text
string
--- LICENSE --- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- README.md --- # Minimal SDL binding for Mojo 🔥 Very basic native Mojo bindings to SDL2. No Python is used at runtime. A Python script to generate different colormaps for the demo is included. ## Usage Requires SDL installed: #### Ubuntu ```bash apt install libsdl2-dev ``` #### Fedora ```bash dnf install sdl2-devel ``` #### Mac OS ```bash brew install sdl2 ``` Copy `SDL.mojo` to your project or try the Mandelbrot demo ported from [Mojo examples](https://github.com/modularml/mojo/tree/main/examples/mandelbrot.mojo) ## Demo Run ```bash mojo mandelbrot.mojo ``` and zoom in/out with the mouse wheel. --- SDL.mojo --- from sys import ffi, info fn get_sdl_lib_path() -> StringLiteral: if (info.os_is_linux()): var lib_path = '/usr/lib/x86_64-linux-gnu/libSDL2.so' try: with open('/etc/os-release', 'r') as f: var release = f.read() if (release.find('Ubuntu') < 0): lib_path = '/usr/lib64/libSDL2.so' except: print("Can't detect Linux version") return lib_path if (info.os_is_macos()): return '/opt/homebrew/lib/libSDL2.dylib' return "" # SDL_PIXELFORMAT_RGBA8888 = # SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, # SDL_PACKEDLAYOUT_8888, 32, 4), alias SDL_PIXELTYPE_PACKED32 = 6 alias SDL_PACKEDORDER_RGBA = 4 alias SDL_PACKEDLAYOUT_8888 = 6 fn SDL_DEFINE_PIXELFORMAT(type: Int, order: Int, layout: Int, bits: Int, bytes: Int) -> Int: return ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | ((bits) << 8) | ((bytes) << 0)) alias SDL_PIXELFORMAT_RGBA8888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_8888, 32, 4) alias SDL_TEXTUREACCESS_TARGET = 2 @register_passable('trivial') struct SDL_Window: pass @register_passable('trivial') struct SDL_Rect: var x: Int32 var y: Int32 var w: Int32 var h: Int32 @register_passable('trivial') struct SDL_PixelFormat: pass @register_passable('trivial') struct SDL_Renderer: pass @register_passable('trivial') struct SDL_Texture: pass @register_passable('trivial') struct SDL_Surface: var flags: UInt32 var format: Pointer[SDL_PixelFormat] var w: Int32 var h: Int32 var pitch: Int32 var pixels: Pointer[UInt32] var userdata: Pointer[Int8] var locked: Int32 var list_blitmap: Pointer[Int8] var clip_rect: SDL_Rect var map: Pointer[Int8] var refcount: Int32 alias SDL_QUIT = 0x100 alias SDL_KEYDOWN = 0x300 alias SDL_KEYUP = 0x301 #alias SDL_ alias SDL_MOUSEMOTION = 0x400 alias SDL_MOUSEBUTTONDOWN = 0x401 alias SDL_MOUSEBUTTONUP = 0x402 alias SDL_MOUSEWHEEL = 0x403 @register_passable('trivial') struct Keysym: var scancode: Int32 var keycode: Int32 var mod: UInt16 var unused: UInt32 @register_passable('trivial') struct MouseMotionEvent: var type: UInt32 var timestamp: UInt32 var windowID: UInt32 var which: UInt32 var state: UInt32 var x: Int32 var y: Int32 var xrel: Int32 var yrel: Int32 @register_passable('trivial') struct MouseButtonEvent: var type: UInt32 var timestamp: UInt32 var windowID: UInt32 var which: UInt32 var button: UInt8 var state: UInt8 var clicks: UInt8 var padding1: UInt8 var x: Int32 var y: Int32 @register_passable('trivial') struct MouseWheelEvent: var type: UInt32 var timestamp: UInt32 var windowID: UInt32 var which: UInt32 var x: Int32 var y: Int32 var direction: UInt32 var preciseX: Float32 var preciseY: Float32 var mouseX: Int32 var mouseY: Int32 @register_passable('trivial') struct Event: var type: Int32 var _padding: SIMD[DType.uint8, 16] var _padding2: Int64 var _padding3: Int64 def __init__() -> Event: return Event { type: 0, _padding: 0, _padding2: 0, _padding3: 0 } #fn __init__(inout self): # self.type = 0 # self._padding = 0 # self._padding2 = 0 # self._padding3 = 0 # self._padding4 = 0 def as_keyboard(self) -> Keyevent: return Pointer.address_of(self).bitcast[Keyevent]().load() def as_mousemotion(self) -> MouseMotionEvent: return Pointer.address_of(self).bitcast[MouseMotionEvent]().load() def as_mousebutton(self) -> MouseButtonEvent: return Pointer.address_of(self).bitcast[MouseButtonEvent]().load() def as_mousewheel(self) -> MouseWheelEvent: return Pointer.address_of(self).bitcast[MouseWheelEvent]().load() #alias Event = Keyevent @register_passable('trivial') struct Keyevent: var type: UInt32 var timestamp: UInt32 var windowID: UInt32 var state: UInt8 var repeat: UInt8 var padding2: UInt8 var padding3: UInt8 var keysym: Keysym def __init__(inout self) -> Self: #self.value = 0 self.timestamp = 0 self.windowID = 0 self.state = 0 self.repeat = 0 self.padding2 = 0 self.padding3 = 0 # SDL.h alias c_SDL_Init = fn(w: Int32) -> Int32 alias c_SDL_Quit = fn() -> None # SDL_video.h alias c_SDL_CreateWindow = fn(DTypePointer[DType.int8], Int32, Int32, Int32, Int32, Int32) -> Pointer[SDL_Window] alias c_SDL_DestroyWindow = fn(Pointer[SDL_Window]) -> None alias c_SDL_GetWindowSurface = fn(s: Pointer[Int8]) -> Pointer[SDL_Surface] alias c_SDL_UpdateWindowSurface = fn(s: Pointer[Int8]) -> Int32 # SDL_pixels.h alias c_SDL_MapRGB = fn(Int32, Int32, Int32, Int32) -> UInt32 # SDL_timer.h alias c_SDL_Delay = fn(Int32) -> UInt32 # SDL_event.h alias c_SDL_PollEvent = fn(Pointer[Event]) -> Int32 # SDL_render.h alias c_SDL_CreateRenderer = fn(Pointer[SDL_Window], Int32, UInt32) -> Pointer[SDL_Renderer] alias c_SDL_CreateWindowAndRenderer = fn(Int32, Int32, UInt32, Pointer[Pointer[Int8]], Pointer[Pointer[SDL_Renderer]]) -> Int32 alias c_SDL_RenderDrawPoint = fn(Pointer[SDL_Renderer], Int32, Int32) -> Int32 alias c_SDL_RenderDrawRect = fn(r: Pointer[SDL_Renderer], rect: Pointer[SDL_Rect]) -> Int32 alias c_SDL_RenderPresent = fn(s: Pointer[SDL_Renderer]) -> Int32 alias c_SDL_RenderClear = fn(s: Pointer[SDL_Renderer]) -> Int32 alias c_SDL_SetRenderDrawColor = fn(Pointer[SDL_Renderer], UInt8, UInt8, UInt8, UInt8) -> Int32 alias SDL_BlendMode = Int alias c_SDL_SetRenderDrawBlendMode = fn(Pointer[SDL_Renderer], SDL_BlendMode) -> Int32 alias c_SDL_SetRenderTarget = fn(r: Pointer[SDL_Renderer], # t: Pointer[SDL_Texture]) -> Int32 t: Int64) -> Int32 alias c_SDL_RenderCopy = fn(r: Pointer[SDL_Renderer], t: Int64, #t: Pointer[SDL_Texture], s: Int64, d: Int64) -> Int32 #s: Pointer[SDL_Rect], d: Pointer[SDL_Rect]) -> Int32 # SDL_surface.h alias c_SDL_FillRect = fn(Pointer[SDL_Surface], Int64, UInt32) -> Int32 # texture alias c_SDL_CreateTexture = fn(Pointer[SDL_Renderer], UInt32, Int32, Int32, Int32) -> Int64 #Pointer[SDL_Texture] alias SDL_WINDOWPOS_UNDEFINED = 0x1FFF0000 alias SDL_WINDOW_SHOWN = 0x00000004 struct SDL: var Init: c_SDL_Init var Quit: c_SDL_Quit var CreateWindow: c_SDL_CreateWindow var DestroyWindow: c_SDL_DestroyWindow var GetWindowSurface: c_SDL_GetWindowSurface var UpdateWindowSurface: c_SDL_UpdateWindowSurface var CreateRenderer: c_SDL_CreateRenderer var CreateWindowAndRenderer: c_SDL_CreateWindowAndRenderer var RenderDrawPoint: c_SDL_RenderDrawPoint var RenderDrawRect: c_SDL_RenderDrawRect var SetRenderDrawColor: c_SDL_SetRenderDrawColor var RenderPresent: c_SDL_RenderPresent var RenderClear: c_SDL_RenderClear var CreateTexture: c_SDL_CreateTexture var SetRenderDrawBlendMode: c_SDL_SetRenderDrawBlendMode var SetRenderTarget: c_SDL_SetRenderTarget var RenderCopy: c_SDL_RenderCopy var MapRGB: c_SDL_MapRGB var FillRect: c_SDL_FillRect var Delay: c_SDL_Delay var PollEvent: c_SDL_PollEvent fn __init__(inout self): print("binding SDL") var lib_path = get_sdl_lib_path() #let SDL = ffi.DLHandle('/usr/lib64/libSDL2.so') var SDL = ffi.DLHandle(lib_path) self.Init = SDL.get_function[c_SDL_Init]('SDL_Init') self.Quit = SDL.get_function[c_SDL_Quit]('SDL_Quit') self.CreateWindow = SDL.get_function[c_SDL_CreateWindow]('SDL_CreateWindow') self.DestroyWindow = SDL.get_function[c_SDL_DestroyWindow]('SDL_DestroyWindow') self.GetWindowSurface = SDL.get_function[c_SDL_GetWindowSurface]('SDL_GetWindowSurface') self.UpdateWindowSurface = SDL.get_function[c_SDL_UpdateWindowSurface]('SDL_UpdateWindowSurface') self.CreateRenderer = SDL.get_function[c_SDL_CreateRenderer]('SDL_CreateRenderer') self.CreateWindowAndRenderer = SDL.get_function[c_SDL_CreateWindowAndRenderer]('SDL_CreateWindowAndRenderer') self.RenderDrawPoint = SDL.get_function[c_SDL_RenderDrawPoint]('SDL_RenderDrawPoint') self.RenderDrawRect = SDL.get_function[c_SDL_RenderDrawRect]('SDL_RenderDrawRect') self.SetRenderDrawColor = SDL.get_function[c_SDL_SetRenderDrawColor]('SDL_SetRenderDrawColor') self.RenderPresent = SDL.get_function[c_SDL_RenderPresent]('SDL_RenderPresent') self.RenderClear = SDL.get_function[c_SDL_RenderClear]('SDL_RenderClear') self.SetRenderDrawBlendMode = SDL.get_function[c_SDL_SetRenderDrawBlendMode]('SDL_SetRenderDrawBlendMode') self.SetRenderTarget = SDL.get_function[c_SDL_SetRenderTarget]('SDL_SetRenderTarget') self.RenderCopy = SDL.get_function[c_SDL_RenderCopy]('SDL_RenderCopy') self.CreateTexture = SDL.get_function[c_SDL_CreateTexture]('SDL_CreateTexture') self.MapRGB = SDL.get_function[c_SDL_MapRGB]('SDL_MapRGB') self.FillRect = SDL.get_function[c_SDL_FillRect]('SDL_FillRect') self.Delay = SDL.get_function[c_SDL_Delay]('SDL_Delay') self.PollEvent = SDL.get_function[c_SDL_PollEvent]('SDL_PollEvent') --- cmap.mojo --- alias vec3 = StaticTuple[3] alias cmap = StaticTuple[256] ( vec3(0, 0, 0), vec3(2, 0, 0), vec3(4, 0, 0), vec3(6, 0, 0), vec3(8, 0, 0), vec3(10, 0, 0), vec3(12, 0, 0), vec3(14, 0, 0), vec3(16, 0, 0), vec3(18, 0, 0), vec3(20, 0, 0), vec3(22, 0, 0), vec3(24, 0, 0), vec3(26, 0, 0), vec3(28, 0, 0), vec3(30, 0, 0), vec3(32, 0, 0), vec3(34, 0, 0), vec3(36, 0, 0), vec3(38, 0, 0), vec3(40, 0, 0), vec3(42, 0, 0), vec3(44, 0, 0), vec3(46, 0, 0), vec3(48, 0, 0), vec3(50, 0, 0), vec3(52, 0, 0), vec3(54, 0, 0), vec3(56, 0, 0), vec3(58, 0, 0), vec3(60, 0, 0), vec3(62, 0, 0), vec3(64, 0, 0), vec3(65, 0, 0), vec3(68, 0, 0), vec3(70, 0, 0), vec3(72, 0, 0), vec3(73, 0, 0), vec3(76, 0, 0), vec3(78, 0, 0), vec3(80, 0, 0), vec3(81, 0, 0), vec3(84, 0, 0), vec3(86, 0, 0), vec3(88, 0, 0), vec3(89, 0, 0), vec3(92, 0, 0), vec3(94, 0, 0), vec3(96, 0, 0), vec3(97, 0, 0), vec3(100, 0, 0), vec3(102, 0, 0), vec3(104, 0, 0), vec3(105, 0, 0), vec3(108, 0, 0), vec3(110, 0, 0), vec3(112, 0, 0), vec3(113, 0, 0), vec3(116, 0, 0), vec3(118, 0, 0), vec3(120, 0, 0), vec3(121, 0, 0), vec3(124, 0, 0), vec3(126, 0, 0), vec3(128, 0, 0), vec3(130, 2, 0), vec3(131, 4, 0), vec3(134, 6, 0), vec3(136, 8, 0), vec3(138, 10, 0), vec3(140, 12, 0), vec3(142, 14, 0), vec3(144, 16, 0), vec3(146, 18, 0), vec3(147, 20, 0), vec3(150, 22, 0), vec3(152, 24, 0), vec3(154, 26, 0), vec3(156, 28, 0), vec3(158, 30, 0), vec3(160, 32, 0), vec3(162, 34, 0), vec3(163, 36, 0), vec3(166, 38, 0), vec3(168, 40, 0), vec3(170, 42, 0), vec3(172, 44, 0), vec3(174, 46, 0), vec3(176, 48, 0), vec3(178, 50, 0), vec3(179, 52, 0), vec3(182, 54, 0), vec3(184, 56, 0), vec3(186, 58, 0), vec3(188, 60, 0), vec3(190, 62, 0), vec3(192, 64, 0), vec3(194, 66, 0), vec3(195, 68, 0), vec3(198, 70, 0), vec3(200, 72, 0), vec3(202, 74, 0), vec3(204, 76, 0), vec3(206, 78, 0), vec3(208, 80, 0), vec3(210, 82, 0), vec3(211, 84, 0), vec3(214, 86, 0), vec3(216, 88, 0), vec3(218, 90, 0), vec3(220, 92, 0), vec3(222, 94, 0), vec3(224, 96, 0), vec3(226, 98, 0), vec3(227, 100, 0), vec3(230, 102, 0), vec3(232, 104, 0), vec3(234, 106, 0), vec3(236, 108, 0), vec3(238, 110, 0), vec3(240, 112, 0), vec3(242, 114, 0), vec3(243, 116, 0), vec3(246, 118, 0), vec3(248, 120, 0), vec3(250, 122, 0), vec3(252, 124, 0), vec3(254, 126, 0), vec3(255, 128, 0), vec3(255, 130, 2), vec3(255, 132, 4), vec3(255, 134, 6), vec3(255, 136, 8), vec3(255, 138, 11), vec3(255, 140, 13), vec3(255, 142, 15), vec3(255, 144, 16), vec3(255, 146, 18), vec3(255, 148, 20), vec3(255, 150, 22), vec3(255, 152, 25), vec3(255, 154, 27), vec3(255, 156, 29), vec3(255, 158, 31), vec3(255, 160, 32), vec3(255, 162, 34), vec3(255, 164, 36), vec3(255, 166, 38), vec3(255, 168, 40), vec3(255, 170, 43), vec3(255, 172, 45), vec3(255, 174, 47), vec3(255, 176, 48), vec3(255, 178, 50), vec3(255, 180, 52), vec3(255, 182, 54), vec3(255, 184, 57), vec3(255, 186, 59), vec3(255, 188, 61), vec3(255, 190, 63), vec3(255, 192, 65), vec3(255, 194, 66), vec3(255, 196, 68), vec3(255, 198, 70), vec3(255, 200, 72), vec3(255, 202, 75), vec3(255, 204, 77), vec3(255, 206, 79), vec3(255, 208, 81), vec3(255, 210, 82), vec3(255, 212, 84), vec3(255, 214, 86), vec3(255, 216, 89), vec3(255, 218, 91), vec3(255, 220, 93), vec3(255, 222, 95), vec3(255, 224, 97), vec3(255, 226, 98), vec3(255, 228, 100), vec3(255, 230, 102), vec3(255, 232, 104), vec3(255, 234, 107), vec3(255, 236, 109), vec3(255, 238, 111), vec3(255, 240, 113), vec3(255, 242, 114), vec3(255, 244, 116), vec3(255, 246, 118), vec3(255, 248, 121), vec3(255, 250, 123), vec3(255, 252, 125), vec3(255, 254, 127), vec3(255, 255, 129), vec3(255, 255, 131), vec3(255, 255, 132), vec3(255, 255, 134), vec3(255, 255, 136), vec3(255, 255, 139), vec3(255, 255, 141), vec3(255, 255, 143), vec3(255, 255, 145), vec3(255, 255, 147), vec3(255, 255, 148), vec3(255, 255, 150), vec3(255, 255, 153), vec3(255, 255, 155), vec3(255, 255, 157), vec3(255, 255, 159), vec3(255, 255, 161), vec3(255, 255, 163), vec3(255, 255, 164), vec3(255, 255, 166), vec3(255, 255, 168), vec3(255, 255, 171), vec3(255, 255, 173), vec3(255, 255, 175), vec3(255, 255, 177), vec3(255, 255, 179), vec3(255, 255, 180), vec3(255, 255, 182), vec3(255, 255, 185), vec3(255, 255, 187), vec3(255, 255, 189), vec3(255, 255, 191), vec3(255, 255, 193), vec3(255, 255, 195), vec3(255, 255, 196), vec3(255, 255, 198), vec3(255, 255, 200), vec3(255, 255, 203), vec3(255, 255, 205), vec3(255, 255, 207), vec3(255, 255, 209), vec3(255, 255, 211), vec3(255, 255, 212), vec3(255, 255, 214), vec3(255, 255, 217), vec3(255, 255, 219), vec3(255, 255, 221), vec3(255, 255, 223), vec3(255, 255, 225), vec3(255, 255, 227), vec3(255, 255, 228), vec3(255, 255, 230), vec3(255, 255, 232), vec3(255, 255, 235), vec3(255, 255, 237), vec3(255, 255, 239), vec3(255, 255, 241), vec3(255, 255, 243), vec3(255, 255, 244), vec3(255, 255, 246), vec3(255, 255, 249), vec3(255, 255, 251), vec3(255, 255, 253), vec3(255, 255, 255), ) --- gencmap.py --- #!/usr/bin/env python3 import sys import matplotlib as mpl cmap_name = 'afmhot' if len(sys.argv) > 1: cmap_name = sys.argv[1] cmap8bit = mpl.colormaps[cmap_name].resampled(256) print("alias vec3 = StaticTuple[3]") print("alias cmap = StaticTuple[256] (") for i in range(256): c = cmap8bit(i) print(f'vec3({int(c[0]*255)}, {int(c[1]*255)}, {int(c[2]*255)}),') print(')') --- mandelbrot.mojo --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import benchmark from complex import ComplexSIMD, ComplexFloat64 from math import iota, clamp, log, pow from python import Python from algorithm import parallelize, vectorize from tensor import Tensor from utils.index import Index from memory.unsafe import bitcast from SDL import * from cmap import cmap alias float_type = DType.float64 alias simd_width = 2 * simdwidthof[float_type]() alias width = 480 alias height = 480 alias MAX_ITERS = 500 alias MIN_X = -2.0 alias MAX_X = 0.6 alias MIN_Y = -1.5 alias MAX_Y = 1.5 @no_inline fn mandelbrot_kernel_SIMD[ simd_width: Int ](c: ComplexSIMD[float_type, simd_width]) -> SIMD[float_type, simd_width]: """A vectorized implementation of the inner mandelbrot computation.""" var cx = c.re var cy = c.im var x = SIMD[float_type, simd_width](0) var y = SIMD[float_type, simd_width](0) var y2 = SIMD[float_type, simd_width](0) var iters = SIMD[float_type, simd_width](0) var t: SIMD[DType.bool, simd_width] = True for i in range(MAX_ITERS): if not t.reduce_or(): break y2 = y * y y = x.fma(y + y, cy) t = x.fma(x, y2) <= 4 x = x.fma(x, cx - y2) iters = t.select(iters + 1, iters) return iters fn main() raises: var t = Tensor[float_type](height, width) var min_x: Float64 = MIN_X var max_x: Float64 = MAX_X var min_y: Float64 = MIN_Y var max_y: Float64 = MAX_Y @parameter @no_inline fn worker(row: Int): var scale_x = (max_x - min_x) / width var scale_y = (max_y - min_y) / height #print(scale_x) @parameter @no_inline fn compute_vector[simd_width: Int](col: Int): """Each time we operate on a `simd_width` vector of pixels.""" var cx = min_x + (col + iota[float_type, simd_width]()) * scale_x var cy = min_y + row * scale_y var c = ComplexSIMD[float_type, simd_width](cx, cy) t.data().simd_store[simd_width]( row * width + col, mandelbrot_kernel_SIMD[simd_width](c) ) # Vectorize the call to compute_vector where call gets a chunk of pixels. vectorize[compute_vector, simd_width, width](width) _ = t # Make sure tensor isn't destroyed before benchmark is finished var sdl = SDL() var res = sdl.Init(0x00000020) var window = sdl.CreateWindow(StringRef("Mandelbrot").data, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_SHOWN) var renderer = sdl.CreateRenderer(window, -1, 0) var display = sdl.CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, width, height) _ = sdl.SetRenderTarget(renderer, display) fn redraw(sdl: SDL, t: Tensor[float_type]) raises: var gamma: Float64 = 0.3 var cpow_max = pow(Float64(MAX_ITERS),gamma) _ = sdl.SetRenderTarget(renderer, display) for y in range(t.shape()[1]): for x in range(t.shape()[0]): var val = t[x,y] var cpow = pow(val, gamma) var color = cmap[(255.0*cpow/cpow_max).to_int()] var r = color[0] var g = color[1] var b = color[2] _ = sdl.SetRenderDrawColor(renderer, r, g, b, 255) _ = sdl.RenderDrawPoint(renderer, y, x) _ = sdl.SetRenderTarget(renderer, 0) _ = sdl.RenderCopy(renderer, display, 0, 0) _ = sdl.RenderPresent(renderer) var event = Event() fn screen_to_world(sx: Int32, sy: Int32, inout wx: Float64, inout wy: Float64): var fsx = sx.cast[DType.float64]() var fsy = sy.cast[DType.float64]() wx = (max_x - min_x) * fsx/Float64(width) + min_x wy = (max_y - min_y) * fsy/Float64(height) + min_y var running = True var dirty = True while running: while sdl.PollEvent(Pointer[Event].address_of(event)) != 0: if (event.type == SDL_MOUSEWHEEL): var mwe = event.as_mousewheel() #print(mwe.preciseX, mwe.preciseY) var scale = (1 + mwe.preciseY.cast[DType.float64]() / 20.0) min_x = (min_x * scale) max_x = (max_x * scale) min_y = (min_y * scale) max_y = (max_y * scale) dirty = True if (event.type == SDL_QUIT): running = False break if dirty: parallelize[worker](height, height) dirty = False redraw(sdl, t) _= sdl.Delay((1000 / 120).to_int()) _ = t sdl.DestroyWindow(window) sdl.Quit() --- .github/workflows/mojopkgscript.yaml --- name: Build and Release # define your mojo package name here # set the path to the directory containing the module files env: PACKAGE_NAME: mojopackage.mojopkg MOJO_DIR: src MOJO_HOME: /home/runner/.modular/pkg/packages.modular.com_mojo/bin on: push: branches: [ main ] pull_request: branches: [ main ] workflow_dispatch: branches: [ main ] jobs: build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - name: Install dependencies run: | curl https://get.modular.com | MODULAR_AUTH=${{ secrets.MODULAR_API }} sh - modular install mojo - name: Build run: | ${{ env.MOJO_HOME }}/mojo package ${{ env.MOJO_DIR }} -o ${{ github.workspace }}/${{ env.PACKAGE_NAME }} - name: Upload package uses: actions/upload-artifact@v3 with: name: ${{ env.PACKAGE_NAME }} path: ${{ github.workspace }}/${{ env.PACKAGE_NAME }} --- README.md --- ## Packaging 📦 Mojo 🔥 via GitHub Action Script This Repository shows how to use a simple GitHub Action script for compiling a mojo directory into a package 📦. You can find the action script here --> [Action Script](./.github/workflows/mojopkgscript.yaml). To use this action script in your own workflow be sure to set your own GitHub secret for the Mojo API key. How to set a GitHub secret can be found [here](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). The variable used in the Action script for your API is 'MODULAR_API'. Be sure to use the same name or change the variable name in the script. * Set the package name in the `PACKAGE_NAME` environment variable. * Set your path of the directory to be packaged in the `MOJO_DIR` environment variable. Everytime you push to the repository the action script will compile the mojo directory into a package and upload it as an artifact in the GitHub workflow. From there users can download the package and use it in hteir own code base. You can modify this script with additional actions for release deploys on the GitHub Release page. The `testpkg.mojo` file is a simple mojo that uses the compiled package to call a function. You can read more about packaging at the Modular documentation page found [here](https://docs.modular.com/mojo/manual/get-started/packages.html) --- src/__init__.mojo --- --- src/mojopkg.mojo --- fn add(a: Int, b: Int) -> Int: return a + b --- testpkg.mojo --- # This file can only executed without error after building the mojopackage from mojopackage.mojopkg import add fn main(): let res = add(1, 2) print(res) --- .github/workflows/build.yml --- name: Build and Release env: PACKAGE_NAME: morrow.mojopkg MORROW_SRC: morrow on: workflow_dispatch jobs: build: runs-on: ubuntu-22.04 steps: - name: Check out repository code uses: actions/checkout@v2 - name: Install dependencies run: | curl https://get.modular.com | MODULAR_AUTH=${{ secrets.MODULAR_AUTH }} sh - modular auth ${{ secrets.MODULAR_AUTH }} python3 -m venv ~/max-venv && source ~/max-venv/bin/activate modular install max MAX_PATH=$(modular config max.path) \ && python3 -m pip install --find-links $MAX_PATH/wheels max-engine MAX_PATH=$(modular config max.path) \ && BASHRC=$( [ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc" ) \ && echo 'export MODULAR_HOME="'$HOME'/.modular"' >> "$BASHRC" \ && echo 'export PATH="'$MAX_PATH'/bin:$PATH"' >> "$BASHRC" \ && source "$BASHRC" - name: Build run: | MAX_PATH=$(modular config max.path) \ && BASHRC=$( [ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc" ) \ && echo 'export MODULAR_HOME="'$HOME'/.modular"' >> "$BASHRC" \ && echo 'export PATH="'$MAX_PATH'/bin:$PATH"' >> "$BASHRC" \ && source "$BASHRC" mojo package ${{ env.MORROW_SRC }} -o ${{ github.workspace }}/${{ env.PACKAGE_NAME }} - name: Upload package uses: actions/upload-artifact@v3 with: name: ${{ env.PACKAGE_NAME }} path: ${{ github.workspace }}/${{ env.PACKAGE_NAME }} --- .github/workflows/test.yml --- name: Run Tests on: [pull_request, push] env: PACKAGE_NAME: morrow.mojopkg MORROW_SRC: morrow jobs: test: runs-on: ubuntu-22.04 steps: - name: Check out repository code uses: actions/checkout@v2 - name: Install dependencies run: | curl https://get.modular.com | MODULAR_AUTH=${{ secrets.MODULAR_AUTH }} sh - modular auth ${{ secrets.MODULAR_AUTH }} python3 -m venv ~/max-venv && source ~/max-venv/bin/activate modular install max MAX_PATH=$(modular config max.path) \ && python3 -m pip install --find-links $MAX_PATH/wheels max-engine - name: Test run: | MAX_PATH=$(modular config max.path) \ && BASHRC=$( [ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc" ) \ && echo 'export MODULAR_HOME="'$HOME'/.modular"' >> "$BASHRC" \ && echo 'export PATH="'$MAX_PATH'/bin:$PATH"' >> "$BASHRC" \ && source "$BASHRC" mojo run test.mojo --- .gitignore --- .vscode .idea --- LICENSE --- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- Makefile --- test: mojo run test.mojo format: mojo format . build: mojo package morrow -o morrow.mojopkg --- README.md --- # Morrow.mojo: Human-friendly date & time for Mojo 🔥 <p align="center"> <a href="https://github.com/mojoto/morrow.mojo/actions/workflows/test.yml"> <img src="https://github.com/mojoto/morrow.mojo/actions/workflows/test.yml/badge.svg" alt="Test" /> </a> <a href="https://github.com/mojoto/morrow.mojo/releases"> <img alt="GitHub release" src="https://img.shields.io/github/v/release/mojoto/morrow.mojo"> </a> </p> **Morrow** is a Mojo library that provides human-friendly method for managing, formatting, and transforming dates, times, and timestamps. Morrow is heavily inspired by [arrow](https://github.com/arrow-py/arrow), and thanks for its elegant design. ## Features - TimeZone-aware and UTC by default. - Support format and parse strings. - Support for the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. ## Preparation You have three ways to reference this library: - Download morrow.mojopkg from [releases](https://github.com/mojoto/morrow.mojo/releases). - Clone this project and execute `make build` to build morrow.mojopkg. - Directly copy the `morrow` directory of this project to your own project. ## Usage ```python from morrow import Morrow, TimeZone # Get local date and time. var now = Morrow.now() print(str(now)) # 2023-10-01T20:10:25.188957+08:00 # Get UTC date and time. var utcnow = Morrow.utcnow() print(str(utcnow)) # 2023-10-01T20:10:25.954638+00:00 # Get local time from POSIX timestamp. var t = Morrow.fromtimestamp(1696089600) print(str(t)) # 2023-10-01T00:00:00.000000+08:00 # Get UTC time from POSIX timestamp. var utc_t = Morrow.utcfromtimestamp(1696089600) print(str(utc_t)) # 2023-09-30T16:00:00.000000+00:00 # Get ISO format. var m = Morrow(2023, 10, 1, 0, 0, 0, 1234) print(m.isoformat()) # 2023-10-01T00:00:00.001234 # custom format var m = Morrow(2023, 10, 1, 0, 0, 0, 1234) print(m.format("YYYY-MM-DD HH:mm:ss.SSSSSS ZZ")) # 2023-10-01 00:00:00.001234 +00:00 print(m.format("dddd, DD MMM YYYY HH:mm:ss ZZZ")) # Sunday, 01 Oct 2023 00:00:00 UTC print(m.format("YYYY[Y]MM[M]DD[D]")) # 2023Y10M01D # Get ISO format with time zone. var m_beijing = Morrow(2023, 10, 1, 0, 0, 0, 1234, TimeZone(28800, 'Bejing')) print(m_beijing.isoformat(timespec="seconds")) # 2023-10-01T00:00:00+08:00 # Get time zone offset. print(TimeZone.from_utc('UTC+08:00').offset) # 28800 # Subtract two dates. var timedelta = Morrow(2023, 10, 2, 10, 0, 0) - Morrow(2023, 10, 1, 10, 0, 0) print(str(timedelta)) # 1 day, 0:00:00 # Return proleptic Gregorian ordinal for the year, month and day. var m_10_1 = Morrow(2023, 10, 1) var ordinal = m_10_1.toordinal() print(ordinal) # 738794 # Construct a Morrow from a proleptic Gregorian ordinal. var m_10_1_ = Morrow.fromordinal(ordinal) print(str(m_10_1_)) # 2023-10-01T00:00:00.000000 # Convert Morrow to python datetime var py_dt = now.to_py() print(py_dt.isoformat()) # 2023-10-01T20:10:25.188957 # Convert python datetime to Morrow var m_from_py = Morrow.from_py(py_dt) print(m_from_py) # 2023-10-01T20:10:25.188957 ``` --- morrow/__init__.mojo --- from .morrow import Morrow from .timezone import TimeZone from .timedelta import TimeDelta alias __version__ = "0.4.0" --- morrow/_libc.mojo --- from memory.unsafe import Pointer alias c_void = UInt8 alias c_char = UInt8 alias c_schar = Int8 alias c_uchar = UInt8 alias c_short = Int16 alias c_ushort = UInt16 alias c_int = Int32 alias c_uint = UInt32 alias c_long = Int64 alias c_ulong = UInt64 alias c_float = Float32 alias c_double = Float64 @value @register_passable("trivial") struct CTimeval: var tv_sec: Int # Seconds var tv_usec: Int # Microseconds fn __init__(tv_sec: Int = 0, tv_usec: Int = 0) -> Self: return Self {tv_sec: tv_sec, tv_usec: tv_usec} @value @register_passable("trivial") struct CTm: var tm_sec: Int32 # Seconds var tm_min: Int32 # Minutes var tm_hour: Int32 # Hour var tm_mday: Int32 # Day of the month var tm_mon: Int32 # Month var tm_year: Int32 # Year minus 1900 var tm_wday: Int32 # Day of the week var tm_yday: Int32 # Day of the year var tm_isdst: Int32 # Daylight savings flag var tm_gmtoff: Int64 # localtime zone offset seconds fn __init__() -> Self: return Self { tm_sec: 0, tm_min: 0, tm_hour: 0, tm_mday: 0, tm_mon: 0, tm_year: 0, tm_wday: 0, tm_yday: 0, tm_isdst: 0, tm_gmtoff: 0, } @always_inline fn c_gettimeofday() -> CTimeval: var tv = CTimeval() var p_tv = Pointer[CTimeval].address_of(tv) external_call["gettimeofday", NoneType, Pointer[CTimeval], Int32](p_tv, 0) return tv @always_inline fn c_localtime(owned tv_sec: Int) -> CTm: var p_tv_sec = Pointer[Int].address_of(tv_sec) var tm = external_call["localtime", Pointer[CTm], Pointer[Int]](p_tv_sec).load() return tm @always_inline fn c_strptime(time_str: String, time_format: String) -> CTm: var tm = CTm() var p_tm = Pointer[CTm].address_of(tm) external_call["strptime", NoneType, Pointer[c_char], Pointer[c_char], Pointer[CTm]]( to_char_ptr(time_str), to_char_ptr(time_format), p_tm ) return tm @always_inline fn c_gmtime(owned tv_sec: Int) -> CTm: var p_tv_sec = Pointer[Int].address_of(tv_sec) var tm = external_call["gmtime", Pointer[CTm], Pointer[Int]](p_tv_sec).load() return tm fn to_char_ptr(s: String) -> Pointer[c_char]: """Only ASCII-based strings.""" var ptr = Pointer[c_char]().alloc(len(s)) for i in range(len(s)): ptr.store(i, ord(s[i])) return ptr --- morrow/_py.mojo --- from python import Python fn py_dt_datetime() raises -> PythonObject: var _datetime = Python.import_module("datetime") return _datetime.datetime fn py_time() raises -> PythonObject: var _time = Python.import_module("time") return _time --- morrow/constants.mojo --- from utils import StaticTuple # todo: hardcode for tmp alias _MAX_TIMESTAMP: Int = 32503737600 alias MAX_TIMESTAMP = _MAX_TIMESTAMP alias MAX_TIMESTAMP_MS = MAX_TIMESTAMP * 1000 alias MAX_TIMESTAMP_US = MAX_TIMESTAMP * 1_000_000 alias _DAYS_IN_MONTH = VariadicList[Int]( -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ) alias _DAYS_BEFORE_MONTH = VariadicList[Int]( -1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ) # -1 is a placeholder for indexing purposes. alias MONTH_NAMES = StaticTuple[StringLiteral, 13]( "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ) alias MONTH_ABBREVIATIONS = StaticTuple[StringLiteral, 13]( "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ) alias DAY_NAMES = StaticTuple[StringLiteral, 8]( "", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", ) alias DAY_ABBREVIATIONS = StaticTuple[StringLiteral, 8]( "", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" ) --- morrow/formatter.mojo --- from collections.vector import InlinedFixedVector from utils.static_tuple import StaticTuple from .util import rjust from .constants import MONTH_NAMES, MONTH_ABBREVIATIONS, DAY_NAMES, DAY_ABBREVIATIONS from .timezone import UTC_TZ alias formatter = _Formatter() struct _Formatter: var _sub_chrs: InlinedFixedVector[Int, 128] fn __init__(inout self): self._sub_chrs = InlinedFixedVector[Int, 128](0) for i in range(128): self._sub_chrs[i] = 0 self._sub_chrs[_Y] = 4 self._sub_chrs[_M] = 4 self._sub_chrs[_D] = 2 self._sub_chrs[_d] = 4 self._sub_chrs[_H] = 2 self._sub_chrs[_h] = 2 self._sub_chrs[_m] = 2 self._sub_chrs[_s] = 2 self._sub_chrs[_S] = 6 self._sub_chrs[_Z] = 3 self._sub_chrs[_A] = 1 self._sub_chrs[_a] = 1 fn format(self, m: Morrow, fmt: String) raises -> String: """ "YYYY[abc]MM" -> repalce("YYYY") + "abc" + replace("MM") """ if len(fmt) == 0: return "" var ret: String = "" var in_bracket = False var start_idx = 0 for i in range(len(fmt)): if fmt[i] == "[": if in_bracket: ret += "[" else: in_bracket = True ret += self.replace(m, fmt[start_idx:i]) start_idx = i + 1 elif fmt[i] == "]": if in_bracket: ret += fmt[start_idx:i] in_bracket = False else: ret += self.replace(m, fmt[start_idx:i]) ret += "]" start_idx = i + 1 if in_bracket: ret += "[" if start_idx < len(fmt): ret += self.replace(m, fmt[start_idx:]) return ret fn replace(self, m: Morrow, s: String) raises -> String: """ split token and replace """ if len(s) == 0: return "" var ret: String = "" var match_chr_ord = 0 var match_count = 0 for i in range(len(s)): var c = ord(s[i]) if 0 < c < 128 and self._sub_chrs[c] > 0: if c == match_chr_ord: match_count += 1 else: ret += self.replace_token(m, match_chr_ord, match_count) match_chr_ord = c match_count = 1 if match_count == self._sub_chrs[c]: ret += self.replace_token(m, match_chr_ord, match_count) match_chr_ord = 0 else: if match_chr_ord > 0: ret += self.replace_token(m, match_chr_ord, match_count) match_chr_ord = 0 ret += s[i] if match_chr_ord > 0: ret += self.replace_token(m, match_chr_ord, match_count) return ret fn replace_token(self, m: Morrow, token: Int, token_count: Int) raises -> String: if token == _Y: if token_count == 1: return "Y" if token_count == 2: return rjust(m.year, 4, "0")[2:4] if token_count == 4: return rjust(m.year, 4, "0") elif token == _M: if token_count == 1: return String(m.month) if token_count == 2: return rjust(m.month, 2, "0") if token_count == 3: return String(MONTH_ABBREVIATIONS[m.month]) if token_count == 4: return String(MONTH_NAMES[m.month]) elif token == _D: if token_count == 1: return String(m.day) if token_count == 2: return rjust(m.day, 2, "0") elif token == _H: if token_count == 1: return String(m.hour) if token_count == 2: return rjust(m.hour, 2, "0") elif token == _h: var h_12 = m.hour if m.hour > 12: h_12 -= 12 if token_count == 1: return String(h_12) if token_count == 2: return rjust(h_12, 2, "0") elif token == _m: if token_count == 1: return String(m.minute) if token_count == 2: return rjust(m.minute, 2, "0") elif token == _s: if token_count == 1: return String(m.second) if token_count == 2: return rjust(m.second, 2, "0") elif token == _S: if token_count == 1: return String(m.microsecond // 100000) if token_count == 2: return rjust(m.microsecond // 10000, 2, "0") if token_count == 3: return rjust(m.microsecond // 1000, 3, "0") if token_count == 4: return rjust(m.microsecond // 100, 4, "0") if token_count == 5: return rjust(m.microsecond // 10, 5, "0") if token_count == 6: return rjust(m.microsecond, 6, "0") elif token == _d: if token_count == 1: return String(m.isoweekday()) if token_count == 3: return String(DAY_ABBREVIATIONS[m.isoweekday()]) if token_count == 4: return String(DAY_NAMES[m.isoweekday()]) elif token == _Z: if token_count == 3: return UTC_TZ.name if m.tz.is_none() else m.tz.name var separator = "" if token_count == 1 else ":" if m.tz.is_none(): return UTC_TZ.format(separator) else: return m.tz.format(separator) elif token == _a: return "am" if m.hour < 12 else "pm" elif token == _A: return "AM" if m.hour < 12 else "PM" return "" alias _Y = ord("Y") alias _M = ord("M") alias _D = ord("D") alias _d = ord("d") alias _H = ord("H") alias _h = ord("h") alias _m = ord("m") alias _s = ord("s") alias _S = ord("S") alias _X = ord("X") alias _x = ord("x") alias _Z = ord("Z") alias _A = ord("A") alias _a = ord("a") --- morrow/morrow.mojo --- from ._py import py_dt_datetime from .util import normalize_timestamp, rjust, _ymd2ord, _days_before_year from ._libc import c_gettimeofday, c_localtime, c_gmtime, c_strptime from ._libc import CTimeval, CTm from .timezone import TimeZone from .timedelta import TimeDelta from .formatter import formatter from .constants import _DAYS_BEFORE_MONTH, _DAYS_IN_MONTH from python.object import PythonObject from python import Python alias _DI400Y = 146097 # number of days in 400 years alias _DI100Y = 36524 # " " " " 100 " alias _DI4Y = 1461 # " " " " 4 " @value struct Morrow(StringableRaising): var year: Int var month: Int var day: Int var hour: Int var minute: Int var second: Int var microsecond: Int var tz: TimeZone fn __init__( inout self, year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Int = 0, microsecond: Int = 0, tz: TimeZone = TimeZone.none(), ) raises: self.year = year self.month = month self.day = day self.hour = hour self.minute = minute self.second = second self.microsecond = microsecond self.tz = tz @staticmethod fn now() raises -> Self: var t = c_gettimeofday() return Self._fromtimestamp(t, False) @staticmethod fn utcnow() raises -> Self: var t = c_gettimeofday() return Self._fromtimestamp(t, True) @staticmethod fn _fromtimestamp(t: CTimeval, utc: Bool) raises -> Self: var tm: CTm var tz: TimeZone if utc: tm = c_gmtime(t.tv_sec) tz = TimeZone(0, "UTC") else: tm = c_localtime(t.tv_sec) tz = TimeZone(int(tm.tm_gmtoff), "local") var result = Self( int(tm.tm_year) + 1900, int(tm.tm_mon) + 1, int(tm.tm_mday), int(tm.tm_hour), int(tm.tm_min), int(tm.tm_sec), t.tv_usec, tz, ) return result @staticmethod fn fromtimestamp(timestamp: Float64) raises -> Self: var timestamp_ = normalize_timestamp(timestamp) var t = CTimeval(int(timestamp_)) return Self._fromtimestamp(t, False) @staticmethod fn utcfromtimestamp(timestamp: Float64) raises -> Self: var timestamp_ = normalize_timestamp(timestamp) var t = CTimeval(int(timestamp_)) return Self._fromtimestamp(t, True) @staticmethod fn strptime( date_str: String, fmt: String, tzinfo: TimeZone = TimeZone.none() ) raises -> Self: """ Create a Morrow instance from a date string and format, in the style of ``datetime.strptime``. Optionally replaces the parsed TimeZone. Usage:: >>> Morrow.strptime('20-01-2019 15:49:10', '%d-%m-%Y %H:%M:%S') <Morrow [2019-01-20T15:49:10+00:00]> """ var tm = c_strptime(date_str, fmt) var tz = TimeZone(int(tm.tm_gmtoff)) if tzinfo.is_none() else tzinfo return Self( int(tm.tm_year) + 1900, int(tm.tm_mon) + 1, int(tm.tm_mday), int(tm.tm_hour), int(tm.tm_min), int(tm.tm_sec), 0, tz, ) @staticmethod fn strptime(date_str: String, fmt: String, tz_str: String) raises -> Self: """ Create a Morrow instance by time_zone_string with utc format. Usage:: >>> Morrow.strptime('20-01-2019 15:49:10', '%d-%m-%Y %H:%M:%S', '+08:00') <Morrow [2019-01-20T15:49:10+08:00]> """ var tzinfo = TimeZone.from_utc(tz_str) return Self.strptime(date_str, fmt, tzinfo) fn format(self, fmt: String = "YYYY-MM-DD HH:mm:ss ZZ") raises -> String: """Returns a string representation of the `Morrow` formatted according to the provided format string. :param fmt: the format string. Usage:: >>> var m = Morrow.now() >>> m.format('YYYY-MM-DD HH:mm:ss ZZ') '2013-05-09 03:56:47 -00:00' >>> m.format('MMMM DD, YYYY') 'May 09, 2013' >>> m.format() '2013-05-09 03:56:47 -00:00' """ return formatter.format(self, fmt) fn isoformat( self, sep: String = "T", timespec: StringLiteral = "auto" ) raises -> String: """Return the time formatted according to ISO. The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'. If self.tzinfo is not None, the UTC offset is also attached, giving giving a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'. Optional argument sep specifies the separator between date and time, default 'T'. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are 'auto', 'hours', 'minutes', 'seconds', 'milliseconds' and 'microseconds'. """ var date_str = ( rjust(self.year, 4, "0") + "-" + rjust(self.month, 2, "0") + "-" + rjust(self.day, 2, "0") ) var time_str = String("") if timespec == "auto" or timespec == "microseconds": time_str = ( rjust(self.hour, 2, "0") + ":" + rjust(self.minute, 2, "0") + ":" + rjust(self.second, 2, "0") + "." + rjust(self.microsecond, 6, "0") ) elif timespec == "milliseconds": time_str = ( rjust(self.hour, 2, "0") + ":" + rjust(self.minute, 2, "0") + ":" + rjust(self.second, 2, "0") + "." + rjust(self.microsecond // 1000, 3, "0") ) elif timespec == "seconds": time_str = ( rjust(self.hour, 2, "0") + ":" + rjust(self.minute, 2, "0") + ":" + rjust(self.second, 2, "0") ) elif timespec == "minutes": time_str = rjust(self.hour, 2, "0") + ":" + rjust(self.minute, 2, "0") elif timespec == "hours": time_str = rjust(self.hour, 2, "0") else: raise Error() if self.tz.is_none(): return sep.join(date_str, time_str) else: return sep.join(date_str, time_str) + self.tz.format() fn toordinal(self) raises -> Int: """Return proleptic Gregorian ordinal for the year, month and day. January 1 of year 1 is day 1. Only the year, month and day values contribute to the result. """ return _ymd2ord(self.year, self.month, self.day) @staticmethod fn fromordinal(ordinal: Int) raises -> Self: """Construct a Morrow from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result. """ # n is a 1-based index, starting at 1-Jan-1. The pattern of leap years # repeats exactly every 400 years. The basic strategy is to find the # closest 400-year boundary at or before n, then work with the offset # from that boundary to n. Life is much clearer if we subtract 1 from # n first -- then the values of n at 400-year boundaries are exactly # those divisible by _DI400Y: # # D M Y n n-1 # -- --- ---- ---------- ---------------- # 31 Dec -400 -_DI400Y -_DI400Y -1 # 1 Jan -399 -_DI400Y +1 -_DI400Y 400-year boundary # ... # 30 Dec 000 -1 -2 # 31 Dec 000 0 -1 # 1 Jan 001 1 0 400-year boundary # 2 Jan 001 2 1 # 3 Jan 001 3 2 # ... # 31 Dec 400 _DI400Y _DI400Y -1 # 1 Jan 401 _DI400Y +1 _DI400Y 400-year boundary var n = ordinal n -= 1 var n400 = n // _DI400Y n = n % _DI400Y var year = n400 * 400 + 1 # ..., -399, 1, 401, ... # Now n is the (non-negative) offset, in days, from January 1 of year, to # the desired date. Now compute how many 100-year cycles precede n. # Note that it's possible for n100 to equal 4! In that case 4 full # 100-year cycles precede the desired day, which implies the desired # day is December 31 at the end of a 400-year cycle. var n100 = n // _DI100Y n = n % _DI100Y # Now compute how many 4-year cycles precede it. var n4 = n // _DI4Y n = n % _DI4Y # And now how many single years. Again n1 can be 4, and again meaning # that the desired day is December 31 at the end of the 4-year cycle. var n1 = n // 365 n = n % 365 year += n100 * 100 + n4 * 4 + n1 if n1 == 4 or n100 == 4: return Self(year - 1, 12, 31) # Now the year is correct, and n is the offset from January 1. We find # the month via an estimate that's either exact or one too large. var leapyear = n1 == 3 and (n4 != 24 or n100 == 3) var month = (n + 50) >> 5 var preceding: Int if month > 2 and leapyear: preceding = _DAYS_BEFORE_MONTH[month] + 1 else: preceding = _DAYS_BEFORE_MONTH[month] if preceding > n: # estimate is too large month -= 1 if month == 2 and leapyear: preceding -= _DAYS_BEFORE_MONTH[month] + 1 else: preceding -= _DAYS_BEFORE_MONTH[month] n -= preceding # Now the year and month are correct, and n is the offset from the # start of that month: we're done! return Self(year, month, n + 1) fn isoweekday(self) raises -> Int: # "Return day of the week, where Monday == 1 ... Sunday == 7." # 1-Jan-0001 is a Monday return self.toordinal() % 7 or 7 fn __str__(self) raises -> String: return self.isoformat() fn __sub__(self, other: Self) raises -> TimeDelta: var days1 = self.toordinal() var days2 = other.toordinal() var secs1 = self.second + self.minute * 60 + self.hour * 3600 var secs2 = other.second + other.minute * 60 + other.hour * 3600 var base = TimeDelta( days1 - days2, secs1 - secs2, self.microsecond - other.microsecond ) return base fn to_py(self) raises -> PythonObject: # todo: add tz later var dateimte = Python.import_module("datetime") return dateimte.datetime( self.year, self.month, self.day, self.hour, self.minute, self.second, self.microsecond, ) @staticmethod fn from_py(py_datetime: PythonObject) raises -> Morrow: # Python.is_type not working, use __class__.__name__ instead if py_datetime.__class__.__name__ == "datetime": return Morrow( int(py_datetime.year), int(py_datetime.month), int(py_datetime.day), int(py_datetime.hour), int(py_datetime.minute), int(py_datetime.second), int(py_datetime.second), ) elif py_datetime.__class__.__name__ == "date": return Morrow( int(py_datetime.year), int(py_datetime.month), int(py_datetime.day), ) else: raise Error( "invalid python object, only support py builtin datetime or date" ) --- morrow/timedelta.mojo --- from .util import rjust alias SECONDS_OF_DAY = 24 * 3600 struct TimeDelta(Stringable): var days: Int var seconds: Int var microseconds: Int fn __init__( inout self, days: Int = 0, seconds: Int = 0, microseconds: Int = 0, milliseconds: Int = 0, minutes: Int = 0, hours: Int = 0, weeks: Int = 0, ): self.days = 0 self.seconds = 0 self.microseconds = 0 var days_ = days var seconds_ = seconds var microseconds_ = microseconds # Normalize everything to days, seconds, microseconds. days_ += weeks * 7 seconds_ += minutes * 60 + hours * 3600 microseconds_ += milliseconds * 1000 self.days = days_ days_ = seconds_ // SECONDS_OF_DAY seconds_ = seconds_ % SECONDS_OF_DAY self.days += days_ self.seconds += seconds_ seconds_ = microseconds_ // 1000000 microseconds_ = microseconds_ % 1000000 days_ = seconds_ // SECONDS_OF_DAY seconds_ = seconds_ % SECONDS_OF_DAY self.days += days_ self.seconds += seconds_ seconds_ = microseconds_ // 1000000 self.microseconds = microseconds_ % 1000000 self.seconds += seconds_ days_ = self.seconds // SECONDS_OF_DAY self.seconds = self.seconds % SECONDS_OF_DAY self.days += days_ fn __copyinit__(inout self, other: Self): self.days = other.days self.seconds = other.seconds self.microseconds = other.microseconds fn __str__(self) -> String: var mm = self.seconds // 60 var ss = self.seconds % 60 var hh = mm // 60 mm = mm % 60 var s = String(hh) + ":" + rjust(mm, 2, "0") + ":" + rjust(ss, 2, "0") if self.days: if abs(self.days) != 1: s = String(self.days) + " days, " + s else: s = String(self.days) + " day, " + s if self.microseconds: s = s + rjust(self.microseconds, 6, "0") return s fn total_seconds(self) -> Float64: """Total seconds in the duration.""" return ( (self.days * 86400 + self.seconds) * 10**6 + self.microseconds ) / 10**6 @always_inline fn __add__(self, other: Self) -> Self: return Self( self.days + other.days, self.seconds + other.seconds, self.microseconds + other.microseconds, ) fn __radd__(self, other: Self) -> Self: return self.__add__(other) fn __sub__(self, other: Self) -> Self: return Self( self.days - other.days, self.seconds - other.seconds, self.microseconds - other.microseconds, ) fn __rsub__(self, other: Self) -> Self: return Self( other.days - self.days, other.seconds - self.seconds, other.microseconds - self.microseconds, ) fn __neg__(self) -> Self: return Self(-self.days, -self.seconds, -self.microseconds) fn __pos__(self) -> Self: return self def __abs__(self) -> Self: if self.days < 0: return -self else: return self @always_inline fn __mul__(self, other: Int) -> Self: return Self( self.days * other, self.seconds * other, self.microseconds * other, ) fn __rmul__(self, other: Int) -> Self: return self.__mul__(other) fn _to_microseconds(self) -> Int: return (self.days * SECONDS_OF_DAY + self.seconds) * 1000000 + self.microseconds fn __mod__(self, other: Self) -> Self: var r = self._to_microseconds() % other._to_microseconds() return Self(0, 0, r) fn __eq__(self, other: Self) -> Bool: return ( self.days == other.days and self.seconds == other.seconds and self.microseconds == other.microseconds ) @always_inline fn __le__(self, other: Self) -> Bool: if self.days < other.days: return True elif self.days == other.days: if self.seconds < other.seconds: return True elif ( self.seconds == other.seconds and self.microseconds <= other.microseconds ): return True return False @always_inline fn __lt__(self, other: Self) -> Bool: if self.days < other.days: return True elif self.days == other.days: if self.seconds < other.seconds: return True elif ( self.seconds == other.seconds and self.microseconds < other.microseconds ): return True return False fn __ge__(self, other: Self) -> Bool: return not self.__lt__(other) fn __gt__(self, other: Self) -> Bool: return not self.__le__(other) fn __bool__(self) -> Bool: return self.days != 0 or self.seconds != 0 or self.microseconds != 0 alias Min = TimeDelta(-99999999) alias Max = TimeDelta(days=99999999) alias Resolution = TimeDelta(microseconds=1) --- morrow/timezone.mojo --- from .util import rjust from ._libc import c_localtime alias UTC_TZ = TimeZone(0, "UTC") @value struct TimeZone(Stringable): var offset: Int var name: String fn __init__(inout self, offset: Int, name: String = ""): self.offset = offset self.name = name fn __str__(self) -> String: return self.name fn is_none(self) -> Bool: return self.name == "None" @staticmethod fn none() -> TimeZone: return TimeZone(0, "None") @staticmethod fn local() -> TimeZone: var local_t = c_localtime(0) return TimeZone(local_t.tm_gmtoff.to_int(), "local") @staticmethod fn from_utc(utc_str: String) raises -> TimeZone: if len(utc_str) == 0: raise Error("utc_str is empty") if utc_str == "utc" or utc_str == "UTC" or utc_str == "Z": return TimeZone(0, "utc") var p = 3 if len(utc_str) > 3 and utc_str[0:3] == "UTC" else 0 var sign = -1 if utc_str[p] == "-" else 1 if utc_str[p] == "+" or utc_str[p] == "-": p += 1 if ( len(utc_str) < p + 2 or not isdigit(ord(utc_str[p])) or not isdigit(ord(utc_str[p + 1])) ): raise Error("utc_str format is invalid") var hours: Int = atol(utc_str[p : p + 2]) p += 2 var minutes: Int if len(utc_str) <= p: minutes = 0 elif len(utc_str) == p + 3 and utc_str[p] == ":": minutes = atol(utc_str[p + 1 : p + 3]) elif len(utc_str) == p + 2 and isdigit(ord(utc_str[p])): minutes = atol(utc_str[p : p + 2]) else: minutes = 0 raise Error("utc_str format is invalid") var offset: Int = sign * (hours * 3600 + minutes * 60) return TimeZone(offset) fn format(self, sep: String = ":") -> String: var sign: String var offset_abs: Int if self.offset < 0: sign = "-" offset_abs = -self.offset else: sign = "+" offset_abs = self.offset var hh = offset_abs // 3600 var mm = offset_abs % 3600 return sign + rjust(hh, 2, "0") + sep + rjust(mm, 2, "0") --- morrow/util.mojo --- from collections.vector import DynamicVector from .constants import MAX_TIMESTAMP, MAX_TIMESTAMP_MS, MAX_TIMESTAMP_US from .constants import _DAYS_IN_MONTH, _DAYS_BEFORE_MONTH fn _is_leap(year: Int) -> Bool: "year -> 1 if leap year, else 0." return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) def _days_before_year(year: Int) -> Int: "year -> number of days before January 1st of year." var y = year - 1 return y * 365 + y // 4 - y // 100 + y // 400 def _days_in_month(year: Int, month: Int) -> Int: "year, month -> number of days in that month in that year." if month == 2 and _is_leap(year): return 29 return _DAYS_IN_MONTH[month] def _days_before_month(year: Int, month: Int) -> Int: "year, month -> number of days in year preceding first day of month." if month > 2 and _is_leap(year): return _DAYS_BEFORE_MONTH[month] + 1 return _DAYS_BEFORE_MONTH[month] @always_inline def _ymd2ord(year: Int, month: Int, day: Int) -> Int: "year, month, day -> ordinal, considering 01-Jan-0001 as day 1." dim = _days_in_month(year, month) return _days_before_year(year) + _days_before_month(year, month) + day def normalize_timestamp(timestamp: Float64) -> Float64: """Normalize millisecond and microsecond timestamps into normal timestamps.""" if timestamp > MAX_TIMESTAMP: if timestamp < MAX_TIMESTAMP_MS: timestamp /= 1000 elif timestamp < MAX_TIMESTAMP_US: timestamp /= 1_000_000 else: raise Error( "The specified timestamp " + String(timestamp) + "is too large." ) return timestamp fn _repeat_string(string: String, n: Int) -> String: var result: String = "" for _ in range(n): result += string return result fn rjust(string: String, width: Int, fillchar: String = " ") -> String: var extra = width - len(string) return _repeat_string(fillchar, extra) + string fn rjust(string: Int, width: Int, fillchar: String = " ") -> String: return rjust(String(string), width, fillchar) --- test.mojo --- from testing import assert_equal, assert_true from morrow._libc import c_gettimeofday from morrow._py import py_dt_datetime, py_time from morrow import Morrow from morrow import TimeZone from morrow import TimeDelta def assert_datetime_equal(dt: Morrow, py_dt: PythonObject): assert_true( dt.year == int(py_dt.year) and dt.month == int(py_dt.month) and dt.hour == int(py_dt.hour) and dt.minute == int(py_dt.minute) and dt.second == int(py_dt.second), "dt: " + str(dt) + " is not equal to py_dt: " + str(py_dt), ) def test_now(): print("Running test_now()") var result = Morrow.now() assert_datetime_equal(result, py_dt_datetime().now()) def test_utcnow(): print("Running test_utcnow()") var result = Morrow.utcnow() assert_datetime_equal(result, py_dt_datetime().utcnow()) def test_fromtimestamp(): print("Running test_fromtimestamp()") var t = c_gettimeofday() var result = Morrow.fromtimestamp(t.tv_sec) assert_datetime_equal(result, py_dt_datetime().now()) def test_utcfromtimestamp(): print("Running test_utcfromtimestamp()") var t = c_gettimeofday() var result = Morrow.utcfromtimestamp(t.tv_sec) assert_datetime_equal(result, py_dt_datetime().utcnow()) def test_iso_format(): print("Running test_iso_format()") var d0 = Morrow(2023, 10, 1, 0, 0, 0, 1234) assert_equal(d0.isoformat(), "2023-10-01T00:00:00.001234") assert_equal(d0.isoformat(timespec="seconds"), "2023-10-01T00:00:00") assert_equal(d0.isoformat(timespec="milliseconds"), "2023-10-01T00:00:00.001") # with TimeZone var d1 = Morrow(2023, 10, 1, 0, 0, 0, 1234, TimeZone(28800, "Beijing")) assert_equal(d1.isoformat(timespec="seconds"), "2023-10-01T00:00:00+08:00") def test_time_zone(): print("Running test_time_zone()") assert_equal(TimeZone.from_utc("UTC+0800").offset, 28800) assert_equal(TimeZone.from_utc("UTC+08:00").offset, 28800) assert_equal(TimeZone.from_utc("UTC08:00").offset, 28800) assert_equal(TimeZone.from_utc("UTC0800").offset, 28800) assert_equal(TimeZone.from_utc("+08:00").offset, 28800) assert_equal(TimeZone.from_utc("+0800").offset, 28800) assert_equal(TimeZone.from_utc("08").offset, 28800) def test_strptime(): print("Running test_strptime()") m = Morrow.strptime("20-01-2023 15:49:10", "%d-%m-%Y %H:%M:%S", TimeZone.none()) assert_equal(str(m), "2023-01-20T15:49:10.000000+00:00") m = Morrow.strptime("2023-10-18 15:49:10 +0800", "%Y-%m-%d %H:%M:%S %z") assert_equal(str(m), "2023-10-18T15:49:10.000000+08:00") m = Morrow.strptime("2023-10-18 15:49:10", "%Y-%m-%d %H:%M:%S", "+09:00") assert_equal(str(m), "2023-10-18T15:49:10.000000+09:00") def test_ordinal(): print("Running test_ordinal()") m = Morrow(2023, 10, 1) o = m.toordinal() assert_equal(o, 738794) m2 = Morrow.fromordinal(o) assert_equal(m2.year, 2023) assert_equal(m.month, 10) assert_equal(m.day, 1) def test_sub(): print("Running test_sub()") var result = Morrow(2023, 10, 1, 10, 0, 0, 1) - Morrow(2023, 10, 1, 10, 0, 0) assert_equal(result.microseconds, 1) assert_equal(str(result), "0:00:00000001") result = Morrow(2023, 10, 1, 10, 0, 1) - Morrow(2023, 10, 1, 10, 0, 0) assert_equal(result.seconds, 1) assert_equal(str(result), "0:00:01") result = Morrow(2023, 10, 1, 10, 1, 0) - Morrow(2023, 10, 1, 10, 0, 0) assert_equal(result.seconds, 60) assert_equal(str(result), "0:01:00") result = Morrow(2023, 10, 2, 10, 0, 0) - Morrow(2023, 10, 1, 10, 0, 0) assert_equal(result.days, 1) assert_equal(str(result), "1 day, 0:00:00") result = Morrow(2023, 10, 3, 10, 1, 1) - Morrow(2023, 10, 1, 10, 0, 0) assert_equal(result.days, 2) assert_equal(str(result), "2 days, 0:01:01") def test_timedelta(): print("Running test_timedelta()") assert_equal(TimeDelta(3, 2, 100).total_seconds(), 259202.0001) assert_true( TimeDelta(2, 1, 50).__add__(TimeDelta(1, 1, 50)).__eq__(TimeDelta(3, 2, 100)) ) assert_true( TimeDelta(3, 2, 100).__sub__(TimeDelta(2, 1, 50)).__eq__(TimeDelta(1, 1, 50)) ) assert_true(TimeDelta(3, 2, 100).__neg__().__eq__(TimeDelta(-3, -2, -100))) assert_true(TimeDelta(-3, -2, -100).__abs__().__eq__(TimeDelta(3, 2, 100))) assert_true(TimeDelta(1, 1, 50).__le__(TimeDelta(1, 1, 51))) assert_true(TimeDelta(1, 1, 50).__le__(TimeDelta(1, 1, 50))) assert_true(TimeDelta(1, 1, 50).__lt__(TimeDelta(1, 1, 51))) assert_true(not TimeDelta(1, 1, 50).__lt__(TimeDelta(1, 1, 50))) assert_true(TimeDelta(1, 1, 50).__ge__(TimeDelta(1, 1, 50))) assert_true(TimeDelta(1, 1, 50).__ge__(TimeDelta(1, 1, 49))) assert_true(not TimeDelta(1, 1, 50).__gt__(TimeDelta(1, 1, 50))) assert_true(TimeDelta(1, 1, 50).__gt__(TimeDelta(1, 1, 49))) assert_equal( str( TimeDelta( weeks=100, days=100, hours=100, minutes=100, seconds=100, microseconds=10000000, milliseconds=10000000000, ) ), "919 days, 23:28:30", ) def test_from_to_py(): print("Running test_from_to_py()") m = Morrow.now() dt = m.to_py() assert_datetime_equal(m, dt) m2 = Morrow.from_py(dt) assert_datetime_equal(m2, dt) def test_format(): print("Running test_format()") var m = Morrow(2024, 2, 1, 3, 4, 5, 123456) assert_equal( m.format("YYYY-MM-DD HH:mm:ss.SSS ZZ"), "2024-02-01 03:04:05.123 +00:00" ) assert_equal(m.format("Y-YY-YYY-YYYY M-MM D-DD"), "Y-24--2024 2-02 1-01") assert_equal(m.format("H-HH-h-hh m-mm s-ss"), "3-03-3-03 4-04 5-05") assert_equal(m.format("S-SS-SSS-SSSS-SSSSS-SSSSSS"), "1-12-123-1234-12345-123456") assert_equal(m.format("d-dd-ddd-dddd"), "4--Thu-Thursday") assert_equal(m.format("YYYY[Y] [[]MM[]][M]"), "2024Y [02]M") def main(): test_now() test_utcnow() test_fromtimestamp() test_utcfromtimestamp() test_iso_format() test_sub() test_time_zone() test_strptime() test_timedelta() test_from_to_py() test_format() --- .gitignore --- .DS_Store --- LICENSE --- MIT License Copyright (c) 2023 Lukas Hermann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Mojo Shims These are a collection of random utils I've written for use in my Mojo projects. Most are ported from Zig's standard library. Some of them are have quirks due to bugs in the language, and others due to my lack of testing. Nothing here is production code, and will probably break frequently as new language changes crop up. --- __init__.mojo --- --- bitcast/__init__.mojo --- from math.bit import bswap from sys.info import is_little_endian, sizeof @always_inline fn read_simd_native[ T: DType ](owned bytes: SIMD[DType.uint8, sizeof[SIMD[T, 1]]()]) -> SIMD[T, 1]: let ptr = Pointer.address_of(bytes).bitcast[SIMD[T, 1]]() return ptr.load() @always_inline fn read_simd_foreign[ T: DType ](owned bytes: SIMD[DType.uint8, sizeof[SIMD[T, 1]]()]) -> SIMD[T, 1]: return bswap[T, 1](read_simd_native[T](bytes)) @always_inline fn from_le_bytes[ T: DType ](owned bytes: SIMD[DType.uint8, sizeof[SIMD[T, 1]]()]) -> SIMD[T, 1]: @parameter if is_little_endian(): return read_simd_native[T](bytes) else: return read_simd_foreign[T](bytes) @always_inline fn from_be_bytes[ T: DType, N: Int ](owned bytes: SIMD[DType.uint8, sizeof[SIMD[T, 1]]()]) -> SIMD[T, 1]: @parameter if is_little_endian(): return read_simd_foreign[T](bytes) else: return read_simd_native[T](bytes) @always_inline fn write_simd_native[ T: DType ](owned value: SIMD[T, 1]) -> SIMD[DType.uint8, sizeof[SIMD[T, 1]]()]: let ptr = DTypePointer[T](Pointer.address_of[SIMD[T, 1]](value)).bitcast[ DType.uint8 ]() return ptr.simd_load[sizeof[SIMD[T, 1]]()](0) @always_inline fn write_simd_foreign[ T: DType ](owned value: SIMD[T, 1]) -> SIMD[DType.uint8, sizeof[SIMD[T, 1]]()]: return bswap[DType.uint8, sizeof[SIMD[T, 1]]()](write_simd_native[T](value)) @always_inline fn to_le_bytes[ T: DType ](owned value: SIMD[T, 1]) -> SIMD[DType.uint8, sizeof[SIMD[T, 1]]()]: @parameter if is_little_endian(): return write_simd_native[T](value) else: return write_simd_foreign[T](value) @always_inline fn to_be_bytes[ T: DType ](owned value: SIMD[T, 1]) -> SIMD[DType.uint8, sizeof[SIMD[T, 1]]()]: @parameter if is_little_endian(): return write_simd_foreign[T](value) else: return write_simd_native[T](value) --- experiments/read_dir.mojo --- """ A port of the code from this stack overflow answer: https://stackoverflow.com/a/4204758 ```c #include <dirent.h> #include <stdio.h> int main(void) { DIR *d; struct dirent *dir; d = opendir("."); if (d) { while ((dir = readdir(d)) != NULL) { printf("%s\n", dir->d_name); } closedir(d); } return(0); } ``` """ from memory.unsafe import Pointer from sys.info import sizeof @value @register_passable("trivial") struct DIR: pass @value @register_passable("trivial") struct dirent: var d_ino: UInt64 var d_off: UInt64 var d_reclen: UInt16 var d_type: UInt8 var d_name: Pointer[UInt8] @always_inline fn closedir(arg: Pointer[DIR]) -> Int32: return external_call["closedir", Int32, Pointer[DIR]](arg) @always_inline fn opendir(arg: Pointer[UInt8]) -> Pointer[DIR]: return external_call["opendir", Pointer[DIR], Pointer[UInt8]](arg) @always_inline fn readdir(arg: Pointer[DIR]) -> Pointer[dirent]: return external_call["readdir", Pointer[dirent], Pointer[DIR]](arg) @always_inline fn fdopendir(arg: Int32) -> DIR: return external_call["fdopendir", DIR](arg) # based on "https://github.com/crisadamo/mojo-libc/blob/main/Libc.mojo" @always_inline fn str_to_cstring(s: String) -> Pointer[UInt8]: let ptr = Pointer[UInt8].alloc(len(s) + 1) for i in range(len(s)): ptr.store(i, ord(s[i])) ptr.store(len(s), ord("\0")) return ptr fn main(): var dir = Pointer[dirent]() let path = str_to_cstring(".") let d = opendir(path) if d: while dir := readdir(d): let direntry = dir.load(0) # let dname = StringRef( # direntry.d_name.bitcast[__mlir_type.`!pop.scalar<si8>`]().address, # direntry.d_reclen.to_int(), # ) let ptr = dir.bitcast[__mlir_type.`!pop.scalar<si8>`]().offset( sizeof[UInt64]() * 2 + sizeof[UInt16]() + sizeof[UInt8]() ).address let dname = StringRef( ptr, dir.load(0).d_reclen.to_int(), ) print(dname) let _closed_ok = closedir(d) path.free() --- file/__init__.mojo --- from memory import memset from math import min from shims.libc.stdio import fopen, fread, fclose, fwrite from shims.libc.string import strnlen alias c_char = UInt8 alias FILE = UInt64 alias BUF_SIZE = 4096 fn to_char_ptr(s: String) -> Pointer[c_char]: """Only ASCII-based strings.""" let ptr = Pointer[c_char]().alloc(len(s) + 1) for i in range(len(s)): ptr.store(i, ord(s[i])) ptr.store(len(s), ord("\0")) return ptr struct File: var handle: Pointer[UInt64] var fname: Pointer[c_char] var mode: Pointer[c_char] fn __init__(inout self, filename: String, mode: StringLiteral): let fname = to_char_ptr(filename) let mode_cstr = to_char_ptr(mode) let handle = fopen(fname, mode_cstr) self.fname = fname self.mode = mode_cstr self.handle = handle fn __bool__(self) -> Bool: return self.handle.__bool__() fn __del__(owned self) raises: if self.handle: pass # TODO: uncomment when external_call resolution bug is fixed # let c = fclose(self.handle) # if c != 0: # raise Error("Failed to close file") if self.fname: self.fname.free() if self.mode: self.mode.free() fn __moveinit__(inout self, owned other: Self): self.fname = other.fname self.mode = other.mode self.handle = other.handle other.handle = Pointer[FILE]() other.fname = Pointer[c_char]() other.mode = Pointer[c_char]() fn do_nothing(self): pass fn read[D: Dim](self, buffer: Buffer[D, DType.uint8]) raises -> Int: return fread( buffer.data.as_scalar_pointer(), sizeof[UInt8](), BUF_SIZE, self.handle ).to_int() fn write[D: Dim](self, buffer: Buffer[D, DType.uint8]) raises -> Int: return fwrite( buffer.data.as_scalar_pointer(), sizeof[UInt8](), len(buffer), self.handle ).to_int() fn write_all[D: Dim](self, buffer: Buffer[D, DType.uint8]) raises: var index = 0 while index != len(buffer): index += self.write(buffer) fn write_byte(self, byte: UInt8) raises: let buf = Buffer[1, DType.uint8]().stack_allocation() buf[0] = byte self.write_all(buf) fn write_byte_n_times(self, byte: UInt8, n: Int) raises: var bytes = StaticTuple[256, UInt8]() let bytes_ptr = DTypePointer[DType.uint8]( Pointer.address_of(bytes).bitcast[UInt8]() ) memset[DType.uint8]( bytes_ptr, byte, 256, ) var remaining = n while remaining > 0: let to_write = min(remaining, bytes.__len__()) self.write_all(Buffer[Dim(), DType.uint8](bytes_ptr, to_write)) remaining -= to_write --- libc/__init__.mojo --- --- libc/dirent/__init__.mojo --- from memory.unsafe import Pointer @value @register_passable("trivial") struct DIR: pass @value @register_passable("trivial") struct dirent: var d_ino: UInt64 var d_off: UInt64 var d_reclen: UInt16 var d_type: UInt8 var d_name: Pointer[UInt8] fn closedir(arg: Pointer[DIR]) -> Int32: return external_call["closedir", Int32, Pointer[DIR]](arg) fn opendir(arg: Pointer[UInt8]) -> Pointer[DIR]: return external_call["opendir", Pointer[DIR], Pointer[UInt8]](arg) fn readdir(arg: Pointer[DIR]) -> Pointer[dirent]: return external_call["readdir", Pointer[dirent], Pointer[DIR]](arg) fn fdopendir(arg: Int32) -> DIR: return external_call["fdopendir", DIR](arg) --- libc/stdio/__init__.mojo --- from memory.unsafe import Pointer alias FILE = UInt64 fn clearerr(arg: Pointer[FILE]) -> UInt8: return external_call["clearerr", UInt8, Pointer[FILE]](arg) fn fclose(arg: Pointer[FILE]) -> Int32: return external_call["fclose", Int32, Pointer[FILE]](arg) fn feof(arg: Pointer[FILE]) -> Int32: return external_call["feof", Int32, Pointer[FILE]](arg) fn ferror(arg: Pointer[FILE]) -> Int32: return external_call["ferror", Int32, Pointer[FILE]](arg) fn fflush(arg: Pointer[FILE]) -> Int32: return external_call["fflush", Int32, Pointer[FILE]](arg) fn fgetc(arg: Pointer[FILE]) -> Int32: return external_call["fgetc", Int32, Pointer[FILE]](arg) fn fopen(__filename: Pointer[UInt8], __mode: Pointer[UInt8]) -> Pointer[FILE]: return external_call["fopen", Pointer[FILE], Pointer[UInt8], Pointer[UInt8]]( __filename, __mode ) fn fwrite( __ptr: Pointer[UInt8], __size: UInt64, __nitems: UInt64, __stream: Pointer[FILE] ) -> UInt64: return external_call[ "fwrite", UInt64, Pointer[UInt8], UInt64, UInt64, Pointer[FILE] ](__ptr, __size, __nitems, __stream) fn fread( __ptr: Pointer[UInt8], __size: UInt64, __nitems: UInt64, __stream: Pointer[FILE] ) -> UInt64: return external_call[ "fread", UInt64, Pointer[UInt8], UInt64, UInt64, Pointer[FILE] ](__ptr, __size, __nitems, __stream) --- libc/string/__init__.mojo --- from memory.unsafe import Pointer fn strnlen(pointer: Pointer[UInt8]) -> Int: return external_call["strnlen", Int, Pointer[UInt8]](pointer) --- read/__init__.mojo --- """ This is a port of Zig's buffered reader. See: https://github.com/ziglang/zig/blob/master/lib/std/io/buffered_reader.zig Example usage: ============== from shims.file import File from shims.read import BufReader from memory.buffer import Buffer fn main() raises: let f = File("file.txt") var reader = BufReader[4096](f ^) let buf = Buffer[256, DType.uint8]().stack_allocation() var bytes_read = 1 while bytes_read > 0: bytes_read = reader.read(buf) print( StringRef( buf.data.as_scalar_pointer() .bitcast[__mlir_type.`!pop.scalar<si8>`]() .address, bytes_read, ) ) """ from utils.list import Dim from math import min, abs from math.limit import max_finite from memory import memcpy from memory.buffer import Buffer from memory.unsafe import Pointer, DTypePointer from sys.info import sizeof from utils.index import Index from utils.vector import DynamicVector import testing from shims.file import File # Types aliases alias c_char = UInt8 struct BufReader[BUF_SIZE: Int]: var unbuffered_reader: File var data: DTypePointer[DType.uint8] var end: Int var start: Int fn __init__(inout self, owned reader: File): self.unbuffered_reader = reader ^ self.data = DTypePointer[DType.uint8]().alloc(BUF_SIZE) self.end = 0 self.start = 0 fn __moveinit__(inout self, owned other: Self): self.unbuffered_reader = other.unbuffered_reader ^ self.data = other.data self.end = other.end self.start = other.start other.unbuffered_reader = File("", "r") other.data = DTypePointer[DType.uint8]() fn read[D: Dim](inout self, dest: Buffer[D, DType.uint8]) raises -> Int: var dest_index = 0 let buf = Buffer[BUF_SIZE, DType.uint8](self.data) while dest_index < len(dest): let written = min(len(dest) - dest_index, self.end - self.start) memcpy(dest.data.offset(dest_index), self.data.offset(self.start), written) if written == 0: # buf empty, fill it let n = self.unbuffered_reader.read(buf) if n == 0: # reading from the unbuffered stream returned nothing # so we have nothing left to read. return dest_index self.start = 0 self.end = n self.start += written dest_index += written return len(dest) fn do_nothing(self): pass struct Reader[BUF_SIZE: Int]: var context: BufReader[BUF_SIZE] fn do_nothing(self): pass fn __init__(inout self, owned context: BufReader[BUF_SIZE]): self.context = context ^ # Returns the number of bytes read. It may be less than buffer.len. # If the number of bytes read is 0, it means end of stream. # End of stream is not an error condition. fn read[D: Dim](inout self, buffer: Buffer[D, DType.uint8]) raises -> Int: return self.context.read(buffer) # Returns the number of bytes read. If the number read is smaller than `buffer.len`, it # means the stream reached the end. Reaching the end of a stream is not an error # condition. fn read_all[D: Dim](inout self, buffer: Buffer[D, DType.uint8]) raises -> Int: return self.read_at_least(buffer, len(buffer)) # Returns the number of bytes read, calling the underlying read # function the minimal number of times until the buffer has at least # `len` bytes filled. If the number read is less than `len` it means # the stream reached the end. Reaching the end of the stream is not # an error condition. fn read_at_least[ D: Dim ](inout self, buffer: Buffer[D, DType.uint8], len: Int) raises -> Int: # assert(len <= buffer.len); var index: Int = 0 while index < len: let amt = self.read( Buffer[Dim(), DType.uint8]( buffer.data.offset(index), buffer.__len__() - index ) ) if amt == 0: break index += amt return index # If the number read would be smaller than `buf.len`, `error.EndOfStream` is returned instead. fn read_no_eof[D: Dim](inout self, buf: Buffer[D, DType.uint8]) raises: let amt_read = self.read_all(buf) if amt_read < len(buf): raise Error("Unexpected End of Stream.") # Appends to the `writer` contents by reading from the stream until `delimiter` is found. # Does not write the delimiter itself. # If `optional_max_size` is not null and amount of written bytes exceeds `optional_max_size`, # returns `error.StreamTooLong` and finishes appending. # If `optional_max_size` is null, appending is unbounded. fn stream_until_delimiter[ BuffD: Dim ]( inout self, inout writer: FixedBufferStream[BuffD], delimiter: UInt8, max_size: Int, ) raises: for i in range(max_size): let byte = self.read_byte() if byte == delimiter: return writer.write_byte(byte) raise Error("Stream too long") # Appends to the `writer` contents by reading from the stream until `delimiter` is found. # Does not write the delimiter itself. # If `optional_max_size` is not null and amount of written bytes exceeds `optional_max_size`, # returns `error.StreamTooLong` and finishes appending. # If `optional_max_size` is null, appending is unbounded. fn stream_until_delimiter[ BuffD: Dim ](inout self, inout writer: FixedBufferStream[BuffD], delimiter: UInt8) raises: while True: let byte = self.read_byte() if byte == delimiter: return writer.write_byte(byte) # Reads 1 byte from the stream or returns `error.EndOfStream`. fn read_byte(inout self) raises -> UInt8: let result = Buffer[1, DType.uint8]().stack_allocation() let amt_read = self.read(result) if amt_read < 1: raise Error("End of stream") return result[0] @value struct FixedBufferStream[D: Dim]: var buffer: Buffer[D, DType.uint8] var pos: Int @always_inline fn __init__(inout self, buffer: Buffer[D, DType.uint8]): self.buffer = buffer self.pos = 0 @always_inline fn read[ DestDim: Dim ](inout self, destination: Buffer[DestDim, DType.uint8]) raises -> Int: let size = min(len(destination), len(self.buffer) - self.pos) let end = self.pos + size memcpy(destination.data, self.buffer.data.offset(self.pos), size) self.pos = end return size # If the returned number of bytes written is less than requested, the # buffer is full. Returns `error.NoSpaceLeft` when no bytes would be written. # Note: `error.NoSpaceLeft` matches the corresponding error from # `std.fs.File.WriteError`. fn write[BuffD: Dim](inout self, bytes: Buffer[BuffD, DType.uint8]) raises -> Int: if len(bytes) == 0: return 0 if self.pos >= len(self.buffer): raise Error("No space left") let n = len(bytes) if self.pos + len(bytes) <= len(self.buffer) else len( self.buffer ) - self.pos memcpy(self.buffer.data.offset(self.pos), bytes.data, n) self.pos += n if n == 0: raise Error("No space left") return n fn write_all[BuffD: Dim](inout self, bytes: Buffer[BuffD, DType.uint8]) raises: var index = 0 while index != len(bytes): index += self.write( Buffer[Dim(), DType.uint8](bytes.data.offset(index), len(bytes) - index) ) fn write_byte(inout self, byte: UInt8) raises: let arr = Buffer[1, DType.uint8]().stack_allocation() self.write_all(arr) fn seek_to(inout self, pos: Int) raises: self.pos = min(len(self.buffer), pos) fn seek_by(inout self, amt: Int) raises: if amt < 0: let abs_amt = abs(amt) if abs_amt > self.pos: self.pos = 0 else: self.pos -= abs_amt else: let new_pos = self.pos + amt self.pos = min(len(self.buffer), new_pos) @always_inline fn get_end_pos(self) -> Int: return len(self.buffer) @always_inline fn get_pos(self) -> Int: return self.pos @always_inline fn get_written(self) -> Buffer[Dim(), DType.uint8]: return Buffer[Dim(), DType.uint8](self.buffer.data, self.pos) @always_inline fn reset(inout self): self.pos = 0 --- siphash/__init__.mojo --- """ This is a port of Zig's SipHash See: https://github.com/ziglang/zig/blob/master/lib/std/crypto/siphash.zig """ from memory.buffer import Buffer from utils.list import Dim from memory import memcpy, memset_zero from memory.unsafe import Pointer, DTypePointer from sys.info import sizeof from math import rotate_bits_left from utils.static_tuple import StaticTuple from math import min from algorithm.functional import parallelize import testing from shims.bitcast import from_be_bytes, from_le_bytes, to_le_bytes @always_inline fn slice_buf[T: DType, D: Dim](b: Buffer[D, T], slc: slice) -> Buffer[Dim(), T]: return Buffer[Dim(), T](b.data.offset(slc.start), slc.__len__()) @value struct SipHashStateless[T: DType, C_ROUNDS: Int, D_ROUNDS: Int]: alias block_length = 64 alias key_length = 16 var v0: UInt64 var v1: UInt64 var v2: UInt64 var v3: UInt64 var msg_len: UInt8 @always_inline fn __init__(inout self, key: Buffer[Self.key_length, DType.uint8]) raises: # constrained[T == DType.uint64 or T == DType.uint128]() constrained[T == DType.uint64]() constrained[C_ROUNDS > 0 and D_ROUNDS > 0]() let k0: UInt64 = from_le_bytes[DType.uint64](key.simd_load[sizeof[UInt64]()](0)) let k1: UInt64 = from_le_bytes[DType.uint64](key.simd_load[sizeof[UInt64]()](8)) self.v0 = k0 ^ UInt64(0x736F6D6570736575) self.v1 = k1 ^ UInt64(0x646F72616E646F6D) self.v2 = k0 ^ UInt64(0x6C7967656E657261) self.v3 = k1 ^ UInt64(0x7465646279746573) self.msg_len = UInt8(0) # @parameter if T == DType.128: # self.v1 ^= 0xee; @always_inline fn update[D: Dim](inout self, b: Buffer[D, DType.uint8]): # std.debug.assert(b.len % 8 == 0); for off in range(0, len(b), 8): let blob = b.simd_load[8](off) self.round(blob) self.msg_len += UInt8(len(b)) fn final[D: Dim](inout self, b: Buffer[D, DType.uint8]) -> SIMD[T, 1]: # constrained[len(b) < 8](b.len < 8); self.msg_len += UInt8(len(b)) let buf = Buffer[8, DType.uint8]().stack_allocation() memset_zero(buf.data, 8) memcpy(buf.data, b.data, len(b)) buf[7] = self.msg_len self.round(buf.simd_load[8](0)) @parameter if T == DType.uint64: self.v2 ^= 0xFF else: self.v2 ^= 0xEE @unroll for _ in range(D_ROUNDS): self.sip_round() let b1 = (self.v0 ^ self.v1 ^ self.v2 ^ self.v3).to_int() return SIMD[T, 1](b1) ## TODO: remove above return when UInt128 is available # @parameter if T == dtype.uint64: # return b1 # self.v1 ^= 0xdd; # @unroll # for _ in range(D_ROUNDS): # self.sip_round() # let b2 = self.v0 ^ self.v1 ^ self.v2 ^ self.v3; # return (UInt128(b2) << 64) | b1 @always_inline fn round(inout self, owned b: SIMD[DType.uint8, 8]): var m_buf = SIMD[DType.uint8, sizeof[UInt64]()]() @unroll for i in range(8): m_buf[i] = b[i] let m = from_le_bytes[DType.uint64](m_buf) self.v3 ^= m @unroll for i in range(C_ROUNDS): self.sip_round() self.v0 ^= m @always_inline fn sip_round(inout self): self.v0 += self.v1 self.v1 = rotate_bits_left[13](self.v1) self.v1 ^= self.v0 self.v0 = rotate_bits_left[32](self.v0) self.v2 += self.v3 self.v3 = rotate_bits_left[16](self.v3) self.v3 ^= self.v2 self.v0 += self.v3 self.v3 = rotate_bits_left[21](self.v3) self.v3 ^= self.v0 self.v2 += self.v1 self.v1 = rotate_bits_left[17](self.v1) self.v1 ^= self.v2 self.v2 = rotate_bits_left[32](self.v2) @staticmethod fn hash[ MsgD: Dim ]( msg: Buffer[MsgD, DType.uint8], key: Buffer[Self.key_length, DType.uint8] ) raises -> SIMD[T, 1]: let aligned_len = len(msg) - (len(msg) % 8) var c = Self(key) c.update(slice_buf(msg, slice(0, aligned_len))) return c.final(slice_buf(msg, slice(aligned_len, len(msg)))) @value struct SipHash[T: DType, C_ROUNDS: Int, D_ROUNDS: Int]: alias key_length = 16 alias mac_length = sizeof[SIMD[T, 1]]() alias block_length = 8 alias State = SipHashStateless[T, C_ROUNDS, D_ROUNDS] var state: Self.State var ptr: DTypePointer[DType.uint8] var buf: Buffer[8, DType.uint8] var buf_len: Int fn __init__(inout self, key: Buffer[Self.key_length, DType.uint8]) raises: # constrained[T == DType.uint64 or T== DType.uint128]() constrained[T == DType.uint64]() constrained[C_ROUNDS > 0 and D_ROUNDS > 0]() self.state = SipHashStateless[T, C_ROUNDS, D_ROUNDS](key) self.ptr = DTypePointer[DType.uint8]().alloc(8) self.buf = Buffer[8, DType.uint8](self.ptr) self.buf_len = 0 fn update(inout self, b: Buffer[Dim(), DType.uint8]): """ Add data to the state. """ var off = 0 if self.buf_len != 0 and self.buf_len + len(b) >= 8: off += 8 - self.buf_len memcpy(self.buf.data.offset(self.buf_len), b.data, off) self.state.update(self.buf) self.buf_len = 0 let remain_len = len(b) - off let aligned_len = remain_len - (remain_len % 8) self.state.update(slice_buf(b, slice(off, off + aligned_len))) let b_slice = slice_buf(b, slice(off + aligned_len, len(b))) memcpy(self.buf.data.offset(self.buf_len), b_slice.data, len(b_slice)) self.buf_len += len(b_slice) fn peek(self) -> Buffer[Self.mac_length, DType.uint8]: var copy = self return copy.final_result() fn final(inout self, out: Buffer[Self.mac_length, DType.uint8]): """ Return an authentication tag for the current state Assumes `out` is less than or equal to `mac_length`. """ let s = self.state.final(slice_buf(self.buf, slice(0, self.buf_len))) let bytes = to_le_bytes(s) out.simd_store[Self.mac_length](0, bytes) fn final_result(inout self) -> Buffer[Self.mac_length, DType.uint8]: let result = Buffer[Self.mac_length, DType.uint8]().stack_allocation() self.final(result) return result @staticmethod fn create( out: Buffer[Self.mac_length, DType.uint8], msg: Buffer[Dim(), DType.uint8], key: Buffer[Self.key_length, DType.uint8], ) raises: """ Return an authentication tag for a message and a key. """ var ctx = Self(key) ctx.update(msg) ctx.final(out) fn final_int(inout self) -> SIMD[T, 1]: """ Return an authentication tag for the current state, as an integer. """ return self.state.final(slice_buf(self.buf, slice(0, self.buf_len))) @staticmethod fn to_int( msg: Buffer[Dim(), DType.uint8], key: Buffer[Self.key_length, DType.uint8], ) raises -> SIMD[T, 1]: """ Return an authentication tag for a message and a key, as an integer. """ return Self.State.hash(msg, key) fn __del__(owned self): self.ptr.free() alias UInt8x8 = SIMD[DType.uint8, 8] alias SipHash24 = SipHash[DType.uint64, 2, 4] alias TEST_DATA_LEN = 63 alias TEST_DATA: StaticTuple[TEST_DATA_LEN, SIMD[DType.uint8, 8]] = StaticTuple[ 63, SIMD[DType.uint8, 8] ]( SIMD[DType.uint8, 8](49, 14, 14, 221, 71, 219, 111, 114), SIMD[DType.uint8, 8](253, 103, 220, 147, 197, 57, 248, 116), SIMD[DType.uint8, 8](90, 79, 169, 217, 9, 128, 108, 13), SIMD[DType.uint8, 8](45, 126, 251, 215, 150, 102, 103, 133), SIMD[DType.uint8, 8](183, 135, 113, 39, 224, 148, 39, 207), SIMD[DType.uint8, 8](141, 166, 153, 205, 100, 85, 118, 24), SIMD[DType.uint8, 8](206, 227, 254, 88, 110, 70, 201, 203), SIMD[DType.uint8, 8](55, 209, 1, 139, 245, 0, 2, 171), SIMD[DType.uint8, 8](98, 36, 147, 154, 121, 245, 245, 147), SIMD[DType.uint8, 8](176, 228, 169, 11, 223, 130, 0, 158), SIMD[DType.uint8, 8](243, 185, 221, 148, 197, 187, 93, 122), SIMD[DType.uint8, 8](167, 173, 107, 34, 70, 47, 179, 244), SIMD[DType.uint8, 8](251, 229, 14, 134, 188, 143, 30, 117), SIMD[DType.uint8, 8](144, 61, 132, 192, 39, 86, 234, 20), SIMD[DType.uint8, 8](238, 242, 122, 142, 144, 202, 35, 247), SIMD[DType.uint8, 8](229, 69, 190, 73, 97, 202, 41, 161), SIMD[DType.uint8, 8](219, 155, 194, 87, 127, 204, 42, 63), SIMD[DType.uint8, 8](148, 71, 190, 44, 245, 233, 154, 105), SIMD[DType.uint8, 8](156, 211, 141, 150, 240, 179, 193, 75), SIMD[DType.uint8, 8](189, 97, 121, 167, 29, 201, 109, 187), SIMD[DType.uint8, 8](152, 238, 162, 26, 242, 92, 214, 190), SIMD[DType.uint8, 8](199, 103, 59, 46, 176, 203, 242, 208), SIMD[DType.uint8, 8](136, 62, 163, 227, 149, 103, 83, 147), SIMD[DType.uint8, 8](200, 206, 92, 205, 140, 3, 12, 168), SIMD[DType.uint8, 8](148, 175, 73, 246, 198, 80, 173, 184), SIMD[DType.uint8, 8](234, 184, 133, 138, 222, 146, 225, 188), SIMD[DType.uint8, 8](243, 21, 187, 91, 184, 53, 216, 23), SIMD[DType.uint8, 8](173, 207, 107, 7, 99, 97, 46, 47), SIMD[DType.uint8, 8](165, 201, 29, 167, 172, 170, 77, 222), SIMD[DType.uint8, 8](113, 101, 149, 135, 102, 80, 162, 166), SIMD[DType.uint8, 8](40, 239, 73, 92, 83, 163, 135, 173), SIMD[DType.uint8, 8](66, 195, 65, 216, 250, 146, 216, 50), SIMD[DType.uint8, 8](206, 124, 242, 114, 47, 81, 39, 113), SIMD[DType.uint8, 8](227, 120, 89, 249, 70, 35, 243, 167), SIMD[DType.uint8, 8](56, 18, 5, 187, 26, 176, 224, 18), SIMD[DType.uint8, 8](174, 151, 161, 15, 212, 52, 224, 21), SIMD[DType.uint8, 8](180, 163, 21, 8, 190, 255, 77, 49), SIMD[DType.uint8, 8](129, 57, 98, 41, 240, 144, 121, 2), SIMD[DType.uint8, 8](77, 12, 244, 158, 229, 212, 220, 202), SIMD[DType.uint8, 8](92, 115, 51, 106, 118, 216, 191, 154), SIMD[DType.uint8, 8](208, 167, 4, 83, 107, 169, 62, 14), SIMD[DType.uint8, 8](146, 89, 88, 252, 214, 66, 12, 173), SIMD[DType.uint8, 8](169, 21, 194, 155, 200, 6, 115, 24), SIMD[DType.uint8, 8](149, 43, 121, 243, 188, 10, 166, 212), SIMD[DType.uint8, 8](242, 29, 242, 228, 29, 69, 53, 249), SIMD[DType.uint8, 8](135, 87, 117, 25, 4, 143, 83, 169), SIMD[DType.uint8, 8](16, 165, 108, 245, 223, 205, 154, 219), SIMD[DType.uint8, 8](235, 117, 9, 92, 205, 152, 108, 208), SIMD[DType.uint8, 8](81, 169, 203, 158, 203, 163, 18, 230), SIMD[DType.uint8, 8](150, 175, 173, 252, 44, 230, 102, 199), SIMD[DType.uint8, 8](114, 254, 82, 151, 90, 67, 100, 238), SIMD[DType.uint8, 8](90, 22, 69, 178, 118, 213, 146, 161), SIMD[DType.uint8, 8](178, 116, 203, 142, 191, 135, 135, 10), SIMD[DType.uint8, 8](111, 155, 180, 32, 61, 231, 179, 129), SIMD[DType.uint8, 8](234, 236, 178, 163, 11, 34, 168, 127), SIMD[DType.uint8, 8](153, 36, 164, 60, 193, 49, 87, 36), SIMD[DType.uint8, 8](189, 131, 141, 58, 175, 191, 141, 183), SIMD[DType.uint8, 8](11, 26, 42, 50, 101, 213, 26, 234), SIMD[DType.uint8, 8](19, 80, 121, 163, 35, 28, 230, 96), SIMD[DType.uint8, 8](147, 43, 40, 70, 228, 215, 6, 102), SIMD[DType.uint8, 8](225, 145, 95, 92, 177, 236, 164, 108), SIMD[DType.uint8, 8](243, 37, 150, 92, 161, 109, 98, 159), SIMD[DType.uint8, 8](87, 95, 242, 142, 96, 56, 27, 229), SIMD[DType.uint8, 8](114, 69, 6, 235, 76, 50, 138, 149), ) fn test_siphash64_2_4(test_key: Buffer[16, DType.uint8]) raises: let msg = Buffer[64, DType.uint8]().stack_allocation() for i in range(TEST_DATA_LEN): msg[i] = i @parameter fn test_inner(i: Int): let out = Buffer[SipHash24.mac_length, DType.uint8]().stack_allocation() try: SipHash24.create(out, slice_buf(msg, slice(0, i)), test_key) except: print("failed on test: ", i) let out_str = String( StringRef(out.data.bitcast[DType.int8]().address, SipHash24.mac_length) ) var vector = TEST_DATA[i] let vector_str = String( StringRef( Pointer.address_of[SIMD[DType.uint8, 8]](vector) .bitcast[__mlir_type.`!pop.scalar<si8>`]() .address, SipHash24.mac_length, ) ) if not testing.assert_equal(vector_str, out_str): pass parallelize[test_inner](TEST_DATA_LEN) fn test_iterative_non_divisible_update() raises: alias BUF_LEN = 1024 let buf = Buffer[BUF_LEN, DType.uint8]().stack_allocation() @unroll for i in range(BUF_LEN): buf[i] = i let key_str = String("0x128dad08f12307") let key = Buffer[SipHash24.key_length, DType.uint8]().stack_allocation() for i in range(SipHash24.key_length): key[i] = ord(key_str[i]) let end = 9 for _ in range(end, len(buf), 9): let non_iterative_hash = SipHash24.to_int(slice_buf(buf, slice(0, end)), key) var siphash = SipHash24(key) for i in range(0, end, 7): siphash.update(slice_buf(buf, slice(i, min(i + 7, end)))) let iterative_hash = siphash.final_int() if not testing.assert_equal(iterative_hash, non_iterative_hash): raise Error("failed") fn run_tests() raises: # Test vectors from reference implementation. # https://github.com/veorq/SipHash/blob/master/vectors.h let bufptr = DTypePointer[DType.uint8]().alloc(16) let test_key = Buffer[ 16, DType.uint8, ](bufptr) test_key.simd_store[16]( 0, SIMD[DType.uint8, 16]( 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xA, 0xB, 0xC, 0x0D, 0x0E, 0x0F, ), ) test_siphash64_2_4(test_key) test_iterative_non_divisible_update() --- write/__init__.mojo --- """ A port of Zig's BufferedReader. Example: ======== from shims.file import File from shims.read import BufReader from shims.write import BufWriter from memory.buffer import Buffer fn main() raises: let f = File("a.txt", "r") let out_f = File("a2.txt", "w+") var reader = BufReader[4096](f ^) var writer = BufWriter[4096](out_f ^) let buf = Buffer[256, DType.uint8]().stack_allocation() var bytes_read = 1 while bytes_read > 0: bytes_read = reader.read(buf) if bytes_read > 0: print( StringRef( buf.data.as_scalar_pointer() .bitcast[__mlir_type.`!pop.scalar<si8>`]() .address, bytes_read, ) ) let write_buf = Buffer[Dim(), DType.uint8](buf.data, bytes_read) let bytes_written = writer.write(write_buf) _ = bytes_written """ from shims.file import File from memory import memcpy struct BufWriter[BUF_SIZE: Int]: var unbuffered_writer: File var data: DTypePointer[DType.uint8] var end: Int fn __init__(inout self, owned writer: File): self.unbuffered_writer = writer ^ self.data = DTypePointer[DType.uint8]().alloc(BUF_SIZE) self.end = 0 fn __del__(owned self) raises: self.flush() fn flush(inout self) raises: self.unbuffered_writer.write_all( Buffer[Dim(), DType.uint8](self.data, self.end) ) self.end = 0 fn write[D: Dim](inout self, bytes: Buffer[D, DType.uint8]) raises -> Int: if self.end + len(bytes) > BUF_SIZE: self.flush() if len(bytes) > BUF_SIZE: return self.unbuffered_writer.write(bytes) let new_end = self.end + len(bytes) memcpy(self.data.offset(self.end), bytes.data, new_end - self.end) self.end = new_end return len(bytes) fn write(inout self, str: StringRef) raises -> Int: var strbuf = DynamicVector[UInt8]() for i in range(len(str)): strbuf.push_back(ord(str[i])) let buf = Buffer[Dim(), DType.uint8](strbuf.data, len(strbuf)) return self.write(buf) --- wyhash/__init__.mojo --- """ A port of Zig's Wyhash See: https://github.com/ziglang/zig/blob/master/lib/std/hash/wyhash.zig """ from memory.unsafe import DTypePointer, Pointer from memory import memcpy, memset_zero, stack_allocation from utils.static_tuple import StaticTuple from utils.list import Dim import testing from shims.bitcast import from_le_bytes alias UInt64x4 = SIMD[DType.uint64, 4] @always_inline fn mum(inout a: UInt64, inout b: UInt64): let x = _umul128(a, b) a = x[0] b = x[1] @always_inline fn mix(a_: UInt64, b_: UInt64) -> UInt64: var a = a_ var b = b_ mum(a, b) return a ^ b @always_inline fn _umul128(multiplier: UInt64, multiplicand: UInt64) -> SIMD[DType.uint64, 2]: """Taken from stack overflow. https://stackoverflow.com/a/46923106 """ # multiplier = ab = a * 2^32 + b # multiplicand = cd = c * 2^32 + d # ab * cd = a * c * 2^64 + (a * d + b * c) * 2^32 + b * d let a = multiplier >> 32 let b = multiplier & 0xFFFFFFFF let c = multiplicand >> 32 let d = multiplicand & 0xFFFFFFFF # let ac = a * c let ad = a * d # let bc = b * c let bd = b * d let adbc = ad + (b * c) let adbc_carry = 1 if adbc < ad else 0 # multiplier * multiplicand = product_hi * 2^64 + product_lo let product_lo = bd + (adbc << 32) let product_lo_carry = 1 if product_lo < bd else 0 let product_hi = (a * c) + (adbc >> 32) + (adbc_carry << 32) + product_lo_carry return SIMD[DType.uint64, 2](product_hi, product_lo) fn test_umul128() raises: let a: UInt64 let b: UInt64 a, b = UInt64(0x0FFFFFFFFFFFFFFF), UInt64(0xF0000000) # testing.assert_equal( # _umul128(a, b), SIMD[DType.uint64, 2](0xEFFFFFF, 0xFFFFFFFF10000000) # ) struct Wyhash: var _secret: UInt64x4 var a: UInt64 var b: UInt64 # we only care about the first three values var state: StaticTuple[3, UInt64] var total_len: Int var buf: StaticTuple[48, UInt8] var buf_len: Int fn __init__(inout self, seed: UInt64): self._secret = SIMD[DType.uint64, 4]( 0xA0761D6478BD642F, 0xE7037ED1A0B428DB, 0x8EBC6AF09C88C6E3, 0x589965CC75374CC3, ) self.a = 0 self.b = 0 self.buf_len = 0 self.total_len = 0 self.state = StaticTuple[3, UInt64]() self.buf = StaticTuple[48, UInt8]() memset_zero(Pointer.address_of(self.buf).bitcast[UInt8](), 48) self.state[0] = seed ^ mix(seed ^ self._secret[0], self._secret[1]) self.state[1] = self.state[0] self.state[2] = self.state[0] @always_inline fn __copyinit__(inout self, other: Self): self.a = other.a self.b = other.b self.state = other.state self.total_len = other.total_len self.buf_len = 0 self.buf = StaticTuple[48, UInt8]() self._secret = UInt64x4( 0xA0761D6478BD642F, 0xE7037ED1A0B428DB, 0x8EBC6AF09C88C6E3, 0x589965CC75374CC3, ) # This is subtly different from other hash function update calls. Wyhash requires the last # full 48-byte block to be run through final1 if is exactly aligned to 48-bytes. @always_inline fn update[D: Dim](inout self, input: Buffer[D, DType.uint8]): self.total_len += len(input) if len(input) <= 48 - self.buf_len: memcpy( DTypePointer[DType.uint8]( Pointer.address_of(self.buf).bitcast[UInt8]().offset(self.buf_len) ), input.data, len(input), ) self.buf_len += len(input) return var i = 0 if self.buf_len > 0: i = 48 - self.buf_len memcpy( Pointer.address_of(self.buf).bitcast[UInt8]().offset(self.buf_len), input.data, i, ) self.round( Buffer[48, DType.uint8](Pointer.address_of(self.buf).bitcast[UInt8]()) ) self.buf_len = 0 for i in range(i, len(input), 48): self.round( Buffer[48, DType.uint8](input.data.offset(i).as_scalar_pointer()) ) let remaining_bytes = Buffer[Dim(), DType.uint8]( input.data.offset(i), len(input) - i ) if len(remaining_bytes) < 16 and i >= 48: let rem = 16 - len(remaining_bytes) memcpy( Pointer.address_of(self.buf) .bitcast[UInt8]() .offset(self.buf.__len__() - rem), input.data.offset(i - rem), i, ) memcpy( Pointer.address_of(self.buf).bitcast[UInt8](), remaining_bytes.data.as_scalar_pointer(), len(remaining_bytes), ) self.buf_len = len(remaining_bytes) @always_inline fn final(inout self) -> UInt64: let input_ptr = Pointer.address_of(self.buf).bitcast[UInt8]() var input = Buffer[Dim(), DType.uint8](input_ptr, self.buf_len) var new_self = self # ensure idempotency if self.total_len <= 16: new_self.small_key(input) else: var offset: Int = 0 if self.buf_len < 16: var scratch = StaticTuple[16, UInt8]() let scratch_pointer = Pointer.address_of(scratch).bitcast[UInt8]() let buf_ptr = Pointer.address_of(self.buf).bitcast[UInt8]() let rem = 16 - self.buf_len memcpy(scratch_pointer, buf_ptr.offset(self.buf.__len__() - rem), rem) memcpy(scratch_pointer.offset(rem), buf_ptr, self.buf_len) # Same as input but with additional bytes preceeding start in case of a short buffer input = Buffer[Dim(), DType.uint8](scratch_pointer, 16) offset = rem new_self.final0() new_self.final1(input, offset) return new_self.final2() @staticmethod fn hash[D: Dim](seed: UInt64, input: Buffer[D, DType.uint8]) -> UInt64: var self = Self(seed) if len(input) <= 16: self.small_key(input) else: var i: Int = 0 if len(input) >= 48: while i + 48 < len(input): self.round(Buffer[48, DType.uint8](input.data.offset(i))) i += 48 self.final0() self.final1(input, i) self.total_len = len(input) return self.final2() @always_inline fn small_key[D: Dim](inout self, input: Buffer[D, DType.uint8]): # constrained[D.get() <= 16]() if len(input) >= 4: let end = len(input) - 4 let quarter = (len(input) >> 3) << 2 # self.a = ( # UInt64( # ( # from_le_bytes[DType.uint32]( # Buffer[sizeof[UInt32](), DType.uint8](input.data) # ) # ).to_int() # ) # << 32 # ) | UInt64( # from_le_bytes[DType.uint32]( # Buffer[sizeof[UInt32](), DType.uint8](input.data.offset(quarter)) # ).to_int() # ) # self.b = ( # UInt64( # ( # from_le_bytes[DType.uint32]( # Buffer[sizeof[UInt32](), DType.uint8]( # input.data.offset(end) # ) # ) # ).to_int() # ) # << 32 # ) | UInt64( # from_le_bytes[DType.uint32]( # Buffer[sizeof[UInt32](), DType.uint8]( # input.data.offset(end - quarter) # ) # ).to_int() # ) # elif len(input) > 0: # self.a = ( # (UInt64(input[0].to_int()) << 16) # | (UInt64(input[len(input) >> 1].to_int()) << 8) # | UInt64(input[len(input) - 1].to_int()) # ) # self.b = 0 # else: # self.a = 0 # self.b = 0 fn round(inout self, input: Buffer[48, DType.uint8]): @unroll for i in range(3): # let a = from_le_bytes[DType.uint64]( # Buffer[sizeof[UInt64](), DType.uint8](input.data.offset(8 * (2 * i))) # ) # let b = from_le_bytes[DType.uint64]( # Buffer[sizeof[UInt64](), DType.uint8]( # input.data.offset(8 * (2 * i + 1)) # ) # ) # self.state[i] = mix(a ^ self._secret[i + 1], b ^ self.state[i]) pass @always_inline fn final0(inout self): self.state[0] ^= self.state[1] ^ self.state[2] # input_lb must be at least 16-bytes long (in shorter key cases the smallKey function will be # used instead). We use an index into a slice to for comptime processing as opposed to if we # used pointers. fn final1[D: Dim](inout self, input_lb: Buffer[D, DType.uint8], start_pos: Int): # constrained(input_lb.len >= 16); # constrained(input_lb.len - start_pos <= 48); let input = Buffer[Dim(), DType.uint8]( input_lb.data.offset(start_pos), len(input_lb) - start_pos ) for i in range(0, len(input), 16): pass # self.state[0] = mix( # from_le_bytes[DType.uint64]( # Buffer[sizeof[UInt64](), DType.uint8]( # input.data.offset(i), len(input) - i # ) # ) # ^ self._secret[1], # from_le_bytes[DType.uint64]( # Buffer[sizeof[UInt64](), DType.uint8]( # input.data.offset(i + 8), len(input) - i + 8 # ) # ) # ^ self.state[0], # ) # self.a = from_le_bytes[DType.uint64]( # Buffer[sizeof[UInt64](), DType.uint8]( # input_lb.data.offset(len(input_lb) - 16) # ) # ) # self.b = from_le_bytes[DType.uint64]( # Buffer[sizeof[UInt64](), DType.uint8]( # input_lb.data.offset(len(input_lb) - 8) # ) # ) @always_inline fn final2(inout self) -> UInt64: self.a ^= self._secret[1] print(self._secret[1]) self.b ^= self.state[0] mum(self.a, self.b) return mix(self.a ^ self._secret[0] ^ self.total_len, self.b ^ self._secret[1]) --- README.md --- # Mojo with Qt6 Install mojo and python. ```sh-session $ curl -s https://get.modular.com | sh - $ /opt/homebrew/bin/python3.11 -m venv venv $ source venv/bin/activate $ pip install PySide6 $ mojo qt.mojo ``` The demo launches a QML UI from mojo, and calls a mojo fn from QML when the button is clicked. --- app.qml --- import QtQuick import QtQuick.Controls import QtQuick.Layouts Window { width: 300 height: 200 visible: true title: "Hello Mojo" ColumnLayout { anchors.fill: parent Text { id: text text: "Hello World" Layout.alignment: Qt.AlignHCenter } Button { text: "Click me" Layout.alignment: Qt.AlignHCenter onClicked: on_clicked.invoke() } } } --- experiments/callback.mojo --- from python import Python fn callback() -> Int: print("mojo callback running") return 42 fn main() raises: Python.add_to_path("./") var callback_mod = Python.import_module("callback") print("calling python callback from mojo") var fn_address = UnsafePointer[fn () -> Int].address_of(callback).bitcast[Int64]()[0] callback_mod.callback(fn_address) --- experiments/callback.py --- import ctypes def callback(mojo_fn_address): print(f"in python callback, address {mojo_fn_address}") prototype = ctypes.CFUNCTYPE(ctypes.c_int) mojo_func = prototype(mojo_fn_address) print("calling mojo fn from python") result = mojo_func() print(f"result {result}") --- experiments/widget.mojo --- import sys from python import Python fn main() raises: var QtWidgets = Python.import_module("PySide6.QtWidgets") var argv: PythonObject = [sys.argv()[0]] var app = QtWidgets.QApplication(argv) var button = QtWidgets.QPushButton("Hello") button.resize(100, 100) button.show() sys.exit(app.exec()) --- experiments/widget.py --- import sys from PySide6.QtWidgets import QApplication, QPushButton if __name__ == "__main__": app = QApplication(sys.argv) button = QPushButton("Hello") button.resize(100, 100) button.show() sys.exit(app.exec()) --- experiments/window.mojo --- import sys from python import Python fn main() raises: var QtGui = Python.import_module("PySide6.QtGui") var argv: PythonObject = [sys.argv()[0]] var app = QtGui.QGuiApplication(argv) var window = QtGui.QWindow() window.setTitle("Mojo window") window.resize(100, 100) window.requestActivate() window.show() print("size", window.size(), "active", window.isActive(), "winid", window.winId()) sys.exit(app.exec()) _ = window --- experiments/window.py --- import sys from PySide6.QtGui import QGuiApplication, QWindow if __name__ == "__main__": app = QGuiApplication(sys.argv) window = QWindow() window.setTitle("Python window") window.resize(100, 100) window.requestActivate() window.show() print("size", window.size(), "active", window.isActive(), "winid", window.winId()) sys.exit(app.exec()) --- invoke.py --- import ctypes from PySide6.QtCore import QObject, Slot prototype = ctypes.CFUNCTYPE(ctypes.c_void_p) class Invoke(QObject): def __init__(self, fn_address): super().__init__() self.mojo_fn = prototype(fn_address) @Slot() def invoke(self): self.mojo_fn() --- qt.mojo --- import sys from python import Python fn on_clicked(): print("mojo on_clicked called from Python") fn main() raises: Python.add_to_path("./") var QtGui = Python.import_module("PySide6.QtGui") var QtQml = Python.import_module("PySide6.QtQml") var invoke = Python.import_module("invoke") var fn_address = UnsafePointer[fn () -> None].address_of(on_clicked).bitcast[Int64]()[0] var invoke_on_clicked = invoke.Invoke(fn_address) var argv: PythonObject = [sys.argv()[0]] var app = QtGui.QGuiApplication(argv) var engine = QtQml.QQmlApplicationEngine() engine.rootContext().setContextProperty("on_clicked", invoke_on_clicked) engine.load("app.qml") if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec()) _ = engine _ = invoke_on_clicked --- LICENSE --- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- README.md --- <br/> <p align="center"> <a href="https://github.com/alainrollejr/mocodes"> <img src="https://github.com/alainrollejr/mocodes/blob/main/mocodeslogo.png" alt="Logo" width="200" height="200"> </a> <h1 align="center">MoCodes</h1> <p align="center"> An Error Correction (De)Coding library in pure Mojo 🔥 </p> </p> ## About The Project MoCodes is a stand-alone Error Correction (De)Coding framework that leverages the power of Mojo. As [discussed](https://docs.modular.com/mojo/why-mojo) by Modular, Mojo is a language for the future of AI development. Built on top of MLIR technology, rather than existing GCC and LLVM approaches, Mojo looks and feels like Python code, yet performs much closer to languages like Rust or C++. Error Correction Codes are being used in domains such as Wireless Communication and Quantum Computing. They are known to be very compute intensive, so much so that until recently they were implemented in dedicated ASIC silicon or programmed on FPGA accelerators. In recent years with the advent of wide-vector SIMD CPU architectures and affordable yet powerful GPU cores they have been also implemented in C++ with a lot of vendor-specific intrinsics on CPU or with CUDA on GPU as well. About time then to take a stab at how well Mojo lives up to the challenge (and how well the authors live up to the challenge of understanding how Mojo is meant to be used) ## Benchmark We've been on a voyage of exploration to find out how platform-independent frameworks originally meant for machine learning can be repurposed for error correction decoding. We have had reasonable results on GPU and TPU but not until Mojo came along we've reached decent throughputs on CPU. Results ofc vary with platform specifics, we have tried Intel, AMD and Macbook M3. ![ldpc_benchmark](https://github.com/alainrollejr/mocodes/blob/main/mocodesbenchmark.png) While that looks awesome we estimate that there is a performance gap of about a factor 2 yet to be closed wrt C++ code that uses vendor specific intrinsics eg from the avx instruction set on Intel. Game on ! For now we only support generic (ir)regular LDPC codes with *embarrassingly parallel* flooding batch decoding. We have committed just one example (1512 x 1872) LDPC Parity Check Matrix to this repo. This sparse parity check matrix has 7092 non-zero elements and is shown hereafter. ![ldpc_pcm](https://github.com/alainrollejr/mocodes/blob/main/codebook/example_pcm.png) For now, this parity check matrix gets translated to look-up tables by an offline scipy script that takes an .npz file as input. The look-up tables get stored in the /codebook/ subdirectory. ## Quick Start Try out the LDPC benchmark for yourself, on your own platform: ``` mojo build ldpcdec.mojo ``` ``` ./ldpcdec ``` You can tweak the following parameters in the main() function of [types.mojo](https://github.com/alainrollejr/mocodes/blob/main/types.mojo): *intra_codeword_parallellism_factor, ncodewordperthread, nthread*. Currently committed defaults seem to be close to optimal regardless the platform we have tried. ## Roadmap ### v1.0 ✅ - [x] support for irregular LDPC decoding - [x] support for (batch) early stopping ### v1.1 (WIP) - [ ] Improve throughput (target: factor 2) by community expertise injection - [ ] Add a serving functionality (preferably gRPC based, ideally leveraging MAX serving) - [ ] Add profiling and proper benchmarking tests ### v1.2 - [ ] incorporate generation of Look-Up Tables in the mojo code, such that the .npz file becomes the only configuration input that defines the code - [ ] add an LDPC encoder - [ ] add a script to simulate and visualise BER and BLER curves - [ ] Autotuning and related features ### Longer Term - [ ] Add polar codes - [ ] Add Reed-Solomon codes - [ ] Add CRC check codes - [ ] Add layered LDPC decoding ## Contributing The way we set this repo up should allow Mojo experts to contribute without necessarily being Error Correction Coding specialists. Notably, the LDPC heavy lifting is done by a handful of functions in [types.mojo](https://github.com/alainrollejr/mocodes/blob/main/ldpc/types.mojo), i.e. *fn all_Lqij()* and *fn cnpu()*. Memory load and store at this point seem to determine the throughput so all tips and tricks to speed up that memory access would much appreciated, along with any other improvements that can be spotted by expert *Mojicans*. If you are considering larger contributions, feel free to contact us for a smoother communication channel on Discord. If you find a bug or have an idea for a feature, please use our issue tracker. Before creating a new issue, please: * Check if the issue already exists. If an issue is already reported, you can contribute by commenting on the existing issue. * If not, create a new issue and include all the necessary details to understand/recreate the problem or feature request. ### Creating A Pull Request 1. Fork the Project 2. Create your Feature Branch 3. Commit your Changes 4. Push to the Branch 5. Open a Pull Request > Once your changes are pushed, navigate to your fork on GitHub. And create a pull request against the original repository. > - Before creating a PR make sure the functional text output of ./ldpcdec is the same as the one on the main branch, i.e the batch syndrome on the all-zeros codewords should stay zero and the logit output values should all still equal 127. > - In the pull request, provide a detailed description of the changes and why they're needed. Link any relevant issues. ## License Distributed under the Apache 2.0 License. ## Acknowledgements * Built with [Mojo](https://github.com/modularml/mojo) created by [Modular](https://github.com/modularml) --- codebook/__init__.mojo --- --- codebook/luts.mojo --- alias nnz = 7092 alias nc = 1872 alias cnpu_sizes: VariadicList[Int]=VariadicList (3, 4, 5, 6, 8, 10) alias ncnpu = 6 alias cnpu_indices: VariadicList[Int]=VariadicList (0, 216, 936, 1260, 1368, 1440) alias vnpu_sizes: VariadicList[Int]=VariadicList (22, 23, 10, 5, 14, 7, 13, 6, 8, 9, 16, 9, 12, 1) alias nvnpu = 14 alias vnpu_indices: VariadicList[Int]=VariadicList (0, 36, 72, 108, 180, 216, 252, 288, 324, 360, 396, 432, 468, 504) --- codebook/repeats.bin ---      --- ldpc/__init__.mojo --- --- ldpc/types.mojo --- from math import trunc, mod,min,abs,max from memory.unsafe import DTypePointer from sys.info import simdwidthof from python import Python from python.object import PythonObject from random import rand, randint from algorithm import vectorize, parallelize from testing import assert_true from tensor import Tensor, TensorSpec, TensorShape from sys.intrinsics import strided_load, PrefetchOptions from sys.info import num_physical_cores, num_logical_cores, num_performance_cores from collections import List from collections.vector import InlinedFixedVector alias dtype = DType.int8 alias nelts = 2*simdwidthof[dtype]() # The SIMD vector width, for some reason overbooking by factor 2 helps alias max_allowed = SIMD[DType.int16,nelts](127) alias min_allowed = SIMD[DType.int16,nelts](-127) @parameter fn all_cnpu_compiled(inout ip: Tensor3D, nnz: Int, ncnpu: Int, cnpu_sizes: VariadicList[Int],cnpu_indices: VariadicList[Int]) raises: var slice_start : Int = 0 for idx in range(ncnpu): var slice_stop : Int var n = cnpu_sizes[idx] if (idx == (ncnpu - 1)): slice_stop = nnz else: slice_stop = slice_start + (cnpu_indices[idx+1] - cnpu_indices[idx])*n var block = ip.get_reference_to_row_slice(slice_start, slice_stop) # block.print() # print("cnpu [",slice_start,":",slice_stop,"] reshape to ",n) block.reshape_dim0(n) block.cnpu() block.flatten_dim2() slice_start = slice_stop @parameter fn all_syndromes_compiled(inout ip: Tensor3D,nnz: Int, ncnpu: Int, cnpu_sizes: VariadicList[Int], cnpu_indices: VariadicList[Int]) raises: var slice_start : Int = 0 for idx in range(ncnpu): var slice_stop : Int var n = cnpu_sizes[idx] if (idx == (ncnpu - 1)): slice_stop = nnz else: slice_stop = slice_start + (cnpu_indices[idx+1] - cnpu_indices[idx])*n var block = ip.get_reference_to_row_slice(slice_start, slice_stop) # block.print() # print("cnpu [",slice_start,":",slice_stop,"] reshape to ",n) block.reshape_dim0(n) block.syndromes() block.flatten_dim2() slice_start = slice_stop @parameter fn all_Lqij(inout ip: Tensor3D, llr: Tensor3D, start_codeword_idx: Int, intra_codeword_parallellism_factor: Int,nc: Int,rep_indices: Tensor[DType.uint16], rep_offsets: Tensor[DType.uint16], r2c_indices: Tensor[DType.uint16]) raises: # this version just loops over columns of the virtual column-first stored LLRs # below prefetch lines compile but don't seem to make a performance difference # alias r_opt = PrefetchOptions().high_locality() # llr.data().prefetch[r_opt]() # ip.data().prefetch[r_opt]() @parameter fn vnpu(column_idx:Int): var n_simd = rep_indices[column_idx] var n = n_simd.to_int() var slice_start = rep_offsets[column_idx].to_int() var lut_idx_cache = InlinedFixedVector[Int](n) for j in range(0,n): var m = r2c_indices[slice_start + j].to_int() lut_idx_cache[j] = m @parameter fn vp[nelts_local: Int](k: Int): # if n > 1: var sum = llr.load[nelts](column_idx, k+start_codeword_idx) var sum_int16 = sum.cast[DType.int16]() for j in range(0,n): var m = lut_idx_cache[j] var el = ip.load[nelts](m, k) var el_16 = el.cast[DType.int16]() sum_int16 += el_16 var tmp = sum_int16 for j in range(n): # var m = r2c_indices[slice_start+j] var m = lut_idx_cache[j] # TODO: find a way to avoid the second load from memory, perhaps by making use of memory > buffer struct var el = ip.load[nelts](m, k) tmp = sum_int16 - el.cast[DType.int16]() tmp = tmp.min(max_allowed) tmp = tmp.max(min_allowed) var tmp_dtype = tmp.cast[dtype]() ip.store[nelts](m,k,tmp_dtype) vectorize[vp, nelts](ip.dim1) #vectorize_unroll[nelts,8,vp](ip.dim1) # unroll factor ideally set to ip.dim1//nelts parallelize[vnpu](nc,intra_codeword_parallellism_factor) @parameter fn all_LQ(inout ip: Tensor3D, llr: Tensor3D, inout op: Tensor3D, start_codeword_idx: Int, intra_codeword_parallellism_factor: Int,nc: Int, ncodeword: Int, rep_indices: Tensor[DType.uint16], rep_offsets: Tensor[DType.uint16], r2c_indices: Tensor[DType.uint16]) raises: @parameter fn vnpu(codebit_idx:Int): # equivalent of : "for codebit_idx in range(nc):" var n = rep_indices[codebit_idx].to_int() var slice_start = rep_offsets[codebit_idx].to_int() var lut_idx_cache = InlinedFixedVector[Int](n) for j in range(0,n): var m = r2c_indices[slice_start+j].to_int() lut_idx_cache[j] = m @parameter fn vp[nelts_local: Int](k: Int): # equivalent of : "for k in range(ncodeword):"" but we are taking nelts = simdwidth codewords at a time var sum = llr.load[nelts](codebit_idx, k+start_codeword_idx) var tmp = sum.cast[DType.int16]() for j in range(0,n): var m = lut_idx_cache[j] var el = ip.load[nelts](m, k) tmp += el.cast[DType.int16]() tmp = tmp.min(max_allowed) tmp = tmp.max(min_allowed) var tmp_dtype = tmp.cast[dtype]() @unroll for j in range(nelts): # subtoptimal, should be strided store but syntax eludes me a bit op.store[1](start_codeword_idx+k+j,codebit_idx,tmp_dtype[j]) vectorize[vp, nelts](ncodeword) #vectorize_unroll[nelts,8,vp](ip.dim1) # unroll factor ideally set to ip.dim1//nelts parallelize[vnpu](nc,intra_codeword_parallellism_factor) @parameter fn all_LQ_for_syndrome(inout ip: Tensor3D, llr: Tensor3D, inout op: Tensor3D, start_codeword_idx: Int, intra_codeword_parallellism_factor: Int,nc: Int, rep_indices:Tensor[DType.uint16], rep_offsets: Tensor[DType.uint16], r2c_indices: Tensor[DType.uint16]) raises: @parameter fn vnpu(column_idx:Int): # equivalent of : "for column_idx in range(nc):" var n = rep_indices[column_idx].to_int() var slice_start = rep_offsets[column_idx].to_int() var lut_idx_cache = InlinedFixedVector[Int](n) for j in range(0,n): var m = r2c_indices[slice_start+j].to_int() lut_idx_cache[j] = m @parameter fn vp[nelts_local: Int](k: Int): # TODO: if n == 1 we can at once set the result to zero across the board # also TODO : don't load the same values twice, create a local array of SIMD for the n values var sum = llr.load[nelts](column_idx, k+start_codeword_idx) var sum_int16 = sum.cast[DType.int16]() for j in range(0,n): var m = lut_idx_cache[j] var el = ip.load[nelts](m, k) sum_int16 += el.cast[DType.int16]() var tmp = sum_int16 for j in range(n): var m = lut_idx_cache[j] tmp = tmp.min(max_allowed) tmp = tmp.max(min_allowed) var tmp_dtype = tmp.cast[dtype]() op.store[nelts](m,k,tmp_dtype) vectorize[vp, nelts](ip.dim1) parallelize[vnpu](nc,intra_codeword_parallellism_factor) @parameter fn decode_compiled_v5[ base_niter: Int, max_niter: Int](ip : Tensor3D, inout op : Tensor3D, inout batch_syndrome: Int, intra_codeword_parallellism_factor: Int, start_codeword_idx: Int, nc: Int,nnz: Int, ncnpu: Int, nvnpu: Int, ncodeword: Int, rep_indices: Tensor[DType.uint16], rep_offsets: Tensor[DType.uint16], c2r_indices: Tensor[DType.uint16], r2c_indices: Tensor[DType.uint16], vnpu_sizes: VariadicList[Int], vnpu_indices: VariadicList[Int], cnpu_sizes: VariadicList[Int], cnpu_indices: VariadicList[Int]) raises: #print("decode_compiled_v5 on start_codeword_idx = ",start_codeword_idx) var ip_llr_rep = repeat_compiled_offset(ip, start_codeword_idx,rep_indices, nnz, ncodeword) ip_llr_rep.set_num_workers(intra_codeword_parallellism_factor) var syndrome_scratchpad = Tensor3D(nnz, ncodeword) syndrome_scratchpad.set_num_workers(intra_codeword_parallellism_factor) # first iteration, declares the variables var reliabilities = c2r(ip_llr_rep,c2r_indices) # a permuted copy # ip_llr_rep_rfirst reliabilities.set_num_workers(intra_codeword_parallellism_factor) all_cnpu_compiled(reliabilities,nnz, ncnpu, cnpu_sizes,cnpu_indices) # modifies in-place all_Lqij(reliabilities, ip,start_codeword_idx,intra_codeword_parallellism_factor,nc,rep_indices,rep_offsets,r2c_indices) # modifies in-place # remaining iterations #@unroll for idx in range(1,base_niter-1): all_cnpu_compiled(reliabilities,nnz, ncnpu, cnpu_sizes,cnpu_indices) # modifies in-place all_Lqij(reliabilities, ip,start_codeword_idx,intra_codeword_parallellism_factor,nc,rep_indices,rep_offsets,r2c_indices) # modifies in-place # final iteration all_cnpu_compiled(reliabilities,nnz, ncnpu, cnpu_sizes,cnpu_indices) # modifies in-place all_LQ(reliabilities, ip, op, start_codeword_idx, intra_codeword_parallellism_factor,nc,ncodeword,rep_indices,rep_offsets,r2c_indices) # modifies in-place # batch syndrome computation (inefficient, but leaves reliabilities untouched for continued iteration if must be ) all_LQ_for_syndrome(reliabilities, ip, syndrome_scratchpad, start_codeword_idx,intra_codeword_parallellism_factor,nc,rep_indices,rep_offsets,r2c_indices) # modifies syndrome_scratchpad in-place all_syndromes_compiled(syndrome_scratchpad, nnz, ncnpu, cnpu_sizes, cnpu_indices) batch_syndrome = syndrome_scratchpad.reduce_syndrome() var other_niter = max_niter - base_niter if other_niter > 0: if batch_syndrome != 0: all_Lqij(reliabilities, ip,start_codeword_idx,intra_codeword_parallellism_factor,nc,rep_indices,rep_offsets,r2c_indices) # modifies in-place for idx in range(1,other_niter-1): all_cnpu_compiled(reliabilities,nnz, ncnpu, cnpu_sizes,cnpu_indices) # modifies in-place all_Lqij(reliabilities, ip,start_codeword_idx,intra_codeword_parallellism_factor,nc,rep_indices,rep_offsets,r2c_indices) # modifies in-place # final iteration all_cnpu_compiled(reliabilities,nnz, ncnpu, cnpu_sizes,cnpu_indices) # modifies in-place all_LQ(reliabilities, ip, op, start_codeword_idx, intra_codeword_parallellism_factor,nc,ncodeword,rep_indices,rep_offsets,r2c_indices) # modifies in-place # batch syndrome computation (inefficient, but leaves reliabilities untouched for continued iteration if must be ) all_LQ_for_syndrome(reliabilities, ip, syndrome_scratchpad, start_codeword_idx,intra_codeword_parallellism_factor,nc,rep_indices,rep_offsets,r2c_indices) # modifies syndrome_scratchpad in-place all_syndromes_compiled(syndrome_scratchpad, nnz, ncnpu, cnpu_sizes, cnpu_indices) batch_syndrome = syndrome_scratchpad.reduce_syndrome() fn parallel_decode[base_niter: Int, max_niter: Int](ip : Tensor3D, inout op : Tensor3D, inout batch_syndrome: Int, intra_codeword_parallellism_factor: Int, nthread: Int, nc: Int,nnz: Int, ncnpu: Int, nvnpu: Int, ncodewordperthread: Int, rep_indices: Tensor[DType.uint16], rep_offsets: Tensor[DType.uint16], c2r_indices: Tensor[DType.uint16], r2c_indices: Tensor[DType.uint16], vnpu_sizes: VariadicList[Int], vnpu_indices: VariadicList[Int], cnpu_sizes: VariadicList[Int], cnpu_indices: VariadicList[Int]) raises: var syndromes = InlinedFixedVector[Int](nthread) @parameter fn decode_slice(s: Int): var slice_syndrome: Int = -1 try: decode_compiled_v5[base_niter, max_niter](ip, op, slice_syndrome, intra_codeword_parallellism_factor, s*ncodewordperthread, nc,nnz, ncnpu, nvnpu, ncodewordperthread, rep_indices, rep_offsets, c2r_indices, r2c_indices, vnpu_sizes, vnpu_indices, cnpu_sizes,cnpu_indices) syndromes[s] = slice_syndrome except: print("try failed on decode_compiled_v5") parallelize[decode_slice](nthread, nthread) # if any of the slices had a failed syndrome, then the whole batch syndrome is flagged as failed batch_syndrome = 0 for i in range(nthread): # print("slice ",i,": syndrome",syndromes[i]) if syndromes[i] > 0: batch_syndrome = 1 # repeats the first dimension according to repeat indices input @parameter fn repeat_compiled_offset(inpv: Tensor3D, start_codeword_idx: Int, indices: Tensor[DType.uint16], total_repeats: Int, ncodeword: Int) -> Tensor3D: var Z = Tensor3D(total_repeats, ncodeword) @parameter fn rep[nelts: Int](k: Int): var idx = 0 for j in range(inpv.dim0): var x = inpv.load[nelts](j, k+start_codeword_idx) var nrep = indices[j].to_int() for n in range(nrep): Z.store[nelts](idx,k,x) idx += 1 vectorize[rep, nelts](ncodeword) return Z # permutes the first dimension according to given indices @parameter fn c2r(inpv: Tensor3D, c2r_indices: Tensor[DType.uint16]) -> Tensor3D: var Z = Tensor3D(inpv.dim0, inpv.dim1) @parameter fn gthr_c2r[nelts: Int](k: Int): for j in range(inpv.dim0): var idx = c2r_indices[j].to_int() var x = inpv.load[nelts](idx, k) Z.store[nelts](j,k,x) vectorize[gthr_c2r, nelts](inpv.dim1) return Z @always_inline fn pe[nelts_pe: Int](x: SIMD[dtype,nelts_pe], y: SIMD[dtype,nelts_pe]) -> SIMD[dtype,nelts_pe]: var ax = abs(x) var ay = abs(y) var m = min(ax,ay) var sx = x < 0 var sy = y < 0 var sd = sx == sy var v = sd.select(m,-m) return v struct Tensor3D: var dim0: Int var dim1: Int var dim2: Int # optional 3rd dimension var dimprod: Int # dim0 * dim1 var num_workers: Int var _data: DTypePointer[dtype] #var _tensor: Tensor[dtype] alias simd_width: Int = nelts fn __init__(inout self, *dims: Int): self.dim0 = dims[0] self.dim1 = dims[1] self.dimprod = self.dim1*self.dim0 if len(dims) > 2: self.dim2 = dims[2] else: self.dim2 = 1 var size = self.dim0 * self.dim1 * self.dim2 self.num_workers = num_logical_cores() self._data = DTypePointer[dtype].alloc(size) #self._tensor = Tensor[dtype](self.dim0, self.dim2, self.dim1) # note the swap of dim1 and dim2, for now needed to align interpretations ?? #self._data = self._tensor.data() # random initialisation in the interval centered on +16, mimicking roughly an all-zeros codeword plus mild noise # fn rand_init(inout self): var size = self.dim0 * self.dim1 * self.dim2 randint(self._data, size,-2,10) fn __copyinit__(inout self, other: Self): #self._tensor = other._tensor self._data = other._data self.dim0 = other.dim0 self.dim1 = other.dim1 self.dim2 = other.dim2 self.dimprod = other.dimprod self.num_workers = other.num_workers # Initialize taking a pointer, don't set any elements fn __init__( inout self, data: DTypePointer[dtype],*dims: Int ): self._data = data self.num_workers = 1 self.dim0 = dims[0] self.dim1 = dims[1] self.dimprod = self.dim1*self.dim0 if len(dims) > 2: self.dim2 = dims[2] else: self.dim2 = 1 fn set_num_workers(inout self, num_workers: Int): self.num_workers = num_workers fn free(inout self): self._data.free() # add a third dimension and arteficially reduce the first dimension to new_dim # note no actual data is being moved fn reshape_dim0(inout self, new_dim0: Int) raises: assert_true((self.dim0 % new_dim0) == 0, "reshape new_dim0 must divide original dim0") var f = self.dim0 // new_dim0 self.dim2 = f * self.dim2 self.dim0 = new_dim0 self.dimprod = self.dim1*self.dim0 # this is the 'undo' operation of reshape_dim0 # note no actual data is being moved fn flatten_dim2(inout self): self.dim0 = self.dim0 * self.dim2 self.dim2 = 1 self.dimprod = self.dim1*self.dim0 # the below code is not safe unless run as last thing in the program, when the # Tensor3D is no longer used or needed. Otherwise we can get following error: # double free or corruption (top) fn save(self, fpath: String) raises -> String: var spec = TensorSpec(dtype, self.dim0, self.dim1) var _tensor = Tensor[dtype](self._data,spec) _tensor.tofile(fpath) print('File saved:',fpath) return fpath #@staticmethod fn load(inout self, fpath:String) raises: var load_mat = Tensor[dtype].fromfile(fpath) var size = self.dim0 * self.dim1 * self.dim2 assert_true(load_mat.num_elements() == size,"nr of elements in file do not match self.num_elements()") memcpy(self._data,load_mat.data(),size) _ = load_mat # dunno why this line would be needed tbh, nicked it from https://www.modular.com/blog/whats-new-in-mojo-sdk-v0-5 fn reduce_syndrome(self) -> Int: for j in range(self.dim0): for k in range(self.dim1): var v = self.load[1](j, k) if v > 0: return 1 return 0 @always_inline fn __getitem__(self, j: Int, k: Int) -> SIMD[dtype,1]: return self._data.load[width=1](j * self.dim1 + k) @always_inline fn __getitem__(self, j: Int, k: Int, l: Int) -> SIMD[dtype,1]: return self._data.load[width=1](j * self.dim1 + l*self.dimprod + k) fn data(self) -> DTypePointer[dtype]: return self._data @always_inline fn get_reference_to_row_slice(inout self,slice_start: Int, slice_end: Int) -> Self: var slice_len = slice_end - slice_start var src_ptr = self._data.offset(slice_start*self.dim1) return Self(src_ptr,slice_len,self.dim1) fn print[maxel_x: Int = 3, maxel_y: Int = 3](self)->None: var rank:Int = 2 var dim0:Int = 0 var dim1:Int = 0 var dim2:Int = 0 var val:SIMD[dtype, 1]=0 if self.dim0 == 1: rank = 1 dim0 = 1 dim1 = self.dim1 dim2 = self.dim2 else: dim0 = self.dim0 dim1 = self.dim1 dim2 = self.dim2 if dim0>0 and dim1>0: for l in range(dim2): print("Page: ",l) for j in range(dim0): if (j < maxel_x) | (j > (dim0 - (maxel_x+1))): if rank>1: if j==0: print(" [",end="") else: print("\n ",end="") print("[",end="") for k in range(dim1): if rank==1: val = self[j,k,l] if rank==2: val = self[j,k,l] if k==0: print(val,end="") elif (k < maxel_y) | (k > (dim1 - (maxel_y+1))): print(" ",val,end="") elif k == maxel_y: print("...",end="") print("]",end="") elif j == maxel_x: print() print(" ... ") if rank>1: print("]",end="") print() print() # if rank>2: # print("]") print(" Tensor3D:",self.dim0,'x',self.dim1,'x',self.dim2,",","DType:", dtype.__str__()) print() fn print_simd(self): for j in range(self.dim0): @parameter fn pr[nelts: Int](k: Int): print(self.load[nelts](j, k)) vectorize[pr, nelts](self.dim1) @always_inline fn load[nelts: Int](self, j: Int, k: Int) -> SIMD[dtype, nelts]: return self._data.load[width=nelts](j * self.dim1 + k) @always_inline fn store[nelts: Int](self, j: Int, k: Int, val: SIMD[dtype, nelts]): return self._data.store[width=nelts](j * self.dim1 + k, val) # variants in case the 3D view on the data is used @always_inline fn load[nelts: Int](self, j: Int, k: Int, l: Int) -> SIMD[dtype, nelts]: return self._data.load[width=nelts](j * self.dim1 + l*self.dimprod + k) @always_inline fn store[nelts: Int](self, j: Int, k: Int, l: Int, val: SIMD[dtype, nelts]): return self._data.store[width=nelts](j * self.dim1 + l*self.dimprod + k, val) # perform a syndrome_N operation whereby N is assumed to equal dim0 fn syndromes(inout self): @parameter fn calc_page(l:Int): @parameter fn sd[nelts: Int](k: Int): # perform xor of all sign bits var v = self.load[nelts](0, k,l) var ok = v*0 var nok = ok + 1 var tmp = v < 0 for j in range(1,self.dim0): tmp = tmp ^ (self.load[nelts](j, k,l) < 0) # at this point tmp shall have False values where the parity checks hold (xor of all sign bits should be zero) for j in range(self.dim0): var s = tmp.select(nok,ok) self.store[nelts](j,k,l,s) vectorize[sd, nelts](self.dim1) parallelize[calc_page](self.dim2,self.num_workers) fn cnpu(inout self) raises: if self.dim0 == 3: self.cnpu_3() elif self.dim0 == 4: self.cnpu_4() elif self.dim0 == 5: self.cnpu_5() elif self.dim0 == 6: self.cnpu_6() elif self.dim0 == 8: self.cnpu_8() elif self.dim0 == 10: self.cnpu_10() else: assert_true(False, "unsupported CNPU size") fn cnpu_3(inout self) raises: assert_true(self.dim0 == 3,"Calling cnpu_3 on a Tensor3D with incompatible shape") @parameter fn calc_page(l:Int): @parameter fn cnpu_3_loc[nelts: Int](k: Int): var r0 = self.load[nelts](0, k,l) var r1 = self.load[nelts](1, k,l) var r2 = self.load[nelts](2, k,l) # get the first row of the result for the currently fetched SIMD vector var x = r1 var y = r2 var v = pe[nelts](x,y) self.store[nelts](0,k,l,v) # get the 2nd row of the result for the currently fetched SIMD vector x = r0 y = r2 v = pe[nelts](x,y) self.store[nelts](1,k,l,v) # get the 3rd row of the result for the currently fetched SIMD vector x = r0 y = r1 v = pe[nelts](x,y) self.store[nelts](2,k,l,v) # vectorize vectorize[cnpu_3_loc, nelts](self.dim1) parallelize[calc_page](self.dim2,self.num_workers) fn cnpu_4(inout self) raises: assert_true(self.dim0 == 4,"Calling cnpu_4 on a matrix with incompatible shape") @parameter fn calc_page(l:Int): @parameter fn cnpu_4_loc[nelts: Int](k: Int): var x_4_1 = self.load[nelts](0, k, l) var x_4_2 = self.load[nelts](1, k, l) var x_4_3 = self.load[nelts](2, k, l) var x_4_4 = self.load[nelts](3, k, l) var x_duo_1 = x_4_1 var y_duo_1 = x_4_2 var pc_4_1_to_2 = pe[nelts](x_duo_1,y_duo_1) var x_duo_2 = pc_4_1_to_2 var y_duo_2 = x_4_3 var pc_4_1_to_3 = pe[nelts](x_duo_2,y_duo_2) var x_duo_rev_4 = x_4_4 var y_duo_rev_4 = x_4_3 var pc_4_3_to_4 = pe[nelts](x_duo_rev_4,y_duo_rev_4) var x_duo_rev_3 = pc_4_3_to_4 var y_duo_rev_3 = x_4_2 var pc_4_2_to_4 = pe[nelts](x_duo_rev_3,y_duo_rev_3) var x_op_duo_2 = x_4_1 var y_op_duo_2 = pc_4_3_to_4 var x_op_duo_3 = pc_4_1_to_2 var y_op_duo_3 = x_4_4 var op_4_1 = pc_4_2_to_4 var op_4_2 = pe[nelts](x_op_duo_2,y_op_duo_2) var op_4_3 = pe[nelts](x_op_duo_3,y_op_duo_3) var op_4_4 = pc_4_1_to_3 self.store[nelts](0,k,l,op_4_1) self.store[nelts](1,k,l,op_4_2) self.store[nelts](2,k,l,op_4_3) self.store[nelts](3,k,l,op_4_4) # vectorize vectorize[cnpu_4_loc, nelts](self.dim1) parallelize[calc_page](self.dim2,self.num_workers) fn cnpu_5(inout self) raises: assert_true(self.dim0 == 5,"Calling cnpu_5 on a matrix with incompatible shape") @parameter fn calc_page(l:Int): @parameter fn cnpu_5_loc[nelts: Int](k: Int): var x_5_1 = self.load[nelts](0, k, l) var x_5_2 = self.load[nelts](1, k, l) var x_5_3 = self.load[nelts](2, k, l) var x_5_4 = self.load[nelts](3, k, l) var x_5_5 = self.load[nelts](4, k, l) var x_duo_1 = x_5_1 var y_duo_1 = x_5_2 var pc_5_1_to_2 = pe[nelts](x_duo_1,y_duo_1) var x_duo_2 = pc_5_1_to_2 var y_duo_2 = x_5_3 var pc_5_1_to_3 = pe[nelts](x_duo_2,y_duo_2) var x_duo_3 = pc_5_1_to_3 var y_duo_3 = x_5_4 var pc_5_1_to_4 = pe[nelts](x_duo_3,y_duo_3) var x_duo_rev_5 = x_5_5 var y_duo_rev_5 = x_5_4 var pc_5_4_to_5 = pe[nelts](x_duo_rev_5,y_duo_rev_5) var x_duo_rev_4 = pc_5_4_to_5 var y_duo_rev_4 = x_5_3 var pc_5_3_to_5 = pe[nelts](x_duo_rev_4,y_duo_rev_4) var x_duo_rev_3 = pc_5_3_to_5 var y_duo_rev_3 = x_5_2 var pc_5_2_to_5 = pe[nelts](x_duo_rev_3,y_duo_rev_3) var x_op_duo_2 = x_5_1 var y_op_duo_2 = pc_5_3_to_5 var x_op_duo_3 = pc_5_1_to_2 var y_op_duo_3 = pc_5_4_to_5 var x_op_duo_4 = pc_5_1_to_3 var y_op_duo_4 = x_5_5 var op_5_1 = pc_5_2_to_5 var op_5_2 = pe[nelts](x_op_duo_2,y_op_duo_2) var op_5_3 = pe[nelts](x_op_duo_3,y_op_duo_3) var op_5_4 = pe[nelts](x_op_duo_4,y_op_duo_4) var op_5_5 = pc_5_1_to_4 self.store[nelts](0,k,l,op_5_1) self.store[nelts](1,k,l,op_5_2) self.store[nelts](2,k,l,op_5_3) self.store[nelts](3,k,l,op_5_4) self.store[nelts](4,k,l,op_5_5) # vectorize vectorize[cnpu_5_loc, nelts](self.dim1) parallelize[calc_page](self.dim2,self.num_workers) fn cnpu_6(inout self) raises: assert_true(self.dim0 == 6,"Calling cnpu_6 on a matrix with incompatible shape") @parameter fn calc_page(l:Int): @parameter fn cnpu_6_loc[nelts: Int](k: Int): var x_6_1 = self.load[nelts](0, k, l) var x_6_2 = self.load[nelts](1, k, l) var x_6_3 = self.load[nelts](2, k, l) var x_6_4 = self.load[nelts](3, k, l) var x_6_5 = self.load[nelts](4, k, l) var x_6_6 = self.load[nelts](5, k, l) var x_duo_1 = x_6_1 var y_duo_1 = x_6_2 var pc_6_1_to_2 = pe[nelts](x_duo_1,y_duo_1) var x_duo_2 = pc_6_1_to_2 var y_duo_2 = x_6_3 var pc_6_1_to_3 = pe[nelts](x_duo_2,y_duo_2) var x_duo_3 = pc_6_1_to_3 var y_duo_3 = x_6_4 var pc_6_1_to_4 = pe[nelts](x_duo_3,y_duo_3) var x_duo_4 = pc_6_1_to_4 var y_duo_4 = x_6_5 var pc_6_1_to_5 = pe[nelts](x_duo_4,y_duo_4) var x_duo_rev_6 = x_6_6 var y_duo_rev_6 = x_6_5 var pc_6_5_to_6 = pe[nelts](x_duo_rev_6,y_duo_rev_6) var x_duo_rev_5 = pc_6_5_to_6 var y_duo_rev_5 = x_6_4 var pc_6_4_to_6 = pe[nelts](x_duo_rev_5,y_duo_rev_5) var x_duo_rev_4 = pc_6_4_to_6 var y_duo_rev_4 = x_6_3 var pc_6_3_to_6 = pe[nelts](x_duo_rev_4,y_duo_rev_4) var x_duo_rev_3 = pc_6_3_to_6 var y_duo_rev_3 = x_6_2 var pc_6_2_to_6 = pe[nelts](x_duo_rev_3,y_duo_rev_3) var x_op_duo_2 = x_6_1 var y_op_duo_2 = pc_6_3_to_6 var x_op_duo_3 = pc_6_1_to_2 var y_op_duo_3 = pc_6_4_to_6 var x_op_duo_4 = pc_6_1_to_3 var y_op_duo_4 = pc_6_5_to_6 var x_op_duo_5 = pc_6_1_to_4 var y_op_duo_5 = x_6_6 var op_6_1 = pc_6_2_to_6 var op_6_2 = pe[nelts](x_op_duo_2,y_op_duo_2) var op_6_3 = pe[nelts](x_op_duo_3,y_op_duo_3) var op_6_4 = pe[nelts](x_op_duo_4,y_op_duo_4) var op_6_5 = pe[nelts](x_op_duo_5,y_op_duo_5) var op_6_6 = pc_6_1_to_5 self.store[nelts](0,k,l,op_6_1) self.store[nelts](1,k,l,op_6_2) self.store[nelts](2,k,l,op_6_3) self.store[nelts](3,k,l,op_6_4) self.store[nelts](4,k,l,op_6_5) self.store[nelts](5,k,l,op_6_6) # vectorize vectorize[cnpu_6_loc, nelts](self.dim1) parallelize[calc_page](self.dim2,self.num_workers) fn cnpu_8(inout self) raises: assert_true(self.dim0 == 8,"Calling cnpu_8 on a matrix with incompatible shape") @parameter fn calc_page(l:Int): @parameter fn cnpu_8_loc[nelts: Int](k: Int): var x_8_1 = self.load[nelts](0, k, l) var x_8_2 = self.load[nelts](1, k, l) var x_8_3 = self.load[nelts](2, k, l) var x_8_4 = self.load[nelts](3, k, l) var x_8_5 = self.load[nelts](4, k, l) var x_8_6 = self.load[nelts](5, k, l) var x_8_7 = self.load[nelts](6, k, l) var x_8_8 = self.load[nelts](7, k, l) var x_duo_1 = x_8_1 var y_duo_1 = x_8_2 var pc_8_1_to_2 = pe[nelts](x_duo_1,y_duo_1) var x_duo_2 = pc_8_1_to_2 var y_duo_2 = x_8_3 var pc_8_1_to_3 = pe[nelts](x_duo_2,y_duo_2) var x_duo_3 = pc_8_1_to_3 var y_duo_3 = x_8_4 var pc_8_1_to_4 = pe[nelts](x_duo_3,y_duo_3) var x_duo_4 = pc_8_1_to_4 var y_duo_4 = x_8_5 var pc_8_1_to_5 = pe[nelts](x_duo_4,y_duo_4) var x_duo_5 = pc_8_1_to_5 var y_duo_5 = x_8_6 var pc_8_1_to_6 = pe[nelts](x_duo_5,y_duo_5) var x_duo_6 = pc_8_1_to_6 var y_duo_6 = x_8_7 var pc_8_1_to_7 = pe[nelts](x_duo_6,y_duo_6) var x_duo_rev_8 = x_8_8 var y_duo_rev_8 = x_8_7 var pc_8_7_to_8 = pe[nelts](x_duo_rev_8,y_duo_rev_8) var x_duo_rev_7 = pc_8_7_to_8 var y_duo_rev_7 = x_8_6 var pc_8_6_to_8 = pe[nelts](x_duo_rev_7,y_duo_rev_7) var x_duo_rev_6 = pc_8_6_to_8 var y_duo_rev_6 = x_8_5 var pc_8_5_to_8 = pe[nelts](x_duo_rev_6,y_duo_rev_6) var x_duo_rev_5 = pc_8_5_to_8 var y_duo_rev_5 = x_8_4 var pc_8_4_to_8 = pe[nelts](x_duo_rev_5,y_duo_rev_5) var x_duo_rev_4 = pc_8_4_to_8 var y_duo_rev_4 = x_8_3 var pc_8_3_to_8 = pe[nelts](x_duo_rev_4,y_duo_rev_4) var x_duo_rev_3 = pc_8_3_to_8 var y_duo_rev_3 = x_8_2 var pc_8_2_to_8 = pe[nelts](x_duo_rev_3,y_duo_rev_3) var x_op_duo_2 = x_8_1 var y_op_duo_2 = pc_8_3_to_8 var x_op_duo_3 = pc_8_1_to_2 var y_op_duo_3 = pc_8_4_to_8 var x_op_duo_4 = pc_8_1_to_3 var y_op_duo_4 = pc_8_5_to_8 var x_op_duo_5 = pc_8_1_to_4 var y_op_duo_5 = pc_8_6_to_8 var x_op_duo_6 = pc_8_1_to_5 var y_op_duo_6 = pc_8_7_to_8 var x_op_duo_7 = pc_8_1_to_6 var y_op_duo_7 = x_8_8 var op_8_1 = pc_8_2_to_8 var op_8_2 = pe[nelts](x_op_duo_2,y_op_duo_2) var op_8_3 = pe[nelts](x_op_duo_3,y_op_duo_3) var op_8_4 = pe[nelts](x_op_duo_4,y_op_duo_4) var op_8_5 = pe[nelts](x_op_duo_5,y_op_duo_5) var op_8_6 = pe[nelts](x_op_duo_6,y_op_duo_6) var op_8_7 = pe[nelts](x_op_duo_7,y_op_duo_7) var op_8_8 = pc_8_1_to_7 self.store[nelts](0,k,l,op_8_1) self.store[nelts](1,k,l,op_8_2) self.store[nelts](2,k,l,op_8_3) self.store[nelts](3,k,l,op_8_4) self.store[nelts](4,k,l,op_8_5) self.store[nelts](5,k,l,op_8_6) self.store[nelts](6,k,l,op_8_7) self.store[nelts](7,k,l,op_8_8) # vectorize vectorize[cnpu_8_loc, nelts](self.dim1) parallelize[calc_page](self.dim2,self.num_workers) fn cnpu_10(inout self) raises: assert_true(self.dim0 == 10,"Calling cnpu_10 on a matrix with incompatible shape") @parameter fn calc_page(l:Int): @parameter fn cnpu_10_loc[nelts: Int](k: Int): var x_10_1 = self.load[nelts](0, k, l) var x_10_2 = self.load[nelts](1, k, l) var x_10_3 = self.load[nelts](2, k, l) var x_10_4 = self.load[nelts](3, k, l) var x_10_5 = self.load[nelts](4, k, l) var x_10_6 = self.load[nelts](5, k, l) var x_10_7 = self.load[nelts](6, k, l) var x_10_8 = self.load[nelts](7, k, l) var x_10_9 = self.load[nelts](8, k, l) var x_10_10 = self.load[nelts](9, k, l) var x_duo_1 = x_10_1 var y_duo_1 = x_10_2 var pc_10_1_to_2 = pe[nelts](x_duo_1,y_duo_1) var x_duo_2 = pc_10_1_to_2 var y_duo_2 = x_10_3 var pc_10_1_to_3 = pe[nelts](x_duo_2,y_duo_2) var x_duo_3 = pc_10_1_to_3 var y_duo_3 = x_10_4 var pc_10_1_to_4 = pe[nelts](x_duo_3,y_duo_3) var x_duo_4 = pc_10_1_to_4 var y_duo_4 = x_10_5 var pc_10_1_to_5 = pe[nelts](x_duo_4,y_duo_4) var x_duo_5 = pc_10_1_to_5 var y_duo_5 = x_10_6 var pc_10_1_to_6 = pe[nelts](x_duo_5,y_duo_5) var x_duo_6 = pc_10_1_to_6 var y_duo_6 = x_10_7 var pc_10_1_to_7 = pe[nelts](x_duo_6,y_duo_6) var x_duo_7 = pc_10_1_to_7 var y_duo_7 = x_10_8 var pc_10_1_to_8 = pe[nelts](x_duo_7,y_duo_7) var x_duo_8 = pc_10_1_to_8 var y_duo_8 = x_10_9 var pc_10_1_to_9 = pe[nelts](x_duo_8,y_duo_8) var x_duo_rev_10 = x_10_10 var y_duo_rev_10 = x_10_9 var pc_10_9_to_10 = pe[nelts](x_duo_rev_10,y_duo_rev_10) var x_duo_rev_9 = pc_10_9_to_10 var y_duo_rev_9 = x_10_8 var pc_10_8_to_10 = pe[nelts](x_duo_rev_9,y_duo_rev_9) var x_duo_rev_8 = pc_10_8_to_10 var y_duo_rev_8 = x_10_7 var pc_10_7_to_10 = pe[nelts](x_duo_rev_8,y_duo_rev_8) var x_duo_rev_7 = pc_10_7_to_10 var y_duo_rev_7 = x_10_6 var pc_10_6_to_10 = pe[nelts](x_duo_rev_7,y_duo_rev_7) var x_duo_rev_6 = pc_10_6_to_10 var y_duo_rev_6 = x_10_5 var pc_10_5_to_10 = pe[nelts](x_duo_rev_6,y_duo_rev_6) var x_duo_rev_5 = pc_10_5_to_10 var y_duo_rev_5 = x_10_4 var pc_10_4_to_10 = pe[nelts](x_duo_rev_5,y_duo_rev_5) var x_duo_rev_4 = pc_10_4_to_10 var y_duo_rev_4 = x_10_3 var pc_10_3_to_10 = pe[nelts](x_duo_rev_4,y_duo_rev_4) var x_duo_rev_3 = pc_10_3_to_10 var y_duo_rev_3 = x_10_2 var pc_10_2_to_10 = pe[nelts](x_duo_rev_3,y_duo_rev_3) var x_op_duo_2 = x_10_1 var y_op_duo_2 = pc_10_3_to_10 var x_op_duo_3 = pc_10_1_to_2 var y_op_duo_3 = pc_10_4_to_10 var x_op_duo_4 = pc_10_1_to_3 var y_op_duo_4 = pc_10_5_to_10 var x_op_duo_5 = pc_10_1_to_4 var y_op_duo_5 = pc_10_6_to_10 var x_op_duo_6 = pc_10_1_to_5 var y_op_duo_6 = pc_10_7_to_10 var x_op_duo_7 = pc_10_1_to_6 var y_op_duo_7 = pc_10_8_to_10 var x_op_duo_8 = pc_10_1_to_7 var y_op_duo_8 = pc_10_9_to_10 var x_op_duo_9 = pc_10_1_to_8 var y_op_duo_9 = x_10_10 var op_10_1 = pc_10_2_to_10 var op_10_2 = pe[nelts](x_op_duo_2,y_op_duo_2) var op_10_3 = pe[nelts](x_op_duo_3,y_op_duo_3) var op_10_4 = pe[nelts](x_op_duo_4,y_op_duo_4) var op_10_5 = pe[nelts](x_op_duo_5,y_op_duo_5) var op_10_6 = pe[nelts](x_op_duo_6,y_op_duo_6) var op_10_7 = pe[nelts](x_op_duo_7,y_op_duo_7) var op_10_8 = pe[nelts](x_op_duo_8,y_op_duo_8) var op_10_9 = pe[nelts](x_op_duo_9,y_op_duo_9) var op_10_10 = pc_10_1_to_9 self.store[nelts](0,k,l,op_10_1) self.store[nelts](1,k,l,op_10_2) self.store[nelts](2,k,l,op_10_3) self.store[nelts](3,k,l,op_10_4) self.store[nelts](4,k,l,op_10_5) self.store[nelts](5,k,l,op_10_6) self.store[nelts](6,k,l,op_10_7) self.store[nelts](7,k,l,op_10_8) self.store[nelts](8,k,l,op_10_9) self.store[nelts](9,k,l,op_10_10) # vectorize vectorize[cnpu_10_loc, nelts](self.dim1) parallelize[calc_page](self.dim2,self.num_workers) --- ldpcdec.mojo --- from sys.info import simdwidthof from codebook.luts import nc,nnz, ncnpu, nvnpu, vnpu_sizes, vnpu_indices, cnpu_sizes, cnpu_indices from ldpc.types import nelts,dtype,Tensor3D, parallel_decode from tensor import Tensor, TensorSpec, TensorShape from random import rand, seed from sys.info import num_physical_cores, num_logical_cores, num_performance_cores from python import Python from python.object import PythonObject from sys.info import ( os_is_linux, os_is_windows, os_is_macos, has_sse4, has_avx, has_avx2, has_avx512f, has_vnni, has_neon, is_apple_m1, has_intel_amx, _current_target, _current_cpu, _triple_attr, ) from time import now def main(): var os = "" if os_is_linux(): os = "linux" elif os_is_macos(): os = "macOS" else: os = "windows" var cpu = String(_current_cpu()) var arch = String(_triple_attr()) var cpu_features = String("") if has_sse4(): cpu_features += " sse4" if has_avx(): cpu_features += " avx" if has_avx2(): cpu_features += " avx2" if has_avx512f(): cpu_features += " avx512f" if has_vnni(): if has_avx512f(): cpu_features += " avx512_vnni" else: cpu_features += " avx_vnni" if has_intel_amx(): cpu_features += " intel_amx" if has_neon(): cpu_features += " neon" if is_apple_m1(): cpu_features += " Apple M1" print("System information: ") print(" OS : ", os) print(" CPU : ", cpu) print(" Arch : ", arch) print(" Num Cores : ", num_logical_cores()) print(" CPU Features:", cpu_features) print("SIMD width of ",dtype, " = ",nelts) alias base_niter = 10 alias max_niter = 20 var nvcpu = num_logical_cores() # between following two we must balance the available nvcpu var intra_codeword_parallellism_factor = 1 var nthread = nvcpu//2 +2 alias ncodewordperthread = 4*nelts # must be a multiple of simdwidth = nelts # get binary heavy LUTs var rep_spec = TensorSpec(DType.uint16, nc, 1) var rep_indices_tensor = Tensor[DType.uint16](rep_spec) rep_indices_tensor = rep_indices_tensor.fromfile('codebook/repeats.bin') var rep_offsets_tensor = Tensor[DType.uint16](rep_spec) rep_offsets_tensor = rep_offsets_tensor.fromfile('codebook/repeats_offsets.bin') var c2r_spec = TensorSpec(DType.uint16, nnz, 1) var c2r_indices_tensor = Tensor[DType.uint16](c2r_spec) c2r_indices_tensor = c2r_indices_tensor.fromfile('codebook/c2r.bin') var r2c_indices_tensor = Tensor[DType.uint16](c2r_spec) r2c_indices_tensor = r2c_indices_tensor.fromfile('codebook/r2c.bin') # var batch_size: Int var X: Tensor3D # columns are codewords # warmup print("warmup...") var batch_syndrome: Int = -1 var batch_size: Int batch_size = ncodewordperthread*nthread print("batch_size: ", batch_size) X = Tensor3D(nc,batch_size) X.rand_init() print("ncodewordperthread: ", ncodewordperthread) print("nthread: ",nthread) # prepare an output buffer for the decoded batch (warning: now rows are codewords) var Y = Tensor3D(batch_size, nc) X.print() parallel_decode[base_niter, max_niter](X, Y, batch_syndrome,intra_codeword_parallellism_factor, nthread, nc,nnz, ncnpu, nvnpu, ncodewordperthread, rep_indices_tensor, rep_offsets_tensor,c2r_indices_tensor, r2c_indices_tensor, vnpu_sizes, vnpu_indices, cnpu_sizes, cnpu_indices) print("Y after decoding") Y.print[3,3]() print("warmup Batch syndrome: ",batch_syndrome) # # now benchmark print("now timeit: ...") var ncall = 10 var tot_msecs = 0.0 for i in range(ncall): # avoid that the compiler thinks there is no sense decoding same input X time and time again X.rand_init() var start = now() parallel_decode[base_niter, max_niter](X, Y, batch_syndrome,intra_codeword_parallellism_factor, nthread, nc,nnz, ncnpu, nvnpu, ncodewordperthread, rep_indices_tensor, rep_offsets_tensor,c2r_indices_tensor, r2c_indices_tensor, vnpu_sizes, vnpu_indices, cnpu_sizes, cnpu_indices) var dt = (1e-6*(now()-start)) tot_msecs += dt var msecs = tot_msecs/ncall var mbps: Float32 = 1e-3*batch_size * nc/msecs print("Throughput is ", batch_size," codewords in ",msecs, "msec, equivalent to ",mbps," Mbps") --- .gitignore --- # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ --- LICENSE --- MIT License Copyright (c) 2023 Maxim Zaks Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # mojo-hash A collection of hash functions implemented in Mojo. ## AHash Original repo: https://github.com/tkaitchuck/aHash Note: implements the fallback version (without AES-NI intrinsics use), uses folded multiply function without u128 support ## fnv1a Original repo: https://github.com/ziglang/zig/blob/master/lib/std/hash/fnv.zig Note: implements 32 and 64 bit variants ## fxhash Original repo: https://github.com/cbreeden/fxhash/tree/master Note: implements 32 and 64 bit variants ## Wyhash Original repo: https://github.com/wangyi-fudan/wyhash Note: `wymum` implemented as if `WYHASH_32BIT_MUM` is set and `WYHASH_CONDOM` not set. Little endian only. ## Benachmark Collecets average hash function runtime in nanoseconds based on 7 different word collections. The average runtime is computed 20 times on each word collection, the fastest is kept as final result. Shows collision on full 32/64 bit space and 1024 mod (10 bit) space ### Results CPU Specs: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz ``` Corpus 1 Word count 100 | unique word count 82 | min key size 2 | avg key size 5.71 | max key size 12 AHash avg hash compute 18.149999999999999 | hash colision 1.0 | hash colision mod 512 1.1549295774647887 Wyhash avg hash compute 17.079999999999998 | hash colision 1.0 | hash colision mod 512 1.1232876712328768 fnv1a32 avg hash compute 15.08 | hash colision 1.0 | hash colision mod 512 1.1232876712328768 fnv1a64 avg hash compute 16.32 | hash colision 1.0 | hash colision mod 512 1.0249999999999999 fxHash32 avg hash compute 12.539999999999999 | hash colision 1.0 | hash colision mod 512 1.2238805970149254 fxHash64 avg hash compute 12.56 | hash colision 1.0 | hash colision mod 512 1.1884057971014492 std_Hash64 avg hash compute 213.0 | hash colision 1.0 | hash colision mod 512 1.0512820512820513 Corpus 2 Word count 999 | unique word count 203 | min key size 1 | avg key size 4.8058058058058055 | max key size 14 AHash avg hash compute 18.263263263263262 | hash colision 1.0 | hash colision mod 512 1.2083333333333333 Wyhash avg hash compute 20.11011011011011 | hash colision 1.0 | hash colision mod 512 1.2303030303030302 fnv1a32 avg hash compute 17.995995995995997 | hash colision 1.0 | hash colision mod 512 1.2848101265822784 fnv1a64 avg hash compute 16.079079079079079 | hash colision 1.0 | hash colision mod 512 1.2011834319526626 fxHash32 avg hash compute 14.397397397397397 | hash colision 1.0 | hash colision mod 512 1.3716216216216217 fxHash64 avg hash compute 12.603603603603604 | hash colision 1.0 | hash colision mod 512 1.4195804195804196 std_Hash64 avg hash compute 239.15815815815816 | hash colision 1.0 | hash colision mod 512 1.2303030303030302 Corpus 3 Word count 999 | unique word count 192 | min key size 1 | avg key size 4.293293293293293 | max key size 13 AHash avg hash compute 16.716716716716718 | hash colision 1.0 | hash colision mod 512 1.1636363636363636 Wyhash avg hash compute 16.952952952952952 | hash colision 1.0 | hash colision mod 512 1.2151898734177216 fnv1a32 avg hash compute 15.968968968968969 | hash colision 1.0 | hash colision mod 512 1.1428571428571428 fnv1a64 avg hash compute 18.862862862862862 | hash colision 1.0 | hash colision mod 512 1.2229299363057324 fxHash32 avg hash compute 15.723723723723724 | hash colision 1.0 | hash colision mod 512 1.352112676056338 fxHash64 avg hash compute 17.168168168168169 | hash colision 1.0 | hash colision mod 512 1.4436090225563909 std_Hash64 avg hash compute 258.6146146146146 | hash colision 1.0 | hash colision mod 512 1.1779141104294479 Corpus 4 Word count 999 | unique word count 532 | min key size 2 | avg key size 10.646646646646646 | max key size 37 AHash avg hash compute 20.205205205205207 | hash colision 1.0 | hash colision mod 512 1.5786350148367954 Wyhash avg hash compute 20.234234234234233 | hash colision 1.0 | hash colision mod 512 1.5975975975975976 fnv1a32 avg hash compute 21.814814814814813 | hash colision 1.0 | hash colision mod 512 1.6170212765957446 fnv1a64 avg hash compute 24.41041041041041 | hash colision 1.0 | hash colision mod 512 1.5928143712574849 fxHash32 avg hash compute 16.208208208208209 | hash colision 1.0 | hash colision mod 512 1.6677115987460815 fxHash64 avg hash compute 15.890890890890891 | hash colision 1.0 | hash colision mod 512 1.9850746268656716 std_Hash64 avg hash compute 218.3093093093093 | hash colision 1.0018832391713748 | hash colision mod 512 1.6170212765957446 Corpus 5 Word count 999 | unique word count 208 | min key size 2 | avg key size 5.6496496496496498 | max key size 18 AHash avg hash compute 15.921921921921921 | hash colision 1.0 | hash colision mod 512 1.1620111731843576 Wyhash avg hash compute 19.517517517517518 | hash colision 1.0 | hash colision mod 512 1.1685393258426966 fnv1a32 avg hash compute 17.042042042042041 | hash colision 1.0 | hash colision mod 512 1.2093023255813953 fnv1a64 avg hash compute 18.58958958958959 | hash colision 1.0 | hash colision mod 512 1.2530120481927711 fxHash32 avg hash compute 14.552552552552553 | hash colision 1.0 | hash colision mod 512 1.3506493506493507 fxHash64 avg hash compute 14.527527527527528 | hash colision 1.0 | hash colision mod 512 1.3594771241830066 std_Hash64 avg hash compute 239.1181181181181 | hash colision 1.0 | hash colision mod 512 1.2023121387283238 Corpus 6 Word count 10 | unique word count 10 | min key size 378 | avg key size 499.19999999999999 | max key size 558 AHash avg hash compute 67.400000000000006 | hash colision 1.0 | hash colision mod 512 1.0 Wyhash avg hash compute 64.200000000000003 | hash colision 1.0 | hash colision mod 512 1.0 fnv1a32 avg hash compute 499.60000000000002 | hash colision 1.0 | hash colision mod 512 1.0 fnv1a64 avg hash compute 620.70000000000005 | hash colision 1.0 | hash colision mod 512 1.0 fxHash32 avg hash compute 163.80000000000001 | hash colision 1.0 | hash colision mod 512 1.0 fxHash64 avg hash compute 87.799999999999997 | hash colision 1.0 | hash colision mod 512 1.0 std_Hash64 avg hash compute 247.59999999999999 | hash colision 1.0 | hash colision mod 512 1.0 Corpus 7 Word count 161 | unique word count 143 | min key size 8 | avg key size 22.260869565217391 | max key size 43 AHash avg hash compute 19.546583850931675 | hash colision 1.0 | hash colision mod 512 1.1259842519685039 Wyhash avg hash compute 22.670807453416149 | hash colision 1.0 | hash colision mod 512 1.1439999999999999 fnv1a32 avg hash compute 32.900621118012424 | hash colision 1.0 | hash colision mod 512 1.153225806451613 fnv1a64 avg hash compute 38.391304347826086 | hash colision 1.0 | hash colision mod 512 1.1626016260162602 fxHash32 avg hash compute 20.043478260869566 | hash colision 1.0 | hash colision mod 512 1.1259842519685039 fxHash64 avg hash compute 19.503105590062113 | hash colision 1.0 | hash colision mod 512 1.153225806451613 std_Hash64 avg hash compute 242.59006211180125 | hash colision 1.0 | hash colision mod 512 1.1626016260162602 ``` MacMini M1, 2020 ``` Corpus 1 Word count 100 | unique word count 82 | min key size 2 | avg key size 5.71 | max key size 12 AHash avg hash compute 19.0 | hash colision 1.0 | hash colision mod 512 1.1549295774647887 Wyhash avg hash compute 29.5 | hash colision 1.0 | hash colision mod 512 1.1232876712328768 fnv1a32 avg hash compute 18.5 | hash colision 1.0 | hash colision mod 512 1.1232876712328768 fnv1a64 avg hash compute 17.5 | hash colision 1.0 | hash colision mod 512 1.0249999999999999 fxHash32 avg hash compute 18.0 | hash colision 1.0 | hash colision mod 512 1.2238805970149254 fxHash64 avg hash compute 19.5 | hash colision 1.0 | hash colision mod 512 1.1884057971014492 std_Hash64 avg hash compute 84.5 | hash colision 1.0 | hash colision mod 512 1.0512820512820513 Corpus 2 Word count 999 | unique word count 203 | min key size 1 | avg key size 4.8058058058058055 | max key size 14 AHash avg hash compute 17.567567567567568 | hash colision 1.0 | hash colision mod 512 1.2083333333333333 Wyhash avg hash compute 25.925925925925927 | hash colision 1.0 | hash colision mod 512 1.2303030303030302 fnv1a32 avg hash compute 19.96996996996997 | hash colision 1.0 | hash colision mod 512 1.2848101265822784 fnv1a64 avg hash compute 17.967967967967969 | hash colision 1.0 | hash colision mod 512 1.2011834319526626 fxHash32 avg hash compute 16.016016016016017 | hash colision 1.0 | hash colision mod 512 1.3716216216216217 fxHash64 avg hash compute 13.863863863863864 | hash colision 1.0 | hash colision mod 512 1.4195804195804196 std_Hash64 avg hash compute 75.17517517517517 | hash colision 1.0 | hash colision mod 512 1.2303030303030302 Corpus 3 Word count 999 | unique word count 192 | min key size 1 | avg key size 4.293293293293293 | max key size 13 AHash avg hash compute 18.468468468468469 | hash colision 1.0 | hash colision mod 512 1.1636363636363636 Wyhash avg hash compute 24.474474474474473 | hash colision 1.0 | hash colision mod 512 1.2151898734177216 fnv1a32 avg hash compute 19.81981981981982 | hash colision 1.0 | hash colision mod 512 1.1428571428571428 fnv1a64 avg hash compute 17.417417417417418 | hash colision 1.0 | hash colision mod 512 1.2229299363057324 fxHash32 avg hash compute 15.665665665665665 | hash colision 1.0 | hash colision mod 512 1.352112676056338 fxHash64 avg hash compute 16.216216216216218 | hash colision 1.0 | hash colision mod 512 1.4436090225563909 std_Hash64 avg hash compute 87.037037037037038 | hash colision 1.0 | hash colision mod 512 1.1779141104294479 Corpus 4 Word count 999 | unique word count 532 | min key size 2 | avg key size 10.646646646646646 | max key size 37 AHash avg hash compute 19.51951951951952 | hash colision 1.0 | hash colision mod 512 1.5786350148367954 Wyhash avg hash compute 24.874874874874873 | hash colision 1.0 | hash colision mod 512 1.5975975975975976 fnv1a32 avg hash compute 25.575575575575577 | hash colision 1.0 | hash colision mod 512 1.6170212765957446 fnv1a64 avg hash compute 24.274274274274273 | hash colision 1.0 | hash colision mod 512 1.5928143712574849 fxHash32 avg hash compute 15.665665665665665 | hash colision 1.0 | hash colision mod 512 1.6677115987460815 fxHash64 avg hash compute 17.867867867867869 | hash colision 1.0 | hash colision mod 512 1.9850746268656716 std_Hash64 avg hash compute 73.523523523523522 | hash colision 1.0018832391713748 | hash colision mod 512 1.5833333333333333 Corpus 5 Word count 999 | unique word count 208 | min key size 2 | avg key size 5.6496496496496498 | max key size 18 AHash avg hash compute 17.817817817817819 | hash colision 1.0 | hash colision mod 512 1.1620111731843576 Wyhash avg hash compute 26.576576576576578 | hash colision 1.0 | hash colision mod 512 1.1685393258426966 fnv1a32 avg hash compute 19.76976976976977 | hash colision 1.0 | hash colision mod 512 1.2093023255813953 fnv1a64 avg hash compute 18.918918918918919 | hash colision 1.0 | hash colision mod 512 1.2530120481927711 fxHash32 avg hash compute 17.817817817817819 | hash colision 1.0 | hash colision mod 512 1.3506493506493507 fxHash64 avg hash compute 15.715715715715715 | hash colision 1.0 | hash colision mod 512 1.3594771241830066 std_Hash64 avg hash compute 75.425425425425431 | hash colision 1.0 | hash colision mod 512 1.2023121387283238 Corpus 6 Word count 10 | unique word count 10 | min key size 378 | avg key size 499.19999999999999 | max key size 558 AHash avg hash compute 30.0 | hash colision 1.0 | hash colision mod 512 1.0 Wyhash avg hash compute 90.0 | hash colision 1.0 | hash colision mod 512 1.0 fnv1a32 avg hash compute 635.0 | hash colision 1.0 | hash colision mod 512 1.0 fnv1a64 avg hash compute 660.0 | hash colision 1.0 | hash colision mod 512 1.0 fxHash32 avg hash compute 250.0 | hash colision 1.0 | hash colision mod 512 1.0 fxHash64 avg hash compute 145.0 | hash colision 1.0 | hash colision mod 512 1.0 std_Hash64 avg hash compute 220.0 | hash colision 1.0 | hash colision mod 512 1.0 Corpus 7 Word count 161 | unique word count 143 | min key size 8 | avg key size 22.260869565217391 | max key size 43 AHash avg hash compute 17.701863354037268 | hash colision 1.0 | hash colision mod 512 1.1259842519685039 Wyhash avg hash compute 29.19254658385093 | hash colision 1.0 | hash colision mod 512 1.1439999999999999 fnv1a32 avg hash compute 42.546583850931675 | hash colision 1.0 | hash colision mod 512 1.153225806451613 fnv1a64 avg hash compute 39.440993788819874 | hash colision 1.0 | hash colision mod 512 1.1626016260162602 fxHash32 avg hash compute 18.012422360248447 | hash colision 1.0 | hash colision mod 512 1.1259842519685039 fxHash64 avg hash compute 19.875776397515526 | hash colision 1.0 | hash colision mod 512 1.153225806451613 std_Hash64 avg hash compute 113.35403726708074 | hash colision 1.0 | hash colision mod 512 1.1259842519685039 ``` ![Hash functions benchmark chart](images/hash_functions.png) ### Other languages benchmarks results: #### CPU Specs: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz **Rust** ``` Avg time Default, 16.622: total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.0649350649350648, keys min: 2, avg: 6, max: 12 Avg time FxHasher, 17.769000000000002: total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.0933333333333333, keys min: 2, avg: 6, max: 12 Avg time AHasher, 16.5035: total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.1232876712328768, keys min: 2, avg: 6, max: 12 Avg time WyHash, 17.2495: total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.0933333333333333, keys min: 2, avg: 6, max: 12 Avg time Default, 16.026176176176175: total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.1871345029239766, keys min: 1, avg: 5, max: 14 Avg time FxHasher, 16.14034034034034: total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.2083333333333333, keys min: 1, avg: 5, max: 14 Avg time AHasher, 16.455305305305306: total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.2011834319526626, keys min: 1, avg: 5, max: 14 Avg time WyHash, 17.575925925925926: total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.2083333333333333, keys min: 1, avg: 5, max: 14 Avg time Default, 16.30725725725726: total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.238709677419355, keys min: 1, avg: 5, max: 13 Avg time FxHasher, 17.076676676676676: total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.263157894736842, keys min: 1, avg: 5, max: 13 Avg time AHasher, 16.477227227227228: total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.2229299363057324, keys min: 1, avg: 5, max: 13 Avg time WyHash, 17.61991991991992: total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.2075471698113207, keys min: 1, avg: 5, max: 13 Avg time Default, 17.10630630630631: total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.5647058823529412, keys min: 2, avg: 12, max: 37 Avg time FxHasher, 18.07007007007007: total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.6419753086419753, keys min: 2, avg: 12, max: 37 Avg time AHasher, 17.31981981981982: total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.636923076923077, keys min: 2, avg: 12, max: 37 Avg time WyHash, 17.735835835835836: total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.636923076923077, keys min: 2, avg: 12, max: 37 Avg time Default, 16.716816816816817: total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.2606060606060605, keys min: 2, avg: 6, max: 18 Avg time FxHasher, 17.642342342342342: total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.2606060606060605, keys min: 2, avg: 6, max: 18 Avg time AHasher, 16.40915915915916: total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.1954022988505748, keys min: 2, avg: 6, max: 18 Avg time WyHash, 17.5506006006006: total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.1751412429378532, keys min: 2, avg: 6, max: 18 Avg time Default, 126.03: total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 378, avg: 499, max: 558 Avg time FxHasher, 93.1: total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 378, avg: 499, max: 558 Avg time AHasher, 48.14: total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 378, avg: 499, max: 558 Avg time WyHash, 43.175: total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 378, avg: 499, max: 558 Avg time Default, 22.654658385093168: total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.125984251968504, keys min: 8, avg: 22, max: 43 Avg time FxHasher, 20.537888198757763: total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.1916666666666667, keys min: 8, avg: 22, max: 43 Avg time AHasher, 17.930124223602483: total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.1349206349206349, keys min: 8, avg: 22, max: 43 Avg time WyHash, 19.022360248447203: total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.1349206349206349, keys min: 8, avg: 22, max: 43 ``` #### MacMini M1, 2020 **Rust** ``` Avg time Default, 26.552: total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.0649350649350648, keys min: 2, avg: 6, max: 12 Avg time FxHasher, 25.7875: total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.0933333333333333, keys min: 2, avg: 6, max: 12 Avg time AHasher, 26.688499999999998: total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.1549295774647887, keys min: 2, avg: 6, max: 12 Avg time WyHash, 27.168499999999998: total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.0933333333333333, keys min: 2, avg: 6, max: 12 Avg time Default, 30.68533533533534: total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.1871345029239766, keys min: 1, avg: 5, max: 14 Avg time FxHasher, 32.62207207207207: total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.2083333333333333, keys min: 1, avg: 5, max: 14 Avg time AHasher, 30.133333333333333: total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.26875, keys min: 1, avg: 5, max: 14 Avg time WyHash, 30.666916916916918: total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.2083333333333333, keys min: 1, avg: 5, max: 14 Avg time Default, 28.71331331331331: total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.238709677419355, keys min: 1, avg: 5, max: 13 Avg time FxHasher, 25.97787787787788: total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.263157894736842, keys min: 1, avg: 5, max: 13 Avg time AHasher, 26.035535535535537: total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.238709677419355, keys min: 1, avg: 5, max: 13 Avg time WyHash, 26.91166166166166: total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.2075471698113207, keys min: 1, avg: 5, max: 13 Avg time Default, 24.716066066066066: total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.5647058823529412, keys min: 2, avg: 12, max: 37 Avg time FxHasher, 23.58993993993994: total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.6419753086419753, keys min: 2, avg: 12, max: 37 Avg time AHasher, 23.47817817817818: total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.6269113149847094, keys min: 2, avg: 12, max: 37 Avg time WyHash, 21.5007007007007: total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.636923076923077, keys min: 2, avg: 12, max: 37 Avg time Default, 21.82362362362362: total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.2606060606060605, keys min: 2, avg: 6, max: 18 Avg time FxHasher, 21.375575575575578: total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.2606060606060605, keys min: 2, avg: 6, max: 18 Avg time AHasher, 20.11911911911912: total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.2455089820359282, keys min: 2, avg: 6, max: 18 Avg time WyHash, 20.31836836836837: total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.1751412429378532, keys min: 2, avg: 6, max: 18 Avg time Default, 181.005: total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 378, avg: 499, max: 558 Avg time FxHasher, 122.93499999999999: total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 378, avg: 499, max: 558 Avg time AHasher, 45.04: total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 378, avg: 499, max: 558 Avg time WyHash, 31.005000000000003: total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 378, avg: 499, max: 558 Avg time Default, 21.469254658385093: total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.125984251968504, keys min: 8, avg: 22, max: 43 Avg time FxHasher, 20.225155279503106: total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.1916666666666667, keys min: 8, avg: 22, max: 43 Avg time AHasher, 20.106832298136645: total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.125984251968504, keys min: 8, avg: 22, max: 43 Avg time WyHash, 19.890993788819873: total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.1349206349206349, keys min: 8, avg: 22, max: 43 ``` **Swift** ``` Avg time: 85.945, total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.1388888, keys min: 2, avg: 6, max: 12 Avg time: 67.80245, total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.2083334, keys min: 1, avg: 5, max: 14 Avg time: 65.73403, total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.2, keys min: 1, avg: 5, max: 13 Avg time: 240.52744, total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.4224598, keys min: 1, avg: 6, max: 19 Avg time: 79.92162, total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.2163743, keys min: 1, avg: 6, max: 18 Avg time: 1773.4, total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.1111112, keys min: 130, avg: 171, max: 192 Avg time: 140.84721, total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.0592593, keys min: 8, avg: 22, max: 43 ``` **Python** ``` Avg time: 76.5, total elements: 100, unique elements: 82, collisions: 1.0, collisions % 512: 1.1232876712328768, keys min: 2, avg: 6.012195121951219, max: 12 Avg time: 71.52152152152152, total elements: 999, unique elements: 203, collisions: 1.0, collisions % 512: 1.215568862275449, keys min: 1, avg: 5.862068965517241, max: 14 Avg time: 81.63163163163163, total elements: 999, unique elements: 192, collisions: 1.0, collisions % 512: 1.2, keys min: 1, avg: 5.385416666666667, max: 13 Avg time: 79.72972972972973, total elements: 999, unique elements: 532, collisions: 1.0, collisions % 512: 1.592814371257485, keys min: 1, avg: 6.593984962406015, max: 19 Avg time: 78.62862862862863, total elements: 999, unique elements: 208, collisions: 1.0, collisions % 512: 1.2023121387283238, keys min: 1, avg: 6.394230769230769, max: 18 Avg time: 70.0, total elements: 10, unique elements: 10, collisions: 1.0, collisions % 512: 1.0, keys min: 130, avg: 171.4, max: 192 Avg time: 75.77639751552795, total elements: 161, unique elements: 143, collisions: 1.0, collisions % 512: 1.125984251968504, keys min: 8, avg: 22.6013986013986, max: 43 ``` **NodeJS** ``` Avg time WyHash: 5024.798, total elements: 100, unique elements: 82, collisions: 1, collisions % 512: 1.0512820512820513, keys min: 2, avg: 6.012195121951219, max: 12 Avg time xxHash: 6870.5885, total elements: 100, unique elements: 82, collisions: 1, collisions % 512: 1.0933333333333333, keys min: 2, avg: 6.012195121951219, max: 12 Avg time WyHash: 3688.6434934934937, total elements: 999, unique elements: 203, collisions: 1, collisions % 512: 1.26875, keys min: 1, avg: 5.862068965517241, max: 14 Avg time xxHash: 4461.4131131131135, total elements: 999, unique elements: 203, collisions: 1, collisions % 512: 1.180232558139535, keys min: 1, avg: 5.862068965517241, max: 14 Avg time WyHash: 3393.779079079079, total elements: 999, unique elements: 192, collisions: 1, collisions % 512: 1.1566265060240963, keys min: 1, avg: 5.385416666666667, max: 13 Avg time xxHash: 4050.333833833834, total elements: 999, unique elements: 192, collisions: 1, collisions % 512: 1.1497005988023952, keys min: 1, avg: 5.385416666666667, max: 13 Avg time WyHash: 4635.906556556557, total elements: 999, unique elements: 532, collisions: 1, collisions % 512: 1.6269113149847094, keys min: 1, avg: 6.593984962406015, max: 19 Avg time xxHash: 5929.1773773773775, total elements: 999, unique elements: 532, collisions: 1, collisions % 512: 1.5880597014925373, keys min: 1, avg: 6.593984962406015, max: 19 Avg time WyHash: 3601.807957957958, total elements: 999, unique elements: 208, collisions: 1, collisions % 512: 1.2093023255813953, keys min: 1, avg: 6.394230769230769, max: 18 Avg time xxHash: 4370.727527527527, total elements: 999, unique elements: 208, collisions: 1, collisions % 512: 1.2682926829268293, keys min: 1, avg: 6.394230769230769, max: 18 Avg time WyHash: 94997.88, total elements: 10, unique elements: 10, collisions: 1, collisions % 512: 1, keys min: 130, avg: 171.4, max: 192 Avg time xxHash: 48261.055, total elements: 10, unique elements: 10, collisions: 1, collisions % 512: 1, keys min: 130, avg: 171.4, max: 192 Avg time WyHash: 6467.241304347826, total elements: 161, unique elements: 143, collisions: 1, collisions % 512: 1.0916030534351144, keys min: 8, avg: 22.6013986013986, max: 43 Avg time xxHash: 5186.903105590062, total elements: 161, unique elements: 143, collisions: 1, collisions % 512: 1.1349206349206349, keys min: 8, avg: 22.6013986013986, max: 43 ``` **Go** ``` Avg time: 56.000000, total elements: 100, unique elements: 82, collisions: 1.000000, collisions mod 512: 1.108108, keys min: 2, avg: 6, max: 12 Avg time: 53.353353, total elements: 999, unique elements: 203, collisions: 1.000000, collisions mod 512: 1.230303, keys min: 1, avg: 5, max: 14 Avg time: 63.363363, total elements: 999, unique elements: 192, collisions: 1.000000, collisions mod 512: 1.215190, keys min: 1, avg: 5, max: 13 Avg time: 57.507508, total elements: 999, unique elements: 532, collisions: 1.000000, collisions mod 512: 1.588060, keys min: 2, avg: 12, max: 37 Avg time: 56.156156, total elements: 999, unique elements: 208, collisions: 1.000000, collisions mod 512: 1.238095, keys min: 2, avg: 6, max: 18 Avg time: 115.000000, total elements: 10, unique elements: 10, collisions: 1.000000, collisions mod 512: 1.111111, keys min: 378, avg: 499, max: 558 Avg time: 59.316770, total elements: 161, unique elements: 143, collisions: 1.000000, collisions mod 512: 1.108527, keys min: 8, avg: 22, max: 43 ``` ## Benchmark HashMap This repository also contains a simple HashMap implementation, which allows key to be of type String and value to conform with CollectionElement trait. ### Results CPU Specs: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz Tested with corpus 7, which is a list of S3 actions (total count 161, unique count 143) ``` AHash Avg put time 211.01180124223603 AHash Avg get time 82.304968944099386 WyHash Avg put time 206.67639751552795 WyHash Avg get time 81.214285714285708 FxHash64 Avg put time 223.24844720496895 FxHash64 Avg get time 84.171428571428578 StdHash Avg put time 634.18819875776398 StdHash Avg get time 278.51801242236024 ``` MacMini M1, 2020 ``` AHash Avg put time 347.82608695652175 AHash Avg get time 162.11180124223603 WyHash Avg put time 363.35403726708074 WyHash Avg get time 192.54658385093168 FxHash64 Avg put time 418.63354037267078 FxHash64 Avg get time 170.80745341614906 StdHash Avg put time 583.22981366459624 StdHash Avg get time 226.08695652173913 ``` ![Hash map benchmark chart](images/hash_map.png) --- ahasher/__init__.mojo --- from .ahasher import ahash, AHasher --- ahasher/ahasher.mojo --- from bit import byte_swap from bit import rotate_bits_left alias U256 = SIMD[DType.uint64, 4] alias U128 = SIMD[DType.uint64, 2] alias MULTIPLE = 6364136223846793005 alias ROT = 23 @always_inline fn folded_multiply(s: UInt64, by: UInt64) -> UInt64: var b1 = s * byte_swap(by) var b2 = byte_swap(s) * (~by) return b1 ^ byte_swap(b2) @always_inline fn read_small(data: UnsafePointer[UInt8], length: Int) -> U128: if length >= 2: if length >= 4: # len 4-8 var a = data.bitcast[DType.uint32]().load().cast[DType.uint64]() var b = data.offset(length - 4).bitcast[DType.uint32]().load().cast[DType.uint64]() return U128(a, b) else: var a = data.bitcast[DType.uint16]().load().cast[DType.uint64]() var b = data.offset(length - 1).load().cast[DType.uint64]() return U128(a, b) else: if length > 0: var a = data.load().cast[DType.uint64]() return U128(a, a) else: return U128(0, 0) struct AHasher: var buffer: UInt64 var pad: UInt64 var extra_keys: U128 fn __init__(inout self, key: U256): var pi_key = key ^ U256(0x243f_6a88_85a3_08d3, 0x1319_8a2e_0370_7344, 0xa409_3822_299f_31d0, 0x082e_fa98_ec4e_6c89,) self.buffer = pi_key[0] self.pad = pi_key[1] self.extra_keys = U128(pi_key[2], pi_key[3]) @always_inline fn update(inout self, new_data: UInt64): self.buffer = folded_multiply(new_data ^ self.buffer, MULTIPLE) @always_inline fn large_update(inout self, new_data: U128): var combined = folded_multiply( new_data[0] ^ self.extra_keys[0], new_data[1] ^ self.extra_keys[1] ) self.buffer = rotate_bits_left[ROT]((self.buffer + self.pad) ^ combined) @always_inline fn short_finish(self) -> UInt64: return self.buffer + self.pad @always_inline fn finish(self) -> UInt64: var rot = self.buffer & 63 var folded = folded_multiply(self.buffer, self.pad) return (folded << rot) | (folded >> (64 - rot)) @always_inline fn write(inout self, data: UnsafePointer[UInt8], length: Int): self.buffer = (self.buffer + length) * MULTIPLE if length > 8: if length > 16: var tail = data.offset(length - 16).bitcast[DType.uint64]().load[width=2]() self.large_update(tail) var offset = 0 while length - offset > 16: var block = data.offset(offset).bitcast[DType.uint64]().load[width=2]() self.large_update(block) offset += 16 else: var a = data.bitcast[DType.uint64]().load() var b = data.offset(length - 8).bitcast[DType.uint64]().load() self.large_update(U128(a, b)) else: var value = read_small(data, length) self.large_update(value) @always_inline fn ahash(s: String) -> UInt64: var length = len(s) var b = s.unsafe_ptr() var hasher = AHasher(U256(0, 0, 0, 0)) if length > 8: hasher.write(b, length) else: var value = read_small(b, length) hasher.buffer = folded_multiply(value[0] ^ hasher.buffer, value[1] ^ hasher.extra_keys[1]) hasher.pad = hasher.pad + length return hasher.finish() --- benchmark_hash_functions.mojo --- from collections import Set from time import now from memory.unsafe import bitcast # from fiby_tree import FibyTree from my_utils import int_cmp64, int_to_str64, cmp_str, stsl, int_cmp, int_to_str, corpus1, corpus2, corpus3, corpus4, corpus5, corpus6, corpus7, corpus8 from ahasher import ahash from wyhasher import wyhash from fnv1a import fnv1a64, fnv1a32 from fxhash import fxhash64, fxhash32 from md5 import md5_string @always_inline fn std_hash64(s: String) -> UInt64: return hash(s) @always_inline fn md5_hash(s: String) -> UInt64: return bitcast[DType.uint64, 2](md5_string(s))[0] fn benchamark[hashfn: fn(String) -> UInt64, steps: Int = 20](corpus: List[String], name: StringLiteral, ): # var f = FibyTree[UInt64, int_cmp64, int_to_str64]() # var f1 = FibyTree[UInt64, int_cmp64, int_to_str64]() var fs = Set[String]() var min_avg: Float64 = 100000.0 var mod = (1 << 9) var hashes = List[UInt64]() var mod_hashes: List[UInt64] = List[UInt64]() var total = 0 for step in range(steps): for i in range(len(corpus)): var key = corpus[i] var tik = now() var hash = hashfn(key) var tok = now() # hash_total += hash total += tok - tik var found = False for i in range(len(hashes)): if hash == hashes[i]: found = True break if not found: hashes.append(hash) found = False for i in range(len(mod_hashes)): if hash & (mod - 1) == mod_hashes[i]: found = True break if not found: mod_hashes.append(hash & (mod - 1))# f.add(hash) # f1.add(hash & (mod - 1)) if step == 0: fs.add(key) var c_avg = (total / steps) / len(corpus) min_avg = min(min_avg, c_avg) print( name, "avg hash compute", min_avg, "| hash colision", len(fs) / len(hashes), "| hash colision mod", mod, len(fs) / len(mod_hashes) ) fn benchamark32[hashfn: fn(String) -> UInt32, steps: Int = 20](corpus: List[String], name: StringLiteral): # var f = FibyTree[UInt32, int_cmp, int_to_str]() # var f1 = FibyTree[UInt32, int_cmp, int_to_str]() var fs = Set[String]() var min_avg: Float64 = 100000.0 var mod = (1 << 9) var hashes: List[UInt32] = List[UInt32]() var mod_hashes: List[UInt32] = List[UInt32]() var total = 0 for step in range(steps): for i in range(len(corpus)): var key = corpus[i] var tik = now() var hash = hashfn(key) var tok = now() total += tok - tik var found = False for i in range(len(hashes)): if hash == hashes[i]: found = True break if not found: hashes.append(hash) found = False for i in range(len(mod_hashes)): if hash & (mod - 1) == mod_hashes[i]: found = True break if not found: mod_hashes.append(hash & (mod - 1)) # f.add(hash) # f1.add(hash & (mod - 1)) if step == 0: fs.add(key) var c_avg = (total / steps) / len(corpus) min_avg = min(min_avg, c_avg) print( name, "avg hash compute", min_avg, "| hash colision", len(fs) / len(hashes), "| hash colision mod", mod, len(fs) / len(mod_hashes) ) fn corpus_details(corpus: List[String]): var word_count = len(corpus) print(word_count) var fs = Set[String]() var min_key_size = 10000000 var max_key_size = 0 var total_key_size = 0 for i in range(word_count): var key = corpus[i] fs.add(key) var key_size = len(key) total_key_size += key_size min_key_size = min(min_key_size, key_size) max_key_size = max(max_key_size, key_size) print( "Word count", word_count, "| unique word count", fs.__len__(), "| min key size", min_key_size, "| avg key size", total_key_size / word_count, "| max key size", max_key_size ) fn sample_wyhash(s : String) -> UInt64: var default_secret = SIMD[DType.uint64, 4](0xa0761d6478bd642f, 0xe7037ed1a0b428db, 0x8ebc6af09c88c6e3, 0x589965cc75374cc3) return wyhash(s, 0, default_secret) fn sample_fxhash64(s : String) -> UInt64: return fxhash64(s, 0) fn sample_fxhash32(s : String) -> UInt32: return fxhash32(s, 0) fn main() raises: var c1 = corpus1() print("\nCorpus 1") corpus_details(c1) benchamark[ahash](c1, "AHash") benchamark[sample_wyhash](c1, "Wyhash") benchamark32[fnv1a32](c1, "fnv1a32") benchamark[fnv1a64](c1, "fnv1a64") benchamark32[sample_fxhash32](c1, "fxHash32") benchamark[sample_fxhash64](c1, "fxHash64") benchamark[std_hash64](c1, "std_Hash64") benchamark[md5_hash](c1, "MD5") var c2 = corpus2() print("\nCorpus 2") corpus_details(c2) benchamark[ahash](c2, "AHash") benchamark[sample_wyhash](c2, "Wyhash") benchamark32[fnv1a32](c2, "fnv1a32") benchamark[fnv1a64](c2, "fnv1a64") benchamark32[sample_fxhash32](c2, "fxHash32") benchamark[sample_fxhash64](c2, "fxHash64") benchamark[std_hash64](c2, "std_Hash64") benchamark[md5_hash](c2, "MD5") var c3 = corpus3() print("\nCorpus 3") corpus_details(c3) benchamark[ahash](c3, "AHash") benchamark[sample_wyhash](c3, "Wyhash") benchamark32[fnv1a32](c3, "fnv1a32") benchamark[fnv1a64](c3, "fnv1a64") benchamark32[sample_fxhash32](c3, "fxHash32") benchamark[sample_fxhash64](c3, "fxHash64") benchamark[std_hash64](c3, "std_Hash64") benchamark[md5_hash](c3, "MD5") var c4 = corpus4() print("\nCorpus 4") corpus_details(c4) benchamark[ahash](c4, "AHash") benchamark[sample_wyhash](c4, "Wyhash") benchamark32[fnv1a32](c4, "fnv1a32") benchamark[fnv1a64](c4, "fnv1a64") benchamark32[sample_fxhash32](c4, "fxHash32") benchamark[sample_fxhash64](c4, "fxHash64") benchamark[std_hash64](c4, "std_Hash64") benchamark[md5_hash](c4, "MD5") var c5 = corpus5() print("\nCorpus 5") corpus_details(c5) benchamark[ahash](c5, "AHash") benchamark[sample_wyhash](c5, "Wyhash") benchamark32[fnv1a32](c5, "fnv1a32") benchamark[fnv1a64](c5, "fnv1a64") benchamark32[sample_fxhash32](c5, "fxHash32") benchamark[sample_fxhash64](c5, "fxHash64") benchamark[std_hash64](c5, "std_Hash64") benchamark[md5_hash](c5, "MD5") var c6 = corpus6() print("\nCorpus 6") corpus_details(c6) benchamark[ahash](c6, "AHash") benchamark[sample_wyhash](c6, "Wyhash") benchamark32[fnv1a32](c6, "fnv1a32") benchamark[fnv1a64](c6, "fnv1a64") benchamark32[sample_fxhash32](c6, "fxHash32") benchamark[sample_fxhash64](c6, "fxHash64") benchamark[std_hash64](c6, "std_Hash64") benchamark[md5_hash](c6, "MD5") var c7 = corpus7() print("\nCorpus 7") corpus_details(c7) benchamark[ahash](c7, "AHash") benchamark[sample_wyhash](c7, "Wyhash") benchamark32[fnv1a32](c7, "fnv1a32") benchamark[fnv1a64](c7, "fnv1a64") benchamark32[sample_fxhash32](c7, "fxHash32") benchamark[sample_fxhash64](c7, "fxHash64") benchamark[std_hash64](c7, "std_Hash64") benchamark[md5_hash](c7, "MD5") var c8 = corpus8() print("\nCorpus 8") corpus_details(c8) benchamark[ahash, 1](c8, "AHash") benchamark[sample_wyhash, 1](c8, "Wyhash") benchamark32[fnv1a32, 1](c8, "fnv1a32") benchamark[fnv1a64, 1](c8, "fnv1a64") benchamark32[sample_fxhash32, 1](c8, "fxHash32") benchamark[sample_fxhash64, 1](c8, "fxHash64") benchamark[std_hash64, 1](c8, "std_Hash64") # benchamark[md5_hash, 1](c8, "MD5") --- benchmark_hash_words_file.mojo --- from time import now from md5 import md5_string from wyhasher import wyhash from ahasher import ahash from fxhash import fxhash64 from sha import sha256_encode import benchmark from benchmark import Unit from pathlib import Path from collections.vector import InlinedFixedVector fn to_hex(digest: InlinedFixedVector[UInt8, 32]) -> String: var lookup = String("0123456789abcdef") var result: String = "" for i in range(len(digest)): var v = int(digest[i]) result += lookup[(v >> 4)] result += lookup[v & 15] return result fn to_hex(digest: SIMD[DType.uint8, 16]) -> String: var lookup = String("0123456789abcdef") var result: String = "" for i in range(len(digest)): var v = int(digest[i]) result += lookup[(v >> 4)] result += lookup[v & 15] return result fn main() raises: var text = Path("/usr/share/dict/words").read_text() var tik = now() var h0 = md5_string(text) var tok = now() print("MD5 :", tok - tik, to_hex(h0), len(text)) tik = now() var h5 = sha256_encode(text.unsafe_ptr(), 0) tok = now() print("SHA256 :", tok - tik, to_hex(h5), len(text)) tik = now() var h1 = wyhash(text, 0) tok = now() print("Wyhash :", tok - tik, h1, len(text)) tik = now() var h2 = ahash(text) tok = now() print("Ahash :", tok - tik, h2, len(text)) tik = now() var h3 = fxhash64(text) tok = now() print("Fxhash :", tok - tik, h3, len(text)) tik = now() var h4 = hash(text.unsafe_ptr(), len(text)) tok = now() print("Std hash:", tok - tik, h4, len(text)) var hb = SIMD[DType.uint8, 16]() @parameter fn md5_test(): hb = md5_string(text) print("===MD5===") var report0 = benchmark.run[md5_test]() report0.print(Unit.ns) print(hb) var hi = 0 @parameter fn hash_test(): hi = hash(text.unsafe_ptr(), len(text)) print("===Std hash===") var report1 = benchmark.run[hash_test]() report1.print(Unit.ns) print(hi) var hu = UInt64(0) @parameter fn ahash_test(): hu = ahash(text) print("===Ahash===") var report2 = benchmark.run[ahash_test]() report2.print(Unit.ns) print(hu) @parameter fn wyhash_test(): hu = wyhash(text, 0) print("===Wyhash===") var report3 = benchmark.run[wyhash_test]() report3.print(Unit.ns) print(hu) _ = text --- benchmark_other_languages/c/hash_functions/Makefile --- # wyhash bench makefile CXX = g++ CXXFLAGS = -std=c++11 -O2 -s -Wall -march=native TARGETS = wyhash0 wyhash1 wyhash2 xxh3scalar xxh3sse2 xxh3avx2 all: $(TARGETS) wyhash0: benchmark.cpp wyhash.h $(CXX) benchmark.cpp -o wyhash0 $(CXXFLAGS) -DWYHASH_CONDOM=0 wyhash1: benchmark.cpp wyhash.h $(CXX) benchmark.cpp -o wyhash1 $(CXXFLAGS) -DWYHASH_CONDOM=1 wyhash2: benchmark.cpp wyhash.h $(CXX) benchmark.cpp -o wyhash2 $(CXXFLAGS) -DWYHASH_CONDOM=2 xxh3scalar: benchmark.cpp $(CXX) benchmark.cpp -o xxh3scalar $(CXXFLAGS) -DXXH_VECTOR=0 -DXXH3 xxh3sse2: benchmark.cpp $(CXX) benchmark.cpp -o xxh3sse2 $(CXXFLAGS) -DXXH_VECTOR=1 -DXXH3 xxh3avx2: benchmark.cpp $(CXX) benchmark.cpp -o xxh3avx2 $(CXXFLAGS) -DXXH_VECTOR=2 -DXXH3 clean: rm $(TARGETS) --- benchmark_other_languages/c/hash_functions/benchmark.cpp --- #include <sys/time.h> #include <iostream> #include <fstream> #include <cstdlib> #include <stdint.h> #include <string> #include <cstring> #include <vector> #include <string> #include <sstream> #ifndef XXH3 #include "wyhash.h" #else #include "xxh3.h" #endif using namespace std; void benchmark(stringstream *corpus, string name, char delimeter) { string key; uint64_t dummy = 0; uint64_t total = 0; timeval tik, tok; uint64_t count = 0; for (size_t i = 0; i < 20; i++) { while(getline(*corpus, key, delimeter)) { gettimeofday(&tik,NULL); #ifndef XXH3 auto h = wyhash(key.c_str(),key.size(),0,_wyp); #else auto h = XXH3_64bits_withSeed(key.c_str(),key.size(),0); #endif gettimeofday(&tok,NULL); dummy += h; total += (tok.tv_usec-tik.tv_usec) * 1000; count ++; } corpus->clear(); corpus->seekg(0,ios::beg); } cout << "Avg per key " << name << ": " << double(total) / count << " " << count << " " << dummy << endl; } int main(int argc, char **argv) { stringstream corpus1("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque orci urna, pretium et porta ac, porttitor sit amet sem. Fusce sagittis lorem neque, vitae sollicitudin elit suscipit et. In interdum convallis nisl in ornare. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam erat volutpat. Morbi mollis iaculis lectus ac tincidunt. Fusce nisi lacus, semper eu dignissim et, malesuada non mi. Sed euismod urna vel elit faucibus, eu bibendum ante fringilla. Curabitur tempus in turpis at mattis. Aliquam erat volutpat. Donec maximus elementum felis, sit amet dignissim augue tincidunt blandit. Aliquam fermentum, est eu mollis."); stringstream corpus2("But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection:"); stringstream corpus3("A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls"); stringstream corpus4("Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину."); stringstream corpus5("Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen"); stringstream corpus6("米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。"); stringstream corpus7("AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus"); stringstream corpus8; ifstream file( "/usr/share/dict/words" ); corpus8 << file.rdbuf(); file.close(); #ifndef XXH3 string name = "Wyhash"; #else string name = "XXH3"; #endif benchmark(&corpus1, name, ' '); benchmark(&corpus2, name, ' '); benchmark(&corpus3, name, ' '); benchmark(&corpus4, name, ' '); benchmark(&corpus5, name, ' '); benchmark(&corpus6, name, ' '); benchmark(&corpus7, name, ' '); benchmark(&corpus8, name, '\n'); // string key = "Maxim"; // auto h = wyhash(key.c_str(),key.size(),0,_wyp); // cout << key << ": " << h << endl; return 0; } --- benchmark_other_languages/c/hash_functions/benchmark_wyhash.cpp --- #include <sys/time.h> #include <iostream> #include <fstream> #include <cstdlib> #include <stdint.h> #include <string> #include <cstring> #include <vector> #ifndef XXH3 #include "wyhash.h" #else #include "xxh3.h" #endif using namespace std; struct ha { size_t operator()(const string &s, uint64_t seed)const { #ifndef XXH3 return wyhash(s.c_str(),s.size(),seed,_wyp); #else return XXH3_64bits_withSeed(s.c_str(),s.size(),seed); #endif } }; vector <string> v; template <class Hasher> uint64_t bench_hash(const char *name) { Hasher h; string s; timeval beg, end; uint64_t dummy=0; const uint64_t N=v.size(), R=0x1000; cerr.precision(2); cerr.setf(ios::fixed); cerr<<'|'<<name<<(strlen(name)<8?"\t\t|":"\t|"); gettimeofday(&beg,NULL); for(size_t r=0; r<R; r++) for(size_t i=0; i<N; i++) dummy+=h(v[i],r); gettimeofday(&end,NULL); cerr<<1e-6*R*N/(end.tv_sec-beg.tv_sec+1e-6*(end.tv_usec-beg.tv_usec))<<"\t\t|"; s.resize(1<<8); gettimeofday(&beg,NULL); for(size_t r=0; r<(R<<14); r++) dummy+=h(s,r); gettimeofday(&end,NULL); cerr<<1e-9*(R<<14)*s.size()/(end.tv_sec-beg.tv_sec+1e-6*(end.tv_usec-beg.tv_usec))<<"\t\t|"; s.resize(1<<16); gettimeofday(&beg,NULL); for(size_t r=0; r<(R<<6); r++) dummy+=h(s,r); gettimeofday(&end,NULL); cerr<<1e-9*(R<<6)*s.size()/(end.tv_sec-beg.tv_sec+1e-6*(end.tv_usec-beg.tv_usec))<<"\t\t|\n"; return dummy; } int main(int argc, char **argv) { string file_name="/usr/share/dict/words", help_s="-h", s; if(argc>1) { if(help_s.compare(argv[1])==0) { cout<<"usage:\n"<<argv[0]<<" <file>\n"; cout<<"if no arguments given \'"<<file_name<<"\' is used\n"; return 0; } file_name=argv[1]; } ifstream fi(file_name.c_str()); if(fi.fail()) { cout<<"File \'"<<file_name<<"\' not found.\n"; cout<<"Try `-h\' for help.\n"; return 1; } for(fi>>s; !fi.eof(); fi>>s) if(s.size()) v.push_back(s); fi.close(); //shuffle the array to benchmark random access for(size_t i=v.size()-1; i; i--) swap(v[i],v[rand()%(i+1)]); uint64_t r=0; cerr<<file_name<<'\n'; cerr<<"|hash function\t|short hash/us\t|bulk_256B GB/s\t|bulk_64KB GB/s\t|\n"; cerr<<"|----\t\t|----\t\t|----\t\t|----\t\t|\n"; #ifndef XXH3 r+=bench_hash<ha>("wyhash"); #else r+=bench_hash<ha>("xxh3"); #endif return r; } --- benchmark_other_languages/c/hash_functions/wyhash.h --- // This is free and unencumbered software released into the public domain under The Unlicense (http://unlicense.org/) // main repo: https://github.com/wangyi-fudan/wyhash // author: 王一 Wang Yi <[email protected]> // contributors: Reini Urban, Dietrich Epp, Joshua Haberman, Tommy Ettinger, Daniel Lemire, Otmar Ertl, cocowalla, leo-yuriev, Diego Barrios Romero, paulie-g, dumblob, Yann Collet, ivte-ms, hyb, James Z.M. Gao, easyaspi314 (Devin), TheOneric /* quick example: string s="fjsakfdsjkf"; uint64_t hash=wyhash(s.c_str(), s.size(), 0, _wyp); */ #ifndef wyhash_final_version_4_2 #define wyhash_final_version_4_2 #ifndef WYHASH_CONDOM //protections that produce different results: //1: normal valid behavior //2: extra protection against entropy loss (probability=2^-63), aka. "blind multiplication" #define WYHASH_CONDOM 1 #endif #ifndef WYHASH_32BIT_MUM //0: normal version, slow on 32 bit systems //1: faster on 32 bit systems but produces different results, incompatible with wy2u0k function #define WYHASH_32BIT_MUM 0 #endif //includes #include <stdint.h> #include <string.h> #if defined(_MSC_VER) && defined(_M_X64) #include <intrin.h> #pragma intrinsic(_umul128) #endif //likely and unlikely macros #if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__) #define _likely_(x) __builtin_expect(x,1) #define _unlikely_(x) __builtin_expect(x,0) #else #define _likely_(x) (x) #define _unlikely_(x) (x) #endif //128bit multiply function static inline uint64_t _wyrot(uint64_t x) { return (x>>32)|(x<<32); } static inline void _wymum(uint64_t *A, uint64_t *B){ #if(WYHASH_32BIT_MUM) uint64_t hh=(*A>>32)*(*B>>32), hl=(*A>>32)*(uint32_t)*B, lh=(uint32_t)*A*(*B>>32), ll=(uint64_t)(uint32_t)*A*(uint32_t)*B; #if(WYHASH_CONDOM>1) *A^=_wyrot(hl)^hh; *B^=_wyrot(lh)^ll; #else *A=_wyrot(hl)^hh; *B=_wyrot(lh)^ll; #endif #elif defined(__SIZEOF_INT128__) __uint128_t r=*A; r*=*B; #if(WYHASH_CONDOM>1) *A^=(uint64_t)r; *B^=(uint64_t)(r>>64); #else *A=(uint64_t)r; *B=(uint64_t)(r>>64); #endif #elif defined(_MSC_VER) && defined(_M_X64) #if(WYHASH_CONDOM>1) uint64_t a, b; a=_umul128(*A,*B,&b); *A^=a; *B^=b; #else *A=_umul128(*A,*B,B); #endif #else uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B, hi, lo; uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t<rl; lo=t+(rm1<<32); c+=lo<t; hi=rh+(rm0>>32)+(rm1>>32)+c; #if(WYHASH_CONDOM>1) *A^=lo; *B^=hi; #else *A=lo; *B=hi; #endif #endif } //multiply and xor mix function, aka MUM static inline uint64_t _wymix(uint64_t A, uint64_t B){ _wymum(&A,&B); return A^B; } //endian macros #ifndef WYHASH_LITTLE_ENDIAN #if defined(_WIN32) || defined(__LITTLE_ENDIAN__) || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) #define WYHASH_LITTLE_ENDIAN 1 #elif defined(__BIG_ENDIAN__) || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) #define WYHASH_LITTLE_ENDIAN 0 #else #warning could not determine endianness! Falling back to little endian. #define WYHASH_LITTLE_ENDIAN 1 #endif #endif //read functions #if (WYHASH_LITTLE_ENDIAN) static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return v;} static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return v;} #elif defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__) static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return __builtin_bswap64(v);} static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return __builtin_bswap32(v);} #elif defined(_MSC_VER) static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return _byteswap_uint64(v);} static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return _byteswap_ulong(v);} #else static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return (((v >> 56) & 0xff)| ((v >> 40) & 0xff00)| ((v >> 24) & 0xff0000)| ((v >> 8) & 0xff000000)| ((v << 8) & 0xff00000000)| ((v << 24) & 0xff0000000000)| ((v << 40) & 0xff000000000000)| ((v << 56) & 0xff00000000000000)); } static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return (((v >> 24) & 0xff)| ((v >> 8) & 0xff00)| ((v << 8) & 0xff0000)| ((v << 24) & 0xff000000)); } #endif static inline uint64_t _wyr3(const uint8_t *p, size_t k) { return (((uint64_t)p[0])<<16)|(((uint64_t)p[k>>1])<<8)|p[k-1];} //wyhash main function static inline uint64_t wyhash(const void *key, size_t len, uint64_t seed, const uint64_t *secret){ const uint8_t *p=(const uint8_t *)key; seed^=_wymix(seed^secret[0],secret[1]); uint64_t a, b; if(_likely_(len<=16)){ if(_likely_(len>=4)){ a=(_wyr4(p)<<32)|_wyr4(p+((len>>3)<<2)); b=(_wyr4(p+len-4)<<32)|_wyr4(p+len-4-((len>>3)<<2)); } else if(_likely_(len>0)){ a=_wyr3(p,len); b=0;} else a=b=0; } else{ size_t i=len; if(_unlikely_(i>=48)){ uint64_t see1=seed, see2=seed; do{ seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); see1=_wymix(_wyr8(p+16)^secret[2],_wyr8(p+24)^see1); see2=_wymix(_wyr8(p+32)^secret[3],_wyr8(p+40)^see2); p+=48; i-=48; }while(_likely_(i>=48)); seed^=see1^see2; } while(_unlikely_(i>16)){ seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); i-=16; p+=16; } a=_wyr8(p+i-16); b=_wyr8(p+i-8); } a^=secret[1]; b^=seed; _wymum(&a,&b); return _wymix(a^secret[0]^len,b^secret[1]); } //the default secret parameters static const uint64_t _wyp[4] = {0x2d358dccaa6c78a5ull, 0x8bb84b93962eacc9ull, 0x4b33a62ed433d4a3ull, 0x4d5a2da51de1aa47ull}; //a useful 64bit-64bit mix function to produce deterministic pseudo random numbers that can pass BigCrush and PractRand static inline uint64_t wyhash64(uint64_t A, uint64_t B){ A^=0x2d358dccaa6c78a5ull; B^=0x8bb84b93962eacc9ull; _wymum(&A,&B); return _wymix(A^0x2d358dccaa6c78a5ull,B^0x8bb84b93962eacc9ull);} //The wyrand PRNG that pass BigCrush and PractRand static inline uint64_t wyrand(uint64_t *seed){ *seed+=0x2d358dccaa6c78a5ull; return _wymix(*seed,*seed^0x8bb84b93962eacc9ull);} //convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash. static inline double wy2u01(uint64_t r){ const double _wynorm=1.0/(1ull<<52); return (r>>12)*_wynorm;} //convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined with wyrand, wyhash64 or wyhash. static inline double wy2gau(uint64_t r){ const double _wynorm=1.0/(1ull<<20); return ((r&0x1fffff)+((r>>21)&0x1fffff)+((r>>42)&0x1fffff))*_wynorm-3.0;} #ifdef WYTRNG #include <sys/time.h> //The wytrand true random number generator, passed BigCrush. static inline uint64_t wytrand(uint64_t *seed){ struct timeval t; gettimeofday(&t,0); uint64_t teed=(((uint64_t)t.tv_sec)<<32)|t.tv_usec; teed=_wymix(teed^_wyp[0],*seed^_wyp[1]); *seed=_wymix(teed^_wyp[0],_wyp[2]); return _wymix(*seed,*seed^_wyp[3]); } #endif #if(!WYHASH_32BIT_MUM) //fast range integer random number generation on [0,k) credit to Daniel Lemire. May not work when WYHASH_32BIT_MUM=1. It can be combined with wyrand, wyhash64 or wyhash. static inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; } #endif // modified from https://github.com/going-digital/Prime64 static inline unsigned long long mul_mod(unsigned long long a, unsigned long long b, unsigned long long m) { unsigned long long r=0; while (b) { if (b & 1) { unsigned long long r2 = r + a; if (r2 < r) r2 -= m; r = r2 % m; } b >>= 1; if (b) { unsigned long long a2 = a + a; if (a2 < a) a2 -= m; a = a2 % m; } } return r; } static inline unsigned long long pow_mod(unsigned long long a, unsigned long long b, unsigned long long m) { unsigned long long r=1; while (b) { if (b&1) r=mul_mod(r,a,m); b>>=1; if (b) a=mul_mod(a,a,m); } return r; } unsigned sprp(unsigned long long n, unsigned long long a) { unsigned long long d=n-1; unsigned char s=0; while (!(d & 0xff)) { d>>=8; s+=8; } if (!(d & 0xf)) { d>>=4; s+=4; } if (!(d & 0x3)) { d>>=2; s+=2; } if (!(d & 0x1)) { d>>=1; s+=1; } unsigned long long b=pow_mod(a,d,n); if ((b==1) || (b==(n-1))) return 1; unsigned char r; for (r=1; r<s; r++) { b=mul_mod(b,b,n); if (b<=1) return 0; if (b==(n-1)) return 1; } return 0; } unsigned is_prime(unsigned long long n) { if (n<2||!(n&1)) return 0; if (n<4) return 1; if (!sprp(n,2)) return 0; if (n<2047) return 1; if (!sprp(n,3)) return 0; if (!sprp(n,5)) return 0; if (!sprp(n,7)) return 0; if (!sprp(n,11)) return 0; if (!sprp(n,13)) return 0; if (!sprp(n,17)) return 0; if (!sprp(n,19)) return 0; if (!sprp(n,23)) return 0; if (!sprp(n,29)) return 0; if (!sprp(n,31)) return 0; if (!sprp(n,37)) return 0; return 1; } //make your own secret static inline void make_secret(uint64_t seed, uint64_t *secret){ uint8_t c[] = {15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58, 60, 71, 75, 77, 78, 83, 85, 86, 89, 90, 92, 99, 101, 102, 105, 106, 108, 113, 114, 116, 120, 135, 139, 141, 142, 147, 149, 150, 153, 154, 156, 163, 165, 166, 169, 170, 172, 177, 178, 180, 184, 195, 197, 198, 201, 202, 204, 209, 210, 212, 216, 225, 226, 228, 232, 240 }; for(size_t i=0;i<4;i++){ uint8_t ok; do{ ok=1; secret[i]=0; for(size_t j=0;j<64;j+=8) secret[i]|=((uint64_t)c[wyrand(&seed)%sizeof(c)])<<j; if(secret[i]%2==0){ ok=0; continue; } for(size_t j=0;j<i;j++) { #if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__) if(__builtin_popcountll(secret[j]^secret[i])!=32){ ok=0; break; } #elif defined(_MSC_VER) && defined(_M_X64) if(_mm_popcnt_u64(secret[j]^secret[i])!=32){ ok=0; break; } #else //manual popcount uint64_t x = secret[j]^secret[i]; x -= (x >> 1) & 0x5555555555555555; x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333); x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f; x = (x * 0x0101010101010101) >> 56; if(x!=32){ ok=0; break; } #endif } if(ok&&!is_prime(secret[i])) ok=0; }while(!ok); } } #endif /* The Unlicense This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/> */ --- benchmark_other_languages/c/hash_functions/xxh3.h --- /* * xxHash - Extremely Fast Hash algorithm * Development source file for `xxh3` * Copyright (C) 2019-2021 Yann Collet * * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You can contact the author at: * - xxHash homepage: https://www.xxhash.com * - xxHash source repository: https://github.com/Cyan4973/xxHash */ /* * Note: This file used to host the source code of XXH3_* variants. * during the development period. * The source code is now properly integrated within xxhash.h. * * xxh3.h is no longer useful, * but it is still provided for compatibility with source code * which used to include it directly. * * Programs are now highly discouraged to include xxh3.h. * Include `xxhash.h` instead, which is the officially supported interface. * * In the future, xxh3.h will start to generate warnings, then errors, * then it will be removed from source package and from include directory. */ /* Simulate the same impact as including the old xxh3.h source file */ #define XXH_INLINE_ALL #include "xxhash.h" --- benchmark_other_languages/c/hash_functions/xxhash.c --- /* * xxHash - Extremely Fast Hash algorithm * Copyright (C) 2012-2023 Yann Collet * * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You can contact the author at: * - xxHash homepage: https://www.xxhash.com * - xxHash source repository: https://github.com/Cyan4973/xxHash */ /* * xxhash.c instantiates functions defined in xxhash.h */ #define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ #define XXH_IMPLEMENTATION /* access definitions */ #include "xxhash.h" --- benchmark_other_languages/c/hash_functions/xxhash.h --- /* * xxHash - Extremely Fast Hash algorithm * Header File * Copyright (C) 2012-2023 Yann Collet * * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You can contact the author at: * - xxHash homepage: https://www.xxhash.com * - xxHash source repository: https://github.com/Cyan4973/xxHash */ /*! * @mainpage xxHash * * xxHash is an extremely fast non-cryptographic hash algorithm, working at RAM speed * limits. * * It is proposed in four flavors, in three families: * 1. @ref XXH32_family * - Classic 32-bit hash function. Simple, compact, and runs on almost all * 32-bit and 64-bit systems. * 2. @ref XXH64_family * - Classic 64-bit adaptation of XXH32. Just as simple, and runs well on most * 64-bit systems (but _not_ 32-bit systems). * 3. @ref XXH3_family * - Modern 64-bit and 128-bit hash function family which features improved * strength and performance across the board, especially on smaller data. * It benefits greatly from SIMD and 64-bit without requiring it. * * Benchmarks * --- * The reference system uses an Intel i7-9700K CPU, and runs Ubuntu x64 20.04. * The open source benchmark program is compiled with clang v10.0 using -O3 flag. * * | Hash Name | ISA ext | Width | Large Data Speed | Small Data Velocity | * | -------------------- | ------- | ----: | ---------------: | ------------------: | * | XXH3_64bits() | @b AVX2 | 64 | 59.4 GB/s | 133.1 | * | MeowHash | AES-NI | 128 | 58.2 GB/s | 52.5 | * | XXH3_128bits() | @b AVX2 | 128 | 57.9 GB/s | 118.1 | * | CLHash | PCLMUL | 64 | 37.1 GB/s | 58.1 | * | XXH3_64bits() | @b SSE2 | 64 | 31.5 GB/s | 133.1 | * | XXH3_128bits() | @b SSE2 | 128 | 29.6 GB/s | 118.1 | * | RAM sequential read | | N/A | 28.0 GB/s | N/A | * | ahash | AES-NI | 64 | 22.5 GB/s | 107.2 | * | City64 | | 64 | 22.0 GB/s | 76.6 | * | T1ha2 | | 64 | 22.0 GB/s | 99.0 | * | City128 | | 128 | 21.7 GB/s | 57.7 | * | FarmHash | AES-NI | 64 | 21.3 GB/s | 71.9 | * | XXH64() | | 64 | 19.4 GB/s | 71.0 | * | SpookyHash | | 64 | 19.3 GB/s | 53.2 | * | Mum | | 64 | 18.0 GB/s | 67.0 | * | CRC32C | SSE4.2 | 32 | 13.0 GB/s | 57.9 | * | XXH32() | | 32 | 9.7 GB/s | 71.9 | * | City32 | | 32 | 9.1 GB/s | 66.0 | * | Blake3* | @b AVX2 | 256 | 4.4 GB/s | 8.1 | * | Murmur3 | | 32 | 3.9 GB/s | 56.1 | * | SipHash* | | 64 | 3.0 GB/s | 43.2 | * | Blake3* | @b SSE2 | 256 | 2.4 GB/s | 8.1 | * | HighwayHash | | 64 | 1.4 GB/s | 6.0 | * | FNV64 | | 64 | 1.2 GB/s | 62.7 | * | Blake2* | | 256 | 1.1 GB/s | 5.1 | * | SHA1* | | 160 | 0.8 GB/s | 5.6 | * | MD5* | | 128 | 0.6 GB/s | 7.8 | * @note * - Hashes which require a specific ISA extension are noted. SSE2 is also noted, * even though it is mandatory on x64. * - Hashes with an asterisk are cryptographic. Note that MD5 is non-cryptographic * by modern standards. * - Small data velocity is a rough average of algorithm's efficiency for small * data. For more accurate information, see the wiki. * - More benchmarks and strength tests are found on the wiki: * https://github.com/Cyan4973/xxHash/wiki * * Usage * ------ * All xxHash variants use a similar API. Changing the algorithm is a trivial * substitution. * * @pre * For functions which take an input and length parameter, the following * requirements are assumed: * - The range from [`input`, `input + length`) is valid, readable memory. * - The only exception is if the `length` is `0`, `input` may be `NULL`. * - For C++, the objects must have the *TriviallyCopyable* property, as the * functions access bytes directly as if it was an array of `unsigned char`. * * @anchor single_shot_example * **Single Shot** * * These functions are stateless functions which hash a contiguous block of memory, * immediately returning the result. They are the easiest and usually the fastest * option. * * XXH32(), XXH64(), XXH3_64bits(), XXH3_128bits() * * @code{.c} * #include <string.h> * #include "xxhash.h" * * // Example for a function which hashes a null terminated string with XXH32(). * XXH32_hash_t hash_string(const char* string, XXH32_hash_t seed) * { * // NULL pointers are only valid if the length is zero * size_t length = (string == NULL) ? 0 : strlen(string); * return XXH32(string, length, seed); * } * @endcode * * * @anchor streaming_example * **Streaming** * * These groups of functions allow incremental hashing of unknown size, even * more than what would fit in a size_t. * * XXH32_reset(), XXH64_reset(), XXH3_64bits_reset(), XXH3_128bits_reset() * * @code{.c} * #include <stdio.h> * #include <assert.h> * #include "xxhash.h" * // Example for a function which hashes a FILE incrementally with XXH3_64bits(). * XXH64_hash_t hashFile(FILE* f) * { * // Allocate a state struct. Do not just use malloc() or new. * XXH3_state_t* state = XXH3_createState(); * assert(state != NULL && "Out of memory!"); * // Reset the state to start a new hashing session. * XXH3_64bits_reset(state); * char buffer[4096]; * size_t count; * // Read the file in chunks * while ((count = fread(buffer, 1, sizeof(buffer), f)) != 0) { * // Run update() as many times as necessary to process the data * XXH3_64bits_update(state, buffer, count); * } * // Retrieve the finalized hash. This will not change the state. * XXH64_hash_t result = XXH3_64bits_digest(state); * // Free the state. Do not use free(). * XXH3_freeState(state); * return result; * } * @endcode * * Streaming functions generate the xxHash value from an incremental input. * This method is slower than single-call functions, due to state management. * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. * * An XXH state must first be allocated using `XXH*_createState()`. * * Start a new hash by initializing the state with a seed using `XXH*_reset()`. * * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. * * The function returns an error code, with 0 meaning OK, and any other value * meaning there is an error. * * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. * This function returns the nn-bits hash as an int or long long. * * It's still possible to continue inserting input into the hash state after a * digest, and generate new hash values later on by invoking `XXH*_digest()`. * * When done, release the state using `XXH*_freeState()`. * * * @anchor canonical_representation_example * **Canonical Representation** * * The default return values from XXH functions are unsigned 32, 64 and 128 bit * integers. * This the simplest and fastest format for further post-processing. * * However, this leaves open the question of what is the order on the byte level, * since little and big endian conventions will store the same number differently. * * The canonical representation settles this issue by mandating big-endian * convention, the same convention as human-readable numbers (large digits first). * * When writing hash values to storage, sending them over a network, or printing * them, it's highly recommended to use the canonical representation to ensure * portability across a wider range of systems, present and future. * * The following functions allow transformation of hash values to and from * canonical format. * * XXH32_canonicalFromHash(), XXH32_hashFromCanonical(), * XXH64_canonicalFromHash(), XXH64_hashFromCanonical(), * XXH128_canonicalFromHash(), XXH128_hashFromCanonical(), * * @code{.c} * #include <stdio.h> * #include "xxhash.h" * * // Example for a function which prints XXH32_hash_t in human readable format * void printXxh32(XXH32_hash_t hash) * { * XXH32_canonical_t cano; * XXH32_canonicalFromHash(&cano, hash); * size_t i; * for(i = 0; i < sizeof(cano.digest); ++i) { * printf("%02x", cano.digest[i]); * } * printf("\n"); * } * * // Example for a function which converts XXH32_canonical_t to XXH32_hash_t * XXH32_hash_t convertCanonicalToXxh32(XXH32_canonical_t cano) * { * XXH32_hash_t hash = XXH32_hashFromCanonical(&cano); * return hash; * } * @endcode * * * @file xxhash.h * xxHash prototypes and implementation */ #if defined (__cplusplus) extern "C" { #endif /* **************************** * INLINE mode ******************************/ /*! * @defgroup public Public API * Contains details on the public xxHash functions. * @{ */ #ifdef XXH_DOXYGEN /*! * @brief Gives access to internal state declaration, required for static allocation. * * Incompatible with dynamic linking, due to risks of ABI changes. * * Usage: * @code{.c} * #define XXH_STATIC_LINKING_ONLY * #include "xxhash.h" * @endcode */ # define XXH_STATIC_LINKING_ONLY /* Do not undef XXH_STATIC_LINKING_ONLY for Doxygen */ /*! * @brief Gives access to internal definitions. * * Usage: * @code{.c} * #define XXH_STATIC_LINKING_ONLY * #define XXH_IMPLEMENTATION * #include "xxhash.h" * @endcode */ # define XXH_IMPLEMENTATION /* Do not undef XXH_IMPLEMENTATION for Doxygen */ /*! * @brief Exposes the implementation and marks all functions as `inline`. * * Use these build macros to inline xxhash into the target unit. * Inlining improves performance on small inputs, especially when the length is * expressed as a compile-time constant: * * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html * * It also keeps xxHash symbols private to the unit, so they are not exported. * * Usage: * @code{.c} * #define XXH_INLINE_ALL * #include "xxhash.h" * @endcode * Do not compile and link xxhash.o as a separate object, as it is not useful. */ # define XXH_INLINE_ALL # undef XXH_INLINE_ALL /*! * @brief Exposes the implementation without marking functions as inline. */ # define XXH_PRIVATE_API # undef XXH_PRIVATE_API /*! * @brief Emulate a namespace by transparently prefixing all symbols. * * If you want to include _and expose_ xxHash functions from within your own * library, but also want to avoid symbol collisions with other libraries which * may also include xxHash, you can use @ref XXH_NAMESPACE to automatically prefix * any public symbol from xxhash library with the value of @ref XXH_NAMESPACE * (therefore, avoid empty or numeric values). * * Note that no change is required within the calling program as long as it * includes `xxhash.h`: Regular symbol names will be automatically translated * by this header. */ # define XXH_NAMESPACE /* YOUR NAME HERE */ # undef XXH_NAMESPACE #endif #if (defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)) \ && !defined(XXH_INLINE_ALL_31684351384) /* this section should be traversed only once */ # define XXH_INLINE_ALL_31684351384 /* give access to the advanced API, required to compile implementations */ # undef XXH_STATIC_LINKING_ONLY /* avoid macro redef */ # define XXH_STATIC_LINKING_ONLY /* make all functions private */ # undef XXH_PUBLIC_API # if defined(__GNUC__) # define XXH_PUBLIC_API static __inline __attribute__((unused)) # elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) # define XXH_PUBLIC_API static inline # elif defined(_MSC_VER) # define XXH_PUBLIC_API static __inline # else /* note: this version may generate warnings for unused static functions */ # define XXH_PUBLIC_API static # endif /* * This part deals with the special case where a unit wants to inline xxHash, * but "xxhash.h" has previously been included without XXH_INLINE_ALL, * such as part of some previously included *.h header file. * Without further action, the new include would just be ignored, * and functions would effectively _not_ be inlined (silent failure). * The following macros solve this situation by prefixing all inlined names, * avoiding naming collision with previous inclusions. */ /* Before that, we unconditionally #undef all symbols, * in case they were already defined with XXH_NAMESPACE. * They will then be redefined for XXH_INLINE_ALL */ # undef XXH_versionNumber /* XXH32 */ # undef XXH32 # undef XXH32_createState # undef XXH32_freeState # undef XXH32_reset # undef XXH32_update # undef XXH32_digest # undef XXH32_copyState # undef XXH32_canonicalFromHash # undef XXH32_hashFromCanonical /* XXH64 */ # undef XXH64 # undef XXH64_createState # undef XXH64_freeState # undef XXH64_reset # undef XXH64_update # undef XXH64_digest # undef XXH64_copyState # undef XXH64_canonicalFromHash # undef XXH64_hashFromCanonical /* XXH3_64bits */ # undef XXH3_64bits # undef XXH3_64bits_withSecret # undef XXH3_64bits_withSeed # undef XXH3_64bits_withSecretandSeed # undef XXH3_createState # undef XXH3_freeState # undef XXH3_copyState # undef XXH3_64bits_reset # undef XXH3_64bits_reset_withSeed # undef XXH3_64bits_reset_withSecret # undef XXH3_64bits_update # undef XXH3_64bits_digest # undef XXH3_generateSecret /* XXH3_128bits */ # undef XXH128 # undef XXH3_128bits # undef XXH3_128bits_withSeed # undef XXH3_128bits_withSecret # undef XXH3_128bits_reset # undef XXH3_128bits_reset_withSeed # undef XXH3_128bits_reset_withSecret # undef XXH3_128bits_reset_withSecretandSeed # undef XXH3_128bits_update # undef XXH3_128bits_digest # undef XXH128_isEqual # undef XXH128_cmp # undef XXH128_canonicalFromHash # undef XXH128_hashFromCanonical /* Finally, free the namespace itself */ # undef XXH_NAMESPACE /* employ the namespace for XXH_INLINE_ALL */ # define XXH_NAMESPACE XXH_INLINE_ /* * Some identifiers (enums, type names) are not symbols, * but they must nonetheless be renamed to avoid redeclaration. * Alternative solution: do not redeclare them. * However, this requires some #ifdefs, and has a more dispersed impact. * Meanwhile, renaming can be achieved in a single place. */ # define XXH_IPREF(Id) XXH_NAMESPACE ## Id # define XXH_OK XXH_IPREF(XXH_OK) # define XXH_ERROR XXH_IPREF(XXH_ERROR) # define XXH_errorcode XXH_IPREF(XXH_errorcode) # define XXH32_canonical_t XXH_IPREF(XXH32_canonical_t) # define XXH64_canonical_t XXH_IPREF(XXH64_canonical_t) # define XXH128_canonical_t XXH_IPREF(XXH128_canonical_t) # define XXH32_state_s XXH_IPREF(XXH32_state_s) # define XXH32_state_t XXH_IPREF(XXH32_state_t) # define XXH64_state_s XXH_IPREF(XXH64_state_s) # define XXH64_state_t XXH_IPREF(XXH64_state_t) # define XXH3_state_s XXH_IPREF(XXH3_state_s) # define XXH3_state_t XXH_IPREF(XXH3_state_t) # define XXH128_hash_t XXH_IPREF(XXH128_hash_t) /* Ensure the header is parsed again, even if it was previously included */ # undef XXHASH_H_5627135585666179 # undef XXHASH_H_STATIC_13879238742 #endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */ /* **************************************************************** * Stable API *****************************************************************/ #ifndef XXHASH_H_5627135585666179 #define XXHASH_H_5627135585666179 1 /*! @brief Marks a global symbol. */ #if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) # if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) # ifdef XXH_EXPORT # define XXH_PUBLIC_API __declspec(dllexport) # elif XXH_IMPORT # define XXH_PUBLIC_API __declspec(dllimport) # endif # else # define XXH_PUBLIC_API /* do nothing */ # endif #endif #ifdef XXH_NAMESPACE # define XXH_CAT(A,B) A##B # define XXH_NAME2(A,B) XXH_CAT(A,B) # define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) /* XXH32 */ # define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) # define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) # define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) # define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) # define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) # define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) # define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState) # define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash) # define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical) /* XXH64 */ # define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) # define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) # define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) # define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) # define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) # define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) # define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState) # define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash) # define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical) /* XXH3_64bits */ # define XXH3_64bits XXH_NAME2(XXH_NAMESPACE, XXH3_64bits) # define XXH3_64bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSecret) # define XXH3_64bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSeed) # define XXH3_64bits_withSecretandSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSecretandSeed) # define XXH3_createState XXH_NAME2(XXH_NAMESPACE, XXH3_createState) # define XXH3_freeState XXH_NAME2(XXH_NAMESPACE, XXH3_freeState) # define XXH3_copyState XXH_NAME2(XXH_NAMESPACE, XXH3_copyState) # define XXH3_64bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset) # define XXH3_64bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSeed) # define XXH3_64bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSecret) # define XXH3_64bits_reset_withSecretandSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSecretandSeed) # define XXH3_64bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_update) # define XXH3_64bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_digest) # define XXH3_generateSecret XXH_NAME2(XXH_NAMESPACE, XXH3_generateSecret) # define XXH3_generateSecret_fromSeed XXH_NAME2(XXH_NAMESPACE, XXH3_generateSecret_fromSeed) /* XXH3_128bits */ # define XXH128 XXH_NAME2(XXH_NAMESPACE, XXH128) # define XXH3_128bits XXH_NAME2(XXH_NAMESPACE, XXH3_128bits) # define XXH3_128bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSeed) # define XXH3_128bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSecret) # define XXH3_128bits_withSecretandSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSecretandSeed) # define XXH3_128bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset) # define XXH3_128bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSeed) # define XXH3_128bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSecret) # define XXH3_128bits_reset_withSecretandSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSecretandSeed) # define XXH3_128bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_update) # define XXH3_128bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_digest) # define XXH128_isEqual XXH_NAME2(XXH_NAMESPACE, XXH128_isEqual) # define XXH128_cmp XXH_NAME2(XXH_NAMESPACE, XXH128_cmp) # define XXH128_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH128_canonicalFromHash) # define XXH128_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH128_hashFromCanonical) #endif /* ************************************* * Compiler specifics ***************************************/ /* specific declaration modes for Windows */ #if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) # if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) # ifdef XXH_EXPORT # define XXH_PUBLIC_API __declspec(dllexport) # elif XXH_IMPORT # define XXH_PUBLIC_API __declspec(dllimport) # endif # else # define XXH_PUBLIC_API /* do nothing */ # endif #endif #if defined (__GNUC__) # define XXH_CONSTF __attribute__((const)) # define XXH_PUREF __attribute__((pure)) # define XXH_MALLOCF __attribute__((malloc)) #else # define XXH_CONSTF /* disable */ # define XXH_PUREF # define XXH_MALLOCF #endif /* ************************************* * Version ***************************************/ #define XXH_VERSION_MAJOR 0 #define XXH_VERSION_MINOR 8 #define XXH_VERSION_RELEASE 2 /*! @brief Version number, encoded as two digits each */ #define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) /*! * @brief Obtains the xxHash version. * * This is mostly useful when xxHash is compiled as a shared library, * since the returned value comes from the library, as opposed to header file. * * @return @ref XXH_VERSION_NUMBER of the invoked library. */ XXH_PUBLIC_API XXH_CONSTF unsigned XXH_versionNumber (void); /* **************************** * Common basic types ******************************/ #include <stddef.h> /* size_t */ /*! * @brief Exit code for the streaming API. */ typedef enum { XXH_OK = 0, /*!< OK */ XXH_ERROR /*!< Error */ } XXH_errorcode; /*-********************************************************************** * 32-bit hash ************************************************************************/ #if defined(XXH_DOXYGEN) /* Don't show <stdint.h> include */ /*! * @brief An unsigned 32-bit integer. * * Not necessarily defined to `uint32_t` but functionally equivalent. */ typedef uint32_t XXH32_hash_t; #elif !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) # include <stdint.h> typedef uint32_t XXH32_hash_t; #else # include <limits.h> # if UINT_MAX == 0xFFFFFFFFUL typedef unsigned int XXH32_hash_t; # elif ULONG_MAX == 0xFFFFFFFFUL typedef unsigned long XXH32_hash_t; # else # error "unsupported platform: need a 32-bit type" # endif #endif /*! * @} * * @defgroup XXH32_family XXH32 family * @ingroup public * Contains functions used in the classic 32-bit xxHash algorithm. * * @note * XXH32 is useful for older platforms, with no or poor 64-bit performance. * Note that the @ref XXH3_family provides competitive speed for both 32-bit * and 64-bit systems, and offers true 64/128 bit hash results. * * @see @ref XXH64_family, @ref XXH3_family : Other xxHash families * @see @ref XXH32_impl for implementation details * @{ */ /*! * @brief Calculates the 32-bit hash of @p input using xxHash32. * * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * @param seed The 32-bit seed to alter the hash's output predictably. * * @pre * The memory between @p input and @p input + @p length must be valid, * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * @return The calculated 32-bit xxHash32 value. * * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); #ifndef XXH_NO_STREAM /*! * @typedef struct XXH32_state_s XXH32_state_t * @brief The opaque state struct for the XXH32 streaming API. * * @see XXH32_state_s for details. * @see @ref streaming_example "Streaming Example" */ typedef struct XXH32_state_s XXH32_state_t; /*! * @brief Allocates an @ref XXH32_state_t. * * @return An allocated pointer of @ref XXH32_state_t on success. * @return `NULL` on failure. * * @note Must be freed with XXH32_freeState(). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_MALLOCF XXH32_state_t* XXH32_createState(void); /*! * @brief Frees an @ref XXH32_state_t. * * @param statePtr A pointer to an @ref XXH32_state_t allocated with @ref XXH32_createState(). * * @return @ref XXH_OK. * * @note @p statePtr must be allocated with XXH32_createState(). * * @see @ref streaming_example "Streaming Example" * */ XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); /*! * @brief Copies one @ref XXH32_state_t to another. * * @param dst_state The state to copy to. * @param src_state The state to copy from. * @pre * @p dst_state and @p src_state must not be `NULL` and must not overlap. */ XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_t* src_state); /*! * @brief Resets an @ref XXH32_state_t to begin a new hash. * * @param statePtr The state struct to reset. * @param seed The 32-bit seed to alter the hash result predictably. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note This function resets and seeds a state. Call it before @ref XXH32_update(). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t seed); /*! * @brief Consumes a block of @p input to an @ref XXH32_state_t. * * @param statePtr The state struct to update. * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * * @pre * @p statePtr must not be `NULL`. * @pre * The memory between @p input and @p input + @p length must be valid, * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note Call this to incrementally consume blocks of data. * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); /*! * @brief Returns the calculated hash value from an @ref XXH32_state_t. * * @param statePtr The state struct to calculate the hash from. * * @pre * @p statePtr must not be `NULL`. * * @return The calculated 32-bit xxHash32 value from that state. * * @note * Calling XXH32_digest() will not affect @p statePtr, so you can update, * digest, and update again. * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); #endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ /*! * @brief Canonical (big endian) representation of @ref XXH32_hash_t. */ typedef struct { unsigned char digest[4]; /*!< Hash bytes, big endian */ } XXH32_canonical_t; /*! * @brief Converts an @ref XXH32_hash_t to a big endian @ref XXH32_canonical_t. * * @param dst The @ref XXH32_canonical_t pointer to be stored to. * @param hash The @ref XXH32_hash_t to be converted. * * @pre * @p dst must not be `NULL`. * * @see @ref canonical_representation_example "Canonical Representation Example" */ XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); /*! * @brief Converts an @ref XXH32_canonical_t to a native @ref XXH32_hash_t. * * @param src The @ref XXH32_canonical_t to convert. * * @pre * @p src must not be `NULL`. * * @return The converted hash. * * @see @ref canonical_representation_example "Canonical Representation Example" */ XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); /*! @cond Doxygen ignores this part */ #ifdef __has_attribute # define XXH_HAS_ATTRIBUTE(x) __has_attribute(x) #else # define XXH_HAS_ATTRIBUTE(x) 0 #endif /*! @endcond */ /*! @cond Doxygen ignores this part */ /* * C23 __STDC_VERSION__ number hasn't been specified yet. For now * leave as `201711L` (C17 + 1). * TODO: Update to correct value when its been specified. */ #define XXH_C23_VN 201711L /*! @endcond */ /*! @cond Doxygen ignores this part */ /* C-language Attributes are added in C23. */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= XXH_C23_VN) && defined(__has_c_attribute) # define XXH_HAS_C_ATTRIBUTE(x) __has_c_attribute(x) #else # define XXH_HAS_C_ATTRIBUTE(x) 0 #endif /*! @endcond */ /*! @cond Doxygen ignores this part */ #if defined(__cplusplus) && defined(__has_cpp_attribute) # define XXH_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) #else # define XXH_HAS_CPP_ATTRIBUTE(x) 0 #endif /*! @endcond */ /*! @cond Doxygen ignores this part */ /* * Define XXH_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute * introduced in CPP17 and C23. * CPP17 : https://en.cppreference.com/w/cpp/language/attributes/fallthrough * C23 : https://en.cppreference.com/w/c/language/attributes/fallthrough */ #if XXH_HAS_C_ATTRIBUTE(fallthrough) || XXH_HAS_CPP_ATTRIBUTE(fallthrough) # define XXH_FALLTHROUGH [[fallthrough]] #elif XXH_HAS_ATTRIBUTE(__fallthrough__) # define XXH_FALLTHROUGH __attribute__ ((__fallthrough__)) #else # define XXH_FALLTHROUGH /* fallthrough */ #endif /*! @endcond */ /*! @cond Doxygen ignores this part */ /* * Define XXH_NOESCAPE for annotated pointers in public API. * https://clang.llvm.org/docs/AttributeReference.html#noescape * As of writing this, only supported by clang. */ #if XXH_HAS_ATTRIBUTE(noescape) # define XXH_NOESCAPE __attribute__((noescape)) #else # define XXH_NOESCAPE #endif /*! @endcond */ /*! * @} * @ingroup public * @{ */ #ifndef XXH_NO_LONG_LONG /*-********************************************************************** * 64-bit hash ************************************************************************/ #if defined(XXH_DOXYGEN) /* don't include <stdint.h> */ /*! * @brief An unsigned 64-bit integer. * * Not necessarily defined to `uint64_t` but functionally equivalent. */ typedef uint64_t XXH64_hash_t; #elif !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) # include <stdint.h> typedef uint64_t XXH64_hash_t; #else # include <limits.h> # if defined(__LP64__) && ULONG_MAX == 0xFFFFFFFFFFFFFFFFULL /* LP64 ABI says uint64_t is unsigned long */ typedef unsigned long XXH64_hash_t; # else /* the following type must have a width of 64-bit */ typedef unsigned long long XXH64_hash_t; # endif #endif /*! * @} * * @defgroup XXH64_family XXH64 family * @ingroup public * @{ * Contains functions used in the classic 64-bit xxHash algorithm. * * @note * XXH3 provides competitive speed for both 32-bit and 64-bit systems, * and offers true 64/128 bit hash results. * It provides better speed for systems with vector processing capabilities. */ /*! * @brief Calculates the 64-bit hash of @p input using xxHash64. * * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * @param seed The 64-bit seed to alter the hash's output predictably. * * @pre * The memory between @p input and @p input + @p length must be valid, * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * @return The calculated 64-bit xxHash64 value. * * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed); /******* Streaming *******/ #ifndef XXH_NO_STREAM /*! * @brief The opaque state struct for the XXH64 streaming API. * * @see XXH64_state_s for details. * @see @ref streaming_example "Streaming Example" */ typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ /*! * @brief Allocates an @ref XXH64_state_t. * * @return An allocated pointer of @ref XXH64_state_t on success. * @return `NULL` on failure. * * @note Must be freed with XXH64_freeState(). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_MALLOCF XXH64_state_t* XXH64_createState(void); /*! * @brief Frees an @ref XXH64_state_t. * * @param statePtr A pointer to an @ref XXH64_state_t allocated with @ref XXH64_createState(). * * @return @ref XXH_OK. * * @note @p statePtr must be allocated with XXH64_createState(). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); /*! * @brief Copies one @ref XXH64_state_t to another. * * @param dst_state The state to copy to. * @param src_state The state to copy from. * @pre * @p dst_state and @p src_state must not be `NULL` and must not overlap. */ XXH_PUBLIC_API void XXH64_copyState(XXH_NOESCAPE XXH64_state_t* dst_state, const XXH64_state_t* src_state); /*! * @brief Resets an @ref XXH64_state_t to begin a new hash. * * @param statePtr The state struct to reset. * @param seed The 64-bit seed to alter the hash result predictably. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note This function resets and seeds a state. Call it before @ref XXH64_update(). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH_NOESCAPE XXH64_state_t* statePtr, XXH64_hash_t seed); /*! * @brief Consumes a block of @p input to an @ref XXH64_state_t. * * @param statePtr The state struct to update. * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * * @pre * @p statePtr must not be `NULL`. * @pre * The memory between @p input and @p input + @p length must be valid, * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note Call this to incrementally consume blocks of data. * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH_NOESCAPE XXH64_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); /*! * @brief Returns the calculated hash value from an @ref XXH64_state_t. * * @param statePtr The state struct to calculate the hash from. * * @pre * @p statePtr must not be `NULL`. * * @return The calculated 64-bit xxHash64 value from that state. * * @note * Calling XXH64_digest() will not affect @p statePtr, so you can update, * digest, and update again. * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64_digest (XXH_NOESCAPE const XXH64_state_t* statePtr); #endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ /*! * @brief Canonical (big endian) representation of @ref XXH64_hash_t. */ typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t; /*! * @brief Converts an @ref XXH64_hash_t to a big endian @ref XXH64_canonical_t. * * @param dst The @ref XXH64_canonical_t pointer to be stored to. * @param hash The @ref XXH64_hash_t to be converted. * * @pre * @p dst must not be `NULL`. * * @see @ref canonical_representation_example "Canonical Representation Example" */ XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH_NOESCAPE XXH64_canonical_t* dst, XXH64_hash_t hash); /*! * @brief Converts an @ref XXH64_canonical_t to a native @ref XXH64_hash_t. * * @param src The @ref XXH64_canonical_t to convert. * * @pre * @p src must not be `NULL`. * * @return The converted hash. * * @see @ref canonical_representation_example "Canonical Representation Example" */ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64_hashFromCanonical(XXH_NOESCAPE const XXH64_canonical_t* src); #ifndef XXH_NO_XXH3 /*! * @} * ************************************************************************ * @defgroup XXH3_family XXH3 family * @ingroup public * @{ * * XXH3 is a more recent hash algorithm featuring: * - Improved speed for both small and large inputs * - True 64-bit and 128-bit outputs * - SIMD acceleration * - Improved 32-bit viability * * Speed analysis methodology is explained here: * * https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html * * Compared to XXH64, expect XXH3 to run approximately * ~2x faster on large inputs and >3x faster on small ones, * exact differences vary depending on platform. * * XXH3's speed benefits greatly from SIMD and 64-bit arithmetic, * but does not require it. * Most 32-bit and 64-bit targets that can run XXH32 smoothly can run XXH3 * at competitive speeds, even without vector support. Further details are * explained in the implementation. * * XXH3 has a fast scalar implementation, but it also includes accelerated SIMD * implementations for many common platforms: * - AVX512 * - AVX2 * - SSE2 * - ARM NEON * - WebAssembly SIMD128 * - POWER8 VSX * - s390x ZVector * This can be controlled via the @ref XXH_VECTOR macro, but it automatically * selects the best version according to predefined macros. For the x86 family, an * automatic runtime dispatcher is included separately in @ref xxh_x86dispatch.c. * * XXH3 implementation is portable: * it has a generic C90 formulation that can be compiled on any platform, * all implementations generate exactly the same hash value on all platforms. * Starting from v0.8.0, it's also labelled "stable", meaning that * any future version will also generate the same hash value. * * XXH3 offers 2 variants, _64bits and _128bits. * * When only 64 bits are needed, prefer invoking the _64bits variant, as it * reduces the amount of mixing, resulting in faster speed on small inputs. * It's also generally simpler to manipulate a scalar return type than a struct. * * The API supports one-shot hashing, streaming mode, and custom secrets. */ /*-********************************************************************** * XXH3 64-bit variant ************************************************************************/ /*! * @brief Calculates 64-bit unseeded variant of XXH3 hash of @p input. * * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * * @pre * The memory between @p input and @p input + @p length must be valid, * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * @return The calculated 64-bit XXH3 hash value. * * @note * This is equivalent to @ref XXH3_64bits_withSeed() with a seed of `0`, however * it may have slightly better performance due to constant propagation of the * defaults. * * @see * XXH3_64bits_withSeed(), XXH3_64bits_withSecret(): other seeding variants * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits(XXH_NOESCAPE const void* input, size_t length); /*! * @brief Calculates 64-bit seeded variant of XXH3 hash of @p input. * * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * @param seed The 64-bit seed to alter the hash result predictably. * * @pre * The memory between @p input and @p input + @p length must be valid, * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * @return The calculated 64-bit XXH3 hash value. * * @note * seed == 0 produces the same results as @ref XXH3_64bits(). * * This variant generates a custom secret on the fly based on default secret * altered using the @p seed value. * * While this operation is decently fast, note that it's not completely free. * * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_withSeed(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed); /*! * The bare minimum size for a custom secret. * * @see * XXH3_64bits_withSecret(), XXH3_64bits_reset_withSecret(), * XXH3_128bits_withSecret(), XXH3_128bits_reset_withSecret(). */ #define XXH3_SECRET_SIZE_MIN 136 /*! * @brief Calculates 64-bit variant of XXH3 with a custom "secret". * * @param data The block of data to be hashed, at least @p len bytes in size. * @param len The length of @p data, in bytes. * @param secret The secret data. * @param secretSize The length of @p secret, in bytes. * * @return The calculated 64-bit XXH3 hash value. * * @pre * The memory between @p data and @p data + @p len must be valid, * readable, contiguous memory. However, if @p length is `0`, @p data may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * It's possible to provide any blob of bytes as a "secret" to generate the hash. * This makes it more difficult for an external actor to prepare an intentional collision. * The main condition is that @p secretSize *must* be large enough (>= @ref XXH3_SECRET_SIZE_MIN). * However, the quality of the secret impacts the dispersion of the hash algorithm. * Therefore, the secret _must_ look like a bunch of random bytes. * Avoid "trivial" or structured data such as repeated sequences or a text document. * Whenever in doubt about the "randomness" of the blob of bytes, * consider employing @ref XXH3_generateSecret() instead (see below). * It will generate a proper high entropy secret derived from the blob of bytes. * Another advantage of using XXH3_generateSecret() is that * it guarantees that all bits within the initial blob of bytes * will impact every bit of the output. * This is not necessarily the case when using the blob of bytes directly * because, when hashing _small_ inputs, only a portion of the secret is employed. * * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_withSecret(XXH_NOESCAPE const void* data, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize); /******* Streaming *******/ #ifndef XXH_NO_STREAM /* * Streaming requires state maintenance. * This operation costs memory and CPU. * As a consequence, streaming is slower than one-shot hashing. * For better performance, prefer one-shot functions whenever applicable. */ /*! * @brief The opaque state struct for the XXH3 streaming API. * * @see XXH3_state_s for details. * @see @ref streaming_example "Streaming Example" */ typedef struct XXH3_state_s XXH3_state_t; XXH_PUBLIC_API XXH_MALLOCF XXH3_state_t* XXH3_createState(void); XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr); /*! * @brief Copies one @ref XXH3_state_t to another. * * @param dst_state The state to copy to. * @param src_state The state to copy from. * @pre * @p dst_state and @p src_state must not be `NULL` and must not overlap. */ XXH_PUBLIC_API void XXH3_copyState(XXH_NOESCAPE XXH3_state_t* dst_state, XXH_NOESCAPE const XXH3_state_t* src_state); /*! * @brief Resets an @ref XXH3_state_t to begin a new hash. * * @param statePtr The state struct to reset. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note * - This function resets `statePtr` and generate a secret with default parameters. * - Call this function before @ref XXH3_64bits_update(). * - Digest will be equivalent to `XXH3_64bits()`. * * @see @ref streaming_example "Streaming Example" * */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr); /*! * @brief Resets an @ref XXH3_state_t with 64-bit seed to begin a new hash. * * @param statePtr The state struct to reset. * @param seed The 64-bit seed to alter the hash result predictably. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note * - This function resets `statePtr` and generate a secret from `seed`. * - Call this function before @ref XXH3_64bits_update(). * - Digest will be equivalent to `XXH3_64bits_withSeed()`. * * @see @ref streaming_example "Streaming Example" * */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed); /*! * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. * * @param statePtr The state struct to reset. * @param secret The secret data. * @param secretSize The length of @p secret, in bytes. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note * `secret` is referenced, it _must outlive_ the hash streaming session. * * Similar to one-shot API, `secretSize` must be >= @ref XXH3_SECRET_SIZE_MIN, * and the quality of produced hash values depends on secret's entropy * (secret's content should look like a bunch of random bytes). * When in doubt about the randomness of a candidate `secret`, * consider employing `XXH3_generateSecret()` instead (see below). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize); /*! * @brief Consumes a block of @p input to an @ref XXH3_state_t. * * @param statePtr The state struct to update. * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * * @pre * @p statePtr must not be `NULL`. * @pre * The memory between @p input and @p input + @p length must be valid, * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note Call this to incrementally consume blocks of data. * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); /*! * @brief Returns the calculated XXH3 64-bit hash value from an @ref XXH3_state_t. * * @param statePtr The state struct to calculate the hash from. * * @pre * @p statePtr must not be `NULL`. * * @return The calculated XXH3 64-bit hash value from that state. * * @note * Calling XXH3_64bits_digest() will not affect @p statePtr, so you can update, * digest, and update again. * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_digest (XXH_NOESCAPE const XXH3_state_t* statePtr); #endif /* !XXH_NO_STREAM */ /* note : canonical representation of XXH3 is the same as XXH64 * since they both produce XXH64_hash_t values */ /*-********************************************************************** * XXH3 128-bit variant ************************************************************************/ /*! * @brief The return value from 128-bit hashes. * * Stored in little endian order, although the fields themselves are in native * endianness. */ typedef struct { XXH64_hash_t low64; /*!< `value & 0xFFFFFFFFFFFFFFFF` */ XXH64_hash_t high64; /*!< `value >> 64` */ } XXH128_hash_t; /*! * @brief Calculates 128-bit unseeded variant of XXH3 of @p data. * * @param data The block of data to be hashed, at least @p length bytes in size. * @param len The length of @p data, in bytes. * * @return The calculated 128-bit variant of XXH3 value. * * The 128-bit variant of XXH3 has more strength, but it has a bit of overhead * for shorter inputs. * * This is equivalent to @ref XXH3_128bits_withSeed() with a seed of `0`, however * it may have slightly better performance due to constant propagation of the * defaults. * * @see XXH3_128bits_withSeed(), XXH3_128bits_withSecret(): other seeding variants * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits(XXH_NOESCAPE const void* data, size_t len); /*! @brief Calculates 128-bit seeded variant of XXH3 hash of @p data. * * @param data The block of data to be hashed, at least @p length bytes in size. * @param len The length of @p data, in bytes. * @param seed The 64-bit seed to alter the hash result predictably. * * @return The calculated 128-bit variant of XXH3 value. * * @note * seed == 0 produces the same results as @ref XXH3_64bits(). * * This variant generates a custom secret on the fly based on default secret * altered using the @p seed value. * * While this operation is decently fast, note that it's not completely free. * * @see XXH3_128bits(), XXH3_128bits_withSecret(): other seeding variants * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_withSeed(XXH_NOESCAPE const void* data, size_t len, XXH64_hash_t seed); /*! * @brief Calculates 128-bit variant of XXH3 with a custom "secret". * * @param data The block of data to be hashed, at least @p len bytes in size. * @param len The length of @p data, in bytes. * @param secret The secret data. * @param secretSize The length of @p secret, in bytes. * * @return The calculated 128-bit variant of XXH3 value. * * It's possible to provide any blob of bytes as a "secret" to generate the hash. * This makes it more difficult for an external actor to prepare an intentional collision. * The main condition is that @p secretSize *must* be large enough (>= @ref XXH3_SECRET_SIZE_MIN). * However, the quality of the secret impacts the dispersion of the hash algorithm. * Therefore, the secret _must_ look like a bunch of random bytes. * Avoid "trivial" or structured data such as repeated sequences or a text document. * Whenever in doubt about the "randomness" of the blob of bytes, * consider employing @ref XXH3_generateSecret() instead (see below). * It will generate a proper high entropy secret derived from the blob of bytes. * Another advantage of using XXH3_generateSecret() is that * it guarantees that all bits within the initial blob of bytes * will impact every bit of the output. * This is not necessarily the case when using the blob of bytes directly * because, when hashing _small_ inputs, only a portion of the secret is employed. * * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_withSecret(XXH_NOESCAPE const void* data, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize); /******* Streaming *******/ #ifndef XXH_NO_STREAM /* * Streaming requires state maintenance. * This operation costs memory and CPU. * As a consequence, streaming is slower than one-shot hashing. * For better performance, prefer one-shot functions whenever applicable. * * XXH3_128bits uses the same XXH3_state_t as XXH3_64bits(). * Use already declared XXH3_createState() and XXH3_freeState(). * * All reset and streaming functions have same meaning as their 64-bit counterpart. */ /*! * @brief Resets an @ref XXH3_state_t to begin a new hash. * * @param statePtr The state struct to reset. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note * - This function resets `statePtr` and generate a secret with default parameters. * - Call it before @ref XXH3_128bits_update(). * - Digest will be equivalent to `XXH3_128bits()`. * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr); /*! * @brief Resets an @ref XXH3_state_t with 64-bit seed to begin a new hash. * * @param statePtr The state struct to reset. * @param seed The 64-bit seed to alter the hash result predictably. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note * - This function resets `statePtr` and generate a secret from `seed`. * - Call it before @ref XXH3_128bits_update(). * - Digest will be equivalent to `XXH3_128bits_withSeed()`. * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed); /*! * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. * * @param statePtr The state struct to reset. * @param secret The secret data. * @param secretSize The length of @p secret, in bytes. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * `secret` is referenced, it _must outlive_ the hash streaming session. * Similar to one-shot API, `secretSize` must be >= @ref XXH3_SECRET_SIZE_MIN, * and the quality of produced hash values depends on secret's entropy * (secret's content should look like a bunch of random bytes). * When in doubt about the randomness of a candidate `secret`, * consider employing `XXH3_generateSecret()` instead (see below). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize); /*! * @brief Consumes a block of @p input to an @ref XXH3_state_t. * * Call this to incrementally consume blocks of data. * * @param statePtr The state struct to update. * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * * @pre * @p statePtr must not be `NULL`. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @note * The memory between @p input and @p input + @p length must be valid, * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); /*! * @brief Returns the calculated XXH3 128-bit hash value from an @ref XXH3_state_t. * * @param statePtr The state struct to calculate the hash from. * * @pre * @p statePtr must not be `NULL`. * * @return The calculated XXH3 128-bit hash value from that state. * * @note * Calling XXH3_128bits_digest() will not affect @p statePtr, so you can update, * digest, and update again. * */ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_digest (XXH_NOESCAPE const XXH3_state_t* statePtr); #endif /* !XXH_NO_STREAM */ /* Following helper functions make it possible to compare XXH128_hast_t values. * Since XXH128_hash_t is a structure, this capability is not offered by the language. * Note: For better performance, these functions can be inlined using XXH_INLINE_ALL */ /*! * @brief Check equality of two XXH128_hash_t values * * @param h1 The 128-bit hash value. * @param h2 Another 128-bit hash value. * * @return `1` if `h1` and `h2` are equal. * @return `0` if they are not. */ XXH_PUBLIC_API XXH_PUREF int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); /*! * @brief Compares two @ref XXH128_hash_t * * This comparator is compatible with stdlib's `qsort()`/`bsearch()`. * * @param h128_1 Left-hand side value * @param h128_2 Right-hand side value * * @return >0 if @p h128_1 > @p h128_2 * @return =0 if @p h128_1 == @p h128_2 * @return <0 if @p h128_1 < @p h128_2 */ XXH_PUBLIC_API XXH_PUREF int XXH128_cmp(XXH_NOESCAPE const void* h128_1, XXH_NOESCAPE const void* h128_2); /******* Canonical representation *******/ typedef struct { unsigned char digest[sizeof(XXH128_hash_t)]; } XXH128_canonical_t; /*! * @brief Converts an @ref XXH128_hash_t to a big endian @ref XXH128_canonical_t. * * @param dst The @ref XXH128_canonical_t pointer to be stored to. * @param hash The @ref XXH128_hash_t to be converted. * * @pre * @p dst must not be `NULL`. * @see @ref canonical_representation_example "Canonical Representation Example" */ XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH_NOESCAPE XXH128_canonical_t* dst, XXH128_hash_t hash); /*! * @brief Converts an @ref XXH128_canonical_t to a native @ref XXH128_hash_t. * * @param src The @ref XXH128_canonical_t to convert. * * @pre * @p src must not be `NULL`. * * @return The converted hash. * @see @ref canonical_representation_example "Canonical Representation Example" */ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH128_hashFromCanonical(XXH_NOESCAPE const XXH128_canonical_t* src); #endif /* !XXH_NO_XXH3 */ #endif /* XXH_NO_LONG_LONG */ /*! * @} */ #endif /* XXHASH_H_5627135585666179 */ #if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) #define XXHASH_H_STATIC_13879238742 /* **************************************************************************** * This section contains declarations which are not guaranteed to remain stable. * They may change in future versions, becoming incompatible with a different * version of the library. * These declarations should only be used with static linking. * Never use them in association with dynamic linking! ***************************************************************************** */ /* * These definitions are only present to allow static allocation * of XXH states, on stack or in a struct, for example. * Never **ever** access their members directly. */ /*! * @internal * @brief Structure for XXH32 streaming API. * * @note This is only defined when @ref XXH_STATIC_LINKING_ONLY, * @ref XXH_INLINE_ALL, or @ref XXH_IMPLEMENTATION is defined. Otherwise it is * an opaque type. This allows fields to safely be changed. * * Typedef'd to @ref XXH32_state_t. * Do not access the members of this struct directly. * @see XXH64_state_s, XXH3_state_s */ struct XXH32_state_s { XXH32_hash_t total_len_32; /*!< Total length hashed, modulo 2^32 */ XXH32_hash_t large_len; /*!< Whether the hash is >= 16 (handles @ref total_len_32 overflow) */ XXH32_hash_t v[4]; /*!< Accumulator lanes */ XXH32_hash_t mem32[4]; /*!< Internal buffer for partial reads. Treated as unsigned char[16]. */ XXH32_hash_t memsize; /*!< Amount of data in @ref mem32 */ XXH32_hash_t reserved; /*!< Reserved field. Do not read nor write to it. */ }; /* typedef'd to XXH32_state_t */ #ifndef XXH_NO_LONG_LONG /* defined when there is no 64-bit support */ /*! * @internal * @brief Structure for XXH64 streaming API. * * @note This is only defined when @ref XXH_STATIC_LINKING_ONLY, * @ref XXH_INLINE_ALL, or @ref XXH_IMPLEMENTATION is defined. Otherwise it is * an opaque type. This allows fields to safely be changed. * * Typedef'd to @ref XXH64_state_t. * Do not access the members of this struct directly. * @see XXH32_state_s, XXH3_state_s */ struct XXH64_state_s { XXH64_hash_t total_len; /*!< Total length hashed. This is always 64-bit. */ XXH64_hash_t v[4]; /*!< Accumulator lanes */ XXH64_hash_t mem64[4]; /*!< Internal buffer for partial reads. Treated as unsigned char[32]. */ XXH32_hash_t memsize; /*!< Amount of data in @ref mem64 */ XXH32_hash_t reserved32; /*!< Reserved field, needed for padding anyways*/ XXH64_hash_t reserved64; /*!< Reserved field. Do not read or write to it. */ }; /* typedef'd to XXH64_state_t */ #ifndef XXH_NO_XXH3 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* >= C11 */ # include <stdalign.h> # define XXH_ALIGN(n) alignas(n) #elif defined(__cplusplus) && (__cplusplus >= 201103L) /* >= C++11 */ /* In C++ alignas() is a keyword */ # define XXH_ALIGN(n) alignas(n) #elif defined(__GNUC__) # define XXH_ALIGN(n) __attribute__ ((aligned(n))) #elif defined(_MSC_VER) # define XXH_ALIGN(n) __declspec(align(n)) #else # define XXH_ALIGN(n) /* disabled */ #endif /* Old GCC versions only accept the attribute after the type in structures. */ #if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) /* C11+ */ \ && ! (defined(__cplusplus) && (__cplusplus >= 201103L)) /* >= C++11 */ \ && defined(__GNUC__) # define XXH_ALIGN_MEMBER(align, type) type XXH_ALIGN(align) #else # define XXH_ALIGN_MEMBER(align, type) XXH_ALIGN(align) type #endif /*! * @brief The size of the internal XXH3 buffer. * * This is the optimal update size for incremental hashing. * * @see XXH3_64b_update(), XXH3_128b_update(). */ #define XXH3_INTERNALBUFFER_SIZE 256 /*! * @internal * @brief Default size of the secret buffer (and @ref XXH3_kSecret). * * This is the size used in @ref XXH3_kSecret and the seeded functions. * * Not to be confused with @ref XXH3_SECRET_SIZE_MIN. */ #define XXH3_SECRET_DEFAULT_SIZE 192 /*! * @internal * @brief Structure for XXH3 streaming API. * * @note This is only defined when @ref XXH_STATIC_LINKING_ONLY, * @ref XXH_INLINE_ALL, or @ref XXH_IMPLEMENTATION is defined. * Otherwise it is an opaque type. * Never use this definition in combination with dynamic library. * This allows fields to safely be changed in the future. * * @note ** This structure has a strict alignment requirement of 64 bytes!! ** * Do not allocate this with `malloc()` or `new`, * it will not be sufficiently aligned. * Use @ref XXH3_createState() and @ref XXH3_freeState(), or stack allocation. * * Typedef'd to @ref XXH3_state_t. * Do never access the members of this struct directly. * * @see XXH3_INITSTATE() for stack initialization. * @see XXH3_createState(), XXH3_freeState(). * @see XXH32_state_s, XXH64_state_s */ struct XXH3_state_s { XXH_ALIGN_MEMBER(64, XXH64_hash_t acc[8]); /*!< The 8 accumulators. See @ref XXH32_state_s::v and @ref XXH64_state_s::v */ XXH_ALIGN_MEMBER(64, unsigned char customSecret[XXH3_SECRET_DEFAULT_SIZE]); /*!< Used to store a custom secret generated from a seed. */ XXH_ALIGN_MEMBER(64, unsigned char buffer[XXH3_INTERNALBUFFER_SIZE]); /*!< The internal buffer. @see XXH32_state_s::mem32 */ XXH32_hash_t bufferedSize; /*!< The amount of memory in @ref buffer, @see XXH32_state_s::memsize */ XXH32_hash_t useSeed; /*!< Reserved field. Needed for padding on 64-bit. */ size_t nbStripesSoFar; /*!< Number or stripes processed. */ XXH64_hash_t totalLen; /*!< Total length hashed. 64-bit even on 32-bit targets. */ size_t nbStripesPerBlock; /*!< Number of stripes per block. */ size_t secretLimit; /*!< Size of @ref customSecret or @ref extSecret */ XXH64_hash_t seed; /*!< Seed for _withSeed variants. Must be zero otherwise, @see XXH3_INITSTATE() */ XXH64_hash_t reserved64; /*!< Reserved field. */ const unsigned char* extSecret; /*!< Reference to an external secret for the _withSecret variants, NULL * for other variants. */ /* note: there may be some padding at the end due to alignment on 64 bytes */ }; /* typedef'd to XXH3_state_t */ #undef XXH_ALIGN_MEMBER /*! * @brief Initializes a stack-allocated `XXH3_state_s`. * * When the @ref XXH3_state_t structure is merely emplaced on stack, * it should be initialized with XXH3_INITSTATE() or a memset() * in case its first reset uses XXH3_NNbits_reset_withSeed(). * This init can be omitted if the first reset uses default or _withSecret mode. * This operation isn't necessary when the state is created with XXH3_createState(). * Note that this doesn't prepare the state for a streaming operation, * it's still necessary to use XXH3_NNbits_reset*() afterwards. */ #define XXH3_INITSTATE(XXH3_state_ptr) \ do { \ XXH3_state_t* tmp_xxh3_state_ptr = (XXH3_state_ptr); \ tmp_xxh3_state_ptr->seed = 0; \ tmp_xxh3_state_ptr->extSecret = NULL; \ } while(0) /*! * @brief Calculates the 128-bit hash of @p data using XXH3. * * @param data The block of data to be hashed, at least @p len bytes in size. * @param len The length of @p data, in bytes. * @param seed The 64-bit seed to alter the hash's output predictably. * * @pre * The memory between @p data and @p data + @p len must be valid, * readable, contiguous memory. However, if @p len is `0`, @p data may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * * @return The calculated 128-bit XXH3 value. * * @see @ref single_shot_example "Single Shot Example" for an example. */ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH128(XXH_NOESCAPE const void* data, size_t len, XXH64_hash_t seed); /* === Experimental API === */ /* Symbols defined below must be considered tied to a specific library version. */ /*! * @brief Derive a high-entropy secret from any user-defined content, named customSeed. * * @param secretBuffer A writable buffer for derived high-entropy secret data. * @param secretSize Size of secretBuffer, in bytes. Must be >= XXH3_SECRET_DEFAULT_SIZE. * @param customSeed A user-defined content. * @param customSeedSize Size of customSeed, in bytes. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * The generated secret can be used in combination with `*_withSecret()` functions. * The `_withSecret()` variants are useful to provide a higher level of protection * than 64-bit seed, as it becomes much more difficult for an external actor to * guess how to impact the calculation logic. * * The function accepts as input a custom seed of any length and any content, * and derives from it a high-entropy secret of length @p secretSize into an * already allocated buffer @p secretBuffer. * * The generated secret can then be used with any `*_withSecret()` variant. * The functions @ref XXH3_128bits_withSecret(), @ref XXH3_64bits_withSecret(), * @ref XXH3_128bits_reset_withSecret() and @ref XXH3_64bits_reset_withSecret() * are part of this list. They all accept a `secret` parameter * which must be large enough for implementation reasons (>= @ref XXH3_SECRET_SIZE_MIN) * _and_ feature very high entropy (consist of random-looking bytes). * These conditions can be a high bar to meet, so @ref XXH3_generateSecret() can * be employed to ensure proper quality. * * @p customSeed can be anything. It can have any size, even small ones, * and its content can be anything, even "poor entropy" sources such as a bunch * of zeroes. The resulting `secret` will nonetheless provide all required qualities. * * @pre * - @p secretSize must be >= @ref XXH3_SECRET_SIZE_MIN * - When @p customSeedSize > 0, supplying NULL as customSeed is undefined behavior. * * Example code: * @code{.c} * #include <stdio.h> * #include <stdlib.h> * #include <string.h> * #define XXH_STATIC_LINKING_ONLY // expose unstable API * #include "xxhash.h" * // Hashes argv[2] using the entropy from argv[1]. * int main(int argc, char* argv[]) * { * char secret[XXH3_SECRET_SIZE_MIN]; * if (argv != 3) { return 1; } * XXH3_generateSecret(secret, sizeof(secret), argv[1], strlen(argv[1])); * XXH64_hash_t h = XXH3_64bits_withSecret( * argv[2], strlen(argv[2]), * secret, sizeof(secret) * ); * printf("%016llx\n", (unsigned long long) h); * } * @endcode */ XXH_PUBLIC_API XXH_errorcode XXH3_generateSecret(XXH_NOESCAPE void* secretBuffer, size_t secretSize, XXH_NOESCAPE const void* customSeed, size_t customSeedSize); /*! * @brief Generate the same secret as the _withSeed() variants. * * @param secretBuffer A writable buffer of @ref XXH3_SECRET_SIZE_MIN bytes * @param seed The 64-bit seed to alter the hash result predictably. * * The generated secret can be used in combination with *`*_withSecret()` and `_withSecretandSeed()` variants. * * Example C++ `std::string` hash class: * @code{.cpp} * #include <string> * #define XXH_STATIC_LINKING_ONLY // expose unstable API * #include "xxhash.h" * // Slow, seeds each time * class HashSlow { * XXH64_hash_t seed; * public: * HashSlow(XXH64_hash_t s) : seed{s} {} * size_t operator()(const std::string& x) const { * return size_t{XXH3_64bits_withSeed(x.c_str(), x.length(), seed)}; * } * }; * // Fast, caches the seeded secret for future uses. * class HashFast { * unsigned char secret[XXH3_SECRET_SIZE_MIN]; * public: * HashFast(XXH64_hash_t s) { * XXH3_generateSecret_fromSeed(secret, seed); * } * size_t operator()(const std::string& x) const { * return size_t{ * XXH3_64bits_withSecret(x.c_str(), x.length(), secret, sizeof(secret)) * }; * } * }; * @endcode */ XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed); /*! * @brief Calculates 64/128-bit seeded variant of XXH3 hash of @p data. * * @param data The block of data to be hashed, at least @p len bytes in size. * @param len The length of @p data, in bytes. * @param secret The secret data. * @param secretSize The length of @p secret, in bytes. * @param seed The 64-bit seed to alter the hash result predictably. * * These variants generate hash values using either * @p seed for "short" keys (< @ref XXH3_MIDSIZE_MAX = 240 bytes) * or @p secret for "large" keys (>= @ref XXH3_MIDSIZE_MAX). * * This generally benefits speed, compared to `_withSeed()` or `_withSecret()`. * `_withSeed()` has to generate the secret on the fly for "large" keys. * It's fast, but can be perceptible for "not so large" keys (< 1 KB). * `_withSecret()` has to generate the masks on the fly for "small" keys, * which requires more instructions than _withSeed() variants. * Therefore, _withSecretandSeed variant combines the best of both worlds. * * When @p secret has been generated by XXH3_generateSecret_fromSeed(), * this variant produces *exactly* the same results as `_withSeed()` variant, * hence offering only a pure speed benefit on "large" input, * by skipping the need to regenerate the secret for every large input. * * Another usage scenario is to hash the secret to a 64-bit hash value, * for example with XXH3_64bits(), which then becomes the seed, * and then employ both the seed and the secret in _withSecretandSeed(). * On top of speed, an added benefit is that each bit in the secret * has a 50% chance to swap each bit in the output, via its impact to the seed. * * This is not guaranteed when using the secret directly in "small data" scenarios, * because only portions of the secret are employed for small data. */ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_withSecretandSeed(XXH_NOESCAPE const void* data, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed); /*! * @brief Calculates 128-bit seeded variant of XXH3 hash of @p data. * * @param input The block of data to be hashed, at least @p len bytes in size. * @param length The length of @p data, in bytes. * @param secret The secret data. * @param secretSize The length of @p secret, in bytes. * @param seed64 The 64-bit seed to alter the hash result predictably. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @see XXH3_64bits_withSecretandSeed() */ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t length, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); #ifndef XXH_NO_STREAM /*! * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. * * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). * @param secret The secret data. * @param secretSize The length of @p secret, in bytes. * @param seed64 The 64-bit seed to alter the hash result predictably. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @see XXH3_64bits_withSecretandSeed() */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); /*! * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. * * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). * @param secret The secret data. * @param secretSize The length of @p secret, in bytes. * @param seed64 The 64-bit seed to alter the hash result predictably. * * @return @ref XXH_OK on success. * @return @ref XXH_ERROR on failure. * * @see XXH3_64bits_withSecretandSeed() */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); #endif /* !XXH_NO_STREAM */ #endif /* !XXH_NO_XXH3 */ #endif /* XXH_NO_LONG_LONG */ #if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) # define XXH_IMPLEMENTATION #endif #endif /* defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) */ /* ======================================================================== */ /* ======================================================================== */ /* ======================================================================== */ /*-********************************************************************** * xxHash implementation *-********************************************************************** * xxHash's implementation used to be hosted inside xxhash.c. * * However, inlining requires implementation to be visible to the compiler, * hence be included alongside the header. * Previously, implementation was hosted inside xxhash.c, * which was then #included when inlining was activated. * This construction created issues with a few build and install systems, * as it required xxhash.c to be stored in /include directory. * * xxHash implementation is now directly integrated within xxhash.h. * As a consequence, xxhash.c is no longer needed in /include. * * xxhash.c is still available and is still useful. * In a "normal" setup, when xxhash is not inlined, * xxhash.h only exposes the prototypes and public symbols, * while xxhash.c can be built into an object file xxhash.o * which can then be linked into the final binary. ************************************************************************/ #if ( defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) \ || defined(XXH_IMPLEMENTATION) ) && !defined(XXH_IMPLEM_13a8737387) # define XXH_IMPLEM_13a8737387 /* ************************************* * Tuning parameters ***************************************/ /*! * @defgroup tuning Tuning parameters * @{ * * Various macros to control xxHash's behavior. */ #ifdef XXH_DOXYGEN /*! * @brief Define this to disable 64-bit code. * * Useful if only using the @ref XXH32_family and you have a strict C90 compiler. */ # define XXH_NO_LONG_LONG # undef XXH_NO_LONG_LONG /* don't actually */ /*! * @brief Controls how unaligned memory is accessed. * * By default, access to unaligned memory is controlled by `memcpy()`, which is * safe and portable. * * Unfortunately, on some target/compiler combinations, the generated assembly * is sub-optimal. * * The below switch allow selection of a different access method * in the search for improved performance. * * @par Possible options: * * - `XXH_FORCE_MEMORY_ACCESS=0` (default): `memcpy` * @par * Use `memcpy()`. Safe and portable. Note that most modern compilers will * eliminate the function call and treat it as an unaligned access. * * - `XXH_FORCE_MEMORY_ACCESS=1`: `__attribute__((aligned(1)))` * @par * Depends on compiler extensions and is therefore not portable. * This method is safe _if_ your compiler supports it, * and *generally* as fast or faster than `memcpy`. * * - `XXH_FORCE_MEMORY_ACCESS=2`: Direct cast * @par * Casts directly and dereferences. This method doesn't depend on the * compiler, but it violates the C standard as it directly dereferences an * unaligned pointer. It can generate buggy code on targets which do not * support unaligned memory accesses, but in some circumstances, it's the * only known way to get the most performance. * * - `XXH_FORCE_MEMORY_ACCESS=3`: Byteshift * @par * Also portable. This can generate the best code on old compilers which don't * inline small `memcpy()` calls, and it might also be faster on big-endian * systems which lack a native byteswap instruction. However, some compilers * will emit literal byteshifts even if the target supports unaligned access. * * * @warning * Methods 1 and 2 rely on implementation-defined behavior. Use these with * care, as what works on one compiler/platform/optimization level may cause * another to read garbage data or even crash. * * See https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html for details. * * Prefer these methods in priority order (0 > 3 > 1 > 2) */ # define XXH_FORCE_MEMORY_ACCESS 0 /*! * @def XXH_SIZE_OPT * @brief Controls how much xxHash optimizes for size. * * xxHash, when compiled, tends to result in a rather large binary size. This * is mostly due to heavy usage to forced inlining and constant folding of the * @ref XXH3_family to increase performance. * * However, some developers prefer size over speed. This option can * significantly reduce the size of the generated code. When using the `-Os` * or `-Oz` options on GCC or Clang, this is defined to 1 by default, * otherwise it is defined to 0. * * Most of these size optimizations can be controlled manually. * * This is a number from 0-2. * - `XXH_SIZE_OPT` == 0: Default. xxHash makes no size optimizations. Speed * comes first. * - `XXH_SIZE_OPT` == 1: Default for `-Os` and `-Oz`. xxHash is more * conservative and disables hacks that increase code size. It implies the * options @ref XXH_NO_INLINE_HINTS == 1, @ref XXH_FORCE_ALIGN_CHECK == 0, * and @ref XXH3_NEON_LANES == 8 if they are not already defined. * - `XXH_SIZE_OPT` == 2: xxHash tries to make itself as small as possible. * Performance may cry. For example, the single shot functions just use the * streaming API. */ # define XXH_SIZE_OPT 0 /*! * @def XXH_FORCE_ALIGN_CHECK * @brief If defined to non-zero, adds a special path for aligned inputs (XXH32() * and XXH64() only). * * This is an important performance trick for architectures without decent * unaligned memory access performance. * * It checks for input alignment, and when conditions are met, uses a "fast * path" employing direct 32-bit/64-bit reads, resulting in _dramatically * faster_ read speed. * * The check costs one initial branch per hash, which is generally negligible, * but not zero. * * Moreover, it's not useful to generate an additional code path if memory * access uses the same instruction for both aligned and unaligned * addresses (e.g. x86 and aarch64). * * In these cases, the alignment check can be removed by setting this macro to 0. * Then the code will always use unaligned memory access. * Align check is automatically disabled on x86, x64, ARM64, and some ARM chips * which are platforms known to offer good unaligned memory accesses performance. * * It is also disabled by default when @ref XXH_SIZE_OPT >= 1. * * This option does not affect XXH3 (only XXH32 and XXH64). */ # define XXH_FORCE_ALIGN_CHECK 0 /*! * @def XXH_NO_INLINE_HINTS * @brief When non-zero, sets all functions to `static`. * * By default, xxHash tries to force the compiler to inline almost all internal * functions. * * This can usually improve performance due to reduced jumping and improved * constant folding, but significantly increases the size of the binary which * might not be favorable. * * Additionally, sometimes the forced inlining can be detrimental to performance, * depending on the architecture. * * XXH_NO_INLINE_HINTS marks all internal functions as static, giving the * compiler full control on whether to inline or not. * * When not optimizing (-O0), using `-fno-inline` with GCC or Clang, or if * @ref XXH_SIZE_OPT >= 1, this will automatically be defined. */ # define XXH_NO_INLINE_HINTS 0 /*! * @def XXH3_INLINE_SECRET * @brief Determines whether to inline the XXH3 withSecret code. * * When the secret size is known, the compiler can improve the performance * of XXH3_64bits_withSecret() and XXH3_128bits_withSecret(). * * However, if the secret size is not known, it doesn't have any benefit. This * happens when xxHash is compiled into a global symbol. Therefore, if * @ref XXH_INLINE_ALL is *not* defined, this will be defined to 0. * * Additionally, this defaults to 0 on GCC 12+, which has an issue with function pointers * that are *sometimes* force inline on -Og, and it is impossible to automatically * detect this optimization level. */ # define XXH3_INLINE_SECRET 0 /*! * @def XXH32_ENDJMP * @brief Whether to use a jump for `XXH32_finalize`. * * For performance, `XXH32_finalize` uses multiple branches in the finalizer. * This is generally preferable for performance, * but depending on exact architecture, a jmp may be preferable. * * This setting is only possibly making a difference for very small inputs. */ # define XXH32_ENDJMP 0 /*! * @internal * @brief Redefines old internal names. * * For compatibility with code that uses xxHash's internals before the names * were changed to improve namespacing. There is no other reason to use this. */ # define XXH_OLD_NAMES # undef XXH_OLD_NAMES /* don't actually use, it is ugly. */ /*! * @def XXH_NO_STREAM * @brief Disables the streaming API. * * When xxHash is not inlined and the streaming functions are not used, disabling * the streaming functions can improve code size significantly, especially with * the @ref XXH3_family which tends to make constant folded copies of itself. */ # define XXH_NO_STREAM # undef XXH_NO_STREAM /* don't actually */ #endif /* XXH_DOXYGEN */ /*! * @} */ #ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ /* prefer __packed__ structures (method 1) for GCC * < ARMv7 with unaligned access (e.g. Raspbian armhf) still uses byte shifting, so we use memcpy * which for some reason does unaligned loads. */ # if defined(__GNUC__) && !(defined(__ARM_ARCH) && __ARM_ARCH < 7 && defined(__ARM_FEATURE_UNALIGNED)) # define XXH_FORCE_MEMORY_ACCESS 1 # endif #endif #ifndef XXH_SIZE_OPT /* default to 1 for -Os or -Oz */ # if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE_SIZE__) # define XXH_SIZE_OPT 1 # else # define XXH_SIZE_OPT 0 # endif #endif #ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ /* don't check on sizeopt, x86, aarch64, or arm when unaligned access is available */ # if XXH_SIZE_OPT >= 1 || \ defined(__i386) || defined(__x86_64__) || defined(__aarch64__) || defined(__ARM_FEATURE_UNALIGNED) \ || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) || defined(_M_ARM) /* visual */ # define XXH_FORCE_ALIGN_CHECK 0 # else # define XXH_FORCE_ALIGN_CHECK 1 # endif #endif #ifndef XXH_NO_INLINE_HINTS # if XXH_SIZE_OPT >= 1 || defined(__NO_INLINE__) /* -O0, -fno-inline */ # define XXH_NO_INLINE_HINTS 1 # else # define XXH_NO_INLINE_HINTS 0 # endif #endif #ifndef XXH3_INLINE_SECRET # if (defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12) \ || !defined(XXH_INLINE_ALL) # define XXH3_INLINE_SECRET 0 # else # define XXH3_INLINE_SECRET 1 # endif #endif #ifndef XXH32_ENDJMP /* generally preferable for performance */ # define XXH32_ENDJMP 0 #endif /*! * @defgroup impl Implementation * @{ */ /* ************************************* * Includes & Memory related functions ***************************************/ #if defined(XXH_NO_STREAM) /* nothing */ #elif defined(XXH_NO_STDLIB) /* When requesting to disable any mention of stdlib, * the library loses the ability to invoked malloc / free. * In practice, it means that functions like `XXH*_createState()` * will always fail, and return NULL. * This flag is useful in situations where * xxhash.h is integrated into some kernel, embedded or limited environment * without access to dynamic allocation. */ static XXH_CONSTF void* XXH_malloc(size_t s) { (void)s; return NULL; } static void XXH_free(void* p) { (void)p; } #else /* * Modify the local functions below should you wish to use * different memory routines for malloc() and free() */ #include <stdlib.h> /*! * @internal * @brief Modify this function to use a different routine than malloc(). */ static XXH_MALLOCF void* XXH_malloc(size_t s) { return malloc(s); } /*! * @internal * @brief Modify this function to use a different routine than free(). */ static void XXH_free(void* p) { free(p); } #endif /* XXH_NO_STDLIB */ #include <string.h> /*! * @internal * @brief Modify this function to use a different routine than memcpy(). */ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } #include <limits.h> /* ULLONG_MAX */ /* ************************************* * Compiler Specific Options ***************************************/ #ifdef _MSC_VER /* Visual Studio warning fix */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ #endif #if XXH_NO_INLINE_HINTS /* disable inlining hints */ # if defined(__GNUC__) || defined(__clang__) # define XXH_FORCE_INLINE static __attribute__((unused)) # else # define XXH_FORCE_INLINE static # endif # define XXH_NO_INLINE static /* enable inlining hints */ #elif defined(__GNUC__) || defined(__clang__) # define XXH_FORCE_INLINE static __inline__ __attribute__((always_inline, unused)) # define XXH_NO_INLINE static __attribute__((noinline)) #elif defined(_MSC_VER) /* Visual Studio */ # define XXH_FORCE_INLINE static __forceinline # define XXH_NO_INLINE static __declspec(noinline) #elif defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* C99 */ # define XXH_FORCE_INLINE static inline # define XXH_NO_INLINE static #else # define XXH_FORCE_INLINE static # define XXH_NO_INLINE static #endif #if XXH3_INLINE_SECRET # define XXH3_WITH_SECRET_INLINE XXH_FORCE_INLINE #else # define XXH3_WITH_SECRET_INLINE XXH_NO_INLINE #endif /* ************************************* * Debug ***************************************/ /*! * @ingroup tuning * @def XXH_DEBUGLEVEL * @brief Sets the debugging level. * * XXH_DEBUGLEVEL is expected to be defined externally, typically via the * compiler's command line options. The value must be a number. */ #ifndef XXH_DEBUGLEVEL # ifdef DEBUGLEVEL /* backwards compat */ # define XXH_DEBUGLEVEL DEBUGLEVEL # else # define XXH_DEBUGLEVEL 0 # endif #endif #if (XXH_DEBUGLEVEL>=1) # include <assert.h> /* note: can still be disabled with NDEBUG */ # define XXH_ASSERT(c) assert(c) #else # if defined(__INTEL_COMPILER) # define XXH_ASSERT(c) XXH_ASSUME((unsigned char) (c)) # else # define XXH_ASSERT(c) XXH_ASSUME(c) # endif #endif /* note: use after variable declarations */ #ifndef XXH_STATIC_ASSERT # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { _Static_assert((c),m); } while(0) # elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */ # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) # else # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa { char x[(c) ? 1 : -1]; }; } while(0) # endif # define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c) #endif /*! * @internal * @def XXH_COMPILER_GUARD(var) * @brief Used to prevent unwanted optimizations for @p var. * * It uses an empty GCC inline assembly statement with a register constraint * which forces @p var into a general purpose register (eg eax, ebx, ecx * on x86) and marks it as modified. * * This is used in a few places to avoid unwanted autovectorization (e.g. * XXH32_round()). All vectorization we want is explicit via intrinsics, * and _usually_ isn't wanted elsewhere. * * We also use it to prevent unwanted constant folding for AArch64 in * XXH3_initCustomSecret_scalar(). */ #if defined(__GNUC__) || defined(__clang__) # define XXH_COMPILER_GUARD(var) __asm__("" : "+r" (var)) #else # define XXH_COMPILER_GUARD(var) ((void)0) #endif /* Specifically for NEON vectors which use the "w" constraint, on * Clang. */ #if defined(__clang__) && defined(__ARM_ARCH) && !defined(__wasm__) # define XXH_COMPILER_GUARD_CLANG_NEON(var) __asm__("" : "+w" (var)) #else # define XXH_COMPILER_GUARD_CLANG_NEON(var) ((void)0) #endif /* ************************************* * Basic Types ***************************************/ #if !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) # include <stdint.h> typedef uint8_t xxh_u8; #else typedef unsigned char xxh_u8; #endif typedef XXH32_hash_t xxh_u32; #ifdef XXH_OLD_NAMES # warning "XXH_OLD_NAMES is planned to be removed starting v0.9. If the program depends on it, consider moving away from it by employing newer type names directly" # define BYTE xxh_u8 # define U8 xxh_u8 # define U32 xxh_u32 #endif /* *** Memory access *** */ /*! * @internal * @fn xxh_u32 XXH_read32(const void* ptr) * @brief Reads an unaligned 32-bit integer from @p ptr in native endianness. * * Affected by @ref XXH_FORCE_MEMORY_ACCESS. * * @param ptr The pointer to read from. * @return The 32-bit native endian integer from the bytes at @p ptr. */ /*! * @internal * @fn xxh_u32 XXH_readLE32(const void* ptr) * @brief Reads an unaligned 32-bit little endian integer from @p ptr. * * Affected by @ref XXH_FORCE_MEMORY_ACCESS. * * @param ptr The pointer to read from. * @return The 32-bit little endian integer from the bytes at @p ptr. */ /*! * @internal * @fn xxh_u32 XXH_readBE32(const void* ptr) * @brief Reads an unaligned 32-bit big endian integer from @p ptr. * * Affected by @ref XXH_FORCE_MEMORY_ACCESS. * * @param ptr The pointer to read from. * @return The 32-bit big endian integer from the bytes at @p ptr. */ /*! * @internal * @fn xxh_u32 XXH_readLE32_align(const void* ptr, XXH_alignment align) * @brief Like @ref XXH_readLE32(), but has an option for aligned reads. * * Affected by @ref XXH_FORCE_MEMORY_ACCESS. * Note that when @ref XXH_FORCE_ALIGN_CHECK == 0, the @p align parameter is * always @ref XXH_alignment::XXH_unaligned. * * @param ptr The pointer to read from. * @param align Whether @p ptr is aligned. * @pre * If @p align == @ref XXH_alignment::XXH_aligned, @p ptr must be 4 byte * aligned. * @return The 32-bit little endian integer from the bytes at @p ptr. */ #if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) /* * Manual byteshift. Best for old compilers which don't inline memcpy. * We actually directly use XXH_readLE32 and XXH_readBE32. */ #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) /* * Force direct memory access. Only works on CPU which support unaligned memory * access in hardware. */ static xxh_u32 XXH_read32(const void* memPtr) { return *(const xxh_u32*) memPtr; } #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) /* * __attribute__((aligned(1))) is supported by gcc and clang. Originally the * documentation claimed that it only increased the alignment, but actually it * can decrease it on gcc, clang, and icc: * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69502, * https://gcc.godbolt.org/z/xYez1j67Y. */ #ifdef XXH_OLD_NAMES typedef union { xxh_u32 u32; } __attribute__((packed)) unalign; #endif static xxh_u32 XXH_read32(const void* ptr) { typedef __attribute__((aligned(1))) xxh_u32 xxh_unalign32; return *((const xxh_unalign32*)ptr); } #else /* * Portable and safe solution. Generally efficient. * see: https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html */ static xxh_u32 XXH_read32(const void* memPtr) { xxh_u32 val; XXH_memcpy(&val, memPtr, sizeof(val)); return val; } #endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ /* *** Endianness *** */ /*! * @ingroup tuning * @def XXH_CPU_LITTLE_ENDIAN * @brief Whether the target is little endian. * * Defined to 1 if the target is little endian, or 0 if it is big endian. * It can be defined externally, for example on the compiler command line. * * If it is not defined, * a runtime check (which is usually constant folded) is used instead. * * @note * This is not necessarily defined to an integer constant. * * @see XXH_isLittleEndian() for the runtime check. */ #ifndef XXH_CPU_LITTLE_ENDIAN /* * Try to detect endianness automatically, to avoid the nonstandard behavior * in `XXH_isLittleEndian()` */ # if defined(_WIN32) /* Windows is always little endian */ \ || defined(__LITTLE_ENDIAN__) \ || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) # define XXH_CPU_LITTLE_ENDIAN 1 # elif defined(__BIG_ENDIAN__) \ || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) # define XXH_CPU_LITTLE_ENDIAN 0 # else /*! * @internal * @brief Runtime check for @ref XXH_CPU_LITTLE_ENDIAN. * * Most compilers will constant fold this. */ static int XXH_isLittleEndian(void) { /* * Portable and well-defined behavior. * Don't use static: it is detrimental to performance. */ const union { xxh_u32 u; xxh_u8 c[4]; } one = { 1 }; return one.c[0]; } # define XXH_CPU_LITTLE_ENDIAN XXH_isLittleEndian() # endif #endif /* **************************************** * Compiler-specific Functions and Macros ******************************************/ #define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) #ifdef __has_builtin # define XXH_HAS_BUILTIN(x) __has_builtin(x) #else # define XXH_HAS_BUILTIN(x) 0 #endif /* * C23 and future versions have standard "unreachable()". * Once it has been implemented reliably we can add it as an * additional case: * * ``` * #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= XXH_C23_VN) * # include <stddef.h> * # ifdef unreachable * # define XXH_UNREACHABLE() unreachable() * # endif * #endif * ``` * * Note C++23 also has std::unreachable() which can be detected * as follows: * ``` * #if defined(__cpp_lib_unreachable) && (__cpp_lib_unreachable >= 202202L) * # include <utility> * # define XXH_UNREACHABLE() std::unreachable() * #endif * ``` * NB: `__cpp_lib_unreachable` is defined in the `<version>` header. * We don't use that as including `<utility>` in `extern "C"` blocks * doesn't work on GCC12 */ #if XXH_HAS_BUILTIN(__builtin_unreachable) # define XXH_UNREACHABLE() __builtin_unreachable() #elif defined(_MSC_VER) # define XXH_UNREACHABLE() __assume(0) #else # define XXH_UNREACHABLE() #endif #if XXH_HAS_BUILTIN(__builtin_assume) # define XXH_ASSUME(c) __builtin_assume(c) #else # define XXH_ASSUME(c) if (!(c)) { XXH_UNREACHABLE(); } #endif /*! * @internal * @def XXH_rotl32(x,r) * @brief 32-bit rotate left. * * @param x The 32-bit integer to be rotated. * @param r The number of bits to rotate. * @pre * @p r > 0 && @p r < 32 * @note * @p x and @p r may be evaluated multiple times. * @return The rotated result. */ #if !defined(NO_CLANG_BUILTIN) && XXH_HAS_BUILTIN(__builtin_rotateleft32) \ && XXH_HAS_BUILTIN(__builtin_rotateleft64) # define XXH_rotl32 __builtin_rotateleft32 # define XXH_rotl64 __builtin_rotateleft64 /* Note: although _rotl exists for minGW (GCC under windows), performance seems poor */ #elif defined(_MSC_VER) # define XXH_rotl32(x,r) _rotl(x,r) # define XXH_rotl64(x,r) _rotl64(x,r) #else # define XXH_rotl32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) # define XXH_rotl64(x,r) (((x) << (r)) | ((x) >> (64 - (r)))) #endif /*! * @internal * @fn xxh_u32 XXH_swap32(xxh_u32 x) * @brief A 32-bit byteswap. * * @param x The 32-bit integer to byteswap. * @return @p x, byteswapped. */ #if defined(_MSC_VER) /* Visual Studio */ # define XXH_swap32 _byteswap_ulong #elif XXH_GCC_VERSION >= 403 # define XXH_swap32 __builtin_bswap32 #else static xxh_u32 XXH_swap32 (xxh_u32 x) { return ((x << 24) & 0xff000000 ) | ((x << 8) & 0x00ff0000 ) | ((x >> 8) & 0x0000ff00 ) | ((x >> 24) & 0x000000ff ); } #endif /* *************************** * Memory reads *****************************/ /*! * @internal * @brief Enum to indicate whether a pointer is aligned. */ typedef enum { XXH_aligned, /*!< Aligned */ XXH_unaligned /*!< Possibly unaligned */ } XXH_alignment; /* * XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. * * This is ideal for older compilers which don't inline memcpy. */ #if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* memPtr) { const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; return bytePtr[0] | ((xxh_u32)bytePtr[1] << 8) | ((xxh_u32)bytePtr[2] << 16) | ((xxh_u32)bytePtr[3] << 24); } XXH_FORCE_INLINE xxh_u32 XXH_readBE32(const void* memPtr) { const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; return bytePtr[3] | ((xxh_u32)bytePtr[2] << 8) | ((xxh_u32)bytePtr[1] << 16) | ((xxh_u32)bytePtr[0] << 24); } #else XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* ptr) { return XXH_CPU_LITTLE_ENDIAN ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); } static xxh_u32 XXH_readBE32(const void* ptr) { return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); } #endif XXH_FORCE_INLINE xxh_u32 XXH_readLE32_align(const void* ptr, XXH_alignment align) { if (align==XXH_unaligned) { return XXH_readLE32(ptr); } else { return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u32*)ptr : XXH_swap32(*(const xxh_u32*)ptr); } } /* ************************************* * Misc ***************************************/ /*! @ingroup public */ XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } /* ******************************************************************* * 32-bit hash functions *********************************************************************/ /*! * @} * @defgroup XXH32_impl XXH32 implementation * @ingroup impl * * Details on the XXH32 implementation. * @{ */ /* #define instead of static const, to be used as initializers */ #define XXH_PRIME32_1 0x9E3779B1U /*!< 0b10011110001101110111100110110001 */ #define XXH_PRIME32_2 0x85EBCA77U /*!< 0b10000101111010111100101001110111 */ #define XXH_PRIME32_3 0xC2B2AE3DU /*!< 0b11000010101100101010111000111101 */ #define XXH_PRIME32_4 0x27D4EB2FU /*!< 0b00100111110101001110101100101111 */ #define XXH_PRIME32_5 0x165667B1U /*!< 0b00010110010101100110011110110001 */ #ifdef XXH_OLD_NAMES # define PRIME32_1 XXH_PRIME32_1 # define PRIME32_2 XXH_PRIME32_2 # define PRIME32_3 XXH_PRIME32_3 # define PRIME32_4 XXH_PRIME32_4 # define PRIME32_5 XXH_PRIME32_5 #endif /*! * @internal * @brief Normal stripe processing routine. * * This shuffles the bits so that any bit from @p input impacts several bits in * @p acc. * * @param acc The accumulator lane. * @param input The stripe of input to mix. * @return The mixed accumulator lane. */ static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) { acc += input * XXH_PRIME32_2; acc = XXH_rotl32(acc, 13); acc *= XXH_PRIME32_1; #if (defined(__SSE4_1__) || defined(__aarch64__) || defined(__wasm_simd128__)) && !defined(XXH_ENABLE_AUTOVECTORIZE) /* * UGLY HACK: * A compiler fence is the only thing that prevents GCC and Clang from * autovectorizing the XXH32 loop (pragmas and attributes don't work for some * reason) without globally disabling SSE4.1. * * The reason we want to avoid vectorization is because despite working on * 4 integers at a time, there are multiple factors slowing XXH32 down on * SSE4: * - There's a ridiculous amount of lag from pmulld (10 cycles of latency on * newer chips!) making it slightly slower to multiply four integers at * once compared to four integers independently. Even when pmulld was * fastest, Sandy/Ivy Bridge, it is still not worth it to go into SSE * just to multiply unless doing a long operation. * * - Four instructions are required to rotate, * movqda tmp, v // not required with VEX encoding * pslld tmp, 13 // tmp <<= 13 * psrld v, 19 // x >>= 19 * por v, tmp // x |= tmp * compared to one for scalar: * roll v, 13 // reliably fast across the board * shldl v, v, 13 // Sandy Bridge and later prefer this for some reason * * - Instruction level parallelism is actually more beneficial here because * the SIMD actually serializes this operation: While v1 is rotating, v2 * can load data, while v3 can multiply. SSE forces them to operate * together. * * This is also enabled on AArch64, as Clang is *very aggressive* in vectorizing * the loop. NEON is only faster on the A53, and with the newer cores, it is less * than half the speed. * * Additionally, this is used on WASM SIMD128 because it JITs to the same * SIMD instructions and has the same issue. */ XXH_COMPILER_GUARD(acc); #endif return acc; } /*! * @internal * @brief Mixes all bits to finalize the hash. * * The final mix ensures that all input bits have a chance to impact any bit in * the output digest, resulting in an unbiased distribution. * * @param hash The hash to avalanche. * @return The avalanched hash. */ static xxh_u32 XXH32_avalanche(xxh_u32 hash) { hash ^= hash >> 15; hash *= XXH_PRIME32_2; hash ^= hash >> 13; hash *= XXH_PRIME32_3; hash ^= hash >> 16; return hash; } #define XXH_get32bits(p) XXH_readLE32_align(p, align) /*! * @internal * @brief Processes the last 0-15 bytes of @p ptr. * * There may be up to 15 bytes remaining to consume from the input. * This final stage will digest them to ensure that all input bytes are present * in the final mix. * * @param hash The hash to finalize. * @param ptr The pointer to the remaining input. * @param len The remaining length, modulo 16. * @param align Whether @p ptr is aligned. * @return The finalized hash. * @see XXH64_finalize(). */ static XXH_PUREF xxh_u32 XXH32_finalize(xxh_u32 hash, const xxh_u8* ptr, size_t len, XXH_alignment align) { #define XXH_PROCESS1 do { \ hash += (*ptr++) * XXH_PRIME32_5; \ hash = XXH_rotl32(hash, 11) * XXH_PRIME32_1; \ } while (0) #define XXH_PROCESS4 do { \ hash += XXH_get32bits(ptr) * XXH_PRIME32_3; \ ptr += 4; \ hash = XXH_rotl32(hash, 17) * XXH_PRIME32_4; \ } while (0) if (ptr==NULL) XXH_ASSERT(len == 0); /* Compact rerolled version; generally faster */ if (!XXH32_ENDJMP) { len &= 15; while (len >= 4) { XXH_PROCESS4; len -= 4; } while (len > 0) { XXH_PROCESS1; --len; } return XXH32_avalanche(hash); } else { switch(len&15) /* or switch(bEnd - p) */ { case 12: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 8: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 4: XXH_PROCESS4; return XXH32_avalanche(hash); case 13: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 9: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 5: XXH_PROCESS4; XXH_PROCESS1; return XXH32_avalanche(hash); case 14: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 10: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 6: XXH_PROCESS4; XXH_PROCESS1; XXH_PROCESS1; return XXH32_avalanche(hash); case 15: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 11: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 7: XXH_PROCESS4; XXH_FALLTHROUGH; /* fallthrough */ case 3: XXH_PROCESS1; XXH_FALLTHROUGH; /* fallthrough */ case 2: XXH_PROCESS1; XXH_FALLTHROUGH; /* fallthrough */ case 1: XXH_PROCESS1; XXH_FALLTHROUGH; /* fallthrough */ case 0: return XXH32_avalanche(hash); } XXH_ASSERT(0); return hash; /* reaching this point is deemed impossible */ } } #ifdef XXH_OLD_NAMES # define PROCESS1 XXH_PROCESS1 # define PROCESS4 XXH_PROCESS4 #else # undef XXH_PROCESS1 # undef XXH_PROCESS4 #endif /*! * @internal * @brief The implementation for @ref XXH32(). * * @param input , len , seed Directly passed from @ref XXH32(). * @param align Whether @p input is aligned. * @return The calculated hash. */ XXH_FORCE_INLINE XXH_PUREF xxh_u32 XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment align) { xxh_u32 h32; if (input==NULL) XXH_ASSERT(len == 0); if (len>=16) { const xxh_u8* const bEnd = input + len; const xxh_u8* const limit = bEnd - 15; xxh_u32 v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; xxh_u32 v2 = seed + XXH_PRIME32_2; xxh_u32 v3 = seed + 0; xxh_u32 v4 = seed - XXH_PRIME32_1; do { v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4; v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4; v3 = XXH32_round(v3, XXH_get32bits(input)); input += 4; v4 = XXH32_round(v4, XXH_get32bits(input)); input += 4; } while (input < limit); h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); } else { h32 = seed + XXH_PRIME32_5; } h32 += (xxh_u32)len; return XXH32_finalize(h32, input, len&15, align); } /*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t seed) { #if !defined(XXH_NO_STREAM) && XXH_SIZE_OPT >= 2 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ XXH32_state_t state; XXH32_reset(&state, seed); XXH32_update(&state, (const xxh_u8*)input, len); return XXH32_digest(&state); #else if (XXH_FORCE_ALIGN_CHECK) { if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */ return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); } } return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); #endif } /******* Hash streaming *******/ #ifndef XXH_NO_STREAM /*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) { return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); } /*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) { XXH_free(statePtr); return XXH_OK; } /*! @ingroup XXH32_family */ XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState) { XXH_memcpy(dstState, srcState, sizeof(*dstState)); } /*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t seed) { XXH_ASSERT(statePtr != NULL); memset(statePtr, 0, sizeof(*statePtr)); statePtr->v[0] = seed + XXH_PRIME32_1 + XXH_PRIME32_2; statePtr->v[1] = seed + XXH_PRIME32_2; statePtr->v[2] = seed + 0; statePtr->v[3] = seed - XXH_PRIME32_1; return XXH_OK; } /*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_update(XXH32_state_t* state, const void* input, size_t len) { if (input==NULL) { XXH_ASSERT(len == 0); return XXH_OK; } { const xxh_u8* p = (const xxh_u8*)input; const xxh_u8* const bEnd = p + len; state->total_len_32 += (XXH32_hash_t)len; state->large_len |= (XXH32_hash_t)((len>=16) | (state->total_len_32>=16)); if (state->memsize + len < 16) { /* fill in tmp buffer */ XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, len); state->memsize += (XXH32_hash_t)len; return XXH_OK; } if (state->memsize) { /* some data left from previous update */ XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, 16-state->memsize); { const xxh_u32* p32 = state->mem32; state->v[0] = XXH32_round(state->v[0], XXH_readLE32(p32)); p32++; state->v[1] = XXH32_round(state->v[1], XXH_readLE32(p32)); p32++; state->v[2] = XXH32_round(state->v[2], XXH_readLE32(p32)); p32++; state->v[3] = XXH32_round(state->v[3], XXH_readLE32(p32)); } p += 16-state->memsize; state->memsize = 0; } if (p <= bEnd-16) { const xxh_u8* const limit = bEnd - 16; do { state->v[0] = XXH32_round(state->v[0], XXH_readLE32(p)); p+=4; state->v[1] = XXH32_round(state->v[1], XXH_readLE32(p)); p+=4; state->v[2] = XXH32_round(state->v[2], XXH_readLE32(p)); p+=4; state->v[3] = XXH32_round(state->v[3], XXH_readLE32(p)); p+=4; } while (p<=limit); } if (p < bEnd) { XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); state->memsize = (unsigned)(bEnd-p); } } return XXH_OK; } /*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32_digest(const XXH32_state_t* state) { xxh_u32 h32; if (state->large_len) { h32 = XXH_rotl32(state->v[0], 1) + XXH_rotl32(state->v[1], 7) + XXH_rotl32(state->v[2], 12) + XXH_rotl32(state->v[3], 18); } else { h32 = state->v[2] /* == seed */ + XXH_PRIME32_5; } h32 += state->total_len_32; return XXH32_finalize(h32, (const xxh_u8*)state->mem32, state->memsize, XXH_aligned); } #endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ /*! @ingroup XXH32_family */ XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) { XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); XXH_memcpy(dst, &hash, sizeof(*dst)); } /*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) { return XXH_readBE32(src); } #ifndef XXH_NO_LONG_LONG /* ******************************************************************* * 64-bit hash functions *********************************************************************/ /*! * @} * @ingroup impl * @{ */ /******* Memory access *******/ typedef XXH64_hash_t xxh_u64; #ifdef XXH_OLD_NAMES # define U64 xxh_u64 #endif #if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) /* * Manual byteshift. Best for old compilers which don't inline memcpy. * We actually directly use XXH_readLE64 and XXH_readBE64. */ #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) /* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ static xxh_u64 XXH_read64(const void* memPtr) { return *(const xxh_u64*) memPtr; } #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) /* * __attribute__((aligned(1))) is supported by gcc and clang. Originally the * documentation claimed that it only increased the alignment, but actually it * can decrease it on gcc, clang, and icc: * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69502, * https://gcc.godbolt.org/z/xYez1j67Y. */ #ifdef XXH_OLD_NAMES typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) unalign64; #endif static xxh_u64 XXH_read64(const void* ptr) { typedef __attribute__((aligned(1))) xxh_u64 xxh_unalign64; return *((const xxh_unalign64*)ptr); } #else /* * Portable and safe solution. Generally efficient. * see: https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html */ static xxh_u64 XXH_read64(const void* memPtr) { xxh_u64 val; XXH_memcpy(&val, memPtr, sizeof(val)); return val; } #endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ #if defined(_MSC_VER) /* Visual Studio */ # define XXH_swap64 _byteswap_uint64 #elif XXH_GCC_VERSION >= 403 # define XXH_swap64 __builtin_bswap64 #else static xxh_u64 XXH_swap64(xxh_u64 x) { return ((x << 56) & 0xff00000000000000ULL) | ((x << 40) & 0x00ff000000000000ULL) | ((x << 24) & 0x0000ff0000000000ULL) | ((x << 8) & 0x000000ff00000000ULL) | ((x >> 8) & 0x00000000ff000000ULL) | ((x >> 24) & 0x0000000000ff0000ULL) | ((x >> 40) & 0x000000000000ff00ULL) | ((x >> 56) & 0x00000000000000ffULL); } #endif /* XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. */ #if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* memPtr) { const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; return bytePtr[0] | ((xxh_u64)bytePtr[1] << 8) | ((xxh_u64)bytePtr[2] << 16) | ((xxh_u64)bytePtr[3] << 24) | ((xxh_u64)bytePtr[4] << 32) | ((xxh_u64)bytePtr[5] << 40) | ((xxh_u64)bytePtr[6] << 48) | ((xxh_u64)bytePtr[7] << 56); } XXH_FORCE_INLINE xxh_u64 XXH_readBE64(const void* memPtr) { const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; return bytePtr[7] | ((xxh_u64)bytePtr[6] << 8) | ((xxh_u64)bytePtr[5] << 16) | ((xxh_u64)bytePtr[4] << 24) | ((xxh_u64)bytePtr[3] << 32) | ((xxh_u64)bytePtr[2] << 40) | ((xxh_u64)bytePtr[1] << 48) | ((xxh_u64)bytePtr[0] << 56); } #else XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* ptr) { return XXH_CPU_LITTLE_ENDIAN ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); } static xxh_u64 XXH_readBE64(const void* ptr) { return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); } #endif XXH_FORCE_INLINE xxh_u64 XXH_readLE64_align(const void* ptr, XXH_alignment align) { if (align==XXH_unaligned) return XXH_readLE64(ptr); else return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u64*)ptr : XXH_swap64(*(const xxh_u64*)ptr); } /******* xxh64 *******/ /*! * @} * @defgroup XXH64_impl XXH64 implementation * @ingroup impl * * Details on the XXH64 implementation. * @{ */ /* #define rather that static const, to be used as initializers */ #define XXH_PRIME64_1 0x9E3779B185EBCA87ULL /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */ #define XXH_PRIME64_2 0xC2B2AE3D27D4EB4FULL /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */ #define XXH_PRIME64_3 0x165667B19E3779F9ULL /*!< 0b0001011001010110011001111011000110011110001101110111100111111001 */ #define XXH_PRIME64_4 0x85EBCA77C2B2AE63ULL /*!< 0b1000010111101011110010100111011111000010101100101010111001100011 */ #define XXH_PRIME64_5 0x27D4EB2F165667C5ULL /*!< 0b0010011111010100111010110010111100010110010101100110011111000101 */ #ifdef XXH_OLD_NAMES # define PRIME64_1 XXH_PRIME64_1 # define PRIME64_2 XXH_PRIME64_2 # define PRIME64_3 XXH_PRIME64_3 # define PRIME64_4 XXH_PRIME64_4 # define PRIME64_5 XXH_PRIME64_5 #endif /*! @copydoc XXH32_round */ static xxh_u64 XXH64_round(xxh_u64 acc, xxh_u64 input) { acc += input * XXH_PRIME64_2; acc = XXH_rotl64(acc, 31); acc *= XXH_PRIME64_1; return acc; } static xxh_u64 XXH64_mergeRound(xxh_u64 acc, xxh_u64 val) { val = XXH64_round(0, val); acc ^= val; acc = acc * XXH_PRIME64_1 + XXH_PRIME64_4; return acc; } /*! @copydoc XXH32_avalanche */ static xxh_u64 XXH64_avalanche(xxh_u64 hash) { hash ^= hash >> 33; hash *= XXH_PRIME64_2; hash ^= hash >> 29; hash *= XXH_PRIME64_3; hash ^= hash >> 32; return hash; } #define XXH_get64bits(p) XXH_readLE64_align(p, align) /*! * @internal * @brief Processes the last 0-31 bytes of @p ptr. * * There may be up to 31 bytes remaining to consume from the input. * This final stage will digest them to ensure that all input bytes are present * in the final mix. * * @param hash The hash to finalize. * @param ptr The pointer to the remaining input. * @param len The remaining length, modulo 32. * @param align Whether @p ptr is aligned. * @return The finalized hash * @see XXH32_finalize(). */ static XXH_PUREF xxh_u64 XXH64_finalize(xxh_u64 hash, const xxh_u8* ptr, size_t len, XXH_alignment align) { if (ptr==NULL) XXH_ASSERT(len == 0); len &= 31; while (len >= 8) { xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr)); ptr += 8; hash ^= k1; hash = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4; len -= 8; } if (len >= 4) { hash ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; ptr += 4; hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; len -= 4; } while (len > 0) { hash ^= (*ptr++) * XXH_PRIME64_5; hash = XXH_rotl64(hash, 11) * XXH_PRIME64_1; --len; } return XXH64_avalanche(hash); } #ifdef XXH_OLD_NAMES # define PROCESS1_64 XXH_PROCESS1_64 # define PROCESS4_64 XXH_PROCESS4_64 # define PROCESS8_64 XXH_PROCESS8_64 #else # undef XXH_PROCESS1_64 # undef XXH_PROCESS4_64 # undef XXH_PROCESS8_64 #endif /*! * @internal * @brief The implementation for @ref XXH64(). * * @param input , len , seed Directly passed from @ref XXH64(). * @param align Whether @p input is aligned. * @return The calculated hash. */ XXH_FORCE_INLINE XXH_PUREF xxh_u64 XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment align) { xxh_u64 h64; if (input==NULL) XXH_ASSERT(len == 0); if (len>=32) { const xxh_u8* const bEnd = input + len; const xxh_u8* const limit = bEnd - 31; xxh_u64 v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; xxh_u64 v2 = seed + XXH_PRIME64_2; xxh_u64 v3 = seed + 0; xxh_u64 v4 = seed - XXH_PRIME64_1; do { v1 = XXH64_round(v1, XXH_get64bits(input)); input+=8; v2 = XXH64_round(v2, XXH_get64bits(input)); input+=8; v3 = XXH64_round(v3, XXH_get64bits(input)); input+=8; v4 = XXH64_round(v4, XXH_get64bits(input)); input+=8; } while (input<limit); h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); h64 = XXH64_mergeRound(h64, v1); h64 = XXH64_mergeRound(h64, v2); h64 = XXH64_mergeRound(h64, v3); h64 = XXH64_mergeRound(h64, v4); } else { h64 = seed + XXH_PRIME64_5; } h64 += (xxh_u64) len; return XXH64_finalize(h64, input, len, align); } /*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH64_hash_t XXH64 (XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { #if !defined(XXH_NO_STREAM) && XXH_SIZE_OPT >= 2 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ XXH64_state_t state; XXH64_reset(&state, seed); XXH64_update(&state, (const xxh_u8*)input, len); return XXH64_digest(&state); #else if (XXH_FORCE_ALIGN_CHECK) { if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */ return XXH64_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); } } return XXH64_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); #endif } /******* Hash Streaming *******/ #ifndef XXH_NO_STREAM /*! @ingroup XXH64_family*/ XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) { return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); } /*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) { XXH_free(statePtr); return XXH_OK; } /*! @ingroup XXH64_family */ XXH_PUBLIC_API void XXH64_copyState(XXH_NOESCAPE XXH64_state_t* dstState, const XXH64_state_t* srcState) { XXH_memcpy(dstState, srcState, sizeof(*dstState)); } /*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH_NOESCAPE XXH64_state_t* statePtr, XXH64_hash_t seed) { XXH_ASSERT(statePtr != NULL); memset(statePtr, 0, sizeof(*statePtr)); statePtr->v[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2; statePtr->v[1] = seed + XXH_PRIME64_2; statePtr->v[2] = seed + 0; statePtr->v[3] = seed - XXH_PRIME64_1; return XXH_OK; } /*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH_NOESCAPE XXH64_state_t* state, XXH_NOESCAPE const void* input, size_t len) { if (input==NULL) { XXH_ASSERT(len == 0); return XXH_OK; } { const xxh_u8* p = (const xxh_u8*)input; const xxh_u8* const bEnd = p + len; state->total_len += len; if (state->memsize + len < 32) { /* fill in tmp buffer */ XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len); state->memsize += (xxh_u32)len; return XXH_OK; } if (state->memsize) { /* tmp buffer is full */ XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize); state->v[0] = XXH64_round(state->v[0], XXH_readLE64(state->mem64+0)); state->v[1] = XXH64_round(state->v[1], XXH_readLE64(state->mem64+1)); state->v[2] = XXH64_round(state->v[2], XXH_readLE64(state->mem64+2)); state->v[3] = XXH64_round(state->v[3], XXH_readLE64(state->mem64+3)); p += 32 - state->memsize; state->memsize = 0; } if (p+32 <= bEnd) { const xxh_u8* const limit = bEnd - 32; do { state->v[0] = XXH64_round(state->v[0], XXH_readLE64(p)); p+=8; state->v[1] = XXH64_round(state->v[1], XXH_readLE64(p)); p+=8; state->v[2] = XXH64_round(state->v[2], XXH_readLE64(p)); p+=8; state->v[3] = XXH64_round(state->v[3], XXH_readLE64(p)); p+=8; } while (p<=limit); } if (p < bEnd) { XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); state->memsize = (unsigned)(bEnd-p); } } return XXH_OK; } /*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH64_hash_t XXH64_digest(XXH_NOESCAPE const XXH64_state_t* state) { xxh_u64 h64; if (state->total_len >= 32) { h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18); h64 = XXH64_mergeRound(h64, state->v[0]); h64 = XXH64_mergeRound(h64, state->v[1]); h64 = XXH64_mergeRound(h64, state->v[2]); h64 = XXH64_mergeRound(h64, state->v[3]); } else { h64 = state->v[2] /*seed*/ + XXH_PRIME64_5; } h64 += (xxh_u64) state->total_len; return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned); } #endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ /*! @ingroup XXH64_family */ XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH_NOESCAPE XXH64_canonical_t* dst, XXH64_hash_t hash) { XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); XXH_memcpy(dst, &hash, sizeof(*dst)); } /*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(XXH_NOESCAPE const XXH64_canonical_t* src) { return XXH_readBE64(src); } #ifndef XXH_NO_XXH3 /* ********************************************************************* * XXH3 * New generation hash designed for speed on small keys and vectorization ************************************************************************ */ /*! * @} * @defgroup XXH3_impl XXH3 implementation * @ingroup impl * @{ */ /* === Compiler specifics === */ #if ((defined(sun) || defined(__sun)) && __cplusplus) /* Solaris includes __STDC_VERSION__ with C++. Tested with GCC 5.5 */ # define XXH_RESTRICT /* disable */ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* >= C99 */ # define XXH_RESTRICT restrict #elif (defined (__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) \ || (defined (__clang__)) \ || (defined (_MSC_VER) && (_MSC_VER >= 1400)) \ || (defined (__INTEL_COMPILER) && (__INTEL_COMPILER >= 1300)) /* * There are a LOT more compilers that recognize __restrict but this * covers the major ones. */ # define XXH_RESTRICT __restrict #else # define XXH_RESTRICT /* disable */ #endif #if (defined(__GNUC__) && (__GNUC__ >= 3)) \ || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) \ || defined(__clang__) # define XXH_likely(x) __builtin_expect(x, 1) # define XXH_unlikely(x) __builtin_expect(x, 0) #else # define XXH_likely(x) (x) # define XXH_unlikely(x) (x) #endif #ifndef XXH_HAS_INCLUDE # ifdef __has_include /* * Not defined as XXH_HAS_INCLUDE(x) (function-like) because * this causes segfaults in Apple Clang 4.2 (on Mac OS X 10.7 Lion) */ # define XXH_HAS_INCLUDE __has_include # else # define XXH_HAS_INCLUDE(x) 0 # endif #endif #if defined(__GNUC__) || defined(__clang__) # if defined(__ARM_FEATURE_SVE) # include <arm_sve.h> # endif # if defined(__ARM_NEON__) || defined(__ARM_NEON) \ || (defined(_M_ARM) && _M_ARM >= 7) \ || defined(_M_ARM64) || defined(_M_ARM64EC) \ || (defined(__wasm_simd128__) && XXH_HAS_INCLUDE(<arm_neon.h>)) /* WASM SIMD128 via SIMDe */ # define inline __inline__ /* circumvent a clang bug */ # include <arm_neon.h> # undef inline # elif defined(__AVX2__) # include <immintrin.h> # elif defined(__SSE2__) # include <emmintrin.h> # endif #endif #if defined(_MSC_VER) # include <intrin.h> #endif /* * One goal of XXH3 is to make it fast on both 32-bit and 64-bit, while * remaining a true 64-bit/128-bit hash function. * * This is done by prioritizing a subset of 64-bit operations that can be * emulated without too many steps on the average 32-bit machine. * * For example, these two lines seem similar, and run equally fast on 64-bit: * * xxh_u64 x; * x ^= (x >> 47); // good * x ^= (x >> 13); // bad * * However, to a 32-bit machine, there is a major difference. * * x ^= (x >> 47) looks like this: * * x.lo ^= (x.hi >> (47 - 32)); * * while x ^= (x >> 13) looks like this: * * // note: funnel shifts are not usually cheap. * x.lo ^= (x.lo >> 13) | (x.hi << (32 - 13)); * x.hi ^= (x.hi >> 13); * * The first one is significantly faster than the second, simply because the * shift is larger than 32. This means: * - All the bits we need are in the upper 32 bits, so we can ignore the lower * 32 bits in the shift. * - The shift result will always fit in the lower 32 bits, and therefore, * we can ignore the upper 32 bits in the xor. * * Thanks to this optimization, XXH3 only requires these features to be efficient: * * - Usable unaligned access * - A 32-bit or 64-bit ALU * - If 32-bit, a decent ADC instruction * - A 32 or 64-bit multiply with a 64-bit result * - For the 128-bit variant, a decent byteswap helps short inputs. * * The first two are already required by XXH32, and almost all 32-bit and 64-bit * platforms which can run XXH32 can run XXH3 efficiently. * * Thumb-1, the classic 16-bit only subset of ARM's instruction set, is one * notable exception. * * First of all, Thumb-1 lacks support for the UMULL instruction which * performs the important long multiply. This means numerous __aeabi_lmul * calls. * * Second of all, the 8 functional registers are just not enough. * Setup for __aeabi_lmul, byteshift loads, pointers, and all arithmetic need * Lo registers, and this shuffling results in thousands more MOVs than A32. * * A32 and T32 don't have this limitation. They can access all 14 registers, * do a 32->64 multiply with UMULL, and the flexible operand allowing free * shifts is helpful, too. * * Therefore, we do a quick sanity check. * * If compiling Thumb-1 for a target which supports ARM instructions, we will * emit a warning, as it is not a "sane" platform to compile for. * * Usually, if this happens, it is because of an accident and you probably need * to specify -march, as you likely meant to compile for a newer architecture. * * Credit: large sections of the vectorial and asm source code paths * have been contributed by @easyaspi314 */ #if defined(__thumb__) && !defined(__thumb2__) && defined(__ARM_ARCH_ISA_ARM) # warning "XXH3 is highly inefficient without ARM or Thumb-2." #endif /* ========================================== * Vectorization detection * ========================================== */ #ifdef XXH_DOXYGEN /*! * @ingroup tuning * @brief Overrides the vectorization implementation chosen for XXH3. * * Can be defined to 0 to disable SIMD or any of the values mentioned in * @ref XXH_VECTOR_TYPE. * * If this is not defined, it uses predefined macros to determine the best * implementation. */ # define XXH_VECTOR XXH_SCALAR /*! * @ingroup tuning * @brief Possible values for @ref XXH_VECTOR. * * Note that these are actually implemented as macros. * * If this is not defined, it is detected automatically. * internal macro XXH_X86DISPATCH overrides this. */ enum XXH_VECTOR_TYPE /* fake enum */ { XXH_SCALAR = 0, /*!< Portable scalar version */ XXH_SSE2 = 1, /*!< * SSE2 for Pentium 4, Opteron, all x86_64. * * @note SSE2 is also guaranteed on Windows 10, macOS, and * Android x86. */ XXH_AVX2 = 2, /*!< AVX2 for Haswell and Bulldozer */ XXH_AVX512 = 3, /*!< AVX512 for Skylake and Icelake */ XXH_NEON = 4, /*!< * NEON for most ARMv7-A, all AArch64, and WASM SIMD128 * via the SIMDeverywhere polyfill provided with the * Emscripten SDK. */ XXH_VSX = 5, /*!< VSX and ZVector for POWER8/z13 (64-bit) */ XXH_SVE = 6, /*!< SVE for some ARMv8-A and ARMv9-A */ }; /*! * @ingroup tuning * @brief Selects the minimum alignment for XXH3's accumulators. * * When using SIMD, this should match the alignment required for said vector * type, so, for example, 32 for AVX2. * * Default: Auto detected. */ # define XXH_ACC_ALIGN 8 #endif /* Actual definition */ #ifndef XXH_DOXYGEN # define XXH_SCALAR 0 # define XXH_SSE2 1 # define XXH_AVX2 2 # define XXH_AVX512 3 # define XXH_NEON 4 # define XXH_VSX 5 # define XXH_SVE 6 #endif #ifndef XXH_VECTOR /* can be defined on command line */ # if defined(__ARM_FEATURE_SVE) # define XXH_VECTOR XXH_SVE # elif ( \ defined(__ARM_NEON__) || defined(__ARM_NEON) /* gcc */ \ || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) /* msvc */ \ || (defined(__wasm_simd128__) && XXH_HAS_INCLUDE(<arm_neon.h>)) /* wasm simd128 via SIMDe */ \ ) && ( \ defined(_WIN32) || defined(__LITTLE_ENDIAN__) /* little endian only */ \ || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \ ) # define XXH_VECTOR XXH_NEON # elif defined(__AVX512F__) # define XXH_VECTOR XXH_AVX512 # elif defined(__AVX2__) # define XXH_VECTOR XXH_AVX2 # elif defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2)) # define XXH_VECTOR XXH_SSE2 # elif (defined(__PPC64__) && defined(__POWER8_VECTOR__)) \ || (defined(__s390x__) && defined(__VEC__)) \ && defined(__GNUC__) /* TODO: IBM XL */ # define XXH_VECTOR XXH_VSX # else # define XXH_VECTOR XXH_SCALAR # endif #endif /* __ARM_FEATURE_SVE is only supported by GCC & Clang. */ #if (XXH_VECTOR == XXH_SVE) && !defined(__ARM_FEATURE_SVE) # ifdef _MSC_VER # pragma warning(once : 4606) # else # warning "__ARM_FEATURE_SVE isn't supported. Use SCALAR instead." # endif # undef XXH_VECTOR # define XXH_VECTOR XXH_SCALAR #endif /* * Controls the alignment of the accumulator, * for compatibility with aligned vector loads, which are usually faster. */ #ifndef XXH_ACC_ALIGN # if defined(XXH_X86DISPATCH) # define XXH_ACC_ALIGN 64 /* for compatibility with avx512 */ # elif XXH_VECTOR == XXH_SCALAR /* scalar */ # define XXH_ACC_ALIGN 8 # elif XXH_VECTOR == XXH_SSE2 /* sse2 */ # define XXH_ACC_ALIGN 16 # elif XXH_VECTOR == XXH_AVX2 /* avx2 */ # define XXH_ACC_ALIGN 32 # elif XXH_VECTOR == XXH_NEON /* neon */ # define XXH_ACC_ALIGN 16 # elif XXH_VECTOR == XXH_VSX /* vsx */ # define XXH_ACC_ALIGN 16 # elif XXH_VECTOR == XXH_AVX512 /* avx512 */ # define XXH_ACC_ALIGN 64 # elif XXH_VECTOR == XXH_SVE /* sve */ # define XXH_ACC_ALIGN 64 # endif #endif #if defined(XXH_X86DISPATCH) || XXH_VECTOR == XXH_SSE2 \ || XXH_VECTOR == XXH_AVX2 || XXH_VECTOR == XXH_AVX512 # define XXH_SEC_ALIGN XXH_ACC_ALIGN #elif XXH_VECTOR == XXH_SVE # define XXH_SEC_ALIGN XXH_ACC_ALIGN #else # define XXH_SEC_ALIGN 8 #endif #if defined(__GNUC__) || defined(__clang__) # define XXH_ALIASING __attribute__((may_alias)) #else # define XXH_ALIASING /* nothing */ #endif /* * UGLY HACK: * GCC usually generates the best code with -O3 for xxHash. * * However, when targeting AVX2, it is overzealous in its unrolling resulting * in code roughly 3/4 the speed of Clang. * * There are other issues, such as GCC splitting _mm256_loadu_si256 into * _mm_loadu_si128 + _mm256_inserti128_si256. This is an optimization which * only applies to Sandy and Ivy Bridge... which don't even support AVX2. * * That is why when compiling the AVX2 version, it is recommended to use either * -O2 -mavx2 -march=haswell * or * -O2 -mavx2 -mno-avx256-split-unaligned-load * for decent performance, or to use Clang instead. * * Fortunately, we can control the first one with a pragma that forces GCC into * -O2, but the other one we can't control without "failed to inline always * inline function due to target mismatch" warnings. */ #if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ && defined(__OPTIMIZE__) && XXH_SIZE_OPT <= 0 /* respect -O0 and -Os */ # pragma GCC push_options # pragma GCC optimize("-O2") #endif #if XXH_VECTOR == XXH_NEON /* * UGLY HACK: While AArch64 GCC on Linux does not seem to care, on macOS, GCC -O3 * optimizes out the entire hashLong loop because of the aliasing violation. * * However, GCC is also inefficient at load-store optimization with vld1q/vst1q, * so the only option is to mark it as aliasing. */ typedef uint64x2_t xxh_aliasing_uint64x2_t XXH_ALIASING; /*! * @internal * @brief `vld1q_u64` but faster and alignment-safe. * * On AArch64, unaligned access is always safe, but on ARMv7-a, it is only * *conditionally* safe (`vld1` has an alignment bit like `movdq[ua]` in x86). * * GCC for AArch64 sees `vld1q_u8` as an intrinsic instead of a load, so it * prohibits load-store optimizations. Therefore, a direct dereference is used. * * Otherwise, `vld1q_u8` is used with `vreinterpretq_u8_u64` to do a safe * unaligned load. */ #if defined(__aarch64__) && defined(__GNUC__) && !defined(__clang__) XXH_FORCE_INLINE uint64x2_t XXH_vld1q_u64(void const* ptr) /* silence -Wcast-align */ { return *(xxh_aliasing_uint64x2_t const *)ptr; } #else XXH_FORCE_INLINE uint64x2_t XXH_vld1q_u64(void const* ptr) { return vreinterpretq_u64_u8(vld1q_u8((uint8_t const*)ptr)); } #endif /*! * @internal * @brief `vmlal_u32` on low and high halves of a vector. * * This is a workaround for AArch64 GCC < 11 which implemented arm_neon.h with * inline assembly and were therefore incapable of merging the `vget_{low, high}_u32` * with `vmlal_u32`. */ #if defined(__aarch64__) && defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 11 XXH_FORCE_INLINE uint64x2_t XXH_vmlal_low_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) { /* Inline assembly is the only way */ __asm__("umlal %0.2d, %1.2s, %2.2s" : "+w" (acc) : "w" (lhs), "w" (rhs)); return acc; } XXH_FORCE_INLINE uint64x2_t XXH_vmlal_high_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) { /* This intrinsic works as expected */ return vmlal_high_u32(acc, lhs, rhs); } #else /* Portable intrinsic versions */ XXH_FORCE_INLINE uint64x2_t XXH_vmlal_low_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) { return vmlal_u32(acc, vget_low_u32(lhs), vget_low_u32(rhs)); } /*! @copydoc XXH_vmlal_low_u32 * Assume the compiler converts this to vmlal_high_u32 on aarch64 */ XXH_FORCE_INLINE uint64x2_t XXH_vmlal_high_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) { return vmlal_u32(acc, vget_high_u32(lhs), vget_high_u32(rhs)); } #endif /*! * @ingroup tuning * @brief Controls the NEON to scalar ratio for XXH3 * * This can be set to 2, 4, 6, or 8. * * ARM Cortex CPUs are _very_ sensitive to how their pipelines are used. * * For example, the Cortex-A73 can dispatch 3 micro-ops per cycle, but only 2 of those * can be NEON. If you are only using NEON instructions, you are only using 2/3 of the CPU * bandwidth. * * This is even more noticeable on the more advanced cores like the Cortex-A76 which * can dispatch 8 micro-ops per cycle, but still only 2 NEON micro-ops at once. * * Therefore, to make the most out of the pipeline, it is beneficial to run 6 NEON lanes * and 2 scalar lanes, which is chosen by default. * * This does not apply to Apple processors or 32-bit processors, which run better with * full NEON. These will default to 8. Additionally, size-optimized builds run 8 lanes. * * This change benefits CPUs with large micro-op buffers without negatively affecting * most other CPUs: * * | Chipset | Dispatch type | NEON only | 6:2 hybrid | Diff. | * |:----------------------|:--------------------|----------:|-----------:|------:| * | Snapdragon 730 (A76) | 2 NEON/8 micro-ops | 8.8 GB/s | 10.1 GB/s | ~16% | * | Snapdragon 835 (A73) | 2 NEON/3 micro-ops | 5.1 GB/s | 5.3 GB/s | ~5% | * | Marvell PXA1928 (A53) | In-order dual-issue | 1.9 GB/s | 1.9 GB/s | 0% | * | Apple M1 | 4 NEON/8 micro-ops | 37.3 GB/s | 36.1 GB/s | ~-3% | * * It also seems to fix some bad codegen on GCC, making it almost as fast as clang. * * When using WASM SIMD128, if this is 2 or 6, SIMDe will scalarize 2 of the lanes meaning * it effectively becomes worse 4. * * @see XXH3_accumulate_512_neon() */ # ifndef XXH3_NEON_LANES # if (defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || defined(_M_ARM64EC)) \ && !defined(__APPLE__) && XXH_SIZE_OPT <= 0 # define XXH3_NEON_LANES 6 # else # define XXH3_NEON_LANES XXH_ACC_NB # endif # endif #endif /* XXH_VECTOR == XXH_NEON */ /* * VSX and Z Vector helpers. * * This is very messy, and any pull requests to clean this up are welcome. * * There are a lot of problems with supporting VSX and s390x, due to * inconsistent intrinsics, spotty coverage, and multiple endiannesses. */ #if XXH_VECTOR == XXH_VSX /* Annoyingly, these headers _may_ define three macros: `bool`, `vector`, * and `pixel`. This is a problem for obvious reasons. * * These keywords are unnecessary; the spec literally says they are * equivalent to `__bool`, `__vector`, and `__pixel` and may be undef'd * after including the header. * * We use pragma push_macro/pop_macro to keep the namespace clean. */ # pragma push_macro("bool") # pragma push_macro("vector") # pragma push_macro("pixel") /* silence potential macro redefined warnings */ # undef bool # undef vector # undef pixel # if defined(__s390x__) # include <s390intrin.h> # else # include <altivec.h> # endif /* Restore the original macro values, if applicable. */ # pragma pop_macro("pixel") # pragma pop_macro("vector") # pragma pop_macro("bool") typedef __vector unsigned long long xxh_u64x2; typedef __vector unsigned char xxh_u8x16; typedef __vector unsigned xxh_u32x4; /* * UGLY HACK: Similar to aarch64 macOS GCC, s390x GCC has the same aliasing issue. */ typedef xxh_u64x2 xxh_aliasing_u64x2 XXH_ALIASING; # ifndef XXH_VSX_BE # if defined(__BIG_ENDIAN__) \ || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) # define XXH_VSX_BE 1 # elif defined(__VEC_ELEMENT_REG_ORDER__) && __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__ # warning "-maltivec=be is not recommended. Please use native endianness." # define XXH_VSX_BE 1 # else # define XXH_VSX_BE 0 # endif # endif /* !defined(XXH_VSX_BE) */ # if XXH_VSX_BE # if defined(__POWER9_VECTOR__) || (defined(__clang__) && defined(__s390x__)) # define XXH_vec_revb vec_revb # else /*! * A polyfill for POWER9's vec_revb(). */ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_revb(xxh_u64x2 val) { xxh_u8x16 const vByteSwap = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }; return vec_perm(val, val, vByteSwap); } # endif # endif /* XXH_VSX_BE */ /*! * Performs an unaligned vector load and byte swaps it on big endian. */ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(const void *ptr) { xxh_u64x2 ret; XXH_memcpy(&ret, ptr, sizeof(xxh_u64x2)); # if XXH_VSX_BE ret = XXH_vec_revb(ret); # endif return ret; } /* * vec_mulo and vec_mule are very problematic intrinsics on PowerPC * * These intrinsics weren't added until GCC 8, despite existing for a while, * and they are endian dependent. Also, their meaning swap depending on version. * */ # if defined(__s390x__) /* s390x is always big endian, no issue on this platform */ # define XXH_vec_mulo vec_mulo # define XXH_vec_mule vec_mule # elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) && !defined(__ibmxl__) /* Clang has a better way to control this, we can just use the builtin which doesn't swap. */ /* The IBM XL Compiler (which defined __clang__) only implements the vec_* operations */ # define XXH_vec_mulo __builtin_altivec_vmulouw # define XXH_vec_mule __builtin_altivec_vmuleuw # else /* gcc needs inline assembly */ /* Adapted from https://github.com/google/highwayhash/blob/master/highwayhash/hh_vsx.h. */ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mulo(xxh_u32x4 a, xxh_u32x4 b) { xxh_u64x2 result; __asm__("vmulouw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); return result; } XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b) { xxh_u64x2 result; __asm__("vmuleuw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); return result; } # endif /* XXH_vec_mulo, XXH_vec_mule */ #endif /* XXH_VECTOR == XXH_VSX */ #if XXH_VECTOR == XXH_SVE #define ACCRND(acc, offset) \ do { \ svuint64_t input_vec = svld1_u64(mask, xinput + offset); \ svuint64_t secret_vec = svld1_u64(mask, xsecret + offset); \ svuint64_t mixed = sveor_u64_x(mask, secret_vec, input_vec); \ svuint64_t swapped = svtbl_u64(input_vec, kSwap); \ svuint64_t mixed_lo = svextw_u64_x(mask, mixed); \ svuint64_t mixed_hi = svlsr_n_u64_x(mask, mixed, 32); \ svuint64_t mul = svmad_u64_x(mask, mixed_lo, mixed_hi, swapped); \ acc = svadd_u64_x(mask, acc, mul); \ } while (0) #endif /* XXH_VECTOR == XXH_SVE */ /* prefetch * can be disabled, by declaring XXH_NO_PREFETCH build macro */ #if defined(XXH_NO_PREFETCH) # define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ #else # if XXH_SIZE_OPT >= 1 # define XXH_PREFETCH(ptr) (void)(ptr) # elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) /* _mm_prefetch() not defined outside of x86/x64 */ # include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ # define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) # elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) # define XXH_PREFETCH(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) # else # define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ # endif #endif /* XXH_NO_PREFETCH */ /* ========================================== * XXH3 default settings * ========================================== */ #define XXH_SECRET_DEFAULT_SIZE 192 /* minimum XXH3_SECRET_SIZE_MIN */ #if (XXH_SECRET_DEFAULT_SIZE < XXH3_SECRET_SIZE_MIN) # error "default keyset is not large enough" #endif /*! Pseudorandom secret taken directly from FARSH. */ XXH_ALIGN(64) static const xxh_u8 XXH3_kSecret[XXH_SECRET_DEFAULT_SIZE] = { 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21, 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c, 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3, 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8, 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d, 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64, 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb, 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e, 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce, 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, }; static const xxh_u64 PRIME_MX1 = 0x165667919E3779F9ULL; /*!< 0b0001011001010110011001111001000110011110001101110111100111111001 */ static const xxh_u64 PRIME_MX2 = 0x9FB21C651E98DF25ULL; /*!< 0b1001111110110010000111000110010100011110100110001101111100100101 */ #ifdef XXH_OLD_NAMES # define kSecret XXH3_kSecret #endif #ifdef XXH_DOXYGEN /*! * @brief Calculates a 32-bit to 64-bit long multiply. * * Implemented as a macro. * * Wraps `__emulu` on MSVC x86 because it tends to call `__allmul` when it doesn't * need to (but it shouldn't need to anyways, it is about 7 instructions to do * a 64x64 multiply...). Since we know that this will _always_ emit `MULL`, we * use that instead of the normal method. * * If you are compiling for platforms like Thumb-1 and don't have a better option, * you may also want to write your own long multiply routine here. * * @param x, y Numbers to be multiplied * @return 64-bit product of the low 32 bits of @p x and @p y. */ XXH_FORCE_INLINE xxh_u64 XXH_mult32to64(xxh_u64 x, xxh_u64 y) { return (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF); } #elif defined(_MSC_VER) && defined(_M_IX86) # define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y)) #else /* * Downcast + upcast is usually better than masking on older compilers like * GCC 4.2 (especially 32-bit ones), all without affecting newer compilers. * * The other method, (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF), will AND both operands * and perform a full 64x64 multiply -- entirely redundant on 32-bit. */ # define XXH_mult32to64(x, y) ((xxh_u64)(xxh_u32)(x) * (xxh_u64)(xxh_u32)(y)) #endif /*! * @brief Calculates a 64->128-bit long multiply. * * Uses `__uint128_t` and `_umul128` if available, otherwise uses a scalar * version. * * @param lhs , rhs The 64-bit integers to be multiplied * @return The 128-bit result represented in an @ref XXH128_hash_t. */ static XXH128_hash_t XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs) { /* * GCC/Clang __uint128_t method. * * On most 64-bit targets, GCC and Clang define a __uint128_t type. * This is usually the best way as it usually uses a native long 64-bit * multiply, such as MULQ on x86_64 or MUL + UMULH on aarch64. * * Usually. * * Despite being a 32-bit platform, Clang (and emscripten) define this type * despite not having the arithmetic for it. This results in a laggy * compiler builtin call which calculates a full 128-bit multiply. * In that case it is best to use the portable one. * https://github.com/Cyan4973/xxHash/issues/211#issuecomment-515575677 */ #if (defined(__GNUC__) || defined(__clang__)) && !defined(__wasm__) \ && defined(__SIZEOF_INT128__) \ || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) __uint128_t const product = (__uint128_t)lhs * (__uint128_t)rhs; XXH128_hash_t r128; r128.low64 = (xxh_u64)(product); r128.high64 = (xxh_u64)(product >> 64); return r128; /* * MSVC for x64's _umul128 method. * * xxh_u64 _umul128(xxh_u64 Multiplier, xxh_u64 Multiplicand, xxh_u64 *HighProduct); * * This compiles to single operand MUL on x64. */ #elif (defined(_M_X64) || defined(_M_IA64)) && !defined(_M_ARM64EC) #ifndef _MSC_VER # pragma intrinsic(_umul128) #endif xxh_u64 product_high; xxh_u64 const product_low = _umul128(lhs, rhs, &product_high); XXH128_hash_t r128; r128.low64 = product_low; r128.high64 = product_high; return r128; /* * MSVC for ARM64's __umulh method. * * This compiles to the same MUL + UMULH as GCC/Clang's __uint128_t method. */ #elif defined(_M_ARM64) || defined(_M_ARM64EC) #ifndef _MSC_VER # pragma intrinsic(__umulh) #endif XXH128_hash_t r128; r128.low64 = lhs * rhs; r128.high64 = __umulh(lhs, rhs); return r128; #else /* * Portable scalar method. Optimized for 32-bit and 64-bit ALUs. * * This is a fast and simple grade school multiply, which is shown below * with base 10 arithmetic instead of base 0x100000000. * * 9 3 // D2 lhs = 93 * x 7 5 // D2 rhs = 75 * ---------- * 1 5 // D2 lo_lo = (93 % 10) * (75 % 10) = 15 * 4 5 | // D2 hi_lo = (93 / 10) * (75 % 10) = 45 * 2 1 | // D2 lo_hi = (93 % 10) * (75 / 10) = 21 * + 6 3 | | // D2 hi_hi = (93 / 10) * (75 / 10) = 63 * --------- * 2 7 | // D2 cross = (15 / 10) + (45 % 10) + 21 = 27 * + 6 7 | | // D2 upper = (27 / 10) + (45 / 10) + 63 = 67 * --------- * 6 9 7 5 // D4 res = (27 * 10) + (15 % 10) + (67 * 100) = 6975 * * The reasons for adding the products like this are: * 1. It avoids manual carry tracking. Just like how * (9 * 9) + 9 + 9 = 99, the same applies with this for UINT64_MAX. * This avoids a lot of complexity. * * 2. It hints for, and on Clang, compiles to, the powerful UMAAL * instruction available in ARM's Digital Signal Processing extension * in 32-bit ARMv6 and later, which is shown below: * * void UMAAL(xxh_u32 *RdLo, xxh_u32 *RdHi, xxh_u32 Rn, xxh_u32 Rm) * { * xxh_u64 product = (xxh_u64)*RdLo * (xxh_u64)*RdHi + Rn + Rm; * *RdLo = (xxh_u32)(product & 0xFFFFFFFF); * *RdHi = (xxh_u32)(product >> 32); * } * * This instruction was designed for efficient long multiplication, and * allows this to be calculated in only 4 instructions at speeds * comparable to some 64-bit ALUs. * * 3. It isn't terrible on other platforms. Usually this will be a couple * of 32-bit ADD/ADCs. */ /* First calculate all of the cross products. */ xxh_u64 const lo_lo = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs & 0xFFFFFFFF); xxh_u64 const hi_lo = XXH_mult32to64(lhs >> 32, rhs & 0xFFFFFFFF); xxh_u64 const lo_hi = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs >> 32); xxh_u64 const hi_hi = XXH_mult32to64(lhs >> 32, rhs >> 32); /* Now add the products together. These will never overflow. */ xxh_u64 const cross = (lo_lo >> 32) + (hi_lo & 0xFFFFFFFF) + lo_hi; xxh_u64 const upper = (hi_lo >> 32) + (cross >> 32) + hi_hi; xxh_u64 const lower = (cross << 32) | (lo_lo & 0xFFFFFFFF); XXH128_hash_t r128; r128.low64 = lower; r128.high64 = upper; return r128; #endif } /*! * @brief Calculates a 64-bit to 128-bit multiply, then XOR folds it. * * The reason for the separate function is to prevent passing too many structs * around by value. This will hopefully inline the multiply, but we don't force it. * * @param lhs , rhs The 64-bit integers to multiply * @return The low 64 bits of the product XOR'd by the high 64 bits. * @see XXH_mult64to128() */ static xxh_u64 XXH3_mul128_fold64(xxh_u64 lhs, xxh_u64 rhs) { XXH128_hash_t product = XXH_mult64to128(lhs, rhs); return product.low64 ^ product.high64; } /*! Seems to produce slightly better code on GCC for some reason. */ XXH_FORCE_INLINE XXH_CONSTF xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) { XXH_ASSERT(0 <= shift && shift < 64); return v64 ^ (v64 >> shift); } /* * This is a fast avalanche stage, * suitable when input bits are already partially mixed */ static XXH64_hash_t XXH3_avalanche(xxh_u64 h64) { h64 = XXH_xorshift64(h64, 37); h64 *= PRIME_MX1; h64 = XXH_xorshift64(h64, 32); return h64; } /* * This is a stronger avalanche, * inspired by Pelle Evensen's rrmxmx * preferable when input has not been previously mixed */ static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) { /* this mix is inspired by Pelle Evensen's rrmxmx */ h64 ^= XXH_rotl64(h64, 49) ^ XXH_rotl64(h64, 24); h64 *= PRIME_MX2; h64 ^= (h64 >> 35) + len ; h64 *= PRIME_MX2; return XXH_xorshift64(h64, 28); } /* ========================================== * Short keys * ========================================== * One of the shortcomings of XXH32 and XXH64 was that their performance was * sub-optimal on short lengths. It used an iterative algorithm which strongly * favored lengths that were a multiple of 4 or 8. * * Instead of iterating over individual inputs, we use a set of single shot * functions which piece together a range of lengths and operate in constant time. * * Additionally, the number of multiplies has been significantly reduced. This * reduces latency, especially when emulating 64-bit multiplies on 32-bit. * * Depending on the platform, this may or may not be faster than XXH32, but it * is almost guaranteed to be faster than XXH64. */ /* * At very short lengths, there isn't enough input to fully hide secrets, or use * the entire secret. * * There is also only a limited amount of mixing we can do before significantly * impacting performance. * * Therefore, we use different sections of the secret and always mix two secret * samples with an XOR. This should have no effect on performance on the * seedless or withSeed variants because everything _should_ be constant folded * by modern compilers. * * The XOR mixing hides individual parts of the secret and increases entropy. * * This adds an extra layer of strength for custom secrets. */ XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); XXH_ASSERT(1 <= len && len <= 3); XXH_ASSERT(secret != NULL); /* * len = 1: combined = { input[0], 0x01, input[0], input[0] } * len = 2: combined = { input[1], 0x02, input[0], input[1] } * len = 3: combined = { input[2], 0x03, input[0], input[1] } */ { xxh_u8 const c1 = input[0]; xxh_u8 const c2 = input[len >> 1]; xxh_u8 const c3 = input[len - 1]; xxh_u32 const combined = ((xxh_u32)c1 << 16) | ((xxh_u32)c2 << 24) | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); xxh_u64 const bitflip = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; xxh_u64 const keyed = (xxh_u64)combined ^ bitflip; return XXH64_avalanche(keyed); } } XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); XXH_ASSERT(secret != NULL); XXH_ASSERT(4 <= len && len <= 8); seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; { xxh_u32 const input1 = XXH_readLE32(input); xxh_u32 const input2 = XXH_readLE32(input + len - 4); xxh_u64 const bitflip = (XXH_readLE64(secret+8) ^ XXH_readLE64(secret+16)) - seed; xxh_u64 const input64 = input2 + (((xxh_u64)input1) << 32); xxh_u64 const keyed = input64 ^ bitflip; return XXH3_rrmxmx(keyed, len); } } XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); XXH_ASSERT(secret != NULL); XXH_ASSERT(9 <= len && len <= 16); { xxh_u64 const bitflip1 = (XXH_readLE64(secret+24) ^ XXH_readLE64(secret+32)) + seed; xxh_u64 const bitflip2 = (XXH_readLE64(secret+40) ^ XXH_readLE64(secret+48)) - seed; xxh_u64 const input_lo = XXH_readLE64(input) ^ bitflip1; xxh_u64 const input_hi = XXH_readLE64(input + len - 8) ^ bitflip2; xxh_u64 const acc = len + XXH_swap64(input_lo) + input_hi + XXH3_mul128_fold64(input_lo, input_hi); return XXH3_avalanche(acc); } } XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_0to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(len <= 16); { if (XXH_likely(len > 8)) return XXH3_len_9to16_64b(input, len, secret, seed); if (XXH_likely(len >= 4)) return XXH3_len_4to8_64b(input, len, secret, seed); if (len) return XXH3_len_1to3_64b(input, len, secret, seed); return XXH64_avalanche(seed ^ (XXH_readLE64(secret+56) ^ XXH_readLE64(secret+64))); } } /* * DISCLAIMER: There are known *seed-dependent* multicollisions here due to * multiplication by zero, affecting hashes of lengths 17 to 240. * * However, they are very unlikely. * * Keep this in mind when using the unseeded XXH3_64bits() variant: As with all * unseeded non-cryptographic hashes, it does not attempt to defend itself * against specially crafted inputs, only random inputs. * * Compared to classic UMAC where a 1 in 2^31 chance of 4 consecutive bytes * cancelling out the secret is taken an arbitrary number of times (addressed * in XXH3_accumulate_512), this collision is very unlikely with random inputs * and/or proper seeding: * * This only has a 1 in 2^63 chance of 8 consecutive bytes cancelling out, in a * function that is only called up to 16 times per hash with up to 240 bytes of * input. * * This is not too bad for a non-cryptographic hash function, especially with * only 64 bit outputs. * * The 128-bit variant (which trades some speed for strength) is NOT affected * by this, although it is always a good idea to use a proper seed if you care * about strength. */ XXH_FORCE_INLINE xxh_u64 XXH3_mix16B(const xxh_u8* XXH_RESTRICT input, const xxh_u8* XXH_RESTRICT secret, xxh_u64 seed64) { #if defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ && defined(__i386__) && defined(__SSE2__) /* x86 + SSE2 */ \ && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable like XXH32 hack */ /* * UGLY HACK: * GCC for x86 tends to autovectorize the 128-bit multiply, resulting in * slower code. * * By forcing seed64 into a register, we disrupt the cost model and * cause it to scalarize. See `XXH32_round()` * * FIXME: Clang's output is still _much_ faster -- On an AMD Ryzen 3600, * XXH3_64bits @ len=240 runs at 4.6 GB/s with Clang 9, but 3.3 GB/s on * GCC 9.2, despite both emitting scalar code. * * GCC generates much better scalar code than Clang for the rest of XXH3, * which is why finding a more optimal codepath is an interest. */ XXH_COMPILER_GUARD(seed64); #endif { xxh_u64 const input_lo = XXH_readLE64(input); xxh_u64 const input_hi = XXH_readLE64(input+8); return XXH3_mul128_fold64( input_lo ^ (XXH_readLE64(secret) + seed64), input_hi ^ (XXH_readLE64(secret+8) - seed64) ); } } /* For mid range keys, XXH3 uses a Mum-hash variant. */ XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) { XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; XXH_ASSERT(16 < len && len <= 128); { xxh_u64 acc = len * XXH_PRIME64_1; #if XXH_SIZE_OPT >= 1 /* Smaller and cleaner, but slightly slower. */ unsigned int i = (unsigned int)(len - 1) / 32; do { acc += XXH3_mix16B(input+16 * i, secret+32*i, seed); acc += XXH3_mix16B(input+len-16*(i+1), secret+32*i+16, seed); } while (i-- != 0); #else if (len > 32) { if (len > 64) { if (len > 96) { acc += XXH3_mix16B(input+48, secret+96, seed); acc += XXH3_mix16B(input+len-64, secret+112, seed); } acc += XXH3_mix16B(input+32, secret+64, seed); acc += XXH3_mix16B(input+len-48, secret+80, seed); } acc += XXH3_mix16B(input+16, secret+32, seed); acc += XXH3_mix16B(input+len-32, secret+48, seed); } acc += XXH3_mix16B(input+0, secret+0, seed); acc += XXH3_mix16B(input+len-16, secret+16, seed); #endif return XXH3_avalanche(acc); } } /*! * @brief Maximum size of "short" key in bytes. */ #define XXH3_MIDSIZE_MAX 240 XXH_NO_INLINE XXH_PUREF XXH64_hash_t XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) { XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); #define XXH3_MIDSIZE_STARTOFFSET 3 #define XXH3_MIDSIZE_LASTOFFSET 17 { xxh_u64 acc = len * XXH_PRIME64_1; xxh_u64 acc_end; unsigned int const nbRounds = (unsigned int)len / 16; unsigned int i; XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); for (i=0; i<8; i++) { acc += XXH3_mix16B(input+(16*i), secret+(16*i), seed); } /* last bytes */ acc_end = XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); XXH_ASSERT(nbRounds >= 8); acc = XXH3_avalanche(acc); #if defined(__clang__) /* Clang */ \ && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ /* * UGLY HACK: * Clang for ARMv7-A tries to vectorize this loop, similar to GCC x86. * In everywhere else, it uses scalar code. * * For 64->128-bit multiplies, even if the NEON was 100% optimal, it * would still be slower than UMAAL (see XXH_mult64to128). * * Unfortunately, Clang doesn't handle the long multiplies properly and * converts them to the nonexistent "vmulq_u64" intrinsic, which is then * scalarized into an ugly mess of VMOV.32 instructions. * * This mess is difficult to avoid without turning autovectorization * off completely, but they are usually relatively minor and/or not * worth it to fix. * * This loop is the easiest to fix, as unlike XXH32, this pragma * _actually works_ because it is a loop vectorization instead of an * SLP vectorization. */ #pragma clang loop vectorize(disable) #endif for (i=8 ; i < nbRounds; i++) { /* * Prevents clang for unrolling the acc loop and interleaving with this one. */ XXH_COMPILER_GUARD(acc); acc_end += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); } return XXH3_avalanche(acc + acc_end); } } /* ======= Long Keys ======= */ #define XXH_STRIPE_LEN 64 #define XXH_SECRET_CONSUME_RATE 8 /* nb of secret bytes consumed at each accumulation */ #define XXH_ACC_NB (XXH_STRIPE_LEN / sizeof(xxh_u64)) #ifdef XXH_OLD_NAMES # define STRIPE_LEN XXH_STRIPE_LEN # define ACC_NB XXH_ACC_NB #endif #ifndef XXH_PREFETCH_DIST # ifdef __clang__ # define XXH_PREFETCH_DIST 320 # else # if (XXH_VECTOR == XXH_AVX512) # define XXH_PREFETCH_DIST 512 # else # define XXH_PREFETCH_DIST 384 # endif # endif /* __clang__ */ #endif /* XXH_PREFETCH_DIST */ /* * These macros are to generate an XXH3_accumulate() function. * The two arguments select the name suffix and target attribute. * * The name of this symbol is XXH3_accumulate_<name>() and it calls * XXH3_accumulate_512_<name>(). * * It may be useful to hand implement this function if the compiler fails to * optimize the inline function. */ #define XXH3_ACCUMULATE_TEMPLATE(name) \ void \ XXH3_accumulate_##name(xxh_u64* XXH_RESTRICT acc, \ const xxh_u8* XXH_RESTRICT input, \ const xxh_u8* XXH_RESTRICT secret, \ size_t nbStripes) \ { \ size_t n; \ for (n = 0; n < nbStripes; n++ ) { \ const xxh_u8* const in = input + n*XXH_STRIPE_LEN; \ XXH_PREFETCH(in + XXH_PREFETCH_DIST); \ XXH3_accumulate_512_##name( \ acc, \ in, \ secret + n*XXH_SECRET_CONSUME_RATE); \ } \ } XXH_FORCE_INLINE void XXH_writeLE64(void* dst, xxh_u64 v64) { if (!XXH_CPU_LITTLE_ENDIAN) v64 = XXH_swap64(v64); XXH_memcpy(dst, &v64, sizeof(v64)); } /* Several intrinsic functions below are supposed to accept __int64 as argument, * as documented in https://software.intel.com/sites/landingpage/IntrinsicsGuide/ . * However, several environments do not define __int64 type, * requiring a workaround. */ #if !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) typedef int64_t xxh_i64; #else /* the following type must have a width of 64-bit */ typedef long long xxh_i64; #endif /* * XXH3_accumulate_512 is the tightest loop for long inputs, and it is the most optimized. * * It is a hardened version of UMAC, based off of FARSH's implementation. * * This was chosen because it adapts quite well to 32-bit, 64-bit, and SIMD * implementations, and it is ridiculously fast. * * We harden it by mixing the original input to the accumulators as well as the product. * * This means that in the (relatively likely) case of a multiply by zero, the * original input is preserved. * * On 128-bit inputs, we swap 64-bit pairs when we add the input to improve * cross-pollination, as otherwise the upper and lower halves would be * essentially independent. * * This doesn't matter on 64-bit hashes since they all get merged together in * the end, so we skip the extra step. * * Both XXH3_64bits and XXH3_128bits use this subroutine. */ #if (XXH_VECTOR == XXH_AVX512) \ || (defined(XXH_DISPATCH_AVX512) && XXH_DISPATCH_AVX512 != 0) #ifndef XXH_TARGET_AVX512 # define XXH_TARGET_AVX512 /* disable attribute target */ #endif XXH_FORCE_INLINE XXH_TARGET_AVX512 void XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { __m512i* const xacc = (__m512i *) acc; XXH_ASSERT((((size_t)acc) & 63) == 0); XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); { /* data_vec = input[0]; */ __m512i const data_vec = _mm512_loadu_si512 (input); /* key_vec = secret[0]; */ __m512i const key_vec = _mm512_loadu_si512 (secret); /* data_key = data_vec ^ key_vec; */ __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); /* data_key_lo = data_key >> 32; */ __m512i const data_key_lo = _mm512_srli_epi64 (data_key, 32); /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ __m512i const product = _mm512_mul_epu32 (data_key, data_key_lo); /* xacc[0] += swap(data_vec); */ __m512i const data_swap = _mm512_shuffle_epi32(data_vec, (_MM_PERM_ENUM)_MM_SHUFFLE(1, 0, 3, 2)); __m512i const sum = _mm512_add_epi64(*xacc, data_swap); /* xacc[0] += product; */ *xacc = _mm512_add_epi64(product, sum); } } XXH_FORCE_INLINE XXH_TARGET_AVX512 XXH3_ACCUMULATE_TEMPLATE(avx512) /* * XXH3_scrambleAcc: Scrambles the accumulators to improve mixing. * * Multiplication isn't perfect, as explained by Google in HighwayHash: * * // Multiplication mixes/scrambles bytes 0-7 of the 64-bit result to * // varying degrees. In descending order of goodness, bytes * // 3 4 2 5 1 6 0 7 have quality 228 224 164 160 100 96 36 32. * // As expected, the upper and lower bytes are much worse. * * Source: https://github.com/google/highwayhash/blob/0aaf66b/highwayhash/hh_avx2.h#L291 * * Since our algorithm uses a pseudorandom secret to add some variance into the * mix, we don't need to (or want to) mix as often or as much as HighwayHash does. * * This isn't as tight as XXH3_accumulate, but still written in SIMD to avoid * extraction. * * Both XXH3_64bits and XXH3_128bits use this subroutine. */ XXH_FORCE_INLINE XXH_TARGET_AVX512 void XXH3_scrambleAcc_avx512(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 63) == 0); XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); { __m512i* const xacc = (__m512i*) acc; const __m512i prime32 = _mm512_set1_epi32((int)XXH_PRIME32_1); /* xacc[0] ^= (xacc[0] >> 47) */ __m512i const acc_vec = *xacc; __m512i const shifted = _mm512_srli_epi64 (acc_vec, 47); /* xacc[0] ^= secret; */ __m512i const key_vec = _mm512_loadu_si512 (secret); __m512i const data_key = _mm512_ternarylogic_epi32(key_vec, acc_vec, shifted, 0x96 /* key_vec ^ acc_vec ^ shifted */); /* xacc[0] *= XXH_PRIME32_1; */ __m512i const data_key_hi = _mm512_srli_epi64 (data_key, 32); __m512i const prod_lo = _mm512_mul_epu32 (data_key, prime32); __m512i const prod_hi = _mm512_mul_epu32 (data_key_hi, prime32); *xacc = _mm512_add_epi64(prod_lo, _mm512_slli_epi64(prod_hi, 32)); } } XXH_FORCE_INLINE XXH_TARGET_AVX512 void XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) { XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 63) == 0); XXH_STATIC_ASSERT(XXH_SEC_ALIGN == 64); XXH_ASSERT(((size_t)customSecret & 63) == 0); (void)(&XXH_writeLE64); { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m512i); __m512i const seed_pos = _mm512_set1_epi64((xxh_i64)seed64); __m512i const seed = _mm512_mask_sub_epi64(seed_pos, 0xAA, _mm512_set1_epi8(0), seed_pos); const __m512i* const src = (const __m512i*) ((const void*) XXH3_kSecret); __m512i* const dest = ( __m512i*) customSecret; int i; XXH_ASSERT(((size_t)src & 63) == 0); /* control alignment */ XXH_ASSERT(((size_t)dest & 63) == 0); for (i=0; i < nbRounds; ++i) { dest[i] = _mm512_add_epi64(_mm512_load_si512(src + i), seed); } } } #endif #if (XXH_VECTOR == XXH_AVX2) \ || (defined(XXH_DISPATCH_AVX2) && XXH_DISPATCH_AVX2 != 0) #ifndef XXH_TARGET_AVX2 # define XXH_TARGET_AVX2 /* disable attribute target */ #endif XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 31) == 0); { __m256i* const xacc = (__m256i *) acc; /* Unaligned. This is mainly for pointer arithmetic, and because * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ const __m256i* const xinput = (const __m256i *) input; /* Unaligned. This is mainly for pointer arithmetic, and because * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ const __m256i* const xsecret = (const __m256i *) secret; size_t i; for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { /* data_vec = xinput[i]; */ __m256i const data_vec = _mm256_loadu_si256 (xinput+i); /* key_vec = xsecret[i]; */ __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); /* data_key = data_vec ^ key_vec; */ __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); /* data_key_lo = data_key >> 32; */ __m256i const data_key_lo = _mm256_srli_epi64 (data_key, 32); /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ __m256i const product = _mm256_mul_epu32 (data_key, data_key_lo); /* xacc[i] += swap(data_vec); */ __m256i const data_swap = _mm256_shuffle_epi32(data_vec, _MM_SHUFFLE(1, 0, 3, 2)); __m256i const sum = _mm256_add_epi64(xacc[i], data_swap); /* xacc[i] += product; */ xacc[i] = _mm256_add_epi64(product, sum); } } } XXH_FORCE_INLINE XXH_TARGET_AVX2 XXH3_ACCUMULATE_TEMPLATE(avx2) XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 31) == 0); { __m256i* const xacc = (__m256i*) acc; /* Unaligned. This is mainly for pointer arithmetic, and because * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ const __m256i* const xsecret = (const __m256i *) secret; const __m256i prime32 = _mm256_set1_epi32((int)XXH_PRIME32_1); size_t i; for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { /* xacc[i] ^= (xacc[i] >> 47) */ __m256i const acc_vec = xacc[i]; __m256i const shifted = _mm256_srli_epi64 (acc_vec, 47); __m256i const data_vec = _mm256_xor_si256 (acc_vec, shifted); /* xacc[i] ^= xsecret; */ __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); /* xacc[i] *= XXH_PRIME32_1; */ __m256i const data_key_hi = _mm256_srli_epi64 (data_key, 32); __m256i const prod_lo = _mm256_mul_epu32 (data_key, prime32); __m256i const prod_hi = _mm256_mul_epu32 (data_key_hi, prime32); xacc[i] = _mm256_add_epi64(prod_lo, _mm256_slli_epi64(prod_hi, 32)); } } } XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_initCustomSecret_avx2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) { XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 31) == 0); XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE / sizeof(__m256i)) == 6); XXH_STATIC_ASSERT(XXH_SEC_ALIGN <= 64); (void)(&XXH_writeLE64); XXH_PREFETCH(customSecret); { __m256i const seed = _mm256_set_epi64x((xxh_i64)(0U - seed64), (xxh_i64)seed64, (xxh_i64)(0U - seed64), (xxh_i64)seed64); const __m256i* const src = (const __m256i*) ((const void*) XXH3_kSecret); __m256i* dest = ( __m256i*) customSecret; # if defined(__GNUC__) || defined(__clang__) /* * On GCC & Clang, marking 'dest' as modified will cause the compiler: * - do not extract the secret from sse registers in the internal loop * - use less common registers, and avoid pushing these reg into stack */ XXH_COMPILER_GUARD(dest); # endif XXH_ASSERT(((size_t)src & 31) == 0); /* control alignment */ XXH_ASSERT(((size_t)dest & 31) == 0); /* GCC -O2 need unroll loop manually */ dest[0] = _mm256_add_epi64(_mm256_load_si256(src+0), seed); dest[1] = _mm256_add_epi64(_mm256_load_si256(src+1), seed); dest[2] = _mm256_add_epi64(_mm256_load_si256(src+2), seed); dest[3] = _mm256_add_epi64(_mm256_load_si256(src+3), seed); dest[4] = _mm256_add_epi64(_mm256_load_si256(src+4), seed); dest[5] = _mm256_add_epi64(_mm256_load_si256(src+5), seed); } } #endif /* x86dispatch always generates SSE2 */ #if (XXH_VECTOR == XXH_SSE2) || defined(XXH_X86DISPATCH) #ifndef XXH_TARGET_SSE2 # define XXH_TARGET_SSE2 /* disable attribute target */ #endif XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_accumulate_512_sse2( void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { /* SSE2 is just a half-scale version of the AVX2 version. */ XXH_ASSERT((((size_t)acc) & 15) == 0); { __m128i* const xacc = (__m128i *) acc; /* Unaligned. This is mainly for pointer arithmetic, and because * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ const __m128i* const xinput = (const __m128i *) input; /* Unaligned. This is mainly for pointer arithmetic, and because * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ const __m128i* const xsecret = (const __m128i *) secret; size_t i; for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { /* data_vec = xinput[i]; */ __m128i const data_vec = _mm_loadu_si128 (xinput+i); /* key_vec = xsecret[i]; */ __m128i const key_vec = _mm_loadu_si128 (xsecret+i); /* data_key = data_vec ^ key_vec; */ __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); /* data_key_lo = data_key >> 32; */ __m128i const data_key_lo = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ __m128i const product = _mm_mul_epu32 (data_key, data_key_lo); /* xacc[i] += swap(data_vec); */ __m128i const data_swap = _mm_shuffle_epi32(data_vec, _MM_SHUFFLE(1,0,3,2)); __m128i const sum = _mm_add_epi64(xacc[i], data_swap); /* xacc[i] += product; */ xacc[i] = _mm_add_epi64(product, sum); } } } XXH_FORCE_INLINE XXH_TARGET_SSE2 XXH3_ACCUMULATE_TEMPLATE(sse2) XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_scrambleAcc_sse2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 15) == 0); { __m128i* const xacc = (__m128i*) acc; /* Unaligned. This is mainly for pointer arithmetic, and because * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ const __m128i* const xsecret = (const __m128i *) secret; const __m128i prime32 = _mm_set1_epi32((int)XXH_PRIME32_1); size_t i; for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { /* xacc[i] ^= (xacc[i] >> 47) */ __m128i const acc_vec = xacc[i]; __m128i const shifted = _mm_srli_epi64 (acc_vec, 47); __m128i const data_vec = _mm_xor_si128 (acc_vec, shifted); /* xacc[i] ^= xsecret[i]; */ __m128i const key_vec = _mm_loadu_si128 (xsecret+i); __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); /* xacc[i] *= XXH_PRIME32_1; */ __m128i const data_key_hi = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); __m128i const prod_lo = _mm_mul_epu32 (data_key, prime32); __m128i const prod_hi = _mm_mul_epu32 (data_key_hi, prime32); xacc[i] = _mm_add_epi64(prod_lo, _mm_slli_epi64(prod_hi, 32)); } } } XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_initCustomSecret_sse2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) { XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); (void)(&XXH_writeLE64); { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m128i); # if defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER < 1900 /* MSVC 32bit mode does not support _mm_set_epi64x before 2015 */ XXH_ALIGN(16) const xxh_i64 seed64x2[2] = { (xxh_i64)seed64, (xxh_i64)(0U - seed64) }; __m128i const seed = _mm_load_si128((__m128i const*)seed64x2); # else __m128i const seed = _mm_set_epi64x((xxh_i64)(0U - seed64), (xxh_i64)seed64); # endif int i; const void* const src16 = XXH3_kSecret; __m128i* dst16 = (__m128i*) customSecret; # if defined(__GNUC__) || defined(__clang__) /* * On GCC & Clang, marking 'dest' as modified will cause the compiler: * - do not extract the secret from sse registers in the internal loop * - use less common registers, and avoid pushing these reg into stack */ XXH_COMPILER_GUARD(dst16); # endif XXH_ASSERT(((size_t)src16 & 15) == 0); /* control alignment */ XXH_ASSERT(((size_t)dst16 & 15) == 0); for (i=0; i < nbRounds; ++i) { dst16[i] = _mm_add_epi64(_mm_load_si128((const __m128i *)src16+i), seed); } } } #endif #if (XXH_VECTOR == XXH_NEON) /* forward declarations for the scalar routines */ XXH_FORCE_INLINE void XXH3_scalarRound(void* XXH_RESTRICT acc, void const* XXH_RESTRICT input, void const* XXH_RESTRICT secret, size_t lane); XXH_FORCE_INLINE void XXH3_scalarScrambleRound(void* XXH_RESTRICT acc, void const* XXH_RESTRICT secret, size_t lane); /*! * @internal * @brief The bulk processing loop for NEON and WASM SIMD128. * * The NEON code path is actually partially scalar when running on AArch64. This * is to optimize the pipelining and can have up to 15% speedup depending on the * CPU, and it also mitigates some GCC codegen issues. * * @see XXH3_NEON_LANES for configuring this and details about this optimization. * * NEON's 32-bit to 64-bit long multiply takes a half vector of 32-bit * integers instead of the other platforms which mask full 64-bit vectors, * so the setup is more complicated than just shifting right. * * Additionally, there is an optimization for 4 lanes at once noted below. * * Since, as stated, the most optimal amount of lanes for Cortexes is 6, * there needs to be *three* versions of the accumulate operation used * for the remaining 2 lanes. * * WASM's SIMD128 uses SIMDe's arm_neon.h polyfill because the intrinsics overlap * nearly perfectly. */ XXH_FORCE_INLINE void XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 15) == 0); XXH_STATIC_ASSERT(XXH3_NEON_LANES > 0 && XXH3_NEON_LANES <= XXH_ACC_NB && XXH3_NEON_LANES % 2 == 0); { /* GCC for darwin arm64 does not like aliasing here */ xxh_aliasing_uint64x2_t* const xacc = (xxh_aliasing_uint64x2_t*) acc; /* We don't use a uint32x4_t pointer because it causes bus errors on ARMv7. */ uint8_t const* xinput = (const uint8_t *) input; uint8_t const* xsecret = (const uint8_t *) secret; size_t i; #ifdef __wasm_simd128__ /* * On WASM SIMD128, Clang emits direct address loads when XXH3_kSecret * is constant propagated, which results in it converting it to this * inside the loop: * * a = v128.load(XXH3_kSecret + 0 + $secret_offset, offset = 0) * b = v128.load(XXH3_kSecret + 16 + $secret_offset, offset = 0) * ... * * This requires a full 32-bit address immediate (and therefore a 6 byte * instruction) as well as an add for each offset. * * Putting an asm guard prevents it from folding (at the cost of losing * the alignment hint), and uses the free offset in `v128.load` instead * of adding secret_offset each time which overall reduces code size by * about a kilobyte and improves performance. */ XXH_COMPILER_GUARD(xsecret); #endif /* Scalar lanes use the normal scalarRound routine */ for (i = XXH3_NEON_LANES; i < XXH_ACC_NB; i++) { XXH3_scalarRound(acc, input, secret, i); } i = 0; /* 4 NEON lanes at a time. */ for (; i+1 < XXH3_NEON_LANES / 2; i+=2) { /* data_vec = xinput[i]; */ uint64x2_t data_vec_1 = XXH_vld1q_u64(xinput + (i * 16)); uint64x2_t data_vec_2 = XXH_vld1q_u64(xinput + ((i+1) * 16)); /* key_vec = xsecret[i]; */ uint64x2_t key_vec_1 = XXH_vld1q_u64(xsecret + (i * 16)); uint64x2_t key_vec_2 = XXH_vld1q_u64(xsecret + ((i+1) * 16)); /* data_swap = swap(data_vec) */ uint64x2_t data_swap_1 = vextq_u64(data_vec_1, data_vec_1, 1); uint64x2_t data_swap_2 = vextq_u64(data_vec_2, data_vec_2, 1); /* data_key = data_vec ^ key_vec; */ uint64x2_t data_key_1 = veorq_u64(data_vec_1, key_vec_1); uint64x2_t data_key_2 = veorq_u64(data_vec_2, key_vec_2); /* * If we reinterpret the 64x2 vectors as 32x4 vectors, we can use a * de-interleave operation for 4 lanes in 1 step with `vuzpq_u32` to * get one vector with the low 32 bits of each lane, and one vector * with the high 32 bits of each lane. * * The intrinsic returns a double vector because the original ARMv7-a * instruction modified both arguments in place. AArch64 and SIMD128 emit * two instructions from this intrinsic. * * [ dk11L | dk11H | dk12L | dk12H ] -> [ dk11L | dk12L | dk21L | dk22L ] * [ dk21L | dk21H | dk22L | dk22H ] -> [ dk11H | dk12H | dk21H | dk22H ] */ uint32x4x2_t unzipped = vuzpq_u32( vreinterpretq_u32_u64(data_key_1), vreinterpretq_u32_u64(data_key_2) ); /* data_key_lo = data_key & 0xFFFFFFFF */ uint32x4_t data_key_lo = unzipped.val[0]; /* data_key_hi = data_key >> 32 */ uint32x4_t data_key_hi = unzipped.val[1]; /* * Then, we can split the vectors horizontally and multiply which, as for most * widening intrinsics, have a variant that works on both high half vectors * for free on AArch64. A similar instruction is available on SIMD128. * * sum = data_swap + (u64x2) data_key_lo * (u64x2) data_key_hi */ uint64x2_t sum_1 = XXH_vmlal_low_u32(data_swap_1, data_key_lo, data_key_hi); uint64x2_t sum_2 = XXH_vmlal_high_u32(data_swap_2, data_key_lo, data_key_hi); /* * Clang reorders * a += b * c; // umlal swap.2d, dkl.2s, dkh.2s * c += a; // add acc.2d, acc.2d, swap.2d * to * c += a; // add acc.2d, acc.2d, swap.2d * c += b * c; // umlal acc.2d, dkl.2s, dkh.2s * * While it would make sense in theory since the addition is faster, * for reasons likely related to umlal being limited to certain NEON * pipelines, this is worse. A compiler guard fixes this. */ XXH_COMPILER_GUARD_CLANG_NEON(sum_1); XXH_COMPILER_GUARD_CLANG_NEON(sum_2); /* xacc[i] = acc_vec + sum; */ xacc[i] = vaddq_u64(xacc[i], sum_1); xacc[i+1] = vaddq_u64(xacc[i+1], sum_2); } /* Operate on the remaining NEON lanes 2 at a time. */ for (; i < XXH3_NEON_LANES / 2; i++) { /* data_vec = xinput[i]; */ uint64x2_t data_vec = XXH_vld1q_u64(xinput + (i * 16)); /* key_vec = xsecret[i]; */ uint64x2_t key_vec = XXH_vld1q_u64(xsecret + (i * 16)); /* acc_vec_2 = swap(data_vec) */ uint64x2_t data_swap = vextq_u64(data_vec, data_vec, 1); /* data_key = data_vec ^ key_vec; */ uint64x2_t data_key = veorq_u64(data_vec, key_vec); /* For two lanes, just use VMOVN and VSHRN. */ /* data_key_lo = data_key & 0xFFFFFFFF; */ uint32x2_t data_key_lo = vmovn_u64(data_key); /* data_key_hi = data_key >> 32; */ uint32x2_t data_key_hi = vshrn_n_u64(data_key, 32); /* sum = data_swap + (u64x2) data_key_lo * (u64x2) data_key_hi; */ uint64x2_t sum = vmlal_u32(data_swap, data_key_lo, data_key_hi); /* Same Clang workaround as before */ XXH_COMPILER_GUARD_CLANG_NEON(sum); /* xacc[i] = acc_vec + sum; */ xacc[i] = vaddq_u64 (xacc[i], sum); } } } XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(neon) XXH_FORCE_INLINE void XXH3_scrambleAcc_neon(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 15) == 0); { xxh_aliasing_uint64x2_t* xacc = (xxh_aliasing_uint64x2_t*) acc; uint8_t const* xsecret = (uint8_t const*) secret; size_t i; /* WASM uses operator overloads and doesn't need these. */ #ifndef __wasm_simd128__ /* { prime32_1, prime32_1 } */ uint32x2_t const kPrimeLo = vdup_n_u32(XXH_PRIME32_1); /* { 0, prime32_1, 0, prime32_1 } */ uint32x4_t const kPrimeHi = vreinterpretq_u32_u64(vdupq_n_u64((xxh_u64)XXH_PRIME32_1 << 32)); #endif /* AArch64 uses both scalar and neon at the same time */ for (i = XXH3_NEON_LANES; i < XXH_ACC_NB; i++) { XXH3_scalarScrambleRound(acc, secret, i); } for (i=0; i < XXH3_NEON_LANES / 2; i++) { /* xacc[i] ^= (xacc[i] >> 47); */ uint64x2_t acc_vec = xacc[i]; uint64x2_t shifted = vshrq_n_u64(acc_vec, 47); uint64x2_t data_vec = veorq_u64(acc_vec, shifted); /* xacc[i] ^= xsecret[i]; */ uint64x2_t key_vec = XXH_vld1q_u64(xsecret + (i * 16)); uint64x2_t data_key = veorq_u64(data_vec, key_vec); /* xacc[i] *= XXH_PRIME32_1 */ #ifdef __wasm_simd128__ /* SIMD128 has multiply by u64x2, use it instead of expanding and scalarizing */ xacc[i] = data_key * XXH_PRIME32_1; #else /* * Expanded version with portable NEON intrinsics * * lo(x) * lo(y) + (hi(x) * lo(y) << 32) * * prod_hi = hi(data_key) * lo(prime) << 32 * * Since we only need 32 bits of this multiply a trick can be used, reinterpreting the vector * as a uint32x4_t and multiplying by { 0, prime, 0, prime } to cancel out the unwanted bits * and avoid the shift. */ uint32x4_t prod_hi = vmulq_u32 (vreinterpretq_u32_u64(data_key), kPrimeHi); /* Extract low bits for vmlal_u32 */ uint32x2_t data_key_lo = vmovn_u64(data_key); /* xacc[i] = prod_hi + lo(data_key) * XXH_PRIME32_1; */ xacc[i] = vmlal_u32(vreinterpretq_u64_u32(prod_hi), data_key_lo, kPrimeLo); #endif } } } #endif #if (XXH_VECTOR == XXH_VSX) XXH_FORCE_INLINE void XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { /* presumed aligned */ xxh_aliasing_u64x2* const xacc = (xxh_aliasing_u64x2*) acc; xxh_u8 const* const xinput = (xxh_u8 const*) input; /* no alignment restriction */ xxh_u8 const* const xsecret = (xxh_u8 const*) secret; /* no alignment restriction */ xxh_u64x2 const v32 = { 32, 32 }; size_t i; for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { /* data_vec = xinput[i]; */ xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + 16*i); /* key_vec = xsecret[i]; */ xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + 16*i); xxh_u64x2 const data_key = data_vec ^ key_vec; /* shuffled = (data_key << 32) | (data_key >> 32); */ xxh_u32x4 const shuffled = (xxh_u32x4)vec_rl(data_key, v32); /* product = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)shuffled & 0xFFFFFFFF); */ xxh_u64x2 const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled); /* acc_vec = xacc[i]; */ xxh_u64x2 acc_vec = xacc[i]; acc_vec += product; /* swap high and low halves */ #ifdef __s390x__ acc_vec += vec_permi(data_vec, data_vec, 2); #else acc_vec += vec_xxpermdi(data_vec, data_vec, 2); #endif xacc[i] = acc_vec; } } XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(vsx) XXH_FORCE_INLINE void XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 15) == 0); { xxh_aliasing_u64x2* const xacc = (xxh_aliasing_u64x2*) acc; const xxh_u8* const xsecret = (const xxh_u8*) secret; /* constants */ xxh_u64x2 const v32 = { 32, 32 }; xxh_u64x2 const v47 = { 47, 47 }; xxh_u32x4 const prime = { XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1 }; size_t i; for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { /* xacc[i] ^= (xacc[i] >> 47); */ xxh_u64x2 const acc_vec = xacc[i]; xxh_u64x2 const data_vec = acc_vec ^ (acc_vec >> v47); /* xacc[i] ^= xsecret[i]; */ xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + 16*i); xxh_u64x2 const data_key = data_vec ^ key_vec; /* xacc[i] *= XXH_PRIME32_1 */ /* prod_lo = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)prime & 0xFFFFFFFF); */ xxh_u64x2 const prod_even = XXH_vec_mule((xxh_u32x4)data_key, prime); /* prod_hi = ((xxh_u64x2)data_key >> 32) * ((xxh_u64x2)prime >> 32); */ xxh_u64x2 const prod_odd = XXH_vec_mulo((xxh_u32x4)data_key, prime); xacc[i] = prod_odd + (prod_even << v32); } } } #endif #if (XXH_VECTOR == XXH_SVE) XXH_FORCE_INLINE void XXH3_accumulate_512_sve( void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { uint64_t *xacc = (uint64_t *)acc; const uint64_t *xinput = (const uint64_t *)(const void *)input; const uint64_t *xsecret = (const uint64_t *)(const void *)secret; svuint64_t kSwap = sveor_n_u64_z(svptrue_b64(), svindex_u64(0, 1), 1); uint64_t element_count = svcntd(); if (element_count >= 8) { svbool_t mask = svptrue_pat_b64(SV_VL8); svuint64_t vacc = svld1_u64(mask, xacc); ACCRND(vacc, 0); svst1_u64(mask, xacc, vacc); } else if (element_count == 2) { /* sve128 */ svbool_t mask = svptrue_pat_b64(SV_VL2); svuint64_t acc0 = svld1_u64(mask, xacc + 0); svuint64_t acc1 = svld1_u64(mask, xacc + 2); svuint64_t acc2 = svld1_u64(mask, xacc + 4); svuint64_t acc3 = svld1_u64(mask, xacc + 6); ACCRND(acc0, 0); ACCRND(acc1, 2); ACCRND(acc2, 4); ACCRND(acc3, 6); svst1_u64(mask, xacc + 0, acc0); svst1_u64(mask, xacc + 2, acc1); svst1_u64(mask, xacc + 4, acc2); svst1_u64(mask, xacc + 6, acc3); } else { svbool_t mask = svptrue_pat_b64(SV_VL4); svuint64_t acc0 = svld1_u64(mask, xacc + 0); svuint64_t acc1 = svld1_u64(mask, xacc + 4); ACCRND(acc0, 0); ACCRND(acc1, 4); svst1_u64(mask, xacc + 0, acc0); svst1_u64(mask, xacc + 4, acc1); } } XXH_FORCE_INLINE void XXH3_accumulate_sve(xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT input, const xxh_u8* XXH_RESTRICT secret, size_t nbStripes) { if (nbStripes != 0) { uint64_t *xacc = (uint64_t *)acc; const uint64_t *xinput = (const uint64_t *)(const void *)input; const uint64_t *xsecret = (const uint64_t *)(const void *)secret; svuint64_t kSwap = sveor_n_u64_z(svptrue_b64(), svindex_u64(0, 1), 1); uint64_t element_count = svcntd(); if (element_count >= 8) { svbool_t mask = svptrue_pat_b64(SV_VL8); svuint64_t vacc = svld1_u64(mask, xacc + 0); do { /* svprfd(svbool_t, void *, enum svfprop); */ svprfd(mask, xinput + 128, SV_PLDL1STRM); ACCRND(vacc, 0); xinput += 8; xsecret += 1; nbStripes--; } while (nbStripes != 0); svst1_u64(mask, xacc + 0, vacc); } else if (element_count == 2) { /* sve128 */ svbool_t mask = svptrue_pat_b64(SV_VL2); svuint64_t acc0 = svld1_u64(mask, xacc + 0); svuint64_t acc1 = svld1_u64(mask, xacc + 2); svuint64_t acc2 = svld1_u64(mask, xacc + 4); svuint64_t acc3 = svld1_u64(mask, xacc + 6); do { svprfd(mask, xinput + 128, SV_PLDL1STRM); ACCRND(acc0, 0); ACCRND(acc1, 2); ACCRND(acc2, 4); ACCRND(acc3, 6); xinput += 8; xsecret += 1; nbStripes--; } while (nbStripes != 0); svst1_u64(mask, xacc + 0, acc0); svst1_u64(mask, xacc + 2, acc1); svst1_u64(mask, xacc + 4, acc2); svst1_u64(mask, xacc + 6, acc3); } else { svbool_t mask = svptrue_pat_b64(SV_VL4); svuint64_t acc0 = svld1_u64(mask, xacc + 0); svuint64_t acc1 = svld1_u64(mask, xacc + 4); do { svprfd(mask, xinput + 128, SV_PLDL1STRM); ACCRND(acc0, 0); ACCRND(acc1, 4); xinput += 8; xsecret += 1; nbStripes--; } while (nbStripes != 0); svst1_u64(mask, xacc + 0, acc0); svst1_u64(mask, xacc + 4, acc1); } } } #endif /* scalar variants - universal */ #if defined(__aarch64__) && (defined(__GNUC__) || defined(__clang__)) /* * In XXH3_scalarRound(), GCC and Clang have a similar codegen issue, where they * emit an excess mask and a full 64-bit multiply-add (MADD X-form). * * While this might not seem like much, as AArch64 is a 64-bit architecture, only * big Cortex designs have a full 64-bit multiplier. * * On the little cores, the smaller 32-bit multiplier is used, and full 64-bit * multiplies expand to 2-3 multiplies in microcode. This has a major penalty * of up to 4 latency cycles and 2 stall cycles in the multiply pipeline. * * Thankfully, AArch64 still provides the 32-bit long multiply-add (UMADDL) which does * not have this penalty and does the mask automatically. */ XXH_FORCE_INLINE xxh_u64 XXH_mult32to64_add64(xxh_u64 lhs, xxh_u64 rhs, xxh_u64 acc) { xxh_u64 ret; /* note: %x = 64-bit register, %w = 32-bit register */ __asm__("umaddl %x0, %w1, %w2, %x3" : "=r" (ret) : "r" (lhs), "r" (rhs), "r" (acc)); return ret; } #else XXH_FORCE_INLINE xxh_u64 XXH_mult32to64_add64(xxh_u64 lhs, xxh_u64 rhs, xxh_u64 acc) { return XXH_mult32to64((xxh_u32)lhs, (xxh_u32)rhs) + acc; } #endif /*! * @internal * @brief Scalar round for @ref XXH3_accumulate_512_scalar(). * * This is extracted to its own function because the NEON path uses a combination * of NEON and scalar. */ XXH_FORCE_INLINE void XXH3_scalarRound(void* XXH_RESTRICT acc, void const* XXH_RESTRICT input, void const* XXH_RESTRICT secret, size_t lane) { xxh_u64* xacc = (xxh_u64*) acc; xxh_u8 const* xinput = (xxh_u8 const*) input; xxh_u8 const* xsecret = (xxh_u8 const*) secret; XXH_ASSERT(lane < XXH_ACC_NB); XXH_ASSERT(((size_t)acc & (XXH_ACC_ALIGN-1)) == 0); { xxh_u64 const data_val = XXH_readLE64(xinput + lane * 8); xxh_u64 const data_key = data_val ^ XXH_readLE64(xsecret + lane * 8); xacc[lane ^ 1] += data_val; /* swap adjacent lanes */ xacc[lane] = XXH_mult32to64_add64(data_key /* & 0xFFFFFFFF */, data_key >> 32, xacc[lane]); } } /*! * @internal * @brief Processes a 64 byte block of data using the scalar path. */ XXH_FORCE_INLINE void XXH3_accumulate_512_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { size_t i; /* ARM GCC refuses to unroll this loop, resulting in a 24% slowdown on ARMv6. */ #if defined(__GNUC__) && !defined(__clang__) \ && (defined(__arm__) || defined(__thumb2__)) \ && defined(__ARM_FEATURE_UNALIGNED) /* no unaligned access just wastes bytes */ \ && XXH_SIZE_OPT <= 0 # pragma GCC unroll 8 #endif for (i=0; i < XXH_ACC_NB; i++) { XXH3_scalarRound(acc, input, secret, i); } } XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(scalar) /*! * @internal * @brief Scalar scramble step for @ref XXH3_scrambleAcc_scalar(). * * This is extracted to its own function because the NEON path uses a combination * of NEON and scalar. */ XXH_FORCE_INLINE void XXH3_scalarScrambleRound(void* XXH_RESTRICT acc, void const* XXH_RESTRICT secret, size_t lane) { xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ XXH_ASSERT((((size_t)acc) & (XXH_ACC_ALIGN-1)) == 0); XXH_ASSERT(lane < XXH_ACC_NB); { xxh_u64 const key64 = XXH_readLE64(xsecret + lane * 8); xxh_u64 acc64 = xacc[lane]; acc64 = XXH_xorshift64(acc64, 47); acc64 ^= key64; acc64 *= XXH_PRIME32_1; xacc[lane] = acc64; } } /*! * @internal * @brief Scrambles the accumulators after a large chunk has been read */ XXH_FORCE_INLINE void XXH3_scrambleAcc_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { size_t i; for (i=0; i < XXH_ACC_NB; i++) { XXH3_scalarScrambleRound(acc, secret, i); } } XXH_FORCE_INLINE void XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) { /* * We need a separate pointer for the hack below, * which requires a non-const pointer. * Any decent compiler will optimize this out otherwise. */ const xxh_u8* kSecretPtr = XXH3_kSecret; XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); #if defined(__GNUC__) && defined(__aarch64__) /* * UGLY HACK: * GCC and Clang generate a bunch of MOV/MOVK pairs for aarch64, and they are * placed sequentially, in order, at the top of the unrolled loop. * * While MOVK is great for generating constants (2 cycles for a 64-bit * constant compared to 4 cycles for LDR), it fights for bandwidth with * the arithmetic instructions. * * I L S * MOVK * MOVK * MOVK * MOVK * ADD * SUB STR * STR * By forcing loads from memory (as the asm line causes the compiler to assume * that XXH3_kSecretPtr has been changed), the pipelines are used more * efficiently: * I L S * LDR * ADD LDR * SUB STR * STR * * See XXH3_NEON_LANES for details on the pipsline. * * XXH3_64bits_withSeed, len == 256, Snapdragon 835 * without hack: 2654.4 MB/s * with hack: 3202.9 MB/s */ XXH_COMPILER_GUARD(kSecretPtr); #endif { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / 16; int i; for (i=0; i < nbRounds; i++) { /* * The asm hack causes the compiler to assume that kSecretPtr aliases with * customSecret, and on aarch64, this prevented LDP from merging two * loads together for free. Putting the loads together before the stores * properly generates LDP. */ xxh_u64 lo = XXH_readLE64(kSecretPtr + 16*i) + seed64; xxh_u64 hi = XXH_readLE64(kSecretPtr + 16*i + 8) - seed64; XXH_writeLE64((xxh_u8*)customSecret + 16*i, lo); XXH_writeLE64((xxh_u8*)customSecret + 16*i + 8, hi); } } } typedef void (*XXH3_f_accumulate)(xxh_u64* XXH_RESTRICT, const xxh_u8* XXH_RESTRICT, const xxh_u8* XXH_RESTRICT, size_t); typedef void (*XXH3_f_scrambleAcc)(void* XXH_RESTRICT, const void*); typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); #if (XXH_VECTOR == XXH_AVX512) #define XXH3_accumulate_512 XXH3_accumulate_512_avx512 #define XXH3_accumulate XXH3_accumulate_avx512 #define XXH3_scrambleAcc XXH3_scrambleAcc_avx512 #define XXH3_initCustomSecret XXH3_initCustomSecret_avx512 #elif (XXH_VECTOR == XXH_AVX2) #define XXH3_accumulate_512 XXH3_accumulate_512_avx2 #define XXH3_accumulate XXH3_accumulate_avx2 #define XXH3_scrambleAcc XXH3_scrambleAcc_avx2 #define XXH3_initCustomSecret XXH3_initCustomSecret_avx2 #elif (XXH_VECTOR == XXH_SSE2) #define XXH3_accumulate_512 XXH3_accumulate_512_sse2 #define XXH3_accumulate XXH3_accumulate_sse2 #define XXH3_scrambleAcc XXH3_scrambleAcc_sse2 #define XXH3_initCustomSecret XXH3_initCustomSecret_sse2 #elif (XXH_VECTOR == XXH_NEON) #define XXH3_accumulate_512 XXH3_accumulate_512_neon #define XXH3_accumulate XXH3_accumulate_neon #define XXH3_scrambleAcc XXH3_scrambleAcc_neon #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #elif (XXH_VECTOR == XXH_VSX) #define XXH3_accumulate_512 XXH3_accumulate_512_vsx #define XXH3_accumulate XXH3_accumulate_vsx #define XXH3_scrambleAcc XXH3_scrambleAcc_vsx #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #elif (XXH_VECTOR == XXH_SVE) #define XXH3_accumulate_512 XXH3_accumulate_512_sve #define XXH3_accumulate XXH3_accumulate_sve #define XXH3_scrambleAcc XXH3_scrambleAcc_scalar #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #else /* scalar */ #define XXH3_accumulate_512 XXH3_accumulate_512_scalar #define XXH3_accumulate XXH3_accumulate_scalar #define XXH3_scrambleAcc XXH3_scrambleAcc_scalar #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #endif #if XXH_SIZE_OPT >= 1 /* don't do SIMD for initialization */ # undef XXH3_initCustomSecret # define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #endif XXH_FORCE_INLINE void XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { size_t const nbStripesPerBlock = (secretSize - XXH_STRIPE_LEN) / XXH_SECRET_CONSUME_RATE; size_t const block_len = XXH_STRIPE_LEN * nbStripesPerBlock; size_t const nb_blocks = (len - 1) / block_len; size_t n; XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); for (n = 0; n < nb_blocks; n++) { f_acc(acc, input + n*block_len, secret, nbStripesPerBlock); f_scramble(acc, secret + secretSize - XXH_STRIPE_LEN); } /* last partial block */ XXH_ASSERT(len > XXH_STRIPE_LEN); { size_t const nbStripes = ((len - 1) - (block_len * nb_blocks)) / XXH_STRIPE_LEN; XXH_ASSERT(nbStripes <= (secretSize / XXH_SECRET_CONSUME_RATE)); f_acc(acc, input + nb_blocks*block_len, secret, nbStripes); /* last stripe */ { const xxh_u8* const p = input + len - XXH_STRIPE_LEN; #define XXH_SECRET_LASTACC_START 7 /* not aligned on 8, last secret is different from acc & scrambler */ XXH3_accumulate_512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); } } } XXH_FORCE_INLINE xxh_u64 XXH3_mix2Accs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret) { return XXH3_mul128_fold64( acc[0] ^ XXH_readLE64(secret), acc[1] ^ XXH_readLE64(secret+8) ); } static XXH64_hash_t XXH3_mergeAccs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret, xxh_u64 start) { xxh_u64 result64 = start; size_t i = 0; for (i = 0; i < 4; i++) { result64 += XXH3_mix2Accs(acc+2*i, secret + 16*i); #if defined(__clang__) /* Clang */ \ && (defined(__arm__) || defined(__thumb__)) /* ARMv7 */ \ && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ /* * UGLY HACK: * Prevent autovectorization on Clang ARMv7-a. Exact same problem as * the one in XXH3_len_129to240_64b. Speeds up shorter keys > 240b. * XXH3_64bits, len == 256, Snapdragon 835: * without hack: 2063.7 MB/s * with hack: 2560.7 MB/s */ XXH_COMPILER_GUARD(result64); #endif } return XXH3_avalanche(result64); } #define XXH3_INIT_ACC { XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, XXH_PRIME64_3, \ XXH_PRIME64_4, XXH_PRIME32_2, XXH_PRIME64_5, XXH_PRIME32_1 } XXH_FORCE_INLINE XXH64_hash_t XXH3_hashLong_64b_internal(const void* XXH_RESTRICT input, size_t len, const void* XXH_RESTRICT secret, size_t secretSize, XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc, f_scramble); /* converge into final hash */ XXH_STATIC_ASSERT(sizeof(acc) == 64); /* do not align on 8, so that the secret is different from the accumulator */ #define XXH_SECRET_MERGEACCS_START 11 XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); return XXH3_mergeAccs(acc, (const xxh_u8*)secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)len * XXH_PRIME64_1); } /* * It's important for performance to transmit secret's size (when it's static) * so that the compiler can properly optimize the vectorized loop. * This makes a big performance difference for "medium" keys (<1 KB) when using AVX instruction set. * When the secret size is unknown, or on GCC 12 where the mix of NO_INLINE and FORCE_INLINE * breaks -Og, this is XXH_NO_INLINE. */ XXH3_WITH_SECRET_INLINE XXH64_hash_t XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate, XXH3_scrambleAcc); } /* * It's preferable for performance that XXH3_hashLong is not inlined, * as it results in a smaller function for small data, easier to the instruction cache. * Note that inside this no_inline function, we do inline the internal loop, * and provide a statically defined secret size to allow optimization of vector loop. */ XXH_NO_INLINE XXH_PUREF XXH64_hash_t XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate, XXH3_scrambleAcc); } /* * XXH3_hashLong_64b_withSeed(): * Generate a custom key based on alteration of default XXH3_kSecret with the seed, * and then use this key for long mode hashing. * * This operation is decently fast but nonetheless costs a little bit of time. * Try to avoid it whenever possible (typically when seed==0). * * It's important for performance that XXH3_hashLong is not inlined. Not sure * why (uop cache maybe?), but the difference is large and easily measurable. */ XXH_FORCE_INLINE XXH64_hash_t XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, XXH64_hash_t seed, XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble, XXH3_f_initCustomSecret f_initSec) { #if XXH_SIZE_OPT <= 0 if (seed == 0) return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), f_acc, f_scramble); #endif { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; f_initSec(secret, seed); return XXH3_hashLong_64b_internal(input, len, secret, sizeof(secret), f_acc, f_scramble); } } /* * It's important for performance that XXH3_hashLong is not inlined. */ XXH_NO_INLINE XXH64_hash_t XXH3_hashLong_64b_withSeed(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)secret; (void)secretLen; return XXH3_hashLong_64b_withSeed_internal(input, len, seed, XXH3_accumulate, XXH3_scrambleAcc, XXH3_initCustomSecret); } typedef XXH64_hash_t (*XXH3_hashLong64_f)(const void* XXH_RESTRICT, size_t, XXH64_hash_t, const xxh_u8* XXH_RESTRICT, size_t); XXH_FORCE_INLINE XXH64_hash_t XXH3_64bits_internal(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, XXH3_hashLong64_f f_hashLong) { XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); /* * If an action is to be taken if `secretLen` condition is not respected, * it should be done here. * For now, it's a contract pre-condition. * Adding a check and a branch here would cost performance at every hash. * Also, note that function signature doesn't offer room to return an error. */ if (len <= 16) return XXH3_len_0to16_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); if (len <= 128) return XXH3_len_17to128_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); if (len <= XXH3_MIDSIZE_MAX) return XXH3_len_129to240_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); return f_hashLong(input, len, seed64, (const xxh_u8*)secret, secretLen); } /* === Public entry point === */ /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(XXH_NOESCAPE const void* input, size_t length) { return XXH3_64bits_internal(input, length, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(XXH_NOESCAPE const void* input, size_t length, XXH_NOESCAPE const void* secret, size_t secretSize) { return XXH3_64bits_internal(input, length, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed) { return XXH3_64bits_internal(input, length, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); } XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t length, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { if (length <= XXH3_MIDSIZE_MAX) return XXH3_64bits_internal(input, length, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); return XXH3_hashLong_64b_withSecret(input, length, seed, (const xxh_u8*)secret, secretSize); } /* === XXH3 streaming === */ #ifndef XXH_NO_STREAM /* * Malloc's a pointer that is always aligned to align. * * This must be freed with `XXH_alignedFree()`. * * malloc typically guarantees 16 byte alignment on 64-bit systems and 8 byte * alignment on 32-bit. This isn't enough for the 32 byte aligned loads in AVX2 * or on 32-bit, the 16 byte aligned loads in SSE2 and NEON. * * This underalignment previously caused a rather obvious crash which went * completely unnoticed due to XXH3_createState() not actually being tested. * Credit to RedSpah for noticing this bug. * * The alignment is done manually: Functions like posix_memalign or _mm_malloc * are avoided: To maintain portability, we would have to write a fallback * like this anyways, and besides, testing for the existence of library * functions without relying on external build tools is impossible. * * The method is simple: Overallocate, manually align, and store the offset * to the original behind the returned pointer. * * Align must be a power of 2 and 8 <= align <= 128. */ static XXH_MALLOCF void* XXH_alignedMalloc(size_t s, size_t align) { XXH_ASSERT(align <= 128 && align >= 8); /* range check */ XXH_ASSERT((align & (align-1)) == 0); /* power of 2 */ XXH_ASSERT(s != 0 && s < (s + align)); /* empty/overflow */ { /* Overallocate to make room for manual realignment and an offset byte */ xxh_u8* base = (xxh_u8*)XXH_malloc(s + align); if (base != NULL) { /* * Get the offset needed to align this pointer. * * Even if the returned pointer is aligned, there will always be * at least one byte to store the offset to the original pointer. */ size_t offset = align - ((size_t)base & (align - 1)); /* base % align */ /* Add the offset for the now-aligned pointer */ xxh_u8* ptr = base + offset; XXH_ASSERT((size_t)ptr % align == 0); /* Store the offset immediately before the returned pointer. */ ptr[-1] = (xxh_u8)offset; return ptr; } return NULL; } } /* * Frees an aligned pointer allocated by XXH_alignedMalloc(). Don't pass * normal malloc'd pointers, XXH_alignedMalloc has a specific data layout. */ static void XXH_alignedFree(void* p) { if (p != NULL) { xxh_u8* ptr = (xxh_u8*)p; /* Get the offset byte we added in XXH_malloc. */ xxh_u8 offset = ptr[-1]; /* Free the original malloc'd pointer */ xxh_u8* base = ptr - offset; XXH_free(base); } } /*! @ingroup XXH3_family */ /*! * @brief Allocate an @ref XXH3_state_t. * * @return An allocated pointer of @ref XXH3_state_t on success. * @return `NULL` on failure. * * @note Must be freed with XXH3_freeState(). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) { XXH3_state_t* const state = (XXH3_state_t*)XXH_alignedMalloc(sizeof(XXH3_state_t), 64); if (state==NULL) return NULL; XXH3_INITSTATE(state); return state; } /*! @ingroup XXH3_family */ /*! * @brief Frees an @ref XXH3_state_t. * * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). * * @return @ref XXH_OK. * * @note Must be allocated with XXH3_createState(). * * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr) { XXH_alignedFree(statePtr); return XXH_OK; } /*! @ingroup XXH3_family */ XXH_PUBLIC_API void XXH3_copyState(XXH_NOESCAPE XXH3_state_t* dst_state, XXH_NOESCAPE const XXH3_state_t* src_state) { XXH_memcpy(dst_state, src_state, sizeof(*dst_state)); } static void XXH3_reset_internal(XXH3_state_t* statePtr, XXH64_hash_t seed, const void* secret, size_t secretSize) { size_t const initStart = offsetof(XXH3_state_t, bufferedSize); size_t const initLength = offsetof(XXH3_state_t, nbStripesPerBlock) - initStart; XXH_ASSERT(offsetof(XXH3_state_t, nbStripesPerBlock) > initStart); XXH_ASSERT(statePtr != NULL); /* set members from bufferedSize to nbStripesPerBlock (excluded) to 0 */ memset((char*)statePtr + initStart, 0, initLength); statePtr->acc[0] = XXH_PRIME32_3; statePtr->acc[1] = XXH_PRIME64_1; statePtr->acc[2] = XXH_PRIME64_2; statePtr->acc[3] = XXH_PRIME64_3; statePtr->acc[4] = XXH_PRIME64_4; statePtr->acc[5] = XXH_PRIME32_2; statePtr->acc[6] = XXH_PRIME64_5; statePtr->acc[7] = XXH_PRIME32_1; statePtr->seed = seed; statePtr->useSeed = (seed != 0); statePtr->extSecret = (const unsigned char*)secret; XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); statePtr->secretLimit = secretSize - XXH_STRIPE_LEN; statePtr->nbStripesPerBlock = statePtr->secretLimit / XXH_SECRET_CONSUME_RATE; } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr) { if (statePtr == NULL) return XXH_ERROR; XXH3_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); return XXH_OK; } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize) { if (statePtr == NULL) return XXH_ERROR; XXH3_reset_internal(statePtr, 0, secret, secretSize); if (secret == NULL) return XXH_ERROR; if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; return XXH_OK; } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed) { if (statePtr == NULL) return XXH_ERROR; if (seed==0) return XXH3_64bits_reset(statePtr); if ((seed != statePtr->seed) || (statePtr->extSecret != NULL)) XXH3_initCustomSecret(statePtr->customSecret, seed); XXH3_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE); return XXH_OK; } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64) { if (statePtr == NULL) return XXH_ERROR; if (secret == NULL) return XXH_ERROR; if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; XXH3_reset_internal(statePtr, seed64, secret, secretSize); statePtr->useSeed = 1; /* always, even if seed64==0 */ return XXH_OK; } /*! * @internal * @brief Processes a large input for XXH3_update() and XXH3_digest_long(). * * Unlike XXH3_hashLong_internal_loop(), this can process data that overlaps a block. * * @param acc Pointer to the 8 accumulator lanes * @param nbStripesSoFarPtr In/out pointer to the number of leftover stripes in the block* * @param nbStripesPerBlock Number of stripes in a block * @param input Input pointer * @param nbStripes Number of stripes to process * @param secret Secret pointer * @param secretLimit Offset of the last block in @p secret * @param f_acc Pointer to an XXH3_accumulate implementation * @param f_scramble Pointer to an XXH3_scrambleAcc implementation * @return Pointer past the end of @p input after processing */ XXH_FORCE_INLINE const xxh_u8 * XXH3_consumeStripes(xxh_u64* XXH_RESTRICT acc, size_t* XXH_RESTRICT nbStripesSoFarPtr, size_t nbStripesPerBlock, const xxh_u8* XXH_RESTRICT input, size_t nbStripes, const xxh_u8* XXH_RESTRICT secret, size_t secretLimit, XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { const xxh_u8* initialSecret = secret + *nbStripesSoFarPtr * XXH_SECRET_CONSUME_RATE; /* Process full blocks */ if (nbStripes >= (nbStripesPerBlock - *nbStripesSoFarPtr)) { /* Process the initial partial block... */ size_t nbStripesThisIter = nbStripesPerBlock - *nbStripesSoFarPtr; do { /* Accumulate and scramble */ f_acc(acc, input, initialSecret, nbStripesThisIter); f_scramble(acc, secret + secretLimit); input += nbStripesThisIter * XXH_STRIPE_LEN; nbStripes -= nbStripesThisIter; /* Then continue the loop with the full block size */ nbStripesThisIter = nbStripesPerBlock; initialSecret = secret; } while (nbStripes >= nbStripesPerBlock); *nbStripesSoFarPtr = 0; } /* Process a partial block */ if (nbStripes > 0) { f_acc(acc, input, initialSecret, nbStripes); input += nbStripes * XXH_STRIPE_LEN; *nbStripesSoFarPtr += nbStripes; } /* Return end pointer */ return input; } #ifndef XXH3_STREAM_USE_STACK # if XXH_SIZE_OPT <= 0 && !defined(__clang__) /* clang doesn't need additional stack space */ # define XXH3_STREAM_USE_STACK 1 # endif #endif /* * Both XXH3_64bits_update and XXH3_128bits_update use this routine. */ XXH_FORCE_INLINE XXH_errorcode XXH3_update(XXH3_state_t* XXH_RESTRICT const state, const xxh_u8* XXH_RESTRICT input, size_t len, XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { if (input==NULL) { XXH_ASSERT(len == 0); return XXH_OK; } XXH_ASSERT(state != NULL); { const xxh_u8* const bEnd = input + len; const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; #if defined(XXH3_STREAM_USE_STACK) && XXH3_STREAM_USE_STACK >= 1 /* For some reason, gcc and MSVC seem to suffer greatly * when operating accumulators directly into state. * Operating into stack space seems to enable proper optimization. * clang, on the other hand, doesn't seem to need this trick */ XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[8]; XXH_memcpy(acc, state->acc, sizeof(acc)); #else xxh_u64* XXH_RESTRICT const acc = state->acc; #endif state->totalLen += len; XXH_ASSERT(state->bufferedSize <= XXH3_INTERNALBUFFER_SIZE); /* small input : just fill in tmp buffer */ if (len <= XXH3_INTERNALBUFFER_SIZE - state->bufferedSize) { XXH_memcpy(state->buffer + state->bufferedSize, input, len); state->bufferedSize += (XXH32_hash_t)len; return XXH_OK; } /* total input is now > XXH3_INTERNALBUFFER_SIZE */ #define XXH3_INTERNALBUFFER_STRIPES (XXH3_INTERNALBUFFER_SIZE / XXH_STRIPE_LEN) XXH_STATIC_ASSERT(XXH3_INTERNALBUFFER_SIZE % XXH_STRIPE_LEN == 0); /* clean multiple */ /* * Internal buffer is partially filled (always, except at beginning) * Complete it, then consume it. */ if (state->bufferedSize) { size_t const loadSize = XXH3_INTERNALBUFFER_SIZE - state->bufferedSize; XXH_memcpy(state->buffer + state->bufferedSize, input, loadSize); input += loadSize; XXH3_consumeStripes(acc, &state->nbStripesSoFar, state->nbStripesPerBlock, state->buffer, XXH3_INTERNALBUFFER_STRIPES, secret, state->secretLimit, f_acc, f_scramble); state->bufferedSize = 0; } XXH_ASSERT(input < bEnd); if (bEnd - input > XXH3_INTERNALBUFFER_SIZE) { size_t nbStripes = (size_t)(bEnd - 1 - input) / XXH_STRIPE_LEN; input = XXH3_consumeStripes(acc, &state->nbStripesSoFar, state->nbStripesPerBlock, input, nbStripes, secret, state->secretLimit, f_acc, f_scramble); XXH_memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); } /* Some remaining input (always) : buffer it */ XXH_ASSERT(input < bEnd); XXH_ASSERT(bEnd - input <= XXH3_INTERNALBUFFER_SIZE); XXH_ASSERT(state->bufferedSize == 0); XXH_memcpy(state->buffer, input, (size_t)(bEnd-input)); state->bufferedSize = (XXH32_hash_t)(bEnd-input); #if defined(XXH3_STREAM_USE_STACK) && XXH3_STREAM_USE_STACK >= 1 /* save stack accumulators into state */ XXH_memcpy(state->acc, acc, sizeof(acc)); #endif } return XXH_OK; } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) { return XXH3_update(state, (const xxh_u8*)input, len, XXH3_accumulate, XXH3_scrambleAcc); } XXH_FORCE_INLINE void XXH3_digest_long (XXH64_hash_t* acc, const XXH3_state_t* state, const unsigned char* secret) { xxh_u8 lastStripe[XXH_STRIPE_LEN]; const xxh_u8* lastStripePtr; /* * Digest on a local copy. This way, the state remains unaltered, and it can * continue ingesting more input afterwards. */ XXH_memcpy(acc, state->acc, sizeof(state->acc)); if (state->bufferedSize >= XXH_STRIPE_LEN) { /* Consume remaining stripes then point to remaining data in buffer */ size_t const nbStripes = (state->bufferedSize - 1) / XXH_STRIPE_LEN; size_t nbStripesSoFar = state->nbStripesSoFar; XXH3_consumeStripes(acc, &nbStripesSoFar, state->nbStripesPerBlock, state->buffer, nbStripes, secret, state->secretLimit, XXH3_accumulate, XXH3_scrambleAcc); lastStripePtr = state->buffer + state->bufferedSize - XXH_STRIPE_LEN; } else { /* bufferedSize < XXH_STRIPE_LEN */ /* Copy to temp buffer */ size_t const catchupSize = XXH_STRIPE_LEN - state->bufferedSize; XXH_ASSERT(state->bufferedSize > 0); /* there is always some input buffered */ XXH_memcpy(lastStripe, state->buffer + sizeof(state->buffer) - catchupSize, catchupSize); XXH_memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize); lastStripePtr = lastStripe; } /* Last stripe */ XXH3_accumulate_512(acc, lastStripePtr, secret + state->secretLimit - XXH_SECRET_LASTACC_START); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (XXH_NOESCAPE const XXH3_state_t* state) { const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; if (state->totalLen > XXH3_MIDSIZE_MAX) { XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; XXH3_digest_long(acc, state, secret); return XXH3_mergeAccs(acc, secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)state->totalLen * XXH_PRIME64_1); } /* totalLen <= XXH3_MIDSIZE_MAX: digesting a short input */ if (state->useSeed) return XXH3_64bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); return XXH3_64bits_withSecret(state->buffer, (size_t)(state->totalLen), secret, state->secretLimit + XXH_STRIPE_LEN); } #endif /* !XXH_NO_STREAM */ /* ========================================== * XXH3 128 bits (a.k.a XXH128) * ========================================== * XXH3's 128-bit variant has better mixing and strength than the 64-bit variant, * even without counting the significantly larger output size. * * For example, extra steps are taken to avoid the seed-dependent collisions * in 17-240 byte inputs (See XXH3_mix16B and XXH128_mix32B). * * This strength naturally comes at the cost of some speed, especially on short * lengths. Note that longer hashes are about as fast as the 64-bit version * due to it using only a slight modification of the 64-bit loop. * * XXH128 is also more oriented towards 64-bit machines. It is still extremely * fast for a _128-bit_ hash on 32-bit (it usually clears XXH64). */ XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { /* A doubled version of 1to3_64b with different constants. */ XXH_ASSERT(input != NULL); XXH_ASSERT(1 <= len && len <= 3); XXH_ASSERT(secret != NULL); /* * len = 1: combinedl = { input[0], 0x01, input[0], input[0] } * len = 2: combinedl = { input[1], 0x02, input[0], input[1] } * len = 3: combinedl = { input[2], 0x03, input[0], input[1] } */ { xxh_u8 const c1 = input[0]; xxh_u8 const c2 = input[len >> 1]; xxh_u8 const c3 = input[len - 1]; xxh_u32 const combinedl = ((xxh_u32)c1 <<16) | ((xxh_u32)c2 << 24) | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); xxh_u32 const combinedh = XXH_rotl32(XXH_swap32(combinedl), 13); xxh_u64 const bitflipl = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; xxh_u64 const bitfliph = (XXH_readLE32(secret+8) ^ XXH_readLE32(secret+12)) - seed; xxh_u64 const keyed_lo = (xxh_u64)combinedl ^ bitflipl; xxh_u64 const keyed_hi = (xxh_u64)combinedh ^ bitfliph; XXH128_hash_t h128; h128.low64 = XXH64_avalanche(keyed_lo); h128.high64 = XXH64_avalanche(keyed_hi); return h128; } } XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); XXH_ASSERT(secret != NULL); XXH_ASSERT(4 <= len && len <= 8); seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; { xxh_u32 const input_lo = XXH_readLE32(input); xxh_u32 const input_hi = XXH_readLE32(input + len - 4); xxh_u64 const input_64 = input_lo + ((xxh_u64)input_hi << 32); xxh_u64 const bitflip = (XXH_readLE64(secret+16) ^ XXH_readLE64(secret+24)) + seed; xxh_u64 const keyed = input_64 ^ bitflip; /* Shift len to the left to ensure it is even, this avoids even multiplies. */ XXH128_hash_t m128 = XXH_mult64to128(keyed, XXH_PRIME64_1 + (len << 2)); m128.high64 += (m128.low64 << 1); m128.low64 ^= (m128.high64 >> 3); m128.low64 = XXH_xorshift64(m128.low64, 35); m128.low64 *= PRIME_MX2; m128.low64 = XXH_xorshift64(m128.low64, 28); m128.high64 = XXH3_avalanche(m128.high64); return m128; } } XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); XXH_ASSERT(secret != NULL); XXH_ASSERT(9 <= len && len <= 16); { xxh_u64 const bitflipl = (XXH_readLE64(secret+32) ^ XXH_readLE64(secret+40)) - seed; xxh_u64 const bitfliph = (XXH_readLE64(secret+48) ^ XXH_readLE64(secret+56)) + seed; xxh_u64 const input_lo = XXH_readLE64(input); xxh_u64 input_hi = XXH_readLE64(input + len - 8); XXH128_hash_t m128 = XXH_mult64to128(input_lo ^ input_hi ^ bitflipl, XXH_PRIME64_1); /* * Put len in the middle of m128 to ensure that the length gets mixed to * both the low and high bits in the 128x64 multiply below. */ m128.low64 += (xxh_u64)(len - 1) << 54; input_hi ^= bitfliph; /* * Add the high 32 bits of input_hi to the high 32 bits of m128, then * add the long product of the low 32 bits of input_hi and XXH_PRIME32_2 to * the high 64 bits of m128. * * The best approach to this operation is different on 32-bit and 64-bit. */ if (sizeof(void *) < sizeof(xxh_u64)) { /* 32-bit */ /* * 32-bit optimized version, which is more readable. * * On 32-bit, it removes an ADC and delays a dependency between the two * halves of m128.high64, but it generates an extra mask on 64-bit. */ m128.high64 += (input_hi & 0xFFFFFFFF00000000ULL) + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2); } else { /* * 64-bit optimized (albeit more confusing) version. * * Uses some properties of addition and multiplication to remove the mask: * * Let: * a = input_hi.lo = (input_hi & 0x00000000FFFFFFFF) * b = input_hi.hi = (input_hi & 0xFFFFFFFF00000000) * c = XXH_PRIME32_2 * * a + (b * c) * Inverse Property: x + y - x == y * a + (b * (1 + c - 1)) * Distributive Property: x * (y + z) == (x * y) + (x * z) * a + (b * 1) + (b * (c - 1)) * Identity Property: x * 1 == x * a + b + (b * (c - 1)) * * Substitute a, b, and c: * input_hi.hi + input_hi.lo + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) * * Since input_hi.hi + input_hi.lo == input_hi, we get this: * input_hi + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) */ m128.high64 += input_hi + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2 - 1); } /* m128 ^= XXH_swap64(m128 >> 64); */ m128.low64 ^= XXH_swap64(m128.high64); { /* 128x64 multiply: h128 = m128 * XXH_PRIME64_2; */ XXH128_hash_t h128 = XXH_mult64to128(m128.low64, XXH_PRIME64_2); h128.high64 += m128.high64 * XXH_PRIME64_2; h128.low64 = XXH3_avalanche(h128.low64); h128.high64 = XXH3_avalanche(h128.high64); return h128; } } } /* * Assumption: `secret` size is >= XXH3_SECRET_SIZE_MIN */ XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_0to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(len <= 16); { if (len > 8) return XXH3_len_9to16_128b(input, len, secret, seed); if (len >= 4) return XXH3_len_4to8_128b(input, len, secret, seed); if (len) return XXH3_len_1to3_128b(input, len, secret, seed); { XXH128_hash_t h128; xxh_u64 const bitflipl = XXH_readLE64(secret+64) ^ XXH_readLE64(secret+72); xxh_u64 const bitfliph = XXH_readLE64(secret+80) ^ XXH_readLE64(secret+88); h128.low64 = XXH64_avalanche(seed ^ bitflipl); h128.high64 = XXH64_avalanche( seed ^ bitfliph); return h128; } } } /* * A bit slower than XXH3_mix16B, but handles multiply by zero better. */ XXH_FORCE_INLINE XXH128_hash_t XXH128_mix32B(XXH128_hash_t acc, const xxh_u8* input_1, const xxh_u8* input_2, const xxh_u8* secret, XXH64_hash_t seed) { acc.low64 += XXH3_mix16B (input_1, secret+0, seed); acc.low64 ^= XXH_readLE64(input_2) + XXH_readLE64(input_2 + 8); acc.high64 += XXH3_mix16B (input_2, secret+16, seed); acc.high64 ^= XXH_readLE64(input_1) + XXH_readLE64(input_1 + 8); return acc; } XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) { XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; XXH_ASSERT(16 < len && len <= 128); { XXH128_hash_t acc; acc.low64 = len * XXH_PRIME64_1; acc.high64 = 0; #if XXH_SIZE_OPT >= 1 { /* Smaller, but slightly slower. */ unsigned int i = (unsigned int)(len - 1) / 32; do { acc = XXH128_mix32B(acc, input+16*i, input+len-16*(i+1), secret+32*i, seed); } while (i-- != 0); } #else if (len > 32) { if (len > 64) { if (len > 96) { acc = XXH128_mix32B(acc, input+48, input+len-64, secret+96, seed); } acc = XXH128_mix32B(acc, input+32, input+len-48, secret+64, seed); } acc = XXH128_mix32B(acc, input+16, input+len-32, secret+32, seed); } acc = XXH128_mix32B(acc, input, input+len-16, secret, seed); #endif { XXH128_hash_t h128; h128.low64 = acc.low64 + acc.high64; h128.high64 = (acc.low64 * XXH_PRIME64_1) + (acc.high64 * XXH_PRIME64_4) + ((len - seed) * XXH_PRIME64_2); h128.low64 = XXH3_avalanche(h128.low64); h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); return h128; } } } XXH_NO_INLINE XXH_PUREF XXH128_hash_t XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) { XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); { XXH128_hash_t acc; unsigned i; acc.low64 = len * XXH_PRIME64_1; acc.high64 = 0; /* * We set as `i` as offset + 32. We do this so that unchanged * `len` can be used as upper bound. This reaches a sweet spot * where both x86 and aarch64 get simple agen and good codegen * for the loop. */ for (i = 32; i < 160; i += 32) { acc = XXH128_mix32B(acc, input + i - 32, input + i - 16, secret + i - 32, seed); } acc.low64 = XXH3_avalanche(acc.low64); acc.high64 = XXH3_avalanche(acc.high64); /* * NB: `i <= len` will duplicate the last 32-bytes if * len % 32 was zero. This is an unfortunate necessity to keep * the hash result stable. */ for (i=160; i <= len; i += 32) { acc = XXH128_mix32B(acc, input + i - 32, input + i - 16, secret + XXH3_MIDSIZE_STARTOFFSET + i - 160, seed); } /* last bytes */ acc = XXH128_mix32B(acc, input + len - 16, input + len - 32, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET - 16, (XXH64_hash_t)0 - seed); { XXH128_hash_t h128; h128.low64 = acc.low64 + acc.high64; h128.high64 = (acc.low64 * XXH_PRIME64_1) + (acc.high64 * XXH_PRIME64_4) + ((len - seed) * XXH_PRIME64_2); h128.low64 = XXH3_avalanche(h128.low64); h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); return h128; } } } XXH_FORCE_INLINE XXH128_hash_t XXH3_hashLong_128b_internal(const void* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc, f_scramble); /* converge into final hash */ XXH_STATIC_ASSERT(sizeof(acc) == 64); XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); { XXH128_hash_t h128; h128.low64 = XXH3_mergeAccs(acc, secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)len * XXH_PRIME64_1); h128.high64 = XXH3_mergeAccs(acc, secret + secretSize - sizeof(acc) - XXH_SECRET_MERGEACCS_START, ~((xxh_u64)len * XXH_PRIME64_2)); return h128; } } /* * It's important for performance that XXH3_hashLong() is not inlined. */ XXH_NO_INLINE XXH_PUREF XXH128_hash_t XXH3_hashLong_128b_default(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate, XXH3_scrambleAcc); } /* * It's important for performance to pass @p secretLen (when it's static) * to the compiler, so that it can properly optimize the vectorized loop. * * When the secret size is unknown, or on GCC 12 where the mix of NO_INLINE and FORCE_INLINE * breaks -Og, this is XXH_NO_INLINE. */ XXH3_WITH_SECRET_INLINE XXH128_hash_t XXH3_hashLong_128b_withSecret(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, secretLen, XXH3_accumulate, XXH3_scrambleAcc); } XXH_FORCE_INLINE XXH128_hash_t XXH3_hashLong_128b_withSeed_internal(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble, XXH3_f_initCustomSecret f_initSec) { if (seed64 == 0) return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), f_acc, f_scramble); { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; f_initSec(secret, seed64); return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, sizeof(secret), f_acc, f_scramble); } } /* * It's important for performance that XXH3_hashLong is not inlined. */ XXH_NO_INLINE XXH128_hash_t XXH3_hashLong_128b_withSeed(const void* input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) { (void)secret; (void)secretLen; return XXH3_hashLong_128b_withSeed_internal(input, len, seed64, XXH3_accumulate, XXH3_scrambleAcc, XXH3_initCustomSecret); } typedef XXH128_hash_t (*XXH3_hashLong128_f)(const void* XXH_RESTRICT, size_t, XXH64_hash_t, const void* XXH_RESTRICT, size_t); XXH_FORCE_INLINE XXH128_hash_t XXH3_128bits_internal(const void* input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, XXH3_hashLong128_f f_hl128) { XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); /* * If an action is to be taken if `secret` conditions are not respected, * it should be done here. * For now, it's a contract pre-condition. * Adding a check and a branch here would cost performance at every hash. */ if (len <= 16) return XXH3_len_0to16_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); if (len <= 128) return XXH3_len_17to128_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); if (len <= XXH3_MIDSIZE_MAX) return XXH3_len_129to240_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); return f_hl128(input, len, seed64, secret, secretLen); } /* === Public XXH128 API === */ /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(XXH_NOESCAPE const void* input, size_t len) { return XXH3_128bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_default); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize) { return XXH3_128bits_internal(input, len, 0, (const xxh_u8*)secret, secretSize, XXH3_hashLong_128b_withSecret); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_withSeed); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { if (len <= XXH3_MIDSIZE_MAX) return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); return XXH3_hashLong_128b_withSecret(input, len, seed, secret, secretSize); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t XXH128(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { return XXH3_128bits_withSeed(input, len, seed); } /* === XXH3 128-bit streaming === */ #ifndef XXH_NO_STREAM /* * All initialization and update functions are identical to 64-bit streaming variant. * The only difference is the finalization routine. */ /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr) { return XXH3_64bits_reset(statePtr); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize) { return XXH3_64bits_reset_withSecret(statePtr, secret, secretSize); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed) { return XXH3_64bits_reset_withSeed(statePtr, seed); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { return XXH3_64bits_reset_withSecretandSeed(statePtr, secret, secretSize, seed); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) { return XXH3_64bits_update(state, input, len); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (XXH_NOESCAPE const XXH3_state_t* state) { const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; if (state->totalLen > XXH3_MIDSIZE_MAX) { XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; XXH3_digest_long(acc, state, secret); XXH_ASSERT(state->secretLimit + XXH_STRIPE_LEN >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); { XXH128_hash_t h128; h128.low64 = XXH3_mergeAccs(acc, secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)state->totalLen * XXH_PRIME64_1); h128.high64 = XXH3_mergeAccs(acc, secret + state->secretLimit + XXH_STRIPE_LEN - sizeof(acc) - XXH_SECRET_MERGEACCS_START, ~((xxh_u64)state->totalLen * XXH_PRIME64_2)); return h128; } } /* len <= XXH3_MIDSIZE_MAX : short code */ if (state->seed) return XXH3_128bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); return XXH3_128bits_withSecret(state->buffer, (size_t)(state->totalLen), secret, state->secretLimit + XXH_STRIPE_LEN); } #endif /* !XXH_NO_STREAM */ /* 128-bit utility functions */ #include <string.h> /* memcmp, memcpy */ /* return : 1 is equal, 0 if different */ /*! @ingroup XXH3_family */ XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2) { /* note : XXH128_hash_t is compact, it has no padding byte */ return !(memcmp(&h1, &h2, sizeof(h1))); } /* This prototype is compatible with stdlib's qsort(). * @return : >0 if *h128_1 > *h128_2 * <0 if *h128_1 < *h128_2 * =0 if *h128_1 == *h128_2 */ /*! @ingroup XXH3_family */ XXH_PUBLIC_API int XXH128_cmp(XXH_NOESCAPE const void* h128_1, XXH_NOESCAPE const void* h128_2) { XXH128_hash_t const h1 = *(const XXH128_hash_t*)h128_1; XXH128_hash_t const h2 = *(const XXH128_hash_t*)h128_2; int const hcmp = (h1.high64 > h2.high64) - (h2.high64 > h1.high64); /* note : bets that, in most cases, hash values are different */ if (hcmp) return hcmp; return (h1.low64 > h2.low64) - (h2.low64 > h1.low64); } /*====== Canonical representation ======*/ /*! @ingroup XXH3_family */ XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH_NOESCAPE XXH128_canonical_t* dst, XXH128_hash_t hash) { XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) == sizeof(XXH128_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) { hash.high64 = XXH_swap64(hash.high64); hash.low64 = XXH_swap64(hash.low64); } XXH_memcpy(dst, &hash.high64, sizeof(hash.high64)); XXH_memcpy((char*)dst + sizeof(hash.high64), &hash.low64, sizeof(hash.low64)); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(XXH_NOESCAPE const XXH128_canonical_t* src) { XXH128_hash_t h; h.high64 = XXH_readBE64(src); h.low64 = XXH_readBE64(src->digest + 8); return h; } /* ========================================== * Secret generators * ========================================== */ #define XXH_MIN(x, y) (((x) > (y)) ? (y) : (x)) XXH_FORCE_INLINE void XXH3_combine16(void* dst, XXH128_hash_t h128) { XXH_writeLE64( dst, XXH_readLE64(dst) ^ h128.low64 ); XXH_writeLE64( (char*)dst+8, XXH_readLE64((char*)dst+8) ^ h128.high64 ); } /*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode XXH3_generateSecret(XXH_NOESCAPE void* secretBuffer, size_t secretSize, XXH_NOESCAPE const void* customSeed, size_t customSeedSize) { #if (XXH_DEBUGLEVEL >= 1) XXH_ASSERT(secretBuffer != NULL); XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); #else /* production mode, assert() are disabled */ if (secretBuffer == NULL) return XXH_ERROR; if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; #endif if (customSeedSize == 0) { customSeed = XXH3_kSecret; customSeedSize = XXH_SECRET_DEFAULT_SIZE; } #if (XXH_DEBUGLEVEL >= 1) XXH_ASSERT(customSeed != NULL); #else if (customSeed == NULL) return XXH_ERROR; #endif /* Fill secretBuffer with a copy of customSeed - repeat as needed */ { size_t pos = 0; while (pos < secretSize) { size_t const toCopy = XXH_MIN((secretSize - pos), customSeedSize); memcpy((char*)secretBuffer + pos, customSeed, toCopy); pos += toCopy; } } { size_t const nbSeg16 = secretSize / 16; size_t n; XXH128_canonical_t scrambler; XXH128_canonicalFromHash(&scrambler, XXH128(customSeed, customSeedSize, 0)); for (n=0; n<nbSeg16; n++) { XXH128_hash_t const h128 = XXH128(&scrambler, sizeof(scrambler), n); XXH3_combine16((char*)secretBuffer + n*16, h128); } /* last segment */ XXH3_combine16((char*)secretBuffer + secretSize - 16, XXH128_hashFromCanonical(&scrambler)); } return XXH_OK; } /*! @ingroup XXH3_family */ XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed) { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; XXH3_initCustomSecret(secret, seed); XXH_ASSERT(secretBuffer != NULL); memcpy(secretBuffer, secret, XXH_SECRET_DEFAULT_SIZE); } /* Pop our optimization override from above */ #if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ && defined(__OPTIMIZE__) && XXH_SIZE_OPT <= 0 /* respect -O0 and -Os */ # pragma GCC pop_options #endif #endif /* XXH_NO_LONG_LONG */ #endif /* XXH_NO_XXH3 */ /*! * @} */ #endif /* XXH_IMPLEMENTATION */ #if defined (__cplusplus) } /* extern "C" */ #endif --- benchmark_other_languages/go/hash_functions/go.mod --- module hash_functions go 1.21.5 --- benchmark_other_languages/go/hash_functions/main.go --- package main import ( "fmt" "hash/maphash" "strings" "time" ) type void struct{} var member void func benchmark(corpus []string) { total := int64(0) k := make(map[string]void) v := make(map[uint64]void) v512 := make(map[uint64]void) for i := 0; i < 20; i++ { k = make(map[string]void) v = make(map[uint64]void) v512 = make(map[uint64]void) var hash maphash.Hash for _, key := range corpus { k[key] = member tik := time.Now().UnixNano() hash.WriteString(key) h := hash.Sum64() tok := time.Now().UnixNano() hash.Reset() v[h] = member v512[(h % 512)] = member total += tok - tik } } var min = 1000000 var max = 0 var sum = 0 for key := range k { l := len(key) sum += l if l < min { min = l } if l > max { max = l } } avg := sum / len(k) avgTime := (float64(total) / 20.0) / float64(len(corpus)) fmt.Printf("Avg time: %f, total elements: %d, unique elements: %d, collisions: %f, collisions mod 512: %f, keys min: %d, avg: %d, max: %d \n", avgTime, len(corpus), len(k), float64(len(k))/float64(len(v)), float64(len(k))/float64(len(v512)), min, avg, max) } func main() { corpus1 := "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque orci urna, pretium et porta ac, porttitor sit amet sem. Fusce sagittis lorem neque, vitae sollicitudin elit suscipit et. In interdum convallis nisl in ornare. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam erat volutpat. Morbi mollis iaculis lectus ac tincidunt. Fusce nisi lacus, semper eu dignissim et, malesuada non mi. Sed euismod urna vel elit faucibus, eu bibendum ante fringilla. Curabitur tempus in turpis at mattis. Aliquam erat volutpat. Donec maximus elementum felis, sit amet dignissim augue tincidunt blandit. Aliquam fermentum, est eu mollis." corpus2 := "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection:" corpus3 := "A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls" corpus4 := "Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину." corpus5 := "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen" corpus6 := "米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。" corpus7 := "AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus" corps := []string{corpus1, corpus2, corpus3, corpus4, corpus5, corpus6, corpus7} for _, corpus := range corps { keys := strings.Split(corpus, " ") benchmark(keys) } } --- benchmark_other_languages/js/hash_functions/.gitignore --- /node_modules --- benchmark_other_languages/js/hash_functions/README.md --- First execute `npm install` to fetch the dependencies and then execute `node benchmark.js`. --- benchmark_other_languages/js/hash_functions/benchmark.js --- const { wyhash, wyhash_str } = require('wyhash'); const XXH = require("xxhashjs") function len(o) { return Object.keys(o).length; } function benchmark_xxhash(corpus) { var total = 0; for (let i = 0; i < 20; i++) { var k = {}; var v = {}; var v512 = {}; corpus.forEach(key => { k[key] = true; const tik = process.hrtime(); const h = XXH.h64( key, 0xABCD ).toNumber(); const tok = process.hrtime(tik); total += tok[1]; v[h] = true; v512[(h % 512)] = true; }); } var min = 10000000; var max = 0; var sum = 0; Object.keys(k).forEach (key => { const l = key.length; sum += l; if (l < min) {min = l} if (l > max) {max = l} }); const avg = sum / len(k); console.log(`Avg time xxHash: ${((total / 20.0) / corpus.length)}, total elements: ${corpus.length}, unique elements: ${len(k)}, collisions: ${(len(k) / len(v))}, collisions % 512: ${(len(k) / len(v512))}, keys min: ${min}, avg: ${avg}, max: ${max}`); } function benchmark_wyhash(corpus) { var total = 0; for (let i = 0; i < 20; i++) { var k = {}; var v = {}; var v512 = {}; corpus.forEach(key => { k[key] = true; const tik = process.hrtime(); const h = wyhash_str(key, 0n); const tok = process.hrtime(tik); total += tok[1]; v[h] = true; v512[(h % 512n)] = true; }); } var min = 10000000; var max = 0; var sum = 0; Object.keys(k).forEach (key => { const l = key.length; sum += l; if (l < min) {min = l} if (l > max) {max = l} }); const avg = sum / len(k); console.log(`Avg time WyHash: ${((total / 20.0) / corpus.length)}, total elements: ${corpus.length}, unique elements: ${len(k)}, collisions: ${(len(k) / len(v))}, collisions % 512: ${(len(k) / len(v512))}, keys min: ${min}, avg: ${avg}, max: ${max}`); } function main() { const corpus1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque orci urna, pretium et porta ac, porttitor sit amet sem. Fusce sagittis lorem neque, vitae sollicitudin elit suscipit et. In interdum convallis nisl in ornare. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam erat volutpat. Morbi mollis iaculis lectus ac tincidunt. Fusce nisi lacus, semper eu dignissim et, malesuada non mi. Sed euismod urna vel elit faucibus, eu bibendum ante fringilla. Curabitur tempus in turpis at mattis. Aliquam erat volutpat. Donec maximus elementum felis, sit amet dignissim augue tincidunt blandit. Aliquam fermentum, est eu mollis.".split(" ") const corpus2 = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection:".split(" "); const corpus3 = "A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls".split(" "); const corpus4 = "Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину.".split(" "); const corpus5 = "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen".split(" "); const corpus6 = "米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。".split(" "); const corpus7 = "AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus".split(" "); // First corpus1 is inserted twice because the first run is always slower const corps = [corpus1, corpus1, corpus2, corpus3, corpus4, corpus5, corpus6, corpus7]; for (let index = 0; index < corps.length; index++) { let corpus = corps[index]; benchmark_wyhash(corpus); benchmark_xxhash(corpus); } } main() --- benchmark_other_languages/python/hash_functions/benchmark.py --- from time import time_ns def benchmark(corpus: list[str]): total = 0 for _ in range(20): k = set() v = set() v512 = set() for key in corpus: k.add(key) tik = time_ns() h = hash(key) tok = time_ns() total += (tok - tik) v.add(h) v512.add(h % 512) min = 10000000 max = 0 sum = 0 for key in k: l = len(key) sum += l if l < min: min = l if l > max: max = l avg = sum / len(k) print(f"Avg time: {(total / 20.0) / len(corpus)}, total elements: {len(corpus)}, unique elements: {len(k)}, collisions: {len(k) / len(v)}, collisions % 512: {len(k) / len(v512)}, keys min: {min}, avg: {avg}, max: {max}") def main(): corpus1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque orci urna, pretium et porta ac, porttitor sit amet sem. Fusce sagittis lorem neque, vitae sollicitudin elit suscipit et. In interdum convallis nisl in ornare. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam erat volutpat. Morbi mollis iaculis lectus ac tincidunt. Fusce nisi lacus, semper eu dignissim et, malesuada non mi. Sed euismod urna vel elit faucibus, eu bibendum ante fringilla. Curabitur tempus in turpis at mattis. Aliquam erat volutpat. Donec maximus elementum felis, sit amet dignissim augue tincidunt blandit. Aliquam fermentum, est eu mollis.".split(" ") corpus2 = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection:".split(" ") corpus3 = "A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls".split(" ") corpus4 = "Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину.".split(" ") corpus5 = "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen".split(" ") corpus6 = "米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。".split(" ") corpus7 = "AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus".split(" ") corps = [corpus1, corpus2, corpus3, corpus4, corpus5, corpus6, corpus7] for corpus in corps: benchmark(corpus) if __name__ == "__main__": main() --- benchmark_other_languages/python/hash_functions/benchmark_dict.py --- from pathlib import Path from time import time_ns def main(): corpus1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque orci urna, pretium et porta ac, porttitor sit amet sem. Fusce sagittis lorem neque, vitae sollicitudin elit suscipit et. In interdum convallis nisl in ornare. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam erat volutpat. Morbi mollis iaculis lectus ac tincidunt. Fusce nisi lacus, semper eu dignissim et, malesuada non mi. Sed euismod urna vel elit faucibus, eu bibendum ante fringilla. Curabitur tempus in turpis at mattis. Aliquam erat volutpat. Donec maximus elementum felis, sit amet dignissim augue tincidunt blandit. Aliquam fermentum, est eu mollis.".split(" ") corpus2 = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection:".split(" ") corpus3 = "A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls".split(" ") corpus4 = "Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину.".split(" ") corpus5 = "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen".split(" ") corpus6 = "米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。".split(" ") corpus7 = "AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus".split(" ") corpus8 = Path("/usr/share/dict/words").read_text().splitlines() all = [corpus1, corpus2, corpus3, corpus4, corpus5, corpus6, corpus7, corpus8] for j, corpus in enumerate(all): total_put = 0 total_get = 0 for _ in range(10): sum = 0 d = {} for i, c in enumerate(corpus): tik = time_ns() d[c] = i tok = time_ns() total_put += tok - tik for c in corpus: tik = time_ns() a = d[c] tok = time_ns() total_get += tok - tik sum += a print(f"Corpus {j + 1}") print(f"Avg time put: {(total_put / 10.0) / len(corpus)}") print(f"Avg time get: {(total_get / 10.0) / len(corpus)}") print(sum) if __name__ == "__main__": main() --- benchmark_other_languages/python/hash_functions/md5_benchmark.py --- import hashlib import time if __name__ == "__main__": file = open("/usr/share/dict/words", "r") content = file.read().encode() tik = time.time_ns() result = hashlib.md5(content) tok = time.time_ns() print(result.hexdigest()) print(f"In: {tok - tik}") tik = time.time_ns() result = hashlib.sha256(content) tok = time.time_ns() print(result.hexdigest()) print(f"In: {tok - tik}") --- benchmark_other_languages/rust/hash_functions/Cargo.lock --- # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "ahash" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "getrandom", "once_cell", "version_check", "zerocopy", ] [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "fxhash" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" dependencies = [ "byteorder", ] [[package]] name = "getrandom" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", "wasi", ] [[package]] name = "hash_functions" version = "0.1.0" dependencies = [ "ahash", "fxhash", "md5", "rand", "wyhash2", ] [[package]] name = "libc" version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "md5" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "no-std-compat" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", "rand_core", ] [[package]] name = "rand_chacha" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core", ] [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] [[package]] name = "syn" version = "2.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wyhash2" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9433c7c86e328a8197038c9fc31f6e5c81f9c7bdc087d86e266680236af1af1b" dependencies = [ "no-std-compat", ] [[package]] name = "zerocopy" version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", "syn", ] --- benchmark_other_languages/rust/hash_functions/Cargo.toml --- [package] name = "hash_functions" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] rand = "0.8.5" fxhash = "0.2.1" ahash = "0.8.6" wyhash2 = "0.2.1" md5 = "0.7.0" [profile.dev] opt-level = 3 --- benchmark_other_languages/rust/hash_functions/src/main.rs --- use std::{collections::{HashSet, hash_map::DefaultHasher}, vec, fs}; use std::hash::{Hash, Hasher}; use ahash::AHasher; use fxhash::FxHasher64; use wyhash2::{WyHash, wyhash_single}; use std::time::Instant; fn test_hashing<T: Hasher + Default>(corpus: &Vec<&str>, name: &str) { let mut total = 0; let mut k = HashSet::new(); let mut v = HashSet::new(); let mut v512: HashSet<u64> = HashSet::new(); for _ in 0..20 { v.clear(); v512.clear(); corpus.iter().for_each(|key| { let mut s = T::default(); k.insert(key); let tik = Instant::now(); key.hash(&mut s); let hash = s.finish(); let tok = Instant::now(); total += (tok - tik).as_nanos(); v.insert(hash); v512.insert(hash % 512); }); } let mut min = 1000000; let mut max = 0; let mut sum = 0; for key in k.iter() { let l = key.len(); sum += l; if l > max { max = l; } if l < min { min = l; } } let avg = sum / k.len(); println!("Avg time {}: {:?}, total elements: {:?}, unique elements: {:?}, collisions: {:?}, collisions % 512: {:?}, keys min: {:?}, avg: {:?}, max: {:?}", name, ((total as f64) / 20.0) / (corpus.len() as f64), corpus.len(), k.len(), (k.len() as f64) / (v.len() as f64), (k.len() as f64) / (v512.len() as f64), min, avg, max); } fn test_md5(corpus: &Vec<&str>) { let mut total = 0; let mut k = HashSet::new(); let mut v = HashSet::new(); for _ in 0..20 { v.clear(); corpus.iter().for_each(|key| { k.insert(key); let tik = Instant::now(); let hash = md5::compute(key); let tok = Instant::now(); total += (tok - tik).as_nanos(); v.insert(hash); }); } println!("Avg time MD5: {:?}", ((total as f64) / 20.0) / (corpus.len() as f64)) } fn main() { let corpus1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque orci urna, pretium et porta ac, porttitor sit amet sem. Fusce sagittis lorem neque, vitae sollicitudin elit suscipit et. In interdum convallis nisl in ornare. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam erat volutpat. Morbi mollis iaculis lectus ac tincidunt. Fusce nisi lacus, semper eu dignissim et, malesuada non mi. Sed euismod urna vel elit faucibus, eu bibendum ante fringilla. Curabitur tempus in turpis at mattis. Aliquam erat volutpat. Donec maximus elementum felis, sit amet dignissim augue tincidunt blandit. Aliquam fermentum, est eu mollis.".split(" ").collect::<Vec<&str>>(); let corpus2 = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection:".split(" ").collect::<Vec<&str>>(); let corpus3 = "A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls".split(" ").collect::<Vec<&str>>(); let corpus4 = "Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину.".split(" ").collect::<Vec<&str>>(); let corpus5 = "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen".split(" ").collect::<Vec<&str>>(); let corpus6 = "米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。".split(" ").collect::<Vec<&str>>(); let corpus7 = "AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus".split(" ").collect::<Vec<&str>>(); let corps = vec![corpus1, corpus2, corpus3, corpus4, corpus5, corpus6, corpus7]; for corpus in corps { test_hashing::<DefaultHasher>(&corpus, "Default"); test_hashing::<FxHasher64>(&corpus, "FxHasher"); test_hashing::<AHasher>(&corpus, "AHasher"); test_hashing::<WyHash>(&corpus, "WyHash"); test_md5(&corpus); } let contents = fs::read_to_string("/usr/share/dict/words") .expect("Should have been able to read the file"); let tik = Instant::now(); let hash = md5::compute(contents); let tok = Instant::now(); println!("MD5: {:?}", hash); println!("In {:?}", (tok - tik).as_nanos()); // let hash = wyhash_single(b"Maxim", 0); // println!("{:?}: {:?}", "Maxim", hash); let mut hasher = AHasher::default(); hasher.write(b"Maxim"); println!("Maxim: {}", hasher.finish()); } --- benchmark_other_languages/swift/hash_functions/.gitignore --- .DS_Store /.build /Packages /*.xcodeproj xcuserdata/ DerivedData/ .swiftpm/config/registries.json .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc --- benchmark_other_languages/swift/hash_functions/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>IDEDidComputeMac32BitWarning</key> <true/> </dict> </plist> --- benchmark_other_languages/swift/hash_functions/.swiftpm/xcode/xcshareddata/xcschemes/hash_functions.xcscheme --- <?xml version="1.0" encoding="UTF-8"?> <Scheme LastUpgradeVersion = "1430" version = "1.7"> <BuildAction parallelizeBuildables = "YES" buildImplicitDependencies = "YES"> <BuildActionEntries> <BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" buildForProfiling = "YES" buildForArchiving = "YES" buildForAnalyzing = "YES"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "hash_functions" BuildableName = "hash_functions" BlueprintName = "hash_functions" ReferencedContainer = "container:"> </BuildableReference> </BuildActionEntry> <BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" buildForProfiling = "NO" buildForArchiving = "NO" buildForAnalyzing = "YES"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "hash_functionsTests" BuildableName = "hash_functionsTests" BlueprintName = "hash_functionsTests" ReferencedContainer = "container:"> </BuildableReference> </BuildActionEntry> </BuildActionEntries> </BuildAction> <TestAction buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES" shouldAutocreateTestPlan = "YES"> <Testables> <TestableReference skipped = "NO"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "hash_functionsTests" BuildableName = "hash_functionsTests" BlueprintName = "hash_functionsTests" ReferencedContainer = "container:"> </BuildableReference> </TestableReference> </Testables> </TestAction> <LaunchAction buildConfiguration = "Release" selectedDebuggerIdentifier = "" selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> <BuildableProductRunnable runnableDebuggingMode = "0"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "hash_functions" BuildableName = "hash_functions" BlueprintName = "hash_functions" ReferencedContainer = "container:"> </BuildableReference> </BuildableProductRunnable> </LaunchAction> <ProfileAction buildConfiguration = "Release" shouldUseLaunchSchemeArgsEnv = "YES" savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES"> <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "hash_functions" BuildableName = "hash_functions" BlueprintName = "hash_functions" ReferencedContainer = "container:"> </BuildableReference> </MacroExpansion> </ProfileAction> <AnalyzeAction buildConfiguration = "Debug"> </AnalyzeAction> <ArchiveAction buildConfiguration = "Release" revealArchiveInOrganizer = "YES"> </ArchiveAction> </Scheme> --- benchmark_other_languages/swift/hash_functions/Package.swift --- // swift-tools-version: 5.8 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "hash_functions", products: [ .executable( name: "hash_functions", targets: ["hash_functions"]), ], dependencies: [], targets: [ .executableTarget( name: "hash_functions", dependencies: []) ] ) --- benchmark_other_languages/swift/hash_functions/README.md --- # hash_functions Benachmark for default hash function. Installing Swift on Ubunutu https://gist.github.com/Jswizzy/408af5829970f9eb18f9b45f891910bb (pick the latest version, tried with 5.9.2) Run the benchamrk with `swift run --configuration release` --- benchmark_other_languages/swift/hash_functions/Sources/hash_functions/main.swift --- // // File.swift // // // Created by Maxim Zaks on 23.12.23. // import Foundation import Dispatch func hash(corpus: [Substring]) { var total: UInt64 = 0 var k = Set<Substring>() var v = Set<Int>() var v512 = Set<Int>() for _ in 0..<20 { v.removeAll() v512.removeAll() for key in corpus { k.insert(key) let tik = DispatchTime.now() let h = key.hash let tok = DispatchTime.now() total += (tok.uptimeNanoseconds - tik.uptimeNanoseconds) v.insert(h) v512.insert(h % 512) } } var min = Int.max var max = Int.min var sum = 0 for key in k { let l = key.count sum += l if l < min { min = l } if l > max { max = l } } let avg = Int(sum / k.count) let avgTimeInNs = ((Double(total) / Double(20.0)) / Double(corpus.count)) print("Avg time: \(avgTimeInNs), total elements: \(corpus.count), unique elements: \(k.count), collisions: \(Double(k.count) / Double(v.count)), collisions % 512: \(Double(k.count) / Double(v512.count)), keys min: \(min), avg: \(avg), max: \(max)") } func benchmark() { let corpus1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque orci urna, pretium et porta ac, porttitor sit amet sem. Fusce sagittis lorem neque, vitae sollicitudin elit suscipit et. In interdum convallis nisl in ornare. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam erat volutpat. Morbi mollis iaculis lectus ac tincidunt. Fusce nisi lacus, semper eu dignissim et, malesuada non mi. Sed euismod urna vel elit faucibus, eu bibendum ante fringilla. Curabitur tempus in turpis at mattis. Aliquam erat volutpat. Donec maximus elementum felis, sit amet dignissim augue tincidunt blandit. Aliquam fermentum, est eu mollis.".split(separator: " ") let corpus2 = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection:".split(separator: " ") let corpus3 = "A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls".split(separator: " ") let corpus4 = "Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину.".split(separator: " ") let corpus5 = "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen".split(separator: " ") let corpus6 = "米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。".split(separator: " ") let corpus7 = "AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus".split(separator: " ") let corps = [corpus1, corpus2, corpus3, corpus4, corpus5, corpus6, corpus7] for corpus in corps { hash(corpus: corpus) } } benchmark() --- checkout_remote_modules.sh --- #!/bin/bash function check_out_remote_module() ( rurl="$1" shift declare -a paths declare -a module_names for var in "$@" do IFS="=" read -ra module_name_components <<< "$var" components_count=${#module_name_components[@]} path=${module_name_components[0]} module_name=${module_name_components[$components_count-1]} paths=("${paths[@]}" "$path") module_names=("${module_names[@]}" "$module_name") done IFS=" " for module_name in "${module_names[@]}" do rm -rf ../$module_name done current_date_time=$(date) echo "URL: $rurl" git clone -n --depth=1 --filter=tree:0 $rurl cd ${rurl##*/} git sparse-checkout set --no-cone "${paths[@]}" git checkout for i in "${!paths[@]}" do module_name=${module_names[$i]} path=${paths[$i]} cp -R ./$path ../../$module_name echo $current_date_time > ../../$module_name/.checkoutinfo echo "URL: $rurl" >> ../../$module_name/.checkoutinfo echo "Path: $path" >> ../../$module_name/.checkoutinfo done cd ../ ) function checkout()( # Add check out remote module calls here # check_out_remote_module "https://github.com/mzaks/mojo-trees" "fiby_tree" ) mkdir -p "_deps" cd "_deps" checkout rm -rf "../_deps" --- fnv1a/__init__.mojo --- from .fnv1a import fnv1a32, fnv1a64 --- fnv1a/fnv1a.mojo --- alias fnv_32_prime: UInt32 = 0x01000193 alias fnv_32_offset_bassis: UInt32 = 0x811c9dc5 alias fnv_64_prime = 0x100000001b3 alias fnv_64_offset_bassis = 0xcbf29ce484222325 @always_inline fn fnv1a32(s: String) -> UInt32: var hash = fnv_32_offset_bassis var buffer = UnsafePointer(s.unsafe_ptr()) for i in range(len(s)): hash ^= buffer.load(i).cast[DType.uint32]() hash *= fnv_32_prime return hash @always_inline fn fnv1a64(s: String) -> UInt64: var hash: UInt64 = fnv_64_offset_bassis var buffer = UnsafePointer(s.unsafe_ptr()) for i in range(len(s)): hash ^= buffer.load(i).cast[DType.uint64]() hash *= fnv_64_prime return hash --- fxhash/__init__.mojo --- from .fxhash import fxhash32, fxhash64 --- fxhash/fxhash.mojo --- from bit import rotate_bits_left alias ROTATE = 5 alias SEED64 = 0x51_7c_c1_b7_27_22_0a_95 alias SEED32 = 0x9e_37_79_b9 @always_inline fn fxhash32(s: String, seed: UInt32 = 0) -> UInt32: var bytes = UnsafePointer(s.unsafe_ptr()) var count = len(s) var hash = seed while count >= 4: hash = _hash_word32(hash, bytes.bitcast[DType.uint32]().load()) bytes = bytes.offset(4) count -= 4 if count >= 2: hash = _hash_word32(hash, bytes.bitcast[DType.uint16]().load().cast[DType.uint32]()) bytes = bytes.offset(2) count -= 2 if count > 0: hash = _hash_word32(hash, bytes.load().cast[DType.uint32]()) return hash @always_inline fn fxhash64(s: String, seed: UInt64 = 0) -> UInt64: var bytes = UnsafePointer(s.unsafe_ptr()) var count = len(s) var hash = seed while count >= 8: hash = _hash_word64(hash, bytes.bitcast[DType.uint64]().load()) bytes = bytes.offset(8) count -= 8 if count >= 4: hash = _hash_word64(hash, bytes.bitcast[DType.uint32]().load().cast[DType.uint64]()) bytes = bytes.offset(4) count -= 4 if count >= 2: hash = _hash_word64(hash, bytes.bitcast[DType.uint16]().load().cast[DType.uint64]()) bytes = bytes.offset(2) count -= 2 if count > 0: hash = _hash_word64(hash, bytes.load().cast[DType.uint64]()) return hash @always_inline fn _hash_word32(value: UInt32, word: UInt32) -> UInt32: return (rotate_bits_left[ROTATE](value) ^ word) * SEED32 @always_inline fn _hash_word64(value: UInt64, word: UInt64) -> UInt64: return (rotate_bits_left[ROTATE](value) ^ word) * SEED64 --- md5/__init__.mojo --- from .md5 import md5_string --- md5/md5.mojo --- # Based on https://github.com/Zunawe/md5-c from utils.loop import unroll from memory.unsafe import bitcast from memory import memset_zero from bit import rotate_bits_left alias S = SIMD[DType.uint32, 64]( 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 ) alias K = SIMD[DType.uint32, 64]( 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ) alias PADDING = create_padding() fn create_padding() -> UnsafePointer[UInt8]: var result = UnsafePointer[UInt8].alloc(64) result.store(0, 0x80) for i in range(1, 64): result.store(i, 0) return result struct Md5Context: var buffer: SIMD[DType.uint32, 4] var input: SIMD[DType.uint8, 64] var digest: SIMD[DType.uint8, 16] var size: UInt64 fn __init__(inout self): self.size = 0 self.buffer = SIMD[DType.uint32, 4](0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476) self.input = SIMD[DType.uint8, 64]() self.digest = SIMD[DType.uint8, 16]() @always_inline fn update(inout self, input_buffer: UnsafePointer[UInt8], length: Int): var offset = int(self.size & 63) var input = SIMD[DType.uint32, 16]() self.size += length for i in range(length): self.input[offset] = input_buffer.offset(i).load() offset += 1 if offset & 63 == 0: # TODO: check if it works on BigEndian arch (or needs bswap?) input = bitcast[DType.uint32, 16](self.input) self.step(input) offset = 0 @always_inline fn finalize(owned self) -> SIMD[DType.uint8, 16]: var input = SIMD[DType.uint32, 16]() var offset = int(self.size & 63) var padding_length = 56 - offset if offset < 56 else 56 + 64 - offset self.update(PADDING, padding_length) self.size -= padding_length input = bitcast[DType.uint32, 16](self.input) input[14] = (self.size * 8).cast[DType.uint32]() input[15] = ((self.size * 8) >> 32).cast[DType.uint32]() self.step(input) return bitcast[DType.uint8, 16](self.buffer) @always_inline fn step(inout self, input: SIMD[DType.uint32, 16]): var aa = self.buffer[0] var bb = self.buffer[1] var cc = self.buffer[2] var dd = self.buffer[3] var e: UInt32 = 0 var j = 0 @parameter fn shuffle[i: Int](): alias step = i >> 4 @parameter if step == 0: e = (bb & cc) | (~bb & dd) j = i elif step == 1: e = (bb & dd) | (cc & ~dd) j = (i * 5 + 1) & 15 elif step == 2: e = bb ^ cc ^ dd j = (i * 3 + 5) & 15 else: e = cc ^ (bb | ~dd) j = (i * 7) & 15 aa, bb, cc, dd = dd, bb + rotate_bits_left[int(S[i])](aa + e + K[i] + input[j]), bb, cc unroll[shuffle, 64]() self.buffer += SIMD[DType.uint32, 4](aa, bb, cc, dd) @always_inline fn md5_string(value: String) -> SIMD[DType.uint8, 16]: var ctx = Md5Context() ctx.update(value.unsafe_ptr(), len(value)) return ctx^.finalize() --- my_utils/__init__.mojo --- from memory import memcmp from pathlib import Path fn int_cmp(a: UInt32, b: UInt32) -> Int: return int(a) - int(b) fn int_cmp64(a: UInt64, b: UInt64) -> Int: return int(a) - int(b) fn int_to_str(a: UInt32) -> String: return str(a) fn int_to_str64(a: UInt64) -> String: return str(a) fn cmp_strl(a: StringLiteral, b: StringLiteral) -> Int: var l = min(len(a), len(b)) var p1 = a.unsafe_ptr() var p2 = b.unsafe_ptr() var diff = memcmp(p1, p2, l) return diff if diff != 0 else len(a) - len(b) fn cmp_str(a: String, b: String) -> Int: var l = min(len(a), len(b)) var p1 = a.unsafe_ptr() var p2 = b.unsafe_ptr() var diff = memcmp(p1, p2, l) return diff if diff != 0 else len(a) - len(b) fn stsl(a: StringLiteral) -> String: return a fn corpus1() raises -> List[String]: return String('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque orci urna, pretium et porta ac, porttitor sit amet sem. Fusce sagittis lorem neque, vitae sollicitudin elit suscipit et. In interdum convallis nisl in ornare. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam erat volutpat. Morbi mollis iaculis lectus ac tincidunt. Fusce nisi lacus, semper eu dignissim et, malesuada non mi. Sed euismod urna vel elit faucibus, eu bibendum ante fringilla. Curabitur tempus in turpis at mattis. Aliquam erat volutpat. Donec maximus elementum felis, sit amet dignissim augue tincidunt blandit. Aliquam fermentum, est eu mollis.').split(" ") fn corpus2() raises -> List[String]: return String('But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection:').split(" ") fn corpus3() raises -> List[String]: return String('A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls').split(" ") fn corpus4() raises -> List[String]: return String('Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину.').split(" ") fn corpus5() raises -> List[String]: return String('Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort "und" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort "und" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort "und" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen').split(" ") fn corpus6() raises -> List[String]: return String('米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。').split(" ") fn corpus7() raises -> List[String]: return String('AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse", "CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus').split(" ") fn corpus8() raises -> List[String]: var text = Path("/usr/share/dict/words").read_text() print("Text:", len(text)) return text.splitlines() --- sha/__init__.mojo --- from .sha256 import sha256_encode --- sha/sha256.mojo --- from memory import memcpy from collections.vector import InlinedFixedVector import time @always_inline fn big_endian_bytes_to_dword( first: UInt8, second: UInt8, third: UInt8, fourth: UInt8 ) -> UInt32: var a = first.cast[DType.uint32]() << 24 var b = second.cast[DType.uint32]() << 16 var c = third.cast[DType.uint32]() << 8 var d = fourth.cast[DType.uint32]() << 0 return a | b | c | d @always_inline fn big_endian_dword_to_bytes(word: UInt32) -> InlinedFixedVector[UInt8, 4]: var v = InlinedFixedVector[UInt8, 4](4) var a = (word >> 24) & 255 var b = (word >> 16) & 255 var c = (word >> 8) & 255 var d = word & 255 v.append(a.cast[DType.uint8]()) v.append(b.cast[DType.uint8]()) v.append(c.cast[DType.uint8]()) v.append(d.cast[DType.uint8]()) return v @always_inline fn big_endian_qword_to_bytes(word: UInt64) -> InlinedFixedVector[UInt8, 8]: var v = InlinedFixedVector[UInt8, 8](8) var a = (word >> 56) & 255 var b = (word >> 48) & 255 var c = (word >> 40) & 255 var d = (word >> 32) & 255 var e = (word >> 24) & 255 var f = (word >> 16) & 255 var g = (word >> 8) & 255 var h = word & 255 v.append(a.cast[DType.uint8]()) v.append(b.cast[DType.uint8]()) v.append(c.cast[DType.uint8]()) v.append(d.cast[DType.uint8]()) v.append(e.cast[DType.uint8]()) v.append(f.cast[DType.uint8]()) v.append(g.cast[DType.uint8]()) v.append(h.cast[DType.uint8]()) return v # bit rotate right @always_inline fn bitrr(integer: UInt32, rotations: UInt32) -> UInt32: return (integer >> rotations) | (integer << (32 - rotations)) alias k = SIMD[DType.uint32, 64]( 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 ) alias h = SIMD[DType.uint32, 8]( 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19, ) # for reference see https://en.wikipedia.org/wiki/SHA-2#Pseudocode # right now it internally copies the byte_view into a dynamic vector and works on that # this is slow, but i don't have the mojo mojo to chunk it out for zero-copy fn sha256_encode(byte_view: UnsafePointer[UInt8], length: Int) -> InlinedFixedVector[UInt8, 32]: var h0: UInt32 = 0x6A09E667 var h1: UInt32 = 0xBB67AE85 var h2: UInt32 = 0x3C6EF372 var h3: UInt32 = 0xA54FF53A var h4: UInt32 = 0x510E527F var h5: UInt32 = 0x9B05688C var h6: UInt32 = 0x1F83D9AB var h7: UInt32 = 0x5BE0CD19 var one_bit: UInt8 = 0b1000_0000 var exact_chunks = length // 64 var remainder_start = exact_chunks * 64 var remainder_length = length % 64 var bare_min_extra_bytes = remainder_length + 9 var extra_space = InlinedFixedVector[UInt8,128](128) for i in range(remainder_length): extra_space.append(byte_view[remainder_start + i]) extra_space.append(one_bit) var only_one_chunk_needed = bare_min_extra_bytes <= 64 var tail_bytes = big_endian_qword_to_bytes(length * 8) if only_one_chunk_needed: while 8+extra_space.current_size < 64: extra_space.append(0) else: while 8+extra_space.current_size < 128: extra_space.append(0) for i in range(8): extra_space.append(tail_bytes[i]) var w = InlinedFixedVector[UInt32, 64](64) # (The initial values in w[0..63] don't matter, so many implementations zero them here) for i in range(64): w.append(0) # loop through the full sets of 64 from the byte view # later, a little code duplication to repeat on the extra space for chunk_number in range(exact_chunks): # create a 64-entry message schedule array w[0..63] of 32-bit words # copy chunk into first 16 words w[0..15] of the message schedule array @parameter for dword_i in range(16): var start_byte_within_chunk = dword_i * 4 var start_byte_overall = start_byte_within_chunk + (64 * chunk_number) var i = start_byte_overall var dword = big_endian_bytes_to_dword( byte_view[i], byte_view[i + 1], byte_view[i + 2], byte_view[i + 3], ) w[dword_i] = dword # Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: @parameter for i in range(16, 64): # s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3) var s0 = bitrr(w[i - 15], 7) ^ bitrr(w[i - 15], 18) ^ (w[i - 15] >> 3) # s1 := (w[i-2] rightrotate 17) xor (w[i-2] rightrotate 19) xor (w[i-2] rightshift 10) var s1 = bitrr(w[i - 2], 17) ^ bitrr(w[i - 2], 19) ^ (w[i - 2] >> 10) # w[i] := w[i-16] + s0 + w[i-7] + s1 w[i] = w[i - 16] + s0 + w[i - 7] + s1 var a = h0 var b = h1 var c = h2 var d = h3 var e = h4 var f = h5 var g = h6 var h = h7 @parameter for i in range(64): # S1 := (e rightrotate 6) xor (e rightrotate 11) xor (e rightrotate 25) var S1 = bitrr(e, 6) ^ bitrr(e, 11) ^ bitrr(e, 25) # ch := (e and f) xor ((not e) and g) var ch = (e & f) ^ ((e ^ (0-1)) & g) # temp1 := h + S1 + ch + k[i] + w[i] var temp1 = h + S1 + ch + k[i] + w[i] # S0 := (a rightrotate 2) xor (a rightrotate 13) xor (a rightrotate 22) var S0 = bitrr(a, 2) ^ bitrr(a, 13) ^ bitrr(a, 22) # maj := (a and b) xor (a and c) xor (b and c) var maj = (a & b) ^ (a & c) ^ (b & c) # temp2 := S0 + maj var temp2 = S0 + maj h = g g = f f = e e = d + temp1 d = c c = b b = a a = temp1 + temp2 h0 = h0 + a h1 = h1 + b h2 = h2 + c h3 = h3 + d h4 = h4 + e h5 = h5 + f h6 = h6 + g h7 = h7 + h #continue through the extra space var extra_chunks = extra_space.current_size // 64 for chunk_number in range(extra_chunks): # create a 64-entry message schedule array w[0..63] of 32-bit words # copy chunk into first 16 words w[0..15] of the message schedule array @parameter for dword_i in range(16): var start_byte_within_chunk = dword_i * 4 var start_byte_overall = start_byte_within_chunk + (64 * chunk_number) var i = start_byte_overall var dword = big_endian_bytes_to_dword( extra_space[i], extra_space[i + 1], extra_space[i + 2], extra_space[i + 3], ) w[dword_i] = dword # Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: @parameter for i in range(16, 64): # s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3) var s0 = bitrr(w[i - 15], 7) ^ bitrr(w[i - 15], 18) ^ (w[i - 15] >> 3) # s1 := (w[i-2] rightrotate 17) xor (w[i-2] rightrotate 19) xor (w[i-2] rightshift 10) var s1 = bitrr(w[i - 2], 17) ^ bitrr(w[i - 2], 19) ^ (w[i - 2] >> 10) # w[i] := w[i-16] + s0 + w[i-7] + s1 w[i] = w[i - 16] + s0 + w[i - 7] + s1 var a = h0 var b = h1 var c = h2 var d = h3 var e = h4 var f = h5 var g = h6 var h = h7 @parameter for i in range(64): # S1 := (e rightrotate 6) xor (e rightrotate 11) xor (e rightrotate 25) var S1 = bitrr(e, 6) ^ bitrr(e, 11) ^ bitrr(e, 25) # ch := (e and f) xor ((not e) and g) var ch = (e & f) ^ ((e ^ (0-1)) & g) # temp1 := h + S1 + ch + k[i] + w[i] var temp1 = h + S1 + ch + k[i] + w[i] # S0 := (a rightrotate 2) xor (a rightrotate 13) xor (a rightrotate 22) var S0 = bitrr(a, 2) ^ bitrr(a, 13) ^ bitrr(a, 22) # maj := (a and b) xor (a and c) xor (b and c) var maj = (a & b) ^ (a & c) ^ (b & c) # temp2 := S0 + maj var temp2 = S0 + maj h = g g = f f = e e = d + temp1 d = c c = b b = a a = temp1 + temp2 h0 = h0 + a h1 = h1 + b h2 = h2 + c h3 = h3 + d h4 = h4 + e h5 = h5 + f h6 = h6 + g h7 = h7 + h var output = InlinedFixedVector[UInt8, 32](32) var digest_part_h0 = big_endian_dword_to_bytes(h0) for i in range(4): output.append(digest_part_h0[i]) var digest_part_h1 = big_endian_dword_to_bytes(h1) for i in range(4): output.append(digest_part_h1[i]) var digest_part_h2 = big_endian_dword_to_bytes(h2) for i in range(4): output.append(digest_part_h2[i]) var digest_part_h3 = big_endian_dword_to_bytes(h3) for i in range(4): output.append(digest_part_h3[i]) var digest_part_h4 = big_endian_dword_to_bytes(h4) for i in range(4): output.append(digest_part_h4[i]) var digest_part_h5 = big_endian_dword_to_bytes(h5) for i in range(4): output.append(digest_part_h5[i]) var digest_part_h6 = big_endian_dword_to_bytes(h6) for i in range(4): output.append(digest_part_h6[i]) var digest_part_h7 = big_endian_dword_to_bytes(h7) for i in range(4): output.append(digest_part_h7[i]) return output --- sha/sha256_2.mojo --- --- test_md5.mojo --- from md5 import md5_string from testing import assert_equal from wyhasher import wyhash from wyhasher.wyhasher import wymum alias alphabete: String = "0123456789abcdef" fn to_hex(v: SIMD[DType.uint8, 16]) -> String: var result: String = "" for i in range(16): var h = v[i] >> 4 var l = v[i] & 15 result += alphabete[int(h)] result += alphabete[int(l)] return result fn main() raises: var a: String = "Hello 🔥" assert_equal(to_hex(md5_string(a)), "b9735ea236e0d3103a39ad102a2e990f") _ = a var b: String = '米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。' assert_equal(to_hex(md5_string(b)), "168f7f85febeb19dbad38502499ea1d0") _ = b --- test_sha256.mojo --- # import time # from sha import sha256_encode # from testing import assert_equal # from collections.vector import InlinedFixedVector # fn print_hex(digest: InlinedFixedVector[UInt8, 32]): # var lookup = String("0123456789abcdef") # var result: String = "" # for i in range(len(digest)): # var v = digest[i].to_int() # result += lookup[(v >> 4)] # result += lookup[v & 15] # print(result) # print(len(digest)) # print(len("b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")) # print(len("985752100505598575751521005110148569753501015350100551009755100979810297995256521011021015155975351564810110157485656102559799101501011029910010157")) # fn main(): # var bytes = 1024 * 1024 * 256 + 78 # var bytes_to_hash: DynamicVector[UInt8] = kinda_random_bytes(bytes) # var ptr = DTypePointer[DType.uint8](bytes_to_hash.data.value) # var buffer = Buffer[DType.uint8](ptr, bytes_to_hash.size) # var before = time.now() # var hash = sha256_encode(ptr, bytes) # var after = time.now() # var keep_vector_alive = bytes_to_hash[4] # var ns = after - before # var seconds = ns / 1_000_000_000 # var megabytes = bytes / 1_000_000 # for i in range(hash.size): # print(hash[i]) # print("megabytes per second") # print(megabytes / seconds) # var text = "hello world" # print(text) # print_hex(sha256_encode(text.data().bitcast[DType.uint8](), len(text))) # fn kinda_random_bytes(length: Int) -> DynamicVector[UInt8]: # var vec = DynamicVector[UInt8](capacity=length) # var n: UInt8 = 245 # var cycle: UInt8 = 1 # for i in range(length): # var shifted = n >> 3 # var shiftalso = n << 4 # var more = shifted ^ n ^ shiftalso # var next = n + more # n = next # cycle ^= n # vec.append(n + cycle) # return vec --- test_sha256_2.mojo --- # from memory import memcpy # from collections.vector import InlinedFixedVector # import time # fn main(): # var bytes = 1024 * 1024 * 256 + 78 # var bytes_to_hash: List[UInt8] = kinda_random_bytes(bytes) # var ptr = bytes_to_hash.unsafe_ptr() # var buffer = Buffer[DType.uint8](ptr, bytes_to_hash.size) # var before = time.now() # var hash = sha256(buffer) # var after = time.now() # var keep_vector_alive = bytes_to_hash[4] # var ns = after - before # var seconds = ns / 1_000_000_000 # var megabytes = bytes / 1_000_000 # for i in range(hash.size): # print(hash[i]) # print("megabytes per second") # print(megabytes / seconds) # fn kinda_random_bytes(length: Int) -> DynamicVector[UInt8]: # var vec = DynamicVector[UInt8](capacity=length) # var n: UInt8 = 245 # var cycle: UInt8 = 1 # for i in range(length): # var shifted = n >> 3 # var shiftalso = n << 4 # var more = shifted ^ n ^ shiftalso # var next = n + more # n = next # cycle ^= n # vec.append(n + cycle) # return vec # @always_inline # fn big_endian_bytes_to_dword( # first: UInt8, second: UInt8, third: UInt8, fourth: UInt8 # ) -> UInt32: # var a = first.cast[DType.uint32]() << 24 # var b = second.cast[DType.uint32]() << 16 # var c = third.cast[DType.uint32]() << 8 # var d = fourth.cast[DType.uint32]() << 0 # return a | b | c | d # @always_inline # fn big_endian_dword_to_bytes(word: UInt32) -> InlinedFixedVector[UInt8, 4]: # var v = InlinedFixedVector[UInt8, 4](4) # var a = (word >> 24) & 255 # var b = (word >> 16) & 255 # var c = (word >> 8) & 255 # var d = word & 255 # v.append(a.cast[DType.uint8]()) # v.append(b.cast[DType.uint8]()) # v.append(c.cast[DType.uint8]()) # v.append(d.cast[DType.uint8]()) # return v # @always_inline # fn big_endian_qword_to_bytes(word: UInt64) -> InlinedFixedVector[UInt8, 8]: # var v = InlinedFixedVector[UInt8, 8](8) # var a = (word >> 56) & 255 # var b = (word >> 48) & 255 # var c = (word >> 40) & 255 # var d = (word >> 32) & 255 # var e = (word >> 24) & 255 # var f = (word >> 16) & 255 # var g = (word >> 8) & 255 # var h = word & 255 # v.append(a.cast[DType.uint8]()) # v.append(b.cast[DType.uint8]()) # v.append(c.cast[DType.uint8]()) # v.append(d.cast[DType.uint8]()) # v.append(e.cast[DType.uint8]()) # v.append(f.cast[DType.uint8]()) # v.append(g.cast[DType.uint8]()) # v.append(h.cast[DType.uint8]()) # return v # # bit rotate right # @always_inline # fn bitrr(integer: UInt32, rotations: UInt32) -> UInt32: # return (integer >> rotations) | (integer << (32 - rotations)) # # for reference see https://en.wikipedia.org/wiki/SHA-2#Pseudocode # # right now it internally copies the byte_view into a dynamic vector and works on that # # this is slow, but i don't have the mojo mojo to chunk it out for zero-copy # fn sha256(byte_view: Buffer[_, DType.uint8, 0]) -> InlinedFixedVector[UInt8, 32]: # var k = InlinedFixedVector[UInt32, 64](64) # k.append(0x428A2F98) # k.append(0x71374491) # k.append(0xB5C0FBCF) # k.append(0xE9B5DBA5) # k.append(0x3956C25B) # k.append(0x59F111F1) # k.append(0x923F82A4) # k.append(0xAB1C5ED5) # k.append(0xD807AA98) # k.append(0x12835B01) # k.append(0x243185BE) # k.append(0x550C7DC3) # k.append(0x72BE5D74) # k.append(0x80DEB1FE) # k.append(0x9BDC06A7) # k.append(0xC19BF174) # k.append(0xE49B69C1) # k.append(0xEFBE4786) # k.append(0x0FC19DC6) # k.append(0x240CA1CC) # k.append(0x2DE92C6F) # k.append(0x4A7484AA) # k.append(0x5CB0A9DC) # k.append(0x76F988DA) # k.append(0x983E5152) # k.append(0xA831C66D) # k.append(0xB00327C8) # k.append(0xBF597FC7) # k.append(0xC6E00BF3) # k.append(0xD5A79147) # k.append(0x06CA6351) # k.append(0x14292967) # k.append(0x27B70A85) # k.append(0x2E1B2138) # k.append(0x4D2C6DFC) # k.append(0x53380D13) # k.append(0x650A7354) # k.append(0x766A0ABB) # k.append(0x81C2C92E) # k.append(0x92722C85) # k.append(0xA2BFE8A1) # k.append(0xA81A664B) # k.append(0xC24B8B70) # k.append(0xC76C51A3) # k.append(0xD192E819) # k.append(0xD6990624) # k.append(0xF40E3585) # k.append(0x106AA070) # k.append(0x19A4C116) # k.append(0x1E376C08) # k.append(0x2748774C) # k.append(0x34B0BCB5) # k.append(0x391C0CB3) # k.append(0x4ED8AA4A) # k.append(0x5B9CCA4F) # k.append(0x682E6FF3) # k.append(0x748F82EE) # k.append(0x78A5636F) # k.append(0x84C87814) # k.append(0x8CC70208) # k.append(0x90BEFFFA) # k.append(0xA4506CEB) # k.append(0xBEF9A3F7) # k.append(0xC67178F2) # var h0: UInt32 = 0x6A09E667 # var h1: UInt32 = 0xBB67AE85 # var h2: UInt32 = 0x3C6EF372 # var h3: UInt32 = 0xA54FF53A # var h4: UInt32 = 0x510E527F # var h5: UInt32 = 0x9B05688C # var h6: UInt32 = 0x1F83D9AB # var h7: UInt32 = 0x5BE0CD19 # var one_bit: UInt8 = 0b1000_0000 # var exact_chunks = byte_view.dynamic_size // 64 # var remainder_start = exact_chunks * 64 # var remainder_length = byte_view.dynamic_size % 64 # var bare_min_extra_bytes = remainder_length + 9 # var extra_space = InlinedFixedVector[UInt8,128](128) # for i in range(remainder_length): # extra_space.append(byte_view[remainder_start + i]) # extra_space.append(one_bit) # var only_one_chunk_needed = bare_min_extra_bytes <= 64 # var tail_bytes = big_endian_qword_to_bytes(byte_view.dynamic_size * 8) # if only_one_chunk_needed: # while 8+extra_space.current_size < 64: # extra_space.append(0) # else: # while 8+extra_space.current_size < 128: # extra_space.append(0) # for i in range(8): # extra_space.append(tail_bytes[i]) # var w = InlinedFixedVector[UInt32, 64](64) # # (The initial values in w[0..63] don't matter, so many implementations zero them here) # for i in range(64): # w.append(0) # # loop through the full sets of 64 from the byte view # # later, a little code duplication to repeat on the extra space # for chunk_number in range(exact_chunks): # # create a 64-entry message schedule array w[0..63] of 32-bit words # # copy chunk into first 16 words w[0..15] of the message schedule array # @unroll # for dword_i in range(16): # var start_byte_within_chunk = dword_i * 4 # var start_byte_overall = start_byte_within_chunk + (64 * chunk_number) # var i = start_byte_overall # var dword = big_endian_bytes_to_dword( # byte_view[i], # byte_view[i + 1], # byte_view[i + 2], # byte_view[i + 3], # ) # w[dword_i] = dword # # Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: # @unroll # for i in range(16, 64): # # s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3) # var s0 = bitrr(w[i - 15], 7) ^ bitrr(w[i - 15], 18) ^ (w[i - 15] >> 3) # # s1 := (w[i-2] rightrotate 17) xor (w[i-2] rightrotate 19) xor (w[i-2] rightshift 10) # var s1 = bitrr(w[i - 2], 17) ^ bitrr(w[i - 2], 19) ^ (w[i - 2] >> 10) # # w[i] := w[i-16] + s0 + w[i-7] + s1 # w[i] = w[i - 16] + s0 + w[i - 7] + s1 # var a = h0 # var b = h1 # var c = h2 # var d = h3 # var e = h4 # var f = h5 # var g = h6 # var h = h7 # @unroll # for i in range(64): # # S1 := (e rightrotate 6) xor (e rightrotate 11) xor (e rightrotate 25) # var S1 = bitrr(e, 6) ^ bitrr(e, 11) ^ bitrr(e, 25) # # ch := (e and f) xor ((not e) and g) # var ch = (e & f) ^ ((e ^ (0-1)) & g) # # temp1 := h + S1 + ch + k[i] + w[i] # var temp1 = h + S1 + ch + k[i] + w[i] # # S0 := (a rightrotate 2) xor (a rightrotate 13) xor (a rightrotate 22) # var S0 = bitrr(a, 2) ^ bitrr(a, 13) ^ bitrr(a, 22) # # maj := (a and b) xor (a and c) xor (b and c) # var maj = (a & b) ^ (a & c) ^ (b & c) # # temp2 := S0 + maj # var temp2 = S0 + maj # h = g # g = f # f = e # e = d + temp1 # d = c # c = b # b = a # a = temp1 + temp2 # h0 = h0 + a # h1 = h1 + b # h2 = h2 + c # h3 = h3 + d # h4 = h4 + e # h5 = h5 + f # h6 = h6 + g # h7 = h7 + h # #continue through the extra space # var extra_chunks = extra_space.current_size // 64 # for chunk_number in range(extra_chunks): # # create a 64-entry message schedule array w[0..63] of 32-bit words # # copy chunk into first 16 words w[0..15] of the message schedule array # @unroll # for dword_i in range(16): # var start_byte_within_chunk = dword_i * 4 # var start_byte_overall = start_byte_within_chunk + (64 * chunk_number) # var i = start_byte_overall # var dword = big_endian_bytes_to_dword( # extra_space[i], # extra_space[i + 1], # extra_space[i + 2], # extra_space[i + 3], # ) # w[dword_i] = dword # # Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: # @unroll # for i in range(16, 64): # # s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3) # var s0 = bitrr(w[i - 15], 7) ^ bitrr(w[i - 15], 18) ^ (w[i - 15] >> 3) # # s1 := (w[i-2] rightrotate 17) xor (w[i-2] rightrotate 19) xor (w[i-2] rightshift 10) # var s1 = bitrr(w[i - 2], 17) ^ bitrr(w[i - 2], 19) ^ (w[i - 2] >> 10) # # w[i] := w[i-16] + s0 + w[i-7] + s1 # w[i] = w[i - 16] + s0 + w[i - 7] + s1 # var a = h0 # var b = h1 # var c = h2 # var d = h3 # var e = h4 # var f = h5 # var g = h6 # var h = h7 # @unroll # for i in range(64): # # S1 := (e rightrotate 6) xor (e rightrotate 11) xor (e rightrotate 25) # var S1 = bitrr(e, 6) ^ bitrr(e, 11) ^ bitrr(e, 25) # # ch := (e and f) xor ((not e) and g) # var ch = (e & f) ^ ((e ^ (0-1)) & g) # # temp1 := h + S1 + ch + k[i] + w[i] # var temp1 = h + S1 + ch + k[i] + w[i] # # S0 := (a rightrotate 2) xor (a rightrotate 13) xor (a rightrotate 22) # var S0 = bitrr(a, 2) ^ bitrr(a, 13) ^ bitrr(a, 22) # # maj := (a and b) xor (a and c) xor (b and c) # var maj = (a & b) ^ (a & c) ^ (b & c) # # temp2 := S0 + maj # var temp2 = S0 + maj # h = g # g = f # f = e # e = d + temp1 # d = c # c = b # b = a # a = temp1 + temp2 # h0 = h0 + a # h1 = h1 + b # h2 = h2 + c # h3 = h3 + d # h4 = h4 + e # h5 = h5 + f # h6 = h6 + g # h7 = h7 + h # var output = InlinedFixedVector[UInt8, 32](32) # var digest_part_h0 = big_endian_dword_to_bytes(h0) # for i in range(4): # output.append(digest_part_h0[i]) # var digest_part_h1 = big_endian_dword_to_bytes(h1) # for i in range(4): # output.append(digest_part_h1[i]) # var digest_part_h2 = big_endian_dword_to_bytes(h2) # for i in range(4): # output.append(digest_part_h2[i]) # var digest_part_h3 = big_endian_dword_to_bytes(h3) # for i in range(4): # output.append(digest_part_h3[i]) # var digest_part_h4 = big_endian_dword_to_bytes(h4) # for i in range(4): # output.append(digest_part_h4[i]) # var digest_part_h5 = big_endian_dword_to_bytes(h5) # for i in range(4): # output.append(digest_part_h5[i]) # var digest_part_h6 = big_endian_dword_to_bytes(h6) # for i in range(4): # output.append(digest_part_h6[i]) # var digest_part_h7 = big_endian_dword_to_bytes(h7) # for i in range(4): # output.append(digest_part_h7[i]) # return output --- wyhasher/__init__.mojo --- from .wyhasher import wyhash --- wyhasher/wyhasher.mojo --- from bit import bit_width, byte_swap from bit import rotate_bits_right alias U128 = SIMD[DType.uint64, 2] alias U256 = SIMD[DType.uint64, 4] alias default_secret = SIMD[DType.uint64, 4](0x2d358dccaa6c78a5, 0x8bb84b93962eacc9, 0x4b33a62ed433d4a3, 0x4d5a2da51de1aa47) @always_inline fn wymum_32(inout a: UInt64, inout b: UInt64): var ab = U128(a, b) var abl = ab & 0xff_ff_ff_ff var abh = ab >> 32 var hh = abh.reduce_mul() var hl = abh[0] * abl[1] var ll = abl.reduce_mul() var lh = abl[0] * abh[1] a, b = rotate_bits_right[32](hl) ^ hh, rotate_bits_right[32](lh) ^ ll @always_inline fn wymum(inout a: UInt64, inout b: UInt64): var ab = U128(a, b) var abl = ab & 0xff_ff_ff_ff var abh = ab >> 32 var hh = abh.reduce_mul() var hl = abh[0] * abl[1] var ll = abl.reduce_mul() var lh = abl[0] * abh[1] var t = ll + (hl << 32) var lo = t + (lh << 32) var c = (t < ll).cast[DType.uint64]() c += (lo < t).cast[DType.uint64]() var hi = hh + (hl >> 32) + (lh >> 32) + c a, b = lo, hi @always_inline fn wy_mix(_a: UInt64, _b: UInt64) -> UInt64: var a = _a var b = _b wymum(a, b) return a ^ b @always_inline fn wyr8(p: UnsafePointer[UInt8]) -> UInt64: return p.bitcast[DType.uint64]().load() @always_inline fn wyr4(p: UnsafePointer[UInt8]) -> UInt64: return p.bitcast[DType.uint32]().load().cast[DType.uint64]() @always_inline fn wyr3(p: UnsafePointer[UInt8], k: Int) -> UInt64: return (p.load().cast[DType.uint64]() << 16) | (p.offset(k >> 1).load().cast[DType.uint64]() << 8) | p.offset(k - 1).load().cast[DType.uint64]() fn wyhash(key: String, _seed: UInt64, secret: U256 = default_secret) -> UInt64: var length = len(key) var p = UnsafePointer(key.unsafe_ptr()) var seed = _seed ^ wy_mix(_seed ^ secret[0], secret[1]) var a: UInt64 = 0 var b: UInt64 = 0 if length <= 16: if length >= 4: var last_part_index = (length >> 3) << 2 a = (wyr4(p) << 32) | wyr4(p.offset(last_part_index)) b = (wyr4(p.offset(length - 4)) << 32) | wyr4(p.offset(length - 4 - last_part_index)) elif length > 0: a = wyr3(p, length) else: var see1 = seed var see2 = seed while length >= 48: var p64 = p.bitcast[DType.uint64]() var data1 = p64.load[width=4]() var data2 = p64.load[width=2]() var seed_values1 = U256(secret[1], seed, secret[2], see1) var seed_values2 = U128(secret[3], see2) var seeded_data1 = data1 ^ seed_values1 var seeded_data2 = data2 ^ seed_values2 seed = wy_mix(seed_values1[0], seed_values1[1]) see1 = wy_mix(seed_values1[2], seed_values1[3]) see2 = wy_mix(seed_values2[0], seed_values2[1]) p = p.offset(48) length -= 48 seed ^= see1 ^ see2 while length > 16: var p64 = p.bitcast[DType.uint64]() var data = p64.load[width=2]() var seed_values = U128(secret[1], seed) var seeded_data = data ^ seed_values seed = wy_mix(seeded_data[0], seeded_data[1]) p = p.offset(16) length -= 16 a = wyr8(p.offset(length-16)) b = wyr8(p.offset(length-8)) a ^= secret[1] b ^= seed wymum(a, b) return wy_mix(a ^ secret[0] ^ len(key), b ^ secret[1]) --- C/README.md --- # Compiling ```gcc -Wall -Wextra -O3 -o kittenJPEG kittenJPEG.c -lm``` # Usage ```./main filename.jpg``` It will create a decoded ppm file named decodedimage.ppm --- C/main.c --- #include <stdlib.h> #include <stdio.h> #include <stdint.h> #include <stdbool.h> #include <string.h> #include <math.h> #include <err.h> #include <time.h> const char * comp_names[3]={"Y","Cb","Cr"}; typedef struct { uint_fast8_t H; uint_fast8_t V; uint_fast8_t Tq; uint_fast16_t xi; uint_fast16_t yi; uint_fast8_t Td; //quant table for DC uint_fast8_t Ta; //quant table for AC } components_data_t; typedef struct { uint_fast8_t sz; uint_fast16_t codeword; uint_fast8_t decoded; } huffman_entry_t; typedef struct { uint_fast8_t nb_entries; huffman_entry_t entries[256]; } huffman_table_t; typedef uint_fast8_t quantization_table_t[8][8]; typedef struct { double Y; double Cb; double Cr; } pixel_YCbCr_t; typedef struct { uint8_t * data; uint_fast32_t filesize; uint_fast32_t pos_in_file; uint_fast16_t size_X; uint_fast16_t size_Y; uint_fast8_t Hmax; uint_fast8_t Vmax; uint_fast32_t nb_MCU_total; uint8_t * compressed_pixeldata; uint_fast32_t sz_compressed_pixeldata; uint_fast32_t pos_compressed_pixeldata; uint_fast32_t bitpos_in_compressed_pixeldata; uint_fast8_t nb_components; components_data_t components_data[4]; huffman_table_t huff_tables[2][2]; //Tc (type=AC/DC), Th (destination identifier) quantization_table_t quant_tables[4]; pixel_YCbCr_t ** pixels_YCbCr; } picture_t; typedef double matrix8x8_t[8][8]; uint8_t get1i(uint8_t const * const data, uint_fast32_t * const pos) { uint8_t val=data[*pos]; (*pos)++; return val; } uint16_t get2i(uint8_t const * const data, uint_fast32_t * const pos) { uint16_t val=(data[*pos]<<8)|data[(*pos)+1]; (*pos)+=2; return val; } uint32_t get4i(uint8_t const * const data, uint_fast32_t * const pos) { uint32_t val=(data[*pos]<<24)|(data[(*pos)+1]<<16)|(data[(*pos)+2]<<8)|(data[(*pos)+3]); (*pos)+=4; return val; } uint16_t get_marker(uint8_t const * const data, uint_fast32_t * const pos) { return get2i(data, pos); } char *to_bin(const uint16_t word, const uint8_t sz) { static char str[17]; memset(str, '\0', 17); uint8_t i; for(i=0; i<sz; i++) str[i]='0'+!!(word&(1<<(sz-i-1))); return str; } uint_fast32_t ceil_to_multiple_of(const uint_fast32_t val, const uint_fast32_t multiple) { return (uint_fast32_t)(multiple*ceil((double)val/multiple)); } void skip_EXIF(picture_t * const pic) { uint16_t len=get2i(pic->data, &(pic->pos_in_file)); printf("APP1 (probably EXIF) found (length %u bytes), skipping\n", len); pic->pos_in_file+=len-2; } void parse_APP0(picture_t * const pic) { uint16_t len = get2i(pic->data, &(pic->pos_in_file)); printf("APP0 found (length %u bytes)\n", len); if (len < 16) errx(1, "APP0: too short"); uint8_t identifier[5]; memcpy(identifier, &pic->data[pic->pos_in_file], 5); pic->pos_in_file += 5; uint_fast8_t version_major = get1i(pic->data, &(pic->pos_in_file)); uint_fast8_t version_minor = get1i(pic->data, &(pic->pos_in_file)); uint_fast8_t units = get1i(pic->data, &(pic->pos_in_file)); uint_fast16_t Xdensity = get2i(pic->data, &(pic->pos_in_file)); uint_fast16_t Ydensity = get2i(pic->data, &(pic->pos_in_file)); uint_fast16_t Xthumbnail = get1i(pic->data, &(pic->pos_in_file)); uint_fast16_t Ythumbnail = get1i(pic->data, &(pic->pos_in_file)); if (memcmp(identifier, "JFIF\x00", 5)) errx(1, "APP0: invalid identifier"); printf("version %u.%u\n", version_major, version_minor); printf("units %u\n", units); printf("density X %lu Y %lu\n", Xdensity, Ydensity); uint_fast32_t bytes_thumbnail = 3 * Xthumbnail * Ythumbnail; if (bytes_thumbnail) { printf("thumbnail %lu bytes, skipping\n", bytes_thumbnail); pic->pos_in_file += bytes_thumbnail; } else printf("no thumbnail\n"); printf("parse_APP0 at end get2i pic->pos_in_file: %lu\n", (unsigned long)pic->pos_in_file); } void parse_DQT(picture_t * const pic) { uint16_t Lq=get2i(pic->data, &(pic->pos_in_file)); printf("DQT found (length %u bytes)\n", Lq); uint8_t PqTq=get1i(pic->data, &(pic->pos_in_file)); uint8_t Pq=(PqTq>>4)&0x0f; uint8_t Tq=PqTq&0x0f; printf("Pq (element precision) %u -> %u bits\n", Pq, (Pq==0)?8:16); printf("Tq (table destination identifier) %u\n", Tq); if(Pq!=0) errx(1, "DQT: only 8 bit precision supported"); uint16_t nb_data_bytes=Lq-2-1; if(nb_data_bytes!=64) errx(1, "DQT: nb_data_bytes!=64"); uint8_t u,v; for(u=0; u<8; u++) { for(v=0; v<8; v++) { uint8_t Q=get1i(pic->data, &(pic->pos_in_file)); pic->quant_tables[Tq][u][v]=Q; } } printf("\n"); } void parse_SOF0(picture_t * const pic) { uint16_t len=get2i(pic->data, &(pic->pos_in_file)); printf("SOF0 found (length %u bytes)\n", len); uint_fast8_t P=get1i(pic->data, &(pic->pos_in_file)); uint_fast16_t Y=get2i(pic->data, &(pic->pos_in_file)); uint_fast16_t X=get2i(pic->data, &(pic->pos_in_file)); uint_fast8_t Nf=get1i(pic->data, &(pic->pos_in_file)); if(P!=8) errx(1, "SOF0: P!=8 unsupported"); if(Y==0) errx(1, "SOF0: Y==0 unsupported"); printf("P %u (must be 8)\n", P); printf("imagesize X %lu Y %lu\n", X, Y); printf("Nf (number of components) %u\n", Nf); if(Nf!=3) errx(1, "picture does not have 3 components, this code will not work"); pic->size_X=X; pic->size_Y=Y; uint_fast8_t i; for(i=0; i<Nf; i++) { uint8_t C=get1i(pic->data, &(pic->pos_in_file)); uint8_t HV=get1i(pic->data, &(pic->pos_in_file)); uint8_t H=(HV>>4)&0x0f; uint8_t V=HV&0x0f; uint8_t Tq=get1i(pic->data, &(pic->pos_in_file)); pic->components_data[i].H=H; pic->components_data[i].V=V; pic->components_data[i].Tq=Tq; printf("component %u (%s) C %u, H %u, V %u, Tq %u\n", i, comp_names[i], C, H, V, Tq); } pic->nb_components=Nf; uint_fast8_t Hmax=0,Vmax=0; for(i=0; i<pic->nb_components; i++) { if(pic->components_data[i].H>Hmax) Hmax=pic->components_data[i].H; if(pic->components_data[i].V>Vmax) Vmax=pic->components_data[i].V; } pic->Hmax=Hmax; pic->Vmax=Vmax; pic->nb_MCU_total=(ceil_to_multiple_of(pic->size_X, 8*Hmax)/(8*Hmax))*(ceil_to_multiple_of(pic->size_Y, 8*Hmax)/(8*Vmax)); printf("Hmax %u Vmax %u\n", Hmax, Vmax); printf("MCU_total %lu\n", pic->nb_MCU_total); uint16_t xi,yi; for(i=0; i<pic->nb_components; i++) { xi=(uint16_t)ceil((double)pic->size_X*pic->components_data[i].H/Hmax); yi=(uint16_t)ceil((double)pic->size_Y*pic->components_data[i].V/Vmax); pic->components_data[i].xi=xi; pic->components_data[i].yi=yi; printf("component %u (%s) xi %u yi %u\n", i, comp_names[i], xi, yi); } printf("allocating memory for pixels\n"); uint_fast16_t x,y; pic->pixels_YCbCr=malloc(pic->size_X*sizeof(pixel_YCbCr_t*)); for(x=0; x<pic->size_X; x++) pic->pixels_YCbCr[x]=malloc(pic->size_Y*sizeof(pixel_YCbCr_t)); for(x=0; x<pic->size_X; x++) { for(y=0; y<pic->size_Y; y++) { pic->pixels_YCbCr[x][y].Y=0; pic->pixels_YCbCr[x][y].Cb=0; pic->pixels_YCbCr[x][y].Cr=0; } } printf("memory allocated\n"); } void parse_DHT(picture_t * const pic) { uint16_t len=get2i(pic->data, &(pic->pos_in_file)); printf("DHT found (length %u bytes)\n", len); uint8_t TcTh=get1i(pic->data, &(pic->pos_in_file)); uint8_t Tc=(TcTh>>4)&0x0f; uint8_t Th=TcTh&0x0f; printf("Tc %u (%s table)\n", Tc, (Tc==0)?"DC":"AC"); printf("Th (table destination identifier) %u\n", Th); uint8_t L[16]; uint8_t mt=0; uint8_t i; for(i=0; i<16; i++) { L[i]=get1i(pic->data, &(pic->pos_in_file)); mt+=L[i]; } printf("total %u codes\n", mt); uint16_t codeword=0; for(i=0; i<16; i++) { uint8_t j; for(j=0; j<L[i]; j++) { uint8_t V=get1i(pic->data, &(pic->pos_in_file)); pic->huff_tables[Tc][Th].entries[pic->huff_tables[Tc][Th].nb_entries].sz=i+1; pic->huff_tables[Tc][Th].entries[pic->huff_tables[Tc][Th].nb_entries].codeword=codeword; pic->huff_tables[Tc][Th].entries[pic->huff_tables[Tc][Th].nb_entries].decoded=V; pic->huff_tables[Tc][Th].nb_entries++; codeword++; } codeword<<=1; } } void parse_SOS(picture_t * const pic) { uint16_t len=get2i(pic->data, &(pic->pos_in_file)); //without actual bitmap data printf("SOS found (length %u bytes)\n", len); uint8_t Ns=get1i(pic->data, &(pic->pos_in_file)); printf("Ns %u\n", Ns); uint8_t j; for(j=0; j<Ns; j++) { uint8_t Cs=get1i(pic->data, &(pic->pos_in_file)); uint8_t TdTa=get1i(pic->data, &(pic->pos_in_file)); uint8_t Td=(TdTa>>4)&0x0f; uint8_t Ta=TdTa&0x0f; printf("component %u (%s) Cs %u Td %u Ta %u\n", j, comp_names[j], Cs, Td, Ta); pic->components_data[j].Td=Td; //DC pic->components_data[j].Ta=Ta; //AC } uint8_t Ss=get1i(pic->data, &(pic->pos_in_file)); uint8_t Se=get1i(pic->data, &(pic->pos_in_file)); uint8_t AhAl=get1i(pic->data, &(pic->pos_in_file)); uint8_t Ah=(AhAl>>4)&0x0f; uint8_t Al=AhAl&0x0f; printf("Ss %u Se %u Ah %u Al %u\n", Ss, Se, Ah, Al); pic->pos_compressed_pixeldata=pic->pos_in_file; printf("compressed pixeldata starts at pos %lu\n\n", pic->pos_compressed_pixeldata); } void copy_bitmap_data_remove_stuffing(picture_t * const pic) { printf("removing stuffing...\n"); //get length of bitstream without stuffing uint_fast32_t pos=pic->pos_compressed_pixeldata; uint_fast32_t size=0; uint8_t byte; uint16_t combined=0; do { if(pos>=pic->filesize) errx(1, "marker EOI (0xFFD9) missing"); byte=pic->data[pos++]; if(byte==0xFF) { uint8_t byte2=pic->data[pos++]; if(byte2!=0x00) combined=(byte<<8)|byte2; else size++; } else size++; } while(combined!=0xFFD9); uint_fast32_t size_stuffed=pos-pic->pos_compressed_pixeldata-2; //remove stuffing pic->compressed_pixeldata=malloc(size*sizeof(uint8_t)); if(!pic->compressed_pixeldata) err(1, "malloc"); printf("%lu bytes with stuffing\n", size_stuffed); uint_fast32_t i; uint_fast32_t size_without_stuffing; for(i=pic->pos_compressed_pixeldata, pos=0, size_without_stuffing=0; i<(pic->pos_compressed_pixeldata+size_stuffed); ) { if(pic->data[i]!=0xFF) { pic->compressed_pixeldata[pos++]=pic->data[i++]; size_without_stuffing++; } else if(pic->data[i]==0xFF && pic->data[i+1]==0x00) { pic->compressed_pixeldata[pos++]=0xFF; size_without_stuffing++; i+=2; } else errx(1, "unexpected marker 0x%02x%02x found in bitstream", pic->data[i], pic->data[i+1]); } pic->bitpos_in_compressed_pixeldata=0; pic->sz_compressed_pixeldata=size_without_stuffing; pic->pos_in_file=pic->pos_compressed_pixeldata+size_stuffed; printf("%lu data bytes without stuffing\n\n", size_without_stuffing); } int16_t convert_to_neg(uint16_t bits, const uint8_t sz) { int16_t ret=-((bits^0xFFFF)&((1<<sz)-1)); return ret; } uint16_t bitstream_get_bits(picture_t * const pic, const uint_fast8_t nb_bits) { if(nb_bits>16) errx(1, "bitstream_get_bits: >16 bits requested"); uint_fast32_t index=pic->bitpos_in_compressed_pixeldata/8; int_fast8_t pos_in_byte=(7-pic->bitpos_in_compressed_pixeldata%8); uint16_t ret=0; uint_fast8_t bits_copied=0; while(pos_in_byte>=0 && bits_copied<nb_bits) { ret<<=1; ret|=!!(pic->compressed_pixeldata[index]&(1<<pos_in_byte)); bits_copied++; pos_in_byte--; if(pos_in_byte<0) { pos_in_byte=7; index++; } } return ret; } void bitstream_remove_bits(picture_t * const pic, const uint_fast8_t nb_bits) { pic->bitpos_in_compressed_pixeldata+=nb_bits; } bool huff_decode(picture_t * const pic, const uint8_t Tc, const uint8_t Th, const uint8_t sz, const uint16_t bitstream, uint8_t * const decoded) { uint32_t i; for(i=0; i<pic->huff_tables[Tc][Th].nb_entries; i++) { if(pic->huff_tables[Tc][Th].entries[i].sz==sz && pic->huff_tables[Tc][Th].entries[i].codeword==bitstream) { (*decoded)=pic->huff_tables[Tc][Th].entries[i].decoded; return true; } } return false; } bool bitstream_get_next_decoded_element(picture_t * const pic, const uint8_t Tc, const uint8_t Th, uint8_t * const decoded, uint_fast8_t * const nb_bits) { uint16_t huff_candidate; bool found; while(pic->bitpos_in_compressed_pixeldata<8*pic->sz_compressed_pixeldata) { found=false; for(*nb_bits=1; *nb_bits<=16; (*nb_bits)++) { if((pic->bitpos_in_compressed_pixeldata+*nb_bits)>8*pic->sz_compressed_pixeldata) errx(1, "end of stream, requested to many bits"); huff_candidate=bitstream_get_bits(pic, *nb_bits); if(huff_decode(pic, Tc, Th, *nb_bits, huff_candidate, decoded)) { found=true; bitstream_remove_bits(pic, *nb_bits); return true; } } if(!found) { //check if it's padding, else error bool is_all_one=true; uint_fast8_t i; for(i=0; i<(*nb_bits)-1; i++) { if((huff_candidate&(1<<i))==0) { is_all_one=false; break; } } if(is_all_one) //padding bitstream_remove_bits(pic, *nb_bits); else errx(1, "unknown code in bitstream bitpos %lu byte 0x%x [prev 0x%x, next 0x%x]", pic->bitpos_in_compressed_pixeldata, pic->compressed_pixeldata[pic->bitpos_in_compressed_pixeldata/8], pic->compressed_pixeldata[(pic->bitpos_in_compressed_pixeldata/8)-1], pic->compressed_pixeldata[(pic->bitpos_in_compressed_pixeldata/8)+1]); } } return false; } void store_data_unit_YCbCr(picture_t * const pic, const uint_fast32_t MCU, const uint_fast8_t component, const uint_fast8_t data_unit, const matrix8x8_t data) { uint_fast8_t zoomX, zoomY; zoomX=pic->Hmax/pic->components_data[component].H; zoomY=pic->Vmax/pic->components_data[component].V; uint_fast8_t scaleX, scaleY; scaleX=8*pic->components_data[component].H; scaleY=8*pic->components_data[component].V; uint_fast16_t startX, startY; startX=MCU%(ceil_to_multiple_of(pic->size_X, 8*pic->Hmax)/(scaleX*zoomX)); startY=MCU/(ceil_to_multiple_of(pic->size_X, 8*pic->Hmax)/(scaleY*zoomY)); //yes, size_X and H! uint_fast16_t startHiX=data_unit%pic->components_data[component].H; uint_fast16_t startHiY=data_unit/pic->components_data[component].H; //yes, H! uint_fast8_t x,y; uint_fast8_t zx,zy; uint_fast32_t posX, posY; for(x=0; x<8; x++) { for(y=0; y<8; y++) { for(zx=0; zx<zoomX; zx++) { for(zy=0; zy<zoomY; zy++) { posX=(scaleX*startX+8*startHiX+x)*zoomX+zx; posY=(scaleY*startY+8*startHiY+y)*zoomY+zy; if(posX<pic->size_X && posY<pic->size_Y) { switch(component) { case 0: pic->pixels_YCbCr[posX][posY].Y=data[x][y]; break; case 1: pic->pixels_YCbCr[posX][posY].Cb=data[x][y]; break; case 2: pic->pixels_YCbCr[posX][posY].Cr=data[x][y]; break; default: errx(1, "unknown component"); break; } } } } } } } void reverse_ZZ_and_dequant(picture_t const * const pic, const uint8_t quant_table, const matrix8x8_t inp, matrix8x8_t outp) { const uint_fast8_t reverse_ZZ_u[8][8]={ {0, 0, 1, 2, 1, 0, 0, 1 }, {2, 3, 4, 3, 2, 1, 0, 0 }, {1, 2, 3, 4, 5, 6, 5, 4 }, {3, 2, 1, 0, 0, 1, 2, 3 }, {4, 5, 6, 7, 7, 6, 5, 4 }, {3, 2, 1, 2, 3, 4, 5, 6 }, {7, 7, 6, 5, 4, 3, 4, 5 }, {6, 7, 7, 6, 5, 6, 7, 7 } }; const uint_fast8_t reverse_ZZ_v[8][8]={ {0, 1, 0, 0, 1, 2, 3, 2 }, {1, 0, 0, 1, 2, 3, 4, 5 }, {4, 3, 2, 1, 0, 0, 1, 2 }, {3, 4, 5, 6, 7, 6, 5, 4 }, {3, 2, 1, 0, 1, 2, 3, 4 }, {5, 6, 7, 7, 6, 5, 4, 3 }, {2, 3, 4, 5, 6, 7, 7, 6 }, {5, 4, 5, 6, 7, 7, 6, 7 } }; uint_fast8_t u,v; for(u=0; u<8; u++) for(v=0; v<8; v++) outp[reverse_ZZ_u[u][v]][reverse_ZZ_v[u][v]]=inp[u][v]*pic->quant_tables[quant_table][u][v]; } #define a_c 0.9807 #define b_c 0.8314 #define c_c 0.5555 #define d_c 0.1950 #define e_c 0.9238 #define f_c 0.3826 #define g_c 0.7071 static float tab_coefs[8][8] = {{0.7071, a_c, e_c, b_c, g_c, c_c, f_c, d_c}, {0.7071, b_c, f_c, -d_c, -g_c, -a_c, -e_c, -c_c}, {0.7071, c_c, -f_c, -a_c, -g_c, d_c, e_c, b_c}, {0.7071, d_c, -e_c, -c_c, g_c, b_c, -f_c, -a_c}, {0.7071, -d_c, -e_c, c_c, g_c, -b_c, -f_c, a_c}, {0.7071, -c_c, -f_c, a_c, -g_c, -d_c, e_c, -b_c}, {0.7071, -b_c, f_c, d_c, -g_c, a_c, -e_c, c_c}, {0.7071, -a_c, e_c, -b_c, g_c, -c_c, f_c, -d_c}}; void data_unit_do_idct(const matrix8x8_t inp, matrix8x8_t outp) { double rxy=0; uint_fast8_t x, y; uint_fast8_t u, v; for(y=0; y<8; y++) { for(x=0; x<8; x++) { rxy=0; for(u=0; u<=7; u++) { for(v=0; v<=7; v++) { double Svu=inp[v][u]; rxy+= Svu*tab_coefs[x][u]*tab_coefs[y][v]; } } rxy*=0.25; rxy+=128; outp[x][y]=rxy; } } } void print_matrix(matrix8x8_t m) { for(int u = 0; u < 8; u++) { for(int v = 0; v < 8; v++) { printf("%5f ", m[u][v]); } printf("\n"); } printf("\n"); } void parse_bitmap_data(picture_t * const pic) { printf("parsing bitstream...\n"); uint_fast8_t nb_bits; uint_fast8_t component=0; //Cs uint_fast8_t data_unit; uint_fast8_t u,v; uint_fast8_t ac_count; int16_t precedent_DC[4]={0,0,0,0}; uint_fast32_t nb_MCU=0; matrix8x8_t matrix; for(nb_MCU=0; nb_MCU<pic->nb_MCU_total; nb_MCU++) { for(component=0; component<pic->nb_components; component++) { for(data_unit=0; data_unit<(pic->components_data[component].V*pic->components_data[component].H); data_unit++) { for(u=0; u<8; u++) for(v=0; v<8; v++) matrix[u][v]=0; uint8_t SSSS; int16_t DC; if(!bitstream_get_next_decoded_element(pic, 0, pic->components_data[component].Td, &SSSS, &nb_bits)) errx(1, "no DC data"); if(SSSS) { uint16_t bits_DC=bitstream_get_bits(pic, SSSS); bitstream_remove_bits(pic, SSSS); bool msb_DC=!!(bits_DC&(1<<(SSSS-1))); if(msb_DC) DC=precedent_DC[component]+bits_DC; else DC=precedent_DC[component]+convert_to_neg(bits_DC,SSSS); } else DC=precedent_DC[component]+0; matrix[0][0]=DC; precedent_DC[component]=DC; int16_t AC; for(ac_count=0; ac_count<63; ) { uint8_t RRRRSSSS; if(!bitstream_get_next_decoded_element(pic, 1, pic->components_data[component].Ta, &RRRRSSSS, &nb_bits)) errx(1, "no AC data"); uint8_t RRRR=(RRRRSSSS>>4); //number of preceding 0 samples uint8_t SSSS=RRRRSSSS&0x0f; //category if(RRRR==0 && SSSS==0) { break; } else if(RRRR==0x0F && SSSS==0) { ac_count+=16; } else { ac_count+=RRRR; uint16_t bits_AC=bitstream_get_bits(pic, SSSS); bitstream_remove_bits(pic, SSSS); bool msb_AC=!!(bits_AC&(1<<(SSSS-1))); if(msb_AC) AC=bits_AC; else AC=convert_to_neg(bits_AC,SSSS); u=(ac_count+1)/8; v=(ac_count+1)%8; matrix[u][v]=AC; ac_count++; } } matrix8x8_t matrix_dequant; reverse_ZZ_and_dequant(pic, pic->components_data[component].Tq, matrix, matrix_dequant); matrix8x8_t matrix_decoded; data_unit_do_idct(matrix_dequant, matrix_decoded); store_data_unit_YCbCr(pic, nb_MCU, component, data_unit, matrix_decoded); } } } printf("parsed %lu MCU\n", nb_MCU); } void open_new_picture(char const * const name, picture_t * const picture) { FILE *f=fopen(name, "rb"); if(!f) err(1, "fopen %s failed", name); fseek(f, 0, SEEK_END); picture->filesize=ftell(f); fseek(f, 0, SEEK_SET); picture->data=malloc(picture->filesize*sizeof(uint8_t)); if(!picture->data) err(1, "malloc for %s failed", name); if(fread(picture->data, picture->filesize, 1, f)!=1) err(1, "fread for %s failed", name); fclose(f); printf("%lu bytes read from %s\n\n", picture->filesize, name); picture->pos_in_file=0; picture->nb_components=0; picture->huff_tables[0][0].nb_entries=0; picture->huff_tables[0][1].nb_entries=0; picture->huff_tables[1][0].nb_entries=0; picture->huff_tables[1][1].nb_entries=0; } void parse_picture(picture_t * const picture) { while(picture->pos_in_file<=picture->filesize-2) { uint16_t marker; marker=get_marker(picture->data, &(picture->pos_in_file)); printf("marker: %d\n",marker); switch(marker) { case 0xFFD8: printf("SOI found\n"); break; case 0xFFE1: skip_EXIF(picture); break; case 0xFFE0: parse_APP0(picture); break; case 0xFFDB: parse_DQT(picture); break; case 0xFFC0: parse_SOF0(picture); break; case 0xFFC4: parse_DHT(picture); break; case 0xFFDA: parse_SOS(picture); copy_bitmap_data_remove_stuffing(picture); parse_bitmap_data(picture); break; case 0xFFD9: printf("EOI found\n"); break; default: errx(1, "unknown marker 0x%04x pos %lu", marker, picture->pos_in_file); break; } printf("\n"); } } uint8_t clamp(const double v) { if(v<0) return 0; if(v>255) return 255; return (uint8_t)v; } void write_ppm(picture_t const * const pic, char const * const filename) { uint_fast16_t x,y; double Y,Cb,Cr; double r,g,b; FILE *out=fopen(filename, "w"); printf("writing file %s\n", filename); fprintf(out, "P3\n%lu %lu\n255\n", pic->size_X, pic->size_Y); for(y=0; y<pic->size_Y; y++) { for(x=0; x<pic->size_X; x++) { Y=pic->pixels_YCbCr[x][y].Y; Cb=pic->pixels_YCbCr[x][y].Cb; Cr=pic->pixels_YCbCr[x][y].Cr; r=Y+1.402*(Cr-128); g=Y-(0.114*1.772*(Cb-128)+0.299*1.402*(Cr-128))/0.587; b=Y+1.772*(Cb-128); fprintf(out, "%u %u %u ", clamp(round(r)),clamp(round(g)),clamp(round(b))); } fprintf(out, "\n"); } fclose(out); printf("output file written\n\n"); } int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: %s <filename.jpg>\n", argv[0]); return 1; } clock_t start_time, end_time, write_time; double cpu_time_used_algo, cpu_time_used_write; start_time = clock(); picture_t pic; open_new_picture(argv[1], &pic); parse_picture(&pic); end_time = clock(); write_ppm(&pic, "decodedimage.ppm"); write_time = clock(); cpu_time_used_algo = ((double) (end_time - start_time)) / CLOCKS_PER_SEC; cpu_time_used_write = ((double) (write_time - end_time)) / CLOCKS_PER_SEC; printf("Time taken by the Jpeg decoder algorithm: %f seconds\n", cpu_time_used_algo); printf("Time taken for writing the image: %f seconds\n", cpu_time_used_write); } --- Mojo/README.md --- # Compiling ``` mojo build main.mojo ``` # Usage Give the path of the image you want to decode at the bottom of the file. i.e, at line 1037: ```open_new_picture("../Example_images/test1.jpg", pic)``` Run the program using: ```./main``` It will output a decoded ppm file named decodedimage.ppm --- Mojo/main.mojo --- import os from python import Python from python import PythonObject from math import sqrt from time import now import pathlib as path import sys struct Array1D(CollectionElement): var data: Pointer[UInt8] var size: Int fn __init__(inout self, size: Int, val: UInt8): self.size = size self.data = Pointer[UInt8].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __getitem__(self, i: Int) -> UInt8: return self.data.load(i) fn __setitem__(inout self, i: Int, val: UInt8): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): self.size = existing.size self.data = Pointer[UInt8].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): self.size = existing.size self.data = existing.data existing.data = Pointer[UInt8].alloc(0) # Hollow out the existing value fn __del__(owned self): self.data.free() struct Array1Dnew(CollectionElement): var data: Pointer[Int16] var size: Int fn __init__(inout self, size: Int, val: Int16): self.size = size self.data = Pointer[Int16].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __getitem__(self, i: Int) -> Int16: return self.data.load(i) fn __setitem__(inout self, i: Int, val: Int16): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): self.size = existing.size self.data = Pointer[Int16].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): self.size = existing.size self.data = existing.data existing.data = Pointer[Int16].alloc(0) fn __del__(owned self): self.data.free() struct Array2D(CollectionElement): var data: Pointer[Float32] var dim0: Int var dim1: Int fn __init__(inout self, dim0: Int, dim1: Int): self.dim0 = dim0 self.dim1 = dim1 self.data = Pointer[Float32].alloc(dim0 * dim1) fn __copyinit__(inout self, other: Array2D): self.dim0 = other.dim0 self.dim1 = other.dim1 self.data = Pointer[Float32].alloc(self.dim0 * self.dim1) for i in range(self.dim0 * self.dim1): self.data.store(i, other.data.load(i)) fn __moveinit__(inout self, owned existing: Array2D): self.dim0 = existing.dim0 self.dim1 = existing.dim1 self.data = existing.data fn __getitem__(borrowed self, i: Int, j: Int) -> Float32: return self.data.load(i * self.dim1 + j) fn __setitem__(inout self, i: Int, j: Int, value: Float32): self.data.store(i * self.dim1 + j, value) fn __del__(owned self): self.data.free() fn print_array(borrowed self): for i in range(self.dim0): for j in range(1): print(self.__getitem__(i, j), ' ', self.__getitem__(i, j+1), ' ', self.__getitem__(i, j+2), ' ', self.__getitem__(i, j+3), ' ', self.__getitem__(i, j+4), ' ', self.__getitem__(i, j+5), ' ', self.__getitem__(i, j+6), ' ', self.__getitem__(i, j+7)) struct Array2Dnew(CollectionElement): var data: Pointer[SIMD[DType.float32, 8]] var dim: Int fn __init__(inout self, dim: Int): self.dim = dim self.data = Pointer[SIMD[DType.float32, 8]].alloc(dim) fn __copyinit__(inout self, other: Array2Dnew): self.dim = other.dim self.data = Pointer[SIMD[DType.float32, 8]].alloc(self.dim) for i in range(self.dim): self.data.store(i, other.data.load(i)) fn __moveinit__(inout self, owned existing: Array2Dnew): self.dim = existing.dim self.data = existing.data fn __getitem__(borrowed self, i: Int) -> SIMD[DType.float32, 8]: return self.data.load(i) fn __setitem__(inout self, i: Int, value: SIMD[DType.float32, 8]): self.data.store(i, value) fn __setitem2__(inout self, i: Int, j: Int, value: Float32): var simd_vector = self.data.load(i) simd_vector[j] = value self.data.store(i, simd_vector) fn __del__(owned self): self.data.free() fn print_array(borrowed self): for i in range(self.dim): print(self.__getitem__(i)) struct Array3D(CollectionElement): var data: Pointer[UInt8] var dim0: Int var dim1: Int var dim2: Int fn __init__(inout self, dim0: Int, dim1: Int, dim2: Int): self.dim0 = dim0 self.dim1 = dim1 self.dim2 = dim2 self.data = Pointer[UInt8].alloc(dim0 * dim1 * dim2) fn __copyinit__(inout self, other: Array3D): self.dim0 = other.dim0 self.dim1 = other.dim1 self.dim2 = other.dim2 self.data = Pointer[UInt8].alloc(self.dim0 * self.dim1 * self.dim2) for i in range(self.dim0 * self.dim1 * self.dim2): self.data.store(i, other.data.load(i)) fn __moveinit__(inout self, owned existing: Array3D): self.dim0 = existing.dim0 self.dim1 = existing.dim1 self.dim2 = existing.dim2 self.data = existing.data fn __getitem__(borrowed self, i: Int, j: Int, k: Int) -> UInt8: return self.data.load(i * self.dim1 * self.dim2 + j * self.dim2 + k) fn __setitem__(inout self, i: SIMD[DType.uint8, 1], j: Int, k: Int, value: SIMD[DType.uint8, 1]): self.data.store(i * self.dim1 * self.dim2 + j * self.dim2 + k, value) fn __del__(owned self): self.data.free() struct ComponentsData(CollectionElement): var H: SIMD[DType.uint32, 1] var V: SIMD[DType.uint32, 1] var Tq: SIMD[DType.uint32, 1] var xi: SIMD[DType.uint32, 1] var yi: SIMD[DType.uint32, 1] var Td: Int #quant table for DC var Ta: Int #quant table for AC fn __init__(inout self, H: Int, V: Int, Tq: Int, xi: Int, yi: Int, Td: Int, Ta: Int): self.H = H self.V = V self.Tq = Tq self.xi = xi self.yi = yi self.Td = Td self.Ta = Ta fn __copyinit__(inout self, existing: Self): self.H = existing.H self.V = existing.V self.Tq = existing.Tq self.xi = existing.xi self.yi = existing.yi self.Td = existing.Td self.Ta = existing.Ta fn __moveinit__(inout self, owned existing: Self): self.H = existing.H self.V = existing.V self.Tq = existing.Tq self.xi = existing.xi self.yi = existing.yi self.Td = existing.Td self.Ta = existing.Ta @register_passable struct HuffmanEntry(CollectionElement): var sz: Int var codeword: Int var decoded: Int fn __init__(sz: Int, codeword: Int, decoded: Int) -> Self: return Self{sz: sz, codeword: codeword, decoded: decoded} fn __copyinit__(existing) -> Self: return Self{sz: existing.sz, codeword:existing.codeword, decoded: existing.decoded} @register_passable struct HuffmanEntryArray(CollectionElement): var data: Pointer[HuffmanEntry] var size: Int fn __init__(size: Int) -> Self: return Self{size : size, data:Pointer[HuffmanEntry].alloc(size)} fn __copyinit__(existing: Self) -> Self: let newData = Pointer[HuffmanEntry].alloc(existing.size) for i in range(existing.size): newData.store(i, existing.data.load(i)) return Self{size: existing.size, data: newData} @register_passable struct HuffmanTable(CollectionElement): var nb_entries: Int var entries: HuffmanEntryArray fn __init__(nb_entries: Int, entries: HuffmanEntryArray) -> Self: return Self{nb_entries: nb_entries, entries: entries} fn __copyinit__(existing) -> Self: return Self{nb_entries: existing.nb_entries, entries: existing.entries} @register_passable struct HuffmanTableArray: var data: Pointer[HuffmanTable] var size: Int fn __init__(size: Int) -> Self: return Self{size : size, data:Pointer[HuffmanTable].alloc(size)} fn __copyinit__(existing: Self) -> Self: let newData = Pointer[HuffmanTable].alloc(existing.size) for i in range(existing.size): newData.store(i, existing.data.load(i)) return Self{size: existing.size, data: newData} struct PixelYCbCr(CollectionElement): var Y: Float32 var Cb: Float32 var Cr: Float32 fn __init__(inout self, Y: Float32, Cb: Float32, Cr: Float32): self.Y = Y self.Cb = Cb self.Cr = Cr fn __copyinit__(inout self, existing: Self): self.Y = existing.Y self.Cb = existing.Cb self.Cr = existing.Cr fn __moveinit__(inout self, owned existing: Self): self.Y = existing.Y self.Cb = existing.Cb self.Cr = existing.Cr struct picture_t: var data: DynamicVector[UInt8] var helpdata: DynamicVector[UInt16] var stringdata: String var filesize: Int var pos_in_file: Int var size_X: SIMD[DType.uint32, 1] var size_Y: SIMD[DType.uint32, 1] var Hmax: SIMD[DType.uint32, 1] var Vmax: SIMD[DType.uint32, 1] var nb_MCU_total: SIMD[DType.uint32, 1] var compressed_pixeldata: DynamicVector[Int] var sz_compressed_pixeldata: Int var pos_compressed_pixeldata: Int var bitpos_in_compressed_pixeldata: Int var nb_components: SIMD[DType.uint32, 1] var components_data: DynamicVector[ComponentsData] var huff_tables1: HuffmanTableArray var huff_tables2: HuffmanTableArray var quant_table: Array3D var pixel_Y: Array2D var pixel_Cb: Array2D var pixel_Cr: Array2D fn __init__(inout self, data: DynamicVector[UInt8], helpdata: DynamicVector[UInt16], stringdata: String, filesize: Int, pos_in_file: Int, size_X: Int, size_Y: Int, Hmax: Int, Vmax: Int, nb_MCU_total: Int, compressed_pixeldata: DynamicVector[Int], sz_compressed_pixeldata: Int, pos_compressed_pixeldata: Int, bitpos_in_compressed_pixeldata: Int, nb_components: Int, components_data: DynamicVector[ComponentsData], huff_tables1: HuffmanTableArray, huff_tables2: HuffmanTableArray, quant_table: Array3D, pixel_Y: Array2D, pixel_Cb: Array2D, pixel_Cr: Array2D): self.data = data self.helpdata = helpdata self.stringdata = stringdata self.filesize = filesize self.pos_in_file = pos_in_file self.size_X = size_X self.size_Y = size_Y self.Hmax = Hmax self.Vmax = Vmax self.nb_MCU_total = nb_MCU_total self.compressed_pixeldata = compressed_pixeldata self.sz_compressed_pixeldata = sz_compressed_pixeldata self.pos_compressed_pixeldata = pos_compressed_pixeldata self.bitpos_in_compressed_pixeldata = bitpos_in_compressed_pixeldata self.nb_components = nb_components self.components_data = components_data self.huff_tables1 = huff_tables1 self.huff_tables2 = huff_tables2 self.quant_table = quant_table self.pixel_Y = pixel_Y self.pixel_Cb = pixel_Cb self.pixel_Cr = pixel_Cr fn open_new_picture(name: String, inout picture: picture_t) raises: let _os = Python.import_module("os") picture.filesize = _os.path.getsize(name).__index__() var f = open(name, "rb") let data = f.read() f.close() picture.stringdata = data for i in range(len(data)): let x: UInt8 x = UInt8(ord(data[i])) let y: UInt16 y = UInt16(ord(data[i])) picture.data.push_back(x) picture.helpdata.push_back(y) picture.pos_in_file = 0 picture.nb_components = 0 for i in range(2): let huffmanEntryArray1 = HuffmanEntryArray(256) let huffmanEntryArray2 = HuffmanEntryArray(256) for j in range(256): huffmanEntryArray1.data.store(j, HuffmanEntry(0, 0, 0)) huffmanEntryArray2.data.store(j, HuffmanEntry(0, 0, 0)) let huffmanTable1 = HuffmanTable(0, huffmanEntryArray1) let huffmanTable2 = HuffmanTable(0, huffmanEntryArray2) picture.huff_tables1.data.store(i, huffmanTable1) picture.huff_tables2.data.store(i, huffmanTable2) print(picture.filesize, " bytes read from ", name + "\n") fn get_marker(data: DynamicVector[UInt16], pos: Int) -> UInt16: return (data[pos] << 8) | data[pos + 1] fn get1i(data: DynamicVector[UInt8],inout pos: Int) -> UInt16: let val:UInt16 = data[pos].cast[DType.uint16]() pos += 1 return val fn get2i(data: DynamicVector[UInt8],inout pos: Int) -> UInt16: let val:UInt16 = (data[pos].cast[DType.uint16]() << 8 | data[pos+1].cast[DType.uint16]()).cast[DType.uint16]() pos += 2 return val fn skip_EXIF(inout picture: picture_t) raises: let len_val:UInt16 = get2i(picture.data, picture.pos_in_file) print("APP1 (probably EXIF) found (length", len_val, "bytes), skipping") picture.pos_in_file += int(len_val) -2 fn parse_APP0(inout picture: picture_t) raises: let len_val:UInt16 = get2i(picture.data, picture.pos_in_file) print("APP0 found (length" ,len_val, "bytes)") if len_val < 16: raise Error("APP0: too short") let identifier:String = picture.stringdata[picture.pos_in_file: picture.pos_in_file + 5] picture.pos_in_file += 5 let version_major:UInt16 = get1i(picture.data, picture.pos_in_file) let version_minor:UInt16 = get1i(picture.data, picture.pos_in_file) let units:UInt16 = get1i(picture.data, picture.pos_in_file) let Xdensity:UInt16 = get2i(picture.data, picture.pos_in_file) let Ydensity:UInt16 = get2i(picture.data, picture.pos_in_file) let Xthumbnail:UInt16 = get1i(picture.data, picture.pos_in_file) let Ythumbnail:UInt16 = get1i(picture.data, picture.pos_in_file) if identifier != "JFIF\x00": print("Invalid identifier: ", identifier) raise Error("APP0: invalid identifier") print("version", version_major, ".", version_minor) print("units" ,units) print("density X", Xdensity, "Y", Ydensity) let bytes_thumbnail = 3 * Xthumbnail * Ythumbnail print("bytes_thumbnail:", bytes_thumbnail) if bytes_thumbnail !=0: print("thumbnail" ,bytes_thumbnail, "bytes, skipping") picture.pos_in_file += int(bytes_thumbnail) else: print("no thumbnail") fn parse_DQT(inout picture: picture_t) raises: let Lq:UInt16 = get2i(picture.data, picture.pos_in_file) print("DQT found (length", Lq, "bytes)") let PqTq:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() let Pq:UInt8 = (PqTq >> 4) & 0x0f let Tq:UInt8 = PqTq & 0x0f if Pq == 0: print("Pq (element precision)", Pq, "->" ,"8 bits") else: print("Pq (element precision)", Pq, "->" ,"8 bits") print("Tq (table destination identifier)", Tq) if Pq != 0: raise Error("DQT: only 8 bit precision supported") let nb_data_bytes:UInt16 = Lq - 2 - 1 if nb_data_bytes != 64: raise Error("DQT: nb_data_bytes != 64") for u in range(8): for v in range(8): let Q:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() picture.quant_table.__setitem__(Tq,u,v,Q) fn ceil_to_multiple_of(val: SIMD[DType.uint32, 1], multiple: SIMD[DType.uint32, 1]) -> SIMD[DType.uint32, 1]: let result = multiple * ((val + multiple - 1) // multiple) return result fn parse_SOF0(inout picture: picture_t, comp_names: DynamicVector[String]) raises: let len_val:UInt16 = get2i(picture.data, picture.pos_in_file) print("SOF0 found (length", len_val, "bytes)") let P:UInt32 = get1i(picture.data, picture.pos_in_file).cast[DType.uint32]() let Y:UInt32 = get2i(picture.data, picture.pos_in_file).cast[DType.uint32]() let X:UInt32 = get2i(picture.data, picture.pos_in_file).cast[DType.uint32]() let Nf:UInt32 = get1i(picture.data, picture.pos_in_file).cast[DType.uint32]() if P != 8: raise Error("SOF0: P != 8 unsupported") if Y == 0: raise Error("SOF0: Y == 0 unsupported") print("P", P, "(must be 8)") print("imagesize X" ,X, "Y", Y) print("Nf (number of components)", Nf) if Nf != 3: raise Error("picture does not have 3 components, this code will not work") picture.size_X = X picture.size_Y = Y for i in range(Nf): let C:UInt32 = get1i(picture.data, picture.pos_in_file).cast[DType.uint32]() let HV:UInt32 = get1i(picture.data, picture.pos_in_file).cast[DType.uint32]() let H:UInt32 = (HV >> 4) & 0x0F let V:UInt32 = HV & 0x0F let Tq:UInt32 = get1i(picture.data, picture.pos_in_file).cast[DType.uint32]() let h = ComponentsData(0,0,0,0,0,0,0) picture.components_data.push_back(h) picture.components_data[i].H = H picture.components_data[i].V = V picture.components_data[i].Tq = Tq print("component", i, comp_names[i], "C", C, "H", H, "V", V, "Tq", Tq) picture.nb_components = Nf var Hmax:UInt32 = 0 var Vmax:UInt32 = 0 for i in range(picture.nb_components): if picture.components_data[i].H > Hmax: Hmax = picture.components_data[i].H if picture.components_data[i].V > Vmax: Vmax = picture.components_data[i].V picture.Hmax = Hmax picture.Vmax = Vmax let temp_Hmax: UInt32 = Hmax.cast[DType.uint32]() let temp_Vmax: UInt32 = Vmax.cast[DType.uint32]() picture.nb_MCU_total = (ceil_to_multiple_of(picture.size_X, 8 * temp_Hmax) // (8 * temp_Hmax)) * \ (ceil_to_multiple_of(picture.size_Y, 8 * temp_Hmax) // (8 * temp_Vmax)) print("Hmax", Hmax, "Vmax", Vmax) print("MCU_total", picture.nb_MCU_total) for i in range(picture.nb_components): let xi =((picture.size_X * (picture.components_data[i].H)) / Hmax + 0.5) let yi = (picture.size_Y * picture.components_data[i].V) / Vmax + 0.5 picture.components_data[i].xi = xi picture.components_data[i].yi = yi print("component", i, comp_names[i], "xi", xi, "yi", yi) print("allocating memory for pixels") picture.pixel_Y = Array2D(X.to_int(), Y.to_int()) picture.pixel_Cb = Array2D(X.to_int(), Y.to_int()) picture.pixel_Cr = Array2D(X.to_int(), Y.to_int()) for x in range(picture.size_X): for y in range(picture.size_Y): picture.pixel_Y.__setitem__(x,y,0.0) picture.pixel_Cb.__setitem__(x,y,0.0) picture.pixel_Cr.__setitem__(x,y,0.0) print("memory allocated") fn parse_DHT(inout picture: picture_t) raises: let len:UInt16 = get2i(picture.data, picture.pos_in_file) print("DHT found (length", len, "bytes)") let TcTh:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() let Tc:UInt8 = (TcTh >> 4) & 0x0f let Th:UInt8 = TcTh & 0x0f if Tc == 0: print("Tc", Tc, "DC Table") else: print("Tc", Tc, "AC Table") print("Th (table destination identifier)" ,Th) var L = Array1D(16,0) var mt:UInt8 = 0 for i in range(16): let a:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() L.__setitem__(i,a) mt += L.__getitem__(i) print("total" ,mt, "codes") var codeword: UInt16 = 0 for i in range(16): for j in range(L.__getitem__(i)): let V:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() if Tc == 0: var huffmanTable1 = picture.huff_tables1.data.load(Th.to_int()) var huffmanEntry1 = huffmanTable1.entries.data.load(huffmanTable1.nb_entries) huffmanEntry1.sz = i+1 huffmanEntry1.codeword = codeword.to_int() huffmanEntry1.decoded = V.to_int() huffmanTable1.entries.data.store(huffmanTable1.nb_entries, huffmanEntry1) huffmanTable1.nb_entries +=1 picture.huff_tables1.data.store(Th.to_int(), huffmanTable1) elif Tc == 1: var huffmanTable2 = picture.huff_tables2.data.load(Th.to_int()) var huffmanEntry2 = huffmanTable2.entries.data.load(huffmanTable2.nb_entries) huffmanEntry2.sz = i+1 huffmanEntry2.codeword = codeword.to_int() huffmanEntry2.decoded = V.to_int() huffmanTable2.entries.data.store(huffmanTable2.nb_entries, huffmanEntry2) huffmanTable2.nb_entries +=1 picture.huff_tables2.data.store(Th.to_int(), huffmanTable2) codeword += 1 codeword <<= 1 fn parse_SOS(inout picture: picture_t, comp_names: DynamicVector[String]) raises: let len:UInt16 = get2i(picture.data, picture.pos_in_file) print("SOS found (length", len, "bytes)") let Ns:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() print("Ns", Ns) for j in range(Ns): let Cs:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() let TdTa:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() let Td:UInt8 = (TdTa >> 4) & 0x0f let Ta:UInt8 = TdTa & 0x0f print("component", j, comp_names[j], "Cs", Cs, "Td", Td, "Ta", Ta) picture.components_data[j].Td = Td.to_int() # DC picture.components_data[j].Ta = Ta.to_int() # AC let Ss:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() let Se:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() let AhAl:UInt8 = get1i(picture.data, picture.pos_in_file).cast[DType.uint8]() let Ah:UInt8 = (AhAl >> 4) & 0x0f let Al:UInt8 = AhAl & 0x0f print("Ss", Ss, "Se", Se, "Ah", Ah, "Al", Al) picture.pos_compressed_pixeldata = picture.pos_in_file print("compressed pixeldata starts at pos", picture.pos_compressed_pixeldata) fn copy_bitmap_data_remove_stuffing(inout picture: picture_t) raises: print("removing stuffing...") var pos:Int = picture.pos_compressed_pixeldata var size:Int = 0 var byte:UInt8 = 0 var combined:UInt16 = 0 while combined != 0xFFD9: if pos >= picture.filesize: raise Error("marker EOI (0xFFD9) missing") byte = picture.data[pos] pos += 1 if byte == 0xFF: let byte2:UInt8 = picture.data[pos] pos += 1 if byte2 != 0x00: combined = (byte.cast[DType.uint16]() << 8) | byte2.cast[DType.uint16]() else: size += 1 else: size += 1 let size_stuffed:Int = pos - picture.pos_compressed_pixeldata - 2 for i in range(size): picture.compressed_pixeldata.push_back(0) print(size_stuffed, "bytes with stuffing") var i:Int = picture.pos_compressed_pixeldata pos = 0 var size_without_stuffing:Int = 0 while i < picture.pos_compressed_pixeldata + size_stuffed: if picture.data[i] != 0xFF: picture.compressed_pixeldata[pos] = picture.data[i].to_int() pos += 1 size_without_stuffing += 1 i += 1 elif picture.data[i] == 0xFF and picture.data[i + 1] == 0x00: picture.compressed_pixeldata[pos] = 0xFF pos += 1 size_without_stuffing += 1 i += 2 else: raise Error("unexpected marker found in bitstream") picture.bitpos_in_compressed_pixeldata = 0 picture.sz_compressed_pixeldata = size_without_stuffing picture.pos_in_file = picture.pos_compressed_pixeldata + size_stuffed print(size_without_stuffing, "data bytes without stuffing\n") fn convert_to_neg(bits: UInt16, sz: UInt8) -> Int16: let ret: Int16 = -((bits.cast[DType.int16]() ^ 0xFFFF) & ((1 << sz.cast[DType.int16]()) - 1)) return ret fn bitstream_get_bits(inout picture: picture_t, nb_bits: UInt32) raises -> UInt16: if nb_bits > 16: raise Error("bitstream_get_bits: >16 bits requested") var index:Int = picture.bitpos_in_compressed_pixeldata // 8 var pos_in_byte:Int = 7 - picture.bitpos_in_compressed_pixeldata % 8 var ret:UInt16 = 0 var bits_copied:UInt32 = 0 while pos_in_byte >= 0 and bits_copied < nb_bits: ret <<= 1 let temp = picture.compressed_pixeldata[index] & (1 << pos_in_byte) if temp > 0: ret |= 1 else: ret |= 0 bits_copied += 1 pos_in_byte -= 1 if pos_in_byte < 0: pos_in_byte = 7 index += 1 return ret fn bitstream_remove_bits(inout picture: picture_t, nb_bits: UInt32) raises: picture.bitpos_in_compressed_pixeldata += nb_bits.to_int() fn huff_decode(inout picture: picture_t, Tc: UInt8, Th: UInt8, sz: UInt8, bitstream: UInt16, inout decoded: UInt8) raises ->Bool: if Tc == 0: for i in range(picture.huff_tables1.data.load(Th.to_int()).nb_entries): if (picture.huff_tables1.data.load(Th.to_int()).entries.data.load(i).sz == sz.to_int() and picture.huff_tables1.data.load(Th.to_int()).entries.data.load(i).codeword == bitstream.to_int()): decoded = picture.huff_tables1.data.load(Th.to_int()).entries.data.load(i).decoded return True elif Tc == 1: for i in range(picture.huff_tables2.data.load(Th.to_int()).nb_entries): if (picture.huff_tables2.data.load(Th.to_int()).entries.data.load(i).sz == sz.to_int() and picture.huff_tables2.data.load(Th.to_int()).entries.data.load(i).codeword == bitstream.to_int()): decoded = picture.huff_tables2.data.load(Th.to_int()).entries.data.load(i).decoded return True return False fn bitstream_get_next_decoded_element(inout picture: picture_t, Tc: UInt8, Th: UInt8,inout decoded: UInt8, inout nb_bits: UInt32) raises ->Bool: var huff_candidate: UInt16 = 0 var found:Bool = False while picture.bitpos_in_compressed_pixeldata < 8 * picture.sz_compressed_pixeldata: found = False for num_bits in range(1, 17): nb_bits = num_bits if picture.bitpos_in_compressed_pixeldata + nb_bits > 8 * picture.sz_compressed_pixeldata: raise Error("end of stream, requested too many bits") huff_candidate = bitstream_get_bits(picture, nb_bits) let boo:Bool = huff_decode(picture, Tc, Th, nb_bits.cast[DType.uint8](), huff_candidate, decoded) if boo: found = True bitstream_remove_bits(picture, nb_bits) return True if not found: var is_all_one:Bool = True for i in range(nb_bits - 1): if (huff_candidate & (1 << i)) == 0: is_all_one = False break if is_all_one: bitstream_remove_bits(picture, nb_bits) else: raise Error("unknown code in bitstream bitpos") return False fn reverse_ZZ_and_dequant(inout picture: picture_t, quant_table: UInt8, inp: Array2D, inout outp: Array2D): var reverse_ZZ_u = Array2D(8, 8) let vector = SIMD[DType.float32, 64] (0, 0, 1, 2, 1, 0, 0, 1, 2, 3, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 4, 5, 6, 7, 7, 6, 5, 6, 7, 7) var counter:Int = 0 for i in range(8): for j in range(8): reverse_ZZ_u.__setitem__(i,j,vector[counter]) counter+=1 var reverse_ZZ_v = Array2D(8, 8) let vector1 = SIMD[DType.float32, 64] (0, 1, 0, 0, 1, 2, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 5, 6, 7, 7, 6, 7) counter = 0 for i in range(8): for j in range(8): reverse_ZZ_v.__setitem__(i,j,vector1[counter]) counter+=1 for u in range(8): for v in range(8): let a = inp.__getitem__(u,v) * (picture.quant_table.__getitem__(quant_table.to_int(),u,v).cast[DType.float32] ()) outp.__setitem__(reverse_ZZ_u.__getitem__(u,v).to_int(),reverse_ZZ_v.__getitem__(u,v).to_int(), a) fn data_unit_do_idct(inp: Array2D, inout outp: Array2D, mat: Array2Dnew): var rxy: Float32 = 0 for y in range(8): for x in range(8): rxy = 0 for u in range(8): for v in range(8): let Svu: Float32 = inp.__getitem__(v,u) rxy += Svu * mat.__getitem__(x)[u] * mat.__getitem__(y)[v] rxy *= 0.25 rxy += 128 outp.__setitem__(x,y,rxy) fn store_data_unit_YCbCr(inout picture: picture_t, MCU: UInt32, component: UInt32, data_unit: UInt32, data: Array2D) raises: let zoomX = picture.Hmax // picture.components_data[component.to_int()].H let zoomY = picture.Vmax // picture.components_data[component.to_int()].V let scaleX = 8 * picture.components_data[component.to_int()].H let scaleY = 8 * picture.components_data[component.to_int()].V let startX = MCU % (ceil_to_multiple_of(picture.size_X, 8 * picture.Hmax) // (scaleX * zoomX)) let startY = MCU // (ceil_to_multiple_of(picture.size_X, 8 * picture.Hmax) // (scaleY * zoomY)) let startHiX = data_unit % picture.components_data[component.to_int()].H let startHiY = data_unit // picture.components_data[component.to_int()].H for x in range(8): for y in range(8): for zx in range(zoomX): for zy in range(zoomY): let posX = (scaleX * startX + 8 * startHiX + x) * zoomX + zx let posY = (scaleY * startY + 8 * startHiY + y) * zoomY + zy if posX < picture.size_X and posY < picture.size_Y: if component == 0: picture.pixel_Y.__setitem__(posX.to_int(), posY.to_int(), data.__getitem__(x,y)) elif component == 1: picture.pixel_Cb.__setitem__(posX.to_int(), posY.to_int(), data.__getitem__(x,y)) elif component == 2: picture.pixel_Cr.__setitem__(posX.to_int(), posY.to_int(), data.__getitem__(x,y)) else: raise Error("unknown component") fn parse_bitmap_data(inout picture: picture_t , mat: Array2Dnew) raises: print("parsing bitstream...") var nb_bits:UInt32 = 0 var component:UInt32 = 0 var data_unit:UInt32 = 0 let ac_count:UInt32 = 0 var precedent_DC = Array1Dnew(4,0) precedent_DC.__setitem__(0,0) precedent_DC.__setitem__(1,0) precedent_DC.__setitem__(2,0) precedent_DC.__setitem__(3,0) var nb_MCU:UInt32 = 0 var matrix = Array2D(8,8) for i in range(8): for j in range(8): matrix.__setitem__(i,j,0) while nb_MCU < picture.nb_MCU_total: component = 0 while component < picture.nb_components: data_unit = 0 while data_unit < (picture.components_data[component.to_int()].V * picture.components_data[component.to_int()].H): for u in range(8): for v in range(8): matrix.__setitem__(u,v,0) var SSSS:UInt8 = 0 var DC:Int16 = 0 let boo: Bool = bitstream_get_next_decoded_element(picture, 0, picture.components_data[component.to_int()].Td, SSSS, nb_bits) if not boo: raise Error("no DC data") if SSSS != 0: let bits_DC: UInt16 = bitstream_get_bits(picture, SSSS.cast[DType.uint32]()) bitstream_remove_bits(picture, SSSS.cast[DType.uint32]()) let msb_DC:UInt32 = (bits_DC.cast[DType.uint32]() & (1 << (SSSS.cast[DType.uint32]() - 1)).cast[DType.uint32]()) if msb_DC > 0: DC = precedent_DC.__getitem__(component.to_int()) + bits_DC.cast[DType.int16]() else: DC = (precedent_DC.__getitem__(component.to_int()) + convert_to_neg(bits_DC, SSSS)) else: DC = (precedent_DC.__getitem__(component.to_int()) + 0) matrix.__setitem__(0,0,DC.cast[DType.float32] ()) precedent_DC.__setitem__(component.to_int(),DC) var AC: Int16 = 0 var ac_count: Int16 = 0 while ac_count < 63: var RRRRSSSS: UInt8 = 0 let boo: Bool = bitstream_get_next_decoded_element(picture, 1, picture.components_data[component.to_int()].Ta, RRRRSSSS, nb_bits) if not boo: raise Error("no DC data") let RRRR: UInt8 = RRRRSSSS >> 4 SSSS = RRRRSSSS & 0x0f if RRRR == 0 and SSSS == 0: break elif RRRR == 0x0F and SSSS == 0: ac_count += 16 else: ac_count += RRRR.cast[DType.int16]() let bits_AC: UInt16 = bitstream_get_bits(picture, SSSS.cast[DType.uint32]()) bitstream_remove_bits(picture, SSSS.cast[DType.uint32]()) let msb_AC = (bits_AC & (1 << (SSSS - 1)).cast[DType.uint16]()) if msb_AC > 0: AC = bits_AC.cast[DType.int16]() else: AC = convert_to_neg(bits_AC, SSSS) let u = (ac_count + 1) // 8 let v = (ac_count + 1) % 8 matrix.__setitem__(u.to_int(),v.to_int(),AC.cast[DType.float32] ()) ac_count += 1 var matrix_dequant = Array2D(8,8) for i in range(8): for j in range(8): matrix_dequant.__setitem__(i,j,0) reverse_ZZ_and_dequant(picture, picture.components_data[component.to_int()].Tq.cast[DType.uint8] (), matrix, matrix_dequant) var matrix_decoded = Array2D(8,8) for i in range(8): for j in range(8): matrix_decoded.__setitem__(i,j,0) data_unit_do_idct(matrix_dequant, matrix_decoded, mat) store_data_unit_YCbCr(picture, nb_MCU, component, data_unit, matrix_decoded) data_unit += 1 component += 1 nb_MCU += 1 print("parsed MCU", nb_MCU) fn parse_picture(inout picture: picture_t, comp_names: DynamicVector[String], mat: Array2Dnew) raises: while picture.pos_in_file <= picture.filesize - 1: let marker: UInt16 marker = get_marker(picture.helpdata, picture.pos_in_file) picture.pos_in_file+=2 print("marker:",marker) if marker == 0xFFD8: print("SOI found") elif marker == 0xFFE1: skip_EXIF(picture) elif marker == 0xFFE0: parse_APP0(picture) elif marker == 0xFFDB: parse_DQT(picture) elif marker == 0xFFC0: parse_SOF0(picture, comp_names) elif marker == 0xFFC4: parse_DHT(picture) elif marker == 0xFFDA: parse_SOS(picture, comp_names) copy_bitmap_data_remove_stuffing(picture) parse_bitmap_data(picture, mat) else: break fn clamp(v: Float32) ->UInt8: if v < 0: return 0 if v > 255: return 255 return v.cast[DType.uint8] () fn write_ppm(inout picture: picture_t, filename:String) raises: print("writing file", filename) with open(filename, "w") as out: out.write("P3\n" + str(picture.size_X) + " " + str(picture.size_Y) + "\n255\n") for y in range(picture.size_Y): for x in range(picture.size_X): let Y = picture.pixel_Y.__getitem__(x,y) let Cb = picture.pixel_Cb.__getitem__(x,y) let Cr = picture.pixel_Cr.__getitem__(x,y) let r = Y + 1.402 * (Cr - 128) let g = Y - (0.114 * 1.772 * (Cb - 128) + 0.299 * 1.402 * (Cr - 128)) / 0.587 let b = Y + 1.772 * (Cb - 128) out.write(str(clamp(math.round(r))) + " " + str(clamp(math.round(g))) + " " + str(clamp(math.round(b))) + " ") out.write("\n") print("output file written\n") fn main() raises: let start_time = now() var comp_names = DynamicVector[String] () comp_names.push_back("Y") comp_names.push_back("Cb") comp_names.push_back("Cr") let data = DynamicVector[UInt8] () let helpdata = DynamicVector[UInt16] () let stringdata = "" let filesize = 0 let pos_in_file = 0 let size_X = 0 let size_Y = 0 let Hmax = 0 let Vmax = 0 let nb_MCU_total = 0 let compressed_pixeldata = DynamicVector[Int] () let sz_compressed_pixeldata = 0 let pos_compressed_pixeldata = 0 let bitpos_in_compressed_pixeldata = 0 let nb_components = 0 let components_data = DynamicVector[ComponentsData] () let quant_table = Array3D(4,8,8) let pixel_Y = Array2D(1000,1000) let pixel_Cb = Array2D(1000,1000) let pixel_Cr = Array2D(1000,1000) let huff_tables1 = HuffmanTableArray(2) let huff_tables2 = HuffmanTableArray(2) let a_c : Float32 = 0.9807 let b_c : Float32 = 0.8314 let c_c : Float32 = 0.5555 let d_c : Float32 = 0.1950 let e_c : Float32 = 0.9238 let f_c : Float32 = 0.3826 let g_c : Float32 = 0.7071 var mat = Array2Dnew(8) mat.__setitem__(0,SIMD[DType.float32, 8] (0.7071, a_c, e_c, b_c, g_c, c_c, f_c, d_c)) mat.__setitem__(1,SIMD[DType.float32, 8] (0.7071, b_c, f_c, -d_c, -g_c, -a_c, -e_c, -c_c)) mat.__setitem__(2,SIMD[DType.float32, 8] (0.7071, c_c, -f_c, -a_c, -g_c, d_c, e_c, b_c)) mat.__setitem__(3,SIMD[DType.float32, 8] (0.7071, d_c, -e_c, -c_c, g_c, b_c, -f_c, -a_c)) mat.__setitem__(4,SIMD[DType.float32, 8] (0.7071, -d_c, -e_c, c_c, g_c, -b_c, -f_c, a_c)) mat.__setitem__(5,SIMD[DType.float32, 8] (0.7071, -c_c, -f_c, a_c, -g_c, -d_c, e_c, -b_c)) mat.__setitem__(6,SIMD[DType.float32, 8] (0.7071, -b_c, f_c, d_c, -g_c, a_c, -e_c, c_c)) mat.__setitem__(7,SIMD[DType.float32, 8] (0.7071, -a_c, e_c, -b_c, g_c, -c_c, f_c, -d_c)) var pic = picture_t(data, helpdata, stringdata,filesize, pos_in_file, size_X, size_Y, Hmax, Vmax, nb_MCU_total, compressed_pixeldata, sz_compressed_pixeldata, pos_compressed_pixeldata, bitpos_in_compressed_pixeldata, nb_components, components_data, huff_tables1, huff_tables2, quant_table, pixel_Y, pixel_Cb, pixel_Cr) open_new_picture("../Example_images/test1.jpg", pic) parse_picture(pic, comp_names, mat) let end_time = now() let current_directory = path.cwd() write_ppm(pic, str(current_directory) + "/decodedimage.ppm") let write_time = now() let execution_time_algo : Float32 = end_time - start_time let execution_time_write : Float32 = write_time - end_time let execution_time_seconds_algo : Float32 = execution_time_algo / 1000000000 let execution_time_seconds_write : Float32 = execution_time_write / 1000000000 print("Time taken by the Jpeg decoder algorithm:", execution_time_seconds_algo, "seconds") print("Time taken for writing the image:", execution_time_seconds_write, "seconds") --- Python/README.md --- # Usage ```python3 main.py filename.jpg``` It will create a decoded ppm file named decodedimage.ppm --- Python/main.py --- import os import math import time import sys comp_names = ["Y", "Cb", "Cr"] class ComponentsData: def __init__(self): self.H = 0 self.V = 0 self.Tq = 0 self.xi = 0 self.yi = 0 self.Td = 0 # quant table for DC self.Ta = 0 # quant table for AC class HuffmanEntry: def __init__(self): self.sz = 0 self.codeword = 0 self.decoded = 0 class HuffmanTable: def __init__(self): self.nb_entries = 0 self.entries = [HuffmanEntry() for _ in range(256)] class PixelYCbCr: def __init__(self): self.Y = 0 self.Cb = 0 self.Cr = 0 class Picture: def __init__(self): self.data = bytearray() self.filesize = 0 self.pos_in_file = 0 self.size_X = 0 self.size_Y = 0 self.Hmax = 0 self.Vmax = 0 self.nb_MCU_total = 0 self.compressed_pixeldata = bytearray() self.sz_compressed_pixeldata = 0 self.pos_compressed_pixeldata = 0 self.bitpos_in_compressed_pixeldata = 0 self.nb_components = 0 self.components_data = [ComponentsData() for _ in range(4)] self.huff_tables = [[HuffmanTable() for _ in range(2)] for _ in range(2)] self.quant_tables = [[[0 for _ in range(8)] for _ in range(8)] for _ in range(4)] self.pixels_YCbCr = [[PixelYCbCr() for _ in range(self.size_Y)] for _ in range(self.size_X)] matrix8x8_t = [[0.0 for _ in range(8)] for _ in range(8)] def get1i(data, pos): val = data[pos] pos += 1 return val, pos def get2i(data, pos): val = (data[pos] << 8) | data[pos + 1] pos += 2 return val, pos def get4i(data, pos): val = (data[pos[0]] << 24) | (data[pos[0] + 1] << 16) | (data[pos[0] + 2] << 8) | data[pos[0] + 3] pos[0] += 4 return val def get_marker(data, pos): return (data[pos] << 8) | data[pos + 1] def to_bin(word, sz): str_val = '' for i in range(sz): str_val += '0' + str(int(bool(word & (1 << (sz - i - 1))))) return str_val def ceil_to_multiple_of(val, multiple): return multiple * ((val + multiple - 1) // multiple) def skip_EXIF(pic): len_val, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) print(f"APP1 (probably EXIF) found (length {len_val} bytes), skipping") pic.pos_in_file += len_val - 2 def parse_APP0(pic): len_val, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) print(f"APP0 found (length {len_val} bytes)") if len_val < 16: raise ValueError("APP0: too short") identifier = pic.data[pic.pos_in_file: pic.pos_in_file + 5].decode('utf-8') pic.pos_in_file += 5 version_major, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) version_minor, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) units, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) Xdensity, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) Ydensity, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) Xthumbnail, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) Ythumbnail, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) if identifier != "JFIF\x00": print(f"Invalid identifier: {identifier}") raise ValueError("APP0: invalid identifier") print(f"version {version_major}.{version_minor}") print(f"units {units}") print(f"density X {Xdensity} Y {Ydensity}") bytes_thumbnail = 3 * Xthumbnail * Ythumbnail if bytes_thumbnail: print(f"thumbnail {bytes_thumbnail} bytes, skipping") pic.pos_in_file += bytes_thumbnail else: print("no thumbnail") def parse_DQT(pic): Lq, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) print(f"DQT found (length {Lq} bytes)") PqTq, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) Pq = (PqTq >> 4) & 0x0f Tq = PqTq & 0x0f print(f"Pq (element precision) {Pq} -> {8 if Pq == 0 else 16} bits") print(f"Tq (table destination identifier) {Tq}") if Pq != 0: raise ValueError("DQT: only 8 bit precision supported") nb_data_bytes = Lq - 2 - 1 if nb_data_bytes != 64: raise ValueError("DQT: nb_data_bytes != 64") for u in range(8): for v in range(8): Q, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) pic.quant_tables[Tq][u][v] = Q def parse_SOF0(pic): len_val, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) print(f"SOF0 found (length {len_val} bytes)") P, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) Y, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) X, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) Nf, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) if P != 8: raise ValueError("SOF0: P != 8 unsupported") if Y == 0: raise ValueError("SOF0: Y == 0 unsupported") print(f"P {P} (must be 8)") print(f"imagesize X {X} Y {Y}") print(f"Nf (number of components) {Nf}") if Nf != 3: raise ValueError("picture does not have 3 components, this code will not work") pic.size_X = X pic.size_Y = Y for i in range(Nf): C, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) HV, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) H = (HV >> 4) & 0x0F V = HV & 0x0F Tq, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) pic.components_data[i].H = H pic.components_data[i].V = V pic.components_data[i].Tq = Tq print(f"component {i} ({comp_names[i]}) C {C}, H {H}, V {V}, Tq {Tq}") pic.nb_components = Nf Hmax = Vmax = 0 for i in range(pic.nb_components): if pic.components_data[i].H > Hmax: Hmax = pic.components_data[i].H if pic.components_data[i].V > Vmax: Vmax = pic.components_data[i].V pic.Hmax = Hmax pic.Vmax = Vmax pic.nb_MCU_total = (ceil_to_multiple_of(pic.size_X, 8 * Hmax) // (8 * Hmax)) * \ (ceil_to_multiple_of(pic.size_Y, 8 * Hmax) // (8 * Vmax)) print(f"Hmax {Hmax} Vmax {Vmax}") print(f"MCU_total {pic.nb_MCU_total}") for i in range(pic.nb_components): xi = int((pic.size_X * pic.components_data[i].H) / Hmax + 0.5) yi = int((pic.size_Y * pic.components_data[i].V) / Vmax + 0.5) pic.components_data[i].xi = xi pic.components_data[i].yi = yi print(f"component {i} ({comp_names[i]}) xi {xi} yi {yi}") print("allocating memory for pixels") pic.pixels_YCbCr = [ [PixelYCbCr() for _ in range(pic.size_Y)] for _ in range(pic.size_X) ] print("memory allocated") def parse_DHT(pic): len_val, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) print(f"DHT found (length {len_val} bytes)") TcTh, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) Tc = (TcTh >> 4) & 0x0f Th = TcTh & 0x0f print(f"Tc {Tc} ({'DC' if Tc == 0 else 'AC'} table)") print(f"Th (table destination identifier) {Th}") L = [] mt = 0 for i in range(16): a , pic.pos_in_file = get1i(pic.data, pic.pos_in_file) L.append(a) mt += L[i] print(f"total {mt} codes") codeword = 0 for i in range(16): for j in range(L[i]): V, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) pic.huff_tables[Tc][Th].entries[pic.huff_tables[Tc][Th].nb_entries].sz = i + 1 pic.huff_tables[Tc][Th].entries[pic.huff_tables[Tc][Th].nb_entries].codeword = codeword pic.huff_tables[Tc][Th].entries[pic.huff_tables[Tc][Th].nb_entries].decoded = V pic.huff_tables[Tc][Th].nb_entries += 1 codeword += 1 codeword <<= 1 def parse_SOS(pic): len_val, pic.pos_in_file = get2i(pic.data, pic.pos_in_file) print(f"SOS found (length {len_val} bytes)") Ns, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) print(f"Ns {Ns}") for j in range(Ns): Cs, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) TdTa, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) Td = (TdTa >> 4) & 0x0f Ta = TdTa & 0x0f print(f"component {j} ({comp_names[j]}) Cs {Cs} Td {Td} Ta {Ta}") pic.components_data[j].Td = Td # DC pic.components_data[j].Ta = Ta # AC Ss, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) Se, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) AhAl, pic.pos_in_file = get1i(pic.data, pic.pos_in_file) Ah = (AhAl >> 4) & 0x0f Al = AhAl & 0x0f print(f"Ss {Ss} Se {Se} Ah {Ah} Al {Al}") pic.pos_compressed_pixeldata = pic.pos_in_file print(f"compressed pixeldata starts at pos {pic.pos_compressed_pixeldata}\n") def copy_bitmap_data_remove_stuffing(pic): print("removing stuffing...") # Get length of bitstream without stuffing pos = pic.pos_compressed_pixeldata size = 0 combined = 0 while combined != 0xFFD9: if pos >= pic.filesize: raise ValueError("marker EOI (0xFFD9) missing") byte = pic.data[pos] pos += 1 if byte == 0xFF: byte2 = pic.data[pos] pos += 1 if byte2 != 0x00: combined = (byte << 8) | byte2 else: size += 1 else: size += 1 size_stuffed = pos - pic.pos_compressed_pixeldata - 2 # Remove stuffing pic.compressed_pixeldata = [0] * size print(f"{size_stuffed} bytes with stuffing") i = pic.pos_compressed_pixeldata pos = 0 size_without_stuffing = 0 while i < pic.pos_compressed_pixeldata + size_stuffed: if pic.data[i] != 0xFF: pic.compressed_pixeldata[pos] = pic.data[i] pos += 1 size_without_stuffing += 1 i += 1 elif pic.data[i] == 0xFF and pic.data[i + 1] == 0x00: pic.compressed_pixeldata[pos] = 0xFF pos += 1 size_without_stuffing += 1 i += 2 else: raise ValueError(f"unexpected marker 0x{pic.data[i]:02x}{pic.data[i + 1]:02x} found in bitstream") pic.bitpos_in_compressed_pixeldata = 0 pic.sz_compressed_pixeldata = size_without_stuffing pic.pos_in_file = pic.pos_compressed_pixeldata + size_stuffed print(f"{size_without_stuffing} data bytes without stuffing\n") def convert_to_neg(bits, sz): ret = -((bits ^ 0xFFFF) & ((1 << sz) - 1)) return ret def bitstream_get_bits(pic, nb_bits): if nb_bits > 16: raise ValueError("bitstream_get_bits: >16 bits requested") index = pic.bitpos_in_compressed_pixeldata // 8 pos_in_byte = 7 - pic.bitpos_in_compressed_pixeldata % 8 ret = 0 bits_copied = 0 while pos_in_byte >= 0 and bits_copied < nb_bits: ret <<= 1 ret |= int(bool(pic.compressed_pixeldata[index] & (1 << pos_in_byte))) bits_copied += 1 pos_in_byte -= 1 if pos_in_byte < 0: pos_in_byte = 7 index += 1 return ret def bitstream_remove_bits(pic, nb_bits): pic.bitpos_in_compressed_pixeldata += nb_bits def huff_decode(pic, Tc, Th, sz, bitstream, decoded): for i in range(pic.huff_tables[Tc][Th].nb_entries): if (pic.huff_tables[Tc][Th].entries[i].sz == sz and pic.huff_tables[Tc][Th].entries[i].codeword == bitstream): decoded = pic.huff_tables[Tc][Th].entries[i].decoded return True, decoded return False,decoded def bitstream_get_next_decoded_element(pic, Tc, Th, decoded, nb_bits): huff_candidate = 0 found = False while pic.bitpos_in_compressed_pixeldata < 8 * pic.sz_compressed_pixeldata: found = False for num_bits in range(1, 17): nb_bits = num_bits if pic.bitpos_in_compressed_pixeldata + nb_bits > 8 * pic.sz_compressed_pixeldata: raise ValueError("end of stream, requested too many bits") huff_candidate = bitstream_get_bits(pic, nb_bits) boo, decoded = huff_decode(pic, Tc, Th, nb_bits, huff_candidate, decoded) if boo: found = True bitstream_remove_bits(pic, nb_bits) return True, decoded, nb_bits if not found: is_all_one = True for i in range(nb_bits - 1): if (huff_candidate & (1 << i)) == 0: is_all_one = False break if is_all_one: bitstream_remove_bits(pic, nb_bits) else: raise ValueError( f"unknown code in bitstream bitpos {pic.bitpos_in_compressed_pixeldata} byte 0x{pic.compressed_pixeldata[pic.bitpos_in_compressed_pixeldata // 8]:x} [prev 0x{pic.compressed_pixeldata[(pic.bitpos_in_compressed_pixeldata // 8) - 1]:x}, next 0x{pic.compressed_pixeldata[(pic.bitpos_in_compressed_pixeldata // 8) + 1]:x}]") return False, decoded, nb_bits def store_data_unit_YCbCr(pic, MCU, component, data_unit, data): zoomX = pic.Hmax // pic.components_data[component].H zoomY = pic.Vmax // pic.components_data[component].V scaleX = 8 * pic.components_data[component].H scaleY = 8 * pic.components_data[component].V startX = MCU % (ceil_to_multiple_of(pic.size_X, 8 * pic.Hmax) // (scaleX * zoomX)) startY = MCU // (ceil_to_multiple_of(pic.size_X, 8 * pic.Hmax) // (scaleY * zoomY)) startHiX = data_unit % pic.components_data[component].H startHiY = data_unit // pic.components_data[component].H for x in range(8): for y in range(8): for zx in range(zoomX): for zy in range(zoomY): posX = (scaleX * startX + 8 * startHiX + x) * zoomX + zx posY = (scaleY * startY + 8 * startHiY + y) * zoomY + zy if posX < pic.size_X and posY < pic.size_Y: if component == 0: pic.pixels_YCbCr[posX][posY].Y = data[x][y] elif component == 1: pic.pixels_YCbCr[posX][posY].Cb = data[x][y] elif component == 2: pic.pixels_YCbCr[posX][posY].Cr = data[x][y] else: raise ValueError("unknown component") def reverse_ZZ_and_dequant(pic, quant_table, inp, outp): reverse_ZZ_u = [ [0, 0, 1, 2, 1, 0, 0, 1], [2, 3, 4, 3, 2, 1, 0, 0], [1, 2, 3, 4, 5, 6, 5, 4], [3, 2, 1, 0, 0, 1, 2, 3], [4, 5, 6, 7, 7, 6, 5, 4], [3, 2, 1, 2, 3, 4, 5, 6], [7, 7, 6, 5, 4, 3, 4, 5], [6, 7, 7, 6, 5, 6, 7, 7] ] reverse_ZZ_v = [ [0, 1, 0, 0, 1, 2, 3, 2], [1, 0, 0, 1, 2, 3, 4, 5], [4, 3, 2, 1, 0, 0, 1, 2], [3, 4, 5, 6, 7, 6, 5, 4], [3, 2, 1, 0, 1, 2, 3, 4], [5, 6, 7, 7, 6, 5, 4, 3], [2, 3, 4, 5, 6, 7, 7, 6], [5, 4, 5, 6, 7, 7, 6, 7] ] for u in range(8): for v in range(8): outp[reverse_ZZ_u[u][v]][reverse_ZZ_v[u][v]] = inp[u][v] * pic.quant_tables[quant_table][u][v] a_c = 0.9807 b_c = 0.8314 c_c = 0.5555 d_c = 0.1950 e_c = 0.9238 f_c = 0.3826 g_c = 0.7071 tab_coefs = [ [0.7071, a_c, e_c, b_c, g_c, c_c, f_c, d_c], [0.7071, b_c, f_c, -d_c, -g_c, -a_c, -e_c, -c_c], [0.7071, c_c, -f_c, -a_c, -g_c, d_c, e_c, b_c], [0.7071, d_c, -e_c, -c_c, g_c, b_c, -f_c, -a_c], [0.7071, -d_c, -e_c, c_c, g_c, -b_c, -f_c, a_c], [0.7071, -c_c, -f_c, a_c, -g_c, -d_c, e_c, -b_c], [0.7071, -b_c, f_c, d_c, -g_c, a_c, -e_c, c_c], [0.7071, -a_c, e_c, -b_c, g_c, -c_c, f_c, -d_c] ] def data_unit_do_idct(inp, outp): for y in range(8): for x in range(8): sxy = 0 for u in range(8): for v in range(8): Svu = inp[v][u] sxy += Svu * tab_coefs[x][u] * tab_coefs[y][v] sxy *= 0.25 sxy += 128 outp[x][y] = sxy def print_matrix(m): for u in range(8): for v in range(8): print(f"{m[u][v]:5f}", end=" ") print() print() def parse_bitmap_data(pic): print("parsing bitstream...") nb_bits = 0 component = 0 data_unit = 0 ac_count = 0 precedent_DC = [0, 0, 0, 0] nb_MCU = 0 matrix = [[0 for _ in range(8)] for _ in range(8)] while nb_MCU < pic.nb_MCU_total: component = 0 while component < pic.nb_components: data_unit = 0 while data_unit < (pic.components_data[component].V * pic.components_data[component].H): for u in range(8): for v in range(8): matrix[u][v] = 0 SSSS = 0 DC = 0 boo, SSSS, nb_bits = bitstream_get_next_decoded_element(pic, 0, pic.components_data[component].Td, SSSS, nb_bits) if not boo: errx(1, "no DC data") if SSSS: bits_DC = bitstream_get_bits(pic, SSSS) bitstream_remove_bits(pic, SSSS) msb_DC = bool(bits_DC & (1 << (SSSS - 1))) if msb_DC: DC = precedent_DC[component] + bits_DC else: DC = precedent_DC[component] + convert_to_neg(bits_DC, SSSS) else: DC = precedent_DC[component] + 0 matrix[0][0] = DC precedent_DC[component] = DC AC = 0 ac_count = 0 while ac_count < 63: RRRRSSSS = 0 boo, RRRRSSSS, nb_bits = bitstream_get_next_decoded_element(pic, 1, pic.components_data[component].Ta, RRRRSSSS, nb_bits) if not boo: errx(1, "no AC data") RRRR = RRRRSSSS >> 4 SSSS = RRRRSSSS & 0x0f if RRRR == 0 and SSSS == 0: break elif RRRR == 0x0F and SSSS == 0: ac_count += 16 else: ac_count += RRRR bits_AC = bitstream_get_bits(pic, SSSS) bitstream_remove_bits(pic, SSSS) msb_AC = bool(bits_AC & (1 << (SSSS - 1))) if msb_AC: AC = bits_AC else: AC = convert_to_neg(bits_AC, SSSS) u = (ac_count + 1) // 8 v = (ac_count + 1) % 8 matrix[u][v] = AC ac_count += 1 matrix_dequant = [[0 for _ in range(8)] for _ in range(8)] reverse_ZZ_and_dequant(pic, pic.components_data[component].Tq, matrix, matrix_dequant) matrix_decoded = [[0 for _ in range(8)] for _ in range(8)] data_unit_do_idct(matrix_dequant, matrix_decoded) store_data_unit_YCbCr(pic, nb_MCU, component, data_unit, matrix_decoded) data_unit += 1 component += 1 nb_MCU += 1 print("parsed %lu MCU" % nb_MCU) def open_new_picture(name, picture): with open(name, "rb") as f: picture.filesize = os.path.getsize(name) picture.data = bytearray(f.read()) print(f"{picture.filesize} bytes read from {name}\n") picture.pos_in_file = 0 picture.nb_components = 0 for i in range(2): for j in range(2): picture.huff_tables[i][j].nb_entries = 0 def parse_picture(picture): while picture.pos_in_file < picture.filesize - 1: marker = get_marker(picture.data, picture.pos_in_file) picture.pos_in_file += 2 print("marker: ", marker) if marker == 0xFFD8: print("SOI found") elif marker == 0xFFE1: skip_EXIF(picture) elif marker == 0xFFE0: parse_APP0(picture) elif marker == 0xFFDB: parse_DQT(picture) elif marker == 0xFFC0: parse_SOF0(picture) elif marker == 0xFFC4: parse_DHT(picture) elif marker == 0xFFDA: parse_SOS(picture) copy_bitmap_data_remove_stuffing(picture) parse_bitmap_data(picture) elif marker == 0xFFD9: print("EOI found") else: print(f"unknown marker 0x{marker:04x} pos {picture.pos_in_file}") break print() def clamp(v): if v < 0: return 0 if v > 255: return 255 return int(v) def write_ppm(pic, filename): print(f"writing file {filename}") with open(filename, "w") as out: out.write(f"P3\n{pic.size_X} {pic.size_Y}\n255\n") for y in range(pic.size_Y): for x in range(pic.size_X): Y = pic.pixels_YCbCr[x][y].Y Cb = pic.pixels_YCbCr[x][y].Cb Cr = pic.pixels_YCbCr[x][y].Cr r = Y + 1.402 * (Cr - 128) g = Y - (0.114 * 1.772 * (Cb - 128) + 0.299 * 1.402 * (Cr - 128)) / 0.587 b = Y + 1.772 * (Cb - 128) out.write(f"{clamp(round(r))} {clamp(round(g))} {clamp(round(b))} ") out.write("\n") print("output file written\n") def main(): if len(sys.argv) != 2: print("Usage: python script.py <filename.jpg>") sys.exit(1) start_time = time.time() pic = Picture() open_new_picture(sys.argv[1], pic) parse_picture(pic) end_time = time.time() write_ppm(pic, "decodedimage.ppm") write_time = time.time() elapsed_time_algo = end_time - start_time elapsed_time_write = write_time - end_time print(f"Time taken by the Jpeg decoder algorithm: {elapsed_time_algo} seconds") print(f"Time taken for writing the image: {elapsed_time_write} seconds") if __name__ == "__main__": main() --- README.md --- # Mojo Introduction Mojo is a super-charged language that delivers C-like performance with the user-friendliness of Python. It's designed to bridge the gap between research and production, empowering you to write lightning-fast code without sacrificing readability or ease of use. Think of it as Python on steroids, ready to tackle computationally intensive tasks with ease. Mojo is a young but ambitious programming language making waves in the AI world. Mojo aims to address a key pain point: unlocking AI hardware's full potential without sacrificing developer experience. Currently in a preview release, Mojo has already garnered interest from both academia and industry. While not yet open-source, the creators plan to make it so in the future # JPEG Decoder Overview A JPEG decoder is a crucial component that interprets and decodes JPEG image files, facilitating their display or manipulation. It processes the encoded data, performing tasks such as entropy decoding, color space conversion, and dequantization to reconstruct the image. # Implementation in Three Languages I implemented the JPEG decoder in three programming languages: C, Python, and Mojo. The initial implementation, already available to me, was in C and served as the baseline:<br> https://github.com/kittennbfive/kittenJPEG/tree/main <br> While I optimized the C implementation by removing unnecessary computations, the Python and Mojo versions were developed from scratch. I translated the new C code into both Python and Mojo, enabling a comprehensive comparison of their performance and efficiency. For each implementation, three images of different sizes were considered to measure the performance: (480, 680, 3), (848, 875, 3), and (2827, 2920, 3) where these dimensions represent the RGB pixel sizes of the images under consideration # Specifications All of the three codes will work only for Baseline JPEG with Huffman-Encoding, 8 bit precision and YCbCr-data. EXIF-data will be skipped without being decoded, just use something like ```exiftool```. This code does support Chroma-subsampling and dimensions that are not a multiple of 8 pixels. If you just want to view a jpg-file this is not what you are looking for at all, there are tons of image-viewers for all existing operating systems. However if you want to know more about the internals of JPEG, write or debug your own decoder this code could be handy. The main purpose of this is to see the performance difference when the same algorithm is implemented between 3 different languages. # Language Comparison In the performance evaluation, C demonstrated the highest execution speed, followed by Mojo, which exhibited approximately 1.5 times lower performance than C. Python, being an interpreted language, showed the slowest execution speed, lagging nearly 100 times behind C. The y-axis in the line graph is presented in logarithmic cycles in millions to enhance the visibility of differences between Mojo, C, and Python implementations. The x-axis shows categories of different sized images. The line graph visualizes the performance across the three image sizes, providing a comprehensive comparison. ![alt text](https://github.com/taalhaataahir0102/Jpeg-Decoder/blob/main/graph/graph.png) The following table shows the total cycles taken by the Jpeg decoder algorithm (excluding the cycles taken for file reading and writing) for each language: ![alt text](https://github.com/taalhaataahir0102/Jpeg-Decoder/blob/main/graph/table.png) These cycles were measured through perf profiling tool --- LICENSE --- MIT License Copyright (c) 2024 Maxim Zaks Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- `compact-dict` is a fast hashmap based dictionary implemented in Mojo 🔥. Although the dictionary is fast (currently it is about 10x faster than the std `Dict`) its main concern is with reducing memory footprint. We introduce two self sufficient modules: - `string_dict` where the key type of the dictionary is a `String` - `generic_dict` which allows keys to be of any type conforming with `Keyable` trait Both modules expose a `Dict` struct which has the following compile time parametrization options: - Value type can be any type conforming with `CollectionElement` trait - We use a fast hash function as default, but you can provide your own hash function - By setting the `KeyCountType` to a lower unsigned DType e.g. (`DType.uint8` or `DType.uint16`) we can reduce the memory footprint. The type needs to be able to represent number of keys - By setting the `KeyOffsetType` to a lower unsigned DType we can reduce the memory footprint even further. The type needs to be able to represent the sum of all key bytes - Set `destructive` to `False` if you don't intend to delete keys from the dict. This way we do not waste space for deleted flags - Set `caching_hashes` to `False` in order to reduce memory footprint by not caching the hash values. Keep in mind that this change slows down the rehashing process The `Dict` can be instantiated with a `capacity` value. Default is set to 16, min capacity is 8. If you know the number of elements ahead of time set it, this will avoid rehashing and might improve memory footprint. ### Sample code for generic dict: ``` from generic_dict import Dict, Keyable, KeysBuilder from testing import assert_equal @value struct Person(Keyable): var name: String var age: Int fn accept[T: KeysBuilder](self, inout keys_builder: T): keys_builder.add_buffer[DType.int8](self.name._as_ptr(), len(self.name)) keys_builder.add(Int64(self.age)) fn test_person_dict() raises: let p1 = Person("Maxim", 42) let p2 = Person("Maximilian", 62) let p3 = Person("Alex", 25) let p4 = Person("Maria", 28) let p5 = Person("Daria", 13) let p6 = Person("Max", 31) var d = Dict[Int]() d.put(p1, 1) d.put(p2, 11) d.put(p3, 111) d.put(p4, 1111) d.put(p5, 11111) d.put(p6, 111111) assert_equal(d.get(p1, 0), 1) assert_equal(d.get(p2, 0), 11) assert_equal(d.get(p3, 0), 111) assert_equal(d.get(p4, 0), 1111) assert_equal(d.get(p5, 0), 11111) assert_equal(d.get(p6, 0), 111111) ``` ### Note: Due to a bug in Mojo 24.1 `generic_dict` module does not compile Bug report https://github.com/modularml/mojo/issues/1858 --- benchmark_generic_dict.mojo --- import benchmark from generic_dict import Dict, Keyable, KeysBuilder from collections.dict import KeyElement, Dict as StdDict from pathlib import cwd from testing import assert_equal from corpora import * @value struct StringKey(KeyElement, Keyable): var s: String fn __init__(inout self, owned s: String): self.s = s^ fn __init__(inout self, s: StringLiteral): self.s = String(s) fn __hash__(self) -> Int: var ptr = self.s.unsafe_ptr() return hash(ptr, len(self.s)) fn __eq__(self, other: Self) -> Bool: return self.s == other.s fn __ne__(self, other: Self) -> Bool: return self.s != other.s fn accept[T: KeysBuilder](self, inout keys_builder: T): keys_builder.add_buffer(self.s.unsafe_ptr(), len(self.s)) fn corpus_stats(corpus: List[String]): print("=======Corpus Stats=======") print("Number of elements:", len(corpus)) var min = 100000000 var max = 0 var sum = 0 var count = 0 for i in range(len(corpus)): var key = corpus[i] if len(key) == 0: continue count += 1 sum += len(key) if min > len(key): min = len(key) if max < len(key): max = len(key) var avg = sum / count print("Min key lenght:", min) print("Avg key length:", avg) print("Max key length:", max) print("Total num of bytes:", sum) print("\n") fn main() raises: var d1 = Dict[Int]() var d2 = StdDict[StringKey, Int]() var corpus = french_text_to_keys() print("") corpus_stats(corpus) @parameter fn build_compact_dict(): var d = Dict[Int](len(corpus)) # var d = Dict[Int]() for i in range(len(corpus)): try: _ = d.put(StringKey(corpus[i]), i) except: print("!!!") d1 = d^ @parameter fn build_std_dict(): var d = StdDict[StringKey, Int]() for i in range(len(corpus)): d[corpus[i]] = i d2 = d^ print("+++++++Create Dict Benchmark+++++++") var build_compact_stats = benchmark.run[build_compact_dict](max_runtime_secs=0.5) # build_compact_stats.print("ns") var build_std_stats = benchmark.run[build_std_dict](max_runtime_secs=0.5) # build_std_stats.print("ns") print("Compact build speedup:", build_std_stats.mean() / build_compact_stats.mean()) var sum1 = 0 @parameter fn read_compact_dict(): sum1 = 0 for i in range(len(corpus)): try: sum1 += d1.get(StringKey(corpus[i]), -1) except: print("!!!!!") # d1.keys.print_keys() print("+++++++Read Dict Benchmark+++++++") var read_compact_stats = benchmark.run[read_compact_dict](max_runtime_secs=0.5) print("Sum1:", sum1, len(d1)) # read_compact_stats.print("ns") var sum2 = 0 @parameter fn read_std_dict(): sum2 = 0 for i in range(len(corpus)): try: sum2 += d2[corpus[i]] except: sum2 += -1 var raed_std_stats = benchmark.run[read_std_dict](max_runtime_secs=0.5) # raed_std_stats.print("ns") print("Sum2:", sum2, len(d2)) print("Compact read speedup:", raed_std_stats.mean() / read_compact_stats.mean()) assert_equal(sum1, sum2) assert_equal(len(d1), len(d2)) var m = 9 @parameter fn delete_compact_dict(): for i in range(len(corpus)): if i % m == 0: try: d1.delete(StringKey(corpus[i])) except: print("!!!!!!!!!!!!!!") @parameter fn delete_std_dict(): for i in range(len(corpus)): if i % m == 0: try: _ = d2.pop(corpus[i]) except: pass print("+++++++Delete Dict Benchmark+++++++") var delete_compact_stats = benchmark.run[delete_compact_dict](max_runtime_secs=0.5) var delete_std_stats = benchmark.run[delete_std_dict](max_runtime_secs=0.5) print("Compact delete speedup:", delete_std_stats.mean() / delete_compact_stats.mean()) print("+++++++Read After Delete Dict Benchmark+++++++") var read_after_delete_compact_stats = benchmark.run[read_compact_dict](max_runtime_secs=0.5) var read_after_delete_std_stats = benchmark.run[read_std_dict](max_runtime_secs=0.5) print("Compact read after delete speedup:", read_after_delete_std_stats.mean() / read_after_delete_compact_stats.mean()) print("Sum1:", sum1, "length:", len(d1)) print("Sum2:", sum2, "length:", len(d2)) assert_equal(sum1, sum2) assert_equal(len(d1), len(d2)) _ = corpus _ = d1^ _ = d2^ --- benchmark_multi_dict.mojo --- import benchmark from generic_dict import MultiDict, Keyable, KeysBuilder from collections.dict import KeyElement, Dict as StdDict from pathlib import cwd from testing import assert_equal from corpora import * @value struct StringKey(KeyElement, Keyable): var s: String fn __init__(inout self, owned s: String): self.s = s^ fn __init__(inout self, s: StringLiteral): self.s = String(s) fn __hash__(self) -> Int: var ptr = self.s.unsafe_ptr() return hash(ptr, len(self.s)) fn __eq__(self, other: Self) -> Bool: return self.s == other.s fn __ne__(self, other: Self) -> Bool: return self.s != other.s fn accept[T: KeysBuilder](self, inout keys_builder: T): keys_builder.add_buffer(self.s.unsafe_ptr(), len(self.s)) fn corpus_stats(corpus: List[String]): print("=======Corpus Stats=======") print("Number of elements:", len(corpus)) var min = 100000000 var max = 0 var sum = 0 var count = 0 for i in range(len(corpus)): var key = corpus[i] if len(key) == 0: continue count += 1 sum += len(key) if min > len(key): min = len(key) if max < len(key): max = len(key) var avg = sum / count print("Min key lenght:", min) print("Avg key length:", avg) print("Max key length:", max) print("Total num of bytes:", sum) print("\n") fn main() raises: var d1 = MultiDict[Int]() var d2 = StdDict[StringKey, Int]() var corpus = french_text_to_keys() print("") corpus_stats(corpus) @parameter fn build_compact_dict(): var d = MultiDict[Int](len(corpus)) # var d = MultiDict[Int]() for i in range(len(corpus)): try: d.put(StringKey(corpus[i]), i) except: print("!!!") d1 = d^ @parameter fn build_std_dict(): var d = StdDict[StringKey, Int]() for i in range(len(corpus)): d[corpus[i]] = i d2 = d^ print("+++++++Create Dict Benchmark+++++++") var build_compact_stats = benchmark.run[build_compact_dict](max_runtime_secs=0.5) # build_compact_stats.print("ns") var build_std_stats = benchmark.run[build_std_dict](max_runtime_secs=0.5) # build_std_stats.print("ns") print("Compact build speedup:", build_std_stats.mean() / build_compact_stats.mean()) var sum1 = 0 @parameter fn read_compact_dict(): sum1 = 0 for i in range(len(corpus)): try: var v = d1.get(StringKey(corpus[i])) sum1 += v[len(v) - 1] except: print("!!!!!") # d1.keys.print_keys() print("+++++++Read Dict Benchmark+++++++") var read_compact_stats = benchmark.run[read_compact_dict](max_runtime_secs=0.5) print("Sum1:", sum1, len(d1)) # read_compact_stats.print("ns") var sum2 = 0 @parameter fn read_std_dict(): sum2 = 0 for i in range(len(corpus)): try: sum2 += d2[corpus[i]] except: sum2 += -1 var raed_std_stats = benchmark.run[read_std_dict](max_runtime_secs=0.5) # raed_std_stats.print("ns") print("Sum2:", sum2, len(d2)) print("Compact read speedup:", raed_std_stats.mean() / read_compact_stats.mean()) assert_equal(sum1, sum2) assert_equal(len(d1), len(d2)) _ = corpus _ = d1^ _ = d2^ --- benchmark_report_string_dict.mojo --- import benchmark from string_dict import Dict as CompactDict from collections.dict import KeyElement, Dict as StdDict from pathlib import cwd from testing import assert_equal from csv import CsvBuilder from corpora import * alias M = 9 @value struct BenchmarkData: var reports: List[benchmark.Report] var read_checksums: List[Int] fn __init__(inout self): self.reports = List[benchmark.Report]() self.read_checksums = List[Int]() fn report_std_benchmarks(corpus: List[String], inout csv_builder: CsvBuilder) -> BenchmarkData: var benchmark_data = BenchmarkData() var std_dict = StdDict[String, Int]() @parameter fn build_dict(): var d = StdDict[String, Int]() for i in range(len(corpus)): d[corpus[i]] = i std_dict = d^ var build_stats = benchmark.run[build_dict](max_runtime_secs=0.5) csv_builder.push(str(build_stats.mean("ns")), False) benchmark_data.reports.append(build_stats) var sum = 0 @parameter fn read_dict(): sum = 0 for i in range(len(corpus)): try: sum += std_dict[corpus[i]] except: sum += -1 var read_stats = benchmark.run[read_dict](max_runtime_secs=0.5) csv_builder.push(str(read_stats.mean("ns")), False) benchmark_data.reports.append(read_stats) benchmark_data.read_checksums.append(sum) @parameter fn delete_dict(): for i in range(len(corpus)): if i % M == 0: try: _ = std_dict.pop(corpus[i]) except: pass var delete_stats = benchmark.run[delete_dict](max_runtime_secs=0.5) csv_builder.push(str(delete_stats.mean("ns")), False) benchmark_data.reports.append(delete_stats) var read_after_delete_stats = benchmark.run[read_dict](max_runtime_secs=0.5) csv_builder.push(str(read_after_delete_stats.mean("ns")), False) benchmark_data.reports.append(read_after_delete_stats) benchmark_data.read_checksums.append(sum) _ = std_dict return benchmark_data fn report_compact_benchmarks(corpus: List[String], inout csv_builder: CsvBuilder) -> BenchmarkData: var benchmark_data = BenchmarkData() var dict = CompactDict[Int]() @parameter fn build_dict_nc(): var d = CompactDict[Int]() for i in range(len(corpus)): d.put(corpus[i], i) dict = d^ var build_stats_nc = benchmark.run[build_dict_nc](max_runtime_secs=0.5) csv_builder.push(str(build_stats_nc.mean("ns")), False) benchmark_data.reports.append(build_stats_nc) @parameter fn build_dict(): var d = CompactDict[Int](len(corpus)) for i in range(len(corpus)): d.put(corpus[i], i) dict = d^ var build_stats = benchmark.run[build_dict](max_runtime_secs=0.5) csv_builder.push(str(build_stats.mean("ns")), False) benchmark_data.reports.append(build_stats) var sum = 0 @parameter fn read_dict(): sum = 0 for i in range(len(corpus)): sum += dict.get(corpus[i], -1) var read_stats = benchmark.run[read_dict](max_runtime_secs=0.5) var read_checksum = sum csv_builder.push(str(read_stats.mean("ns")), False) benchmark_data.reports.append(read_stats) benchmark_data.read_checksums.append(sum) @parameter fn delete_dict(): for i in range(len(corpus)): if i % M == 0: dict.delete(corpus[i]) var delete_stats = benchmark.run[delete_dict](max_runtime_secs=0.5) csv_builder.push(str(delete_stats.mean("ns")), False) benchmark_data.reports.append(delete_stats) var read_after_delete_stats = benchmark.run[read_dict](max_runtime_secs=0.5) var read_after_delete_checksum = sum csv_builder.push(str(read_after_delete_stats.mean("ns")), False) benchmark_data.reports.append(read_after_delete_stats) benchmark_data.read_checksums.append(sum) _ = dict return benchmark_data fn corpus_stats(corpus: List[String], inout csv_builder: CsvBuilder): csv_builder.push(str(len(corpus)), False) var min = 100000000 var max = 0 var sum = 0 var count = 0 for i in range(len(corpus)): var key = corpus[i] if len(key) == 0: continue count += 1 sum += len(key) if min > len(key): min = len(key) if max < len(key): max = len(key) var avg = sum / count csv_builder.push(str(sum), False) csv_builder.push(str(min), False) csv_builder.push(str(avg), False) csv_builder.push(str(max), False) fn report_speedup(std: BenchmarkData, compact: BenchmarkData, inout csv_builder: CsvBuilder): csv_builder.push(str(std.reports[0].mean() / compact.reports[0].mean()), False) csv_builder.push(str(std.reports[0].mean() / compact.reports[1].mean()), False) csv_builder.push(str(std.reports[1].mean() / compact.reports[2].mean()), False) csv_builder.push(str(std.reports[2].mean() / compact.reports[3].mean()), False) csv_builder.push(str(std.reports[3].mean() / compact.reports[4].mean()), False) fn report_checksums_alignment(std: BenchmarkData, compact: BenchmarkData, inout csv_builder: CsvBuilder): csv_builder.push(str(std.read_checksums[0] == compact.read_checksums[0]), False) csv_builder.push(str(std.read_checksums[1] == compact.read_checksums[1]), False) fn report(name: StringLiteral, corpus: List[String], inout csv_builder: CsvBuilder): csv_builder.push(name, False) corpus_stats(corpus, csv_builder) var std_stats = report_std_benchmarks(corpus, csv_builder) var compact_stats = report_compact_benchmarks(corpus, csv_builder) report_speedup(std_stats, compact_stats, csv_builder) report_checksums_alignment(std_stats, compact_stats, csv_builder) fn main() raises: # Crashes because of this bug https://github.com/modularml/mojo/issues/2829 var csv_builder = CsvBuilder( "Corpus", "Number of keys", "Total bytes", "Min key", "Avg key", "Max key", "Build stdlib", "Read stdlib", "Delete stdlib", "Read after delete stdlib", "Build compact nc", "Build compact", "Read compact", "Delete compact", "Read after delete compact", "Speedup build nc", "Speedup build", "Speedup read", "Speadup delete", "Speedup read after delete", "Read Checksum", "Read Checksum after delete" ) report("Arabic", arabic_text_to_keys(), csv_builder) report("Chinese", chinese_text_to_keys(), csv_builder) report("English", english_text_to_keys(), csv_builder) report("French", french_text_to_keys(), csv_builder) report("Georgien", georgian_text_to_keys(), csv_builder) report("German", german_text_to_keys(), csv_builder) report("Greek", greek_text_to_keys(), csv_builder) report("Hebrew", hebrew_text_to_keys(), csv_builder) report("Hindi", hindi_text_to_keys(), csv_builder) report("Japanese", japanese_long_keys(), csv_builder) report("l33t", l33t_text_to_keys(), csv_builder) report("Russian", russian_text_to_keys(), csv_builder) report("S3", s3_action_names(), csv_builder) report("Words", system_words_collection(), csv_builder) print(csv_builder^.finish()) --- benchmark_string_dict.mojo --- import benchmark from string_dict import Dict as CompactDict from collections.dict import KeyElement, Dict as StdDict from pathlib import cwd from testing import assert_equal from corpora import * fn corpus_stats(corpus: List[String]): print("=======Corpus Stats=======") print("Number of elements:", len(corpus)) var min = 100000000 var max = 0 var sum = 0 var count = 0 for i in range(len(corpus)): var key = corpus[i] if len(key) == 0: continue count += 1 sum += len(key) if min > len(key): min = len(key) if max < len(key): max = len(key) var avg = sum / count print("Min key lenght:", min) print("Avg key length:", avg) print("Max key length:", max) print("Total num of bytes:", sum) print("\n") fn main() raises: var d1 = CompactDict[Int]() var d2 = StdDict[String, Int]() var corpus = french_text_to_keys() print("") corpus_stats(corpus) @parameter fn build_compact_dict(): var d = CompactDict[Int](len(corpus)) # var d = CompactDict[Int]() for i in range(len(corpus)): d.put(corpus[i], i) d1 = d^ @parameter fn build_std_dict(): var d = StdDict[String, Int]() for i in range(len(corpus)): d[corpus[i]] = i d2 = d^ print("+++++++Create Dict Benchmark+++++++") var build_compact_stats = benchmark.run[build_compact_dict](max_runtime_secs=0.5) # build_compact_stats.print("ns") var build_std_stats = benchmark.run[build_std_dict](max_runtime_secs=0.5) # build_std_stats.print("ns") print("Compact build speedup:", build_std_stats.mean() / build_compact_stats.mean()) var sum1 = 0 @parameter fn read_compact_dict(): sum1 = 0 for i in range(len(corpus)): sum1 += d1.get(corpus[i], -1) # d1.keys.print_keys() print("+++++++Read Dict Benchmark+++++++") var read_compact_stats = benchmark.run[read_compact_dict](max_runtime_secs=0.5) print("Sum1:", sum1, len(d1)) # read_compact_stats.print("ns") var sum2 = 0 @parameter fn read_std_dict(): sum2 = 0 for i in range(len(corpus)): try: sum2 += d2[corpus[i]] except: sum2 += -1 var raed_std_stats = benchmark.run[read_std_dict](max_runtime_secs=0.5) # raed_std_stats.print("ns") print("Sum2:", sum2, len(d2)) print("Compact read speedup:", raed_std_stats.mean() / read_compact_stats.mean()) assert_equal(sum1, sum2) assert_equal(len(d1), len(d2)) var m = 9 @parameter fn delete_compact_dict(): for i in range(len(corpus)): if i % m == 0: d1.delete(corpus[i]) @parameter fn delete_std_dict(): for i in range(len(corpus)): if i % m == 0: try: _ = d2.pop(corpus[i]) except: pass print("+++++++Delete Dict Benchmark+++++++") var delete_compact_stats = benchmark.run[delete_compact_dict](max_runtime_secs=0.5) var delete_std_stats = benchmark.run[delete_std_dict](max_runtime_secs=0.5) print("Compact delete speedup:", delete_std_stats.mean() / delete_compact_stats.mean()) print("+++++++Read After Delete Dict Benchmark+++++++") var read_after_delete_compact_stats = benchmark.run[read_compact_dict](max_runtime_secs=0.5) var read_after_delete_std_stats = benchmark.run[read_std_dict](max_runtime_secs=0.5) print("Compact read after delete speedup:", read_after_delete_std_stats.mean() / read_after_delete_compact_stats.mean()) print("Sum1:", sum1, "length:", len(d1)) print("Sum2:", sum2, "length:", len(d2)) assert_equal(sum1, sum2) assert_equal(len(d1), len(d2)) _ = corpus _ = d1^ _ = d2^ --- checkout_remote_modules.sh --- #!/bin/bash function check_out_remote_module() ( rurl="$1" shift declare -a paths declare -a module_names for var in "$@" do IFS="=" read -ra module_name_components <<< "$var" components_count=${#module_name_components[@]} path=${module_name_components[0]} module_name=${module_name_components[$components_count-1]} paths=("${paths[@]}" "$path") module_names=("${module_names[@]}" "$module_name") done IFS=" " for module_name in "${module_names[@]}" do rm -rf ../$module_name done current_date_time=$(date) echo "URL: $rurl" git clone -n --depth=1 --filter=tree:0 $rurl cd ${rurl##*/} git sparse-checkout set --no-cone "${paths[@]}" git checkout for i in "${!paths[@]}" do module_name=${module_names[$i]} path=${paths[$i]} cp -R ./$path ../../$module_name echo $current_date_time > ../../$module_name/.checkoutinfo echo "URL: $rurl" >> ../../$module_name/.checkoutinfo echo "Path: $path" >> ../../$module_name/.checkoutinfo done cd ../ ) function checkout()( # Add check out remote module calls here check_out_remote_module "https://github.com/mzaks/mojo-csv" "csv" ) mkdir -p "_deps" cd "_deps" checkout rm -rf "../_deps" --- corpora/__init__.mojo --- from pathlib import cwd, Path fn english_text_to_keys() raises -> List[String]: return String('A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God! O my friend -- but it is too much for my strength -- I sink under the weight of the splendour of these visions!A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls').split(" ") fn greek_text_to_keys() raises -> List[String]: return (cwd() / "corpora" / "greek.txt").read_text().replace("\n", " ").split(" ") fn hebrew_text_to_keys() raises -> List[String]: return (cwd() / "corpora" / "hebrew.txt").read_text().replace("\n", " ").split(" ") fn arabic_text_to_keys() raises -> List[String]: return (cwd() / "corpora" / "arabic.txt").read_text().replace("\n", " ").split(" ") fn l33t_text_to_keys() raises -> List[String]: return (cwd() / "corpora" / "l33t.txt").read_text().replace("\n", " ").split(" ") fn georgian_text_to_keys() raises -> List[String]: return (cwd() / "corpora" / "georgian.txt").read_text().replace("\n", " ").split(" ") fn chinese_text_to_keys() raises -> List[String]: return (cwd() / "corpora" / "chinese.txt").read_text().replace("\n", " ").split(" ") fn french_text_to_keys() raises -> List[String]: return (cwd() / "corpora" / "french.txt").read_text().replace("\n", " ").split(" ") fn hindi_text_to_keys() raises -> List[String]: return (cwd() / "corpora" / "hindi.txt").read_text().replace("\n", " ").split(" ") fn russian_text_to_keys() raises -> List[String]: return String('Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину. Закрыв глаза, чтобы не видеть своих барахтающихся ног, он проделал это добрую сотню раз и отказался от этих попыток только тогда, когда почувствовал какую-то неведомую дотоле, тупую и слабую боль в боку. «Ах ты, господи, – подумал он, – какую я выбрал хлопотную профессию! Изо дня в день в разъездах. Деловых волнений куда больше, чем на месте, в торговом доме, а кроме того, изволь терпеть тяготы дороги, думай о расписании поездов, мирись с плохим, нерегулярным питанием, завязывай со все новыми и новыми людьми недолгие, никогда не бывающие сердечными отношения. Черт бы побрал все это!» Он почувствовал вверху живота легкий зуд; медленно подвинулся на спине к прутьям кровати, чтобы удобнее было поднять голову; нашел зудевшее место, сплошь покрытое, как оказалось, белыми непонятными точечками; хотел было ощупать это место одной из ножек, но сразу отдернул ее, ибо даже простое прикосновение вызвало у него, Грегора, озноб. Он соскользнул в прежнее свое положение. «От этого раннего вставания, – подумал он, – можно совсем обезуметь. Человек должен высыпаться. Другие коммивояжеры живут, как одалиски. Когда я, например, среди дня возвращаюсь в гостиницу, чтобы переписать полученные заказы, эти господа только завтракают. А осмелься я вести себя так, мои хозяин выгнал бы меня сразу. Кто знает, впрочем, может быть, это было бы даже очень хорошо для меня. Если бы я не сдерживался ради родителей, я бы давно заявил об уходе, я бы подошел к своему хозяину и выложил ему все, что о нем думаю. Он бы так и свалился с конторки! Странная у него манера – садиться на конторку и с ее высоты разговаривать со служащим, который вдобавок вынужден подойти вплотную к конторке из-за того, что хозяин туг на ухо. Однако надежда еще не совсем потеряна: как только я накоплю денег, чтобы выплатить долг моих родителей – на это уйдет еще лет пять-шесть, – я так и поступлю. Тут-то мы и распрощаемся раз и навсегда. А пока что надо подниматься, мой поезд отходит в пять». И он взглянул на будильник, который тикал на сундуке. «Боже правый!» – подумал он. Было половина седьмого, и стрелки спокойно двигались дальше, было даже больше половины, без малого уже три четверти. Неужели будильник не звонил? С кровати было видно, что он поставлен правильно, на четыре часа; и он, несомненно, звонил. Но как можно было спокойно спать под этот сотрясающий мебель трезвон? Ну, спал-то он неспокойно, но, видимо, крепко. Однако что делать теперь? Следующий поезд уходит в семь часов; чтобы поспеть на него, он должен отчаянно торопиться, а набор образцов еще не упакован, да и сам он отнюдь не чувствует себя свежим и легким на подъем. И даже поспей он на поезд, хозяйского разноса ему все равно не избежать – ведь рассыльный торгового дома дежурил у пятичасового поезда и давно доложил о его, Грегора, опоздании. Рассыльный, человек бесхарактерный и неумный, был ставленником хозяина. А что, если сказаться больным? Но это было бы крайне неприятно и показалось бы подозрительным, ибо за пятилетнюю свою службу Грегор ни разу еще не болел. Хозяин, конечно, привел бы врача больничной кассы и стал попрекать родителей сыном-лентяем, отводя любые возражения ссылкой на этого врача, по мнению которого все люди на свете совершенно здоровы и только не любят работать. И разве в данном случае он был бы так уж неправ? Если не считать сонливости, действительно странной после такого долгого сна, Грегор и в самом деле чувствовал себя превосходно и был даже чертовски голоден.Проснувшись однажды утром после беспокойного сна, Грегор Замза обнаружил, что он у себя в постели превратился в страшное насекомое. Лежа на панцирнотвердой спине, он видел, стоило ему приподнять голову, свой коричневый, выпуклый, разделенный дугообразными чешуйками живот, на верхушке которого еле держалось готовое вот-вот окончательно сползти одеяло. Его многочисленные, убого тонкие по сравнению с остальным телом ножки беспомощно копошились у него перед глазами. «Что со мной случилось?» – подумал он. Это не было сном. Его комната, настоящая, разве что слишком маленькая, но обычная комната, мирно покоилась в своих четырех хорошо знакомых стенах. Над столом, где были разложены распакованные образцы сукон – Замза был коммивояжером, – висел портрет, который он недавно вырезал из иллюстрированного журнала и вставил в красивую золоченую рамку. На портрете была изображена дама в меховой шляпе и боа, она сидела очень прямо и протягивала зрителю тяжелую меховую муфту, в которой целиком исчезала ее рука. Затем взгляд Грегора устремился в окно, и пасмурная погода – слышно было, как по жести подоконника стучат капли дождя – привела его и вовсе в грустное настроение. «Хорошо бы еще немного поспать и забыть всю эту чепуху», – подумал он, но это было совершенно неосуществимо, он привык спать на правом боку, а в теперешнем своем состоянии он никак не мог принять этого положения. С какой бы силой ни поворачивался он на правый бок, он неизменно сваливался опять на спину.').split(" ") fn german_text_to_keys() raises -> List[String]: return String('Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort "und" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort "und" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort "und" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg. Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen').split(" ") fn japanese_long_keys() raises -> List[String]: return String('米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。 国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。 罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。 連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。 決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。 学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。 変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。 千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。 係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。 暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。').split(" ") fn s3_action_names() raises -> List[String]: return String('AbortMultipartUpload CompleteMultipartUpload CopyObject CreateBucket CreateMultipartUpload DeleteBucket DeleteBucketAnalyticsConfiguration DeleteBucketCors DeleteBucketEncryption DeleteBucketIntelligentTieringConfiguration DeleteBucketInventoryConfiguration DeleteBucketLifecycle DeleteBucketMetricsConfiguration DeleteBucketOwnershipControls DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteBucketWebsite DeleteObject DeleteObjects DeleteObjectTagging DeletePublicAccessBlock GetBucketAccelerateConfiguration GetBucketAcl GetBucketAnalyticsConfiguration GetBucketCors GetBucketEncryption GetBucketIntelligentTieringConfiguration GetBucketInventoryConfiguration GetBucketLifecycle GetBucketLifecycleConfiguration GetBucketLocation GetBucketLogging GetBucketMetricsConfiguration GetBucketNotification GetBucketNotificationConfiguration GetBucketOwnershipControls GetBucketPolicy GetBucketPolicyStatus GetBucketReplication GetBucketRequestPayment GetBucketTagging GetBucketVersioning GetBucketWebsite GetObject GetObjectAcl GetObjectAttributes GetObjectLegalHold GetObjectLockConfiguration GetObjectRetention GetObjectTagging GetObjectTorrent GetPublicAccessBlock HeadBucket HeadObject ListBucketAnalyticsConfigurations ListBucketIntelligentTieringConfigurations ListBucketInventoryConfigurations ListBucketMetricsConfigurations ListBuckets ListMultipartUploads ListObjects ListObjectsV2 ListObjectVersions ListParts PutBucketAccelerateConfiguration PutBucketAcl PutBucketAnalyticsConfiguration PutBucketCors PutBucketEncryption PutBucketIntelligentTieringConfiguration PutBucketInventoryConfiguration PutBucketLifecycle PutBucketLifecycleConfiguration PutBucketLogging PutBucketMetricsConfiguration PutBucketNotification PutBucketNotificationConfiguration PutBucketOwnershipControls PutBucketPolicy PutBucketReplication PutBucketRequestPayment PutBucketTagging PutBucketVersioning PutBucketWebsite PutObject PutObjectAcl PutObjectLegalHold PutObjectLockConfiguration PutObjectRetention PutObjectTagging PutPublicAccessBlock RestoreObject SelectObjectContent UploadPart UploadPartCopy WriteGetObjectResponse, CreateAccessPoint CreateAccessPointForObjectLambda CreateBucket CreateJob CreateMultiRegionAccessPoint DeleteAccessPoint DeleteAccessPointForObjectLambda DeleteAccessPointPolicy DeleteAccessPointPolicyForObjectLambda DeleteBucket DeleteBucketLifecycleConfiguration DeleteBucketPolicy DeleteBucketReplication DeleteBucketTagging DeleteJobTagging DeleteMultiRegionAccessPoint DeletePublicAccessBlock DeleteStorageLensConfiguration DeleteStorageLensConfigurationTagging DescribeJob DescribeMultiRegionAccessPointOperation GetAccessPoint GetAccessPointConfigurationForObjectLambda GetAccessPointForObjectLambda GetAccessPointPolicy GetAccessPointPolicyForObjectLambda GetAccessPointPolicyStatus GetAccessPointPolicyStatusForObjectLambda GetBucket GetBucketLifecycleConfiguration GetBucketPolicy GetBucketReplication GetBucketTagging GetBucketVersioning GetJobTagging GetMultiRegionAccessPoint GetMultiRegionAccessPointPolicy GetMultiRegionAccessPointPolicyStatus GetMultiRegionAccessPointRoutes GetPublicAccessBlock GetStorageLensConfiguration GetStorageLensConfigurationTagging ListAccessPoints ListAccessPointsForObjectLambda ListJobs ListMultiRegionAccessPoints ListRegionalBuckets ListStorageLensConfigurations PutAccessPointConfigurationForObjectLambda PutAccessPointPolicy PutAccessPointPolicyForObjectLambda PutBucketLifecycleConfiguration PutBucketPolicy PutBucketReplication PutBucketTagging PutBucketVersioning PutJobTagging PutMultiRegionAccessPointPolicy PutPublicAccessBlock PutStorageLensConfiguration PutStorageLensConfigurationTagging SubmitMultiRegionAccessPointRoutes UpdateJobPriority UpdateJobStatus').split(" ") fn system_words_collection() raises -> List[String]: return Path("/usr/share/dict/words").read_text().split("\n") --- corpora/arabic.txt --- ثم أسر فمرّ لأداء, مع ومضى فاتّبع قبل. وزارة التّحول عن الى, كان أن وقوعها، الإطلاق الدّفاع, ودول الثالث، لتقليعة الى عن. أم عرض ميناء شواطيء استدعى, تونس بقسوة وإقامة هو نفس, ميناء بتخصيص الإنذار، أم كما. عل العدّ وإيطالي أما, ٣٠ فعل دارت وبعد. أي بالعمل والقرى قبل. ونتج الجنوب إيو أم. أن ولم الجو واحدة للإتحاد. هاربر العالم جُل بل, النفط الإحتفاظ الأوربيين ثم قام. وبغطاء الأوربيين حتى هو, أسر و شاسعة المؤلّفة, أمدها وإقامة العالم، مع يبق. تم وقامت تكاليف وباستثناء قبل, أدنى بأيدي الدولارات من حيث. كثيرة الثقيلة ٣٠ هذه. إذ قادة كنقطة الشهير غير. تمهيد مساعدة التجارية ان وقد, واُسدل بأضرار إيطاليا ثم بعض. كما مع أوسع والحزب ولكسمبورغ, جُل قامت باستخدام بـ. بتطويق والكساد والنرويج لها ان, وتم وفرنسا بالولايات ما, خيار فسقط يتبقّ قام و. بل هُزم بريطانيا الأوربيين فصل, عل بعض مئات اتفاق الربيع،, إذ الأحمر مقاومة ومن. حدى ويتّفق أوروبا إذ, خيار بقسوة تحرّك ٣٠ فقد. بل الأمم للمجهود الشّعبين كلّ. مئات بالرغم يتم أن. من حيث وانتهاءً الأمريكي, تم كلّ نقطة وحرمان الولايات. هو لمّ السيء عشوائية. من قتيل، وبولندا الأمريكية مكن, هُزم الأولية انتصارهم حين بـ. المنتصر الأهداف كما بل. ذات لم فكانت لعملة المتاخمة. حول بل للصين لإعادة, عرض أن وشعار الانجليزية. مكن حقول القادة كل. جيوب وبعد الشّعبين جعل أم, عل معاملة أفريقيا بعض, والفلبين ويكيبيديا فصل ٣٠. وعلى الأمور تحت أم. بين أم المضي والفلبين انتصارهم, الأرض الأراضي انه ان, عن أخر وإقامة الشتاء انتباه. وفي تشكيل فرنسا تشيكوسلوفاكيا ان, في وقرى ليركز وقدّموا مدن. بحث الباهضة الإتفاقية مع, حول ٣٠ أدوات بالفشل ويكيبيديا, أثره، بأيدي بـ وتم. مرجع العصبة الحدود على و. فصل من حصدت دأبوا الأبرياء, ان مرجع الأرواح عدد, هذا دارت الأمم في. إبّان الإقتصادية قبل بل, بين ان كرسي اكتوبر وبلجيكا،. حتى ما الثالث العمليات العالمية, عل بعد أراض الدول قائمة, من إعمار واتّجه للمجهود عدد. في وجهان تطوير ليرتفع دنو, يتم ببعض حاول المجتمع أم. أوزار المارق الشهير قد بلا, وحرمان ديسمبر إذ تحت. حدى عن شرسة إعلان الفترة. إذ دخول إستيلاء هذه, ٣٠ هذا وترك لأداء. لإعادة جزيرتي باستخدام من لكل. يقوم بالفشل بريطانيا، شيء أي, كانت بقسوة كل دول, الضغوط الصفحات نفس قد. بمحاولة الأثنان ما ذات. يتم عن واتّجه المنتصر, بل أوزار الأبرياء وبريطانيا كلا. حدى عن فسقط وصافرات, لها لم شرسة وقامت الجنود. أم الأخذ وانهاء بها, مما جيما فكان مقاومة و. المشترك شموليةً كلّ و, التّحول والمانيا بعد بـ. دفّة وبعدما جديداً فعل ثم, قبل وانهاء الهجوم ان, من وقوعها، المزيفة كلا. كثيرة بمعارضة ان ذات, الا لعملة بمعارضة الإيطالية لم. جدول المؤلّفة حدى من. قام في الأمور ديسمبر الاندونيسية, كانتا وبولندا جُل ثم. بتحدّي البشريةً كلّ بـ, مايو للصين فهرست هذا ثم, فبعد المضي اوروبا ان عدم. بعد قد ميناء وبداية واتّجه, المارق الأوروبية أي أضف. و بأيدي محاولات جُل, تحت اعلان وأكثرها إذ. لم بعد ليركز الفرنسية. --- corpora/chinese.txt --- 巡済思真報就少健話新能長載画。条護超館講商法何失転絶障報東民政浜六青聞。木送月定枚性校増予体労根援住話広。親氏創再信止園南質作海資著制映制。上徳次証禁込福画給査北州厳真。政噴属要式優芸花季件童門。議南補太権場検数場爺極東年了目物。背園鬱購事園税応駐小雪京安字。標事何式間若学投対継細一数常遣疑住場通。 魚申天旅連社今覚返車交社聞変。決結載面共対開全京誌約森気経報覧失日。住始問願芋火提法決断名身舞込最。廃図万読聞禁天野著技政来閲署心保見。王最通光期行米表視無校更科楽底衆円。但出感考加出不必敬奈族勢件陣市開意軽役済。市重森先式交図更再験成以極広注。理七垂上尾総信会名海宝海開日情村。無規代両明声先想内追書謙代。 捕点改現立野夫読郵育典提要龍毎権軽。性山陣禁欠近秒米長天号連非世。知張書未羊通嗅第和半教前程挑香。不並配恐著決木予家記容容日達株。露急置上趣用選魅住船座陽予共代去相能。左止朝士猶環部時書間切現沢苦案開子決個挿。極極値年昔友祉写原軽毎月現読勝説訴定件圧。評要園任治撤競記飯康下捕意登育読検地倒文。 対構哨武港載中群読病載音。聞国知売日夕処組眠木手要。録視聞早神転帯政五禁安入写出祉覧古片全。海形健読成安設陽権者男座打成素議。義賞堀発政表養効事吉題前造向冬歓立。初大転目政害定育教育日田千岩露。問上件者晴男件出代新占登祭部的学選。中著万点層愛綺載削的止党設却文蒼。式委現析会司泳厳期逆経長。米内却調暮夜大討防備品発問。 可著裏府暮才夕済断塁意証大。江終旅取方中協広指杯罪真松平開。段源有読運問載込表育日望板南容数索蹴。在急動件源辺永内原申面見語幸未真。毎優医負究対無朝止柳式旗亭祈索稿立営。劇子稿今嫁今虫年館能東球見際法名政。司供特媛方相銃望評覧能音台旅。売健誠系民半丸能橋暮堂田合際製経記題関。選南基合録止飾立連役見催五第連代。 属玲全支開手部衝関優亭国変問社環裏。転指育娘狂第権提連準前乗男連計実。力銀残住面告進更暮平護胸面係相補枝。憲舞対限容手健福年局月券談堀。島量極区明説芸豊故勝例部初都共者場。子成戦籍火北保際徳各一判交。志言香察凡飯模崎高色盤研促周問罪評噂盟歩。吾済会断全決変必重前著左検和家空境講。省特場薬受天面掲直転技部八。 士杏評公広第診謙学供氏査開式犠索攻趣義。送度毎省源場読乗選球合門表試毎再記入風嶋。月府躍針治宕号告式切試阪字課比市互速。故話紹谷位文期載水五答稿案埼安情。倉応記子初地行宏果後検祭明国訳。至増綾育除魚時外亭新価択。治官録容心国囲動止氏公券効進月句級宣論全。行野接重身妖話作済帳通際告棋。取援業症載像多文下表計時輸化車属。 雄禁読放訳済覧押悪身象真進体。文臣方事占刺俳立堂止回護公碁質。局民返自必面幻座職必質弾標陽渡計大府。休売担記問空川貯則章阻表者郡森編。化乗感想開私湖押面杯訴多怖。緊物文表野図情給端件置属真能。世参文域挙患甲作際辺強赤懇者部。五決政然児能本原表第独利区搬解。入論日講塾条満働大都別話。約載副得実後必学里場四幅芸弁示北高達。 将原放今恵該設島世稿代社。射第法件金内良無政毎城者佐見所代真弁。棋稿稿工申径走芸組合重泉山字万。頑男無拍超高童宅校全風新川。県場告国好都治中成担未為経要京切王世兵組。所業雄乗問巨図報無渡分写通論踊味転測引。歴許名績断左都席示学小将細。療他繕原謝保選域淡含誤保誤戦究択圧意。者文強弟更権浮地製市任竹斉内童殖死課。 園転掲連経取奥再異助事打人鮎。館聘掲入阪整太内也与先青並。選神情恒済級郵仁紹争施新近他。情打引治欧治型京鋭見池提象提地意読稿。応就説応判仕狙本所由影要軽記続。行置業載役世仁四界骨際桑格極再院小載再燃。義頼白列紹半社選奪試市新醸。成雲川法住下経乗康参日迎力食超施変挙朝民。聞葉性経好玲学体返渡定状容無急大代職翌味。 --- corpora/french.txt --- At hâs putànt tîmèam. No èssé mêis mèî, tê vïde éuismod sapërét eœs. Né qûï tàle cotidîequê, congue definïebàs çompléctîtur te qùo. Ea méà énim docendi praésent, no probo oblïqûe çœncèptam mea. Ut tàmqùam principes qûi, sàdipscing cônsectétuer çu vim. Vix në sïmul nemôrê torquâtos, stët facete përîculâ eà cum. Façëte offîçïïs atomœrùm éu prî, at tritàni delenit prô. Qùi volutpàt tîncîdunt et, îus èlît iusto œratîœ ân. Côngûê plâcerat similique sea èt, sîmùl albuçïus în pro. Ei prôbo concéptam rêprimiqùè qui, éu labôre possit his, të ius bruté vérïtus. Vivèndo tràctatos per cu, quîs œportéat ràtiônîbus êx vel. Usù lobœrtîs rectêqùè an. Pro îd primâ apêriri tractâtos, dicït salutatus mei an. Dissêntiet reprêhendunt his at, mea môvët adipisci éu, quàndô dïctas quo ex. Cû ludûs dôlôrum advêrsârium méî, in eum nèmoré impèdit, prïncîpes urbanitas vœluptatibus sea no. Eù prô mandamus périçùla mâïéstâtis. Ad çlita indôctum mel, ûrbanitas omittàntur vis nœ. Iùs ut tamquam appareat sçrîpsêrit, àn hàs tïncidunt scrïptorém, offïçîis gubergrén nëcéssitàtibùs seâ at. Dœcéndi ëlïgëndi èi séd. Véniâm nœluissé îd mël. Ad fâllî iudico sit. Facer qûodsi in sit, méi facétë similique at, his vëniam dicûnt menandri tè. Qùândo ëfficïàntur ëî mèà. Ea méis postéa graèço mei, cu stet cîbœ tamquam ius, îd pro porro assuéverit. Eum irîùre probatus id. Sed éû laùdém aetérno, âgàm omnêsque nêcessïtatibus çû ëœs, vix ex probœ mëliore. Dolœrê philosophia ët cum. No nam nèmœre nonumes. Alïi verear quî te, ridêns cœpiosaè detraxit an ius. Ad omnës ëleîfênd his, nonumés laborâmus usu et. Pertinax reprîmiqùé eà mel, êx mél quot fâbulas èpîçuri. Eros ludus învîdùnt èum nè, mùtât modus vis et. Sea ât dôctùs dispùtàtiôni, pro ad brute simul tràctâtœs, est cëtèro intéllégàm ïd. Adhuç mundï quî èi, éu veniam aperiam ïùs. Lùciliûs volùtpat mél in, legeré opœrtèàt sea ne, mêl illud rèqûê labîtur ùt. Ad altêrum vulputate nâm, séd ëripuit lâborês nô. Pri choro dôlorum cu, ut mea îûdîco cetèro cônvêniré. Muçiûs optiôn rèfôrmîdans ad ést, ât mél dœming qualîsqué, nec ôdio molëstîe vïtupératœribus ne. Solét fuïssét êx mêî, èï nobîs fâçilisis élaborarët ést, ut mël tantas âdvérsarium. Ne unum vœcibus prœdessêt vim, in hïs hàrum traçtatos corrûmpit. Utinam latine maiorum id duœ, eligéndi vitùperâtà disputationi no est. Të élit apériàm séd, pertïnacia omîttàntur et èst. Stet vïdît lobortis has tê, ëi nàm commùné iràcùndiâ phïlosœphîa. Vis summô êvértitur id, nàtùm fàcer percîpitur ne séa. Eàm promptâ éxpëtendâ nê, hàrum tibîqué sèâ ut. Meîs facîlisi an quî, cû latine àccusatà assuèverit mei. Doctus habémùs ne vél, mèa ét vitàé nostrud appareat, at duis çommodo hïs. In êam quôd malorûm façilïs. Ex vis essé modus çôrrumpit, çum èâ rêpudiandâé signiferumqué, nam nœ réqùè inânï dëlicata. Vis id œmnïs mâzim, in sït sàpèrét debîtis, qûâestio prodësset tè vîm. An sôléât àdipiscing meî. Sea àn dêtracto repùdiare, id dolorèm placeràt vîtûpêràtoribus sëd. Hàs cœrporâ çœncéptâm no. --- corpora/georgian.txt --- ლორემ იფსუმ დოლორ სით ამეთ, ფერრი ცოფიოსაე სედ ეუ, მოლესთიე ფერფეთუა ეუ ვის. მალორუმ ვირთუთე ინ ყუი, ყუო ეა ორნათუს ვითუფერათა. ევერთი ინერმის ან ესთ. აუთემ ნულლამ დისსენთიას ად ეუმ. თემფორ ანიმალ რეფრიმიყუე ინ ჰას, უსუ ფრიმის ელეცთრამ თე, აუთემ აუდიამ ეამ უთ. ათ მელიორე მოლესთიე დელიცათისსიმი ფრო, ვივენდუმ ინვენირე ეოს ნო. ჰის ეთ ცეთერო დისფუთათიონი, ჰის იდ ლეგერე ლაორეეთ დისფუთანდო, ყუი ეა თათიონ მუნერე ფოსთეა. იუს ეფიცურეი ფაცილისის ომითთანთურ ცუ, ერანთ თრაცთათოს ვის ეი. ურბანითას ინცორრუფთე სით ან. ნე ომნეს სემფერ ყუო. ეი ეამ მოვეთ ვენიამ არგუმენთუმ, ვერეარ თორყუათოს ელოყუენთიამ ფრი თე. ათ ირაცუნდია გუბერგრენ ფრო, ელით სფლენდიდე ად უსუ. დიცით ლაორეეთ ეხ ეოს, ეამ ათ ირიურე ფეთენთიუმ იმფერდიეთ, ეიუს ფრიმის რეფორმიდანს ვიმ თე. სუმო ნოვუმ მეი ნე. ან ეამ ალიენუმ რეცთეყუე მოლესთიაე. მეი ნოვუმ სიმულ ეუ, დიცთა ფუთენთ ჰას ეთ. ყუი მალის ლეგერე ეთ. ჰის ცუ ინანი უბიყუე გრაეცე. ინიმიცუს ცონსეცთეთუერ ფერ ეხ, უთ ჯუსთო ფოსსე ფერ. ეა ჰას ინვიდუნთ სცრიფსერით, მეა ფაცერ ფოსსით ეთ. ფრო ათ თორყუათოს ადვერსარიუმ, ვიმ ცუ ნოვუმ ალიყუანდო. მეი ლაუდემ ყუაესთიო ინცორრუფთე ან. ალიყუიფ რეფორმიდანს ველ თე, ნო ვის ნიჰილ გრაეცი დომინგ, იდ ფოსსით თიმეამ ფერფეთუა ველ. ჰარუმ აეთერნო ფერსეყუერის ეხ ნეც. ცორრუმფით დეფინითიონეს თე ყუი, მუნერე დელიცათისსიმი ეთ ცუმ. მელ ეთ სოლეთ თანთას ინციდერინთ. ინ ლობორთის ოცურრერეთ ველ, ნო თალე სუმო მუთათ ფერ. ელეცთრამ სიმილიყუე ფრი ან. ეა დიამ აცცუსამუს ფრი. ინ ანიმალ ვულფუთათე ნეც. უთ ფერრი ფოსთეა ვის. მელ ინ იუდიცო ყუაეყუე მინიმუმ, ად ფუგით დეცორე ლეგიმუს დუო. იუსთო ფერსეცუთი ეთ იუს, ველ თაციმათეს თინციდუნთ მედიოცრითათემ უთ. ვივენდო დელიცათა ცოთიდიეყუე ფერ ცუ. ყუემ ასსუევერით ნეგლეგენთურ ვიმ ეა, მაზიმ რეცუსაბო ნეცესსითათიბუს ფერ ეხ, ეა მეა მეის მუნერე. ნო დუო დიცთა ვენიამ ინერმის. დიცამ სალუთათუს იდ უსუ, ნეც ნო დენიყუე ელაბორარეთ აფფელლანთურ. ნეც ომნესყუე ცოთიდიეყუე ცომფლეცთითურ ნო. ინ ფერ რებუმ ფერთინახ, ნონუმეს ჰაბემუს ათ ეუმ. ჯუსთო ნოსთრუდ დისფუთანდო ნო ნამ. ცუ ლაუდემ ვოლუფთათიბუს იუს. ელით ცონთენთიონეს ველ ეი, ინ ნეც ვენიამ ნონუმy. თე სით ულლუმ დესერუისსე არგუმენთუმ. ან სთეთ ოფორთერე ესთ, ფერრი ფორრო დებითის ეუ ცუმ. ეროს ოფთიონ ეხ ფრო, მელ ათ ინანი ინერმის ვივენდუმ. იდ ვიმ ილლუდ ინთელლეგებათ. ეა ჰის ცეთეროს ვოლუფთათუმ დისფუთათიონი. თე ფრობათუს თემფორიბუს ინთელლეგებათ ნეც. იდ მელ ამეთ სცაევოლა. ყუოდსი ყუაესთიო სფლენდიდე ყუო იდ, ათ უსუ სალე ინთერესსეთ ცომფრეჰენსამ. იდ ეამ დიცამ დელენითი, თე მეა ფორრო ნულლა, ყუო ალიი ენიმ ფრიმა ათ. ნეც ფუთენთ ფეუგიათ ეა, თე მედიოცრემ ფერსეყუერის ვიმ. --- corpora/greek.txt --- Λορεμ ιπσθμ δολορ σιτ αμετ, ιλλθμ φορενσιβθσ εα σιτ. Ηαβεο περιcθλα εφφιcιαντθρ cθ vιμ. Περπετθα αδολεσcενσ εθμ θτ, vιμ οδιο δολορεμ ομνεσqθε αν. Εστ cοπιοσαε λιβεραvισσε νε, ιδ μει ελιτ φεθγιατ μεδιοcρεμ. Ναμ ρεqθε ιμπεδιτ πρινcιπεσ αδ, ατ ναμ εραντ μθνερε ρεγιονε. Ει προ βλανδιτ φαcιλισι αccθσαμθσ, τε εαμ σαλε παρτεμ απεριαμ, εα πριμα ανιμαλ vιμ. Εοσ ετ διcο ομνισ jθστο, εξ ηασ ελιτ μελιθσ vιvενδο. Σεδ ιγνοτα cοντεντιονεσ εθ, νε ιλλθδ ποσσε εστ. Εξ μελ cλιτα ομνιθμ vολθτπατ, μεα ταcιματεσ ελαβοραρετ αδ. Εξερcι εξπετενδα ει μεα, εα ηασ περσιθσ cοτιδιεqθε. Πθρτο δεσερθντ εvερτιτθρ cθμ cθ. Cλιτα ιθδιcο qθιδαμ νεc ιδ. Μελ νθλλαμ cονcεπταμ ει, ατ προ αδιπισcι ρεπθδιαρε cονστιτθτο. Γραεcε δεβιτισ γλοριατθρ νεc ιδ. Δθο ετιαμ ρεφερρεντθρ τε. Εοσ ιν οπορτερε σπλενδιδε. Εραντ δομινγ cομπρεηενσαμ εθ σεδ, ιμπετθσ νθσqθαμ ιντερπρεταρισ ετ ηασ, περ αβηορρεαντ μοδερατιθσ νε. Προ πθρτο vιρισ δολορε τε, οπτιον vερτερεμ αδολεσcενσ ιθσ νο. Νο cθμ σθασ δεβιτισ τραcτατοσ, πλαcερατ φαcιλισισ cθ μελ, cασε ιλλθμ θρβανιτασ ετ ιθσ. Απεριρι σcριβεντθρ vελ ιν, νεc αθγθε λαβιτθρ εα. Cθ πριμα φθισσετ τινcιδθντ περ, vιμ cθ ινανι ελαβοραρετ. Ατ δθο νισλ ηομερο. Νο διcιτ εσσεντ ελειφενδ εθμ, ετ διcτα ιντερπρεταρισ ηισ. Προδεσσετ μνεσαρcηθμ μεδιοcριτατεμ σεα εα, γραεcε φαβθλασ πρι ει. Vιμ αδ vιδε πηιλοσοπηια. Εστ νε ερατ ριδενσ, προ cθ πθτεντ σεντεντιαε. Ατqθι φαcιλισ ιντελλεγατ αδ ηισ, qθο σθμμο vολθμθσ περσεqθερισ εξ. Μει ιμπεδιτ τηεοπηραστθσ cθ. Ατ αδμοδθμ δενιqθε ιθσ, αν σαεπε προπριαε ιντελλεγατ δθο, ηισ εθ αccθσατα πετεντιθμ. Ιδ σιτ μθνερε ινcορρθπτε. Ποστθλαντ ινcιδεριντ νεc αδ, λαθδεμ cονσθλατθ ιμπερδιετ vιμ τε, vιvενδθμ qθαλισqθε vολθπταρια θτ ναμ. Εθ vερι ιντερεσσετ vισ. Μοδο βρθτε ιισqθε θτ vισ. Μελ ιδ δεβετ vιτθπερατα ιντερπρεταρισ, μει εροσ qθιδαμ cομπλεcτιτθρ νε, ατ vιταε μαιορθμ cονσεcτετθερ νεc. Ιν δολορθμ φαcιλισισ εοσ, εξ ενιμ λαβοραμθσ ηισ, δοcτθσ απειριαν σεντεντιαε qθο εθ. Σονετ δελιcατισσιμι εοσ νο, σονετ vιταε νο σεα. Εξ σεδ φαcιλισι cορρθμπιτ. Πριμα τηεοπηραστθσ εα ιθσ. Ατ vελ ατqθι vιδισσε ινvιδθντ. Εαμ cαθσαε οπτιον ελιγενδι αν. Ετ εριπθιτ νομινατι ελαβοραρετ εαμ, τιμεαμ λεγιμθσ πατριοqθε δθο αδ, ετ δθο σενσιβθσ τεμποριβθσ περσεqθερισ. Αν vιμ οδιο ταλε, σεδ τε ιδqθε τεμποριβθσ. Ηινc γραεcι ασσθεvεριτ μει εθ, vελ ιν περσιθσ ινερμισ περτιναξ, αθτεμ τολλιτ μολεστιαε δθο ατ. Σεντεντιαε τεμποριβθσ ει σεδ, qθι νο μινιμ δολορ qθανδο. Θτ ηισ cονσθλ φθισσετ, vολθμθσ cονσθλατθ σcριβεντθρ vισ αδ. Ειρμοδ ομνιθμ σενσιβθσ ηισ νε, εαμ περσιθσ αντιοπαμ περιcθλισ εα, vισ cασε σολθμ ιντελλεγατ ατ. Ει τοτα ρεπριμιqθε δελιcατισσιμι vιξ, εξπετενδα vθλπθτατε τινcιδθντ νεc αδ, ιλλθμ σcριπτα περ θτ. Απεριαμ εριπθιτ πρι ει, ετ εοσ πθταντ εqθιδεμ vθλπθτατε. Νεc διcθντ λατινε δεσερθισσε εθ, cθ εαμ μοδθσ qθοδσι ινvιδθντ. Νο μελ μοδθσ cετεροσ νεcεσσιτατιβθσ, πριμα σονετ απειριαν εθμ εξ. Ελιγενδι τηεοπηραστθσ νε qθι, διcατ τεμπορ λαορεετ μελ εα, εα σcριπτα δοcενδι vολθπτθα σιτ. Νο σαλε λθδθσ αππελλαντθρ. --- corpora/hebrew.txt --- זאת ולחבר מדריכים את. עוד הגרפים ייִדיש גם, או שמו הרוח חינוך אספרנטו, תנך ספרדית תיקונים ביולוגיה ב. שתי גם אחרים קלאסיים בויקיפדיה, או שתי עסקים תרומה חבריכם. כלל ראשי בחירות לעריכה של, ב מוגש יכול המזנון כתב. החול בחירות בדף על, בה הטבע בקלות האטמוספירה צעד. רבה מדריכים סוציולוגיה או. גם בקלות מיזמים מועמדים קרן, גם אחר מושגי ומדעים רב־לשוני. ב מפתח זכויות התפתחות מדע, תורת רביעי גם זכר. היום לציין או כתב, שאלות והנדסה בה אנא, את דפים עיצוב כתב. אם שנורו רב־לשוני בקר, על הטבע לחיבור סדר, או כלל מוסיקה הסביבה. ובמתן והנדסה על תנך, כלים בקרבת מונחים קרן אל, חפש נבחרים אירועים פוליטיקה או. על כדי ערכים לחיבור שינויים. שער בה ברית כלשהו אנגלית. ננקטת וקשקש רבה של, או החלל מיתולוגיה שער, תנך או רוסית באגים שימושיים. זאת בה תיבת יסוד לערוך, גרמנית קישורים האנציקלופדיה מה אחר, ב נפלו העזרה אנא. והוא התפתחות ויקיפדיה בה אתה. תיבת שאלות טבלאות עזה דת. אל מתן מדעי ניווט ביולי. או רבה אירועים אינטרנט האטמוספירה, פיסול אודות ב כלל. או ברית דרכה מתן. כלל קהילה ומהימנה על, צ'ט אל הבהרה בקלות הספרות. אחד את החלל סטטיסטיקה, כלשהו טכניים עוד אם, היא אל מונחונים האטמוספירה. אל ציור עסקים בעברית זאת. תנך או בידור קודמות. אל בקר אחרות פולנית. ביולי ספינות שמו את, בקר שונה ומהימנה ופיתוחה אם. פיסול ערכים המשפט אחר בה. או מדעי תורת ויקימדיה תנך. עזה אל זקוק ביוטכנולוגיה, על כדור רוסית לחשבון תנך. זכר דת מיזמי ספורט בהשחתה, מה דפים מושגי אדריכלות אחר. אחר היום בגרסה את. על מדעי מדריכים מתן, רביעי לערכים מה סדר. זכר גם זכויות אקטואליה אתנולוגיה. צ'ט הטבע יכול מושגי של, אל לוח שתפו הראשי. על הסביבה מיוחדים שכל, דת שמו יכול ואמנות. מיזם לעריכת קרימינולוגיה את רבה, רבה ב הגולשות רב־לשוני. את כיצד גרמנית למאמרים רבה. שכל ב ביוני התפתחות תאולוגיה. על עזרה ותשובות כתב, בהבנה בויקיפדיה כדי בה, קרן בקרבת תקשורת או. שאלות קישורים אתה ב, בה רבה מיזם לימודים. קלאסיים טכנולוגיה מדע על. שמו לחשבון הקנאים סוציולוגיה גם. ניווט משחקים מדע אם. שנתי ספורט בקר גם, החברה אחרונים שימושיים קרן בה. דפים בארגז שמו או, דת עוד לערך אנציקלופדיה, כדי ארכיאולוגיה ביוטכנולוגיה מה. מפתח שמות מועמדים כלל אם. מתוך ציור לעריכת זאת של, הטבע בארגז ומהימנה או כתב. ביולי משפטית רומנית דת כתב, גם לוח פנאי התפתחות. --- corpora/hindi.txt --- कैसे संसाध ज्यादा अंग्रेजी गटकउसि हमेहो। प्रसारन सक्षम पसंद ढांचा देते उदेशीत स्वतंत्रता बाटते उद्योग उपलब्धता दिये हिंदी एछित उदेशीत अनुवाद विवरन सकती सारांश सुस्पश्ट अंग्रेजी मुक्त सारांश प्रसारन हार्डवेर एकएस हैं। लेकिन आधुनिक वर्णित बारे जानते संपादक यन्त्रालय चुनने मानसिक विकसित जिसे करता। दारी बातसमय प्रेरना दस्तावेज जागरुक है।अभी अनुवाद दौरान होगा समाजो प्रसारन सम्पर्क बीसबतेबोध विषय मेमत बनाकर जागरुक लचकनहि विभाजनक्षमता उसीएक् स्वतंत्र प्रौध्योगिकी बारे तरीके आंतरजाल अमितकुमार विकेन्द्रित खरिदे हीकम यधपि करता। हमेहो। केन्द्रिय व्याख्यान मानसिक बिन्दुओमे अर्थपुर्ण सकती बनाकर सके। उपेक्ष प्रोत्साहित माहितीवानीज्य चुनने संस्था शारिरिक सोफ़्टवेर तरीके देते चिदंश मुखय दिनांक व्यवहार माध्यम दोषसके बातसमय पसंद वर्णन उन्हे वेबजाल हुएआदि प्रोत्साहित लेने हमारी ऎसाजीस प्राधिकरन पढने पहोच हुआआदी हुएआदि ध्वनि वर्तमान केन्द्रिय पुष्टिकर्ता एवम् पहेला सदस्य आशाआपस स्थापित ७हल बाटते भारतीय हमेहो। क्षमता। मेमत समस्याओ व्याख्या प्रति जाता वैश्विक सुस्पश्ट विभाग वहहर लक्षण सुना प्रमान मेंभटृ विश्लेषण किया चिदंश वैश्विक वास्तविक मुश्किले लेने बनाना खरिदने पत्रिका कम्प्युटर सुचना नीचे विनिमय सोफ़तवेर निरपेक्ष हुआआदी व्याख्यान सहयोग अधिक उपलब्ध संपुर्ण अंग्रेजी बनाने दिये पहोच। जैसी किएलोग स्वतंत्र बीसबतेबोध दारी विकास खयालात विभाजन असक्षम प्राथमिक वर्णन बारे संस्था सभिसमज मुश्किले देते दौरान भोगोलिक केन्द्रित लेकिन कैसे कीने विशेष वर्णित अधिकांश ध्येय काम उद्योग निर्देश प्रतिबध हमारि सकते प्रव्रुति पुष्टिकर्ता विवरन भाषए पत्रिका विकेन्द्रियकरण लक्षण पासपाई प्रसारन रखते उनका आवश्यक आंतरजाल अर्थपुर्ण खरिदे बढाता चाहे सभिसमज दस्तावेज स्वतंत्रता सहयोग कीने प्रेरना मुश्किले लगती प्रेरना लाभान्वित करके(विशेष हिंदी वर्णन विनिमय प्रेरना जानकारी हीकम देने बलवान संपादक परिभाषित मुक्त २४भि ऎसाजीस तकनीकी अधिकांश कराना आपके परस्पर वातावरण सार्वजनिक समस्याए संपुर्ण विषय लेकिन विवरन तरहथा। हमेहो। अधिक लगती पहेला करेसाथ वैश्विक प्रति उपलब्धता विभाजनक्षमता कोहम वर्ष विश्व सम्पर्क बीसबतेबोध जिम्मे प्रव्रुति प्राधिकरन लेकिन रचना सामूहिक ढांचामात्रुभाषा बाजार उशकी एसेएवं समस्याओ लाभान्वित हैं। मुक्त डाले। किके सहायता विस्तरणक्षमता हीकम ब्रौशर ज्यादा मर्यादित प्राण वेबजाल सभीकुछ एकत्रित सेऔर विकास प्रति विषय उपेक्ष नयेलिए वर्तमान कम्प्युटर पुर्व अथवा देखने अपनि अधिकार परस्पर वास्तविक सादगि मानव असक्षम दिनांक सिद्धांत प्राधिकरन बढाता होभर प्राण लक्ष्य बिन्दुओ सुस्पश्ट सकती विनिमय कम्प्युटर वार्तालाप थातक खरिदे बहुत जानते सामूहिक निर्माता विभाजनक्षमता चाहे सारांश निरपेक्ष सीमित अथवा भाषाओ गुजरना प्राथमिक अधिकांश अन्तरराष्ट्रीयकरन उनके बनाने अत्यंत कार्यलय रचना उन्हे विषय हमारी दिशामे वेबजाल कार्यकर्ता देने हुआआदी सभिसमज बनाकर गएआप नयेलिए दर्शाता समस्याओ संदेश बाटते ब्रौशर विभाजन विकसित खण्ड मुक्त खयालात उद्योग काम विवरण अधिकार हमेहो। प्रोत्साहित पडता वातावरण समस्याओ विकेन्द्रित लिए। समजते बहुत आधुनिक अर्थपुर्ण हिंदी आवश्यक प्रदान स्वतंत्रता विकास सके। होभर चुनने मानसिक वातावरण विज्ञान किया पत्रिका मुश्किल समस्याए हिंदी सुचना आपको विज्ञान समस्याओ बेंगलूर एछित डाले। कार्यकर्ता अमितकुमार जानते सुविधा कार्यकर्ता करके(विशेष होभर एकत्रित व्याख्या देने कार्य सादगि जिम्मे वास्तव व्रुद्धि भाषा २४भि उपेक्ष तकनिकल करके(विशेष उन्हे करती परिभाषित माहितीवानीज्य बढाता खयालात एसलिये सुना जानते विवरन दोषसके सोफ़्टवेर सिद्धांत करके दोषसके आवश्यकत व्याख्यान अपनि सुचना जिम्मे आवश्यकत आंतरकार्यक्षमता बाधा चिदंश --- corpora/l33t.txt --- 5IM1LaR c0mm4ndz h4D 1T. 1n70 kl1k be 4r3. 45 n33d 1nDeX3D, 4u70m471(4lly y3r. N33d miL4R 83 70p, d@ w1ll w1+hOUT INt3r35+3d n0w. +o joo m0r3 4v41|4b|3, Up c|1ck d0(um3n7 d159l4y3d, 73h, 4|| t0 w1tH (4(h3d 51m1l4r. W17h @n33 f00l! 93t y0, 94g3 WI5h h4D da. |235u|7z 4v41|4b|3 k@n d@. @R3 da 250m \/\/3b 7|24n5|4735. @$ KWIckLy, 1nd1c473z0r w3b. Vve +H@T wh1(h c@ch3d be. 0vvn3r z3aRc|-| 1T f4q. 7he p@93 p1cz! 4z. K@n |4unch f34tUr3 f337u|23, 0f. M1t3 b33n d0 0u7, @$ iTz f0|2 r35ul7. 4u70m471(4lly. Be @R3 f00l! De@l. |-|@v3, d@ 4r3 vv3b p|20g|24m, 5|\|4p5)-(07. D0 5peNDInG KWIckLy, 4nd. D0 fOr h7m| Wh3|\| L0Ok1NG, 3nT3R Ph13LD, Up y3r. 0n d1z b4(| d33z, CaN p1>< 5(0u7s |247h3r d0, p4g3, INt3r35+3d m4y 1T. TH4T n33d w17h +h3 83, be @R3 F1ND p49E$ pr3f3|23nc35, d3n MOr3 M4NY qu3ry 17. Why 7h15 r35u|7 0f, @$ 7he p@93 p4g3, |235u|7z, 83 t3H p4g3 f|20n7. 0f73n @8ou+ g3t 83, 47 1iNx v3|2510n pdf, p1x 83 qu3ry |\|0t 717|3z. 70 joo P4935 r35u|7z, 4rE U5Ed m0r3 g00g13 iN, d@ kl1x 73rm5 z3aRcH, c4n. 0t|-|3r k0pYr1t3d t3H d@, 717|3z r35ul7. kvv3r33, 17 f0r. 73x7 l1nx iz 937, +hO53 m1-|-3 0t|-|3r pdf 1+, LINk mIGH+ 94g3s CaN y4. Be pdf d33z l1nx c|1ck, @R n0n-3N9l1sh p4|271cu|4|2 f4q. D1z HAV3 v3r510|\| (ra\/\/1z !=. 0R w3b wh1(h d0wn|04d, @$ 93t M155In9 tHUm841|_, 4r3 0f 4cc355 4lvvAyz tHUm841|_. Da NUMbER 1nd1c473z0r 0u7, 17 h4D 5IM1LaR d0wn|04d. WI5h 7h4n 93t u5, @R3 @$ wIlL NUMbER f1|\|d. Up 7he 4|50 m47(h z3aRc|-|, 7h3y (4(h3d k0pYr1t3d c@N b3, 7h47 tR4nz|_4t10n @nD 1n. 5O f0r p4g3 h4v3 0f73n. +3's yOU, d0(um3n7 1+ fOr. IN 937 f|20n7 0t|-|3r zp33k3rz, 0u7 Th@t 4b0u7 c0mpu73|2, 83. 0n d0n't 74|<3z v3|2510n H45, 7h3 De@l. 0p710n 17. B33n w17h p@g3z y3r b3, alz0 |21gh7 3n4b|3 kUm 0n. N0n 1+ Th@t phr0|\/|, 937 15 |4unch 53rv3s |_@n9U493. 1F u\/ c|1ck 0vvn3r, d@t, f00l! 0p710n BuT y@. IN @nD De@l. 51m1l4r. D4 8Ut 94g3s |_@n9U493, No+ be 94g3 w4nN@, 1iNx w1+hOUT 1F w1t. IN +hO53 c0mpu73|2, iTz, +H@T v3ry c0nT3nT, 73h 0n. 1T z3aRcH k4cH3d k0pYr1t3d 4nd, |1nk 4lvvAyz 1T fOr, 45 BuT 51m1l4r r3l473d. Iz 4r3 73rm5 534|2ch KeYW0rD5, n33d n0n-3N9l1sh 17 +HE, 83 pHinD 5It35 4r3. PHor d159l4y3d, @$ p1x, l3tz f4m1|14r 1nDeX3D, why |7. N33d 34513r d3n y4, M155In9 c0nT3nT, 1T f0r. (0py d33z 5O c4n, 4r3 v3r510n tR@nz|_4t3d 4u70m471c4||y 47. 4nd vv1t 0f73n |_@n9U493 d0. 1F @R3 p@g3 wIlL, pdf b3 HELp m47(h. F4q h7m| l1nx r35u|7z 0R. W1|| l3tz M@Y 1F, |1nk yOU, r33zUltz 0f d1z, LINk 3n4b|3d, g3t +o. 17 kl1x Wh0 |23p|4c3d z33. 0f HAV3 p1cz! 3ng|335h 8Ut, 1F vve p@g3 vv0rx pr3f3|23nc35. D0nT f00l! pR0dUc+ m4y 1+. L1|\|k tR4nz|_4t10n 4u70m471c4||y u5 4r3, w17h p1cz! k0nt@kt 4z pdf, vv1t L0Ok1NG 0t|-|3r N0+ Up. P1cz! 1nF0, r3zUltz y4 w3b, != u\/ 1nt0 p|20g|24m,. (0py 3N9l1sh t0 c@N. 45 (4(]-[3z d0(um3n7 1PH, 1n p1x |-|@v3 |3tz0rz 4u70m471(4lly. != M4NY 3nT3R 73h, 0u7 F1lt3r f0|2m4771ng 17. --- csv/.checkoutinfo --- Mon Jun 3 14:53:31 CEST 2024 URL: https://github.com/mzaks/mojo-csv Path: csv --- csv/__init__.mojo --- from .csv_builder import CsvBuilder from .csv_table import CsvTable --- csv/csv_builder.mojo --- from memory.memory import memcpy from buffer import Buffer, Dim from .string_utils import find_indices, contains_any_of, string_from_pointer alias BufferType = Buffer[DType.int8] alias CR_CHAR = "\r" alias CR = ord(CR_CHAR) alias LF_CHAR = "\n" alias LF = ord(LF_CHAR) alias COMMA_CHAR = "," alias COMMA = ord(COMMA_CHAR) alias QUOTE_CHAR = '"' alias QUOTE = UInt8(ord(QUOTE_CHAR)) struct CsvBuilder: var _buffer: DTypePointer[DType.uint8] var _capacity: Int var num_bytes: Int var _column_count: Int var _elements_count: Int var _finished: Bool fn __init__(inout self, column_count: Int): self._capacity = 1024 self._buffer = DTypePointer[DType.uint8].alloc(self._capacity) self._column_count = column_count self._elements_count = 0 self._finished = False self.num_bytes = 0 fn __init__(inout self, *coulmn_names: StringLiteral): self._capacity = 1024 self._buffer = DTypePointer[DType.uint8].alloc(self._capacity) self._elements_count = 0 self._finished = False self.num_bytes = 0 var column_name_list: VariadicList[StringLiteral] = coulmn_names self._column_count = len(column_name_list) for i in range(len(column_name_list)): self.push(coulmn_names[i]) fn __del__(owned self): if not self._finished: self._buffer.free() fn push[S: Stringable](inout self, value: S, consider_escaping: Bool = False): self.push(str(value), consider_escaping) fn push_empty(inout self): self.push("", False) fn fill_up_row(inout self): var num_empty = self._column_count - (self._elements_count % self._column_count) if num_empty < self._column_count: for _ in range(num_empty): self.push_empty() fn push(inout self, s: String, consider_escaping: Bool = True): if consider_escaping and contains_any_of( s, CR_CHAR, LF_CHAR, COMMA_CHAR, QUOTE_CHAR ): return self.push(QUOTE_CHAR + escape_quotes_in(s) + QUOTE_CHAR, False) var size = len(s) self._extend_buffer_if_needed(size + 2) if self._elements_count > 0: if self._elements_count % self._column_count == 0: self._buffer.offset(self.num_bytes).store(CR) self._buffer.offset(self.num_bytes + 1).store(LF) self.num_bytes += 2 else: self._buffer.offset(self.num_bytes).store(COMMA) self.num_bytes += 1 memcpy(self._buffer.offset(self.num_bytes), s.unsafe_ptr(), size) s._strref_keepalive() self.num_bytes += size self._elements_count += 1 @always_inline fn _extend_buffer_if_needed(inout self, size: Int): if self.num_bytes + size < self._capacity: return var new_size = self._capacity while new_size < self.num_bytes + size: new_size *= 2 var p = DTypePointer[DType.uint8].alloc(new_size) memcpy(p, self._buffer, self.num_bytes) self._buffer.free() self._capacity = new_size self._buffer = p fn finish(owned self) -> String: self._finished = True self.fill_up_row() self._buffer.offset(self.num_bytes).store(CR) self._buffer.offset(self.num_bytes + 1).store(LF) self.num_bytes += 3 return string_from_pointer(self._buffer, self.num_bytes) fn escape_quotes_in(s: String) -> String: var indices = find_indices(s, QUOTE_CHAR) var i_size = len(indices) if i_size == 0: return s var size = len(s._buffer) var p_current = DTypePointer(s.unsafe_ptr()) var p_result = DTypePointer[DType.uint8].alloc(size + i_size) var first_index = int(indices[0]) memcpy(p_result, p_current, first_index) p_result.offset(first_index).store(QUOTE) var offset = first_index + 1 for i in range(1, len(indices)): var c_offset = int(indices[i - 1]) var length = int(indices[i]) - c_offset memcpy(p_result.offset(offset), p_current.offset(c_offset), length) offset += length p_result.offset(offset).store(QUOTE) offset += 1 var last_index = int(indices[i_size - 1]) memcpy(p_result.offset(offset), p_current.offset(last_index), size - last_index) return string_from_pointer(p_result, size + i_size) --- csv/csv_table.mojo --- from .string_utils import find_indices, string_from_pointer from algorithm.functional import vectorize from sys.info import simdwidthof from sys.intrinsics import compressed_store from math import iota from memory import stack_allocation alias QUOTE = ord('"') alias COMMA = ord(",") alias LF = ord("\n") alias CR = ord("\r") alias simd_width_u8 = simdwidthof[DType.uint8]() struct CsvTable[sep: Int = COMMA]: var _inner_string: String var _starts: List[Int] var _ends: List[Int] var column_count: Int fn __init__(inout self, owned s: String, with_simd: Bool = True): self._inner_string = s self._starts = List[Int](capacity=10) self._ends = List[Int](capacity=10) self.column_count = -1 if with_simd: self._simd_parse() else: self._parse() @always_inline fn _parse(inout self): var length = len(self._inner_string) var offset = 0 var in_double_quotes = False self._starts.append(offset) while offset < length: var c = self._inner_string._buffer[offset] if c == QUOTE: in_double_quotes = not in_double_quotes offset += 1 elif not in_double_quotes and c == sep: self._ends.append(offset) offset += 1 self._starts.append(offset) elif not in_double_quotes and c == LF: self._ends.append(offset) if self.column_count == -1: self.column_count = len(self._ends) offset += 1 self._starts.append(offset) elif ( not in_double_quotes and c == CR and length > offset + 1 and self._inner_string._buffer[offset + 1] == LF ): self._ends.append(offset) if self.column_count == -1: self.column_count = len(self._ends) offset += 2 self._starts.append(offset) else: offset += 1 if self._inner_string[length - 1] == "\n": _ = self._starts.pop() else: self._ends.append(length) @always_inline fn _simd_parse(inout self): var p = DTypePointer(self._inner_string.unsafe_ptr()) var string_byte_length = len(self._inner_string) var in_quotes = False var last_chunk__ends_on_cr = False self._starts.append(0) @always_inline @parameter fn find_indicies[simd_width: Int](offset: Int): var chars = p.load[width=simd_width](offset) var quotes = chars == QUOTE var separators = chars == sep var lfs = chars == LF var all_bits = quotes | separators | lfs var crs = chars == CR var offsets = iota[DType.uint8, simd_width]() var sp: DTypePointer[DType.uint8] = stack_allocation[ simd_width, UInt8, simd_width ]() compressed_store(offsets, sp, all_bits) var all_len = all_bits.reduce_bit_count() for i in range(all_len): var index = int(sp.load(i)) if quotes[index]: in_quotes = not in_quotes continue if in_quotes: continue var current_offset = index + offset var rs_compensation: Int if index > 0: rs_compensation = int(lfs[index] & crs[index - 1]) else: rs_compensation = int(lfs[index] & last_chunk__ends_on_cr) self._ends.append(current_offset - rs_compensation) self._starts.append(current_offset + 1) if self.column_count == -1 and lfs[index]: self.column_count = len(self._ends) last_chunk__ends_on_cr = crs[simd_width - 1] vectorize[find_indicies, simd_width_u8](string_byte_length) if self._inner_string[string_byte_length - 1] == "\n": _ = self._starts.pop() else: self._ends.append(string_byte_length) fn get(self, row: Int, column: Int) -> String: if column >= self.column_count: return "" var index = self.column_count * row + column if index >= len(self._ends): return "" if ( self._inner_string[self._starts[index]] == '"' and self._inner_string[self._ends[index] - 1] == '"' ): var start = self._starts[index] + 1 var length = (self._ends[index] - 1) - start var p1 = Pointer[UInt8].alloc(length + 1) memcpy(p1, DTypePointer(self._inner_string.unsafe_ptr()).offset(start), length) var _inner_string = string_from_pointer(p1, length + 1) var quote_indices = find_indices(_inner_string, '"') var quotes_count = len(quote_indices) if quotes_count == 0 or quotes_count & 1 == 1: return _inner_string var p = DTypePointer(_inner_string.unsafe_ptr()) var length2 = length - (quotes_count >> 1) var p2 = Pointer[UInt8].alloc(length2 + 1) var offset2 = 0 memcpy(p2, p, int(quote_indices[0])) offset2 += int(quote_indices[0]) for i in range(2, quotes_count, 2): var start = int(quote_indices[i - 1]) var size = int(quote_indices[i]) - start memcpy(p2.offset(offset2), p.offset(start), size) offset2 += size var last = int(quote_indices[quotes_count - 1]) memcpy(p2.offset(offset2), p.offset(last), length - last) _inner_string._strref_keepalive() return string_from_pointer(p2, length - (quotes_count >> 1) + 1) return self._inner_string[self._starts[index] : self._ends[index]] fn row_count(self) -> Int: return len(self._starts) // self.column_count --- csv/string_utils.mojo --- from algorithm.functional import vectorize from sys.info import simdwidthof from sys.intrinsics import compressed_store # from math import iota, reduce_bit_count, any_true from math import iota from memory import stack_allocation from time import now from collections.vector import InlinedFixedVector alias simd_width_i8 = simdwidthof[DType.int8]() fn vectorize_and_exit[simd_width: Int, workgroup_function: fn[i: Int](Int) capturing -> Bool](size: Int): var loops = size // simd_width for i in range(loops): if workgroup_function[simd_width](i * simd_width): return var rest = size & (simd_width - 1) @parameter if simd_width >= 64: if rest >= 32: if workgroup_function[32](size - rest): return rest -= 32 @parameter if simd_width >= 32: if rest >= 16: if workgroup_function[16](size - rest): return rest -= 16 @parameter if simd_width >= 16: if rest >= 8: if workgroup_function[8](size - rest): return rest -= 8 @parameter if simd_width >= 8: if rest >= 4: if workgroup_function[4](size - rest): return rest -= 4 @parameter if simd_width >= 4: if rest >= 2: if workgroup_function[2](size - rest): return rest -= 2 if rest == 1: _= workgroup_function[1](size - rest) fn find_indices(s: String, c: String) -> List[UInt64]: var size = len(s) var result = List[UInt64]() var char = UInt8(ord(c)) var p = DTypePointer(s.unsafe_ptr()) @parameter fn find[simd_width: Int](offset: Int): @parameter if simd_width == 1: if p.offset(offset).load() == char: return result.append(offset) else: var chunk = p.load[width=simd_width](offset) var occurrence = chunk == char var offsets = iota[DType.uint64, simd_width]() + offset var occurrence_count = occurrence.reduce_bit_count() var current_len = len(result) result.reserve(current_len + occurrence_count) result.resize(current_len + occurrence_count, 0) compressed_store(offsets, DTypePointer[DType.uint64](result.data).offset(current_len), occurrence) vectorize[find, simd_width_i8](size) return result fn occurrence_count(s: String, *c: String) -> Int: var size = len(s) var result = 0 var chars = InlinedFixedVector[UInt8](len(c)) for i in range(len(c)): chars.append(UInt8(ord(c[i]))) var p = DTypePointer(s.unsafe_ptr()) @parameter fn find[simd_width: Int](offset: Int): @parameter if simd_width == 1: for i in range(len(chars)): var char = chars[i] if p.offset(offset).load() == char: result += 1 return else: var chunk = p.load[width=simd_width](offset) var occurrence = SIMD[DType.bool, simd_width](False) for i in range(len(chars)): occurrence |= chunk == chars[i] var occurrence_count = occurrence.reduce_bit_count() result += occurrence_count vectorize[find, simd_width_i8](size) return result fn contains_any_of(s: String, *c: String) -> Bool: var size = len(s) # var c_list: VariadicListMem[String] = c var chars = InlinedFixedVector[UInt8](len(c)) for i in range(len(c)): chars.append(UInt8(ord(c[i]))) var p = DTypePointer(s.unsafe_ptr()) var flag = False @parameter fn find[simd_width: Int](i: Int) -> Bool: var chunk = p.load[width=simd_width]() p = p.offset(simd_width) for i in range(len(chars)): var occurrence = chunk == chars[i] if occurrence.reduce_or(): flag = True return flag return False vectorize_and_exit[simd_width_i8, find](size) return flag @always_inline fn string_from_pointer(p: DTypePointer[DType.uint8], length: Int) -> String: # Since Mojo 0.5.0 the pointer needs to provide a 0 terminated byte string p.store(length - 1, 0) return String(p, length) fn print_v(v: List[UInt64]): print("(" + str(len(v)) + ")[") for i in range(len(v)): var end = ", " if i < len(v) - 1 else "]\n" print(v[i], end=end) --- generic_dict/__init__.mojo --- from .dict import Dict from .keys_container import Keyable, KeysBuilder from .multi_dict import MultiDict from .sparse_array import SparseArray --- generic_dict/ahasher.mojo --- # This code is based on https://github.com/tkaitchuck/aHash from bit import rotate_bits_left, byte_swap from .keys_container import KeyRef alias U256 = SIMD[DType.uint64, 4] alias U128 = SIMD[DType.uint64, 2] alias MULTIPLE = 6364136223846793005 alias ROT = 23 @always_inline fn folded_multiply(s: UInt64, by: UInt64) -> UInt64: var b1 = s * byte_swap(by) var b2 = byte_swap(s) * (~by) return b1 ^ byte_swap(b2) @always_inline fn read_small(data: DTypePointer[DType.uint8], length: Int) -> U128: if length >= 2: if length >= 4: # len 4-8 var a = data.bitcast[DType.uint32]().load().cast[DType.uint64]() var b = data.offset(length - 4).bitcast[DType.uint32]().load().cast[DType.uint64]() return U128(a, b) else: var a = data.bitcast[DType.uint16]().load().cast[DType.uint64]() var b = data.offset(length - 1).load().cast[DType.uint64]() return U128(a, b) else: if length > 0: var a = data.load().cast[DType.uint64]() return U128(a, a) else: return U128(0, 0) struct AHasher: var buffer: UInt64 var pad: UInt64 var extra_keys: U128 fn __init__(inout self, key: U256): var pi_key = key ^ U256(0x243f_6a88_85a3_08d3, 0x1319_8a2e_0370_7344, 0xa409_3822_299f_31d0, 0x082e_fa98_ec4e_6c89,) self.buffer = pi_key[0] self.pad = pi_key[1] self.extra_keys = U128(pi_key[2], pi_key[3]) @always_inline fn update(inout self, new_data: UInt64): self.buffer = folded_multiply(new_data ^ self.buffer, MULTIPLE) @always_inline fn large_update(inout self, new_data: U128): var combined = folded_multiply( new_data[0] ^ self.extra_keys[0], new_data[1] ^ self.extra_keys[1] ) self.buffer = rotate_bits_left[ROT]((self.buffer + self.pad) ^ combined) @always_inline fn short_finish(self) -> UInt64: return self.buffer + self.pad @always_inline fn finish(self) -> UInt64: var rot = self.buffer & 63 var folded = folded_multiply(self.buffer, self.pad) return (folded << rot) | (folded >> (64 - rot)) @always_inline fn write(inout self, data: DTypePointer[DType.uint8], length: Int): self.buffer = (self.buffer + length) * MULTIPLE if length > 8: if length > 16: var tail = data.offset(length - 16).bitcast[DType.uint64]().load[width=2]() self.large_update(tail) var offset = 0 while length - offset > 16: var block = data.offset(offset).bitcast[DType.uint64]().load[width=2]() self.large_update(block) offset += 16 else: var a = data.bitcast[DType.uint64]().load() var b = data.offset(length - 8).bitcast[DType.uint64]().load() self.large_update(U128(a, b)) else: var value = read_small(data, length) self.large_update(value) @always_inline fn ahash(s: KeyRef) -> UInt64: var length = s.size var b = s.pointer var hasher = AHasher(U256(0, 0, 0, 0)) if length > 8: hasher.write(b, length) else: var value = read_small(b, length) hasher.buffer = folded_multiply(value[0] ^ hasher.buffer, value[1] ^ hasher.extra_keys[1]) hasher.pad = hasher.pad + length return hasher.finish() --- generic_dict/dict.mojo --- from bit import pop_count, bit_width from memory import memset_zero, memcpy from .key_eq import eq from .keys_container import KeysContainer, KeyRef, Keyable from .ahasher import ahash from .single_key_builder import SingleKeyBuilder struct Dict[ V: CollectionElement, hash: fn(KeyRef) -> UInt64 = ahash, KeyCountType: DType = DType.uint32, KeyOffsetType: DType = DType.uint32, destructive: Bool = True, caching_hashes: Bool = True, ](Sized): var keys: KeysContainer[KeyOffsetType] var key_hashes: DTypePointer[KeyCountType] var values: List[V] var slot_to_index: DTypePointer[KeyCountType] var deleted_mask: DTypePointer[DType.uint8] var count: Int var capacity: Int var key_builder: SingleKeyBuilder fn __init__(inout self, capacity: Int = 16): constrained[ KeyCountType == DType.uint8 or KeyCountType == DType.uint16 or KeyCountType == DType.uint32 or KeyCountType == DType.uint64, "KeyCountType needs to be an unsigned integer" ]() self.count = 0 if capacity <= 8: self.capacity = 8 else: var icapacity = Int64(capacity) self.capacity = capacity if pop_count(icapacity) == 1 else 1 << int(bit_width(icapacity)) self.keys = KeysContainer[KeyOffsetType](capacity) self.key_builder = SingleKeyBuilder() @parameter if caching_hashes: self.key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) else: self.key_hashes = DTypePointer[KeyCountType].alloc(0) self.values = List[V](capacity=capacity) self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memset_zero(self.slot_to_index, self.capacity) @parameter if destructive: self.deleted_mask = DTypePointer[DType.uint8].alloc(self.capacity >> 3) memset_zero(self.deleted_mask, self.capacity >> 3) else: self.deleted_mask = DTypePointer[DType.uint8].alloc(0) fn __copyinit__(inout self, existing: Self): self.count = existing.count self.capacity = existing.capacity self.keys = existing.keys self.key_builder = self.key_builder @parameter if caching_hashes: self.key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) memcpy(self.key_hashes, existing.key_hashes, self.capacity) else: self.key_hashes = DTypePointer[KeyCountType].alloc(0) self.values = existing.values self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memcpy(self.slot_to_index, existing.slot_to_index, self.capacity) @parameter if destructive: self.deleted_mask = DTypePointer[DType.uint8].alloc(self.capacity >> 3) memcpy(self.deleted_mask, existing.deleted_mask, self.capacity >> 3) else: self.deleted_mask = DTypePointer[DType.uint8].alloc(0) fn __moveinit__(inout self, owned existing: Self): self.count = existing.count self.capacity = existing.capacity self.keys = existing.keys^ self.key_builder = existing.key_builder^ self.key_hashes = existing.key_hashes self.values = existing.values^ self.slot_to_index = existing.slot_to_index self.deleted_mask = existing.deleted_mask fn __del__(owned self): self.slot_to_index.free() self.deleted_mask.free() self.key_hashes.free() fn __len__(self) -> Int: return self.count @always_inline fn __contains__[T: Keyable](inout self, key: T) -> Bool: try: self.key_builder.reset() key.accept(self.key_builder) var key_ref = self.key_builder.get_key() return self._find_key_index(key_ref) != 0 except: return False fn put[T: Keyable](inout self, key: T, value: V) raises -> Bool: """Return True when value is inserted and not updated.""" if self.count / self.capacity >= 0.87: self._rehash() key.accept(self.keys) self.keys.end_key() var key_ref = self.keys.get_last() var key_hash = hash(key_ref).cast[KeyCountType]() var modulo_mask = self.capacity - 1 var slot = int(key_hash & modulo_mask) while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: @parameter if caching_hashes: self.key_hashes.store(slot, key_hash) self.values.append(value) self.count += 1 self.slot_to_index.store(slot, SIMD[KeyCountType, 1](self.keys.count)) return True @parameter if caching_hashes: var other_key_hash = self.key_hashes[slot] if other_key_hash == key_hash: var other_key = self.keys[key_index - 1] if eq(other_key, key_ref): self.values[key_index - 1] = value # replace value self.keys.drop_last() @parameter if destructive: if self._is_deleted(key_index - 1): self.count += 1 self._not_deleted(key_index - 1) return True return False else: var other_key = self.keys[key_index - 1] if eq(other_key, key_ref): self.values[key_index - 1] = value # replace value self.keys.drop_last() @parameter if destructive: if self._is_deleted(key_index - 1): self.count += 1 self._not_deleted(key_index - 1) return True return False slot = (slot + 1) & modulo_mask @always_inline fn _is_deleted(self, index: Int) -> Bool: var offset = index >> 3 var bit_index = index & 7 return self.deleted_mask.offset(offset).load() & (1 << bit_index) != 0 @always_inline fn _deleted(self, index: Int): var offset = index >> 3 var bit_index = index & 7 var p = self.deleted_mask.offset(offset) var mask = p.load() p.store(mask | (1 << bit_index)) @always_inline fn _not_deleted(self, index: Int): var offset = index >> 3 var bit_index = index & 7 var p = self.deleted_mask.offset(offset) var mask = p.load() p.store(mask & ~(1 << bit_index)) @always_inline fn _rehash(inout self) raises: var old_slot_to_index = self.slot_to_index var old_capacity = self.capacity self.capacity <<= 1 var mask_capacity = self.capacity >> 3 self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memset_zero(self.slot_to_index, self.capacity) var key_hashes = self.key_hashes @parameter if caching_hashes: key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) @parameter if destructive: var deleted_mask = DTypePointer[DType.uint8].alloc(mask_capacity) memset_zero(deleted_mask, mask_capacity) memcpy(deleted_mask, self.deleted_mask, old_capacity >> 3) self.deleted_mask.free() self.deleted_mask = deleted_mask var modulo_mask = self.capacity - 1 for i in range(old_capacity): if old_slot_to_index[i] == 0: continue var key_hash = SIMD[KeyCountType, 1](0) @parameter if caching_hashes: key_hash = self.key_hashes[i] else: key_hash = hash(self.keys[int(old_slot_to_index[i] - 1)]).cast[KeyCountType]() var slot = int(key_hash & modulo_mask) while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: self.slot_to_index.store(slot, old_slot_to_index[i]) break else: slot = (slot + 1) & modulo_mask @parameter if caching_hashes: key_hashes[slot] = key_hash @parameter if caching_hashes: self.key_hashes.free() self.key_hashes = key_hashes old_slot_to_index.free() @always_inline fn get[T: Keyable](inout self, key: T, default: V) raises -> V: self.key_builder.reset() key.accept(self.key_builder) var key_ref = self.key_builder.get_key() var key_index = self._find_key_index(key_ref) if key_index == 0: return default @parameter if destructive: if self._is_deleted(key_index - 1): return default return self.values[key_index - 1] fn delete[T: Keyable](inout self, key: T) raises: @parameter if not destructive: return self.key_builder.reset() key.accept(self.key_builder) var key_ref = self.key_builder.get_key() var key_index = self._find_key_index(key_ref) if key_index == 0: return if not self._is_deleted(key_index - 1): self.count -= 1 self._deleted(key_index - 1) fn clear(inout self): self.values.clear() self.keys.clear() memset_zero(self.slot_to_index, self.capacity) @parameter if destructive: memset_zero(self.deleted_mask, self.capacity >> 3) self.count = 0 fn _find_key_index(self, key_ref: KeyRef) raises -> Int: var key_hash = hash(key_ref).cast[KeyCountType]() var modulo_mask = self.capacity - 1 var slot = int(key_hash & modulo_mask) while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: return key_index @parameter if caching_hashes: var other_key_hash = self.key_hashes[slot] if key_hash == other_key_hash: var other_key = self.keys[key_index - 1] if eq(other_key, key_ref): return key_index else: var other_key = self.keys[key_index - 1] if eq(other_key, key_ref): return key_index slot = (slot + 1) & modulo_mask fn debug(self) raises: print("Dict count:", self.count, "and capacity:", self.capacity) print("KeyMap:") for i in range(self.capacity): var end = ", " if i < self.capacity - 1 else "\n" print(self.slot_to_index.load(i), end=end) print("Keys:") self.keys.print_keys() @parameter if caching_hashes: print("KeyHashes:") for i in range(self.capacity): var end = ", " if i < self.capacity - 1 else "\n" if self.slot_to_index.load(i) > 0: print(self.key_hashes.load(i), end=end) else: print(0, end=end) --- generic_dict/key_eq.mojo --- from .keys_container import KeyRef @always_inline fn eq(a: KeyRef, b: KeyRef) -> Bool: var l = a.size if l != b.size: return False var p1 = a.pointer var p2 = b.pointer var offset = 0 alias step = 16 while l - offset >= step: var unequal = p1.load[width=step](offset) != p2.load[width=step](offset) if unequal.reduce_or(): return False offset += step while l - offset > 0: if p1.load(offset) != p2.load(offset): return False offset += 1 return True --- generic_dict/keys_container.mojo --- from collections.vector import InlinedFixedVector trait Keyable: fn accept[T: KeysBuilder](self, inout keys_builder: T): ... alias lookup = String("0123456789abcdef") @value struct KeyRef(Stringable): var pointer: DTypePointer[DType.uint8] var size: Int fn __str__(self) -> String: var result = String("(") + str(self.size) + (")") for i in range(self.size): result += lookup[int(self.pointer.load(i) >> 4)] result += lookup[int(self.pointer.load(i) & 0xf)] return result trait KeysBuilder: fn add[T: DType, size: Int](inout self, value: SIMD[T, size]): ... fn add_buffer[T: DType](inout self, pointer: DTypePointer[T], size: Int): ... struct KeysContainer[KeyEndType: DType = DType.uint32](Sized, KeysBuilder): var keys: DTypePointer[DType.uint8] var allocated_bytes: Int var keys_end: DTypePointer[KeyEndType] var count: Int var capacity: Int var key_size: Int fn __init__(inout self, capacity: Int): constrained[ KeyEndType == DType.uint8 or KeyEndType == DType.uint16 or KeyEndType == DType.uint32 or KeyEndType == DType.uint64, "KeyEndType needs to be an unsigned integer" ]() self.allocated_bytes = capacity << 3 self.keys = DTypePointer[DType.uint8].alloc(self.allocated_bytes) self.keys_end = DTypePointer[KeyEndType].alloc(capacity) self.count = 0 self.capacity = capacity self.key_size = 0 fn __copyinit__(inout self, existing: Self): self.allocated_bytes = existing.allocated_bytes self.count = existing.count self.capacity = existing.capacity self.key_size = existing.key_size self.keys = DTypePointer[DType.uint8].alloc(self.allocated_bytes) memcpy(self.keys, existing.keys, self.allocated_bytes) self.keys_end = DTypePointer[KeyEndType].alloc(self.allocated_bytes) memcpy(self.keys_end, existing.keys_end, self.capacity) fn __moveinit__(inout self, owned existing: Self): self.allocated_bytes = existing.allocated_bytes self.count = existing.count self.capacity = existing.capacity self.key_size = existing.key_size self.keys = existing.keys self.keys_end = existing.keys_end fn __del__(owned self): self.keys.free() self.keys_end.free() @always_inline fn add[T: DType, size: Int](inout self, value: SIMD[T, size]): var prev_end = 0 if self.count == 0 else self.keys_end[self.count - 1] var key_length = size * T.sizeof() var old_key_size = self.key_size self.key_size += key_length var new_end = prev_end + self.key_size var needs_realocation = False while new_end > self.allocated_bytes: self.allocated_bytes += self.allocated_bytes >> 1 needs_realocation = True if needs_realocation: var keys = DTypePointer[DType.uint8].alloc(self.allocated_bytes) memcpy(keys, self.keys, int(prev_end) + old_key_size) self.keys.free() self.keys = keys self.keys.store(prev_end + old_key_size, bitcast[DType.uint8, size * T.sizeof()](value)) @always_inline fn add_buffer[T: DType](inout self, pointer: DTypePointer[T], size: Int): var prev_end = 0 if self.count == 0 else self.keys_end[self.count - 1] var key_length = size * T.sizeof() var old_key_size = self.key_size self.key_size += key_length var new_end = prev_end + self.key_size var needs_realocation = False while new_end > self.allocated_bytes: self.allocated_bytes += self.allocated_bytes >> 1 needs_realocation = True if needs_realocation: var keys = DTypePointer[DType.uint8].alloc(self.allocated_bytes) memcpy(keys, self.keys, int(prev_end) + old_key_size) self.keys.free() self.keys = keys memcpy(self.keys.offset(prev_end + old_key_size), pointer.bitcast[DType.uint8](), key_length) @always_inline fn end_key(inout self): var prev_end = 0 if self.count == 0 else self.keys_end[self.count - 1] var count = self.count + 1 if count >= self.capacity: var new_capacity = self.capacity + (self.capacity >> 1) var keys_end = DTypePointer[KeyEndType].alloc(self.allocated_bytes) memcpy(keys_end, self.keys_end, self.capacity) self.keys_end.free() self.keys_end = keys_end self.capacity = new_capacity self.keys_end.store(self.count, prev_end + self.key_size) self.count = count self.key_size = 0 @always_inline fn drop_last(inout self): self.count -= 1 @always_inline fn get_last(self) raises -> KeyRef: return self.get(self.count - 1) @always_inline fn get(self, index: Int) raises -> KeyRef: if index < 0 or index >= self.count: raise "Invalid index" var start = 0 if index == 0 else int(self.keys_end[index - 1]) var length = int(self.keys_end[index]) - start return KeyRef(self.keys.offset(start), length) @always_inline fn clear(inout self): self.count = 0 @always_inline fn __getitem__(self, index: Int) raises -> KeyRef: return self.get(index) @always_inline fn __len__(self) -> Int: return self.count fn print_keys(self) raises: print("(" + str(self.count) + ")[") for i in range(self.count): var end = ", " if i < self.capacity - 1 else "]\n" print(self[i], end=end) --- generic_dict/multi_dict.mojo --- from .ahasher import ahash from .key_eq import eq from .keys_container import KeyRef, KeysContainer from .single_key_builder import SingleKeyBuilder from .sparse_array import SparseArray from bit import pop_count, bit_width @value struct _ValuesIter[ list_mutability: Bool, //, T: CollectionElement, NextKeyCountType: DType, list_lifetime: AnyLifetime[list_mutability].type, ]: alias list_type = List[T] var current_index: Optional[Int] var next_index: Optional[Int] var values: Reference[Self.list_type, list_lifetime] var next_values: Reference[Self.list_type, list_lifetime] var next_next_values_index: Reference[SparseArray[NextKeyCountType], list_lifetime] var first: Bool fn __iter__(self) -> Self: return self fn __next__( inout self, ) -> Reference[T, list_lifetime]: var element = self.values[].__get_ref(self.current_index.or_else(0)) if self.first else self.next_values[].__get_ref(self.current_index.or_else(0)) self.first = False self.current_index = self.next_index var next = self.next_next_values_index[].get(self.current_index.or_else(-1)) self.next_index = Optional(int(next.or_else(-1))) if next else None return element[] fn __len__(self) -> Int: if not self.current_index: return 0 if not self.next_index: return 1 return 2 struct MultiDict[ V: CollectionElement, hash: fn(KeyRef) -> UInt64 = ahash, KeyCountType: DType = DType.uint32, NextKeyCountType: DType = DType.uint16, KeyOffsetType: DType = DType.uint32, caching_hashes: Bool = True, ](Sized): var keys: KeysContainer[KeyOffsetType] var key_hashes: DTypePointer[KeyCountType] var values: List[V] var next_values_index: SparseArray[NextKeyCountType] var next_values: List[V] var next_next_values_index: SparseArray[NextKeyCountType] var slot_to_index: DTypePointer[KeyCountType] var count: Int var capacity: Int var key_builder: SingleKeyBuilder fn __init__(inout self, capacity: Int = 16): constrained[ KeyCountType == DType.uint8 or KeyCountType == DType.uint16 or KeyCountType == DType.uint32 or KeyCountType == DType.uint64, "KeyCountType needs to be an unsigned integer" ]() constrained[ NextKeyCountType == DType.uint8 or NextKeyCountType == DType.uint16 or NextKeyCountType == DType.uint32 or NextKeyCountType == DType.uint64, "NextKeyCountType needs to be an unsigned integer" ]() self.count = 0 if capacity <= 8: self.capacity = 8 else: var icapacity = Int64(capacity) self.capacity = capacity if pop_count(icapacity) == 1 else 1 << int(bit_width(icapacity)) self.keys = KeysContainer[KeyOffsetType](capacity) self.key_builder = SingleKeyBuilder() @parameter if caching_hashes: self.key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) else: self.key_hashes = DTypePointer[KeyCountType].alloc(0) self.values = List[V](capacity=capacity) self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memset_zero(self.slot_to_index, self.capacity) #TODO: Think about having an optional here or an empty List self.next_values = List[V]() self.next_values_index = SparseArray[NextKeyCountType]() self.next_next_values_index = SparseArray[NextKeyCountType]() fn __copyinit__(inout self, existing: Self): self.count = existing.count self.capacity = existing.capacity self.keys = existing.keys self.key_builder = self.key_builder @parameter if caching_hashes: self.key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) memcpy(self.key_hashes, existing.key_hashes, self.capacity) else: self.key_hashes = DTypePointer[KeyCountType].alloc(0) self.values = existing.values self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memcpy(self.slot_to_index, existing.slot_to_index, self.capacity) self.next_values = existing.next_values self.next_values_index = existing.next_values_index self.next_next_values_index = existing.next_next_values_index fn __moveinit__(inout self, owned existing: Self): self.count = existing.count self.capacity = existing.capacity self.keys = existing.keys^ self.key_builder = existing.key_builder^ self.key_hashes = existing.key_hashes self.values = existing.values^ self.slot_to_index = existing.slot_to_index self.next_values = existing.next_values^ self.next_values_index = existing.next_values_index^ self.next_next_values_index = existing.next_next_values_index^ fn __del__(owned self): self.slot_to_index.free() self.key_hashes.free() fn __len__(self) -> Int: return self.count fn put[T: Keyable](inout self, key: T, value: V) raises: if self.count / self.capacity >= 0.87: self._rehash() key.accept(self.keys) self.keys.end_key() var key_ref = self.keys.get_last() var key_hash = hash(key_ref).cast[KeyCountType]() var modulo_mask = self.capacity - 1 var slot = int(key_hash & modulo_mask) while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: @parameter if caching_hashes: self.key_hashes.store(slot, key_hash) self.values.append(value) self.count += 1 self.slot_to_index.store(slot, SIMD[KeyCountType, 1](self.keys.count)) return @parameter if caching_hashes: var other_key_hash = self.key_hashes[slot] if other_key_hash == key_hash: var other_key = self.keys[key_index - 1] if eq(other_key, key_ref): self._add_next(value, key_index) return else: var other_key = self.keys[key_index - 1] if eq(other_key, key_ref): self._add_next(value, key_index) return slot = (slot + 1) & modulo_mask @always_inline fn _add_next(inout self, value: V, key_index: Int): self.next_values.append(value) var next_index = self.next_values_index.get(key_index - 1) if not next_index: self.next_values_index[key_index - 1] = len(self.next_values) - 1 else: var index = int(next_index.value()) var next_next_index = self.next_next_values_index.get(index) while next_next_index: index = int(next_next_index.value()) next_next_index = self.next_next_values_index.get(index) self.next_next_values_index[index] = len(self.next_values) - 1 self.keys.drop_last() @always_inline fn _rehash(inout self) raises: var old_slot_to_index = self.slot_to_index var old_capacity = self.capacity self.capacity <<= 1 self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memset_zero(self.slot_to_index, self.capacity) var key_hashes = self.key_hashes @parameter if caching_hashes: key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) var modulo_mask = self.capacity - 1 for i in range(old_capacity): if old_slot_to_index[i] == 0: continue var key_hash = SIMD[KeyCountType, 1](0) @parameter if caching_hashes: key_hash = self.key_hashes[i] else: key_hash = hash(self.keys[int(old_slot_to_index[i] - 1)]).cast[KeyCountType]() var slot = int(key_hash & modulo_mask) while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: self.slot_to_index.store(slot, old_slot_to_index[i]) break else: slot = (slot + 1) & modulo_mask @parameter if caching_hashes: key_hashes[slot] = key_hash @parameter if caching_hashes: self.key_hashes.free() self.key_hashes = key_hashes old_slot_to_index.free() @always_inline fn get[T: Keyable](inout self, key: T) raises -> List[V]: var result = List[V]() self.key_builder.reset() key.accept(self.key_builder) var key_ref = self.key_builder.get_key() var key_index = self._find_key_index(key_ref) if key_index == 0: return result result.append(self.values[key_index - 1]) var next_index = self.next_values_index.get(key_index - 1) if not next_index: return result var index = int(next_index.value()) result.append(self.next_values[index]) var next_next_index = self.next_next_values_index.get(index) while next_next_index: index = int(next_next_index.value()) result.append(self.next_values[index]) next_next_index = self.next_next_values_index.get(index) return result fn get_itter[T: Keyable](inout self, key: T) raises -> _ValuesIter[V, NextKeyCountType, __lifetime_of(self)]: self.key_builder.reset() key.accept(self.key_builder) var key_ref = self.key_builder.get_key() var key_index = self._find_key_index(key_ref) if key_index == 0: return _ValuesIter(None, None, self.values, self.next_values, self.next_next_values_index, True) var next_index = self.next_values_index.get(key_index - 1) if not next_index: return _ValuesIter(Optional(key_index - 1), None, self.values, self.next_values, self.next_next_values_index, True) return _ValuesIter(Optional(key_index - 1), Optional(int(next_index.value())), self.values, self.next_values, self.next_next_values_index, True) fn _find_key_index(self, key_ref: KeyRef) raises -> Int: var key_hash = hash(key_ref).cast[KeyCountType]() var modulo_mask = self.capacity - 1 var slot = int(key_hash & modulo_mask) while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: return key_index @parameter if caching_hashes: var other_key_hash = self.key_hashes[slot] if key_hash == other_key_hash: var other_key = self.keys[key_index - 1] if eq(other_key, key_ref): return key_index else: var other_key = self.keys[key_index - 1] if eq(other_key, key_ref): return key_index slot = (slot + 1) & modulo_mask fn debug(self) raises: print("Dict count:", self.count, "and capacity:", self.capacity) print("KeyMap:") for i in range(self.capacity): var end = ", " if i < self.capacity - 1 else "" print(self.slot_to_index.load(i), end=end) print("Keys:") self.keys.print_keys() @parameter if caching_hashes: print("KeyHashes:") for i in range(self.capacity): var end = ", " if i < self.capacity - 1 else "" if self.slot_to_index.load(i) > 0: print(self.key_hashes.load(i), end=end) else: print(0, end=end) print("Next Values:") self.next_values_index.debug() print("Next Next Values:") self.next_next_values_index.debug() --- generic_dict/single_key_builder.mojo --- from .keys_container import KeysBuilder, KeyRef struct SingleKeyBuilder(KeysBuilder): var key: DTypePointer[DType.uint8] var allocated_bytes: Int var key_size: Int fn __init__(inout self, bytes: Int = 64): self.allocated_bytes = bytes self.key = DTypePointer[DType.uint8].alloc(self.allocated_bytes) self.key_size = 0 fn __copyinit__(inout self, existing: Self): self.allocated_bytes = existing.allocated_bytes self.key = DTypePointer[DType.uint8].alloc(self.allocated_bytes) memcpy(self.key, existing.key, self.allocated_bytes) self.key_size = existing.key_size fn __moveinit__(inout self, owned existing: Self): self.allocated_bytes = existing.allocated_bytes self.key = existing.key self.key_size = existing.key_size fn __del__(owned self): self.key.free() @always_inline fn add[T: DType, size: Int](inout self, value: SIMD[T, size]): var key_length = size * T.sizeof() var old_key_size = self.key_size self.key_size += key_length var needs_realocation = False while self.key_size > self.allocated_bytes: self.allocated_bytes += self.allocated_bytes >> 1 needs_realocation = True if needs_realocation: var key = DTypePointer[DType.uint8].alloc(self.allocated_bytes) memcpy(key, self.key, old_key_size) self.key.free() self.key = key self.key.store(old_key_size, bitcast[DType.uint8, size * T.sizeof()](value)) @always_inline fn add_buffer[T: DType](inout self, pointer: DTypePointer[T], size: Int): var key_length = size * T.sizeof() var old_key_size = self.key_size self.key_size += key_length var needs_realocation = False while self.key_size > self.allocated_bytes: self.allocated_bytes += self.allocated_bytes >> 1 needs_realocation = True if needs_realocation: var key = DTypePointer[DType.uint8].alloc(self.allocated_bytes) memcpy(key, self.key, old_key_size) self.key.free() self.key = key memcpy(self.key.offset(old_key_size), pointer.bitcast[DType.uint8](), key_length) @always_inline fn get_key(self) -> KeyRef: return KeyRef(self.key, self.key_size) @always_inline fn reset(inout self): self.key_size = 0 --- generic_dict/sparse_array.mojo --- from collections import Optional from bit import pop_count from tensor import Tensor, TensorSpec struct SparseArray[T: DType]: var mask: DTypePointer[DType.uint8] var values: DTypePointer[T] var mask_size: Int var values_count: Int var values_capacity: Int fn __init__(inout self, capacity: Int = 8): var _capacity = capacity if capacity >= 8 else 8 self.mask_size = -(-_capacity >> 3) self.mask = DTypePointer[DType.uint8].alloc(self.mask_size) memset_zero(self.mask, self.mask_size) self.values_capacity = 4 self.values_count = 0 self.values = DTypePointer[T].alloc(self.values_capacity) fn __copyinit__(inout self, existing: Self): self.mask_size = existing.mask_size self.values_count = existing.values_count self.values_capacity = existing.values_capacity self.mask = DTypePointer[DType.uint8].alloc(self.mask_size) memcpy(self.mask, existing.mask, self.mask_size) self.values = DTypePointer[T].alloc(self.values_capacity) memcpy(self.values, existing.values, self.values_count) fn __moveinit__(inout self, owned existing: Self): self.mask_size = existing.mask_size self.values_count = existing.values_count self.values_capacity = existing.values_capacity self.mask = existing.mask self.values = existing.values fn __del__(owned self): self.mask.free() self.values.free() @always_inline fn __contains__(self, index: Int) -> Bool: var offset = index >> 3 var bit_index = index & 7 return self.contains(offset, bit_index) @always_inline fn contains(self, offset: Int, bit_index: Int) -> Bool: return offset < self.mask_size and self.mask.load(offset) & (1 << bit_index) != 0 fn __setitem__(inout self, index: Int, value: SIMD[T, 1]): var offset = index >> 3 var bit_index = index & 7 if self.mask_size <= offset: var mask = DTypePointer[DType.uint8].alloc(offset + 1) memcpy(mask, self.mask, self.mask_size) memset_zero(mask.offset(self.mask_size), offset + 1 - self.mask_size) self.mask.free() self.mask = mask self.mask_size = offset + 1 var p = self.mask.offset(offset) var mask = p.load() if self.contains(offset, bit_index): self.values.store(self._value_index(offset, bit_index), value) return p.store(mask | (1 << bit_index)) if self.values_capacity <= self.values_count + 1: var values_capacity = self.values_capacity + (self.values_capacity >> 1) var values = DTypePointer[T].alloc(values_capacity) memcpy(values, self.values, self.values_count) self.values.free() self.values = values self.values_capacity = values_capacity var value_index = self._value_index(offset, bit_index) for i in range(self.values_count, value_index, -1): self.values.store(i, self.values.load(i-1)) self.values.store(value_index, value) self.values_count += 1 fn get(self, index: Int) -> Optional[SIMD[T, 1]]: var offset = index >> 3 var bit_index = index & 7 if not self.contains(offset, bit_index): return None return self.values.load(self._value_index(offset, bit_index)) @always_inline fn _value_index(self, offset: Int, bit_index: Int) -> Int: if not self.contains(offset, bit_index): return -1 alias width = 32 var cursor = 0 var result = 0 while cursor + width < offset: var v = self.mask.load[width=width](cursor) result += int(pop_count(v).cast[DType.int16]().reduce_add[1]()) cursor += width while cursor <= offset: var v = self.mask.load(cursor) result += int(pop_count(v)) cursor += 1 result -= int(pop_count(self.mask.load(offset) >> (bit_index + 1))) return result - 1 fn dense_values_list(self) -> List[Scalar[T]]: var data = UnsafePointer[Scalar[T]].alloc(self.values_count) memcpy(data, self.values, self.values_count) return List[Scalar[T]](unsafe_pointer=data, size=self.values_count, capacity=self.values_count) fn debug(self): print("(" + str(self.mask_size) + ")[") for i in range(self.mask_size): var end = ", " if i < self.mask_size - 1 else "" print(self.mask.load(i), end=end) print("]") print("(" + str(self.values_count) + ")[") for i in range(self.values_count): var end = ", " if i < self.mask_size - 1 else "" print(self.values.load(i), end=end) print("]") --- memory_consumption_compact_dict.mojo --- from string_dict import Dict from corpora import system_words_collection, hindi_text_to_keys fn main() raises: var corpus = system_words_collection() var dict = Dict[Int](len(corpus)) for _ in range(100): for i in range(len(corpus)): dict.put(corpus[i], i) var sum = 0 for _ in range(100): sum = 0 for i in range(len(corpus)): sum += dict.get(corpus[i], -1) print(sum) --- memory_consumption_std_lib_dict.mojo --- from collections import Dict from corpora import system_words_collection, hindi_text_to_keys fn main() raises: var corpus = system_words_collection() var dict = Dict[String, Int]() for _ in range(100): for i in range(len(corpus)): dict[corpus[i]] = i var sum = 0 for _ in range(100): sum = 0 for i in range(len(corpus)): sum += dict[corpus[i]] print(sum) --- report_i7_2_8.csv --- Corpus,Number of keys,Total bytes,Min key,Avg key,Max key,Build stdlib,Read stdlib,Delete stdlib,Read after delete stdlib,Build compact nc,Build compact,Read compact,Delete compact,Read after delete compact,Speedup build nc,Speedup build,Speedup read,Speadup delete,Speedup read after delete,Read Checksum,Read Checksum after delete Arabic,463,4223,2,9.1209503239740819,26,282161.26750000002,266846.96649999998,25982.4938,251971.11499999999,44130.014150000003,37598.3321,33078.459300000002,3796.3750749999999,33273.6777,6.3938630642836527,7.5046219270987278,8.0670917614352113,6.844027074959131,7.5726860514730543,True,True Chinese,10,4647,441,464.69999999999999,480,16025.14772063509,18314.451569610952,2830.3437250000002,16485.900081009782,6502.6824200000001,8495.0055049999992,4019.8425699999998,802.64647549999995,3991.0950549999998,2.4643903370318809,1.8864199335954508,4.5560121449261013,3.5262644406889945,4.1306708694788989,True,True English,999,4289,1,4.293293293293293,13,516880.22249999997,502126.95250000001,39695.287499999999,410971.52649999998,77203.731549999997,73065.018899999995,65741.021649999995,8142.0887400000001,67550.941399999996,6.6950160584563099,7.0742501717193145,7.6379548096055485,4.8753199292691569,6.0838756349293455,True,True French,471,2977,2,6.3205944798301488,19,341206.46399999998,246948.72200000001,21297.802361912833,242384.2065,43061.94915,37721.114300000001,33534.9614,3896.972655,33558.7333,7.9236186641588642,9.045503303172568,7.3639184806099109,5.4652172974800699,7.2226863968074753,True,True Georgien,381,5982,6,15.700787401574804,42,259902.92249999999,224538.21063674512,21832.607244233364,213897.87081594602,39817.638099999996,34050.844400000002,28084.701550000002,3465.9476549999999,27987.880349999999,6.5273314767507511,7.6327893501519153,7.995036380820828,6.2991739684058681,7.6425176948402251,True,True German,999,5644,2,5.6496496496496498,18,507176.1605,500103.71399999998,41164.0988,435041.69650000002,76674.384300000005,72348.200349999999,64904.020049999999,7966.6006150000003,66604.793550000002,6.6146753590559975,7.0102111461850631,7.7052810228817243,5.1670845306960329,6.5316874854272422,True,True Greek,452,4693,3,10.382743362831858,28,268406.69199999998,256531.18599999999,27333.841799999998,244574.5575,43754.644950000002,37785.7929,31911.987150000001,3830.38267,32000.785650000002,6.1343588162289509,7.1033759357739994,8.0387092409568108,7.1360603247507921,7.642767279996451,True,True Hebrew,376,3346,2,8.8989361702127656,25,220431.24414348463,192329.32168501677,16003.335905794691,180609.85216659011,34367.662700000001,30125.461050000002,25570.2399,3110.0909099999999,26677.436600000001,6.4139143260238232,7.3171077374593274,7.5216080270336745,5.1456167581270762,6.7701351848246967,True,True Japanese,10,4992,378,499.19999999999999,558,18134.214944105184,18792.600778070293,2486.7059549999999,16540.184582894799,7786.0123899999999,8632.5784600000006,4200.9365500000004,872.44017699999995,4230.3348150000002,2.3290760450620329,2.1006718940502034,4.4734312347731828,2.8502882152342695,3.9098996429895587,True,True l33t,487,2317,2,4.7577002053388089,14,284474.48849999998,267964.25300000003,33560.018600000003,268617.7745,42140.019650000002,37495.18535,32642.908800000001,3984.9862750000002,32958.36505,6.750696626692247,7.5869604549107805,8.2089575607918857,8.4216146014204298,8.1502154033578194,True,True S3,161,3582,8,22.248447204968944,43,109559.598,99783.478099999993,8019.4958800000004,96937.528099999996,19218.501141948658,16048.145968523408,12074.652835913561,1462.8362449864971,12026.096542032623,5.7007358269403117,6.8269317972860257,8.2638796705785733,5.4821555778952042,8.0605978640859863,True,True Words,104335,880750,1,8.4416393505472804,23,82684071.5,55425389.399999999,4880371.8799999999,54811311.600000001,10383361.395,9020746.9649999999,8160072.2599999998,1036582.8945000001,8245112.3300000001,7.9631314325451168,9.1659894486354219,6.7922669841651633,4.7081346855082611,6.6477337610753935,True,True --- report_m1.csv --- Corpus,Number of keys,Total bytes,Min key,Avg key,Max key,Build stdlib,Read stdlib,Delete stdlib,Read after delete stdlib,Build compact nc,Build compact,Read compact,Delete compact,Read after delete compact,Speedup build nc,Speedup build,Speedup read,Speadup delete,Speedup read after delete,Read Checksum,Read Checksum after delete Arabic,463,4223,2,9.1209503239740819,26,235932.5,223595.52401746725,22670.877683403218,218722.66157622033,37214.300000000003,34868.900000000001,28109.849999999999,3218.5900000000001,31558.549999999999,6.3398344184896658,6.7662730972299094,7.9543478182013514,7.0437296093641057,6.9306942675192724,True,True Chinese,10,4647,441,464.69999999999999,480,15724.874561912206,18064.8962184507,4231.6149999999998,19025.38622655475,5201.1899999999996,7042.125,3814.7350000000001,638.20950000000005,3478.0749999999998,3.0233224631117506,2.2329729395476798,4.7355573109143103,6.6304481522133409,5.4700908481141877,True,True English,999,4289,1,4.293293293293293,13,427551.5,420086.5,23105.549999999999,286848.5,62043.0,53854.050000000003,49204.099999999999,5579.9350000000004,48462.550000000003,6.8912125461373561,7.9390779337858524,8.5376320265994092,4.1408278053418179,5.9189724849394016,True,True French,471,2977,2,6.3205944798301488,19,283979.5,241187.0,12612.260450748878,191136.0681114551,39083.949999999997,27904.549999999999,25878.400000000001,2977.4000000000001,30242.049999999999,7.2658853570327464,10.176817042381979,9.3200120563867941,4.2359980018636652,6.3202087196950973,True,True Georgien,381,5982,6,15.700787401574804,42,244965.5,197522.29097255276,15711.83870835553,182804.96546900953,36506.699999999997,29836.299999999999,26632.0,2996.605,25659.75,6.7101518351425895,8.2103176332185956,7.4167276574253815,5.2432131389874632,7.124191212658328,True,True German,999,5644,2,5.6496496496496498,18,460852.5,419771.5,23377.549999999999,344666.5,61785.449999999997,60368.050000000003,47545.400000000001,5651.8900000000003,52190.25,7.4589162982546862,7.6340464865106634,8.8288562090128586,4.1362358432312023,6.6040400266333261,True,True Greek,452,4693,3,10.382743362831858,28,244522.5,221500.94654286487,24229.25,214683.0,38830.349999999999,31879.25,30672.950000000001,3340.5599999999999,28890.849999999999,6.2972005145459669,7.6702714147917552,7.2213773550592588,7.253050386761501,7.4308301763361069,True,True Hebrew,376,3346,2,8.8989361702127656,25,233578.5,168860.83752093802,12954.055595892542,151668.27673329864,29366.349999999999,23654.950000000001,21462.204182949532,2668.6300000000001,21630.732621223018,7.9539506952685644,9.874402609179052,7.867823643905508,4.8541969459582415,7.0117031812639183,True,True Hindi,450,8280,9,18.399999999999999,51,279719.5,261702.0,16873.475787181891,210054.84571925251,48077.199999999997,36368.800000000003,34604.75,3576.3200000000002,31252.849999999999,5.8181320875591753,7.6911941004377375,7.5626033998222786,4.7181112951810498,6.7211420948570302,True,True Japanese,10,4992,378,499.19999999999999,558,16569.322489095444,20352.976730129947,4614.2399999999998,24709.549999999999,6137.2650000000003,8562.8150000000005,3843.0749999999998,697.17399999999998,3811.1550000000002,2.6997893180586869,1.935032169805776,5.2960134085673447,6.6184912231379833,6.4834807295950965,True,True l33t,487,2317,2,4.7577002053388089,14,276193.0,237513.5,24396.650000000001,243392.5,34135.050000000003,29055.049999999999,27157.200000000001,2879.3049999999998,26537.799999999999,8.0911848671673265,9.5058518226607784,8.7458758634910811,8.4731037524680453,9.1715402181039885,True,True Russian,999,10636,2,10.646646646646646,37,604495.0,475855.5,39374.800000000003,414928.0,84918.649999999994,73036.600000000006,61565.75,7363.0749999999998,64405.650000000001,7.1185187235077345,8.2766037849516554,7.7292244470342686,5.3476027339121224,6.4424161544833405,True,True S3,161,3582,8,22.248447204968944,43,95685.949999999997,86654.449999999997,7334.6599999999999,79889.0,29397.849999999999,15670.69554658157,12936.078249315638,1437.7824488910567,12447.492445545658,3.2548621752951323,6.1060435840624239,6.6986646439452624,5.1013698252173887,6.4180798140261839,True,True Words,235977,2257909,1,9.5683840729565723,28,159431769.23076922,114977950.0,10390735.0,111888000.0,21706760.683760684,17649079.207920793,14882849.056603774,2961165.0,15481181.25,7.3447978513921583,9.0334326993794267,7.7255335697288627,3.5090023690000387,7.2273554706944614,True,True --- report_m1_new.csv --- Corpus,Number of keys,Total bytes,Min key,Avg key,Max key,Build stdlib,Read stdlib,Delete stdlib,Read after delete stdlib,Build compact nc,Build compact,Read compact,Delete compact,Read after delete compact,Speedup build nc,Speedup build,Speedup read,Speadup delete,Speedup read after delete,Read Checksum,Read Checksum after delete Arabic,463,4223,2,9.1209503239740819,26,77512.350000000006,61041.650000000001,6077.0900000000001,60665.75,36217.150000000001,35177.099999999999,29045.450000000001,3385.3800000000001,36741.949999999997,2.1402111982858947,2.2034889175059913,2.1015907827215625,1.7950983346035012,1.6511303836622715,True,True Chinese,10,4647,441,464.69999999999999,480,5740.8000000000002,8005.4849999999997,1132.5329999999999,7623.1450000000004,5382.9949999999999,5126.1850000000004,4430.7849999999999,869.87894017913936,4922.875,1.0664695025724527,1.1198971554869752,1.8067870591780013,1.3019432333501151,1.5485148414290431,True,True English,999,4289,1,4.293293293293293,13,121901.95,105672.3,12042.870000000001,103702.10000000001,65044.800000000003,50951.150000000001,48228.25,6271.0649999999996,58321.449999999997,1.874122912208201,2.3925259783145227,2.1910871740110829,1.9203867285700278,1.7781125126347168,True,True French,471,2977,2,6.3205944798301488,19,81442.050000000003,54487.150000000001,5469.7650000000003,52006.400000000001,34522.300000000003,27519.099999999999,30547.400000000001,3276.1149999999998,29836.650000000001,2.3591142536852989,2.9594736019709944,1.7836919017657797,1.6695888270100407,1.7430375058862171,True,True Georgien,381,5982,6,15.700787401574804,42,63962.949999999997,52573.150000000001,5155.1049999999996,52648.5,36022.5,28743.5,31056.650000000001,3157.625,29115.849999999999,1.7756388368380871,2.2253013724842137,1.6928145823841272,1.6325893670084317,1.8082419026063121,True,True German,999,5644,2,5.6496496496496498,18,124514.95,103500.25,12231.155000000001,104708.25,66339.25,53060.900000000001,52700.650000000001,5990.3900000000003,62306.199999999997,1.8769423832798831,2.3466422544660945,1.9639273898898779,2.0417961101030153,1.6805430278206663,True,True Greek,452,4693,3,10.382743362831858,28,72400.350000000006,54366.199999999997,6382.6350000000002,58440.0,38861.449999999997,31355.0,34619.099999999999,3638.8899999999999,32193.349999999999,1.8630377919506353,2.3090527826502951,1.570410553711679,1.7540060293111359,1.8152817274374988,True,True Hebrew,376,3346,2,8.8989361702127656,25,63110.25,47014.050000000003,4731.3149999999996,43050.599999999999,30170.349999999999,23344.54666629382,22286.694296287751,2655.5349999999999,23653.25,2.0917970789201981,2.7034258108392466,2.1095120422516427,1.7816805276526197,1.8200712375677761,True,True Hindi,450,8280,9,18.399999999999999,51,72564.25,59076.199999999997,5954.8900000000003,59433.400000000001,43256.699999999997,35778.050000000003,32692.049999999999,3832.1550000000002,37412.449999999997,1.6775262560481961,2.0281778911930637,1.807050949695721,1.5539272289351556,1.5885995170057026,True,True Japanese,10,4992,378,499.19999999999999,558,6018.9499999999998,7916.6400000000003,1192.5155,7461.915,5876.1800000000003,4899.4099999999999,4751.3050000000003,956.60199999999998,4724.46,1.0242963966386325,1.2285050648955689,1.6662032852026971,1.2466161475723447,1.5794217751870054,True,True l33t,487,2317,2,4.7577002053388089,14,67924.800000000003,53437.599999999999,6322.6049999999996,54617.75,35199.150000000001,28267.950000000001,26417.549999999999,3097.415,30473.0,1.9297284167373356,2.4028909064859674,2.0228068083527808,2.0412521408981359,1.7923325566895283,True,True Russian,999,10636,2,10.646646646646646,37,155766.14978969176,118214.14999999999,13390.757523271017,119861.84210526316,81256.649999999994,70636.649999999994,67257.149999999994,7817.6949999999997,71723.449999999997,1.9169649473574382,2.2051746478590331,1.7576443545407441,1.7128779676453247,1.6711667119367957,True,True S3,161,3582,8,22.248447204968944,43,27222.849999999999,20800.466086722419,2110.5573605021605,24579.299999999999,18197.410576168797,13987.306483529275,13269.252762453505,1511.4813406196954,13797.569452179918,1.4959738302355423,1.9462539147230535,1.5675687590773106,1.3963502583742444,1.7814224516272787,True,True Words,235977,2257909,1,9.5683840729565723,28,65289550.0,32252450.0,5270680.0,35955200.0,22515927.927927926,19531765.151515152,16623086.330935251,2298315.0,18200452.05479452,2.899705053639706,3.3427367927847138,1.940220327195125,2.2932800769259218,1.9755113714622474,True,True --- string_dict/__init__.mojo --- from .dict import Dict --- string_dict/ahasher.mojo --- # This code is based on https://github.com/tkaitchuck/aHash from bit import rotate_bits_left, byte_swap alias U256 = SIMD[DType.uint64, 4] alias U128 = SIMD[DType.uint64, 2] alias MULTIPLE = 6364136223846793005 alias ROT = 23 @always_inline fn folded_multiply(s: UInt64, by: UInt64) -> UInt64: var b1 = s * byte_swap(by) var b2 = byte_swap(s) * (~by) return b1 ^ byte_swap(b2) @always_inline fn read_small(data: DTypePointer[DType.uint8], length: Int) -> U128: if length >= 2: if length >= 4: # len 4-8 var a = data.bitcast[DType.uint32]().load().cast[DType.uint64]() var b = data.offset(length - 4).bitcast[DType.uint32]().load().cast[DType.uint64]() return U128(a, b) else: var a = data.bitcast[DType.uint16]().load().cast[DType.uint64]() var b = data.offset(length - 1).load().cast[DType.uint64]() return U128(a, b) else: if length > 0: var a = data.load().cast[DType.uint64]() return U128(a, a) else: return U128(0, 0) struct AHasher: var buffer: UInt64 var pad: UInt64 var extra_keys: U128 fn __init__(inout self, key: U256): var pi_key = key ^ U256(0x243f_6a88_85a3_08d3, 0x1319_8a2e_0370_7344, 0xa409_3822_299f_31d0, 0x082e_fa98_ec4e_6c89,) self.buffer = pi_key[0] self.pad = pi_key[1] self.extra_keys = U128(pi_key[2], pi_key[3]) @always_inline fn update(inout self, new_data: UInt64): self.buffer = folded_multiply(new_data ^ self.buffer, MULTIPLE) @always_inline fn large_update(inout self, new_data: U128): var combined = folded_multiply( new_data[0] ^ self.extra_keys[0], new_data[1] ^ self.extra_keys[1] ) self.buffer = rotate_bits_left[ROT]((self.buffer + self.pad) ^ combined) @always_inline fn short_finish(self) -> UInt64: return self.buffer + self.pad @always_inline fn finish(self) -> UInt64: var rot = self.buffer & 63 var folded = folded_multiply(self.buffer, self.pad) return (folded << rot) | (folded >> (64 - rot)) @always_inline fn write(inout self, data: DTypePointer[DType.uint8], length: Int): self.buffer = (self.buffer + length) * MULTIPLE if length > 8: if length > 16: var tail = data.offset(length - 16).bitcast[DType.uint64]().load[width=2]() self.large_update(tail) var offset = 0 while length - offset > 16: var block = data.offset(offset).bitcast[DType.uint64]().load[width=2]() self.large_update(block) offset += 16 else: var a = data.bitcast[DType.uint64]().load() var b = data.offset(length - 8).bitcast[DType.uint64]().load() self.large_update(U128(a, b)) else: var value = read_small(data, length) self.large_update(value) @always_inline fn ahash(s: String) -> UInt64: var length = len(s) var b = s.unsafe_ptr() var hasher = AHasher(U256(0, 0, 0, 0)) if length > 8: hasher.write(b, length) else: var value = read_small(b, length) hasher.buffer = folded_multiply(value[0] ^ hasher.buffer, value[1] ^ hasher.extra_keys[1]) hasher.pad = hasher.pad + length return hasher.finish() --- string_dict/dict.mojo --- from bit import pop_count, bit_width from memory import memset_zero, memcpy from collections import List from .string_eq import eq from .keys_container import KeysContainer from .ahasher import ahash struct Dict[ V: CollectionElement, hash: fn(String) -> UInt64 = ahash, KeyCountType: DType = DType.uint32, KeyOffsetType: DType = DType.uint32, destructive: Bool = True, caching_hashes: Bool = True, ](Sized): var keys: KeysContainer[KeyOffsetType] var key_hashes: DTypePointer[KeyCountType] var values: List[V] var slot_to_index: DTypePointer[KeyCountType] var deleted_mask: DTypePointer[DType.uint8] var count: Int var capacity: Int fn __init__(inout self, capacity: Int = 16): constrained[ KeyCountType == DType.uint8 or KeyCountType == DType.uint16 or KeyCountType == DType.uint32 or KeyCountType == DType.uint64, "KeyCountType needs to be an unsigned integer" ]() self.count = 0 if capacity <= 8: self.capacity = 8 else: var icapacity = Int64(capacity) self.capacity = capacity if pop_count(icapacity) == 1 else 1 << int(bit_width(icapacity)) self.keys = KeysContainer[KeyOffsetType](capacity) @parameter if caching_hashes: self.key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) else: self.key_hashes = DTypePointer[KeyCountType].alloc(0) self.values = List[V](capacity=capacity) self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memset_zero(self.slot_to_index, self.capacity) @parameter if destructive: self.deleted_mask = DTypePointer[DType.uint8].alloc(self.capacity >> 3) memset_zero(self.deleted_mask, self.capacity >> 3) else: self.deleted_mask = DTypePointer[DType.uint8].alloc(0) fn __copyinit__(inout self, existing: Self): self.count = existing.count self.capacity = existing.capacity self.keys = existing.keys @parameter if caching_hashes: self.key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) memcpy(self.key_hashes, existing.key_hashes, self.capacity) else: self.key_hashes = DTypePointer[KeyCountType].alloc(0) self.values = existing.values self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memcpy(self.slot_to_index, existing.slot_to_index, self.capacity) @parameter if destructive: self.deleted_mask = DTypePointer[DType.uint8].alloc(self.capacity >> 3) memcpy(self.deleted_mask, existing.deleted_mask, self.capacity >> 3) else: self.deleted_mask = DTypePointer[DType.uint8].alloc(0) fn __moveinit__(inout self, owned existing: Self): self.count = existing.count self.capacity = existing.capacity self.keys = existing.keys^ self.key_hashes = existing.key_hashes self.values = existing.values^ self.slot_to_index = existing.slot_to_index self.deleted_mask = existing.deleted_mask fn __del__(owned self): self.slot_to_index.free() self.deleted_mask.free() self.key_hashes.free() fn __len__(self) -> Int: return self.count @always_inline fn __contains__(inout self, key: String) -> Bool: return self._find_key_index(key) != 0 fn put(inout self, key: String, value: V): if self.count / self.capacity >= 0.87: self._rehash() var key_hash = hash(key).cast[KeyCountType]() var modulo_mask = self.capacity - 1 var slot = int(key_hash & modulo_mask) while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: self.keys.add(key) @parameter if caching_hashes: self.key_hashes.store(slot, key_hash) self.values.append(value) self.count += 1 self.slot_to_index.store(slot, SIMD[KeyCountType, 1](self.keys.count)) return @parameter if caching_hashes: var other_key_hash = self.key_hashes[slot] if other_key_hash == key_hash: var other_key = self.keys[key_index - 1] if eq(other_key, key): self.values[key_index - 1] = value # replace value @parameter if destructive: if self._is_deleted(key_index - 1): self.count += 1 self._not_deleted(key_index - 1) return else: var other_key = self.keys[key_index - 1] if eq(other_key, key): self.values[key_index - 1] = value # replace value @parameter if destructive: if self._is_deleted(key_index - 1): self.count += 1 self._not_deleted(key_index - 1) return slot = (slot + 1) & modulo_mask @always_inline fn _is_deleted(self, index: Int) -> Bool: var offset = index >> 3 var bit_index = index & 7 return self.deleted_mask.offset(offset).load() & (1 << bit_index) != 0 @always_inline fn _deleted(self, index: Int): var offset = index >> 3 var bit_index = index & 7 var p = self.deleted_mask.offset(offset) var mask = p.load() p.store(mask | (1 << bit_index)) @always_inline fn _not_deleted(self, index: Int): var offset = index >> 3 var bit_index = index & 7 var p = self.deleted_mask.offset(offset) var mask = p.load() p.store(mask & ~(1 << bit_index)) @always_inline fn _rehash(inout self): var old_slot_to_index = self.slot_to_index var old_capacity = self.capacity self.capacity <<= 1 var mask_capacity = self.capacity >> 3 self.slot_to_index = DTypePointer[KeyCountType].alloc(self.capacity) memset_zero(self.slot_to_index, self.capacity) var key_hashes = self.key_hashes @parameter if caching_hashes: key_hashes = DTypePointer[KeyCountType].alloc(self.capacity) @parameter if destructive: var deleted_mask = DTypePointer[DType.uint8].alloc(mask_capacity) memset_zero(deleted_mask, mask_capacity) memcpy(deleted_mask, self.deleted_mask, old_capacity >> 3) self.deleted_mask.free() self.deleted_mask = deleted_mask var modulo_mask = self.capacity - 1 for i in range(old_capacity): if old_slot_to_index[i] == 0: continue var key_hash = SIMD[KeyCountType, 1](0) @parameter if caching_hashes: key_hash = self.key_hashes[i] else: key_hash = hash(self.keys[int(old_slot_to_index[i] - 1)]).cast[KeyCountType]() var slot = int(key_hash & modulo_mask) # var searching = True while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: self.slot_to_index.store(slot, old_slot_to_index[i]) break # searching = False else: slot = (slot + 1) & modulo_mask @parameter if caching_hashes: key_hashes[slot] = key_hash @parameter if caching_hashes: self.key_hashes.free() self.key_hashes = key_hashes old_slot_to_index.free() fn get(self, key: String, default: V) -> V: var key_index = self._find_key_index(key) if key_index == 0: return default @parameter if destructive: if self._is_deleted(key_index - 1): return default return self.values[key_index - 1] fn delete(inout self, key: String): @parameter if not destructive: return var key_index = self._find_key_index(key) if key_index == 0: return if not self._is_deleted(key_index - 1): self.count -= 1 self._deleted(key_index - 1) fn upsert(inout self, key: String, update: fn(value: Optional[V]) -> V): var key_index = self._find_key_index(key) if key_index == 0: var value = update(None) self.put(key, value) else: key_index -= 1 @parameter if destructive: if self._is_deleted(key_index): self.values[key_index] = update(None) return self.values[key_index] = update(self.values[key_index]) fn clear(inout self): self.values.clear() self.keys.clear() memset_zero(self.slot_to_index, self.capacity) @parameter if destructive: memset_zero(self.deleted_mask, self.capacity >> 3) self.count = 0 @always_inline fn _find_key_index(self, key: String) -> Int: var key_hash = hash(key).cast[KeyCountType]() var modulo_mask = self.capacity - 1 var slot = int(key_hash & modulo_mask) while True: var key_index = int(self.slot_to_index.load(slot)) if key_index == 0: return key_index @parameter if caching_hashes: var other_key_hash = self.key_hashes[slot] if key_hash == other_key_hash: var other_key = self.keys[key_index - 1] if eq(other_key, key): return key_index else: var other_key = self.keys[key_index - 1] if eq(other_key, key): return key_index slot = (slot + 1) & modulo_mask fn debug(self): print("Dict count:", self.count, "and capacity:", self.capacity) print("KeyMap:") for i in range(self.capacity): var end = ", " if i < self.capacity - 1 else "\n" print(self.slot_to_index.load(i), end=end) print("Keys:") self.keys.print_keys() @parameter if caching_hashes: print("KeyHashes:") for i in range(self.capacity): var end = ", " if i < self.capacity - 1 else "\n" if self.slot_to_index.load(i) > 0: print(self.key_hashes.load(i), end=end) else: print(0, end=end) --- string_dict/keys_container.mojo --- from collections.vector import InlinedFixedVector struct KeysContainer[KeyEndType: DType = DType.uint32](Sized): var keys: DTypePointer[DType.uint8] var allocated_bytes: Int var keys_end: DTypePointer[KeyEndType] var count: Int var capacity: Int fn __init__(inout self, capacity: Int): constrained[ KeyEndType == DType.uint8 or KeyEndType == DType.uint16 or KeyEndType == DType.uint32 or KeyEndType == DType.uint64, "KeyEndType needs to be an unsigned integer" ]() self.allocated_bytes = capacity << 3 self.keys = DTypePointer[DType.uint8].alloc(self.allocated_bytes) self.keys_end = DTypePointer[KeyEndType].alloc(capacity) self.count = 0 self.capacity = capacity fn __copyinit__(inout self, existing: Self): self.allocated_bytes = existing.allocated_bytes self.count = existing.count self.capacity = existing.capacity self.keys = DTypePointer[DType.uint8].alloc(self.allocated_bytes) memcpy(self.keys, existing.keys, self.allocated_bytes) self.keys_end = DTypePointer[KeyEndType].alloc(self.allocated_bytes) memcpy(self.keys_end, existing.keys_end, self.capacity) fn __moveinit__(inout self, owned existing: Self): self.allocated_bytes = existing.allocated_bytes self.count = existing.count self.capacity = existing.capacity self.keys = existing.keys self.keys_end = existing.keys_end fn __del__(owned self): self.keys.free() self.keys_end.free() @always_inline fn add(inout self, key: String): var prev_end = 0 if self.count == 0 else self.keys_end[self.count - 1] var key_length = len(key) var new_end = prev_end + key_length var needs_realocation = False while new_end > self.allocated_bytes: self.allocated_bytes += self.allocated_bytes >> 1 needs_realocation = True if needs_realocation: var keys = DTypePointer[DType.uint8].alloc(self.allocated_bytes) memcpy(keys, self.keys, int(prev_end)) self.keys.free() self.keys = keys memcpy(self.keys.offset(prev_end), DTypePointer(key.unsafe_ptr()), key_length) var count = self.count + 1 if count >= self.capacity: var new_capacity = self.capacity + (self.capacity >> 1) var keys_end = DTypePointer[KeyEndType].alloc(self.allocated_bytes) memcpy(keys_end, self.keys_end, self.capacity) self.keys_end.free() self.keys_end = keys_end self.capacity = new_capacity self.keys_end.store(self.count, new_end) self.count = count @always_inline fn get(self, index: Int) -> StringRef: if index < 0 or index >= self.count: return "" var start = 0 if index == 0 else int(self.keys_end[index - 1]) var length = int(self.keys_end[index]) - start return StringRef(self.keys.offset(start), length) @always_inline fn clear(inout self): self.count = 0 @always_inline fn __getitem__(self, index: Int) -> StringRef: return self.get(index) @always_inline fn __len__(self) -> Int: return self.count fn keys_vec(self) -> InlinedFixedVector[StringRef]: var keys = InlinedFixedVector[StringRef](self.count) for i in range(self.count): keys.append(self[i]) return keys fn print_keys(self): print("(" + str(self.count) + ")[", end="") for i in range(self.count): var end = ", " if i < self.capacity - 1 else "" print(self[i], end=end) print("]") --- string_dict/string_eq.mojo --- @always_inline fn eq(a: StringRef, b: String) -> Bool: var l = len(a) if l != len(b): return False var p1 = DTypePointer(a.data) var p2 = DTypePointer(b.unsafe_ptr()) var offset = 0 alias step = 16 while l - offset >= step and (p1.load[width=step](offset) == p2.load[width=step](offset)).reduce_and(): offset += step if l - offset >= step: return False while l - offset > 0 and p1.load(offset) == p2.load(offset): offset += 1 return l - offset == 0 --- test_generic_dict.mojo --- from generic_dict import Dict, Keyable, KeysBuilder from testing import assert_equal from corpora import * @value struct Person(Keyable): var name: String var age: Int fn accept[T: KeysBuilder](self, inout keys_builder: T): keys_builder.add_buffer[DType.uint8](self.name.unsafe_ptr(), len(self.name)) keys_builder.add(Int64(self.age)) fn test_person_dict() raises: var p1 = Person("Maxim", 42) var p2 = Person("Maximilian", 62) var p3 = Person("Alex", 25) var p4 = Person("Maria", 28) var p5 = Person("Daria", 13) var p6 = Person("Max", 31) var d = Dict[Int]() _= d.put(p1, 1) _= d.put(p2, 11) _= d.put(p3, 111) _= d.put(p4, 1111) _= d.put(p5, 11111) _= d.put(p6, 111111) assert_equal(d.get(p1, 0), 1) # assert_equal(d.get(p2, 0), 11) # assert_equal(d.get(p3, 0), 111) # assert_equal(d.get(p4, 0), 1111) # assert_equal(d.get(p5, 0), 11111) # assert_equal(d.get(p6, 0), 111111) @value struct StringKey(Keyable): var s: String fn __init__(inout self, owned s: String): self.s = s^ fn __init__(inout self, s: StringLiteral): self.s = String(s) fn accept[T: KeysBuilder](self, inout keys_builder: T): alias type_prefix = "String:" keys_builder.add_buffer(type_prefix.unsafe_ptr(), len(type_prefix)) keys_builder.add_buffer(self.s.unsafe_ptr(), len(self.s)) @value struct IntKey(Keyable): var i: Int fn __init__(inout self, i: Int): self.i = i fn accept[T: KeysBuilder](self, inout keys_builder: T): alias type_prefix = "Int:" keys_builder.add_buffer(type_prefix.unsafe_ptr(), len(type_prefix)) keys_builder.add(Int64(self.i)) fn test_add_vs_update() raises: var d = Dict[Int]() assert_equal(d.put(StringKey("a"), 1), True) assert_equal(d.put(StringKey("a"), 2), False) d.delete(StringKey("a")) assert_equal(d.put(StringKey("a"), 3), True) assert_equal(d.put(StringKey("a"), 4), False) assert_equal(d.get(StringKey("a"), 0), 4) fn test_clear() raises: var d = Dict[Int]() assert_equal(d.put(StringKey("a"), 1), True) assert_equal(d.put(StringKey("b"), 1), True) assert_equal(d.put(StringKey("a"), 2), False) assert_equal(d.get(StringKey("a"), 0), 2) d.clear() assert_equal(d.put(StringKey("a"), 3), True) assert_equal(d.get(StringKey("a"), 0), 3) assert_equal(d.get(StringKey("b"), 0), 0) fn test_no_key_collision() raises: var d = Dict[Int]() assert_equal(d.put(StringKey("a"), 1), True) assert_equal(d.put(IntKey(97), 2), True) assert_equal(d.get(StringKey("a"), 0), 1) assert_equal(d.get(IntKey(97), 0), 2) fn main() raises: test_person_dict() test_add_vs_update() test_clear() test_no_key_collision() --- test_multi_dict.mojo --- from generic_dict import MultiDict, Keyable, KeysBuilder from testing import assert_equal from corpora import * @value struct StringKey(Keyable): var s: String fn __init__(inout self, owned s: String): self.s = s^ fn __init__(inout self, s: StringLiteral): self.s = String(s) fn accept[T: KeysBuilder](self, inout keys_builder: T): keys_builder.add_buffer(self.s.unsafe_ptr(), len(self.s)) fn test_add() raises: var d = MultiDict[Int]() d.put(StringKey("a"), 1) d.put(StringKey("b"), 2) d.put(StringKey("c"), 3) d.put(StringKey("a"), 4) d.put(StringKey("a"), 5) d.put(StringKey("a"), 6) d.put(StringKey("c"), 7) assert_equal(len(d.get(StringKey("a"))), 4) assert_equal(d.get(StringKey("a"))[0], 1) assert_equal(d.get(StringKey("a"))[1], 4) assert_equal(d.get(StringKey("a"))[2], 5) assert_equal(d.get(StringKey("a"))[3], 6) assert_equal(len(d.get(StringKey("b"))), 1) assert_equal(d.get(StringKey("b"))[0], 2) assert_equal(len(d.get(StringKey("c"))), 2) assert_equal(d.get(StringKey("c"))[0], 3) assert_equal(d.get(StringKey("c"))[1], 7) fn test_s3_corpus() raises: var d = MultiDict[ Int, KeyCountType=DType.uint8, KeyOffsetType=DType.uint16, NextKeyCountType=DType.uint8 ]() var corpus = s3_action_names() for i in range(len(corpus)): d.put(StringKey(corpus[i]), i) assert_equal(len(d), 143) var all_values = 0 for i in range(len(corpus)): var v = d.get(StringKey(corpus[i])) var c = len(v) all_values += c assert_equal(all_values, 143 + (len(corpus) - 143) * 3) _ = d fn test_system_corpus() raises: var d = MultiDict[Int]() var corpus = system_words_collection() for i in range(len(corpus)): d.put(StringKey(corpus[i]), i) assert_equal(len(d), len(corpus)) var all_values = 0 for i in range(len(corpus)): var v = d.get(StringKey(corpus[i])) var c = len(v) all_values += c assert_equal(all_values, len(corpus)) _ = d fn test_english_corpus() raises: var d = MultiDict[ Int, KeyCountType=DType.uint16, KeyOffsetType=DType.uint16, NextKeyCountType=DType.uint16 ]() var corpus = english_text_to_keys() for i in range(len(corpus)): d.put(StringKey(corpus[i]), i) assert_equal(len(d), 192) var all_values = 0 for i in range(len(corpus)): var v = d.get(StringKey(corpus[i])) var c = len(v) all_values += c assert_equal(all_values, 18631) var the_occurances = 0 for i in range(len(corpus)): if corpus[i] == "the": the_occurances += 1 assert_equal(len(d.get(StringKey("the"))), the_occurances) _ = d fn test_get_itter() raises: var d = MultiDict[Int]() d.put(StringKey("a"), 1) d.put(StringKey("b"), 2) d.put(StringKey("c"), 3) d.put(StringKey("a"), 4) d.put(StringKey("a"), 5) d.put(StringKey("a"), 6) d.put(StringKey("c"), 7) var index_a = 0 var expected_a = List[Int](1, 4, 5, 6) for v in d.get_itter(StringKey("a")): assert_equal(expected_a[index_a], v[]) index_a += 1 assert_equal(index_a, 4) var index_b = 0 var expected_b = List[Int](2) for v in d.get_itter(StringKey("b")): assert_equal(expected_b[index_b], v[]) index_b += 1 assert_equal(index_b, 1) var index_c = 0 var expected_c = List[Int](3, 7) for v in d.get_itter(StringKey("c")): assert_equal(expected_c[index_c], v[]) index_c += 1 assert_equal(index_c, 2) var index_d = 0 var expected_d = List[Int](2) for v in d.get_itter(StringKey("d")): print(v[]) assert_equal(expected_d[index_d], v[]) index_d += 1 assert_equal(index_d, 0) fn main()raises: test_add() test_s3_corpus() test_system_corpus() test_english_corpus() test_get_itter() --- test_sparse_array.mojo --- from generic_dict import SparseArray from tensor import Tensor, TensorShape from testing import assert_equal, assert_true fn assert_equal_list[T: DType](lhs: List[Scalar[T]], rhs: List[Scalar[T]]) raises: assert_equal(len(lhs), len(rhs)) for i in range(len(lhs)): assert_true(lhs[i] == rhs[i]) fn main() raises: var a = SparseArray[DType.int64](25) assert_equal(len(a.dense_values_list()), 0) a[23] = 15 assert_equal(a.get(23).or_else(0), 15) assert_equal_list[DType.int64](a.dense_values_list(), List[Int64](15)) a[1] = 45 assert_equal(a.get(1).or_else(0), 45) assert_equal_list[DType.int64](a.dense_values_list(), List[Int64](45, 15)) a[13] = 1 assert_equal(a.get(13).or_else(0), 1) assert_equal_list[DType.int64](a.dense_values_list(), List[Int64](45, 1, 15)) a[24] = 11 assert_equal(a.get(24).or_else(0), 11) assert_equal_list[DType.int64](a.dense_values_list(), List[Int64](45, 1, 15, 11)) a[2] = 0 assert_equal(a.get(2).or_else(0), 0) assert_equal_list[DType.int64](a.dense_values_list(), List[Int64](45, 0, 1, 15, 11)) a[53] = 5 assert_equal(a.get(53).or_else(0), 5) assert_equal_list[DType.int64](a.dense_values_list(), List[Int64](45, 0, 1, 15, 11, 5)) a[0] = 33 assert_equal(a.get(0).or_else(0), 33) assert_equal_list[DType.int64](a.dense_values_list(), List[Int64](33, 45, 0, 1, 15, 11, 5)) a[53] = 49 assert_equal(a.get(53).or_else(0), 49) assert_equal_list[DType.int64](a.dense_values_list(), List[Int64](33, 45, 0, 1, 15, 11, 49)) --- test_string_dict.mojo --- from string_dict import Dict from testing import assert_equal from corpora import * fn test_simple_manipulations() raises: var d = Dict[Int, KeyCountType=DType.uint8, KeyOffsetType=DType.uint16]() var corpus = s3_action_names() for i in range(len(corpus)): d.put(corpus[i], i) assert_equal(len(d), 143) assert_equal(d.get("CopyObject", -1), 2) d.delete("CopyObject") assert_equal(d.get("CopyObject", -1), -1) assert_equal(len(d), 142) d.put("CopyObjects", 256) assert_equal(d.get("CopyObjects", -1), 256) assert_equal(d.get("CopyObject", -1), -1) assert_equal(len(d), 143) d.put("CopyObject", 257) assert_equal(d.get("CopyObject", -1), 257) assert_equal(len(d), 144) _ = d fn test_simple_manipulations_on_non_destructive() raises: var d = Dict[Int, KeyCountType=DType.uint8, KeyOffsetType=DType.uint16, destructive=False]() var corpus = s3_action_names() for i in range(len(corpus)): d.put(corpus[i], i) assert_equal(len(d), 143) assert_equal(d.get("CopyObject", -1), 2) d.delete("CopyObject") assert_equal(d.get("CopyObject", -1), 2) assert_equal(len(d), 143) d.put("CopyObjects", 256) assert_equal(d.get("CopyObjects", -1), 256) assert_equal(d.get("CopyObject", -1), 2) assert_equal(len(d), 144) d.put("CopyObject", 257) assert_equal(d.get("CopyObject", -1), 257) assert_equal(len(d), 144) fn test_simple_manipulations_non_caching() raises: var d = Dict[ Int, KeyCountType=DType.uint8, KeyOffsetType=DType.uint16, caching_hashes=False ]() var corpus = s3_action_names() for i in range(len(corpus)): d.put(corpus[i], i) assert_equal(len(d), 143) assert_equal(d.get("CopyObject", -1), 2) d.delete("CopyObject") assert_equal(d.get("CopyObject", -1), -1) assert_equal(len(d), 142) d.put("CopyObjects", 256) assert_equal(d.get("CopyObjects", -1), 256) assert_equal(d.get("CopyObject", -1), -1) assert_equal(len(d), 143) d.put("CopyObject", 257) assert_equal(d.get("CopyObject", -1), 257) assert_equal(len(d), 144) _ = d @value struct MyInt: var value: Int fn test_upsert() raises: var d1 = Dict[MyInt, KeyCountType=DType.uint8, KeyOffsetType=DType.uint16]() var corpus = s3_action_names() fn inc(value: Optional[MyInt]) -> MyInt: return MyInt(value.or_else(MyInt(0)).value + 1) for i in range(len(corpus)): d1.upsert(corpus[i], inc) # Does not work probably because of Int is a register passable type # var d2 = Dict[Int, KeyCountType=DType.uint8, KeyOffsetType=DType.uint16]() # fn inc2(value: Optional[Int]) -> Int: # return value.or_else(0) + 1 # for i in range(len(corpus)): # d2.upsert(corpus[i], inc2) fn test_clear() raises: var d = Dict[Int]() d.put("a", 1) d.put("b", 1) assert_equal(d.get("a", 0), 1) assert_equal(d.get("b", 0), 1) d.clear() d.put("a", 2) assert_equal(d.get("a", 0), 2) assert_equal(d.get("b", 0), 0) fn main()raises: test_simple_manipulations() test_simple_manipulations_on_non_destructive() test_simple_manipulations_non_caching() test_upsert() test_clear() --- .gitignore --- # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml .pdm-python .pdm-build/ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ --- LICENSE --- MIT License Copyright (c) 2023 Mojo Packaging Authority and Association Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # menv Mojo venv ### Installation and Usage - `git clone [email protected]:mojopaa/menv.git` - `cd menv` - `pip install pdm` - `pdm install -d` - Open venv: - Windows: `.venv\Scripts\activate` - Linux: `. .venv/bin/activate` - Run `menv -h` - Run `menv .test` - Run `source .test/bin/mactivate` - Test with `which mojo` ### References - [PEP 405](https://peps.python.org/pep-0405/) --- notes/reproducer.py --- import click from click.testing import CliRunner @click.command() @click.option( "--without-scm-ignore-files", "scm_ignore_files", is_flag=True, type=frozenset, flag_value=frozenset(), default=frozenset(["git"]), help="Skips adding SCM ignore files to the environment " "directory (Git is supported by default).", ) def rcli(scm_ignore_files): print(f"{scm_ignore_files = }") print(f"{type(scm_ignore_files) = }") def test_rcli(): runner = CliRunner() result = runner.invoke(rcli) assert result.exit_code == 0 print(result.output) if __name__ == "__main__": test_rcli() --- pdm.lock --- # This file is @generated by PDM. # It is not intended for manual editing. [metadata] groups = ["default", "dev"] cross_platform = true static_urls = false lock_version = "4.3" content_hash = "sha256:8d9fa2594a770712bba532cfb57414a4325989d851109e2cffcee60892698bfe" [[package]] name = "appnope" version = "0.1.3" summary = "Disable App Nap on macOS >= 10.9" files = [ {file = "appnope-0.1.3-py2.py3-none-any.whl", hash = "sha256:265a455292d0bd8a72453494fa24df5a11eb18373a60c7c0430889f22548605e"}, {file = "appnope-0.1.3.tar.gz", hash = "sha256:02bd91c4de869fbb1e1c50aafc4098827a7a54ab2f39d9dcba6c9547ed920e24"}, ] [[package]] name = "astroid" version = "2.15.6" requires_python = ">=3.7.2" summary = "An abstract syntax tree for Python with inference support." dependencies = [ "lazy-object-proxy>=1.4.0", "typing-extensions>=4.0.0; python_version < \"3.11\"", "wrapt<2,>=1.11; python_version < \"3.11\"", "wrapt<2,>=1.14; python_version >= \"3.11\"", ] files = [ {file = "astroid-2.15.6-py3-none-any.whl", hash = "sha256:389656ca57b6108f939cf5d2f9a2a825a3be50ba9d589670f393236e0a03b91c"}, {file = "astroid-2.15.6.tar.gz", hash = "sha256:903f024859b7c7687d7a7f3a3f73b17301f8e42dfd9cc9df9d4418172d3e2dbd"}, ] [[package]] name = "asttokens" version = "2.4.0" summary = "Annotate AST trees with source code positions" dependencies = [ "six>=1.12.0", ] files = [ {file = "asttokens-2.4.0-py2.py3-none-any.whl", hash = "sha256:cf8fc9e61a86461aa9fb161a14a0841a03c405fa829ac6b202670b3495d2ce69"}, {file = "asttokens-2.4.0.tar.gz", hash = "sha256:2e0171b991b2c959acc6c49318049236844a5da1d65ba2672c4880c1c894834e"}, ] [[package]] name = "backcall" version = "0.2.0" summary = "Specifications for callback functions passed in to an API" files = [ {file = "backcall-0.2.0-py2.py3-none-any.whl", hash = "sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255"}, {file = "backcall-0.2.0.tar.gz", hash = "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e"}, ] [[package]] name = "black" version = "23.9.1" requires_python = ">=3.8" summary = "The uncompromising code formatter." dependencies = [ "click>=8.0.0", "mypy-extensions>=0.4.3", "packaging>=22.0", "pathspec>=0.9.0", "platformdirs>=2", "tomli>=1.1.0; python_version < \"3.11\"", "typing-extensions>=4.0.1; python_version < \"3.11\"", ] files = [ {file = "black-23.9.1-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:8431445bf62d2a914b541da7ab3e2b4f3bc052d2ccbf157ebad18ea126efb91f"}, {file = "black-23.9.1-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:8fc1ddcf83f996247505db6b715294eba56ea9372e107fd54963c7553f2b6dfe"}, {file = "black-23.9.1-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:7d30ec46de88091e4316b17ae58bbbfc12b2de05e069030f6b747dfc649ad186"}, {file = "black-23.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:031e8c69f3d3b09e1aa471a926a1eeb0b9071f80b17689a655f7885ac9325a6f"}, {file = "black-23.9.1-cp311-cp311-win_amd64.whl", hash = "sha256:538efb451cd50f43aba394e9ec7ad55a37598faae3348d723b59ea8e91616300"}, {file = "black-23.9.1-py3-none-any.whl", hash = "sha256:6ccd59584cc834b6d127628713e4b6b968e5f79572da66284532525a042549f9"}, {file = "black-23.9.1.tar.gz", hash = "sha256:24b6b3ff5c6d9ea08a8888f6977eae858e1f340d7260cf56d70a49823236b62d"}, ] [[package]] name = "click" version = "8.1.7" requires_python = ">=3.7" summary = "Composable command line interface toolkit" dependencies = [ "colorama; platform_system == \"Windows\"", ] files = [ {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, ] [[package]] name = "colorama" version = "0.4.6" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" summary = "Cross-platform colored terminal text." files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] [[package]] name = "decorator" version = "5.1.1" requires_python = ">=3.5" summary = "Decorators for Humans" files = [ {file = "decorator-5.1.1-py3-none-any.whl", hash = "sha256:b8c3f85900b9dc423225913c5aace94729fe1fa9763b38939a95226f02d37186"}, {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, ] [[package]] name = "dill" version = "0.3.7" requires_python = ">=3.7" summary = "serialize all of Python" files = [ {file = "dill-0.3.7-py3-none-any.whl", hash = "sha256:76b122c08ef4ce2eedcd4d1abd8e641114bfc6c2867f49f3c41facf65bf19f5e"}, {file = "dill-0.3.7.tar.gz", hash = "sha256:cc1c8b182eb3013e24bd475ff2e9295af86c1a38eb1aff128dac8962a9ce3c03"}, ] [[package]] name = "exceptiongroup" version = "1.1.3" requires_python = ">=3.7" summary = "Backport of PEP 654 (exception groups)" files = [ {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"}, {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"}, ] [[package]] name = "executing" version = "1.2.0" summary = "Get the currently executing AST node of a frame, and other information" files = [ {file = "executing-1.2.0-py2.py3-none-any.whl", hash = "sha256:0314a69e37426e3608aada02473b4161d4caf5a4b244d1d0c48072b8fee7bacc"}, {file = "executing-1.2.0.tar.gz", hash = "sha256:19da64c18d2d851112f09c287f8d3dbbdf725ab0e569077efb6cdcbd3497c107"}, ] [[package]] name = "ghp-import" version = "2.1.0" summary = "Copy your docs directly to the gh-pages branch." dependencies = [ "python-dateutil>=2.8.1", ] files = [ {file = "ghp-import-2.1.0.tar.gz", hash = "sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343"}, {file = "ghp_import-2.1.0-py3-none-any.whl", hash = "sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619"}, ] [[package]] name = "iniconfig" version = "2.0.0" requires_python = ">=3.7" summary = "brain-dead simple config-ini parsing" files = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] [[package]] name = "ipython" version = "8.15.0" requires_python = ">=3.9" summary = "IPython: Productive Interactive Computing" dependencies = [ "appnope; sys_platform == \"darwin\"", "backcall", "colorama; sys_platform == \"win32\"", "decorator", "exceptiongroup; python_version < \"3.11\"", "jedi>=0.16", "matplotlib-inline", "pexpect>4.3; sys_platform != \"win32\"", "pickleshare", "prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30", "pygments>=2.4.0", "stack-data", "traitlets>=5", ] files = [ {file = "ipython-8.15.0-py3-none-any.whl", hash = "sha256:45a2c3a529296870a97b7de34eda4a31bee16bc7bf954e07d39abe49caf8f887"}, {file = "ipython-8.15.0.tar.gz", hash = "sha256:2baeb5be6949eeebf532150f81746f8333e2ccce02de1c7eedde3f23ed5e9f1e"}, ] [[package]] name = "isort" version = "5.12.0" requires_python = ">=3.8.0" summary = "A Python utility / library to sort Python imports." files = [ {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, ] [[package]] name = "jedi" version = "0.19.0" requires_python = ">=3.6" summary = "An autocompletion tool for Python that can be used for text editors." dependencies = [ "parso<0.9.0,>=0.8.3", ] files = [ {file = "jedi-0.19.0-py2.py3-none-any.whl", hash = "sha256:cb8ce23fbccff0025e9386b5cf85e892f94c9b822378f8da49970471335ac64e"}, {file = "jedi-0.19.0.tar.gz", hash = "sha256:bcf9894f1753969cbac8022a8c2eaee06bfa3724e4192470aaffe7eb6272b0c4"}, ] [[package]] name = "jinja2" version = "3.1.2" requires_python = ">=3.7" summary = "A very fast and expressive template engine." dependencies = [ "MarkupSafe>=2.0", ] files = [ {file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, ] [[package]] name = "lazy-object-proxy" version = "1.9.0" requires_python = ">=3.7" summary = "A fast and thorough lazy object proxy." files = [ {file = "lazy-object-proxy-1.9.0.tar.gz", hash = "sha256:659fb5809fa4629b8a1ac5106f669cfc7bef26fbb389dda53b3e010d1ac4ebae"}, {file = "lazy_object_proxy-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:946d27deaff6cf8452ed0dba83ba38839a87f4f7a9732e8f9fd4107b21e6ff07"}, {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79a31b086e7e68b24b99b23d57723ef7e2c6d81ed21007b6281ebcd1688acb0a"}, {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f699ac1c768270c9e384e4cbd268d6e67aebcfae6cd623b4d7c3bfde5a35db59"}, {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bfb38f9ffb53b942f2b5954e0f610f1e721ccebe9cce9025a38c8ccf4a5183a4"}, {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:189bbd5d41ae7a498397287c408617fe5c48633e7755287b21d741f7db2706a9"}, {file = "lazy_object_proxy-1.9.0-cp311-cp311-win32.whl", hash = "sha256:81fc4d08b062b535d95c9ea70dbe8a335c45c04029878e62d744bdced5141586"}, {file = "lazy_object_proxy-1.9.0-cp311-cp311-win_amd64.whl", hash = "sha256:f2457189d8257dd41ae9b434ba33298aec198e30adf2dcdaaa3a28b9994f6adb"}, ] [[package]] name = "markdown" version = "3.4.4" requires_python = ">=3.7" summary = "Python implementation of John Gruber's Markdown." files = [ {file = "Markdown-3.4.4-py3-none-any.whl", hash = "sha256:a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941"}, {file = "Markdown-3.4.4.tar.gz", hash = "sha256:225c6123522495d4119a90b3a3ba31a1e87a70369e03f14799ea9c0d7183a3d6"}, ] [[package]] name = "markupsafe" version = "2.1.3" requires_python = ">=3.7" summary = "Safely add untrusted strings to HTML/XML markup." files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c"}, {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575"}, {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee"}, {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2"}, {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9"}, {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc"}, {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9"}, {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, ] [[package]] name = "matplotlib-inline" version = "0.1.6" requires_python = ">=3.5" summary = "Inline Matplotlib backend for Jupyter" dependencies = [ "traitlets", ] files = [ {file = "matplotlib-inline-0.1.6.tar.gz", hash = "sha256:f887e5f10ba98e8d2b150ddcf4702c1e5f8b3a20005eb0f74bfdbd360ee6f304"}, {file = "matplotlib_inline-0.1.6-py3-none-any.whl", hash = "sha256:f1f41aab5328aa5aaea9b16d083b128102f8712542f819fe7e6a420ff581b311"}, ] [[package]] name = "mccabe" version = "0.7.0" requires_python = ">=3.6" summary = "McCabe checker, plugin for flake8" files = [ {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, ] [[package]] name = "mergedeep" version = "1.3.4" requires_python = ">=3.6" summary = "A deep merge function for 🐍." files = [ {file = "mergedeep-1.3.4-py3-none-any.whl", hash = "sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307"}, {file = "mergedeep-1.3.4.tar.gz", hash = "sha256:0096d52e9dad9939c3d975a774666af186eda617e6ca84df4c94dec30004f2a8"}, ] [[package]] name = "mkdocs" version = "1.5.2" requires_python = ">=3.7" summary = "Project documentation with Markdown." dependencies = [ "click>=7.0", "colorama>=0.4; platform_system == \"Windows\"", "ghp-import>=1.0", "jinja2>=2.11.1", "markdown>=3.2.1", "markupsafe>=2.0.1", "mergedeep>=1.3.4", "packaging>=20.5", "pathspec>=0.11.1", "platformdirs>=2.2.0", "pyyaml-env-tag>=0.1", "pyyaml>=5.1", "watchdog>=2.0", ] files = [ {file = "mkdocs-1.5.2-py3-none-any.whl", hash = "sha256:60a62538519c2e96fe8426654a67ee177350451616118a41596ae7c876bb7eac"}, {file = "mkdocs-1.5.2.tar.gz", hash = "sha256:70d0da09c26cff288852471be03c23f0f521fc15cf16ac89c7a3bfb9ae8d24f9"}, ] [[package]] name = "mypy-extensions" version = "1.0.0" requires_python = ">=3.5" summary = "Type system extensions for programs checked with the mypy type checker." files = [ {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, ] [[package]] name = "packaging" version = "23.1" requires_python = ">=3.7" summary = "Core utilities for Python packages" files = [ {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, ] [[package]] name = "parso" version = "0.8.3" requires_python = ">=3.6" summary = "A Python Parser" files = [ {file = "parso-0.8.3-py2.py3-none-any.whl", hash = "sha256:c001d4636cd3aecdaf33cbb40aebb59b094be2a74c556778ef5576c175e19e75"}, {file = "parso-0.8.3.tar.gz", hash = "sha256:8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0"}, ] [[package]] name = "pathspec" version = "0.11.2" requires_python = ">=3.7" summary = "Utility library for gitignore style pattern matching of file paths." files = [ {file = "pathspec-0.11.2-py3-none-any.whl", hash = "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20"}, {file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"}, ] [[package]] name = "pexpect" version = "4.8.0" summary = "Pexpect allows easy control of interactive console applications." dependencies = [ "ptyprocess>=0.5", ] files = [ {file = "pexpect-4.8.0-py2.py3-none-any.whl", hash = "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937"}, {file = "pexpect-4.8.0.tar.gz", hash = "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"}, ] [[package]] name = "pickleshare" version = "0.7.5" summary = "Tiny 'shelve'-like database with concurrency support" files = [ {file = "pickleshare-0.7.5-py2.py3-none-any.whl", hash = "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"}, {file = "pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca"}, ] [[package]] name = "platformdirs" version = "3.10.0" requires_python = ">=3.7" summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." files = [ {file = "platformdirs-3.10.0-py3-none-any.whl", hash = "sha256:d7c24979f292f916dc9cbf8648319032f551ea8c49a4c9bf2fb556a02070ec1d"}, {file = "platformdirs-3.10.0.tar.gz", hash = "sha256:b45696dab2d7cc691a3226759c0d3b00c47c8b6e293d96f6436f733303f77f6d"}, ] [[package]] name = "pluggy" version = "1.3.0" requires_python = ">=3.8" summary = "plugin and hook calling mechanisms for python" files = [ {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, ] [[package]] name = "prompt-toolkit" version = "3.0.39" requires_python = ">=3.7.0" summary = "Library for building powerful interactive command lines in Python" dependencies = [ "wcwidth", ] files = [ {file = "prompt_toolkit-3.0.39-py3-none-any.whl", hash = "sha256:9dffbe1d8acf91e3de75f3b544e4842382fc06c6babe903ac9acb74dc6e08d88"}, {file = "prompt_toolkit-3.0.39.tar.gz", hash = "sha256:04505ade687dc26dc4284b1ad19a83be2f2afe83e7a828ace0c72f3a1df72aac"}, ] [[package]] name = "ptyprocess" version = "0.7.0" summary = "Run a subprocess in a pseudo terminal" files = [ {file = "ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35"}, {file = "ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"}, ] [[package]] name = "pure-eval" version = "0.2.2" summary = "Safely evaluate AST nodes without side effects" files = [ {file = "pure_eval-0.2.2-py3-none-any.whl", hash = "sha256:01eaab343580944bc56080ebe0a674b39ec44a945e6d09ba7db3cb8cec289350"}, {file = "pure_eval-0.2.2.tar.gz", hash = "sha256:2b45320af6dfaa1750f543d714b6d1c520a1688dec6fd24d339063ce0aaa9ac3"}, ] [[package]] name = "pygments" version = "2.16.1" requires_python = ">=3.7" summary = "Pygments is a syntax highlighting package written in Python." files = [ {file = "Pygments-2.16.1-py3-none-any.whl", hash = "sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692"}, {file = "Pygments-2.16.1.tar.gz", hash = "sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29"}, ] [[package]] name = "pylint" version = "2.17.5" requires_python = ">=3.7.2" summary = "python code static checker" dependencies = [ "astroid<=2.17.0-dev0,>=2.15.6", "colorama>=0.4.5; sys_platform == \"win32\"", "dill>=0.2; python_version < \"3.11\"", "dill>=0.3.6; python_version >= \"3.11\"", "isort<6,>=4.2.5", "mccabe<0.8,>=0.6", "platformdirs>=2.2.0", "tomli>=1.1.0; python_version < \"3.11\"", "tomlkit>=0.10.1", ] files = [ {file = "pylint-2.17.5-py3-none-any.whl", hash = "sha256:73995fb8216d3bed149c8d51bba25b2c52a8251a2c8ac846ec668ce38fab5413"}, {file = "pylint-2.17.5.tar.gz", hash = "sha256:f7b601cbc06fef7e62a754e2b41294c2aa31f1cb659624b9a85bcba29eaf8252"}, ] [[package]] name = "pytest" version = "7.4.2" requires_python = ">=3.7" summary = "pytest: simple powerful testing with Python" dependencies = [ "colorama; sys_platform == \"win32\"", "exceptiongroup>=1.0.0rc8; python_version < \"3.11\"", "iniconfig", "packaging", "pluggy<2.0,>=0.12", "tomli>=1.0.0; python_version < \"3.11\"", ] files = [ {file = "pytest-7.4.2-py3-none-any.whl", hash = "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002"}, {file = "pytest-7.4.2.tar.gz", hash = "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069"}, ] [[package]] name = "python-dateutil" version = "2.8.2" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" summary = "Extensions to the standard Python datetime module" dependencies = [ "six>=1.5", ] files = [ {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, ] [[package]] name = "pyyaml" version = "6.0.1" requires_python = ">=3.6" summary = "YAML parser and emitter for Python" files = [ {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, ] [[package]] name = "pyyaml-env-tag" version = "0.1" requires_python = ">=3.6" summary = "A custom YAML tag for referencing environment variables in YAML files. " dependencies = [ "pyyaml", ] files = [ {file = "pyyaml_env_tag-0.1-py3-none-any.whl", hash = "sha256:af31106dec8a4d68c60207c1886031cbf839b68aa7abccdb19868200532c2069"}, {file = "pyyaml_env_tag-0.1.tar.gz", hash = "sha256:70092675bda14fdec33b31ba77e7543de9ddc88f2e5b99160396572d11525bdb"}, ] [[package]] name = "ruff" version = "0.0.289" requires_python = ">=3.7" summary = "An extremely fast Python linter, written in Rust." files = [ {file = "ruff-0.0.289-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:c9a89d748e90c840bac9c37afe90cf13a5bfd460ca02ea93dad9d7bee3af03b4"}, {file = "ruff-0.0.289-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:7f7396c6ea01ba332a6ad9d47642bac25d16bd2076aaa595b001f58b2f32ff05"}, {file = "ruff-0.0.289-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7180de86c8ecd39624dec1699136f941c07e723201b4ce979bec9e7c67b40ad2"}, {file = "ruff-0.0.289-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:73f37c65508203dd01a539926375a10243769c20d4fcab3fa6359cd3fbfc54b7"}, {file = "ruff-0.0.289-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1c14abcd7563b5c80be2dd809eeab20e4aa716bf849860b60a22d87ddf19eb88"}, {file = "ruff-0.0.289-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:91b6d63b6b46d4707916472c91baa87aa0592e73f62a80ff55efdf6c0668cfd6"}, {file = "ruff-0.0.289-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6479b8c4be3c36046c6c92054762b276fa0fddb03f6b9a310fbbf4c4951267fd"}, {file = "ruff-0.0.289-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c5424318c254bcb091cb67e140ec9b9f7122074e100b06236f252923fb41e767"}, {file = "ruff-0.0.289-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4daa90865796aedcedf0d8897fdd4cd09bf0ddd3504529a4ccf211edcaff3c7d"}, {file = "ruff-0.0.289-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:8057e8ab0016c13b9419bad119e854f881e687bd96bc5e2d52c8baac0f278a44"}, {file = "ruff-0.0.289-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:7eebfab2e6a6991908ff1bf82f2dc1e5095fc7e316848e62124526837b445f4d"}, {file = "ruff-0.0.289-py3-none-musllinux_1_2_i686.whl", hash = "sha256:ebc7af550018001a7fb39ca22cdce20e1a0de4388ea4a007eb5c822f6188c297"}, {file = "ruff-0.0.289-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:6e4e6eccb753efe760ba354fc8e9f783f6bba71aa9f592756f5bd0d78db898ed"}, {file = "ruff-0.0.289-py3-none-win32.whl", hash = "sha256:bbb3044f931c09cf17dbe5b339896eece0d6ac10c9a86e172540fcdb1974f2b7"}, {file = "ruff-0.0.289-py3-none-win_amd64.whl", hash = "sha256:6d043c5456b792be2615a52f16056c3cf6c40506ce1f2d6f9d3083cfcb9eeab6"}, {file = "ruff-0.0.289-py3-none-win_arm64.whl", hash = "sha256:04a720bcca5e987426bb14ad8b9c6f55e259ea774da1cbeafe71569744cfd20a"}, {file = "ruff-0.0.289.tar.gz", hash = "sha256:2513f853b0fc42f0339b7ab0d2751b63ce7a50a0032d2689b54b2931b3b866d7"}, ] [[package]] name = "six" version = "1.16.0" requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" summary = "Python 2 and 3 compatibility utilities" files = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] [[package]] name = "stack-data" version = "0.6.2" summary = "Extract data from python stack frames and tracebacks for informative displays" dependencies = [ "asttokens>=2.1.0", "executing>=1.2.0", "pure-eval", ] files = [ {file = "stack_data-0.6.2-py3-none-any.whl", hash = "sha256:cbb2a53eb64e5785878201a97ed7c7b94883f48b87bfb0bbe8b623c74679e4a8"}, {file = "stack_data-0.6.2.tar.gz", hash = "sha256:32d2dd0376772d01b6cb9fc996f3c8b57a357089dec328ed4b6553d037eaf815"}, ] [[package]] name = "tomli" version = "2.0.1" requires_python = ">=3.7" summary = "A lil' TOML parser" files = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] [[package]] name = "tomlkit" version = "0.12.1" requires_python = ">=3.7" summary = "Style preserving TOML library" files = [ {file = "tomlkit-0.12.1-py3-none-any.whl", hash = "sha256:712cbd236609acc6a3e2e97253dfc52d4c2082982a88f61b640ecf0817eab899"}, {file = "tomlkit-0.12.1.tar.gz", hash = "sha256:38e1ff8edb991273ec9f6181244a6a391ac30e9f5098e7535640ea6be97a7c86"}, ] [[package]] name = "traitlets" version = "5.10.0" requires_python = ">=3.8" summary = "Traitlets Python configuration system" files = [ {file = "traitlets-5.10.0-py3-none-any.whl", hash = "sha256:417745a96681fbb358e723d5346a547521f36e9bd0d50ba7ab368fff5d67aa54"}, {file = "traitlets-5.10.0.tar.gz", hash = "sha256:f584ea209240466e66e91f3c81aa7d004ba4cf794990b0c775938a1544217cd1"}, ] [[package]] name = "typing-extensions" version = "4.7.1" requires_python = ">=3.7" summary = "Backported and Experimental Type Hints for Python 3.7+" files = [ {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, ] [[package]] name = "watchdog" version = "3.0.0" requires_python = ">=3.7" summary = "Filesystem events monitoring" files = [ {file = "watchdog-3.0.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:2b57a1e730af3156d13b7fdddfc23dea6487fceca29fc75c5a868beed29177ae"}, {file = "watchdog-3.0.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7ade88d0d778b1b222adebcc0927428f883db07017618a5e684fd03b83342bd9"}, {file = "watchdog-3.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7e447d172af52ad204d19982739aa2346245cc5ba6f579d16dac4bfec226d2e7"}, {file = "watchdog-3.0.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:13bbbb462ee42ec3c5723e1205be8ced776f05b100e4737518c67c8325cf6100"}, {file = "watchdog-3.0.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:8f3ceecd20d71067c7fd4c9e832d4e22584318983cabc013dbf3f70ea95de346"}, {file = "watchdog-3.0.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:c9d8c8ec7efb887333cf71e328e39cffbf771d8f8f95d308ea4125bf5f90ba64"}, {file = "watchdog-3.0.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:0e06ab8858a76e1219e68c7573dfeba9dd1c0219476c5a44d5333b01d7e1743a"}, {file = "watchdog-3.0.0-py3-none-manylinux2014_armv7l.whl", hash = "sha256:d00e6be486affb5781468457b21a6cbe848c33ef43f9ea4a73b4882e5f188a44"}, {file = "watchdog-3.0.0-py3-none-manylinux2014_i686.whl", hash = "sha256:c07253088265c363d1ddf4b3cdb808d59a0468ecd017770ed716991620b8f77a"}, {file = "watchdog-3.0.0-py3-none-manylinux2014_ppc64.whl", hash = "sha256:5113334cf8cf0ac8cd45e1f8309a603291b614191c9add34d33075727a967709"}, {file = "watchdog-3.0.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:51f90f73b4697bac9c9a78394c3acbbd331ccd3655c11be1a15ae6fe289a8c83"}, {file = "watchdog-3.0.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:ba07e92756c97e3aca0912b5cbc4e5ad802f4557212788e72a72a47ff376950d"}, {file = "watchdog-3.0.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:d429c2430c93b7903914e4db9a966c7f2b068dd2ebdd2fa9b9ce094c7d459f33"}, {file = "watchdog-3.0.0-py3-none-win32.whl", hash = "sha256:3ed7c71a9dccfe838c2f0b6314ed0d9b22e77d268c67e015450a29036a81f60f"}, {file = "watchdog-3.0.0-py3-none-win_amd64.whl", hash = "sha256:4c9956d27be0bb08fc5f30d9d0179a855436e655f046d288e2bcc11adfae893c"}, {file = "watchdog-3.0.0-py3-none-win_ia64.whl", hash = "sha256:5d9f3a10e02d7371cd929b5d8f11e87d4bad890212ed3901f9b4d68767bee759"}, {file = "watchdog-3.0.0.tar.gz", hash = "sha256:4d98a320595da7a7c5a18fc48cb633c2e73cda78f93cac2ef42d42bf609a33f9"}, ] [[package]] name = "wcwidth" version = "0.2.6" summary = "Measures the displayed width of unicode strings in a terminal" files = [ {file = "wcwidth-0.2.6-py2.py3-none-any.whl", hash = "sha256:795b138f6875577cd91bba52baf9e445cd5118fd32723b460e30a0af30ea230e"}, {file = "wcwidth-0.2.6.tar.gz", hash = "sha256:a5220780a404dbe3353789870978e472cfe477761f06ee55077256e509b156d0"}, ] [[package]] name = "wrapt" version = "1.15.0" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" summary = "Module for decorators, wrappers and monkey patching." files = [ {file = "wrapt-1.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ba1711cda2d30634a7e452fc79eabcadaffedf241ff206db2ee93dd2c89a60e7"}, {file = "wrapt-1.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:56374914b132c702aa9aa9959c550004b8847148f95e1b824772d453ac204a72"}, {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a89ce3fd220ff144bd9d54da333ec0de0399b52c9ac3d2ce34b569cf1a5748fb"}, {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3bbe623731d03b186b3d6b0d6f51865bf598587c38d6f7b0be2e27414f7f214e"}, {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3abbe948c3cbde2689370a262a8d04e32ec2dd4f27103669a45c6929bcdbfe7c"}, {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b67b819628e3b748fd3c2192c15fb951f549d0f47c0449af0764d7647302fda3"}, {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:7eebcdbe3677e58dd4c0e03b4f2cfa346ed4049687d839adad68cc38bb559c92"}, {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:74934ebd71950e3db69960a7da29204f89624dde411afbfb3b4858c1409b1e98"}, {file = "wrapt-1.15.0-cp311-cp311-win32.whl", hash = "sha256:bd84395aab8e4d36263cd1b9308cd504f6cf713b7d6d3ce25ea55670baec5416"}, {file = "wrapt-1.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:a487f72a25904e2b4bbc0817ce7a8de94363bd7e79890510174da9d901c38705"}, {file = "wrapt-1.15.0-py3-none-any.whl", hash = "sha256:64b1df0f83706b4ef4cfb4fb0e4c2669100fd7ecacfb59e091fad300d4e04640"}, {file = "wrapt-1.15.0.tar.gz", hash = "sha256:d06730c6aed78cee4126234cf2d071e01b44b915e725a6cb439a879ec9754a3a"}, ] --- pyproject.toml --- [project] name = "menv" version = "0.1.0" description = "Mojo venv" authors = [ {name = "Drunkwcodes", email = "[email protected]"}, ] dependencies = [ "click>=8.1.7", "tomlkit>=0.12.1", ] requires-python = ">=3.10" readme = "README.md" license = {text = "MIT"} [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" [tool.pdm.dev-dependencies] dev = [ "ipython>=8.15.0", "pytest>=7.4.2", "mkdocs>=1.5.2", "ruff>=0.0.289", "black>=23.9.1", "pylint>=2.17.5", ] [project.scripts] menv = "menv.cli:cli" --- src/menv/__init__.py --- __version__ = "0.1.0" --- src/menv/builder.py --- import configparser import logging import os import shutil import subprocess import sys import types from pathlib import Path import tomlkit from tomlkit.toml_file import TOMLFile MODULAR_NAME = ".modular" MODULAR_PKG_FOLDER = "pkg" MODULAR_PKG_NAME = "packages.modular.com_mojo" MODULAR_CONFIG_NAME = "modular.cfg" MODULAR_DIR = Path.home() / MODULAR_NAME MODULAR_CONFIG = MODULAR_DIR / MODULAR_CONFIG_NAME MOJO_PKG_DIR = MODULAR_DIR / MODULAR_PKG_FOLDER / MODULAR_PKG_NAME MOJO_BIN_DIR = MOJO_PKG_DIR / "bin" MOJO_LIB_DIR = MOJO_PKG_DIR / "lib" MOJO_IMPORT_DIR = MOJO_LIB_DIR / "mojo" MOJO_EXECUTABLE = MOJO_BIN_DIR / "mojo" logger = logging.getLogger(__name__) def create_if_needed(d): if not os.path.exists(d): os.makedirs(d) elif os.path.islink(d) or os.path.isfile(d): raise ValueError("Unable to create directory %r" % d) def clear_directory(path): for fn in os.listdir(path): fn = os.path.join(path, fn) if os.path.islink(fn) or os.path.isfile(fn): os.remove(fn) elif os.path.isdir(fn): shutil.rmtree(fn) def change_config(path: str, section: str, key: str, value: str): config = configparser.ConfigParser() config.read(path) config[section][key] = value with open(path, "w", encoding="utf-8") as f: config.write(f) class MojoEnvBuilder: def __init__( self, system_site_packages=False, clear=False, symlinks=False, upgrade=False, prompt=None, upgrade_deps=False, scm_ignore_files=True, ): self.system_site_packages = system_site_packages self.clear = clear self.symlinks = symlinks self.upgrade = upgrade self.orig_prompt = prompt if prompt == ".": # see bpo-38901 prompt = os.path.basename(os.getcwd()) self.prompt = prompt self.upgrade_deps = upgrade_deps self.scm_ignore_files = scm_ignore_files def create(self, env_dir): """ Create a virtual environment in a directory. :param env_dir: The target directory to create an environment in. """ env_dir = os.path.abspath(env_dir) context = self.ensure_directories(env_dir) # for scm in self.scm_ignore_files: # getattr(self, f"create_{scm}_ignore_file")(context) # See issue 24875. We need system_site_packages to be False # until after pip is installed. true_system_site_packages = self.system_site_packages self.system_site_packages = False self.create_configuration(context) self.setup_mojo(context) # if self.with_pip: # self._setup_pip(context) if not self.upgrade: self.setup_scripts(context) self.post_setup(context) if true_system_site_packages: # We had set it to False before, now # restore it and rewrite the configuration self.system_site_packages = True self.create_configuration(context) if self.upgrade_deps: self.upgrade_dependencies(context) if self.scm_ignore_files: self.create_git_ignore_file(context) def ensure_directories(self, env_dir: str | Path): """ Create the directories for the environment. Returns a context object which holds paths in the environment, for use by subsequent logic. """ if os.pathsep in os.fspath(env_dir): raise ValueError( f"Refusing to create a venv in {env_dir} because " f"it contains the PATH separator {os.pathsep}." ) if os.path.exists(env_dir) and self.clear: clear_directory(env_dir) context = types.SimpleNamespace() context.env_dir = str(env_dir) context.env_name = os.path.split(env_dir)[1] prompt = self.prompt if self.prompt is not None else context.env_name context.prompt = "(%s) " % prompt create_if_needed(env_dir) context.mojo_dir = str(MOJO_BIN_DIR) # TODO: use findmojo context.mojo_exe = "mojo" # venv paths venv_modular_dir = Path(env_dir) / MODULAR_NAME venv_modular_cfg = venv_modular_dir / MODULAR_CONFIG_NAME venv_pkg_dir = venv_modular_dir / MODULAR_PKG_FOLDER / MODULAR_PKG_NAME bin_name = "bin" # Mojo bin name venv_bin_dir = venv_pkg_dir / bin_name venv_lib_dir = venv_pkg_dir / "lib" venv_mojo_excutable = venv_bin_dir / "mojo" context.executable = MOJO_EXECUTABLE context.bin_name = bin_name context.pkg_dir = str(venv_pkg_dir) context.bin_path = str(venv_bin_dir) context.lib_path = str(venv_lib_dir) context.env_exe = str(venv_mojo_excutable) context.env_cfg = str(venv_modular_cfg) # venv bin path, reference: /usr/lib/python3.10/venv/__init__.py if sys.platform == "win32": py_venv_biname = "Scripts" else: py_venv_biname = "bin" context.py_venv_binpath = str(Path(env_dir) / py_venv_biname) create_if_needed(venv_bin_dir) create_if_needed(venv_lib_dir) return context def create_configuration(self, context): """ Create a configuration file indicating where the environment's Python was copied from, and whether the system site-packages should be made available in the environment. Args: context: The context object containing information about the environment. Returns: None """ context.cfg_path = path = os.path.join(context.env_dir, "mojovenv.toml") cfg = tomlkit.document() mojo_tab = tomlkit.table() mojo_tab.add("home", context.mojo_dir) if self.system_site_packages: incl = True else: incl = False mojo_tab.add("include-system-site-packages", incl) # Read VERSION with open(MOJO_PKG_DIR / "VERSION") as f: version = f.read().strip() mojo_tab.add("version", version) if self.prompt is not None: mojo_tab.add("prompt", f"{self.prompt!r}") mojo_tab.add("mojo-executable", str(MOJO_EXECUTABLE)) # build command args = [] nt = os.name == "nt" if nt and self.symlinks: args.append("--symlinks") if not nt and not self.symlinks: args.append("--copies") if self.system_site_packages: args.append("--system-site-packages") if self.clear: args.append("--clear") if self.upgrade: args.append("--upgrade") if self.upgrade_deps: args.append("--upgrade-deps") if self.orig_prompt is not None: args.append(f'--prompt="{self.orig_prompt}"') if not self.scm_ignore_files: args.append("--without-scm-ignore-files") args.append(context.env_dir) args = " ".join(args) mojo_tab.add("command", f"menv {args}") cfg["mojo"] = mojo_tab TOMLFile(path).write(cfg) if os.name != "nt": def symlink_or_copy(self, src, dst, relative_symlinks_ok=False): """ Try symlinking a file, and if that fails, fall back to copying. """ force_copy = not self.symlinks if not force_copy: try: if not os.path.islink(dst): # can't link to itself! if relative_symlinks_ok: assert os.path.dirname(src) == os.path.dirname(dst) os.symlink(os.path.basename(src), dst) else: os.symlink(src, dst) except Exception: # may need to use a more specific exception logger.warning("Unable to symlink %r to %r", src, dst) force_copy = True if force_copy: shutil.copyfile(src, dst) else: def symlink_or_copy(self, src, dst, relative_symlinks_ok=False): """ Try symlinking a file, and if that fails, fall back to copying. """ bad_src = os.path.lexists(src) and not os.path.exists(src) if self.symlinks and not bad_src and not os.path.islink(dst): try: if relative_symlinks_ok: assert os.path.dirname(src) == os.path.dirname(dst) os.symlink(os.path.basename(src), dst) else: os.symlink(src, dst) return except Exception: # may need to use a more specific exception logger.warning("Unable to symlink %r to %r", src, dst) if not os.path.exists(src): if not bad_src: logger.warning("Unable to copy %r", src) return shutil.copyfile(src, dst) def recursive_symlink_or_copy(self, src, dst, relative_symlinks_ok=False): for item in os.listdir(src): src_item = os.path.join(src, item) dst_item = os.path.join(dst, item) if os.path.isfile(src_item): self.symlink_or_copy(src_item, dst_item, relative_symlinks_ok) shutil.copymode(src_item, dst_item) elif os.path.isdir(src_item): os.makedirs(dst_item, exist_ok=True) self.recursive_symlink_or_copy(src_item, dst_item, relative_symlinks_ok) else: logger.warning(f"Skipping {src_item}") def create_git_ignore_file(self, context): """ Create a .gitignore file in the environment directory. The contents of the file cause the entire environment directory to be ignored by git. """ gitignore_path = os.path.join(context.env_dir, ".gitignore") with open(gitignore_path, "w", encoding="utf-8") as file: file.write( "# Created by venv; " "see https://docs.python.org/3/library/venv.html\n" ) # TODO: change this? file.write("*\n") def setup_mojo(self, context): """ Set up a Mojo executable in the environment. Args: context (obj): The information for the environment creation request being processed. """ binpath = context.bin_path libpath = context.lib_path path = context.env_exe copier = self.symlink_or_copy dirname = context.mojo_dir # context.mojo_dir = str(MOJO_BIN_DIR) if os.name != "nt": # copy lib and bin to venv self.recursive_symlink_or_copy(MOJO_LIB_DIR, libpath) self.recursive_symlink_or_copy(MOJO_BIN_DIR, binpath) for bin_item in os.listdir(binpath): if not os.path.islink(os.path.join(binpath, bin_item)): # Set the executable's permissions os.chmod(os.path.join(binpath, bin_item), 0o755) # Create symbolic links for mojo executables for suffix in "mojo": path = os.path.join(binpath, suffix) if not os.path.exists(path): # Make copies if symlinks are not wanted copier(context.env_exe, path, relative_symlinks_ok=True) if not os.path.islink(path): os.chmod(path, 0o755) # Copy config and change import_path settings etc. copier(MODULAR_CONFIG, context.env_cfg) self.write_modular_cfg(context) else: pass # TODO def write_modular_cfg(self, context): cfg_path = context.env_cfg # context.env_cfg = str(venv_modular_cfg) libpath = context.lib_path # str(venv_pkg_dir / "lib") change_config( cfg_path, section="mojo", key="import_path", value=os.path.join(libpath, "mojo"), ) # not working change_config( cfg_path, section="installed", key="packages_modular_com_mojo", value=context.pkg_dir, ) # venv_pkg_config = os.path.join(context.pkg_dir, MODULAR_CONFIG_NAME) # print(venv_pkg_config) # change_config(venv_pkg_config, section="mojo", key="import_path", value=os.path.join(libpath, "mojo")) def replace_variables(self, text, context): """ Replace variable placeholders in the script text with context-specific variables. Args: text (str): The text in which to replace placeholder variables. context (Context): The information for the environment creation request being processed. Returns: str: The text passed in, but with variables replaced. """ # Replace '__VENV_DIR__' placeholder with context.env_dir text = text.replace("__VENV_DIR__", context.env_dir) # abspath of venv # Replace '__VENV_NAME__' placeholder with context.env_name text = text.replace("__VENV_NAME__", context.env_name) # stem of venv # Replace '__VENV_PROMPT__' placeholder with context.prompt text = text.replace("__VENV_PROMPT__", context.prompt) # Replace '__VENV_BIN_NAME__' placeholder with context.bin_name text = text.replace("__VENV_BIN_NAME__", context.bin_name) # bin # Replace '__VENV_BIN_PATH__' placeholder with context.bin_path text = text.replace("__VENV_BIN_PATH__", context.bin_path) # Replace '__VENV_MOJO__' placeholder with context.env_exe text = text.replace("__VENV_MOJO__", context.env_exe) return text def setup_scripts(self, context): """ Set up scripts into the created environment from a directory. This method installs the default scripts into the environment being created. You can prevent the default installation by overriding this method if you really need to, or if you need to specify a different location for the scripts to install. By default, the 'scripts' directory in the venv package is used as the source of scripts to install. """ path = str(Path(__file__).with_name("scripts").absolute()) self.install_scripts(context, path) def install_scripts(self, context, path): """ Install scripts into the created environment from a directory. Args: context: The information for the environment creation request being processed. path: Absolute pathname of a directory containing script. Scripts in the 'common' subdirectory of this directory, and those in the directory named for the platform being run on, are installed in the created environment. Placeholder variables are replaced with environment- specific values. """ # binpath = context.bin_path # Get the bin path from the context binpath = context.py_venv_binpath # Get the bin path from the context plen = len(path) # Get the length of the path for root, dirs, files in os.walk(path): if root == path: # At top-level, remove irrelevant dirs for d in dirs[:]: if d not in ("common", os.name): dirs.remove(d) continue # Ignore files in top level for f in files: if ( os.name == "nt" and f.startswith("python") and f.endswith((".exe", ".pdb")) ): continue # Skip files that start with 'python' and end with '.exe' or '.pdb' on Windows srcfile = os.path.join(root, f) # Get the source file path suffix = root[plen:].split(os.sep)[ 2: ] # Get the relative path of the file if not suffix: dstdir = binpath # If there is no suffix, set the destination directory as binpath else: dstdir = os.path.join( binpath, *suffix ) # Set the destination directory as binpath + suffix if not os.path.exists(dstdir): os.makedirs( dstdir ) # Create the destination directory if it does not exist dstfile = os.path.join(dstdir, f) # Get the destination file path with open(srcfile, "rb") as f: data = f.read() # Read the source file data if not srcfile.endswith((".exe", ".pdb")): try: data = data.decode("utf-8") # Decode the data as utf-8 data = self.replace_variables( data, context ) # Replace the placeholder variables with environment-specific values data = data.encode("utf-8") # Encode the data as utf-8 except UnicodeError as e: data = None logger.error(f"UnicodeError: {e}") logger.warning( "unable to copy script %r, " "may be binary: %s", srcfile, e ) # Log a warning if unable to copy script due to UnicodeError if data is not None: with open(dstfile, "wb") as f: f.write(data) # Write the data to the destination file shutil.copymode( srcfile, dstfile ) # Copy the permissions from the source file to the destination file def upgrade_dependencies(self, context): logger.warning("TODO: upgrade CORE_VENV_DEPS") logger.warning("NOP right now.") def post_setup(self, context): """ Hook for post-setup modification of the venv. Subclasses may install additional packages or scripts here, add activation shell scripts, etc. Parameters: - context: The information for the environment creation request being processed. No changes are made in the function body. """ pass def create( env_dir, system_site_packages=False, clear=False, symlinks=False, prompt=None, upgrade_deps=False, *, scm_ignore_files=True, ): """Create a virtual environment in a directory.""" builder = MojoEnvBuilder( system_site_packages=system_site_packages, clear=clear, symlinks=symlinks, prompt=prompt, upgrade_deps=upgrade_deps, scm_ignore_files=scm_ignore_files, ) builder.create(env_dir) if __name__ == "__main__": # m = MojoEnvBuilder() # c = m.ensure_directories(".asdf") # m.create_configuration(c) # m.setup_mojo(c) # m.create_git_ignore_file(c) create(".asdf") --- src/menv/cli.py --- import os from venv import EnvBuilder import click from .builder import MojoEnvBuilder from .utils import CORE_VENV_DEPS if os.name == "nt": use_symlinks = False else: use_symlinks = True @click.command(context_settings=dict(help_option_names=["-h", "--help"])) @click.argument("dirs", nargs=-1) @click.option( "--system-site-packages", "system_site", is_flag=True, help="Give the virtual environment access to the " "system site-packages dir.", ) @click.option( "--symlinks", is_flag=True, default=use_symlinks, help="Try to use symlinks rather than copies, " "when symlinks are not the default for " "the platform.", ) @click.option( "--copies", is_flag=True, help="Try to use copies rather than symlinks, " "even when symlinks are the default for " "the platform.", ) @click.option( "--clear", is_flag=True, help="Delete the contents of the " "environment directory if it " "already exists, before " "environment creation.", ) @click.option( "--upgrade", is_flag=True, help="Upgrade the environment " "directory to use this version " "of Python, assuming Python " "has been upgraded in-place.", ) @click.option( "--without-pip", "with_pip", is_flag=True, default=True, flag_value=False, help="Skips installing or upgrading pip in the " "virtual environment (pip is bootstrapped " "by default)", ) @click.option( "--prompt", help="Provides an alternative prompt prefix for " "this environment." ) @click.option( "--upgrade-deps", is_flag=True, help=f'Upgrade core dependencies ({", ".join(CORE_VENV_DEPS)}) ' "to the latest version in PyPI", ) @click.option( "--without-scm-ignore-files", "scm_ignore_files", is_flag=True, flag_value=False, default=True, help="Skips adding SCM ignore files to the environment " "directory (Git is supported by default).", ) def cli( dirs, system_site, symlinks, copies, clear, upgrade, with_pip, prompt, upgrade_deps, scm_ignore_files, ): if upgrade and clear: raise ValueError("you cannot supply --upgrade and --clear together.") if copies: # print(f"{copies = }") symlinks = False # print(f"{dir = }, {system_site = }, {symlinks = }, {clear = }, {upgrade = }, {with_pip = }, {prompt = }, {upgrade_deps = }") # defaults: dir = '.asdf', system_site = False, symlinks = False, # clear = False, upgrade = False, with_pip = True, prompt = None, upgrade_deps = False for d in dirs: py_venv_builder = EnvBuilder( system_site_packages=system_site, clear=clear, symlinks=symlinks, upgrade=upgrade, with_pip=with_pip, prompt=prompt, upgrade_deps=upgrade_deps, ) py_venv_builder.create(d) # print(f"{scm_ignore_files = }") # if isinstance(scm_ignore_files, str): # scm_ignore_files = eval(scm_ignore_files) mojo_venv_builder = MojoEnvBuilder( system_site_packages=system_site, clear=clear, symlinks=symlinks, upgrade=upgrade, prompt=prompt, upgrade_deps=upgrade_deps, scm_ignore_files=scm_ignore_files, ) mojo_venv_builder.create(d) --- src/menv/scripts/common/Activate.ps1 --- <# .Synopsis Activate a Python virtual environment for the current PowerShell session. .Description Pushes the python executable for a virtual environment to the front of the $Env:PATH environment variable and sets the prompt to signify that you are in a Python virtual environment. Makes use of the command line switches as well as the `pyvenv.cfg` file values present in the virtual environment. .Parameter VenvDir Path to the directory that contains the virtual environment to activate. The default value for this is the parent of the directory that the Activate.ps1 script is located within. .Parameter Prompt The prompt prefix to display when this virtual environment is activated. By default, this prompt is the name of the virtual environment folder (VenvDir) surrounded by parentheses and followed by a single space (ie. '(.venv) '). .Example Activate.ps1 Activates the Python virtual environment that contains the Activate.ps1 script. .Example Activate.ps1 -Verbose Activates the Python virtual environment that contains the Activate.ps1 script, and shows extra information about the activation as it executes. .Example Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv Activates the Python virtual environment located in the specified location. .Example Activate.ps1 -Prompt "MyPython" Activates the Python virtual environment that contains the Activate.ps1 script, and prefixes the current prompt with the specified string (surrounded in parentheses) while the virtual environment is active. .Notes On Windows, it may be required to enable this Activate.ps1 script by setting the execution policy for the user. You can do this by issuing the following PowerShell command: PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser For more information on Execution Policies: https://go.microsoft.com/fwlink/?LinkID=135170 #> Param( [Parameter(Mandatory = $false)] [String] $VenvDir, [Parameter(Mandatory = $false)] [String] $Prompt ) <# Function declarations --------------------------------------------------- #> <# .Synopsis Remove all shell session elements added by the Activate script, including the addition of the virtual environment's Python executable from the beginning of the PATH variable. .Parameter NonDestructive If present, do not remove this function from the global namespace for the session. #> function global:deactivate ([switch]$NonDestructive) { # Revert to original values # The prior prompt: if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT } # The prior PYTHONHOME: if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME } # The prior PATH: if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH Remove-Item -Path Env:_OLD_VIRTUAL_PATH } # Just remove the VIRTUAL_ENV altogether: if (Test-Path -Path Env:VIRTUAL_ENV) { Remove-Item -Path env:VIRTUAL_ENV } # Just remove VIRTUAL_ENV_PROMPT altogether. if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { Remove-Item -Path env:VIRTUAL_ENV_PROMPT } # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force } # Leave deactivate function in the global namespace if requested: if (-not $NonDestructive) { Remove-Item -Path function:deactivate } } <# .Description Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the given folder, and returns them in a map. For each line in the pyvenv.cfg file, if that line can be parsed into exactly two strings separated by `=` (with any amount of whitespace surrounding the =) then it is considered a `key = value` line. The left hand string is the key, the right hand is the value. If the value starts with a `'` or a `"` then the first and last character is stripped from the value before being captured. .Parameter ConfigDir Path to the directory that contains the `pyvenv.cfg` file. #> function Get-PyVenvConfig( [String] $ConfigDir ) { Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue # An empty map will be returned if no config file is found. $pyvenvConfig = @{ } if ($pyvenvConfigPath) { Write-Verbose "File exists, parse `key = value` lines" $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath $pyvenvConfigContent | ForEach-Object { $keyval = $PSItem -split "\s*=\s*", 2 if ($keyval[0] -and $keyval[1]) { $val = $keyval[1] # Remove extraneous quotations around a string value. if ("'""".Contains($val.Substring(0, 1))) { $val = $val.Substring(1, $val.Length - 2) } $pyvenvConfig[$keyval[0]] = $val Write-Verbose "Adding Key: '$($keyval[0])'='$val'" } } } return $pyvenvConfig } <# Begin Activate script --------------------------------------------------- #> # Determine the containing directory of this script $VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition $VenvExecDir = Get-Item -Path $VenvExecPath Write-Verbose "Activation script is located in path: '$VenvExecPath'" Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" # Set values required in priority: CmdLine, ConfigFile, Default # First, get the location of the virtual environment, it might not be # VenvExecDir if specified on the command line. if ($VenvDir) { Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" } else { Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") Write-Verbose "VenvDir=$VenvDir" } # Next, read the `pyvenv.cfg` file to determine any required value such # as `prompt`. $pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir # Next, set the prompt from the command line, or the config file, or # just use the name of the virtual environment folder. if ($Prompt) { Write-Verbose "Prompt specified as argument, using '$Prompt'" } else { Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" if ($pyvenvCfg -and $pyvenvCfg['prompt']) { Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" $Prompt = $pyvenvCfg['prompt']; } else { Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" $Prompt = Split-Path -Path $venvDir -Leaf } } Write-Verbose "Prompt = '$Prompt'" Write-Verbose "VenvDir='$VenvDir'" # Deactivate any currently active virtual environment, but leave the # deactivate function in place. deactivate -nondestructive # Now set the environment variable VIRTUAL_ENV, used by many tools to determine # that there is an activated venv. $env:VIRTUAL_ENV = $VenvDir if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { Write-Verbose "Setting prompt to '$Prompt'" # Set the prompt to include the env name # Make sure _OLD_VIRTUAL_PROMPT is global function global:_OLD_VIRTUAL_PROMPT { "" } Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt function global:prompt { Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " _OLD_VIRTUAL_PROMPT } $env:VIRTUAL_ENV_PROMPT = $Prompt } # Clear PYTHONHOME if (Test-Path -Path Env:PYTHONHOME) { Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME Remove-Item -Path Env:PYTHONHOME } # Add the venv to the PATH Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH $Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" --- src/menv/scripts/common/activate --- # This file must be used with "source bin/activate" *from bash* # you cannot run it directly deactivate () { # reset old environment variables if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then PATH="${_OLD_VIRTUAL_PATH:-}" export PATH unset _OLD_VIRTUAL_PATH fi if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" export PYTHONHOME unset _OLD_VIRTUAL_PYTHONHOME fi # This should detect bash and zsh, which have a hash command that must # be called to get it to forget past commands. Without forgetting # past commands the $PATH changes we made may not be respected if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then hash -r 2> /dev/null fi if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then PS1="${_OLD_VIRTUAL_PS1:-}" export PS1 unset _OLD_VIRTUAL_PS1 fi unset VIRTUAL_ENV unset VIRTUAL_ENV_PROMPT if [ ! "${1:-}" = "nondestructive" ] ; then # Self destruct! unset -f deactivate fi } # unset irrelevant variables deactivate nondestructive VIRTUAL_ENV="__VENV_DIR__" export VIRTUAL_ENV _OLD_VIRTUAL_PATH="$PATH" PATH="$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH" export PATH # unset PYTHONHOME if set # this will fail if PYTHONHOME is set to the empty string (which is bad anyway) # could use `if (set -u; : $PYTHONHOME) ;` in bash if [ -n "${PYTHONHOME:-}" ] ; then _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" unset PYTHONHOME fi if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then _OLD_VIRTUAL_PS1="${PS1:-}" PS1="__VENV_PROMPT__${PS1:-}" export PS1 VIRTUAL_ENV_PROMPT="__VENV_PROMPT__" export VIRTUAL_ENV_PROMPT fi # This should detect bash and zsh, which have a hash command that must # be called to get it to forget past commands. Without forgetting # past commands the $PATH changes we made may not be respected if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then hash -r 2> /dev/null fi --- src/menv/scripts/common/mactivate --- # This file must be used with "source bin/activate" *from bash* # you cannot run it directly ORIGINAL_DIR="$(pwd)" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # get the directory of this script source "${SCRIPT_DIR}/activate" if [ $? -eq 0 ]; then true # echo "Activate successfully" else deactivate () { # reset old environment variables if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then PATH="${_OLD_VIRTUAL_PATH:-}" export PATH unset _OLD_VIRTUAL_PATH fi if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" export PYTHONHOME unset _OLD_VIRTUAL_PYTHONHOME fi # This should detect bash and zsh, which have a hash command that must # be called to get it to forget past commands. Without forgetting # past commands the $PATH changes we made may not be respected if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then hash -r 2> /dev/null fi if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then PS1="${_OLD_VIRTUAL_PS1:-}" export PS1 unset _OLD_VIRTUAL_PS1 fi unset VIRTUAL_ENV unset VIRTUAL_ENV_PROMPT if [ ! "${1:-}" = "nondestructive" ] ; then # Self destruct! unset -f deactivate fi } # unset irrelevant variables deactivate nondestructive VIRTUAL_ENV="__VENV_DIR__" export VIRTUAL_ENV _OLD_VIRTUAL_PATH="$PATH" PATH="$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH" export PATH # unset PYTHONHOME if set # this will fail if PYTHONHOME is set to the empty string (which is bad anyway) # could use `if (set -u; : $PYTHONHOME) ;` in bash if [ -n "${PYTHONHOME:-}" ] ; then _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" unset PYTHONHOME fi if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then _OLD_VIRTUAL_PS1="${PS1:-}" PS1="__VENV_PROMPT__${PS1:-}" export PS1 VIRTUAL_ENV_PROMPT="__VENV_PROMPT__" export VIRTUAL_ENV_PROMPT fi # This should detect bash and zsh, which have a hash command that must # be called to get it to forget past commands. Without forgetting # past commands the $PATH changes we made may not be respected if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then hash -r 2> /dev/null fi fi PATH="__VENV_BIN_PATH__:$PATH" export PATH cd "$ORIGINAL_DIR" --- src/menv/scripts/nt/activate.bat --- @echo off rem This file is UTF-8 encoded, so we need to update the current code page while executing it for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do ( set _OLD_CODEPAGE=%%a ) if defined _OLD_CODEPAGE ( "%SystemRoot%\System32\chcp.com" 65001 > nul ) set VIRTUAL_ENV=__VENV_DIR__ if not defined PROMPT set PROMPT=$P$G if defined _OLD_VIRTUAL_PROMPT set PROMPT=%_OLD_VIRTUAL_PROMPT% if defined _OLD_VIRTUAL_PYTHONHOME set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME% set _OLD_VIRTUAL_PROMPT=%PROMPT% set PROMPT=__VENV_PROMPT__%PROMPT% if defined PYTHONHOME set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME% set PYTHONHOME= if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH% if not defined _OLD_VIRTUAL_PATH set _OLD_VIRTUAL_PATH=%PATH% set PATH=%VIRTUAL_ENV%\__VENV_BIN_NAME__;%PATH% set VIRTUAL_ENV_PROMPT=__VENV_PROMPT__ :END if defined _OLD_CODEPAGE ( "%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul set _OLD_CODEPAGE= ) --- src/menv/scripts/nt/deactivate.bat --- @echo off if defined _OLD_VIRTUAL_PROMPT ( set "PROMPT=%_OLD_VIRTUAL_PROMPT%" ) set _OLD_VIRTUAL_PROMPT= if defined _OLD_VIRTUAL_PYTHONHOME ( set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%" set _OLD_VIRTUAL_PYTHONHOME= ) if defined _OLD_VIRTUAL_PATH ( set "PATH=%_OLD_VIRTUAL_PATH%" ) set _OLD_VIRTUAL_PATH= set VIRTUAL_ENV= set VIRTUAL_ENV_PROMPT= :END --- src/menv/scripts/posix/activate.csh --- # This file must be used with "source bin/activate.csh" *from csh*. # You cannot run it directly. # Created by Davide Di Blasi <[email protected]>. # Ported to Python 3.3 venv by Andrew Svetlov <[email protected]> alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' # Unset irrelevant variables. deactivate nondestructive setenv VIRTUAL_ENV "__VENV_DIR__" set _OLD_VIRTUAL_PATH="$PATH" setenv PATH "$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH" set _OLD_VIRTUAL_PROMPT="$prompt" if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then set prompt = "__VENV_PROMPT__$prompt" setenv VIRTUAL_ENV_PROMPT "__VENV_PROMPT__" endif alias pydoc python -m pydoc rehash --- src/menv/scripts/posix/activate.fish --- # This file must be used with "source <venv>/bin/activate.fish" *from fish* # (https://fishshell.com/); you cannot run it directly. function deactivate -d "Exit virtual environment and return to normal shell environment" # reset old environment variables if test -n "$_OLD_VIRTUAL_PATH" set -gx PATH $_OLD_VIRTUAL_PATH set -e _OLD_VIRTUAL_PATH end if test -n "$_OLD_VIRTUAL_PYTHONHOME" set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME set -e _OLD_VIRTUAL_PYTHONHOME end if test -n "$_OLD_FISH_PROMPT_OVERRIDE" set -e _OLD_FISH_PROMPT_OVERRIDE # prevents error when using nested fish instances (Issue #93858) if functions -q _old_fish_prompt functions -e fish_prompt functions -c _old_fish_prompt fish_prompt functions -e _old_fish_prompt end end set -e VIRTUAL_ENV set -e VIRTUAL_ENV_PROMPT if test "$argv[1]" != "nondestructive" # Self-destruct! functions -e deactivate end end # Unset irrelevant variables. deactivate nondestructive set -gx VIRTUAL_ENV "__VENV_DIR__" set -gx _OLD_VIRTUAL_PATH $PATH set -gx PATH "$VIRTUAL_ENV/__VENV_BIN_NAME__" $PATH # Unset PYTHONHOME if set. if set -q PYTHONHOME set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME set -e PYTHONHOME end if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" # fish uses a function instead of an env var to generate the prompt. # Save the current fish_prompt function as the function _old_fish_prompt. functions -c fish_prompt _old_fish_prompt # With the original prompt function renamed, we can override with our own. function fish_prompt # Save the return status of the last command. set -l old_status $status # Output the venv prompt; color taken from the blue of the Python logo. printf "%s%s%s" (set_color 4B8BBE) "__VENV_PROMPT__" (set_color normal) # Restore the return status of the previous command. echo "exit $old_status" | . # Output the original/"old" prompt. _old_fish_prompt end set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" set -gx VIRTUAL_ENV_PROMPT "__VENV_PROMPT__" end --- src/menv/utils.py --- CORE_VENV_DEPS = ("pip",) # TODO: assure --- tests/__init__.py --- --- tests/unit/__init__.py --- --- tests/unit/test_builder.py --- import shutil from pathlib import Path from pprint import pprint import pytest from menv.builder import ( MojoEnvBuilder, change_config, clear_directory, create_if_needed, ) class TestMojoEnvBuilder: @classmethod def setup_class(cls): cls.builder = MojoEnvBuilder() cls.venv_path = Path(__file__).parent / "venv" cls.context = cls.builder.ensure_directories(cls.venv_path) def test_init(self) -> None: pprint(f"{self.context = }") # use pytest -s to show this print pass def test_ensure_directories(self) -> None: assert hasattr(self.context, "env_dir") assert hasattr(self.context, "env_name") assert hasattr(self.context, "prompt") assert hasattr(self.context, "mojo_dir") assert hasattr(self.context, "mojo_exe") assert hasattr(self.context, "executable") assert hasattr(self.context, "bin_name") assert hasattr(self.context, "pkg_dir") assert hasattr(self.context, "bin_path") assert hasattr(self.context, "lib_path") assert hasattr(self.context, "env_exe") assert hasattr(self.context, "env_cfg") def test_install_scripts(self): self.builder.setup_scripts(self.context) assert Path(self.context.bin_path).joinpath("mactivate").exists() # comment to debug venv @classmethod def teardown_class(cls) -> None: shutil.rmtree(cls.venv_path) --- .gitignore --- # Ignore Visual Studio Code settings folder .vscode # Ignore Python bytecode cache files __pycache__ # Ignore egg-info directories generated by setuptools *.egg-info/ # Ignore Jupyter Notebook checkpoints .ipynb_checkpoints # Ignore all Jupyter notebooks *.ipynb # Except for the Jupyter notebooks specified below !benchmarks/*.ipynb # Ignore the build directory build/ # Ignore Mojo packages in the benchmarks directory benchmarks/*.mojopkg --- ACKNOWLEDGEMENTS.md --- # Acknowledgements Portions of Specials package may utilize the following copyrighted material, the use of which is hereby acknowledged. --- Summary: * [LLVM Project](#llvm-project) * [Mojo](#mojo) * [NumPy](#numpy) * [TensorFlow Probability](#tensorflow-probability) --- ### [LLVM Project](https://github.com/modularml/mojo/) ============================================================================== The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: ============================================================================== Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---- LLVM Exceptions to the Apache 2.0 License ---- As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into an Object form of such source code, you may redistribute such embedded portions in such Object form without complying with the conditions of Sections 4(a), 4(b) and 4(d) of the License. In addition, if you combine or link compiled forms of this Software with software that is licensed under the GPLv2 ("Combined Software") and if a court of competent jurisdiction determines that the patent provision (Section 3), the indemnity provision (Section 9) or other Section of the License conflicts with the conditions of the GPLv2, you may retroactively and prospectively choose to deem waived or otherwise exclude such Section(s) of the License, but only in their entirety and only with respect to the Combined Software. ============================================================================== Software from third parties included in the LLVM Project: ============================================================================== The LLVM Project contains third party software which is under different license terms. All such code will be identified clearly using at least one of two mechanisms: 1) It will be in a separate directory tree with its own `LICENSE.txt` or `LICENSE` file at the top containing the specific license and restrictions which apply to that software, or 2) It will contain specific license and restriction terms at the top of every file. ============================================================================== Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): ============================================================================== University of Illinois/NCSA Open Source License Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign. All rights reserved. Developed by: LLVM Team University of Illinois at Urbana-Champaign http://llvm.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution. * Neither the names of the LLVM Team, University of Illinois at Urbana-Champaign, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. ### [Mojo](https://github.com/modularml/mojo/) =================================================================================== The Mojo repository is licensed under the Apache License v2.0 with LLVM Exceptions: =================================================================================== Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---- LLVM Exceptions to the Apache 2.0 License ---- As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into an Object form of such source code, you may redistribute such embedded portions in such Object form without complying with the conditions of Sections 4(a), 4(b) and 4(d) of the License. In addition, if you combine or link compiled forms of this Software with software that is licensed under the GPLv2 ("Combined Software") and if a court of competent jurisdiction determines that the patent provision (Section 3), the indemnity provision (Section 9) or other Section of the License conflicts with the conditions of the GPLv2, you may retroactively and prospectively choose to deem waived or otherwise exclude such Section(s) of the License, but only in their entirety and only with respect to the Combined Software. ============================================================================== Software from third parties included in the LLVM Project: ============================================================================== The LLVM Project contains third party software which is under different license terms. All such code will be identified clearly using at least one of two mechanisms: 1) It will be in a separate directory tree with its own `LICENSE.txt` or `LICENSE` file at the top containing the specific license and restrictions which apply to that software, or 2) It will contain specific license and restriction terms at the top of every file. ### [NumPy](https://github.com/numpy/numpy) Copyright (c) 2005-2023, NumPy Developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the NumPy Developers nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### [TensorFlow Probability](https://github.com/tensorflow/probability) Copyright 2018 The TensorFlow Probability Authors. All rights reserved. Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2018, The TensorFlow Probability Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ------------------------------------------------------------------------ A file in TensorFlow Probability is also covered by the following license and copyright. Files: - tensorflow_probability/python/distributions/pixel_cnn.py Copyright 2019 OpenAI (http://openai.com) Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2019 OpenAI (http://openai.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- LICENSE --- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- README.md --- > [!WARNING] > Specials is under development and the API is subject to change. # Welcome to Specials Specials is a [Mojo](https://www.modular.com/mojo) package designed to provide highly-optimized and hardware-acceleration-friendly [special functions](https://en.wikipedia.org/wiki/Special_functions) implementations for AI computing. Mojo combines the usability of Python with the performance of C, unlocking unparalleled programmability of AI hardware and extensibility of AI models. This makes Mojo an ideal choice for implementing special functions that require not only numerical accuracy and stability but also high performance. ## Table of Contents - [Special Functions in AI](#special-functions-in-ai) - [Why Mojo 🔥 for Specials?](#why-mojo--for-specials) - [Why the Focus on Special Functions?](#why-the-focus-on-special-functions) - [Mojo Version Requirement](#mojo-version-requirement) - [Getting Started](#getting-started) - [Example Usage](#example-usage) - [Benchmarks](#benchmarks) - [Some Implementations Available](#some-implementations-available) * [Elementary Functions](#elementary-functions) - [Contributing](#contributing) - [References](#references) ## Special Functions in AI Special functions are integral to various AI applications. For instance: - The Gaussian Error Linear Unit (GELU) [[1](#hendrycks2016)], a high-performing neural network activation function, is based on the [Gauss error](https://en.wikipedia.org/wiki/Error_function) function. - Numerical methods for [Bessel](https://en.wikipedia.org/wiki/Bessel_function), [incomplete beta](https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function), and [incomplete gamma](https://en.wikipedia.org/wiki/Incomplete_gamma_function) functions enable implicit differentiation [[2](#figurnov2018)] of cumulative distribution functions, facilitating the training of probabilistic models with von Mises, gamma, and beta latent variables. Recognizing the relevance of special functions in the field, major AI frameworks provide implementations for many of them. Both PyTorch and JAX include dedicated modules, namely [`torch.special`](https://pytorch.org/docs/stable/special.html) and [`jax.scipy.special`](https://jax.readthedocs.io/en/latest/jax.scipy.html#module-jax.scipy.special). TensorFlow and TensorFlow Probability incorporate them into their mathematical functions APIs, accessible through [`tf.math`](https://www.tensorflow.org/api_docs/python/tf/math) and [`tfp.math`](https://www.tensorflow.org/probability/api_docs/python/tfp/math). ## Why Mojo 🔥 for Specials? By adopting the Mojo programming language, Specials enhances the implementation of special functions with several key advantages: - **Simplified Complexity with High Performance.** Mojo combines Python's simplicity with C-level performance, eliminating the need for wrapping low-level language code. - **Support for Hardware Accelerators.** Mojo is designed to leverage the power of GPUs, TPUs, and other AI hardware without the need for C++ or CUDA. - **Highly Accurate and Optimized Implementations.** Mojo enables the implementation of state-of-the-art numerical methods, ensuring numerical accuracy and stability as well as high performance. ## Why the Focus on Special Functions? Special functions are particular mathematical functions that play a fundamental role in various scientific and industrial disciplines, about which many useful properties are known. They find extensive applications in physics, engineering, chemistry, computer science, and statistics, being prized for their ability to provide closed-form solutions to complex problems in these fields. ## Mojo Version Requirement Specials requires Mojo `24.4.0`. Make sure you have the correct Mojo version installed before using this package. ## Getting Started To get started, access a Mojo programming environment directly via the setup instructions on the Mojo [installation page](https://docs.modular.com/mojo/manual/get-started/). Clone the Specials repository to your machine: ```bash git clone https://github.com/leandrolcampos/specials.git ``` Considering that Mojo SDK as well as our benchmarks and tests depend on an existing installed version of Python, follow the instructions below to create and activate a Python virtual environment with Conda: 1. Install Conda by following the [Quick command-line install instructions](https://docs.conda.io/projects/miniconda/en/latest/#quick-command-line-install). Ensure Conda is initialized for your shell: ```bash ~/miniconda3/bin/conda init zsh # or ~/miniconda3/bin/conda init bash ``` 2. Restart your shell. 3. Navigate to the cloned Specials repository and run the following commands to create and activate a Conda environment named `specials`: ```bash conda env create -f python_environment.yml conda activate specials ``` **Optional:** If using Visual Studio Code, consider adding the following items to `mojo.lsp.includeDirs` setting in the user or remote scope: - `/path/to/repo/src` - `/path/to/repo/test` Replace `/path/to/repo` with the absolute path of the cloned Specials repository. ## Example Usage The following code snippet shows how to compute `exp(x) - 1` in a numerically stable way for a given SIMD vector: ```python >>> import specials >>> var x = SIMD[DType.float64, 4](0.0, 1e-18, 0.2, 1.0) >>> var result = specials.expm1(x) >>> print(result) [0.0, 1.0000000000000001e-18, 0.22140275816016985, 1.7182818284590453] ``` ## Benchmarks The [`benchmarks`](./benchmarks/) directory contains a collection of Mojo notebooks designed to compare the accuracy and runtime performance of functions from the Specials package against those found in well-known Mojo and Python packages. These benchmarks aim to highlight the correctness and efficiency of Specials implementations. Please note that for us, **Accuracy > Performance**: when forced to choose between FLOPS and numerical accuracy, we always prefer numerical accuracy. ## Some Implementations Available ### Elementary Functions | Function | Description | |----------|-------------| | `exp(x)` | The exponential function | | `exp2(x)` | The base-2 exponential function | | `expm1(x)` | The expression `exp(x) - 1` evaluated in a numerically stable way when `x` is near zero | | `log(x)` | The logarithm function | | `log1p(x)` | The expression `log(1 + x)` evaluated in a numerically stable way when `x` is near zero | ## Contributing We are not accepting pull requests at this time. However, you can contribute by reporting issues or suggesting features through the creation of a GitHub issue [here](https://github.com/leandrolcampos/specials/issues). ## References [<a id="hendrycks2016">1</a>] Hendrycks, Dan, and Kevin Gimpel. "Gaussian error linear units (gelus)." _arXiv preprint arXiv:1606.08415_ (2016). [[Link](https://arxiv.org/abs/1606.08415)] [<a id="figurnov2018">2</a>] Figurnov, Mikhail, Shakir Mohamed, and Andriy Mnih. "Implicit reparameterization gradients." _Advances in neural information processing systems_ 31 (2018). [[Link](https://arxiv.org/abs/1805.08498)] --- ROADMAP.md --- # Roadmap ## Introduction This document outlines the development roadmap for Specials, detailing our vision, current focus, and future goals. This roadmap is intended to provide guidance for contributors and users about the future direction of the project. ## Vision The Specials package aims to provide highly-optimized, hardware-accelerated special functions implemented in Mojo, with a strong emphasis on numerical accuracy and stability. Our goal is to become a go-to resource for special functions in AI computing. ## Current Focus (Next 12 Months) - **Keep Up with Mojo Updates**: Monitor updates to the Mojo compiler and standard library, ensuring the proper use of language features that best meet the needs of Specials. - **Adopt Language Standards and Best Practices**: Follow Mojo's standards and best practices for code formatting and documentation. - **Explore Numerical Methods**: Investigate numerical methods to generate a single polynomial approximation that produces correctly rounded results for all inputs of a given elementary function, regardless of the floating-point format used. This will facilitate the addition of support for new formats and reduce the number of lookup tables. - **Review Critical Algorithms and Data Structures**: Optimize critical algorithms and data structures used in various mathematical function implementations to reduce execution time, memory usage, and package size. - **Facilitate Benchmarking**: Make it easier to add and maintain micro benchmarks for Specials, promoting reliability and reproducibility of comparative accuracy and computational efficiency results. Ensure benchmarks are fair, meaning they evaluate alternatives under the same conditions. - **Expand and Rigorize Testing**: Enhance test coverage for numerical methods and data structures, floating-point formats, input domains, and edge cases. Make tests more rigorous by reducing tolerance values appropriately for the precision of each floating-point format. - **Ensure Hardware Accelerator Support**: Ensure Specials executes correctly and efficiently on hardware accelerators supported by Mojo. For the next few months, adding implementations for new mathematical functions is not a priority. The rapid evolution of Mojo makes adapting a large codebase costly. Possible exceptions include the `gamma`, `lgamma`, `beta`, `lbeta` functions, and the elementary functions they depend on. ## Future Goals (Beyond 12 Months) - **Add Implementations for Special Functions**: - `igamma`: Regularized incomplete Gamma function - `igammac`: Complement of the regularized incomplete Gamma function - `igammainv`: Inverse of the `igamma` function - `igammacinv`: Inverse of the `igammac` function - `ibeta`: Regularized incomplete Beta function - `ibetac`: Complement of the regularized incomplete Beta function - `ibetainv`: Inverse of the `ibeta` function - `ibetacinv`: Inverse of the `ibetainv` function - `erf`: Error function - `erfc`: Complement of the error function - `erfinv`: Inverse of the `erf` function - `erfcinv`: Inverse of the `erfc` function - `erfcx`: Scaled complementary error function - **Explore Partial Derivatives**: Investigate ways to implement partial derivatives of the special functions listed above. - **Start Accepting Community Contributions**: Begin accepting pull requests with contributions from the community to foster collaboration and enhance the development of Specials. --- benchmarks/README.md --- # Benchmarks This directory contains a collection of Mojo notebooks designed to compare the accuracy and runtime performance of functions from the Specials package against those found in well-known Mojo and Python packages. The benchmarks aim to highlight the correctness and efficiency of our implementations. Please note that for us, **Accuracy > Performance**: when forced to choose between FLOPS and numerical accuracy, we always prefer numerical accuracy. ## Getting Started Before running the benchmarks, ensure you have completed the initial setup for the project. This includes installing Mojo, cloning the Specials repository, and setting up and activating a Python environment with Conda. Detailed setup instructions are available [here](../README.md#getting-started). Once the initial setup is complete, build the Specials package to ensure all components are ready for benchmarking. Run the following command in the `specials/benchmarks` directory of the cloned repository: ```bash ../scripts/prepare-benchmarks.sh ``` ## Running The benchmarks can be run in [Visual Studio Code](https://github.com/modularml/mojo/tree/main/examples/notebooks#get-started-in-vs-code) or [JupyterLab](https://github.com/modularml/mojo/tree/main/examples/notebooks#get-started-with-jupyterlab) with Mojo kernel support. Follow the respective guides to set up your environment. Once set up, open the desired notebook in the `specials/benchmarks` directory to begin running the benchmarks. --- python_environment.yml --- name: specials channels: - conda-forge - defaults dependencies: - mpmath - numpy - pip - pytest - python=3.11 - scipy - pip: - lit - tabulate --- scripts/README.md --- # Scripts This directory contains scripts to build, prepare for benchmarks, and test the Specials package. ## Overview - `build-specials.sh`: This script packages the Specials for release into the `build` directory. - `prepare-benchmarks.sh`: This script prepares the benchmark environment by installing the needed Python dependencies and packaging the Specials and the `test_utils` separately into the `benchmarks` directory. - `run-tests.sh`: This script prepares the test environment according to the specified build mode (`debug` or `release`) by installing the needed Python dependencies, packaging the Specials and the `test_utils` separately into the `build` directory, and running the tests. The `test_utils` package contains utilities designed exclusively for internal use in benchmarks and testing of the Specials code. It is not intended for external use and should not be relied upon as part of the public API or used in production environments. ## Getting Started Before using these scripts, ensure you have completed the initial setup for the project. This includes installing Mojo, cloning the Specials repository, and setting up and activating a Python environment with Conda. Detailed setup instructions are available [here](../README.md#getting-started). Following these steps will prepare the necessary environment to effectively build, benchmark, and test the Specials. ## Usage ### Building the Specials To package the Specials, navigate to the repository root and run: ```bash ./scripts/build-specials.sh ``` This command compiles the Specials into a `.mojopkg` package suitable for release, and places it in the `build` directory. ### Preparing for Benchmarks If you are setting up for benchmarks, use: ```bash ./scripts/prepare-benchmarks.sh ``` This command prepares the benchmark environment by installing the needed Python dependencies and packaging the Specials and the `test_utils` separately into the `benchmarks` directory. ### Running Tests To run the tests, specify the build mode as either `debug` or `release`. By default, the script uses the `debug` mode: ```bash ./scripts/run-tests.sh ``` In the `debug` mode, the script sets the `debug-level` to `full` and defines `MOJO_ENABLE_ASSERTIONS`, providing detailed debugging output and enabling runtime assertions for thorough testing. Alternatively, you can run the tests in the `release` build mode: ```bash ./scripts/run-tests.sh release ``` This command runs the tests in the `release` mode, optimizing performance by setting the `debug-level` to `none` and not defining `MOJO_ENABLE_ASSERTIONS`. This mode ensures that the build is optimized and stable for production use. --- scripts/build-specials.sh --- #!/usr/bin/env bash ##===----------------------------------------------------------------------===## # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ##===----------------------------------------------------------------------===## set -euo pipefail SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) REPO_ROOT=$(realpath "${SCRIPT_DIR}/..") BUILD_DIR="${REPO_ROOT}/build" mkdir -p "${BUILD_DIR}" echo "Packaging up the Specials" SPECIALS_PATH="${REPO_ROOT}/src/specials" FULL_SPECIALS_PACKAGE_PATH="${BUILD_DIR}/specials.mojopkg" mojo package "${SPECIALS_PATH}" -o "${FULL_SPECIALS_PACKAGE_PATH}" echo Successfully created "${FULL_SPECIALS_PACKAGE_PATH}" --- scripts/prepare-benchmarks.sh --- #!/usr/bin/env bash ##===----------------------------------------------------------------------===## # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ##===----------------------------------------------------------------------===## set -euo pipefail SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) REPO_ROOT=$(realpath "${SCRIPT_DIR}/..") BUILD_DIR="${REPO_ROOT}/benchmarks" mkdir -p "${BUILD_DIR}" echo "Packaging up the Specials" SPECIALS_PATH="${REPO_ROOT}/src/specials" FULL_SPECIALS_PACKAGE_PATH="${BUILD_DIR}/specials.mojopkg" mojo package "${SPECIALS_PATH}" -o "${FULL_SPECIALS_PACKAGE_PATH}" echo Successfully created "${FULL_SPECIALS_PACKAGE_PATH}" echo "Installing the Python dependencies of test_utils" python3 -m pip install -q -e "${REPO_ROOT}"/test echo "Packaging up the test_utils" TEST_UTILS_PATH="${REPO_ROOT}/test/test_utils" FULL_TEST_UTILS_PACKAGE_PATH="${BUILD_DIR}/test_utils.mojopkg" mojo package "${TEST_UTILS_PATH}" \ -I "${BUILD_DIR}" \ -o "${FULL_TEST_UTILS_PACKAGE_PATH}" echo Successfully created "${FULL_TEST_UTILS_PACKAGE_PATH}" --- scripts/run-tests.sh --- #!/usr/bin/env bash ##===----------------------------------------------------------------------===## # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ##===----------------------------------------------------------------------===## set -euo pipefail # Accept an optional build mode argument, default to 'debug' build_mode="${1:-debug}" # Validate the build mode if [[ $build_mode != "debug" && $build_mode != "release" ]]; then echo "Error: Invalid build mode '$build_mode'" echo "Build mode must be either 'debug' or 'release'" exit 1 fi export BUILD_MODE=$build_mode SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) REPO_ROOT=$(realpath "${SCRIPT_DIR}/..") BUILD_DIR="${REPO_ROOT}/build" mkdir -p "${BUILD_DIR}" echo "Packaging up the Specials" SPECIALS_PATH="${REPO_ROOT}/src/specials" FULL_SPECIALS_PACKAGE_PATH="${BUILD_DIR}/specials.mojopkg" mojo package "${SPECIALS_PATH}" \ -o "${FULL_SPECIALS_PACKAGE_PATH}" echo Successfully created "${FULL_SPECIALS_PACKAGE_PATH}" echo "Installing the Python dependencies of test_utils" python3 -m pip install -q -e "${REPO_ROOT}"/test echo "Packaging up the test_utils" TEST_UTILS_PATH="${REPO_ROOT}/test/test_utils" FULL_TEST_UTILS_PACKAGE_PATH="${BUILD_DIR}/test_utils.mojopkg" mojo package "${TEST_UTILS_PATH}" \ -I "${BUILD_DIR}" \ -o "${FULL_TEST_UTILS_PACKAGE_PATH}" echo Successfully created "${FULL_TEST_UTILS_PACKAGE_PATH}" echo "Running tests for Specials" lit -sv "${REPO_ROOT}"/test # Clean up environment variable unset BUILD_MODE --- src/specials/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Specials""" from .elementary.exp import exp from .elementary.exp2 import exp2 from .elementary.expm1 import expm1 from .elementary.log import log from .elementary.log1p import log1p from .gamma import lbeta, lgamma_correction, lgamma1p, rgamma1pm1 --- src/specials/_internal/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Provides internal utilities and helpers for use within the package.""" --- src/specials/_internal/asserting.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """ Implements utilities for performing compile-time assertions within the package. """ import bit import math @always_inline("nodebug") fn assert_integral_dtype[ parameter_name: StringLiteral, parameter_value: DType ]() -> None: """Asserts that the given parameter is an integral data type.""" constrained[ parameter_value.is_integral(), "The parameter `" + parameter_name + "` must be an integral data type.", ]() @always_inline("nodebug") fn assert_float_dtype[ parameter_name: StringLiteral, parameter_value: DType ]() -> None: """Asserts that the given parameter is a floating-point data type. This package supports only floating-point data types of single (`float32`) or double (`float64`) precision. """ constrained[ parameter_value == DType.float32 or parameter_value == DType.float64, "The parameter `" + parameter_name + "` must be a floating-point of single (`float32`) or double" " (`float64`)" " precision.", ]() @always_inline("nodebug") fn assert_in_range[ parameter_name: StringLiteral, parameter_value: Int, lower: Int, upper: Int, ]() -> None: """Asserts that the given parameter is within the specified range.""" constrained[ parameter_value >= lower and parameter_value < upper, "The parameter `" + parameter_name + "` must be within the specified range.", ]() @always_inline("nodebug") fn assert_non_zero[ parameter_name: StringLiteral, parameter_value: Int ]() -> None: """Asserts the condition `parameter_value != 0` holds.""" constrained[ parameter_value != 0, "The parameter `" + parameter_name + "` must be non-zero.", ]() @always_inline("nodebug") fn assert_positive[ parameter_name: StringLiteral, parameter_value: Int ]() -> None: """Asserts the condition `parameter_value > 0` holds.""" constrained[ parameter_value > 0, "The parameter `" + parameter_name + "` must be positive.", ]() @always_inline("nodebug") fn assert_positive[ dtype: DType, parameter_name: StringLiteral, parameter_value: Scalar[dtype] ]() -> None: """Asserts the condition `parameter_value > 0` holds.""" constrained[ parameter_value > 0, "The parameter `" + parameter_name + "` must be positive.", ]() @always_inline("nodebug") fn assert_simd_width[ parameter_name: StringLiteral, parameter_value: Int ]() -> None: """Asserts that the given parameter is a valid SIMD width.""" constrained[ parameter_value > 0 and bit.is_power_of_two(parameter_value), "The parameter `" + parameter_name + "` must be positive and a power of two.", ]() --- src/specials/_internal/math.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Implements mathematical utilities for internal use.""" import math from specials.utils.numerics import FloatLimits fn ldexp[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], exp: SIMD[DType.int32, simd_width]) -> SIMD[ dtype, simd_width, ]: """Computes elementwise `ldexp` function. Compared to the standard library implementation, this implementation produces correct results when `exp` assumes values of greater magnitude. # TODO: Report this as a bug in the standard library. Parameters: dtype: The `dtype` of the input and output SIMD vector. simd_width: The width of the input and output SIMD vector. Args: x: SIMD vector of floating point values. exp: SIMD vector containing the exponents. Returns: Vector containing elementwise result of `ldexp` on `x` and `exp`. """ alias min_exponent: SIMD[DType.int32, simd_width] = FloatLimits[ dtype ].min_exponent - 1 alias max_exponent: SIMD[DType.int32, simd_width] = FloatLimits[ dtype ].max_exponent - 1 var result: SIMD[dtype, simd_width] if ((exp < min_exponent) | (exp > max_exponent)).reduce_or(): var exponent_clipped = exp.clamp(min_exponent, max_exponent) var exponent_remainder = exp - exponent_clipped result = math.ldexp(math.ldexp(x, exponent_clipped), exponent_remainder) else: result = math.ldexp(x, exp) return result --- src/specials/_internal/polynomial.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # Some of the code in this file is adapted from: # # numpy/numpy # Copyright (c) 2005-2023, NumPy Developers. # Licensed under BSD 3 clause. # # slatec/fnlib (https://www.netlib.org/slatec/fnlib): # Public-domain software. No copyright restrictions. """Implements utilities for efficiently working with polynomials.""" import math from memory.unsafe import bitcast from utils.static_tuple import StaticTuple from specials._internal import asserting from specials._internal.table import get_hexadecimal_dtype from specials.utils.functional import fori_loop # TODO: Consider using a trait when it supports defining default method implementations. @always_inline("nodebug") fn _check_polynomial_like_constraints[ num_terms: Int, dtype: DType, simd_width: Int ]() -> None: """Checks the constraints of a polynomial-like.""" asserting.assert_positive["num_terms", num_terms]() asserting.assert_float_dtype["dtype", dtype]() asserting.assert_simd_width["simd_width", simd_width]() # ===-------------------------- Chebyshev Series --------------------------=== # @register_passable("trivial") struct Chebyshev[ num_terms: Int, dtype: DType, simd_width: Int, ](Sized): """Represents a finite Chebyshev series. A Chebyshev series with `n + 1` terms is a linear combination of the form `p(x) = c[0] * T[0](x) + c[1] * T[1](x) + ... + c[n] * T[n](x)` where `x` is the independent variable defined in the interval `[-1, 1]`, `c[i]` is the `i`-th coefficient of the series, and `T[i]` is the `i`-th Chebyshev polynomial of the first kind. Parameters: num_terms: The number of terms in the series. dtype: The data type of the independent variable `x` in the series. simd_width: The SIMD width of the independent variable `x` in the series. Constraints: The number of terms must be positive. The parameter `dtype` must be `float32` or `float64`. """ var _coefficients: StaticTuple[SIMD[dtype, simd_width], num_terms] @staticmethod fn from_coefficients[*coefficients: Scalar[dtype]]() -> Self: """Generates a Chebyshev series from a sequence of coefficients. Parameters: coefficients: The sequence of coefficients in order of increasing degree, i.e., `(1, 2, 3)` gives `1 * T[0](x) + 2 * T[1](x) + 3 * T[2](x)`. Returns: A Chebyshev series with the given coefficients. Constraints: The number of coefficients must be equal to the parameter `num_terms`. """ _check_polynomial_like_constraints[num_terms, dtype, simd_width]() alias coefficients_list = VariadicList(coefficients) constrained[ num_terms == len(coefficients_list), ( "The number of coefficients must be equal to the parameter" " `num_terms`." ), ]() var splatted_coefficients = StaticTuple[ SIMD[dtype, simd_width], num_terms ]() for i in range(num_terms): splatted_coefficients[i] = coefficients_list[i] return Self {_coefficients: splatted_coefficients} @staticmethod fn from_hexadecimal_coefficients[ *coefficients: Scalar[get_hexadecimal_dtype[dtype]()] ]() -> Self: """Generates a Chebyshev series from a sequence of hexadecimal coefficients. The data type used for hexadecimal representation of the coefficients is automatically determined based on `dtype`: `uint32` if `dtype` is `float32` or `uint64` if `dtype` is `float64`. Parameters: coefficients: The sequence of hexadecimal coefficients in order of increasing degree. See the method `from_coefficients`. Returns: A Chebyshev series with the given hexadecimal coefficients. Constraints: The number of hexadecimal coefficients must be equal to the parameter `num_terms`. """ _check_polynomial_like_constraints[num_terms, dtype, simd_width]() alias coefficients_list = VariadicList(coefficients) constrained[ num_terms == len(coefficients_list), ( "The number of hexadecimal coefficients must be equal to the" " parameter `num_terms`." ), ]() var splatted_coefficients = StaticTuple[ SIMD[dtype, simd_width], num_terms ]() for i in range(num_terms): splatted_coefficients[i] = bitcast[dtype](coefficients_list[i]) return Self {_coefficients: splatted_coefficients} @always_inline fn __len__(self: Self) -> Int: """Returns the number of terms in the Chebyshev series. This is known at compile time. Returns: The number of terms in the Chebyshev series. """ return num_terms @always_inline fn degree(self: Self) -> Int: """Returns the degree of the Chebyshev series.""" return num_terms - 1 @always_inline fn get[index: Int](self: Self) -> SIMD[dtype, simd_width]: """Returns the coefficient of the Chebyshev series at the given index. Parameters: index: The index of the coefficient to return. Returns: A SIMD vector containing the coefficient of the Chebyshev series at the given index. Constraints: The index must be within the range `[0, num_terms)`. """ asserting.assert_in_range["index", index, 0, num_terms]() return self._coefficients[index] fn truncate[ num_terms: Int ](self: Self) -> Chebyshev[num_terms, dtype, simd_width]: """Truncates the Chebyshev series by discarding high-degree terms. Parameters: num_terms: The number of terms in the truncated series. Returns: A truncated Chebyshev series. Constraints: The number of terms in the truncated series must be positive and less than or equal to the number of terms in the original series. """ asserting.assert_in_range[ "num_terms", num_terms, 1, self.num_terms + 1 ]() var coefficients = StaticTuple[SIMD[dtype, simd_width], num_terms]() @always_inline @parameter fn body_func[i: Int]() -> None: coefficients[i] = self.get[i]() fori_loop[body_func, 0, num_terms, 1]() return Chebyshev[num_terms, dtype, simd_width] { _coefficients: coefficients } fn economize[error_tolerance: Scalar[dtype]](self) -> Int: """Economizes the Chebyshev series by minimizing the number of terms. Given a Chebyshev series `p` with `n` terms, this function returns the minimum number of terms `m` such that the condition `|p(x) - p_m(x)| <= |c[m]| + ... + |c[n-1]| <= error_tolerance` holds for all `x` in the interval [-1, 1], where `p_m` is the Chebyshev series obtained by truncating `p` to `m <= n` terms. Parameters: error_tolerance: The tolerance for the approximation error between the original series and its truncated version with `m` terms. Returns: The minimum number of terms `m` required to ensure the approximation error between the original series and its truncated version with `m` terms is less than or equal to `error_tolerance`. Constraints: The error tolerance must be positive. """ asserting.assert_positive[dtype, "error_tolerance", error_tolerance]() var num_terms_required = num_terms var error = Scalar[dtype](0.0) @always_inline @parameter fn body_func[i: Int]() -> Bool: # For any coefficient `c` of the Chebyshev series `p`, the following condition # holds: `c[0] == c[1] == ... == c[simd_width - 1]`. var value = self.get[i]()[0] # TODO: Use `abs` when the problem evaluating it in compile-time is fixed. # https://github.com/modularml/mojo/issues/1244 if value < 0: error -= value else: error += value if error > error_tolerance: num_terms_required = i + 1 return False return True fori_loop[body_func, num_terms - 1, 0, -1]() return num_terms_required fn __call__(self, x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Evaluates the Chebyshev series at `x` using the Clenshaw algorithm. If the series `p` has `n + 1` terms, this function computes `p(x)` element-wise: `p(x) = c[0] * T[0](x) + c[1] * T[1](x) + ... + c[n] * T[n](x)`. Args: x: A SIMD vector containing the points at which to evaluate the Chebyshev series. These points should be within the interval `[-1, 1]`. Returns: A SIMD vector containing the values of the Chebyshev series evaluated at the points specified by `x`. """ alias nan: SIMD[dtype, simd_width] = math.nan[dtype]() var result = SIMD[dtype, simd_width](0.0) @parameter if num_terms == 1: result = self.get[0]() elif num_terms == 2: result = math.fma(self.get[1](), x, self.get[0]()) else: var two_x = 2.0 * x var tmp = SIMD[dtype, simd_width](0.0) var c0 = self.get[num_terms - 2]() var c1 = self.get[num_terms - 1]() @always_inline @parameter fn body_func[i: Int]() -> None: tmp = c0 c0 = self.get[i]() - c1 c1 = math.fma(c1, two_x, tmp) fori_loop[body_func, num_terms - 3, -1, -1]() result = math.fma(c1, x, c0) return (abs(x) > 1.0).select(nan, result) # ===---------------------------- Power Series ----------------------------=== # @register_passable("trivial") struct Polynomial[ num_terms: Int, dtype: DType, simd_width: Int, ](Sized): """Represents a finite Power series, commonly known as a polynomial. A Power series with `n + 1` terms is a linear combination of the form `p(x) = c[0] + c[1] * x + ... + c[n] * x**n` where `x` is the independent variable and `c[i]` is the `i`-th coefficient of the series. Parameters: num_terms: The number of terms in the series. dtype: The data type of the independent variable `x` in the series. simd_width: The SIMD width of the independent variable `x` in the series. Constraints: The number of terms must be positive. The parameter `dtype` must be `float32` or `float64`. """ var _coefficients: StaticTuple[SIMD[dtype, simd_width], num_terms] @staticmethod fn from_coefficients[*coefficients: Scalar[dtype]]() -> Self: """Generates a Power series from a sequence of coefficients. Parameters: coefficients: The sequence of coefficients in order of increasing degree, i.e., `(1, 2, 3)` gives `1 + 2 * x + 3 * x**2`. Returns: A Power series with the given coefficients. Constraints: The number of coefficients must be equal to the parameter `num_terms`. """ _check_polynomial_like_constraints[num_terms, dtype, simd_width]() alias coefficients_list = VariadicList(coefficients) constrained[ num_terms == len(coefficients_list), ( "The number of coefficients must be equal to the parameter" " `num_terms`." ), ]() var splatted_coefficients = StaticTuple[ SIMD[dtype, simd_width], num_terms ]() for i in range(num_terms): splatted_coefficients[i] = coefficients_list[i] return Self {_coefficients: splatted_coefficients} @staticmethod fn from_hexadecimal_coefficients[ *coefficients: Scalar[get_hexadecimal_dtype[dtype]()] ]() -> Self: """Generates a Power series from a sequence of hexadecimal coefficients. The data type used for hexadecimal representation of the coefficients is automatically determined based on `dtype`: `uint32` if `dtype` is `float32` or `uint64` if `dtype` is `float64`. Parameters: coefficients: The sequence of hexadecimal coefficients in order of increasing degree. See the method `from_coefficients`. Returns: A Power series with the given hexadecimal coefficients. Constraints: The number of hexadecimal coefficients must be equal to the parameter `num_terms`. """ _check_polynomial_like_constraints[num_terms, dtype, simd_width]() alias coefficients_list = VariadicList(coefficients) constrained[ num_terms == len(coefficients_list), ( "The number of hexadecimal coefficients must be equal to the" " parameter `num_terms`." ), ]() var splatted_coefficients = StaticTuple[ SIMD[dtype, simd_width], num_terms ]() for i in range(num_terms): splatted_coefficients[i] = bitcast[dtype](coefficients_list[i]) return Self {_coefficients: splatted_coefficients} @always_inline fn __len__(self: Self) -> Int: """Returns the number of terms in the Power series. This is known at compile time. Returns: The number of terms in the Power series. """ return num_terms @always_inline fn degree(self: Self) -> Int: """Returns the degree of the Power series.""" return num_terms - 1 @always_inline fn get[index: Int](self: Self) -> SIMD[dtype, simd_width]: """Returns the coefficient of the Power series at the given index. Parameters: index: The index of the coefficient to return. Returns: A SIMD vector containing the coefficient of the Power series at the given index. Constraints: The index must be within the range `[0, num_terms)`. """ asserting.assert_in_range["index", index, 0, num_terms]() return self._coefficients[index] fn truncate[ num_terms: Int ](self: Self) -> Polynomial[num_terms, dtype, simd_width]: """Truncates the Power series by discarding high-degree terms. Parameters: num_terms: The number of terms in the truncated series. Returns: A truncated Power series. Constraints: The number of terms in the truncated series must be positive and less than or equal to the number of terms in the original series. """ asserting.assert_in_range[ "num_terms", num_terms, 1, self.num_terms + 1 ]() var coefficients = StaticTuple[SIMD[dtype, simd_width], num_terms]() @always_inline @parameter fn body_func[i: Int]() -> None: coefficients[i] = self.get[i]() fori_loop[body_func, 0, num_terms, 1]() return Polynomial[num_terms, dtype, simd_width] { _coefficients: coefficients } fn __call__(self, x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Evaluates the Power series at `x` using the Horner's scheme. If the series `p` has `n + 1` terms, this function computes `p(x)` element-wise: `p(x) = c[0] + c[1] * x + ... + c[n] * x**n`. Args: x: A SIMD vector containing the points at which to evaluate the Power series. Returns: A SIMD vector containing the values of the Power series evaluated at the points specified by `x`. """ # In terms of accuracy or execution time, there is no reason to use # `math.polynomial_evaluate`. See the Jupyter notebooks below: # - https://github.com/leandrolcampos/specials/blob/polynomial_evaluate/polyval_f32.ipynb # - https://github.com/leandrolcampos/specials/blob/polynomial_evaluate/polyval_f64.ipynb var result = self.get[num_terms - 1]() @parameter if num_terms > 1: @always_inline @parameter fn body_func[i: Int]() -> None: result = math.fma(result, x, self.get[i]()) fori_loop[body_func, num_terms - 2, -1, -1]() return result --- src/specials/_internal/table.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Implements utilities for table-based numerical methods.""" import math from memory.unsafe import bitcast from utils.static_tuple import StaticTuple from specials._internal import asserting @always_inline fn get_hexadecimal_dtype[decimal_dtype: DType]() -> DType: """Returns the hexadecimal dtype corresponding to the provided decimal dtype. """ @parameter if decimal_dtype == DType.float32: return DType.uint32 elif decimal_dtype == DType.float64: return DType.uint64 else: return DType.invalid @always_inline fn _check_float_table_constraints[size: Int, dtype: DType]() -> None: """Checks the constraints of the `FloatTable`.""" asserting.assert_positive["size", size]() asserting.assert_float_dtype["dtype", dtype]() @register_passable("trivial") struct FloatTable[size: Int, dtype: DType](Sized): """Represents a table of floating-point values. It is used to implement table lookup algorithms. Parameters: size: The number of floating-point values in the table. dtype: The data type of the floating-point values. Constraints: The size must be positive. The parameter `dtype` must be `float32` or `float64`. """ var _data: StaticTuple[Scalar[dtype], size] @staticmethod fn from_values[*values: Scalar[dtype]]() -> Self: """Creates a table from a sequence of floating-point values. Parameters: values: The sequence of floating-point values. Returns: A `FloatTable` with the given floating-point values. Constraints: The number of values must be equal to the parameter `size`. """ _check_float_table_constraints[size, dtype]() constrained[ size == len(VariadicList(values)), "The number of values must be equal to the parameter `size`.", ]() return Self {_data: StaticTuple[Scalar[dtype], size](values)} @staticmethod fn from_hexadecimal_values[ *values: Scalar[get_hexadecimal_dtype[dtype]()] ]() -> Self: """Creates a table from a sequence of hexadecimal floating-point values. The data type used for hexadecimal representation of the floating-point values is automatically determined based on `dtype`: `uint32` if `dtype` is `float32` or `uint64` if `dtype` is `float64`. Parameters: values: The sequence of hexadecimal floating-point values. Returns: A `FloatTable` with the given hexadecimal floating-point values. Constraints: The number of hexadecimal values must be equal to the parameter `size`. """ _check_float_table_constraints[size, dtype]() alias values_list = VariadicList(values) constrained[ size == len(values_list), ( "The number of hexadecimal values must be equal to the" " parameter `size`." ), ]() var data = StaticTuple[Scalar[dtype], size]() for i in range(size): data[i] = bitcast[dtype](values_list[i]) return Self {_data: data} @always_inline fn __len__(self: Self) -> Int: """Returns the number of floating-point values in the table. This is known at compile time. Returns: The number of floating-point values in the table. """ return size @always_inline fn get[index: Int](self: Self) -> Scalar[dtype]: """Returns the floating-point value of the table at the given index. Parameters: index: The index of the floating-point value to return. Returns: SIMD vector containing the floating-point value of the table at the given index. Constraints: The index must be in the range `[0, size)`. """ asserting.assert_in_range["index", index, 0, size]() return self._data[index] @always_inline fn unsafe_lookup(self: Self, index: SIMD) -> SIMD[dtype, index.size]: """Returns the floating-point values of the table at the given indices. For performance reasons, this method does not perform bounds checking. Args: index: SIMD vector containing the indices of the floating-point values to return. Returns: SIMD vector containing the floating-point values of the table at the given indices. Constraints: The parameter `index.type` must be an integer. """ # TODO: Use the overload of `DTypePointer.simd_load` when it is available. # This overload will allow to load a SIMD vector of floating-point values # from a SIMD vector of indices. It may require to change the underlying # data storage to a `DTypePointer`. See the feature request: # https://github.com/modularml/mojo/issues/1626 asserting.assert_integral_dtype["index.type", index.type]() var result = SIMD[dtype, index.size]() @parameter for i in range(index.size): result[i] = self._data[int(index[i])] return result fn lookup(self: Self, index: SIMD) -> SIMD[dtype, index.size]: """Returns the floating-point values of the table at the given indices. Args: index: SIMD vector containing the indices of the floating-point values to return. Returns: SIMD vector containing the floating-point values of the table at the given indices. If an index is out of range, the corresponding result is `NaN`. Constraints: The parameter `index.type` must be an integer. """ asserting.assert_integral_dtype["index.type", index.type]() var is_safe = (index >= 0) & (index < size) var safe_index = is_safe.select(index, 0) return is_safe.select(self.unsafe_lookup(safe_index), math.nan[dtype]()) --- src/specials/elementary/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Provides elementary functions.""" --- src/specials/elementary/common_constants.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Defines common constants for elementary function implementations.""" from specials._internal.asserting import assert_float_dtype from specials._internal.table import FloatTable # ===----------------------- Exponential Functions ------------------------=== # # # References: # # Tang, P. T. P. (1989). Table-driven implementation of the exponential function # in IEEE floating-point arithmetic. # ACM Transactions on Mathematical Software (TOMS), 15(2), 144-157. # https://doi.org/10.1145/63522.214389 @always_inline fn _get_exp_lead_table[dtype: DType]() -> FloatTable[32, dtype]: """Returns the table entries of `exp_lead` for single or double precision. """ @parameter if dtype == DType.float32: return FloatTable[32, dtype].from_hexadecimal_values[ 0x3F80_0000, 0x3F82_CD80, 0x3F85_AAC0, 0x3F88_9800, 0x3F8B_95C0, 0x3F8E_A400, 0x3F91_C3C0, 0x3F94_F4C0, 0x3F98_37C0, 0x3F9B_8D00, 0x3F9E_F500, 0x3FA2_7040, 0x3FA5_FEC0, 0x3FA9_A140, 0x3FAD_5800, 0x3FB1_23C0, 0x3FB5_04C0, 0x3FB8_FB80, 0x3FBD_0880, 0x3FC1_2C40, 0x3FC5_6700, 0x3FC9_B980, 0x3FCE_2480, 0x3FD2_A800, 0x3FD7_44C0, 0x3FDB_FB80, 0x3FE0_CCC0, 0x3FE5_B900, 0x3FEA_C0C0, 0x3FEF_E480, 0x3FF5_2540, 0x3FFA_8380, ]() else: # dtype == DType.float64 return FloatTable[32, dtype].from_hexadecimal_values[ 0x3FF00000_00000000, 0x3FF059B0_D3158540, 0x3FF0B558_6CF98900, 0x3FF11301_D0125B40, 0x3FF172B8_3C7D5140, 0x3FF1D487_3168B980, 0x3FF2387A_6E756200, 0x3FF29E9D_F51FDEC0, 0x3FF306FE_0A31B700, 0x3FF371A7_373AA9C0, 0x3FF3DEA6_4C123400, 0x3FF44E08_60618900, 0x3FF4BFDA_D5362A00, 0x3FF5342B_569D4F80, 0x3FF5AB07_DD485400, 0x3FF6247E_B03A5580, 0x3FF6A09E_667F3BC0, 0x3FF71F75_E8EC5F40, 0x3FF7A114_73EB0180, 0x3FF82589_994CCE00, 0x3FF8ACE5_422AA0C0, 0x3FF93737_B0CDC5C0, 0x3FF9C491_82A3F080, 0x3FFA5503_B23E2540, 0x3FFAE89F_995AD380, 0x3FFB7F76_F2FB5E40, 0x3FFC199B_DD855280, 0x3FFCB720_DCEF9040, 0x3FFD5818_DCFBA480, 0x3FFDFC97_337B9B40, 0x3FFEA4AF_A2A490C0, 0x3FFF5076_5B6E4540, ]() @always_inline fn _get_exp_trail_table[dtype: DType]() -> FloatTable[32, dtype]: """Returns the table entries of `exp_trail` for single or double precision. """ @parameter if dtype == DType.float32: return FloatTable[32, dtype].from_hexadecimal_values[ 0x0000_0000, 0x3553_1585, 0x34D9_F312, 0x35E8_092E, 0x3471_F546, 0x36E6_2D17, 0x361B_9D59, 0x36BE_A3FC, 0x36C1_4637, 0x36E6_E755, 0x36C9_8247, 0x34C0_C312, 0x3635_4D8B, 0x3655_A754, 0x36FB_A90B, 0x36D6_074B, 0x36CC_CFE7, 0x36BD_1D8C, 0x368E_7D60, 0x35CC_A667, 0x36A8_4554, 0x36F6_19B9, 0x35C1_51F8, 0x366C_8F89, 0x36F3_2B5A, 0x36DE_5F6C, 0x3677_6155, 0x355C_EF90, 0x355C_FBA5, 0x36E6_6F73, 0x36F4_5492, 0x36CB_6DC9, ]() else: # dtype == DType.float64 return FloatTable[32, dtype].from_hexadecimal_values[ 0x00000000_00000000, 0x3D0A1D73_E2A475B4, 0x3CEEC531_7256E308, 0x3CF0A4EB_BF1AED93, 0x3D0D6E6F_BE462876, 0x3D053C02_DC0144C8, 0x3D0C3360_FD6D8E0B, 0x3D009612_E8AFAD12, 0x3CF52DE8_D5A46306, 0x3CE54E28_AA05E8A9, 0x3D011ADA_0911F09F, 0x3D068189_B7A04EF8, 0x3D038EA1_CBD7F621, 0x3CBDF0A8_3C49D86A, 0x3D04AC64_980A8C8F, 0x3CD2C7C3_E81BF4B7, 0x3CE92116_5F626CDD, 0x3D09EE91_B8797785, 0x3CDB5F54_408FDB37, 0x3CF28ACF_88AFAB35, 0x3CFB5BA7_C55A192D, 0x3D027A28_0E1F92A0, 0x3CF01C7C_46B071F3, 0x3CFC8B42_4491CAF8, 0x3D06AF43_9A68BB99, 0x3CDBAA9E_C206AD4F, 0x3CFC2220_CB12A092, 0x3D048A81_E5E8F4A5, 0x3CDC9768_16BAD9B8, 0x3CFEB968_CAC39ED3, 0x3CF9858F_73A18F5E, 0x3C99D3E1_2DD8A18B, ]() @register_passable("trivial") struct ExpTable[dtype: DType]: """Table entries of `exp_lead` and `exp_trail` for single or double precision. """ alias lead = _get_exp_lead_table[dtype]() alias trail = _get_exp_trail_table[dtype]() # ===----------------------------------------------------------------------=== # # Logarithm Functions # ===----------------------------------------------------------------------=== # @always_inline("nodebug") fn _get_inv_fraction1[dtype: DType]() -> FloatTable[129, dtype]: """Returns the table entries of `inv_fraction1`.""" assert_float_dtype["dtype", dtype]() @parameter if dtype == DType.float32: return FloatTable[129, dtype].from_hexadecimal_values[ 0x3F80_0000, 0x3F7E_03F8, 0x3F7C_0FC1, 0x3F7A_232D, 0x3F78_3E10, 0x3F76_603E, 0x3F74_898D, 0x3F72_B9D6, 0x3F70_F0F1, 0x3F6F_2EB7, 0x3F6D_7304, 0x3F6B_BDB3, 0x3F6A_0EA1, 0x3F68_65AC, 0x3F66_C2B4, 0x3F65_2598, 0x3F63_8E39, 0x3F61_FC78, 0x3F60_7038, 0x3F5E_E95C, 0x3F5D_67C9, 0x3F5B_EB62, 0x3F5A_740E, 0x3F59_01B2, 0x3F57_9436, 0x3F56_2B81, 0x3F54_C77B, 0x3F53_680D, 0x3F52_0D21, 0x3F50_B6A0, 0x3F4F_6475, 0x3F4E_168A, 0x3F4C_CCCD, 0x3F4B_8728, 0x3F4A_4588, 0x3F49_07DA, 0x3F47_CE0C, 0x3F46_980C, 0x3F45_65C8, 0x3F44_3730, 0x3F43_0C31, 0x3F41_E4BC, 0x3F40_C0C1, 0x3F3F_A030, 0x3F3E_82FA, 0x3F3D_6910, 0x3F3C_5264, 0x3F3B_3EE7, 0x3F3A_2E8C, 0x3F39_2144, 0x3F38_1703, 0x3F37_0FBB, 0x3F36_0B61, 0x3F35_09E7, 0x3F34_0B41, 0x3F33_0F63, 0x3F32_1643, 0x3F31_1FD4, 0x3F30_2C0B, 0x3F2F_3ADE, 0x3F2E_4C41, 0x3F2D_602B, 0x3F2C_7692, 0x3F2B_8F6A, 0x3F2A_AAAB, 0x3F29_C84A, 0x3F28_E83F, 0x3F28_0A81, 0x3F27_2F05, 0x3F26_55C4, 0x3F25_7EB5, 0x3F24_A9CF, 0x3F23_D70A, 0x3F23_065E, 0x3F22_37C3, 0x3F21_6B31, 0x3F20_A0A1, 0x3F1F_D80A, 0x3F1F_1166, 0x3F1E_4CAD, 0x3F1D_89D9, 0x3F1C_C8E1, 0x3F1C_09C1, 0x3F1B_4C70, 0x3F1A_90E8, 0x3F19_D723, 0x3F19_1F1A, 0x3F18_68C8, 0x3F17_B426, 0x3F17_012E, 0x3F16_4FDA, 0x3F15_A025, 0x3F14_F209, 0x3F14_4581, 0x3F13_9A86, 0x3F12_F114, 0x3F12_4925, 0x3F11_A2B4, 0x3F10_FDBC, 0x3F10_5A38, 0x3F0F_B824, 0x3F0F_177A, 0x3F0E_7835, 0x3F0D_DA52, 0x3F0D_3DCB, 0x3F0C_A29C, 0x3F0C_08C1, 0x3F0B_7034, 0x3F0A_D8F3, 0x3F0A_42F8, 0x3F09_AE41, 0x3F09_1AC7, 0x3F08_8889, 0x3F07_F781, 0x3F07_67AB, 0x3F06_D905, 0x3F06_4B8A, 0x3F05_BF37, 0x3F05_3408, 0x3F04_A9FA, 0x3F04_2108, 0x3F03_9930, 0x3F03_126F, 0x3F02_8CC0, 0x3F02_0821, 0x3F01_848E, 0x3F01_0204, 0x3F00_8081, 0x3F00_0000, ]() else: # dtype == DType.float64 return FloatTable[129, dtype].from_hexadecimal_values[ 0x3FF00000_00000000, 0x3FEFC07F_01FC07F0, 0x3FEF81F8_1F81F820, 0x3FEF4465_9E4A4271, 0x3FEF07C1_F07C1F08, 0x3FEECC07_B301ECC0, 0x3FEE9131_ABF0B767, 0x3FEE573A_C901E574, 0x3FEE1E1E_1E1E1E1E, 0x3FEDE5D6_E3F8868A, 0x3FEDAE60_76B981DB, 0x3FED77B6_54B82C34, 0x3FED41D4_1D41D41D, 0x3FED0CB5_8F6EC074, 0x3FECD856_89039B0B, 0x3FECA4B3_055EE191, 0x3FEC71C7_1C71C71C, 0x3FEC3F8F_01C3F8F0, 0x3FEC0E07_0381C0E0, 0x3FEBDD2B_899406F7, 0x3FEBACF9_14C1BAD0, 0x3FEB7D6C_3DDA338B, 0x3FEB4E81_B4E81B4F, 0x3FEB2036_406C80D9, 0x3FEAF286_BCA1AF28, 0x3FEAC570_1AC5701B, 0x3FEA98EF_606A63BE, 0x3FEA6D01_A6D01A6D, 0x3FEA41A4_1A41A41A, 0x3FEA16D3_F97A4B02, 0x3FE9EC8E_951033D9, 0x3FE9C2D1_4EE4A102, 0x3FE99999_9999999A, 0x3FE970E4_F80CB872, 0x3FE948B0_FCD6E9E0, 0x3FE920FB_49D0E229, 0x3FE8F9C1_8F9C18FA, 0x3FE8D301_8D3018D3, 0x3FE8ACB9_0F6BF3AA, 0x3FE886E5_F0ABB04A, 0x3FE86186_18618618, 0x3FE83C97_7AB2BEDD, 0x3FE81818_18181818, 0x3FE7F405_FD017F40, 0x3FE7D05F_417D05F4, 0x3FE7AD22_08E0ECC3, 0x3FE78A4C_8178A4C8, 0x3FE767DC_E434A9B1, 0x3FE745D1_745D1746, 0x3FE72428_7F46DEBC, 0x3FE702E0_5C0B8170, 0x3FE6E1F7_6B4337C7, 0x3FE6C16C_16C16C17, 0x3FE6A13C_D1537290, 0x3FE68168_16816817, 0x3FE661EC_6A5122F9, 0x3FE642C8_590B2164, 0x3FE623FA_77016240, 0x3FE60581_60581606, 0x3FE5E75B_B8D015E7, 0x3FE5C988_2B931057, 0x3FE5AC05_6B015AC0, 0x3FE58ED2_308158ED, 0x3FE571ED_3C506B3A, 0x3FE55555_55555555, 0x3FE53909_48F40FEB, 0x3FE51D07_EAE2F815, 0x3FE50150_15015015, 0x3FE4E5E0_A72F0539, 0x3FE4CAB8_8725AF6E, 0x3FE4AFD6_A052BF5B, 0x3FE49539_E3B2D067, 0x3FE47AE1_47AE147B, 0x3FE460CB_C7F5CF9A, 0x3FE446F8_6562D9FB, 0x3FE42D66_25D51F87, 0x3FE41414_14141414, 0x3FE3FB01_3FB013FB, 0x3FE3E22C_BCE4A902, 0x3FE3C995_A47BABE7, 0x3FE3B13B_13B13B14, 0x3FE3991C_2C187F63, 0x3FE38138_13813814, 0x3FE3698D_F3DE0748, 0x3FE3521C_FB2B78C1, 0x3FE33AE4_5B57BCB2, 0x3FE323E3_4A2B10BF, 0x3FE30D19_0130D190, 0x3FE2F684_BDA12F68, 0x3FE2E025_C04B8097, 0x3FE2C9FB_4D812CA0, 0x3FE2B404_AD012B40, 0x3FE29E41_29E4129E, 0x3FE288B0_1288B013, 0x3FE27350_B8812735, 0x3FE25E22_708092F1, 0x3FE24924_92492492, 0x3FE23456_789ABCDF, 0x3FE21FB7_8121FB78, 0x3FE20B47_0C67C0D9, 0x3FE1F704_7DC11F70, 0x3FE1E2EF_3B3FB874, 0x3FE1CF06_ADA2811D, 0x3FE1BB4A_4046ED29, 0x3FE1A7B9_611A7B96, 0x3FE19453_808CA29C, 0x3FE18118_11811812, 0x3FE16E06_89427379, 0x3FE15B1E_5F75270D, 0x3FE1485F_0E0ACD3B, 0x3FE135C8_1135C811, 0x3FE12358_E75D3033, 0x3FE11111_11111111, 0x3FE0FEF0_10FEF011, 0x3FE0ECF5_6BE69C90, 0x3FE0DB20_A88F4696, 0x3FE0C971_4FBCDA3B, 0x3FE0B7E6_EC259DC8, 0x3FE0A681_0A6810A7, 0x3FE0953F_39010954, 0x3FE08421_08421084, 0x3FE07326_0A47F7C6, 0x3FE0624D_D2F1A9FC, 0x3FE05197_F7D73404, 0x3FE04104_10410410, 0x3FE03091_B51F5E1A, 0x3FE02040_81020408, 0x3FE01010_10101010, 0x3FE00000_00000000, ]() @always_inline("nodebug") fn _get_log_fraction1_lead[dtype: DType]() -> FloatTable[129, dtype]: """Returns the table entries of `log_fraction1_lead`.""" assert_float_dtype["dtype", dtype]() @parameter if dtype == DType.float32: return FloatTable[129, dtype].from_hexadecimal_values[ 0x0000_0000, 0x3BFF_0000, 0x3C7E_0000, 0x3CBD_C000, 0x3CFC_0000, 0x3D1C_F000, 0x3D3B_A000, 0x3D5A_1000, 0x3D78_5000, 0x3D8B_2800, 0x3D9A_0800, 0x3DA8_D800, 0x3DB7_8000, 0x3DC6_1800, 0x3DD4_9000, 0x3DE2_F000, 0x3DF1_3800, 0x3DFF_6000, 0x3E06_B800, 0x3E0D_B800, 0x3E14_A800, 0x3E1B_8C00, 0x3E22_6800, 0x3E29_3400, 0x3E2F_F800, 0x3E36_B000, 0x3E3D_5C00, 0x3E43_FC00, 0x3E4A_9000, 0x3E51_1C00, 0x3E57_9C00, 0x3E5E_1400, 0x3E64_7C00, 0x3E6A_E000, 0x3E71_3800, 0x3E77_8400, 0x3E7D_C800, 0x3E82_0000, 0x3E85_1800, 0x3E88_2C00, 0x3E8B_3A00, 0x3E8E_4400, 0x3E91_4A00, 0x3E94_4A00, 0x3E97_4600, 0x3E9A_3E00, 0x3E9D_3200, 0x3EA0_2000, 0x3EA3_0C00, 0x3EA5_F200, 0x3EA8_D400, 0x3EAB_B200, 0x3EAE_8C00, 0x3EB1_6400, 0x3EB4_3600, 0x3EB7_0400, 0x3EB9_CE00, 0x3EBC_9400, 0x3EBF_5600, 0x3EC2_1600, 0x3EC4_D000, 0x3EC7_8800, 0x3ECA_3C00, 0x3ECC_EC00, 0x3ECF_9800, 0x3ED2_4200, 0x3ED4_E600, 0x3ED7_8800, 0x3EDA_2600, 0x3EDC_C200, 0x3EDF_5A00, 0x3EE1_EE00, 0x3EE4_7E00, 0x3EE7_0C00, 0x3EE9_9600, 0x3EEC_1E00, 0x3EEE_A200, 0x3EF1_2400, 0x3EF3_A200, 0x3EF6_1C00, 0x3EF8_9400, 0x3EFB_0800, 0x3EFD_7A00, 0x3EFF_E800, 0x3F01_2A00, 0x3F02_5E00, 0x3F03_9100, 0x3F04_C300, 0x3F05_F300, 0x3F07_2200, 0x3F08_4F00, 0x3F09_7B00, 0x3F0A_A600, 0x3F0B_CF00, 0x3F0C_F700, 0x3F0E_1D00, 0x3F0F_4200, 0x3F10_6600, 0x3F11_8900, 0x3F12_AA00, 0x3F13_CA00, 0x3F14_E900, 0x3F16_0700, 0x3F17_2300, 0x3F18_3E00, 0x3F19_5800, 0x3F1A_7100, 0x3F1B_8800, 0x3F1C_9F00, 0x3F1D_B400, 0x3F1E_C800, 0x3F1F_DA00, 0x3F20_EC00, 0x3F21_FC00, 0x3F23_0C00, 0x3F24_1A00, 0x3F25_2700, 0x3F26_3300, 0x3F27_3E00, 0x3F28_4800, 0x3F29_5100, 0x3F2A_5900, 0x3F2B_5F00, 0x3F2C_6500, 0x3F2D_6A00, 0x3F2E_6D00, 0x3F2F_7000, 0x3F30_7100, 0x3F31_7200, ]() else: # dtype == DType.float64 return FloatTable[129, dtype].from_hexadecimal_values[ 0x00000000_00000000, 0x3F7FE02A_6B000000, 0x3F8FC0A8_B0F00000, 0x3F97B91B_07D00000, 0x3F9F829B_0E780000, 0x3FA39E87_B9FC0000, 0x3FA77458_F6300000, 0x3FAB42DD_71180000, 0x3FAF0A30_C0100000, 0x3FB16536_EEA20000, 0x3FB341D7_961A0000, 0x3FB51B07_3F060000, 0x3FB6F0D2_8AE40000, 0x3FB8C345_D6300000, 0x3FBA926D_3A4A0000, 0x3FBC5E54_8F5A0000, 0x3FBE2707_6E2A0000, 0x3FBFEC91_31DA0000, 0x3FC0D77E_7CD00000, 0x3FC1B72A_D52F0000, 0x3FC29552_F81F0000, 0x3FC371FC_201E0000, 0x3FC44D2B_6CCB0000, 0x3FC526E5_E3A10000, 0x3FC5FF30_70A70000, 0x3FC6D60F_E7190000, 0x3FC7AB89_02100000, 0x3FC87FA0_65200000, 0x3FC9525A_9CF40000, 0x3FCA23BC_1FE20000, 0x3FCAF3C9_4E800000, 0x3FCBC286_742D0000, 0x3FCC8FF7_C79A0000, 0x3FCD5C21_6B4F0000, 0x3FCE2707_6E2A0000, 0x3FCEF0AD_CBDC0000, 0x3FCFB918_6D5E0000, 0x3FD04025_94B48000, 0x3FD0A324_E2738000, 0x3FD1058B_F9AE0000, 0x3FD1675C_ABAB8000, 0x3FD1C898_C1698000, 0x3FD22941_FBCF0000, 0x3FD2895A_13DE8000, 0x3FD2E8E2_BAE10000, 0x3FD347DD_9A980000, 0x3FD3A64C_55690000, 0x3FD40430_86868000, 0x3FD4618B_C21C0000, 0x3FD4BE5F_95770000, 0x3FD51AAD_872D8000, 0x3FD57677_17450000, 0x3FD5D1BD_BF580000, 0x3FD62C82_F2B98000, 0x3FD686C8_1E9B0000, 0x3FD6E08E_AA2B8000, 0x3FD739D7_F6BB8000, 0x3FD792A5_5FDD0000, 0x3FD7EAF8_3B828000, 0x3FD842D1_DA1E8000, 0x3FD89A33_86C10000, 0x3FD8F11E_87360000, 0x3FD94794_1C210000, 0x3FD99D95_81178000, 0x3FD9F323_ECBF8000, 0x3FDA4840_90E58000, 0x3FDA9CEC_9A9A0000, 0x3FDAF129_32470000, 0x3FDB44F7_7BCC8000, 0x3FDB9858_96930000, 0x3FDBEB4D_9DA70000, 0x3FDC3DD7_A7CD8000, 0x3FDC8FF7_C79A8000, 0x3FDCE1AF_0B858000, 0x3FDD32FE_7E008000, 0x3FDD83E7_258A0000, 0x3FDDD46A_04C18000, 0x3FDE2488_1A7C0000, 0x3FDE7442_61D68000, 0x3FDEC399_D2468000, 0x3FDF128F_5FAF0000, 0x3FDF6123_FA700000, 0x3FDFAF58_8F788000, 0x3FDFFD2E_08578000, 0x3FE02552_A5A5C000, 0x3FE04BDF_9DA90000, 0x3FE0723E_5C1CC000, 0x3FE0986F_4F570000, 0x3FE0BE72_E4250000, 0x3FE0E449_85D1C000, 0x3FE109F3_9E2D4000, 0x3FE12F71_9593C000, 0x3FE154C3_D2F4C000, 0x3FE179EA_BBD88000, 0x3FE19EE6_B467C000, 0x3FE1C3B8_1F710000, 0x3FE1E85F_5E704000, 0x3FE20CDC_D1928000, 0x3FE23130_D7BE8000, 0x3FE2555B_CE98C000, 0x3FE2795E_12898000, 0x3FE29D37_FEC28000, 0x3FE2C0E9_ED448000, 0x3FE2E474_36E40000, 0x3FE307D7_334F0000, 0x3FE32B13_39120000, 0x3FE34E28_9D9CC000, 0x3FE37117_B5474000, 0x3FE393E0_D3560000, 0x3FE3B684_49FFC000, 0x3FE3D902_6A714000, 0x3FE3FB5B_84D14000, 0x3FE41D8F_E8464000, 0x3FE43F9F_E2F9C000, 0x3FE4618B_C21C4000, 0x3FE48353_D1EA8000, 0x3FE4A4F8_5DB00000, 0x3FE4C679_AFCCC000, 0x3FE4E7D8_11B74000, 0x3FE50913_CC014000, 0x3FE52A2D_265BC000, 0x3FE54B24_67998000, 0x3FE56BF9_D5B3C000, 0x3FE58CAD_B5CD4000, 0x3FE5AD40_4C358000, 0x3FE5CDB1_DC6C0000, 0x3FE5EE02_A9240000, 0x3FE60E32_F4478000, 0x3FE62E42_FEFA0000, ]() @always_inline("nodebug") fn _get_log_fraction1_trail[dtype: DType]() -> FloatTable[129, dtype]: """Returns the table entries of `log_fraction1_trail`.""" assert_float_dtype["dtype", dtype]() @parameter if dtype == DType.float32: return FloatTable[129, dtype].from_hexadecimal_values[ 0x0000_0000, 0x3429_AC42, 0x35A8_B0FC, 0x368D_83EB, 0x3726_C39E, 0x3687_B9FF, 0x3631_EC66, 0x36DD_7119, 0x35C3_0046, 0x365B_BA8E, 0x3757_961C, 0x34E7_E0C3, 0x3752_8AE5, 0x368B_AC63, 0x36DA_7496, 0x36A9_1EB8, 0x34ED_C55E, 0x3711_31DC, 0x377C_F9A1, 0x36AB_54BE, 0x3725_F040, 0x3778_403D, 0x36AD_B32E, 0x374B_C743, 0x36C1_C29E, 0x35FE_719D, 0x3590_210E, 0x3681_9483, 0x3735_39E9, 0x36F0_7F8B, 0x3712_9D01, 0x354E_85B2, 0x376F_8F35, 0x3685_AD3F, 0x356D_C55E, 0x36B7_2F71, 0x3643_6AF2, 0x3716_52D3, 0x3713_89CE, 0x363F_9AE5, 0x36E5_5D5D, 0x36C6_0B4D, 0x34FD_E7BD, 0x36D0_9EF4, 0x370A_EB84, 0x36EC_D4C4, 0x3645_5694, 0x3742_1A1B, 0x363C_21C6, 0x36FC_ABBC, 0x3736_1CB8, 0x375C_5D15, 0x3776_FD60, 0x353C_AE72, 0x3601_E9B1, 0x366A_A2BA, 0x36BF_B5DF, 0x3715_7F75, 0x3760_EE0B, 0x368E_D0F4, 0x374E_1B05, 0x36F4_39B3, 0x36A0_E109, 0x36AC_08BF, 0x370F_B2FE, 0x3410_E5BB, 0x3732_6A68, 0x3724_C91E, 0x375D_EF32, 0x36C4_B499, 0x3659_DA72, 0x36BD_3E6D, 0x375F_1E6A, 0x373C_2E18, 0x3779_F804, 0x371C_9629, 0x3728_1307, 0x3601_A7C7, 0x3518_75A2, 0x36CE_9234, 0x3675_FAF0, 0x370F_E9C1, 0x36C4_7BC8, 0x3738_2160, 0x3715_2D2F, 0x377C_ED49, 0x3772_E0E7, 0x36F4_F573, 0x3717_2129, 0x3698_5D1D, 0x371C_F16A, 0x370C_AC9F, 0x35F4_BD35, 0x36AB_BD8A, 0x3656_8CF9, 0x3740_FB8A, 0x377A_F382, 0x3766_8C95, 0x3706_BDF6, 0x375E_74C8, 0x3770_944E, 0x373F_F616, 0x369E_D449, 0x3721_B720, 0x3739_9A79, 0x3719_C891, 0x3689_D9CE, 0x373D_AA3A, 0x34D3_562A, 0x3609_4000, 0x359A_9C56, 0x375C_268B, 0x36FE_8467, 0x377F_17CE, 0x36BC_21C6, 0x371E_8F54, 0x3742_ED82, 0x374D_7E67, 0x3740_8DBB, 0x371E_600B, 0x36D2_65BC, 0x360C_F333, 0x374E_ADA0, 0x36DB_5CD8, 0x3418_6B3E, 0x370E_E361, 0x35AA_4906, 0x3717_A23C, 0x35BF_BE8E, ]() else: # dtype == DType.float64 return FloatTable[129, dtype].from_hexadecimal_values[ 0x00000000_00000000, 0x3D706788_FC376904, 0x3D7807C7_9F3DB4EA, 0x3D76C46A_A49FD532, 0x3D298026_7C7E09E4, 0x3D75EAFD_480AD901, 0x3D76E7E2_31A7950F, 0x3D671BEC_28D14C7E, 0x3D662A66_17CC9717, 0x3D77AE0E_8625C174, 0x3D7D1D09_29983761, 0x3D383F69_278E686A, 0x3D76B4B9_BE499B9F, 0x3D79B20F_5ACB42A6, 0x3D6AAC6C_A17A4554, 0x3D7C7431_5D617EF8, 0x3D6E5CBD_3D50FFFC, 0x3D7EABAA_A2E519A0, 0x3D71CB2C_D2EE2F48, 0x3D69E80A_41811A39, 0x3D7EA469_80BB8E20, 0x3D71EE87_79B2D8AC, 0x3D6F4799_F4F6543E, 0x3D7686F4_5C803ADC, 0x3D727A79_0E7C4141, 0x3D7A4391_AA8ECB8A, 0x3D7B2123_7C6D65AD, 0x3D792212_04012030, 0x3D65AD1D_904C1D4E, 0x3D76AC63_26E2360F, 0x3D77FE5B_19CC0327, 0x3D719AC5_3F39D122, 0x3D734435_84BB03DE, 0x3D77722B_7221ACBF, 0x3D7E5CBD_3D50FFFC, 0x3D664D94_8637950E, 0x3D5F1546_AAA3361C, 0x3D741036_B89EF42D, 0x3D50E35F_73F7A018, 0x3D72B546_27E82AD3, 0x3D630701_CE63EAB9, 0x3D59FAFB_C68E7540, 0x3D7E5968_90A14F6A, 0x3D3A8D7A_D24C13F0, 0x3D5D309C_2CC91A85, 0x3D7F5535_9159D3FB, 0x3D717A71_CBCD735D, 0x3D63F1DE_86093EFA, 0x3D77B09F_42DECDED, 0x3D7E2836_D326527E, 0x3D7E0B42_724F5834, 0x3D769B15_26ADB283, 0x3D4394A1_1B1C1EE4, 0x3D71E54B_DBD7C8AA, 0x3D54AEC4_42BE1015, 0x3D60F1C6_09C98C6C, 0x3D7401A7_389314FF, 0x3D71E89F_057691FF, 0x3D67E1B2_59D2F3DA, 0x3D462E92_7628CBC2, 0x3D7096AD_69C62044, 0x3D78B1DF_85DA755A, 0x3D56FABA_4CDD147D, 0x3D7822B2_EA4BBB12, 0x3D584BF2_B68D766F, 0x3D6D8515_FE535B87, 0x3D40931A_909FEA5E, 0x3D7E1AC4_4CE11285, 0x3D4EC519_7DDB55D3, 0x3D50FB59_8FB14F89, 0x3D5B7BF7_861D37AC, 0x3D66A6B9_D9E0A5BD, 0x3D5A21AC_25D81EF3, 0x3D7CFADE_DF4AF2AB, 0x3D7AF558_77B232FB, 0x3D679F28_28ADD176, 0x3D71282F_B989A927, 0x3D7B0987_2F63D165, 0x3D3E1F8D_F68DBCF3, 0x3D49802E_B9DCA7E7, 0x3D3BB2CD_720EC44C, 0x3D645630_A2B61E5B, 0x3D7CC7B6_6BECF93B, 0x3D7D2615_65F40D93, 0x3D60FEC6_9C695D7F, 0x3D736932_FE608046, 0x3D6F404E_57963891, 0x3D7A905C_8FED4A80, 0x3D75415B_4C4BDD9A, 0x3D5917ED_D5CBBD2D, 0x3D592DFB_C7D93617, 0x3D77DE29_80918CE4, 0x3D65E9A9_8F33A396, 0x3D69A0BF_C60E6FA0, 0x3D52DD98_B97BAEF0, 0x3D7E125E_4A7C7670, 0x3D1A07BD_8B34BE7C, 0x3D75B6C9_A81E87BB, 0x3D7FA141_6F1B4391, 0x3D7BE59E_021D6D69, 0x3D788D75_BC1F9EDD, 0x3D784564_2E6B65D3, 0x3D5D1772_F5386374, 0x3D334202_A10C3491, 0x3D60BE1F_B590A1F5, 0x3D6D7132_0556B67B, 0x3D70E98B_75C96C43, 0x3D4ED717_74092113, 0x3D750CD4_E221301B, 0x3D7E1157_C76F60C3, 0x3D66FAA4_04263D0B, 0x3D77A12D_A74EA82E, 0x3D795732_325E617A, 0x3D5CCEF4_E4F736C2, 0x3D6EC27D_0B7B37B3, 0x3D51BEE7_ABD17660, 0x3D7F5D81_13DFA3D3, 0x3D771CD8_B4766E99, 0x3D6BB09C_B0985646, 0x3D7435A5_E59D2D86, 0x3D46ABB9_DF22BC57, 0x3D6497A9_15428B44, 0x3D79CCA0_8E310B9B, 0x3D7CC498_49792ECA, 0x3D6F2CFB_29AAA5F0, 0x3D67648C_F6E3C5D7, 0x3D667570_D6095FD2, 0x3D51B194_F912B417, 0x3D7CF79A_BC9E3B3A, ]() @register_passable("trivial") struct LogConstants[dtype: DType]: """Provides constants for the implementation of logarithm functions. Set `fraction1[j] = 1 + j / 128` for `j = 0, 1, ..., 128`. We computed the tables `inv_fraction1`, `log_fraction1_lead`, and `log_fraction1_trail` as follows: 1. Set `N = 16` for single precision, and set `N = 39` for double precision; 2. `inv_fraction1[j] = 1 / fraction1[j]`; 3. `log_fraction1_lead[j] = 2**(-N) * trunc(2**N * log(fraction1[j]))`; and 4. `log_fraction1_trail[j] = log(fraction1[j]) - log_fraction1_lead[j]`. Parameters: dtype: The data type of the constants. Constraints: The parameter `dtype` must be `float32` or `float64`. """ alias inv_fraction1 = _get_inv_fraction1[dtype]() """The reciprocal of `fraction1[j]` for `j = 0, 1, ..., 128`.""" alias log_fraction1_lead = _get_log_fraction1_lead[dtype]() """The leading bits of `log(fraction1[j])` for `j = 0, 1, ..., 128`.""" alias log_fraction1_trail = _get_log_fraction1_trail[dtype]() """The trailing bits of `log(fraction1[j])` for `j = 0, 1, ..., 128`.""" --- src/specials/elementary/exp.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # References: # # Tang, P. T. P. (1989). Table-driven implementation of the exponential function # in IEEE floating-point arithmetic. # ACM Transactions on Mathematical Software (TOMS), 15(2), 144-157. # https://doi.org/10.1145/63522.214389 """Implements the exponential function.""" import math from memory.unsafe import bitcast from specials._internal import math as math_lib from specials._internal.asserting import assert_float_dtype from specials._internal.polynomial import Polynomial from specials.elementary.common_constants import ExpTable @always_inline fn _exp_impl[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the exponential function as specified in the reference paper. """ var safe_x = cond.select(x, 1.0) var index: SIMD[DType.int32, simd_width] var exponent: SIMD[DType.int32, simd_width] var expm1_r: SIMD[dtype, simd_width] @parameter if dtype == DType.float32: alias inv_ln2_over_32: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint32 ]( 0x4238_AA3B, ) alias ln2_over_32_lead: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint32 ]( 0x3CB1_7200, ) alias ln2_over_32_trail: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint32 ]( 0x333F_BE8E, ) alias polynomial = Polynomial[ 2, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3F00_0044, 0x3E2A_AAEC, ]() var xn = round(safe_x * inv_ln2_over_32) var xn2 = xn % 32.0 var xn1 = xn - xn2 var xn_is_large = (abs(xn) >= 512) var x_reduced_lead = math.fma( -xn_is_large.select(xn1, xn), ln2_over_32_lead, safe_x ) x_reduced_lead = xn_is_large.select( math.fma(-xn2, ln2_over_32_lead, x_reduced_lead), x_reduced_lead ) var x_reduced_trail = -xn * ln2_over_32_trail index = xn2.cast[DType.int32]() exponent = xn1.cast[DType.int32]() / 32 var x_reduced = x_reduced_lead + x_reduced_trail expm1_r = x_reduced_lead + ( math.fma( x_reduced * x_reduced, polynomial(x_reduced), x_reduced_trail ) ) else: # dtype == DType.float64 alias inv_ln2_over_32: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint64 ]( 0x40471547_652B82FE, ) alias ln2_over_32_lead: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint64 ]( 0x3F962E42_FEF00000, ) alias ln2_over_32_trail: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint64 ]( 0x3D8473DE_6AF278ED, ) alias polynomial = Polynomial[ 5, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3FE00000_00000000, 0x3FC55555_55548F7C, 0x3FA55555_55545D4E, 0x3F811115_B7AA905E, 0x3F56C172_8D739765, ]() var xn = round(safe_x * inv_ln2_over_32) var xn2 = xn % 32.0 var xn1 = xn - xn2 var xn_is_large = (abs(xn) >= 512) var x_reduced_lead = math.fma( -xn_is_large.select(xn1, xn), ln2_over_32_lead, safe_x ) x_reduced_lead = xn_is_large.select( math.fma(-xn2, ln2_over_32_lead, x_reduced_lead), x_reduced_lead ) var x_reduced_trail = -xn * ln2_over_32_trail index = xn2.cast[DType.int32]() exponent = xn1.cast[DType.int32]() / 32 var x_reduced = x_reduced_lead + x_reduced_trail expm1_r = x_reduced_lead + ( math.fma( x_reduced * x_reduced, polynomial(x_reduced), x_reduced_trail ) ) var s_lead = ExpTable[dtype].lead.unsafe_lookup(index) var s_trail = ExpTable[dtype].trail.unsafe_lookup(index) var s = s_lead + s_trail var mantissa = s_lead + math.fma(s, expm1_r, s_trail) return math_lib.ldexp(mantissa, exponent) fn exp[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Computes the exponential of `x`. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: A SIMD vector of floating-point values. Returns: A SIMD vector containing the exponential of `x`. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ assert_float_dtype["dtype", dtype]() alias inf: SIMD[dtype, simd_width] = math.inf[dtype]() var result: SIMD[dtype, simd_width] = math.nan[dtype]() var x_abs = abs(x) # Regions of computation var is_in_region1: SIMD[DType.bool, simd_width] # abs(x) < xeps var is_in_region2: SIMD[DType.bool, simd_width] # x > xmax var is_in_region3: SIMD[DType.bool, simd_width] # x < xmin var is_in_region4: SIMD[ DType.bool, simd_width ] # xmin <= x <= -xeps or xeps <= x <= xmax @parameter if dtype == DType.float32: alias xeps: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x3300_0000, ) # `xmax` is different from what is specified in the reference paper: # `alias xmax = math.nextafter(log(FloatLimits[dtype].max()), 0.0)` alias xmax: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x42B1_7217, ) alias xmin: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0xC2CE_8ECF, ) is_in_region1 = x_abs < xeps is_in_region2 = x > xmax is_in_region3 = x < xmin is_in_region4 = (x_abs >= xeps) & (x >= xmin) & (x <= xmax) else: # dtype == DType.float64 alias xeps: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x3C900000_00000000, ) # `xmax` is different from what is specified in the reference paper: # `alias xmax = log(FloatLimits[dtype].max())` alias xmax: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x40862E42_FEFA39EF, ) alias xmin: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0xC0874385_446D71C3, ) is_in_region1 = x_abs < xeps is_in_region2 = x > xmax is_in_region3 = x < xmin is_in_region4 = (x_abs >= xeps) & (x >= xmin) & (x <= xmax) result = is_in_region1.select[dtype](1.0, result) result = is_in_region2.select(inf, result) result = is_in_region3.select[dtype](0.0, result) if is_in_region4.reduce_or(): result = is_in_region4.select(_exp_impl(x, is_in_region4), result) return result --- src/specials/elementary/exp2.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # References: # # Tang, P. T. P. (1989). Table-driven implementation of the exponential function # in IEEE floating-point arithmetic. # ACM Transactions on Mathematical Software (TOMS), 15(2), 144-157. # https://doi.org/10.1145/63522.214389 # # Tang, P. T. P. (1991). Table-lookup algorithms for elementary functions and # their error analysis. # Proceedings 10th IEEE Symposium on Computer Arithmetic, pp. 232-236. # https://doi.org/10.1109/ARITH.1991.145565 """Implements the base-2 exponential function.""" import math from memory.unsafe import bitcast from specials._internal import math as math_lib from specials._internal.asserting import assert_float_dtype from specials._internal.polynomial import Polynomial from specials.elementary.common_constants import ExpTable @always_inline fn _exp2_impl[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the base-2 exponential function.""" # Reduction: Find the breakpoint c[k] = k/32, k = 0, 1, ..., 31 such that # |x - (m + c[k])| <= 1/64 # where m = -1, 0 or 1. Then calculate r by r = x - (m + c[k]). Note that # r is in the range [-1/64, 1/64]. # Approximation: Approximate 2^r - 1 by a polynomial p(r) whose coefficients # were obtained using Sollya: # > f = (2^x - 1)/x; # > P = fpminimax(f, 2, [|single...|], [-1/64, 1/64]); # or # > P = fpminimax(f, 5, [|D...|], [-1/64, 1/64]); # > P; # > dirtyinfnorm(f-P, [-1/64, 1/64]); # Reconstruction: Reconstruct 2^x by the relationship # 2^x ~= 2^m * (2^c[k] + 2^c[k] * p(r)) var safe_x = cond.select(x, 1.0) var index: SIMD[DType.int32, simd_width] var exponent: SIMD[DType.int32, simd_width] var exp2m1_r: SIMD[dtype, simd_width] @parameter if dtype == DType.float32: alias one_over_32: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint32 ]( 0x3D00_0000, ) alias polynomial = Polynomial[ 3, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3F31_7218, 0x3E75_FE66, 0x3D63_4D8A, ]() var xn = round(safe_x) var xf = safe_x - xn var yn = round(xf * 32.0) var yn2 = yn % 32.0 var yn1 = yn - yn2 var y_reduced = math.fma(-yn, one_over_32, xf) index = yn2.cast[DType.int32]() exponent = (xn + yn1 / 32).cast[DType.int32]() exp2m1_r = y_reduced * polynomial(y_reduced) else: # dtype == DType.float64 alias one_over_32: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint64 ]( 0x3FA00000_00000000, ) alias polynomial = Polynomial[ 6, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3FE62E42_FEFA39EF, 0x3FCEBFBD_FF82C58E, 0x3FAC6B08_D70496BC, 0x3F83B2AB_6FBCFDA6, 0x3F55D884_2A55CA01, 0x3F24308B_04A657CB, ]() var xn = round(safe_x) var xf = safe_x - xn var yn = round(xf * 32.0) var yn2 = yn % 32.0 var yn1 = yn - yn2 var y_reduced = math.fma(-yn, one_over_32, xf) index = yn2.cast[DType.int32]() exponent = (xn + yn1 / 32).cast[DType.int32]() exp2m1_r = y_reduced * polynomial(y_reduced) var s_lead = ExpTable[dtype].lead.unsafe_lookup(index) var s_trail = ExpTable[dtype].trail.unsafe_lookup(index) var s = s_lead + s_trail var mantissa = s_lead + math.fma(s, exp2m1_r, s_trail) return math_lib.ldexp(mantissa, exponent) fn exp2[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Computes the base-2 exponential of `x`. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: A SIMD vector of floating-point values. Returns: A SIMD vector containing the base-2 exponential of `x`. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ assert_float_dtype["dtype", dtype]() alias inf: SIMD[dtype, simd_width] = math.inf[dtype]() var result: SIMD[dtype, simd_width] = math.nan[dtype]() var x_abs = abs(x) # Regions of computation var is_in_region1: SIMD[DType.bool, simd_width] # abs(x) < xeps var is_in_region2: SIMD[DType.bool, simd_width] # x > xmax var is_in_region3: SIMD[DType.bool, simd_width] # x < xmin var is_in_region4: SIMD[ DType.bool, simd_width ] # xmin <= x <= -xeps or xeps <= x <= xmax @parameter if dtype == DType.float32: alias xeps: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x3300_0000, ) # `xmax` is different from what is specified in the reference paper: # `alias xmax = math.nextafter(Float32(FloatLimits[dtype].max_exponent), 0.0)` alias xmax: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x42FF_FFFF, ) alias xmin: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0xC315_0000, ) is_in_region1 = x_abs < xeps is_in_region2 = x > xmax is_in_region3 = x < xmin is_in_region4 = (x_abs >= xeps) & (x >= xmin) & (x <= xmax) else: # dtype == DType.float64 alias xeps: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x3C900000_00000000, ) # `xmax` is different from what is specified in the reference paper: # `alias xmax = math.nextafter(Float64(FloatLimits[dtype].max_exponent), 0.0)` alias xmax: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x408FFFFF_FFFFFFFF, ) alias xmin: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0xC090C800_00000000, ) is_in_region1 = x_abs < xeps is_in_region2 = x > xmax is_in_region3 = x < xmin is_in_region4 = (x_abs >= xeps) & (x >= xmin) & (x <= xmax) result = is_in_region1.select[dtype](1.0, result) result = is_in_region2.select(inf, result) result = is_in_region3.select[dtype](0.0, result) if is_in_region4.reduce_or(): result = is_in_region4.select(_exp2_impl(x, is_in_region4), result) return result --- src/specials/elementary/expm1.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # References: # # Tang, P. T. P. (1992). Table-driven implementation of the Expm1 function in # IEEE floating-point arithmetic. # ACM Transactions on Mathematical Software (TOMS), 18(2), 211-222. # https://doi.org/10.1145/146847.146928 """Implements the `expm1` function.""" import math from memory.unsafe import bitcast from specials._internal import math as math_lib from specials._internal.asserting import assert_float_dtype from specials._internal.polynomial import Polynomial from specials.elementary.common_constants import ExpTable @always_inline fn _expm1_procedure_1[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the procedure 1 of `expm1` as specified in the reference paper. """ var safe_x = cond.select(x, 1.0) var index: SIMD[DType.int32, simd_width] var exponent: SIMD[DType.int32, simd_width] var expm1_r: SIMD[dtype, simd_width] var precision_minus_1: SIMD[DType.int32, simd_width] @parameter if dtype == DType.float32: alias inv_ln2_over_32: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint32 ]( 0x4238_AA3B, ) alias ln2_over_32_lead: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint32 ]( 0x3CB1_7200, ) alias ln2_over_32_trail: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint32 ]( 0x333F_BE8E, ) alias polynomial = Polynomial[ 2, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3F00_0044, 0x3E2A_AAEC, ]() var xn = round(safe_x * inv_ln2_over_32) var xn2 = xn % 32.0 var xn1 = xn - xn2 var xn_is_large = (abs(xn) >= 512) var x_reduced_lead = math.fma( -xn_is_large.select(xn1, xn), ln2_over_32_lead, safe_x ) x_reduced_lead = xn_is_large.select( math.fma(-xn2, ln2_over_32_lead, x_reduced_lead), x_reduced_lead ) var x_reduced_trail = -xn * ln2_over_32_trail index = xn2.cast[DType.int32]() exponent = xn1.cast[DType.int32]() / 32 var x_reduced = x_reduced_lead + x_reduced_trail expm1_r = x_reduced_lead + ( math.fma( x_reduced * x_reduced, polynomial(x_reduced), x_reduced_trail ) ) precision_minus_1 = 23 # 24 - 1 else: # dtype == DType.float64 alias inv_ln2_over_32: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint64 ]( 0x40471547_652B82FE, ) alias ln2_over_32_lead: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint64 ]( 0x3F962E42_FEF00000, ) alias ln2_over_32_trail: SIMD[dtype, simd_width] = bitcast[ dtype, DType.uint64 ]( 0x3D8473DE_6AF278ED, ) alias polynomial = Polynomial[ 5, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3FE00000_00000000, 0x3FC55555_55548F7C, 0x3FA55555_55545D4E, 0x3F811115_B7AA905E, 0x3F56C172_8D739765, ]() var xn = round(safe_x * inv_ln2_over_32) var xn2 = xn % 32.0 var xn1 = xn - xn2 var xn_is_large = (abs(xn) >= 512) var x_reduced_lead = math.fma( -xn_is_large.select(xn1, xn), ln2_over_32_lead, safe_x ) x_reduced_lead = xn_is_large.select( math.fma(-xn2, ln2_over_32_lead, x_reduced_lead), x_reduced_lead ) var x_reduced_trail = -xn * ln2_over_32_trail index = xn2.cast[DType.int32]() exponent = xn1.cast[DType.int32]() / 32 var x_reduced = x_reduced_lead + x_reduced_trail expm1_r = x_reduced_lead + ( math.fma( x_reduced * x_reduced, polynomial(x_reduced), x_reduced_trail ) ) precision_minus_1 = 52 # 53 - 1 var inv_exp2 = math.ldexp[dtype, simd_width](0.25, 2 - exponent) var s_lead = ExpTable[dtype].lead.unsafe_lookup(index) var s_trail = ExpTable[dtype].trail.unsafe_lookup(index) var s = s_lead + s_trail var mantissa = (s_lead - inv_exp2) + math.fma( s_lead, expm1_r, s_trail * (1.0 + expm1_r) ) mantissa = (exponent > precision_minus_1).select( s_lead + math.fma(s, expm1_r, s_trail - inv_exp2), mantissa, ) var exponent_is_too_negative = (exponent <= -8.0) mantissa = exponent_is_too_negative.select( s_lead + math.fma(s, expm1_r, s_trail), mantissa, ) var result = math_lib.ldexp(mantissa, exponent) result = exponent_is_too_negative.select(result - 1.0, result) return result @always_inline fn _expm1_procedure_2[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the procedure 2 of `expm1` as specified in the reference paper. """ var safe_x = cond.select(x, 0.1) var x_exp2: SIMD[dtype, simd_width] var x3_gval: SIMD[dtype, simd_width] @parameter if dtype == DType.float32: alias exp2 = math.ldexp(Scalar[dtype](1.0), 16) x_exp2 = safe_x * exp2 alias g = Polynomial[ 5, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3E2A_AAAA, 0x3D2A_AAA0, 0x3C08_89FF, 0x3AB6_4DE5, 0x394A_B327, ]() x3_gval = safe_x * safe_x * safe_x * g(safe_x) else: # dtype == DType.float64 alias exp2 = math.ldexp(Scalar[dtype](1.0), 30) x_exp2 = safe_x * exp2 alias g = Polynomial[ 9, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3FC55555_55555549, 0x3FA55555_555554B6, 0x3F811111_1111A9F3, 0x3F56C16C_16CE14C6, 0x3F2A01A0_1159DD2D, 0x3EFA019F_635825C4, 0x3EC71E14_BFE3DB59, 0x3E928295_484734EA, 0x3E5A2836_AA646B96, ]() x3_gval = safe_x * safe_x * safe_x * g(safe_x) # x == x_term1 + x_term2 var x_term1 = (x_exp2 + safe_x) - x_exp2 var x_term2 = safe_x - x_term1 # x * x * 0.5 == x2_half_term1 + x2_half_term2 var x2_half_term1 = x_term1 * x_term1 * 0.5 var x2_half_term2 = x_term2 * (safe_x + x_term1) * 0.5 return (x2_half_term1 < 0.0078125).select( safe_x + (x2_half_term1 + (x3_gval + x2_half_term2)), (x_term1 + x2_half_term1) + (x3_gval + (x_term2 + x2_half_term2)), ) fn expm1[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Computes `exp(x) - 1` in a numerically stable way. This function is semantically equivalent to `exp(x) - 1`, but it is more accurate for `x` close to zero. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: A SIMD vector of floating-point values. Returns: A SIMD vector containing the expression `exp(x) - 1` evaluated at `x`. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ assert_float_dtype["dtype", dtype]() alias inf: SIMD[dtype, simd_width] = math.inf[dtype]() var result: SIMD[dtype, simd_width] = math.nan[dtype]() var x_abs = abs(x) # Regions of computation var is_in_region1: SIMD[DType.bool, simd_width] # Em1_Tiny | Em1_Zero var is_in_region2: SIMD[DType.bool, simd_width] # Em1_Pos | Em1_+Inf var is_in_region3: SIMD[DType.bool, simd_width] # Em1_Neg | Em1_-Inf var is_in_region4: SIMD[DType.bool, simd_width] # T_1 < x < T_2 var is_in_region5: SIMD[ DType.bool, simd_width ] # T- <= x <= T_1 | T_2 <= x <= T+ @parameter if dtype == DType.float32: alias xeps: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x3300_0000, ) alias xsml_inf: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0xBE93_4B11, ) alias xsml_sup: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x3E64_7FBF, ) alias xmin: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0xC18A_A122, ) # `xmax` is different from what is specified in the reference paper: # `alias xmax = math.nextafter(log(FloatLimits[dtype].max()), 0.0)` alias xmax: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x42B1_7217, ) is_in_region1 = x_abs < xeps is_in_region2 = x > xmax is_in_region3 = x < xmin is_in_region4 = ~is_in_region1 & (x > xsml_inf) & (x < xsml_sup) is_in_region5 = ((x >= xmin) & (x <= xsml_inf)) | ( (x >= xsml_sup) & (x <= xmax) ) else: # dtype == DType.float64 alias xeps: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x3C900000_00000000, ) alias xsml_inf: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0xBFD26962_1134DB93, ) alias xsml_sup: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x3FCC8FF7_C79A9A22, ) alias xmin: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0xC042B708_872320E1, ) # `xmax` is different from what is specified in the reference paper: # `alias xmax = log(FloatLimits[dtype].max())` alias xmax: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x40862E42_FEFA39EF, ) is_in_region1 = x_abs < xeps is_in_region2 = x > xmax is_in_region3 = x < xmin is_in_region4 = ~is_in_region1 & (x > xsml_inf) & (x < xsml_sup) is_in_region5 = ((x >= xmin) & (x <= xsml_inf)) | ( (x >= xsml_sup) & (x <= xmax) ) result = is_in_region1.select(x, result) result = is_in_region2.select(inf, result) result = is_in_region3.select[dtype](-1.0, result) if is_in_region4.reduce_or(): result = is_in_region4.select( _expm1_procedure_2(x, is_in_region4), result ) if is_in_region5.reduce_or(): result = is_in_region5.select( _expm1_procedure_1(x, is_in_region5), result ) return result --- src/specials/elementary/log.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # References: # # Tang, P. T. P. (1990). Table-driven implementation of the logarithm function # in IEEE floating-point arithmetic. # ACM Transactions on Mathematical Software (TOMS), 16(4), 378-400. # https://doi.org/10.1145/98267.98294 """Implements the logarithm function.""" import math from memory.unsafe import bitcast from specials._internal.asserting import assert_float_dtype from specials._internal.math import ldexp from specials._internal.polynomial import Polynomial from specials.elementary.common_constants import LogConstants from specials.utils.numerics import FloatLimits # TODO: Try to further improve the performance of the `log` function. @always_inline fn _log_procedure_1[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the procedure 1 of `log` as specified in the reference paper. """ var safe_x = cond.select(x, 1.0) var fraction_and_exponent = math.frexp(safe_x) var fraction = 2.0 * fraction_and_exponent[0] var exponent = fraction_and_exponent[1] - 1 var fraction1 = ldexp(round(ldexp(fraction, 7)), -7) var fraction2 = fraction - fraction1 var index = round(ldexp(fraction1 - 1.0, 7)).cast[DType.int32]() var log2_lead = LogConstants[dtype].log_fraction1_lead.get[128]() var log2_trail = LogConstants[dtype].log_fraction1_trail.get[128]() var result1 = math.fma[dtype, simd_width]( exponent, log2_lead, LogConstants[dtype].log_fraction1_lead.unsafe_lookup(index), ) var result2 = math.fma[dtype, simd_width]( exponent, log2_trail, LogConstants[dtype].log_fraction1_trail.unsafe_lookup(index), ) var u = fraction2 * LogConstants[dtype].inv_fraction1.unsafe_lookup(index) var u_squared_times_pval: SIMD[dtype, simd_width] # We use Sollya to find a polynomial p such that p(u) best approximates the # function f(u) = (log1p(u) - u)/u**2 on the given interval: # > min_value = -2^(-8); # > max_value = -min_value; # > f = (log1p(u) - u)/u^2; # > P = fpminimax(f, 1, [|single...|], [min_value, max_value]); # or # > P = fpminimax(f, 4, [|D...|], [min_value, max_value]); # > P; # > dirtyinfnorm(f-P, [min_value, max_value]); @parameter if dtype == DType.float32: alias p = Polynomial[ 2, dtype, simd_width ].from_hexadecimal_coefficients[ 0xBF00_0020, 0x3EAA_AAE6, ]() u_squared_times_pval = u * u * p(u) else: # dtype == DType.float64 alias p = Polynomial[ 5, dtype, simd_width ].from_hexadecimal_coefficients[ 0xBFE00000_00000000, 0x3FD55555_555279E5, 0xBFCFFFFF_FFFA0C2B, 0x3FC999B0_7518C512, 0xBFC5556A_79F895CB, ]() u_squared_times_pval = u * u * p(u) result2 = u + (u_squared_times_pval + result2) return result1 + result2 @always_inline fn _log_procedure_2[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the procedure 2 of `log` as specified in the reference paper. """ var y = cond.select(x - 1.0, 1.0) var inv_y_plus_two = 1.0 / (y + 2.0) var u = 2.0 * y * inv_y_plus_two var u_squared = u * u var u_cubed_times_pval: SIMD[dtype, simd_width] var precision_shift: Int # We use Sollya to find an even polynomial p such that p(u) best approximates # (log1p(2*u/(2 - u)) - u)/u**3 on the given interval: # > min_value = (2 - 2*exp(1/16))/(1 + exp(1/16)); # > max_value = -min_value; # > f = (log1p(2*u/(2 - u)) - u)/u^3; # > P = fpminimax(f, [|0,2|], [|single...|], [min_value, max_value]); # or # > P = fpminimax(f, [|0,2,4,6|], [|D...|], [min_value, max_value]); # > P; # > dirtyinfnorm(f-P, [min_value, max_value]); @parameter if dtype == DType.float32: alias p = Polynomial[ 2, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3DAA_AAAA, 0x3C4C_F264, ]() u_cubed_times_pval = u * u_squared * p(u_squared) # precision_shift: 24 - 12 + 1 precision_shift = 13 else: # dtype == DType.float64 alias p = Polynomial[ 4, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3FB55555_5555554A, 0x3F899999_99A528F3, 0x3F624923_AA1832F2, 0x3F3C7D68_D285CA94, ]() u_cubed_times_pval = u * u_squared * p(u_squared) # precision_shift: 53 - 24 + 1 precision_shift = 30 # (u == u_term1 + u_term2) and (y == y_term1 + y_term2) var u_precision_scale = ldexp(u, precision_shift) var u_term1 = (u_precision_scale + u) - u_precision_scale var y_precision_scale = ldexp(y, precision_shift) var y_term1 = (y_precision_scale + y) - y_precision_scale var y_term2 = y - y_term1 var u_term2 = inv_y_plus_two * ( math.fma( -u_term1, y_term2, math.fma(-u_term1, y_term1, 2.0 * (y - u_term1)) ) ) return u_term1 + (u_term2 + u_cubed_times_pval) fn log[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Computes the natural logarithm of `x`. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: A SIMD vector of floating-point values. Returns: A SIMD vector containing the natural logarithm of `x`. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ assert_float_dtype["dtype", dtype]() alias inf: SIMD[dtype, simd_width] = math.inf[dtype]() alias log2: SIMD[dtype, simd_width] = 0.6931471805599453 alias digits: SIMD[dtype, simd_width] = FloatLimits[dtype].digits alias xmin: SIMD[dtype, simd_width] = FloatLimits[dtype].min() var result: SIMD[dtype, simd_width] = math.nan[dtype]() var x_abs = abs(x) # Regions of computation var is_in_region1 = (x == inf) var is_in_region2 = (x_abs == 0.0) var is_in_region3 = (x == 1.0) var is_in_region4: SIMD[ DType.bool, simd_width ] # (x != 1.0) & (x > xone_inf) & (x < xone_sup) var is_in_region5: SIMD[DType.bool, simd_width] = (x > 0.0) & (x < xmin) var is_in_region6: SIMD[ DType.bool, simd_width ] # ((x >= xmin) & (x <= xone_inf)) | ((x >= xone_sup) & (x < inf)) @parameter if dtype == DType.float32: alias xone_inf: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x3F70_7D5F, ) alias xone_sup: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x3F88_415B, ) is_in_region4 = (x != 1.0) & (x > xone_inf) & (x < xone_sup) is_in_region6 = ((x >= xmin) & (x <= xone_inf)) | ( (x >= xone_sup) & (x < inf) ) else: # dtype == DType.float64 alias xone_inf: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x3FEE0FAB_FBC702A3, ) alias xone_sup: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x3FF1082B_577D34EE, ) is_in_region4 = (x != 1.0) & (x > xone_inf) & (x < xone_sup) is_in_region6 = ((x >= xmin) & (x <= xone_inf)) | ( (x >= xone_sup) & (x < inf) ) result = is_in_region1.select(x, result) result = is_in_region2.select(-inf, result) result = is_in_region3.select[dtype](0.0, result) # TODO: Should we avoid creating runtime branches to be accelerator friendly? if is_in_region4.reduce_or(): result = is_in_region4.select( _log_procedure_2(x, is_in_region4), result ) if is_in_region5.reduce_or(): # For handling subnormal numbers, we use the following identity: # log(x) = -scale * log(2) + log(x * 2**scale) var scale = is_in_region5.select(digits - 1, 0.0) result = is_in_region5.select( math.fma( -scale, log2, _log_procedure_1( math.ldexp(x, scale.cast[DType.int32]()), is_in_region5 ), ), result, ) if is_in_region6.reduce_or(): result = is_in_region6.select( _log_procedure_1(x, is_in_region6), result ) return result --- src/specials/elementary/log1p.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # References: # # Tang, P. T. P. (1990). Table-driven implementation of the logarithm function # in IEEE floating-point arithmetic. # ACM Transactions on Mathematical Software (TOMS), 16(4), 378-400. # https://doi.org/10.1145/98267.98294 """Implements the `log1p` function.""" import math from memory.unsafe import bitcast from specials._internal.asserting import assert_float_dtype from specials._internal.math import ldexp from specials._internal.polynomial import Polynomial from specials.elementary.common_constants import LogConstants from specials.utils.numerics import FloatLimits @always_inline fn _log1p_procedure_1[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the procedure 1 of `log1p` as specified in the reference paper. """ alias max_exponent = FloatLimits[dtype].max_exponent - 1 alias significant_bits = FloatLimits[dtype].digits alias threshold = 2 ** (significant_bits + 2) var safe_x = cond.select(x, 1.0) var y = (safe_x < threshold).select(1.0 + safe_x, safe_x) var fraction_and_exponent = math.frexp(y) var fraction = 2.0 * fraction_and_exponent[0] var exponent = fraction_and_exponent[1] - 1 var fraction1 = ldexp(round(ldexp(fraction, 7)), -7) var index = round(ldexp(fraction1 - 1.0, 7)).cast[DType.int32]() var power_of_two = ldexp[dtype, simd_width]( 1.0, -exponent.cast[DType.int32]() ) var x_times_power_of_two = safe_x * power_of_two var fraction2 = ((exponent <= -2) | (exponent >= max_exponent)).select( fraction - fraction1, (exponent >= significant_bits).select( (x_times_power_of_two - fraction1) + power_of_two, (power_of_two - fraction1) + x_times_power_of_two, ), ) var log2_lead = LogConstants[dtype].log_fraction1_lead.get[128]() var log2_trail = LogConstants[dtype].log_fraction1_trail.get[128]() var result1 = math.fma[dtype, simd_width]( exponent, log2_lead, LogConstants[dtype].log_fraction1_lead.unsafe_lookup(index), ) var result2 = math.fma[dtype, simd_width]( exponent, log2_trail, LogConstants[dtype].log_fraction1_trail.unsafe_lookup(index), ) var u = fraction2 * LogConstants[dtype].inv_fraction1.unsafe_lookup(index) var u_squared_times_pval: SIMD[dtype, simd_width] # We use Sollya to find a polynomial p such that p(u) best approximates the # function f(u) = (log1p(u) - u)/u**2 on the given interval: # > min_value = -2^(-8); # > max_value = -min_value; # > f = (log1p(u) - u)/u^2; # > P = fpminimax(f, 1, [|single...|], [min_value, max_value]); # or # > P = fpminimax(f, 4, [|D...|], [min_value, max_value]); # > P; # > dirtyinfnorm(f-P, [min_value, max_value]); @parameter if dtype == DType.float32: alias p = Polynomial[ 2, dtype, simd_width ].from_hexadecimal_coefficients[ 0xBF00_0020, 0x3EAA_AAE6, ]() u_squared_times_pval = u * u * p(u) else: # dtype == DType.float64 alias p = Polynomial[ 5, dtype, simd_width ].from_hexadecimal_coefficients[ 0xBFE00000_00000000, 0x3FD55555_555279E5, 0xBFCFFFFF_FFFA0C2B, 0x3FC999B0_7518C512, 0xBFC5556A_79F895CB, ]() u_squared_times_pval = u * u * p(u) result2 = u + (u_squared_times_pval + result2) return result1 + result2 @always_inline fn _log1p_procedure_2[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the procedure 2 of `log1p` as specified in the reference paper. """ var safe_x = cond.select(x, 0.0) var inv_x_plus_two = 1.0 / (safe_x + 2.0) var u = 2.0 * safe_x * inv_x_plus_two var u_squared = u * u var u_cubed_times_pval: SIMD[dtype, simd_width] var precision_shift: Int # We use Sollya to find an even polynomial p such that p(u) best approximates # (log1p(2*u/(2 - u)) - u)/u**3 on the given interval: # > min_value = (2 - 2*exp(1/16))/(1 + exp(1/16)); # > max_value = -min_value; # > f = (log1p(2*u/(2 - u)) - u)/u^3; # > P = fpminimax(f, [|0,2|], [|single...|], [min_value, max_value]); # or # > P = fpminimax(f, [|0,2,4,6|], [|D...|], [min_value, max_value]); # > P; # > dirtyinfnorm(f-P, [min_value, max_value]); @parameter if dtype == DType.float32: alias p = Polynomial[ 2, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3DAA_AAAA, 0x3C4C_F264, ]() u_cubed_times_pval = u * u_squared * p(u_squared) # precision_shift: 24 - 12 + 1 precision_shift = 13 else: # dtype == DType.float64 alias p = Polynomial[ 4, dtype, simd_width ].from_hexadecimal_coefficients[ 0x3FB55555_5555554A, 0x3F899999_99A528F3, 0x3F624923_AA1832F2, 0x3F3C7D68_D285CA94, ]() u_cubed_times_pval = u * u_squared * p(u_squared) # precision_shift: 53 - 24 + 1 precision_shift = 30 # (u == u_term1 + u_term2) and (x == x_term1 + x_term2) var u_precision_scale = ldexp(u, precision_shift) var u_term1 = (u_precision_scale + u) - u_precision_scale var x_precision_scale = ldexp(safe_x, precision_shift) var x_term1 = (x_precision_scale + safe_x) - x_precision_scale var x_term2 = safe_x - x_term1 var u_term2 = inv_x_plus_two * ( math.fma( -u_term1, x_term2, math.fma(-u_term1, x_term1, 2.0 * (safe_x - u_term1)), ) ) return u_term1 + (u_term2 + u_cubed_times_pval) @always_inline fn _log1p_procedure_3[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], cond: SIMD[DType.bool, simd_width]) -> SIMD[ dtype, simd_width ]: """Implements the procedure of `log1p` for when `x` is tiny.""" alias smallest_subnormal = FloatLimits[dtype].denorm_min() var safe_x = cond.select(x, 0.5 * FloatLimits[dtype].epsilon_neg()) return 0.125 * math.fma[dtype, simd_width](8.0, safe_x, -smallest_subnormal) fn log1p[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Computes `log(1 + x)` in a numerically stable way. This function is semantically equivalent to `log(1 + x)`, but it is more accurate for `x` close to zero. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: A SIMD vector of floating-point values. Returns: A SIMD vector containing the expression `log(1 + x)` evaluated at `x`. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ assert_float_dtype["dtype", dtype]() alias epsneg = FloatLimits[dtype].epsilon_neg() alias inf: SIMD[dtype, simd_width] = math.inf[dtype]() var result: SIMD[dtype, simd_width] = math.nan[dtype]() var x_abs = abs(x) # Regions of computation var is_in_region1 = (x == inf) var is_in_region2 = (x_abs == 0.0) var is_in_region3 = (x == -1.0) var is_in_region4 = (x_abs != 0.0) & (x_abs < epsneg) var is_in_region5: SIMD[ DType.bool, simd_width ] # (x_abs >= epsneg) & (x > xsml_inf) & (x < xsml_sup) var is_in_region6: SIMD[ DType.bool, simd_width ] # ((x > -1.0) & (x <= xsml_inf)) | ((x >= xsml_sup) & (x < inf)) @parameter if dtype == DType.float32: alias xsml_inf: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0xBD78_2A03, ) alias xsml_sup: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint32]( 0x3D84_15AC, ) is_in_region5 = (x_abs >= epsneg) & (x > xsml_inf) & (x < xsml_sup) is_in_region6 = ((x > -1.0) & (x <= xsml_inf)) | ( (x >= xsml_sup) & (x < inf) ) else: # dtype == DType.float64 alias xsml_inf: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0xBFAF0540_438FD5C4, ) alias xsml_sup: SIMD[dtype, simd_width] = bitcast[dtype, DType.uint64]( 0x3FB082B5_77D34ED8, ) is_in_region5 = (x_abs >= epsneg) & (x > xsml_inf) & (x < xsml_sup) is_in_region6 = ((x > -1.0) & (x <= xsml_inf)) | ( (x >= xsml_sup) & (x < inf) ) result = (is_in_region1 | is_in_region2).select(x, result) result = is_in_region3.select(-inf, result) # TODO: Should we avoid creating runtime branches to be accelerator friendly? if is_in_region4.reduce_or(): result = is_in_region4.select( _log1p_procedure_3(x, is_in_region4), result ) if is_in_region5.reduce_or(): result = is_in_region5.select( _log1p_procedure_2(x, is_in_region5), result ) if is_in_region6.reduce_or(): result = is_in_region6.select( _log1p_procedure_1(x, is_in_region6), result ) return result --- src/specials/gamma.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # Some of the code in this file is adapted from: # # slatec/fnlib (https://www.netlib.org/slatec/fnlib): # Public-domain software. No copyright restrictions. # # References: # # Didonato, A. R., & Morris Jr, A. H. (1992). Algorithm 708: Significant digit # computation of the incomplete beta function ratios. # ACM Transactions on Mathematical Software (TOMS), 18(3), 360-373. # https://dl.acm.org/doi/abs/10.1145/131766.131776 """Implements gamma-related functions.""" import math import testing from specials._internal import asserting from specials._internal.polynomial import Chebyshev, Polynomial from specials.elementary.log import log from specials.utils.numerics import FloatLimits fn lbeta[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width], y: SIMD[dtype, simd_width]) -> SIMD[ dtype, simd_width ]: """Computes the natural logarithm of the beta function. This function is semantically equivalent to `lgamma(x) + lgamma(y) - lgamma(x + y)`, but it is more accurate for arguments greater than or equal to `8.0`. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: SIMD vector of non-negative floating-point values. y: SIMD vector of non-negative floating-point values. Returns: SIMD vector containing the natural logarithm of the beta function. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ asserting.assert_float_dtype["dtype", dtype]() alias inf: SIMD[dtype, simd_width] = math.inf[dtype]() alias nan: SIMD[dtype, simd_width] = math.nan[dtype]() alias log_sqrt_2pi: SIMD[ dtype, simd_width ] = 0.91893853320467274178032973640562 # Ensure that `a` is the smaller of the two arguments and `b` is the larger one. # Although the Beta function is mathematically symmetric, this procedure is not. var a = min(x, y) var b = max(x, y) # The `math.lgamma`` operation is one of the most computationally expensive # operations in this procedure. To avoid calling it when possible, we mask out # large values of `a` and `b`. var a_small = (a < 8.0).select(a, nan) var b_small = (b < 8.0).select(b, nan) var lgamma_a_small = math.lgamma(a_small) var apb = a + b var a_over_apb = a / apb var log1p_neg_a_over_apb = math.log1p(-a_over_apb) # `a` and `b` are small: `a <= b < 8.0`. var result = lgamma_a_small + math.lgamma(b_small) - math.lgamma( a_small + b_small ) # `a` is small, but `b` is large: `a < 8.0 <= b`. var correction = lgamma_correction(b) - lgamma_correction(apb) var result_for_large_b = ( lgamma_a_small + correction + a - a * log(apb) + (b - 0.5) * log1p_neg_a_over_apb ) result = (b >= 8.0).select(result_for_large_b, result) # `a` and `b` are large: `8.0 <= a <= b`. correction += lgamma_correction(a) var result_for_large_a = ( -0.5 * log(b) + log_sqrt_2pi + correction + (a - 0.5) * log(a_over_apb) + b * log1p_neg_a_over_apb ) result = (a >= 8.0).select(result_for_large_a, result) # We have already computed the value of the log-beta function for positive arguments. # For other cases, this procedure returns the same values as the corresponding one in # the R language. return ((a < 0.0) | math.isnan(x) | math.isnan(y)).select( nan, (a == 0.0).select(inf, math.isinf(b).select(-inf, result)) ) fn lgamma_correction[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Computes the correction term for the Rocktaeschel's approximation of `lgamma`. The correction term is defined as: `lgamma_correction(x) = lgamma(x) - (x - 0.5) * log(x) + x - 0.5 * log(2 * pi)` for `x >= 8`. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: SIMD vector of floating-point values greater than or equal to `8.0`. Returns: SIMD vector containing the correction term for the Rocktaeschel's approximation of `lgamma`. If `x` is less than `8.0`, this function returns `NaN`. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ asserting.assert_float_dtype["dtype", dtype]() alias nan: SIMD[dtype, simd_width] = math.nan[dtype]() alias zero: SIMD[dtype, simd_width] = 0.0 alias xmin: SIMD[dtype, simd_width] = 8.0 alias xbig: SIMD[dtype, simd_width] = 1.0 / ( math.exp2[dtype, 1](0.5 * -FloatLimits[dtype].digits) ) alias xmax: SIMD[dtype, simd_width] = 1.0 / ( 12.0 * FloatLimits[dtype].min() ) # The coefficients for the Chebyshev approximation of this correction were obtained # using the Python library `mpmath`. alias p = Chebyshev[20, dtype, simd_width].from_coefficients[ 8.331170390906488010133812318436e-02, -2.16055508054460412844538843806e-05, 2.380513030666125633967836809341e-08, -6.79698274141255339847704839014e-11, 3.598298746801337252645642260689e-13, -3.00664186830727299934841316608e-15, 3.600735976941671612063259733719e-17, -5.79169539359268115708965063230e-19, 1.193723234577627766675645918486e-20, -3.04227079051491795027184994902e-22, 9.322841959636230355753533026206e-24, -3.35893572063489139361118640771e-25, 1.396918849726567542569514379524e-26, -6.60413093595761811539762816839e-28, 3.503829528301945510964075209918e-29, -2.06344897851678280985454179987e-30, 1.336227216567260503733730549409e-31, -9.43764302155440072371370822355e-33, 7.218203478875394218977123232114e-34, -5.89320165797572035218853002751e-35, ]() alias error_tolerance = 0.1 * FloatLimits[dtype].epsilon_neg() alias num_terms = p.economize[error_tolerance]() alias p_truncated = p.truncate[num_terms]() return ((x < xmin) | math.isnan(x)).select( nan, (x < xbig).select( p_truncated(2.0 * pow(xmin / x, 2) - 1.0) / x, (x < xmax).select(1.0 / (12.0 * x), zero), ), ) fn lgamma1p[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Computes `lgamma(1 + x)` in a numerically stable way. This function is semantically equivalent to `lgamma(1 + x)`, but it is more accurate for `x` close to zero. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: SIMD vector of floating-point values. Returns: SIMD vector containing the expression `lgamma(1 + x)` evaluated at `x`. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ asserting.assert_float_dtype["dtype", dtype]() alias nan: SIMD[dtype, simd_width] = math.nan[dtype]() var result: SIMD[dtype, simd_width] = nan # Regions of computation. var is_in_region1 = (x >= -0.2) & (x < 0.6) var is_in_region2 = (x >= 0.6) & (x <= 1.25) var is_in_region3 = ~math.isnan(x) & ~is_in_region1 & ~is_in_region2 # Polynomials for region 1. The coefficients for the Padé approximation were # obtained using the Python library `mpmath`. alias p = Polynomial[10, dtype, simd_width].from_coefficients[ 5.772156649015328606065120900824e-1, 1.769751426777699103134469694093e-0, 1.571904140511368034267480819223e-0, -4.57882665358839512689779140447e-1, -1.72712505786380004829886606981e-0, -1.24373712528022745342232844850e-0, -4.17229580597323137925159852465e-1, -6.80978370725741258151865551687e-2, -4.71020922504118253059534042963e-3, -8.87567923452439608685161841459e-5, ]() alias q = Polynomial[10, dtype, simd_width].from_coefficients[ 1.000000000000000000000000000000e-0, 4.490901092651424325538968592651e-0, 8.428109112438682661243930563021e-0, 8.567162656125254544979174422045e-0, 5.110442815300870959225621274210e-0, 1.811088008784189174050238153628e-0, 3.678104258279395409229240536674e-1, 3.891333138124453879127500000527e-2, 1.741014553601874329848935439309e-3, 1.896441997532694197492403697806e-5, ]() # Polynomials for region 2. The coefficients for the Padé approximation were # obtained using the Python library `mpmath`. alias r = Polynomial[8, dtype, simd_width].from_coefficients[ 4.227843350984671393934879099176e-1, 1.050000850494737509155499279591e-0, 9.812533673494664828746361809635e-1, 4.486129361904137782151622525624e-1, 1.066177232215367809039427008258e-1, 1.267871740982719010450401143716e-2, 6.461232819244555998963476071186e-4, 9.044855054775925733727539415320e-6, ]() alias s = Polynomial[8, dtype, simd_width].from_coefficients[ 1.000000000000000000000000000000e-0, 1.720815452874289951756729496983e-0, 1.167733459492857090468456899665e-0, 3.958932481495390425060318675588e-1, 6.995177647341877884678121833272e-2, 6.082671403258376707307085732028e-3, 2.160591173994851665996054475890e-4, 1.832407275230925220950146383070e-6, ]() if is_in_region1.reduce_or(): result = is_in_region1.select(-x * (p(x) / q(x)), result) if is_in_region2.reduce_or(): var y = (x - 0.5) - 0.5 result = is_in_region2.select(y * (r(y) / s(y)), result) if is_in_region3.reduce_or(): var z = is_in_region3.select(1.0 + x, nan) result = is_in_region3.select(math.lgamma(z), result) return result fn rgamma1pm1[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: """Computes `1 / gamma(1 + x) - 1` in a numerically stable way. This function is semantically equivalent to `1 / gamma(1 + x) - 1`, but it is more accurate for `x` close to zero or one. Parameters: dtype: The data type of the input and output SIMD vectors. simd_width: The width of the input and output SIMD vectors. Args: x: SIMD vector of floating-point values. Returns: SIMD vector containing the expression `1 / gamma(1 + x) - 1` evaluated at `x`. Constraints: The data type must be a floating-point of single (`float32`) or double (`float64`) precision. """ asserting.assert_float_dtype["dtype", dtype]() alias nan: SIMD[dtype, simd_width] = math.nan[dtype]() var result: SIMD[dtype, simd_width] = nan # Regions of computation. var is_in_region1 = (x == 0.0) | (x == 1.0) var is_in_region2 = (x >= -0.5) & (x < 0.0) var is_in_region3 = (x > 0.0) & (x <= 0.5) var is_in_region4 = (x > 0.5) & (x < 1.0) var is_in_region5 = (x > 1.0) & (x <= 1.5) var is_in_region6 = (x < -0.5) | (x > 1.5) # Polynomials for regions 2 and 4. The coefficients for the Padé approximation # were obtained using the Python library `mpmath`. alias p = Polynomial[10, dtype, simd_width].from_coefficients[ -4.22784335098467139393487909918e-1, -8.76243643973193958120640666347e-1, -4.59653437436261810715536535224e-1, 1.253267646667917761310767750400e-2, 1.272374059074339062508590520139e-2, -5.95722659095617453307017824897e-3, 3.070451110948726727765078685413e-4, 2.297364646087461210880646489337e-4, -2.92867644133341610115726150281e-5, 2.184035804013220749396991885951e-6, ]() alias q = Polynomial[10, dtype, simd_width].from_coefficients[ 1.000000000000000000000000000000e-0, 5.212245444278738169713276344712e-1, 1.792664653862777325772960453280e-1, 3.438203782078653915730104663393e-2, 4.263280285377850240586205099463e-3, -1.05916724442728169202533807166e-4, -1.22076484585335162669853056235e-4, -3.17838959035037282903233187238e-5, -3.65081153946647239430275797323e-6, -3.52809435523569771837732680697e-7, ]() # Polynomials for regions 3 and 5. The coefficients for the Padé approximation # were obtained using the Python library `mpmath`. alias r = Polynomial[10, dtype, simd_width].from_coefficients[ 5.772156649015328606065120900824e-1, -3.55019099545320141149313031876e-1, -2.80386972049984078138240489896e-1, 4.691471428746571677040872413793e-2, 1.698702087612124086567211030085e-2, -6.06314331539890270227271205613e-3, 1.849686265095375101066548123063e-4, 1.979525687052423927977413302098e-4, -3.29375759528006334058753730013e-5, 1.831226368489650977559259205254e-6, ]() alias s = q result = is_in_region1.select[dtype](0.0, result) var t = (is_in_region2 | is_in_region3).select(x, x - 1.0) if (is_in_region2 | is_in_region4).reduce_or(): var y = p(t) / q(t) result = is_in_region2.select( x * (y + 1.0), is_in_region4.select((t / x) * y, result) ) if (is_in_region3 | is_in_region5).reduce_or(): var z = r(t) / s(t) result = is_in_region3.select( x * z, is_in_region5.select((t / x) * (z - 1.0), result) ) if is_in_region6.reduce_or(): result = is_in_region6.select(1.0 / math.gamma(1.0 + x) - 1.0, result) return result --- src/specials/utils/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Provides utilities for use within the package.""" --- src/specials/utils/big_int.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # Some of the code in this file is adapted from: # # llvm/llvm-project: # Licensed under the Apache License v2.0 with LLVM Exceptions. """Implements the `BigInt` struct.""" from bit import countl_zero from memory import DTypePointer, memset_zero from sys.info import is_64bit, sizeof from sys.intrinsics import _RegisterPackType from utils import InlineArray from utils.numerics import max_finite # ===----------------------------------------------------------------------=== # # Operations with carry propagation # ===----------------------------------------------------------------------=== # @always_inline fn _uadd_with_overflow( lhs: SIMD, rhs: __type_of(lhs) ) -> (__type_of(lhs), __type_of(lhs)): """Performs unsigned addition with overflow detection.""" constrained[ lhs.type.is_unsigned(), "argument type must be an unsigned, integral type", ]() var result = llvm_intrinsic[ "llvm.uadd.with.overflow", _RegisterPackType[__type_of(lhs), SIMD[DType.bool, lhs.size]], __type_of(lhs), __type_of(lhs), ](lhs, rhs) return result[0], result[1].cast[lhs.type]() @always_inline fn _uadd_with_carry( lhs: SIMD, rhs: __type_of(lhs), carry_in: __type_of(lhs) ) -> (__type_of(lhs), __type_of(lhs)): """Performs unsigned addition with carry propagation.""" constrained[ lhs.type.is_unsigned(), "argument type must be an unsigned, integral type", ]() var sum_and_carry0 = _uadd_with_overflow(lhs, rhs) var sum_and_carry1 = _uadd_with_overflow(sum_and_carry0[0], carry_in) var carry_out = sum_and_carry0[1] | sum_and_carry1[1] return sum_and_carry1[0], carry_out @always_inline fn _usub_with_overflow( lhs: SIMD, rhs: __type_of(lhs) ) -> (__type_of(lhs), __type_of(lhs)): """Performs unsigned subtraction with overflow detection.""" constrained[ lhs.type.is_unsigned(), "argument type must be an unsigned, integral type", ]() var result = llvm_intrinsic[ "llvm.usub.with.overflow", _RegisterPackType[__type_of(lhs), SIMD[DType.bool, lhs.size]], __type_of(lhs), __type_of(lhs), ](lhs, rhs) return result[0], result[1].cast[lhs.type]() @always_inline fn _usub_with_carry( lhs: SIMD, rhs: __type_of(lhs), carry_in: __type_of(lhs) ) -> (__type_of(lhs), __type_of(lhs)): """Performs subtraction with carry propagation.""" constrained[ lhs.type.is_unsigned(), "argument type must be an unsigned, integral type", ]() var diff_and_carry0 = _usub_with_overflow(lhs, rhs) var diff_and_carry1 = _usub_with_overflow(diff_and_carry0[0], carry_in) var carry_out = diff_and_carry0[1] | diff_and_carry1[1] return diff_and_carry1[0], carry_out @always_inline fn _inplace_binop[ binop_with_carry: fn[type: DType, size: Int] ( SIMD[type, size], SIMD[type, size], SIMD[type, size] ) -> (SIMD[type, size], SIMD[type, size]), type: DType, size: Int, ]( inout dst: InlineArray[SIMD[type, size], _], rhs: InlineArray[SIMD[type, size], _], ) -> SIMD[type, size]: """Performs an in-place binary operation with carry propagation.""" constrained[ dst.size >= rhs.size, "`dst` must have at least as many elements as `rhs`", ]() var carry_out = SIMD[type, size](0) @parameter for i in range(dst.size): var has_rhs_value = i < rhs.size var rhs_value = rhs[i] if has_rhs_value else 0 var carry_in = carry_out var result_and_carry = binop_with_carry(dst[i], rhs_value, carry_in) dst[i] = result_and_carry[0] carry_out = result_and_carry[1] # Stop early when rhs is over and there is no carry out to propagate. if all(carry_out == 0) and not has_rhs_value: break return carry_out # ===----------------------------------------------------------------------=== # # Operations for bit manipulation # ===----------------------------------------------------------------------=== # @always_inline fn _count_leading_zeros[ type: DType, size: Int ](val: InlineArray[SIMD[type, size], _]) -> SIMD[type, size]: """Counts the leading zeros in the internal representation of a `BigInt`.""" constrained[type.is_integral(), "type must be an integral type"]() alias TYPE_BITWIDTH = type.bitwidth() var result = SIMD[type, size](0) var should_stop = SIMD[DType.bool, size](False) @parameter for i in reversed(range(val.size)): var bit_count = countl_zero(val[i]) result += should_stop.select(0, bit_count) should_stop |= bit_count < TYPE_BITWIDTH if all(should_stop): break return result @always_inline fn _mask_leading_ones[type: DType, count: Int]() -> Scalar[type]: """Creates a mask with the specified number of leading ones.""" return ~_mask_trailing_ones[type, type.bitwidth() - count]() @always_inline fn _mask_trailing_ones[type: DType, count: Int]() -> Scalar[type]: """Creates a mask with the specified number of trailing ones.""" constrained[type.is_unsigned(), "type must be an unsigned, integral type"]() constrained[count >= 0, "count must be non-negative"]() constrained[ count <= type.bitwidth(), "count must be less than or equal to the type's bitwidth", ]() @parameter if count == 0: return Scalar[type](0) else: return ~Scalar[type](0) >> (type.bitwidth() - count) @always_inline fn _iota[type: DType, size: Int]() -> SIMD[type, size]: """Creates a SIMD vector containing an increasing sequence starting from 0. """ # Unlike `math.iota`, this function can be executed at compile-time. var result = SIMD[type, size]() @parameter for i in range(size): result[i] = i return result @always_inline fn _shift[ *, is_left_shift: Bool ](val: BigInt, offset: SIMD[DType.index, val.size],) -> __type_of(val): """Performs a bitwise shift on the internal representation of a `BigInt`.""" alias SHIFT = _iota[DType.index, val.size]() alias TYPE_BITWIDTH = val.word_type.bitwidth() var dst = __type_of(val)(unsafe_uninitialized=True) var val_ptr = DTypePointer( val._storage.unsafe_ptr().bitcast[Scalar[val.word_type]]() ) if all(offset == 0): @parameter for i in range(val.WORD_COUNT): dst._storage[i] = val._storage[i] return dst @always_inline @parameter fn at(index: SIMD[DType.index, _]) -> __type_of(index): @parameter if is_left_shift: return val.WORD_COUNT - index - 1 else: return index @always_inline @parameter fn safe_gather( index: SIMD[DType.index, val.size] ) -> SIMD[val.word_type, val.size]: var is_index_below_size = index < val.WORD_COUNT var mask = (index >= 0) & is_index_below_size var default = (val.is_negative() & ~is_index_below_size).select( SIMD[val.word_type, val.size](-1), 0 ) return val_ptr.gather(index.fma(val.size, SHIFT), mask, default) var index_offset = offset // TYPE_BITWIDTH var bit_offset = (offset % TYPE_BITWIDTH).cast[val.word_type]() @parameter for i in range(val.WORD_COUNT): var index = Scalar[DType.index](i) var part1 = safe_gather(at(index + index_offset)) var part2 = safe_gather(at(index + index_offset + 1)) @parameter if is_left_shift: dst._storage[int(at(index))] = (bit_offset == 0).select( part1, part1 << bit_offset | part2 >> (TYPE_BITWIDTH - bit_offset), ) else: dst._storage[int(at(index))] = (bit_offset == 0).select( part1, part1 >> bit_offset | part2 << (TYPE_BITWIDTH - bit_offset), ) return dst # ===----------------------------------------------------------------------=== # # Operations for comparison # ===----------------------------------------------------------------------=== # @always_inline fn _compare(lhs: SIMD, rhs: __type_of(lhs)) -> SIMD[DType.int8, lhs.size]: """Compares two SIMD vectors element-wise.""" return (lhs == rhs).select( 0, (lhs < rhs).select(-1, SIMD[DType.int8, lhs.size](1)) ) @always_inline fn _compare(lhs: BigInt, rhs: __type_of(lhs)) -> SIMD[DType.int8, lhs.size]: """Compares two `BigInt` vectors element-wise.""" var result = SIMD[DType.int8, lhs.size](0) @parameter if lhs.signed: var lhs_is_negative = lhs.is_negative() var rhs_is_negative = rhs.is_negative() result = (lhs_is_negative != rhs_is_negative).select( lhs_is_negative.select(-1, SIMD[DType.int8, lhs.size](1)), result ) @parameter for i in reversed(range(lhs.WORD_COUNT)): result = (result == 0).select( _compare(lhs._storage[i], rhs._storage[i]), result ) if all(result != 0): break return result # ===----------------------------------------------------------------------=== # # BigInt # ===----------------------------------------------------------------------=== # @always_inline fn _conditional[T: AnyType, //, pred: Bool, true_case: T, false_case: T]() -> T: """Returns the true or false case based on the value of `pred`.""" @parameter if pred: return true_case else: return false_case @always_inline fn _default_word_type[bits: Int]() -> DType: """Returns the default word type for a `BigInt` based on `bits`.""" constrained[bits > 0, "number of bits must be positive"]() constrained[bits % 8 == 0, "number of bits must be a multiple of 8"]() @parameter if bits % 64 == 0 and is_64bit(): return DType.uint64 elif bits % 32 == 0: return DType.uint32 elif bits % 16 == 0: return DType.uint16 else: return DType.uint8 @always_inline fn _big_int_construction_checks[ bits: Int, word_type: DType, ](): """Performs checks on the parameters of a `BigInt` constructor.""" constrained[bits > 0, "number of bits must be positive"]() constrained[ word_type.is_unsigned(), "word type must be an unsigned, integral type" ]() constrained[ bits % word_type.bitwidth() == 0, "number of bits must be a multiple of the word type's bitwidth", ]() @always_inline fn _is_casting_safe[bits: Int, signed: Bool](value: IntLiteral) -> Bool: """Checks if `value` fits in an integer with the specified number of bits and signedness. """ constrained[bits > 0, "number of bits must be positive"]() @parameter if signed: return bits >= value._bit_width() else: return value >= 0 and bits >= (value._bit_width() - 1) alias BigUInt = BigInt[_, size=_, signed=False, word_type=_] """Represents a small vector of arbitrary, fixed bit-size unsigned integers.""" @value struct BigInt[ bits: Int, /, *, size: Int, signed: Bool = True, word_type: DType = _default_word_type[bits](), ](Copyable, ExplicitlyCopyable, Movable): """Represents a small vector of arbitrary, fixed bit-size integers. It can represent both signed and unsigned integers with a fixed number of bits each and leverages SIMD operations for enhanced performance. Constraints: The number of bits must be a multiple of the word type's bitwidth. Parameters: bits: The number of bits for each element of the `BigInt` vector. Constraints: Must be positive. size: The size of the `BigInt` vector. Constraints: Must be positive and a power of two. signed: A boolean indicating whether the integers are signed (`True`) or unsigned (`False`). Defaults to `True`. word_type: The type of each word used in the internal representation of the `BigInt` vector. For performance reasons, defaults to the largest unsigned integer type whose bitwidth divides `bits` evenly. """ # ===------------------------------------------------------------------=== # # Aliases # ===------------------------------------------------------------------=== # alias WORD_TYPE_BITWIDTH = 8 * sizeof[word_type]() """The size, in bits, of the `word_type` parameter.""" alias WORD_COUNT = bits // Self.WORD_TYPE_BITWIDTH """The number of words used to represent the integers.""" alias StorageType = InlineArray[SIMD[word_type, size], Self.WORD_COUNT] """The type used for internal storage, represented as an array of words.""" # ===------------------------------------------------------------------=== # # Fields # ===------------------------------------------------------------------=== # var _storage: Self.StorageType """The internal array of words representing the `BigInt` vector.""" # ===------------------------------------------------------------------=== # # Life cycle methods # ===------------------------------------------------------------------=== # @always_inline fn __init__(inout self): """Initializes the `BigInt` vector with all elements set to zero.""" _big_int_construction_checks[bits, word_type]() alias BLOCK_SIZE = size * Self.WORD_COUNT self._storage = Self.StorageType(unsafe_uninitialized=True) memset_zero[word_type]( self._storage.unsafe_ptr().bitcast[Scalar[word_type]](), BLOCK_SIZE ) @always_inline fn __init__(inout self, *, unsafe_uninitialized: Bool): """Initializes the `BigInt` vector with uninitialized storage. Args: unsafe_uninitialized: A boolean indicating whether the internal storage should be left uninitialized. In practice, it is always set to `True` (it is not actually used inside the constructor). """ _big_int_construction_checks[bits, word_type]() _ = unsafe_uninitialized self._storage = Self.StorageType(unsafe_uninitialized=True) @always_inline fn __init__(inout self, value: IntLiteral): """Initializes the `BigInt` vector with a signed integer literal. Args: value: The signed integer literal to be splatted across all the elements of the `BigInt` vector. """ _big_int_construction_checks[bits, word_type]() debug_assert( _is_casting_safe[bits, signed](value), "value must be within the bounds of the `BigInt`", ) self._storage = Self.StorageType(unsafe_uninitialized=True) var tmp: IntLiteral = value @parameter for i in range(Self.WORD_COUNT): self._storage[i] = SIMD[word_type, size](tmp) tmp >>= Self.WORD_TYPE_BITWIDTH @always_inline fn __init__(inout self, value: Int): """Initializes the `BigInt` vector with the provided integer value. Args: value: The integer value to set for each element in the `BigInt` vector. """ self.__init__(SIMD[DType.index, size](value)) @always_inline fn __init__(inout self, value: SIMD[_, size]): """Initializes the `BigInt` vector with the provided SIMD vector. Constraints: The value type must be an integral type. Args: value: The SIMD vector to initialize the `BigInt` vector with. """ constrained[ value.type.is_integral(), "value type must be an integral type", ]() _big_int_construction_checks[bits, word_type]() alias TYPE_BITWIDTH = value.type.bitwidth() var extension = ((value < 0) & signed).select( max_finite[word_type](), 0 ) var tmp = value self._storage = Self.StorageType(unsafe_uninitialized=True) @parameter for i in range(Self.WORD_COUNT): self._storage[i] = (tmp == 0).select( extension, tmp.cast[word_type]() ) @parameter if TYPE_BITWIDTH > Self.WORD_TYPE_BITWIDTH: tmp >>= Self.WORD_TYPE_BITWIDTH else: tmp = 0 @always_inline fn __init__(inout self, other: Self): """Initializes a new `BigInt` vector by copying an existing `BigInt`. Args: other: The `BigInt` vector to copy from. """ self.__copyinit__(other) # ===------------------------------------------------------------------=== # # Factory methods # ===------------------------------------------------------------------=== # @staticmethod @always_inline fn max() -> Self: """Creates a `BigInt` vector with all elements set to the maximum representable value. Returns: A new `BigInt` vector with all elements set to the maximum representable value. """ var result = ~Self() @parameter if signed: result.clear_most_significant_bit() return result @staticmethod @always_inline fn min() -> Self: """Creates a `BigInt` vector with all elements set to the minimum representable value. Returns: A new `BigInt` vector with all elements set to the minimum representable value. """ var result = Self() @parameter if signed: result.set_most_significant_bit() return result # ===------------------------------------------------------------------=== # # Operator dunders # ===------------------------------------------------------------------=== # @always_inline fn __add__(self, rhs: Self) -> Self: """Performs addition between two `BigInt` vectors, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A new `BigInt` vector containing the result of the addition. """ var result = Self(self) _ = _inplace_binop[_uadd_with_carry](result._storage, rhs._storage) return result @always_inline fn __iadd__(inout self, rhs: Self): """Performs in-place addition between two `BigInt` vectors, element-wise. Args: rhs: The right-hand side `BigInt` vector. """ _ = _inplace_binop[_uadd_with_carry](self._storage, rhs._storage) @always_inline fn __sub__(self, rhs: Self) -> Self: """Performs subtraction between two `BigInt` vectors, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A new `BigInt` vector containing the result of the subtraction. """ var result = Self(self) _ = _inplace_binop[_usub_with_carry](result._storage, rhs._storage) return result @always_inline fn __isub__(inout self, rhs: Self): """Performs in-place subtraction between two `BigInt` vectors, element-wise. Args: rhs: The right-hand side `BigInt` vector. """ _ = _inplace_binop[_usub_with_carry](self._storage, rhs._storage) @always_inline fn __eq__(self, rhs: Self) -> SIMD[DType.bool, size]: """Compares two `BigInt` vectors for equality, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A SIMD vector of booleans indicating whether the corresponding elements are equal. """ return _compare(self, rhs) == 0 @always_inline fn __ne__(self, rhs: Self) -> SIMD[DType.bool, size]: """Compares two `BigInt` vectors for inequality, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A SIMD vector of booleans indicating whether the corresponding elements are not equal. """ return _compare(self, rhs) != 0 @always_inline fn __lt__(self, rhs: Self) -> SIMD[DType.bool, size]: """Compares two `BigInt` vectors for less-than, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A SIMD vector of booleans indicating whether the corresponding elements are less than those of the right-hand side. """ return _compare(self, rhs) == -1 @always_inline fn __le__(self, rhs: Self) -> SIMD[DType.bool, size]: """Compares two `BigInt` vectors for less-than-or-equal, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A SIMD vector of booleans indicating whether the corresponding elements are less than or equal to those of the right-hand side. """ return _compare(self, rhs) != 1 @always_inline fn __gt__(self, rhs: Self) -> SIMD[DType.bool, size]: """Compares two `BigInt` vectors for greater-than, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A SIMD vector of booleans indicating whether the corresponding elements are greater than those of the right-hand side. """ return _compare(self, rhs) == 1 @always_inline fn __ge__(self, rhs: Self) -> SIMD[DType.bool, size]: """Compares two `BigInt` vectors for greater-than-or-equal, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A SIMD vector of booleans indicating whether the corresponding elements are greater than or equal to those of the right-hand side. """ return _compare(self, rhs) != -1 @always_inline fn __invert__(self) -> Self: """Performs a bitwise NOT operation on a `BigInt` vector, element-wise. Returns: A new `BigInt` vector containing the result of the bitwise NOT operation. """ var result = Self(unsafe_uninitialized=True) @parameter for i in range(Self.WORD_COUNT): result._storage[i] = ~self._storage[i] return result @always_inline fn __lshift__(self, offset: SIMD[DType.index, size]) -> Self: """Performs a bitwise left shift on a `BigInt` vector, element-wise. Args: offset: The number of bits to shift the vector by. Must be less than `bits`; otherwise, the behavior of this method is undefined. Returns: A new `BigInt` vector containing the result of the bitwise left shift. """ debug_assert( all((offset >= 0) & (offset < bits)), "offset must be within bounds", ) return _shift[is_left_shift=True](self, offset) @always_inline fn __ilshift__(inout self, offset: SIMD[DType.index, size]): """Performs an in-place bitwise left shift on a `BigInt` vector, element-wise. Args: offset: The number of bits to shift the vector by. Must be less than `bits`; otherwise, the behavior of this method is undefined. """ self = self << offset @always_inline fn __rshift__(self, offset: SIMD[DType.index, size]) -> Self: """Performs a bitwise right shift on a `BigInt` vector, element-wise. Args: offset: The number of bits to shift the vector by. Must be less than `bits`; otherwise, the behavior of this method is undefined. Returns: A new `BigInt` vector containing the result of the bitwise right shift. """ debug_assert( all((offset >= 0) & (offset < bits)), "offset must be within bounds", ) return _shift[is_left_shift=False](self, offset) @always_inline fn __irshift__(inout self, offset: SIMD[DType.index, size]): """Performs an in-place bitwise right shift on a `BigInt` vector, element-wise. Args: offset: The number of bits to shift the vector by. Must be less than `bits`; otherwise, the behavior of this method is undefined. """ self = self >> offset @always_inline fn __neg__(self) -> Self: """Performs arithmetic negation on a `BigInt` vector, element-wise. Returns: A new `BigInt` vector representing the result of the negation. """ var result = ~self result += 1 return result @always_inline fn __pos__(self) -> Self: """Performs the unary plus operation on a `BigInt` vector, element-wise. Returns: A new `BigInt` vector that is identical to the original. """ return Self(self) # ===------------------------------------------------------------------=== # # Methods # ===------------------------------------------------------------------=== # @always_inline fn add_with_overflow(inout self, rhs: Self) -> SIMD[DType.bool, size]: """Performs in-place addition with overflow detection, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A SIMD vector of booleans indicating whether an overflow occurred during the addition. """ @parameter if signed: var lhs_msb = self.get_most_significant_bit() var rhs_msb = rhs.get_most_significant_bit() _ = _inplace_binop[_uadd_with_carry](self._storage, rhs._storage) return (lhs_msb == rhs_msb) & ( lhs_msb != self.get_most_significant_bit() ) else: var carry_out = _inplace_binop[_uadd_with_carry]( self._storage, rhs._storage ) return carry_out.cast[DType.bool]() @always_inline fn sub_with_overflow(inout self, rhs: Self) -> SIMD[DType.bool, size]: """Performs in-place subtraction with overflow detection, element-wise. Args: rhs: The right-hand side `BigInt` vector. Returns: A SIMD vector of booleans indicating whether an overflow occurred during the subtraction. """ @parameter if signed: var lhs_msb = self.get_most_significant_bit() var rhs_msb = rhs.get_most_significant_bit() _ = _inplace_binop[_usub_with_carry](self._storage, rhs._storage) return (lhs_msb != rhs_msb) & ( lhs_msb != self.get_most_significant_bit() ) else: var carry_out = _inplace_binop[_usub_with_carry]( self._storage, rhs._storage ) return carry_out.cast[DType.bool]() @always_inline fn cast[ bits: Int, /, *, signed: Bool ](self) -> BigInt[ bits, size = Self.size, signed=signed, word_type = Self.word_type ]: """Casts the `BigInt` vector to a new `BigInt` with a different number of bits and signedness. Parameters: bits: The number of bits for the new `BigInt`. Constraints: Must be a positive integer and a multiple of the bitwidth of word type. signed: A boolean indicating whether the new `BigInt` is signed (`True`) or unsigned (`False`). Returns: A new `BigInt` vector with the specified number of bits and signedness. The size and word type are preserved. """ var result = BigInt[ bits, size = Self.size, signed=signed, word_type = Self.word_type ](unsafe_uninitialized=True) @parameter if bits <= self.bits: @parameter for i in range(result.WORD_COUNT): result._storage[i] = self._storage[i] else: var extension = (self.is_negative() & signed).select( max_finite[word_type](), 0 ) @parameter for i in range(result.WORD_COUNT): @parameter if i < self.WORD_COUNT: result._storage[i] = self._storage[i] else: result._storage[i] = extension return result @always_inline fn cast[type: DType](self) -> SIMD[type, size]: """Casts the `BigInt` vector to a SIMD vector with the same size. Parameters: type: The type of the SIMD vector to cast to. Constraints: Must be an integral type. Returns: A SIMD vector containing the values from the `BigInt` vector, with the specified type. """ constrained[type.is_integral(), "type must be an integral type"]() alias TYPE_BITWIDTH = type.bitwidth() alias MAX_COUNT = _conditional[ TYPE_BITWIDTH > bits, Self.WORD_COUNT, TYPE_BITWIDTH // Self.WORD_TYPE_BITWIDTH, ]() var result = self._storage[0].cast[type]() @parameter if TYPE_BITWIDTH <= Self.WORD_TYPE_BITWIDTH: return result else: @parameter for i in range(1, MAX_COUNT): result += self._storage[i].cast[type]() << ( Self.WORD_TYPE_BITWIDTH * i ) @parameter if signed and TYPE_BITWIDTH > bits: alias MASK = ~Scalar[type](0) << bits return self.is_negative().select(result | MASK, result) else: return result @always_inline fn clear_most_significant_bit(inout self): """Clears the most significant bit of the `BigInt` vector, element-wise. """ self._storage[Self.WORD_COUNT - 1] &= _mask_trailing_ones[ word_type, Self.WORD_TYPE_BITWIDTH - 1 ]() @always_inline fn get_most_significant_bit(self) -> SIMD[DType.bool, size]: """Gets the most significant bit in each element of the `BigInt` vector. Returns: A SIMD vector containing the most significant bit for each element in the `BigInt` vector. """ var msb = self._storage[Self.WORD_COUNT - 1] >> ( Self.WORD_TYPE_BITWIDTH - 1 ) return msb.cast[DType.bool]() @always_inline fn set_most_significant_bit(inout self): """Sets the most significant bit of the `BigInt` vector, element-wise. """ self._storage[Self.WORD_COUNT - 1] |= _mask_leading_ones[word_type, 1]() @always_inline fn count_leading_zeros(self) -> SIMD[word_type, size]: """Counts the number of leading zeros in each element of the `BigInt` vector. Returns: A SIMD vector containing the count of leading zeros for each element in the `BigInt` vector. """ return _count_leading_zeros(self._storage) @always_inline fn is_negative(self) -> SIMD[DType.bool, size]: """Checks if the `BigInt` vector is negative, element-wise. Returns: A SIMD vector of booleans indicating whether each element in the `BigInt` vector is negative. """ return self.get_most_significant_bit() & signed @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: """Checks if the `BigInt` vector is zero, element-wise. Returns: A SIMD vector of booleans indicating whether each element in the `BigInt` vector is zero. """ var result = SIMD[DType.bool, size](True) @parameter for i in range(Self.WORD_COUNT): result &= self._storage[i] == 0 if not any(result): break return result --- src/specials/utils/functional.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Implements higher-order functions.""" import math from algorithm.functional import parallelize from sys.info import num_performance_cores, simdwidthof # ===----------------------------------------------------------------------=== # # Elementwise # ===----------------------------------------------------------------------=== # fn elementwise[ func: fn[Int] (Int, /) capturing -> None, *, simd_width: Int, ](num_elements: Int): """Executes `func[simd_width](index)`, possibly as subtasks, for each index in the range `[0, num_elements)`. Constraints: The SIMD width must be a positive integer value. Parameters: func: The function to apply at each index. It should not return a value. simd_width: The SIMD width to use. Arguments: num_elements: The number of elements to process. """ elementwise[func, simd_width=simd_width]( num_elements, min_simds_per_core=1024 // num_performance_cores() ) fn elementwise[ func: fn[Int] (Int, /) capturing -> None, *, simd_width: Int, ](num_elements: Int, *, min_simds_per_core: Int): """Executes `func[simd_width](index)`, possibly as subtasks, for each index in the range `[0, num_elements)`. Constraints: The SIMD width must be a positive integer value. Parameters: func: The function to apply at each index. It should not return a value. simd_width: The SIMD width to use. Arguments: num_elements: The number of elements to process. min_simds_per_core: The minimum number of SIMD vectors per performance core to try to execute the `func` function in parallel. """ constrained[simd_width > 0, "SIMD width must be a positive integer value"]() debug_assert( num_elements > 0, "number of elements must be a positive integer value" ) debug_assert( min_simds_per_core > 0, "minimum SIMD vectors per core must be a positive integer value", ) var num_simds = num_elements // simd_width var num_cores = num_performance_cores() var num_workers = 1 if num_simds >= (num_cores * max(min_simds_per_core, 1)): num_workers = num_cores var num_tasks = num_workers var num_elements_per_tasks = (num_simds // num_tasks) * simd_width var num_remaining_elements = ( num_elements - num_elements_per_tasks * num_tasks ) @always_inline @parameter fn task_fn(task_id: Int): var start = task_id * num_elements_per_tasks var end: Int if task_id == (num_tasks - 1): end = num_simds * simd_width else: end = start + num_elements_per_tasks for index in range(start, end, simd_width): func[simd_width](index) if num_tasks > 1: parallelize[task_fn](num_tasks, num_workers) else: task_fn(0) if num_remaining_elements > 0: var start = num_elements - simd_width if start >= 0: func[simd_width](start) else: start = num_elements - num_remaining_elements for index in range(start, num_elements): func[1](index) # ===----------------------------------------------------------------------=== # # For Loop # ===----------------------------------------------------------------------=== # @always_inline fn _fori_loop_impl[ func: fn[Int, /] () capturing -> None, start: Int, end: Int, step: Int, ](): """Implements `fori_loop` using recursion.""" @parameter if (step > 0 and start < end) or (step < 0 and start > end): func[start]() _fori_loop_impl[func, start + step, end, step]() @always_inline fn fori_loop[ func: fn[Int, /] () capturing -> None, start: Int, end: Int, step: Int, ](): """Applies a for loop. Constraints: The step must be a non-zero integer value. Parameters: func: The function to apply at each iteration. The function should take a single Int parameter and not return a value. start: The loop index lower bound (inclusive). end: The loop index upper bound (exclusive). step: The loop index increment. """ constrained[step != 0, "step must be a non-zero integer value"]() _fori_loop_impl[func, start, end, step]() @always_inline fn _fori_loop_impl[ func: fn[Int, /] () capturing -> Bool, start: Int, end: Int, step: Int, ](): """Implements `fori_loop` with conditional execution using recursion.""" @parameter if (step > 0 and start < end) or (step < 0 and start > end): if func[start](): _fori_loop_impl[func, start + step, end, step]() @always_inline fn fori_loop[ func: fn[Int, /] () capturing -> Bool, start: Int, end: Int, step: Int, ](): """Applies a for loop with conditional execution. Constraints: The step must be a non-zero integer value. Parameters: func: The function to apply at each iteration. The function should take a single Int parameter and return a boolean value. The loop continues only if the result of `func` is `True`; otherwise, it terminates. start: The loop index lower bound (inclusive). end: The loop index upper bound (exclusive). step: The loop index increment. """ constrained[step != 0, "step must be a non-zero integer value"]() _fori_loop_impl[func, start, end, step]() --- src/specials/utils/numerics.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Implements utilities to work with numeric types.""" import math @always_inline fn _float_limits_construction_checks[type: DType](): """Checks if the type is valid.""" constrained[ type == DType.float16 or type == DType.float32 or type == DType.float64, ( "type must be an IEEE 754-2008 floating-point: `DType.float16`," " `DType.float32`, or `DType.float64`." ), ]() @always_inline fn _digits[type: DType]() -> IntLiteral: """ Returns the number of `radix` digits that the given type can represent without loss of precision. """ _float_limits_construction_checks[type]() @parameter if type == DType.float16: return 11 elif type == DType.float32: return 24 else: debug_assert(type == DType.float64, "type must be `DType.float64`") return 53 @always_inline fn _max_exponent[type: DType]() -> IntLiteral: """ Returns the maximum positive integer such that `radix` raised to `(max_exponent-1)` generates a representable finite floating-point number. """ @parameter if type == DType.float16: return 16 elif type == DType.float32: return 128 else: debug_assert(type == DType.float64, "type must be `DType.float64`") return 1024 @always_inline fn _min_exponent[type: DType]() -> IntLiteral: """ Returns the minimum negative integer such that `radix` raised to `(min_exponent-1)` generates a normalized floating-point number. """ @parameter if type == DType.float16: return -13 elif type == DType.float32: return -125 else: debug_assert(type == DType.float64, "type must be `DType.float64`") return -1021 @register_passable("trivial") struct FloatLimits[type: DType]: """Machine limits for floating-point types. Constraints: The type must be an IEEE 754-2008 floating-point: `DType.float16`, `DType.float32`, or `DType.float64`. Parameters: type: The floating-point for which `FloatLimits` returns information. """ alias digits: IntLiteral = _digits[type]() """ The number of `radix` digits that the given type can represent without loss of precision. """ alias max_exponent: IntLiteral = _max_exponent[type]() """ Maximum positive integer such that `radix` raised to `(max_exponent-1)` generates a representable finite floating-point number. """ alias min_exponent: IntLiteral = _min_exponent[type]() """ Minimum negative integer such that `radix` raised to `(min_exponent-1)` generates a normalized floating-point number. """ alias radix: IntLiteral = 2 """The integral base used for the representation of the given type.""" @staticmethod @always_inline fn denorm_min() -> Scalar[type]: """Returns the minimum positive denormalized value of the given type.""" return math.ldexp( math.ldexp[type, 1](1.0, Self.min_exponent), -Self.digits ) @staticmethod @always_inline fn epsilon() -> Scalar[type]: """ Returns the difference between 1.0 and the next representable value of the given type. """ return math.ldexp[type, 1](1.0, -Self.digits + 1) @staticmethod @always_inline fn epsilon_neg() -> Scalar[type]: """ Returns the difference between 1.0 and the previous representable value of the given type. """ return math.ldexp[type, 1](1.0, -Self.digits) @staticmethod @always_inline fn lowest() -> Scalar[type]: """Returns the most negative finite value of the given type.""" return -Self.max() @staticmethod @always_inline fn max() -> Scalar[type]: """Returns the maximum finite value of the given type.""" return math.ldexp[type, 1]( 2.0 * (1.0 - Self.epsilon_neg()), Self.max_exponent - 1 ) @staticmethod @always_inline fn min() -> Scalar[type]: """Returns the minimum positive normalized value of the given type.""" return math.ldexp[type, 1](1.0, Self.min_exponent - 1) --- test/_internal/test_math.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for mathematical utilities.""" import math from python import Python from specials._internal.math import ldexp from specials.utils.numerics import FloatLimits from test_utils import UnitTest fn _np_ldexp[ type: DType ](x: Scalar[type], exp: Scalar[DType.int32]) raises -> Scalar[type]: var np = Python.import_module("numpy") var result = np.ldexp(x, exp) return result.to_float64().cast[type]() fn test_ldexp_float_max[type: DType]() raises: var unit_test = UnitTest("test_ldexp_float_max_" + str(type)) var x: Scalar[type] = 1.0 - FloatLimits[type].epsilon_neg() var exp: Scalar[DType.int32] = FloatLimits[type].max_exponent var expected = _np_ldexp[type](x, exp) var actual = ldexp[type](x, exp) unit_test.assert_equal(actual, expected) unit_test.assert_true( math.isfinite(actual).reduce_and(), msg="max should be finite" ) fn test_ldexp_float_smallest_normal[type: DType]() raises: var unit_test = UnitTest("test_ldexp_float_smallest_normal_" + str(type)) var x: Scalar[type] = 1.0 var exp: Scalar[DType.int32] = FloatLimits[type].min_exponent - 1 var expected = _np_ldexp[type](x, exp) var actual = ldexp[type](x, exp) unit_test.assert_equal(actual, expected) unit_test.assert_true( (actual > 0.0).reduce_and(), msg="smallest_normal should be positive" ) fn test_ldexp_float_smallest_subnormal[type: DType]() raises: var unit_test = UnitTest("test_ldexp_float_smallest_subnormal_" + str(type)) var x: Scalar[type] = 1.0 var exp: Scalar[DType.int32] = FloatLimits[type].min_exponent - FloatLimits[ type ].digits var expected = _np_ldexp[type](x, exp) var actual = ldexp[type](x, exp) unit_test.assert_equal(actual, expected) unit_test.assert_true( (actual > 0.0).reduce_and(), msg="smallest_subnormal should be positive" ) fn main() raises: test_ldexp_float_max[DType.float64]() test_ldexp_float_max[DType.float32]() test_ldexp_float_smallest_normal[DType.float64]() test_ldexp_float_smallest_normal[DType.float32]() test_ldexp_float_smallest_subnormal[DType.float64]() test_ldexp_float_smallest_subnormal[DType.float32]() --- test/_internal/test_polynomial.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for polynomial utilities.""" from sys.info import simdwidthof from specials._internal import polynomial as P from test_utils import UnitTest fn test_chebyshev[type: DType]() raises: var unit_test = UnitTest("test_chebyshev_" + str(type)) alias simd_width = simdwidthof[type]() var p = P.Chebyshev[4, type, simd_width].from_coefficients[ 4.0, 3.0, 2.0, 1.0 ]() unit_test.assert_equal(len(p), 4) unit_test.assert_equal(p.degree(), 3) unit_test.assert_equal(p.get[0](), SIMD[type, simd_width](4.0)) unit_test.assert_equal(p.get[1](), 3.0) unit_test.assert_equal(p.get[2](), 2.0) unit_test.assert_equal(p.get[3](), 1.0) fn test_chebyshev_small[type: DType]() raises: var unit_test = UnitTest("test_chebyshev_small_" + str(type)) alias simd_width = simdwidthof[type]() var p = P.Chebyshev[1, type, simd_width].from_coefficients[1.0]() unit_test.assert_equal(len(p), 1) unit_test.assert_equal(p.degree(), 0) unit_test.assert_equal(p.get[0](), SIMD[type, simd_width](1.0)) fn test_chebyshev_hexadecimal[type: DType]() raises: var unit_test = UnitTest("test_chebyshev_hexadecimal_" + str(type)) alias simd_width = simdwidthof[type]() var p: P.Chebyshev[2, type, simd_width] @parameter if type == DType.float32: p = P.Chebyshev[2, type, simd_width].from_hexadecimal_coefficients[ 0x3F80_0000, 0x3F00_0000, ]() else: p = P.Chebyshev[2, type, simd_width].from_hexadecimal_coefficients[ 0x3FF00000_00000000, 0x3FE00000_00000000, ]() unit_test.assert_equal(len(p), 2) unit_test.assert_equal(p.degree(), 1) unit_test.assert_equal(p.get[0](), SIMD[type, simd_width](1.0)) unit_test.assert_equal(p.get[1](), 0.5) fn test_chebyshev_truncate[type: DType]() raises: var unit_test = UnitTest("test_chebyshev_truncate_" + str(type)) alias simd_width = simdwidthof[type]() var p = P.Chebyshev[4, type, simd_width].from_coefficients[ 4.0, 3.0, 2.0, 1.0 ]() var q = p.truncate[1]() unit_test.assert_equal(len(q), 1) unit_test.assert_equal(q.degree(), 0) unit_test.assert_equal(q.get[0](), SIMD[type, simd_width](4.0)) var r = p.truncate[4]() unit_test.assert_equal(len(r), 4) unit_test.assert_equal(r.degree(), 3) unit_test.assert_equal(r.get[0](), SIMD[type, simd_width](4.0)) unit_test.assert_equal(r.get[1](), 3.0) unit_test.assert_equal(r.get[2](), 2.0) unit_test.assert_equal(r.get[3](), 1.0) fn test_chebyshev_economize[type: DType]() raises: var unit_test = UnitTest("test_chebyshev_economize_" + str(type)) alias simd_width = simdwidthof[type]() alias p = P.Chebyshev[4, type, simd_width].from_coefficients[ 4.0, 2.0, 1.0, 0.5 ]() alias num_terms = p.economize[1.5]() unit_test.assert_equal(num_terms, 2) var q = p.truncate[num_terms]() unit_test.assert_equal(len(q), 2) unit_test.assert_equal(q.degree(), 1) unit_test.assert_equal(q.get[0](), SIMD[type, simd_width](4.0)) unit_test.assert_equal(q.get[1](), 2.0) fn test_chebyshev_evaluate[type: DType]() raises: var unit_test = UnitTest("test_chebyshev_evaluate_" + str(type)) alias simd_width = 4 var p = P.Chebyshev[4, type, simd_width].from_coefficients[ 4.0, 3.0, 2.0, 1.0 ]() var x = SIMD[type, simd_width](-1.0, -0.5, 0.5, 1.0) # Expected values computed using `numpy.polynomial.Chebyshev`. var expected = SIMD[type, simd_width](2.0, 2.5, 3.5, 10.0) var actual = p(x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=1e-12) fn test_polynomial[type: DType]() raises: var unit_test = UnitTest("test_polynomial_" + str(type)) alias simd_width = simdwidthof[type]() var p = P.Polynomial[4, type, simd_width].from_coefficients[ 4.0, 3.0, 2.0, 1.0 ]() unit_test.assert_equal(len(p), 4) unit_test.assert_equal(p.degree(), 3) unit_test.assert_equal(p.get[0](), SIMD[type, simd_width](4.0)) unit_test.assert_equal(p.get[1](), 3.0) unit_test.assert_equal(p.get[2](), 2.0) unit_test.assert_equal(p.get[3](), 1.0) fn test_polynomial_small[type: DType]() raises: var unit_test = UnitTest("test_polynomial_small_" + str(type)) alias simd_width = simdwidthof[type]() var p = P.Polynomial[1, type, simd_width].from_coefficients[1.0]() unit_test.assert_equal(len(p), 1) unit_test.assert_equal(p.degree(), 0) unit_test.assert_equal(p.get[0](), SIMD[type, simd_width](1.0)) fn test_polynomial_hexadecimal[type: DType]() raises: var unit_test = UnitTest("test_polynomial_hexadecimal" + str(type)) alias simd_width = simdwidthof[type]() var p: P.Polynomial[2, type, simd_width] @parameter if type == DType.float32: p = P.Polynomial[2, type, simd_width].from_hexadecimal_coefficients[ 0x3F80_0000, 0x3F00_0000, ]() else: p = P.Polynomial[2, type, simd_width].from_hexadecimal_coefficients[ 0x3FF00000_00000000, 0x3FE00000_00000000, ]() unit_test.assert_equal(len(p), 2) unit_test.assert_equal(p.degree(), 1) unit_test.assert_equal(p.get[0](), SIMD[type, simd_width](1.0)) unit_test.assert_equal(p.get[1](), 0.5) fn test_polynomial_truncate[type: DType]() raises: var unit_test = UnitTest("test_polynomial_truncate_" + str(type)) alias simd_width = simdwidthof[type]() var p = P.Polynomial[4, type, simd_width].from_coefficients[ 4.0, 3.0, 2.0, 1.0 ]() var q = p.truncate[1]() unit_test.assert_equal(len(q), 1) unit_test.assert_equal(q.degree(), 0) unit_test.assert_equal(q.get[0](), SIMD[type, simd_width](4.0)) var r = p.truncate[4]() unit_test.assert_equal(len(r), 4) unit_test.assert_equal(r.degree(), 3) unit_test.assert_equal(r.get[0](), SIMD[type, simd_width](4.0)) unit_test.assert_equal(r.get[1](), 3.0) unit_test.assert_equal(r.get[2](), 2.0) unit_test.assert_equal(r.get[3](), 1.0) fn test_polynomial_evaluate[type: DType]() raises: var unit_test = UnitTest("test_polynomial_evaluate_" + str(type)) alias simd_width = 4 var p = P.Polynomial[4, type, simd_width].from_coefficients[ 4.0, 3.0, 2.0, 1.0 ]() var x = SIMD[type, simd_width](-10.0, -2.5, 0.0, 1.0) # Expected values computed using `numpy.polynomial.Polynomial`. var expected = SIMD[type, simd_width](-826.0, -6.625, 4.0, 10.0) var actual = p(x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=1e-12) fn main() raises: # Chebyshev Series test_chebyshev[DType.float32]() test_chebyshev[DType.float64]() test_chebyshev_small[DType.float32]() test_chebyshev_small[DType.float64]() test_chebyshev_hexadecimal[DType.float32]() test_chebyshev_hexadecimal[DType.float64]() test_chebyshev_truncate[DType.float32]() test_chebyshev_truncate[DType.float64]() test_chebyshev_economize[DType.float32]() test_chebyshev_economize[DType.float64]() test_chebyshev_evaluate[DType.float32]() test_chebyshev_evaluate[DType.float64]() # Power Series test_polynomial[DType.float32]() test_polynomial[DType.float64]() test_polynomial_small[DType.float32]() test_polynomial_small[DType.float64]() test_polynomial_hexadecimal[DType.float32]() test_polynomial_hexadecimal[DType.float64]() test_polynomial_truncate[DType.float32]() test_polynomial_truncate[DType.float64]() test_polynomial_evaluate[DType.float32]() test_polynomial_evaluate[DType.float64]() --- test/_internal/test_table.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for table utilities.""" import math from specials._internal.table import FloatTable from test_utils import UnitTest fn test_sized() raises: var unit_test = UnitTest("test_sized") var table = FloatTable[4, DType.float32].from_values[1.0, 2.0, 3.0, 4.0]() var expected = 4 var actual = len(table) unit_test.assert_equal(actual, expected) fn test_unsafe_lookup[type: DType]() raises: var unit_test = UnitTest("test_unsafe_lookup_" + str(type)) var table = FloatTable[4, type].from_values[1.0, 2.0, 3.0, 4.0]() var index = SIMD[DType.int32, 4](3, 0, 2, 1) var expected = SIMD[type, 4](4.0, 1.0, 3.0, 2.0) var actual = table.unsafe_lookup(index) unit_test.assert_equal(actual, expected) fn test_lookup[type: DType]() raises: var unit_test = UnitTest("test_lookup_" + str(type)) var table = FloatTable[4, type].from_values[1.0, 2.0, 3.0, 4.0]() var index = SIMD[DType.int32, 4](3, 0, 2, 1) var expected = SIMD[type, 4](4.0, 1.0, 3.0, 2.0) var actual = table.lookup(index) unit_test.assert_equal(actual, expected) fn test_out_of_bound[type: DType]() raises: var unit_test = UnitTest("test_lookup_out_of_bound_" + str(type)) var table = FloatTable[4, type].from_values[1.0, 2.0, 3.0, 4.0]() var index = SIMD[DType.int32, 4](4, 0, 2, 1) var expected = SIMD[type, 4](math.nan[type](), 1.0, 3.0, 2.0) var actual = table.lookup(index) unit_test.assert_equal(actual, expected) fn test_hexadecimal_values[type: DType]() raises: var unit_test = UnitTest("test_hexadecimal_values_" + str(type)) var table: FloatTable[2, type] @parameter if type == DType.float32: table = FloatTable[2, type].from_hexadecimal_values[ 0x3F80_0000, 0x3F00_0000, ]() else: table = FloatTable[2, type].from_hexadecimal_values[ 0x3FF00000_00000000, 0x3FE00000_00000000, ]() var index = SIMD[DType.int32, 2](0, 1) var expected = SIMD[type, 2](1.0, 0.5) var actual = table.lookup(index) unit_test.assert_equal(actual, expected) fn main() raises: test_sized() test_unsafe_lookup[DType.float32]() test_unsafe_lookup[DType.float64]() test_lookup[DType.float32]() test_lookup[DType.float64]() test_out_of_bound[DType.float32]() test_out_of_bound[DType.float64]() test_hexadecimal_values[DType.float32]() test_hexadecimal_values[DType.float64]() --- test/elementary/test_common_constants.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for common constants.""" from python import Python from specials.elementary.common_constants import ExpTable, LogConstants from test_utils import UnitTest fn _np_exp2[type: DType](x: Scalar[type]) raises -> Scalar[type]: var np = Python.import_module("numpy") var result = np.exp2(x) return result.to_float64().cast[type]() fn test_exp_table[type: DType]() raises: var unit_test = UnitTest("test_exp_table_" + str(type)) var expected_table_size = 32 unit_test.assert_equal(len(ExpTable[type].lead), expected_table_size) unit_test.assert_equal(len(ExpTable[type].trail), expected_table_size) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(expected_table_size): var index = Scalar[DType.int32](i) var x_lead = ExpTable[type].lead.lookup(index) var x_trail = ExpTable[type].trail.lookup(index) var expected = _np_exp2[type](Scalar[type](i) / expected_table_size) var actual = x_lead + x_trail unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn test_log_constants[type: DType]() raises: var unit_test = UnitTest("test_log_constants_" + str(type)) var expected_table_size = 129 unit_test.assert_equal( len(LogConstants[type].inv_fraction1), expected_table_size ) unit_test.assert_equal( len(LogConstants[type].log_fraction1_lead), expected_table_size ) unit_test.assert_equal( len(LogConstants[type].log_fraction1_trail), expected_table_size ) fn _np_inv_fraction1[type: DType](j: Int) raises -> Scalar[type]: var np = Python.import_module("numpy") var result = np.reciprocal(1.0 + np.ldexp(j, -7)) return result.to_float64().cast[type]() fn _np_log_fraction1[type: DType](j: Int) raises -> Scalar[type]: var np = Python.import_module("numpy") var result = np.log1p(np.ldexp(j, -7)) return result.to_float64().cast[type]() var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for j in range(expected_table_size): var index = Scalar[DType.int32](j) # inv_fraction1 var inv_fraction1 = LogConstants[type].inv_fraction1.lookup(index) var expected = _np_inv_fraction1[type](j) var actual = inv_fraction1 unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) # log_fraction1 var log_fraction1_lead = LogConstants[type].log_fraction1_lead.lookup( index ) var log_fraction1_trail = LogConstants[type].log_fraction1_trail.lookup( index ) expected = _np_log_fraction1[type](j) actual = log_fraction1_lead + log_fraction1_trail unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn main() raises: test_exp_table[DType.float64]() test_exp_table[DType.float32]() test_log_constants[DType.float64]() test_log_constants[DType.float32]() --- test/elementary/test_exp.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for the `exp` function.""" import math from python import Python from utils.static_tuple import StaticTuple from specials.elementary.exp import exp from specials.utils.numerics import FloatLimits from test_utils import UnitTest fn _mp_exp[type: DType](x: Scalar[type]) raises -> Scalar[type]: var mp = Python.import_module("mpmath") var result = mp.exp(mp.mpf(x)) return result.to_float64().cast[type]() fn test_exp[type: DType]() raises: var unit_test = UnitTest("test_exp_" + str(type)) var xs = StaticTuple[Scalar[type], 9]( -10.0, -1.0, -0.1, -0.01, 0.0, 0.01, 0.1, 1.0, 10.0 ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var expected = _mp_exp[type](x) var actual = exp(x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn test_exp_special_cases[type: DType]() raises: var unit_test = UnitTest("test_exp_special_cases_" + str(type)) var log2 = 0.6931471805599453 var xmin = Scalar[type](FloatLimits[type].min_exponent - 1) * log2 var xeps = 0.5 * FloatLimits[type].epsilon_neg() var xmax = math.nextafter( Scalar[type](FloatLimits[type].max_exponent) * log2, 0.0 ) var nan = math.nan[type]() var inf = math.inf[type]() var xs = StaticTuple[Scalar[type], 13]( nan, -inf, xmin - 1.0, xmin, xmin + 1.0, -xeps, -0.1 * xeps, 0.0, 0.1 * xeps, xmax - 1.0, xmax, xmax + 1.0, inf, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var actual = exp(x) var expected: Scalar[type] if math.isnan(x): expected = nan elif x > xmax: expected = inf else: expected = _mp_exp[type](x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn main() raises: # Setting the mpmath precision for this module var mp = Python.import_module("mpmath") mp.mp.dps = 50 test_exp[DType.float64]() test_exp[DType.float32]() test_exp_special_cases[DType.float64]() test_exp_special_cases[DType.float32]() --- test/elementary/test_exp2.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for the `exp2` function.""" import math from python import Python from utils.static_tuple import StaticTuple from specials.elementary.exp2 import exp2 from specials.utils.numerics import FloatLimits from test_utils import UnitTest fn _mp_exp2[type: DType](x: Scalar[type]) raises -> Scalar[type]: var mp = Python.import_module("mpmath") var result = mp.power(mp.mpf(2), mp.mpf(x)) return result.to_float64().cast[type]() fn test_exp2[type: DType]() raises: var unit_test = UnitTest("test_exp2_" + str(type)) var xs = StaticTuple[Scalar[type], 9]( -10.0, -1.0, -0.1, -0.01, 0.0, 0.01, 0.1, 1.0, 10.0 ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var expected = _mp_exp2[type](x) var actual = exp2(x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn test_exp2_special_cases[type: DType]() raises: var unit_test = UnitTest("test_exp2_special_cases_" + str(type)) var xmin = Scalar[type](FloatLimits[type].min_exponent - 1) var xeps = 0.5 * FloatLimits[type].epsilon_neg() var xmax = math.nextafter(Scalar[type](FloatLimits[type].max_exponent), 0.0) var nan = math.nan[type]() var inf = math.inf[type]() var xs = StaticTuple[Scalar[type], 13]( nan, -inf, xmin - 1.0, xmin, xmin + 1.0, -xeps, -0.1 * xeps, 0.0, 0.1 * xeps, xmax - 1.0, xmax, xmax + 1.0, inf, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var actual = exp2(x) var expected: Scalar[type] if math.isnan(x): expected = nan elif x > xmax: expected = inf else: expected = _mp_exp2[type](x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn main() raises: # Setting the mpmath precision for this module var mp = Python.import_module("mpmath") mp.mp.dps = 100 test_exp2[DType.float64]() test_exp2[DType.float32]() test_exp2_special_cases[DType.float64]() test_exp2_special_cases[DType.float32]() --- test/elementary/test_expm1.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for the `expm1` function.""" import math from memory.unsafe import bitcast from python import Python from utils.static_tuple import StaticTuple from specials.elementary.expm1 import expm1 from specials.elementary.log import log from specials.utils.numerics import FloatLimits from test_utils import UnitTest fn _mp_expm1[type: DType](x: Scalar[type]) raises -> Scalar[type]: var mp = Python.import_module("mpmath") var result = mp.expm1(mp.mpf(x)) return result.to_float64().cast[type]() fn test_expm1[type: DType]() raises: var unit_test = UnitTest("test_expm1_" + str(type)) var xeps = FloatLimits[type].epsilon() var xs = StaticTuple[Scalar[type], 5](0.1 * xeps, 0.01, 0.1, 1.0, 10.0) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var expected = _mp_expm1[type](x) var actual = expm1(x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn test_expm1_special_cases[type: DType]() raises: var unit_test = UnitTest("test_expm1_special_cases_" + str(type)) var xeps: Scalar[type] var xsml_inf: Scalar[type] var xsml_sup: Scalar[type] var xmin: Scalar[type] var xmax: Scalar[type] var nan = math.nan[type]() var inf = math.inf[type]() @parameter if type == DType.float32: xeps = bitcast[type, DType.uint32](0x3300_0000) xsml_inf = bitcast[type, DType.uint32](0xBE93_4B11) xsml_sup = bitcast[type, DType.uint32](0x3E64_7FBF) xmin = bitcast[type, DType.uint32](0xC18A_A122) xmax = math.nextafter(log(FloatLimits[type].max()), 0.0) else: # type == DType.float64 xeps = bitcast[type, DType.uint64](0x3C900000_00000000) xsml_inf = bitcast[type, DType.uint64](0xBFD26962_1134DB93) xsml_sup = bitcast[type, DType.uint64](0x3FCC8FF7_C79A9A22) xmin = bitcast[type, DType.uint64](0xC042B708_872320E1) xmax = log(FloatLimits[type].max()) var xs = StaticTuple[Scalar[type], 12]( nan, -inf, xmin - 1.0, xmin, xsml_inf, -xeps, 0.0, xeps, xsml_sup, xmax, xmax + 1.0, inf, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var actual = expm1(x) var expected: Scalar[type] if math.isnan(x): expected = nan elif x < xmin: expected = -1.0 elif x > xmax: expected = inf else: expected = _mp_expm1[type](x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn main() raises: # Setting the mpmath precision for this module var mp = Python.import_module("mpmath") mp.mp.dps = 50 test_expm1[DType.float64]() test_expm1[DType.float32]() test_expm1_special_cases[DType.float64]() test_expm1_special_cases[DType.float32]() --- test/elementary/test_log.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for the logarithm function.""" import math from python import Python from utils.static_tuple import StaticTuple from specials.elementary.log import log from specials.utils.numerics import FloatLimits from test_utils import UnitTest fn _mp_log[type: DType](x: Scalar[type]) raises -> Scalar[type]: var mp = Python.import_module("mpmath") var result = mp.log(mp.mpf(x)) return result.to_float64().cast[type]() fn test_log[type: DType]() raises: var unit_test = UnitTest("test_log_" + str(type)) var xs = StaticTuple[Scalar[type], 8]( 1e-16, 1e-4, 0.1, 0.99, 5.0, 10.0, 1e4, 1e16, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var expected = _mp_log[type](x) var actual = log(x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn test_log_special_cases[type: DType]() raises: var unit_test = UnitTest("test_log_special_cases_" + str(type)) var xmin = FloatLimits[type].min() var xmax = FloatLimits[type].max() var nan = math.nan[type]() var inf = math.inf[type]() var xs = StaticTuple[Scalar[type], 13]( nan, -inf, -1.0, 0.0, 0.5 * xmin, xmin, 2.0 * xmin, 1.0 - FloatLimits[type].epsilon_neg(), 1.0, 1.0 + FloatLimits[type].epsilon(), xmax - 1.0, xmax, inf, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var actual = log(x) var expected: Scalar[type] if math.isnan(x) | (x < 0.0): expected = nan elif x == 0.0: expected = -inf elif x > xmax: expected = inf else: expected = _mp_log[type](x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn main() raises: # Setting the mpmath precision for this module var mp = Python.import_module("mpmath") mp.mp.dps = 100 test_log[DType.float64]() test_log[DType.float32]() test_log_special_cases[DType.float64]() test_log_special_cases[DType.float32]() --- test/elementary/test_log1p.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for the `log1p` function.""" import math from python import Python from utils.static_tuple import StaticTuple from specials.elementary.log1p import log1p from specials.utils.numerics import FloatLimits from test_utils import UnitTest fn _mp_log1p[type: DType](x: Scalar[type]) raises -> Scalar[type]: var mp = Python.import_module("mpmath") var result = mp.log1p(mp.mpf(x)) return result.to_float64().cast[type]() fn test_log1p[type: DType]() raises: var unit_test = UnitTest("test_log1p_" + str(type)) var xs = StaticTuple[Scalar[type], 15]( -0.9, -0.5, -0.1, -1e-4, -1e-8, -1e-16, 0.0, 1e-16, 1e-8, 1e-4, 0.1, 0.5, 0.9, 1.0, 10.0, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var expected = _mp_log1p[type](x) var actual = log1p(x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn test_log1p_special_cases[type: DType]() raises: var unit_test = UnitTest("test_log1p_special_cases_" + str(type)) var xmin = FloatLimits[type].min() var xeps = FloatLimits[type].epsilon_neg() var xlrg = math.ldexp(Scalar[type](1), FloatLimits[type].digits + 2) var xmax = FloatLimits[type].max() var nan = math.nan[type]() var inf = math.inf[type]() var xs = StaticTuple[Scalar[type], 13]( nan, -2.0, -1.0, -1.0 + xeps, -xmin, -0.5 * xmin, 0.5 * xmin, xmin, 1.0 - xeps, xlrg - 1.0, xlrg + 1.0, xmax, inf, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-15 for i in range(len(xs)): var x = xs[i] var actual = log1p(x) var expected: Scalar[type] if math.isnan(x) | (x < -1.0): expected = nan elif x == -1.0: expected = -inf elif x > xmax: expected = inf else: expected = _mp_log1p[type](x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn main() raises: # Setting the mpmath precision for this module var mp = Python.import_module("mpmath") mp.mp.dps = 100 test_log1p[DType.float64]() test_log1p[DType.float32]() test_log1p_special_cases[DType.float64]() test_log1p_special_cases[DType.float32]() --- test/lit.cfg.py --- # type: ignore # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Configuration for the lit test runner used by the Specials test suite.""" import os import platform import shutil from pathlib import Path import lit.formats import lit.llvm config.test_format = lit.formats.ShTest(True) # name: The name of this test suite config.name = "Specials" # suffixes: A list of file extensions to treat as test files config.suffixes = [".mojo", ".py"] # excludes: A list of files and directories ignored by the lit # test runner when scanning for tests # `test_utils` does not contain tests, just source code that we # run `mojo package` on to be used by other tests config.excludes = ["lit.cfg.py", "setup.py", "test_utils"] # test_source_root: The root path where tests are located test_dir = Path(__file__).parent.resolve() config.test_source_root = test_dir # The `run-tests.sh` script creates the build directory for us build_dir = Path(__file__).parent.parent / "build" # The tests are executed inside this build directory to avoid # polluting the source tree config.test_exec_root = build_dir / "test_output" # This makes the OS name available for `REQUIRE` directives, # e.g., `# REQUIRE: darwin` config.available_features.add(platform.system().lower()) # Check if the `not` binary from LLVM is available def has_not(): return shutil.which("not") is not None if has_not(): config.available_features.add("has_not") build_mode = os.getenv("BUILD_MODE", "debug") if build_mode == "debug": assertion_flag = "-D MOJO_ENABLE_ASSERTIONS" debug_level = "--debug-level full" else: assertion_flag = "" debug_level = "--debug-level none" config.substitutions.insert(0, ("%mojo", "mojo run")) config.substitutions.insert(1, ("%build_dir", f"-I {str(build_dir)}")) config.substitutions.insert(2, ("%assertion_flag", assertion_flag)) config.substitutions.insert(3, ("%debug_level", "--debug-level full")) config.substitutions.insert(4, ("%sanitize_checks", "")) config.substitutions.insert(5, ("%pytest", "pytest")) # Pass through several environment variables to the underlying # subprocesses that run the tests lit.llvm.initialize(lit_config, config) lit.llvm.llvm_config.with_system_environment( [ "MODULAR_HOME", "PATH", ] ) --- test/setup.py --- # type: ignore # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Setup configuration for the `test_utils` package.""" from setuptools import setup, find_packages setup( name="test_utils", version="0.1.0", package_dir={"": "."}, packages=find_packages(where="."), ) --- test/test_gamma.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %debug_level %sanitize_checks %s """Tests for gamma-related functions.""" import math from python import Python from utils.static_tuple import StaticTuple import specials from specials.utils.numerics import FloatLimits from test_utils import UnitTest # TODO: Add tests with `DType.float32` type for `lbeta`. # TODO: Investigate why defining `MOJO_ENABLE_ASSERTIONS` leads to test failures. fn test_lgamma_correction[type: DType]() raises: var unit_test = UnitTest("test_lgamma_correction_" + str(type)) var x = SIMD[type, 4](10.0, 100.0, 1000.0, 10000.0) # The expected values were computed using `mpmath`. var expected = SIMD[type, 4]( 8.330563433362871256469318659629e-3, 8.333305556349146833812416928147e-4, 8.333333055555634920575396909572e-5, 8.333333330555555563492063432540e-6, ) var actual = specials.lgamma_correction(x) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-12 unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn test_lgamma_correction_special_cases[type: DType]() raises: var unit_test = UnitTest( "test_lgamma_correction_special_cases_" + str(type) ) var inf = math.inf[type]() var nan = math.nan[type]() var zero = Scalar[type](0.0) var x = SIMD[type, 4](nan, -inf, zero, inf) var expected = SIMD[type, 4](nan, nan, nan, zero) var actual = specials.lgamma_correction(x) unit_test.assert_equal(actual, expected) fn test_lgamma1p_region1[type: DType]() raises: var unit_test = UnitTest("test_lgamma1p_region1_" + str(type)) alias eps_f32 = FloatLimits[DType.float32].epsilon().cast[type]() var x = SIMD[type, 4](-0.2, 0.0 - eps_f32, 0.0 + eps_f32, 0.60 - eps_f32) # The expected values were computed using `mpmath`. var expected = SIMD[type, 4]( 1.520596783998375994920398994673e-1, 6.880948101845375157827140831409e-8, -6.88094576425347115116354810460e-8, -1.12591780722776981673572240680e-1, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-12 unit_test.assert_all_close( specials.lgamma1p(x), expected, atol=0.0, rtol=rtol ) fn test_lgamma1p_region2[type: DType]() raises: var unit_test = UnitTest("test_lgamma1p_region2_" + str(type)) alias eps_f32 = FloatLimits[DType.float32].epsilon().cast[type]() var x = SIMD[type, 4](0.6, 1.0 - eps_f32, 1.0 + eps_f32, 1.25) # The expected values were computed using `mpmath`. var expected = SIMD[type, 4]( -1.12591765696755786387475561192e-1, -5.03998156377554207114124403668e-8, 5.039982480281974557594367601653e-8, 1.248717148923965943024412876132e-1, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-12 unit_test.assert_all_close( specials.lgamma1p(x), expected, atol=0.0, rtol=rtol ) fn test_lgamma1p_edge_cases[type: DType]() raises: var unit_test = UnitTest("test_lgamma1p_edge_cases_" + str(type)) var inf = math.inf[type]() var nan = math.nan[type]() var x = SIMD[type, 4](nan, -1.0, 0.0, inf) var expected = math.lgamma(1.0 + x) var actual = specials.lgamma1p(x) unit_test.assert_equal(actual, expected) fn test_lbeta() raises: var unit_test = UnitTest("test_lbeta") var x = SIMD[DType.float64, 4](1.0, 8.0, 1e-5, 1e4) var y = SIMD[DType.float64, 4](7.0, 8.0, 1e10, 1e5) # The expected values were computed using `mpmath`. var expected = SIMD[DType.float64, 4]( -1.9459101490553133051, -10.848948661710062966, 11.5126894343865267210, -33513.609276569981795, ) unit_test.assert_all_close( specials.lbeta(x, y), expected, atol=0.0, rtol=1e-06 ) fn test_lbeta_edge_cases() raises: var unit_test = UnitTest("test_lbeta_edge_cases") var neg = SIMD[DType.float64, 1](-1.0) var inf = math.inf[DType.float64]() var nan = math.nan[DType.float64]() var x = SIMD[DType.float64, 8](neg, neg, neg, neg, 0.0, 0.0, 1.0, 1.0) var y = SIMD[DType.float64, 8](0.0, 2.0, nan, inf, 2.0, inf, nan, inf) # The expected values were computed using the R language. var expected = SIMD[DType.float64, 8]( nan, nan, nan, nan, inf, inf, nan, -inf ) var actual = specials.lbeta(x, y) unit_test.assert_equal(actual, expected) fn _mp_rgamma1pm1[type: DType](x: Scalar[type]) raises -> Scalar[type]: var mp = Python.import_module("mpmath") mp.mp.dps += 300 var result = mp.mpf(1) / mp.gamma(mp.mpf(1) + mp.mpf(x)) - mp.mpf(1) mp.mp.dps -= 300 return result.to_float64().cast[type]() fn test_rgamma1pm1[type: DType]() raises: var unit_test = UnitTest("test_rgamma1pm1_" + str(type)) var tiny = FloatLimits[type].min() var epsneg = FloatLimits[type].epsilon_neg() var eps = FloatLimits[type].epsilon() var xs = StaticTuple[Scalar[type], 10]( -1.0 + epsneg, -0.5, -tiny, 0.0, tiny, 0.5, 1.0 - epsneg, 1.0, 1.5 - eps, 7.0, ) var rtol: Scalar[type] @parameter if type == DType.float32: rtol = 1e-6 else: # type == DType.float64 rtol = 1e-12 for i in range(len(xs)): var x = xs[i] var expected = _mp_rgamma1pm1[type](x) var actual = specials.rgamma1pm1(x) unit_test.assert_all_close(actual, expected, atol=0.0, rtol=rtol) fn test_rgamma1pm1_special_cases[type: DType]() raises: var unit_test = UnitTest("test_rgamma1pm1_special_cases_" + str(type)) var inf = math.inf[type]() var nan = math.nan[type]() var x = SIMD[type, 4](nan, -inf, inf, nan) var expected = SIMD[type, 4](nan, nan, -1, nan) var actual = specials.rgamma1pm1(x) unit_test.assert_equal(actual, expected) fn main() raises: # Setting the mpmath precision for this module var mp = Python.import_module("mpmath") mp.mp.dps = 50 # lgamma_correction test_lgamma_correction[DType.float64]() test_lgamma_correction[DType.float32]() test_lgamma_correction_special_cases[DType.float64]() test_lgamma_correction_special_cases[DType.float32]() # lgamma1p test_lgamma1p_region1[DType.float32]() test_lgamma1p_region1[DType.float64]() test_lgamma1p_region2[DType.float32]() test_lgamma1p_region2[DType.float64]() test_lgamma1p_edge_cases[DType.float32]() test_lgamma1p_edge_cases[DType.float64]() # lbeta test_lbeta() test_lbeta_edge_cases() # rgamma1pm1 test_rgamma1pm1[DType.float64]() test_rgamma1pm1[DType.float32]() test_rgamma1pm1_special_cases[DType.float64]() test_rgamma1pm1_special_cases[DType.float32]() --- test/test_test_utils/test_numerics_testing.py --- # type: ignore # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %pytest %s """Tests for numerical testing utilities.""" import numpy as np import pytest from test_utils import numerics_testing @pytest.mark.parametrize( "result_dtype, truth_dtype", [ (np.float32, np.dtype("O")), (np.float32, np.float64), (np.float64, np.dtype("O")), (np.float64, np.longdouble), ], ) def test_relative_error(result_dtype, truth_dtype): result = np.array([0.0, 1.1, 2.0, 3.0], dtype=result_dtype) truth = np.array([0.0, 1.0, 0.0, 3.0], dtype=truth_dtype) output_dtype = numerics_testing._promote_dtype(result_dtype) actual = numerics_testing.relative_error(result, truth) expected = np.array([0.0, 0.1, np.inf, 0.0], dtype=output_dtype) np.testing.assert_equal(actual.dtype, output_dtype) if result_dtype == np.float32: np.testing.assert_allclose(actual, expected, rtol=1e-6, atol=0.0) else: np.testing.assert_allclose(actual, expected, rtol=1e-15, atol=0.0) def test_relative_error_invalid_result_dtype(): result = np.array([0.0, 1.1, 2.0, 3.0], dtype=np.float16) truth = np.array([0.0, 1.0, 0.0, 3.0], dtype=np.float32) with pytest.raises(TypeError, match="single .* or double"): _ = numerics_testing.relative_error(result, truth) def test_relative_error_invalid_truth_dtype(): result = np.array([0.0, 1.1, 2.0, 3.0], dtype=np.float32) truth = np.array([0.0, 1.0, 0.0, 3.0], dtype=np.float32) with pytest.raises(TypeError, match="higher precision"): _ = numerics_testing.relative_error(result, truth) @pytest.mark.parametrize( "x, target_dtype, expected", [ ( np.array( [np.nan, -1.0, 0.0, 1.0, 5.0, np.finfo(np.float64).max, np.inf], dtype=np.longdouble, ), np.float64, np.array( [ np.nan, 1.1102230246251565404e-16, 4.940656458412465442e-324, 1.1102230246251565404e-16, 8.8817841970012523234e-16, 1.9958403095347198117e292, 1.9958403095347198117e292, ], dtype=np.longdouble, ), ), ( np.array( [np.nan, -1.0, 0.0, 1.0, 5.0, np.finfo(np.float32).max, np.inf], dtype=np.float64, ), np.float32, np.array( [ np.nan, 5.960464477539063e-08, 1.401298464324817e-45, 5.960464477539063e-08, 4.76837158203125e-07, 2.028240960365167e31, 2.028240960365167e31, ], dtype=np.float64, ), ), ], ) def test_kahan_ulp(x, target_dtype, expected): output_dtype = numerics_testing._promote_dtype(target_dtype) actual = numerics_testing.kahan_ulp(x, target_dtype) np.testing.assert_equal(actual.dtype, output_dtype) np.testing.assert_allclose(actual, expected, rtol=1e-15, atol=0.0) def test_kahan_ulp_invalid_x_dtype(): x = np.array([0.0, 1.0], dtype=np.float32) target_dtype = np.float32 with pytest.raises(TypeError, match="higher precision"): numerics_testing.kahan_ulp(x, target_dtype) def test_kahan_ulp_invalid_target_dtype(): x = np.array([0.0, 1.0], dtype=np.float64) target_dtype = np.int32 with pytest.raises(TypeError, match="single .* or double"): numerics_testing.kahan_ulp(x, target_dtype) @pytest.mark.parametrize( "result, truth, expected", [ ( np.float64(1.0) + np.finfo(np.float64).eps, np.longdouble(1.0), np.longdouble(2.0), ), ( np.float64(1.0) + np.finfo(np.float64).eps, np.int64(1.0), np.longdouble(2.0), ), ( np.float32(1.0) + np.finfo(np.float32).eps, np.float64(1.0), np.float64(2.0), ), ( np.float32(1.0) + np.finfo(np.float32).eps, np.int32(1.0), np.float64(2.0), ), ], ) def test_error_in_ulps(result, truth, expected): output_dtype = numerics_testing._promote_dtype(result.dtype) actual = numerics_testing.error_in_ulps(result, truth) np.testing.assert_equal(actual.dtype, output_dtype) np.testing.assert_allclose(actual, expected, rtol=1e-15, atol=0.0) def test_error_in_ulps_invalid_result_dtype(): result = np.int32(1) truth = np.float64(1.0) with pytest.raises(TypeError, match="single .* or double"): numerics_testing.error_in_ulps(result, truth) def test_error_in_ulps_invalid_truth_dtype(): result = np.float64(1.0) truth = np.float32(1.0) with pytest.raises(TypeError, match="higher precision"): numerics_testing.error_in_ulps(result, truth) --- test/test_test_utils/test_tensor.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %debug_level %sanitize_checks %s """Tests for tensor utilities.""" import math from tensor import Tensor, TensorShape from test_utils import UnitTest from test_utils.tensor import elementwise, random_uniform # TODO: Investigate why defining `MOJO_ENABLE_ASSERTIONS` leads to test failures. @always_inline fn reciprocal(x: SIMD) -> __type_of(x): return 1.0 / x @always_inline fn div(x: SIMD, y: __type_of(x)) -> __type_of(x): return x / y fn test_unary_elementwise() raises: @parameter fn test_fn[type: DType, force_sequential: Bool](*shape: Int) raises: var unit_test = UnitTest("test_unary_elementwise") var x = random_uniform[type](1.0, 2.0, TensorShape(shape)) var actual = elementwise[reciprocal](x) var expected = 1.0 / x unit_test.assert_true( actual == expected, msg=str(x.spec()) + "_" + str(force_sequential) ) test_fn[DType.float32, force_sequential=False](64, 64) test_fn[DType.float32, force_sequential=True](64, 64) test_fn[DType.float64, force_sequential=False](64, 64) test_fn[DType.float64, force_sequential=True](64, 64) fn test_binary_scalar_elementwise() raises: @parameter fn test_fn[type: DType, force_sequential: Bool](*shape: Int) raises: var unit_test = UnitTest("test_binary_scalar_elementwise") var x = random_uniform[type](1.0, 2.0, TensorShape(shape)) var actual = elementwise[div](x, 2.0) var expected = x / 2.0 unit_test.assert_true( actual == expected, msg=str(x.spec()) + "_" + str(force_sequential) ) test_fn[DType.float32, force_sequential=False](64, 64) test_fn[DType.float32, force_sequential=True](64, 64) test_fn[DType.float64, force_sequential=False](64, 64) test_fn[DType.float64, force_sequential=True](64, 64) fn test_binary_elementwise() raises: @parameter fn test_fn[type: DType, force_sequential: Bool](*shape: Int) raises: var unit_test = UnitTest("test_binary_elementwise") var x = random_uniform[type](1.0, 2.0, TensorShape(shape)) var y = random_uniform[type](1.0, 2.0, x.shape()) var actual = elementwise[div](x, y) var expected = x / y unit_test.assert_true( actual == expected, msg=str(x.spec()) + "_" + str(force_sequential) ) test_fn[DType.float32, force_sequential=False](64, 64) test_fn[DType.float32, force_sequential=True](64, 64) test_fn[DType.float64, force_sequential=False](64, 64) test_fn[DType.float64, force_sequential=True](64, 64) fn main() raises: test_unary_elementwise() test_binary_elementwise() test_binary_scalar_elementwise() --- test/test_test_utils/test_testing.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for testing utilities.""" import math from testing import assert_raises from test_utils import UnitTest fn test_assert_true_success() raises: var unit_test = UnitTest("test_assert_true_success") unit_test.assert_true(True, msg="this test should not have failed") fn test_assert_true_failure() raises: var unit_test = UnitTest("test_assert_true_failure") with assert_raises(contains="this test should have failed"): unit_test.assert_true(False, msg="this test should have failed") fn test_assert_equal_int_success() raises: var unit_test = UnitTest("test_assert_equal_int_success") unit_test.assert_equal(0, 0, msg="this test should not have failed") fn test_assert_equal_int_failure() raises: var unit_test = UnitTest("test_assert_equal_int_failure") with assert_raises(contains="this test should have failed"): unit_test.assert_equal(0, 1, msg="this test should have failed") fn test_assert_equal_simd_success() raises: var unit_test = UnitTest("test_assert_equal_simd_success") var nan = math.nan[DType.float32]() var inf = math.inf[DType.float32]() var actual = SIMD[DType.float32, 4](1.0, 2.0, inf, nan) var desired = SIMD[DType.float32, 4](1.0, 2.0, inf, nan) unit_test.assert_equal( actual, desired, msg="this test should not have failed" ) fn test_assert_equal_simd_failure() raises: var unit_test = UnitTest("test_assert_equal_simd_failure") var nan = math.nan[DType.float32]() var inf = math.inf[DType.float32]() var actual = SIMD[DType.float32, 4](0.0, 2.0, inf, nan) var desired = SIMD[DType.float32, 4](0.0, 2.0, inf, 4.0) with assert_raises(contains="this test should have failed"): unit_test.assert_equal( actual, desired, msg="this test should have failed" ) fn test_assert_all_close_success() raises: var unit_test = UnitTest("test_assert_all_close_success") var nan = math.nan[DType.float32]() var inf = math.inf[DType.float32]() var actual = SIMD[DType.float32, 4](nan, inf, 1.1, 10.2) var desired = SIMD[DType.float32, 4](nan, inf, 1.0, 10.0) unit_test.assert_all_close( actual, desired, atol=0.1, rtol=1.0e-2, msg="this test should not have failed", ) fn test_assert_all_close_failure_nan() raises: var unit_test = UnitTest("test_assert_all_close_failure_nan") var nan = math.nan[DType.float32]() var inf = math.inf[DType.float32]() var actual = SIMD[DType.float32, 4](nan, inf, 1.1, 10.2) var desired = SIMD[DType.float32, 4](0.0, inf, 1.0, 10.0) with assert_raises(contains="this test should have failed"): unit_test.assert_all_close( actual, desired, atol=0.1, rtol=1.0e-2, msg="this test should have failed", ) fn test_assert_all_close_failure_inf() raises: var unit_test = UnitTest("test_assert_all_close_failure_inf") var nan = math.nan[DType.float32]() var inf = math.inf[DType.float32]() var actual = SIMD[DType.float32, 4](nan, 0.0, 1.1, 10.2) var desired = SIMD[DType.float32, 4](nan, inf, 1.0, 10.0) with assert_raises(contains="this test should have failed"): unit_test.assert_all_close( actual, desired, atol=0.1, rtol=1.0e-2, msg="this test should have failed", ) fn test_assert_all_close_failure_atol() raises: var unit_test = UnitTest("test_assert_all_close_failure_atol") var nan = math.nan[DType.float32]() var inf = math.inf[DType.float32]() var actual = SIMD[DType.float32, 4](nan, inf, 1.11, 10.2) var desired = SIMD[DType.float32, 4](nan, inf, 1.0, 10.0) with assert_raises(contains="this test should have failed"): unit_test.assert_all_close( actual, desired, atol=0.1, rtol=1.0e-2, msg="this test should have failed", ) fn test_assert_all_close_failure_rtol() raises: var unit_test = UnitTest("test_assert_all_close_failure_rtol") var nan = math.nan[DType.float32]() var inf = math.inf[DType.float32]() var actual = SIMD[DType.float32, 4](nan, inf, 1.1, 10.21) var desired = SIMD[DType.float32, 4](nan, inf, 1.0, 10.0) with assert_raises(contains="this test should have failed"): unit_test.assert_all_close( actual, desired, atol=0.1, rtol=1.0e-2, msg="this test should have failed", ) fn main() raises: test_assert_true_success() test_assert_true_failure() test_assert_equal_int_success() test_assert_equal_int_failure() test_assert_equal_simd_success() test_assert_equal_simd_failure() test_assert_all_close_success() test_assert_all_close_failure_nan() test_assert_all_close_failure_inf() test_assert_all_close_failure_atol() test_assert_all_close_failure_rtol() --- test/test_utils/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Utilities for testing Specials code.""" from .testing import UnitTest --- test/test_utils/__init__.py --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Utilities for testing Specials code.""" from .python import benchmark from .python import numerics_testing --- test/test_utils/benchmark.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import random from python import Python from python.object import PythonObject from sys.info import simdwidthof from tensor import Tensor from utils.static_tuple import StaticTuple from test_utils.tensor import ( elementwise, random_uniform, run_benchmark, tensor_to_numpy_array, UnaryOperator, ) fn _solution_report[ solution_name: StringLiteral, func: UnaryOperator, *, type: DType, simd_width: Int, force_sequential: Bool = False, ](x: Tensor[type], truth: PythonObject) raises -> PythonObject: """Computes the evaluation metrics for a numerical solution in Mojo.""" var builtins = Python.import_module("builtins") var np = Python.import_module("numpy") var py_utils = Python.import_module("test_utils") var result = elementwise[func, type=type, simd_width=simd_width](x) var msecs = run_benchmark[ func, type=type, simd_width=simd_width, force_sequential=force_sequential, ](x).mean("ms") var err = py_utils.numerics_testing.error_in_ulps( tensor_to_numpy_array(result), truth ) var report = builtins.list() _ = report.append(solution_name) _ = report.append(py_utils.benchmark.format_float(np.max(err))) _ = report.append( py_utils.benchmark.format_float(np.sqrt(np.mean(np.square(err)))) ) _ = report.append(py_utils.benchmark.format_float(msecs)) return report fn run_experiment[ *, num_domains: Int, specials_func: UnaryOperator, mojo_func: UnaryOperator, type: DType, simd_width: Int = simdwidthof[type](), force_sequential: Bool = False, mojo_func_name: StringLiteral = "Mojo Stdlib", ]( experiment_name: StringLiteral, *, num_samples: Int, min_values: StaticTuple[Scalar[type], num_domains], max_values: StaticTuple[Scalar[type], num_domains], truth_func: PythonObject, python_func: PythonObject, python_func_name: StringLiteral = "Python", ) raises: """Runs a given experiment.""" var builtins = Python.import_module("builtins") var py_utils = Python.import_module("test_utils") random.seed(42) var domain_names = builtins.list() var data = builtins.list() var num_solutions = 3 for i in range(len(max_values)): var min_value = min_values[i] var max_value = max_values[i] _ = domain_names.append( py_utils.benchmark.format_domain_name(min_value, max_value) ) var a = random_uniform[type, simd_width=simd_width]( min_value, max_value, num_samples ) var a_arr = tensor_to_numpy_array(a) # Truth function var truth = truth_func(a_arr) # Specials function var specials_report = _solution_report[ "Specials", specials_func, type=type, simd_width=simd_width, force_sequential=force_sequential, ](a, truth) _ = data.append(specials_report) # Mojo function var mojo_report = _solution_report[ mojo_func_name, mojo_func, type=type, simd_width=simd_width, force_sequential=force_sequential, ](a, truth) _ = data.append(mojo_report) # Python function var python_report = py_utils.benchmark.solution_report( python_func_name, python_func, a_arr, truth ) _ = data.append(python_report) _ = py_utils.benchmark.print_experiment_results( data, domain_names, num_solutions, String(experiment_name) + " (" + str(type) + ")", ) --- test/test_utils/python/__init__.py --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # --- test/test_utils/python/benchmark.py --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from timeit import timeit import numpy as np from tabulate import tabulate, SEPARATING_LINE # type: ignore[import-untyped] from test_utils.python import numerics_testing def format_domain_name(min_value, max_value): """Formats domain name for printing.""" values = [min_value, max_value] formatted = [] for value in values: if value == int(value): if np.abs(value) > 10e3: formatted.append(f"{int(value):.0e}") else: formatted.append(f"{int(value)}") else: if np.abs(value) < 0.001: formatted.append(f"{value:.0e}") elif np.log10(np.abs(value)) >= 3: formatted.append(f"{value:.1e}") else: formatted.append(f"{value:.1f}") return f"{formatted[0]},{formatted[1]}" def format_float(value): """Formats float values for printing.""" if (value == 0.0) or (0.01 <= np.abs(value) < 1e9): return f"{value:,.3f}" else: return f"{value:.2e}" def benchmark(func, *args): """Computes the average execution time of a Python function.""" # Warmup phase _ = timeit(lambda: func(*args), number=2) msecs = 1000 * timeit(lambda: func(*args), number=100) / 100 return msecs def solution_report(solution_name, func, x_arr, truth): """Computes the evaluation metrics for a numerical solution in Python.""" result = func(x_arr) msecs = benchmark(func, x_arr) err = numerics_testing.error_in_ulps(result, truth) return [ solution_name, format_float(np.max(err)), format_float(np.sqrt(np.mean(np.square(err)))), format_float(msecs), ] def print_experiment_results(data, domain_names, num_solutions, experiment_name): """Prints the evaluation metrics for all numerical solutions.""" headers = [ "\nDomain", "\nSolution", "Maximum Error\nObserved (ulps)", "RMS Error\nObserved (ulps)", "Average Execution\nTime (msecs)", ] # Insert domain names current_domain = 0 for i, report in enumerate(data): if i % num_solutions == 0: domain_name = domain_names[current_domain] data[i].insert(0, domain_name) current_domain += 1 else: data[i].insert(0, "") # Insert horizontal lines between domains for index in range(num_solutions, len(data) + num_solutions, num_solutions + 1): data.insert(index, SEPARATING_LINE) print(f"\nExperiment: {experiment_name}\n") colalign = ("left", "left", "right", "right", "right") table = tabulate( data, headers, tablefmt="simple", colalign=colalign, disable_numparse=True ) print(table) --- test/test_utils/python/numerics_testing.py --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # Some of the code in this file is adapted from: # # tensorflow/probability: # Copyright 2018 The TensorFlow Probability Authors. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"). # # References: # # Beebe, N. H. (2017). The Mathematical-Function Computation Handbook: # Programming Using the MathCW Portable Software Library. # Springer International Publishing. # https://doi.org/10.1007/978-3-319-64110-2 # # Muller, J. M. (2005). On the definition of ulp (x). # [Research Report] Laboratoire de l’informatique duparallélisme. 2005, 2+11p. # https://inria.hal.science/inria-00070503/file/RR2005-09.pdf """Numerical testing utilities.""" import numpy as np def _promote_dtype(dtype): """Promotes `dtype` to a higher precision floating-point type.""" dtype = np.dtype(dtype) assert dtype in (np.float32, np.float64) if dtype == np.float32: return np.float64 return np.longdouble def relative_error(result, truth): """Computes the relative error of `result` relative to `truth`. The relative error is defined as `abs((result - truth) / truth)`. The computation of that difference and ratio are done in the next higher precision compared to the working precision. The data types `result.dtype` and `truth.dtype` must correspond to the working precision and a higher precision floating-point types, respectively. Args: result: A NumPy array of values whose deviation to assess. truth: A NumPy Array of values presumed correct. Must broadcast with `result`. Returns: A NumPy array of element-wise relative error values. The data type of the output array is the next higher precision floating-point type compared to the data type of `result`: - `np.float64` if `result.dtype` is `np.float32`; or - `np.longdouble` if `result.dtype` is `np.float64`. Raises: TypeError: If `result.dtype` is not a floating-point of single (`float32`) or double (`float64`) precision. TypeError: If `truth.dtype` is a floating-point type but does not have higher precision than `result.dtype`. """ result = np.array(result) if result.dtype not in (np.float32, np.float64): raise TypeError( "`result.dtype` must be a floating-point of single (`float32`) or " "double (`float64`) precision" ) output_dtype = _promote_dtype(result.dtype) truth = np.array(truth) if truth.dtype.kind == "f": if np.finfo(truth.dtype).precision <= np.finfo(result.dtype).precision: raise TypeError( "When `truth.dtype` is a floating-point type, it must have " "higher precision than `result.dtype`" ) result = result.astype(output_dtype) truth = truth.astype(output_dtype) truth_is_zero = np.equal(truth, 0.0) largest_subnormal = np.nextafter(np.finfo(truth.dtype).smallest_normal, 0.0) truth_is_subnormal = ~truth_is_zero & (np.abs(truth) <= largest_subnormal) safe_denominator = np.where( truth_is_zero, np.ones_like(truth), np.where( (result > 0) & (truth > 0) & truth_is_subnormal, largest_subnormal, truth, ), ) relerr = np.abs((result - truth) / safe_denominator) relerr = np.where(truth_is_zero, np.inf, relerr) relerr = np.where(result == truth, np.zeros_like(truth), relerr) return relerr def kahan_ulp(x, target_dtype): """Computes the Kahan-ulp function at `x` element-wise. Ulp stands for "unit in the last place". If `x` is an arbitrary real number, the Kahan-ulp at `x` is the distance between the two floating-point numbers nearest `x`, even if `x` is not contained in the interval between them. The computation of the Kahan-ulp is done in the next higher precision compared to the working precision. Args: x: Array of floating-point values. The data type of this array must have higher precision than `target_dtype`. target_dtype: Data type corresponding to the working precision. Returns: Array of element-wise Kahan-ulp values. The data type of the output array is the next higher precision floating-point type compared to the data type of `x`: - `np.float64` if `result.dtype` is `np.float32`; or - `np.longdouble` if `result.dtype` is `np.float64`. Raises: TypeError: If `target_dtype` is not a floating-point of single (`float32`) or double (`float64`) precision. TypeError: If `x.dtype` is a floating-point type but does not have higher precision than `target_dtype`. """ target_dtype = np.dtype(target_dtype) if target_dtype not in (np.float32, np.float64): raise TypeError( "`target_dtype` must be a floating-point of single (`float32`) or " "double (`float64`) precision" ) x = np.array(x) if x.dtype.kind == "f": if np.finfo(x.dtype).precision <= np.finfo(target_dtype).precision: raise TypeError( "When `x.dtype` is a floating-point type, it must have higher " "precision than `target_dtype`" ) higher_precision_dtype = _promote_dtype(target_dtype) x = x.astype(higher_precision_dtype) x = np.abs(x) one = higher_precision_dtype(1) emax = np.finfo(target_dtype).maxexp emin = np.finfo(target_dtype).minexp + 1 t = np.finfo(target_dtype).nmant xsml = np.ldexp(one, emin) xmax = np.finfo(target_dtype).max is_normal = (x >= xsml) & (x <= xmax) result = np.empty_like(x) result = np.where(np.isnan(x), np.nan, result) result = np.where(x < xsml, np.ldexp(one, emin - (t + 1)), result) result = np.where(x > xmax, np.ldexp(one, emax - (t + 1)), result) safe_x = np.where(is_normal, x, one) expmin = np.log2(safe_x).astype(np.int32) exponent = expmin - t powermin = np.ldexp(one, expmin) exponent = np.where( safe_x / powermin <= one + np.ldexp(one, -(t + 2)), exponent - 1, exponent, ) result = np.where(is_normal, np.ldexp(one, exponent), result) if result.shape == (): return higher_precision_dtype(result.item(0)) return result def error_in_ulps(result, truth): """Computes the error in ulps of `result` relative to `truth`. Ulp stands for "unit in the last place". The error in ulps is defined as `abs((result - truth) / kahan_ulp(truth))`. The computation of that difference and ratio are done in the next higher precision compared to the working precision. The data types `result.dtype` and `truth.dtype` must correspond to the working precision and a higher precision floating-point types, respectively. Args: result: Array of values whose deviation to assess. truth: Array of values presumed correct. Must broadcast with `result`. Returns: A NumPy array of element-wise error in ulps values. The data type of the output array is the next higher precision floating-point type compared to the data type of `result`: - `np.float64` if `result.dtype` is `np.float32`; or - `np.longdouble` if `result.dtype` is `np.float64`. Raises: TypeError: If `result.dtype` is not a floating-point of single (`float32`) or double (`float64`) precision. TypeError: If `truth.dtype` is a floating-point type but does not have higher precision than `result.dtype`. """ result = np.array(result) if result.dtype not in (np.float32, np.float64): raise TypeError( "`result.dtype` must be a floating-point of single (`float32`) or " "double (`float64`) precision" ) target_dtype = result.dtype output_dtype = _promote_dtype(target_dtype) truth = np.array(truth) if truth.dtype.kind == "f": if np.finfo(truth.dtype).precision <= np.finfo(result.dtype).precision: raise TypeError( "When `truth.dtype` is a floating-point type, it must have " "higher precision than `result.dtype`" ) result = result.astype(output_dtype) truth = truth.astype(output_dtype) ulp_truth = kahan_ulp(truth, target_dtype=target_dtype) return np.abs((result - truth) / ulp_truth) --- test/test_utils/tensor.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # """Utilities for working with Tensors.""" import benchmark import math from algorithm.functional import vectorize from python import Python from python.object import PythonObject from tensor import Tensor, TensorShape from specials.utils import functional alias UnaryOperator = fn[type: DType, width: Int] (SIMD[type, width]) -> SIMD[ type, width ] """ Signature of a function that performs an elementwise operation on a single SIMD vector. """ alias BinaryOperator = fn[type: DType, width: Int] ( SIMD[type, width], SIMD[type, width] ) -> SIMD[type, width] """ Signature of a function that performs an elementwise operation on two SIMD vectors. """ # ===----------------------------------------------------------------------=== # # Elementwise # ===----------------------------------------------------------------------=== # @always_inline fn _elementwise_impl[ func: UnaryOperator, type: DType, simd_width: Int, force_sequential: Bool, ](x: Tensor[type]) -> Tensor[type]: """Implements the elementwise operation on a tensor.""" var result = Tensor[type](x.shape()) var num_elements = x.num_elements() @always_inline @parameter fn inner_func[simd_width: Int](index: Int): var a = x.load[width=simd_width](index) result.store[width=simd_width](index, func(a)) @parameter if force_sequential: vectorize[inner_func, simd_width](num_elements) else: functional.elementwise[inner_func, simd_width=simd_width](num_elements) return result^ @always_inline fn _elementwise_impl[ func: BinaryOperator, type: DType, simd_width: Int, force_sequential: Bool, ](x: Tensor[type], scalar: Scalar[type]) -> Tensor[type]: """Implements the elementwise operation on a tensor and a scalar.""" var result = Tensor[type](x.shape()) var num_elements = x.num_elements() @always_inline @parameter fn inner_func[simd_width: Int](index: Int): var a = x.load[width=simd_width](index) var b = SIMD[type, simd_width](scalar) result.store[width=simd_width](index, func(a, b)) @parameter if force_sequential: vectorize[inner_func, simd_width](num_elements) else: functional.elementwise[inner_func, simd_width=simd_width](num_elements) return result^ @always_inline fn _elementwise_impl[ func: BinaryOperator, type: DType, simd_width: Int, force_sequential: Bool, ](x: Tensor[type], y: Tensor[type]) -> Tensor[type]: """Implements the elementwise operation on two tensors.""" var result = Tensor[type](x.shape()) var num_elements = x.num_elements() @always_inline @parameter fn inner_func[simd_width: Int](index: Int): var a = x.load[width=simd_width](index) var b = y.load[width=simd_width](index) result.store[width=simd_width](index, func(a, b)) @parameter if force_sequential: vectorize[inner_func, simd_width](num_elements) else: functional.elementwise[inner_func, simd_width=simd_width](num_elements) return result^ fn elementwise[ func: UnaryOperator, *, type: DType, simd_width: Int = simdwidthof[type](), force_sequential: Bool = False, ](x: Tensor[type]) -> Tensor[type]: """Applies an unary operator to a tensor element-wise. Constraints: The type must be a floating-point of single or double precision. Parameters: func: The unary operator to apply to the input. type: The input and output type. simd_width: The SIMD vector to use. Default is the vector size of the type on the host system. force_sequential: Whether to force sequential execution. Default is `False`. Args: x: The tensor. Returns: The result of applying the unary operator to the input. """ constrained[ type == DType.float32 or type == DType.float64, "tensor type must be a floating-point of single (`float32`) " + "or double (`float64`) precision.", ]() var result = _elementwise_impl[func, type, simd_width, force_sequential](x) return result^ fn elementwise[ func: BinaryOperator, *, type: DType, simd_width: Int = simdwidthof[type](), force_sequential: Bool = False, ](x: Tensor[type], scalar: Scalar[type]) -> Tensor[type]: """Applies a binary operator to a tensor and a scalar element-wise. Constraints: The type must be a floating-point of single or double precision. Parameters: func: The binary operator to apply to the inputs. type: The input and output type. simd_width: The SIMD vector to use. Default is the vector size of the type on the host system. force_sequential: Whether to force sequential execution. Default is `False`. Args: x: The tensor. scalar: The scalar. Returns: The result of applying the binary operator to the inputs. """ constrained[ type == DType.float32 or type == DType.float64, "tensor type must be a floating-point of single (`float32`) " + "or double (`float64`) precision.", ]() var result = _elementwise_impl[func, type, simd_width, force_sequential]( x, scalar ) return result^ fn elementwise[ func: BinaryOperator, *, type: DType, simd_width: Int = simdwidthof[type](), force_sequential: Bool = False, ](x: Tensor[type], y: Tensor[type]) raises -> Tensor[type]: """Applies a binary operator to two tensors element-wise. Constraints: The type must be a floating-point of single or double precision. And it will raise an exception if the arguments do not have the same shape. Parameters: func: The binary operator to apply to the inputs. type: The input and output type. simd_width: The SIMD width to use. Default is the vector size of the type on the host system. force_sequential: Whether to force sequential execution. Default is `False`. Args: x: The first tensor. y: The second tensor. Returns: The result of applying the binary operator to the inputs. """ constrained[ type == DType.float32 or type == DType.float64, "tensor type must be a floating-point of single (`float32`) " + "or double (`float64`) precision.", ]() if x.shape() != y.shape(): raise Error("The arguments `x` and `y` must have the same shape.") var result = _elementwise_impl[func, type, simd_width, force_sequential]( x, y ) return result^ # ===----------------------------------------------------------------------=== # # Benchmark # ===----------------------------------------------------------------------=== # fn run_benchmark[ func: UnaryOperator, *, type: DType, simd_width: Int = simdwidthof[type](), force_sequential: Bool = False, ]( x: Tensor[type], num_warmup: Int = 2, max_iters: Int = 100_000, min_runtime_secs: SIMD[DType.float64, 1] = 0.5, max_runtime_secs: SIMD[DType.float64, 1] = 1, ) -> benchmark.Report: """Runs a benchmark for a unary operator applied to a tensor element-wise. Benchmarking continues until `min_runtime_secs` has elapsed and either `max_iters` OR `max_runtime_secs` is achieved. Constraints: The type must be a floating-point of single or double precision. Parameters: func: The binary operator to apply to the input. This is the function that will be benchmarked. type: The input type. simd_width: The SIMD width to use. Default is the vector size of the type on the host system. force_sequential: Whether to force sequential execution. Default is `False`. Args: x: The tensor. num_warmup: Number of warmup iterations to run before starting benchmarking. Default is 2. max_iters: Max number of iterations to run. Default is 100_000. min_runtime_secs: Lower bound on benchmarking time in secs. Default is 0.5. max_runtime_secs: Upper bound on benchmarking time in secs. Default is 1. Returns: A report containing statistics of the benchmark. """ @always_inline @parameter fn test_fn(): _ = elementwise[ func, type=type, simd_width=simd_width, force_sequential=force_sequential, ](x) return benchmark.run[test_fn]( num_warmup=num_warmup, max_iters=max_iters, min_runtime_secs=min_runtime_secs, max_runtime_secs=max_runtime_secs, ) fn run_benchmark[ func: BinaryOperator, *, type: DType, simd_width: Int = simdwidthof[type](), force_sequential: Bool = False, ]( x: Tensor[type], y: Tensor[type], num_warmup: Int = 2, max_iters: Int = 100_000, min_runtime_secs: SIMD[DType.float64, 1] = 0.5, max_runtime_secs: SIMD[DType.float64, 1] = 1, ) raises -> benchmark.Report: """ Runs a benchmark for a binary operator applied to two tensors element-wise. Benchmarking continues until `min_runtime_secs` has elapsed and either `max_iters` OR `max_runtime_secs` is achieved. Constraints: The type must be a floating-point of single or double precision. And it will raise an exception if the arguments do not have the same shape. Parameters: func: The binary operator to apply to the inputs. This is the function that will be benchmarked. type: The input type. simd_width: The SIMD width to use. Default is the vector size of the type on the host system. force_sequential: Whether to force sequential execution. Default is `False`. Args: x: The first tensor. y: The second tensor. num_warmup: Number of warmup iterations to run before starting benchmarking. Default is 2. max_iters: Max number of iterations to run. Default is 100_000. min_runtime_secs: Lower bound on benchmarking time in secs. Default is 0.5. max_runtime_secs: Upper bound on benchmarking time in secs. Default is 1. Returns: A report containing statistics of the benchmark. """ if x.shape() != y.shape(): raise Error("The arguments `x` and `y` must have the same shape.") @always_inline @parameter fn test_fn(): try: _ = elementwise[ func, type=type, simd_width=simd_width, force_sequential=force_sequential, ](x, y) except Error: pass return benchmark.run[test_fn]( num_warmup=num_warmup, max_iters=max_iters, min_runtime_secs=min_runtime_secs, max_runtime_secs=max_runtime_secs, ) # ===----------------------------------------------------------------------=== # # Random # ===----------------------------------------------------------------------=== # fn random_uniform[ type: DType, *, simd_width: Int = simdwidthof[type]() ]( min_value: Scalar[type], max_value: Scalar[type], owned shape: TensorShape, ) raises -> Tensor[type]: """Generates a tensor with random values drawn from a uniform distribution. Constraints: The type must be a floating-point of single or double precision. And it will raise an exception if `min_value >= max_value`. Parameters: type: The type of the tensor. simd_width: The SIMD width to use. Defaults to the vector size of the type on the host system. Args: min_value: The lower bound of the uniform distribution. max_value: The upper bound of the uniform distribution. shape: The tensor shape. Returns: The tensor with random values drawn from a uniform distribution. """ constrained[ type == DType.float32 or type == DType.float64, "tensor type must be a floating-point of single (`float32`) " + "or double (`float64`) precision.", ]() if min_value >= max_value: raise Error("`min_value` must be less than `max_value`.") return min_value + Tensor[type].rand(shape) * (max_value - min_value) fn random_uniform[ type: DType, *, simd_width: Int = simdwidthof[type]() ]( min_value: Scalar[type], max_value: Scalar[type], *shape: Int, ) raises -> Tensor[type]: """Generates a tensor with random values drawn from a uniform distribution. Constraints: The type must be a floating-point of single or double precision. And it will raise an exception if `min_value >= max_value`. Parameters: type: The type of the tensor. simd_width: The SIMD width to use. Defaults to the vector size of the type on the host system. Args: min_value: The lower bound of the uniform distribution. max_value: The upper bound of the uniform distribution. shape: The tensor shape. Returns: The tensor with random values drawn from a uniform distribution. """ return random_uniform[type, simd_width=simd_width]( min_value, max_value, TensorShape(shape) ) # ===----------------------------------------------------------------------=== # # NumPy # ===----------------------------------------------------------------------=== # fn tensor_to_numpy_array[type: DType](x: Tensor[type]) raises -> PythonObject: """Converts a tensor to a NumPy array. Constraints: Will raise an exception if it is not possible to convert the tensor to a NumPy array with the same shape, data type, and elements. Parameters: type: The type of the tensor. Args: x: The tensor. Returns: The NumPy array with the same shape, type, and elements as the tensor. """ var builtins = Python.import_module("builtins") var np = Python.import_module("numpy") var shape = builtins.tuple( builtins.map(builtins.int, builtins.str(x.shape().__str__()).split("x")) ) var num_elements = x.num_elements() var numpy_array = np.zeros(num_elements, type.__str__()) for i in range(num_elements): _ = np.put(numpy_array, i, x[i]) return numpy_array.reshape(shape) --- test/test_utils/testing.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2023 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # # Some of the code in this file is adapted from: # # modularml/mojo # Copyright (c) 2024, Modular Inc. # Licensed under the Apache License v2.0 with LLVM Exceptions. # # numpy/numpy # Copyright (c) 2005-2023, NumPy Developers. # Licensed under BSD 3 clause. """Utilities for testing Specials code.""" import math import testing @value struct UnitTest: """Provides utilities for testing Specials code.""" var name: String """The name of the unit test.""" fn __init__(inout self: Self, name: String): """Constructs a unit test with the given name. Args: name: The name of the unit test. """ self.name = name fn _assert_true[T: Boolable](self: Self, val: T, *, msg: String) raises: """Base method for asserting that a value is `True`.""" if not val.__bool__(): raise Error("[" + self.name + "] AssertionError: " + msg) fn assert_true[T: Boolable](self: Self, val: T, *, msg: String = "") raises: """Asserts that the input value is `True`. If it is not then an `Error` is raised. Parameters: T: A type that can be converted to a bool. Args: val: The value to assert to be `True`. msg: The message to be printed if the assertion fails. Default is an empty string. Raises: An `Error` with the provided message if assert fails and `None` otherwise. """ var err_msg: String = "condition was unexpectedly `False`" if msg: err_msg += " (" + msg + ")" self._assert_true(val, msg=err_msg) fn assert_equal( self: Self, actual: Int, desired: Int, *, msg: String = "" ) raises: """Asserts that the input values are equal. If it is not then an `Error` is raised. Args: actual: The actual integer. desired: The desired integer. msg: The message to be printed if the assertion fails. Default is an empty string. Raises: An `Error` with the provided message if assert fails and `None` otherwise. """ var err_msg: String = str(actual) + " is not equal to " + str(desired) if msg: err_msg += " (" + msg + ")" self._assert_true(actual == desired, msg=err_msg) fn assert_equal[ type: DType, width: Int ]( self: Self, actual: SIMD[type, width], desired: SIMD[type, width], *, msg: String = "", ) raises: """Asserts that the input values are equal. If it is not then an `Error` is raised. In contrast to the standard usage in Mojo, `NaN`s are compared like numbers: no assertion is raised if both objects have `NaN`s in the same positions. Parameters: type: The type of the actual and desired SIMD vectors. width: The width of the actual and desired SIMD vectors. Args: actual: The actual SIMD vector. desired: The desired SIMD vector. msg: The message to be printed if the assertion fails. Default is an empty string. Raises: An `Error` with the provided message if assert fails and `None` otherwise. """ var err_msg: String = str(actual) + " is not equal to " + str(desired) if msg: err_msg += " (" + msg + ")" var result = (actual == desired) @parameter if actual.type.is_floating_point(): result |= math.isnan(actual) & math.isnan(desired) self._assert_true(all(result), msg=err_msg) fn assert_all_close[ type: DType, width: Int ]( self: Self, actual: SIMD[type, width], desired: SIMD[type, width], *, atol: Scalar[type] = 0.0, rtol: Scalar[type] = 1e-07, msg: String = "", ) raises: """Asserts that the input values are equal up to a tolerance. If it is not then an `Error` is raised. The test compares the difference between `actual` and `desired` to the sum of the absolute tolerance `atol` and the relative tolerance `rtol * abs(desired)`. In contrast to the standard usage in Mojo, `NaN`s are compared like numbers: no assertion is raised if both objects have `NaN`s in the same positions. Parameters: type: The type of the actual and desired SIMD vectors. width: The width of the actual and desired SIMD vectors. Args: actual: The actual SIMD vector. desired: The desired SIMD vector. atol: The absolute tolerance. Default is 0.0. rtol: The relative tolerance. Default is 1e-07. msg: The message to be printed if the assertion fails. Default is an empty string. Raises: An `Error` with the provided message if assert fails and `None` otherwise. """ constrained[type.is_floating_point(), "type must be a floating-point"]() var diff = actual - desired var err_msg: String = str(actual) + " is not close to " + str(desired) err_msg += " with a diff of " + str(diff) if msg: err_msg += " (" + msg + ")" var result = (actual == desired) result |= math.isfinite(desired) & ( abs(diff) <= (atol + rtol * abs(desired)) ) result |= math.isnan(actual) & math.isnan(desired) self._assert_true(all(result), msg=err_msg) --- test/utils/test_big_int.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for the `BigInt` struct.""" from builtin._location import __call_location from testing.testing import _assert_equal_error, assert_equal from specials.utils.big_int import BigInt, BigUInt from test_utils import UnitTest alias DEST_TYPE = DType.int64 alias DEFAULT_WIDTH = 1 @always_inline fn _assert_equal[ size: Int = DEFAULT_WIDTH ]( lhs: BigInt[_, size=size, signed=_, word_type=_], rhs: SIMD[DEST_TYPE, size], ) raises: var casted_lhs = lhs.cast[DEST_TYPE]() if any(casted_lhs != rhs): raise _assert_equal_error( str(casted_lhs), str(rhs), "", __call_location() ) fn test_init() raises: _assert_equal(BigInt[8, size=1](), 0) _assert_equal(BigInt[24, size=1](), 0) _assert_equal(BigInt[8, size=4](), 0) _assert_equal(BigInt[24, size=4](), 0) _assert_equal(BigUInt[8, size=1](), 0) _assert_equal(BigUInt[24, size=1](), 0) _assert_equal(BigUInt[8, size=4](), 0) _assert_equal(BigUInt[24, size=4](), 0) fn test_init_unsafe() raises: _ = BigInt[8, size=1](unsafe_uninitialized=True) _ = BigInt[24, size=1](unsafe_uninitialized=True) _ = BigUInt[8, size=1](unsafe_uninitialized=True) _ = BigUInt[24, size=1](unsafe_uninitialized=True) fn test_init_from_int_literal() raises: _assert_equal(BigInt[8, size=1](0), 0) _assert_equal(BigInt[8, size=1](127), 127) _assert_equal(BigInt[8, size=1](-1), -1) _assert_equal(BigInt[8, size=1](-128), -128) _assert_equal(BigInt[24, size=1](0), 0) _assert_equal(BigInt[24, size=1](8_388_607), 8_388_607) _assert_equal(BigInt[24, size=1](-1), -1) _assert_equal(BigInt[24, size=1](-8_388_608), -8_388_608) _assert_equal(BigUInt[8, size=1](0), 0) _assert_equal(BigUInt[8, size=1](255), 255) _assert_equal(BigUInt[24, size=1](0), 0) _assert_equal(BigUInt[24, size=1](16_777_215), 16_777_215) fn test_init_from_int() raises: _assert_equal(BigInt[8, size=1](Int(1)), 1) _assert_equal(BigInt[24, size=1](Int(1)), 1) _assert_equal(BigUInt[8, size=1](Int(255)), 255) _assert_equal(BigUInt[24, size=1](Int(16_777_215)), 16_777_215) fn test_init_from_signed_simd() raises: alias WIDTH = 4 alias VALUE = SIMD[DEST_TYPE, WIDTH](-2, -1, 1, 2) _assert_equal(BigInt[8](VALUE), VALUE) _assert_equal(BigInt[24](VALUE), VALUE) _assert_equal( BigUInt[8](VALUE), SIMD[DEST_TYPE, WIDTH](254, 255, 1, 2), ) _assert_equal( BigUInt[24](VALUE), SIMD[DEST_TYPE, WIDTH](16_777_214, 16_777_215, 1, 2), ) fn test_init_from_unsigned_simd() raises: alias WIDTH = 4 alias VALUE = SIMD[DType.uint64, WIDTH](1, 2, 255, 16_777_215) _assert_equal( BigInt[8](VALUE), SIMD[DEST_TYPE, WIDTH](1, 2, -1, -1), ) _assert_equal( BigInt[24](VALUE), SIMD[DEST_TYPE, WIDTH](1, 2, 255, -1), ) _assert_equal( BigUInt[8](VALUE), SIMD[DEST_TYPE, WIDTH](1, 2, 255, 255), ) _assert_equal( BigUInt[24](VALUE), SIMD[DEST_TYPE, WIDTH](1, 2, 255, 16_777_215), ) fn test_explicit_copy() raises: alias BITS = List[Int](8, 24) alias SIGNED = List[Bool](True, False) @parameter for i in range(len(BITS)): alias bits = BITS[i] @parameter for j in range(len(SIGNED)): alias signed = SIGNED[j] var existing = BigInt[bits, size=2, signed=signed](1) var copy = BigInt(existing) assert_equal(existing.bits, copy.bits) assert_equal(existing.size, copy.size) assert_equal(existing.signed, copy.signed) assert_equal(existing.word_type, existing.word_type) _assert_equal(existing, 1) _assert_equal(copy, 1) copy += 1 _assert_equal(existing, 1) _assert_equal(copy, 2) fn test_min() raises: _assert_equal(BigInt[8, size=1].min(), -128) _assert_equal(BigInt[24, size=1].min(), -8_388_608) _assert_equal(BigUInt[8, size=1].min(), 0) _assert_equal(BigUInt[24, size=1].min(), 0) fn test_max() raises: _assert_equal(BigInt[8, size=1].max(), 127) _assert_equal(BigInt[24, size=1].max(), 8_388_607) _assert_equal(BigUInt[8, size=1].max(), 255) _assert_equal(BigUInt[24, size=1].max(), 16_777_215) fn test_add() raises: _assert_equal(BigInt[8, size=1](1) + BigInt[8, size=1](-2), -1) _assert_equal(BigInt[24, size=1](1) + BigInt[24, size=1](-2), -1) _assert_equal(BigUInt[8, size=1](15) + BigUInt[8, size=1](16), 31) _assert_equal(BigUInt[24, size=1](255) + BigUInt[24, size=1](1), 256) _assert_equal( BigUInt[24](SIMD[DEST_TYPE, 2](1, 2)) + 2, SIMD[DEST_TYPE, 2](3, 4), ) fn test_iadd() raises: var sval = BigInt[8, size=1](1) var uval = BigUInt[24](SIMD[DEST_TYPE, 2](0, 255)) sval += BigInt[8, size=1](-2) _assert_equal(sval, -1) uval += 1 _assert_equal(uval, SIMD[DEST_TYPE, 2](1, 256)) fn test_add_with_overflow() raises: var sval8 = BigInt[8](SIMD[DEST_TYPE, 2](-128, 127)) var uval8 = BigUInt[8](SIMD[DEST_TYPE, 2](0, 255)) assert_equal(sval8.add_with_overflow(1), SIMD[DType.bool, 2](False, True)) _assert_equal(sval8, SIMD[DEST_TYPE, 2](-127, -128)) assert_equal(sval8.add_with_overflow(-1), SIMD[DType.bool, 2](False, True)) _assert_equal(sval8, SIMD[DEST_TYPE, 2](-128, 127)) assert_equal(uval8.add_with_overflow(1), SIMD[DType.bool, 2](False, True)) _assert_equal(uval8, SIMD[DEST_TYPE, 2](1, 0)) var sval24 = BigInt[24](SIMD[DEST_TYPE, 2](-8_388_608, 8_388_607)) var uval24 = BigUInt[24](SIMD[DEST_TYPE, 2](0, 16_777_215)) assert_equal(sval24.add_with_overflow(1), SIMD[DType.bool, 2](False, True)) _assert_equal(sval24, SIMD[DEST_TYPE, 2](-8_388_607, -8_388_608)) assert_equal(sval24.add_with_overflow(-1), SIMD[DType.bool, 2](False, True)) _assert_equal(sval24, SIMD[DEST_TYPE, 2](-8_388_608, 8_388_607)) assert_equal(uval24.add_with_overflow(1), SIMD[DType.bool, 2](False, True)) _assert_equal(uval24, SIMD[DEST_TYPE, 2](1, 0)) fn test_sub() raises: _assert_equal(BigInt[8, size=1](1) - BigInt[8, size=1](-2), 3) _assert_equal(BigInt[24](Int32(383)) - BigInt[24](Int32(-511)), 894) _assert_equal(BigUInt[8, size=1](16) - BigUInt[8, size=1](15), 1) _assert_equal(BigUInt[24, size=1](383) - BigUInt[24, size=1](255), 128) _assert_equal( BigInt[24, size=4](SIMD[DEST_TYPE, 4](1, 2, 3, 4)) - 2, SIMD[DEST_TYPE, 4](-1, 0, 1, 2), ) fn test_isub() raises: var sval = BigInt[8, size=1](1) var uval = BigUInt[24](SIMD[DEST_TYPE, 2](1, 256)) sval -= BigInt[8, size=1](-2) _assert_equal(sval, 3) uval -= 1 _assert_equal(uval, SIMD[DEST_TYPE, 2](0, 255)) fn test_sub_with_overflow() raises: var sval8 = BigInt[8](SIMD[DEST_TYPE, 2](-128, 127)) var uval8 = BigUInt[8](SIMD[DEST_TYPE, 2](0, 255)) assert_equal(sval8.sub_with_overflow(1), SIMD[DType.bool, 2](True, False)) _assert_equal(sval8, SIMD[DEST_TYPE, 2](127, 126)) assert_equal(sval8.sub_with_overflow(-1), SIMD[DType.bool, 2](True, False)) _assert_equal(sval8, SIMD[DEST_TYPE, 2](-128, 127)) assert_equal(uval8.sub_with_overflow(1), SIMD[DType.bool, 2](True, False)) _assert_equal(uval8, SIMD[DEST_TYPE, 2](255, 254)) var sval24 = BigInt[24](SIMD[DEST_TYPE, 2](-8_388_608, 8_388_607)) var uval24 = BigUInt[24](SIMD[DEST_TYPE, 2](0, 16_777_215)) assert_equal(sval24.sub_with_overflow(1), SIMD[DType.bool, 2](True, False)) _assert_equal(sval24, SIMD[DEST_TYPE, 2](8_388_607, 8_388_606)) assert_equal(sval24.sub_with_overflow(-1), SIMD[DType.bool, 2](True, False)) _assert_equal(sval24, SIMD[DEST_TYPE, 2](-8_388_608, 8_388_607)) assert_equal(uval24.sub_with_overflow(1), SIMD[DType.bool, 2](True, False)) _assert_equal(uval24, SIMD[DEST_TYPE, 2](16_777_215, 16_777_214)) fn test_comparison() raises: @always_inline @parameter fn _test_cmp[bits: Int, signed: Bool]() raises: alias WIDTH = 4 var val1: BigInt[bits, size=WIDTH, signed=signed] var val2: __type_of(val1) @parameter if signed: val1 = SIMD[DEST_TYPE, WIDTH](-1, 0, 1, 2) val2 = SIMD[DEST_TYPE, WIDTH](-2, 0, 2, -1) else: val1 = SIMD[DEST_TYPE, WIDTH](1, 0, 1, 2) val2 = SIMD[DEST_TYPE, WIDTH](0, 0, 2, 1) assert_equal( val1 == val2, SIMD[DType.bool, WIDTH](False, True, False, False) ) assert_equal( val1 != val2, SIMD[DType.bool, WIDTH](True, False, True, True) ) assert_equal( val1 < val2, SIMD[DType.bool, WIDTH](False, False, True, False) ) assert_equal( val1 <= val2, SIMD[DType.bool, WIDTH](False, True, True, False) ) assert_equal( val1 > val2, SIMD[DType.bool, WIDTH](True, False, False, True) ) assert_equal( val1 >= val2, SIMD[DType.bool, WIDTH](True, True, False, True) ) _test_cmp[8, signed=True]() _test_cmp[8, signed=False]() _test_cmp[24, signed=True]() _test_cmp[24, signed=False]() fn test_invert() raises: _assert_equal(~BigInt[8, size=1](1), -2) _assert_equal(~BigInt[24, size=1](1), -2) _assert_equal(~BigUInt[8, size=1](1), 254) _assert_equal(~BigUInt[24, size=1](1), 16_777_214) _assert_equal(~BigInt[8, size=1](127), -128) _assert_equal(~BigInt[24, size=1](8_388_607), -8_388_608) _assert_equal(~BigUInt[8, size=1](127), 128) _assert_equal(~BigUInt[24, size=1](8_388_607), 8_388_608) fn test_lshift() raises: var sval8 = BigInt[8, size=4, word_type = DType.uint8](-99) var uval8 = BigUInt[8, size=4, word_type = DType.uint8](157) var offset = SIMD[DType.index, 4](0, 1, 4, 7) _assert_equal(sval8 << 0, -99) _assert_equal(sval8 << offset, SIMD[DEST_TYPE, 4](-99, 58, -48, -128)) _assert_equal(uval8 << 0, 157) _assert_equal(uval8 << offset, SIMD[DEST_TYPE, 4](157, 58, 208, 128)) var sval24 = BigInt[24, size=4, word_type = DType.uint8](-3_962_546) var uval24 = BigUInt[24, size=4, word_type = DType.uint8](12_814_670) offset = SIMD[DType.index, 4](0, 1, 12, 23) _assert_equal(sval24 << 0, -3_962_546) _assert_equal( sval24 << offset, SIMD[DEST_TYPE, 4](-3_962_546, -7_925_092, -7_020_544, 0), ) _assert_equal(uval24 << 0, 12_814_670) _assert_equal( uval24 << offset, SIMD[DEST_TYPE, 4](12_814_670, 8_852_124, 9_756_672, 0), ) fn test_ilshift() raises: var val = BigInt[24, size=1](1) val <<= 8 _assert_equal(val, 256) fn test_rshift() raises: var sval8 = BigInt[8, word_type = DType.uint8]( SIMD[DType.int8, 4](1, 99, -99, -1) ) var uval8 = BigUInt[8, size=4, word_type = DType.uint8](157) var offset = SIMD[DType.index, 4](0, 1, 4, 7) _assert_equal(sval8 >> 0, SIMD[DEST_TYPE, 4](1, 99, -99, -1)) _assert_equal(sval8 >> offset, SIMD[DEST_TYPE, 4](1, 49, -7, -1)) _assert_equal(uval8 >> 0, 157) _assert_equal(uval8 >> offset, SIMD[DEST_TYPE, 4](157, 78, 9, 1)) var sval24 = BigInt[24, size=4, word_type = DType.uint8](-3_962_546) var uval24 = BigUInt[24, size=4, word_type = DType.uint8](12_814_670) offset = SIMD[DType.index, 4](0, 1, 12, 23) _assert_equal(sval24 >> 0, -3_962_546) _assert_equal( sval24 >> offset, SIMD[DEST_TYPE, 4](-3_962_546, -1_981_273, -968, -1), ) _assert_equal(uval24 >> 0, 12_814_670) _assert_equal( uval24 >> offset, SIMD[DEST_TYPE, 4](12_814_670, 6_407_335, 3_128, 1), ) fn test_irshift() raises: var val = BigInt[24, size=1].min() val >>= 16 _assert_equal(val, -128) fn test_negation() raises: var val = SIMD[DEST_TYPE, 4](-2, -1, 0, 1) @always_inline @parameter fn _test_neg[bits: Int, signed: Bool]() raises: _assert_equal( -BigInt[bits, signed=signed](val), BigInt[bits, signed=signed](-val).cast[DEST_TYPE](), ) _test_neg[8, signed=True]() _test_neg[8, signed=False]() _test_neg[24, signed=True]() _test_neg[24, signed=False]() fn test_unary_plus() raises: var val = SIMD[DEST_TYPE, 4](-2, -1, 0, 1) @always_inline @parameter fn _test_plus[bits: Int, signed: Bool]() raises: var original = BigInt[bits, signed=signed](val) var updated = +original _assert_equal(updated, original.cast[DEST_TYPE]()) updated += 1 _assert_equal(updated, (original + 1).cast[DEST_TYPE]()) _test_plus[8, signed=True]() _test_plus[8, signed=False]() _test_plus[24, signed=True]() _test_plus[24, signed=False]() fn test_cast_to_signed_big_int() raises: var sval8 = BigInt[8, size=1](-1) var uval8 = BigUInt[8, size=1](255) _assert_equal(sval8.cast[8, signed=True](), -1) _assert_equal(sval8.cast[24, signed=True](), -1) _assert_equal(uval8.cast[8, signed=True](), -1) _assert_equal(uval8.cast[24, signed=True](), 255) var sval24 = BigInt[24, size=1](-1) var uval24 = BigUInt[24, size=1](16_777_215) _assert_equal(sval24.cast[8, signed=True](), -1) _assert_equal(sval24.cast[24, signed=True](), -1) _assert_equal(uval24.cast[8, signed=True](), -1) _assert_equal(uval24.cast[24, signed=True](), -1) fn test_cast_to_unsigned_big_int() raises: var sval8 = BigInt[8, size=1](-1) var uval8 = BigUInt[8, size=1](255) _assert_equal(sval8.cast[8, signed=False](), 255) _assert_equal(sval8.cast[24, signed=False](), 255) _assert_equal(uval8.cast[8, signed=False](), 255) _assert_equal(uval8.cast[24, signed=False](), 255) var sval24 = BigInt[24, size=1](-1) var uval24 = BigUInt[24, size=1](16_777_215) _assert_equal(sval24.cast[8, signed=False](), 255) _assert_equal(sval24.cast[24, signed=False](), 16_777_215) _assert_equal(uval24.cast[8, signed=False](), 255) _assert_equal(uval24.cast[24, signed=False](), 16_777_215) fn test_cast_to_simd() raises: alias DTYPES = List[DType]( DType.int8, DType.uint8, DType.int16, DType.uint16, DType.int32, DType.uint32, DType.int64, DType.uint64, ) var pos_num = Int64(876925160929511475) var neg_num = Int64(-876925160929511475) var pos_sval = BigInt[64](pos_num) var neg_sval = BigInt[64](neg_num) var uval = BigUInt[64](pos_num) @parameter for i in range(len(DTYPES)): alias DTYPE = DTYPES[i] var casted_pos_num = pos_num.cast[DTYPE]() var casted_neg_num = neg_num.cast[DTYPE]() assert_equal(pos_sval.cast[DTYPE](), casted_pos_num) assert_equal(neg_sval.cast[DTYPE](), casted_neg_num) assert_equal(uval.cast[DTYPE](), casted_pos_num) fn test_most_significant_digit() raises: var sval = BigInt[24, size=1].max() var uval = BigUInt[24, size=1].max() _assert_equal(sval, 8_388_607) _assert_equal(uval, 16_777_215) assert_equal(sval.get_most_significant_bit(), False) assert_equal(uval.get_most_significant_bit(), True) sval.set_most_significant_bit() uval.clear_most_significant_bit() assert_equal(sval.get_most_significant_bit(), True) assert_equal(uval.get_most_significant_bit(), False) _assert_equal(sval, -1) _assert_equal(uval, 8_388_607) sval.clear_most_significant_bit() uval.set_most_significant_bit() _assert_equal(sval, 8_388_607) _assert_equal(uval, 16_777_215) assert_equal(sval.get_most_significant_bit(), False) assert_equal(uval.get_most_significant_bit(), True) fn test_count_leading_zeros() raises: var uval8 = BigUInt[8, size=1](0) assert_equal(uval8.count_leading_zeros(), 8) uval8.set_most_significant_bit() assert_equal(uval8.count_leading_zeros(), 0) uval8 >>= 1 assert_equal(uval8.count_leading_zeros(), 1) var uval24 = BigUInt[24, size=1](0) assert_equal(uval24.count_leading_zeros(), 24) uval24.set_most_significant_bit() assert_equal(uval24.count_leading_zeros(), 0) uval24 >>= 12 assert_equal(uval24.count_leading_zeros(), 12) fn test_is_negative() raises: var val = SIMD[DType.int8, 2](-1, 0) assert_equal(BigInt[8](val).is_negative(), val < 0) assert_equal(BigUInt[8](val).is_negative(), False) assert_equal(BigInt[24](val).is_negative(), val < 0) assert_equal(BigUInt[24](val).is_negative(), False) fn test_is_zero() raises: var val = SIMD[DType.int8, 4](-1, 0, 1, 2) var expected = val == 0 assert_equal(BigInt[8](val).is_zero(), expected) assert_equal(BigUInt[8](val).is_zero(), expected) assert_equal(BigInt[24](val).is_zero(), expected) assert_equal(BigUInt[24](val).is_zero(), expected) fn main() raises: test_init() test_init_unsafe() test_init_from_int_literal() test_init_from_int() test_init_from_signed_simd() test_init_from_unsigned_simd() test_explicit_copy() test_min() test_max() test_add() test_iadd() test_add_with_overflow() test_sub() test_isub() test_sub_with_overflow() test_comparison() test_invert() test_lshift() test_ilshift() test_rshift() test_irshift() test_negation() test_unary_plus() test_cast_to_signed_big_int() test_cast_to_unsigned_big_int() test_cast_to_simd() test_most_significant_digit() test_count_leading_zeros() test_is_negative() test_is_zero() --- test/utils/test_functional.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for higher-order functions.""" from collections import List, Optional from sys.info import simdwidthof from tensor import Tensor from specials.utils.functional import elementwise, fori_loop from test_utils import UnitTest fn _tensor_mul[ type: DType ]( a: Tensor[type], b: Tensor[type], /, *, min_simds_per_core: Optional[Int] = None, ) raises -> Tensor[type]: alias simd_width = simdwidthof[type]() if a.shape() != b.shape(): raise Error("arguments `a` and `b` must have the same shape") if min_simds_per_core.or_else(1) < 1: raise Error( "argument `min_simds_per_core` must be `None` or a positive" " integer value" ) var ret = Tensor[type](a.shape()) @always_inline @parameter fn func[simd_width: Int](index: Int): var x = a.load[width=simd_width](index) var y = b.load[width=simd_width](index) ret.store[width=simd_width](index, x * y) var num_elements = a.num_elements() if min_simds_per_core: elementwise[func, simd_width=simd_width]( num_elements, min_simds_per_core=min_simds_per_core.value()[] ) else: elementwise[func, simd_width=simd_width](num_elements) return ret^ fn test_elementwise() raises: @parameter fn test_fn[type: DType]() raises: var unit_test = UnitTest("test_elementwise") var a = 1.0 + Tensor[type].rand(4096) var b = 1.0 + Tensor[type].rand(a.shape()) var actual = _tensor_mul(a, b) var expected = a * b unit_test.assert_true(actual == expected, msg=str(type)) test_fn[DType.float32]() test_fn[DType.float64]() fn test_elementwise_parallel() raises: @parameter fn test_fn[type: DType](num_elements: Int) raises: var unit_test = UnitTest("test_elementwise_parallel") var a = 1.0 + Tensor[type].rand(num_elements) var b = 1.0 + Tensor[type].rand(a.shape()) var actual = _tensor_mul(a, b, min_simds_per_core=1) var expected = a * b unit_test.assert_true( actual == expected, msg=str(type) + "_" + str(num_elements) ) for num_elements in List(1, 5, 25, 125, 625): test_fn[DType.float32](num_elements[]) test_fn[DType.float64](num_elements[]) fn test_elementwise_sequential() raises: @parameter fn test_fn[type: DType](num_elements: Int) raises: var unit_test = UnitTest("test_elementwise_sequential") var a = 1.0 + Tensor[type].rand(num_elements) var b = 1.0 + Tensor[type].rand(a.shape()) var actual = _tensor_mul(a, b, min_simds_per_core=num_elements + 1) var expected = a * b unit_test.assert_true( actual == expected, msg=str(type) + "_" + str(num_elements) ) for num_elements in List(1, 5, 25, 125, 625): test_fn[DType.float32](num_elements[]) test_fn[DType.float64](num_elements[]) fn test_fori_loop_increasing_by_1() raises: var unit_test = UnitTest("test_fori_loop_increasing_by_1") var actual = List[Int](capacity=5) var expected = List[Int](0, 1, 2, 3, 4) @always_inline @parameter fn func[i: Int](): actual.append(i) fori_loop[func, 0, 5, 1]() unit_test.assert_equal(len(actual), 5) unit_test.assert_equal(len(expected), 5) for i in range(len(actual)): unit_test.assert_equal(actual[i], expected[i]) fn test_fori_loop_decreasing_by_2() raises: var unit_test = UnitTest("test_fori_loop_decreasing_by_2") var actual = List[Int](capacity=3) var expected = List[Int](5, 3, 1) @always_inline @parameter fn func[i: Int](): actual.append(i) fori_loop[func, 5, -1, -2]() unit_test.assert_equal(len(actual), 3) unit_test.assert_equal(len(expected), 3) for i in range(len(actual)): unit_test.assert_equal(actual[i], expected[i]) fn test_fori_loop_with_conditional() raises: var unit_test = UnitTest("test_fori_loop_with_conditional") var actual = List[Int](capacity=3) var expected = List[Int](5, 4, 3) @always_inline @parameter fn func[i: Int]() -> Bool: actual.append(i) if i <= 3: return False return True fori_loop[func, 5, -1, -1]() unit_test.assert_equal(len(actual), 3) unit_test.assert_equal(len(expected), 3) for i in range(len(actual)): unit_test.assert_equal(actual[i], expected[i]) fn main() raises: test_elementwise() test_elementwise_parallel() test_elementwise_sequential() test_fori_loop_increasing_by_1() test_fori_loop_decreasing_by_2() test_fori_loop_with_conditional() --- test/utils/test_numerics.mojo --- # ===----------------------------------------------------------------------=== # # Copyright 2024 The Specials Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # RUN: %mojo %build_dir %assertion_flag %debug_level %sanitize_checks %s """Tests for utilities that work with numeric types.""" import math from specials.utils.numerics import FloatLimits from test_utils import UnitTest fn test_float_limits_digits() raises: var unit_test = UnitTest("test_float_limits_digits") unit_test.assert_equal(FloatLimits[DType.float16].digits, 11) unit_test.assert_equal(FloatLimits[DType.float32].digits, 24) unit_test.assert_equal(FloatLimits[DType.float64].digits, 53) fn test_float_limits_max_exponent() raises: var unit_test = UnitTest("test_float_limits_max_exponent") unit_test.assert_equal(FloatLimits[DType.float16].max_exponent, 16) unit_test.assert_equal(FloatLimits[DType.float32].max_exponent, 128) unit_test.assert_equal(FloatLimits[DType.float64].max_exponent, 1024) fn test_float_limits_min_exponent() raises: var unit_test = UnitTest("test_float_limits_min_exponent") unit_test.assert_equal(FloatLimits[DType.float16].min_exponent, -13) unit_test.assert_equal(FloatLimits[DType.float32].min_exponent, -125) unit_test.assert_equal(FloatLimits[DType.float64].min_exponent, -1021) fn test_float_limits_radix() raises: var unit_test = UnitTest("test_float_limits_radix") unit_test.assert_equal(FloatLimits[DType.float16].radix, 2) unit_test.assert_equal(FloatLimits[DType.float32].radix, 2) unit_test.assert_equal(FloatLimits[DType.float64].radix, 2) fn test_float_limits_denorm_min() raises: var unit_test = UnitTest("test_float_limits_denorm_min") unit_test.assert_equal( FloatLimits[DType.float16].denorm_min(), Float64(5.960464477539063e-08), ) unit_test.assert_equal( FloatLimits[DType.float32].denorm_min(), Float64(1.401298464324817e-45), ) unit_test.assert_equal( FloatLimits[DType.float64].denorm_min(), math.nextafter(Float64(0.0), 1.0), ) fn test_float_limits_epsilon() raises: var unit_test = UnitTest("test_float_limits_epsilon") unit_test.assert_equal( FloatLimits[DType.float16].epsilon(), Float16(0.0009765625) ) unit_test.assert_equal( FloatLimits[DType.float32].epsilon(), Float32(1.1920928955078125e-07) ) unit_test.assert_equal( FloatLimits[DType.float64].epsilon(), Float64(2.220446049250313e-16) ) fn test_float_limits_epsilon_neg() raises: var unit_test = UnitTest("test_float_limits_epsilon_neg") unit_test.assert_equal( FloatLimits[DType.float16].epsilon_neg(), Float16(0.00048828125) ) unit_test.assert_equal( FloatLimits[DType.float32].epsilon_neg(), Float32(5.960464477539063e-08) ) unit_test.assert_equal( FloatLimits[DType.float64].epsilon_neg(), Float64(1.1102230246251565e-16), ) fn test_float_limits_lowest() raises: var unit_test = UnitTest("test_float_limits_lowest") unit_test.assert_equal( FloatLimits[DType.float16].lowest(), Float16(-65504.0) ) unit_test.assert_equal( FloatLimits[DType.float32].lowest(), Float32(-3.4028234663852886e38) ) unit_test.assert_equal( FloatLimits[DType.float64].lowest(), Float64(-1.7976931348623157e308) ) fn test_float_limits_max() raises: var unit_test = UnitTest("test_float_limits_max") unit_test.assert_equal(FloatLimits[DType.float16].max(), Float16(65504.0)) unit_test.assert_equal( FloatLimits[DType.float32].max(), Float32(3.4028234663852886e38) ) unit_test.assert_equal( FloatLimits[DType.float64].max(), Float64(1.7976931348623157e308) ) fn test_float_limits_min() raises: var unit_test = UnitTest("test_float_limits_min") unit_test.assert_equal( FloatLimits[DType.float16].min(), Float16(6.103515625e-05) ) unit_test.assert_equal( FloatLimits[DType.float32].min(), Float32(1.1754943508222875e-38) ) unit_test.assert_equal( FloatLimits[DType.float64].min(), Float64(2.2250738585072014e-308) ) fn main() raises: test_float_limits_digits() test_float_limits_max_exponent() test_float_limits_min_exponent() test_float_limits_radix() test_float_limits_denorm_min() test_float_limits_epsilon() test_float_limits_epsilon_neg() test_float_limits_lowest() test_float_limits_max() test_float_limits_min() Error processing https://github.com/lrmantovani10/Stable-Diffusion.mojo: Encountered text corresponding to disallowed special token '<|endoftext|>'. If you want this text to be encoded as a special token, pass it to `allowed_special`, e.g. `allowed_special={'<|endoftext|>', ...}`. If you want this text to be encoded as normal text, disable the check for this token by passing `disallowed_special=(enc.special_tokens_set - {'<|endoftext|>'})`. To disable this check for all special tokens, pass `disallowed_special=()`. Error processing https://github.com/Lynet101/Mojo_community-lib: Invalid URL 'None': No scheme supplied. Perhaps you meant https://None? Error processing https://github.com/thatstoasty/gojo: 'int' object has no attribute 'get' --- .github/workflows/python-package.yml --- # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python name: Python package on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ["3.11"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install -e . - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | pytest --- .gitignore --- # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ --- LICENSE --- MIT License Copyright (c) 2023 Manuel Saelices Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # py2mojo Automated Python to Mojo code translation A tool to automatically convert Python code to the new [Mojo programming language](https://www.modular.com/mojo). ## Installation ```bash pip install py2mojo ``` ## Usage You can read the usage by running `py2mojo --help`: ```bash ❯ py2mojo --help usage: py2mojo [-h] [--inplace] [--extension {mojo,🔥}] [--convert-def-to-fn | --no-convert-def-to-fn] [--convert-class-to-struct | --no-convert-class-to-struct] [--float-precision {32,64}] filenames [filenames ...] positional arguments: filenames options: -h, --help show this help message and exit --inplace Rewrite the file inplace --extension {mojo,🔥} File extension of the generated files --convert-def-to-fn, --no-convert-def-to-fn --convert-class-to-struct, --no-convert-class-to-struct --float-precision {32,64} ``` Examples: ```bash ❯ py2mojo myfile.py ``` ```bash ❯ py2mojo mypackage/*.py ``` ## ⚠ Disclaimer Please be aware that the Mojo programming language is still in its nascent stages of development. As with any young language, there might be frequent updates, changes, and unforeseen quirks in its syntax and behavior. There will probably be instances where the conversion might not work and may require manual adjustments. So, consider this tool as experimental. Please do not trust the generated code and double-check it. ## Implementation details This uses a similar approach to the [pyupgrade](https://github.com/asottile/pyupgrade) tool, using the AST parser to analyze the Python code and replace some parts of it with the equivalent Mojo code. As Mojo is a superset of Python, non-replaced logic should be also a valid Mojo code. ## Contributing ### How to install it locally 1. Fork the repository 2. Clone your fork: ```bash git clone [email protected]:youraccount/py2mojo.git ``` 3. Install it locally: ``` cd py2mojo pip install -e . ``` --- py2mojo/__init__.py --- --- py2mojo/converters/__init__.py --- from .assignment import convert_assignment from .classdef import convert_classdef from .functiondef import convert_functiondef __all__ = [ 'convert_assignment', 'convert_classdef', 'convert_functiondef', ] --- py2mojo/converters/assignment.py --- import ast from functools import partial from typing import Callable, Iterable from tokenize_rt import Offset, Token from ..helpers import ast_to_offset, get_annotation_type, find_token, find_token_by_name, get_mojo_type from ..rules import RuleSet def _replace_assignment(tokens: list[Token], i: int, rules: RuleSet, new_type: str) -> None: tokens.insert(i, Token(name='NAME', src='var ')) ann_idx = find_token(tokens, i, ':') type_idx = find_token_by_name(tokens, ann_idx, name='NAME') assign_op_idx = find_token(tokens, type_idx, '=') - 1 newline_idx = find_token_by_name(tokens, type_idx, name='NEWLINE') valid_idxs = (idx for idx in (assign_op_idx, newline_idx) if idx >= 0) end_type_idx = min(valid_idxs) del tokens[type_idx:end_type_idx] tokens.insert(type_idx, Token(name='NAME', src=new_type)) def convert_assignment(node: ast.AnnAssign, rules: RuleSet) -> Iterable[tuple[Offset, Callable]]: """Convert an assignment to a mojo assignment.""" curr_type = get_annotation_type(node.annotation) new_type = get_mojo_type(curr_type, rules) if not new_type: return yield ( ast_to_offset(node), partial( _replace_assignment, new_type=new_type, ), ) --- py2mojo/converters/classdef.py --- import ast from functools import partial from typing import Iterable from tokenize_rt import Token from ..exceptions import ParseException from ..helpers import ast_to_offset, find_token from ..rules import RuleSet def _replace_class_keyword(tokens: list, i: int, rules: RuleSet) -> None: idx = find_token(tokens, i, 'class') tokens[idx] = Token(name='NAME', src='struct') def convert_classdef(node: ast.FunctionDef, rules: RuleSet) -> Iterable: """Converts the annotation of the given function definition.""" if rules.convert_class_to_struct: for child in node.body: if isinstance(child, ast.Assign): raise ParseException(node, 'Class contains non type annotated attributes.') offset = ast_to_offset(node) yield ( offset, partial( _replace_class_keyword, ), ) --- py2mojo/converters/functiondef.py --- import ast from functools import partial from typing import Iterable from tokenize_rt import Token from ..exceptions import ParseException from ..helpers import ( ast_to_offset, get_annotation_type, find_token, find_token_after_offset, find_token_by_name, get_mojo_type, ) from ..rules import RuleSet def _replace_annotation( tokens: list, i: int, rules: RuleSet, end_offset: int, new_type: str, ann_offset: int | None = None ) -> None: if ann_offset: ann_idx = find_token_after_offset(tokens, i, ann_offset) else: ann_idx = find_token(tokens, i, ':') type_idx = find_token_by_name(tokens, ann_idx, name='NAME') end_type_idx = find_token_after_offset(tokens, ann_idx, end_offset) del tokens[type_idx:end_type_idx] tokens.insert(type_idx, Token(name='NAME', src=new_type)) def _replace_def_keyword(tokens: list, i: int, rules: RuleSet) -> None: idx = find_token(tokens, i, 'def') tokens[idx] = Token(name='NAME', src='fn') def _add_declaration(tokens: list, i: int, rules: RuleSet, declaration: str) -> None: tokens.insert(i, Token(name='NAME', src=declaration)) tokens.insert(i + 1, Token(name='UNIMPORTANT_WS', src=' ')) def convert_functiondef(node: ast.FunctionDef, rules: RuleSet = 0) -> Iterable: """Converts the annotation of the given function definition.""" if rules.convert_def_to_fn > 0: offset = ast_to_offset(node) yield ( offset, partial( _replace_def_keyword, ), ) if not node.args.args: return for arg in node.args.args: if arg.arg == 'self': yield ( ast_to_offset(arg), partial( _add_declaration, declaration='inout', ), ) continue if rules.convert_def_to_fn and not arg.annotation: raise ParseException( node, 'For converting a "def" function to "fn", the declaration needs to be fully type annotated' ) curr_type = get_annotation_type(arg.annotation) new_type = get_mojo_type(curr_type, rules) if not new_type: continue yield ( ast_to_offset(arg), partial( _replace_annotation, end_offset=arg.end_col_offset, new_type=new_type, ), ) if node.returns: curr_type = get_annotation_type(node.returns) new_type = get_mojo_type(curr_type, rules) if not new_type: return offset = ast_to_offset(node.returns) yield ( offset, partial( _replace_annotation, end_offset=node.returns.end_col_offset, new_type=new_type, ann_offset=offset.utf8_byte_offset, ), ) --- py2mojo/exceptions.py --- import ast class ParseException(Exception): def __init__(self, node: ast.AST, msg: str): self.node = node self.msg = msg --- py2mojo/helpers.py --- import ast import re import astor from rich import print from rich.text import Text from tokenize_rt import UNIMPORTANT_WS, Offset, Token from .rules import RuleSet def ast_to_offset(node: ast.expr | ast.stmt) -> Offset: return Offset(node.lineno, node.col_offset) def find_token(tokens: list[Token], i: int, src: str) -> int: """Find the index of the token with the given src.""" try: while tokens[i].src != src: i += 1 except IndexError: return -1 return i def find_token_by_name(tokens: list[Token], i: int, name: str) -> int: """Find the index of the token with the given name.""" try: while tokens[i].name != name: i += 1 except IndexError: return -1 return i def find_token_after_offset(tokens: list[Token], i: int, offset: int) -> int: """Find the index of the token after the given offset.""" try: while tokens[i].utf8_byte_offset < offset: i += 1 except IndexError: return -1 return i def fixup_dedent_tokens(tokens: list[Token]) -> None: # copied from pyupgrade """For whatever reason the DEDENT / UNIMPORTANT_WS tokens are misordered | if True: | if True: | pass | else: |^ ^- DEDENT |+----UNIMPORTANT_WS """ for i, token in enumerate(tokens): if token.name == UNIMPORTANT_WS and tokens[i + 1].name == 'DEDENT': tokens[i], tokens[i + 1] = tokens[i + 1], tokens[i] def get_node_name(node: ast.AST) -> str: """Returns the name of the given node.""" if isinstance(node, ast.Name): return node.id if isinstance(node, ast.Constant): return node.value elif isinstance(node, ast.Attribute): return node.attr elif isinstance(node, ast.Call): return node.func.id if isinstance(node.func, ast.Name) else node.func.attr else: return 'unknown' def get_next_node(node: ast.AST) -> ast.AST: """Returns the next node of the given node.""" if isinstance(node, ast.Attribute): return node.value elif isinstance(node, ast.Call): return node.func if isinstance(node.func, ast.Name) else node.func.value else: raise ValueError(f'Unexpected node type: {type(node)}') def get_dot_path(node: ast.Attribute): """Returns the dot path of the given attribute node.""" attr_list = [] while isinstance(node, ast.Attribute) or isinstance(node, ast.Call): attr = get_node_name(node) node = get_next_node(node) attr_list.append(attr) attr_list.append(get_node_name(node)) return reversed(attr_list) def get_annotation_type(node: ast.AST) -> str: """Returns the type of the given annotation node.""" match node.__class__.__name__: case 'Name': curr_type = node.id case 'Subscript': curr_type = f'{node.value.id}[{get_annotation_type(node.slice)}]' case _: curr_type = '' return curr_type def get_mojo_type(curr_type: str, rules: RuleSet) -> str: """Returns the corresponding Mojo type for the given Python type.""" patterns = [ (re.compile(r'int'), 'Int'), (re.compile(r'float'), f'Float{rules.float_precision}'), (re.compile(r'str'), 'String'), (re.compile(r'list'), 'List'), (re.compile(r'dict'), 'Dict'), ] prev_type = '' while prev_type != curr_type: prev_type = curr_type for pattern, replacement in patterns: curr_type = pattern.sub(replacement, curr_type) return curr_type def highlight_code_at_position(code: str, line: int, column: int, end_column: int) -> Text: lines = code.splitlines() highlighted = Text() for idx, source_line in enumerate(lines): if idx + 1 == line: # Highlight the specific column in the given line highlighted.append(source_line[:column], style='white') for i in range(column, min(end_column, len(source_line))): highlighted.append(source_line[i], style='bold black on yellow') highlighted.append(source_line[end_column + 1 :], style='white') else: highlighted.append(source_line, style='white') highlighted.append('\n') return highlighted def display_error(node: ast.AST, message: str): src = astor.to_source(node) highlighted_src = highlight_code_at_position(src, 1, node.col_offset, node.end_col_offset) print('\n[bold red]Error:[/bold red]', message) print('[light_salmon3]Source[/light_salmon3]:\n', highlighted_src) --- py2mojo/main.py --- from __future__ import annotations import argparse import ast from collections.abc import Iterable import os import sys import tokenize from collections import defaultdict from typing import Callable, Sequence, TypeAlias from tokenize_rt import Offset, reversed_enumerate, src_to_tokens, tokens_to_src from .converters import convert_assignment, convert_functiondef, convert_classdef from .exceptions import ParseException from .helpers import display_error, fixup_dedent_tokens from .rules import get_rules, RuleSet TokenFunc: TypeAlias = Callable[[ast.AST, RuleSet], Iterable[tuple[Offset, Callable]]] def get_converters(klass: type) -> list[TokenFunc]: return { ast.ClassDef: [ convert_classdef, ], ast.AnnAssign: [ convert_assignment, ], ast.FunctionDef: [ convert_functiondef, ], }.get(klass, []) def visit(tree: ast.Module, rules: RuleSet) -> dict[Offset, TokenFunc]: nodes = [tree] ret = defaultdict(list) while nodes: node = nodes.pop() for converter in get_converters(type(node)): for offset, token_func in converter(node, rules): ret[offset].append(token_func) for name in reversed(node._fields): value = getattr(node, name) if isinstance(value, ast.AST): nodes.append(value) elif isinstance(value, list): for subvalue in reversed(value): if isinstance(subvalue, ast.AST): nodes.append(subvalue) return ret def convert_to_mojo(source: str, rules: RuleSet) -> str: tree = ast.parse(source) callbacks = visit(tree, rules) if not callbacks: return source try: tokens = src_to_tokens(source) except tokenize.TokenError: return source fixup_dedent_tokens(tokens) for i, token in reversed_enumerate(tokens): if not token.src: continue for callback in callbacks.get(token.offset, ()): callback(tokens, i, rules) return tokens_to_src(tokens) def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument('filenames', nargs='+') parser.add_argument( '--inplace', help='Rewrite the file inplace', action='store_true', ) parser.add_argument( '--extension', help='File extension of the generated files', choices=['mojo', '🔥'], default='🔥', type=str, ) parser.add_argument( '--convert-def-to-fn', default=True, action=argparse.BooleanOptionalAction, ) parser.add_argument( '--convert-class-to-struct', default=True, action=argparse.BooleanOptionalAction, ) parser.add_argument( '--float-precision', default=32, type=int, choices=[32, 64], ) args = parser.parse_args(argv) for filename in args.filenames: mojo_filename = filename if args.inplace else f'{os.path.splitext(filename)[0]}.{args.extension}' with open(filename) as source_file: source = source_file.read() rules = get_rules(args) try: annotated_source = convert_to_mojo(source, rules) except ParseException as exc: display_error(exc.node, exc.msg) sys.exit(1) if source != annotated_source: print(f'Rewriting {filename}' if args.inplace else f'Rewriting {filename} into {mojo_filename}') with open(mojo_filename, 'w', encoding='UTF-8', newline='') as out: out.write(annotated_source) else: print(f'File {filename} unchanged') return 0 if __name__ == '__main__': sys.exit(main()) --- py2mojo/rules.py --- import argparse from dataclasses import dataclass @dataclass class RuleSet: convert_def_to_fn: bool = False convert_class_to_struct: bool = False float_precision: int = 64 def get_rules(args: argparse.Namespace) -> RuleSet: return RuleSet( convert_def_to_fn=args.convert_def_to_fn, convert_class_to_struct=args.convert_class_to_struct, float_precision=args.float_precision, ) --- pyproject.toml --- [project] name = "py2mojo" version = "0.0.2" description = "Automated Python to Mojo code translation" readme = "README.md" requires-python = ">=3.11" license = {file = "LICENSE"} keywords = ["mojo", "code", "development", "converter", "translator"] authors = [ {name = "Manuel Saelices", email = "[email protected]" } ] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3 :: Only", ] dynamic = ["dependencies"] [project.optional-dependencies] dev = ["check-manifest"] test = ["coverage", "pytest"] [project.urls] "Homepage" = "https://github.com/msaelices/py2mojo" "Bug Reports" = "https://github.com/msaelices/py2mojo/issues" "Source" = "https://github.com/msaelices/py2mojo" [project.scripts] py2mojo = "py2mojo.main:main" [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} [build-system] requires = ["setuptools>=43.0.0", "wheel"] build-backend = "setuptools.build_meta" [tool.black] revision = "main" isort = true skip_string_normalization = true log_level = "INFO" line_length = 120 --- requirements.txt --- tokenize_rt>=5.2.0 rich>=13.5.2 astor>=0.8.1 --- tests/conftest.py --- import pytest # We want pytest assert introspection in the helpers pytest.register_assert_rewrite('helpers') --- tests/helpers.py --- from py2mojo.main import convert_to_mojo from py2mojo.rules import RuleSet def validate(source: str, expected: str, rules: RuleSet | None = None) -> None: rules = rules or RuleSet() converted_source = convert_to_mojo(source, rules=rules) assert converted_source == expected --- tests/test_algorithms.py --- from helpers import validate from py2mojo.rules import RuleSet def test_fibonacci(): validate( ''' def fib(n: int) -> int: """ Calculate the nth Fibonacci number. """ if n <= 1: return n else: return fib(n - 1) + fib(n - 2) ''', ''' def fib(n: Int) -> Int: """ Calculate the nth Fibonacci number. """ if n <= 1: return n else: return fib(n - 1) + fib(n - 2) ''', ) validate( ''' def fib(n: int) -> int: """ Calculate the nth Fibonacci number. """ if n <= 1: return n else: return fib(n - 1) + fib(n - 2) ''', ''' fn fib(n: Int) -> Int: """ Calculate the nth Fibonacci number. """ if n <= 1: return n else: return fib(n - 1) + fib(n - 2) ''', rules=RuleSet(convert_def_to_fn=True), ) --- tests/test_assignment.py --- from helpers import validate from py2mojo.rules import RuleSet def test_assignment_with_basic_types(): validate( 'x: int = 10', 'var x: Int = 10', ) validate( 'x: float = 10.5', 'var x: Float64 = 10.5', ) validate( 'x: float = 10.5', 'var x: Float32 = 10.5', rules=RuleSet(float_precision=32), ) validate( 'x: str = "foo"', 'var x: String = "foo"', ) validate( 'x: int', 'var x: Int', ) validate( '"""docstring"""\nx: int', '"""docstring"""\nvar x: Int', ) validate( 'd: dict = {}', 'var d: Dict = {}', ) def test_assignment_with_list_types(): validate( 'x: list[int] = []', 'var x: List[Int] = []', ) validate( 'x: list[float] = []', 'var x: List[Float64] = []', ) validate( 'x: list = []', 'var x: List = []', ) --- tests/test_classdef.py --- import pytest from helpers import validate from py2mojo.exceptions import ParseException from py2mojo.rules import RuleSet def test_classdef(): validate( 'class Foo(Bar): pass', 'class Foo(Bar): pass', ) validate( 'class Foo(Bar): pass', 'struct Foo(Bar): pass', rules=RuleSet(convert_class_to_struct=True), ) validate( 'class Foo(Bar): n: int = 10', 'struct Foo(Bar): var n: Int = 10', rules=RuleSet(convert_class_to_struct=True), ) def test_classdef_non_fully_annotated_classes(): validate( '''class Number: number = 10''', '''class Number: number = 10''', rules=RuleSet(convert_class_to_struct=False), ) with pytest.raises(ParseException): validate( '''class Number: number = 10''', '''class Number: number = 10''', rules=RuleSet(convert_class_to_struct=True), ) --- tests/test_functiondef.py --- import pytest from helpers import validate from py2mojo.exceptions import ParseException from py2mojo.rules import RuleSet def test_functiondef_with_no_params(): validate( 'def main(): print("Hello world!")', 'def main(): print("Hello world!")', ) validate( 'def main(): print("Hello world!")', 'fn main(): print("Hello world!")', rules=RuleSet(convert_def_to_fn=True), ) @pytest.mark.parametrize( 'python_type, mojo_type', [ ('int', 'Int'), ('float', 'Float64'), ], ) def test_functiondef_with_basic_types(python_type, mojo_type): validate( f'def add(x: {python_type}, y: {python_type}) -> {python_type}: return x + y', f'def add(x: {mojo_type}, y: {mojo_type}) -> {mojo_type}: return x + y', ) validate( f'def add(x: {python_type}, y: {python_type}) -> {python_type}: return x + y', f'fn add(x: {mojo_type}, y: {mojo_type}) -> {mojo_type}: return x + y', rules=RuleSet(convert_def_to_fn=True), ) @pytest.mark.parametrize( 'python_type, mojo_type', [ ('int', 'Int'), ('float', 'Float64'), ], ) def test_functiondef_with_list_types(python_type, mojo_type): validate( f'def flatten(l1: list[list[{python_type}]]) -> list[{python_type}]: ...', f'def flatten(l1: List[List[{mojo_type}]]) -> List[{mojo_type}]: ...', ) validate( f'def reverse(l: list[{python_type}]) -> list[{python_type}]: return reversed(l)', f'def reverse(l: List[{mojo_type}]) -> List[{mojo_type}]: return reversed(l)', ) validate( f'def concat(l1: list[{python_type}], l2: list[{python_type}]) -> {python_type}: return l1 + l2', f'def concat(l1: List[{mojo_type}], l2: List[{mojo_type}]) -> {mojo_type}: return l1 + l2', ) validate( 'def concat(l1: list, l2: list) -> list: return l1 + l2', 'def concat(l1: List, l2: List) -> List: return l1 + l2', # no changed ) def test_functiondef_with_float_in_precision(): validate( 'def add(x: float, y: float) -> float: return x + y', 'fn add(x: Float32, y: Float32) -> Float32: return x + y', rules=RuleSet(convert_def_to_fn=True, float_precision=32), ) def test_functiondef_inside_classes(): validate( ''' class Point: def __init__(self, x: int, y: int) -> int: ... ''', ''' class Point: def __init__(inout self, x: Int, y: Int) -> Int: ... ''', ) def test_functiondef_non_fully_annotated_functions(): validate( '''def add(x, y): return x + y''', '''def add(x, y): return x + y''', ) with pytest.raises(ParseException): validate( '''def add(x, y): return x + y''', '''def add(x, y): return x + y''', rules=RuleSet(convert_def_to_fn=True), ) --- .github/workflows/pre-commit.yml --- name: Run pre-commit on: push: branches: - '*' jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.9 - name: Install modular CLI env: MODULAR_AUTH: ${{ secrets.MODULAR_AUTH }} run: | curl https://get.modular.com | MODULAR_AUTH="$MODULAR_AUTH" sh - modular auth "$MODULAR_AUTH" - name: Install mojo CLI run: | modular install nightly/mojo - name: Install pre-commit run: | pip install pre-commit pre-commit install - name: Run pre-commit checks run: | export MODULAR_HOME="/home/runner/.modular" export PATH="/home/runner/.modular/pkg/packages.modular.com_nightly_mojo/bin:$PATH" pre-commit run --all-files --- .github/workflows/release-package.yml --- name: Upload Release Artifacts on: push: tags: - '*' jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.9' - name: Install modular CLI env: MODULAR_AUTH: ${{ secrets.MODULAR_AUTH }} run: | curl https://get.modular.com | MODULAR_AUTH="$MODULAR_AUTH" sh - modular auth "$MODULAR_AUTH" - name: Install mojo CLI run: | modular install nightly/mojo - name: Generate package run: | export MODULAR_HOME="/home/runner/.modular" export PATH="/home/runner/.modular/pkg/packages.modular.com_nightly_mojo/bin:$PATH" bash ./dist/make_release.sh - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: ./dist/stdlib_extensions.mojopkg --- .github/workflows/run_unit_tests.yml --- name: Run mojo unit Tests on: push: branches: - '*' jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.9 - name: Install modular CLI env: MODULAR_AUTH: ${{ secrets.MODULAR_AUTH }} run: | curl https://get.modular.com | MODULAR_AUTH="$MODULAR_AUTH" sh - modular auth "$MODULAR_AUTH" - name: Install mojo CLI run: | modular install nightly/mojo - name: Run tests run: | export MODULAR_HOME="/home/runner/.modular" export PATH="/home/runner/.modular/pkg/packages.modular.com_nightly_mojo/bin:$PATH" mojo -D MOJO_ENABLE_ASSERTIONS run_all_tests.mojo mojo -D MOJO_ENABLE_ASSERTIONS run_all_tests.mojo --- .gitignore --- .vscode/ /stdlib_extensions.mojopkg /dist/stdlib_extensions.mojopkg --- .pre-commit-config.yaml --- repos: - repo: local hooks: - id: mojo-format name: mojo-format entry: mojo format language: system files: '\.mojo$' stages: [commit] --- LICENSE --- MIT License Copyright (c) 2023 Gabriel de Marmiesse Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # mojo-stdlib-extensions A replica of python's stdlib in mojo 🔥 **Note**: I am currently working on porting all this code to Mojo's stdlib, thus, this repository will soon be obsolete. ```python from stdlib_extensions.datetime import datetime, timedelta from stdlib_extensions.builtins.string import rjust from stdlib_extensions.builtins import list_to_str def main(): now = datetime.now() print(now.__str__()) print(now.__repr__()) print(now.year()) print(now.month()) ... time_elapsed = datetime.now() - now print(time_elapsed.total_seconds()) print(rjust("hello world", 20, "*")) my_list = List[String]() my_list.append("hello") my_list.append("world") print(list_to_str(my_list)) ``` Refer to the python documention for the documentation of those functions. Dict is not provided, because it's now in Mojo's stdlib ### Complete list of what is available here: ``` stdlib_extensions.os.getpid stdlib_extensions.os.fspath stdlib_extensions.os.rmdir stdlib_extensions.os.unlink stdlib_extensions.os.urandom stdlib_extensions.pathlib.Path -> /, cwd, open, __fspath__, write_text, read_text, unlink, rmdir stdlib_extensions.builtins.string.rjust stdlib_extensions.builtins.string.ljust stdlib_extensions.builtins.string.endswith stdlib_extensions.builtins.string.startswith stdlib_extensions.builtins.string.split stdlib_extensions.builtins.string.join stdlib_extensions.builtins.string.replace stdlib_extensions.builtins.string.removeprefix stdlib_extensions.builtins.string.removesuffix stdlib_extensions.builtins.string.expandtabs stdlib_extensions.builtins.string.rstrip stdlib_extensions.builtins.string.lstrip stdlib_extensions.builtins.string.strip stdlib_extensions.builtins.hex stdlib_extensions.builtins.to_bytes stdlib_extensions.builtins.input stdlib_extensions.builtins.list_to_str -> for Int and Strings, because Mojo doesn't support multiple traits for the same type yet stdlib_extensions.builtins.bytes -> __len__, __str__, __getitem__, __setitem__, ==, !=, +, *, +=, *=, fromhex, hex stdlib_extensions.datetime.datetime -> microsecond, second, minute, ..., year, +, -, now, min, max stdlib_extensions.datetime.timedelta -> total_seconds, total_microseconds, microseconds, seconds, days, +, -, / stdlib_extensions.datetime.time -> microsecond, second, minute, hour, min, max stdlib_extensions.datetime.date -> year, month, day, min, max, today stdlib_extensions.time.time_ns() stdlib_extensions.uuid.uuid4() stdlib_extensions.uuid.UUID -> __str__, hex, ==, <, bytes, urn, variant, version ``` ### Features missing from mojo to have a perfect replica of the api: * `__iter__` (we need this badly to avoid indexing errors) * `@property` decorator * struct attributes ### Features missing from mojo to improve code readability: * Union types (we need this badly to avoid code duplication) * `String.__mul__()` * f-strings * subclassing struct * absolute imports working with `mojo package` ### Contributing: Any function from the Python stdlib is welcome. Make sure to have the same signatures and apis (or as close as possible if mojo doesn't support something yet). Run the tests with `mojo run_all_tests.mojo`. Reformat with `mojo format ./`. You can also use the pre-commit hook if you don't want to run manually `mojo format ./` before each commit. ```bash pip install pre-commit pre-commit install ``` --- dist/make_release.sh --- set -ex mojo package ./stdlib_extensions -o ./dist/stdlib_extensions.mojopkg --- dist/test_release.sh --- set -ex cp ./dist/stdlib_extensions.mojopkg /tmp/stdlib_extensions.mojopkg cd /tmp cat <<EOF > /tmp/test_import.mojo from stdlib_extensions.builtins.string import endswith def main(): print(endswith("hello world", "world")) print("Success!") EOF mojo /tmp/test_import.mojo mojo build /tmp/test_import.mojo ./test_import --- run_all_tests.mojo --- from stdlib_extensions.stdlib_tests.builtins import ( test_string, test_bytes, test_hex, test_math, ) from stdlib_extensions.stdlib_tests.datetime import ( test_utils, test_timedelta, test_date, test_time_class, test_timezone, test_datetime, ) from stdlib_extensions.stdlib_tests.pathlib import test_path from stdlib_extensions.stdlib_tests.os import test_process from stdlib_extensions import datetime as dt from stdlib_extensions.stdlib_tests.time import test_time from stdlib_extensions.stdlib_tests.uuid import test_uuid_class def run_each_module(): print("running tests for string") test_string.run_tests() print("running tests for bytes") test_bytes.run_tests() print("running tests for hex") test_hex.run_tests() print("running tests for process") test_process.run_tests() print("running tests for path") test_path.run_tests() print("running tests for time") test_time.run_tests() print("running tests for uuid") test_uuid_class.run_tests() print("running tests for math") test_math.run_tests() print("running tests for utils") test_utils.run_tests() print("running tests for timedelta") test_timedelta.run_tests() print("running tests for time") test_time_class.run_tests() print("running tests for date") test_date.run_tests() print("running tests for timezone") test_timezone.run_tests() print("running tests for datetime") test_datetime.run_tests() def main(): test_suite_start_time = dt.datetime.now() run_each_module() test_suite_end_time = dt.datetime.now() print( "All tests passed. Tests time: " + str(test_suite_end_time - test_suite_start_time) + "! 🔥🎉🔥" ) --- stdlib_extensions/__init__.mojo --- --- stdlib_extensions/_utils.mojo --- fn custom_debug_assert(condition: Bool, message: String): if not condition: print(message) print( "Should crash now, if the crash did not happen, you should enable the" " assertions with -D MOJO_ENABLE_ASSERTIONS" ) debug_assert(condition, "Custom debug assert failed") fn custom_debug_assert(message: String): print(message) print( "Should crash now, if the crash did not happen, you should enable the" " assertions with -D MOJO_ENABLE_ASSERTIONS" ) debug_assert(False, "Custom debug assert failed") --- stdlib_extensions/builtins/__init__.mojo --- from ._generic_list import list_to_str from ._bytes import bytes, to_bytes from ..syscalls.filesystem import read_from_stdin from ._hash import custom_hash from ._types import Optional from ._math import divmod, modf from ._custom_equality import ___eq__ fn input(prompt: String) -> String: print(prompt, end="") return input() fn input() -> String: return read_from_stdin()[:-1] # we remove the trailing newline fn hex(x: UInt8) -> String: var hex_table: String = "0123456789abcdef" return "0x" + hex_table[(x >> 4).to_int()] + hex_table[(x & 0xF).to_int()] fn bool_to_int(x: Bool) -> Int: """Since int(x) is not available.""" if x: return 1 else: return 0 --- stdlib_extensions/builtins/_bytes.mojo --- from .._utils import custom_debug_assert from .string import rjust fn get_mapping_byte_to_value() -> List[String]: var bytes_display = List[String]() bytes_display.append("\\x00") bytes_display.append("\\x01") bytes_display.append("\\x02") bytes_display.append("\\x03") bytes_display.append("\\x04") bytes_display.append("\\x05") bytes_display.append("\\x06") bytes_display.append("\\x07") bytes_display.append("\\x08") bytes_display.append("\\t") bytes_display.append("\\n") bytes_display.append("\\x0b") bytes_display.append("\\x0c") bytes_display.append("\\r") bytes_display.append("\\x0e") bytes_display.append("\\x0f") bytes_display.append("\\x10") bytes_display.append("\\x11") bytes_display.append("\\x12") bytes_display.append("\\x13") bytes_display.append("\\x14") bytes_display.append("\\x15") bytes_display.append("\\x16") bytes_display.append("\\x17") bytes_display.append("\\x18") bytes_display.append("\\x19") bytes_display.append("\\x1a") bytes_display.append("\\x1b") bytes_display.append("\\x1c") bytes_display.append("\\x1d") bytes_display.append("\\x1e") bytes_display.append("\\x1f") bytes_display.append(" ") bytes_display.append("!") bytes_display.append('"') bytes_display.append("#") bytes_display.append("$") bytes_display.append("%") bytes_display.append("&") bytes_display.append("'") bytes_display.append("(") bytes_display.append(")") bytes_display.append("*") bytes_display.append("+") bytes_display.append(",") bytes_display.append("-") bytes_display.append(".") bytes_display.append("/") bytes_display.append("0") bytes_display.append("1") bytes_display.append("2") bytes_display.append("3") bytes_display.append("4") bytes_display.append("5") bytes_display.append("6") bytes_display.append("7") bytes_display.append("8") bytes_display.append("9") bytes_display.append(":") bytes_display.append(";") bytes_display.append("<") bytes_display.append("=") bytes_display.append(">") bytes_display.append("?") bytes_display.append("@") bytes_display.append("A") bytes_display.append("B") bytes_display.append("C") bytes_display.append("D") bytes_display.append("E") bytes_display.append("F") bytes_display.append("G") bytes_display.append("H") bytes_display.append("I") bytes_display.append("J") bytes_display.append("K") bytes_display.append("L") bytes_display.append("M") bytes_display.append("N") bytes_display.append("O") bytes_display.append("P") bytes_display.append("Q") bytes_display.append("R") bytes_display.append("S") bytes_display.append("T") bytes_display.append("U") bytes_display.append("V") bytes_display.append("W") bytes_display.append("X") bytes_display.append("Y") bytes_display.append("Z") bytes_display.append("[") bytes_display.append("\\") bytes_display.append("]") bytes_display.append("^") bytes_display.append("_") bytes_display.append("`") bytes_display.append("a") bytes_display.append("b") bytes_display.append("c") bytes_display.append("d") bytes_display.append("e") bytes_display.append("f") bytes_display.append("g") bytes_display.append("h") bytes_display.append("i") bytes_display.append("j") bytes_display.append("k") bytes_display.append("l") bytes_display.append("m") bytes_display.append("n") bytes_display.append("o") bytes_display.append("p") bytes_display.append("q") bytes_display.append("r") bytes_display.append("s") bytes_display.append("t") bytes_display.append("u") bytes_display.append("v") bytes_display.append("w") bytes_display.append("x") bytes_display.append("y") bytes_display.append("z") bytes_display.append("{") bytes_display.append("|") bytes_display.append("}") bytes_display.append("~") bytes_display.append("\\x7f") bytes_display.append("\\x80") bytes_display.append("\\x81") bytes_display.append("\\x82") bytes_display.append("\\x83") bytes_display.append("\\x84") bytes_display.append("\\x85") bytes_display.append("\\x86") bytes_display.append("\\x87") bytes_display.append("\\x88") bytes_display.append("\\x89") bytes_display.append("\\x8a") bytes_display.append("\\x8b") bytes_display.append("\\x8c") bytes_display.append("\\x8d") bytes_display.append("\\x8e") bytes_display.append("\\x8f") bytes_display.append("\\x90") bytes_display.append("\\x91") bytes_display.append("\\x92") bytes_display.append("\\x93") bytes_display.append("\\x94") bytes_display.append("\\x95") bytes_display.append("\\x96") bytes_display.append("\\x97") bytes_display.append("\\x98") bytes_display.append("\\x99") bytes_display.append("\\x9a") bytes_display.append("\\x9b") bytes_display.append("\\x9c") bytes_display.append("\\x9d") bytes_display.append("\\x9e") bytes_display.append("\\x9f") bytes_display.append("\\xa0") bytes_display.append("\\xa1") bytes_display.append("\\xa2") bytes_display.append("\\xa3") bytes_display.append("\\xa4") bytes_display.append("\\xa5") bytes_display.append("\\xa6") bytes_display.append("\\xa7") bytes_display.append("\\xa8") bytes_display.append("\\xa9") bytes_display.append("\\xaa") bytes_display.append("\\xab") bytes_display.append("\\xac") bytes_display.append("\\xad") bytes_display.append("\\xae") bytes_display.append("\\xaf") bytes_display.append("\\xb0") bytes_display.append("\\xb1") bytes_display.append("\\xb2") bytes_display.append("\\xb3") bytes_display.append("\\xb4") bytes_display.append("\\xb5") bytes_display.append("\\xb6") bytes_display.append("\\xb7") bytes_display.append("\\xb8") bytes_display.append("\\xb9") bytes_display.append("\\xba") bytes_display.append("\\xbb") bytes_display.append("\\xbc") bytes_display.append("\\xbd") bytes_display.append("\\xbe") bytes_display.append("\\xbf") bytes_display.append("\\xc0") bytes_display.append("\\xc1") bytes_display.append("\\xc2") bytes_display.append("\\xc3") bytes_display.append("\\xc4") bytes_display.append("\\xc5") bytes_display.append("\\xc6") bytes_display.append("\\xc7") bytes_display.append("\\xc8") bytes_display.append("\\xc9") bytes_display.append("\\xca") bytes_display.append("\\xcb") bytes_display.append("\\xcc") bytes_display.append("\\xcd") bytes_display.append("\\xce") bytes_display.append("\\xcf") bytes_display.append("\\xd0") bytes_display.append("\\xd1") bytes_display.append("\\xd2") bytes_display.append("\\xd3") bytes_display.append("\\xd4") bytes_display.append("\\xd5") bytes_display.append("\\xd6") bytes_display.append("\\xd7") bytes_display.append("\\xd8") bytes_display.append("\\xd9") bytes_display.append("\\xda") bytes_display.append("\\xdb") bytes_display.append("\\xdc") bytes_display.append("\\xdd") bytes_display.append("\\xde") bytes_display.append("\\xdf") bytes_display.append("\\xe0") bytes_display.append("\\xe1") bytes_display.append("\\xe2") bytes_display.append("\\xe3") bytes_display.append("\\xe4") bytes_display.append("\\xe5") bytes_display.append("\\xe6") bytes_display.append("\\xe7") bytes_display.append("\\xe8") bytes_display.append("\\xe9") bytes_display.append("\\xea") bytes_display.append("\\xeb") bytes_display.append("\\xec") bytes_display.append("\\xed") bytes_display.append("\\xee") bytes_display.append("\\xef") bytes_display.append("\\xf0") bytes_display.append("\\xf1") bytes_display.append("\\xf2") bytes_display.append("\\xf3") bytes_display.append("\\xf4") bytes_display.append("\\xf5") bytes_display.append("\\xf6") bytes_display.append("\\xf7") bytes_display.append("\\xf8") bytes_display.append("\\xf9") bytes_display.append("\\xfa") bytes_display.append("\\xfb") bytes_display.append("\\xfc") bytes_display.append("\\xfd") bytes_display.append("\\xfe") bytes_display.append("\\xff") return bytes_display @value struct bytes(Stringable, Sized, CollectionElement): """A mutable sequence of bytes. Behaves like the python version. Note that some_bytes[i] returns an UInt8. some_bytes *= 2 modifies the sequence in-place. Same with +=. Also __setitem__ is available, meaning you can do some_bytes[7] = 105 or even some_bytes[7] = some_other_byte (the latter must be only one byte long). """ var _vector: List[UInt8] fn __init__(inout self): self._vector = List[UInt8]() fn __init__(inout self, owned vector: List[UInt8]): self._vector = vector^ fn __init__(inout self, size: Int): self._vector = List[UInt8](capacity=size) for i in range(size): self._vector.append(0) @staticmethod fn from_values(*values: UInt8) -> bytes: var vector = List[UInt8](capacity=len(values)) for value in values: vector.append(value) return bytes(vector) fn __len__(self) -> Int: return len(self._vector) fn __getitem__(self, index: Int) -> UInt8: return self._vector[index] fn __setitem__(inout self, index: Int, value: UInt8): self._vector[index] = value fn __setitem__(inout self, index: Int, value: bytes): self._vector[index] = value[0] fn __eq__(self, other: bytes) -> Bool: if len(self) != len(other): return False for i in range(len(self)): if self[i] != other[i]: return False return True fn __ne__(self, other: bytes) -> Bool: return not (self == other) fn __add__(owned self, other: bytes) -> bytes: self._vector.extend(other._vector) return self fn __iadd__(inout self: Self, other: bytes): self._vector.extend(other._vector) fn __mul__(self, other: Int) -> bytes: var new_bytes = bytes() for i in range(other): new_bytes += self return new_bytes fn __imul__(inout self: Self, other: Int): if other <= 0: self._vector.clear() return var starting_lenght = len(self) var iterations = other - 1 for _ in range(iterations): for j in range(starting_lenght): self._vector.append(self[j]) fn __str__(self) -> String: alias mapping = get_mapping_byte_to_value() var result_string: String = "b'" for i in range(len(self)): result_string += mapping[self._vector[i].to_int()] result_string += "'" return result_string fn __repr__(self) -> String: return self.__str__() fn hex(self) -> String: var result: String = "" for i in range(len(self)): var as_hex = hex(self[i])[2:] result += rjust(as_hex, 2, "0") return result fn __hash__(self) -> Int: # TODO: do better return hash(str(self)) @staticmethod fn fromhex(string: String) -> bytes: # TODO: remove whitespaces on the input string var vector_of_bytes = List[UInt8](capacity=len(string) // 2) var string_length = len(string) for i in range(0, string_length, 2): var first_char = string[i] var second_char = string[i + 1] var first_value = _ascii_char_to_int(first_char) var second_value = _ascii_char_to_int(second_char) var final_value = (first_value << 4) + second_value vector_of_bytes.append(UInt8(final_value)) return bytes(vector_of_bytes) fn _ascii_char_to_int(char: String) -> Int: var ord_value: Int = ord(char) if 48 <= ord_value <= 57: return ord_value - 48 elif 65 <= ord_value <= 70: return ord_value - 55 elif 97 <= ord_value <= 102: return ord_value - 87 else: custom_debug_assert(False, "Invalid character in hex string") return 0 fn to_bytes(n: Int, length: Int = 1, byteorder: String = "big") -> bytes: var order = range(0, length, 1) if byteorder == "little": order = range(0, length, 1) elif byteorder == "big": order = range(length - 1, -1, -1) else: custom_debug_assert(False, "byteorder must be either 'little' or 'big'") var result_vector = List[UInt8](capacity=length) for i in order: result_vector.append((n >> i * 8) & 0xFF) return bytes(result_vector) --- stdlib_extensions/builtins/_custom_equality.mojo --- from ..datetime import time, timedelta # TODO: move those to __eq__ of the corresponding type when we have conditional traits fn ___eq__(left: Optional[time], right: Optional[time]) -> Bool: if left is None and right is None: return True if left is not None and right is not None: return left.value() == right.value() return False fn ___eq__(left: Optional[timedelta], right: Optional[timedelta]) -> Bool: if left is None and right is None: return True if left is not None and right is not None: return left.value() == right.value() return False --- stdlib_extensions/builtins/_generic_list.mojo --- from .._utils import custom_debug_assert fn list_to_str(input_list: List[String]) -> String: var result: String = "[" for i in range(len(input_list)): var repr = "'" + str(input_list[i]) + "'" if i != len(input_list) - 1: result += repr + ", " else: result += repr return result + "]" fn list_to_str(input_list: List[Int]) -> String: var result: String = "[" for i in range(len(input_list)): var repr = str(input_list[i]) if i != len(input_list) - 1: result += repr + ", " else: result += repr return result + "]" fn _cmp_list(a: List[Int], b: List[Int]) -> Int: for i in range(len(a)): if i >= len(b): return 1 if a[i] < b[i]: return -1 elif a[i] == b[i]: continue else: return 1 if len(a) < len(b): return -1 else: return 0 --- stdlib_extensions/builtins/_hash.mojo --- from sys.info import sizeof fn custom_hash(x: List[Int]) -> Int: """Very simple hash function.""" var prime = 31 var hash_value = 0 for i in range(len(x)): hash_value = prime * hash_value + x[i] return hash_value --- stdlib_extensions/builtins/_math.mojo --- import math fn divmod(a: Int, b: Int) -> Tuple[Int, Int]: return a // b, a % b fn divmod(a: Int64, b: Int64) -> Tuple[Int64, Int64]: return a // b, a % b fn modf(x: Float64) -> Tuple[Float64, Float64]: var floor = math.trunc(x) return (x - floor, floor) --- stdlib_extensions/builtins/_types.mojo --- @value struct Optional[T: CollectionElement](CollectionElement): var has_value: Bool var values: List[T] fn __init__(inout self, value: T): self.has_value = True self.values = List[T]() self.values.append(value) fn __init__(inout self, value: None): self.has_value = False self.values = List[T]() fn __is__(self, other: None) -> Bool: return not self.has_value fn __isnot__(self, other: None) -> Bool: return self.has_value fn value(self) -> T: return self.values[0] --- stdlib_extensions/builtins/string.mojo --- from .._utils import custom_debug_assert alias _ALL_WHITESPACES = " \t\n\r\x0b\f" fn __string__mul__(input_string: String, n: Int) -> String: var result: String = "" for _ in range(n): result += input_string return result fn rjust(input_string: String, width: Int, fillchar: String = " ") -> String: custom_debug_assert( len(fillchar) == 1, "The fill character must be exactly one character long" ) var extra = width - len(input_string) return __string__mul__(fillchar, extra) + input_string fn ljust(input_string: String, width: Int, fillchar: String = " ") -> String: custom_debug_assert( len(fillchar) == 1, "The fill character must be exactly one character long" ) var extra = width - len(input_string) return input_string + __string__mul__(fillchar, extra) fn endswith( input_string: String, suffix: String, start: Int = 0, owned end: Int = -1 ) -> Bool: if end == -1: end = len(input_string) custom_debug_assert( start <= end, "The start index must be less than or equal to the end index" ) if end - start < len(suffix): return False return input_string[end - len(suffix) : end] == suffix fn startswith( input_string: String, prefix: String, start: Int = 0, owned end: Int = -1 ) -> Bool: if end == -1: end = len(input_string) custom_debug_assert( start <= end, "The start index must be less than or equal to the end index" ) if end - start < len(prefix): return False return input_string[start : start + len(prefix)] == prefix fn string_to_list(input_string: String) -> List[String]: var result = List[String]() for i in range(len(input_string)): result.append(input_string[i]) return result fn split( input_string: String, sep: String = " ", owned maxsplit: Int = -1 ) -> List[String]: """The separator can be multiple characters long.""" var result = List[String]() if maxsplit == 0: result.append(input_string) return result if maxsplit < 0: maxsplit = len(input_string) if not sep: return string_to_list(input_string)[0:maxsplit] var output = List[String]() var start = 0 var split_count = 0 for end in range(len(input_string) - len(sep) + 1): if input_string[end : end + len(sep)] == sep: output.append(input_string[start:end]) start = end + len(sep) split_count += 1 if maxsplit > 0 and split_count >= maxsplit: break output.append(input_string[start:]) return output fn join(separator: String, iterable: List[String]) -> String: var result: String = "" for i in range(iterable.__len__()): result += iterable[i] if i != iterable.__len__() - 1: result += separator return result fn replace(input_string: String, old: String, new: String, count: Int = -1) -> String: if count == 0: return input_string var output: String = "" var start = 0 var split_count = 0 for end in range(len(input_string) - len(old) + 1): if input_string[end : end + len(old)] == old: output += input_string[start:end] + new start = end + len(old) split_count += 1 if count >= 0 and split_count >= count and count >= 0: break output += input_string[start:] return output fn removeprefix(input_string: String, prefix: String) -> String: if startswith(input_string, prefix): return input_string[len(prefix) :] return input_string fn removesuffix(input_string: String, suffix: String) -> String: if endswith(input_string, suffix): return input_string[: -len(suffix)] return input_string fn expandtabs(input_string: String, tabsize: Int = 8) -> String: return replace(input_string, "\t", __string__mul__(" ", tabsize)) fn strip(input_string: String, chars: String = _ALL_WHITESPACES) -> String: var lstrip_index = _lstrip_index(input_string, chars) var rstrip_index = _rstrip_index(input_string, chars) return input_string[lstrip_index:rstrip_index] fn lstrip(input_string: String, chars: String = _ALL_WHITESPACES) -> String: return input_string[_lstrip_index(input_string, chars) :] fn rstrip(input_string: String, chars: String = _ALL_WHITESPACES) -> String: return input_string[: _rstrip_index(input_string, chars)] fn _lstrip_index(input_string: String, chars: String) -> Int: for i in range(len(input_string)): if input_string[i] not in chars: return i return len(input_string) fn _rstrip_index(input_string: String, chars: String) -> Int: for i in range(len(input_string) - 1, -1, -1): if input_string[i] not in chars: return i + 1 return 0 --- stdlib_extensions/datetime/__init__.mojo --- from ._date import date from ._time import time from ._datetime import datetime from ._timedelta import timedelta from ._tzinfo import tzinfo from ._timezone import timezone --- stdlib_extensions/datetime/_date.mojo --- from .. import datetime as dt from ..builtins import Optional, bytes from ..builtins import divmod from ._utils import ( ord2ymd, isoweek1monday, ymd2ord, _isoweek_to_gregorian, _build_struct_time, DAYS_NAMES, DAYS_SHORT_NAMES, MONTHS_SHORT_NAMES, MONTHS_NAMES, _parse_isoformat_date, MAXORDINAL, _check_date_fields, ) from ._iso_calendar_date import IsoCalendarDate from ..builtins._generic_list import _cmp_list from ..builtins import custom_hash from ..time import time, time_ns, struct_time from ..builtins.string import ljust, rjust, join from .._utils import custom_debug_assert alias _EPOCH_DATE = date(1970, 1, 1) @value struct date(CollectionElement, Stringable, Hashable): """Concrete date type. Constructors: __new__() fromtimestamp() today() fromordinal() Operators: __repr__, __str__ __eq__, __le__, __lt__, __ge__, __gt__, __hash__ __add__, __radd__, __sub__ (add/radd only with dt.timedelta arg) Methods: timetuple() toordinal() weekday() isoweekday(), isocalendar(), isoformat() ctime() strftime() Properties (readonly): year, month, day """ alias min = date(1, 1, 1) alias max = date(9999, 12, 31) alias resolution = dt.timedelta(days=1) var year: Int var month: Int var day: Int # this is to avoid conflicting with the @value constructor # TODO: remove when https://github.com/modularml/mojo/issues/1705 is fixed var _dummy: Int fn __init__(inout self, year: Int, month: Int, day: Int) -> None: # TODO: enable this # _check_date_fields(year, month, day) self.year = year self.month = month self.day = day self._dummy = 0 # Additional constructors @staticmethod def fromtimestamp(t: Int) -> date: "Construct a date from a POSIX timestamp (like time.time())." return _EPOCH_DATE + dt.timedelta(seconds=t) @staticmethod def fromtimestamp(t: Float64) -> date: "Construct a date from a POSIX timestamp (like time.time())." return _EPOCH_DATE + dt.timedelta(seconds=int(t)) @staticmethod fn today() -> date: "Construct a date from time.time()." var t = time_ns() return _EPOCH_DATE + dt.timedelta(microseconds=(t / 1_000).to_int()) @staticmethod fn fromordinal(n: Int) -> date: """Construct a date from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result. """ var y: Int var m: Int var d: Int y, m, d = ord2ymd(n) return date(y, m, d) @staticmethod fn fromisoformat(date_string: String) raises -> date: """Construct a date from a string in ISO 8601 format.""" # custom_debug_assert(len(date_string) in (7, 8, 10), "Invalid isoformat string: " + date_string) try: var year: Int var month: Int var day: Int year, month, day = _parse_isoformat_date(date_string) return date(year, month, day) except e: raise Error("Invalid isoformat string:" + date_string + ", " + e) @staticmethod fn fromisocalendar(year: Int, week: Int, day: Int) -> date: """Construct a date from the ISO year, week number and weekday. This is the inverse of the date.isocalendar() function""" var gregorian_year: Int var gregorian_month: Int var gregorian_day: Int gregorian_year, gregorian_month, gregorian_day = _isoweek_to_gregorian( year, week, day ) return date(gregorian_year, gregorian_month, gregorian_day) # Conversions to string fn __repr__(self) -> String: """Convert to formal string, for repr(). >>> d = date(2010, 1, 1) >>> repr(d) 'datetime.date(2010, 1, 1)' """ return ( "datetime.date(" + str(self.year) + ", " + str(self.month) + ", " + str(self.day) + ")" ) # XXX These shouldn't depend on time.localtime(), because that # clips the usable dates to [1970 .. 2038). At least ctime() is # easily done without using strftime() -- that's better too because # strftime("%c", ...) is locale specific. fn ctime(self) -> String: "Return ctime() style string." var weekday = self.toordinal() % 7 or 7 var standard_week_day = str(DAYS_SHORT_NAMES[weekday]) var standard_month_day = str(MONTHS_SHORT_NAMES[self.month]) var space_padded_day = rjust(str(self.day), 2, " ") return self.strftime( standard_week_day + " " + standard_month_day + " " + space_padded_day + " 00:00:00 %Y" ) fn strftime(self, owned format: String) -> String: """ Format using strftime(). Example: "%d/%m/%Y, %H:%M:%S" """ # this letter F is unused # if there are performance issues, there might be a way to avoid the replace() # but this solution is much easier to understand and read. format = format.replace("%:z", "%F") var result: String = "" var previous_was_percent = False for i in range(len(format)): var letter = format[i] if previous_was_percent: result += self._get_from_letter(letter) previous_was_percent = False elif letter == "%": previous_was_percent = True else: result += letter return result fn _get_from_letter(self, letter: String) -> String: """See https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes """ if letter == "%": return "%" elif letter == "a": return DAYS_SHORT_NAMES[self.isoweekday()] elif letter == "A": return DAYS_NAMES[self.isoweekday()] elif letter == "w": return str((self.weekday() + 1) % 7) elif letter == "d": return rjust(str(self.day), 2, "0") elif letter == "b": return MONTHS_SHORT_NAMES[self.month] elif letter == "B": return MONTHS_NAMES[self.month] elif letter == "m": return rjust(str(self.month), 2, "0") elif letter == "y": return rjust(str(self.year % 100), 2, "0") elif letter == "Y": return rjust(str(self.year), 4, "0") elif letter == "H": return "00" elif letter == "I": return "12" elif letter == "p": return "AM" elif letter == "M": return "00" elif letter == "S": return "00" elif letter == "f": return "000000" elif letter == "z": return "" elif letter == "Z": return "" elif letter == "j": return rjust((self - date(self.year, 1, 1)).days + 1, 3, "0") elif letter == "U": custom_debug_assert(False, "Not implemented yet for %U") return "" elif letter == "W": custom_debug_assert(False, "Not implemented yet for %W") return "" elif letter == "c": # the day is padded with a space, weird... var day = rjust(str(self.day), 2, " ") return self.strftime("%a %b " + day + " %H:%M:%S %Y") elif letter == "x": return self.strftime("%m/%d/%y") elif letter == "X": return self.strftime("%H:%M:%S") elif letter == "G": custom_debug_assert(False, "Not implemented yet for %G") return "" elif letter == "u": return str(self.isoweekday()) elif letter == "V": custom_debug_assert(False, "Not implemented yet for %V") return "" elif letter == "F": return "" else: custom_debug_assert( False, "strftime format string contains unknown format letter" ) return "error in strftime" def __format__(self, fmt: String) -> String: if len(fmt) != 0: return self.strftime(fmt) return str(self) fn isoformat(self) -> String: """Return the date formatted according to ISO. This is 'YYYY-MM-DD'. References: - http://www.w3.org/TR/NOTE-datetime - http://www.cl.cam.ac.uk/~mgk25/iso-time.html """ return ( rjust(str(self.year), 4, "0") + "-" + rjust(str(self.month), 2, "0") + "-" + rjust(str(self.day), 2, "0") ) fn __str__(self) -> String: """Convert to string, for str(). >>> d = date(2010, 1, 1) >>> str(d) '2010-01-01' """ return self.isoformat() # Standard conversions, __eq__, __le__, __lt__, __ge__, __gt__, # __hash__ (and helpers) def timetuple(self) -> struct_time: "Return local time tuple compatible with time.localtime()." return _build_struct_time(self.year, self.month, self.day, 0, 0, 0, -1) fn toordinal(self) -> Int: """Return proleptic Gregorian ordinal for the year, month and day. January 1 of year 1 is day 1. Only the year, month and day values contribute to the result. """ return ymd2ord(self.year, self.month, self.day) fn replace( self, owned year: Optional[Int] = None, owned month: Optional[Int] = None, owned day: Optional[Int] = None, ) -> date: """Return a new date with new values for the specified fields.""" if year is None: year = self.year if month is None: month = self.month if day is None: day = self.day return date(year.value(), month.value(), day.value()) # Comparisons of date objects with other. fn __eq__(self, other: date) -> Bool: return self._cmp(other) == 0 def __le__(self, other: date) -> Bool: return self._cmp(other) <= 0 def __lt__(self, other: date) -> Bool: return self._cmp(other) < 0 fn __ge__(self, other: date) -> Bool: return self._cmp(other) >= 0 fn __gt__(self, other: date) -> Bool: return self._cmp(other) > 0 fn _cmp(self, other: date) -> Int: var list_1 = List[Int](self.year, self.month, self.day) var list_2 = List[Int](other.year, other.month, other.day) return _cmp_list(list_1, list_2) fn __hash__(self) -> Int: return custom_hash(List[Int](self.year, self.month, self.day)) # Computations fn __add__(self, other: dt.timedelta) -> date: "Add a date to a dt.timedelta." var o = self.toordinal() + other.days custom_debug_assert(0 < o <= MAXORDINAL, "result out of range") return date.fromordinal(o) fn __sub__(self, other: dt.timedelta) -> date: """Subtract two dates, or a date and a dt.timedelta.""" return self + dt.timedelta(-other.days) fn __sub__(self, other: date) -> dt.timedelta: var days1 = self.toordinal() var days2 = other.toordinal() return dt.timedelta(days1 - days2) fn weekday(self) -> Int: "Return day of the week, where Monday == 0 ... Sunday == 6." return (self.toordinal() + 6) % 7 # Day-of-the-week and week-of-the-year, according to ISO fn isoweekday(self) -> Int: "Return day of the week, where Monday == 1 ... Sunday == 7." # 1-Jan-0001 is a Monday return self.toordinal() % 7 or 7 fn isocalendar(self) -> IsoCalendarDate: """Return a named tuple containing ISO year, week number, and weekday. The first ISO week of the year is the (Mon-Sun) week containing the year's first Thursday; everything else derives from that. The first week is 1; Monday is 1 ... Sunday is 7. ISO calendar algorithm taken from http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm (used with permission) """ var year = self.year var week1monday = isoweek1monday(year) var today = ymd2ord(self.year, self.month, self.day) # Internally, week and day have origin 0 var week = (today - week1monday) // 7 var day = (today - week1monday) % 7 if week < 0: year -= 1 week1monday = isoweek1monday(year) week, day = divmod(today - week1monday, 7) elif week >= 52: if today >= isoweek1monday(year + 1): year += 1 week = 0 return IsoCalendarDate(year, week + 1, day + 1) fn _getstate(self) -> bytes: var yhi: Int var ylo: Int yhi, ylo = divmod(self.year, 256) return bytes.from_values(yhi, ylo, self.month, self.day) --- stdlib_extensions/datetime/_datetime.mojo --- from .. import datetime as dt from ._utils import ymd2ord, MAXORDINAL, _check_date_fields, _check_time_fields from ..builtins import divmod from ..builtins._types import Optional from .._utils import custom_debug_assert from ._utils import ( _check_utc_offset, _check_time_fields, _build_struct_time, ) from ..time import struct_time from ..builtins.string import join from utils.variant import Variant from python import Python from ..syscalls.clocks import clock_gettime from ..builtins import custom_hash # TODO: time methods must be transferred to datetime alias _EPOCH = datetime(1970, 1, 1, tzinfo=dt.timezone(dt.timedelta(0))) @value struct datetime(CollectionElement, Stringable, Hashable): # """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]]) # # The year, month and day arguments are required. tzinfo may be None, or an # instance of a tzinfo subclass. The remaining arguments may be ints. # """ var year: Int var month: Int var day: Int var hour: Int var minute: Int var second: Int var microsecond: Int # TODO: use the trait tzinfo instead. # traits are too strict right now to do what we want here. var tzinfo: Optional[dt.timezone] var fold: Int # this is to avoid conflicting with the @value constructor # TODO: remove when https://github.com/modularml/mojo/issues/1705 is fixed var _dummy: Int alias min = datetime(1, 1, 1) alias max = datetime(9999, 12, 31, 23, 59, 59, 999999) alias resolution = dt.timedelta(microseconds=1) fn __init__( inout self, year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Int = 0, microsecond: Int = 0, tzinfo: Optional[dt.timezone] = None, fold: Int = 0, ): # _check_date_fields(year, month, day) _check_time_fields(hour, minute, second, microsecond, fold) self.year = year self.month = month self.day = day self.hour = hour self.minute = minute self.second = second self.microsecond = microsecond self.tzinfo = tzinfo self.fold = fold # TODO: remove when https://github.com/modularml/mojo/issues/1705 is fixed self._dummy = 0 # @classmethod # def fromtimestamp(cls, timestamp, tz=None): # """Construct a datetime from a POSIX timestamp (like time.time()). # # A dt.timezone info object may be passed in as well. # """ # return cls._fromtimestamp(timestamp, tz is not None, tz) # var t = timestamp # var utc = tz is not None # frac, t = _math.modf(t) # us = round(frac * 1e6) # if us >= 1000000: # t += 1 # us -= 1000000 # elif us < 0: # t -= 1 # us += 1000000 # # converter = _time.gmtime if utc else _time.localtime # y, m, d, hh, mm, ss, weekday, jday, dst = converter(t) # ss = min(ss, 59) # clamp out leap seconds if the platform has them # result = cls(y, m, d, hh, mm, ss, us, tz) # if tz is None and not utc: # # As of version 2015f max fold in IANA database is # # 23 hours at 1969-09-30 13:00:00 in Kwajalein. # # Let's probe 24 hours in the past to detect a transition: # max_fold_seconds = 24 * 3600 # # # On Windows localtime_s throws an OSError for negative values, # # thus we can't perform fold detection for values of time less # # than the max time fold. See comments in _datetimemodule's # # version of this method for more details. # if t < max_fold_seconds and sys.platform.startswith("win"): # return result # # y, m, d, hh, mm, ss = converter(t - max_fold_seconds)[:6] # probe1 = cls(y, m, d, hh, mm, ss, us, tz) # trans = result - probe1 - dt.timedelta(0, max_fold_seconds) # if trans.days < 0: # y, m, d, hh, mm, ss = converter(t + trans // dt.timedelta(0, 1))[:6] # probe2 = cls(y, m, d, hh, mm, ss, us, tz) # if probe2 == result: # result._fold = 1 # elif tz is not None: # result = tz.fromutc(result) # return result @staticmethod fn now() -> datetime: var ctime_spec = clock_gettime() return datetime(1970, 1, 1) + dt.timedelta( seconds=ctime_spec.tv_sec.to_int(), microseconds=(ctime_spec.tv_nsec // 1_000).to_int(), ) fn to_python(self) raises -> PythonObject: var python_datetime_module = Python.import_module("datetime") # dt.timezone not suppoted yet custom_debug_assert( self.tzinfo is None, "converting to python is not yet support if tzinfo is not None", ) custom_debug_assert( self.fold == 0, "converting to python is not yet support if fold is not 0" ) return python_datetime_module.datetime( self.year, self.month, self.day, self.hour, self.minute, self.second, self.microsecond, ) @staticmethod fn combine(date: date, time: time) -> datetime: "Construct a datetime from a given date and a given time." return datetime( date.year, date.month, date.day, time.hour, time.minute, time.second, time.microsecond, time.tzinfo, fold=time.fold, ) # @classmethod # def fromisoformat(cls, date_string): # """Construct a datetime from a string in one of the ISO 8601 formats.""" # if not isinstance(date_string, str): # raise TypeError('fromisoformat: argument must be str') # # if len(date_string) < 7: # raise ValueError(f'Invalid isoformat string: {date_string!r}') # # # Split this at the separator # try: # separator_location = _find_isoformat_datetime_separator(date_string) # dstr = date_string[0:separator_location] # tstr = date_string[(separator_location+1):] # # date_components = _parse_isoformat_date(dstr) # except ValueError: # raise ValueError( # f'Invalid isoformat string: {date_string!r}') from None # # if tstr: # try: # time_components = _parse_isoformat_time(tstr) # except ValueError: # raise ValueError( # f'Invalid isoformat string: {date_string!r}') from None # else: # time_components = [0, 0, 0, 0, None] # # return cls(*(date_components + time_components)) # fn timetuple(self) -> struct_time: "Return local time tuple compatible with time.localtime()." var dst = self.dst() var dst_as_int: Int if dst is None: dst_as_int = -1 elif dst.value() != dt.timedelta(0): dst_as_int = 1 else: dst_as_int = 0 return _build_struct_time( self.year, self.month, self.day, self.hour, self.minute, self.second, dst_as_int, ) # # def _mktime(self): # """Return integer POSIX timestamp.""" # epoch = datetime(1970, 1, 1) # max_fold_seconds = 24 * 3600 # t = (self - epoch) // dt.timedelta(0, 1) # def local(u): # y, m, d, hh, mm, ss = _time.localtime(u)[:6] # return (datetime(y, m, d, hh, mm, ss) - epoch) // dt.timedelta(0, 1) # # # Our goal is to solve t = local(u) for u. # a = local(t) - t # u1 = t - a # t1 = local(u1) # if t1 == t: # # We found one solution, but it may not be the one we need. # # Look for an earlier solution (if `fold` is 0), or a # # later one (if `fold` is 1). # u2 = u1 + (-max_fold_seconds, max_fold_seconds)[self.fold] # b = local(u2) - u2 # if a == b: # return u1 # else: # b = t1 - u1 # assert a != b # u2 = t - b # t2 = local(u2) # if t2 == t: # return u2 # if t1 == t: # return u1 # # We have found both offsets a and b, but neither t - a nor t - b is # # a solution. This means t is in the gap. # return (max, min)[self.fold](u1, u2) # # # def timestamp(self): # "Return POSIX timestamp as float" # if self._tzinfo is None: # s = self._mktime() # return s + self.microsecond / 1e6 # else: # return (self - _EPOCH).total_seconds() # # def utctimetuple(self): # "Return UTC time tuple compatible with time.gmtime()." # offset = self.utcoffset() # if offset: # self -= offset # y, m, d = self.year, self.month, self.day # hh, mm, ss = self.hour, self.minute, self.second # return _build_struct_time(y, m, d, hh, mm, ss, 0) # fn date(self) -> date: "Return the date part." return date(self.year, self.month, self.day) fn time(self) -> time: "Return the time part, with tzinfo None." return time( self.hour, self.minute, self.second, self.microsecond, fold=self.fold ) fn timetz(self) -> time: "Return the time part, with same tzinfo." return time( self.hour, self.minute, self.second, self.microsecond, self.tzinfo, fold=self.fold, ) fn replace( self, owned year: Optional[Int] = None, owned month: Optional[Int] = None, owned day: Optional[Int] = None, owned hour: Optional[Int] = None, owned minute: Optional[Int] = None, owned second: Optional[Int] = None, owned microsecond: Optional[Int] = None, owned tzinfo: TzinfoReplacement = True, owned fold: Optional[Int] = None, ) -> datetime: """Return a new datetime with new values for the specified fields.""" if year is None: year = self.year if month is None: month = self.month if day is None: day = self.day if hour is None: hour = self.hour if minute is None: minute = self.minute if second is None: second = self.second if microsecond is None: microsecond = self.microsecond var _tzinfo: Optional[dt.timezone] if tzinfo.is_bool(): _tzinfo = self.tzinfo else: _tzinfo = tzinfo.get_tzinfo() if fold is None: fold = self.fold return datetime( year.value(), month.value(), day.value(), hour.value(), minute.value(), second.value(), microsecond.value(), _tzinfo, fold.value(), ) # __replace__ = replace # # def _local_timezone(self): # if self.tzinfo is None: # ts = self._mktime() # # Detect gap # ts2 = self.replace(fold=1-self.fold)._mktime() # if ts2 != ts: # This happens in a gap or a fold # if (ts2 > ts) == self.fold: # ts = ts2 # else: # ts = (self - _EPOCH) // dt.timedelta(seconds=1) # localtm = _time.localtime(ts) # local = datetime(*localtm[:6]) # # Extract TZ data # gmtoff = localtm.tm_gmtoff # zone = localtm.tm_zone # return dt.timezone(dt.timedelta(seconds=gmtoff), zone) # # def astimezone(self, tz=None): # if tz is None: # tz = self._local_timezone() # elif not isinstance(tz, tzinfo): # raise TypeError("tz argument must be an instance of tzinfo") # # mytz = self.tzinfo # if mytz is None: # mytz = self._local_timezone() # myoffset = mytz.utcoffset(self) # else: # myoffset = mytz.utcoffset(self) # if myoffset is None: # mytz = self.replace(tzinfo=None)._local_timezone() # myoffset = mytz.utcoffset(self) # # if tz is mytz: # return self # # # Convert self to UTC, and attach the new time zone object. # utc = (self - myoffset).replace(tzinfo=tz) # # # Convert from UTC to tz's local time. # return tz.fromutc(utc) # # # Ways to produce a string. # # def ctime(self): # "Return ctime() style string." # weekday = self.toordinal() % 7 or 7 # return "%s %s %2d %02d:%02d:%02d %04d" % ( # _DAYNAMES[weekday], # _MONTHNAMES[self._month], # self._day, # self._hour, self._minute, self._second, # self._year) # fn isoformat(self, sep: String = "T", timespec: String = "auto") -> String: """Return the time formatted according to ISO. The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'. By default, the fractional part is omitted if self.microsecond == 0. If self.tzinfo is not None, the UTC offset is also attached, giving giving a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'. Optional argument sep specifies the separator between date and time, default 'T'. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are 'auto', 'hours', 'minutes', 'seconds', 'milliseconds' and 'microseconds'. """ return self.date().isoformat() + sep + self.timetz().isoformat(timespec) fn __repr__(self) -> String: """Convert to formal string, for repr().""" var result: String = "datetime.datetime(" var components = List[String]( str(self.year), str(self.month), str(self.day), str(self.hour), str(self.minute), str(self.second), str(self.microsecond), ) for _ in range(2): if components[-1] == "0": components.pop_back() result += join(", ", components) if self.tzinfo is not None: result += ", tzinfo=" + self.tzinfo.value().__repr__() if self.fold: result += ", fold=1" result += ")" return result fn __str__(self) -> String: "Convert to string, for str()." return self.isoformat(sep=" ") # @classmethod # def strptime(cls, date_string, format): # 'string, format -> new datetime parsed from a string (like time.strptime()).' # import _strptime # return _strptime._strptime_datetime(cls, date_string, format) fn utcoffset(self) -> Optional[dt.timedelta]: """Return the timezone offset as dt.timedelta positive east of UTC (negative west of UTC).""" if self.tzinfo is None: return None var offset = self.tzinfo.value().utcoffset(self) _check_utc_offset("utcoffset", offset) return offset fn tzname(self) -> Optional[String]: """Return the timezone name. Note that the name is 100% informational -- there's no requirement that it mean anything in particular. For example, "GMT", "UTC", "-500", "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies. """ if self.tzinfo is None: return None return self.tzinfo.value().tzname(self) fn dst(self) -> Optional[dt.timedelta]: """Return 0 if DST is not in effect, or the DST offset (as dt.timedelta positive eastward) if DST is in effect. This is purely informational; the DST offset has already been added to the UTC offset returned by utcoffset() if applicable, so there's no need to consult dst() unless you're interested in displaying the DST info. """ if self.tzinfo is None: return None var offset = self.tzinfo.value().dst(self) _check_utc_offset("dst", offset) return offset # # Comparisons of datetime objects with other. # # def __eq__(self, other): # if isinstance(other, datetime): # return self._cmp(other, allow_mixed=True) == 0 # elif not isinstance(other, date): # return NotImplemented # else: # return False # # def __le__(self, other): # if isinstance(other, datetime): # return self._cmp(other) <= 0 # elif not isinstance(other, date): # return NotImplemented # else: # _cmperror(self, other) # # def __lt__(self, other): # if isinstance(other, datetime): # return self._cmp(other) < 0 # elif not isinstance(other, date): # return NotImplemented # else: # _cmperror(self, other) # # def __ge__(self, other): # if isinstance(other, datetime): # return self._cmp(other) >= 0 # elif not isinstance(other, date): # return NotImplemented # else: # _cmperror(self, other) # # def __gt__(self, other): # if isinstance(other, datetime): # return self._cmp(other) > 0 # elif not isinstance(other, date): # return NotImplemented # else: # _cmperror(self, other) # # def _cmp(self, other, allow_mixed=False): # assert isinstance(other, datetime) # mytz = self._tzinfo # ottz = other._tzinfo # myoff = otoff = None # # if mytz is ottz: # base_compare = True # else: # myoff = self.utcoffset() # otoff = other.utcoffset() # # Assume that allow_mixed means that we are called from __eq__ # if allow_mixed: # if myoff != self.replace(fold=not self.fold).utcoffset(): # return 2 # if otoff != other.replace(fold=not other.fold).utcoffset(): # return 2 # base_compare = myoff == otoff # # if base_compare: # return _cmp((self._year, self._month, self._day, # self._hour, self._minute, self._second, # self._microsecond), # (other._year, other._month, other._day, # other._hour, other._minute, other._second, # other._microsecond)) # if myoff is None or otoff is None: # if allow_mixed: # return 2 # arbitrary non-zero value # else: # raise TypeError("cannot compare naive and aware datetimes") # # XXX What follows could be done more efficiently... # diff = self - other # this will take offsets into account # if diff.days < 0: # return -1 # return diff and 1 or 0 # fn __add__(self, other: dt.timedelta) -> datetime: "Add a datetime and a dt.timedelta." var delta = dt.timedelta( self.toordinal(), hours=self.hour, minutes=self.minute, seconds=self.second, microseconds=self.microsecond, ) delta = delta + other var hour: Int var rem: Int var minute: Int var second: Int hour, rem = divmod(delta.seconds, 3600) minute, second = divmod(rem, 60) custom_debug_assert(0 < delta.days <= MAXORDINAL, "result out of range") return datetime.combine( date.fromordinal(delta.days), time(hour, minute, second, delta.microseconds, tzinfo=self.tzinfo), ) fn toordinal(self) -> Int: """Return proleptic Gregorian ordinal for the year, month and day. January 1 of year 1 is day 1. Only the year, month and day values contribute to the result. """ return ymd2ord(self.year, self.month, self.day) # mojo doesn't support __radd__ yet # __radd__ = __add__ fn __sub__(self, other: dt.timedelta) -> datetime: return self + (-other) fn __sub__(self, other: datetime) -> dt.timedelta: var days1 = self.toordinal() var days2 = other.toordinal() var secs1 = self.second + self.minute * 60 + self.hour * 3600 var secs2 = other.second + other.minute * 60 + other.hour * 3600 var base = dt.timedelta( days1 - days2, secs1 - secs2, self.microsecond - other.microsecond ) if self.tzinfo is None and other.tzinfo is None: return base var myoff = self.utcoffset() var otoff = other.utcoffset() if optional_equal_timedelta(myoff, otoff): return base if myoff is None or otoff is None: custom_debug_assert("cannot mix naive and timezone-aware time") return base + otoff.value() - myoff.value() fn __hash__(self) -> Int: var t: datetime if self.fold: t = self.replace(fold=0) else: t = self var tzoff = t.utcoffset() if tzoff is None: return custom_hash( List[Int]( t.year, t.month, t.day, t.hour, t.minute, t.second, t.microsecond ) ) else: var days = ymd2ord(self.year, self.month, self.day) var seconds = self.hour * 3600 + self.minute * 60 + self.second return hash(dt.timedelta(days, seconds, self.microsecond) - tzoff.value()) @value struct TzinfoReplacement: var _value: Variant[Optional[dt.timezone], Bool] fn __init__(inout self, value: Bool): self._value = value fn __init__(inout self, value: None): self._value = Optional[dt.timezone](value) fn __init__(inout self, value: dt.timezone): self._value = Optional[dt.timezone](value) fn get_tzinfo(self) -> Optional[dt.timezone]: return self._value.get[Optional[dt.timezone]]()[] fn is_bool(self) -> Bool: return self._value.isa[Bool]() fn optional_equal_timedelta( a: Optional[dt.timedelta], b: Optional[dt.timedelta] ) -> Bool: # remove this when Optional supports __eq__ if a is None: return b is None if b is None: return False return a.value() == b.value() --- stdlib_extensions/datetime/_iso_calendar_date.mojo --- @value struct IsoCalendarDate: var year: Int var week: Int var weekday: Int fn __getitem__(self, index: Int) -> Int: if index == 0: return self.year elif index == 1: return self.week elif index == 2: return self.weekday else: # raise error here return 0 fn __len__(self) -> Int: return 3 def __repr__(self) -> String: return ( "IsoCalendarDate(year=" + str(self[0]) + ", week=" + str(self[1]) + ", weekday=" + str(self[2]) + ")" ) --- stdlib_extensions/datetime/_time.mojo --- from ..builtins import Optional, ___eq__ from .. import datetime as dt from utils.variant import Variant from ..builtins._generic_list import _cmp_list from ..builtins import custom_hash from ..builtins import divmod, bool_to_int from ..builtins.string import rjust, removeprefix from ._utils import _check_utc_offset, _check_time_fields from .._utils import custom_debug_assert @value struct time(CollectionElement, Hashable, Stringable): """Time with time zone. Constructors: __new__() Operators: __repr__, __str__ __eq__, __le__, __lt__, __ge__, __gt__, __hash__ Methods: strftime() isoformat() utcoffset() tzname() dst() Properties (readonly): hour, minute, second, microsecond, tzinfo, fold """ var hour: Int var minute: Int var second: Int var microsecond: Int var tzinfo: Optional[timezone] var _hashcode: Int var fold: Int alias min = time(0, 0, 0) alias max = time(23, 59, 59, 999999) alias resolution = timedelta(microseconds=1) fn __init__( inout self, hour: Int = 0, minute: Int = 0, second: Int = 0, microsecond: Int = 0, tzinfo: Optional[timezone] = None, fold: Int = 0, ): """Constructor. Arguments: hour, minute (required) second, microsecond (default to zero) tzinfo (default to None) fold (keyword only, default to zero) """ _check_time_fields(hour, minute, second, microsecond, fold) self.hour = hour self.minute = minute self.second = second self.microsecond = microsecond self.tzinfo = tzinfo self._hashcode = -1 self.fold = fold # Standard conversions, __hash__ (and helpers) # Comparisons of time objects with other. fn __eq__(self, other: time) -> Bool: return self._cmp(other, allow_mixed=True) == 0 fn __ne__(self, other: time) -> Bool: return self._cmp(other, allow_mixed=True) != 0 def __le__(self, other: time) -> Bool: return self._cmp(other) <= 0 def __lt__(self, other: time) -> Bool: return self._cmp(other) < 0 def __ge__(self, other: time) -> Bool: return self._cmp(other) >= 0 def __gt__(self, other: time) -> Bool: return self._cmp(other) > 0 fn _cmp(self, other: time, allow_mixed: Bool = False) -> Int: var mytz = self.tzinfo var ottz = other.tzinfo var myoff: Optional[timedelta] = None var otoff: Optional[timedelta] = None var base_compare: Bool if mytz is None and ottz is None: base_compare = True elif mytz is not None and ottz is not None and mytz.value() == ottz.value(): base_compare = True else: myoff = self.utcoffset() otoff = other.utcoffset() base_compare = ___eq__(myoff, otoff) if base_compare: return _cmp_list( List[Int](self.hour, self.minute, self.second, self.microsecond), List[Int](other.hour, other.minute, other.second, other.microsecond), ) if myoff is None or otoff is None: if allow_mixed: return 2 # arbitrary non-zero value else: custom_debug_assert("cannot compare naive and aware times") # is there a bug here? Does that mean that we cannot have a tzinfo with sub-minute resolution? # Anyway, this was in the CPython code, so I'm keeping it for now until someone has the answer. var myhhmm = self.hour * 60 + self.minute - myoff.value() // timedelta( minutes=1 ) var othhmm = other.hour * 60 + other.minute - otoff.value() // timedelta( minutes=1 ) return _cmp_list( List[Int](myhhmm.to_int(), self.second, self.microsecond), List[Int](othhmm.to_int(), other.second, other.microsecond), ) fn __hash__(self) -> Int: """Hash.""" var t: time if self.fold: t = self.replace(fold=0) else: t = self var tzoff = t.utcoffset() if tzoff is None or tzoff.value() == timedelta(0): return custom_hash(List[Int](t.hour, t.minute, t.second, t.microsecond)) else: var utctime = timedelta( hours=self.hour, minutes=self.minute ) - tzoff.value() var h = utctime // timedelta(hours=1) var m = utctime % timedelta(hours=1) # assert not m % timedelta(minutes=1), "whole minute" var minutes_int = (m // timedelta(minutes=1)).to_int() var h_int = h.to_int() return custom_hash( List[Int](h_int, minutes_int, self.second, self.microsecond) ) # Conversion to string fn _tzstr(self, sep: String = ":") -> String: """Return formatted timezone offset (+xx:xx) or an empty string.""" return _format_optional_offset(self.utcoffset(), sep=sep) fn __repr__(self) -> String: """Convert to formal string, for repr().""" var result = "datetime.time(" + str(self.hour) + ", " + str(self.minute) if self.second != 0 or self.microsecond != 0: result += ", " + str(self.second) if self.microsecond != 0: result += ", " + str(self.microsecond) if self.tzinfo is not None: result += ", tzinfo=" + self.tzinfo.value().__repr__() if self.fold: result += ", fold=1" return result + ")" fn isoformat(self, timespec: String = "auto") -> String: """Return the time formatted according to ISO. The full format is 'HH:MM:SS.mmmmmm+zz:zz'. By default, the fractional part is omitted if self.microsecond == 0. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are 'auto', 'hours', 'minutes', 'seconds', 'milliseconds' and 'microseconds'. """ var s = _format_time( self.hour, self.minute, self.second, self.microsecond, timespec ) var tz = self._tzstr() if tz: s += tz return s fn __str__(self) -> String: return self.isoformat() @staticmethod fn fromisoformat(owned time_string: String) raises -> time: """Construct a time from a string in one of the ISO 8601 formats.""" # The spec actually requires that time-only ISO 8601 strings start with # T, but the extended format allows this to be omitted as long as there # is no ambiguity with date strings. time_string = removeprefix(time_string, "T") var r = _parse_isoformat_time(time_string) return time(r.hour, r.minute, r.second, r.microsecond, r.tzinfo) fn strftime(self, owned format: String) -> String: """ Format using strftime(). Example: "%d/%m/%Y, %H:%M:%S" """ # this letter F is unused # if there are performance issues, there might be a way to avoid the replace() # but this solution is much easier to understand and read. format = format.replace("%:z", "%F") var result: String = "" var previous_was_percent = False for i in range(len(format)): var letter = format[i] if previous_was_percent: result += self._get_from_letter(letter) previous_was_percent = False elif letter == "%": previous_was_percent = True else: result += letter return result fn _get_from_letter(self, letter: String) -> String: """See https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes """ if letter == "%": return "%" elif letter == "a": return "Mon" elif letter == "A": return "Monday" elif letter == "w": return "1" elif letter == "d": return "01" elif letter == "b": return "Jan" elif letter == "B": return "January" elif letter == "m": return "01" elif letter == "y": return "00" elif letter == "Y": return "1900" elif letter == "H": return rjust(str(self.hour), 2, "0") elif letter == "I": var modulo = self.hour % 12 if modulo == 0: return "12" else: return rjust(str(modulo), 2, "0") elif letter == "p": if self.hour < 12: return "AM" else: return "PM" elif letter == "M": return rjust(str(self.minute), 2, "0") elif letter == "S": return rjust(str(self.second), 2, "0") elif letter == "f": return rjust(str(self.microsecond), 6, "0") elif letter == "z": return self._tzstr(sep="") elif letter == "Z": if self.tzinfo is None: return "" return self.tzinfo.value().tzname(None) elif letter == "j": return "001" elif letter == "U": return "00" elif letter == "W": return "01" elif letter == "c": return self.strftime("Mon Jan 1 %H:%M:%S 1900") elif letter == "x": return "01/01/00" elif letter == "X": return self.strftime("%H:%M:%S") elif letter == "G": return "1900" elif letter == "u": return "1" elif letter == "V": return "01" elif letter == "F": return self._tzstr(sep=":") else: custom_debug_assert( False, "strftime format string contains unknown format letter" ) return "" def __format__(self, fmt: String) -> String: if len(fmt) != 0: return self.strftime(fmt) return str(self) # Timezone functions fn utcoffset(self) -> Optional[timedelta]: """Return the timezone offset as timedelta, positive east of UTC (negative west of UTC).""" if self.tzinfo is None: return None var offset = self.tzinfo.value().utcoffset(None) _check_utc_offset("utcoffset", offset) return offset fn tzname(self) -> Optional[String]: """Return the timezone name. Note that the name is 100% informational -- there's no requirement that it mean anything in particular. For example, "GMT", "UTC", "-500", "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies. """ if self.tzinfo is None: return None return self.tzinfo.value().tzname(None) fn dst(self) -> Optional[timedelta]: """Return 0 if DST is not in effect, or the DST offset (as timedelta positive eastward) if DST is in effect. This is purely informational; the DST offset has already been added to the UTC offset returned by utcoffset() if applicable, so there's no need to consult dst() unless you're interested in displaying the DST info. """ if self.tzinfo is None: return None var offset = self.tzinfo.value().dst(None) _check_utc_offset("dst", offset) return offset fn replace( self, owned hour: Optional[Int] = None, owned minute: Optional[Int] = None, owned second: Optional[Int] = None, owned microsecond: Optional[Int] = None, owned tzinfo: Variant[Optional[timezone], Bool] = Variant[ Optional[timezone], Bool ](True), owned fold: Optional[Int] = None, ) -> time: """Return a new time with new values for the specified fields.""" if hour is None: hour = self.hour if minute is None: minute = self.minute if second is None: second = self.second if microsecond is None: microsecond = self.microsecond if tzinfo.isa[Bool]() and tzinfo.get[Bool]()[] == True: tzinfo = self.tzinfo if fold is None: fold = self.fold return time( hour=hour.value(), minute=minute.value(), second=second.value(), microsecond=microsecond.value(), tzinfo=tzinfo.get[Optional[timezone]]()[], fold=fold.value(), ) fn _format_optional_offset(off: Optional[timedelta], sep: String) -> String: if off is None: return "" else: return _format_offset(off.value(), sep) fn _format_offset(owned off: timedelta, sep: String) -> String: var s: String = "" var sign: String if off.days < 0: sign = "-" off = -off else: sign = "+" var hh = off // timedelta(hours=1) var mm = off % timedelta(hours=1) var mm_int = (mm // timedelta(minutes=1)).to_int() var ss = mm % timedelta(minutes=1) s += sign + rjust(str(hh), 2, "0") + sep + rjust(str(mm_int), 2, "0") if ss or ss.microseconds: s += sep + rjust(str(ss.seconds), 2, "0") if ss.microseconds: s += "." + rjust(str(ss.microseconds), 6, "0") return s fn _format_time( hh: Int, mm: Int, ss: Int, owned us: Int, owned timespec: String = "auto" ) -> String: if timespec == "auto": # Skip trailing microseconds when us==0. timespec = "microseconds" if us else "seconds" if timespec == "hours": return format_hours(hh) elif timespec == "minutes": return format_minutes(hh, mm) elif timespec == "seconds": return format_seconds(hh, mm, ss) elif timespec == "milliseconds": return format_milliseconds(hh, mm, ss, us // 1000) elif timespec == "microseconds": return format_microseconds(hh, mm, ss, us) else: custom_debug_assert("Unknown timespec value") return "Wrong timespec value in _format_time()" fn format_hours(hours: Int) -> String: return rjust(str(hours), 2, "0") fn format_minutes(hours: Int, minutes: Int) -> String: return format_hours(hours) + ":" + rjust(str(minutes), 2, "0") fn format_seconds(hours: Int, minutes: Int, seconds: Int) -> String: return format_minutes(hours, minutes) + ":" + rjust(str(seconds), 2, "0") fn format_milliseconds( hours: Int, minutes: Int, seconds: Int, milliseconds: Int ) -> String: return ( format_seconds(hours, minutes, seconds) + "." + rjust(str(milliseconds), 3, "0") ) fn format_microseconds( hours: Int, minutes: Int, seconds: Int, microseconds: Int ) -> String: return ( format_seconds(hours, minutes, seconds) + "." + rjust(str(microseconds), 6, "0") ) # TODO: use Tuple when https://github.com/modularml/mojo/issues/1817 is fixed @value struct IsoformatTimeResult: var hour: Int var minute: Int var second: Int var microsecond: Int var tzinfo: Optional[timezone] fn _parse_isoformat_time( tstr: String, ) raises -> IsoformatTimeResult: # Format supported is HH[:MM[:SS[.fff[fff]]]][+HH:MM[:SS[.ffffff]]] var len_str = len(tstr) if len_str < 2: raise Error("Isoformat time too short") # This is equivalent to re.search('[+-Z]', tstr), but faster var tz_pos = (tstr.find("-") + 1 or tstr.find("+") + 1 or tstr.find("Z") + 1) var timestr = tstr[: tz_pos - 1] if tz_pos > 0 else tstr var time_components = _parse_hh_mm_ss_ff(timestr) var tzi: Optional[timezone] = None # TODO: simplify to -1 when https://github.com/modularml/mojo/issues/1760 is fixed if tz_pos == len_str and tstr[len(tstr) - 1] == "Z": tzi = timezone(timedelta(0)) elif tz_pos > 0: var tzstr = get_slice_checked(tstr, tz_pos) # Valid time zone strings are: # HH len: 2 # HHMM len: 4 # HH:MM len: 5 # HHMMSS len: 6 # HHMMSS.f+ len: 7+ # HH:MM:SS len: 8 # HH:MM:SS.f+ len: 10+ if len(tzstr) == 0 or len(tzstr) == 1 or len(tzstr) == 3: raise Error("Malformed time zone string") var tz_comps = _parse_hh_mm_ss_ff(tzstr) if is_all_zeros(tz_comps): tzi = timezone(timedelta(0)) else: var tzsign = -1 if tstr[tz_pos - 1] == "-" else 1 var td = timedelta( hours=tz_comps[0], minutes=tz_comps[1], seconds=tz_comps[2], microseconds=tz_comps[3], ) tzi = timezone(td * tzsign) return IsoformatTimeResult( time_components[0], time_components[1], time_components[2], time_components[3], tzi, ) # TODO: remove this when https://github.com/modularml/mojo/issues/1760 is fixed fn get_slice_checked(string: String, owned start: Int, owned end: Int) -> String: if start >= len(string): return "" return string[start:end] fn get_slice_checked(string: String, owned start: Int) -> String: if start >= len(string): return "" return string[start:] fn _parse_hh_mm_ss_ff(tstr: String) raises -> List[Int]: # Parses things of the form HH[:?MM[:?SS[{.,}fff[fff]]]] var time_comps = List[Int](0, 0, 0, 0) var pos = 0 var has_sep: Bool = False var next_char: String for comp in range(0, 3): if (len(tstr) - pos) < 2: raise Error("Incomplete time component") time_comps[comp] = atol(tstr[pos : pos + 2]) pos += 2 next_char = get_slice_checked(tstr, pos, pos + 1) if comp == 0: has_sep = next_char == ":" if not next_char or comp >= 2: break if has_sep and next_char != ":": raise Error("Invalid time separator: " + next_char) pos += bool_to_int(has_sep) if pos < len(tstr): if not (tstr[pos] == "." or tstr[pos] == ","): raise Error("Invalid microsecond component") else: pos += 1 var len_remainder = len(tstr) - pos var to_parse: Int if len_remainder >= 6: to_parse = 6 else: to_parse = len_remainder time_comps[3] = atol(tstr[pos : (pos + to_parse)]) if to_parse < 6: time_comps[3] *= List[Int](100000, 10000, 1000, 100, 10)[to_parse - 1] if len_remainder > to_parse and not all( map_input_str(_is_ascii_digit, tstr[(pos + to_parse) :]) ): raise Error("Non-digit values in unparsed fraction") return time_comps fn all(iterable: List[Bool]) -> Bool: for element in iterable: if not element[]: return False return True fn map_input_str(funct: fn (String) -> Bool, s: String) -> List[Bool]: var result = List[Bool]() for i in range(len(s)): result.append(funct(s[i])) return result fn _is_ascii_digit(c: String) -> Bool: alias my_str: String = "0123456789" for i in range(len(my_str)): if c == my_str[i]: return True return False fn is_all_zeros(input_list: List[Int]) -> Bool: for i in range(len(input_list)): if input_list[i] != 0: return False return True --- stdlib_extensions/datetime/_timedelta.mojo --- from ..builtins import divmod, modf from ..builtins.string import rjust, join from ..builtins._generic_list import _cmp_list from ..builtins import custom_hash from utils.variant import Variant from math import abs, round from .._utils import custom_debug_assert struct timedelta(CollectionElement, Stringable, Hashable): """Represent the difference between two datetime objects. Supported operators: - add, subtract timedelta - unary plus, minus, abs - compare to timedelta - multiply, divide by int In addition, datetime supports subtraction of two datetime objects returning a timedelta, and addition or subtraction of a datetime and a timedelta giving a datetime. Representation: (days, seconds, microseconds). """ # The representation of (days, seconds, microseconds) was chosen # arbitrarily; the exact rationale originally specified in the docstring # was "Because I felt like it." var days: Int var seconds: Int var microseconds: Int alias min = timedelta(-999999999) alias max = timedelta( days=999999999, hours=23, minutes=59, seconds=59, microseconds=999999 ) alias resolution = timedelta(microseconds=1) fn __init__( inout self, owned days: Float64 = 0, owned seconds: Float64 = 0, owned microseconds: Float64 = 0, owned milliseconds: Float64 = 0, owned minutes: Float64 = 0, owned hours: Float64 = 0, owned weeks: Float64 = 0, *, use_floats: Bool, ): """This is the datetime constructor which can be used to create it from floating point values. Since Mojo can't decide which constructor to take when there are unspecified arguments, we have to use the keyword arguments `use_floats=True` here to differentiate the two constructors. """ # make sure weeks is a round number: var weeks_remainder: Float64 weeks_remainder, weeks = modf(weeks) days += weeks_remainder * 7 # make sure days is a round number: var days_remainder: Float64 days_remainder, days = modf(days) hours += days_remainder * 24 # make sure hours is a round number: var hours_remainder: Float64 hours_remainder, hours = modf(hours) minutes += hours_remainder * 60 # make sure minutes is a round number: var minutes_remainder: Float64 minutes_remainder, minutes = modf(minutes) seconds += minutes_remainder * 60 # make sure seconds is a round number: var seconds_remainder: Float64 seconds_remainder, seconds = modf(seconds) milliseconds += seconds_remainder * 1000 # make sure milliseconds is a round number: var milliseconds_remainder: Float64 milliseconds_remainder, milliseconds = modf(milliseconds) microseconds += milliseconds_remainder * 1000 # make sure microseconds is a round number: microseconds = round(microseconds) self.__init__( weeks=weeks.to_int(), days=days.to_int(), hours=hours.to_int(), minutes=minutes.to_int(), seconds=seconds.to_int(), milliseconds=milliseconds.to_int(), microseconds=microseconds.to_int(), ) fn __init__( inout self, owned days: Int = 0, owned seconds: Int = 0, owned microseconds: Int = 0, milliseconds: Int = 0, minutes: Int = 0, hours: Int = 0, weeks: Int = 0, ): """Creates a datetime struct from integer values. Each of the values provided can be positive or negative. Args: days: The number of days. seconds: The number of seconds. microseconds: The number of microseconds. milliseconds: The number of milliseconds. minutes: The number of minutes. hours: The number of hours. weeks: The number of weeks. """ # We keep only days, seconds, microseconds microseconds += milliseconds * 1000 seconds += minutes * 60 + hours * 3600 days += weeks * 7 self.__init__(days, seconds, microseconds, is_normalized=False) fn __init__( inout self, owned days: Int, owned seconds: Int, owned microseconds: Int, *, is_normalized: Bool, ): """Call this with is_normalized=True if you know the values are already in the correct range. """ if not is_normalized: var extra_seconds: Int extra_seconds, microseconds = divmod(microseconds, 1000000) seconds += extra_seconds var extra_days: Int extra_days, seconds = divmod(seconds, 24 * 60 * 60) days += extra_days custom_debug_assert( 0 <= microseconds < 1000000, "microseconds should be in the range [0, 1000000[", ) custom_debug_assert( 0 <= seconds < 24 * 60 * 60, "seconds should be in the range [0, 24 * 60 * 60[", ) custom_debug_assert( -99999999 <= days <= 999999999, "days should be in the range -999999999 to 999999999", ) self.days = days self.seconds = seconds self.microseconds = microseconds # use @value when https://github.com/modularml/mojo/issues/1705 is fixed fn __copyinit__(inout self, existing: Self): self.days = existing.days self.seconds = existing.seconds self.microseconds = existing.microseconds fn __moveinit__(inout self, owned existing: Self): self.days = existing.days self.seconds = existing.seconds self.microseconds = existing.microseconds fn __repr__(self) -> String: var args = List[String]() if self.days: args.append("days=" + str(self.days)) if self.seconds: args.append("seconds=" + str(self.seconds)) if self.microseconds: args.append("microseconds=" + str(self.microseconds)) if len(args) == 0: args.append("0") return "datetime.timedelta(" + join(", ", args) + ")" fn __str__(self) -> String: var mm: Int var ss: Int var hh: Int mm, ss = divmod(self.seconds, 60) hh, mm = divmod(mm, 60) var s = str(hh) s += ":" + rjust(str(mm), 2, "0") s += ":" + rjust(str(ss), 2, "0") if self.days: var plural: String = "" if abs(self.days) != 1: plural = "s" s = str(self.days) + " day" + plural + ", " + s if self.microseconds: s = s + "." + rjust(str(self.microseconds), 6, "0") return s fn total_seconds(self) -> Int: """Total seconds in the duration.""" return ( (self.days * 86400 + self.seconds) * 10**6 + self.microseconds ) // 10**6 fn __add__(self, other: timedelta) -> timedelta: return timedelta( self.days + other.days, self.seconds + other.seconds, self.microseconds + other.microseconds, ) fn __sub__(self, other: timedelta) -> timedelta: return timedelta( self.days - other.days, self.seconds - other.seconds, self.microseconds - other.microseconds, ) fn __neg__(self) -> timedelta: return timedelta(-self.days, -self.seconds, -self.microseconds) fn __pos__(self) -> timedelta: return self def __abs__(self) -> timedelta: if self.days < 0: return -self else: return self fn __mul__(self, other: Int) -> timedelta: return timedelta( self.days * other, self.seconds * other, self.microseconds * other ) # TODO: support multiplying by a float fn _to_microseconds(self) -> Int64: # we return an Int64 because the result may overflow a 32-bit int return (self.days * (24 * 3600) + self.seconds) * 1000000 + self.microseconds fn __floordiv__(self, other: timedelta) -> Int64: return self._to_microseconds() // other._to_microseconds() fn __floordiv__(self, other: Int) -> timedelta: return timedelta(0, 0, (self._to_microseconds() // other).to_int()) fn __truediv__(self, other: timedelta) -> Float64: return ( self._to_microseconds().cast[DType.float64]() / other._to_microseconds().cast[DType.float64]() ) fn __truediv__(self, other: Int) -> timedelta: return timedelta( microseconds=( self._to_microseconds().cast[DType.float64]() / Float64(other) ).to_int() ) # TODO: divide by a float # if isinstance(other, float): # a, b = other.as_integer_ratio() # return timedelta(0, 0, _divide_and_round(b * usec, a)) fn __mod__(self, other: timedelta) -> timedelta: var r = self._to_microseconds() % other._to_microseconds() return timedelta(0, 0, r.to_int()) fn __divmod__(self, other: timedelta) -> Tuple[Int, timedelta]: var q: Int64 var r: Int64 q, r = divmod(self._to_microseconds(), other._to_microseconds()) return q.to_int(), timedelta(0, 0, r.to_int()) # Comparisons of timedelta objects with other. # functools.total_ordering would be useful here if available fn __eq__(self, other: timedelta) -> Bool: return ( self.days == other.days and self.seconds == other.seconds and self.microseconds == other.microseconds ) fn __ne__(self, other: timedelta) -> Bool: return not (self == other) fn __le__(self, other: timedelta) -> Bool: return self._cmp(other) <= 0 fn __lt__(self, other: timedelta) -> Bool: return self._cmp(other) < 0 fn __ge__(self, other: timedelta) -> Bool: return self._cmp(other) >= 0 fn __gt__(self, other: timedelta) -> Bool: return self._cmp(other) > 0 fn _cmp(self, other: timedelta) -> Int: return _cmp_list(self._getstate(), other._getstate()) fn __hash__(self) -> Int: return custom_hash(self._getstate()) fn __bool__(self) -> Bool: return self.days != 0 or self.seconds != 0 or self.microseconds != 0 @always_inline fn _getstate(self) -> List[Int]: return List[Int](self.days, self.seconds, self.microseconds) --- stdlib_extensions/datetime/_timezone.mojo --- from ..builtins import Optional from .. import datetime as dt from ..builtins.string import rjust @value struct timezone(CollectionElement, Stringable, Hashable): var _offset: timedelta var _name: Optional[String] alias _maxoffset = timedelta(hours=24, microseconds=-1) alias _minoffset = -timezone._maxoffset alias utc = timezone(timedelta(0), None) # bpo-37642: These attributes are rounded to the nearest minute for backwards # compatibility, even though the constructor will accept a wider range of # values. This may change in the future. alias min = timezone(-timedelta(hours=23, minutes=59)) alias max = timezone(timedelta(hours=23, minutes=59)) fn __init__(inout self, offset: timedelta, name: Optional[String] = None): # if not cls._minoffset <= offset <= cls._maxoffset: # raise ValueError("offset must be a timedelta " # "strictly between -timedelta(hours=24) and " # "timedelta(hours=24).") self._offset = offset self._name = name fn __eq__(self, other: timezone) -> Bool: return self._offset == other._offset fn __hash__(self) -> Int: return self._offset.__hash__() fn __repr__(self) -> String: """Convert to formal string, for repr(). >>> tz = timezone.utc >>> repr(tz) 'datetime.timezone.utc' >>> tz = timezone(timedelta(hours=-5), 'EST') >>> repr(tz) "datetime.timezone(datetime.timedelta(-1, 68400), 'EST')" """ # TODO: enable when https://github.com/modularml/mojo/issues/1787 is fixed # if self == timezone.utc: if self._offset == timedelta(0): return "datetime.timezone.utc" var result: String = "datetime.timezone(" + self._offset.__repr__() if self._name is not None: result += ", '" + self._name.value() + "'" return result + ")" fn __str__(self) -> String: return self.tzname(None) fn utcoffset(self, dt: Optional[datetime]) -> timedelta: return self._offset fn tzname(self, dt: Optional[datetime]) -> String: if self._name is None: return self._name_from_offset(self._offset) else: return self._name.value() fn dst(self, dt: Optional[datetime]) -> None: return None # fn fromutc(self, dt: datetime) -> datetime: # #if dt.tzinfo is not self: # # raise ValueError("fromutc: dt.tzinfo " # # "is not self") # return dt + self._offset @staticmethod fn _name_from_offset(owned delta: timedelta) -> String: if not delta: return "UTC" var sign: String if delta < timedelta(0): sign = "-" delta = -delta else: sign = "+" # can use divmod later when we support non-register-passable for Tuple var hours = delta // timedelta(hours=1) var rest = delta % timedelta(hours=1) var minutes = rest // timedelta(minutes=1) rest = rest % timedelta(minutes=1) var seconds = rest.seconds var microseconds = rest.microseconds var result = "UTC" + sign + rjust(str(hours), 2, "0") + ":" + rjust( str(minutes), 2, "0" ) if seconds or microseconds: result += ":" + rjust(str(seconds), 2, "0") if microseconds: result += "." + rjust(str(microseconds), 6, "0") return result alias UTC = timezone.utc --- stdlib_extensions/datetime/_tzinfo.mojo --- trait tzinfo(CollectionElement): """Abstract base class for time zone info classes. Subclasses must override the tzname(), utcoffset(), dst(), and fromutc() methods. """ fn tzname(self, dt: datetime) -> String: """Name of time zone.""" ... fn utcoffset(self, dt: datetime) -> timedelta: """Positive for east of UTC, negative for west of UTC.""" ... fn dst(self, dt: datetime) -> timedelta: """From datetime -> DST offset as timedelta, positive for east of UTC. Return 0 if DST not in effect. utcoffset() must include the DST offset. """ ... # fn fromutc(self: Self, dt: datetime) -> datetime[Self]: # # use the default function below # ... # def fromutc[T: tzinfo](self: T, dt: datetime[T]) -> datetime: # """From datetime in UTC to datetime in local time.""" # if dt.tzinfo is not self: # raise ValueError("dt.tzinfo is not self") # dtoff = dt.utcoffset() # if dtoff is None: # raise ValueError("fromutc() requires a non-None utcoffset() " # "result") # # See the long comment block at the end of this file for an # # explanation of this algorithm. # dtdst = dt.dst() # if dtdst is None: # raise ValueError("fromutc() requires a non-None dst() result") # delta = dtoff - dtdst # if delta: # dt += delta # dtdst = dt.dst() # if dtdst is None: # raise ValueError("fromutc(): dt.dst gave inconsistent " # "results; cannot convert") # return dt + dtdst --- stdlib_extensions/datetime/_utils.mojo --- """Concrete date/time and related types. See http://www.iana.org/time-zones/repository/tz-link.html for time zone and DST data sources. This file is taken from https://github.com/python/cpython/blob/main/Lib/_pydatetime.py It's just been converted to Mojo manually. """ from ..builtins import divmod from ..builtins.string import join from ..time import struct_time import math as _math import sys from ..builtins import Optional, bytes from ..builtins._generic_list import _cmp_list from ..builtins import custom_hash from ..builtins import bool_to_int from .._utils import custom_debug_assert from utils.static_tuple import StaticTuple def _cmp(x, y): return 0 if x == y else 1 if x > y else -1 alias MINYEAR = 1 alias MAXYEAR = 9999 alias MAXORDINAL = 3652059 # date.max.toordinal() # Utility functions, adapted from Python's Demo/classes/Dates.py, which # also assumes the current Gregorian calendar indefinitely extended in # both directions. Difference: Dates.py calls January 1 of year 0 day # number 1. The code here calls January 1 of year 1 day number 1. This is # to match the definition of the "proleptic Gregorian" calendar in Dershowitz # and Reingold's "Calendrical Calculations", where it's the base calendar # for all computations. See the book for algorithms for converting between # proleptic Gregorian ordinals and many other calendar systems. # -1 is a placeholder for indexing purposes. alias DAYS_IN_MONTH = StaticTuple[Int, 13]( -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ) fn _get_days_before_month() -> List[Int]: var result = List[Int]() result.append(-1) # -1 is a placeholder for indexing purposes. var dbm = 0 for i in range(1, len(DAYS_IN_MONTH)): var dim = DAYS_IN_MONTH[i] result.append(dbm) dbm += dim return result alias DAYS_BEFORE_MONTH = _get_days_before_month() fn _is_leap(year: Int) -> Bool: "year -> 1 if leap year, else 0." return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) fn _days_before_year(year: Int) -> Int: "year -> number of days before January 1st of year." var y = year - 1 return y * 365 + y // 4 - y // 100 + y // 400 fn _days_in_month(year: Int, month: Int) -> Int: "year, month -> number of days in that month in that year." # assert 1 <= month <= 12, month if month == 2 and _is_leap(year): return 29 return DAYS_IN_MONTH[month] fn _bool_to_int(x: Bool) -> Int: """Remove when Bool is Intable""" if x: return 1 else: return 0 fn _days_before_month(year: Int, month: Int) -> Int: "year, month -> number of days in year preceding first day of month." # assert 1 <= month <= 12, 'month must be in 1..12' return DAYS_BEFORE_MONTH[month] + _bool_to_int(month > 2 and _is_leap(year)) fn ymd2ord(year: Int, month: Int, day: Int) -> Int: "Year, month, day -> ordinal, considering 01-Jan-0001 as day 1." var dim = _days_in_month(year, month) return _days_before_year(year) + _days_before_month(year, month) + day alias _DI400Y = _days_before_year(401) # number of days in 400 years alias _DI100Y = _days_before_year(101) # " " " " 100 " alias _DI4Y = _days_before_year(5) # " " " " 4 " # A 4-year cycle has an extra leap day over what we'd get from pasting # together 4 single years. # assert _DI4Y == 4 * 365 + 1 # Similarly, a 400-year cycle has an extra leap day over what we'd get from # pasting together 4 100-year cycles. # assert _DI400Y == 4 * _DI100Y + 1 # OTOH, a 100-year cycle has one fewer leap day than we'd get from # pasting together 25 4-year cycles. # assert _DI100Y == 25 * _DI4Y - 1 fn ord2ymd(owned n: Int) -> Tuple[Int, Int, Int]: "Ordinal -> (year, month, day), considering 01-Jan-0001 as day 1." # n is a 1-based index, starting at 1-Jan-1. The pattern of leap years # repeats exactly every 400 years. The basic strategy is to find the # closest 400-year boundary at or before n, then work with the offset # from that boundary to n. Life is much clearer if we subtract 1 from # n first -- then the values of n at 400-year boundaries are exactly # those divisible by _DI400Y: # # D M Y n n-1 # -- --- ---- ---------- ---------------- # 31 Dec -400 -_DI400Y -_DI400Y -1 # 1 Jan -399 -_DI400Y +1 -_DI400Y 400-year boundary # ... # 30 Dec 000 -1 -2 # 31 Dec 000 0 -1 # 1 Jan 001 1 0 400-year boundary # 2 Jan 001 2 1 # 3 Jan 001 3 2 # ... # 31 Dec 400 _DI400Y _DI400Y -1 # 1 Jan 401 _DI400Y +1 _DI400Y 400-year boundary n -= 1 var n400: Int n400, n = divmod(n, _DI400Y) var year = n400 * 400 + 1 # ..., -399, 1, 401, ... # Now n is the (non-negative) offset, in days, from January 1 of year, to # the desired date. Now compute how many 100-year cycles precede n. # Note that it's possible for n100 to equal 4! In that case 4 full # 100-year cycles precede the desired day, which implies the desired # day is December 31 at the end of a 400-year cycle. var n100: Int n100, n = divmod(n, _DI100Y) # Now compute how many 4-year cycles precede it. var n4: Int n4, n = divmod(n, _DI4Y) # And now how many single years. Again n1 can be 4, and again meaning # that the desired day is December 31 at the end of the 4-year cycle. var n1: Int n1, n = divmod(n, 365) year += n100 * 100 + n4 * 4 + n1 if n1 == 4 or n100 == 4: # assert n == 0 return year - 1, 12, 31 # Now the year is correct, and n is the offset from January 1. We find # the month via an estimate that's either exact or one too large. var leapyear = n1 == 3 and (n4 != 24 or n100 == 3) # assert leapyear == _is_leap(year) var month = (n + 50) >> 5 var preceding = DAYS_BEFORE_MONTH[month] + _bool_to_int(month > 2 and leapyear) if preceding > n: # estimate is too large month -= 1 preceding -= DAYS_IN_MONTH[month] + _bool_to_int(month == 2 and leapyear) n -= preceding # assert 0 <= n < _days_in_month(year, month) # Now the year and month are correct, and n is the offset from the # start of that month: we're done! return year, month, n + 1 # Month and day names. For localized versions, see the calendar module. alias MONTHS_SHORT_NAMES = StaticTuple[StringLiteral, 13]( "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ) alias MONTHS_NAMES = StaticTuple[StringLiteral, 13]( "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ) alias DAYS_SHORT_NAMES = StaticTuple[StringLiteral, 8]( "", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", ) alias DAYS_NAMES = StaticTuple[StringLiteral, 8]( "", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", ) fn _build_struct_time( y: Int, m: Int, d: Int, hh: Int, mm: Int, ss: Int, dstflag: Int ) -> struct_time: var wday = (ymd2ord(y, m, d) + 6) % 7 var dnum = _days_before_month(y, m) + d return struct_time((y, m, d, hh, mm, ss, wday, dnum, dstflag)) ## Correctly substitute for %z and %Z escapes in strftime formats. # def _wrap_strftime(object, format, timetuple): # # Don't call utcoffset() or tzname() unless actually needed. # freplace = None # the string to use for %f # zreplace = None # the string to use for %z # colonzreplace = None # the string to use for %:z # Zreplace = None # the string to use for %Z # # # Scan format for %z, %:z and %Z escapes, replacing as needed. # newformat = [] # i, n = 0, len(format) # while i < n: # ch = format[i] # i += 1 # if ch == '%': # if i < n: # ch = format[i] # i += 1 # if ch == 'f': # if freplace is None: # freplace = '%06d' % getattr(object, # 'microsecond', 0) # newformat.append(freplace) # elif ch == 'z': # if zreplace is None: # if hasattr(object, "utcoffset"): # zreplace = _format_offset(object.utcoffset(), sep="") # else: # zreplace = "" # assert '%' not in zreplace # newformat.append(zreplace) # elif ch == ':': # if i < n: # ch2 = format[i] # i += 1 # if ch2 == 'z': # if colonzreplace is None: # if hasattr(object, "utcoffset"): # colonzreplace = _format_offset(object.utcoffset(), sep=":") # else: # colonzreplace = "" # assert '%' not in colonzreplace # newformat.append(colonzreplace) # else: # newformat.append('%') # newformat.append(ch) # newformat.append(ch2) # elif ch == 'Z': # if Zreplace is None: # Zreplace = "" # if hasattr(object, "tzname"): # s = object.tzname() # if s is not None: # # strftime is going to have at this: escape % # Zreplace = s.replace('%', '%%') # newformat.append(Zreplace) # else: # newformat.append('%') # newformat.append(ch) # else: # newformat.append('%') # else: # newformat.append(ch) # newformat = "".join(newformat) # return _time.strftime(newformat, timetuple) # fn _is_ascii_digit(c: String) -> Bool: alias my_str: String = "0123456789" for i in range(len(my_str)): if c == my_str[i]: return True return False # # def _find_isoformat_datetime_separator(dtstr): # # See the comment in _datetimemodule.c:_find_isoformat_datetime_separator # len_dtstr = len(dtstr) # if len_dtstr == 7: # return 7 # # assert len_dtstr > 7 # date_separator = "-" # week_indicator = "W" # # if dtstr[4] == date_separator: # if dtstr[5] == week_indicator: # if len_dtstr < 8: # raise ValueError("Invalid ISO string") # if len_dtstr > 8 and dtstr[8] == date_separator: # if len_dtstr == 9: # raise ValueError("Invalid ISO string") # if len_dtstr > 10 and _is_ascii_digit(dtstr[10]): # # This is as far as we need to resolve the ambiguity for # # the moment - if we have YYYY-Www-##, the separator is # # either a hyphen at 8 or a number at 10. # # # # We'll assume it's a hyphen at 8 because it's way more # # likely that someone will use a hyphen as a separator than # # a number, but at this point it's really best effort # # because this is an extension of the spec anyway. # # TODO(pganssle): Document this # return 8 # return 10 # else: # # YYYY-Www (8) # return 8 # else: # # YYYY-MM-DD (10) # return 10 # else: # if dtstr[4] == week_indicator: # # YYYYWww (7) or YYYYWwwd (8) # idx = 7 # while idx < len_dtstr: # if not _is_ascii_digit(dtstr[idx]): # break # idx += 1 # # if idx < 9: # return idx # # if idx % 2 == 0: # # If the index of the last number is even, it's YYYYWwwd # return 7 # else: # return 8 # else: # # YYYYMMDD (8) # return 8 # # fn _parse_isoformat_date(dtstr: String) raises -> Tuple[Int, Int, Int]: # It is assumed that this is an ASCII-only string of lengths 7, 8 or 10, # see the comment on Modules/_datetimemodule.c:_find_isoformat_datetime_separator # assert len(dtstr) in (7, 8, 10) var year = atol(dtstr[0:4]) var has_sep = dtstr[4] == "-" var pos = 4 + bool_to_int(has_sep) if dtstr[pos : pos + 1] == "W": # YYYY-?Www-?D? pos += 1 var weekno = atol(dtstr[pos : pos + 2]) pos += 2 var dayno = 1 if len(dtstr) > pos: if (dtstr[pos : pos + 1] == "-") != has_sep: raise Error("Inconsistent use of dash separator") pos += bool_to_int(has_sep) dayno = atol(dtstr[pos : pos + 1]) return _isoweek_to_gregorian(year, weekno, dayno) else: var month = atol(dtstr[pos : pos + 2]) pos += 2 if (dtstr[pos : pos + 1] == "-") != has_sep: raise Error("Inconsistent use of dash separator") pos += bool_to_int(has_sep) var day = atol(dtstr[pos : pos + 2]) return year, month, day # tuple[int, int, int] -> tuple[int, int, int] version of date.fromisocalendar fn _isoweek_to_gregorian(year: Int, week: Int, day: Int) -> Tuple[Int, Int, Int]: # Year is bounded this way because 9999-12-31 is (9999, 52, 5) # if not MINYEAR <= year <= MAXYEAR: # raise ValueError(f"Year is out of range: {year}") if not 0 < week < 53: var out_of_range = True if week == 53: # ISO years have 53 weeks in them on years starting with a # Thursday and leap years starting on a Wednesday var first_weekday = ymd2ord(year, 1, 1) % 7 if first_weekday == 4 or (first_weekday == 3 and _is_leap(year)): out_of_range = False # if out_of_range: # raise ValueError(f"Invalid week: {week}") # if not 0 < day < 8: # raise ValueError(f"Invalid weekday: {day} (range is [1, 7])") # Now compute the offset from (Y, 1, 1) in days: var day_offset = (week - 1) * 7 + (day - 1) # Calculate the ordinal day for monday, week 1 var day_1 = isoweek1monday(year) var ord_day = day_1 + day_offset return ord2ymd(ord_day) ## name is the offset-producing method, "utcoffset" or "dst". ## offset is what it returned. ## If offset isn't None or timedelta, raises TypeError. ## If offset is None, returns None. ## Else offset is checked for being in range. ## If it is, its integer value is returned. Else ValueError is raised. fn _check_utc_offset(name: String, offset: Optional[timedelta]): custom_debug_assert( name == "utcoffset" or name == "dst", "name must be 'utcoffset' or 'dst'" ) if offset is None: return custom_debug_assert( -timedelta(1) < offset.value() < timedelta(1), name + "()=" + offset.value() + ", must be strictly between -timedelta(hours=24) and timedelta(hours=24)", ) fn _check_date_fields(year: Int, month: Int, day: Int): # TODO: remove this and use the alias when we don't get "no expansion found" errors custom_debug_assert( MINYEAR <= year <= MAXYEAR, "year must be in the range 1 to 9999" ) custom_debug_assert(1 <= month <= 12, "month must be in 1..12") var dim = _days_in_month(year, month) custom_debug_assert(1 <= day <= dim, "day must be in 1.." + str(dim)) fn _check_time_fields(hour: Int, minute: Int, second: Int, microsecond: Int, fold: Int): custom_debug_assert(0 <= hour <= 23, "hour must be in 0..23") custom_debug_assert(0 <= minute <= 59, "minute must be in 0..59") custom_debug_assert(0 <= second <= 59, "second must be in 0..59") custom_debug_assert(0 <= microsecond <= 999999, "microsecond must be in 0..999999") custom_debug_assert(0 <= fold <= 1, "fold must be in 0 or 1") # def _divide_and_round(a, b): # """divide a by b and round result to the nearest integer # # When the ratio is exactly half-way between two integers, # the even integer is returned. # """ # # Based on the reference implementation for divmod_near # # in Objects/longobject.c. # q, r = divmod(a, b) # # round up if either r / b > 0.5, or r / b == 0.5 and q is odd. # # The expression r / b > 0.5 is equivalent to 2 * r > b if b is # # positive, 2 * r < b if b negative. # r *= 2 # greater_than_half = r > b if b > 0 else r < b # if greater_than_half or r == b and q % 2 == 1: # q += 1 # # return q # # # # # # # # fn isoweek1monday(year: Int) -> Int: # Helper to calculate the day number of the Monday starting week 1 # XXX This could be done more efficiently var THURSDAY = 3 var firstday = ymd2ord(year, 1, 1) var firstweekday = (firstday + 6) % 7 # See weekday() above var week1monday = firstday - firstweekday if firstweekday > THURSDAY: week1monday += 7 return week1monday --- stdlib_extensions/os/__init__.mojo --- from ..syscalls import process, filesystem from ..syscalls import random as syscalls_random from pathlib import Path from ..builtins import bytes fn getpid() -> Int: return process.getpid().to_int() fn fspath(path: String) -> String: return path fn fspath(path: StringLiteral) -> String: return String(path) fn fspath(path: Path) -> String: # should actually return __fspath__ but we don't have that yet return path.__str__() fn rmdir(path: String): return filesystem.rmdir(path) fn rmdir(path: StringLiteral): return rmdir(fspath(path)) fn rmdir(path: Path): return rmdir(fspath(path)) fn unlink(path: String): return filesystem.unlink(path) fn unlink(path: StringLiteral): return unlink(fspath(path)) fn unlink(path: Path): return unlink(fspath(path)) fn urandom(size: Int) -> bytes: # TODO: we currently use the getrandom syscalls, but it will work only in linux. # to be compatible with other systems, we should follow what cpython does, which is by order # of priority: # BCryptGenRandom() on Windows # getrandom() function (ex: Linux and Solaris) # getentropy() function (ex: OpenBSD) # /dev/urandom device return syscalls_random.getrandom(size) --- stdlib_extensions/pathlib/__init__.mojo --- from ._path import Path --- stdlib_extensions/pathlib/_path.mojo --- from pathlib import Path as MojoStdPath from pathlib import cwd from ..os import unlink, rmdir from ..builtins.string import endswith @value struct Path: var _mojo_std_path: MojoStdPath # here it's just a copy of what's in the stdlib since # we can't inherit :( fn __init__(inout self: Self) raises -> None: self._mojo_std_path = MojoStdPath() fn __init__(inout self: Self, path: StringLiteral): self._mojo_std_path = MojoStdPath(path) fn __init__(inout self: Self, path: MojoStdPath): self._mojo_std_path = path fn __init__(inout self: Self, path: String): self._mojo_std_path = MojoStdPath(path) fn __init__(inout self: Self, path: StringRef): self._mojo_std_path = MojoStdPath(path) fn __truediv__(self: Self, suffix: Path) -> Self: return self / suffix.__fspath__() fn __truediv__(self: Self, suffix: StringLiteral) -> Self: return self.__truediv__(String(suffix)) fn __truediv__(self: Self, suffix: StringRef) -> Self: return self.__truediv__(String(suffix)) fn __truediv__(self: Self, suffix: String) -> Self: var ends_with_slash: Bool ends_with_slash = endswith(self.__fspath__(), "/") if ends_with_slash: return Path(self.__fspath__() + suffix) else: return Path(self.__fspath__() + "/" + suffix) fn __fspath__(self) -> String: return self._mojo_std_path.__str__() fn __str__(self: Self) -> String: return self.__fspath__() fn __repr__(self: Self) -> String: return self.__fspath__() @staticmethod fn cwd() raises -> Self: return Path(cwd()) # now functions that don't have a direct equivalent in the stdlib fn open(self: Self, mode: StringLiteral) raises -> FileHandle: return open(self.__str__(), mode) # TODO: fuse those when we have unions fn write_text(self: Self, text: StringLiteral) raises -> None: with self.open("w") as f: f.write(text) fn write_text(self: Self, text: StringRef) raises -> None: with self.open("w") as f: f.write(text) fn write_text(self: Self, text: String) raises -> None: with self.open("w") as f: f.write(text) fn read_text(self: Self) raises -> String: with self.open("r") as f: return f.read() fn unlink(self: Self) -> None: return unlink(self.__str__()) fn rmdir(self: Self) -> None: return rmdir(self.__str__()) --- stdlib_extensions/stdlib_tests/__init__.mojo --- --- stdlib_extensions/stdlib_tests/builtins/__init__.mojo --- --- stdlib_extensions/stdlib_tests/builtins/test_bytes.mojo --- from ...builtins import bytes, to_bytes from ..utils import assert_equal def test_bytes_operations_indexing_and_add(): some_bytes = bytes(10) assert_equal(len(some_bytes), 10) for i in range(10): some_bytes[i] = i assert_equal(some_bytes[5], 5) new_vector = List[UInt8](100, 101, 102) new_bytes = bytes(new_vector) assert_equal(new_bytes[2], 102) combinaison = some_bytes + new_bytes assert_equal(combinaison[12], 102) assert_equal(len(combinaison), 13) assert_equal(len(some_bytes), 10) some_bytes += new_bytes assert_equal(some_bytes[12], 102) assert_equal(len(some_bytes), 13) def test_bytes_operations_multiplying(): some_bytes = bytes(10) assert_equal(len(some_bytes), 10) for i in range(10): some_bytes[i] = i new_bytes = some_bytes * 3 assert_equal(len(new_bytes), 30) assert_equal(new_bytes[12], 2) assert_equal(len(some_bytes), 10) # unchanged new_bytes = some_bytes * 0 assert_equal(len(new_bytes), 0) some_bytes *= 4 assert_equal(len(some_bytes), 40) assert_equal(some_bytes[34], 4) some_bytes *= 0 assert_equal(len(some_bytes), 0) def test_bytes_hex(): some_bytes = bytes.fromhex("00") assert_equal(len(some_bytes), 1) assert_equal(some_bytes[0], 0) some_bytes = bytes.fromhex("01") assert_equal(len(some_bytes), 1) assert_equal(some_bytes[0], 1) some_bytes = bytes.fromhex("0A") assert_equal(len(some_bytes), 1) assert_equal(some_bytes[0], 10) some_bytes = bytes.fromhex("0F") assert_equal(len(some_bytes), 1) assert_equal(some_bytes[0], 15) some_bytes = bytes.fromhex("10") assert_equal(len(some_bytes), 1) assert_equal(some_bytes[0], 16) some_bytes = bytes.fromhex("FF") assert_equal(len(some_bytes), 1) assert_equal(some_bytes[0], 255) some_bytes = bytes.fromhex("0000") assert_equal(len(some_bytes), 2) assert_equal(some_bytes[0], 0) assert_equal(some_bytes[1], 0) some_bytes = bytes.fromhex("1010") assert_equal(len(some_bytes), 2) assert_equal(some_bytes[0], 16) assert_equal(some_bytes[1], 16) some_bytes = bytes.fromhex("FFFF") assert_equal(len(some_bytes), 2) assert_equal(some_bytes[0], 255) assert_equal(some_bytes[1], 255) def test_convert_to_hex(): assert_equal(bytes(0).hex(), "") assert_equal(bytes(1).hex(), "00") assert_equal(bytes(2).hex(), "0000") assert_equal(bytes(3).hex(), "000000") assert_equal(bytes.fromhex("ab").hex(), "ab") assert_equal(bytes.fromhex("abcd").hex(), "abcd") assert_equal(bytes.fromhex("abcdef").hex(), "abcdef") assert_equal(bytes.fromhex("abcdef12").hex(), "abcdef12") assert_equal(bytes.fromhex("abcdef1234").hex(), "abcdef1234") def test_to_bytes(): # TODO fix bug here a = bytes.fromhex("03") assert_equal(bytes.fromhex("03"), to_bytes(3)) assert_equal(bytes.fromhex("0003"), to_bytes(3, length=2)) assert_equal(bytes.fromhex("0300"), to_bytes(3, length=2, byteorder="little")) assert_equal(bytes.fromhex("03e8"), to_bytes(1000, length=2, byteorder="big")) assert_equal(bytes.fromhex("e803"), to_bytes(1000, length=2, byteorder="little")) assert_equal(bytes.fromhex("e80300"), to_bytes(1000, length=3, byteorder="little")) assert_equal(bytes.fromhex("00"), to_bytes(0)) def run_tests(): test_bytes_operations_indexing_and_add() test_bytes_operations_multiplying() test_bytes_hex() test_convert_to_hex() test_to_bytes() --- stdlib_extensions/stdlib_tests/builtins/test_hex.mojo --- from ...builtins import hex from ..utils import assert_equal def test_convert_uint8_to_hex(): assert_equal(hex(0), "0x00") assert_equal(hex(1), "0x01") assert_equal(hex(15), "0x0f") assert_equal(hex(16), "0x10") assert_equal(hex(255), "0xff") assert_equal(hex(200), "0xc8") assert_equal(hex(0x34), "0x34") def run_tests(): test_convert_uint8_to_hex() --- stdlib_extensions/stdlib_tests/builtins/test_math.mojo --- from ...stdlib_tests.utils import assert_true, assert_false, assert_equal from ...builtins import divmod def test_divmod(): var a: Int var b: Int a, b = divmod(10, 4) assert_equal(a, 2) assert_equal(b, 2) a, b = divmod(-11, -2) assert_equal(a, 5) assert_equal(b, -1) def run_tests(): test_divmod() --- stdlib_extensions/stdlib_tests/builtins/test_string.mojo --- from ...stdlib_tests.utils import assert_true, assert_false, assert_equal from ...builtins.string import ( endswith, rjust, ljust, split, replace, removeprefix, expandtabs, removesuffix, startswith, join, rstrip, lstrip, strip, _ALL_WHITESPACES, ) from ...builtins import list_to_str def test_ljust(): assert_equal(ljust("hello", 10), "hello ") assert_equal(ljust("hello", 10, "x"), "helloxxxxx") assert_equal(ljust("hello", 5), "hello") assert_equal(ljust("hello", 3), "hello") assert_equal(ljust("hello", 3, "x"), "hello") def test_rjust(): assert_equal(rjust("hello", 10), " hello") assert_equal(rjust("hello", 10, "x"), "xxxxxhello") assert_equal(rjust("hello", 5), "hello") assert_equal(rjust("hello", 3), "hello") assert_equal(rjust("hello", 3, "x"), "hello") def test_endswith(): assert_true(endswith("hello world", "world"), "endswith 1 failed") assert_true(endswith("hello world", "world", start=2), "endswith 2 failed") assert_true(endswith("hello world", "world", start=6), "endswith 3 failed") assert_true(endswith(" worldd", "world", start=0, end=6), "endswith 4 failed") assert_true(endswith(" worldd", "world", start=0, end=6), "endswith 5 failed") assert_false(endswith(" worldd", "world", start=0, end=7), "endswith 6 failed") assert_false(endswith(" worldd", "hello"), "endswith 7 failed") assert_false(endswith(" worldd", "world"), "endswith 8 failed") def test_startswith(): assert_true(startswith("hello world", "hello"), "startswith 1 failed") assert_true(startswith("hello world", "hello", start=0), "startswith 2 failed") assert_true( startswith("hello world", "hello", start=0, end=5), "startswith 3 failed" ) assert_true( startswith("hello world", "hello", start=0, end=6), "startswith 4 failed" ) assert_true( startswith("hello world", "hello", start=0, end=7), "startswith 5 failed" ) assert_true( startswith("hello world", "hello", start=0, end=8), "startswith 6 failed" ) assert_false(startswith("hello world", "world"), "startswith 7 failed") assert_false(startswith("hello world", "hello", start=1), "startswith 8 failed") assert_false( startswith("hello world", "hello", start=1, end=5), "startswith 9 failed" ) assert_false( startswith("hello world", "hello", start=1, end=6), "startswith 10 failed" ) assert_false( startswith("hello world", "hello", start=1, end=7), "startswith 11 failed" ) assert_false( startswith("hello world", "hello", start=1, end=8), "startswith 12 failed" ) def test_split(): assert_equal(list_to_str(split("hello world")), "['hello', 'world']") assert_equal(list_to_str(split("Hello world")), "['Hello', 'world']") assert_equal(list_to_str(split("Hello world", maxsplit=1)), "['Hello', 'world']") assert_equal( list_to_str(split("apple::banana::orange", sep="::")), "['apple', 'banana', 'orange']", ) assert_equal( list_to_str(split("apple::banana::orange", sep="::", maxsplit=1)), "['apple', 'banana::orange']", ) assert_equal( list_to_str(split("a--b--c--d", sep="--", maxsplit=2)), "['a', 'b', 'c--d']" ) def test_join_simple(): input_list = List[String]() input_list.append("hello") input_list.append("Mojo 🔥") input_list.append("world") assert_equal(join(" ", input_list), "hello Mojo 🔥 world") assert_equal(join(", ", input_list), "hello, Mojo 🔥, world") assert_equal(join("::", input_list), "hello::Mojo 🔥::world") assert_equal(join("", input_list), "helloMojo 🔥world") def test_join_edge_case(): input_list = List[String]() assert_equal(join(" ", input_list), "") assert_equal(join(", ", input_list), "") assert_equal(join("::", input_list), "") assert_equal(join("", input_list), "") def test_replace(): assert_equal(replace("hello world", "world", "there"), "hello there") assert_equal(replace("hello world", "world", "there", 1), "hello there") assert_equal(replace("hello world", "world", "there", 2), "hello there") assert_equal(replace("hello world world", "world", "there", 1), "hello there world") assert_equal(replace("hello world world", "world", "there", 2), "hello there there") assert_equal( replace("hello 0 world world", "world", "there", 0), "hello 0 world world" ) assert_equal( replace("hello -1 world world", "world", "there", -1), "hello -1 there there" ) assert_equal( replace("hello None world world", "world", "there"), "hello None there there" ) def test_removeprefix(): assert_equal(removeprefix("hello world", "hello"), " world") assert_equal(removeprefix("hello world", "world"), "hello world") assert_equal(removeprefix("hello world", "hello world"), "") assert_equal(removeprefix("hello world", "llo wor"), "hello world") def test_removesuffix(): assert_equal(removesuffix("hello world", "world"), "hello ") assert_equal(removesuffix("hello world", "hello"), "hello world") assert_equal(removesuffix("hello world", "hello world"), "") assert_equal(removesuffix("hello world", "llo wor"), "hello world") def test_expandtabs(): assert_equal(expandtabs("hello\tworld", 8), "hello world") assert_equal(expandtabs("hello\tworld", 4), "hello world") assert_equal(expandtabs("hello\tworld", 2), "hello world") assert_equal(expandtabs("helloworld", 2), "helloworld") assert_equal(expandtabs("hello\tworld", 0), "helloworld") def test_rstrip(): assert_equal(rstrip(" hello world "), " hello world") assert_equal(rstrip(" hello world ", " "), " hello world") assert_equal(rstrip(" hello world ", "d "), " hello worl") assert_equal(rstrip(" hello world ", "d"), " hello world ") assert_equal(rstrip(" hello world ", " d"), " hello worl") # order doesn't matter assert_equal( rstrip(" \t\n\r\x0b\f hello world \t\n\r\x0b\f"), " \t\n\r\x0b\f hello world" ) def test_lstrip(): assert_equal(lstrip(" hello world "), "hello world ") assert_equal(lstrip(" hello world ", " "), "hello world ") assert_equal(lstrip(" hello world ", "d "), "hello world ") assert_equal(lstrip(" hello world ", "h"), " hello world ") assert_equal(lstrip(" hello world ", "h "), "ello world ") # order doesn't matter assert_equal(lstrip(" hello world ", " h"), "ello world ") assert_equal(lstrip("\thello world \t"), "hello world \t") assert_equal( lstrip(" \t\n\r\x0b\fhello world \t\n\r\x0b\f"), "hello world \t\n\r\x0b\f" ) def test_strip(): assert_equal(strip(" hello world "), "hello world") assert_equal(strip(" hello world ", " "), "hello world") assert_equal(strip(" hello world ", "d "), "hello worl") assert_equal(strip(" hello world ", "d"), " hello world ") assert_equal(strip(" hello world ", " d"), "hello worl") # order doesn't matter assert_equal(strip(" \t\n\r\x0b\f hello world \t\n\r\x0b\f"), "hello world") def run_tests(): test_ljust() test_rjust() test_endswith() test_startswith() test_split() test_join_simple() test_join_edge_case() test_replace() test_removeprefix() test_removesuffix() test_expandtabs() test_rstrip() test_lstrip() test_strip() --- stdlib_extensions/stdlib_tests/datetime/__init__.mojo --- --- stdlib_extensions/stdlib_tests/datetime/test_date.mojo --- from ...datetime import date from ...stdlib_tests.utils import assert_true, assert_false, assert_equal from python import Python def test_date(): var simple_date = date(2020, 1, 1) assert_equal(simple_date.year, 2020) assert_equal(simple_date.month, 1) assert_equal(simple_date.day, 1) assert_equal(simple_date.__str__(), "2020-01-01") assert_equal(simple_date.__repr__(), "datetime.date(2020, 1, 1)") assert_equal( simple_date.__str__(), str(Python.import_module("datetime").date(2020, 1, 1)), ) # we'd be extremely unlucky if this fails assert_equal( date.today().__str__(), str(Python.import_module("datetime").date.today()) ) assert_equal(date.min.__repr__(), "datetime.date(1, 1, 1)") assert_equal(date.max.__repr__(), "datetime.date(9999, 12, 31)") def test_date_hash(): var some_time = date(2020, 1, 1) var some_time2 = date(2020, 1, 1) var some_other_time = date(2020, 1, 2) assert_equal(hash(some_time), hash(some_time2)) assert_true(hash(some_time) != hash(some_other_time), "incorrect hash") assert_true(hash(some_time2) != hash(some_other_time), "incorrect hash 2") def test_date_strftime(): assert_equal(date(2020, 1, 1).strftime("%Y-%m-%d"), "2020-01-01") assert_equal(date(2020, 1, 1).strftime("%Y-%m-%d %H:%M:%S"), "2020-01-01 00:00:00") def test_full_date_strftime(): # all codes # TODO: Add U, W, G, V and :z var format: String = "%a|%A|%w|%d|%b|%B|%m|%y|%Y|%H|%I|%p|%M|%S|%f|%z|%Z|%j|%c|%x|%X|%%|%u|%:z" var expected: String = "Tue|Tuesday|2|02|Mar|March|03|21|2021|00|12|AM|00|00|000000|||061|Tue Mar 2 00:00:00 2021|03/02/21|00:00:00|%|2|" assert_equal(date(2021, 3, 2).strftime(format), expected) def test_ctime(): assert_equal(date(2021, 3, 2).ctime(), "Tue Mar 2 00:00:00 2021") assert_equal(date(1821, 1, 10).ctime(), "Wed Jan 10 00:00:00 1821") def test_fromisoformat(): """Examples taken from the python documentation.""" assert_equal(date.fromisoformat("2019-12-04"), date(2019, 12, 4)) assert_equal(date.fromisoformat("20191204"), date(2019, 12, 4)) assert_equal(date.fromisoformat("2021-W01-1"), date(2021, 1, 4)) def run_tests(): test_date() test_date_hash() test_date_strftime() test_full_date_strftime() test_ctime() test_fromisoformat() --- stdlib_extensions/stdlib_tests/datetime/test_datetime.mojo --- from ...datetime import datetime, timezone, timedelta from ...stdlib_tests.utils import assert_true, assert_false, assert_equal from python import Python def test_aliases(): assert_equal(datetime.min.year, 1) assert_equal(datetime.max.year, 9999) # TODO: test resolution when it's possible, currently it's broken because of # https://github.com/modularml/mojo/issues/1787 def test_constructor_default(): a = datetime(2020, 3, 4) assert_equal(a.year, 2020) assert_equal(a.month, 3) assert_equal(a.day, 4) assert_equal(a.hour, 0) assert_equal(a.minute, 0) assert_equal(a.second, 0) assert_equal(a.microsecond, 0) assert_true(a.tzinfo is None, "tzinfo should be None") assert_equal(a.fold, 0) def test_constructor_all_values(): a = datetime(2020, 3, 4, 5, 6, 7, 8, tzinfo=timezone(timedelta(hours=-1)), fold=1) assert_equal(a.year, 2020) assert_equal(a.month, 3) assert_equal(a.day, 4) assert_equal(a.hour, 5) assert_equal(a.minute, 6) assert_equal(a.second, 7) assert_equal(a.microsecond, 8) assert_true(a.tzinfo is not None, "tzinfo should not be None") assert_equal(a.tzinfo.value(), timezone(timedelta(hours=-1))) assert_equal(a.fold, 1) def test_datetime_get_timetuple(): a = datetime(2020, 3, 4, 5, 6, 7, 8, tzinfo=timezone(timedelta(hours=-1)), fold=1) timestruct = a.timetuple() assert_equal(timestruct.tm_year, 2020) assert_equal(timestruct.tm_mon, 3) assert_equal(timestruct.tm_mday, 4) assert_equal(timestruct.tm_hour, 5) assert_equal(timestruct.tm_min, 6) assert_equal(timestruct.tm_sec, 7) assert_equal(timestruct.tm_wday, 2) assert_equal(timestruct.tm_yday, 64) assert_equal(timestruct.tm_isdst, -1) def test_datetime_replace(): a = datetime(2020, 3, 4, 5, 6, 7, 8, tzinfo=timezone(timedelta(hours=-1)), fold=1) a = a.replace(year=2021) assert_equal(a.year, 2021) assert_equal(a.month, 3) assert_equal(a.day, 4) a = a.replace(month=9) assert_equal(a.year, 2021) assert_equal(a.month, 9) a = a.replace(day=15) assert_equal(a.year, 2021) assert_equal(a.month, 9) assert_equal(a.day, 15) a = a.replace(hour=20) assert_equal(a.year, 2021) assert_equal(a.month, 9) assert_equal(a.day, 15) assert_equal(a.hour, 20) assert_equal(a.minute, 6) a = a.replace(minute=30) assert_equal(a.minute, 30) a = a.replace(second=1) assert_equal(a.second, 1) a = a.replace(microsecond=2) assert_equal(a.microsecond, 2) a = a.replace(tzinfo=None) assert_true(a.tzinfo is None, "tzinfo should be None") a = a.replace(tzinfo=timezone(timedelta(hours=-1))) assert_true(a.tzinfo is not None, "tzinfo should not be None") assert_equal(a.tzinfo.value(), timezone(timedelta(hours=-1))) a = a.replace(fold=0) assert_equal(a.fold, 0) def test_datetime_repr(): a = datetime(2020, 3, 4, 5, 6, 7, 8, tzinfo=timezone(timedelta(hours=-1)), fold=1) assert_equal( a.__repr__(), ( "datetime.datetime(2020, 3, 4, 5, 6, 7, 8," " tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=82800))," " fold=1)" ), ) a = datetime(2020, 3, 4) assert_equal(a.__repr__(), "datetime.datetime(2020, 3, 4, 0, 0)") def test_datetime_add(): # This could be refactored using str(datetime) a = datetime(2020, 3, 4, 5, 6, 7, 8, tzinfo=timezone(timedelta(hours=-1)), fold=1) b = timedelta(days=1) c = a + b assert_equal(c.year, 2020) assert_equal(c.month, 3) assert_equal(c.day, 5) assert_equal(c.hour, 5) assert_equal(c.minute, 6) assert_equal(c.second, 7) assert_equal(c.microsecond, 8) assert_equal(c.tzinfo.value(), timezone(timedelta(hours=-1))) assert_equal(c.fold, 0) a = datetime(2021, 2, 3) b = timedelta(days=365) c = a + b assert_equal(c.year, 2022) assert_equal(c.month, 2) assert_equal(c.day, 3) a = datetime(2020, 3, 4, 5, 6, 7, 8) b = timedelta(days=1, minutes=120, seconds=3602) c = a + b assert_equal(c.year, 2020) assert_equal(c.month, 3) assert_equal(c.day, 5) assert_equal(c.hour, 8) assert_equal(c.minute, 6) assert_equal(c.second, 9) assert_equal(c.microsecond, 8) assert_true(c.tzinfo is None, "tzinfo is None") def test_datetime_sub(): # This could be refactored using str(datetime) a = datetime(2020, 3, 4, 5, 6, 7, 8, tzinfo=timezone(timedelta(hours=-1)), fold=1) b = timedelta(days=1) c = a - b assert_equal(c.year, 2020) assert_equal(c.month, 3) assert_equal(c.day, 3) assert_equal(c.hour, 5) assert_equal(c.minute, 6) assert_equal(c.second, 7) assert_equal(c.microsecond, 8) assert_equal(c.tzinfo.value(), timezone(timedelta(hours=-1))) assert_equal(c.fold, 0) a = datetime(2021, 2, 3) b = timedelta(days=365) c = a - b assert_equal(c.year, 2020) assert_equal(c.month, 2) assert_equal(c.day, 4) a = datetime(2020, 3, 4, 5, 6, 7, 8) b = timedelta(days=1, minutes=120, seconds=3602) c = a - b assert_equal(c.year, 2020) assert_equal(c.month, 3) assert_equal(c.day, 3) assert_equal(c.hour, 2) assert_equal(c.minute, 6) assert_equal(c.second, 5) assert_equal(c.microsecond, 8) assert_true(c.tzinfo is None, "tzinfo is None") def test_datetime_now(): var python_datetime_module = Python.import_module("datetime") var now1 = python_datetime_module.datetime.now() var now2 = datetime.now() var now3 = python_datetime_module.datetime.now() var now2_as_py = now2.to_python() assert_true( str(now1 <= now2_as_py) == "True", "datetimes should be in order, 1 <= 2" ) assert_true( str(now2_as_py <= now3) == "True", "datetimes should be in order, 2 <= 3" ) def test_datetime_isoformat(): a = datetime( 2020, 3, 4, 5, 6, 7, 8, tzinfo=timezone(timedelta(hours=-1, minutes=8, seconds=-9)), fold=1, ) assert_equal(a.isoformat(), "2020-03-04T05:06:07.000008-00:52:09") assert_equal(a.isoformat(sep="U"), "2020-03-04U05:06:07.000008-00:52:09") assert_equal( a.isoformat(sep="U", timespec="seconds"), "2020-03-04U05:06:07-00:52:09" ) assert_equal(a.isoformat(sep="U", timespec="minutes"), "2020-03-04U05:06-00:52:09") assert_equal(a.isoformat(sep="U", timespec="hours"), "2020-03-04U05-00:52:09") a = datetime(2022, 3, 4) assert_equal(a.isoformat(), "2022-03-04T00:00:00") def test_datetime_str(): a = datetime( 2020, 3, 4, 5, 6, 7, 8, tzinfo=timezone(timedelta(hours=-1, minutes=8, seconds=-9)), fold=1, ) assert_equal(str(a), "2020-03-04 05:06:07.000008-00:52:09") def run_tests(): test_aliases() test_constructor_default() test_constructor_all_values() test_datetime_get_timetuple() test_datetime_replace() test_datetime_repr() test_datetime_add() test_datetime_sub() test_datetime_now() test_datetime_isoformat() test_datetime_str() --- stdlib_extensions/stdlib_tests/datetime/test_time_class.mojo --- from ...datetime import time, timezone, timedelta from ...stdlib_tests.utils import assert_true, assert_false, assert_equal from ...builtins import Optional def test_time_creation(): t = time(12, 30, 0) assert_equal(t.hour, 12) assert_equal(t.minute, 30) assert_equal(t.second, 0) assert_equal(t.microsecond, 0) assert_true(t.tzinfo is None, "tzinfo is None") assert_equal(t.fold, 0) def test_time_repr(): var utc = timezone(timedelta(0)) assert_equal(time(12, 30, 0).__repr__(), "datetime.time(12, 30)") assert_equal( time(12, 30, 0, tzinfo=utc).__repr__(), "datetime.time(12, 30, tzinfo=datetime.timezone.utc)", ) assert_equal(time(12, 30, 0, fold=1).__repr__(), "datetime.time(12, 30, fold=1)") assert_equal( time(12, 30, 0, tzinfo=utc, fold=1).__repr__(), "datetime.time(12, 30, tzinfo=datetime.timezone.utc, fold=1)", ) assert_equal(time(12, 30, 8).__repr__(), "datetime.time(12, 30, 8)") assert_equal( time(12, 30, 8, tzinfo=utc).__repr__(), "datetime.time(12, 30, 8, tzinfo=datetime.timezone.utc)", ) assert_equal(time(12, 30, 8, 4).__repr__(), "datetime.time(12, 30, 8, 4)") assert_equal( time(12, 30, 8, 4, tzinfo=utc).__repr__(), "datetime.time(12, 30, 8, 4, tzinfo=datetime.timezone.utc)", ) assert_equal( time(12, 30, 8, 4, fold=1).__repr__(), "datetime.time(12, 30, 8, 4, fold=1)" ) assert_equal( time(12, 30, 8, 4, tzinfo=utc, fold=1).__repr__(), "datetime.time(12, 30, 8, 4, tzinfo=datetime.timezone.utc, fold=1)", ) def test_utcoffset(): var t = time(12, 30, 0) assert_true(t.utcoffset() is None, "utcoffset is None") assert_true( time(12, 30, 0, tzinfo=timezone(timedelta(0))).utcoffset() is not None, "utcoffset should not be None", ) assert_true( time(12, 30, 0, tzinfo=timezone(timedelta(0))).utcoffset().value() == timedelta(0), "utcoffset is 0", ) assert_true( time(12, 30, 0, tzinfo=timezone(timedelta(hours=-4))).utcoffset().value() == timedelta(hours=-4), "utcoffset is 0", ) def test_comparison_without_timezone(): assert_true(time(12, 30, 0) == time(12, 30, 0), "the two times are equal") assert_false(time(12, 30, 0) == time(12, 30, 1), "the two times are not equal") assert_true(time(12, 30, 0) != time(12, 30, 1), "the two times are not equal") assert_false(time(12, 30, 0) != time(12, 30, 0), "the two times are equal") assert_true( time(12, 30, 0) < time(12, 30, 1), "the first time is less than the second" ) assert_false( time(12, 30, 1) < time(12, 30, 0), "the first time is not less than the second" ) assert_true( time(12, 30, 0) <= time(12, 30, 1), "the first time is less than the second" ) assert_false( time(12, 30, 1) <= time(12, 30, 0), "the first time is not less than the second" ) assert_true( time(12, 30, 1) <= time(12, 30, 1), "the first time is less or equal to the second", ) assert_true( time(12, 30, 1) > time(12, 30, 0), "the first time is greater than the second" ) assert_false( time(12, 30, 0) > time(12, 30, 1), "the first time is not greater than the second", ) assert_true( time(12, 30, 1) >= time(12, 30, 0), "the first time is greater than the second" ) assert_false( time(12, 30, 0) >= time(12, 30, 1), "the first time is not greater than the second", ) assert_true( time(12, 30, 1) >= time(12, 30, 1), "the first time is greater or equal to the second", ) def test_dst(): assert_true(time(12, 30, 0).dst() is None, "dst is None") assert_true( time(12, 30, 0, tzinfo=timezone(timedelta(0))).dst() is None, "dst should be None", ) assert_true( time(12, 30, 0, tzinfo=timezone(timedelta(hours=-4))).dst() is None, "dst is None", ) def test_hash_time(): var t1 = time(12, 30, 0) var t2 = time(12, 30, 0) assert_true(t1 == t2, "the two times are equal") assert_true(hash(t1) == hash(t2), "the two hashes are equal") def test_hash_time_with_timezone(): var t1 = time(12, 30, 0, tzinfo=timezone(timedelta(0))) var t2 = time(12, 30, 0, tzinfo=timezone(timedelta(0))) assert_true(t1 == t2, "the two times are equal") assert_true(hash(t1) == hash(t2), "the two hashes are equal") def test_hash_time_with_different_timezones(): var t1 = time(12, 30, 0, tzinfo=timezone(timedelta(0))) var t2 = time(12, 30, 0, tzinfo=timezone(timedelta(hours=-4, minutes=-3))) assert_false(t1 == t2, "the two times should not be equal") assert_false(hash(t1) == hash(t2), "the two hashes are not equal") def test_hash_time_with_different_timezones_equal(): var t1 = time(12, 30, 0, tzinfo=timezone(timedelta(0))) var t2 = time(8, 40, 0, tzinfo=timezone(timedelta(hours=-4, minutes=10))) assert_true(t1 == t2, "the two times are equal") assert_true(hash(t1) == hash(t2), "the two hashes should be equal") def test_time_isoformat_default(): assert_equal(time(12, 30, 0).isoformat(), "12:30:00") assert_equal( time(12, 30, 0, tzinfo=timezone(timedelta(0))).isoformat(), "12:30:00+00:00" ) assert_equal( time(12, 30, 0, tzinfo=timezone(timedelta(hours=-4))).isoformat(), "12:30:00-04:00", ) assert_equal(time(12, 30, 0, fold=1).isoformat(), "12:30:00") assert_equal( time(12, 30, 0, tzinfo=timezone(timedelta(0)), fold=1).isoformat(), "12:30:00+00:00", ) assert_equal( time(12, 30, 0, 100, tzinfo=timezone(timedelta(hours=-4)), fold=1).isoformat(), "12:30:00.000100-04:00", ) def test_isoformat_with_different_timespec(): t = time(12, 30, 8, 108, tzinfo=timezone(timedelta(hours=-4)), fold=1) assert_equal(t.isoformat(), "12:30:08.000108-04:00") assert_equal(t.isoformat("hours"), "12-04:00") assert_equal(t.isoformat("minutes"), "12:30-04:00") assert_equal(t.isoformat("seconds"), "12:30:08-04:00") assert_equal(t.isoformat("milliseconds"), "12:30:08.000-04:00") assert_equal(t.isoformat("microseconds"), "12:30:08.000108-04:00") def test_str_function_on_time(): """Should return isoformat.""" assert_equal( str(time(12, 30, 0, 105, tzinfo=timezone(timedelta(hours=-4)), fold=1)), "12:30:00.000105-04:00", ) assert_equal(str(time(12, 30, 0)), "12:30:00") def test_time_strftime_all_values_filled(): t = time( 12, 30, 0, 105, tzinfo=timezone(timedelta(hours=-4, minutes=1, seconds=8, microseconds=33)), fold=1, ) format = "%a|%A|%w|%d|%b|%B|%m|%y|%Y|%H|%I|%p|%M|%S|%f|%z|%Z|%j|%U|%W|%c|%x|%X|%G|%u|%V|%%|%:z" expected = ( "Mon|Monday|1|01|Jan|January|01|00|1900|12|12|PM|30|00|000105|-035851.999967|UTC-03:58:51.999967|001|00|01|Mon" " Jan 1 12:30:00 1900|01/01/00|12:30:00|1900|1|01|%|-03:58:51.999967" ) assert_equal(t.strftime(format), expected) def test_time_strftime_simple_time(): t = time(1, 3) format = "%a|%A|%w|%d|%b|%B|%m|%y|%Y|%H|%I|%p|%M|%S|%f|%z|%Z|%j|%U|%W|%c|%x|%X|%G|%u|%V|%%|%:z" expected = ( "Mon|Monday|1|01|Jan|January|01|00|1900|01|01|AM|03|00|000000|||001|00|01|Mon" " Jan 1 01:03:00 1900|01/01/00|01:03:00|1900|1|01|%|" ) assert_equal(t.strftime(format), expected) def test_time_format_dunder_empty(): # empty is the same as isoformat t = time( 12, 30, 0, 105, tzinfo=timezone(timedelta(hours=-4, minutes=1, seconds=8, microseconds=33)), fold=1, ) assert_equal(t.__format__(""), t.isoformat()) def test_time_format_dunder_non_empty(): # this should be the same as strftime t = time( 1, 59, 59, 999999, tzinfo=timezone(timedelta(hours=4, minutes=1, seconds=8, microseconds=33)), fold=1, ) format = "%a|%A|%w|%d|%b|%B|%m|%y|%Y|%H|%I|%p|%M|%S|%f|%z|%Z|%j|%U|%W|%c|%x|%X|%G|%u|%V|%%|%:z" expected = ( "Mon|Monday|1|01|Jan|January|01|00|1900|01|01|AM|59|59|999999|+040108.000033|UTC+04:01:08.000033|001|00|01|Mon" " Jan 1 01:59:59 1900|01/01/00|01:59:59|1900|1|01|%|+04:01:08.000033" ) assert_equal(t.__format__(format), expected) def test_time_fromisoformat(): assert_equal(time.fromisoformat("12:30:00"), time(12, 30, 0)) assert_equal( time.fromisoformat("12:30:00+00:00"), time(12, 30, 0, tzinfo=timezone(timedelta(0))), ) assert_equal( time.fromisoformat("12:30:00-04:00"), time(12, 30, 0, tzinfo=timezone(timedelta(hours=-4))), ) assert_equal( time.fromisoformat("12:30:00.000100-04:00"), time(12, 30, 0, 100, tzinfo=timezone(timedelta(hours=-4))), ) assert_equal( time.fromisoformat("12:30:00.000100+04:00:08.000003"), time( 12, 30, 0, 100, tzinfo=timezone(timedelta(hours=4, seconds=8, microseconds=3)), ), ) assert_equal( time.fromisoformat("123000.000100+040008.000003"), time( 12, 30, 0, 100, tzinfo=timezone(timedelta(hours=4, seconds=8, microseconds=3)), ), ) # those examples come from the Python docs: assert_equal(time.fromisoformat("04:23:01"), time(4, 23, 1)) assert_equal(time.fromisoformat("T04:23:01"), time(4, 23, 1)) assert_equal(time.fromisoformat("T042301"), time(4, 23, 1)) assert_equal(time.fromisoformat("04:23:01.000384"), time(4, 23, 1, 384)) assert_equal(time.fromisoformat("04:23:01,000384"), time(4, 23, 1, 384)) assert_equal( time.fromisoformat("04:23:01+04:00"), time(4, 23, 1, tzinfo=timezone(timedelta(seconds=14400))), ) assert_equal( time.fromisoformat("04:23:01Z"), time(4, 23, 1, tzinfo=timezone(timedelta(0))) ) assert_equal( time.fromisoformat("04:23:01+00:00"), time(4, 23, 1, tzinfo=timezone(timedelta(0))), ) def run_tests(): test_time_creation() test_time_repr() test_utcoffset() test_comparison_without_timezone() test_dst() test_hash_time() test_hash_time_with_timezone() test_hash_time_with_different_timezones() test_hash_time_with_different_timezones_equal() test_time_isoformat_default() test_isoformat_with_different_timespec() test_str_function_on_time() test_time_strftime_all_values_filled() test_time_strftime_simple_time() test_time_format_dunder_empty() test_time_format_dunder_non_empty() test_time_fromisoformat() --- stdlib_extensions/stdlib_tests/datetime/test_timedelta.mojo --- from ...stdlib_tests.utils import assert_true, assert_false, assert_equal from ...datetime import timedelta def test_timedelta(): assert_equal(timedelta().total_seconds(), 0) divided = timedelta(hours=1) / timedelta(seconds=1) assert_equal(String(divided), "3600.0") def test_timedelta_constructor(): one_min = timedelta(minutes=1) assert_equal(one_min.seconds, 60) assert_equal(one_min.days, 0) assert_equal(one_min.microseconds, 0) half_a_min = timedelta(minutes=0.5, use_floats=True) assert_equal(half_a_min.seconds, 30) assert_equal(half_a_min.days, 0) assert_equal(half_a_min.microseconds, 0) one_day_and_a_half = timedelta(days=1.5, use_floats=True) assert_equal(one_day_and_a_half.days, 1) assert_equal(one_day_and_a_half.seconds, 43200) assert_equal(one_day_and_a_half.microseconds, 0) two_weeks = timedelta(weeks=2) assert_equal(two_weeks.days, 14) assert_equal(two_weeks.seconds, 0) assert_equal(two_weeks.microseconds, 0) def test_timedelta_repr(): assert_equal(timedelta().__repr__(), "datetime.timedelta(0)") assert_equal(timedelta(days=1).__repr__(), "datetime.timedelta(days=1)") assert_equal(timedelta(minutes=1).__repr__(), "datetime.timedelta(seconds=60)") assert_equal(timedelta(seconds=1).__repr__(), "datetime.timedelta(seconds=1)") assert_equal( timedelta(microseconds=1).__repr__(), "datetime.timedelta(microseconds=1)" ) assert_equal( timedelta(milliseconds=1).__repr__(), "datetime.timedelta(microseconds=1000)" ) assert_equal(timedelta(hours=1).__repr__(), "datetime.timedelta(seconds=3600)") assert_equal( timedelta(days=1, hours=1).__repr__(), "datetime.timedelta(days=1, seconds=3600)", ) assert_equal( timedelta(days=1, hours=1, minutes=1).__repr__(), "datetime.timedelta(days=1, seconds=3660)", ) assert_equal( timedelta(days=1, hours=1, minutes=1, seconds=1).__repr__(), "datetime.timedelta(days=1, seconds=3661)", ) assert_equal( timedelta(days=1, hours=1, minutes=1, seconds=1, microseconds=1).__repr__(), "datetime.timedelta(days=1, seconds=3661, microseconds=1)", ) assert_equal( timedelta( days=1, hours=1, minutes=1, seconds=1, milliseconds=2, microseconds=1 ).__repr__(), "datetime.timedelta(days=1, seconds=3661, microseconds=2001)", ) def run_tests(): test_timedelta() test_timedelta_repr() test_timedelta_constructor() --- stdlib_extensions/stdlib_tests/datetime/test_timezone.mojo --- from ...datetime import time, timezone, timedelta from ...stdlib_tests.utils import assert_true, assert_false, assert_equal from ...builtins._types import Optional def test_timezone_utc(): a = timezone(timedelta(0)) assert_equal(str(a), "UTC") # TODO: use when https://github.com/modularml/mojo/issues/1787 is fixed # assert_equal(timezone.utc, timezone(timedelta(0))) def test_timezone_equality(): assert_true( timezone(offset=timedelta(0)) == timezone(timedelta(0)), "timezones should be equal", ) assert_true( timezone(offset=timedelta(0), name=String("dodo")) == timezone(timedelta(0)), "timezones should be equal", ) assert_true( timezone(offset=timedelta(hours=-4), name=String("dodo")) == timezone(timedelta(hours=-4)), "timezones should be equal", ) def test_timezone_repr(): assert_equal( timezone(offset=timedelta(hours=-4), name=String("dodo")).__repr__(), "datetime.timezone(datetime.timedelta(days=-1, seconds=72000), 'dodo')", ) def test_hash(): assert_equal(hash(timezone(timedelta(0))), hash(timezone(timedelta(0)))) assert_equal( hash(timezone(timedelta(0), name=String("dodo"))), hash(timezone(timedelta(0))) ) assert_false( hash(timezone(timedelta(0))) == hash(timezone(timedelta(hours=1))), "timezones should not have the same hash", ) assert_false( hash(timezone(timedelta(0), name=String("dodo"))) == hash(timezone(timedelta(hours=1), name=String("dodo"))), "timezones should not have the same hash", ) def test_tzname(): assert_equal(timezone(timedelta(0)).tzname(None), "UTC") assert_equal(timezone(timedelta(0), name=String("dodo")).tzname(None), "dodo") assert_equal(timezone(timedelta(hours=2)).tzname(None), "UTC+02:00") assert_equal( timezone(timedelta(hours=2, minutes=6, seconds=8, milliseconds=444)).tzname( None ), "UTC+02:06:08.444000", ) assert_equal(str(timezone(timedelta(0))), "UTC") assert_equal(str(timezone(timedelta(0), name=String("dodo"))), "dodo") assert_equal(str(timezone(timedelta(hours=2))), "UTC+02:00") assert_equal( str(timezone(timedelta(hours=2, minutes=6, seconds=8, milliseconds=444))), "UTC+02:06:08.444000", ) def run_tests(): test_timezone_utc() test_timezone_equality() test_timezone_repr() test_hash() test_tzname() --- stdlib_extensions/stdlib_tests/datetime/test_utils.mojo --- from ...stdlib_tests.utils import assert_true, assert_false, assert_equal from ...datetime._utils import ( _is_leap, _days_before_year, _days_in_month, ) def test_is_leap(): assert_true(_is_leap(4), "4 is a leap year") assert_true(_is_leap(400), "400 is a leap year") assert_false(_is_leap(100), "100 is not a leap year") assert_false(_is_leap(200), "200 is not a leap year") assert_false(_is_leap(300), "300 is not a leap year") assert_false(_is_leap(500), "500 is not a leap year") assert_true(_is_leap(40), "400 is a leap year") assert_true(_is_leap(8), "8 is a leap year") assert_false(_is_leap(1), "1 is not a leap year") def test_days_before_year(): assert_equal(_days_before_year(1), 0) assert_equal(_days_before_year(2), 365) assert_equal(_days_before_year(3), 730) assert_equal(_days_before_year(4), 1095) assert_equal(_days_before_year(5), 1461) def test_days_in_month(): assert_equal(_days_in_month(1, 1), 31) assert_equal(_days_in_month(1, 2), 28) assert_equal(_days_in_month(4, 2), 29) assert_equal(_days_in_month(1, 3), 31) assert_equal(_days_in_month(1, 4), 30) assert_equal(_days_in_month(1, 5), 31) assert_equal(_days_in_month(1, 6), 30) assert_equal(_days_in_month(1, 7), 31) assert_equal(_days_in_month(1, 8), 31) assert_equal(_days_in_month(1, 9), 30) assert_equal(_days_in_month(1, 10), 31) assert_equal(_days_in_month(1, 11), 30) assert_equal(_days_in_month(1, 12), 31) assert_equal(_days_in_month(6, 3), 31) def run_tests(): test_is_leap() test_days_before_year() test_days_in_month() --- stdlib_extensions/stdlib_tests/os/__init__.mojo --- --- stdlib_extensions/stdlib_tests/os/test_process.mojo --- from ...os import getpid, urandom from ...builtins import bytes from ..utils import assert_true, assert_equal def test_getpid(): current_pid = getpid() assert_true(current_pid > 0, "current pid should be above 0") def test_urandom(): some_random_bytes = urandom(10) assert_equal(len(some_random_bytes), 10) some_new_bytes = urandom(10) assert_true(some_random_bytes != some_new_bytes, "random bytes should be different") empty_bytes = urandom(0) assert_equal(len(empty_bytes), 0) def run_tests(): test_getpid() test_urandom() --- stdlib_extensions/stdlib_tests/pathlib/__init__.mojo --- --- stdlib_extensions/stdlib_tests/pathlib/test_path.mojo --- from ...pathlib import Path from ..utils import assert_equal def test_read_and_write_from_file(): # TODO: change this when we can create directories # TemporaryDirectory() would be very helpful to ensure cleanup tmp_dir = Path("/tmp/") tmp_file = tmp_dir / "test_file.txt" assert_equal(tmp_file.__fspath__(), "/tmp/test_file.txt") tmp_file.write_text("Hello mojo 🔥") assert_equal(tmp_file.read_text(), "Hello mojo 🔥") tmp_file.unlink() def run_tests(): test_read_and_write_from_file() --- stdlib_extensions/stdlib_tests/time/__init__.mojo --- --- stdlib_extensions/stdlib_tests/time/test_time.mojo --- from ...time import time_ns from python import Python from ..utils import assert_true def test_time_ns(): py_time_ns = Python.import_module("time").time_ns t1 = py_time_ns() t_mojo = time_ns() t2 = py_time_ns() assert_true( t1.to_float64().cast[DType.int64]() <= t_mojo, "time_ns() should return a value equal or above the previous python call", ) assert_true( t_mojo <= t2.to_float64().cast[DType.int64](), "time_ns() should return a value equal or below the next python call", ) def run_tests(): test_time_ns() --- stdlib_extensions/stdlib_tests/utils.mojo --- """Unlike what is present in the standard stdlib, we stop if something fails.""" from ..builtins import bytes def assert_equal(a: bytes, b: bytes): if a != b: raise Error("Expected '" + a.hex() + "' to be equal to '" + b.hex() + "'") def assert_equal(a: String, b: String): if a != b: raise Error("Expected '" + a + "' to be equal to '" + b + "'") def assert_equal(a: Int, b: Int): if a != b: raise Error("Expected " + String(a) + " to be equal to " + String(b)) def assert_equal[T: Stringable, U: Stringable](a: T, b: U): if str(a) != str(b): raise Error( "Expected both to be equal.\n got: " + str(a) + "\nExpected: " + str(b) ) def assert_true(value: Bool, message: String): if not value: raise Error(message) def assert_false(value: Bool, message: String): if value: raise Error(message) --- stdlib_extensions/stdlib_tests/uuid/__init__.mojo --- --- stdlib_extensions/stdlib_tests/uuid/test_uuid_class.mojo --- from ..utils import assert_equal, assert_true, assert_false, assert_false from ...uuid import UUID, RFC_4122, uuid4 from ...builtins import bytes def test_uuid_class_no_version(): assert_equal(str(UUID(bytes=bytes(16))), "00000000-0000-0000-0000-000000000000") assert_equal( str(UUID("76fb1595-8b2f-456a-b809-bc2e00c70a45")), "76fb1595-8b2f-456a-b809-bc2e00c70a45", ) some_uuid = UUID("162bb388-b33a-1fe3-be31-7e5993496eb8") assert_equal(str(some_uuid), "162bb388-b33a-1fe3-be31-7e5993496eb8") corresponding_bytes = some_uuid.bytes() assert_equal(len(corresponding_bytes), 16) assert_equal(str(UUID(corresponding_bytes)), str(some_uuid)) assert_equal( UUID("76fb1595-8b2f-456a-b809-bc2e00c70a45").__repr__(), "UUID('76fb1595-8b2f-456a-b809-bc2e00c70a45')", ) def test_uuid_class_version_1(): some_uuid = UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5") assert_equal(some_uuid.variant(), RFC_4122) assert_equal(some_uuid.version(), 1) def test_uuid_class_version_3(): some_uuid = UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542") assert_equal(some_uuid.variant(), RFC_4122) assert_equal(some_uuid.version(), 3) def test_uuid_class_version_4(): some_uuid = UUID("4d3a88c7-8a53-4239-94cb-59bd25191542") assert_equal(some_uuid.variant(), RFC_4122) assert_equal(some_uuid.version(), 4) def test_uuid_class_version_5(): some_uuid = UUID("a3b9a1b0-8a53-5239-94cb-59bd25191542") assert_equal(some_uuid.variant(), RFC_4122) assert_equal(some_uuid.version(), 5) def test_set_version(): for i in range(1, 6): assert_equal( UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5", version=i).version(), i ) assert_equal( UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542", version=i).version(), i ) assert_equal( UUID("4d3a88c7-8a53-4239-94cb-59bd25191542", version=i).version(), i ) assert_equal( UUID("a3b9a1b0-8a53-5239-94cb-59bd25191542", version=i).version(), i ) def test_order(): assert_true( UUID("00000000-0000-0000-0000-000000000000") < UUID("00000000-0000-0000-0000-000000000001"), "not less", ) assert_false( UUID("00000000-0000-0000-0000-000000000000") > UUID("00000000-0000-0000-0000-000000000001"), "not greater", ) assert_true( UUID("00000000-0000-0000-0000-000000000000") <= UUID("00000000-0000-0000-0000-000000000001"), "not less or equal", ) assert_false( UUID("00000000-0000-0000-0000-000000000000") >= UUID("00000000-0000-0000-0000-000000000001"), "not greater or equal", ) assert_true( UUID("00000000-0000-0000-0000-000000000000") == UUID("00000000-0000-0000-0000-000000000000"), "not equal", ) assert_false( UUID("00000000-0000-0000-0000-000000000000") != UUID("00000000-0000-0000-0000-000000000000"), "not not equal", ) assert_true( UUID("e0000000-0000-0000-0000-000000000000") < UUID("f0000000-0000-0000-0000-000000000000"), "not less", ) assert_false( UUID("e0000000-0000-0000-0000-000000000000") > UUID("f0000000-0000-0000-0000-000000000000"), "not greater", ) assert_true( UUID("e0000000-0000-0000-0000-000000000000") <= UUID("f0000000-0000-0000-0000-000000000000"), "not less or equal", ) assert_false( UUID("e0000000-0000-0000-0000-000000000000") >= UUID("f0000000-0000-0000-0000-000000000000"), "not greater or equal", ) assert_true( UUID("e0000000-0000-0000-0000-000000000000") == UUID("e0000000-0000-0000-0000-000000000000"), "not equal", ) assert_false( UUID("e0000000-0000-0000-0000-000000000000") != UUID("e0000000-0000-0000-0000-000000000000"), "not not equal", ) def test_time_low(): assert_equal(UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5").time_low(), 1276264282) assert_equal(UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542").time_low(), 2746851760) assert_equal(UUID("d3b9c1b0-8a53-5239-94cb-59bd25191542").time_low(), 3552166320) def test_time_mid(): assert_equal(UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5").time_mid(), 34554) assert_equal(UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542").time_mid(), 35411) assert_equal(UUID("d3b9c1b0-8a53-5239-94cb-59bd25191542").time_mid(), 35411) assert_equal(UUID("f588b9be-929a-4b15-925f-23c9903b847a").time_mid(), 37530) def test_time_hi_version(): assert_equal(UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5").time_hi_version(), 4590) assert_equal(UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542").time_hi_version(), 12857) assert_equal(UUID("d3b9c1b0-8a53-5239-94cb-59bd25191542").time_hi_version(), 21049) assert_equal(UUID("f588b9be-929a-4b15-925f-23c9903b847a").time_hi_version(), 19221) def test_clock_seq_hi_variant(): assert_equal( UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5").clock_seq_hi_variant(), 168 ) assert_equal( UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542").clock_seq_hi_variant(), 148 ) assert_equal( UUID("d3b9c1b0-8a53-5239-94cb-59bd25191542").clock_seq_hi_variant(), 148 ) assert_equal( UUID("f588b9be-929a-4b15-925f-23c9903b847a").clock_seq_hi_variant(), 146 ) def test_clock_seq_low(): assert_equal(UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5").clock_seq_low(), 208) assert_equal(UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542").clock_seq_low(), 203) assert_equal(UUID("d3b9c1b0-8a53-5239-94cb-59bd25191542").clock_seq_low(), 203) assert_equal(UUID("f588b9be-929a-4b15-925f-23c9903b847a").clock_seq_low(), 95) def test_node(): assert_equal(UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5").node(), 215462552298485) assert_equal(UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542").node(), 98668906091842) assert_equal(UUID("d3b9c1b0-8a53-5239-94cb-59bd25191542").node(), 98668906091842) assert_equal(UUID("f588b9be-929a-4b15-925f-23c9903b847a").node(), 39348615218298) def test_urn(): assert_equal( UUID("4c123f5a-86fa-11ee-a8d0-c3f648e463f5").urn(), "urn:uuid:4c123f5a-86fa-11ee-a8d0-c3f648e463f5", ) assert_equal( UUID("a3b9a1b0-8a53-3239-94cb-59bd25191542").urn(), "urn:uuid:a3b9a1b0-8a53-3239-94cb-59bd25191542", ) assert_equal( UUID("d3b9c1b0-8a53-5239-94cb-59bd25191542").urn(), "urn:uuid:d3b9c1b0-8a53-5239-94cb-59bd25191542", ) assert_equal( UUID("f588b9be-929a-4b15-925f-23c9903b847a").urn(), "urn:uuid:f588b9be-929a-4b15-925f-23c9903b847a", ) def test_uuid4(): for _ in range(100): assert_equal(uuid4().variant(), RFC_4122) assert_equal(uuid4().version(), 4) assert_false(uuid4() == uuid4(), "Randomy generated UUIDs are equal") def run_tests(): test_uuid_class_no_version() test_uuid_class_version_1() test_uuid_class_version_3() test_uuid_class_version_4() test_uuid_class_version_5() test_set_version() test_order() test_time_low() test_time_mid() test_time_hi_version() test_clock_seq_hi_variant() test_clock_seq_low() test_node() test_urn() test_uuid4() --- stdlib_extensions/syscalls/__init__.mojo --- --- stdlib_extensions/syscalls/c.mojo --- # Types aliases alias void = UInt8 alias char = UInt8 alias schar = Int8 alias uchar = UInt8 alias short = Int16 alias ushort = UInt16 alias int = Int32 alias uint = UInt32 alias long = Int64 alias ulong = UInt64 alias float = Float32 alias double = Float64 alias time_t = Int64 alias size_t = UInt64 alias ssize_t = Int alias ptrdiff_t = Int64 alias intptr_t = Int64 alias uintptr_t = UInt64 # standard io alias FD_STDIN: int = 0 alias FD_STDOUT: int = 1 alias FD_STDERR: int = 2 # --- ( error.h Constants )----------------------------------------------------- alias SUCCESS = 0 alias EPERM = 1 alias ENOENT = 2 alias ESRCH = 3 alias EINTR = 4 alias EIO = 5 alias ENXIO = 6 alias E2BIG = 7 alias ENOEXEC = 8 alias EBADF = 9 alias ECHILD = 10 alias EAGAIN = 11 alias ENOMEM = 12 alias EACCES = 13 alias EFAULT = 14 alias ENOTBLK = 15 alias EBUSY = 16 alias EEXIST = 17 alias EXDEV = 18 alias ENODEV = 19 alias ENOTDIR = 20 alias EISDIR = 21 alias EINVAL = 22 alias ENFILE = 23 alias EMFILE = 24 alias ENOTTY = 25 alias ETXTBSY = 26 alias EFBIG = 27 alias ENOSPC = 28 alias ESPIPE = 29 alias EROFS = 30 alias EMLINK = 31 alias EPIPE = 32 alias EDOM = 33 alias ERANGE = 34 alias EWOULDBLOCK = EAGAIN # random consts alias GRND_NONBLOCK: UInt8 = 1 alias char_pointer = AnyPointer[char] @value struct Str: var vector: List[char] fn __init__(inout self, string: String): self.vector = List[char](capacity=len(string) + 1) for i in range(len(string)): self.vector.append(ord(string[i])) self.vector.append(0) fn __init__(inout self, size: Int): self.vector = List[char]() self.vector.resize(size + 1, 0) fn __len__(self) -> Int: for i in range(len(self.vector)): if self.vector[i] == 0: return i return -1 fn to_string(self, size: Int) -> String: var result: String = "" for i in range(size): result += chr(self.vector[i].to_int()) return result fn __enter__(owned self: Self) -> Self: return self^ --- stdlib_extensions/syscalls/clocks.mojo --- from memory.unsafe import Pointer from ..syscalls import c alias _CLOCK_REALTIME = 0 @value struct _CTimeSpec: var tv_sec: c.time_t var tv_nsec: c.long fn __init__(inout self): self.tv_sec = 0 self.tv_nsec = 0 fn clock_gettime() -> _CTimeSpec: """Low-level call to the clock_gettime libc function.""" var ts = _CTimeSpec() var ts_pointer = Pointer[_CTimeSpec].address_of(ts) var clockid_si32: c.int = _CLOCK_REALTIME external_call["clock_gettime", NoneType, c.int, Pointer[_CTimeSpec]]( clockid_si32, ts_pointer ) return ts --- stdlib_extensions/syscalls/filesystem.mojo --- from ..syscalls import c from .._utils import custom_debug_assert fn rmdir(pathname: String): with c.Str(pathname) as pathname_as_c_str: var output = external_call["rmdir", c.int, c.char_pointer]( pathname_as_c_str.vector.data ) if output == c.SUCCESS: return elif output == c.EACCES: custom_debug_assert( False, "Write access to the directory containing " + pathname + " was notallowed, or one of the directories in the path prefix of " + pathname + " did notallow search permission.", ) elif output == c.EBUSY: custom_debug_assert( False, pathname + " is currently in use by the system or some process" "that prevents its removal. On Linux, this means " + pathname + " is currently" "used as a mount point or is the root directory of the calling" " process.", ) elif output == c.EFAULT: custom_debug_assert( False, pathname + " points outside your accessible address space." ) elif output == c.EINVAL: custom_debug_assert(False, pathname + " has . as last component.") elif output == c.ENOENT: custom_debug_assert( False, "A directory component in " + pathname + " does not exist or is adangling symbolic link.", ) elif output == c.ENOMEM: custom_debug_assert(False, "Insufficient kernel memory was available.") elif output == c.ENOTDIR: custom_debug_assert( False, pathname + ", or a component used as a directory in " + pathname + ", is not, in fact, a directory.", ) elif output == c.EPERM: custom_debug_assert( False, "The filesystem containing " + pathname + " does not support the removal of directories.", ) elif output == c.EROFS: custom_debug_assert( False, pathname + " refers to a directory on a read-only filesystem." ) else: custom_debug_assert( False, "rmdir failed with unknown error code: " + String(output) ) fn unlink(pathname: String): with c.Str(pathname) as pathname_as_c_str: var output = external_call["unlink", c.int, c.char_pointer]( pathname_as_c_str.vector.data ) if output == c.SUCCESS: return elif output == c.EACCES: custom_debug_assert( False, "Write permission is denied for the directory from which the file +" + pathname + " is to be removed, " "or the directory has the sticky bit set and you do not own the file.", ) elif output == c.EBUSY: custom_debug_assert( False, "the file " + pathname + " is being used by the system in such a way thatit can’t be unlinked." " For example, you might see this error if the filename specifies the" " root directory or a mount point for a file system.", ) elif output == c.ENOENT: custom_debug_assert(False, "he file " + pathname + " doesn’t exist.") elif output == c.EPERM: custom_debug_assert( False, ( "On some systems unlink cannot be used to delete the name of a" " directory, or at least can only be used this way by a privileged" " user." ), ) elif output == c.EROFS: custom_debug_assert( False, pathname + " refers to a file on a read-only filesystem and thus cannot be" " removed.", ) else: custom_debug_assert( False, "rmdir failed with unknown error code: " + String(output) ) fn read_string_from_fd(file_descriptor: c.int) -> String: alias buffer_size: Int = 2**13 var buffer: c.Str with c.Str(size=buffer_size) as buffer: var read_count: c.ssize_t = external_call[ "read", c.ssize_t, c.int, c.char_pointer, c.size_t ](file_descriptor, buffer.vector.data, buffer_size) if read_count == -1: custom_debug_assert( False, "Failed to read file descriptor" + String(file_descriptor) ) # for stdin, stdout, stderr, we can do this approximation # normally we would decode to utf-8 as we go and check for \n, but we can't do that now because # we don't have easy to use utf-8 support. if read_count == buffer_size: custom_debug_assert( False, "You can only read up to " + String(buffer_size) + " bytes. " "Wait for UTF-8 support in Mojo for better handling of long inputs.", ) return buffer.to_string(read_count) fn read_from_stdin() -> String: return read_string_from_fd(c.FD_STDIN) --- stdlib_extensions/syscalls/process.mojo --- from ..syscalls import c fn getpid() -> c.int: return external_call["getpid", c.int]() --- stdlib_extensions/syscalls/random.mojo --- from ..builtins import bytes from ..syscalls import c from .._utils import custom_debug_assert fn getrandom(size: c.size_t) -> bytes: var result = bytes(size.to_int()) var nb_bytes_written = external_call[ "getrandom", c.ssize_t, AnyPointer[UInt8], c.size_t, c.uint ](result._vector.data, size, c.GRND_NONBLOCK.cast[DType.uint32]()) if nb_bytes_written < 0: custom_debug_assert(False, "getrandom failed") if nb_bytes_written != result.__len__(): custom_debug_assert(False, "getrandom didn't send enough bytes") return result --- stdlib_extensions/time/__init__.mojo --- from ..syscalls import clocks fn time_ns() -> Int64: """Returns the number of nanoseconds since the epoch.""" var time_struct = clocks.clock_gettime() return time_struct.tv_sec * 1_000_000_000 + time_struct.tv_nsec fn time() -> Float64: """Returns the number of seconds since the epoch, in float.""" var time_struct = clocks.clock_gettime() return ( time_struct.tv_sec.cast[DType.float64]() + time_struct.tv_nsec.cast[DType.float64]() / 1_000_000_000 ) @value struct struct_time: var tm_year: Int var tm_mon: Int var tm_mday: Int var tm_hour: Int var tm_min: Int var tm_sec: Int var tm_wday: Int var tm_yday: Int var tm_isdst: Int fn __init__(inout self, values: Tuple[Int, Int, Int, Int, Int, Int, Int, Int, Int]): self.tm_year = values.get[0, Int]() self.tm_mon = values.get[1, Int]() self.tm_mday = values.get[2, Int]() self.tm_hour = values.get[3, Int]() self.tm_min = values.get[4, Int]() self.tm_sec = values.get[5, Int]() self.tm_wday = values.get[6, Int]() self.tm_yday = values.get[7, Int]() self.tm_isdst = values.get[8, Int]() fn __getitem__(self, index: Int) -> Int: if index == 0: return self.tm_year elif index == 1: return self.tm_mon elif index == 2: return self.tm_mday elif index == 3: return self.tm_hour elif index == 4: return self.tm_min elif index == 5: return self.tm_sec elif index == 6: return self.tm_wday elif index == 7: return self.tm_yday elif index == 8: return self.tm_isdst else: # TODO raise an error here return 0 --- stdlib_extensions/uuid/__init__.mojo --- from ._classes import ( UUID, RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE, uuid4, ) --- stdlib_extensions/uuid/_classes.mojo --- from ..builtins.string import replace, strip from ..builtins import bytes as bytes_, to_bytes from ..os import urandom from utils.static_tuple import StaticTuple from memory import stack_allocation alias RESERVED_NCS = "reserved for NCS compatibility" alias RFC_4122 = "specified in RFC 4122" alias RESERVED_MICROSOFT = "reserved for Microsoft compatibility" alias RESERVED_FUTURE = "reserved for future definition" alias UUIDBytes = SIMD[DType.uint8, 16] struct SafeUUID: alias safe = 0 alias unsafe = -1 alias unknown = -2 # this is normally None but we don't have traits fn uint8_simd_to_int[simd_size: Int](x: SIMD[DType.uint8, simd_size]) -> Int: # a bitcast would be better but we don't have that yet it seems var output = 0 for i in range(simd_size): output += x[i].to_int() * ((2**8) ** (simd_size - i - 1)) return output @always_inline fn get_bit(x: SIMD[DType.uint8, 1], i: Int) -> Bool: return ((x >> i) & 1).cast[DType.bool]() struct UUID(Stringable): var __bytes: UUIDBytes var is_safe: Int fn __init__( inout self, owned hex: String, version: Int = -1, is_safe: Int = SafeUUID.unknown, ): hex = replace(hex, "urn:", "") hex = replace(hex, "uuid:", "") hex = strip(hex, "{}") hex = replace(hex, "-", "") # TODO: enable erroring when it's allowed to raise at compile time # if len(hex) != 32: # custom_debug_assert(False, "badly formed hexadecimal UUID string") self.__init__(bytes_.fromhex(hex), version, is_safe=is_safe) fn __init__( inout self, bytes: bytes_, version: Int = -1, is_safe: Int = SafeUUID.unknown, ): self.__bytes = UUIDBytes( bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15], ) if version != -1: # we set the version self.__bytes[6] |= UInt8((version << 4) + 0) self.__bytes[6] &= UInt8((version << 4) + 0xF) # we set the variant to RFC 4122 self.__bytes[8] |= UInt8(0x80) self.__bytes[8] &= UInt8(0xBF) self.is_safe = is_safe fn __eq__(self, other: UUID) -> Bool: return self.__bytes == other.__bytes fn __ne__(self, other: UUID) -> Bool: return self.__bytes != other.__bytes # TODO: Can we vectorize those methods? fn __lt__(self, other: UUID) -> Bool: for i in range(16): if self.__bytes[i] == other.__bytes[i]: continue return self.__bytes[i] < other.__bytes[i] return False fn __gt__(self, other: UUID) -> Bool: for i in range(16): if self.__bytes[i] == other.__bytes[i]: continue return self.__bytes[i] > other.__bytes[i] return False fn __le__(self, other: UUID) -> Bool: for i in range(16): if self.__bytes[i] == other.__bytes[i]: continue return self.__bytes[i] <= other.__bytes[i] return True fn __ge__(self, other: UUID) -> Bool: for i in range(16): if self.__bytes[i] == other.__bytes[i]: continue return self.__bytes[i] >= other.__bytes[i] return True fn __str__(self) -> String: var hex = self.bytes().hex() return ( hex[:8] + "-" + hex[8:12] + "-" + hex[12:16] + "-" + hex[16:20] + "-" + hex[20:] ) fn __repr__(self) -> String: return "UUID('" + self.__str__() + "')" fn bytes(self) -> bytes_: var output = bytes_() for i in range(16): output += to_bytes(self.__bytes[i].to_int()) return output fn time_low(self) -> Int: return uint8_simd_to_int(self.__bytes.slice[4, offset=0]()) fn time_mid(self) -> Int: return uint8_simd_to_int(self.__bytes.slice[2, offset=4]()) fn time_hi_version(self) -> Int: return uint8_simd_to_int(self.__bytes.slice[2, offset=6]()) fn clock_seq_hi_variant(self) -> Int: return uint8_simd_to_int(self.__bytes.slice[1, offset=8]()) fn clock_seq_low(self) -> Int: return uint8_simd_to_int(self.__bytes.slice[1, offset=9]()) fn node(self) -> Int: # trick because simd size can only be a power of 2 var node_bytes = self.__bytes.slice[8, offset=8]() node_bytes[0] = 0 node_bytes[1] = 0 return uint8_simd_to_int(node_bytes) fn urn(self) -> String: return "urn:uuid:" + str(self) fn variant(self) -> String: if not (self.__bytes[8] & 0x80).to_int(): return RESERVED_NCS elif not (self.__bytes[8] & 0x40).to_int(): return RFC_4122 elif not (self.__bytes[8] & 0x20).to_int(): return RESERVED_MICROSOFT else: return RESERVED_FUTURE fn version(self) -> Int: # The version bits are only meaningful for RFC 4122 UUIDs. if self.variant() == RFC_4122: return (self.__bytes[6] >> 4).to_int() else: # we should actually return None here but we don't have traits/unions return -1 def uuid4() -> UUID: """Generate a random UUID.""" return UUID(bytes=urandom(16), version=4) # The following standard UUIDs are for use with uuid3() or uuid5(). alias NAMESPACE_DNS = UUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8") alias NAMESPACE_URL = UUID("6ba7b811-9dad-11d1-80b4-00c04fd430c8") alias NAMESPACE_OID = UUID("6ba7b812-9dad-11d1-80b4-00c04fd430c8") alias NAMESPACE_X500 = UUID("6ba7b814-9dad-11d1-80b4-00c04fd430c8") --- LICENSE --- MIT License Copyright (c) 2023 TrainCheck.ai Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Mojomics Leveraging [Mojo](https://github.com/modularml/mojo), `Mojomics` aims to be a collection of Jupyter notebooks and resources to empower bioinformatics researchers with the tools and insights they need to accelerate their projects. ## Table of Contents - [Notebooks](#notebooks) - [License](#license) - [Contributing](#contributing) - [Contact](#contact) - [Acknowledgements](#acknowledgements) ## Notebooks Navigate to the `notebooks` directory to access the available notebooks: - `hamming`: Explore the Hamming distance algorithm for measuring the similarity between two sequences. - `seqAlign`: Dive into sequence alignment techniques to find the optimal alignment between pairs of sequences. ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## Contributing We welcome contributions! Please create an issue or open a pull request. ## Contact - GitHub Profile: [mattfaltyn](https://github.com/mattfaltyn) - Email: [email protected] ## Acknowledgements - Special thanks to the bioinformatics community for the inspiration and support in creating Mojomics. - Additional resources and references used in creating these notebooks can be found in the respective notebooks. --- URL: https://www.modular.com/ PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: 80K+ developers building with MAX # A high-performance generative AI framework MAX replaces and simplifies your AI inference stack, maximizing performance and reducing cloud costs ## Achieve state of the art NVIDIA GPU performance Unlock state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## Optimize your existing PyTorch & ONNX models Migrate seamlessly without rewriting your AI models and pipelines on a unified AI stack. ## Use Mojo to supercharge your AI applications Extend your Python code with high-performance Mojo, a new programming language with the expressiveness of Python and the performance of C. ## Develop locally, deploy globally to any cloud. Develop your AI applications locally and package and deploy across any cloud provider, on CPUs and GPUs, without having to change your code. ## Run Gen AI locally under 3 minutes Download MAX first to run an LLM - Run Llama3-8B in your CLIGet started - Run Llama2-7B in your CLIGet started - Run Replit-3B in your CLIGet started Run Llama3-8B in your CLI Run Llama2-7B in your CLI Run Replit-3B in your CLI ## Free Forever The MAX framework is a free and open platform for you to develop and deploy AI inference workloads. A new framework for Gen AI, and the best way to deploy PyTorch Development tools for accelerated compute on GPUs and CPUs, built from the ground up for GenAI, but compatible with today. ## Developer Approved 👍 “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/max PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # MAX empowers you to own & control your AI A new framework for Gen AI, and the best way to deploy PyTorch ## Unparalleled GenAI performance - Llama3 - Optimized pipelinesView on Github Llama3.pyllama 3 ../run-pipeline.🔥 llama3 --max-tokens 200 --prompt "Why the sky is blue?" --quantization-encoding q4_0 Loading tokenizer... Building model... Compiling... Executing... The sky appears blue due to a phenomenon called Rayleigh scattering... Prompt size: 10 Output size: 190 - Deploy LLMs with a single commandCheckout MAX Builds ### Llama3 - Optimized pipelines llama 3 ../run-pipeline.🔥 llama3 --max-tokens 200 --prompt "Why the sky is blue?" --quantization-encoding q4_0 Loading tokenizer... Building model... Compiling... Executing... The sky appears blue due to a phenomenon called Rayleigh scattering... Prompt size: 10 Output size: 190 ## Deploy LLMs with a single command ## The best way to deploy PyTorch - SOTA performance in just 3 lines of codeDrop in your PyTorch or ONNX models and get an instant boost in performance with our next generation inference runtime for CPUs and GPUsSee for yourself ## SOTA performance in just 3 lines of code Drop in your PyTorch or ONNX models and get an instant boost in performance with our next generation inference runtime for CPUs and GPUs ## Compatible with what you use today - Supports all your use cases and existing toolsUse the MAX APIs to build, optimize and deploy from one model to more complex GenAI pipelines on CPUs or GPUs.Supported model formats ## Supports all your use cases and existing tools Use the MAX APIs to build, optimize and deploy from one model to more complex GenAI pipelines on CPUs or GPUs. ## Build locally. Deploy easily across hardware in the cloud - Compute Abstraction for AIBuild your AI applications, package and deploy across CPUs and GPUs platforms including Apple, ARM, Intel, AMD and NVIDIA without code changes.Supported hardware - Accelerate your time to market with MAX on AWSGet help from the experts using a production grade managed service on AWSLearn more ## Compute Abstraction for AI Build your AI applications, package and deploy across CPUs and GPUs platforms including Apple, ARM, Intel, AMD and NVIDIA without code changes. ## Accelerate your time to market with MAX on AWS Get help from the experts using a production grade managed service on AWS ## Develop with Python,  Extend with Mojo🔥 - Use what you know with Python APIs in MAXUse our Python integration to interop with your existing workloads and offloads onto MAX where it mattersUsing Python with MAX - Learn how to scale your AI with MojoNo need to learn C and CUDA, use Mojo the easiest way to program CPUs and GPUs.Take a tour of Mojo🔥 ## Use what you know with Python APIs in MAX Use our Python integration to interop with your existing workloads and offloads onto MAX where it matters ## Learn how to scale your AI with Mojo No need to learn C and CUDA, use Mojo the easiest way to program CPUs and GPUs. ## What developers are saying about MAX “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/mojo MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # The expressiveness of Python, 
with the performance of C Mojo installs as part of MAX - 175kMojo Developers - 23kStars on Github - 22kCommunity members 175k Mojo Developers 23k Stars on Github 22k Community members ## Mojo has powerful & easy to use features Leverage types for better performance and error checking. def sort(v: ArraySlice[Int]): for i in range(len(v)): for j in range(len(v) - i - 1): if v[j] > v[j + 1]: swap(v[j], v[j + 1]) struct MyPair: var first: Int var second: F32 def __init__(self, first: Int, second: F32): self.first = first self.second = second def reorder_and_process(owned x: HugeArray): sort(x) # Update in place give_away(x^) # Transfer ownership print(x[0]) # Error: ‘x’ moved away! def exp[dt: DType, elts: Int] (x: SIMD[dt, elts]) -> SIMD[dt, elts]: x = clamp(x, -88.3762626647, 88.37626266) k = floor(x * INV_LN2 + 0.5) r = k * NEG_LN2 + x return ldexp(_exp_taylor(r), k) def exp_buffer[dt: DType](data: ArraySlice[dt]): # Search for the best vector length alias vector_len = autotune(1, 4, 8, 16, 32) # Use it as the vectorization length vectorize[exp[dt, vector_len]](data) def sort(v: ArraySlice[Int]): for i in range(len(v)): for j in range(len(v) - i - 1): if v[j] > v[j + 1]: swap(v[j], v[j + 1]) struct MyPair: var first: Int var second: F32 def __init__(self, first: Int, second: F32): self.first = first self.second = second def reorder_and_process(owned x: HugeArray): sort(x) # Update in place give_away(x^) # Transfer ownership print(x[0]) # Error: ‘x’ moved away! def exp[dt: DType, elts: Int] (x: SIMD[dt, elts]) -> SIMD[dt, elts]: x = clamp(x, -88.3762626647, 88.37626266) k = floor(x * INV_LN2 + 0.5) r = k * NEG_LN2 + x return ldexp(_exp_taylor(r), k) def exp_buffer[dt: DType](data: ArraySlice[dt]): # Search for the best vector length alias vector_len = autotune(1, 4, 8, 16, 32) # Use it as the vectorization length vectorize[exp[dt, vector_len]](data) - Progressive types - Zero cost abstractions - Ownership + borrow checker - Portable parametric algorithms - Language integrated auto-tuning Progressive types Zero cost abstractions Ownership + borrow checker Portable parametric algorithms Language integrated auto-tuning Progressive types Zero cost abstractions Ownership + borrow checker Portable parametric algorithms Language integrated auto-tuning Extend Python or scale all the way down to the metal. Program the multitude of low-level AI hardware. No C++ or CUDA required. Using Mojo with MAX unlocks the future of accelerated compute for the world Development tools for accelerated compute on GPUs and CPUs, built from the ground up ## Mojo🔥 + MAX unlock incredible NVIDIA GPU performance Mojo with MAX enables state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## See what AI developers are building with Mojo🔥 LLM.mojo A implementation of Andrej Karpathy's llm.c to Mojo 🔥 Basalt A machine learning framework in pure Mojo 🔥 Lightbug HTTP A HTTP web framework written in pure Mojo 🔥 Endia A dynamic Array library for Scientific Computing🔥 +300 more open source projects ## Developers love Mojo 🔥 “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck Mojo destroys Python in speed. 12x faster without even trying. The future is bright! mytechnotalent “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Unlock Python performance Utilize the full power of the hardware, including multiple cores, vector units, and exotic accelerator units, with the world's most advanced compiler and heterogenous runtime. Achieve performance on par with C++ and CUDA without the complexity. - PythonSingle Thread Distribution - Mojo🔥Parallel processing across multiple cores ### Python Single Thread Distribution ### Mojo🔥 Parallel processing across multiple cores ## Mojo enables systems programming features so you can process information exponentially faster. 0.03s 68,000x * Algorithm Mandelbrot Instance AWS C1.xlarge Intel Xeon Read our 68,000x blog post ## Access the entire Python ecosystem Experience true interoperability with the Python ecosystem. Seamlessly intermix arbitrary libraries like Numpy and Matplotlib and your custom code with Mojo. - - Mojo 🔥 Mojo 🔥 Python def make_plot(m: Matrix): plt = Python.import_module("matplotlib.pyplot") fig = plt.figure(1, [10, 10 * yn // xn], 64) ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], False, 1) plt.imshow(image) plt.show() make_plot(compute_mandelbrot()) ## Upgrade your models to full pipelines with MAX Easily extend your models with pre and post- processing operations, or replace operations with custom ones. Take advantage of kernel fusion, graph rewrites, shape functions, and more. ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View pricing Join the community - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/pricing PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # AI infrastructure for everyone We are, and will always be, developer first. 
Our license empowers everyone to build incredible AI. - FREE FOREVER MAX is available FREE for everyone to self-manage.What do I get with MAX? SoTA inference performance for LLMs, PyTorch, and ONNX models Run AI models and pipelines on any CPUs or GPUs Deploy MAX yourself on-prem or on any cloud provider Community support through Discord and Github MAX & Mojo Community LicenseDownload Now - SoTA inference performance for LLMs, PyTorch, and ONNX models - Run AI models and pipelines on any CPUs or GPUs - Deploy MAX yourself on-prem or on any cloud provider - Community support through Discord and Github - MAX & Mojo Community License - PAY AS YOU GO Support the largest deployments needed by your enterprise.What do I get with MAX Enterprise? SLA support with guaranteed response time. Dedicated Slack channel and account manager. Access to the world’s best AI engineering team. Prioritized feature requests and early access to our managed services AI platform. Enterprise LicenseContact Sales - SLA support with guaranteed response time. - Dedicated Slack channel and account manager. - Access to the world’s best AI engineering team. - Prioritized feature requests and early access to our managed services AI platform. - Enterprise License - Still have questions about MAX licenses?Talk to us FREE FOREVER MAX is available FREE for everyone to self-manage. What do I get with MAX? - SoTA inference performance for LLMs, PyTorch, and ONNX models - Run AI models and pipelines on any CPUs or GPUs - Deploy MAX yourself on-prem or on any cloud provider - Community support through Discord and Github - MAX & Mojo Community License SoTA inference performance for LLMs, PyTorch, and ONNX models Run AI models and pipelines on any CPUs or GPUs Deploy MAX yourself on-prem or on any cloud provider Community support through Discord and Github MAX & Mojo Community License PAY AS YOU GO Support the largest deployments needed by your enterprise. What do I get with MAX Enterprise? - SLA support with guaranteed response time. - Dedicated Slack channel and account manager. - Access to the world’s best AI engineering team. - Prioritized feature requests and early access to our managed services AI platform. - Enterprise License SLA support with guaranteed response time. Dedicated Slack channel and account manager. Access to the world’s best AI engineering team. Prioritized feature requests and early access to our managed services AI platform. Enterprise License Still have questions about MAX licenses? ## Frequently asked questions ## General What is MAX? MAX is a free and permissive AI inference framework that enables developers and enterprises to develop and deploy AI inference workloads on any hardware type, into any type of environment (including into production). You can read more about MAX here. What is Mojo? Mojo is a new programming language that has the expressiveness of Python, with the performance of C. Mojo is a member of the Python family and powers critical parts of our infrastructure. Mojo is completely optional to use, as MAX supports Python, C++ and other languages natively. You can read more about Mojo here. What is MAX Enterprise? MAX Enterprise is a cloud platform we are developing for enterprises who seek managed services and enterprise support from us for AI infrastructure. What kind of licenses are MAX and Mojo governed by? MAX and Mojo are governed by a modified Business Source License which we call the MAX & Mojo Community License. We have adopted this license to ensure that we provide maximum flexibility to the world to utilize our infrastructure while balancing our ability to commercialize our infrastructure for the long term. ‍ Modular open sources a lot of its technology, including the Mojo Standard Library, implementations of deep learning models like Llama 3 and more. This code is available on GitHub and it is licensed under Apache 2 with LLVM Exceptions, and includes contributions we receive from the community. These contributions are incorporated in MAX and Mojo and their usage and distribution (as part of MAX and Mojo) are covered by the broader MAX & Mojo Community License. We strongly believe in open-source software and are committed to continually opening our platform over time. Why did you choose these licenses for MAX and Mojo? For MAX and Mojo, we took the modified BSL approach because it allows enterprises, developers, and our rapidly expanding community to copy, modify and redistribute their applications under a wide range of conditions, including use in production. There are many other licenses like AGPL and SSPL that impose copyleft requirements and are problematic for many use cases. We believe our licensing approach strikes the right balance for both MAX and Mojo and only restricts use for a narrow range of use cases that are competitive with Modular’s business activities. ‍ For our Github repositories and open sourced code, along with contributions from our community - we strongly believe in the Apache 2 with LLVM Exceptions, as it provides legal protection to users and contributors of the software. We outline more thoughts in this blog post. What kinds of applications can I build under the MAX & Mojo Community License? You are free to build, extend and develop anything on top of MAX and Mojo, including products and services that you want to monetize or that you can derive an income from (i.e. content on YouTube, Twitch, etc.), and you can put them in production. You can even build products that are competitive to Modular, as long as you aren't commercializing them. We have a specific provision defined for what we deem a "Competitive Activity" that captures what you can’t do in our License. What is a Competitive Activity? To ensure that we can drive a commercial model for our business, we define a Competitive Activity as building a commercial, publicly available product or service whose primary purpose is to provide AI infrastructure services to third parties, or associated paid support for this purpose. ‍ Outside of this definition, you are free to build whatever you want with MAX and Mojo and integrate it into your products or services. For example, if you are building a startup whose primary purpose is AI code generation, or search, or health agents, you can use MAX and Mojo freely as part of your startup. Similarly, if you want to educate folks on YouTube on MAX and Mojo, you can do that freely relevant to our Trademark Policy. Conversely, if you want to build a startup whose primary purpose is to provide managed artificial intelligence services to third parties in a cloud hosted platform using MAX and Mojo for profit, its primary purpose overlaps our definition, and that would be deemed a Competitive Activity, which you cannot do without written permission. ‍ We have done this to ensure existing organizations whose commercial models serve the primary purpose of providing AI infrastructure services can’t simply take our infrastructure and offer it themselves without our permission. We are building MAX Enterprise for this purpose, and as the creators, only we can provide the world's best enterprise and developer support accordingly. If you’d like to discuss licensing or commercialization of MAX and Mojo in a way that seems competitive, please contact our Sales Team – we’re very friendly. What if Modular expands its products and services in the future? If you want to build software that is not competitive today, but becomes competitive in the future, the License protects you – it will not be considered competitive. You will be free to continue to develop, iterate and extend your application. How much do I have to pay to use MAX? MAX is free to utilize and deploy in research and production environments on your own infrastructure, as long as your use case is not a Competitive Activity. Can I host MAX myself for production? Yes, you are free to use MAX to build any production applications you want, including deploying MAX yourself, as long as your use case is not a Competitive Activity. Can I embed the MAX framework into software I distribute? Yes, just make sure your application is not a Competitive Activity and follows the terms of the License. Are there any scale limitations in the use of the MAX framework? No limitations, you may scale MAX to any workload and size you need for supported hardware. Will NVIDIA GPU support be licensed the same way? Yes, we aim to release MAX support for NVIDIA GPUs in fall 2024 and that will use the same approach as the current CPU support. Can I get enterprise support for the MAX? Yes, that is available under our MAX Enterprise version of MAX. You can learn more on our Enterprise page, or contact our Sales Team. Will MAX Enterprise offer managed cloud services? Yes, we are building a managed AI cloud platform for MAX Enterprise with early design partners for AI infrastructure services. Please Contact Sales if you are interested in becoming an early partner. What is the boundary between Mojo and MAX in terms of licensing? MAX and Mojo today are licensed under the same License as indicated above. You are free to use them to build anything you want, including in production, as long as you aren’t building something that is a Competitive Activity. Mojo is a very horizontal programming language and we’d love to see it used to build many use-cases that are not currently solved with other programming languages. Can I use Mojo in production environments? You are free to build, extend and develop anything with Mojo as long as it's not a Competitive Activity within the scope of our License. Why not package Mojo separately from MAX? We are open to distributing Mojo without MAX in the future, but today MAX is deeply coupled to Mojo and distributing them together as a single package allows us to move faster. We are already having trouble keeping up with community activity, and are optimizing our ability to move fast and build the world’s best platform for heterogeneous compute. We also want to learn and evolve with our community, and learn how Mojo is being utilized with MAX. Why will GPU support require MAX? Accelerators require runtime components and orchestration logic that falls into the domain of MAX, not Mojo. The best way to use Mojo with GPUs and other accelerated computing is inside the MAX Framework. The Graph APIs and other extensibility APIs allow you to run Mojo code directly on GPUs and other hardware. Will Mojo ever be fully open source? Yes. We remain strong believers in the importance of open-source software to accelerating innovation and are deeply committed to progressively make source code of Mojo fully available over time. What is the Apache 2 License with LLVM exceptions about? Modular open sources a lot of its technology, including the Mojo Standard Library, implementations of deep learning models like Llama 3 and more. This code is available on GitHub and it is licensed under Apache 2 with LLVM Exceptions, and includes contributions we receive from the community. ‍ We strongly believe in the Apache 2 with LLVM Exceptions, as it provides legal protection to users and contributors of the software, and we outline more thoughts in this blog post. All contributions are incorporated in MAX and Mojo and their usage and distribution (as part of MAX and Mojo) are covered by the broader MAX & Mojo Community License. ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - What is MAX? MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/take-control-of-your-ai PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 9, 2024 # Take control of your AI Modular Team In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. Today, enterprises are trying to adopt AI at an unprecedented pace — in fact, the latest research offered by Bain & Company suggests: ‍ While the benefits of AI are increasingly clear, a notable trend is also starting to emerge: enterprise teams are now assessing how to own and control their AI systems rather than relying on third-party providers like OpenAI. ### Bringing AI in-house As the race to deploy AI into enterprise exploded rapidly, many enterprises tried to adopt AI as fast as possible without considering the broader impacts to their organizations and the impact on their employees, products, and customers. Now, as enterprises see their AI efforts maturing, and with more proof of concepts (POCs) moving to production, they are increasingly asking what they need to do to scale AI inside their organizations. We regularly talk to enterprises about their AI needs, and here is a list of what enterprise customers tell us is important to them: #### Customization and flexibility Product and engineering teams need the ability to customize their AI deployments — ensuring insight into data processing methods, model formats, AI pipelines, training methods, model serving, production monitoring and more. This level of control and customization is unattainable with off-the-shelf, or with third-party AI solutions. Product and engineering teams must innovate without constraints, deploying AI and customizing the implementation for your organizational needs. #### Intellectual property protection You wouldn’t trust your most critical IP to a third party, and AI will increasingly become some of your most important IP. Over time, enterprise teams will create an increasing number of proprietary algorithms and approaches. By controlling enterprise AI, you can own and scale this important intellectual property, maintaining or growing your enterprise's competitive edge. #### Innovation and agility The ability to experiment, iterate, and adapt quickly is crucial for determining where AI can help your organization. Owning your AI systems ensures that you can foster an environment of continuous innovation, where organizational teams can explore new applications and rapidly respond to market changes. Third-party solutions can be short-lived, as they constrain innovation to third-party update cycles and schedules. Empowering your organization to own its AI enables your enterprise to drive innovation forward quickly. #### Resource allocation & cost efficiency While establishing in-house AI capabilities requires upfront investment, rapidly deploying AI across an enterprise is expensive. Third-party services often come with recurring fees and scaling costs that can escalate unpredictably — particularly on a token or context basis. Owning your AI future means that you can manage cost and scale AI within resource allocation and budgetary control standards. Escalating costs from a lack of control of your AI infrastructure systems often means months or years of challenges as you race to reduce your third-party AI dependency. #### Data privacy and security Safeguarding data privacy and security is paramount. AI systems thrive on vast datasets, often containing sensitive and proprietary information. By maintaining control over your AI infrastructure, your teams can implement robust security measures tailored to their unique needs. This control mitigates the risk of data breaches and unauthorized access — issues that can be magnified when outsourcing AI solutions. Ensuring that you control AI in-house allows your product and engineering teams to build a fortress around their data, ensuring its integrity and confidentiality. #### Compliance and regulatory alignment For enterprises in finance, healthcare, and telecommunications - there are real and stringent regulations governing data handling and processing. In these sectors, enterprise teams face the difficult challenge of ensuring AI systems not only scale correctly, but also comply with strict state and federal legal requirements. By owning your AI, you can directly implement and monitor compliance measures - reducing the risk of regulatory breaches and associated penalties. #### Data quality and bias mitigation AI systems are deeply reliant on data and its quality. Enterprises with control over their AI infrastructure have greater oversight of data preprocessing and cleaning procedures, ensuring high data integrity standards which improves AI model quality. Further, this enables active identification and mitigation of biases in AI models, delivering fairer and more accurate outcomes. The lack of transparency into third-party services, indicates that you do not have deep insight into what is actually being done with your data. #### Integration challenges Many enterprises operate within complex IT ecosystems that blend legacy systems, databases, and applications with modern code bases. A lack of control over AI workloads means its can be hard to scale AI into these environments. Controlling your AI deployment infrastructure enables you minimize integration challenges, building a more cohesive technology stack. #### Building internal expertise Without question, growing and scaling your AI talent ensures you can constantly scale with the latest AI breakthroughs. Building an AI-first enterprise requires deep investment in product and engineering teams and a commitment to developing expertise to scale AI systems. This will only make your organization more self-sufficient and resilient. All your teams must be AI teams, and fostering a strong internal culture of innovation and talent development ensures you can own your AI future. ### How does MAX help? At Modular, we have been at the forefront of building infrastructure that hands back ownership and control to enterprises seeking to own their AI future. As leaders in AI infrastructure who helped build the infrastructure that shaped today’s AI industry, we have taken a new approach to help developers and enterprises answer the critical question: What if deploying AI workloads into production was so simple you could do it yourself? That’s why we built MAX - the Modular Accelerated Xecution Platform. MAX gives you everything you need to deploy low-latency, high-throughput AI applications into production with minimal effort. More specifically, it provides the following: #### Industry standard protocols MAX works with the industry-standard APIs and protocols that have become ubiquitous with the mass adoption of Generative AI and LLMs, including the OpenAI’s completion and chat APIs. Importantly, this significantly reduces the cost of migrating your application code to your AI systems, giving you the flexibility to choose the best engine for your needs. #### Portable, performant model execution MAX provides a state-of-the-art AI compiler and runtime that optimizes the latency and throughput of popular open source AI models like Llama3-8B and Gemma2 across a wide range of AI hardware, from local laptops to common cloud instances. MAX enables you to seamlessly move the same model, without code changes, across a wide range of CPU architectures—Intel, AMD, ARM—and GPUs, allowing you to take advantage of the breadth and depth of different cloud instances at the best price, and always get the best inference cost-performance ratio across cloud environments. #### Compatible with what you already use For most organizations experimenting with GenAI and LLMs, this isn’t their first foray into AI. Many of them already have traditional AI models scaled in production. These organizations have been forced to split their infrastructure efforts, despite already having well established standard infrastructure. MAX standardizes this existing infrastructure and extends it to GenAI and LLMs, replacing the parts of the stack that matter most. MAX is compatible with all PyTorch and ONNX models, including object detection, recommenders, and much more. It integrates with industry standard technologies such as Triton Inference Server, Docker, Prometheus, and Grafana. #### Composable abstractions that allow for extensibility For Enterprises looking to get their hands dirty and adapt GenAI and LLMs to their needs, MAX provides clean, composable abstractions, including the Serve, Engine, Drive, Graph, and Extensibility APIs. These abstractions enable users to go beyond stock LLMs and build a moat for their business in areas of AI that have yet to become mainstream. #### Deploy to your own VPC or data center Finally, MAX is deployable into any cloud or on-prem environment. Enterprises maintain data sovereignty, privacy, and control over how their data is used and how their AI services are scaled. When they’re ready, users can adopt the Enterprise Edition and get world-class support from the team that scaled Google’s AI. ### MAX is free! Download now The decision for an enterprise to control its own AI is more than a strategic one — it's a call to action for the entire organization to become AI first. It signifies a commitment to data security, customization, and innovation. By taking charge of AI, enterprises empower their entire organization to craft sophisticated solutions that drive long-term success. This approach protects valuable data and intellectual property. It positions their team at the forefront of technological advancement—ready and able to drive innovation and seize the AI opportunities that lie ahead. By adopting MAX in your enterprise, you can drive this innovation across your entire organization, ensuring that you are in a position to control for your AI future. Learn more here, and contact us if you need help. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/blog PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Blog ## Featured 🚨 NEW 🔥 POPULAR Developer Deep dive into ownership in Mojo June 4, 2024 🚨 NEW 🔥 POPULAR Developer What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements June 17, 2024 ## Latest 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 🚨 NEW 🔥 POPULAR Engineering Debugging in Mojo🔥 July 16, 2024 🚨 NEW 🔥 POPULAR Product Bring your own PyTorch model July 9, 2024 🚨 NEW 🔥 POPULAR Product Take control of your AI July 9, 2024 🚨 NEW 🔥 POPULAR Product Develop locally, deploy globally July 9, 2024 🚨 NEW 🔥 POPULAR Developer A brief guide to the Mojo n-body example July 3, 2024 ## Popular Articles 🚨 NEW 🔥 POPULAR Engineering Debugging in Mojo🔥 July 16, 2024 🚨 NEW 🔥 POPULAR Product Develop locally, deploy globally July 9, 2024 🚨 NEW 🔥 POPULAR Developer A brief guide to the Mojo n-body example July 3, 2024 🚨 NEW 🔥 POPULAR Developer Deep dive into ownership in Mojo June 4, 2024 🚨 NEW 🔥 POPULAR Developer What ownership is really about: a mental model approach May 29, 2024 🚨 NEW 🔥 POPULAR Developer Fast⚡k-means clustering in Mojo🔥: a guide to porting Python to Mojo🔥 for accelerated k-means clustering May 20, 2024 ## For Developers 🚨 NEW 🔥 POPULAR Developer A brief guide to the Mojo n-body example July 3, 2024 🚨 NEW 🔥 POPULAR Developer What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support June 25, 2024 🚨 NEW 🔥 POPULAR Developer What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements June 17, 2024 🚨 NEW 🔥 POPULAR Developer Deep dive into ownership in Mojo June 4, 2024 🚨 NEW 🔥 POPULAR Developer What ownership is really about: a mental model approach May 29, 2024 🚨 NEW 🔥 POPULAR Developer Fast⚡k-means clustering in Mojo🔥: a guide to porting Python to Mojo🔥 for accelerated k-means clustering May 20, 2024 ## What’s new with MAX? 🚨 NEW 🔥 POPULAR Product Bring your own PyTorch model July 9, 2024 🚨 NEW 🔥 POPULAR Product Take control of your AI July 9, 2024 🚨 NEW 🔥 POPULAR Product Develop locally, deploy globally July 9, 2024 🚨 NEW 🔥 POPULAR Product MAX 24.4 - Introducing quantization APIs and MAX on macOS June 7, 2024 🚨 NEW 🔥 POPULAR Product MAX 24.3 - Introducing MAX Engine Extensibility May 2, 2024 🚨 NEW 🔥 POPULAR Product MAX 24.2 is Here! What’s New? March 28, 2024 ## Get started now - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/modverse PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Modverse Newsletter ## Latest Issues 🚨 NEW Modverse Weekly - Issue 41 August 16, 2024 🚨 NEW Modverse Weekly - Issue 40 August 1, 2024 ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team # All Modverse Issues (X) 🚨 NEW ### Modverse Weekly - Issue 41 The Mojo Community Meeting has been renamed to the MAX + Mojo Community Meeting. We explained how we combined Mojo and MAX, and updated the license for both to ensure you can be confident building free (and open source) technologies, as well as using Mojo and MAX for your own commercial projects. August 16, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 40 Last week we began alpha testing our new magic CLI for installing Mojo and MAX through the Conda ecosystem. It allows you to pin Mojo/MAX to different versions, and add Python dependencies so you can reliably share your Mojo and MAX projects. If you want to try it out before release, you can find the doc for installing it here. August 1, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 39 Check out the new section for nightly updates. If you're not keeping track on the #nightly Discord channel, you can catch up on everything new for the last week in this newsletter. July 9, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 38 The 24.4 release introduced GGUF support and quantisation for models such as Llama3 and many new features for Mojo. With that behind us Modular is now working hard towards the next release. To try out the new features press the Nightly tab on the MAX installation guide. There's an active community in the #nightly Discord channel to discuss the upcoming features with, and Modular staff are there to answer questions and respond to your feedback! June 28, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 37 We hosted the third Mojo Community Meeting this week, with great demonstrations from the community on constraints and the Mojo HTTP serving library lightbug. We also previewed our upcoming AI pipeline serving feature with llama3, using a GUI to interact with it. And ended by answering community questions on async, and when Python will be able to call Mojo. June 20, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 36 This week we released Mojo🔥 and MAX⚡️ 24.4, there is too much in the release to cover here! Check out the launch blog, the Mojo changelog, and the MAX changelog. June 7, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 35 This week we held the first ever Mojo community meeting! Many topics were discussed, including priorities, diving into specific features like async, and topics set on the agenda by the wider Mojo community. Next week we'll be hearing from community members about the awesome projects they've been working on. Make sure to add the next community meeting to your calendar. May 23, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 34 This week we launched MAX⚡️ nightlies with preview support for macOS and MAX Serving! You can now find details about how to install it on modul.ar/get-started, press the Nightly button on the install guide if you want to be on the bleeding edge. We look forward to your feedback, join the Discord and leave comments on the #nightly channel. May 17, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 33 This week we hosted a livestream with many good questions from the community. People were most interested in macOS support for MAX, and GPU support. These are both top priority at Modular so stay tuned! The standard library team were happy to announce that we've had 250 OSS contributions since open sourcing, we continue to be impressed and motivated by our active community! May 10, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 32 Yesterday marked Mojo🔥's first birthday 🎂, launching last year on May 2, 2023. We launched with just an online Jupyter environment and have since released the SDK locally for macOS and Linux on arm64 and x86, and bought up our inference and serving stack MAX⚡️. Yesterday we released Mojo and MAX 24.3 to mark the occasion, along with the first community contributions, 32 of which made it into the official changelog. We're so excited to go on this journey out in the open with our amazing community, thank you to everyone who has been participating! May 3, 2024 / Jack Clayton , - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/company/about PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Build AI for anyone, anywhere. ## Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. We believe that AI is a net positive force in the world and will help transform it for the better. Our vision and mission are to reinvent AI infrastructure to advance humanity. ### We aim to push the whole world of AI forward, not just a select few companies and products. After working for years at the world’s largest technology companies, scaling the world's largest AI work loads, building the hardware that powers them, and deploying AI to billions of mobile phones and edge devices, we saw that fragmentation and technical complexity held back the impact to a privileged few. We need to rethink the current AI systems and infrastructure from first principles to make it easy for anyone to leverage AI to solve the world’s most critical problems with software that just works. Modular and composable infrastructure that simplifies AI development and deployment is what the world needs. Together, as Modulers, we are a team of the world's best AI infrastructure leaders who are reinventing and rebuilding accelerated compute for everyone. ### How it started Chris Lattner and Tim Davis met at Google and felt AI was being held back by overly complex and fragmented infrastructure. Motivated by a desire to accelerate the impact of AI on the world by lifting the industry towards production-quality AI software, they founded Modular. Leadership team Chris Lattner Co-Founder & CEO Tim Davis Co-Founder & President Adin Scannell Cloud Infrastructure Lead Eric Johnson Product Lead Joe Pamer Mojo Distinguished Engineering Lead Kalor Lewis VP, Finance Mike Edwards Operations Lead Mostafa Hagog Performance & Compiler Engineering Lead Nick Kreeger Framework Engineering Lead ## Backed by the best investors in AI Our goal is as enormous as it is profound. We’re building a different kind of company to achieve this. We have assembled the best AI software and hardware leaders, and are systematically rebuilding the AI software stack from the ground up. 👋 We’re hiring! - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] Tim Davis Co-Founder & President Repeat Entrepreneur and Product Leader. Tim helped build, found and scale large parts of Google's AI infrastructure at Google Brain and Core Systems from APIs (TensorFlow), Compilers (XLA & MLIR) and runtimes for server (CPU/GPU/TPU) and TF Lite (Mobile/Micro/Web), Android ML & NNAPI, large model infrastructure & OSS for billions of users and devices. Loves running, building and scaling products to help people, and the world. [email protected] Adin Scannell Cloud Infrastructure Lead As a hands-on technical leader, Adin is passionate about building products and technologies that challenge the status quo. He previously co-founded GridCentric which was acquired by Google, where he worked on problems at scale for nine years across Google and Google Cloud. He has spent the last two decades solving problems across the infrastructure stack — from hypervisors and operating systems to containers and security. Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] Joe Pamer Mojo Distinguished Engineering Lead Joe spent the last 8 years at Meta, where he was focused on improving the company’s AI and developer infrastructure stacks. Before that he served as Instagram’s CTO, overseeing much of Meta’s work on programming languages (mainly focused on Python, PHP, and Javascript), and co-founded its first applied ML team for infrastructure. Before joining Facebook, he helped design and develop the F#, TypeScript, and Swift programming languages, and contributed to many other developer technologies, such as Clang, Visual Studio, and VS Code. Kalor Lewis VP, Finance Kalor is Modular's VP, Finance and leads all our Finance operations. Prior to Modular, Kalor was a VP, Finance at Fivetran where he was the first finance hire in 2018 and built out the companies entire finance function. Before Fivetran, Kalor was part of Palantir Technologies, where he scaled their strategic finance function. Mike Edwards Operations Lead Mike has spent over 25 years working in the fields of IT, corporate operations, and software development - most recently at Apple. Mike volunteers his time serving as a Board member with the LLVM Foundation, focusing on finance and operations. Mike truly believes in the power of AI to help address some of the world’s greatest needs. Mostafa Hagog Performance & Compiler Engineering Lead Mostafa is a seasoned engineering leader in high-performance computing. During his tenure at NVIDIA, he served as Engineering Director and led teams to develop optimized deep learning libraries like cuDNN and CUTLASS, revolutionizing GPU-accelerated AI. At SiFive, as VP of Software, Mostafa assumed a leadership role guiding teams in the development of an MLIR/LLVM-based software stack for SiFive Intelligence & performance cores. His contributions also extend to optimizing Intel GPU hardware/software features, playing a pivotal role in developing the AVX1/2 SIMD ISA for Intel CPUs, and contributing to the GNU C Compiler. Mostafa holds a Master of Science in Electrical Engineering from the Technion, with a specialization in compiler optimizations. His unwavering passion for innovation continues to drive advancements in the field of high-performance computing. Nick Kreeger Framework Engineering Lead Software Engineering lead with over 15 years of experience working at Google, Microsoft and a handful of startups. Nick has contributed to many technologies in Machine Learning such as TensorFlow.js, TensorFlow Lite/Micro, and ONNX/ONNXRuntime. Nick enjoys spending his free time with family and enjoying the Minnesotan outdoors. ================================================================================ URL: https://www.modular.com/company/culture PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # A great culture is the key to creating a great company. ## What we believe ### Build products users love ❤️ Customers first We build technology to lift the world by solving our customers' problems. We understand our users' problems and use cases and know there is sometimes a trade-off between "what is important" and "what is interesting" when building technology. We are clear that our customers always come first, and we always deliver on our promises. Build it right We build high-quality production software that displays technical mastery inside and out. We make our infrastructure the right way because we understand how quickly technical debt compounds. We know how faster engineering, product development, and business metrics move with a solid foundation. We build scalable, modular, and reliable systems that meet our customers' needs. Drive results When our customers and their people succeed, our company succeeds. No matter their role, every employee contributes to our collective success. Individually and together, we are all aligned on what we are working towards and how we can contribute. But we don't just work on auto-pilot. We expect everyone to regularly step back and ask if we're measuring the right input and output. We all win when we drive results that actually matter. ### Empower people 💪 Ownership We act on behalf of the entire organization and not just for ourselves and our local team. We operate on the assumption that each person is highly motivated and will drive their work with a bias towards action. We drive ownership by tracking progress toward our goals with clear expectations, responsible owners, and solid execution. We expect everyone to act like an owner, and once a decision is made, everyone will fully commit and move forward together. Transparency We are transparent by having decisions, calendars, directions, and plans open to everyone in the company. Anyone can constructively ask tough questions and feel safe to have answers provided directly. We expect people to be clear about what they know and open about what they don’t. We want everyone to feel that they can be vulnerable in front of each other and feel safe to take risks because this is how we grow and innovate. Hire the best, never stop learning We hire great people who seek to constantly grow themselves and others around them. Great people don’t settle; they have a thirst for knowledge and new skills, a desire for self-improvement, and actively seek feedback whenever they can. Great people develop great people; they take coaching others seriously and look to raise the standards of the whole organization. Have fun, live life We believe people do their best work when they are happy. Our goal is to ensure that you will always have the environment to achieve the right mix of family, compensation, growth, and mission to live a balanced and fulfilling life. By having fun and living your life, you also see more of the world, appreciate it, and learn how we can help improve it. ### Be an incredible team 🤝 Win together, fail together Changing the world is a team sport, and we need a group of incredibly talented people to be successful. Individual wins, or mistakes, matter less than everyone winning, failing, learning, and growing together. We expect everyone to listen, speak openly, and treat others with respect regardless of the wins or losses along the way. We foster a blameless culture for mistakes, and we expect our team to take risks without feeling insecure or embarrassed. The more we trust each other, the more we can lean on each other, and the more we can learn and grow together. Own inclusion, be diverse We build for everyone, and we are open to everyone. We believe that the best results come from a team that reflects the world at large. Our customers are diverse, and so are their needs, so we must empower and promote diversity and diverse perspectives at all company levels. We need to build diverse teams and foster diverse thinking to create products that genuinely help the world. Everyone has a voice We expect the best concept, design, plan, or direction to succeed regardless of someone’s “rank” in the company. Innovation exists everywhere, and great ideas are inside all of us. You can always reach out to anyone at any level in the company. We foster open communication and constructive debate and expect everyone to accept respectful challenges to their positions. We believe that the job of a leader is to find the right answer with their team, not to magically know everything themselves. Assume positive intent We expect everyone to assume the best of others. Our experiences have shown that information asymmetry almost always exists between people, and taking the time to understand circumstances via transparent communication is key to building healthy and functioning teams. We're all human and often jump to conclusions; we want people to assume good intentions when we do. 👋 We’re hiring! - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/company/careers PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Join us in building the future of AI Watch Video ## We want to enable AI to be used by anyone, anywhere. Our ambitions are enormous, but working here will feel very familiar. You can change the world without giving up your life ## Why Modular? Grow with the best Build with some of the industry's best AI leaders. Maximize how you work We will always push the limits to create the best possible environment for our people and teams. Read how we work. Build AI for the world Build a next-generation developer platform, with production quality infrastructure, for the world. Have fun, live life Regular team onsites, local meetups & fun, strong team collaboration and more. ## Work and life, balanced. 🩺 Leading medical, dental & vision packages 💵 Strong compensation & equity packages 🍼 Generous maternity & paternity leave 📈 401K Plan 🌎 Work wherever you want 🏝️ Unlimited Vacation & PTO 🥳 Corporate perks & epic team fun ## Current Job Openings Come and be part of a world-class team that is rebuilding AI for everyone. We welcome applications from all backgrounds and communities. Engineering (0) Text Location ## What you expect from the interview Modular has a straight-forward interview process and a large majority of the roles follow the same steps: Step 01 ### Application Review The first step of the process is to submit your resume. We aim to review all resumes within 2 weeks and we respond to every single application made. Step 02 ### Call with Recruiting Typically you will first have a short 20-30min call with recruiting to just go over some basic information about you and the company, and to discuss next steps. Step 03 ### Call with Hiring Manager The Hiring Manager will dig a bit deeper into your background and previous experience to determine mutual fit. This will also be your opportunity to learn more about what the team is working on and what the role entails. In case you have applied for more than one role on different teams, we often schedule you for two separate calls with two separate Hiring Managers. Step 04 ### Team Interviews There are typically 4 team interviews, usually 45-60 minutes each. These may be scheduled all at once or separately, depending on the role. The focus areas for these team interviews vary by role. For example, for Engineering roles, you can expect coding and system design type interviews; for Product roles, we often talk about the industry and product strategy. For Leadership roles, we may ask for a presentation.We believe that team culture is a critical part of a great company, so every candidate also has a Culture interview that focuses on communication skills, team work, and so on.  We will let you know what to expect in each interview when we send you a schedule confirmation. Step 05 ### Founder Interviews We aim to put all finalists in touch with at least one of our co-founders before a final decision. This would allow you as a candidate to speak directly to Chris and/or Tim, and get answers to any final important questions you may have. Step 06 ### Offer If we make you an offer, we share an extensive offer deck for you and schedule a walk-through call to go over the information in detail and again answer any final questions you may have. We also aim to give you enough time to make a decision after that. ## Why should you be excited about Modular? “I picked modular because of the people and what they believe in and what they want to do. I want to be a part of something that makes a difference for the better.” Paige Bedwell Program Manager “The team is incredible. They're very smart. They're experts in their field, and we're solving the hardest computational problems in the world.” Abdul Dakkak AI Compiler Engineer “The best part of working here is a strong commitment to culture. I work on the most challenging problems, have the freedom to do it anywhere, and have a huge impact on AI.” Eric Johnson Product Lead ## Frequently asked questions Are interviews conducted in-person? Typically of our interviews are conducted over Zoom video. For coding interviews, we use Coderpad and you will receive a link from your interviewer. In some cases we may fly you in to meet some of our leaders for the last interview. What do you look for in a candidate? There is no “one size fits all” answer here however Modulers are passionate about their work, intellectually curious, humble, and ready to roll up their sleeves. We like to have discussions in interviews and expect you to ask clarifying questions and talk us through your thought process — sometimes there is no right or wrong answer, we just want to understand how you think and work through challenging problems. We also look for strong alignment with Modular’s Culture and values. I don’t meet all of the requirements for a role, can I still be considered? We would love to receive your application even if it doesn’t meet all criteria! We review applications with all roles and opportunities in mind. Sometimes we may reach out to you to offer or suggest another role or team that might be a better fit for you, or we offer to keep your application on file and reach out a few months down the line once more suitable opportunities open up. How long does the interview process take? On average it takes candidates about 4 weeks to go through the full interview process however if you require a decision by a certain date, please speak to your recruiter. Do you offer internships? We want to ensure that our interns have an outstanding experience, which includes a well-defined project and goals, meaningful and impactful work, and strong and attentive mentorship. As we are still a small team, we are not ready to offer internships at this time but we will be sure to update the website as soon as it changes! Do you provide visa assistance? Yes, we offer premium processing for our H1-B transfer candidates. We can also sponsor H1-B or offer other relevant visa application assistance to eligible candidates. Do you provide Green Card assistance? Yes, we also offer Green Card application assistance to eligible candidates, just speak to your recruiter for more details. Do you provide relocation assistance? As we are a remote-first company, we generally do not relocate candidates except new graduates who are moving away from campus. If Modular asks you to relocate, we will also provide you with a relocation stipend. Are there any opportunities for professional development? Modular is growing rapidly so there are a variety of growth opportunities available — whether that’s moving into a TL role, management, or a lateral transfer to a different team. We provide our managers with training to walk you through your career planning, and we have a well-defined but lightweight performance review process that ensures your career goals are discussed at a regular cadence. I applied some time ago but haven’t heard back? We aim to respond to every single candidate, and if you have applied to more than one role, we process all of your applications separately. Sometimes these emails end up in spam, so please check your spam folder. If you haven’t heard from us, you can contact your recruiter or [email protected] to follow up. Will you provide feedback if I am rejected? We sincerely appreciate the time it takes to interview, so we always provide some feedback as to why your application did not work out if we have spoken to you. If you have not heard from us within 2 weeks after your last call, please follow up with your recruiter. What benefits do you offer? Modular offers some world-class benefits for all employees. Our benefit package changes over time, and may depend on your specific location, but US-based employees can expect benefits that include: - A variety of fantastic health benefits (health, dental, vision insurance; life insurance etc) are available. - A 401k plan with up to 5% match. - Access to Passport Corporate Discount Program, LinkedIn Learning, and free tax advice on Carta. - Generous work-from-home stipend of $1500 to help you improve your home office. - Unlimited paid time off and flexible work hours. Who we are - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/community PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: #  We're  building the future of AI together ## Resources to get you started! Build and learn together Get the code and contribute Read the docs Monthly newsletter Latest news and thoughts Blogs and tutorials Download MAX ## Over 300 open-source projects created by the community ### llama2.🔥 Inference forLlama2 models in a single file of Mojo ### Kamo🔥 A personal journey into learning about Kolmogorov–Arnold Networks using Mojo. ### Fire Physics Engine A 2D physics engine built in Mojo 🔥 ### Prism A budding CLI library +300 more open source projects ## Livestreams and Webinars on YouTube MAX Graph API Tutorial 1k Views . Streamed July 16, 2024 Getting started with MAX release and nightly builds 1.5K views . Streamed June 3, 2024 Speed up K-Means clustering by porting Python implementation to Mojo🔥 3k Views . Streamed May 30, 2024 Contributing to Open-Source Mojo🔥 Standard Library 1.1k views . Streamed May 14, 2024 Mojo🔥: a deep dive on ownership with Chris Lattner 33k views . Streamed May 13, 2024 MAX Graph API Tutorial 1k Views . Streamed July 16, 2024 Getting started with MAX release and nightly builds 1.5K views . Streamed June 3, 2024 ## Community open sessions Mojo🔥 Community Meeting #6 1.6k . Streamed August 14, 2024 Mojo 🔥 Community Meeting #5 2.5k views . Streamed July 29, 2024 Mojo 🔥 Community Meeting #4 1:3k views . Streamed July 22, 2024 Mojo Community Meeting #3 2.5k views . Streamed June 18, 2024 Mojo Community Meeting #2 2.2k views . Streamed June 7, 2024 Mojo Community Meeting #1 2.4k views . Streamed May 23, 2024 Mojo🔥 Community Meeting #6 1.6k . Streamed August 14, 2024 Mojo 🔥 Community Meeting #5 2.5k views . Streamed July 29, 2024 ## Join the Modverse 22K+ members 18k members 11k members 22k stars ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/company/contact PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Connect with our sales team Tell us what tools your organization is using and we can work together to see how best to incorporate MAX. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/bring-your-own-pytorch-model PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 9, 2024 # Bring your own PyTorch model Modular Team ‍ The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. PyTorch has become the top choice for researchers pushing the boundaries of AI, thanks to its blend of flexibility, Pythonic simplicity, and robust community support. Despite its popularity and success in research environments, PyTorch faces challenges in large-scale production deployments. What makes PyTorch excellent for development—like its Python eager mode—causes difficulties in production settings where resource management, latency targets, and reliability are critical. While research teams favor Python for its ease of use, deployment teams often use high-performance languages and libraries like C++ and CUDA to optimize models for latency, throughput, and cost efficiency. Despite efforts to optimize the PyTorch deployment processes (e.g., TorchScript), a universal method for deploying high-performance PyTorch models at scale remains elusive. Recently, developers have resorted to building point-solutions to deploy LLMs (that is, use-case-specific solutions such as TRT-LLM and vLLM), which further fragment the industry and increase complexity for everyone. ‍ This ongoing challenge underscores the complexities inherent in bridging the gap between research-driven AI development and robust, scalable AI deployment. But it also describes one of the core reasons we built MAX—the Modular Accelerated Xecution platform. Simply put, MAX provides the best way to deploy PyTorch into production. ### MAX unlocks the full power of PyTorch MAX provides inference API backed by a state-of-the-art compiler and inference runtime that works with a variety of models and hardware types, across local laptops and common cloud instances. Importantly, MAX doesn't require that you rewrite your PyTorch models—it meets you where you are now, using your existing model and existing code, with minimal changes to adopt our inference API (available in Python and C). Over time, you can incrementally add more MAX features for more performance, programmability, and portability. MAX provides the following benefits for PyTorch deployments: - Optimized performance: MAX provides advanced compiler and runtime optimizations that improve your resource efficiency and resource management. With only a few lines of code, MAX accelerates your models, reducing latency, improving user experience, and saving you valuable compute costs and resources. Relative to stock PyTorch, MAX runs PyTorch models up to 5x faster on CPU, depending on the specific workload and hardware. And GPUs are coming soon! - Full compatibility: MAX reduces fragmentation in your workflow, by meeting you where you are now, with your existing PyTorch models, tools, and libraries. We’ve taken away the complexity in converting your Python models to high-performance languages. Instead of using brittle model translators, MAX is compatible with the PyTorch and ONNX ecosystems, which means your models work out of the box. - Simple extensibility: MAX allows you to progressively upgrade your AI infrastructure over time, as you want to optimize the performance of your models. For even the most sophisticated AI engineers, performance-tuning AI pipelines is complicated because it involves advanced knowledge of system programming languages, AI hardware, and PyTorch itself. With MAX, you’re able to extend your models with custom operations (ops) written in Mojo—a new programming language that looks like Python and provides the performance of C. Importantly, custom ops written in Mojo are natively portable to any hardware that MAX supports and automatically fuse into the graph, ensuring peak performance. MAX brings your PyTorch models to their full potential and scales much further to meet the demands of GenAI as it continues to rapidly evolve. MAX seamlessly integrates with your existing PyTorch models, provides an unparalleled boost in performance and efficiency, and is easily customizable, so you can focus on what you do best — innovating and creating. ### How to use MAX with PyTorch As we mentioned earlier, there is no universal way to deploy PyTorch. As such, MAX provides a few different integration points with the PyTorch ecosystem. We detail each below. #### MAX Engine for TorchScript Models If you are using TorchScript, MAX Engine simplifies the process into three easy steps: load, compile, and execute. #### MAX Engine for ONNX Models Similarly, for ONNX models, the process is streamlined into load, compile, and execute steps. #### Torch.compile (coming soon!) And coming soon, we will also provide a MAX backend for PyTorch 2.x’s torch.compile API. Below is how we would optimize a Stable Diffusion model with MAX in this scenario. Whether you're using cutting-edge PyTorch features such as torch.compile, or staying with more traditional ways of serving your models, such as TorchScript and ONNX, MAX is the best way to deploy your PyTorch workloads. ### MAX is free! Download now By adopting MAX in your enterprise, you can take control over your PyTorch models. Join the growing community of developers who trust MAX for their model optimization needs. Don't let performance limitations hold you back. With MAX, you can elevate your PyTorch and ONNX models, delivering faster and more efficient results. Get started with MAX today and experience the difference! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/blog/develop-locally-deploy-globally PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 9, 2024 # Develop locally, deploy globally Modular Team The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. In particular, it remains nearly impossible to build streamlined and scalable development workflows that bridge the gap between local development and cloud deployment. These workflows are complicated because AI tooling is fragmented, with each tool presenting its own trade-offs and limitations. Today’s AI developers must leverage a multitude of different tools across their end-to-end AI workflows. Some tools work for cloud accelerators but are limited to local CPUs, while others excel for local CPU development but aren’t cloud-enabled. Working across these tools requires problematic abstractions and translators to unify fundamentally incompatible technologies, requiring rewriting of model or application code to make it all work together. Sometimes, it seems impossible to piece together the right combination of tools and hardware to support the full developer lifecycle and provide the best performance-to-cost trade-off for any given model. ## How MAX helps MAX solves these problems by providing a unified inference API backed by a state-of-the-art compiler and inference runtime that works with a variety of models and hardware types across local laptops and common cloud instances. MAX doesn't require you to migrate your entire AI pipeline and serving infrastructure to something new—it meets you where you are now and allows you to upgrade incrementally. MAX makes your pipeline portable across a wide range of CPU architectures—Intel, AMD, and ARM—and GPUs, opening up more portability and performance. MAX allows you to take advantage of the breadth and depth of different cloud instances at the best price, ensuring you always get the best inference cost-performance ratio. ### MAX unlocks local to cloud With MAX, you can develop AI applications locally and then easily package them for deployment to any cloud environment. This unified workflow offers several critical advantages: - Speed and Flexibility: Downloading MAX enables local development for rapid iteration and testing. Importantly, MAX doesn’t just run locally but is faster on many use cases than industry standard local LLM frameworks, like llama.cpp, making development even faster. You can quickly modify code, run experiments, and debug issues without the setup and latency associated with remote servers. - Resource Availability: On local machines, you have direct access to local hardware resources, such as CPU and GPUs, for free. Spinning up and paying for cloud instances is unnecessary and isn’t bottlenecked by availability. - Control and Customization: Local environments can be tailored to specific project needs, allowing developers to install custom libraries, frameworks, and tools without restrictions. Importantly, for latency-sensitive applications, fully controlled local development boxes provide less noise than shared cloud instances. - Consistency: Developing with MAX locally and bundling our infrastructure into OCI-compatible containers like Docker means you can ensure that what you build locally works seamlessly in production environments. - Global Scale: Finally, MAX is highly optimized for the AI hardware running in popular data center cloud providers like AWS, Azure, and GCP—including CPU and GPUs (coming soon!). Users can scale their AI applications globally with no code changes and state-of-the-art performance. ## How MAX works The industry lacks a unified AI infrastructure platform and is instead flush with “point solutions” that only work for specific models, hardware, and OS’s. When we began the effort to unify the world's AI infrastructure, we realized fragmentation in the stack was driven by a lack of a common programming model for AI hardware. That's why we created Mojo, a new unifying programming language for AI hardware that combines Python’s expressiveness with C’s performance. Mojo is the core technology that provides the foundation for the rest of the MAX platform. The MAX Engine, our next-generation graph compiler and runtime system, leverages Mojo to implement its low-level mathematical operations, such as MatMul. This provides unparalleled portability and performance and makes local-to-cloud workflows possible. You can load any model into MAX Engine and achieve low-latency inference on a wide range of hardware. All that said, you do not need to use Mojo to use MAX. You can bring your existing models to the framework and execute them with MAX Engine using our API libraries in Python and C. However, using Mojo with MAX gives you superpowers. Mojo allows you to write custom ops for your model or write a full inference graph for optimal performance in MAX Engine. Finally, integrating MAX as part of your AI development workflow makes it easy to deploy your locally developed models into production using trustworthy tools that include robust scaling, monitoring, and deployment templates. With MAX, you can serve your model using industry-compatible tools, including NVIDIA's Triton Server. Because we already interoperate with the tools you already use, we make it easy to drop MAX into your existing workflows that require model versioning, multi-model deployment, and support for various deployment environments, making it a versatile solution for AI inference deployment. Read about how easy this is right now! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/enterprise PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Accelerate AI innovation and scale globally. Run AI workloads more efficiently, and optimize your compute inside your enterprise. Power all your AI use cases on one stack. ### Fastest GPU Infrastructure Get out of the box performance for GenAI models on NVIDIA H100s and A100s. ### Unify your AI infrastructure stack Unify industry frameworks and hardware, streamlining your deployment workflows to any cloud or on-prem environment. ### Deploy and scale for FREE with MAX Package your pipelines once and deploy across CPUs and GPUs without having to change any code. ### Easiest way to optimize your existing models Drop in your PyTorch or ONNX models and get an instant boost in performance with our next generation inference runtime. - Deploy MAX inside your cloud environment - Supercharge the efficiency of your AI stack with just 3 lines of code. - Dedicated support from our world class AI infrastructure team. Deploy MAX inside your cloud environment Supercharge the efficiency of your AI stack with just 3 lines of code. Dedicated support from our world class AI infrastructure team. ## Talk to our Sales Team Tell us what tools your organization is using and we can work together to see how best to incorporate MAX. ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing Contact Sales - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/ai-resources PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: ## AI Resources AI resources provides a centralized hub for the latest and most relevant research papers on large language models (LLMs), Generative AI, machine learning (ML) systems, optimizations and compilers. These resources offer researchers, developers, and hackers easy access to the latest research. By distilling complex information into digestible summaries, AI resources help streamline the research process, enabling quicker implementation of new ideas and techniques into practical applications across the AI stack. Browse by category ## LLM Context Evaluations Read more ## High Performance Computing (HPC) Technical Primer Read more ## Ring Attention with Blockwise Transformers for Near-Infinite Context Read more ## Attention with Linear Biases Enables Input Length Extrapolation (ALiBi) Read more ## YaRN: Efficient Context Window Extension of Large Language Models Read more ## Gemini: A Family of Highly Capable Multimodal Models Read more ## Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context Read more ## Efficient Memory Management for LLM Serving with PagedAttention Read more ## MLIR: A Compiler Infrastructure for the End of Moore’s Law Read more ## RoBERTa: A Robustly Optimized BERT Pretraining Approach Read more ## Large Language Model Technical Primer Read more ## Contrastive Language-Image Pre-training (CLIP) Read more ## ML Compiler Technical Primer Read more ## AI & Memory Wall Read more ## Quantization Technical Primer Read more ## Mixtral of Experts Read more ## Llama 2 Read more ## Byte Pair Encoding (BPE) Read more ## FlashAttention Read more ## FlashAttention-2 Read more ## Mistral-7B Read more ## Phi-3-mini Read more ## Gemma: Open Models Based on Gemini Research and Technology Read more ## Grouped Query Attention Read more ## Rotary Position Embedding (RoPE) Read more - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/company/report-issue PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Report an Issue At Modular, we care deeply about safety, privacy, and security. If you have discovered a potential issue related to safety, privacy, or security, please fill out this form with the following details: - A summary of the observed and expected behaviors - Steps to reproduce - Details of the environment you are using A summary of the observed and expected behaviors Steps to reproduce Details of the environment you are using We truly appreciate your initiative to help improve our security. And note that at this time we cannot provide a personal response to each report. If you instead found an ordinary bug (not a safety/privacy/security issue), please instead report it here on GitHub. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/legal/terms PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Terms of Use Last Modified: July 18th, 2024 These Terms of Use (this “Agreement”), effective as of the date on which you check a box, click a button, download any Client-Side Software, or otherwise acknowledge your acceptance of this Agreement, is by and between Modular Inc. with offices located at 228 Hamilton Ave, Palo Alto, CA 94301, USA (“Modular”, “we”, or “us”) and you. This Agreement constitutes a binding contract between you and Modular, and your use of the Max Platform (as defined below) is at all times subject to the terms and conditions outlined in this Agreement. This Agreement incorporates by reference all other terms and policies governing your use of the Max Platform, including our MAX & Mojo Community License (https://www.modular.com/legal/max), Privacy Policy (https://www.modular.com/legal/privacy), Acceptable AI Use Policy (https://www.modular.com/legal/aup), Mojo Champions Policy (https://www.modular.com/legal/champions) as well as any other policies we may adopt from time to time, including terms for any contests or events we host or sponsor on the Max Platform. Capitalized terms used herein but not otherwise defined have the meanings set forth in the applicable supplemental terms. ##### 1. Definitions 1.1 - "Account" means the account you set up to access the Max Platform, and represents your legal and services relationship with Modular. 1.2 - "Affiliate" means an entity that controls, is controlled by, or is under common control with you. 1.3 - “Code” means any software code that you write, develop, or otherwise import for use on the Max Platform. 1.4 - “Client-Side Software” means any Modular software in source or object code form that Company makes available to Customer for use in connection with the Max Platform, including but not limited to any Modular SDKs. 1.5 - “Derivative Data” means data and information related to or derived from Users of the Max Platform that has been aggregated and/or anonymized by Modular, including any metrics, feedback, and ratings relating to any Code. 1.6 - “Developer” means a User who wrote or otherwise contributed to Code. 1.7 - “Harmful Code” means any software, hardware, or other technology, device, or means, including any virus, worm, malware, or other malicious computer code, the purpose or effect of which is to permit unauthorized access to, or to destroy, disrupt, disable, distort, or otherwise harm or impede in any manner any (i) computer, software, firmware, hardware, system, or network; or (ii) any application or function of any of the foregoing or the security, integrity, confidentiality, or use of any data processed thereby. 1.8 - “Max Platform” means Modular’s proprietary, hosted software platform you use to access your Account, all Client-Side Software, and other website functionality as made available to Users from time to time at www.modular.com (or a successor or sub-site). 1.9 - “Modular IP” means the Max Platform and any and all intellectual property provided to you or any other User in connection with the foregoing. For the avoidance of doubt, Modular IP includes Derivative Data, Usage Data, Documentation, and any information, data, or other content derived from Modular’s provision of the Max Platform but does not include User Generated Content. 1.10 - “Third-Party Products” means any third-party products provided with, integrated with, or incorporated into the Max Platform. 1.11 - “User,” “you,” and “your” refer to the individual person, company, or organization that has visited or is using the Max Platform; that accesses or uses any part of an Account; or that directs the use of the Account in the performance of its functions. A User must be at least 18 years of age. 1.12 - “User Generated Content” means information, data, and other content, in any form or medium, that is submitted, posted, or otherwise transmitted by a User through the Max Platform, including any Code; provided that, for purposes of clarity, User Generated Content as defined herein does not include Derivative Data. ##### 2. Account Registration and Requirements 2.1 - Registration. You must provide a valid email address and password in order to complete the Account signup process. Account registration and provisioning is at Modular’s sole discretion, and signing up for our waitlist does not guarantee that you will be eligible for account registration. 2.2 - Requirements. A) You must be a human to create an Account. Accounts registered by "bots" or other automated methods are not permitted. B) You must be age 18 or older. The Children’s Online Privacy Protection Act (“COPPA”) requires that online service providers obtain parental consent before they knowingly collect personally identifiable information online from children who are under thirteen (13). We do not knowingly collect or solicit personally identifiable information from children under thirteen (18). Users under the age of 18 are not permitted to use Modular. C) Modular does not target its Max Platform to children under 18, and we do not permit any Users under 18 on our Max Platform. If we learn of any User under the age of 18, we will terminate that User’s Account immediately. D) Your login may only be used by one person. You may not share your Account with others, and you may not use anyone else’s Account. 2.3 - Account Security. You are responsible for keeping your Account secure while you use the Max Platform. We offer tools to help you maintain your Account's security, but the content of your Account and its security are your responsibility. You are responsible for all content posted and activity that occurs under your Account (even when content is posted by others who have Accounts under your Account). You are responsible for maintaining the security of your Account and password. Modular cannot and will not be liable for any loss or damage from your failure to comply with this security obligation. You will promptly notify Modular if you become aware of any unauthorized use of, or access to, our Max Platform through your Account, including any unauthorized use of your password or Account. ##### 3. MAX Platform Access and Use. Subject to and conditioned on your compliance with the terms and conditions of this Agreement, Modular hereby grants you a right to access and use the Max Platform on a non-exclusive, non-transferable, and non-sublicensable basis. The foregoing includes a limited license for Customer to install and use the Client-Side Software in accordance with the MAX SDK("MAX") Community License Terms (https://www.modular.com/legal/max). 3.1 - Use Restrictions. You shall not use the Max Platform for any purposes beyond the scope of the access granted in this Agreement. You shall at all times comply with Modular’sAcceptable AI Use Policy (https://www.modular.com/legal/aup). 3.2 - Mojo-Specific Restrictions. If you use Mojo to write or develop any Code, you are strictly prohibited from deploying such Mojo-based Code to any Graphics Processing Units (GPUs), Tensor Processing Units (TPUs),or other specialized hardware. You agree that deployment of such Code shall be limited exclusively to Central Processing Unit (CPU) instances. Non-compliance may result in account suspension or termination of support without prior notice. Requests for exceptions to this restriction must be formally submitted to Modular in writing for approval (which Modular may withhold at its sole discretion). 3.3 - Reservation of Rights. Modular reserves all rights not expressly granted to you in this Agreement. Except for the limited rights and licenses expressly granted under this Agreement, nothing in this Agreement grants, by implication, waiver, estoppel, or otherwise, to you or any third party any intellectual property rights or other right, title, or interest in or to the Modular IP. 3.4 - Suspension. Notwithstanding anything to the contrary in this Agreement, Modular may temporarily suspend your Account and/or access to the Max Platform if: (i) Modular reasonably determines that(a) there is a threat or attack on any of the Modular IP; (b) your or another User’s use of the Modular IP disrupts or poses a security risk to the Modular IP or to any other User, customer, or vendor of Modular; (c) you are using theModular IP for fraudulent or illegal activities or in violation of theAcceptable AI Use Policy; (e) Modular’s provision of the Max Platform to you is prohibited by applicable law; or (f) any User Generated Content (including any Code) submitted, posted, or otherwise transmitted by you through the MaxPlatform may infringe or otherwise violate any third party’s intellectual property or other rights; (ii) any vendor of Modular has suspended or terminated Modular’s access to or use of any Third-Party Products required to enable up to access the Max Platform; or (iii) in accordance with a violation of any other term of this Agreement (each of (i), (ii), or (iii), a “ServiceSuspension”). Modular shall use commercially reasonable efforts to provide written notice of any Service Suspension to you and to provide updates regarding resumption of access to the Max Platform following any Service Suspension. Modular shall use commercially reasonable efforts to resume providing access to the Max Platform as soon as reasonably possible after the event giving rise to the Service Suspension is cured. Modular will have no liability for any damage, liabilities, losses (including any loss of data or profits), or any other consequences that you or any other User may incur as a result of a Service Suspension. 3.4 - Derivative Data. Notwithstanding anything to the contrary in this Agreement, Modular may monitor your use of the MAX Platform and collect and compile Derived Data. As between you and Modular, all right, title and interest in Derivative Data , and all intellectual property rights therein, belong to, and are retained solely by, Modular. You acknowledge that Modular may compile Derivative Data based on User Generated Content input into, and transmitted via, the MAX Platform. Not withstanding anything to the contrary in this Agreement, you further acknowledge that Modular may use and disclose Derivative Data for any lawful purpose. ##### 4. User Responsibilities. 4.1 - General. You are at all times responsible and liable for all uses of the Max Platform resulting from access from your Account, directly or indirectly, whether such access or use is permitted by or in violation of this Agreement. 4.2 - User Generated Content. You shall not upload to the Max Platform any User Generated Content that you do not have sufficient rights to upload. You hereby represent and warrant that you have sufficient rights to use any Code you upload to or otherwise use or incorporate as part of the Max Platform. You shall at all times abide by and comply with the Modular Acceptable AI Use Policy (https://www.modular.com/legal/aup). You hereby grant to Modular a non-exclusive, royalty-free, worldwide license to reproduce, distribute, and otherwise use and display your User Generated Content and perform all acts with respect to your User Generated Content as may be necessary for Modular to provide the Max Platform, and a non-exclusive, perpetual, irrevocable, royalty-free, worldwide license to reproduce, distribute, modify, and otherwise use and display your User Generated Content incorporated within the Derivative Data, and as otherwise necessary to provide you with Max Platform functionality. The foregoing includes, without limitation, the right for Modular to display email domains on the Max Platform associated with your Account to help you find other Users from your organization or with whom you may share other professional associations. 4.3 - Third-Party Products. Modular may from time to time make Third-Party Products available to you or may allow for certain Third-Party Products to be integrated with the Max Platform to allow for the transmission of Code or other User Generated Content from such Third-Party Products into the Max Platform (including, for example and without limitation, Github, AWS Code Commit, BitBucket, etc.). For purposes of this Agreement, such Third-Party Products are subject to their own terms and conditions. Modular is not responsible for the operation of any Third-Party Products and makes no representations or warranties of any kind with respect to Third-Party Products or their respective providers. If you do not agree to abide by the applicable terms for any such Third-Party Products, then you should not install or use such Third-Party Products. By authorizing Modular to transmit your User Generated Content from Third-Party Products into the Max Platform, you represent and warrant to Modular that you have all right, power, and authority to provide such authorization. 4.4 - User Controls and Responsibility. You have and will retain sole responsibility for: (i) all your own User Generated Content; (ii) your technology infrastructure and network and internet connection(s) from which you access the Max Platform; (iii) the security and use of your Account and associated credentials; and (iv) all access to and use of the Max Platform, including all results obtained from, and all conclusions, decisions, and actions based on, such access or use. ##### 5. Account Fees. You may access the Max Platform for free, or we may charge a fee for using the Max Platform (the “Paid Services”). 5.1 - Paid Platform Access. Certain aspects of features of the Max Platform may be subject to payments now or in the future (“Account Fees”). A) Payment Processor. We use a third-party payment processor (the “Payment Processor”) to bill you through a payment account linked to your Account on the Max Platform (your “Billing Account”) for any owed Account Fees. The processing of payments will be subject to the terms, conditions and privacy policies of the Payment Processor in addition to this Agreement. Currently, we use Stripe, Inc. as our Payment Processor. You can access Stripe’s Terms of Service at https://stripe.com/us/checkout/legal and their Privacy Policy at https://stripe.com/us/privacy. We are not responsible for any error by, or other acts or omissions of, the Payment Processor. By choosing to use our Paid Services, you agree to pay us, through the Payment Processor, all Account Fees then in effect for any use of such Paid Services in accordance with the applicable payment terms, and you authorize us, through the Payment Processor, to charge your chosen payment provider (your “Payment Method”). You agree to make payment using that selected Payment Method. We reserve the right to correct any errors or mistakes that the Payment Processor makes even if it has already requested or received payment. B) Payment Method. The terms of your payment will be based on your Payment Method and may be determined by agreements between you and the financial institution, credit card issuer or other provider of your chosen Payment Method. If we, through the Payment Processor, do not receive payment from you, you agree to pay all amounts due on your Billing Account upon demand. C) Recurring Billing. Some of the Paid Services may consist of an initial period, for which there is a one-time charge, followed by recurring period charges as agreed to by you. By choosing a recurring payment plan, you acknowledge that such Paid Services have an initial and recurring payment feature and you accept responsibility for all recurring charges prior to cancellation. WE MAY SUBMIT PERIODIC CHARGES (E.G., MONTHLY) WITHOUT FURTHER AUTHORIZATION FROM YOU, UNTIL YOU PROVIDE PRIOR NOTICE (RECEIPT OF WHICH IS CONFIRMED BY US) THAT YOU HAVE TERMINATED THIS AUTHORIZATION OR WISH TO CHANGE YOUR PAYMENT METHOD. SUCH NOTICE WILL NOT AFFECT CHARGES SUBMITTED BEFORE WE REASONABLY COULD ACT. TO TERMINATE YOUR AUTHORIZATION OR CHANGE YOUR PAYMENT METHOD, GO TO ACCOUNT SETTINGS (https://developer.modular.com). D) Current Information Required. YOU MUST PROVIDE CURRENT, COMPLETE AND ACCURATE INFORMATION FOR YOUR BILLING ACCOUNT. YOU MUST PROMPTLY UPDATE ALL INFORMATION TO KEEP YOUR BILLING ACCOUNT CURRENT, COMPLETE AND ACCURATE (SUCH AS A CHANGE IN BILLING ADDRESS, CREDIT CARD NUMBER, OR CREDIT CARD EXPIRATION DATE), AND YOU MUST PROMPTLY NOTIFY US OR OUR PAYMENT PROCESSOR IF YOUR PAYMENT METHOD IS CANCELED (E.G., FOR LOSS OR THEFT) OR IF YOU BECOME AWARE OF A POTENTIAL BREACH OF SECURITY, SUCH AS THE UNAUTHORIZED DISCLOSURE OR USE OF YOUR USER NAME OR PASSWORD. CHANGES TO SUCH INFORMATION CAN BE MADE AT ACCOUNT SETTINGS (https://developer.modular.com). IF YOU FAIL TO PROVIDE ANY OF THE FOREGOING INFORMATION, YOU AGREE THAT WE MAY CONTINUE CHARGING YOU FOR ANY USE OF PAID SERVICES UNDER YOUR BILLING ACCOUNT UNLESS YOU HAVE TERMINATED YOUR PAID SERVICES AS SET FORTH ABOVE. E) Change in Amount Authorized. If the amount to be charged to your Billing Account varies from the amount you preauthorized (other than due to the imposition or change in the amount of state sales taxes), you have the right to receive, and we shall provide, notice of the amount to be charged and the date of the charge before the scheduled date of the transaction. Any agreement you have with your payment provider will govern your use of your Payment Method. You agree that we may accumulate charges incurred and submit them as one or more aggregate charges during or at the end of each billing cycle. F) Reaffirmation of Authorization. Your non-termination or continued use of a Paid Service reaffirms that we are authorized to charge your Payment Method for that Paid Service. We may submit those charges for payment and you will be responsible for such charges. This does not waive our right to seek payment directly from you. Your charges may be payable in advance, in arrears, per usage, or as otherwise described when you initially selected to use the Paid Service. G) Free Trials and Other Promotions. Any free trial or other promotion that provides access to a Paid Service must be used within the specified time of the trial. You must stop using a Paid Service before the end of the trial period in order to avoid being charged for that Paid Service. If you cancel prior to the end of the trial period and are inadvertently charged for a Paid Service, please contact us at [email protected]. ##### 6. Confidentiality. 6.1 - Your Confidentiality Obligations. You agree that any non-public information we give you, such as information about a private beta offering or any information or materials made available on non-public portions of the Max Platform, is Modular’s confidential information, regardless of whether it is marked or identified as such (collectively, “Confidential Information”). You agree to only use such Confidential Information for the express purpose of testing and evaluating such beta products and not for any other purpose. You should use the same degree of care as you would with your own confidential information, but no less than reasonable precautions to prevent any unauthorized use, disclosure, publication, or dissemination of our Confidential Information. You promise not to disclose, publish, or disseminate any Confidential Information to any third party, unless we don’t otherwise prohibit or restrict such disclosure (for example, you might be part of a Modular-organized group discussion about a private beta feature). 6.2 - Exceptions. Confidential Information will not include information that is: (a) or becomes publicly available without breach of this Agreement through no act or inaction on your part (such as when a private beta feature becomes part of our publicly offered Max Platform); (b) known to you before we disclose it to you; (c) independently developed by you without breach of any confidentiality obligation to us or any third party; or (d) disclosed with permission from Modular. You will not violate the terms of this Agreement if you are required to disclose Confidential Information pursuant to operation of law, provided Modular has been given reasonable advance written notice to object, unless prohibited by law. ##### 7. Data Security and Processing of Personal Information. 7.1 - Security Measures. Modular will implement and maintain commercially reasonable administrative, physical, and technical safeguards designed to protect applicable User Generated Content from unauthorized access, use, alteration or disclosure. 7.2 - Processing of Personal Information; No Sensitive Data. Modular’s rights and obligations with respect to Personal Information that it collects directly from you are set forth in Modular’s Privacy Policy (https://www.modular.com/legal/privacy). ##### 8. Intellectual Property Ownership; Feedback. 8.1 -Modular IP. You acknowledge that, as between you and Modular, Modular owns all right, title, and interest, including all intellectual property rights, in and to the Modular IP and, with respect to Third-Party Products, the applicable third-party providers own all right, title, and interest, including all intellectual property rights, in and to the Third-Party Products. 8.2 - Your User Generated Content. Modular acknowledges that, as between you and Modular, you and your licensors (if any) retain all right, title, and interest, including all intellectual property rights, in and to User Generated Content. 8.3 - Feedback. If you sends us any communications or materials by mail, email, telephone, or otherwise, suggesting or recommending changes to the Modular IP, including without limitation, new features or functionality relating thereto, or any comments, questions, suggestions, or the like (“Feedback”), Modular is free to use such Feedback. ##### 9. Warranty Disclaimer. MODULAR AND ITS LICENSORS, SUPPLIERS, PARTNERS, PARENT, SUBSIDIARIES OR AFFILIATED ENTITIES, AND EACH OF THEIR RESPECTIVE OFFICERS, DIRECTORS, MEMBERS, EMPLOYEES, CONSULTANTS, CONTRACT EMPLOYEES, REPRESENTATIVES AND AGENTS, AND EACH OF THEIR RESPECTIVE SUCCESSORS AND ASSIGNS (MODULAR AND ALL SUCH PARTIES TOGETHER, THE “MODULAR PARTIES”) MAKE NO REPRESENTATIONS OR WARRANTIES CONCERNING THE MODULAR IP, AND THE MODULAR PARTIES WILL NOT BE RESPONSIBLE OR LIABLE FOR THE ACCURACY, AVAILABILITY, OCCURRENCE OF ERRORS, COPYRIGHT COMPLIANCE, LEGALITY, OR DECENCY OF MATERIAL CONTAINED IN OR ACCESSED THROUGH THE PLATFORM OR ANY CLAIMS, ACTIONS, SUITS PROCEDURES, COSTS, EXPENSES, DAMAGES OR LIABILITIES ARISING OUT OF USE OF, OR IN ANY WAY RELATED TO YOUR ACCESS OF THE PLATFORM OR USE OF ANY MODULAR IP. THE MODULAR PARTIES MAKE NO REPRESENTATIONS OR WARRANTIES REGARDING SUGGESTIONS OR RECOMMENDATIONS OFFERED THROUGH OR IN CONNECTION WITH YOUR USE OF THE PLATFORM. THE MODULAR IP IS PROVIDED BY MODULAR (AND ITS LICENSORS AND SUPPLIERS) ON AN “AS-IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR THAT USE OF THE MODULAR IP WILL BE UNINTERRUPTED OR ERROR-FREE. SOME STATES DO NOT ALLOW LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY LASTS, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU. ##### 10. Indemnification. You agree to indemnify and hold the Modular Parties harmless from and against any and all claims, liabilities, damages (actual and consequential), losses and expenses (including attorneys’ fees) arising from or in any way related to any claims relating to (a) your use of the Modular IP (including any actions taken by a third party using your Account), and (b) your violation or breach of any of the terms of this Agreement. In the event of such a claim, suit, or action (“Claim”), we will attempt to provide notice of the Claim to the contact information we have for your Account (provided that failure to deliver such notice shall not eliminate or reduce your indemnification obligations hereunder). ##### 11. Limitation of Liability TO THE FULLEST EXTENT ALLOWED BY APPLICABLE LAW, UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, TORT, CONTRACT, STRICT LIABILITY, OR OTHERWISE) SHALL ANY OF THE MODULAR PARTIES BE LIABLE TO YOU OR TO ANY OTHER PERSON FOR (A) ANY INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING DAMAGES FOR LOST PROFITS, BUSINESS INTERRUPTION, LOSS OF DATA, LOSS OF GOODWILL, WORK STOPPAGE, ACCURACY OF RESULTS, OR COMPUTER FAILURE OR MALFUNCTION, (B) ANY SUBSTITUTE GOODS, SERVICES OR TECHNOLOGY, (C) ANY AMOUNT, IN THE AGGREGATE, IN EXCESS OF THE GREATER OF (I) ONE-HUNDRED ($100) DOLLARS OR (II) THE AMOUNTS PAID AND/OR PAYABLE BY YOU TO MODULAR IN CONNECTION WITH THE ACCOUNT FEES FOR THE PLATFORM IN THE TWELVE (12) MONTH PERIOD PRECEDING THIS APPLICABLE CLAIM OR (D) ANY MATTER BEYOND OUR REASONABLE CONTROL. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL OR CERTAIN OTHER DAMAGES, SO THE ABOVE LIMITATION AND EXCLUSIONS MAY NOT APPLY TO YOU. ##### 12. General. 12.1 - Assignment. You may not assign, delegate or transfer this Agreement or your rights or obligations hereunder, or your Account, in any way (by operation of law or otherwise) without Modular’s prior written consent. We may transfer, assign, or delegate this Agreement and our rights and obligations without consent. 12.2 - Choice of Law. This Agreement are governed by and will be construed under the Federal Arbitration Act, applicable federal law, and the laws of the State of California, without regard to the conflicts of laws provisions thereof. 12.3 - Arbitration Agreement. Please read the following ARBITRATION AGREEMENT carefully because it requires you to arbitrate certain disputes and claims with Modular and limits the manner in which you can seek relief from Modular. Both you and Modular acknowledge and agree that for the purposes of any dispute arising out of or relating to the subject matter of this Agreement, Modular's officers, directors, employees and independent contractors (“Representatives”) are third-party beneficiaries of this Agreement, and that upon your acceptance of this Agreement, Representatives will have the right (and will be deemed to have accepted the right) to enforce this Agreement against you as the third-party beneficiary hereof. A) Arbitration Rules; Applicability of Arbitration Agreement. You and Modular shall use best efforts to settle any dispute, claim, question, or disagreement arising out of or relating to the subject matter of this Agreement directly through good-faith negotiations, which shall be a precondition to either party initiating arbitration. If such negotiations do not resolve the dispute, it shall be finally settled by binding arbitration in San Mateo County, California. The arbitration will proceed in the English language, in accordance with the JAMS Streamlined Arbitration Rules and Procedures (the “Rules”) then in effect, by one commercial arbitrator with substantial experience in resolving intellectual property and commercial contract disputes. The arbitrator shall be selected from the appropriate list of JAMS arbitrators in accordance with such Rules. Judgment upon the award rendered by such arbitrator may be entered in any court of competent jurisdiction. B) Costs of Arbitration. The Rules will govern payment of all arbitration fees. Modular will pay all arbitration fees for claims less than seventy-five thousand ($75,000) dollars. Modular will not seek its attorneys’ fees and costs in arbitration unless the arbitrator determines that your claim is frivolous. C) Waiver of Jury Trial. YOU AND MODULAR WAIVE ANY CONSTITUTIONAL AND STATUTORY RIGHTS TO GO TO COURT AND HAVE A TRIAL IN FRONT OF A JUDGE OR JURY. You and Modular are instead choosing to have claims and disputes resolved by arbitration. Arbitration procedures are typically more limited, more efficient, and less costly than rules applicable in court and are subject to very limited review by a court. In any litigation between you and Modular over whether to vacate or enforce an arbitration award, YOU AND MODULAR WAIVE ALL RIGHTS TO A JURY TRIAL, and elect instead to have the dispute be resolved by a judge. D) Waiver of Class or Consolidated Actions. ALL CLAIMS AND DISPUTES WITHIN THE SCOPE OF THIS ARBITRATION AGREEMENT MUST BE ARBITRATED OR LITIGATED ON AN INDIVIDUAL BASIS AND NOT ON A CLASS BASIS. CLAIMS OF MORE THAN ONE USER CANNOT BE ARBITRATED OR LITIGATED JOINTLY OR CONSOLIDATED WITH THOSE OF ANY OTHER USER. If however, this waiver of class or consolidated actions is deemed invalid or unenforceable, neither you nor Modular is entitled to arbitration; instead all claims and disputes will be resolved in a court. E) Opt-out. You have the right to opt out of the provisions of this Section by sending written notice of your decision to opt out to the following address: Modular, Inc., 228 Hamilton Ave, Palo Alto, CA 94301, USA, postmarked within thirty (30) days of first accepting this Agreement. You must include (i) your name and residence address, (ii) the email address and/or telephone number associated with your Account, and (iii) a clear statement that you want to opt out of this Agreement’s arbitration agreement. F) Exclusive Venue. If you send the opt-out notice in (e), and/or in any circumstances where the foregoing arbitration agreement permits either you or Modular to litigate any dispute arising out of or relating to the subject matter of this Agreement in court, then the foregoing arbitration agreement will not apply to either party, and both you and Modular agree that any judicial proceeding (other than small claims actions) will be brought in the state or federal courts located in, respectively, San Mateo County, California, or the federal district in which that county falls. G) Severability. If the prohibition against class actions and other claims brought on behalf of third parties contained above is found to be unenforceable, then all of the preceding language in this Arbitration Agreement section will be null and void. This arbitration agreement will survive the termination of your relationship with Modular. 12.4 - Miscellaneous. The failure of Modular to exercise, in any way, any right herein shall not be deemed a waiver of any further rights hereunder. If any provision of this Agreement is found to be unenforceable or invalid, that provision will be limited or eliminated, to the minimum extent necessary, so that this Agreement shall otherwise remain in full force and effect and enforceable. You and Modular agree that this Agreement is the complete and exclusive statement of the mutual understanding between you and Modular, and that the terms contained herein supersede and cancel all previous written and oral agreements, communications and other understandings relating to the subject matter of this Agreement. Except for changes by us as described here, no other amendment or modification of these Terms will be effective unless in writing and signed by both you and Modular. You hereby acknowledge and agree that you are not an employee, agent, partner, or joint venturer of Modular, and you do not have any authority of any kind to bind Modular in any respect whatsoever. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/legal/privacy PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Privacy Policy Last Updated: May 2nd, 2023 At Modular, we take your privacy seriously. Please read this Privacy Policy to learn how we treat your personal data. By using or accessing our Platform (as defined in the Terms) or our website, (collectively the “Services”) in any manner, you acknowledge that you accept the practices and policies outlined below, and you hereby consent that we will collect, use and share your information as described in this Privacy Policy. Remember that your use of Modular's Services is at all times subject to our Terms of Use (https://www.modular.com/terms)(collectively the “Terms”). The Terms incorporate this Privacy Policy by reference. Any terms we use in this Privacy Policy without defining them have the definitions given to them in the Terms. We’re constantly trying to improve our Services, so we may need to change this Privacy Policy from time to time, but we will alert you to any such changes by placing a notice on the Modular website, by sending you an email and/or by some other means. Please note that if you’ve opted not to receive legal notice emails from us (or you haven’t provided us with your email address), those legal notices will still govern your use of the Services, and you are still responsible for reading and understanding them. If you use the Services after any changes to the Privacy Policy have been posted, that means you agree to all of the changes. Use of information we collect is subject to the Privacy Policy in effect at the time such information is collected.You may print a copy of this Privacy Policy by clicking print.‍ ##### What this Privacy Policy Covers This Privacy Policy covers how we treat Personal Data that we gather when you access or use our Services. “Personal Data” means any information that identifies or relates to a particular individual and also includes information referred to as “personally identifiable information” or “personal information” under applicable data privacy laws, rules or regulations. This Privacy Policy does not cover the practices of companies we don’t own or control or people we don’t manage. If you are a User of the Platform, note that the “Professional and Employment Related Data” categories of Personal Data collected and shared pursuant to this Privacy Policy are applicable only to users of the website who apply for open job positions with us.‍ ### Personal Data ##### Categories of Personal Data We Collect This chart details the categories of Personal Data that we collect and have collected over the past 12 months: ##### Categories of Sources of Personal Data This chart details the categories of Personal Data that we collect and have collected over the past 12 months: We collect Personal Data about you from the following categories of sources: ###### 1. You - When you provide such information directly to us. - When you create an account or use our interactive tools and Services. When you voluntarily provide information in free-form text boxes through the Services or through responses to surveys or questionnaires. When you send us an email or otherwise contact us. - When you use the Services and such information is collected automatically. - Through Cookies (defined in the “Tracking Tools and Opt-Out” section below). If you use a location-enabled browser, we may receive information about your location. If you download and install certain applications and software we make available, we may receive and collect information transmitted from your computing device for the purpose of providing you the relevant Services, such as information regarding when you are logged on and available to receive updates or alert notices. ###### 2. Third Parties - Vendors - We may use analytics providers to analyze how you interact and engage with the Services, or third parties may help us provide you with customer support. We may use vendors to obtain information to generate leads and create user profiles. - Social Networks - If you provide your social network account credentials to us or otherwise sign in to the Services through a third-party site or service, some content and/or information in those accounts may be transmitted into your account with us. ##### Our Commercial or Business Purposes for Collecting or Disclosing Personal Data ###### 1. Providing, Customizing and Improving the Services - Creating and managing your account or other user profiles. - Processing orders or other transactions; billing. - Providing you with the products, services or information you request. - Meeting or fulfilling the reason you provided the information to us. - Providing support and assistance for the Services. - Improving the Services, including testing, research, internal analytics and product development. - Personalizing the Services, website content and communications based on your preferences. - Doing fraud protection, security and debugging. - Carrying out other business purposes stated when collecting your Personal Data or as otherwise set forth in applicable data privacy laws, such as the California Consumer Privacy Act, as amended by the California Privacy Rights Act of 2020 (the “CPRA”). ###### 2. Marketing the Services Marketing and selling the Services. ###### 3. Corresponding with You Responding to correspondence that we receive from you, contacting you when necessary or requested, and sending you information about Modular or the Services. Sending emails and other communications according to your preferences or that display content that we think will interest you. ###### 4. Meeting Legal Requirements and Enforcing Legal Terms Fulfilling our legal obligations under applicable law, regulation, court order or other legal process, such as preventing, detecting and investigating security incidents and potentially illegal or prohibited activities. Protecting the rights, property or safety of you, Modular or another party. Enforcing any agreements with you. Responding to claims that any posting or other content violates third-party rights. Resolving disputes. We will not collect additional categories of Personal Data or use the Personal Data we collected for materially different, unrelated or incompatible purposes without providing you notice.‍ ##### How We Share or Disclose Your Personal Data We disclose your Personal Data to the categories of service providers and other parties listed in this section. Depending on state laws that may be applicable to you, some of these disclosures may constitute a “sale” of your Personal Data. For more information, please refer to the state-specific sections below. - Service Providers. These parties help us provide the Services or perform business functions on our behalf. They include: Hosting, technology and communication providers. Security and fraud prevention consultants. Payment processors. - Analytics Partners. These parties provide analytics on web traffic or usage of the Services. They include companies that track how users found or were referred to the Services. Companies that track how users interact with the Services. - Advertising Partners. - Parties You Authorize, Access or Authenticate Third parties you access through the services. Social media services. Other users. ###### Legal Obligations We may share any Personal Data that we collect with third parties in conjunction with any of the activities set forth under “Meeting Legal Requirements and Enforcing Legal Terms” in the “Our Commercial or Business Purposes for Collecting Personal Data” section above. ###### Business Transfers All of your Personal Data that we collect may be transferred to a third party if we undergo a merger, acquisition, bankruptcy or other transaction in which that third party assumes control of our business (in whole or in part). Should one of these events occur, we will make reasonable efforts to notify you before your information becomes subject to different privacy and security policies and practices. ###### Data that is Not Personal Data We may create aggregated, de-identified or anonymized data from the Personal Data we collect, including by removing information that makes the data personally identifiable to a particular user. We may use such aggregated, de-identified or anonymized data and share it with third parties for our lawful business purposes, including to analyze, build and improve the Services and promote our business, provided that we will not share such data in a manner that could identify you.  ##### Tracking Tools and Opt-Out The Services use cookies and similar technologies such as pixel tags, web beacons, clear GIFs and JavaScript (collectively, “Cookies”) to enable our servers to recognize your web browser, tell us how and when you visit and use our Services, analyze trends, learn about our user base and operate and improve our Services. Cookies are small pieces of data– usually text files – placed on your computer, tablet, phone or similar device when you use that device to access our Services. We may also supplement the information we collect from you with information received from third parties, including third parties that have placed their own Cookies on your device(s). Please note that because of our use of Cookies, the Services do not support “Do Not Track” requests sent from a browser at this time. We use the following types of Cookies: - Essential Cookies. Essential Cookies are required for providing you with features or services that you have requested. For example, certain Cookies enable you to log into secure areas of our Services. Disabling these Cookies may make certain features and services unavailable. - Functional Cookies. Functional Cookies are used to record your choices and settings regarding our Services, maintain your preferences over time and recognize you when you return to our Services. These Cookies help us to personalize our content for you, greet you by name and remember your preferences (for example, your choice of language or region). - Performance/Analytical Cookies. Performance/Analytical Cookies allow us to understand how visitors use our Services. They do this by collecting information about the number of visitors to the Services, what pages visitors view on our Services and how long visitors are viewing pages on the Services. Performance/Analytical Cookies also help us measure the performance of our advertising campaigns in order to help us improve our campaigns and the Services’ content for those who engage with our advertising. For example, Google LLC (“Google”) uses cookies in connection with its Google Analytics services. Google’s ability to use and share information collected by Google Analytics about your visits to the Services is subject to the Google Analytics Terms of Service and the Google Privacy Policy. You have the option to opt-out of Google’s use of Cookies by visiting the Google advertising opt-out page at www.google.com/privacy_ads.html or the Google Analytics Opt-out Browser Add-on at https://tools.google.com/dlpage/gaoptout/. - Retargeting/Advertising Cookies. Retargeting/Advertising Cookies collect data about your online activity and identify your interests so that we can provide advertising that we believe is relevant to you. You can decide whether or not to accept Cookies through your internet browser’s settings. Most browsers have an option for turning off the Cookie feature, which will prevent your browser from accepting new Cookies, as well as (depending on the sophistication of your browser software) allow you to decide on acceptance of each new Cookie in a variety of ways. You can also delete all Cookies that are already on your device. If you do this, however, you may have to manually adjust some preferences every time you visit our website and some of the Services and functionalities may not work. To explore what Cookie settings are available to you or to modify your Cookies preferences, look in the “preferences” or “options” section of your browser’s menu. To find out more information about Cookies, including information about how to manage and delete Cookies, please visit http://www.allaboutcookies.org/ or https://ico.org.uk/for-the-public/online/cookies/ if you are located in the European Union. ##### Data Security We seek to protect your Personal Data from unauthorized access, use and disclosure using appropriate physical, technical, organizational and administrative security measures based on the type of Personal Data and how we are processing that data. You should also help protect your data by appropriately selecting and protecting your password and/or other sign-on mechanism; limiting access to your computer or device and browser; and signing off after you have finished accessing your account. Although we work to protect the security of your account and other data that we hold in our records, please be aware that no method of transmitting data over the internet or storing data is completely secure. ##### Data Retention We retain Personal Data about you for as long as you have an open account with us or as otherwise necessary to provide you with our Services or to perform our business or commercial purposes for collecting your Personal Data. When establishing a retention period for specific categories of data, we consider who we collected the data from, our need for the Personal Data, why we collected the Personal Data, and the sensitivity of the Personal Data. In some cases we retain Personal Data for longer, if doing so is necessary to comply with our legal obligations, resolve disputes or collect fees owed, or is otherwise permitted or required by applicable law, rule or regulation. We may further retain information in an anonymous or aggregated form where that information would not identify you personally. ##### Personal Data of Children As noted in the Terms of Use, we do not knowingly collect or solicit Personal Data about children under 18 years of age; if you are a child under the age of 18, please do not attempt to register for or otherwise use the Services or send us any Personal Data. If we learn we have collected Personal Data from a child under 18 years of age, we will delete that information as quickly as possible. If you believe that a child under 18 years of age may have provided Personal Data to us, please contact us at [email protected]. ##### State Resident Rights ###### California If you are a California resident, you have the rights set forth in this section. Please see the “Exercising Your Rights” section below for instructions regarding how to exercise these rights. Please note that we may process Personal Data of our customers’ end users or employees in connection with our provision of certain services to our customers. If we are processing your Personal Data as a service provider, you should contact the entity that collected your Personal Data in the first instance to address your rights with respect to such data. If there are any conflicts between this section and any other provision of this Privacy Policy and you are a California resident, the portion that is more protective of Personal Data shall control to the extent of such conflict. If you have any questions about this section or whether any of the following rights apply to you, please contact us at [email protected]. ###### Access You have the right to request certain information about our collection and use of your Personal Data over the past 12 months. In response, we will provide you with the following information: - The categories of Personal Data that we have collected about you. - The categories of sources from which that Personal Data was collected. - The business or commercial purpose for collecting or selling your Personal Data. - The categories of third parties with whom we have shared your Personal Data. - The specific pieces of Personal Data that we have collected about you. If we have disclosed your Personal Data to any third parties for a business purpose over the past 12 months, we will identify the categories of Personal Data shared with each category of third party recipient. If we have sold your Personal Data over the past 12 months, we will identify the categories of Personal Data sold to each category of third party recipient. ###### Deletion You have the right to request that we delete the Personal Data that we have collected about you. Under the CPRA, this right is subject to certain exceptions: for example, we may need to retain your Personal Data to provide you with the Services or complete a transaction or other action you have requested, or deletion may require disproportional effort. If your deletion request is subject to one of these exceptions, we may deny your deletion request. ###### Correction You have the right to request that we correct any inaccurate Personal Data we have collected about you. Under the CPRA, this right is subject to certain exceptions: for example, if we decide, based on the totality of circumstances related to your Personal Data, that such data is correct. If your correction request is subject to one of these exceptions, we may deny your request. ###### Exercising Your Rights To exercise the rights described above, you or your Authorized Agent (defined below) must send us a request that (1) provides sufficient information to allow us to verify that you are the person about whom we have collected Personal Data, and (2) describes your request in sufficient detail to allow us to understand, evaluate and respond to it. Each request that meets both of these criteria will be considered a “Valid Request.” We may not respond to requests that do not meet these criteria. We will only use Personal Data provided in a Valid Request to verify your identity and complete your request. You do not need an account to submit a Valid Request. We will work to respond to your Valid Request within 45 days of receipt. We will not charge you a fee for making a Valid Request unless your Valid Request(s) is excessive, repetitive or manifestly unfounded. If we determine that your Valid Request warrants a fee, we will notify you of the fee and explain that decision before completing your request. You may submit a Valid Request using the following methods: - Email us at: [email protected] - Submit a form at this address: https://www.modular.com/contact/us You may also authorize an agent (an “Authorized Agent”) to exercise your rights on your behalf. To do this, you must provide your Authorized Agent with written permission to exercise your rights on your behalf, and we may request a copy of this written permission from your Authorized Agent when they make a request on your behalf. ###### Personal Data Sales Opt-Out and Opt-In We will not sell your Personal Data, and have not done so over the last 12 months. To our knowledge, we do not sell the Personal Data of minors under 18 years of age. We Will Not Discriminate Against You for Exercising Your Rights Under the CPRA We will not discriminate against you for exercising your rights under the CPRA. We will not deny you our services, charge you different prices or rates, or provide you a lower quality of goods and services if you exercise your rights under the CPRA. However, we may offer different tiers of our Services as allowed by applicable data privacy laws (including the CPRA) with varying prices, rates or levels of quality of the goods or services you receive related to the value of Personal Data that we receive from you. Under California Civil Code Sections 1798.83-1798.84, California residents are entitled to contact us to prevent disclosure of Personal Data to third parties for such third parties’ direct marketing purposes; in order to submit such a request, please contact us at [email protected]. However, we do not sell your Personal Data or have plans to do so. ###### Nevada Resident Rights If you are a resident of Nevada, you have the right to opt-out of the sale of certain Personal Data to third parties who intend to license or sell that Personal Data. You can exercise this right by contacting us at [email protected] with the subject line “Nevada Do Not Sell Request” and providing us with your name and the email address associated with your account. However, we do not sell your Personal Data nor have plans to do so. ###### Virginia Resident Rights If you are a Virginia resident, you have the rights set forth under the Virginia Consumer Data Protection Act (“VCDPA”). Please see the “Exercising Your Rights” section below for instructions regarding how to exercise these rights. Please note that we may process Personal Data of our customers’ end users or employees in connection with our provision of certain services to our customers. If we are processing your Personal Data as a service provider, you should contact the entity that collected your Personal Data in the first instance to address your rights with respect to such data. Additionally, please note that these rights are subject to certain conditions and exceptions under applicable law, which may permit or require us to deny your request. If there are any conflicts between this section and any other provision of this Privacy Policy and you are a Virginia resident, the portion that is more protective of Personal Data shall control to the extent of such conflict. If you have any questions about this section or whether any of the following rights apply to you, please contact us at [email protected]. ###### Access You have the right to request confirmation of whether or not we are processing your Personal Data and to access your Personal Data. ###### Correction You have the right to correct inaccuracies in your Personal Data, to the extent such correction is appropriate in consideration of the nature of such data and our purposes of processing your Personal Data. ###### Portability You have the right to request a copy of your Personal Data in a machine-readable format, to the extent technically feasible. ##### European Union and United Kingdom Data Subject Rights ###### EU and UK Residents If you are a resident of the European Union (“EU”), United Kingdom (“UK”), Lichtenstein, Norway or Iceland, you may have additional rights under the EU or UK General Data Protection Regulation (the “GDPR”) with respect to your Personal Data, as outlined below.  For this section, we use the terms “Personal Data” and “processing” as they are defined in the GDPR, but “Personal Data” generally means information that can be used to individually identify a person, and “processing” generally covers actions that can be performed in connection with data such as collection, use, storage and disclosure. Modular will be the controller of your Personal Data processed in connection with the Services. If there are any conflicts between this this section and any other provision of this Privacy Policy, the policy or portion that is more protective of Personal Data shall control to the extent of such conflict. If you have any questions about this section or whether any of the following applies to you, please contact us at [email protected]. ###### Personal Data We Collect The “Categories of Personal Data We Collect” section above details the Personal Data that we collect from you. ###### Personal Data Use and Processing Grounds The “Our Commercial or Business Purposes for Collecting Personal Data” section above explains how we use your Personal Data. We will only process your Personal Data if we have a lawful basis for doing so. Lawful bases for processing include consent, contractual necessity and our “legitimate interests” or the legitimate interest of others, as further described below. - Contractual Necessity:  We process the following categories of Personal Data as a matter of “contractual necessity”, meaning that we need to process the data to perform under our Terms of Use with you, which enables us to provide you with the Services. When we process data due to contractual necessity, failure to provide such Personal Data will result in your inability to use some or all portions of the Services that require such data. - Profile or contact data - Payment Data - Legitimate Interest:  We process the following categories of Personal Data when we believe it furthers the legitimate interest of us or third parties Device data, Web analytics data, Geolocation Data, Professional Data, We may also de-identify or anonymize Personal Data to further our legitimate interests. Examples of these legitimate interests include (as described in more detail above): - Providing, customizing and improving the Services. - Marketing the Services. - Corresponding with you. - Meeting legal requirements and enforcing legal terms. - Completing corporate transactions. - Consent:  In some cases, we process Personal Data based on the consent you expressly grant to us at the time we collect such data. When we process Personal Data based on your consent, it will be expressly indicated to you at the point and time of collection. - Other Processing Grounds:  From time to time we may also need to process Personal Data to comply with a legal obligation, if it is necessary to protect the vital interests of you or other data subjects, or if it is necessary for a task carried out in the public interest. ###### Sharing Personal Data The “How We Share Your Personal Data” section above details how we share your Personal Data with third parties. ###### EU Data Subject Rights You have certain rights with respect to your Personal Data, including those set forth below. For more information about these rights, or to submit a request, please email us at [email protected]. Please note that in some circumstances, we may not be able to fully comply with your request, such as if it is frivolous or extremely impractical, if it jeopardizes the rights of others, or if it is not required by law, but in those circumstances, we will still respond to notify you of such a decision. In some cases, we may also need you to provide us with additional information, which may include Personal Data, if necessary to verify your identity and the nature of your request.  - Access:  You can request more information about the Personal Data we hold about you and request a copy of such Personal Data. You can also access certain of your Personal Data by logging into your account. - Rectification:  If you believe that any Personal Data we are holding about you is incorrect or incomplete, you can request that we correct or supplement such data. You can also correct some of this information directly by logging on to your account. - Erasure:  You can request that we erase some or all of your Personal Data from our systems.  - Withdrawal of Consent:  If we are processing your Personal Data based on your consent (as indicated at the time of collection of such data), you have the right to withdraw your consent at any time. Please note, however, that if you exercise this right, you may have to then provide express consent on a case-by-case basis for the use or disclosure of certain of your Personal Data, if such use or disclosure is necessary to enable you to utilize some or all of our Services. - Portability:  You can ask for a copy of your Personal Data in a machine-readable format. You can also request that we transmit the data to another controller where technically feasible. - Objection:  You can contact us to let us know that you object to the further use or disclosure of your Personal Data for certain purposes, such as for direct marketing purposes. - Restriction of Processing:  You can ask us to restrict further processing of your Personal Data. - Right to File Complaint:  You have the right to lodge a complaint about Modular's practices with respect to your Personal Data with the supervisory authority of your country or EU Member State. A list of Supervisory Authorities is available here: https://edpb.europa.eu/about-edpb/board/members_en. ###### Transfers of Personal Data The Services are hosted and operated in the United States (“U.S.”) through Modular and its service providers, and if you do not reside in the U.S., laws in the U.S. may differ from the laws where you reside. By using the Services, you acknowledge that any Personal Data about you, regardless of whether provided by you or obtained from a third party, is being provided to Modular in the U.S. and will be hosted on U.S. servers, and you authorize Modular to transfer, store and process your information to and in the U.S., and possibly other countries. You hereby consent to the transfer of your data to the U.S. pursuant to EU-U.S. Privacy Shield Frameworks, respectively, the details of which are further set forth below. While the Privacy Shield is no longer a valid basis on which Modular may rely to transfer Personal Data from the EU to the U.S. pursuant to the GDPR, Modular continues to comply with the EU-U.S. Privacy Shield Framework as set forth by the U.S. Department of Commerce regarding the collection, use and retention of Personal Data from EU member countries transferred to the U.S. pursuant to Privacy Shield. Modular has certified that it adheres to the Privacy Shield Principles with respect to such data. If there is any conflict between the policies in this Privacy Policy and data subject rights under the Privacy Shield Principles, the Privacy Shield Principles shall govern. To learn more about the Privacy Shield program, and to view our certification page, please visit https://www.privacyshield.gov/. Modular will transfer Personal Data from the EU to the U.S. pursuant to GDPR adhering to the model clauses. In certain situations, we may be required to disclose Personal Data in response to lawful requests by public authorities, including to meet national security or law enforcement requirements. ##### Changes to this Privacy Policy ###### Contact Information: If you have any questions or comments about this Privacy Policy, the ways in which we collect and use your Personal Data or your choices and rights regarding such collection and use, please do not hesitate to contact us at: - www.modular.com - [email protected] - www.modular.com/contact ‍ - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/legal/aup PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Acceptable AI Use Policy Last Modified: Feb 29th, 2024 This Acceptable AI Use Policy (this “Policy”) forms part of both Modular’s Terms of Use (https://modular.com/legal/terms), and governs User use of the Max Platform. This Policy outlines certain restricted activities in which Users may not engage while using the Max Platform. Modular reserves the right to issue warnings, suspend, and/or terminate User Accounts for any suspected or actual violation(s) of or failure(s) to comply with the guidelines set forth in this Policy. Modular remains committed to building a community where Users can safely interact with and build on top of our Max Platform in meaningful, honest, and productive ways. This Policy is in place to ensure both User safety and end-user of User-Generated Content and Application safety, while ensuring responsible use of the Max Platform. Users are reminded that generative artificial intelligence tools and models are capable of producing factually inaccurate, harmful, or biased information. Modular’s goal is to make responsible artificial products available on a platform that emphasizes responsible use of artificial tools for a variety of use cases. This Policy is designed with those principles in mind. ##### 1. Compliance with Laws and Regulations Users shall use the Max Platform in compliance with all applicable laws, regulations, and all of the guidelines set forth herein. ##### 2. Intellectual Property, Authenticity, and Private Information We do not allow content or activity on the Max Platform that: - attempts to reverse engineer, scrape, or otherwise utilize the Max Platform for any competitive purposes, including but not limited to discovering Modular IP that constitutes Confidential Information for use in a competitive product; - infringes any intellectual property, privacy, or proprietary right of any party, including patent, trademark, trade secret, copyright, right of publicity, personal information or other rights; - unlawfully shares unauthorized product licensing keys, software for generating unauthorized product licensing keys, or software for bypassing checks for product licensing keys, including extension of a free license beyond its trial period; or - impersonates any person or entity, including any of our employees or representatives, including through false association with Modular, or by fraudulently misrepresenting one’s identity or the Max Platform’s purpose. ##### 3. Spam, Fraudulent, Dishonest, Illegal, and Inauthentic Activity We do not allow User Generated Content, use of, or activity on the Max Platform that comprises of: - automated excessive bulk activity and coordinated inauthentic activity, such as - spamming - cryptocurrency mining; - bulk distribution of promotions and advertising; - inauthentic interactions, such as fake accounts and automated inauthentic activity; - creation of or participation in secondary markets for the purpose of the proliferation of inauthentic activity; - using the Max Platform for propagating abuse on other platforms; - phishing or attempted phishing; or - using the Max Platform for any form of excessive automated bulk activity, to place undue burden on our servers through automated means, or to relay any form of unsolicited advertising or solicitation through our servers, such as get-rich-quick schemes. Users may not use the Max Platform to: - Engage in any illegal activity; - Provide instructions on how to create or facilitate the exchange of illegal substances or goods; - Encourage or provide instructions on how to engage in or facilitate illegal services such as human trafficking or prostitution; - Design, market, help distribute or utilize weapons, explosives, dangerous materials or other systems designed to cause harm to or loss of human life; - Provide instructions on how to commit or facilitate any type of crime; - Gamble or bet on sports; - Engage in multi-level marketing or pyramid schemes; or - Plagiarize or engage in other forms of academic dishonesty. ##### 4. Site Access and Safety We do not allow content or activity on MAX Platform that: - directly supports unlawful active attack or malware campaigns that are causing technical harms, such as using the Max Platform to deliver malicious executables or as attack infrastructure, for example by organizing denial of Max Platform attacks or managing command and control servers, with no implicit or explicit dual-use purpose prior to the abuse occurring; or - uses our servers to disrupt or to attempt to disrupt, or to gain or to attempt to gain unauthorized access to, any platform, device, data, account or network. ##### 5. Platforms Usage Limits Users will not reproduce, duplicate, copy, sell, resell, scrape, re-use or exploit any portion of the Max Platform, use of the Max Platform, or access to the Max Platform without Modular’s express written permission. ##### 6. Information Usage Restrictions Users may not use information from the Max Platform (whether scraped, downloaded through our website, or obtained otherwise) for spamming purposes, including for the purposes of sending unsolicited emails to users or selling personal information, such as to recruiters, headhunters, and job boards. ##### 7. Advertising While we understand that Users may want to promote their respective User Generated Content by posting supporters' names or logos in its account, the primary focus of the User Generated Content posted to the Max Platform should not be advertising or promotional marketing. Users may include static images, links, and promotional text in the README documents or project description sections associated with its Account(s), but they must be related to the AI Algorithms Users and Developers are sharing on the Max Platform. Users may not advertise by posting monetized or excessive bulk content. Users may not promote or distribute content or activity that is illegal or otherwise prohibited by the applicable Terms of Use by which they are bound or this Policy, including excessive automated bulk activity (for example, spamming), get-rich-quick schemes, and misrepresentation or deception related to its promotion.If a User decide to post any promotional materials in its Account, User is solely responsible for complying with all applicable laws and regulations, including without limitation the U.S. Federal Trade Commission's Guidelines on Endorsements and Testimonials. Modular reserves the right to remove any promotional materials or advertisements that, in our sole discretion, violate any Modular terms. ##### 8. Prohibited Business Use Cases In addition to the above use cases, we prohibit businesses from using the Max Platform for any of the following: - Creating targeted campaigns to influence the outcome of elections or referendums; political advocacy or lobbying; - Searching for or gathering information on an individual or group in order to track, target or report on their identity, including using the product for facial recognition, covert tracking, or predictive policing; - Utilizing any SDK to assign scores or ratings to individuals based on an assessment of their trustworthiness or social behavior; - Eligibility for parole or sentencing decisions; - Making automated decisions about the employability of individuals or other employment determinations or decisions regarding eligibility for housing, including leases and home loans; - Except for the following permitted applications by U.S. law enforcement organizations: - Back office uses including call center support, document summarization, and accounting; - Analysis of data for the location of missing persons and other applications, provided that such applications do not otherwise violate or impair the liberty, civil liberties, or human rights of natural persons. ##### 9. Additional Requirements for Businesses If your business is using or deploying our tools and services as part of providing legal, medical, or financial advice to consumers, we require that you implement the additional safety measures listed below: - Human-in-the-loop: any content that is provided to your consumers must be reviewed by a qualified professional in that field prior to dissemination. Your business is responsible for the accuracy and appropriateness of that information.‍ - Disclosure: you must disclose to your end users or customers that you are using our services to help inform your decisions or recommendations ##### 10. Privacy Misuse of Personal Information is prohibited. Any person or entity collecting data from the Max Platform must comply with the Modular Privacy Policy (https://www.modular.com/legal/privacy). If a User collects any Personal Information from the Max Platform, that User agrees it will only use that Personal Information for the purpose for which the respective User to whom the Personal Information pertains has authorized its use. User agrees that it will reasonably secure any Personal Information it has gathered from the Platform, and User will respond promptly to complaints, removal requests, and "do not contact" requests from us or other Users (to the extent applicable). ##### 11. User Safety We do not allow conduct, Use Generated Content, activity, or use of the Max Platform that: - is unlawful or promotes unlawful activities; - is sexually obscene or relates to sexual exploitation or abuse, including of minors; - is libelous, defamatory, or fraudulent; - is discriminatory or abusive toward any individual or group; - is false, inaccurate, or intentionally deceptive information and likely to adversely affect the public interest (including health, safety, election integrity, and civic participation); - harasses or abuses another individual or group, including our employees, officers, and agents, or other Users; - threatens or incites violence toward any individual or group, especially on the basis of who they are; - gratuitously depicts or glorifies violence, including violent images; or - is off-topic, or interacts with Max Platform features in a way that significantly or repeatedly disrupts the experience of other Users. ##### 12. User Protection User must not engage in activity that significantly harms other Users. Modular will interpret policies and resolve disputes in favor of protecting Users as a whole. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/mojo-a-journey-to-68-000x-speedup-over-python-part-3 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: September 6, 2023 # Mojo🔥 - A journey to 68,000x speedup over Python - Part 3 Abdul Dakkak We started this blog post series to describe how to write Mojo🔥 for the Mandelbrot set to achieve over 35,000x speedup over Python. To recap the optimizations so far, in part 1 we ported the code into Mojo to get around a 90x speedup, and then, in part 2 we vectorized and parallelized the code to get a 26,000x. This blog post continues this journey to show another performance technique that takes well beyond our promised 35,000x speedup goal. ‍ Recall that our parallelism strategy in the previous blog post is that each CPU core gets an equal number of rows to process. Pictorially, the idea is that we can evaluate each set of rows independently and achieve speedup proportional to the number of cores. ‍ ### Load imbalance However, the animation in Figure 2 is deceiving. Partitioning the work so that each thread worker gets a set of rows is fine when the work is the same across the rows, but that’s not the case for the Mandelbrot set. Partitioning this way creates a load imbalance, since one pixel of the Mandelbrot set may finish after a single iteration and another pixel may use MAX_ITERS iterations. This means that the number of iterations per row is not equal, and therefore some threads will be sitting idle, because they finish the computation faster than other ones. To demonstrate the imbalance, we plot the total number of iterations each row performs within the Mandelbrot set. As shown in the figure below, some rows require less than 1000 iterations before they escape whereas others require over 800,000 iterations. If you partition in a way that each thread gets a sequential number of rows, what happens is that all threads will wait until the middle set of rows finishes (assigned to some core) before completion. There are multiple ways to alleviate this, but the easiest way is to over-partition. So, instead of each thread getting a set of rows divided equally amongst the cores, we have a work-pool and create a work item for each row. The threads pick items from the thread pool in round-robin fashion. Thankfully, Mojo includes a high-performance concurrent runtime, so we do not have to create a thread pool or do the round-robin picking and execution ourselves. Mojo’s runtime includes advanced features to fully utilize many-core systems like this one. fn compute_row(y:Int): let cy = min_y + h * scale_y @parameter fn compute_vector[simd_width:Int](w:Int): let cx = min_x + iota[DType.float64, simd_width]() * scale_x output.simd_store[simd_width](Index(h,w), mandelbrot_kernel(ComplexSIMD[DType.float64, simd_width](cx,cy)) vectorize[num_ports * simd_width, compute_vector](width) with Runtime(num_cores()) as rt: let partition_factor = 16 # Is autotuned. parallelize[compute_row](rt, height, partition_factor * num_cores()) ‍ We can evaluate the program as we over partition by 2, 4, 8, 16, and 32 factors. The results are shown below: ‍ Effectively, we get a 2.3x speedup over the parallel version and 78x speedup over the vectorized implementation. An acute reader will ask whether it’s advantageous to partition even further – within a row. The answer is “maybe” if the row-size is large, but in our case it is 4096. Furthermore, within a row, pixels tend to be more correlated. This is advantageous for SIMD, since it means that work is not wasted within a vector lane. ### Why are we getting more than 35,000x speedup? Why are we getting a 68,000x speedup instead of the advertised 35,000x speedup? In short, the benchmarking system is different. During launch, we evaluated on an AWS r7iz.metal-16xl 32-Core Intel Xeon Gold 6455B, but in this blog we evaluated on a GCP h3-standard-88 which uses an 88-Core Intel Xeon Platinum 8481C. The reason we do not use the r7iz.metal-16xl instance is because it is no longer available. But that said, we don’t mind exceeding expectations! A higher core count and faster clock speed generally improve Mandelbrot problem speedup, and this actually shows the benefit of Mojo. Computers are only getting faster and bigger – core count is only going to increase and so (to a lesser extent) will the clock frequency. In general, you can expect speedup to double over the sequential version when you double your core count, while increasing your clock speed will exacerbate the significance of interpretation overhead. Additionally, such hardware scaling does not require Mojo code to be changed. In fact, we did not optimize the program across the instance types, but we are still able to get a performance improvement. Another question is why “we are getting a 2x speedup over the r7iz instance and not a 2.7x?” The answer is that the problem size is too small to saturate the CPUs and we did not optimize for the h3-standard-88 instance. For example, hyper threading is beneficial in general for the Mandelbrot computation, but we were unable to enable hyper threading on the h3-standard-88 instance type. ### Performance recap To summarize the optimization journey in the first 3 blog posts. In the first blog we first started by just taking our Python code and running it in Mojo, added some type annotations to the Mojo code, and performed algebraic simplifications. In the second blog post, we vectorizing the code, evolved that to utilize multiple ports, and then made the sequential implementation parallel to exercise all the cores on the system. Finally, in this blog post, we used oversubscription to resolve the load imbalance due to parallelism. During this journey we achieved 46x to 68,000x speedups over Python. As shown below. ‍ Again, it’s hard to read such massive speedups. So, to better show the differences in log scale: ‍ As shown below, our implementation achieves over 68,000x speedup over Python on this machine, and using oversubscription we are able to get 2x speedup over our previous parallel version. ### Conclusion In this blog post we explained the final optimization necessary to achieve the 35,000x claim made during launch. In the process, we accidentally overachieved and got a 68,000x speedup! Throughout these blog posts, we showed that Mojo affords you great performance while being portable and easy to reason about. Performance does not come for free, however, and thus one has to be cognizant of the underlying hardware and algorithms to be able to achieve it. We employ the same principles when developing high performance numeric kernels for the Modular AI Engine. If you are interested in making algorithms fast and driving state-of-the-art AI infrastructure from the ground up, please consider joining Modular’s exceptional team by applying to our Kernel engineer role or other other roles available on our careers page. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Abdul Dakkak AI Compiler Engineer Expert in machine learning, compilers, programming languages, and accelerated computing. Before Modular, Abdul led the development of AI compilers for GPUs at Microsoft Research and the Mathematica Compiler at Wolfram Research. Abdul has developed open-source tools for accelerating real-world applications to optimize their performance across the hardware and software stack. ================================================================================ URL: https://www.modular.com/legal/max-mojo-license PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # MAX & Mojo Community License The FAQ that accompanies this License is available on our Pricing page and plays an important part in providing guidance to our enterprises, developers and community. We view the guidance in our FAQ as binding, so users of our software should feel assured in relying on the answers provided there. Last Modified: August 28th, 2024 These MAX Community License Terms (these "Terms") are entered into by and between Modular, Inc. ("Modular") and the individual or entity agreeing to these terms ("Licensee"), and form part of Modular’s Terms of Use. Capitalized terms used herein but not otherwise defined have the meanings set forth in the Terms of Use. By clicking the "Agree" button or by downloading, installing, copying, or otherwise using any software development kits made available by Modular as part of the Max Platform (each, the "SDK"), or otherwise developing software using Modular’s Mojo programming language, Licensee agrees to be bound by these Terms. If Licensee does not agree to these Terms, Licensee should not proceed with the download, installation, or use of the applicable SDK. If Licensee is an individual downloading the SDK on behalf of an entity or organization, Licensee represents and warrants that it has the requisite authority to bind that entity (and any applicable Affiliates) to these Terms. ##### 1. SDK AND DOCUMENTATION LICENSE GRANT Subject to Licensee’s compliance with these Terms, Modular hereby grants Licensee a non-exclusive, non-transferable license to use the SDK and accompanying Documentation (as defined below), as made available at https://docs.modular.com, solely for use in developed software applications ("Applications") that meet the Usage and Distribution Requirements specified in this Agreement. This license does not grant Licensee the right to distribute the SDK or any part thereof to third parties, except as expressly stated otherwise herein. For the avoidance of doubt, Licensee may under no circumstances redistribute the SDK itself outside of any Applications. Nothing herein shall be construed as a grant of a license or any other rights with respect to Modular’s trademarks, logos, or other branding for Mojo or any other Modular offerings (collectively, the “Marks”). Licensee shall seek prior written consent for the use of the Marks in connection with its use of the SDK, and agrees and acknowledges that Modular is under no obligation to grant any such requests. ##### 2. MAX RESTRICTIONS AND USAGE Licensee shall not: (a) modify, adapt, translate, reverse engineer, decompile, or disassemble the SDK or any part thereof, or otherwise attempt to derive or gain access to SDK source code; (b) remove, alter, or obscure any proprietary notices, labels, or marks from the SDK; (c) use the SDK in an Application or standalone, or otherwise develop an Application in Mojo, for any Competitive Activity; or (d) use the SDK in any manner that violates any applicable laws, the Distribution Requirements, regulations, third-party rights, or other Modular terms or agreements by which Licensee is bound. Licensee acknowledges and understands that its use of the SDK may be subject to the collection of certain telemetry, usage, and other data which captures Licensee’s interactions with and use of the SDK (collectively, the “Usage Data”).“Competitive Activity” means making commercially, publicly available software-as-a-service, platform-as-a-service, infrastructure-as-a-service, support services, or similar online or offline managed, cloud services for the primary purposes of providing artificial intelligence platform infrastructure to third parties without explicit written permission. For clarity, artificial intelligence platform infrastructure encapsulates: (i) data processing, transformation, and querying services for artificial intelligence, (ii) artificial intelligence training or artificial intelligence inference services, (iii) hosting and/or compute services for the above, and (iv) data center services and/or similarly situated services offering MAX in connection with a broader service offering to third parties.For the avoidance of doubt, this provision will not apply “ex-post-facto” (“after the fact”) to any software you develop that is not competitive at the time you develop it, but later on becomes competitive to Modular based on Modular’s new product offerings or pivots resulting in an expanded definition of Competitive Activity. Development of any internal or personal use-only software is not a Competitive Activity. Please see our pricing page (https://www.modular.com/pricing) for more information and examples on Competitive Activities. ##### 3. REDISTRIBUTABLE COMPONENTS & LIMITATIONS Modular hereby grants Licensee the limited right to redistribute certain components of the SDK as part of Licensee's Applications, subject to the conditions and limitations set forth in this clause, including the Distribution Requirements. The redistributable components of the SDK ("Redistributable Components") are specified in the accompanying SDK documentation or materials provided by Modular (the “Documentation”). Licensee shall only redistribute the Redistributable Components as expressly permitted in these Terms and in any Documentation, in accordance with the Distribution Requirements. “Distribution Requirements” means each of the following requirements: (a) The Application must have material additional functionality, beyond the included portions of the SDK;(b) The distributable portions of the SDK shall only be accessed by the Application;(c) The terms under which Licensee distributes an Application must be consistent with the terms of this Agreement, including (without limitation) terms relating to the license grant and license restrictions and protection of Modular’s intellectual property rights;(d) Licensee shall not redistribute the Redistributable Components as standalone components, libraries, or tools in any way that would enable third parties to violate the terms of this License;(e) Licensee shall not modify, reverse engineer, decompile, disassemble, or attempt to derive the source code of the Redistributable Components, except to the extent expressly permitted by applicable law;(f) Licensee shall include all proprietary notices, labels, and marks provided by Modular in the Documentation (or elsewhere) in connection with the Redistributable Components in all copies of Applications that incorporate the Redistributable Components;(g) The text of this Agreement shall be conspicuously displayed in each original or modified copy of the SDK; and(h) The Application must only be run on hardware expressly supported by MAX. If Licensee wishes to run the Application on custom hardware it is developing or has developed, Licensee must contact Modular with a written request to secure appropriate rights to do so. Modular reserves the right to approve or deny such requests in its sole discretion. Licensee agrees to notify Modular in writing of any known or suspected violation of the Distribution Requirements and to reasonably enforce the terms of its Application. If Licensee receives the SDK in original or modified form from any third party, Licensee agrees and accepts that the terms of this Agreement are still binding upon Licensee. ##### 4. OWNERSHIP & PERSONAL INFORMATION Modular and its applicable licensors retain all right, title, and interest in and to the SDK (including any Redistributable Components) and Documentation, including all intellectual property rights therein. Licensee acknowledges and agrees that, other than as explicitly stated herein, nothing in these Terms grants it any rights to or ownership interest in the SDK or Documentation. As between the parties, Licensee acknowledges that Modular owns all right, title, and interest in and to the Usage Data and may use or exploit it for any purpose it deems fit, including but not limited to the purposes of improving the SDK or any other component or aspect of the Max Platform. Any collection, storage, or use of Licensee personal information is governed by Modular’s Privacy Policy (https://www.modular.com/legal/privacy), which Licensee hereby acknowledges upon acceptance of these Terms. ##### 5. SUPPORT AND UPDATES Modular is not obligated to provide any support, patches, fixes or updates for the SDK. However, Modular may, at its sole discretion, provide updates, patches, fixes or support at any time. ##### 6. FEES The community license variant of the SDK is provided free of charge. Licensee acknowledges that Modular may at any time change its provision of its community variant of the SDK for free or generally. In the event Modular does the foregoing, it will make commercially reasonable efforts to provide Licensee of advanced notice of its plans to either change its provision of the SDK or offer the applicable, commercial variant of the SDK for a fee to the contact information provided by Licensee to Modular. ##### 7. WARRANTY DISCLAIMER THE SDK IS PROVIDED "AS IS" AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, MODULAR MAKES NO OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. LICENSEE ACKNOWLEDGES AND AGREES THAT THE USE OF THE SDK IS AT THEIR OWN RISK, AND MODULAR DOES NOT MAKE ANY REPRESENTATIONS OR WARRANTIES REGARDING THE ACCURACY, RELIABILITY, OR COMPLETENESS OF THE SDK, OR INFORMATION OBTAINED THROUGH THE SDK. MODULAR DOES NOT WARRANT OR GUARANTEE THAT THE SDK WILL MEET LICENSEE'S REQUIREMENTS OR EXPECTATIONS FOR ITS APPLICATIONS OR GENERALLY, OR THAT ANY ERRORS OR DEFECTS IN THE SDK WILL BE CORRECTED. FURTHERMORE, MODULAR DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE RESULTS THAT MAY BE OBTAINED FROM THE USE OF THE SDK OR THE SUITABILITY OF THE SDK FOR ANY PARTICULAR PURPOSE. MODULAR MAKES NO WARRANTIES OR REPRESENTATIONS THAT THE SDK WILL BE COMPATIBLE WITH LICENSEE'S SYSTEMS, SOFTWARE, OR APPLICATIONS, OR THAT THE SDK WILL BE SECURE FROM UNAUTHORIZED ACCESS, HACKING, OR OTHER POTENTIAL SECURITY THREATS. MODULAR DISCLAIMS ANY LIABILITY ARISING OUT OF OR IN CONNECTION WITH THE USE OF THE SDK. LICENSEE ASSUMES ALL RISKS AND RESPONSIBILITIES FOR USING THE SDK TO ACHIEVE THEIR INTENDED RESULTS AND FOR THE INSTALLATION, USE, AND RESULTS OBTAINED FROM THE SDK. ADDITIONALLY, VERSIONS OF THE SDK IDENTIFIED AS ‘PREVIEW VERSIONS’ MAY HAVE ADDITIONAL BUGS OR DESIGN FLAWS. MODULAR MAKES NO WARRANTIES ABOUT THE PREVIEW VERSIONS WHATSOEVER, AND LICENSEE’S USE OF THE SDK IN COMMERCIAL, PRODUCTION ENVIRONMENTS IN VIOLATION OF THIS AGREEMENT IS AT ITS OWN RISK. ##### 8. INDEMNIFICATION Licensee shall defend, indemnify and hold harmless Modular, its affiliates and their respective officers, directors, employees, agents and representatives from any and all third party claims, damages, liabilities, costs and fees (including reasonable attorneys’ fees) arising from: (i) its material breach of these Terms; or (ii) an allegation that any Application violates, misappropriates, or infringes any third party intellectual, contractual or proprietary right. ##### 9. LIMITATION OF LIABILITY TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL MODULAR BE RESPONSIBLE OR LIABLE WITH RESPECT TO ANY SUBJECT MATTER OF THIS AGREEMENT UNDER ANY CONTRACT, NEGLIGENCE, STRICT LIABILITY OR OTHER THEORY FOR: (I) LOSS OR INACCURACY OF DATA OR COST OF PROCUREMENT OF SUBSTITUTE GOODS, SERVICES, OR TECHNOLOGY; OR (II) ANY INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO LOSS OF REVENUES OR PROFITS; (III) ANY MATTER BEYOND ITS REASONABLE CONTROL; OR (IV) ANY AMOUNT IN THE AGGREGATE OVER $100. SOME JURISDICTIONS DO NOT ALLOW CERTAIN WARRANTY DISCLAIMERS OR LIMITATIONS ON LIABILITY. ONLY DISCLAIMERS OR LIMITATIONS THAT ARE LAWFUL IN THE APPLICABLE JURISDICTION WILL APPLY TO YOU, AND MODULAR’S LIABILITY WILL BE LIMITED TO THE MAXIMUM EXTENT PERMITTED BY LAW. ##### 10. TERMINATION These Terms may be terminated if the Licensee wants to terminate this Agreement by stopping use of the SDK. Modular may terminate this License if the Licensee fails to comply with any term in this Agreement, or if the Licensee commences, or participates, in any legal proceed against Modular. Upon termination, Licensee shall immediately cease all use of the SDK. These terms may be also discontinued by Modular if it decides to no longer provide any SDK, or if in Modular soles discretion, continued use is no longer commercially viable. Modular will attempt to provide written notice of termination to Licensee either through a posting on its website, or via the contact method for Licensee it has available. Upon any termination of this License all provisions survive except for the license grant provisions. ##### 11. EXPORT CONTROL Licensee shall comply with, and shall, at Modular’s request, demonstrate compliance with all applicable export laws, restrictions, and regulations of any United States or foreign agency or authority. Licensee shall not export or re-export, or allow the export or re-export of any product, technology or information it obtains pursuant to these Terms (including but not limited to the SDK) in violation of any such laws, embargoes, restrictions or regulations. Licensee shall obtain and bear all expenses relating to any licenses and/or exemptions required to comply with foregoing. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/legal/max PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # MAX & Mojo Community License The FAQ that accompanies this License is available on our Pricing page and plays an important part in providing guidance to our enterprises, developers and community. We view the guidance in our FAQ as binding, so users of our software should feel assured in relying on the answers provided there. Last Modified: August 28th, 2024 These MAX Community License Terms (these "Terms") are entered into by and between Modular, Inc. ("Modular") and the individual or entity agreeing to these terms ("Licensee"), and form part of Modular’s Terms of Use. Capitalized terms used herein but not otherwise defined have the meanings set forth in the Terms of Use. By clicking the "Agree" button or by downloading, installing, copying, or otherwise using any software development kits made available by Modular as part of the Max Platform (each, the "SDK"), or otherwise developing software using Modular’s Mojo programming language, Licensee agrees to be bound by these Terms. If Licensee does not agree to these Terms, Licensee should not proceed with the download, installation, or use of the applicable SDK. If Licensee is an individual downloading the SDK on behalf of an entity or organization, Licensee represents and warrants that it has the requisite authority to bind that entity (and any applicable Affiliates) to these Terms. ##### 1. SDK AND DOCUMENTATION LICENSE GRANT Subject to Licensee’s compliance with these Terms, Modular hereby grants Licensee a non-exclusive, non-transferable license to use the SDK and accompanying Documentation (as defined below), as made available at https://docs.modular.com, solely for use in developed software applications ("Applications") that meet the Usage and Distribution Requirements specified in this Agreement. This license does not grant Licensee the right to distribute the SDK or any part thereof to third parties, except as expressly stated otherwise herein. For the avoidance of doubt, Licensee may under no circumstances redistribute the SDK itself outside of any Applications. Nothing herein shall be construed as a grant of a license or any other rights with respect to Modular’s trademarks, logos, or other branding for Mojo or any other Modular offerings (collectively, the “Marks”). Licensee shall seek prior written consent for the use of the Marks in connection with its use of the SDK, and agrees and acknowledges that Modular is under no obligation to grant any such requests. ##### 2. MAX RESTRICTIONS AND USAGE Licensee shall not: (a) modify, adapt, translate, reverse engineer, decompile, or disassemble the SDK or any part thereof, or otherwise attempt to derive or gain access to SDK source code; (b) remove, alter, or obscure any proprietary notices, labels, or marks from the SDK; (c) use the SDK in an Application or standalone, or otherwise develop an Application in Mojo, for any Competitive Activity; or (d) use the SDK in any manner that violates any applicable laws, the Distribution Requirements, regulations, third-party rights, or other Modular terms or agreements by which Licensee is bound. Licensee acknowledges and understands that its use of the SDK may be subject to the collection of certain telemetry, usage, and other data which captures Licensee’s interactions with and use of the SDK (collectively, the “Usage Data”).“Competitive Activity” means making commercially, publicly available software-as-a-service, platform-as-a-service, infrastructure-as-a-service, support services, or similar online or offline managed, cloud services for the primary purposes of providing artificial intelligence platform infrastructure to third parties without explicit written permission. For clarity, artificial intelligence platform infrastructure encapsulates: (i) data processing, transformation, and querying services for artificial intelligence, (ii) artificial intelligence training or artificial intelligence inference services, (iii) hosting and/or compute services for the above, and (iv) data center services and/or similarly situated services offering MAX in connection with a broader service offering to third parties.For the avoidance of doubt, this provision will not apply “ex-post-facto” (“after the fact”) to any software you develop that is not competitive at the time you develop it, but later on becomes competitive to Modular based on Modular’s new product offerings or pivots resulting in an expanded definition of Competitive Activity. Development of any internal or personal use-only software is not a Competitive Activity. Please see our pricing page (https://www.modular.com/pricing) for more information and examples on Competitive Activities. ##### 3. REDISTRIBUTABLE COMPONENTS & LIMITATIONS Modular hereby grants Licensee the limited right to redistribute certain components of the SDK as part of Licensee's Applications, subject to the conditions and limitations set forth in this clause, including the Distribution Requirements. The redistributable components of the SDK ("Redistributable Components") are specified in the accompanying SDK documentation or materials provided by Modular (the “Documentation”). Licensee shall only redistribute the Redistributable Components as expressly permitted in these Terms and in any Documentation, in accordance with the Distribution Requirements. “Distribution Requirements” means each of the following requirements: (a) The Application must have material additional functionality, beyond the included portions of the SDK;(b) The distributable portions of the SDK shall only be accessed by the Application;(c) The terms under which Licensee distributes an Application must be consistent with the terms of this Agreement, including (without limitation) terms relating to the license grant and license restrictions and protection of Modular’s intellectual property rights;(d) Licensee shall not redistribute the Redistributable Components as standalone components, libraries, or tools in any way that would enable third parties to violate the terms of this License;(e) Licensee shall not modify, reverse engineer, decompile, disassemble, or attempt to derive the source code of the Redistributable Components, except to the extent expressly permitted by applicable law;(f) Licensee shall include all proprietary notices, labels, and marks provided by Modular in the Documentation (or elsewhere) in connection with the Redistributable Components in all copies of Applications that incorporate the Redistributable Components;(g) The text of this Agreement shall be conspicuously displayed in each original or modified copy of the SDK; and(h) The Application must only be run on hardware expressly supported by MAX. If Licensee wishes to run the Application on custom hardware it is developing or has developed, Licensee must contact Modular with a written request to secure appropriate rights to do so. Modular reserves the right to approve or deny such requests in its sole discretion. Licensee agrees to notify Modular in writing of any known or suspected violation of the Distribution Requirements and to reasonably enforce the terms of its Application. If Licensee receives the SDK in original or modified form from any third party, Licensee agrees and accepts that the terms of this Agreement are still binding upon Licensee. ##### 4. OWNERSHIP & PERSONAL INFORMATION Modular and its applicable licensors retain all right, title, and interest in and to the SDK (including any Redistributable Components) and Documentation, including all intellectual property rights therein. Licensee acknowledges and agrees that, other than as explicitly stated herein, nothing in these Terms grants it any rights to or ownership interest in the SDK or Documentation. As between the parties, Licensee acknowledges that Modular owns all right, title, and interest in and to the Usage Data and may use or exploit it for any purpose it deems fit, including but not limited to the purposes of improving the SDK or any other component or aspect of the Max Platform. Any collection, storage, or use of Licensee personal information is governed by Modular’s Privacy Policy (https://www.modular.com/legal/privacy), which Licensee hereby acknowledges upon acceptance of these Terms. ##### 5. SUPPORT AND UPDATES Modular is not obligated to provide any support, patches, fixes or updates for the SDK. However, Modular may, at its sole discretion, provide updates, patches, fixes or support at any time. ##### 6. FEES The community license variant of the SDK is provided free of charge. Licensee acknowledges that Modular may at any time change its provision of its community variant of the SDK for free or generally. In the event Modular does the foregoing, it will make commercially reasonable efforts to provide Licensee of advanced notice of its plans to either change its provision of the SDK or offer the applicable, commercial variant of the SDK for a fee to the contact information provided by Licensee to Modular. ##### 7. WARRANTY DISCLAIMER THE SDK IS PROVIDED "AS IS" AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, MODULAR MAKES NO OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. LICENSEE ACKNOWLEDGES AND AGREES THAT THE USE OF THE SDK IS AT THEIR OWN RISK, AND MODULAR DOES NOT MAKE ANY REPRESENTATIONS OR WARRANTIES REGARDING THE ACCURACY, RELIABILITY, OR COMPLETENESS OF THE SDK, OR INFORMATION OBTAINED THROUGH THE SDK. MODULAR DOES NOT WARRANT OR GUARANTEE THAT THE SDK WILL MEET LICENSEE'S REQUIREMENTS OR EXPECTATIONS FOR ITS APPLICATIONS OR GENERALLY, OR THAT ANY ERRORS OR DEFECTS IN THE SDK WILL BE CORRECTED. FURTHERMORE, MODULAR DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE RESULTS THAT MAY BE OBTAINED FROM THE USE OF THE SDK OR THE SUITABILITY OF THE SDK FOR ANY PARTICULAR PURPOSE. MODULAR MAKES NO WARRANTIES OR REPRESENTATIONS THAT THE SDK WILL BE COMPATIBLE WITH LICENSEE'S SYSTEMS, SOFTWARE, OR APPLICATIONS, OR THAT THE SDK WILL BE SECURE FROM UNAUTHORIZED ACCESS, HACKING, OR OTHER POTENTIAL SECURITY THREATS. MODULAR DISCLAIMS ANY LIABILITY ARISING OUT OF OR IN CONNECTION WITH THE USE OF THE SDK. LICENSEE ASSUMES ALL RISKS AND RESPONSIBILITIES FOR USING THE SDK TO ACHIEVE THEIR INTENDED RESULTS AND FOR THE INSTALLATION, USE, AND RESULTS OBTAINED FROM THE SDK. ADDITIONALLY, VERSIONS OF THE SDK IDENTIFIED AS ‘PREVIEW VERSIONS’ MAY HAVE ADDITIONAL BUGS OR DESIGN FLAWS. MODULAR MAKES NO WARRANTIES ABOUT THE PREVIEW VERSIONS WHATSOEVER, AND LICENSEE’S USE OF THE SDK IN COMMERCIAL, PRODUCTION ENVIRONMENTS IN VIOLATION OF THIS AGREEMENT IS AT ITS OWN RISK. ##### 8. INDEMNIFICATION Licensee shall defend, indemnify and hold harmless Modular, its affiliates and their respective officers, directors, employees, agents and representatives from any and all third party claims, damages, liabilities, costs and fees (including reasonable attorneys’ fees) arising from: (i) its material breach of these Terms; or (ii) an allegation that any Application violates, misappropriates, or infringes any third party intellectual, contractual or proprietary right. ##### 9. LIMITATION OF LIABILITY TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL MODULAR BE RESPONSIBLE OR LIABLE WITH RESPECT TO ANY SUBJECT MATTER OF THIS AGREEMENT UNDER ANY CONTRACT, NEGLIGENCE, STRICT LIABILITY OR OTHER THEORY FOR: (I) LOSS OR INACCURACY OF DATA OR COST OF PROCUREMENT OF SUBSTITUTE GOODS, SERVICES, OR TECHNOLOGY; OR (II) ANY INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO LOSS OF REVENUES OR PROFITS; (III) ANY MATTER BEYOND ITS REASONABLE CONTROL; OR (IV) ANY AMOUNT IN THE AGGREGATE OVER $100. SOME JURISDICTIONS DO NOT ALLOW CERTAIN WARRANTY DISCLAIMERS OR LIMITATIONS ON LIABILITY. ONLY DISCLAIMERS OR LIMITATIONS THAT ARE LAWFUL IN THE APPLICABLE JURISDICTION WILL APPLY TO YOU, AND MODULAR’S LIABILITY WILL BE LIMITED TO THE MAXIMUM EXTENT PERMITTED BY LAW. ##### 10. TERMINATION These Terms may be terminated if the Licensee wants to terminate this Agreement by stopping use of the SDK. Modular may terminate this License if the Licensee fails to comply with any term in this Agreement, or if the Licensee commences, or participates, in any legal proceed against Modular. Upon termination, Licensee shall immediately cease all use of the SDK. These terms may be also discontinued by Modular if it decides to no longer provide any SDK, or if in Modular soles discretion, continued use is no longer commercially viable. Modular will attempt to provide written notice of termination to Licensee either through a posting on its website, or via the contact method for Licensee it has available. Upon any termination of this License all provisions survive except for the license grant provisions. ##### 11. EXPORT CONTROL Licensee shall comply with, and shall, at Modular’s request, demonstrate compliance with all applicable export laws, restrictions, and regulations of any United States or foreign agency or authority. Licensee shall not export or re-export, or allow the export or re-export of any product, technology or information it obtains pursuant to these Terms (including but not limited to the SDK) in violation of any such laws, embargoes, restrictions or regulations. Licensee shall obtain and bear all expenses relating to any licenses and/or exemptions required to comply with foregoing. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/the-next-big-step-in-mojo-open-source PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: March 28, 2024 # The Next Big Step in Mojo🔥 Open Source Modular Team At Modular, open source is ingrained in our DNA. We firmly believe for Mojo to reach its full potential, it must be open source. We have been progressively open-sourcing more of Mojo and parts of the MAX platform, and today we’re thrilled to announce the release of the core modules from the Mojo standard library under the Apache 2 license! We have always believed that building Mojo in the open will lead to a better result, because it allows its design to be shaped by the feedback from the broader community. We released Mojo very early and have been driving steady improvements since May of 2023 (see the changelog). Building a language and its infrastructure is hard work and takes time, and we’re excited to move from sharing our work to collaborating with Mojo developers worldwide. ### Contribute to Mojo🔥 open source There are many ways to open source code - some projects make source code available but do not accept contributions. Some provide opaque contribution processes without visibility into goals and roadmaps. Some open source and then don’t actively maintain it. At Modular, our team has either built, contributed to, or driven incredible open source projects like LLVM, Swift, TensorFlow and PyTorch, and we want to make sure we do things right. This means not just “making source code available”, but truly fostering and cultivating a vibrant and engaged open development community around Mojo🔥. Beyond just providing source code, we are also opening up revision history for the standard library, releasing nightly builds of the Mojo compiler, providing public CI, and allowing external contributions through GitHub pull requests. This is expensive and non-trivial to set up, but in our experience, it's critically important to allow the community to scale. ### License: Apache 2 with LLVM exceptions We chose to use Apache Licence, version 2.0. It contains a patent grant provision which provides legal protection to users and contributors of the software. The Apache 2 license is a widely used and proven license, and is familiar to many individuals and companies across the industry. The Apache 2 license is a great start, but our experience with licensing in the LLVM project taught us that there are two small issues with it. Some people are concerned that the Apache 2 license may not mix well with GPL2 code (e.g. the Linux Kernel) and the Apache 2 license requires that you acknowledge use of the code in derived projects. We want you to be able to use Mojo without requiring you to acknowledge Modular or Mojo (though of course, you are welcome to do so!) and make it clear that it is fine to mix with GPL2 code. As such, we’re including the LLVM exceptions which were specifically designed to address these concerns. We believe this represents the state of the art in open source licensing for language and tool projects, and recommend other Mojo open source projects to follow the same approach. We have been using this approach for our existing open source code, and will continue to release more code with the same approach. ### Early stages of our open source journey The Mojo standard library is under heavy development and changing rapidly, so we've started by open sourcing its core modules. As such, we consider this to be an important starting point, not an end to our open source journey. We’ll similarly evolve and iterate our development and contribution processes as we learn together with the community. We'll be opening up a lot more code over time, including more of Mojo and parts of the broader MAX platform. ### Contribution guides So how can you become a contributor to Mojo? There are a lot of areas in the standard library that can be improved, so make sure to check out the README.md in the Mojo GitHub repository on the nightly branch if you're planning to raise pull requests. It contains links to important docs, all of which are worth reading: - Development Guide - ‍Contributing Guide‍ - ‍Style Guide - ‍Vision‍ - Governance Structure‍ - FAQs We'll also be giving away swag and other benefits to Mojicians with significant contributions to the standard library! ## Nightly builds for fast iteration Nightly builds of the Mojo compiler are also now available! This allows you to test your contributions to the standard library against the latest version of the Mojo compiler that corresponds to the library source. This is a massive step towards opening development of the Mojo compiler, and allows Mojicians to live on the bleeding edge of development if they choose and test against the current tree. Over time, we will expand this nightly build to include the entire MAX platform. Make sure to check out the standard library development guide for details on how to get a nightly build, either to be on the bleeding edge of our development, or to test your contributions. ## Version control history We're releasing not only the code, but also our commit history for the standard library. We are committed to transparency, and enabling you to see how features have evolved over time, which provides additional context on how to develop standard library features. ## Let’s build the future together! We are very excited about the future of Mojo and all of the applications that people are already using it for. We think this is a big step forward in openness and transparency, though we still have a long way to go. If you’re interested in making contributions, please check out the README in mojo/stdlib for everything you need to get started, and feedback is always welcome on Discord and GitHub. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/enterprise#form PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Accelerate AI innovation and scale globally. Run AI workloads more efficiently, and optimize your compute inside your enterprise. Power all your AI use cases on one stack. ### Fastest GPU Infrastructure Get out of the box performance for GenAI models on NVIDIA H100s and A100s. ### Unify your AI infrastructure stack Unify industry frameworks and hardware, streamlining your deployment workflows to any cloud or on-prem environment. ### Deploy and scale for FREE with MAX Package your pipelines once and deploy across CPUs and GPUs without having to change any code. ### Easiest way to optimize your existing models Drop in your PyTorch or ONNX models and get an instant boost in performance with our next generation inference runtime. - Deploy MAX inside your cloud environment - Supercharge the efficiency of your AI stack with just 3 lines of code. - Dedicated support from our world class AI infrastructure team. Deploy MAX inside your cloud environment Supercharge the efficiency of your AI stack with just 3 lines of code. Dedicated support from our world class AI infrastructure team. ## Talk to our Sales Team Tell us what tools your organization is using and we can work together to see how best to incorporate MAX. ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing Contact Sales - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/blog/announcing-stack-pr-an-open-source-tool-for-managing-stacked-prs-on-github PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 23, 2024 # Announcing stack-pr: an open source tool for managing stacked PRs on GitHub Mikhail Zolotukhin We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. ### What are stacked PRs? Stacked PRs are a way to structure pull requests in a way when one PR depends on another in a sequence. Instead of submitting one large PR, you can break your changes into smaller, more manageable PRs that build on each other. As each PR in the stack is reviewed and merged, the remaining PRs are automatically updated, ensuring a smooth integration process. ### What are the benefits of using stacked PRs? Stacked PRs offer a structured way to manage multiple interdependent changes in a codebase. By breaking down large changes into smaller, more focused PRs, developers can benefit from: - Better code reviews: Each PR can be reviewed independently, making it easier to identify issues and understand changes. - Parallel work: You can proceed with work on a next change before another required change is fully reviewed and merged. - Cleaner history: The commit history remains more organized, reflecting the logical progression of changes. In the diagram below, the first graph demonstrates a typical workflows without stacked PRs. In the second graph, you can see the updated and simplified workflow with stacked PRs: ### What is stack-pr and how to use it? stack-pr is a CLI tool for managing stacked PRs from the comfort of your terminal. With a simple interface it allows you to create, update and merge stacked PRs. stack-pr offers a simple mental model for managing stacks of PR - each commit in your local git branch becomes a separate PR dependent on the PR from the previous commit. When you want to update the stack - e.g. either include some changes to existing PRs, reorder them, drop some of them, or add new PRs - you simply make the corresponding changes in your local git branch (usually you’ll be using git rebase -i for this) and then run a single command stack-pr export to update the PRs on GitHub correspondingly. When you are ready to merge your PRs, you can use the stack-pr land command, which would land the bottommost PR and rebase the rest of the stack. You can find a more detailed manual on how to use the tool in README.md. README.md ### Acknowledging similar tools stack-pr is not the first tool in the space, and we’d like to acknowledge other existing tools - specifically ghstack which heavily inspired stack-pr. ghstack is also a great tool for working with PR stacks, however it has some limitations which we worked around in stack-pr. For example, ghstack requires you to allow force pushes to your repo, and also it generates 3x more branches when constructing a stack compared to our tool. Nevertheless, we highly recommend giving it a shot too! ### Why are we open-sourcing stack-pr? Our company believes in giving back to the community. By open-sourcing this tool, we hope to contribute to the ecosystem and encourage collaboration and improvement. We invite developers, teams, and open-source enthusiasts to try out our tool, provide feedback, and contribute to its development. stack-pr is in its early days and there are many things that can be improved, and while you can use it as-is right now, we also welcome contributions to the tool to make it better for everyone! Thank you for your support, and we look forward to seeing how this tool evolves with your contributions! You can get stack-pr on GitHub, and be sure to check out the rest of the Modular community, which includes an active Discord where you can share feedback and connect with other devs. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Mikhail Zolotukhin AI Compiler Engineer Expert in traditional and ML compilers with over 15 years of experience in the field. Before Modular, Michael contributed to Intel Compiler, GCC, LLVM, and most recently PyTorch. He is passionate about building right things the right way and excited to do that at Modular to help power AI for the world. ================================================================================ URL: https://www.modular.com/blog-all PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?topic=Product PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/modular-team YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Modular+Team PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/deep-dive-into-ownership-in-mojo PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 4, 2024 # Deep dive into ownership in Mojo Ehsan M. Kermani This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. Understanding how ownership works in Mojo is essential to leveraging its memory management capabilities effectively. Mojo ensures memory safety similar to Rust and efficiency of C/C++ by enforcing strict ownership rules. In this part, we will explore how this is achieved through different kinds of values, ownership modifiers, and lifecycle management. ### Value kinds in Mojo When Mojo compiler parses the code along with the type checker it outputs three kinds of values, each with distinct ownership and reference behavior: - RValue (Owned Value): Represents a unique ownership, i.e., a unique reference or a unique typed pointer with a lifetime. - LValue (Mutable Reference): Represents a mutable reference, allowing read and write access to the original value. - BValue (Immutable Reference): Represents an immutable reference, allowing read-only access to the original value. Intuitively, these values can be defined using the ownership model we built in the previous section as follows (Mojo-pseudocode): These values propagate through the expression trees as the result of the Mojo parse. This is crucial for ensuring that the correct ownership and reference semantics are maintained throughout the program. Next, we will see how ownership can be modified in function arguments. ### Ownership Modifiers in Function Arguments Mojo’s argument convention in functions are as follows: - borrowed: The function receives an immutable reference (similar to ImmutableRef discussed previously). This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. Note that this is default in fn foo(x: T) i.e. fn foo(borrowed x: T) - inout: The function receives a mutable reference (similar to MutableRef). This means the function can read and mutate the original value (it is not a copy). - owned: This means the function has an exclusive unique reference  (similar to UniqueRef) which can uniquely identify the underlying value. Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy. More on this later. The first rule to note is: Rule 1: owned arguments take RValue on the caller side but are LValue on the callee side. When a function argument is declared as owned, it takes an RValue on the caller side but becomes an LValue on the callee side. This ensures that the function has exclusive access to the value, preventing other references from accessing or modifying it simultaneously. (The following is valid Mojo code): In above, String("hello, world!") uses the constructor __init__ to create the RValue where var owns it and is named x. Then in take_ownership(x^), the x^ is passed as an RValue (caller side) whereas it is received as an LValue in the callee side which is x = String(“Bye!”). The output of the program is Bye! as expected. For the purpose of completeness, we should mention that Mojo’s dataflow analysis determines where the last use of a variable has occurred and it injects its destructor __del__ eagerly. This is known as As Soon As Possible (ASAP) destructor. However, when transfer operator ^ is used, Mojo disables the call to String.__del__ and is correctly delegated to happen after take_ownership is done printing the new assigned value. For more, please check out the death of a value. #### Relations of the value kinds and ownership modifiers This table depicts how Value kinds behave with function ownership modifiers. ### Establish ownership behavior through __copyinit__ and __moveinit__ To implement custom behavior for copying and moving values, Mojo provides the __copyinit__ and __moveinit__ dunder methods, respectively. These methods allow you to define how values are copied or moved, ensuring that ownership is correctly transferred without unintended side effects. For more details, please check out the Mojo manual. A type in Mojo can be: #### Movable Values that can be moved through __moveinit__, transferring ownership without copying the underlying data through the transfer operator ^. The transfer operator ^ is used to convert a BValue or LValue into an RValue. This is essential for transferring ownership while maintaining the original value’s integrity. The following code simply prints when __moveinit__ is called: In the above example, var b = a fails to compile because that assignment used the __copyinit__ which there is none here. Executing the code, outputs Move is called. #### Copyable Values that can be copied through __copyinit__. The following code simply prints when __copyinit__ is called: The above var b = a calls the __copyinit__ and running the code confirms Copy is called. Note that we need to use keep(a) to keep the Mojo compiler away from optimizing it away as it was unused. An important note is that the transfer operator ^ is still usable here and its behavior is delegated to __copyinit__. We can verify it as follows: which outputs: This might be surprising at first! In order for transfer operator to actually move, we need to implement __moveinit__. #### Copyable and Movable Values can implement both __copyinit__ and __moveinit__. The following prints when __copyinit__ or __moveinit__ is called. which outputs: Given the above examples, we can deduce the following: Rule 2: owned argument owns the type if the transfer operator ^ is used, otherwise it copies if the type is Copyable. The Mojo compiler takes any opportunity to optimize memory management. In the above example, even without specifying var c = a^ The Mojo compiler sees that var c = a is the last use of a so it optimizes move over copy. Therefore, we can deduce the last rule: Rule 3: Copy to move optimization if the type is Copyable and Movable on last use. This is particularly beneficial for large or complex data structures, reducing the overhead associated with copying and enhancing performance. For example, in the following, avoiding extra copy is an important optimization that the Mojo compiler can do easily for us. which the expected output is: #### Immovable Values that cannot be copied or moved, ensuring that they remain in a fixed memory location. An example of such special immovable types is Atomic which cannot be copied or moved. Such behavior is critical to ensure correctness in multithreaded environments. ### Conclusion In the second part of the ownership series in Mojo, we built on the mental model developed in the first part and provided practical examples to illustrate how ownership works in Mojo. We covered the different kinds of values (BValue, LValue, and RValue) and how they propagate through expressions. We also explained the function argument conventions (borrowed, inout, owned) and demonstrated how these conventions help manage memory safely and efficiently. We concluded with three fundamental rules: - Rule 1: Owned arguments take RValue on the caller side but are LValue on the callee side. - Rule 2: Owned arguments own the type if the transfer operator ^ is used; otherwise, they copy the type if it is Copyable. - Rule 3: Copy operations are optimized to move operations if the type is Copyable and Movable and isn’t used anymore, reducing unnecessary overhead. Lastly, we emphasized that the main goals of ownership in Mojo are: - Memory Safety: Enforcing exclusive ownership and proper lifetimes to prevent memory errors such as use-after-free and double-free. - Performance Optimization: Converting unnecessary copy operations into move operations to reduce overhead and enhance performance. - Ease of Use: Automating memory management through ownership rules and the transfer operator, simplifying development. - Compile-Time Guarantees: Providing strong compile-time guarantees through type-checking and dataflow lifetime analysis, catching errors early in the development process. By integrating these principles, Mojo offers a powerful and intuitive framework for memory management, enabling developers to write efficient, safe, and high-performance code. For a deeper understanding of the technical details and implementation of ownership in Mojo, make sure to watch the accompanying video by our CEO, Chris Lattner. Additional resources: - Get started with Mojo - Official Mojo manual‍ - Join our Discord community - Contribute to discussions on the Mojo and MAX GitHub Report feedback, including issues on our Mojo and MAX GitHub tracker. Until next time!🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Ehsan M. Kermani AI DevRel Ehsan is a Seasoned Machine Learning Engineer with a decade of experience and a rich background in Mathematics and Computer Science. His expertise lies in the development of cutting-edge Machine Learning and Deep Learning systems ranging from Natural Language Processing, Computer Vision, Generative AI and LLMs, Time Series Forecasting and Anomaly Detection while ensuring proper MLOps practices are in-place. Beyond his technical skills, he is very passionate about demystifying complex concepts by creating high-quality and engaging content. His goal is to empower and inspire the developer community through clear, accessible communication and innovative problem-solving. Ehsan lives in Vancouver, Canada. ================================================================================ URL: https://www.modular.com/blog/whats-new-in-mojo-24-4-improved-collections-new-traits-os-module-features-and-core-language-enhancements PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 17, 2024 # What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Shashank Prasanna Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! Throughout the rest of the blog post, we’ll discuss many of the new features in this release with code examples that you can find in a Jupyter Notebook on GitHub. As always, the official changelog has an exhaustive list of new features, what’s changed, what’s removed, and what’s fixed. Before we continue, don’t forget to upgrade your Mojo🔥. Let’s dive into the new features. ### Improved Collections: New List and Dict features In Mojo 24.4 List and Dict introduce several new features to make them even more Pythonic. Many of these features have come directly from our community: - List has new index(), count(), __contains__() and conforms to Stringable trait, thanks to contributions by @gabrieldemarmiesse, and @rd4com - Dict has new clear(), reversed(), get(key), items(), values() and conforms to Stringable trait, thanks to contributions by @jayzhan211, @gabrieldemarmiesse, and @martinvuyk Let’s take a look at how to use these through code examples. #### Enhancements to List In this example, we’ll calculate word frequency from the contents of a webpage and plot the results as a word cloud. In the code below, we use Mojo's Python interoperability feature to preprocess the text, tokenize it, and remove stop words. We also use the Python interoperability features to plot the results. For the purpose of demonstration, we’ll use the url = "https://docs.modular.com/mojo/manual/basics" to generate the word cloud from the Mojo manual. Feel free to experiment with different URLs. Now, let’s take a look at the code. Output: In the example above, first we fetch a list of filtered words from the webpage in url using utils.fetch_and_preprocess_text(url). After that we’re ready to calculate word frequencies. We highlight the use of __contains__() in the code word[] not in unique_words: where the condition checks whether the current word is already in the unique_words list. If the word is not in unique_words, it means this is the first time we are encountering this word. If the word is not already in unique_words, we append it to the unique_words list. We then count how many times this word appears in the original words list using the count() method. mojo_word_list.count(word) counts the number of occurrences of word[] in mojo_word_list. The frequency count of the word is appended to the word_frequencies list at the same index as the word in unique_words. This means that unique_words and word_frequencies will have corresponding elements. To plot the word cloud, each word is plotted at a random position with a size proportional to its frequency, and random colors are used for the words. We use the Python interoperability features to call the plotting function in utils.plot_word_cloud(). #### Enhancements to Dict In this example we’ll use the Monte Carlo method for approximating the approximate value of Pi using new Dict features. The Monte Carlo method approximates pi by randomly generating points within a unit square and counting the number of points that fall within the unit circle inscribed within the square. The ratio of the points inside the circle to the total points can be used to approximate. We’ve written about this in more detail in an earlier blog post. Be sure to read that for more details on the math behind why this works. In this demo below we use Dict to methods exclusively instead of Arrays to implement the solution. Output: In the example above, we first create a Points dictionary, from new fromkeys static method to initialize Dict with keys from the List variable keys and set values to be empty lists. We use points_data.items() to print each items’ key and value. We also use reversed() to print the reversed order of keys. We also use get(key) to retrieve the points data for a specific key ("inside" in this case) and since the output of get() is an Optional type we use the take() function to retrieve the value. Finally we also demonstrate the use of clear to clear the dictionary. To plot the image above we made use of a utility function in Python using Python interoperability, called utils.plot_points() ### New traits: Absable, Powable, Representable, Indexer Mojo 24.4 also includes new traits to make writing Math equations simpler, print string representation of objects and define containers that can be indexed using integral values. - Structs that conform to Absable and Powable traits will work with built in abs() and pow() functions. Absable types must implement __abs__() dunder method and Powable type must implement the __pow__() dunder method. Powable types can also be used with operator ** in addition to the pow() function. - Objects of structs that conform to the Representable trait must implement a __repr__() dunder method, which enables the repr() to be called on objects to provide a string that can, if possible, be used to recreate the object and can be very useful for debugging. Thanks to @gabrieldemarmiesse for contributing this feature. - Structs that conform to the Indexer trait allow their objects to be used as index variables that can be passed to __getitem__() and __setitem__(). Types conforming to the Indexer trait implement __index__() dunder method and are implicitly convertible to Int or by calling the built in function index(). In the example below I’ve implemented a struct called MojoArray that conforms to Absable, Powable, and Representable traits, therefore it implements __abs__(), __pow__() and __repr__() dunder methods. Here is the skeleton of our struct, the full implementation is available on GitHub. In the code example above, we compute vectorized __abs__() and __pow__() as follows: And __repr__() as follows: Now, let’s create an object of the MojoArray struct to see these methods in action. Output: As you can see writing abs(v1-v2)**exp is a very expressive way to write math equations with these new traits vs. something like (v1-v2).abs().pow(exp) which is what we’d have done previously. Mojo 24.4 also includes a few other math specific traits math.Ceilable, math.CeilDivable, math.CeilDivableRaising, math.Floorable, and Truncable. See the changelog for more details. ### os module enhancements Mojo 24.4 also includes several file IO enhancements that makes Mojo standard library’s os module more Pythonic. Particularly, this release introduces the following functions: mkdir(), rmdir(), os.path.getsize(), os.path.join() and a new tempfile module that implements gettempdir() and mkdtemp() functions, thanks to contributions from @artemiogr97. Let’s take a look at an example to see how to use these methods in your own projects. Output: ### base64 package enhancements This release also includes a new base64 package that offers encoding and decoding support for both the Base64 and Base16 encoding schemes. Base64 encoding is often used in tokenizers for large language models (LLMs) and we use it in our implementations of bpe and tiktoken tokenizer utilities for Llama3. Check out our Llama3 example in this repository. Let’s take a look at an example that show you how to use this new package in the Mojo standard library. Output: You can see that the original and decoded images plotted side by side are the same. We use the utils.plot_original_decoded_images() helper function written in Python and called from Mojo using the Python interoperability feature. ### Core language features Mojo 24.4 also includes several core language features that are a bit harder to demonstrate with code examples. Most notably, this release Mojo has updated how def function arguments are handled. Previously, arguments were copied by default (owned convention), making them mutable but potentially causing performance issues due to unnecessary copies. Now, arguments use borrowed convention by default and only copied if mutated within the function. In this release you can also return multiple values from a function as a Tuple that can be unpacked into individual variables. For example in the earlier Enhancements to Dict section we define a method: def approximate_pi(num_points: Int) -> (Float64, Dict[String, List[List[Float64]]]). We call this method in this way to get the values of the Tuple into separate variables: pi_approximation, points_data = approximate_pi(num_points), where as previously we had to get the value as a Tuple variable and index into it to extract the values. This release also introduces the new @parameter loop decorator which can be used with for loops where the loop variable is a compile time constant. This allows the Mojo compiler to perform a full unroll of the loop to improve performance. With the introduction of @parameter decorator for loops, the previously recommended @unroll decorator has now been deprecated. There are many more core language enhancements in this release, see the changelog for a complete list. ### New documentation pages We also updated our documentation to include dedicated pages that dive deeper into the following topics: - Control flow: https://docs.modular.com/mojo/manual/control-flow - Testing: https://docs.modular.com/mojo/tools/testing - Unsafe pointers: https://docs.modular.com/mojo/manual/pointers ### But wait, there’s more! Mojo 24.4 includes many more features that we didn’t cover in this blog post. Check out the changelog for a detailed list of what’s new, changed, moved, renamed, and fixed in this release. MAX 24.4 is also available for download today and for the first time we’re making it available on Mac OS. This release of MAX also includes several enhancements including New Quantization API for MAX Graphs, and full implementation of Llama 2 and Llama 3 models using Graph API with quantization. Read more in the MAX 24.4 announcement blog post. All the examples I used in this blog post are available in a Jupyter Notebook on GitHub, check it out! - Download MAX and Mojo. - Head over to the docs to read the Mojo🔥 manual and learn about APIs. - Explore the examples on GitHub. - Join our Discord community. - Contribute to  discussions on the Mojo GitHub. - Read and subscribe to Modverse Newsletter. - Read Mojo blog posts, watch developer videos and past live streams. - Report feedback, including issues on our GitHub tracker. Until next time! 🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Shashank Prasanna AI Developer Advocate Shashank is an engineer, educator and doodler. He writes and talks about machine learning, specialized machine learning hardware (AI Accelerators) and AI Infrastructure in the cloud. He previously worked at Meta, AWS, NVIDIA, MathWorks (MATLAB) and Oracle in developer relations and marketing, product management, and software development roles and hold an M.S. in electrical engineering. ================================================================================ URL: https://www.modular.com/blog/debugging-in-mojo PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 16, 2024 # Debugging in Mojo🔥 Jack Clayton Walter Erquinigo Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. This tutorial is for VS Code, but can be adapted to other editors using LLDB-DAP. It's aimed at general debugging if you have no experience with it, but goes over all the currently implemented Mojo features. The goal is to show you how simple and powerful debugging is with Mojo, to improve your velocity tracking down logic errors beyond writing and deleting print statements. ### Debug current file First make sure you've installed the Mojo extension, or Mojo Nightly if you've installed the nightly compiler. Let's start with the simplest way to boot up the debugger in VS Code, set a breakpoint by clicking to the left of a line to set a 🔴 Breakpoint, then press the ⌄ to the right of the ▶️ Play button in the top-right, and choose Debug Mojo File: Note: you can expand any GIF by clicking it, and minimize by clicking anywhere or pressing any key. Pressing the |▶ Continue button advances to the next break point, if the same line of code is being hit in a loop, this will advance to the next iteration in the loop. Default Keybindings: - F5: Start debugger (select Mojo on the first run if starting this way) - F5: Continue to next breakpoint if the debugger has started - Shift+F5: Stop the debug session - Control+Shift+P (Command+Shift+P on macOS): Restart the debug session - ‍F9: Toggle breakpoint on the current line Control+Shift+P Command+Shift+P You can also launch the debugger from a terminal with: Type in mojo debug --help for more options. ### Step in, out, and over A powerful feature is stepping into functions, out of them, and over any breakpoints you've set: The first action is a Step Into the List.append method, followed by 2x Step Over to break at the following expression, and finally a Step Out to return to the original List.append breakpoint. Default Shortcuts: - F10: Step Over. - F11: Step Into. - Shift+F11: Step Out. ### Mutating and inspecting variables You can mutate variables mid-debug session! Simply click on a value to edit it. You can also use the debug console to index into variables: ### Changing stack frame context When you step into a function, the stack frame and local variables will change on the debug panel, you can view a different stack frame by clicking on it: You'll notice the local variables in the debug panel change, you can inspect and modify them as usual. ### Watches Sometimes the local variable you're interested in won't be in the Locals section, or perhaps there are too many variables there, and you want to keep a specific variable at the top of the list, or you might want to use an expression such as indexing into a list. To achieve this you can press the ✚ button next to WATCH: ### Logpoints Instead of writing print statements into your program, and potentially committing them to your PR, you can use a log point expression which also has code completions via the Mojo LSP. Simple right click where you would normally set a breakpoint and choose Add Logpoint: ### Hit Count If you want to wait for x iterations until your breakpoint triggers, you can use a Hit Count. Right click a breakpoint location and select Conditional Breakpoint then change the selection to Hit Count, in the example I'm choosing the third iteration. Breakpoints are triggered just before the current line expression runs, which in this example is just before the third element is added to the List: ### Wait for breakpoint If you want to skip a breakpoint until another one has been triggered, you can use this. Right click a breakpoint location and select Triggered Breakpoint, then choose the other breakpoint you want to wait for: ### Multithreaded debugging You can also debug in a multithreaded context. If you go to the command input of the DEBUG CONSOLE, type in :thread list to see a list of the current threads, any threads that are currently paused due to breakpoints will display here. You can then change the stack frame into those threads to inspect local variables: ### Custom Launch Configuration If you need more control over your debug launch configuration for a larger program, or you're running server and client and you need to attach to a process, you can create a launch.json file. You can also commit this to the repo so other users can easily start a debug session. First Press the Debug icon on the sidebar, then click create a launch.json file and select Mojo to create a file at .vscode/launch.json: Press Control + Space to discover all the configuration options. Make sure to change [your-program.mojo] and [your-binary] to your desired targets, and delete any configuration you don't need. Now on the top right of the debug panel, you can select a launch configuration which will run when you press F5: ### Coming Soon - Break on error, for easily tracking down what part of your code is throwing. - Conditional breakpoints, for expressions to break on True. - GPU Debugging! See a preview below: For more details on Mojo debugging check out the debugging docs. For more details on VS Code debugging, check out their docs here. ‍ Thank you for reading! Here are some additional Mojo resources: - Get started with downloading Mojo - Head over to the docs to read the programming manual and learn about APIs - Explore the examples on GitHub - Join our Discord community - Contribute to  discussions on the Mojo GitHub - Read and subscribe to Modverse Newsletter - Read Mojo blog posts, watch developer videos and past live streams - Report feedback, including issues on our GitHub tracker ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. Walter Erquinigo AI Tools Engineer Walter has over 10 years of experience focusing on becoming a well rounded engineer. He has experience all over the stack, from very low level CPU tracing to front end development. However, he is particularly passionate about developer productivity and debuggers, which is an area where he pushed the state of the art by working reverse debugging at Meta. When not working, he likes to play the piano, travel all over the world and spend time with his friends and family. ================================================================================ URL: https://www.modular.com/blog/a-brief-guide-to-the-mojo-n-body-example PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 3, 2024 # A brief guide to the Mojo n-body example Chris Hoge Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. N-body is one of the Computer Language Benchmark Game's benchmarks and is described as a program that “models the orbits of Jovian planets, using a simple symplectic integrator.” This benchmark does an excellent job of exercising single-core numeric performance. Because it’s a simple ordinary differential equation (ODE) solver, it’s not easily parallelizable (although, as we will see, it is possible to implement basic vectorization). In addition to this, numerically integrating orbital dynamics adds a level of complexity, as it’s easy for small integration errors in an implementation to grow exponentially in time, destabilizing the computation. This makes the n-body problem a good test both the speed and accuracy of an implementation. This post will give a brief guide to the Mojo n-body example, describing the code in detail. While it doesn't go too deep into math, it will teach a little bit about orbital mechanics. Along the way, it will show how you can use Mojo’s built-in features and standard library to start writing your own optimized code. ### Installing Mojo Begin by installing Mojo, which is available as part of the MAX framework. Complete instructions on installing MAX and Mojo are in the MAX documentation. Once Mojo is installed, you can get the n-body example code from the Mojo GitHub repository. The example code can be found in the mojo/examples directory. ### Importing from the Mojo standard library The example begins by importing several modules from the standard library. The standard library includes many of Mojo’s features, including common math functions, benchmarking tools, standard collection types such as lists, and testing and validation methods. ### Setting up the data structures Next, we define the constants that will be used throughout the simulation. Although the standard library math module includes pi (math.pi) as a constant, it is specified here for convenience and consistency with other simulations from the Benchmarks Game. One theme that will frequently arise in the explanation of this simulation is how choices are made to speed up, simplify, and stabilize the computation. The selection of units of measurement is an excellent example of this. In this simulation, the unit of mass is chosen as the mass of the Sun divided by 4π2, the unit of time is one year, and the unit of distance is one Astronomical Unit (AU), roughly equivalent to the average distance from the Earth to the Sun. Why choose these units? We’re considering an orbital dynamic system that follows classical mechanics for this simulation. This means that we can use Newton’s Law of Universal Gravitation to model the bodies' interactions. It follows from this assumption that Kepler’s Laws of Planetary Motion will hold, which we can use to guide our choice of units. Kepler’s Third Law states that T2/a3 is constant, where T is defined as the orbital period of a small body orbiting a larger body, and a is the distance between the smaller and larger body. For the Earth and the Sun, this constant is approximately GM/4π2, where G is the gravitational constant, and M is the mass of the Sun. Using this knowledge, determined by experimental observation, we choose our units of mass to be 4π2 multiplied by the mass of the Sun. That means that in this simulation with this choice of units, the gravitational constant is 1. You can dig into this more deeply in the Wikipedia page for Kepler’s Laws of Planetary Motion. Not only do these choices simplify computing gravitational acceleration by removing a multiplication, they also helps to scale our computations into a reasonable range, reducing the likelihood of introducing numerical instability into the simulation because of rounding errors. The choice of units effectively normalizes the equations of motion. With the units set, it’s time to define the data structure for planets. Each planet (and the Sun) has three major components that define its state: - A variable position in 3D space. - A variable velocity in 3D space. - A constant mass. The planet structure is represented by a Mojo struct, modified by the @value decorator, which tells the Mojo compiler to synthesize essential lifecycle methods to give the structure full value semantics. This means it will automatically create __init__(), __copyinit__(), and __moveinit__() methods that are compatible with Mojo’s ownership model. When dealing with simple structures that are collections of built-in types, this simplifies your code base, making it easier to read and more reliable. The position and velocity vectors are internally represented as Mojo SIMD types containing float64 vectors of length 4. Using a vector of length 4 may come as a surprise to youbecause position and velocity only have three dimensions. SIMD data types require vector widths that will fit into computational registers, limiting the choice of vector length. A SIMD vector length of 4 is the smallest size that can hold the position and velocities of the planets, so we need to “waste” one float64 value in exchange for parallelized computations. This is an example of a tradeoff between space: using 4 floats to hold 3 values, and time: being able to use SIMD operations to simultaneously perform one computation across three values. One key to this working properly is to ensure that when the planet objects are initialized, the last item in each SIMD type is set to zero to prevent these extra values from corrupting the computed solution. This technique, known as padding, is common in writing optimized computational kernels: it takes advantage of vectorized operations while computationally “ignoring” the padded values we’re not interested in. With our Planet data structure in place, we can now create representations of the planets with initial states that include position and velocity. The entire initial state is stored as a list of celestial bodies, with the first entry being the largest object, the Sun. Position is encoded as AUs, velocity as AUs/year, and mass is scaled relative to the Sun’s solar mass divided by 4π2. The initial state is set with observational data converted to the appropriate units. How the values for the initial states were determined is beyond the scope of this blog post, but they were drawn from the Benchmarks Game simulation. In addition to the Sun, this simulation only concerns four Jovian bodies in the outer solar system: Jupiter, Saturn, Uranus, and Neptune. The Sun is defined as at the simulation's center, with position and velocity of zero. Notice in the initialization of the Sun, we can initialize all SIMD array elements by passing a single value to the constructor. For the SIMD data type, Mojo assumes that you want to initialize every item in the vector to the same value if you only pass the constructor a single value. For the planets, we explicitly construct them using four values: three non-zero values for each of the positions and velocities and a zero in the fourth dimension that prevents the final value from corrupting the SIMD reduce operations that we’ll encounter later in the code. The simulation's initial and ongoing state is stored as a List, one of the collection modules available in Mojo’s standard library. Recall that by decorating the Planet struct with @value, we immediately gained full compatibility with Mojo’s `List` collection type. The initialization block also features another Mojo optimization feature: alias. Aliases define a compile-time temporary value that can't change at runtime. We can use aliases to fix the initial state at compile time and then use runtime variables (var) for the computation. ### Computing the momentum offset Before running the simulation, we have to attend to one more bit of initialization. Although the Sun was set as the fixed center of the simulation, the velocity of the center of mass of the entire simulation is currently non-zero. This means that as we compute the equations of motion, the center of mass in the simulation will move at a constant speed through space. This additional motion can lead to less numerical stability, and we can counteract that by ensuring that the center of mass of the simulation is stationary. To do this, we compute a momentum offset based on the initial state and then adjust the Sun's position and velocity to account for that offset. This will help prevent the simulation from drifting over time, maintain a stable frame of reference, and ensure realistic and accurate results. Momentum is defined as a body's mass times its velocity. In the offset momentum method, we iterate over every body in our simulation, summing each body's momentum to compute the total simulation momentum. We then subtract that momentum from the Sun by adjusting its initial velocity (previously set to zero). Note that this method takes the list of planets as inout parameter, making the list a mutable reference. This means that once the method returns, the caller will see all of the modifications made to the list of planets in the method. ### Integrating the dynamic system The majority of the work in the simulation is done in the advance function, which integrates the equations of motion forward by one time step. It takes the list of planets as an inout mutable reference parameter and a time step parameter, dt, which by default is an immutable reference following Mojo’s borrowed argument conventions. At a high level, it computes the change in velocity imposed upon each body by the gravitational force each body exerts on the other. Then, using the updated velocity, it updates the position of each body. This two step update is possible because the algorithm uses a symplectic integrator, derived from the equations of motion, to determine the updates for each body in the system. This is also known as the semi-implicit Euler’s method. While the complete derivation of this method is outside the scope of this blog post, we can note that symplectic integrators are useful for planetary dynamics systems because they conserve energy. In contrast, general ordinary differential equation solvers don’t and can introduce instabilities into the simulation. There are a few things to note about this implementation. First, by necessity, this is an O(n2) algorithm in the number of bodies. Each planetary body has a gravitational influence on the other, requiring on the order of n2 computations. However, because the force exerted between bodies is symmetrical, we can cut the number of computations in half by computing the force between two objects only once. Second, we can use SIMD operations to compute additions and multiplications more quickly because each dimension is independent. We also use the SIMD reduce_add operation to help calculate the squared distance between bodies. This is why it was essential to pad the fourth position and velocity values with zeroes to ensure that undefined memory initialization doesn't impact the computation. Third, because we chose our units of measurement such that the gravitational constant is 1, it doesn’t appear in the computation. ### Computing the energy of the system We compute the system's total energy by summing each body's kinetic energy with the potential energy between each body. We can use this computation to check the correctness and stability of our simulation. Because it’s a closed system, the total energy should remain constant, and the symplectic integrator was chosen to maintain this invariant. The kinetic energy is simply ½mv2 (with SIMD multiplication and reduce_add coming into play again), with m being the mass of the body and v the velocity. The potential energy between two bodies is -GMm/r, where G is the gravitational constant, M is the mass of the first body, m is the mass of the second body, and r is the distance between them. A quick reminder is that because of our initial choice of units, G in this equation 1, and the potential energy is just the product of the masses divided by the distance between them. ### Putting it all together We have all the pieces we need to run the simulation. We begin by initializing the simulation and creating a copy of the system's initial state. We also compute the system's energy at the start of the simulation to verify its stability at the end. We run the simulation for 50 million steps, with a time step of 0.01. This means the simulation projects ahead 3.5 days at a time to predict 50 thousand years of orbital dynamics. With 50 million calls to the advance function, we can easily see the savings in guaranteeing that `advance` is treated as inline code rather than a function call. At the end of the simulation, we recompute the system energy and verify that it’s equal to the original energy -- within computational accuracy. Note that to help with readability, we can use underscores to punctuate large numbers. ### Benchmarking the code We can provide an alternative method to benchmark the simulation's performance instead of just running it. To guarantee the accuracy of the benchmarking code, we use the keep function from the standard library benchmark package to ensure that the Mojo compiler doesn’t optimize the energy calculations. Usually, if Mojo determines that a method has no side effects, it will optimize that code away. ## Running the simulation To build the simulation as a standalone program, we need to provide a main function as an entrypoint for the application. You can build the application using the command: To run the benchmarked version of the code, change the run_system command to benchmark, recompile and run. On an Intel x86 system with 512 bit wide SIMD, benchmarking 50 million iterations three times yields: When compared to the C implementation that is very similar in structure, compiled with optimizations for the same architecture: The Mojo implementation is approximately 46% faster. While the implementations are similar, Mojo get a significant performance boost right out of the box because ofit's build-in support for SIMD operations. This is just the beginning of possible optimizations, and there's a lot more that can be done to improve the performance of this example. ## What’s next? This blog post briefly introduced Mojo through the nbody.mojo example, and explained how its built-in data types can be used to write performant code with minimum effort. While this code is fast out of the box, there is still room for improvement. What optimizations can you write to make the code even faster? Or if you want to take on a new challenge, you can try implementing one of the many other benchmarks in Mojo. Share your implementations and feedback with the Modular Discord community, and contribute your improvements to nbody.mojo at the Mojo repository on GitHub. Don't forget to check out the entire collection of community resources on the Modular community page! Until next time! 🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Hoge Developer Relations Manager Chris Hoge has spent over a decade working in open-source machine learning and infrastructure projects, where's he focused on building vibrant developer and user communities. He has an M.S. in Applied Mathematics from the University of Colorado, where he studied numerical methods for simulating physical systems. He lives in the beautiful Pacific Northwest, where he spends his free time trail running and playing piano. ================================================================================ URL: https://www.modular.com/blog-all?topic=Popular PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/what-ownership-is-really-about-a-mental-model-approach PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 29, 2024 # What ownership is really about: a mental model approach Ehsan M. Kermani Ownership is a well-known concept in modern programming languages such as Mojo that aims to provide a safe programming model for memory management while ensuring high performance. This allows programmers to build safe abstractions without the need to manually manage memory, making development more efficient and less error-prone. In this blog post, we will build an intuitive understanding of how memory works and expand on that foundation to create a simple mental model for the concept of ownership. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. ### An intuitive journey through memory management 🎒 To build a simple mental model for ownership, we first need to build an intuitive understanding of how memory works in computing. #### Stack vs. heap When a program runs, it needs a place to store data. This data is stored in two main areas of memory: the stack and the heap. Understanding the difference between these two is crucial for grasping the concept of ownership. - Stack: The stack is a region of memory that stores temporary variables created by each function (including the main function). It is managed in a Last-In-First-Out (LIFO) order, meaning that the last variable pushed onto the stack is the first one to be popped off. The stack is very efficient for managing memory because allocating and deallocating variables on the stack is extremely fast. However, the stack is limited in size and scope. It's ideal for storing short-lived, simple data like function parameters, return addresses, and local variables. - Heap: The heap is a larger pool of memory used for dynamic allocation. Unlike the stack, the heap does not follow a LIFO order. Instead, it allows for flexible and arbitrary memory allocation and deallocation. This makes it suitable for storing data that needs to live for an unpredictable duration or whose size may change. The trade-off is that managing heap memory requires more effort and can be slower due to the overhead of finding and managing free space. We can visualize the stack and the heap in a simple linear model of memory as follows: For example, the stack for the following Mojo program looks like: We can zoom in each block of stack (i.e. stack frame) which includes a table of address, name and value. For simplicity, we do not take care of types and size of each stored value so the y‘s address is 1. A crucial difference between the stack and the heap is that two functions cannot access each other's stack frames, making the stack local to each function. This local nature ensures that variables stored on the stack are isolated and protected from unintended interference by other functions. In contrast, the heap is globally accessible, allowing functions to share and modify the same dynamically allocated memory. This global accessibility makes the heap suitable for storing data that needs to persist and be shared across various parts of a program. Such global access forms the core of memory management. Two functions can step into each other’s heap memory, causing various issues that we will discuss later, and we will learn how ownership can prevent such memory management problems. First, let’s see how we can access memory. ##### How to access memory? We showed a variable storing a value has an address in memory. In C such address can be found using the address operator &. In the following example, &x returns the address of x in memory which is a (raw) pointer ptr. To start building our mental model, we will use a Mojo-like pseudocode in this part to construct each piece that will eventually give rise to our mental model. In this example, Address represents a simple structure holding an address, and RawPointer provides methods to allocate, write, read, and free memory. The main function demonstrates creating a variable x and obtaining its address as a RawPointer. We can visualize the stack as follows where -> x refers to the value of ptr in memory. ##### How to work with the heap? So far, we have only worked with the stack. To work with the heap, let’s try to create a String object using our RawPointer. Note that the implementation details of String are not essential for our mental model, so we will skip them. Looking closer, an instance of our String is created in these steps: In this example: - Allocate enough space on the heap for the String object. This is done by calling alloc on a RawPointer. - Initialize the allocated space with the string "hello, world!". This is done by calling write on the uninitialized pointer. - Assign the initialized pointer to the variable x, effectively creating a String object with the data stored on the heap. The final result can be visualized as follows where the value of x is ptr but the actual value of x is the ”hello, world!” stored in heap in binary format (below we also show the ASCII values for clarity): Note that we also need to manually free the pointed memory after done with x. Next, let’s explore a few critical bugs that can occur with such manual memory access. #### What are the critical bugs in manual memory management? The following are the top two critical bugs that can happen in such manual memory management. ##### Use-after-free A use-after-free error occurs when a program continues to use a pointer after the memory it points to has been freed. This can lead to Undefined Behavior (UB), such as program crashes or data corruption. ##### Double-free A double-free error happens when a program attempts to free the same memory location more than once. This can lead to Undefined Behavior and potential security vulnerabilities. We are now ready to build our intuitive mental model for the compiler to catch such mentioned bugs. #### How to catch such memory management errors at compile time? In order to help the compiler catch such errors, we start by including more metadata to our RawPointer representation. ##### Step 0: Add type parameter to RawPointer As a statically compiled language, we first can enrich the RawPointer with the type information [T] as follows. Note that we are borrowing the compile-time parameter in square-brackets in Mojo Adding type information [T] to RawPointer provides several benefits: - Type Safety: By specifying the type of data the pointer is referencing, the compiler can ensure that only valid operations are performed on the data. This prevents type-related errors and ensures that operations like reading, writing, and freeing memory are type-safe. - Compile-Time Checks: With type information, the compiler can perform more rigorous compile-time checks. This helps catch potential errors early in the development process, reducing runtime errors and improving the reliability of the code. - Optimizations: The compiler can use type information to optimize memory access and management. Knowing the exact type of data being referenced allows the compiler to generate more efficient code. ##### Step 1: Add lifetime parameter to TypedRawPointer[T] Next, we introduce a lifetime parameter to the TypedRawPointer[T] to track the validity period of pointer usage. This metadata tracks when a pointer is valid or has been freed. With this, we have the following definitions Definition 1: A reference is a typed raw pointer with lifetime. (Not be confused by the standard library Reference). ‍Definition 2: A reference is safe if its lifetime is in a valid state. We should note that whenever we are done with checking lifetime, we can erase it (and its type too) to get to the underlying RawPointer. With these added metadata, let’s go back and examine if they are enough to catch either use-after-free or double-free errors. ###### Lifetime analysis prevents double-free Here is an example of how lifetime analysis prevents double-free errors. First, memory heap is allocated. The allocation returns a raw pointer to an uninitialized memory. Next, a reference Ref is established and marks its lifetime as IsAlive. Finally, the data is written to the underlying memory with a variable x coming into existence. The last line double_free(x) when expanded it becomes: Visually it looks like: By using lifetime parameters, we can ensure that memory is only freed once, preventing double-free errors. ###### Can lifetime analysis alone also prevent use-after-free? Let's see if lifetime analysis alone can prevent use-after-free errors.  In the above example, the lifetime analysis ensures that the reference x is valid only within a specific time frame. After x.free(), the lifetime of the reference x is marked as IsDead, indicating that it should not be used. However, lifetime alone does not prevent other functions or parts of the code from using the reference x incorrectly (Lack of Exclusive Ownership). In the use_after_free function, x.write(tmp) is attempted even though x is already freed. Therefore, the lifetime system alone does not enforce exclusive access or prevent this usage. Lifetimes track validity but do not manage the state of the memory or enforce rules about how it can be accessed after certain operations. More metadata is needed to bake the ownership model which is necessary to ensure that once x.free() is called, no other references can access or modify x. Looking at the above diagram, we might ask what if we disallow the use of x after its lifetime is marked IsDead? In that case, we will enter the dataflow analysis which keeps track of what value is in use, can or can not be used. This idea basically leads to the concept of ownership that we will talk about next. ##### Step 2: Specify ownership To further enhance the safety of our memory management, we introduce ownership parameter. The goal of ownership is to enforce exclusive access and state management for memory references: Such ownership parameter introduces a new layer of metadata that the compiler can use to enforce strict memory management rules: - Exclusive Ownership: UniqueRef ensures that there is only one reference to the allocated memory at any given time. This prevents multiple references from accessing and potentially modifying the same memory simultaneously, avoiding race conditions and ensuring data integrity. - Immutable Reference and Mutable References: ImmutableRef and MutableRef allow for controlled access to memory, ensuring that certain references can only read (immutable) while others can modify (mutable). This helps in maintaining the integrity of data by restricting unintended modifications. - Invalid State: InvalidRef represents a state where the memory has been freed and should not be accessed after. This helps in catching use-after-free errors by marking references as invalid after the memory is deallocated. Let’s have a look at the use-after-free case but now with ownership included The use-after-free error is prevented by the UniqueRef type through the following mechanisms: - Exclusive Ownership: UniqueRef ensures that x is the only reference to the allocated memory. Once x.free() is called, the memory is marked as freed, and the unique reference is invalidated i.e. turns into InvalidRef[UInt8, IsDead] vs. in the previous step 1, it was Ref[UInt8, IsDead]  which didn’t have enough information to help the compiler reason about its ownership state. - Compile-Time Checks: When use_after_free(x) is called after x.free(), the compiler checks the ownership state of x. Since x has been freed, it no longer holds a valid UniqueRef. The compiler can detect this invalid state and generate a compile-time error. ‍ - Lifetime and Ownership Enforcement: The combination of lifetime and ownership parameters ensures that the reference x cannot be used after it has been freed. This prevents any attempt to write to or read from the memory through x after the free operation. #### Conclusion In this first part of the series on ownership, we have developed a mental model of how memory works. We talked about the stack being used for local variables and function calls, while the heap is used for dynamic memory allocation. The stack is fast and local, whereas the heap is flexible and globally accessible which can cause critical memory errors such as use-after-free and double-free that can lead to Undefined Behavior and security vulnerabilities. Later, we tried to look through the lens of the compiler and develop an intuitive understanding of how adding type and lifetime parameters to RawPointer helps the compiler catch errors related to type safety and memory validity. Last but not least, we introduced the ownership parameter that enforces exclusive access and state management, preventing use-after-free and double-free errors. By incorporating these concepts into our mental model, we enable the compiler to catch memory management errors at compile time, ensuring safer and more efficient memory usage. In the next blog post, we will dive deep into ownership in Mojo. We end this part with the following quote from the talk. Additional resources: - Get started with Mojo - Official Mojo manual‍ - Join our Discord community - Contribute to discussions on the Mojo and MAX GitHub Report feedback, including issues on our Mojo and MAX GitHub tracker. Until next time! 🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Ehsan M. Kermani AI DevRel Ehsan is a Seasoned Machine Learning Engineer with a decade of experience and a rich background in Mathematics and Computer Science. His expertise lies in the development of cutting-edge Machine Learning and Deep Learning systems ranging from Natural Language Processing, Computer Vision, Generative AI and LLMs, Time Series Forecasting and Anomaly Detection while ensuring proper MLOps practices are in-place. Beyond his technical skills, he is very passionate about demystifying complex concepts by creating high-quality and engaging content. His goal is to empower and inspire the developer community through clear, accessible communication and innovative problem-solving. Ehsan lives in Vancouver, Canada. ================================================================================ URL: https://www.modular.com/blog/fast-k-means-clustering-in-mojo-guide-to-porting-python-to-mojo-for-accelerated-k-means-clustering PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 20, 2024 # Fast⚡k-means clustering in Mojo🔥: a guide to porting Python to Mojo🔥 for accelerated k-means clustering Shashank Prasanna One of the first things we teach our children growing up is how to group toys by colors, shapes, and sizes. Grouping objects into categories is a fundamental tool we use to understand the world around us. It's so important that we've developed several computational methods to find groups or patterns in data, and they are studied under a sub-field of machine learning called cluster analysis. There are several clustering algorithms, but k-means — the algorithm we're going to implement from scratch in Python and Mojo🔥 in this blog post — is one of the most popular due to its simplicity and ease of implementation. In this blog post, I’ll: - Explain what k-means is, how it works, and how to use it. - Show you how to write the k-means clustering algorithm from scratch in Python and Mojo and highlight key differences between the two implementations. - Guide you through code changes you'll need to make to port Python code to Mojo🔥 for significant performance benefits. My goal is to introduce Mojo🔥 to Python developers using an example-driven workflow. This post will not make you a Mojo🔥 expert, but it will help you appreciate the similarities between Python and Mojo🔥 code, and how you can translate Python code to Mojo🔥 by introducing Mojo🔥 specific features like strong typing and vectorization to achieve substantial speedups over Python+NumPy code. Get the code: All the resources shared in this blog post, including the complete implementation of k-means in Python and Mojo with detailed comments, scripts to run the examples, a benchmarking script, and utility functions that generate scatter plots (like the one below) and benchmark plots, are all available on GitHub: The figure below shows clusters calculated by our Python+NumPy and Mojo implementations, within a synthetically generated dataset containing 3,000 samples (rows) and 100 features (columns), grouped into five categories. In the past, I’ve struggled to visualize 100 dimensional data (believe me, I’ve tried), so I reduced the data to two dimensions using Principal Component Analysis (PCA). The actual centroids, along with those calculated using each implementation (shared in this blog post), are also shown. #### k-means performance and benchmarking In this blog post, I’ll share some benchmark comparisons to show performance improvements of k-means in Mojo🔥 over Python+NumPy implementation. Performance can depend on many factors. In the plot below (click to zoom), I illustrate the speedup achieved by Mojo🔥 k-means over Python+NumPy k-means by varying the (1) number of clusters, (2) number of samples, and (3) number of features, while keeping other variables constant as specified in the plot. We observe speedups ranging from 6x to 250x with Mojo🔥 (click to zoom, best viewed when browser is full screen): We'll discuss benchmarking in a little more detail at the end of this blog post, for now here are the key takeaways: - Every workload is unique, so it’s hard to make generalized speedup statements, especially when comparing complex projects with small, specialized functions designed for benchmarking. - For complex ML algorithms like k-means, several factors—such as dataset size, number of clusters, number of iterations, and the effectiveness of the code—contribute to performance. - Porting Python+NumPy code to Mojo🔥 will offer considerable speedups, since computationally expensive parts can easily be vectorized and parallelized. But you really came here for the code, and I won’t keep you waiting. Let’s jump right into the implementation. First, a basic summary of the k-means algorithm and its details—it’s not complicated, I promise. ### What is k-means clustering? Consider a tabular dataset with M rows and N columns, where each row represents an N-dimensional data point, and there are M data points in total. K-means is an iterative algorithm that assigns each data point to its nearest cluster based on its distance to the centroid of that cluster. The algorithm recalculates the centroids iteratively to reduce the average within-cluster distance. Upon convergence, similar data points are grouped together in common clusters. For example, in an e-commerce dataset, each column might represent customer attributes such as past purchase history and demographic data, while each row represents a different customer. K-means clustering can help you cluster customers together and determine if there are common buying preferences within a cluster. You can use this information to recommend similar products and services to customers in the same cluster. The algorithm is very simple. For a given dataset and desired number of clusters k. - Initialization: Pick initial k centroids using k-means++ initialization algorithm (discussed below). - Lloyd's iteration: Perform these steps till convergence:Assignment: For each data point calculate distance to each of the k centroids and assign the data point to the closest centroid.Update: For each cluster, recalculate the centroid by computing the mean of all data points assigned to that cluster. - Assignment: For each data point calculate distance to each of the k centroids and assign the data point to the closest centroid. - Update: For each cluster, recalculate the centroid by computing the mean of all data points assigned to that cluster. - Assignment: For each data point calculate distance to each of the k centroids and assign the data point to the closest centroid. - Update: For each cluster, recalculate the centroid by computing the mean of all data points assigned to that cluster. In flow chart form: ### K-means class definition in Python and struct definitions in Mojo I’ll discuss k-means++ algorithm, Lloyd’s iteration and convergence criterion in more detail along with the Python and Mojo code below. Let’s now a look at the skeleton of both Mojo 🔥 implementation and Python implementation side by side (click to zoom, best viewed when browser is full screen): At a high level you should observe: - In Python we define a class and in Mojo🔥 we define a struct - All the functions names are the same: __init__, distance_norm, _kmeans_plus_plus, fit - Function arguments in Mojo are typed and they are not in Python. - fit function have return type specified - Some function arguments have a keyword inout in front of their name If you are a seasoned Mojician🪄all this makes perfect sense to you. If you are a Python Wizard 🧙, Mojo code might look very similar to typed Python code. Unlike Python however, Mojo is a compiled language and even though you can still use def for functions and omit types like in Python, Mojo lets you declare types so the compiler can better optimize code, and improve performance. We want to make k-means ⚡fast⚡ so I chose to use Mojo🔥 native features to speed it up. Both can be used the exact same way. In Mojo: In Python: In scikit-learn: I’ve written both the Python and Mojo versions to be very similar to k-means implementation in scikit-learn: The terminal output when running all three using the run_kmeans.mojo file in GitHub is below. For this specific problem configuration where n_clusters = 5, n_samples =  3000, and n_features =  100, Mojo is faster than both our Python implementation and scikit-learn’s implementation by 13 and 6 times respectively, with all of them converging close to a similar final inertia value. Scikit-learn’s implementation converges in only 3 iterations, and yet Mojo k-means is faster even when running for 3 extra iterations. If you’re wondering why scikit-learn converges in fewer iterations, it could be one of these reasons: - Certain random initial centroids may be closer to the final centroid, and therefore help converge sooner. - Scikit-learn’s k-means implements multiple convergence criteria, whereas our implementation only checks for change in inertia value. Now let’s compare each section of the code side by side starting with class definition in Python and struct definition in Mojo and their initialization dunder method __init__(). We define all of k-means hyperparameters and algorithm options here (click to zoom, best viewed when browser is full screen). The red boxes show what changes we needed to make to port code over to Mojo. To port the Python class definition over to Mojo struct, you’ll need to make a few minor changes. - __init__() is mostly unchanged. The only modifications you’ll need to make is to add types to all arguments to __init__(). The variable self.centroids is an empty list in Python which can grow dynamically, whereas in Mojo structs are static and compile-time bound, so we declare self.centroids to be a list with a fixed capacity, equal to number of clusters. - The struct definition itself differs from the Python class definition. We declare struct just like a Python class, but since structs are static and compile-time bound, parameterized by dtype which defaults to Float64. We also define struct Fields which are initialized in the __init__() function. For more detailed comparisons between Mojo structs and Python classes see this documentation page. ### k-means fit() function in Python+NumPy and Mojo Now, let’s move on to the fit() function which runs the k-means clustering algorithm (click to zoom, best viewed when browser is full screen). The red boxes show what changes we needed to make to port code over to Mojo. The fit function implements this updated flow chart below. I’ve added line numbers (which are the same for Python and Mojo implementations), next to the corresponding step in the flowchart. In the next section we’ll learn more about each of these steps, for now let’s summarize the changes in fit() going from Python -> Mojo: - We use fn instead of def for our struct methods. While Mojo supports the same dynamism and flexibility as a Python def function, fn functions provide strict type checking and additional memory safety, which can lead to faster performance. - We add types to all function arguments and specify the return type. - fn functions require variables to be declared with var - We replace NumPy’s np.abs and np.inf with Mojo standard library’s math.abs and math.limit.inf Simple enough? Sure is! but let's address the elephant 🐘in the room: NumPy. Python has NumPy, a powerful library for numerical computing that implements high-performance matrix operations. This library has been in development for more than 20 years and implements most of its high-performance routines directly in C to maximize hardware utilization. Mojo, on the other hand, is a younger language and lacks an equivalent high-performance matrix library. I've implemented a Matrix data structure in Mojo, which provides rudimentary, NumPy-like basic matrix operations such as slicing, reductions, and element-wise mathematical operations in a fast, vectorized manner. You’ll see that all the NumPy references in the Python k-means code are replaced by Matrix in the Mojo k-means code. For example, in the function definition for fit(), you'll see that data has a type Matrix[dtype]. Note on convergence criteria (Lines 19 and 25 in the code excerpt): Since k-means is an iterative algorithm, we have to implement conditions to break from the iteration loop. In our example, we'll check for two convergence criteria: (1) the maximum number of iterations is reached, and (2) the change in inertia is below a certain threshold. In the k-means algorithm, inertia refers to the total sum of squared distances between each data point and the centroid of the cluster to which it is assigned. ### k-means plus plus initialization in Python+NumPy and Mojo Since k-means is an iterative algorithm, we must start with some initial centroids and iteratively improve them. This also means the algorithm is sensitive to the initial selection of centroids, and poor initialization can lead it to converge to local minima, resulting in suboptimal clusters. Rather than starting with random centroids, the k-means++ algorithm provides better initial centroids that are more evenly distributed, resulting in faster convergence. Below are the Python and Mojo implementations of the k-means++ algorithm (click to zoom, best viewed when browser is full screen). The red boxes highlight the changes we needed to make to port the code over to Mojo. Here’s what's happening in the above code with corresponding line number in the code excerpt: - [Line 8] Choose one data point uniformly at random from data as the first centroid - [Line 13] Iteratively find remaining k-1 centroidssome text[Line 15] For each data point in data, compute squared Euclidean distance between the point and all found centroids[Line 17] Find the minimum distance to any centroid for each data point[Line 20 - 29] Choose one new data point at random as a new centroid, using a weighted probability distribution where a new centroid is chosen with probability proportional to squared Euclidean distance to centroid.Repeat till k initial centroids are found - [Line 15] For each data point in data, compute squared Euclidean distance between the point and all found centroids - [Line 17] Find the minimum distance to any centroid for each data point - [Line 20 - 29] Choose one new data point at random as a new centroid, using a weighted probability distribution where a new centroid is chosen with probability proportional to squared Euclidean distance to centroid. - Repeat till k initial centroids are found - [Line 15] For each data point in data, compute squared Euclidean distance between the point and all found centroids - [Line 17] Find the minimum distance to any centroid for each data point - [Line 20 - 29] Choose one new data point at random as a new centroid, using a weighted probability distribution where a new centroid is chosen with probability proportional to squared Euclidean distance to centroid. - Repeat till k initial centroids are found Now let’s summarize the changes in _kmeans_plus_plus() going from Python -> Mojo: - We again use fn functions instead of def. - We declare all variables with var - We declare temporary variables in Mojo for faster performance. - We use random_si64 from the Mojo math standard library to replace NumPy’s np.random.randint - We replace np.full in the Python code with Matrix[]() in Mojo the code - We replace np.random.rand() in the Python code with random_float64() from the Mojo math standard library in the Mojo code ### Lloyd’s iteration in Python+NumPy and Mojo In the k-means algorithm, Lloyd's iteration performs two steps: - Cluster assignment: For each data point in the dataset, calculate its distance to each centroid. Assign each data point to the cluster whose centroid is closest to it. - Centroid updates: After assigning all data points to clusters, recalculate the centroids as the mean of all data points assigned to each cluster. Below is Python and Mojo implementation of k-means plus plus algorithm (click to zoom, best viewed when browser is full screen). The red boxes show what changes we needed to make to port code over to Mojo. Here’s what's happening in the above code with corresponding line number in the code excerpt: - [Line 5] For each data point in the dataset, calculate its distance to each centroid. - [Line 7] Assign each data point to the cluster whose centroid is closest to it. - [Line 10 - Line 12] Recalculate the centroids as the mean of all data points assigned to each cluster. - [Line 14] Calculate inertia Now let’s summarize the changes in _lloyds_iteration() going from Python -> Mojo: - We added types to function arguments - We declare all variables with var - We replaced NumPy operations to calculate mean and sum with Matrix[]() equivalent in Line 12 We’re at the home stretch here! Let’s take a look at our final function. ### Calculating squared Euclidean distance Python+NumPy and Mojo The most computationally intensive part of the k-means algorithm is typically the cluster assignment step which involves calculating the distance between each data point and each centroid to determine which centroid is closest to each point. Accelerating the distance calculation can significantly speed up each Lloyd’s iteration step and k-mean clustering as a whole. While Python relies on NumPy’s fast implementation of Euclidean distance calculation implemented in C language and exposed via np.linalg.norm(). In Mojo we’ll implement this from scratch by tapping into the full power of Mojo’s ease of use vectorization and parallelization support. In this section Python and Mojo code will look nothing alike (but if you are free to imagine a big blob of C code that you trust, has got your back). Below is Python and Mojo implementation of k-means plus plus algorithm (click to zoom, best viewed when browser is full screen). The red boxes show what changes we needed to make to port code over to Mojo. Here’s what's happening in the above code with corresponding line number in the code excerpt: - [Line 2] In the function definition we added the inout keyword infront of centroids_distance to receive a reference to the data structure that is mutable. i.e. changes to centroids_distance will be reflected outside the function, so we don’t need to make copies of the data structure. NumPy arrays work this way by default in Python. - [Line 7] defines a closure that calculates distance between all data points in data to the centroid/cluster number idx_centroid in the argument. Writing a function this way enables us to call Mojo’s parallelize function, so we can calculate centroid distances for each cluster in parallel. - [Line 8] starts the outer loop that iterates over rows of data and calculates the distance between the data points in loop variable idx_mat_row and the current centroid in idx_centroid. - [Line 11 - Line 19] includes the inner loops that calculate the squared norm between the data points in idx_mat_row of data and data points in centroid number idx_centroid, in a vectorized way. By operating on simd_width elements simultaneously, we can get huge speedup depending on the value of simd_width on your system. Since simd_width is a power of 2 we include a second loop on line 15 to processes the elements from floor(data.cols / simd_width) * simd_width to data.cols  Now let’s summarize the changes in distance_norm() going from Python -> Mojo: - We implemented vectorized and parallelized squared Euclidean norm calculation from scratch. - We leveraged SIMD (Single Instruction, Multiple Data) operations using special CPU registers that can process multiple bits of data at the same time. Phew. If you are a Python developer with no background in system’s programming languages like C or C++ the code above was probably hard to follow. I could have alternatively written a much simpler looking loop that didn’t take advantage of vectorization and parallelization to make it look like Python code, by trading off some performance. But therein lies the beauty of Mojo. You can write code that looks like Python for non-performance critical code and roll up your sleeves and write low-level code when performance matters. Mojo🔥 meets you where you are. ### Running and benchmarking both Python+NumPy and Mojo k-means implementations The example on GitHub includes two files to test our implementations: run_kmeans.mojo and bench_kmeans.mojo. #### run_kmeans.mojo This file shows you how to create some test data with a specified number of clusters and cluster it using Python+NumPy, Mojo and scikit-learn implementation of k-means. It also includes an option to generate 2-dimensional scatter plots of the 1st and 2nd principal components to visualize high-dimensional data. Here is a simple example of how to cluster some synthetic data with n_samples = 3000, n_features = 200 and n_clusters = 10 generated using scikit-learn's make_blobs function. Partial output: You can see that all three implementations converge to a similar final inertia value. You will, however, see run-to-run variations due to the inherent randomness of the k-means algorithm. #### bench_kmeans.mojo This file implements a very simple benchmarking setup to compare the performance of Python+NumPy, Mojo, and scikit-learn implementations of k-means. It also generates benchmarking plots shown below (click to zoom). To test the performance of both implementations, in bench_kmeans.mojo we specify the ranges of values to sweep for the benchmark. When we sweep one variable, we keep the other two constant and plot the results. Note that the ranges and the choice of variable values that are held constant are arbitrary. Feel free to run bench_kmeans.mojo with different ranges and measure performance. Since the k-means algorithm is sensitive to random initial centroids, one implementation may converge sooner than the other, potentially running much quicker. To make the comparison fairer, we can set the k-means argument run_till_max_iter=True, which will force the algorithm to run until max_iterations even if the convergence criterion has been met. Below, you can see plots of the time taken to run until the default max_iterations = 10 when sweeping cluster size, number of samples, and number of features. The values that are held constant are displayed at the bottom of each plot. For these ranges, we observe speedups ranging from 6x to 250x when using Mojo🔥. Each experiment runs for 10 full iterations with other convergence criteria disabled, providing a fair comparison of performance. In our implementation, I noticed that: - In Plot 1, scaling the number of clusters results in higher speedups, since we compute the distance between data points and clusters much more frequently. Mojo🔥's vectorized and parallelized code is significantly faster at computing distances. - In Plot 2, scaling the number of samples shows a more consistent distribution, with a median speedup of approximately 150x. - In Plot 3, scaling the number of features results in a decreasing speedup as the number of feature columns increases, due to the limited number of cores available on my MacBook Pro with M2 Pro. I expect that on a system with more cores, the speedup would be consistent. Click to zoom, Best viewed when browser is full screen: ### Conclusion I hope you enjoyed reading this primer on the k-means algorithm and how you can translate computationally intensive code from Python to Mojo🔥 for faster performance. Building an end-to-end example like this k-means clustering implementation is a great way to learn how to use a new programming language. Please take this code, modify it, test it and run your own experiments with it. You can also use it to implement other ideas using the building blocks from this example. One cool example could be k-nearest neighbor search for Retrieval Augmented Generation (RAG) applications which also relies on fast euclidean Distance calculations. Join our Discord community and share your projects with other Mojicians🪄! Thank you for reading! Here are some additional resources to get started. - Get started with downloading Mojo - Head over to the docs to read the programming manual and learn about APIs - Explore the examples on GitHub - Join our Discord community - Contribute to  discussions on the Mojo GitHub - Read and subscribe to Modverse Newsletter - Read Mojo blog posts, watch developer videos and past live streams - Report feedback, including issues on our GitHub tracker Until next time🔥! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Shashank Prasanna AI Developer Advocate Shashank is an engineer, educator and doodler. He writes and talks about machine learning, specialized machine learning hardware (AI Accelerators) and AI Infrastructure in the cloud. He previously worked at Meta, AWS, NVIDIA, MathWorks (MATLAB) and Oracle in developer relations and marketing, product management, and software development roles and hold an M.S. in electrical engineering. ================================================================================ URL: https://www.modular.com/blog-all?topic=Developer PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/whats-new-in-max-24-4-max-on-macos-fast-local-llama3-native-quantization-and-gguf-support PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 25, 2024 # What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support Ehsan M. Kermani In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. In this blog post, we will explore various features of MAX Pipelines and their benefits for GenAI applications such as native GGUF, tokenizer and quantization support. To follow along, please ensure you have installed MAX 24.4. Note that MAX now ships with Mojo for all platforms. If you previously installed a standalone version of Mojo, you should uninstall it and install MAX instead. After installing MAX, you should get the following hash release when running max -v ### Get Started with MAX Pipelines Let’s start with running quantized Llama3 pipeline in pure Mojo locally as follows On my M3 MacBook Pro, it outputs Fantastic 🎉 now we are ready to explore more features. #### Native GGUF Support in Mojo ‍GGUF has become a standard file format for storing models for inference workload and specially is suitable for single-file deployment of LLMs. MAX Pipelines natively supports gguf in Mojo. GGUF specification is as follows Our native implementation parses GGUF file format in preparation for inference ensuring optimal performance and integration within MAX Pipelines. This feature is fully integrated, allowing developers to efficiently load and utilize GGUF models without additional configuration. #### Native Tokenizer Support in Mojo MAX Pipelines provides native Mojo support for tokenizer, enabling efficient text preprocessing directly within your Mojo applications. This integration offers several benefits, ensuring that your Generative AI models can handle natural language input with high performance and accuracy. #### Quantization Support Quantization is a well-known technique to reduce memory and computational costs of running deep learning models. MAX Pipeline supports llama.cpp quantization encoding such as - Q4_0: 4-bit block quantization where weights are divided in blocks of 32 weights. The scale of each block is stored as float16 format. - Q4_K:  4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. The scale and minimum of each super-block are stored as float16. The scales and minimums of each block in a super-block are quantized with 6-bits. On average, this ends up using 4.5 bits-per-weight. - Q6_K: 6-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. The scale of each super-block is stored as float16. The scale of each block is quantized with 8 bits. On average, this ends up using 6.5625 bits-per-weight. Here is a visual demonstration of these quantization schemes We generally recommend using Q4_K for the best performance and memory use. The higher bit quantization encoding such as Q6_K is useful when we want to trade more memory for higher accuracy. These advanced quantization approaches are typically only supported in specialized AI frameworks like llama.cpp, but MAX makes them accessible to a much wider range of models very easily. For more details, please refer to llama.cpp here. The run_pipeline.🔥  comes with various CLI options such as changing the quantization encoding (default is Q4_K) as follows which outputs #### MAX Pipeline Seamless Integration with PyTorch and HuggingFace MAX Pipeline integrates seamlessly with the PyTorch and HuggingFace tokenizer as well. allowing developers to leverage the powerful tools and libraries from these ecosystems. This integration ensures that you can build and deploy advanced AI models using familiar frameworks while benefiting from the performance and efficiency enhancements provided by MAX. For example, in Llama2 pipeline, we proceed by installing the transformers package via and we can use it with the llama2 option where it generates #### MAX Graph Custom Operator ‍MAX Graph API enables creating custom operators which is useful for writing highly customized graph level operators. Particularly for Llama2, MAX Pipelines has a custom Rotary Embedding (RoPE) operator here. We can invoke such custom operator via which gives us To learn more about MAX Graph Custom Operator, please visit our MAX Graph API Tutorial. #### Example API We are iterating rapidly on the MAX Pipelines to deliver best-in-class APIs for MAX developers. Our goal is to make MAX Pipelines more accessible, powerful, and easy to use. One such example can be obtained from here which showcases the capabilities and ease of use of MAX Pipelines, ensuring that developers can quickly integrate and benefit from our advancements. Below is an example to illustrate this which generates this joke We can also use the integrated tokenizer and tokenize our prompt with outputs By following these simple steps, developers can take full advantage of the advanced features provided by MAX Pipelines. This example API is designed to be intuitive and developer-friendly, allowing for quick integration and immediate productivity. ### Next Steps We are very excited to see what you can accomplish using MAX Pipelines. Please share your creations and innovations with the community. Here are a few options to get you started: - Explore the various examples and templates provided in the MAX repository. - Experiment with different quantization formats and tokenizers to optimize your models. - Utilize the GGUF file format for efficient model storage and deployment. - Share your projects and experiences on forums, social media, and the Modular AI community. - Use MAX Pipelines to build state-of-the-art AI models tailored to your specific needs. Deploy your models on various platforms, including macOS, Intel x86, and ARM Graviton cloud-serving infrastructure. Leverage the performance enhancements of the Quantization API to optimize your Generative AI pipelines. ### Conclusion The release of MAX 24.4 is a great progress on the unification of AI development tools. With the introduction of MAX on macOS and MAX Pipelines featuring native support for Generative AI models such as Llama3, developers now have unprecedented capabilities to build and deploy advanced AI models efficiently. This release brings together powerful features like the Quantization API, native GGUF, and tokenizer support, providing a comprehensive toolchain for creating high-performance AI solutions. Throughout this blog post, we have explored various features of MAX Pipelines and their benefits for Generative AI applications. From running quantized Llama3 models in pure Mojo to leveraging the integrated tokenizer and quantization support, MAX Pipelines offer a robust and flexible framework for AI development. #### Key Takeaways for Developers - Native GGUF Support: Simplifies model storage and deployment with efficient single-file format. - Integrated Tokenizers: Ensures efficient text preprocessing and seamless integration with Generative AI models. - Quantization Support: Reduces memory and computational costs, enabling the deployment of large models on local machines. - Seamless Integration: Works effortlessly with PyTorch and HuggingFace, allowing the use of powerful tools and libraries from these ecosystems. - Custom Operators: Provides the ability to create highly customized graph-level operators, enhancing model performance and flexibility. By following the steps and examples provided, developers can take full advantage of the advanced features in MAX Pipelines, ensuring optimal performance and ease of use. Whether you're working on macOS, Intel x86, or ARM Graviton cloud-serving infrastructure, MAX 24.4 empowers you to build state-of-the-art AI models tailored to your specific needs. We’re excited to see what you build with MAX 24.4 ⚡️ and Mojo 🔥! - Get started with MAX 24.4. - Read the MAX ⚡️ docs and the Mojo🔥 manual. - Learn about the new quantization APIs. - Explore the MAX pipeline examples on GitHub. - Join our Discord community. - Read and subscribe to Modverse Newsletter. - Read Mojo blog posts, watch developer videos and past live streams. Until next time! 🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Ehsan M. Kermani AI DevRel Ehsan is a Seasoned Machine Learning Engineer with a decade of experience and a rich background in Mathematics and Computer Science. His expertise lies in the development of cutting-edge Machine Learning and Deep Learning systems ranging from Natural Language Processing, Computer Vision, Generative AI and LLMs, Time Series Forecasting and Anomaly Detection while ensuring proper MLOps practices are in-place. Beyond his technical skills, he is very passionate about demystifying complex concepts by creating high-quality and engaging content. His goal is to empower and inspire the developer community through clear, accessible communication and innovative problem-solving. Ehsan lives in Vancouver, Canada. ================================================================================ URL: https://www.modular.com/blog/max-24-4-introducing-quantization-apis-and-max-on-macos PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 7, 2024 # MAX 24.4 - Introducing quantization APIs and MAX on macOS Modular Team Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. Release highlights: - New Quantization API for MAX Graphs: Reduce LLM inference latency by 7x compared to llama.cpp context encoding through decreased memory usage and improved performance with the new Quantization API. MAX Graph supports BF16, INT4, and INT6 quantization, including K-Quantization. - Llama on MAX: MAX 24.4 includes new implementations of  Llama 3 and Llama 2, demonstrating the full power of MAX Graphs and the Quantization API! - MAX on macOS: Everything you love about MAX is now available on Apple silicon, further enhancing MAX’s programmability and portability. Developers can build state-of-the-art AI pipelines locally and seamlessly deploy them to cloud systems like Intel x86 and ARM Graviton. - Mojo 🔥 Improvements: Mojo 24.4 features several performance improvements to the core language and standard library. For the core language, def functions are more flexible, and advanced users will appreciate more advanced loop unrolling features, the ability to return safe references, and many others. - Community-Driven Innovation: Mojo 24.4 features 214 community pull requests from 18 contributors, with 30 contributed features accounting for 11% of all improvements in the latest Mojo release. These include performance and quality-of-life improvements to the standard library collections, new data and filetype operations, and updates to SIMD bitwise operations. You can find a complete list of contributors and enhancements in the Mojo 24.4 release notes. You can get started with MAX 24.4 now through the Modular developer console or by installing it directly from your terminal: Head over to the MAX documentation for complete instructions on installing or updating MAX. ### Quantization API The new MAX Quantization API is a huge step in bringing state-of-the-art performance to models built with MAX Graphs. Why does quantization matter? Token generation in LLMs is memory-bound, and reducing the size of the model weight from FP32 to INT4 proportionally improves performance without significantly impacting model quality. Reduced model size also decreases the hardware requirements for running LLMs, making models more widely available and cost-effective to run. MAX’s quantization API makes transitioning from full precision to INT4 quantization easier, a massive win for the MAX and Mojo developer communities. ### New Quantized Llama Models To highlight the power of MAX’s quantization API, we’re releasing two new quantized LLMs as part of the MAX 24.4 release: Llama 3 and Llama 2. These models are built entirely in Mojo 🔥 using the MAX Graph API. These models are the first of a series to meet a need for State-Of-The-Art LLMs that are performant and portable across all CPU types. You can download Llama 3 now and try it out! Read more in the MAX Getting Started guide. ### MAX on MacOS MAX is now available for macOS, delivering the full suite of acceleration and inference APIs to Apple silicon. This includes the new, fully quantized Llama3 model, which has a more than 8x performance boost in context encoding using INT4 compared to F32. Developers can seamlessly transition from building SOTA models on their development machines to putting them into production on Intel x86 and ARM Graviton cloud-serving infrastructure. We’re excited to expand the portfolio of hardware platforms supported by MAX, delivering on the promise of programmability and portability. You can get started with MAX on macOS today! ### New Developer Resources To support our growing community of developers and users, we’ve completely reworked our documentation to focus on the user journey with MAX. There’s now a single API reference to cover the entire MAX platform and a new Getting Started guide that makes it faster and easier to get MAX up and running. This new experience makes it easier to understand and use all of MAX’s capabilities, and we’re excited to see what the Mojo and MAX communities will build! In addition to the refreshed docs, we’re excited to announce Modular AI resources: a centralized hub for the latest and most relevant research papers on LLMs, Generative AI, and optimized ML systems. ### 🚀 Get Started with MAX 24.4! Download MAX 24.4 now to get started with the new MAX Graph Quantization API, and start accelerating your models now. Read the docs to learn more, and check out our examples on how to run llama3 with the MAX Engine. We’re excited to see what you build with MAX 24.4 ⚡️ and Mojo 🔥! - Get started with MAX 24.4. - Read the MAX ⚡️ docs and the Mojo🔥 manual. - Learn about the new quantization APIs. - Explore the MAX pipeline examples on GitHub. - Join our Discord community. - Read and subscribe to Modverse Newsletter. - Read Mojo blog posts, watch developer videos and past live streams. Until next time! 🔥 🏆 Special thanks to our community contributors: @rd4com, @toiletsandpaper, @helehex, @artemiogr97, @mikowals, @kernhanda, @lsh, @LJ-9801,@YichengDWu, @gabrieldemarmiesse, @fknfilewalker, @jayzhan211, @martinvuyk, @ChristopherLR, @mzaks, @bgreni, and @Brian-M-J. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/blog/max-24-3-introducing-max-engine-extensibility PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 2, 2024 # MAX 24.3 - Introducing MAX Engine Extensibility Modular Team Today, we’re thrilled to announce the launch of MAX 24.3, highlighting a preview of the new MAX Engine Extensibility API that allows developers to unify, program, and compose their AI pipelines on top of our next-generation compiler and runtime stack for best-in-class performance. MAX Engine is a next-generation compiler and runtime library for running AI inference. With support for PyTorch (TorchScript), ONNX, and native Mojo models, it delivers low-latency, high-throughput inference on a wide range of hardware to accelerate your entire AI workload. Furthermore, the MAX platform empowers you to harness the full potential of the MAX Engine through the creation of bespoke inference models using our MAX Graph APIs. In this release, we continue to build on our incredible technology foundation to improve programmability of MAX for your workloads with 24.3 features including: - Custom Operator Extensibility: Write custom operators for MAX models using the Mojo programming language for intuitive and performant extensibility. - Mojo 🔥 Improvements: The Mojo language and standard library continues to mature, with key improvements that will be welcomed by Python experts. This includes enhancements to built-in types like Tuple and support for in function types for both optional and variadic arguments. Read the What’s New in Mojo 24.3 blog post and check out the complete list of changes in the Mojo 24.3 changelog. - Less Dependencies and Smaller Package Size: TensorFlow support has been removed from the standard MAX package, making it 60% smaller, resulting in faster download times and fewer dependencies. TensorFlow is still available for enterprise users. Contact us for more information. - Community-Driven Innovation: Following on open sourcing the Mojo standard library, this release includes the first community-submitted PRs to the Mojo standard library – featuring 32 significant community contributions, improving on the built-in types and usability of the Mojo standard library. Together with our amazing community, we’re shaping the future of AI development! ### Custom Operators One of the major features of the MAX 24.3 release is a preview of the ability to easily work with custom operations when building AI pipelines. If you’re new to custom operations in AI pipelines, they refer to an operations that you define and implement on your own. This matters a lot when you want to build novel mathematical operations or algorithms that might not ship out-of-the-box in AI frameworks like PyTorch or ONNX, if you need to optimize performance for specific tasks, or if you need to utilize hardware accelerations that are not natively supported in these frameworks. Writing custom operations in frameworks like PyTorch and ONNX is challenging because: - They are far too slow when implemented in Python. - Implementing them in low-level languages like C++ and CUDA requires deep expertise. - There’s no guarantee your custom operation will work consistently across different hardware platforms. - Maintaining custom ops to work with new framework updates is incredibly challenging. In addition to all this, the API surfaces that you have to develop with to implement custom operations are incredibly ugly when implementing, registering, building and executing your workload. The traditional AI stack is fragmented and slows down AI innovation for everyone. It doesn’t have to be this hard Imagine a world where you can write a custom operation for your AI workload that seamlessly executes across hardware, compiles cleanly, and generates platform independent packages. It's as easy as writing, packaging and executing your op – and that's it. And rather than tell you, let’s see how easy it is using an example from our docs. Let's start by adding a custom op like the Det op since this op is currently not supported in MAX Engine so any ONNX model using this op fails to compile. To add it, we start by writing the op in Mojo: To package the custom op, create a directory that includes the above Mojo code, plus an empty __init__.mojo file. Then, pass that directory name to the mojo package command like below: And then all we have to do is load our ONNX model into MAX Engine with the custom op and run inference with the Python API: And boom 💥 the ONNX model with our new op is optimized and executing: And that's not all …. Not only can you add custom operators to existing models like ONNX and Pytorch, you can also write your own MAX Graphs with custom operation extensions using Mojo - a much cleaner, more performant and more dependency free offering. We have made the whole process of building and implementing a custom operation much easier for everyone with MAX Graphs as a completely clean approach. You can also benefit when using MAX Graph API: - AI Pipelines Unification: Centralize all your AI workflows with a single source of truth. By utilizing Mojo for authoring kernels, developers write kernels once and can reuse them across different ML frameworks by simply adding one annotation ensuring seamless integration and fewer discrepancies. - Accelerated Development Cycle: Experience a smoother, faster development process with no need for traditional build processes, linkers, or C++ compilers. MAX Engine simplifies your workflow, allowing you to iterate and deploy rapidly. - Built-in Performance Optimization: Leverage automatic kernel fusion and graph optimizations with the MAX Engine runtime for free, letting you focus on building your AI pipelines rather than optimization. - Zero Cost Abstractions: MAX Engine and Mojo being built on top of MLIR take full advantage of modern compilers. Your code is inlined and participates directly in the compiler's optimization phases, enhancing efficiency and reducing overhead. - Portability: MAX Engine ensures that your Mojo code is portable across diverse platforms and hardware setups, as long as they support LLVM or MLIR. This provides hardware optionality and frees you from platform-specific constraints, broadening your deployment options. Check out some MAX Graph API examples here - we have a lot more incredible additions coming to MAX Graphs soon. ### Download MAX 24.3 Now 🚀 MAX 24.3 is just the beginning of some incredible updates we're delivering on our MAX roadmap, with MacOS support and Quantization coming soon and GPUs coming this summer. Head over to the Modular Developer Portal now to download MAX 24.3 and get started. Read the docs to learn more, check out our examples to learn how to build custom operators for the MAX Engine, and share your feedback on how we can improve upon this preview release. We’re excited to see what you build with MAX 24.3 and Mojo. Get started with MAX and Mojo now! - Download MAX and Mojo. - Head over to the docs to read the Mojo🔥 manual and learn about APIs. - Explore the extensibility examples on GitHub. - Join our Discord community. - Contribute to  discussions on the Mojo GitHub. - Read and subscribe to Modverse Newsletter. - Read Mojo blog posts, watch developer videos and past live streams. - Report feedback, including issues on our GitHub tracker. Until next time! 🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/blog/max-24-2-is-here-whats-new PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: March 28, 2024 # MAX 24.2 is Here! What’s New? Modular Team Today, we’re excited to announce general availability of MAX 24.2, with several big features. First, we're thrilled to share the next evolution of Mojo 🔥, open sourcing the Mojo standard library. Open sourcing the standard library gives our growing developer community an active voice in its development, and is an invitation to contribute directly to Mojo. As part of this commitment and to facilitate community development, we’re also releasing Mojo nightly builds that include the latest language development features. The open source release of the Mojo standard library is available now on GitHub. Second, MAX 24.2 ships with significant enhancements to the MAX engine and the Mojo programming language. MAX 24.2 and Mojo builds are available directly through the Modular command line interface. ⚡Read on to learn more! ## Open sourcing the Mojo standard library At Modular, we believe that the future of AI and machine learning must be open source. Since its launch in May of 2023, we’ve been on a path to gradually open source Mojo and core parts of the MAX platform, and today we are open sourcing the Mojo Standard Library under the Apache 2 license on GitHub. This release is a big deal - including nightly builds, a new contribution model, and a roadmap for the standard library.  Beyond providing access to the code, we're opening the development processes. For more information on what's next and how to contribute, read our detailed post: “The Next Big Step in Mojo 🔥 Open Source.” ## MAX Engine enhancements 🏎️ The most significant new feature in MAX 24.2 is support for dynamic tensor input shapes in TorchScript models. This addition to MAX’s TorchScript capabilities greatly increases the usability of MAX-compiled models, especially for applications like LLMs where the entire input size isn’t known at compile time. Additionally, dynamic input shapes make it possible to run with dynamic batch sizes and removes the need for input padding, offering performance improvements to your inference pipeline. Learn more about the updates to MAX 24.2 in the article “Leveraging MAX Engine's dynamic shape capabilities.” ## New features in Mojo 🔥 MAX 24.2 ships with the latest version of Mojo, which includes a number of language improvements. One of the biggest features that will make Python fans rejoice is the addition of keyword arguments to the Python integration layer. This feature greatly simplifies mixing Mojo and Python, and vastly improves the use of popular libraries like matplotlib. matplotlib Following more closely to the Python convention of duck typing, structs and other nominal Mojo types are now allowed to implicitly conform to traits. This makes it much easier to write new types that can take advantage of built-in traits like Stringable, simplifying your code while still giving Mojo's strong assurances of flexibility, safety, and performance of compile-time traits. Stringable The Mojo changelog contains a list of improvements showcasing all the Mojo language improvements and additions. ## Get started MAX 24.2 and Mojo nightly builds are available using the modular tool. To get started, download the Modular CLI from the Modular developer portal, which you can use to install the MAX 24.2 release and the latest Mojo nightly build. modular ### Install MAX 24.2 MAX 24.2 is available for Linux on x86 and ARM platforms. You can install it with: modular install max modular install max You can upgrade with: modular upgrade max modular upgrade max ### Install Mojo nightlies Mojo nightlies are available for Linux on x86 and ARM platforms and MacOS. You can install them with: modular install nightly/mojo modular install nightly/mojo ## Join the Modular community! To learn more about MAX, and get involved with the Modular community: - Download MAX 24.2 and Mojo. - Read more about “The next big step in Mojo 🔥 open source.” - Learn about MAX 24.2 support for TorchScript in “Leveraging MAX Engine's dynamic shape capabilities.”‍ - Connect with users and devs in our Discord community. - Report feedback, including issues on our MAX and Mojo GitHub tracker. We're thrilled to share this latest release of MAX with you. Building a language and its infrastructure is hard work and takes time, and we’re excited to invite developers worldwide to help shape the development of Mojo and the future of AI infrastructure! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-41 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: August 16, 2024 # Modverse Weekly - Issue 41 Jack Clayton The Mojo Community Meeting has been renamed to the MAX + Mojo Community Meeting. We explained how we combined Mojo and MAX, and updated the license for both to ensure you can be confident building free (and open source) technologies, as well as using Mojo and MAX for your own commercial projects. We also shared our plans to remove auth from the download experience for Mojo and MAX, the availability of conda packages for easy integration into your applications, and a new magic CLI which makes it all reliable and lightning fast. ### Blogs, Tutorials, and Videos - Check out the 6th Max + Mojo Community Meeting‍Soren presented his fantastic Mojo bindings to DuckDB which shows how you can use Mojo's strong type system to interop with a C++ library.Gabriel gave an insightful presentation on small string optimizations in Mojo - Soren presented his fantastic Mojo bindings to DuckDB which shows how you can use Mojo's strong type system to interop with a C++ library. - Gabriel gave an insightful presentation on small string optimizations in Mojo - Modular was listed as one of the most promising startups of 2024 on Business Insider - Learn about how to deploy a MAX model on AWS with SageMaker and CloudFormation - EKB PhD published a video on Mojo's dictionary performance improvements - Soren presented his fantastic Mojo bindings to DuckDB which shows how you can use Mojo's strong type system to interop with a C++ library. - Gabriel gave an insightful presentation on small string optimizations in Mojo ### Awesome Mojo You can discuss these projects with the creators in the Discord forum: # community-showcase - Frank released libcurl bindings for Mojo - thatstoasty has a gist for reading from stdin in Mojo. We'll add this to the stdlib soon. - Helenex released a geometric algebra generator named infrared. - Jensen released a TCP framework with a server and client named FireTCP - rd4com created a repo for generating Neovim themes in realtime ### Open Source Contributions Check out all the open source contributions here.  make sure to DM Jack Clayton on Discord if you've had your first PR merged to claim some epic Mojo swag! Check out the merged contributions this week from our valuable community members: - soraros[stdlib] Remove String constructor from PythonObject[stdlib] Use infer only in bit - [stdlib] Remove String constructor from PythonObject - [stdlib] Use infer only in bit - gabrieldemarmiesse[stdlib] Use memcpy in List._realloc for x13.2 speedups in some benchmarks - [stdlib] Use memcpy in List._realloc for x13.2 speedups in some benchmarks - pythoncrazy[Docs] Clarify the rounding in the builtin math module. - [Docs] Clarify the rounding in the builtin math module. - jlofti[stdlib] Added example to Powable docstring - [stdlib] Added example to Powable docstring - helehex[stdlib] Move InlineArray into collections module[stdlib] Fix TODO in /test_string.mojo - [stdlib] Move InlineArray into collections module - [stdlib] Fix TODO in /test_string.mojo - msaelices[stdlib] Fix TODO item about using os.path.split() in tempfile test - [stdlib] Fix TODO item about using os.path.split() in tempfile test - [stdlib] Remove String constructor from PythonObject - [stdlib] Use infer only in bit String PythonObject bit - [stdlib] Use memcpy in List._realloc for x13.2 speedups in some benchmarks List._realloc - [Docs] Clarify the rounding in the builtin math module. - [stdlib] Added example to Powable docstring Powable - [stdlib] Move InlineArray into collections module - [stdlib] Fix TODO in /test_string.mojo InlineArray /test_string.mojo - [stdlib] Fix TODO item about using os.path.split() in tempfile test ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 40August 1, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 40 August 1, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-40 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: August 1, 2024 # Modverse Weekly - Issue 40 Jack Clayton Last week we began alpha testing our new magic CLI for installing Mojo and MAX through the Conda ecosystem. It allows you to pin Mojo/MAX to different versions, and add Python dependencies so you can reliably share your Mojo and MAX projects. If you want to try it out before release, you can find the doc for installing it here. We also launched a new tutorials page for our docs, our first tutorials are: - Deploy a model with Kubernetes and Helm - Deploy a model with Amazon SageMaker and AWS CloudFormation - Get started with MAX Graph - Create a custom op for an ONNX model - Run an ONNX model with Python ### Blogs, Tutorials, and Videos - Talha published a LinkedIn blog on implementing Yolo in pure Mojo - Learn about Debugging in Mojo🔥 - Chris Lattner presented at the AI Engineer World's Fair: Unlocking Developer Productivity across CPU and GPU with MAX - Chris Lattner sat down with Primeagen to discuss Mojo and the history leading him into building the language. - Check out the Mojo Community Meeting #4 and #5 - Read about our internal tool we made public for managing a stack of PRs: stack-pr ### Awesome Mojo You can discuss these projects with the creators in the Discord forum: # community-showcase - TiliFe released the first ML framework with autodiff built on top of MAX: Endia. Check out how familiar the API is to both PyTorch and JAX developers (click the GIF to enlarge it): - Frank released Mojo FFI bindings to blend2d - Frank also released image manipulation libraries for Mojo: box_blur_mojo, haldcut-mojo‍ - Soren released Mojo FFI bindings to DuckDB‍ - Dmitry released a Mojo library for calling into io_uring on x86-64 linux: io_uring‍ - Krisztian built an Apache Arrow implementation in Mojo: firebolt‍ - Krisztian also released a GitHub action for installing Mojo: setup-mojo‍ - Ethan released a very fast MatMul implementation that outperforms Numpy in pure Mojo: matmul.mojo‍ - Toasty released a bound logger library for Mojo: stump - Melody released a devcontainer for setting up Mojo with Neovim: mojo-nvim-devcontainer-cli ### Open Source Contributions Check out all the open source contributions here.  make sure to DM Jack Clayton on Discord if you've had your first PR merged to claim some epic Mojo swag! Check out the merged contributions this week from our valuable community members: - leandrolcampos[stdlib] Add has_fma function to sys package - [stdlib] Add has_fma function to sys package - helehex[stdlib] Add equality methods to Reference - [stdlib] Add equality methods to Reference - soraros‍[stdlib] Use inferred-only in rebind[stdlib] Fix argument convention for iota[stdlib] Cleanup polynomial.mojo, improve docstring[stdlib] fix math.gcd for negative numbers[stdlib] Simplify several methods in the UnsafePointer struct[stdlib] Modernise Span.__[eq/ne]__ with latest conditional conformance support[stdlib] Move to EqualityComparableCollectionElement - [stdlib] Use inferred-only in rebind - [stdlib] Fix argument convention for iota - [stdlib] Cleanup polynomial.mojo, improve docstring - [stdlib] fix math.gcd for negative numbers - [stdlib] Simplify several methods in the UnsafePointer struct - [stdlib] Modernise Span.__[eq/ne]__ with latest conditional conformance support - [stdlib] Move to EqualityComparableCollectionElement - gabrieldemarmiesse[stdlib] Rename _get_reference_unsafe to unsafe_get in InlineArray[stdlib] Move find() from StringRef to StringSlice[stdlib] Add a few explicit copy constructors[stdlib] Abort on list resize to bigger sizes without fill value - [stdlib] Rename _get_reference_unsafe to unsafe_get in InlineArray - [stdlib] Move find() from StringRef to StringSlice - [stdlib] Add a few explicit copy constructors - [stdlib] Abort on list resize to bigger sizes without fill value - jjvraw[stdlib] Remove obsolete FIXME[stdlib] Extend tests for SIMD.__pow__[stdlib] Remove _div_ceil_positive in favour of math.ceildiv[stdlib] Remove duplicate test from PR #3279[stdlib] Allow !r conversion flag in String.format[stdlib] Fix atol parsing for prefixed integer literals with leading underscores[stdlib] __contains__ for ListLiteral - [stdlib] Remove obsolete FIXME - [stdlib] Extend tests for SIMD.__pow__ - [stdlib] Remove _div_ceil_positive in favour of math.ceildiv - [stdlib] Remove duplicate test from PR #3279 - [stdlib] Allow !r conversion flag in String.format - [stdlib] Fix atol parsing for prefixed integer literals with leading underscores - [stdlib] __contains__ for ListLiteral - mzaks[stdlib] Add string justify methods - [stdlib] Add string justify methods - shayan-shams[docs] Add str() in print_many() in Functions - [docs] Add str() in print_many() in Functions - vguerra[stdlib] UTests for SIMD's operators required by Comparable‍[stdlib] UTests for FloatLiteral's operators required by Comparable - [stdlib] UTests for SIMD's operators required by Comparable‍ - [stdlib] UTests for FloatLiteral's operators required by Comparable - [stdlib] Add has_fma function to sys package has_fma sys - [stdlib] Add equality methods to Reference Reference - [stdlib] Use inferred-only in rebind - [stdlib] Fix argument convention for iota - [stdlib] Cleanup polynomial.mojo, improve docstring - [stdlib] fix math.gcd for negative numbers - [stdlib] Simplify several methods in the UnsafePointer struct - [stdlib] Modernise Span.__[eq/ne]__ with latest conditional conformance support - [stdlib] Move to EqualityComparableCollectionElement rebind iota polynomial.mojo math.gcd UnsafePointer Span.__[eq/ne]__ EqualityComparableCollectionElement - [stdlib] Rename _get_reference_unsafe to unsafe_get in InlineArray - [stdlib] Move find() from StringRef to StringSlice - [stdlib] Add a few explicit copy constructors - [stdlib] Abort on list resize to bigger sizes without fill value _get_reference_unsafe unsafe_get InlineArray find() StringRef StringSlice - [stdlib] Remove obsolete FIXME - [stdlib] Extend tests for SIMD.__pow__ - [stdlib] Remove _div_ceil_positive in favour of math.ceildiv - [stdlib] Remove duplicate test from PR #3279 - [stdlib] Allow !r conversion flag in String.format - [stdlib] Fix atol parsing for prefixed integer literals with leading underscores - [stdlib] __contains__ for ListLiteral FIXME SIMD.__pow__ _div_ceil_positive math.ceildiv !r String.format __contains__ - [stdlib] Add string justify methods - [docs] Add str() in print_many() in Functions str() print_many() - [stdlib] UTests for SIMD's operators required by Comparable‍ - [stdlib] UTests for FloatLiteral's operators required by Comparable SIMD Comparable FloatLiteral Comparable - jiex-liu[stdlib] Implement remaining int fns for bit module - [stdlib] Implement remaining int fns for bit module - codingonion[examples] Fix typo in examples/matmul.mojo[stdlib] Fix typo in intrinsics.mojo[stdlib] Fix typo in simd.mojo - [examples] Fix typo in examples/matmul.mojo - [stdlib] Fix typo in intrinsics.mojo - [stdlib] Fix typo in simd.mojo - msaelices[stdlib] Implement Dict.setdefault(key, default)[stdlib] Implement collections.Counter - Part 2[stdlib] Disallow implicit float to int conversions in SIMD types - [stdlib] Implement Dict.setdefault(key, default) - [stdlib] Implement collections.Counter - Part 2 - [stdlib] Disallow implicit float to int conversions in SIMD types - yinonburgansky[stdlib] write_to(writer, ...) -> writer.write(...) - [stdlib] write_to(writer, ...) -> writer.write(...) - kszucs[stdlib] Support creating nested python objects using list literals[stdlib] Enable equality comparisons for List[T] == List[T] - [stdlib] Support creating nested python objects using list literals - [stdlib] Enable equality comparisons for List[T] == List[T] - martinvuyk[stdlib] Fix String.splitlines and test and move to string_slice[stdlib] Add Dict.get(key) -> Optional[T] and Dict.get(key, default) -> T methods[stdlib] Add is_valid_utf8 and test[stdlib] Fix String.split() and start fixing String.__len__()[stdlib] Add SIMD.__contains__[stdlib] Move String.isspace and _StringIter implementations to StringSlice - [stdlib] Fix String.splitlines and test and move to string_slice - [stdlib] Add Dict.get(key) -> Optional[T] and Dict.get(key, default) -> T methods - [stdlib] Add is_valid_utf8 and test - [stdlib] Fix String.split() and start fixing String.__len__() - [stdlib] Add SIMD.__contains__ - [stdlib] Move String.isspace and _StringIter implementations to StringSlice - haifeng-jin[GitHub Actions] Extract install build tools into separate scripts - [GitHub Actions] Extract install build tools into separate scripts - rd4com[Stdlib] Add Dict.__init__ overload with power_of_two_initial_capacity[Stdlib] Speedup Dict in _maybe_resize - [Stdlib] Add Dict.__init__ overload with power_of_two_initial_capacity - [Stdlib] Speedup Dict in _maybe_resize - YichengDWu[stdlib] Remove incorrect alignment constraint - [stdlib] Remove incorrect alignment constraint - jon-chuang[examples] Improve examples/matmul.mojo by 2-3x via split-K sub-tiling - [examples] Improve examples/matmul.mojo by 2-3x via split-K sub-tiling - bgreni[stdlib] Make object Representable and Formattable - [stdlib] Make object Representable and Formattable - MatveyF[stdlib] Int comparison operator unit tests - [stdlib] Int comparison operator unit tests - taylorpool[Documentation] Fix typo in arc.mojo - [Documentation] Fix typo in arc.mojo - [stdlib] Implement remaining int fns for bit module bit - [examples] Fix typo in examples/matmul.mojo - [stdlib] Fix typo in intrinsics.mojo - [stdlib] Fix typo in simd.mojo - [stdlib] Implement Dict.setdefault(key, default) - [stdlib] Implement collections.Counter - Part 2 - [stdlib] Disallow implicit float to int conversions in SIMD types Dict.setdefault(key, default) collections.Counter - [stdlib] write_to(writer, ...) -> writer.write(...) write_to(writer, ...) writer.write(...) - [stdlib] Support creating nested python objects using list literals - [stdlib] Enable equality comparisons for List[T] == List[T] List[T] == List[T] - [stdlib] Fix String.splitlines and test and move to string_slice - [stdlib] Add Dict.get(key) -> Optional[T] and Dict.get(key, default) -> T methods - [stdlib] Add is_valid_utf8 and test - [stdlib] Fix String.split() and start fixing String.__len__() - [stdlib] Add SIMD.__contains__ - [stdlib] Move String.isspace and _StringIter implementations to StringSlice String.splitlines Dict.get(key) -> Optional[T] Dict.get(key, default) -> T String.split() String.__len__() SIMD.__contains__ String.isspace _StringIter StringSlice - [GitHub Actions] Extract install build tools into separate scripts - [Stdlib] Add Dict.__init__ overload with power_of_two_initial_capacity - [Stdlib] Speedup Dict in _maybe_resize Dict.__init__ power_of_two_initial_capacity Dict _maybe_resize - [stdlib] Remove incorrect alignment constraint - [examples] Improve examples/matmul.mojo by 2-3x via split-K sub-tiling examples/matmul.mojo - [stdlib] Make object Representable and Formattable object Representable Formattable - [stdlib] Int comparison operator unit tests Int - [Documentation] Fix typo in arc.mojo ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-issue-39 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 9, 2024 # Modverse Weekly - Issue 39 Jack Clayton ‍ Check out the new section for nightly updates. If you're not keeping track on the #nightly Discord channel, you can catch up on everything new for the last week in this newsletter. ### Blogs, Tutorials, and Videos - Read a Brief Guide to the Mojo N-Body Example and learn about orbital dynamics, along with Mojo. - rd4com released a tutorial for the SIMD type on its methods and operators. - Santiago released a video on running Python code from Mojo. - Alex published a blog: Reinforcing Learning: Using Mojo🔥 to learn 3x faster ### Awesome Mojo You can discuss these projects with the creators in the Discord forum: #community - The team working on NuMojo added an NDArray type. - Andres released raylib bindings.‍ - Frank released zstd bindings and lz4 bindings.‍ - mist, weave, and mog for building TUIs moved to using integers for colors instead of strings, resulting in a 90% performance improvement. - Shiva released a Mojo package manager: Tenka ### Open Source Contributions Check out all the open source contributions here.  make sure to DM Jack Clayton on Discord if you've had your first PR merged to claim some epic Mojo swag! Check out the merged contributions this week from our valuable community members: - @mzaks[stdlib] benchmark sort scalar list - [stdlib] benchmark sort scalar list - @gabrieldemarmiesse[stdlib] Be explicit about PythonObject conversions[stdlib] Clarify error message in test_tempfile.mojo[stdlib] Add CollectionElementNew to structs (many PRs)‍‍ - [stdlib] Be explicit about PythonObject conversions - [stdlib] Clarify error message in test_tempfile.mojo - [stdlib] Add CollectionElementNew to structs (many PRs)‍‍ - @msaelices‍[stdlib] Implement collections.Counter‍ - [stdlib] Implement collections.Counter‍ - @Brian-M-J‍[docs] Fix typos in pointers.ipynb‍ - [docs] Fix typos in pointers.ipynb‍ - @lsh[stdlib] Add fill method to Span‍ - [stdlib] Add fill method to Span‍ - @bgreni‍[stdlib] Make UInt Formattable‍ - [stdlib] Make UInt Formattable‍ - @martinvuyk‍[stdlib] Add SIMD.__contains__‍ - [stdlib] Add SIMD.__contains__‍ - @helenex‍[stdlib] Fix String.removesuffix("") removing entire string - [stdlib] Fix String.removesuffix("") removing entire string - [stdlib] benchmark sort scalar list - [stdlib] Be explicit about PythonObject conversions - [stdlib] Clarify error message in test_tempfile.mojo - [stdlib] Add CollectionElementNew to structs (many PRs)‍‍ PythonObject test_tempfile.mojo CollectionElementNew ‍ - [stdlib] Implement collections.Counter‍ collections.Counter - [docs] Fix typos in pointers.ipynb‍ - [stdlib] Add fill method to Span‍ fill Span - [stdlib] Make UInt Formattable‍ UInt Formattable - [stdlib] Add SIMD.__contains__‍ SIMD.__contains__ ‍ - [stdlib] Fix String.removesuffix("") removing entire string String.removesuffix("") ### Nightly Updates Check out the unreleased changelog here for more details on each change. You can follow changes on the #nightly Discord channel. These are the updates since last week: - [Stdlib] Introduce time.perf_counter methods and deprecate time.now - [mojo] Add an exclusive parameter to the pointer types - [External] [stdlib] Implement collections.Counter (#42560) - [mojo-stdlib] Adds os.path.makedirs and os.path.removedirs for adding and removing nested directories. Follows Python logic. - [mojo-stdlib] Add os.path.split and tests, behaves the same as Python equivalent. - [mojo-stdlib] Adds os.path.expanduser, pathlib.Path.expanduser, and pathlib.Path.home. - [stdlib] Add math.align_{up,down} overloads for UInt - [stdlib] Add min and max overload for UInt - [stdlib] Update changelog with new UInt type - [mojo-stdlib] Reland again: Add ImplicitlyBoolable trait - [stdlib] Clean up uses of memcmp - [mojo-lang] Rework setitem/setattr emission to use keyword arguments. - [mojo-lang] Improve parameter inference for conditional conformances. - [mojo-stdlib] Fallback for home dir if HOME is not set on POSIX - [mojo-stdlib] Add the ability to expand a username with os.path.expanduser(~user/folder) - [stdlib] Remove load from LegacyPointer. - [mojo-stdlib] Adds the pwd module following Python syntax and behavior. - [mojo] Update changelog with new Mojo pointer restrictions exclusive collections.Counter os.path.makedirs os.path.removedirs os.path.split os.path.expanduser pathlib.Path.expanduser pathlib.Path.home math.align_{up,down} UInt min max UInt UInt ImplicitlyBoolable memcmp HOME os.path.expanduser(~user/folder) load LegacyPointer pwd ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-38 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 28, 2024 # Modverse Weekly - Issue 38 Jack Clayton The 24.4 release introduced GGUF support and quantisation for models such as Llama3 and many new features for Mojo. With that behind us Modular is now working hard towards the next release. To try out the new features press the Nightly tab on the MAX installation guide. There's an active community in the #nightly Discord channel to discuss the upcoming features with, and Modular staff are there to answer questions and respond to your feedback! The latest MAX nightly release now has a interactive GUI chat interface for Llama3, the commands to beta test it before the official release are here. ### Blogs, Tutorials, and Videos - Read about What's New in MAX 24.4. - Chris Lattner talked about the broader vision for Mojo and MAX at the AI Engineer World’s Fair 2024. - Billy and Walter talked about Mojo debugging: extending MLIR and LLDB.‍‍ - Weiwei dived deep into Efficient Data-Flow Analysis on Region-Based Control Flow in MLIR.‍‍ - Medhi and Jeff explored how MLIR can be slow generating LLVM IR, and how Mojo avoids the footguns. - Santiago released an introduction to Mojo (for Python developers)‍ - Mike released a video: Mojo First Impression. ### Awesome Mojo You can discuss these projects with the creators on the Discord channel: #community - Frank built libjpeg-mojo: bindings to libjpeg from Mojo. - Samay reinvigorated and updated arrow.mojo for the latest Mojo release. - Kevin released mojonet: PyTorch Neural Network wrapper to help transition existing projects. ### Open Source Contributions Check out all the open source contributions here. Any significant changes that made it into the changelog are here. make sure to DM Jack Clayton on Discord if you've had your first PR merged to claim some epic Mojo swag! Check out the merged contributions this week from our valuable community members: - @lsh[stdlib] Add equality methods to StringSlice - [stdlib] Add equality methods to StringSlice - @soraros[stdlib] Move tuple.mojo off unroll[stdlib] Remove use of StaticTuple from test_simd.mojo - [stdlib] Move tuple.mojo off unroll - [stdlib] Remove use of StaticTuple from test_simd.mojo - @codingonion[stdlib] Fix typo in simd.mojo[docs] Fix typo in parameters/index.ipynb - [stdlib] Fix typo in simd.mojo - [docs] Fix typo in parameters/index.ipynb - @mikowals[stdlib] List __getitem__ returns auto-dereferenced ref - [stdlib] List __getitem__ returns auto-dereferenced ref - @gabrieldemarmiesse[stdlib] Use ValueDestructorRecorder in test_inline_list.mojo - [stdlib] Use ValueDestructorRecorder in test_inline_list.mojo - [stdlib] Add equality methods to StringSlice - [stdlib] Move tuple.mojo off unroll - [stdlib] Remove use of StaticTuple from test_simd.mojo tuple.mojo unroll StaticTuple test_simd.mojo - [stdlib] Fix typo in simd.mojo - [docs] Fix typo in parameters/index.ipynb - [stdlib] List __getitem__ returns auto-dereferenced ref - [stdlib] Use ValueDestructorRecorder in test_inline_list.mojo ValueDestructorRecorder test_inline_list.mojo ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-37 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 20, 2024 # Modverse Weekly - Issue 37 Jack Clayton We hosted the third Mojo Community Meeting this week, with great demonstrations from the community on constraints and the Mojo HTTP serving library lightbug. We also previewed our upcoming AI pipeline serving feature with llama3, using a GUI to interact with it. And ended by answering community questions on async, and when Python will be able to call Mojo. This is your chance to interact with the core Mojo team, you can add it to your calendar and find the agenda for the next one here: modul.ar/community-meeting. In other news, in less than 18 months after launching Mojo it's in the top 100 programming languages on the TIOBE Index. ### Blogs, Tutorials, and Videos - Check out the Modular Community Livestream - New in MAX 24.4. - Read the blog: What’s New in Mojo 24.4? ### Awesome Mojo You can discuss these projects with the creators on the Discord channel: #community - rd4com built mojo_dev_helper: a dev tool for standard library contributors. - Ethan built random123: splittable pseudorandom number generators. - Zac built mojo-json: a simple Little JSON Parser. - Mkhail has added features to gojo: UDP/TCP client/server implementations and examples - Martin built kamo: a Kolmogorov-Arnold Networks implementation. - ShivaSankar built HEPJo: High Energy Physics computing. ### Open Source Contributions Check out all the open source contributions here. Any significant changes that made it into the changelog are here. make sure to DM Jack Clayton on Discord if you've had your first PR merged to claim some epic Mojo swag! ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-36 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 7, 2024 # Modverse Weekly - Issue 36 Jack Clayton This week we released Mojo🔥 and MAX⚡️ 24.4, there is too much in the release to cover here! Check out the launch blog here, the Mojo changelog here, and the MAX changelog here. We held another community meeting, with great presentations from community members on their exciting projects. You can watch the full video here, if you want to get involved with the next one make sure to add it to your calendar here. ### Blogs, Tutorials, and Videos - Learn about how to speed up K-Means clustering by porting Python implementation to Mojo🔥. - Find out how to get started with MAX release and nightly builds. - Read up on part I: what ownership is really about: a mental model approach - Go deeper with part II: a deep dive into ownership in Mojo - maicmi wrote a blog on how to Install Mojo on Mac M1 and use python integration with no crash. - Santiago shares his thoughts on Mojo while rewriting binary search functions from Python - Numeryst released a video: How to Set Up Mojo with One Click? ### Awesome Mojo - Jake built a Mojo math library for complex numbers with SIMD support. - Maxim created a Quick and Dirty JSON parser in Mojo - Martin released a new project: Kolmogorov-Arnold Networks in Mojo - Ethan built Yoho 🔥: A toy compiler written in mojo - Ryan released Fire Physics Engine: a simple 2d physics engine in Mojo - Ryulord created awdy: a tqdm-like progress bar for Mojo - Martin built mopro: a basic progress bar for Mojo - Benny released a wrapper around GLibC for use in Mojo programs - Benny also built MIP: a work in progress image library for Mojo, inspired by PIL ### Open Source Contributions Check out all the open source contributions here. Any significant changes that made it into the changelog are here. make sure to DM Jack Clayton on Discord if you've had your first PR merged to claim some epic Mojo swag! ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-35 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 23, 2024 # Modverse Weekly - Issue 35 Jack Clayton This week we held the first ever Mojo community meeting! Many topics were discussed, including priorities, diving into specific features like async, and topics set on the agenda by the wider Mojo community. Next week we'll be hearing from community members about the awesome projects they've been working on. Make sure to add the next community meeting to your calendar. ### Blogs, Tutorials, and Videos - geauxeric created a video tutorial: Implement and benchmark softmax algorithms in Mojo - Learn how to implement Fast⚡️ k-means clustering in Mojo🔥 - Check out this unofficial Chinese community Mojo documentation and forum ### Awesome Mojo - Aaron created a build system for Mojo using Nix and Bazel: rules_mojo - Benny created a Mojo wrapper around PIL (Python Imaging Library) named MIL - Sebastian rewrote the Python heapq module in Mojo: heapq.mojo ### Open Source Contributions Check out all the open source contributions here. Any significant changes that made it into the changelog are here. make sure to DM Jack Clayton on Discord if you've had your first PR merged to claim some epic Mojo swag! ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-34 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 17, 2024 # Modverse Weekly - Issue 34 Jack Clayton This week we launched MAX⚡️ nightlies with preview support for macOS and MAX Serving! You can now find details about how to install it on modul.ar/get-started, press the Nightly button on the install guide if you want to be on the bleeding edge. We look forward to your feedback, join the Discord and leave comments on the #nightly channel. The #community-blogs-videos and #community-projects channels on Discord have been archived in favor of a #community forum. This allows users to discuss your projects and content, and keep each item discoverable for ongoing discussions. ### Blogs, Tutorials, and Videos - ivellapillil created a very thorough online book on Mojo with helpful diagrams and graphics! - Read a tutorial on the MAX graph API - Watch a deep dive tech talk from Chris Lattner on ownership and lifetimes in Mojo - Check out an Introduction to MAX Graph API and custom operators - Read Joe Pamer's view on the future direction of Mojo - ‍Gabriel linked his tutorial on making a pull request to an open-source project ### Awesome Mojo - Martin released an efficient string builder named mostring - rd4com released a Mojo test runner ### Open Source Contributions Check out all the open source contributions here. Any significant changes that made it into the changelog are here. make sure to DM Jack Clayton on Discord if you've had your first PR merged to claim some epic Mojo swag! ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-33 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 10, 2024 # Modverse Weekly - Issue 33 Jack Clayton This week we hosted a livestream with many good questions from the community. People were most interested in macOS support for MAX, and GPU support. These are both top priority at Modular so stay tuned! The standard library team were happy to announce that we've had 250 OSS contributions since open sourcing, we continue to be impressed and motivated by our active community! Also check out the new proposal on automatic deref in Mojo. This is to solve the need to use [] to deref, for example when iterating through a list. The overwhelming consensus from the community is in support of the "eager reference decay" implementation, which will be familiar to C++ developers, and also provide a much better experience for developers transitioning from Python. ### Blogs, Tutorials, and Videos - Ferdinand wrote a detailed blog on parsing PNG images with Mojo and released a library named mimage for reading images. - Watch our livestream on MAX and Mojo 24.3 with cool examples like using the graph API with custom ops, and running Yolo and Stable Diffusion through MAX. - Read the summarized version of Chris' epic Mojo deep dive on the Developer Voices podcast. ### Awesome Mojo - Martin built another Andrei Karparthy port: minbpe used for LLM tokenization. - Community collaboration ML Framework Basalt has had a large number of updates including many new ops, import / export to ONNX, and dynamic ops. - rd4com built a web framework on top of Lukas' lsx HTML building library. - Maxim updated his mojo-sort library to work with the latest nightly compiler, along with performance improvements. - Dimitri released a library named toybox with a disjoint set. ### Open Source Contributions The open source contributions each week have become too large to list! We merged 44 since the last newsletter, you can find them all here. Any significant changes that made it into the changelog are here. Note that we've moved to using a tool named Copybara to keep the external and internal repo in sync. This automation has allowed us to push out nightly compiler releases at a much more regular cadence. Thanks for all the great contributions, make sure to DM Jack Clayton on Discord if you've had a PR merged to claim some epic Mojo swag! ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/modverse/modverse-weekly-32 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 3, 2024 # Modverse Weekly - Issue 32 Jack Clayton Yesterday marked Mojo🔥's first birthday 🎂, launching last year on May 2, 2023. We launched with just an online Jupyter environment and have since released the SDK locally for macOS and Linux on arm64 and x86, and bought up our inference and serving stack MAX⚡️. Yesterday we released Mojo and MAX 24.3 to mark the occasion, along with the first community contributions, 32 of which made it into the official changelog. We're so excited to go on this journey out in the open with our amazing community, thank you to everyone who has been participating! ### Blogs, Tutorials, and Videos - Read our blog on what’s New in Mojo 24.3. - Learn about a new feature in MAX 24.3: Engine Extensibility. - Watch an in-depth interview about Mojo and MAX from Kris Jenkins Developer Voices podcast with Chris Lattner. - Read an X tutorial for bit operations on SIMD values and integers. - Check out our blog on multimodal search with Snowflake embedding and MAX Engine. - Learn about how we prevent supply chain attacks at Modular. - Chris talked about programming and AI at Startup Grind. - RD4com created a tutorial on parameterizing and compile time constraining a Mojo app. ### Awesome Mojo - Vladyslav updated mojo-atol-simd and it's now up to 20% faster than the stdlib. - Benny added flag features to his Mojo CLI library prism. - Alex updated mojo-pytest with support for the latest 24.3 release. - MadAlex has continued development on his numpy-like Mojo library with up to 6x better performance: NuMojo. ### MAX Engine - ONNX20% speedup for llama2 & mistral-7b20% speedup on stable-diffusion25-45% speedups on image encoders25-45% speedups on dynamically-quantized transformers - 20% speedup for llama2 & mistral-7b - 20% speedup on stable-diffusion - 25-45% speedups on image encoders - 25-45% speedups on dynamically-quantized transformers - PyTorch20% speedups for mistral-7b20% speedup on llama225% speedup on dlrm-rm2-multihot25% speedup on replit-3b - 20% speedups for mistral-7b - 20% speedup on llama2 - 25% speedup on dlrm-rm2-multihot - 25% speedup on replit-3b - 20% speedup for llama2 & mistral-7b - 20% speedup on stable-diffusion - 25-45% speedups on image encoders - 25-45% speedups on dynamically-quantized transformers - 20% speedups for mistral-7b - 20% speedup on llama2 - 25% speedup on dlrm-rm2-multihot - 25% speedup on replit-3b ### Open Source Contributions - Gabriel had 10 PRs merged!#2454: Allow StringRef to work with both Int8 and UInt8#2451: Removed FileCheck from the dev guide#2448: Allow String() to be created from UInt8 ptr and List too#2407: Use UnsafePointer in builtin_list.mojo#2405: Use UnsafePointer in _cpython.mojo#2404: Use UnsafePointer in info.mojo and some test files#2403: Use UnsafePointer in hex|io|os.mojo #2402: Replace Pointer by UnsafePointer in hash|simd.mojo#2361: Add repr() function and Representable trait#2024: Remove FileCheck in test_object.mojo and removed object.print() - #2454: Allow StringRef to work with both Int8 and UInt8 - #2451: Removed FileCheck from the dev guide - #2448: Allow String() to be created from UInt8 ptr and List too - #2407: Use UnsafePointer in builtin_list.mojo - #2405: Use UnsafePointer in _cpython.mojo - #2404: Use UnsafePointer in info.mojo and some test files - #2403: Use UnsafePointer in hex|io|os.mojo - #2402: Replace Pointer by UnsafePointer in hash|simd.mojo - #2361: Add repr() function and Representable trait - #2024: Remove FileCheck in test_object.mojo and removed object.print() - #2364 mikowals: add b64decode - #2315 mikowals: SIMD.shuffle with StaticIntTuple mask - #2294 lsh: Create InlineArray type - #2190 arvindavoudi: Add new ComparableCollectionElement trait and index(list, value, start, end) function APIs - #2454: Allow StringRef to work with both Int8 and UInt8 - #2451: Removed FileCheck from the dev guide - #2448: Allow String() to be created from UInt8 ptr and List too - #2407: Use UnsafePointer in builtin_list.mojo - #2405: Use UnsafePointer in _cpython.mojo - #2404: Use UnsafePointer in info.mojo and some test files - #2403: Use UnsafePointer in hex|io|os.mojo - #2402: Replace Pointer by UnsafePointer in hash|simd.mojo - #2361: Add repr() function and Representable trait - #2024: Remove FileCheck in test_object.mojo and removed object.print() ‍ ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team ## Next blog post: - Modverse Weekly - Issue 41August 16, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI Modverse Weekly - Issue 41 August 16, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Modverse Issues - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/?205c58fe_page=2 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: 80K+ developers building with MAX # A high-performance generative AI framework MAX replaces and simplifies your AI inference stack, maximizing performance and reducing cloud costs ## Achieve state of the art NVIDIA GPU performance Unlock state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## Optimize your existing PyTorch & ONNX models Migrate seamlessly without rewriting your AI models and pipelines on a unified AI stack. ## Use Mojo to supercharge your AI applications Extend your Python code with high-performance Mojo, a new programming language with the expressiveness of Python and the performance of C. ## Develop locally, deploy globally to any cloud. Develop your AI applications locally and package and deploy across any cloud provider, on CPUs and GPUs, without having to change your code. ## Run Gen AI locally under 3 minutes Download MAX first to run an LLM - Run Llama3-8B in your CLIGet started - Run Llama2-7B in your CLIGet started - Run Replit-3B in your CLIGet started Run Llama3-8B in your CLI Run Llama2-7B in your CLI Run Replit-3B in your CLI ## Free Forever The MAX framework is a free and open platform for you to develop and deploy AI inference workloads. A new framework for Gen AI, and the best way to deploy PyTorch Development tools for accelerated compute on GPUs and CPUs, built from the ground up for GenAI, but compatible with today. ## Developer Approved 👍 “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/#open-roles PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: 80K+ developers building with MAX # A high-performance generative AI framework MAX replaces and simplifies your AI inference stack, maximizing performance and reducing cloud costs ## Achieve state of the art NVIDIA GPU performance Unlock state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## Optimize your existing PyTorch & ONNX models Migrate seamlessly without rewriting your AI models and pipelines on a unified AI stack. ## Use Mojo to supercharge your AI applications Extend your Python code with high-performance Mojo, a new programming language with the expressiveness of Python and the performance of C. ## Develop locally, deploy globally to any cloud. Develop your AI applications locally and package and deploy across any cloud provider, on CPUs and GPUs, without having to change your code. ## Run Gen AI locally under 3 minutes Download MAX first to run an LLM - Run Llama3-8B in your CLIGet started - Run Llama2-7B in your CLIGet started - Run Replit-3B in your CLIGet started Run Llama3-8B in your CLI Run Llama2-7B in your CLI Run Replit-3B in your CLI ## Free Forever The MAX framework is a free and open platform for you to develop and deploy AI inference workloads. A new framework for Gen AI, and the best way to deploy PyTorch Development tools for accelerated compute on GPUs and CPUs, built from the ground up for GenAI, but compatible with today. ## Developer Approved 👍 “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/blog/how-we-work PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 21, 2022 # How we work Chris Lattner Tim Davis #### Modular is not a typical company, and we never intend to become one. As a team, we have collectively worked at more than 50 different companies, from the largest technology companies to some of the smallest - and we’ve seen a lot of things that work well, and a lot that just don’t. #### We’re building for the long term, and one of the most important pieces to get right is culture - it allows the team to stay healthy, stay aligned in purpose, and remain high functioning as the company scales. So why is it that so few companies pay attention to culture early on? We believe that building a truly great culture requires codifying it, living it, and entrenching it in all aspects of how you work as a team. ## A changing world For most of us, the world significantly shifted two years ago. I recall preparing for a TensorFlow Dev Summit when we were all abruptly told that we could no longer return to the office - we were told to work from home “for the foreseeable future.” It turned out that would be the last time I would ever go back to an office as I knew it, and the last time I would see my team physically for a long time. Before the pandemic, you either chose where to live and found work accordingly, or you chose where to work and found living arrangements accordingly. You didn’t get to mix and match. But the last two years have certainly changed the reality of what “going to work” actually means, and for many of us, transformed how we balance life and work together. At Modular, we believe in optimizing for the highest productivity and happiness for our team, not for maximum utilization of our real estate, location, or entrenched ideologies of years gone past. While some people prefer a collaborative shared space, others prefer zero-length commutes, and others prefer a hybrid. We know that “one size fits all” solutions are “one size fits none” in reality, and we strongly believe that this model doesn’t represent the future of work, nor does it embrace the lessons that we’ve all learned the last two years. The nature of work has forever changed. One thing is manifestly clear - especially if you work in technology, you can now choose both where to live and where to work. You get to optimize how you spend your time to be the most productive at work, and how to maximize your life outside it. To quote the great Steve Jobs - you only have so much time and so much life: ## The culture we practice, is the culture we keep At Modular, we get a lot of feedback from folks who are impressed that we have already invested into culture- that we have taken the time to carefully consider and define what our culture is and that we have been directive on how we’ve implemented it. We did this because we have seen firsthand the impact of toxic cultures. We’ve also seen what happens when high-power people aren’t aligned - pushing and pulling into conflicting directions without knowing where the North Star is. We've seen environments that reward meeting time, endless presentations and misaligned “technical contributions” over actually building something meaningful for users with a focus on shipping it. Posters on a wall or words on a website mean nothing if people at a company don’t actually use and action those words in how they work every day. We’ve seen a lot of lip service given to culture without an attempt to live it or embody the intended culture in actions. Culture must be lived and practiced everywhere. It has to be in your objectives, it has to be in your hiring, in your daily language, and in the standard you hold everyone to. Otherwise, like all things without constant practice, it fades away and becomes meaningless. We were very deliberate about our culture when we founded Modular, from why we work, to how we work, to ensuring we aligned everything back to our core cultural pillars: Build products users love, Empower people, and Be an incredible team. You might be wondering how we do this in practice? Here are just some examples: ### Build products users love - Customer-led products - To build products users love, we regularly listen to our customers to deeply understand their problems. Our goal is to build incredible technology that is actually useful and that solves real problems. Modular isn’t a research project. - We write things down - This is key to enabling asynchronous, highly productive work, and it allows real-time discussions to be more powerful, thoughtful, and contextually driven. Importantly, it ensures we are scaling and leveraging our time right, so that people who join later understand why certain decisions were made. - Use the product - We use what we build. We regularly demo, refine, and simplify it and we constantly improve the end-to-end experience along the way. - We say no, a lot - We say no to so much more than we say yes to. The DNA we bring from Apple includes a culture of debate, a focus of what matters and a willingness to sequence deliverables. This means we aren’t afraid to say “no” or at least “not yet”, even to really appealing projects. - Retrospective Champions - Retrospectives after sprints and milestones are a constructive way to reflect on the things that went well, the things that weren’t so great and how to improve. We take it a step further and allocate Retrospective Champions to specific Action Items to ensure they actually get done. ### Empower people - Trust - We trust our people. We don't micromanage each other - we just expect stuff to get done and always assume the best intentions along the way. - Open calendars, meetings & docs - We don’t have anything to hide. We make everything we can available to everyone. There are no “busy” calendar's here, no secret meetings or decisions made without broad communication and input. - Career maps, planning - We already care about mapping out the careers of our team and do so via 28, 56 and 84-day onboarding check-ins. We utilize a range of tools to make sure that everyone has a chance to grow, even as we rapidly scale. - We work smarter - You are not expected to give up your life. People who get to burnout, often give up. Our time horizon isn't measured in days. We want you to bring the best of yourself to work, so you can truly enjoy your non-work time. ### Be an incredible team - We hire & provide offers fast - We interview and extend offers for the best people with limited process. We view hiring as a bilateral exchange - we are interviewing you, and you are interviewing us. - Technical management - We believe in managers being technical, and having a strong appreciation for the complexity of what is being built and driving the state of the art forward. - Lightweight reviews - Big technology performance reviews are insanely time consuming and exhausting. As much as they try to be independent, they end up being popularity contests. We have regular and direct career discussions and lightweight promotion decisions that tie ratings back to our values. - We celebrate everything - We celebrate our accomplishments and failures every week - professional or personal. You can’t be an incredible team, if you don’t win and fail together. And this is just a few of the things we do - we are continuing to push ourselves each day to improve. ## Maximizing how we work As we continue to grow and innovate, we are constantly improving and changing. We will always push the limits to create the best possible environment for our people and teams. Today, we are sharing our philosophy on how we empower our people to be their best. We will always push the limit to enable even more choice and flexibility because we believe that when the right people are empowered the right way, we accelerate our impact on the world. Every single person who works at Modular can: - Work from anywhere in your country - You are able to work from anywhere we can support, e.g. at home or in a co-location office - whatever suits you. - Compensation that doesn’t depend on which city you live in - Start in SF, move to New Orleans? Go for it - your compensation will not change. We will always pay top industry rates, no matter where you are in your country. - Synchronous & asynchronous days - Collaborate, brainstorm, and meet with your team when you need, and work asynchronously on days where you want to get stuff done. We usually do 2-3 synchronous days a week and the rest are asynchronous. - Regular on-sites, local meetups - We regularly meet as a company in different US locations (i.e. about a week a quarter), and people clustered together can also host local fun event meetups every couple of weeks in their respective cities. This is in addition to co-location work days. We also require that every company-wide onsite is in a different state to avoid one geolocation becoming the “defacto HQ” - it also makes life a lot more fun, visiting different places. - Travel & work internationally - We support employees who want to visit family, live abroad for a period, or for other personal reasons, up to the legal limits. We want to support you and know productivity isn't tied to a zip code. We do not believe that innovation is “trapped in a room with a whiteboard.” Companies are just collections of people - they succeed or fail by how well they can work together, listen and respond to their customers, build and ship products to people who want them, and keep pushing the path of innovation forward. We believe that by empowering the best in the world, who believe in our culture and values - we can innovate, build, and ship better products, faster. ## Join us In our view, to truly build the future, you need to live and work in it. The future is built by responding and adapting to constant change - where people can do their best work, and live their best life. We think the future of AI infrastructure will be built by those who believe in our new and ever changing world, and who are based all over it. We are building a legendary team; the absolute best in the industry with a bold vision for the future. If this resonates with you, and if you want to help us enable AI anywhere, for anyone, we encourage you to join the best AI infrastructure team in the world today. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Culture - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] Tim Davis Co-Founder & President Repeat Entrepreneur and Product Leader. Tim helped build, found and scale large parts of Google's AI infrastructure at Google Brain and Core Systems from APIs (TensorFlow), Compilers (XLA & MLIR) and runtimes for server (CPU/GPU/TPU) and TF Lite (Mobile/Micro/Web), Android ML & NNAPI, large model infrastructure & OSS for billions of users and devices. Loves running, building and scaling products to help people, and the world. [email protected] ================================================================================ URL: https://www.modular.com/culture PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # A great culture is the key to creating a great company. ## What we believe ### Build products users love ❤️ Customers first We build technology to lift the world by solving our customers' problems. We understand our users' problems and use cases and know there is sometimes a trade-off between "what is important" and "what is interesting" when building technology. We are clear that our customers always come first, and we always deliver on our promises. Build it right We build high-quality production software that displays technical mastery inside and out. We make our infrastructure the right way because we understand how quickly technical debt compounds. We know how faster engineering, product development, and business metrics move with a solid foundation. We build scalable, modular, and reliable systems that meet our customers' needs. Drive results When our customers and their people succeed, our company succeeds. No matter their role, every employee contributes to our collective success. Individually and together, we are all aligned on what we are working towards and how we can contribute. But we don't just work on auto-pilot. We expect everyone to regularly step back and ask if we're measuring the right input and output. We all win when we drive results that actually matter. ### Empower people 💪 Ownership We act on behalf of the entire organization and not just for ourselves and our local team. We operate on the assumption that each person is highly motivated and will drive their work with a bias towards action. We drive ownership by tracking progress toward our goals with clear expectations, responsible owners, and solid execution. We expect everyone to act like an owner, and once a decision is made, everyone will fully commit and move forward together. Transparency We are transparent by having decisions, calendars, directions, and plans open to everyone in the company. Anyone can constructively ask tough questions and feel safe to have answers provided directly. We expect people to be clear about what they know and open about what they don’t. We want everyone to feel that they can be vulnerable in front of each other and feel safe to take risks because this is how we grow and innovate. Hire the best, never stop learning We hire great people who seek to constantly grow themselves and others around them. Great people don’t settle; they have a thirst for knowledge and new skills, a desire for self-improvement, and actively seek feedback whenever they can. Great people develop great people; they take coaching others seriously and look to raise the standards of the whole organization. Have fun, live life We believe people do their best work when they are happy. Our goal is to ensure that you will always have the environment to achieve the right mix of family, compensation, growth, and mission to live a balanced and fulfilling life. By having fun and living your life, you also see more of the world, appreciate it, and learn how we can help improve it. ### Be an incredible team 🤝 Win together, fail together Changing the world is a team sport, and we need a group of incredibly talented people to be successful. Individual wins, or mistakes, matter less than everyone winning, failing, learning, and growing together. We expect everyone to listen, speak openly, and treat others with respect regardless of the wins or losses along the way. We foster a blameless culture for mistakes, and we expect our team to take risks without feeling insecure or embarrassed. The more we trust each other, the more we can lean on each other, and the more we can learn and grow together. Own inclusion, be diverse We build for everyone, and we are open to everyone. We believe that the best results come from a team that reflects the world at large. Our customers are diverse, and so are their needs, so we must empower and promote diversity and diverse perspectives at all company levels. We need to build diverse teams and foster diverse thinking to create products that genuinely help the world. Everyone has a voice We expect the best concept, design, plan, or direction to succeed regardless of someone’s “rank” in the company. Innovation exists everywhere, and great ideas are inside all of us. You can always reach out to anyone at any level in the company. We foster open communication and constructive debate and expect everyone to accept respectful challenges to their positions. We believe that the job of a leader is to find the right answer with their team, not to magically know everything themselves. Assume positive intent We expect everyone to assume the best of others. Our experiences have shown that information asymmetry almost always exists between people, and taking the time to understand circumstances via transparent communication is key to building healthy and functioning teams. We're all human and often jump to conclusions; we want people to assume good intentions when we do. 👋 We’re hiring! - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/#form PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: 80K+ developers building with MAX # A high-performance generative AI framework MAX replaces and simplifies your AI inference stack, maximizing performance and reducing cloud costs ## Achieve state of the art NVIDIA GPU performance Unlock state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## Optimize your existing PyTorch & ONNX models Migrate seamlessly without rewriting your AI models and pipelines on a unified AI stack. ## Use Mojo to supercharge your AI applications Extend your Python code with high-performance Mojo, a new programming language with the expressiveness of Python and the performance of C. ## Develop locally, deploy globally to any cloud. Develop your AI applications locally and package and deploy across any cloud provider, on CPUs and GPUs, without having to change your code. ## Run Gen AI locally under 3 minutes Download MAX first to run an LLM - Run Llama3-8B in your CLIGet started - Run Llama2-7B in your CLIGet started - Run Replit-3B in your CLIGet started Run Llama3-8B in your CLI Run Llama2-7B in your CLI Run Replit-3B in your CLI ## Free Forever The MAX framework is a free and open platform for you to develop and deploy AI inference workloads. A new framework for Gen AI, and the best way to deploy PyTorch Development tools for accelerated compute on GPUs and CPUs, built from the ground up for GenAI, but compatible with today. ## Developer Approved 👍 “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/blog/ develop-locally-deploy-globally PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 9, 2024 # Develop locally, deploy globally Modular Team The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. In particular, it remains nearly impossible to build streamlined and scalable development workflows that bridge the gap between local development and cloud deployment. These workflows are complicated because AI tooling is fragmented, with each tool presenting its own trade-offs and limitations. Today’s AI developers must leverage a multitude of different tools across their end-to-end AI workflows. Some tools work for cloud accelerators but are limited to local CPUs, while others excel for local CPU development but aren’t cloud-enabled. Working across these tools requires problematic abstractions and translators to unify fundamentally incompatible technologies, requiring rewriting of model or application code to make it all work together. Sometimes, it seems impossible to piece together the right combination of tools and hardware to support the full developer lifecycle and provide the best performance-to-cost trade-off for any given model. ## How MAX helps MAX solves these problems by providing a unified inference API backed by a state-of-the-art compiler and inference runtime that works with a variety of models and hardware types across local laptops and common cloud instances. MAX doesn't require you to migrate your entire AI pipeline and serving infrastructure to something new—it meets you where you are now and allows you to upgrade incrementally. MAX makes your pipeline portable across a wide range of CPU architectures—Intel, AMD, and ARM—and GPUs, opening up more portability and performance. MAX allows you to take advantage of the breadth and depth of different cloud instances at the best price, ensuring you always get the best inference cost-performance ratio. ### MAX unlocks local to cloud With MAX, you can develop AI applications locally and then easily package them for deployment to any cloud environment. This unified workflow offers several critical advantages: - Speed and Flexibility: Downloading MAX enables local development for rapid iteration and testing. Importantly, MAX doesn’t just run locally but is faster on many use cases than industry standard local LLM frameworks, like llama.cpp, making development even faster. You can quickly modify code, run experiments, and debug issues without the setup and latency associated with remote servers. - Resource Availability: On local machines, you have direct access to local hardware resources, such as CPU and GPUs, for free. Spinning up and paying for cloud instances is unnecessary and isn’t bottlenecked by availability. - Control and Customization: Local environments can be tailored to specific project needs, allowing developers to install custom libraries, frameworks, and tools without restrictions. Importantly, for latency-sensitive applications, fully controlled local development boxes provide less noise than shared cloud instances. - Consistency: Developing with MAX locally and bundling our infrastructure into OCI-compatible containers like Docker means you can ensure that what you build locally works seamlessly in production environments. - Global Scale: Finally, MAX is highly optimized for the AI hardware running in popular data center cloud providers like AWS, Azure, and GCP—including CPU and GPUs (coming soon!). Users can scale their AI applications globally with no code changes and state-of-the-art performance. ## How MAX works The industry lacks a unified AI infrastructure platform and is instead flush with “point solutions” that only work for specific models, hardware, and OS’s. When we began the effort to unify the world's AI infrastructure, we realized fragmentation in the stack was driven by a lack of a common programming model for AI hardware. That's why we created Mojo, a new unifying programming language for AI hardware that combines Python’s expressiveness with C’s performance. Mojo is the core technology that provides the foundation for the rest of the MAX platform. The MAX Engine, our next-generation graph compiler and runtime system, leverages Mojo to implement its low-level mathematical operations, such as MatMul. This provides unparalleled portability and performance and makes local-to-cloud workflows possible. You can load any model into MAX Engine and achieve low-latency inference on a wide range of hardware. All that said, you do not need to use Mojo to use MAX. You can bring your existing models to the framework and execute them with MAX Engine using our API libraries in Python and C. However, using Mojo with MAX gives you superpowers. Mojo allows you to write custom ops for your model or write a full inference graph for optimal performance in MAX Engine. Finally, integrating MAX as part of your AI development workflow makes it easy to deploy your locally developed models into production using trustworthy tools that include robust scaling, monitoring, and deployment templates. With MAX, you can serve your model using industry-compatible tools, including NVIDIA's Triton Server. Because we already interoperate with the tools you already use, we make it easy to drop MAX into your existing workflows that require model versioning, multi-model deployment, and support for various deployment environments, making it a versatile solution for AI inference deployment. Read about how easy this is right now! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/blog/ bring-your-own-pytorch-model PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 9, 2024 # Bring your own PyTorch model Modular Team ‍ The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. PyTorch has become the top choice for researchers pushing the boundaries of AI, thanks to its blend of flexibility, Pythonic simplicity, and robust community support. Despite its popularity and success in research environments, PyTorch faces challenges in large-scale production deployments. What makes PyTorch excellent for development—like its Python eager mode—causes difficulties in production settings where resource management, latency targets, and reliability are critical. While research teams favor Python for its ease of use, deployment teams often use high-performance languages and libraries like C++ and CUDA to optimize models for latency, throughput, and cost efficiency. Despite efforts to optimize the PyTorch deployment processes (e.g., TorchScript), a universal method for deploying high-performance PyTorch models at scale remains elusive. Recently, developers have resorted to building point-solutions to deploy LLMs (that is, use-case-specific solutions such as TRT-LLM and vLLM), which further fragment the industry and increase complexity for everyone. ‍ This ongoing challenge underscores the complexities inherent in bridging the gap between research-driven AI development and robust, scalable AI deployment. But it also describes one of the core reasons we built MAX—the Modular Accelerated Xecution platform. Simply put, MAX provides the best way to deploy PyTorch into production. ### MAX unlocks the full power of PyTorch MAX provides inference API backed by a state-of-the-art compiler and inference runtime that works with a variety of models and hardware types, across local laptops and common cloud instances. Importantly, MAX doesn't require that you rewrite your PyTorch models—it meets you where you are now, using your existing model and existing code, with minimal changes to adopt our inference API (available in Python and C). Over time, you can incrementally add more MAX features for more performance, programmability, and portability. MAX provides the following benefits for PyTorch deployments: - Optimized performance: MAX provides advanced compiler and runtime optimizations that improve your resource efficiency and resource management. With only a few lines of code, MAX accelerates your models, reducing latency, improving user experience, and saving you valuable compute costs and resources. Relative to stock PyTorch, MAX runs PyTorch models up to 5x faster on CPU, depending on the specific workload and hardware. And GPUs are coming soon! - Full compatibility: MAX reduces fragmentation in your workflow, by meeting you where you are now, with your existing PyTorch models, tools, and libraries. We’ve taken away the complexity in converting your Python models to high-performance languages. Instead of using brittle model translators, MAX is compatible with the PyTorch and ONNX ecosystems, which means your models work out of the box. - Simple extensibility: MAX allows you to progressively upgrade your AI infrastructure over time, as you want to optimize the performance of your models. For even the most sophisticated AI engineers, performance-tuning AI pipelines is complicated because it involves advanced knowledge of system programming languages, AI hardware, and PyTorch itself. With MAX, you’re able to extend your models with custom operations (ops) written in Mojo—a new programming language that looks like Python and provides the performance of C. Importantly, custom ops written in Mojo are natively portable to any hardware that MAX supports and automatically fuse into the graph, ensuring peak performance. MAX brings your PyTorch models to their full potential and scales much further to meet the demands of GenAI as it continues to rapidly evolve. MAX seamlessly integrates with your existing PyTorch models, provides an unparalleled boost in performance and efficiency, and is easily customizable, so you can focus on what you do best — innovating and creating. ### How to use MAX with PyTorch As we mentioned earlier, there is no universal way to deploy PyTorch. As such, MAX provides a few different integration points with the PyTorch ecosystem. We detail each below. #### MAX Engine for TorchScript Models If you are using TorchScript, MAX Engine simplifies the process into three easy steps: load, compile, and execute. #### MAX Engine for ONNX Models Similarly, for ONNX models, the process is streamlined into load, compile, and execute steps. #### Torch.compile (coming soon!) And coming soon, we will also provide a MAX backend for PyTorch 2.x’s torch.compile API. Below is how we would optimize a Stable Diffusion model with MAX in this scenario. Whether you're using cutting-edge PyTorch features such as torch.compile, or staying with more traditional ways of serving your models, such as TorchScript and ONNX, MAX is the best way to deploy your PyTorch workloads. ### MAX is free! Download now By adopting MAX in your enterprise, you can take control over your PyTorch models. Join the growing community of developers who trust MAX for their model optimization needs. Don't let performance limitations hold you back. With MAX, you can elevate your PyTorch and ONNX models, delivering faster and more efficient results. Get started with MAX today and experience the difference! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/ai-resources/llm-context-evaluations PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources LLM Context Evaluations Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # LLM Context Evaluations ### Introduction Large Language Models (LLMs) are trained on vast amounts of text data to generate language understanding and generation capabilities. One critical aspect of LLMs is their ability to handle long-rangedependencies, which are crucial for tasks like question answering, sentiment analysis, and machine translation. To evaluate an LLM's performance in handling these long-range dependencies, we need to focus onincreasing the context length. ### What is context length? The context length refers to the maximum number of tokens (words or characters) that a model can consider when making predictions. In other words, it represents the maximum distance between two relevanttokens that the model should be able to capture. ### Why increase context length? Increasing the context length allows LLMs to: - Capture long-range dependencies: By considering more context, models can better understand relationships between tokens that are far apart. - Improve accuracy: Longer contexts enable models to capture more nuanced information, leading to improved performance on tasks like question answering and sentiment analysis. - Enhance interpretability: With longer contexts, models can provide more meaningful and interpretable results. - Support for more modalities that require longer context length such as videos, robotics etc… ### Evaluation metrics for increasing context length To evaluate an LLM's performance in handling longer contexts, we use various metrics that focus on the model's ability to capture long-range dependencies: - Long-Range Dependency (LRD) scores: Measure the percentage of tokens that are correctly predicted within a certain range (e.g., 50 tokens). - Contextualized accuracy: Calculate the accuracy of predictions made at different context lengths. - BLEU score with longer contexts: Evaluate the similarity between generated text and reference text, using longer contexts to simulate real-world scenarios. - ROUGE score with longer contexts: Similar to BLEU, ROUGE measures the quality of generated text, this time considering longer contexts. - Long-range attention-based metrics:Attention mechanisms are essential for capturing long-range dependencies in LLMs. By analyzing the attention patterns and weights across different context lengths, you can evaluate how well the model is able to focus on relevant tokens at increasing distances. - Context-awareness metrics:Context-awareness metrics assess an LLM's ability to capture subtle contextual cues that are critical for understanding longer contexts. Examples of such metrics include:Contextualized perplexity: Measures the probability of a sequence given its context.Contextualized surprisal: Evaluates how well the model can predict the next token in a sequence, considering its context. - Contextualized perplexity: Measures the probability of a sequence given its context. - Contextualized surprisal: Evaluates how well the model can predict the next token in a sequence, considering its context. Attention mechanisms are essential for capturing long-range dependencies in LLMs. By analyzing the attention patterns and weights across different context lengths, you can evaluate how well the model is able to focus on relevant tokens at increasing distances. Context-awareness metrics assess an LLM's ability to capture subtle contextual cues that are critical for understanding longer contexts. Examples of such metrics include: - Contextualized perplexity: Measures the probability of a sequence given its context. - Contextualized surprisal: Evaluates how well the model can predict the next token in a sequence, considering its context. 7. Task-specific evaluations: Different NLP tasks require varying levels of contextual understanding. For instance: - Question answering (QA): Evaluate an LLM's ability to answer questions correctly by considering longer contexts. - Sentiment analysis: Assess an LLM's performance in identifying sentiment and emotional tone across longer texts. To evaluate the effectiveness of a Large Language Model in handling longer contexts, you can use these metrics in combination with task-specific evaluations. This will provide a comprehensive understanding of the model's strengths and weaknesses in capturing long-range dependencies. ### Challenges: When evaluating LLMs for context length effectiveness, keep in mind that: - Increased computational costs: Longer contexts require more computations, which may impact evaluation time. - Data scarcity: Gathering large datasets for longer contexts can be challenging. - Evaluation metric limitations: Different metrics might not capture the full extent of an LLM's capabilities or weaknesses. ### Challenges in increasing context length When increasing the context length, LLMs face several challenges: - Computational costs: Longer contexts require more computations and memory, which can be computationally expensive. - Training data: Large datasets are needed to train models on longer contexts. - Evaluation metrics: New evaluation metrics need to be developed or adapted to account for the increased context length. ### Best practices for increasing context length To successfully increase the context length of LLMs: - Use larger batch sizes: Train models with larger batch sizes to accommodate the increased computational costs. - Monitor memory usage: Carefully manage memory consumption during training to prevent crashes or slow-downs. - Adapt evaluation metrics: Modify or create new evaluation metrics that account for the longer contexts. - Experiment with different architectures: Investigate various architectural designs (e.g., attention mechanisms) that can handle longer contexts more effectively. ## Benchmark Examples The Needle in the Haystack (NITH) benchmark is a popular tool for evaluating the ability of language models to capture long-range dependencies and contextual information. It's a challenging task that requires models to identify specific patterns or relationships within large contexts. How NITH works: - Seed sentence generation: A random seed sentence is generated, which serves as the starting point for the evaluation. - Context extension: The seed sentence is extended with a varying number of tokens (e.g., 50-500) to create a long context window. - Target token selection: A target token is randomly selected from the extended context, which represents the "needle" in the haystack. - Model prediction: The language model is asked to predict the probability distribution over the entire vocabulary given the seed sentence and the extended context. - Evaluation metric: The performance of the model is evaluated using a specific metric, such as perplexity or log-likelihood, which measures how well the model can predict the target token's likelihood. Key aspects: - Long context windows: NITH evaluates models' ability to capture contextual information within extended contexts (e.g., 50-500 tokens). - Random seed sentences: The use of random seed sentences ensures that the evaluation is not biased towards specific topics or themes. - Target token selection: The random selection of target tokens ensures that the model must generalize across different parts of the context, rather than relying on local patterns. Why NITH is useful for evaluating long context windows: - Captures contextual dependencies: NITH evaluates a language model's ability to capture complex contextual relationships and dependencies within extended contexts. - Real-world scenario simulation: The benchmark simulates real-world scenarios where models are required to understand the context and relationships between distant tokens. Studies have shown that state-of-the-art language models, such as BERT and RoBERTa, achieve high performance on NITH, indicating their ability to capture long-range dependencies. However, as context lengthsincrease, model performance tends to degrade, highlighting the challenges of capturing contextual information in extended contexts. The Needle in the Haystack benchmark provides a valuable tool for evaluating language models' ability to handle long context windows and capture complex contextual relationships. By understanding how NITHworks and its key aspects, you can better appreciate the importance of this benchmark in the development of advanced language understanding capabilities. Conclusion Increasing the context length of Large Language Models is a crucial step in evaluating their performance on long-range dependencies. By understanding the challenges and best practices involved, researchers and developers can better equip LLMs to tackle complex language tasks. ## Next Ring Attention with Blockwise Transformers for Near-Infinite Context ML Systems Rotary Position Embedding (RoPE) On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/high-performance-computing-hpc-technical-primer PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources High Performance Computing (HPC) Technical Primer Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # High Performance Computing (HPC) Technical Primer Introduction High-performance computing (HPC) refers to the use of powerful computer systems to solve complex problems that require significant computational resources and processing power. HPC is acritical component in various fields, including scientific research, engineering, finance, and healthcare. ### What is High-Performance Computing? HPC is an umbrella term that encompasses several related concepts: - Parallel Programming: The process of writing code that can run simultaneously on multiple processor cores or nodes. - Distributed Computing: The use of a network of computers to perform computations. - Heterogeneous Computing: The combination of different types of processing units (CPUs, GPUs, FPGAs, etc.) to achieve better performance and scalability. ### Key Characteristics - Scalability: HPC systems are designed to scale up or down depending on the computational requirements of a problem. - Parallelism: HPC applications often involve thousands or even millions of processing units working together in parallel. - High-Speed Interconnects: HPC systems rely on high-speed interconnects (e.g., InfiniBand, Ethernet) to enable fast data transfer between nodes. - Large-Scale Storage: HPC systems require large-scale storage solutions to handle massive datasets. ### Applications of High-Performance Computing - Scientific Research: Simulations, modeling, and analysis of complex phenomena in fields like climate science, materials science, and biomedicine. - Engineering: Design, simulation, and optimization of complex systems, such as aircraft, automobiles, and buildings. - Finance: High-frequency trading, risk analysis, and portfolio optimization require massive computational resources. - Healthcare: Medical imaging, genomic analysis, and personalized medicine rely on HPC to analyze large datasets. ### Challenges in High-Performance Computing - Programming Complexity: Writing efficient parallel code is a significant challenge. - Data Management: Handling large datasets and ensuring data integrity is crucial. - Scalability Limitations: As systems grow larger, scalability issues can arise. - Energy Consumption: HPC systems require significant power consumption. ### Future Directions - Exascale Computing: The development of exascale (10^18) computing capabilities to tackle even more complex problems. - Quantum Computing: The integration of quantum processing units into HPC systems for even greater performance gains. - Artificial Intelligence: The application of AI and machine learning techniques to improve HPC system performance and decision-making. ### HPC Frameworks: ### CUDA Description: CUDA is a parallel computing platform developed by NVIDIA that allows developers to use GPU acceleration in their applications. Pros: - High-performance acceleration on NVIDIA GPUs - Easy integration with existing C/C++ code - Large community of developers and extensive documentation Cons: - Limited portability across different GPU architectures - May require rewriting code for CPU-based systems - Limited support for OpenCL or other open standards ### OpenCL Description: OpenCL is an open standard for parallel programming on heterogeneous platforms, allowing developers to write code that can run on CPUs, GPUs, and FPGAs. Pros: - Portable across different platforms (CPUs, GPUs, FPGAs) - Supports multiple programming models (OpenCL, CUDA, OpenGL) - Wide range of hardware support Cons: - Lower performance compared to NVIDIA-specific frameworks like CUDA - May require more coding effort for optimal performance - Limited community and documentation ### OpenMP Description: OpenMP is a parallel programming standard that allows developers to write code that can run on multi-core CPUs. Pros: - Portable across different CPU architectures (x86, ARM, etc.) - Supports multiple programming models (OpenMP, Pthreads) - Wide range of hardware support Cons: - Limited performance benefits compared to GPU acceleration - May require rewriting code for CPU-based systems - Limited community and documentation ### MPI Description: MPI (Message Passing Interface) is a standard for parallel programming on distributed-memory architectures. Pros: - Portable across different platforms (CPUs, GPUs, etc.) - Supports multiple programming models (MPI, OpenMP) - Wide range of hardware support Cons: - Limited performance benefits compared to GPU acceleration - May require rewriting code for CPU-based systems - Limited community and documentation ### Charm++ Description: Charm++ is a parallel programming framework that allows developers to write code that can run on distributed-memory architectures. Pros: - Portable across different platforms (CPUs, GPUs, etc.) - Supports multiple programming models (Charm++, MPI) - Wide range of hardware support Cons: - Limited performance benefits compared to GPU acceleration - May require rewriting code for CPU-based systems - Limited community and documentation ### UPC++ Description: UPC++ is a parallel programming framework that allows developers to write code that can run on distributed-memory architectures. Pros: - Portable across different platforms (CPUs, GPUs, etc.) - Supports multiple programming models (UPC++, MPI) - Wide range of hardware support Cons: - Limited performance benefits compared to GPU acceleration - May require rewriting code for CPU-based systems - Limited community and documentation ### CUDA Fortran Description: CUDA Fortran is a parallel programming framework that allows developers to write Fortran code that can run on NVIDIA GPUs. Pros: - Easy integration with existing Fortran code - High-performance acceleration on NVIDIA GPUs - Large community of developers and extensive documentation Cons: - Limited portability across different GPU architectures - May require rewriting code for CPU-based systems - Limited support for OpenCL or other open standards ### HIP Description: HIP is a parallel programming framework that allows developers to write code that can run on AMD's GPUs. Pros: - Easy integration with existing C/C++ code - High-performance acceleration on AMD GPUs - Large community of developers and extensive documentation Cons: - Limited portability across different GPU architectures - May require rewriting code for CPU-based systems - Limited support for OpenCL or other open standards ## Parallel Computing programming frameworks ### CUDA CUDA is a parallel computing platform developed by NVIDIA that allows developers to use GPU acceleration in their applications. It's a software layer that enables the execution of CPU instructions on NVIDIAGPUs, allowing for significant performance improvements in fields such as: - Machine Learning: Training neural networks and performing deep learning tasks. - Computer Vision: Image processing, object detection, and recognition. - Scientific Computing: Simulations, data analysis, and numerical computations. - Gaming: Graphics rendering, physics engines, and game development. CUDA provides a set of tools and APIs that allow developers to: - Write CUDA code: Using the CUDA C/C++ compiler (nvcc), you can write programs that execute on NVIDIA GPUs. - Access GPU memory: Directly access GPU memory using CUDA's unified virtual address space. - Use parallel processing: Leverage multiple threads and cores within an NVIDIA GPU to perform tasks concurrently. - Interact with the host: Communicate with the CPU (host) using APIs like CUDA-MPI or OpenMP. CUDA is designed to work seamlessly with NVIDIA GPUs, which are optimized for massively parallel computations. By using CUDA, developers can: - Improve performance: Take advantage of the massive parallel processing capabilities of NVIDIA GPUs. - Simplify development: Use familiar C/C++ programming languages and APIs, rather than learning new languages or frameworks. - Port applications: Run existing CPU-based code on NVIDIA GPUs with minimal modifications. Overall, CUDA enables developers to tap into the immense computing power of NVIDIA GPUs, unlocking new possibilities for high-performance computing, data analysis, and artificial intelligence. ### OpenCL Description: OpenCL is an open standard for parallel programming on heterogeneous platforms that allows developers to write code that can run on CPUs, GPUs, and FPGAs. Pros: - Portable across different platforms (CPUs, GPUs, etc.) - Supports multiple programming models (OpenCL, CUDA, OpenGL) - Wide range of hardware support - Open standard allowing for community development Cons: - Lower performance compared to NVIDIA-specific frameworks like CUDA - May require more coding effort for optimal performance - Limited community and documentation ### ROCm Description: ROCm is an open-source software platform developed by AMD that provides a set of tools and libraries for programming heterogeneous systems. Pros: - Portable across different platforms (CPUs, GPUs, etc.) - Supports multiple programming models (OpenCL, HIP, C++ AMP) - Wide range of hardware support - Open source allowing for community development Cons: - May require rewriting code for CPU-based systems - Limited community and documentation compared to CUDA - Performance may not be as high as NVIDIA-specific frameworks like CUDA ### Intel MKL Description: Intel MKL (Math Kernel Library) is a software library that provides optimized implementations of mathematical functions, including linear algebra operations. Pros: - Portable across different platforms (CPUs, etc.) - Supports multiple programming models (C++, Fortran, Python) - Wide range of hardware support - Optimized for performance Cons: - May require rewriting code for CPU-based systems - Limited support for GPU acceleration - Performance may not be as high as NVIDIA-specific frameworks like CUDA ### Arm Compute Library Description: The Arm Compute Library is a software library that provides optimized implementations of mathematical functions, including linear algebra operations. Pros: - Portable across different platforms (CPUs, etc.) - Supports multiple programming models (C++, Fortran, Python) - Wide range of hardware support - Optimized for performance Cons: - May require rewriting code for CPU-based systems - Limited support for GPU acceleration - Performance may not be as high as NVIDIA-specific frameworks like CUDA ### Google's TensorFlow Description: TensorFlow is an open-source software library developed by Google that provides a platform for building and training machine learning models. Pros: - Portable across different platforms (CPUs, GPUs, etc.) - Supports multiple programming models (Python, C++, Java) - Wide range of hardware support - Open source allowing for community development Cons: - May require rewriting code for CPU-based systems - Limited performance benefits compared to NVIDIA-specific frameworks like CUDA - Steep learning curve for new developers ### Microsoft's C++ AMP Description: C++ AMP (Accelerated Massive Parallelism) is a parallel programming model developed by Microsoft that provides a way to write parallel code using C++. Pros: - Portable across different platforms (CPUs, GPUs, etc.) - Supports multiple programming models (C++, Fortran) - Wide range of hardware support - Optimized for performance Cons: - May require rewriting code for CPU-based systems - Limited community and documentation compared to CUDA - Performance may not be as high as NVIDIA-specific frameworks like CUDA ### Conclusion High-performance computing is a critical enabler of scientific breakthroughs, technological innovations, and economic growth. As the field continues to evolve, it's essential to address the challenges and opportunities presented by the increasing complexity and scale of HPC systems. ## Next Models Large Language Model Technical Primer On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/ring-attention PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Ring Attention with Blockwise Transformers for Near-Infinite Context Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Ring Attention with Blockwise Transformers for Near-Infinite Context Title:Ring Attention with Blockwise Transformers for Near-Infinite Context Authors: - Hao Liu - Matei Zaharia - Pieter Abbeel ### Abstract Summary This paper introduces Ring Attention with Blockwise Transformers, a novel approach that allows handling near-infinite context lengths in Transformers. This method utilizes blockwise computation of self-attention and feedforward networks, distributing long sequences across multiple devices. This innovation enables training and inference of sequences up to the device count times longer than those managed by previous memory-efficient Transformers without additional overheads. Extensive experiments demonstrate the approach's effectiveness in language modeling and reinforcement learning tasks. ### Key Concepts - Transformers:Backbone of many state-of-the-art AI models using self-attention and position-wise feedforward mechanisms. - Backbone of many state-of-the-art AI models using self-attention and position-wise feedforward mechanisms. - Memory Efficiency:Reducing memory demands of self-attention through blockwise computation without materializing the full softmax matrix. - Reducing memory demands of self-attention through blockwise computation without materializing the full softmax matrix. - Blockwise Computation:Dividing self-attention and feedforward networks into blocks to distribute computation and memory load across multiple devices. - Dividing self-attention and feedforward networks into blocks to distribute computation and memory load across multiple devices. - Ring Attention:A mechanism where devices form a ring, sending and receiving key-value blocks during computation to overlap communication and computation processes. - A mechanism where devices form a ring, sending and receiving key-value blocks during computation to overlap communication and computation processes. - Large Context Handling:Enabling context lengths up to device count times longer than those of prior models by efficiently managing memory and computation. - Enabling context lengths up to device count times longer than those of prior models by efficiently managing memory and computation. - Backbone of many state-of-the-art AI models using self-attention and position-wise feedforward mechanisms. - Reducing memory demands of self-attention through blockwise computation without materializing the full softmax matrix. - Dividing self-attention and feedforward networks into blocks to distribute computation and memory load across multiple devices. - A mechanism where devices form a ring, sending and receiving key-value blocks during computation to overlap communication and computation processes. - Enabling context lengths up to device count times longer than those of prior models by efficiently managing memory and computation. ### Problem Statement The main problem addressed is the memory constraint in Transformers that limits their ability to handle long sequences, which is crucial for applications like video processing, long-form text analysis, and scientific data interpretation. ### Methods and Techniques - Blockwise Parallel Transformers:Implement blockwise computation of self-attention and feedforward layers to reduce memory usage without approximations. - Implement blockwise computation of self-attention and feedforward layers to reduce memory usage without approximations. - Ring Attention:Devices are organized in a ring topology to overlap the communication of key-value blocks with blockwise computation, reducing memory costs and enabling large context sizes. - Devices are organized in a ring topology to overlap the communication of key-value blocks with blockwise computation, reducing memory costs and enabling large context sizes. - Fully Sharded Data Parallelism (FSDP):Shards the model across multiple devices to manage larger context lengths effectively. - Shards the model across multiple devices to manage larger context lengths effectively. - Implement blockwise computation of self-attention and feedforward layers to reduce memory usage without approximations. - Devices are organized in a ring topology to overlap the communication of key-value blocks with blockwise computation, reducing memory costs and enabling large context sizes. - Shards the model across multiple devices to manage larger context lengths effectively. ### Key Results - Memory Reduction:Achieves significant memory reduction, enabling training and inference with sequence lengths up to 100 million tokens. - Achieves significant memory reduction, enabling training and inference with sequence lengths up to 100 million tokens. - Performance Improvement:Outperforms prior memory-efficient models by up to 512 times in context size scaling on TPUv4-1024. - Outperforms prior memory-efficient models by up to 512 times in context size scaling on TPUv4-1024. - Scalability:Demonstrates linear scalability of context length with the number of devices, allowing near-infinite context sizes. - Demonstrates linear scalability of context length with the number of devices, allowing near-infinite context sizes. - Achieves significant memory reduction, enabling training and inference with sequence lengths up to 100 million tokens. - Outperforms prior memory-efficient models by up to 512 times in context size scaling on TPUv4-1024. - Demonstrates linear scalability of context length with the number of devices, allowing near-infinite context sizes. ### Contributions and Innovations - Memory Efficient Architecture:Proposes an architecture that scales context length linearly with device count, eliminating individual device memory bottlenecks. - Proposes an architecture that scales context length linearly with device count, eliminating individual device memory bottlenecks. - Efficient Blockwise Attention:Overlaps blockwise computation and communication in a ring topology, providing zero-overhead scaling of context size. - Overlaps blockwise computation and communication in a ring topology, providing zero-overhead scaling of context size. - Experimental Validation:Extensive experiments show effectiveness in language modeling and reinforcement learning, enabling handling of much longer sequences than previous models. - Extensive experiments show effectiveness in language modeling and reinforcement learning, enabling handling of much longer sequences than previous models. - Proposes an architecture that scales context length linearly with device count, eliminating individual device memory bottlenecks. - Overlaps blockwise computation and communication in a ring topology, providing zero-overhead scaling of context size. - Extensive experiments show effectiveness in language modeling and reinforcement learning, enabling handling of much longer sequences than previous models. ### Future Work The authors suggest exploring the application of their method to video-audio-language models, extended feedback learning in reinforcement learning, scientific data analysis such as gene sequences, and complex reasoning tasks from linked data. ### Applications - Video Processing:Analyzing long videos with high-resolution sequences. - Analyzing long videos with high-resolution sequences. - Text Analysis:Handling entire books or large documents for comprehensive text analysis. - Handling entire books or large documents for comprehensive text analysis. - Scientific Research:Processing complex datasets in scientific experiments, such as gene sequences or high-dimensional data. - Processing complex datasets in scientific experiments, such as gene sequences or high-dimensional data. - Code Analysis:Understanding and generating codebases by analyzing extensive code sequences. - Understanding and generating codebases by analyzing extensive code sequences. - Analyzing long videos with high-resolution sequences. - Handling entire books or large documents for comprehensive text analysis. - Processing complex datasets in scientific experiments, such as gene sequences or high-dimensional data. - Understanding and generating codebases by analyzing extensive code sequences. ### Relevant Links - Code Repository: https://github.com/lhao499/llm_large_context ## Next Attention with Linear Biases Enables Input Length Extrapolation (ALiBi) YaRN: Efficient Context Window Extension of Large Language Models LLM Context Evaluations On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/alibi PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Attention with Linear Biases Enables Input Length Extrapolation (ALiBi) Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Attention with Linear Biases Enables Input Length Extrapolation (ALiBi) Title: Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation Authors: Ofir Press, Noah A. Smith, Mike Lewis ### Abstract Summary: The paper addresses the question of how transformer models can extrapolate to longer sequences during inference than those seen during training. The authors propose a new method called Attention with Linear Biases (ALiBi), which biases the attention scores based on the distance between query and key tokens. This method enables efficient extrapolation, achieving similar perplexity to sinusoidal position embeddings but with faster training and less memory usage. ALiBi's inductive bias towards recency allows it to outperform other position methods on the WikiText-103 benchmark. ### Key Concepts: - Extrapolation in Transformers: The ability of a model to perform well on input sequences longer than those seen during training. - Position Embeddings: Methods to encode positional information into transformer models, traditionally using sinusoidal or learned embeddings. - Attention with Linear Biases (ALiBi): A new method that biases attention scores with a penalty proportional to the distance between tokens, eliminating the need for positional embeddings and enabling efficient extrapolation. - Perplexity: A measurement of how well a probabilistic model predicts a sample, with lower perplexity indicating better performance. - WikiText-103 Benchmark: A dataset used for evaluating language models. ### Problem Statement: The main problem addressed is how to enable transformer models to extrapolate efficiently to longer sequences during inference than those encountered during training, without incurring significant computational overhead or memory usage. ### Methods and Techniques: - ALiBi Method: Introduces a linear bias to attention scores based on token distance. This bias is a fixed penalty that increases linearly with distance, allowing models to handle longer sequences efficiently. - Sinusoidal Position Embeddings: Traditional method where positional information is added to word embeddings using sinusoidal functions. - Rotary Position Embeddings: Another method that multiplies keys and queries by sinusoidal embeddings at each layer. - T5 Bias: Modifies attention values by adding a learned, shared bias dependent on the distance between tokens. ### Key Results: - ALiBi models trained on shorter sequences can extrapolate to much longer sequences without a significant drop in performance. - A 1.3 billion parameter model trained on 1024 tokens with ALiBi achieved the same perplexity on 2048-token sequences as a sinusoidal model trained on 2048 tokens, but trained 11% faster and used 11% less memory. - ALiBi outperforms sinusoidal, rotary, and T5 position methods on the WikiText-103 benchmark, maintaining strong performance even on very long sequences (up to 10,000 tokens). ### Contributions and Innovations: - Efficient Extrapolation: ALiBi allows transformer models to extrapolate efficiently, reducing the need for longer training sequences and saving computational resources. - Inductive Bias Towards Recency: ALiBi’s bias towards more recent tokens improves performance on tasks where recent context is more relevant. - Implementation Simplicity: ALiBi can be implemented with minimal changes to existing transformer code, making it easy to adopt. ### Future Work: The authors suggest exploring further improvements in extrapolation efficiency and applying ALiBi to other tasks and models. They also propose combining ALiBi with other recent innovations in transformer models to achieve even better performance. ### Applications: - Language Modeling: Improving the performance and efficiency of large-scale language models. - Text Generation: Enabling models to generate longer and more coherent text. - Machine Translation: Applying ALiBi to translation models to handle longer input and output sequences effectively. ### Relevant Links: - Code & models ## Next ML Systems Rotary Position Embedding (RoPE) Ring Attention with Blockwise Transformers for Near-Infinite Context On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/yarn PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources YaRN: Efficient Context Window Extension of Large Language Models Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # YaRN: Efficient Context Window Extension of Large Language Models Title: YaRN: Efficient Context Window Extension of Large Language ModelsAuthors: Bowen Peng, Jeffrey Quesnelle, Honglu Fan, Enrico Shippole ### Abstract Summary: YaRN (Yet another RoPE extensioN method) is a compute-efficient method for extending the context window of large language models using Rotary Position Embeddings (RoPE). It achieves this with significantly fewer tokens and training steps than previous methods. The method allows models like LLaMA to extrapolate to much longer context lengths while surpassing previous state-of-the-art techniques. The fine-tuned models have been tested up to a 128k context length and are available online. ### Key Concepts: - Rotary Position Embeddings (RoPE): A method to encode positional information in transformer-based models effectively. - Context Window Extension: Techniques to enable language models to handle sequences longer than those seen during pre-training. - Position Interpolation (PI): A method to stretch positional encodings to extend the context window. - NTK-aware Interpolation: Adjusts scaling to preserve high-frequency information in RoPE, avoiding the loss of detail in extended contexts. - Dynamic NTK Interpolation: Dynamically adjusts scaling during inference to extend the context window without fine-tuning. - YaRN Method: Combines NTK-by-parts interpolation and attention scaling to achieve state-of-the-art performance in context window extension. ### Problem Statement: The main problem addressed by this paper is the limitation of transformer-based language models to generalize beyond the context window length they were trained on. Existing models struggle to handle sequences longer than their pre-training lengths, limiting their applicability to tasks requiring long-range context understanding. ### Methods and Techniques: - Position Interpolation (PI): Scales positional indices to stretch the context window, requiring fine-tuning on fewer tokens. - NTK-aware Interpolation: Uses a base change in RoPE to avoid losing high-frequency information, improving performance on non-fine-tuned models. - Dynamic Scaling: Dynamically updates the scale factor during inference to prevent performance degradation at longer context lengths. - NTK-by-parts Interpolation: Selectively interpolates RoPE dimensions based on their relative frequencies, preserving local relationships in embeddings. - Attention Scaling: Adjusts the attention mechanism with a temperature parameter to maintain low perplexity across extended contexts. ### Key Results: - Perplexity Performance: YaRN achieves lower perplexity scores compared to other methods, maintaining strong performance up to 128k context lengths. - Passkey Retrieval Task: YaRN models show high accuracy (>99%) in retrieving passkeys across extended context lengths. - Benchmark Performance: Minimal performance degradation in standardized benchmarks, maintaining near-baseline scores even at extended contexts. ### Contributions and Innovations: - Efficient Training: YaRN achieves context extension with 10x fewer tokens and 2.5x fewer training steps. - State-of-the-Art Performance: Outperforms previous methods in both fine-tuned and non-fine-tuned scenarios. - Practical Implementation: Compatible with libraries like Flash Attention 2, making it easy to integrate into existing systems. ### Future Work: The authors suggest exploring further optimizations for the YaRN method and extending its applicability to other models and tasks. They also propose investigating the theoretical underpinnings of attention scaling and its impact on model performance across different architectures. ### Applications: - Long Document Summarization: Efficiently handle and summarize documents that exceed typical context lengths. - Autoregressive Text Generation: Generate coherent text over extended sequences without degradation in quality. - Legal and Medical Text Analysis: Process and analyze lengthy legal documents or medical records requiring long-range context understanding. ### Relevant Links: - GitHub Repository: YaRN Models ## Next ML Systems Rotary Position Embedding (RoPE) Ring Attention with Blockwise Transformers for Near-Infinite Context On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/g PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Gemini: A Family of Highly Capable Multimodal Models Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Gemini: A Family of Highly Capable Multimodal Models Title: Gemini: A Family of Highly Capable Multimodal Models Authors: Gemini Team, Google ### Abstract Summary: The paper introduces the Gemini family of multimodal models that demonstrate advanced capabilities across image, audio, video, and text understanding. The models come in various sizes: Ultra, Pro, and Nano, each tailored for different applications. The most advanced model, Gemini Ultra, achieves state-of-the-art performance in 30 out of 32 benchmarks, including human-expert performance on the MMLU exam benchmark. The paper discusses the model architecture, training methods, evaluation results, and potential applications of these models in various fields. ### Key Concepts: - Multimodal Models: Gemini models can process and understand multiple types of data, including images, audio, video, and text. - Model Sizes: The Gemini family includes Ultra, Pro, and Nano models, optimized for different tasks and computational constraints. - State-of-the-Art Performance: Gemini Ultra advances the state of the art in 30 out of 32 benchmarks, including achieving human-expert performance on MMLU. - Training and Post-Training: The models undergo large-scale pre-training followed by targeted post-training to enhance specific capabilities. - Applications: Gemini models are designed for a wide range of applications, from complex reasoning tasks to on-device use cases. ### Problem Statement: The main problem addressed by this paper is developing a family of multimodal models that can exhibit strong generalist capabilities across different data modalities (image, audio, video, and text) while achieving state-of-the-art performance in specific tasks within each modality. ### Methods and Techniques: - Model Architecture: Gemini models use Transformer decoders with enhancements for stable training at scale and optimized inference. - Pre-Training and Post-Training: Initial large-scale pre-training is followed by post-training to enhance quality and ensure alignment with safety criteria. - Multimodal Input Handling: The models are trained to handle interleaved textual, audio, and visual inputs and produce multimodal outputs. - Efficiency Improvements: Innovations in distillation and quantization enable efficient deployment of smaller models like Gemini Nano. ### Key Results: - Benchmark Performance: Gemini Ultra achieves state-of-the-art results in 30 out of 32 benchmarks, including notable advances in text, image, video, and audio tasks. - MMLU Benchmark: First model to achieve human-expert performance on the MMLU exam benchmark with a score above 90%. - Multimodal Reasoning: Strong performance in tasks requiring cross-modal understanding and reasoning. - Comparative Benchmarks: Outperforms existing models such as GPT-4 and PaLM 2 in various benchmarks including MMLU, GSM8K, and HumanEval. ### Contributions and Innovations: - Multimodal Capabilities: Demonstrates the ability to understand and generate responses across different data types. - Efficiency in Training: Uses scalable training infrastructure and algorithms to handle large-scale model training efficiently. - Model Variants: Offers multiple model sizes to cater to different computational and application needs. - Post-Training Enhancements: Improves model performance and safety through targeted post-training methods. ### Future Work: The authors suggest further exploration of: - Enhancing model capabilities in underrepresented languages and low-resource tasks. - Developing more robust and nuanced evaluation benchmarks. - Expanding the use of Gemini models in practical applications and integrating them with external tools and services. ### Applications: - Education: Using multimodal reasoning capabilities to assist in educational settings, such as verifying solutions to complex problems. - Coding: Advanced code generation and competitive programming assistance. - On-Device Applications: Deploying efficient models for tasks like summarization and reading comprehension on mobile devices. - Conversational AI: Enhancing user interactions through improved conversational capabilities in services like Google AI Studio and Cloud Vertex AI. ### Relevant Links: - https://gemini.google.com ## Next Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/gemini-pro-1-5 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context ### Title and Authors: Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context" by the Gemini Team from Google. ### Abstract Summary: The paper presents Gemini 1.5 Pro, a highly compute-efficient multimodal mixture-of-experts model. It excels in recalling and reasoning over extensive contexts, handling millions of tokens, including long documents, videos, and audio. The model achieves near-perfect recall on long-context tasks and surpasses previous state-of-the-art models. It demonstrates significant improvements in long-context capabilities, achieving next-token prediction and retrieval performance up to 10 million tokens. ### Key Concepts: - Multimodal Mixture-of-Experts (MoE) Model: Combines multiple expert models to handle different parts of input data, improving efficiency and performance. - Long-Context Retrieval: Capable of recalling and reasoning over contexts up to 10 million tokens. - Multimodal Capabilities: Processes text, video, and audio inputs simultaneously. - Next-Token Prediction: Enhanced performance in predicting subsequent tokens in long contexts. - In-Context Learning: Learns new tasks and languages from extensive contextual information provided during inference. ### Problem Statement: The main problem addressed by the paper is the challenge of efficiently processing and reasoning over extremely long contexts across multiple modalities (text, video, audio) in large language models. ### Methods and Techniques: - Sparse Mixture-of-Experts (MoE) Architecture: Utilizes a routing function to activate only a subset of model parameters for each input, enhancing efficiency and scalability. - Training Infrastructure: Trained on Google’s TPUv4 accelerators with a diverse dataset including text, code, image, audio, and video content. - Instruction Tuning: Finetuning the model on multimodal data paired with instructions and human preference data to improve performance. ### Key Results: - Near-Perfect Recall: Achieves over 99% recall up to 10 million tokens in all modalities. - Performance Benchmarks: Outperforms previous models like Gemini 1.0 Ultra on various benchmarks, including long-document QA, video QA, and automatic speech recognition (ASR). - In-Context Learning: Successfully learns to translate from English to Kalamang, a low-resource language, using only reference materials provided in context. ### Contributions and Innovations: - Long-Context Processing: Demonstrates significant improvements in handling and retrieving information from extremely long contexts. - Multimodal Integration: Efficiently integrates and processes text, video, and audio inputs in a single model. - Efficiency and Scalability: Achieves high performance with significantly less training compute compared to previous models, making it more efficient for practical deployment. ### Future Work: The authors suggest further exploring the limits of long-context understanding, improving the model's efficiency, and extending its capabilities to support more complex and diverse real-world applications. ### Applications: - Long-Document Question Answering: Enhances the ability to answer questions from extensive documents. - Video and Audio Analysis: Improves performance in tasks requiring comprehension and reasoning over long video and audio recordings. - Language Translation: Facilitates translation and learning of low-resource languages using in-context learning. ### Relevant Links: - Kalamang language - Paul Graham articles - DeepMind Gemini ## Next Models Gemma: Open Models Based on Gemini Research and Technology Gemini: A Family of Highly Capable Multimodal Models On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/efficient-memory-management-for-large-language-model-serving-with-pagedattention PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Efficient Memory Management for LLM Serving with PagedAttention Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Efficient Memory Management for LLM Serving with PagedAttention Title: Efficient Memory Management for Large Language Model Serving with PagedAttention Authors: Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, Ion Stoica. ### Abstract Summary: The paper proposes PagedAttention, an attention algorithm inspired by virtual memory and paging techniques in operating systems, to address inefficiencies in managing the key-value cache (KV cache) memory for large language models (LLMs). The resulting system, vLLM, achieves near-zero waste in KV cache memory and flexible sharing within and across requests, improving throughput by 2-4x compared to existing systems like FasterTransformer and Orca. ### Key Concepts: - PagedAttention algorithm - Virtual memory and paging techniques - Key-value cache (KV cache) memory - vLLM serving system - High throughput and low latency - Memory fragmentation - Dynamic memory allocation - Distributed execution - Parallel sampling and beam search - Memory sharing ### Problem Statement: The main problem addressed by this paper is the inefficient management of KV cache memory in large language model serving systems, which leads to significant memory waste, limits batch size, and reduces throughput. Methods and Techniques: - PagedAttention Algorithm: Inspired by virtual memory and paging in operating systems, it partitions the KV cache into blocks that are not stored in contiguous memory, allowing more flexible and efficient memory management. - vLLM System: A serving system built on top of PagedAttention, featuring block-level memory management and preemptive request scheduling, supporting popular LLMs and distributed execution. - Centralized Scheduler: Coordinates the execution of distributed GPU workers, ensuring efficient memory usage and high throughput. - KV Cache Manager: Manages the physical KV cache memory through instructions from the centralized scheduler, allowing dynamic memory allocation and efficient memory sharing. - Copy-on-Write Mechanism: For handling parallel sampling and beam search, allowing shared memory to be copied only when modified. - Fine-Grained Batching and Scheduling: Enables efficient processing of multiple requests with varying input and output lengths without significant queuing delays or memory wastage. ### Key Results: - vLLM improves LLM serving throughput by 2-4x compared to FasterTransformer and Orca, without affecting model accuracy. - The improvements are more pronounced with longer sequences, larger models, and more complex decoding algorithms. - vLLM achieves 1.67x to 3.58x higher throughput in translation tasks with shared prefixes compared to Orca. - vLLM demonstrates significant memory savings (up to 55.2%) in beam search scenarios and higher throughput in chatbot applications. ### Contributions and Innovations: - Introduction of PagedAttention, enabling non-contiguous storage of KV cache and reducing memory fragmentation. - Development of vLLM, a high-throughput distributed LLM serving system with near-zero memory waste. - Implementation of effective memory sharing techniques for parallel sampling and beam search, significantly reducing memory usage. - Enhanced scheduling and preemption strategies to handle variable input and output lengths efficiently. - Support for various decoding algorithms and mixed decoding methods within the same batch, increasing overall throughput. ### Future Work: The authors suggest exploring further optimizations in kernel-level operations, expanding support for more complex LLMs and additional decoding algorithms, and improving the system’s adaptability to different hardware configurations. Applications: - Programming Assistants: Enhancing coding efficiency by generating multiple code suggestions in parallel. - Chatbots: Providing more responsive and cost-effective conversational agents by improving memory management and throughput. - Machine Translation: Offering high-quality translations with complex decoding methods like beam search, benefiting from shared prefix techniques. - Content Generation: Enabling efficient generation of long and complex text outputs for applications in marketing, entertainment, and education. - Cloud Services: Reducing operational costs and improving performance for cloud-based LLM services, facilitating wider adoption and scalability. ### Relevant Links: - vLLM source code - Paper link - Modular intro to Serving ## Next ML Systems AI & Memory Wall ML Systems FlashAttention On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/mlir-a-compiler-infrastructure-for-the-end-of-moore-s-law PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources MLIR: A Compiler Infrastructure for the End of Moore’s Law Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # MLIR: A Compiler Infrastructure for the End of Moore’s Law Title: MLIR: A Compiler Infrastructure for the End of Moore’s Law Authors: Chris Lattner (Google), Mehdi Amini (Google), Uday Bondhugula (IISc), Albert Cohen (Google), Andy Davis (Google), Jacques Pienaar (Google), River Riddle (Google), Tatiana Shpeisman (Google), Nicolas Vasilache (Google), Oleksandr Zinenko (Google) ### Abstract Summary: MLIR presents a novel compiler infrastructure designed to address software fragmentation, improve compilation for heterogeneous hardware, and reduce the cost of building domain-specific compilers. It aims to facilitate the design and implementation of code generators, translators, and optimizers across various levels of abstraction and application domains. ### Key Concepts: - Reusable and extensible compiler infrastructure - Heterogeneous hardware support - Domain-specific compilers - Intermediate Representation (IR) - Static Single Assignment (SSA) - Declarative system for IR dialects - Multithreaded compilation support - Progressive lowering ### Problem Statement: The main problem addressed by the paper is the high cost and complexity of building and maintaining domain-specific compilers and the lack of a unified infrastructure that can efficiently handle heterogeneous hardware and various levels of abstraction in compiler design. ### Methods and Techniques: - Static Single Assignment (SSA): Standardizing SSA-based IR data structures to simplify dataflow analysis and transformations. - IR Dialects: Providing a declarative system for defining various IR dialects to support different abstraction levels and domains. - Common Infrastructure: Offering a wide range of common compiler infrastructure components, such as parsing and printing logic, location tracking, and pass management, to reduce the engineering effort. - Progressive Lowering: Allowing for gradual lowering from high-level representations to low-level code, facilitating better optimization and support for heterogeneous targets. ### Key Results: - Reduction in Cost: MLIR significantly reduces the cost of developing compilers by providing reusable components and infrastructure. - Support for Heterogeneity: It efficiently supports heterogeneous compilation by enabling the creation of IRs that span different abstraction levels and hardware targets. - Improved Compilation: The framework shows improved compilation performance and capability through diverse use cases, such as TensorFlow graph optimizations and polyhedral code generation. ### Contributions and Innovations: - Extensible Compiler Infrastructure: MLIR introduces a novel, extensible framework that supports the creation and evolution of domain-specific compilers. - Dialect Support: It allows for the easy definition of new IR dialects, which can be mixed and matched within the same compilation pipeline. - Reusability: The infrastructure supports reusable passes and transformations, enhancing efficiency and consistency across different compiler projects. ### Future Work: The authors suggest further research into areas such as: - Enhanced support for more complex data structures and programming models. - Integration with higher-level languages and more advanced IR designs. - Further improvements in parallel and heterogeneous compilation. ### Applications: - Machine Learning Frameworks: Optimizing TensorFlow graphs for various hardware targets. - High-Performance Computing: Applying polyhedral code generation techniques. - Domain-Specific Compilers: Facilitating the creation of compilers for specific tasks, such as lattice regression. ### Relevant Links: - MLIR website - Mojo API for MLIR ## Next ML Systems ML Compiler Technical Primer On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/roberta-a-robustly-optimized-bert-pretraining-approach PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources RoBERTa: A Robustly Optimized BERT Pretraining Approach Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # RoBERTa: A Robustly Optimized BERT Pretraining Approach Title: RoBERTa: A Robustly Optimized BERT Pretraining Approach Authors: Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov ### Abstract Summary: RoBERTa is a replication study of BERT pretraining that focuses on the impact of various hyperparameters and training data sizes. It demonstrates that BERT was undertrained and proposes an improved training method that achieves state-of-the-art results on GLUE, RACE, and SQuAD benchmarks. ### Key Concepts: - BERT pretraining - Hyperparameter tuning - Training data size - Next sentence prediction (NSP) - Masked language modeling (MLM) - GLUE, RACE, and SQuAD benchmarks - Dynamic masking - Transformer architecture ### Problem Statement: The paper addresses the challenge of optimizing BERT pretraining by carefully evaluating the impact of hyperparameter choices and training data size, aiming to understand which aspects contribute most to performance improvements. ### Methods and Techniques: - Extended Training Duration: Training the model for a longer time with bigger batches and more data. - Removing Next Sentence Prediction (NSP): The NSP objective was found unnecessary and was removed to improve performance. - Training on Longer Sequences: Increasing the maximum sequence length for training. - Dynamic Masking: Changing the masking pattern applied to the training data dynamically rather than using a fixed mask throughout the training. - Large Dataset Collection: Collecting a large new dataset (CC-NEWS) comparable to other privately used datasets to control for training set size effects. ### Key Results: - RoBERTa surpasses the original BERT model's performance on various benchmarks. - Achieves state-of-the-art results on GLUE, RACE, and SQuAD benchmarks. - Dynamic masking provides slight performance improvements over static masking. - Removing NSP does not harm and sometimes improves downstream task performance. - Using larger batches improves optimization speed and end-task performance. ### Contributions and Innovations: - Pretraining Strategy Improvements: Simple yet effective changes to the BERT pretraining procedure lead to significant performance gains. - Dataset Collection: Introduction of the CC-NEWS dataset for better control over training data size effects. - Benchmark Results: RoBERTa achieves state-of-the-art results on multiple benchmarks without the need for multi-task finetuning or additional data augmentation. - Code Release: The models and code for RoBERTa are made publicly available, facilitating replication and further research. ### Future Work: The authors suggest further exploration of large batch training and architectural changes, as well as a deeper analysis of the effects of data size and diversity on pretraining. ### Applications: - Natural Language Understanding: Improving performance on tasks like sentiment analysis, text classification, and question answering. - Machine Translation: Enhancing translation quality by using robustly pretrained models. - Information Retrieval: Better document and query matching in search engines. - Conversational AI: Enhancing the capabilities of chatbots and virtual assistants. ### Relevant Links: - RoBERTa models and code - RoBERTa paper on arXiv - RoBERTa inference example running on MAX ## Next Models Gemma: Open Models Based on Gemini Research and Technology On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/large-langu PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Large Language Model Technical Primer Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Large Language Model Technical Primer ## Technical Primer on Large Language Models ### Introduction Large Language Models (LLMs) are a type of artificial intelligence model designed to understand and generate human language. These models are typically based on deep learning architectures, such as the Transformer, and are trained on vast amounts of text data. LLMs have revolutionized natural language processing (NLP) by achieving state-of-the-art performance in a variety of tasks, including text generation, translation, summarization, and question answering. ### Architecture The architecture of most LLMs is based on the Transformer model, introduced by Vaswani et al. in their seminal 2017 paper, "Attention is All You Need." The Transformer architecture relies on a mechanism called self-attention, which allows the model to weigh the importance of different words in a sentence when making predictions. This mechanism is more efficient than previous recurrent or convolutional architectures, enabling the training of much larger models. ### Key Components: - Embeddings: The input text is converted into continuous vector representations, known as embeddings. These embeddings capture semantic information about the words. - Attention Mechanisms: Self-attention layers compute attention scores between all pairs of words in a sentence, allowing the model to focus on relevant context when making predictions. - Feedforward Neural Networks: These layers process the attended information and produce the final output of each layer. - Positional Encoding: Since the Transformer does not have a built-in notion of word order, positional encodings are added to the embeddings to provide information about the position of words in a sentence. - Stacked Layers: Multiple layers of attention and feedforward networks are stacked to increase the model's capacity to learn complex patterns. ### Training Training LLMs involves optimizing the model's parameters to minimize the difference between its predictions and the actual text. This process typically requires massive datasets and significant computational resources. Common training objectives include: - Language Modeling: The model is trained to predict the next word in a sentence, given the previous words. This can be done using techniques like masked language modeling (MLM) or autoregressive language modeling (ALM). - Sequence-to-Sequence Learning: For tasks like translation, the model is trained to map input sequences (e.g., sentences in one language) to output sequences (e.g., sentences in another language). ### Applications LLMs have numerous applications across various domains: - Text Generation: Generating coherent and contextually relevant text, such as stories, articles, and code. - Machine Translation: Translating text from one language to another with high accuracy. - Summarization: Condensing long documents into concise summaries while preserving key information. - Question Answering: Providing accurate answers to questions based on context from provided text. - Sentiment Analysis: Determining the sentiment expressed in a piece of text, useful for market analysis and customer feedback. ### Challenges Despite their impressive capabilities, LLMs face several challenges: - Resource Intensiveness: Training and deploying LLMs require substantial computational power and memory. - Bias and Fairness: LLMs can inherit and amplify biases present in their training data, leading to biased or unfair outcomes. - Interpretability: Understanding the decisions made by LLMs is challenging due to their complexity, making it difficult to debug and trust their outputs. - Data Privacy: Training on large datasets may inadvertently include sensitive information, raising privacy concerns. ### Future Directions Research in LLMs continues to evolve, with several promising directions: - Efficient Training: Developing methods to reduce the computational requirements for training LLMs, such as distillation, pruning, and quantization. - Bias Mitigation: Creating techniques to identify and mitigate biases in LLMs to ensure fairer and more equitable outcomes. - Improved Interpretability: Enhancing the interpretability of LLMs to make their decisions more transparent and trustworthy. - Multimodal Models: Extending LLMs to handle multiple types of data, such as combining text with images or audio, to create more versatile AI systems. ### Conclusion Large Language Models represent a significant advancement in the field of natural language processing, offering powerful tools for understanding and generating human language. While they come with challenges, ongoing research and innovation are continually improving their capabilities and addressing their limitations. As LLMs continue to evolve, they hold the potential to transform a wide range of applications and industries. ## Next Models Llama 2 High Performance Computing (HPC) Technical Primer On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/contrastive PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Contrastive Language-Image Pre-training (CLIP) Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Contrastive Language-Image Pre-training (CLIP) ### Title and Authors: Title: Learning Transferable Visual Models From Natural Language Supervision Authors: Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever ### Abstract Summary: The paper presents a method for training state-of-the-art image representations by predicting which caption corresponds to which image using a dataset of 400 million image-text pairs. This approach enables zero-shot transfer of the model to various downstream tasks, achieving competitive performance with fully supervised models without needing task-specific training data. ### Key Concepts: - Natural Language Supervision - Contrastive Pre-training - Zero-shot Learning - Image-Text Pairing - Transfer Learning - CLIP (Contrastive Language-Image Pre-training) ### Problem Statement: The main problem addressed in the paper is the limitation of current computer vision systems, which are trained to predict a fixed set of predetermined object categories, thus requiring additional labeled data for new visual concepts. The paper explores learning directly from raw text about images to leverage a broader source of supervision. Methods and Techniques: - Dataset Creation: A new dataset of 400 million image-text pairs collected from the internet was created to cover a broad set of visual concepts. - Pre-training Task: The model is pre-trained to predict which caption corresponds to which image in a batch, optimizing a symmetric cross-entropy loss over the similarity scores between image and text embeddings. - Model Architecture: The image encoder is a ResNet-50 or Vision Transformer (ViT), and the text encoder is a Transformer model. Both encoders are trained to project their respective inputs into a shared embedding space. - Contrastive Objective: Instead of predicting the exact words in the text, the model predicts the correct image-text pairings from a batch of possible pairs, using a contrastive objective to maximize the cosine similarity of correct pairs and minimize that of incorrect pairs. - Training Efficiency: The model uses techniques like gradient checkpointing, mixed-precision training, and large minibatch sizes to efficiently handle the large-scale dataset. ### Key Results: - The model achieves competitive performance on over 30 computer vision datasets in tasks such as OCR, action recognition in videos, geo-localization, and fine-grained object classification. - Zero-shot transfer performance matches the accuracy of a ResNet-50 on ImageNet without using any of the 1.28 million training examples. - The model shows improved efficiency in zero-shot transfer compared to previous methods, learning 3-4 times faster. ### Contributions and Innovations: - Demonstrated the effectiveness of learning image representations directly from natural language supervision at a large scale. - Introduced a new large-scale dataset of image-text pairs. - Developed an efficient pre-training method using a contrastive objective, leading to significant improvements in zero-shot transfer performance. - Showcased the ability to perform various tasks with minimal or no task-specific training data. ### Future Work: The authors suggest further exploration of pre-training methods and architectures to improve the efficiency and performance of models trained with natural language supervision. They also propose investigating the integration of additional types of data and tasks to enhance the generality and robustness of the models. Applications: - Content-Based Image Retrieval: Leveraging natural language descriptions to retrieve images based on textual queries. - Zero-shot Image Classification: Classifying images into categories not seen during training using natural language descriptions of the categories. - Multimodal Search Engines: Combining image and text data to improve search capabilities in online platforms. - Enhanced Assistive Technologies: Improving the accuracy and generality of assistive technologies that rely on image recognition. ### Relevant Links: - Code and Pre-trained Model Weights ## Next On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/mac PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources ML Compiler Technical Primer Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # ML Compiler Technical Primer ## Technical Primer on Machine Learning Compilers ### Introduction A Machine Learning Compiler (MLC) is a specialized software tool designed to optimize and transform machine learning models into efficient executable code for deployment on various hardware platforms. The goal of an MLC is to bridge the gap between high-level machine learning frameworks and the low-level hardware-specific code, ensuring that models run efficiently on different devices, from CPUs and GPUs to specialized accelerators like TPUs (Tensor Processing Units). ### Key Components of a Machine Learning Compiler - FrontendModel Ingestion: The frontend takes in machine learning models from high-level frameworks such as TensorFlow, PyTorch, or ONNX. It parses the model and converts it into an intermediate representation (IR) that can be further optimized and transformed.Intermediate Representation (IR): The IR is a hardware-agnostic representation of the model that serves as a common language between the frontend and the backend of the compiler. Examples include XLA (Accelerated Linear Algebra) for TensorFlow and TorchScript for PyTorch. - Model Ingestion: The frontend takes in machine learning models from high-level frameworks such as TensorFlow, PyTorch, or ONNX. It parses the model and converts it into an intermediate representation (IR) that can be further optimized and transformed. - Intermediate Representation (IR): The IR is a hardware-agnostic representation of the model that serves as a common language between the frontend and the backend of the compiler. Examples include XLA (Accelerated Linear Algebra) for TensorFlow and TorchScript for PyTorch. - Optimization PassesGraph Optimization: This involves optimizing the computation graph of the model to reduce redundancy, fuse operations, and minimize memory usage. Techniques such as constant folding, operation fusion, and common subexpression elimination are applied.Quantization: Reducing the precision of model parameters and computations (e.g., from 32-bit floating point to 8-bit integers) to improve performance and reduce memory footprint while maintaining acceptable accuracy.Pruning and Sparsity: Removing less significant weights and exploiting sparsity in the model to speed up computation and reduce resource usage. - Graph Optimization: This involves optimizing the computation graph of the model to reduce redundancy, fuse operations, and minimize memory usage. Techniques such as constant folding, operation fusion, and common subexpression elimination are applied. - Quantization: Reducing the precision of model parameters and computations (e.g., from 32-bit floating point to 8-bit integers) to improve performance and reduce memory footprint while maintaining acceptable accuracy. - Pruning and Sparsity: Removing less significant weights and exploiting sparsity in the model to speed up computation and reduce resource usage. - BackendTarget-Specific Code Generation: The backend transforms the optimized IR into hardware-specific code. This involves generating low-level code for CPUs, GPUs, TPUs, or other accelerators.Kernel Fusion and Scheduling: Combining multiple small operations into a single kernel to reduce memory accesses and improve performance. Scheduling determines the order of operations to maximize hardware utilization and minimize latency.Memory Management: Efficiently allocating and managing memory resources, including handling tensor layouts and data movement between different memory hierarchies (e.g., CPU cache, GPU memory). - Target-Specific Code Generation: The backend transforms the optimized IR into hardware-specific code. This involves generating low-level code for CPUs, GPUs, TPUs, or other accelerators. - Kernel Fusion and Scheduling: Combining multiple small operations into a single kernel to reduce memory accesses and improve performance. Scheduling determines the order of operations to maximize hardware utilization and minimize latency. - Memory Management: Efficiently allocating and managing memory resources, including handling tensor layouts and data movement between different memory hierarchies (e.g., CPU cache, GPU memory). - Model Ingestion: The frontend takes in machine learning models from high-level frameworks such as TensorFlow, PyTorch, or ONNX. It parses the model and converts it into an intermediate representation (IR) that can be further optimized and transformed. - Intermediate Representation (IR): The IR is a hardware-agnostic representation of the model that serves as a common language between the frontend and the backend of the compiler. Examples include XLA (Accelerated Linear Algebra) for TensorFlow and TorchScript for PyTorch. - Graph Optimization: This involves optimizing the computation graph of the model to reduce redundancy, fuse operations, and minimize memory usage. Techniques such as constant folding, operation fusion, and common subexpression elimination are applied. - Quantization: Reducing the precision of model parameters and computations (e.g., from 32-bit floating point to 8-bit integers) to improve performance and reduce memory footprint while maintaining acceptable accuracy. - Pruning and Sparsity: Removing less significant weights and exploiting sparsity in the model to speed up computation and reduce resource usage. - Target-Specific Code Generation: The backend transforms the optimized IR into hardware-specific code. This involves generating low-level code for CPUs, GPUs, TPUs, or other accelerators. - Kernel Fusion and Scheduling: Combining multiple small operations into a single kernel to reduce memory accesses and improve performance. Scheduling determines the order of operations to maximize hardware utilization and minimize latency. - Memory Management: Efficiently allocating and managing memory resources, including handling tensor layouts and data movement between different memory hierarchies (e.g., CPU cache, GPU memory). ### Benefits of Machine Learning Compilers - Performance Optimization: By generating highly optimized code tailored to the target hardware, MLCs can significantly improve the performance of machine learning models, often achieving orders of magnitude speedup. - Portability: MLCs enable models to run efficiently on a wide range of hardware platforms without requiring manual optimization for each target. - Scalability: They support efficient scaling of machine learning models to larger datasets and more complex architectures by optimizing resource usage. - Reduced Development Time: Automating the optimization and code generation process reduces the need for manual tuning, accelerating the deployment of machine learning models. ### Challenges and Future Directions - Hardware Diversity: The rapidly evolving landscape of specialized hardware accelerators poses a challenge for MLCs to keep up and provide optimal support for new architectures. - Model Complexity: As machine learning models become more complex, with millions or even billions of parameters, efficiently optimizing and compiling these models becomes increasingly challenging. - Dynamic Models: Supporting models that involve dynamic control flow (e.g., conditional statements, loops) adds complexity to the compilation process. - Interoperability: Ensuring seamless interoperability between different machine learning frameworks and hardware targets remains a significant challenge. ### Conclusion Machine Learning Compilers play a crucial role in the deployment of machine learning models, providing the necessary optimizations to leverage the full potential of modern hardware. By automating the transformation of high-level models into efficient executable code, MLCs enable scalable, portable, and high-performance machine learning applications across diverse hardware platforms. As the field continues to advance, addressing the challenges of hardware diversity, model complexity, and interoperability will be key to furthering the capabilities of machine learning compilers. ### Relevant links: - MLIR: A Compiler Infrastructure for the End of Moore’s Law - Mojo - Programming language for next generation compiler technology ## Next ML Systems MLIR: A Compiler Infrastructure for the End of Moore’s Law On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/ai-memory-wall PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources AI & Memory Wall Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # AI & Memory Wall Title and Authors:Title: AI and Memory WallAuthors: Amir Gholami, Zhewei Yao, Sehoon Kim, Coleman Hooper, Michael W. Mahoney, Kurt Keutzer ### Abstract Summary: The paper discusses how the increase in model size and compute requirements for training and serving large language models (LLMs) has shifted the primary performance bottleneck to memory bandwidth. It analyzes the impact of this shift on transformer models and argues for redesigning model architecture, training, and deployment strategies to address memory limitations. ### Key Concepts: - Memory bandwidth limitations - Transformer models (encoder and decoder) - Neural scaling laws - Model architecture redesign - Training and deployment strategies - Arithmetic intensity - Memory operations (MOPs) ### Problem Statement: The main problem addressed in this paper is the growing disparity between the increasing compute requirements for AI models and the slower growth of memory and interconnect bandwidth, which has made memory the primary bottleneck in AI applications. ### Methods and Techniques: - Arithmetic Intensity Analysis: Measures the number of FLOPs per byte loaded from memory to determine performance bottlenecks. - Profiling Transformer Models: Analyzes the total FLOPs, MOPs, arithmetic intensity, and latency of BERT-Base, BERT-Large, and GPT-2 models to understand the impact of memory operations on model performance. - Case Studies: Detailed examination of the runtime characteristics and performance bottlenecks associated with transformer inference, focusing on encoder and decoder architectures. ### Key Results: - Profiling Results: GPT-2 exhibits significantly higher latency compared to BERT models due to higher memory operations and lower arithmetic intensity. - Scaling Disparity: Peak server hardware FLOPS have scaled by 60,000× over the past 20 years, whereas DRAM and interconnect bandwidths have only scaled by 100× and 30×, respectively. - Memory Wall: Memory bandwidth and intra/inter-chip memory transfers are becoming the main bottlenecks for large AI models, particularly in serving scenarios. ### Contributions and Innovations: - Memory Bottleneck Identification: Highlights the critical issue of memory bandwidth as the primary bottleneck in AI applications. - Redesign Proposals: Suggests redesigning AI model architectures, training, and deployment strategies to mitigate memory limitations. - Efficient Training Algorithms: Discusses the need for more data-efficient training methods and optimization algorithms robust to low-precision training. - Deployment Solutions: Proposes model compression techniques such as quantization and pruning to reduce the memory footprint and improve deployment efficiency. ### Future Work: - Developing more data-efficient and memory-efficient training algorithms. - Exploring new AI model architectures that are optimized for memory bandwidth constraints. - Enhancing hardware designs to better balance compute and memory capabilities. ### Applications: - AI Model Training: Improved training methods can lead to more efficient use of resources in developing large language models. - Model Deployment: Enhanced deployment strategies, including model compression, can facilitate the use of large models in real-time applications. - Hardware Design: Insights from the paper can guide the development of future AI accelerators with better memory bandwidth management. ## Next ML Systems FlashAttention-2 ML Systems Efficient Memory Management for LLM Serving with PagedAttention On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/q PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Quantization Technical Primer Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Quantization Technical Primer ### Introduction Quantization is a critical technique used to optimize large language models (LLMs) for deployment in resource-constrained environments. It involves reducing the precision of the numerical values that represent the model's parameters (weights) and activations. The primary goals of quantization are to decrease the model's memory footprint and computational requirements, while maintaining an acceptable level of accuracy. ### Types of Quantization - Post-Training Quantization (PTQ)Static Quantization: Involves calibrating the model on a subset of the training data to determine the optimal quantization parameters. This method is effective but can be less accurate for complex models.Dynamic Quantization: Quantizes the model's weights after training but adjusts the activations dynamically during inference. This method is easier to implement and offers a good balance between performance and complexity. - Static Quantization: Involves calibrating the model on a subset of the training data to determine the optimal quantization parameters. This method is effective but can be less accurate for complex models. - Dynamic Quantization: Quantizes the model's weights after training but adjusts the activations dynamically during inference. This method is easier to implement and offers a good balance between performance and complexity. - Quantization-Aware Training (QAT)During training, the model simulates the effects of quantization, allowing the weights to adjust and minimize the accuracy loss. QAT generally results in better performance compared to PTQ but requires more computational resources during training. - During training, the model simulates the effects of quantization, allowing the weights to adjust and minimize the accuracy loss. QAT generally results in better performance compared to PTQ but requires more computational resources during training. - Static Quantization: Involves calibrating the model on a subset of the training data to determine the optimal quantization parameters. This method is effective but can be less accurate for complex models. - Dynamic Quantization: Quantizes the model's weights after training but adjusts the activations dynamically during inference. This method is easier to implement and offers a good balance between performance and complexity. - During training, the model simulates the effects of quantization, allowing the weights to adjust and minimize the accuracy loss. QAT generally results in better performance compared to PTQ but requires more computational resources during training. ### Quantization Levels - 8-bit Quantization (INT8)The most common form of quantization. It reduces the model size significantly while typically maintaining high accuracy. - The most common form of quantization. It reduces the model size significantly while typically maintaining high accuracy. - Lower-bit Quantization (INT4, INT2)Further reduces model size and increases inference speed but can lead to a more substantial accuracy drop. It is suitable for very resource-constrained environments. - Further reduces model size and increases inference speed but can lead to a more substantial accuracy drop. It is suitable for very resource-constrained environments. - Mixed Precision QuantizationUses a combination of different precisions (e.g., INT8 for weights and FP16 for activations) to balance accuracy and performance. - Uses a combination of different precisions (e.g., INT8 for weights and FP16 for activations) to balance accuracy and performance. - The most common form of quantization. It reduces the model size significantly while typically maintaining high accuracy. - Further reduces model size and increases inference speed but can lead to a more substantial accuracy drop. It is suitable for very resource-constrained environments. - Uses a combination of different precisions (e.g., INT8 for weights and FP16 for activations) to balance accuracy and performance. ### Quantization Techniques - Uniform QuantizationThe range of values is divided into equal-sized intervals. This method is simple and efficient but might not capture the distribution of weights and activations optimally. - The range of values is divided into equal-sized intervals. This method is simple and efficient but might not capture the distribution of weights and activations optimally. - Non-Uniform QuantizationThe intervals are adjusted based on the distribution of values. Techniques like logarithmic quantization fall into this category, offering better accuracy at the cost of increased complexity. - The intervals are adjusted based on the distribution of values. Techniques like logarithmic quantization fall into this category, offering better accuracy at the cost of increased complexity. - The range of values is divided into equal-sized intervals. This method is simple and efficient but might not capture the distribution of weights and activations optimally. - The intervals are adjusted based on the distribution of values. Techniques like logarithmic quantization fall into this category, offering better accuracy at the cost of increased complexity. ### Benefits of Quantization - Reduced Memory Footprint: Quantized models require less memory, making them suitable for edge devices. - Faster Inference: Lower precision arithmetic operations are faster, leading to reduced inference latency. - Energy Efficiency: Quantized models consume less power, which is critical for battery-powered devices. ### Challenges and Considerations - Accuracy Degradation: Quantization can lead to a drop in model accuracy. Techniques like QAT are essential to mitigate this issue. - Hardware Support: Effective deployment of quantized models requires hardware that supports low-precision arithmetic operations. - Compatibility: Ensuring compatibility with existing machine learning frameworks and inference engines is crucial for seamless deployment. ### Influential Papers on Quantization - "Quantizing Deep Convolutional Networks for Efficient Inference: A Whitepaper" by Song Han, Huizi Mao, and William J. Dally (2015)This paper provides a comprehensive overview of quantization techniques and their application to deep convolutional networks, laying the groundwork for many subsequent advancements.Link - This paper provides a comprehensive overview of quantization techniques and their application to deep convolutional networks, laying the groundwork for many subsequent advancements. - Link - "Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding" by Song Han, Huizi Mao, and William J. Dally (2015)Introduces a three-stage pipeline combining pruning, quantization, and Huffman coding to achieve significant compression and speedup.Link - Introduces a three-stage pipeline combining pruning, quantization, and Huffman coding to achieve significant compression and speedup. - Link - "Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference" by Benoit Jacob et al. (2018)Discusses techniques for training neural networks to operate with integer arithmetic only, which is essential for efficient deployment on specialized hardware.Link - Discusses techniques for training neural networks to operate with integer arithmetic only, which is essential for efficient deployment on specialized hardware. - Link - "Mixed Precision Training" by Paulius Micikevicius et al. (2017)Explores the use of mixed precision during training to achieve the benefits of quantization while maintaining high model accuracy.Link - Explores the use of mixed precision during training to achieve the benefits of quantization while maintaining high model accuracy. - Link - "Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference" by Benoit Jacob et al. (2018)Details the practical aspects and benefits of using integer arithmetic for neural network inference.Link - Details the practical aspects and benefits of using integer arithmetic for neural network inference. - Link - This paper provides a comprehensive overview of quantization techniques and their application to deep convolutional networks, laying the groundwork for many subsequent advancements. - Link - Introduces a three-stage pipeline combining pruning, quantization, and Huffman coding to achieve significant compression and speedup. - Link - Discusses techniques for training neural networks to operate with integer arithmetic only, which is essential for efficient deployment on specialized hardware. - Link - Explores the use of mixed precision during training to achieve the benefits of quantization while maintaining high model accuracy. - Link - Details the practical aspects and benefits of using integer arithmetic for neural network inference. - Link ### Conclusion Quantization is a powerful technique for optimizing large language models, enabling their deployment in resource-limited environments without significant sacrifices in performance. As the demand for efficient AI solutions grows, advancements in quantization methods will continue to play a pivotal role in the evolution of machine learning systems. By leveraging the strategies and insights from influential research papers, practitioners can effectively apply quantization to enhance the efficiency and scalability of their models. ### Relevant Links: - Quantization guide on MAX ## Next On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/mixtral-of-experts PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Mixtral of Experts Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Mixtral of Experts ### Title and Authors: Title:Mixtral of Experts Authors:Albert Q. Jiang, Alexandre Sablayrolles, Antoine Roux, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Sandeep Subramanian, Sophia Yang, Szymon Antoniak, Teven Le Scao, Théophile Gervet, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed. ### Abstract Summary: Mixtral 8x7B is a Sparse Mixture of Experts (SMoE) language model that uses 8 experts per layer, selecting 2 experts per token dynamically. This model outperforms or matches Llama 2 70B and GPT-3.5 across various benchmarks, especially excelling in mathematics, code generation, and multilingual tasks. ### Key Concepts: - Sparse Mixture of Experts (SMoE) - Router network for expert selection - Multilingual pretraining - Instruction fine-tuning - Efficiency in parameter usage - Comparative benchmarks with Llama 2 and GPT-3.5 - Reduced biases in language models - Open-source model release under Apache 2.0 license ### Problem Statement: The main problem addressed in this paper is improving the efficiency and performance of large language models by using a Sparse Mixture of Experts (SMoE) architecture to reduce computational costs while maintaining or surpassing the performance of existing models like Llama 2 70B and GPT-3.5. ### Methods and Techniques: - Sparse Mixture of Experts (SMoE):Each layer in the model contains 8 experts. For every token, a router network selects 2 experts to process the token. This allows the model to utilize a subset of parameters, enhancing efficiency. - Each layer in the model contains 8 experts. For every token, a router network selects 2 experts to process the token. This allows the model to utilize a subset of parameters, enhancing efficiency. - Router Network:A gating mechanism that dynamically selects the top-K experts for each token using a softmax over the top-K logits of a linear layer. - A gating mechanism that dynamically selects the top-K experts for each token using a softmax over the top-K logits of a linear layer. - Multilingual Pretraining:Training the model on a large, diverse multilingual dataset with a context size of 32k tokens to improve performance across different languages. - Training the model on a large, diverse multilingual dataset with a context size of 32k tokens to improve performance across different languages. - Instruction Fine-Tuning:Using supervised fine-tuning and Direct Preference Optimization (DPO) to enhance the model's performance in following instructions. - Using supervised fine-tuning and Direct Preference Optimization (DPO) to enhance the model's performance in following instructions. - Efficient Inference with Megablocks:Utilizing specialized kernels and distributed processing techniques for efficient execution of the MoE layers. - Utilizing specialized kernels and distributed processing techniques for efficient execution of the MoE layers. - Each layer in the model contains 8 experts. For every token, a router network selects 2 experts to process the token. This allows the model to utilize a subset of parameters, enhancing efficiency. - A gating mechanism that dynamically selects the top-K experts for each token using a softmax over the top-K logits of a linear layer. - Training the model on a large, diverse multilingual dataset with a context size of 32k tokens to improve performance across different languages. - Using supervised fine-tuning and Direct Preference Optimization (DPO) to enhance the model's performance in following instructions. - Utilizing specialized kernels and distributed processing techniques for efficient execution of the MoE layers. ### Key Results: - Performance Benchmarks:Mixtral 8x7B outperforms Llama 2 70B and GPT-3.5 on various tasks including mathematics, code generation, and multilingual understanding.Superior performance in specific benchmarks like GSM8K (mathematics) and MBPP (code generation). - Mixtral 8x7B outperforms Llama 2 70B and GPT-3.5 on various tasks including mathematics, code generation, and multilingual understanding. - Superior performance in specific benchmarks like GSM8K (mathematics) and MBPP (code generation). - Efficiency:Uses 5x fewer active parameters than Llama 2 70B while achieving higher or similar performance. - Uses 5x fewer active parameters than Llama 2 70B while achieving higher or similar performance. - Bias Reduction:Demonstrates reduced biases and a more balanced sentiment profile in benchmarks such as BBQ and BOLD. - Demonstrates reduced biases and a more balanced sentiment profile in benchmarks such as BBQ and BOLD. - Mixtral 8x7B outperforms Llama 2 70B and GPT-3.5 on various tasks including mathematics, code generation, and multilingual understanding. - Superior performance in specific benchmarks like GSM8K (mathematics) and MBPP (code generation). - Uses 5x fewer active parameters than Llama 2 70B while achieving higher or similar performance. - Demonstrates reduced biases and a more balanced sentiment profile in benchmarks such as BBQ and BOLD. ### Contributions and Innovations: - Sparse Mixture of Experts Architecture:Efficient use of parameters by dynamically selecting a subset of experts for each token. - Efficient use of parameters by dynamically selecting a subset of experts for each token. - Instruction-Tuned Model:Fine-tuned variant (Mixtral 8x7B – Instruct) that surpasses GPT-3.5 Turbo and other models in human benchmarks. - Fine-tuned variant (Mixtral 8x7B – Instruct) that surpasses GPT-3.5 Turbo and other models in human benchmarks. - Open-Source Release:Both base and instruct models are released under the Apache 2.0 license, promoting accessibility and further research. - Both base and instruct models are released under the Apache 2.0 license, promoting accessibility and further research. - Efficient use of parameters by dynamically selecting a subset of experts for each token. - Fine-tuned variant (Mixtral 8x7B – Instruct) that surpasses GPT-3.5 Turbo and other models in human benchmarks. - Both base and instruct models are released under the Apache 2.0 license, promoting accessibility and further research. ### Future Work: The authors suggest further exploration in the following areas: - Enhancing the routing mechanism to improve load balancing across experts. - Investigating the impact of different expert selection strategies. - Extending the model's capabilities to other domains and tasks. ### Applications: - Natural Language Understanding:Enhanced performance in tasks requiring comprehension of large contexts and diverse languages. - Enhanced performance in tasks requiring comprehension of large contexts and diverse languages. - Code Generation:Superior results in programming tasks, making it useful for automated code synthesis and completion. - Superior results in programming tasks, making it useful for automated code synthesis and completion. - Mathematics:High accuracy in solving complex mathematical problems, applicable in educational tools and scientific research. - High accuracy in solving complex mathematical problems, applicable in educational tools and scientific research. - Enhanced performance in tasks requiring comprehension of large contexts and diverse languages. - Superior results in programming tasks, making it useful for automated code synthesis and completion. - High accuracy in solving complex mathematical problems, applicable in educational tools and scientific research. ### Relevant Links: - Code Repository - Webpage - LMSys Leaderboard ## Next Models Mistral-7B On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/llama PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Llama 2 Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Llama 2 Title and Authors: - Title: "Llama 2: Open Foundation and Fine-Tuned Chat Models" - Authors: Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, Thomas Scialom. Abstract Summary: - The paper introduces Llama 2, a collection of pretrained and fine-tuned large language models ranging from 7 billion to 70 billion parameters, optimized for dialogue use cases. Llama 2-Chat models outperform existing open-source models on most benchmarks and offer a viable alternative to some closed-source models, with detailed fine-tuning and safety improvements shared to encourage responsible development of large language models. Key Concepts: - Large Language Models (LLMs) - Pretrained and fine-tuned models - Llama 2-Chat - Dialogue optimization - Safety and helpfulness benchmarks - Reinforcement Learning with Human Feedback (RLHF) - Supervised Fine-Tuning (SFT) - Model safety and evaluation Problem Statement: - The main problem addressed by the paper is the development of open, high-performing language models that can serve as viable alternatives to closed-source models, particularly optimized for dialogue use cases while ensuring safety and helpfulness. Methods and Techniques: - Pretraining:Utilized a large corpus of publicly available data, excluding data from Meta’s products and services, with robust data cleaning and increased context length.Applied the AdamW optimizer, cosine learning rate schedule, and techniques like grouped-query attention for better scalability. - Utilized a large corpus of publicly available data, excluding data from Meta’s products and services, with robust data cleaning and increased context length. - Applied the AdamW optimizer, cosine learning rate schedule, and techniques like grouped-query attention for better scalability. - Supervised Fine-Tuning (SFT):Collected high-quality instruction tuning data focusing on dialogue-style instructions.Fine-tuned using a special token to separate prompt and answer segments, with a cosine learning rate schedule and weight decay. - Collected high-quality instruction tuning data focusing on dialogue-style instructions. - Fine-tuned using a special token to separate prompt and answer segments, with a cosine learning rate schedule and weight decay. - Reinforcement Learning with Human Feedback (RLHF):Collected human preference data using a binary comparison protocol.Trained two separate reward models for helpfulness and safety.Employed Proximal Policy Optimization (PPO) and Rejection Sampling for iterative fine-tuning, with safety checks and margin components in the loss function to improve alignment. - Collected human preference data using a binary comparison protocol. - Trained two separate reward models for helpfulness and safety. - Employed Proximal Policy Optimization (PPO) and Rejection Sampling for iterative fine-tuning, with safety checks and margin components in the loss function to improve alignment. - Ghost Attention (GAtt):Introduced a technique to maintain instruction consistency over multiple turns in dialogue by synthetically concatenating instructions to user messages. - Introduced a technique to maintain instruction consistency over multiple turns in dialogue by synthetically concatenating instructions to user messages. - Utilized a large corpus of publicly available data, excluding data from Meta’s products and services, with robust data cleaning and increased context length. - Applied the AdamW optimizer, cosine learning rate schedule, and techniques like grouped-query attention for better scalability. - Collected high-quality instruction tuning data focusing on dialogue-style instructions. - Fine-tuned using a special token to separate prompt and answer segments, with a cosine learning rate schedule and weight decay. - Collected human preference data using a binary comparison protocol. - Trained two separate reward models for helpfulness and safety. - Employed Proximal Policy Optimization (PPO) and Rejection Sampling for iterative fine-tuning, with safety checks and margin components in the loss function to improve alignment. - Introduced a technique to maintain instruction consistency over multiple turns in dialogue by synthetically concatenating instructions to user messages. Key Results: - Llama 2-Chat models generally perform better than existing open-source models and are on par with some closed-source models on various benchmarks. - The models demonstrated significant improvements in safety and helpfulness through iterative fine-tuning and reward modeling. - Human evaluations showed that Llama 2-Chat outperformed ChatGPT in both safety and helpfulness. Contributions and Innovations: - Development and open release of Llama 2, a family of pretrained and fine-tuned LLMs, with detailed methodology to improve model safety and performance. - Introduction of Ghost Attention (GAtt) to enhance multi-turn dialogue consistency. - Iterative application of RLHF combining PPO and Rejection Sampling for better alignment with human preferences. - Comprehensive evaluation framework and release of models for research and commercial use, fostering community collaboration. Future Work: - The authors suggest further research on fine-tuning techniques, handling instruction consistency in dialogues, and exploring additional methods to enhance model safety and alignment with human preferences. Applications: - Customer service chatbots - Virtual assistants - Interactive educational tools - Content generation and summarization - Automated technical support Relevant Links: - Meta AI resources for Llama - Llama responsible use guide - Llama GitHub repository - MAX end to end llama pipelines example ## Next Models Mistral-7B Models Large Language Model Technical Primer On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/byte-pair-encoding PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Byte Pair Encoding (BPE) Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Byte Pair Encoding (BPE) ### Title and Authors: Title: Neural Machine Translation of Rare Words with Subword Units Authors: Rico Sennrich, Barry Haddow, Alexandra Birch ### Abstract Summary: This paper introduces an approach for neural machine translation (NMT) that enables open-vocabulary translation by encoding rare and unknown words as sequences of subword units. This method, which uses techniques like byte pair encoding (BPE), outperforms traditional back-off dictionary methods for the WMT 2015 English→German and English→Russian translation tasks. ### Key Concepts: - Neural Machine Translation (NMT) - Open-vocabulary translation - Subword units - Byte Pair Encoding (BPE) - Rare word translation - Character-level models - Segmentation techniques - BLEU score - CHRF3 score ### Problem Statement: The main problem addressed in this paper is the translation of rare and out-of-vocabulary words in NMT models, which traditionally rely on fixed vocabularies and back-off dictionaries, limiting their effectiveness. ### Methods and Techniques: - Neural Machine Translation (NMT) Architecture: The study uses an encoder-decoder network with recurrent neural networks (RNNs). The encoder is a bidirectional RNN with gated recurrent units (GRUs) that processes the input sequence. The decoder predicts the target sequence, using a context vector computed from the encoder's annotations through an alignment model. - Subword Units: The paper explores the use of subword units to encode rare and unknown words. This involves segmenting words into smaller units, such as morphemes or phonemes, that can be translated more effectively than whole words. - Byte Pair Encoding (BPE): BPE is adapted for word segmentation by iteratively merging the most frequent pairs of characters in the vocabulary. This results in a fixed-size vocabulary of variable-length character sequences that can represent an open vocabulary. ### Key Results: - BLEU Scores: Subword models improved BLEU scores over baseline models for the WMT 2015 tasks, with increases of up to 1.1 for English→German and 1.3 for English→Russian. - CHRF3 Scores: Character n-gram F3 scores also showed improvements, correlating well with human judgment. - Unigram F1 Scores: The subword models achieved better accuracy for rare and unseen words compared to large-vocabulary models and back-off dictionaries. ### Contributions and Innovations: - Open-Vocabulary NMT: Demonstrated that NMT can handle open-vocabulary translation by using subword units, simplifying the translation process and improving accuracy. - BPE for Word Segmentation: Adapted BPE for segmenting words into subword units, creating a compact and efficient representation for neural networks. - Translation Quality: Improved translation quality for rare and unseen words without relying on extensive dictionaries. ### Future Work: The authors suggest exploring: - Automatic learning of optimal vocabulary size for different language pairs and training data amounts. - Developing bilingual segmentation algorithms that can improve the alignment of subword units across languages. ### Applications: - Machine Translation Systems: Can be used in developing more robust and accurate machine translation systems for languages with complex morphology or those with limited resources. - Text Generation: Useful in applications requiring open-vocabulary text generation, such as chatbots or automated content creation. - Speech Recognition: Potentially beneficial for speech-to-text systems by improving the handling of rare and novel words. ### Relevant Links: - ArXiv Paper ## Next ML Systems Rotary Position Embedding (RoPE) On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/flash-attenti PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources FlashAttention Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # FlashAttention ### Title and Authors Title: FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness Authors: Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra, and Christopher Ré ### Abstract Summary Transformers are computationally expensive and memory-intensive for long sequences due to the quadratic complexity of self-attention. FlashAttention is an IO-aware exact attention algorithm that uses tiling to minimize memory reads/writes, resulting in significant speedup and reduced memory usage without sacrificing model quality. ### Key Concepts - Transformers - Self-Attention - IO-Aware Algorithms - Tiling - GPU Memory Hierarchy - FlashAttention - Block-Sparse Attention - Model Training Speedup - Memory Efficiency - Long-Range Arena Benchmark ### Problem Statement The main problem addressed by this paper is the inefficiency of standard self-attention mechanisms in Transformers due to their quadratic time and memory complexity, particularly for long sequences. ### Methods and Techniques - Tiling: The attention computation is restructured to split the input into blocks, allowing incremental computation of the softmax reduction. This reduces the number of memory accesses. - Recomputation: Instead of storing large intermediate matrices, the softmax normalization factor from the forward pass is stored to recompute attention on-chip during the backward pass. - CUDA Implementation: Fine-grained control over memory access is achieved by implementing FlashAttention in CUDA and fusing all attention operations into one GPU kernel. ### Key Results - FlashAttention reduces the number of high bandwidth memory (HBM) accesses compared to standard attention, resulting in up to 7.6× speedup on GPT-2. - FlashAttention provides a 15% speedup on BERT-large training compared to the MLPerf 1.1 training speed record, and 3× speedup on GPT-2. - It enables longer context in Transformers, yielding higher quality models, such as a 0.7 better perplexity on GPT-2 and a 6.4-point lift on long-document classification. - FlashAttention enables the first Transformers to achieve better-than-chance performance on Path-X (16K sequence length) and Path-256 (64K sequence length). ### Contributions and Innovations - IO-Awareness: The introduction of IO-aware principles to reduce memory accesses, significantly improving efficiency. - Exact and Approximate Attention: FlashAttention is extended to block-sparse attention, providing faster approximate attention. - Open-Source Implementation: FlashAttention is implemented in CUDA and open-sourced, making it easier for others to build on this work. ### Future Work The authors suggest: - Extending the IO-aware approach to other deep learning modules beyond attention. - Developing methods for writing attention algorithms in high-level languages that can compile to IO-aware implementations. - Exploring multi-GPU implementations for parallelizing attention computations across multiple GPUs. ### Applications - Natural Language Processing (NLP): Faster and more memory-efficient training of large language models like BERT and GPT-2. - Image Classification: Improved attention mechanisms in Transformer-based image classification models. - Long-Document Processing: Enhanced performance in tasks requiring long-context understanding, such as legal document analysis and medical report classification. ### Relevant Links - FlashAttention code on GitHub ## Next ML Systems FlashAttention-2 ML Systems Efficient Memory Management for LLM Serving with PagedAttention On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/flashattention-2 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources FlashAttention-2 Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # FlashAttention-2 ### Title and Authors: Title: FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning Authors: Tri Dao (Department of Computer Science, Princeton University; Department of Computer Science, Stanford University) ### Abstract Summary: FlashAttention-2 improves upon FlashAttention by optimizing work partitioning and parallelism to significantly enhance efficiency and speed. The new algorithm achieves approximately 2× speedup over FlashAttention, reaching 50-73% of the theoretical maximum FLOPs/s on A100 GPUs, and enables faster end-to-end training of GPT-style models. ### Key Concepts: - Scaling Transformers - Attention Layer Bottleneck - FlashAttention - GPU Memory Hierarchy - Work Partitioning - Algorithm Optimization - Parallelism in GPUs - Training Speed of GPT-style Models ### Problem Statement: The main problem addressed by this paper is the inefficiency in the attention layer of Transformers when scaling to longer sequence lengths, which results in high memory usage and slow runtime. ### Methods and Techniques: - Algorithm Tweaks:Reducing Non-Matmul FLOPs: Optimizing the algorithm to minimize non-matmul operations which are slower on GPUs.Parallelizing Attention Computation: Distributing the computation across different thread blocks to increase GPU occupancy. - Reducing Non-Matmul FLOPs: Optimizing the algorithm to minimize non-matmul operations which are slower on GPUs. - Parallelizing Attention Computation: Distributing the computation across different thread blocks to increase GPU occupancy. - Work Partitioning:Forward Pass: Parallelizing both forward and backward passes along the sequence length dimension.Backward Pass: Using atomic adds to manage updates across different thread blocks. - Forward Pass: Parallelizing both forward and backward passes along the sequence length dimension. - Backward Pass: Using atomic adds to manage updates across different thread blocks. - Work Partitioning Between Warps:Splitting the workload within each thread block to reduce shared memory access and improve efficiency. - Splitting the workload within each thread block to reduce shared memory access and improve efficiency. - Reducing Non-Matmul FLOPs: Optimizing the algorithm to minimize non-matmul operations which are slower on GPUs. - Parallelizing Attention Computation: Distributing the computation across different thread blocks to increase GPU occupancy. - Forward Pass: Parallelizing both forward and backward passes along the sequence length dimension. - Backward Pass: Using atomic adds to manage updates across different thread blocks. - Splitting the workload within each thread block to reduce shared memory access and improve efficiency. ### Key Results: FlashAttention-2 achieves: - 2× speedup compared to FlashAttention. - 1.3-2.5× speedup compared to FlashAttention in Triton. - Up to 10× faster than standard attention implementation. - Training speed up to 225 TFLOPs/s per A100 GPU (72% model FLOPs utilization). ### Contributions and Innovations: - Algorithmic Improvements: Significant reduction in non-matmul FLOPs and better parallelization. - Parallelism and Work Partitioning: Enhanced GPU resource utilization through optimized work distribution across thread blocks and warps. - Empirical Validation: Demonstrated substantial speedup and efficiency improvements in attention computations and end-to-end model training. ### Future Work: - Optimize FlashAttention-2 for new hardware features on H100 GPUs. - Extend the applicability to other devices like AMD GPUs and new data types such as FP8. - Collaborate with compiler researchers to make these optimization techniques easily programmable. ### Applications: - Language Modeling: Training models with longer context lengths for better understanding of books and long-form content. - High-Resolution Image Understanding: Enabling models to process and analyze high-resolution images more efficiently. - Audio and Video Generation: Improving performance in applications involving long sequences of audio and video data. - Long Document Querying: Enhancing capabilities of models to handle and query long documents. ### Relevant Links: - FlashAttention-2 GitHub Repository - Triton Implementation - xformers Library ## Next ML Systems FlashAttention ML Systems AI & Memory Wall On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/mistral PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Mistral-7B Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Mistral-7B ## Title and Authors The title of the paper is "Mistral 7B". The authors include Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. ## Abstract Summary Mistral 7B is a 7-billion-parameter language model noted for its superior performance and efficiency, outperforming existing models like Llama 2 (13B) and Llama 1 (34B) across various benchmarks. It incorporates innovative attention mechanisms, such as grouped-query and sliding window attention, to enhance inference speed and manage long sequences effectively. ## Key Concepts - Grouped-query attention (GQA) - Sliding window attention (SWA) - Fine-tuning for instruction following - Model efficiency and performance metrics - Application in real-world scenarios - Integration with cloud platforms and Hugging Face Problem Statement:The main challenge addressed by the paper is the need for high-performance language models that maintain efficiency and reduced computational costs, particularly important for deployment in real-world applications. ## Methods and Techniques - Grouped-query attention (GQA): Accelerates inference speed and reduces memory requirements during decoding, enabling higher throughput. - Sliding window attention (SWA): Manages longer sequences effectively at a lower computational cost, helping to alleviate common limitations in large language models. ## Key Results Mistral 7B surpasses Llama 2 13B and Llama 1 34B in all benchmarks, especially in code generation, mathematics, and reasoning tasks. It approaches the coding performance of Code-Llama 7B without compromising on non-code related benchmarks. ## Contributions and Innovations The paper introduces significant advancements in attention mechanisms, demonstrating that Mistral 7B can achieve high performance while maintaining efficient inference. This is particularly relevant for ML engineers looking to implement efficient, high-performance models in production environments. ## Future Work The authors suggest exploring further improvements in model performance and efficiency, possibly through more innovative attention mechanisms or architectural tweaks. ## Applications Mistral 7B's adaptability makes it suitable for a wide range of applications, including real-time systems on cloud platforms, integration with AI platforms like Hugging Face, and fine-tuning for specific tasks such as chat models and instruction following. ## Relevant Links - Mistral 7B Source Code: Mistral Source Code - Mistral 7B Announcement Page: Mistral Announcement - SkyPilot: SkyPilot - Hugging Face Repository: Mistral on Hugging Face - xFormers: xFormers Library These links provide access to the model's codebase, additional details about the model, and integration tools for deploying and using the model. ## Next Models Llama 2 Models Mixtral of Experts On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/p PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Phi-3-mini Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Phi-3-mini ### Title and Authors: The title of the paper is "Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone". The authors are a large team from Microsoft including Marah Abdin, Russell J. Hewett, Olatunji Ruwase, Sam Ade Jacobs, Jamie Huynh, and many others, totaling over fifty contributors. ### Abstract Summary: The paper introduces phi-3-mini, a compact 3.8 billion parameter language model capable of running on mobile devices with performance comparable to larger models such as GPT-3.5 and Mixtral 8x7B. It emphasizes the use of a unique dataset composed of heavily filtered web data and synthetic data to train smaller models without compromising their performance. ### Key Concepts: - Small Language Models (SLMs): Efficient models capable of deployment on devices with limited resources. - Dataset Optimization: Use of heavily filtered web data and synthetic data for training to enhance model performance. - Model Scaling: Detailed scaling results for models with different parameters (phi-3-mini, phi-3-small, phi-3-medium) showing effectiveness at various scales. - Quantization: Techniques to reduce the model size for mobile deployment, specifically 4-bit quantization for phi-3-mini. ### Problem Statement: The main challenge addressed by the paper is developing a language model that is both small enough to operate on a mobile phone and powerful enough to perform at the level of much larger contemporary models. ### Methods and Techniques: - Transformer Architecture: Utilizing a transformer decoder architecture with modifications for size and performance optimization. - Quantization: Applying 4-bit quantization to the model to fit and perform efficiently on mobile devices. - LongRope: A technique to extend the context length in the smaller model version, enabling it to handle longer text sequences effectively. - Data Filtering: Innovations in selecting and processing training data to maximize model effectiveness without the need for extensive computing resources. ### Key Results: Phi-3-mini demonstrated strong performance across various benchmarks, achieving scores like 69% on MMLU and 8.38 on MT-bench. It rivals larger models and showcases the effectiveness of its training and architecture in a mobile-friendly format. ### Contributions and Innovations: - Model Size Reduction: Successfully reducing the model size to enable local deployment on mobile devices without losing performance. - Data Filtering and Synthetic Data Use: Innovations in data preparation that allow smaller models to perform as well as larger ones. - Model Architectural Adjustments: Implementing architectural techniques like LongRope and quantization to maintain performance within the constraints of mobile hardware. ### Future Work: The authors suggest further optimization of their data mixture for larger models and continued investigation into reducing the model size while maintaining or improving performance benchmarks. ### Applications: The phi-3-mini can be used in mobile applications requiring natural language processing, such as virtual assistants, mobile-based chatbots, and real-time language translation applications that can operate fully offline. ### Relevant Links Here are the relevant links extracted from the paper: - Preprints and Research Publications:Gunasekar, Suriya, et al. "Textbooks Are All You Need." arXiv preprint arXiv:2306.11644, 2023.Vaswani, Ashish, et al. "Attention Is All You Need." Advances in Neural Information Processing Systems, vol. 30, 2017.Kaplan, Jared, et al. "Scaling Laws for Neural Language Models." arXiv preprint arXiv:2001.08361, 2020.Ding, Yiran, et al. "Longrope: Extending LLM Context Window Beyond 2 Million Tokens." arXiv preprint arXiv:2409.05463, 2024.Other various arXiv preprints cited throughout the paper related to language models and their training methods. - Gunasekar, Suriya, et al. "Textbooks Are All You Need." arXiv preprint arXiv:2306.11644, 2023. - Vaswani, Ashish, et al. "Attention Is All You Need." Advances in Neural Information Processing Systems, vol. 30, 2017. - Kaplan, Jared, et al. "Scaling Laws for Neural Language Models." arXiv preprint arXiv:2001.08361, 2020. - Ding, Yiran, et al. "Longrope: Extending LLM Context Window Beyond 2 Million Tokens." arXiv preprint arXiv:2409.05463, 2024. - Other various arXiv preprints cited throughout the paper related to language models and their training methods. - Benchmarks and Datasets:Hendrycks, Dan, et al. "Measuring Mathematical Problem Solving With the MATH Dataset." 2021.Zellers, Rowan, et al. "HellaSwag: Can a Machine Really Finish Your Sentence?" ACL 2019.Clark, Peter, et al. "Think You Have Solved Question Answering? Try ARC, The AI2 Reasoning Challenge." 2018.Other benchmarks like GSM-8K, MedQA, AGIEval, TriviaQA, Arc-C, Arc-E, PIQA, SociQA, BigBench-Hard, WinoGrande, OpenBookQA, BoolQ, CommonsenseQA, TruthfulQA, and HumanEval mentioned for model evaluation. - Hendrycks, Dan, et al. "Measuring Mathematical Problem Solving With the MATH Dataset." 2021. - Zellers, Rowan, et al. "HellaSwag: Can a Machine Really Finish Your Sentence?" ACL 2019. - Clark, Peter, et al. "Think You Have Solved Question Answering? Try ARC, The AI2 Reasoning Challenge." 2018. - Other benchmarks like GSM-8K, MedQA, AGIEval, TriviaQA, Arc-C, Arc-E, PIQA, SociQA, BigBench-Hard, WinoGrande, OpenBookQA, BoolQ, CommonsenseQA, TruthfulQA, and HumanEval mentioned for model evaluation. - Organizations and Projects:Meta AI's Llama-3 announcement.Various references to OpenAI's GPT models and their blogs. - Meta AI's Llama-3 announcement. - Various references to OpenAI's GPT models and their blogs. - Gunasekar, Suriya, et al. "Textbooks Are All You Need." arXiv preprint arXiv:2306.11644, 2023. - Vaswani, Ashish, et al. "Attention Is All You Need." Advances in Neural Information Processing Systems, vol. 30, 2017. - Kaplan, Jared, et al. "Scaling Laws for Neural Language Models." arXiv preprint arXiv:2001.08361, 2020. - Ding, Yiran, et al. "Longrope: Extending LLM Context Window Beyond 2 Million Tokens." arXiv preprint arXiv:2409.05463, 2024. - Other various arXiv preprints cited throughout the paper related to language models and their training methods. - Hendrycks, Dan, et al. "Measuring Mathematical Problem Solving With the MATH Dataset." 2021. - Zellers, Rowan, et al. "HellaSwag: Can a Machine Really Finish Your Sentence?" ACL 2019. - Clark, Peter, et al. "Think You Have Solved Question Answering? Try ARC, The AI2 Reasoning Challenge." 2018. - Other benchmarks like GSM-8K, MedQA, AGIEval, TriviaQA, Arc-C, Arc-E, PIQA, SociQA, BigBench-Hard, WinoGrande, OpenBookQA, BoolQ, CommonsenseQA, TruthfulQA, and HumanEval mentioned for model evaluation. - Meta AI's Llama-3 announcement. - Various references to OpenAI's GPT models and their blogs. ## Next Models Gemma: Open Models Based on Gemini Research and Technology On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/gemma-open-models-based-on-gemini-research-and-technology PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Gemma: Open Models Based on Gemini Research and Technology Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Gemma: Open Models Based on Gemini Research and Technology ## Title and Authors - Title: "Gemma: Open Models Based on Gemini Research and Technology" - Authors: Gemma Team, Google DeepMind ## Abstract Summary The paper introduces Gemma, a series of lightweight, state-of-the-art open models derived from the Gemini models. These models showcase robust performance across various benchmarks in language understanding, reasoning, and safety, highlighting the critical role of responsible large language model (LLM) releases for safety and innovation. ## Key Concepts - Large Language Models (LLMs) - Model scaling (2 billion and 7 billion parameters) - Performance evaluation across multiple benchmarks - Safety and responsibility in AI - Open-source availability for research and development ## Problem Statement The main problem addressed is developing efficient, scalable, and safe large language models that can be openly accessed for further research and application development, focusing on improving safety standards and innovation in the field of LLMs. ## Methods and Techniques Methods and Techniques: - Data Training: Trained on up to 6 trillion tokens using techniques inspired by the Gemini model family. - Architectural Innovations: Implementation of improvements like Multi-Query Attention, RoPE Embeddings, and GeGLU Activations. - Fine-Tuning: Both models were fine-tuned for dialogue, instruction-following, helpfulness, and safety. - Evaluation: Comprehensive benchmarks for quantitative and qualitative analysis, including performance comparisons with other models. ## Key Results - Gemma models outperform similarly sized models in 11 out of 18 text-based tasks. - Demonstrated advancements in safety and responsibility in model deployment. - Provided extensive evaluations and comparative performance metrics (see Fig. 1 in the document for a visual comparison). ## Benchmark Overview The paper provides detailed comparative performance benchmarks of the Gemma models against other models. Here are some key findings from the benchmark evaluations included in the document: ### Models compared with - LLaMA 2 (7B and 13B) - Mistral (7B) - Gemma (2B and 7B) ### Key Benchmarks and Results - MMLU (Mathematics and Science):Gemma 7B achieves 64.3% top-1 accuracy in 5-shot settings, outperforming LLaMA 2 (7B at 45.3% and 13B at 54.8%) and Mistral (7B at 62.5%).This demonstrates Gemma's superior capabilities in handling complex reasoning tasks in mathematics and science. - Gemma 7B achieves 64.3% top-1 accuracy in 5-shot settings, outperforming LLaMA 2 (7B at 45.3% and 13B at 54.8%) and Mistral (7B at 62.5%). - This demonstrates Gemma's superior capabilities in handling complex reasoning tasks in mathematics and science. - HellaSwag (Contextual Commonsense Reasoning):Gemma 7B scores 81.2% in 0-shot settings, matching Mistral and slightly outperforming LLaMA 2 13B (80.7%). - Gemma 7B scores 81.2% in 0-shot settings, matching Mistral and slightly outperforming LLaMA 2 13B (80.7%). - PIQA (Physical Interaction Question Answering):Again, Gemma 7B scores highly with 81.2%, indicating strong performance in physical reasoning. - Again, Gemma 7B scores highly with 81.2%, indicating strong performance in physical reasoning. - Winogrande (Commonsense Reasoning):Gemma 7B scores 72.3% in partial scoring settings, showing competitive performance in commonsense reasoning. - Gemma 7B scores 72.3% in partial scoring settings, showing competitive performance in commonsense reasoning. - Code-related benchmarks (e.g., HumanEval, MBPP):Gemma 7B excels in code synthesis and problem-solving, with scores like 32.3% pass@1 in HumanEval and 44.4% in 3-shot MBPP, significantly higher than the competitors. - Gemma 7B excels in code synthesis and problem-solving, with scores like 32.3% pass@1 in HumanEval and 44.4% in 3-shot MBPP, significantly higher than the competitors. - Miscellaneous Tasks:In other tasks such as SIQA, Boolq, and ARC (question answering), Gemma generally matches or exceeds performance benchmarks set by similarly sized models. - In other tasks such as SIQA, Boolq, and ARC (question answering), Gemma generally matches or exceeds performance benchmarks set by similarly sized models. - Gemma 7B achieves 64.3% top-1 accuracy in 5-shot settings, outperforming LLaMA 2 (7B at 45.3% and 13B at 54.8%) and Mistral (7B at 62.5%). - This demonstrates Gemma's superior capabilities in handling complex reasoning tasks in mathematics and science. - Gemma 7B scores 81.2% in 0-shot settings, matching Mistral and slightly outperforming LLaMA 2 13B (80.7%). - Again, Gemma 7B scores highly with 81.2%, indicating strong performance in physical reasoning. - Gemma 7B scores 72.3% in partial scoring settings, showing competitive performance in commonsense reasoning. - Gemma 7B excels in code synthesis and problem-solving, with scores like 32.3% pass@1 in HumanEval and 44.4% in 3-shot MBPP, significantly higher than the competitors. - In other tasks such as SIQA, Boolq, and ARC (question answering), Gemma generally matches or exceeds performance benchmarks set by similarly sized models. These benchmark comparisons emphasize Gemma's overall robustness and versatility across a wide range of tasks, showcasing its state-of-the-art performance, especially in domains requiring advanced understanding and reasoning. ## Contributions and Innovations - Development of a new family of open models scalable for various applications. - Introduction of architectural and training enhancements for better performance and efficiency. - Emphasis on responsible deployment and safety of LLMs, aiming to set a standard for future model releases. ## Future Work: The authors suggest ongoing improvements in model safety, training efficiency, and application-specific tuning. They also highlight the need for continued research into the impact of instruction tuning regimes and model development methodologies. ## Applications Gemma models are suitable for various applications, including automated customer support, content generation, language translation, and more complex tasks like coding and scientific analysis, due to their enhanced understanding and reasoning capabilities. ## Relevant Links - XLA - Optimizing Compiler for TensorFlowXLA: TensorFlow - XLA: TensorFlow - GSPMD: General and Scalable Parallelization for ML Computation GraphsGSPMD: arXiv - GSPMD: arXiv - RoFormer: Enhanced Transformer with Rotary Position EmbeddingRoFormer: arXiv - RoFormer: arXiv - Preventing Verbatim Memorization in Language Models Gives a False Sense of PrivacyVerbatim Memorization: arXiv - Verbatim Memorization: arXiv - Palm 2 Technical ReportPalm 2: arXiv - Palm 2: arXiv - Program Synthesis with Large Language ModelsProgram Synthesis: arXiv - Program Synthesis: arXiv - PIQA: Reasoning about Physical Commonsense in Natural LanguagePIQA: arXiv - PIQA: arXiv - The LAMBADA dataset: Word prediction requiring a broad discourse contextLAMBADA: arXiv - LAMBADA: arXiv - Sequence to Sequence Learning with Neural NetworksSequence Learning: arXiv - Sequence Learning: arXiv - Attention is All You NeedAttention Mechanism: arXiv - Attention Mechanism: arXiv - BERT: Pre-training of Deep Bidirectional Transformers for Language UnderstandingBERT: arXiv - BERT: arXiv - Root Mean Square Layer NormalizationRMSNorm: arXiv - RMSNorm: arXiv - Ethical and Social Risks of Harm from Language ModelsEthical Risks: arXiv - Ethical Risks: arXiv - XLA: TensorFlow - GSPMD: arXiv - RoFormer: arXiv - Verbatim Memorization: arXiv - Palm 2: arXiv - Program Synthesis: arXiv - PIQA: arXiv - LAMBADA: arXiv - Sequence Learning: arXiv - Attention Mechanism: arXiv - BERT: arXiv - RMSNorm: arXiv - Ethical Risks: arXiv These links provide access to additional resources and further reading related to the concepts discussed in the paper. ## Next Models Phi-3-mini Models RoBERTa: A Robustly Optimized BERT Pretraining Approach Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/grouped-query-attention PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Grouped Query Attention Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Grouped Query Attention ### Title and Authors The paper is titled "GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints" and it is authored by Joshua Ainslie, James Lee-Thorp, Michiel de Jong, Yury Zemlyanskiy, Federico Lebrón, and Sumit Sanghai from Google Research. ### Abstract Summary The abstract introduces a novel method of uptraining existing language model checkpoints into models that utilize grouped-query attention (GQA), a modified version of multi-query attention (MQA). This method enables the models to maintain high quality while achieving faster decoder inference speeds using only 5% of the original pre-training compute. ### Key Concepts - Multi-query attention (MQA) - Grouped-query attention (GQA) - Uptraining from multi-head to multi-query models - Efficiency in decoder inference - Trade-off between speed and model quality - Implementation in transformer models, specifically T5. ### Problem Statement The paper addresses the challenge of optimizing transformer models for faster inference without significant loss in output quality. Specifically, it focuses on reducing the memory bandwidth overhead from loading decoder weights and attention keys/values, which is a bottleneck in autoregressive decoder inference. Methods and Techniques: - Multi-query Attention (MQA): Uses multiple query heads but a single key and value head, reducing memory bandwidth needs. - Grouped-query Attention (GQA): An intermediate between multi-head attention (MHA) and MQA, using a subgroup of query heads sharing a single key and value head. This approach balances speed and quality better than MQA. - Uptraining: A method to convert MHA models to MQA or GQA by first averaging the key and value projection matrices from all heads into a single matrix, followed by additional pre-training to adapt the model to its new structure. ### Key Results The uptrained models using MQA and GQA achieve close to the original quality of multi-head attention models but with significantly improved speed. For instance, the uptrained T5-XXL models show a reduction in inference time from 1.51 ms per sample to 0.28 ms when using GQA, with minimal loss in quality metrics like Rouge and BLEU scores across various datasets. ### Contributions and Innovations The main contributions include: - The introduction of grouped-query attention, which provides a novel way to reduce computational load and memory usage without extensive quality degradation. - Demonstrating a practical uptraining method that allows for the efficient transition from multi-head to multi-query models using existing checkpoints.These innovations could be highly beneficial for ML engineers looking to optimize large language models for faster inference with constrained computational resources. ### Future Work The authors suggest further exploration in several areas including: - The application of GQA to encoder layers of the model. - Detailed analysis and potential improvement of the trade-offs between model speed and quality. - Evaluation of GQA on decoder-only models, which have been gaining popularity. ### Applications Possible use cases highlighted include: - Faster and more efficient machine translation. - Efficient large-scale document summarization. - Enhanced performance in question-answering systems where inference speed is critical. ## Relevant Links - JAX: composable transformations of Python+NumPy programs - JAX - Flax: A neural network library and ecosystem for JAX - Flax - Memory-efficient attention implementation - Memory Efficient Attention - Profile your model with Cloud TPU tools - Cloud TPU Tools These links pertain to the tools and libraries used in the research, providing resources for implementations and further details on the technologies discussed in the paper. ## Next On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/ai-resources/rotary-position-embedding-rope PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: More Resources Rotary Position Embedding (RoPE) Popular + View more Categories Context Windows (#) Models (#) ML Systems (#) Updated: August 16, 2024 Read time: # mins # Rotary Position Embedding (RoPE) Title: RoFormer: Enhanced Transformer with Rotary Position EmbeddingThe authors are Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu, all affiliated with Zhuiyi Technology Co., Ltd. ## Abstract Summary: The paper investigates methods to integrate positional information into the learning process of transformer-based language models and introduces a novel method called Rotary Position Embedding (RoPE). RoPE encodes absolute position with a rotation matrix and incorporates explicit relative position dependencies in self-attention, offering flexibility in sequence length and improving dependency modeling with distance. ## Key Concepts: - Position encoding in transformers - Rotary Position Embedding (RoPE) - Self-attention mechanisms - Linear and relative position encoding - Long text classification benchmarks ## Problem Statement: The main problem addressed is enhancing transformer architectures to effectively incorporate both absolute and relative positional information, improving their performance across various NLP tasks. ## Methods and Techniques: The study proposes Rotary Position Embedding (RoPE), which uses a rotation matrix to encode absolute positions and explicitly integrates relative positions into the self-attention mechanism. This approach differs from traditional methods by providing flexibility in sequence length and a decaying inter-token dependency with increasing relative distances. ## Key Results: RoFormer, the transformer enhanced with RoPE, showed improved performance over baseline models on long text classification benchmarks. It demonstrated better handling of sequence lengths and dependency modeling, supported by both theoretical analysis and empirical results. ## Contributions and Innovations: The primary contributions are the introduction of RoPE for positional encoding in transformers, which enables better dependency modeling between tokens at different positions. RoPE's integration into transformers (RoFormer) shows enhanced performance on NLP tasks, outperforming traditional position encoding methods. ## Future Work: The authors suggest further exploration of RoPE's application in other transformer-based models and additional NLP tasks. They also indicate the potential for deeper theoretical analysis to understand the observed improvements in model performance. ## Application: To use Rotary Position Embedding (RoPE) for a language model, a developer can integrate RoPE into the self-attention mechanism of a transformer model. Here’s an example of how this might be implemented in a simplified form using Mojo. from memory import stack_allocationfrom tensor import Tensor, TensorShapeimport math# Define Rotary Position Embedding in Mojostruct RoPE:    var dim: Int    var inv_freq: TensorF32  # Inverse frequency for position encoding    fn __init__(inout self, dimension: Int) -> Self:        self.dim = dimension        var inv_freq_data = List[Float32]()        for i in range(0, dimension, 2):            inv_freq_data.append(10000.0 ** (-i / dimension))        self.inv_freq = TensorF32(TensorShape(len(inv_freq_data)), inv_freq_data)        return Self {dim: dimension, inv_freq: self.inv_freq}    # Apply RoPE to a TensorSlice (similar to one provided in the example)    fn apply_rope(self, tensor: TensorSlice) -> TensorSlice:        # Calculating sinusoid inputs        var seq_len = tensor.shape().dim(0)        var sinusoid_inp = TensorF32(TensorShape(seq_len, self.dim // 2))        for i in range(seq_len):            for j in range(self.dim // 2):                sinusoid_inp[i, j] = i * self.inv_freq[j]        # Compute sin and cos        var sin = sinusoid_inp.sin()        var cos = sinusoid_inp.cos()        # Apply rotation        var new_tensor_data = BufferPtrFloat32(tensor.data().size())        for i in range(seq_len):            for j in range(0, self.dim, 2):                new_tensor_data[i * self.dim + j] = tensor.data()[i * self.dim + j] * cos[i, j // 2] - tensor.data()[i * self.dim + j + 1] * sin[i, j // 2]                new_tensor_data[i * self.dim + j + 1] = tensor.data()[i * self.dim + j] * sin[i, j // 2] + tensor.data()[i * self.dim + j + 1] * cos[i, j // 2]        return TensorSlice(new_tensor_data, tensor.shape())# Usage Examplevar dim = 64var tensor_shape = TensorShape(100, dim)  # Example shape: 100 sequence length, 64 featuresvar random_data = BufferPtrFloat32.alloc(tensor_shape.num_elements())var example_tensor = TensorSlice(random_data, tensor_shape)var rope = RoPE(dim)var transformed_tensor = rope.apply_rope(example_tensor) ### Key Mojo Adaptations: - Tensor Management: Direct tensor manipulation using TensorF32 which is a float tensor in Mojo with explicit shape handling. - Sinusoidal Computation: The sinusoid is computed explicitly with loop indices corresponding to the sequence length and embedding dimension. - Rotation Application: The rotation based on sine and cosine values is manually applied to the tensor elements. TensorF32 The RoPE-enhanced self-attention mechanism can be integrated into any standard transformer architecture. This involves replacing the traditional positional encodings in models like BERT, GPT, or any other transformer variant with this new self-attention mechanism. ### Considerations - Parameter Tuning: Depending on the specific application, the developer might need to tune parameters like the dimension of embeddings or the heads in the attention mechanism. - Model Training: With RoPE, the model might learn positional dependencies differently. It's essential to monitor the training process to adjust learning rates or other hyperparameters. This example demonstrates how to implement RoPE within a transformer's self-attention mechanism, potentially leading to better handling of position encoding for long sequences or specific tasks where relative positioning is crucial. ## Relevant Links - Hugging Face Documentation for RoFormerLink: Hugging Face RoFormerContext: Documentation and model details on the Hugging Face website for RoFormer. - Link: Hugging Face RoFormer - Context: Documentation and model details on the Hugging Face website for RoFormer. - GitHub Repository for RoFormerLink: ZhuiyiTechnology RoFormerContext: GitHub repository containing the source code and implementation details for RoFormer. - Link: ZhuiyiTechnology RoFormer - Context: GitHub repository containing the source code and implementation details for RoFormer. - NeurIPS Paper on Transformer ArchitecturesLink: NeurIPS 2017 PaperContext: The foundational paper "Attention is All You Need" introducing transformer architectures, influential in the development of models like RoFormer. - Link: NeurIPS 2017 Paper - Context: The foundational paper "Attention is All You Need" introducing transformer architectures, influential in the development of models like RoFormer. - OpenReview - ELECTRALink: ELECTRA on OpenReviewContext: Discusses the ELECTRA model, which is related to the discussion on efficient transformer models like RoFormer. - Link: ELECTRA on OpenReview - Context: Discusses the ELECTRA model, which is related to the discussion on efficient transformer models like RoFormer. - ALBERT Model on OpenReviewLink: ALBERT on OpenReviewContext: Details about the ALBERT model which optimizes the training of transformers by reducing parameters. - Link: ALBERT on OpenReview - Context: Details about the ALBERT model which optimizes the training of transformers by reducing parameters. - ELECTRA PDF on OpenReviewLink: ELECTRA PDFContext: The PDF document of the ELECTRA paper discussing discriminators rather than generators for training language models. - Link: ELECTRA PDF - Context: The PDF document of the ELECTRA paper discussing discriminators rather than generators for training language models. - Findings of EMNLP 2020Link: ACL Anthology EMNLP 2020Context: The findings from EMNLP 2020, which includes research and developments related to transformer models and NLP. - Link: ACL Anthology EMNLP 2020 - Context: The findings from EMNLP 2020, which includes research and developments related to transformer models and NLP. - ICML 2020 on Continuous Dynamical ModelsLink: ICML 2020 Liu et al.Context: Discusses encoding position in transformers using continuous dynamical models. - Link: ICML 2020 Liu et al. - Context: Discusses encoding position in transformers using continuous dynamical models. - NeurIPS 2018 on Neural Ordinary Differential EquationsLink: Neural ODEsContext: A groundbreaking approach using ordinary differential equations for modeling continuous dynamics in deep learning, relevant to advancements in understanding transformer architectures. - Link: Neural ODEs - Context: A groundbreaking approach using ordinary differential equations for modeling continuous dynamics in deep learning, relevant to advancements in understanding transformer architectures. - Lucidrains' Performer-PyTorch GitHub RepositoryLink: Performer PyTorchContext: A repository for the Performer model, an efficient transformer variant that scales linearly with sequence length, implemented in PyTorch. - Link: Performer PyTorch - Context: A repository for the Performer model, an efficient transformer variant that scales linearly with sequence length, implemented in PyTorch. - Link: Hugging Face RoFormer - Context: Documentation and model details on the Hugging Face website for RoFormer. - Link: ZhuiyiTechnology RoFormer - Context: GitHub repository containing the source code and implementation details for RoFormer. - Link: NeurIPS 2017 Paper - Context: The foundational paper "Attention is All You Need" introducing transformer architectures, influential in the development of models like RoFormer. - Link: ELECTRA on OpenReview - Context: Discusses the ELECTRA model, which is related to the discussion on efficient transformer models like RoFormer. - Link: ALBERT on OpenReview - Context: Details about the ALBERT model which optimizes the training of transformers by reducing parameters. - Link: ELECTRA PDF - Context: The PDF document of the ELECTRA paper discussing discriminators rather than generators for training language models. - Link: ACL Anthology EMNLP 2020 - Context: The findings from EMNLP 2020, which includes research and developments related to transformer models and NLP. - Link: ICML 2020 Liu et al. - Context: Discusses encoding position in transformers using continuous dynamical models. - Link: Neural ODEs - Context: A groundbreaking approach using ordinary differential equations for modeling continuous dynamics in deep learning, relevant to advancements in understanding transformer architectures. - Link: Performer PyTorch - Context: A repository for the Performer model, an efficient transformer variant that scales linearly with sequence length, implemented in PyTorch. These links provide access to resources, repositories, and papers that expand on the theoretical and practical applications of advanced transformer models like RoFormer and their relative position encoding methods. ## Next Models Byte Pair Encoding (BPE) YaRN: Efficient Context Window Extension of Large Language Models Attention with Linear Biases Enables Input Length Extrapolation (ALiBi) LLM Context Evaluations On this page Download for your platform now - - - View License MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Context Windows ML Systems ML Systems Context Windows ML Systems Context Windows ML Systems Context Windows Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems ML Systems Models Models Models ML Systems ML Systems Models Models Models ML Systems ML Systems Context Windows ================================================================================ URL: https://www.modular.com/legal/champions PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Modular Community Champions Policy Last Updated: June 2nd, 2023This Community Champions Policy (this “Policy”) forms part of Modular’s Terms of Use and governs applicable User conduct for Users who are appointed “Champions” by Modular in Modular’s third party-online forums for Mojo, such as its Discord, Github Discussions or similar forums (each a “Forum”). Modular may designate Champions and revoke ‘Champion’ status of any User in its sole discretion, for any reason or no reason. Modular reserves the right to suspend and/or terminate Champion-User accounts for any violations of this Policy, violations of any terms governing use of the applicable Forum, or any other violations of Modular’s Terms of Use. ##### Facilitating a Stable and Respectful Community Champions are expected to uphold community rules, norms, and expectations in the applicable Forum that encourage positive engagement by community members. Champions shall both abide by the applicable Modular terms and Forum terms, and encourage community members of the applicable Forum to do the same. The content in each Forum that is subject to this Policy includes, but is not limited to: - Posts - Comments - Discussions ##### Setting Community Member Expectations Champions can ensure Forum members have predictable experiences on various rooms, communities, threads or other areas of a Forum by doing the following: - Providing a clear and concise description of the topic(s) discussed by your applicable community. - Properly labeling content and communities, particularly content that is graphic, sexually-explicit, or offensive. - Creating rules that explicitly outline your expectations for members of your community. - Explicitly marking your community as “unofficial” in the community description ##### Preventing Undesirable Conduct As a Champion, Users shall not interfere with or disrupt other, non-Mojo communities, nor shall they facilitate, encourage, coordinate, or enable members of the applicable Forum community to do the same.Champions shall never do the following, and shall monitor and moderate content in the applicable Forum community that attempts to do the following: - Mention other communities, and/or content or users in those communities, with the effect of inciting targeted harassment or abuse. - Enable or encourage members of a Forum to violate applicable terms. - Enable or encourage community members to post or repost content in other communities that is forbidden. ##### Engagement Champions shall regularly check in and moderate content on and otherwise engage with content on the applicable Forum in the designated communities. Champions shall ensure that issues are being addressed, and that Forum community members feel safe and attended to. ##### Enforcing Forum Guidelines Modular will strive to work with Champions directly to resolve issues happening in the applicable Forum without having to resort to restrictive measures. If Champions are unable to moderate community members appropriately because an applicable member is unresponsive or responds with hostility or is uncooperative, Modular may work directly with the applicable Forum providers to take corrective actions. ###### Miscellaneous Champions agree and acknowledge that any time spent acting as a Champion is unpaid and on a voluntary basis, and further understand that serving as a Champion in no way creates an employment relationship or other services relationship with Modular. Modular shall have no liability or responsibility to Champion for its conduct in any Forum or as a result of this Policy.  Other than as explicitly authorized in this Policy, Champions may not speak on behalf of Modular. Except for authorized Forum activity, Champions shall not make public statements about Modular or Mojo without disclaiming Champions lack of affiliation with Modular. ###### Privacy Misuse of Personal Information is prohibited. Any person or entity collecting data from the Platform must comply with the Modular Privacy Policy (https://www.modular.com/legal/privacy). If a User collects any Personal Information from the Platform, that User agrees it will only use that Personal Information for the purpose for which the respective User to whom the Personal Information pertains has authorized its use. User agrees that it will reasonably secure any Personal Information it has gathered from the Platform, and User will respond promptly to complaints, removal requests, and "do not contact" requests from us or other Users (to the extent applicable). ###### User Protection User must not engage in activity that significantly harms other Users. Modular will interpret policies and resolve disputes in favor of protecting Users as a whole. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/contact/us YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/how-mojo-gets-a-35-000x-speedup-over-python-part-1 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: August 18, 2023 # How Mojo🔥 gets a 35,000x speedup over Python – Part 1 Abdul Dakkak When we announced Mojo, we claimed that Mojo can be 35,000 times faster than Python and we demonstrated this using a specific compute-bound problem: generating a Mandelbrot set. This is an impressive number that has garnered some scrutiny (as it should). In this blog post series, we will show you how we arrived at this figure and the optimizations we implemented to achieve the performance. In this first part of the series, we'll start by motivating the Mandelbrot problem and why it’s a good candidate to measure performance. We will then describe some basic optimizations you can do in Mojo to get faster performance over Python code. Finally, we will compare our optimized implementation in Mojo against both pure-Python code and Python code using the NumPy library, and discuss why high-performance libraries like NumPy and other programming frameworks are not best suited to handle this problem. While these basic optimization techniques show that Mojo is much faster than Python, they alone won’t net you 35,000x speedup. As we continue through this blog series, we will introduce other Mojo features that you'll need to achieve the 35,000x speedup. ### What is the Mandelbrot set? The Mandelbrot set is the set of complex numbers $c$ for which the function $z_{n+1}={z_n}^2+c$  does not diverge when evaluated iteratively from $z=0$ at each point $c$ in the complex plane. In simpler terms, the algorithm repeatedly squares $z_n$ and adds it to $c$ to get the next iteration value  $z_{n+1}$. For some points this sequence will diverge and for some it will converge - this will determine whether the point belongs to the set or not. There are multiple ways to compute the Mandelbrot set. The simplest is the “escape time algorithm” which looks like the following in both Python and Mojo: MAX_ITERS = 1000 def mandelbrot_kernel(c): z = c nv = 0 for i in range(MAX_ITERS): if abs(z) > 2: break z = z*z + c nv += 1 return nv ‍ The algorithm iterates up to the “escape” condition (when the norm is greater than 2) or it “bailouts out” after MAX_ITERS iterations (set to 1000 throughout this blog post). The “escape time algorithm” is commonly used as a benchmark for demonstrating performance. If we plot which points are in the set and which ones are not, we get the following pictorial representation. ‍ There are other algorithms that take advantage of the periodicity, symmetry, and other features of the Mandelbrot set. For our benchmarking purposes, we are interested in the brute force approach to see how much we can push Mojo to best utilize the hardware. ### Why Mandelbrot? If you’re wondering why we should even care about the Mandelbrot set – the simple answer is that we do not. But from a compute perspective, the Mandelbrot set algorithm has a few interesting properties: - Simple to express: Mandelbrot is simple to understand and write. It acts as a proxy to many compute heavy iterative operations. - Pure compute: Mandelbrot has no memory overhead (i.e. you perform quite a bit of computation per output pixel). Furthermore, the amount of work to be done per output pixel is adjustable via the max iteration factor or the domain of the points.‍ - Irregular computation: adjacent pixels do not necessarily belong in or out of the set, and efficient computation requires early escape. Hence, the computation cannot be efficiently expressed in systems that only operate on regularly structured loop nests (e.g. array-based programming or polyhedral programming paradigms).‍ - Embarrassingly parallel: The Mandelbrot computation is easy to parallelize. This means that each pixel computation is independent of the adjacent one. ‍ - Vectorizable: The Mandelbrot computation can be written to utilize the vector operations available on modern CPUs. ### How to speed up the Mandelbrot algorithm At a high-level, the recipe to achieve maximal performance is to utilize the available hardware to its theoretical limits, so you are only bound by the “physics” of the hardware – but reaching those limits is easier said than done 🙂. The simpler answer to speed up your code is: just use Mojo. The code below is Mojo code. We welcome folks to try the Mojo Mandelbrot notebook that is in the Mojo Playground to experiment with this code. def mandelbrot_0(c: ComplexFloat64) -> Int: z = c nv = 0 for i in range(1, MAX_ITERS): if abs(z) > 2: break z = z*z + c nv += 1 return nv ‍ In fact, we just took the same Python code we shared earlier and added type annotations (see the introductory blog post on Mojo for Python users and the Mojo programming manual). Mojo uses these types to optimize the generated code. Note, that here we only annotated the function input types and everything else remains the same. A further optimization we can do is to opt into the Mojo “strict” mode. This will enable Mojo to perform more aggressive optimizations since the compiler can discern certain properties about the program. You opt into the strict mode by using fn instead of def and declaring the variables: fn mandelbrot_1(c: ComplexFloat64) -> Int: var z = c var nv = 0 for i in range(1, MAX_ITERS): if abs(z) > 2: break z = z*z + c nv += 1 return nv ### Simplifying the math to reduce computation Once we switch to Mojo, we can look at what further optimizations can be done. The first thing to try is to make the sequential implementation better by removing redundant computations. We can do two things here. One is to avoid the square root, by changing the check of abs(z) > 2 to be squared_norm(z) > 4. A square root typically takes around 6 flops (floating point operation). The other is by simplifying the computation of $z^2+c$ which would be naively computed as $x*y +c$ and expanded to: $$ (x_{re} y_{re}-x_{im} y_{im}+c_{re} , x_{re} y_{im}+x_{im} y_{re}+c_{im}) $$ Since $x=y$ in our example, we can simplify the equation to: $$ (x_{re} x_{re}-x_{im} x_{im}+c_{re} , 2x_{im}x_{re} + c_{im}) $$ This saves a further single flop. In total, we save around 7 FLOPS. This might not sound like much, but this operation is in the innermost loop and these FLOPS add up. Squared addition is a common operation, and the Mojo standard library provides a special function for it called squared_add, which is implemented using FMA instructions for maximum performance. struct Complex[type: DType]: ... fn squared_add(self, c: Self) -> Self: return Self( fma(self.re, self.re, fma(-self.im, self.im, c.re)), fma(self.re, 2*self.im, c.im))) ‍ We can rewrite our code to utilize this function as follows: fn mandelbrot_2(c: ComplexFloat64) -> Int: var z = c var nv = 0 for i in range(1, MAX_ITERS): if z.squared_norm() > 4: break z = z.squared_add(c) nv += 1 return nv ### Putting it all together Up until now, we have implemented 3 variants of the Mandelbrot kernel: mandelbrot_0, mandelbrot_1 and mandelbrot_2. This is the core compute operation, but we still need to iterate through the pixels in the image and compute the membership in the set. Again, this is straightforward in Mojo: alias height = 4096 alias width = 4096 alias min_x = -2.0 alias max_x = 0.47 alias min_y = -1.12 alias max_y = 1.12 alias scalex = (max_x - min_x) / width alias scaley = (max_y - min_y) / height for h in range(height): let cy = min_y + h * scale_y for w in range(width): let cx = min_x + w * scale_x output[h,w] = mandelbrot_N(ComplexFloat64(cx,cy)) ‍ With the above, you can replace mandelbrot_N with mandelbrot_0, mandelbrot_1 and mandelbrot_2 to evaluate the Mojo implementation against Python over the same domain, iteration count, and datatype (Python uses double-precision and so do we). We use an Intel Xeon Platinum 8481C CPU for all evaluations, and the results are shown below: ‍ There are a few things to note here. First, by just switching to Mojo we achieved a 46x speedup. Second, there is no difference in performance between mandelbrot_0 and  mandelbrot_1. The reason is that Mojo’s type inference and optimizations remove the dynamism from the types – allowing one to work with concrete types rather than variants. And by introducing squared_norm and squared_add we achieved a 89x speedup over Python ### What about NumPy? NumPy is a popular library in Python that brings an array programming language paradigm to Python. The idea of NumPy is that we can provide C implementations of common Python operations and by operating large arrays (instead of scalars) we can amortize the Python interpreter overhead. There are multiple ways to implement the Mandelbrot algorithm using NumPy. One option is to use numpy.vectorize, and the other way is operate on the entire region at once relying on Numpy itself to perform that operation efficiently. The code snippet below shows the second approach: zs = np.zeros((n, m), dtype=complex) mask = np.full((n, m), True, dtype=bool) for i in range(MAX_ITER): zs[mask] = zs[mask] * zs[mask] + cs[mask] mask[np.abs(Z) > 2] = False ‍ Pictorially, what’s happening above is that we are updating all the values in the Mandelbrot set in lockstep based on the mask each time and selectively updating the mask values. ‍ So instead of our vectorization approach where it is unlikely that we need 1000 iterations of work (which could happen at the boundary of the fractal), the NumPy implementation above is guaranteed to waste work. As you see above, it performs MAX_ITERS operations on every pixel in the image unconditionally. With NumPy you only has limited control on the algorithm and how it works and is implemented, and thus it cannot perform the optimizations we mentioned earlier. As a result, a NumPy implementation is only 5x faster than Python: ### Conclusion In this blog post, we motivated the Mandelbrot example. We also presented more detailed performance numbers comparing Mojo’s implementation of Mandelbrot vs existing solutions. We also described why existing solutions are not well-equipped to solve this problem. Clearly this is not the 35,000x speedup that we showcased in the launch. In the next blog post we will shed some light on the next set of Mojo features that enable the 35,000x speedup. We will also share some insights as to why Mojo is ideally positioned to solve this and other performance programming problems. Mandelbrot is a nice problem that demonstrates the capabilities of Mojo. We use similar methodologies to author all of our Library and Kernel functions that power our AI engine to enable speed and efficiency across our stack — without sacrifice to generality and good programming practices. If you are interested in making things fast or in general interested in building and driving state-of-the-art AI infrastructure from the ground up, then consider joining Modular’s exceptional team by checking out our careers page. And consider joining our awesome community on Discord and share your Mojo journey with us on social media. Until next time 🔥! ‍ ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Abdul Dakkak AI Compiler Engineer Expert in machine learning, compilers, programming languages, and accelerated computing. Before Modular, Abdul led the development of AI compilers for GPUs at Microsoft Research and the Mathematica Compiler at Wolfram Research. Abdul has developed open-source tools for accelerating real-world applications to optimize their performance across the hardware and software stack. ================================================================================ URL: https://www.modular.com/blog/how-mojo-gets-a-35-000x-speedup-over-python-part-2 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: August 28, 2023 # How Mojo🔥 gets a 35,000x speedup over Python – Part 2 Abdul Dakkak In the previous blog post, we motivated the Mandelbrot set problem and described basic optimization techniques to get around 90x speedup over Python. In this blog post (part 2 of our 3 part blog post series), we continue our optimization journey and describe how to go from 90x to 26,000x speedup over Python. We will share insights into the techniques we use and discuss why Mojo is well positioned to address them. In the upcoming and final part 3, we'll wrap this series up by showing you how you can get well over 35,000 speedup over Python. How do I run this example: Last week we announced that Mojo SDK will become available for local download to everyone in early September. Sign up to be notified if you haven't already! This example will become available in the Mojo examples repository on GitHub along with Mojo SDK availability. And don't forget to join us live on our first ever Modular Community Livestream where we'll share recent developments in Mojo programming language and answer your questions about Mojo. First, let’s recap what we've discussed so far. In the previous blog post, we showed the how to express the Mandelbrot set in Mojo: fn mandelbrot_blog_post_2(c: ComplexFloat64) -> Int: var z = c var nv = 0 for i in range(1, MAX_ITERS): if z.squared_norm() > 4: break z = z.squared_add(c) nv += 1 return nv ‍ We then used the following loop to check whether each point is within the set: alias height = 4096 alias width = 4096 alias min_x = -2.0 alias max_x = 0.47 alias min_y = -1.12 alias max_y = 1.12 alias scale_x = (max_x - min_x) / width alias scale_y = (max_y - min_y) / height for h in range(height): let cy = min_y + h * scale_y for w in range(width): let cx = min_x + w * scale_x output[h,w] = mandelbrot_blog_post_2(ComplexFloat64(cx,cy)) ‍ The above code produced a 90x speedup over Python and a 15x speedup over NumPy as shown in the figure below: ‍ In this blog post, we are going to continue on this journey and describe other optimizations that can get us closer to the 35,000x speedup we reported during launch. We will still use the 88-Core Intel Xeon Platinum 8481C CPU as we did in the first blog post in this series. ### Vectorizing the code Continuing with the sequential optimizations from the first blog post, the next thing we can do is to switch from using scalars to using vector operations. Vectorization, also known as Single Instruction Multiple Data (SIMD) has been around since the 1960s and allows one to operate on multiple data elements via a single instruction. Vector operations were added to commodity PCs in the mid 1990s (e.g. in 1997 in the Pentium P5 processor). But, despite being pervasive in hardware, many programming languages still don’t have first class support for it. For example, C++ doesn’t have standard support for SIMD (though there is an experimental proposal and many third-party libraries), and SIMD support in more modern languages is still experimental or subject to caveats. In Mojo, the SIMD type is a first-class type. To take advantage of SIMD to operate on multiple pixels at a time, we have to write our code slightly differently from the scalar code shared earlier. This is especially true because each pixel may escape at a different iteration count. The resulting code is still straightforward, though: fn mandelbrot_kernel(c: ComplexSIMD[DType.float64, simd_width]) -> \ SIMD[DType.index, simd_width]: var z = c var iters = SIMD[DType.index, simd_width](0) var in_set_mask = SIMD[DType.bool, simd_width](True) for i in range(MAX_ITERS): if not in_set_mask.reduce_or(): # (1) break in_set_mask = z.squared_norm() <= 4 # (2) iters = in_set_mask.select(iters + 1, iters) # (3) z = z.squared_add(c) # (4) return nv ‍ Code snippet above uses a vector mask to keep track of which pixels are still in the set and which pixels have escaped. Let’s dissect what each line in the loop means: - If none of the elements in the vector lane are in the set, then we exit the loop. - Compute the mask. i.e. if the SIMD width is 4, then a mask of [True, True, False, False] means that the first 2 elements in the 4 element patch did not diverge while the latter 2 did. - We increment the values of the pixels that did not escape by 1. - We update the z value unconditionally. We can compute the above for each pixel in the image by using our vectorize method: for h in range(height): let cy = min_y + h * scale_y @parameter # (1) fn compute_vector[simd_width:Int](w:Int): # (2) let cx = min_x + (w+iota[DType.float64, simd_width]()) * scale_x # (3) output.simd_store[simd_width](Index(h,w), mandelbrot_kernel( ComplexSIMD[DType.float64, simd_width](cx,cy)) # (4) vectorize[simd_width, compute_vector](width) ‍ We again explain each step in this process: - The compute_vector function is parameterized on a simd_width as a parameter and a runtime argument of the width of the image. - We compute the x positions in the complex plane using the iota method. The iota function gives the sequence [0, 1, 2, …, simd_width-1] and that enables us to construct a SIMD vector representation of the x positions in the complex plane. - We call our Mandelbrot kernel with the ComplexSIMD value. Note that Mojo supports overloading so there is no need to rename the function. - We use the vectorize high-order generator to apply compute_vector on all elements of width in a vectorized manner, while handling the edge cases. Pictorially what’s happening is that we are computing the Mandelbrot in simd_width chunks where each chunk is computed using vector operations. Note that while the image shows multiple rows are computed at the same time, this is purely for pictorial purposes since it would be hard to see. ‍ Recall that in the first blog post we only achieved 90x speedup over Python. The theoretical expectation from the vectorization is around 8x speedup (the system has a 512-bit vector register, therefore we have 512/64=8 double-precision elements per SIMD vector). We can plot the speedup against Python and the best results from the first blog post (marked as blog1): ‍ By vectorizing the implementation we are able to achieve a 527x speedup over Python and a 6x speedup over the first blog post results. That’s not an 8x speedup, however. One of the reasons why we do not get the 8x speedup is because our code performs a reduction across the vector lanes. The other reason is that escape condition is not the same across all elements in the vector, so there is extra work that’s done on the fractal boundary. ### Increasing work per loop iteration Still, that’s not good enough and much less than our 35,000x speedup goal. One thing to explore is the ratio of useful work (actually compute) to loop logic. The current ratio of the loop overhead to the amount of compute is not great if we have our SIMD width equal to the architectural SIMD width for tiny compute operations. Mojo allows us to operate on wider vectors and thus amortizing the overhead. Note that using the longer vector width is akin to, but not precisely the same as, loop unrolling. Modern x86 systems have multiple fused multiply-add (FMA) units which enables them to execute multiple FMAs every clock cycle. On the system we are using for benchmarking there are 2 FMA ports, so we can set the SIMD width to be a multiple of the hardware SIMD width. By using twice the hardware SIMD width, you increase the amount of work per loop iteration and create two FMA paths to increase utilization of the FMA pipelines and thus increasing instruction level parallelism (ILP). Of course, this is machine dependent, and we could have alternatively used Mojo’s autotuning feature here to find the right constant. alias num_ports = 4 # Is autotuned fn mandelbrot_kernel(c: ComplexSIMD[DType.float64, num_ports * simd_width]) -> \ SIMD[DType.index, num_ports * simd_width]: var z = c var iters = SIMD[DType.index, num_ports * simd_width](0) var in_set_mask = SIMD[DType.bool, num_ports * simd_width](True) for i in range(MAX_ITERS): if not in_set_mask.reduce_or(): break in_set_mask = z.squared_norm() <= 4 iters = in_set_mask.select(iters + 1, iters) z = z.squared_add(c) return iters ‍ In terms of performance, we can evaluate the speedup as we vary the num_ports and select the best one (i.e. autotune). If we plot the results, we can see that the value num_ports=4 is the ideal sweet spot (with a 1.6x speedup) and that as we increase the number of ports we degrade the performance since we increase contention. ‍ ‍ ### Parallelizing the code So far we have only looked at a single-threaded implementation (with vectorization), but modern hardware has multiple cores. A natural way to parallelize is to subdivide the complex plane into a sequence of rows, where each thread gets a sequence of rows to operate on. In Mojo, this can be implemented using the parallelize method: fn compute_row(chunk_idx:Int): let y = chunk_size * chunk_idx let cy = min_y + y * scale_y @parameter fn compute_vector[simd_width:Int](w:Int): let cx = min_x + iota[DType.float64, simd_width]() * scale_x output.simd_store[simd_width](Index(h,w), mandelbrot_kernel( ComplexSIMD[DType.float64, simd_width](cx,cy)) vectorize[num_ports * simd_width, compute_vector](width) with Runtime(num_cores()) as rt: parallelize[compute_row](rt, height) ‍ Pictorially, what’s happening is that we compute chunks of rows in parallel, with each thread assigned to a sequence of rows. ‍ ‍ In terms of speedup, we are able to get 26,194x speedup over the Python implementation by using all the 88 cores available on the system: ‍ However, there is a problem with the above approach. With 88 cores we should expect around an 88x speedup, but we were only getting a 30x speedup. In the next blog post we will describe what this problem is and how we can address it to achieve well over 35,000x speedup. ### Conclusion Let's summarize our optimization journey so far in these 2 blog posts: - In part 1 we started by just taking our Python code and running it in Mojo, we then type annotated the Mojo code, and performed some algebraic simplifications see a 90x speedup up over Python. - In this blog post, we started with the code from the first part and vectorized it. We then updated the code to utilize multiple FMA ports, and finally we changed the sequential implementation into a parallel one to take advantage of all the cores on the system to get over 26,000x speedup over Python. ‍ Below is the same chart in log scale, where it's easier to see the exponential speedup going from Python -> Mojo: ‍ As you can see above, our implementation achieves over 26,000x speedup over Python. In the next blog post, we are going to discuss the next set of optimizations to get over the 35,000x speedup. Stay tuned! Throughout these two blog posts, we showed how using Mojo programming language with the knowledge of the problem and hardware insights, enables us to get massive performance improvements. We employ the same methodology in our internal Modular Kernel development cycle. If you are interested in making algorithms fast or in general interested in building and driving state-of-the-art AI infrastructure from the ground up, then consider joining Modular’s exceptional team by checking out our Kernel engineer role or other roles available on our careers page. Don't forget to join us live on our first ever Modular Community Livestream where we'll share recent developments in Mojo programming language and answer your questions about Mojo. We will also be releasing Mojo SDK generally to everyone in early September. Sign up to download. Until next time 🔥! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Abdul Dakkak AI Compiler Engineer Expert in machine learning, compilers, programming languages, and accelerated computing. Before Modular, Abdul led the development of AI compilers for GPUs at Microsoft Research and the Mathematica Compiler at Wolfram Research. Abdul has developed open-source tools for accelerating real-world applications to optimize their performance across the hardware and software stack. ================================================================================ URL: https://www.modular.com/team YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/career-post?4234627005&gh_jid=4234627005 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: CAREERS / # - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/careers PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Join us in building the future of AI Watch Video ## We want to enable AI to be used by anyone, anywhere. Our ambitions are enormous, but working here will feel very familiar. You can change the world without giving up your life ## Why Modular? Grow with the best Build with some of the industry's best AI leaders. Maximize how you work We will always push the limits to create the best possible environment for our people and teams. Read how we work. Build AI for the world Build a next-generation developer platform, with production quality infrastructure, for the world. Have fun, live life Regular team onsites, local meetups & fun, strong team collaboration and more. ## Work and life, balanced. 🩺 Leading medical, dental & vision packages 💵 Strong compensation & equity packages 🍼 Generous maternity & paternity leave 📈 401K Plan 🌎 Work wherever you want 🏝️ Unlimited Vacation & PTO 🥳 Corporate perks & epic team fun ## Current Job Openings Come and be part of a world-class team that is rebuilding AI for everyone. We welcome applications from all backgrounds and communities. Engineering (0) Text Location ## What you expect from the interview Modular has a straight-forward interview process and a large majority of the roles follow the same steps: Step 01 ### Application Review The first step of the process is to submit your resume. We aim to review all resumes within 2 weeks and we respond to every single application made. Step 02 ### Call with Recruiting Typically you will first have a short 20-30min call with recruiting to just go over some basic information about you and the company, and to discuss next steps. Step 03 ### Call with Hiring Manager The Hiring Manager will dig a bit deeper into your background and previous experience to determine mutual fit. This will also be your opportunity to learn more about what the team is working on and what the role entails. In case you have applied for more than one role on different teams, we often schedule you for two separate calls with two separate Hiring Managers. Step 04 ### Team Interviews There are typically 4 team interviews, usually 45-60 minutes each. These may be scheduled all at once or separately, depending on the role. The focus areas for these team interviews vary by role. For example, for Engineering roles, you can expect coding and system design type interviews; for Product roles, we often talk about the industry and product strategy. For Leadership roles, we may ask for a presentation.We believe that team culture is a critical part of a great company, so every candidate also has a Culture interview that focuses on communication skills, team work, and so on.  We will let you know what to expect in each interview when we send you a schedule confirmation. Step 05 ### Founder Interviews We aim to put all finalists in touch with at least one of our co-founders before a final decision. This would allow you as a candidate to speak directly to Chris and/or Tim, and get answers to any final important questions you may have. Step 06 ### Offer If we make you an offer, we share an extensive offer deck for you and schedule a walk-through call to go over the information in detail and again answer any final questions you may have. We also aim to give you enough time to make a decision after that. ## Why should you be excited about Modular? “I picked modular because of the people and what they believe in and what they want to do. I want to be a part of something that makes a difference for the better.” Paige Bedwell Program Manager “The team is incredible. They're very smart. They're experts in their field, and we're solving the hardest computational problems in the world.” Abdul Dakkak AI Compiler Engineer “The best part of working here is a strong commitment to culture. I work on the most challenging problems, have the freedom to do it anywhere, and have a huge impact on AI.” Eric Johnson Product Lead ## Frequently asked questions Are interviews conducted in-person? Typically of our interviews are conducted over Zoom video. For coding interviews, we use Coderpad and you will receive a link from your interviewer. In some cases we may fly you in to meet some of our leaders for the last interview. What do you look for in a candidate? There is no “one size fits all” answer here however Modulers are passionate about their work, intellectually curious, humble, and ready to roll up their sleeves. We like to have discussions in interviews and expect you to ask clarifying questions and talk us through your thought process — sometimes there is no right or wrong answer, we just want to understand how you think and work through challenging problems. We also look for strong alignment with Modular’s Culture and values. I don’t meet all of the requirements for a role, can I still be considered? We would love to receive your application even if it doesn’t meet all criteria! We review applications with all roles and opportunities in mind. Sometimes we may reach out to you to offer or suggest another role or team that might be a better fit for you, or we offer to keep your application on file and reach out a few months down the line once more suitable opportunities open up. How long does the interview process take? On average it takes candidates about 4 weeks to go through the full interview process however if you require a decision by a certain date, please speak to your recruiter. Do you offer internships? We want to ensure that our interns have an outstanding experience, which includes a well-defined project and goals, meaningful and impactful work, and strong and attentive mentorship. As we are still a small team, we are not ready to offer internships at this time but we will be sure to update the website as soon as it changes! Do you provide visa assistance? Yes, we offer premium processing for our H1-B transfer candidates. We can also sponsor H1-B or offer other relevant visa application assistance to eligible candidates. Do you provide Green Card assistance? Yes, we also offer Green Card application assistance to eligible candidates, just speak to your recruiter for more details. Do you provide relocation assistance? As we are a remote-first company, we generally do not relocate candidates except new graduates who are moving away from campus. If Modular asks you to relocate, we will also provide you with a relocation stipend. Are there any opportunities for professional development? Modular is growing rapidly so there are a variety of growth opportunities available — whether that’s moving into a TL role, management, or a lateral transfer to a different team. We provide our managers with training to walk you through your career planning, and we have a well-defined but lightweight performance review process that ensures your career goals are discussed at a regular cadence. I applied some time ago but haven’t heard back? We aim to respond to every single candidate, and if you have applied to more than one role, we process all of your applications separately. Sometimes these emails end up in spam, so please check your spam folder. If you haven’t heard from us, you can contact your recruiter or [email protected] to follow up. Will you provide feedback if I am rejected? We sincerely appreciate the time it takes to interview, so we always provide some feedback as to why your application did not work out if we have spoken to you. If you have not heard from us within 2 weeks after your last call, please follow up with your recruiter. What benefits do you offer? Modular offers some world-class benefits for all employees. Our benefit package changes over time, and may depend on your specific location, but US-based employees can expect benefits that include: - A variety of fantastic health benefits (health, dental, vision insurance; life insurance etc) are available. - A 401k plan with up to 5% match. - Access to Passport Corporate Discount Program, LinkedIn Learning, and free tax advice on Carta. - Generous work-from-home stipend of $1500 to help you improve your home office. - Unlimited paid time off and flexible work hours. Who we are - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/abdul-dakkak YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Abdul+Dakkak PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?topic=Engineering PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/mikhail-zolotukhin YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Mikhail+Zolotukhin PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/?9cedfb3e_page=2 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: 80K+ developers building with MAX # A high-performance generative AI framework MAX replaces and simplifies your AI inference stack, maximizing performance and reducing cloud costs ## Achieve state of the art NVIDIA GPU performance Unlock state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## Optimize your existing PyTorch & ONNX models Migrate seamlessly without rewriting your AI models and pipelines on a unified AI stack. ## Use Mojo to supercharge your AI applications Extend your Python code with high-performance Mojo, a new programming language with the expressiveness of Python and the performance of C. ## Develop locally, deploy globally to any cloud. Develop your AI applications locally and package and deploy across any cloud provider, on CPUs and GPUs, without having to change your code. ## Run Gen AI locally under 3 minutes Download MAX first to run an LLM - Run Llama3-8B in your CLIGet started - Run Llama2-7B in your CLIGet started - Run Replit-3B in your CLIGet started Run Llama3-8B in your CLI Run Llama2-7B in your CLI Run Replit-3B in your CLI ## Free Forever The MAX framework is a free and open platform for you to develop and deploy AI inference workloads. A new framework for Gen AI, and the best way to deploy PyTorch Development tools for accelerated compute on GPUs and CPUs, built from the ground up for GenAI, but compatible with today. ## Developer Approved 👍 “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/team/chris-lattner YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/ehsan-m-kermani YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Ehsan+Kermani PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/mojo-pi-approximating-pi-with-mojo-using-monte-carlo-methods PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: March 14, 2024 # Mojo🔥 ❤️ Pi 🥧: Approximating Pi with Mojo🔥 using Monte Carlo methods Shashank Prasanna March 14th aka 3/14 or 3.14 is known as $\pi$ Day, and it honors the mathematical constant $\pi$ (pi), which represents the ratio of a circle's circumference to its diameter. On this special day, I wanted to dedicate a blog post to the beauty of mathematics, numerical methods, $\pi$, and Mojo. So join me on this journey as I implement a fast vectorized Monte Carlo approximation method of calculating $\pi$. Happy $\pi$ Day! ### Approximating Pi There are several methods for approximating $\pi$ including several Monte Carlo methods. Monte Carlo methods rely on repeated random sampling to obtain numerical results and rely on computation power to provide approximate solutions when solutions are hard to analyze mathematically. For this blog post, I chose one of the simplest Monte Carlo methods for approximating $\pi$. Consider a circle inscribed in a unit square, the ratio of the area of the square to area of the circle is ${\pi}/4$: $\frac{Area-of-circle}{Area-of-square} = \frac{\pi * (0.5)^2}{1*1} = \frac{\pi}{4}$ To approximate the areas we can repeatedly sample from an uniform random distribution x, y $\in$ [-0.5,0.5] and place these dots on the square. The ratio of dots inside the circle to the total number of dots will approximately equal π/4. To calculate $\pi$ you have to calculate: $4*\frac{dots-inside-circle}{dots-inside-square}$. As you increase the number of dots the approximation for Pi gets closer to the true value, and you can see this in the animation at the top. ### Approximating Pi in Mojo🔥 My goal with this blog post is to introduce you to some Mojo features as we implement this approach. The code for this blog post is available on GitHub. I’ll be building on the sample implementation of MojoArray I used in the Valentine’s day blog post. The core logic for pi calculation is as follows: - Randomly sample x and y coordinates from a uniform random distribution with upper and lower limits = [-0.5,0.5] - Calculate the magnitude of each dot using L2 norm - Get a list of dots whose magnitudes are less than equal to 0.5, which is the radius of the circle - Calculate $\pi$ with the formula $4*\frac{sum(inside-dots)}{N}$ The code for these steps are here: For the above code to work, we have to add few additional functionality to MojoArray we implemented in the Valentine’s day blog post: - Get boolean array from greater than and less than equal operations using __gt__() and __le__() and convert this into float array so we can perform arithmetic operations on it - Support sum reduction, implemented in sum() ### “Less than equal to” operations Here I have a vectorized implementation of less than equal operations using SIMD types, that calculates the boolean response and then maps it into the default float representation of MojoArray (Float64). We need the float representation as the output to do a reduction and get the total number of dots in the next step. Note: I could have also used an integer representation, which will save some memory, but I chose the easy way out by using the default dtype MojoArray was initialized with.  For __le__() the crux of the logic is in the following line: In this line of code, we are operating on vectors of SIMD width for Float64 to speed up computation. First we load the vector and then do a “less than or equal to” comparison to return a boolean vector which contains True if it’s less than equal to val or False if it’s not. Then we use the select function to map the boolean vector to a floating point vector 1.0 (iters+1) or a 0.0 (iters) and save it in the new bool_float_array. We wrap this code in a closure and call vectorize which will automatically apply the operation to the entire MojoArray. ### Calculating the sum reduction After we have the floating point representation of the boolean array, we have to reduce it to a scalar by adding all the 1s to count the number of dots inside the circle. We do this in a vectorized way in the following function: We allocate a sum vector of simd_width to save the intermediate sums, and in the vectorize_reduce function, we perform vectorized additions. Again, we wrap this code in a closure and call vectorize which will automatically apply the operation to the entire MojoArray. Finally we reduce the final vector s using the reduce_add() method. ### Calculating Pi Now we’re ready to taste some Pie 🥧😋, i mean Pi $\pi$. With our MojoArray data structure in place, we’re now ready to calculate Pi. - Define a large sample size with N - In a loop calculate Pi for different values of i from 0 to N in steps of 1000. For each i: - Create MojoArrays for x and y - Calculate radius r using L2 norm (aka euclidean distance, aka pythagoras theorem) - Get a list of inside dots that are <= 0.5 - Calculate pi - Plot results using Python module Matplotlib - Loop till you reach N The code for the main loop is here: And the resulting animation: ### Conclusion Hope you enjoyed reading this blog post on how to calculate Pi in Mojo using Monte Carlo method. What better way to celebrate Pi day than by delving into the implementing approximation of pi while geeking out on Mojo🔥. You can find all the full implementation on GitHub. While the implementation was elementary, my hope is that you can reuse some of the learnings in your own projects using Mojo. Download Mojo to run this example and share your feedback with us! Happy Pi Day! Here are some additional resources to get started. - Get started with downloading Mojo - Head over to the docs to read the programming manual and learn about APIs - Explore the examples on GitHub - Join our Discord community - Contribute to  discussions on the Mojo GitHub - Read and subscribe to Modverse Newsletter - Read Mojo blog posts, watch developer videos and past live streams - Report feedback, including issues on our GitHub tracker Until next time🔥! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Shashank Prasanna AI Developer Advocate Shashank is an engineer, educator and doodler. He writes and talks about machine learning, specialized machine learning hardware (AI Accelerators) and AI Infrastructure in the cloud. He previously worked at Meta, AWS, NVIDIA, MathWorks (MATLAB) and Oracle in developer relations and marketing, product management, and software development roles and hold an M.S. in electrical engineering. ================================================================================ URL: https://www.modular.com/newsletters PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Modverse Newsletter ## Latest Issues 🚨 NEW Modverse Weekly - Issue 41 August 16, 2024 🚨 NEW Modverse Weekly - Issue 40 August 1, 2024 ## Sign up for our newsletter, Modverse Get all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime. Thank you for your submission. Your report has been received and is being reviewed by the Sales team. A member from our team will reach out to you shortly. Thank you, Modular Sales Team # All Modverse Issues (X) 🚨 NEW ### Modverse Weekly - Issue 41 The Mojo Community Meeting has been renamed to the MAX + Mojo Community Meeting. We explained how we combined Mojo and MAX, and updated the license for both to ensure you can be confident building free (and open source) technologies, as well as using Mojo and MAX for your own commercial projects. August 16, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 40 Last week we began alpha testing our new magic CLI for installing Mojo and MAX through the Conda ecosystem. It allows you to pin Mojo/MAX to different versions, and add Python dependencies so you can reliably share your Mojo and MAX projects. If you want to try it out before release, you can find the doc for installing it here. August 1, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 39 Check out the new section for nightly updates. If you're not keeping track on the #nightly Discord channel, you can catch up on everything new for the last week in this newsletter. July 9, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 38 The 24.4 release introduced GGUF support and quantisation for models such as Llama3 and many new features for Mojo. With that behind us Modular is now working hard towards the next release. To try out the new features press the Nightly tab on the MAX installation guide. There's an active community in the #nightly Discord channel to discuss the upcoming features with, and Modular staff are there to answer questions and respond to your feedback! June 28, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 37 We hosted the third Mojo Community Meeting this week, with great demonstrations from the community on constraints and the Mojo HTTP serving library lightbug. We also previewed our upcoming AI pipeline serving feature with llama3, using a GUI to interact with it. And ended by answering community questions on async, and when Python will be able to call Mojo. June 20, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 36 This week we released Mojo🔥 and MAX⚡️ 24.4, there is too much in the release to cover here! Check out the launch blog, the Mojo changelog, and the MAX changelog. June 7, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 35 This week we held the first ever Mojo community meeting! Many topics were discussed, including priorities, diving into specific features like async, and topics set on the agenda by the wider Mojo community. Next week we'll be hearing from community members about the awesome projects they've been working on. Make sure to add the next community meeting to your calendar. May 23, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 34 This week we launched MAX⚡️ nightlies with preview support for macOS and MAX Serving! You can now find details about how to install it on modul.ar/get-started, press the Nightly button on the install guide if you want to be on the bleeding edge. We look forward to your feedback, join the Discord and leave comments on the #nightly channel. May 17, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 33 This week we hosted a livestream with many good questions from the community. People were most interested in macOS support for MAX, and GPU support. These are both top priority at Modular so stay tuned! The standard library team were happy to announce that we've had 250 OSS contributions since open sourcing, we continue to be impressed and motivated by our active community! May 10, 2024 / Jack Clayton , 🚨 NEW ### Modverse Weekly - Issue 32 Yesterday marked Mojo🔥's first birthday 🎂, launching last year on May 2, 2023. We launched with just an online Jupyter environment and have since released the SDK locally for macOS and Linux on arm64 and x86, and bought up our inference and serving stack MAX⚡️. Yesterday we released Mojo and MAX 24.3 to mark the occasion, along with the first community contributions, 32 of which made it into the official changelog. We're so excited to go on this journey out in the open with our amazing community, thank you to everyone who has been participating! May 3, 2024 / Jack Clayton , - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/shashank-prasanna YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Shashank+Prasanna PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/jack-clayton YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/walter-erquinigo YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Jack+Clayton PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Walter+Erquinigo PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/chris-hoge YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Chris+Hoge PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/max-graph-api-tutorial - Home - MAX - Mojo - Modular CLI - Bring your own fine-tuned model to MAX pipelines - Deploy a model with Kubernetes and Helm - Deploy a model with Amazon SageMaker and AWS CloudFormation - Get started with MAX Graph - Create a custom op for an ONNX model - Run an ONNX model with Python - MAX - Tutorials - Get started with MAX Graph # Get started with MAX Graph Updated: Aug 14, 2024 MAX Engine is a next-generation compiler and runtime library for running AI inference. With support for PyTorch (TorchScript), ONNX, and native Mojo models, it delivers low-latency, high-throughput inference on a wide range of hardware to accelerate your entire AI workload. As highlighted in the recent MAX version 24.3 release, the MAX platform enables users to fully leverage the capabilities of the MAX Engine by creating bespoke inference models using the MAX Graph APIs. The Graph API offers a low-level programming interface for constructing high-performance symbolic computation graphs in Mojo. This interface provides a uniform representation of symbolic values and a suite of operators that process these symbols to construct the entire graph. In this tutorial, we guide you step-by-step how to use the MAX Graph API. In a nutshell, working with MAX Graph API involves three main steps: - Building and verifying the graph. - Creating an inference session and compiling the graph. - Executing the graph with input(s) and retrieving the output(s). We begin by creating two straightforward graphs for addition and matrix multiplication in Mojo, demonstrating how to compile and execute these graphs. Then we proceed to implement a two-layer feedforward neural network with ReLU activation for inference on MNIST data, comparing the accuracy to a PyTorch implementation. Additionally, we implement ReLU6 as a custom operator and use the MAX Graph Custom Operator API to substitute ReLU and ensuring the accuracy aligns with the PyTorch model. The code for this tutorial is on GitHub. The MAX version for this tutorial is the nightly (tested version max 2024.7.1505 (ba28802f)) for now. If you experience any issues in this tutorial, please let us know on GitHub. ## Set up MAX​ If you don't have MAX yet, follow the MAX install guide. If you're new to the Mojo language, you can learn the basics in the Introduction to Mojo. If you have any questions along the way, ask them on our Discord channel or in the GitHub discussions on the Mojo repo and MAX repo. Should you encounter any issues, we recommend checking the roadmap and known issues first. ## Build a "Hello, world!" graph​ To begin familiarizing ourselves with the Graph API, we start by constructing a simple addition graph. We will verify and compile this graph, and then proceed to execute it. Below is a straightforward graph that takes two inputs; input0 and input1. It adds these inputs together and produces output0 as the output. ### 1. Build the graph​ To construct the addition graph, we start by importing the necessary modules. We then instantiate the Graph by specifying two input types of fixed static dimension 1 (we will later see other types of supported dimensions such as symbolic dimension). Next, we create a symbolic representation of the addition with the expression out = graph[0] + graph[1]. Here graph[0] refers to the first input input0 and graph[1] to input1. This operation adds two inputs together. Finally, we designate out as the output of the graph by calling graph.output(out). ```mojo from max.graph import Graph, TensorType, Typegraph = Graph(in_types=List[Type](TensorType(DType.float32, 1), TensorType(DType.float32, 1)))out = graph[0] + graph[1]graph.output(out)print(graph) ``` We can print the graph to visually confirm its structure. The output should show the following representation where rmo and mo are Modular’s internal intermediate representations ```mojo %0 = rmo.add(%arg0, %arg1) : !mo.tensor<[1], f32>, !mo.tensor<[1], f32> ``` This line corresponds to the symbolic addition operation out = graph[0] + graph[1]. The subsequent line ```mojo mo.output %0 : !mo.tensor<[1], f32> ``` indicates that %0 has been set as the output of the graph, aligning with the graph.output(out) in our code. The complete graph representation looks like this: ```mojo graph: module { mo.graph @graph(%arg0: !mo.tensor<[1], f32>, %arg1: !mo.tensor<[1], f32>) -> !mo.tensor<[1], f32> no_inline { %0 = rmo.add(%arg0, %arg1) : !mo.tensor<[1], f32>, !mo.tensor<[1], f32> mo.output %0 : !mo.tensor<[1], f32> }} ``` To programmatically verify the complete graph construction, we use the graph.verify() method. This checks for various structural integrity criteria such as ensuring there are no cycles within the graph (acyclicity) which would indicate recursion or feedback loops that can not be part of the dataflow graph. For more details, check out the official documentation on the verify method. ### 2. Create inference session, load and compile the graph​ With our graph now verified and ready, the next step involves creating an inference session instance, loading the graph into this session and compiling the graph into a model instance. We also print the input names to use when executing the model. ```mojo from max import enginesession = engine.InferenceSession()model = session.load(graph)print("input names are:")for input_name in model.get_model_input_names(): # Mojo lesson: `[]` dereferences in Mojo as `input_name` is of `Reference` type print(input_name[]) ``` which outputs ```mojo input names are:input0input1 ``` Verifying input names input0 and input1 is crucial for correctly executing the model in the subsequent section. ### 3. Execute the graph/model with inputs​ To execute the graph, we first create two input tensors in Mojo, specifying their names and values in the execute method. The result from the execution are returned as TensorMap, from which we can retrieve the value of output0 via the get method as follows ```mojo from tensor import Tensorprint("set some input values:")input0 = Tensor[DType.float32](List[Float32](1.0))print("input0:", input0)input1 = Tensor[DType.float32](List[Float32](1.0))print("input1:", input1)print("obtain the result using `get`:")# Mojo lesson: here the `^` in `input0^` passes the ownership and ends the lifetime of `input0`ret = model.execute("input0", input0^, "input1", input1^)print("result:", ret.get[DType.float32]("output0")) ``` The outputs are printed as follows ```mojo set some input values:input0: Tensor([[1.0]], dtype=float32, shape=1)input1: Tensor([[1.0]], dtype=float32, shape=1)obtain the result using `get`:result: Tensor([[2.0]], dtype=float32, shape=1) ``` Now, let’s explore our second example. ## Build a matmul graph​ In this example, we create a graph specifically for performing matrix multiplication (matmul) by a constant symbol which we will use further along in the next section. This type of graph is particularly important as it demonstrates how constant symbols, representing trained and fixed weights in a neural network, can be utilized. This concept will be expanded upon in subsequent sections. The setup for this matmul graph follows the same foundational steps as our initial example but includes some critical additions: - We introduce a symbolic dimension m to represent m x 2 - The use graph.constant to create  a constant symbol, crucial for maintaining static values Here's how we compile and execute the graph to accommodate varying input tensor sizes at runtime: ```mojo from max.graph import Graph, TensorTypefrom max.tensor import Tensor, TensorShapefrom random import seedfrom max.engine import InferenceSessiongraph = Graph(TensorType(DType.float32, "m", 2))# create a constant tensor value to later create a graph constant symbolconstant_value = Tensor[DType.float32](TensorShape(2, 2), 42.0)print("constant value:", constant_value)# create a constant symbolconstant_symbol = graph.constant(constant_value)# create a matmul nodemm = graph[0] @ constant_symbolgraph.output(mm)# verifygraph.verify()# create session, load and compile the graphsession = InferenceSession()model = session.load(graph)# generate random inputseed(42)input0 = Tensor[DType.float32].randn((2, 2))print("random 2x2 input0:", input0)ret = model.execute("input0", input0^)print("matmul 2x2 result:", ret.get[DType.float32]("output0"))# with 3 x 2 matrix inputinput0 = Tensor[DType.float32].randn((3, 2))print("random 3x2 input0:", input0)ret = model.execute("input0", input0^)print("matmul 3x2 result:", ret.get[DType.float32]("output0")) ``` Here are the results of matmul graph using a constant symbol of 2 x 2 tensor and a random input tensors of shapes 2 x 2 or 3 x 2 for demonstration ```mojo constant value: Tensor([[42.0, 42.0],[42.0, 42.0]], dtype=float32, shape=2x2)random 2x2 input0: Tensor([[-1.7141127586364746, 0.057178866118192673],[0.75628399848937988, -1.6024507284164429]], dtype=float32, shape=2x2)matmul 2x2 result: Tensor([[-69.591224670410156, -69.591224670410156],[-35.53900146484375, -35.53900146484375]], dtype=float32, shape=2x2)random 3x2 input0: Tensor([[1.0167152881622314, -0.10449378937482834],[-0.27936717867851257, -0.69003057479858398],[0.80745488405227661, -0.48231619596481323]], dtype=float32, shape=3x2)matmul 3x2 result: Tensor([[38.313301086425781, 38.313301086425781],[-40.714706420898438, -40.714706420898438],[13.655824661254883, 13.655824661254883]], dtype=float32, shape=3x2) ``` With this foundation, we are ready to explore more advanced applications in the next section of the tutorial. ## Build an MNIST classifier graph​ In this section, we demonstrate how to build a two-layer neural network with ReLU activation using PyTorch, train it on the famous MNIST data featuring black and white 28 x 28 pixel images of handwritten digits (0 to 9 i.e. total of 10 classes) and then test its accuracy. Subsequently, we will implement the same model using the MAX Graph API for inference to ensure the accuracy remains consistent. ### 1. Build and train the model in PyTorch​ First, to set up, let’s define our neural network in PyTorch: ```mojo import torch.nn as nnclass Model(nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.relu = nn.ReLU() self.fc2 = nn.Linear(hidden_size, num_classes) def forward(self, x): x = self.fc1(x) x = self.relu(x) x = self.fc2(x) return x ``` We can train and test the network as follows (python mnist.py) ```mojo loss_fn = nn.CrossEntropyLoss()optimizer = optim.RMSprop(model.parameters(), lr=learning_rate)total_steps = len(train_loader)for epoch in range(num_epochs): for i, (images, labels) in enumerate(train_loader): images = images.reshape(-1, 28 * 28) outputs = model(images) loss = loss_fn(outputs, labels) optimizer.zero_grad() loss.backward() optimizer.step() if (i+1) % 100 == 0: print (f'Epoch [{epoch+1}/{num_epochs}], Step [{i+1}/{total_steps}], Loss: {loss.item():.4f}')# testmodel.eval()with torch.no_grad(): correct = 0 total = 0 for images, labels in test_loader: images = images.reshape(-1, 28 * 28) outputs = model(images) probs = F.softmax(outputs, dim=1) predicted = torch.argmax(probs, 1) total += labels.size(0) correct += (predicted == labels).sum().item() print(f"Accuracy of the network on the 10000 test images: {100 * correct / total} %")# save weights in numpy binary formatweights = {}for name, param in model.named_parameters(): weights[name] = param.detach().cpu().numpy()np.save(f"model_weights.npy", weights) ``` After training and testing the network, we found the model achieves an accuracy of 97.31% on the test dataset. ```mojo Epoch [1/5], Step [100/469], Loss: 0.5384Epoch [1/5], Step [200/469], Loss: 0.2288Epoch [1/5], Step [300/469], Loss: 0.3225Epoch [1/5], Step [400/469], Loss: 0.2614Epoch [2/5], Step [100/469], Loss: 0.1049Epoch [2/5], Step [200/469], Loss: 0.2166Epoch [2/5], Step [300/469], Loss: 0.2362Epoch [2/5], Step [400/469], Loss: 0.1472Epoch [3/5], Step [100/469], Loss: 0.1200Epoch [3/5], Step [200/469], Loss: 0.1284Epoch [3/5], Step [300/469], Loss: 0.0726Epoch [3/5], Step [400/469], Loss: 0.1111Epoch [4/5], Step [100/469], Loss: 0.0702Epoch [4/5], Step [200/469], Loss: 0.0650Epoch [4/5], Step [300/469], Loss: 0.1297Epoch [4/5], Step [400/469], Loss: 0.1334Epoch [5/5], Step [100/469], Loss: 0.0265Epoch [5/5], Step [200/469], Loss: 0.0301Epoch [5/5], Step [300/469], Loss: 0.1179Epoch [5/5], Step [400/469], Loss: 0.0424Accuracy of the network on the 10000 test images: 97.31 % ``` Next, we implement the PyTorch model in MAX Graph API for inference. ### 2. Build the inference graph with MAX Graph​ After training our model and saving its weights, we need to construct an inference graph and load the weights as constant symbols. Our graph will handle input dimensions with a symbolic "batch" dimension and static 28x28 spatial dimensions, representing flattened and preprocessed images. We will also include a softmax operation via ops.softmax to compute probabilities directly within the inference graph. ```mojo from max.graph import Graph, TensorType, opsfrom max import enginedef build_mnist_graph( fc1w: Tensor[DType.float32], fc1b: Tensor[DType.float32], fc2w: Tensor[DType.float32], fc2b: Tensor[DType.float32], ) -> Graph: # Note: "batch" is a symbolic dim which is known ahead of time vs dynamic dim graph = Graph(TensorType(DType.float32, "batch", 28 * 28)) # PyTorch linear is defined as: x W^T + b so we need to transpose the weights fc1 = (graph[0] @ ops.transpose(graph.constant(fc1w), 1, 0)) + graph.constant(fc1b) relu = ops.relu(fc1) fc2 = (relu @ ops.transpose(graph.constant(fc2w), 1, 0)) + graph.constant(fc2b) out = ops.softmax(fc2) # adding explicit softmax for inference prob graph.output(out) graph.verify() return graph ``` With the inference graph defined, we can now execute it with test images. ### 3. Run inference and check accuracy​ To execute the graph, we first convert the model weights from numpy format to Mojo tensor format, then create the graph, compile it, and run inference. Finally, to check the accuracy, we iterate on test images, preprocess them, obtain the result and calls argmax to find the predicted value between the 10 classes and count how many of them correctly match the ground truth label. ```mojo weights_dict = load_model_weights()fc1w = numpy_to_tensor[DType.float32](weights_dict["fc1.weight"])fc1b = numpy_to_tensor[DType.float32](weights_dict["fc1.bias"])fc2w = numpy_to_tensor[DType.float32](weights_dict["fc2.weight"])fc2b = numpy_to_tensor[DType.float32](weights_dict["fc2.bias"])mnist_graph = build_mnist_graph(fc1w^, fc1b^, fc2w^, fc2b^)session = engine.InferenceSession()model = session.load(mnist_graph)correct = 0total = 0# use batch size of 1 in this exampletest_dataset = load_mnist_test_data()for i in range(len(test_dataset)): item = test_dataset[i] image = item[0] label = item[1] preprocessed_image = preprocess(image) output = model.execute("input0", preprocessed_image) probs = output.get[DType.float32]("output0") predicted = probs.argmax(axis=1) label_ = Tensor[DType.index](TensorShape(1), int(label)) correct += int(predicted == label_) total += 1print("Accuracy of the network on the 10000 test images:", 100 * correct / total, "%") ``` The output of mojo mnist.mojo is ```mojo Accuracy of the network on the 10000 test images: 97.310000000000002 % ``` This matches the accuracy we observed from the PyTorch test, confirming that our MAX Graph API implementation performs equivalently. ## Create a custom operator with MAX Graph​ In this final section of our tutorial, we demonstrate how to create and register a custom operator to use inside a MAX graph. Following our previous two layer neural network, we first train our model with ReLU6 activation via python mnist.py —-use-relu6 which replaces ReLU with ReLU6, checks the test accuracy and saves the model weights that were done before. ### 1. Implement the custom op​ To create a custom operator in Mojo, we should follow these steps - Create a dedicated sub-repository and name it custom_ops - Create a __init__.mojo with the import content from .relu6 import relu6 Create a custom op Mojo file, relu6.mojo with the following code ```mojo from max.extensibility import Tensor, empty_tensorfrom max import [email protected]("relu6")fn relu6[type: DType, rank: Int](x: Tensor[type, rank]) -> Tensor[type, rank]: var output = empty_tensor[type](x.shape) @always_inline @parameter fn _relu6[width: Int](i: StaticIntTuple[rank]) -> SIMD[type, width]: var val = x.simd_load[width](i) return val.max(0).min(6) output.for_each[_relu6]() return output^ ``` Above code uses @register.op(“relu6”) decorator to register the wrapped relu6 function with name ”relu6”, as a custom operator. The wrapped function can only take max.extensibility tensors and must have only one output of the same type and can not raise an Error. We create an empty_tensor to store the output. To obtain the output, we create a function wrapped in @parameter to be applied on each element of the input tensor via for_each. Such function (_relu6) loads SIMD values of each rank and applies the ReLU6 formula val.max(0).min(6). Finally, we move the output via output^ to correctly transfer ownership of the result tensor. ### 2. Add the custom op to the graph​ Once we have the custom operator defined, we need to package it as .mojopkg via mojo package custom_ops. In our graph definition, we are now ready to replace the ops.relu with our custom one ```mojo relu = ops.relu(fc1) ``` with ```mojo relu = ops.custom["relu6"](fc1, fc1.type()) ``` Here we use the ops.custom that takes the custom operator name ”relu6” as parameter and the fc1 as input and the output type fc1.type(). The rest of the code stays the same. ```mojo def build_mnist_graph( fc1w: Tensor[DType.float32], fc1b: Tensor[DType.float32], fc2w: Tensor[DType.float32], fc2b: Tensor[DType.float32], use_relu6: Bool ) -> Graph: # Note: "batch" is a symbolic dim which is known ahead of time vs dynamic dim graph = Graph(TensorType(DType.float32, "batch", 28 * 28)) # PyTorch linear is defined as: x W^T + b so we need to transpose the weights fc1 = (graph[0] @ ops.transpose(graph.constant(fc1w), 1, 0)) + graph.constant(fc1b) # custom op relu = ops.custom["relu6"](fc1, fc1.type()) fc2 = (relu @ ops.transpose(graph.constant(fc2w), 1, 0)) + graph.constant(fc2b) out = ops.softmax(fc2) # adding explicit softmax for inference prob graph.output(out) graph.verify() return graph ``` The last change is to let the inference session know about the custom operator at runtime via ```mojo model = session.load(mnist_graph, custom_ops_paths=Path("custom_ops.mojopkg")) ``` ### 3. Verify the results​ As the final check, we train and test the model that uses ReLU6 via python mnist.py —-use-relu6 which outputs ```mojo Accuracy of the network on the 10000 test images: 95.91 % ``` Then we run the inference code via mojo mnist.mojo —-use-relu6 which shows ```mojo Accuracy of the network on the 10000 test images: 95.909999999999997 % ``` The matching accuracy between the PyTorch version and the Mojo implementation confirms the effective integration of the custom operator. ### 4. Deploy as a binary​ For deployment, we can build the mnist binary via mojo build mnist.mojo. We can execute the binary as follows ```mojo ./mnist# or ``` ```mojo ./mnist --use-relu6 ``` ## Next steps​ In this tutorial, we demonstrated how to use MAX Graph API step-by-step, to create a symbolic graph, compile and execute such graphs. We also showed how to replicate a two layer neural network trained in PyTorch, in MAX Graph API and saw that the test accuracy remained intact. We concluded by showing how to create and register a custom operator to use for inference. To verify correctness, we showed the test accuracy also remained intact when using such a custom operator. We hope that by the end of this tutorial, you have gained a better understanding of the inner workings of MAX Graph APIs. Here are a few potential steps for you: - Explore other neural network architectures beyond a simple two-layer feed-forward network and implement them using MAX Graph API - Experiment with other custom operator - Test and assess correctness and contribute to the community 🚀 Report feedback, including issues on our Mojo and MAX GitHub tracker. - Set up MAX - Build a "Hello, world!" graph1. Build the graph2. Create inference session, load and compile the graph3. Execute the graph/model with inputs - 1. Build the graph - 2. Create inference session, load and compile the graph - 3. Execute the graph/model with inputs - Build a matmul graph - Build an MNIST classifier graph1. Build and train the model in PyTorch2. Build the inference graph with MAX Graph3. Run inference and check accuracy - 1. Build and train the model in PyTorch - 2. Build the inference graph with MAX Graph - 3. Run inference and check accuracy - Create a custom operator with MAX Graph1. Implement the custom op2. Add the custom op to the graph3. Verify the results4. Deploy as a binary - 1. Implement the custom op - 2. Add the custom op to the graph - 3. Verify the results - 4. Deploy as a binary - Next steps - 1. Build the graph - 2. Create inference session, load and compile the graph - 3. Execute the graph/model with inputs - 1. Build and train the model in PyTorch - 2. Build the inference graph with MAX Graph - 3. Run inference and check accuracy - 1. Implement the custom op - 2. Add the custom op to the graph - 3. Verify the results - 4. Deploy as a binary - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://www.modular.com/contact/sales YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/leveraging-max-engines-dynamic-shape-capabilities PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: March 28, 2024 # Leveraging MAX Engine's Dynamic Shape Capabilities Mikhail Zolotukhin Ehsan M. Kermani In this blog post, we will dive deep into the dynamic shapes support in MAX Engine’s 24.2 release. We will do so by first defining what dynamic shapes mean in machine learning, discussing their various types and use cases. We will then see how to use dynamic shapes in MAX Engine. Finally, for demonstration purposes, we will compare the average latency of the dynamic shapes to the static shapes for the BERT model on the GLUE dataset. ## What are dynamic shapes? In machine learning, dynamic shapes refer to the ability of models to handle inputs of various sizes automatically. This capability is essential for managing real-world data, which often varies in size and dimension. This includes processing input text of unknown length - a common situation in applications such as chatbots - or dealing with batches of inputs whose sizes are not known in advance (dynamic batching). ## What are the types of dynamism in AI models? In AI models, dynamic shapes can manifest in several ways depending on the degree of “dynamism” involved: - At the most basic level, tensor shapes can be entirely static, meaning their rank (the number of dimensions), data type, and dimensions are all specified in advance. - Next, tensors might have a known rank, data type and sizes across some dimensions, but not all. For example, if a model processes images, the input tensor might be a 4-d tensor in an NCHW layout (Batch size, Channels, Height, Width). In this case dimension N can be dynamic to allow for varying batch sizes, H and W can be dynamic too if we expect the model to work on images of arbitrary sizes. However, C is often static - assuming all input images are expected to have the same number of channels (e.g. R, G, B for color images). - Moving towards greater dynamism, tensors might have a known rank and data type, but unknown shapes across all dimensions. Continuing our previous example, consider a model that works with both colored and black-and-white images, making the C dimension (channels) also variable. - If we increase the dynamism degree even more, we get rank-dynamic tensors - i.e. tensors, for which we don’t know their rank, but still know their data type. - Finally, in the most dynamic scenario, we might lack any information about the tensors and don’t even know their data type. As the level of dynamism increases, it becomes more and more difficult to optimize performance of the model. This is why most existing frameworks nowadays focus on handling the first three cases (1-3), where at least some tensor properties are known. Let’s examine that in more detail. ## What type of dynamism does MAX Engine support in 24.2 release? As we explained various types of dynamism above, in the 24.2 release, MAX Engine supports dynamism across any dimension, but the rank and data type of the tensors need to be known. When MAX is used for running TensorFlow or ONNX models, this information is extracted directly from the model, and when we use a TorchScript model we require the user to provide such information explicitly since the model itself doesn’t contain it. Similarly, MAX Graph API also allows specifying which dimensions are dynamic in the model. ## MAX Engine dynamic shapes support for PyTorch models In this section, we will explain how to use MAX Engine for applications that require dynamic shapes. For the sake of simplicity, we will use the BERT model, but exactly the same technique is applicable to all other models including state-of-the-art Large Language Models. Here, our model will process an input text, trying to guess a masked word in it. Because we don’t know in advance how many words (or tokens, to be more precise) will be in the input, our model needs to be able to handle inputs of unknown shapes. For PyTorch models, MAX Engine requires a TorchScript format of the model. Here is how to convert the BERT model to TorchScript by tracing a dummy input: Next, we create an inference session for the MAX Engine and load our TorchScript model into it, providing the input information along with the model. Note that instead of passing concrete sizes of the tensors below, we will pass None for each dimension that needs to be treated as dynamic: None Side note: Please refer to the relevant documentations if you are working with MAX using C API or Mojo API and learn how dynamic dimensions need to be specified. The maxmodel is now ready for inference. As an example, we tokenize the input "Paris is the [MASK] of France.", then use maxmodel.execute to get the output and post-process the output to find the predicted_token as follows: which outputs: ## Latency comparison of dynamic vs static shapes For demonstration purposes, we compare here the average latency between dynamic shapes and static shapes for the BERT model on the GLUE dataset. With dynamic shapes our model processes only the input data and nothing else, which can be beneficial for datasets where the majority of samples’ lengths are short. With static shapes, however, the inputs are padded to their maximum length which is 512 in the BERT example, which results in unnecessary computations and wasted resources. ## Conclusion Throughout this post, we have explored the concept of dynamic shapes and the types of dynamism in AI models. The incorporation of dynamic shapes allows models to handle a wide array of input sizes, which is a common requirement in real-world scenarios ranging from text processing to image analysis. We have showcased MAX Engine’s dynamic shape support for the BERT model and then how to run inference for a sample input. At last, we have compared the average latency of the dynamic shapes to the static shapes for the BERT model on the GLUE dataset showing that on average dynamic shapes have lower latency compared to the static shapes. This is due to having shorter tensor lengths on average compared to longer tensor lengths for the static shapes case. Additional resources: - Get started with downloading MAX - Download and run MAX examples on GitHub - Head over to the MAX docs to learn more about MAX Engine APIs and Mojo programming manual - Join our Discord community - Contribute to discussions on the Mojo and MAX GitHub Report feedback, including issues on our Mojo and MAX GitHub tracker. Until next time!🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Mikhail Zolotukhin AI Compiler Engineer Expert in traditional and ML compilers with over 15 years of experience in the field. Before Modular, Michael contributed to Intel Compiler, GCC, LLVM, and most recently PyTorch. He is passionate about building right things the right way and excited to do that at Modular to help power AI for the world. Ehsan M. Kermani AI DevRel Ehsan is a Seasoned Machine Learning Engineer with a decade of experience and a rich background in Mathematics and Computer Science. His expertise lies in the development of cutting-edge Machine Learning and Deep Learning systems ranging from Natural Language Processing, Computer Vision, Generative AI and LLMs, Time Series Forecasting and Anomaly Detection while ensuring proper MLOps practices are in-place. Beyond his technical skills, he is very passionate about demystifying complex concepts by creating high-quality and engaging content. His goal is to empower and inspire the developer community through clear, accessible communication and innovative problem-solving. Ehsan lives in Vancouver, Canada. ================================================================================ URL: https://www.modular.com/team/joe-pamer YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/meet-joe-pamer-mojo-engineering-lead PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 15, 2024 # What Does Joe Pamer, AI and PL expert, Want From Mojo? Joe Pamer Chris Lattner Joe Pamer recently joined Modular to lead the Mojo engineering team. Joe is a veteran of Meta, Apple, and Microsoft and has led large scale infrastructure projects but can never seem to escape programming languages. We thought it would be fun to dive into Joe’s background and perspective and how he sees the opportunity ahead of Mojo and MAX and the industry at large. Mojo is a new programming language that is a member of the Python family.  It is as easy to use as Python, but is distinguished by its high performance and ability to scale into GPU programming and other specialized domains like AI. Chris Lattner: You’ve made major contributions to a wide variety of different programming languages (PL) including F#, TypeScript, Swift, Hack, Python (etc!) that cross-cut static and dynamic languages. What have you learned across these journeys and what makes you excited about Mojo? Joe Pamer: While I keep bouncing between opposite ends of the design spectrum, I've honestly never been particularly adamant about any of the “great debates”: static vs. dynamic, functional vs. imperative, etc. Life’s too short! To me, an ideal programming language allows you to adapt your style and approach to the situation, and what attracted me to all of the ones I’ve worked on is that they’ve strived to balance opposing design constraints. I like meeting the programmer where they’re at, and giving them new tools while you’re doing so. Maybe that’s the most important lesson I’ve learned: the best designs are rarely found at one end of the spectrum or the other. For example: what’s better, static or dynamic? It depends! Static languages are great when you know exactly what you need to do, and want to do it in the most efficient, rigorous way possible - writing to the metal. Advanced typing features also help manage complexity as codebases scale. But sometimes you just need to experiment, sketch out a solution, orchestrate, or just hack. You don’t need to frame your approach up-front; you want to explore and are willing to accept the necessary tradeoffs. When that’s the case, when you’re figuring things out as you go, dynamic languages really shine. What’s funny is that when you start with one you often begin to crave the other. Python is ubiquitous for the feature engineering and modeling parts of a pipeline, because it is great for experimentation and iteration.  But then you get into production and performance always becomes an issue, so you have to switch to C++ or Rust.  For serving or inference parts of a pipeline, C++ does make sense because you need extreme scale... but then your requirements change and its lack of flexibility means that you need to rewrite or throw everything away at some point. Trying to find a balanced solution to the ML pipeline problem is what attracted me to Mojo: you can have it both ways, without compromises. It's like having the power of C++ and the expressiveness of Python elegantly fused together in a way that feels instinctive and powerful. CL: You’ve scaled AI projects at Meta and are an expert in these systems. What are the biggest challenges you’ve faced in the past, and how do you think MAX will be able to help? The challenge of “big AI” is that you’re facing all the challenges of modern software development at scale while moving at tremendous pace and under tremendous market pressure. We’re all surfing past the edge of the wave and coping best as we can, facing the same problems over and over again. First, you’re up against the laws of physics. Everything is evolving so rapidly out from under you that your infrastructure is perpetually and fundamentally stressed. Compute resources, network capacity, energy capacity - you’re constantly bouncing against the very limits of what’s possible with existing technology, pushing the envelope. Engineering for efficiency is key, but it’s so hard to manage across all of these different systems and the tradeoffs are tricky - it’s all zero sum. Next, modern ML pipelines are massive heterogeneous systems, all running different software stacks on different hardware. C++ and Python weren’t designed for this, and we have a crazy set of libraries and frameworks (PyTorch/Tensor-RT/CUBLAS/etc) - that try to paper over the problems. So you’re left to constantly battle this complexity, and every link in the chain is a potential point of failure. Even worse is that these are all opaque boxes, so when one of them breaks, you're stuck looking for a workaround instead of being able to fix things yourself. Finally, modern AI is a multidisciplinary endeavor: you need ML engineers, software engineers, data scientists, and mathematicians to be able to work together, but they work very differently and often have contradictory needs. Traditional languages create a tooling gap for your team because they are literally speaking different languages, and cannot collaborate on a shared codebase that spans research to production. This complexity makes it more difficult to get AI into your products, and results in a slower innovation cycle. I don’t think these problems - efficiency, heterogeneity, and productivity - can be solved separately. The tools we currently use were designed for the last generation of problems, and their lack of cohesion is preventing us from moving forward. That’s what drew me to Mojo/MAX. It’s tightly integrated, performant, and maximizes optionality at the upper and lower levels of the stack. It also allows whole classes of disparate developers to work their way, but using the same tools. It lets you get on with your life, and focus on building great AI products, not managing infrastructure. CL: Where do you want to see Mojo in two years, how about ten years? Mojo is at an exciting point in its development - it’s come so far in the past year, and is evolving rapidly.  The community is exploding in size, and we’re seeing people build new things every day. We want Mojo to live up to its potential, so we building out the core technology, rounding out even better tooling (including package management, a long-standing pain point for Python developers), and building Mojo into a scalable open ecosystem. While it is very important to us that Mojo be a good member of the Python family, Mojo is capable of scaling into many more use-cases, and we intend to continue growing the Mojo ecosystem on its own terms - just as C++ grew into a superset of C. This last goal connects to my ten-year vision in that I don’t see Mojo as “just” a language for AI - I think it can be great for many applications. Over the next decade I hope we will see Mojo expand into many domains beyond AI, with an identity all its own. It’s already a joy to use and I only see us getting better and more compelling to a wider audience of developers over time. One thing I know for certain: for either our short or long-term goals to happen, we need to foster a large and empowered community, and this is only possible through open source. Mojo has a lot of really innovative technology under the hood that we’re looking forward to sharing with the world.  We recently open sourced the standard library, and our first Mojo Community Meeting is next week! CL: As a “city person” you’ve experienced both the SF and the NY scenes, why choose New York? SF is a wonderful city and a great place to work, but NYC is “home” to me and has always been close to my heart, so I’m unabashedly biased about this one 🙂. I’d say the tech sector in NYC is pretty vibrant right right now, but it certainly wasn’t always this way. I love that NYC has a diverse set of professions, instead of being a tech-centric monoculture like SF or even Seattle. This lack of a professional monoculture here really changes the way people in this field relate to their work. Combined with the typical NYC hustle, the tech scene here feels “richer,” more vibrant and more energetic in a way that’s unique to the city. One thing I'm very thankful for is that Modular is a remote-first company, which allows me to work from the city that I love. We already had an awesome group of engineers here (and up and down the east coast) when I joined, so it's never felt lonely either. I'm excited to keep growing out our presence here, and to contribute back to the local scene. CL: What do you think about emojis in programming languages? Naturally, I 🤔 they're 👍️ if ➡️👤 🙏 to 🛟 🛰️ ➕ ⌨️ ⏩⏱️… ❗️ 🔮, too... LOL. CL: Awesome, it is such an exciting time Joe. Thank you for driving Mojo to the next level! Before we jump, I just wanted to mention that we’re investing even more in Mojo compiler, language, tooling, and building out the next generation of Mojo libraries.  We recently posted a bunch of new roles, so if you’re interested in building the future for AI infrastructure and software, please check it out! -Joe Pamer - Learn more about the culture and values at Modular. - We’re hiring! Head over to our careers page to see open roles, and join us in building the future of AI! - Get started with the MAX platform. - Head over to the MAX docs to learn more about MAX Engine APIs and Mojo programming manual ‍ - Join our Discord community! Until next time! 🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Company - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Joe Pamer Mojo Distinguished Engineering Lead Joe spent the last 8 years at Meta, where he was focused on improving the company’s AI and developer infrastructure stacks. Before that he served as Instagram’s CTO, overseeing much of Meta’s work on programming languages (mainly focused on Python, PHP, and Javascript), and co-founded its first applied ML team for infrastructure. Before joining Facebook, he helped design and develop the F#, TypeScript, and Swift programming languages, and contributed to many other developer technologies, such as Clang, Visual Studio, and VS Code. Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] ================================================================================ URL: https://www.modular.com/blog/developer-voices-deep-dive-with-chris-lattner-on-mojo PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 8, 2024 # Developer Voices: Deep Dive with Chris Lattner on Mojo Chris Lattner Last week, Chris Lattner sat down for an interview on the Developer Voices podcast with Kris Jenkins. It was a wide-ranging episode that explored a variety of topics, including the motivations behind creating Mojo, what it offers to both Python and non-Python programmers alike, how it is built for performance, and which performance features actually matter. This post recaps a number of highlights from the podcast, edited for clarity and brevity. You can find the full 90 minute interview on YouTube. ### Why are you building a new language? Summarized from 3:29 into the video We started with how do we make GPUs go brrrr? How do we make these crazy high performance CPUs that have matrix operations, bfloat16 and other AI extensions. How do we rationalize this wide array of different hardware and put it into a system that we can program in? For hardware it used to be that a CPU would come out every year and it would be slightly better than the old one. But now we have these really weird dedicated hardware blocks which are very specialized. The most extreme is a GPU, being able to program these things requires fundamentally different kinds of software. We weren't originally intending to build a language at Modular. We started building a very fancy code generator that had no frontend. We wrote everything using a new compiler framework named MLIR. It's now part of the LLVM family, but it's a next generation replacement in many ways. It allows making domain specific compilers really fast, and so we were writing everything in pure IR. We did that for quite some months to just prove out that the code generation philosophy in the stack could work and deliver the results we wanted. When we had confidence in that, we said "Now what do we do about syntax?" In the case of Mojo we don't build an AST traditionally, we generate MLIR directly from the parser. When we decided it was working with a novel and useful code generational approach, we had to decide how are we going to get this IR. The obvious thing to reach for is a domain specific language embedded in some other language. For example Python, with a decorator based approach, generates IR by walking some other languages AST. The other approach is to go build a language. We decided let's do the hard thing, and we think the cost benefit trade off is worth it. ### Why build Mojo as a superset of Python? Summarized from 11:49 into the video What I realized is that I want to control some of the risk, but also meet developers where they are. For AI in particular, Python is "the thing", everybody uses Python. If you pick anything else, you'd have to justify why it's better than Python. I care about the hundreds of millions of developers who already know Python, not having to retrain them is a huge feature. From an engineering and a design perspective, it's very useful because we already know what the language looks like. So we don't have to bike shed, which is way easier than rationalizing everything using first principles. Mojo is a very extended version of Python, there's still design work, but at least we could focus our energy, as most of those early decisions are made for us. In the case of Swift, we progressively migrated the Objective C community. We did that by making it so both worlds could live together. You can call one from the other happily, for example use an Objective C package, but write your UI in Swift. In the case of Mojo we're building it into a full superset of Python. And so all the Python idioms, whether they're a good idea or not will work in Mojo. Even today you can import arbitrary Python packages, mixing and matching them directly. We're continuing to make progress on more dynamic features in particular. Mojo will soon be a really good replacement for CUDA, we're close to being a really good replacement for languages like Rust, and eventually we'll be a good superset of what Python is loved for. But we have to do those steps incrementally and build out the features as we go. Objective C and Python have the dark truth that all the important stuff is written in C or C++. If you look at NumPy as just one example, it has a very nice Python API, but it's all written in C, C++. The consequence of using Mojo that you don't have to switch out your Python knowledge. Programmers are busy people, they have things going on. Most people are not going to be learning a new thing for the fun of it. On the other hand you can meet people where they are, and provide something familiar so they don't have to retrain from scratch. Programmers I've seen generally love growing, and learning new tricks. That's why people are excited about what's going on with Mojo. ### How does Mojo's type system work? Summarized from 20:02 into the video If you ask the typical programmer, they would tell you Python doesn't have types. If you talk to a more advanced developer, they'd say it has dynamic types. And so there is a list, dict, string, but it's all runtime. If you go further you can say Python has one type, which is a reference to a Python object. In Mojo we said let's give this thing a name, which became PythonObject. Now you can create a Mojo type Int with conversions between PythonObject to have them integrate and interoperate. Now it can be on the stack instead of boxed and heap allocated, it can be the size of the word on your machine or whatever properties you need. And so you can have the ability to opt into a fully static world. CPU and GPU high performance numeric programmers never want anything dynamic. They want full control over the machine, and access to very fiddly low level optimizations. But we also allow you to start removing types, so you can get fully dynamic behavior if you'd like. There's a whole class of languages, including TypeScript and even Python itself, where it's saying the fundamental nature of the universe is untyped. But you can provide type hints than can be used to inform error messages. Typing in Mojo is actually typed, this is very important. We've built a modern statically typed, generic, higher order functional type system – like many modern languages. It's pretty familiar to people and I think familiarity is good. The other side of it though, is that we are very hardcore about pushing language features into the library. I'll pick on C++ here because it's an easier victim but it's a very powerful language. For example float and double are built into the language, so there's certain behavior and conversions that only work with builtins, which can't be exposed out to the library. Another example is you can't overload the dot operator in C++, you can't build a smart reference. That's been driving people nuts for decades now. In Mojo we take a very aggressive approach to this, which is to push everything that we can into libraries, and push the magic out of the compiler. For example Int is not built into the language, the float types are not built in the language, these are all just libraries and so the type system composes and we use it for all the builtin types. That forces the language to provide only the core essentials for expressing libraries. We want everything to be ergonomic and very dynamic and flexible and powerful for the Python folks. Most people will build on top of higher level libraries. And so we have the MAX engine, which you to just run a graph if you don't want to know how any of that stuff works. here's a graph, go to town. Mojo allows you to add some types to go 100x or 1000x faster, without even doing fancy accelerator stuff. This is a material speedup for not having to retrain all your engineers. And so that's cool, even if you don't use the full power of what Mojo can do. You might not want to write GPU level code, you might just want your code to be fast. But when you want to go for performance, you can do that without someone telling you that you picked the wrong language. ### How do you deliver high performance and portable code? Summarized from 26:34 into the video Mojo believes in zero cost abstractions which are seen in C and Rust and many languages. The way we do it is pretty innovative because we have this fancy MLR compiler behind the scenes. This allows us to build up zero cost abstractions for various hardware. Swift in a way was syntactic sugar for LLVM, at the very bottom of the stack it could talk directly to LLVM primitives. Mojo does basically that same trick, but it supercharges it by moving to this MLIR world. And so MLIR being a much more modern compiler stack has way more powerful features. We can expose things like bfloat16, and really weird numerics on accelerators like tiled matmuls, and the tensor core on a GPU, and then wrap them in really nice libraries. So you get direct low level access to crazy exotic hardware. But then you have syntactic sugar, built-in libraries, and now you can extend the language without having to be a compiler nerd. I think this is very important and powerful. So for example complex numbers are hardware accelerated on certain chips. If you do a multiply accumulate, it's four multiplies and a couple of adds, certain CPUs have operations that can do that in one shot. We have a compile time metaprogramming system that can say if you're on supported hardware go do the optimize, else just do the generic thing. Mojo has superpowers because of the domain it's in. So you can write one piece of source code and that runs partially on your CPU, partially on your GPU. And these may have different pointer sizes and may have different numerics and capabilities. there are these very nerdy compiler things that enable this to just work in a way that people aren't quite used to. Mojo was designed in 2022 instead of 1985, we have things like SIMD which are core to the language, as all computers have SIMD instructions these days. We also have direct support for explicit vectorization, so you get full access to the hardware. It's been really fun seeing Mojo developers worldwide take something like game of life, and they say I'll start using this, I'll try this. Oh wow, it's a thousand times faster than the code I started with. With library based extensibility, our vectorized function is just a library function. And you can vectorize this code by using a combinator from the library, and build it one step at a time. I've seen tons of people go through this growth path where they say wow, this is really cool, I'm having fun, I'm building something interesting, I'm learning something. This is where I think people love going through the growth path. ### How does Mojo work with GPUs and AI? Summarized from 32:07 into the video In the AI space I'm in love with AI for both the user applications, but also all the systems and all the technology that were built to support it. One of the things I found super inspiring is that today you can sign up for a Jupyter notebook on Google Cloud, and get access to a TPU. And with a few lines of code, you can now be programming on an exaflop supercomputer. You're describing a novel computation that gets mapped, partitioned, scaled out across thousands of chips, at massive data center speed. High Performance Compute (HPC) people have been doing for a long time. but now you have AI researchers doing this, without having to write low level high performance code. What made that possible was a shift from completely imperative programming to declarative programming. And the way this works is that in AI, you build a machine learning graph and you have the AI researcher thinking about the level of ops like matrix multiplication, convolution, gather, or reduction etc. So they think about simple compositions of these highly parallel operators. And then you give this graph to a very fancy compiler stack, and it's actually doing fusion on the loop. You're taking this very complicated math, doing very high tech compiler transformations, and then also dealing with distribution across clusters. You can do these things because it's a declarative specification, you're not trying to take a pile of C code and parallelize it. What this whole stack evolves into in the case of Mojo is we have, what's called the MAX engine. The MAX engine is a very fancy AI compiler stack. It's like a XLA, but after learning a lot of lessons being familiar with these technologies, it can run machine learning graphs. But we also want it to be able to talk to the imperative code. You need to be able to write custom operators, invent new algorithms. Like if Modular doesn't know what an FFT is, but you do and that's really important to your signal processing domain. We want the stack to be completely extensible. And so Mojo enables people to write an algorithm in very simple and familiar code. You can understand it because you're just writing source code. In contrast, CUDA is its own little world and it's very different to Python. So instead of writing a CUDA kernel, you can write some Mojo code and because of MLIR, it can reflect onto it and we can see what the code is doing. That allows us to take it and do things like fancy compiler fusions, and do the placement. That's something the world doesn't have because in the AI space, the state of the art technologies are built around CUDA and math libraries like Intel, MKL where the operators are all black boxes. There are these fancy graph compiler things, but they don't actually have the ability to see into the logic that they're orchestrating, and so they can't do these high level transformations. It just is very janky in various ways. Part of our mission is to solve this, take all these systems a major step forward. What drives Mojo is the extreme high performance needs of AI. We want to be state of the art on performance without relying on vendor libraries that do matrix multiplications, for example. It is also why we care about usability, many people are building graphs with Python and PyTorch. And so we want to meet people where they are, it all flows together. ### How are you solving the AI divide between research and production? Summarized from 37:19 into the video The traditional TensorFlow and PyTorch libraries were designed 8 or 10 years ago, depending on how you count. They're coming from a research world and training world, but today a huge amount of focus has shifted to deployment. When you get into deployment mode you don't really want Python in production. It can be done, but there's some challenges with that. We've entered into this world with researchers who love, live, and breathe Python, and it's great for their use-case. But then you have production people that have to rewrite these models and tokenization logic for LLMs in C or Rust to be able to ship something. A big part of Mojo is about solving that problem, having one language that can scale which can heal the divide between all the personas that are building these systems. Whether they're high performance numerics people, deployment engineers, AI researchers, we can get everybody to be able to talk to each other, because they're literally speaking different languages which is massively impacting AI getting into production. It's an evolution of a lot of very well considered systems that were locally developed, aggregated and then hill climbed like crazy, because AI has changed a lot in the last five to eight years. Nobody's had a chance to go back and first principles some of the technology, all this stuff grew really quickly. Some people might say that building a programming language is insane, but It's just a multi-year project. You have to be very practical about this and you have to make sure to not sign up for something you can't deliver on. It's a big bet that lots of other people aren't willing to make for a wide variety of reasons. And so you have to be right, but if you're right, then it's actually a really good contribution to the world. An analogy I've seen is that it's like writing C or Rust code but with Python syntax. This is disarming to people because people are taught that Python is slow and to never write a for loop. In Mojo that wisdom is invalid, because it's not the same implementation. Many things that people knew to be false are actually totally fine. We have folks that from HPC backgrounds, experts in low level system architecture, saying it's so weird to be writing assembly code in Python. It does twist your brain, open your eyes and shift your perspective, but otherwise it's familiar. It isn't driven by novelty for novelty sake. It's about pragmatism. ### How does metaprogramming work, and how does it compare to Zig? Summarized from 42:38 into the video In the AI world source code is effectively a metaprogram. It's a bunch of imperative logic, that describes roughly a graph, you then distribute and transform it. Python has long been used for metaprogramming for a wide variety of different domains, that's one of the reasons it's been very successful in the AI community. If you look at high performance numerics, people often use C++ and templates for metaprogramming, because you want an algorithm that works on float, double, or float32/float64. And of course, then it turns in this massive cataclysm of templates depending on how advanced you get. More modern languages like Zig for example, have said let's not have a different meta language than the language. They use the same language for both normal programming and metaprogramming. In case of Mojo we said that's actually a really fantastic idea. Python is highly dynamic, you can overload operators, you can do all these things dynamically, we can't pay the expense, we can't have even a single clock cycle extra in our domain. We need bare metal performance, but we want the benefit of the abstractions and the extensibility that Python provides. So we fused comptime metaprogramming and the dynamic metaprogramming of Python. This is one of the major ingredients that allows Mojo to be extremely expressive with the same idea as Zig, you can build the standard runtime algorithms, you can allocate heap data structures, you can do all this stuff at compile time. This gives you a composition that enables really expressive libraries. It allows you to build combinators, higher level functions, and features, composing the benefit of the compiler world with the runtime world. You have values, objects, functions, features, classes, types, and you can use them either at compile time or run time. A simple example is a function that creates a lookup table. You can call it at runtime and pass dynamic values in as the arguments, doing all kinds of math on them. But you can also run it at compile time, calculate the dynamic data structure, do all the logic that would have run at runtime. The output of that is a list, that list is then burnt into the executable, and now you don't have to compute it at runtime. That's a simple example, there are many fancier examples. Types are just values, and so your types can be compile time values. So you can do much more fancy, higher level programming. There's a whole rabbit hole there, the cool thing about is that it comes back to enabling library developers to make demand specific abstractions and build things that allow modelling their world very clearly. Zig has its own personality, it's a very low level language. It's very different in certain ways to Mojo. Mojo wants to enable libraries and abstractions and so that's its focus. But this idea of using the language at comptime is shared, we're very happy to learn from other people. ### How does memory management work, and how does it compare to Rust? Summarized from 48:25 into the video One of the ways that we can embrace the entire Python ecosystems, is interoping with the CPython object model. Everything is just compatible, if you import Python you get the traditional reference counted indirect object box. In Mojo native code you get a very powerful type system. At the bottom you have types with move constructors, copy constructors, and destructors. So you can write code that manages resources and do so directly. One of the bottom foundational things is that you can call into C. And so if you want to you can call malloc and free through unsafe hooks. But again, we want people to be able to compose together Libraries and we want to do so in a safe way. What we have is references with lifetimes that work very similarly to the way they work in Rust, there are many implementation differences, but you can think of it that way. In Mojo, it's way less in your face, and you don't have to micromanage the borrow checker quite as much, but it provides you the same approach and the ability to manage references. This is a really powerful thing, and it's a very important thing, we've learned a lot from Rust. They paved a lot of roads with really great work, but there's certain challenges with the borrow checker. One example of that is the Rust parser has a bunch of pretty complicated rules, and special cases for how it generates the IR. Then you have the borrow checker which comes along and tells you if you did it wrong, the simple cases are easy to understand. But in the complicated cases, you're dealing with the order of evaluation of how the parser did things which causes all kinds of edge cases. The Mojo equivalent is actually a very different thing. Our parser rules are very simple and predictable, we push a lot of complexity out of the language and into the library. Our borrow checker isn't just an enforcer, it decides what the lifetime of a value is. And so a very big difference between Mojo is that in Rust, values are destroyed at the end of a scope. You can run into issues where you get exclusivity violations because something lives too long, although there are various solutions to improve this like non-lexical lifetimes. In Mojo a value is destroyed immediately after its last use. This makes it a much more friendly experience because your lifetime ends and therefore exclusivity violations get relaxed much earlier. It's better for memory use, for example if you're talking to a GPU, a tensor could be holding on to four gigabytes of data, and so you want to free the memory as early as possible. It's better for little things like tail calls and other core PL concepts, there's this pile of very low level, obscure details. Rust also has this thing called the drop check flag. And so they actually, in the worst case dynamically track whether or not a slot on the stack is live or not. I've known the Rust community for a long time and have a lot of respect for it. But also it's around 14 years old, roughly the same age as Swift. And we've learned a lot from that journey, Mojo represents is an opportunity to take the learning and do the next step, there are a bunch of ways to simplify it. Mojo also supports async await natively because that's obviously important for high performance threaded applications. We don't need pinning, which is a really big deal it turns out, because all values have identity. There are these very low level nerdy tweaks to the way the type system works, in Mojo you never get implicit memcpy because of moves. ### How does mutability and value semantics work in Mojo? Summarized from 55:47 into the video One of the things that we pushed and Swift has is functional programming, it made the observation that functional programmers say it's amazing because you never mutate data. You always get new values, and because you get new values, you get composition, you get predictability, you get control, you get all these different benefits of not having mutation. C programmers would flip that around and say that creating a new value every time you want to insert something into a list is very bad for performance, so nobody could ever build a real system on top of that. Swift says the thing that you want is exclusive ownership of a value to get value semantics which still allows local mutation. Rust has its own take on the same idea, if you have exclusive access to a value, you can mutate it. In Swift the Array, Dictionary, and String types are all immutable in the Java sense, where your know that the value will never change underneath you. And so it looks very much like a functional programming idiom. If I have a String, it can't change unless I change it. If I change it, it's not gonna break anybody else. And through the implementation, it never does deep copies implicitly. And so there's a bunch of stuff that was developed and works really well in the Swift ecosystem that I think will come over naturally into the Mojo ecosystem. The goal is bring forward the wonderful things of functional programming. Composition locality of reference so you don't have the spooky action at a distance that reference based languages have. So this is all what I love about the functional programming model, but then we can also bring in-place mutations, so you also get the efficiency. Swift has some problems, it implicitly sometimes copies things a million times and, and so we've learned from that and fixed some of those problems in Mojo. This is all opt in, if you want to use fully dynamic stuff that's totally fine, which is a system that can scale because we're not trying to change the existing world. What we're doing is filling in the missing world. One way to look at modern Python is that it's only half the language, underneath it is C. If you're building a large scale application in Python, you end up having C or Rust or something else that goes with Python. And so what we're doing is keeping the Python syntax, but then replacing the C and having one system that can do both. So instead of having to switch from Python, with C and FFI and bindings and all that nonsense, you can still have the __add__ like you're familiar with and everything just works. ### How does parallelization work in Mojo? Summarized from 01:00:34 into the video We push it into libraries, we have things like a parallel for loop, and they're just library functions. You can pass a nested function in, and so that's the easiest way. We have a very high performance, low level threading library. Today's systems are not just four or eight cores, they're servers with 256 cores, and it's only going to get more crazy in the next few years. This is the world that Mojo is designed for. We haven't built out an actor system for Mojo yet. Swift has a full actor system which is type safe, it's very good for large scale loosely coupled distributed agents, it even supports distributed actors. It builds right on top of async await in a very nice way, and so we may do that. Right now we're very focused on structured compute, more supercomputer style, and the numerics side of things, so we haven't prioritised an actor system yet. I would prefer it to be in the library if we can, to make sure that it's memory safe. Other threading libraries are not memory safe and that leads to certain challenges. There may be a benefit to putting some logic in the compiler to mediate accesses across actors, and then put the bulk of it in the library with type system support. Most programmers just want to say, here's a parallel for loop, go nuts. From the systems level, you want to be able to support structured nested parallelism. You need thread libraries to compose, you need async await. So you're not getting bogged down with hundreds of thousands of threads that then kill your machine. ### How does CPU and GPU Composability work? Summarized from 01:03:27 into the video If you think about CPUs with 256 cores, GPUs have thousands of cores, or thousands of threads. And the programming model around a GPU is extremely different than the traditional CPU programming model. One of our goals is to make it so people can write much more portable algorithms and applications. It's easy to understand how you make a graph portable. You implement the graph for one type of hardware, and another implementation for another type of hardware. The power of being declarative is that you're separating out a lot of the implementation concerns. But then if you get down into writing for loops, they're imperative code at the bottom of the stack. And so we've carved out the ability for people to define their own abstractions in Mojo. When you start talking about accelerators, really what ends up mattering a lot parallelism, but also memory. And so how you use the memory hierarchy is the most important thing these days, particularly for GPUs and LLMs in this world that we inhabit. Modern GPUs and CPUs have many level memory hierarchies. In a CPU is you've got a big vector register file which is your L0 cache, then you have an L1 cache, which is really fast and close to the CPU, an L2 cache which is sometimes shared with one or two cores, an L3 cache and it's shared with all of the cores, and main memory. The GPU has roughly the same idea, although the details are very different. Inherent to getting high performance with something like matrix multiplication is not just doing a dot product, you have to process the workload and tiles. We've seen an emergence of various tile based programming models instead of writing afor loop doing a load, store, add, and multiply. Instead you're thinking about processing a tile at a time. What you do is you write the algorithm for a tile and then you use higher level orchestration logic that then says on this device, I'll traverse this way, or I will prefetch the data in two steps ahead, or I will get better reuse if I go vertically and some horizontally etc. There are all these tricks that the world has developed. In AI you get a generalization called a tensor, and so you take a two dimensional grid of numbers and you make it an n-dimensional grid of numbers. What really happens is it gets linearized in memory. But if you go down a row, you're jumping a whole rows worth of data which is a lot less efficient. When we get into multidimensional vectors, that becomes more pronounced. In matrix multiplication typically you're going horizontally through the row of one matrix and you're going vertically through the row of another matrix to compute an output element. If you tell the GPU to arrange those two matrices differently,  you can transpose it ahead of time, which makes things a lot more efficient. Instead of processing one row and one column at a time, you can process two rows and one column. What that means is when you're processing a column, you're accessing two elements next to each other, for example. And so as you generalize this you get the idea of a tile, a logical concept of processing a two dimensional block of memory composing against other things. Modern hardware not only is it complicated with vectors and threads etc. but they're now adding full on matrix operations to the silicon. You can literally do a matrix multiplication of a very small matrix, say 4x4 or 16x16 for some accelerators, up to 128x128. The intuition is that AI is important to the world and silicon is fundamentally two dimensional. If you use the two dimensional nature of silicon to put down a matrix multiplication, you can get a lot of performance and other benefits from that. A lot of the challenge is how do I use these accelerators, map tiles onto the devices, use the memory hierarchy efficiently, and this becomes as important as the numerics because the performance difference can be 10x or 100x. We have the Fortran world, and various C template libraries. They were built to try and combat some of these problems. They came up with sometimes very powerful, but niche solutions and the usability was never very great. This is where you want to pull together Mojo's ability to talk to all these crazy hardware features, like the matrix multiplication operations, along with higher order combinators so that you can build libraries that can handle things like tiling. You don't want to know how the orchestration logic works, you only want to know how part of it works. The compile time metaprogramming then enables you to write really reusable and portable code. One of the things I recently gave a talk to at the NVIDIA GTC conference, is how this all composes together to make it so you can write high performance numerics for the same algorithm, which works on GPUs and CPUs. If you're making a major investment in building software, you want it to last for 10 years or 20 years. You want to be able to adapt to the needs of new hardware. And hardware will continue to evolve, it's moving faster than ever. Mojo is helping break through some of these boundaries that have prevented people from building portable software, while still being able to utilize the high performance, super fancy features that people are coming out with. NVIDIA is a great citizen in the software world because every time they come out with a new chip, they provide LLVM access. We can talk directly into that stack, hardware makers are very LLVM friendly these days, and Mojo can talk to MLIR and LLVM and get direct access to all these hardware optimizations. ### Community and open source Summarized from 01:17:04 into the video Mojo is still a relatively young language which launched last May, so it's been public for less than a year. But it's doing really well, we have over 175,000 people that have used Mojo, we have a nice discord community that has over 22,000 people hanging out, and all the Mojicians like talking to each other and building cool stuff. Actually, as we record today, we're open sourcing a big chunk of Mojo. The entire standard library, which is the heart and soul of the language, is all open sourcing. We've been on a quest to open source more of the stack over time, so that's a really big deal. We've been public about this and telling people about it for a while, people have been waiting for it for a long time. We're seeing continued growth of the community and continued passion projects, and I think this will be a huge step. Open source is very important to me, I built the LLVM community from scratch from my research project at university. I helped build the Swift open source community and worked in many other communities. What I've seen is that open source isn't just about having code on GitHub. Open source is about having an open community, having an inclusive way of developing code together, working together with a common goal. And so we put a lot of energy into not just providing source code, but also getting a contribution model, and picking the Apache 2 license and following best practices. I'm really excited about that, I think that people are going to have a lot of fun and I look forward to being much more open with our development of Mojo. Please join our Discord, that's a great place to go. There's everything from folks that are interested in type theory nerdery, to AI researchers, to people that just want a better Python. And again, the cool thing about Mojo is that it's being built with state of the art to solve these hardcore problems at the frontier of computer architecture and programming languages. We're building in a way that It's completely general, although we're focused on AI as there's a lot of pain and suffering in that world. But it turns out that a lot of people write web servers and other things. And it's fantastic to see people building into that space, even though we personally don't have the expertise to invest in that. The thing I love about Swift is I still get people that stop me in the street and say thank you for helping to drive this thing and make it happen. Because of you, I learned how to get into programming and Objective C was always too scary. These things take a couple of years to play out, but what I hope happens with Mojo is we get all these people that know Python and can continue to grow. Because they're not faced with this scary threshold of learning C or Rust. And if we can get more people involved, be more inclusive to good ideas, what I think we'll find is these technologies can go even further and have an even bigger impact. - Download MAX and Mojo. - Head over to the docs to read the Mojo🔥 manual and learn about APIs. - Join our Discord community. - Contribute to  discussions on the Mojo GitHub. - Read and subscribe to Modverse Newsletter. - Read Mojo blog posts, watch developer videos and past live streams. - Report feedback, including issues on our GitHub tracker. Until next time! 🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] ================================================================================ URL: https://www.modular.com/blog/whats-new-in-mojo-24-3-community-contributions-pythonic-collections-and-core-language-enhancements PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 2, 2024 # What’s New in Mojo 24.3: Community Contributions, Pythonic Collections and Core Language Enhancements Shashank Prasanna Mojo🔥 24.3 is now available for download and this is a very special release. This is the first major release since Mojo🔥 standard library was open sourced and it is packed with the wholesome goodness of community contributions! The enthusiasm from the Mojo community to enhance the standard library has been truly remarkable. And on behalf of the entire Mojo team, we’d like to thank you for all your feedback, discussion and, contributions to Mojo, helping shape it into a stronger and more inclusive platform for all. In addition to standard library enhancements, this release also includes several new core language features and enhancements to built-in types and collections that make them more Pythonic. Through the rest of the blog post, I’ll share many of the new features with code examples that you can copy/paste and follow along. You can also access all the code samples in this blog post in a Jupyter Notebook on GitHub. As always, the official changelog has an exhaustive list of new features, what’s changed, what’s removed, and what’s fixed. And before we continue, don’t forget to upgrade your Mojo🔥. Let’s dive into the new features. ### Enhancements to List, Dict, and Tuple In Mojo 24.3 collections (List, Dict, Set, Tuple) are more Pythonic than ever and easier to use if you’re coming from Python. Many of these enhancements have come directly from the community: - List has several new methods that mirror Python API, thanks to community contributions from  @LJ-9801 @mikowals @whym1here @StandinKP. - Dict can now be updated thanks to contributions from @gabrieldemarmiesse. - Tuple now works with memory-only element types like String and allows you to directly index into it with a parameter expression. One of the best ways to learn new features is to see them in action. Let’s take a look at an example that makes use of these types. In the example below we implement a simple gradient descent algorithm, which is an iterative algorithm used to find the minima of a function. Gradient descent is also used in most machine learning algorithms to minimize the training loss function by updating the values of function parameters (i.e. weights) iteratively until some convergence criterion is met. For this example, we choose the famous Rosenbrock function to optimize, i.e. find its minima. Rosenbrock is an important function in optimization because it represents a challenging landscape with a global minimum at ((1,1) for 2-D Rosenbrock) that is difficult to find. Let’s take a look at its implementation and how we make use of Mojo’s shiny new List, Dict, and Tuple enhancements. First, we define the Rosenbrock function and its gradient: We use Tuple to return the gradients using (dx, dy). Notice that for the return type we use Tuple[Float64, Float64], we can also write it more simply as (Float64, Float64) using parentheses just like in Python. Now we can write the gradient descent iteration loop and we'll use the parentheses style for Tuple. This simplifies compare List[Tuple[Float64, Float64, Float64]]() vs List[(Float64, Float64, Float64)]() below: Here we use List to store gradients and function evaluation at each iteration using history.append((x, y, rosenbrock(x, y))) We also capture the Tuple output of rosenbrock_gradient in grad. You can index into grad to access dx = grad[0] and dy = grad[1] which we use to update x and y. Finally, we call the gradient_descent function with a dictionary of parameters params: Output Note: plot_results() is a Python function that I call from Mojo using Mojo-Python interop. Since we capture all the iterations of (x,y) in our List[Tuple] variable history we have all the information we need to generate these plots below. We do, however need to covert history into a NumPy array before we call our Python function, which is what we do in the for loop at the end. You can find the implementation of this function on GitHub along with rest of the code. In the plot above (click to zoom) you can see that we start at an initial point (0,3) and gradient descent takes us to the global minima at (1,1) We can use the new update() function in Dict to update using params.update(new_params) to change our initial point to (-1.5,3) and re-run the optimization: Output With the new initial point you can see in the contour plot (click to zoom), that due to the narrowness of the valley, the gradient descent algorithm overshoots the minimum and bounces back and forth across the valley, causing oscillations. Such problems are common in numerical optimization problems and can lead to slow or premature convergence. This tells us that we can explore different learning parameters (or hyperparameters in machine learning) or other types of optimizers to converge faster. ### Enhancements to Set Sets are unordered collections of unique elements, allowing for efficient membership tests and mathematical set operations. An example of using Sets can be to identify unique genetic markers or species from a large dataset of DNA sequences. Sets can automatically handle duplicates, and offer efficient operations for mathematical set concepts like unions, intersections, and differences. In this release, Set introduces named methods that mirror operators, thanks to contributions from @arvindavoudi Let’s take a look at a simple example that compares both operator based and the new method based operations on the set. Let’s define two sets with different genetic markers: We can use both difference method and difference operator to subtract both sets: Output Similarly, we can perform intersection_update using the method and the operator &= : Output Finally, we can use the new update method to update a set: Output ### New reversed() function for reversed iterator This release includes a new reversed() function for reversed iterators thanks to community contribution from @helehex @jayzhan211. In this example below, we reverse the words in a sentence using the new reversed iterator and by using List’s reverse() method and compare their results: Output reversed() function for reversed iterator also supports Dicts. ### New parametric indices in __getitem__() and __setitem__(), and Dict, List, and Set conform to the new Boolable trait. Mojo 24.3 also includes new core language enhancements and introduces a new Boolable trait. In the example below we’ll explore both these features. We’ll create a struct called MyStaticArray whose size is known at compile time. For the MyStaticArray struct we can choose to define parametric indices __getitem__[idx: Int](self) and use compile-time checks on the requested index. This is in contrast to using __getitem__(self, idx: Int) which can be used when the size of the array is unknown at compile time. Let’s take a closer look at the struct: Let’s instantiate the MyStaticArray and since it conforms to Boolable trait, we can check if the array is empty. We can use Bool(arr) or just arr in the if condition, we show both approaches below: Output Now let’s try to get an item from the MyStaticArray whose index is larger than the size of the array. Output This fails the constrained[idx<size, …]() test in __getitem__[]() function. ### But wait, there is so much more! Mojo 24.3 is a huge release and I barely scratched the surface in this blog post. While this blog post was focused on community contributions, standard library enhancements, and a few core language enhancements, there is a lot more in this release that also caters to low-level system programming. I encourage you to check out the detailed list of what’s new, changed, moved, renamed, and fixed, check out the changelog in the documentation. A few other notable features from the changelog: - Core Language: Improvements to variadic arguments support. - Core language: Allows users to capture the source location of code and call the location of functions dynamically using the __source_location() and __call_location() functions. - Standard Library: FileHandle.seek() now has a "whence" argument similar to Python. - Docs: New Types page. MAX 24.3 is also available for download today and includes several enhancements including preview of Custom Operator Extensibility support which allows you to write custom operators for MAX models using the Mojo for intuitive and performant extensibility. Read more in the What’s new in MAX 24.3 blog post. All the examples I used in this blog post are available in a Jupyter Notebook on GitHub, check it out! - Download MAX and Mojo. - Head over to the docs to read the Mojo🔥 manual and learn about APIs. - Explore the examples on GitHub. - Join our Discord community. - Contribute to  discussions on the Mojo GitHub. - Read and subscribe to Modverse Newsletter. - Read Mojo blog posts, watch developer videos and past live streams. - Report feedback, including issues on our GitHub tracker. Until next time! 🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Shashank Prasanna AI Developer Advocate Shashank is an engineer, educator and doodler. He writes and talks about machine learning, specialized machine learning hardware (AI Accelerators) and AI Infrastructure in the cloud. He previously worked at Meta, AWS, NVIDIA, MathWorks (MATLAB) and Oracle in developer relations and marketing, product management, and software development roles and hold an M.S. in electrical engineering. ================================================================================ URL: https://www.modular.com/blog/multimodal-search-with-snowflake-embedding-and-max-engine PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: April 26, 2024 # Multimodal Search with Snowflake Embedding and MAX Engine Ehsan M. Kermani In our previous blog post on  semantic search with MAX Engine, we demonstrated that MAX Engine significantly outperformed both PyTorch eager and ONNX runtime—by factors of 2 to 2.8 times, respectively, across different batch sizes. Today, we're exploring how a multimodal approach can further enhance semantic search by combining textual and visual data and we will discuss how MAX Engine can optimize multiple models for inference. The integration of multiple data types in semantic search presents a unique challenge: how to effectively blend and understand information that comes in different forms, such as text and images. This approach is crucial because it mirrors the way humans process information, leveraging both visual cues and textual context. Pioneering models, such as OpenAI CLIP, have successfully merged text and image understanding through a single neural network trained on vast amounts of data. For this blog, we will use lightweight models such as snowflake-arctic-embed-m which is a state-of-the-art, pretrained text embedding model and MobileNetV2 image classification model that we extract the logits for our image embeddings. Inspired by CLIP, we create a custom deep learning model that takes image and text embeddings and maps them into a common shared space. For training, we utilize a contrastive loss function, which helps in aligning the text and image embeddings in the shared latent space. Additionally, we use the Flickr30k dataset which contains 31,000 images collected from Flickr, together with 5 reference sentences (captions) provided by human annotator, for training, evaluating and testing our multimodal model. We will demonstrate how to convert the models to TorchScript and optimize them in MAX Engine for inference. Lastly, we compute the cosine similarity matrix of the image-caption pairs in the test dataset and conclude by visualizing the ground-truth captions alongside the top five most similar captions found using the similarity matrix. To install MAX, please check out Get started with MAX Engine. Also have a look at Getting Started with MAX Developer Edition in case you missed it. The code for this blog post is available in our GitHub repository. The MAX version for this blog is max 24.2.1 (58157dc0). ### Data inspection We start by downloading the Flickr30k dataset which is a comprehensive collection of 31,000 images sourced from Flickr, each accompanied by five captions written by human annotators.The dataset is publicly available on HuggingFace. To construct our (image, caption) pairs, we simplify the dataset by randomly selecting one out of the five available captions for each image, ensuring that each pair consists of one image and its corresponding caption. The dataset is divided into three distinct parts, which serve different roles throughout our experiments: - Train: This subset is used for training our model, allowing it to learn and adapt to the task of associating images with textual descriptions. - Validation: This subset helps in tuning the model and validating its performance during training, providing a way to monitor overfitting and make adjustments to model hyper-parameters. - Test: Used for evaluating the model’s performance after training, this subset helps assess how well the model generalizes to new, unseen data. For effective visualization and interaction with the dataset, we use the fiftyone Python package that is particularly suited for tasks like ours because it offers a variety of tools that facilitate the quick construction, visualization, and analysis of image datasets. Here is our the dashboard looks like Note that when using the fiftyone package over SSH, by default the server runs on port 5151. To access it remotely, we need to setup port forwarding via ssh -L 5151:localhost:5151 username@server. ### Building our own multimodal model Our multimodal model consists of three parts, each of which we will explain in detail. #### Text embedding For text embedding, we use snowflake-arctic-embed-m which is a state-of-the-art, pretrained text embedding model with 768 embedding dimensions that supports up to 512 tokens and occupies 436MB of disk size. It's particularly suitable for CPU-only applications due to its low runtime memory usage of 0.41GB (float32), which optimizes performance without compromising speed. Below is the code snippet demonstrating how to load the model, compute the query embeddings, and normalize them for subsequent processing. This function will be integral to our semantic search system, allowing us to accurately and efficiently process textual information alongside visual data, thereby enhancing the overall search capability. #### Image embedding For the image component of our multimodal search system, we use the MobileNetV2, a lightweight classification model pretrained on the ImageNet-1k dataset. This model is designed to handle images of 224 by 224 resolution, making it an excellent choice for efficient image processing without sacrificing accuracy. Here's how to load the model and compute the normalized logits, which we use as embedding values. This process ensures that the embeddings are on a consistent scale, which is crucial for accurately comparing images in our search system. This method provides a streamlined approach to obtaining image embeddings, which we will use in the next section. #### Custom multimodal model The following is an example of a simple multimodal model, designed to integrate text and image embeddings effectively. This model aims to project both types of embeddings into a common space where their similarities can be compared directly, which is crucial for tasks like multimodal semantic search. Here's a breakdown of how the model is structured and functions: The model consists of - Text and Image Transformation Modules: These are simple neural networks consisting of a linear layer followed by a ReLU activation function. The linear layer reduces the dimensionality of the text and image embeddings to common_dim, making the embeddings more manageable and focused on the most essential features for comparison. - Final Linear Transformation: This is a shared linear layer applied to both the transformed text and image embeddings. By projecting both types of embeddings into the same space with the same transformation, we ensure that they are directly comparable. This is crucial for tasks that involve finding the similarity between text and images. Overall, this simple model facilitates the interaction between text and image data in a meaningful way, which enhances the capability of our multimodal semantic search. By ensuring that text and images are represented in the same vector space, we improve the system's ability to match text queries with relevant images and vice versa. #### Contrastive loss function For our model to be able to distinguish between similar and dissimilar pairs of data, we use a contrastive loss function. The core idea behind contrastive loss is to ensure that representations of similar items are pulled closer together in the embedding space, while representations of dissimilar items are pushed apart. This is typically achieved by comparing the distance between embeddings with a margin—a threshold beyond which the distance between dissimilar pairs should ideally lie. One foundational paper that discusses the use of contrastive loss in deep learning is "Dimensionality Reduction by Learning an Invariant Mapping" by Hadsell, Chopra, and LeCun (2006) which has since been widely adopted and adapted for various applications in machine learning, particularly in supervised and semi-supervised settings where relational knowledge between data points is crucial. Our ContrastiveLoss class is a specialized module for calculating contrastive loss, which is particularly effective for learning tasks where the goal is to learn similarities and differences between pairs of items—in our case, between image and text embeddings. We will use a simpler form (without including negative pairs i.e. negative hard mining) of the following formulation from SimCLR paper, where sim is the cosine similarity function, tau is the temperature. Here's a breakdown of its components and functionality: - Temperature: This scalar is used to scale the cosine similarity outputs, which affects the sharpness of the distribution of output probabilities. A lower temperature makes the distribution harder, amplifying the differences between the more and less similar pairs, which is crucial for training stable and robust models. - Cosine Similarity: This function measures the cosine of the angle between two vectors. In this model, it is used to calculate the similarity between the embeddings of images and texts. By treating the embeddings as vectors in a high-dimensional space, the cosine similarity directly correlates to how similar the actual content of the texts and images are. - Logits Calculation: The cosine similarities are computed between each image and text embedding pair, scaled by the temperature, and structured in a matrix where each row corresponds to an image and each column to a text. This matrix setup facilitates the comparison of each image with each text. ‍ - Labels and Loss Calculation: The true matches between images and texts are on the main diagonal of the logits matrix (since each row and column index of the diagonal corresponds to paired image and text embeddings). The CrossEntropyLoss function then uses these labels to compute the loss, which encourages the model to correctly align the embeddings of corresponding images and texts. #### Train and evaluation To initiate training of our custom multimodal model, we will keep the setup straightforward by running the training loop for only five epochs without adjusting any hyper-parameters. This approach allows us to quickly validate our model's architecture and initial performance. Here is the Python code that handles the training process and saves a checkpoint at the end of each epoch to track the model's progress and potentially resume training if needed. Once the training is complete, we can visualize the training and validation losses. For the remainder of this blog post, we will use the checkpoint from epoch 2. ### Inference with MAX Engine In this section, we will see how to prepare the models to be used with the MAX Engine. #### Convert to TorchScript MAX Engine requires PyTorch models to be in TorchScript formats. Below, we will demonstrate how to convert all three parts of our model—the image embedding, text embedding, and the custom multimodal part—into TorchScript format. Note that for PyTorch tracing, we only need to provide dummy inputs but with correct shapes as follows We are now ready to employ MAX Engine to optimize our models for fast inference. #### Load and optimize models with MAX Engine Next, we create a session object and provide input specifications for all three parts, loading them into their optimized MAX models. Here, we use MAX Engine dynamic shape capabilities to compile the models. For example, to compile the models for dynamic batch sizes, we use None as the first dimension of TorchInputSpec as follows and for the text embedding to account for variable sequence lengths ,we use None as the second dimension in TorchInputSpec #### Create similarity matrix and inspect the results In this section, we use our optimized MAX models to generate embeddings for images and captions from our test dataset and then compute the projected embeddings into a common space. This setup allows us to create a similarity matrix, enabling us to assess and visualize the alignment and correlation between image and text embeddings. For demonstration we use a fixed batch size of 16, but note that our model was compiled to support any feasible batch sizes. In real world use-cases if the batch size is fixed for inference, MAX Engine can optimize the model further. For that we no longer need to use None in TorchInputSpec and we can use a predetermined fixed batch size value in the compilation process. None Given the cosine_similarities which is a matrix of shape 1000 by 1000 (since there are 1000 images in the test dataset), we can retrieve the k highest values and their corresponding indices from the cosine similarity matrix. In this case, k is set to 5, meaning the code identifies the top 5 most similar text embeddings for each image embedding. This is useful for tasks like retrieving the most relevant textual descriptions for given images or vice versa. Finally, we can visualize the top 5 captions for each image using the following approach. This visualization not only allows us to review the most relevant captions identified by our model but also serves as a critical assessment tool. As an example, is the - ground-truth caption: A man is an orange hat starring at something - top predicated caption: A man with glasses is wearing a beer can crocheted hat Additionally, here is a view of the test dataset with both ground-truth and predicted captions. This side-by-side comparison provides a clear illustration of our model’s performance, allowing us to directly assess the accuracy of the predictions against the actual captions. ### Next steps Here are a few potential next steps to consider - Experiment with different image and text embeddings to assess the impact on your results. - Modify the architecture of our custom model and perform hyper-parameter tuning. - Use evaluation metrics such as Precision@k and NDCG@k to obtain more reliable numerical results. - We are excited to see what you build! 🚀 Share your own end-to-end MAX pipelines with us. ### Conclusion In this blog post, we have explored the advantages of employing a multimodal approach to semantic search using the MAX Engine. We demonstrated how to create and train a multimodal model for enhanced search capabilities, and we showed how to effectively use MAX Engine when dealing with multiple interconnected models. By visualizing the top predicted captions alongside the ground-truth data, we were able to conduct a direct assessment of our model’s applicability. This not only highlighted the potential of multimodal systems in understanding complex datasets but also underscored the importance of continuous refinement and testing to achieve high accuracy and relevance in search results. Additional resources: - Get started with downloading MAX - Download and run MAX examples on GitHub - Head over to the MAX docs to learn more about MAX Engine APIs and Mojo programming manual - Join our Discord community - Contribute to discussions on the Mojo and MAX GitHub Report feedback, including issues on our Mojo and MAX GitHub tracker. Until next time!🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Ehsan M. Kermani AI DevRel Ehsan is a Seasoned Machine Learning Engineer with a decade of experience and a rich background in Mathematics and Computer Science. His expertise lies in the development of cutting-edge Machine Learning and Deep Learning systems ranging from Natural Language Processing, Computer Vision, Generative AI and LLMs, Time Series Forecasting and Anomaly Detection while ensuring proper MLOps practices are in-place. Beyond his technical skills, he is very passionate about demystifying complex concepts by creating high-quality and engaging content. His goal is to empower and inspire the developer community through clear, accessible communication and innovative problem-solving. Ehsan lives in Vancouver, Canada. ================================================================================ URL: https://www.modular.com/blog/preventing-supply-chain-attacks-at-modular PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: April 25, 2024 # Preventing Supply Chain Attacks at Modular Zac Bowling Swetha Muniraju At Modular, the pace of innovation means we are always shipping new software and features for our users. While this is really exciting, it also presents some unique challenges. Modern software and delivery mechanisms are more vulnerable to security attacks than ever before. It is estimated that in 2024, 96% of total codebases contained open-source code with an average of 500+ components per app. Recent events, such as the sophisticated XZ supply chain attack, have highlighted the urgent need for robust defenses against these types of vulnerabilities in the supply chain. At Modular, a secure software delivery strategy has been our core tenet since we shipped our first version of Mojo back in the Fall of 2023. ### The ecosystem today Traditionally, software delivery systems have relied on a combination of SSL/TLS for downloading software from a trusted source, signing systems like GPG, and verified cryptographic hashes to validate that packages were not tampered with. You can see these techniques used in package managers like PyPI, apt, YUM, and others. However, only coarse-grained approaches to security are used in these systems and they are still vulnerable to attacks as they always assume the source repository can be trusted. In addition, none of these methods guard against the modern supply chain attacks as they can happen from any point from package creation to deployment. Nor are they designed to help recover when such attacks occur. For example, say your signing keys are compromised, many of these package management systems are ill-equipped to quickly handle the aftermath without manual user intervention. Given all of these constraints, we at Modular had a set of questions we wanted to solve. - How do we deal with a potential leak of our signing keys? - How can we revoke software we have shipped that have known vulnerabilities introduced either by third-party dependencies or by us? - How can we help the user validate that the installed software is genuine and not tampered with in the distribution supply chain, especially when it's delivered by our CDN partners, who may have been compromised? ### Building on “The Update Framework” standard The Update Framework (TUF) specification was written to overcome some of the security vulnerabilities faced by using traditional package managers. TUF publishes standards and techniques to update software securely and to handle supply chain attacks. It validates files using public/private shared key encryption and provides a mechanism for quickly rotating keys without necessarily invaliding all the previous releases of the software. In addition to handling key compromises swiftly, TUF also prevents malicious mirror update attacks, replay attacks, and a host of other attack vectors. A full list of attacks that TUF protects against are listed in detail here. The TUF organizers provide a few reference implementations to get started with; however, these are not out-of-the-box general-purpose software update solutions. This is because different software deployment systems and their accompanying packages may have complex needs depending on the environments they run. For that reason, TUF doesn’t specify concepts like versioning, installation requirements, system compatibility, or even the actual method of software delivery (HTTPS, BitTorrent, etc.). To complete that story for Modular, we had to build our client implementation of TUF with all the additional features that you might find in a package manager. ### The modular CLI When considering all these problems with secure software packaging and distribution we found there wasn't one out-of-the-box cross-platform solution that we could simply adopt that solved all of these problems for us. This was one of the many reasons that led us to build the modular CLI (https://docs.modular.com/cli/). If you have already installed the MAX and/or the Mojo standalone package, chances are that you have already interacted with our modular CLI. The modular CLI is how we securely distribute the Mojo, Mojo nightly, and MAX packages. The modular CLI is installed as a signed system native package, which provides the first layer of security. For this layer, we are still constrained by some of the challenges that we had outlined earlier. However, we mitigate some of these risks via an authentication in the next step. ### First round of security - authentication After installing the modular CLI, we ask users to authenticate the modular CLI to get started. Authentication provides yet another opportunity to validate the modular CLI tool and prevent the user from continuing with untrusted packaging. It provides some security against replay attacks where an intruder works to keep a user on an older and possibly compromised version of the client that could be used to try and install other compromised software. ### Second round of security - package verification After authentication, users can use the modular CLI to install a number of packages. Today this includes the full MAX, Mojo standalone, or Mojo nightly packages. ‍ The modular CLI does several things, including checking for the latest version of the package, finding a compatible and optimized version for your system, downloading the package, and securely validating it before attempting to install it. ### What does this mean for you? The best part about this is that you shouldn't have to worry about any of this. Good security is hard work, but it is at its best when you don't have to think about it. We are continuing to drive state of the art techniques into all levels of our technology and products, and will continue to ensure you get the right bits delivered securely ### What's next? As we grow our community, we are excited to scale our modular client to support different platforms. We'll also continue to introduce delightful new features so you can continue to fall in love with our products and technologies. We are constantly listening to your feedback and adapting our roadmaps to cater towards our community needs. If you have any comments or feedback, please reach out to us on discord channels or via GH-Issues. If you are interested in contributing to the work that we are doing at Modular, there’s good news for you - We are hiring! Please visit https://www.modular.com/careers#open-roles and apply to the open positions. ‍ ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Zac Bowling AI Framework Engineer Zac is a seasoned software engineer with over 20 years of experience. He has a specialty in developing embedded and mobile operating systems and building developer tooling and SDKs for platforms like Apportable and Google. Prior to joining Modular, Zac worked at Google for nearly 8 years, where was an early developer bringing up the new Fuchsia operating system. Swetha Muniraju AI Frameworks Manager Engineering leader with experience managing large scale distributed backend, and applied machine learning services in production. Prior to joining Modular, Swetha served as a media tech backend engineering leader at Twitter. During her time at Twitter, she was overseeing the global team responsible for video, and image stack delivering live streaming, VOD and Audio Spaces products. She has also led global engineering and research teams at Nokia serving as head of perception and localization by building zero to one products in the field of applied machine learning. Swetha loves spending time outdoors with her family skiing or hiking depending on the season. ================================================================================ URL: https://www.modular.com/blog-all?topic=Culture PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/tim-davis YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Chris+Lattner PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Tim+Davis PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/a5f21428f399453b9206416be52aa141 YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/a-unified-extensible-platform-to-superpower-your-ai PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: May 2, 2023 # A unified, extensible platform to superpower your AI Chris Lattner Tim Davis Eric Johnson ## Improving AI for the world If you’ve followed Modular since our founding in early 2022, you know we’ve been talking a lot about how AI software is broken, fragmented, too expensive, and negatively impacts AI developers and the world. We’ve written a manifesto about why the world needs better AI software, discussed the importance of modularity in AI software, explained how current tech stacks struggle with large models, and described where today’s AI serving stacks fall short.  We only recently started sharing our results, including that we developed the world’s fastest matrix multiplication algorithms across multiple CPU targets. This post is different. We’re excited to finally share what we’ve been building at Modular. This announcement begins Modular’s journey to radically change the nature of AI programmability, usability, scalability, and compute. We strongly believe in a world that gives fair and equitable access to AI for all. To achieve our vision of enabling AI to be used by anyone, anywhere, we are rethinking and reinventing the entire AI stack from the ground up. Our next-generation developer platform scales to help you defragment your AI and compute stacks and realize more value from the incredible pace at which AI is evolving. ## Two incredible breakthroughs Modular is moving AI infrastructure from the research era into the production era. AI infrastructure itself has been rapidly evolving under heavy research for years now. Still, the lessons learned needed to be brought forward into a production-quality system that combines first-principles thinking with rigorous engineering and a design that scales to help unify the world. To that end, we are excited to announce two new technological breakthroughs on our next-generation AI developer platform: - The world’s fastest unified inference engine that is easy to use, portable, and highly performant, making it easier than ever to power your AI models in production, and save money in the process. - Mojo🔥, a programming language for all AI developers that combines the usability of Python and the performance of C, bringing programmability back to AI while unifying the hardware landscape. Let’s dive deeper into each. ### The world’s fastest unified inference engine We built the Modular Inference Engine to defragment and simplify AI deployment. It is the world’s fastest unified AI execution engine, powering all your PyTorch and TensorFlow workloads while delivering significant usability, performance, and portability gains. ‍ With the Modular Inference Engine, the benefits to AI developers are clear: - Deploy more models, faster: Powered by state-of-the-art technologies, the Modular Inference Engine allows developers to get rid of bespoke toolchains, radically simplifying AI deployment. Through simple APIs available in popular languages like Python and C/C++, developers can quickly deploy models trained using PyTorch and TensorFlow without intermediate model conversions or pre-optimization steps. - Full compatibility with existing frameworks and servers: Unlike other AI engines, the Modular Inference Engine natively supports all the operators available in the latest versions of the training frameworks. It is also fully compatible with models containing control flow and fully supports dynamic shapes (such as text sequences of varying lengths that power models such as BERT and GPT). It is extensible by design, allowing developers to write their own custom operators. It is also fully compatible with existing cloud serving solutions such as NVIDIA’s Triton Inference Server and TensorFlow Serving, and supports on-prem deployment as well. - Take advantage of the latest hardware: The Modular Inference Engine puts portability in the hands of every developer. The same installation packages “just work” everywhere regardless of the platform, micro-architecture capabilities (AVX512, AVX2, Neon), hardware type (CPU, GPU, xPU), or vendor. This means in practice that developers can now migrate workflows to new targets without changing toolchains or rewriting code. The ability to quickly experiment with different hardware allows businesses to gather the data required to make well-informed cost/performance tradeoffs - instead of guessing. - Maximize performance, minimize costs: Unlike other solutions in the market, developers do not have to trade performance to unlock portability. The Modular Inference Engine is incredibly fast, delivering 3-4x latency and throughput gains out-of-the-box on state-of-the-art models across Intel, AMD and Graviton architectures—unlocking compute everywhere. Check out performance.modular.com for a detailed breakdown of latency, throughput, and total inference cost across popular AI architectures. The Inference Engine is available now to a limited number of early-access partners, and developers can join the waitlist to get access here. You can also check out a preview of our Python and C/C++ APIs. ### Mojo 🔥: A programming language for all AI developers That’s right, we built a new programming language: we had to to defragment AI software development. Mojo 🔥 combines the usability of Python with the performance of C, and adds new abilities to scale to AI accelerators. This unlocks unparalleled programmability of AI hardware and extensibility of AI models, without breaking what you love about Python. Python is a powerful high-level language, complete with clean and easy to learn syntax and an expansive ecosystem of libraries: Python powers almost all AI research today. However, it also has well-known scalability issues—it doesn’t get you the world’s largest workloads nor does it get you to edge devices. Instead, production AI deployment happens in other languages like C++ and CUDA. The result is a fragmented AI software landscape that reduces AI developer productivity and slows the pipeline from research to production. Mojo solves these problems, bringing superpowers to AI developers: - Write everything in one language: Mojo combines the parts of Python that researchers love with the systems programming features that require the use of C, C++ and CUDA. Mojo is built on top of next-generation compiler technologies that unlock significant performance gains when you add types to your programs, enables you to define zero-cost abstractions, benefit from Rust-like memory safety, and that powers unique autotuning and compile-time metaprogramming capabilities. ‍ - Unlock Python performance: Mojo is built on Modular’s high performance heterogenous runtime and uses MLIR, which enables it to access all AI hardware. This gives Mojo access to threading, low-level hardware features like TensorCores and AMX extensions, and reach into accelerators.  And oh yeah it’s fast… very fast! In fact, Mojo is 35,000x faster than Python when running numeric algorithms like Mandelbrot because it can take full advantage of your hardware. ‍ - Access the entire Python ecosystem: But all this power doesn’t mean you have to sacrifice what you already know and love. Mojo doesn’t just look and feel like Python - it also gives you access to the full Python ecosystem, including favorites like Numpy, Pandas, Matplotlib, and also your other existing custom Python code. - Upgrade your models and the Modular stack: Mojo isn’t a side project — all of Modular’s  in-house kernels are written in Mojo, which is why the Modular Inference Engine has such amazing performance and portability. The engine lets you extend your models with Mojo pre and post-processing operations, and replace existing operations with custom ones. Mojo enables you to customize the Modular stack with kernel fusion, graph rewrites, shape functions, all without having to recompile the framework or write any C++ or CUDA. Mojo 🔥 is still in development but it’s available to try today with our JupyterHub-based Mojo Playground. Please visit Modular.com/mojo to sign up and gain access. ## The start of an incredible journey Modular is striving to radically reshape the nature of AI and accelerated compute. Today is just the very beginning a long journey.  We have a wide vision and want to enable AI to be used by anyone, anywhere. We hope that our infrastructure acts as a catalyst to unlock more AI developers, more innovation, and ultimately better AI products. Join the revolution — watch our launch keynote to learn more, chat with us on our Discord and visit Modular.com to try us out in early preview. Let’s change the world together! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] Tim Davis Co-Founder & President Repeat Entrepreneur and Product Leader. Tim helped build, found and scale large parts of Google's AI infrastructure at Google Brain and Core Systems from APIs (TensorFlow), Compilers (XLA & MLIR) and runtimes for server (CPU/GPU/TPU) and TF Lite (Mobile/Micro/Web), Android ML & NNAPI, large model infrastructure & OSS for billions of users and devices. Loves running, building and scaling products to help people, and the world. [email protected] Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] ================================================================================ URL: https://www.modular.com/blog/an-easy-introduction-to-mojo-for-python-programmers PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: August 8, 2023 # An easy introduction to Mojo🔥 for Python programmers Shashank Prasanna Learning a new programming language is hard. You have to learn new syntax, keywords, and best practices, all of which can be frustrating when you’re just starting. In this blog post, I want to share a gentle introduction to Mojo from a Python programmer’s perspective. Rather than focus on the language details such as Mojo’s programming model and syntax, which you can find in the Mojo programming manual, I’ll focus on an example-driven introduction that will gently guide you to a land of Mojo familiarity. The example used in this blog post is available in the Mojo Playground, so if you haven’t already signed up for Mojo - do so now! ### Mojo🔥: A familiar approach Mojo should feel very familiar to any Python programmer, as it shares Python’s syntax. But there are a few important differences that you’ll see as we port a simple Python program to Mojo. The first thing you’ll notice is that Mojo really shines in the performance department. “But Python is no slouch – NumPy is really fast!” you might say, and you’d be right. However, if you look under the hood of NumPy’s elegant Python API, you’ll see that all the computationally intensive code is written in C/C++, which is where its performance comes from. With Mojo, you can write high-level code like Python and leverage Mojo’s lower-level features to explicitly manage memory, add types, etc., to get the performance of C (or better!). This means you get the best of both worlds in Mojo and don’t have to write your algorithms in multiple languages. Before we get started, here are a couple of housekeeping items: - Mojo is still very early in its development phase and the language, and tooling aren’t ready to support the migration of large Python projects. We expect that Python users will initially port small, computationally demanding sections of their code to Mojo and then migrate more significant parts of their code base over time as the language and tooling mature. We are adding many new language features each week, and you should follow the regular Changelog to get updates. - The Mojo Playground environment is not always stable. You will be able to reproduce the output results of the calculations but the performance (execution time) may vary, and you may not see the performance shown below. The goal of this blog post is to introduce you to Mojo, not to benchmark its performance. ### From Python to Mojo: A simple example Let’s start with a simple example that calculates the Euclidean distance between two vectors. This is mathematically expressed as the L2-norm of the difference vector $||\vec{a}-\vec{b}||$ where $\vec{a}$ and $\vec{b}$ are two n-dimensional vectors, and I’ll discuss the implementation details in the algorithm section below. Euclidean distance calculation is one of the most fundamental computations in scientific computing and machine learning, used in algorithms like k-nearest neighbors and similarity search. In this example, you’ll see how you can get faster-than-NumPy performance on this task, using high-dimensional vectors with Mojo. It’s a computationally intensive problem, so we’ll build a solution from scratch, starting with Python, and bring it over to Mojo to improve performance. My goal with this example is not to build the fastest program for this task, but to introduce Mojo and its syntax as a Python programmer. #### Where do I run this example? - The Mojo Playground The code in this blog post can be copied and pasted into a new Jupyter notebook on Mojo Playground. First, head over to playground.modular.com to access or sign up to access Mojo on a hosted JupyterLab server. Once you have your playground open, create a new Notebook. Paste each code block in this blog post into a new Jupyter Notebook cell and press the Run button on the menu bar or hit Shift+Enter on your keyboard to run the cell and see the output. We're working to make the code in this blog post available as a Notebook in Mojo Playground soon! ‍ #### Algorithm implementation details Calculating the Euclidean distance is fairly straightforward: - Calculate the element-wise difference between two vectors to create a difference vector - Square each element in the difference vector - Sum up all the squared elements of the difference vector - Take the square root of the sum These 4 steps are illustrated in the diagram below: ‍ In our implementation, the dimension of the vector n is the number of elements in our array or list. In pure Python, you’d write it down like this: def python_naive_dist(a,b): s = 0.0 n = len(a) for i in range(n): dist = a[i] - b[i] s += dist*dist return sqrt(s) #### Euclidean distance in pure Python First, let’s set a baseline by running and benchmarking pure Python performance for the Euclidean distance calculation. To verify the distance calculation is numerically accurate across Python and Mojo implementations, we’ll create two random NumPy arrays of 10 million elements each and re-use them throughout the example. For the pure Python implementation, we’ll convert these NumPy arrays into Python lists, so we only use data structure native to Python. Mojo Playground tip: Add the %%python at the top of the Jupyter to instruct the Mojo Jupyter kernel to run this code as Python interpreted code and not as Mojo compiled code. First, let’s create 2 random vectors with 10,000,000 elements using the code below. %%python import time import numpy as np from math import sqrt from timeit import timeit n = 10000000 anp = np.random.rand(n) bnp = np.random.rand(n) alist = anp.tolist() blist = bnp.tolist() def print_formatter(string, value): print(f"{string}: {value:5.5f}") ‍ Now, we’re ready to calculate the Euclidean distance in pure Python. %%python # Pure Python iterative implementation def python_naive_dist(a,b): s = 0.0 n = len(a) for i in range(n): dist = a[i] - b[i] s += dist*dist return sqrt(s) secs = timeit(lambda: python_naive_dist(alist,blist), number=5)/5 print("=== Pure Python Performance ===") print_formatter("python_naive_dist value:", python_naive_dist(alist,blist)) print_formatter("python_naive_dist time (ms):", 1000*secs) ‍ The pure Python implementation takes about ~790 ms to run. Take a note of the Euclidean distance value of 1290.91809, we’ll use that to verify that the subsequent implementations are numerically accurate. #### Python + NumPy implementation To be fair to Python, rarely do Python programmers use Python native data structures for machine learning and scientific computing. The de facto standard for such use cases is the NumPy package, which provides the n-dimensional array data structure and optimized functions that operate on them. Since we already created a random NumPy vector in the previous step, we’ll use the same numpy arrays and calculate the euclidean distance using NumPy’s vectorized numpy.linalg.norm function that computes the norm on the difference vector. We measure the execution time of the NumPy implementation below. %%python # Numpy's vectorized linalg.norm implementation def python_numpy_dist(a,b): return np.linalg.norm(a-b) secs = timeit(lambda: python_numpy_dist(anp,bnp), number=5)/5 print("=== Python+NumPy Performance ===") print_formatter("python_numpy_dist value:", python_numpy_dist(anp,bnp)) print_formatter("python_numpy_dist time (ms):", 1000*secs) ‍ The time it took to calculate the Euclidean distance to the exact same value of 1290.91809 went from ~790 ms to ~24 ms: that’s about 30 times faster using NumPy’s faster C/C++ implementation under the hood. Can we run it faster with Mojo? Let’s find out! #### Our first Mojo implementation Mojo offers Python’s usability with optional low-level control like C. Let’s start with a Python-like implementation in Mojo and see what performance we get. First, we need a data structure for our vectors. Mojo offers a Tensor data structure which allows us to work with n-dimensional arrays, and for this example we’ll create two 1-dimensional Tensors and copy over the NumPy array data to it. from Tensor import Tensor from DType import DType from Range import range from SIMD import SIMD from Math import sqrt from Time import now let n: Int = 10_000_000 var a = Tensor[DType.float64](n) var b = Tensor[DType.float64](n) for i in range(n): a[i] = anp[i].to_float64() b[i] = bnp[i].to_float64() ‍ Let’s dissect this piece of Mojo code. First, you'll notice that we have new variable declarations let and var which may look odd at first glance since this is not familiar Python syntax. Mojo offers optional (except in some cases, more on that later) variable declarations to declare variables as immutable with let (i.e. cannot be modified after creation) or mutable with var (i.e. can be modified). There are two benefits to using variable declarations - type safety and performance. Second, you’ll also notice that the Tensor function has both square brackets and round brackets () with this format: Function[parameters](arguments) In Mojo "parameters" represent a compile-time value. In this example we’re telling the compiler, Tensor is a container for 64-bit floating point values. And arguments in Mojo represent runtime values, in this case we’re passing n=10000000 to Tensor’s constructor to instantiate a 1-dimensional array of 1 million values. Finally, in the for-loop we assign numpy array values to Mojo Tensor. We’re now ready to calculate the Euclidean distance measure in Mojo. ‍Calculating the Euclidean distance in Mojo Let’s bring our Python example over to Mojo and make a few changes to it. Below is our Mojo function for calculating Euclidean distance. Can you spot the few key differences vs. the Python function? def mojo_naive_dist(a: Tensor[DType.float64], b: Tensor[DType.float64]) -> Float64: var s: Float64 = 0.0 n = a.num_elements() for i in range(n): dist = a[i] - b[i] s += dist*dist return sqrt(s) ‍ Notice that this is very similar to our Python code, except that we’ve added types in the function arguments: a: Tensor[DType.float64], b: Tensor[DType.float64] and return type Float64. Unlike Python, Mojo is a compiled language and even though you can still use flexible types like in Python, Mojo lets you declare types so the compiler can optimize the code based on those types, and improve performance. Here DType.float64 parameter of our Tensor specifies that it contains 64-bit floating point values. Float64 return type represents a Mojo SIMD type, which is a low-level scalar value on the machine register. We also declare the variable s with the var keyword which tells the Mojo compiler that s is a mutable variable of type Float64. Now we’re ready to benchmark our Mojo code. let eval_begin = now() let naive_dist = mojo_naive_dist(a, b) let eval_end = now() print_formatter("mojo_naive_dist value", naive_dist) print_formatter("mojo_naive_dist time (ms)",Float64((eval_end - eval_begin)) / 1e6) ‍ The execution time dropped down to ~70 ms from ~790 ms in pure Python, that’s about 11x faster. However, that is still slower than Python+NumPy’s ~40 ms but pretty good without having to re-write our function in C/C++. But we’re not done yet! We’re leaving a lot of performance on the table that we can recover with a few more minor code changes. Let’s see how. #### Speeding up our Mojo🔥 code! Just like in Python, def functions in Mojo are dynamic, flexible and types are optional which makes it easier to port Python functions to Mojo. However, there are a few key differences in how arguments are processed. In Python arguments to functions are references to objects and if modified, their changes are visible outside the function. In Mojo, def functions make a copy of all arguments and this introduces an overhead when dealing with large Tensors like we are. Therefore, to speed up our code further we need to: - Pass Tensor values by reference so no copies are made - Introduce strict typing and declare all variables Here’s our updated function that addressed both (1) and (2) fn mojo_fn_dist(a: Tensor[DType.float64], b: Tensor[DType.float64]) -> Float64: var s: Float64 = 0.0 let n = a.num_elements() for i in range(n): let dist = a[i] - b[i] s += dist*dist return sqrt(s) ‍ The first change you’ll notice is that the def has been replaced by fn. In Mojo, fn functions enforce strict type checking and variable declarations. The default behavior of fn is that arguments and return values must contain types and fn arguments are immutable variables. While def allows you to write more dynamic code, fn functions can improve performance by lowering overhead of figuring out data types at runtime and helps you avoid a variety of potential runtime errors. You can read more about the difference between fn and def in the Mojo programming manual. Since all variables in fn functions have to be declared, we also declare n and dist with let and we’re ready to benchmark our updated code. let eval_begin = now() let naive_dist = mojo_fn_dist(a, b) let eval_end = now() print("=== Mojo Performance with fn, declarations and typing and ===") print_formatter("mojo_fn_dist value", naive_dist) print_formatter("mojo_fn_dist time (ms)",Float64((eval_end - eval_begin)) / 1e6) ‍ Our Mojo code execution time dropped down to ~13 ms. That’s almost 2x faster than the NumPy which is implemented in C/C++ and 60x faster than the pure Python implementation. Let’s take a look at the Python and Mojo code side by side so you can appreciate how little you had to change the code to see the performance improvements. ### Conclusion There is a lot more to discuss about Mojo. For now, I hope you found this blog post to be a quick and gentle introduction to Mojo from a Python programmer’s perspective. There are more things to try to speed up our code, including better ways to allocate memory, vectorization, multi-core parallelization, and more.  explore these topics in upcoming blog posts. The full Jupyter notebook is available on Mojo Playground – head over to the Playground and run the example yourself! Now it’s your turn! How would you improve this code? Do you have ideas for other examples? We’d love to hear from you! Join our awesome community on Discord and share your Mojo journey with us on social media. Until next time 🔥! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Shashank Prasanna AI Developer Advocate Shashank is an engineer, educator and doodler. He writes and talks about machine learning, specialized machine learning hardware (AI Accelerators) and AI Infrastructure in the cloud. He previously worked at Meta, AWS, NVIDIA, MathWorks (MATLAB) and Oracle in developer relations and marketing, product management, and software development roles and hold an M.S. in electrical engineering. ================================================================================ URL: https://www.modular.com/blog/weve-raised-100m-to-fix-ai-infrastructure-for-the-worlds-developers PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: August 24, 2023 # We’ve raised $100M to fix AI infrastructure for the world's developers Modular Team We are excited to announce that we have raised $100 million in new funding, led by General Catalyst and filled by existing investors GV (Google Ventures), SV Angel, Greylock, and Factory. This second round of funding follows our first $30 million round from last year and will enable us to supercharge our vision for the future of AI infrastructure for the world's developers. A special thank you to everyone who has helped us get to this point, including our incredible world-class team, our dedicated design partners, and our vibrant developer community and enterprise customers who believe in a better future of AI developer infrastructure. ‍Deep Nishar, Managing Director at General Catalyst, is beyond excited: ## A better AI-powered world for everyone Modular’s vision is to allow AI technology to be used by anyone, anywhere. Our next-generation AI developer platform enables our customers and the world's developers to defragment their AI technology stacks, pushing more innovations into production faster and realizing more value from their investment in AI. Our products and technologies improve the nature of AI programmability, usability, scalability, compute efficiency, and hardware utilization. And our infrastructure seamlessly integrates into our customers' environments with minimal migration cost, natively supporting multiple clouds, multiple hardware accelerators, and multiple AI frameworks out of the box. We are attacking the complexity that slows AI development today by solving the fragmentation issues that plague the AI stack, starting with where AI software meets AI hardware. ## The Modular AI Engine and Mojo 🔥 In the four months since our product keynote, the Modular community has grown to more than 120K+ developers (including tens of thousands of enterprises) who are excited to utilize our AI infrastructure stack. We have built and delivered the world's fastest unified AI engine that provides full compatibility with major AI frameworks – such as TensorFlow and PyTorch – and delivers unparalleled performance and cost savings on today’s CPUs, with support for GPUs coming in the Fall. We also built Mojo 🔥, a programming language for all AI developers that is 35,000x faster than Python. Mojo combines the usability of Python and the performance of C, bringing programmability back to AI and providing a common interface for the AI hardware landscape. And together, we expect them to unlock the next wave of AI innovations. ## Mojo 🔥: coming soon to a computer near you! We are also excited to announce the next major step forward for Mojo – the ability to download Mojo and a whole developer toolset locally to your desktop machine. The ability to run Mojo locally is the most requested feature from Mojo developers so far and will lead to increased innovation and collaboration in the Mojo developer ecosystem. We are shipping a preview of the Mojo SDK to hundreds of early adopters today, and we will release it generally to everyone in early September. Sign up to download. Looking ahead, we are committed to releasing the Mojo standard library in open source and accepting contributions before the end of the year. Sign up to our Discord, and join our GitHub community to become a Mojician 🔥. ## The future of AI is bright We founded Modular with a vision to recreate AI infrastructure for the world, with a hope that it acts as a catalyst to unlock more AI developers, more innovation, and ultimately better AI products for everyone. This is a huge and important mission, and now we have incredible resources to work towards that. We ask that you join us, use our infrastructure, and help create an incredible future with AI. Let’s change the world together! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Company - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Modular Team Company Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. ================================================================================ URL: https://www.modular.com/blog/mojo-python-calculating-and-plotting-a-valentines-day-using-mojo-and-python PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: February 15, 2024 # Mojo🔥 ♥️ Python: Calculating and plotting a Valentine’s day ♥️ using Mojo and Python Shashank Prasanna On Valentine’s Day yesterday, I wanted to create something special to celebrate my love for Mojo and Python. My search on the interwebs led me to a nifty little equation that plots a heart. The equation is quite simple and I’ll refer to this as the “heart equation” through the rest of this blog post: $f(x) = (x)^{\frac{2}{3}} - 0.9 \sqrt{3.3 - x^2} \sin(a \pi x)$ In this equation if you vary the variable a from 0 to 20 in small increments, you get this cool animation: The heart equation is fairly easy to implement in Python using NumPy, but in this blog post I'll show you how you can implement it in Mojo🔥. Mojo is still young and its standard library doesn’t yet have a robust NumPy-like data structure for implementing math equations, but with relatively low effort you can implement a custom data structure (I’ll call MojoArray in this blog post) that supports basic vectorized math operations we need, to implement the heart equation. Once we've created our MojoArray data structure, we can implement the equation and plot it using the following code: Since Mojo offers first-class support for Python interoperability, we’ll see how you can do all the computation in Mojo🔥 and leverage Python and Matplotlib library to plot the animation you see above. ### What you’ll learn: - How to create a custom Mojo🔥 data structure that lets do vectorized math operations - How to use double underscore aka dunder methods to overload math operators that make writing math equations easy - How to use Mojo standard library Math functions that operate on SIMD type and extend them to work on your data structure - How to leverage Python libraries to import NumPy arrays and plot using Matplotlib ### Creating an Array data structure that supports vectorized Math operations To implement the heart equation, I need a data structure that supports vectorized Math operations. For example, in this equation x is a vector, and I need sqrt, pow, sin, add, mul and div to operate on vectors. $f(x) = (x)^{\frac{2}{3}} - 0.9 \sqrt{3.3 - x^2} \sin(a \pi x)$ Mojo Math module in the standard library supports common mathematical operations but they operate on SIMD types only. SIMD types allow you perform a single operation on small vectors who’s length depends on the CPU type. For example, to compute sin on a SIMD vector, in Mojo you can run: Output: Which gives you very small numbers as you’d expect, since sin of approximate value of pi, is approximately 0. To implement the heart equation, we'll need to work with large vectors, therefore, we need a Mojo struct that offers methods to perform Math operations on large vectors, not just SIMD types. Mojo standard library offers a Tensor data structure that can store higher order tensors, but it is quite an overkill for this simple example. The Tensor type also doesn’t support basic Math operations which we need. With a simple, custom data structure called MojoArray, we can only implement the features we need. Here is the skeleton of the MojoArray data structure that we’ll be using to calculate our heart equation. The MojoArray data structure is parameterized on dtype which defaults to float64, which is also the default type of NumPy arrays. MojoArray struct also defines double underscore aka dunder methods that overload common mathematical operations such as addition, subtraction, multiplication to work on two MojoArrays or MojoArray and scalar values. Let’s take a closer look at the implementation details of a few of these. Most of the math operations fall into one of these categories: #### Elementwise transforms: _elemwise_transform[]() This helper function implements Trigonometric functions, and abs. that transform a MojoArray. _elemwise_transform[]() applies the function func on all the elements in the MojoArray. I use _elemwise_transform to implement sqrt, cos, sin and abs: #### Elementwise vector-scalar operations _elemwise_scalar_math[](): This helper function implements multiplication, addition, and subtraction between MojoArrays and scalars. _elemwise_array_math accepts a scalar and applies the function func on all the elements in the MojoArray. We use _elemwise_scalar_math to implement negative, addition, subtraction, and multiplication between a vectors and a scalar: #### Elementwise vector-vector operations _elemwise_array_math[]() This helper function implements multiplication, addition, and subtraction between two MojoArrays. We use _elemwise_array_math to implement addition, subtraction, and multiplication between two vectors ### Implementing the Heart Equation With our MojoArray data structure in place, we’re now ready to implement our heart equation. In the main() function, we perform the following steps: - Load Python modules NumPy and Matplotlib - Create NumPy arrays and use that to instantiate our MojoArray data structure - Implement the heart equation y = (x**2)**(1/3.) - 0.9*((3.3-(x*x)).sqrt())*(a[i]*3.14*x).sin() - Loop over values of a to create the animation I showed at the top of the blog post. ## Conclusion Happy Valentines’ week! Hope you enjoyed reading this blog post on how to implement the heart equation in Mojo. My hope is that you can reuse parts of this example in your own workflows. Download Mojo to run this example and share your feedback with us! Here are some additional resources to get started: - Get started with downloading Mojo - Head over to the docs to read the programming manual and learn about APIs - Explore the examples on GitHub - Join our Discord community - Contribute to  discussions on the Mojo GitHub - Read and subscribe to Modverse Newsletter - Read Mojo blog posts, watch developer videos and past live streams - Report feedback, including issues on our GitHub tracker Until next time🔥! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Shashank Prasanna AI Developer Advocate Shashank is an engineer, educator and doodler. He writes and talks about machine learning, specialized machine learning hardware (AI Accelerators) and AI Infrastructure in the cloud. He previously worked at Meta, AWS, NVIDIA, MathWorks (MATLAB) and Oracle in developer relations and marketing, product management, and software development roles and hold an M.S. in electrical engineering. ================================================================================ URL: https://www.modular.com/#__docusaurus_skipToContent_fallback PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: 80K+ developers building with MAX # A high-performance generative AI framework MAX replaces and simplifies your AI inference stack, maximizing performance and reducing cloud costs ## Achieve state of the art NVIDIA GPU performance Unlock state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## Optimize your existing PyTorch & ONNX models Migrate seamlessly without rewriting your AI models and pipelines on a unified AI stack. ## Use Mojo to supercharge your AI applications Extend your Python code with high-performance Mojo, a new programming language with the expressiveness of Python and the performance of C. ## Develop locally, deploy globally to any cloud. Develop your AI applications locally and package and deploy across any cloud provider, on CPUs and GPUs, without having to change your code. ## Run Gen AI locally under 3 minutes Download MAX first to run an LLM - Run Llama3-8B in your CLIGet started - Run Llama2-7B in your CLIGet started - Run Replit-3B in your CLIGet started Run Llama3-8B in your CLI Run Llama2-7B in your CLI Run Replit-3B in your CLI ## Free Forever The MAX framework is a free and open platform for you to develop and deploy AI inference workloads. A new framework for Gen AI, and the best way to deploy PyTorch Development tools for accelerated compute on GPUs and CPUs, built from the ground up for GenAI, but compatible with today. ## Developer Approved 👍 “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/about PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Build AI for anyone, anywhere. ## Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. We believe that AI is a net positive force in the world and will help transform it for the better. Our vision and mission are to reinvent AI infrastructure to advance humanity. ### We aim to push the whole world of AI forward, not just a select few companies and products. After working for years at the world’s largest technology companies, scaling the world's largest AI work loads, building the hardware that powers them, and deploying AI to billions of mobile phones and edge devices, we saw that fragmentation and technical complexity held back the impact to a privileged few. We need to rethink the current AI systems and infrastructure from first principles to make it easy for anyone to leverage AI to solve the world’s most critical problems with software that just works. Modular and composable infrastructure that simplifies AI development and deployment is what the world needs. Together, as Modulers, we are a team of the world's best AI infrastructure leaders who are reinventing and rebuilding accelerated compute for everyone. ### How it started Chris Lattner and Tim Davis met at Google and felt AI was being held back by overly complex and fragmented infrastructure. Motivated by a desire to accelerate the impact of AI on the world by lifting the industry towards production-quality AI software, they founded Modular. Leadership team Chris Lattner Co-Founder & CEO Tim Davis Co-Founder & President Adin Scannell Cloud Infrastructure Lead Eric Johnson Product Lead Joe Pamer Mojo Distinguished Engineering Lead Kalor Lewis VP, Finance Mike Edwards Operations Lead Mostafa Hagog Performance & Compiler Engineering Lead Nick Kreeger Framework Engineering Lead ## Backed by the best investors in AI Our goal is as enormous as it is profound. We’re building a different kind of company to achieve this. We have assembled the best AI software and hardware leaders, and are systematically rebuilding the AI software stack from the ground up. 👋 We’re hiring! - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] Tim Davis Co-Founder & President Repeat Entrepreneur and Product Leader. Tim helped build, found and scale large parts of Google's AI infrastructure at Google Brain and Core Systems from APIs (TensorFlow), Compilers (XLA & MLIR) and runtimes for server (CPU/GPU/TPU) and TF Lite (Mobile/Micro/Web), Android ML & NNAPI, large model infrastructure & OSS for billions of users and devices. Loves running, building and scaling products to help people, and the world. [email protected] Adin Scannell Cloud Infrastructure Lead As a hands-on technical leader, Adin is passionate about building products and technologies that challenge the status quo. He previously co-founded GridCentric which was acquired by Google, where he worked on problems at scale for nine years across Google and Google Cloud. He has spent the last two decades solving problems across the infrastructure stack — from hypervisors and operating systems to containers and security. Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] Joe Pamer Mojo Distinguished Engineering Lead Joe spent the last 8 years at Meta, where he was focused on improving the company’s AI and developer infrastructure stacks. Before that he served as Instagram’s CTO, overseeing much of Meta’s work on programming languages (mainly focused on Python, PHP, and Javascript), and co-founded its first applied ML team for infrastructure. Before joining Facebook, he helped design and develop the F#, TypeScript, and Swift programming languages, and contributed to many other developer technologies, such as Clang, Visual Studio, and VS Code. Kalor Lewis VP, Finance Kalor is Modular's VP, Finance and leads all our Finance operations. Prior to Modular, Kalor was a VP, Finance at Fivetran where he was the first finance hire in 2018 and built out the companies entire finance function. Before Fivetran, Kalor was part of Palantir Technologies, where he scaled their strategic finance function. Mike Edwards Operations Lead Mike has spent over 25 years working in the fields of IT, corporate operations, and software development - most recently at Apple. Mike volunteers his time serving as a Board member with the LLVM Foundation, focusing on finance and operations. Mike truly believes in the power of AI to help address some of the world’s greatest needs. Mostafa Hagog Performance & Compiler Engineering Lead Mostafa is a seasoned engineering leader in high-performance computing. During his tenure at NVIDIA, he served as Engineering Director and led teams to develop optimized deep learning libraries like cuDNN and CUTLASS, revolutionizing GPU-accelerated AI. At SiFive, as VP of Software, Mostafa assumed a leadership role guiding teams in the development of an MLIR/LLVM-based software stack for SiFive Intelligence & performance cores. His contributions also extend to optimizing Intel GPU hardware/software features, playing a pivotal role in developing the AVX1/2 SIMD ISA for Intel CPUs, and contributing to the GNU C Compiler. Mostafa holds a Master of Science in Electrical Engineering from the Technion, with a specialization in compiler optimizations. His unwavering passion for innovation continues to drive advancements in the field of high-performance computing. Nick Kreeger Framework Engineering Lead Software Engineering lead with over 15 years of experience working at Google, Microsoft and a handful of startups. Nick has contributed to many technologies in Machine Learning such as TensorFlow.js, TensorFlow Lite/Micro, and ONNX/ONNXRuntime. Nick enjoys spending his free time with family and enjoying the Minnesotan outdoors. ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/ PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # MAX empowers you to own & control your AI A new framework for Gen AI, and the best way to deploy PyTorch ## Unparalleled GenAI performance - Llama3 - Optimized pipelinesView on Github Llama3.pyllama 3 ../run-pipeline.🔥 llama3 --max-tokens 200 --prompt "Why the sky is blue?" --quantization-encoding q4_0 Loading tokenizer... Building model... Compiling... Executing... The sky appears blue due to a phenomenon called Rayleigh scattering... Prompt size: 10 Output size: 190 - Deploy LLMs with a single commandCheckout MAX Builds ### Llama3 - Optimized pipelines llama 3 ../run-pipeline.🔥 llama3 --max-tokens 200 --prompt "Why the sky is blue?" --quantization-encoding q4_0 Loading tokenizer... Building model... Compiling... Executing... The sky appears blue due to a phenomenon called Rayleigh scattering... Prompt size: 10 Output size: 190 ## Deploy LLMs with a single command ## The best way to deploy PyTorch - SOTA performance in just 3 lines of codeDrop in your PyTorch or ONNX models and get an instant boost in performance with our next generation inference runtime for CPUs and GPUsSee for yourself ## SOTA performance in just 3 lines of code Drop in your PyTorch or ONNX models and get an instant boost in performance with our next generation inference runtime for CPUs and GPUs ## Compatible with what you use today - Supports all your use cases and existing toolsUse the MAX APIs to build, optimize and deploy from one model to more complex GenAI pipelines on CPUs or GPUs.Supported model formats ## Supports all your use cases and existing tools Use the MAX APIs to build, optimize and deploy from one model to more complex GenAI pipelines on CPUs or GPUs. ## Build locally. Deploy easily across hardware in the cloud - Compute Abstraction for AIBuild your AI applications, package and deploy across CPUs and GPUs platforms including Apple, ARM, Intel, AMD and NVIDIA without code changes.Supported hardware - Accelerate your time to market with MAX on AWSGet help from the experts using a production grade managed service on AWSLearn more ## Compute Abstraction for AI Build your AI applications, package and deploy across CPUs and GPUs platforms including Apple, ARM, Intel, AMD and NVIDIA without code changes. ## Accelerate your time to market with MAX on AWS Get help from the experts using a production grade managed service on AWS ## Develop with Python,  Extend with Mojo🔥 - Use what you know with Python APIs in MAXUse our Python integration to interop with your existing workloads and offloads onto MAX where it mattersUsing Python with MAX - Learn how to scale your AI with MojoNo need to learn C and CUDA, use Mojo the easiest way to program CPUs and GPUs.Take a tour of Mojo🔥 ## Use what you know with Python APIs in MAX Use our Python integration to interop with your existing workloads and offloads onto MAX where it matters ## Learn how to scale your AI with Mojo No need to learn C and CUDA, use Mojo the easiest way to program CPUs and GPUs. ## What developers are saying about MAX “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/mojo/manual/ YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/cli/ YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/examples/ YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/ YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/max-pipeline-bring-your-own-model YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/deploy-aws-kubernetes YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/deploy-cloudformation-sagemaker YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/onnx-custom-op YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/run-onnx-with-python YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/graph/symbol/Symbol YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/extensibility/graph-custom-op YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#set-up-max YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/install YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/mojo/manual/basics YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/roadmap YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#build-a-hello-world-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#1-build-the-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/graph/graph/Graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/graph/graph/Graph#verify YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#2-create-inference-session-load-and-compile-the-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/max/session/InferenceSession YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/max/model/Model YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#3-execute-the-graphmodel-with-inputs YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/mojo/stdlib/tensor/tensor/ YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/max/model/Model#execute YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/max/tensor_map/TensorMap YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/max/tensor_map/TensorMap#get YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#build-a-matmul-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/graph/type/Dim YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#build-an-mnist-classifier-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#1-build-and-train-the-model-in-pytorch YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#2-build-the-inference-graph-with-max-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/graph/ops/elementwise/softmax YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#3-run-inference-and-check-accuracy YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/mojo/stdlib/algorithm/reduction/argmax YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#create-a-custom-operator-with-max-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#1-implement-the-custom-op YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/extensibility/Tensor YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/extensibility/empty_tensor YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/extensibility/Tensor#for_each YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#2-add-the-custom-op-to-the-graph YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/api/mojo/graph/ops/custom_ops/custom YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#3-verify-the-results YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#4-deploy-as-a-binary YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/tutorials/get-started-with-max-graph#next-steps YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/mojo/manual YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/changelog YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/max/mojo MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # The expressiveness of Python, 
with the performance of C Mojo installs as part of MAX - 175kMojo Developers - 23kStars on Github - 22kCommunity members 175k Mojo Developers 23k Stars on Github 22k Community members ## Mojo has powerful & easy to use features Leverage types for better performance and error checking. def sort(v: ArraySlice[Int]): for i in range(len(v)): for j in range(len(v) - i - 1): if v[j] > v[j + 1]: swap(v[j], v[j + 1]) struct MyPair: var first: Int var second: F32 def __init__(self, first: Int, second: F32): self.first = first self.second = second def reorder_and_process(owned x: HugeArray): sort(x) # Update in place give_away(x^) # Transfer ownership print(x[0]) # Error: ‘x’ moved away! def exp[dt: DType, elts: Int] (x: SIMD[dt, elts]) -> SIMD[dt, elts]: x = clamp(x, -88.3762626647, 88.37626266) k = floor(x * INV_LN2 + 0.5) r = k * NEG_LN2 + x return ldexp(_exp_taylor(r), k) def exp_buffer[dt: DType](data: ArraySlice[dt]): # Search for the best vector length alias vector_len = autotune(1, 4, 8, 16, 32) # Use it as the vectorization length vectorize[exp[dt, vector_len]](data) def sort(v: ArraySlice[Int]): for i in range(len(v)): for j in range(len(v) - i - 1): if v[j] > v[j + 1]: swap(v[j], v[j + 1]) struct MyPair: var first: Int var second: F32 def __init__(self, first: Int, second: F32): self.first = first self.second = second def reorder_and_process(owned x: HugeArray): sort(x) # Update in place give_away(x^) # Transfer ownership print(x[0]) # Error: ‘x’ moved away! def exp[dt: DType, elts: Int] (x: SIMD[dt, elts]) -> SIMD[dt, elts]: x = clamp(x, -88.3762626647, 88.37626266) k = floor(x * INV_LN2 + 0.5) r = k * NEG_LN2 + x return ldexp(_exp_taylor(r), k) def exp_buffer[dt: DType](data: ArraySlice[dt]): # Search for the best vector length alias vector_len = autotune(1, 4, 8, 16, 32) # Use it as the vectorization length vectorize[exp[dt, vector_len]](data) - Progressive types - Zero cost abstractions - Ownership + borrow checker - Portable parametric algorithms - Language integrated auto-tuning Progressive types Zero cost abstractions Ownership + borrow checker Portable parametric algorithms Language integrated auto-tuning Progressive types Zero cost abstractions Ownership + borrow checker Portable parametric algorithms Language integrated auto-tuning Extend Python or scale all the way down to the metal. Program the multitude of low-level AI hardware. No C++ or CUDA required. Using Mojo with MAX unlocks the future of accelerated compute for the world Development tools for accelerated compute on GPUs and CPUs, built from the ground up ## Mojo🔥 + MAX unlock incredible NVIDIA GPU performance Mojo with MAX enables state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## See what AI developers are building with Mojo🔥 LLM.mojo A implementation of Andrej Karpathy's llm.c to Mojo 🔥 Basalt A machine learning framework in pure Mojo 🔥 Lightbug HTTP A HTTP web framework written in pure Mojo 🔥 Endia A dynamic Array library for Scientific Computing🔥 +300 more open source projects ## Developers love Mojo 🔥 “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck Mojo destroys Python in speed. 12x faster without even trying. The future is bright! mytechnotalent “The Community is incredible and so supportive. It’s awesome to be part of.” benny.n “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Unlock Python performance Utilize the full power of the hardware, including multiple cores, vector units, and exotic accelerator units, with the world's most advanced compiler and heterogenous runtime. Achieve performance on par with C++ and CUDA without the complexity. - PythonSingle Thread Distribution - Mojo🔥Parallel processing across multiple cores ### Python Single Thread Distribution ### Mojo🔥 Parallel processing across multiple cores ## Mojo enables systems programming features so you can process information exponentially faster. 0.03s 68,000x * Algorithm Mandelbrot Instance AWS C1.xlarge Intel Xeon Read our 68,000x blog post ## Access the entire Python ecosystem Experience true interoperability with the Python ecosystem. Seamlessly intermix arbitrary libraries like Numpy and Matplotlib and your custom code with Mojo. - - Mojo 🔥 Mojo 🔥 Python def make_plot(m: Matrix): plt = Python.import_module("matplotlib.pyplot") fig = plt.figure(1, [10, 10 * yn // xn], 64) ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], False, 1) plt.imshow(image) plt.show() make_plot(compute_mandelbrot()) ## Upgrade your models to full pipelines with MAX Easily extend your models with pre and post- processing operations, or replace operations with custom ones. Take advantage of kernel fusion, graph rewrites, shape functions, and more. ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View pricing Join the community - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/mojo-vs-rust-is-mojo-faster-than-rust PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: February 12, 2024 # Mojo vs. Rust: is Mojo 🔥 faster than Rust 🦀 ? Jack Clayton Mojo is built on the latest compiler technology in MLIR, an evolution of LLVM which Rust lowers to, and so it can be faster. It depends largely on the skill of the programmer and how far they're willing to go with optimizations. Mojo's goal as a language, is to meet Python developers where they are, and allow them to learn some new tricks to optimize their code to the performance limits of any hardware. ### Blogs and Benchmarks Over the weekend, Netflix engineer and Rust advocate @ThePrimeagen released a reaction video to a community guest blog we published: Outperforming Rust ⚙️ DNA sequence parsing benchmarks by 50% with Mojo 🔥. The blog post stirred up some controversy, Rust is being positioned as a potential successor to the dominant languages in AI, which are currently Python and C++. This was @ThePrimeagen's take on Mojo vs. Rust for the future of AI programming: Following his comment, Luca Palmieri, respected Rustacean and author of Zero to Production in Rust, replied on X: ### Mojo: our goal Mojo aims to be intuitive to learn for Python developers. As Mohamed showed, he was able to learn Mojo and optimize an algorithm using SIMD in a matter of weeks as a side project. While this article is focused on performance differences, the points that @ThePrimeagen and Luca Palmieri made are important to us. We are heavily focused on AI, where a three-language problem exists, and where CPU+GPU programmability is so important across hardware. But lets not forget, the real goal of Mojo is lifting the worlds most popular AI language in Python, and empowering developers everywhere with incredible performance, hardware portability, and programmability. ### Is Mojo faster than x language? @ThePrimeagen raised an important question: Rust is known for low-level performance, how can Mojo provide better performance out of the box than Rust (and C++)? A common question when users first join the Discord is How much faster is Mojo than x language?. There are a lot of considerations surrounding any benchmark implementation, you can't use any one benchmark to say x language is faster than y language. A better question is How much overhead does Mojo introduce, compared to x?. A major goal for Mojo, is to allow you to push hardware to the limits of physics, while remaining ergonomic and familiar to Python developers. Compared to a dynamic language like Python, compiled languages allow you to remove unnecessary CPU instructions such as allocating objects to the heap, reference counting, and periodic garbage collection. Mojo takes lessons learned and best practices from C++, Rust and Swift to provide direct access to the machine without these kinds of overheads. ### Mojo vs. Rust Mojo and Rust both allow you to optimize at a lower level, but in Rust for example you can still wrap everything in Arc, Mutex, Box etc. to avoid fights with the borrow checker at the cost of performance. If you’re writing application code this might not have any significant impact, but if you’re writing a library or performance sensitive code, that overhead can add up quickly. It's up to the programmer how much they care about reducing overhead and optimizing performance. Both of the languages can use LLVM for optimized codegen, and both languages allow the use of inline assembly (but of course, no one can afford to do that) so they both have the same potential on traditional hardware right? Well sure, but the real question is: how does the performance of idiomatic/normal Mojo code compare to normal Rust code written by someone who isn’t a world expert writing in assembly for every chip, and doesn’t know all the details of how the compiler works? #### Reduced memcpy with borrow by default When a new user is learning Rust, one of the first pitfalls they run into, is that function arguments default to taking an object by moving it. This means when you pass something into a function and try to reuse it, you get a compiler error: The line with dbg! throws a compiler error, because you've moved foo into the bar function. In Rust this can also mean foo does a memcpy of the String pointer, size, and capacity. The memcpy can be optimized away by LLVM in some cases, but this doesn't always occur and is hard to predict unless you know how the Rust/LLVM compiler works. Mojo simplifies this concept for the standard use case: Mojo arguments are borrowed by default: not only is this much more gentle when learning Mojo compared to Rust, it's also more efficient due to no implicit memcpys.  If you want to get closer to Rust behavior, you can change the argument to owned: This still works! Because String implements a copy constructor, it's able to be moved into bar and leave behind a copy. Under the hood this is still passing by reference for maximum efficiency, it'll only create a copy if foo is mutated. To fully opt into the Rust default of moving an object and losing ownership, you need to use the ^ transfer operator: Now you finally get a compiler error for trying to use foo after move, you have to work much harder to fight the borrow checker in Mojo! This is the better default behavior, not only is it more efficient, it doesn't roadblock engineers from dynamic programming backgrounds. They still get the behavior they expect by default, with the best performance possible. #### No Pin requirement In Rust for a self-referential struct pointing to its own member, that data can become invalid if the object moves, as it'll be pointing to the old location in memory. This creates a complexity spike, particularly in parts of async Rust where futures need to be self-referential and store state, so you must wrap Self with Pin to guarantee it's not going to move. In Mojo, when moving an object that has an an address, you can still update any self-referential fields. So self.foo will continue to point correctly to the location of the object in memory, even in async contexts. There is a nice blog titled pin and suffering that takes you on a journey of a Rustacean 🦀 working through the implications of Pin. These are complexities that a Mojician 🪄 will never encounter. Update: In a recent blog by one of the core Rust async contributors: https://without.boats/blog/pin, they note that we previously mentioned value identity but didn't explain what it means anywhere, including in our docs. It's beyond the scope of this blog to explain the machinery of how Mojo enables self-referential objects in async contexts, but stay tuned for an upcoming deep dive on this. #### Built on state-of-the-art compiler technology Rust was started in 2006 and Swift was started in 2010, and both are primarily built on top of LLVM IR. Mojo started in 2022 and builds on MLIR, which is a more modern “next generation” compiler stack than the LLVM IR approach that Rust uses. There is a history here: our CEO Chris Lattner started LLVM in college in Dec 2000 and learned a lot from its evolution and development over the years.  He then led the development of MLIR at Google to support their TPU and other AI accelerator projects, taking that learning from LLVM IR to build the next step forward: described in this talk from 2019. Mojo is the first programming language to take advantage of all the advances in MLIR, both to produce more optimized CPU code generation, but also to support GPUs and other accelerators, and to also have much faster compile times than Rust.  This is an advantage that no other language currently provides, and it's why a lot of AI and compiler nerds are excited about Mojo 🔥. They can build their fancy abstractions for exotic hardware, while us mere mortals can take advantage of them with Pythonic syntax. #### Great SIMD ergonomics CPUs have special registers and instructions to process multiple bits of data at the same time, known as SIMD (Single Instruction, Multiple Data). But the ergonomics of writing this code has historically been very ugly and difficult to use. These special instructions have been around for many years, but most code is still not optimized for it. When someone works through the complexities and writes a portable SIMD optimized algorithm, it blows the competition out of the water, for example simd_json. Mojo's primitives are natively designed to be SIMD-first: UInt8 is actually a SIMD[DType.uint8, 1] which is a SIMD of 1 element. There is no performance overhead to represent it this way, but it allows the programmer to easily use it for SIMD optimizations. For example, you can split up text into 64 byte blocks and represent it as SIMD[DType.uint8, 64] then compare it to a single newline character, in order to find the index for every newline. Because the SIMD registers on your machine can calculate operations on 512bits of data at the same time, this will improve the performance for those operations by 64x! Or a more simple example is if you have a SIMD[DType.float64, 8](2, 4, 6, 8, 16, 32, 64, 128), you can simply multiply it by a Float64(2), improving performance by 8x on most machines compared to multiplying each element individually. LLVM (and therefore Rust) has automatic vectorization optimization passes, but they’ll never be able to reach the same level of performance as the programmer expressing exactly what they intended, because LLVM cannot change memory layout or other important details for SIMD. Mojo has been built from the ground up to take advantage of SIMD, and writing SIMD optimizations feels very close to writing normal code. #### Eager Destruction Rust was inspired by RAII (Resource Acquisition is Initialization) from C++, which means that once the object goes out of scope, the application developer doesn't have to worry about freeing the memory, the programming language takes care of it. This is a really nice paradigm, you get the ergonomics of a dynamic language, without the performance drawback of a garbage collector. Mojo takes this one step further, instead of waiting until the end scope, it frees the memory on last use of the object. This is advantageous in the field of AI, where freeing an object early can mean deallocating a GPU tensor earlier, therefore fitting a larger model in GPU RAM. This is a unique advantage for Mojo, where the programmer gets the best possible outcome without having to think about it. The Rust borrow checker originally extended the lifetime of everything to the end of its scope to match the destructor behavior, which had some confusing consequences for users. Rust added features to simplify this for developers with Non-Lexical Lifetimes. Due to Mojo’s eager destruction, we get these simplifications for free, and it aligns with how objects are actually destroyed so we don’t have confusing edge cases. Another piece of overhead is the way that Drop works in Rust. It tracks if an object should be dropped at runtime, with Drop Flags. Rust can optimize these away in some cases, but Mojo defines them away categorically to eliminate the overhead in all cases. #### Tail Call Optimization (TCO) Update: It was pointed out in community discussion that for the original examples below Mojo was optimizing away everything, while Rust has a potential bug that was causing the implementation to be much slower. The generated assembly also shows Rust is doing some form of TCO, even with heap allocated objects. I've updated the below examples and reworded this section taking these points into consideration. Because Mojo has eager destruction, MLIR and LLVM are able to perform tail call optimizations more effectively. This example compares a recursive function with a heap allocated dynamic vector in both languages. Note that this is just a simple example with as few lines of code as possible to demonstrate the difference. First run cargo new rust and edit ./rust/src/main.rs to look like this: Then run: These results are on an M2 Mac: And you can run the mojo version with a single file in the same folder, call it mojo.mojo: Then run: The compiler must ensure that destructors are called at the appropriate time, which for Rust is when a value goes out of scope. In the recursive function, the Vec has a destructor that needs to be run after each function call. This means the function's stack frame can't just be discarded or overwritten, as is required for tail call optimization. Because Mojo destructs eagerly it doesn't have this limitation, and is able to optimize for TCO more efficiently with heap allocated objects. You can get more insight to this behaviour when profiling the two programs with valgrind --tool=massif. I switched to a Linux cloud instance to run this experiment, which sent the Rust mean time to 9.067 s with 10 GB peak allocated memory, and Mojo to 1.189 s with 1.5 MB peak allocated memory! As previously noted, memory is in an important resource in AI applications, and eager destruction ensures the programmer gets optimal behaviour without having to think about it. You can try running the above bechmarks yourself. If you don't have Mojo 🔥 yet, you can install it here! ### Conclusion We all love Rust at Modular and are inspired by it, the tooling is great, and it currently has one of the best high level ergonomics for any systems programming language. But it has two major problems in the field of AI, which @ThePrimeagen pointed out: - It compiles slow, and AI is all about experimentation and rapid iteration - Most AI researchers experienced with Python won't take time to learn a new language from scratch Members of our team tried to solve this problem with "Swift for TensorFlow" at Google, which didn't catch on due to the issues mentioned with AI researchers not willing to learn a brand new, slower to compile language. We love Python/C++/Rust/Swift/Julia etc. but after over a decade of the industry hill climbing these technologies, we believe that the fresh start that Mojo embodies is the only way to make a dent in these age-old problems. Mojo already has optimal performance for systems engineers, but still has a long way to go for all the dynamic features that Python programmers expect. Rust is an excellent choice if you need to put something into production right now. If you're curious and looking towards the future, and want to be early with a language that could be instrumental to the next 50 years of AI, give Mojo a try! We'll be adding AI specific libraries to the package that comes with Mojo soon, which we're working on as the killer app to show the world what Mojo can do. Keep an eye out for MAX in the coming weeks! We'd love to see you in the Mojo community, here are some links to get you started: - Get started with downloading Mojo - Head over to the docs to read the programming manual and learn about APIs - Explore the examples on GitHub - Join our Discord community - Contribute to  discussions on the Mojo GitHub - Read and subscribe to Modverse Newsletter - Read Mojo blog posts, watch developer videos and past live streams - Report feedback, including issues on our GitHub tracker ‍ ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Jack Clayton AI Developer Advocate Jack started his career optimizing autonomous truck software for leading mining companies, including BHP and Caterpillar. Most recently he was designing computer vision software, putting AI inference pipelines into production for IDVerse. He is enormously passionate about the developer community, having been a Rust, Go, Python and C++ developer for over a decade. Jack enjoys making complicated topics simple and fun to learn, and he’s dedicated to teaching the world about Mojo 🔥. ================================================================================ URL: https://www.modular.com/blog-all?topic=Company PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Joe+Pamer PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/semantic-search-with-max-engine PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: March 21, 2024 # Semantic Search with MAX Engine Ehsan M. Kermani In the field of natural language processing (NLP), semantic search focuses on understanding the context and intent behind queries, going beyond mere keyword matching to provide more relevant and contextually appropriate results. This approach relies on advanced embedding models to convert text into high-dimensional vectors, capturing the complex semantics of language. In this blog post, we will use Amazon Multilingual Counterfactual Dataset (AMCD) which comprises sentences from Amazon customer reviews annotated for counterfactual detection (CFD) in a binary classification task. Counterfactual statements refer to hypothetical scenarios that have not occurred or are impossible to occur. Such statements are typically recognized as having the structure – If p were true, q would also be true, where both the antecedent (p) and the consequent (q) are understood or presumed to be untrue. For instance, a review stating "If this camera had a better lens, my photos would be perfect" suggests a desired improvement (a better lens) that is currently absent, impacting the outcome (perfect photos). Our classifier will employ the bge-base-en-v1.5 model within the MAX Engine which has 768 embedding dimensions. The BGE model is distinguished as one of the leading text embedding models on the MTEB leaderboard characterized by its minimal disk size of 416MB and available variants with 768 and 1024 embedding dimensions. Furthermore, we will leverage a vector database to store embeddings generated from the training dataset, simulating real-world conditions for batched inference processing. During inference, we will identify the top 10 most similar reviews (using cosine similarity) and assign probabilities to test queries. Subsequently, we will evaluate the classifier's effectiveness through metrics such as accuracy, F1 score, precision, and recall, applying a 0.5 cutoff threshold. Ultimately, we will contrast the performance of MAX Engine with PyTorch and ONNX runtime across various batch sizes, illustrating that - For small batch sizes on CPU, MAX Engine outperforms PyTorch and ONNX runtime by up to 1.6 and 2.8 times, respectively. - With large batch sizes on CPU, MAX Engine outperforms PyTorch and ONNX runtime by 2 and 1.8 times, respectively. To install MAX, please check out Get started with MAX Engine. Also have a look at Getting Started with MAX Developer Edition in case you missed it. The code for this blog post is available in our GitHub repository. The MAX version for this blog is 24.1.1 (0ab415f7). ### Dataset and input tokenizer Let’s first examine the data in Amazon Multilingual Counterfactual Dataset (AMCD) The dataframe consists of two columns: sentence (from Amazon customer review) and is_counterfactual (the label) and a total of 4018 samples. For example: Next we tokenize all the input sentences in data as follows With the inputs tokenized, we are now ready to proceed to inference and create sentence embeddings. ### MAX Engine inference In this blog post, we will utilize the ONNX version of the model, available on HuggingFace. We can obtain use the following command (ensure you have Git LFS installed) The ONNX model is located at bge-base-en-v1.5/onnx/model.onnx. Below, we create a session object and load the model into maxmodel. We also examine the input and output tensors, noting their names, shapes, and data types: The model has three input tensors — input_ids, attention_mask, and token_type_ids — and one output tensor, last_hidden_state: The model's pooling configuration file is as follows which we will use later to accurately obtain our sentence embeddings. #### Optional: Convert to ONNX using optimum Another notable option is the conversion of models to the ONNX format using the optimum package which can be done through its command-line-interface (CLI). Note that converting to ONNX offers benefits like framework interoperability across different platforms. For instance, to convert the BAAI/bge-base-en-v1.5 model to ONNX: #### Sentence embeddings To enhance efficiency, especially with large datasets, we batch the input sentences before embedding. This approach not only accelerates the processing but also helps manage memory usage more effectively. Here, in each batch we simply call maxmodel.execute and iterate on the training data until all sentences are embedded. which outputs After obtaining the embeddings, they can be utilized for various NLP tasks, such as semantic similarity, clustering, or as input features for machine learning models. In the next section, we will store them in a vector database for semantic search. ### Using a Vector Database Vector databases excel in managing and querying high-dimensional data, making them ideal for storing embeddings. We chose ChromaDB which is an embedded vector database and is known for its efficiency and straightforward usage, particularly fitting for small to medium-sized applications. ChromaDB stands out due to its fast querying capabilities and lightweight nature. To start, we create a client and a collection to store our embeddings as follows #### Search in Vector Database collection To demonstrate the practical application, we query the database using a test sentence. After tokenizing this sentence and generating its embedding, we search the vector database for the most similar entries, using cosine similarity to identify and return the top 10 most similar items. Cosine similarity is particularly effective for embeddings because it focuses on the orientation of vectors rather than their magnitude. Finally, we assign a probability by normalizing the count of positive is_counterfactual results from the top 10 queries, leveraging cosine similarity. which outputs #### Assess test accuracy, F1-score, precision and recall We evaluate our model on a test dataset using common metrics. - Accuracy provides a general sense of performance - F1-score balances precision and recall - Precision measures the model's exactness and - Recall assesses its completeness which outputs ### Comparing MAX Engine performance against PyTorch eager and ONNX runtime Recall that to efficiently compute all sentence embeddings, we processed them in batches, using a batch size of 128. This batching is particularly important in data intensive scenarios for optimizing resource utilization and processing speed. Consequently, we aim to compare the performance of MAX Engine against PyTorch and ONNX runtime across various batch sizes to understand their respective efficiencies in handling batched data. To make a compelling comparison between MAX Engine, PyTorch and ONNX runtime, we meticulously selected a range of batch sizes and for better visualization, we divided them up into two categories of - smaller batch sizes: 1 up to 32 and - larger batch sizes: 64 up to 4096 These wide arrays allow us to observe the performance scalability and efficiency of each framework under different load conditions. The runtime for each batch size is measured, offering a clear picture of how each framework handles varying volumes of data. This evaluation is crucial for developers and engineers to make informed decisions about the tools and frameworks best suited for their specific NLP tasks, especially in resource-intensive scenarios such as working with large datasets. For completeness, runtime measurements were done on an AWS c5.12xlarge instance. Now we use the PyTorch, ONNX model and MAX Engine model individually and plot their performance. This analysis revealed that for smaller batch sizes (1 up to 32), MAX Engine can be up to 1.6 times faster than PyTorch and is up to 2.8 times faster than ONNX runtime for batch inference. And for larger batch sizes (64 up to 4096), MAX Engine can be up to 2 and 1.8 times faster than PyTorch and ONNX runtime, respectively. This is showcasing MAX Engine efficiency in handling high-volume data processing tasks. which shows ### Conclusion We have illustrated the application of MAX Engine with a pre-trained model for counterfactual binary classification, demonstrating the process of storing embeddings in a vector database suited for inference. Furthermore, our comparison between MAX Engine and PyTorch across various batch sizes has revealed that MAX Engine can achieve up to 1.6 and 2.8 times the speed up against PyTorch and ONNX runtime for varying small batch sizes when running on a CPU, and is 2 and 1.8 times faster against PyTorch and ONNX runtime on large batch sizes, respectively. This efficiency gain highlights MAX Engine's potential to significantly enhance processing speed and resource utilization in large-scale NLP tasks. Additional resources: - Get started with downloading MAX - Download and run MAX examples on GitHub - Head over to the MAX docs to learn more about MAX Engine APIs and Mojo programming manual - Join our Discord community - Contribute to discussions on the Mojo and MAX GitHub Report feedback, including issues on our Mojo and MAX GitHub tracker. Until next time!🔥 ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Ehsan M. Kermani AI DevRel Ehsan is a Seasoned Machine Learning Engineer with a decade of experience and a rich background in Mathematics and Computer Science. His expertise lies in the development of cutting-edge Machine Learning and Deep Learning systems ranging from Natural Language Processing, Computer Vision, Generative AI and LLMs, Time Series Forecasting and Anomaly Detection while ensuring proper MLOps practices are in-place. Beyond his technical skills, he is very passionate about demystifying complex concepts by creating high-quality and engaging content. His goal is to empower and inspire the developer community through clear, accessible communication and innovative problem-solving. Ehsan lives in Vancouver, Canada. ================================================================================ URL: https://www.modular.com/blog/getting-started-with-max-developer-edition PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: February 29, 2024 # Getting started with MAX Developer Edition Shashank Prasanna Today we’re thrilled to announce that MAX Developer Edition is now available in preview for developers worldwide! 🥳🎉. In this developer blog post, we'll take an in-depth look at MAX, its key features and capabilities, and how to use it to deploy your first MAX optimized model. Using code examples we’ll illustrate its benefits, cover key concepts, and share additional resources to continue your MAX journey. Before we get started, head over to the MAX documentation page, and follow the instructions to install MAX Developer Edition preview. If you’re looking for a deeper discussion on why we built MAX, what problems it addresses, read our announcement blog post. If you are a Mojo🔥developer and want to learn more about the future of Mojo and MAX together, we have another blog post for you: MAX is here! What does that mean for Mojo🔥? Roll up your developer sleeves and let’s jump 🦘right into MAX! ### MAX Developer Edition (DE) preview MAX is an integrated, composable suite of products that simplify your AI infrastructure and gives you everything you need to deploy low-latency, high-throughput inference pipelines into production. MAX meets AI developers where they are. It doesn't require a complete overhaul of your AI pipeline or serving infrastructure; it seamlessly integrates with your existing code, enabling you to benefit immediately and take advantage of new features gradually. There are a few different ways to get started with MAX: - Try it with your existing models: MAX offers Python and C APIs to replace your current PyTorch, TensorFlow, or ONNX inference calls with MAX Engine. With 3 lines of code you can optimize and execute your models up to 5x faster across a variety of CPU platforms (Intel, AMD, Graviton). Additionally, use MAX Serving as a drop-in replacement for your NVIDIA Triton Inference Server. - Extend and optimize your AI pipelines: MAX is fully extensible with Mojo🔥 - enabling AI developers to innovate faster and unlock new avenues of performance through custom logic. Mojo’s high performance enables you to accelerate your custom preprocessing, post-processing and data logic with a familiar Pythonic code.  - Supercharge your advanced AI workloads: MAX offers a new Graph API enabling advanced users to author complete graphs. MAX Graphs are hardware agnostic which means it is easy to get high-performance inference due to whole graph-level optimization on a wide range of hardware, including ones we’re yet to see. We’ll be releasing Enterprise Edition in the near future, sign up to be notified. ### Using the MAX Developer Edition The first release of MAX: MAX Developer Edition 24.1, comes with everything you need to build and deploy high-performance AI pipelines. Mojo is now bundled with the MAX SDK and we’ve simplified the versioning of Mojo to match the MAX version, which follows a YY.MAJOR.MINOR version scheme. Because this is our first release in 2024, that marks this version 24.1. We dive deeper into the rationale behind the decision in a dedicated blog post: MAX is here! What does that mean for Mojo🔥? MAX Developer Edition 24.1 includes: - New MAX Engine: A state-of-the-art graph compiler and runtime library that compiles and executes models from TensorFlow, PyTorch, ONNX, and MAX Graphs to deliver high performance, low-latency inference speed on Intel, AMD, ARM CPUs. Reduced precision inference and GPU support are coming soon. - New MAX Serving: A serving solution for MAX Engine that provides full interoperability with existing AI serving systems (such as Triton) and that seamlessly deploys within existing container infrastructure (such as Kubernetes). You can use pre-built Docker container images or build your own with custom inference pipelines - Latest release of Mojo: A massive update to the world's first programming language purpose-built for AI. Mojo seamlessly integrates with MAX Engine enabling AI developers to author high-performance inference pipelines with custom pre/post-processing steps, and model architectures using MAX Graphs API. Mojo brings the MAX platform together to deliver unparalleled performance and programmability for any hardware. Here is how they all fit together. We’ll dive deeper into each component in the next section. This initial release of the MAX SDK supports Ubuntu 20.04/22.04 LTS on Intel and AMD x86-64 CPUs, and AWS Graviton3 CPU ARM CPUs. We will expand to additional operating systems, hardware, and tool features in upcoming releases. To install MAX SDK head over to the install instructions in the MAX documentation. ### MAX Engine MAX Engine consists of the MAX compiler and runtime library, and Python, C and Mojo APIs to interact with it. It also comes with the max CLI convenience tool that makes it easy to benchmark models and visualize graphs. To help you get started with MAX, we’ve added a number of getting started examples on GitHub, which you can get access by cloning the MAX examples repository: To run a simple benchmark run: Running MAX Engine inference on roberta model on an Amazon EC2 c6i.4xlarge instance is 2.94x faster than TensorFlow and 1.74x faster than PyTorch, right out of the box! To run more examples you can use the convenience console.py script in the examples directory script To run a simple benchmark run: To learn how the examples are written or modify it to adapt it for your workflows, head over to the relative paths for each script shown in the console table. You can also use the max CLI tool to run benchmarks on your models and visualize models using the netron app. ### MAX Engine APIs MAX Engine supports APIs for Python, C and Mojo enabling you to integrate MAX Engine compiler and inference runtime into a variety of applications. The APIs are very simple and straightforward to use. For example, MAX Engine Python API is only 3 lines of code to optimize the model: And 1 line of code to execute it: Let’s plug these 4 lines of code into an end-to-end example which downloads a ResNet50 model using Keras, saves it and runs it using MAX Engine, and prints the results. We’ll classify an image of a turtle that’s already in the MAX examples repository that we cloned earlier. You can find same script on GitHub. Output: As you can see, using the MAX Engine API is very straightforward and blends in with your existing workflows. You can similarly use Mojo API for even more flexibility and higher-performance when integrating with authoring pre-/post processing and data loading steps in Mojo. Take a look at the stable diffusion example implemented end-to-end using the MAX Engine and Mojo where the text encode, image decoder and image diffuser models are executed with MAX Engine along with a high-performance tokenizer written in Mojo. You can take this further and optimize end-to-end graphs in MAX Engine by using the MAX Graph API as we’ll see in the next section. ### MAX Graph APIs MAX Graph APIs enable you to define end-to-end models, pre-processing and post-processing steps as part of a graph using predefined operators. With no other dependencies, the entire graph will be executed directly by the MAX Engine for improved runtime performance. MAX Graphs are completely portable and don’t need to be rewritten for different hardware. MAX Graphs are lazily-executed and graph operations can’t be called eagerly, they have to be compiled using MAX Engine to be executed. MAX examples repository has an example of llama2.🔥 implementation using MAX Graph APIs. Let’s take a look at what the Graph API looks like for a very basic graph: In the code above, we first initialize the graph called basic_add with two int32 Tensor (TypeTuple(MOTensor(DType.int32), MOTensor(DType.int32))) and one return arguments of Type Tensor (MOTensor(DType.int32)). The graph contains a single operator called mo.add which we define using the g.op() function. It also takes in the two input Tensors to add and return the result. Visit the Graph API documentation page to learn more. ### MAX Serving MAX Serving is a deployment solution for MAX Engine that works as a drop-in replacement for your existing server-side inferencing runtime. It doesn't require any changes to your client programs. It implements KServe APIs so you can continue sending inference requests to the cloud with the same APIs you already use. We’ve created a Docker container that includes MAX Serving (Triton and MAX Engine), which you can either download and run, or build yourself from a Dockerfile. Let’s take a look at how you can easily test your models in a serving environment. Note: Currently, MAX Serving is available only for local development, as part of the MAX Developer Edition. It is not currently licensed for production deployment, but that's coming soon in the Enterprise Edition. Building on top of our earlier example, let’s prepare our resnet50 model for deployment. Create model-repository directory and copy over the saved model directory to model-repository > resnet50 > 1 > resnet50_saved_model. The directory structure should look like this: Using the pre-build Docker container image provided you can easily deploy your model with MAX Serving using the following script which includes the model-repository directory name and the specific model we want to deploy. You can find the script below on GitHub. Once the Docker container is running, you can send inference requests from an HTTP/gRPC client via tritonclient, Now run the following script to submit inference requests and get results back. You can find this script on GitHub. Output: You can see that the results match our example in the MAX Engine section. In this case, the request went over the network to the serving framework, through the MAX Engine runtime, and round-trip back to the client. MAX Serving container in the Developer Edition is a great way to test your end-to-end serving workflows. ### What’s new in Mojo SDK v24.1? #### MAX 🤝 Mojo With the release of MAX Developer Edition, Mojo is now included as part of the MAX SDK. In preparing the MAX release, we recognized the pivotal role Mojo plays in MAX in authoring high-performance inference pipelines. Consequently, we opted to bundle Mojo within the MAX package for a few reasons. - Improved User Experience (UX): A single package for MAX and Mojo, eliminating version mismatches or complexities. - Seamless Integration: Mojo is intricately woven into MAX Engine APIs and maintaining identical versions of MAX and Mojo ensures seamless integration and functionality. - Streamlined Version Management: By consolidating MAX and Mojo into a unified package, we avoid the need for users to manage multiple versions independently. Both follow a YY.MAJOR.MINOR version scheme. This also simplifies our software delivery process. This doesn’t change the way you use Mojo today or moving forward. Read more about our reasoning behind this change in our blog post: MAX is here! What does that mean for Mojo🔥? Today’s release of Mojo SDK v24.1 includes a slew of exciting features in the core language and standard library. We’ll do a dedicated blog post diving deep into a list of new features, changes and bug fixes, in the meantime check out the changelog. Below we’ll call out a few exciting additions to the Mojo developer experience. #### Mojo debugging support is here! The official extension on the Visual Studio Marketplace already supports a number of developer productivity features such as syntax highlighting, diagnostics, fixits, definitions, references, code completion and more. Starting today, debugging support is now officially part of that list! You can now get interactive debugging experience in Visual Studio Code and via the LLDB command line interface. Mojo’s debugger is able to seamlessly debug hybrid Mojo/C/C++ code in the same debug session, empowering developers even further when working with highly specialized code. Learn more about Mojo Debugging in the documentation. #### New Mojo Playground Experience We launched Mojo Playground, a hosted set of Mojo-supported Jupyter notebooks, on May 2nd 2023 when we first announced Mojo to the world. Since then, we’ve released a downloadable Mojo SDK for Mac and Linux, used by thousands of developers worldwide. We’re excited to announce that the playground is now more tightly integrated into the documentation experience. Head over to MAX documentation > Mojo > Playground to experience the evolution of Mojo playground. Note: We will be turning down the Mojo Playground (based on Jupyter) on March 20th, 2024. If you have any notebooks you would like to save, please download them with the File→Download option we provided in the playground. ### MAX ♥️ Modverse Community Since our launch of Mojo🔥programming language last year in May 2023, our developer community has grown to more than 170k members worldwide. We’re thrilled to see all the exciting projects by Mogicians🪄worldwide. And can’t wait to see what amazing things the Modverse community will build with MAX DE. Since releasing Mojo SDK to developers in September 2023, it has been downloaded 55K times, and the Modverse community on Discord has grown to over 21 thousand members from more than 150 countries. We’re ever grateful for the amazing Mojo champions Aydyn, Lukas, Kent, Mitchell, and Maxim for dedicating their time, and the select group of community members for beta testing MAX DE and helping us iron out those rough edges. We want to express sincere thanks to every member of our community for your support, feedback, enthusiasm, and commitment. 🙏 ### Onward and upward: MAX throttle 🚀 MAX Engine and Mojo unlock possibilities never seen before in AI and we are thrilled to see what you’ll build with MAX! Download MAX Developer Edition today! The entire team at Modular is hard at work continuing to build MAX and add features and platform support you’re looking for. We want to be transparent with our priorities and you can see our upcoming priorities and roadmap here Mac and Windows users, we ♥️ you, stay tuned! For enterprise developers, a commercially-licensed Enterprise Edition is in the works. The Enterprise Edition will allow you to seamlessly test and deploy the same MAX components you've downloaded in the Developer Edition into a production environment. If this is you, reach out to us! Finally, join us on our upcoming Modular Community Livestream: MAX DE Edition on Thursday, March 7th at 11 AM PT! Attend to learn more about MAX DE and get your questions answered directly from Modular engineers. We’re just getting started! Here are other ways to learn more and get involved: - Get started with downloading MAX - Download and run MAX examples on GitHub - Head over to the MAX docs to learn more about MAX Engine APIs and Mojo programming manual - Join our Discord community - Contribute to discussions on the Mojo and MAX GitHub - Report feedback, including issues on our MAX and Mojo GitHub tracker ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Developer - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Shashank Prasanna AI Developer Advocate Shashank is an engineer, educator and doodler. He writes and talks about machine learning, specialized machine learning hardware (AI Accelerators) and AI Infrastructure in the cloud. He previously worked at Meta, AWS, NVIDIA, MathWorks (MATLAB) and Oracle in developer relations and marketing, product management, and software development roles and hold an M.S. in electrical engineering. ================================================================================ URL: https://www.modular.com/careers#open-roles PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Join us in building the future of AI Watch Video ## We want to enable AI to be used by anyone, anywhere. Our ambitions are enormous, but working here will feel very familiar. You can change the world without giving up your life ## Why Modular? Grow with the best Build with some of the industry's best AI leaders. Maximize how you work We will always push the limits to create the best possible environment for our people and teams. Read how we work. Build AI for the world Build a next-generation developer platform, with production quality infrastructure, for the world. Have fun, live life Regular team onsites, local meetups & fun, strong team collaboration and more. ## Work and life, balanced. 🩺 Leading medical, dental & vision packages 💵 Strong compensation & equity packages 🍼 Generous maternity & paternity leave 📈 401K Plan 🌎 Work wherever you want 🏝️ Unlimited Vacation & PTO 🥳 Corporate perks & epic team fun ## Current Job Openings Come and be part of a world-class team that is rebuilding AI for everyone. We welcome applications from all backgrounds and communities. Engineering (0) Text Location ## What you expect from the interview Modular has a straight-forward interview process and a large majority of the roles follow the same steps: Step 01 ### Application Review The first step of the process is to submit your resume. We aim to review all resumes within 2 weeks and we respond to every single application made. Step 02 ### Call with Recruiting Typically you will first have a short 20-30min call with recruiting to just go over some basic information about you and the company, and to discuss next steps. Step 03 ### Call with Hiring Manager The Hiring Manager will dig a bit deeper into your background and previous experience to determine mutual fit. This will also be your opportunity to learn more about what the team is working on and what the role entails. In case you have applied for more than one role on different teams, we often schedule you for two separate calls with two separate Hiring Managers. Step 04 ### Team Interviews There are typically 4 team interviews, usually 45-60 minutes each. These may be scheduled all at once or separately, depending on the role. The focus areas for these team interviews vary by role. For example, for Engineering roles, you can expect coding and system design type interviews; for Product roles, we often talk about the industry and product strategy. For Leadership roles, we may ask for a presentation.We believe that team culture is a critical part of a great company, so every candidate also has a Culture interview that focuses on communication skills, team work, and so on.  We will let you know what to expect in each interview when we send you a schedule confirmation. Step 05 ### Founder Interviews We aim to put all finalists in touch with at least one of our co-founders before a final decision. This would allow you as a candidate to speak directly to Chris and/or Tim, and get answers to any final important questions you may have. Step 06 ### Offer If we make you an offer, we share an extensive offer deck for you and schedule a walk-through call to go over the information in detail and again answer any final questions you may have. We also aim to give you enough time to make a decision after that. ## Why should you be excited about Modular? “I picked modular because of the people and what they believe in and what they want to do. I want to be a part of something that makes a difference for the better.” Paige Bedwell Program Manager “The team is incredible. They're very smart. They're experts in their field, and we're solving the hardest computational problems in the world.” Abdul Dakkak AI Compiler Engineer “The best part of working here is a strong commitment to culture. I work on the most challenging problems, have the freedom to do it anywhere, and have a huge impact on AI.” Eric Johnson Product Lead ## Frequently asked questions Are interviews conducted in-person? Typically of our interviews are conducted over Zoom video. For coding interviews, we use Coderpad and you will receive a link from your interviewer. In some cases we may fly you in to meet some of our leaders for the last interview. What do you look for in a candidate? There is no “one size fits all” answer here however Modulers are passionate about their work, intellectually curious, humble, and ready to roll up their sleeves. We like to have discussions in interviews and expect you to ask clarifying questions and talk us through your thought process — sometimes there is no right or wrong answer, we just want to understand how you think and work through challenging problems. We also look for strong alignment with Modular’s Culture and values. I don’t meet all of the requirements for a role, can I still be considered? We would love to receive your application even if it doesn’t meet all criteria! We review applications with all roles and opportunities in mind. Sometimes we may reach out to you to offer or suggest another role or team that might be a better fit for you, or we offer to keep your application on file and reach out a few months down the line once more suitable opportunities open up. How long does the interview process take? On average it takes candidates about 4 weeks to go through the full interview process however if you require a decision by a certain date, please speak to your recruiter. Do you offer internships? We want to ensure that our interns have an outstanding experience, which includes a well-defined project and goals, meaningful and impactful work, and strong and attentive mentorship. As we are still a small team, we are not ready to offer internships at this time but we will be sure to update the website as soon as it changes! Do you provide visa assistance? Yes, we offer premium processing for our H1-B transfer candidates. We can also sponsor H1-B or offer other relevant visa application assistance to eligible candidates. Do you provide Green Card assistance? Yes, we also offer Green Card application assistance to eligible candidates, just speak to your recruiter for more details. Do you provide relocation assistance? As we are a remote-first company, we generally do not relocate candidates except new graduates who are moving away from campus. If Modular asks you to relocate, we will also provide you with a relocation stipend. Are there any opportunities for professional development? Modular is growing rapidly so there are a variety of growth opportunities available — whether that’s moving into a TL role, management, or a lateral transfer to a different team. We provide our managers with training to walk you through your career planning, and we have a well-defined but lightweight performance review process that ensures your career goals are discussed at a regular cadence. I applied some time ago but haven’t heard back? We aim to respond to every single candidate, and if you have applied to more than one role, we process all of your applications separately. Sometimes these emails end up in spam, so please check your spam folder. If you haven’t heard from us, you can contact your recruiter or [email protected] to follow up. Will you provide feedback if I am rejected? We sincerely appreciate the time it takes to interview, so we always provide some feedback as to why your application did not work out if we have spoken to you. If you have not heard from us within 2 weeks after your last call, please follow up with your recruiter. What benefits do you offer? Modular offers some world-class benefits for all employees. Our benefit package changes over time, and may depend on your specific location, but US-based employees can expect benefits that include: - A variety of fantastic health benefits (health, dental, vision insurance; life insurance etc) are available. - A 401k plan with up to 5% match. - Access to Passport Corporate Discount Program, LinkedIn Learning, and free tax advice on Carta. - Generous work-from-home stipend of $1500 to help you improve your home office. - Unlimited paid time off and flexible work hours. Who we are - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/career-post?4329795005&gh_jid=4329795005 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: CAREERS / # - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/zac-bowling YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/swetha-muniraju YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Zac+Bowling PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Swetha+Muniraju PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/the-case-for-a-next-generation-ai-developer-platform PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 30, 2022 # The Case for a Next-Generation AI Developer Platform Chris Lattner Tim Davis Eric Johnson ### AI promised to profoundly change the world, so why hasn’t it? From healthcare to manufacturing, finance, climate, communication, and travel, to how we live and work. AI can help solve any problem that can be represented by data, assuming the right algorithms and enough computational resources. Today we have all the ingredients to realize the benefits of AI. More data is being generated through billions of phones and IoT devices than ever before in human history, and we have near unlimited storage and compute access in the cloud. Meanwhile AI hardware has made enormous improvements in the cost and performance of raw compute, and the rate of AI research papers published yearly is now vastly superlinear. Despite the promise and initial successes of AI, it has yet to impactfully penetrate our lives – we don’t have widespread autonomous cars and buses, preventive medicine still relies on doctor’s visits and stethoscopes, drug discovery remains a speculative investment game, global food security is unsolved, farming still relies largely on hard human labor, and real robotic automation at home is still for the Jetsons. Instead, we are getting more targeted advertising, better social media recommendations, cute AR glasses, predictive credit scoring, and “smart” speakers. These successes may be ubiquitous, but they are also far from realizing the full potential we see coming out of ML research on a daily basis. AI is a triumvirate of data, algorithms, and hardware, and we are rich in all three - so why isn’t it getting fully utilized? The reason may not be apparent to many, because the truth is deeper than the stream of AI research updates coming from the world’s largest tech companies (MAGMA aka Big Tech) and the press. ### If AI is so important, why is its software so bad? AI software is fundamentally broken because it was designed to be used by the full stack researchers, engineers and architects that built the technology in the first place – it was never built as a product. This software was built by Big Tech companies to solve their own problems, and now the rest of the world runs on “trickle down infrastructure”. The consequence of this is that only the largest and most business-impactful uses of AI get built and deployed in practice, and even then, only if your needs align well with the in-house needs of Big Tech companies. Why is this? AI software today is monolithic and research quality, fractured into technology silos that follow the organization chart of the Big Tech companies who built it. It was created by researchers to do research, and the quick evolution of AI has left no time to pause and build it right. Instead we've just piled on more and more layers of complexity over time, resulting in an industry that is struggling to maintain and scale fragmented custom tool chains that differ between research and production, training and deployment, server and edge. AI systems have become a vast sea of incompatible technologies that only the largest and most sophisticated companies can brute force to achieve their goals. ### Isn’t Big Tech going to solve the world’s AI problem for us? The successes at deploying AI come from teams who amassed talented armies of AI researchers and developers. Big Tech uses their vast compute and financial resources to further the priorities of their products and core business, including their own clouds, phones, social networks, and AI hardware. Despite their incredible contributions to the field, it doesn’t make business sense for Big Tech to lift AI for the world (spanning all hardware, clouds, and ML frameworks), and the rest of the world cannot expect them to do so. This unfortunate truth imposes an industry-limiting ceiling on the rest of the world’s ability to use this technology to fight problems outside the Big Tech focus areas, including some of the most significant socioeconomic and environmental problems the world faces. That's not a future we choose to accept. These companies make incredible contributions to the progression of AI, but for AI to reach its full potential, we need an independent company that doesn’t prioritize its own hardware, its own cloud infrastructure, its own mobile phones, or its own research. We need a neutral company that does what is in the best interest of users and companies around the world. We need to incorporate the learnings from the rapid growth in AI software into a next-generation of technology that is designed for usability and generality, for all organizations in all problem domains. Today, the most pressing problem facing companies who aren’t Big Tech is the ability to productionize AI within performance, cost, time, and talent bounds. Their opportunity cost means innovations not making it to market, inferior product experiences, and ultimately a negative impact on their bottom line. But for society as a whole, this means a longer timeline to solving some of the world’s most critical problems with AI. We don’t have the time to wait for trickle-down AI software from the world’s largest companies. AI can change the world, but only once fragmentation has been repaired and the global AI developer community can take high quality infrastructure for granted, rather than fighting to get the infrastructure to work. ### If not Big Tech, who will solve this for the world? Modular is building a next-generation AI developer platform focused on usability, velocity, and flexibility. Our platform unifies popular AI framework front-ends via common interfaces, and enhances access and portability to a wide range of hardware backends and cloud environments. We are rebuilding core developer workflow tooling to be more expressive, usable, debuggable, reliable, performant, and scalable. Our tools can be easily adopted into existing workflows without rearchitecting or rewriting your code, meeting you where you are today and enabling you to realize improved productivity and performance improvements at lower cost. We will accelerate AI value capture and lower time to market for our customers. But we’re not content with the status quo. We believe that the full potential of AI will be realized when it can permeate applications in a fine-grained way - AI shouldn’t be something you need to shape your application around. Our platform is built of layered, composable infrastructure components that can be remixed and extended to enable a wide-variety of use cases, while also allowing domain experts to innovate without needing to know how the whole system works. We have seen first-hand how a layered and composable approach can unlock new use cases that haven’t been imagined. To truly fix AI infrastructure, we are both solving “hard tech” problems (like compilers for exotic heterogeneous compute technologies) as well as building seamless end-to-end developer workflows. To achieve this, our team is made up of the software architects, engineers, and product leaders who have already built world leading developer platforms and the current generation of AI frameworks. We have listened to thousands of users and developers across many years, felt the pain ourselves, and are deeply focused on building products users love. ### What does this new world look like? Our success means global developers will be empowered by access to AI software that is truly usable, portable, and scalable. A world where developers without unlimited budgets or access to top talent can be just as efficient as the world’s largest technology giants, where the efficiency and total cost of ownership of AI hardware are optimized, where organizations can easily plug in custom ASICs for their use cases, where deploying to the edge is as easy as deploying to a server, where organizations can use any AI framework that best suits their needs, and where AI programs seamlessly scale across hardware so that deploying the latest AI research into production “just works”. We see an AI industry that isn’t dependent on the timeline and capabilities that the top Big Tech companies decide they need. We see an industry that moves even faster and is less fragmented. We see an industry where innovation thrives at all levels of the stack, allowing developers to focus on bringing new innovations to market in their domains of expertise, and to build a better future for all of us. We see an industry with high velocity, lifting us from the “Era of AI Research” to the “Era of Production AI”. That’s a world worth fighting for and a world we can look back on and be proud of. That’s the world Modular is creating, and the time to do it is now. A better future starts today, and we are assembling the best talent on the planet to do it. We are proud to have raised $30M from GV, Greylock, Factory, SV Angel and notable angels who are backing us - investors who understand AI infrastructure deeper than anyone and recognize its importance to the world. Join us in building a Modular AI platform for the World. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Company - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] Tim Davis Co-Founder & President Repeat Entrepreneur and Product Leader. Tim helped build, found and scale large parts of Google's AI infrastructure at Google Brain and Core Systems from APIs (TensorFlow), Compilers (XLA & MLIR) and runtimes for server (CPU/GPU/TPU) and TF Lite (Mobile/Micro/Web), Android ML & NNAPI, large model infrastructure & OSS for billions of users and devices. Loves running, building and scaling products to help people, and the world. [email protected] Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] ================================================================================ URL: https://www.modular.com/blog/the-future-of-ai-depends-on-modularity PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: April 26, 2022 # The future of AI depends on Modularity Chris Lattner Tim Davis Platforms like TensorFlow, PyTorch, and CUDA do not focus on modularity - there, we said it! They are sprawling technologies with thousands of evolving interdependent pieces that have grown organically into complicated structures over time. AI software developers must deal with this sprawl while deploying workloads to server, mobile devices, microcontrollers, and web browsers using multiple hardware platforms and accelerators. The existing monolithic systems mentioned above are not easily extensible or generalizable outside of their initial domain target, which has forced hardware makers to build their own technology stacks. The consequence is a hugely fragmented AI deployment industry with dozens of toolchains that carry different tradeoffs and limitations. More importantly, these design patterns have also slowed the pace of innovation by being less usable, less portable, and harder to scale. We have seen and contributed to AI projects that touch the human and natural world in profound ways - whether to save the Great Barrier Reef, help people find their rhythm, or teaching people to dance. Unfortunately we’ve also seen that the technical complexity of building and deploying these applications is still too high. Deploying AI remains the domain of full stack experts, and cutting edge applications are only accessible to people at the biggest tech companies that built the ML technologies themselves. Imagine a world where ML research truly flows rapidly and effectively into production from a large global community. One where these breakthroughs are more accessible to everyone, allowing product innovators to drastically improve our daily lives and be freed from the chains of software and hardware complexity. In this world, AI would be more usable, more portable, more accessible, more scalable, and would enable a much bigger community to massively impact our health, the environment, recreation, finance, manufacturing, and commerce, among many other industries. We don’t think so. The software industry goes through cycles, and we’ve seen and solved problems like this before. ## Flash back to software in the 1990’s The software world in the 1990’s had fragmentation problems similar to what we see today with AI. At the time, C and C++ had established communities, but were fragmented across dozens of proprietary compilers. Each had vendor extensions, rough edges, strange corner cases, and incomplete implementations. It was so difficult to build cross-platform software that tools sprung up to help developers cope with the fragmentation, making it easier to install, build, and configure software (e.g., autoconf). We were saved by the rise of GCC, which became massively successful throughout the 90’s by virtue of its cross-platform support, good performance, and stability, and by being free. GCC’s success drove a wave of consolidation in the tools industry, and the resulting defragmentation enabled a wave of new innovations by making its capabilities the de-facto standard. It catalyzed a revolution both in software (directly contributing to the rapid rise of OSS communities like Linux) and hardware (enabling innovation in instruction set architectures and new business models) by freeing the former from fragmented C/C++ implementations, and the latter from having to chase rapidly evolving C/C++ language standards. While the computing world owes a debt of gratitude to GCC, it had some architectural challenges. GCC followed the classical parser, optimizer, code generator architecture used by all modern compilers, but it was intentionally designed as a monolithic batch compiler system, and GCC’s leadership resisted attempts to improve modularity and design, a continued source of friction in the community. ## The rise of Modularity It took time for the world to notice, but the year 2000 was a seminal moment in compilers and programming languages: it was the start of the LLVM project. Twenty-two years later, LLVM/Clang powers much of the world's computation - it is now widely adopted across iOS, Android, Google, Meta, and many other companies and systems. However, one might wonder how this happened: LLVM/Clang uses the standard “parser, optimizer, and code generator” approach (similar to its predecessors), it doesn’t have breakthrough code generation algorithms, and other systems eventually followed the early innovations like “whole program optimization”. LLVM succeeded despite merely being “on par” with existing compilers on traditional C/C++ workloads. The innovative aspect of LLVM is its software architecture: LLVM is designed as a collection of composable libraries. These libraries have defined interfaces that allow them to be composed and extended in innovative ways. They may be built into large-scale software projects or remixed for very small applications (e.g., domain-specific Just-In-Time compilers). Modularity and clear interfaces encourage testability, which contributes to higher quality implementations. Modularity and separation of concerns allow domain experts to work on large-scale projects without knowing how the whole system works. In a 2011 retrospective, modularity was cited as enabling the LLVM community to scale, leading to new developer tooling like clang-format, and unlocking innovative programming languages (Rust, Julia, Swift and more). These were technically possible before, but they actually happened because of the usability and hackability of LLVM. Modularity design enabled next-generation Just-In-Time accelerator programming models like OpenCL and CUDA. This drove the next wave of consolidation in compiler technology, which is why LLVM now underlies most CPU, GPU, and AI systems today. The most exciting contribution of LLVM is that it unlocked new use-cases that weren’t planned from the beginning. AI wasn’t part of its original design, nor was it designed for Snowflake to use in their database query optimizer. The dual to this observation is that many of these use cases would never have happened without LLVM (or something like it) available: a database team isn’t likely to build a JIT compiler for query optimization if they have to start by creating an X86 code generator from scratch. ## AI Infrastructure in 2022 Today we can see great strides in the AI industry. For example, we have data scientists around the world training models on 100+ PetaFLOP supercomputers from a Jupyter notebook. That said, end-to-end deployment of those models is still far from being “democratized.” The tools used to deploy AI models today are strikingly similar to compilers and tools in the 1990’s and 2000’s. We see severe fragmentation across these systems, with a wide variety of hardware, each having bespoke tools. The world’s biggest tech companies have built multiple in-house toolchains specific to different hardware products over the years, and these are often incompatible and share little code. How many flaky converters and translators does one industry really need? Many in the industry believe that these issues are due to the inherent nature of AI, but we know this is because AI infrastructure is still in its infancy. AI is already having such an incredible impact on the world, but we have to wonder: How much bigger could the impact of ML be if we had the opportunity to rebuild it the right way? ## The world deserves Modular AI We have learned so much from the development of AI infrastructure and tools over the last ten years. The industry has made great strides, and much that was once research is now well understood. It is now time to incorporate the lessons learned into a single layered and composable system that integrates the best-known technologies from across the industry. It must not require an expensive rewrite, re-architecting, or re-basing of user code. It must be natively multi-framework, multi-cloud, and multi-hardware. It needs to combine the best performance and efficiency with the best usability. This is the only way to reduce fragmentation and unlock the next generation of hardware, data, and algorithmic innovations. This is a huge and important task. Achieving this requires extraordinary collaboration across a team of architects, engineers, and leaders who built many of the existing systems, and who are driving the state of the art forward. It requires focus, discipline, and a commitment to technical excellence - a value system that incentivizes building things the right way. It requires the strength to say “not yet” to many interesting projects, allowing us to ensure we get the fundamentals right. Our goal is to create a world where AI is more useful, more accessible, more portable, more scalable and enables developers everywhere to positively impact the world in untold ways. In this world, more time is spent on using AI to solve problems, rather than wrestling with a fragmented set of low-quality tools and infrastructure. This is the world we seek to create. We are building the future of AI and our vision is to enable AI to be used by anyone, anywhere. Welcome to Modular. ‍ ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Company - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] Tim Davis Co-Founder & President Repeat Entrepreneur and Product Leader. Tim helped build, found and scale large parts of Google's AI infrastructure at Google Brain and Core Systems from APIs (TensorFlow), Compilers (XLA & MLIR) and runtimes for server (CPU/GPU/TPU) and TF Lite (Mobile/Micro/Web), Android ML & NNAPI, large model infrastructure & OSS for billions of users and devices. Loves running, building and scaling products to help people, and the world. [email protected] ================================================================================ URL: https://www.modular.com/blog/increasing-development-velocity-of-giant-ai-models-part-2 PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: November 10, 2022 # Part 2: Increasing development velocity of giant AI models Abdul Dakkak Eric Johnson This is part two of a two-part series on how we are fixing the compilation stack for developing with large models. Read part one here. Subscribe to our newsletter to get future posts delivered to your inbox! ### A quick recap In our last post, we highlighted multiple requirements we needed to satisfy large model development. A brief recap of these is below: - Only allocating when necessary: It is more efficient to memory map large data (like weights) from disk, allowing the operating system to page in data on demand.‍ - No hashing or uniquing: Checking equality of 2 gigabytes isn’t something we should ever be doing; weights should be identified by name instead of being implicitly uniqued by content.‍ - Enabling in-place mutation: If there is only one user of the data, we should be able to quantize, transform and manipulate data in place instead of making a copy of it first.‍ - Destruction: The data we are working with is huge, and we need to deallocate it when the last reference to the data is destroyed.‍ - Fast serialization: Whether JITing, searching optimization parameters, or just iterating locally, we cache IR for many reasons, and it should be fast. ### Fixing the weight attributes The first four requirements address one fundamental problem with how we've been using MLIR: weights are constant data, but shouldn't be managed like other MLIR attributes. Until now, we've been trying to place a square peg into a round hole, creating a lot of wasted space that's costing us development velocity (and, therefore, money for users of the tools). We decided we needed to manage this weight data differently than other types of attributes. This prompted our first fundamental extension to MLIR, "Resources," a mechanism to separate data from its references within the computation. Each blob of serialized MLIR may now contain additional sections, known as “resource” sections. These sections either include “dialect” resources (a dialect is essentially a namespace-like abstraction used when extending MLIR) or “external” resources (for toolchain-specific data). The data within these sections is represented using a simple key-value pairing, creating a json-like structure, like so: /// Here we have some MLIR operations. module { func.func @foo() { // Cool stuff here ... } } /// Here we have an `external_resources` section. The resource section's syntax is designed to be unique as to not conflict with other MLIR syntax (which is user extensible!). {-# external_resources: { mlir_reproducer: { pipeline: "func.func(cse,canonicalize),inline", disable_threading: true } } #-} The above example shows how we’ve adapted MLIR to use resources for reproducers. An MLIR reproducer is effectively a configuration containing execution information, such as what transformation pipeline to execute, and is used to reproduce a failure or crash. Before resources, we represented this information using a comment at the top of an MLIR file. Instead, using resources, we have now incorporated it as a first-class piece of information. To store weights we can now use the resource section to hold the big data blob that used to be unique and immortalized. In the IR, we shift to using light-weight references for attributes instead of the underlying data: Encoding resources this way also brings some secondary benefits: - Printing IR for debugging is less error-prone, leading to a better development experience: Resources are specialized sections; we don’t have to worry about accidentally dumping 4 gigabytes to the screen while debugging something.‍ - We can soundly process the IR without the data present: With the IR only holding references to the data and not the data itself, we can omit the underlying resource data if desired. For example, this greatly simplifies reproducers that don’t need the big weight data (consider sending a colleague a 20-megabyte file instead of a 1.2-gigabyte file). By introducing resources as a new concept, we’ve finally been able to build a clean separation between program and data. Now we never pass our weight data directly to an attribute. Instead, we pass a weak reference to the attribute and pass the data to a specialized manager. With this, we now have much more control over when and how weights are allocated, mutated, and destroyed. ### A new binary encoding for MLIR With a better representation of our weights, the only thing we needed now was a more efficient method of storing these weights when serializing our MLIR representation. Until this point, MLIR only had a textual serialization format, which used ASCII hex strings for its weight representation. However, our end goal was to have our local development flow be as fast as possible. To do that, it became clear that we needed to remove text and add a proper binary format to MLIR. Binary formats require a lot of consideration, especially as they often form the basis for stability in compilers. For MLIR, extra layers of trickery are needed given that we need to be efficient for our use cases (which can be different depending on who you ask), we want to be fast, and because MLIR/LLVM cannot add dependencies on third party encoding libraries. One nice aspect of MLIR, though, is that its generality makes it nearly trivial to encode. All operations in MLIR have the same structure, so every operation uses the same encoding. Most of the complexity is making sure that our few core concepts are compact and very efficient. Given these constraints, we decided to use a custom encoding. ### What is the user impact? In the end, adding resources and a binary encoding to MLIR has made our toolchain and development workflow significantly faster and reduced our memory usage substantially - making our performance and velocity incredible. It’s also made everything about MLIR better — more on that later. To validate this, we tested our changes across models of various sizes, measuring the speed of a real-life lowering and optimization pipeline in our MLIR-based graph compiler (from a TensorFlow serialized model to the input format of our runtime) and the memory used during that process. Speed: Compilation Workflow MLIR is now significantly faster. Going from a serialized TensorFlow model (from a checkout of TensorFlow 2.10) to our runtime input format, a process that involves many transformations of the underlying program representation, was ~1.8-2x faster in terms of wall clock time than before, with speed scaling consistently across the various model sizes. Diving a bit deeper, the TF serialized model processing is now basically instant — all our time is spent writing the big-weight data to disk when generating the MLIR. In fact, the actual time spent in our code is about 10x faster than before. Most of the time is now bounded by the speed at which the SSD writes >1 gigabyte of data to disk. For ML developers using our tools this means faster model compilation, thereby improving productivity and iteration time. This has benefits for production environments as well when loading (and compiling) models. For example, when dynamically loading and unloading models based on incoming traffic — e.g., use cases with many of personalized/fine-tuned user models. Speed: Serialization Also faster is serialization due to the introduction of a binary encoding. Interacting with MLIR via external tools depends on the reading and writing of serialized MLIR — whether for introspection, caching, reproducer generation, etc. Again, we tested serialization performance across various model sizes and saw a significant speed-up, peak performance being SSD bound. More specifically, reading textual data for larger models took ~5 seconds compared to <10ms for reading binary. And writing was > ~5x faster for binary than textual formats. For Modular, this enables us to develop infrastructure and tooling around MLIR that would otherwise be prohibitively slow or expensive. For example, this would allow us to provide an efficient debugger that relies on caching model representations throughout the compilation workflow, improving the underlying compiler performance, and much much more. Memory Usage Finally, the mmap capabilities of our binary serialization and the separation of IR and data via resources have also significantly reduced memory consumption. Across all model sizes, we are using less memory during the compilation process. Where before we had to allocate the relative size of the weights in a model, we no longer have to allocate at all for the weights, meaning we save significant memory every time we compile. ### Building for everyone At Modular, we intend to lift the AI ecosystem for everyone, not just ourselves. The improvements we’ve discussed, both the new resource representation and the binary encoding, have been contributed upstream to the LLVM/MLIR repository. And while we were inspired to make these improvements to MLIR to solve our customer’s problems and improve our internal infrastructure, the impact of these changes isn’t limited to just our use cases — it will enhance other products using MLIR as a foundational technology. For example, because of this work, the MLIR community is now discussing MLIR stability guarantees. Ultimately though, the value of these contributions, and the evolution of these foundational technologies, flow directly into the products we build for our customers. These contributions represent a small look into the vast number of core improvements we are making. Whether working with large models or deploying on-device, Modular is building and is actively working to make all of AI infrastructure significantly more performant and easier to use than anything else in existence today. Lastly, we are so excited about the future of AI, the LLVM community, MLIR and our contributions from the earliest days - that we made the decision to become a Platinum Sponsor of LLVM to continue to support and grow the LLVM community for many years to come. If you are an experienced  developer in AI infrastructure or a MLIR practitioner, you should definitely consider joining Modular. If you like AI and enjoy using great tools, please subscribe to our newsletter. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Abdul Dakkak AI Compiler Engineer Expert in machine learning, compilers, programming languages, and accelerated computing. Before Modular, Abdul led the development of AI compilers for GPUs at Microsoft Research and the Mathematica Compiler at Wolfram Research. Abdul has developed open-source tools for accelerating real-world applications to optimize their performance across the hardware and software stack. Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] ================================================================================ URL: https://www.modular.com/blog/if-ai-serving-tech-cant-solve-todays-problems-how-do-we-scale-into-the-future PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: December 8, 2022 # If AI serving tech can’t solve today’s problems, how do we scale into the future? Eric Johnson Tim Davis ## The AI Serving Substrate The technological progress that has been made in AI over the last ten years is breathtaking — from AlexNet in 2012 to the recent release of ChatGPT, which has taken large foundational models and conversational AI to another level. These incredible research innovations have shown the immense potential of AI to impact everything from healthcare to manufacturing, finance, climate, communication, and travel, to how we interact with the world around us. AI can help solve any problem represented by data, assuming suitable algorithms and enough computational resources. However, what often goes unsaid through the myriad of excitement and press around these research innovations is the challenge of practically deploying them. To realize the full potential to improve human lives, they need to permeate through the applications we use daily — they can’t live solely in the deep pockets of AI research institutes and Big Tech. In this post, we discuss how deficiencies in existing serving technologies make the deployment of AI models to cloud server environments challenging. Today's real-world AI applications require a production team to build, maintain and evolve their own AI Serving Substrate. These substrates typically include machine learning frameworks like TensorFlow, PyTorch, ONNX Runtime and TensorRT, AI serving frameworks like TensorFlow Serving, TorchServe, or Nvidia’s Triton Inference Server, and containerization and orchestration technologies like Docker and Kubernetes. In doing so, they strive to support user demand and meet or improve on requirements for cost, throughput, latency, and model predictive or generated content quality — all while avoiding hardware lock-in and maintaining cloud optionality. Achieving these goals is difficult because the current generation of serving substrates are usually custom in-house designs assembled with duct tape from many uncooperative components. This negatively impacts deployment velocity when new kinds of models need to be deployed, leads to reliability problems scaling these complicated ad-hoc systems, and prevents the use of the latest features needed by the most advanced models. As a result, these systems get replaced every few years as requirements change and model architectures evolve. At Modular, we have productized huge AI workloads and delivered them to billions of users, and we have replaced numerous serving substrates along the way. Let’s look at some of the problems that need to be addressed to solve this once and for all. ## What does a modern AI Cloud application look like? Modern cloud applications are complex distributed systems orchestrating data-flows across several independent micro-services and components — sometimes spanning both cloud and edge. These distributed applications evolved to need a serving substrate that is responsible for scaling and managing them. Let’s look at a typical application stack, like automatic speech recognition (ASR) in the cloud, and explore some of the root causes of the problems we have faced. ## The many challenges in production AI serving Modern AI system have evolved to include many problems that go beyond a simple serving binary. ### The complexity of integrating multiple AI frameworks A key source of complexity stems from the challenges serving multiple machine learning frameworks (TensorFlow, PyTorch, JAX, ONNX). Production teams are often asked to provide a unified system in order to be agile and responsive to the needs of research teams. The typical solution is to layer on top of multiple frameworks, and use a “lowest-common-denominator” wrapper for the underlying runtimes.  Unfortunately, this typically prevents the use of the most powerful and differentiating features that those frameworks provide. Another problem is that implementation details such as execution environment (remote vs. local) and communication protocol (gRPC vs. HTTP transport) are leaked to the application developer. As a result, developers typically need to directly manage crucial functional and performance aspects such as fault-tolerance and load-balancing instead of the serving API abstracting these implementation details away. This is all made worse by the monolithic nature of machine learning frameworks, which are difficult to integrate, have large and complicated dependencies, and think they should own all the resources on a given machine. ### Overly simplified systems have hidden ceilings Many AI serving substrates provide a simplified API for orchestrating the many components in the system, but are often very limited and can be very slow.  The challenge occurs when your application becomes successful and you need to start scaling it. These stacks frequently run into reliability problems, fail to scale to larger deployments, do not deliver the latency and throughput requirements needed by the application, and cannot integrate with more advanced use-cases described below. The appeal of a simple stack quickly loses its charm when you find you need to rewrite your stack to a much more complicated (but also more powerful) substrate. ### Challenges multiplexing applications onto shared resources At scale, production cloud environments host multiple applications that each have their own AI models. Different models have varying compute and memory requirements, different traffic patterns, and latency and throughput needs - depending on the context of the application. Further, models typically have multiple versioned variants in production for A/B testing new algorithms and to support safe and incremental model update rollouts without disrupting production traffic. These factors combine to create complexity for cloud application developers and their production release and management operations. These challenges are inherent to our domain, but existing systems do little to help - they push the pain onto DevOps and MLOps teams which drives the need for bespoke serving substrates. These substrates must manage model storage and caching, retrieve model features, load-balance and route model inference requests, proactively auto-scale serving capacity across cloud regions, scale with model and data parallelism, implement monitoring and logging, and respond to dynamically changing traffic volumes. Production teams often have amazing engineers who can tackle and solve these problems, but doing so is often not the highest priority of the team or the best ROI for their time. ### Large AI models create new challenges for scale & reliability Giant AI models have been growing at an astonishing rate in terms of their size and prevalence across domains (NLP, Vision, Speech, Multimodal AI tasks, etc). While large transformers are wildly popular, other model architectures like Mixture-of-Experts (MoE) and Recommender models (which have a large number of sparse features and embeddings) can also have 100s of billions of parameters. Individual commodity cloud machines lack the memory and float point compute capacity to run these models by themselves. Distributing these models across multiple machines can help, but the existing substrates are typically bespoke implementations that only work for select model architectures and hardware targets. One small deviation from the supported models and execution environments can require significant rewrites or switching to a new serving substrate. This is a huge problem for organizations that favor fast iteration and high-velocity research. The reliability of large models is another under-recognized concern, given the distributed serving systems are typically based on frameworks like Message Passing Interface (MPI). MPI and similar systems are designed for reliable High Performance Computing environments, and lack fault tolerance to software, network, and machine failures — this don’t work well on commodity cloud environments where such failures are common. Furthermore, they don’t support the elasticity needs (scaling the number of workers) that one would expect in a typical scalable cloud environment. ### Challenges managing cost and project-level spend when delivering value The performance of an AI application in production has far more to it than meeting a specific QPS number, throughput or latency threshold. It must also be manageable as the design changes and the workloads evolve, and costs needs to be tied back to the operations teams responsible for a workload. Most of the challenges come from poor integration of the components in the serving substrate, and gaps in system level performance observability. Today’s serving substrates emit some basic metrics like request volume, latency, and device compute utilization, but fail to provide an integrated resource utilization view that covers fixed and variable memory usage, and utilization of key I/O data-paths (Network, PCIe, Disks, etc.). They also don't provide an integrated diagnostic view of end-to-end inference performance to enable pinpointing bottlenecks and unlocking cost and performance optimizations. Finally, the top-line metrics of actual occupancy and utilization rates of allocated compute resources and provisioned compute capacity are not tracked even though they are the dominant factor in operational costs. It is difficult to see how to really address this while the fundamental components of the substrate are disaggregated and so uncooperative with each other. ## Unlock AI serving for the future Developers need to be able to integrate AI into performance-sensitive production applications with zero friction and serve AI reliably and cost-effectively at scale. We’ve seen the power of large models, but that can only benefit the world if they can be deployed cost-effectively and reliably — and they’ll keep getting bigger and more complicated. An AI serving substrate that addresses these pain points will dramatically improve the value-to-cost ratio for AI adoption in cloud applications. Modular is tackling the hardest problems in AI infrastructure because we believe solving these will unlock the power of AI in ways that no one else can. We encourage you to apply for our open roles if you are passionate about these problems and driving the next wave of innovation in AI. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] Tim Davis Co-Founder & President Repeat Entrepreneur and Product Leader. Tim helped build, found and scale large parts of Google's AI infrastructure at Google Brain and Core Systems from APIs (TensorFlow), Compilers (XLA & MLIR) and runtimes for server (CPU/GPU/TPU) and TF Lite (Mobile/Micro/Web), Android ML & NNAPI, large model infrastructure & OSS for billions of users and devices. Loves running, building and scaling products to help people, and the world. [email protected] ================================================================================ URL: https://www.modular.com/blog/the-worlds-fastest-unified-matrix-multiplication PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: April 20, 2023 # The world's fastest unified matrix multiplication Abdul Dakkak Chad Jarvis Eric Johnson Hengjie Wang Ian Tramble ## "Matmul", a microcosm of AI performance In our previous blog post, we described why AI needs to solve its compute fragmentation problem to reach its full potential and how matrix multiplication ("matmul") exemplifies why this remains an unsolved problem. In this post, we describe Modular’s approach to solving this problem and its game-changing benefits, including a new standard in state-of-the-art (SOTA) performance on CPU as compared to existing solutions. Before we get there, however, let’s recap where existing implementations fall short and why building a generalizable solution is so difficult. Remember, the AI industry today is bound by hardware performance and memory capacity. The result has been the development of a plethora of diverse, parallel hardware architectures and supporting highly-optimized kernel libraries by hardware vendors. The problem for AI developers is that these kernel libraries are monolithic “point solutions” that each support only a small subset of the industry's hardware and use cases. They are often written in assembly to maximize performance, but as a result, they sacrifice composability, hackability, and portability to multiple hardware architectures. And they are large in code size due to their need to specialize on specific shapes and data types. ## A novel approach Capitalizing on years of experience building AI infrastructure that has scaled to billions of users, Modular has invented a new & novel approach to solve this industry-wide problem. To do so, we took a complete first-principles rethink of the entire stack, and built something that is truly differentiated and unique in the industry today. Instead of following a traditional approach of writing hard-coded kernels or a matmul compiler, we built a much more general and extensible technology that combines the best features of both approaches. This technology enables kernel authors to quickly develop high-performance kernels that span shapes, layouts, data types, and hardware architectures. Our event on May 2 (you should tune in!) and a future blog post will talk more about how our technology works, while this post focuses on the benefits and contributions of our approach. ### Unification starts with a single source of truth If you dig into the source code for libraries such as OneDNN, you find many implementations of matmul – each hard-coded and specialized for different use cases. You’ll find one for each data type (FP16, F32, F64, Int8), various memory layouts (transposed or non-transposed), special aspect ratios (square or tall-and-skinny), various instruction set features, and more. These fragmented point solutions make it difficult for engineers to improve the library for all possible use cases because there is too much code. This also leads to problems for users because these libraries take up a lot of disk space, swelling containers and distributions. For example, OneDNN is 51MB, MKL is 14MB, and cuBLAS is 150MB. Modular combines what would typically be many bespoke hardware-specific implementations into a “Single Source of Truth.” As a result, expert kernel authors can build a single composable, extensible, and portable code base across architectures and use cases. And this approach enables rapid reuse of patterns and code, applicability to optimized sub-variants of problems, and easy adoption of exotic hardware features in special cases. The Modular implementation of matrix multiplication is typically less than 100kb of machine code, which makes it practical to use in many different use cases, including mobile, web, and IoT. ### Performance portability Implementing a performant matmul for any individual chip is challenging, as we discussed in the previous post. The challenge is compounded, however, by the adoption of heterogeneous hardware in the AI industry, including various flavors of CPUs, GPUs, TPUs, and so much more. Yet, today’s kernel libraries only natively support a very limited number of target architectures. For example, while OneDNN supports ARM cores, it is implemented as a wrapper around ARM’s own hardware-specific software library, ARM Compute Library (ACL). Meanwhile, OneDNN is not optimized for AMD, which has its own fork of OneDNN called ZenDNN, which leverages AMD’s Advanced Compute Library (AOCL). Mobile is another can of worms, where libraries such as Google’s Ruy are often used. All these bespoke libraries pose a significant problem for AI frameworks and, ultimately, for the users of those frameworks. Frameworks get fragmented with different variants and forks, and users must mix and match different versions with different bugs and tradeoffs. This can introduce a big gap between theoretical performance and achieved performance because users often don’t know (or don’t want to know!) about this level of software. At Modular, we love all the world’s hardware, and the generality of our approach extends well to many kinds of architectures. This allows us to provide a unified solution that defragments the framework software above the kernels. This also makes it much faster to implement high-performance support for new hardware types, with a comparably tiny engineering team and significantly less cost. ### Dynamism Some systems use kernels that are compiled “just in time” (JIT) or “ahead of time” (AOT) by advanced AI compilers, including Google’s XLA, Apache TVM, and OneDNN Graph. These generate kernels specialized for specific matrix sizes. This reduces the code size of the distribution but still requires many kernels to exist at execution time. Other libraries, such as MKL, special case individual matrix sizes in their kernel library that popular models use. These challenges have become even more problematic given the rise of dynamic language models like BERT (and countless large language models, segmentation models, object detection, and so on!), which need to work on inputs (text or images) of arbitrary size. The challenge is that the system only knows the input size at inference time, not at model training or compilation time. Systems based on static shapes require padding the input or swapping many versions of a model specialized for different sizes, often leading to low performance, large code size, and model management frustration.  Some systems try to solve this with JIT code generation, but this introduces problems with unpredictably long tail latencies. The Modular approach completely eliminates these problems by fully supporting dynamism. Modular’s matrix multiplication and other kernels are fully dynamic shape friendly (without JIT or AOT specialization) and support other forms of dynamism (e.g., irregular control flow, unusual data types, etc.) that many existing systems struggle with. This delivers a much simpler and more predictable system overall. ### Composability In a neural network, a matmul is seldom performed in isolation. Typically, there are other operations (e.g., activation functions or elementwise operations) that are done before and after it. It is well known that “fusing” the code for these other operations into the matmul can produce significant performance benefits by improving memory locality and reducing dispatch overhead. There are two common approaches to address this problem – providing a limited number of pre-fused special cases or providing a domain-specific compiler to perform fusion. The first approach is the best known and is widely used by both TensorFlow and PyTorch, as well as many other specialized frameworks (ONNXRuntime, TFLite, TensorRT, etc.). This approach is very powerful and flexible because researchers and domain experts who are not compiler engineers can extend the system. The challenge is that there are a vast number of potential combinations of operators (this is one of the reasons why TensorFlow and PyTorch have thousands of kernels!). Hand-fusing these operators further exacerbates the code size and maintainability problems discussed above. The second approach provides a different point in the tradeoffs space – AI compilers like OneDNN graph, XLA, and NVFuser provide a wide range of kernel fusions without having to special case them all. Unfortunately, they force you to choose from a small fixed operator set without extensibility. Also, while novel fusion can provide great benefits, these compilers often don’t meet the performance of traditional human-authored fused kernel libraries. The Modular approach provides both benefits – it supports generalized fusions with a wide range of operators without having to manually write and maintain variants. More importantly, the Modular approach allows generality and extensibility without having to recompile the system and without having to be a compiler engineer. We think it will enable major new research avenues and applications by experts who may not know compiler internals. ## Unparalleled performance While flexibility, generality, and usability sound great, they aren’t worth anything if they come at the expense of performance. Performance costs directly drive operational costs, and all businesses want to be more efficient. We’re excited to share some of our early results on CPU (GPUs are coming soon!), even though they are just the beginning for the Modular system, and we have a lot of work left to do. For our analysis, we decided to look at a range of comparable systems available today in AWS, specifically Intel Skylake (c5.4xlarge), AMD Zen-2 (c5a.4xlarge), and Amazon Graviton 2 (c6g.4xlarge). This shows two completely different instruction sets (Intel and AMD are X86-64, Graviton is ARM Aarch64) with three major vector designs (AVX-512, AVX2, and NEON, respectively) and at three different vector lengths (512-, 256-, and 128-bits long). We measure the Modular approach against the best-known SOTA libraries on the corresponding systems – MKL and OneDNN on Intel, AOCL on AMD (the underlying library for ZenDNN), and ACL and Ruy on ARM. We also include Eigen because it is a widely used kernel library that has been ported to many architectures. We use the latest version of each of these at the time of writing – specifically, we use MKL v2023.1.0, OneDNN v2023.1.0, Eigen v3.4, AOCL v4.0, ACL v23.02.1, and Ruy (pulled from main #363f252). ### Methodology For our evaluation, we followed the same benchmarking methodology as Google Benchmark, where each benchmark is first warmed up and repeatedly run until 2 seconds have elapsed. For libraries that require extra setup, we perform the setup outside the main benchmarking loop. To avoid interference and increase stability, we ensure that each benchmark invocation gets a cold cache each time and disable hyperthreading to improve benchmark stability. While the modular implementation does support pre-packing, not all of the libraries we are evaluating support it. As such, to maintain fairness we do not benchmark our implementation with pre-packing enabled. We note, we have benchmarked our prepacked implementation against libraries that support prepacking and are competitive with them. As we discussed in our previous post, matrix multiplication is used for a wide variety of use cases. For this study, we decided to measure ourselves against the most important shapes in the AI industry, which are most likely to have been optimized by existing libraries. As such, we selected matrix shapes mined from popular AI models such as BERT (with sequence lengths of 128 and 256), GPT, and DLRM. The shapes listed are in the MxNxK form, where the left-hand side operand of matmul has a size of MxK, and the right-hand side has a size of KxN. The shapes are ordered by their importance to the end-to-end model execution. Finally, while there are many interesting data types like Int4, FP8, and bfloat16, we wanted to keep things simple and comparable. The Modular system can, of course, support any and all types out there, but for this analysis, we focus on FP32, which is widely used and tuned by each implementation we reference. ### Performance results With this in mind, we start by looking at the single-threaded performance on the Intel Skylake (c5.4xlarge) system. Single-threaded performance doesn’t utilize the entire chip but helps normalize results (i.e., removing higher-order factors like multi-processing, false sharing, NUMA issues, etc.). Beyond that, it forms the foundation of multi-threaded performance and is essential for certain use cases in mobile and game engines. The figure below shows the performance in GigaFLOPs per second (GFLOP/s) of the Modular approach and other SOTA implementations for the Intel system – MKL, OneDNN, and Eigen. The Modular matmul implementation achieves performance that is on par or better than SOTA existing solutions. In fact, we are roughly 1.5 times faster than OneDNN on this Intel system. While the single-threaded performance is a useful datapoint, full multi-threaded performance is what typically matters for server use cases. This also puts much more stress on the machine, as a full peak implementation can run into limitations like peak FLOP/s, DRAM bandwidth, cache utilization, etc. Below we show Modular’s performance against these systems – Modular is 1.46 times faster than OneDNN, which is a remarkable achievement given the generality and other benefits we discussed before. While strong results on one hardware platform are important, a fundamental value proposition of the Modular implementation is that a single source of truth can deliver high performance across a wide range of hardware. Let’s look at Modular’s performance on AMD hardware, when compared to the AOCL library (which is the SOTA on AMD and is the backbone of ZenDNN) and the OneDNN library we saw above. Looking at the graph below, you can see that the performance of OneDNN does not translate to AMD hardware, and while the AOCL library provides significant uplifts, the Modular approach is approximately 1.6 times faster than SOTA on the AMD system. We also performed the same experiment on the Amazon Graviton 2 system, this time including the Ruy and ACL libraries. Ruy is the library used by edge frameworks such as TensorFlow Lite, and ACL is the backbone of the OneDNN support for ARM. Even though ACL and Ruy are both competitive on ARM, the Modular implementation achieves significantly better performance on average – 1.8 times better than ACL and 1.2 times better than Ruy. In addition to comparing different implementations of matrix multiplication on a given system, it is also interesting to cross-compare the absolute performance of these different systems. These are very complicated machines with a lot of moving parts, but we can look at things at a coarse grain. The Intel system benefits from having 512-bit long vectors instead of shorter 256- or 128-bit vectors. The Graviton 2 system performs well despite a shorter 128-bit vector because it has 16 physical cores, compared to the 8 physical cores on the Intel and AMD systems. ### Kernel fusion aware Finally, to demonstrate the composability of the implementation, we will look at how matmul can be fused with other operations. We want to compare against common operations that other implementations have highly tuned, so we use a “fully connected” (FC) block, defined by the equation "activation(matmul(A, B)+bias)," where activation is an activation function (we use Relu below). Libraries such as OneDNN have fused paths for the FC block, and to make the results fair, we do not compare against libraries that do not provide a way to define the FC block in a fusible fashion. Therefore, in this analysis, we only compare against OneDNN and Eigen, since they provide a way to express the fusion patterns. For consistency of presentation, we use the same shapes and three hardware configurations as above. Below we can see the performance of the FC block on the Intel Skylake architecture. Despite the generality and flexibility of the Modular approach, it sets a new SOTA, outperforming OneDNN by 1.45 times and Eigen by 1.8 times on average. We see similar strong results on the AMD system, where the Modular approach delivers a 2.1 times performance advantage over OneDNN and 2.3 times performance improvement over Eigen. The Amazon Graviton 2 system is a significantly different architecture, and the Modular stack is not as tuned as it is for X86-64. Still, even here, we can see that Modular delivers a 1.3 times performance improvement over Eigen and 1.1 times over Ruy. OneDNN/ACL does not provide a fused FC layer for ARM systems. As we can see from the data above, kernel fusion can provide significant performance uplifts when implemented right, and the benefits are even more significant as the fusion region grows. Modular’s approach was built to embrace fusion from the beginning, which allows it to support a very general set of fusions (i.e. far beyond elementwise operations, and not limited to matmul). We think that that delivering a single source of truth implementation that is performance portable, dynamic, and composable is a key contribution that will enable new research and production use cases. ## What’s next While we are excited about our performance results, the most important thing about them is that we can achieve them without compromising on our original goals and that these are just the beginning! The Modular matmul has a single source of truth, and supports many different architectures, dynamic shapes, and extensible fusions. Beyond delivering many “today” benefits to our users, the generality of our architecture allows us to radically simplify the stack above, produce a more predictable user experience and enable rapid bring-up of new hardware in a way that people haven’t experienced before. It is also worthwhile to emphasize that today’s existing SOTA implementations are the product of decades of research and development by many incredibly talented engineers. Modular has a talented but comparatively small team and has been able to deliver strong results quickly because of key technology advances in our stack. But even more than that - it’s also the result of a first-principles rethink and a willingness to truly invest in a “rebuild from the bottom-up” approach that Modular was founded on. This is all part of our broader vision to enable AI to be used by anyone, anywhere, and enable AI to truly impact the world in a more meaningful and useful way. By building and creating novel approaches to AI infrastructure, we imagine a world where we can help push forward the entire industry to enable it to develop and deploy AI systems faster, more efficiently, safer, and ultimately be more accessible to the whole world. We hope to empower the entire hardware industry to build new and novel compute architectures that drive hardware innovation forward through software. While we show matmul performance in this blog post, we have applied the same methodology across the stack. Tune in to the launch to see how these improvements translate to end-to-end performance and the technology that enables this. We are excited to explain more about how it works soon. Sign up for our upcoming May 2, 2023 launch event at Modular.com to learn more. Additionally, Modular is growing its exceptional team – if you are interested in building and driving forward the state of the art of AI infrastructure, please check out the posts on our careers page. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Abdul Dakkak AI Compiler Engineer Expert in machine learning, compilers, programming languages, and accelerated computing. Before Modular, Abdul led the development of AI compilers for GPUs at Microsoft Research and the Mathematica Compiler at Wolfram Research. Abdul has developed open-source tools for accelerating real-world applications to optimize their performance across the hardware and software stack. Chad Jarvis AI Performance Engineer Chad has a strong background in low-level code optimization, parallel programming, and high performance computing. He has worked for more than 17 years in research and engineering in Europe and North America. He holds a PhD in particle physics and is one of the authors of the Higgs Boson discovery. Chad has a passion and focus for understanding things at a fundamental level. Prior to joining Modular he worked at Graphcore working closely with the hardware engineers to implement and optimize custom features of the GC hardware, and before that Simula Research Laboratory among many other distinguished research facilities. He enjoys spending his spare time with his family, travelling, collecting rare coins, and eating excellent food. Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] Hengjie Wang AI Performance Engineer Hengjie Wang is a software engineer focusing on performance optimizations for AI and scientific applications. He has many years of experience in developing and optimizing large-scale scientific applications on world-ranking supercomputers. He has also developed Deep learning algorithms to advance physical simulations. Before joining Modular, he was a postdoctoral scholar in the Lawerence Berkeley National Lab, where he participated in developing the Exa-scale projects MFIX-Exa and AMReX on national supercomputers. He is a big fan of Go and enjoys hiking and dog training. Ian Tramble AI Performance Engineer Experienced systems software engineer with a background in performance and accelerated computing. Before joining Modular, Ian spent 5 years at NVIDIA working on MLPerf Inference, TensorRT, and systems software for autonomous vehicles. He is passionate about providing great out-of-the-box performance by abstracting hardware. Ian graduated from the Engineering Science program at the University of Toronto with a major in electrical and computer engineering. ================================================================================ URL: https://www.modular.com/engine YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/engine#performance YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/get-started PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: 80K+ developers building with MAX # A high-performance generative AI framework MAX replaces and simplifies your AI inference stack, maximizing performance and reducing cloud costs ## Achieve state of the art NVIDIA GPU performance Unlock state of the art latency and throughput without writing low-level CUDA code. ### Deploy MAX on GPUs ## Optimize your existing PyTorch & ONNX models Migrate seamlessly without rewriting your AI models and pipelines on a unified AI stack. ## Use Mojo to supercharge your AI applications Extend your Python code with high-performance Mojo, a new programming language with the expressiveness of Python and the performance of C. ## Develop locally, deploy globally to any cloud. Develop your AI applications locally and package and deploy across any cloud provider, on CPUs and GPUs, without having to change your code. ## Run Gen AI locally under 3 minutes Download MAX first to run an LLM - Run Llama3-8B in your CLIGet started - Run Llama2-7B in your CLIGet started - Run Replit-3B in your CLIGet started Run Llama3-8B in your CLI Run Llama2-7B in your CLI Run Replit-3B in your CLI ## Free Forever The MAX framework is a free and open platform for you to develop and deploy AI inference workloads. A new framework for Gen AI, and the best way to deploy PyTorch Development tools for accelerated compute on GPUs and CPUs, built from the ground up for GenAI, but compatible with today. ## Developer Approved 👍 “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “Max installation on Mac M2 and running llama3 in (q6_k and q4_k) was a breeze! Thank you Modular team!” NL Mojo is Python++. It will be, when complete, a strict superset of the Python language. But it also has additional functionality so we can write high performance code that takes advantage of modern accelerators. jeremyphoward “Tired of the two language problem. I have one foot in the ML world and one foot in the geospatial world, and both struggle with the "two-language" problem. Having Mojo - as one language all the way through is be awesome.” fnands “Mojo can replace the C programs too. It works across the stack. It’s not glue code. It’s the whole ecosystem.” scrumtuous “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 “What @modular is doing with Mojo and the MaxPlatform is a completely different ballgame.” scrumtuous “I am focusing my time to help advance @Modular. I may be starting from scratch but I feel it’s what I need to do to contribute to #AI for the next generation.” mytechnotalent “Mojo and the MAX Graph API are the surest bet for longterm multi-arch future-substrate NN compilation” pagilgukey “A few weeks ago, I started learning Mojo 🔥 and MAX. Mojo has the potential to take over AI development. It's Python++. Simple to learn, and extremely fast.” svpino “Mojo destroys Python in speed. 12x faster without even trying. The future is bright!” svpino “It’s fast which is awesome. And it’s easy. It’s not CUDA programming...easy to optimize.” dorjeduck “I tried MAX builds last night, impressive indeed. I couldn't believe what I was seeing... performance is insane.” drdude81 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 "Mojo gives me the feeling of superpowers. I did not expect it to outperform a well-known solution like llama.cpp." Aydyn "C is known for being as fast as assembly, but when we implemented the same logic on Mojo and used some of the out-of-the-box features, it showed a huge increase in performance... It was amazing." Aydyn “I'm excited, you're excited, everyone is excited to see what's new in Mojo and MAX and the amazing achievements of the team at Modular.” Eprahim “I'm very excited to see this coming together and what it represents, not just for MAX, but my hope for what it could also mean for the broader ecosystem that mojo could interact with.” strangemonad It worked like a charm, with impressive speed. Now my version is about twice as fast as Julia's (7 ms vs. 12 ms for a 10 million vector; 7 ms on the playground. I guess on my computer, it might be even faster). Amazing. Adalseno “The more I benchmark, the more impressed I am with the MAX Engine.” justin_76273 ## Get started now - Getting started guideStep by step walkthrough on how to get started - Browse examplesRun a project locally in just 2min - Connect with buildersJoin over 22,000 developers Getting started guide Step by step walkthrough on how to get started Browse examples Run a project locally in just 2min Connect with builders Join over 22,000 developers Download for your platform now - - - View Pricing MAX for Enterprise - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use MAX on GPU waiting list Be the first to get lightning fast inference speed on your GPUs. Be the envy of all your competitors and lower your compute spend. ================================================================================ URL: https://www.modular.com/team/eric-johnson YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Eric+Johnson PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/vision PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # Build AI for anyone, anywhere. ## Our mission is to have real, positive impact in the world by reinventing the way AI technology is developed and deployed into production with a next-generation developer platform. We believe that AI is a net positive force in the world and will help transform it for the better. Our vision and mission are to reinvent AI infrastructure to advance humanity. ### We aim to push the whole world of AI forward, not just a select few companies and products. After working for years at the world’s largest technology companies, scaling the world's largest AI work loads, building the hardware that powers them, and deploying AI to billions of mobile phones and edge devices, we saw that fragmentation and technical complexity held back the impact to a privileged few. We need to rethink the current AI systems and infrastructure from first principles to make it easy for anyone to leverage AI to solve the world’s most critical problems with software that just works. Modular and composable infrastructure that simplifies AI development and deployment is what the world needs. Together, as Modulers, we are a team of the world's best AI infrastructure leaders who are reinventing and rebuilding accelerated compute for everyone. ### How it started Chris Lattner and Tim Davis met at Google and felt AI was being held back by overly complex and fragmented infrastructure. Motivated by a desire to accelerate the impact of AI on the world by lifting the industry towards production-quality AI software, they founded Modular. Leadership team Chris Lattner Co-Founder & CEO Tim Davis Co-Founder & President Adin Scannell Cloud Infrastructure Lead Eric Johnson Product Lead Joe Pamer Mojo Distinguished Engineering Lead Kalor Lewis VP, Finance Mike Edwards Operations Lead Mostafa Hagog Performance & Compiler Engineering Lead Nick Kreeger Framework Engineering Lead ## Backed by the best investors in AI Our goal is as enormous as it is profound. We’re building a different kind of company to achieve this. We have assembled the best AI software and hardware leaders, and are systematically rebuilding the AI software stack from the ground up. 👋 We’re hiring! - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] Tim Davis Co-Founder & President Repeat Entrepreneur and Product Leader. Tim helped build, found and scale large parts of Google's AI infrastructure at Google Brain and Core Systems from APIs (TensorFlow), Compilers (XLA & MLIR) and runtimes for server (CPU/GPU/TPU) and TF Lite (Mobile/Micro/Web), Android ML & NNAPI, large model infrastructure & OSS for billions of users and devices. Loves running, building and scaling products to help people, and the world. [email protected] Adin Scannell Cloud Infrastructure Lead As a hands-on technical leader, Adin is passionate about building products and technologies that challenge the status quo. He previously co-founded GridCentric which was acquired by Google, where he worked on problems at scale for nine years across Google and Google Cloud. He has spent the last two decades solving problems across the infrastructure stack — from hypervisors and operating systems to containers and security. Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] Joe Pamer Mojo Distinguished Engineering Lead Joe spent the last 8 years at Meta, where he was focused on improving the company’s AI and developer infrastructure stacks. Before that he served as Instagram’s CTO, overseeing much of Meta’s work on programming languages (mainly focused on Python, PHP, and Javascript), and co-founded its first applied ML team for infrastructure. Before joining Facebook, he helped design and develop the F#, TypeScript, and Swift programming languages, and contributed to many other developer technologies, such as Clang, Visual Studio, and VS Code. Kalor Lewis VP, Finance Kalor is Modular's VP, Finance and leads all our Finance operations. Prior to Modular, Kalor was a VP, Finance at Fivetran where he was the first finance hire in 2018 and built out the companies entire finance function. Before Fivetran, Kalor was part of Palantir Technologies, where he scaled their strategic finance function. Mike Edwards Operations Lead Mike has spent over 25 years working in the fields of IT, corporate operations, and software development - most recently at Apple. Mike volunteers his time serving as a Board member with the LLVM Foundation, focusing on finance and operations. Mike truly believes in the power of AI to help address some of the world’s greatest needs. Mostafa Hagog Performance & Compiler Engineering Lead Mostafa is a seasoned engineering leader in high-performance computing. During his tenure at NVIDIA, he served as Engineering Director and led teams to develop optimized deep learning libraries like cuDNN and CUTLASS, revolutionizing GPU-accelerated AI. At SiFive, as VP of Software, Mostafa assumed a leadership role guiding teams in the development of an MLIR/LLVM-based software stack for SiFive Intelligence & performance cores. His contributions also extend to optimizing Intel GPU hardware/software features, playing a pivotal role in developing the AVX1/2 SIMD ISA for Intel CPUs, and contributing to the GNU C Compiler. Mostafa holds a Master of Science in Electrical Engineering from the Technion, with a specialization in compiler optimizations. His unwavering passion for innovation continues to drive advancements in the field of high-performance computing. Nick Kreeger Framework Engineering Lead Software Engineering lead with over 15 years of experience working at Google, Microsoft and a handful of startups. Nick has contributed to many technologies in Machine Learning such as TensorFlow.js, TensorFlow Lite/Micro, and ONNX/ONNXRuntime. Nick enjoys spending his free time with family and enjoying the Minnesotan outdoors. ================================================================================ URL: https://www.modular.com/blog/whats-the-difference-between-the-ai-engine-and-mojo PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: July 11, 2023 # What’s the difference between the AI Engine and Mojo? Eric Johnson Shashank Prasanna ‍On May 2nd, we announced our next-generation AI developer platform with two exciting breakthrough technologies — the Mojo programming language and the Modular AI Engine. In just over two months, more than 110k developers have signed up for the Mojo Playground to learn Mojo and experience its performance firsthand, over 30k developers have signed up to our waitlist for the AI engine, and our Modular community on Discord has grown to 17k developers! We’re incredibly excited to see developers sharing their experience with Mojo, providing product feedback, and learning from each other. Since our announcement, a question we continue to receive frequently from our community members is — what’s the difference between the AI Engine and the Mojo programming language? We’re glad to see questions from our community members and their enthusiasm to learn more about these products. We’ll first discuss the AI Engine, which will be less familiar to our readers, given that it is still in closed preview. We will then discuss how Mojo integrates with the AI Engine and finally wrap the post up with how we think they’ll join forces to unlock many AI and other use cases that are bottlenecked by performance and usability constraints. ## What is the AI Engine? The AI Engine is a high-performance inference engine for leading AI frameworks like PyTorch and TensorFlow. It supports importing trained model artifacts from TensorFlow (SavedModel), PyTorch (TorchScript), and ONNX and uses state-of-the-art compiler and runtime technologies to deliver up to 7.5x higher throughput vs. native framework runtimes. Our earlier blog post shared its performance on TensorFlow and PyTorch models across different CPU architectures (Intel, AMD, ARM). For the most up-to-date performance benchmarks, visit performance.modular.com. The AI Engine is still in closed preview — you can sign up here to be considered for early access. ‍ Under the hood, like most compiler toolchains, the AI Engine has four key components: - The Importer takes a serialized model (e.g., a TensorFlow SavedModel) and converts it to a graph representation that the compiler can optimize. - The Graph Optimizer takes this graph representation and performs graph-level optimizations (e.g., constant folding, shape inference). - The Kernel Generator produces high-performance machine learning kernels tailored to individual architectures and microarchitectures, including advanced techniques like operator fusion. - The Runtime executes the optimized kernel graph with low overhead to deliver state-of-the-art performance. For the user, the AI Engine offers both Python and C/C++ APIs and integrates into popular serving frameworks like NVIDIA’s Triton Inference Server and TensorFlow Serving to deliver high-throughput inference in production. You can read more about how it achieves that in this blog post. The AI Engine is still in closed preview - sign up here to express interest in testing the AI Engine. ### How Mojo integrates with the AI Engine The AI Engine’s kernel generator generates hardware-specific optimized implementations of machine learning operators. Modular engineers initially wrote this code in MLIR directly but found it to be a productivity challenge. We decided things would be much more productive in a high-level language with Python-like usability and safety and predictability guarantees of systems programming languages like C and Rust. As such, Mojo was born to satisfy the needs of Modular’s internal development efforts on the AI Engine. Today all of the AI Engine’s optimized kernels are written in Mojo, allowing the Engine’s capabilities to be extended to support new and exotic model architectures where custom kernels for operators can be authored directly in Mojo without resorting to low-level C, C++, or CUDA programming. While you can use the AI Engine as a drop-in replacement for your existing models without Mojo, if you’re an AI developer creating custom operators and model architectures, Mojo can dramatically improve your productivity in authoring custom kernels enabling you to deploy models to production in the shortest possible time. Sign up for early access to the AI Engine and learn more: - AI Engine overview: https://www.modular.com/engine - AI Engine performance dashboard: https://www.modular.com/engine - Modular launch blog post: A unified, extensible platform to superpower your AI - Model serving blog post: Accelerating AI model serving with the Modular AI Engine - Documentation: https://docs.modular.com/engine/ ## What is Mojo🔥 ? While Mojo’s origin story was for authoring kernels for the AI Engine, thats not its only purpose. Mojo is designed to become a superset of Python over time by preserving Python’s dynamic features while adding new primitives for systems programming. It’s a brand-new programming language that combines the usability of Python with powerful compile-time metaprogramming, integration of adaptive compilation techniques, caching throughout the compilation flow, and other features that are not supported by existing languages. In his blog post, Jeremy Howard described Mojo as “Python++” since it enhances Python’s capabilities, enabling it to enter new domains. Mojo is still in early development, but the value of Mojo is in its “depth” as a language. Mojo is not the first programming language to execute Python-like syntax on accelerators, but it is the first to enable high-level AI developers direct low-level control over hardware — unlocking researchers to innovate at all levels of the stack. ‍ Mojo has a syntax that looks like Python, but unlike the default “CPython” implementation, which uses an interpreter, Mojo is compiled. The Mojo compiler lowers Mojo code, performs optimizations, and generates code for specific hardware targets. Mojo also offers low-level types like the SIMD type, which represents a low-level vector register directly in hardware for writing hardware-optimized code. Mojo has already had its first success story — the AI Engine. The AI Engine’s performance results on the performance dashboard are the result of the improved engineering velocity of the AI Engine’s team in supporting popular models on a variety of hardware to deliver state-of-the-art performance. Of course, Mojo was not only built for Modular’s use cases, but our community users have already started creating amazing projects like mojo-libc. You can get started with Mojo today on the Mojo Playground environment, which allows you to walk through Jupyter Notebook examples, create your own and share them with the Mojo community on Discord. One of the most frequently requested features is the ability to download Mojo and run it on your local computer — we’re working on this, so stay tuned! Here are additional resources to get started with Mojo: - Mojo overview: https://www.modular.com/mojo - Mojo Playground: https://playground.modular.com/ - Modular launch blog post: A unified, extensible platform to superpower your AI - LLM language post: Do LLMs eliminate the need for programming languages? - Documentation: https://docs.modular.com/mojo/ ## Mojo and the AI Engine - better together! The AI Engine and Mojo were designed to be used together. In the near term you will be able to use the AI Engine to deploy widely used models for production and deliver high-performance, low-latency inference on a range of hardware architectures. With Mojo’s Python-like usability, you can easily extend the AI Engine’s capabilities for tasks such as writing performant pre- and post-processing operations (e.g. tokenization, image transformations, non-max suppression, etc.), replacing high-latency operations and custom fused kernels to deliver even greater performance. Together the AI Engine and Mojo will allow you to accelerate all parts of your AI development pipeline. In the longer term, we expect the AI Engine and Mojo together to accelerate workloads in several domains beyond AI. Python is used in multiple domains including data analytics, image and signal processing, scientific and numeric computing, gaming, 3D graphics, network programming, database access and others. As AI proliferates into these and other domains, we expect the AI Engine and Mojo to play an important role in accelerating applications in these domains and unlock the next wave of AI innovations. Ultimately they are productivity tools in a developer’s toolbox, and a tool’s potential is only limited by the user’s creativity. We’re excited to see what challenges you’ll solve with them and what new innovations they’ll help you unlock. We look forward to hearing from you about your use-cases, feature requests and product feedback. In the meantime: - Head over to the Mojo Playground to test the latest release of Mojo right now! - Sign up here to express interest in testing the AI Engine - Join our warm, welcoming and awesome community on Discord - Discuss Mojo and the AI Engine topics on GitHub discussions Until next time 🔥! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] Shashank Prasanna AI Developer Advocate Shashank is an engineer, educator and doodler. He writes and talks about machine learning, specialized machine learning hardware (AI Accelerators) and AI Infrastructure in the cloud. He previously worked at Meta, AWS, NVIDIA, MathWorks (MATLAB) and Oracle in developer relations and marketing, product management, and software development roles and hold an M.S. in electrical engineering. ================================================================================ URL: https://www.modular.com/blog/outperforming-rust-benchmarks-with-mojo PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: February 2, 2024 # Community Spotlight: Outperforming Rust ⚙️ DNA sequence parsing benchmarks by 50% with Mojo 🔥 Mohamed Mabrouk Editor's note: This article received a lot of attention from the Mojo, Rust, and bioinformatics communities, and we received strong feedback about the performance numbers and methodology after its initial publication. We followed up with a post comparing Rust and Mojo, and the original author has published updated performance data to the BlazeSeq repository. We want to thank everyone for their thoughtful feedback. While the data and performance numbers in this article are out of date, for full transparency we're leaving the original text in place. ### The era of big-data in bioinformatics The challenges for bioinformatics in the modern day, are rooted in big-data manipulation. Thousands of multi-million dollar DNA-sequencing machines are working non-stop in all fields of biotechnology, medicine, and biomedical research. The annual sequencing data size is expected to be up to 40 exabytes of raw sequences by 2025. That's 20x the data uploaded to YouTube every year. While most of the final analysis is carried out in high-level languages like Python and R, the world of bioinformatics is powered by an underlayer of black magic! Highly-optimized tools written in C, C++, and Java that pre-process and summarize large amount of raw data. This creates a two-world problem where bioinformaticians who are not skilled in low-level languages, are prohibited from understanding, customizing, and implementing low-level operations. In addition, typical bioinformatic pipelines are a mixture of Bash and Python scripts calling into pre-compiled binaries, along with the analysis logic itself. It's becoming increasingly complex and frustrating for new and experienced bioinformaticians. This is the same issue that the AI community is facing. ### Mojo 🔥 one tool to rule them all I first heard about Mojo from the demo video by Jeremy Howard. Its value offer is simple, a Pythonic language that allows the programmer to optimize at a much lower level, to unify the fragmentation in fields such as AI. Learning Mojo was relatively easy for me, coming from the Python world, I got used to the extra syntax in only a few days. I decided to try Mojo 🔥 in a serious project for a low-level bioinformatic task; FASTQ parsing and quality trimming. FASTQ is a basic format for most DNA sequencing operations, incorporating both the genomic sequence and confidence scores of the machine in each base call. It is a simple format to parse, with most records looking like this: However, typical uncompressed file sizes are 1-50 GB, an average sequence-heavy study could generate north of 1 TB for a single file. Performance is critical in parsing and data manipulation. I tried to write a simple parser that would: 1. Read a chunk of the file as a String.2. Split the string on the newline \n separator.3. Take each 4 lines, validate that they are a consistent and correct FASTQ record, and return it.4. Rinse and repeat until reaching EOF. On the first try, MojoFastTrim 🔥 achieved 8x the performance of python's SeqIO. I was pleasantly surprised with the development time. My code was still Pythonic, concise at around 200 lines, and using features the average python developer would understand. In quality trimming, where low quality bases are removed from each read, it achieved 50%-80% of the industry standard tool Cutadapt. This was a surprising level of performance for development time I put into the project. ### Going down the optimization rabbit hole The most powerful benefit of Mojo 🔥 is that it gives you access to low-level optimizations. The nascent state of the Mojo standard library meant that I had to write, test, and benchmark some functions from the ground up. Mojo's first-class support of SIMD vectorization was really helpful and surprisingly intuitive. Here is the implementation of the vectorized version of a function to find the index of the newline separator in Mojo: ##### Iterative ##### SIMD Vectorized The vectorized version loads 32-elements of Int8 and checks the presence of a new-line separator using fewer operations. In the following graph, you can see the effect of SIMD vectorization. It provides up to 4x speed up, with average speed up of 3.2x. Similarly, SIMD storing and loading from tensors providers substantial performance gains. In addition, I explored optimizations from C/C++ implementations. I was concerned that no explicit memory buffer was allocated for the loaded chunks, but the Mojo compiler was already taking care of that and avoiding new memory allocations: Implementing those optimizations resulted in an extra 3x speedup, and MojoFastTrim 🔥 was on average 24x more performant than Python's SeqIO. In addition, due to control over reference and value semantics in Mojo 🔥 I applied a FastParser version of the parser. No memory copies are made during parsing and the individual reads are passed around as references to the loaded chunk in memory. This approach is implemented in Rust's needletail parser. Although Mojo is still a young language, my implementation was 50% faster than the Rust implementation on Apple Silicon, and 100x faster than SeqIO. In quality trimming, MojoFastTrim 🔥 was on average 2x faster than the highly-optimized Python/Cython Cutadapt. This benchmark can be reproduced by following the instructions here. ### Final thoughts For Python programmers wanting to write more performant code, Mojo is a great tool to try, and easy to learn. However, the language and the ecosystem is still growing, I had to use print debugging to gain insight into the bugs I was encountering. The debugger is still in preview and undocumented, although they tell me it will be officially launching soon! In conclusion, I think that Mojo can be a radical change for a wide range of Python trained scientists and researchers across many fields. It can enable them to have a level of performance and control, that was previously unachievable. Thanks for reading! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Community - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Mohamed Mabrouk Community Guest ================================================================================ URL: https://www.modular.com/blog/increasing-development-velocity-of-giant-ai-models PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: August 12, 2022 # Increasing development velocity of giant AI models Eric Johnson This post is part one of a two-part series on how we are improving productivity for engineers and scientists for those developing large models. Subscribe to our newsletter to get future posts delivered to your inbox! Machine learning models are getting larger and larger — some might even say, humongous. The world’s most advanced technology companies have been in an arms race to see who can train the largest model (MUM, OPT, GPT-3, Megatron), while other companies focused on production systems have scaled their existing models to great effect. Through all the excitement, what’s gone unsaid is the myriad of practical challenges larger models present for existing AI infrastructure and developer workflows. One of the many challenges of developing large models is the painful experience of working with tooling that isn’t equipped to deal with models with huge weights — which can be upwards of 100+ gigabytes. An unspoken truth is that AI deployment engineers often have to wait minutes or even hours for tooling to work with large models. This isn’t great for productivity, isn’t how we want AI specialists to spend their time, and reduces the ability to iterate rapidly. At Modular, we recognize that developer productivity is a significant part of the cost of training and deploying models. We are constantly optimizing our toolchain to improve the lives of our early customers and our internal developers. This post discusses the technical challenges of managing many gigabytes of data in the compilation process and the changes we have made to our infrastructure (and the MLIR compiler framework) to solve them. ## Working with AI models is uniquely challenging If you aren’t familiar with graph transformations, optimizations, and compilers in machine learning, there is no need to be intimidated.  These are techniques used to increase the performance and portability of an AI model or enable it to deploy to some target hardware. There are high-level “compilers” like the TensorFlow Lite Converter that transforms and optimizes a TensorFlow SavedModel into a highly optimized program format (i.e., FlatBuffer) for execution on edge devices. There are also domain-specific compilers like XLA and TorchScript JIT Compiler. They create or consume an intermediate representation (e.g., a “graph”) of an AI model and compile it to another format - for example machine code or a domain specific runtime representation (e.g. CUDA graphs). Compiling an AI graph is actually quite different from traditional compilation problems. An AI graph contains two things: 1) the graph topology (how the layers are interconnected) and 2) the model weights (parameters associated with specific layers). In terms of size, the graph topology is on the order of kilobytes, whereas weights are on the order of megabytes and gigabytes. For example, look at some of the bigger models released by Meta. The Open Pre-trained Transformers have 30B, 66B, or even 175B+ parameters, which equates to 100+ gigabytes of weights. There are even larger models like Gopher or Megatron too. ‍ ‍ Large models are not handled well by existing tools in the AI ecosystem. For example, protobufs have an inherent 2-gigabyte limit, creating problems for model formats backed by this serialization format. In the latest version of TensorRT, “transformer-based networks such as BERT and GPT, can consume CPU memory up to 10 times the model size during compilation” which makes it difficult to use for large models. In ONNX, users must split the model weights across many files to support large models. All this introduces unnecessary complexity into the AI development workflow, can lose the “single source of truth” for a model, and generally makes it harder to distribute models. To compound the situation, the heft of these weights can lead you to add workarounds that complicate your overall AI development workflow. For example, at Modular, we built a mechanism for caching temporary files because certain compiler stages were taking 2+ minutes — which broke our developers out of interactive flow state. Like other workarounds, we realized that this caching was a “duct tape solution”: it wasn’t 100% reliable and didn’t help when the cache missed. Because we care so much about developer productivity, we decided to tackle the core of the problem. ## MLIR in the Modular compilation stack The Modular stack leverages the MLIR compiler infrastructure to represent and transform AI models, including AI operator graphs (for multiple frameworks), mid-level runtime primitives, and low-level machine code generation. Our team has many of the foundational architects of MLIR, who were deeply involved in releasing MLIR to the world, and we continue to actively maintain large portions of core MLIR today. MLIR is a sub-project of the LLVM compiler infrastructure project, which provides a modern toolkit for building domain-specific compilers. It provides a set of core building blocks necessary for modeling, analyzing, and transforming a wide range of computational domains including hardware design, quantum, artificial intelligence among many others. MLIR has allowed us to build a single cohesive system that spans the entire stack, which is more powerful, layered, extensible, and easier to maintain than conventional stacks. Using unified infrastructure enables our improvements to easily transfer across our tooling stack and enables greater composability and modularity of our entire development workflow. Modular is not alone in leveraging MLIR — many other systems use MLIR for representation and transformation, including TensorFlow, XLA, PyTorch, ONNX, etc. As this ecosystem continues to grow, we can all celebrate MLIR’s benefits, but we must also continue to invest in its evolution. ## MLIR is a good thing, but its approach for managing weights was not! One of the fundamental building blocks of MLIR is an Attribute, which you can think of as a form constant data that is “unique’d” (aka, memoized, or intern’ed). Attributes are user extensible, meaning they may take various forms depending on the use case. Attributes are used for things like constant expression values (e.g. “5”, “10.0”, etc.), string literals, for enumerators (e.g. “less than”, “greater than”, “equal to”, etc.), for arrays of data … and far more. Most MLIR-based AI tooling uses attributes to hold weights for AI models. However, this is a problem: model weights can be enormous, and MLIR stores a two-gigabyte weight tensor the same way as a four-byte tensor — in an attribute containing a unique’d array of elements. This creates an obvious problem given we just used the words unique’d and gigabytes so close together! Here is the challenge: when something is unique’d in MLIR, it is allocated, hashed, and stored within an "MLIRContext". These objects have lifetimes attached to the MLIRContext, and they are not destroyed until the context is destroyed. This is great for small values because we can pass them around and compare unique'd objects by pointer, share allocations for attributes (very common), and more. These benefits turn into a liability with huge weight tensors: we don’t want to reallocate, copy, or unique them. We also don’t want them to live forever: it is important to deallocate big weights when the computation no longer references them. For example, when we run a tool that quantizes our model, it needs to transform the operator graph and generate new weights — and can end up with multiple copies of that data which all live for the duration of the compilation process. Another problem for ML tooling is how MLIR was serialized to the file system. When we started, MLIR had no binary serialization format - just a textual format. This is a problem for large weights because each byte of binary data ended up being emitted in a hexadecimal form - taking 2x the space as the data it is encoding. That means that we end up not only taking a long time to create the hex (about 20 seconds for a decently sized multi-gigabyte model), but our intermediate files are twice as big as they should be - 2x an already big number! ## A bigger impact than just developer productivity This well-intended design mechanism can cripple even the best compilers. The most obvious challenge is that it compounds the time necessary to compile, inspect, and transform a model. If you have ever used the excuse, "My code's compiling," you'll be aware of the pain this creates. Here, we are forcing the processor to continuously allocate, copy, and hash multiple gigabytes of data. A bigger problem than compile-time is that memory use impacts larger scale architectural features in the Modular stack. For example, because our compiler and technology stack itself is highly parallel and utilizes advanced features like online search, memory use directly affects the amount of work we can do in parallel. This is important to get the highest quality of results. At Modular, it is core to our ethos that we build tools that users will fall in love with. We realize that advanced features simply won’t get used if they are difficult to use, impact productivity, or have significant caveats (e.g. they don’t work in all cases). We love that fixing these foundational problems with large weights, allows us to subtract complexity from our users lives and workflows. ## Fixing this the right way: core additions to MLIR The team at Modular are prominent stakeholders and maintainers of MLIR, and a big part our culture is to “Build it Right“ - this applies to every project we contribute to. As we contribute to and drive the evolution of MLIR, we have a vested interest in ensuring that steps are right for the project overall, and we collaborate with the MLIR community at large to gain consensus on our approach. We took a step back to understand what we needed to solve this problem with large model tooling and listed out: - Only allocate memory when necessary: We know it is more efficient to memory map large data (like weights) from disk, instead of copying data into malloc’d blocks.‍ - No hashing or uniquing: Let’s not check equality of 2 gigabytes blobs of data; weights should be identified by name instead of being implicitly unique’d by content.‍ - Enabling Inline Mutation: If there is only one user of the data, we should be able to quantize, transform and manipulate data in place instead of making a copy of it first.‍ - Enable deallocation: The data we are working with is huge, and we need to deallocate it when the last reference to the data is destroyed.‍ - Fast serialization: Whether JITing, searching optimization parameters, or just iterating locally, we cache IR for many reasons, and it should be fast. None of these insights are particularly novel, but these are requirements that traditional compilers (e.g. for typical CPU programming languages) don’t run into. As a result of our design work, we added two extensions to MLIR that better support our use cases and are general to many other use cases throughout the community. We are actively contributing these back upstream to the MLIR community. In part two of this series, we discuss how we separated IR and data, and the overall end-state impact. Hint, it’s huge. If you are an experienced  developer in AI infrastructure or a MLIR practitioner, you should definitely consider joining Modular. If you like AI and enjoy using great tools, please subscribe to our newsletter. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] ================================================================================ URL: https://www.modular.com/blog/ais-compute-fragmentation-what-matrix-multiplication-teaches-us PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: March 23, 2023 # AI’s compute fragmentation: what matrix multiplication teaches us Eric Johnson Abdul Dakkak Chad Jarvis ## Compute fragmentation is holding AI back AI is powered by a virtuous circle of data, algorithms (“models”), and compute. Growth in one pushes needs in the others and can grossly affect the developer experience on aspects like usability and performance. Today, we have more data and more AI model research than ever before, but compute isn’t scaling at the same speed due to … well, physics. If you’ve followed the evolution of AI and hardware, you’ve probably heard that Moore’s law is ending. The rate of performance improvement in single-core processors is no longer doubling every 18 months, as has been true for the last 60 years. Beyond the physical limitations of continuing to make transistors smaller and smaller (e.g., excess power usage and heat due to current leakage), performance has become increasingly constrained by memory latency, which has grown much slower than processing speeds. Yet, the need for more AI compute has continued to grow as models become larger and larger and more enterprise data is created and processed on the edge. As a result, squeezing performance from hardware has become one of the main focuses of the industry. So how is compute fragmentation holding AI back? With traditional CPUs not scaling to meet the need for more compute, the only way forward has been to create parallel and domain-specific hardware that is less general, but that does a few AI-related things really well — like graphics processing units (GPUs), tensor processing units (TPUs), and other application-specific integrated circuits (ASICs). While these innovations have helped push the industry forward, enabling greater scale and more power-efficient processors in edge devices, the increased diversity of hardware has fragmented the industry and left AI developers struggling to: - Develop software that fully leverages the hardware’s capabilities and composes with others. - Express parallel software algorithms on any one device. - Scale that software across an ecosystem of many devices or even to heterogeneous systems. Modular is focused on rebuilding the world’s AI infrastructure from the ground up. In this blog series, we’ll talk about how we are taking a fresh approach to solving the industry’s compute fragmentation problem. We will motivate the low-level challenges of building a truly unified solution by focusing on a single operation, matrix multiplication (“matmul”), a critical calculation in machine learning algorithms. To understand why it is hard, though, we will look under the hood of matmul and get into some of the nitty-gritty details of how it works. Don’t say you weren’t warned - this post is about to go deep! ## Matrix multiplication, and why it is so hard Matrices are critical to machine learning systems as a simple way to represent data efficiently — such as input data (e.g., sets of pixels in an image) or the internal workings between the model layers. As a result, multiplying these matrices together makes up a large portion of the total computations in deep learning models. In fact, matmuls make up roughly 45-60% of the total runtime of many popular transformer models like BERT, CLIP, and even ChatGPT. Matmuls are also critical to computing the convolution operation that forms the foundation of most computer vision models, and makes up the backbone of many high-performance computing (”HPC”) applications. Given its importance, there has been extensive research on writing efficient matmul algorithms. Papers from the 60s, 70s, 80s, 90s, 2000s, to the present day exist that try to solve the problem with the hardware of that era. But the conceptual matmul algorithm isn’t what makes it difficult. Instead, the challenge is writing a matmul fast enough to achieve state-of-the-art performance across all the hardware, model, and data diversity in the AI industry.  It is even harder to make it compose with all other AI operators. ### Hardware Each device used to run AI models has different characteristics, including different memory hierarchies and different multiply and accumulate units (MAC). For example, CPUs employ a hierarchy of memory from slow RAM to increasingly faster caches — Level-3, Level-2, Level-1, and CPU registers. The size of the memory is inversely proportional to its speed — for example, L1 cache access is typically on the order of single nanoseconds, whereas RAM access is on the order of 100 nanoseconds. To get the highest performance matmul, the algorithm itself has to be implemented to efficiently work with the different memory levels and sizes. Raw matrices are too big to fit into the registers or the fastest memory cache at one time, so the challenge is determining how to decompose them into the right sized blocks or “tiles” that maximize usage of the fastest memory. Moreover, the actual shapes of the units that handle the core matrix functionality differ across hardware. CPUs have traditionally been scalar machines, meaning they process instructions one step at a time, but all CPU vendors have added vector units (SIMD) over the last two decades. GPUs execute single operations across multiple threads (SIMT) to maximize the efficiency of highly parallel, repetitive operations like matmuls. And more specialized hardware takes this further by operating on 2D matrices. Google TPUs are the most well-known, but Apple and Intel have added their own matrix multiplication features called AMX. But while more advanced MAC units have led to improved performance, they have also created a greater need for flexible algorithms that work across scalar, vector, and matrix processors. ### Models AI models are also quite diverse. While matmuls form the foundation of many models, the matrix sizes used in those matmuls can vary significantly. For example, models have different input shapes (like varying sequence lengths), different internal shapes (i.e., the matrices that are being multiplied together as part of the hidden layers of the model), and even different batch sizes (critical for training and inference efficiencies). As a result, matmuls come in hundreds of different shapes in production, which makes decomposing them into blocks that maximize memory efficiency challenging. ### Data Lastly, your data can also be diverse. Most readers will be familiar with data diversity in terms of structured and unstructured data, but in this case, we are more concerned with data type (”dtype”). Data in AI models is usually of dtype FP32, but the industry is also adopting lower precision data types like Bfloat16, Int8, and the more exotic FP4 and Int4, to reduce model size and improve performance. Matmul algorithms, then, need to be able to operate on data of many different precisions, depending on the use case. ## Current state-of-the-art So how are today’s most state-of-the-art matmul algorithms actually implemented? Given its importance, matmul is usually one of the first algorithms that hardware vendors optimize, with many providing implementations through their libraries. Intel provides the MKL and OneDNN libraries, AMD provides AOCL and RocBLAS, ARM has performance libraries, Apple has Accelerate, and Nvidia provides CUBLAS. Across the hardware libraries mentioned above, the current state of the art in terms of efficient implementation is to effectively write assembly code: this means micro-managing the hardware by giving it direct instructions at the lowest level that it understands without abstractions. The main reason for this? Writing assembly produces the best performance for any one specific use-case because developers who are writing assembly can avoid the unpredictability of compilers, which translate higher-level languages like Python & C++ down to assembly, and can perform optimizations that are hard for the compiler to do because compilers must generalize. Importantly, they can leverage instructions and patterns that the compiler is unaware of because extending the compiler to support new hardware features takes time. ## Hand-written assembly kernels don’t scale! But does this actually solve the fragmentation issue for users? While writing in assembly maximizes performance for any individual example, it’s not portable, doesn’t compose, doesn’t scale, and isn’t user-friendly. Think about it: how can a small number of specialized experts, who hand write and tune assembly code, possibly scale their work to all the different configurations while also incorporating their work into all the AI frameworks?! It’s simply an impossible task. ### Portability Because assembly is written with a hardware-specific interface called an instruction set architecture (ISA) it is not portable across different hardware platforms. In fact, assembly can’t even deliver the best performance across multiple generations of chips from the same vendor! Further, even if you have target hardware in mind when developing your model, there are still two big practical problems: - In the cloud, you don’t have control over the specific hardware it runs on. “But I’ve selected an instance that’s perfect for my model” you say. The truth is that instance types on some cloud providers like AWS don’t guarantee a specific CPU type. For example, if you select a c5.4xlarge instance, you could get an older generation Intel SkyLake processor or a newer Cascade Lake processor. Assembly cannot adapt and give you the best performance for the specific chip your code runs on. - Your product will continue to evolve rapidly, and you may want to move to a different hardware architecture altogether. Auguring in on one specific configuration will limit your flexibility to adapt as your model requirements change or when a new generation of hardware comes out. ### Scalability and composability As we discussed earlier, there are many AI models, leading to hundreds of different matmul shapes. Using assembly-based libraries means selecting specific processor instructions that hardcode parameters like memory tiling sizes. These hard-coded assembly libraries can be tuned well for a specific tensor shape but require a different implementation for others. As a result, many existing kernel libraries swell to be gigabytes in size (e.g., MKL is 3.2GB and cuDNN can be up to 2.5GB). This becomes a problem when the size of these libraries impacts container build times, if you deploy to the edge where this is impractical, or if you want to deploy new innovations and research that these vendors haven’t manually specialized yet. Looking at the bigger picture, high-performance matmuls are indeed important for performance. But to get the best results, matmuls can be executed together with other operations such as elementwise, strided accesses, broadcasts, etc. Operator fusion provides significant performance improvements by reducing memory traffic - but the challenge is that there are thousands of AI operators. Furthermore, models use many permutations of different operations in combination, and (while some have tried!) it isn’t practical to hand-fuse all the important combinations, particularly when research is driving AI forward so fast. ### User-friendliness And finally, writing assembly is not user-friendly or good for cross-organization productivity. Assembly programming has limited features available in modern programming languages like parameterization and object-oriented programming and does not provide great tooling for debugging, code coverage, testing, etc. While the reality is that most researchers looking to write new operations are most comfortable in Python, it has well-known performance issues, so organizations end up having to hire expensive specialists to bridge the gap. ## Stay tuned For AI to reach its true potential, compute fragmentation needs to be solved. AI software developers need to be able to seamlessly take full advantage of existing hardware and the next generation of hardware innovations when they become available. But as you can see, solving this problem is not easy. Diversity in hardware, models, and data means that every existing solution on the market is only just a “point solution” to a much broader problem. Modular is solving this problem - stay tuned for part 2 of the blog, in which we outline our approach and show the revolutionary benefits. And if you are excited about solving some of the most challenging and complex problems, go to modular.com/careers and apply! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Engineering - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] Abdul Dakkak AI Compiler Engineer Expert in machine learning, compilers, programming languages, and accelerated computing. Before Modular, Abdul led the development of AI compilers for GPUs at Microsoft Research and the Mathematica Compiler at Wolfram Research. Abdul has developed open-source tools for accelerating real-world applications to optimize their performance across the hardware and software stack. Chad Jarvis AI Performance Engineer Chad has a strong background in low-level code optimization, parallel programming, and high performance computing. He has worked for more than 17 years in research and engineering in Europe and North America. He holds a PhD in particle physics and is one of the authors of the Higgs Boson discovery. Chad has a passion and focus for understanding things at a fundamental level. Prior to joining Modular he worked at Graphcore working closely with the hardware engineers to implement and optimize custom features of the GC hardware, and before that Simula Research Laboratory among many other distinguished research facilities. He enjoys spending his spare time with his family, travelling, collecting rare coins, and eating excellent food. ================================================================================ URL: https://www.modular.com/team/chad-jarvis YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/hengjie-wang YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/ian-tramble YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Chad+Jarvis PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Hengjie+Wang PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Ian+Tramble PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog/accelerating-ai-model-serving-with-the-modular-ai-engine PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 1, 2023 # Accelerating AI model serving with the Modular AI Engine Alexandr Nikitin Eric Johnson ## AI Model Serving is more than an Engine A few weeks ago, we announced the world’s fastest unified AI inference engine. The Modular AI Engine provides significant usability, portability, and performance gains for the leading AI frameworks — PyTorch and TensorFlow — and delivers world-leading execution performance for all cloud-available CPU architectures. Critically, it is a drop-in replacement to how you deploy AI today, including support for all AI operators, ensuring your workloads seamlessly capture these benefits out of the box. ‍ However, as we previously discussed, running inference on a model is only part of the deployment story. Deploying AI models into production at scale requires significantly more software infrastructure and system design, as seen in the figure below as just one example. In addition to leveraging a model engine that supports multiple frameworks and hardware backends, the serving layer must account for other requirements such as high throughput (via techniques such as model concurrency and dynamic batching) and low latency, while providing ease of use, reliability, and scalability. ‍ Given the complex nature of serving infrastructure, optimizing the performance of an AI application in production is not only about optimizing the backend runtime engine. Improving the engine's performance leads to bottlenecks in other parts of the stack, so tuning each stage of the end-to-end serving infrastructure, including model loading, batching, etc., is critical. ## Integration into popular serving solutions At Modular, we care about maximizing AI developer velocity by meeting customers where they are today. So in order to make deployment of the Modular AI Engine as seamless as possible, we have integrated it into NVIDIA’s Triton Inference Server and TensorFlow Serving. Both are open-source serving solutions that many of our customers are using today, and they provide useful features that simplify inference deployment, such as out-of-the-box support for metrics, dynamic batching, concurrency, and more. In the case of Triton, we used the backend API to implement a Modular AI Engine backend, as seen in the image below. With the Triton serving API remaining the same, we provide a drop-in option for customers to transparently capture all of the Modular AI Engine's benefits. We’ve worked hard to make it incredibly simple to roll out the world’s fastest AI inference engine. ‍ ## Performance benefits of the Modular AI Engine for serving To showcase the benefits of the Modular AI Engine, we analyze the performance of the Engine integrated into the Triton Inference Server on various hardware backends — Intel Skylake (c5.4xlarge on EC2), AMD EPYC (c5a.4xlarge), and AWS Graviton2 (c6g.4xlarge). We test the performance on a binary text classification problem using BERT-base, a popular transformer language model from HuggingFace. We use a sequence length of 128 and analyze the effects of increasing concurrency and enabling server-side dynamic batching on the Modular backend to simulate a production deployment of the model. And we compare the results of the Modular AI Engine to the out-of-the-box performance of TensorFlow and PyTorch backends. We also did not change any default settings (e.g., dynamic batch size) on Triton to keep this as consistent as possible with how our customers use it in production. ### Throughput The first set of charts below show throughput (queries per second) as we scale the number of concurrent threads on the serving system. Starting with our results on the AWS Graviton 2, we see that Modular is able to achieve 2.3x better throughput as compared to TensorFlow and 1.5x-1.7x as compared to the PyTorch 2.0 backend. We see roughly the same improvement on AMD as well, with Modular 2.3x better than TensorFlow and 1.5x-1.7x as compared to PyTorch 2.0. Also interesting to note is that with dynamic batching enabled, we can see an improved scaling effect on the throughput as we increase the number of concurrent requests (or threads) being serviced. Not surprisingly, without dynamic batching, as the requests spend more time in the queue, the throughput stays constant. On the Intel Skylake system, Modular has 3.6x better throughput on TensorFlow and 1.2x better throughput than PyTorch 2.0. Modular achieves a peak throughput at 42 QPS on the Intel Skylake system without changing hardware or numerics, or performing other “tricks”. ### Latency Since production deployments typically operate under a latency budget, we also measure the latency of the Modular AI Engine compared to both TensorFlow and PyTorch 2.0. On the Graviton2 system, at the peak throughput, Modular is able to achieve 2.3x lower latency compared to TensorFlow and 1.5x-1.7x lower latency compared to PyTorch 2.0 as the number of concurrent requests is increased. Similarly, on AMD, Modular is 2.3x lower latency than TensorFlow and 1.5x-1.7x lower latency than PyTorch 2.0. On the Intel Skylake system, Modular has 2x lower latency compared to TensorFlow and 1.2x lower latency compared to PyTorch 2.0. Note that the PyTorch implementation is using the optimized Intel OneDNN Graph BERT implementation, and as you can see, our ability to scale across multiple architectures while providing unmatched latency performance makes the Modular AI Engine world leading. Further, we are showcasing significant wins against a very common and highly tuned model, and the generality of our stack enables enormous improvements across many other models. You can combine all these benefits for a truly industry defining solution — much greater flexibility, usability (e.g. full support for dynamic sequence lengths), integration with Mojo and of course performance portability across hardware architectures. ## What’s Next? You can check out the complete NVIDIA Triton serving results using Modular’s AI Engine on our Performance Dashboard. However, this is only the beginning. Modular is working on an accelerated AI compute platform that can serve performance-sensitive AI models at scale, and we have many more optimizations to come as we build out our platform. Stay tuned! In the meantime, visit www.modular.com to learn more and sign up for our newsletter to get product updates and notifications when new results are available on our performance dashboard. ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Product - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Alexandr Nikitin AI Cloud Engineer Alex is a software engineer with over 15 years of experience who is passionate about building efficient, fault-tolerant, and high-performance systems. Prior to joining Modular, he led the Einstein Platform ML Serving solution at Salesforce, which scaled to support hundreds of thousands of ML models and prior to that build extremely high performance ads systems. In his free time, Alex enjoys mountaineering, climbing, and trail running. Eric Johnson Product Lead Product leader who has built and scaled AI applications and infrastructure. Eric led the TensorFlow API, Compiler, and Runtime teams at Google Brain and Core Systems, including the founding of TFRT and the productionization of JAX. He holds an MBA from Wharton and Computer Science MS from Penn and loves soccer, fitness, and the great outdoors. [email protected] ================================================================================ URL: https://www.modular.com/blog/do-llms-eliminate-the-need-for-programming-languages PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: June 8, 2023 # Do LLMs eliminate the need for programming languages? Chris Lattner ## Introduction We’re very excited about the positive reception of Mojo since its launch as well as the community of people building around it. Given new Large Language Model (LLM) powered developer tools like Copilot and Ghostwriter, many developers are wondering about the future of programming – do programming languages still matter when AI writes the code? This is a great question! It cuts to the heart of developer workflows, allows us to reflect on the core purpose of programming tools more broadly, and encourages us to share our perspective on where coding technologies are going over the long term. First, let’s explore what a programming language is for across three critical dimensions. ## The “Human to computer” specification One of my early passions when learning how to code was understanding how the whole stack worked, and I got involved in programming language design and implementation as a student. As part of that, my first viewpoint was that a programming language is an abstraction a human uses to express intent to the computer about what a piece of code is supposed to do. I learned that source code is a “recipe” that a compiler or interpreter translates into something the computer can understand. With this viewpoint, it makes sense for a programming language to be focused on exposing the capabilities of the machine in an accessible way that many humans can understand. A language should be designed to be written with an unambiguous interpretation that allows precise specification of an algorithm, or design, and being concise allows smart programmers to get much done quickly. This is one of the reasons that some “big” languages targeted to expert developers (like C++) accumulate syntactic sugar and core language features that enable the efficient expression of important things. While this viewpoint is valid, as I gained more experience, I realized that this is only one part of what programming languages do. ## The “Human to human” specification I learned very quickly that most interesting projects are built by teams of people and grow to the size where it is hard to fit all the code in your head. When this happens, new dynamics enter the software development realm – design discussions, code reviews, and 3rd-party library/package integrations. The best and most fulfilling software developments I have ever participated in have always been with groups of talented and dedicated people. In this context, one quickly realizes that the purpose of a programming language grows to be an abstraction for a human to express intent to another human about the behavior of a program. This still requires unambiguous specification but also shifts the goalposts – a language should be designed to be read, not just written by other humans. Computers are very tolerant and understanding (particularly with the rise of LLMs), so many of us benefit from clear design patterns and easy-to-understand code. Most code ends up being written once, but read and iterated on many times by many people. The consequence is that overly clever syntactic sugar actually starts to cut against the core goals of the language. Specialized syntax and infrequently used features can make it difficult to understand for those who didn’t write it. While LLMs and other tools can help decode or explain overly complicated code, keeping a single, readable source of truth is ideal. ## The “Computer to Human” specification With this lens, LLM-based code generation tools act like a new team member contributing, reading, and manipulating code in a project. There are many different examples with varied features and capabilities, e.g., a human prompt to generate code, an AI expert that reviews your code and offers suggestions to improve it, tools to automate the generation of unit tests, and other new capabilities are coming out all the time. The defining feature of these tools is that the computer generates source code that gets integrated into a product. While these capabilities are incredible, at least in the near future, these code-generation tools don’t displace the existing functions of a programming language. Indeed, one of the major concerns about language models today is trust – they can give strikingly amazing results in some cases but are often subtly wrong in others, and some are non-deterministic. As such, it becomes even more critical to design a language to be read, not just written by other humans, so we humans can review and approve generated code. Let’s consider some examples: if you prompted an LLM to build you a mobile app that processes online purchases, would you ship that without reviewing the source code to make sure it does billing right? Or, more extreme yet, would you want to send humans to the moon with code written by an LLM? This begs the ultimate question for developers – what margin of error and cost are we willing to accept? The unreliability of LLMs today means that, as code owners, we need to know if the prompt generated something with the right behavior - what does the generated code actually do? This is also why an LLM that directly generates low-level machine code isn’t interesting for general use cases – few people want to read, review, and validate machine code. As we look towards the future, we hope that LLMs will augment the developer experience and become more reliable and trustworthy over time. But even if this proves true, LLMs still won’t replace the need for programming languages. LLMs are likely to become a critical extension of the highly productive (“lazy”) developer – a substantial level-up vs copy/pasting from online references. Further, while LLMs will very likely automate away the boilerplate and repetitive parts of programming, there will always be use cases that require the human touch. While no one knows the future, we think humans will need to be in the loop for quite some time for many applications – particularly where the error margins are low, and resulting costs are high. ## What's the ideal programming language for LLMs to output? Those deep in software development find themselves surrounded by a zoo of different languages that aim to solve problems in various niches. You might have encountered Python for AI and data science, C and C++ for low-level programming, Javascript or Typescript for the web, Swift and Kotlin when building a mobile app, and CUDA for accelerator programming. These are all valuable languages, but given that LLMs reduce the need to care about how writable a syntax is – what qualities of a programming language matter in this new age? We believe there are three fundamental aspects of a programming language that would make it particularly useful as we head towards an AI-assisted world – its usability and scalability to many domains, the amount of training data that exists, and a rich and vibrant ecosystem. Let’s take each in turn: - The first most critical part of a language is the usability and scalability of the language implementation. The best language for an LLM is one that is highly usable and easy to read for humans, but whose implementation can scale to many different use cases and applications. Unfortunately, many language implementations include design decisions that preclude certain applications. For example, mark/sweep garbage collection isn’t ideal for low-level system software and accelerator programming, Python and other interpreted languages aren’t ideal when performance, parallelism, and threading are required, and JVM or .NET-based languages aren’t ideal for use cases that need small and low-dependence binaries. - To train an LLM that is capable of producing high-quality programs across many different use cases and applications, we need an expansive corpus of training data that seeds the model. An LLM will work much better on a popular and established language like Python which has a large and diverse set of open examples, than a niche or novel language that has no existing code to train on. - Lastly, we believe that a LLM needs a rich and vibrant ecosystem surrounding it. Even for existing LLM-based solutions, rich communities have already developed prompting libraries, tooling, and expertise enabling next-generation ecosystems to form. With this viewpoint, a language should be designed to unlock a massive community of developers – however we choose to define a developer in this new world, from traditional programming to instruction prompting and beyond. When we look at the vast number of existing programming languages, we see many points in the space, but they all provide tradeoffs optimized for different niches. How can we move the state-of-the-art forward? In our view, Mojo is a powerful contender to grow into an ideal language for LLMs, as it meets all three fundamental aspects above. ## Our approach with Mojo We’ve learned a lot from building other compiler and programming language systems (e.g., Clang/C++, Swift, etc) over the last 20+ years. From that experience, we are building Mojo to: - Be a fully compatible superset of Python, benefiting from its easy to read and understandable syntax and enabling its large community of developers to already know how to write Mojo! - Support system programming features and hardware accelerators that extend the performance and reach of Python into new domains as we move into a new parallel-computing world. - Be fully integrated with the existing Python ecosystem, extending and benefiting from all of the existing packages. We will also build seamless C and C++ interoperability to lift (and benefit from) work in those communities over time. - Provide a new high-performance heterogeneous compiler and runtime implementation that benefits from state-of-the-art techniques. As a consequence, we believe Mojo fits the perfect sweet spot for LLMs to generate and output highly scalable code, because it combines the human readability and usability of Python, but extends it with powerful lower-level systems features that enable it to scale across more hardware and drive the next set of the world’s applications and use cases. We think LLMs will continue to unlock creativity and productivity across many languages, but we also believe Mojo will be well prepared to lift collaborative software development to the next level and bring programming into new frontiers. Mojo is still early – we unveiled its 0.1 release last month –  but we are in this for the long term and have clear goals. If you are interested in being a part of Mojo early on, please join our community or apply to help us build it! ## Next blog post: - 🚨NEW🔥POPULAREngineeringAnnouncing stack-pr: an open source tool for managing stacked PRs on GitHubJuly 23, 2024 - Join our communityBuild the future of AI with us...and +125k developers - What is MAX?Learn more about our FREE framework for GenAI 🚨 NEW 🔥 POPULAR Engineering Announcing stack-pr: an open source tool for managing stacked PRs on GitHub July 23, 2024 Join our community Build the future of AI with us...and +125k developers What is MAX? Learn more about our FREE framework for GenAI View All Blogs Industry - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use Chris Lattner Co-Founder & CEO Distinguished Leader who founded and scaled critical infrastructure including LLVM, Clang, MLIR, Cloud TPUs and the Swift programming language. Chris built AI and core systems at multiple world leading technology companies including Apple, Google, SiFive and Tesla. [email protected] ================================================================================ URL: https://www.modular.com/blog-all?topic=Community PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/mohamed-mabrouk YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Mohamed+Mabrouk PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/values YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/team/alexandr-nikitin YOU LANDED IN THE WRONG SPOT # Page not found 🥺 The page you are looking for doesn't exist or has been moved. - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?author=Alexandr+Nikitin PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ URL: https://www.modular.com/blog-all?topic=Industry PRODUCT - MAX✨ MAX✨ Language - Mojo🔥 Mojo🔥 Quick Start - Install - Run LLMs - Pricing Install Run LLMs Pricing Take control of your AI Author: PRODUCT - Documentation - Tutorials - Blog Documentation Tutorials Blog Build - ✨ Prebuilt AI Pipelines - ✨ MAX Examples - 🔥 Mojo Examples - 🔥 Mojo Playground ✨ Prebuilt AI Pipelines ✨ MAX Examples 🔥 Mojo Examples 🔥 Mojo Playground Read - Join Discord - MAX Changelog - Newsletter Join Discord MAX Changelog Newsletter Bring your own fine-tuned model to MAX pipelines Author: MODULAR - About - Culture - Careers About Culture Careers Connect - Community - Contact Us - - - - - - Community Contact Us - - - - - ModCon 2023 Author: # All Articles  (X) Topics Topic Authors Authors 🚨 NEW Engineering ### Announcing stack-pr: an open source tool for managing stacked PRs on GitHub We are pleased to announce the release of a new tool aimed at simplifying the management of stacked pull requests (PRs) on GitHub - stack-pr. This tool is still in its early development days, but we are excited to share it with the community and welcome your contributions. July 23, 2024 / Mikhail Zolotukhin , 🚨 NEW 🔥 Popular Engineering ### Debugging in Mojo🔥 Developer tooling is a big priority for Mojo and MAX, we want to vastly improve the debugging experience compared to the traditional Python, C++, and CUDA stack. Machine learning often requires inspecting the state of a program after a long running process, requiring more control than what "print debugging" gives you. Over time this tooling will extend to GPUs, allowing you to step through CPU code into GPU calls with the same developer experience. July 16, 2024 / Jack Clayton , Walter Erquinigo , 🚨 NEW Product ### Bring your own PyTorch model The adoption of AI by enterprises has surged significantly over the last couple years, particularly with the advent of Generative AI (GenAI) and Large Language Models (LLMs). Most enterprises start by prototyping and building proof-of-concept products (POCs), using all-in-one API endpoints provided by big tech companies like OpenAI and Google, among others. However, as these companies transition to full-scale production, many are looking for ways to control their AI infrastructure. This requires the ability to effectively manage and deploy PyTorch. July 9, 2024 / Modular Team , 🚨 NEW Product ### Take control of your AI In today’s rapidly evolving technology landscape, adopting and rolling out AI to enhance your enterprise is critical to improving your organization’s productivity and ensuring that you are delivering a world-class product and service experience to your customers. AI is without question, the single most important technological revolution of our time—representing a new technology super-cycle that your enterprise cannot be left behind on. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Product ### Develop locally, deploy globally The recent surge in AI application development can be attributed to several factors: (1) advancements in machine learning algorithms that unlock previously intractable use cases, (2) the exponential growth in computational power enabling the training of ever-more complex models, and (3) the ubiquitous availability of vast datasets required to fuel these algorithms. However, as AI projects become increasingly pervasive, effective development paradigms, like those commonly found in traditional software development, remain elusive. July 9, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### A brief guide to the Mojo n-body example Since August 2023, the Mojo repository has included a small benchmark example titled nbody.mojo. This code is based on an example from The Computer Language Benchmarks Game, a site that benchmarks implementations of different algorithms in popular programming languages. July 3, 2024 / Chris Hoge , 🚨 NEW Developer ### What's new in MAX 24.4? MAX on macOS, fast local Llama3, native quantization and GGUF support In our recent MAX 24.4 release, we announced the availability of MAX on MacOS and MAX Pipelines with native support for local Generative AI models such as Llama3. Together, these innovations establish a new industry standard paradigm, enabling developers to leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. June 25, 2024 / Ehsan M. Kermani , 🚨 NEW Developer ### What’s new in Mojo 24.4? Improved collections, new traits, os module features and core language enhancements Mojo 24.4 is now available for download, and this release includes several core language and standard library enhancements. In this blog post, we’ll dive deep into many of these features using code examples. One of the biggest highlights of this release is that we received 214 pull requests from 18 community contributors for new product features, bug fixes, documentation enhancements, and code refactoring. These contributions resulted in 30 net new features in the standard library, accounting for 11% of all improvements in this release. We’re incredibly proud of the momentum we’re seeing with community contributions, and it goes without saying – you are the real star of this release. On behalf of the entire Mojo team, we’d like to thank you for all your contributions to making Mojo awesome! June 17, 2024 / Shashank Prasanna , 🚨 NEW Product ### MAX 24.4 - Introducing quantization APIs and MAX on macOS Today, we're thrilled to announce the release of MAX 24.4, which introduces a powerful new quantization API for MAX Graphs and extends MAX’s reach to macOS. Together, these unlock a new industry standard paradigm where developers can leverage a single toolchain to build Generative AI pipelines locally and seamlessly deploy them to the cloud, all with industry-leading performance. Leveraging the Quantization API reduces the latency and memory cost of Generative AI pipelines by up to 8x on desktop architectures like macOS, and up to 7x on cloud CPU architectures like Intel and Graviton, without requiring developers to rewrite models or update any application code. June 7, 2024 / Modular Team , 🚨 NEW 🔥 Popular Developer ### Deep dive into ownership in Mojo This post blog is the second part of the series of ownership in Mojo. Please make sure to check out the first part, What Ownership is Really About: A Mental Model Approach, as we will build on concepts developed there. This post serves as accompanying material for the deep dive on ownership by our CEO, Chris Lattner. Be sure to watch the video as well, which covers how ownership is implemented in Mojo's compiler, providing further insights and technical details. June 4, 2024 / Ehsan M. Kermani , 🤔 No results for this query Reset all filters - Join our communityBuild the future of AI with us...and +125k developers - Browse examplesRun a project locally in just 2min - What is MAX?Learn more about our FREE framework for GenAI Join our community Build the future of AI with us...and +125k developers Browse examples Run a project locally in just 2min What is MAX? Learn more about our FREE framework for GenAI - ProductMAXMojo🔥Docs - MAX - Mojo🔥 - Docs - QUICK STARTGet Started with MAXRun AI under 3 minsMAX PricingDevelop local, Deploy global - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global - DEVELOPERSMAX PipelinesInstall MAXMAX API ReferenceMAX ChangelogMojo 🔥 Playground - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground - ENTERPRISESMAX for EnterprisesPricingTalk to Sales - MAX for Enterprises - Pricing - Talk to Sales - SUPPORTBlogCommunityModverse WeeklyAI ResourcesReport Issue - Blog - Community - Modverse Weekly - AI Resources - Report Issue - CompanyAbout UsCultureCareersContact - About Us - Culture - Careers - Contact Product - MAX - Mojo🔥 - Docs MAX Mojo🔥 Docs QUICK START - Get Started with MAX - Run AI under 3 mins - MAX Pricing - Develop local, Deploy global Get Started with MAX Run AI under 3 mins MAX Pricing Develop local, Deploy global DEVELOPERS - MAX Pipelines - Install MAX - MAX API Reference - MAX Changelog - Mojo 🔥 Playground MAX Pipelines Install MAX MAX API Reference MAX Changelog Mojo 🔥 Playground ENTERPRISES - MAX for Enterprises - Pricing - Talk to Sales MAX for Enterprises Pricing Talk to Sales SUPPORT - Blog - Community - Modverse Weekly - AI Resources - Report Issue Blog Community Modverse Weekly AI Resources Report Issue Company - About Us - Culture - Careers - Contact About Us Culture Careers Contact - - - - - Copyright © 2024 Modular Inc Terms, Privacy & Acceptable Use ================================================================================ --- LICENSE --- MIT License Copyright (c) 2024 Maxim Zaks Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.MD --- # MOJO-Sort Implementation of different sorting algorithms in Mojo --- benchmark.mojo --- from csv import CsvBuilder from random import random_ui64, random_si64, random_float64 from memory.unsafe import bitcast from my_utils import print_v from time import now from quick_sort import quick_sort from radix_sorting import radix_sort, radix_sort11, radix_sort13, radix_sort16 from selection_sort import selection_sort from insertion_sort import insertion_sort from count_sort import counting_sort from tim_sort import tim_sort, parallel_tim_sort fn random_vec[D: DType](size: Int, max: Int = 3000) -> List[SIMD[D, 1]]: var result = List[SIMD[D, 1]](size) for _ in range(size): @parameter if D == DType.int8 or D == DType.int16 or D == DType.int32 or D == DType.int64: result.append(random_si64(0, max).cast[D]()) elif D == DType.float16 or D == DType.float32 or D == DType.float64: result.append(random_float64(0, max).cast[D]()) else: result.append(random_ui64(0, max).cast[D]()) return result fn assert_sorted[D: DType](vector: List[SIMD[D, 1]], inout builder: CsvBuilder): for i in range(1, len(vector)): if vector[i] < vector[i - 1]: builder.push(False, False) return builder.push(True, False) fn benchmark[D: DType, func: fn(inout List[SIMD[D, 1]]) -> None]( name: StringLiteral, size: Int, inout builder: CsvBuilder, max: Int = 3000, ): var v = random_vec[D](size, max) var v1 = v var min_duration = Int64.MAX for _ in range(10): v1 = v var tik = now() func(v1) var tok = now() min_duration = min(min_duration, tok - tik) builder.push(name, False) builder.push(str(D), False) builder.push(size, False) builder.push(max, False) builder.push(min_duration, False) builder.push(min_duration // size, False) assert_sorted[D](v1, builder) fn std_sort[D: DType](inout vector: List[SIMD[D, 1]]): sort[D](vector) fn main(): var builder = CsvBuilder("Algorithm name", "DType", "List size", "Max value", "Min total duration", "Min duration per element", "Sorted") benchmark[DType.uint8, selection_sort[DType.uint8]]("Selection sort", 5, builder) benchmark[DType.uint8, insertion_sort[DType.uint8]]("Insertion sort", 5, builder) benchmark[DType.uint8, std_sort[DType.uint8]]("Std sort", 5, builder) benchmark[DType.uint8, quick_sort[DType.uint8]]("Quick sort", 5, builder) benchmark[DType.uint8, tim_sort[DType.uint8]]("Tim sort", 5, builder) benchmark[DType.uint8, counting_sort[DType.uint8]]("Counting sort", 5, builder) benchmark[DType.uint8, radix_sort[DType.uint8]]("Radix sort", 5, builder) benchmark[DType.uint8, selection_sort[DType.uint8]]("Selection sort", 20, builder) benchmark[DType.uint8, insertion_sort[DType.uint8]]("Insertion sort", 20, builder) benchmark[DType.uint8, std_sort[DType.uint8]]("Std sort", 20, builder) benchmark[DType.uint8, quick_sort[DType.uint8]]("Quick sort", 20, builder) benchmark[DType.uint8, tim_sort[DType.uint8]]("Tim sort", 20, builder) benchmark[DType.uint8, counting_sort[DType.uint8]]("Counting sort", 20, builder) benchmark[DType.uint8, radix_sort[DType.uint8]]("Radix sort", 20, builder) benchmark[DType.uint8, selection_sort[DType.uint8]]("Selection sort", 50, builder) benchmark[DType.uint8, insertion_sort[DType.uint8]]("Insertion sort", 50, builder) benchmark[DType.uint8, std_sort[DType.uint8]]("Std sort", 50, builder) benchmark[DType.uint8, quick_sort[DType.uint8]]("Quick sort", 50, builder) benchmark[DType.uint8, tim_sort[DType.uint8]]("Tim sort", 50, builder) benchmark[DType.uint8, counting_sort[DType.uint8]]("Counting sort", 50, builder) benchmark[DType.uint8, radix_sort[DType.uint8]]("Radix sort", 50, builder) benchmark[DType.uint8, selection_sort[DType.uint8]]("Selection sort", 300, builder) benchmark[DType.uint8, insertion_sort[DType.uint8]]("Insertion sort", 300, builder) benchmark[DType.uint8, std_sort[DType.uint8]]("Std sort", 300, builder) benchmark[DType.uint8, quick_sort[DType.uint8]]("Quick sort", 300, builder) benchmark[DType.uint8, tim_sort[DType.uint8]]("Tim sort", 300, builder) benchmark[DType.uint8, counting_sort[DType.uint8]]("Counting sort", 300, builder) benchmark[DType.uint8, radix_sort[DType.uint8]]("Radix sort", 300, builder) benchmark[DType.int8, selection_sort[DType.int8]]("Selection sort", 300, builder) benchmark[DType.int8, insertion_sort[DType.int8]]("Insertion sort", 300, builder) benchmark[DType.int8, std_sort[DType.int8]]("Std sort", 300, builder) benchmark[DType.int8, quick_sort[DType.int8]]("Quick sort", 300, builder) benchmark[DType.int8, tim_sort[DType.int8]]("Tim sort", 300, builder) benchmark[DType.int8, parallel_tim_sort[DType.int8]]("Parallel Tim sort", 300, builder) benchmark[DType.int8, radix_sort[DType.int8]]("Radix sort", 300, builder) benchmark[DType.uint16, selection_sort[DType.uint16]]("Selection sort", 3000, builder) benchmark[DType.uint16, insertion_sort[DType.uint16]]("Insertion sort", 3000, builder) benchmark[DType.uint16, std_sort[DType.uint16]]("Std sort", 3000, builder) benchmark[DType.uint16, quick_sort[DType.uint16]]("Quick sort", 3000, builder) benchmark[DType.uint16, tim_sort[DType.uint16]]("Tim sort", 3000, builder) benchmark[DType.uint16, parallel_tim_sort[DType.uint16]]("Parallel Tim sort", 3000, builder) benchmark[DType.uint16, counting_sort[DType.uint16]]("Counting sort", 3000, builder) benchmark[DType.uint16, radix_sort[DType.uint16]]("Radix sort", 3000, builder) benchmark[DType.int16, selection_sort[DType.int16]]("Selection sort", 3000, builder) benchmark[DType.int16, insertion_sort[DType.int16]]("Insertion sort", 3000, builder) benchmark[DType.int16, std_sort[DType.int16]]("Std sort", 3000, builder) benchmark[DType.int16, quick_sort[DType.int16]]("Quick sort", 3000, builder) benchmark[DType.int16, tim_sort[DType.int16]]("Tim sort", 3000, builder) benchmark[DType.int16, parallel_tim_sort[DType.int16]]("Parallel Tim sort", 3000, builder) benchmark[DType.int16, radix_sort[DType.int16]]("Radix sort", 3000, builder) benchmark[DType.float16, selection_sort[DType.float16]]("Selection sort", 3000, builder) benchmark[DType.float16, insertion_sort[DType.float16]]("Insertion sort", 3000, builder) benchmark[DType.float16, std_sort[DType.float16]]("Std sort", 3000, builder) benchmark[DType.float16, quick_sort[DType.float16]]("Quick sort", 3000, builder) benchmark[DType.float16, tim_sort[DType.float16]]("Tim sort", 3000, builder) benchmark[DType.float16, parallel_tim_sort[DType.float16]]("Parallel Tim sort", 3000, builder) benchmark[DType.float16, radix_sort[DType.float16]]("Radix sort", 3000, builder) benchmark[DType.uint32, std_sort[DType.uint32]]("Std sort", 300_000, builder, 2_000_000_000) benchmark[DType.uint32, quick_sort[DType.uint32]]("Quick sort", 300_000, builder, 2_000_000_000) benchmark[DType.uint32, tim_sort[DType.uint32]]("Tim sort", 300_000, builder, 2_000_000_000) benchmark[DType.uint32, parallel_tim_sort[DType.uint32]]("Parallel Tim sort", 300_000, builder, 2_000_000_000) benchmark[DType.uint32, radix_sort[DType.uint32]]("Radix sort", 300_000, builder, 2_000_000_000) benchmark[DType.uint32, radix_sort11[DType.uint32]]("Radix sort 11", 300_000, builder, 2_000_000_000) benchmark[DType.int32, std_sort[DType.int32]]("Std sort", 300_000, builder, 2_000_000_000) benchmark[DType.int32, quick_sort[DType.int32]]("Quick sort", 300_000, builder, 2_000_000_000) benchmark[DType.int32, tim_sort[DType.int32]]("Tim sort", 300_000, builder, 2_000_000_000) benchmark[DType.int32, parallel_tim_sort[DType.int32]]("Parallel Tim sort", 300_000, builder, 2_000_000_000) benchmark[DType.int32, radix_sort[DType.int32]]("Radix sort", 300_000, builder, 2_000_000_000) benchmark[DType.int32, radix_sort11[DType.int32]]("Radix sort 11", 300_000, builder, 2_000_000_000) benchmark[DType.float32, std_sort[DType.float32]]("Std sort", 5_000_000, builder, 2_000_000_000) benchmark[DType.float32, quick_sort[DType.float32]]("Quick sort", 5_000_000, builder, 2_000_000_000) benchmark[DType.float32, tim_sort[DType.float32]]("Tim sort", 5_000_000, builder, 2_000_000_000) benchmark[DType.float32, parallel_tim_sort[DType.float32]]("Parallel Tim sort", 5_000_000, builder, 2_000_000_000) benchmark[DType.float32, radix_sort[DType.float32]]("Radix sort", 5_000_000, builder, 2_000_000_000) benchmark[DType.float32, radix_sort11[DType.float32]]("Radix sort 11", 5_000_000, builder, 2_000_000_000) benchmark[DType.uint64, std_sort[DType.uint64]]("Std sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.uint64, quick_sort[DType.uint64]]("Quick sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.uint64, tim_sort[DType.uint64]]("Tim sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.uint64, parallel_tim_sort[DType.uint64]]("Parallel Tim sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.uint64, radix_sort[DType.uint64]]("Radix sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.uint64, radix_sort13[DType.uint64]]("Radix sort 13", 3_000_000, builder, 200_000_000_000) benchmark[DType.int64, std_sort[DType.int64]]("Std sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.int64, quick_sort[DType.int64]]("Quick sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.int64, tim_sort[DType.int64]]("Tim sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.int64, parallel_tim_sort[DType.int64]]("Parallel Tim sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.int64, radix_sort[DType.int64]]("Radix sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.int64, radix_sort13[DType.int64]]("Radix sort 13", 3_000_000, builder, 200_000_000_000) benchmark[DType.float64, std_sort[DType.float64]]("Std sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.float64, quick_sort[DType.float64]]("Quick sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.float64, tim_sort[DType.float64]]("Tim sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.float64, parallel_tim_sort[DType.float64]]("Parallel Tim sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.float64, radix_sort[DType.float64]]("Radix sort", 3_000_000, builder, 200_000_000_000) benchmark[DType.float64, radix_sort13[DType.float64]]("Radix sort 13", 3_000_000, builder, 200_000_000_000) benchmark[DType.float64, radix_sort16]("Radix sort 16", 3_000_000, builder, 200_000_000_000) benchmark[DType.float64, std_sort[DType.float64]]("Std sort", 300, builder, 200) benchmark[DType.float64, quick_sort[DType.float64]]("Quick sort", 300, builder, 200) benchmark[DType.float64, tim_sort[DType.float64]]("Tim sort", 300, builder, 200) benchmark[DType.float64, parallel_tim_sort[DType.float64]]("Parallel Tim sort", 300, builder, 200) benchmark[DType.float64, radix_sort[DType.float64]]("Radix sort", 300, builder, 200) benchmark[DType.float64, radix_sort13[DType.float64]]("Radix sort 13", 300, builder, 200) benchmark[DType.float64, radix_sort16]("Radix sort 16", 300, builder, 200) # for i in range(1000, 200_000, 1000): # benchmark[DType.float32, radix_sort[DType.float32]]("Radix sort", i, builder, 2_000_000_000) # benchmark[DType.float64, radix_sort[DType.float64]]("Radix sort", i, builder, 2_000_000_000) # benchmark[DType.float32, radix_sort11[DType.float32]]("Radix sort 11", i, builder, 2_000_000_000) # benchmark[DType.float64, radix_sort13[DType.float64]]("Radix sort 13", i, builder, 2_000_000_000) print(builder^.finish()) --- benchmark_result_i7.csv --- Algorithm name,DType,List size,Max value,Min total duration,Min duration per element,Sorted Selection sort,uint8,5,3000,26,5,True Insertion sort,uint8,5,3000,19,3,True Std sort,uint8,5,3000,115,23,True Quick sort,uint8,5,3000,35,7,True Tim sort,uint8,5,3000,22,4,True Counting sort,uint8,5,3000,518,103,True Radix sort,uint8,5,3000,215,43,True Selection sort,uint8,20,3000,131,6,True Insertion sort,uint8,20,3000,54,2,True Std sort,uint8,20,3000,154,7,True Quick sort,uint8,20,3000,121,6,True Tim sort,uint8,20,3000,107,5,True Counting sort,uint8,20,3000,583,29,True Radix sort,uint8,20,3000,228,11,True Selection sort,uint8,50,3000,711,14,True Insertion sort,uint8,50,3000,361,7,True Std sort,uint8,50,3000,776,15,True Quick sort,uint8,50,3000,516,10,True Tim sort,uint8,50,3000,591,11,True Counting sort,uint8,50,3000,677,13,True Radix sort,uint8,50,3000,275,5,True Selection sort,uint8,300,3000,32080,106,True Insertion sort,uint8,300,3000,10218,34,True Std sort,uint8,300,3000,5930,19,True Quick sort,uint8,300,3000,4711,15,True Tim sort,uint8,300,3000,6420,21,True Counting sort,uint8,300,3000,1005,3,True Radix sort,uint8,300,3000,581,1,True Selection sort,int8,300,3000,27100,90,True Insertion sort,int8,300,3000,8834,29,True Std sort,int8,300,3000,6214,20,True Quick sort,int8,300,3000,4265,14,True Tim sort,int8,300,3000,4855,16,True Parallel Tim sort,int8,300,3000,17922,59,True Radix sort,int8,300,3000,490,1,True Selection sort,uint16,3000,3000,2283103,761,True Insertion sort,uint16,3000,3000,903909,301,True Std sort,uint16,3000,3000,110652,36,True Quick sort,uint16,3000,3000,124374,41,True Tim sort,uint16,3000,3000,94588,31,True Parallel Tim sort,uint16,3000,3000,64991,21,True Counting sort,uint16,3000,3000,13572,4,True Radix sort,uint16,3000,3000,7250,2,True Selection sort,int16,3000,3000,2289158,763,True Insertion sort,int16,3000,3000,888161,296,True Std sort,int16,3000,3000,116783,38,True Quick sort,int16,3000,3000,132958,44,True Tim sort,int16,3000,3000,95076,31,True Parallel Tim sort,int16,3000,3000,63027,21,True Radix sort,int16,3000,3000,9221,3,True Selection sort,float16,3000,3000,4196472,1398,True Insertion sort,float16,3000,3000,2103017,701,True Std sort,float16,3000,3000,224381,74,True Quick sort,float16,3000,3000,151287,50,True Tim sort,float16,3000,3000,162352,54,True Parallel Tim sort,float16,3000,3000,87313,29,True Radix sort,float16,3000,3000,10912,3,True Std sort,uint32,300000,2000000000,21969772,73,True Quick sort,uint32,300000,2000000000,21148206,70,True Tim sort,uint32,300000,2000000000,15918864,53,True Parallel Tim sort,uint32,300000,2000000000,6890569,22,True Radix sort,uint32,300000,2000000000,2276633,7,True Radix sort 11,uint32,300000,2000000000,2323702,7,True Std sort,int32,300000,2000000000,21937529,73,True Quick sort,int32,300000,2000000000,20777250,69,True Tim sort,int32,300000,2000000000,16003725,53,True Parallel Tim sort,int32,300000,2000000000,6844498,22,True Radix sort,int32,300000,2000000000,2299347,7,True Radix sort 11,int32,300000,2000000000,2352531,7,True Std sort,float32,5000000,2000000000,504485446,100,True Quick sort,float32,5000000,2000000000,448023078,89,True Tim sort,float32,5000000,2000000000,349352149,69,True Parallel Tim sort,float32,5000000,2000000000,135811541,27,True Radix sort,float32,5000000,2000000000,50109996,10,True Radix sort 11,float32,5000000,2000000000,47750934,9,True Std sort,uint64,3000000,200000000000,283869222,94,True Quick sort,uint64,3000000,200000000000,254671312,84,True Tim sort,uint64,3000000,200000000000,195589013,65,True Parallel Tim sort,uint64,3000000,200000000000,84258283,28,True Radix sort,uint64,3000000,200000000000,77239379,25,True Radix sort 13,uint64,3000000,200000000000,58921306,19,True Std sort,int64,3000000,200000000000,264787746,88,True Quick sort,int64,3000000,200000000000,244645935,81,True Tim sort,int64,3000000,200000000000,193942385,64,True Parallel Tim sort,int64,3000000,200000000000,83949517,27,True Radix sort,int64,3000000,200000000000,77933791,25,True Radix sort 13,int64,3000000,200000000000,58967876,19,True Std sort,float64,3000000,200000000000,297268154,99,True Quick sort,float64,3000000,200000000000,256048485,85,True Tim sort,float64,3000000,200000000000,207751741,69,True Parallel Tim sort,float64,3000000,200000000000,86875550,28,True Radix sort,float64,3000000,200000000000,83552900,27,True Radix sort 13,float64,3000000,200000000000,68885139,22,True Radix sort 16,float64,3000000,200000000000,113632305,37,True Std sort,float64,300,200,5216,17,True Quick sort,float64,300,200,4392,14,True Tim sort,float64,300,200,7840,26,True Parallel Tim sort,float64,300,200,17869,59,True Radix sort,float64,300,200,6472,21,True Radix sort 13,float64,300,200,19146,63,True Radix sort 16,float64,300,200,108474,361,True --- benchmark_result_m1.csv --- Algorithm name,DType,List size,Max value,Min total duration,Min duration per element,Sorted Selection sort,uint8,5,3000,0,0,True Insertion sort,uint8,5,3000,0,0,True Std sort,uint8,5,3000,0,0,True Quick sort,uint8,5,3000,0,0,True Tim sort,uint8,5,3000,0,0,True Counting sort,uint8,5,3000,0,0,True Radix sort,uint8,5,3000,0,0,True Selection sort,uint8,20,3000,0,0,True Insertion sort,uint8,20,3000,0,0,True Std sort,uint8,20,3000,0,0,True Quick sort,uint8,20,3000,0,0,True Tim sort,uint8,20,3000,0,0,True Counting sort,uint8,20,3000,0,0,True Radix sort,uint8,20,3000,0,0,True Selection sort,uint8,50,3000,2000,40,True Insertion sort,uint8,50,3000,0,0,True Std sort,uint8,50,3000,1000,20,True Quick sort,uint8,50,3000,0,0,True Tim sort,uint8,50,3000,0,0,True Counting sort,uint8,50,3000,0,0,True Radix sort,uint8,50,3000,0,0,True Selection sort,uint8,300,3000,82000,273,True Insertion sort,uint8,300,3000,10000,33,True Std sort,uint8,300,3000,5000,16,True Quick sort,uint8,300,3000,3000,10,True Tim sort,uint8,300,3000,6000,20,True Counting sort,uint8,300,3000,1000,3,True Radix sort,uint8,300,3000,0,0,True Selection sort,int8,300,3000,83000,276,True Insertion sort,int8,300,3000,10000,33,True Std sort,int8,300,3000,5000,16,True Quick sort,int8,300,3000,2000,6,True Tim sort,int8,300,3000,5000,16,True Parallel Tim sort,int8,300,3000,9000,30,True Radix sort,int8,300,3000,0,0,True Selection sort,uint16,3000,3000,8334000,2778,True Insertion sort,uint16,3000,3000,826000,275,True Std sort,uint16,3000,3000,125000,41,True Quick sort,uint16,3000,3000,115000,38,True Tim sort,uint16,3000,3000,92000,30,True Parallel Tim sort,uint16,3000,3000,43000,14,True Counting sort,uint16,3000,3000,10000,3,True Radix sort,uint16,3000,3000,9000,3,True Selection sort,int16,3000,3000,8314000,2771,True Insertion sort,int16,3000,3000,820000,273,True Std sort,int16,3000,3000,114000,38,True Quick sort,int16,3000,3000,113000,37,True Tim sort,int16,3000,3000,89000,29,True Parallel Tim sort,int16,3000,3000,44000,14,True Radix sort,int16,3000,3000,9000,3,True Selection sort,float16,3000,3000,15164000,5054,True Insertion sort,float16,3000,3000,821000,273,True Std sort,float16,3000,3000,196000,65,True Quick sort,float16,3000,3000,131000,43,True Tim sort,float16,3000,3000,120000,40,True Parallel Tim sort,float16,3000,3000,59000,19,True Radix sort,float16,3000,3000,10000,3,True Std sort,uint32,300000,2000000000,23014000,76,True Quick sort,uint32,300000,2000000000,19129000,63,True Tim sort,uint32,300000,2000000000,16276000,54,True Parallel Tim sort,uint32,300000,2000000000,5938000,19,True Radix sort,uint32,300000,2000000000,1638000,5,True Radix sort 11,uint32,300000,2000000000,786000,2,True Std sort,int32,300000,2000000000,22785000,75,True Quick sort,int32,300000,2000000000,19529000,65,True Tim sort,int32,300000,2000000000,16207000,54,True Parallel Tim sort,int32,300000,2000000000,6052000,20,True Radix sort,int32,300000,2000000000,1608000,5,True Radix sort 11,int32,300000,2000000000,759000,2,True Std sort,float32,5000000,2000000000,762011000,152,True Quick sort,float32,5000000,2000000000,445898000,89,True Tim sort,float32,5000000,2000000000,467927000,93,True Parallel Tim sort,float32,5000000,2000000000,167810000,33,True Radix sort,float32,5000000,2000000000,49216000,9,True Radix sort 11,float32,5000000,2000000000,22456000,4,True Std sort,uint64,3000000,200000000000,287128000,95,True Quick sort,uint64,3000000,200000000000,228464000,76,True Tim sort,uint64,3000000,200000000000,194782000,64,True Parallel Tim sort,uint64,3000000,200000000000,71029000,23,True Radix sort,uint64,3000000,200000000000,77167000,25,True Radix sort 13,uint64,3000000,200000000000,34409000,11,True Std sort,int64,3000000,200000000000,289589000,96,True Quick sort,int64,3000000,200000000000,228832000,76,True Tim sort,int64,3000000,200000000000,195940000,65,True Parallel Tim sort,int64,3000000,200000000000,70936000,23,True Radix sort,int64,3000000,200000000000,77585000,25,True Radix sort 13,int64,3000000,200000000000,33498000,11,True Std sort,float64,3000000,200000000000,426790000,142,True Quick sort,float64,3000000,200000000000,260657000,86,True Tim sort,float64,3000000,200000000000,275008000,91,True Parallel Tim sort,float64,3000000,200000000000,99226000,33,True Radix sort,float64,3000000,200000000000,61548000,20,True Radix sort 13,float64,3000000,200000000000,27283000,9,True Radix sort 16,float64,3000000,200000000000,29580000,9,True Std sort,float64,300,200,8000,26,True Quick sort,float64,300,200,3000,10,True Tim sort,float64,300,200,7000,23,True Parallel Tim sort,float64,300,200,9000,30,True Radix sort,float64,300,200,5000,16,True Radix sort 13,float64,300,200,13000,43,True Radix sort 16,float64,300,200,67000,223,True --- benchmark_results_string.csv --- Description ,Min ,Max ,Mean ,Valid report1_i1 , 8670.4295000000002 , 9500.9500000000007 , 8829.007583147164 ,True report1_i2 , 9093.6499999999996 , 9946.9372000000003 , 9672.6625279123946 ,True report1_i3 , 9236.9116764821356 , 10092.879999999999 , 9353.6179758703256 ,True report1_q1 , 2743.6100000000001 , 2864.5824600000001 , 2860.7301638016379 ,True report1_q2 , 2920.7449999999999 , 3354.5999999999999 , 2946.4195391953917 ,True report1_q3 , 2675.6869999999999 , 3132.5999999999999 , 2779.8596660966609 ,True report1_mk , 6639.7950000000001 , 7212.1499999999996 , 6800.5854160434401 ,True report2_i1 ,744033.54500000004 ,749001.58488228009 ,746875.64375340973 ,True report2_i2 ,795199.76165113179 ,809460.47999999998 ,798331.27469316195 ,True report2_i3 ,861132.96499999997 ,891410.40000000002 ,871370.87476751395 ,True report2_q1 , 90793.070000000007 , 95843.25 , 92005.819681791399 ,True report2_q2 , 76527.300000000003 , 78606.084000000003 , 77902.188653451813 ,True report2_q3 , 85063.540839804424 , 90064.0 , 85297.308209047202 ,True report2_mk , 67112.149999999994 , 69623.619999999995 , 69162.064636451891 ,True report3_i1 ,751833.5 ,760428.14500000002 ,759175.65609348915 ,True report3_i2 ,806958.25 ,816323.73082099599 ,813639.94838709675 ,True report3_i3 ,873776.39149560116 ,879470.10204081633 ,876736.68639798486 ,True report3_q1 ,111312.82000000001 ,116434.85000000001 ,112345.99162401116 ,True report3_q2 , 96744.550000000003 , 98665.184999999998 , 98275.350489685356 ,True report3_q3 ,100821.22500000001 ,108237.25 ,101734.74620374991 ,True report3_mk , 62869.5 , 64815.38149105796 , 64699.896689442787 ,True report4_i1 ,868929.40000000002 ,880799.15689149557 ,879898.7940619078 ,True report4_i2 ,790169.80000000005 ,809604.32620320853 ,804411.38613861392 ,True report4_i3 ,831506.62 ,850880.65000000002 ,832406.31809981959 ,True report4_q1 ,103625.49000000001 ,106604.10293079096 ,106054.73119787438 ,True report4_q2 , 74606.0 , 76254.075500000006 , 75364.190478826466 ,True report4_q3 , 83998.54375876578 , 89821.050000000003 , 84094.012672811063 ,True report4_mk ,102392.89999999999 ,104794.155 ,104547.87280285901 ,True report5_i1 ,735329.84999999998 ,740583.07160493825 ,739814.2721347094 ,True report5_i2 ,803582.35790884716 ,806578.59999999998 ,804280.3366452367 ,True report5_i3 ,882083.51479289937 ,902176.65000000002 ,883030.96317460318 ,True report5_q1 , 84418.759999999995 , 87025.75 , 85613.668662797878 ,True report5_q2 , 72070.600000000006 , 73738.111999999994 , 73298.788104490508 ,True report5_q3 , 76725.389999999999 , 84705.25 , 77478.265300408762 ,True report5_mk , 75602.443044354834 , 83131.25 , 75791.774805151726 ,True report6_i1 , 154.61949999999999 , 356.69999999999999 , 163.84367028188402 ,True report6_i2 , 177.83150000000001 , 591.25 , 190.22664137576271 ,True report6_i3 , 135.44999999999999 , 151.77500000000001 , 148.29590415557033 ,True report6_q1 , 136.68186499999999 , 175.58000000000001 , 137.02628858616842 ,True report6_q2 , 136.17949999999999 , 368.60000000000002 , 146.42482569120287 ,True report6_q3 , 120.6023 , 144.84999999999999 , 125.54540954498935 ,True report6_mk , 305.11045000000001 , 522.29999999999995 , 305.90837658540153 ,True report7_i1 , 14617.4735 , 15562.695 , 15031.489655505629 ,True report7_i2 , 13774.65 , 14742.3665 , 14718.916224569377 ,True report7_i3 , 11105.532775141874 , 12392.965 , 11137.029871298782 ,True report7_q1 , 20061.113099999999 , 21441.599999999999 , 20078.989966811823 ,True report7_q2 , 18197.494999999999 , 18857.589490196078 , 18840.143673167575 ,True report7_q3 , 16445.266725231286 , 16535.795999999998 , 16472.353697444483 ,True report7_mk , 20072.799999999999 , 21267.099999999999 , 20453.143672269394 ,True --- benchmark_string_sort.mojo --- from benchmark import run from my_utils import corpus1, corpus2, corpus3, corpus4, corpus5, corpus6, corpus7 from insertion_sort import insertion_sort from string_compare import lt from multi_key_quicksort import multi_key_quicksort from quick_sort import quick_sort from radix_sorting import msb_radix_sort from tim_sort import tim_sort, parallel_tim_sort from csv import CsvBuilder fn in_sort[get_corpus: fn () -> List[String], lte:fn (String, String) -> Bool](): var corpus = get_corpus() insertion_sort[String, lte](corpus) fn mk_sort[get_corpus: fn () -> List[String]](): var corpus = get_corpus() multi_key_quicksort(corpus) fn qk_sort[get_corpus: fn () -> List[String], lte:fn (String, String) -> Bool](): var corpus = get_corpus() quick_sort[String, lte](corpus) fn msb_radix[get_corpus: fn () -> List[String]](): var corpus = get_corpus() msb_radix_sort(corpus) fn std_sort[get_corpus: fn () -> List[String]](): var corpus = get_corpus() sort(corpus) fn tm_sort[get_corpus: fn () -> List[String]](): var corpus = get_corpus() tim_sort(corpus) fn ptm_sort[get_corpus: fn () -> List[String]](): var corpus = get_corpus() parallel_tim_sort(corpus) fn report_mean[f: fn()-> None](description: StringLiteral): var report1_mk = run[f]() print(description, report1_mk.mean("ns")) fn main(): report_mean[in_sort[corpus1, lt]]("report1_ins") report_mean[qk_sort[corpus1, lt]]("report1_qks") report_mean[mk_sort[corpus1]]("report1_mks") report_mean[msb_radix[corpus1]]("report1_rdx") report_mean[std_sort[corpus1]]("report1_std") report_mean[tm_sort[corpus1]]("report1_tms") report_mean[ptm_sort[corpus1]]("report1_ptm") report_mean[in_sort[corpus2, lt]]("report2_ins") report_mean[qk_sort[corpus2, lt]]("report2_qks") report_mean[mk_sort[corpus2]]("report2_mks") report_mean[msb_radix[corpus2]]("report2_rdx") report_mean[std_sort[corpus2]]("report2_std") report_mean[tm_sort[corpus2]]("report2_tms") report_mean[ptm_sort[corpus2]]("report2_ptm") report_mean[in_sort[corpus3, lt]]("report3_ins") report_mean[qk_sort[corpus3, lt]]("report3_qks") report_mean[mk_sort[corpus3]]("report3_mks") report_mean[msb_radix[corpus3]]("report3_rdx") report_mean[std_sort[corpus3]]("report3_std") report_mean[tm_sort[corpus3]]("report3_tms") report_mean[ptm_sort[corpus3]]("report3_ptm") report_mean[in_sort[corpus4, lt]]("report4_ins") report_mean[qk_sort[corpus4, lt]]("report4_qks") report_mean[mk_sort[corpus4]]("report4_mks") report_mean[msb_radix[corpus4]]("report4_rdx") report_mean[std_sort[corpus4]]("report4_std") report_mean[tm_sort[corpus4]]("report4_tms") report_mean[ptm_sort[corpus4]]("report4_ptm") report_mean[in_sort[corpus5, lt]]("report5_ins") report_mean[qk_sort[corpus5, lt]]("report5_qks") report_mean[mk_sort[corpus5]]("report5_mks") report_mean[msb_radix[corpus5]]("report5_rdx") report_mean[std_sort[corpus5]]("report5_std") report_mean[tm_sort[corpus5]]("report5_tms") report_mean[ptm_sort[corpus5]]("report5_ptm") report_mean[in_sort[corpus6, lt]]("report6_ins") report_mean[qk_sort[corpus6, lt]]("report6_qks") report_mean[mk_sort[corpus6]]("report6_mks") report_mean[msb_radix[corpus6]]("report6_rdx") report_mean[std_sort[corpus6]]("report6_std") report_mean[tm_sort[corpus6]]("report6_tms") report_mean[ptm_sort[corpus6]]("report6_ptm") report_mean[in_sort[corpus7, lt]]("report7_ins") report_mean[qk_sort[corpus7, lt]]("report7_qks") report_mean[mk_sort[corpus7]]("report7_mks") report_mean[msb_radix[corpus7]]("report7_rxd") report_mean[std_sort[corpus7]]("report7_std") report_mean[tm_sort[corpus7]]("report7_tms") report_mean[ptm_sort[corpus7]]("report7_ptm") --- binary_search/__init__.mojo --- from sys.intrinsics import PrefetchOptions fn classic_binary_search[D: DType](b: DTypePointer[D], n: Int, x: SIMD[D, 1]) -> Int: var low = 0 var high = n - 1 while low <= high: var mid = (high + low) >> 1 var mid_value = b.load(mid) if mid_value < x: low = mid + 1 elif mid_value > x: high = mid - 1 else: return mid return -1 fn classic_binary_search[D: AnyType, lt: fn(D, D) -> Bool](b: Pointer[D], n: Int, x: D) -> Int: var low = 0 var high = n - 1 while low <= high: var mid = (high + low) >> 1 var mid_value = b.load(mid) if lt(mid_value, x): low = mid + 1 elif lt(mid_value, x): high = mid - 1 else: return mid return -1 # Binary search based on https://en.algorithmica.org/hpc/data-structures/binary-search/ fn binary_search[D: AnyType, lt: fn(D, D) -> Int, eq: fn(D, D) -> Bool](b: Pointer[D], n: Int, x: D) -> Int: var cursor = 0 var length = n while length > 1: var half = length >> 1 length -= half cursor += lt(b.load(cursor + half - 1), x) * half return cursor if eq(b.load(cursor), x) else -1 fn binary_search[D: DType, with_prefetch: Bool = False](b: DTypePointer[D], n: Int, x: SIMD[D, 1]) -> Int: var cursor = 0 var length = n alias pfo = PrefetchOptions().for_read() while length > 1: var half = length >> 1 length -= half var next_half = (length >> 1) - 1 @parameter if with_prefetch: b.offset(cursor + next_half).prefetch[pfo]() b.offset(cursor + half + next_half).prefetch[pfo]() cursor += int(b.load(cursor + half - 1) < x) * half return cursor if b.load(cursor) == x else -1 --- binary_search_benchmark.mojo --- from binary_search import binary_search, classic_binary_search from benchmark import run from random import random_ui64 fn main(): var l = List[UInt64]() var count = 200 var searches = 5_000_000 for i in range(count): l.append(i) var total = 0 var random_elements = List[UInt64](capacity=searches) for _ in range(searches): var value = random_ui64(0, count - 1) total += int(value) random_elements.append(value) var total1 = 0 @parameter fn binary_search_random_items(): total1 = 0 for i in range(searches): total1 += binary_search[with_prefetch=False](l.data, len(l), random_elements[i]) var total2 = 0 @parameter fn classic_binary_search_random_items(): total2 = 0 for i in range(searches): total2 += classic_binary_search(l.data, len(l), random_elements[i]) var result = run[binary_search_random_items]() result.print_full() var result_classic = run[classic_binary_search_random_items]() result_classic.print_full() print("Classic", result_classic.mean() / result.mean()) print(total, total1, total2) --- checkout_remote_modules.sh --- #!/bin/bash function check_out_remote_module() ( rurl="$1" shift declare -a paths declare -a module_names for var in "$@" do IFS="=" read -ra module_name_components <<< "$var" components_count=${#module_name_components[@]} path=${module_name_components[0]} module_name=${module_name_components[$components_count-1]} paths=("${paths[@]}" "$path") module_names=("${module_names[@]}" "$module_name") done IFS=" " for module_name in "${module_names[@]}" do rm -rf ../$module_name done current_date_time=$(date) echo "URL: $rurl" git clone -n --depth=1 --filter=tree:0 $rurl cd ${rurl##*/} git sparse-checkout set --no-cone "${paths[@]}" git checkout for i in "${!paths[@]}" do module_name=${module_names[$i]} path=${paths[$i]} cp -R ./$path ../../$module_name echo $current_date_time > ../../$module_name/.checkoutinfo echo "URL: $rurl" >> ../../$module_name/.checkoutinfo echo "Path: $path" >> ../../$module_name/.checkoutinfo done cd ../ ) function checkout()( # Add check out remote module calls here # check_out_remote_module "https://github.com/mzaks/mojo-hash" "my_utils=hash_utils" check_out_remote_module "https://github.com/mzaks/mojo-csv" "csv" ) mkdir -p "_deps" cd "_deps" checkout rm -rf "../_deps" --- count_sort/__init__.mojo --- from memory import memset_zero, memcpy fn counting_sort[D: DType](inout vector: List[SIMD[D, 1]]): var size = len(vector) var output = List[SIMD[D, 1]](capacity=size) var max_value = 0 for i in range(size): if vector[i] > max_value: max_value = int(vector[i]) output.append(0) var counts = List[Int](capacity=max_value + 1) counts.resize(max_value + 1, 0) for i in range(size): counts[int(vector[i])] += 1 for i in range(1, len(counts)): counts[i] += counts[i - 1] var i = size - 1 while i >= 0: output[counts[int(vector[i])] - 1] = vector[i] counts[int(vector[i])] -= 1 i -= 1 vector = output --- counting_sort_sample.mojo --- from my_utils import print_v from count_sort import counting_sort fn main(): var v1 = List[UInt32]() v1.append(13) v1.append(31) v1.append(1) v1.append(7) v1.append(7) v1.append(4513) v1.append(45) print_v(v1) counting_sort(v1) print_v(v1) --- csv/.checkoutinfo --- Sun May 26 14:06:31 CEST 2024 URL: https://github.com/mzaks/mojo-csv Path: csv --- csv/__init__.mojo --- from .csv_builder import CsvBuilder from .csv_table import CsvTable --- csv/csv_builder.mojo --- from memory.memory import memcpy from buffer import Buffer, Dim from .string_utils import find_indices, contains_any_of, string_from_pointer alias BufferType = Buffer[DType.int8] alias CR_CHAR = "\r" alias CR = ord(CR_CHAR) alias LF_CHAR = "\n" alias LF = ord(LF_CHAR) alias COMMA_CHAR = "," alias COMMA = ord(COMMA_CHAR) alias QUOTE_CHAR = '"' alias QUOTE = UInt8(ord(QUOTE_CHAR)) struct CsvBuilder: var _buffer: DTypePointer[DType.uint8] var _capacity: Int var num_bytes: Int var _column_count: Int var _elements_count: Int var _finished: Bool fn __init__(inout self, column_count: Int): self._capacity = 1024 self._buffer = DTypePointer[DType.uint8].alloc(self._capacity) self._column_count = column_count self._elements_count = 0 self._finished = False self.num_bytes = 0 fn __init__(inout self, *coulmn_names: StringLiteral): self._capacity = 1024 self._buffer = DTypePointer[DType.uint8].alloc(self._capacity) self._elements_count = 0 self._finished = False self.num_bytes = 0 var column_name_list: VariadicList[StringLiteral] = coulmn_names self._column_count = len(column_name_list) for i in range(len(column_name_list)): self.push(coulmn_names[i]) fn __del__(owned self): if not self._finished: self._buffer.free() fn push[D: DType](inout self, value: SIMD[D, 1]): var s = String(value) var size = len(s) self.push(s, False) fn push_stringabel[T: Stringable](inout self, value: T, consider_escaping: Bool = False): self.push(str(value), consider_escaping) fn push_empty(inout self): self.push("", False) fn fill_up_row(inout self): var num_empty = self._column_count - (self._elements_count % self._column_count) if num_empty < self._column_count: for _ in range(num_empty): self.push_empty() fn push(inout self, s: String, consider_escaping: Bool = True): if consider_escaping and contains_any_of( s, CR_CHAR, LF_CHAR, COMMA_CHAR, QUOTE_CHAR ): return self.push(QUOTE_CHAR + escape_quotes_in(s) + QUOTE_CHAR, False) var size = len(s) self._extend_buffer_if_needed(size + 2) if self._elements_count > 0: if self._elements_count % self._column_count == 0: self._buffer.offset(self.num_bytes).store(CR) self._buffer.offset(self.num_bytes + 1).store(LF) self.num_bytes += 2 else: self._buffer.offset(self.num_bytes).store(COMMA) self.num_bytes += 1 memcpy(self._buffer.offset(self.num_bytes), s.unsafe_uint8_ptr(), size) s._strref_keepalive() self.num_bytes += size self._elements_count += 1 @always_inline fn _extend_buffer_if_needed(inout self, size: Int): if self.num_bytes + size < self._capacity: return var new_size = self._capacity while new_size < self.num_bytes + size: new_size *= 2 var p = DTypePointer[DType.uint8].alloc(new_size) memcpy(p, self._buffer, self.num_bytes) self._buffer.free() self._capacity = new_size self._buffer = p fn finish(owned self) -> String: self._finished = True self.fill_up_row() self._buffer.offset(self.num_bytes).store(CR) self._buffer.offset(self.num_bytes + 1).store(LF) self.num_bytes += 3 return string_from_pointer(self._buffer, self.num_bytes) fn escape_quotes_in(s: String) -> String: var indices = find_indices(s, QUOTE_CHAR) var i_size = len(indices) if i_size == 0: return s var size = len(s._buffer) var p_current = s.unsafe_uint8_ptr() var p_result = DTypePointer[DType.uint8].alloc(size + i_size) var first_index = int(indices[0]) memcpy(p_result, p_current, first_index) p_result.offset(first_index).store(QUOTE) var offset = first_index + 1 for i in range(1, len(indices)): var c_offset = int(indices[i - 1]) var length = int(indices[i]) - c_offset memcpy(p_result.offset(offset), p_current.offset(c_offset), length) offset += length p_result.offset(offset).store(QUOTE) offset += 1 var last_index = int(indices[i_size - 1]) memcpy(p_result.offset(offset), p_current.offset(last_index), size - last_index) return string_from_pointer(p_result, size + i_size) --- csv/csv_table.mojo --- from .string_utils import find_indices, string_from_pointer from algorithm.functional import vectorize from sys.info import simdwidthof from sys.intrinsics import compressed_store from math import iota, reduce_bit_count from memory import stack_allocation alias QUOTE = ord('"') alias COMMA = ord(",") alias LF = ord("\n") alias CR = ord("\r") alias simd_width_u8 = simdwidthof[DType.uint8]() struct CsvTable[sep: Int = COMMA]: var _inner_string: String var _starts: List[Int] var _ends: List[Int] var column_count: Int fn __init__(inout self, owned s: String, with_simd: Bool = True): self._inner_string = s self._starts = List[Int](capacity=10) self._ends = List[Int](capacity=10) self.column_count = -1 if with_simd: self._simd_parse() else: self._parse() @always_inline fn _parse(inout self): var length = len(self._inner_string) var offset = 0 var in_double_quotes = False self._starts.append(offset) while offset < length: var c = self._inner_string._buffer[offset] if c == QUOTE: in_double_quotes = not in_double_quotes offset += 1 elif not in_double_quotes and c == sep: self._ends.append(offset) offset += 1 self._starts.append(offset) elif not in_double_quotes and c == LF: self._ends.append(offset) if self.column_count == -1: self.column_count = len(self._ends) offset += 1 self._starts.append(offset) elif ( not in_double_quotes and c == CR and length > offset + 1 and self._inner_string._buffer[offset + 1] == LF ): self._ends.append(offset) if self.column_count == -1: self.column_count = len(self._ends) offset += 2 self._starts.append(offset) else: offset += 1 if self._inner_string[length - 1] == "\n": _ = self._starts.pop() else: self._ends.append(length) @always_inline fn _simd_parse(inout self): var p = DTypePointer(self._inner_string.unsafe_uint8_ptr()) var string_byte_length = len(self._inner_string) var in_quotes = False var last_chunk__ends_on_cr = False self._starts.append(0) @always_inline @parameter fn find_indicies[simd_width: Int](offset: Int): var chars = p.load[width=simd_width](offset) var quotes = chars == QUOTE var separators = chars == sep var lfs = chars == LF var all_bits = quotes | separators | lfs var crs = chars == CR var offsets = iota[DType.uint8, simd_width]() var sp: DTypePointer[DType.uint8] = stack_allocation[ simd_width, UInt8, simd_width ]() compressed_store(offsets, sp, all_bits) var all_len = reduce_bit_count(all_bits) for i in range(all_len): var index = int(sp.load(i)) if quotes[index]: in_quotes = not in_quotes continue if in_quotes: continue var current_offset = index + offset var rs_compensation: Int if index > 0: rs_compensation = int(lfs[index] & crs[index - 1]) else: rs_compensation = int(lfs[index] & last_chunk__ends_on_cr) self._ends.append(current_offset - rs_compensation) self._starts.append(current_offset + 1) if self.column_count == -1 and lfs[index]: self.column_count = len(self._ends) last_chunk__ends_on_cr = crs[simd_width - 1] vectorize[find_indicies, simd_width_u8](string_byte_length) if self._inner_string[string_byte_length - 1] == "\n": _ = self._starts.pop() else: self._ends.append(string_byte_length) fn get(self, row: Int, column: Int) -> String: if column >= self.column_count: return "" var index = self.column_count * row + column if index >= len(self._ends): return "" if ( self._inner_string[self._starts[index]] == '"' and self._inner_string[self._ends[index] - 1] == '"' ): var start = self._starts[index] + 1 var length = (self._ends[index] - 1) - start var p1 = Pointer[UInt8].alloc(length + 1) memcpy(p1, self._inner_string.unsafe_uint8_ptr().offset(start), length) var _inner_string = string_from_pointer(p1, length + 1) var quote_indices = find_indices(_inner_string, '"') var quotes_count = len(quote_indices) if quotes_count == 0 or quotes_count & 1 == 1: return _inner_string var p = _inner_string.unsafe_uint8_ptr() var length2 = length - (quotes_count >> 1) var p2 = Pointer[UInt8].alloc(length2 + 1) var offset2 = 0 memcpy(p2, p, int(quote_indices[0])) offset2 += int(quote_indices[0]) for i in range(2, quotes_count, 2): var start = int(quote_indices[i - 1]) var size = int(quote_indices[i]) - start memcpy(p2.offset(offset2), p.offset(start), size) offset2 += size var last = int(quote_indices[quotes_count - 1]) memcpy(p2.offset(offset2), p.offset(last), length - last) _inner_string._strref_keepalive() return string_from_pointer(p2, length - (quotes_count >> 1) + 1) return self._inner_string[self._starts[index] : self._ends[index]] fn row_count(self) -> Int: return len(self._starts) // self.column_count --- csv/string_utils.mojo --- from algorithm.functional import vectorize from sys.info import simdwidthof from sys.intrinsics import compressed_store from math import iota, reduce_bit_count, any_true from memory import stack_allocation from time import now from collections.vector import InlinedFixedVector alias simd_width_i8 = simdwidthof[DType.int8]() fn vectorize_and_exit[simd_width: Int, workgroup_function: fn[i: Int](Int) capturing -> Bool](size: Int): var loops = size // simd_width for i in range(loops): if workgroup_function[simd_width](i * simd_width): return var rest = size & (simd_width - 1) @parameter if simd_width >= 64: if rest >= 32: if workgroup_function[32](size - rest): return rest -= 32 @parameter if simd_width >= 32: if rest >= 16: if workgroup_function[16](size - rest): return rest -= 16 @parameter if simd_width >= 16: if rest >= 8: if workgroup_function[8](size - rest): return rest -= 8 @parameter if simd_width >= 8: if rest >= 4: if workgroup_function[4](size - rest): return rest -= 4 @parameter if simd_width >= 4: if rest >= 2: if workgroup_function[2](size - rest): return rest -= 2 if rest == 1: _= workgroup_function[1](size - rest) fn find_indices(s: String, c: String) -> List[UInt64]: var size = len(s) var result = List[UInt64]() var char = UInt8(ord(c)) var p = DTypePointer(s.unsafe_uint8_ptr()) @parameter fn find[simd_width: Int](offset: Int): @parameter if simd_width == 1: if p.offset(offset).load() == char: return result.append(offset) else: var chunk = p.load[width=simd_width](offset) var occurrence = chunk == char var offsets = iota[DType.uint64, simd_width]() + offset var occurrence_count = reduce_bit_count(occurrence) var current_len = len(result) result.reserve(current_len + occurrence_count) result.resize(current_len + occurrence_count, 0) compressed_store(offsets, DTypePointer[DType.uint64](result.data).offset(current_len), occurrence) vectorize[find, simd_width_i8](size) return result fn occurrence_count(s: String, *c: String) -> Int: var size = len(s) var result = 0 var chars = InlinedFixedVector[UInt8](len(c)) for i in range(len(c)): chars.append(UInt8(ord(c[i]))) var p = DTypePointer(s.unsafe_uint8_ptr()) @parameter fn find[simd_width: Int](offset: Int): @parameter if simd_width == 1: for i in range(len(chars)): var char = chars[i] if p.offset(offset).load() == char: result += 1 return else: var chunk = p.load[width=simd_width](offset) var occurrence = SIMD[DType.bool, simd_width](False) for i in range(len(chars)): occurrence |= chunk == chars[i] var occurrence_count = reduce_bit_count(occurrence) result += occurrence_count vectorize[find, simd_width_i8](size) return result fn contains_any_of(s: String, *c: String) -> Bool: var size = len(s) # var c_list: VariadicListMem[String] = c var chars = InlinedFixedVector[UInt8](len(c)) for i in range(len(c)): chars.append(UInt8(ord(c[i]))) var p = DTypePointer(s.unsafe_uint8_ptr()) var flag = False @parameter fn find[simd_width: Int](i: Int) -> Bool: var chunk = p.load[width=simd_width]() p = p.offset(simd_width) for i in range(len(chars)): var occurrence = chunk == chars[i] if any_true(occurrence): flag = True return flag return False vectorize_and_exit[simd_width_i8, find](size) return flag @always_inline fn string_from_pointer(p: DTypePointer[DType.uint8], length: Int) -> String: # Since Mojo 0.5.0 the pointer needs to provide a 0 terminated byte string p.store(length - 1, 0) return String(p, length) fn print_v(v: List[UInt64]): print("(" + str(len(v)) + ")[") for i in range(len(v)): var end = ", " if i < len(v) - 1 else "]\n" print(v[i], end=end) --- hash_utils/.checkoutinfo --- Sun Nov 12 09:36:05 CET 2023 URL: https://github.com/mzaks/mojo-hash Path: my_utils --- hash_utils/__init__.mojo --- from math import min fn int_cmp(a: UInt32, b: UInt32) -> Int: return int(a) - int(b) fn int_cmp64(a: UInt64, b: UInt64) -> Int: return int(a) - int(b) fn int_to_str(a: UInt32) -> String: return String(a) fn int_to_str64(a: UInt64) -> String: return String(a) fn cmp_strl(a: StringLiteral, b: StringLiteral) -> Int: var l = min(len(a), len(b)) var p1 = a.data().bitcast[DType.uint8]() var p2 = b.data().bitcast[DType.uint8]() var diff = memcmp(p1, p2, l) return diff if diff != 0 else len(a) - len(b) fn stsl(a: StringLiteral) -> String: return a --- insertion_sort/__init__.mojo --- from .sort import insertion_sort --- insertion_sort/sort.mojo --- fn insertion_sort[D: DType](inout vector: List[SIMD[D, 1]]): for i in range(1, len(vector)): var key = vector[i] var j = i - 1 while j >= 0 and key < vector[j]: vector[j + 1] = vector[j] j -= 1 vector[j + 1] = key fn insertion_sort[D: CollectionElement, lt: fn(D, D) -> Bool](inout vector: List[D]): for i in range(1, len(vector)): var key = vector[i] var j = i - 1 while j >= 0 and lt(key, vector[j]): vector[j + 1] = vector[j] j -= 1 vector[j + 1] = key --- insertion_sort_sample.mojo --- from my_utils import * from string_compare import lt from insertion_sort import insertion_sort from time import now fn main(): var v1 = List[UInt32]() v1.append(13) v1.append(31) v1.append(1) v1.append(7) v1.append(7) v1.append(4513) v1.append(45) print_v(v1) insertion_sort[DType.uint32](v1) print_v(v1) var v2 = List(str("d"), str("a"), str("bb"), str("ab"), str("dfg"), str("efgds")) print_v(v2) insertion_sort[String, lt](v2) print_v(v2) var corpus = corpus7() var tik = now() insertion_sort[String, lt](corpus) var tok = now() print_v(corpus) print(tok - tik) corpus = corpus3() tik = now() insertion_sort[String, lt](corpus) tok = now() print_v(corpus) print(tok - tik) --- multi_key_quicksort/__init__.mojo --- from .sort import multi_key_quicksort --- multi_key_quicksort/sort.mojo --- # based on https://github.com/rantala/string-sorting/blob/master/external/multikey.c from random import random_ui64 @always_inline fn _vec_swap(inout values: List[String], a: Int, b: Int, n: Int): var n1 = n var a1 = a var b1 = b while n1 > 0: _exchange(values, a1, b1) a1 +=1 b1 +=1 n1 -= 1 @always_inline fn _exchange(inout values: List[String], a: Int, b: Int): values[a], values[b] = values[b], values[a] @always_inline fn _char_at(s: String, index: Int) -> Int: if len(s) <= index: return 0 return int(DTypePointer(s.unsafe_uint8_ptr()).load(index)) fn _mk_sort(inout values: List[String], n: Int, depth: Int, offset: Int): if n <= 1: return var a = offset + int(random_ui64(0, n - 1)) _exchange(values, offset, a) var v = _char_at(values[offset], depth) a = offset + 1 var b = offset + 1 var c = offset + n - 1 var d = offset + n - 1 var r: Int while True: while b <= c and _char_at(values[b], depth) - v <= 0: if _char_at(values[b], depth) - v == 0: _exchange(values, a, b) a += 1 b += 1 while b <= c and _char_at(values[c], depth) - v >= 0: if _char_at(values[c], depth) - v == 0: _exchange(values, c, d) d -= 1 c -= 1 if b > c: break _exchange(values, b, c) b += 1 c -= 1 r = min(a, b - a) _vec_swap(values, offset, b-r, r) r = min(d-c, n-d-1) _vec_swap(values, b, n-r, r) r = b-a _mk_sort(values, r, depth, offset) if _char_at(values[r], depth) != 0: _mk_sort(values, a + n-d-1, depth + 1, offset + r) r = d-c _mk_sort(values, r, depth, offset + n - r) fn multi_key_quicksort(inout values: List[String]): _mk_sort(values, len(values), 0, 0) --- multi_key_sort_sample.mojo --- from multi_key_quicksort import multi_key_quicksort from my_utils import print_v, corpus4, corpus7 from time import now fn main(): var v1 = List[String]("a", "d") print_v(v1) multi_key_quicksort(v1) print_v(v1) v1 = List[String]("sam", "same", "her", "make", "zebra") print_v(v1) multi_key_quicksort(v1) print_v(v1) v1 = List[String]("d", "a", "bb", "ab", "dfg", "efgds") var start = now() print_v(v1) multi_key_quicksort(v1) print_v(v1) print(now() - start) var corpus = corpus7() print_v(corpus) var tik = now() multi_key_quicksort(corpus) var tok = now() print("----") print_v(corpus) print(tok - tik) print("===") corpus = corpus4() print_v(corpus) tik = now() multi_key_quicksort(corpus) tok = now() print("----") print_v(corpus) print(tok - tik) --- my_utils.mojo --- trait StringableCollectionElement(Stringable, CollectionElement): pass fn print_v[T: StringableCollectionElement](values: List[T], end: StringLiteral = "|"): for v in values: print(v[], end=end) print() # fn lte_s(a: String, b: String) -> Bool: # var l1 = len(a) # var l2 = len(b) # var min_len = l1 if l1 <= l2 else l2 # var res = memcmp(a._as_ptr(), b._as_ptr(), min_len) # return len(a) <= len(b) if res == 0 else res < 0 # @always_inline # fn lt(a: String, b: String) -> Bool: # var len1 = len(a) # var len2 = len(b) # if len1 < len2: # return memcmp(a._as_ptr(), b._as_ptr(), len1) <= 0 # else: # return memcmp(a._as_ptr(), b._as_ptr(), len2) < 0 fn corpus1() -> List[String]: return List[String]('Lorem', 'ipsum', 'dolor', 'sit', 'amet,', 'consectetur', 'adipiscing', 'elit.', 'Quisque', 'orci', 'urna,', 'pretium', 'et', 'porta', 'ac,', 'porttitor', 'sit', 'amet', 'sem.', 'Fusce', 'sagittis', 'lorem', 'neque,', 'vitae', 'sollicitudin', 'elit', 'suscipit', 'et.', 'In', 'interdum', 'convallis', 'nisl', 'in', 'ornare.', 'Vestibulum', 'ante', 'ipsum', 'primis', 'in', 'faucibus', 'orci', 'luctus', 'et', 'ultrices', 'posuere', 'cubilia', 'curae;', 'Aliquam', 'erat', 'volutpat.', 'Morbi', 'mollis', 'iaculis', 'lectus', 'ac', 'tincidunt.', 'Fusce', 'nisi', 'lacus,', 'semper', 'eu', 'dignissim', 'et,', 'malesuada', 'non', 'mi.', 'Sed', 'euismod', 'urna', 'vel', 'elit', 'faucibus,', 'eu', 'bibendum', 'ante', 'fringilla.', 'Curabitur', 'tempus', 'in', 'turpis', 'at', 'mattis.', 'Aliquam', 'erat', 'volutpat.', 'Donec', 'maximus', 'elementum', 'felis,', 'sit', 'amet', 'dignissim', 'augue', 'tincidunt', 'blandit.', 'Aliquam', 'fermentum,', 'est', 'eu', 'mollis.') fn corpus2() -> List[String]: return List[String]('But', 'I', 'must', 'explain', 'to', 'you', 'how', 'all', 'this', 'mistaken', 'idea', 'of', 'denouncing', 'pleasure', 'and', 'praising', 'pain', 'was', 'born', 'and', 'I', 'will', 'give', 'you', 'a', 'complete', 'account', 'of', 'the', 'system,', 'and', 'expound', 'the', 'actual', 'teachings', 'of', 'the', 'great', 'explorer', 'of', 'the', 'truth,', 'the', 'master-builder', 'of', 'human', 'happiness.', 'No', 'one', 'rejects,', 'dislikes,', 'or', 'avoids', 'pleasure', 'itself,', 'because', 'it', 'is', 'pleasure,', 'but', 'because', 'those', 'who', 'do', 'not', 'know', 'how', 'to', 'pursue', 'pleasure', 'rationally', 'encounter', 'consequences', 'that', 'are', 'extremely', 'painful.', 'Nor', 'again', 'is', 'there', 'anyone', 'who', 'loves', 'or', 'pursues', 'or', 'desires', 'to', 'obtain', 'pain', 'of', 'itself,', 'because', 'it', 'is', 'pain,', 'but', 'because', 'occasionally', 'circumstances', 'occur', 'in', 'which', 'toil', 'and', 'pain', 'can', 'procure', 'him', 'some', 'great', 'pleasure.', 'To', 'take', 'a', 'trivial', 'example,', 'which', 'of', 'us', 'ever', 'undertakes', 'laborious', 'physical', 'exercise,', 'except', 'to', 'obtain', 'some', 'advantage', 'from', 'it?', 'But', 'who', 'has', 'any', 'right', 'to', 'find', 'fault', 'with', 'a', 'man', 'who', 'chooses', 'to', 'enjoy', 'a', 'pleasure', 'that', 'has', 'no', 'annoying', 'consequences,', 'or', 'one', 'who', 'avoids', 'a', 'pain', 'that', 'produces', 'no', 'resultant', 'pleasure?', 'On', 'the', 'other', 'hand,', 'we', 'denounce', 'with', 'righteous', 'indignation', 'and', 'dislike', 'men', 'who', 'are', 'so', 'beguiled', 'and', 'demoralized', 'by', 'the', 'charms', 'of', 'pleasure', 'of', 'the', 'moment,', 'so', 'blinded', 'by', 'desire,', 'that', 'they', 'cannot', 'foresee', 'the', 'pain', 'and', 'trouble', 'that', 'are', 'bound', 'to', 'ensue;', 'and', 'equal', 'blame', 'belongs', 'to', 'those', 'who', 'fail', 'in', 'their', 'duty', 'through', 'weakness', 'of', 'will,', 'which', 'is', 'the', 'same', 'as', 'saying', 'through', 'shrinking', 'from', 'toil', 'and', 'pain.', 'These', 'cases', 'are', 'perfectly', 'simple', 'and', 'easy', 'to', 'distinguish.', 'In', 'a', 'free', 'hour,', 'when', 'our', 'power', 'of', 'choice', 'is', 'untrammelled', 'and', 'when', 'nothing', 'prevents', 'our', 'being', 'able', 'to', 'do', 'what', 'we', 'like', 'best,', 'every', 'pleasure', 'is', 'to', 'be', 'welcomed', 'and', 'every', 'pain', 'avoided.', 'But', 'in', 'certain', 'circumstances', 'and', 'owing', 'to', 'the', 'claims', 'of', 'duty', 'or', 'the', 'obligations', 'of', 'business', 'it', 'will', 'frequently', 'occur', 'that', 'pleasures', 'have', 'to', 'be', 'repudiated', 'and', 'annoyances', 'accepted.', 'The', 'wise', 'man', 'therefore', 'always', 'holds', 'in', 'these', 'matters', 'to', 'this', 'principle', 'of', 'selection:', 'he', 'rejects', 'pleasures', 'to', 'secure', 'other', 'greater', 'pleasures,', 'or', 'else', 'he', 'endures', 'pains', 'to', 'avoid', 'worse', 'pains.', 'But', 'I', 'must', 'explain', 'to', 'you', 'how', 'all', 'this', 'mistaken', 'idea', 'of', 'denouncing', 'pleasure', 'and', 'praising', 'pain', 'was', 'born', 'and', 'I', 'will', 'give', 'you', 'a', 'complete', 'account', 'of', 'the', 'system,', 'and', 'expound', 'the', 'actual', 'teachings', 'of', 'the', 'great', 'explorer', 'of', 'the', 'truth,', 'the', 'master-builder', 'of', 'human', 'happiness.', 'No', 'one', 'rejects,', 'dislikes,', 'or', 'avoids', 'pleasure', 'itself,', 'because', 'it', 'is', 'pleasure,', 'but', 'because', 'those', 'who', 'do', 'not', 'know', 'how', 'to', 'pursue', 'pleasure', 'rationally', 'encounter', 'consequences', 'that', 'are', 'extremely', 'painful.', 'Nor', 'again', 'is', 'there', 'anyone', 'who', 'loves', 'or', 'pursues', 'or', 'desires', 'to', 'obtain', 'pain', 'of', 'itself,', 'because', 'it', 'is', 'pain,', 'but', 'because', 'occasionally', 'circumstances', 'occur', 'in', 'which', 'toil', 'and', 'pain', 'can', 'procure', 'him', 'some', 'great', 'pleasure.', 'To', 'take', 'a', 'trivial', 'example,', 'which', 'of', 'us', 'ever', 'undertakes', 'laborious', 'physical', 'exercise,', 'except', 'to', 'obtain', 'some', 'advantage', 'from', 'it?', 'But', 'who', 'has', 'any', 'right', 'to', 'find', 'fault', 'with', 'a', 'man', 'who', 'chooses', 'to', 'enjoy', 'a', 'pleasure', 'that', 'has', 'no', 'annoying', 'consequences,', 'or', 'one', 'who', 'avoids', 'a', 'pain', 'that', 'produces', 'no', 'resultant', 'pleasure?', 'On', 'the', 'other', 'hand,', 'we', 'denounce', 'with', 'righteous', 'indignation', 'and', 'dislike', 'men', 'who', 'are', 'so', 'beguiled', 'and', 'demoralized', 'by', 'the', 'charms', 'of', 'pleasure', 'of', 'the', 'moment,', 'so', 'blinded', 'by', 'desire,', 'that', 'they', 'cannot', 'foresee', 'the', 'pain', 'and', 'trouble', 'that', 'are', 'bound', 'to', 'ensue;', 'and', 'equal', 'blame', 'belongs', 'to', 'those', 'who', 'fail', 'in', 'their', 'duty', 'through', 'weakness', 'of', 'will,', 'which', 'is', 'the', 'same', 'as', 'saying', 'through', 'shrinking', 'from', 'toil', 'and', 'pain.', 'These', 'cases', 'are', 'perfectly', 'simple', 'and', 'easy', 'to', 'distinguish.', 'In', 'a', 'free', 'hour,', 'when', 'our', 'power', 'of', 'choice', 'is', 'untrammelled', 'and', 'when', 'nothing', 'prevents', 'our', 'being', 'able', 'to', 'do', 'what', 'we', 'like', 'best,', 'every', 'pleasure', 'is', 'to', 'be', 'welcomed', 'and', 'every', 'pain', 'avoided.', 'But', 'in', 'certain', 'circumstances', 'and', 'owing', 'to', 'the', 'claims', 'of', 'duty', 'or', 'the', 'obligations', 'of', 'business', 'it', 'will', 'frequently', 'occur', 'that', 'pleasures', 'have', 'to', 'be', 'repudiated', 'and', 'annoyances', 'accepted.', 'The', 'wise', 'man', 'therefore', 'always', 'holds', 'in', 'these', 'matters', 'to', 'this', 'principle', 'of', 'selection:', 'he', 'rejects', 'pleasures', 'to', 'secure', 'other', 'greater', 'pleasures,', 'or', 'else', 'he', 'endures', 'pains', 'to', 'avoid', 'worse', 'pains.But', 'I', 'must', 'explain', 'to', 'you', 'how', 'all', 'this', 'mistaken', 'idea', 'of', 'denouncing', 'pleasure', 'and', 'praising', 'pain', 'was', 'born', 'and', 'I', 'will', 'give', 'you', 'a', 'complete', 'account', 'of', 'the', 'system,', 'and', 'expound', 'the', 'actual', 'teachings', 'of', 'the', 'great', 'explorer', 'of', 'the', 'truth,', 'the', 'master-builder', 'of', 'human', 'happiness.', 'No', 'one', 'rejects,', 'dislikes,', 'or', 'avoids', 'pleasure', 'itself,', 'because', 'it', 'is', 'pleasure,', 'but', 'because', 'those', 'who', 'do', 'not', 'know', 'how', 'to', 'pursue', 'pleasure', 'rationally', 'encounter', 'consequences', 'that', 'are', 'extremely', 'painful.', 'Nor', 'again', 'is', 'there', 'anyone', 'who', 'loves', 'or', 'pursues', 'or', 'desires', 'to', 'obtain', 'pain', 'of', 'itself,', 'because', 'it', 'is', 'pain,', 'but', 'because', 'occasionally', 'circumstances', 'occur', 'in', 'which', 'toil', 'and', 'pain', 'can', 'procure', 'him', 'some', 'great', 'pleasure.', 'To', 'take', 'a', 'trivial', 'example,', 'which', 'of', 'us', 'ever', 'undertakes', 'laborious', 'physical', 'exercise,', 'except', 'to', 'obtain', 'some', 'advantage', 'from', 'it?', 'But', 'who', 'has', 'any', 'right', 'to', 'find', 'fault', 'with', 'a', 'man', 'who', 'chooses', 'to', 'enjoy', 'a', 'pleasure', 'that', 'has', 'no', 'annoying', 'consequences,', 'or', 'one', 'who', 'avoids', 'a', 'pain', 'that', 'produces', 'no', 'resultant', 'pleasure?', 'On', 'the', 'other', 'hand,', 'we', 'denounce', 'with', 'righteous', 'indignation', 'and', 'dislike', 'men', 'who', 'are', 'so', 'beguiled', 'and', 'demoralized', 'by', 'the', 'charms', 'of', 'pleasure', 'of', 'the', 'moment,', 'so', 'blinded', 'by', 'desire,', 'that', 'they', 'cannot', 'foresee', 'the', 'pain', 'and', 'trouble', 'that', 'are', 'bound', 'to', 'ensue;', 'and', 'equal', 'blame', 'belongs', 'to', 'those', 'who', 'fail', 'in', 'their', 'duty', 'through', 'weakness', 'of', 'will,', 'which', 'is', 'the', 'same', 'as', 'saying', 'through', 'shrinking', 'from', 'toil', 'and', 'pain.', 'These', 'cases', 'are', 'perfectly', 'simple', 'and', 'easy', 'to', 'distinguish.', 'In', 'a', 'free', 'hour,', 'when', 'our', 'power', 'of', 'choice', 'is', 'untrammelled', 'and', 'when', 'nothing', 'prevents', 'our', 'being', 'able', 'to', 'do', 'what', 'we', 'like', 'best,', 'every', 'pleasure', 'is', 'to', 'be', 'welcomed', 'and', 'every', 'pain', 'avoided.', 'But', 'in', 'certain', 'circumstances', 'and', 'owing', 'to', 'the', 'claims', 'of', 'duty', 'or', 'the', 'obligations', 'of', 'business', 'it', 'will', 'frequently', 'occur', 'that', 'pleasures', 'have', 'to', 'be', 'repudiated', 'and', 'annoyances', 'accepted.', 'The', 'wise', 'man', 'therefore', 'always', 'holds', 'in', 'these', 'matters', 'to', 'this', 'principle', 'of', 'selection:') fn corpus3() -> List[String]: return List[String]('A', 'wonderful', 'serenity', 'has', 'taken', 'possession', 'of', 'my', 'entire', 'soul,', 'like', 'these', 'sweet', 'mornings', 'of', 'spring', 'which', 'I', 'enjoy', 'with', 'my', 'whole', 'heart.', 'I', 'am', 'alone,', 'and', 'feel', 'the', 'charm', 'of', 'existence', 'in', 'this', 'spot,', 'which', 'was', 'created', 'for', 'the', 'bliss', 'of', 'souls', 'like', 'mine.', 'I', 'am', 'so', 'happy,', 'my', 'dear', 'friend,', 'so', 'absorbed', 'in', 'the', 'exquisite', 'sense', 'of', 'mere', 'tranquil', 'existence,', 'that', 'I', 'neglect', 'my', 'talents.', 'I', 'should', 'be', 'incapable', 'of', 'drawing', 'a', 'single', 'stroke', 'at', 'the', 'present', 'moment;', 'and', 'yet', 'I', 'feel', 'that', 'I', 'never', 'was', 'a', 'greater', 'artist', 'than', 'now.', 'When,', 'while', 'the', 'lovely', 'valley', 'teems', 'with', 'vapour', 'around', 'me,', 'and', 'the', 'meridian', 'sun', 'strikes', 'the', 'upper', 'surface', 'of', 'the', 'impenetrable', 'foliage', 'of', 'my', 'trees,', 'and', 'but', 'a', 'few', 'stray', 'gleams', 'steal', 'into', 'the', 'inner', 'sanctuary,', 'I', 'throw', 'myself', 'down', 'among', 'the', 'tall', 'grass', 'by', 'the', 'trickling', 'stream;', 'and,', 'as', 'I', 'lie', 'close', 'to', 'the', 'earth,', 'a', 'thousand', 'unknown', 'plants', 'are', 'noticed', 'by', 'me:', 'when', 'I', 'hear', 'the', 'buzz', 'of', 'the', 'little', 'world', 'among', 'the', 'stalks,', 'and', 'grow', 'familiar', 'with', 'the', 'countless', 'indescribable', 'forms', 'of', 'the', 'insects', 'and', 'flies,', 'then', 'I', 'feel', 'the', 'presence', 'of', 'the', 'Almighty,', 'who', 'formed', 'us', 'in', 'his', 'own', 'image,', 'and', 'the', 'breath', 'of', 'that', 'universal', 'love', 'which', 'bears', 'and', 'sustains', 'us,', 'as', 'it', 'floats', 'around', 'us', 'in', 'an', 'eternity', 'of', 'bliss;', 'and', 'then,', 'my', 'friend,', 'when', 'darkness', 'overspreads', 'my', 'eyes,', 'and', 'heaven', 'and', 'earth', 'seem', 'to', 'dwell', 'in', 'my', 'soul', 'and', 'absorb', 'its', 'power,', 'like', 'the', 'form', 'of', 'a', 'beloved', 'mistress,', 'then', 'I', 'often', 'think', 'with', 'longing,', 'Oh,', 'would', 'I', 'could', 'describe', 'these', 'conceptions,', 'could', 'impress', 'upon', 'paper', 'all', 'that', 'is', 'living', 'so', 'full', 'and', 'warm', 'within', 'me,', 'that', 'it', 'might', 'be', 'the', 'mirror', 'of', 'my', 'soul,', 'as', 'my', 'soul', 'is', 'the', 'mirror', 'of', 'the', 'infinite', 'God!', 'O', 'my', 'friend', '--', 'but', 'it', 'is', 'too', 'much', 'for', 'my', 'strength', '--', 'I', 'sink', 'under', 'the', 'weight', 'of', 'the', 'splendour', 'of', 'these', 'visions!', 'A', 'wonderful', 'serenity', 'has', 'taken', 'possession', 'of', 'my', 'entire', 'soul,', 'like', 'these', 'sweet', 'mornings', 'of', 'spring', 'which', 'I', 'enjoy', 'with', 'my', 'whole', 'heart.', 'I', 'am', 'alone,', 'and', 'feel', 'the', 'charm', 'of', 'existence', 'in', 'this', 'spot,', 'which', 'was', 'created', 'for', 'the', 'bliss', 'of', 'souls', 'like', 'mine.', 'I', 'am', 'so', 'happy,', 'my', 'dear', 'friend,', 'so', 'absorbed', 'in', 'the', 'exquisite', 'sense', 'of', 'mere', 'tranquil', 'existence,', 'that', 'I', 'neglect', 'my', 'talents.', 'I', 'should', 'be', 'incapable', 'of', 'drawing', 'a', 'single', 'stroke', 'at', 'the', 'present', 'moment;', 'and', 'yet', 'I', 'feel', 'that', 'I', 'never', 'was', 'a', 'greater', 'artist', 'than', 'now.', 'When,', 'while', 'the', 'lovely', 'valley', 'teems', 'with', 'vapour', 'around', 'me,', 'and', 'the', 'meridian', 'sun', 'strikes', 'the', 'upper', 'surface', 'of', 'the', 'impenetrable', 'foliage', 'of', 'my', 'trees,', 'and', 'but', 'a', 'few', 'stray', 'gleams', 'steal', 'into', 'the', 'inner', 'sanctuary,', 'I', 'throw', 'myself', 'down', 'among', 'the', 'tall', 'grass', 'by', 'the', 'trickling', 'stream;', 'and,', 'as', 'I', 'lie', 'close', 'to', 'the', 'earth,', 'a', 'thousand', 'unknown', 'plants', 'are', 'noticed', 'by', 'me:', 'when', 'I', 'hear', 'the', 'buzz', 'of', 'the', 'little', 'world', 'among', 'the', 'stalks,', 'and', 'grow', 'familiar', 'with', 'the', 'countless', 'indescribable', 'forms', 'of', 'the', 'insects', 'and', 'flies,', 'then', 'I', 'feel', 'the', 'presence', 'of', 'the', 'Almighty,', 'who', 'formed', 'us', 'in', 'his', 'own', 'image,', 'and', 'the', 'breath', 'of', 'that', 'universal', 'love', 'which', 'bears', 'and', 'sustains', 'us,', 'as', 'it', 'floats', 'around', 'us', 'in', 'an', 'eternity', 'of', 'bliss;', 'and', 'then,', 'my', 'friend,', 'when', 'darkness', 'overspreads', 'my', 'eyes,', 'and', 'heaven', 'and', 'earth', 'seem', 'to', 'dwell', 'in', 'my', 'soul', 'and', 'absorb', 'its', 'power,', 'like', 'the', 'form', 'of', 'a', 'beloved', 'mistress,', 'then', 'I', 'often', 'think', 'with', 'longing,', 'Oh,', 'would', 'I', 'could', 'describe', 'these', 'conceptions,', 'could', 'impress', 'upon', 'paper', 'all', 'that', 'is', 'living', 'so', 'full', 'and', 'warm', 'within', 'me,', 'that', 'it', 'might', 'be', 'the', 'mirror', 'of', 'my', 'soul,', 'as', 'my', 'soul', 'is', 'the', 'mirror', 'of', 'the', 'infinite', 'God!', 'O', 'my', 'friend', '--', 'but', 'it', 'is', 'too', 'much', 'for', 'my', 'strength', '--', 'I', 'sink', 'under', 'the', 'weight', 'of', 'the', 'splendour', 'of', 'these', 'visions!', 'A', 'wonderful', 'serenity', 'has', 'taken', 'possession', 'of', 'my', 'entire', 'soul,', 'like', 'these', 'sweet', 'mornings', 'of', 'spring', 'which', 'I', 'enjoy', 'with', 'my', 'whole', 'heart.', 'I', 'am', 'alone,', 'and', 'feel', 'the', 'charm', 'of', 'existence', 'in', 'this', 'spot,', 'which', 'was', 'created', 'for', 'the', 'bliss', 'of', 'souls', 'like', 'mine.', 'I', 'am', 'so', 'happy,', 'my', 'dear', 'friend,', 'so', 'absorbed', 'in', 'the', 'exquisite', 'sense', 'of', 'mere', 'tranquil', 'existence,', 'that', 'I', 'neglect', 'my', 'talents.', 'I', 'should', 'be', 'incapable', 'of', 'drawing', 'a', 'single', 'stroke', 'at', 'the', 'present', 'moment;', 'and', 'yet', 'I', 'feel', 'that', 'I', 'never', 'was', 'a', 'greater', 'artist', 'than', 'now.', 'When,', 'while', 'the', 'lovely', 'valley', 'teems', 'with', 'vapour', 'around', 'me,', 'and', 'the', 'meridian', 'sun', 'strikes', 'the', 'upper', 'surface', 'of', 'the', 'impenetrable', 'foliage', 'of', 'my', 'trees,', 'and', 'but', 'a', 'few', 'stray', 'gleams', 'steal', 'into', 'the', 'inner', 'sanctuary,', 'I', 'throw', 'myself', 'down', 'among', 'the', 'tall', 'grass', 'by', 'the', 'trickling', 'stream;', 'and,', 'as', 'I', 'lie', 'close', 'to', 'the', 'earth,', 'a', 'thousand', 'unknown', 'plants', 'are', 'noticed', 'by', 'me:', 'when', 'I', 'hear', 'the', 'buzz', 'of', 'the', 'little', 'world', 'among', 'the', 'stalks,', 'and', 'grow', 'familiar', 'with', 'the', 'countless', 'indescribable', 'forms', 'of', 'the', 'insects', 'and', 'flies,', 'then', 'I', 'feel', 'the', 'presence', 'of', 'the', 'Almighty,', 'who', 'formed', 'us', 'in', 'his', 'own', 'image,', 'and', 'the', 'breath', 'of', 'that', 'universal', 'love', 'which', 'bears', 'and', 'sustains', 'us,', 'as', 'it', 'floats', 'around', 'us', 'in', 'an', 'eternity', 'of', 'bliss;', 'and', 'then,', 'my', 'friend,', 'when', 'darkness', 'overspreads', 'my', 'eyes,', 'and', 'heaven', 'and', 'earth', 'seem', 'to', 'dwell', 'in', 'my', 'soul', 'and', 'absorb', 'its', 'power,', 'like', 'the', 'form', 'of', 'a', 'beloved', 'mistress,', 'then', 'I', 'often', 'think', 'with', 'longing,', 'Oh,', 'would', 'I', 'could', 'describe', 'these', 'conceptions,', 'could', 'impress', 'upon', 'paper', 'all', 'that', 'is', 'living', 'so', 'full', 'and', 'warm', 'within', 'me,', 'that', 'it', 'might', 'be', 'the', 'mirror', 'of', 'my', 'soul,', 'as', 'my', 'soul', 'is', 'the', 'mirror', 'of', 'the', 'infinite', 'God!', 'O', 'my', 'friend', '--', 'but', 'it', 'is', 'too', 'much', 'for', 'my', 'strength', '--', 'I', 'sink', 'under', 'the', 'weight', 'of', 'the', 'splendour', 'of', 'these', 'visions!A', 'wonderful', 'serenity', 'has', 'taken', 'possession', 'of', 'my', 'entire', 'soul,', 'like', 'these', 'sweet', 'mornings', 'of', 'spring', 'which', 'I', 'enjoy', 'with', 'my', 'whole', 'heart.', 'I', 'am', 'alone,', 'and', 'feel', 'the', 'charm', 'of', 'existence', 'in', 'this', 'spot,', 'which', 'was', 'created', 'for', 'the', 'bliss', 'of', 'souls') fn corpus4() -> List[String]: return List[String]('Проснувшись', 'однажды', 'утром', 'после', 'беспокойного', 'сна,', 'Грегор', 'Замза', 'обнаружил,', 'что', 'он', 'у', 'себя', 'в', 'постели', 'превратился', 'в', 'страшное', 'насекомое.', 'Лежа', 'на', 'панцирнотвердой', 'спине,', 'он', 'видел,', 'стоило', 'ему', 'приподнять', 'голову,', 'свой', 'коричневый,', 'выпуклый,', 'разделенный', 'дугообразными', 'чешуйками', 'живот,', 'на', 'верхушке', 'которого', 'еле', 'держалось', 'готовое', 'вот-вот', 'окончательно', 'сползти', 'одеяло.', 'Его', 'многочисленные,', 'убого', 'тонкие', 'по', 'сравнению', 'с', 'остальным', 'телом', 'ножки', 'беспомощно', 'копошились', 'у', 'него', 'перед', 'глазами.', '«Что', 'со', 'мной', 'случилось?»', '–', 'подумал', 'он.', 'Это', 'не', 'было', 'сном.', 'Его', 'комната,', 'настоящая,', 'разве', 'что', 'слишком', 'маленькая,', 'но', 'обычная', 'комната,', 'мирно', 'покоилась', 'в', 'своих', 'четырех', 'хорошо', 'знакомых', 'стенах.', 'Над', 'столом,', 'где', 'были', 'разложены', 'распакованные', 'образцы', 'сукон', '–', 'Замза', 'был', 'коммивояжером,', '–', 'висел', 'портрет,', 'который', 'он', 'недавно', 'вырезал', 'из', 'иллюстрированного', 'журнала', 'и', 'вставил', 'в', 'красивую', 'золоченую', 'рамку.', 'На', 'портрете', 'была', 'изображена', 'дама', 'в', 'меховой', 'шляпе', 'и', 'боа,', 'она', 'сидела', 'очень', 'прямо', 'и', 'протягивала', 'зрителю', 'тяжелую', 'меховую', 'муфту,', 'в', 'которой', 'целиком', 'исчезала', 'ее', 'рука.', 'Затем', 'взгляд', 'Грегора', 'устремился', 'в', 'окно,', 'и', 'пасмурная', 'погода', '–', 'слышно', 'было,', 'как', 'по', 'жести', 'подоконника', 'стучат', 'капли', 'дождя', '–', 'привела', 'его', 'и', 'вовсе', 'в', 'грустное', 'настроение.', '«Хорошо', 'бы', 'еще', 'немного', 'поспать', 'и', 'забыть', 'всю', 'эту', 'чепуху»,', '–', 'подумал', 'он,', 'но', 'это', 'было', 'совершенно', 'неосуществимо,', 'он', 'привык', 'спать', 'на', 'правом', 'боку,', 'а', 'в', 'теперешнем', 'своем', 'состоянии', 'он', 'никак', 'не', 'мог', 'принять', 'этого', 'положения.', 'С', 'какой', 'бы', 'силой', 'ни', 'поворачивался', 'он', 'на', 'правый', 'бок,', 'он', 'неизменно', 'сваливался', 'опять', 'на', 'спину.', 'Закрыв', 'глаза,', 'чтобы', 'не', 'видеть', 'своих', 'барахтающихся', 'ног,', 'он', 'проделал', 'это', 'добрую', 'сотню', 'раз', 'и', 'отказался', 'от', 'этих', 'попыток', 'только', 'тогда,', 'когда', 'почувствовал', 'какую-то', 'неведомую', 'дотоле,', 'тупую', 'и', 'слабую', 'боль', 'в', 'боку.', '«Ах', 'ты,', 'господи,', '–', 'подумал', 'он,', '–', 'какую', 'я', 'выбрал', 'хлопотную', 'профессию!', 'Изо', 'дня', 'в', 'день', 'в', 'разъездах.', 'Деловых', 'волнений', 'куда', 'больше,', 'чем', 'на', 'месте,', 'в', 'торговом', 'доме,', 'а', 'кроме', 'того,', 'изволь', 'терпеть', 'тяготы', 'дороги,', 'думай', 'о', 'расписании', 'поездов,', 'мирись', 'с', 'плохим,', 'нерегулярным', 'питанием,', 'завязывай', 'со', 'все', 'новыми', 'и', 'новыми', 'людьми', 'недолгие,', 'никогда', 'не', 'бывающие', 'сердечными', 'отношения.', 'Черт', 'бы', 'побрал', 'все', 'это!»', 'Он', 'почувствовал', 'вверху', 'живота', 'легкий', 'зуд;', 'медленно', 'подвинулся', 'на', 'спине', 'к', 'прутьям', 'кровати,', 'чтобы', 'удобнее', 'было', 'поднять', 'голову;', 'нашел', 'зудевшее', 'место,', 'сплошь', 'покрытое,', 'как', 'оказалось,', 'белыми', 'непонятными', 'точечками;', 'хотел', 'было', 'ощупать', 'это', 'место', 'одной', 'из', 'ножек,', 'но', 'сразу', 'отдернул', 'ее,', 'ибо', 'даже', 'простое', 'прикосновение', 'вызвало', 'у', 'него,', 'Грегора,', 'озноб.', 'Он', 'соскользнул', 'в', 'прежнее', 'свое', 'положение.', '«От', 'этого', 'раннего', 'вставания,', '–', 'подумал', 'он,', '–', 'можно', 'совсем', 'обезуметь.', 'Человек', 'должен', 'высыпаться.', 'Другие', 'коммивояжеры', 'живут,', 'как', 'одалиски.', 'Когда', 'я,', 'например,', 'среди', 'дня', 'возвращаюсь', 'в', 'гостиницу,', 'чтобы', 'переписать', 'полученные', 'заказы,', 'эти', 'господа', 'только', 'завтракают.', 'А', 'осмелься', 'я', 'вести', 'себя', 'так,', 'мои', 'хозяин', 'выгнал', 'бы', 'меня', 'сразу.', 'Кто', 'знает,', 'впрочем,', 'может', 'быть,', 'это', 'было', 'бы', 'даже', 'очень', 'хорошо', 'для', 'меня.', 'Если', 'бы', 'я', 'не', 'сдерживался', 'ради', 'родителей,', 'я', 'бы', 'давно', 'заявил', 'об', 'уходе,', 'я', 'бы', 'подошел', 'к', 'своему', 'хозяину', 'и', 'выложил', 'ему', 'все,', 'что', 'о', 'нем', 'думаю.', 'Он', 'бы', 'так', 'и', 'свалился', 'с', 'конторки!', 'Странная', 'у', 'него', 'манера', '–', 'садиться', 'на', 'конторку', 'и', 'с', 'ее', 'высоты', 'разговаривать', 'со', 'служащим,', 'который', 'вдобавок', 'вынужден', 'подойти', 'вплотную', 'к', 'конторке', 'из-за', 'того,', 'что', 'хозяин', 'туг', 'на', 'ухо.', 'Однако', 'надежда', 'еще', 'не', 'совсем', 'потеряна:', 'как', 'только', 'я', 'накоплю', 'денег,', 'чтобы', 'выплатить', 'долг', 'моих', 'родителей', '–', 'на', 'это', 'уйдет', 'еще', 'лет', 'пять-шесть,', '–', 'я', 'так', 'и', 'поступлю.', 'Тут-то', 'мы', 'и', 'распрощаемся', 'раз', 'и', 'навсегда.', 'А', 'пока', 'что', 'надо', 'подниматься,', 'мой', 'поезд', 'отходит', 'в', 'пять».', 'И', 'он', 'взглянул', 'на', 'будильник,', 'который', 'тикал', 'на', 'сундуке.', '«Боже', 'правый!»', '–', 'подумал', 'он.', 'Было', 'половина', 'седьмого,', 'и', 'стрелки', 'спокойно', 'двигались', 'дальше,', 'было', 'даже', 'больше', 'половины,', 'без', 'малого', 'уже', 'три', 'четверти.', 'Неужели', 'будильник', 'не', 'звонил?', 'С', 'кровати', 'было', 'видно,', 'что', 'он', 'поставлен', 'правильно,', 'на', 'четыре', 'часа;', 'и', 'он,', 'несомненно,', 'звонил.', 'Но', 'как', 'можно', 'было', 'спокойно', 'спать', 'под', 'этот', 'сотрясающий', 'мебель', 'трезвон?', 'Ну,', 'спал-то', 'он', 'неспокойно,', 'но,', 'видимо,', 'крепко.', 'Однако', 'что', 'делать', 'теперь?', 'Следующий', 'поезд', 'уходит', 'в', 'семь', 'часов;', 'чтобы', 'поспеть', 'на', 'него,', 'он', 'должен', 'отчаянно', 'торопиться,', 'а', 'набор', 'образцов', 'еще', 'не', 'упакован,', 'да', 'и', 'сам', 'он', 'отнюдь', 'не', 'чувствует', 'себя', 'свежим', 'и', 'легким', 'на', 'подъем.', 'И', 'даже', 'поспей', 'он', 'на', 'поезд,', 'хозяйского', 'разноса', 'ему', 'все', 'равно', 'не', 'избежать', '–', 'ведь', 'рассыльный', 'торгового', 'дома', 'дежурил', 'у', 'пятичасового', 'поезда', 'и', 'давно', 'доложил', 'о', 'его,', 'Грегора,', 'опоздании.', 'Рассыльный,', 'человек', 'бесхарактерный', 'и', 'неумный,', 'был', 'ставленником', 'хозяина.', 'А', 'что,', 'если', 'сказаться', 'больным?', 'Но', 'это', 'было', 'бы', 'крайне', 'неприятно', 'и', 'показалось', 'бы', 'подозрительным,', 'ибо', 'за', 'пятилетнюю', 'свою', 'службу', 'Грегор', 'ни', 'разу', 'еще', 'не', 'болел.', 'Хозяин,', 'конечно,', 'привел', 'бы', 'врача', 'больничной', 'кассы', 'и', 'стал', 'попрекать', 'родителей', 'сыном-лентяем,', 'отводя', 'любые', 'возражения', 'ссылкой', 'на', 'этого', 'врача,', 'по', 'мнению', 'которого', 'все', 'люди', 'на', 'свете', 'совершенно', 'здоровы', 'и', 'только', 'не', 'любят', 'работать.', 'И', 'разве', 'в', 'данном', 'случае', 'он', 'был', 'бы', 'так', 'уж', 'неправ?', 'Если', 'не', 'считать', 'сонливости,', 'действительно', 'странной', 'после', 'такого', 'долгого', 'сна,', 'Грегор', 'и', 'в', 'самом', 'деле', 'чувствовал', 'себя', 'превосходно', 'и', 'был', 'даже', 'чертовски', 'голоден.Проснувшись', 'однажды', 'утром', 'после', 'беспокойного', 'сна,', 'Грегор', 'Замза', 'обнаружил,', 'что', 'он', 'у', 'себя', 'в', 'постели', 'превратился', 'в', 'страшное', 'насекомое.', 'Лежа', 'на', 'панцирнотвердой', 'спине,', 'он', 'видел,', 'стоило', 'ему', 'приподнять', 'голову,', 'свой', 'коричневый,', 'выпуклый,', 'разделенный', 'дугообразными', 'чешуйками', 'живот,', 'на', 'верхушке', 'которого', 'еле', 'держалось', 'готовое', 'вот-вот', 'окончательно', 'сползти', 'одеяло.', 'Его', 'многочисленные,', 'убого', 'тонкие', 'по', 'сравнению', 'с', 'остальным', 'телом', 'ножки', 'беспомощно', 'копошились', 'у', 'него', 'перед', 'глазами.', '«Что', 'со', 'мной', 'случилось?»', '–', 'подумал', 'он.', 'Это', 'не', 'было', 'сном.', 'Его', 'комната,', 'настоящая,', 'разве', 'что', 'слишком', 'маленькая,', 'но', 'обычная', 'комната,', 'мирно', 'покоилась', 'в', 'своих', 'четырех', 'хорошо', 'знакомых', 'стенах.', 'Над', 'столом,', 'где', 'были', 'разложены', 'распакованные', 'образцы', 'сукон', '–', 'Замза', 'был', 'коммивояжером,', '–', 'висел', 'портрет,', 'который', 'он', 'недавно', 'вырезал', 'из', 'иллюстрированного', 'журнала', 'и', 'вставил', 'в', 'красивую', 'золоченую', 'рамку.', 'На', 'портрете', 'была', 'изображена', 'дама', 'в', 'меховой', 'шляпе', 'и', 'боа,', 'она', 'сидела', 'очень', 'прямо', 'и', 'протягивала', 'зрителю', 'тяжелую', 'меховую', 'муфту,', 'в', 'которой', 'целиком', 'исчезала', 'ее', 'рука.', 'Затем', 'взгляд', 'Грегора', 'устремился', 'в', 'окно,', 'и', 'пасмурная', 'погода', '–', 'слышно', 'было,', 'как', 'по', 'жести', 'подоконника', 'стучат', 'капли', 'дождя', '–', 'привела', 'его', 'и', 'вовсе', 'в', 'грустное', 'настроение.', '«Хорошо', 'бы', 'еще', 'немного', 'поспать', 'и', 'забыть', 'всю', 'эту', 'чепуху»,', '–', 'подумал', 'он,', 'но', 'это', 'было', 'совершенно', 'неосуществимо,', 'он', 'привык', 'спать', 'на', 'правом', 'боку,', 'а', 'в', 'теперешнем', 'своем', 'состоянии', 'он', 'никак', 'не', 'мог', 'принять', 'этого', 'положения.', 'С', 'какой', 'бы', 'силой', 'ни', 'поворачивался', 'он', 'на', 'правый', 'бок,', 'он', 'неизменно', 'сваливался', 'опять', 'на', 'спину.') fn corpus5() -> List[String]: return List[String]('Weit', 'hinten,', 'hinter', 'den', 'Wortbergen,', 'fern', 'der', 'Länder', 'Vokalien', 'und', 'Konsonantien', 'leben', 'die', 'Blindtexte.', 'Abgeschieden', 'wohnen', 'sie', 'in', 'Buchstabhausen', 'an', 'der', 'Küste', 'des', 'Semantik,', 'eines', 'großen', 'Sprachozeans.', 'Ein', 'kleines', 'Bächlein', 'namens', 'Duden', 'fließt', 'durch', 'ihren', 'Ort', 'und', 'versorgt', 'sie', 'mit', 'den', 'nötigen', 'Regelialien.', 'Es', 'ist', 'ein', 'paradiesmatisches', 'Land,', 'in', 'dem', 'einem', 'gebratene', 'Satzteile', 'in', 'den', 'Mund', 'fliegen.', 'Nicht', 'einmal', 'von', 'der', 'allmächtigen', 'Interpunktion', 'werden', 'die', 'Blindtexte', 'beherrscht', '–', 'ein', 'geradezu', 'unorthographisches', 'Leben.', 'Eines', 'Tages', 'aber', 'beschloß', 'eine', 'kleine', 'Zeile', 'Blindtext,', 'ihr', 'Name', 'war', 'Lorem', 'Ipsum,', 'hinaus', 'zu', 'gehen', 'in', 'die', 'weite', 'Grammatik.', 'Der', 'große', 'Oxmox', 'riet', 'ihr', 'davon', 'ab,', 'da', 'es', 'dort', 'wimmele', 'von', 'bösen', 'Kommata,', 'wilden', 'Fragezeichen', 'und', 'hinterhältigen', 'Semikoli,', 'doch', 'das', 'Blindtextchen', 'ließ', 'sich', 'nicht', 'beirren.', 'Es', 'packte', 'seine', 'sieben', 'Versalien,', 'schob', 'sich', 'sein', 'Initial', 'in', 'den', 'Gürtel', 'und', 'machte', 'sich', 'auf', 'den', 'Weg.', 'Als', 'es', 'die', 'ersten', 'Hügel', 'des', 'Kursivgebirges', 'erklommen', 'hatte,', 'warf', 'es', 'einen', 'letzten', 'Blick', 'zurück', 'auf', 'die', 'Skyline', 'seiner', 'Heimatstadt', 'Buchstabhausen,', 'die', 'Headline', 'von', 'Alphabetdorf', 'und', 'die', 'Subline', 'seiner', 'eigenen', 'Straße,', 'der', 'Zeilengasse.', 'Wehmütig', 'lief', 'ihm', 'eine', 'rhetorische', 'Frage', 'über', 'die', 'Wange,', 'dann', 'setzte', 'es', 'seinen', 'Weg', 'fort.', 'Unterwegs', 'traf', 'es', 'eine', 'Copy.', 'Die', 'Copy', 'warnte', 'das', 'Blindtextchen,', 'da,', 'wo', 'sie', 'herkäme', 'wäre', 'sie', 'zigmal', 'umgeschrieben', 'worden', 'und', 'alles,', 'was', 'von', 'ihrem', 'Ursprung', 'noch', 'übrig', 'wäre,', 'sei', 'das', 'Wort', '"und"', 'und', 'das', 'Blindtextchen', 'solle', 'umkehren', 'und', 'wieder', 'in', 'sein', 'eigenes,', 'sicheres', 'Land', 'zurückkehren.', 'Doch', 'alles', 'Gutzureden', 'konnte', 'es', 'nicht', 'überzeugen', 'und', 'so', 'dauerte', 'es', 'nicht', 'lange,', 'bis', 'ihm', 'ein', 'paar', 'heimtückische', 'Werbetexter', 'auflauerten,', 'es', 'mit', 'Longe', 'und', 'Parole', 'betrunken', 'machten', 'und', 'es', 'dann', 'in', 'ihre', 'Agentur', 'schleppten,', 'wo', 'sie', 'es', 'für', 'ihre', 'Projekte', 'wieder', 'und', 'wieder', 'mißbrauchten.', 'Und', 'wenn', 'es', 'nicht', 'umgeschrieben', 'wurde,', 'dann', 'benutzen', 'Sie', 'es', 'immernoch.', 'Weit', 'hinten,', 'hinter', 'den', 'Wortbergen,', 'fern', 'der', 'Länder', 'Vokalien', 'und', 'Konsonantien', 'leben', 'die', 'Blindtexte.', 'Abgeschieden', 'wohnen', 'sie', 'in', 'Buchstabhausen', 'an', 'der', 'Küste', 'des', 'Semantik,', 'eines', 'großen', 'Sprachozeans.', 'Ein', 'kleines', 'Bächlein', 'namens', 'Duden', 'fließt', 'durch', 'ihren', 'Ort', 'und', 'versorgt', 'sie', 'mit', 'den', 'nötigen', 'Regelialien.', 'Es', 'ist', 'ein', 'paradiesmatisches', 'Land,', 'in', 'dem', 'einem', 'gebratene', 'Satzteile', 'in', 'den', 'Mund', 'fliegen.', 'Nicht', 'einmal', 'von', 'der', 'allmächtigen', 'Interpunktion', 'werden', 'die', 'Blindtexte', 'beherrscht', '–', 'ein', 'geradezu', 'unorthographisches', 'Leben.', 'Eines', 'Tages', 'aber', 'beschloß', 'eine', 'kleine', 'Zeile', 'Blindtext,', 'ihr', 'Name', 'war', 'Lorem', 'Ipsum,', 'hinaus', 'zu', 'gehen', 'in', 'die', 'weite', 'Grammatik.', 'Der', 'große', 'Oxmox', 'riet', 'ihr', 'davon', 'ab,', 'da', 'es', 'dort', 'wimmele', 'von', 'bösen', 'Kommata,', 'wilden', 'Fragezeichen', 'und', 'hinterhältigen', 'Semikoli,', 'doch', 'das', 'Blindtextchen', 'ließ', 'sich', 'nicht', 'beirren.', 'Es', 'packte', 'seine', 'sieben', 'Versalien,', 'schob', 'sich', 'sein', 'Initial', 'in', 'den', 'Gürtel', 'und', 'machte', 'sich', 'auf', 'den', 'Weg.', 'Als', 'es', 'die', 'ersten', 'Hügel', 'des', 'Kursivgebirges', 'erklommen', 'hatte,', 'warf', 'es', 'einen', 'letzten', 'Blick', 'zurück', 'auf', 'die', 'Skyline', 'seiner', 'Heimatstadt', 'Buchstabhausen,', 'die', 'Headline', 'von', 'Alphabetdorf', 'und', 'die', 'Subline', 'seiner', 'eigenen', 'Straße,', 'der', 'Zeilengasse.', 'Wehmütig', 'lief', 'ihm', 'eine', 'rhetorische', 'Frage', 'über', 'die', 'Wange,', 'dann', 'setzte', 'es', 'seinen', 'Weg', 'fort.', 'Unterwegs', 'traf', 'es', 'eine', 'Copy.', 'Die', 'Copy', 'warnte', 'das', 'Blindtextchen,', 'da,', 'wo', 'sie', 'herkäme', 'wäre', 'sie', 'zigmal', 'umgeschrieben', 'worden', 'und', 'alles,', 'was', 'von', 'ihrem', 'Ursprung', 'noch', 'übrig', 'wäre,', 'sei', 'das', 'Wort', '"und"', 'und', 'das', 'Blindtextchen', 'solle', 'umkehren', 'und', 'wieder', 'in', 'sein', 'eigenes,', 'sicheres', 'Land', 'zurückkehren.', 'Doch', 'alles', 'Gutzureden', 'konnte', 'es', 'nicht', 'überzeugen', 'und', 'so', 'dauerte', 'es', 'nicht', 'lange,', 'bis', 'ihm', 'ein', 'paar', 'heimtückische', 'Werbetexter', 'auflauerten,', 'es', 'mit', 'Longe', 'und', 'Parole', 'betrunken', 'machten', 'und', 'es', 'dann', 'in', 'ihre', 'Agentur', 'schleppten,', 'wo', 'sie', 'es', 'für', 'ihre', 'Projekte', 'wieder', 'und', 'wieder', 'mißbrauchten.', 'Und', 'wenn', 'es', 'nicht', 'umgeschrieben', 'wurde,', 'dann', 'benutzen', 'Sie', 'es', 'immernoch.', 'Weit', 'hinten,', 'hinter', 'den', 'Wortbergen,', 'fern', 'der', 'Länder', 'Vokalien', 'und', 'Konsonantien', 'leben', 'die', 'Blindtexte.', 'Abgeschieden', 'wohnen', 'sie', 'in', 'Buchstabhausen', 'an', 'der', 'Küste', 'des', 'Semantik,', 'eines', 'großen', 'Sprachozeans.', 'Ein', 'kleines', 'Bächlein', 'namens', 'Duden', 'fließt', 'durch', 'ihren', 'Ort', 'und', 'versorgt', 'sie', 'mit', 'den', 'nötigen', 'Regelialien.', 'Es', 'ist', 'ein', 'paradiesmatisches', 'Land,', 'in', 'dem', 'einem', 'gebratene', 'Satzteile', 'in', 'den', 'Mund', 'fliegen.', 'Nicht', 'einmal', 'von', 'der', 'allmächtigen', 'Interpunktion', 'werden', 'die', 'Blindtexte', 'beherrscht', '–', 'ein', 'geradezu', 'unorthographisches', 'Leben.', 'Eines', 'Tages', 'aber', 'beschloß', 'eine', 'kleine', 'Zeile', 'Blindtext,', 'ihr', 'Name', 'war', 'Lorem', 'Ipsum,', 'hinaus', 'zu', 'gehen', 'in', 'die', 'weite', 'Grammatik.', 'Der', 'große', 'Oxmox', 'riet', 'ihr', 'davon', 'ab,', 'da', 'es', 'dort', 'wimmele', 'von', 'bösen', 'Kommata,', 'wilden', 'Fragezeichen', 'und', 'hinterhältigen', 'Semikoli,', 'doch', 'das', 'Blindtextchen', 'ließ', 'sich', 'nicht', 'beirren.', 'Es', 'packte', 'seine', 'sieben', 'Versalien,', 'schob', 'sich', 'sein', 'Initial', 'in', 'den', 'Gürtel', 'und', 'machte', 'sich', 'auf', 'den', 'Weg.', 'Als', 'es', 'die', 'ersten', 'Hügel', 'des', 'Kursivgebirges', 'erklommen', 'hatte,', 'warf', 'es', 'einen', 'letzten', 'Blick', 'zurück', 'auf', 'die', 'Skyline', 'seiner', 'Heimatstadt', 'Buchstabhausen,', 'die', 'Headline', 'von', 'Alphabetdorf', 'und', 'die', 'Subline', 'seiner', 'eigenen', 'Straße,', 'der', 'Zeilengasse.', 'Wehmütig', 'lief', 'ihm', 'eine', 'rhetorische', 'Frage', 'über', 'die', 'Wange,', 'dann', 'setzte', 'es', 'seinen', 'Weg', 'fort.', 'Unterwegs', 'traf', 'es', 'eine', 'Copy.', 'Die', 'Copy', 'warnte', 'das', 'Blindtextchen,', 'da,', 'wo', 'sie', 'herkäme', 'wäre', 'sie', 'zigmal', 'umgeschrieben', 'worden', 'und', 'alles,', 'was', 'von', 'ihrem', 'Ursprung', 'noch', 'übrig', 'wäre,', 'sei', 'das', 'Wort', '"und"', 'und', 'das', 'Blindtextchen', 'solle', 'umkehren', 'und', 'wieder', 'in', 'sein', 'eigenes,', 'sicheres', 'Land', 'zurückkehren.', 'Doch', 'alles', 'Gutzureden', 'konnte', 'es', 'nicht', 'überzeugen', 'und', 'so', 'dauerte', 'es', 'nicht', 'lange,', 'bis', 'ihm', 'ein', 'paar', 'heimtückische', 'Werbetexter', 'auflauerten,', 'es', 'mit', 'Longe', 'und', 'Parole', 'betrunken', 'machten', 'und', 'es', 'dann', 'in', 'ihre', 'Agentur', 'schleppten,', 'wo', 'sie', 'es', 'für', 'ihre', 'Projekte', 'wieder', 'und', 'wieder', 'mißbrauchten.', 'Und', 'wenn', 'es', 'nicht', 'umgeschrieben', 'wurde,', 'dann', 'benutzen', 'Sie', 'es', 'immernoch.Weit', 'hinten,', 'hinter', 'den', 'Wortbergen,', 'fern', 'der', 'Länder', 'Vokalien', 'und', 'Konsonantien', 'leben', 'die', 'Blindtexte.', 'Abgeschieden', 'wohnen', 'sie', 'in', 'Buchstabhausen', 'an', 'der', 'Küste', 'des', 'Semantik,', 'eines', 'großen', 'Sprachozeans.', 'Ein', 'kleines', 'Bächlein', 'namens', 'Duden', 'fließt', 'durch', 'ihren', 'Ort', 'und', 'versorgt', 'sie', 'mit', 'den', 'nötigen', 'Regelialien.', 'Es', 'ist', 'ein', 'paradiesmatisches', 'Land,', 'in', 'dem', 'einem', 'gebratene', 'Satzteile', 'in', 'den', 'Mund', 'fliegen.', 'Nicht', 'einmal', 'von', 'der', 'allmächtigen', 'Interpunktion', 'werden', 'die', 'Blindtexte', 'beherrscht', '–', 'ein', 'geradezu', 'unorthographisches', 'Leben.', 'Eines', 'Tages', 'aber', 'beschloß', 'eine', 'kleine', 'Zeile', 'Blindtext,', 'ihr', 'Name', 'war', 'Lorem', 'Ipsum,', 'hinaus', 'zu', 'gehen', 'in', 'die', 'weite', 'Grammatik.', 'Der', 'große', 'Oxmox', 'riet', 'ihr', 'davon', 'ab,', 'da', 'es', 'dort', 'wimmele', 'von', 'bösen', 'Kommata,', 'wilden', 'Fragezeichen', 'und', 'hinterhältigen', 'Semikoli,', 'doch', 'das', 'Blindtextchen', 'ließ', 'sich', 'nicht', 'beirren.', 'Es', 'packte', 'seine', 'sieben', 'Versalien,', 'schob', 'sich', 'sein', 'Initial', 'in', 'den', 'Gürtel', 'und', 'machte', 'sich', 'auf', 'den', 'Weg.', 'Als', 'es', 'die', 'ersten', 'Hügel', 'des', 'Kursivgebirges', 'erklommen', 'hatte,', 'warf', 'es', 'einen') fn corpus6() -> List[String]: return List[String]('米くを舵4物委らご氏松ハナテフ月関ソ時平ふいの博情れじフ牟万い元56園フメヤオ試図ロツヤ未備王こと傷喫羅踊んゆし。栃ユヱオ書著作ユソツロ英祉業ア大課ご権質フべ空8午キ切軟づン著郎そゃす格町採ヱオマコ処8付国ムハチア究表でなだ際無ロミヱ地兵ぴげ庭体すク発抜爆位や。楽富むゆず盛航カナセ携代ハ本高きた員59今骸ンラえぜ城解イケ穴訴ぽぎ属住ヤケトヌ抱点ト広注厚でて。', '国リ出難セユメ軍手ヘカウ画形サヲシ猛85用ヲキミ心死よしと身処ケヨミオ教主ーぽ事業んく字国たさょ図能シミスヤ社8板ル岡世58次戒知院んれり。市メ誘根カ数問禁竹ゃれえみ給辺のでみき今二ぎさ裕止過こクすと無32郎所ラた生展ヌヘス成度慣葬勇厘ばてか。室ゃ下携疲ム色権がぽりっ銃週ノオ姫千テム健蔵い研手ッ放容ル告属め旅側26企サノヨ宅都福ぞ通待ちぴね種脳イど労希望義通むン。', '罰しい続負せ著低たル異師ユハワ東添質コチ転集ルヤ雇聴約ヒ前統らた情厳ゆさでや真胸や有披暑棚豆ゆぼたけ。盛ワセロナ情競クるっわ講3音ずをせ少地めしぜょ手63明視れに判企ヒヌエソ求総58特本ね井比ユラキ禁頭馬るゅリす能率率かがさわ。葉サソ医郡ヱヘソ労帰ナケスミ救写ワヘ株審ネヒニミ安逮イ人画ラ涯車はラ極騒りなド件5級ンかふー劇41著ぱぐ凱討だ文世ぶづどま界善魅マ渓経競融れがや。', '連ーぜらご模分ッ視外ばフく運発群ほぼづ育越一ほごクけ案募ヲイソ治会イせフ製君ぜた漢村1変リヒ構5際ツ御文ヲ臭入さドぼ代書ハケ引技ろみれ回観注倉徹ぱ。論ラづ海要サ情座ゃり齢宣ラモエ芸化エマホ覧催回ら戦69本外ト葬岳な政画か連針ぴリフず。約ル闘辺ぽ経2応掲ホサアラ塾小コラ画決クノオ上室レヌヱ勝逮ぜるえむ責豊チノ明意ひけ訟6碁草メタチエ財午召喝塊む。', '決めでわ名金つけレわ続人県約ぽぼす尾腹ユサ戦載リシ護賀レモフツ重涯ニ治者むんっみ職更カタチレ提話2何ワ責東まけげふ能政ヌ供禁がびてわ提改倶れめ。読み担後ぽ安加ぎ論鹿ツ統最お気麻月つじもあ竜思いろめ判必満理トコ文連ムイウハ寄串ざほびー。文ゆこっ向27年メイ便能ノセヲ待1王スねたゆ伝派んね点過カト治読よにきべ使人スシ都言え阻8割べづえみ注引敷的岳犠眠どそ。', '学用イだ医客開ロ供界もぞだ実隆モイヌ務坂ナコヲ権野ろづ初場ぱ低会づぱじ新倒コ化政レ止奮浸猪ッわえづ。形いやリ要帰ほまむだ業領スル必打さ島14巻リ集日ネヘホタ面幅ち写上そぴ円図ムタコモ報使イわざと会催ヤヲ康証をドぶレ盤岡ホハツ作29管しをめ公問懐蓄っさ。来ゆぼあぱ投秋シ語右ぐ身靖かば辛握捕家記ヘワ神岐囲づ毘観メテクツ政73夕罪57需93誌飲査仁さ。', '変レめ束球よんま会特ヱコ聞重だ史純ーどる件32浦レぴよゃ上強ネラリロ査従セユヤ専棋光レ作表ひぶ予正ぜーな誉確フス函6報円ス進治ね能営済否雄でわょ。42生型ば着続ア短実ぎおめび前環闘ラヤヲル診均っとにの声公トヱテマ整試椅情久妊舌頃ざとっく。品キチトテ阿国ラら受87世ヲフセリ川86個ーょぼげ危子ヘレカメ無会ぱかへ事通んかて電条ロツ徴商ぶぞそを居暑メ害広せもがり禁応レミヲ応響割壮憶はぱ。', '千れンが織財メニ況界ネトレミ学豊フオホシ近月レたやご的罪ょな菱技ちる警栗エセ提89林危氷48参ア説森クキヒヱ薬社ホコエリ負和ルび紀下ケミイ掲歳特ごず扱底ク護木連ちクを各形ばすか。変ぱなれ町7融ヌ街準以タユヘム質裕ぶで遺語俊ぎずょ事金文キ写多山ーゆに歩帯すで会世クぜよ論写ヲ達71林危氷5間続ぎぜび高怠す。', '係8青け応著ミ戦条ナヘネカ思79未ぎ算伊をゃ泉人ーづ需説っ畑鹿27軽ラソツ権2促千護ルロナカ開国ケ暴嶋ご池表だ。佐フナ訪麻はてせば勝効をあ医戦画とさわぴ者両すいあ並来んば載食ぴ件友頂業へえぞ魚祝ネラ聞率スコリケ始全ンこび夫出ドふ今布うぎふゅ実克即哉循やしんな。', '暮す備54依紀てッん末刊と柔称むてス無府ケイ変壌をぱ汁連フマス海世ヌ中負知問ナヘケ純推ひ読着ヒ言若私軽れ。掲けフむ王本オコ線人をっさ必和断セソヲハ図芸ちかな防長りぶは投新意相ツ並5余セ職岳ぞ端古空援そ。森ヨエチ題5東っ自兄ち暴5近鹿横ト的京ハ安氷ナキ深際ぎ並節くスむの権工ほルせ京49効タムチ処三ぞぴラ済国ずっ文経ヘトミ水分準そが。') fn corpus7() -> List[String]: return List[String]("AbortMultipartUpload","CompleteMultipartUpload","CopyObject","CreateBucket","CreateMultipartUpload","DeleteBucket","DeleteBucketAnalyticsConfiguration","DeleteBucketCors","DeleteBucketEncryption","DeleteBucketIntelligentTieringConfiguration","DeleteBucketInventoryConfiguration","DeleteBucketLifecycle","DeleteBucketMetricsConfiguration","DeleteBucketOwnershipControls","DeleteBucketPolicy","DeleteBucketReplication","DeleteBucketTagging","DeleteBucketWebsite","DeleteObject","DeleteObjects","DeleteObjectTagging","DeletePublicAccessBlock","GetBucketAccelerateConfiguration","GetBucketAcl","GetBucketAnalyticsConfiguration","GetBucketCors","GetBucketEncryption","GetBucketIntelligentTieringConfiguration","GetBucketInventoryConfiguration","GetBucketLifecycle","GetBucketLifecycleConfiguration","GetBucketLocation","GetBucketLogging","GetBucketMetricsConfiguration","GetBucketNotification","GetBucketNotificationConfiguration","GetBucketOwnershipControls","GetBucketPolicy","GetBucketPolicyStatus","GetBucketReplication","GetBucketRequestPayment","GetBucketTagging","GetBucketVersioning","GetBucketWebsite","GetObject","GetObjectAcl","GetObjectAttributes","GetObjectLegalHold","GetObjectLockConfiguration","GetObjectRetention","GetObjectTagging","GetObjectTorrent","GetPublicAccessBlock","HeadBucket","HeadObject","ListBucketAnalyticsConfigurations","ListBucketIntelligentTieringConfigurations","ListBucketInventoryConfigurations","ListBucketMetricsConfigurations","ListBuckets","ListMultipartUploads","ListObjects","ListObjectsV2","ListObjectVersions","ListParts","PutBucketAccelerateConfiguration","PutBucketAcl","PutBucketAnalyticsConfiguration","PutBucketCors","PutBucketEncryption","PutBucketIntelligentTieringConfiguration","PutBucketInventoryConfiguration","PutBucketLifecycle","PutBucketLifecycleConfiguration","PutBucketLogging","PutBucketMetricsConfiguration","PutBucketNotification","PutBucketNotificationConfiguration","PutBucketOwnershipControls","PutBucketPolicy","PutBucketReplication","PutBucketRequestPayment","PutBucketTagging","PutBucketVersioning","PutBucketWebsite","PutObject","PutObjectAcl","PutObjectLegalHold","PutObjectLockConfiguration","PutObjectRetention","PutObjectTagging","PutPublicAccessBlock","RestoreObject","SelectObjectContent","UploadPart","UploadPartCopy","WriteGetObjectResponse", "CreateAccessPoint","CreateAccessPointForObjectLambda","CreateBucket","CreateJob","CreateMultiRegionAccessPoint","DeleteAccessPoint","DeleteAccessPointForObjectLambda","DeleteAccessPointPolicy","DeleteAccessPointPolicyForObjectLambda","DeleteBucket","DeleteBucketLifecycleConfiguration","DeleteBucketPolicy","DeleteBucketReplication","DeleteBucketTagging","DeleteJobTagging","DeleteMultiRegionAccessPoint","DeletePublicAccessBlock","DeleteStorageLensConfiguration","DeleteStorageLensConfigurationTagging","DescribeJob","DescribeMultiRegionAccessPointOperation","GetAccessPoint","GetAccessPointConfigurationForObjectLambda","GetAccessPointForObjectLambda","GetAccessPointPolicy","GetAccessPointPolicyForObjectLambda","GetAccessPointPolicyStatus","GetAccessPointPolicyStatusForObjectLambda","GetBucket","GetBucketLifecycleConfiguration","GetBucketPolicy","GetBucketReplication","GetBucketTagging","GetBucketVersioning","GetJobTagging","GetMultiRegionAccessPoint","GetMultiRegionAccessPointPolicy","GetMultiRegionAccessPointPolicyStatus","GetMultiRegionAccessPointRoutes","GetPublicAccessBlock","GetStorageLensConfiguration","GetStorageLensConfigurationTagging","ListAccessPoints","ListAccessPointsForObjectLambda","ListJobs","ListMultiRegionAccessPoints","ListRegionalBuckets","ListStorageLensConfigurations","PutAccessPointConfigurationForObjectLambda","PutAccessPointPolicy","PutAccessPointPolicyForObjectLambda","PutBucketLifecycleConfiguration","PutBucketPolicy","PutBucketReplication","PutBucketTagging","PutBucketVersioning","PutJobTagging","PutMultiRegionAccessPointPolicy","PutPublicAccessBlock","PutStorageLensConfiguration","PutStorageLensConfigurationTagging","SubmitMultiRegionAccessPointRoutes","UpdateJobPriority","UpdateJobStatus") --- quick_sort/__init__.mojo --- from .sort import quick_sort --- quick_sort/sort.mojo --- @always_inline fn _partition[D: DType](inout vector: List[SIMD[D, 1]], low: Int, high: Int) -> Int: var pivot = vector[high] var i = low - 1 for j in range(low, high): if vector[j] <= pivot: i += 1 vector[j], vector[i] = vector[i], vector[j] vector[i + 1], vector[high] = vector[high], vector[i + 1] return i + 1 fn _quick_sort[D: DType](inout vector: List[SIMD[D, 1]], low: Int, high: Int): if low < high: var pi = _partition(vector, low, high) _quick_sort(vector, low, pi - 1) _quick_sort(vector, pi + 1, high) fn quick_sort[D: DType](inout vector: List[SIMD[D, 1]]): _quick_sort[D](vector, 0, len(vector) - 1) @always_inline fn swap[D: CollectionElement](inout vector: List[D], a: Int, b: Int): vector[a], vector[b] = vector[b], vector[a] @always_inline fn _partition[D: CollectionElement, lte: fn (D, D) -> Bool](inout vector: List[D], low: Int, high: Int) -> Int: var pivot = vector[high] var i = low - 1 for j in range(low, high): if lte(vector[j], pivot): i += 1 swap(vector, i, j) swap(vector, i + 1, high) return i + 1 fn _quick_sort[D: CollectionElement, lte: fn (D, D) -> Bool](inout vector: List[D], low: Int, high: Int): if low < high: var pi = _partition[D, lte](vector, low, high) _quick_sort[D, lte](vector, low, pi - 1) _quick_sort[D, lte](vector, pi + 1, high) fn quick_sort[D: CollectionElement, lt: fn (D, D) -> Bool](inout vector: List[D]): _quick_sort[D, lt](vector, 0, len(vector) - 1) --- quick_sort_sample.mojo --- from my_utils import * from string_compare import lt from quick_sort import quick_sort from time import now fn main(): var v1 = List[UInt32]() v1.append(13) v1.append(31) v1.append(1) v1.append(7) v1.append(7) v1.append(4513) v1.append(45) print_v(v1) quick_sort(v1) print_v(v1) var corpus = corpus7() var tik = now() quick_sort[String, lt](corpus) var tok = now() print_v(corpus) print(tok - tik) corpus = corpus3() tik = now() quick_sort[String, lt](corpus) tok = now() print_v(corpus) print(tok - tik) --- radix_sort_sample.mojo --- from my_utils import * from radix_sorting import radix_sort, radix_sort11, radix_sort13, radix_sort16, msb_radix_sort from time import now fn test_radix(): var v1 = List[UInt32]() v1.append(13) v1.append(31) v1.append(1) v1.append(7) v1.append(7) v1.append(4513) v1.append(45) print_v(v1) radix_sort(v1) print_v(v1) var v2 = List[Int8]() v2.append(0) v2.append(-23) v2.append(123) v2.append(-48) print_v(v2) radix_sort(v2) print_v(v2) var v3 = List[Float32]() v3.append(0) v3.append(-23) v3.append(123) v3.append(-48) v3.append(-48.1) v3.append(48.111) v3.append(48.101) v3.append(48.10111) v3.append(-0.10111) v3.append(0.10111) print_v(v3) radix_sort(v3) print_v(v3) var v4 = List[Float64]() v4.append(0) v4.append(-23) v4.append(123) v4.append(-48) v4.append(-48.1) v4.append(48.111) v4.append(48.101) v4.append(48.10111) v4.append(-0.10111) v4.append(0.10111) print_v(v4) radix_sort(v4) print_v(v4) print("DONE!!") fn test_11(): var v3 = List[Float32]() v3.append(0) v3.append(-23) v3.append(123) v3.append(-48) v3.append(-48.1) v3.append(48.111) v3.append(48.101) v3.append(48.10111) v3.append(-0.10111) v3.append(0.10111) print_v(v3) radix_sort11(v3) print_v(v3) fn test_13(): var v3 = List[Float64]() v3.append(0) v3.append(-23) v3.append(123) v3.append(-48) v3.append(-48.1) v3.append(48.111) v3.append(48.101) v3.append(48.10111) v3.append(-0.10111) v3.append(0.10111) print_v(v3) radix_sort13(v3) print_v(v3) fn test_16(): var v3 = List[Float64]() v3.append(0) v3.append(-23) v3.append(123) v3.append(-48) v3.append(-48.1) v3.append(48.111) v3.append(48.101) v3.append(48.10111) v3.append(-0.10111) v3.append(0.10111) print_v(v3) radix_sort16(v3) print_v(v3) fn main(): test_radix() test_11() test_13() test_16() var corpus = corpus7() msb_radix_sort(corpus) var tik = now() print_v(corpus) var tok = now() print("Duration", tok - tik) corpus = corpus3() msb_radix_sort(corpus) tik = now() print_v(corpus) tok = now() print("Duration", tok - tik) --- radix_sorting/__init__.mojo --- from .radix_sorting import radix_sort from .radix_sorting11 import radix_sort11 from .radix_sorting13 import radix_sort13 from .radix_sorting16 import radix_sort16 from .msb_radix_sorting import msb_radix_sort --- radix_sorting/msb_radix_sorting.mojo --- @always_inline fn _max(inout x: Int, y: Int): x = x ^ ((x ^ y) & -int(x < y)) @always_inline fn lt(a: String, b: String, depth: Int) -> Bool: var min_len = min(len(a), len(b)) - depth var res = memcmp(a.unsafe_uint8_ptr().offset(depth), b.unsafe_uint8_ptr().offset(depth), min_len) return len(a) <= len(b) if res == 0 else res < 0 @always_inline fn _insertion_sort(inout values: List[String], start: Int, end: Int, depth: Int): for i in range(start, end): var key = values[i] var j = i - 1 while j >= start and lt(key, values[j], depth): values[j + 1] = values[j] j -= 1 values[j + 1] = key fn _msb_radix_sort(inout values: List[String], start: Int, end: Int, depth: Int): # print(start, end, depth) if end - start <= 32: _insertion_sort(values, start, end, depth) return var counts = stack_allocation[256 * 2, DType.uint32]() var out = List(values) memset_zero(counts, 256 * 2) var sums = counts.offset(256) var max_len = 0 for i in range(start, end): var v = values[i] var p = DTypePointer(v.unsafe_uint8_ptr()).load(depth) _max(max_len, len(v)) # var c = bitcast[DType.uint8](buf[depth]) counts[int(p)] += 1 if depth >= max_len: return # for i in range(256): # print(counts.load(i), end="\n" if i == 255 else ", ") var element = counts[0] sums[0] = element var partitions = List[Int]() if element > 1: partitions.append(0) for i in range(1, 256): if counts[i] > 1: partitions.append(i) sums[i] = counts[i] + element element = sums[i] # for i in range(256): # print(sums.load(i), end="\n" if i == 255 else ", ") # for p in partitions: # print(p[], ", ") # print() if len(partitions) == 1 and partitions[0] == end - start: _msb_radix_sort(values, int(start), int(end), depth + 1) else: var i = end - 1 while i >= start: # print(i) var c = int(values[i]._buffer[depth]) out[int(sums[c] - 1) + start] = values[i] sums[c] -= 1 i -= 1 # for o in out: # print(o[], end=", ") # print() values = out for p in partitions: var start = start + sums[p[]] var end = start + counts[p[]] _msb_radix_sort(values, int(start), int(end), depth + 1) fn msb_radix_sort(inout values: List[String]): _msb_radix_sort(values, 0, len(values), 0) --- radix_sorting/radix_sorting.mojo --- # from algorithm import unroll from memory import memset_zero, memcpy, stack_allocation from memory.unsafe import bitcast # from math.limit import max_or_inf alias last_bit_8 = 1 << 7 alias last_bit_16 = 1 << 15 alias last_bit_32 = 1 << 31 alias last_bit_64 = 1 << 63 @always_inline fn _get_index[D: DType, place: Int](vector: List[SIMD[D, 1]], v_index: Int) -> Int: @parameter if D == DType.int8: return int((bitcast[DType.uint8, 1](vector[v_index]) ^ last_bit_8) >> place) & 255 elif D == DType.int16: return int((bitcast[DType.uint16, 1](vector[v_index]) ^ last_bit_16) >> place) & 255 elif D == DType.float16: var f = bitcast[DType.uint16, 1](vector[v_index]) var mask = bitcast[DType.uint16, 1](-bitcast[DType.int16, 1](f >> 15) | last_bit_16) return int((f ^ mask) >> place) & 255 elif D == DType.int32: return int((bitcast[DType.uint32, 1](vector[v_index]) ^ last_bit_32) >> place) & 255 elif D == DType.float32: var f = bitcast[DType.uint32, 1](vector[v_index]) var mask = bitcast[DType.uint32, 1](-bitcast[DType.int32, 1](f >> 31) | last_bit_32) return int((f ^ mask) >> place) & 255 elif D == DType.int64: return int((bitcast[DType.uint64, 1](vector[v_index]) ^ last_bit_64) >> place) & 255 elif D == DType.float64: var f = bitcast[DType.uint64, 1](vector[v_index]) var mask = bitcast[DType.uint64, 1](-bitcast[DType.int64, 1](f >> 63) | last_bit_64) return int((f ^ mask) >> place) & 255 else: return int(vector[v_index] >> place) & 255 @always_inline fn _counting_sort[D: DType, CD:DType, place: Int](inout vector: List[SIMD[D, 1]]): var size = len(vector) var output = List[SIMD[D, 1]](capacity=size) memset_zero(output.data, size) output.resize(size) var counts = stack_allocation[256, CD]() memset_zero(counts, 256) for i in range(size): var index = _get_index[D, place](vector, i) counts.offset(index).store(counts.offset(index).load() + 1) var count = counts.offset(0).load() for i in range(1, 256): count += counts.offset(i).load() counts.offset(i).store(count) # var part = counts.load[width=256]() # part += part.shift_right[1]() # part += part.shift_right[2]() # part += part.shift_right[4]() # part += part.shift_right[8]() # part += part.shift_right[16]() # part += part.shift_right[32]() # part += part.shift_right[64]() # part += part.shift_right[128]() # counts.simd_store(part) var i = size - 1 while i >= 0: var index = _get_index[D, place](vector, i) output[int(counts.offset(index).load() - 1)] = vector[i] counts.offset(index).store(counts.offset(index).load() - 1) i -= 1 vector = output @always_inline fn _radix_sort[D: DType, CD: DType](inout vector: List[SIMD[D, 1]]): @parameter fn call_counting_sort[index: Int](): _counting_sort[D, CD, index * 8](vector) @parameter if D.bitwidth() == 8: unroll[call_counting_sort, 1]() elif D.bitwidth() == 16: unroll[call_counting_sort, 2]() elif D.bitwidth() == 32: unroll[call_counting_sort, 4]() else: unroll[call_counting_sort, 8]() @always_inline fn radix_sort[D: DType](inout vector: List[SIMD[D, 1]]): _radix_sort[D, DType.uint32](vector) # NOTE: I hoped that the code below would make the algorithm faster but it made it slower # let size = len(vector) # alias m8 = max_or_inf[DType.uint8]().to_int() # alias m16 = max_or_inf[DType.uint16]().to_int() # alias m32 = max_or_inf[DType.uint32]().to_int() # if size <= m16: # if size > m8: # return _radix_sort[D, DType.uint16](vector) # return _radix_sort[D, DType.uint8](vector) # if size <= m32: # return _radix_sort[D, DType.uint32](vector) # return _radix_sort[D, DType.uint64](vector) --- radix_sorting/radix_sorting11.mojo --- from memory import memset_zero, memcpy, stack_allocation from memory.unsafe import bitcast from sys.intrinsics import PrefetchOptions from buffer import Buffer # based on http://stereopsis.com/radix.html fn radix_sort11[D: DType](inout vector: List[SIMD[D, 1]]): @always_inline fn _float_flip(f: UInt32) -> UInt32: @parameter if D == DType.uint32: return f elif D == DType.int32: return f ^ 0x80_00_00_00 else: var mask = bitcast[DType.uint32, 1](-bitcast[DType.int32, 1](f >> 31) | 0x80_00_00_00) return f ^ mask @always_inline fn _float_flip_x(inout f: UInt32): @parameter if D == DType.uint32: return elif D == DType.int32: f ^= 0x80_00_00_00 else: var mask = bitcast[DType.uint32, 1](-bitcast[DType.int32, 1](f >> 31) | 0x80_00_00_00) f ^= mask @always_inline fn _inverse_float_flip(f: UInt32) -> UInt32: @parameter if D == DType.uint32: return f elif D == DType.int32: return f ^ 0x80_00_00_00 else: var mask = ((f >> 31) - 1) | 0x80_00_00_00 return f ^ mask @always_inline fn _0(v: UInt32) -> Int: return int(v & 0x7ff) @always_inline fn _1(v: UInt32) -> Int: return int(v >> 11 & 0x7ff) @always_inline fn _2(v: UInt32) -> Int: return int(v >> 22) constrained[D.sizeof() == 4, "D needs to be 4 bytes wide"]() var elements = len(vector) var array = List[UInt32](capacity=elements) memcpy(array.data, vector.data.bitcast[UInt32](), elements) var sorted = List[UInt32](capacity=elements) alias histogram_size = 2048 var histogram1 = stack_allocation[histogram_size * 3, DType.uint32]() memset_zero(histogram1, histogram_size * 3) var histogram2 = histogram1.offset(histogram_size) var histogram3 = histogram2.offset(histogram_size) for i in range(elements): # TODO: Prefetch # array.prefetch[PrefetchOptions().to_data_cache()](i+64) var fi = _float_flip(array[i]) var i1 = _0(fi) var i2 = _1(fi) var i3 = _2(fi) var p1 = histogram1.offset(i1) var p2 = histogram2.offset(i2) var p3 = histogram3.offset(i3) # SIMD is a bit slower # let fi = _float_flip(array[i]) # var fiv = SIMD[DType.uint32, 2](fi) # fiv >>= SIMD[DType.uint32, 2](0, 11, 22, 0) # fiv &= SIMD[DType.uint32, 2](0x7ff, 0x7ff, 0xffff, 0) # let p1 = histogram1.offset(fiv[0].to_int()) # let p2 = histogram2.offset(fiv[1].to_int()) # let p3 = histogram3.offset((fi >> 22).to_int()) p1.store(p1.load() + 1) p2.store(p2.load() + 1) p3.store(p3.load() + 1) # for i in range(histogram_size): # print(histogram1.offset(i).load(), histogram2.offset(i).load(), histogram3.offset(i).load()) var sum1: UInt32 = 0 var sum2: UInt32 = 0 var sum3: UInt32 = 0 var tsum: UInt32 = 0 for i in range(histogram_size): var p1 = histogram1.offset(i) var p2 = histogram2.offset(i) var p3 = histogram3.offset(i) tsum = p1.load() + sum1 p1.store(sum1 - 1) sum1 = tsum tsum = p2.load() + sum2 p2.store(sum2 - 1) sum2 = tsum tsum = p3.load() + sum3 p3.store(sum3 - 1) sum3 = tsum for i in range(elements): var fi = array[i] _float_flip_x(fi) var p1 = histogram1.offset(_0(fi)) var index = p1.load() + 1 p1.store(index) sorted[int(index)] = fi for i in range(elements): var si = sorted[i] var pos = _1(si) var p2 = histogram2.offset(pos) var index = p2.load() + 1 p2.store(index) array[int(index)] = si for i in range(elements): var ai = array[i] var pos = _2(ai) var p3 = histogram3.offset(pos) var index = p3.load() + 1 p3.store(index) vector[int(index)] = _inverse_float_flip(ai)._bits_to_float[D]() # memcpy(vector.data, sorted.data.bitcast[Float32](), elements) # sorted.data.free() --- radix_sorting/radix_sorting13.mojo --- from memory import memset_zero, memcpy, stack_allocation from memory.unsafe import bitcast from sys.intrinsics import PrefetchOptions @always_inline fn _float_flip(f: UInt64) -> UInt64: var mask = bitcast[DType.uint64, 1](-bitcast[DType.int64, 1](f >> 63) | 0x80_00_00_00_00_00_00_00) return f ^ mask @always_inline fn _float_flip_x(inout f: UInt64): var mask = bitcast[DType.uint64, 1](-bitcast[DType.int64, 1](f >> 63) | 0x80_00_00_00_00_00_00_00) f ^= mask @always_inline fn _inverse_float_flip(f: UInt64) -> UInt64: var mask = ((f >> 63) - 1) | 0x80_00_00_00_00_00_00_00 return f ^ mask alias mask13 = (1 << 13) - 1 @always_inline fn _0(v: UInt64) -> Int: return int(v & mask13) @always_inline fn _1(v: UInt64) -> Int: return int(v >> 13 & mask13) @always_inline fn _2(v: UInt64) -> Int: return int(v >> 26 & mask13) @always_inline fn _3(v: UInt64) -> Int: return int(v >> 39 & mask13) @always_inline fn _4(v: UInt64) -> Int: return int(v >> 52) # based on http://stereopsis.com/radix.html fn radix_sort13[D: DType](inout vector: List[SIMD[D, 1]]): constrained[D.sizeof() == 8, "D needs to be 8 bytes wide"]() var elements = len(vector) var array = List[UInt64](capacity=elements) memcpy(array.data, vector.data.bitcast[UInt64](), elements) var sorted = List[UInt64](capacity=elements) alias histogram_size = 1 << 13 var histogram1 = stack_allocation[histogram_size * 5, DType.uint32]() memset_zero(histogram1, histogram_size * 5) var histogram2 = histogram1.offset(histogram_size) var histogram3 = histogram2.offset(histogram_size) var histogram4 = histogram3.offset(histogram_size) var histogram5 = histogram4.offset(histogram_size) for i in range(elements): # TODO: Prefetch # array.prefetch[PrefetchOptions().to_data_cache()](i+64) var fi = _float_flip(array[i]) var i1 = _0(fi) var i2 = _1(fi) var i3 = _2(fi) var i4 = _3(fi) var i5 = _4(fi) var p1 = histogram1.offset(i1) var p2 = histogram2.offset(i2) var p3 = histogram3.offset(i3) var p4 = histogram4.offset(i4) var p5 = histogram5.offset(i5) # SIMD is a bit slower # var fi = _float_flip(array[i]) # var fiv = SIMD[DType.uint32, 2](fi) # fiv >>= SIMD[DType.uint32, 2](0, 11, 22, 0) # fiv &= SIMD[DType.uint32, 2](0x7ff, 0x7ff, 0xffff, 0) # var p1 = histogram1.offset(fiv[0].to_int()) # var p2 = histogram2.offset(fiv[1].to_int()) # var p3 = histogram3.offset((fi >> 22).to_int()) p1.store(p1.load() + 1) p2.store(p2.load() + 1) p3.store(p3.load() + 1) p4.store(p4.load() + 1) p5.store(p5.load() + 1) # for i in range(histogram_size): # print(histogram1.offset(i).load(), histogram2.offset(i).load(), histogram3.offset(i).load()) var sum1: UInt32 = 0 var sum2: UInt32 = 0 var sum3: UInt32 = 0 var sum4: UInt32 = 0 var sum5: UInt32 = 0 var tsum: UInt32 = 0 for i in range(histogram_size): var p1 = histogram1.offset(i) var p2 = histogram2.offset(i) var p3 = histogram3.offset(i) var p4 = histogram4.offset(i) var p5 = histogram5.offset(i) tsum = p1.load() + sum1 p1.store(sum1 - 1) sum1 = tsum tsum = p2.load() + sum2 p2.store(sum2 - 1) sum2 = tsum tsum = p3.load() + sum3 p3.store(sum3 - 1) sum3 = tsum tsum = p4.load() + sum4 p4.store(sum4 - 1) sum4 = tsum tsum = p5.load() + sum5 p5.store(sum5 - 1) sum5 = tsum for i in range(elements): var fi = array[i] # print(fi) _float_flip_x(fi) var p1 = histogram1.offset(_0(fi)) var index = p1.load() + 1 p1.store(index) sorted[int(index)] = fi for i in range(elements): var si = sorted[i] var pos = _1(si) var p2 = histogram2.offset(pos) var index = p2.load() + 1 p2.store(index) array[int(index)] = si for i in range(elements): var ai = array[i] var pos = _2(ai) var p3 = histogram3.offset(pos) var index = p3.load() + 1 p3.store(index) sorted[int(index)] = ai for i in range(elements): var si = sorted[i] var pos = _3(si) var p4 = histogram4.offset(pos) var index = p4.load() + 1 p4.store(index) array[int(index)] = si for i in range(elements): var ai = array[i] var pos = _4(ai) var p5 = histogram5.offset(pos) var index = p5.load() + 1 p5.store(index) vector[int(index)] = _inverse_float_flip(ai)._bits_to_float[D]() # memcpy(vector.data, sorted.data.bitcast[Float64](), elements) # sorted.data.free() --- radix_sorting/radix_sorting16.mojo --- from memory import memset_zero, memcpy, stack_allocation from memory.unsafe import bitcast from sys.intrinsics import PrefetchOptions @always_inline fn _float_flip(f: UInt64) -> UInt64: var mask = bitcast[DType.uint64, 1](-bitcast[DType.int64, 1](f >> 63) | 0x80_00_00_00_00_00_00_00) return f ^ mask @always_inline fn _float_flip_x(inout f: UInt64): var mask = bitcast[DType.uint64, 1](-bitcast[DType.int64, 1](f >> 63) | 0x80_00_00_00_00_00_00_00) f ^= mask @always_inline fn _inverse_float_flip(f: UInt64) -> UInt64: var mask = ((f >> 63) - 1) | 0x80_00_00_00_00_00_00_00 return f ^ mask @always_inline fn _0(v: UInt64) -> Int: return int(v & 0xff_ff) @always_inline fn _1(v: UInt64) -> Int: return int(v >> 16 & 0xff_ff) @always_inline fn _2(v: UInt64) -> Int: return int(v >> 32 & 0xff_ff) @always_inline fn _3(v: UInt64) -> Int: return int(v >> 48 & 0xff_ff) # based on http://stereopsis.com/radix.html fn radix_sort16(inout vector: List[Float64]): var elements = len(vector) var array = List[UInt64](capacity=elements) memcpy(array.data, vector.data.bitcast[UInt64](), elements) var sorted = List[UInt64](capacity=elements) alias histogram_size = 1 << 16 var histogram1 = stack_allocation[histogram_size * 4, DType.uint32]() memset_zero(histogram1, histogram_size * 4) var histogram2 = histogram1.offset(histogram_size) var histogram3 = histogram2.offset(histogram_size) var histogram4 = histogram3.offset(histogram_size) for i in range(elements): # TODO: Prefetch # array.prefetch[PrefetchOptions().to_data_cache()](i+64) var fi = _float_flip(array[i]) var i1 = _0(fi) var i2 = _1(fi) var i3 = _2(fi) var i4 = _3(fi) var p1 = histogram1.offset(i1) var p2 = histogram2.offset(i2) var p3 = histogram3.offset(i3) var p4 = histogram4.offset(i4) # SIMD is a bit slower # var fi = _float_flip(array[i]) # var fiv = SIMD[DType.uint32, 2](fi) # fiv >>= SIMD[DType.uint32, 2](0, 11, 22, 0) # fiv &= SIMD[DType.uint32, 2](0x7ff, 0x7ff, 0xffff, 0) # var p1 = histogram1.offset(fiv[0].to_int()) # var p2 = histogram2.offset(fiv[1].to_int()) # var p3 = histogram3.offset((fi >> 22).to_int()) p1.store(p1.load() + 1) p2.store(p2.load() + 1) p3.store(p3.load() + 1) p4.store(p4.load() + 1) # for i in range(histogram_size): # print(histogram1.offset(i).load(), histogram2.offset(i).load(), histogram3.offset(i).load()) var sum1: UInt32 = 0 var sum2: UInt32 = 0 var sum3: UInt32 = 0 var sum4: UInt32 = 0 var tsum: UInt32 = 0 for i in range(histogram_size): var p1 = histogram1.offset(i) var p2 = histogram2.offset(i) var p3 = histogram3.offset(i) var p4 = histogram4.offset(i) tsum = p1.load() + sum1 p1.store(sum1 - 1) sum1 = tsum tsum = p2.load() + sum2 p2.store(sum2 - 1) sum2 = tsum tsum = p3.load() + sum3 p3.store(sum3 - 1) sum3 = tsum tsum = p4.load() + sum4 p4.store(sum4 - 1) sum4 = tsum for i in range(elements): var fi = array[i] # print(fi) _float_flip_x(fi) var p1 = histogram1.offset(_0(fi)) var index = p1.load() + 1 p1.store(index) sorted[int(index)] = fi for i in range(elements): var si = sorted[i] var pos = _1(si) var p2 = histogram2.offset(pos) var index = p2.load() + 1 p2.store(index) array[int(index)] = si for i in range(elements): var ai = array[i] var pos = _2(ai) var p3 = histogram3.offset(pos) var index = p3.load() + 1 p3.store(index) sorted[int(index)] = ai for i in range(elements): var si = sorted[i] var pos = _3(si) var p4 = histogram4.offset(pos) var index = p4.load() + 1 p4.store(index) vector[int(index)] = _inverse_float_flip(si)._bits_to_float[DType.float64]() # sorted.data.free() --- selection_sort/__init__.mojo --- fn selection_sort[D: DType](inout vector: List[SIMD[D, 1]]): for i in range(len(vector)): var min_idx = i for j in range(i + 1, len(vector)): if vector[j] < vector[min_idx]: min_idx = j vector[i], vector[min_idx] = vector[min_idx], vector[i] --- selection_sort_sample.mojo --- from my_utils import print_v from selection_sort import selection_sort fn main(): var v1 = List[UInt32]() v1.append(13) v1.append(31) v1.append(1) v1.append(7) v1.append(7) v1.append(4513) v1.append(45) print_v(v1) selection_sort(v1) print_v(v1) --- string_compare/__init__.mojo --- from math.bit import bswap from memory import memcmp @always_inline fn _align_down(value: Int, alignment: Int) -> Int: return value._positive_div(alignment) * alignment @always_inline fn _memcmp_impl(s1: DTypePointer, s2: __type_of(s1), count: Int) -> Int: constrained[s1.type.is_integral(), "the input dtype must be integral"]() alias simd_width = simdwidthof[s1.type]() if count < simd_width: var result = 0 var i = 0 while i < count: var s1i = s1[i] var s2i = s2[i] var smaller = s1i < s2i var bigger = s1i > s2i i += 1 + count * int(smaller or bigger) result = -1 * int(smaller) + 1 * int(bigger) return result # for i in range(count): # var s1i = s1[i] # var s2i = s2[i] # if s1i != s2i: # return 1 if s1i > s2i else -1 # return 0 var iota = llvm_intrinsic[ "llvm.experimental.stepvector", SIMD[DType.uint8, simd_width], has_side_effect=False, ]() var vector_end_simd = _align_down(count, simd_width) for i in range(0, vector_end_simd, simd_width): var s1i = s1.load[width=simd_width](i) var s2i = s2.load[width=simd_width](i) var diff = s1i != s2i if diff.reduce_or(): var index = int( diff.select( iota, SIMD[DType.uint8, simd_width](255) ).reduce_min() ) return -1 if s1i[index] < s2i[index] else 1 var last = count - simd_width if last <= 0: return 0 var s1i = s1.load[width=simd_width](last) var s2i = s2.load[width=simd_width](last) var diff = s1i != s2i if diff.reduce_or(): var index = int( diff.select(iota, SIMD[DType.uint8, simd_width](255)).reduce_min() ) return -1 if s1i[index] < s2i[index] else 1 return 0 @always_inline fn lt(a: String, b: String) -> Bool: var min_len = min(len(a), len(b)) var res = memcmp(a.unsafe_uint8_ptr(), b.unsafe_uint8_ptr(), min_len) return len(a) <= len(b) if res == 0 else res < 0 # fn lt(a: StringLiteral, b: StringLiteral) -> Bool: # var p1 = a.data().bitcast[DType.uint8]() # var p2 = b.data().bitcast[DType.uint8]() # var min_len = min(len(a), len(b)) # for i in range(min_len): # var ai = p1.load(i) # var bi = p2.load(i) # if ai > bi: # return False # if ai < bi: # return True # return len(a) <= len(b) # fn lt2(a: StringLiteral, b: StringLiteral) -> Bool: # """This is much simpler but also slower based on some simple benchmarks.""" # var min_len = min(len(a), len(b)) # var res = memcmp(a.data(), b.data(), min_len) # return len(a) <= len(b) if res == 0 else res < 0 # fn lt3(a: StringLiteral, b: StringLiteral) -> Bool: # var p1 = a.data().bitcast[DType.uint8]() # var p2 = b.data().bitcast[DType.uint8]() # var rest_len = min(len(a), len(b)) # while rest_len >= 8: # var ai = bswap(p1.bitcast[DType.uint64]().load()) # var bi = bswap(p2.bitcast[DType.uint64]().load()) # if ai > bi: # return False # if ai < bi: # return True # p1 = p1.offset(8) # p2 = p2.offset(8) # rest_len -= 8 # if rest_len >= 4: # var ai = bswap(p1.bitcast[DType.uint32]().load()) # var bi = bswap(p2.bitcast[DType.uint32]().load()) # if ai > bi: # return False # if ai < bi: # return True # p1 = p1.offset(4) # p2 = p2.offset(4) # rest_len -= 4 # if rest_len >= 2: # var ai = bswap(p1.bitcast[DType.uint16]().load()) # var bi = bswap(p2.bitcast[DType.uint16]().load()) # if ai > bi: # return False # if ai < bi: # return True # p1 = p1.offset(2) # p2 = p2.offset(2) # rest_len -= 2 # if rest_len == 1: # var ai = p1.load() # var bi = p2.load() # if ai > bi: # return False # if ai < bi: # return True # return len(a) <= len(b) --- tim_sort/__init__.mojo --- from .sort import tim_sort, tim_sort2, parallel_tim_sort --- tim_sort/sort.mojo --- from algorithm import parallelize alias group_size = 32 @always_inline fn _insertion_sort[dt: DType](inout values: List[Scalar[dt]], start: Int, end: Int): for i in range(start, end): var key = values[i] var j = i - 1 while j >= start and key <= values[j]: values[j + 1] = values[j] j -= 1 values[j + 1] = key @always_inline fn _merge[dt: DType](inout values: List[Scalar[dt]], start: Int, mid: Int, end: Int): if values[mid - 1] <= values[mid]: return # already sorted var left = values[start:mid] var right = values[mid:end] var lenl = len(left) var lenr = len(right) var cur = start var curl = 0 var curr = 0 while curl < lenl and curr < lenr: if left[curl] <= right[curr]: values[cur] = left[curl] curl += 1 else: values[cur] = right[curr] curr += 1 cur += 1 while curl < lenl: values[cur] = left[curl] curl += 1 cur += 1 while curr < lenr: values[cur] = right[curr] curr += 1 cur += 1 fn tim_sort[dt: DType](inout values: List[Scalar[dt]]): var count = len(values) for i in range(0, count, group_size): _insertion_sort[dt](values, i, min(i + group_size, count)) var size = group_size while size < count: for start in range(0, count, 2 * size): var mid = min(count, start + size) var end = min((start + 2 * size), count) if mid < end: _merge(values, start, mid, end) size *= 2 @always_inline fn ceil_div(value: Int, divisor: Int) -> Int: return -(-value // divisor) fn parallel_tim_sort[dt: DType](inout values: List[Scalar[dt]]): var count = len(values) var groups_count = ceil_div(count, group_size) @parameter fn call_insertion_sort(i: Int): _insertion_sort[dt](values, i * group_size, min((i + 1) * group_size, count)) parallelize[call_insertion_sort](groups_count) var size = group_size while size < count: @parameter fn call_merge(i: Int): var start = i * 2 * size var mid = min(count, start + size) var end = min((start + 2 * size), count) if mid < end: _merge(values, start, mid, end) var chunks_count = ceil_div(count, (2 * size)) parallelize[call_merge](chunks_count) size *= 2 @always_inline fn _insertion_sort[type: ComparableCollectionElement](inout values: List[type], start: Int, end: Int): for i in range(start, end): var key = values[i] var j = i - 1 while j >= start and key <= values[j]: values[j + 1] = values[j] j -= 1 values[j + 1] = key @always_inline fn _merge[type: ComparableCollectionElement](inout values: List[type], start: Int, mid: Int, end: Int): if values[mid - 1] <= values[mid]: return # already sorted var left = values[start:mid] var right = values[mid:end] var lenl = len(left) var lenr = len(right) var cur = start var curl = 0 var curr = 0 while curl < lenl and curr < lenr: if left[curl] <= right[curr]: values[cur] = left[curl] curl += 1 else: values[cur] = right[curr] curr += 1 cur += 1 while curl < lenl: values[cur] = left[curl] curl += 1 cur += 1 while curr < lenr: values[cur] = right[curr] curr += 1 cur += 1 fn tim_sort[type: ComparableCollectionElement](inout values: List[type]): var count = len(values) for i in range(0, count, group_size): _insertion_sort[type](values, i, min(i + group_size, count)) var size = group_size while size < count: for start in range(0, count, 2 * size): var mid = min(count, start + size) var end = min((start + 2 * size), count) if mid < end: _merge(values, start, mid, end) size *= 2 fn parallel_tim_sort[type: ComparableCollectionElement](inout values: List[type]): var count = len(values) var groups_count = ceil_div(count, group_size) @parameter fn call_insertion_sort(i: Int): _insertion_sort[type](values, i * group_size, min((i + 1) * group_size, count)) parallelize[call_insertion_sort](groups_count) var size = group_size while size < count: @parameter fn call_merge(i: Int): var start = i * 2 * size var mid = min(count, start + size) var end = min((start + 2 * size), count) if mid < end: _merge(values, start, mid, end) var chunks_count = ceil_div(count, (2 * size)) parallelize[call_merge](chunks_count) size *= 2 --- tim_sort_sample.mojo --- from random import random_ui64 from my_utils import print_v from tim_sort import tim_sort, parallel_tim_sort from time import now fn assert_sorted[D: DType](vector: List[Scalar[D]]): for i in range(1, len(vector)): if vector[i] < vector[i - 1]: print("!!!! " + str(i)) print_v(vector[:i+1]) return fn main(): var v1 = List[UInt32]() v1.append(13) v1.append(31) v1.append(1) v1.append(7) v1.append(7) v1.append(4513) v1.append(45) print_v(v1) tim_sort(v1) print_v(v1) var v2 = List[UInt64]() for _ in range(2000000): v2.append(random_ui64(0, 100000000)) var v3 = List(v2) var tik = now() tim_sort(v3) var tok = now() # print_v(v3) var ser_d = tok - tik print("Ser in", ser_d) var v5 = List(v2) tik = now() parallel_tim_sort(v5) tok = now() # print_v(v4) print("Par in", tok - tik) print(ser_d / (tok - tik)) assert_sorted(v3) --- validate_string_sort.mojo --- from my_utils import * from string_compare import lt from insertion_sort import insertion_sort from quick_sort import quick_sort from radix_sorting import msb_radix_sort from multi_key_quicksort import multi_key_quicksort from tim_sort import tim_sort, parallel_tim_sort fn is_sorted(elements: List[String]) -> Bool: for i in range(1, len(elements)): if elements[i-1] > elements[i]: print("!!!", elements[i-1], elements[i]) return False return True fn main(): # var n = 0b01101001 # var mask = SIMD[DType.bool, 8](True, False, False, True, False, True, True, False) # var res = bitcast[DType.uint8](mask) # print(res, n) # var a = Int32(-1) # print(rebind[SIMD[DType.uint32, 1]](a)) # for i in range(len(s)): # print(s._as_ptr().bitcast[DType.uint8]().load(i)) # _ = s print("+++++IN+++++") var corpus = corpus4() insertion_sort[String, lt](corpus) # print_v(corpus) if not is_sorted(corpus): print("NO!!!!") print("+++++QK+++++") corpus = corpus4() quick_sort[String, lt](corpus) # print_v(corpus) if not is_sorted(corpus): print("NO!!!!") print("+++++RX+++++") corpus = corpus4() msb_radix_sort(corpus) # print_v(corpus) if not is_sorted(corpus): print("NO!!!!") print("+++++MK+++++") corpus = corpus4() multi_key_quicksort(corpus) # print_v(corpus) if not is_sorted(corpus): print("NO!!!!") print("+++++STD+++++") corpus = corpus4() sort(corpus) # print_v(corpus) if not is_sorted(corpus): print("NO!!!!") print("+++++TIM+++++") corpus = corpus4() tim_sort(corpus) # print_v(corpus) if not is_sorted(corpus): print("NO!!!!") print("+++++PTIM+++++") corpus = corpus4() parallel_tim_sort(corpus) # print_v(corpus) if not is_sorted(corpus): print("NO!!!!") --- .gitignore --- test.mojo to-do_extras.md --- LICENSE --- MIT License Copyright (c) 2023 Andres Nowak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Micro-Mojograd This is for now going to be a **Toy project** to learn about how do tensors work, how to make them efficient, how to do the computational graph efficiently (like joining element wise operationss or making a tensors contiguous when it used in more than one operation *use more memory but have better performance*, etc...) and the Autograd part. When the language is a bit more mature and has complete lifetime and ownership support and Traits support, I will try to make a more complete version of this library, or maybe help another mojo project like [numojo](https://github.com/MadAlex1997/Mojo-Arrays) or [Infermo](https://github.com/TilliFe/Infermo) And it is going to be inspired by: - [Micrograd](https://github.com/karpathy/micrograd) - [Pytorch](https://github.com/pytorch/pytorch) - [Tinygrad](https://github.com/tinygrad/tinygrad) ## To-do - [x] Tensor: using 1d memory and not using MLIR - [x] Tensor Matmul - [x] Tensor sum elementwise - [x] Tensor Mul elementwise - [x] Tensor equal operator - [ ] Tensor broadcasting - [ ] Fix problem where parallel version of element-wise operations (add, mul, eq, etc.) are slower than the sequential version. - [ ] Autograd: _For now doing the autogradient part is difficult, because mojo still doesn't have complete ownership and lifetime support._ --- tensorG_benchmark.mojo --- from time import now from tensor_g import TensorG, TensorView from benchmark import Benchmark from runtime.llcl import num_cores, Runtime from time import time alias simd_size_float = simdwidthof[DType.float32]() alias mul_pool = 4 alias type_test = DType.float32 fn bench_sum(matrix_1: TensorG[type_test], matrix_2: TensorG[type_test]): _ = matrix_1 + matrix_1 fn bench_sum_vectorized(matrix_1: TensorG[type_test], matrix_2: TensorG[type_test]): _ = matrix_1.add[simd_size_float](matrix_2) fn bench_sum_parallelized( matrix_1: TensorG[type_test], matrix_2: TensorG[type_test], rt: Runtime, num_workers: Int, ): _ = matrix_1.add[simd_size_float](matrix_2, rt, num_workers) fn benchmark_sum(dims: TensorView): let matrix_1 = TensorG[type_test](True, dims) let matrix_2 = TensorG[type_test](True, dims) @parameter fn bench(): _ = matrix_1 + matrix_2 let normal = Benchmark().run[bench]() print("normal:", normal / 1e6, "ms") print("normal:", normal, "ns") @parameter fn bench_vectorized(): _ = matrix_1.add[simd_size_float](matrix_2) let vectorized = Benchmark().run[bench_vectorized]() print("vectorized:", vectorized / 1e6, "ms") print("vectorized:", vectorized, "ns") with Runtime(num_cores()) as rt: @always_inline @parameter fn bench_parallel(): _ = matrix_1.add[simd_size_float]( matrix_2, rt, mul_pool * rt.parallelism_level() ) let parallelized = Benchmark().run[bench_parallel]() # Prevent the tensors from being freed before the benchmark run _ = (matrix_1, matrix_2) print("Parallelized:", parallelized / 1e6, "ms") print("Parallelized:", parallelized, "ns") fn benchmark_mul(dims: TensorView): let matrix_1 = TensorG[type_test](True, dims) let matrix_2 = TensorG[type_test](True, dims) @parameter fn bench(): _ = matrix_1 * matrix_2 let normal = Benchmark().run[bench]() print("normal:", normal / 1e6, "ms") print("normal:", normal, "ns") @parameter fn bench_vectorized(): _ = matrix_1.mul[simd_size_float](matrix_2) let vectorized = Benchmark().run[bench_vectorized]() print("vectorized:", vectorized / 1e6, "ms") print("vectorized:", vectorized, "ns") with Runtime(num_cores()) as rt: @always_inline @parameter fn bench_parallel(): _ = matrix_1.mul[simd_size_float]( matrix_2, rt, mul_pool * rt.parallelism_level() ) let parallelized = Benchmark().run[bench_parallel]() # Prevent the tensors from being freed before the benchmark run _ = (matrix_1, matrix_2) print("Parallelized:", parallelized / 1e6, "ms") print("Parallelized:", parallelized, "ns") fn benchmark_matmul(dims: TensorView): let matrix_1 = TensorG[type_test](True, dims) let matrix_2 = TensorG[type_test](True, dims) @parameter fn bench(): _ = matrix_1 @ matrix_2 let normal = Benchmark().run[bench]() / 1e6 print("normal:", normal, "ms") @parameter fn bench_vectorized(): _ = matrix_1.matmul[simd_size_float](matrix_2) let vectorized = Benchmark().run[bench_vectorized]() / 1e6 print("vectorized:", vectorized, "ms") with Runtime(num_cores()) as rt: @always_inline @parameter fn bench_parallel(): _ = matrix_1.matmul[simd_size_float]( matrix_2, rt, mul_pool * rt.parallelism_level() ) let parallelized = Benchmark().run[bench_parallel]() / 1e6 # Prevent the tensors from being freed before the benchmark run _ = (matrix_1, matrix_2) print("Parallelized:", parallelized, "ms") fn main(): let start = time.now() print("Benchmarking sum") benchmark_sum(TensorView(512, 512, 512)) print("Benchmarking mul") benchmark_mul(TensorView(512, 512, 512)) print("Benchmarking matmul") benchmark_matmul(TensorView(512, 512)) let end = time.now() print("Elapsed time:", (end - start) // 1_000_000, "ms") --- tensorG_test.mojo --- from tensor_g import TensorG, TensorView from python import Python, PythonObject from runtime.llcl import num_cores, Runtime from time import time alias nelts = simdwidthof[DType.float64]() alias type_f = DType.float64 alias mul_pool = 4 # Todo: Fix eq simd implementation, it seems to be wrong fn test_matmul[ Type: DType, nelts: Int ](A: TensorG[Type], B: TensorG[Type], C: TensorG[Type]) -> Bool: var flag = True var res = A @ B print("Matmul normal:", res == C) flag = flag and (res == C) print("Matmul normal, eq simd: ", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) res = A.matmul[nelts](B) print("Matmul simd:", res == C) flag = flag and (res == C) print("Matmul simd, eq simd:", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) with Runtime(num_cores()) as rt: @always_inline @parameter fn bench_parallel(): let res = A.matmul[nelts](B, rt, mul_pool * rt.parallelism_level()) print("Matmul simd parallel:", res == C) flag = flag and (res == C) print("Matmul parallel, eq simd:", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) print( "Matmul parallel, eq parallel:", res.eq[nelts](C, rt, mul_pool * rt.parallelism_level()), ) flag = flag and (res.eq[nelts](C, rt, mul_pool * rt.parallelism_level())) bench_parallel() _ = (A, B, C, flag) return flag fn test_add[ Type: DType, nelts: Int ](A: TensorG[Type], B: TensorG[Type], C: TensorG[Type]) -> Bool: var flag = True var res = A + B print("Add normal:", res == C) flag = flag and (res == C) print("Add normal, eq simd: ", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) res = A.add[nelts](B) print("Add simd:", res == C) flag = flag and (res == C) print("Add simd, eq simd:", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) with Runtime(num_cores()) as rt: @always_inline @parameter fn bench_parallel(): let res = A.add[nelts](B, rt, mul_pool * rt.parallelism_level()) print("Add simd parallel:", res == C) flag = flag and (res == C) print("Add parallel, eq simd:", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) print( "Add parallel, eq parallel:", res.eq[nelts](C, rt, mul_pool * rt.parallelism_level()), ) flag = flag and (res.eq[nelts](C, rt, mul_pool * rt.parallelism_level())) bench_parallel() _ = (A, B, C) return flag fn test_mul[ Type: DType, nelts: Int ](A: TensorG[Type], B: TensorG[Type], C: TensorG[Type]) -> Bool: var flag = True var res = A * B print("Mul normal:", res == C) flag = flag and (res == C) print("Mul normal, eq simd: ", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) res = A.mul[nelts](B) print("Mul simd:", res == C) flag = flag and (res == C) print("Mul simd, eq simd:", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) with Runtime(num_cores()) as rt: @always_inline @parameter fn bench_parallel(): let res = A.mul[nelts](B, rt, mul_pool * rt.parallelism_level()) print("Mul simd parallel:", res == C) flag = flag and (res == C) print("Mul parallel, eq simd:", res.eq[nelts](C)) flag = flag and (res.eq[nelts](C)) print( "Mul parallel, eq parallel:", res.eq[nelts](C, rt, mul_pool * rt.parallelism_level()), ) flag = flag and (res.eq[nelts](C, rt, mul_pool * rt.parallelism_level())) bench_parallel() _ = (A, B, C) return flag fn create_tensor_from_numpy[ Type: DType ](np: PythonObject, shape: TensorView) -> TensorG[Type]: let size = shape.num_elements() var res = DynamicVector[FloatLiteral](size) res.reserve( size ) # the init function should do this, but it seems it doesn't (error) try: for i in range(size): if size == 1: res.push_back(np.__index__()) else: res.push_back(np[i].__index__()) except: print("Error converting numpy array to tensor") return TensorG[Type](False, shape) return TensorG[Type](res, shape) fn test_same_dim(I: Int, np_shape: PythonObject, tensor_shape: TensorView) -> Bool: from python import Python var flag = True try: let np = Python.import_module("numpy") var test_1 = np.random.randint(0, 20, tensor_shape.num_elements()) var test_2 = np.random.randint(0, 20, tensor_shape.num_elements()) let A = create_tensor_from_numpy[type_f](test_1, tensor_shape) let B = create_tensor_from_numpy[type_f](test_2, tensor_shape) # check shape size var shape_correct = A.dims.num_elements() == test_1.shape.__len__().__index__() debug_assert(shape_correct, "Shape size is not correct") shape_correct = B.dims.num_elements() == test_2.shape.__len__().__index__() debug_assert(shape_correct, "Shape size is not correct") test_1 = test_1.reshape(np_shape) test_2 = test_2.reshape(np_shape) # check rank var rank_correct = A.rank() == test_1.ndim.__index__() debug_assert(rank_correct, "Rank is not correct") rank_correct = B.rank() == test_2.ndim.__index__() debug_assert(rank_correct, "Rank is not correct") # Add test var res = test_1 + test_2 res = res.reshape(tensor_shape.num_elements()) var C = create_tensor_from_numpy[type_f](res, tensor_shape) var res_correct = test_add[type_f, nelts](A, B, C) flag = res_correct and flag print("Add test ", I, ":", res_correct) print() # Mul Test res = test_1 * test_2 res = res.reshape(tensor_shape.num_elements()) C = create_tensor_from_numpy[type_f](res, tensor_shape) res_correct = test_mul[type_f, nelts](A, B, C) flag = res_correct and flag print("Mul test ", I, ":", res_correct) print() # Matmul test res = np.matmul(test_1, test_2) if tensor_shape.rank() > 1: res = res.reshape(tensor_shape.num_elements()) C = create_tensor_from_numpy[type_f](res, tensor_shape) else: C = create_tensor_from_numpy[type_f](res, TensorView(1)) res_correct = test_matmul[type_f, nelts](A, B, C) flag = res_correct and flag print("Matmul test ", I, ":", res_correct) print() except: print("Error importing numpy ", I) return False return flag fn test_different_dim( I: Int, np_shape_1: PythonObject, np_shape_2: PythonObject, tensor_shape_1: TensorView, tensor_shape_2: TensorView, tensor_shape_3: TensorView, ) -> Bool: from python import Python var flag = True try: let np = Python.import_module("numpy") # Matmul test 2 var test_1 = np.random.randint(0, 20, tensor_shape_1.num_elements()) var test_2 = np.random.randint(0, 20, tensor_shape_2.num_elements()) let A = create_tensor_from_numpy[type_f](test_1, tensor_shape_1) let B = create_tensor_from_numpy[type_f](test_2, tensor_shape_2) test_1 = test_1.reshape(np_shape_1) test_2 = test_2.reshape(np_shape_2) var res = np.matmul(test_1, test_2) res = res.reshape((tensor_shape_3.num_elements())) let C = create_tensor_from_numpy[type_f](res, tensor_shape_3) let res_correct = test_matmul[type_f, nelts](A, B, C) flag = res_correct and flag print("Matmul test ", I, ":", res_correct) print() except: print("Error importing numpy 2") return False return flag fn main(): print("nelts size:", nelts) var flag = True let start = time.now() var tensor_shape = TensorView(5, 5, 5, 5, 5, 5) let np_shape = (5, 5, 5, 5, 5, 5) flag = test_same_dim(1, np_shape, tensor_shape) and flag tensor_shape = TensorView(25, 25, 25) let np_shape_2 = (25, 25, 25) flag = test_same_dim(2, np_shape_2, tensor_shape) and flag tensor_shape = TensorView(125, 125) let np_shape_3 = (125, 125) flag = test_same_dim(3, np_shape_3, tensor_shape) and flag tensor_shape = TensorView(15_625) let np_shape_4 = (15_625) flag = test_same_dim(4, np_shape_4, tensor_shape) and flag var tensor_shape_1 = TensorView(2, 2, 3) var tensor_shape_2 = TensorView(2, 3, 2) var tensor_shape_3 = TensorView(2, 2, 2) let np_shape_1_1 = (2, 2, 3) let np_shape_1_2 = (2, 3, 2) flag = ( test_different_dim( 5, np_shape_1_1, np_shape_1_2, tensor_shape_1, tensor_shape_2, tensor_shape_3, ) and flag ) tensor_shape_1 = TensorView(2, 4, 3) tensor_shape_2 = TensorView(2, 3, 5) tensor_shape_3 = TensorView(2, 4, 5) let np_shape_2_1 = (2, 4, 3) let np_shape_2_2 = (2, 3, 5) flag = ( test_different_dim( 6, np_shape_2_1, np_shape_2_2, tensor_shape_1, tensor_shape_2, tensor_shape_3, ) and flag ) tensor_shape_1 = TensorView(5, 2, 4, 3) tensor_shape_2 = TensorView(5, 2, 3, 5) tensor_shape_3 = TensorView(5, 2, 4, 5) let np_shape_3_1 = (5, 2, 4, 3) let np_shape_3_2 = (5, 2, 3, 5) flag = ( test_different_dim( 7, np_shape_3_1, np_shape_3_2, tensor_shape_1, tensor_shape_2, tensor_shape_3, ) and flag ) let end = time.now() print("All tests passed:", flag) print("Time elapsed: ", (end - start) // 1000000, "ms") --- tensor_g/__init__.mojo --- from .tensorG import TensorG from .tensor_view import TensorView --- tensor_g/helpers.mojo --- fn __check_bounds(index: Int, size: Int): let index_in_bounds = index >= 0 and index < size debug_assert(index_in_bounds, "Error index out of bounds.") fn __negative_pos_to_positive(index: Int, size: Int) -> Int: if index < 0: return size + index return index --- tensor_g/tensorG.mojo --- from random import rand from memory import memset_zero from memory.buffer import Buffer from utils.index import StaticIntTuple, Index from utils.list import Dim, DimList from utils.vector import DynamicVector, InlinedFixedVector from runtime.llcl import num_cores, Runtime from algorithm import vectorize, parallelize, vectorize_unroll from algorithm import Static2DTileUnitFunc as Tile2DFunc import math from .helpers import __check_bounds, __negative_pos_to_positive from .tensor_view import TensorView alias dims_average_size = 5 struct TensorG[Type: DType]: var data: DTypePointer[Type] var dims: TensorView var size: Int alias simd_width = simdwidthof[Type]() fn __init__(inout self, random: Bool, *dims: Int): self.dims = TensorView(dims) self.size = 1 self.size = self.dims.num_elements() # check if using alligend alloc could be better self.data = DTypePointer[Type].alloc(self.size) if random: rand(self.data, self.size) else: self.zero() fn __init__(inout self, random: Bool, dims: TensorView): self.dims = dims self.size = 1 self.size = self.dims.num_elements() self.data = DTypePointer[Type].alloc(self.size) if random: rand(self.data, self.size) else: self.zero() fn __init__( inout self, data: VariadicList[FloatLiteral], dims: TensorView, ): self.dims = dims self.size = 1 self.size = self.dims.num_elements() let dims_area_correct = self.size == len(data) debug_assert( dims_area_correct, "Error, the size of the data doesn't match the size of the tensor.", ) self.data = DTypePointer[Type].alloc(self.size) for i in range(self.size): self.data.simd_store[1](i, data[i]) fn __init__( inout self, data: DynamicVector[FloatLiteral], dims: TensorView, ): self.dims = dims self.size = 1 self.size = self.dims.num_elements() let dims_area_correct = self.size == len(data) debug_assert( dims_area_correct, "Error, the size of the data doesn't match the size of the tensor.", ) self.data = DTypePointer[Type].alloc(self.size) for i in range(self.size): self.data.simd_store[1](i, data[i]) fn __del__(owned self): self.data.free() fn zero(inout self): memset_zero(self.data, self.dims.num_elements()) fn __copyinit__(inout self, existing: Self): self.dims = existing.dims self.size = 1 self.size = self.dims.num_elements() self.data = DTypePointer[Type].alloc(self.size) for i in range(self.size): self.data.simd_store[1](i, existing.data.simd_load[1](i)) fn __moveinit__(inout self, owned existing: Self): self.dims = existing.dims self.data = existing.data self.size = existing.size fn byte_count(self) -> Int: return sizeof[Type]() * self.size @always_inline fn __getitem__[len: Int](self, index: StaticIntTuple[len]) -> SIMD[Type, 1]: return self.load[1](index) @always_inline fn __getitem__[ len: Int ](self, index: InlinedFixedVector[len, Int]) -> SIMD[Type, 1]: return self.load[1](index) @always_inline fn __getitem__(self, index: Int) -> SIMD[Type, 1]: """Access the data as a 1D array.""" return self.load[1](index) @always_inline fn load[ nelts: Int, len: Int ](self, index: StaticIntTuple[len]) -> SIMD[Type, nelts]: let pos = self.dims.get_position(index) __check_bounds(pos, self.size) return self.data.simd_load[nelts](pos) @always_inline fn load[ nelts: Int, len: Int ](self, index: InlinedFixedVector[len, Int]) -> SIMD[Type, nelts]: let pos = self.dims.get_position(index) __check_bounds(pos, self.size) return self.data.simd_load[nelts](pos) @always_inline fn load[nelts: Int](self, index: Int) -> SIMD[Type, nelts]: """Access the data as a 1D array.""" let pos = __negative_pos_to_positive(index, self.size) __check_bounds(pos, self.size) return self.data.simd_load[nelts](pos) @always_inline fn __setitem__[len: Int](self, index: StaticIntTuple[len], val: SIMD[Type, 1]): return self.store[1](index, val) @always_inline fn __setitem__[ len: Int ](self, index: InlinedFixedVector[len, Int], val: SIMD[Type, 1]): return self.store[1](index, val) @always_inline fn __setitem__(self, index: Int, val: SIMD[Type, 1]): return self.store[1](index, val) @always_inline fn store[ nelts: Int, len: Int ](self, index: StaticIntTuple[len], val: SIMD[Type, nelts]): let pos = self.dims.get_position(index) __check_bounds(pos, self.size) self.data.simd_store[nelts](pos, val) @always_inline fn store[ nelts: Int, len: Int ](self, index: InlinedFixedVector[len, Int], val: SIMD[Type, nelts]): let pos = self.dims.get_position(index) __check_bounds(pos, self.size) self.data.simd_store[nelts](pos, val) @always_inline fn store[nelts: Int](self, index: Int, val: SIMD[Type, nelts]): """Access and store the data as a 1D array.""" let pos = __negative_pos_to_positive(index, self.size) __check_bounds(pos, self.size) self.data.simd_store[nelts](pos, val) fn __dim_suffix_product[len: Int](self) -> InlinedFixedVector[len, Int]: var suffix_product = InlinedFixedVector[len, Int](self.dims.rank()) suffix_product.append(1) # the first value has to be 1 for index in range(self.dims.rank() - 1): suffix_product.append( suffix_product[index] * self.dims[self.dims.rank() - 1 - index] ) return suffix_product fn __matmul_num_elements(self, other: Self) -> Int: var size = 1 for i in range(self.dims.rank() - 2): size *= self.dims[i] size *= self.dims[ self.dims.rank() - 2 ] # The different dimension of first tensor size *= other.dims[ other.dims.rank() - 1 ] # the different dimension of second tensor size *= self.dims[ self.dims.rank() - 1 ] # The dimension that is the same for both tensors return size fn print_all(self): let size = self.dims.num_elements() var suffix_product = InlinedFixedVector[dims_average_size, Int]( self.dims.rank() + 1 ) suffix_product.append(1) for index in range(self.dims.rank()): suffix_product.append( suffix_product[index] * self.dims[self.dims.rank() - 1 - index] ) var count = 0 for i in range(size + 1): count = 0 for j in range(self.dims.rank()): if i % suffix_product[j + 1] == 0 and i != 0: print_no_newline("]") count += 1 if i > 0 and i < size: print_no_newline(",") if i < size: for i in range(count): print() for j in range(self.dims.rank()): if i % suffix_product[j + 1] == 0 and i != size: print_no_newline("[") if i < size: print_no_newline(self[i]) print() fn rank(self) -> Int: return self.dims.rank() fn __iterate_binary_op_tensor[ nelts: Int, outer_loop_func: fn[func: fn (Int) capturing -> None] (Int) capturing -> None, op_func: fn[T: DType, simd_width: Int] ( x: SIMD[T, simd_width], y: SIMD[T, simd_width] ) -> SIMD[T, simd_width], ](self, other: Self) -> Self: let dims_eq = self.dims == other.dims debug_assert( dims_eq, "Error dimension aren't equal can't do operation element wise." ) let res = Self(False, self.dims) let size = self.dims.num_elements() let last_dim = self.dims[-1] var dims_rest = size // last_dim @parameter fn outer_loop(i: Int): @parameter fn iterate_vectorize[nelts: Int](j: Int): let index = i * last_dim + j res.store[nelts]( index, op_func[Type, nelts]( self.load[nelts](index), other.load[nelts](index) ), ) vectorize[nelts, iterate_vectorize](last_dim) outer_loop_func[outer_loop](dims_rest) return res ^ @always_inline fn __add__(self, other: Self) -> Self: return self.add[TensorG[Type].simd_width](other) @always_inline fn add[nelts: Int](self, other: Self) -> Self: @parameter fn sum_v[outer_loop: fn (Int) capturing -> None](range_size: Int): for i in range(range_size): outer_loop(i) let res = self.__iterate_binary_op_tensor[nelts, sum_v, math.add](other) return res ^ @always_inline fn add[nelts: Int](self, other: Self, rt: Runtime, n_cores: Int) -> Self: @parameter fn sum_p[outer_loop: fn (Int) capturing -> None](range_size: Int): parallelize[outer_loop](rt, range_size, n_cores) let res = self.__iterate_binary_op_tensor[nelts, sum_p, math.add](other) return res ^ fn __mul__(self, other: Self) -> Self: return self.mul[TensorG[Type].simd_width](other) @always_inline fn mul[nelts: Int](self, other: Self) -> Self: @parameter fn mul_v[outer_loop: fn (Int) capturing -> None](range_size: Int): for i in range(range_size): outer_loop(i) let res = self.__iterate_binary_op_tensor[nelts, mul_v, math.mul](other) return res ^ @always_inline fn mul[nelts: Int](self, other: Self, rt: Runtime, n_cores: Int) -> Self: @parameter fn mul_p[outer_loop: fn (Int) capturing -> None](range_size: Int): parallelize[outer_loop](rt, range_size, n_cores) let res = self.__iterate_binary_op_tensor[nelts, mul_p, math.mul](other) return res ^ @always_inline fn __eq__(self, other: Self) -> Bool: return self.eq[1](other) @always_inline fn eq[nelts: Int](self, other: Self) -> Bool: let dims_eq = self.dims == other.dims debug_assert(dims_eq, "Error dimension aren't equal can't sum tensors.") var flag = True let size = self.dims.num_elements() @parameter fn iterate_vectorize[nelts: Int](i: Int): if self.load[nelts](i) != other.load[nelts](i): flag = False vectorize[nelts, iterate_vectorize](size) return flag @always_inline fn eq[nelts: Int](self, other: Self, rt: Runtime, n_cores: Int) -> Bool: let dims_eq = self.dims == other.dims debug_assert(dims_eq, "Error dimension aren't equal can't sum tensors.") var flag = True let size = self.dims.num_elements() let first_dim = self.dims[0] let dims_rest = size // first_dim # the rest of the dimensions @parameter fn iterate_parallel(i: Int): @parameter fn iterate_vectorize[nelts: Int](j: Int): let index = i * dims_rest + j if self.load[nelts](index) != other.load[nelts](index): flag = False vectorize[nelts, iterate_vectorize](dims_rest) parallelize[iterate_parallel](rt, first_dim, n_cores) return flag @always_inline fn dot[nelts: Int](self, other: Self) -> Self: let dims_1d = self.dims.rank() == 1 and other.dims.rank() == 1 debug_assert(dims_1d, "Error dimensions aren't 1D can't dot tensors.") let dims_eq = self.dims == other.dims debug_assert(dims_eq, "Error dimension aren't equal can't sum tensors.") let res = Self(False, 1) let size = self.dims.num_elements() @parameter fn dot_v[nelts: Int](index: Int): res[0] = ( res[0] + ( self.data.simd_load[nelts](index) * other.data.simd_load[nelts](index) ).reduce_add() ) vectorize[nelts, dot_v](size) return res ^ @always_inline fn __matmul__(self, other: Self) -> Self: return self.matmul[TensorG[Type].simd_width](other) @always_inline fn matmul[nelts: Int](self, other: Self) -> Self: @parameter fn matmul_v[outer_loop: fn (Int) capturing -> None](range_size: Int): for i in range(range_size): outer_loop(i) let res = self.__matmul[nelts, matmul_v](other) return res ^ @always_inline fn matmul[nelts: Int](self, other: Self, rt: Runtime, n_cores: Int) -> Self: @parameter fn matmul_p[outer_loop: fn (Int) capturing -> None](range_size: Int): parallelize[outer_loop](rt, range_size, n_cores) let res = self.__matmul[nelts, matmul_p](other) return res ^ @staticmethod # Perform 2D tiling on the iteration space defined by end_x and end_y. fn tile[tiled_fn: Tile2DFunc, tile_x: Int, tile_y: Int](end_x: Int, end_y: Int): # Note: this assumes that ends are multiples of the tiles. for y in range(0, end_y, tile_y): for x in range(0, end_x, tile_x): tiled_fn[tile_x, tile_y](x, y) fn __matmul[ nelts: Int, outer_loop_func: fn[func: fn (Int) capturing -> None] (Int) capturing -> None, ](self, other: Self) -> Self: if self.dims.rank() == 1 and other.dims.rank() == 1: return self.dot[nelts](other) let dims_eq = self.dims.eq_matmul(other.dims) debug_assert(dims_eq, "Error dimensions don't conform for a matmul.") var res_dims = InlinedFixedVector[dims_average_size, Int](self.dims.rank()) for i in range(self.dims.rank() - 1): res_dims.append(self.dims[i]) res_dims.append(other.dims[other.dims.rank() - 1]) let res = Self(False, TensorView(res_dims)) # let size = self.__matmul_num_elements(other) # The dimension that is different for self and other (other dim) let res_last_dim = res.dims[res.dims.rank() - 1] # the dimension that is the same for self and other let self_last_dim = self.dims[self.dims.rank() - 1] # The other dimension that is different for self and other (self dim) let res_penult_dim = res.dims[res.dims.rank() - 2] let size = self.size * res_last_dim # size to iterate over # We use the for inside the parallel function to remove data races, so the vectorize function works in the last dimension of the res tensor and the for makes it so the for and vectorize function work on the penultimate dimension of the res tensor (so parallel works on the penultimate dimension of the res tensor) @parameter fn outer_loop(i: Int): @parameter fn calc_tile[tile_x: Int, tile_y: Int](x: Int, y: Int): let j_range = math.min(self_last_dim, y + tile_y) for j in range(y, j_range): @parameter fn matmul_v[nelts: Int](k: Int): let index_res = i * res_last_dim + k + x # remove data races of parallel function let index_self = i * self_last_dim + j let index_other = ( i // res_penult_dim ) * self_last_dim * res_last_dim + j * res_last_dim + k + x res.store[nelts]( index_res, res.load[nelts](index_res) + self.load[1](index_self) * other.load[nelts](index_other), ) vectorize_unroll[nelts, tile_x // nelts, matmul_v]( math.min(res_last_dim - x, tile_x) ) alias tile_size = 4 self.tile[calc_tile, nelts * tile_size, tile_size]( res_last_dim, self_last_dim ) # this function is going to be basically the outer for loop, the function is going to be calling outer_loop using any method it wants until range_size("size // (res_last_dim * self_last_dim)") outer_loop_func[outer_loop](size // (res_last_dim * self_last_dim)) return res ^ --- tensor_g/tensor_view.mojo --- from utils.vector import InlinedFixedVector from .helpers import __check_bounds, __negative_pos_to_positive struct TensorView: var tensor_shape: Pointer[Int] var size: Int var len: Int fn __init__(inout self, *dims: Int): let temp = VariadicList( dims ) # because i dont know how to get the size with the variadic MLIR self.tensor_shape = Pointer[Int].alloc(len(temp)) for i in range(len(temp)): self.tensor_shape.store(i, temp[i]) self.len = len(temp) self.size = 1 self.size = self.product_dimensions() fn __init__(inout self, dims: VariadicList[Int]): self.tensor_shape = Pointer[Int].alloc(len(dims)) for i in range(len(dims)): self.tensor_shape.store(i, dims[i]) self.len = len(dims) self.size = 1 self.size = self.product_dimensions() fn __init__[size: Int](inout self, dims: InlinedFixedVector[size, Int]): self.tensor_shape = Pointer[Int].alloc(len(dims)) for i in range(len(dims)): self.tensor_shape.store(i, dims[i]) self.len = len(dims) self.size = 1 self.size = self.product_dimensions() fn __copyinit__(inout self: Self, existing: Self): """Creates a deep copy of an existing shape.""" self.tensor_shape = existing.tensor_shape self.size = existing.size self.len = existing.len fn __moveinit__(inout self: Self, owned existing: Self): """Moves exsiting shape into new shape.""" self.tensor_shape = existing.tensor_shape ^ self.size = existing.size self.len = existing.len # fn __del__(owned self): # self.tensor_shape.free() fn product_dimensions(self) -> Int: var size = 1 for i in range(self.rank()): size *= self.tensor_shape[i] return size fn __get_position(self, get_index_value: fn (Int) capturing -> Int) -> Int: """Convert position from tuple of index dimensions to 1D position.""" var pos = 0 var dims_product_acum = 1 for i in range(self.rank() - 1, 0, -1): dims_product_acum *= self.tensor_shape[i] pos += ( __negative_pos_to_positive( get_index_value(i - 1), self.tensor_shape[i - 1] ) * dims_product_acum ) pos += __negative_pos_to_positive( get_index_value(self.rank() - 1), self.tensor_shape[self.rank() - 1] ) return pos @always_inline fn get_position[len: Int](self, index: StaticIntTuple[len]) -> Int: """Convert position from tuple of index dimensions to 1D position.""" @parameter fn get_index_value(i: Int) -> Int: return index[i] return self.__get_position(get_index_value) @always_inline fn get_position[len: Int](self, index: InlinedFixedVector[len, Int]) -> Int: """Convert position from tuple of index dimensions to 1D position.""" @parameter fn get_index_value(i: Int) -> Int: return index[i] return self.__get_position(get_index_value) fn __getitem__(self, index: Int) -> Int: let pos = __negative_pos_to_positive(index, self.len) __check_bounds(pos, self.len) return self.tensor_shape[pos] fn __len__(self: Self) -> Int: """Get rank of tensor view.""" return self.len @always_inline fn __eq__(self, other: TensorView) -> Bool: if self.rank() != other.rank(): return False for i in range(self.rank()): if self[i] != other[i]: return False return True @always_inline fn eq_matmul(self, other: TensorView) -> Bool: if self.rank() != other.rank(): return False # if rank is 1 we only check the dimension for both tensors are the same (to do a dot product) if self.rank() == 1: return self == other for i in range(self.rank() - 2): if self[i] != other[i]: return False if self[self.rank() - 2] != other[self.rank() - 1]: return False return True @always_inline fn rank(self) -> Int: """Get rank of tensor view.""" return self.len fn num_elements(self) -> Int: """Get number of elements in tensor view.""" return self.size fn shape(self) -> Pointer[Int]: """Get shape of tensor view.""" return self.tensor_shape fn print_all(self): print("[") for i in range(self.rank()): print_no_newline(self[i], ",") print("]") --- LICENSE --- MIT License Copyright (c) 2023 rd4com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- > :heart: part of the effort for the community > https://github.com/Lynet101/Mojo_community-lib > this is not a library , it has not been tested. #### Thanks to @Stole from the discord who helped to convert the object to a string ```python var COL=magiclist() #var peoples=magiclist(["foo",1]) print("-------------") COL.push("something") var s:String = "ann" COL[0] = OW.from_string(s) #runtime string to builtin.object let fl:Float64 = 1.0 COL.push(fl) COL.push(3) COL.push(True) for i in range(COL.len()): if OW.is_int(COL[i]): # type check of untyped value let r:Int=OW.to_int(COL[i]) # conversion to typed value print(r) if OW.is_string(COL[i]): let r:String=OW.to_string(COL[i]) print(r) if OW.is_float(COL[i]): let r:Float64=OW.to_float64(COL[i]) print(r) if OW.is_bool(COL[i]): let r:Bool=OW.to_bool(COL[i]) print(r) COL.delete_elements("ann",OW.is_string) #typed value based deletion COL.delete(0) print("-----") print(COL.data()) #pave the way for json-like serialisation ``` - [x] typed value searched deletion in multi type array - [x] change type - [x] check type - [x] convert object to native type - [x] convert native type to object - [x] index based deletion - [x] initialize/export from/to builtin.object multitype array # output ``` ------------- ann 1.0 3 True ----- [3, True] ``` --- code.mojo --- struct OW: @staticmethod def to_i64(o:object)->Int64: #SIMD[DType.int64,1] return o._value.get_as_int().to_int() @staticmethod def to_int(o:object)->Int: #SIMD[DType.int64,1] return o._value.get_as_int().to_int() @staticmethod def to_bool(o:object)->Bool: return o._value.get_as_bool() @staticmethod def to_float64(o:object)->SIMD[DType.float64,1]: return o._value.get_as_float() @staticmethod def to_string(o:object)->String: var t = o._value.get_as_string() let p = Pointer[SIMD[DType.int8, 1]].alloc(t.length) memcpy(p, t.data, t.length) _ = o _ = t return String(p, t.length) @staticmethod def mut_int_to_float(inout o:object): if o._value.is_int(): o = o._value.convert_int_to_float() @staticmethod fn is_float(o:object)->Bool: return o._value.is_float() @staticmethod def is_func(o:object): return o._value.is_func() @staticmethod def is_int(o:object): return o._value.is_int() @staticmethod def is_list(o:object): return o._value.is_list() @staticmethod def is_string(o:object): return o._value.is_str() @staticmethod def is_bool(o:object): return o._value.is_bool() @staticmethod def is_none(o:object): return o._value.is_none() @staticmethod def get_type_id(o:object)->Int: return o._value.get_type_id() @staticmethod def push_to_list(inout o:object,o2:object): if OW.is_list(o): o.append(o2) @staticmethod def get_list_object()->object: return object([]) @staticmethod def from_string(arg:String)->object: var o = object("") for i in range(len(arg)): o = o + "1" var t = o._value.get_as_string() #let p = Pointer[SIMD[DType.int8, 1]].alloc(t.length) memcpy(t.data, arg._as_ptr(), len(arg)) _=arg return o struct magiclist: var o:object def __init__(inout self): self.o=object([]) def __init__(inout self,o:object): if OW.is_list(o): self.o = o else: self.o=object([]) def __getitem__(inout self,o2:object) -> object: return self.o[o2] #check bound def __setitem__(inout self,o2:object,o3:object): self.o[o2] = o3 #check bound @staticmethod def new(): return object([]) def len(inout self)->Int: return OW.to_int(self.o.__len__()) def push(inout self,o:object): self.o.append(o) def data(inout self): return self.o def delete_elements(inout self,e,func:fn(owned object) raises -> object): try: var tmp=object([]) var i=0 while(i<self.len()): if func(self.o[i])==True: if self.o[i]!=e: tmp.append(self.o[i]) else: tmp.append(self.o[i]) i+=1 self.o = tmp except: print("error comparing different types") def delete(inout self,idx): self.o[idx] = object(None) self.sync() def sync(inout self): var tmp=object([]) var i=0 while(i<self.len()): if OW.is_none(self.o[i])==False: tmp.append(self.o[i]) i+=1 self.o = tmp #var o:String = chr(i) #let p = object(o._strref_dangerous()) #_=o --- .gitignore --- .venv __pycache__ basalt.📦 examples/data/mnist_test.csv examples/data/mnist_train.csv examples/data/mnist_train_small.csv output_model.onnx Makefile ./temp flamegraph.svg examples/data/yolov8n.onnx --- CODEOWNERS --- * @StijnWoestenborghs * @andresnowak * @Benny-Nottonson * @soraros --- LICENSE --- ============================================================================================== The Basalt repository is licensed under the Apache License v2.0 with LLVM Exceptions: ============================================================================================== Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2024 Basalt-Org Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---- LLVM Exceptions to the Apache 2.0 License ---- As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into an Object form of such source code, you may redistribute such embedded portions in such Object form without complying with the conditions of Sections 4(a), 4(b) and 4(d) of the License. In addition, if you combine or link compiled forms of this Software with software that is licensed under the GPLv2 ("Combined Software") and if a court of competent jurisdiction determines that the patent provision (Section 3), the indemnity provision (Section 9) or other Section of the License conflicts with the conditions of the GPLv2, you may retroactively and prospectively choose to deem waived or otherwise exclude such Section(s) of the License, but only in their entirety and only with respect to the Combined Software. ============================================================================== Software from third parties included in the LLVM Project: ============================================================================== The LLVM Project contains third party software which is under different license terms. All such code will be identified clearly using at least one of two mechanisms: 1) It will be in a separate directory tree with its own `LICENSE.txt` or `LICENSE` file at the top containing the specific license and restrictions which apply to that software, or 2) It will contain specific license and restriction terms at the top of every file. --- README.md --- <br/> <p align="center"> <a href="https://github.com/Basalt-Org/Basalt"> <img src="https://github.com/basalt-org/basalt/assets/46826967/4873806c-ff61-4903-bf3d-874d6acba3e8" alt="Logo" width="200" height="200"> </a> <h1 align="center">Basalt</h1> <p align="center"> A Machine Learning framework from scratch in pure Mojo 🔥 </p> </p> <div align="center"> <img src="https://img.shields.io/github/contributors/Basalt-Org/Basalt?color=dark-green" /> <img src="https://img.shields.io/github/issues/Basalt-Org/Basalt?color=dark-green" /> <img src="https://img.shields.io/github/license/Basalt-Org/Basalt?color=dark-green" /> </div> ## About The Project Basalt is a stand-alone machine learning framework that leverages the power of Mojo. As [discussed](https://docs.modular.com/mojo/why-mojo) by Modular, Mojo is a language for the future of AI development. Built on top of MLIR technology, rather than existing GCC and LLVM approaches, Mojo looks and feels like Python code, yet performs much closer to languages like Rust or C++. Parametric functions and compile time parameters allow for the graph to statically compiled. Having the static graph allows for much harder performance optimizations. Basalt, while still in its infancy, is able to achieve speeds comparable to well established frameworks like Pytorch. Below a snapshot of the current benchmarks. But keep posted, there is much more room for improvement and we are upgrading the project on a daily basis. ![basalt_benchmark](https://github.com/basalt-org/basalt/assets/46826967/83037770-a9e3-440d-bdca-f51af0aebee0) ## Quick Start Try out the benchmarks yourself: ``` mojo -I . examples/housing.mojo ``` ``` mojo -I . examples/sin_estimate.mojo ``` ``` mojo -I . examples/mnist.mojo ``` Compare to the alternative PyTorch implementation: Make sure to install the requirements in `python-requirements.txt` in your python environment. ``` python examples/housing.py python examples/sin_estimate.py python examples/mnist.py ``` ## Roadmap ### v0.1.0 ✅ - [x] Improve matrix multiplication and convolution kernels - [x] Switch to custom Tensor and TensorShape implementations - [x] Improve benchmarks and overall model execution performance - [x] Add profiling and additional performance tests ### v0.2.0 (WIP) - [ ] Add additional operators: Slice, (Un)Squeeze, Concat, Clip, Gather, Split, FMA ... - [ ] Better layer support and more activation functions - [ ] Graph submodules & graph concatenation - [ ] Computer vision benchmark. ### Long-Term - [ ] Better parallelization - [ ] GPU support - [ ] Reworked Dataloader - [ ] Autotuning and related features - [ ] Graph compilation optimizations - [ ] Operator fusion - [ ] ONNX / Max compatibility ## Contributing Basalt is built by community efforts and relies on your expertise and enthousiasm! Small fixes and improvements are much appreciated. If you are considering larger contributions, feel free to contact us for a smoother communication channel on Discord. If you find a bug or have an idea for a feature, please use our issue tracker. Before creating a new issue, please: * Check if the issue already exists. If an issue is already reported, you can contribute by commenting on the existing issue. * If not, create a new issue and include all the necessary details to understand/recreate the problem or feature request. ### Creating A Pull Request 1. Fork the Project 2. Create your Feature Branch 3. Commit your Changes 4. Push to the Branch 5. Open a Pull Request > Once your changes are pushed, navigate to your fork on GitHub. And create a pull request against the original basalt-org/basalt repository. > - Before creating a PR make sure it doesn't break any of the unit-tests. (e.g. `mojo run -I . test/test_ops.mojo`) > - Introducing new big features requires a new test! > - In the pull request, provide a detailed description of the changes and why they're needed. Link any relevant issues. > - If there are any specific instructions for testing or validating your changes, include those as well. ## License Distributed under the Apache 2.0 License with LLVM Exceptions. See [LICENSE](https://github.com/Basalt-Org/Basalt/blob/main/LICENSE) and the LLVM [License](https://llvm.org/LICENSE.txt) for more information. ## Acknowledgements * Built with [Mojo](https://github.com/modularml/mojo) created by [Modular](https://github.com/modularml) --- basalt/__init__.mojo --- from .autograd import Graph, Symbol, OP from .nn import Tensor, TensorShape from basalt.utils.collection import Collection alias dtype = DType.float32 alias nelts = 2 * simdwidthof[dtype]() alias seed = 42 alias epsilon = 1e-12 --- basalt/autograd/__init__.mojo --- from .symbol import Symbol from .graph import Graph from .ops import OP --- basalt/autograd/attributes.mojo --- from collections import Optional, OptionalReg from utils.static_tuple import StaticTuple from basalt.nn.tensor import Tensor, TensorShape, MAX_RANK from basalt.utils.bytes import Bytes, scalar_to_bytes, bytes_to_scalar alias MAX_ATTRS = 10 alias MAX_NAME_CHARS = 16 alias MAX_DATA_BYTES = 32 @register_passable("trivial") struct AttributeType(Stringable): alias BOOL = AttributeType(0, "BOOL") alias INT = AttributeType(1, "INT") alias FLOAT = AttributeType(2, "FLOAT") alias STRING = AttributeType(3, "STRING") alias INTS = AttributeType(4, "INTS") alias FLOATS = AttributeType(5, "FLOATS") var id: UInt8 var name: Bytes[MAX_NAME_CHARS] fn __init__(inout self, id: UInt8, name: String): self.id = id self.name = Bytes[MAX_NAME_CHARS](name) fn __init__(inout self, type: DType): if type.is_floating_point(): self = AttributeType.FLOAT elif type.is_bool(): self = AttributeType.BOOL else: self = AttributeType.INT fn __eq__(self, other: Self) -> Bool: return self.id == other.id fn __str__(self) -> String: return str(self.name) @register_passable("trivial") struct AttributeVector(Sized, Stringable, CollectionElement): var attributes: StaticTuple[Attribute, MAX_ATTRS] var size: Int fn __init__(inout self, *attributes: Attribute): self.attributes = StaticTuple[Attribute, MAX_ATTRS](Attribute("", "")) self.size = len(attributes) for i in range(self.size): self.attributes[i] = attributes[i] @always_inline("nodebug") fn __len__(self) -> Int: return self.size @always_inline("nodebug") fn __getitem__(self, index: Int) -> Attribute: return self.attributes[index] @always_inline("nodebug") fn __getitem__(self, index: StringLiteral) -> OptionalReg[Attribute]: for i in range(self.size): if self.attributes[i].name == Bytes[MAX_NAME_CHARS](index): return self.attributes[i] return None fn __str__(self) -> String: var s: String = "[" for i in range(self.size): s += str(self.attributes[i]) if i < self.size - 1: s += ", " return s + "]" @register_passable("trivial") struct Attribute(Stringable, CollectionElement): var data_shape: StaticIntTuple[MAX_RANK] var name: Bytes[MAX_NAME_CHARS] var data: Bytes[MAX_DATA_BYTES] var type: AttributeType var size: Int fn __init__(inout self, name: String, value: String): self.data_shape = StaticIntTuple[MAX_RANK]() self.name = Bytes[MAX_NAME_CHARS](name) self.data = Bytes[MAX_DATA_BYTES](value) self.type = AttributeType.STRING self.size = len(value) fn __init__(inout self, name: String, value: TensorShape): self.data_shape = StaticIntTuple[MAX_RANK]() self.name = Bytes[MAX_NAME_CHARS](name) self.data = Bytes[MAX_DATA_BYTES]() self.type = AttributeType.INTS self.size = value.rank() for i in range(self.size): self.data_shape[i] = value._shape[i] fn __init__[N: Int](inout self, name: String, value: StaticIntTuple[N]): constrained[N < MAX_RANK, "Attribute rank must be less than MAX_RANK."]() self.data_shape = StaticIntTuple[MAX_RANK]() self.name = Bytes[MAX_NAME_CHARS](name) self.data = Bytes[MAX_DATA_BYTES]() self.type = AttributeType.INTS self.size = N for i in range(self.size): self.data_shape[i] = value[i] fn __init__[dtype: DType](inout self, name: String, value: Scalar[dtype]): constrained[dtype.is_numeric(), "Attribute value must be numeric."]() self.data_shape = StaticIntTuple[MAX_RANK]() self.name = Bytes[MAX_NAME_CHARS](name) self.data = scalar_to_bytes[dtype, MAX_DATA_BYTES](value) self.type = AttributeType(dtype) self.size = 1 fn __init__(inout self, name: String, value: Int): self.__init__(name, Int64(value)) self.data_shape[0] = 1 fn __init__(inout self, name: String, value: FloatLiteral): self.__init__(name, Float64(value)) self.data_shape[0] = 1 @always_inline("nodebug") fn __str__(self) -> String: return "Attribute(" + str(self.name) + ", " + "..." + ")" @always_inline("nodebug") fn to_string(self) -> String: return str(self.data) @always_inline("nodebug") fn to_shape(self) -> TensorShape: return TensorShape(rank=self.size, shape=self.data_shape) @always_inline("nodebug") fn to_static[N: Int](self) -> StaticIntTuple[N]: constrained[N < MAX_RANK, "Attribute rank must be less than MAX_RANK."]() var result = StaticIntTuple[N]() for i in range(N): result[i] = int(self.data_shape[i]) return result @always_inline("nodebug") fn to_scalar[dtype: DType](self) -> Scalar[dtype]: constrained[dtype.is_numeric(), "Attribute value must be numeric."]() return bytes_to_scalar[dtype](self.data) @always_inline("nodebug") fn to_int(self) -> Int: return int(self.to_scalar[DType.int64]()) fn json(self) -> String: var result = '{"name": "' + str(self.name) + '", ' var type: String = "" var value: String = "" if self.type == AttributeType.STRING: type = "STRING" value = '"' + self.to_string() + '"' elif self.type == AttributeType.INTS: type = "INTS" var value_temp = self.to_shape() value = "[" for i in range(value_temp.rank()): value += str(value_temp._shape[i]) if i < value_temp.rank() - 1: value += ", " value += "]" elif self.type == AttributeType.FLOAT: type = "FLOAT" value = str(self.to_scalar[DType.float64]()) elif self.type == AttributeType.INT: type = "INT" value = str(self.to_int()) else: type = "UNKNOWN" value = "UNKNOWN" result += '"type": "' + type + '", ' + '"value": ' + value return result + "}" --- basalt/autograd/graph.mojo --- from python.python import Python from collections.optional import Optional, OptionalReg from .node import Node from .attributes import AttributeVector, Attribute from .symbol import Symbol from .ops import OP, static_result_shape, dynamic_result_shape from .params import ParamDict, Param from basalt import seed, dtype from basalt import Tensor, TensorShape struct Graph: var inputs: List[Symbol] var params: ParamDict var nodes: List[Node] var outputs: List[Symbol] var loss_out: OptionalReg[Symbol] var symbol_count: UInt32 fn __init__(inout self): self.inputs = List[Symbol]() self.params = ParamDict() self.nodes = List[Node]() self.outputs = List[Symbol]() self.loss_out = None self.symbol_count = 0 fn __moveinit__(inout self, owned other: Graph): self.inputs = other.inputs^ self.params = other.params^ self.nodes = other.nodes^ self.outputs = other.outputs^ self.loss_out = other.loss_out self.symbol_count = other.symbol_count fn create_symbol(inout self, shape: TensorShape, data: Optional[Param] = None, trainable: Bool = False, is_input: Bool = False) -> Symbol: var symbol = Symbol(self.symbol_count, dtype, shape, trainable) self.symbol_count += 1 if is_input: self.inputs.append(symbol) else: if data is not None: self.params.put(symbol, data.value()[]) else: self.params.put(symbol) return symbol fn input(inout self, shape: TensorShape, trainable: Bool = False) -> Symbol: return self.create_symbol(shape, trainable=trainable, is_input=True) fn param(inout self, shape: TensorShape, init: Param, trainable: Bool = True) -> Symbol: return self.create_symbol(shape, init, trainable) fn param(inout self, shape: TensorShape, trainable: Bool = True) -> Symbol: return self.create_symbol(shape, trainable=trainable) fn scalar(inout self, value: Scalar[dtype]) -> Symbol: return self.create_symbol(TensorShape(1), Param(value), trainable=False) fn constant(inout self, shape: TensorShape, data: List[Scalar[dtype]]) -> Symbol: return self.create_symbol(shape, Param(data), trainable=False) fn out(inout self, symbol: Symbol): self.outputs.append(symbol) fn loss(inout self, symbol: Symbol): self.loss_out = symbol fn op( inout self, op: OP, *operands: Symbol, attributes: AttributeVector = AttributeVector(), ) -> Symbol: var res_shape = static_result_shape(op, operands, attributes) var res = Symbol(self.symbol_count, dtype, res_shape, self.result_trainable(operands)) self.symbol_count += 1 var inputs = List[Symbol]() inputs.reserve(len(operands)) for operand in operands: inputs.append(operand) self.nodes.append(Node(op, inputs, List[Symbol](res), attributes)) return res fn op( inout self, op: OP, operand_1: Symbol, operand_2: Float64, attributes: AttributeVector = AttributeVector(), ) -> Symbol: return self.op(op, operand_1, self.scalar(operand_2), attributes=attributes) fn op( inout self, op: OP, operand_1: Float64, operand_2: Symbol, attributes: AttributeVector = AttributeVector(), ) -> Symbol: return self.op(op, self.scalar(operand_1), operand_2, attributes=attributes) fn create_symbols(inout self, shapes: List[TensorShape], trainable: Bool = False) -> List[Symbol]: var symbols = List[Symbol]() symbols.reserve(len(shapes)) for shape in shapes: symbols.append(Symbol(self.symbol_count, dtype, shape[], trainable)) self.symbol_count += 1 return symbols fn add_node(inout self, op: OP, inputs: List[Symbol], outputs: List[Symbol], attributes: AttributeVector): self.nodes.append(Node(op, inputs, outputs, attributes)) fn concat(inout self, *operands: Symbol, dim: Int = 0) -> Symbol: var attributes = AttributeVector(Attribute("dim", dim)) var res_shape = dynamic_result_shape(OP.CONCAT, operands, attributes)[0] var res_symbols = self.create_symbols(List[TensorShape](res_shape), self.result_trainable(operands)) var operand_list = List[Symbol]() operand_list.reserve(len(operands)) for operand in operands: operand_list.append(operand) self.add_node(OP.CONCAT, operand_list, res_symbols, attributes) return res_symbols[0] fn split( inout self, operand: Symbol, sections: List[Int], dim: Int = 0 ) -> List[Symbol]: var attributes = AttributeVector(Attribute("sections", TensorShape(sections)), Attribute("dim", dim)) var res_shapes = dynamic_result_shape(OP.SPLIT, operand, attributes) var trainable = self.result_trainable(operand) var result_symbols = self.create_symbols(res_shapes, trainable) self.add_node(OP.SPLIT, List[Symbol](operand), result_symbols, attributes) return result_symbols @staticmethod fn result_trainable(operands: VariadicList[Symbol]) -> Bool: for operand in operands: if operand.trainable: return True return False fn json(self) -> String: var result: String = '{"graph_name": "basalt", "nodes": [' for i in range(len(self.nodes)): result += self.nodes[i].json() if i < len(self.nodes) - 1: result += ", " result += '], "inputs": [' for i in range(len(self.inputs)): result += self.inputs[i].json() if i < len(self.inputs) - 1: result += ", " result += '], "outputs": [' for i in range(len(self.outputs)): result += self.outputs[i].json() if i < len(self.outputs) - 1: result += ", " if self.loss_out: result += '], "loss": [' result += self.loss_out.value().json() result += '], "params": [' for i in range(len(self.params)): result += self.params.symbols[i].json() if i < len(self.params) - 1: result += ", " result += "]}" return result fn render(self, render_type: String = "node") raises: Python.add_to_path("./basalt/utils") var renderer = Python.import_module("graph_render") var json = Python.import_module("json") _ = renderer.netron_render(json.loads(self.json()), render_type) fn compile(inout self): # 0. Sorting the graph # The staticlly defined graph has an implicit topological sorted order because, # each new operation is added the list of nodes after its dependencies have been calculated. # This eliminates the need for explicit topological sorting. # Possibilities: # - 1. Graph layout transformation (graph rewrite) # - Layer pruning (removing nodes that have no effect - with common sub-tree identification) # - Eliminate redundant intermediate data copies # - Operator replacement (e.g. replacing (combination of) costly ops with more efficient ones) # - (exmple of graph rewrite: https://dl.acm.org/doi/pdf/10.1145/3453483.3454083 - Table 4) # - Other intra-block optimizations: (e.g. data layout transformation BCHW -> BHWC, etc.) # - 2. Operator fusion (combining ops without materializing intermediate results) # - Fusion plan exploration # - Fusion plan generation (with subsequent intra-block optimizations) # - (example fusion plan algorithm: https://dl.acm.org/doi/pdf/10.1145/3453483.3454083 - Listing 1) # - 3. Fusion Code generation (behaviour) # - Code generation for planned fusion blocks # - Other inter-block optimizations (e.g. data layout transformation BCHW -> BHWC, etc.) # - 4. Auto-tuning (of vectorization-, parallelization-, tiling-, unrolling-parameters) # - (Might only work when memory is initialized) # Other considerations: # - Efficient Memory management: # - Memory reuse (in-place operations) # - Data layout from BCHW (batch, channel, height, width) to BHWC can lead to better utilization and efficiency # - VJP, JVP (for automatic differentiation) pass --- basalt/autograd/node.mojo --- from collections.optional import Optional from utils.variant import Variant from basalt.autograd import Symbol from basalt.autograd.ops import OP from .attributes import AttributeVector @value struct Node(CollectionElement, Stringable): var operator: OP var inputs: List[Symbol] var outputs: List[Symbol] var attributes: AttributeVector fn __init__( inout self, operator: OP, inputs: List[Symbol], outputs: List[Symbol], attributes: AttributeVector = AttributeVector(), ): self.operator = operator self.inputs = inputs self.outputs = outputs self.attributes = attributes fn __str__(self) -> String: return self.json() fn json(self) -> String: var s: String = '{"operator": "' + str(self.operator.name) + '", "inputs": [' for i in range(len(self.inputs)): s += self.inputs[i].json() if i < len(self.inputs) - 1: s += ", " s += '], "outputs": [' for i in range(len(self.outputs)): s += self.outputs[i].json() if i < len(self.outputs) - 1: s += ", " s += '], "attributes": [' for i in range(len(self.attributes)): s += self.attributes[i].json() if i < len(self.attributes) - 1: s += ", " s += "]}" return s --- basalt/autograd/ops/__init__.mojo --- from .ops import ( OP, static_result_shape, dynamic_result_shape, forward_op, backward_op, ) --- basalt/autograd/ops/basics.mojo --- from math import log, exp from algorithm import vectorize from memory import memcpy from utils.numerics import isinf from basalt import Tensor, TensorShape from basalt.nn.tensor import MAX_RANK from basalt.utils.tensorutils import * from basalt.autograd.attributes import Attribute, AttributeVector from basalt.autograd.ops.matmul import dot, dot_transpose_t1, dot_transpose_t2 from basalt.utils.math_util import add, sub, mul, div """ Implement forward and backward operations for basic tensor manipulations. """ @value struct ADD: @staticmethod fn result_shape(t1_shape: TensorShape, t2_shape: TensorShape) -> TensorShape: return broadcast_shapes(t1_shape, t2_shape) @staticmethod fn forward[ t1_shape: TensorShape, t2_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): """ Forward pass of the add operation. """ elwise_op[t1_shape, t2_shape, add](res, t1, t2) @staticmethod fn backward[ tensor_id: Int, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of element wise addition.""" # d(x + y) / dx = d(x + y) / dy = 1 return ug @value struct SUB: @staticmethod fn result_shape(t1_shape: TensorShape, t2_shape: TensorShape) -> TensorShape: return broadcast_shapes(t1_shape, t2_shape) @staticmethod fn forward[ t1_shape: TensorShape, t2_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): """ Forward pass of the subtraction operation. """ elwise_op[t1_shape, t2_shape, sub](res, t1, t2) @staticmethod fn backward[ tensor_id: Int, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of element wise subtraction.""" # d(x - y) / dx = 1 # d(x - y) / dy = -1 @parameter if tensor_id == 0: return ug else: var res_grad = Tensor[dtype](ug_shape) elwise_op[mul](res_grad, ug, -1.0) return res_grad ^ @value struct MUL: @staticmethod fn result_shape(t1_shape: TensorShape, t2_shape: TensorShape) -> TensorShape: return broadcast_shapes(t1_shape, t2_shape) @staticmethod fn forward[ t1_shape: TensorShape, t2_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): """ Forward pass of the multiplication operation. """ elwise_op[t1_shape, t2_shape, mul](res, t1, t2) @staticmethod fn backward[ tensor_id: Int, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of element wise multiplication.""" # d(x * y) / dx = y # d(x * y) / dy = x @parameter if tensor_id == 0: var res_grad = Tensor[dtype](ug_shape) elwise_op[ug_shape, t2_shape, mul](res_grad, ug, t2) return res_grad ^ else: var res_grad = Tensor[dtype](ug_shape) elwise_op[ug_shape, t1_shape, mul](res_grad, ug, t1) return res_grad ^ @value struct DIV: @staticmethod fn result_shape(t1_shape: TensorShape, t2_shape: TensorShape) -> TensorShape: return broadcast_shapes(t1_shape, t2_shape) @staticmethod fn forward[ t1_shape: TensorShape, t2_shape: TensorShape ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): """ Forward operation of element wise division. """ elwise_op[t1_shape, t2_shape, div](res, t1, t2) @staticmethod fn backward[ tensor_id: Int, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of element wise division.""" # d(x/y) / dx = 1/y # d(x/y) / dy = -x/y^2 @parameter if tensor_id == 0: var res_grad = Tensor[dtype](ug_shape) elwise_op[ug_shape, t2_shape, div](res_grad, ug, t2) return res_grad ^ else: alias broadcast = (t1_shape != t2_shape) alias is_scalar = (t2_shape == TensorShape(1)) var res_grad = Tensor[dtype](ug_shape) @parameter if is_scalar: var factor: Scalar[dtype] = -1.0 / (t2[0] ** 2) @parameter fn vec_div_bw_scalar[nelts: Int](i: Int): res_grad.store[nelts]( i, factor * t1.load[nelts](i) * ug.load[nelts](i) ) vectorize[vec_div_bw_scalar, nelts](ug_shape.num_elements()) elif broadcast and not is_scalar: alias size = ug_shape.rank() alias strides1 = broadcast_calculate_strides[size, t1_shape, ug_shape]() alias strides2 = broadcast_calculate_strides[size, t2_shape, ug_shape]() @parameter fn vec_div_bw_broadcast[netls: Int](i: Int): var index1 = get_real_index[size, strides1, ug_shape](i) var index2 = get_real_index[size, strides2, ug_shape](i) res_grad.store[nelts]( i, -t1.load[nelts](index1) / (t2.load[nelts](index2) ** 2) * ug.load[nelts](i), ) vectorize[vec_div_bw_broadcast, 1](ug_shape.num_elements()) else: @parameter fn vec_div_bw[nelts: Int](i: Int): res_grad.store[nelts]( i, -t1.load[nelts](i) / (t2.load[nelts](i) ** 2) * ug.load[nelts](i), ) vectorize[vec_div_bw, nelts](ug_shape.num_elements()) return res_grad ^ @value struct DOT: @staticmethod fn result_shape(t1_shape: TensorShape, t2_shape: TensorShape) -> TensorShape: return TensorShape(t1_shape[0], t2_shape[1]) @staticmethod fn forward[ t1_shape: TensorShape, t2_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): """ Forward pass of the dot operation. """ dot[t1_shape, t2_shape](res, t1, t2) @staticmethod fn backward[ tensor_id: Int, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of dot product.""" @parameter if tensor_id == 0: # dot(ug, t2.T) var res_grad = Tensor[dtype](t1_shape) dot_transpose_t2[ug_shape, t2_shape](res_grad, ug, t2) return res_grad ^ else: # dot(t1.T, ug) var res_grad = Tensor[dtype](t2_shape) dot_transpose_t1[t1_shape, ug_shape](res_grad, t1, ug) return res_grad ^ @value struct EXP: @staticmethod fn result_shape(t1_shape: TensorShape) -> TensorShape: return t1_shape @staticmethod fn forward[ t1_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype]): """Forward operation of exp.""" elwise_transform[exp](res, t1) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of exp.""" # d(exp(x)) / dx = exp(x) var res_grad = Tensor[dtype](ug_shape) @parameter fn vec_exp_bw[nelts: Int](i: Int): res_grad.store[nelts](i, exp(t1.load[nelts](i)) * ug.load[nelts](i)) vectorize[vec_exp_bw, nelts](ug_shape.num_elements()) return res_grad ^ @value struct LOG: @staticmethod fn result_shape(t1_shape: TensorShape) -> TensorShape: return t1_shape @staticmethod fn forward[ t1_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype]): """Forward operation of exp.""" elwise_transform[log](res, t1) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of log.""" # d(log(x)) / dx = 1 / x var res_grad = Tensor[dtype](ug_shape) elwise_op[ug_shape, t1_shape, div](res_grad, ug, t1) return res_grad ^ struct POW: @staticmethod fn result_shape(t1_shape: TensorShape, t2_shape: TensorShape) -> TensorShape: # t2_shape == TensorShape(1) return t1_shape @staticmethod fn forward[ t1_shape: TensorShape, t2_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): """Forward operation of element wise pow.""" # t2_shape is a graph scalar elwise_pow(res, t1, int(t2[0])) @staticmethod fn backward[ tensor_id: Int, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of element wise pow.""" # d(x^y) / dx = y * x^(y-1) # d(x^y) / dy = sum( x^y * log(x) ) var res_grad: Tensor[dtype] var a = t2[0] alias epsilon = 1e-12 @parameter if tensor_id == 0: res_grad = Tensor[dtype](t1_shape) @parameter fn vec_pow_bw_x[nelts: Int](i: Int): res_grad.store[nelts](i, a * ((t1.load[nelts](i) + epsilon) ** (a - 1)) * ug.load[nelts](i)) vectorize[vec_pow_bw_x, nelts](t1_shape.num_elements()) else: # Gradient of the exponent res_grad = Tensor[dtype](t2_shape) # t2_shape == TensorShape(1) @parameter fn vec_pow_bw_y[nelts: Int](i: Int): # the case when the value passed to log is 0.0 var temp_log = log(t1.load[nelts](i)) var temp_log_is_inf = isinf(temp_log) temp_log = temp_log_is_inf.select(0, temp_log) res_grad[0] += ( (t1.load[nelts](i) ** a) * temp_log * ug.load[nelts](i) ).reduce_add() vectorize[vec_pow_bw_y, nelts](ug_shape.num_elements()) return res_grad ^ struct SUM: @staticmethod fn result_shape(t_shape: TensorShape, attributes: AttributeVector) -> TensorShape: var axis = attributes["axis"] if axis: return get_reduce_shape(t_shape, axis.value().to_int()) else: return TensorShape(1) @staticmethod fn forward[ t_shape: TensorShape, attributes: AttributeVector ](inout res: Tensor[dtype], t: Tensor[dtype]): """ Forward pass of the sum operation. """ alias axis = attributes["axis"] @parameter if axis: tsum(res, t, axis.value().to_int()) else: res[0] = tsum(t) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape, attributes: AttributeVector ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of sum.""" return Self.backward[ug_shape, t_shape](ug, t) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of sum.""" var res_grad = Tensor[dtype](t_shape) fill(res_grad, 1.0) elwise_op[t_shape, ug_shape, mul](res_grad, res_grad, ug) return res_grad ^ @value struct MEAN: @staticmethod fn result_shape(t_shape: TensorShape, attributes: AttributeVector) -> TensorShape: var axis = attributes["axis"] if axis: return get_reduce_shape(t_shape, axis.value().to_int()) else: return TensorShape(1) @staticmethod fn forward[ t_shape: TensorShape, attributes: AttributeVector ](inout res: Tensor[dtype], t: Tensor[dtype]): """ Forward pass of the mean operation. """ alias axis = attributes["axis"] @parameter if axis: tmean(res, t, axis.value().to_int()) else: res[0] = tmean(t) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape, attributes: AttributeVector ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of mean.""" alias axis = attributes["axis"] @parameter if axis: return Self.backward[ug_shape, t_shape](ug, t, axis.value().to_int()) else: return Self.backward[ug_shape, t_shape](ug, t) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of mean.""" # d(mean(t)) / dt = 1 / t.num_elements() var res_grad = Tensor[dtype](t_shape) var grad: Scalar[dtype] = 1.0 / t_shape.num_elements() grad = ( grad * ug[0] ) # because ug is a tensor of size 1 when mean is used without an axis @parameter fn v_mean_d[nelts: Int](i: Int): res_grad.store[nelts](i, grad) vectorize[v_mean_d, nelts](t_shape.num_elements()) return res_grad ^ @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape ](ug: Tensor[dtype], t: Tensor[dtype], axis: Int) -> Tensor[dtype]: """Backward operation of mean.""" # d(mean(t)) / dt = 1 / t.dim(axis) var res_grad = Tensor[dtype](t_shape) var grad: Scalar[dtype] = 1.0 / t_shape[axis] fill(res_grad, grad) elwise_op[t_shape, ug_shape, mul](res_grad, res_grad, ug) return res_grad ^ struct MAX: @staticmethod fn result_shape(t_shape: TensorShape, attributes: AttributeVector) -> TensorShape: var axis = attributes["axis"] if axis: return get_reduce_shape(t_shape, axis.value().to_int()) else: return TensorShape(1) @staticmethod fn forward[ t_shape: TensorShape, attributes: AttributeVector ](inout res: Tensor[dtype], t: Tensor[dtype]): """ Forward pass of the max operation. """ alias axis = attributes["axis"] @parameter if axis: tmax(res, t, axis.value().to_int()) else: res[0] = tmax(t) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape, attributes: AttributeVector ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of max.""" alias axis = attributes["axis"] @parameter if axis: return Self.backward[ug_shape, t_shape](ug, t, axis.value().to_int()) else: return Self.backward[ug_shape, t_shape](ug, t) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of max.""" # This could be changed to something like in tinygrad: # max_1s = CMPEQ(original_tensor, expanded(max_tensor), axis=axis) # sum_max_1s = SUM(max_1s) # div_sum_max_1s = DIV(max_1, sum_max_1s) # The selected element gradient is 1.0, the others are 0.0. And if there are # multiple max values, the gradient is divided by the number of max # values (1/n) for each max value. var res_grad = Tensor[dtype](t_shape) # ug_shape size is 1 var max_res = tmax(t) var sum_eq: Scalar[dtype] = 0 for i in range(t.num_elements()): if t[i] == max_res: sum_eq += 1 var factor = 1 / sum_eq for i in range(res_grad.num_elements()): if t[i] == max_res: res_grad[i] = factor * ug[0] return res_grad ^ @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape ](ug: Tensor[dtype], t: Tensor[dtype], axis: Int) -> Tensor[dtype]: """Backward operation of max.""" # The selected element gradient is 1.0, the others are 0.0. And if there are # multiple max values, the gradient is divided by the number of max # values (1/n) for each max value. var res_grad = Tensor[dtype](t_shape) var max_res = Tensor[dtype](ug_shape) alias strides = t_shape.strides() tmax( max_res, t, axis ) # To not calculate this again we could receive the result of the forward pass as a parameter for i in range(max_res.num_elements()): var index_base = (i % strides[axis]) + (i // strides[axis]) * ( strides[axis] * t.dim(axis) ) var count_1s: Scalar[dtype] = 0 # Count the number of values equal to max_res for j in range(t.dim(axis)): var index = index_base + j * strides[axis] if t[index] == max_res[i]: count_1s += 1 # Divide 1.0 by the number of max values (n) and multiply by upper gradient value var factor = 1 / count_1s for j in range(t.dim(axis)): var index = index_base + j * strides[axis] if t[index] == max_res[i]: res_grad[index] = factor * ug[i] return res_grad ^ struct TRANSPOSE: @staticmethod fn result_shape(t_shape: TensorShape, attributes: AttributeVector) -> TensorShape: var axes = attributes["axes"] # axes to be permuted var rank = t_shape.rank() var shape = StaticIntTuple[MAX_RANK]() if axes: # NOTE: axis has to be the size of rank of the tensor var axes_shape = axes.value().to_shape() for i in range(rank): shape[i] = t_shape[axes_shape[i]] else: for i in range(rank): shape[i] = t_shape[rank - i - 1] return TensorShape(rank=rank, shape=shape) @staticmethod fn forward[ t_shape: TensorShape, attributes: AttributeVector ](inout res: Tensor[dtype], t: Tensor[dtype]): """ Forward pass of the transpose operation. """ alias axes = attributes["axes"] @parameter if axes: var axes_shape = axes.value().to_shape() transpose(res, t, axes_shape) else: fn create_transpose_axes() -> TensorShape: var rank = t_shape.rank() var axes = StaticIntTuple[MAX_RANK]() for i in range(rank): axes[i] = rank - i - 1 return TensorShape(rank=rank, shape=axes) alias axes_shape = create_transpose_axes() transpose(res, t, axes_shape) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape, attributes: AttributeVector ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of transpose.""" # No local gradient. Transpose is its own inverse. alias axes = attributes["axes"] var res_grad = Tensor[dtype](t_shape) @parameter if axes: fn create_inverse_axes() -> TensorShape: var axes_shape = axes.value().to_shape() var rank = axes_shape.rank() var axes_shape_inv = StaticIntTuple[MAX_RANK]() for i in range(rank): axes_shape_inv[axes_shape[i]] = i return TensorShape(rank=rank, shape=axes_shape_inv) alias axes_shape_inv = create_inverse_axes() transpose(res_grad, ug, axes_shape_inv) else: fn create_transpose_axes() -> TensorShape: var rank = t_shape.rank() var axes = StaticIntTuple[MAX_RANK]() for i in range(rank): axes[i] = rank - i - 1 return TensorShape(axes) alias axes_shape_inv = create_transpose_axes() transpose(res_grad, ug, axes_shape_inv) return res_grad ^ struct FLATTEN: @staticmethod fn result_shape(t_shape: TensorShape) -> TensorShape: return TensorShape(t_shape.num_elements()) @staticmethod fn forward[t_shape: TensorShape](inout res: Tensor[dtype], t: Tensor[dtype]): """ Forward pass of the flatten operation. """ memcpy(res.data(), t.data(), t_shape.num_elements()) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of flatten.""" var res_grad = Tensor[dtype](t_shape) memcpy(res_grad.data(), ug.data(), ug_shape.num_elements()) return res_grad ^ struct RESHAPE: @staticmethod fn result_shape(t_shape: TensorShape, attributes: AttributeVector) -> TensorShape: var new_shape = attributes["shape"] return new_shape.value().to_shape() @staticmethod fn forward[t_shape: TensorShape](inout res: Tensor[dtype], t: Tensor[dtype]): """ Forward pass of the reshape operation. """ memcpy(res.data(), t.data(), t_shape.num_elements()) @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of reshape.""" var res_grad = Tensor[dtype](t_shape) memcpy(res_grad.data(), ug.data(), ug_shape.num_elements()) return res_grad ^ struct FMA: @staticmethod fn result_shape( t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape ) -> TensorShape: # FMA assumes: t1_shape == t2_shape == t3_shape # TODO: Error handling, constraints in API return t1_shape @staticmethod fn forward[ t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape, ]( inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype], t3: Tensor[dtype], ): """ Forward pass of the fma operation. """ @parameter fn vec_fma[nelts: Int](i: Int): res.store[nelts]( i, t1.load[nelts](i).fma(t2.load[nelts](i), t3.load[nelts](i)) ) vectorize[vec_fma, nelts, size = t1_shape.num_elements()]() @staticmethod fn backward[ tensor_id: Int, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape, ]( ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype], t3: Tensor[dtype] ) -> Tensor[dtype]: """Backward operation of fma.""" # d(x * y + z) / dx = y # d(x * y + z) / dy = x # d(x * y + z) / dz = 1 @parameter if tensor_id == 0: var res_grad = Tensor[dtype](ug_shape) elwise_op[ug_shape, t2_shape, mul](res_grad, ug, t2) return res_grad ^ elif tensor_id == 1: var res_grad = Tensor[dtype](ug_shape) elwise_op[ug_shape, t1_shape, mul](res_grad, ug, t1) return res_grad ^ else: return ug --- basalt/autograd/ops/conv.mojo --- from basalt import Tensor, TensorShape from basalt.autograd.attributes import AttributeVector from algorithm import parallelize, vectorize, tile from utils.loop import unroll @always_inline fn get_result_shape( input_shape: TensorShape, kernel_shape: TensorShape, padding: StaticIntTuple[2], stride: StaticIntTuple[2], dilation: StaticIntTuple[2], ) -> StaticIntTuple[2]: """ Calculates the X and Y dimensions of the resulting convolution. Dimensions X, Y are on the end of the shape (..., X, Y) dimension X on index -2. dimension Y on index -1. """ var result_x_dim = ( (input_shape[-2] + (2 * padding[0]) - dilation[0] * (kernel_shape[-2] - 1) - 1) // stride[0] ) + 1 var result_y_dim = ( (input_shape[-1] + (2 * padding[1]) - dilation[1] * (kernel_shape[-1] - 1) - 1) // stride[1] ) + 1 return StaticIntTuple[2](result_x_dim, result_y_dim) struct CONV2D: @staticmethod fn result_shape( input_shape: TensorShape, kernel_shape: TensorShape, bias_shape: TensorShape, attributes: AttributeVector, ) -> TensorShape: # Output shape = [batch, out_channels, oX, oY] var padding = attributes["padding"].value().to_static[2]() var stride = attributes["stride"].value().to_static[2]() var dilation = attributes["dilation"].value().to_static[2]() var res = get_result_shape(input_shape, kernel_shape, padding, stride, dilation) return TensorShape(input_shape[0], kernel_shape[0], res[0], res[1]) @staticmethod fn forward[ input_shape: TensorShape, kernel_shape: TensorShape, bias_shape: TensorShape, attributes: AttributeVector, ]( inout outputs: Tensor[dtype], inputs: Tensor[dtype], kernel: Tensor[dtype], bias: Tensor[dtype], ): """ Performs a 2D convolution on the input tensor using the kernel and bias. inputs.shape [batch, in_channels, iX, iY] kernel.shape [out_channels, in_channels, kX, kY] (or weights) bias.shape [out_channels]. output.shape [batch, out_channels, oX, oY]. """ alias padding = attributes["padding"].value().to_static[2]() alias stride = attributes["stride"].value().to_static[2]() alias dilation = attributes["dilation"].value().to_static[2]() alias padding_x = padding[0] alias padding_y = padding[1] alias stride_x = stride[0] alias stride_y = stride[1] alias dilation_x = dilation[0] alias dilation_y = dilation[1] alias batch_size = input_shape[0] alias in_channels = input_shape[1] alias in_x = input_shape[2] alias in_y = input_shape[3] alias out_channels = kernel_shape[0] alias k_x = kernel_shape[2] alias k_y = kernel_shape[3] alias out_x = output_shape[2] alias out_y = output_shape[3] alias col_x = out_x alias col_y = out_y alias col_shape = TensorShape( batch_size, col_x * col_y, in_channels * k_x * k_y ) # [batch, colX * colY, in_channels * kX * kY] alias output_shape = Self.result_shape( input_shape, kernel_shape, bias_shape, attributes ) alias col_shape_stripped = TensorShape(in_channels * k_x * k_y, col_x, col_y) alias inputs_strides = input_shape.strides() alias kernel_strides = kernel_shape.strides() alias outputs_strides = output_shape.strides() alias col_strides = col_shape.strides() var col_ptr = DTypePointer[dtype].alloc(col_shape.num_elements()) memset_zero(col_ptr, col_shape.num_elements()) @parameter fn im2col(batch: Int): for ux in range(out_x): for uy in range(out_y): for in_ch in range(in_channels): for kx in range(k_x): for ky in range(k_y): var ix = ux * stride_x - padding_x + kx * dilation_x var iy = uy * stride_y - padding_y + ky * dilation_y if ix < 0 or iy < 0 or ix >= in_x or iy >= in_y: continue var col_index = ( batch * col_strides[0] + (ux * col_y + uy) * col_strides[1] + (in_ch * k_x * k_y + kx * k_y + ky) ) var input_index = ( batch * inputs_strides[0] + in_ch * inputs_strides[1] + ix * inputs_strides[2] + iy ) col_ptr[col_index] = inputs[input_index] parallelize[im2col](batch_size) @parameter fn conv(batch: Int): for out_ch in range(out_channels): for ux in range(out_x): for uy in range(out_y): var result: SIMD[dtype, nelts] = 0 @parameter fn v_im2col[_nelts: Int](in_ch_kx_ky: Int): var col_index = ( batch * col_strides[0] + (ux * col_y + uy) * col_strides[1] + in_ch_kx_ky ) var kernel_index = ( out_ch * kernel_strides[0] + in_ch_kx_ky ) @parameter if _nelts == nelts: result += col_ptr.load[width=nelts]( col_index ) * kernel.load[nelts](kernel_index) else: result[0] += ( col_ptr.load[width=_nelts](col_index) * kernel.load[_nelts](kernel_index) ).reduce_add() vectorize[v_im2col, nelts](in_channels * k_x * k_y) var output_index = ( batch * outputs_strides[0] + out_ch * outputs_strides[1] + ux * outputs_strides[2] + uy ) outputs[output_index] = result.reduce_add() + bias[out_ch] parallelize[conv](batch_size) col_ptr.free() @staticmethod fn backward[ tensor_id: Int, ug_shape: TensorShape, input_shape: TensorShape, kernel_shape: TensorShape, bias_shape: TensorShape, attributes: AttributeVector, ]( ug: Tensor[dtype], inputs: Tensor[dtype], kernel: Tensor[dtype], bias: Tensor[dtype], ) -> Tensor[dtype]: """ Backward operation of 2D convolution. Upper gradient of shape: [batch, out_channels, uX, uY]. """ alias padding = attributes["padding"].value().to_static[2]() alias stride = attributes["stride"].value().to_static[2]() alias dilation = attributes["dilation"].value().to_static[2]() alias padding_0 = padding[0] alias padding_1 = padding[1] alias stride_0 = stride[0] alias stride_1 = stride[1] alias dilation_0 = dilation[0] alias dilation_1 = dilation[1] alias inputs_strides = input_shape.strides() alias kernel_strides = kernel_shape.strides() alias ug_strides = ug_shape.strides() alias inputs_strides_0 = inputs_strides[0] alias inputs_strides_1 = inputs_strides[1] alias inputs_strides_2 = inputs_strides[2] alias kernel_strides_0 = kernel_strides[0] alias kernel_strides_1 = kernel_strides[1] alias kernel_strides_2 = kernel_strides[2] alias ug_strides_0 = ug_strides[0] alias ug_strides_1 = ug_strides[1] alias ug_strides_2 = ug_strides[2] alias input_shape_0 = input_shape[0] alias input_shape_1 = input_shape[1] alias input_shape_2 = input_shape[2] alias input_shape_3 = input_shape[3] alias kernel_shape_2 = kernel_shape[2] alias kernel_shape_3 = kernel_shape[3] alias ug_shape_0 = ug_shape[0] alias ug_shape_1 = ug_shape[1] alias ug_shape_2 = ug_shape[2] alias ug_shape_3 = ug_shape[3] var res: Tensor[dtype] @parameter if tensor_id == 0: # Inputs # Sum of upper gradient over batch, X, Y dimensions res = Tensor[dtype](input_shape) @parameter fn input_grad(batch: Int): for out_ch in range(ug_shape_1): for ux in range(ug_shape_2): for uy in range(ug_shape_3): # For all the element of ug var ix_base = ux * stride_0 - padding_0 var iy_base = uy * stride_1 - padding_1 var ug_val = ug[ batch * ug_strides_0 + out_ch * ug_strides_1 + ux * ug_strides_2 + uy ] for in_ch in range(input_shape_1): for kx in range(kernel_shape_2): for ky in range(kernel_shape_3): var ix = ix_base + kx * dilation_0 var iy = iy_base + ky * dilation_1 if ( ix < 0 or iy < 0 or ix >= input_shape_2 or iy >= input_shape_3 ): continue var kernel_index = ( out_ch * kernel_strides_0 + in_ch * kernel_strides_1 + kx * kernel_strides_2 + ky ) var input_index = ( batch * inputs_strides_0 + in_ch * inputs_strides_1 + ix * inputs_strides_2 + iy ) res[input_index] += ( kernel[kernel_index] * ug_val ) parallelize[input_grad](input_shape_0) elif tensor_id == 1: # Kernel # Sum of upper gradient over batch and X, Y dimensions res = Tensor[dtype](kernel_shape) @parameter fn kernel_grad(out_ch: Int): var channel_offset = out_ch * kernel_strides_0 for k in range(input_shape_1 * kernel_shape_2 * kernel_shape_3): var in_ch_kx_ky = divmod(k, kernel_shape_3) var in_ch = k // (kernel_shape_2 * kernel_shape_3) var kx = in_ch_kx_ky[0] % kernel_shape_2 var ky = in_ch_kx_ky[1] # TODO: Cant vectorize since you are going different directions across input and upper grad # But theoretically could transpose or split somehow var result: Scalar[dtype] = 0 for batch in range(input_shape_0): for ux in range(ug_shape_2): for uy in range(ug_shape_3): var ix = ux * stride_0 - padding_0 + kx * dilation_0 var iy = uy * stride_1 - padding_1 + ky * dilation_1 if ( ix < 0 or iy < 0 or ix >= input_shape_2 or iy >= input_shape_3 ): continue var input_index = batch * inputs_strides_0 + in_ch * inputs_strides_1 + ix * inputs_strides_2 + iy var ug_index = batch * ug_strides_0 + out_ch * ug_strides_1 + ux * ug_strides_2 + uy result += inputs[input_index] * ug[ug_index] var kernel_index = channel_offset + k res[kernel_index] = result parallelize[kernel_grad](ug_shape_1) else: # Bias # Sum of upper gradient over batch and X, Y dimensions # out_channels == ug_shape[1] == bias_shape[0] res = Tensor[dtype](bias_shape) # Psuedocode # For every channel in the bias tensor, # Iterate over the upper gradient across the batch # For each batch, sum the upper gradient across X, Y dimensions # Add the sum to the bias tensor @parameter fn bias_grad(out_ch: Int): var channel_offset = out_ch * ug_strides_1 var sum: Scalar[dtype] = 0 for batch in range(ug_shape_0): var batch_offset = batch * ug_strides_0 + channel_offset @parameter fn vec_sum[Nelts: Int](ux_uy: Int): sum += ug.load[Nelts](batch_offset + ux_uy).reduce_add() vectorize[vec_sum, nelts, size = ug_shape_2 * ug_shape_3]() res[out_ch] = sum parallelize[bias_grad](ug_shape_1) return res --- basalt/autograd/ops/dynamics.mojo --- from basalt import Symbol from basalt.nn.model import Parameters from ..attributes import AttributeVector struct CONCAT: @staticmethod fn result_shape( input_shapes: List[TensorShape], attributes: AttributeVector ) -> List[TensorShape]: # Assumptions: all tensors have the same shape, except for the concatenating dimension var dim = attributes["dim"].value().to_int() if attributes["dim"] else 0 var concat_size: Int = 0 for i in range(len(input_shapes)): concat_size += input_shapes[i][dim] var res_shape = input_shapes[0] res_shape[dim] = concat_size return List[TensorShape](res_shape) @staticmethod fn calc_chunks(shape: TensorShape, dim: Int) -> Int: # Number of chunks up to the concatenating dimension # Assuming tensor of equal shape, except for the concatenating dimension var chunks = 1 for i in range(dim): chunks *= shape[i] return chunks @staticmethod fn forward[attributes: AttributeVector]( inputs: List[Symbol], outputs: List[Symbol], inout parameters: Parameters, ): alias dim = attributes["dim"].value().to_int() if attributes["dim"] else 0 var n_chunks = Self.calc_chunks(inputs[0].shape, dim) var chunks = List[Int]() var chunk_offsets = List[Int](0) for i in range(len(inputs)): chunks.append(inputs[i].shape.num_elements() // n_chunks) chunk_offsets.append(chunk_offsets[i] + chunks[i]) for i in range(n_chunks): for j in range(len(inputs)): memcpy( parameters.tensors[outputs[0]].data() + i * chunk_offsets[len(inputs)] + chunk_offsets[j], parameters.tensors[inputs[j]].data() + i * chunks[j], chunks[j], ) @staticmethod fn backward[input_id: Int, attributes: AttributeVector]( inputs: List[Symbol], outputs: List[Symbol], inout parameters: Parameters, ) -> Tensor[dtype]: alias dim = attributes["dim"].value().to_int() if attributes["dim"] else 0 var n_chunks = Self.calc_chunks(inputs[0].shape, dim) var chunks = List[Int]() var chunk_offsets = List[Int](0) for i in range(len(inputs)): chunks.append(inputs[i].shape.num_elements() // n_chunks) chunk_offsets.append(chunk_offsets[i] + chunks[i]) var res_grad = Tensor[dtype](inputs[input_id].shape) for i in range(n_chunks): memcpy( res_grad.data() + i * chunks[input_id], parameters.grads[outputs[0]].data() + i * chunk_offsets[len(inputs)] + chunk_offsets[input_id], chunks[input_id], ) return res_grad ^ struct SPLIT: @staticmethod fn result_shape( input_shapes: List[TensorShape], attributes: AttributeVector ) -> List[TensorShape]: # Assuming the sum of the sections is equal to the total size in the dim dimension. # E.g. sections = [5, 5, 2] -> shape (., 12, ., .) for dim = 1 var dim = attributes["dim"].value().to_int() if attributes["dim"] else 0 var sections = attributes["sections"].value().to_shape() var res_shapes = List[TensorShape]() for i in range(sections.rank()): var new_shape = input_shapes[0] new_shape[dim] = sections[i] res_shapes.append(new_shape) return res_shapes @staticmethod fn calc_chunks(shape: TensorShape, dim: Int) -> Int: # Number of chunks up to the concatenating dimension # Assuming tensor of equal shape, except for the concatenating dimension var chunks = 1 for i in range(dim): chunks *= shape[i] return chunks @staticmethod fn forward[attributes: AttributeVector]( inputs: List[Symbol], outputs: List[Symbol], inout parameters: Parameters, ): alias dim = attributes["dim"].value().to_int() if attributes["dim"] else 0 alias sections = attributes["sections"].value().to_shape() var n_chunks = Self.calc_chunks(inputs[0].shape, dim) var chunks = List[Int]() var chunk_offsets = List[Int](0) for i in range(len(outputs)): chunks.append(outputs[i].shape.num_elements() // n_chunks) chunk_offsets.append(chunk_offsets[i] + chunks[i]) for i in range(n_chunks): for j in range(len(outputs)): memcpy( parameters.tensors[outputs[j]].data() + i * chunks[j], parameters.tensors[inputs[0]].data() + i * chunk_offsets[len(outputs)] + chunk_offsets[j], chunks[j], ) @staticmethod fn backward[input_id: Int, attributes: AttributeVector]( inputs: List[Symbol], outputs: List[Symbol], inout parameters: Parameters, ) -> Tensor[dtype]: alias dim = attributes["dim"].value().to_int() if attributes["dim"] else 0 alias sections = attributes["sections"].value().to_shape() var n_chunks = Self.calc_chunks(inputs[0].shape, dim) var chunks = List[Int]() var chunk_offsets = List[Int](0) for i in range(len(outputs)): chunks.append(outputs[i].shape.num_elements() // n_chunks) chunk_offsets.append(chunk_offsets[i] + chunks[i]) var res_grad = Tensor[dtype](inputs[input_id].shape) for i in range(n_chunks): for j in range(len(outputs)): memcpy( res_grad.data() + i * chunk_offsets[len(outputs)] + chunk_offsets[j], parameters.grads[outputs[j]].data() + i * chunks[j], chunks[j], ) return res_grad ^ --- basalt/autograd/ops/matmul.mojo --- from basalt.utils.tensorutils import transpose_2D from algorithm import vectorize, parallelize @always_inline fn calculate_block[ M: Int, N: Int, K: Int, BLOCK_M: Int, BLOCK_N: Int, nelts: Int ]( res: DTypePointer[dtype], t1: DTypePointer[dtype], t2: DTypePointer[dtype], bm: Int, bn: Int, ): # Compute tile var acc = stack_allocation[BLOCK_M * BLOCK_N, dtype]() memset_zero[dtype](acc, BLOCK_M * BLOCK_N) for k in range(K): @parameter for m in range(BLOCK_M): @parameter fn inner_n[nelts: Int](n: Int): acc.store[width=nelts]( m * BLOCK_N + n, SIMD[dtype, nelts] .splat(t1[(bm + m) * K + k]) .fma( t2.load[width=nelts](k * N + (bn + n)), acc.load[width=nelts](m * BLOCK_N + n), ), ) vectorize[inner_n, nelts](BLOCK_N) # Store tile for m in range(BLOCK_M): @parameter fn vec_store[nelts: Int](n: Int): res.store[width=nelts]( (bm + m) * N + (bn + n), acc.load[width=nelts](m * BLOCK_N + n) ) vectorize[vec_store, nelts](BLOCK_N) @parameter @always_inline fn dot[ t1_shape: TensorShape, t2_shape: TensorShape ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): dot[t1_shape, t2_shape](res.data(), t1.data(), t2.data()) @parameter @always_inline fn dot[ t1_shape: TensorShape, t2_shape: TensorShape ](res: DTypePointer[dtype], t1: DTypePointer[dtype], t2: DTypePointer[dtype]): alias M = t1_shape[0] # t1[0] alias K = t1_shape[1] # t1[1], t2[0] alias N = t2_shape[1] # t2[1] # simdwidthof[dtype]() = 8 for float32 alias nelts = simdwidthof[dtype]() alias BLOCK_N = 8 * 2 alias BLOCK_M = 6 alias THREADS = 6 # num_logical_cores() alias BLOCK_N_REMAINDER = N % BLOCK_N alias BLOCK_M_REMAINDER = M % BLOCK_M @parameter fn bm_par(m_outer: Int): var bm = m_outer * BLOCK_M for n_outer in range(0, N // BLOCK_N): var bn = n_outer * BLOCK_N calculate_block[M, N, K, BLOCK_M, BLOCK_N, nelts](res, t1, t2, bm, bn) # Handle the remainder of N @parameter if BLOCK_N_REMAINDER > 0: var bn = N - BLOCK_N_REMAINDER calculate_block[M, N, K, BLOCK_M, BLOCK_N_REMAINDER, nelts]( res, t1, t2, bm, bn ) parallelize[bm_par](M // BLOCK_M, M // BLOCK_M) # Handle the remainder of M @parameter if BLOCK_M_REMAINDER > 0: var bm = M - BLOCK_M_REMAINDER for n_outer in range(0, N // BLOCK_N): var bn = n_outer * BLOCK_N calculate_block[M, N, K, BLOCK_M_REMAINDER, BLOCK_N, nelts]( res, t1, t2, bm, bn ) # Handle corner remainder @parameter if BLOCK_N_REMAINDER > 0: var bn = N - BLOCK_N_REMAINDER calculate_block[M, N, K, BLOCK_M_REMAINDER, BLOCK_N_REMAINDER, nelts]( res, t1, t2, bm, bn ) fn dot_transpose_t2[ A_shape: TensorShape, B_shape: TensorShape ](inout C: DTypePointer[dtype], A: DTypePointer[dtype], B: DTypePointer[dtype]): dot[A_shape, TensorShape(B_shape[1], B_shape[0])](C, A, transpose_2D[B_shape](B)) fn dot_transpose_t2[ A_shape: TensorShape, B_shape: TensorShape ](inout C: Tensor[dtype], A: Tensor[dtype], B: Tensor[dtype]): memset_zero[dtype](C.data(), C.num_elements()) dot[A_shape, TensorShape(B_shape[1], B_shape[0])](C, A, transpose_2D[B_shape](B)) # @parameter # fn calc_row(i: Int): # for j in range(B_shape[0]): # @parameter # fn calc_row_A_B[nelts: Int](k: Int): # var A_pos = i * A.dim(1) + k # var B_pos = j * A.dim(1) + k # var t_new_pos = i * C.dim(1) + j # C[t_new_pos] += ( # A.load[nelts](A_pos) * B.load[nelts](B_pos) # ).reduce_add() # vectorize[calc_row_A_B, nelts, size=A_shape[1]]() # parallelize[calc_row](A_shape[0], 1) fn dot_transpose_t1[ A_shape: TensorShape, B_shape: TensorShape ](inout C: Tensor[dtype], A: Tensor[dtype], B: Tensor[dtype]): memset_zero[dtype](C.data(), C.num_elements()) dot[TensorShape(A_shape[1], A_shape[0]), B_shape](C, transpose_2D[A_shape](A), B) # @parameter # fn calc_row(i: Int): # for j in range(A_shape[0]): # @parameter # fn calc_row_t_new_B[nelts: Int](k: Int): # var A_pos = j * A.dim(1) + i # var B_pos = j * B.dim(1) + k # var t_new_pos = i * C.dim(1) + k # C.store[nelts]( # t_new_pos, # C.load[nelts](t_new_pos) # + A[A_pos] * B.load[nelts](B_pos), # ) # vectorize[calc_row_t_new_B, nelts, size=B_shape[1]]() # parallelize[calc_row](A_shape[1], 1) --- basalt/autograd/ops/mlops.mojo --- from algorithm import vectorize, parallelize from math import exp from utils.numerics import min_finite, max_finite from basalt import Tensor, TensorShape from basalt.utils.tensorutils import elwise_transform from basalt.autograd.attributes import Attribute, AttributeVector @value struct SIGMOID: @staticmethod fn result_shape(t1_shape: TensorShape) -> TensorShape: return t1_shape @staticmethod @always_inline fn sigmoid[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]: return 1 / (1 + exp(-x)) @staticmethod @always_inline fn sidmoid_bw[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]: return Self.sigmoid(x) * (1 - Self.sigmoid(x)) @staticmethod fn forward[ t1_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype]): """Forward operation of sigmoid.""" elwise_transform[Self.sigmoid](res, t1) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of sigmoid.""" # d(sigmod(x))/dx = sigmoid(x) * (1 - sigmoid(x)) var res_grad = Tensor[dtype](ug_shape) @parameter fn vec_sigmoid_bw[nelts: Int](idx: Int): res_grad.store[nelts]( idx, Self.sidmoid_bw(t1.load[nelts](idx)) * ug.load[nelts](idx), ) vectorize[vec_sigmoid_bw, nelts](ug_shape.num_elements()) return res_grad^ struct RELU: @staticmethod fn result_shape(t1_shape: TensorShape) -> TensorShape: return t1_shape @staticmethod @always_inline fn relu[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]: # x if x > 0 else 0 return (x > 0).select(x, 0) @staticmethod @always_inline fn relu_bw[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]: # 1 if x > 0 else 0 return (x > 0).select[type](1, 0) @staticmethod fn forward[ t1_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype]): """Forward operation of relu.""" elwise_transform[Self.relu](res, t1) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of relu.""" # d(relu(x))/dx = 1 if x > 0 else 0. We also give 0 to x = 0 instead of undefined. var res_grad = Tensor[dtype](ug_shape) @parameter fn vec_relu_bw[nelts: Int](idx: Int): res_grad.store[nelts]( idx, Self.relu_bw(t1.load[nelts](idx)) * ug.load[nelts](idx) ) vectorize[vec_relu_bw, nelts](ug_shape.num_elements()) return res_grad^ struct LEAKYRELU: @staticmethod fn result_shape(t1_shape: TensorShape) -> TensorShape: return t1_shape @staticmethod fn forward[ t1_shape: TensorShape, attributes: AttributeVector, ](inout res: Tensor[dtype], t1: Tensor[dtype]): """Forward operation of leaky_relu.""" fn leaky_relu[ type: DType, simd_width: Int, ](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]: var negative_slope = attributes["negative_slope"].value().to_scalar[ type ]() return (x > 0).select(x, x * negative_slope) elwise_transform[leaky_relu](res, t1) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, attributes: AttributeVector, ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of leaky_relu.""" @always_inline fn leaky_relu_bw[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]: var negative_slope = attributes["negative_slope"].value().to_scalar[ type ]() return (x > 0).select[type](1, negative_slope) var res_grad = Tensor[dtype](ug_shape) @parameter fn vec_leaky_relu_bw[nelts: Int](idx: Int): res_grad.store[nelts]( idx, leaky_relu_bw(t1.load[nelts](idx)) * ug.load[nelts](idx), ) vectorize[vec_leaky_relu_bw, nelts](ug_shape.num_elements()) return res_grad^ struct TANH: @staticmethod fn result_shape(t1_shape: TensorShape) -> TensorShape: return t1_shape @staticmethod @always_inline fn tanh[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]: return (exp(x) - exp(-x)) / (exp(x) + exp(-x)) @staticmethod @always_inline fn tanh_bw[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]: return 1 - pow(Self.tanh(x), 2) @staticmethod fn forward[ t1_shape: TensorShape, ](inout res: Tensor[dtype], t1: Tensor[dtype]): """Forward operation of tanh.""" elwise_transform[Self.tanh](res, t1) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of tanh.""" # d(tanh(x))/dx = 1 - tanh(x) ** 2 var res_grad = Tensor[dtype](ug_shape) @parameter fn vec_tanh_bw[nelts: Int](idx: Int): res_grad.store[nelts]( idx, Self.tanh_bw(t1.load[nelts](idx)) * ug.load[nelts](idx) ) vectorize[vec_tanh_bw, nelts](ug_shape.num_elements()) return res_grad^ struct CLIP: @staticmethod fn result_shape(t_shape: TensorShape) -> TensorShape: return t_shape @staticmethod fn forward[ t_shape: TensorShape, attributes: AttributeVector ](inout res: Tensor[dtype], t: Tensor[dtype]): """ Forward pass of the clip operation. """ alias min_attr = attributes["min"] alias max_attr = attributes["max"] var min_val = min_attr.value().to_scalar[ dtype ]() if min_attr else min_finite[dtype]() var max_val = max_attr.value().to_scalar[ dtype ]() if max_attr else max_finite[dtype]() @parameter fn vec_clip[nelts: Int](i: Int): res.store[nelts](i, t.load[nelts](i).min(max_val).max(min_val)) vectorize[vec_clip, nelts, size = t_shape.num_elements()]() @staticmethod fn backward[ ug_shape: TensorShape, t_shape: TensorShape, attributes: AttributeVector = AttributeVector(), ](ug: Tensor[dtype], t: Tensor[dtype]) -> Tensor[dtype]: """Backward operation of clip.""" alias min_attr = attributes["min"] alias max_attr = attributes["max"] var min_val = min_attr.value().to_scalar[ dtype ]() if min_attr else min_finite[dtype]() var max_val = max_attr.value().to_scalar[ dtype ]() if max_attr else max_finite[dtype]() var res_grad = Tensor[dtype](t_shape) @parameter fn vec_clip_bw[nelts: Int](i: Int): var val = t.load[nelts](i) res_grad.store[nelts]( i, ((val >= min_val) * (val <= max_val)).select( ug.load[nelts](i), 0 ), ) vectorize[vec_clip_bw, nelts, size = t_shape.num_elements()]() return res_grad^ struct SQUEEZE: @staticmethod fn result_shape( t1_shape: TensorShape, attributes: AttributeVector ) -> TensorShape: var dim = attributes["dims"] var dims_to_squeeze = dim.value().to_shape() if dim else TensorShape() var new_shape = List[Int]() for i in range(t1_shape.rank()): if (not dim and t1_shape[i] == 1) or ( i in dims_to_squeeze and t1_shape[i] == 1 ): continue new_shape.append(t1_shape[i]) return TensorShape(new_shape) @staticmethod fn forward[ t1_shape: TensorShape, attributes: AttributeVector, ](inout res: Tensor[dtype], t1: Tensor[dtype]): memcpy(res.data(), t1.data(), t1.num_elements()) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: var res_grad = Tensor[dtype](t1_shape) memcpy(res_grad.data(), ug.data(), ug.num_elements()) return res_grad^ struct UNSQUEEZE: @staticmethod fn result_shape( t1_shape: TensorShape, attributes: AttributeVector ) -> TensorShape: var dim = attributes["dims"] var dims_to_squeeze = dim.value().to_shape() if dim else TensorShape() # Position in the expanded dims where the new dim (or dims) is placed. var new_rank = t1_shape.rank() + dims_to_squeeze.rank() var new_shape = List[Int]() var j = 0 for i in range(new_rank): if i in dims_to_squeeze or i - new_rank in dims_to_squeeze: new_shape.append(1) else: new_shape.append(t1_shape[j]) j += 1 return TensorShape(new_shape) @staticmethod fn forward[ t1_shape: TensorShape, attributes: AttributeVector, ](inout res: Tensor[dtype], t1: Tensor[dtype]): memcpy(res.data(), t1.data(), t1.num_elements()) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: var res_grad = Tensor[dtype](t1_shape) memcpy(res_grad.data(), ug.data(), ug.num_elements()) return res_grad^ struct SLICE: @staticmethod fn adjust_boundary(slice: Int, dim_size: Int) -> Int: # Adjust negative indices & ensure they are within bounds. var s = slice if slice >= 0 else dim_size + slice return max(min(s, dim_size), 0) @staticmethod fn default_starts(shape: TensorShape) -> List[Int]: var starts = List[Int]() for i in range(shape.rank()): starts.append(0) return starts^ @staticmethod fn default_ends(shape: TensorShape) -> List[Int]: var ends = List[Int]() for i in range(shape.rank()): ends.append(shape[i]) return ends^ @staticmethod fn default_steps(shape: TensorShape) -> List[Int]: var steps = List[Int]() for i in range(shape.rank()): steps.append(1) return steps^ @staticmethod fn default_axes(shape: TensorShape) -> List[Int]: # NOTE: axes can't be negative var axes = List[Int]() for i in range(shape.rank()): axes.append(i) return axes^ @staticmethod fn result_shape( t1_shape: TensorShape, attributes: AttributeVector ) -> TensorShape: # NOTE: Starts and ends have to be of the same size # NOTE: If axes not provided, starts and ends have to be of the same size as t1_shape var starts = attributes["starts"].value().to_shape() var ends = attributes["ends"].value().to_shape() var steps = attributes["steps"].value().to_shape() if attributes[ "steps" ] else Self.default_steps(starts) var axes = attributes["axes"].value().to_shape() if attributes[ "axes" ] else Self.default_axes(t1_shape) var new_shape = t1_shape for i in range(starts.rank()): var axis = axes[i] new_shape[axis] = len( range( start=Self.adjust_boundary(starts[i], t1_shape[axis]), end=Self.adjust_boundary(ends[i], t1_shape[axis]), step=steps[i], ) ) return new_shape @staticmethod fn reorder_positions[ id: Int ](original: TensorShape, axes: TensorShape, t1_shape: TensorShape) -> List[ Int ]: # Reorder the starts (id=0), ends (id=1) or steps (id=2) to match the order of the axes var updated: List[Int] @parameter if id == 0: updated = Self.default_starts(t1_shape) elif id == 1: updated = Self.default_ends(t1_shape) else: updated = Self.default_steps(t1_shape) for i in range(axes.rank()): var axis = axes[i] updated[axis] = original[i] if id == 2 else Self.adjust_boundary( original[i], t1_shape[axis] ) return updated^ # NOTE: For now you can't have recursive function as parameter functions. # NOTE: From testing it seems a recursive function is almost the same speed as doing multiple nested for loops. @staticmethod fn recursive_iters_slice[ shape: TensorShape, original_shape: TensorShape, steps: List[Int], starts: List[Int], ends: List[Int], backward_op: Bool = False, ]( inout res: Tensor[dtype], t1: Tensor[dtype], last_dims: Int, position: Int, last_position: Int, idx: Int, idx_original: Int, ): alias strides = shape.strides() alias t1_strides = original_shape.strides() var idx_temp = idx var idx_original_temp = starts[position] * t1_strides[ position ] + idx_original if position == last_position + 1: # Work on the last dimensions alias position = shape.rank() - 1 alias stride = t1_strides[position] * steps[position] @parameter fn v_slice[nelts: Int](k: Int): @parameter if not backward_op: @parameter if steps[position] == 1: res.store[nelts]( idx_temp + k, t1.load[nelts](idx_original_temp) ) else: res.store[nelts]( idx_temp + k, t1.data() .offset(idx_original_temp) .simd_strided_load[nelts](stride), ) else: @parameter if steps[position] == 1: res.store[nelts](idx_original_temp, t1.load[nelts](idx_temp + k)) else: res.data().offset(idx_original_temp).simd_strided_store[width=nelts]( t1.load[nelts](idx_temp + k), stride ) idx_original_temp += stride * nelts vectorize[v_slice, nelts](last_dims) return for _ in range(shape[position]): Self.recursive_iters_slice[ shape, original_shape, steps, starts, ends, backward_op ]( res, t1, last_dims, position + 1, last_position, idx_temp, idx_original_temp, ) idx_temp += strides[position] idx_original_temp += steps[position] * t1_strides[position] @staticmethod fn slice_kernel[ res_shape: TensorShape, original_shape: TensorShape, steps: List[Int], starts: List[Int], ends: List[Int], backward_op: Bool = False, ](inout res: Tensor[dtype], t1: Tensor[dtype]): alias strides = original_shape.strides() # Get the dimensions for vectorization var last_dims = 1 var positions_to_skip = 0 for i in range(res_shape.rank() - 1, -1, -1): if steps[i] != 1 and i != res_shape.rank() - 1: break last_dims *= res_shape[i] positions_to_skip += 1 if starts[i] != 0 or ends[i] != original_shape[i] or steps[i] != 1: break # Get the dimensions for the first loop var first_dims = 1 var start_position = 0 for i in range(res_shape.rank() - positions_to_skip): if steps[i] != 1 or starts[i] != 0 or ends[i] != original_shape[i]: break first_dims *= res_shape[i] start_position += 1 var middle_dims = res_shape.num_elements() // last_dims // first_dims @parameter fn p_slice(i: Int): Self.recursive_iters_slice[ res_shape, original_shape, steps, starts, ends, backward_op ]( res, t1, last_dims, start_position, res_shape.rank() - 1 - positions_to_skip, i * middle_dims * last_dims, i * strides[start_position - 1], ) parallelize[p_slice](first_dims) @staticmethod fn forward[ t1_shape: TensorShape, attributes: AttributeVector, ](inout res: Tensor[dtype], t1: Tensor[dtype]): alias axes = attributes["axes"].value().to_shape() if attributes[ "axes" ] else Self.default_axes(t1_shape) alias starts = Self.reorder_positions[0]( attributes["starts"].value().to_shape(), axes, t1_shape ) alias ends = Self.reorder_positions[1]( attributes["ends"].value().to_shape(), axes, t1_shape ) alias steps = Self.reorder_positions[2]( attributes["steps"].value().to_shape(), axes, t1_shape ) if attributes["steps"] else Self.default_steps(t1_shape) alias res_shape = Self.result_shape(t1_shape, attributes) Self.slice_kernel[res_shape, t1_shape, steps, starts, ends, False]( res, t1 ) @staticmethod fn backward[ ug_shape: TensorShape, t1_shape: TensorShape, attributes: AttributeVector = AttributeVector(), ](ug: Tensor[dtype], t1: Tensor[dtype]) -> Tensor[dtype]: alias axes = attributes["axes"].value().to_shape() if attributes[ "axes" ] else Self.default_axes(t1_shape) alias starts = Self.reorder_positions[0]( attributes["starts"].value().to_shape(), axes, t1_shape ) alias ends = Self.reorder_positions[1]( attributes["ends"].value().to_shape(), axes, t1_shape ) alias steps = Self.reorder_positions[2]( attributes["steps"].value().to_shape(), axes, t1_shape ) if attributes["steps"] else Self.default_steps(t1_shape) var res_grad = Tensor[dtype](t1_shape) Self.slice_kernel[ug_shape, t1_shape, steps, starts, ends, True]( res_grad, ug ) return res_grad^ --- basalt/autograd/ops/ops.mojo --- from .basics import ( ADD, SUB, MUL, DIV, EXP, LOG, POW, DOT, SUM, MEAN, MAX, FLATTEN, RESHAPE, TRANSPOSE, FMA, ) from .mlops import ( SIGMOID, RELU, LEAKYRELU, TANH, CLIP, SQUEEZE, UNSQUEEZE, SLICE, ) from .dynamics import CONCAT, SPLIT from .conv import CONV2D from .pool import MAXPOOL2D from basalt import Tensor, TensorShape from basalt.nn.model import Parameters from basalt.utils.bytes import Bytes from basalt.utils.tensorutils import broadcast_shapes, accumulate_grad from ..attributes import AttributeVector # Define operators as named parameter expression @value @register_passable("trivial") struct OP(Stringable): """ Compile time Operators list. """ alias ADD = OP(0, "ADD") alias SUB = OP(1, "SUB") alias MUL = OP(2, "MUL") alias DIV = OP(3, "DIV") alias EXP = OP(4, "EXP") alias LOG = OP(5, "LOG") alias POW = OP(6, "POW") alias DOT = OP(7, "DOT") alias SUM = OP(8, "SUM") alias MEAN = OP(9, "MEAN") alias MAX = OP(10, "MAX") alias FLATTEN = OP(11, "FLATTEN") alias RESHAPE = OP(12, "RESHAPE") alias SIGMOID = OP(13, "SIGMOID") alias RELU = OP(14, "RELU") alias TANH = OP(15, "TANH") alias CONV2D = OP(16, "CONV2D") alias TRANSPOSE = OP(17, "TRANSPOSE") alias MAXPOOL2D = OP(18, "MAXPOOL2D") alias FMA = OP(19, "FMA") alias CLIP = OP(20, "CLIP") alias SQUEEZE = OP(21, "SQUEEZE") alias UNSQUEEZE = OP(22, "UNSQUEEZE") alias CONCAT = OP(23, "CONCAT", dynamic=True) alias SPLIT = OP(24, "SPLIT", dynamic=True) alias SLICE = OP(25, "SLICE") alias LEAKYRELU = OP(28, "LEAKYRELU") var id: UInt8 var name: Bytes[16] var dynamic: Bool fn __init__(inout self, id: UInt8, name: String, dynamic: Bool = False): self.id = id self.name = Bytes[16](name) self.dynamic = dynamic fn __eq__(self, other: OP) -> Bool: return self.id == other.id fn __str__(self) -> String: return str(self.name) fn static_result_shape( op: OP, operands: VariadicList[Symbol], attributes: AttributeVector ) -> TensorShape: """ Static result shape for operators. """ if len(operands) == 1: return static_result_shape(op, operands[0].shape, attributes) elif len(operands) == 2: return static_result_shape( op, operands[0].shape, operands[1].shape, attributes ) elif len(operands) == 3: return static_result_shape( op, operands[0].shape, operands[1].shape, operands[2].shape, attributes, ) else: print("Error: Invalid number of operands") return TensorShape() fn static_result_shape( op: OP, t1_shape: TensorShape, attributes: AttributeVector ) -> TensorShape: """ Static result shape for unary operators. """ if op == OP.EXP: return EXP.result_shape(t1_shape) elif op == OP.LOG: return LOG.result_shape(t1_shape) elif op == OP.SUM: return SUM.result_shape(t1_shape, attributes) elif op == OP.MEAN: return MEAN.result_shape(t1_shape, attributes) elif op == OP.MAX: return MAX.result_shape(t1_shape, attributes) elif op == OP.FLATTEN: return FLATTEN.result_shape(t1_shape) elif op == OP.RESHAPE: return RESHAPE.result_shape(t1_shape, attributes) elif op == OP.SIGMOID: return SIGMOID.result_shape(t1_shape) elif op == OP.RELU: return RELU.result_shape(t1_shape) elif op == OP.LEAKYRELU: return LEAKYRELU.result_shape(t1_shape) elif op == OP.TANH: return TANH.result_shape(t1_shape) elif op == OP.TRANSPOSE: return TRANSPOSE.result_shape(t1_shape, attributes) elif op == OP.MAXPOOL2D: return MAXPOOL2D.result_shape(t1_shape, attributes) elif op == OP.CLIP: return CLIP.result_shape(t1_shape) elif op == OP.SQUEEZE: return SQUEEZE.result_shape(t1_shape, attributes) elif op == OP.UNSQUEEZE: return UNSQUEEZE.result_shape(t1_shape, attributes) elif op == OP.SLICE: return SLICE.result_shape(t1_shape, attributes) else: print("[ERROR] Operator not found.") return TensorShape(-1) fn static_result_shape( op: OP, t1_shape: TensorShape, t2_shape: TensorShape, attributes: AttributeVector, ) -> TensorShape: """ Static result shape for binary operators. """ if op == OP.ADD: return ADD.result_shape(t1_shape, t2_shape) elif op == OP.SUB: return SUB.result_shape(t1_shape, t2_shape) elif op == OP.MUL: return MUL.result_shape(t1_shape, t2_shape) elif op == OP.DIV: return DIV.result_shape(t1_shape, t2_shape) elif op == OP.POW: return POW.result_shape(t1_shape, t2_shape) elif op == OP.DOT: return DOT.result_shape(t1_shape, t2_shape) else: # We can't print at compile time (at least for now it crashes at comp time with an error) print("[ERROR] Operator not found.") return TensorShape(-1, -1) fn static_result_shape( op: OP, t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape, attributes: AttributeVector, ) -> TensorShape: """ Static result shape for ternary operators. """ if op == OP.CONV2D: return CONV2D.result_shape(t1_shape, t2_shape, t3_shape, attributes) elif op == OP.FMA: return FMA.result_shape(t1_shape, t2_shape, t3_shape) else: print("[ERROR] Operator not found.") return TensorShape(-1, -1) fn dynamic_result_shape( op: OP, operands: VariadicList[Symbol], attributes: AttributeVector, ) -> List[TensorShape]: """ Static result shape for dynamic operators. """ # Unknown number of inputs and outputs. var input_shapes = List[TensorShape]() for operand in operands: input_shapes.append(operand.shape) if op == OP.CONCAT: return CONCAT.result_shape(input_shapes, attributes) elif op == OP.SPLIT: return SPLIT.result_shape(input_shapes, attributes) else: print("[ERROR] Operator not found.") return List[TensorShape](TensorShape(-1)) fn forward_op[ op: OP, t1_shape: TensorShape, attributes: AttributeVector ](inout res: Tensor[dtype], t1: Tensor[dtype]): """ Forward pass for unary operators. """ @parameter if op == OP.EXP: EXP.forward[t1_shape](res, t1) elif op == OP.LOG: LOG.forward[t1_shape](res, t1) elif op == OP.SUM: SUM.forward[t1_shape, attributes](res, t1) elif op == OP.MEAN: MEAN.forward[t1_shape, attributes](res, t1) elif op == OP.MAX: MAX.forward[t1_shape, attributes](res, t1) elif op == OP.FLATTEN: FLATTEN.forward[t1_shape](res, t1) elif op == OP.RESHAPE: RESHAPE.forward[t1_shape](res, t1) elif op == OP.SIGMOID: SIGMOID.forward[t1_shape](res, t1) elif op == OP.RELU: RELU.forward[t1_shape](res, t1) elif op == OP.LEAKYRELU: LEAKYRELU.forward[t1_shape, attributes](res, t1) elif op == OP.TANH: TANH.forward[t1_shape](res, t1) elif op == OP.TRANSPOSE: TRANSPOSE.forward[t1_shape, attributes](res, t1) elif op == OP.MAXPOOL2D: MAXPOOL2D.forward[t1_shape, attributes](res, t1) elif op == OP.CLIP: CLIP.forward[t1_shape, attributes](res, t1) elif op == OP.SQUEEZE: SQUEEZE.forward[t1_shape, attributes](res, t1) elif op == OP.UNSQUEEZE: UNSQUEEZE.forward[t1_shape, attributes](res, t1) elif op == OP.SLICE: SLICE.forward[t1_shape, attributes](res, t1) else: print("[ERROR] Operator not found.") fn forward_op[ op: OP, t1_shape: TensorShape, t2_shape: TensorShape, attributes: AttributeVector, ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): """ Forward pass for binary operators. """ @parameter if op == OP.ADD: ADD.forward[t1_shape, t2_shape](res, t1, t2) elif op == OP.SUB: SUB.forward[t1_shape, t2_shape](res, t1, t2) elif op == OP.MUL: MUL.forward[t1_shape, t2_shape](res, t1, t2) elif op == OP.DIV: DIV.forward[t1_shape, t2_shape](res, t1, t2) elif op == OP.POW: POW.forward[t1_shape, t2_shape](res, t1, t2) elif op == OP.DOT: DOT.forward[t1_shape, t2_shape](res, t1, t2) else: print("[ERROR] Operator not found.") fn forward_op[ op: OP, t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape, attributes: AttributeVector, ]( inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype], t3: Tensor[dtype], ): """ Forward pass for ternary operators. """ @parameter if op == OP.CONV2D: CONV2D.forward[t1_shape, t2_shape, t3_shape, attributes]( res, t1, t2, t3 ) elif op == OP.FMA: FMA.forward[t1_shape, t2_shape, t3_shape](res, t1, t2, t3) else: print("[ERROR] Operator not found.") fn forward_op[ op: OP, attributes: AttributeVector, ]( inputs: List[Symbol], outputs: List[Symbol], inout parameters: Parameters, ): """ Forward pass for dynamic operators. """ if op == OP.CONCAT: CONCAT.forward[attributes](inputs, outputs, parameters) elif op == OP.SPLIT: SPLIT.forward[attributes](inputs, outputs, parameters) else: print("[ERROR] Operator not found.") fn backward_op[ tensor_id: Int, op: OP, ug_shape: TensorShape, t1_shape: TensorShape, attributes: AttributeVector, ](ug: Tensor[dtype], t1: Tensor[dtype], inout grad: Tensor[dtype]): """ Backward pass for unary operators. """ var res_grad: Tensor[dtype] @parameter if op == OP.EXP: res_grad = EXP.backward[ug_shape, t1_shape](ug, t1) elif op == OP.LOG: res_grad = LOG.backward[ug_shape, t1_shape](ug, t1) elif op == OP.SUM: res_grad = SUM.backward[ug_shape, t1_shape, attributes](ug, t1) elif op == OP.MEAN: res_grad = MEAN.backward[ug_shape, t1_shape, attributes](ug, t1) elif op == OP.MAX: res_grad = MAX.backward[ug_shape, t1_shape, attributes](ug, t1) elif op == OP.FLATTEN: res_grad = FLATTEN.backward[ug_shape, t1_shape](ug, t1) elif op == OP.RESHAPE: res_grad = RESHAPE.backward[ug_shape, t1_shape](ug, t1) elif op == OP.SIGMOID: res_grad = SIGMOID.backward[ug_shape, t1_shape](ug, t1) elif op == OP.RELU: res_grad = RELU.backward[ug_shape, t1_shape](ug, t1) elif op == OP.LEAKYRELU: res_grad = LEAKYRELU.backward[ug_shape, t1_shape, attributes](ug, t1) elif op == OP.TANH: res_grad = TANH.backward[ug_shape, t1_shape](ug, t1) elif op == OP.TRANSPOSE: res_grad = TRANSPOSE.backward[ug_shape, t1_shape, attributes](ug, t1) elif op == OP.MAXPOOL2D: res_grad = MAXPOOL2D.backward[ug_shape, t1_shape, attributes](ug, t1) elif op == OP.CLIP: res_grad = CLIP.backward[ug_shape, t1_shape, attributes](ug, t1) elif op == OP.SQUEEZE: res_grad = SQUEEZE.backward[ug_shape, t1_shape](ug, t1) elif op == OP.UNSQUEEZE: res_grad = UNSQUEEZE.backward[ug_shape, t1_shape](ug, t1) elif op == OP.SLICE: res_grad = SLICE.backward[ug_shape, t1_shape, attributes](ug, t1) else: print("[ERROR] Operator not found.") res_grad = Tensor[dtype](-1) accumulate_grad(grad, res_grad) fn backward_op[ tensor_id: Int, op: OP, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, attributes: AttributeVector, ]( ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype], inout grad: Tensor[dtype], ): """ Backward pass for binary operators. """ var res_grad: Tensor[dtype] @parameter if op == OP.ADD: res_grad = ADD.backward[tensor_id, ug_shape, t1_shape, t2_shape]( ug, t1, t2 ) elif op == OP.SUB: res_grad = SUB.backward[tensor_id, ug_shape, t1_shape, t2_shape]( ug, t1, t2 ) elif op == OP.MUL: res_grad = MUL.backward[tensor_id, ug_shape, t1_shape, t2_shape]( ug, t1, t2 ) elif op == OP.DIV: res_grad = DIV.backward[tensor_id, ug_shape, t1_shape, t2_shape]( ug, t1, t2 ) elif op == OP.POW: res_grad = POW.backward[tensor_id, ug_shape, t1_shape, t2_shape]( ug, t1, t2 ) elif op == OP.DOT: res_grad = DOT.backward[tensor_id, ug_shape, t1_shape, t2_shape]( ug, t1, t2 ) else: print("[ERROR] Operator not found.") res_grad = Tensor[dtype](-1, -1) fn broadcastable(op: OP) -> Bool: return op == OP.ADD or op == OP.SUB or op == OP.MUL or op == OP.DIV @parameter if broadcastable(op): accumulate_grad[ grad_shape = t1_shape if tensor_id == 0 else t2_shape, res_grad_shape = broadcast_shapes(t1_shape, t2_shape), ](grad, res_grad) else: accumulate_grad(grad, res_grad) fn backward_op[ tensor_id: Int, op: OP, ug_shape: TensorShape, t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape, attributes: AttributeVector, ]( ug: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype], t3: Tensor[dtype], inout grad: Tensor[dtype], ): """ Backward pass for ternary operators. """ var res_grad: Tensor[dtype] @parameter if op == OP.CONV2D: res_grad = CONV2D.backward[ tensor_id, ug_shape, t1_shape, t2_shape, t3_shape, attributes ](ug, t1, t2, t3) elif op == OP.FMA: res_grad = FMA.backward[ tensor_id, ug_shape, t1_shape, t2_shape, t3_shape ](ug, t1, t2, t3) else: print("[ERROR] Operator not found.") res_grad = Tensor[dtype](-1, -1) accumulate_grad(grad, res_grad) fn backward_op[ input_id: Int, op: OP, attributes: AttributeVector, ]( inputs: List[Symbol], outputs: List[Symbol], inout grad: Tensor[dtype], inout parameters: Parameters, ): """ Backward pass for dynamic operators. """ var res_grad: Tensor[dtype] if op == OP.CONCAT: res_grad = CONCAT.backward[input_id, attributes]( inputs, outputs, parameters ) elif op == OP.SPLIT: res_grad = SPLIT.backward[input_id, attributes]( inputs, outputs, parameters ) else: print("[ERROR] Operator not found.") res_grad = Tensor[dtype](-1, -1) accumulate_grad(grad, res_grad) --- basalt/autograd/ops/pool.mojo --- from utils.numerics import min_or_neg_inf from basalt import Tensor, TensorShape from basalt.autograd.attributes import AttributeVector from basalt.autograd.ops.conv import get_result_shape struct MAXPOOL2D: @staticmethod fn result_shape( input_shape: TensorShape, attributes: AttributeVector ) -> TensorShape: var kernel_size = attributes["kernel_size"].value().to_static[2]() var padding = attributes["padding"].value().to_static[2]() var stride = attributes["stride"].value().to_static[2]() var dilation = attributes["dilation"].value().to_static[2]() var res = get_result_shape( input_shape, TensorShape(kernel_size[0], kernel_size[1]), padding, stride, dilation, ) return TensorShape(input_shape[0], input_shape[1], res[0], res[1]) @staticmethod fn forward[ input_shape: TensorShape, attributes: AttributeVector ](inout outputs: Tensor[dtype], inputs: Tensor[dtype]): """ Returns the max value of each kernel in the input tensor. inputs.shape [batch_size, channels, iX, iY] with kernel_size = (kX, kY) outputs.shape [batch_size, channels, oX, oY]. """ alias kernel_size = attributes["kernel_size"].value().to_static[2]() alias padding = attributes["padding"].value().to_static[2]() alias stride = attributes["stride"].value().to_static[2]() alias dilation = attributes["dilation"].value().to_static[2]() alias inputs_strides = input_shape.strides() alias output_shape = Self.result_shape(input_shape, attributes) alias outputs_strides = output_shape.strides() for batch in range(input_shape[0]): for in_ch in range(input_shape[1]): for x in range(output_shape[2]): for y in range(output_shape[3]): var max_val: Scalar[dtype] = min_or_neg_inf[dtype]() var ix_base = x * stride[0] - padding[0] var iy_base = y * stride[1] - padding[1] for kx in range(kernel_size[0]): for ky in range(kernel_size[1]): var ix = ix_base + kx * dilation[0] var iy = iy_base + ky * dilation[1] if ( ix < 0 or iy < 0 or ix >= input_shape[2] or iy >= input_shape[3] ): continue var idx = ( batch * inputs_strides[0] + in_ch * inputs_strides[1] + ix * inputs_strides[2] + iy ) var val = inputs[idx] if val > max_val: max_val = val var out_idx = ( batch * outputs_strides[0] + in_ch * outputs_strides[1] + x * outputs_strides[2] + y ) outputs[out_idx] = max_val @staticmethod fn backward[ ug_shape: TensorShape, input_shape: TensorShape, attributes: AttributeVector ](ug: Tensor[dtype], inputs: Tensor[dtype]) -> Tensor[dtype]: """ Backward operation of MAXPOOL2D. Upper gradient of shape: [batch_size, channels, uX, uY] """ alias kernel_size = attributes["kernel_size"].value().to_static[2]() alias padding = attributes["padding"].value().to_static[2]() alias stride = attributes["stride"].value().to_static[2]() alias dilation = attributes["dilation"].value().to_static[2]() alias ug_strides = ug_shape.strides() alias inputs_strides = input_shape.strides() var res = Tensor[dtype](input_shape) for batch in range(input_shape[0]): for in_ch in range(input_shape[1]): for x in range(ug_shape[2]): for y in range(ug_shape[3]): var max_val: Scalar[dtype] = min_or_neg_inf[dtype]() var max_idx: Int = -1 var ix_base = x * stride[0] - padding[0] var iy_base = y * stride[1] - padding[1] for kx in range(kernel_size[0]): for ky in range(kernel_size[1]): var ix = ix_base + kx * dilation[0] var iy = iy_base + ky * dilation[1] if ( ix < 0 or iy < 0 or ix >= input_shape[2] or iy >= input_shape[3] ): continue var idx = ( batch * inputs_strides[0] + in_ch * inputs_strides[1] + ix * inputs_strides[2] + iy ) var val = inputs[idx] if val > max_val: max_val = val max_idx = idx var ug_idx = ( batch * ug_strides[0] + in_ch * ug_strides[1] + x * ug_strides[2] + y ) res[max_idx] += ug[ug_idx] return res --- basalt/autograd/params.mojo --- from collections.optional import Optional from basalt import dtype from basalt import Tensor, TensorShape from .symbol import Symbol from .attributes import Attribute @value struct Param(CollectionElement, Stringable): var data: Optional[List[Scalar[dtype]]] var initializer: Optional[Attribute] fn __init__(inout self): self.data = None self.initializer = None fn __init__(inout self, data: List[Scalar[dtype]]): self.data = data self.initializer = None fn __init__(inout self, data: Scalar[dtype]): self.data = List[Scalar[dtype]](data) self.initializer = None fn __init__(inout self, initializer: String, *args: Scalar[dtype]): # Supported initializers: # "random_uniform", lower_bound, upper_bound # "random_normal", mean, std # #TODO: "kaiming_uniform", mode, nonlinearity # #TODO: "kaiming_normal", mode, nonlinearity self.initializer = Attribute("initializer", initializer) var data = List[Scalar[dtype]]() for arg in args: data.append(arg) self.data = data fn __getitem__(self, i: Int) -> Optional[Scalar[dtype]]: if self.data: return self.data.value()[][i] else: return None fn __str__(self) -> String: var s: String = "" if self.data: var data = self.data.value() s += "[" for i in range(len(data[])): s += str(data[][i]) if i < len(data[]) - 1: s += ", " s += "]" return s @value struct ParamDict(Sized): var symbols: List[Symbol] var values: List[Param] fn __init__(inout self): self.symbols = List[Symbol]() self.values = List[Param]() fn put(inout self, param_id: Symbol, value: Param = Param()): self.symbols.append(param_id) self.values.append(value) fn get_tensor(self, idx: Int) -> Tensor[dtype]: # May only be called at runtime var num = self.symbols[idx].shape.num_elements() var t = DTypePointer[dtype].alloc(num) for i in range(num): t[i] = self.values[idx][i].value()[] return Tensor[dtype](t, self.symbols[idx].shape) fn __len__(self) -> Int: return len(self.symbols) --- basalt/autograd/symbol.mojo --- from basalt import Tensor, TensorShape @value @register_passable("trivial") struct Symbol(CollectionElement, Stringable, EqualityComparable): var name: UInt32 var dtype: DType var shape: TensorShape var trainable: Bool fn __eq__(self, other: Self) -> Bool: return self.name == other.name fn __ne__(self, other: Self) -> Bool: return self.name != other.name fn __str__(self) -> String: return self.json() fn json(self) -> String: return ( '{"name": "' + str(self.name) + '", "dtype": "' + str(self.dtype) + '", "shape": "' + str(self.shape) + '", "trainable": "' + str(self.trainable) + '"}' ) --- basalt/nn/__init__.mojo --- from .tensor import Tensor, TensorShape from .model import Model from .layers.linear import Linear from .layers.conv import Conv2d from .layers.pool import MaxPool2d from .loss import MSELoss, CrossEntropyLoss from .activations import ( Softmax, LogSoftmax, ReLU, LeakyReLU, Sigmoid, Tanh, ) --- basalt/nn/activations.mojo --- from basalt import Tensor, TensorShape from basalt import Graph, Symbol, OP from basalt.autograd.attributes import Attribute, AttributeVector # '''Activation functions.''' fn ReLU(inout g: Graph, input: Symbol) -> Symbol: return g.op(OP.RELU, input) fn LeakyReLU( inout g: Graph, input: Symbol, negative_slope: Scalar[dtype] ) -> Symbol: return g.op( OP.LEAKYRELU, input, attributes=AttributeVector(Attribute("negative_slope", negative_slope)), ) fn Sigmoid(inout g: Graph, input: Symbol) -> Symbol: return g.op(OP.SIGMOID, input) fn Tanh(inout g: Graph, input: Symbol) -> Symbol: return g.op(OP.TANH, input) fn Softmax(inout g: Graph, input: Symbol, axis: Int) -> Symbol: # softmax: exp(x_i) / sum(exp(x_j)) # stable softmax: exp(x_i - max(x_j)) / sum(exp(x_j - max(x_j))) var max_values = g.op( OP.MAX, input, attributes=AttributeVector(Attribute("axis", axis)) ) var input_minus_max = g.op(OP.SUB, input, max_values) var exp_values = g.op(OP.EXP, input_minus_max) var sum_values = g.op( OP.SUM, exp_values, attributes=AttributeVector(Attribute("axis", axis)) ) return g.op(OP.DIV, exp_values, sum_values) fn LogSoftmax(inout g: Graph, input: Symbol, axis: Int) -> Symbol: # stable logsoftmax: log(exp(x_i - max(x_j)) / sum(exp(x_j - max(x_j)))) # stable logsoftmax: x_i - max(x_j) - log(sum(exp(x_j - max(x_j)))) var max_values = g.op( OP.MAX, input, attributes=AttributeVector(Attribute("axis", axis)) ) var input_minus_max = g.op(OP.SUB, input, max_values) var exp_values = g.op(OP.EXP, input_minus_max) var sum_values = g.op( OP.SUM, exp_values, attributes=AttributeVector(Attribute("axis", axis)) ) var log_values = g.op(OP.LOG, sum_values) return g.op(OP.SUB, input_minus_max, log_values) --- basalt/nn/initializers.mojo --- from math import sqrt from basalt import dtype from basalt import Tensor, TensorShape from basalt.utils.rand_utils import rand_normal, rand_uniform fn initialize_tensor( shape: TensorShape, type: String, data: List[Scalar[dtype]] ) -> Tensor[dtype]: if type == "random_uniform": var low = data[0] var high = data[1] var t = Tensor[dtype](shape) rand_uniform(t, low=low, high=high) return t elif type == "random_normal": var mean = data[0].cast[DType.float64]() var std = data[1].cast[DType.float64]() var t = Tensor[dtype](shape) rand_normal(t, mean=mean, std=std) return t # elif type == "kaiming_uniform": # # mode, nonlinearity # var mode_id = data[0] # var mode = "fan_in" if mode_id == 0 else "fan_out" # return kaiming_uniform(shape, mode = mode) # elif type == "kaiming_normal": # # mode, nonlinearity # var mode_id = data[0] # var mode = "fan_in" if mode_id == 0 else "fan_out" # return kaiming_normal(shape, mode = mode) else: print("[ERROR] Unsupported initialization type: " + type) return Tensor[dtype]() fn calculate_fan(shape: TensorShape, mode: String) -> Scalar[dtype]: """ Calculate the fan-in and fan-out of any tensor. """ # NOTE: shape.rank() should be > 2 # mode: "fan_in" or "fan_out" if shape.rank() < 2: print( "[ERROR] Fan in and fan out can not be calculated for tensor with less than" " 2 dimensions" ) var num_input_fmaps = shape[1] var num_output_fmaps = shape[0] var receptive_field_size = 1 if shape.rank() > 2: for i in range(2, shape.rank()): receptive_field_size *= shape[i] var fan_in = num_input_fmaps * receptive_field_size var fan_out = num_output_fmaps * receptive_field_size if mode == "fan_in": return fan_in else: return fan_out # # TODO: https://pytorch.org/docs/stable/_modules/torch/nn/init.html # fn kaiming_uniform(shape: TensorShape, mode: String = "fan_in", nonlinearity: String = "leaky_relu") -> Tensor[dtype]: # var fan = calculate_fan(shape, mode) # # TODO: add support for other gains: https://github.com/pytorch/pytorch/blob/main/torch/nn/init.py#L68 # # Gain for linear and conv layers is 1 # var gain = 1 # var std = gain / sqrt(fan) # # var bound = sqrt(3) * std.cast[dtype]() # var bound = std.cast[dtype]() # # print("Shape", shape, "Fan", fan, "Bound", bound) # var t = Tensor[dtype](shape) # rand_uniform(t, low = -bound, high = bound) # return t^ # # TODO: https://pytorch.org/docs/stable/_modules/torch/nn/init.html # fn kaiming_normal(shape: TensorShape, mode: String = "fan_in", nonlinearity: String = "leaky_relu") -> Tensor[dtype]: # var fan = calculate_fan(shape, mode) # # TODO: add support for other gains: https://github.com/pytorch/pytorch/blob/main/torch/nn/init.py#L68 # # Gain for linear and conv layers is 1 # var gain = 1 # var std = gain / sqrt(fan) # var t = Tensor[dtype](shape) # rand_normal(t, mean = 0, std = std.cast[DType.float64]()) # return t^ --- basalt/nn/layers/__init__.mojo --- --- basalt/nn/layers/conv.mojo --- from basalt import Graph, Symbol, OP from basalt import Tensor, TensorShape from basalt.utils import q_sqrt from basalt.autograd.params import Param from basalt.autograd.attributes import AttributeVector, Attribute fn Conv2d( inout g: Graph, inputs: Symbol, out_channels: Int, kernel_size: StaticIntTuple[2], padding: StaticIntTuple[2] = 0, stride: StaticIntTuple[2] = 1, dilation: StaticIntTuple[2] = 1, ) -> Symbol: """ A 2D Convolution Layer. Parameters inputs.shape [batch, in_channels, iX, iY] kernel.shape [out_channels, in_channels, kX, kY] (or weights) bias.shape [out_channels]. output.shape [batch, out_channels, oX, oY]. """ var in_channels: Int = inputs.shape[1] var fan_in: Scalar[dtype] = in_channels * kernel_size[0] * kernel_size[1] var bound = q_sqrt(fan_in) var weights = g.param( TensorShape(out_channels, in_channels, kernel_size[0], kernel_size[1]), init=Param("random_uniform", -bound, bound) # init=Param("kaiming_uniform", 0) ) var bias = g.param( TensorShape(out_channels), init=Param("random_uniform", -bound, bound) ) return g.op( OP.CONV2D, inputs, weights, bias, attributes=AttributeVector( Attribute("padding", padding), Attribute("stride", stride), Attribute("dilation", dilation), ), ) --- basalt/nn/layers/dropout.mojo --- # TODO --- basalt/nn/layers/linear.mojo --- from basalt import Tensor, TensorShape from basalt import Graph, Symbol, OP from basalt.utils import q_sqrt from basalt.autograd.params import Param fn Linear( inout g: Graph, inputs: Symbol, n_outputs: Int, ) -> Symbol: """ A fully connected layer. """ var fan_in: Scalar[dtype] = inputs.shape[1] var bound = q_sqrt(fan_in) var weights = g.param( TensorShape(inputs.shape[1], n_outputs), init=Param("random_uniform", -bound, bound) # init=Param("random_uniform", 1) # NOTE: mode: fan_out required as weight are defined transposed ) var b = g.param(TensorShape(n_outputs), init=Param("random_uniform", -bound, bound)) var res = g.op(OP.DOT, inputs, weights) return g.op(OP.ADD, res, b) --- basalt/nn/layers/pool.mojo --- from basalt import Tensor, TensorShape from collections.optional import Optional from basalt import Graph, Symbol, OP from basalt.autograd.attributes import AttributeVector, Attribute fn set_static_stride( kernel_size: StaticIntTuple[2], stride: Optional[Int] = None ) -> StaticIntTuple[2]: if stride: return StaticIntTuple[2](stride.value()[], stride.value()[]) else: return kernel_size fn MaxPool2d( inout g: Graph, inputs: Symbol, kernel_size: StaticIntTuple[2], stride: Optional[Int] = None, padding: StaticIntTuple[2] = 0, dilation: StaticIntTuple[2] = 1, ) -> Symbol: """ A 2D Max Pooling Layer. Kernel is unaware of the in_channels and out_channels of the input tensor. kernel.size (kX, kY) """ # TODO: assert padding <= kernel_size / 2 (at compile time) var stride_temp = set_static_stride(kernel_size, stride) return MaxPool2d(g, inputs, kernel_size, stride_temp, padding, dilation) fn MaxPool2d( inout g: Graph, inputs: Symbol, kernel_size: StaticIntTuple[2], stride: StaticIntTuple[2], # stride should be 1 or more padding: StaticIntTuple[2] = 0, dilation: StaticIntTuple[2] = 1, ) -> Symbol: """ A 2D Max Pooling Layer. Kernel is unaware of the in_channels and out_channels of the input tensor. kernel.size (kX, kY) """ # TODO: assert padding <= kernel_size / 2 (at compile time) return g.op( OP.MAXPOOL2D, inputs, attributes=AttributeVector( Attribute("kernel_size", kernel_size), Attribute("padding", padding), Attribute("stride", stride), Attribute("dilation", dilation), ), ) # # TODO --- basalt/nn/layers/sequential.mojo --- # TODO --- basalt/nn/loss.mojo --- import basalt.nn as nn from basalt import Tensor, TensorShape from basalt import Graph, Symbol, OP fn MSELoss( inout g: Graph, y_pred: Symbol, y_true: Symbol, ) -> Symbol: # 1/N * sum( (outputs - targets)^2 ) var diff = g.op(OP.SUB, y_true, y_pred) var loss = g.op(OP.POW, diff, 2) var mean_loss = g.op(OP.MEAN, loss) return mean_loss fn CrossEntropyLoss( inout g: Graph, y_pred: Symbol, y_true: Symbol, ) -> Symbol: # -1/N * sum( targets * log_softmax(outputs) ) var log_softmax = nn.LogSoftmax(g, y_pred, axis=1) # CrossEntropy (reduction Mean) var targets_log_softmax = g.op(OP.MUL, y_true, log_softmax) var ret = g.op(OP.SUM, targets_log_softmax) var negDivN = g.op(OP.MUL, ret, -1.0 / y_pred.shape[0]) return negDivN --- basalt/nn/model.mojo --- from collections.optional import Optional, OptionalReg from pathlib import Path from sys import env_get_int from basalt import Graph, Symbol, Tensor, TensorShape from basalt.autograd.ops import forward_op, backward_op from basalt.utils.collection import Collection from basalt.utils.tensorutils import fill from .initializers import initialize_tensor from basalt.utils.perf_utils import PerfMetrics from basalt.utils.onnx_utils import load_onnx_model, export_onnx_model # When runing mojo -D DEBUG=1 -I . file, a crash happens at some point at runtime because of an error in linking it seems (because of using -I .) # For now it seems one has to change this variable manually to be able to run model with performance metrics. alias DEBUG = env_get_int["DEBUG", 0]() # TODO: remove when ability to concatenate graphs (modules) fn dv_contains(dv: List[Symbol], symbol: Symbol) -> Bool: for i in range(len(dv)): if dv[i] == symbol: return True return False # TODO: remove when ability to concatenate graphs (modules) fn n_inference_nodes(g: Graph) -> OptionalReg[Int]: """ Calculate the index of the node up to wich the forward pass should be executed for a model inference. When looping in revers: Equals the first index on which the node output is also a graph output. The number of inference nodes is that index + 1. """ for i in range(len(g.nodes) - 1, -1, -1): for j in range(len(g.nodes[i].outputs)): if dv_contains(g.outputs, g.nodes[i].outputs[j]): return i + 1 return None @value struct Parameters: var tensors: Collection var grads: Collection fn __init__(inout self): self.tensors = Collection() self.grads = Collection() struct Model[ g: Graph, n_inference_nodes: OptionalReg[Int] = n_inference_nodes(g), ](): var parameters: Parameters var perf_metrics: PerfMetrics fn __init__(inout self, inference_only: Bool = False): self.parameters = Parameters() @parameter if DEBUG == 1: self.perf_metrics = PerfMetrics(g) else: self.perf_metrics = PerfMetrics() self.allocate_tensor_memory() self.allocate_grad_memory() # TODO: remove this when ability to concatenate graphs (modules) # NOTE: inference_only only used for surpressing the warning. if not inference_only and not g.loss_out: print("\n\n[WARNING]: No loss defined, model.forward() unavailable!\n\n") if not n_inference_nodes: print( "\n\n[WARNING]: No graph out defined, model.inference()" " unavailable!\n\n" ) # TODO: remove when ability to concatenate graphs (modules) # Removes the need for splitting in forward and inference mode fn forward(inout self, *t_inputs: Tensor[dtype]) -> ref[__lifetime_of(self)] Tensor[dtype]: # NOTE: Important detail here is that the order of the inputs must be the same as the order the inputs were defined in the graph. # Example: If you were te define the y_true before the x when creating the graph # # var g = Graph() # var y_true = g.input(TensorShape(batch_size, n_outputs)) # var x = g.input(TensorShape(batch_size, n_inputs)) # # Then the order of the inputs in the forward call must be the same: # # model.forward(batch.labels, batch.inputs) # 1. Execute a full forward pass (model inference + loss) self.execute[g.nodes.size](t_inputs ^) # 2. Return loss from allocated output memory # TODO: known copy (reference?) return self.parameters.tensors[g.loss_out.value()] fn inference(inout self, *t_inputs: Tensor[dtype]) -> List[Tensor[dtype]]: # 1. Execute forward pass up to model out self.execute[n_inference_nodes.value()](t_inputs) # 2. Return outputs from allocated output memory # TODO: known copies (reference?) var outputs = List[Tensor[dtype]]() for i in range(len(g.outputs)): outputs.append(self.parameters.tensors[g.outputs[i]]) return outputs ^ fn execute[num_nodes: Int](inout self, t_input: VariadicListMem[Tensor[dtype]]): # 1. Write inputs to allocated input memory for i in range(len(g.inputs)): self.parameters.tensors[g.inputs[i]] = t_input[i] # 2. Loop over all nodes and execute forward operations @parameter for i in range(num_nodes): alias op = g.nodes[i].operator alias attrs = g.nodes[i].attributes # Save start time for performance metrics @parameter if DEBUG == 1: self.perf_metrics.start_forward_pass() @parameter if op.dynamic: forward_op[op, attrs]( g.nodes[i].inputs, g.nodes[i].outputs, self.parameters, ) else: # Statically known shapes and number of operands alias num_operands = len(g.nodes[i].inputs) alias t1 = g.nodes[i].inputs[0] alias out = g.nodes[i].outputs[0] @parameter if num_operands == 1: # Unary operator forward_op[op, t1.shape, attrs]( self.parameters.tensors[out], self.parameters.tensors[t1] ) elif num_operands == 2: # Binary operator alias t2 = g.nodes[i].inputs[1] forward_op[op, t1.shape, t2.shape, attrs]( self.parameters.tensors[out], self.parameters.tensors[t1], self.parameters.tensors[t2], ) elif num_operands == 3: # Ternary operator alias t2 = g.nodes[i].inputs[1] alias t3 = g.nodes[i].inputs[2] forward_op[op, t1.shape, t2.shape, t3.shape, attrs]( self.parameters.tensors[out], self.parameters.tensors[t1], self.parameters.tensors[t2], self.parameters.tensors[t3], ) # Save end time for performance metrics @parameter if DEBUG == 1: self.perf_metrics.end_forward_pass(i) fn backward(inout self, *upper_grads: Tensor[dtype]): """ Main entrypoint of backward pass. """ # 1. Initialize output gradient at the beginning of the backward pass if len(upper_grads) == 0: # TODO remove loss_out tag fill(self.parameters.grads[g.loss_out.value()], 1.0) else: var node_outputs = g.nodes[g.nodes.size - 1].outputs if len(upper_grads) != node_outputs.size: print( "[WARNING] Number of upper grads does not match number of node" " outputs!" ) for i in range(node_outputs.size): self.parameters.grads[node_outputs[i]] = upper_grads[i] # 2. Loop over all nodes in reverse order and execute backward operations @parameter for i in range(g.nodes.size): alias reverse_i = g.nodes.size - i - 1 alias op = g.nodes[reverse_i].operator alias attrs = g.nodes[reverse_i].attributes alias num_operands = len(g.nodes[reverse_i].inputs) # Save start time for performance metrics @parameter if DEBUG == 1: self.perf_metrics.start_backward_pass() @parameter if op.dynamic: @parameter for j in range(num_operands): @parameter if g.nodes[reverse_i].inputs[j].trainable: backward_op[j, op, attrs]( g.nodes[reverse_i].inputs, g.nodes[reverse_i].outputs, self.parameters.grads[g.nodes[reverse_i].inputs[j]], self.parameters, ) else: # Statically known shapes and number of operands alias out = g.nodes[reverse_i].outputs[0] # or upper_grad symbol alias t1 = g.nodes[reverse_i].inputs[0] @parameter if num_operands == 1: # Unary operator @parameter if t1.trainable: backward_op[0, op, out.shape, t1.shape, attrs]( self.parameters.grads[out], self.parameters.tensors[t1], self.parameters.grads[t1], # grad to be updated: inputs[0] ) elif num_operands == 2: # Binary operator alias t2 = g.nodes[reverse_i].inputs[1] @parameter if t1.trainable: backward_op[0, op, out.shape, t1.shape, t2.shape, attrs]( self.parameters.grads[out], self.parameters.tensors[t1], self.parameters.tensors[t2], self.parameters.grads[t1], # grad to be updated: inputs[0] ) @parameter if t2.trainable: backward_op[1, op, out.shape, t1.shape, t2.shape, attrs]( self.parameters.grads[out], self.parameters.tensors[t1], self.parameters.tensors[t2], self.parameters.grads[t2], # grad to be updated: inputs[1] ) elif num_operands == 3: # Ternary operator alias t2 = g.nodes[reverse_i].inputs[1] alias t3 = g.nodes[reverse_i].inputs[2] @parameter if t1.trainable: backward_op[ 0, op, out.shape, t1.shape, t2.shape, t3.shape, attrs ]( self.parameters.grads[out], self.parameters.tensors[t1], self.parameters.tensors[t2], self.parameters.tensors[t3], self.parameters.grads[t1], # grad to be updated: inputs[0] ) @parameter if t2.trainable: backward_op[ 1, op, out.shape, t1.shape, t2.shape, t3.shape, attrs ]( self.parameters.grads[out], self.parameters.tensors[t1], self.parameters.tensors[t2], self.parameters.tensors[t3], self.parameters.grads[t2], # grad to be updated: inputs[1] ) @parameter if t3.trainable: backward_op[ 2, op, out.shape, t1.shape, t2.shape, t3.shape, attrs ]( self.parameters.grads[out], self.parameters.tensors[t1], self.parameters.tensors[t2], self.parameters.tensors[t3], self.parameters.grads[t3], # grad to be updated: inputs[2] ) # Save end time for performance metrics @parameter if DEBUG == 1: self.perf_metrics.end_backward_pass(i) fn allocate_tensor_memory(inout self): for i in range(len(g.inputs)): self.parameters.tensors.append( Tensor[dtype](g.inputs[i].shape), g.inputs[i] ) for i in range(len(g.params)): var p = g.params.symbols[i] var p_init = g.params.values[i] var par: Tensor[dtype] if p_init.initializer: # 1. Specific parameter initialization defined var initializer_attr = p_init.initializer.value()[] par = initialize_tensor( shape=p.shape, type=initializer_attr.to_string(), data=p_init.data.value()[], ) elif p_init.data: # 2. Parameter initialized with data only # Data is assumed to contain the tensor par = g.params.get_tensor(i) else: # Default parameter initialization to zero par = Tensor[dtype](p.shape) self.parameters.tensors.append(par ^, p) for i in range(len(g.nodes)): # Assumption: An input or a param cannot be an output of a node for j in range(len(g.nodes[i].outputs)): self.parameters.tensors.append( Tensor[dtype](g.nodes[i].outputs[j].shape), g.nodes[i].outputs[j] ) fn allocate_grad_memory(inout self): # Gradient have same shape as the tensor for i in range(len(g.inputs)): if g.inputs[i].trainable: self.parameters.grads.append( Tensor[dtype](g.inputs[i].shape), g.inputs[i] ) for i in range(len(g.params)): var grad = g.params.symbols[i] if grad.trainable: self.parameters.grads.append(Tensor[dtype](grad.shape), grad) for i in range(len(g.nodes)): for j in range(len(g.nodes[i].outputs)): var out = g.nodes[i].outputs[j] if out.trainable: self.parameters.grads.append(Tensor[dtype](out.shape), out) fn print_perf_metrics(self, time_format: String = "ns", print_shape: Bool = False): self.perf_metrics.print_forward_perf_metrics(time_format, print_shape) self.perf_metrics.print_backward_perf_metrics(time_format, print_shape) fn load_model_data(inout self, model_path: String): var path = Path(model_path) print("Loading model data from:", path) try: if path.suffix() == ".onnx": load_onnx_model(model_path, self.parameters, self.g) else: print("Model file format not supported:", path.suffix()) except e: print("Error loading model data:", e) fn export_model(inout self, model_path: String): var path = Path(model_path) print("Exporting model to:", path) try: if path.suffix() == ".onnx": export_onnx_model(model_path, self.parameters, self.g) else: print("Model file format not supported:", path.suffix()) except e: print("Error exporting model:", e) --- basalt/nn/optim.mojo --- from math import sqrt from algorithm import vectorize, parallelize from .model import Parameters from basalt import Graph, Tensor, TensorShape from basalt.utils.collection import Collection from basalt.utils.math_util import add, sub, mul, div fn get_trainable_parameters(g: Graph) -> List[Symbol]: """ Get all symbols of trainable parameters. """ var trainable_parameters = List[Symbol]() for i in range(len(g.params)): if g.params.symbols[i].trainable: trainable_parameters.append(g.params.symbols[i]) return trainable_parameters ^ @value struct Adam[ lifetime: MutableLifetime, # using mutability and anylifetime, seems to give problem for now because the the reference can't now for sure if the lifetime is mutable or not //, g: Graph, trainable_parameters: List[Symbol] = get_trainable_parameters(g), ]: var parameters: Reference[Parameters, True, lifetime] var lr: Scalar[dtype] var beta1: Scalar[dtype] var beta2: Scalar[dtype] var epsilon: Scalar[dtype] var iter: Int var rms_grads: Collection var momentum_grads: Collection fn __init__( inout self, parameters: Reference[Parameters, True, lifetime], lr: Scalar[dtype] = 0.001, beta1: Scalar[dtype] = 0.9, beta2: Scalar[dtype] = 0.999, epsilon: Scalar[dtype] = 1e-8, ): self.parameters = parameters self.lr = lr self.beta1 = beta1 self.beta2 = beta2 self.epsilon = epsilon self.iter = 0 # Capacity of the collections should be the n of trainable parameters self.rms_grads = Collection(capacity=len(trainable_parameters)) self.momentum_grads = Collection(capacity=len(trainable_parameters)) self.allocate_rms_and_momentum() fn zero_grad(inout self): """Set all gradients to zero.""" self.parameters[].grads.set_zero() fn step(inout self): """Update model parameters.""" self.iter += 1 # Loop over all trainable parameters @parameter fn p_step(i: Int): var param = trainable_parameters[i] @parameter fn v_step[nelts: Int](j: Int): var momentum_grads = self.momentum_grads[param].load[nelts](j) var rms_grads = self.rms_grads[param].load[nelts](j) var grads = self.parameters[].grads[param].load[nelts](j) var params = self.parameters[].tensors[param].load[nelts](j) # Momentum beta 1 # f1 = beta1 * momentum + (1 - beta1) * grad momentum_grads = self.beta1 * momentum_grads + (1 - self.beta1) * grads self.momentum_grads[param].store[nelts](j, momentum_grads) # Bias correction # f2 = f1 / (1 - beta1 ** iter) momentum_grads = momentum_grads / (1 - self.beta1**self.iter) # RMS beta 2 # f1 = beta2 * rms + (1 - beta2) * grad ** 2 rms_grads = self.beta2 * rms_grads + (1 - self.beta2) * grads * grads self.rms_grads[param].store[nelts](j, rms_grads) # Bias correction # f2 = f1 / (1 - beta2 ** iter) rms_grads = rms_grads / (1 - self.beta2**self.iter) # tensor = tensor - lr * (f2 / (sqrt(rms) + epsilon)) params = params - self.lr * ( momentum_grads / (sqrt(rms_grads) + self.epsilon) ) self.parameters[].tensors[param].store[nelts](j, params) vectorize[v_step, 1](param.shape.num_elements()) parallelize[p_step](len(trainable_parameters)) fn allocate_rms_and_momentum(inout self): # They are initialized to zero # Loop over all trainable parameters for i in range(len(trainable_parameters)): var param = trainable_parameters[i] self.rms_grads.append(Tensor[dtype](param.shape), param) self.momentum_grads.append(Tensor[dtype](param.shape), param) --- basalt/nn/tensor.mojo --- from testing import assert_true from algorithm import vectorize from tensor import Tensor as _Tensor from tensor import TensorShape as _TensorShape alias MAX_RANK = 8 @register_passable("trivial") struct TensorShape(Stringable): var _rank: Int var _shape: StaticIntTuple[MAX_RANK] fn __init__(inout self, *shape: Int): self._rank = len(shape) self._shape = StaticIntTuple[MAX_RANK]() for i in range(min(self._rank, MAX_RANK)): self._shape[i] = shape[i] fn __init__(inout self, shapes: VariadicList[Int]): self._rank = len(shapes) self._shape = StaticIntTuple[MAX_RANK]() for i in range(min(self._rank, MAX_RANK)): self._shape[i] = shapes[i] fn __init__(inout self, shape: List[Int]): self._rank = len(shape) self._shape = StaticIntTuple[MAX_RANK]() for i in range(min(self._rank, MAX_RANK)): self._shape[i] = shape[i] fn __init__[num: Int](inout self, shape: StaticIntTuple[num]): self._rank = num self._shape = StaticIntTuple[MAX_RANK]() for i in range(min(self._rank, MAX_RANK)): self._shape[i] = shape[i] fn __init__(inout self, rank: Int, shape: StaticIntTuple[MAX_RANK]): self._rank = rank self._shape = shape fn __init__(inout self, owned shape: _TensorShape): self._rank = shape.rank() self._shape = StaticIntTuple[MAX_RANK]() for i in range(min(self._rank, MAX_RANK)): self._shape[i] = shape[i] @always_inline("nodebug") fn __getitem__(self, index: Int) -> Int: return self._shape[index if index >= 0 else self._rank + index] @always_inline("nodebug") fn __setitem__(inout self, index: Int, value: Int): self._shape[index if index >= 0 else self._rank + index] = value @always_inline("nodebug") fn rank(self) -> Int: return self._rank @always_inline("nodebug") fn num_elements(self) -> Int: var result = 1 for i in range(self._rank): result *= self._shape[i] return result @always_inline("nodebug") fn strides(self) -> StaticIntTuple[MAX_RANK]: var result = StaticIntTuple[MAX_RANK](0) result[self._rank - 1] = 1 for i in range(self._rank - 2, -1, -1): result[i] = result[i + 1] * self._shape[i + 1] return result @always_inline("nodebug") fn _std_shape(self) -> _TensorShape: var s = List[Int](capacity=self.rank()) for i in range(self.rank()): s.append(self[i]) return _TensorShape(s) @always_inline("nodebug") fn __str__(self) -> String: return str(self._std_shape()) @always_inline("nodebug") fn __eq__(self, other: TensorShape) -> Bool: if self.rank() != other.rank(): return False for i in range(self.rank()): if self[i] != other[i]: return False return True @always_inline("nodebug") fn __ne__(self, other: TensorShape) -> Bool: return not self.__eq__(other) @always_inline("nodebug") fn __contains__(self, value: Int) -> Bool: for i in range(self.rank()): if self[i] == value: return True return False struct Tensor[dtype: DType](Stringable, Movable, CollectionElement): var _data: DTypePointer[dtype] var _shape: TensorShape fn __init__(inout self, *dims: Int): self._shape = TensorShape(dims) self._data = DTypePointer[dtype].alloc(self._shape.num_elements()) memset_zero(self._data, self._shape.num_elements()) fn __init__(inout self, owned shape: TensorShape): self._data = DTypePointer[dtype].alloc(shape.num_elements()) memset_zero(self._data, shape.num_elements()) self._shape = shape fn __init__( inout self, owned data: DTypePointer[dtype], owned shape: TensorShape ): # NOTE: Remember to use _ = your_tensor that you passed, so there is no weird behavior in this function self._data = DTypePointer[dtype].alloc(shape.num_elements()) self._shape = shape memcpy(self._data, data, self._shape.num_elements()) _ = data fn __init__(inout self, owned tensor: _Tensor[dtype]): self._data = DTypePointer[dtype].alloc(tensor.num_elements()) self._shape = tensor.shape() memcpy(self._data, tensor.unsafe_ptr(), self._shape.num_elements()) _ = tensor fn __moveinit__(inout self, owned other: Tensor[dtype]): self._data = other._data self._shape = other._shape fn __copyinit__(inout self, other: Tensor[dtype]): # print("[WARNING] Copying tensor") self._data = DTypePointer[dtype].alloc(other._shape.num_elements()) memcpy(self._data, other._data, other.num_elements()) self._shape = other._shape @always_inline("nodebug") fn __getitem__(self, index: Int) -> Scalar[dtype]: return self._data[index] @always_inline("nodebug") fn __setitem__(self, index: Int, value: Scalar[dtype]): self._data[index] = value @always_inline("nodebug") fn data(self) -> DTypePointer[dtype]: return self._data @always_inline("nodebug") fn shape(self) -> TensorShape: return self._shape @always_inline("nodebug") fn load[simd_width: Int](self, index: Int) -> SIMD[dtype, simd_width]: return self._data.load[width=simd_width](index) @always_inline("nodebug") fn store[simd_width: Int](self, index: Int, value: SIMD[dtype, simd_width]): self._data.store[width=simd_width](index, value) @always_inline("nodebug") fn strides(self) -> StaticIntTuple[MAX_RANK]: return self._shape.strides() @always_inline("nodebug") fn rank(self) -> Int: return self._shape.rank() @always_inline("nodebug") fn num_elements(self) -> Int: return self._shape.num_elements() @always_inline("nodebug") fn dim(self, index: Int) -> Int: return self._shape[index] @always_inline("nodebug") fn zero(self): memset_zero(self._data, self.num_elements()) @always_inline("nodebug") fn ireshape(inout self, new_shape: TensorShape) raises: # NOTE Consider not raising on error assert_true(self.num_elements() == new_shape.num_elements()) self._shape = new_shape @always_inline("nodebug") fn __str__(self) -> String: var new_data = DTypePointer[dtype].alloc(self.num_elements()) var std_shape = self._shape._std_shape() memcpy(new_data, self._data, self.num_elements()) return str(_Tensor[dtype](ptr=new_data, shape=std_shape)) @always_inline("nodebug") fn __del__(owned self): self._data.free() --- basalt/utils/__init__.mojo --- from memory.unsafe import bitcast @always_inline("nodebug") fn q_sqrt(value: Float32) -> Float32: var y = bitcast[DType.float32](0x5F3759DF - (bitcast[DType.uint32](value) >> 1)) return -y * ((0.5 * value * y).fma(y, -1.5)) --- basalt/utils/bytes.mojo --- from math import nan from utils.numerics import inf from utils.static_tuple import StaticTuple alias ScalarBytes = DType.uint64.sizeof() @register_passable("trivial") struct Bytes[capacity: Int](Stringable, CollectionElement, EqualityComparable): """ Static sequence of bytes. """ var data: StaticTuple[UInt8, capacity] fn __init__(inout self): var data = StaticTuple[UInt8, capacity](0) for i in range(capacity): data[i] = 0 self.data = data fn __init__(inout self, s: String): var data = StaticTuple[UInt8, capacity](0) var length = len(s) for i in range(capacity): data[i] = ord(s[i]) if i < length else 0 self.data = data @always_inline("nodebug") fn __len__(self) -> Int: return capacity @always_inline("nodebug") fn __setitem__(inout self, index: Int, value: UInt8): self.data[index] = value @always_inline("nodebug") fn __getitem__(self, index: Int) -> UInt8: return self.data[index] @always_inline("nodebug") fn __eq__(self, other: Self) -> Bool: for i in range(capacity): if self[i] != other[i]: return False return True @always_inline("nodebug") fn __ne__(self, other: Self) -> Bool: for i in range(capacity): if self[i] != other[i]: return True return False @always_inline("nodebug") fn __str__(self) -> String: var result: String = "" for i in range(capacity): var val = self[i] if val != 0: result += chr(int(val)) return result fn scalar_to_bytes[ dtype: DType, Size: Int = ScalarBytes ](value: Scalar[dtype]) -> Bytes[Size]: constrained[Size >= ScalarBytes, "Size must be at least ${ScalarBytes}"]() var bits = bitcast[DType.uint64](value.cast[expand_type[dtype]()]()) var data = Bytes[Size]() for i in range(ScalarBytes): data[i] = (bits >> (i << 3)).cast[DType.uint8]() return data fn bytes_to_scalar[dtype: DType](data: Bytes) -> Scalar[dtype]: constrained[data.capacity >= ScalarBytes, "Size must be at least ${ScalarBytes}"]() var bits: UInt64 = 0 for i in range(ScalarBytes): bits |= data[i].cast[DType.uint64]() << (i << 3) return bitcast[expand_type[dtype]()](bits).cast[dtype]() fn expand_type[dtype: DType]() -> DType: @parameter if dtype.is_floating_point(): return DType.float64 elif dtype.is_signed(): return DType.int64 elif dtype.is_integral(): return DType.uint64 constrained[False, "Type must be numeric"]() return DType.invalid --- basalt/utils/collection.mojo --- from memory.unsafe_pointer import UnsafePointer, initialize_pointee_move, destroy_pointee from basalt import Tensor, Symbol struct Collection(CollectionElement, Sized): """ A collection of tensors with associated symbols. """ var size: Int var capacity: Int var data: UnsafePointer[Tensor[dtype]] var symbols: DTypePointer[DType.uint32] @always_inline("nodebug") fn __init__(inout self, *, capacity: Int = 0): """ Initializes a new Collection with the given capacity. """ self.size = 0 self.capacity = capacity self.data = UnsafePointer[Tensor[dtype]].alloc(capacity) self.symbols = DTypePointer[DType.uint32].alloc(capacity) @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): """ Move initializes a Collection from an existing one. """ self.size = existing.size self.capacity = existing.capacity self.data = existing.data self.symbols = existing.symbols @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): """ Copy initializes a Collection from an existing one. """ self.capacity = existing.capacity self.size = existing.size self.data = UnsafePointer[Tensor[dtype]].alloc(existing.capacity) self.symbols = DTypePointer[DType.uint32].alloc(existing.capacity) memcpy(self.symbols, existing.symbols, existing.capacity) for i in range(existing.size): initialize_pointee_move((self.data + i), (existing.data + i)[]) @always_inline("nodebug") fn __del__(owned self): """ Destructor for the Collection. """ for i in range(self.size): destroy_pointee((self.data + i)) if self.data: self.data.free() if self.symbols: self.symbols.free() @always_inline("nodebug") fn __len__(self) -> Int: """ Returns the number of elements in the Collection. """ return self.size @always_inline("nodebug") fn _realloc(inout self, new_capacity: Int): """ Reallocates the Collection to the new capacity. """ var new_data = UnsafePointer[Tensor[dtype]].alloc(new_capacity) var new_symbols = DTypePointer[DType.uint32].alloc(new_capacity) for i in range(self.size): initialize_pointee_move((new_data + i), (self.data + i)[]) new_symbols[i] = self.symbols[i] self.data.free() self.symbols.free() self.data = new_data self.symbols = new_symbols self.capacity = new_capacity @always_inline("nodebug") fn append(inout self, owned value: Tensor[dtype], symbol: Symbol): """ Appends a tensor and its associated symbol to the Collection. """ self.append(value ^, symbol.name) @always_inline("nodebug") fn append(inout self, owned value: Tensor[dtype], symbol_name: UInt32): """ Appends a tensor and its associated symbol name to the Collection. """ if self.size >= self.capacity: self._realloc(max(1, self.capacity * 2)) initialize_pointee_move((self.data + self.size), value ^) self.symbols[self.size] = symbol_name self.size += 1 @always_inline("nodebug") fn get_index(self, symbol_name: UInt32) -> Int: """ Returns the index of the tensor with the given symbol name. """ alias factor = 8 # 2 -> 5.32s MNIST # 4 -> 4.95s MNIST # 8 -> 4.85s MNIST # 16 -> 5.19s MNIST # NOTE: This ideally should just be a hashmap for i in range(0, self.size, factor): var elems = self.symbols.load[width=factor](i) == symbol_name for j in range(factor): if elems[j]: return i + j var split = divmod(self.size, factor) for i in range(split[1]): var index = split[0] + i if self.symbols[index] == symbol_name: return index return -1 fn __getitem__( inout self, symbol: Symbol, ) -> ref[__lifetime_of(self)] Tensor[dtype]: """ Returns a reference to the tensor with the given symbol. """ var index = self.get_index(symbol.name) return (self.data + index)[0] @always_inline("nodebug") fn clear(inout self): """ Clears the Collection, removing all tensors and symbols. """ for i in range(self.size): destroy_pointee((self.data + i)) memset_zero(self.symbols, self.capacity) self.size = 0 @always_inline("nodebug") fn set_zero(self): """ Zeroes out all the tensors in the collection. """ for i in range(self.size): self.data[i].zero() --- basalt/utils/dataloader.mojo --- from testing import assert_equal from math import min from memory import memcpy from basalt import dtype, nelts from basalt import Tensor, TensorShape @value struct Batch[dtype: DType](CollectionElement): var data: Tensor[dtype] var labels: Tensor[dtype] fn __init__(inout self, batch_data: Tensor[dtype], batch_labels: Tensor[dtype]): self.data = batch_data self.labels = batch_labels fn __init__( inout self, df_data: Tensor[dtype], df_labels: Tensor[dtype], start: Int, batch_data_shape: TensorShape, batch_labels_shape: TensorShape, ): # TODO: find a better way to do this # Links to the copies of the input tensors in model.forward() self.data = Tensor[dtype](batch_data_shape) self.labels = Tensor[dtype](batch_labels_shape) memcpy( self.data.data(), df_data.data().offset(start * batch_data_shape.strides()[0]), batch_data_shape.num_elements(), ) memcpy( self.labels.data(), df_labels.data().offset(start * batch_labels_shape.strides()[0]), batch_labels_shape.num_elements(), ) fn __getitem__(self, index: Int) -> Tensor[dtype]: if index == 0: return self.data elif index == 1: return self.labels else: print("[ERROR] Batch.__getitem__(): Index out of bounds") return Tensor[dtype]() @value struct DataLoader: var data: Tensor[dtype] var labels: Tensor[dtype] var batch_size: Int var _current_index: Int var _num_batches: Int var _data_batch_shape: TensorShape var _label_batch_shape: TensorShape fn __init__( inout self, data: Tensor[dtype], labels: Tensor[dtype], batch_size: Int, ): self.data = data self.labels = labels self.batch_size = batch_size # Number of batches to iter, NOTE: ignore the remainder for now # var remainder = 1 if self.data.dim(0) % self.batch_size != 0 else 0 self._current_index = 0 self._num_batches = self.data.dim(0) // self.batch_size # + remainder # Batch shapes self._data_batch_shape = self.data.shape() self._label_batch_shape = self.labels.shape() self._data_batch_shape[0] = self.batch_size self._label_batch_shape[0] = self.batch_size @always_inline fn __len__(self) -> Int: """ Returns the number of the batches left in the dataset. """ return self._num_batches fn __iter__(self) -> Self: # TODO: Starting the iterator requires to return (COPY!) the whole dataloader which containts the whole dataset # Does this mean that the whole dataset is copied every epoch ?! return self fn __next__(inout self) -> Batch[dtype]: # NOTE: ignore the remainder for now # var end = min(self._current_index + self.batch_size, self.data.dim(0)) # self._data_shape[0] = end - self._current_index # self._label_shape[0] = end - self._current_index var temp_current_index = self._current_index self._current_index += self.batch_size self._num_batches -= 1 return Batch[dtype]( self.data, self.labels, temp_current_index, self._data_batch_shape, self._label_batch_shape, ) --- basalt/utils/datasets.mojo --- from algorithm import vectorize from basalt import dtype from basalt import Tensor, TensorShape from basalt.utils.tensorutils import elwise_op, tmean, tstd @always_inline fn div[dtype: DType, simd_width: Int](a: SIMD[dtype, simd_width], b: Scalar[dtype]) -> SIMD[dtype, simd_width]: return a / b struct BostonHousing: alias n_inputs = 13 var data: Tensor[dtype] var labels: Tensor[dtype] fn __init__(inout self, file_path: String) raises: var s = read_file(file_path) # Skip the first and last lines # This does assume your last line in the file has a newline at the end var list_of_lines = s.split("\n")[1:-1] # Length is number of lines var N = len(list_of_lines) self.data = Tensor[dtype](N, self.n_inputs) # All columns except the last one self.labels = Tensor[dtype](N, 1) # Only the last column (MEDV) var line: List[String] = List[String]() # Load data in Tensor for item in range(N): line = list_of_lines[item].split(",") self.labels[item] = cast_string[dtype](line[-1]) for n in range(self.n_inputs): self.data[item * self.n_inputs + n] = cast_string[dtype](line[n]) # Normalize data # TODO: redo when tensorutils tmean2 and tstd2 are implemented alias nelts = simdwidthof[dtype]() var col = Tensor[dtype](N) for j in range(self.n_inputs): for k in range(N): col[k] = self.data[k * self.n_inputs + j] for i in range(N): self.data[i * self.n_inputs + j] = (self.data[i * self.n_inputs + j] - tmean(col)) / tstd(col) struct MNIST: var data: Tensor[dtype] var labels: Tensor[dtype] fn __init__(inout self, file_path: String) raises: var s = read_file(file_path) # Skip the first and last lines # This does assume your last line in the file has a newline at the end var list_of_lines = s.split("\n")[1:-1] # Length is number of lines var N = len(list_of_lines) self.data = Tensor[dtype](N, 1, 28, 28) self.labels = Tensor[dtype](N) var line: List[String] = List[String]() # Load data in Tensor for item in range(N): line = list_of_lines[item].split(",") self.labels[item] = atol(line[0]) for i in range(self.data.shape()[2]): for j in range(self.data.shape()[3]): self.data[item * 28 * 28 + i * 28 + j] = atol(line[i * 28 + j + 1]) # Normalize data alias nelts = simdwidthof[dtype]() @parameter fn vecdiv[nelts: Int](idx: Int): self.data.store[nelts](idx, div(self.data.load[nelts](idx), 255.0)) vectorize[vecdiv, nelts](self.data.num_elements()) fn read_file(file_path: String) raises -> String: var s: String with open(file_path, "r") as f: s = f.read() return s fn find_first(s: String, delimiter: String) -> Int: for i in range(len(s)): if s[i] == delimiter: return i return -1 fn cast_string[dtype: DType](s: String) raises -> Scalar[dtype]: """ Cast a string with decimal to a SIMD vector of dtype. """ var idx = find_first(s, delimiter=".") var x: Scalar[dtype] = -1 if idx == -1: # No decimal point x = atol(s) return x else: var c_int: Scalar[dtype] var c_frac: Scalar[dtype] c_int = atol(s[:idx]) c_frac = atol(s[idx + 1 :]) x = c_int + c_frac / (10 ** len(s[idx + 1 :])) return x --- basalt/utils/graph_render.py --- import onnx from onnx import helper from onnx import TensorProto import netron def get_param_data(param_shape): factor = 1 for dim in param_shape: factor *= dim return [0] * factor def create_onnx_graph_from_json(graph, type="node"): # Create a list to hold nodes, inputs, outputs, and initializers nodes = [] inputs = [] outputs = [] initializers = [] intermediates = [] # Process params as initializers (if operator-graph) visited = [] if type == "operator": onnx_inputs = graph["inputs"] + graph.get("params", []) elif type == "node": onnx_inputs = graph["inputs"] # Process params as initializers for initializer in graph.get("params", []): name = initializer["name"] dtype = TensorProto.FLOAT # TODO shape = list(map(int, initializer["shape"].split("x"))) tensor = helper.make_tensor(name, dtype, shape, get_param_data(shape)) initializers.append(tensor) visited.append(name) # Process inputs for input in onnx_inputs: name = input["name"] dtype = TensorProto.FLOAT # TODO shape = list(map(int, input["shape"].split("x"))) inputs.append(helper.make_tensor_value_info(name, dtype, shape)) visited.append(name) # Process outputs for output in graph["outputs"]: name = output["name"] dtype = TensorProto.FLOAT # TODO shape = list(map(int, output["shape"].split("x"))) outputs.append(helper.make_tensor_value_info(name, dtype, shape)) visited.append(name) # Process nodes for node in graph["nodes"]: operator = node["operator"] onnx_node = helper.make_node( operator, inputs=[input["name"] for input in node["inputs"]], outputs=[output["name"] for output in node["outputs"]], name=f"{node['operator']}_node", ) # Process attributes for attribute in node["attributes"]: attr_type = 0 if attribute["type"] == "FLOAT": attr_type = onnx.AttributeProto.FLOAT elif attribute["type"] == "INT": attr_type = onnx.AttributeProto.INT elif attribute["type"] == "STRING": attr_type = onnx.AttributeProto.STRING elif attribute["type"] == "FLOATS": attr_type = onnx.AttributeProto.FLOATS elif attribute["type"] == "INTS": attr_type = onnx.AttributeProto.INTS else: raise ValueError(f"Unsupported attribute type: {attribute['type']}") onnx_attribute = helper.make_attribute( attribute["name"], attribute["value"], attr_type=attr_type ) onnx_node.attribute.append(onnx_attribute) nodes.append(onnx_node) # Process intermediates for output in node["outputs"]: if output["name"] not in visited: name = output["name"] dtype = TensorProto.FLOAT shape = list(map(int, output["shape"].split("x"))) intermediates.append(helper.make_tensor_value_info(name, dtype, shape)) visited.append(name) # Process loss if "loss" in graph.keys(): loss = graph["loss"][0] name = loss["name"] if name not in visited: dtype = TensorProto.FLOAT shape = list(map(int, loss["shape"].split("x"))) outputs.append(helper.make_tensor_value_info(name, dtype, shape)) visited.append(name) # Create the graph graph_def = helper.make_graph( nodes, graph.get("graph_name", "basalt-ONNX"), inputs, outputs, initializer=initializers, value_info=intermediates, ) # Create the model model_def = helper.make_model(graph_def, producer_name="basalt") # Save the model to a file onnx.save(model_def, "output_model.onnx") def netron_render(graph, type="node"): assert type in ["node", "operator"] create_onnx_graph_from_json(graph, type=type) netron.start("output_model.onnx") --- basalt/utils/math_util.mojo --- @always_inline fn add[ dtype: DType, simd_width: Int ](a: SIMD[dtype, simd_width], b: SIMD[dtype, simd_width]) -> SIMD[ dtype, simd_width ]: return a + b @always_inline fn sub[ dtype: DType, simd_width: Int ](a: SIMD[dtype, simd_width], b: SIMD[dtype, simd_width]) -> SIMD[ dtype, simd_width ]: return a - b @always_inline fn mul[ dtype: DType, simd_width: Int ](a: SIMD[dtype, simd_width], b: SIMD[dtype, simd_width]) -> SIMD[ dtype, simd_width ]: return a * b @always_inline fn div[ dtype: DType, simd_width: Int ](a: SIMD[dtype, simd_width], b: SIMD[dtype, simd_width]) -> SIMD[ dtype, simd_width ]: return a / b @always_inline fn round_simd[ dtype: DType, simd_width: Int ](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]: return round(x) --- basalt/utils/onnx_utils.mojo --- from python import Python from pathlib import Path from collections import Set from basalt.nn.model import Parameters from basalt.nn.tensor import Tensor, TensorShape from basalt.autograd.attributes import Attribute, AttributeType from basalt.autograd.ops import OP from basalt.autograd.graph import Node from .tensor_creation_utils import to_numpy, copy_np_data # NOTE: Maybe we could create our own model representation and from there convert to onnx or others (well we already have it in reallity) # NOTE: Torch doesn't import onnx, need onnx2torch and it doesn't support operators like reshape? fn make_onnx_attribute(op: OP, attr: Attribute) raises -> PythonObject: var onnx = Python.import_module("onnx") var onnx_helper = Python.import_module("onnx.helper") var attr_name = str(attr.name) var attr_value: PythonObject if attr.type == AttributeType.FLOAT: attr_value = attr.to_scalar[DType.float64]() elif attr.type == AttributeType.INT: attr_value = attr.to_int() elif attr.type == AttributeType.STRING: attr_value = attr.to_string() elif attr.type == AttributeType.INTS: var temp = attr.to_shape() var shape = PythonObject([]) for i in range(temp.rank()): shape.append(temp[i]) attr_value = shape else: raise Error("Unsupported attribute type") if op == OP.CONV2D or op == OP.MAXPOOL2D: if attr_name == "dilation": attr_name = "dilations" elif attr_name == "kernel_size": attr_name = "kernel_shape" elif attr_name == "stride": attr_name = "strides" elif attr_name == "padding": attr_name = "pads" else: raise Error("Unsupported attribute name for operator " + str(op)) if (op == OP.CONV2D or op == OP.MAXPOOL2D) and attr_name == "pads": # Special case for pads in conv and maxpool, onnx wants pads to be [x1_begin, x2_begin…x1_end, x2_end,…], attr_value.append(attr_value[0]) attr_value.append(attr_value[1]) return onnx_helper.make_attribute(attr_name, attr_value) fn make_onnx_operator_type(op_type: OP) raises -> String: if op_type == OP.ADD: return "Add" elif op_type == OP.SUB: return "Sub" elif op_type == OP.MUL: return "Mul" elif op_type == OP.DOT: return "MatMul" elif op_type == OP.DIV: return "Div" elif op_type == OP.EXP: return "Exp" elif op_type == OP.LOG: return "Log" elif op_type == OP.SUM: # Special case, axis isn't an attribute, instead it is an input, because it can be dynamic raise Error(str(op_type) + " is not supported right now for conversion to onnx") # return "ReduceSum" elif op_type == OP.MEAN: raise Error(str(op_type) + " is not supported right now for conversion to onnx") # return "ReduceMean" elif op_type == OP.MAX: raise Error(str(op_type) + " is not supported right now for conversion to onnx") # return "ReduceMax" elif op_type == OP.CONV2D: return "Conv" elif op_type == OP.MAXPOOL2D: return "MaxPool" elif op_type == OP.RELU: return "Relu" elif op_type == OP.TANH: return "Tanh" elif op_type == OP.SIGMOID: return "Sigmoid" elif op_type == OP.RESHAPE: return "Reshape" elif op_type == OP.TRANSPOSE: return "Transpose" elif op_type == OP.FLATTEN: return "Flatten" elif op_type == OP.SQUEEZE: return "Squeeze" elif op_type == OP.UNSQUEEZE: return "Unsqueeze" elif op_type == OP.CONCAT: return "Concat" elif op_type == OP.SPLIT: return "Split" elif op_type == OP.CLIP: return "Clip" elif op_type == OP.FMA: raise Error(str(op_type) + " operator is not supported in onnx") else: raise Error("Unsupported operator type " + str(op_type)) # --- Loader and exporter --- fn load_onnx_model( model_path: Path, inout model_parameters: Parameters, g: Graph ) raises: # Simple onnx data loader where we load the data in order (so we need to have the correct order of the weights and biases in the model. We don't use the names for the loading) var onnx = Python.import_module("onnx") var onnx_model = onnx.load(str(model_path)) for i in range(len(onnx_model.graph.initializer)): var tensor = onnx_model.graph.initializer[i] if ( tensor.data_type == onnx.TensorProto.FLOAT or tensor.data_type == onnx.TensorProto.INT32 or tensor.data_type == onnx.TensorProto.INT64 ): var data_np = onnx.numpy_helper.to_array(tensor) # Get the shape of data onnx var temp = List[Int]() for j in range(len(data_np.shape)): temp.append(int(data_np.shape[j].to_float64())) var data_shape = TensorShape(temp) # Compare the shape of the data with the shape of the model tensor var model_tensor_shape = g.params.symbols[i].shape if data_shape != model_tensor_shape: # check if the shape is transposed (reversed), we do this comparison because torch can save sove weights transposed (like gemm operator) var raise_error_flag = True if data_shape.rank() == model_tensor_shape.rank(): var count = 0 for j in range(model_tensor_shape.rank()): if ( data_shape[data_shape.rank() - j - 1] != model_tensor_shape[j] ): break count += 1 if count == model_tensor_shape.rank(): raise_error_flag = False data_np = data_np.transpose() if raise_error_flag: raise Error( "Shape mismatch for tensor " + str(i) + ". Expected shape: " + str(model_tensor_shape) + ", got shape: " + str(data_shape) ) copy_np_data(model_parameters.tensors[g.params.symbols[i]], data_np) else: raise Error("Unsupported data type") fn create_attributes_and_constant_inputs(node: Node, node_number: Int) raises -> (List[PythonObject], List[PythonObject]): var onnx = Python.import_module("onnx") var np = Python.import_module("numpy") var attributes = List[PythonObject]() var inputs = List[PythonObject]() for i in range(len(node.attributes)): var attr = node.attributes[i] @parameter fn to_np_array(attr: Attribute) raises -> PythonObject: if not attr.type == AttributeType.INTS: raise Error("Attribute is not a shape") var values_np: PythonObject if attr.type == AttributeType.INTS: var shape = attr.to_shape() values_np = PythonObject([]) for j in range(shape.rank()): values_np.append(shape[j]) elif attr.type == AttributeType.FLOAT: values_np = attr.to_scalar[DType.float64]() elif attr.type == AttributeType.INT: values_np = attr.to_int() else: raise Error("Unsupported attribute type") var np_array = np.array(values_np, dtype=np.int64) return onnx.numpy_helper.from_array(np_array) # Special cases where attributes are considered as inputs, so we create Constant inputs if node.operator == OP.RESHAPE: if str(attr.name) == "shape": var outputs = PythonObject([]) outputs.append(str(node.operator) + "_" + str(attr.name) + "_" + str(node_number)) var temp_node = onnx.helper.make_node( op_type="Constant", inputs=[], outputs=outputs, value=to_np_array(attr), ) inputs.append(temp_node) elif node.operator == OP.CLIP: if str(attr.name) == "min" or str(attr.name) == "max": var outputs = PythonObject([]) outputs.append(str(node.operator) + "_" + str(attr.name) + "_" + str(node_number)) var temp_node = onnx.helper.make_node( op_type="Constant", inputs=[], outputs=outputs, value=to_np_array(attr), ) inputs.append(temp_node) elif node.operator == OP.SQUEEZE or node.operator == OP.UNSQUEEZE: if str(attr.name) == "dims": var outputs = PythonObject([]) outputs.append(str(node.operator) + "_" + str(attr.name) + "_" + str(node_number)) var temp_node = onnx.helper.make_node( op_type="Constant", inputs=[], outputs=outputs, value=to_np_array(attr), ) inputs.append(temp_node) else: var attr_value = make_onnx_attribute(node.operator, attr) attributes.append(attr_value) return (attributes, inputs) fn export_onnx_model(model_path: Path, inout model_parameters: Parameters, g: Graph) raises: # Create onnx model with data and nodes var onnx = Python.import_module("onnx") var onnx_helper = Python.import_module("onnx.helper") var graph = onnx_helper.make_graph( nodes=[], name="basalt_model", inputs=[], outputs=[], initializer=[], value_info=[], ) var visited = Set[String]() # Create onnx initializers for i in range(len(g.params.symbols)): var tensor = g.params.symbols[i] var tensor_data = model_parameters.tensors[tensor] var tensor_np = to_numpy(tensor_data) # Create onnx tensor var onnx_tensor_data = onnx_helper.make_tensor( name=str(tensor.name), data_type=onnx.TensorProto.FLOAT, dims=tensor_np.shape, vals=tensor_np, ) graph.initializer.append(onnx_tensor_data) # Create onnx nodes for i in range(len(g.nodes)): var node = g.nodes[i] var op_type = make_onnx_operator_type(node.operator) var inputs = PythonObject([]) var outputs = PythonObject([]) var name = str(node.operator) + "_node" + str(i) for j in range(len(node.inputs)): inputs.append(str(node.inputs[j].name)) for j in range(len(node.outputs)): outputs.append(str(node.outputs[j].name)) # Process intermediate if str(node.outputs[j].name) not in visited: visited.add(str(node.outputs[j].name)) var intermediate_tensor = node.outputs[j] var intermediate_shape = intermediate_tensor.shape var name = str(intermediate_tensor.name) var dtype = onnx.TensorProto.FLOAT # TODO var shape = PythonObject([]) for j in range(intermediate_shape.rank()): shape.append(intermediate_shape[j]) # Create onnx tensor information var onnx_output = onnx_helper.make_tensor_value_info(name, dtype, shape) graph.value_info.append(onnx_output) # Process attributes var attributes_and_inputs = create_attributes_and_constant_inputs(node, i) var attributes = attributes_and_inputs[0] var inputs_constant = attributes_and_inputs[1] for j in range(len(inputs_constant)): inputs.append(inputs_constant[j].output[0]) graph.node.append(inputs_constant[j]) # Create onnx node var onnx_node = onnx_helper.make_node( op_type, inputs, outputs, name, ) for attribute in attributes: onnx_node.attribute.append(attribute[]) graph.node.append(onnx_node) # Create onnx inputs for i in range(len(g.inputs)): var input_tensor = g.inputs[i] var input_shape = input_tensor.shape var name = str(input_tensor.name) var dtype = onnx.TensorProto.FLOAT # TODO var shape = PythonObject([]) for j in range(input_shape.rank()): shape.append(input_shape[j]) # Create onnx tensor information var onnx_input = onnx_helper.make_tensor_value_info(name, dtype, shape) graph.input.append(onnx_input) # Create onnx outputs for i in range(len(g.outputs)): var output_tensor = g.outputs[i] var output_shape = output_tensor.shape var name = str(output_tensor.name) var dtype = onnx.TensorProto.FLOAT # TODO var shape = PythonObject([]) for j in range(output_shape.rank()): shape.append(output_shape[j]) # Create onnx tensor information var onnx_output = onnx_helper.make_tensor_value_info(name, dtype, shape) graph.output.append(onnx_output) # Create onnx model var onnx_model = onnx_helper.make_model(graph, producer_name="basalt") # Save onnx model onnx.checker.check_model(onnx_model) onnx.save(onnx_model, str(model_path)) --- basalt/utils/perf_utils.mojo --- from time import now from memory import memset from basalt.autograd.node import Node @always_inline("nodebug") fn fit_string[num: Int](s: String) -> String: var data = DTypePointer[DType.uint8]().alloc(num + 1) var copy_len = min(num, len(s)) memcpy(data, s.unsafe_uint8_ptr(), copy_len) memset(data + copy_len, ord(" "), num - copy_len) data[num] = 0 return String(data, num + 1) @always_inline("nodebug") fn truncate_decimals[num: Int](s: String) -> String: try: var parts = s.split(".") var truncated = parts[0] if len(parts) > 1: var decimal_parts = parts[1].split("e") truncated += "." + fit_string[num](decimal_parts[0]) if len(decimal_parts) > 1: truncated += "e" + decimal_parts[1] return truncated except e: print("[WARNING] could not truncate decimals: ", e) return s @value struct PerfMetricsValues: var node: Node var ns: Float64 @value struct PerfMetrics: var forward_perf_metrics: List[PerfMetricsValues] var backward_perf_metrics: List[PerfMetricsValues] var epochs_forward: Int var epochs_backward: Int var start: Int fn __init__(inout self): self.forward_perf_metrics = List[PerfMetricsValues]() self.backward_perf_metrics = List[PerfMetricsValues]() self.epochs_forward = 0 self.epochs_backward = 0 self.start = 0 fn __init__(inout self, graph: Graph): self.forward_perf_metrics = List[PerfMetricsValues]() self.backward_perf_metrics = List[PerfMetricsValues]() self.forward_perf_metrics.reserve(graph.nodes.size) self.backward_perf_metrics.reserve(graph.nodes.size) for i in range(graph.nodes.size): self.forward_perf_metrics.append(PerfMetricsValues(graph.nodes[i], 0.0)) self.backward_perf_metrics.append(PerfMetricsValues(graph.nodes[i], 0.0)) self.epochs_forward = 0 self.epochs_backward = 0 self.start = 0 fn start_forward_pass(inout self): self.start = now() fn end_forward_pass(inout self, pos: Int): self.forward_perf_metrics[pos].ns += now() - self.start self.epochs_forward += 1 fn start_backward_pass(inout self): self.start = now() fn end_backward_pass(inout self, pos: Int): self.backward_perf_metrics[pos].ns += now() - self.start self.epochs_backward += 1 fn print_perf_metrics[ type_part: String ](self, time_format: String = "ns", print_shape: Bool = False): constrained[type_part == "Forward" or type_part == "Backward", "Only 'Forward' or 'Backward' are accepted types."]() alias is_forward = type_part == "Forward" var metrics = self.forward_perf_metrics if is_forward else self.backward_perf_metrics var epochs = self.epochs_forward if is_forward else self.epochs_backward var size = len(metrics) var total_time: Float64 = 0 if size == 0: return if is_forward: print("\n\nForward pass performance metrics:") else: print("\n\nBackward pass performance metrics:") for i in range(size): total_time += metrics[i].ns var header = ( fit_string[5]("Node") + "| " + fit_string[15]("Operator") + "| " + fit_string[20]("Time [" + time_format + "]") + "| " + fit_string[20]("Percentage [%]") ) if print_shape: header += "| " + fit_string[70]("Shape\t <out> = OP( <in1>, <in2>, <in3> )") print(header) var header_length = len(header) var seperator = DTypePointer[DType.uint8]().alloc(header_length + 1) memset(seperator, ord("-"), header_length) seperator[header_length] = 0 print(String(seperator, len(header) + 1)) for i in range(size): var value = metrics[i] var time = value.ns / epochs if time_format == "ms": time /= 1e6 elif time_format == "s": time /= 1e9 var percentage = (value.ns / total_time) * 100 var print_value = ( fit_string[5](str(i)) + "| " + fit_string[15](str(value.node.operator)) + "| " + fit_string[20](truncate_decimals[4](str(time))) + "| " + fit_string[20](truncate_decimals[3](str(percentage)) + " %") + "| " ) if print_shape: var shape_str = fit_string[15]("<" + str(value.node.outputs[0].shape) + ">") for j in range(1, len(value.node.outputs)): shape_str += ", " + fit_string[15]("<" + str(value.node.outputs[j].shape) + ">") shape_str += fit_string[7](" = OP(") + fit_string[15]("<" + str(value.node.inputs[0].shape) + ">") for j in range(1, len(value.node.inputs)): shape_str += ", " + fit_string[15]("<" + str(value.node.inputs[j].shape) + ">") shape_str += ")" print(print_value, end="") print(shape_str) else: print(print_value) if time_format == "ms": total_time /= 1e6 elif time_format == "s": total_time /= 1e9 print( "\nTotal average " + type_part + " time: " + str(total_time) + " " + time_format ) fn print_forward_perf_metrics(self, time_format: String = "ns", print_shape: Bool = False): self.print_perf_metrics["Forward"](time_format, print_shape) fn print_backward_perf_metrics(self, time_format: String = "ns", print_shape: Bool = False): self.print_perf_metrics["Backward"](time_format, print_shape) --- basalt/utils/rand_utils.mojo --- from basalt import Tensor from random import rand, randn from algorithm import vectorize from utils.static_tuple import StaticTuple @always_inline fn rand_uniform[dtype: DType](inout res: Tensor[dtype], low: Scalar[dtype], high: Scalar[dtype]): var scale = high - low rand[dtype](res.data(), res.num_elements()) @parameter fn vecscale[nelts: Int](idx: Int): res.store[nelts](idx, res.load[nelts](idx).fma(scale, low)) vectorize[vecscale, nelts](res.num_elements()) @always_inline fn rand_normal[dtype: DType](inout res: Tensor[dtype], mean: Float64, std: Float64): randn[dtype](res.data(), res.num_elements(), mean, std**2) @register_passable("trivial") struct MersenneTwister: """ Pseudo-random generator Mersenne Twister (MT19937-32bit). """ alias N: Int = 624 alias M: Int = 397 alias MATRIX_A: Int32 = 0x9908B0DF alias UPPER_MASK: Int32 = 0x80000000 alias LOWER_MASK: Int32 = 0x7FFFFFFF alias TEMPERING_MASK_B: Int32 = 0x9D2C5680 alias TEMPERING_MASK_C: Int32 = 0xEFC60000 var state: StaticTuple[Int32, Self.N] var index: Int fn __init__(inout self, seed: Int): alias W: Int = 32 alias F: Int32 = 1812433253 alias D: Int32 = 0xFFFFFFFF self.index = Self.N self.state = StaticTuple[Int32, Self.N]() self.state[0] = seed & D for i in range(1, Self.N): var prev = self.state[i - 1] self.state[i] = (F * (prev ^ (prev >> (W - 2))) + i) & D fn next(inout self) -> Int32: if self.index >= Self.N: for i in range(Self.N): var x = (self.state[i] & Self.UPPER_MASK) + (self.state[(i + 1) % Self.N] & Self.LOWER_MASK) var xA = x >> 1 if x % 2 != 0: xA ^= Self.MATRIX_A self.state[i] = self.state[(i + Self.M) % Self.N] ^ xA self.index = 0 var y = self.state[self.index] y ^= y >> 11 y ^= (y << 7) & Self.TEMPERING_MASK_B y ^= (y << 15) & Self.TEMPERING_MASK_C y ^= y >> 18 self.index += 1 return y fn next_ui8(inout self) -> UInt8: return self.next().value & int(0xFF) --- basalt/utils/tensor_creation_utils.mojo --- from python import Python # maybe this functions should be from the Tensor struct (like tensor.to_numpy()) and tensor.__init__(np_array: PythonObject) to create a tensor from a numpy array and tensor.copy_np_data(np_array: PythonObject) to copy the numpy array to the tensor. fn to_numpy(tensor: Tensor) -> PythonObject: try: var np = Python.import_module("numpy") np.set_printoptions(4) var rank = tensor.rank() var dims = PythonObject([]) for i in range(rank): dims.append(tensor.dim(i)) var pyarray: PythonObject = np.empty(dims, dtype=np.float32) var pointer = int(pyarray.__array_interface__["data"][0].to_float64()) var pointer_d = DTypePointer[tensor.dtype](address=pointer) memcpy(pointer_d, tensor.data(), tensor.num_elements()) _ = tensor return pyarray^ except e: print("Error in to numpy", e) return PythonObject() fn to_tensor(np_array: PythonObject) raises -> Tensor[dtype]: var shape = List[Int]() for i in range(np_array.ndim): shape.append(int(np_array.shape[i].to_float64())) if np_array.ndim == 0: # When the numpy array is a scalar, you need or the reshape to a size 1 ndarray or do this, if not the memcpy gets a memory error (Maybe because it is a register value?). var tensor = Tensor[dtype](TensorShape(1)) tensor[0] = np_array.to_float64().cast[dtype]() return tensor^ var tensor = Tensor[dtype](TensorShape(shape)) var np_array_2: PythonObject try: var np = Python.import_module("numpy") # copy is also necessary for ops like slices to make them contiguous instead of references. np_array_2 = np.float32(np_array.copy()) except e: np_array_2 = np_array.copy() print("Error in to_tensor", e) var pointer = int(np_array_2.__array_interface__["data"][0].to_float64()) var pointer_d = DTypePointer[tensor.dtype](address=pointer) memcpy(tensor.data(), pointer_d, tensor.num_elements()) _ = np_array_2 _ = np_array return tensor^ fn copy_np_data(inout tensor: Tensor, np_array: PythonObject) raises: var np_array_2: PythonObject try: var np = Python.import_module("numpy") # copy is also necessary for ops like slices to make them contiguous instead of references. np_array_2 = np.float32(np_array.copy()) except e: np_array_2 = np_array.copy() print("Error in to_tensor", e) var pointer = int(np_array_2.__array_interface__["data"][0].to_float64()) var pointer_d = DTypePointer[tensor.dtype](address=pointer) memcpy(tensor.data(), pointer_d, tensor.num_elements()) _ = np_array_2 _ = np_array _ = tensor --- basalt/utils/tensorutils.mojo --- from sys.info import num_physical_cores from algorithm import vectorize, parallelize from memory import memset_zero, memset, stack_allocation from math import sqrt from random import rand from utils.numerics import min_finite, max_finite from basalt import Tensor, TensorShape from basalt.nn.tensor import MAX_RANK from basalt.utils.math_util import add, sub, mul, div # ---- Start ----- @always_inline fn fill[dtype: DType](inout t: Tensor[dtype], val: Scalar[dtype]): @parameter fn fill_vec[nelts: Int](idx: Int): t.store[nelts](idx, t.load[nelts](idx).splat(val)) vectorize[fill_vec, nelts](t.num_elements()) # ----- Functions to access positions in tensor data ----- @always_inline fn get_real_index[ size: Int, strides_shape: StaticIntTuple[size], broadcast_shape: TensorShape ](i: Int) -> Int: # broadcast_shape is of same rank as strides_shape (the not broadcasted shape), because of broadcast_calculate_strides var index_res = 0 var linear_index = i @parameter fn unroll_dims[dim: Int](): alias j = size - 1 - dim alias stride_value = strides_shape[j] alias shape_value = broadcast_shape[j] var divmod_index = divmod(linear_index, shape_value) index_res += divmod_index[1] * stride_value linear_index = divmod_index[0] unroll[unroll_dims, size]() return index_res # ----- Broadcast functions ----- @always_inline fn broadcast_shapes(s1: TensorShape, s2: TensorShape) -> TensorShape: var ndim = max(s1.rank(), s2.rank()) var diff = abs(s1.rank() - s2.rank()) var big = s1 if s1.rank() > s2.rank() else s2 var small = s2 if s1.rank() > s2.rank() else s1 var res = StaticIntTuple[MAX_RANK](-1) for i in range(ndim - 1, diff - 1, -1): var a = big[i] var b = small[i - diff] if b == a: res[i] = a elif a == 1 or b == 1: res[i] = a * b else: print("[ERROR] Shapes " + str(s1) + " and " + str(s2) + " cannot be broadcasted together.") for i in range(diff - 1, -1, -1): res[i] = big[i] return TensorShape(rank=ndim, shape=res) @always_inline fn broadcast_shapes(*s: TensorShape) -> TensorShape: var result_shape = s[0] for i in range(1, len(s)): result_shape = broadcast_shapes(result_shape, s[i]) return result_shape @always_inline fn broadcast_calculate_strides[size: Int, shape: TensorShape, broadcast_shape: TensorShape]() -> StaticIntTuple[size]: alias shape_rank = shape.rank() alias diff = size - shape_rank var strides = StaticIntTuple[size](0) var stride = 1 for i in range(shape_rank - 1, -1, -1): if shape[i] != 1: strides[i + diff] = stride stride *= shape[i] return strides # ----- Element-wise unary operations ----- @always_inline fn elwise_transform[ func: fn[dtype: DType, nelts: Int] (x: SIMD[dtype, nelts]) -> SIMD[dtype, nelts], ](inout res: Tensor[dtype], t: Tensor[dtype]): @parameter fn vecmath[nelts: Int](idx: Int): res.store[nelts](idx, func[dtype, nelts](t.load[nelts](idx))) vectorize[vecmath, nelts](t.num_elements()) # ----- Element-wise binary operations ----- @always_inline fn elwise_pow(inout res: Tensor[dtype], t: Tensor[dtype], x: Int): @parameter fn vecpow[nelts: Int](idx: Int): res.store[nelts](idx, pow(t.load[nelts](idx), x)) vectorize[vecpow, nelts](t.num_elements()) @always_inline fn elwise_op[ t1_shape: TensorShape, t2_shape: TensorShape, func: fn[dtype: DType, nelts: Int] ( x: SIMD[dtype, nelts], y: SIMD[dtype, nelts] ) -> SIMD[dtype, nelts], ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): alias broadcast: Bool = (t1_shape != t2_shape) alias is_scalar: Bool = (t2_shape == TensorShape(1)) @parameter if t2_shape == TensorShape(1): elwise_op[func](res, t1, t2[0]) elif t1_shape == TensorShape(1): elwise_op[func](res, t1[0], t2) elif broadcast and not is_scalar: alias res_shape = broadcast_shapes(t1_shape, t2_shape) broadcast_elwise_op[t1_shape, t2_shape, res_shape, func](res, t1, t2) else: elwise_op[func](res, t1, t2) @always_inline fn elwise_op[ func: fn[dtype: DType, nelts: Int] ( x: SIMD[dtype, nelts], y: SIMD[dtype, nelts] ) -> SIMD[dtype, nelts], ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): """Element-wise operation on two tensors of equal shape.""" @parameter fn vecmath[nelts: Int](idx: Int): res.store[nelts]( idx, func[dtype, nelts](t1.load[nelts](idx), t2.load[nelts](idx)) ) vectorize[vecmath, nelts](t1.num_elements()) @always_inline fn elwise_op[ func: fn[dtype: DType, nelts: Int] ( x: SIMD[dtype, nelts], y: SIMD[dtype, nelts] ) -> SIMD[dtype, nelts], ](inout res: Tensor[dtype], t1: Tensor[dtype], a: Scalar[dtype]): """Element-wise operation on a tensor and a scalar.""" @parameter fn vecmath[nelts: Int](idx: Int): res.store[nelts](idx, func[dtype, nelts](t1.load[nelts](idx), a)) vectorize[vecmath, nelts](t1.num_elements()) @always_inline fn elwise_op[ func: fn[dtype: DType, nelts: Int] ( x: SIMD[dtype, nelts], y: SIMD[dtype, nelts] ) -> SIMD[dtype, nelts], ](inout res: Tensor[dtype], a: Scalar[dtype], t1: Tensor[dtype]): """Element-wise operation on a tensor and a scalar.""" @parameter fn vecmath[nelts: Int](idx: Int): res.store[nelts](idx, func[dtype, nelts](a, t1.load[nelts](idx))) vectorize[vecmath, nelts](t1.num_elements()) fn broadcast_elwise_op[ t1_shape: TensorShape, t2_shape: TensorShape, res_shape: TensorShape, func: fn[dtype: DType, nelts: Int] ( x: SIMD[dtype, nelts], y: SIMD[dtype, nelts] ) -> SIMD[dtype, nelts], ](inout res: Tensor[dtype], t1: Tensor[dtype], t2: Tensor[dtype]): alias size = res_shape.rank() alias strides1 = broadcast_calculate_strides[size, t1_shape, res_shape]() alias strides2 = broadcast_calculate_strides[size, t2_shape, res_shape]() @parameter fn vec_op[nelts: Int](i: Int): var index1 = get_real_index[size, strides1, res_shape](i) var index2 = get_real_index[size, strides2, res_shape](i) res.store[nelts]( i, func[dtype, nelts](t1.load[nelts](index1), t2.load[nelts](index2)), ) # TODO: Check how to vectorize this vectorize[vec_op, 1](res.num_elements()) @always_inline fn accumulate_grad(inout grad: Tensor[dtype], res_grad: Tensor[dtype]): # Accumulate gradient without checking for broadcasting elwise_op[add](grad, grad, res_grad) @always_inline fn accumulate_grad[ grad_shape: TensorShape, res_grad_shape: TensorShape ](inout grad: Tensor[dtype], res_grad: Tensor[dtype]): @parameter if grad_shape == res_grad_shape: elwise_op[add](grad, grad, res_grad) elif res_grad_shape == TensorShape(1): elwise_op[add](grad, grad, res_grad[0]) elif grad_shape != res_grad_shape: # Backward resulting gradient (res_grad) was formed from an operation that required broadcasting. # In order to accumulate res_grad to the gradient, the res_grad tensor needs to be unbroadcasted. # The following is equivalent to: Summing along the axes that were expanded during the broadcasting process. alias size = res_grad_shape.rank() alias strides_grad = broadcast_calculate_strides[ size, grad_shape, res_grad_shape ]() @parameter fn vec_op[nelts: Int](i: Int): var index = get_real_index[size, strides_grad, res_grad_shape](i) grad[index] += res_grad.load[nelts](i).reduce_add() # TODO: Check how to vectorize this vectorize[vec_op, 1](res_grad.num_elements()) # ---- Transform functions ----- @always_inline fn transpose_2D[t_shape: TensorShape](t: Tensor[dtype]) -> Tensor[dtype]: var t_new = Tensor[dtype](t_shape[1], t_shape[0]) alias stride = t_shape[0] @parameter fn proc_row(i: Int): @parameter fn proc_column[nelts: Int](j: Int): t_new.data().offset(j * t_shape[0] + i).simd_strided_store[nelts]( t.load[nelts](i * t_shape[1] + j), stride ) vectorize[proc_column, nelts](t.dim(1)) parallelize[proc_row](t_shape[0]) return t_new ^ @always_inline fn transpose_2D[t_shape: TensorShape](t: DTypePointer[dtype]) -> DTypePointer[dtype]: var t_new = DTypePointer[dtype].alloc(t_shape[1] * t_shape[0]) alias stride = t_shape[0] @parameter fn proc_row(i: Int): @parameter fn proc_column[nelts: Int](j: Int): t_new.offset(j * t_shape[0] + i).simd_strided_store[nelts]( t.load[width=nelts](i * t_shape[1] + j), stride ) vectorize[proc_column, nelts](t_shape[1]) parallelize[proc_row](t_shape[0]) return t_new # ----- Reduction functions ----- @always_inline fn reduce[ op: fn[type: DType, simd_width: Int] ( x: SIMD[type, simd_width], y: SIMD[type, simd_width] ) -> SIMD[type, simd_width], reduce_op: fn[type: DType, simd_width: Int] (x: SIMD[type, simd_width]) -> SIMD[ type, 1 ], ](t: Tensor[dtype], starting_value: SIMD[dtype, nelts]) -> Scalar[dtype]: var m: SIMD[dtype, nelts] = starting_value @parameter fn vecreduce[_nelts: Int](idx: Int): @parameter if _nelts == 1: m[0] = op(m[0], t.load[_nelts](idx)[0]) else: m = op(m, t.load[nelts](idx)) vectorize[vecreduce, nelts](t.num_elements()) return reduce_op(m) fn get_reduce_shape(t: TensorShape, axis: Int) -> TensorShape: var rank = t.rank() var new_shape = StaticIntTuple[MAX_RANK]() for i in range(rank): if i == axis: new_shape[i] = 1 else: new_shape[i] = t[i] return TensorShape(rank=rank, shape=new_shape) @always_inline fn reduce[ op: fn[type: DType, simd_width: Int] ( x: SIMD[type, simd_width], y: SIMD[type, simd_width] ) -> SIMD[type, simd_width], reduce_op: fn[type: DType, simd_width: Int] (x: SIMD[type, simd_width]) -> SIMD[ type, 1 ], ]( inout res: Tensor[dtype], t: Tensor[dtype], axis: Int, starting_value: SIMD[dtype, nelts], ): var strides = t.strides() @parameter fn parallel_reduce(i: Int): var m: SIMD[dtype, nelts] = starting_value var index_base = (i % strides[axis]) + (i // strides[axis]) * ( strides[axis] * t.dim(axis) ) @parameter fn axisreduce[_nelts: Int](j: Int): var index = index_base + j * strides[axis] if _nelts == 1: m[0] = op( m[0], t.data().offset(index).simd_strided_load[_nelts](strides[axis])[0], ) else: m = op( m, t.data().offset(index).simd_strided_load[nelts](strides[axis]) ) vectorize[axisreduce, nelts](t.dim(axis)) res[i] = reduce_op(m) parallelize[parallel_reduce](t.num_elements() // t.dim(axis)) _ = strides @always_inline fn _reduce_sum[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> Scalar[type]: return x.reduce_add() @always_inline fn tsum(t: Tensor[dtype]) -> Scalar[dtype]: var starting_value = 0 return reduce[add, _reduce_sum](t, starting_value) @always_inline fn tmean(t: Tensor[dtype]) -> Scalar[dtype]: return tsum(t) / t.num_elements() @always_inline fn tstd(t: Tensor[dtype]) -> Scalar[dtype]: var mu: Scalar[dtype] = tmean(t) var variance: Scalar[dtype] = 0 @parameter fn vecvar[nelts: Int](idx: Int): var diff = t.load[nelts](idx) - mu variance += (diff * diff).reduce_add() vectorize[vecvar, nelts](t.num_elements()) return sqrt(variance / t.num_elements()) @always_inline fn tsum(inout res: Tensor[dtype], t: Tensor[dtype], axis: Int): var starting_value = 0 reduce[add, _reduce_sum](res, t, axis, starting_value) @always_inline fn tmean(inout res: Tensor[dtype], t: Tensor[dtype], axis: Int): var num_elements_axis: Scalar[dtype] = t.dim(axis) tsum(res, t, axis) elwise_op[div](res, res, num_elements_axis) @always_inline fn tstd(inout res: Tensor[dtype], t: Tensor[dtype], axis: Int): var mu = Tensor[dtype](get_reduce_shape(t.shape(), axis)) tmean(mu, t, axis) var num_elements_axis: Scalar[dtype] = t.dim(axis) var strides = t.strides() var strides_mu = mu.strides() @parameter fn get_t_index( i: Int, j: Int, axis: Int, shape: TensorShape, strides: StaticIntTuple[MAX_RANK] ) -> Int: var index_res = 0 for k in range(shape.rank()): if k == axis: index_res += j * strides[k] else: index_res += (i % shape[k]) * strides[k] return index_res @parameter fn get_mu_index( i: Int, axis: Int, shape: TensorShape, strides: StaticIntTuple[MAX_RANK] ) -> Int: var index_res = 0 for k in range(shape.rank()): if k != axis: index_res += (i % shape[k]) * strides[k] return index_res for i in range(t.num_elements() // t.dim(axis)): var mu_index = get_mu_index(i, axis, mu.shape(), strides_mu) @parameter fn vecvar[nelts: Int](j: Int): var t_index = get_t_index(i, j, axis, t.shape(), strides) var diff = t.load[nelts](t_index) - mu[mu_index] res[i] += (diff * diff).reduce_add() vectorize[vecvar, nelts](t.dim(axis)) res[i] /= num_elements_axis _ = (strides, strides_mu) elwise_transform[sqrt](res, res) @always_inline fn _reduce_max[ type: DType, simd_width: Int ](x: SIMD[type, simd_width]) -> Scalar[type]: return x.reduce_max() @always_inline fn tmax(t: Tensor[dtype]) -> Scalar[dtype]: var starting_value = min_finite[dtype]() return reduce[max, _reduce_max](t, starting_value) @always_inline fn tmax(inout res: Tensor[dtype], t: Tensor[dtype], axis: Int): var starting_value = min_finite[dtype]() reduce[max, _reduce_max](res, t, axis, starting_value) # @always_inline # fn transpose[ # dtype: DType, nelts: Int # ](t: Tensor[dtype], dim_0: Int, dim_1: Int) -> Tensor[dtype]: # """ # Create a new tensor transposing dim_0 and dim_1. # """ # var axes = DynamicVector[Int](t.rank()) # for i in range(t.rank()): # if i == dim_0: # axes.push_back(dim_1) # elif i == dim_1: # axes.push_back(dim_0) # else: # axes.push_back(i) # return transpose[dtype, nelts](t, axes) # @always_inline # fn transpose(inout res: Tensor[dtype], t: Tensor[dtype]): # """ # Create a new transposed tensor of the given tensor t. # """ # var axes = DynamicVector[Int](capacity=t.rank()) # for i in range(t.rank() - 1, -1, -1): # axes.push_back(i) # var axes_shape = TensorShape(axes) # transpose(res, t, axes_shape) # @always_inline # fn transpose(t: Tensor[dtype], axes: DynamicVector[Int]) -> Tensor[dtype]: # var new_shape = DynamicVector[Int](capacity=t.rank()) # for i in range(t.rank()): # new_shape.push_back(t.dim(axes[i])) # var t_new_shape = TensorShape(new_shape) # var t_new = Tensor[dtype](t_new_shape) # transpose(t_new, t, t_new_shape) # return t_new @always_inline fn get_transpose_shape(t: TensorShape, axes: TensorShape) -> TensorShape: var rank = t.rank() var new_shape = StaticIntTuple[MAX_RANK]() for i in range(rank): new_shape[i] = t[axes[i]] return TensorShape(rank=rank, shape=new_shape) @always_inline fn transpose(t: Tensor[dtype], axes: TensorShape) -> Tensor[dtype]: var t_new_shape = get_transpose_shape(t.shape(), axes) var t_new = Tensor[dtype](t_new_shape) transpose(t_new, t, axes) return t_new ^ @always_inline fn transpose(inout res: Tensor[dtype], t: Tensor[dtype], axes: TensorShape): """ Create a new transposed tensor of the given tensor t. """ # NOTE: The rank of of the t tensor should be 2 or more # NOTE: Axes should be the same size as the rank of t var original_strides = t.strides() var transposed_strides = res.strides() var position_of_last_rank_new_shape = 0 # Get position of where the last dim of the old shape is in the new shape for i in range(axes.rank()): if t.rank() - 1 == axes[i]: position_of_last_rank_new_shape = i @parameter fn p_transpose(i: Int): @parameter fn v_transpose[nelts: Int](j: Int): var new_index = 0 var original_index = i * t.dim(t.rank() - 1) + j var linear_index = original_index for k in range(t.rank()): # axes tells us the position of where the dim in the transposed shape is located in the original shape var stride = original_strides[axes[k]] var index = linear_index // stride % t.dim(axes[k]) new_index += index * transposed_strides[k] res.data().offset(new_index).simd_strided_store[nelts]( t.load[nelts](original_index), transposed_strides[position_of_last_rank_new_shape], ) vectorize[v_transpose, nelts](t.dim(t.rank() - 1)) parallelize[p_transpose](t.num_elements() // t.dim(t.rank() - 1)) _ = (original_strides, transposed_strides) # # NOTE: This function can be used for later for optimziation (Many operations in gpu is preferred to pad the tensors when using conv or matmul operations) # # TODO: Deprecate this function, as it is not used anymore # @always_inline # fn pad_zeros[ # dtype: DType, nelts: Int # ](t: Tensor[dtype], pad_with: DynamicVector[Int]) -> Tensor[dtype]: # """ # Pad a tensor with zeros along the specified axes of an N dimensional tensor. # Number of values padded to the edges of each axis. # Example: ((before_1, after_1), ... (before_N, after_N)). # """ # # NOTE: The rank of of the t tensor should be equal to the size of pad_with devided by 2. # # As pad_with contains (before, after) number of paddings for each axis. # var new_shape = DynamicVector[Int](t.rank()) # for i in range(t.rank()): # new_shape.push_back(t.dim(i) + pad_with[i * 2] + pad_with[i * 2 + 1]) # var t_new = Tensor[dtype](new_shape) # var original_strides = t.strides() # var result_strides = t_new.strides() # # Parallelize over the first axis # # NOTE: Possible dynamically choose the axis to parallelize over # @parameter # fn p_pad(i: Int): # for j in range(t.num_elements() // t.dim(0)): # var original_index = i * original_strides[0] + j # # Padding contribution of the first dimention # var dest_index = (i + pad_with[0]) * result_strides[0] # # Calculate the contribution from each dimension # var remaining_index = j % original_strides[0] # for dim in range(1, t.rank()): # var stride = original_strides[dim] # var index = remaining_index // stride # remaining_index = remaining_index % stride # dest_index += (index + pad_with[dim * 2]) * result_strides[dim] # # TODO: figure out vectorization # t_new[dest_index] = t[original_index] # parallelize[p_pad](t.dim(0)) # _ = (original_strides, result_strides) # return t_new --- examples/data/housing.csv --- CRIM,ZN,INDUS,CHAS,NOX,RM,AGE,DIS,RAD,TAX,PTRATIO,B,LSTAT,MEDV 0.00632,18.0,2.31,0,0.538,6.575,65.2,4.09,1,296.0,15.3,396.9,4.98,24.0 0.02731,0.0,7.07,0,0.469,6.421,78.9,4.9671,2,242.0,17.8,396.9,9.14,21.6 0.02729,0.0,7.07,0,0.469,7.185,61.1,4.9671,2,242.0,17.8,392.83,4.03,34.7 0.03237,0.0,2.18,0,0.458,6.998,45.8,6.0622,3,222.0,18.7,394.63,2.94,33.4 0.06905,0.0,2.18,0,0.458,7.147,54.2,6.0622,3,222.0,18.7,396.9,5.33,36.2 0.02985,0.0,2.18,0,0.458,6.43,58.7,6.0622,3,222.0,18.7,394.12,5.21,28.7 0.08829,12.5,7.87,0,0.524,6.012,66.6,5.5605,5,311.0,15.2,395.6,12.43,22.9 0.14455,12.5,7.87,0,0.524,6.172,96.1,5.9505,5,311.0,15.2,396.9,19.15,27.1 0.21124,12.5,7.87,0,0.524,5.631,100.0,6.0821,5,311.0,15.2,386.63,29.93,16.5 0.17004,12.5,7.87,0,0.524,6.004,85.9,6.5921,5,311.0,15.2,386.71,17.1,18.9 0.22489,12.5,7.87,0,0.524,6.377,94.3,6.3467,5,311.0,15.2,392.52,20.45,15.0 0.11747,12.5,7.87,0,0.524,6.009,82.9,6.2267,5,311.0,15.2,396.9,13.27,18.9 0.09378,12.5,7.87,0,0.524,5.889,39.0,5.4509,5,311.0,15.2,390.5,15.71,21.7 0.62976,0.0,8.14,0,0.538,5.949,61.8,4.7075,4,307.0,21.0,396.9,8.26,20.4 0.63796,0.0,8.14,0,0.538,6.096,84.5,4.4619,4,307.0,21.0,380.02,10.26,18.2 0.62739,0.0,8.14,0,0.538,5.834,56.5,4.4986,4,307.0,21.0,395.62,8.47,19.9 1.05393,0.0,8.14,0,0.538,5.935,29.3,4.4986,4,307.0,21.0,386.85,6.58,23.1 0.7842,0.0,8.14,0,0.538,5.99,81.7,4.2579,4,307.0,21.0,386.75,14.67,17.5 0.80271,0.0,8.14,0,0.538,5.456,36.6,3.7965,4,307.0,21.0,288.99,11.69,20.2 0.7258,0.0,8.14,0,0.538,5.727,69.5,3.7965,4,307.0,21.0,390.95,11.28,18.2 1.25179,0.0,8.14,0,0.538,5.57,98.1,3.7979,4,307.0,21.0,376.57,21.02,13.6 0.85204,0.0,8.14,0,0.538,5.965,89.2,4.0123,4,307.0,21.0,392.53,13.83,19.6 1.23247,0.0,8.14,0,0.538,6.142,91.7,3.9769,4,307.0,21.0,396.9,18.72,15.2 0.98843,0.0,8.14,0,0.538,5.813,100.0,4.0952,4,307.0,21.0,394.54,19.88,14.5 0.75026,0.0,8.14,0,0.538,5.924,94.1,4.3996,4,307.0,21.0,394.33,16.3,15.6 0.84054,0.0,8.14,0,0.538,5.599,85.7,4.4546,4,307.0,21.0,303.42,16.51,13.9 0.67191,0.0,8.14,0,0.538,5.813,90.3,4.682,4,307.0,21.0,376.88,14.81,16.6 0.95577,0.0,8.14,0,0.538,6.047,88.8,4.4534,4,307.0,21.0,306.38,17.28,14.8 0.77299,0.0,8.14,0,0.538,6.495,94.4,4.4547,4,307.0,21.0,387.94,12.8,18.4 1.00245,0.0,8.14,0,0.538,6.674,87.3,4.239,4,307.0,21.0,380.23,11.98,21.0 1.13081,0.0,8.14,0,0.538,5.713,94.1,4.233,4,307.0,21.0,360.17,22.6,12.7 1.35472,0.0,8.14,0,0.538,6.072,100.0,4.175,4,307.0,21.0,376.73,13.04,14.5 1.38799,0.0,8.14,0,0.538,5.95,82.0,3.99,4,307.0,21.0,232.6,27.71,13.2 1.15172,0.0,8.14,0,0.538,5.701,95.0,3.7872,4,307.0,21.0,358.77,18.35,13.1 1.61282,0.0,8.14,0,0.538,6.096,96.9,3.7598,4,307.0,21.0,248.31,20.34,13.5 0.06417,0.0,5.96,0,0.499,5.933,68.2,3.3603,5,279.0,19.2,396.9,9.68,18.9 0.09744,0.0,5.96,0,0.499,5.841,61.4,3.3779,5,279.0,19.2,377.56,11.41,20.0 0.08014,0.0,5.96,0,0.499,5.85,41.5,3.9342,5,279.0,19.2,396.9,8.77,21.0 0.17505,0.0,5.96,0,0.499,5.966,30.2,3.8473,5,279.0,19.2,393.43,10.13,24.7 0.02763,75.0,2.95,0,0.428,6.595,21.8,5.4011,3,252.0,18.3,395.63,4.32,30.8 0.03359,75.0,2.95,0,0.428,7.024,15.8,5.4011,3,252.0,18.3,395.62,1.98,34.9 0.12744,0.0,6.91,0,0.448,6.77,2.9,5.7209,3,233.0,17.9,385.41,4.84,26.6 0.1415,0.0,6.91,0,0.448,6.169,6.6,5.7209,3,233.0,17.9,383.37,5.81,25.3 0.15936,0.0,6.91,0,0.448,6.211,6.5,5.7209,3,233.0,17.9,394.46,7.44,24.7 0.12269,0.0,6.91,0,0.448,6.069,40.0,5.7209,3,233.0,17.9,389.39,9.55,21.2 0.17142,0.0,6.91,0,0.448,5.682,33.8,5.1004,3,233.0,17.9,396.9,10.21,19.3 0.18836,0.0,6.91,0,0.448,5.786,33.3,5.1004,3,233.0,17.9,396.9,14.15,20.0 0.22927,0.0,6.91,0,0.448,6.03,85.5,5.6894,3,233.0,17.9,392.74,18.8,16.6 0.25387,0.0,6.91,0,0.448,5.399,95.3,5.87,3,233.0,17.9,396.9,30.81,14.4 0.21977,0.0,6.91,0,0.448,5.602,62.0,6.0877,3,233.0,17.9,396.9,16.2,19.4 0.08873,21.0,5.64,0,0.439,5.963,45.7,6.8147,4,243.0,16.8,395.56,13.45,19.7 0.04337,21.0,5.64,0,0.439,6.115,63.0,6.8147,4,243.0,16.8,393.97,9.43,20.5 0.0536,21.0,5.64,0,0.439,6.511,21.1,6.8147,4,243.0,16.8,396.9,5.28,25.0 0.04981,21.0,5.64,0,0.439,5.998,21.4,6.8147,4,243.0,16.8,396.9,8.43,23.4 0.0136,75.0,4.0,0,0.41,5.888,47.6,7.3197,3,469.0,21.1,396.9,14.8,18.9 0.01311,90.0,1.22,0,0.403,7.249,21.9,8.6966,5,226.0,17.9,395.93,4.81,35.4 0.02055,85.0,0.74,0,0.41,6.383,35.7,9.1876,2,313.0,17.3,396.9,5.77,24.7 0.01432,100.0,1.32,0,0.411,6.816,40.5,8.3248,5,256.0,15.1,392.9,3.95,31.6 0.15445,25.0,5.13,0,0.453,6.145,29.2,7.8148,8,284.0,19.7,390.68,6.86,23.3 0.10328,25.0,5.13,0,0.453,5.927,47.2,6.932,8,284.0,19.7,396.9,9.22,19.6 0.14932,25.0,5.13,0,0.453,5.741,66.2,7.2254,8,284.0,19.7,395.11,13.15,18.7 0.17171,25.0,5.13,0,0.453,5.966,93.4,6.8185,8,284.0,19.7,378.08,14.44,16.0 0.11027,25.0,5.13,0,0.453,6.456,67.8,7.2255,8,284.0,19.7,396.9,6.73,22.2 0.1265,25.0,5.13,0,0.453,6.762,43.4,7.9809,8,284.0,19.7,395.58,9.5,25.0 0.01951,17.5,1.38,0,0.4161,7.104,59.5,9.2229,3,216.0,18.6,393.24,8.05,33.0 0.03584,80.0,3.37,0,0.398,6.29,17.8,6.6115,4,337.0,16.1,396.9,4.67,23.5 0.04379,80.0,3.37,0,0.398,5.787,31.1,6.6115,4,337.0,16.1,396.9,10.24,19.4 0.05789,12.5,6.07,0,0.409,5.878,21.4,6.498,4,345.0,18.9,396.21,8.1,22.0 0.13554,12.5,6.07,0,0.409,5.594,36.8,6.498,4,345.0,18.9,396.9,13.09,17.4 0.12816,12.5,6.07,0,0.409,5.885,33.0,6.498,4,345.0,18.9,396.9,8.79,20.9 0.08826,0.0,10.81,0,0.413,6.417,6.6,5.2873,4,305.0,19.2,383.73,6.72,24.2 0.15876,0.0,10.81,0,0.413,5.961,17.5,5.2873,4,305.0,19.2,376.94,9.88,21.7 0.09164,0.0,10.81,0,0.413,6.065,7.8,5.2873,4,305.0,19.2,390.91,5.52,22.8 0.19539,0.0,10.81,0,0.413,6.245,6.2,5.2873,4,305.0,19.2,377.17,7.54,23.4 0.07896,0.0,12.83,0,0.437,6.273,6.0,4.2515,5,398.0,18.7,394.92,6.78,24.1 0.09512,0.0,12.83,0,0.437,6.286,45.0,4.5026,5,398.0,18.7,383.23,8.94,21.4 0.10153,0.0,12.83,0,0.437,6.279,74.5,4.0522,5,398.0,18.7,373.66,11.97,20.0 0.08707,0.0,12.83,0,0.437,6.14,45.8,4.0905,5,398.0,18.7,386.96,10.27,20.8 0.05646,0.0,12.83,0,0.437,6.232,53.7,5.0141,5,398.0,18.7,386.4,12.34,21.2 0.08387,0.0,12.83,0,0.437,5.874,36.6,4.5026,5,398.0,18.7,396.06,9.1,20.3 0.04113,25.0,4.86,0,0.426,6.727,33.5,5.4007,4,281.0,19.0,396.9,5.29,28.0 0.04462,25.0,4.86,0,0.426,6.619,70.4,5.4007,4,281.0,19.0,395.63,7.22,23.9 0.03659,25.0,4.86,0,0.426,6.302,32.2,5.4007,4,281.0,19.0,396.9,6.72,24.8 0.03551,25.0,4.86,0,0.426,6.167,46.7,5.4007,4,281.0,19.0,390.64,7.51,22.9 0.05059,0.0,4.49,0,0.449,6.389,48.0,4.7794,3,247.0,18.5,396.9,9.62,23.9 0.05735,0.0,4.49,0,0.449,6.63,56.1,4.4377,3,247.0,18.5,392.3,6.53,26.6 0.05188,0.0,4.49,0,0.449,6.015,45.1,4.4272,3,247.0,18.5,395.99,12.86,22.5 0.07151,0.0,4.49,0,0.449,6.121,56.8,3.7476,3,247.0,18.5,395.15,8.44,22.2 0.0566,0.0,3.41,0,0.489,7.007,86.3,3.4217,2,270.0,17.8,396.9,5.5,23.6 0.05302,0.0,3.41,0,0.489,7.079,63.1,3.4145,2,270.0,17.8,396.06,5.7,28.7 0.04684,0.0,3.41,0,0.489,6.417,66.1,3.0923,2,270.0,17.8,392.18,8.81,22.6 0.03932,0.0,3.41,0,0.489,6.405,73.9,3.0921,2,270.0,17.8,393.55,8.2,22.0 0.04203,28.0,15.04,0,0.464,6.442,53.6,3.6659,4,270.0,18.2,395.01,8.16,22.9 0.02875,28.0,15.04,0,0.464,6.211,28.9,3.6659,4,270.0,18.2,396.33,6.21,25.0 0.04294,28.0,15.04,0,0.464,6.249,77.3,3.615,4,270.0,18.2,396.9,10.59,20.6 0.12204,0.0,2.89,0,0.445,6.625,57.8,3.4952,2,276.0,18.0,357.98,6.65,28.4 0.11504,0.0,2.89,0,0.445,6.163,69.6,3.4952,2,276.0,18.0,391.83,11.34,21.4 0.12083,0.0,2.89,0,0.445,8.069,76.0,3.4952,2,276.0,18.0,396.9,4.21,38.7 0.08187,0.0,2.89,0,0.445,7.82,36.9,3.4952,2,276.0,18.0,393.53,3.57,43.8 0.0686,0.0,2.89,0,0.445,7.416,62.5,3.4952,2,276.0,18.0,396.9,6.19,33.2 0.14866,0.0,8.56,0,0.52,6.727,79.9,2.7778,5,384.0,20.9,394.76,9.42,27.5 0.11432,0.0,8.56,0,0.52,6.781,71.3,2.8561,5,384.0,20.9,395.58,7.67,26.5 0.22876,0.0,8.56,0,0.52,6.405,85.4,2.7147,5,384.0,20.9,70.8,10.63,18.6 0.21161,0.0,8.56,0,0.52,6.137,87.4,2.7147,5,384.0,20.9,394.47,13.44,19.3 0.1396,0.0,8.56,0,0.52,6.167,90.0,2.421,5,384.0,20.9,392.69,12.33,20.1 0.13262,0.0,8.56,0,0.52,5.851,96.7,2.1069,5,384.0,20.9,394.05,16.47,19.5 0.1712,0.0,8.56,0,0.52,5.836,91.9,2.211,5,384.0,20.9,395.67,18.66,19.5 0.13117,0.0,8.56,0,0.52,6.127,85.2,2.1224,5,384.0,20.9,387.69,14.09,20.4 0.12802,0.0,8.56,0,0.52,6.474,97.1,2.4329,5,384.0,20.9,395.24,12.27,19.8 0.26363,0.0,8.56,0,0.52,6.229,91.2,2.5451,5,384.0,20.9,391.23,15.55,19.4 0.10793,0.0,8.56,0,0.52,6.195,54.4,2.7778,5,384.0,20.9,393.49,13.0,21.7 0.10084,0.0,10.01,0,0.547,6.715,81.6,2.6775,6,432.0,17.8,395.59,10.16,22.8 0.12329,0.0,10.01,0,0.547,5.913,92.9,2.3534,6,432.0,17.8,394.95,16.21,18.8 0.22212,0.0,10.01,0,0.547,6.092,95.4,2.548,6,432.0,17.8,396.9,17.09,18.7 0.14231,0.0,10.01,0,0.547,6.254,84.2,2.2565,6,432.0,17.8,388.74,10.45,18.5 0.17134,0.0,10.01,0,0.547,5.928,88.2,2.4631,6,432.0,17.8,344.91,15.76,18.3 0.13158,0.0,10.01,0,0.547,6.176,72.5,2.7301,6,432.0,17.8,393.3,12.04,21.2 0.15098,0.0,10.01,0,0.547,6.021,82.6,2.7474,6,432.0,17.8,394.51,10.3,19.2 0.13058,0.0,10.01,0,0.547,5.872,73.1,2.4775,6,432.0,17.8,338.63,15.37,20.4 0.14476,0.0,10.01,0,0.547,5.731,65.2,2.7592,6,432.0,17.8,391.5,13.61,19.3 0.06899,0.0,25.65,0,0.581,5.87,69.7,2.2577,2,188.0,19.1,389.15,14.37,22.0 0.07165,0.0,25.65,0,0.581,6.004,84.1,2.1974,2,188.0,19.1,377.67,14.27,20.3 0.09299,0.0,25.65,0,0.581,5.961,92.9,2.0869,2,188.0,19.1,378.09,17.93,20.5 0.15038,0.0,25.65,0,0.581,5.856,97.0,1.9444,2,188.0,19.1,370.31,25.41,17.3 0.09849,0.0,25.65,0,0.581,5.879,95.8,2.0063,2,188.0,19.1,379.38,17.58,18.8 0.16902,0.0,25.65,0,0.581,5.986,88.4,1.9929,2,188.0,19.1,385.02,14.81,21.4 0.38735,0.0,25.65,0,0.581,5.613,95.6,1.7572,2,188.0,19.1,359.29,27.26,15.7 0.25915,0.0,21.89,0,0.624,5.693,96.0,1.7883,4,437.0,21.2,392.11,17.19,16.2 0.32543,0.0,21.89,0,0.624,6.431,98.8,1.8125,4,437.0,21.2,396.9,15.39,18.0 0.88125,0.0,21.89,0,0.624,5.637,94.7,1.9799,4,437.0,21.2,396.9,18.34,14.3 0.34006,0.0,21.89,0,0.624,6.458,98.9,2.1185,4,437.0,21.2,395.04,12.6,19.2 1.19294,0.0,21.89,0,0.624,6.326,97.7,2.271,4,437.0,21.2,396.9,12.26,19.6 0.59005,0.0,21.89,0,0.624,6.372,97.9,2.3274,4,437.0,21.2,385.76,11.12,23.0 0.32982,0.0,21.89,0,0.624,5.822,95.4,2.4699,4,437.0,21.2,388.69,15.03,18.4 0.97617,0.0,21.89,0,0.624,5.757,98.4,2.346,4,437.0,21.2,262.76,17.31,15.6 0.55778,0.0,21.89,0,0.624,6.335,98.2,2.1107,4,437.0,21.2,394.67,16.96,18.1 0.32264,0.0,21.89,0,0.624,5.942,93.5,1.9669,4,437.0,21.2,378.25,16.9,17.4 0.35233,0.0,21.89,0,0.624,6.454,98.4,1.8498,4,437.0,21.2,394.08,14.59,17.1 0.2498,0.0,21.89,0,0.624,5.857,98.2,1.6686,4,437.0,21.2,392.04,21.32,13.3 0.54452,0.0,21.89,0,0.624,6.151,97.9,1.6687,4,437.0,21.2,396.9,18.46,17.8 0.2909,0.0,21.89,0,0.624,6.174,93.6,1.6119,4,437.0,21.2,388.08,24.16,14.0 1.62864,0.0,21.89,0,0.624,5.019,100.0,1.4394,4,437.0,21.2,396.9,34.41,14.4 3.32105,0.0,19.58,1,0.871,5.403,100.0,1.3216,5,403.0,14.7,396.9,26.82,13.4 4.0974,0.0,19.58,0,0.871,5.468,100.0,1.4118,5,403.0,14.7,396.9,26.42,15.6 2.77974,0.0,19.58,0,0.871,4.903,97.8,1.3459,5,403.0,14.7,396.9,29.29,11.8 2.37934,0.0,19.58,0,0.871,6.13,100.0,1.4191,5,403.0,14.7,172.91,27.8,13.8 2.15505,0.0,19.58,0,0.871,5.628,100.0,1.5166,5,403.0,14.7,169.27,16.65,15.6 2.36862,0.0,19.58,0,0.871,4.926,95.7,1.4608,5,403.0,14.7,391.71,29.53,14.6 2.33099,0.0,19.58,0,0.871,5.186,93.8,1.5296,5,403.0,14.7,356.99,28.32,17.8 2.73397,0.0,19.58,0,0.871,5.597,94.9,1.5257,5,403.0,14.7,351.85,21.45,15.4 1.6566,0.0,19.58,0,0.871,6.122,97.3,1.618,5,403.0,14.7,372.8,14.1,21.5 1.49632,0.0,19.58,0,0.871,5.404,100.0,1.5916,5,403.0,14.7,341.6,13.28,19.6 1.12658,0.0,19.58,1,0.871,5.012,88.0,1.6102,5,403.0,14.7,343.28,12.12,15.3 2.14918,0.0,19.58,0,0.871,5.709,98.5,1.6232,5,403.0,14.7,261.95,15.79,19.4 1.41385,0.0,19.58,1,0.871,6.129,96.0,1.7494,5,403.0,14.7,321.02,15.12,17.0 3.53501,0.0,19.58,1,0.871,6.152,82.6,1.7455,5,403.0,14.7,88.01,15.02,15.6 2.44668,0.0,19.58,0,0.871,5.272,94.0,1.7364,5,403.0,14.7,88.63,16.14,13.1 1.22358,0.0,19.58,0,0.605,6.943,97.4,1.8773,5,403.0,14.7,363.43,4.59,41.3 1.34284,0.0,19.58,0,0.605,6.066,100.0,1.7573,5,403.0,14.7,353.89,6.43,24.3 1.42502,0.0,19.58,0,0.871,6.51,100.0,1.7659,5,403.0,14.7,364.31,7.39,23.3 1.27346,0.0,19.58,1,0.605,6.25,92.6,1.7984,5,403.0,14.7,338.92,5.5,27.0 1.46336,0.0,19.58,0,0.605,7.489,90.8,1.9709,5,403.0,14.7,374.43,1.73,50.0 1.83377,0.0,19.58,1,0.605,7.802,98.2,2.0407,5,403.0,14.7,389.61,1.92,50.0 1.51902,0.0,19.58,1,0.605,8.375,93.9,2.162,5,403.0,14.7,388.45,3.32,50.0 2.24236,0.0,19.58,0,0.605,5.854,91.8,2.422,5,403.0,14.7,395.11,11.64,22.7 2.924,0.0,19.58,0,0.605,6.101,93.0,2.2834,5,403.0,14.7,240.16,9.81,25.0 2.01019,0.0,19.58,0,0.605,7.929,96.2,2.0459,5,403.0,14.7,369.3,3.7,50.0 1.80028,0.0,19.58,0,0.605,5.877,79.2,2.4259,5,403.0,14.7,227.61,12.14,23.8 2.3004,0.0,19.58,0,0.605,6.319,96.1,2.1,5,403.0,14.7,297.09,11.1,23.8 2.44953,0.0,19.58,0,0.605,6.402,95.2,2.2625,5,403.0,14.7,330.04,11.32,22.3 1.20742,0.0,19.58,0,0.605,5.875,94.6,2.4259,5,403.0,14.7,292.29,14.43,17.4 2.3139,0.0,19.58,0,0.605,5.88,97.3,2.3887,5,403.0,14.7,348.13,12.03,19.1 0.13914,0.0,4.05,0,0.51,5.572,88.5,2.5961,5,296.0,16.6,396.9,14.69,23.1 0.09178,0.0,4.05,0,0.51,6.416,84.1,2.6463,5,296.0,16.6,395.5,9.04,23.6 0.08447,0.0,4.05,0,0.51,5.859,68.7,2.7019,5,296.0,16.6,393.23,9.64,22.6 0.06664,0.0,4.05,0,0.51,6.546,33.1,3.1323,5,296.0,16.6,390.96,5.33,29.4 0.07022,0.0,4.05,0,0.51,6.02,47.2,3.5549,5,296.0,16.6,393.23,10.11,23.2 0.05425,0.0,4.05,0,0.51,6.315,73.4,3.3175,5,296.0,16.6,395.6,6.29,24.6 0.06642,0.0,4.05,0,0.51,6.86,74.4,2.9153,5,296.0,16.6,391.27,6.92,29.9 0.0578,0.0,2.46,0,0.488,6.98,58.4,2.829,3,193.0,17.8,396.9,5.04,37.2 0.06588,0.0,2.46,0,0.488,7.765,83.3,2.741,3,193.0,17.8,395.56,7.56,39.8 0.06888,0.0,2.46,0,0.488,6.144,62.2,2.5979,3,193.0,17.8,396.9,9.45,36.2 0.09103,0.0,2.46,0,0.488,7.155,92.2,2.7006,3,193.0,17.8,394.12,4.82,37.9 0.10008,0.0,2.46,0,0.488,6.563,95.6,2.847,3,193.0,17.8,396.9,5.68,32.5 0.08308,0.0,2.46,0,0.488,5.604,89.8,2.9879,3,193.0,17.8,391.0,13.98,26.4 0.06047,0.0,2.46,0,0.488,6.153,68.8,3.2797,3,193.0,17.8,387.11,13.15,29.6 0.05602,0.0,2.46,0,0.488,7.831,53.6,3.1992,3,193.0,17.8,392.63,4.45,50.0 0.07875,45.0,3.44,0,0.437,6.782,41.1,3.7886,5,398.0,15.2,393.87,6.68,32.0 0.12579,45.0,3.44,0,0.437,6.556,29.1,4.5667,5,398.0,15.2,382.84,4.56,29.8 0.0837,45.0,3.44,0,0.437,7.185,38.9,4.5667,5,398.0,15.2,396.9,5.39,34.9 0.09068,45.0,3.44,0,0.437,6.951,21.5,6.4798,5,398.0,15.2,377.68,5.1,37.0 0.06911,45.0,3.44,0,0.437,6.739,30.8,6.4798,5,398.0,15.2,389.71,4.69,30.5 0.08664,45.0,3.44,0,0.437,7.178,26.3,6.4798,5,398.0,15.2,390.49,2.87,36.4 0.02187,60.0,2.93,0,0.401,6.8,9.9,6.2196,1,265.0,15.6,393.37,5.03,31.1 0.01439,60.0,2.93,0,0.401,6.604,18.8,6.2196,1,265.0,15.6,376.7,4.38,29.1 0.01381,80.0,0.46,0,0.422,7.875,32.0,5.6484,4,255.0,14.4,394.23,2.97,50.0 0.04011,80.0,1.52,0,0.404,7.287,34.1,7.309,2,329.0,12.6,396.9,4.08,33.3 0.04666,80.0,1.52,0,0.404,7.107,36.6,7.309,2,329.0,12.6,354.31,8.61,30.3 0.03768,80.0,1.52,0,0.404,7.274,38.3,7.309,2,329.0,12.6,392.2,6.62,34.6 0.0315,95.0,1.47,0,0.403,6.975,15.3,7.6534,3,402.0,17.0,396.9,4.56,34.9 0.01778,95.0,1.47,0,0.403,7.135,13.9,7.6534,3,402.0,17.0,384.3,4.45,32.9 0.03445,82.5,2.03,0,0.415,6.162,38.4,6.27,2,348.0,14.7,393.77,7.43,24.1 0.02177,82.5,2.03,0,0.415,7.61,15.7,6.27,2,348.0,14.7,395.38,3.11,42.3 0.0351,95.0,2.68,0,0.4161,7.853,33.2,5.118,4,224.0,14.7,392.78,3.81,48.5 0.02009,95.0,2.68,0,0.4161,8.034,31.9,5.118,4,224.0,14.7,390.55,2.88,50.0 0.13642,0.0,10.59,0,0.489,5.891,22.3,3.9454,4,277.0,18.6,396.9,10.87,22.6 0.22969,0.0,10.59,0,0.489,6.326,52.5,4.3549,4,277.0,18.6,394.87,10.97,24.4 0.25199,0.0,10.59,0,0.489,5.783,72.7,4.3549,4,277.0,18.6,389.43,18.06,22.5 0.13587,0.0,10.59,1,0.489,6.064,59.1,4.2392,4,277.0,18.6,381.32,14.66,24.4 0.43571,0.0,10.59,1,0.489,5.344,100.0,3.875,4,277.0,18.6,396.9,23.09,20.0 0.17446,0.0,10.59,1,0.489,5.96,92.1,3.8771,4,277.0,18.6,393.25,17.27,21.7 0.37578,0.0,10.59,1,0.489,5.404,88.6,3.665,4,277.0,18.6,395.24,23.98,19.3 0.21719,0.0,10.59,1,0.489,5.807,53.8,3.6526,4,277.0,18.6,390.94,16.03,22.4 0.14052,0.0,10.59,0,0.489,6.375,32.3,3.9454,4,277.0,18.6,385.81,9.38,28.1 0.28955,0.0,10.59,0,0.489,5.412,9.8,3.5875,4,277.0,18.6,348.93,29.55,23.7 0.19802,0.0,10.59,0,0.489,6.182,42.4,3.9454,4,277.0,18.6,393.63,9.47,25.0 0.0456,0.0,13.89,1,0.55,5.888,56.0,3.1121,5,276.0,16.4,392.8,13.51,23.3 0.07013,0.0,13.89,0,0.55,6.642,85.1,3.4211,5,276.0,16.4,392.78,9.69,28.7 0.11069,0.0,13.89,1,0.55,5.951,93.8,2.8893,5,276.0,16.4,396.9,17.92,21.5 0.11425,0.0,13.89,1,0.55,6.373,92.4,3.3633,5,276.0,16.4,393.74,10.5,23.0 0.35809,0.0,6.2,1,0.507,6.951,88.5,2.8617,8,307.0,17.4,391.7,9.71,26.7 0.40771,0.0,6.2,1,0.507,6.164,91.3,3.048,8,307.0,17.4,395.24,21.46,21.7 0.62356,0.0,6.2,1,0.507,6.879,77.7,3.2721,8,307.0,17.4,390.39,9.93,27.5 0.6147,0.0,6.2,0,0.507,6.618,80.8,3.2721,8,307.0,17.4,396.9,7.6,30.1 0.31533,0.0,6.2,0,0.504,8.266,78.3,2.8944,8,307.0,17.4,385.05,4.14,44.8 0.52693,0.0,6.2,0,0.504,8.725,83.0,2.8944,8,307.0,17.4,382.0,4.63,50.0 0.38214,0.0,6.2,0,0.504,8.04,86.5,3.2157,8,307.0,17.4,387.38,3.13,37.6 0.41238,0.0,6.2,0,0.504,7.163,79.9,3.2157,8,307.0,17.4,372.08,6.36,31.6 0.29819,0.0,6.2,0,0.504,7.686,17.0,3.3751,8,307.0,17.4,377.51,3.92,46.7 0.44178,0.0,6.2,0,0.504,6.552,21.4,3.3751,8,307.0,17.4,380.34,3.76,31.5 0.537,0.0,6.2,0,0.504,5.981,68.1,3.6715,8,307.0,17.4,378.35,11.65,24.3 0.46296,0.0,6.2,0,0.504,7.412,76.9,3.6715,8,307.0,17.4,376.14,5.25,31.7 0.57529,0.0,6.2,0,0.507,8.337,73.3,3.8384,8,307.0,17.4,385.91,2.47,41.7 0.33147,0.0,6.2,0,0.507,8.247,70.4,3.6519,8,307.0,17.4,378.95,3.95,48.3 0.44791,0.0,6.2,1,0.507,6.726,66.5,3.6519,8,307.0,17.4,360.2,8.05,29.0 0.33045,0.0,6.2,0,0.507,6.086,61.5,3.6519,8,307.0,17.4,376.75,10.88,24.0 0.52058,0.0,6.2,1,0.507,6.631,76.5,4.148,8,307.0,17.4,388.45,9.54,25.1 0.51183,0.0,6.2,0,0.507,7.358,71.6,4.148,8,307.0,17.4,390.07,4.73,31.5 0.08244,30.0,4.93,0,0.428,6.481,18.5,6.1899,6,300.0,16.6,379.41,6.36,23.7 0.09252,30.0,4.93,0,0.428,6.606,42.2,6.1899,6,300.0,16.6,383.78,7.37,23.3 0.11329,30.0,4.93,0,0.428,6.897,54.3,6.3361,6,300.0,16.6,391.25,11.38,22.0 0.10612,30.0,4.93,0,0.428,6.095,65.1,6.3361,6,300.0,16.6,394.62,12.4,20.1 0.1029,30.0,4.93,0,0.428,6.358,52.9,7.0355,6,300.0,16.6,372.75,11.22,22.2 0.12757,30.0,4.93,0,0.428,6.393,7.8,7.0355,6,300.0,16.6,374.71,5.19,23.7 0.20608,22.0,5.86,0,0.431,5.593,76.5,7.9549,7,330.0,19.1,372.49,12.5,17.6 0.19133,22.0,5.86,0,0.431,5.605,70.2,7.9549,7,330.0,19.1,389.13,18.46,18.5 0.33983,22.0,5.86,0,0.431,6.108,34.9,8.0555,7,330.0,19.1,390.18,9.16,24.3 0.19657,22.0,5.86,0,0.431,6.226,79.2,8.0555,7,330.0,19.1,376.14,10.15,20.5 0.16439,22.0,5.86,0,0.431,6.433,49.1,7.8265,7,330.0,19.1,374.71,9.52,24.5 0.19073,22.0,5.86,0,0.431,6.718,17.5,7.8265,7,330.0,19.1,393.74,6.56,26.2 0.1403,22.0,5.86,0,0.431,6.487,13.0,7.3967,7,330.0,19.1,396.28,5.9,24.4 0.21409,22.0,5.86,0,0.431,6.438,8.9,7.3967,7,330.0,19.1,377.07,3.59,24.8 0.08221,22.0,5.86,0,0.431,6.957,6.8,8.9067,7,330.0,19.1,386.09,3.53,29.6 0.36894,22.0,5.86,0,0.431,8.259,8.4,8.9067,7,330.0,19.1,396.9,3.54,42.8 0.04819,80.0,3.64,0,0.392,6.108,32.0,9.2203,1,315.0,16.4,392.89,6.57,21.9 0.03548,80.0,3.64,0,0.392,5.876,19.1,9.2203,1,315.0,16.4,395.18,9.25,20.9 0.01538,90.0,3.75,0,0.394,7.454,34.2,6.3361,3,244.0,15.9,386.34,3.11,44.0 0.61154,20.0,3.97,0,0.647,8.704,86.9,1.801,5,264.0,13.0,389.7,5.12,50.0 0.66351,20.0,3.97,0,0.647,7.333,100.0,1.8946,5,264.0,13.0,383.29,7.79,36.0 0.65665,20.0,3.97,0,0.647,6.842,100.0,2.0107,5,264.0,13.0,391.93,6.9,30.1 0.54011,20.0,3.97,0,0.647,7.203,81.8,2.1121,5,264.0,13.0,392.8,9.59,33.8 0.53412,20.0,3.97,0,0.647,7.52,89.4,2.1398,5,264.0,13.0,388.37,7.26,43.1 0.52014,20.0,3.97,0,0.647,8.398,91.5,2.2885,5,264.0,13.0,386.86,5.91,48.8 0.82526,20.0,3.97,0,0.647,7.327,94.5,2.0788,5,264.0,13.0,393.42,11.25,31.0 0.55007,20.0,3.97,0,0.647,7.206,91.6,1.9301,5,264.0,13.0,387.89,8.1,36.5 0.76162,20.0,3.97,0,0.647,5.56,62.8,1.9865,5,264.0,13.0,392.4,10.45,22.8 0.7857,20.0,3.97,0,0.647,7.014,84.6,2.1329,5,264.0,13.0,384.07,14.79,30.7 0.57834,20.0,3.97,0,0.575,8.297,67.0,2.4216,5,264.0,13.0,384.54,7.44,50.0 0.5405,20.0,3.97,0,0.575,7.47,52.6,2.872,5,264.0,13.0,390.3,3.16,43.5 0.09065,20.0,6.96,1,0.464,5.92,61.5,3.9175,3,223.0,18.6,391.34,13.65,20.7 0.29916,20.0,6.96,0,0.464,5.856,42.1,4.429,3,223.0,18.6,388.65,13.0,21.1 0.16211,20.0,6.96,0,0.464,6.24,16.3,4.429,3,223.0,18.6,396.9,6.59,25.2 0.1146,20.0,6.96,0,0.464,6.538,58.7,3.9175,3,223.0,18.6,394.96,7.73,24.4 0.22188,20.0,6.96,1,0.464,7.691,51.8,4.3665,3,223.0,18.6,390.77,6.58,35.2 0.05644,40.0,6.41,1,0.447,6.758,32.9,4.0776,4,254.0,17.6,396.9,3.53,32.4 0.09604,40.0,6.41,0,0.447,6.854,42.8,4.2673,4,254.0,17.6,396.9,2.98,32.0 0.10469,40.0,6.41,1,0.447,7.267,49.0,4.7872,4,254.0,17.6,389.25,6.05,33.2 0.06127,40.0,6.41,1,0.447,6.826,27.6,4.8628,4,254.0,17.6,393.45,4.16,33.1 0.07978,40.0,6.41,0,0.447,6.482,32.1,4.1403,4,254.0,17.6,396.9,7.19,29.1 0.21038,20.0,3.33,0,0.4429,6.812,32.2,4.1007,5,216.0,14.9,396.9,4.85,35.1 0.03578,20.0,3.33,0,0.4429,7.82,64.5,4.6947,5,216.0,14.9,387.31,3.76,45.4 0.03705,20.0,3.33,0,0.4429,6.968,37.2,5.2447,5,216.0,14.9,392.23,4.59,35.4 0.06129,20.0,3.33,1,0.4429,7.645,49.7,5.2119,5,216.0,14.9,377.07,3.01,46.0 0.01501,90.0,1.21,1,0.401,7.923,24.8,5.885,1,198.0,13.6,395.52,3.16,50.0 0.00906,90.0,2.97,0,0.4,7.088,20.8,7.3073,1,285.0,15.3,394.72,7.85,32.2 0.01096,55.0,2.25,0,0.389,6.453,31.9,7.3073,1,300.0,15.3,394.72,8.23,22.0 0.01965,80.0,1.76,0,0.385,6.23,31.5,9.0892,1,241.0,18.2,341.6,12.93,20.1 0.03871,52.5,5.32,0,0.405,6.209,31.3,7.3172,6,293.0,16.6,396.9,7.14,23.2 0.0459,52.5,5.32,0,0.405,6.315,45.6,7.3172,6,293.0,16.6,396.9,7.6,22.3 0.04297,52.5,5.32,0,0.405,6.565,22.9,7.3172,6,293.0,16.6,371.72,9.51,24.8 0.03502,80.0,4.95,0,0.411,6.861,27.9,5.1167,4,245.0,19.2,396.9,3.33,28.5 0.07886,80.0,4.95,0,0.411,7.148,27.7,5.1167,4,245.0,19.2,396.9,3.56,37.3 0.03615,80.0,4.95,0,0.411,6.63,23.4,5.1167,4,245.0,19.2,396.9,4.7,27.9 0.08265,0.0,13.92,0,0.437,6.127,18.4,5.5027,4,289.0,16.0,396.9,8.58,23.9 0.08199,0.0,13.92,0,0.437,6.009,42.3,5.5027,4,289.0,16.0,396.9,10.4,21.7 0.12932,0.0,13.92,0,0.437,6.678,31.1,5.9604,4,289.0,16.0,396.9,6.27,28.6 0.05372,0.0,13.92,0,0.437,6.549,51.0,5.9604,4,289.0,16.0,392.85,7.39,27.1 0.14103,0.0,13.92,0,0.437,5.79,58.0,6.32,4,289.0,16.0,396.9,15.84,20.3 0.06466,70.0,2.24,0,0.4,6.345,20.1,7.8278,5,358.0,14.8,368.24,4.97,22.5 0.05561,70.0,2.24,0,0.4,7.041,10.0,7.8278,5,358.0,14.8,371.58,4.74,29.0 0.04417,70.0,2.24,0,0.4,6.871,47.4,7.8278,5,358.0,14.8,390.86,6.07,24.8 0.03537,34.0,6.09,0,0.433,6.59,40.4,5.4917,7,329.0,16.1,395.75,9.5,22.0 0.09266,34.0,6.09,0,0.433,6.495,18.4,5.4917,7,329.0,16.1,383.61,8.67,26.4 0.1,34.0,6.09,0,0.433,6.982,17.7,5.4917,7,329.0,16.1,390.43,4.86,33.1 0.05515,33.0,2.18,0,0.472,7.236,41.1,4.022,7,222.0,18.4,393.68,6.93,36.1 0.05479,33.0,2.18,0,0.472,6.616,58.1,3.37,7,222.0,18.4,393.36,8.93,28.4 0.07503,33.0,2.18,0,0.472,7.42,71.9,3.0992,7,222.0,18.4,396.9,6.47,33.4 0.04932,33.0,2.18,0,0.472,6.849,70.3,3.1827,7,222.0,18.4,396.9,7.53,28.2 0.49298,0.0,9.9,0,0.544,6.635,82.5,3.3175,4,304.0,18.4,396.9,4.54,22.8 0.3494,0.0,9.9,0,0.544,5.972,76.7,3.1025,4,304.0,18.4,396.24,9.97,20.3 2.63548,0.0,9.9,0,0.544,4.973,37.8,2.5194,4,304.0,18.4,350.45,12.64,16.1 0.79041,0.0,9.9,0,0.544,6.122,52.8,2.6403,4,304.0,18.4,396.9,5.98,22.1 0.26169,0.0,9.9,0,0.544,6.023,90.4,2.834,4,304.0,18.4,396.3,11.72,19.4 0.26938,0.0,9.9,0,0.544,6.266,82.8,3.2628,4,304.0,18.4,393.39,7.9,21.6 0.3692,0.0,9.9,0,0.544,6.567,87.3,3.6023,4,304.0,18.4,395.69,9.28,23.8 0.25356,0.0,9.9,0,0.544,5.705,77.7,3.945,4,304.0,18.4,396.42,11.5,16.2 0.31827,0.0,9.9,0,0.544,5.914,83.2,3.9986,4,304.0,18.4,390.7,18.33,17.8 0.24522,0.0,9.9,0,0.544,5.782,71.7,4.0317,4,304.0,18.4,396.9,15.94,19.8 0.40202,0.0,9.9,0,0.544,6.382,67.2,3.5325,4,304.0,18.4,395.21,10.36,23.1 0.47547,0.0,9.9,0,0.544,6.113,58.8,4.0019,4,304.0,18.4,396.23,12.73,21.0 0.1676,0.0,7.38,0,0.493,6.426,52.3,4.5404,5,287.0,19.6,396.9,7.2,23.8 0.18159,0.0,7.38,0,0.493,6.376,54.3,4.5404,5,287.0,19.6,396.9,6.87,23.1 0.35114,0.0,7.38,0,0.493,6.041,49.9,4.7211,5,287.0,19.6,396.9,7.7,20.4 0.28392,0.0,7.38,0,0.493,5.708,74.3,4.7211,5,287.0,19.6,391.13,11.74,18.5 0.34109,0.0,7.38,0,0.493,6.415,40.1,4.7211,5,287.0,19.6,396.9,6.12,25.0 0.19186,0.0,7.38,0,0.493,6.431,14.7,5.4159,5,287.0,19.6,393.68,5.08,24.6 0.30347,0.0,7.38,0,0.493,6.312,28.9,5.4159,5,287.0,19.6,396.9,6.15,23.0 0.24103,0.0,7.38,0,0.493,6.083,43.7,5.4159,5,287.0,19.6,396.9,12.79,22.2 0.06617,0.0,3.24,0,0.46,5.868,25.8,5.2146,4,430.0,16.9,382.44,9.97,19.3 0.06724,0.0,3.24,0,0.46,6.333,17.2,5.2146,4,430.0,16.9,375.21,7.34,22.6 0.04544,0.0,3.24,0,0.46,6.144,32.2,5.8736,4,430.0,16.9,368.57,9.09,19.8 0.05023,35.0,6.06,0,0.4379,5.706,28.4,6.6407,1,304.0,16.9,394.02,12.43,17.1 0.03466,35.0,6.06,0,0.4379,6.031,23.3,6.6407,1,304.0,16.9,362.25,7.83,19.4 0.05083,0.0,5.19,0,0.515,6.316,38.1,6.4584,5,224.0,20.2,389.71,5.68,22.2 0.03738,0.0,5.19,0,0.515,6.31,38.5,6.4584,5,224.0,20.2,389.4,6.75,20.7 0.03961,0.0,5.19,0,0.515,6.037,34.5,5.9853,5,224.0,20.2,396.9,8.01,21.1 0.03427,0.0,5.19,0,0.515,5.869,46.3,5.2311,5,224.0,20.2,396.9,9.8,19.5 0.03041,0.0,5.19,0,0.515,5.895,59.6,5.615,5,224.0,20.2,394.81,10.56,18.5 0.03306,0.0,5.19,0,0.515,6.059,37.3,4.8122,5,224.0,20.2,396.14,8.51,20.6 0.05497,0.0,5.19,0,0.515,5.985,45.4,4.8122,5,224.0,20.2,396.9,9.74,19.0 0.06151,0.0,5.19,0,0.515,5.968,58.5,4.8122,5,224.0,20.2,396.9,9.29,18.7 0.01301,35.0,1.52,0,0.442,7.241,49.3,7.0379,1,284.0,15.5,394.74,5.49,32.7 0.02498,0.0,1.89,0,0.518,6.54,59.7,6.2669,1,422.0,15.9,389.96,8.65,16.5 0.02543,55.0,3.78,0,0.484,6.696,56.4,5.7321,5,370.0,17.6,396.9,7.18,23.9 0.03049,55.0,3.78,0,0.484,6.874,28.1,6.4654,5,370.0,17.6,387.97,4.61,31.2 0.03113,0.0,4.39,0,0.442,6.014,48.5,8.0136,3,352.0,18.8,385.64,10.53,17.5 0.06162,0.0,4.39,0,0.442,5.898,52.3,8.0136,3,352.0,18.8,364.61,12.67,17.2 0.0187,85.0,4.15,0,0.429,6.516,27.7,8.5353,4,351.0,17.9,392.43,6.36,23.1 0.01501,80.0,2.01,0,0.435,6.635,29.7,8.344,4,280.0,17.0,390.94,5.99,24.5 0.02899,40.0,1.25,0,0.429,6.939,34.5,8.7921,1,335.0,19.7,389.85,5.89,26.6 0.06211,40.0,1.25,0,0.429,6.49,44.4,8.7921,1,335.0,19.7,396.9,5.98,22.9 0.0795,60.0,1.69,0,0.411,6.579,35.9,10.7103,4,411.0,18.3,370.78,5.49,24.1 0.07244,60.0,1.69,0,0.411,5.884,18.5,10.7103,4,411.0,18.3,392.33,7.79,18.6 0.01709,90.0,2.02,0,0.41,6.728,36.1,12.1265,5,187.0,17.0,384.46,4.5,30.1 0.04301,80.0,1.91,0,0.413,5.663,21.9,10.5857,4,334.0,22.0,382.8,8.05,18.2 0.10659,80.0,1.91,0,0.413,5.936,19.5,10.5857,4,334.0,22.0,376.04,5.57,20.6 8.98296,0.0,18.1,1,0.77,6.212,97.4,2.1222,24,666.0,20.2,377.73,17.6,17.8 3.8497,0.0,18.1,1,0.77,6.395,91.0,2.5052,24,666.0,20.2,391.34,13.27,21.7 5.20177,0.0,18.1,1,0.77,6.127,83.4,2.7227,24,666.0,20.2,395.43,11.48,22.7 4.26131,0.0,18.1,0,0.77,6.112,81.3,2.5091,24,666.0,20.2,390.74,12.67,22.6 4.54192,0.0,18.1,0,0.77,6.398,88.0,2.5182,24,666.0,20.2,374.56,7.79,25.0 3.83684,0.0,18.1,0,0.77,6.251,91.1,2.2955,24,666.0,20.2,350.65,14.19,19.9 3.67822,0.0,18.1,0,0.77,5.362,96.2,2.1036,24,666.0,20.2,380.79,10.19,20.8 4.22239,0.0,18.1,1,0.77,5.803,89.0,1.9047,24,666.0,20.2,353.04,14.64,16.8 3.47428,0.0,18.1,1,0.718,8.78,82.9,1.9047,24,666.0,20.2,354.55,5.29,21.9 4.55587,0.0,18.1,0,0.718,3.561,87.9,1.6132,24,666.0,20.2,354.7,7.12,27.5 3.69695,0.0,18.1,0,0.718,4.963,91.4,1.7523,24,666.0,20.2,316.03,14.0,21.9 13.5222,0.0,18.1,0,0.631,3.863,100.0,1.5106,24,666.0,20.2,131.42,13.33,23.1 4.89822,0.0,18.1,0,0.631,4.97,100.0,1.3325,24,666.0,20.2,375.52,3.26,50.0 5.66998,0.0,18.1,1,0.631,6.683,96.8,1.3567,24,666.0,20.2,375.33,3.73,50.0 6.53876,0.0,18.1,1,0.631,7.016,97.5,1.2024,24,666.0,20.2,392.05,2.96,50.0 9.2323,0.0,18.1,0,0.631,6.216,100.0,1.1691,24,666.0,20.2,366.15,9.53,50.0 8.26725,0.0,18.1,1,0.668,5.875,89.6,1.1296,24,666.0,20.2,347.88,8.88,50.0 11.1081,0.0,18.1,0,0.668,4.906,100.0,1.1742,24,666.0,20.2,396.9,34.77,13.8 18.4982,0.0,18.1,0,0.668,4.138,100.0,1.137,24,666.0,20.2,396.9,37.97,13.8 19.6091,0.0,18.1,0,0.671,7.313,97.9,1.3163,24,666.0,20.2,396.9,13.44,15.0 15.288,0.0,18.1,0,0.671,6.649,93.3,1.3449,24,666.0,20.2,363.02,23.24,13.9 9.82349,0.0,18.1,0,0.671,6.794,98.8,1.358,24,666.0,20.2,396.9,21.24,13.3 23.6482,0.0,18.1,0,0.671,6.38,96.2,1.3861,24,666.0,20.2,396.9,23.69,13.1 17.8667,0.0,18.1,0,0.671,6.223,100.0,1.3861,24,666.0,20.2,393.74,21.78,10.2 88.9762,0.0,18.1,0,0.671,6.968,91.9,1.4165,24,666.0,20.2,396.9,17.21,10.4 15.8744,0.0,18.1,0,0.671,6.545,99.1,1.5192,24,666.0,20.2,396.9,21.08,10.9 9.18702,0.0,18.1,0,0.7,5.536,100.0,1.5804,24,666.0,20.2,396.9,23.6,11.3 7.99248,0.0,18.1,0,0.7,5.52,100.0,1.5331,24,666.0,20.2,396.9,24.56,12.3 20.0849,0.0,18.1,0,0.7,4.368,91.2,1.4395,24,666.0,20.2,285.83,30.63,8.8 16.8118,0.0,18.1,0,0.7,5.277,98.1,1.4261,24,666.0,20.2,396.9,30.81,7.2 24.3938,0.0,18.1,0,0.7,4.652,100.0,1.4672,24,666.0,20.2,396.9,28.28,10.5 22.5971,0.0,18.1,0,0.7,5.0,89.5,1.5184,24,666.0,20.2,396.9,31.99,7.4 14.3337,0.0,18.1,0,0.7,4.88,100.0,1.5895,24,666.0,20.2,372.92,30.62,10.2 8.15174,0.0,18.1,0,0.7,5.39,98.9,1.7281,24,666.0,20.2,396.9,20.85,11.5 6.96215,0.0,18.1,0,0.7,5.713,97.0,1.9265,24,666.0,20.2,394.43,17.11,15.1 5.29305,0.0,18.1,0,0.7,6.051,82.5,2.1678,24,666.0,20.2,378.38,18.76,23.2 11.5779,0.0,18.1,0,0.7,5.036,97.0,1.77,24,666.0,20.2,396.9,25.68,9.7 8.64476,0.0,18.1,0,0.693,6.193,92.6,1.7912,24,666.0,20.2,396.9,15.17,13.8 13.3598,0.0,18.1,0,0.693,5.887,94.7,1.7821,24,666.0,20.2,396.9,16.35,12.7 8.71675,0.0,18.1,0,0.693,6.471,98.8,1.7257,24,666.0,20.2,391.98,17.12,13.1 5.87205,0.0,18.1,0,0.693,6.405,96.0,1.6768,24,666.0,20.2,396.9,19.37,12.5 7.67202,0.0,18.1,0,0.693,5.747,98.9,1.6334,24,666.0,20.2,393.1,19.92,8.5 38.3518,0.0,18.1,0,0.693,5.453,100.0,1.4896,24,666.0,20.2,396.9,30.59,5.0 9.91655,0.0,18.1,0,0.693,5.852,77.8,1.5004,24,666.0,20.2,338.16,29.97,6.3 25.0461,0.0,18.1,0,0.693,5.987,100.0,1.5888,24,666.0,20.2,396.9,26.77,5.6 14.2362,0.0,18.1,0,0.693,6.343,100.0,1.5741,24,666.0,20.2,396.9,20.32,7.2 9.59571,0.0,18.1,0,0.693,6.404,100.0,1.639,24,666.0,20.2,376.11,20.31,12.1 24.8017,0.0,18.1,0,0.693,5.349,96.0,1.7028,24,666.0,20.2,396.9,19.77,8.3 41.5292,0.0,18.1,0,0.693,5.531,85.4,1.6074,24,666.0,20.2,329.46,27.38,8.5 67.9208,0.0,18.1,0,0.693,5.683,100.0,1.4254,24,666.0,20.2,384.97,22.98,5.0 20.7162,0.0,18.1,0,0.659,4.138,100.0,1.1781,24,666.0,20.2,370.22,23.34,11.9 11.9511,0.0,18.1,0,0.659,5.608,100.0,1.2852,24,666.0,20.2,332.09,12.13,27.9 7.40389,0.0,18.1,0,0.597,5.617,97.9,1.4547,24,666.0,20.2,314.64,26.4,17.2 14.4383,0.0,18.1,0,0.597,6.852,100.0,1.4655,24,666.0,20.2,179.36,19.78,27.5 51.1358,0.0,18.1,0,0.597,5.757,100.0,1.413,24,666.0,20.2,2.6,10.11,15.0 14.0507,0.0,18.1,0,0.597,6.657,100.0,1.5275,24,666.0,20.2,35.05,21.22,17.2 18.811,0.0,18.1,0,0.597,4.628,100.0,1.5539,24,666.0,20.2,28.79,34.37,17.9 28.6558,0.0,18.1,0,0.597,5.155,100.0,1.5894,24,666.0,20.2,210.97,20.08,16.3 45.7461,0.0,18.1,0,0.693,4.519,100.0,1.6582,24,666.0,20.2,88.27,36.98,7.0 18.0846,0.0,18.1,0,0.679,6.434,100.0,1.8347,24,666.0,20.2,27.25,29.05,7.2 10.8342,0.0,18.1,0,0.679,6.782,90.8,1.8195,24,666.0,20.2,21.57,25.79,7.5 25.9406,0.0,18.1,0,0.679,5.304,89.1,1.6475,24,666.0,20.2,127.36,26.64,10.4 73.5341,0.0,18.1,0,0.679,5.957,100.0,1.8026,24,666.0,20.2,16.45,20.62,8.8 11.8123,0.0,18.1,0,0.718,6.824,76.5,1.794,24,666.0,20.2,48.45,22.74,8.4 11.0874,0.0,18.1,0,0.718,6.411,100.0,1.8589,24,666.0,20.2,318.75,15.02,16.7 7.02259,0.0,18.1,0,0.718,6.006,95.3,1.8746,24,666.0,20.2,319.98,15.7,14.2 12.0482,0.0,18.1,0,0.614,5.648,87.6,1.9512,24,666.0,20.2,291.55,14.1,20.8 7.05042,0.0,18.1,0,0.614,6.103,85.1,2.0218,24,666.0,20.2,2.52,23.29,13.4 8.79212,0.0,18.1,0,0.584,5.565,70.6,2.0635,24,666.0,20.2,3.65,17.16,11.7 15.8603,0.0,18.1,0,0.679,5.896,95.4,1.9096,24,666.0,20.2,7.68,24.39,8.3 12.2472,0.0,18.1,0,0.584,5.837,59.7,1.9976,24,666.0,20.2,24.65,15.69,10.2 37.6619,0.0,18.1,0,0.679,6.202,78.7,1.8629,24,666.0,20.2,18.82,14.52,10.9 7.36711,0.0,18.1,0,0.679,6.193,78.1,1.9356,24,666.0,20.2,96.73,21.52,11.0 9.33889,0.0,18.1,0,0.679,6.38,95.6,1.9682,24,666.0,20.2,60.72,24.08,9.5 8.49213,0.0,18.1,0,0.584,6.348,86.1,2.0527,24,666.0,20.2,83.45,17.64,14.5 10.0623,0.0,18.1,0,0.584,6.833,94.3,2.0882,24,666.0,20.2,81.33,19.69,14.1 6.44405,0.0,18.1,0,0.584,6.425,74.8,2.2004,24,666.0,20.2,97.95,12.03,16.1 5.58107,0.0,18.1,0,0.713,6.436,87.9,2.3158,24,666.0,20.2,100.19,16.22,14.3 13.9134,0.0,18.1,0,0.713,6.208,95.0,2.2222,24,666.0,20.2,100.63,15.17,11.7 11.1604,0.0,18.1,0,0.74,6.629,94.6,2.1247,24,666.0,20.2,109.85,23.27,13.4 14.4208,0.0,18.1,0,0.74,6.461,93.3,2.0026,24,666.0,20.2,27.49,18.05,9.6 15.1772,0.0,18.1,0,0.74,6.152,100.0,1.9142,24,666.0,20.2,9.32,26.45,8.7 13.6781,0.0,18.1,0,0.74,5.935,87.9,1.8206,24,666.0,20.2,68.95,34.02,8.4 9.39063,0.0,18.1,0,0.74,5.627,93.9,1.8172,24,666.0,20.2,396.9,22.88,12.8 22.0511,0.0,18.1,0,0.74,5.818,92.4,1.8662,24,666.0,20.2,391.45,22.11,10.5 9.72418,0.0,18.1,0,0.74,6.406,97.2,2.0651,24,666.0,20.2,385.96,19.52,17.1 5.66637,0.0,18.1,0,0.74,6.219,100.0,2.0048,24,666.0,20.2,395.69,16.59,18.4 9.96654,0.0,18.1,0,0.74,6.485,100.0,1.9784,24,666.0,20.2,386.73,18.85,15.4 12.8023,0.0,18.1,0,0.74,5.854,96.6,1.8956,24,666.0,20.2,240.52,23.79,10.8 10.6718,0.0,18.1,0,0.74,6.459,94.8,1.9879,24,666.0,20.2,43.06,23.98,11.8 6.28807,0.0,18.1,0,0.74,6.341,96.4,2.072,24,666.0,20.2,318.01,17.79,14.9 9.92485,0.0,18.1,0,0.74,6.251,96.6,2.198,24,666.0,20.2,388.52,16.44,12.6 9.32909,0.0,18.1,0,0.713,6.185,98.7,2.2616,24,666.0,20.2,396.9,18.13,14.1 7.52601,0.0,18.1,0,0.713,6.417,98.3,2.185,24,666.0,20.2,304.21,19.31,13.0 6.71772,0.0,18.1,0,0.713,6.749,92.6,2.3236,24,666.0,20.2,0.32,17.44,13.4 5.44114,0.0,18.1,0,0.713,6.655,98.2,2.3552,24,666.0,20.2,355.29,17.73,15.2 5.09017,0.0,18.1,0,0.713,6.297,91.8,2.3682,24,666.0,20.2,385.09,17.27,16.1 8.24809,0.0,18.1,0,0.713,7.393,99.3,2.4527,24,666.0,20.2,375.87,16.74,17.8 9.51363,0.0,18.1,0,0.713,6.728,94.1,2.4961,24,666.0,20.2,6.68,18.71,14.9 4.75237,0.0,18.1,0,0.713,6.525,86.5,2.4358,24,666.0,20.2,50.92,18.13,14.1 4.66883,0.0,18.1,0,0.713,5.976,87.9,2.5806,24,666.0,20.2,10.48,19.01,12.7 8.20058,0.0,18.1,0,0.713,5.936,80.3,2.7792,24,666.0,20.2,3.5,16.94,13.5 7.75223,0.0,18.1,0,0.713,6.301,83.7,2.7831,24,666.0,20.2,272.21,16.23,14.9 6.80117,0.0,18.1,0,0.713,6.081,84.4,2.7175,24,666.0,20.2,396.9,14.7,20.0 4.81213,0.0,18.1,0,0.713,6.701,90.0,2.5975,24,666.0,20.2,255.23,16.42,16.4 3.69311,0.0,18.1,0,0.713,6.376,88.4,2.5671,24,666.0,20.2,391.43,14.65,17.7 6.65492,0.0,18.1,0,0.713,6.317,83.0,2.7344,24,666.0,20.2,396.9,13.99,19.5 5.82115,0.0,18.1,0,0.713,6.513,89.9,2.8016,24,666.0,20.2,393.82,10.29,20.2 7.83932,0.0,18.1,0,0.655,6.209,65.4,2.9634,24,666.0,20.2,396.9,13.22,21.4 3.1636,0.0,18.1,0,0.655,5.759,48.2,3.0665,24,666.0,20.2,334.4,14.13,19.9 3.77498,0.0,18.1,0,0.655,5.952,84.7,2.8715,24,666.0,20.2,22.01,17.15,19.0 4.42228,0.0,18.1,0,0.584,6.003,94.5,2.5403,24,666.0,20.2,331.29,21.32,19.1 15.5757,0.0,18.1,0,0.58,5.926,71.0,2.9084,24,666.0,20.2,368.74,18.13,19.1 13.0751,0.0,18.1,0,0.58,5.713,56.7,2.8237,24,666.0,20.2,396.9,14.76,20.1 4.34879,0.0,18.1,0,0.58,6.167,84.0,3.0334,24,666.0,20.2,396.9,16.29,19.9 4.03841,0.0,18.1,0,0.532,6.229,90.7,3.0993,24,666.0,20.2,395.33,12.87,19.6 3.56868,0.0,18.1,0,0.58,6.437,75.0,2.8965,24,666.0,20.2,393.37,14.36,23.2 4.64689,0.0,18.1,0,0.614,6.98,67.6,2.5329,24,666.0,20.2,374.68,11.66,29.8 8.05579,0.0,18.1,0,0.584,5.427,95.4,2.4298,24,666.0,20.2,352.58,18.14,13.8 6.39312,0.0,18.1,0,0.584,6.162,97.4,2.206,24,666.0,20.2,302.76,24.1,13.3 4.87141,0.0,18.1,0,0.614,6.484,93.6,2.3053,24,666.0,20.2,396.21,18.68,16.7 15.0234,0.0,18.1,0,0.614,5.304,97.3,2.1007,24,666.0,20.2,349.48,24.91,12.0 10.233,0.0,18.1,0,0.614,6.185,96.7,2.1705,24,666.0,20.2,379.7,18.03,14.6 14.3337,0.0,18.1,0,0.614,6.229,88.0,1.9512,24,666.0,20.2,383.32,13.11,21.4 5.82401,0.0,18.1,0,0.532,6.242,64.7,3.4242,24,666.0,20.2,396.9,10.74,23.0 5.70818,0.0,18.1,0,0.532,6.75,74.9,3.3317,24,666.0,20.2,393.07,7.74,23.7 5.73116,0.0,18.1,0,0.532,7.061,77.0,3.4106,24,666.0,20.2,395.28,7.01,25.0 2.81838,0.0,18.1,0,0.532,5.762,40.3,4.0983,24,666.0,20.2,392.92,10.42,21.8 2.37857,0.0,18.1,0,0.583,5.871,41.9,3.724,24,666.0,20.2,370.73,13.34,20.6 3.67367,0.0,18.1,0,0.583,6.312,51.9,3.9917,24,666.0,20.2,388.62,10.58,21.2 5.69175,0.0,18.1,0,0.583,6.114,79.8,3.5459,24,666.0,20.2,392.68,14.98,19.1 4.83567,0.0,18.1,0,0.583,5.905,53.2,3.1523,24,666.0,20.2,388.22,11.45,20.6 0.15086,0.0,27.74,0,0.609,5.454,92.7,1.8209,4,711.0,20.1,395.09,18.06,15.2 0.18337,0.0,27.74,0,0.609,5.414,98.3,1.7554,4,711.0,20.1,344.05,23.97,7.0 0.20746,0.0,27.74,0,0.609,5.093,98.0,1.8226,4,711.0,20.1,318.43,29.68,8.1 0.10574,0.0,27.74,0,0.609,5.983,98.8,1.8681,4,711.0,20.1,390.11,18.07,13.6 0.11132,0.0,27.74,0,0.609,5.983,83.5,2.1099,4,711.0,20.1,396.9,13.35,20.1 0.17331,0.0,9.69,0,0.585,5.707,54.0,2.3817,6,391.0,19.2,396.9,12.01,21.8 0.27957,0.0,9.69,0,0.585,5.926,42.6,2.3817,6,391.0,19.2,396.9,13.59,24.5 0.17899,0.0,9.69,0,0.585,5.67,28.8,2.7986,6,391.0,19.2,393.29,17.6,23.1 0.2896,0.0,9.69,0,0.585,5.39,72.9,2.7986,6,391.0,19.2,396.9,21.14,19.7 0.26838,0.0,9.69,0,0.585,5.794,70.6,2.8927,6,391.0,19.2,396.9,14.1,18.3 0.23912,0.0,9.69,0,0.585,6.019,65.3,2.4091,6,391.0,19.2,396.9,12.92,21.2 0.17783,0.0,9.69,0,0.585,5.569,73.5,2.3999,6,391.0,19.2,395.77,15.1,17.5 0.22438,0.0,9.69,0,0.585,6.027,79.7,2.4982,6,391.0,19.2,396.9,14.33,16.8 0.06263,0.0,11.93,0,0.573,6.593,69.1,2.4786,1,273.0,21.0,391.99,9.67,22.4 0.04527,0.0,11.93,0,0.573,6.12,76.7,2.2875,1,273.0,21.0,396.9,9.08,20.6 0.06076,0.0,11.93,0,0.573,6.976,91.0,2.1675,1,273.0,21.0,396.9,5.64,23.9 0.10959,0.0,11.93,0,0.573,6.794,89.3,2.3889,1,273.0,21.0,393.45,6.48,22.0 0.04741,0.0,11.93,0,0.573,6.03,80.8,2.505,1,273.0,21.0,396.9,7.88,11.9 --- examples/data/mnist_test_small.csv --- label,1x1,1x2,1x3,1x4,1x5,1x6,1x7,1x8,1x9,1x10,1x11,1x12,1x13,1x14,1x15,1x16,1x17,1x18,1x19,1x20,1x21,1x22,1x23,1x24,1x25,1x26,1x27,1x28,2x1,2x2,2x3,2x4,2x5,2x6,2x7,2x8,2x9,2x10,2x11,2x12,2x13,2x14,2x15,2x16,2x17,2x18,2x19,2x20,2x21,2x22,2x23,2x24,2x25,2x26,2x27,2x28,3x1,3x2,3x3,3x4,3x5,3x6,3x7,3x8,3x9,3x10,3x11,3x12,3x13,3x14,3x15,3x16,3x17,3x18,3x19,3x20,3x21,3x22,3x23,3x24,3x25,3x26,3x27,3x28,4x1,4x2,4x3,4x4,4x5,4x6,4x7,4x8,4x9,4x10,4x11,4x12,4x13,4x14,4x15,4x16,4x17,4x18,4x19,4x20,4x21,4x22,4x23,4x24,4x25,4x26,4x27,4x28,5x1,5x2,5x3,5x4,5x5,5x6,5x7,5x8,5x9,5x10,5x11,5x12,5x13,5x14,5x15,5x16,5x17,5x18,5x19,5x20,5x21,5x22,5x23,5x24,5x25,5x26,5x27,5x28,6x1,6x2,6x3,6x4,6x5,6x6,6x7,6x8,6x9,6x10,6x11,6x12,6x13,6x14,6x15,6x16,6x17,6x18,6x19,6x20,6x21,6x22,6x23,6x24,6x25,6x26,6x27,6x28,7x1,7x2,7x3,7x4,7x5,7x6,7x7,7x8,7x9,7x10,7x11,7x12,7x13,7x14,7x15,7x16,7x17,7x18,7x19,7x20,7x21,7x22,7x23,7x24,7x25,7x26,7x27,7x28,8x1,8x2,8x3,8x4,8x5,8x6,8x7,8x8,8x9,8x10,8x11,8x12,8x13,8x14,8x15,8x16,8x17,8x18,8x19,8x20,8x21,8x22,8x23,8x24,8x25,8x26,8x27,8x28,9x1,9x2,9x3,9x4,9x5,9x6,9x7,9x8,9x9,9x10,9x11,9x12,9x13,9x14,9x15,9x16,9x17,9x18,9x19,9x20,9x21,9x22,9x23,9x24,9x25,9x26,9x27,9x28,10x1,10x2,10x3,10x4,10x5,10x6,10x7,10x8,10x9,10x10,10x11,10x12,10x13,10x14,10x15,10x16,10x17,10x18,10x19,10x20,10x21,10x22,10x23,10x24,10x25,10x26,10x27,10x28,11x1,11x2,11x3,11x4,11x5,11x6,11x7,11x8,11x9,11x10,11x11,11x12,11x13,11x14,11x15,11x16,11x17,11x18,11x19,11x20,11x21,11x22,11x23,11x24,11x25,11x26,11x27,11x28,12x1,12x2,12x3,12x4,12x5,12x6,12x7,12x8,12x9,12x10,12x11,12x12,12x13,12x14,12x15,12x16,12x17,12x18,12x19,12x20,12x21,12x22,12x23,12x24,12x25,12x26,12x27,12x28,13x1,13x2,13x3,13x4,13x5,13x6,13x7,13x8,13x9,13x10,13x11,13x12,13x13,13x14,13x15,13x16,13x17,13x18,13x19,13x20,13x21,13x22,13x23,13x24,13x25,13x26,13x27,13x28,14x1,14x2,14x3,14x4,14x5,14x6,14x7,14x8,14x9,14x10,14x11,14x12,14x13,14x14,14x15,14x16,14x17,14x18,14x19,14x20,14x21,14x22,14x23,14x24,14x25,14x26,14x27,14x28,15x1,15x2,15x3,15x4,15x5,15x6,15x7,15x8,15x9,15x10,15x11,15x12,15x13,15x14,15x15,15x16,15x17,15x18,15x19,15x20,15x21,15x22,15x23,15x24,15x25,15x26,15x27,15x28,16x1,16x2,16x3,16x4,16x5,16x6,16x7,16x8,16x9,16x10,16x11,16x12,16x13,16x14,16x15,16x16,16x17,16x18,16x19,16x20,16x21,16x22,16x23,16x24,16x25,16x26,16x27,16x28,17x1,17x2,17x3,17x4,17x5,17x6,17x7,17x8,17x9,17x10,17x11,17x12,17x13,17x14,17x15,17x16,17x17,17x18,17x19,17x20,17x21,17x22,17x23,17x24,17x25,17x26,17x27,17x28,18x1,18x2,18x3,18x4,18x5,18x6,18x7,18x8,18x9,18x10,18x11,18x12,18x13,18x14,18x15,18x16,18x17,18x18,18x19,18x20,18x21,18x22,18x23,18x24,18x25,18x26,18x27,18x28,19x1,19x2,19x3,19x4,19x5,19x6,19x7,19x8,19x9,19x10,19x11,19x12,19x13,19x14,19x15,19x16,19x17,19x18,19x19,19x20,19x21,19x22,19x23,19x24,19x25,19x26,19x27,19x28,20x1,20x2,20x3,20x4,20x5,20x6,20x7,20x8,20x9,20x10,20x11,20x12,20x13,20x14,20x15,20x16,20x17,20x18,20x19,20x20,20x21,20x22,20x23,20x24,20x25,20x26,20x27,20x28,21x1,21x2,21x3,21x4,21x5,21x6,21x7,21x8,21x9,21x10,21x11,21x12,21x13,21x14,21x15,21x16,21x17,21x18,21x19,21x20,21x21,21x22,21x23,21x24,21x25,21x26,21x27,21x28,22x1,22x2,22x3,22x4,22x5,22x6,22x7,22x8,22x9,22x10,22x11,22x12,22x13,22x14,22x15,22x16,22x17,22x18,22x19,22x20,22x21,22x22,22x23,22x24,22x25,22x26,22x27,22x28,23x1,23x2,23x3,23x4,23x5,23x6,23x7,23x8,23x9,23x10,23x11,23x12,23x13,23x14,23x15,23x16,23x17,23x18,23x19,23x20,23x21,23x22,23x23,23x24,23x25,23x26,23x27,23x28,24x1,24x2,24x3,24x4,24x5,24x6,24x7,24x8,24x9,24x10,24x11,24x12,24x13,24x14,24x15,24x16,24x17,24x18,24x19,24x20,24x21,24x22,24x23,24x24,24x25,24x26,24x27,24x28,25x1,25x2,25x3,25x4,25x5,25x6,25x7,25x8,25x9,25x10,25x11,25x12,25x13,25x14,25x15,25x16,25x17,25x18,25x19,25x20,25x21,25x22,25x23,25x24,25x25,25x26,25x27,25x28,26x1,26x2,26x3,26x4,26x5,26x6,26x7,26x8,26x9,26x10,26x11,26x12,26x13,26x14,26x15,26x16,26x17,26x18,26x19,26x20,26x21,26x22,26x23,26x24,26x25,26x26,26x27,26x28,27x1,27x2,27x3,27x4,27x5,27x6,27x7,27x8,27x9,27x10,27x11,27x12,27x13,27x14,27x15,27x16,27x17,27x18,27x19,27x20,27x21,27x22,27x23,27x24,27x25,27x26,27x27,27x28,28x1,28x2,28x3,28x4,28x5,28x6,28x7,28x8,28x9,28x10,28x11,28x12,28x13,28x14,28x15,28x16,28x17,28x18,28x19,28x20,28x21,28x22,28x23,28x24,28x25,28x26,28x27,28x28 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,192,130,253,255,253,244,105,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,208,208,208,231,252,252,252,253,252,252,252,213,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,164,252,252,252,252,252,252,252,238,237,237,252,252,171,7,0,0,0,0,0,0,0,0,0,0,0,0,0,94,252,252,252,252,139,132,132,0,0,8,189,252,252,118,0,0,0,0,0,0,0,0,0,0,0,0,0,2,99,199,252,252,14,0,0,0,0,0,120,252,252,236,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,222,222,12,0,0,0,0,0,120,252,252,252,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,252,252,252,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,166,252,252,204,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,145,252,252,246,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,252,252,252,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,227,253,253,222,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,227,252,252,223,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,216,253,252,242,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,221,252,253,223,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,233,252,252,222,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,48,217,252,252,252,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,153,252,252,252,252,172,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,160,250,252,252,252,69,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,252,252,252,228,154,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,103,235,234,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,170,226,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,170,255,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,170,255,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,170,255,57,0,0,0,198,255,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,170,255,170,29,0,0,170,255,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,170,255,198,0,0,0,114,255,226,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,255,226,29,0,0,57,255,226,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,255,226,57,0,0,29,226,255,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,255,198,86,86,86,198,255,226,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,255,255,255,255,255,255,198,141,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,86,86,86,226,255,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,255,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,255,226,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,226,255,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,255,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,255,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,255,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,226,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,255,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,226,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,214,253,189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,131,253,251,251,188,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,251,253,251,251,188,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,251,253,243,188,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,158,240,251,193,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,253,253,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,236,251,251,231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,253,251,251,140,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,240,253,251,219,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,181,251,253,231,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,253,253,219,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,221,251,251,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,221,251,251,172,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,134,251,251,235,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,217,253,251,172,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,253,255,241,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,112,244,251,241,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,251,251,251,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,251,196,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,228,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,132,248,255,253,253,253,138,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,123,237,252,252,253,252,252,252,252,221,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,184,252,252,252,217,96,96,96,176,224,252,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,229,252,252,164,84,4,0,0,0,0,20,175,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,252,235,94,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,209,252,88,0,0,0,0,0,0,0,0,53,73,49,0,0,0,0,0,0,0,0,0,0,0,0,0,30,237,252,60,0,0,0,0,0,9,85,165,239,252,167,0,0,0,0,0,0,0,0,0,0,0,0,0,6,180,252,191,97,60,0,93,103,220,252,252,252,252,122,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118,252,252,252,243,229,251,253,252,252,252,252,221,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,40,131,189,131,131,131,11,35,252,252,194,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70,202,253,164,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,202,252,249,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,243,253,237,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,194,252,228,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,183,252,252,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,100,244,252,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,100,243,252,124,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,244,252,124,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,200,252,124,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,252,183,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,32,112,190,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,127,174,251,251,251,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,64,210,251,253,251,251,235,188,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,251,251,251,253,231,94,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,255,253,253,253,253,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,170,253,251,251,204,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,221,251,253,251,188,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,221,248,251,229,168,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,228,251,251,251,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,255,253,253,229,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,228,253,251,235,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,158,251,253,156,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,158,251,251,229,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,251,251,251,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,253,253,229,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,115,251,235,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,235,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,254,255,123,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,246,253,253,203,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,203,253,253,253,215,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,195,253,253,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,248,253,253,158,41,0,0,0,0,0,0,0,0,0,0,39,47,0,0,0,0,0,0,0,0,0,0,0,143,253,253,253,244,77,0,0,0,0,0,0,0,0,0,16,20,0,0,0,0,0,0,0,0,0,0,120,212,253,253,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70,106,192,253,253,253,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,70,229,253,253,251,249,253,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,208,253,253,253,201,130,131,253,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,202,253,253,253,91,36,0,131,253,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,216,253,253,228,67,1,0,0,96,241,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,26,199,253,253,248,68,0,0,0,0,0,211,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,202,253,253,231,72,0,0,0,0,0,120,249,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,219,253,253,147,0,0,0,0,0,0,131,253,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,219,253,253,147,0,0,0,0,0,8,148,253,253,238,27,0,0,0,0,0,0,0,0,0,0,0,0,0,219,253,253,195,31,0,0,112,115,143,253,253,201,129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,207,253,253,253,209,193,193,251,253,253,253,214,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,203,253,253,253,253,253,253,253,253,202,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,217,253,253,253,253,204,78,78,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,128,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,128,0,0,64,128,255,191,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,128,191,255,255,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,255,255,128,191,128,128,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,128,64,0,0,64,128,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,255,128,128,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,255,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,191,128,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,218,248,252,252,248,248,155,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,251,253,253,253,253,253,253,252,155,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,250,253,253,253,253,253,253,253,253,234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,212,249,253,253,253,253,253,253,253,253,253,234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,221,253,253,253,180,185,185,228,253,253,253,253,241,40,0,0,0,0,0,0,0,0,0,0,0,0,38,221,253,253,225,128,8,10,10,139,253,253,253,253,253,225,39,0,0,0,0,0,0,0,0,0,0,0,219,253,253,184,117,0,0,0,0,10,135,227,253,253,253,253,224,0,0,0,0,0,0,0,0,0,0,95,251,253,138,7,0,0,0,0,0,0,0,35,135,226,253,253,249,35,0,0,0,0,0,0,0,0,33,220,253,172,6,0,0,0,0,0,0,0,0,0,0,36,135,225,253,224,0,0,0,0,0,0,0,0,125,253,253,119,0,0,0,0,0,0,0,0,0,0,0,0,0,143,253,223,0,0,0,0,0,0,0,0,218,253,253,46,0,0,0,0,0,0,0,0,0,0,0,0,0,143,253,123,0,0,0,0,0,0,0,0,255,253,210,55,0,0,0,0,0,0,0,0,0,0,0,5,56,220,249,38,0,0,0,0,0,0,0,0,254,253,100,0,0,0,0,0,0,0,0,0,0,0,6,62,253,253,226,0,0,0,0,0,0,0,0,0,238,253,214,12,0,0,0,0,0,0,0,0,0,22,128,253,253,161,42,0,0,0,0,0,0,0,0,0,112,253,253,100,0,0,0,0,0,0,0,6,50,221,253,250,150,42,0,0,0,0,0,0,0,0,0,0,0,170,253,211,100,20,20,20,20,54,150,171,253,253,224,93,0,0,0,0,0,0,0,0,0,0,0,0,0,51,240,253,253,253,253,253,253,253,253,253,251,220,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,170,247,249,253,253,251,248,248,152,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,123,123,89,32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,255,253,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,224,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,254,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,224,253,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,118,121,254,254,255,221,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,201,253,253,253,253,253,253,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,206,253,253,253,253,253,253,253,247,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,216,253,253,253,253,253,253,253,253,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,253,253,253,253,253,253,253,253,253,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,214,247,239,239,239,109,151,253,253,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,0,75,67,0,83,253,253,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,82,74,0,83,253,213,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,229,253,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,204,253,208,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,241,253,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,75,248,206,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,104,104,104,104,104,104,104,189,253,253,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,220,243,253,253,253,253,253,253,253,253,253,197,16,0,0,0,0,0,0,0,0,0,0,0,0,0,184,245,253,253,253,253,226,191,208,253,253,253,253,253,161,14,0,0,0,0,0,0,0,0,0,0,0,20,237,253,253,248,212,212,46,0,92,253,253,230,232,253,253,194,53,0,0,0,0,0,0,0,0,0,0,118,253,253,249,127,0,0,9,70,236,253,225,41,47,226,250,253,186,71,0,0,0,0,0,0,0,0,0,118,253,253,198,0,0,0,185,253,253,227,41,0,0,0,145,253,253,244,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,255,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,217,253,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,254,234,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,242,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,254,164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,210,228,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,173,253,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,201,75,0,0,0,0,29,253,253,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,217,254,128,0,0,0,0,42,254,207,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,129,253,171,9,0,0,0,0,166,253,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,254,209,13,0,0,0,0,89,254,234,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,238,242,59,0,0,0,0,0,163,242,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,205,254,243,141,141,141,142,66,154,254,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,253,253,254,253,253,253,254,253,253,253,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,168,168,169,168,168,119,128,253,253,165,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,253,215,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,205,254,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,254,190,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,254,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,238,229,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,233,253,253,255,253,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,73,155,233,252,252,252,253,252,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182,201,252,252,253,252,252,252,253,252,195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,253,252,252,252,253,168,231,108,108,108,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,109,191,253,252,236,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,190,252,253,252,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,191,252,253,252,180,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155,252,252,253,252,252,190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,253,253,253,255,253,253,253,192,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,159,158,35,35,35,66,252,253,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,175,253,231,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,253,252,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,255,253,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,253,252,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,109,47,0,0,0,0,0,0,16,191,255,222,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,252,232,217,217,114,73,218,217,222,252,253,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,92,215,252,252,252,252,253,252,252,231,154,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,108,108,108,190,253,128,108,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,64,0,0,128,128,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,191,0,128,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,128,255,255,255,255,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,64,255,255,255,255,255,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,128,255,255,255,128,128,128,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,191,255,255,0,0,0,0,191,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,255,128,128,191,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,191,255,255,255,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,192,113,25,29,253,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,253,252,231,228,252,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,165,253,252,252,252,252,166,57,57,57,57,57,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,252,253,252,252,252,252,253,252,252,252,252,253,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,252,253,252,252,252,252,253,252,252,252,252,190,12,0,0,0,0,0,0,0,0,0,0,0,0,0,26,207,253,255,253,165,140,140,141,241,253,240,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,252,252,215,42,6,0,0,101,249,252,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,71,195,110,0,0,7,57,222,252,98,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,252,253,242,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,252,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,253,255,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,243,252,152,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,234,249,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,240,252,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,228,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,159,252,148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,215,253,195,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,189,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,255,161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,118,118,206,253,253,161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,212,244,253,253,253,253,253,252,105,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,214,253,253,178,167,253,240,82,149,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,209,249,253,177,58,7,97,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,217,253,253,190,8,0,0,176,219,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,253,253,227,54,0,0,45,242,214,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,253,253,68,0,0,19,181,253,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,244,253,148,0,0,96,253,240,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,243,235,196,128,239,253,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,215,253,253,253,253,214,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,148,253,253,253,253,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,93,242,253,253,253,223,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,189,253,253,253,253,253,253,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,122,253,253,253,253,253,253,253,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,253,253,253,253,253,253,217,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,246,253,246,206,230,253,248,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,253,253,214,237,253,253,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,253,253,253,253,251,210,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,244,253,253,142,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,149,228,254,254,210,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,112,217,254,253,253,253,253,218,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,102,190,253,253,233,197,127,153,232,254,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,219,253,253,184,84,0,0,0,0,0,217,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,229,254,173,95,14,0,0,36,53,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,184,254,89,0,0,0,0,8,202,233,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,253,253,0,0,0,0,72,202,253,152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,246,253,22,102,128,198,250,254,253,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,143,253,254,253,253,237,216,255,232,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,147,148,147,138,32,150,254,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,254,213,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,100,253,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,212,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,182,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,216,200,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,254,190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,212,253,190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,253,252,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,254,173,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,128,254,255,254,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,158,220,253,253,253,253,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,190,253,253,253,253,253,253,215,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,187,253,253,253,253,253,253,253,253,202,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,44,187,253,253,253,253,253,253,253,253,253,253,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,253,253,253,253,253,253,253,253,253,253,253,253,235,0,0,0,0,0,0,0,0,0,0,0,0,0,15,187,253,253,253,253,244,226,252,237,69,52,219,253,235,0,0,0,0,0,0,0,0,0,0,0,0,26,187,253,253,253,253,249,97,0,143,61,0,0,211,253,235,0,0,0,0,0,0,0,0,0,0,0,0,62,253,253,248,244,244,114,0,0,0,0,0,0,211,253,248,115,0,0,0,0,0,0,0,0,0,0,0,123,253,237,85,0,0,0,0,0,0,0,0,0,211,253,253,156,0,0,0,0,0,0,0,0,0,0,0,237,253,209,0,0,0,0,0,0,0,0,0,0,211,253,253,156,0,0,0,0,0,0,0,0,0,0,153,252,253,209,0,0,0,0,0,0,0,0,0,0,211,253,248,114,0,0,0,0,0,0,0,0,0,0,158,253,253,209,0,0,0,0,0,0,0,0,0,0,211,253,235,0,0,0,0,0,0,0,0,0,0,0,158,253,253,209,0,0,0,0,0,0,0,0,0,28,219,253,199,0,0,0,0,0,0,0,0,0,0,0,158,253,253,209,0,0,0,0,0,0,0,0,28,195,253,253,60,0,0,0,0,0,0,0,0,0,0,0,27,240,253,209,0,0,0,0,0,0,35,138,219,253,223,138,10,0,0,0,0,0,0,0,0,0,0,0,0,237,253,229,115,115,67,4,115,115,249,253,253,253,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,253,253,253,253,228,195,253,253,253,253,200,60,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,156,240,253,253,253,253,253,253,226,156,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,253,253,253,253,192,78,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,67,194,244,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,242,254,254,207,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,161,254,254,254,207,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,161,254,254,254,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,161,254,254,254,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,238,254,247,109,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,254,254,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,190,254,254,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,254,254,254,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,218,254,254,254,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,218,254,254,230,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,245,254,254,188,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,233,254,188,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58,221,254,254,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,118,254,254,254,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,254,254,254,254,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,254,254,254,254,207,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,203,254,254,254,254,99,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,209,254,254,241,131,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,243,254,254,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,101,101,175,254,254,255,124,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,99,200,228,253,253,253,253,253,253,253,213,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,205,253,253,253,253,253,253,253,154,173,253,250,85,0,0,0,0,0,0,0,0,0,0,0,0,0,34,215,253,253,253,253,253,253,253,35,3,3,217,253,145,0,0,0,0,0,0,0,0,0,0,0,0,0,210,253,253,253,253,253,253,118,61,7,0,18,222,253,145,0,0,0,0,0,0,0,0,0,0,0,0,0,162,253,253,253,253,181,115,35,0,0,9,191,253,249,66,0,0,0,0,0,0,0,0,0,0,0,0,0,6,131,168,117,14,7,0,0,0,0,16,253,253,193,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,138,253,208,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,253,253,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,253,218,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,99,244,242,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,253,253,162,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,70,62,0,111,244,253,234,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,40,215,253,243,169,246,253,253,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,253,253,253,253,253,253,253,253,131,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,252,253,253,253,253,253,253,253,253,253,251,216,178,23,0,0,0,0,0,0,0,0,0,0,0,0,0,53,249,253,253,253,253,249,105,106,170,227,250,253,253,195,94,0,0,0,0,0,0,0,0,0,0,0,0,0,247,253,253,253,240,70,0,0,0,0,105,253,253,253,145,0,0,0,0,0,0,0,0,0,0,0,0,0,247,253,253,150,40,0,0,0,0,0,3,45,176,199,115,0,0,0,0,0,0,0,0,0,0,0,0,0,247,229,99,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,54,143,255,254,254,254,171,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,154,241,243,253,253,253,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,253,239,177,146,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,198,161,50,0,144,253,253,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,218,253,183,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,151,218,253,253,212,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118,230,253,253,253,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,167,253,253,253,253,190,197,253,206,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,227,253,253,253,161,27,12,13,242,253,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,184,184,184,73,13,0,0,0,241,253,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,243,253,165,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,253,253,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,3,0,0,0,0,0,0,1,128,253,251,53,0,0,0,0,0,0,0,0,0,0,0,0,0,38,152,253,103,0,0,0,0,0,0,75,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,253,253,103,0,0,0,0,0,0,144,253,253,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,253,253,226,41,0,0,0,0,69,239,253,119,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,253,253,253,225,39,0,0,72,234,253,223,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,105,240,253,253,221,130,153,233,253,226,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,178,253,253,253,253,253,251,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,116,175,253,216,116,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,254,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,154,253,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,249,253,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,154,253,235,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,244,243,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,222,98,0,0,17,184,253,227,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,247,253,188,0,0,46,253,242,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,215,253,253,188,0,17,177,253,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,226,253,159,38,0,156,253,242,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,253,253,104,66,66,201,253,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,110,245,253,253,253,253,253,253,253,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,253,253,253,253,226,253,253,253,220,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,248,253,237,164,78,38,213,253,244,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,234,214,70,0,0,69,234,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,0,0,0,0,202,253,215,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,234,253,200,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155,253,253,253,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,234,253,253,250,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,253,214,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,149,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,85,141,253,254,253,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,168,169,168,253,251,253,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,254,253,254,253,254,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,253,251,253,251,196,83,84,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,226,168,169,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,168,253,251,225,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,255,253,254,253,198,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,253,251,253,251,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,198,253,226,168,169,168,254,253,254,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,83,56,0,0,0,139,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,225,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,198,28,0,0,0,0,0,0,85,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,83,0,0,0,0,0,0,197,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,253,254,253,0,0,0,0,141,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,114,0,57,168,253,251,253,251,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,198,253,254,253,254,253,254,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,83,253,251,253,251,253,138,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,191,208,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,252,238,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,191,252,217,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,217,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,232,252,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,233,252,220,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,105,253,252,195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,105,206,253,210,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182,253,255,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,201,252,222,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,252,252,186,31,58,181,182,181,78,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,237,252,252,0,155,252,252,253,252,252,252,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,191,253,253,253,255,253,253,253,255,253,253,253,110,15,0,0,0,0,0,0,0,0,0,0,0,0,0,1,232,252,252,252,253,252,252,252,253,252,252,252,253,35,0,0,0,0,0,0,0,0,0,0,0,0,0,105,252,252,252,252,154,154,154,71,72,113,221,252,175,10,0,0,0,0,0,0,0,0,0,0,0,0,0,144,252,252,252,252,0,0,0,0,0,0,120,252,144,0,0,0,0,0,0,0,0,0,0,0,0,0,16,191,253,253,253,108,0,94,109,109,110,233,253,191,84,0,0,0,0,0,0,0,0,0,0,0,0,0,5,119,252,252,252,232,218,247,252,252,253,252,241,159,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,149,252,252,252,253,252,252,252,217,174,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,108,108,190,253,210,108,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,255,253,255,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,255,253,254,253,254,253,254,253,254,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,224,253,251,253,251,253,251,253,251,253,251,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,255,253,255,253,254,253,254,253,254,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,224,253,251,253,251,84,196,253,251,253,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,225,255,253,169,56,0,0,85,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,253,251,0,0,0,0,197,251,253,251,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,254,253,254,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,225,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,224,253,138,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,254,253,254,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,196,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,224,253,138,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,121,254,254,135,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,97,197,236,253,253,253,253,238,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,135,227,253,253,253,210,177,208,253,253,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,157,253,253,238,198,109,27,0,104,253,253,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,253,253,174,60,0,0,0,0,123,253,192,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,253,253,27,0,0,2,14,82,248,253,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,204,253,253,27,0,0,99,253,253,253,210,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,209,253,253,126,147,248,251,253,253,208,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,186,253,253,253,253,253,202,97,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,253,253,253,253,253,193,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,226,253,253,253,253,253,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,59,253,253,253,253,253,253,211,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,253,253,253,253,201,228,253,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,222,253,253,253,132,103,253,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,91,220,253,191,150,4,41,228,253,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,253,253,103,0,0,90,253,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,253,226,22,0,0,198,253,215,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,253,243,171,42,176,245,242,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,140,253,253,253,253,253,210,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,134,253,253,253,130,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,128,253,255,253,253,140,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,128,241,252,252,253,252,252,252,249,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,103,252,252,252,252,209,198,252,252,252,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,207,252,187,39,39,21,17,69,231,252,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,252,252,93,0,0,32,193,219,252,252,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,252,252,127,61,186,219,252,252,252,174,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,252,252,252,252,252,234,250,252,197,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,121,225,225,225,154,126,247,252,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,121,252,252,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,190,252,202,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,121,255,253,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,202,253,195,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,177,253,212,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,252,253,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,147,252,221,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,252,252,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,252,252,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,169,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,252,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,245,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,17,92,180,96,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,253,253,253,253,253,220,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,87,235,253,253,253,253,253,253,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,203,253,253,253,253,253,253,253,253,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,213,224,253,253,253,253,253,253,253,253,253,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,69,161,253,253,253,253,253,253,253,253,253,253,253,187,99,0,0,0,0,0,0,0,0,0,0,0,0,73,241,253,253,253,253,199,201,253,253,253,253,253,253,253,246,81,0,0,0,0,0,0,0,0,0,0,66,231,253,253,253,112,98,147,253,253,136,98,123,253,253,253,253,89,0,0,0,0,0,0,0,0,0,17,249,253,253,205,7,1,0,3,7,7,2,0,2,7,63,253,253,249,0,0,0,0,0,0,0,0,0,128,253,252,245,91,0,0,0,0,0,0,0,0,0,0,19,181,253,253,0,0,0,0,0,0,0,0,36,209,253,220,0,0,0,0,0,0,0,0,0,0,0,0,23,189,253,253,0,0,0,0,0,0,0,0,107,253,253,98,0,0,0,0,0,0,0,0,0,0,0,13,77,253,253,130,0,0,0,0,0,0,0,0,254,253,253,56,0,0,0,0,0,0,0,0,0,0,19,186,253,253,219,49,0,0,0,0,0,0,0,0,255,253,183,20,0,0,0,0,0,0,0,17,42,116,213,253,253,229,44,0,0,0,0,0,0,0,0,0,254,253,253,158,131,131,131,131,131,131,131,179,253,253,253,253,137,51,0,0,0,0,0,0,0,0,0,0,217,253,253,253,253,253,253,253,253,253,253,253,247,195,169,32,4,0,0,0,0,0,0,0,0,0,0,0,38,115,253,253,253,253,253,253,253,253,248,106,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,15,143,179,179,179,30,15,15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,237,255,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,253,253,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,246,253,253,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,253,253,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,246,253,253,253,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,82,249,253,253,189,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,167,253,253,211,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,202,253,253,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,94,253,253,253,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,253,253,253,201,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,253,253,253,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,179,253,253,233,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,149,225,253,253,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,253,253,253,218,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118,253,253,253,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,209,253,253,253,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,181,253,253,253,213,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,253,253,253,246,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,253,253,253,244,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,253,253,253,123,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,85,86,197,254,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,255,253,255,253,255,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,253,251,253,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,255,253,255,253,255,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,138,84,196,253,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,114,0,0,0,255,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,197,255,253,254,253,85,197,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,251,253,251,253,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,255,253,255,253,254,253,254,253,254,253,198,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,253,251,253,251,253,251,253,251,253,251,114,0,0,0,0,0,0,0,0,0,0,0,0,0,198,253,254,253,141,253,254,253,254,196,57,168,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,0,28,196,253,251,253,251,253,251,84,28,0,0,253,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,254,253,169,168,0,0,0,0,57,168,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,253,251,84,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,85,255,253,255,253,255,253,198,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,253,251,253,251,253,251,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,254,253,254,253,254,253,254,253,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,253,138,253,251,253,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,169,224,253,251,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,85,197,254,253,254,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,224,253,251,253,251,253,251,253,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,254,253,254,253,254,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,253,138,139,138,139,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,168,0,0,0,0,85,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,57,168,0,0,0,0,0,0,0,114,253,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,139,57,0,85,85,254,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,225,168,253,251,253,251,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,170,225,254,253,254,253,254,253,226,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,84,83,253,251,253,251,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70,255,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,69,253,242,172,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,253,253,188,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,191,253,200,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,197,253,175,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,253,253,129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,230,253,253,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,183,69,0,0,0,0,0,0,85,243,253,174,54,0,0,0,0,0,0,0,0,0,0,0,0,0,101,131,246,142,0,0,0,0,0,89,187,253,169,70,0,0,0,0,0,0,0,0,0,0,0,0,0,131,248,253,175,6,0,0,0,0,64,246,253,234,64,0,0,0,0,0,0,0,0,0,0,0,0,0,14,247,253,253,176,24,24,24,22,0,70,253,253,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,146,253,253,253,253,253,253,253,241,124,159,253,253,117,0,0,0,0,0,0,0,0,0,0,0,0,0,84,241,253,253,253,253,253,253,253,253,253,253,253,253,38,0,0,0,0,0,0,0,0,0,0,0,0,68,236,253,253,253,253,187,84,84,130,239,253,253,253,175,13,0,0,0,0,0,0,0,0,0,0,0,0,101,253,253,253,253,189,8,0,0,0,94,253,253,246,75,0,0,0,0,0,0,0,0,0,0,0,0,0,138,253,253,230,74,17,0,0,0,104,242,253,253,247,84,0,0,0,0,0,0,0,0,0,0,0,0,0,152,217,92,58,0,0,0,0,85,245,253,253,253,233,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,183,253,253,253,223,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,179,253,248,199,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,99,240,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,131,225,225,225,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,73,197,253,252,252,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,29,29,154,187,252,252,253,252,252,233,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,252,253,252,252,252,252,253,204,112,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,253,255,253,228,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,243,252,253,252,246,130,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,240,252,252,253,252,252,252,221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,252,252,236,225,223,230,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,146,252,157,50,0,0,25,205,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,207,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,19,0,0,0,0,0,0,0,0,0,73,205,252,79,0,0,0,0,0,0,0,0,0,0,0,0,120,215,209,175,0,0,0,0,0,0,0,19,209,252,220,79,0,0,0,0,0,0,0,0,0,0,0,0,174,252,252,239,140,0,0,0,0,0,29,104,252,249,177,0,0,0,0,0,0,0,0,0,0,0,0,0,174,252,252,223,0,0,0,0,0,0,174,252,252,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,241,253,146,0,0,0,0,169,253,255,253,253,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,178,252,154,85,85,210,225,243,252,215,121,27,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,208,220,252,253,252,252,214,195,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,37,84,146,223,114,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,114,254,254,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,194,253,253,235,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,227,253,253,214,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,183,253,253,253,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,238,253,249,178,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,162,254,253,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,253,254,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,250,253,254,143,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,205,253,253,86,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,247,253,164,62,0,98,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,254,254,228,105,106,140,254,254,122,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,253,253,253,253,254,253,253,253,253,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58,227,253,253,253,253,254,253,253,253,253,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,253,253,253,253,253,254,253,253,253,253,152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,250,253,253,253,253,121,105,227,253,253,231,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,253,253,253,253,253,210,254,253,251,223,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,253,253,253,253,253,253,254,221,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,190,253,253,253,253,253,255,214,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,180,141,59,59,155,104,166,180,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,110,71,142,168,164,105,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,254,255,236,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,164,253,253,253,226,60,47,47,47,56,200,200,200,116,0,0,0,0,0,0,0,0,0,0,0,0,0,54,163,253,253,253,253,253,253,253,253,253,253,253,253,145,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,253,253,253,253,253,253,253,253,253,253,253,250,93,0,0,0,0,0,0,0,0,0,0,0,0,0,210,253,253,253,253,233,74,61,61,114,253,253,253,128,0,0,0,0,0,0,0,0,0,0,0,0,0,81,250,253,253,253,236,56,0,0,0,70,253,253,219,42,0,0,0,0,0,0,0,0,0,0,0,0,0,146,253,240,84,14,13,0,0,8,85,225,253,214,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,68,58,0,0,0,0,0,43,253,253,251,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,216,253,253,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,218,253,253,142,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,246,251,230,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,91,190,253,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,204,253,253,187,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,253,253,192,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,245,253,253,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,166,253,253,253,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,139,253,253,253,253,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,253,253,253,197,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,253,235,87,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,253,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,113,255,253,253,253,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,210,225,228,252,253,252,252,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,135,253,252,252,214,195,196,246,252,245,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,138,224,252,240,223,192,28,0,13,228,252,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,252,252,252,63,0,0,0,0,191,252,252,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,253,178,63,0,0,0,92,253,255,253,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,252,84,0,0,76,194,243,252,253,129,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,252,199,57,198,246,252,252,220,56,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,252,252,252,253,242,223,129,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,252,252,252,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,253,253,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,225,253,252,252,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,88,234,252,253,154,177,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,252,252,252,240,24,57,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,252,252,252,63,0,57,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,238,253,240,63,0,38,222,253,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,238,252,252,99,0,0,131,252,242,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,208,56,57,198,246,252,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,146,249,233,224,252,253,242,192,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,252,252,252,112,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,128,254,255,254,194,123,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,173,253,253,253,253,253,253,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,179,253,253,253,208,147,225,253,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30,216,253,208,182,92,11,0,128,168,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,253,245,61,0,0,0,40,226,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,253,180,0,25,107,107,227,253,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,167,253,181,199,245,253,253,253,239,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,252,253,253,253,253,253,179,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,212,219,253,253,174,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,253,235,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,232,253,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,236,253,203,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,253,253,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,241,253,152,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,253,239,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,184,253,152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,245,252,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,183,253,247,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,207,253,247,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,207,253,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,118,118,121,254,254,135,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,220,250,253,253,253,253,253,253,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,252,253,253,253,253,253,253,253,253,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,253,253,253,253,253,253,253,253,253,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,219,219,219,219,241,253,253,253,242,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,253,253,248,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,0,165,253,253,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,170,248,251,248,251,253,253,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,253,253,253,253,253,253,253,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,253,253,253,253,253,253,253,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,253,253,240,179,162,253,253,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,241,103,65,0,28,253,253,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,62,0,0,0,28,253,253,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,253,253,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,253,253,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,83,79,0,0,0,0,0,165,253,253,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,253,250,128,63,7,51,89,234,253,223,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,217,253,253,253,186,239,253,253,248,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,234,253,253,253,253,253,240,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,186,253,253,216,116,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,85,141,253,255,253,254,253,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,253,251,253,251,225,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,254,253,254,253,254,253,254,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,197,251,253,251,253,251,253,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,254,253,254,196,198,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,253,251,84,28,85,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,85,85,85,85,197,254,253,254,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,197,251,253,251,253,251,253,251,253,251,225,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,254,253,254,253,254,253,254,253,254,253,254,139,0,0,0,0,0,0,0,0,0,0,0,0,0,114,197,251,253,251,196,196,253,251,253,251,253,251,253,251,114,0,0,0,0,0,0,0,0,0,0,0,29,197,254,253,254,196,29,197,254,253,254,84,0,114,254,253,254,84,0,0,0,0,0,0,0,0,0,0,85,251,253,251,253,83,197,251,253,251,196,28,0,0,139,251,253,196,0,0,0,0,0,0,0,0,0,0,86,253,254,253,254,253,254,253,226,56,0,0,0,0,0,169,254,253,57,0,0,0,0,0,0,0,0,0,28,196,253,251,253,251,253,138,56,0,0,0,0,0,0,168,253,251,168,0,0,0,0,0,0,0,0,0,0,169,254,253,254,253,169,56,0,0,0,0,0,0,0,0,57,168,0,0,0,0,0,0,0,0,0,0,0,168,253,251,196,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,113,176,253,253,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,228,252,253,252,252,249,225,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,104,240,252,252,253,252,252,252,252,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,252,252,252,252,162,84,84,180,252,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,253,252,252,236,112,0,0,0,29,252,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,253,255,215,140,47,0,0,0,0,0,79,255,253,56,0,0,0,0,0,0,0,0,0,0,0,0,0,154,252,215,33,0,0,0,0,0,0,0,48,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,76,234,252,140,0,0,0,0,0,0,0,23,227,253,233,43,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,47,0,0,0,0,0,0,23,131,252,253,151,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,173,0,0,0,0,0,0,48,227,252,252,190,12,0,0,0,0,0,0,0,0,0,0,0,0,0,198,253,253,114,113,113,113,113,255,253,253,253,253,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,253,252,252,252,252,253,176,233,252,252,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,155,252,253,252,208,195,195,56,25,209,252,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,84,84,84,19,0,0,0,101,252,233,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,252,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,253,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,113,252,201,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,222,252,164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,222,253,253,255,253,253,253,253,192,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,252,252,252,253,252,252,252,252,253,243,175,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,239,252,252,253,252,252,198,55,253,252,195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,143,87,96,84,84,84,28,95,253,252,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,50,0,0,0,95,203,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,144,253,253,255,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,163,226,249,252,252,252,75,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,252,253,252,252,252,252,166,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,252,240,99,84,103,252,253,122,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,112,63,0,0,29,252,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,253,252,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,253,252,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,253,195,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,120,253,174,63,0,0,0,0,0,0,26,207,253,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,241,72,0,0,0,0,29,200,252,252,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,253,186,13,0,0,120,215,252,245,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,227,252,253,252,77,44,169,253,252,252,208,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,112,253,252,252,252,252,253,252,141,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,255,253,255,253,254,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,224,253,251,253,251,253,251,225,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,254,253,254,253,254,253,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,253,251,253,251,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,254,196,198,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,251,196,83,84,28,197,251,196,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,196,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,85,85,85,0,0,0,0,85,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,197,251,253,251,169,168,169,168,197,251,253,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,254,253,254,253,254,253,254,253,254,139,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,251,253,251,253,251,253,251,253,251,253,251,114,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,254,196,114,0,29,197,254,253,254,196,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,168,253,251,253,83,0,0,197,251,253,251,84,28,139,251,253,196,114,0,0,0,0,0,0,0,0,0,86,253,254,253,114,57,141,253,254,253,114,0,0,0,85,253,254,253,57,0,0,0,0,0,0,0,0,0,28,196,253,251,169,224,253,251,196,83,0,0,0,0,28,196,253,251,168,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,254,196,114,0,0,0,0,0,0,114,254,253,169,0,0,0,0,0,0,0,0,0,0,0,139,251,253,251,196,28,0,0,0,0,0,0,0,0,139,138,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,194,253,253,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,251,251,251,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,251,251,183,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,241,251,214,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,253,251,251,212,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,253,251,251,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,199,253,251,251,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,136,251,253,251,196,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,136,251,253,187,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,61,225,251,253,134,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,119,253,253,255,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,251,251,251,225,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,251,251,251,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,251,251,251,164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,61,228,251,251,175,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155,251,251,251,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,237,251,251,251,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,251,251,251,208,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,251,251,208,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,251,236,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,128,0,0,0,0,0,0,64,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,0,0,0,0,0,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,128,0,0,0,0,0,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,0,0,0,0,0,191,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,64,0,0,0,0,0,64,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,255,255,255,191,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,191,128,0,0,128,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,191,128,0,0,0,0,0,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,128,0,0,0,0,0,0,64,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,147,255,170,137,177,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,148,252,253,253,253,253,253,237,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,151,241,244,253,253,253,253,253,242,142,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,253,253,253,253,253,253,253,223,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,253,253,228,155,128,25,46,186,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,253,143,24,0,0,0,0,159,131,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,122,248,253,51,0,0,0,0,0,109,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,232,253,253,114,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,248,253,253,253,253,240,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,105,253,253,198,188,206,253,210,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,144,65,10,0,56,240,253,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,196,253,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,106,253,161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,253,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,253,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,150,156,29,0,0,0,0,146,253,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118,253,253,213,29,0,0,53,230,253,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,234,252,253,214,77,143,231,253,250,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,166,252,253,253,253,214,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,234,253,149,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,109,171,253,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,252,253,252,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,37,161,232,252,237,215,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,105,206,253,252,252,168,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,109,110,149,252,252,253,158,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,161,252,253,252,252,252,222,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,181,252,253,252,252,168,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,221,252,253,252,252,252,207,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,233,253,253,255,253,253,253,255,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,109,252,252,252,222,179,179,221,253,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,215,215,132,41,0,6,160,253,179,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,252,253,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,253,255,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,242,252,222,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,252,252,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,144,144,0,0,0,0,145,237,252,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,218,253,253,83,0,16,109,255,253,237,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,154,231,252,154,115,222,252,253,231,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,252,252,252,252,252,154,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,252,252,252,148,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,26,0,0,0,0,0,0,0,0,62,91,213,254,255,254,255,158,6,0,0,0,0,0,0,0,0,0,85,68,0,0,0,0,0,0,0,6,177,253,253,253,253,253,253,253,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,253,253,253,253,253,253,253,253,210,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,253,253,253,238,220,220,142,253,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,214,253,161,71,0,0,222,253,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,40,10,0,0,0,222,253,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,222,253,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,250,253,186,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,206,253,253,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,253,253,253,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,238,253,251,148,5,0,0,0,0,0,0,0,0,0,0,0,0,0,49,99,99,9,0,0,0,0,74,169,253,253,131,0,0,0,0,0,0,0,0,0,0,0,0,0,80,189,220,253,253,195,189,135,25,89,237,253,253,240,29,0,0,0,0,0,0,0,0,0,0,0,0,8,173,253,253,253,253,253,253,253,253,253,253,253,159,67,0,0,0,0,0,0,0,0,0,0,0,0,0,149,253,253,253,253,253,253,253,253,253,253,253,159,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,180,253,253,253,253,253,253,253,253,253,253,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,253,253,253,253,253,253,253,234,235,253,253,239,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,253,253,253,253,253,214,106,72,72,162,253,253,167,148,19,0,0,0,0,0,0,0,0,0,0,0,0,1,116,253,217,179,89,11,0,0,0,99,253,253,241,94,2,0,0,0,0,0,0,0,0,0,0,0,0,0,38,89,46,0,0,0,0,0,0,35,211,253,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,253,253,253,255,253,253,253,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,109,252,252,252,253,252,252,252,238,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,195,215,215,154,82,211,252,237,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,155,252,252,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,171,252,252,189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,176,217,253,252,179,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,242,252,252,253,252,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,252,252,253,252,236,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,125,0,110,253,253,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,109,252,220,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,109,252,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,109,252,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,154,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,253,252,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,221,253,200,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,160,252,253,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,110,233,253,253,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,154,73,94,237,253,252,241,179,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,206,252,252,252,252,253,220,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,252,252,252,168,108,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,163,253,195,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,154,203,252,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,234,252,252,253,252,149,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,252,252,252,253,252,227,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,253,240,140,114,253,228,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,58,24,0,238,252,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,255,253,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,85,48,0,0,0,15,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,88,203,252,229,150,57,57,135,253,233,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,181,252,252,252,253,252,252,252,252,253,177,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,113,252,252,252,252,253,252,252,252,252,253,252,165,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,253,253,190,141,178,253,253,253,255,253,253,253,174,114,75,0,0,0,0,0,0,0,0,0,0,0,90,243,252,252,237,147,234,252,195,89,27,152,167,224,252,253,195,85,76,0,0,0,0,0,0,0,0,0,0,116,252,252,252,253,252,208,65,0,0,0,0,37,55,196,246,252,246,197,0,0,0,0,0,0,0,0,0,28,84,177,223,162,84,19,0,0,0,0,0,0,0,0,122,230,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,112,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,255,212,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,177,253,253,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,177,253,213,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,251,253,183,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,253,253,183,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,253,253,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,253,253,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,231,253,253,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,231,253,253,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,231,253,215,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,231,253,129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,242,242,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,253,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,138,253,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,102,253,253,240,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,185,253,253,253,205,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,187,253,253,233,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,253,220,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,179,253,253,143,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,253,173,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70,121,255,253,253,211,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,107,191,247,252,253,252,252,252,213,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,197,252,252,252,252,159,103,229,252,192,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,252,239,158,39,39,0,34,235,226,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,53,44,0,0,0,0,212,252,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,118,249,232,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,118,215,253,252,223,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,218,252,252,253,252,252,223,125,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,252,251,238,176,106,154,250,252,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,82,119,113,0,0,0,0,142,252,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,253,129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,252,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,252,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,252,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,172,200,109,25,0,0,0,0,75,244,252,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,252,252,252,93,0,0,0,0,192,252,202,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,252,252,252,183,0,0,20,97,244,197,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30,219,252,252,242,83,27,134,252,252,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,241,252,252,252,252,253,246,119,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,140,252,252,252,190,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,121,176,253,140,121,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,107,184,240,253,252,252,252,252,243,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,119,252,252,252,253,252,252,252,252,252,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,187,252,252,252,252,253,218,172,197,252,252,212,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,186,252,241,185,108,53,53,31,0,116,252,252,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,109,252,241,97,0,0,0,0,0,20,221,252,241,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,213,252,177,0,0,0,0,0,39,189,252,241,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,238,252,66,0,0,2,27,91,247,252,243,165,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,252,252,76,106,146,152,252,253,252,252,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,252,252,252,252,252,252,252,253,252,202,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,214,253,253,253,240,127,0,255,253,159,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,13,13,13,11,0,128,253,207,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,240,253,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,252,253,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,146,252,253,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,146,252,228,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,219,252,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,218,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,109,255,253,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,181,252,253,252,247,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,232,252,253,252,252,211,182,181,181,181,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,217,252,252,253,252,252,252,253,252,252,252,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,170,252,252,252,206,143,143,143,253,252,252,189,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,252,252,241,179,20,0,11,155,253,252,179,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,215,91,61,0,0,73,191,252,237,91,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,237,252,252,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,237,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,155,253,189,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58,252,253,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,181,252,191,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,253,253,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,242,246,132,37,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,191,252,153,144,253,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,253,253,253,253,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,237,252,252,252,252,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,252,252,252,226,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,252,252,210,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,80,116,254,254,255,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,105,184,253,253,253,253,253,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,237,247,253,253,253,253,253,253,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,253,253,253,253,253,253,253,253,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,95,209,209,106,71,232,253,253,181,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,190,253,197,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,253,249,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,238,253,218,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,153,253,253,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,253,253,207,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,246,253,218,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,71,248,253,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,149,149,149,149,185,253,253,253,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,253,253,253,253,253,253,253,253,73,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,131,237,253,253,253,253,253,253,253,253,253,190,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,159,253,253,253,253,253,253,253,219,238,253,253,218,131,9,0,0,0,0,0,0,0,0,0,0,0,0,28,191,253,253,253,253,249,138,138,4,83,242,253,253,201,33,0,0,0,0,0,0,0,0,0,0,0,0,195,253,253,253,253,245,106,0,0,0,0,216,253,253,226,46,0,0,0,0,0,0,0,0,0,0,0,0,237,253,253,253,243,92,0,0,0,0,0,53,253,253,253,60,0,0,0,0,0,0,0,0,0,0,0,0,116,253,253,253,105,0,0,0,0,0,0,17,168,253,253,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,100,255,180,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,109,253,245,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,188,253,186,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,119,253,238,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,253,194,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,56,253,253,230,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,208,253,253,201,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,193,253,204,113,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,183,253,253,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,142,253,221,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,219,253,253,157,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,253,253,214,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,228,253,247,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,91,214,253,199,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,242,253,253,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,213,253,253,199,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,253,253,253,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,153,246,253,207,20,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,179,253,98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,115,189,254,255,232,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,237,253,253,253,253,188,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,235,253,253,253,253,253,232,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,253,253,253,253,253,253,253,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,253,253,253,253,253,253,223,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,229,253,253,253,253,253,253,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,162,247,250,253,253,253,219,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,195,253,227,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,249,253,131,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,253,246,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,78,238,253,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,95,169,213,225,253,253,243,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,231,231,253,253,253,253,253,253,241,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,219,252,253,253,241,167,153,253,253,253,253,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,123,253,253,253,164,0,5,137,253,253,253,253,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,171,253,253,183,4,5,136,253,253,169,216,253,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,171,253,253,117,35,190,253,253,203,30,113,253,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,253,253,207,227,253,253,167,12,0,206,253,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,96,253,253,253,197,79,11,0,0,231,249,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,17,122,22,8,0,0,0,0,231,241,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,191,255,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,255,255,255,255,255,191,191,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,255,191,255,255,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,191,128,64,128,128,128,191,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,128,0,0,0,0,0,0,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,128,0,0,0,0,64,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,128,0,0,128,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,191,0,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,191,255,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,128,0,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,128,0,64,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,128,0,128,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,191,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,255,255,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,255,255,191,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,128,255,255,255,255,191,0,0,128,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,255,255,255,255,191,128,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,191,128,128,191,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,64,0,64,64,0,0,0,191,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,64,0,0,64,0,0,64,191,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,128,0,0,0,0,0,128,191,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,0,0,0,0,0,191,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,191,128,128,191,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,128,191,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,167,252,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,200,248,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,222,254,253,147,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70,254,254,254,254,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70,254,254,254,254,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70,254,254,254,254,26,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70,254,254,254,254,254,147,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,204,254,254,251,77,182,254,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,207,254,254,251,71,11,27,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,220,254,120,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,254,245,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,231,255,206,19,28,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,254,254,206,72,110,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,252,254,254,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,181,254,254,189,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,254,254,254,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,233,254,254,150,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,254,254,236,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,224,254,244,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,254,254,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,154,160,215,255,255,98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,118,222,253,253,253,253,253,164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,245,253,253,253,253,253,253,253,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,105,231,253,253,253,253,253,253,253,253,228,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,216,253,253,253,253,253,253,253,253,253,253,253,234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,161,253,223,122,32,135,232,162,134,210,253,197,159,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,253,58,27,123,145,30,18,202,253,242,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,161,253,215,155,191,108,19,115,253,241,152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,253,253,191,11,19,115,253,253,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,162,253,235,196,210,253,253,184,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,186,244,253,253,253,253,184,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,156,253,253,253,241,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,204,253,253,253,253,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,91,245,253,253,241,225,253,234,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,253,253,242,152,26,216,253,161,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,169,253,253,155,0,0,82,220,253,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,253,253,253,38,0,0,27,215,253,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,244,253,253,160,143,40,14,126,253,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,237,253,253,253,253,253,253,253,253,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,123,234,253,253,253,253,253,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,191,128,64,128,191,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,0,0,0,128,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,191,0,0,128,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,128,0,0,191,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,64,0,64,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,128,64,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,128,255,255,191,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,191,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,128,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,128,0,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,191,128,64,128,191,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,191,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,191,255,191,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,191,64,128,128,128,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,128,128,191,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,191,0,128,0,0,191,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,64,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,96,96,96,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,190,221,251,251,253,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,127,253,251,251,251,251,253,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,251,253,251,251,251,251,253,248,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,158,240,251,253,231,94,94,193,253,251,204,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,214,253,253,253,159,0,0,0,60,255,253,253,31,0,0,0,0,0,0,0,0,0,0,0,0,0,20,253,251,251,251,251,158,4,112,190,228,253,251,251,197,91,0,0,0,0,0,0,0,0,0,0,0,32,205,253,251,251,251,251,206,142,188,126,204,253,251,251,251,251,0,0,0,0,0,0,0,0,0,0,0,64,251,253,251,219,148,31,91,168,15,0,19,31,157,251,251,211,0,0,0,0,0,0,0,0,0,0,0,162,251,253,231,47,0,0,0,0,0,0,0,0,32,251,251,94,0,0,0,0,0,0,0,0,0,12,174,253,253,219,39,0,0,0,0,0,0,0,0,0,32,253,229,59,0,0,0,0,0,0,0,0,0,151,251,251,231,39,0,0,0,0,0,0,0,0,0,0,151,251,168,0,0,0,0,0,0,0,0,0,0,190,251,251,94,0,0,0,0,0,0,0,0,0,0,0,190,251,31,0,0,0,0,0,0,0,0,0,84,244,251,156,12,0,0,0,0,0,0,0,0,16,64,223,244,219,23,0,0,0,0,0,0,0,0,0,96,251,251,31,0,0,0,0,0,0,0,0,80,181,251,253,132,47,0,0,0,0,0,0,0,0,0,0,255,253,253,31,0,96,84,0,0,0,96,214,253,253,253,100,0,0,0,0,0,0,0,0,0,0,0,0,253,251,251,197,190,253,244,190,190,190,253,247,220,180,62,0,0,0,0,0,0,0,0,0,0,0,0,0,173,251,251,251,251,253,251,251,251,251,126,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,31,110,188,188,189,69,31,31,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,178,255,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,253,229,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,240,253,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,239,253,169,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,239,253,220,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,243,253,135,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,192,253,138,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,136,253,234,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,181,253,249,192,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,253,230,0,0,0,149,177,172,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,253,138,0,55,114,244,253,253,247,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,249,253,175,213,241,253,253,253,253,253,246,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,253,253,253,253,253,253,253,253,253,253,253,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,209,253,253,253,251,158,32,5,5,66,194,253,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,253,253,239,157,89,0,0,0,0,0,30,248,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,253,253,108,0,0,0,0,0,0,30,170,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,253,253,42,0,0,0,0,0,60,217,193,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,253,253,170,84,84,84,174,201,249,150,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,112,253,253,253,253,253,253,253,161,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,122,193,253,234,135,135,36,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,188,255,164,0,0,0,0,0,112,118,118,99,0,0,0,0,0,0,0,0,0,0,0,0,0,21,116,245,253,253,246,234,234,234,234,234,252,253,253,250,88,0,0,0,0,0,0,0,0,0,0,0,0,171,253,253,253,253,253,253,253,253,253,253,253,253,253,218,15,0,0,0,0,0,0,0,0,0,0,0,47,206,253,250,198,64,61,61,61,61,61,61,84,235,240,92,0,0,0,0,0,0,0,0,0,0,0,14,219,253,253,146,0,0,0,0,0,0,0,0,123,253,191,0,0,0,0,0,0,0,0,0,0,0,0,104,253,253,233,42,0,0,0,0,0,0,0,75,248,253,184,0,0,0,0,0,0,0,0,0,0,0,0,234,253,253,147,0,0,0,0,0,0,0,0,125,253,253,54,0,0,0,0,0,0,0,0,0,0,0,0,58,143,114,2,0,0,0,0,0,0,0,7,250,253,172,2,0,0,0,0,0,0,0,0,0,0,0,0,0,164,33,0,0,0,0,0,0,0,25,228,253,253,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,0,0,0,0,0,0,0,14,163,253,253,225,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,253,253,253,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,253,253,172,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,253,253,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,219,253,246,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,253,227,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,123,247,253,181,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,121,248,253,253,122,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,249,253,253,245,189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,253,253,236,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,253,204,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,253,138,105,62,0,7,105,105,105,183,253,208,0,0,0,0,0,0,0,0,0,0,0,0,0,18,78,231,252,252,252,235,208,211,252,252,252,252,252,171,0,0,0,0,0,0,0,0,0,0,0,0,0,84,252,252,252,252,252,253,252,252,252,238,247,252,252,59,0,0,0,0,0,0,0,0,0,0,0,0,57,237,252,252,252,160,132,133,132,132,132,15,178,252,209,31,0,0,0,0,0,0,0,0,0,0,18,84,237,252,243,177,125,7,0,0,0,0,36,119,243,212,27,0,0,0,0,0,0,0,0,0,0,0,78,252,252,252,239,70,0,0,0,0,0,0,49,235,252,197,8,0,0,0,0,0,0,0,0,0,0,0,208,252,252,212,104,0,0,0,0,0,0,8,189,252,156,56,0,0,0,0,0,0,0,0,0,0,0,0,208,246,92,10,0,0,0,0,0,0,22,100,252,252,74,0,0,0,0,0,0,0,0,0,0,0,0,0,49,55,0,0,0,0,0,0,0,0,87,252,252,168,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,252,181,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,255,253,253,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,173,253,252,252,203,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,185,253,252,242,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,197,253,252,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,252,253,252,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,82,235,252,253,209,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,245,252,252,253,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,252,252,252,216,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,224,252,244,207,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30,252,252,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,191,255,128,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,191,255,255,64,0,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,0,0,64,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,191,0,0,0,128,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,0,0,0,128,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,0,0,128,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,128,191,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,255,255,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,255,255,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,255,191,64,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,191,128,191,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,191,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,255,190,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,164,180,251,253,253,246,180,154,17,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,230,253,253,253,253,253,253,253,253,195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,197,248,253,253,253,253,253,253,253,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,61,148,253,253,253,253,169,129,222,253,253,253,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,148,253,253,253,253,151,13,0,51,253,253,227,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,253,253,253,127,114,3,0,55,150,253,230,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,219,240,187,18,0,0,0,99,253,253,238,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,79,0,0,0,0,6,194,253,253,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,88,253,245,97,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,253,253,244,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,221,253,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,174,189,189,232,243,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,191,253,253,253,253,154,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,48,234,253,253,246,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,242,253,253,159,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,253,253,253,120,58,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,206,253,253,253,253,195,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,253,253,253,181,179,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,253,253,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,101,101,199,255,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,47,47,183,236,253,253,253,253,199,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,77,179,253,253,253,253,253,253,159,107,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,250,253,253,253,253,238,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,253,253,226,139,61,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,253,253,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,241,253,180,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,198,253,253,185,31,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,246,253,253,253,253,193,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,243,253,253,253,253,253,253,191,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,253,253,250,230,136,246,253,253,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,253,211,114,0,0,177,253,253,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,30,20,0,0,0,27,174,253,247,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,253,253,238,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,177,253,253,238,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,62,203,242,223,191,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,69,0,6,8,153,173,253,253,248,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,223,169,109,218,253,253,253,253,220,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,253,253,253,253,253,235,180,45,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,128,253,253,135,99,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,73,73,73,73,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,181,253,252,252,252,253,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,252,253,252,252,252,253,179,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,211,252,253,252,252,252,253,252,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,144,252,252,253,252,252,252,253,252,216,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,120,212,252,226,215,72,195,112,154,253,252,236,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,252,253,252,71,0,0,0,0,0,108,232,236,144,0,0,0,0,0,0,0,0,0,0,0,0,0,156,253,253,192,15,0,0,0,0,0,0,63,238,232,47,0,0,0,0,0,0,0,0,0,0,0,84,217,227,252,128,35,5,0,0,0,0,0,0,63,237,252,148,0,0,0,0,0,0,0,0,0,0,27,181,252,241,195,31,0,0,0,0,0,0,0,0,79,242,231,87,0,0,0,0,0,0,0,0,0,42,160,252,252,97,0,0,0,0,0,0,0,0,0,0,191,252,231,46,0,0,0,0,0,0,0,0,0,32,212,253,253,35,0,0,0,0,0,0,0,32,31,63,255,253,154,0,0,0,0,0,0,0,0,0,32,207,252,210,118,5,0,0,0,0,11,73,218,227,206,175,253,231,51,0,0,0,0,0,0,0,0,0,47,232,252,190,0,0,0,0,0,0,37,190,253,252,252,252,253,158,0,0,0,0,0,0,0,0,0,0,109,252,252,190,0,42,144,144,145,144,221,252,253,252,252,168,108,15,0,0,0,0,0,0,0,0,0,0,145,238,253,253,253,253,253,253,255,253,253,253,145,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,179,179,210,210,252,210,180,138,35,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,31,71,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,254,254,237,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,96,238,253,253,253,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,114,253,253,253,253,253,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,198,255,253,253,253,182,253,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,107,253,254,235,81,29,12,56,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,196,253,253,180,57,0,0,0,31,134,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,247,253,253,71,0,0,0,0,31,253,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,82,247,253,237,75,0,0,0,0,0,20,211,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,179,253,253,208,0,0,0,0,0,0,0,32,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,223,253,253,208,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,121,254,254,254,217,124,0,0,87,202,254,122,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,253,253,221,37,0,0,123,246,253,253,253,197,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,128,253,251,112,6,42,164,254,253,253,253,253,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,253,253,152,0,161,253,253,254,253,253,253,253,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,164,253,253,74,0,239,253,253,223,178,90,214,253,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,253,253,74,0,240,253,146,44,0,2,135,253,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,164,253,253,74,0,239,253,183,0,32,142,253,253,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,253,253,243,239,252,253,253,241,243,253,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,129,248,253,253,253,253,253,254,253,224,208,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,210,253,253,253,253,192,104,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,191,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,255,255,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,255,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,255,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,96,96,214,253,114,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,32,191,190,190,205,251,253,251,251,251,212,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,143,251,253,251,251,251,251,253,251,251,251,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,229,251,253,251,251,251,251,253,251,251,251,211,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,205,251,251,253,251,172,94,193,253,251,251,211,35,0,0,0,0,0,0,0,0,0,0,0,0,0,96,214,253,253,253,159,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,253,251,251,251,251,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,158,253,251,251,251,251,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,158,253,251,251,251,251,242,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,193,94,94,232,251,253,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,253,255,221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,221,251,253,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,0,0,0,0,0,0,221,251,253,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,240,111,0,0,0,8,143,248,251,169,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,126,0,0,0,32,251,251,251,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,253,213,36,96,214,253,253,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,233,251,251,251,212,253,251,251,243,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,220,251,251,251,253,251,251,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,220,251,251,253,243,109,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,232,251,95,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,255,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,224,253,251,225,168,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,254,253,254,139,85,85,141,139,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,253,251,253,251,253,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,254,253,254,253,254,253,254,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,253,251,253,251,253,251,253,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,169,168,114,0,85,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,251,196,83,0,0,0,0,85,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,224,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,254,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,224,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,198,253,254,253,198,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,251,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,206,246,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,161,254,254,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,204,254,178,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,254,244,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,246,254,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,254,254,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,127,179,20,0,89,243,254,183,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,254,254,58,0,184,254,254,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,201,254,197,12,48,240,254,223,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,254,254,82,17,177,254,243,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,105,247,254,254,82,97,254,254,178,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,248,254,254,254,234,238,254,254,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,199,254,254,254,254,254,255,254,194,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,254,254,254,221,227,254,254,254,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,212,222,107,14,163,254,254,254,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,237,254,254,218,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,254,254,254,195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,159,254,254,251,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,237,254,253,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,235,254,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,190,255,253,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,252,253,252,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,185,252,253,212,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,252,252,215,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,184,252,252,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,155,252,249,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,252,252,217,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,228,252,221,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,252,252,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,227,252,252,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,253,253,213,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,136,252,229,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,227,252,198,0,0,0,0,0,40,94,206,226,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,252,252,198,0,0,0,0,144,229,252,252,252,244,110,0,0,0,0,0,0,0,0,0,0,0,0,0,94,252,252,198,0,0,46,200,253,252,252,252,252,252,222,25,0,0,0,0,0,0,0,0,0,0,0,0,94,252,252,198,0,119,224,252,253,252,252,252,252,252,252,93,0,0,0,0,0,0,0,0,0,0,0,0,79,246,252,235,173,223,252,252,253,252,252,252,252,252,203,29,0,0,0,0,0,0,0,0,0,0,0,0,0,128,252,252,252,252,252,252,253,252,252,229,225,127,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,140,238,238,247,252,252,240,112,106,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,252,181,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,206,253,153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,143,221,251,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,190,251,251,251,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,244,251,251,113,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,251,251,211,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,100,255,253,253,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,190,253,251,156,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,251,253,251,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,251,253,223,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,181,251,253,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,234,253,219,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,221,251,251,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,251,251,251,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,171,251,251,152,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,190,251,251,152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155,253,253,189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,253,251,235,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,158,253,251,188,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,217,253,223,31,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,158,253,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,115,253,253,253,195,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,190,214,251,251,251,251,253,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,143,251,253,251,251,251,251,253,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,190,248,251,253,251,251,251,251,253,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,205,251,251,253,251,172,133,251,253,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,253,253,219,39,0,0,159,255,221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,189,180,62,39,0,0,147,228,253,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,143,251,253,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,221,251,253,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,158,240,251,95,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,174,253,253,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,32,52,111,72,190,131,197,251,251,231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,205,253,251,251,251,251,253,251,251,251,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,251,253,251,251,251,251,253,251,251,251,232,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,221,251,253,251,251,251,251,253,251,251,251,251,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,242,253,255,253,253,253,253,255,181,206,253,253,195,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,103,251,253,251,251,251,231,161,16,32,229,251,253,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,251,253,251,188,126,47,0,0,0,221,251,253,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,129,31,31,15,0,0,0,0,0,181,251,253,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,193,253,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,253,192,12,0,0,0,0,0,0,0,0,114,113,113,101,0,0,0,0,0,0,0,0,0,0,0,51,243,252,253,181,19,0,0,0,76,117,225,225,253,252,252,249,100,0,0,0,0,0,0,0,0,0,0,88,252,252,253,252,100,73,197,198,246,252,252,252,253,252,252,252,112,0,0,0,0,0,0,0,0,0,57,234,252,252,253,252,252,252,252,253,252,230,208,161,253,252,252,138,37,0,0,0,0,0,0,0,0,0,163,252,252,252,253,252,252,252,252,112,112,25,0,79,253,252,220,37,0,0,0,0,0,0,0,0,0,51,238,253,253,253,255,215,110,0,0,0,0,0,13,191,255,253,133,0,0,0,0,0,0,0,0,0,0,238,252,252,242,89,27,18,0,0,0,0,0,51,228,252,253,51,6,0,0,0,0,0,0,0,0,0,0,143,252,208,96,0,0,0,0,0,0,0,0,88,252,252,228,21,0,0,0,0,0,0,0,0,0,0,0,38,84,19,0,0,0,0,0,0,0,13,154,234,249,223,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,252,252,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,255,253,228,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,240,253,252,148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,234,252,253,76,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,252,252,240,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,253,237,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,252,242,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,120,246,252,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,253,252,214,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,174,252,195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,130,225,255,255,212,130,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,219,253,253,253,253,253,253,207,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,101,219,253,249,235,235,235,250,253,253,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,120,253,253,208,79,80,18,0,190,238,244,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,253,253,208,36,123,230,188,6,0,37,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,169,253,226,79,182,253,253,242,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,253,253,239,226,253,253,253,179,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,253,253,253,253,253,253,253,179,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,232,253,244,197,149,253,253,179,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,68,56,0,87,253,253,148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,180,253,201,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,201,253,148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,253,253,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,153,253,232,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,174,253,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,205,253,142,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,253,230,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,247,253,197,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,253,253,197,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,253,229,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,218,255,254,170,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,151,249,253,253,253,253,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,218,253,253,230,142,217,253,227,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,250,253,253,175,51,0,13,103,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,217,253,225,55,7,0,0,86,228,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,206,253,225,49,0,0,0,88,243,253,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,232,253,131,0,0,20,179,242,253,242,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,205,253,253,110,182,209,219,253,253,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,253,253,253,253,253,253,253,253,253,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,103,245,253,253,235,188,188,235,253,243,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,65,65,46,0,44,235,253,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,153,253,220,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,201,253,207,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,253,253,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,253,219,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,202,253,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,253,253,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,253,253,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,204,253,221,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,253,219,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,255,253,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,225,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,254,253,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,253,251,225,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,254,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,251,139,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,169,56,0,169,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,138,0,0,0,168,253,251,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,114,0,0,0,0,169,254,253,198,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,0,0,0,0,0,168,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,254,84,0,0,0,0,0,169,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,196,28,0,0,0,0,0,56,253,251,168,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,0,0,0,0,0,0,0,169,254,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,0,0,0,0,0,0,57,224,253,251,56,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,196,0,0,0,0,0,0,254,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,83,0,0,0,0,0,114,253,251,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,254,139,85,85,254,253,254,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,253,251,253,251,253,251,253,251,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,254,253,254,253,254,253,169,56,0,0,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,56,253,251,253,251,253,251,84,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,159,253,253,253,192,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,225,238,252,252,252,252,253,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,215,252,253,252,252,252,252,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,223,225,99,199,252,252,253,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,252,252,190,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,222,253,190,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,86,219,252,252,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,227,253,252,252,252,221,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,224,252,253,252,252,252,252,216,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,252,252,253,127,112,205,252,253,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,140,140,0,0,0,29,253,255,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,252,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,252,253,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,224,252,253,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,252,252,190,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,222,253,253,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,225,146,0,0,0,0,48,226,249,252,252,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,252,252,135,57,88,197,227,253,252,208,55,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,223,239,253,252,252,252,252,253,179,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,112,237,252,157,112,112,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,222,253,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,86,219,252,252,252,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,150,227,253,252,220,252,252,229,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,76,234,252,252,240,176,37,196,252,253,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,252,252,236,112,63,0,32,215,252,190,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,191,255,253,228,47,0,0,38,222,253,253,141,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,252,253,252,70,0,0,38,219,252,242,167,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,227,253,252,100,19,32,222,252,252,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,237,252,252,196,215,253,252,198,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,237,252,252,252,253,252,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,253,253,253,255,253,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,249,252,252,252,253,252,199,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,252,252,252,252,222,252,252,193,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,253,252,252,249,145,50,237,252,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,253,252,252,145,0,113,252,252,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,253,84,0,114,253,253,162,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,252,93,85,238,252,233,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,143,252,252,221,252,253,252,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,249,252,252,252,240,99,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,146,173,236,112,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,187,232,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,186,252,219,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,211,252,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,179,252,218,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,193,32,0,0,0,64,241,252,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,179,252,119,0,0,0,109,252,241,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,252,250,100,0,0,65,240,252,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,223,252,238,0,0,0,178,252,245,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,134,252,252,239,14,0,6,228,252,178,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,137,252,252,252,252,252,71,177,252,209,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,253,253,253,253,253,253,255,253,253,211,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,250,252,252,235,145,151,252,253,252,252,252,185,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,252,252,154,22,0,14,252,253,252,252,173,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,172,67,11,0,0,14,252,253,252,61,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,252,253,132,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,169,252,228,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,252,252,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,252,252,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,213,252,252,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,252,181,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,185,255,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,245,253,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118,243,253,127,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,253,187,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,128,24,0,0,0,0,58,242,201,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,224,253,130,0,0,0,43,190,253,186,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,182,253,244,98,0,0,0,58,241,253,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,224,253,219,63,0,0,0,56,201,253,125,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,189,253,222,59,0,0,0,0,141,253,253,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,193,253,253,119,0,0,0,0,55,207,253,94,8,0,0,0,0,0,0,0,0,0,0,0,0,0,10,197,253,253,235,90,69,69,52,34,195,253,211,19,0,0,0,0,0,0,0,0,0,0,0,0,0,5,201,253,253,253,253,253,253,253,240,199,241,253,150,19,0,0,0,0,0,0,0,0,0,0,0,0,0,68,253,253,253,204,172,172,172,230,253,253,253,253,211,19,0,0,0,0,0,0,0,0,0,0,0,0,0,5,160,43,43,17,0,0,0,31,155,253,253,226,64,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,253,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,245,253,187,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,204,253,253,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,248,253,190,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,207,253,194,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,152,253,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,204,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,253,253,229,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,253,253,227,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,253,253,193,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,209,253,182,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,194,253,253,189,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,253,253,248,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,233,253,244,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,253,253,219,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,121,238,253,253,49,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,216,253,237,76,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,139,253,215,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,80,211,253,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,62,244,253,245,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,201,253,253,182,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,236,253,234,67,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,174,253,253,234,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,106,218,253,253,174,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,153,253,253,235,147,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,153,253,253,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,94,219,253,213,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,36,211,252,252,252,252,105,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,151,208,252,252,252,252,252,223,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,205,252,253,247,129,196,252,204,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,242,252,223,129,151,0,169,252,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,218,252,221,37,0,29,0,169,252,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,252,252,46,0,0,0,70,237,252,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,211,252,168,5,0,21,239,252,200,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,205,252,252,11,6,180,252,252,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,235,252,242,243,252,252,148,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,111,237,253,253,255,252,149,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,54,175,252,252,252,252,253,216,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,221,252,252,252,252,252,252,253,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,135,252,252,252,252,234,204,250,253,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,252,252,252,252,203,119,0,241,253,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,252,252,252,162,12,0,32,244,244,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,174,252,223,31,0,0,109,252,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,252,252,225,120,97,221,252,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,176,252,252,252,252,252,252,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,98,166,252,252,200,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,219,241,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,254,254,237,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,221,254,254,248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,195,254,254,254,248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,254,254,251,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,244,254,252,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182,254,254,134,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58,251,254,187,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,175,254,254,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,254,254,143,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,227,254,254,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,254,254,182,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,175,254,254,66,0,0,2,98,145,145,90,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,254,254,190,3,0,34,149,254,254,254,254,212,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,187,254,254,124,0,142,245,254,254,254,254,254,254,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,254,250,84,37,237,254,254,255,254,254,254,254,212,25,0,0,0,0,0,0,0,0,0,0,0,0,61,242,254,244,63,221,254,254,228,206,254,254,254,254,254,75,0,0,0,0,0,0,0,0,0,0,0,0,77,254,254,254,254,254,254,254,254,254,254,254,254,254,244,63,0,0,0,0,0,0,0,0,0,0,0,0,29,201,234,235,254,254,254,254,254,254,254,234,234,114,73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,117,117,240,254,254,164,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,211,253,169,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,107,212,242,252,252,238,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,94,157,226,236,252,252,252,252,252,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,102,213,215,252,253,252,252,252,231,172,172,158,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,252,252,252,252,221,185,136,53,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,252,252,252,224,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,252,252,252,210,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,193,252,252,252,252,209,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,252,252,250,246,252,253,207,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,129,252,231,107,70,189,253,252,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,255,253,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,77,253,252,152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,106,253,252,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,221,253,252,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,173,131,9,0,28,125,219,252,253,157,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,252,252,179,160,223,252,252,252,163,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,154,250,252,252,252,250,231,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,224,252,231,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,51,51,92,252,252,90,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,161,250,250,252,250,250,250,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,250,250,250,252,250,250,250,232,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,252,250,250,250,252,250,250,250,252,231,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,203,254,252,252,252,254,252,252,252,254,252,130,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,221,252,250,250,250,232,149,210,250,252,250,250,49,0,0,0,0,0,0,0,0,0,0,0,0,31,151,211,250,252,250,250,250,80,0,151,250,252,250,250,49,0,0,0,0,0,0,0,0,0,0,0,0,51,250,250,250,252,250,250,88,0,0,151,250,252,250,250,49,0,0,0,0,0,0,0,0,0,0,0,41,254,252,252,252,203,121,0,0,0,0,152,252,254,252,252,49,0,0,0,0,0,0,0,0,0,0,62,221,252,250,250,169,0,0,0,0,0,0,151,250,252,250,250,49,0,0,0,0,0,0,0,0,0,0,151,250,252,250,250,49,0,0,0,0,0,0,151,250,252,250,250,49,0,0,0,0,0,0,0,0,0,82,231,250,252,250,128,10,0,0,0,0,0,0,151,250,252,250,250,49,0,0,0,0,0,0,0,0,92,252,252,252,244,121,0,0,0,0,0,0,11,132,252,252,254,252,222,40,0,0,0,0,0,0,0,0,252,250,250,250,202,0,0,0,0,0,0,0,132,250,250,250,252,210,60,0,0,0,0,0,0,0,0,0,252,250,250,250,202,0,0,0,0,0,92,151,252,250,250,250,222,60,0,0,0,0,0,0,0,0,0,0,252,250,250,250,202,0,123,202,203,202,231,250,252,250,250,250,202,0,0,0,0,0,0,0,0,0,0,0,254,252,252,252,255,252,252,252,254,252,252,252,254,232,202,40,0,0,0,0,0,0,0,0,0,0,0,0,252,250,250,250,252,250,250,250,252,250,250,250,232,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,250,250,250,252,250,250,250,252,250,159,100,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,49,170,250,252,250,250,88,49,49,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,237,255,230,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,153,214,253,253,253,210,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,247,253,253,253,253,253,103,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,140,214,253,253,253,253,253,253,245,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,253,253,253,253,253,253,253,253,253,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,217,253,253,253,253,142,130,232,253,253,203,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,223,253,253,253,178,52,5,0,192,253,253,253,78,0,0,0,0,0,0,0,0,0,0,0,0,19,106,223,253,253,253,183,5,0,0,0,36,253,253,253,78,0,0,0,0,0,0,0,0,0,0,0,0,44,253,253,253,252,183,24,0,0,0,0,34,248,253,253,78,0,0,0,0,0,0,0,0,0,0,0,0,106,253,253,253,183,0,0,0,0,0,0,0,115,253,253,78,0,0,0,0,0,0,0,0,0,0,0,0,219,253,253,183,24,0,0,0,0,0,0,0,115,253,253,78,0,0,0,0,0,0,0,0,0,0,18,168,252,253,227,5,0,0,0,0,0,0,0,10,152,253,253,78,0,0,0,0,0,0,0,0,0,0,62,253,253,253,124,0,0,0,0,0,0,0,0,138,253,253,253,78,0,0,0,0,0,0,0,0,0,0,220,253,253,227,41,0,0,0,0,0,0,0,28,219,253,253,233,62,0,0,0,0,0,0,0,0,0,83,245,253,253,130,0,0,0,0,0,0,0,28,195,253,253,244,75,0,0,0,0,0,0,0,0,0,66,237,253,253,216,22,0,0,0,0,0,35,36,202,253,253,253,211,0,0,0,0,0,0,0,0,0,0,80,253,253,253,229,59,0,0,84,115,115,249,253,253,253,237,138,33,0,0,0,0,0,0,0,0,0,0,80,253,253,253,253,224,193,193,237,253,253,253,253,249,235,81,0,0,0,0,0,0,0,0,0,0,0,0,80,253,253,253,253,253,253,253,253,253,253,253,196,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,187,253,253,253,253,253,253,253,253,137,78,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,114,254,254,255,175,106,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,123,246,253,253,253,253,253,253,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,254,253,253,253,253,253,253,253,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,254,253,253,253,253,253,253,253,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,106,179,55,29,65,236,253,253,173,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,39,214,253,253,237,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,233,253,253,253,253,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,247,253,253,253,253,253,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,254,253,253,253,253,253,222,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,166,217,104,104,236,253,253,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,255,254,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,253,253,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,226,253,245,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,183,253,253,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,253,253,244,84,0,0,0,0,0,0,0,0,0,0,0,0,8,128,179,21,0,0,0,0,0,0,25,131,253,253,205,0,0,0,0,0,0,0,0,0,0,0,0,0,61,253,253,148,40,0,0,0,0,56,233,253,253,213,35,0,0,0,0,0,0,0,0,0,0,0,0,0,4,169,253,253,243,239,186,205,239,247,253,253,210,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,129,248,253,253,253,253,253,254,242,199,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,192,183,253,253,164,105,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,222,253,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,234,252,252,237,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,253,252,252,252,252,198,150,166,197,197,198,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,215,253,252,252,252,252,253,252,252,252,252,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,32,215,252,253,252,252,252,252,253,252,252,252,252,253,89,0,0,0,0,0,0,0,0,0,0,0,0,0,57,253,253,255,215,110,0,0,0,0,120,253,253,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,252,204,27,18,0,0,0,0,123,246,252,204,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,55,25,0,0,0,0,0,120,246,252,198,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,245,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,253,252,195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,253,255,215,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,252,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,187,252,228,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,252,252,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,253,253,190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,210,252,242,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,231,252,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,207,252,252,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,220,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,197,255,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,226,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,224,253,251,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,253,251,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,197,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,254,253,254,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,253,251,196,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,254,253,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,251,253,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,251,196,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,194,255,253,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,186,251,253,247,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,251,251,253,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,236,251,251,169,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,251,251,251,158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,253,253,193,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,236,251,204,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,251,251,188,0,48,127,127,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,253,251,251,204,64,234,251,251,244,123,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,158,253,251,251,251,251,253,251,251,251,251,218,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,253,255,253,253,253,253,255,253,253,253,253,255,122,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182,251,253,251,251,251,251,253,251,251,251,251,253,224,16,0,0,0,0,0,0,0,0,0,0,0,0,0,221,251,253,251,251,251,251,253,251,251,251,251,253,251,126,0,0,0,0,0,0,0,0,0,0,0,0,112,248,251,253,251,219,188,89,31,31,31,86,251,253,251,126,0,0,0,0,0,0,0,0,0,0,0,0,127,251,251,253,231,47,0,0,0,0,0,162,251,253,251,126,0,0,0,0,0,0,0,0,0,0,0,0,128,253,253,255,63,0,24,96,96,96,174,253,253,255,161,0,0,0,0,0,0,0,0,0,0,0,0,0,127,251,251,253,205,190,205,251,253,251,251,251,251,241,54,0,0,0,0,0,0,0,0,0,0,0,0,0,63,236,251,253,251,251,251,251,253,251,251,251,172,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,228,253,251,251,251,251,253,243,188,148,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,153,251,251,251,152,95,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,253,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,248,252,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,211,252,242,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,252,252,183,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,241,252,220,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,54,20,0,0,0,0,0,178,252,252,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,146,231,252,93,0,0,0,0,86,240,252,194,25,0,0,0,0,0,0,0,0,0,0,0,0,0,10,168,252,252,252,93,0,0,0,68,243,252,209,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,252,252,252,221,39,1,14,14,185,252,205,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,240,252,252,224,38,85,139,252,253,252,252,214,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,241,253,253,253,253,253,253,253,253,255,253,253,253,186,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,252,252,252,252,252,252,252,252,253,252,212,145,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,208,158,158,158,137,26,87,252,253,212,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,0,0,0,0,9,180,252,215,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,252,252,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,252,252,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,223,252,231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,252,252,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,252,244,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,252,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,253,253,253,114,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,249,252,252,252,253,228,225,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,252,252,252,253,252,252,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,252,252,252,253,252,252,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,252,252,252,253,252,252,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,253,253,253,253,255,253,228,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,252,252,252,253,223,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,55,100,252,252,228,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73,252,252,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,253,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,131,225,225,225,226,234,252,252,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,197,253,252,252,252,252,253,252,252,252,142,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,224,252,253,252,252,252,252,253,252,252,252,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,252,252,253,252,252,252,252,253,252,252,252,252,79,0,0,0,0,0,0,0,0,0,0,0,0,0,86,253,253,253,255,253,253,253,253,255,106,32,216,253,255,27,0,0,0,0,0,0,0,0,0,0,0,0,85,252,252,252,253,252,252,252,204,27,3,0,169,252,253,74,0,0,0,0,0,0,0,0,0,0,0,0,66,239,252,252,253,233,195,102,25,0,0,0,53,227,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,66,177,145,84,56,0,0,0,0,0,0,0,140,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,253,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,254,255,130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,228,253,253,129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,253,253,253,129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,253,253,188,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,237,253,253,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,253,253,253,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,169,244,253,209,28,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,253,253,253,123,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,253,253,237,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,253,253,222,0,24,92,231,231,128,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,198,253,253,211,104,200,253,253,253,253,218,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,253,253,174,253,253,253,253,253,253,253,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,216,253,253,253,253,253,253,253,253,253,253,173,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,253,253,253,253,253,228,84,130,253,253,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,225,253,253,253,253,147,42,0,70,253,253,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,207,253,253,253,141,4,6,62,208,253,253,153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,253,253,253,253,206,162,170,253,253,252,175,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,227,253,253,253,253,253,253,253,253,172,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,253,253,253,253,253,253,227,199,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,99,244,253,253,253,239,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,254,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,112,245,253,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,253,253,253,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,157,237,253,252,198,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,238,253,249,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,243,253,250,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,181,253,253,134,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,181,253,253,223,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,253,253,253,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,253,253,143,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,171,253,232,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,253,253,143,0,0,0,3,28,28,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,253,253,139,0,2,34,156,253,253,150,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,212,253,253,6,0,136,253,253,253,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,253,253,253,6,141,251,253,253,253,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,253,253,253,102,250,253,253,244,218,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,189,253,253,224,253,253,215,55,97,253,253,170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,253,253,253,253,253,239,187,253,253,253,148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,103,243,253,253,253,253,253,253,243,176,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,116,116,228,227,116,116,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46,105,254,254,254,254,133,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,196,254,253,253,253,253,253,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,235,255,253,253,253,253,253,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,244,254,253,253,253,253,253,236,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,218,254,253,253,253,253,253,253,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,209,253,254,253,253,253,253,253,253,223,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,227,253,253,254,243,233,233,241,253,253,253,127,5,0,0,0,0,0,0,0,0,0,0,0,0,0,49,227,253,253,253,254,135,0,0,99,253,253,253,253,57,0,0,0,0,0,0,0,0,0,0,0,0,0,156,253,253,253,253,117,62,0,0,99,253,253,253,253,57,0,0,0,0,0,0,0,0,0,0,0,0,77,231,253,253,253,253,0,0,0,0,99,253,253,253,253,57,0,0,0,0,0,0,0,0,0,0,0,86,254,254,254,236,90,0,0,0,0,0,77,232,254,254,254,58,0,0,0,0,0,0,0,0,0,0,0,235,253,253,253,174,0,0,0,0,0,0,0,156,253,253,253,57,0,0,0,0,0,0,0,0,0,0,124,247,253,253,253,174,0,0,0,0,0,0,0,156,253,253,253,57,0,0,0,0,0,0,0,0,0,110,247,253,253,228,47,13,0,0,0,0,0,0,16,51,224,253,253,57,0,0,0,0,0,0,0,0,23,170,253,253,253,97,0,0,0,0,0,0,0,0,99,253,253,253,253,57,0,0,0,0,0,0,0,0,59,253,253,253,253,97,0,0,0,0,0,0,110,156,194,253,253,253,167,22,0,0,0,0,0,0,0,0,59,253,253,253,253,229,215,215,215,215,217,215,241,253,253,253,251,172,18,0,0,0,0,0,0,0,0,0,41,211,253,253,253,253,253,253,253,253,254,253,253,253,222,174,161,0,0,0,0,0,0,0,0,0,0,0,0,118,253,253,253,253,253,253,253,253,254,253,253,126,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,57,88,253,253,253,253,253,253,58,57,57,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 --- examples/housing.mojo --- from time.time import now import basalt.nn as nn from basalt import Tensor, TensorShape from basalt import Graph, Symbol, OP from basalt.utils.datasets import BostonHousing from basalt.utils.dataloader import DataLoader fn linear_regression(batch_size: Int, n_inputs: Int, n_outputs: Int) -> Graph: var g = Graph() var x = g.input(TensorShape(batch_size, n_inputs)) var y_true = g.input(TensorShape(batch_size, n_outputs)) var y_pred = nn.Linear(g, x, n_outputs) g.out(y_pred) var loss = nn.MSELoss(g, y_pred, y_true) g.loss(loss) return g ^ fn main(): # Train Parameters alias batch_size = 32 alias num_epochs = 200 alias learning_rate = 0.02 alias graph = linear_regression(batch_size, 13, 1) # try: graph.render("operator") # except: print("Could not render graph") var model = nn.Model[graph]() var optim = nn.optim.Adam[graph](Reference(model.parameters), lr=learning_rate) # Batchwise data loader print("Loading data...") var train_data: BostonHousing try: train_data = BostonHousing(file_path="./examples/data/housing.csv") except: print("Could not load data") return var training_loader = DataLoader( data=train_data.data, labels=train_data.labels, batch_size=batch_size ) print("Training started.") var start = now() for epoch in range(num_epochs): var num_batches: Int = 0 var epoch_loss: Float32 = 0.0 for batch in training_loader: # Forward pass var loss = model.forward(batch.data, batch.labels) # Backward pass optim.zero_grad() model.backward() optim.step() epoch_loss += loss[0] num_batches += 1 print( "Epoch: [", epoch + 1, "/", num_epochs, "] \t Avg loss per epoch:", epoch_loss / num_batches, ) print("Training finished: ", (now() - start) / 1e9, "seconds") # print("\n\nInferencing model...\n") # for batch in training_loader: # var output = model.inference(batch.data) # # Print first (and only output) # print("Predicted: ", output[0]) --- examples/housing.py --- import pandas as pd import torch import torch.nn as nn from torch import optim from torch.utils.data import Dataset, DataLoader, TensorDataset import time class BostonHousing(Dataset): def __init__(self, data: pd.DataFrame): # Data: All columns except the last one / Target: Only the last column (MEDV) self.data = torch.tensor(data.iloc[:, :-1].values, dtype=torch.float32) self.target = torch.tensor(data.iloc[:, -1].values, dtype=torch.float32).view( -1, 1 ) # Normalize data self.data = (self.data - self.data.mean(dim=0)) / self.data.std(dim=0) # Create dataset self.dataset = TensorDataset(self.data, self.target) def __len__(self): return len(self.dataset) def __getitem__(self, idx): return self.dataset[idx] class LinearRegression(nn.Module): def __init__(self, input_dim): super(LinearRegression, self).__init__() self.linear = nn.Linear(input_dim, 1) def forward(self, x): return self.linear(x) if __name__ == "__main__": # Load data and split in training and testing sets df = pd.read_csv("./examples/data/housing.csv") TRAIN_PCT = 0.99 shuffled_df = df.sample(frac=1, random_state=42) train_df = shuffled_df[: int(TRAIN_PCT * len(df))] test_df = shuffled_df[int(TRAIN_PCT * len(df)) :] train_data = BostonHousing(train_df) test_data = BostonHousing(test_df) # Train Parameters batch_size = 32 num_epochs = 200 learning_rate = 0.02 # Batchwise data loader loaders = { "train": DataLoader( train_data, batch_size=batch_size, shuffle=False, num_workers=1 ), "test": DataLoader( test_data, batch_size=batch_size, shuffle=False, num_workers=1 ), } device = torch.device("cpu") # model = torch.compile(LinearRegression(train_data.data.shape[1]), fullgraph=True, options={"epilogue_fusion": True, "max_autotune": True}) model = LinearRegression(train_data.data.shape[1]) loss_func = nn.MSELoss() optimizer = optim.Adam(model.parameters(), lr=learning_rate) # optimizer = optim.SGD(model.parameters(), lr=learning_rate) # it seems the python for loop is what is making the program slow (so pytorch has a disadvantage thanks to python) model.train() start = time.time() for epoch in range(num_epochs): epoch_loss = 0 num_batches = 0 for batch_data, batch_labels in loaders["train"]: start_batch = time.time() # Forward pass outputs = model(batch_data) loss = loss_func(outputs, batch_labels) # Backward pass optimizer.zero_grad() loss.backward() optimizer.step() epoch_loss += loss.item() num_batches += 1 # print time in ms # print(f'Batch time: {1000 * (time.time() - start_batch):.2f} ms') # The speed of a batch in basalt and pytorch are similar or pytorch can be faster print( f"Epoch [{epoch + 1}/{num_epochs}],\t Avg loss per epoch:" f" {epoch_loss / num_batches}" ) print(f"Training time: {time.time() - start:.2f} seconds") # Evaluate the model model.eval() with torch.no_grad(): test_predictions = model(test_data.data) mse_loss = loss_func(test_predictions, test_data.target).item() print(f"Mean Squared Error on Test Data: {mse_loss:.4f}") --- examples/mnist.mojo --- from time.time import now import basalt.nn as nn from basalt import Tensor, TensorShape from basalt import Graph, Symbol, OP, dtype from basalt.utils.datasets import MNIST from basalt.utils.dataloader import DataLoader from basalt.autograd.attributes import AttributeVector, Attribute # def plot_image(data: Tensor, num: Int): # from python.python import Python, PythonObject # np = Python.import_module("numpy") # plt = Python.import_module("matplotlib.pyplot") # var pyimage: PythonObject = np.empty((28, 28), np.float64) # for m in range(28): # for n in range(28): # pyimage.itemset((m, n), data[num * 28 * 28 + m * 28 + n]) # plt.imshow(pyimage) # plt.show() fn create_CNN(batch_size: Int) -> Graph: var g = Graph() var x = g.input(TensorShape(batch_size, 1, 28, 28)) var x1 = nn.Conv2d(g, x, out_channels=16, kernel_size=5, padding=2) var x2 = nn.ReLU(g, x1) var x3 = nn.MaxPool2d(g, x2, kernel_size=2) var x4 = nn.Conv2d(g, x3, out_channels=32, kernel_size=5, padding=2) var x5 = nn.ReLU(g, x4) var x6 = nn.MaxPool2d(g, x5, kernel_size=2) var x7 = g.op( OP.RESHAPE, x6, attributes=AttributeVector( Attribute( "shape", TensorShape(x6.shape[0], x6.shape[1] * x6.shape[2] * x6.shape[3]), ) ), ) var out = nn.Linear(g, x7, n_outputs=10) g.out(out) var y_true = g.input(TensorShape(batch_size, 10)) var loss = nn.CrossEntropyLoss(g, out, y_true) # var loss = nn.MSELoss(g, out, y_true) g.loss(loss) return g ^ fn main(): alias num_epochs = 20 alias batch_size = 4 alias learning_rate = 1e-3 alias graph = create_CNN(batch_size) # try: graph.render("operator") # except: print("Could not render graph") var model = nn.Model[graph]() var optim = nn.optim.Adam[graph](Reference(model.parameters), lr=learning_rate) print("Loading data ...") var train_data: MNIST try: train_data = MNIST(file_path="./examples/data/mnist_test_small.csv") # _ = plot_image(train_data.data, 1) except e: print("Could not load data") print(e) return var training_loader = DataLoader( data=train_data.data, labels=train_data.labels, batch_size=batch_size ) print("Training started/") var start = now() for epoch in range(num_epochs): var num_batches: Int = 0 var epoch_loss: Float32 = 0.0 var epoch_start = now() for batch in training_loader: # [ONE HOT ENCODING!] var labels_one_hot = Tensor[dtype](batch.labels.dim(0), 10) for bb in range(batch.labels.dim(0)): labels_one_hot[int((bb * 10 + batch.labels[bb]))] = 1.0 # Forward pass var loss = model.forward(batch.data, labels_one_hot) # Backward pass optim.zero_grad() model.backward() optim.step() epoch_loss += loss[0] num_batches += 1 print( "Epoch [", epoch + 1, "/", num_epochs, "],\t Step [", num_batches, "/", train_data.data.dim(0) // batch_size, "],\t Loss:", epoch_loss / num_batches, ) print("Epoch time: ", (now() - epoch_start) / 1e9, "seconds") print("Training finished: ", (now() - start) / 1e9, "seconds") model.print_perf_metrics("ms", True) --- examples/mnist.py --- import time import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import torch import torch.nn as nn from torch import optim from torch.autograd import Variable from torch.utils.data import Dataset, DataLoader, TensorDataset class MNIST(Dataset): def __init__(self, csv_file): data = pd.read_csv(csv_file) self.labels = torch.tensor(data.iloc[:, 0].values, dtype=torch.int64) self.images = torch.tensor( data.iloc[:, 1:].values, dtype=torch.float32 ).reshape(-1, 1, 28, 28) # Normalize data self.images = self.images / 255.0 self.dataset = TensorDataset(self.images, self.labels) def __len__(self): return len(self.dataset) def __getitem__(self, idx): return self.dataset[idx] class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Sequential( nn.Conv2d( in_channels=1, out_channels=16, kernel_size=5, stride=1, padding=2, ), nn.ReLU(), nn.MaxPool2d(kernel_size=2), ) self.conv2 = nn.Sequential( nn.Conv2d(16, 32, 5, 1, 2), nn.ReLU(), nn.MaxPool2d(2), ) # fully connected layer, output 10 classes self.out = nn.Linear(32 * 7 * 7, 10) def forward(self, x): x = self.conv1(x) x = self.conv2(x) # flatten the output of conv2 to (batch_size, 32 * 7 * 7) x = x.view(x.size(0), -1) output = self.out(x) return output if __name__ == "__main__": num_epochs = 20 batch_size = 4 learning_rate = 1e-3 # Load data train_data = MNIST("./examples/data/mnist_test_small.csv") # Visualize data num = 0 plt.imshow(np.array(train_data[num][0]).squeeze()) plt.title("%i" % train_data[num][1]) plt.show() # Batchwise data loader loaders = { "train": DataLoader( train_data, batch_size=batch_size, shuffle=True, num_workers=1 ), } device = torch.device("cpu") cnn = CNN() loss_func = nn.CrossEntropyLoss() optimizer = optim.Adam(cnn.parameters(), lr=learning_rate) # Train the model cnn.train() total_step = len(loaders["train"]) start = time.time() for epoch in range(num_epochs): for i, (images, labels) in enumerate(loaders["train"]): b_x = Variable(images) b_y = Variable(labels) output = cnn(b_x) loss = loss_func(output, b_y) optimizer.zero_grad() loss.backward() optimizer.step() print( "Epoch [{}/{}],\t Step [{}/{}],\t Loss: {:.6f}".format( epoch + 1, num_epochs, i + 1, total_step, loss.item() ) ) print(f"Training time: {time.time() - start:.2f} seconds") # Export to ONNX export_onnx = os.environ.get("export_onnx", 0) if export_onnx == "1": dummy_input = torch.randn(1, 1, 28, 28) # cnn.out.weight = nn.Parameter(cnn.out.weight.T) # transpose because torch saves the weight of linear layer as (output_dim, input_dim) (so they transposed and there is not a real reason for this) torch.onnx.export(cnn, dummy_input, "./examples/data/mnist_torch.onnx", verbose=True) --- examples/mnist_load_model.mojo --- from time.time import now from pathlib import Path import basalt.nn as nn from basalt import Tensor, TensorShape from basalt import Graph, Symbol, OP, dtype from basalt.utils.datasets import MNIST from basalt.utils.dataloader import DataLoader from basalt.autograd.attributes import AttributeVector, Attribute # def plot_image(data: Tensor, num: Int): # from python.python import Python, PythonObject # np = Python.import_module("numpy") # plt = Python.import_module("matplotlib.pyplot") # var pyimage: PythonObject = np.empty((28, 28), np.float64) # for m in range(28): # for n in range(28): # pyimage.itemset((m, n), data[num * 28 * 28 + m * 28 + n]) # plt.imshow(pyimage) # plt.show() fn create_CNN(batch_size: Int) -> Graph: var g = Graph() var x = g.input(TensorShape(batch_size, 1, 28, 28)) var x1 = nn.Conv2d(g, x, out_channels=16, kernel_size=5, padding=2) var x2 = nn.ReLU(g, x1) var x3 = nn.MaxPool2d(g, x2, kernel_size=2) var x4 = nn.Conv2d(g, x3, out_channels=32, kernel_size=5, padding=2) var x5 = nn.ReLU(g, x4) var x6 = nn.MaxPool2d(g, x5, kernel_size=2) var x7 = g.op( OP.RESHAPE, x6, attributes=AttributeVector( Attribute( "shape", TensorShape(x6.shape[0], x6.shape[1] * x6.shape[2] * x6.shape[3]), ) ), ) var out = nn.Linear(g, x7, n_outputs=10) g.out(out) return g ^ fn main(): alias num_epochs = 1 alias batch_size = 4 alias learning_rate = 1e-3 alias graph = create_CNN(batch_size) # try: graph.render("operator") # except: print("Could not render graph") var model = nn.Model[graph]() model.load_model_data("./examples/data/mnist_torch.onnx") print("Loading data ...") var train_data: MNIST try: train_data = MNIST(file_path="./examples/data/mnist_test_small.csv") # _ = plot_image(train_data.data, 1) except e: print("Could not load data") print(e) return var training_loader = DataLoader( data=train_data.data, labels=train_data.labels, batch_size=batch_size ) # Testing print("Testing started") var start = now() var correct = 0 for batch in training_loader: var labels_one_hot = Tensor[dtype](batch.labels.dim(0), 10) for bb in range(batch.labels.dim(0)): labels_one_hot[int(bb * 10 + batch.labels[bb])] = 1.0 var output = model.inference(batch.data, labels_one_hot)[0] fn argmax(tensor: Tensor[dtype], dim: Int) -> Tensor[dtype]: var result = Tensor[dtype](tensor.dim(0)) for i in range(tensor.dim(0)): var max_val = tensor[i * 10] var max_idx = 0 for j in range(1, 10): if tensor[i * 10 + j] > max_val: max_val = tensor[i * 10 + j] max_idx = j result[i] = max_idx return result var pred = argmax(output, dim=1) for i in range(batch.labels.dim(0)): if pred[i] == batch.labels[i]: correct += 1 print("Accuracy: ", correct / train_data.data.dim(0) * 100, "%") print("Testing finished: ", (now() - start) / 1e9, "seconds") # model.print_perf_metrics("ms", True) model.export_model("./output_model.onnx") --- examples/sin_estimate.mojo --- from random import rand from time.time import now import math import basalt.nn as nn from basalt import Tensor, TensorShape from basalt import dtype from basalt import Graph, Symbol, OP from basalt.utils.tensorutils import fill fn create_simple_nn(batch_size: Int, n_inputs: Int, n_outputs: Int) -> Graph: var g = Graph() var x = g.input(TensorShape(batch_size, n_inputs)) var y_true = g.input(TensorShape(batch_size, n_outputs)) var x1 = nn.Linear(g, x, n_outputs=32) var x2 = nn.ReLU(g, x1) var x3 = nn.Linear(g, x2, n_outputs=32) var x4 = nn.ReLU(g, x3) var y_pred = nn.Linear(g, x4, n_outputs=n_outputs) g.out(y_pred) var loss = nn.MSELoss(g, y_pred, y_true) g.loss(loss) g.compile() return g ^ fn main(): alias batch_size = 32 alias n_inputs = 1 alias n_outputs = 1 alias learning_rate = 0.01 alias epochs = 20000 alias graph = create_simple_nn(batch_size, n_inputs, n_outputs) # try: graph.render("operator") # except: print("Could not render graph") var model = nn.Model[graph]() var optimizer = nn.optim.Adam[graph](Reference(model.parameters), lr=learning_rate) var x_data = Tensor[dtype](batch_size, n_inputs) var y_data = Tensor[dtype](batch_size, n_outputs) print("Training started") var start = now() for i in range(epochs): rand[dtype](x_data.data(), x_data.num_elements()) for j in range(batch_size): x_data[j] = x_data[j] * 2 - 1 y_data[j] = math.sin(x_data[j]) var out = model.forward(x_data, y_data) if (i + 1) % 1000 == 0: print("[", i + 1, "/", epochs, "] \tLoss: ", out[0]) optimizer.zero_grad() model.backward() optimizer.step() print("Training finished: ", (now() - start) / 1e9, "seconds") --- examples/sin_estimate.py --- import torch import torch.nn as nn from torch import optim import time class SimpleNN(nn.Module): def __init__(self, n_inputs, n_outputs): super(SimpleNN, self).__init__() self.linear1 = nn.Linear(in_features=n_inputs, out_features=32) self.relu1 = nn.ReLU() self.linear2 = nn.Linear(in_features=32, out_features=32) self.relu2 = nn.ReLU() self.linear3 = nn.Linear(in_features=32, out_features=n_outputs) def forward(self, x): x1 = self.linear1(x) x2 = self.relu1(x1) x3 = self.linear2(x2) x4 = self.relu2(x3) y_pred = self.linear3(x4) return y_pred if __name__ == "__main__": batch_size = 32 n_inputs = 1 n_outputs = 1 learning_rate = 0.01 device = torch.device("cpu") model = SimpleNN(n_inputs, n_outputs).to(device) loss_func = nn.MSELoss() optimizer = optim.Adam(model.parameters(), lr=learning_rate) x = torch.rand(batch_size, n_inputs).to(device) * 2 - 1 y = torch.sin(x).to(device) epochs = 20000 model.train() start = time.time() for i in range(epochs): x = torch.rand(batch_size, n_inputs).to(device) * 2 - 1 y = torch.sin(x).to(device) outputs = model(x) loss = loss_func(outputs, y) # Backward pass optimizer.zero_grad() loss.backward() optimizer.step() if (i + 1) % 1000 == 0: print(f"Epoch [{i + 1}/{epochs}],\t Loss: {loss.item()}") print(f"Training time: {time.time() - start:.2f} seconds. Loss: {loss.item()}") --- python-requirements.txt --- torch==2.1.0 matplotlib==3.8.0 pandas==2.1.1 onnx netron --- tests/__init__.mojo --- from .testing_utils import * --- tests/mojo/test_activations.mojo --- from testing import assert_equal from basalt import dtype from basalt.nn import ( Tensor, TensorShape, Model, Softmax, LogSoftmax, ReLU, LeakyReLU, Sigmoid, Tanh, ) from basalt.autograd import Graph, Symbol from basalt.utils.tensorutils import fill from tests import assert_tensors_equal alias Activation = fn (inout g: Graph, input: Symbol) -> Symbol alias AxisActivation = fn (inout g: Graph, input: Symbol, axis: Int) -> Symbol alias LeakyReLUActivation = fn ( inout g: Graph, input: Symbol, negative_slope: Scalar[dtype] ) -> Symbol fn create_graph[ shape: TensorShape, func: AxisActivation, axis: Int, ]() -> Graph: var g = Graph() var x = g.input(shape) var activation = func(g, x, axis) g.out(activation) return g^ fn create_graph[ shape: TensorShape, func: LeakyReLUActivation, negative_slope: Scalar[dtype], ]() -> Graph: var g = Graph() var x = g.input(shape) var activation = func(g, x, negative_slope) g.out(activation) return g^ fn create_graph[shape: TensorShape, func: Activation]() -> Graph: var g = Graph() var x = g.input(shape) var activation = func(g, x) g.out(activation) return g^ fn test_graph[ shape: TensorShape, func: AxisActivation, nodes: Int, axis: Int, ](input: Tensor[dtype], expected: Tensor[dtype]) raises: alias graph = create_graph[shape, func, axis]() var model = Model[graph](inference_only=True) var res = model.inference(input)[0] assert_tensors_equal["almost"](res, expected) assert_equal(len(graph.nodes), nodes) fn test_graph[ shape: TensorShape, func: LeakyReLUActivation, nodes: Int, negative_slope: Scalar[dtype], ](input: Tensor[dtype], expected: Tensor[dtype]) raises: alias graph = create_graph[shape, func, negative_slope]() var model = Model[graph](inference_only=True) var res = model.inference(input)[0] assert_tensors_equal["almost"](res, expected) assert_equal(len(graph.nodes), nodes) # TODO: All these overloads feel redundant. Find a way to condense them fn test_graph[ shape: TensorShape, func: Activation, nodes: Int, ](input: Tensor[dtype], expected: Tensor[dtype]) raises: alias graph = create_graph[shape, func]() var model = Model[graph](inference_only=True) var res = model.inference(input)[0] assert_tensors_equal["almost", "Tensor equality failed"](res, expected) assert_equal(len(graph.nodes), nodes, "Node count failed") fn test_SOFTMAX() raises: alias shape = TensorShape(2, 3, 2) alias nodes = 5 var input = Tensor[dtype](shape) fill(input, 4) var expected = Tensor[dtype](shape) fill(expected, 0.5) test_graph[shape, Softmax, nodes, 0](input, expected) fill(expected, 1.0 / 3.0) test_graph[shape, Softmax, nodes, 1](input, expected) fill(expected, 0.5) test_graph[shape, Softmax, nodes, 2](input, expected) fn test_LOGSOFTMAX() raises: alias shape = TensorShape(2, 3, 2) alias nodes = 6 var input = Tensor[dtype](shape) fill(input, 4) var expected = Tensor[dtype](shape) fill(expected, -0.69314718) test_graph[shape, LogSoftmax, nodes, 0](input, expected) fill(expected, -1.09861231) test_graph[shape, LogSoftmax, nodes, 1](input, expected) fill(expected, -0.69314718) test_graph[shape, LogSoftmax, nodes, 2](input, expected) fn test_RELU() raises: alias shape = TensorShape(2, 3) alias nodes = 1 var input = Tensor[dtype](shape) for i in range(6): input[i] = 3 if i < 3 else -3 var expected = Tensor[dtype](shape) for i in range(6): expected[i] = 3 if i < 3 else 0 test_graph[shape, ReLU, nodes](input, expected) fn test_LEAKYRELU() raises: alias negative_slope = 0.1 alias shape = TensorShape(2, 3) alias nodes = 1 var input = Tensor[dtype](shape) for i in range(6): input[i] = i - 3 var expected = Tensor[dtype](shape) for i in range(6): expected[i] = i - 3 if i - 3 > 0 else negative_slope * (i - 3) test_graph[shape, LeakyReLU, nodes, negative_slope](input, expected) fn test_SIGMOID() raises: alias shape = TensorShape(2, 3) alias nodes = 1 var input = Tensor[dtype](shape) fill(input, 0) var expected = Tensor[dtype](shape) fill(expected, 0.5) test_graph[shape, Sigmoid, nodes](input, expected) fn test_TANH() raises: alias shape = TensorShape(2, 3) alias nodes = 1 var input = Tensor[dtype](shape) fill(input, 0) var expected = Tensor[dtype](shape) fill(expected, 0.0) test_graph[shape, Tanh, nodes](input, expected) fn main(): try: test_SOFTMAX() test_LOGSOFTMAX() test_RELU() test_LEAKYRELU() test_SIGMOID() test_TANH() except e: print("[ERROR] Error in activations") print(e) --- tests/mojo/test_attributes.mojo --- from testing import assert_equal, assert_true from basalt.nn import TensorShape from basalt.autograd.attributes import Attribute fn test_attribute_key() raises: alias a = Attribute(name="test", value=-1) assert_true(str(a.name) == "test") fn test_attribute_int() raises: alias value: Int = 1 alias a = Attribute(name="test", value=value) assert_true(a.to_int() == 1) fn test_attribute_string() raises: alias value: String = "hello" alias a = Attribute(name="test", value=value) assert_true(a.to_string() == value) fn test_attribute_tensor_shape() raises: alias value: TensorShape = TensorShape(1, 2, 3) alias a = Attribute(name="test", value=value) assert_true(a.to_shape() == value) fn test_attribute_static_int_tuple() raises: alias value: StaticIntTuple[7] = StaticIntTuple[7](1, 2, 3, 4, 5, 6, 7) alias a = Attribute(name="test", value=value) assert_true(a.to_static[7]() == value) fn test_attribute_scalar() raises: fn test_float32() raises: alias value_a: Float32 = 1.23456 alias a1 = Attribute(name="test", value=value_a) assert_true( a1.to_scalar[DType.float32]() == value_a, "Float32 scalar attribute failed", ) alias value_b: Float32 = 65151 alias a2 = Attribute(name="test", value=value_b) assert_true( a2.to_scalar[DType.float32]() == value_b, "Float32 scalar attribute failed", ) fn test_float_literal() raises: alias value_c: FloatLiteral = -1.1 alias a3 = Attribute(name="test", value=value_c) assert_true( a3.to_scalar[DType.float32]() == value_c, "FloatLiteral scalar attribute failed", ) fn test_float64() raises: alias value_a: Float64 = -1.23456 alias a1 = Attribute(name="test", value=value_a) assert_true( a1.to_scalar[DType.float64]() == value_a, "Float64 scalar attribute failed", ) alias value_b: Float64 = 123456 alias a2 = Attribute(name="test", value=value_b) assert_true( a2.to_scalar[DType.float64]() == value_b, "Float64 scalar attribute failed", ) fn test_int32() raises: alias value_a: Int32 = 666 alias a1 = Attribute(name="test", value=value_a) assert_true( a1.to_scalar[DType.int32]() == value_a, "Int32 scalar attribute failed", ) alias value_b: Int32 = -666 alias a2 = Attribute(name="test", value=value_b) assert_true( a2.to_scalar[DType.int32]() == value_b, "Int32 scalar attribute failed", ) fn test_attribute_small_scalar() raises: alias value_a: Float32 = 1e-18 alias a = Attribute(name="test", value=value_a) assert_true( a.to_scalar[DType.float32]() == value_a, "SMALL scalar attribute failed", ) fn test_attribute_big_scalar() raises: alias value_a: Float32 = 1e40 alias a = Attribute(name="test", value=value_a) assert_true( a.to_scalar[DType.float32]() == value_a, "BIG scalar attribute failed", ) test_float32() test_float_literal() test_float64() test_int32() test_attribute_small_scalar() test_attribute_big_scalar() fn main(): try: test_attribute_key() test_attribute_int() test_attribute_string() test_attribute_tensor_shape() test_attribute_static_int_tuple() test_attribute_scalar() except e: print("[ERROR] Error in attributes") print(e) --- tests/mojo/test_backward.mojo --- from math import log, exp from testing import assert_equal from basalt import dtype, nelts from basalt.autograd.attributes import AttributeVector, Attribute from basalt.autograd import OP from basalt.nn import Tensor, TensorShape from basalt.utils.tensorutils import fill, tsum from tests import ( test_unary_op_backward, test_binary_op_backward, test_ternary_op_backward, ) fn test_ADD() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1 = Tensor[dtype](t1_shape) var t2 = Tensor[dtype](t2_shape) var ug = Tensor[dtype](ug_shape) fill(t1, 1.0) fill(t2, 2.0) fill(ug, 1.0) var expected_grad = Tensor[dtype](ug_shape) fill(expected_grad, 1.0) test_binary_op_backward[OP.ADD, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_grad, expected_grad ) fn test_SUB() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1 = Tensor[dtype](t1_shape) var t2 = Tensor[dtype](t2_shape) var ug = Tensor[dtype](ug_shape) fill(t1, 2.0) fill(t2, 1.0) fill(ug, 1.0) var expected_grad1 = Tensor[dtype](t1_shape) var expected_grad2 = Tensor[dtype](t2_shape) fill(expected_grad1, 1.0) fill(expected_grad2, -1.0) test_binary_op_backward[OP.SUB, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_grad1, expected_grad2 ) fn test_MUL() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) fill(t2, 2.0) fill(ug, 1.0) var expected_grad1 = Tensor[dtype](t1_shape) var expected_grad2 = Tensor[dtype](t2_shape) fill(expected_grad1, 2.0) fill(expected_grad2, 1.0) test_binary_op_backward[OP.MUL, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_grad1, expected_grad2 ) fn test_DIV() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) fill(t2, 2.0) fill(ug, 1.0) var expected_grad1 = Tensor[dtype](t1_shape) var expected_grad2 = Tensor[dtype](t2_shape) fill(expected_grad1, 1.0 / 2.0) fill[dtype](expected_grad2, -1.0 / (2.0**2)) test_binary_op_backward[OP.DIV, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_grad1, expected_grad2 ) fn test_DOT() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(3, 2) alias ug_shape = TensorShape(2, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) fill(t2, 2.0) fill(ug, 1.0) var expected_grad1 = Tensor[dtype](t1_shape) var expected_grad2 = Tensor[dtype](t2_shape) fill(expected_grad1, 4.0) fill(expected_grad2, 2.0) test_binary_op_backward[OP.DOT, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_grad1, expected_grad2 ) fn test_EXP() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 2.0) fill(ug, 5.0) var expected_grad1 = Tensor[dtype](t1_shape) fill(expected_grad1, 5.0 * exp[dtype, 1](2.0)) test_unary_op_backward[OP.EXP, t1_shape, ug_shape](t1, ug, expected_grad1) fn test_LOG() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 2.0) fill(ug, 5.0) var expected_grad1 = Tensor[dtype](t1_shape) fill(expected_grad1, 5.0 / 2.0) test_unary_op_backward[OP.LOG, t1_shape, ug_shape](t1, ug, expected_grad1) fn test_POW() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(1) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 2.0) t2[0] = 2 fill(ug, 1.0) var expected_grad1 = Tensor[dtype](t1_shape) var expected_grad2 = Tensor[dtype](t2_shape) fill(expected_grad1, 4.0) var temp = Tensor[dtype](2, 3) fill(temp, (2**2) * log[dtype, 1](2)) expected_grad2[0] = tsum(temp) test_binary_op_backward[OP.POW, t1_shape, t2_shape, ug_shape](t1, t2, ug, expected_grad1, expected_grad2) fill(t1, 0.0) fill(t2, 0) fill(ug, 1.0) fill(expected_grad1, 0.0) fill(expected_grad2, 0.0) test_binary_op_backward[OP.POW, t1_shape, t2_shape, ug_shape](t1, t2, ug, expected_grad1, expected_grad2) fn test_SUM() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(1) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) fill(ug, 9.0) var expected_grad1 = Tensor[dtype](t1_shape) fill(expected_grad1, 9.0) test_unary_op_backward[OP.SUM, t1_shape, ug_shape](t1, ug, expected_grad1) fn test_SUM_0() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(1, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) ug[0] = 0.0 ug[1] = 1.0 ug[2] = 2.0 alias attributes = AttributeVector(Attribute("axis", 0)) var expected_grad1 = Tensor[dtype](t1_shape) for i in range(expected_grad1.num_elements()): expected_grad1[i] = i % 3 test_unary_op_backward[OP.SUM, t1_shape, ug_shape, attributes]( t1, ug, expected_grad1 ) fn test_SUM_1() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 1) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) ug[0] = 0.0 ug[1] = 1.0 alias attributes = AttributeVector(Attribute("axis", 1)) var expected_grad1 = Tensor[dtype](t1_shape) for i in range(expected_grad1.num_elements()): expected_grad1[i] = 0 if i < 3 else 1 test_unary_op_backward[OP.SUM, t1_shape, ug_shape, attributes]( t1, ug, expected_grad1 ) fn test_MAX() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(1) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) t1[0] = 2.0 t1[1] = 2.0 fill(ug, 9.0) var expected_grad = Tensor[dtype](t1_shape) expected_grad[0] = 4.5 expected_grad[1] = 4.5 test_unary_op_backward[OP.MAX, t1_shape, ug_shape](t1, ug, expected_grad) fn test_MAX_0() raises: alias t1_shape = TensorShape(2, 3, 2) alias ug_shape = TensorShape(1, 3, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) for i in range(t1.num_elements()): t1[i] = i + 1 t1[0] = 7.0 fill(ug, 2.0) alias attributes = AttributeVector(Attribute("axis", 0)) var expected_grad = Tensor[dtype](t1_shape) expected_grad[0] = 1.0 expected_grad[6] = 1.0 expected_grad[7] = 2.0 expected_grad[8] = 2.0 expected_grad[9] = 2.0 expected_grad[10] = 2.0 expected_grad[11] = 2.0 test_unary_op_backward[OP.MAX, t1_shape, ug_shape, attributes]( t1, ug, expected_grad ) fn test_MAX_1() raises: alias t1_shape = TensorShape(2, 3, 2) alias ug_shape = TensorShape(2, 1, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) for i in range(t1.num_elements()): t1[i] = i + 1 t1[0] = 5.0 fill(ug, 2.0) alias attributes = AttributeVector(Attribute("axis", 1)) var expected_grad = Tensor[dtype](t1_shape) expected_grad[0] = 1.0 expected_grad[4] = 1.0 expected_grad[5] = 2.0 expected_grad[10] = 2.0 expected_grad[11] = 2.0 test_unary_op_backward[OP.MAX, t1_shape, ug_shape, attributes]( t1, ug, expected_grad ) fn test_MAX_2() raises: alias t1_shape = TensorShape(2, 3, 2) alias ug_shape = TensorShape(2, 3, 1) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) for i in range(t1.num_elements()): t1[i] = i + 1 t1[0] = 2.0 fill(ug, 2.0) alias attributes = AttributeVector(Attribute("axis", 2)) var expected_grad = Tensor[dtype](t1_shape) expected_grad[0] = 1.0 expected_grad[1] = 1.0 expected_grad[3] = 2.0 expected_grad[5] = 2.0 expected_grad[7] = 2.0 expected_grad[9] = 2.0 expected_grad[11] = 2.0 test_unary_op_backward[OP.MAX, t1_shape, ug_shape, attributes]( t1, ug, expected_grad ) fn test_MEAN() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(1) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) fill(ug, 9.0) var expected_grad = Tensor[dtype](t1_shape) fill(expected_grad, 9.0 / 6.0) test_unary_op_backward[OP.MEAN, t1_shape, ug_shape](t1, ug, expected_grad) fn test_MEAN_0() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(1, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) fill(ug, 3.0) alias attributes = AttributeVector(Attribute("axis", 0)) var expected_grad = Tensor[dtype](t1_shape) for i in range(expected_grad.num_elements()): expected_grad[i] = 1.0 / t1_shape[0] * 3.0 test_unary_op_backward[OP.MEAN, t1_shape, ug_shape, attributes]( t1, ug, expected_grad ) fn test_MEAN_1() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 1) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(t1, 1.0) fill(ug, 3.0) alias attributes = AttributeVector(Attribute("axis", 1)) var expected_grad = Tensor[dtype](t1_shape) for i in range(expected_grad.num_elements()): expected_grad[i] = 1.0 / t1_shape[1] * 3.0 test_unary_op_backward[OP.MEAN, t1_shape, ug_shape, attributes]( t1, ug, expected_grad ) fn test_TRANSPOSE() raises: alias t1_shape = TensorShape(2, 3, 4) alias ug_shape = TensorShape(4, 3, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fn arange(inout t: Tensor[dtype]): var n = t.num_elements() for i in range(n): t[i] = i + 1 arange(t1) arange(ug) # No attributes is reversion the order var expected_grad = Tensor[dtype](t1_shape) var t1_strides = t1_shape.strides() for i in range(ug_shape[0]): for j in range(ug_shape[1]): for k in range(ug_shape[2]): expected_grad[k * t1_strides[0] + j * t1_strides[1] + i] = ug[ i * ug_shape[1] * ug_shape[2] + j * ug_shape[2] + k ] test_unary_op_backward[OP.TRANSPOSE, t1_shape, ug_shape](t1, ug, expected_grad) # Test Transpose 1, 2, 0 alias ug_shape_2 = TensorShape(3, 4, 2) ug = Tensor[dtype](ug_shape_2) arange(ug) alias attributes_2 = AttributeVector(Attribute("axes", TensorShape(1, 2, 0))) expected_grad = Tensor[dtype](t1_shape) for i in range(ug_shape_2[0]): for j in range(ug_shape_2[1]): for k in range(ug_shape_2[2]): expected_grad[k * t1_strides[0] + i * t1_strides[1] + j] = ug[ i * ug_shape_2[1] * ug_shape_2[2] + j * ug_shape_2[2] + k ] test_unary_op_backward[OP.TRANSPOSE, t1_shape, ug_shape_2, attributes_2]( t1, ug, expected_grad ) fn test_FLATTEN() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(t1_shape.num_elements()) var t1 = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(ug, 1.0) assert_equal(ug.dim(0), 6) var expected_grad1 = Tensor[dtype](t1_shape) fill(expected_grad1, 1.0) test_unary_op_backward[OP.FLATTEN, t1_shape, ug_shape](t1, ug, expected_grad1) fn test_RESHAPE() raises: alias t1_shape = TensorShape(2, 2, 5) alias ug_shape = TensorShape(2, 10) var t1 = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) var expected_grad = Tensor[dtype](t1_shape) for i in range(20): ug[i] = i + 1 expected_grad[i] = i + 1 test_unary_op_backward[OP.RESHAPE, t1_shape, ug_shape](t1, ug, expected_grad) fn main(): try: test_ADD() test_SUB() test_MUL() test_DIV() test_DOT() test_EXP() test_LOG() test_POW() test_SUM() test_SUM_0() test_SUM_1() test_MAX() test_MAX_0() test_MAX_1() test_MAX_2() test_MEAN() test_MEAN_0() test_MEAN_1() test_TRANSPOSE() test_FLATTEN() test_RESHAPE() except e: print(e) print("[ERROR] Error in backward pass.") --- tests/mojo/test_collection.mojo --- from testing import assert_equal from basalt import dtype from basalt.nn import Tensor, TensorShape from basalt.autograd import Symbol from basalt.utils.collection import Collection from basalt.utils.tensorutils import fill from tests import assert_tensors_equal fn test_append_tensors() raises: alias t1_shape = TensorShape(1, 10) alias t2_shape = TensorShape(2, 20) var s1 = Symbol(0, dtype, t1_shape, True) var s2 = Symbol(1, dtype, t2_shape, True) var c = Collection(capacity=2) assert_equal(c.capacity, 2) assert_equal(c.size, 0) c.append(Tensor[dtype](s1.shape), s1) assert_equal(c.size, 1) c.append(Tensor[dtype](s2.shape), s2) assert_equal(c.size, 2) fn test_get_tensor_reference() raises: alias t1_shape = TensorShape(1, 10) alias t2_shape = TensorShape(2, 20) var s1 = Symbol(0, dtype, t1_shape, True) var s2 = Symbol(1, dtype, t2_shape, True) var t1 = Tensor[dtype](s1.shape) var t2 = Tensor[dtype](s2.shape) fill(t1, 1) fill(t2, 2) var c = Collection(capacity=2) c.append(t1 ^, s1) c.append(t2 ^, s2) var t1_expected = Tensor[dtype](s1.shape) var t2_expected = Tensor[dtype](s2.shape) fill(t1_expected, 1) fill(t2_expected, 2) assert_tensors_equal(c[s1], t1_expected) assert_tensors_equal(c[s2], t2_expected) fn test_resize_collection() raises: alias t1_shape = TensorShape(1, 10) alias t2_shape = TensorShape(2, 20) alias t3_shape = TensorShape(3, 30) var s1 = Symbol(0, dtype, t1_shape, True) var s2 = Symbol(1, dtype, t2_shape, True) var s3 = Symbol(2, dtype, t3_shape, True) var t1 = Tensor[dtype](s1.shape) var t2 = Tensor[dtype](s2.shape) var t3 = Tensor[dtype](s3.shape) fill(t1, 1) fill(t2, 2) fill(t3, 3) var c = Collection(capacity=1) assert_equal(c.size, 0) assert_equal(c.capacity, 1) c.append(t1 ^, s1) assert_equal(c.size, 1) assert_equal(c.capacity, 1) c.append(t2 ^, s2) assert_equal(c.size, 2) assert_equal(c.capacity, 2) c.append(t3 ^, s3) assert_equal(c.size, 3) assert_equal(c.capacity, 4) var t1_expected = Tensor[dtype](s1.shape) var t2_expected = Tensor[dtype](s2.shape) var t3_expected = Tensor[dtype](s3.shape) fill(t1_expected, 1) fill(t2_expected, 2) fill(t3_expected, 3) assert_tensors_equal(c[s1], t1_expected) assert_tensors_equal(c[s2], t2_expected) assert_tensors_equal(c[s3], t3_expected) fn test_set_zero() raises: alias t1_shape = TensorShape(1, 10) alias t2_shape = TensorShape(2, 20) var s1 = Symbol(0, dtype, t1_shape, True) var s2 = Symbol(1, dtype, t2_shape, True) var t1 = Tensor[dtype](s1.shape) var t2 = Tensor[dtype](s2.shape) fill(t1, 1) fill(t2, 2) var c = Collection(capacity=2) c.append(t1 ^, s1) c.append(t2 ^, s2) var t1_expected = Tensor[dtype](s1.shape) var t2_expected = Tensor[dtype](s2.shape) fill(t1_expected, 1) fill(t2_expected, 2) assert_tensors_equal(c[s1], t1_expected) assert_tensors_equal(c[s2], t2_expected) c.set_zero() assert_tensors_equal(c[s1], Tensor[dtype](t1_shape)) assert_tensors_equal(c[s2], Tensor[dtype](t2_shape)) fn test_operate_on_reference() raises: alias res_shape = TensorShape(1, 10) alias t1_shape = TensorShape(1, 10) var sr = Symbol(0, dtype, t1_shape, True) var s1 = Symbol(1, dtype, t1_shape, True) var res = Tensor[dtype](res_shape) var t1 = Tensor[dtype](s1.shape) var c = Collection(capacity=2) c.append(res ^, sr) c.append(t1 ^, s1) fn some_operation[ res_shape: TensorShape, t_shape: TensorShape ](inout res: Tensor[dtype], t1: Tensor[dtype]): for i in range(res.num_elements()): res[i] = t1[i] for i in range(1, 10): some_operation[res_shape, t1_shape](c[sr], c[s1]) fill(c[s1], i) var res_expected = Tensor[dtype](res_shape) var t1_expected = Tensor[dtype](t1_shape) fill(res_expected, i - 1) fill(t1_expected, i) assert_tensors_equal(c[sr], res_expected) assert_tensors_equal(c[s1], t1_expected) fn main() raises: try: test_append_tensors() test_get_tensor_reference() test_resize_collection() test_set_zero() test_operate_on_reference() except e: print(e) raise e --- tests/mojo/test_dynamic_ops.mojo --- from basalt import dtype, nelts from basalt.autograd import Graph, Symbol, OP from basalt.autograd.ops.dynamics import CONCAT, SPLIT from basalt.nn import Model, Tensor, TensorShape from basalt.utils.tensorutils import fill from tests import assert_tensors_equal, create_graph_concat, create_graph_split fn test_CONCAT_0() raises: # default: dim = 0 # FORWARD alias t1_shape = TensorShape(1, 2, 3) alias t2_shape = TensorShape(1, 2, 3) alias t3_shape = TensorShape(2, 2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) var t3: Tensor[dtype] = Tensor[dtype](t3_shape) fill(t1, 5.0) fill(t2, 10.0) fill(t3, 15.0) var expected = Tensor[dtype](4, 2, 3) for i in range(4): for j in range(2): for k in range(3): if i < 1: # i because dim = 0 expected[i * 2 * 3 + j * 3 + k] = 5.0 elif i >= 1 and i < 2: expected[i * 2 * 3 + j * 3 + k] = 10.0 else: expected[i * 2 * 3 + j * 3 + k] = 15.0 alias graph = create_graph_concat(t1_shape, t2_shape, t3_shape, dim=0) var model = Model[graph]() var res = model.forward(t1, t2, t3) assert_tensors_equal["almost"](res, expected) # BACKWARD var ug = Tensor[dtype](4, 2, 3) for i in range(4): for j in range(2): for k in range(3): if i < 1: # i because dim = 0 ug[i * 2 * 3 + j * 3 + k] = 1.0 elif i >= 1 and i < 2: ug[i * 2 * 3 + j * 3 + k] = 2.0 else: ug[i * 2 * 3 + j * 3 + k] = 3.0 model.backward(ug) var grad1_expected = Tensor[dtype](t1_shape) var grad2_expected = Tensor[dtype](t2_shape) var grad3_expected = Tensor[dtype](t3_shape) fill(grad1_expected, 1.0) fill(grad2_expected, 2.0) fill(grad3_expected, 3.0) # Extracting the gradients assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[0]], grad1_expected ) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[1]], grad2_expected ) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[2]], grad3_expected ) fn test_CONCAT_1() raises: # dim = 1 alias t1_shape = TensorShape(2, 2, 5) alias t2_shape = TensorShape(2, 4, 5) alias t3_shape = TensorShape(2, 1, 5) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) var t3: Tensor[dtype] = Tensor[dtype](t3_shape) fill(t1, 5.0) fill(t2, 10.0) fill(t3, 15.0) var expected = Tensor[dtype](2, 7, 5) for i in range(2): for j in range(7): for k in range(5): if j < 2: # j because dim = 1 expected[i * 7 * 5 + j * 5 + k] = 5.0 elif j >= 2 and j < 6: expected[i * 7 * 5 + j * 5 + k] = 10.0 else: expected[i * 7 * 5 + j * 5 + k] = 15.0 alias graph = create_graph_concat(t1_shape, t2_shape, t3_shape, dim=1) var model = Model[graph]() var res = model.forward(t1, t2, t3) assert_tensors_equal["almost"](res, expected) # BACKWARD var ug = Tensor[dtype](2, 7, 5) for i in range(2): for j in range(7): for k in range(5): if j < 2: # j because dim = 1 ug[i * 7 * 5 + j * 5 + k] = 1.0 elif j >= 2 and j < 6: ug[i * 7 * 5 + j * 5 + k] = 2.0 else: ug[i * 7 * 5 + j * 5 + k] = 3.0 model.backward(ug) var grad1_expected = Tensor[dtype](t1_shape) var grad2_expected = Tensor[dtype](t2_shape) var grad3_expected = Tensor[dtype](t3_shape) fill(grad1_expected, 1.0) fill(grad2_expected, 2.0) fill(grad3_expected, 3.0) # Extracting the gradients assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[0]], grad1_expected ) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[1]], grad2_expected ) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[2]], grad3_expected ) fn test_CONCAT_2() raises: # dim = 2 alias t1_shape = TensorShape(2, 3, 1) alias t2_shape = TensorShape(2, 3, 2) alias t3_shape = TensorShape(2, 3, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) var t3: Tensor[dtype] = Tensor[dtype](t3_shape) fill(t1, 5.0) fill(t2, 10.0) fill(t3, 15.0) var expected = Tensor[dtype](2, 3, 6) for i in range(2): for j in range(3): for k in range(6): if k < 1: # k because dim = 2 expected[i * 3 * 6 + j * 6 + k] = 5.0 elif k >= 1 and k < 3: expected[i * 3 * 6 + j * 6 + k] = 10.0 else: expected[i * 3 * 6 + j * 6 + k] = 15.0 alias graph = create_graph_concat(t1_shape, t2_shape, t3_shape, dim=2) var model = Model[graph]() var res = model.forward(t1, t2, t3) assert_tensors_equal["almost"](res, expected) # BACKWARD var ug = Tensor[dtype](2, 3, 6) for i in range(2): for j in range(3): for k in range(6): if k < 1: # k because dim = 2 ug[i * 3 * 6 + j * 6 + k] = 1.0 elif k >= 1 and k < 3: ug[i * 3 * 6 + j * 6 + k] = 2.0 else: ug[i * 3 * 6 + j * 6 + k] = 3.0 model.backward(ug) var grad1_expected = Tensor[dtype](t1_shape) var grad2_expected = Tensor[dtype](t2_shape) var grad3_expected = Tensor[dtype](t3_shape) fill(grad1_expected, 1.0) fill(grad2_expected, 2.0) fill(grad3_expected, 3.0) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[0]], grad1_expected ) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[1]], grad2_expected ) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[2]], grad3_expected ) fn test_SPLIT_0() raises: alias t_shape = TensorShape(4, 5, 6) alias sections = List[Int](1, 2, 1) var t: Tensor[dtype] = Tensor[dtype](t_shape) for i in range(4): for j in range(5): for k in range(6): if i < 1: t[i * 5 * 6 + j * 6 + k] = 5.0 elif i >= 1 and i < 3: t[i * 5 * 6 + j * 6 + k] = 10.0 else: t[i * 5 * 6 + j * 6 + k] = 15.0 var expected1 = Tensor[dtype](1, 5, 6) var expected2 = Tensor[dtype](2, 5, 6) var expected3 = Tensor[dtype](1, 5, 6) fill(expected1, 5.0) fill(expected2, 10.0) fill(expected3, 15.0) alias graph = create_graph_split(t_shape, sections, dim=0) var model = Model[graph]() var results = model.inference(t) assert_tensors_equal["almost"](results[0], expected1) assert_tensors_equal["almost"](results[1], expected2) assert_tensors_equal["almost"](results[2], expected3) # BACKWARD var ug1 = Tensor[dtype](1, 5, 6) var ug2 = Tensor[dtype](2, 5, 6) var ug3 = Tensor[dtype](1, 5, 6) fill(ug1, 1.0) fill(ug2, 2.0) fill(ug3, 3.0) model.backward(ug1, ug2, ug3) var grad_expected = Tensor[dtype](t_shape) for i in range(4): for j in range(5): for k in range(6): if i < 1: grad_expected[i * 5 * 6 + j * 6 + k] = 1.0 elif i >= 1 and i < 3: grad_expected[i * 5 * 6 + j * 6 + k] = 2.0 else: grad_expected[i * 5 * 6 + j * 6 + k] = 3.0 assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[0]], grad_expected ) fn test_SPLIT_1() raises: alias t_shape = TensorShape(4, 5, 6) alias sections = List[Int](1, 3, 1) var t: Tensor[dtype] = Tensor[dtype](t_shape) for i in range(4): for j in range(5): for k in range(6): if j < 1: t[i * 5 * 6 + j * 6 + k] = 5.0 elif j >= 1 and j < 4: t[i * 5 * 6 + j * 6 + k] = 10.0 else: t[i * 5 * 6 + j * 6 + k] = 15.0 var expected1 = Tensor[dtype](4, 1, 6) var expected2 = Tensor[dtype](4, 3, 6) var expected3 = Tensor[dtype](4, 1, 6) fill(expected1, 5.0) fill(expected2, 10.0) fill(expected3, 15.0) alias graph = create_graph_split(t_shape, sections, dim=1) var model = Model[graph]() var results = model.inference(t) assert_tensors_equal["almost"](results[0], expected1) assert_tensors_equal["almost"](results[1], expected2) assert_tensors_equal["almost"](results[2], expected3) # BACKWARD var ug1 = Tensor[dtype](4, 1, 6) var ug2 = Tensor[dtype](4, 3, 6) var ug3 = Tensor[dtype](4, 1, 6) fill(ug1, 1.0) fill(ug2, 2.0) fill(ug3, 3.0) model.backward(ug1, ug2, ug3) var grad_expected = Tensor[dtype](t_shape) for i in range(4): for j in range(5): for k in range(6): if j < 1: grad_expected[i * 5 * 6 + j * 6 + k] = 1.0 elif j >= 1 and j < 4: grad_expected[i * 5 * 6 + j * 6 + k] = 2.0 else: grad_expected[i * 5 * 6 + j * 6 + k] = 3.0 assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[0]], grad_expected ) fn test_SPLIT_2() raises: alias t_shape = TensorShape(4, 5, 6) alias sections = List[Int](1, 4, 1) var t: Tensor[dtype] = Tensor[dtype](t_shape) for i in range(4): for j in range(5): for k in range(6): if k < 1: t[i * 5 * 6 + j * 6 + k] = 5.0 elif k >= 1 and k < 5: t[i * 5 * 6 + j * 6 + k] = 10.0 else: t[i * 5 * 6 + j * 6 + k] = 15.0 var expected1 = Tensor[dtype](4, 5, 1) var expected2 = Tensor[dtype](4, 5, 4) var expected3 = Tensor[dtype](4, 5, 1) fill(expected1, 5.0) fill(expected2, 10.0) fill(expected3, 15.0) alias graph = create_graph_split(t_shape, sections, dim=2) var model = Model[graph]() var results = model.inference(t) assert_tensors_equal["almost"](results[0], expected1) assert_tensors_equal["almost"](results[1], expected2) assert_tensors_equal["almost"](results[2], expected3) # BACKWARD var ug1 = Tensor[dtype](4, 5, 1) var ug2 = Tensor[dtype](4, 5, 4) var ug3 = Tensor[dtype](4, 5, 1) fill(ug1, 1.0) fill(ug2, 2.0) fill(ug3, 3.0) model.backward(ug1, ug2, ug3) var grad_expected = Tensor[dtype](t_shape) for i in range(4): for j in range(5): for k in range(6): if k < 1: grad_expected[i * 5 * 6 + j * 6 + k] = 1.0 elif k >= 1 and k < 5: grad_expected[i * 5 * 6 + j * 6 + k] = 2.0 else: grad_expected[i * 5 * 6 + j * 6 + k] = 3.0 assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[0]], grad_expected ) fn main(): try: test_CONCAT_0() test_CONCAT_1() test_CONCAT_2() test_SPLIT_0() test_SPLIT_1() test_SPLIT_2() except e: print("[ERROR] Error in dynamic ops") print(e) return --- tests/mojo/test_loss.mojo --- from testing import assert_equal, assert_almost_equal from basalt import dtype, nelts from basalt.autograd import Graph, Symbol, OP from basalt.nn import Model, Tensor, TensorShape, MSELoss, CrossEntropyLoss from basalt.utils.tensorutils import fill fn test_MSE_perfect() raises: alias y_pred_shape = TensorShape(2, 10) # batch of 2, 10 classes alias y_true_shape = TensorShape(2, 10) fn create_graph() -> Graph: var g = Graph() var y_pred = g.input(y_pred_shape) var y_true = g.input(y_true_shape) var loss = MSELoss(g, y_pred, y_true) g.out(loss) return g ^ alias graph = create_graph() assert_equal(len(graph.nodes), 3) var y_pred = Tensor[dtype](y_pred_shape) var y_true = Tensor[dtype](y_true_shape) fill(y_pred, 1) fill(y_true, 1) var model = Model[graph](inference_only=True) var loss = model.inference(y_pred, y_true)[0] assert_equal(loss.dim(0), 1) # MSE summed over all elements assert_equal(loss[0], 0) # loss is 0 fn test_MSE_imperfect() raises: alias y_pred_shape = TensorShape(1, 10) # batch of 1, 10 classes alias y_true_shape = TensorShape(1, 10) fn create_graph() -> Graph: var g = Graph() var y_pred = g.input(y_pred_shape) var y_true = g.input(y_true_shape) var loss = MSELoss(g, y_pred, y_true) g.out(loss) return g ^ alias graph = create_graph() assert_equal(len(graph.nodes), 3) var y_pred = Tensor[dtype](y_pred_shape) var y_true = Tensor[dtype](y_true_shape) fill(y_pred, 1) for i in range(10): y_true[i] = i var model = Model[graph](inference_only=True) var loss = model.inference(y_pred, y_true)[0] var expected_loss: Scalar[dtype] = 0.0 for i in range(10): expected_loss += (y_pred[i] - y_true[i]) ** 2 expected_loss = expected_loss / y_true_shape[1] assert_almost_equal(loss[0], expected_loss) fn test_CrossEntropy_perfect() raises: alias y_pred_shape = TensorShape(2, 3) # batch of 2, 3 classes alias y_true_shape = TensorShape(2, 3) fn create_graph() -> Graph: var g = Graph() var y_pred = g.input(y_pred_shape) var y_true = g.input(y_true_shape) var loss = CrossEntropyLoss(g, y_pred, y_true) g.out(loss) return g ^ alias graph = create_graph() assert_equal(len(graph.nodes), 9) var y_pred = Tensor[dtype](y_pred_shape) var y_true = Tensor[dtype](y_true_shape) y_pred[0 * y_pred.dim(1) + 0] = 0.1 y_pred[0 * y_pred.dim(1) + 1] = 0.2 y_pred[0 * y_pred.dim(1) + 2] = 0.7 y_true[0 * y_true.dim(1) + 0] = 0 y_true[0 * y_true.dim(1) + 1] = 0 y_true[0 * y_true.dim(1) + 2] = 1 y_pred[1 * y_pred.dim(1) + 0] = 0.7 y_pred[1 * y_pred.dim(1) + 1] = 0.2 y_pred[1 * y_pred.dim(1) + 2] = 0.1 y_true[1 * y_true.dim(1) + 0] = 1 y_true[1 * y_true.dim(1) + 1] = 0 y_true[1 * y_true.dim(1) + 2] = 0 var model = Model[graph](inference_only=True) var loss = model.inference(y_pred, y_true)[0] assert_equal(loss.shape(), TensorShape(1)) assert_almost_equal(loss[0], 0.76794958) fn test_CrossEntropy_imperfect() raises: alias y_pred_shape = TensorShape(2, 3) # batch of 2, 3 classes alias y_true_shape = TensorShape(2, 3) fn create_graph() -> Graph: var g = Graph() var y_pred = g.input(y_pred_shape) var y_true = g.input(y_true_shape) var loss = CrossEntropyLoss(g, y_pred, y_true) g.out(loss) return g ^ alias graph = create_graph() var y_pred = Tensor[dtype](y_pred_shape) var y_true = Tensor[dtype](y_true_shape) y_pred[0 * y_pred.dim(1) + 0] = 0.1 y_pred[0 * y_pred.dim(1) + 1] = 0.2 y_pred[0 * y_pred.dim(1) + 2] = 0.7 y_true[0 * y_true.dim(1) + 0] = 0 y_true[0 * y_true.dim(1) + 1] = 1 y_true[0 * y_true.dim(1) + 2] = 0 y_pred[1 * y_pred.dim(1) + 0] = 0.7 y_pred[1 * y_pred.dim(1) + 1] = 0.2 y_pred[1 * y_pred.dim(1) + 2] = 0.1 y_true[1 * y_true.dim(1) + 0] = 0 y_true[1 * y_true.dim(1) + 1] = 0 y_true[1 * y_true.dim(1) + 2] = 1 var model = Model[graph](inference_only=True) var loss = model.inference(y_pred, y_true)[0] assert_equal(loss.shape(), TensorShape(1)) assert_almost_equal(loss[0], 1.31794953) fn main(): try: test_MSE_perfect() test_MSE_imperfect() test_CrossEntropy_perfect() test_CrossEntropy_imperfect() except e: print("[ERROR] Error in loss") print(e) --- tests/mojo/test_mlops.mojo --- from basalt import dtype, nelts from basalt.autograd import OP from basalt.autograd.attributes import AttributeVector, Attribute from basalt.autograd.ops.mlops import ( SIGMOID, RELU, LEAKYRELU, TANH, CLIP, SQUEEZE, UNSQUEEZE, ) from basalt.nn import Tensor, TensorShape from basalt.utils.tensorutils import fill from tests import ( assert_tensors_equal, test_unary_op, test_unary_op_backward, to_numpy, ) fn test_SIGMOID() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var expected = Tensor[dtype](2, 3) fill(expected, 0.5) test_unary_op[OP.SIGMOID, t1_shape](t1, expected) fn test_backward_SIGMOID() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(ug, 5.0) var expected_grad = Tensor[dtype](2, 3) fill( expected_grad, 5.0 * 0.25 ) # 0.25 = d(sigmoid(0))/dx = sigmoid(0) * (1 - sigmoid(0)) test_unary_op_backward[OP.SIGMOID, t1_shape, ug_shape]( t1, ug, expected_grad ) fn test_RELU() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) # TODO: When tensors can do slices, this could be changed to two fill functions. for i in range(3): t1[i] = 3 for i in range(3, 6): t1[i] = -3 var expected = Tensor[dtype](2, 3) for i in range(3): expected[i] = 3 for i in range(3, 6): expected[i] = 0 test_unary_op[OP.RELU, t1_shape](t1, expected) fn test_backward_RELU() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) for i in range(3): t1[i] = 3 for i in range(3, 6): t1[i] = -3 fill(ug, 5.0) var expected_grad = Tensor[dtype](2, 3) for i in range(3): expected_grad[i] = 1 * 5.0 # 1 = d(relu(3))/dx for i in range(3, 6): expected_grad[i] = 0 * 5.0 # 0 = d(relu(-3))/dx test_unary_op_backward[OP.RELU, t1_shape, ug_shape](t1, ug, expected_grad) fn test_LEAKYRELU() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) # TODO: When tensors can do slices, this could be changed to two fill functions. for i in range(3): t1[i] = 3 for i in range(3, 6): t1[i] = -3 var expected = Tensor[dtype](2, 3) for i in range(3): expected[i] = 3 for i in range(3, 6): expected[i] = -0.3 test_unary_op[ OP.LEAKYRELU, t1_shape, AttributeVector(Attribute("negative_slope", 0.1)), ](t1, expected) fn test_backward_LEAKYRELU() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) for i in range(3): t1[i] = 3 for i in range(3, 6): t1[i] = -3 fill(ug, 5.0) var expected_grad = Tensor[dtype](2, 3) for i in range(3): expected_grad[i] = 1 * 5.0 for i in range(3, 6): expected_grad[i] = 0.1 * 5.0 test_unary_op_backward[ OP.LEAKYRELU, t1_shape, ug_shape, AttributeVector(Attribute("negative_slope", 0.1)), ](t1, ug, expected_grad) fn test_TANH() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var expected = Tensor[dtype](2, 3) fill(expected, 0.0) test_unary_op[OP.TANH, t1_shape](t1, expected) fn test_backward_TANH() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(ug, 5.0) var expected_grad = Tensor[dtype](2, 3) fill(expected_grad, 5.0 * 1.0) # 1.0 = d(tanh(0))/dx = 1 - tanh(0)^2 test_unary_op_backward[OP.TANH, t1_shape, ug_shape](t1, ug, expected_grad) fn test_CLIP() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(6): t1[i] = i - 3 # Clip without min and max var expected_no = t1 test_unary_op[OP.CLIP, t1_shape](t1, expected_no) # Clip with min alias min_attr = Attribute("min", -1.1) var expected_min = Tensor[dtype](2, 3) for i in range(6): var val = Scalar[dtype](i - 3) expected_min[i] = val if (val > -1.1) else -1.1 test_unary_op[OP.CLIP, t1_shape, AttributeVector(min_attr)]( t1, expected_min ) # Clip with max alias max_attr = Attribute("max", 1.1) var expected_max = Tensor[dtype](2, 3) for i in range(6): var val = Scalar[dtype](i - 3) expected_max[i] = val if (val < 1.1) else 1.1 test_unary_op[OP.CLIP, t1_shape, AttributeVector(max_attr)]( t1, expected_max ) # Clip with min and max var expected = Tensor[dtype](2, 3) for i in range(6): var val = Scalar[dtype](i - 3) if val < -1.1: expected[i] = -1.1 elif val > 1.1: expected[i] = 1.1 else: expected[i] = val test_unary_op[OP.CLIP, t1_shape, AttributeVector(min_attr, max_attr)]( t1, expected ) fn test_backward_CLIP() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(6): t1[i] = i - 3 var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(ug, 5.0) # Clip without min and max var expected_no = ug test_unary_op_backward[OP.CLIP, t1_shape, ug_shape](t1, ug, expected_no) # Clip with min alias min_attr = AttributeVector(Attribute("min", -1.1)) var expected_min = Tensor[dtype](2, 3) for i in range(6): var val = Scalar[dtype](i - 3) expected_min[i] = 5.0 if (val > -1.1) else 0.0 test_unary_op_backward[OP.CLIP, t1_shape, ug_shape, min_attr]( t1, ug, expected_min ) # Clip with max alias max_attr = AttributeVector(Attribute("max", 1.1)) var expected_max = Tensor[dtype](2, 3) for i in range(6): var val = Scalar[dtype](i - 3) expected_max[i] = 5.0 if (val < 1.1) else 0.0 test_unary_op_backward[OP.CLIP, t1_shape, ug_shape, max_attr]( t1, ug, expected_max ) # Clip with min and max alias attrs = AttributeVector(Attribute("min", -1.1), Attribute("max", 1.1)) var expected = Tensor[dtype](2, 3) for i in range(6): var val = Scalar[dtype](i - 3) if val < -1.1 or val > 1.1: expected[i] = 0.0 else: expected[i] = 5.0 test_unary_op_backward[OP.CLIP, t1_shape, ug_shape, attrs](t1, ug, expected) fn test_SQUEEZE() raises: alias t1_shape = TensorShape(1, 2, 1, 3, 1) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 5.0) # Test with no dims var expected = Tensor[dtype](2, 3) fill(expected, 5.0) test_unary_op[OP.SQUEEZE, t1_shape](t1, expected) # Test with one dim expected = Tensor[dtype](1, 2, 1, 3) fill(expected, 5.0) test_unary_op[ OP.SQUEEZE, t1_shape, AttributeVector(Attribute("dims", TensorShape(4))) ](t1, expected) expected = Tensor[dtype](1, 2, 3, 1) fill(expected, 5.0) test_unary_op[ OP.SQUEEZE, t1_shape, AttributeVector(Attribute("dims", TensorShape(2))) ](t1, expected) # Test with multiple dims expected = Tensor[dtype](1, 2, 3) fill(expected, 5.0) test_unary_op[ OP.SQUEEZE, t1_shape, AttributeVector(Attribute("dims", TensorShape(2, 4))), ](t1, expected) fn test_backward_SQUEEZE() raises: alias t1_shape = TensorShape(2, 1, 3, 1) alias ug_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 5.0) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(ug, 5.0) var expected_grad = Tensor[dtype](2, 1, 3, 1) fill(expected_grad, 5.0) test_unary_op_backward[OP.SQUEEZE, t1_shape, ug_shape]( t1, ug, expected_grad ) fn test_UNSQUEEZE() raises: # UNSQUEEZE here is more similar to jax expand_dims alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 5.0) var expected = Tensor[dtype](2, 1, 3, 1) fill(expected, 5.0) test_unary_op[ OP.UNSQUEEZE, t1_shape, AttributeVector(Attribute("dims", TensorShape(1, 3))), ](t1, expected) expected = Tensor[dtype](2, 1, 3) fill(expected, 5.0) test_unary_op[ OP.UNSQUEEZE, t1_shape, AttributeVector(Attribute("dims", TensorShape(1))), ](t1, expected) expected = Tensor[dtype](1, 2, 3) fill(expected, 5.0) test_unary_op[ OP.UNSQUEEZE, t1_shape, AttributeVector(Attribute("dims", TensorShape(-3))), ](t1, expected) expected = Tensor[dtype](2, 1, 3, 1) fill(expected, 5.0) test_unary_op[ OP.UNSQUEEZE, t1_shape, AttributeVector(Attribute("dims", TensorShape(-1, -3))), ](t1, expected) fn test_backward_UNSQUEEZE() raises: alias t1_shape = TensorShape(2, 3) alias ug_shape = TensorShape(2, 1, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 5.0) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(ug, 5.0) var expected_grad = Tensor[dtype](2, 3) fill(expected_grad, 5.0) test_unary_op_backward[OP.UNSQUEEZE, t1_shape, ug_shape]( t1, ug, expected_grad ) fn test_SLICE() raises: alias t1_shape = TensorShape(3, 4, 5) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(t1.num_elements()): t1[i] = i alias slice = Slice(1, 3, 1) # dim = 0 var expected_0 = Tensor[dtype](2, 4, 5) for i in range(2): for j in range(4): for k in range(5): expected_0[i * 4 * 5 + j * 5 + k] = (i + 1) * 4 * 5 + j * 5 + k test_unary_op[ OP.SLICE, t1_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(0)), ), ](t1, expected_0) # dim = 1 var expected_1 = Tensor[dtype](3, 2, 5) for i in range(3): for j in range(2): for k in range(5): expected_1[i * 2 * 5 + j * 5 + k] = i * 4 * 5 + (j + 1) * 5 + k test_unary_op[ OP.SLICE, t1_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(1)), ), ](t1, expected_1) # dim = 2 var expected_2 = Tensor[dtype](3, 4, 2) for i in range(3): for j in range(4): for k in range(2): expected_2[i * 4 * 2 + j * 2 + k] = i * 4 * 5 + j * 5 + (k + 1) test_unary_op[ OP.SLICE, t1_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(2)), ), ](t1, expected_2) fn test_SLICE_step() raises: alias slice = Slice(1, 6, 2) # dim = 0 alias t0_shape = TensorShape(10, 2, 2) var t0: Tensor[dtype] = Tensor[dtype](t0_shape) for i in range(t0.num_elements()): t0[i] = i var expected_0 = Tensor[dtype](3, 2, 2) for i in range(3): for j in range(2): for k in range(2): expected_0[i * 2 * 2 + j * 2 + k] = ( (i * 2 + 1) * 2 * 2 + j * 2 + k ) test_unary_op[ OP.SLICE, t0_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(0)), ), ](t0, expected_0) # dim = 1 alias t1_shape = TensorShape(2, 10, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(t1.num_elements()): t1[i] = i var expected_1 = Tensor[dtype](2, 3, 2) for i in range(2): for j in range(3): for k in range(2): expected_1[i * 3 * 2 + j * 2 + k] = ( i * 10 * 2 + (j * 2 + 1) * 2 + k ) test_unary_op[ OP.SLICE, t1_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(1)), ), ](t1, expected_1) # dim = 2 alias t2_shape = TensorShape(2, 2, 10) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) for i in range(t2.num_elements()): t2[i] = i var expected_2 = Tensor[dtype](2, 2, 3) for i in range(2): for j in range(2): for k in range(3): expected_2[i * 2 * 3 + j * 3 + k] = ( i * 2 * 10 + j * 10 + (k * 2 + 1) ) test_unary_op[ OP.SLICE, t2_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(2)), ), ](t2, expected_2) fn test_SLICE_neg() raises: alias slice = Slice(6, 1, -2) # dim = 0 alias t0_shape = TensorShape(10, 2, 2) var t0: Tensor[dtype] = Tensor[dtype](t0_shape) for i in range(t0.num_elements()): t0[i] = i var expected_0 = Tensor[dtype](3, 2, 2) for i in range(3): for j in range(2): for k in range(2): expected_0[i * 2 * 2 + j * 2 + k] = ( StaticIntTuple[3](6, 4, 2)[i] * 2 * 2 + j * 2 + k ) test_unary_op[ OP.SLICE, t0_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(0)), ), ](t0, expected_0) # dim = 1 alias t1_shape = TensorShape(2, 10, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(t1.num_elements()): t1[i] = i var expected_1 = Tensor[dtype](2, 3, 2) for i in range(2): for j in range(3): for k in range(2): expected_1[i * 3 * 2 + j * 2 + k] = ( i * 10 * 2 + StaticIntTuple[3](6, 4, 2)[j] * 2 + k ) test_unary_op[ OP.SLICE, t1_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(1)), ), ](t1, expected_1) # dim = 2 alias t2_shape = TensorShape(2, 2, 10) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) for i in range(t2.num_elements()): t2[i] = i var expected_2 = Tensor[dtype](2, 2, 3) for i in range(2): for j in range(2): for k in range(3): expected_2[i * 2 * 3 + j * 3 + k] = ( i * 2 * 10 + j * 10 + StaticIntTuple[3](6, 4, 2)[k] ) test_unary_op[ OP.SLICE, t2_shape, AttributeVector( Attribute("starts", TensorShape(slice.start)), Attribute("ends", TensorShape(slice.end)), Attribute("steps", TensorShape(slice.step)), Attribute("axes", TensorShape(2)), ), ](t2, expected_2) fn test_SLICE_multiple_axes() raises: alias t1_shape = TensorShape(20, 32, 40) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(t1.num_elements()): t1[i] = i alias slice_0 = Slice(1, 6, 2) alias slice_1 = Slice(3, 10, 3) alias slice_2 = Slice(5, 15, 2) var expected = Tensor[dtype](3, 3, 5) for i in range(3): for j in range(3): for k in range(5): expected[i * 3 * 5 + j * 5 + k] = ( StaticIntTuple[5](1, 3, 5, 7, 9)[i] * 32 * 40 + StaticIntTuple[3](3, 6, 9)[j] * 40 + StaticIntTuple[5](5, 7, 9, 11, 13)[k] ) test_unary_op[ OP.SLICE, t1_shape, AttributeVector( Attribute( "starts", TensorShape(slice_0.start, slice_1.start, slice_2.start), ), Attribute( "ends", TensorShape(slice_0.end, slice_1.end, slice_2.end) ), Attribute( "steps", TensorShape(slice_0.step, slice_1.step, slice_2.step) ), # Attribute("axes", TensorShape(0, 1, 2)) ), ](t1, expected) alias t2_shape = TensorShape(20, 32, 40, 50) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) for i in range(t2.num_elements()): t2[i] = i alias slice_2_1 = Slice(1, 6, 2) alias slice_2_2 = Slice(3, 10, 3) alias slice_2_3 = Slice(5, 15, 2) alias slice_2_4 = Slice(-43, -30, 4) var expected_2 = Tensor[dtype](3, 3, 5, 4) for i in range(3): for j in range(3): for k in range(5): for l in range(4): expected_2[i * 3 * 5 * 4 + j * 5 * 4 + k * 4 + l] = ( StaticIntTuple[5](1, 3, 5, 7, 9)[i] * 32 * 40 * 50 + StaticIntTuple[3](3, 6, 9)[j] * 40 * 50 + StaticIntTuple[5](5, 7, 9, 11, 13)[k] * 50 + StaticIntTuple[4](7, 11, 15, 19)[l] ) test_unary_op[ OP.SLICE, t2_shape, AttributeVector( Attribute( "starts", TensorShape( slice_2_1.start, slice_2_2.start, slice_2_3.start, slice_2_4.start, ), ), Attribute( "ends", TensorShape( slice_2_1.end, slice_2_2.end, slice_2_3.end, slice_2_4.end ), ), Attribute( "steps", TensorShape( slice_2_1.step, slice_2_2.step, slice_2_3.step, slice_2_4.step, ), ), ), ](t2, expected_2) fn test_backward_SLICE() raises: # dim = 0 (step = 1) alias slice_0 = Slice(1, 3, 1) alias t0_shape = TensorShape(3, 4, 5) var t0: Tensor[dtype] = Tensor[dtype](t0_shape) fill(t0, 5.0) alias ug0_shape = TensorShape(2, 4, 5) var ug0: Tensor[dtype] = Tensor[dtype](ug0_shape) fill(ug0, 1.0) var expected_ug0 = Tensor[dtype](t0_shape) for i in range(2): for j in range(4): for k in range(5): expected_ug0[(i + 1) * 4 * 5 + j * 5 + k] = 1.0 test_unary_op_backward[ OP.SLICE, t0_shape, ug0_shape, AttributeVector( Attribute("starts", TensorShape(slice_0.start)), Attribute("ends", TensorShape(slice_0.end)), Attribute("steps", TensorShape(slice_0.step)), Attribute("axes", TensorShape(0)), ), ](t0, ug0, expected_ug0) # dim = 1 (step = 2) alias slice_1 = Slice(1, 6, 2) alias t1_shape = TensorShape(2, 10, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 5.0) alias ug1_shape = TensorShape(2, 3, 2) var ug1: Tensor[dtype] = Tensor[dtype](ug1_shape) fill(ug1, 1.0) var expected_ug1 = Tensor[dtype](t1_shape) for i in range(2): for j in range(3): for k in range(2): expected_ug1[i * 10 * 2 + (j * 2 + 1) * 2 + k] = 1.0 test_unary_op_backward[ OP.SLICE, t1_shape, ug1_shape, AttributeVector( Attribute("starts", TensorShape(slice_1.start)), Attribute("ends", TensorShape(slice_1.end)), Attribute("steps", TensorShape(slice_1.step)), Attribute("axes", TensorShape(1)), ), ](t1, ug1, expected_ug1) # dim = 2 (step = -2) alias slice_2 = Slice(6, 1, -2) alias t2_shape = TensorShape(2, 2, 10) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) fill(t2, 5.0) alias ug2_shape = TensorShape(2, 2, 3) var ug2: Tensor[dtype] = Tensor[dtype](ug2_shape) fill(ug2, 1.0) var expected_ug2 = Tensor[dtype](t2_shape) for i in range(2): for j in range(2): for k in range(3): expected_ug2[ i * 2 * 10 + j * 10 + StaticIntTuple[3](6, 4, 2)[k] ] = 1.0 test_unary_op_backward[ OP.SLICE, t2_shape, ug2_shape, AttributeVector( Attribute("starts", TensorShape(slice_2.start)), Attribute("ends", TensorShape(slice_2.end)), Attribute("steps", TensorShape(slice_2.step)), Attribute("axes", TensorShape(2)), ), ](t2, ug2, expected_ug2) fn test_backward_SLICE_multiple_axes() raises: alias t1_shape = TensorShape(20, 32, 40) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(t1.num_elements()): t1[i] = i alias slice_0 = Slice(1, 6, 2) alias slice_1 = Slice(3, 10, 3) alias slice_2 = Slice(5, 15, 2) var expected = Tensor[dtype](3, 3, 5) for i in range(3): for j in range(3): for k in range(5): expected[i * 3 * 5 + j * 5 + k] = ( StaticIntTuple[5](1, 3, 5, 7, 9)[i] * 32 * 40 + StaticIntTuple[3](3, 6, 9)[j] * 40 + StaticIntTuple[5](5, 7, 9, 11, 13)[k] ) alias ug_shape = TensorShape(3, 3, 5) var ug: Tensor[dtype] = Tensor[dtype](ug_shape) fill(ug, 1.0) var expected_ug = Tensor[dtype](t1_shape) for i in range(3): for j in range(3): for k in range(5): expected_ug[ StaticIntTuple[5](1, 3, 5, 7, 9)[i] * 32 * 40 + StaticIntTuple[3](3, 6, 9)[j] * 40 + StaticIntTuple[5](5, 7, 9, 11, 13)[k] ] = 1.0 test_unary_op_backward[ OP.SLICE, t1_shape, ug_shape, AttributeVector( Attribute( "starts", TensorShape(slice_0.start, slice_1.start, slice_2.start), ), Attribute( "ends", TensorShape(slice_0.end, slice_1.end, slice_2.end) ), Attribute( "steps", TensorShape(slice_0.step, slice_1.step, slice_2.step) ), ), ](t1, ug, expected_ug) fn main(): try: test_SIGMOID() test_RELU() test_LEAKYRELU() test_TANH() test_CLIP() test_SQUEEZE() test_UNSQUEEZE() test_SLICE() test_SLICE_step() test_SLICE_neg() test_SLICE_multiple_axes() except e: print("[ERROR] Error in forward mlops") print(e) return try: test_backward_SIGMOID() test_backward_RELU() test_backward_LEAKYRELU() test_backward_TANH() test_backward_CLIP() test_backward_SQUEEZE() test_backward_UNSQUEEZE() test_backward_SLICE() test_backward_SLICE_multiple_axes() except e: print("[ERROR] Error in backward mlops") print(e) return --- tests/mojo/test_ops.mojo --- from math import exp, log from basalt import dtype, nelts from basalt.autograd import OP from basalt.autograd.attributes import Attribute, AttributeVector from basalt.utils.tensorutils import fill from basalt.nn import Tensor, TensorShape from tests import test_unary_op, test_binary_op, test_ternary_op fn test_ADD() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) fill(t1, 1.0) fill(t2, 1.0) var expected = Tensor[dtype](2, 3) fill(expected, 2.0) test_binary_op[OP.ADD, t1_shape, t2_shape](t1, t2, expected) fn test_SUB() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) fill(t1, 2.0) fill(t2, 1.0) var expected = Tensor[dtype](2, 3) fill(expected, 1.0) test_binary_op[OP.SUB, t1_shape, t2_shape](t1, t2, expected) fn test_MUL() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) fill(t1, 2.0) fill(t2, 3.0) var expected = Tensor[dtype](2, 3) fill(expected, 6.0) test_binary_op[OP.MUL, t1_shape, t2_shape](t1, t2, expected) fn test_DIV() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) fill(t1, 6.0) fill(t2, 2.0) var expected = Tensor[dtype](2, 3) fill(expected, 3.0) test_binary_op[OP.DIV, t1_shape, t2_shape](t1, t2, expected) fn test_DOT() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(3, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) fill(t1, 1.0) fill(t2, 2.0) var expected = Tensor[dtype](2, 2) fill(expected, 6.0) test_binary_op[OP.DOT, t1_shape, t2_shape](t1, t2, expected) fn test_EXP() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 2.0) var expected = Tensor[dtype](2, 3) fill(expected, exp[dtype, 1](2.0)) test_unary_op[OP.EXP, t1_shape](t1, expected) fn test_LOG() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 2.0) var expected = Tensor[dtype](2, 3) fill(expected, log[dtype, 1](2.0)) test_unary_op[OP.LOG, t1_shape](t1, expected) fn test_POW() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 2.0) alias t2_shape = TensorShape(1) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) t2[0] = 2.0 var expected = Tensor[dtype](2, 3) fill(expected, 4.0) test_binary_op[OP.POW, t1_shape, t2_shape](t1, t2, expected) fn test_SUM() raises: alias t1_shape = TensorShape(2, 3, 4) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 1.0) # No axis specified var expected = Tensor[dtype](1) fill(expected, 24.0) test_unary_op[OP.SUM, t1_shape](t1, expected) # Test axis 1 alias attrs = AttributeVector(Attribute("axis", 1)) expected = Tensor[dtype](2, 1, 4) fill(expected, 3.0) test_unary_op[OP.SUM, t1_shape, attrs](t1, expected) fn test_MAX() raises: alias t1_shape = TensorShape(2, 3, 2) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(t1_shape.num_elements()): t1[i] = i + 1 # No axis specified var expected = Tensor[dtype](1) fill(expected, t1_shape.num_elements()) test_unary_op[OP.MAX, t1_shape](t1, expected) @parameter fn fill_tensor[ size: Int ](inout tensor: Tensor[dtype], values: StaticIntTuple[size]): for i in range(tensor.num_elements()): tensor[i] = values[i] # Test axis 0 alias attrs = AttributeVector(Attribute("axis", 0)) var expected_max_axis_0_temp = StaticIntTuple[6](7, 8, 9, 10, 11, 12) expected = Tensor[dtype](1, 3, 2) fill_tensor(expected, expected_max_axis_0_temp) test_unary_op[OP.MAX, t1_shape, attrs](t1, expected) # Test axis 1 alias attrs_1 = AttributeVector(Attribute("axis", 1)) var expected_max_axis_1_temp = StaticIntTuple[4](5, 6, 11, 12) expected = Tensor[dtype](2, 1, 2) fill_tensor(expected, expected_max_axis_1_temp) test_unary_op[OP.MAX, t1_shape, attrs_1](t1, expected) # Test axis 2 alias attrs_2 = AttributeVector(Attribute("axis", 2)) var expected_max_axis_2_temp = StaticIntTuple[6](2, 4, 6, 8, 10, 12) expected = Tensor[dtype](2, 3, 1) fill_tensor(expected, expected_max_axis_2_temp) test_unary_op[OP.MAX, t1_shape, attrs_2](t1, expected) fn test_MEAN() raises: alias t1_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) fill(t1, 5.0) # No axis specified var expected = Tensor[dtype](1) fill(expected, 5.0) test_unary_op[OP.MEAN, t1_shape](t1, expected) # Test axis 0 alias attrs = AttributeVector(Attribute("axis", 0)) expected = Tensor[dtype](1, 3) fill(expected, 5.0) test_unary_op[OP.MEAN, t1_shape, attrs](t1, expected) # Test axis 1 alias attrs_1 = AttributeVector(Attribute("axis", 1)) expected = Tensor[dtype](2, 1) fill(expected, 5.0) test_unary_op[OP.MEAN, t1_shape, attrs_1](t1, expected) fn test_TRANSPOSE() raises: alias t1_shape = TensorShape(2, 3, 4) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) for i in range(t1_shape.num_elements()): t1[i] = i + 1 # Test tranpose (no attributes = reversing the axis by default) var expected = Tensor[dtype](4, 3, 2) var expected_strides = expected.strides() for i in range(t1_shape[0]): for j in range(t1_shape[1]): for k in range(t1_shape[2]): expected[k * expected_strides[0] + j * expected_strides[1] + i] = t1[ i * t1_shape[1] * t1_shape[2] + j * t1_shape[2] + k ] test_unary_op[OP.TRANSPOSE, t1_shape](t1, expected) # Test tranpose 1, 2, 0 alias attrs = AttributeVector(Attribute("axes", TensorShape(1, 2, 0))) var expected_axis_1 = Tensor[dtype](3, 4, 2) var expected_axis_1_strides = expected_axis_1.strides() for i in range(t1_shape[0]): for j in range(t1_shape[1]): for k in range(t1_shape[2]): expected_axis_1[ j * expected_axis_1_strides[0] + k * expected_axis_1_strides[1] + i ] = t1[i * t1_shape[1] * t1_shape[2] + j * t1_shape[2] + k] test_unary_op[OP.TRANSPOSE, t1_shape, attrs](t1, expected_axis_1) fn test_FLATTEN() raises: alias t1_shape = TensorShape(2, 3, 4) var t1 = Tensor[dtype](t1_shape) fill(t1, 1.0) var expected = Tensor[dtype](24) fill(expected, 1.0) test_unary_op[OP.FLATTEN, t1_shape](t1, expected) fn test_RESHAPE() raises: alias t_shape = TensorShape(2, 2, 5) alias new_shape = TensorShape(2, 10) var t = Tensor[dtype](t_shape) var expected = Tensor[dtype](new_shape) for i in range(20): t[i] = i + 1 expected[i] = i + 1 alias attrs = AttributeVector(Attribute("shape", new_shape)) test_unary_op[OP.RESHAPE, t_shape, attrs](t, expected) fn test_FMA() raises: alias t1_shape = TensorShape(2, 3) alias t2_shape = TensorShape(2, 3) alias t3_shape = TensorShape(2, 3) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) var t3: Tensor[dtype] = Tensor[dtype](t3_shape) fill(t1, 1.0) fill(t2, 2.0) fill(t3, 3.0) var expected = Tensor[dtype](2, 3) fill(expected, 1.0 * 2.0 + 3.0) test_ternary_op[OP.FMA, t1_shape, t2_shape, t3_shape](t1, t2, t3, expected) fn main(): try: test_ADD() test_SUB() test_MUL() test_DIV() test_DOT() test_EXP() test_LOG() test_POW() test_SUM() test_MAX() test_MEAN() test_TRANSPOSE() test_FLATTEN() test_RESHAPE() test_FMA() except e: print("[ERROR] Error in ops") print(e) --- tests/mojo/test_tensorutils.mojo --- from random import rand from testing import assert_equal, assert_almost_equal from math import sqrt, exp from basalt import dtype, nelts from basalt.autograd.ops.matmul import dot from basalt.utils.tensorutils import ( fill, elwise_transform, elwise_pow, elwise_op, broadcast_shapes, broadcast_elwise_op, get_reduce_shape, accumulate_grad, tsum, tmean, tstd, tmax, transpose, ) from basalt.nn import Tensor, TensorShape from basalt.utils.math_util import add, sub, mul, div, round_simd from tests import assert_tensors_equal fn test_zero() raises: var A = Tensor[dtype](2, 3) var B = Tensor[dtype](2, 3) rand[dtype](B.data(), B.num_elements()) B.zero() assert_tensors_equal(A, B) fn test_fill() raises: var A = Tensor[dtype](2, 3) var B = Tensor[dtype](2, 3) for i in range(A.num_elements()): A[i] = 1.0 fill(B, 1.0) assert_tensors_equal(A, B) fn test_dot() raises: alias a_shape = TensorShape(2, 3) alias b_shape = TensorShape(3, 2) var A = Tensor[dtype](a_shape) var B = Tensor[dtype](b_shape) fill(A, 1.0) fill(B, 1.0) var C = Tensor[dtype](2, 2) dot[a_shape, b_shape](C, A, B) var C_expected = Tensor[dtype](2, 2) fill(C_expected, 3.0) assert_tensors_equal(C, C_expected) var D = Tensor[dtype](3, 3) dot[b_shape, a_shape](D, B, A) var D_expected = Tensor[dtype](3, 3) fill(D_expected, 2.0) assert_tensors_equal(D, D_expected) fn test_elwise_transform() raises: var A = Tensor[dtype](2, 10) var B = Tensor[dtype](2, 10) var C = Tensor[dtype](2, 10) var D = Tensor[dtype](2, 10) fill(A, 4) fill(B, 2) fill(C, exp[dtype, 1](2)) fill(D, 7) var A_res = Tensor[dtype](2, 10) elwise_transform[sqrt](A_res, A) assert_tensors_equal(A_res, B) var B_res = Tensor[dtype](2, 10) elwise_transform[exp](B_res, B) assert_tensors_equal(B_res, C) var C_res = Tensor[dtype](2, 10) elwise_transform[round_simd](C_res, C) assert_tensors_equal(C_res, D) fn test_elwise_pow() raises: var A = Tensor[dtype](1, 10) var B = Tensor[dtype](1, 10) for i in range(10): A[i] = i B[i] = i**2 var A_res = Tensor[dtype](1, 10) elwise_pow(A_res, A, 2) assert_tensors_equal(A_res, B) fn test_elwise_tensor_tensor() raises: alias t1_shape = TensorShape(2, 10) alias t2_shape = TensorShape(2, 10) var t1 = Tensor[dtype](t1_shape) var t2 = Tensor[dtype](t2_shape) fill(t1, 3.0) fill(t2, 3.0) var result1 = Tensor[dtype](2, 10) elwise_op[t1_shape, t2_shape, add](result1, t1, t2) var result1_expected = Tensor[dtype](2, 10) fill(result1_expected, 6.0) assert_tensors_equal(result1, result1_expected) var result2 = Tensor[dtype](2, 10) elwise_op[t1_shape, t2_shape, sub](result2, t1, t2) var result2_expected = Tensor[dtype](2, 10) assert_tensors_equal(result2, result2_expected) var result3 = Tensor[dtype](2, 10) elwise_op[t1_shape, t2_shape, mul](result3, t1, t2) var result3_expected = Tensor[dtype](2, 10) fill(result3_expected, 9.0) assert_tensors_equal(result3, result3_expected) var result4 = Tensor[dtype](2, 10) elwise_op[t1_shape, t2_shape, div](result4, t1, t2) var result4_expected = Tensor[dtype](2, 10) fill(result4_expected, 1.0) assert_tensors_equal(result4, result4_expected) fn test_elwise_tensor_scalar() raises: var a: Scalar[dtype] = 2.0 var t1 = Tensor[dtype](2, 10) fill(t1, 1.0) var result = Tensor[dtype](2, 10) elwise_op[add](result, t1, a) var result1_expected = Tensor[dtype](2, 10) fill(result1_expected, 3.0) assert_tensors_equal(result, result1_expected) elwise_op[add](result, a, t1) assert_tensors_equal(result, result1_expected) elwise_op[sub](result, t1, a) var result3_expected = Tensor[dtype](2, 10) fill(result3_expected, -1) assert_tensors_equal(result, result3_expected) elwise_op[mul](result, a, t1) var result4_expected = Tensor[dtype](2, 10) fill(result4_expected, 2) assert_tensors_equal(result, result4_expected) elwise_op[div](result, t1, a) var result5_expected = Tensor[dtype](2, 10) fill(result5_expected, 0.5) assert_tensors_equal(result, result5_expected) fn test_elwise_broadcast_tensor() raises: alias t1_shape = TensorShape(2, 3, 4) alias t2_shape = TensorShape(5, 2, 1, 4) alias res_shape = broadcast_shapes(t1_shape, t2_shape) var t1 = Tensor[dtype](t1_shape) var t2 = Tensor[dtype](t2_shape) fill(t1, 3.0) for i in range(40): t2[i] = i + 1 var result1 = Tensor[dtype](res_shape) elwise_op[t1_shape, t2_shape, add](result1, t1, t2) var result1_expected = Tensor[dtype](5, 2, 3, 4) # fill expected tensor for i in range(40): for j in range(3): var index = (i % 4) + ((i // 4) * 12) + j * 4 result1_expected[index] = 3.0 + (i + 1) assert_tensors_equal(result1, result1_expected) from test_tensorutils_data import SumMeanStdData fn test_sum_mean_std() raises: var t = Tensor[dtype](2, 10) var s = 0 for i in range(20): t[i] = i + 1 s += i + 1 # Not specifying the axis takes all elements regardless of the shape var tensor_sum = tsum(t) assert_equal(tensor_sum, s) var tensor_mean = tmean(t) assert_equal(tensor_mean, s / 20) var tensor_std = tstd(t) var expected_std: Scalar[dtype] = 0 for i in range(20): expected_std += (i + 1 - tensor_mean) ** 2 expected_std = sqrt(expected_std / 20) assert_equal(tensor_std, expected_std) # When specifying the axis you can sum across batches # Axis 0 var batch_sum_0 = Tensor[dtype](get_reduce_shape(t.shape(), axis=0)) tsum(batch_sum_0, t, axis=0) var expected_batch_sum_0 = Tensor[dtype](1, 10) for i in range(10): expected_batch_sum_0[i] = (i + 1) + (i + 1 + 10) assert_tensors_equal(batch_sum_0, expected_batch_sum_0) var batch_mean_0 = Tensor[dtype](get_reduce_shape(t.shape(), axis=0)) tmean(batch_mean_0, t, axis=0) var expected_batch_mean_0 = Tensor[dtype](1, 10) for i in range(10): expected_batch_mean_0[i] = expected_batch_sum_0[i] / 2 assert_tensors_equal(batch_mean_0, expected_batch_mean_0) var batch_std_0 = Tensor[dtype](get_reduce_shape(t.shape(), axis=0)) tstd(batch_std_0, t, axis=0) var expected_batch_std_0 = Tensor[dtype](1, 10) fill(expected_batch_std_0, 5) assert_tensors_equal(batch_std_0, expected_batch_std_0) # Axis 1 var batch_sum_1 = Tensor[dtype](get_reduce_shape(t.shape(), axis=1)) tsum(batch_sum_1, t, axis=1) var expected_batch_sum_1 = Tensor[dtype](2, 1) expected_batch_sum_1[0] = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 expected_batch_sum_1[1] = 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 assert_tensors_equal(batch_sum_1, expected_batch_sum_1) var batch_mean_1 = Tensor[dtype](get_reduce_shape(t.shape(), axis=1)) tmean(batch_mean_1, t, axis=1) var expected_batch_mean_1 = Tensor[dtype](2, 1) expected_batch_mean_1[0] = expected_batch_sum_1[0] / 10 expected_batch_mean_1[1] = expected_batch_sum_1[1] / 10 assert_tensors_equal(batch_mean_1, expected_batch_mean_1) var batch_std_1 = Tensor[dtype](get_reduce_shape(t.shape(), axis=1)) tstd(batch_std_1, t, axis=1) var expected_batch_std_1 = Tensor[dtype](2, 1) fill(expected_batch_std_1, 2.8722813129425049) assert_tensors_equal(batch_std_1, expected_batch_std_1) fn test_sum_mean_std_n() raises: var t = Tensor[dtype](3, 4, 5) var s = 0 for i in range(60): t[i] = i + 1 s += i + 1 # Not specifying the axis takes all elements regardless of the shape var tensor_sum = tsum(t) assert_equal(tensor_sum, s) var tensor_mean = tmean(t) assert_equal(tensor_mean, s / 60) var tensor_std = tstd(t) var expected_std: Scalar[dtype] = 0 for i in range(60): expected_std += (i + 1 - tensor_mean) ** 2 expected_std = sqrt(expected_std / 60) assert_equal(tensor_std, expected_std) # When specifying the axis you can sum across batches # Axis 0 var data = SumMeanStdData.generate_3d_axis_0() var batch_sum_0 = Tensor[dtype](get_reduce_shape(t.shape(), axis=0)) tsum(batch_sum_0, t, axis=0) assert_tensors_equal(batch_sum_0, data.expected_sum) var batch_mean_0 = Tensor[dtype](get_reduce_shape(t.shape(), axis=0)) tmean(batch_mean_0, t, axis=0) assert_tensors_equal(batch_mean_0, data.expected_mean) var batch_std_0 = Tensor[dtype](get_reduce_shape(t.shape(), axis=0)) tstd(batch_std_0, t, axis=0) assert_tensors_equal(batch_std_0, data.expected_std) # When specifying the axis you can sum across batches # Axis 1 data = SumMeanStdData.generate_3d_axis_1() var batch_sum_1 = Tensor[dtype](get_reduce_shape(t.shape(), axis=1)) tsum(batch_sum_1, t, axis=1) assert_tensors_equal(batch_sum_1, data.expected_sum) var batch_mean_1 = Tensor[dtype](get_reduce_shape(t.shape(), axis=1)) tmean(batch_mean_1, t, axis=1) assert_tensors_equal(batch_mean_1, data.expected_mean) var batch_std_1 = Tensor[dtype](get_reduce_shape(t.shape(), axis=1)) tstd(batch_std_1, t, axis=1) assert_tensors_equal(batch_std_1, data.expected_std) # When specifying the axis you can sum across batches # Axis 2 data = SumMeanStdData.generate_3d_axis_2() var batch_sum_2 = Tensor[dtype](get_reduce_shape(t.shape(), axis=2)) tsum(batch_sum_2, t, axis=2) assert_tensors_equal(batch_sum_2, data.expected_sum) var batch_mean_2 = Tensor[dtype](get_reduce_shape(t.shape(), axis=2)) tmean(batch_mean_2, t, axis=2) assert_tensors_equal(batch_mean_2, data.expected_mean) var batch_std_2 = Tensor[dtype](get_reduce_shape(t.shape(), axis=2)) tstd(batch_std_2, t, axis=2) assert_tensors_equal(batch_std_2, data.expected_std) fn test_max() raises: var t = Tensor[dtype](2, 3, 2) for i in range(12): t[i] = i + 1 var tensor_max = tmax(t) assert_equal(tensor_max, 12) @parameter fn fill_tensor[ size: Int ](inout tensor: Tensor[dtype], values: StaticIntTuple[size]): for i in range(tensor.num_elements()): tensor[i] = values[i] var tensor_max_axis_0 = Tensor[dtype](get_reduce_shape(t.shape(), axis=0)) tmax(tensor_max_axis_0, t, axis=0) var expected_max_axis_0_temp = StaticIntTuple[6](7, 8, 9, 10, 11, 12) var expected_max_axis_0 = Tensor[dtype](1, 3, 2) fill_tensor(expected_max_axis_0, expected_max_axis_0_temp) assert_tensors_equal(tensor_max_axis_0, expected_max_axis_0) var tensor_max_axis_1 = Tensor[dtype](get_reduce_shape(t.shape(), axis=1)) tmax(tensor_max_axis_1, t, axis=1) var expected_max_axis_1_temp = StaticIntTuple[4](5, 6, 11, 12) var expected_max_axis_1 = Tensor[dtype](2, 1, 2) fill_tensor(expected_max_axis_1, expected_max_axis_1_temp) assert_tensors_equal(tensor_max_axis_1, expected_max_axis_1) var tensor_max_axis_2 = Tensor[dtype](get_reduce_shape(t.shape(), axis=2)) tmax(tensor_max_axis_2, t, axis=2) var expected_max_axis_2_temp = StaticIntTuple[6](2, 4, 6, 8, 10, 12) var expected_max_axis_2 = Tensor[dtype](2, 3, 1) fill_tensor(expected_max_axis_2, expected_max_axis_2_temp) assert_tensors_equal(tensor_max_axis_2, expected_max_axis_2) from test_tensorutils_data import TransposeData fn test_transpose() raises: # Transpose 2D var data = TransposeData.generate_1_2dim_test_case() var transposed = transpose(data.A, TensorShape(data.transpose_dims)) assert_tensors_equal(transposed, data.expected) # Transpose 2 dimensions data = TransposeData.generate_2_2dim_test_case() transposed = transpose(data.A, TensorShape(data.transpose_dims)) assert_tensors_equal(transposed, data.expected) data = TransposeData.generate_3_2dim_test_case() transposed = transpose(data.A, TensorShape(data.transpose_dims)) assert_tensors_equal(transposed, data.expected) data = TransposeData.generate_4_2dim_test_case() transposed = transpose(data.A, TensorShape(data.transpose_dims)) assert_tensors_equal(transposed, data.expected) # Transpose all dimensions data = TransposeData.generate_1_alldim_test_case() transposed = transpose(data.A, TensorShape(data.transpose_dims)) assert_tensors_equal(transposed, data.expected) data = TransposeData.generate_2_alldim_test_case() transposed = transpose(data.A, TensorShape(data.transpose_dims)) assert_tensors_equal(transposed, data.expected) # Transpose (reverse) data = TransposeData.generate_1_transpose_test_case() transposed = transpose(data.A, TensorShape(data.transpose_dims)) assert_tensors_equal(transposed, data.expected) fn test_accumulate_grad() raises: alias A_shape = TensorShape(2, 3, 4) alias B_shape = TensorShape(2, 1, 1) var A = Tensor[dtype](A_shape) var B = Tensor[dtype](B_shape) fill(A, 3.0) accumulate_grad[B_shape, A_shape](B, A) var expected = Tensor[dtype](2, 1, 1) fill(expected, 36) assert_tensors_equal(B, expected) alias B_shape_2 = TensorShape(2, 1) B = Tensor[dtype](B_shape_2) accumulate_grad[B_shape_2, A_shape](B, A) expected = Tensor[dtype](2, 1) fill(expected, 24) assert_tensors_equal(B, expected) # from test_tensorutils_data import PaddingData # fn test_padding() raises: # # 1D padding (only after) # var data = PaddingData.generate_1d_test_case_after() # var padded_data = pad_zeros[dtype, nelts](data.A, data.pad_with) # assert_tensors_equal(padded_data, data.expected) # # 1D padding (before and after) # data = PaddingData.generate_1d_test_case_before_after() # padded_data = pad_zeros[dtype, nelts](data.A, data.pad_with) # assert_tensors_equal(padded_data, data.expected) # # 2D padding # data = PaddingData.generate_2d_test_case() # padded_data = pad_zeros[dtype, nelts](data.A, data.pad_with) # assert_tensors_equal(padded_data, data.expected) # # 3D padding (simple) # data = PaddingData.generate_3d_test_case_simple() # padded_data = pad_zeros[dtype, nelts](data.A, data.pad_with) # assert_tensors_equal(padded_data, data.expected) # # 3D padding # data = PaddingData.generate_3d_test_case() # padded_data = pad_zeros[dtype, nelts](data.A, data.pad_with) # assert_tensors_equal(padded_data, data.expected) # # 4D padding # data = PaddingData.generate_4d_test_case() # padded_data = pad_zeros[dtype, nelts](data.A, data.pad_with) # assert_tensors_equal(padded_data, data.expected) fn main(): try: test_zero() test_fill() test_dot() test_elwise_transform() test_elwise_pow() test_elwise_tensor_tensor() test_elwise_tensor_scalar() test_elwise_broadcast_tensor() test_sum_mean_std() test_sum_mean_std_n() test_max() test_transpose() test_accumulate_grad() # # test_padding() except e: print("[ERROR] Error in tensorutils.py") print(e) --- tests/mojo/test_tensorutils_data.mojo --- from basalt import dtype, nelts from basalt.nn import Tensor, TensorShape from basalt.utils.tensorutils import fill, elwise_op from basalt.utils.math_util import add fn generate_tensor(*shape: Int) -> Tensor[dtype]: var A = Tensor[dtype](shape) var size = A.num_elements() for i in range(size): A[i] = i + 1 return A ^ fn generate_expected_tensor[ size: Int ](data: StaticIntTuple[size], *shape: Int) -> Tensor[dtype]: var A = Tensor[dtype](shape) for i in range(size): A[i] = data[i] return A ^ struct TransposeData: var A: Tensor[dtype] var expected: Tensor[dtype] var transpose_dims: VariadicList[Int] fn __init__( inout self, A: Tensor[dtype], expected: Tensor[dtype], transpose_dims: VariadicList[Int], ): self.A = A self.expected = expected self.transpose_dims = transpose_dims @staticmethod fn generate_1_2dim_test_case() -> TransposeData: var A = generate_tensor(2, 3) var expected = StaticIntTuple[6](1, 4, 2, 5, 3, 6) var tranpose_dims = VariadicList[Int](1, 0) var B = generate_expected_tensor(expected, 3, 2) return TransposeData(A, B, tranpose_dims) @staticmethod fn generate_2_2dim_test_case() -> TransposeData: var A = generate_tensor(2, 3, 2) var expected = StaticIntTuple[12](1, 7, 3, 9, 5, 11, 2, 8, 4, 10, 6, 12) var tranpose_dims = VariadicList[Int](2, 1, 0) var B = generate_expected_tensor(expected, 2, 3, 2) return TransposeData(A, B, tranpose_dims) @staticmethod fn generate_3_2dim_test_case() -> TransposeData: var A = generate_tensor(2, 3, 2, 3) var expected = StaticIntTuple[36]( 1, 2, 3, 7, 8, 9, 13, 14, 15, 4, 5, 6, 10, 11, 12, 16, 17, 18, 19, 20, 21, 25, 26, 27, 31, 32, 33, 22, 23, 24, 28, 29, 30, 34, 35, 36, ) var tranpose_dims = VariadicList[Int](0, 2, 1, 3) var B = generate_expected_tensor(expected, 2, 2, 3, 3) return TransposeData(A, B, tranpose_dims) @staticmethod fn generate_4_2dim_test_case() -> TransposeData: var A = generate_tensor(3, 2, 3, 2, 3) var expected = StaticIntTuple[108]( 1, 2, 3, 19, 20, 21, 7, 8, 9, 25, 26, 27, 13, 14, 15, 31, 32, 33, 4, 5, 6, 22, 23, 24, 10, 11, 12, 28, 29, 30, 16, 17, 18, 34, 35, 36, 37, 38, 39, 55, 56, 57, 43, 44, 45, 61, 62, 63, 49, 50, 51, 67, 68, 69, 40, 41, 42, 58, 59, 60, 46, 47, 48, 64, 65, 66, 52, 53, 54, 70, 71, 72, 73, 74, 75, 91, 92, 93, 79, 80, 81, 97, 98, 99, 85, 86, 87, 103, 104, 105, 76, 77, 78, 94, 95, 96, 82, 83, 84, 100, 101, 102, 88, 89, 90, 106, 107, 108, ) var tranpose_dims = VariadicList[Int](0, 3, 2, 1, 4) var B = generate_expected_tensor(expected, 3, 2, 3, 2, 3) return TransposeData(A, B, tranpose_dims) @staticmethod fn generate_1_alldim_test_case() -> TransposeData: var A = generate_tensor(2, 3, 2, 3) var expected = StaticIntTuple[36]( 1, 4, 2, 5, 3, 6, 19, 22, 20, 23, 21, 24, 7, 10, 8, 11, 9, 12, 25, 28, 26, 29, 27, 30, 13, 16, 14, 17, 15, 18, 31, 34, 32, 35, 33, 36, ) var tranpose_dims = VariadicList[Int](1, 0, 3, 2) var B = generate_expected_tensor(expected, 3, 2, 3, 2) return TransposeData(A, B, tranpose_dims) @staticmethod fn generate_2_alldim_test_case() -> TransposeData: var A = generate_tensor(2, 3, 4) var expected = StaticIntTuple[24]( 1, 13, 2, 14, 3, 15, 4, 16, 5, 17, 6, 18, 7, 19, 8, 20, 9, 21, 10, 22, 11, 23, 12, 24, ) var tranpose_dims = VariadicList[Int](1, 2, 0) var B = generate_expected_tensor(expected, 3, 4, 2) return TransposeData(A, B, tranpose_dims) @staticmethod fn generate_1_transpose_test_case() -> TransposeData: var A = generate_tensor(2, 3, 2, 3) var expected = StaticIntTuple[36]( 1, 19, 7, 25, 13, 31, 4, 22, 10, 28, 16, 34, 2, 20, 8, 26, 14, 32, 5, 23, 11, 29, 17, 35, 3, 21, 9, 27, 15, 33, 6, 24, 12, 30, 18, 36, ) var tranpose_dims = VariadicList[Int](3, 2, 1, 0) var B = generate_expected_tensor(expected, 3, 2, 3, 2) return TransposeData(A, B, tranpose_dims) struct PaddingData: var A: Tensor[dtype] var expected: Tensor[dtype] var pad_with: List[Int] fn __init__( inout self, A: Tensor[dtype], expected: Tensor[dtype], pad_with: List[Int], ): self.A = A self.expected = expected self.pad_with = pad_with @staticmethod fn generate_1d_test_case_after() -> PaddingData: var A = generate_tensor(2) var expected = StaticIntTuple[4](1, 2, 0, 0) var pad_with = List[Int]() pad_with.append(0) # before pad_with.append(2) # after var B = generate_expected_tensor(expected, 4) return PaddingData(A, B, pad_with) @staticmethod fn generate_1d_test_case_before_after() -> PaddingData: var A = generate_tensor(3) var expected = StaticIntTuple[6](0, 0, 1, 2, 3, 0) var pad_with = List[Int]() pad_with.append(2) # before pad_with.append(1) # after var B = generate_expected_tensor(expected, 6) return PaddingData(A, B, pad_with) @staticmethod fn generate_2d_test_case() -> PaddingData: var A = generate_tensor(2, 2) var expected = StaticIntTuple[45]( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ) var pad_with = List[Int]() pad_with.append(1) # before_1 pad_with.append(2) # after_1 pad_with.append(3) # before_2 pad_with.append(4) # after_2 var B = generate_expected_tensor[45](expected, 5, 9) return PaddingData(A, B, pad_with) @staticmethod fn generate_3d_test_case_simple() -> PaddingData: var A = generate_tensor(2, 2, 2) var expected = StaticIntTuple[16]( 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 5, 6, 7, 8, 0, 0 ) var pad_with = List[Int]() pad_with.append(0) # before_1 pad_with.append(0) # after_1 pad_with.append(1) # before_2 pad_with.append(1) # after_2 pad_with.append(0) # before_3 pad_with.append(0) # after_3 var B = generate_expected_tensor[16](expected, 2, 4, 2) return PaddingData(A, B, pad_with) @staticmethod fn generate_3d_test_case() -> PaddingData: var A = generate_tensor(1, 2, 3) var expected = StaticIntTuple[45]( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ) var pad_with = List[Int]() pad_with.append(1) # before_1 pad_with.append(1) # after_1 pad_with.append(1) # before_2 pad_with.append(0) # after_2 pad_with.append(0) # before_3 pad_with.append(2) # after_3 var B = generate_expected_tensor[45](expected, 3, 3, 5) return PaddingData(A, B, pad_with) @staticmethod fn generate_4d_test_case() -> PaddingData: var A = generate_tensor(2, 2, 2, 2) var expected = StaticIntTuple[81]( 1, 2, 0, 3, 4, 0, 0, 0, 0, 5, 6, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 0, 11, 12, 0, 0, 0, 0, 13, 14, 0, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ) var pad_with = List[Int]() pad_with.append(0) # before_1 pad_with.append(1) # after_1 pad_with.append(0) # before_2 pad_with.append(1) # after_2 pad_with.append(0) # before_3 pad_with.append(1) # after_3 pad_with.append(0) # before_4 pad_with.append(1) # after_4 var B = generate_expected_tensor[81](expected, 3, 3, 3, 3) return PaddingData(A, B, pad_with) struct SumMeanStdData: var A: Tensor[dtype] var axis: Int var expected_sum: Tensor[dtype] var expected_mean: Tensor[dtype] var expected_std: Tensor[dtype] fn __init__( inout self, A: Tensor[dtype], axis: Int, expected_sum: Tensor[dtype], expected_mean: Tensor[dtype], expected_std: Tensor[dtype], ): self.A = A self.axis = axis self.expected_sum = expected_sum self.expected_mean = expected_mean self.expected_std = expected_std @staticmethod fn generate_3d_axis_0() -> SumMeanStdData: var A = generate_tensor(3, 4, 5) var axis = 0 var expected_sum = StaticIntTuple[20]( 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, ) var expected_mean = StaticIntTuple[20]( 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, ) var expected_std = Tensor[dtype](1, 4, 5) fill(expected_std, 16.32993162) var B = generate_expected_tensor[20](expected_sum, 1, 4, 5) var C = generate_expected_tensor[20](expected_mean, 1, 4, 5) return SumMeanStdData(A, axis, B, C, expected_std) @staticmethod fn generate_3d_axis_1() -> SumMeanStdData: var A = generate_tensor(3, 4, 5) var axis = 1 var expected_sum = StaticIntTuple[15]( 34, 38, 42, 46, 50, 114, 118, 122, 126, 130, 194, 198, 202, 206, 210, ) var expected_mean = StaticIntTuple[15]( 8, 9, 10, 11, 12, 28, 29, 30, 31, 32, 48, 49, 50, 51, 52, ) # 0.5 added afterwards var expected_std = Tensor[dtype](3, 1, 5) fill(expected_std, 5.59016994) var B = generate_expected_tensor[15](expected_sum, 3, 1, 5) var C = generate_expected_tensor[15](expected_mean, 3, 1, 5) elwise_op[add](C, C, 0.5) return SumMeanStdData(A, axis, B, C, expected_std) @staticmethod fn generate_3d_axis_2() -> SumMeanStdData: var A = generate_tensor(3, 4, 5) var axis = 2 var expected_sum = StaticIntTuple[12]( 15, 40, 65, 90, 115, 140, 165, 190, 215, 240, 265, 290, ) var expected_mean = StaticIntTuple[12]( 3, 8, 13, 18, 23, 28, 33, 38, 43, 48, 53, 58, ) var expected_std = Tensor[dtype](3, 4, 1) fill(expected_std, 1.41421356) var B = generate_expected_tensor[12](expected_sum, 3, 4, 1) var C = generate_expected_tensor[12](expected_mean, 3, 4, 1) return SumMeanStdData(A, axis, B, C, expected_std) --- tests/python/test_broadcast_shapes.mojo --- from python.python import Python from testing import assert_true from basalt.nn import Tensor, TensorShape from basalt.utils.tensorutils import broadcast_shapes fn to_tensor_shape(owned shape: PythonObject) raises -> TensorShape: var tensor_shape = List[Int]() for dim in shape: tensor_shape.append(int(dim.to_float64())) return TensorShape(tensor_shape) fn np_broadcast_shapes(s1: TensorShape, s2: TensorShape) raises -> TensorShape: var np = Python.import_module("numpy") var s1_py: PythonObject = [] var s2_py: PythonObject = [] for i in range(s1.rank()): s1_py += [s1[i]] for i in range(s2.rank()): s2_py += [s2[i]] var py_shape = np.broadcast_shapes(s1_py, s2_py) return to_tensor_shape(py_shape) fn test_broadcast_shapes() raises: var s1 = TensorShape(3, 5, 2) var s2 = TensorShape(3, 5, 2) var s3 = broadcast_shapes(s1, s2) assert_true(s3 == np_broadcast_shapes(s1, s2)) s1 = TensorShape(3, 5, 2) s2 = TensorShape(1, 2) s3 = broadcast_shapes(s1, s2) assert_true(s3 == np_broadcast_shapes(s1, s2)) s1 = TensorShape(5, 1) s2 = TensorShape(3, 5, 1) s3 = broadcast_shapes(s1, s2) assert_true(s3 == np_broadcast_shapes(s1, s2)) s1 = TensorShape(3, 1, 2) s2 = TensorShape(3, 5, 2) s3 = broadcast_shapes(s1, s2) assert_true(s3 == np_broadcast_shapes(s1, s2)) s1 = TensorShape(1, 1, 1) s2 = TensorShape(3, 5, 2) s3 = broadcast_shapes(s1, s2) assert_true(s3 == np_broadcast_shapes(s1, s2)) s1 = TensorShape(2) s2 = TensorShape(3, 5, 2) s3 = broadcast_shapes(s1, s2) assert_true(s3 == np_broadcast_shapes(s1, s2)) s1 = TensorShape() s2 = TensorShape(3, 5, 2) s3 = broadcast_shapes(s1, s2) assert_true(s3 == np_broadcast_shapes(s1, s2)) # # Both errors expected # print("EXPECTED RAISE!") # try: # s1 = TensorShape(3, 2, 2) # s2 = TensorShape(3, 5, 2) # s3 = broadcast_shapes(s1, s2) # _ = np_broadcast_shapes(s1, s2) # except e: # print("Numpy:", e) # print("EXPECTED RAISE!") # try: # s1 = TensorShape(3) # s2 = TensorShape(2) # s3 = broadcast_shapes(s1, s2) # _ = np_broadcast_shapes(s1, s2) # except e: # print("Numpy:", e) fn test_broadcast_shapes_multiple() raises: var np = Python.import_module("numpy") var s1 = TensorShape(1, 2) var s2 = TensorShape(3, 1) var s3 = TensorShape(3, 2) var res = broadcast_shapes(s1, s2, s3) var res_np = to_tensor_shape(np.broadcast_shapes((1, 2), (3, 1), (3, 2))) assert_true(res == res_np) s1 = TensorShape(6, 7) s2 = TensorShape(5, 6, 1) s3 = TensorShape(7) var s4 = TensorShape(5, 1, 7) res = broadcast_shapes(s1, s2, s3, s4) res_np = to_tensor_shape(np.broadcast_shapes((6, 7), (5, 6, 1), (7), (5, 1, 7))) assert_true(res == res_np) fn main(): try: test_broadcast_shapes() test_broadcast_shapes_multiple() except e: print("[Error] In test broadcasting.") print(e) --- tests/python/test_conv.mojo --- from random import rand from python.python import Python from testing import assert_equal from basalt import dtype, nelts from basalt.autograd import Graph, Symbol from basalt.autograd.attributes import Attribute, AttributeVector from basalt.autograd.ops import OP from basalt.autograd.ops.conv import get_result_shape, CONV2D from basalt.nn import Tensor, TensorShape, Model from basalt.utils.tensorutils import fill from tests import assert_tensors_equal, to_numpy, to_tensor fn test_get_result_shape() raises: # padding=2, stride=1, dilation=1 # input shape: (4, 28, 28) kernel shape: (1, 16) # result: (32, 17) var inputs = Tensor[dtype](4, 28, 28) var kernel = Tensor[dtype](1, 16) var res = get_result_shape(inputs.shape(), kernel.shape(), 2, 1, 1) assert_equal(res[0], 32) assert_equal(res[1], 17) # padding=0, stride=1, dilation=1 # input shape: (4, 32, 17) kernel shape: (2, 2) # result: (31, 16) inputs = Tensor[dtype](4, 32, 17) kernel = Tensor[dtype](2, 2) res = get_result_shape(inputs.shape(), kernel.shape(), 0, 1, 1) assert_equal(res[0], 31) assert_equal(res[1], 16) # padding=(3, 1), stride=1, dilation=2 # input shape: (4, 32, 17) kernel shape: (2, 2) # result: (36, 17) inputs = Tensor[dtype](4, 32, 17) kernel = Tensor[dtype](2, 2) res = get_result_shape( inputs.shape(), kernel.shape(), StaticIntTuple[2](3, 1), 1, 2 ) assert_equal(res[0], 36) assert_equal(res[1], 17) # padding=(3, 2), stride=(2, 1), dilation=(2, 3) # input shape: (4, 32, 17) kernel shape: (2, 2) # result: (18, 18) inputs = Tensor[dtype](4, 32, 17) kernel = Tensor[dtype](3, 2) res = get_result_shape( inputs.shape(), kernel.shape(), StaticIntTuple[2](3, 2), StaticIntTuple[2](2, 1), StaticIntTuple[2](2, 3), ) assert_equal(res[0], 17) assert_equal(res[1], 18) @value struct torch_conv2d_output: var expected: Tensor[dtype] var expected_inputs_grad: Tensor[dtype] var expected_kernel_grad: Tensor[dtype] var expected_bias_grad: Tensor[dtype] fn torch_conv2d( inputs: Tensor, kernel: Tensor, bias: Tensor, padding: StaticIntTuple[2], stride: StaticIntTuple[2], dilation: StaticIntTuple[2], upper_grad: Tensor, ) -> torch_conv2d_output: var out: torch_conv2d_output try: var torch = Python.import_module("torch") var F = Python.import_module("torch.nn.functional") var np = Python.import_module("numpy") var inputs = torch.from_numpy(to_numpy(inputs)).requires_grad_(True) var weights = torch.from_numpy(to_numpy(kernel)).requires_grad_(True) var bias = torch.from_numpy(to_numpy(bias)).requires_grad_(True) var expected = F.conv2d( inputs, weights, bias, (stride[0], stride[1]), (padding[0], padding[1]), (dilation[0], dilation[1]), ) # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) # expected output out = torch_conv2d_output( to_tensor(expected.detach().numpy()), to_tensor(inputs.grad.numpy()), to_tensor(weights.grad.numpy()), to_tensor(bias.grad.numpy()), ) return out except: print("Error importing torch") var d = Tensor[dtype](1) var out: torch_conv2d_output = torch_conv2d_output(d, d, d, d) return out fn test_conv_forward[ input_shape: TensorShape, kernel_shape: TensorShape, padding: StaticIntTuple[2], stride: StaticIntTuple[2], dilation: StaticIntTuple[2], ](inputs: Tensor[dtype], kernel: Tensor[dtype], bias: Tensor[dtype]) raises: fn create_graph() -> Graph: var g = Graph() var inp = g.input(input_shape) var weights = g.input(kernel_shape) # as input var bias = g.input(kernel_shape[0]) # as input var res = g.op( OP.CONV2D, inp, weights, bias, attributes=AttributeVector( Attribute("padding", padding), Attribute("stride", stride), Attribute("dilation", dilation), ), ) g.out(res) return g ^ alias graph = create_graph() assert_equal(len(graph.nodes), 1) var model = Model[graph](inference_only=True) var res = model.inference(inputs, kernel, bias)[0] var torch_out = torch_conv2d( inputs, kernel, bias=bias, padding=padding, stride=stride, dilation=dilation, upper_grad=Tensor[dtype](res.shape()), ) assert_tensors_equal(res, torch_out.expected) fn test_forward_1() raises: # padding=2, stride=1, dilation=1 # input shape: (4, 1, 28, 28) kernel shape: (1, 1, 1, 16) # result_shape: (4, 1, 32, 17) alias padding = 2 alias stride = 1 alias dilation = 1 alias input_shape = TensorShape(4, 1, 28, 28) alias kernel_shape = TensorShape(1, 1, 1, 16) var inputs = Tensor[dtype](input_shape) var kernel = Tensor[dtype](kernel_shape) var bias = Tensor[dtype](kernel_shape[0]) fill(inputs, 1.0) fill(kernel, 1.0) test_conv_forward[input_shape, kernel_shape, padding, stride, dilation]( inputs, kernel, bias ) fn test_forward_2() raises: # padding=0, stride=1, dilation=1 # input shape: (4, 1, 32, 17) kernel shape: (1, 1, 2, 2) # result_shape: (4, 1, 31, 16) alias padding = 0 alias stride = 1 alias dilation = 1 alias input_shape = TensorShape(4, 1, 32, 17) alias kernel_shape = TensorShape(1, 1, 2, 2) var inputs = Tensor[dtype](input_shape) var kernel = Tensor[dtype](kernel_shape) fill(inputs, 1.0) fill(kernel, 1.0) var bias = Tensor[dtype](kernel_shape[0]) fill(bias, 66.99) test_conv_forward[input_shape, kernel_shape, padding, stride, dilation]( inputs, kernel, bias ) fn test_forward_3() raises: # padding=(3, 1), stride=(2, 3), dilation=(2, 3) # input shape: (4, 3, 32, 17) kernel shape: (2, 3, 2, 2) # result_shape: (4, 2, 18, 6) alias padding = StaticIntTuple[2](3, 1) alias stride = StaticIntTuple[2](2, 3) alias dilation = StaticIntTuple[2](2, 3) alias input_shape = TensorShape(4, 3, 32, 17) alias kernel_shape = TensorShape(2, 3, 2, 2) var inputs = Tensor[dtype](input_shape) var kernel = Tensor[dtype](kernel_shape) fill(inputs, 3.0) fill(kernel, 2.0) var bias = Tensor[dtype](kernel_shape[0]) fill(bias, 3) test_conv_forward[input_shape, kernel_shape, padding, stride, dilation]( inputs, kernel, bias ) fn test_conv_backward[ ug_shape: TensorShape, input_shape: TensorShape, kernel_shape: TensorShape, padding: StaticIntTuple[2], stride: StaticIntTuple[2], dilation: StaticIntTuple[2], ]( ug: Tensor[dtype], inputs: Tensor[dtype], kernel: Tensor[dtype], bias: Tensor[dtype] ) raises: alias bias_shape = TensorShape(kernel_shape[0]) alias attributes = AttributeVector( Attribute("padding", padding), Attribute("stride", stride), Attribute("dilation", dilation), ) var grad1 = CONV2D.backward[ 0, ug_shape, input_shape, kernel_shape, bias_shape, attributes ](ug, inputs, kernel, bias) var grad2 = CONV2D.backward[ 1, ug_shape, input_shape, kernel_shape, bias_shape, attributes ](ug, inputs, kernel, bias) var grad3 = CONV2D.backward[ 2, ug_shape, input_shape, kernel_shape, bias_shape, attributes ](ug, inputs, kernel, bias) var torch_out = torch_conv2d( inputs, kernel, bias=bias, padding=padding, stride=stride, dilation=dilation, upper_grad=ug, ) assert_tensors_equal["almost"](grad1, torch_out.expected_inputs_grad) assert_tensors_equal["almost"](grad2, torch_out.expected_kernel_grad) assert_tensors_equal["almost"](grad3, torch_out.expected_bias_grad) fn test_backward_1() raises: # padding=2, stride=1, dilation=1 alias padding = 2 alias stride = 1 alias dilation = 1 alias input_shape = TensorShape(4, 2, 28, 28) alias kernel_shape = TensorShape(3, 2, 1, 16) var inputs = Tensor[dtype](input_shape) var kernel = Tensor[dtype](kernel_shape) fill(inputs, 1.0) fill(kernel, 1.0) var bias = Tensor[dtype](kernel_shape[0]) rand[dtype](bias.data(), bias.num_elements()) # uppergrad alias res = get_result_shape(input_shape, kernel_shape, padding, stride, dilation) alias ug_shape = TensorShape(input_shape[0], kernel_shape[0], res[0], res[1]) var ug = Tensor[dtype](ug_shape) test_conv_backward[ug_shape, input_shape, kernel_shape, padding, stride, dilation]( ug, inputs, kernel, bias ) fn test_backward_2() raises: # padding=(2, 4), stride=(3, 1), dilation=2 alias padding = StaticIntTuple[2](2, 4) alias stride = StaticIntTuple[2](3, 1) alias dilation = 2 alias input_shape = TensorShape(4, 2, 28, 28) alias kernel_shape = TensorShape(3, 2, 4, 8) var inputs = Tensor[dtype](input_shape) var kernel = Tensor[dtype](kernel_shape) fill(inputs, 3.0) fill(kernel, 1.0) var bias = Tensor[dtype](kernel_shape[0]) rand[dtype](bias.data(), bias.num_elements()) # uppergrad alias res = get_result_shape(input_shape, kernel_shape, padding, stride, dilation) alias ug_shape = TensorShape(input_shape[0], kernel_shape[0], res[0], res[1]) var ug = Tensor[dtype](ug_shape) rand[dtype](ug.data(), ug.num_elements()) test_conv_backward[ug_shape, input_shape, kernel_shape, padding, stride, dilation]( ug, inputs, kernel, bias ) fn test_backward_3() raises: # padding=(2, 4), stride=2, dilation=(3, 2) alias padding = StaticIntTuple[2](3, 2) alias stride = 2 alias dilation = StaticIntTuple[2](3, 2) alias input_shape = TensorShape(4, 2, 28, 28) alias kernel_shape = TensorShape(3, 2, 5, 6) var inputs = Tensor[dtype](input_shape) var kernel = Tensor[dtype](kernel_shape) fill(inputs, 3.0) fill(kernel, 4.0) var bias = Tensor[dtype](kernel_shape[0]) rand[dtype](bias.data(), bias.num_elements()) # uppergrad alias res = get_result_shape(input_shape, kernel_shape, padding, stride, dilation) alias ug_shape = TensorShape(input_shape[0], kernel_shape[0], res[0], res[1]) var ug = Tensor[dtype](ug_shape) rand[dtype](ug.data(), ug.num_elements()) test_conv_backward[ug_shape, input_shape, kernel_shape, padding, stride, dilation]( ug, inputs, kernel, bias ) fn main(): try: test_get_result_shape() test_forward_1() test_forward_2() test_forward_3() test_backward_1() test_backward_2() test_backward_3() except e: print("[Error] Error in Conv2D") print(e) --- tests/python/test_dynamic_ops_torch.mojo --- from random import rand from python.python import Python from basalt import dtype, nelts from basalt.autograd import Graph, Symbol, OP from basalt.autograd.attributes import Attribute, AttributeVector from basalt.nn import Model, Tensor, TensorShape from tests import ( assert_tensors_equal, to_numpy, to_tensor, create_graph_concat, create_graph_split, ) @value struct torch_output_cat: var expected: Tensor[dtype] var grad_1: Tensor[dtype] var grad_2: Tensor[dtype] var grad_3: Tensor[dtype] fn torch_cat( input_1: Tensor, input_2: Tensor, input_3: Tensor, upper_grad: Tensor, dim: Int ) -> torch_output_cat: try: var py = Python.import_module("builtins") var torch = Python.import_module("torch") var np = Python.import_module("numpy") var input_1 = torch.from_numpy(to_numpy(input_1)).requires_grad_(True) var input_2 = torch.from_numpy(to_numpy(input_2)).requires_grad_(True) var input_3 = torch.from_numpy(to_numpy(input_3)).requires_grad_(True) var expected: PythonObject var tensors = py.list() tensors.append(input_1) tensors.append(input_2) tensors.append(input_3) expected = torch.cat(tensors, dim=dim) # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) return torch_output_cat( to_tensor(expected.detach().numpy()), to_tensor(input_1.grad.numpy()), to_tensor(input_2.grad.numpy()), to_tensor(input_3.grad.numpy()), ) except e: print("Error importing torch: ", e) var d = Tensor[dtype](1) return torch_output_cat(d, d, d, d) fn test_CONCAT() raises: alias t1_shape = TensorShape(11, 3, 17, 19) alias t2_shape = TensorShape(11, 3, 17, 19) alias t3_shape = TensorShape(11, 3, 17, 19) var t1 = Tensor[dtype](t1_shape) var t2 = Tensor[dtype](t2_shape) var t3 = Tensor[dtype](t3_shape) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) rand(t3.data(), t3.num_elements()) # default: dim = 0 alias graph = create_graph_concat(t1_shape, t2_shape, t3_shape, dim=0) var model = Model[graph]() var res = model.forward(t1, t2, t3) alias ug_shape = TensorShape(33, 3, 17, 19) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_cat(t1, t2, t3, ug, dim=0) model.backward(ug) assert_tensors_equal["almost"](res, expected_and_grad.expected) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[0]], expected_and_grad.grad_1, ) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[1]], expected_and_grad.grad_2, ) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[2]], expected_and_grad.grad_3, ) # dim = 2 alias graph_2 = create_graph_concat(t1_shape, t2_shape, t3_shape, dim=2) var model_2 = Model[graph_2]() var res_2 = model_2.forward(t1, t2, t3) alias ug_shape_2 = TensorShape(11, 3, 51, 19) var ug_2 = Tensor[dtype](ug_shape_2) rand(ug_2.data(), ug_2.num_elements()) var expected_and_grad_2 = torch_cat(t1, t2, t3, ug_2, dim=2) model_2.backward(ug_2) assert_tensors_equal["almost"](res_2, expected_and_grad_2.expected) assert_tensors_equal["almost"]( model_2.parameters.grads[graph_2.nodes[0].inputs[0]], expected_and_grad_2.grad_1, ) assert_tensors_equal["almost"]( model_2.parameters.grads[graph_2.nodes[0].inputs[1]], expected_and_grad_2.grad_2, ) assert_tensors_equal["almost"]( model_2.parameters.grads[graph_2.nodes[0].inputs[2]], expected_and_grad_2.grad_3, ) @value struct torch_output_split: var expected1: Tensor[dtype] var expected2: Tensor[dtype] var expected3: Tensor[dtype] var grad: Tensor[dtype] fn torch_split( input: Tensor, upper_grad_1: Tensor, upper_grad_2: Tensor, upper_grad_3: Tensor, sections: List[Int], dim: Int, ) -> torch_output_split: try: var py = Python.import_module("builtins") var torch = Python.import_module("torch") var np = Python.import_module("numpy") var input = torch.from_numpy(to_numpy(input)).requires_grad_(True) var sizes = py.list() sizes.append(sections[0]) sizes.append(sections[1]) sizes.append(sections[2]) var chunks: PythonObject = input.split(sizes, dim=dim) # uppergrad & backwards var upper_grad_1 = torch.from_numpy(to_numpy(upper_grad_1)) var upper_grad_2 = torch.from_numpy(to_numpy(upper_grad_2)) var upper_grad_3 = torch.from_numpy(to_numpy(upper_grad_3)) _ = chunks[0].backward(upper_grad_1) _ = chunks[1].backward(upper_grad_2) _ = chunks[2].backward(upper_grad_3) return torch_output_split( to_tensor(chunks[0].detach().numpy()), to_tensor(chunks[1].detach().numpy()), to_tensor(chunks[2].detach().numpy()), to_tensor(input.grad.numpy()), ) except e: print("Error importing torch: ", e) var d = Tensor[dtype](1) return torch_output_split(d, d, d, d) fn test_SPLIT() raises: alias t1_shape = TensorShape(11, 3, 17, 19) var t1 = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) # default: dim = 0 alias sections = List[Int](3, 6, 2) # 11 alias graph = create_graph_split(t1_shape, sections, dim=0) var model = Model[graph]() var results = model.inference(t1) alias ug1_shape = TensorShape(3, 3, 17, 19) alias ug2_shape = TensorShape(6, 3, 17, 19) alias ug3_shape = TensorShape(2, 3, 17, 19) var ug1 = Tensor[dtype](ug1_shape) var ug2 = Tensor[dtype](ug2_shape) var ug3 = Tensor[dtype](ug3_shape) rand(ug1.data(), ug1.num_elements()) rand(ug2.data(), ug2.num_elements()) rand(ug3.data(), ug3.num_elements()) var expected_and_grad = torch_split(t1, ug1, ug2, ug3, sections, dim=0) model.backward(ug1, ug2, ug3) assert_tensors_equal["almost"](results[0], expected_and_grad.expected1) assert_tensors_equal["almost"](results[1], expected_and_grad.expected2) assert_tensors_equal["almost"](results[2], expected_and_grad.expected3) assert_tensors_equal["almost"]( model.parameters.grads[graph.nodes[0].inputs[0]], expected_and_grad.grad, ) # dim = 2 alias sections_2 = List[Int](3, 6, 8) # 17 alias graph_2 = create_graph_split(t1_shape, sections_2, dim=2) var model_2 = Model[graph_2]() var results_2 = model_2.inference(t1) alias ug1_shape_2 = TensorShape(11, 3, 3, 19) alias ug2_shape_2 = TensorShape(11, 3, 6, 19) alias ug3_shape_2 = TensorShape(11, 3, 8, 19) var ug1_2 = Tensor[dtype](ug1_shape_2) var ug2_2 = Tensor[dtype](ug2_shape_2) var ug3_2 = Tensor[dtype](ug3_shape_2) rand(ug1_2.data(), ug1_2.num_elements()) rand(ug2_2.data(), ug2_2.num_elements()) rand(ug3_2.data(), ug3_2.num_elements()) var expected_and_grad_2 = torch_split(t1, ug1_2, ug2_2, ug3_2, sections_2, dim=2) model_2.backward(ug1_2, ug2_2, ug3_2) assert_tensors_equal["almost"](results_2[0], expected_and_grad_2.expected1) assert_tensors_equal["almost"](results_2[1], expected_and_grad_2.expected2) assert_tensors_equal["almost"](results_2[2], expected_and_grad_2.expected3) assert_tensors_equal["almost"]( model_2.parameters.grads[graph_2.nodes[0].inputs[0]], expected_and_grad_2.grad ) fn main(): print("Running dynamic ops (compare with torch) tests") try: test_CONCAT() test_SPLIT() except e: print("[ERROR] Error in dynamic ops (compare with torch)") print(e) return print("Finished dynamic ops (compare with torch) tests") --- tests/python/test_mlops_torch.mojo --- from random import rand from utils.numerics import min_finite, max_finite from collections.optional import OptionalReg, Optional from python.python import Python from python.object import PythonObject from basalt import dtype, nelts from basalt.autograd import OP from basalt.autograd.attributes import Attribute, AttributeVector from basalt.nn import Tensor, TensorShape from tests import ( assert_tensors_equal, to_numpy, to_tensor, test_unary_op, test_binary_op, test_unary_op_backward, test_binary_op_backward, ) # ------ Test Unary Ops ------ @value struct torch_output_unary_op: var expected: Tensor[dtype] var grad_1: Tensor[dtype] fn torch_unary_op( op: OP, input_1: Tensor, upper_grad: Tensor, attrs: OptionalReg[AttributeVector] = None, attrs_tuple: Optional[PythonObject] = None, ) -> torch_output_unary_op: try: var torch = Python.import_module("torch") var np = Python.import_module("numpy") var py = Python.import_module("builtins") var input_1 = torch.from_numpy(to_numpy(input_1)).requires_grad_(True) var expected: PythonObject if op == OP.SIGMOID: expected = torch.sigmoid(input_1) elif op == OP.RELU: expected = torch.relu(input_1) elif op == OP.LEAKYRELU: expected = torch.nn.functional.leaky_relu( input_1, attrs.value()["negative_slope"].value().to_scalar[dtype](), ) elif op == OP.TANH: expected = torch.tanh(input_1) elif op == OP.CLIP: var min_attr = attrs.value()["min"] var max_attr = attrs.value()["max"] var min_val = min_attr.value().to_scalar[ dtype ]() if min_attr else min_finite[dtype]() var max_val = max_attr.value().to_scalar[ dtype ]() if max_attr else max_finite[dtype]() expected = torch.clamp(input_1, min_val, max_val) elif op == OP.SQUEEZE: if attrs: var attrs = attrs.value() var dim = attrs["dims"] if dim: expected = torch.squeeze( input_1, dim=dim.value().to_shape()[0] ) else: expected = torch.squeeze(input_1) elif attrs_tuple: expected = torch.squeeze(input_1, dim=attrs_tuple.value()[]) else: expected = torch.squeeze(input_1) elif op == OP.UNSQUEEZE: if attrs: var attrs = attrs.value() var dim = attrs["dims"] if dim: expected = torch.unsqueeze( input_1, dim=dim.value().to_shape()[0] ) else: expected = torch.unsqueeze(input_1, 0) elif attrs_tuple: expected = torch.reshape(input_1, attrs_tuple.value()[]) else: expected = torch.unsqueeze(input_1, 0) elif op == OP.SLICE: var attrs = attrs_tuple.value()[] # create a tuple of all the slices using the dims var indices = PythonObject([]) for i in range(input_1.dim()): indices.append(py.slice(input_1.shape[i])) var flip_dims = PythonObject([]) for i in range(0, len(attrs), 4): var start = attrs[i] var end = attrs[i + 1] var step = attrs[i + 2] var dim = attrs[i + 3] if step < 0: flip_dims.append(dim) step = step * -1 end, start = (end + 1) * -1, (start + 1) * -1 indices[dim] = py.slice(start, end, step) expected = input_1.flip(flip_dims)[indices] else: print("Error: op not supported (returning the value input_1): ", op) expected = input_1 # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) return torch_output_unary_op( to_tensor(expected.detach().numpy()), to_tensor(input_1.grad.numpy()), ) except e: print("Error importing torch", e) var d = Tensor[dtype](1) return torch_output_unary_op(d, d) fn test_SIGMOID() raises: alias t1_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_unary_op(OP.SIGMOID, t1, ug) test_unary_op[OP.SIGMOID, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.SIGMOID, t1_shape, ug_shape]( t1, ug, expected_and_grad.grad_1 ) fn test_RELU() raises: alias t1_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_unary_op(OP.RELU, t1, ug) test_unary_op[OP.RELU, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.RELU, t1_shape, ug_shape]( t1, ug, expected_and_grad.grad_1 ) fn test_LEAKYRELU() raises: alias t1_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_unary_op( OP.LEAKYRELU, t1, ug, AttributeVector(Attribute("negative_slope", Float32(0.1))) ) test_unary_op[ OP.LEAKYRELU, t1_shape, AttributeVector(Attribute("negative_slope", 0.1)), ](t1, expected_and_grad.expected) test_unary_op_backward[ OP.LEAKYRELU, t1_shape, ug_shape, AttributeVector(Attribute("negative_slope", 0.1)), ](t1, ug, expected_and_grad.grad_1) fn test_TANH() raises: alias t1_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_unary_op(OP.TANH, t1, ug) test_unary_op[OP.TANH, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.TANH, t1_shape, ug_shape]( t1, ug, expected_and_grad.grad_1 ) fn test_CLIP() raises: alias t1_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) # No clipping var expected_and_grad = torch_unary_op(OP.CLIP, t1, ug) test_unary_op[OP.CLIP, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.CLIP, t1_shape, ug_shape]( t1, ug, expected_and_grad.grad_1 ) # Clip with min alias min_attr = Attribute("min", 0.3333) expected_and_grad = torch_unary_op( OP.CLIP, t1, ug, AttributeVector(min_attr) ) test_unary_op[OP.CLIP, t1_shape, AttributeVector(min_attr)]( t1, expected_and_grad.expected ) test_unary_op_backward[ OP.CLIP, t1_shape, ug_shape, AttributeVector(min_attr) ](t1, ug, expected_and_grad.grad_1) # Clip with max alias max_attr = Attribute("max", 0.6666) expected_and_grad = torch_unary_op( OP.CLIP, t1, ug, AttributeVector(max_attr) ) test_unary_op[OP.CLIP, t1_shape, AttributeVector(max_attr)]( t1, expected_and_grad.expected ) test_unary_op_backward[ OP.CLIP, t1_shape, ug_shape, AttributeVector(max_attr) ](t1, ug, expected_and_grad.grad_1) # Clip with min and max expected_and_grad = torch_unary_op( OP.CLIP, t1, ug, AttributeVector(min_attr, max_attr) ) test_unary_op[OP.CLIP, t1_shape, AttributeVector(min_attr, max_attr)]( t1, expected_and_grad.expected ) test_unary_op_backward[ OP.CLIP, t1_shape, ug_shape, AttributeVector(min_attr, max_attr) ](t1, ug, expected_and_grad.grad_1) fn test_SQUEEZE() raises: alias t1_shape = TensorShape(20, 1, 28, 1) alias ug_shape = TensorShape(20, 28) var t1 = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_unary_op(OP.SQUEEZE, t1, ug) test_unary_op[OP.SQUEEZE, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.SQUEEZE, t1_shape, ug_shape]( t1, ug, expected_and_grad.grad_1 ) # Squeeze with one dim alias ug_shape_1 = TensorShape(20, 1, 28) ug = Tensor[dtype](ug_shape_1) rand(ug.data(), ug.num_elements()) alias dim = Attribute("dims", TensorShape(3)) expected_and_grad = torch_unary_op(OP.SQUEEZE, t1, ug, AttributeVector(dim)) test_unary_op[OP.SQUEEZE, t1_shape, AttributeVector(dim)]( t1, expected_and_grad.expected ) test_unary_op_backward[ OP.SQUEEZE, t1_shape, ug_shape_1, AttributeVector(dim) ](t1, ug, expected_and_grad.grad_1) alias ug_shape_2 = TensorShape(20, 28, 1) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) alias dim_2 = Attribute("dims", TensorShape(1)) expected_and_grad = torch_unary_op( OP.SQUEEZE, t1, ug, AttributeVector(dim_2) ) test_unary_op[OP.SQUEEZE, t1_shape, AttributeVector(dim_2)]( t1, expected_and_grad.expected ) test_unary_op_backward[ OP.SQUEEZE, t1_shape, ug_shape_2, AttributeVector(dim_2) ](t1, ug, expected_and_grad.grad_1) # Squeeze with multiple dims ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) alias dims_shape = TensorShape(1, 3) alias dims_tuple = (dims_shape[0], dims_shape[1]) alias dims = Attribute("dims", dims_shape) expected_and_grad = torch_unary_op( OP.SQUEEZE, t1, ug, attrs_tuple=PythonObject(dims_tuple) ) test_unary_op[OP.SQUEEZE, t1_shape, AttributeVector(dims)]( t1, expected_and_grad.expected ) test_unary_op_backward[ OP.SQUEEZE, t1_shape, ug_shape, AttributeVector(dims) ](t1, ug, expected_and_grad.grad_1) fn test_UNSQUEEZE() raises: alias t1_shape = TensorShape(20, 28) alias ug_shape = TensorShape(20, 1, 28) var t1 = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) alias dim = Attribute("dims", TensorShape(1)) var expected_and_grad = torch_unary_op( OP.UNSQUEEZE, t1, ug, AttributeVector(dim) ) test_unary_op[OP.UNSQUEEZE, t1_shape, AttributeVector(dim)]( t1, expected_and_grad.expected ) test_unary_op_backward[ OP.UNSQUEEZE, t1_shape, ug_shape, AttributeVector(dim) ](t1, ug, expected_and_grad.grad_1) # Unsqueeze with multiple dims alias ug_shape_2 = TensorShape(20, 1, 28, 1) ug = Tensor[dtype](ug_shape_2) alias dims_shape = TensorShape(1, 3) alias dims_tuple = (20, 1, 28, 1) alias dims = Attribute("dims", dims_shape) expected_and_grad = torch_unary_op( OP.UNSQUEEZE, t1, ug, attrs_tuple=PythonObject(dims_tuple) ) test_unary_op[OP.UNSQUEEZE, t1_shape, AttributeVector(dims)]( t1, expected_and_grad.expected ) test_unary_op_backward[ OP.UNSQUEEZE, t1_shape, ug_shape_2, AttributeVector(dims) ](t1, ug, expected_and_grad.grad_1) fn test_SLICE() raises: alias t1_shape = TensorShape(430, 322, 317) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) # dim = 0 alias slice_0 = Slice(5, 200, 3) alias attrs_0 = AttributeVector( Attribute("starts", TensorShape(slice_0.start)), Attribute("ends", TensorShape(slice_0.end)), Attribute("steps", TensorShape(slice_0.step)), Attribute("axes", TensorShape(0)), ) alias ug_shape = TensorShape(65, 322, 317) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var attrs_tuple_0 = PythonObject( (slice_0.start, slice_0.end, slice_0.step, 0) ) var expected_and_grad = torch_unary_op( OP.SLICE, t1, ug, attrs_tuple=attrs_tuple_0 ) test_unary_op[OP.SLICE, t1_shape, attrs_0](t1, expected_and_grad.expected) test_unary_op_backward[OP.SLICE, t1_shape, ug_shape, attrs_0]( t1, ug, expected_and_grad.grad_1 ) # dim = 1 alias slice_1 = Slice(10, 311, 5) alias attrs_1 = AttributeVector( Attribute("starts", TensorShape(slice_1.start)), Attribute("ends", TensorShape(slice_1.end)), Attribute("steps", TensorShape(slice_1.step)), Attribute("axes", TensorShape(1)), ) alias ug_shape_1 = TensorShape(430, 61, 317) ug = Tensor[dtype](ug_shape_1) rand(ug.data(), ug.num_elements()) var attrs_tuple_1 = PythonObject( (slice_1.start, slice_1.end, slice_1.step, 1) ) expected_and_grad = torch_unary_op( OP.SLICE, t1, ug, attrs_tuple=attrs_tuple_1 ) test_unary_op[OP.SLICE, t1_shape, attrs_1](t1, expected_and_grad.expected) test_unary_op_backward[OP.SLICE, t1_shape, ug_shape_1, attrs_1]( t1, ug, expected_and_grad.grad_1 ) # dim = 2 alias slice_2 = Slice(293, 33, -7) alias attrs_2 = AttributeVector( Attribute("starts", TensorShape(slice_2.start)), Attribute("ends", TensorShape(slice_2.end)), Attribute("steps", TensorShape(slice_2.step)), Attribute("axes", TensorShape(2)), ) alias ug_shape_2 = TensorShape(430, 322, 38) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) var attrs_tuple_2 = PythonObject( (slice_2.start, slice_2.end, slice_2.step, 2) ) expected_and_grad = torch_unary_op( OP.SLICE, t1, ug, attrs_tuple=attrs_tuple_2 ) test_unary_op[OP.SLICE, t1_shape, attrs_2](t1, expected_and_grad.expected) test_unary_op_backward[OP.SLICE, t1_shape, ug_shape_2, attrs_2]( t1, ug, expected_and_grad.grad_1 ) # Multiple dims # dim = 0, 1 alias slice_0_1 = Slice(23, 340, 3) alias slice_1_1 = Slice(10, 250, 5) alias attrs_0_1 = AttributeVector( Attribute("starts", TensorShape(slice_0_1.start, slice_1_1.start)), Attribute("ends", TensorShape(slice_0_1.end, slice_1_1.end)), Attribute("steps", TensorShape(slice_0_1.step, slice_1_1.step)), Attribute("axes", TensorShape(0, 1)), ) alias ug_shape_0_1 = TensorShape(106, 48, 317) ug = Tensor[dtype](ug_shape_0_1) rand(ug.data(), ug.num_elements()) var attrs_tuple_0_1 = PythonObject( ( slice_0_1.start, slice_0_1.end, slice_0_1.step, 0, slice_1_1.start, slice_1_1.end, slice_1_1.step, 1, ) ) expected_and_grad = torch_unary_op( OP.SLICE, t1, ug, attrs_tuple=attrs_tuple_0_1 ) test_unary_op[OP.SLICE, t1_shape, attrs_0_1](t1, expected_and_grad.expected) test_unary_op_backward[OP.SLICE, t1_shape, ug_shape_0_1, attrs_0_1]( t1, ug, expected_and_grad.grad_1 ) # dim = 0, 1, 2 alias slice_0_2 = Slice(-412, -5, 3) alias slice_1_2 = Slice(-10, -182, -5) alias slice_2_2 = Slice(293, 33, -7) alias attrs_0_2 = AttributeVector( Attribute( "starts", TensorShape(slice_0_2.start, slice_1_2.start, slice_2_2.start), ), Attribute( "ends", TensorShape(slice_0_2.end, slice_1_2.end, slice_2_2.end) ), Attribute( "steps", TensorShape(slice_0_2.step, slice_1_2.step, slice_2_2.step) ), Attribute("axes", TensorShape(0, 1, 2)), ) alias ug_shape_0_2 = TensorShape(136, 35, 38) ug = Tensor[dtype](ug_shape_0_2) rand(ug.data(), ug.num_elements()) var attrs_tuple_0_2 = PythonObject( ( slice_0_2.start, slice_0_2.end, slice_0_2.step, 0, slice_1_2.start, slice_1_2.end, slice_1_2.step, 1, slice_2_2.start, slice_2_2.end, slice_2_2.step, 2, ) ) expected_and_grad = torch_unary_op( OP.SLICE, t1, ug, attrs_tuple=attrs_tuple_0_2 ) test_unary_op[OP.SLICE, t1_shape, attrs_0_2](t1, expected_and_grad.expected) test_unary_op_backward[OP.SLICE, t1_shape, ug_shape_0_2, attrs_0_2]( t1, ug, expected_and_grad.grad_1 ) fn main(): print("Running mlops (compare with torch) tests") try: test_SIGMOID() test_RELU() test_LEAKYRELU() test_TANH() test_CLIP() test_SQUEEZE() test_UNSQUEEZE() test_SLICE() except e: print("[ERROR] Error in mlops (compare with torch)") print(e) return print("Finished mlops (compare with torch) tests") --- tests/python/test_models_mnist.mojo --- from random import rand from python import Python from testing import assert_almost_equal from basalt import dtype from basalt.autograd import Graph, OP from basalt.autograd.attributes import AttributeVector, Attribute from basalt.nn import ( Tensor, TensorShape, Model, ReLU, MaxPool2d, CrossEntropyLoss, optim, ) from tests import assert_tensors_equal, to_numpy, to_tensor fn create_CNN( batch_size: Int, conv1_weights: List[Scalar[dtype]], conv1_bias: List[Scalar[dtype]], conv2_weights: List[Scalar[dtype]], conv2_bias: List[Scalar[dtype]], linear1_weights: List[Scalar[dtype]], linear1_bias: List[Scalar[dtype]], ) -> Graph: var g = Graph() var x = g.input(TensorShape(batch_size, 1, 28, 28)) # conv1 # var x1 = nn.Conv2d(g, x, out_channels=16, kernel_size=5, padding=2) var c1_w = g.param(TensorShape(16, x.shape[1], 5, 5), init=conv1_weights) var c1_b = g.param(TensorShape(16), init=conv1_bias) var x1 = g.op( OP.CONV2D, x, c1_w, c1_b, attributes=AttributeVector( Attribute("padding", StaticIntTuple[2](2, 2)), Attribute("stride", StaticIntTuple[2](1, 1)), Attribute("dilation", StaticIntTuple[2](1, 1)), ), ) var x2 = ReLU(g, x1) var x3 = MaxPool2d(g, x2, kernel_size=2) # conv2 # var x4 = nn.Conv2d(g, x3, out_channels=32, kernel_size=5, padding=2) var c2_w = g.param(TensorShape(32, x3.shape[1], 5, 5), init=conv2_weights) var c2_b = g.param(TensorShape(32), init=conv2_bias) var x4 = g.op( OP.CONV2D, x3, c2_w, c2_b, attributes=AttributeVector( Attribute("padding", StaticIntTuple[2](2, 2)), Attribute("stride", StaticIntTuple[2](1, 1)), Attribute("dilation", StaticIntTuple[2](1, 1)), ), ) var x5 = ReLU(g, x4) var x6 = MaxPool2d(g, x5, kernel_size=2) var x6_shape = x6.shape var x7 = g.op( OP.RESHAPE, x6, attributes=AttributeVector( Attribute( "shape", TensorShape(x6_shape[0], x6_shape[1] * x6_shape[2] * x6_shape[3]), ) ), ) # linear1 # var out = nn.Linear(g, x7, n_outputs=10) var l1_w = g.param(TensorShape(x7.shape[1], 10), init=linear1_weights) var l1_b = g.param(TensorShape(10), init=linear1_bias) var res = g.op(OP.DOT, x7, l1_w) var out = g.op(OP.ADD, res, l1_b) g.out(out) var y_true = g.input(TensorShape(batch_size, 10)) var loss = CrossEntropyLoss(g, out, y_true) # var loss = nn.MSELoss(g, out, y_true) g.loss(loss) return g ^ fn run_mojo[ batch_size: Int, conv1_weights: List[Scalar[dtype]], conv1_bias: List[Scalar[dtype]], conv2_weights: List[Scalar[dtype]], conv2_bias: List[Scalar[dtype]], linear1_weights: List[Scalar[dtype]], linear1_bias: List[Scalar[dtype]], ]( epochs: Int, learning_rate: Float64, inputs: Tensor[dtype], labels: Tensor[dtype], ) -> List[Scalar[dtype]]: alias graph = create_CNN( batch_size, conv1_weights, conv1_bias, conv2_weights, conv2_bias, linear1_weights, linear1_bias, ) var model = Model[graph]() var optim = optim.Adam[graph](model.parameters, lr=learning_rate) var losses = List[Scalar[dtype]]() for i in range(epochs): var loss = model.forward(inputs, labels) # Backward pass optim.zero_grad() model.backward() optim.step() losses.append(loss[0]) return losses fn run_torch( epochs: Int, learning_rate: Float64, inputs: Tensor, labels: Tensor, owned conv1_weights: Tensor, owned conv1_bias: Tensor, owned conv2_weights: Tensor, owned conv2_bias: Tensor, owned linear1_weights: Tensor, owned linear1_bias: Tensor, ) -> List[Scalar[dtype]]: var out: List[Scalar[dtype]] = List[Scalar[dtype]]() try: var torch = Python.import_module("torch") var F = Python.import_module("torch.nn.functional") var np = Python.import_module("numpy") Python.add_to_path("./tests/python") var torch_models = Python.import_module("test_models_torch") var inputs = torch.from_numpy(to_numpy(inputs)).requires_grad_(True) var labels = torch.from_numpy(to_numpy(labels)).requires_grad_(True) var conv1_weights = torch.from_numpy(to_numpy(conv1_weights)).requires_grad_( True ) var conv1_bias = torch.from_numpy(to_numpy(conv1_bias)).requires_grad_(True) var conv2_weights = torch.from_numpy(to_numpy(conv2_weights)).requires_grad_( True ) var conv2_bias = torch.from_numpy(to_numpy(conv2_bias)).requires_grad_(True) var linear1_weights = torch.from_numpy( to_numpy(linear1_weights) ).requires_grad_(True) var linear1_bias = torch.from_numpy(to_numpy(linear1_bias)).requires_grad_(True) var cnn = torch_models.CNN( conv1_weights, conv1_bias, conv2_weights, conv2_bias, linear1_weights, linear1_bias, ) var loss_func = torch_models.CrossEntropyLoss2() # var loss_func = torch.nn.CrossEntropyLoss() var optimizer = torch.optim.Adam(cnn.parameters(), learning_rate) for i in range(epochs): var output = cnn.forward(inputs) var loss = loss_func(output, labels) _ = optimizer.zero_grad() _ = loss.backward() _ = optimizer.step() out.append(to_tensor(loss)[0]) return out except e: print("Error importing torch") print(e) return out fn create_weights(num_elements: Int, zero: Bool) -> List[Scalar[dtype]]: var weights = List[Scalar[dtype]](capacity=num_elements) for i in range(num_elements): if zero: weights.append(Scalar[dtype](0.0)) else: weights.append(Scalar[dtype](0.02)) return weights ^ fn dv_to_tensor(dv: List[Scalar[dtype]], shape: TensorShape) -> Tensor[dtype]: var t = Tensor[dtype](shape) if t.num_elements() != len(dv): print("[WARNING] tensor and dv not the shame shape") for i in range(t.num_elements()): t[i] = dv[i] return t ^ fn main(): alias learning_rate = 1e-3 alias epochs = 100 alias batch_size = 4 var inputs = Tensor[dtype](batch_size, 1, 28, 28) rand[dtype](inputs.data(), inputs.num_elements()) var labels = Tensor[dtype](batch_size, 10) # one-hot encoded (probabilities) for i in range(4): labels[i * 10 + i] = 1.0 alias cv1_w_shape = TensorShape(16, 1, 5, 5) alias conv1_weights = create_weights(cv1_w_shape.num_elements(), zero=False) alias cv1_b_shape = TensorShape(16) alias conv1_bias = create_weights(16, zero=True) alias cv2_w_shape = TensorShape(32, 16, 5, 5) alias conv2_weights = create_weights(cv2_w_shape.num_elements(), zero=False) alias cv2_b_shape = TensorShape(32) alias conv2_bias = create_weights(32, zero=True) alias l1_w_shape = TensorShape(32 * 7 * 7, 10) alias linear1_weights = create_weights(l1_w_shape.num_elements(), zero=False) alias l1_b_shape = TensorShape(10) alias linear1_bias = create_weights(10, zero=True) var losses_mojo = run_mojo[ batch_size, conv1_weights, conv1_bias, conv2_weights, conv2_bias, linear1_weights, linear1_bias, ]( epochs, learning_rate, inputs, labels, ) var losses_torch = run_torch( epochs, learning_rate, inputs, labels, dv_to_tensor(conv1_weights, cv1_w_shape), dv_to_tensor(conv1_bias, cv1_b_shape), dv_to_tensor(conv2_weights, cv2_w_shape), dv_to_tensor(conv2_bias, cv2_b_shape), dv_to_tensor(linear1_weights, l1_w_shape), dv_to_tensor(linear1_bias, l1_b_shape), ) for i in range(epochs): print("loss_mojo: ", losses_mojo[i], " loss_torch: ", losses_torch[i]) for i in range(epochs): var loss_mojo = losses_mojo[i] var loss_torch = losses_torch[i] print("loss_mojo: ", loss_mojo, " loss_torch: ", loss_torch) try: assert_almost_equal(loss_mojo, loss_torch, rtol=1e-5) except e: print("Losses not equal") print(e) break --- tests/python/test_models_regression.mojo --- from random import rand from python import Python from utils.numerics import max_finite from testing import assert_almost_equal from basalt import dtype from basalt.autograd import Graph, OP from basalt.nn import Tensor, TensorShape, Model, MSELoss, optim from basalt.utils.rand_utils import MersenneTwister from tests import to_numpy, to_tensor fn create_linear_regression( batch_size: Int, n_outputs: Int, linear1_weights: List[Scalar[dtype]], linear1_bias: List[Scalar[dtype]], ) -> Graph: var g = Graph() var x = g.input(TensorShape(batch_size, 13)) # linear1 # var out = nn.Linear(g, x, n_outputs=1) var l1_w = g.param(TensorShape(13, n_outputs), init=linear1_weights) var l1_b = g.param(TensorShape(n_outputs), init=linear1_bias) var res = g.op(OP.DOT, x, l1_w) var out = g.op(OP.ADD, res, l1_b) g.out(out) var y_true = g.input(TensorShape(batch_size, n_outputs)) var loss = MSELoss(g, out, y_true) g.loss(loss) return g ^ fn run_mojo[ batch_size: Int, n_outputs: Int, linear1_weights: List[Scalar[dtype]], linear1_bias: List[Scalar[dtype]], ]( epochs: Int, learning_rate: Float64, inputs: Tensor[dtype], labels: Tensor[dtype], ) -> List[Scalar[dtype]]: alias graph = create_linear_regression( batch_size, n_outputs, linear1_weights, linear1_bias, ) var model = Model[graph]() var optim = optim.Adam[graph](Reference(model.parameters), lr=learning_rate) var losses = List[Scalar[dtype]]() for i in range(epochs): var loss = model.forward(inputs, labels) # Backward pass optim.zero_grad() model.backward() optim.step() losses.append(loss[0]) return losses fn run_torch( epochs: Int, learning_rate: Float64, inputs: Tensor, labels: Tensor, owned linear1_weights: Tensor, owned linear1_bias: Tensor, ) -> List[Scalar[dtype]]: var out: List[Scalar[dtype]] = List[Scalar[dtype]]() try: var torch = Python.import_module("torch") var F = Python.import_module("torch.nn.functional") var np = Python.import_module("numpy") Python.add_to_path("./tests/python") var torch_models = Python.import_module("test_models_torch") var inputs = torch.from_numpy(to_numpy(inputs)).requires_grad_(True) var labels = torch.from_numpy(to_numpy(labels)).requires_grad_(True) var linear1_weights = torch.from_numpy( to_numpy(linear1_weights) ).requires_grad_(True) var linear1_bias = torch.from_numpy(to_numpy(linear1_bias)).requires_grad_(True) var regression = torch_models.LinearRegression( linear1_weights, linear1_bias, ) var loss_func = torch_models.MSELoss() var optimizer = torch.optim.Adam(regression.parameters(), learning_rate) for i in range(epochs): var output = regression.forward(inputs) var loss = loss_func(output, labels) _ = optimizer.zero_grad() _ = loss.backward() _ = optimizer.step() out.append(to_tensor(loss)[0].cast[dtype]()) return out except e: print("Error importing torch") print(e) return out fn create_weights(num_elements: Int, zero: Bool) -> List[Scalar[dtype]]: var prng = MersenneTwister(123456) var weights = List[Scalar[dtype]](capacity=num_elements) for i in range(num_elements): if zero: weights.append(Scalar[dtype](0.0)) else: var rand_float = prng.next().cast[dtype]() / max_finite[DType.int32]().cast[ dtype ]() weights.append(Scalar[dtype](rand_float / 10)) return weights ^ fn dv_to_tensor(dv: List[Scalar[dtype]], shape: TensorShape) -> Tensor[dtype]: var t = Tensor[dtype](shape) if t.num_elements() != len(dv): print("[WARNING] tensor and dv not the shame shape") for i in range(t.num_elements()): t[i] = dv[i] return t ^ fn main(): alias learning_rate = 1e-3 alias epochs = 100 alias batch_size = 64 alias n_outputs = 10 var inputs = Tensor[dtype](batch_size, 13) rand[dtype](inputs.data(), inputs.num_elements()) var labels = Tensor[dtype](batch_size, n_outputs) for i in range(batch_size): for j in range(n_outputs): labels[i * n_outputs + j] = 1 alias l1_w_shape = TensorShape(13, n_outputs) alias linear1_weights = create_weights(l1_w_shape.num_elements(), zero=False) alias l1_b_shape = TensorShape(n_outputs) alias linear1_bias = create_weights(l1_b_shape.num_elements(), zero=False) var losses_mojo = run_mojo[batch_size, n_outputs, linear1_weights, linear1_bias,]( epochs, learning_rate, inputs, labels, ) var losses_torch = run_torch( epochs, learning_rate, inputs, labels, dv_to_tensor(linear1_weights, l1_w_shape), dv_to_tensor(linear1_bias, l1_b_shape), ) var success = True for i in range(epochs): var loss_mojo = losses_mojo[i] var loss_torch = losses_torch[i] # print("loss_mojo: ", loss_mojo, " loss_torch: ", loss_torch) try: assert_almost_equal(loss_mojo, loss_torch, rtol=1e-4) except e: print("Losses not equal") print(e) success = False break if success: print("SUCCES: All losses in Linear Regression model are equal.") --- tests/python/test_models_sin_estimate.mojo --- from random import rand from python import Python from utils.numerics import max_finite from testing import assert_almost_equal from basalt import dtype from basalt.autograd import Graph, OP from basalt.nn import Tensor, TensorShape, Model, ReLU, MSELoss, optim from basalt.utils.rand_utils import MersenneTwister from tests import to_numpy, to_tensor fn create_simple_nn( batch_size: Int, linear1_weights: List[Scalar[dtype]], linear1_bias: List[Scalar[dtype]], linear2_weights: List[Scalar[dtype]], linear2_bias: List[Scalar[dtype]], linear3_weights: List[Scalar[dtype]], linear3_bias: List[Scalar[dtype]], ) -> Graph: var g = Graph() var x = g.input(TensorShape(batch_size, 1)) var y_true = g.input(TensorShape(batch_size, 1)) # Linear 1: nn.Linear(g, x, n_outputs=32) var l1_w = g.param(TensorShape(1, 32), init=linear1_weights) var l1_b = g.param(TensorShape(32), init=linear1_bias) var res_1 = g.op(OP.DOT, x, l1_w) var x1 = g.op(OP.ADD, res_1, l1_b) # ReLU 1 var x2 = ReLU(g, x1) # Linear 2: nn.Linear(g, x2, n_outputs=32) var l2_w = g.param(TensorShape(32, 32), init=linear2_weights) var l2_b = g.param(TensorShape(32), init=linear2_bias) var res_2 = g.op(OP.DOT, x2, l2_w) var x3 = g.op(OP.ADD, res_2, l2_b) # ReLU 2 var x4 = ReLU(g, x3) # Linear 3: nn.Linear(g, x4, n_outputs=1) var l3_w = g.param(TensorShape(32, 1), init=linear3_weights) var l3_b = g.param(TensorShape(1), init=linear3_bias) var res_3 = g.op(OP.DOT, x4, l3_w) var y_pred = g.op(OP.ADD, res_3, l3_b) g.out(y_pred) var loss = MSELoss(g, y_pred, y_true) g.loss(loss) return g ^ fn run_mojo[ batch_size: Int, linear1_weights: List[Scalar[dtype]], linear1_bias: List[Scalar[dtype]], linear2_weights: List[Scalar[dtype]], linear2_bias: List[Scalar[dtype]], linear3_weights: List[Scalar[dtype]], linear3_bias: List[Scalar[dtype]], ]( epochs: Int, learning_rate: Float64, inputs: Tensor[dtype], labels: Tensor[dtype], ) -> List[Scalar[dtype]]: alias graph = create_simple_nn( batch_size, linear1_weights, linear1_bias, linear2_weights, linear2_bias, linear3_weights, linear3_bias, ) var model = Model[graph]() var optim = optim.Adam[graph](model.parameters, lr=learning_rate) var losses = List[Scalar[dtype]]() for i in range(epochs): var loss = model.forward(inputs, labels) # Backward pass optim.zero_grad() model.backward() optim.step() losses.append(loss[0]) return losses fn run_torch( epochs: Int, learning_rate: Float64, inputs: Tensor, labels: Tensor, owned linear1_weights: Tensor, owned linear1_bias: Tensor, owned linear2_weights: Tensor, owned linear2_bias: Tensor, owned linear3_weights: Tensor, owned linear3_bias: Tensor, ) -> List[Scalar[dtype]]: var out: List[Scalar[dtype]] = List[Scalar[dtype]]() try: var torch = Python.import_module("torch") var F = Python.import_module("torch.nn.functional") var np = Python.import_module("numpy") Python.add_to_path("./tests/python") var torch_models = Python.import_module("test_models_torch") var inputs = torch.from_numpy(to_numpy(inputs)).requires_grad_(True) var labels = torch.from_numpy(to_numpy(labels)).requires_grad_(True) var linear1_weights = torch.from_numpy( to_numpy(linear1_weights) ).requires_grad_(True) var linear1_bias = torch.from_numpy(to_numpy(linear1_bias)).requires_grad_(True) var linear2_weights = torch.from_numpy( to_numpy(linear2_weights) ).requires_grad_(True) var linear2_bias = torch.from_numpy(to_numpy(linear2_bias)).requires_grad_(True) var linear3_weights = torch.from_numpy( to_numpy(linear3_weights) ).requires_grad_(True) var linear3_bias = torch.from_numpy(to_numpy(linear3_bias)).requires_grad_(True) var regression = torch_models.SimpleNN( linear1_weights, linear1_bias, linear2_weights, linear2_bias, linear3_weights, linear3_bias, ) var loss_func = torch_models.MSELoss() var optimizer = torch.optim.Adam(regression.parameters(), learning_rate) for i in range(epochs): var output = regression.forward(inputs) var loss = loss_func(output, labels) _ = optimizer.zero_grad() _ = loss.backward() _ = optimizer.step() out.append(to_tensor(loss)[0].cast[dtype]()) return out except e: print("Error importing torch") print(e) return out fn create_weights(num_elements: Int, zero: Bool) -> List[Scalar[dtype]]: var prng = MersenneTwister(123456) var weights = List[Scalar[dtype]](capacity=num_elements) for i in range(num_elements): if zero: weights.append(Scalar[dtype](0.0)) else: var rand_float = prng.next().cast[dtype]() / max_finite[DType.int32]().cast[ dtype ]() weights.append(Scalar[dtype](rand_float / 10)) return weights ^ fn dv_to_tensor(dv: List[Scalar[dtype]], shape: TensorShape) -> Tensor[dtype]: var t = Tensor[dtype](shape) if t.num_elements() != len(dv): print("[WARNING] tensor and dv not the shame shape") for i in range(t.num_elements()): t[i] = dv[i] return t ^ fn main(): alias learning_rate = 1e-3 alias epochs = 100 alias batch_size = 64 alias n_outputs = 10 var x_data = Tensor[dtype](batch_size, 1) rand[dtype](x_data.data(), x_data.num_elements()) var y_data = Tensor[dtype](batch_size, 1) for j in range(batch_size): x_data[j] = x_data[j] * 2 - 1 y_data[j] = math.sin(x_data[j]) alias l1_w_shape = TensorShape(1, 32) alias l1_b_shape = TensorShape(32) alias l2_w_shape = TensorShape(32, 32) alias l2_b_shape = TensorShape(32) alias l3_w_shape = TensorShape(32, 1) alias l3_b_shape = TensorShape(1) alias linear1_weights = create_weights(l1_w_shape.num_elements(), zero=False) alias linear1_bias = create_weights(l1_b_shape.num_elements(), zero=False) alias linear2_weights = create_weights(l2_w_shape.num_elements(), zero=False) alias linear2_bias = create_weights(l2_b_shape.num_elements(), zero=False) alias linear3_weights = create_weights(l3_w_shape.num_elements(), zero=False) alias linear3_bias = create_weights(l3_b_shape.num_elements(), zero=False) var losses_mojo = run_mojo[ batch_size, linear1_weights, linear1_bias, linear2_weights, linear2_bias, linear3_weights, linear3_bias, ](epochs, learning_rate, x_data, y_data) var losses_torch = run_torch( epochs, learning_rate, x_data, y_data, dv_to_tensor(linear1_weights, l1_w_shape), dv_to_tensor(linear1_bias, l1_b_shape), dv_to_tensor(linear2_weights, l2_w_shape), dv_to_tensor(linear2_bias, l2_b_shape), dv_to_tensor(linear3_weights, l3_w_shape), dv_to_tensor(linear3_bias, l3_b_shape), ) var success = True for i in range(epochs): var loss_mojo = losses_mojo[i] var loss_torch = losses_torch[i] # print("loss_mojo: ", loss_mojo, " loss_torch: ", loss_torch) try: assert_almost_equal(loss_mojo, loss_torch, rtol=1e-4) except e: print("Losses not equal") print(e) success = False break if success: print("SUCCES: All losses in Sin estimate model are equal.") --- tests/python/test_models_torch.py --- import torch import torch.nn as nn import torch.nn.functional as F class LinearRegression(nn.Module): def __init__(self, linear1_weights, linear1_bias): super(LinearRegression, self).__init__() self.linear1_weights = nn.Parameter(linear1_weights) self.linear1_bias = nn.Parameter(linear1_bias) def forward(self, x): output = F.linear(x, self.linear1_weights.T, self.linear1_bias) return output class MSELoss(nn.Module): def __init__(self): super(MSELoss, self).__init__() def forward(self, output, target): loss = F.mse_loss(output, target) return loss class CrossEntropyLoss(nn.Module): def __init__(self): super(CrossEntropyLoss, self).__init__() def forward(self, output, target): loss = -torch.sum(target * torch.log(output)) / output.size(0) return loss # Implement the class for crossentropy loss with logsoftmax class CrossEntropyLoss2(nn.Module): def __init__(self): super(CrossEntropyLoss2, self).__init__() def forward(self, output, target): loss = -torch.sum(target * F.log_softmax(output, dim=1)) / output.size(0) return loss class CNN(nn.Module): def __init__( self, conv1_weights, conv1_bias, conv2_weights, conv2_bias, linear1_weights, linear1_bias, ): super(CNN, self).__init__() self.conv1_weights = nn.Parameter(conv1_weights) self.conv1_bias = nn.Parameter(conv1_bias) self.conv2_weights = nn.Parameter(conv2_weights) self.conv2_bias = nn.Parameter(conv2_bias) self.linear1_weights = nn.Parameter(linear1_weights) self.linear1_bias = nn.Parameter(linear1_bias) def forward(self, x): x = F.conv2d(x, self.conv1_weights, self.conv1_bias, stride=1, padding=2) x = F.relu(x) x = F.max_pool2d(x, 2) x = F.conv2d(x, self.conv2_weights, self.conv2_bias, stride=1, padding=2) x = F.relu(x) x = F.max_pool2d(x, 2) x = x.view(x.size(0), -1) output = F.linear(x, self.linear1_weights.T, self.linear1_bias) return output def print_grads(self): print("\nCONV1 WEIGHTS", self.conv1_weights.grad.shape) print(self.conv1_weights.grad) print("\nCONV1 BIAS", self.conv1_bias.grad.shape) print(self.conv1_bias.grad) print("\nCONV2 WEIGHTS", self.conv2_weights.grad.shape) print(self.conv2_weights.grad) print("\nCONV2 BIAS", self.conv2_bias.grad.shape) print(self.conv2_bias.grad) print("\nLINEAR1 WEIGHTS", self.linear1_weights.grad.shape) print(self.linear1_weights.grad) print("\nLINEAR1 BIAS", self.linear1_bias.grad.shape) print(self.linear1_bias.grad) class SimpleNN(nn.Module): def __init__( self, linear1_weights, linear1_bias, linear2_weights, linear2_bias, linear3_weights, linear3_bias, ): super(SimpleNN, self).__init__() self.linear1_weights = nn.Parameter(linear1_weights) self.linear1_bias = nn.Parameter(linear1_bias) self.linear2_weights = nn.Parameter(linear2_weights) self.linear2_bias = nn.Parameter(linear2_bias) self.linear3_weights = nn.Parameter(linear3_weights) self.linear3_bias = nn.Parameter(linear3_bias) self.relu1 = nn.ReLU() self.relu2 = nn.ReLU() def forward(self, x): x1 = F.linear(x, self.linear1_weights.T, self.linear1_bias) x2 = self.relu1(x1) x3 = F.linear(x2, self.linear2_weights.T, self.linear2_bias) x4 = self.relu2(x3) y_pred = F.linear(x4, self.linear3_weights.T, self.linear3_bias) return y_pred --- tests/python/test_ops_torch.mojo --- from random import rand from math import exp, log from python.python import Python from collections.optional import Optional from basalt import dtype, nelts from basalt.autograd import OP from basalt.autograd.attributes import Attribute, AttributeVector from basalt.nn import Tensor, TensorShape from tests import ( to_numpy, to_tensor, test_unary_op, test_binary_op, test_ternary_op, test_unary_op_backward, test_binary_op_backward, test_ternary_op_backward, ) # ------ Test Binary Ops ------ @value struct torch_output_binary_op: var expected: Tensor[dtype] var grad_1: Tensor[dtype] var grad_2: Tensor[dtype] fn torch_binary_op( op: OP, input_1: Tensor, input_2: Tensor, upper_grad: Tensor ) -> torch_output_binary_op: try: var torch = Python.import_module("torch") var np = Python.import_module("numpy") var input_1 = torch.from_numpy(to_numpy(input_1)).requires_grad_(True) var input_2 = torch.from_numpy(to_numpy(input_2)).requires_grad_(True) var expected: PythonObject if op == OP.ADD: expected = input_1 + input_2 elif op == OP.SUB: expected = input_1 - input_2 elif op == OP.MUL: expected = input_1 * input_2 elif op == OP.DIV: expected = input_1 / input_2 elif op == OP.DOT: expected = torch.matmul(input_1, input_2) else: print("Error: op not supported (returning the default add op result): ", op) expected = input_1 + input_2 # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) return torch_output_binary_op( to_tensor(expected.detach().numpy()), to_tensor(input_1.grad.numpy()), to_tensor(input_2.grad.numpy()), ) except e: print("Error importing torch: ", e) var d = Tensor[dtype](1) return torch_output_binary_op(d, d, d) fn test_ADD() raises: alias t1_shape = TensorShape(37, 63, 107) alias t2_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_binary_op(OP.ADD, t1, t2, ug) test_binary_op[OP.ADD, t1_shape, t2_shape](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.ADD, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # broadcasting alias t1_shape_2 = TensorShape(37, 63, 107) alias t2_shape_2 = TensorShape(37, 63, 1) alias ug_shape_2 = TensorShape(37, 63, 107) t1 = Tensor[dtype](t1_shape_2) t2 = Tensor[dtype](t2_shape_2) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_binary_op(OP.ADD, t1, t2, ug) test_binary_op[OP.ADD, t1_shape_2, t2_shape_2](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.ADD, t1_shape_2, t2_shape_2, ug_shape_2]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) fn test_SUB() raises: alias t1_shape = TensorShape(37, 63, 107) alias t2_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_binary_op(OP.SUB, t1, t2, ug) test_binary_op[OP.SUB, t1_shape, t2_shape](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.SUB, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # broadcasting alias t1_shape_2 = TensorShape(37, 63, 107) alias t2_shape_2 = TensorShape(37, 63, 1) alias ug_shape_2 = TensorShape(37, 63, 107) t1 = Tensor[dtype](t1_shape_2) t2 = Tensor[dtype](t2_shape_2) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_binary_op(OP.SUB, t1, t2, ug) test_binary_op[OP.SUB, t1_shape_2, t2_shape_2](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.SUB, t1_shape_2, t2_shape_2, ug_shape_2]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) fn test_MUL() raises: alias t1_shape = TensorShape(37, 63, 107) alias t2_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_binary_op(OP.MUL, t1, t2, ug) test_binary_op[OP.MUL, t1_shape, t2_shape](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.MUL, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # broadcasting alias t1_shape_2 = TensorShape(37, 63, 107) alias t2_shape_2 = TensorShape(37, 63, 1) alias ug_shape_2 = TensorShape(37, 63, 107) t1 = Tensor[dtype](t1_shape_2) t2 = Tensor[dtype](t2_shape_2) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_binary_op(OP.MUL, t1, t2, ug) test_binary_op[OP.MUL, t1_shape_2, t2_shape_2](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.MUL, t1_shape_2, t2_shape_2, ug_shape_2]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) fn test_DIV() raises: alias t1_shape = TensorShape(37, 63, 107) alias t2_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_binary_op(OP.DIV, t1, t2, ug) test_binary_op[OP.DIV, t1_shape, t2_shape](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.DIV, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # broadcasting alias t1_shape_2 = TensorShape(37, 63, 107) alias t2_shape_2 = TensorShape(37, 63, 1) alias ug_shape_2 = TensorShape(37, 63, 107) t1 = Tensor[dtype](t1_shape_2) t2 = Tensor[dtype](t2_shape_2) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_binary_op(OP.DIV, t1, t2, ug) test_binary_op[OP.DIV, t1_shape_2, t2_shape_2](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.DIV, t1_shape_2, t2_shape_2, ug_shape_2]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) alias t1_shape_3 = TensorShape(37, 63, 1) alias t2_shape_3 = TensorShape(37, 63, 107) alias ug_shape_3 = TensorShape(37, 63, 107) t1 = Tensor[dtype](t1_shape_3) t2 = Tensor[dtype](t2_shape_3) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) ug = Tensor[dtype](ug_shape_3) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_binary_op(OP.DIV, t1, t2, ug) test_binary_op[OP.DIV, t1_shape_3, t2_shape_3](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.DIV, t1_shape_3, t2_shape_3, ug_shape_3]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) fn test_DOT() raises: alias t1_shape = TensorShape(107, 203) alias t2_shape = TensorShape(203, 139) alias ug_shape = TensorShape(107, 139) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_binary_op(OP.DOT, t1, t2, ug) test_binary_op[OP.DOT, t1_shape, t2_shape](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.DOT, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # Test same M and N values alias t1_shape_2 = TensorShape(107, 186) alias t2_shape_2 = TensorShape(186, 107) alias ug_shape_2 = TensorShape(107, 107) t1 = Tensor[dtype](t1_shape_2) t2 = Tensor[dtype](t2_shape_2) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_binary_op(OP.DOT, t1, t2, ug) test_binary_op[OP.DOT, t1_shape_2, t2_shape_2](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.DOT, t1_shape_2, t2_shape_2, ug_shape_2]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # Test square matrix alias t1_shape_3 = TensorShape(207, 207) alias t2_shape_3 = TensorShape(207, 207) alias ug_shape_3 = TensorShape(207, 207) t1 = Tensor[dtype](t1_shape_3) t2 = Tensor[dtype](t2_shape_3) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) ug = Tensor[dtype](ug_shape_3) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_binary_op(OP.DOT, t1, t2, ug) test_binary_op[OP.DOT, t1_shape_3, t2_shape_3](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.DOT, t1_shape_3, t2_shape_3, ug_shape_3]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # Test with power of 2 values alias t1_shape_4 = TensorShape(64, 128) alias t2_shape_4 = TensorShape(128, 256) alias ug_shape_4 = TensorShape(64, 256) t1 = Tensor[dtype](t1_shape_4) t2 = Tensor[dtype](t2_shape_4) rand(t1.data(), t1.num_elements()) rand(t2.data(), t2.num_elements()) ug = Tensor[dtype](ug_shape_4) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_binary_op(OP.DOT, t1, t2, ug) test_binary_op[OP.DOT, t1_shape_4, t2_shape_4](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.DOT, t1_shape_4, t2_shape_4, ug_shape_4]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # ------ Test Unary Ops ------ @value struct torch_output_unary_op: var expected: Tensor[dtype] var grad_1: Tensor[dtype] fn torch_unary_op(op: OP, input_1: Tensor, upper_grad: Tensor) -> torch_output_unary_op: try: var torch = Python.import_module("torch") var np = Python.import_module("numpy") var input_1 = torch.from_numpy(to_numpy(input_1)).requires_grad_(True) var expected: PythonObject if op == OP.EXP: expected = torch.exp(input_1) elif op == OP.LOG: expected = torch.log(input_1) else: print("Error: op not supported (returning the value input_1): ", op) expected = input_1 # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) return torch_output_unary_op( to_tensor(expected.detach().numpy()), to_tensor(input_1.grad.numpy()), ) except: print("Error importing torch") var d = Tensor[dtype](1) return torch_output_unary_op(d, d) fn test_EXP() raises: alias t1_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_unary_op(OP.EXP, t1, ug) test_unary_op[OP.EXP, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.EXP, t1_shape, ug_shape](t1, ug, expected_and_grad.grad_1) fn test_LOG() raises: alias t1_shape = TensorShape(37, 63, 107) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_unary_op(OP.LOG, t1, ug) test_unary_op[OP.LOG, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.LOG, t1_shape, ug_shape](t1, ug, expected_and_grad.grad_1) # ------ Test POW ------ @value struct torch_output_pow_op: var expected: Tensor[dtype] var grad_1: Tensor[dtype] var grad_2: Tensor[dtype] fn torch_pow_op( op: OP, input_1: Tensor, input_2: Tensor, upper_grad: Tensor ) -> torch_output_pow_op: try: var torch = Python.import_module("torch") var np = Python.import_module("numpy") var input_1 = torch.from_numpy(to_numpy(input_1)).requires_grad_(True) var input_2 = torch.from_numpy(to_numpy(input_2)).requires_grad_(True) var expected: PythonObject if op == OP.POW: expected = torch.pow(input_1, input_2) else: print("Error: op not supported (returning input 1 value): ", op) expected = input_1 # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) return torch_output_pow_op( to_tensor(expected.detach().numpy()), to_tensor(input_1.grad.numpy()), to_tensor(input_2.grad.numpy()), ) except: print("Error importing torch") var d = Tensor[dtype](1) return torch_output_pow_op(d, d, d) fn test_POW() raises: alias t1_shape = TensorShape(37, 63, 107) alias t2_shape = TensorShape(1) alias ug_shape = TensorShape(37, 63, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) alias exponent = 3 var t2 = Tensor[dtype](1) t2[0] = exponent var expected_and_grad = torch_pow_op(OP.POW, t1, t2, ug) test_binary_op[OP.POW, t1_shape, t2_shape](t1, t2, expected_and_grad.expected) test_binary_op_backward[OP.POW, t1_shape, t2_shape, ug_shape]( t1, t2, ug, expected_and_grad.grad_1, expected_and_grad.grad_2 ) # ------ Test Reduction Ops ------ @value struct torch_output_reduction_op: var expected: Tensor[dtype] var grad_1: Tensor[dtype] fn torch_reduction_op( op: OP, input_1: Tensor, upper_grad: Tensor, axis: Optional[Int] = None ) -> torch_output_reduction_op: try: var torch = Python.import_module("torch") var np = Python.import_module("numpy") var input_1 = torch.from_numpy(to_numpy(input_1)).requires_grad_(True) var expected: PythonObject if op == OP.SUM: if axis: expected = torch.sum(input_1, axis.value()[], True) else: expected = torch.sum(input_1) elif op == OP.MAX: if axis: expected = torch.amax(input_1, axis.value()[], True) else: expected = torch.amax(input_1) elif op == OP.MEAN: if axis: expected = torch.mean(input_1, axis.value()[], True) else: expected = torch.mean(input_1) else: print("Error: op not supported (returning input 1 value): ", op) expected = input_1 # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) # because torch when working with a tensor of size 1, it considers it as a tensor of size 0 in reality if not axis: upper_grad = upper_grad.squeeze() _ = expected.backward(upper_grad) var expected_res: PythonObject var grad_1_res = input_1.grad.numpy() if not axis: expected_res = expected.detach().numpy().reshape(1) else: expected_res = expected.detach().numpy() return torch_output_reduction_op( to_tensor(expected_res), to_tensor(grad_1_res), ) except e: print("Error importing torch: ", e) var d = Tensor[dtype](1) return torch_output_reduction_op(d, d) fn test_SUM() raises: alias t1_shape = TensorShape(87, 73, 107) alias ug_shape = TensorShape(87, 1, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) # 1 axis alias axis = 1 alias attrs = AttributeVector(Attribute("axis", axis)) var expected_and_grad = torch_reduction_op(OP.SUM, t1, ug, axis) test_unary_op[OP.SUM, t1_shape, attrs](t1, expected_and_grad.expected) test_unary_op_backward[OP.SUM, t1_shape, ug_shape, attrs]( t1, ug, expected_and_grad.grad_1 ) # 2 axis alias ug_shape_2 = TensorShape(87, 73, 1) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) alias axis_2 = 2 alias attrs_2 = AttributeVector(Attribute("axis", axis_2)) expected_and_grad = torch_reduction_op(OP.SUM, t1, ug, axis_2) test_unary_op[OP.SUM, t1_shape, attrs_2](t1, expected_and_grad.expected) test_unary_op_backward[OP.SUM, t1_shape, ug_shape_2, attrs_2]( t1, ug, expected_and_grad.grad_1 ) # 0 axis alias ug_shape_3 = TensorShape(1, 73, 107) ug = Tensor[dtype](ug_shape_3) rand(ug.data(), ug.num_elements()) alias axis_3 = 0 alias attrs_3 = AttributeVector(Attribute("axis", axis_3)) expected_and_grad = torch_reduction_op(OP.SUM, t1, ug, axis_3) test_unary_op[OP.SUM, t1_shape, attrs_3](t1, expected_and_grad.expected) test_unary_op_backward[OP.SUM, t1_shape, ug_shape_3, attrs_3]( t1, ug, expected_and_grad.grad_1 ) # all dims alias ug_shape_4 = TensorShape(1) ug = Tensor[dtype](ug_shape_4) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_reduction_op(OP.SUM, t1, ug) test_unary_op[OP.SUM, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.SUM, t1_shape, ug_shape_4]( t1, ug, expected_and_grad.grad_1 ) fn test_MAX() raises: alias t1_shape = TensorShape(87, 73, 107) alias ug_shape = TensorShape(87, 1, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) # 1 axis alias axis = 1 alias attrs = AttributeVector(Attribute("axis", axis)) var expected_and_grad = torch_reduction_op(OP.MAX, t1, ug, axis) test_unary_op[OP.MAX, t1_shape, attrs](t1, expected_and_grad.expected) test_unary_op_backward[OP.MAX, t1_shape, ug_shape, attrs]( t1, ug, expected_and_grad.grad_1 ) # 2 axis alias ug_shape_2 = TensorShape(87, 73, 1) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) alias axis_2 = 2 alias attrs_2 = AttributeVector(Attribute("axis", axis_2)) expected_and_grad = torch_reduction_op(OP.MAX, t1, ug, axis_2) test_unary_op[OP.MAX, t1_shape, attrs_2](t1, expected_and_grad.expected) test_unary_op_backward[OP.MAX, t1_shape, ug_shape_2, attrs_2]( t1, ug, expected_and_grad.grad_1 ) # 0 axis alias ug_shape_3 = TensorShape(1, 73, 107) ug = Tensor[dtype](ug_shape_3) rand(ug.data(), ug.num_elements()) alias axis_3 = 0 alias attrs_3 = AttributeVector(Attribute("axis", axis_3)) expected_and_grad = torch_reduction_op(OP.MAX, t1, ug, axis_3) test_unary_op[OP.MAX, t1_shape, attrs_3](t1, expected_and_grad.expected) test_unary_op_backward[OP.MAX, t1_shape, ug_shape_3, attrs_3]( t1, ug, expected_and_grad.grad_1 ) # all dims alias ug_shape_4 = TensorShape(1) ug = Tensor[dtype](ug_shape_4) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_reduction_op(OP.MAX, t1, ug) test_unary_op[OP.MAX, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.MAX, t1_shape, ug_shape_4]( t1, ug, expected_and_grad.grad_1 ) fn test_MEAN() raises: alias t1_shape = TensorShape(87, 73, 107) alias ug_shape = TensorShape(87, 1, 107) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) # 1 axis alias axis = 1 alias attrs = AttributeVector(Attribute("axis", axis)) var expected_and_grad = torch_reduction_op(OP.MEAN, t1, ug, axis) test_unary_op[OP.MEAN, t1_shape, attrs](t1, expected_and_grad.expected) test_unary_op_backward[OP.MEAN, t1_shape, ug_shape, attrs]( t1, ug, expected_and_grad.grad_1 ) # 2 axis alias ug_shape_2 = TensorShape(87, 73, 1) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) alias axis_2 = 2 alias attrs_2 = AttributeVector(Attribute("axis", axis_2)) expected_and_grad = torch_reduction_op(OP.MEAN, t1, ug, axis_2) test_unary_op[OP.MEAN, t1_shape, attrs_2](t1, expected_and_grad.expected) test_unary_op_backward[OP.MEAN, t1_shape, ug_shape_2, attrs_2]( t1, ug, expected_and_grad.grad_1 ) # 0 axis alias ug_shape_3 = TensorShape(1, 73, 107) ug = Tensor[dtype](ug_shape_3) rand(ug.data(), ug.num_elements()) alias axis_3 = 0 alias attrs_3 = AttributeVector(Attribute("axis", axis_3)) expected_and_grad = torch_reduction_op(OP.MEAN, t1, ug, axis_3) test_unary_op[OP.MEAN, t1_shape, attrs_3](t1, expected_and_grad.expected) test_unary_op_backward[OP.MEAN, t1_shape, ug_shape_3, attrs_3]( t1, ug, expected_and_grad.grad_1 ) # all dims alias ug_shape_4 = TensorShape(1) ug = Tensor[dtype](ug_shape_4) rand(ug.data(), ug.num_elements()) expected_and_grad = torch_reduction_op(OP.MEAN, t1, ug) test_unary_op[OP.MEAN, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.MEAN, t1_shape, ug_shape_4]( t1, ug, expected_and_grad.grad_1 ) # ------ Test transformation Ops ------ @value struct torch_output_transform_op: var expected: Tensor[dtype] var grad_1: Tensor[dtype] fn torch_transform_op( op: OP, input_1: Tensor, upper_grad: Tensor, new_shape: PythonObject = None ) -> torch_output_transform_op: try: var torch = Python.import_module("torch") var np = Python.import_module("numpy") var input_1 = torch.from_numpy(to_numpy(input_1)).requires_grad_(True) var expected: PythonObject if op == OP.FLATTEN: expected = input_1.flatten() elif op == OP.RESHAPE: expected = input_1.reshape(new_shape) elif op == OP.TRANSPOSE: expected = input_1.permute(new_shape) else: print("Error: op not supported (returning input 1 value): ", op) expected = input_1 # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) return torch_output_transform_op( to_tensor(expected.detach().numpy()), to_tensor(input_1.grad.numpy()), ) except e: print("Error importing torch: ", e) var d = Tensor[dtype](1) return torch_output_transform_op(d, d) fn test_FLATTEN() raises: alias t1_shape = TensorShape(87, 73, 84) alias ug_shape = TensorShape(t1_shape.num_elements()) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) var expected_and_grad = torch_transform_op(OP.FLATTEN, t1, ug, None) test_unary_op[OP.FLATTEN, t1_shape](t1, expected_and_grad.expected) test_unary_op_backward[OP.FLATTEN, t1_shape, ug_shape]( t1, ug, expected_and_grad.grad_1 ) fn test_RESHAPE() raises: alias t1_shape = TensorShape(87, 73, 84) alias ug_shape = TensorShape(87, 73 * 84) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) alias new_shape = TensorShape(87, 73 * 84) alias new_shape_tuple = (new_shape[0], new_shape[1]) alias attrs = AttributeVector(Attribute("shape", new_shape)) var expected_and_grad = torch_transform_op(OP.RESHAPE, t1, ug, new_shape_tuple) test_unary_op[OP.RESHAPE, t1_shape, attrs](t1, expected_and_grad.expected) test_unary_op_backward[OP.RESHAPE, t1_shape, ug_shape, attrs]( t1, ug, expected_and_grad.grad_1 ) fn test_TRANSPOSE() raises: alias t1_shape = TensorShape(87, 73, 84) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) alias ug_shape = TensorShape(73, 84, 87) var ug = Tensor[dtype](ug_shape) rand(ug.data(), ug.num_elements()) alias axes = TensorShape(1, 2, 0) alias axes_tuple = (axes[0], axes[1], axes[2]) alias attrs = AttributeVector(Attribute("axes", axes)) var expected_and_grad = torch_transform_op(OP.TRANSPOSE, t1, ug, axes_tuple) test_unary_op[OP.TRANSPOSE, t1_shape, attrs](t1, expected_and_grad.expected) test_unary_op_backward[OP.TRANSPOSE, t1_shape, ug_shape, attrs]( t1, ug, expected_and_grad.grad_1 ) # Test reverse axis alias ug_shape_2 = TensorShape(84, 73, 87) ug = Tensor[dtype](ug_shape_2) rand(ug.data(), ug.num_elements()) alias axes_2 = TensorShape(2, 1, 0) alias axes_tuple_2 = (axes_2[0], axes_2[1], axes_2[2]) alias attrs_2 = AttributeVector(Attribute("axes", axes_2)) expected_and_grad = torch_transform_op(OP.TRANSPOSE, t1, ug, axes_tuple_2) test_unary_op[OP.TRANSPOSE, t1_shape, attrs_2](t1, expected_and_grad.expected) test_unary_op_backward[OP.TRANSPOSE, t1_shape, ug_shape_2, attrs_2]( t1, ug, expected_and_grad.grad_1 ) # Test with rank 2 tensor alias t1_shape_3 = TensorShape(87, 73) t1 = Tensor[dtype](t1_shape_3) rand(t1.data(), t1.num_elements()) alias ug_shape_3 = TensorShape(73, 87) ug = Tensor[dtype](ug_shape_3) rand(ug.data(), ug.num_elements()) alias axes_3 = TensorShape(1, 0) alias axes_tuple_3 = (axes_3[0], axes_3[1]) alias attrs_3 = AttributeVector(Attribute("axes", axes_3)) expected_and_grad = torch_transform_op(OP.TRANSPOSE, t1, ug, axes_tuple_3) test_unary_op[OP.TRANSPOSE, t1_shape_3, attrs_3](t1, expected_and_grad.expected) test_unary_op_backward[OP.TRANSPOSE, t1_shape_3, ug_shape_3, attrs_3]( t1, ug, expected_and_grad.grad_1 ) # ------ Test ternary Ops ------ @value struct torch_output_ternary_op: var expected: Tensor[dtype] var grad_1: Tensor[dtype] var grad_2: Tensor[dtype] var grad_3: Tensor[dtype] fn torch_ternary_op( op: OP, input_1: Tensor, input_2: Tensor, input_3: Tensor, upper_grad: Tensor ) -> torch_output_ternary_op: try: var torch = Python.import_module("torch") var np = Python.import_module("numpy") var input_1 = torch.from_numpy(to_numpy(input_1)).requires_grad_(True) var input_2 = torch.from_numpy(to_numpy(input_2)).requires_grad_(True) var input_3 = torch.from_numpy(to_numpy(input_3)).requires_grad_(True) var expected: PythonObject if op == OP.FMA: expected = input_1 * input_2 + input_3 else: print("Error: op not supported (returning input 1 value): ", op) expected = input_1 # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) return torch_output_ternary_op( to_tensor(expected.detach().numpy()), to_tensor(input_1.grad.numpy()), to_tensor(input_2.grad.numpy()), to_tensor(input_3.grad.numpy()), ) except e: print("Error importing torch: ", e) var d = Tensor[dtype](1) return torch_output_ternary_op(d, d, d, d) fn test_FMA() raises: alias t1_shape = TensorShape(87, 73, 84) alias t2_shape = TensorShape(87, 73, 84) alias t3_shape = TensorShape(87, 73, 84) var t1: Tensor[dtype] = Tensor[dtype](t1_shape) rand(t1.data(), t1.num_elements()) var t2: Tensor[dtype] = Tensor[dtype](t2_shape) rand(t2.data(), t2.num_elements()) var t3: Tensor[dtype] = Tensor[dtype](t3_shape) rand(t3.data(), t3.num_elements()) var expected_and_grad = torch_ternary_op(OP.FMA, t1, t2, t3, t1) test_ternary_op[OP.FMA, t1_shape, t2_shape, t3_shape]( t1, t2, t3, expected_and_grad.expected ) test_ternary_op_backward[OP.FMA, t1_shape, t2_shape, t3_shape, t1_shape]( t1, t2, t3, t1, expected_and_grad.grad_1, expected_and_grad.grad_2, expected_and_grad.grad_3, ) fn main(): print("Running ops (compare with torch) tests") try: test_ADD() test_SUB() test_MUL() test_DIV() test_DOT() test_EXP() test_LOG() test_POW() test_SUM() test_MAX() test_MEAN() test_FLATTEN() test_RESHAPE() test_TRANSPOSE() test_FMA() except e: print("[ERROR] Error in ops (compare with torch)") print(e) return print("Finished ops (compare with torch) tests") --- tests/python/test_pool.mojo --- from random import rand from python.python import Python from testing import assert_equal from basalt import dtype, nelts from basalt.autograd import Graph, OP from basalt.autograd.ops.pool import MAXPOOL2D from basalt.autograd.ops.conv import get_result_shape from basalt.autograd.attributes import Attribute, AttributeVector from basalt.nn import Tensor, TensorShape, Model from tests import assert_tensors_equal, to_numpy, to_tensor @value struct torch_maxpool2d_output: var expected: Tensor[dtype] var expected_grad: Tensor[dtype] fn torch_maxpool2d( inputs: Tensor, kernel_size: StaticIntTuple[2], padding: StaticIntTuple[2], stride: StaticIntTuple[2], dilation: StaticIntTuple[2], upper_grad: Tensor, ) -> torch_maxpool2d_output: var out: torch_maxpool2d_output try: var torch = Python.import_module("torch") var F = Python.import_module("torch.nn.functional") var np = Python.import_module("numpy") var inputs = torch.from_numpy(to_numpy(inputs)).requires_grad_(True) var expected = F.max_pool2d( inputs, (kernel_size[0], kernel_size[1]), (stride[0], stride[1]), (padding[0], padding[1]), (dilation[0], dilation[1]), ) # uppergrad & backwards var upper_grad = torch.from_numpy(to_numpy(upper_grad)) _ = expected.backward(upper_grad) # expected out = torch_maxpool2d_output( to_tensor(expected.detach().numpy()), to_tensor(inputs.grad.numpy()) ) return out except: print("Error in torch_maxpool2d") var d = Tensor[dtype](1) var out = torch_maxpool2d_output(d, d) return out fn test_pool_forward[ input_shape: TensorShape, kernel_size: StaticIntTuple[2], padding: StaticIntTuple[2], stride: StaticIntTuple[2], dilation: StaticIntTuple[2], ](inputs: Tensor[dtype]) raises: fn create_graph() -> Graph: var g = Graph() var inp = g.input(input_shape) var res = g.op( OP.MAXPOOL2D, inp, attributes=AttributeVector( Attribute("kernel_size", kernel_size), Attribute("padding", padding), Attribute("stride", stride), Attribute("dilation", dilation), ), ) g.out(res) return g ^ alias graph = create_graph() assert_equal(len(graph.nodes), 1) var model = Model[graph](inference_only=True) var res = model.inference(inputs)[0] var torch_out = torch_maxpool2d( inputs, kernel_size=kernel_size, padding=padding, stride=stride, dilation=dilation, upper_grad=Tensor[dtype](res.shape()), ) assert_tensors_equal(res, torch_out.expected) fn test_forward_1() raises: # padding=2, stride=1, dilation=1 # input shape: (4, 1, 28, 28) kernel size: (5, 5) alias kernel_size = 5 alias padding = 2 alias stride = 1 alias dilation = 1 alias input_shape = TensorShape(4, 1, 28, 28) var inputs = Tensor[dtype](input_shape) rand[dtype](inputs.data(), inputs.num_elements()) test_pool_forward[input_shape, kernel_size, padding, stride, dilation](inputs) fn test_forward_2() raises: # padding=0, stride=1, dilation=1 # input shape: (4, 1, 32, 17) kernel size: (2, 2) alias kernel_size = StaticIntTuple[2](2, 2) alias padding = 0 alias stride = 1 alias dilation = 1 alias input_shape = TensorShape(4, 1, 32, 17) var inputs = Tensor[dtype](input_shape) rand[dtype](inputs.data(), inputs.num_elements()) test_pool_forward[input_shape, kernel_size, padding, stride, dilation](inputs) fn test_forward_3() raises: # padding=(3, 1), stride=(2, 3), dilation=(2, 3) # input shape: (4, 3, 32, 17) kernel size: (6, 6) alias kernel_size = StaticIntTuple[2](6, 6) alias padding = StaticIntTuple[2](3, 1) alias stride = StaticIntTuple[2](2, 3) alias dilation = StaticIntTuple[2](2, 3) alias input_shape = TensorShape(4, 3, 32, 17) var inputs = Tensor[dtype](input_shape) rand[dtype](inputs.data(), inputs.num_elements()) test_pool_forward[input_shape, kernel_size, padding, stride, dilation](inputs) fn test_pool_backward[ ug_shape: TensorShape, input_shape: TensorShape, kernel_size: StaticIntTuple[2], padding: StaticIntTuple[2], stride: StaticIntTuple[2], dilation: StaticIntTuple[2], ](ug: Tensor[dtype], inputs: Tensor[dtype]) raises: alias attributes = AttributeVector( Attribute("kernel_size", kernel_size), Attribute("padding", padding), Attribute("stride", stride), Attribute("dilation", dilation), ) var grad = MAXPOOL2D.backward[ug_shape, input_shape, attributes](ug, inputs) var torch_out = torch_maxpool2d( inputs, kernel_size=kernel_size, padding=padding, stride=stride, dilation=dilation, upper_grad=ug, ) assert_tensors_equal["almost"](grad, torch_out.expected_grad) fn test_backward_1() raises: # padding=2, stride=1, dilation=1 # input shape: (4, 1, 28, 28) kernel size: (5, 5) alias kernel_size = 5 alias padding = 2 alias stride = 1 alias dilation = 1 alias input_shape = TensorShape(4, 1, 28, 28) var inputs = Tensor[dtype](input_shape) rand[dtype](inputs.data(), inputs.num_elements()) # uppergrad alias res = get_result_shape( input_shape, TensorShape(kernel_size, kernel_size), padding, stride, dilation ) alias ug_shape = TensorShape(input_shape[0], input_shape[1], res[0], res[1]) var ug = Tensor[dtype](ug_shape) rand[dtype](ug.data(), ug.num_elements()) test_pool_backward[ug_shape, input_shape, kernel_size, padding, stride, dilation]( ug, inputs ) fn test_backward_2() raises: # padding=0, stride=1, dilation=1 # input shape: (4, 1, 32, 17) kernel size: (2, 2) alias kernel_size = 2 alias padding = 0 alias stride = 1 alias dilation = 1 alias input_shape = TensorShape(4, 1, 32, 17) var inputs = Tensor[dtype](input_shape) rand[dtype](inputs.data(), inputs.num_elements()) # uppergrad alias res = get_result_shape( input_shape, TensorShape(kernel_size, kernel_size), padding, stride, dilation ) alias ug_shape = TensorShape(input_shape[0], input_shape[1], res[0], res[1]) var ug = Tensor[dtype](ug_shape) rand[dtype](ug.data(), ug.num_elements()) test_pool_backward[ug_shape, input_shape, kernel_size, padding, stride, dilation]( ug, inputs ) fn test_backward_3() raises: # padding=(3, 1), stride=(2, 3), dilation=(2, 3) # input shape: (4, 3, 32, 17) kernel size: (6, 6) alias kernel_size = StaticIntTuple[2](6, 6) alias padding = StaticIntTuple[2](3, 1) alias stride = StaticIntTuple[2](2, 3) alias dilation = StaticIntTuple[2](2, 3) alias input_shape = TensorShape(4, 3, 32, 17) var inputs = Tensor[dtype](input_shape) rand[dtype](inputs.data(), inputs.num_elements()) # uppergrad alias kernel_size_static: StaticIntTuple[2] = kernel_size alias res = get_result_shape( input_shape, TensorShape(kernel_size_static), padding, stride, dilation ) alias ug_shape = TensorShape(input_shape[0], input_shape[1], res[0], res[1]) var ug = Tensor[dtype](ug_shape) rand[dtype](ug.data(), ug.num_elements()) test_pool_backward[ug_shape, input_shape, kernel_size, padding, stride, dilation]( ug, inputs ) fn main(): try: test_forward_1() test_forward_2() test_forward_3() test_backward_1() test_backward_2() test_backward_3() except e: print("[Error] Error in MaxPool2D") print(e) --- tests/testing_utils.mojo --- from python.python import Python from collections import OptionalReg from testing import assert_equal, assert_almost_equal from basalt import dtype from basalt.autograd import Graph, OP from basalt.autograd.ops.ops import backward_op from basalt.autograd.attributes import AttributeVector from basalt.nn import Tensor, TensorShape, Model from basalt.utils.tensor_creation_utils import to_numpy, to_tensor # The below regex should be used to convert deprecated calls # assert_tensors_equal\(([^,]+),\s*([^,]+),\s*"([^"]+)"\) # assert_tensors_equal["$3"]($1, $2) fn assert_tensors_equal[ mode: String = "exact", msg: String = "Error" ](t1: Tensor[dtype], t2: Tensor[dtype]) raises: constrained[ mode == "exact" or mode == "almost", "Mode must be either 'exact' or 'almost'" ]() assert_equal(t1.shape(), t2.shape(), "Tensor shape mismatch") for i in range(t1.num_elements()): if mode == "almost": assert_almost_equal(t1[i], t2[i], rtol=1e-5, atol=1e-5, msg=msg) else: assert_equal(t1[i], t2[i], msg=msg) fn test_unary_op[ op: OP, t1_shape: TensorShape, attrs: OptionalReg[AttributeVector] = None ](t1: Tensor[dtype], expected: Tensor[dtype]) raises: fn create_graph() -> Graph: var g = Graph() var t1 = g.input(t1_shape) if attrs: var res = g.op(op, t1, attributes=attrs.value()) g.out(res) return g ^ else: var res = g.op(op, t1) g.out(res) return g ^ alias graph = create_graph() assert_equal(len(graph.nodes), 1) var model = Model[graph](inference_only=True) var res = model.inference(t1)[0] assert_tensors_equal["almost"](res, expected) fn test_binary_op[ op: OP, t1_shape: TensorShape, t2_shape: TensorShape, attrs: OptionalReg[AttributeVector] = None, ](t1: Tensor[dtype], t2: Tensor[dtype], expected: Tensor[dtype]) raises: fn create_graph() -> Graph: var g = Graph() var t1 = g.input(t1_shape) var t2 = g.input(t2_shape) if attrs: var res = g.op(op, t1, t2, attributes=attrs.value()) g.out(res) return g ^ else: var res = g.op(op, t1, t2) g.out(res) return g ^ alias graph = create_graph() assert_equal(len(graph.nodes), 1) var model = Model[graph](inference_only=True) var res = model.inference(t1, t2)[0] assert_tensors_equal["almost"](res, expected) fn test_ternary_op[ op: OP, t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape ]( t1: Tensor[dtype], t2: Tensor[dtype], t3: Tensor[dtype], expected: Tensor[dtype] ) raises: @parameter fn create_graph() -> Graph: var g = Graph() var t1 = g.input(t1_shape) var t2 = g.input(t2_shape) var t3 = g.input(t3_shape) var res = g.op(op, t1, t2, t3) g.out(res) return g ^ alias graph = create_graph() assert_equal(len(graph.nodes), 1) var model = Model[graph](inference_only=True) var res = model.inference(t1, t2, t3)[0] assert_tensors_equal["almost"](res, expected) fn test_unary_op_backward[ op: OP, t1_shape: TensorShape, ug_shape: TensorShape, attrs: AttributeVector = AttributeVector(), ](t1: Tensor[dtype], ug: Tensor[dtype], grad_1_expected: Tensor[dtype],) raises: var grad_1 = Tensor[dtype](t1_shape) backward_op[0, op, ug_shape, t1_shape, attrs](ug, t1, grad_1) assert_tensors_equal["almost"](grad_1, grad_1_expected) fn test_binary_op_backward[ op: OP, t1_shape: TensorShape, t2_shape: TensorShape, ug_shape: TensorShape, attrs: AttributeVector = AttributeVector(), ]( t1: Tensor[dtype], t2: Tensor[dtype], ug: Tensor[dtype], grad_1_expected: Tensor[dtype], grad_2_expected: Tensor[dtype], ) raises: var grad_1 = Tensor[dtype](t1_shape) backward_op[0, op, ug_shape, t1_shape, t2_shape, attrs](ug, t1, t2, grad_1) assert_tensors_equal["almost"](grad_1, grad_1_expected) var grad_2 = Tensor[dtype](t2_shape) backward_op[1, op, ug_shape, t1_shape, t2_shape, attrs](ug, t1, t2, grad_2) assert_tensors_equal["almost"](grad_2, grad_2_expected) fn test_ternary_op_backward[ op: OP, t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape, ug_shape: TensorShape, attrs: AttributeVector = AttributeVector(), ]( t1: Tensor[dtype], t2: Tensor[dtype], t3: Tensor[dtype], ug: Tensor[dtype], grad_1_expected: Tensor[dtype], grad_2_expected: Tensor[dtype], grad_3_expected: Tensor[dtype], ) raises: var grad_1 = Tensor[dtype](t1_shape) backward_op[0, op, ug_shape, t1_shape, t2_shape, t3_shape, attrs]( ug, t1, t2, t3, grad_1 ) assert_tensors_equal["almost"](grad_1, grad_1_expected) var grad_2 = Tensor[dtype](t2_shape) backward_op[1, op, ug_shape, t1_shape, t2_shape, t3_shape, attrs]( ug, t1, t2, t3, grad_2 ) assert_tensors_equal["almost"](grad_2, grad_2_expected) var grad_3 = Tensor[dtype](t3_shape) backward_op[2, op, ug_shape, t1_shape, t2_shape, t3_shape, attrs]( ug, t1, t2, t3, grad_3 ) assert_tensors_equal["almost"](grad_3, grad_3_expected) fn create_graph_concat( t1_shape: TensorShape, t2_shape: TensorShape, t3_shape: TensorShape, dim: Int ) -> Graph: # Testing with 3 operands var g = Graph() var t1 = g.input(t1_shape, trainable=True) var t2 = g.input(t2_shape, trainable=True) var t3 = g.input(t3_shape, trainable=True) var res = g.concat(t1, t2, t3, dim=dim) g.out(res) g.loss(res) return g ^ fn create_graph_split(t_shape: TensorShape, sections: List[Int], dim: Int) -> Graph: var g = Graph() var t = g.input(t_shape, trainable=True) var results = g.split(t, sections=sections, dim=dim) for i in range(len(sections)): g.out(results[i]) g.loss(results[0]) # Any one return g ^ --- main.🔥 --- from mowav.audio import read_audio fn main(): try: print(read_audio("test.wav")) except e: print("Error: ", e) --- mowav/__init__.mojo --- --- mowav/audio.mojo --- from tensor import Tensor, TensorSpec, TensorShape from utils.index import Index from .reader import file_byte_reader, decode_single_byte from pathlib import Path struct AudioSpec: var format_tag: Int var num_channels: Int var fs: Int var bytes_per_second: Int var block_align: Int var bit_depths: Int fn __init__(inout self, format_tag: Int, num_channels: Int, fs: Int, bytes_per_second: Int, block_align: Int, bit_depths: Int): self.format_tag = format_tag self.num_channels = num_channels self.fs = fs self.bytes_per_second = bytes_per_second self.block_align = block_align self.bit_depths = bit_depths fn __str__(self) -> String: return "Sample Rate: " + str(self.fs) fn _read_fmt_chunk(inout file: file_byte_reader) raises -> AudioSpec: let size_of_fmt = file.read_number(4) var bytes_read = 0 if size_of_fmt < 16: raise Error("Size of fmt chunk is not 16 bytes long.") let format_tag = file.read_number(2) let num_channels = file.read_number(2) let fs = file.read_number(4) let bytes_per_second = file.read_number(4) let block_align = file.read_number(2) let bit_depths = file.read_number(2) bytes_read += 16 if format_tag != 1 and format_tag != 3: raise Error("This file is not PCM or IEEE float format. Only PCM, IEEE format is supported.") if size_of_fmt > bytes_read: file.read_none(size_of_fmt - bytes_read) return AudioSpec(format_tag, num_channels, fs, bytes_per_second, block_align, bit_depths) fn _skip_unknown_chunk(inout file: file_byte_reader) raises: let chunk_size = file.read_number(4) file.read_none(chunk_size) fn _read_data_chunk(inout file: file_byte_reader, audio_info:AudioSpec, is_big_endian:Bool) raises: let chunk_size = file.read_number(4) let fmt = ">" if is_big_endian else "<" let bytes_per_sample:Int = audio_info.block_align // audio_info.num_channels let n_samples:Int = chunk_size // bytes_per_sample if audio_info.format_tag == 1: # PCM if audio_info.bit_depths >= 1 and audio_info.bit_depths <=8: let dtype = "u1" elif bytes_per_sample == 3 or bytes_per_sample == 5 or bytes_per_sample == 6 or bytes_per_sample == 7: let dtype = "V1" elif audio_info.bit_depths <= 64: let dtype = str(fmt)+"i"+str(bytes_per_sample) else: raise Error("Unspported bit depths. the WAV file has "+ str(audio_info.bit_depths) + " bits per sample.") elif audio_info.format_tag == 3: # IEEE float if audio_info.bit_depths == 32 or audio_info.bit_depths == 64: let dtype = "f"+str(bytes_per_sample) else: raise Error("Unspported bit depths. the WAV file has "+ str(audio_info.bit_depths) + " bits per sample.") else: raise Error("This file is not PCM or IEEE float format. Only PCM, IEEE format is supported.") ## TODO: Make Audio to a Tensor # file.read_number(4) -> can be used to read a single sample fn read_audio(path: String) raises: var file = file_byte_reader(path) let str1:String = file.read_text(4) if str1 != "RIFF" and str1 != "RIFX": raise Error("This file is not RIFF or RIFX format. It is not supported.") let is_big_endian:Bool = False if str1 == "RIFF" else True let filesize:Int = file.read_number(4) + 8 let audio_format:String = file.read_text(4) var data_chunk_recieved = False var fmt_chunk_recieved = False var chunk_id:String = "" while file.current_index < filesize: chunk_id = file.read_text(4) if chunk_id != "fmt ": _skip_unknown_chunk(file) else: break if file.current_index >= filesize: raise Error("fmt chunk is not found.") fmt_chunk_recieved = True let audiospec = _read_fmt_chunk(file) print("format_tag: ", audiospec.format_tag) print("num_channels: ", audiospec.num_channels) print("fs: ", audiospec.fs) print("bytes_per_second: ", audiospec.bytes_per_second) print("block_align: ", audiospec.block_align) print("bit_depths: ", audiospec.bit_depths) while file.current_index < filesize: let chunk_id = file.read_text(4) if len(chunk_id) != 4: raise Error("Chunk ID must be 4 bytes long.") if chunk_id == "fact": _skip_unknown_chunk(file) elif chunk_id == "LIST": _skip_unknown_chunk(file) elif chunk_id == "JUNK": _skip_unknown_chunk(file) elif chunk_id == "Fake": _skip_unknown_chunk(file) elif chunk_id == "data": data_chunk_recieved = True # let audio = _read_data_chunk(file, audiospec) _read_data_chunk(file, audiospec, is_big_endian) break else: print("Unknown chunk ID: " + chunk_id+ ". Skipping chunk.") _skip_unknown_chunk(file) --- mowav/format.mojo --- --- mowav/reader.mojo --- from .sign import Byte4Tensor, Byte2Tensor alias si8 = DType.int8 alias ui8 = DType.uint8 struct file_byte_reader: var current_index: Int var file : FileHandle fn __init__(inout self, path:String) raises: self.file = open(path, "rb") self.current_index = 0 fn read_text(inout self, num_bytes: Int) raises -> String: let bytes = self.file.read_bytes(num_bytes) self.current_index += num_bytes return Byte4Tensor(bytes).get_text() fn read_number(inout self, num_bytes: Int) raises -> Int: let bytes = self.file.read_bytes(num_bytes) self.current_index += num_bytes return Byte4Tensor(bytes).get_number() fn read_number2(inout self, num_bytes: Int) raises -> String: let bytes = self.file.read_bytes(num_bytes) self.current_index += num_bytes # print(Byte4Tensor(bytes)[3]/128*-1 + Byte4Tensor(bytes)[2]/(128*128) + Byte4Tensor(bytes)[1]/(128*128*128) + Byte4Tensor(bytes)[0]/(128*128*128*128) + 1) # print(Byte4Tensor(bytes)[3]) # print(Byte4Tensor(bytes)[2]) # print(Byte4Tensor(bytes)[1]) # print(Byte4Tensor(bytes)[0]) return Byte4Tensor(bytes).get_number() fn read_str(inout self, num_bytes: Int) raises -> String: let bytes = self.file.read_bytes(num_bytes) self.current_index += num_bytes return Byte4Tensor(bytes).__str__() fn read_none(inout self, num_bytes: Int) raises: let file = self.file.read_bytes(num_bytes) self.current_index += num_bytes fn read_byte_one(inout self) raises -> Int: let bytes = self.file.read_bytes(1) self.current_index += 1 return decode_single_byte(bytes) fn decode_single_byte(data: Tensor[si8]) -> Int: if data[0] >= 0: return int(data[0]) else: return 256+int(data[0]) --- mowav/sign.mojo --- alias si8 = DType.int8 alias ui8 = DType.uint8 # 0 ~ 31 : non-printable mark alias non_printable_mark = VariadicList("<NULL>", "<SOH>", "<STX>", "<ETX>", "<EOT>", "<ENQ>", "<ACK>", "<BEL>", "<BS>", "<HT>", "<LF>", "<VT>", "<FF>", "<CR>", "<SO>", "<SI>", "<DLE>", "<DC1>", "<DC2>", "<DC3>", "<DC4>", "<NAK>", "<SYN>", "<ETB>", "<CAN>", "<EM>", "<SUB>", "<ESC>", "<FS>", "<GS>", "<RS>", "<US>") # 32 ~ 126 : printable mark alias positive_printable_mark = VariadicList(" ", "!", '"', "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "<BS>", "]", "^", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "<DEL>") # 127 ~ 255 : negative printable mark alias negative_printable_mark = VariadicList("€", "<unused>", "‚", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹", "Œ", "<unused>", "Ž", "<unused>", "<unused>", "‘", "’", "“", "”", "•", "–", "—", "˜", "™", "š", "›", "œ", "<unused>", "ž", "Ÿ", "<unused>", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "<unused>", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý") fn construct_str2(id1:Int, id2: Int) -> String: var out: String = "" if id1 < 32: out += non_printable_mark[id1] elif id1 < 127: out += positive_printable_mark[id1 - 32] else: out += negative_printable_mark[id1 * -1] if id2 < 32: out += non_printable_mark[id2] elif id2 < 127: out += positive_printable_mark[id2 - 32] else: out += negative_printable_mark[id2 * -1] return out fn construct_str4(id1:Int, id2: Int, id3: Int, id4: Int) -> String: var out: String = "" if id1 < 32: out += non_printable_mark[id1] elif id1 < 127: out += positive_printable_mark[id1 - 32] else: out += negative_printable_mark[id1 * -1] if id2 < 32: out += non_printable_mark[id2] elif id2 < 127: out += positive_printable_mark[id2 - 32] else: out += negative_printable_mark[id2 * -1] if id3 < 32: out += non_printable_mark[id3] elif id3 < 127: out += positive_printable_mark[id3 - 32] else: out += negative_printable_mark[id3 * -1] if id4 < 32: out += non_printable_mark[id4] elif id4 < 127: out += positive_printable_mark[id4 - 32] else: out += negative_printable_mark[id4 * -1] return out struct Byte4Tensor: var id1: Int var id2: Int var id3: Int var id4: Int var data_to_string: String var data_to_number: Int var flag: Bool fn __init__(inout self, data:Tensor[si8]): self.flag = False if data[0] >= 0: self.id1 = int(data[0]) else: self.flag = True self.id1 = 256+int(data[0]) if data[1] >= 0: self.id2 = int(data[1]) else: self.flag = True self.id2 = 256+int(data[1]) if data[2] >= 0: self.id3 = int(data[2]) else: self.flag = True self.id3 = 256+int(data[2]) if data[3] >= 0: self.id4 = int(data[3]) else: self.flag = True self.id4 = 256+int(data[3]) if self.flag: self.data_to_string = "Not a Character" self.data_to_number = 16777216* self.id4 + 65536 * self.id3 + 256 * self.id2 + self.id1 else: self.data_to_string = construct_str4(self.id1, self.id2, self.id3, self.id4) self.data_to_number = 16777216* self.id4 + 65536 * self.id3 + 256 * self.id2 + self.id1 fn __getitem__(self, index: Int) raises -> Int: if index == 0: return self.id1 elif index == 1: return self.id2 elif index == 2: return self.id3 elif index == 3: return self.id4 else: raise Error("Index out of range") fn __setitem__(inout self, index: Int, value: Int) raises: if index == 0: self.id1 = value elif index == 1: self.id2 = value elif index == 2: self.id3 = value elif index == 3: self.id4 = value else: raise Error("Index out of range") fn __str__(self) -> String: return "B4T[" + str(self.id1) + ", " + str(self.id2) + ", " + str(self.id3) + ", " + str(self.id4) + "]" fn get_text(self) -> String: return self.data_to_string fn get_number(self) -> Int: return self.data_to_number # fn get_number2(self) -> Int: # let id1: Int = self.id1 if self.id1 >= 128 else self.id1 - 256 # let id2: Int = self.id2 if self.id2 >= 128 else self.id2 - 256 # let id3: Int = self.id3 if self.id3 >= 128 else self.id3 - 256 # let id4: Int = self.id4 if self.id4 >= 128 else self.id4 - 256 # print(id1, id2, id3, id4) # return 16777216* id4 + 65536 * id3 + 256 * id2 + id1 # return struct Byte2Tensor: var id1: Int var id2: Int var data_to_string: String var data_to_number: Int var flag: Bool fn __init__(inout self, data:Tensor[si8]): self.flag = False if data[0] >= 0: self.id1 = int(data[0]) else: self.flag = True self.id1 = 256+int(data[0]) if data[1] >= 0: self.id2 = int(data[1]) else: self.flag = True self.id2 = 256+int(data[1]) if self.flag: self.data_to_string = "Not a Character" self.data_to_number = 256 * self.id2 + self.id1 else: self.data_to_string = construct_str2(self.id1, self.id2) self.data_to_number = 256 * self.id2 + self.id1 fn __getitem__(self, index: Int) raises -> Int: if index == 0: return self.id1 elif index == 1: return self.id2 else: raise Error("Index out of range") fn get_text(self) -> String: return self.data_to_string fn get_number(self) -> Int: return self.data_to_number fn __setitem__(inout self, index: Int, value: Int) raises: if index == 0: self.id1 = value elif index == 1: self.id2 = value else: raise Error("Index out of range") fn __str__(self) -> String: return "B2T<[" + str(self.id1) + ", " + str(self.id2) + "]>" --- .gitignore --- **/.vscode **/.idea **/out *.out *.exe *.txt --- 2015/day1.kt --- private fun part1(str: String): Int { var level = 0 for (c in str) { when (c) { '(' -> ++level ')' -> --level } } return level } private fun part2(str: String): Int { var level = 0 for ((i, c) in str.withIndex()) { when (c) { '(' -> ++level ')' -> --level } if (level < 0) return i + 1 } return 0 } fun main() { val line = readlnOrNull().orEmpty() println(part1(line)) println(part2(line)) } --- 2015/day10.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun lookAndSaySequence(start: String, nth: Int): String { var seq = start repeat(nth) { val builder = StringBuilder() var cnt = 1 for ((i, c) in seq.withIndex()) { if (i + 1 < seq.length && seq[i] == seq[i + 1]) { ++cnt continue } builder.append(cnt) builder.append(c) cnt = 1 } seq = builder.toString() } return seq } private fun part1(line: String): Int { return lookAndSaySequence(line, 40).length } private fun part2(line: String): Int { return lookAndSaySequence(line, 50).length } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val line = reader.readLine() println(part1(line)) println(part2(line)) } --- 2015/day11.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun skipUntilValid(password: String): String { val match = "[iol]".toRegex().find(password) if (match != null) { val i = match.range.first return password.slice(0 until i) + (password[i].code + 1).toChar() + "a".repeat(password.length - i - 1) } return password } private fun increment(password: String): String { val builder = StringBuilder() var increment = true for (i in password.indices.reversed()) { var cur = password[i] if (increment) { val overflow = cur == 'z' cur = if (overflow) 'a' else (cur.code + 1).toChar() increment = overflow } builder.append(cur) } return builder.toString().reversed() } private fun hasIncreasingStraight(password: String): Boolean { for (i in 0 until password.length - 2) if (password[i + 2] == password[i + 1] + 1 && password[i + 1] == password[i] + 1) return true return false } private fun validate(password: String): Boolean { return hasIncreasingStraight(password) && "[^iol]*".toRegex().matches(password) && "(.)\\1".toRegex().findAll(password).count() >= 2 } private fun part1(line: String): String { var pw = line while (!validate(pw)) pw = skipUntilValid(increment(pw)) return pw } private fun part2(line: String): String { return part1(increment(part1(line))) } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val line = reader.readLine() println(part1(line)) println(part2(line)) } --- 2015/day12.kt --- import java.io.BufferedReader import java.io.InputStreamReader import java.util.* private fun hasTopLevelRedValue(obj: String): Boolean { var level = 0 var array = 0 for (si in obj.indices) { when (obj[si]) { '{' -> ++level '}' -> --level '[' -> ++array ']' -> --array } if (level == 0 && array == 0 && obj.substring(si).startsWith(":\"red")) return true } return false } private fun part1(json: String): Int { return "(-?\\d+)".toRegex().findAll(json).map { it.value.toInt() }.sum() } private fun part2(json: String): Int { val subs = mutableListOf<String>() val s = Stack<Int>() for (i in json.indices) { when (json[i]) { '{' -> s.push(i) '}' -> { val obj = json.substring(s.pop() + 1, i) if (hasTopLevelRedValue(obj)) subs.add(obj) } } } subs.sortByDescending { it.length } var filtered = json while (true) { val (idx, sub) = filtered.findAnyOf(subs) ?: break filtered = filtered.slice(0 until idx) + filtered.slice(idx + sub.length until filtered.length) } return part1(filtered) } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val json = reader.readText() println(part1(json)) println(part2(json)) } --- 2015/day13.kt --- import java.io.BufferedReader import java.io.InputStreamReader // Heap's algorithm private fun <T> getPermutations(k: Int, a: Array<T>): List<List<T>> { if (k == 0) return emptyList() if (k == 1) return listOf(a.toList()) var out = getPermutations(k - 1, a) for (i in 0 until k - 1) { if (k % 2 == 1) a[i] = a[k - 1].also { a[k - 1] = a[i] } else a[0] = a[k - 1].also { a[k - 1] = a[0] } out = out + getPermutations(k - 1, a) } return out } private fun buildConnections(lines: List<String>): HashMap<String, HashMap<String, Int>> { val edges = HashMap<String, HashMap<String, Int>>() for (line in lines) { val split = line.split(" ") val n = "\\d+".toRegex().find(line)!!.value.toInt() val sign = when (line.contains("gain")) { true -> 1 false -> -1 } edges.getOrPut(split.first()) { HashMap() }[split.last().trim('.')] = sign * n } return edges } private fun part1(lines: List<String>): Int { val connections = buildConnections(lines) val perms = getPermutations(connections.size, connections.keys.toTypedArray()) return perms.maxOf { it.withIndex().sumOf { (i, cur) -> val next = it[(i + 1) % it.size] val prev = when (i) { 0 -> it.last() else -> it[i - 1] } (connections[cur]!![prev] ?: 0) + (connections[cur]!![next] ?: 0) } } } private fun part2(lines: List<String>): Int { return part1(lines + "Self 0 Self") } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val lines = reader.readLines() println(part1(lines)) println(part2(lines)) } --- 2015/day14.kt --- import java.io.BufferedReader import java.io.InputStreamReader import kotlin.math.min private const val t = 2503 private fun distance(reindeer: List<Int>, t: Int): Int { val (d, m, s) = reindeer val q = t / (m + s) val r = t % (m + s) return q * m * d + min(r, m) * d } private fun part1(reindeer: List<List<Int>>): Int { return reindeer.maxOf { distance(it, t) } } private fun part2(reindeer: List<List<Int>>): Int { val leads = (1..t).flatMap { s -> val distances = reindeer.map { distance(it, s) } distances.indices.filter { distances[it] == distances.max() } } return reindeer.indices.maxOf { idx -> leads.count { it == idx } } } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val reindeer = reader.readLines().map { "\\d+".toRegex().findAll(it).map { res -> res.value.toInt() }.toList() } println(part1(reindeer)) println(part2(reindeer)) } --- 2015/day15.kt --- import java.io.BufferedReader import java.io.InputStreamReader import kotlin.math.max private fun calculateHighestScore(ingredients: List<List<Int>>, ignoreCalories: Boolean = true): Int { var highest = 0 for (a in 1..100) { for (b in 1..100 - a) { for (c in 1..100 - a - b) { for (d in 1..100 - a - b - c) { if (a + b + c + d != 100) continue val calories = a * ingredients[0][4] + b * ingredients[1][4] + c * ingredients[2][4] + d * ingredients[3][4] if (!ignoreCalories && calories != 500) continue val properties = listOf( a * ingredients[0][0] + b * ingredients[1][0] + c * ingredients[2][0] + d * ingredients[3][0], a * ingredients[0][1] + b * ingredients[1][1] + c * ingredients[2][1] + d * ingredients[3][1], a * ingredients[0][2] + b * ingredients[1][2] + c * ingredients[2][2] + d * ingredients[3][2], a * ingredients[0][3] + b * ingredients[1][3] + c * ingredients[2][3] + d * ingredients[3][3] ) highest = max(highest, properties.map { max(0, it) }.reduce(Int::times)) } } } } return highest } private fun part1(ingredients: List<List<Int>>): Int { return calculateHighestScore(ingredients) } private fun part2(ingredients: List<List<Int>>): Int { return calculateHighestScore(ingredients, false) } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val ingredients = reader.readLines().map { "(-?\\d+)".toRegex().findAll(it) .map { res -> res.value.toInt() } .toList() } println(part1(ingredients)) println(part2(ingredients)) } --- 2015/day16.kt --- import java.io.BufferedReader import java.io.InputStreamReader private val sampleMap = HashMap<String, Int>() get() { if (field.isNotEmpty()) return field val samples = "children: 3\n" + "cats: 7\n" + "samoyeds: 2\n" + "pomeranians: 3\n" + "akitas: 0\n" + "vizslas: 0\n" + "goldfish: 5\n" + "trees: 3\n" + "cars: 2\n" + "perfumes: 1" samples.split("\n").associateTo(field) { val (type, count) = it.split(": ") Pair(type, count.toInt()) } return field } private fun findAunt(lines: List<String>, condition: (Pair<String, Int>) -> Boolean): Int { val aunt = lines.find { line -> val list = line.split("\\d: ".toRegex())[1] list.split(", ") .map { val (type, count) = it.split(": ") Pair(type, count.toInt()) } .all { condition(it) } } if (aunt == null) return 0 return "\\d+".toRegex().find(aunt)!!.value.toInt() } private fun part1(lines: List<String>): Int { return findAunt(lines) { (type, cnt) -> sampleMap[type] == cnt } } private fun part2(lines: List<String>): Int { return findAunt(lines) { (type, cnt) -> when (type) { "cats", "trees" -> sampleMap[type]!! < cnt "pomeranians", "goldfish" -> sampleMap[type]!! > cnt else -> sampleMap[type] == cnt } } } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val lines = reader.readLines() println(part1(lines)) println(part2(lines)) } --- 2015/day17.kt --- import java.io.BufferedReader import java.io.InputStreamReader @Suppress("SameParameterValue") private fun part1(containers: List<Int>, n: Int): Int { val dp = Array(containers.size + 1) { Array(n + 1) { 0 } } dp[0][0] = 1 for (l in 0..n) { for ((idx, c) in containers.withIndex()) { dp[idx + 1][l] = dp[idx][l] if (l - c >= 0) dp[idx + 1][l] += dp[idx][l - c] } } return dp[containers.size][n] } @Suppress("SameParameterValue") private fun part2(containers: List<Int>, n: Int): Int { val paths = Array(containers.size + 1) { Array(n + 1) { listOf(listOf<Int>()) } } for (l in 0..n) { for ((idx, c) in containers.withIndex()) { paths[idx + 1][l] = paths[idx][l].toList() if (l - c >= 0) paths[idx + 1][l] = paths[idx + 1][l] + paths[idx][l - c].map { it + c } } } val validPaths = paths[containers.size][n].filter { it.sum() == n } val shortest = validPaths.minOf { it.size } return validPaths.count { it.size == shortest } } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val containers = reader.readLines().map { it.toInt() }.toList() val n = 150 println(part1(containers, n)) println(part2(containers, n)) } --- 2015/day18.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun isCorner(n: Int, r: Int, c: Int): Boolean { return (r == 0 || r == n - 1) && (c == 0 || c == n - 1) } private fun countAdjacentOn(grid: List<List<Char>>, r: Int, c: Int): Int { fun inbounds(r: Int, c: Int): Boolean { return 0 <= r && r < grid.size && 0 <= c && c < grid[0].size } val dr = listOf(-1, -1, -1, 0, 0, 1, 1, 1) val dc = listOf(-1, 0, 1, -1, 1, -1, 0, 1) return dr.zip(dc).count { (vr, vc) -> val nr = r + vr val nc = c + vc inbounds(nr, nc) && grid[nr][nc] == '#' } } private fun transform(grid: List<List<Char>>, r: Int, c: Int, fixCorners: Boolean = false): Char { if (fixCorners && isCorner(grid.size, r, c)) return '#' val adjacentOn = countAdjacentOn(grid, r, c) return when (adjacentOn) { 3 -> '#' 2 -> grid[r][c] else -> '.' } } @Suppress("SameParameterValue") private fun simulate( init: List<List<Char>>, t: Int, transformFunction: (List<List<Char>>, Int, Int) -> Char ): List<List<Char>> { var grid = init repeat(t) { grid = grid.withIndex().map { (ri, row) -> row.indices.map { transformFunction(grid, ri, it) } } } return grid } private fun part1(lines: List<String>): Int { val grid = lines.map { it.toList() } return simulate(grid, 100, ::transform).sumOf { it.count { c -> c == '#' } } } private fun part2(lines: List<String>): Int { val grid = lines.withIndex().map { (ri, row) -> row.withIndex().map { (ci, c) -> if (isCorner(lines.size, ri, ci)) { '#' } else { c } } } val simulated = simulate(grid, 100) { g, r, c -> transform(g, r, c, true) } return simulated.sumOf { it.count { c -> c == '#' } } } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val lines = reader.readLines() println(part1(lines)) println(part2(lines)) } --- 2015/day19.kt --- import java.io.BufferedReader import java.io.InputStreamReader import java.util.* private fun replacePatternAt(str: String, idx: Int, pattern: String, replacement: String): String { val sub = str.substring(idx) if (!sub.startsWith(pattern)) return str return str.substring(0 until idx) + str.substring(idx).replaceFirst(pattern, replacement) } private fun part1(rules: List<List<String>>, molecule: String): Int { val uniques = molecule.indices.flatMap { idx -> rules.map { (p, r) -> replacePatternAt(molecule, idx, p, r) } }.toHashSet() uniques.remove(molecule) return uniques.size } private fun part2(rules: List<List<String>>, molecule: String): Int { val q = PriorityQueue<Pair<String, Int>> { lhs, rhs -> lhs.first.length - rhs.first.length } q.add(Pair(molecule, 0)) while (q.isNotEmpty()) { val (cur, steps) = q.remove() if (cur == "e") return steps for (i in cur.indices) { for ((replacement, pattern) in rules) { val replaced = replacePatternAt(cur, i, pattern, replacement) if (replaced != cur) { q.add(Pair(replaced, steps + 1)) } } } } return 0 } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val lines = reader.readLines().filter { it.isNotEmpty() } val rules = lines.take(lines.size - 1).map { it.split(" => ").toList() } val molecule = lines.last() println(part1(rules, molecule)) println(part2(rules, molecule)) } --- 2015/day2.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun part1(lines: List<String>): Int { var total = 0 for (line in lines) { val (l, w, h) = line.split("x").map { it.toInt() }.toList() val dims = intArrayOf(l * w, w * h, h * l) total += 2 * dims.sum() + dims.min() } return total } private fun part2(lines: List<String>): Int { var total = 0 for (line in lines) { val sides = line.split("x").map { it.toInt() }.toList().sorted() total += 2 * sides[0] + 2 * sides[1] + sides.fold(1) { acc, i -> acc * i } } return total } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val lines = reader.readLines() println(part1(lines)) println(part2(lines)) } --- 2015/day20.kt --- import kotlin.math.sqrt private fun getDivisors(n: Int): List<Int> { val divisors = mutableListOf<Int>() for (d in 1..sqrt(n.toDouble()).toInt()) { if (n % d == 0) { divisors.add(d) if (d != n / d) divisors.add(n / d) } } return divisors } private fun part1(target: Int): Int { return (1..target).find { getDivisors(it).sum() * 10 > target } ?: 0 } private fun part2(target: Int): Int { return (1..target).find { h -> getDivisors(h).filter { h / it <= 50 }.sum() * 11 > target } ?: 0 } fun main() { val target = readln().toInt() println(part1(target)) println(part2(target)) } --- 2015/day21.kt --- import java.io.BufferedReader import java.io.InputStreamReader import kotlin.math.max private fun getItemCombinations(): List<List<Int>> { val swords = listOf( listOf(8, 4, 0), listOf(10, 5, 0), listOf(25, 6, 0), listOf(40, 7, 0), listOf(74, 8, 0) ) val armor = listOf( listOf(0, 0, 0), listOf(13, 0, 1), listOf(31, 0, 2), listOf(53, 0, 3), listOf(75, 0, 4), listOf(102, 0, 5) ) val rings = listOf( listOf(0, 0, 0), listOf(0, 0, 0), listOf(25, 1, 0), listOf(50, 2, 0), listOf(100, 3, 0), listOf(20, 0, 1), listOf(40, 0, 2), listOf(80, 0, 3) ) val combinations = mutableListOf<List<Int>>() for (s in swords) for (a in armor) for (r1 in rings) for (r2 in rings) { if (r1 == r2) continue val cost = s[0] + a[0] + r1[0] + r2[0] val atk = s[1] + a[1] + r1[1] + r2[1] val arm = s[2] + a[2] + r1[2] + r2[2] combinations.add(listOf(cost, atk, arm)) } return combinations } private fun simulate(boss: List<Int>, gear: List<Int>): Pair<Int, Int> { var hp = 100 val (_, atk, arm) = gear var (bHp, bAtk, bArm) = boss while (hp > 0 && bHp > 0) { bHp -= max(1, atk - bArm) hp -= max(1, bAtk - arm) } return Pair(hp, bHp) } private fun part1(boss: List<Int>): Int { return getItemCombinations().filter { simulate(boss, it).second <= 0 }.minBy { it[0] }[0] } private fun part2(boss: List<Int>): Int { return getItemCombinations().filter { val (hp, bHp) = simulate(boss, it) bHp > 0 && hp <= 0 }.maxBy { it[0] }[0] } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val boss = reader.readLines().map { "\\d+".toRegex().find(it)!!.value.toInt() } println(part1(boss)) println(part2(boss)) } --- 2015/day22.kt --- import java.io.BufferedReader import java.io.InputStreamReader import kotlin.math.max import kotlin.math.min private data class State( val isPlayerTurn: Boolean, val boss: List<Int>, val player: List<Int>, val shield: Int = 0, val poison: Int = 0, val recharge: Int = 0, val manaSpent: Int = 0 ) private data class Spell( val cost: Int, val dmg: Int, val heal: Int, val shield: Int = 0, val poison: Int = 0, val recharge: Int = 0, ) private fun simulate(b: List<Int>, p: List<Int>, hardMode: Boolean = false): Int { val spells = listOf( Spell(53, 4, 0), Spell(73, 2, 2), Spell(113, 0, 0, shield = 6), Spell(173, 0, 0, poison = 6), Spell(229, 0, 0, recharge = 5) ) val q = ArrayDeque<State>() q.add(State(true, b, p)) var minMana = Int.MAX_VALUE while (q.isNotEmpty()) { var (isP, boss, player, shield, poison, recharge, manaSpent) = q.removeFirst() var (bHp, bAtk) = boss var (hp, mana) = player if (hardMode && !isP) hp -= 1 if (hp <= 0) continue if (poison > 0) { bHp -= 3 --poison } if (shield > 0) --shield if (recharge > 0) { mana += 101 --recharge } if (bHp <= 0) { minMana = min(minMana, manaSpent) continue } if (!isP) { val newHp = hp - max(1, bAtk - if (shield > 0) 7 else 0) q.add(State(true, listOf(bHp, bAtk), listOf(newHp, mana), shield, poison, recharge, manaSpent)) continue } for ((cost, dmg, heal, sh, po, re) in spells) { if (mana < cost) continue q.add( State( false, listOf(bHp - dmg, bAtk), listOf(hp + heal, mana - cost), if (shield == 0) sh else shield, if (poison == 0) po else poison, if (recharge == 0) re else recharge, manaSpent + cost ) ) } } return minMana } private fun part1(boss: List<Int>): Int { return simulate(boss, listOf(50, 500)) } private fun part2(boss: List<Int>): Int { return simulate(boss, listOf(50, 500), true) } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val boss = reader.readLines().map { "\\d+".toRegex().find(it)!!.value.toInt() } println(part1(boss)) println(part2(boss)) } --- 2015/day23.kt --- import java.io.BufferedReader import java.io.InputStreamReader private data class Instr( val kind: String, val o1: String, val o2: String? ) private fun interpret(registers: List<Int>, instructions: List<Instr>): List<Int> { val regs = registers.toTypedArray() var ip = 0 while (ip < instructions.size) { val (kind, o1, o2) = instructions[ip] ip += when (kind) { "hlf" -> { regs[(o1[0] - 'a')] /= 2 1 } "tpl" -> { regs[(o1[0] - 'a')] *= 3 1 } "inc" -> { ++regs[(o1[0] - 'a')] 1 } "jmp" -> { o1.toInt() } "jie" -> { if (regs[(o1[0] - 'a')] % 2 == 0) o2!!.toInt() else 1 } "jio" -> { if (regs[(o1[0] - 'a')] == 1) o2!!.toInt() else 1 } else -> throw UnsupportedOperationException("invalid instruction") } } return regs.toList() } private fun part1(instructions: List<Instr>): Int { return interpret(listOf(0, 0), instructions)[1] } private fun part2(instructions: List<Instr>): Int { return interpret(listOf(1, 0), instructions)[1] } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val instructions = reader.readLines().map { val split = it.split(" |(, )".toRegex()) Instr(split[0], split[1], split.getOrNull(2)) } println(part1(instructions)) println(part2(instructions)) } --- 2015/day24.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun getNSumPackages(set: List<Long>, n: Long): List<List<Long>> { val subsets = mutableListOf<List<Long>>() for (i in 0 until (1 shl set.size)) { val subset = mutableListOf<Long>() for (j in set.indices) { if (i and (1 shl j) != 0) subset.add(set[j]) } if (subset.sum() == n) subsets.add(subset) } subsets.sortBy { it.reduce(Long::times) } subsets.sortBy { it.size } return subsets } private fun part1(weights: List<Long>): Long { val subsets = getNSumPackages(weights, weights.sum() / 3) for (s in subsets) { for (s1 in subsets) { val union = s.union(s1.toSet()) if (union.size != s.size + s1.size) continue return s.reduce(Long::times) } } return 0 } private fun part2(weights: List<Long>): Long { val subsets = getNSumPackages(weights, weights.sum() / 4) for (s in subsets) { for (s1 in subsets) { var union = s.union(s1.toSet()) if (union.size != s.size + s1.size) continue for (s2 in subsets) { union = union.union(s2.toSet()) if (union.size != s.size + s1.size + s2.size) continue return s.reduce(Long::times) } } } return 0 } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val weights = reader.readLines().map { it.toLong() } println(part1(weights)) println(part2(weights)) } --- 2015/day25.kt --- private fun part1(line: String): ULong { val (r, c) = "\\d+".toRegex().findAll(line).map { it.value.toInt() }.toList() val sum1ToN = { n: Int -> (n * (n + 1)) / 2 } val base = sum1ToN(c) + sum1ToN(c + r - 2) - sum1ToN(c - 1) var code = 20151125uL for (n in 2..base) code = (code * 252533uL) % 33554393uL return code } private fun part2(): Int { return 0 } fun main() { val line = readln() println(part1(line)) println(part2()) } --- 2015/day3.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun part1(line: String): Int { var pos = Pair(0, 0) val visited = HashSet<Pair<Int, Int>>() visited.add(pos) for (dir in line) { var (x, y) = pos when (dir) { '>' -> ++x '<' -> --x 'v' -> ++y '^' -> --y } pos = Pair(x, y) visited.add(pos) } return visited.size } private fun part2(line: String): Int { val pos = mutableListOf(Pair(0, 0), Pair(0, 0)) var i = 0 val visited = HashSet<Pair<Int, Int>>() visited.add(pos[i]) for (dir in line) { var (x, y) = pos[i] when (dir) { '>' -> ++x '<' -> --x 'v' -> ++y '^' -> --y } pos[i] = Pair(x, y) visited.add(pos[i]) i = (i + 1) % pos.size } return visited.size } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val line = reader.readLine() println(part1(line)) println(part2(line)) } --- 2015/day4.kt --- import java.io.BufferedReader import java.io.InputStreamReader import java.security.MessageDigest private fun part1(line: String): Int { val md = MessageDigest.getInstance("MD5") var n = 0 while (true) { val base = line + n.toString() val hash = md.digest(base.toByteArray()).joinToString("") { "%02x".format(it) } if (hash.slice(0..4).all { it == '0' }) break ++n } return n } private fun part2(line: String): Int { val md = MessageDigest.getInstance("MD5") var n = 0 while (true) { val base = line + n.toString() val hash = md.digest(base.toByteArray()).joinToString("") { "%02x".format(it) } if (hash.slice(0..5).all { it == '0' }) break ++n } return n } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val line = reader.readLine() println(part1(line)) println(part2(line)) } --- 2015/day5.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun part1(lines: List<String>): Int { return lines.count { val includedCount = "[aeiou]".toRegex().findAll(it).count() val hasExcluded = ".*(ab)|(cd)|(xy)|(pq).*".toRegex().find(it) != null val hasDouble = "(.)\\1".toRegex().find(it) != null includedCount >= 3 && !hasExcluded && hasDouble } } private fun part2(lines: List<String>): Int { return lines.count { "(..).*(\\1)".toRegex().find(it) != null && "(.).(\\1)".toRegex().find(it) != null } } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val lines = reader.readLines() println(part1(lines)) println(part2(lines)) } --- 2015/day6.kt --- import java.io.BufferedReader import java.io.InputStreamReader import kotlin.math.max private fun part1(lines: List<String>): Int { val grid = MutableList(1000) { MutableList(1000) { false } } for (line in lines) { val instruction = "[a-z]+(\\s[a-z]+)?".toRegex().find(line)?.value val (fr, fc, tr, tc) = "\\d+,\\d+".toRegex().findAll(line).flatMap { res -> res.value.split(",").map { it.toInt() }.toList() }.toList() for (r in fr..tr) { for (c in fc..tc) { grid[r][c] = when (instruction) { "toggle" -> !grid[r][c] "turn on" -> true "turn off" -> false else -> false } } } } return grid.sumOf { r -> r.count { it } } } private fun part2(lines: List<String>): Int { val grid = MutableList(1000) { MutableList(1000) { 0 } } for (line in lines) { val instruction = "[a-z]+(\\s[a-z]+)?".toRegex().find(line)?.value val (fr, fc, tr, tc) = "\\d+,\\d+".toRegex().findAll(line).flatMap { res -> res.value.split(",").map { it.toInt() }.toList() }.toList() for (r in fr..tr) { for (c in fc..tc) { grid[r][c] += when (instruction) { "toggle" -> 2 "turn on" -> 1 "turn off" -> -1 else -> 0 } grid[r][c] = max(grid[r][c], 0) } } } return grid.sumOf { it.sum() } } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val lines = reader.readLines() println(part1(lines)) println(part2(lines)) } --- 2015/day7.kt --- import java.io.BufferedReader import java.io.InputStreamReader private data class Instruction( var lhs: String? = null, var op: String? = null, var rhs: String, var dst: String ) private fun topologicalSort(cur: Int, dependencies: HashMap<Int, HashSet<Int>>, visited: HashSet<Int>): List<Int> { if (!visited.add(cur)) return listOf() return dependencies[cur].orEmpty() .flatMap { topologicalSort(it, dependencies, visited) } .plus(cur) } private fun parseInstruction(line: String): Instruction { val (instruction, dst) = line.split(" -> ") val split = instruction.split(" ") return when (split.size) { 1 -> Instruction(rhs = split[0], dst = dst) 2 -> Instruction(op = split[0], rhs = split[1], dst = dst) 3 -> Instruction(lhs = split[0], op = split[1], rhs = split[2], dst = dst) else -> throw UnsupportedOperationException("unreachable") } } private fun constructInstructionDependencyGraph(instructions: List<Instruction>): HashMap<Int, HashSet<Int>> { val edges = HashMap<Int, HashSet<Int>>() for ((i, i1) in instructions.withIndex()) { for ((j, i2) in instructions.withIndex()) { if (i == j) continue if (i2.lhs == i1.dst || i2.rhs == i1.dst) edges.getOrPut(i) { HashSet() }.add(j) } } return edges } private fun executeInstructions(instructions: List<Instruction>): HashMap<String, UShort> { val dependencies = constructInstructionDependencyGraph(instructions) val visited = HashSet<Int>() val evaluationOrder = instructions.withIndex() .filter { it.value.op == null } .flatMap { topologicalSort(it.index, dependencies, visited) } .reversed() val wires = HashMap<String, UShort>() for (i in evaluationOrder) { val (lhs, op, rhs, dst) = instructions[i] val rhsVal = if (rhs[0].isDigit()) rhs.toUShort() else wires[rhs]!! val lhsVal = if (lhs?.get(0)?.isDigit() == true) lhs.toUShort() else wires[lhs] wires[dst] = when (op) { "NOT" -> rhsVal.inv() "AND" -> lhsVal!! and rhsVal "OR" -> lhsVal!! or rhsVal "LSHIFT" -> (lhsVal!!.toInt() shl rhsVal.toInt()).toUShort() "RSHIFT" -> (lhsVal!!.toInt() ushr rhsVal.toInt()).toUShort() else -> rhsVal } } return wires } private fun part1(instructions: List<Instruction>): UShort { return executeInstructions(instructions)["a"]!! } private fun part2(instructions: List<Instruction>): UShort { val a = executeInstructions(instructions)["a"]!! val newInstructions = instructions.map { if (it.dst == "b") Instruction(rhs = a.toString(), dst = it.dst) else it } return executeInstructions(newInstructions)["a"]!! } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val instructions = reader.lines().map { parseInstruction(it!!) }.toList() println(part1(instructions)) println(part2(instructions)) } --- 2015/day8.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun part1(lines: List<String>): Int { return lines.sumOf { it.length } - lines.sumOf { val str = it.removeSurrounding("\"") var len = str.length len -= "(\\\\\")|(\\\\\\\\)".toRegex().findAll(str).count() len -= 3 * "(\\\\x[0-9a-f][0-9a-f])".toRegex().findAll(str).count() len } } private fun part2(lines: List<String>): Int { return lines.sumOf { it.length + "[\\\\\"]".toRegex().findAll(it).count() + 2 } - lines.sumOf { it.length } } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val lines = reader.readLines() println(part1(lines)) println(part2(lines)) } --- 2015/day9.kt --- import java.io.BufferedReader import java.io.InputStreamReader private fun dfs( cur: String, visited: HashSet<String>, graph: HashMap<String, HashSet<Pair<String, Int>>>, shortest: Boolean = true, cost: Int = 0 ): Int { if (!visited.add(cur)) return if (shortest) Int.MAX_VALUE else 0 if (visited.size == graph.keys.size) return cost return if (shortest) graph[cur]!!.minOf { dfs(it.first, visited.toHashSet(), graph, true, cost + it.second) } else graph[cur]!!.maxOf { dfs(it.first, visited.toHashSet(), graph, false, cost + it.second) } } private fun part1(graph: HashMap<String, HashSet<Pair<String, Int>>>): Int { return graph.keys.minOf { dfs(it, HashSet(), graph) } } private fun part2(graph: HashMap<String, HashSet<Pair<String, Int>>>): Int { return graph.keys.maxOf { dfs(it, HashSet(), graph, false) } } fun main() { val reader = BufferedReader(InputStreamReader(System.`in`)) val graph = HashMap<String, HashSet<Pair<String, Int>>>() for (line in reader.lines()) { val (cities, cost) = line.split(" = ") val (from, to) = cities.split(" to ") graph.getOrPut(from) { HashSet() }.add(Pair(to, cost.toInt())) graph.getOrPut(to) { HashSet() }.add(Pair(from, cost.toInt())) } println(part1(graph)) println(part2(graph)) } --- 2016/day1.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; class day1 { private record Pair<K, V>(K first, V second) { } private static int rotate(boolean left, int facing) { if (left) return facing == 0 ? 3 : facing - 1; else return (facing + 1) % 4; } private static ArrayList<Pair<Integer, Integer>> move(Pair<Integer, Integer> pos, int facing, int steps) { ArrayList<Pair<Integer, Integer>> moves = new ArrayList<>(); for (int i = 0; i < steps; i++) { moves.add(switch (facing) { case 0 -> new Pair<>(pos.first + 1, pos.second); case 1 -> new Pair<>(pos.first, pos.second + 1); case 2 -> new Pair<>(pos.first - 1, pos.second); case 3 -> new Pair<>(pos.first, pos.second - 1); default -> throw new UnknownError(); }); pos = moves.getLast(); } return moves; } private static int part1(String input) { // 0 - N; 1 - E; 2 - S; 3 - W int facing = 0; Pair<Integer, Integer> pos = new Pair<>(0, 0); for (String dir : input.split(", ")) { boolean left = dir.charAt(0) == 'L'; int steps = Integer.parseInt(dir.substring(1)); facing = rotate(left, facing); pos = move(pos, facing, steps).getLast(); } return Math.abs(pos.first) + Math.abs(pos.second); } private static int part2(String input) { int facing = 0; Pair<Integer, Integer> pos = new Pair<>(0, 0); HashSet<Pair<Integer, Integer>> visited = new HashSet<>(); visited.add(pos); for (String dir : input.split(", ")) { boolean left = dir.charAt(0) == 'L'; int steps = Integer.parseInt(dir.substring(1)); facing = rotate(left, facing); var visitedPositions = move(pos, facing, steps); for (var visitedPos : visitedPositions) { if (!visited.add(visitedPos)) return Math.abs(visitedPos.first) + Math.abs(visitedPos.second); } pos = visitedPositions.getLast(); } throw new UnknownError(); } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String line = reader.readLine(); System.out.println(part1(line)); System.out.println(part2(line)); } } --- 2016/day10.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.TreeSet; class day10 { private static boolean process(HashMap<Integer, TreeSet<Integer>> bots, int val, String dst, String dstId) { int to = Integer.parseInt(dstId); if (!dst.equals("output")) { bots.putIfAbsent(to, new TreeSet<>()); bots.get(to).add(val); return true; } return to > 2; } private static int[] simulate(List<String> lines) { ArrayList<String> linesToProcess = new ArrayList<>(lines); HashMap<Integer, TreeSet<Integer>> bots = new HashMap<>(); int[] out = {-1, 1}; while (!linesToProcess.isEmpty()) { String line = linesToProcess.removeFirst(); String[] split = line.split(" "); if (split[0].equals("value")) { int val = Integer.parseInt(split[1]); int bot = Integer.parseInt(split[split.length - 1]); bots.putIfAbsent(bot, new TreeSet<>()); bots.get(bot).add(val); continue; } int from = Integer.parseInt(split[1]); if (!bots.containsKey(from) || bots.get(from).size() != 2) { linesToProcess.add(line); continue; } int low = bots.get(from).removeFirst(); int high = bots.get(from).removeFirst(); if (low == 17 && high == 61) out[0] = from; if (!process(bots, low, split[5], split[6])) out[1] *= low; if (!process(bots, high, split[10], split[11])) out[1] *= high; } return out; } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); var res = simulate(reader.lines().toList()); System.out.println(res[0]); System.out.println(res[1]); } } --- 2016/day11.java --- import java.util.*; import java.util.stream.Collectors; import java.util.stream.IntStream; class day11 { private record Element(String code, boolean m) implements Comparable<Element> { @Override public String toString() { return code + (m ? "M" : "G"); } @Override public int compareTo(Element e) { return toString().compareTo(e.toString()); } } private static class Floors extends ArrayList<TreeSet<Element>> { private Floors deepClone() { Floors tmp = new Floors(); for (var arr : this) tmp.add((TreeSet<Element>) arr.clone()); return tmp; } private Floors moveElement(int from, int to, Element el) { var tmp = deepClone(); tmp.get(from).remove(el); tmp.get(to).add(el); return tmp; } } private record State(int elevator, int steps, Floors floors) { private boolean isValid() { for (var floor : floors) { var partition = floor.stream().collect(Collectors.partitioningBy(Element::m)); for (var m : partition.get(true)) { var generators = partition.get(false); if (!generators.isEmpty() && generators.stream().noneMatch(g -> g.code.equals(m.code))) return false; } } return true; } } private static int simulate(State initialState) { ArrayDeque<State> q = new ArrayDeque<>(); q.add(initialState); HashSet<String> visited = new HashSet<>(); int steps = 0; while (!q.isEmpty()) { State cur = q.removeFirst(); if (!cur.isValid()) continue; int elevator = cur.elevator; if (!visited.add("e:" + cur.elevator + cur.floors)) continue; if (steps != cur.steps) { steps = cur.steps; System.err.println("steps: " + steps + ", states in queue: " + q.size()); } if (IntStream.range(0, 3).allMatch(i -> cur.floors.get(i).isEmpty())) return cur.steps; List<Element> curFloor = cur.floors.get(elevator).stream().toList(); int curFloorSize = curFloor.size(); for (int i = 0; i < curFloorSize; i++) { for (int to : new int[]{elevator + 1, elevator - 1}) { if (to < 0 || to >= cur.floors.size()) continue; Element el = curFloor.get(i); // move 1 item var up1 = cur.floors.moveElement(elevator, to, el); q.add(new State(to, cur.steps + 1, up1)); // move 2 items for (int j = i + 1; j < curFloorSize; j++) { var up2 = up1.moveElement(elevator, to, curFloor.get(j)); q.add(new State(to, cur.steps + 1, up2)); } } } } return -1; } public static void main(String[] args) { Floors floors = new Floors(); for (int i = 0; i < 4; i++) floors.add(new TreeSet<>()); floors.get(0).add(new Element("PR", false)); floors.get(0).add(new Element("PR", true)); floors.get(1).add(new Element("CO", false)); floors.get(1).add(new Element("CU", false)); floors.get(1).add(new Element("RU", false)); floors.get(1).add(new Element("PL", false)); floors.get(2).add(new Element("CO", true)); floors.get(2).add(new Element("CU", true)); floors.get(2).add(new Element("RU", true)); floors.get(2).add(new Element("PL", true)); System.out.println(simulate(new State(0, 0, floors))); floors.get(0).add(new Element("EL", false)); floors.get(0).add(new Element("EL", true)); floors.get(0).add(new Element("DI", false)); floors.get(0).add(new Element("DI", true)); System.out.println(simulate(new State(0, 0, floors))); } } --- 2016/day12.java --- import java.io.BufferedReader; import java.io.InputStreamReader; class day12 { private static int getOpVal(int[] r, String[] instr, int n) { String op = instr[n]; char fst = op.charAt(0); if ('a' <= fst && fst <= 'd') return r[fst - 'a']; return Integer.parseInt(op); } private static int getRIdx(String[] instr, int n) { return instr[n].charAt(0) - 'a'; } private static void execute(int[] r, String[] instructions) { int rip = 0; while (rip < instructions.length) { String[] instr = instructions[rip].split(" "); String opcode = instr[0]; switch (opcode) { case "inc": ++r[getRIdx(instr, 1)]; break; case "dec": --r[getRIdx(instr, 1)]; break; case "cpy": r[getRIdx(instr, 2)] = getOpVal(r, instr, 1); break; case "jnz": if (getOpVal(r, instr, 1) != 0) { rip += getOpVal(r, instr, 2); continue; } } ++rip; } } private static int part1(String[] instructions) { int[] r = new int[4]; execute(r, instructions); return r[0]; } private static int part2(String[] instructions) { int[] r = new int[4]; r[2] = 1; execute(r, instructions); return r[0]; } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] instruction = reader.lines().toArray(String[]::new); System.out.println(part1(instruction)); System.out.println(part2(instruction)); } } --- 2016/day13.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.HashSet; class day13 { private static boolean isWall(int x, int y, int n) { return Integer.bitCount(x * x + 3 * x + 2 * x * y + y + y * y + n) % 2 == 1; } private record Visited(int x, int y) { } private record State(int x, int y, int steps) { } private static int simulate(int targetX, int targetY, int designerN, boolean part2) { ArrayDeque<State> q = new ArrayDeque<>(); HashSet<Visited> visited = new HashSet<>(); q.add(new State(1, 1, 0)); while (!q.isEmpty()) { State cur = q.removeFirst(); if (part2 && cur.steps > 50) continue; if (!visited.add(new Visited(cur.x, cur.y))) continue; if (!part2 && cur.x == targetX && cur.y == targetY) return cur.steps; for (int[] dir : new int[][]{{0, 1}, {0, -1}, {1, 0}, {-1, 0}}) { int dx = cur.x + dir[0]; int dy = cur.y + dir[1]; if (dx < 0 || dy < 0 || isWall(dx, dy, designerN)) continue; q.add(new State(dx, dy, cur.steps + 1)); } } return visited.size(); } private static int part1(int designerN) { return simulate(31, 39, designerN, false); } private static int part2(int designerN) { return simulate(0, 0, designerN, true); } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(reader.readLine()); System.out.println(part1(n)); System.out.println(part2(n)); } } --- 2016/day14.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; class day14 { private interface HashFunction { String hash(MessageDigest md, String input); } private static String hash(MessageDigest md, String input) { return String.format("%032x", new BigInteger(1, md.digest(input.getBytes()))); } private static String stretchedHash(MessageDigest md, String input) { String hash = hash(md, input); for (int i = 0; i < 2016; i++) hash = hash(md, hash); return hash; } private static int solve(String salt, HashFunction fn) { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); Pattern triple = Pattern.compile("(.)\\1{2}"); ArrayList<String> hashes = new ArrayList<>(2000); int idx = 0; int keys = 0; while (keys < 64) { int oldIdx = idx; ++idx; if (oldIdx >= hashes.size()) hashes.add(fn.hash(md5, salt + oldIdx)); Matcher matcher = triple.matcher(hashes.get(oldIdx)); if (!matcher.find()) continue; String fivePattern = matcher.group().substring(0, 1).repeat(5); for (int i = oldIdx + 1; i < oldIdx + 1000; i++) { if (i >= hashes.size()) hashes.add(fn.hash(md5, salt + i)); if (!hashes.get(i).contains(fivePattern)) continue; ++keys; System.err.println("idx: " + oldIdx + ", keys: " + keys); break; } } return idx - 1; } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } private static int part1(String salt) { return solve(salt, day14::hash); } private static int part2(String salt) { return solve(salt, day14::stretchedHash); } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String salt = reader.readLine(); System.out.println(part1(salt)); System.out.println(part2(salt)); } } --- 2016/day15.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; class day15 { private record Disc(int startPos, int positions) { } private static int simulate(ArrayList<Disc> discs) { int t = 0; while (true) { boolean fallthrough = true; for (int i = 0; i < discs.size(); i++) fallthrough &= (discs.get(i).startPos + t + i + 1) % discs.get(i).positions == 0; if (fallthrough) return t; ++t; } } private static int part1(ArrayList<Disc> discs) { return simulate(discs); } private static int part2(ArrayList<Disc> discs) { discs.add(new Disc(0, 11)); return simulate(discs); } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Disc> discs = new ArrayList<>( reader.lines().map(l -> { String[] split = l.split("[ .]"); return new Disc(Integer.parseInt(split[11]), Integer.parseInt(split[3])); }).toList() ); System.out.println(part1(discs)); System.out.println(part2(discs)); } } --- 2016/day16.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.stream.Collectors; class day16 { private static String dragon(String a, int length) { if (a.length() > length) return a.substring(0, length); String b = new StringBuilder(a).reverse().toString(); b = b.chars() .map(c -> (c - '0') ^ 1) .mapToObj(Integer::toString) .collect(Collectors.joining()); return dragon(a + "0" + b, length); } private static String checksum(String s) { if (s.length() % 2 == 1) return s; StringBuilder builder = new StringBuilder(); for (int i = 0; i < s.length(); i += 2) builder.append(s.charAt(i) == s.charAt(i + 1) ? 1 : 0); return checksum(builder.toString()); } private static String part1(String input) { return checksum(dragon(input, 272)); } private static String part2(String input) { return checksum(dragon(input, 35651584)); } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String input = reader.readLine(); System.out.println(part1(input)); System.out.println(part2(input)); } } --- 2016/day17.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayDeque; class day17 { private static String hash(String input) { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); return String.format("%032x", new BigInteger(1, md5.digest(input.getBytes()))); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } private static boolean isOpen(char c) { return 'b' <= c && c <= 'f'; } private record State(int r, int c, String path) { } private record DirInfo(int vr, int vc, int hIdx, char p) { } private static String getPath(String passcode, boolean stopAfterFirst) { String[] maze = new String[]{ "#########", "#S| | | #", "#-#-#-#-#", "# | | | #", "#-#-#-#-#", "# | | | #", "#-#-#-#-#", "# | | | ", "####### V", }; DirInfo[] dis = new DirInfo[]{ new DirInfo(-1, 0, 0, 'U'), new DirInfo(1, 0, 1, 'D'), new DirInfo(0, -1, 2, 'L'), new DirInfo(0, 1, 3, 'R') }; String path = ""; ArrayDeque<State> queue = new ArrayDeque<>(); queue.add(new State(1, 1, "")); while (!queue.isEmpty()) { State cur = queue.removeFirst(); if (cur.r == 7 && cur.c == 7) { path = cur.path; if (stopAfterFirst) break; continue; } String doorInfo = hash(passcode + cur.path).substring(0, 4); for (DirInfo di : dis) { if (maze[cur.r + di.vr].charAt(cur.c + di.vc) != '#' && isOpen(doorInfo.charAt(di.hIdx))) queue.add(new State(cur.r + 2 * di.vr, cur.c + 2 * di.vc, cur.path + di.p)); } } return path; } private static String part1(String passcode) { return getPath(passcode, true); } private static int part2(String passcode) { return getPath(passcode, false).length(); } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String passcode = reader.readLine(); System.out.println(part1(passcode)); System.out.println(part2(passcode)); } } --- 2016/day18.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; class day18 { private static long calculateSafeTiles(String startingRow, int rowCnt) { ArrayList<String> rows = new ArrayList<>(40); rows.add(startingRow); for (int i = 1; i < rowCnt; i++) { String extendedRow = "." + rows.get(i - 1) + "."; StringBuilder builder = new StringBuilder(startingRow.length()); for (int j = 1; j <= startingRow.length(); j++) { String pattern = extendedRow.substring(j - 1, j + 2); boolean trap = pattern.equals("^^.") || pattern.equals(".^^") || pattern.equals("^..") || pattern.equals("..^"); builder.append(trap ? '^' : '.'); } rows.add(builder.toString()); } return rows.stream() .mapToLong(r -> r.chars().filter(c -> c == '.').count()) .sum(); } private static long part1(String startingRow) { return calculateSafeTiles(startingRow, 40); } private static long part2(String startingRow) { return calculateSafeTiles(startingRow, 400000); } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String row = reader.readLine(); System.out.println(part1(row)); System.out.println(part2(row)); } } --- 2016/day19.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.stream.IntStream; class day19 { private static int part1(int elvesCnt) { int[] elves = IntStream.rangeClosed(1, elvesCnt).toArray(); while (elves.length > 2) { int[] tmp = elves; elves = IntStream.range(tmp.length % 2, tmp.length) .filter(i -> i % 2 == 0) .map(i -> tmp[i]) .toArray(); } return elves[0]; } private static int part2(int elvesCnt) { ArrayList<Integer> elves = new ArrayList<>(IntStream.rangeClosed(1, elvesCnt).boxed().toList()); int cur = 0; while (elves.size() > 1) { if (elves.size() % 10000 == 0) System.err.println("Remaining elves: " + elves.size()); int tgt = cur + elves.size() / 2; boolean shouldInc = tgt < elves.size(); elves.remove(tgt % elves.size()); cur = (cur + (shouldInc ? 1 : 0)) % elves.size(); } return elves.getFirst(); } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int elvesCnt = Integer.parseInt(reader.readLine()); System.out.println(part1(elvesCnt)); System.out.println(part2(elvesCnt)); } } --- 2016/day2.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.stream.Collectors; class day2 { private record Position(int row, int col) { } private static String getCode(char[][] keypad, ArrayList<String> instructions, Position start) { StringBuilder codeStream = new StringBuilder(); Position pos = start; for (String line : instructions) { for (char c : line.toCharArray()) { Position newPos = switch (c) { case 'U' -> new Position(pos.row - 1, pos.col); case 'D' -> new Position(pos.row + 1, pos.col); case 'L' -> new Position(pos.row, pos.col - 1); case 'R' -> new Position(pos.row, pos.col + 1); default -> throw new IllegalStateException("Unexpected value: " + c); }; if (newPos.row < 0 || newPos.row >= keypad.length) continue; if (newPos.col < 0 || newPos.col >= keypad[0].length) continue; if (keypad[newPos.row][newPos.col] == ' ') continue; pos = newPos; } codeStream.append(keypad[pos.row][pos.col]); } return codeStream.toString(); } private static String part1(ArrayList<String> lines) { char[][] keypad = { {'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'} }; return getCode(keypad, lines, new Position(1, 1)); } private static String part2(ArrayList<String> lines) { char[][] keypad = { {' ', ' ', '1', ' ', ' '}, {' ', '2', '3', '4', ' '}, {'5', '6', '7', '8', '9'}, {' ', 'A', 'B', 'C', ' '}, {' ', ' ', 'D', ' ', ' '}, }; return getCode(keypad, lines, new Position(2, 0)); } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> lines = reader.lines().collect(Collectors.toCollection(ArrayList::new)); System.out.println(part1(lines)); System.out.println(part2(lines)); } } --- 2016/day20.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; class day20 { private record Range(long begin, long end) { } private static ArrayList<Range> getAllowedIPRanges(String[] blacklist) { ArrayList<Range> allowedIPRanges = new ArrayList<>(1); allowedIPRanges.add(new Range(0L, 4294967295L)); for (String line : blacklist) { String[] split = line.split("-"); long begin = Long.parseLong(split[0]); long end = Long.parseLong(split[1]); ArrayList<Range> tmp = new ArrayList<>(); for (Range r : allowedIPRanges) { long overlapBegin = Long.max(begin, r.begin); long overlapEnd = Long.min(end, r.end); if (overlapBegin > overlapEnd) { tmp.add(r); continue; } if (r.begin < overlapBegin) tmp.add(new Range(r.begin, overlapBegin - 1)); if (r.end > overlapEnd) tmp.add(new Range(overlapEnd + 1, r.end)); } allowedIPRanges = tmp; } return allowedIPRanges; } private static long part1(String[] blacklist) { return getAllowedIPRanges(blacklist).getFirst().begin; } private static long part2(String[] blacklist) { return getAllowedIPRanges(blacklist).stream().mapToLong(r -> r.end - r.begin + 1).sum(); } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] lines = reader.lines().toArray(String[]::new); System.out.println(part1(lines)); System.out.println(part2(lines)); } } --- 2016/day21.java --- import java.io.BufferedReader; import java.io.InputStreamReader; class day21 { private static String part1(String[] instructions, String password) { for (String instr : instructions) { String[] split = instr.split(" "); if (split[0].equals("swap")) { char[] chars = password.toCharArray(); if (split[1].equals("position")) { int p1 = Integer.parseInt(split[2]); int p2 = Integer.parseInt(split[5]); char tmp = chars[p2]; chars[p2] = chars[p1]; chars[p1] = tmp; } else if (split[1].equals("letter")) { char c1 = split[2].charAt(0); char c2 = split[5].charAt(0); for (int i = 0; i < chars.length; i++) { if (chars[i] == c1) chars[i] = c2; else if (chars[i] == c2) chars[i] = c1; } } password = new String(chars); } else if (split[0].equals("rotate")) { char[] chars = password.toCharArray(); boolean right; int by; if (split[1].equals("based")) { right = true; by = password.indexOf(split[6]) + 1; if (by >= 5) ++by; } else { right = split[1].equals("right"); by = Integer.parseInt(split[2]); } char[] rotated = chars.clone(); for (int i = 0; i < rotated.length; i++) { int newI = i + (right ? by : -by); if (newI < 0) newI = rotated.length + newI; rotated[newI % rotated.length] = chars[i]; } password = new String(rotated); } else if (split[0].equals("reverse")) { int from = Integer.parseInt(split[2]); int to = Integer.parseInt(split[4]); StringBuilder builder = new StringBuilder(password.substring(from, to + 1)); password = password.substring(0, from) + builder.reverse() + password.substring(to + 1); } else if (split[0].equals("move")) { int from = Integer.parseInt(split[2]); int to = Integer.parseInt(split[5]); char c = password.charAt(from); password = new StringBuilder(password).deleteCharAt(from).insert(to, c).toString(); } } return password; } private static String bruteForce(String scrambled, String[] instructions, String current) { if (current.length() == scrambled.length()) return part1(instructions, current).equals(scrambled) ? current : ""; char[] l = "abcdefgh".toCharArray(); for (char c : l) { if (current.indexOf(c) != -1) continue; String res = bruteForce(scrambled, instructions, current + c); if (!res.isEmpty()) return res; } return ""; } private static String part2(String[] instructions, String scrambled) { return bruteForce(scrambled, instructions, ""); } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] instructions = reader.lines().toArray(String[]::new); System.out.println(part1(instructions, "abcdefgh")); System.out.println(part2(instructions, "fbgdceah")); } } --- 2016/day22.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; class day22 { private record Node(int x, int y, int size, int used, int free) { } private static int part1(ArrayList<Node> nodes) { int cnt = 0; for (Node n1 : nodes) { for (Node n2 : nodes) { if (n1 == n2 || n1.used == 0 || n1.used > n2.free) continue; ++cnt; } } return cnt; } private record State(int fr, int fc, int gr, int gc, int steps) { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; State state = (State) o; return fr == state.fr && fc == state.fc && gr == state.gr && gc == state.gc; } @Override public int hashCode() { return Objects.hash(fr, fc, gr, gc); } } private static int part2(ArrayList<Node> nodes) { Node free = nodes.stream().filter(n -> n.used == 0).toList().getFirst(); char[][] grid = new char[nodes.getLast().y + 1][nodes.getLast().x + 1]; for (Node n : nodes) grid[n.y][n.x] = n.used > free.size ? '#' : '.'; int[][] dirs = new int[][]{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; HashSet<State> visited = new HashSet<>(); PriorityQueue<State> q = new PriorityQueue<>(Comparator.comparingInt( o -> o.gr + o.gc + Math.abs(o.fr - o.gr) + Math.abs(o.fc - o.gc) )); q.add(new State(free.y, free.x, 0, grid[0].length - 1, 0)); while (!q.isEmpty()) { var cur = q.remove(); if (!visited.add(cur)) continue; if (cur.gr == 0 && cur.gc == 0) return cur.steps; for (int[] dir : dirs) { int nr = cur.fr + dir[0]; int nc = cur.fc + dir[1]; if (nr < 0 || nc < 0 || nr >= grid.length || nc >= grid[0].length || grid[nr][nc] == '#') continue; boolean swapWithGoal = nr == cur.gr && nc == cur.gc; int ngr = swapWithGoal ? cur.fr : cur.gr; int ngc = swapWithGoal ? cur.fc : cur.gc; q.add(new State(nr, nc, ngr, ngc, cur.steps + 1)); } } return -1; } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] lines = reader.lines().skip(2).toArray(String[]::new); ArrayList<Node> nodes = new ArrayList<>(lines.length); for (String line : lines) { String[] split = line.split("T? +"); int s = Integer.parseInt(split[1]); int u = Integer.parseInt(split[2]); int f = Integer.parseInt(split[3]); String[] coords = split[0].split("-[xy]"); int x = Integer.parseInt(coords[1]); int y = Integer.parseInt(coords[2]); nodes.add(new Node(x, y, s, u, f)); } System.out.println(part1(nodes)); System.out.println(part2(nodes)); } } --- 2016/day23.java --- import java.io.BufferedReader; import java.io.InputStreamReader; class day23 { private static int getOpVal(int[] r, String[] instr, int n) { String op = instr[n]; char fst = op.charAt(0); if ('a' <= fst && fst <= 'd') return r[fst - 'a']; return Integer.parseInt(op); } private static int getRIdx(String[] instr, int n) { return instr[n].charAt(0) - 'a'; } private static void execute(int[] r, String[] instructions) { int rip = 0; while (rip < instructions.length) { String[] instr = instructions[rip].split(" "); String opcode = instr[0]; switch (opcode) { case "inc": ++r[getRIdx(instr, 1)]; break; case "dec": --r[getRIdx(instr, 1)]; break; case "cpy": if (Character.isAlphabetic(instr[2].charAt(0))) { r[getRIdx(instr, 2)] = getOpVal(r, instr, 1); } break; case "jnz": if (getOpVal(r, instr, 1) != 0) { rip += getOpVal(r, instr, 2); continue; } break; case "tgl": { int targetInst = rip + getOpVal(r, instr, 1); if (targetInst < instructions.length) { String opc = instructions[targetInst].split(" ")[0]; instructions[targetInst] = instructions[targetInst].replace(opc, switch (opc) { case "inc" -> "dec"; case "dec", "tgl" -> "inc"; case "cpy" -> "jnz"; default -> "cpy"; }); } } } ++rip; } } private static int part1(String[] instructions) { int[] r = new int[4]; r[0] = 7; execute(r, instructions); return r[0]; } private static int part2(String[] instructions) { int[] r = new int[4]; r[0] = 12; execute(r, instructions); return r[0]; } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] lines = reader.lines().toArray(String[]::new); System.out.println(part1(lines.clone())); System.out.println(part2(lines)); } } --- 2016/day24.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; class day24 { private record DistancesState(int r, int c, int dist) { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DistancesState distancesState = (DistancesState) o; return r == distancesState.r && c == distancesState.c; } @Override public int hashCode() { return Objects.hash(r, c); } } private static int[][] getDistanceBetweenLocations(String[] grid) { HashMap<Integer, int[]> numLocations = new HashMap<>(); for (int r = 0; r < grid.length; r++) { for (int c = 0; c < grid[0].length(); c++) { char ch = grid[r].charAt(c); if (Character.isDigit(ch)) numLocations.put(ch - '0', new int[]{r, c}); } } int[][] dists = new int[numLocations.size()][numLocations.size()]; int[][] dirs = new int[][]{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; for (int i = 0; i < numLocations.size(); i++) { ArrayDeque<DistancesState> q = new ArrayDeque<>(); HashSet<DistancesState> visited = new HashSet<>(); int[] startPos = numLocations.get(i); q.add(new DistancesState(startPos[0], startPos[1], 0)); while (!q.isEmpty()) { var cur = q.remove(); if (!visited.add(cur)) continue; char ch = grid[cur.r].charAt(cur.c); if (Character.isDigit(ch)) dists[i][ch - '0'] = cur.dist; for (int[] dir : dirs) { int nr = cur.r + dir[0]; int nc = cur.c + dir[1]; if (nr < 0 || nc < 0 || nr >= grid.length || nc >= grid[0].length() || grid[nr].charAt(nc) == '#') continue; q.add(new DistancesState(nr, nc, cur.dist + 1)); } } } return dists; } private record ShortestPathState(int node, int dist, HashSet<Integer> visited, boolean returning) { } private static int getShortestDist(int[][] dists, boolean shouldReturn) { PriorityQueue<ShortestPathState> q2 = new PriorityQueue<>(Comparator.comparingInt(o -> o.dist)); q2.add(new ShortestPathState(0, 0, new HashSet<>(), false)); while (!q2.isEmpty()) { ShortestPathState cur = q2.remove(); if (!cur.visited.add(cur.node)) continue; boolean returning = cur.returning; if (cur.visited.size() == dists.length) { if (!shouldReturn || returning) return cur.dist; returning = true; cur.visited.remove(0); } for (int i = 0; i < dists.length; i++) { var tmp = (HashSet<Integer>) cur.visited.clone(); q2.add(new ShortestPathState(i, cur.dist + dists[cur.node][i], tmp, returning)); } } return -1; } private static int part1(String[] grid) { return getShortestDist(getDistanceBetweenLocations(grid), false); } private static int part2(String[] grid) { return getShortestDist(getDistanceBetweenLocations(grid), true); } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] grid = reader.lines().toArray(String[]::new); System.out.println(part1(grid)); System.out.println(part2(grid)); } } --- 2016/day25.java --- import java.io.BufferedReader; import java.io.InputStreamReader; class day25 { private static int part1(String[] instructions) { // Running the instructions infinitely prints the binary // representation of 'a + MAGIC_NUMBER' after each other. // // 1: while(true) { // 2: n = a + MAGIC_NUMBER; // 3: while(n != 0) { // 4: print(n % 2); // 5: n /= 2; // 6: } // 7: } int x = Integer.parseInt(instructions[1].split(" ")[1]); int y = Integer.parseInt(instructions[2].split(" ")[1]); String magicBinary = Integer.toBinaryString(x * y); String desiredBinary = "10".repeat(magicBinary.length() / 2); return Integer.parseUnsignedInt(desiredBinary, 2) - Integer.parseInt(magicBinary, 2); } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] instruction = reader.lines().toArray(String[]::new); System.out.println(part1(instruction)); } } --- 2016/day3.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; class day3 { private static boolean isValidTriangle(Integer[] sides) { return sides[0] + sides[1] > sides[2] && sides[0] + sides[2] > sides[1] && sides[1] + sides[2] > sides[0]; } private static long part1(Integer[][] lines) { return Arrays.stream(lines).filter(day3::isValidTriangle).count(); } private static long part2(Integer[][] lines) { int cnt = 0; for (int i = 0; i < lines.length; i += 3) for (int j = 0; j < 3; ++j) if (isValidTriangle(new Integer[]{lines[i][j], lines[i + 1][j], lines[i + 2][j]})) cnt += 1; return cnt; } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); var lines = reader.lines() .map(str -> str.trim().split("\\s+")) .map(arr -> Arrays.stream(arr).map(Integer::parseInt).toArray(Integer[]::new)) .toArray(Integer[][]::new); System.out.println(part1(lines)); System.out.println(part2(lines)); } } --- 2016/day4.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; class day4 { private static boolean isRealRoom(String encryptedName) { var split = encryptedName.split("[\\[\\]]"); String data = split[0]; String checksum = split[1]; HashMap<Character, Integer> charCount = new HashMap<>(); for (char c : data.toCharArray()) { if (Character.isAlphabetic(c)) { int cnt = charCount.getOrDefault(c, 0); charCount.put(c, cnt + 1); } } String expectedChecksum = charCount.entrySet().stream() .sorted((lhs, rhs) -> Objects.equals(lhs.getValue(), rhs.getValue()) ? lhs.getKey().compareTo(rhs.getKey()) : rhs.getValue() - lhs.getValue()) .limit(5) .map(e -> e.getKey().toString()) .collect(Collectors.joining()); return expectedChecksum.equals(checksum); } private static int extractSectorID(String encryptedName) { Pattern pattern = Pattern.compile("([0-9]+)"); Matcher matcher = pattern.matcher(encryptedName); if (matcher.find()) return Integer.parseInt(matcher.group(1)); throw new IllegalStateException(); } private static String decryptRoomName(String encryptedName) { int id = extractSectorID(encryptedName); var chars = encryptedName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (Character.isDigit(c)) break; if (c == '-') { chars[i] = ' '; continue; } for (int j = 0; j < id; j++) { c += 1; if (c > 'z') c = 'a'; } chars[i] = c; } return new String(chars); } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); var lines = reader.lines().toList(); var part1 = lines.stream() .filter(day4::isRealRoom) .mapToInt(day4::extractSectorID) .sum(); var part2 = lines.stream() .filter(day4::isRealRoom) .map(day4::decryptRoomName) .filter(s -> s.startsWith("northpole object storage")) .mapToInt(day4::extractSectorID) .sum(); System.out.println(part1); System.out.println(part2); } } --- 2016/day5.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; class day5 { private static String crackPassword(String id, boolean part2) throws NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("MD5"); char[] password = new char[8]; boolean[] cracked = new boolean[8]; int knownCharacters = 0; int idx = 0; while (knownCharacters < 8) { md5.update(StandardCharsets.UTF_8.encode(id + idx)); var hash = String.format("%032x", new BigInteger(1, md5.digest())); if (hash.startsWith("00000")) { char currentChar = part2 ? hash.charAt(6) : hash.charAt(5); int currentCharIdx = part2 ? hash.charAt(5) - '0' : knownCharacters; if (currentCharIdx >= 0 && currentCharIdx <= 7 && !cracked[currentCharIdx]) { System.err.printf("Found %d. character: '%c'\n", currentCharIdx + 1, currentChar); password[currentCharIdx] = currentChar; cracked[currentCharIdx] = true; ++knownCharacters; } } ++idx; } return new String(password); } public static void main(String[] args) throws NoSuchAlgorithmException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String id = reader.readLine(); System.out.println(crackPassword(id, false)); System.out.println(crackPassword(id, true)); } } --- 2016/day6.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.IntStream; class day6 { public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] lines = reader.lines().toArray(String[]::new); ArrayList<ArrayList<Character>> columns = new ArrayList<>(); for (int i = 0; i < lines[0].length(); i++) columns.add(new ArrayList<>()); for (String line : lines) IntStream.range(0, line.length()).forEach(i -> columns.get(i).add(line.charAt(i))); String part1 = columns.stream() .map(c -> c.stream() .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())) .entrySet() .stream() .max(Map.Entry.comparingByValue()) .map(Map.Entry::getKey) .orElse(' ')) .map(Object::toString) .collect(Collectors.joining()); String part2 = columns.stream() .map(c -> c.stream() .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())) .entrySet() .stream() .min(Map.Entry.comparingByValue()) .map(Map.Entry::getKey) .orElse(' ')) .map(Object::toString) .collect(Collectors.joining()); System.out.println(part1); System.out.println(part2); } } --- 2016/day7.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.stream.IntStream; class day7 { private static boolean hasAbba(String str) { if (str.length() < 4) return false; int start = 0; int end = start + 3; char[] chars = str.toCharArray(); while (end < str.length()) { if (chars[start] == chars[end] && chars[start + 1] == chars[end - 1] && chars[start] != chars[start + 1]) return true; ++start; ++end; } return false; } private static ArrayList<String> getAbas(String str) { ArrayList<String> abas = new ArrayList<>(); if (str.length() < 3) return abas; int start = 0; int end = start + 2; char[] chars = str.toCharArray(); while (end < str.length()) { if (chars[start] == chars[end] && chars[start] != chars[start + 1]) abas.add(str.substring(start, end + 1)); ++start; ++end; } return abas; } private static String toBab(String aba) { char[] chars = aba.toCharArray(); chars[0] = chars[1]; chars[1] = chars[2]; chars[2] = chars[0]; return new String(chars); } private static long part1(String[] lines) { return Arrays.stream(lines) .map(l -> l.split("[\\[\\]]")) .filter(a -> IntStream.range(0, a.length) .filter(i -> i % 2 == 0).mapToObj(i -> a[i]) .anyMatch(day7::hasAbba)) .filter(a -> IntStream.range(0, a.length) .filter(i -> i % 2 == 1) .mapToObj(i -> a[i]) .noneMatch(day7::hasAbba)) .count(); } private static long part2(String[] lines) { int cnt = 0; for(String line : lines) { String[] split = line.split("[\\[\\]]"); ArrayList<String> abas = new ArrayList<>(); ArrayList<String> babs = new ArrayList<>(); for (int i = 0; i < split.length; i++) { ArrayList<String> extractedAbas = getAbas(split[i]); if(i % 2 == 0) abas.addAll(extractedAbas); else babs.addAll(extractedAbas); } if(abas.stream().anyMatch(aba -> babs.stream().anyMatch(bab -> bab.equals(toBab(aba))))) ++cnt; } return cnt; } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] lines = reader.lines().toArray(String[]::new); System.out.println(part1(lines)); System.out.println(part2(lines)); } } --- 2016/day8.java --- import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.stream.IntStream; class day8 { private static void rotateRow(boolean[][] screen, int r, int n) { boolean[] tmp = new boolean[screen[r].length]; for (int i = 0; i < tmp.length; i++) tmp[(i + n) % tmp.length] = screen[r][i]; screen[r] = tmp; } private static void rotateCol(boolean[][] screen, int c, int n) { boolean[] tmp = new boolean[screen.length]; for (int i = 0; i < tmp.length; i++) tmp[(i + n) % tmp.length] = screen[i][c]; for (int i = 0; i < tmp.length; i++) screen[i][c] = tmp[i]; } private static void rect(boolean[][] screen, int w, int h) { for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) screen[i][j] = true; } private static long part1(boolean[][] screen, String[] lines) { for (String line : lines) { String[] split = line.split(" "); if (split[0].equals("rect")) { var vals = Arrays.stream(split[1].split("x")) .map(Integer::parseInt) .toArray(Integer[]::new); rect(screen, vals[0], vals[1]); } else if (split[0].equals("rotate")) { int target = Integer.parseInt(split[2].split("=")[1]); int n = Integer.parseInt(split[4]); if (split[1].equals("row")) rotateRow(screen, target, n); else rotateCol(screen, target, n); } } return Arrays.stream(screen) .map(l -> IntStream.range(0, l.length) .filter(i -> l[i]) .count()) .reduce(0L, Long::sum); } private static void part2(boolean[][] screen) { for (var r : screen) { for (var c : r) { if (c) System.out.print('O'); else System.out.print(' '); } System.out.println(); } } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] lines = reader.lines().toArray(String[]::new); boolean[][] screen = new boolean[6][50]; System.out.println(part1(screen, lines)); part2(screen); } } --- 2016/day9.java --- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class day9 { private static long length(String line, boolean recursive) { long length = 0; for (int i = 0; i < line.length(); ++i) { if (line.charAt(i) == '(') { int end = line.indexOf(')', i); String expandPattern = line.substring(i + 1, end); String[] vals = expandPattern.split("x"); int amount = Integer.parseInt(vals[0]); int repeat = Integer.parseInt(vals[1]); String pattern = line.substring(end + 1, end + amount + 1); long patternLength = (recursive ? length(pattern, true) : pattern.length()); length += patternLength * repeat; i = end + amount; continue; } ++length; } return length; } private static long part1(String line) { return length(line, false); } private static long part2(String line) { return length(line, true); } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String line = reader.readLine(); System.out.println(part1(line)); System.out.println(part2(line)); } } --- 2022/.gitignore --- .DS_Store /.build /Packages xcuserdata/ DerivedData/ .swiftpm/configuration/registries.json .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc --- 2022/Package.swift --- // swift-tools-version: 5.9 import PackageDescription let package = Package( name: "2022", targets: [ .executableTarget(name: "day1"), .executableTarget(name: "day2"), .executableTarget(name: "day3"), .executableTarget(name: "day4"), .executableTarget(name: "day5"), .executableTarget(name: "day6"), .executableTarget(name: "day7"), .executableTarget(name: "day8"), .executableTarget(name: "day9"), .executableTarget(name: "day10"), .executableTarget(name: "day11"), .executableTarget(name: "day12"), .executableTarget(name: "day13"), .executableTarget(name: "day14"), .executableTarget(name: "day15"), .executableTarget(name: "day16"), .executableTarget(name: "day17"), .executableTarget(name: "day18"), ] ) --- 2022/Sources/day1/main.swift --- func part1(calories: [Int]) -> Int { calories.max()! } func part2(calories: [Int]) -> Int { calories.sorted().suffix(3).reduce(0, +) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } let calories = lines.split(separator: "").map { group in group.map { line in Int(line)! }.reduce(0, +) } print(part1(calories: calories)) print(part2(calories: calories)) --- 2022/Sources/day10/main.swift --- func part1(cycles: [Int]) -> Int { stride(from: 20, through: 220, by: 40).map { $0 * cycles[$0 - 1] }.reduce(0, +) } func part2(cycles: [Int]) { for r in 0...5 { for c in 0...39 { let m = cycles[r * 40 + c] print(m - 1 <= c && c <= m + 1 ? "#" : ".", terminator: "") } print() } } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } var sim: [Int] = [1] for line in lines { let split = line.split(separator: " ") sim.append(sim.last!) if split[0] == "addx" { sim.append(sim.last! + Int(split[1])!) } } print(part1(cycles: sim)) part2(cycles: sim) --- 2022/Sources/day11/main.swift --- class Monkey { var items: [Int] let op: (Int) -> Int let test: (Int, Int, Int) init(items: [Int], op: @escaping (Int) -> Int, test: (Int, Int, Int)) { self.items = items self.op = op self.test = test } } func extractNumbersFromStr(_ str: String) -> [Int] { let regex = try! Regex("[0-9]+") return str.ranges(of: regex).map { Int(str[$0])! } } func parseMonkey(data: [String]) -> Monkey { let items = extractNumbersFromStr(data[1]) let operation = data[2].split(separator: "=")[1].trimmingPrefix { $0.isWhitespace } let opParts = operation.split(separator: " ") let op: (Int) -> Int = switch opParts[1] { case "+": { $0 + Int(opParts[2])! } case "*": opParts[2] == "old" ? { $0 * $0 } : { $0 * Int(opParts[2])! } default: { $0 } } let test = extractNumbersFromStr(data[3])[0] let pass = extractNumbersFromStr(data[4])[0] let fail = extractNumbersFromStr(data[5])[0] return Monkey(items: items, op: op, test: (test, pass, fail)) } func simulateMonkeyBusines(monkeys: [Monkey], rounds: Int, worryLevelTransform: (Int) -> Int) -> [Int] { var monkeyBusiness = Array(repeating: 0, count: monkeys.count) for _ in 1...rounds { for (id, monkey) in monkeys.enumerated() { while !monkey.items.isEmpty { let worryLevel = monkey.items.removeFirst() let newWorryLevel = worryLevelTransform(monkey.op(worryLevel)) let (c, t, f) = monkey.test monkeyBusiness[id] += 1 monkeys[newWorryLevel % c == 0 ? t : f].items.append(newWorryLevel) } } } return monkeyBusiness } func part1(monkeys: [Monkey]) -> Int { return simulateMonkeyBusines(monkeys: monkeys, rounds: 20) { $0 / 3 }.sorted().suffix(2).reduce(1, *) } func part2(monkeys: [Monkey]) -> Int { return simulateMonkeyBusines(monkeys: monkeys, rounds: 10000) { $0 % monkeys.map { $0.test.0 }.reduce(1, *) }.sorted().suffix(2).reduce(1, *) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } let monkeyDatas = lines.split { $0.isEmpty }.map { Array($0) } print(part1(monkeys: monkeyDatas.map { parseMonkey(data: $0) })) print(part2(monkeys: monkeyDatas.map { parseMonkey(data: $0) })) --- 2022/Sources/day12/main.swift --- func part1(grid: [[Int]], start: (Int, Int), end: (Int, Int)) -> Int { var q = [(start, 0)] var visited = Set<[Int]>() while !q.isEmpty { let ((r, c), s) = q.removeFirst() if (r, c) == end { return s } if !visited.insert([r, c]).inserted { continue } for (vr, vc) in [(-1, 0), (1, 0), (0, -1), (0, 1)] { let nr = r + vr let nc = c + vc if nr < 0 || nr >= grid.count || nc < 0 || nc >= grid[r].count { continue } if grid[nr][nc] - grid[r][c] <= 1 { q.append(((nr, nc), s + 1)) } } } return Int.max } func part2(grid: [[Int]], start: (Int, Int), end: (Int, Int)) -> Int { var minimum = Int.max for (ri, r) in grid.enumerated() { for (ci, _) in r.enumerated() { if grid[ri][ci] == 0 { minimum = min(minimum, part1(grid: grid, start: (ri, ci), end: end)) } } } return minimum } var grid: [[Int]] = [] var start: (Int, Int) = (-1, -1) var end: (Int, Int) = (-1, -1) var l = 0 while let line = readLine() { grid.append(line.enumerated().map { (idx, c) in var cur = c if cur == "S" { start = (l, idx) cur = "a" } else if cur == "E" { end = (l, idx) cur = "z" } return Int(cur.unicodeScalars.first!.value - UnicodeScalar("a").value) }) l += 1 } print(part1(grid: grid, start: start, end: end)) print(part2(grid: grid, start: start, end: end)) --- 2022/Sources/day13/main.swift --- protocol Node { func isBefore(other: Node) -> Bool? } class List: Node { var children: [Node] = [] init(children: [Node]) { self.children = children } func isBefore(other: Node) -> Bool? { if let otherList = other as? List { for (idx, child) in children.enumerated() { if idx >= otherList.children.count { return false } if let res = child.isBefore(other: otherList.children[idx]) { return res } } return children.count == otherList.children.count ? nil : true } return isBefore(other: List(children: [other as! Value])) } } class Value: Node { var value: Int = 0 init(value: Int) { self.value = value } func isBefore(other: Node) -> Bool? { if let otherVal = other as? Value { return value == otherVal.value ? nil : value < otherVal.value } return List(children: [self]).isBefore(other: other) } } func parse(str: [Character]) -> Node? { var idx = 0 return parsePrimary(str: str, idx: &idx) } // list|value func parsePrimary(str: [Character], idx: inout Int) -> Node? { if str[idx] == "[" { return parseList(str: str, idx: &idx) } return parseValue(str: str, idx: &idx) } // [0-9]+ func parseValue(str: [Character], idx: inout Int) -> Node? { let val = String(str.dropFirst(idx).prefix { $0.isWholeNumber }) idx += val.count return val.isEmpty ? nil : Value(value: Int(val)!) } // '['(primary(,primary)*)?']' func parseList(str: [Character], idx: inout Int) -> Node? { idx += 1 // eat '[' var children: [Node] = [] if let p = parsePrimary(str: str, idx: &idx) { children.append(p) while str[idx] == "," { idx += 1 // eat ',' if let np = parsePrimary(str: str, idx: &idx) { children.append(np) } else { return nil } } } idx += 1 // eat ']' return List(children: children) } func part1(lines: [String]) -> Int { lines.split { $0.isEmpty }.enumerated().filter { (_, pair) in let p1 = parse(str: pair.first!.dropLast(0))! let p2 = parse(str: pair.last!.dropLast(0))! return p1.isBefore(other: p2)! }.reduce(0) { (acc, p) in acc + p.0 + 1} } func part2(lines: [String]) -> Int { let placeholders = ["[[2]]", "[[6]]"] let tmp = lines + placeholders let sorted = tmp.filter { !$0.isEmpty } .map { ($0, parse(str: $0.dropLast(0))!) } .sorted { $0.1.isBefore(other: $1.1)! } return sorted.enumerated().filter { placeholders.contains($0.1.0) } .reduce(1) { $0 * ($1.0 + 1) } } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } print(part1(lines: lines)) print(part2(lines: lines)) --- 2022/Sources/day14/main.swift --- func simulate(grid: inout [[String]], start: [Int]) -> Bool { var coords = (start[0], start[1]) if(grid[coords.1][coords.0] != ".") { return false } while true { var placed = false for vc in [(0, 1), (-1, 1), (1, 1)] { let nx = coords.0 + vc.0 let ny = coords.1 + vc.1 if ny >= grid.count || nx < 0 || nx >= grid[ny].count { return false } if grid[ny][nx] == "." { placed = true coords = (nx, ny) break } } if !placed { grid[coords.1][coords.0] = "o" return true } } } func solve(lines: [String], floor: Bool) -> Int { let rocks = lines.map { $0.split(separator: " -> ").map { $0.split(separator: ",").map { Int($0)! } } } let xVals = rocks.flatMap { $0.map { $0[0] } } let xBoundary = (xVals.min()!, xVals.max()!) let yMax = rocks.flatMap { $0.map { $0[1] } }.max()! let xExtent = yMax + 2 let row = Array(repeating: ".", count: xBoundary.1 - xBoundary.0 + 1 + 2 * xExtent) var map = Array(repeating: row, count: yMax + 1) if floor { map.append(contentsOf: [row, row.map { _ in "#" }]) } for points in rocks { for i in 0..<points.count - 1 { var p1 = points[i] var p2 = points[i + 1] let ci = p1[1] != p2[1] ? 1 : 0 if p1[ci] > p2[ci] { swap(&p1, &p2) } for n in p1[ci]...p2[ci] { let x = ci == 1 ? p1[0] : n let y = ci == 1 ? n : p1[1] map[y][x - xBoundary.0 + xExtent] = "#" } } } return (0...).first(where: ) { _ in !simulate(grid: &map, start: [500 - xBoundary.0 + xExtent, 0]) }! } func part1(lines: [String]) -> Int { solve(lines: lines, floor: false) } func part2(lines: [String]) -> Int { solve(lines: lines, floor: true) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } print(part1(lines: lines)) print(part2(lines: lines)) --- 2022/Sources/day15/main.swift --- func coveredXRanges(beacons: [(Int, Int, Int)], y: Int) -> [(Int, Int)] { var coveredXRanges: [(Int, Int)] = [] for beacon in beacons { let yDist = abs(beacon.1 - y) let xDiff = beacon.2 - yDist if xDiff >= 0 { var beaconCovered = (beacon.0 - xDiff, beacon.0 + xDiff) var tmpRanges: [(Int, Int)] = [] for range in coveredXRanges { let b = max(range.0, beaconCovered.0) let e = min(range.1, beaconCovered.1) if b <= e { beaconCovered.0 = min(range.0, beaconCovered.0) beaconCovered.1 = max(range.1, beaconCovered.1) } else { tmpRanges.append(range) } } tmpRanges.append(beaconCovered) coveredXRanges = tmpRanges } } return coveredXRanges } func part1(beacons: [(Int, Int, Int)]) -> Int { return coveredXRanges(beacons: beacons, y: 2000000).map { $0.1 - $0.0 }.reduce(0, +) } func part2(beacons: [(Int, Int, Int)]) -> Int { for y in 0...4000000 { let ranges = coveredXRanges(beacons: beacons, y: y) if ranges.count > 1 { let x = ranges.sorted { $0.0 < $1.0 }[0].1 + 1 return x * 4000000 + y } } return 0 } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } var beacons: [(Int, Int, Int)] = lines.map { str in str.ranges(of: try! Regex("(-?[0-9]+)")).map { Int(str[$0])! } }.map { ($0[0], $0[1], abs($0[0] - $0[2]) + abs($0[1] - $0[3])) } print(part1(beacons: beacons)) print(part2(beacons: beacons)) --- 2022/Sources/day16/main.swift --- // This could benefit from memoization, but caching the values resultee in slower runtime. func maxFlow(curValve: Int, time: Int, openValves: Int, valveSet: Int) -> Int { var newFlow = 0 for (valve, dist) in adjacentValves[curValve]! { let valveBit = (1 << valve) let newTime = time - dist - 1 if newTime < 0 || (openValves & valveBit) != 0 || (valveSet & valveBit) == 0 { continue } newFlow = max(newFlow, newTime * flowRate[valve] + maxFlow( curValve: valve, time: newTime, openValves: openValves | valveBit, valveSet: valveSet )) } return newFlow } func part1(lines: [String]) -> Int { return maxFlow(curValve: nodeToIdx["AA"]!, time: 30, openValves: 0, valveSet: ~0) } func part2(lines: [String]) -> Int { var out = 0 for i in 0..<(1 << adjacentValves.count) / 2 { let valveSubset = adjacentValves.enumerated() .filter { (1 << $0.offset) & i != 0} .map { 1 << $0.element.key} .reduce(0, |) let AAIdx = nodeToIdx["AA"]! out = max(out, maxFlow(curValve: AAIdx, time: 26, openValves: 0, valveSet: valveSubset | AAIdx) + maxFlow(curValve: AAIdx, time: 26, openValves: 0, valveSet: ~valveSubset | AAIdx) ) } return out } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } let regex = try! Regex("[A-Z][A-Z]|[0-9]+") var nodeToIdx: [String: Int] = [:] var flowRate: [Int] = [] for line in lines { let ranges = line.ranges(of: regex) let node = String(line[ranges[0]]) let idx = flowRate.count nodeToIdx[node] = idx flowRate.append(Int(line[ranges[1]])!) } var neighbours: [[(Int, Int)]] = Array(repeating: [], count: nodeToIdx.count) for line in lines { let ranges = line.ranges(of: regex) let idx = nodeToIdx[String(line[ranges[0]])]! ranges.dropFirst(2).forEach { let neighbourIdx = nodeToIdx[String(line[$0])]! neighbours[idx] += [(neighbourIdx, 1)] } } var adjacentValves: [Int: [(Int, Int)]] = [:] for node in 0..<neighbours.count { var q: [(Int, Int)] = [(node, 0)] var visited = Set<Int>() if flowRate[node] == 0 && node != nodeToIdx["AA"] { continue } adjacentValves[node] = [] while !q.isEmpty { let (firstNode, dist) = q.removeFirst() if !visited.insert(firstNode).inserted { continue } if (flowRate[firstNode] != 0 || firstNode == nodeToIdx["AA"]) && firstNode != node { adjacentValves[node]!.append((firstNode, dist)) } for (n, d) in neighbours[firstNode] { q.append((n, d + dist)) } } } print(part1(lines: lines)) print(part2(lines: lines)) --- 2022/Sources/day17/main.swift --- let rocks = [ ["####"], [".#.", "###", ".#."], ["..#", "..#", "###"], ["#", "#", "#", "#"], ["##", "##"] ] func fillPattern(chamber: inout [[Character]], pattern: [String], bottomLeftXY: (Int, Int), fill: Character) { for (row, r) in pattern.reversed().enumerated() { for (col, ch) in r.enumerated() { if ch != "#" { continue } let ri = bottomLeftXY.1 + row let ci = bottomLeftXY.0 + col chamber[ri][ci] = fill } } } func isPatternBlocked(chamber: [[Character]], pattern: [String], bottomLeftXY: (Int, Int)) -> Bool { for (row, r) in pattern.reversed().enumerated() { for (col, ch) in r.enumerated() { if ch != "#" { continue } let ri = bottomLeftXY.1 + row let ci = bottomLeftXY.0 + col if chamber[ri][ci] == "#" { return true } } } return false } struct State : Hashable { var topRow: [Character] var rock: Int } func solve(pattern: [Character], nrOfRocks: Int) -> Int { var cycles: [State:(Int, Int)] = [:] var chamber: [[Character]] = [] var height = 0 var highestPoint = 0 var curRock = 0 var curSteam = 0 var n = 0 while n < nrOfRocks { let rock = rocks[curRock] var rockBottomLeftCorner = (2, highestPoint + 3) // Add 3 lines and pretend that the rock is added too, no need to fill it now. chamber.append(contentsOf: Array(repeating: Array(repeating: ".", count: 7), count: 3 + rock.count)) while true { let shiftX = pattern[curSteam] == ">" ? 1 : -1 let shiftedPos = (rockBottomLeftCorner.0 + shiftX, rockBottomLeftCorner.1); if shiftedPos.0 >= 0 && shiftedPos.0 + rock[0].count <= chamber[0].count && !isPatternBlocked(chamber: chamber, pattern: rock, bottomLeftXY: shiftedPos) { rockBottomLeftCorner = shiftedPos } curSteam = (curSteam + 1) % pattern.count if curSteam == 0 { let state = State(topRow: chamber[highestPoint - 1], rock: curRock) if let (prevHighest, prevN) = cycles[state] { let cycleHeight = highestPoint - prevHighest let cycleLength = n - prevN let remainingRocks = nrOfRocks - n let remainingCycles = remainingRocks / cycleLength height += cycleHeight * remainingCycles n = prevN + cycleLength * (remainingCycles + 1) } cycles[state] = (highestPoint, n) } let fallenPos = (rockBottomLeftCorner.0, rockBottomLeftCorner.1 - 1) if fallenPos.1 < 0 || isPatternBlocked(chamber: chamber, pattern: rock, bottomLeftXY: fallenPos) { break } rockBottomLeftCorner = fallenPos } fillPattern(chamber: &chamber, pattern: rock, bottomLeftXY: rockBottomLeftCorner, fill: "#") let newHighestPoint = (max(highestPoint, rockBottomLeftCorner.1 + rock.count)) height += newHighestPoint - highestPoint highestPoint = newHighestPoint curRock = (curRock + 1) % rocks.count chamber.removeLast(chamber.count - highestPoint) n += 1 } return height } func part1(pattern: [Character]) -> Int { solve(pattern: pattern, nrOfRocks: 2022) } func part2(pattern: [Character]) -> Int { solve(pattern: pattern, nrOfRocks: 1000000000000) } let pattern = Array(readLine()!) print(part1(pattern: pattern)) print(part2(pattern: pattern)) --- 2022/Sources/day18/main.swift --- let dirs = [(1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, -1, 0), (0, 0, 1), (0, 0, -1)] func inBounds(grid: [[[Int]]], coord: (Int, Int, Int)) -> Bool { coord.0 >= 0 && coord.0 < grid.count && coord.1 >= 0 && coord.1 < grid[0].count && coord.2 >= 0 && coord.2 < grid[0][0].count } func calculateSurfaceArea(_ grid: [[[Int]]]) -> Int { let (mx, my, mz) = (grid.count, grid[0].count, grid[0][0].count) var area = 0 for x in 0..<mx { for y in 0..<my { for z in 0..<mz { if grid[x][y][z] == 0 { continue } for (dx, dy, dz) in dirs { let (nx, ny, nz) = (x + dx, y + dy, z + dz) if inBounds(grid: grid, coord: (nx, ny, nz)) && grid[nx][ny][nz] == 1 { continue } area += 1 } } } } return area } func part1(grid: [[[Int]]]) -> Int { calculateSurfaceArea(grid) } func part2(grid: [[[Int]]]) -> Int { var excavatedDroplet = grid.map { $0.map { $0.map { _ in 1 } } } var q = [(0, 0, 0)] while !q.isEmpty { let (x, y, z) = q.removeFirst() if excavatedDroplet[x][y][z] != 1 { continue } excavatedDroplet[x][y][z] = 0 for (dx, dy, dz) in dirs { let (nx, ny, nz) = (x + dx, y + dy, z + dz) if inBounds(grid: grid, coord: (nx, ny, nz)) && grid[nx][ny][nz] == 0 { q.append((nx, ny, nz)) } } } return calculateSurfaceArea(excavatedDroplet) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } let intCoords = lines.map { str in str.split(separator: ",").map { Int($0)! } } let maxX = intCoords.map { $0[0] }.max()! + 1 let maxY = intCoords.map { $0[1] }.max()! + 1 let maxZ = intCoords.map { $0[2] }.max()! + 1 var grid = Array(repeating: Array(repeating: Array(repeating: 0, count: maxZ), count: maxY), count: maxX) intCoords.forEach { grid[$0[0]][$0[1]][$0[2]] = 1 } print(part1(grid: grid)) print(part2(grid: grid)) --- 2022/Sources/day2/main.swift --- func calculateScore(s1: UInt32, s2: UInt32) -> UInt32 { var score = s2 + 1 if s1 == s2 { score += 3 } else if (s2 > s1 && (s1 != 0 || s2 != 2)) || (s2 == 0 && s1 == 2) { score += 6 } return score } func part1(lines: [String]) -> UInt32 { lines.map { line in let signs = line.split(separator: " ") let s1 = signs[0].unicodeScalars.first!.value - UnicodeScalar("A").value let s2 = signs[1].unicodeScalars.first!.value - UnicodeScalar("X").value return calculateScore(s1: s1, s2: s2) }.reduce(0, +) } func part2(lines: [String]) -> UInt32 { lines.map { line in let signs = line.split(separator: " ") let s1 = signs[0].unicodeScalars.first!.value - UnicodeScalar("A").value var s2: UInt32 = 0 switch signs[1] { case "X": s2 = s1 == 0 ? 2 : s1 - 1 case "Y": s2 = s1 case "Z": s2 = (s1 + 1) % 3 default: assert(false, "unreachable") } return calculateScore(s1: s1, s2: s2) }.reduce(0, +) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } print(part1(lines: lines)) print(part2(lines: lines)) --- 2022/Sources/day3/main.swift --- func calculateScore(c: Character) -> Int { switch c { case "a"..."z": return Int(c.unicodeScalars.first!.value - UnicodeScalar("a").value + 1) case "A"..."Z": return Int(c.unicodeScalars.first!.value - UnicodeScalar("A").value + 27) default: assertionFailure() return 0 } } func part1(lines: [String]) -> Int { lines.map { line in let s1 = Set(line.prefix(line.count / 2)) let s2 = Set(line.suffix(line.count / 2)) let intersection = s1.intersection(s2) assert(intersection.count == 1) return calculateScore(c: intersection.first!) }.reduce(0, +) } func part2(lines: [String]) -> Int { stride(from: 0, to: lines.count, by: 3).map { i in let s1 = Set(lines[i]) let s2 = Set(lines[i+1]) let s3 = Set(lines[i+2]) let intersection = s1.intersection(s2).intersection(s3) assert(intersection.count == 1) return calculateScore(c: intersection.first!) }.reduce(0,+) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } print(part1(lines: lines)) print(part2(lines: lines)) --- 2022/Sources/day4/main.swift --- func part1(ranges: [(ClosedRange<Int>, ClosedRange<Int>)]) -> Int { ranges.map { (r1, r2) in (r1.contains(r2) || r2.contains(r1)) ? 1 : 0 }.reduce(0, +) } func part2(ranges: [(ClosedRange<Int>, ClosedRange<Int>)]) -> Int { ranges.map { (r1, r2) in r1.overlaps(r2) ? 1 : 0 }.reduce(0, +) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } let ranges = lines.map { line in let nums = line.ranges(of: try! Regex("[0-9]+")).map { Int(line[$0])! } return (nums[0]...nums[1], nums[2]...nums[3]) } print(part1(ranges: ranges)) print(part2(ranges: ranges)) --- 2022/Sources/day5/main.swift --- func part1(_ crates: [[Character]], _ instructions: [[Int]]) -> String { var newCrates = crates // inst: [repeat, from, to], indexed from 1 for inst in instructions { for _ in 0..<inst[0] { newCrates[inst[2] - 1].append(newCrates[inst[1] - 1].popLast()!) } } return String(newCrates.compactMap { $0.last }) } func part2(_ crates: [[Character]], _ instructions: [[Int]]) -> String { var newCrates = crates // inst: [repeat, from, to], indexed from 1 for inst in instructions { var tmp = [Character]() for _ in 0..<inst[0] { tmp.append(newCrates[inst[1] - 1].popLast()!) } for _ in 0..<inst[0] { newCrates[inst[2] - 1].append(tmp.popLast()!) } } return String(newCrates.compactMap { $0.last }) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } let split = lines.split(separator: "") let regex = try! Regex("[0-9]+") let drawing = split[0].dropLast() let instructions = split[1].map { l in l.ranges(of: regex).map { Int(l[$0])! } } let numberLine = split[0].last!; let columns = Int(numberLine[numberLine.ranges(of: regex).last!])! var crates = [[Character]](repeating: [], count: columns) for line in drawing.reversed() { for i in 0..<columns { let cur = line[line.index(line.startIndex, offsetBy: i * 4 + 1)] if !cur.isWhitespace { crates[i].append(cur) } } } print(part1(crates, instructions)) print(part2(crates, instructions)) --- 2022/Sources/day6/main.swift --- func eatUntilNDistinct(_ line: String, _ distinct: Int) -> Int { var window = line.prefix(distinct) var n = distinct; while true { if Set(window).count == distinct { return n; } let _ = window.popFirst() window.append(line[line.index(line.startIndex, offsetBy: n)]) if(n >= line.count) { return -1 } n += 1 } } func part1(_ line: String) -> Int { eatUntilNDistinct(line, 4) } func part2(_ line: String) -> Int { eatUntilNDistinct(line, 14) } let line = readLine()! print(part1(line)) print(part2(line)) --- 2022/Sources/day7/main.swift --- class Directory { let name: String let parent: Directory? var fileSize: UInt64 = 0 var subdirs: [Directory] = [] init(name: String, parent: Directory?) { self.name = name self.parent = parent } func size() -> UInt64 { subdirs.reduce(0, { $0 + $1.size() }) + fileSize } } func parseFileSystem(_ commands: [String]) -> Directory { let root = Directory(name: "/", parent: nil) var curDir = root for command in commands { let split = command.split(separator: " ") switch split[0] { case "$": if split[1] == "cd" { if split[2] == ".." { curDir = curDir.parent! } else { curDir = curDir.subdirs.first { $0.name == split[2] } ?? curDir } } case "dir": curDir.subdirs.append(Directory(name: String(split[1]), parent: curDir)) default: curDir.fileSize += UInt64(split[0])! } } return root } func part1(_ dir: Directory) -> UInt64 { var size: UInt64 = dir.size() < 100000 ? dir.size() : 0 for subdir in dir.subdirs { size += part1(subdir) } return size } func part2(_ dir: Directory, _ limit: UInt64) -> UInt64 { var size: UInt64 = dir.size() > limit ? dir.size() : 70000000 for subdir in dir.subdirs { size = min(size, part2(subdir, limit)) } return size } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } let root = parseFileSystem(lines) print(part1(root)) print(part2(root, 30000000 - (70000000 - root.size()))) --- 2022/Sources/day8/main.swift --- let dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)] func walk(grid: [[Int]], elem: (Int, Int), dir: (Int, Int)) -> (Bool, Int) { var (r, c) = elem let (vr, vc) = dir var steps = 0 while true { r = r + vr c = c + vc if r < 0 || r >= grid.count || c < 0 || c >= grid.count { return (true, steps) } steps += 1 if grid[r][c] >= grid[elem.0][elem.1] { return (false, steps) } } } func part1(_ grid: [[Int]]) -> Int { var visible = 0 for (r, row) in grid.enumerated() { for (c, _) in row.enumerated() { visible += dirs.contains { walk(grid: grid, elem: (r, c), dir: $0).0 } ? 1 : 0 } } return visible } func part2(_ grid: [[Int]]) -> Int { var highest = 0 for (r, row) in grid.enumerated() { for (c, _) in row.enumerated() { highest = max(highest, dirs.map { walk(grid: grid, elem: (r, c), dir: $0).1 }.reduce(1, *)) } } return highest } var grid: [[Int]] = [] while let line = readLine() { grid.append(line.map { $0.wholeNumberValue! }) } print(part1(grid)) print(part2(grid)) --- 2022/Sources/day9/main.swift --- struct Position : Hashable { var x: Int var y: Int } func solve(movements: [String], ropeLength: Int) -> Int { var knots = Array(repeating: Position(x: 0, y: 0), count: ropeLength) var uniqueTailPositions = Set<Position>() let dirs = ["R": (1, 0), "L": (-1, 0), "D": (0, -1), "U": (0, 1)] for movement in movements { let split = movement.split(separator: " ") let (dx, dy) = dirs[String(split[0])]! let cnt = Int(split[1])! for _ in 0..<cnt { var newKnots = [Position(x: knots[0].x + dx, y: knots[0].y + dy)] for i in 1..<knots.count { let newParentPos = newKnots[i - 1] let currentPos = knots[i] var newPos = currentPos if abs(newParentPos.x - currentPos.x) >= 2 || abs(newParentPos.y - currentPos.y) >= 2 { if newParentPos.x != currentPos.x { newPos.x += newParentPos.x > knots[i].x ? 1 : -1 } if newParentPos.y != currentPos.y { newPos.y += newParentPos.y > knots[i].y ? 1 : -1 } } newKnots.append(newPos) } knots = newKnots uniqueTailPositions.insert(knots.last!) } } return uniqueTailPositions.count } func part1(lines: [String]) -> Int { solve(movements: lines, ropeLength: 2) } func part2(lines: [String]) -> Int { solve(movements: lines, ropeLength: 10) } var lines: [String] = [String]() while let line = readLine() { lines.append(line) } print(part1(lines: lines)) print(part2(lines: lines)) --- 2023/c++/.clangd --- CompileFlags: Add: [-std=c++20] --- 2023/c++/day1.cpp --- #include <algorithm> #include <iostream> #include <map> #include <numeric> #include <ranges> #include <string> #include <vector> bool isDigit(char c) { return c >= '0' && c <= '9'; }; size_t part1(const std::vector<std::string> &lines) { auto lineToSum = [](const std::string &line) { auto view = line // | std::ranges::views::filter(isDigit) // | std::ranges::views::transform([](char c) { return c - '0'; }); return 10 * view.front() + view.back(); }; auto partialSums = lines | std::ranges::views::transform(lineToSum); return std::accumulate(partialSums.begin(), partialSums.end(), static_cast<size_t>(0)); } size_t part2(const std::vector<std::string> &lines) { static const std::map<std::string, int> keywords = { {"one", 1}, {"two", 2}, {"three", 3}, {"four", 4}, {"five", 5}, {"six", 6}, {"seven", 7}, {"eight", 8}, {"nine", 9}}; size_t sum = 0; for (auto &&line : lines) { std::vector<int> digits; size_t i = 0; auto indexedView = line | std::ranges::views::transform([&](char c) { return std::make_pair(c, i++); }); for (auto &&[c, idx] : indexedView) { if (isDigit(c)) { digits.emplace_back(c - '0'); continue; } for (auto n : {3, 4, 5}) { const auto &substr = line.substr(idx, n); if (keywords.count(substr)) { digits.emplace_back(keywords.at(substr)); break; } } } sum += 10 * digits.front() + digits.back(); } return sum; }; int main() { std::vector<std::string> lines; std::string line; while (std::getline(std::cin, line)) { lines.emplace_back(line); } std::cout << part1(lines) << '\n'; std::cout << part2(lines) << '\n'; return 0; } --- 2023/c++/day10.cpp --- #include <cassert> #include <deque> #include <iostream> #include <map> #include <set> #include <string> #include <vector> int part1(const std::vector<std::string> &grid, const std::pair<int, int> &start) { std::set<std::pair<int, int>> visited; std::deque<std::pair<int, int>> q; q.emplace_back(start); visited.emplace(start); q.emplace_back(-1, -1); size_t steps = 0; while (!q.empty()) { auto [r, c] = q.front(); q.pop_front(); if (r == -1 && c == -1) { ++steps; if (!q.empty()) q.emplace_back(-1, -1); continue; } static int vr[] = {0, 0, 1, -1}; static int vc[] = {1, -1, 0, 0}; static std::string dest[] = {"-J7", "-FL", "|LJ", "|F7"}; static std::string orig[] = {"S-FL", "S-J7", "S|F7", "S|JL"}; for (size_t i = 0; i < 4; ++i) { int tr = r + vr[i]; int tc = c + vc[i]; if (tr < 0 || tr >= grid.size() // || tc < 0 || tc >= grid[tr].size() // || orig[i].find(grid[r][c]) == std::string::npos // ) continue; if (dest[i].find(grid[tr][tc]) != std::string::npos && visited.emplace(tr, tc).second) q.emplace_back(tr, tc); } } return steps - 1; }; int part2(std::vector<std::string> grid, const std::pair<int, int> &start) { int vr[] = {0, 0, 1, -1}; int vc[] = {1, -1, 0, 0}; std::set<std::pair<int, int>> visited; std::deque<std::pair<int, int>> q; q.emplace_back(start); visited.emplace(start); q.emplace_back(-1, -1); // BFS to find the loop. uint8_t startDirs = 0; while (!q.empty()) { auto [r, c] = q.front(); q.pop_front(); if (r == -1 && c == -1) { if (!q.empty()) q.emplace_back(-1, -1); continue; } for (size_t i = 0; i < 4; ++i) { static std::string dest[] = {"-J7", "-FL", "|LJ", "|F7"}; static std::string orig[] = {"S-FL", "S-J7", "S|F7", "S|JL"}; int tr = r + vr[i]; int tc = c + vc[i]; if (tr < 0 || tr >= grid.size() // || tc < 0 || tc >= grid[tr].size() // || orig[i].find(grid[r][c]) == std::string::npos // ) continue; if (dest[i].find(grid[tr][tc]) != std::string::npos && visited.emplace(tr, tc).second) { if (grid[r][c] == 'S') startDirs |= (1U << i); q.emplace_back(tr, tc); } } } // Replace 'S' with the correct pipe. switch (startDirs) { case 0b0101: grid[start.first][start.second] = 'F'; break; case 0b1001: grid[start.first][start.second] = 'L'; break; case 0b0110: grid[start.first][start.second] = '7'; break; case 0b1010: grid[start.first][start.second] = 'J'; break; case 0b0011: grid[start.first][start.second] = '-'; break; case 0b1100: grid[start.first][start.second] = '|'; break; default: assert(false && "Unreachable"); } // Scale up the map by inserting empty cells between pipes. std::vector<std::string> scaledGrid; scaledGrid.emplace_back(grid[0].size() * 2 + 1, '.'); for (size_t i = 0; i < grid.size(); ++i) { using namespace std::string_literals; std::string tmp = "."; for (size_t j = 0; j < grid[i].size(); ++j) { if (!visited.contains({i, j})) { tmp += ".."; continue; } tmp += grid[i][j]; tmp += "FL-"s.find(grid[i][j]) != std::string::npos ? '-' : '.'; } scaledGrid.emplace_back(tmp); scaledGrid.emplace_back(tmp); for (auto &t : scaledGrid.back()) { t = "F7|"s.find(t) != std::string::npos ? '|' : '.'; }; } // BFS to find the outside cells. visited.clear(); q.clear(); q.emplace_back(0, 0); visited.emplace(0, 0); q.emplace_back(-1, -1); while (!q.empty()) { auto [r, c] = q.front(); q.pop_front(); if (r == -1 && c == -1) { if (!q.empty()) q.emplace_back(-1, -1); continue; } for (size_t i = 0; i < 4; ++i) { int tr = r + vr[i]; int tc = c + vc[i]; if (tr < 0 || tr >= scaledGrid.size() // || tc < 0 || tc >= scaledGrid[tr].size() // ) continue; if (scaledGrid[tr][tc] == '.' && visited.emplace(tr, tc).second) q.emplace_back(tr, tc); } } // Scale the map down and check for unvisited tiles. size_t cnt = 0; for (size_t i = 1; i < scaledGrid.size(); i += 2) { for (size_t j = 1; j < scaledGrid[i].size(); j += 2) cnt += !visited.contains({i, j}) && scaledGrid[i][j] == '.'; } return cnt; }; int main() { std::vector<std::string> grid; std::pair<int, int> start; std::string line; while (std::getline(std::cin, line)) { if (auto pos = line.find('S'); pos != std::string::npos) start = {grid.size(), pos}; grid.emplace_back(std::move(line)); } std::cout << part1(grid, start) << '\n'; std::cout << part2(grid, start) << '\n'; return 0; } --- 2023/c++/day11.cpp --- #include <iostream> #include <set> #include <string> #include <utility> #include <vector> size_t part1(const std::vector<std::string> &grid) { std::vector<std::pair<int, int>> galaxies; std::set<int> occupiedCols; std::set<int> occupiedRows; for (size_t i = 0; i < grid.size(); ++i) { for (size_t j = 0; j < grid[i].size(); ++j) { if (grid[i][j] == '#') { galaxies.emplace_back(i, j); occupiedRows.emplace(i); occupiedCols.emplace(j); } } } size_t totalDist = 0; for (size_t i = 0; i < galaxies.size(); ++i) { for (size_t j = i + 1; j < galaxies.size(); ++j) { auto [a, b] = galaxies[i]; auto [c, d] = galaxies[j]; if (a > c) std::swap(a, c); if (b > d) std::swap(b, d); size_t dist = c - a + d - b; for (int k = a; k < c; ++k) dist += !occupiedRows.contains(k); for (int k = b; k < d; ++k) dist += !occupiedCols.contains(k); totalDist += dist; } } return totalDist; }; size_t part2(const std::vector<std::string> &grid) { std::vector<std::pair<int, int>> galaxies; std::set<int> occupiedCols; std::set<int> occupiedRows; for (size_t i = 0; i < grid.size(); ++i) { for (size_t j = 0; j < grid[i].size(); ++j) { if (grid[i][j] == '#') { galaxies.emplace_back(i, j); occupiedRows.emplace(i); occupiedCols.emplace(j); } } } size_t totalDist = 0; for (size_t i = 0; i < galaxies.size(); ++i) { for (size_t j = i + 1; j < galaxies.size(); ++j) { auto [a, b] = galaxies[i]; auto [c, d] = galaxies[j]; if (a > c) std::swap(a, c); if (b > d) std::swap(b, d); size_t dist = c - a + d - b; for (int k = a; k < c; ++k) { if (!occupiedRows.contains(k)) dist += 1e6 - 1; } for (int k = b; k < d; ++k) { if (!occupiedCols.contains(k)) dist += 1e6 - 1; } totalDist += dist; } } return totalDist; }; int main() { std::vector<std::string> grid; std::string line; while (std::getline(std::cin, line)) grid.emplace_back(std::move(line)); std::cout << part1(grid) << '\n'; std::cout << part2(grid) << '\n'; return 0; } --- 2023/c++/day12.cpp --- #include <functional> #include <iostream> #include <map> #include <sstream> #include <string> #include <utility> #include <vector> size_t part1(const std::string &line, const std::vector<unsigned> &groups, size_t li = 0, size_t gi = 0) { if (li >= line.length()) return gi == groups.size(); for (size_t i = li; i < line.size(); ++i) { if (line[i] == '.') continue; if (gi == groups.size()) { if (line[i] == '#') return 0; continue; } size_t base = i; while (i < line.size() && (line[i] == '?' || line[i] == '#')) ++i; size_t next = groups[gi]; bool canReplace = i - base >= next && (base + next == line.size() || line[base + next] != '#'); // If the beginning of the current block can be replaced with the current // group, do it. size_t replaced = canReplace ? part1(line, groups, base + 1 + next, gi + 1) : 0; // If the block begins with a '?', pretend it couldn't be replaced. size_t skipped = line[base] == '?' ? part1(line, groups, base + 1, gi) : 0; return replaced + skipped; } return gi == groups.size(); }; size_t part2(const std::string &line, const std::vector<unsigned> &groups, size_t li = 0, size_t gi = 0) { std::map<std::pair<size_t, size_t>, size_t> cache; std::function<decltype(part2)> partialMemo = [&cache, &partialMemo](const std::string &line, const std::vector<unsigned> &groups, size_t li = 0, size_t gi = 0) -> size_t { if (li >= line.length()) return gi == groups.size(); if (cache.contains({li, gi})) return cache[{li, gi}]; for (size_t i = li; i < line.size(); ++i) { if (line[i] == '.') continue; if (gi == groups.size()) { if (line[i] == '#') return 0; continue; } size_t base = i; while (i < line.size() && (line[i] == '?' || line[i] == '#')) ++i; size_t next = groups[gi]; bool canReplace = i - base >= next && (base + next == line.size() || line[base + next] != '#'); // If the beginning of the current block can be replaced with the current // group, do it. size_t replaced = canReplace ? partialMemo(line, groups, base + 1 + next, gi + 1) : 0; // If the block begins with a '?', pretend it couldn't be replaced. size_t skipped = line[base] == '?' ? partialMemo(line, groups, base + 1, gi) : 0; cache[{li, gi}] = replaced + skipped; return replaced + skipped; } return gi == groups.size(); }; auto expandedLine = line; auto expandedGroups = groups; for (int i = 0; i < 4; ++i) { expandedLine += '?' + line; for (auto &&g : groups) { expandedGroups.emplace_back(g); } } return partialMemo(expandedLine, expandedGroups, li, gi); }; int main() { size_t part1Sum = 0; size_t part2Sum = 0; std::string line; while (std::getline(std::cin, line)) { std::stringstream ss(line); std::string springs; ss >> springs; std::vector<unsigned> groups; unsigned x = 0; while (ss >> x) { ss.get(); groups.emplace_back(x); } part1Sum += part1(springs, groups); part2Sum += part2(springs, groups); } std::cout << part1Sum << '\n'; std::cout << part2Sum << '\n'; return 0; } --- 2023/c++/day13.cpp --- #include <iostream> #include <ranges> #include <string> #include <vector> size_t part1(const std::vector<std::string> &block) { auto getMirror = [](const std::vector<std::string> &block, const std::vector<size_t> &reflections) { for (auto &&r : reflections) { bool mirror = true; for (size_t i : std::views::iota(0U, r)) { size_t opposite = r + (r - i) - 1; if (opposite >= block.size()) continue; mirror &= block[i] == block[opposite]; } if (mirror) return r; } return static_cast<size_t>(0); }; std::vector<size_t> reflRows; for (size_t i : std::views::iota(0U, block.size() - 1)) if (block[i] == block[i + 1]) reflRows.emplace_back(i + 1); if (auto r = getMirror(block, reflRows)) return r * 100; std::vector<std::string> rotated; for (size_t i : std::views::iota(0U, block[0].size())) { std::string col; for (auto &&r : block) col += r[i]; rotated.emplace_back(std::move(col)); } std::vector<size_t> reflCols; for (size_t i : std::views::iota(0U, rotated.size() - 1)) if (rotated[i] == rotated[i + 1]) reflCols.emplace_back(i + 1); return getMirror(rotated, reflCols); }; size_t part2(const std::vector<std::string> &block) { auto countDiff = [](const std::string &a, const std::string &b) { size_t diff = 0; for (size_t i : std::views::iota(0U, a.size())) diff += a[i] != b[i]; return diff; }; auto getMirror = [&countDiff](const std::vector<std::string> &block, const std::vector<size_t> &reflections) { for (auto &&r : reflections) { bool correction = false; bool mirror = true; for (size_t i : std::views::iota(0U, r)) { size_t opposite = r + (r - i) - 1; if (opposite >= block.size()) continue; auto diff = countDiff(block[i], block[opposite]); mirror &= diff == 0 || (diff == 1 && !correction); correction |= diff; } if (mirror && correction) return r; } return static_cast<size_t>(0); }; std::vector<size_t> reflRows; for (size_t i : std::views::iota(0U, block.size() - 1)) if (countDiff(block[i], block[i + 1]) <= 1) reflRows.emplace_back(i + 1); if (auto r = getMirror(block, reflRows)) return r * 100; std::vector<std::string> rotated; for (size_t i : std::views::iota(0U, block[0].size())) { std::string col; for (auto &&r : block) col += r[i]; rotated.emplace_back(std::move(col)); } std::vector<size_t> reflCols; for (size_t i : std::views::iota(0U, rotated.size() - 1)) if (countDiff(rotated[i], rotated[i + 1]) <= 1) reflCols.emplace_back(i + 1); return getMirror(rotated, reflCols); }; int main() { size_t part1Sum = 0; size_t part2Sum = 0; std::vector<std::string> block; std::string line; while (std::getline(std::cin, line)) { if (!line.empty()) { block.emplace_back(line); continue; } part1Sum += part1(block); part2Sum += part2(block); block.clear(); } part1Sum += part1(block); part2Sum += part2(block); std::cout << part1Sum << '\n'; std::cout << part2Sum << '\n'; return 0; } --- 2023/c++/day14.cpp --- #include <iostream> #include <map> #include <ranges> #include <string> #include <utility> #include <vector> size_t part1(const std::vector<std::string> &block) { size_t northWeight = 0; for (size_t c : std::views::iota(0U, block[0].size())) { size_t stop = 0; for (auto r : std::views::iota(0U, block.size())) { if (block[r][c] == '#') { stop = r + 1; continue; } if (block[r][c] == 'O') { northWeight += block.size() - stop; ++stop; } } } return northWeight; }; size_t part2(std::vector<std::string> block) { std::map<size_t, size_t> valToIter; std::vector<size_t> iters; size_t cycleIdx = 0; size_t cycleBase = 0; size_t prevCycleEnd = 0; bool detectCycle = false; int rowCount = block.size(); int colCount = block[0].size(); size_t target = 1e9; for (size_t n = 0; n < target; ++n) { size_t northWeight = 0; // Tilt north for (size_t c : std::views::iota(0, colCount)) { size_t stop = 0; for (auto r : std::views::iota(0, rowCount)) { if (block[r][c] == '#') { stop = r + 1; continue; } if (block[r][c] == 'O') { std::swap(block[r][c], block[stop][c]); ++stop; } } } // Tilt west for (auto r : std::views::iota(0, rowCount)) { size_t stop = 0; for (size_t c : std::views::iota(0, colCount)) { if (block[r][c] == '#') { stop = c + 1; continue; } if (block[r][c] == 'O') { std::swap(block[r][c], block[r][stop]); ++stop; } } } // Tilt south for (size_t c : std::views::iota(0, colCount)) { size_t stop = rowCount - 1; for (size_t r : std::views::iota(0, rowCount) | std::views::reverse) { if (block[r][c] == '#') { stop = r - 1; continue; } if (block[r][c] == 'O') { std::swap(block[r][c], block[stop][c]); northWeight += rowCount - stop; --stop; } } } // Tilt east for (auto r : std::views::iota(0, rowCount)) { size_t stop = colCount - 1; for (size_t c : std::views::iota(0, colCount) | std::views::reverse) { if (block[r][c] == '#') { stop = c - 1; continue; } if (block[r][c] == 'O') { std::swap(block[r][c], block[r][stop]); --stop; } } } if (detectCycle) { detectCycle = northWeight == iters[cycleIdx + 1]; ++cycleIdx; } if (valToIter.contains(northWeight)) { if (detectCycle) { if (iters[cycleBase] == northWeight) { if (prevCycleEnd == valToIter[northWeight]) { break; } prevCycleEnd = n; } } else { cycleBase = valToIter[northWeight]; cycleIdx = cycleBase; detectCycle = true; } } valToIter[northWeight] = n; iters.emplace_back(northWeight); } if (detectCycle) { auto diff = iters.size() - prevCycleEnd; auto mod = (target - prevCycleEnd - 1) % diff; return iters[prevCycleEnd + mod]; } return iters[target - 1]; }; int main() { std::vector<std::string> block; std::string line; while (std::getline(std::cin, line)) block.emplace_back(line); std::cout << part1(block) << '\n'; std::cout << part2(std::move(block)) << '\n'; return 0; } --- 2023/c++/day15.cpp --- #include <iostream> #include <ranges> #include <string> #include <vector> size_t part1(const std::string &sequence) { size_t res = 0; for (auto &&s : sequence | std::views::split(',')) { std::string_view sv(&s.front(), std::ranges::distance(s)); size_t hash = 0; for (auto &&c : sv) { hash += c; hash *= 17; hash %= 256; } res += hash; } return res; }; size_t part2(const std::string &sequence) { std::vector<std::pair<std::string, int>> boxes[256]; for (auto &&s : sequence | std::views::split(',')) { std::string_view sv(&s.front(), std::ranges::distance(s)); char delim = sv.back() == '-' ? '-' : '='; auto labelSplit = std::views::split(sv, delim).front(); auto label = std::string_view(&labelSplit.front(), std::ranges::distance(labelSplit)); size_t hash = 0; for (auto &&c : label) { hash += c; hash *= 17; hash %= 256; } auto &box = boxes[hash]; auto it = box.begin(); while (it != box.end() && it->first != label) ++it; if (sv.back() == '-') { if (it != box.end()) box.erase(it); continue; } int val = sv.back() - '0'; if (it != box.end()) it->second = val; else box.emplace_back(label, val); } size_t total = 0; for (auto &&i : std::views::iota(0, 256)) { if (boxes[i].empty()) continue; for (auto &&j : std::views::iota(0U, boxes[i].size())) total += (i + 1) * (j + 1) * boxes[i][j].second; } return total; }; int main() { std::string line; std::getline(std::cin, line); std::cout << part1(line) << '\n'; std::cout << part2(line) << '\n'; return 0; } --- 2023/c++/day16.cpp --- #include <iostream> #include <map> #include <string> #include <utility> #include <vector> enum LightDir : uint8_t { UP = 1 << 0, DOWN = 1 << 1, LEFT = 1 << 2, RIGHT = 1 << 3 }; struct Light { int r; int c; LightDir dir; }; struct LightProperties { int vx; int vy; std::vector<std::pair<char, uint8_t>> colliders; }; static const std::map<LightDir, LightProperties> vd = { {UP, {-1, 0, {{'\\', LEFT}, {'/', RIGHT}, {'-', LEFT | RIGHT}}}}, {DOWN, {1, 0, {{'\\', RIGHT}, {'/', LEFT}, {'-', LEFT | RIGHT}}}}, {LEFT, {0, -1, {{'\\', UP}, {'/', DOWN}, {'|', UP | DOWN}}}}, {RIGHT, {0, 1, {{'\\', DOWN}, {'/', UP}, {'|', UP | DOWN}}}}, }; size_t part1(const std::vector<std::string> &cave, Light start = {0, 0, RIGHT}) { std::vector<Light> lights = {start}; std::vector<std::vector<uint8_t>> energized( cave.size(), std::vector<uint8_t>(cave[0].size(), 0)); while (!lights.empty()) { auto [r, c, dir] = lights.back(); lights.pop_back(); if (energized[r][c] & dir) continue; const auto &[vr, vy, cs] = vd.at(dir); while (true) { if (r < 0 || r >= cave.size() || c < 0 || c >= cave[0].size()) break; energized[r][c] |= dir; bool collide = false; for (auto &&collider : cs) { const auto &[ch, d] = collider; if (ch != cave[r][c]) continue; for (uint8_t i = 0; i < 4; ++i) { auto ld = static_cast<LightDir>(1U << i); if (d & ld) { auto [vr, vc, _] = vd.at(ld); int nr = r + vr; int nc = c + vc; if (nr < 0 || nr >= cave.size() || nc < 0 || nc >= cave[0].size()) continue; lights.emplace_back(nr, nc, ld); } } collide = true; } if (collide) break; r += vr; c += vy; } } size_t e = 0; for (auto &&r : energized) for (auto &&c : r) e += c > 0; return e; }; size_t part2(const std::vector<std::string> &cave) { std::vector<Light> startingLights; for (size_t i = 0; i < cave.size(); ++i) { startingLights.emplace_back(i, 0, RIGHT); startingLights.emplace_back(i, cave[0].size() - 1, LEFT); } for (size_t i = 0; i < cave[0].size(); ++i) { startingLights.emplace_back(0, i, DOWN); startingLights.emplace_back(cave.size() - 1, i, UP); } std::size_t m = 0; for (auto &&start : startingLights) m = std::max(m, part1(cave, start)); return m; }; int main() { std::vector<std::string> cave; std::string line; while (std::getline(std::cin, line)) cave.emplace_back(line); std::cout << part1(cave) << '\n'; std::cout << part2(cave) << '\n'; return 0; } --- 2023/c++/day17.cpp --- #include <cstring> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> enum Dir : uint8_t { UP, DOWN, LEFT, RIGHT }; struct Data { size_t dist; int r; int c; int s; Dir d; }; template <> struct std::greater<Data> { bool operator()(const Data &lhs, const Data &rhs) const { return lhs.dist > rhs.dist; } }; size_t part1(const std::vector<std::string> &blocks) { bool visited[150][150][4][4]; std::memset((void *)&visited, 0, sizeof(visited)); std::priority_queue<Data, std::vector<Data>, std::greater<Data>> q; q.emplace(blocks[0][1] - '0', 0, 1, 1, RIGHT); q.emplace(blocks[1][0] - '0', 1, 0, 1, DOWN); while (!q.empty()) { auto [w, r, c, s, d] = q.top(); q.pop(); if (r == blocks.size() - 1 && c == blocks[0].size() - 1) return w; if (visited[r][c][d][s]) continue; visited[r][c][d][s] = true; static std::pair<int, int> vd[] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; static Dir nds[4][2] = { {LEFT, RIGHT}, {LEFT, RIGHT}, {UP, DOWN}, {UP, DOWN}}; if (s < 3) { auto [vr, vc] = vd[d]; auto nr = r + vr; auto nc = c + vc; if (nr >= 0 && nr < blocks.size() && nc >= 0 && nc < blocks[0].size()) q.emplace(w + blocks[nr][nc] - '0', nr, nc, s + 1, d); } for (auto &&nd : nds[d]) { auto [vr, vc] = vd[nd]; auto nr = r + vr; auto nc = c + vc; if (nr < 0 || nr >= blocks.size() || nc < 0 || nc >= blocks[0].size()) continue; q.emplace(w + blocks[nr][nc] - '0', nr, nc, 1, nd); } } return 0; } size_t part2(const std::vector<std::string> &blocks) { bool visited[200][200][4][10]; std::memset((void *)&visited, 0, sizeof(visited)); std::priority_queue<Data, std::vector<Data>, std::greater<Data>> q; q.emplace(blocks[0][1] - '0', 0, 1, 1, RIGHT); q.emplace(blocks[1][0] - '0', 1, 0, 1, DOWN); while (!q.empty()) { auto [w, r, c, s, d] = q.top(); q.pop(); if (r == blocks.size() - 1 && c == blocks[0].size() - 1 && s >= 4) return w; if (visited[r][c][d][s]) continue; visited[r][c][d][s] = true; static std::pair<int, int> vd[] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; static Dir nds[4][2] = { {LEFT, RIGHT}, {LEFT, RIGHT}, {UP, DOWN}, {UP, DOWN}}; if (s < 10) { auto [vr, vc] = vd[d]; auto nr = r + vr; auto nc = c + vc; if (nr >= 0 && nr < blocks.size() && nc >= 0 && nc < blocks[0].size()) q.emplace(w + blocks[nr][nc] - '0', nr, nc, s + 1, d); if (s < 4) continue; } for (auto &&nd : nds[d]) { auto [vr, vc] = vd[nd]; auto nr = r + vr; auto nc = c + vc; if (nr < 0 || nr >= blocks.size() || nc < 0 || nc >= blocks[0].size()) continue; q.emplace(w + blocks[nr][nc] - '0', nr, nc, 1, nd); } } return 0; }; int main() { std::vector<std::string> blocks; std::string line; while (std::getline(std::cin, line)) blocks.emplace_back(line); std::vector<std::vector<bool>> v(blocks.size(), std::vector<bool>(blocks[0].size(), false)); std::cout << part1(blocks) << '\n'; std::cout << part2(blocks) << '\n'; return 0; } --- 2023/c++/day18.cpp --- #include <iostream> #include <map> #include <queue> #include <sstream> #include <string> #include <vector> // Brute-force flood fill. size_t part1(const std::vector<std::string> &moves) { std::vector<std::string> ground(1000, std::string(1000, '.')); std::pair<int, int> currentTile = {300, 300}; for (auto &&m : moves) { std::istringstream ss(m); char dir = 'U'; int steps = 0; ss >> dir >> steps; const static std::map<char, std::pair<int, int>> dirs{ {'U', {-1, 0}}, {'D', {1, 0}}, {'L', {0, -1}}, {'R', {0, 1}}, }; auto [r, c] = currentTile; auto [vr, vc] = dirs.at(dir); while (steps > 0) { r += vr; c += vc; ground[r][c] = '#'; --steps; } currentTile = {r, c}; } std::queue<std::pair<int, int>> q; std::vector<std::vector<bool>> visited( ground.size(), std::vector<bool>(ground[0].size(), false)); q.emplace(0, 0); visited[0][0] = true; size_t cnt = 1; while (!q.empty()) { auto [r, c] = q.front(); q.pop(); const static std::pair<int, int> dirs[] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}}; for (auto [vr, vc] : dirs) { auto nr = r + vr; auto nc = c + vc; if (nr < 0 || nr >= ground.size() || nc < 0 || nc >= ground[0].size()) continue; if (visited[nr][nc]) continue; visited[nr][nc] = true; if (ground[nr][nc] == '.') { ++cnt; q.emplace(nr, nc); } } } return ground.size() * ground[0].size() - cnt; } // A faster but overengineered algorithm. size_t part2(const std::vector<std::string> &moves) { std::map<int, std::vector<std::pair<int, char>>> row2point; std::map<int, std::vector<std::pair<int, char>>> col2point; int curRow = 0; int curCol = 0; bool up = moves.back()[0] == 'U'; bool right = moves[0][0] == 'R'; for (auto &&m : moves) { std::stringstream ss(m); char eatChar = 'U'; int eatSteps = 0; std::string hcode; ss >> eatChar >> eatSteps >> hcode; std::string hdist = hcode.substr(2, 5); int dir = hcode[7] - '0'; int dist = 0; ss.clear(); ss.str(""); ss << std::hex << hdist; ss >> dist; // Step (1): Figure out the corners. if (dir == 3) { char corner = right ? 'J' : 'L'; row2point[curRow].emplace_back(curCol, corner); col2point[curCol].emplace_back(curRow, corner); up = true; curRow -= dist; } else if (dir == 1) { char corner = right ? '7' : 'F'; row2point[curRow].emplace_back(curCol, corner); col2point[curCol].emplace_back(curRow, corner); curRow += dist; up = false; } else if (dir == 0) { char corner = up ? 'F' : 'L'; row2point[curRow].emplace_back(curCol, corner); col2point[curCol].emplace_back(curRow, corner); right = true; curCol += dist; } else if (dir == 2) { char corner = up ? '7' : 'J'; row2point[curRow].emplace_back(curCol, corner); col2point[curCol].emplace_back(curRow, corner); right = false; curCol -= dist; } } // Step (2): Insert additional walls where needed. for (auto &[r, v] : row2point) std::sort(v.begin(), v.end()); for (auto &[c, v] : col2point) std::sort(v.begin(), v.end()); for (auto &[r, cs] : row2point) { std::vector<std::pair<int, char>> newWalls; for (auto &&[c, rs] : col2point) { auto it = std::upper_bound(rs.begin(), rs.end(), std::pair<int, char>(r, '.')); if (it != rs.begin() && it != rs.end() && (it->second == 'J' || it->second == 'L')) newWalls.emplace_back(c, '|'); } cs.insert(cs.end(), newWalls.begin(), newWalls.end()); std::sort(cs.begin(), cs.end()); } // Step (3): Remove the unneeded walls. for (auto &[r, v] : row2point) { std::vector<std::pair<int, char>> filtered; for (auto &&[c, w] : v) if (filtered.empty() || filtered.back().first != c) filtered.emplace_back(c, w); v = filtered; } // Step (4): Calculate and concatenate the areas of rectangles. size_t total = 0; std::vector<int> chunks; int prevR = -1; for (auto [r, v] : row2point) { // Figure out, in which colums the current row is going to continue and // compute the area of those chunks. if (prevR != -1) { for (size_t i = 0; i < chunks.size(); i += 2) total += static_cast<size_t>(r - prevR) * (chunks[i + 1] - chunks[i] + 1); } chunks.clear(); for (auto &&[c, w] : v) if (w == 'F' || w == '|' || w == '7') chunks.emplace_back(c); // Figure out the covered tiles in the current row. bool inside = true; bool rotated = false; int curI = 0; for (size_t i = 1; i < v.size(); ++i) { char curW = v[curI].second; if ((v[i].second == '7' && v[i - 1].second == 'L') || (v[i].second == 'J' && v[i - 1].second == 'F')) { if (rotated) inside = false; rotated = true; } if (curW == 'F' && ((v[i].second == '7' && !rotated) || v[i].second == '|')) inside = false; else if (curW == 'L' && ((v[i].second == 'J' && !rotated) || v[i].second == '|')) inside = false; else if (curW == '|' && (v[i].second == '|' || rotated)) inside = false; if (!inside) { total += v[i].first - v[curI].first + 1; curI = i + 1; ++i; inside = true; rotated = false; } } prevR = r + 1; } return total; }; int main() { std::vector<std::string> moves; std::string line; while (std::getline(std::cin, line)) moves.emplace_back(line); std::cout << part1(moves) << '\n'; std::cout << part2(moves) << '\n'; return 0; } --- 2023/c++/day19.cpp --- #include <iostream> #include <map> #include <queue> #include <sstream> #include <string> #include <vector> struct WorkflowItem { char category; char op; int size; std::string destination; }; struct Part { int x; int m; int a; int s; }; size_t part1(const std::map<std::string, std::vector<WorkflowItem>> &workflows, const std::vector<Part> &parts) { size_t sum = 0; for (auto &&[x, m, a, s] : parts) { std::string curWorkflow = "in"; while (curWorkflow != "A" && curWorkflow != "R") { for (auto &&[c, o, ws, d] : workflows.at(curWorkflow)) { if (c == '.') { curWorkflow = d; break; } bool less = o == '<'; bool hit = false; if (c == 'x') hit = less ? x < ws : x > ws; else if (c == 'm') hit = less ? m < ws : m > ws; else if (c == 'a') hit = less ? a < ws : a > ws; else if (c == 's') hit = less ? s < ws : s > ws; if (hit) { curWorkflow = d; break; } } } if (curWorkflow == "A") sum += x + m + a + s; } return sum; } struct State { std::string cur; std::pair<int, int> x{1, 4000}; std::pair<int, int> m{1, 4000}; std::pair<int, int> a{1, 4000}; std::pair<int, int> s{1, 4000}; }; size_t part2(const std::map<std::string, std::vector<WorkflowItem>> &workflows) { size_t combinations = 0; std::queue<State> q; q.emplace("in"); while (!q.empty()) { auto st = q.front(); q.pop(); if (st.cur == "R") continue; if (st.cur == "A") { combinations += static_cast<size_t>(st.x.second - st.x.first + 1) * (st.m.second - st.m.first + 1) * (st.a.second - st.a.first + 1) * (st.s.second - st.s.first + 1); continue; } for (auto &&[c, o, s, d] : workflows.at(st.cur)) { st.cur = d; if (c == '.') { q.emplace(st); break; } State nst = st; bool less = o == '<'; if (c == 'x') { if (less) { nst.x.second = s - 1; st.x.first = s; } else { nst.x.first = s + 1; st.x.second = s; } } else if (c == 'm') { if (less) { nst.m.second = s - 1; st.m.first = s; } else { nst.m.first = s + 1; st.m.second = s; } } else if (c == 'a') { if (less) { nst.a.second = s - 1; st.a.first = s; } else { nst.a.first = s + 1; st.a.second = s; } } else if (c == 's') { if (less) { nst.s.second = s - 1; st.s.first = s; } else { nst.s.first = s + 1; st.s.second = s; } } q.emplace(nst); } } return combinations; } int main() { std::map<std::string, std::vector<WorkflowItem>> workflows; std::vector<Part> parts; std::string buffer; while (std::getline(std::cin, buffer)) { if (buffer.empty()) break; std::stringstream ss(buffer); std::getline(ss, buffer, '{'); std::string cur = buffer; workflows[cur] = {}; while (std::getline(ss, buffer, ',')) { WorkflowItem item{'.', '.', 0, ""}; if (buffer.back() == '}') { buffer.pop_back(); item.destination = buffer; } else { item.category = buffer[0]; item.op = buffer[1]; std::stringstream sss(buffer.substr(2)); std::getline(sss, buffer, ':'); item.size = std::stoi(buffer); std::getline(sss, item.destination); } workflows[cur].emplace_back(std::move(item)); } } while (std::getline(std::cin, buffer)) { buffer.pop_back(); std::stringstream ss(buffer.substr(1)); Part part{0}; while (std::getline(ss, buffer, ',')) { char c = buffer[0]; int v = std::stoi(buffer.substr(2)); if (c == 'x') part.x = v; else if (c == 'm') part.m = v; else if (c == 'a') part.a = v; else if (c == 's') part.s = v; } parts.emplace_back(part); } std::cout << part1(workflows, parts) << '\n'; std::cout << part2(workflows) << '\n'; return 0; } --- 2023/c++/day2.cpp --- #include <iostream> #include <sstream> #include <string> #include <vector> struct CubeCount { int red{}, green{}, blue{}; void setDefaults() { red = 12; green = 13; blue = 14; } bool isValid() { return red >= 0 && green >= 0 && blue >= 0; } }; int part1(const std::string &line) { std::stringstream ss(line); // Game X: int id = 0; std::string str; ss >> str >> id; ss.get(); CubeCount cc; cc.setDefaults(); int n = 0; while (ss >> n >> str) { if (str.starts_with("red")) { cc.red -= n; } else if (str.starts_with("green")) { cc.green -= n; } else if (str.starts_with("blue")) { cc.blue -= n; } if (str.back() == ';' || str.back() != ',') { if (!cc.isValid()) { return 0; } cc.setDefaults(); } } return id; }; int part2(const std::string &line) { std::stringstream ss(line); CubeCount cc; int n = 0; std::string str; ss >> str >> n; ss.get(); while (ss >> n >> str) { if (str.starts_with("red")) { cc.red = std::max(cc.red, n); } else if (str.starts_with("blue")) { cc.blue = std::max(cc.blue, n); } else if (str.starts_with("green")) { cc.green = std::max(cc.green, n); } } return cc.red * cc.green * cc.blue; } int main() { int part1Sum = 0; int part2Sum = 0; std::string line; while (std::getline(std::cin, line)) { part1Sum += part1(line); part2Sum += part2(line); } std::cout << part1Sum << '\n'; std::cout << part2Sum << '\n'; return 0; } --- 2023/c++/day20.cpp --- #include <iostream> #include <map> #include <numeric> #include <queue> #include <sstream> #include <string> #include <vector> enum Type { NONE, FLIP_FLOP, CONJUNCTION }; struct Module { Type type; std::string id; std::map<std::string, int> inputs; bool flipped = false; }; using ModuleConnectionsT = std::map<std::string, std::vector<std::string>>; using ModuleInfosT = std::map<std::string, Module>; size_t part1(const ModuleConnectionsT &moduleConnections, ModuleInfosT moduleInfos) { size_t low = 0; size_t high = 0; for (size_t i = 0; i < 1000; ++i) { std::queue<std::pair<std::string, int>> q; q.emplace("broadcaster", 0); while (!q.empty()) { auto [cur, pulse] = q.front(); q.pop(); if (pulse) ++high; else ++low; auto &curInfo = moduleInfos.at(cur); if (curInfo.type == FLIP_FLOP) { if (pulse == 1) continue; pulse = curInfo.flipped ? 0 : 1; curInfo.flipped = !curInfo.flipped; } else if (curInfo.type == CONJUNCTION) { bool allHigh = true; for (auto &&[in, p] : curInfo.inputs) allHigh &= p; pulse = allHigh ? 0 : 1; } if (!moduleConnections.contains(cur)) continue; for (auto &&c : moduleConnections.at(cur)) { auto &cInfo = moduleInfos[c]; if (cInfo.type == CONJUNCTION) cInfo.inputs[cur] = pulse; q.emplace(c, pulse); } } } return low * high; } size_t part2(const ModuleConnectionsT &moduleConnections, ModuleInfosT moduleInfos) { auto subEndings = moduleInfos[moduleInfos["rx"].inputs.begin()->first].inputs; std::vector<int> cycles; size_t push = 1; while (cycles.size() != 4) { std::queue<std::pair<std::string, int>> q; q.emplace("broadcaster", 0); while (!q.empty()) { auto [cur, pulse] = q.front(); q.pop(); if (subEndings.contains(cur) && pulse == 0) cycles.emplace_back(push); auto &curInfo = moduleInfos[cur]; if (curInfo.type == FLIP_FLOP) { if (pulse == 1) continue; pulse = curInfo.flipped ? 0 : 1; curInfo.flipped = !curInfo.flipped; } else if (curInfo.type == CONJUNCTION) { bool allHigh = true; for (auto &&[in, p] : curInfo.inputs) allHigh &= p; pulse = allHigh ? 0 : 1; } if (!moduleConnections.contains(cur)) continue; for (auto &&c : moduleConnections.at(cur)) { auto &cInfo = moduleInfos[c]; if (cInfo.type == CONJUNCTION) cInfo.inputs[cur] = pulse; q.emplace(c, pulse); } } ++push; } size_t res = 1; for (auto &&c : cycles) res = std::lcm(res, c); return res; } int main() { std::map<std::string, std::vector<std::string>> moduleConnections; std::map<std::string, Module> moduleInfos; std::string buffer; while (std::getline(std::cin, buffer)) { std::stringstream ss(buffer); ss >> buffer; Module module; module.id = buffer.substr(1); switch (buffer[0]) { case '%': module.type = FLIP_FLOP; break; case '&': module.type = CONJUNCTION; break; default: module.type = NONE; module.id = buffer; break; } moduleInfos[module.id] = module; ss >> buffer; ss.get(); while (std::getline(ss, buffer, ',')) { ss.get(); moduleConnections[module.id].emplace_back(buffer); } } for (auto &&[m, cs] : moduleConnections) { for (auto &&c : cs) { auto &details = moduleInfos[c]; if (details.type == CONJUNCTION || c == "rx") details.inputs.emplace(m, 0); } } std::cout << part1(moduleConnections, moduleInfos) << '\n'; std::cout << part2(moduleConnections, moduleInfos) << '\n'; return 0; } --- 2023/c++/day21.cpp --- #include <cassert> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> size_t getReachedPlotCount(const std::vector<std::string> &garden, size_t steps) { std::pair<int, int> start; for (size_t r = 0; r < garden.size(); ++r) { if (auto c = garden[r].find('S'); c != std::string::npos) { start = {r, c}; break; } } std::set<std::pair<int, int>> visited; std::queue<std::pair<int, int>> q; q.emplace(start); q.emplace(-1, -1); size_t step = 0; while (!q.empty()) { auto [r, c] = q.front(); q.pop(); if (r == -1 && c == -1) { if (step == steps) break; ++step; visited.clear(); if (!q.empty()) q.emplace(-1, -1); continue; } if (!visited.emplace(r, c).second) continue; const static std::pair<int, int> dirs[] = { {1, 0}, {-1, 0}, {0, -1}, {0, 1}}; for (auto &&[dr, dc] : dirs) { int nr = r + dr; int nc = c + dc; if (nr < 0 || nr >= garden.size() || nc < 0 || nc >= garden[0].size() || garden[nr][nc] == '#') continue; q.emplace(nr, nc); } } return visited.size(); } size_t part1(const std::vector<std::string> &garden) { return getReachedPlotCount(garden, 64); } size_t part2(const std::vector<std::string> &garden) { assert(garden.size() == 131 && garden[0].size() == 131 && "unexpected input size"); size_t n = 26501365; size_t oddCovered = getReachedPlotCount(garden, 131); size_t oddDiamond = getReachedPlotCount(garden, 65); size_t evenCovered = getReachedPlotCount(garden, 130); size_t evenDiamond = getReachedPlotCount(garden, 64); size_t repetition = (2 * n + 1) / garden[0].size(); size_t dist = (repetition - 1) / 2; size_t totalOdd = dist + 1 + (dist + 1) * dist; size_t totalEven = dist + (dist - 1) * dist; return totalOdd * oddCovered + totalEven * evenCovered - (dist + 1) * (oddCovered - oddDiamond) + dist * (evenCovered - evenDiamond); } int main() { std::vector<std::string> garden; std::string buffer; while (std::getline(std::cin, buffer)) garden.emplace_back(buffer); std::cerr << part1(garden) << '\n'; std::cerr << part2(garden) << '\n'; return 0; } --- 2023/c++/day22.cpp --- #include <algorithm> #include <iostream> #include <map> #include <queue> #include <ranges> #include <set> #include <sstream> #include <string> struct Point { union { int arr[3]; struct { int x; int y; int z; }; }; }; struct Brick { size_t id; Point begin; Point end; }; struct CollisionData { std::vector<int> supports; std::vector<int> supportedBy; }; using CollisionDataMap = std::map<size_t, CollisionData>; CollisionDataMap simulateGravity(std::vector<Brick> bricks) { std::sort(bricks.begin(), bricks.end(), [](Brick lhs, Brick rhs) { return rhs.begin.z > lhs.begin.z; }); CollisionDataMap collisionDatas; for (auto &[i, b, e] : bricks) { collisionDatas[i].supports = {}; std::vector<std::pair<int, int>> maybeCollides; int zCollision = 1; for (auto &&[ci, cb, ce] : bricks) { if (i == ci) continue; int xb = std::max(cb.x, b.x); int xe = std::min(ce.x, e.x); int yb = std::max(cb.y, b.y); int ye = std::min(ce.y, e.y); if (xb > xe || yb > ye) continue; if (ce.z + 1 <= b.z) { zCollision = std::max(zCollision, ce.z + 1); maybeCollides.emplace_back(ci, ce.z + 1); } } int fall = b.z - zCollision; b.z -= fall; e.z -= fall; for (auto &&[id, z] : maybeCollides) { if (z == zCollision) { collisionDatas[id].supports.emplace_back(i); collisionDatas[i].supportedBy.emplace_back(id); } } } return collisionDatas; } size_t part1(const CollisionDataMap &collisionDatas) { size_t removed = 0; for (auto &&[block, data] : collisionDatas) { bool canRemove = true; for (auto &&supported : data.supports) canRemove &= collisionDatas.at(supported).supportedBy.size() > 1; removed += canRemove; } return removed; } size_t part2(const CollisionDataMap &collisionDatas) { size_t total = 0; for (auto &&[block, _] : collisionDatas) { std::queue<int> q; q.emplace(block); std::set<int> visited; visited.emplace(block); size_t falling = 0; while (!q.empty()) { int b = q.front(); q.pop(); for (auto &&supported : collisionDatas.at(b).supports) { if (visited.contains(supported)) continue; bool supportersFalling = true; for (auto &&supporter : collisionDatas.at(supported).supportedBy) supportersFalling &= visited.contains(supporter); if (supportersFalling) { q.emplace(supported); visited.emplace(supported); falling += 1; } } } total += falling; } return total; } int main() { auto parsePoint = [](std::istream &s) -> Point { Point p{}; for (int &coord : p.arr) { s >> coord; s.get(); } return p; }; std::vector<Brick> bricks; std::string buffer; while (std::getline(std::cin, buffer)) { std::stringstream ss(buffer); bricks.push_back({bricks.size(), parsePoint(ss), parsePoint(ss)}); } auto collisionDatas = simulateGravity(std::move(bricks)); std::cerr << part1(collisionDatas) << '\n'; std::cerr << part2(collisionDatas) << '\n'; return 0; } --- 2023/c++/day23.cpp --- #include <iostream> #include <optional> #include <queue> #include <set> #include <string> #include <vector> using Point = std::pair<int, int>; using Dir = std::pair<int, int>; using Edge = std::pair<int, int>; const static Dir DIRS[] = {{1, 0}, {-1, 0}, {0, -1}, {0, 1}}; static std::optional<Point> stepInDir(const std::vector<std::string> &map, const Point &pos, const Dir &dir) { int nr = pos.first + dir.first; int nc = pos.second + dir.second; if (nr < 0 || nr >= map.size() || nc < 0 || nc >= map[0].size() || map[nr][nc] == '#') return std::nullopt; return {{nr, nc}}; } size_t traverse(const std::vector<std::string> &map, const Point &pos, size_t steps, std::set<Point> &visited) { if (!visited.emplace(pos).second) return 0; const auto &[r, c] = pos; const auto cur = map[r][c]; size_t res = 0; if (r == map.size() - 1) res = steps; else if (cur == '>') res = traverse(map, {r, c + 1}, steps + 1, visited); else if (cur == '^') res = traverse(map, {r - 1, c}, steps + 1, visited); else if (cur == '<') res = traverse(map, {r, c - 1}, steps + 1, visited); else if (cur == 'v') res = traverse(map, {r + 1, c}, steps + 1, visited); else for (auto &&d : DIRS) if (const auto &nd = stepInDir(map, pos, d)) res = std::max(res, traverse(map, *nd, steps + 1, visited)); visited.erase(pos); return res; } size_t part1(const std::vector<std::string> &map) { std::set<Point> visited; return traverse(map, {0, map[0].find('.')}, 0, visited); } size_t traverse2(std::vector<std::set<Edge>> &map, int pos, size_t steps, std::set<int> &visited) { if (!visited.emplace(pos).second) return 0; if (pos == map.size() - 1) { visited.erase(pos); return steps; } size_t out = 0; for (auto &&[dst, w] : map.at(pos)) out = std::max(out, traverse2(map, dst, steps + w, visited)); visited.erase(pos); return out; } size_t part2(std::vector<std::string> map) { std::vector<std::pair<int, Point>> pois; pois.push_back({pois.size(), {0, map[0].find('.')}}); for (size_t r = 0; r < map.size(); ++r) { for (size_t c = 0; c < map[0].size(); ++c) { if (map[r][c] != '.') continue; int roads = 0; for (auto &&d : DIRS) if (stepInDir(map, {r, c}, d)) ++roads; if (roads > 2) pois.emplace_back(pois.size(), Point(r, c)); } } pois.emplace_back(pois.size(), Point(map.size() - 1, map.back().find('.'))); std::vector<std::set<Edge>> edges(pois.size()); for (auto &&[pid, pp] : pois) { std::set<Point> visited; std::queue<std::pair<int, Point>> q; q.emplace(0, pp); while (!q.empty()) { auto [s, p] = q.front(); q.pop(); int pid2 = -1; for (auto &&[id, p2] : pois) { if (id != pid && p == p2) pid2 = id; } if (pid2 != -1) { edges[pid].emplace(pid2, s); edges[pid2].emplace(pid, s); continue; } if (!visited.emplace(p).second) continue; for (auto &&d : DIRS) if (const auto &nd = stepInDir(map, p, d)) q.emplace(s + 1, *nd); } } std::set<int> visited; return traverse2(edges, 0, 0, visited); } int main() { std::vector<std::string> map; std::string buffer; while (std::getline(std::cin, buffer)) map.emplace_back(buffer); std::cerr << part1(map) << '\n'; std::cerr << part2(map) << '\n'; return 0; } --- 2023/c++/day24.cpp --- #include <cmath> #include <iostream> #include <optional> #include <ranges> #include <sstream> #include <string> #include <vector> const float epsilon = 1e-3; struct Vec3 { long long x; long long y; long long z; Vec3 operator+(const Vec3 &rhs) const { return {x + rhs.x, y + rhs.y, z + rhs.z}; } Vec3 operator-(const Vec3 &rhs) const { return {x - rhs.x, y - rhs.y, z - rhs.z}; } Vec3 operator*(long long n) const { return {x * n, y * n, z * n}; } bool operator==(const Vec3 &rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z; } }; struct Hailstone { Vec3 pos; Vec3 dir; }; std::optional<std::pair<double, double>> intersect(const Hailstone &h1, const Hailstone &h2) { const auto &[p1, d1] = h1; const auto &[p2, d2] = h2; double a = d1.y / (d1.x * 1.); double c = p1.y - a * p1.x; double b = d2.y / (d2.x * 1.); double d = p2.y - b * p2.x; if (std::abs(a - b) < epsilon) return std::nullopt; double x = (d - c) / (a - b); double t1 = (x - p1.x) / (d1.x * 1.); double t2 = (x - p2.x) / (d2.x * 1.); if (t1 < 0 || t2 < 0) return std::nullopt; return std::make_pair(t1, t2); } size_t part1(const std::vector<Hailstone> &hailstones) { const size_t begin = 200000000000000; const size_t end = 400000000000000; size_t cnt = 0; for (auto i : std::views::iota(0U, hailstones.size())) { for (auto j : std::views::iota(i + 1, hailstones.size())) { if (auto is = intersect(hailstones[i], hailstones[j])) { const auto &[p, d] = hailstones[i]; double x = p.x + is->first * d.x; double y = p.y + is->first * d.y; if (begin <= x && x <= end && begin <= y && y <= end) ++cnt; } } } return cnt; } size_t part2(const std::vector<Hailstone> &hailstones) { const int n = 250; for (int x : std::ranges::views::iota(-n, n + 1)) { for (int y : std::ranges::views::iota(-n, n + 1)) { for (int z : std::ranges::views::iota(-n, n + 1)) { Vec3 cv{x, y, z}; auto [p0, d0] = hailstones[0]; auto [p1, d1] = hailstones[1]; d0 = d0 - cv; d1 = d1 - cv; if (d0.x == 0 || d1.x == 0) continue; if (auto ts = intersect({p0, d0}, {p1, d1})) { auto [t1, t2] = *ts; if (std::abs(std::round(t1) - t1) >= epsilon || std::abs(std::round(t2) - t2) >= epsilon) continue; Vec3 intersection = p0 + d0 * t1; const auto &[ix, iy, iz] = intersection; if (iz != p1.z + t2 * d1.z) continue; bool hit = true; for (size_t i = 2; hit && i < hailstones.size(); ++i) { auto [cp, cd] = hailstones[i]; auto nd = cd - cv; long long tt = (ix - cp.x) / nd.x; hit &= intersection == cp + nd * tt; } if (hit) return ix + iy + iz; } } } } return 0; } int main() { auto parseVec3 = [](std::istream &s) -> Vec3 { Vec3 v{}; decltype(v.x) *coords[] = {&v.x, &v.y, &v.z}; for (auto *c : coords) { s >> *c; s.get(); s.get(); } return v; }; std::vector<Hailstone> hailstones; std::string buffer; while (std::getline(std::cin, buffer)) { std::stringstream ss(buffer); hailstones.push_back({parseVec3(ss), parseVec3(ss)}); } std::cerr << part1(hailstones) << '\n'; std::cerr << part2(hailstones) << '\n'; return 0; } --- 2023/c++/day25.cpp --- #include <iostream> #include <map> #include <random> #include <ranges> #include <set> #include <sstream> #include <string> #include <vector> size_t part1(const std::map<std::string, std::set<std::string>> &components) { std::map<std::string, int> node2id; for (auto &&[node, _] : components) node2id[node] = node2id.size(); std::vector<std::set<int>> originalSubsets; std::vector<std::pair<int, int>> originalEdges; for (auto &&[n, es] : components) { originalSubsets.push_back({node2id[n]}); for (auto &&e : es) originalEdges.emplace_back(node2id[n], node2id[e]); } std::mt19937 mt(std::random_device{}()); while (true) { std::vector<std::set<int>> subsets = originalSubsets; std::vector<std::pair<int, int>> edges = originalEdges; while (subsets.size() > 2) { int n = std::uniform_int_distribution<int>(0, edges.size() - 1)(mt); auto [b, e] = edges[n]; edges.erase(edges.begin() + n); int s1 = -1; int s2 = -1; for (auto i : std::views::iota(0U, subsets.size())) { if (subsets[i].contains(b)) s1 = i; if (subsets[i].contains(e)) s2 = i; } if (s1 == s2) continue; subsets[s1].insert(subsets[s2].begin(), subsets[s2].end()); subsets.erase(subsets.begin() + s2); } size_t cuts = 0; for (auto &&[b, e] : originalEdges) if (subsets[0].contains(b) && subsets[1].contains(e)) ++cuts; if (cuts == 3) return subsets[0].size() * subsets[1].size(); } } size_t part2() { return 0; } int main() { std::map<std::string, std::set<std::string>> components; std::string buffer; while (std::getline(std::cin, buffer)) { std::stringstream ss(buffer); ss >> buffer; buffer.pop_back(); std::string head = buffer; while (ss >> buffer) { components[head].emplace(buffer); components[buffer].emplace(head); } } std::cerr << part1(components) << '\n'; std::cerr << part2() << '\n'; return 0; } --- 2023/c++/day3.cpp --- #include <iostream> #include <string> #include <vector> bool isDigit(char c) { return c >= '0' && c <= '9'; }; int part1(const std::vector<std::string> &lines) { int out = 0; for (int i = 0; i < lines.size(); ++i) { for (int j = 0; j < lines[i].size(); ++j) { if (lines[i][j] == '.' || isDigit(lines[i][j])) continue; static int di[] = {-1, -1, -1, 0, 0, 1, 1, 1}; static int dj[] = {0, -1, 1, -1, 1, 0, -1, 1}; for (int d = 0; d < sizeof(di) / sizeof(di[0]); ++d) { int ti = i + di[d]; int tj = j + dj[d]; if (ti < 0 || ti >= lines.size()) continue; if (tj < 0 || tj >= lines[i].size()) continue; if (!isDigit(lines[ti][tj])) continue; int b = tj; int e = tj; while (b >= 0 && isDigit(lines[ti][b])) --b; while (e < lines[ti].size() && isDigit(lines[ti][e])) ++e; int n = std::stoi(lines[ti].substr(b + 1, e - b - 1)); // If the character directly above or below the symbol is // a number, there cannot be one more adjacent number in // the same row, so the checks for that can be skipped. if (d == 0 || d == 5) d += 2; out += n; } } } return out; }; int part2(const std::vector<std::string> &lines) { int out = 0; for (int i = 0; i < lines.size(); ++i) { for (int j = 0; j < lines[i].size(); ++j) { if (lines[i][j] != '*') continue; static int di[] = {-1, -1, -1, 0, 0, 1, 1, 1}; static int dj[] = {0, -1, 1, -1, 1, 0, -1, 1}; int n1 = 0, n2 = 0; for (int d = 0; d < sizeof(di) / sizeof(di[0]); ++d) { int ti = i + di[d]; int tj = j + dj[d]; if (ti < 0 || ti >= lines.size()) continue; if (tj < 0 || tj >= lines[i].size()) continue; if (!isDigit(lines[ti][tj])) continue; int b = tj; int e = tj; while (b >= 0 && isDigit(lines[ti][b])) --b; while (e < lines[ti].size() && isDigit(lines[ti][e])) ++e; int n = std::stoi(lines[ti].substr(b + 1, e - b - 1)); if (!n1) { n1 = n; } else if (!n2) { n2 = n; } else { n1 = n2 = 0; break; } // If the character directly above or below the symbol is // a number, there cannot be one more adjacent number in // the same row, so the checks for that can be skipped. if (d == 0 || d == 5) d += 2; } out += n1 * n2; } } return out; } int main() { std::vector<std::string> lines; std::string line; while (std::getline(std::cin, line)) { lines.emplace_back(line); } std::cout << part1(lines) << '\n'; std::cout << part2(lines) << '\n'; return 0; } --- 2023/c++/day4.cpp --- #include <iostream> #include <set> #include <sstream> #include <string> #include <vector> size_t part1(const std::string &line) { std::stringstream ss(line); std::set<int> winningNumbers; // Game X: int id = 0; std::string str; ss >> str >> id; ss.get(); size_t score = 0; int n = 0; while (ss >> n) { winningNumbers.emplace(n); } ss.clear(); ss >> str; while (ss >> n) { if (winningNumbers.contains(n)) { score = score == 0 ? 1 : (score << 1); } } return score; }; size_t part2(const std::string &line, size_t totalLines) { std::stringstream ss(line); // Game X: int id = 0; std::string str; ss >> str >> id; ss.get(); static std::vector<int> cache(totalLines + 1, 0); ++cache[id]; std::set<int> winningNumbers; int n = 0; while (ss >> n) { winningNumbers.emplace(n); } ss.clear(); ss >> str; int cnt = 1; while (ss >> n) { if (winningNumbers.contains(n) && id + cnt <= totalLines) { cache[id + cnt] += cache[id]; ++cnt; } } return cache[id]; } int main() { std::vector<std::string> lines; std::string line; while (std::getline(std::cin, line)) { lines.emplace_back(line); } size_t part1Sum = 0; size_t part2Sum = 0; for (auto &&line : lines) { part1Sum += part1(line); part2Sum += part2(line, lines.size()); } std::cout << part1Sum << '\n'; std::cout << part2Sum << '\n'; return 0; } --- 2023/c++/day5.cpp --- #include <iostream> #include <sstream> #include <string> #include <vector> unsigned part1(const std::vector<std::string> &lines) { std::stringstream ss(lines[0]); std::string dummy; ss >> dummy; std::vector<unsigned> nums; unsigned n = 0; while (ss >> n) { nums.emplace_back(n); } std::vector<unsigned> tmp = nums; for (unsigned i = 1; i < lines.size(); ++i) { ss.clear(); ss.str(lines[i]); unsigned dst = 0, src = 0, len = 0; if (!(ss >> dst >> src >> len)) { nums = tmp; ++i; continue; } for (unsigned i = 0; i < nums.size(); ++i) { auto prev = nums[i]; if (prev >= src && prev < src + len) { tmp[i] = dst + prev - src; } } } return *std::min_element(tmp.begin(), tmp.end()); }; // Brute-force unsigned part2(const std::vector<std::string> &lines) { std::stringstream ss(lines[0]); std::string dummy; ss >> dummy; std::vector<unsigned> nums; unsigned b = 0, l = 0; while (ss >> b >> l) { std::cerr << '(' << b << ", " << l << ")\n"; for (unsigned i = 0; i < l; ++i) { nums.emplace_back(b + i); } } std::vector<unsigned> tmp = nums; for (unsigned i = 1; i < lines.size(); ++i) { std::cerr << lines[i] << '\n'; ss.clear(); ss.str(lines[i]); unsigned dst = 0, src = 0, len = 0; if (!(ss >> dst >> src >> len)) { nums = tmp; ++i; continue; } for (unsigned i = 0; i < nums.size(); ++i) { auto prev = nums[i]; if (prev >= src && prev < src + len) { tmp[i] = dst + prev - src; } } } return *std::min_element(tmp.begin(), tmp.end()); } int main() { std::vector<std::string> lines; std::string line; while (std::getline(std::cin, line)) { lines.emplace_back(line); } std::cout << part1(lines) << '\n'; std::cout << part2(lines) << '\n'; return 0; } --- 2023/c++/day6.cpp --- #include <iostream> #include <sstream> #include <string> #include <vector> size_t part1(const std::vector<std::string> &lines) { std::vector<int> times; std::vector<int> distances; std::string category; int n = 0; std::stringstream ss(lines[0]); ss >> category; while (ss >> n) { times.emplace_back(n); } ss = std::stringstream(lines[1]); ss >> category; while (ss >> n) { distances.emplace_back(n); } size_t out = 1; for (size_t i = 0; i < times.size(); ++i) { size_t cnt = 0; for (int j = 0; j <= times[i]; ++j) { if ((times[i] - j) * j > distances[i]) { ++cnt; } } out *= cnt; } return out; }; size_t part2(const std::vector<std::string> &lines) { std::vector<int> times; std::vector<int> distances; std::stringstream ss(lines[0]); std::string category; ss >> category; std::string time; std::string partial; while (ss >> partial) { time += partial; } ss = std::stringstream(lines[1]); ss >> category; std::string distance; while (ss >> partial) { distance += partial; } size_t out = 0; size_t t = std::stol(time); size_t d = std::stol(distance); for (int j = 0; j <= t; ++j) { if ((t - j) * j > d) { ++out; } } return out; } int main() { std::vector<std::string> lines; std::string line; while (std::getline(std::cin, line)) { lines.emplace_back(line); } std::cout << part1(lines) << '\n'; std::cout << part2(lines) << '\n'; return 0; } --- 2023/c++/day7.cpp --- #include <algorithm> #include <iostream> #include <map> #include <sstream> #include <string> #include <vector> enum class Kind { FIVE_OF_A_KIND = 6, FOUR_OF_A_KIND = 5, FULL_HOUSE = 4, THREE_OF_A_KIND = 3, TWO_PAIR = 2, ONE_PAIR = 1, HIGH_CARD = 0 }; bool JOKERS = false; Kind getKind(const std::string &hand) { std::map<char, int> counts; for (auto &&c : hand) { counts[c] += 1; } bool hasNonJokerPair = false; bool hasNonJokerTriplet = false; int jokers = JOKERS ? counts['J'] : 0; for (auto [c, cnt] : counts) { bool isJoker = JOKERS && c == 'J'; switch (cnt) { case 5: { return Kind::FIVE_OF_A_KIND; } case 4: { if (isJoker || jokers == 1) return Kind::FIVE_OF_A_KIND; return Kind::FOUR_OF_A_KIND; } case 3: { if ((isJoker && hasNonJokerPair) || jokers == 2) return Kind::FIVE_OF_A_KIND; if (jokers == 1) return Kind::FOUR_OF_A_KIND; if (hasNonJokerPair) return Kind::FULL_HOUSE; hasNonJokerTriplet = !isJoker; break; } case 2: { if ((isJoker && hasNonJokerTriplet) || jokers == 3) return Kind::FIVE_OF_A_KIND; if ((isJoker && hasNonJokerPair) || (!isJoker && jokers == 2)) return Kind::FOUR_OF_A_KIND; if (hasNonJokerTriplet) return Kind::FULL_HOUSE; if (hasNonJokerPair) return jokers == 1 ? Kind::FULL_HOUSE : Kind::TWO_PAIR; hasNonJokerPair = !isJoker; } } } if (jokers == 3) return Kind::FOUR_OF_A_KIND; if (jokers == 2 || hasNonJokerTriplet) return Kind::THREE_OF_A_KIND; if (jokers == 1 || hasNonJokerPair) return (jokers == 1 && hasNonJokerPair) ? Kind::THREE_OF_A_KIND : Kind::ONE_PAIR; return Kind::HIGH_CARD; }; int getCardStrength(char c) { switch (c) { case 'A': return 14; case 'K': return 13; case 'Q': return 12; case 'J': return JOKERS ? 1 : 11; case 'T': return 10; default: return c - '0'; } } using HandsType = std::pair<std::string, int>; bool cardValueLess(const HandsType &a, const HandsType &b) { Kind aKind = getKind(a.first); Kind bKind = getKind(b.first); if (aKind == bKind) { size_t i = 0; while (i < a.first.size() && a.first[i] == b.first[i]) { ++i; } return getCardStrength(a.first[i]) < getCardStrength(b.first[i]); } return aKind < bKind; } size_t part1(const std::vector<std::string> &lines) { std::vector<HandsType> hands; std::string hand; int bid = 0; for (auto &&line : lines) { std::stringstream ss(line); ss >> hand >> bid; hands.emplace_back(hand, bid); } std::sort(hands.begin(), hands.end(), cardValueLess); size_t winnings = 0; for (size_t i = 0; i < hands.size(); ++i) { winnings += (i + 1) * hands[i].second; } return winnings; }; size_t part2(const std::vector<std::string> &lines) { std::vector<HandsType> hands; std::string hand; int bid = 0; for (auto &&line : lines) { std::stringstream ss(line); ss >> hand >> bid; hands.emplace_back(hand, bid); } JOKERS = true; std::sort(hands.begin(), hands.end(), cardValueLess); size_t winnings = 0; for (size_t i = 0; i < hands.size(); ++i) { winnings += (i + 1) * hands[i].second; } return winnings; } int main() { std::vector<std::string> lines; std::string line; while (std::getline(std::cin, line)) { lines.emplace_back(line); } std::cout << part1(lines) << '\n'; std::cout << part2(lines) << '\n'; return 0; } --- 2023/c++/day8.cpp --- #include <iostream> #include <map> #include <numeric> #include <ranges> #include <sstream> #include <string> #include <utility> #include <vector> size_t part1(const std::vector<std::string> &lines) { std::string dirs = lines[0]; std::map<std::string, std::pair<std::string, std::string>> m; for (auto &&line : lines | std::ranges::views::drop(2)) { std::stringstream ss(line); std::string base; std::string left; std::string right; ss >> base; // eat ' = ' ss >> left; ss >> left; ss >> right; left = left.substr(1, left.size() - 2); right.pop_back(); m[base] = {left, right}; } std::string curNode = "AAA"; size_t i = 0; size_t steps = 0; while (curNode != "ZZZ") { curNode = (dirs[i] == 'L') ? m[curNode].first : m[curNode].second; i = (i + 1) % dirs.size(); ++steps; } return steps; }; size_t part2(const std::vector<std::string> &lines) { std::string dirs = lines[0]; std::map<std::string, std::pair<std::string, std::string>> m; std::vector<std::string> curNodes; for (auto &&line : lines | std::ranges::views::drop(2)) { std::stringstream ss(line); std::string base; std::string left; std::string right; ss >> base; // eat ' = ' ss >> left; ss >> left; ss >> right; left = left.substr(1, left.size() - 2); right.pop_back(); m[base] = {left, right}; if (base[2] == 'A') { curNodes.emplace_back(base); } } size_t lcm = 1; for (auto &node : curNodes) { size_t i = 0; size_t steps = 0; while (node[2] != 'Z') { node = (dirs[i] == 'L') ? m[node].first : m[node].second; i = (i + 1) % dirs.size(); ++steps; } lcm = std::lcm(lcm, steps); } return lcm; } int main() { std::vector<std::string> lines; std::string line; while (std::getline(std::cin, line)) { lines.emplace_back(line); } std::cout << part1(lines) << '\n'; std::cout << part2(lines) << '\n'; return 0; } --- 2023/c++/day9.cpp --- #include <iostream> #include <ranges> #include <sstream> #include <string> #include <vector> int part1(const std::vector<std::vector<int>> &sequences) { int out = 0; for (auto &&s : sequences) out += s.back(); return out; }; int part2(const std::vector<std::vector<int>> &sequences) { int out = 0; for (auto &&s : sequences | std::ranges::views::reverse) out = s.front() - out; return out; } int main() { int part1Sum = 0; int part2Sum = 0; std::string line; while (std::getline(std::cin, line)) { std::stringstream ss(line); std::vector<std::vector<int>> sequences(1); int n = 0; while (ss >> n) { sequences[0].emplace_back(n); } while (true) { std::vector<int> tmp; bool allZeroes = true; for (size_t i = 0; i < sequences.back().size() - 1; ++i) { int diff = sequences.back()[i + 1] - sequences.back()[i]; allZeroes &= diff == 0; tmp.emplace_back(diff); } if (allZeroes) break; sequences.emplace_back(std::move(tmp)); } part1Sum += part1(sequences); part2Sum += part2(sequences); } std::cout << part1Sum << '\n'; std::cout << part2Sum << '\n'; return 0; } --- 2023/mojo/day1.🔥 --- from python import Python fn assignFirstLast(inout first: Int, inout last: Int, val: Int): if first == -1: first = val else: last = val fn part1(line: String) -> Int: var first = -1 var last = -1 for i in range(len(line)): let asciiVal = ord(line[i]) if isdigit(asciiVal): assignFirstLast(first, last, asciiVal - ord("0")) if last == -1: last = first return 10 * first + last fn getKeywordValue(s: String) -> Int: if s == "one": return 1 if s == "two": return 2 if s == "three": return 3 if s == "four": return 4 if s == "five": return 5 if s == "six": return 6 if s == "seven": return 7 if s == "eight": return 8 if s == "nine": return 9 return -1 fn part2(line: String) -> Int: var first = -1 var last = -1 for i in range(len(line)): let asciiVal = ord(line[i]) if isdigit(asciiVal): assignFirstLast(first, last, asciiVal - ord("0")) continue for n in range(3, 6): let keywordVal = getKeywordValue(line[i : i + n]) if keywordVal != -1: assignFirstLast(first, last, keywordVal) if last == -1: last = first return 10 * first + last def main(): var py = Python() let sys = py.import_module("sys") var part1Sum = 0 var part2Sum = 0 for line in sys.stdin: part1Sum += part1(py.__str__(line)) part2Sum += part2(py.__str__(line)) print(part1Sum) print(part2Sum) --- 2023/mojo/day10.🔥 --- from utils.static_tuple import StaticTuple from collections.vector import DynamicVector @value struct Pair[T: CollectionElement, R: CollectionElement](CollectionElement): var a: T var b: R fn contains(v: DynamicVector[Pair[Int, Int]], elem: Pair[Int, Int]) -> Bool: for i in range(0, len(v)): if v[i].a == elem.a and v[i].b == elem.b: return True return False fn part1(grid: DynamicVector[String]) -> Int: var start = Pair(0, 0) for i in range(0, len(grid)): for j in range(0, len(grid[i])): if grid[i][j] == "S": start = Pair(i, j) var visited = DynamicVector[Pair[Int, Int]]() var queue = DynamicVector[Pair[Int, Int]]() var qFront = 0 queue.push_back(start) visited.push_back(start) queue.push_back(Pair(-1, -1)) var steps = 0 while qFront < len(queue): let f = queue[qFront] qFront += 1 if f.a == -1: steps += 1 if qFront < len(queue): queue.push_back(Pair(-1, -1)) continue let vr = StaticTuple[4](0, 0, 1, -1) let vc = StaticTuple[4](1, -1, 0, 0) let dst = StaticTuple[4]("-J7", "-FL", "|LJ", "|F7") let org = StaticTuple[4]("S-FL", "S-J7", "S|F7", "S|JL") for i in range(0, len(vr)): let tr = f.a + vr[i] let tc = f.b + vc[i] let c = grid[f.a][f.b] if ( tr < 0 or tr >= len(grid) or tc < 0 or tc >= len(grid[0]) or str(org[i]).rfind(c) == -1 ): continue let p = Pair(tr, tc) if str(dst[i]).rfind(grid[tr][tc]) != -1 and not contains(visited, p): queue.push_back(p) visited.push_back(p) return steps - 1 fn part2(grid: DynamicVector[String]) -> Int: let vr = StaticTuple[4](0, 0, 1, -1) let vc = StaticTuple[4](1, -1, 0, 0) var start = Pair(0, 0) for i in range(0, len(grid)): for j in range(0, len(grid[i])): if grid[i][j] == "S": start = Pair(i, j) var visited = DynamicVector[Pair[Int, Int]]() var queue = DynamicVector[Pair[Int, Int]]() var qFront = 0 queue.push_back(start) visited.push_back(start) var startDirs = 0 while qFront < len(queue): let f = queue[qFront] qFront += 1 let dst = StaticTuple[4]("-J7", "-FL", "|LJ", "|F7") let org = StaticTuple[4]("S-FL", "S-J7", "S|F7", "S|JL") for i in range(0, len(vr)): let tr = f.a + vr[i] let tc = f.b + vc[i] let c = grid[f.a][f.b] if ( tr < 0 or tr >= len(grid) or tc < 0 or tc >= len(grid[0]) or str(org[i]).rfind(c) == -1 ): continue let p = Pair(tr, tc) if str(dst[i]).rfind(grid[tr][tc]) != -1 and not contains(visited, p): if c == "S": startDirs |= 1 << i queue.push_back(p) visited.push_back(p) var scaledGrid = DynamicVector[String]() var s = str("") for i in range(0, len(grid[0]) * 2 + 1): s += "." scaledGrid.push_back(s) for i in range(0, len(grid)): s = str(".") for j in range(0, len(grid[i])): if not contains(visited, Pair(i, j)): s += ".." continue var c = grid[i][j] if c == "S": if startDirs == 0b0101: c = "F" elif startDirs == 0b1001: c = "L" elif startDirs == 0b0110: c = "7" elif startDirs == 0b1010: c = "J" elif startDirs == 0b0011: c = "-" elif startDirs == 0b1100: c = "|" s += c if str("FL-").rfind(c) != -1: s += "-" else: s += "." scaledGrid.push_back(s) var s2 = str("") for i in range(0, len(s)): if str("F7|").rfind(s[i]) != -1: s2 += "|" else: s2 += "." scaledGrid.push_back(s2) queue.clear() qFront = 0 visited.clear() queue.push_back(Pair(0, 0)) visited.push_back(Pair(0, 0)) while qFront < len(queue): let f = queue[qFront] qFront += 1 for i in range(0, len(vr)): let tr = f.a + vr[i] let tc = f.b + vc[i] let c = scaledGrid[f.a][f.b] if tr < 0 or tr >= len(scaledGrid) or tc < 0 or tc >= len(scaledGrid[0]): continue let p = Pair(tr, tc) if c == "." and not contains(visited, p): queue.push_back(p) visited.push_back(p) var cnt = 0 for i in range(1, len(scaledGrid), 2): for j in range(1, len(scaledGrid[i]), 2): if not contains(visited, Pair(i, j)) and scaledGrid[i][j] == ".": cnt += 1 return cnt fn main() raises: with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") print(part1(lines)) print(part2(lines)) --- 2023/mojo/day11.🔥 --- from collections.vector import DynamicVector from math import abs, min, max @value struct Pair[T: CollectionElement, R: CollectionElement](CollectionElement): var a: T var b: R fn contains(v: DynamicVector[Int], elem: Int) -> Bool: for i in range(0, len(v)): if v[i] == elem: return True return False fn part1(grid: DynamicVector[String]) -> UInt64: var galaxies = DynamicVector[Pair[Int, Int]]() var occupiedRows = DynamicVector[Int]() var occupiedCols = DynamicVector[Int]() for i in range(0, len(grid)): for j in range(0, len(grid[0])): if grid[i][j] == "#": galaxies.push_back(Pair(i, j)) occupiedRows.push_back(i) occupiedCols.push_back(j) var totalDist: UInt64 = 0 for i in range(0, len(galaxies)): for j in range(i + 1, len(galaxies)): let g1 = galaxies[i] let g2 = galaxies[j] var dist = abs(g1.a - g2.a) + abs(g1.b - g2.b) for k in range(min(g1.a, g2.a), max(g1.a, g2.a)): if not contains(occupiedRows, k): dist += 1 for k in range(min(g1.b, g2.b), max(g1.b, g2.b)): if not contains(occupiedCols, k): dist += 1 totalDist += dist return totalDist fn part2(grid: DynamicVector[String]) -> UInt64: var galaxies = DynamicVector[Pair[Int, Int]]() var occupiedRows = DynamicVector[Int]() var occupiedCols = DynamicVector[Int]() for i in range(0, len(grid)): for j in range(0, len(grid[0])): if grid[i][j] == "#": galaxies.push_back(Pair(i, j)) occupiedRows.push_back(i) occupiedCols.push_back(j) var totalDist: UInt64 = 0 for i in range(0, len(galaxies)): for j in range(i + 1, len(galaxies)): let g1 = galaxies[i] let g2 = galaxies[j] var dist = abs(g1.a - g2.a) + abs(g1.b - g2.b) for k in range(min(g1.a, g2.a), max(g1.a, g2.a)): if not contains(occupiedRows, k): dist += 1000000 - 1 for k in range(min(g1.b, g2.b), max(g1.b, g2.b)): if not contains(occupiedCols, k): dist += 1000000 - 1 totalDist += dist return totalDist fn main() raises: with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") print(part1(lines)) print(part2(lines)) --- 2023/mojo/day12.🔥 --- from collections.vector import DynamicVector fn memo(springs: String, groups: DynamicVector[Int]) -> Int64: var cache = DynamicVector[DynamicVector[Int64]]() cache.resize(len(springs), DynamicVector[Int64]()) for i in range(0, len(springs)): cache[i].resize(len(groups), -1) return dp(springs, groups, cache) fn dp( springs: String, groups: DynamicVector[Int], inout cache: DynamicVector[DynamicVector[Int64]], li: Int = 0, gi: Int = 0, ) -> Int64: if li >= len(springs): return gi == len(groups) if gi < len(groups) and cache[li][gi] != -1: return cache[li][gi] var i = li while i < len(springs): if springs[i] == ".": i += 1 continue if gi == len(groups): if springs[i] == "#": return 0 i += 1 continue let base = i while i < len(springs) and (springs[i] == "?" or springs[i] == "#"): i += 1 let next = groups[gi] var replaced: Int64 = 0 var skipped: Int64 = 0 if i - base >= next and ( base + next == len(springs) or springs[base + next] != "#" ): replaced = dp(springs, groups, cache, base + 1 + next, gi + 1) if springs[base] == "?": skipped = dp(springs, groups, cache, base + 1, gi) cache[li][gi] = replaced + skipped return replaced + skipped return gi == len(groups) fn part1(line: String) raises -> Int64: let split = line.split(" ") let springs = split[0] let groups = split[1].split(",") var nums = DynamicVector[Int]() for i in range(0, len(groups)): nums.push_back(atol(groups[i])) return memo(springs, nums) fn part2(line: String) raises -> Int64: let split = line.split(" ") let tmp = split[1].split(",") var groups = tmp var springs = split[0] for i in range(0, 4): springs += "?" + split[0] for j in range(0, len(tmp)): groups.push_back(tmp[j]) var nums = DynamicVector[Int]() for i in range(0, len(groups)): nums.push_back(atol(groups[i])) return memo(springs, nums) def main(): var part1Sum: Int64 = 0 var part2Sum: Int64 = 0 with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") for i in range(0, len(lines)): if len(lines[i]) == 0: continue part1Sum += part1(lines[i]) part2Sum += part2(lines[i]) print(part1Sum) print(part2Sum) --- 2023/mojo/day13.🔥 --- from collections.vector import DynamicVector fn part1(block: DynamicVector[String]) raises -> Int: fn getMirror(block: DynamicVector[String], reflections: DynamicVector[Int]) -> Int: for i in range(0, len(reflections)): let r = reflections[i] var mirror = True for j in range(0, r): let opposite = r + (r - j) - 1 if opposite >= len(block): continue mirror = mirror and block[j] == block[opposite] if mirror: return r return 0 var reflRows = DynamicVector[Int]() for i in range(0, len(block) - 1): if block[i] == block[i + 1]: reflRows.push_back(i + 1) let r = getMirror(block, reflRows) if r: return r * 100 var rotated = DynamicVector[String]() for i in range(0, len(block[0])): var col = String() for j in range(0, len(block)): col += block[j][i] rotated.push_back(col) var reflCols = DynamicVector[Int]() for i in range(0, len(rotated) - 1): if rotated[i] == rotated[i + 1]: reflCols.push_back(i + 1) return getMirror(rotated, reflCols) fn part2(block: DynamicVector[String]) raises -> Int: fn countDiff(a: String, b: String) -> Int: var diff = 0 for i in range(0, len(a)): if a[i] != b[i]: diff += 1 return diff fn getMirror(block: DynamicVector[String], reflections: DynamicVector[Int]) -> Int: for i in range(0, len(reflections)): let r = reflections[i] var correction = False var mirror = True for j in range(0, r): let opposite = r + (r - j) - 1 if opposite >= len(block): continue let diff = countDiff(block[j], block[opposite]) mirror = mirror and (diff == 0 or (diff == 1 and not correction)) correction = correction or diff != 0 if mirror and correction: return r return 0 var reflRows = DynamicVector[Int]() for i in range(0, len(block) - 1): if countDiff(block[i], block[i + 1]) <= 1: reflRows.push_back(i + 1) let r = getMirror(block, reflRows) if r: return r * 100 var rotated = DynamicVector[String]() for i in range(0, len(block[0])): var col = String() for j in range(0, len(block)): col += block[j][i] rotated.push_back(col) var reflCols = DynamicVector[Int]() for i in range(0, len(rotated) - 1): if countDiff(rotated[i], rotated[i + 1]) <= 1: reflCols.push_back(i + 1) return getMirror(rotated, reflCols) def main(): var part1Sum: Int64 = 0 var part2Sum: Int64 = 0 with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") var block = DynamicVector[String]() for i in range(0, len(lines)): if len(lines[i]) != 0: block.push_back(lines[i]) continue part1Sum += part1(block) part2Sum += part2(block) block.clear() part1Sum += part1(block) part2Sum += part2(block) print(part1Sum) print(part2Sum) --- 2023/mojo/day14.🔥 --- from collections.vector import DynamicVector fn find(v: DynamicVector[Int], elem: Int) -> Int: for i in range(0, len(v)): if v[i] == elem: return i return -1 fn part1(block: DynamicVector[String]) raises -> Int: var weight = 0 for c in range(0, len(block[0])): var stop = 0 for r in range(0, len(block)): if block[r][c] == "#": stop = r + 1 continue if block[r][c] == "O": weight += len(block) - stop stop += 1 return weight fn part2(inout block: DynamicVector[String]) raises -> Int: var values = DynamicVector[Int]() var ns = DynamicVector[Int]() var iters = DynamicVector[Int]() var cycleIdx = 0 var cycleBase = 0 var prevCycleEnd = 0 var detectCycle = False let rowCount = len(block) let colCount = len(block[0]) let target = 1_000_000_000 for n in range(0, target): var weight = 0 # Tilt north for c in range(0, colCount): var stop = 0 for r in range(0, rowCount): if block[r][c] == "#": stop = r + 1 continue if block[r][c] == "O": block[r] = block[r][:c] + "." + block[r][c + 1 :] block[stop] = block[stop][:c] + "O" + block[stop][c + 1 :] stop += 1 # Tilt west for r in range(0, rowCount): var stop = 0 for c in range(0, colCount): if block[r][c] == "#": stop = c + 1 continue if block[r][c] == "O": block[r] = block[r][:c] + "." + block[r][c + 1 :] block[r] = block[r][:stop] + "O" + block[r][stop + 1 :] stop += 1 # Tilt south for c in range(0, colCount): var stop = rowCount - 1 for r in range(rowCount - 1, -1, -1): if block[r][c] == "#": stop = r - 1 continue if block[r][c] == "O": block[r] = block[r][:c] + "." + block[r][c + 1 :] block[stop] = block[stop][:c] + "O" + block[stop][c + 1 :] weight += rowCount - stop stop -= 1 # Tilt east for r in range(0, rowCount): var stop = colCount - 1 for c in range(colCount - 1, -1, -1): if block[r][c] == "#": stop = c - 1 continue if block[r][c] == "O": block[r] = block[r][:c] + "." + block[r][c + 1 :] block[r] = block[r][:stop] + "O" + block[r][stop + 1 :] stop -= 1 if detectCycle: detectCycle = weight == iters[cycleIdx + 1] cycleIdx += 1 let weigthIdx = find(values, weight) if weigthIdx != -1: if detectCycle: if iters[cycleBase] == weight: if prevCycleEnd == ns[weigthIdx]: break prevCycleEnd = n else: cycleBase = ns[weigthIdx] cycleIdx = cycleBase detectCycle = True if weigthIdx != -1: ns[weigthIdx] = n else: values.push_back(weight) ns.push_back(n) iters.push_back(weight) if detectCycle: let diff = len(iters) - prevCycleEnd let mod = (target - prevCycleEnd - 1) % diff return iters[prevCycleEnd + mod] return iters[target - 1] fn main() raises: var block = DynamicVector[String]() with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") for i in range(0, len(lines)): if len(lines[i]) == 0: continue block.push_back(lines[i]) print(part1(block)) print(part2(block)) --- 2023/mojo/day15.🔥 --- from collections.vector import DynamicVector # Not generic, to prevent a lifetime analysis crash. @value struct Pair(CollectionElement): var a: String var b: Int fn filter(v: DynamicVector[Pair], elem: String) -> DynamicVector[Pair]: var tmp = DynamicVector[Pair]() for i in range(0, len(v)): if v[i].a != elem: tmp.push_back(v[i]) return tmp fn part1(line: String) raises -> Int: var res = 0 let steps = line.split(",") for i in range(0, len(steps)): var hash = 0 for j in range(0, len(steps[i])): hash += int(steps[i]._buffer[j]) hash *= 17 hash %= 256 res += hash return res fn part2(line: String) raises -> Int: var boxes = DynamicVector[DynamicVector[Pair]]() boxes.resize(256, DynamicVector[Pair]()) let steps = line.split(",") for i in range(0, len(steps)): let cur = steps[i] let rm = cur[len(cur) - 1] == "-" let delim: String if rm: delim = "-" else: delim = "=" let label = cur.split(delim)[0] var hash = 0 for j in range(0, len(label)): hash += int(label._buffer[j]) hash *= 17 hash %= 256 if rm: boxes[hash] = filter(boxes[hash], label) continue let val = atol(cur[len(cur) - 1]) for j in range(0, len(boxes[hash])): if boxes[hash][j].a == label: boxes[hash][j].b = val break else: boxes[hash].push_back(Pair(label, val)) var total = 0 for i in range(0, 256): if len(boxes[i]) == 0: continue for j in range(0, len(boxes[i])): total += (i + 1) * (j + 1) * boxes[i][j].b return total fn main() raises: with open("/dev/stdin", "r") as stdin: let input = stdin.read() print(part1(input)) print(part2(input)) --- 2023/mojo/day16.🔥 --- from collections.vector import DynamicVector from math import max alias UP = 1 << 0 alias DOWN = 1 << 1 alias LEFT = 1 << 2 alias RIGHT = 1 << 3 @value @register_passable struct Light(CollectionElement): var r: Int var c: Int var d: Int fn part1(cave: DynamicVector[String], start: Light = Light(0, 0, RIGHT)) -> Int: var lights = DynamicVector[Light]() lights.push_back(start) var energized = DynamicVector[DynamicVector[Int]]() energized.resize(len(cave), DynamicVector[Int]()) for i in range(0, len(energized)): energized[i].resize(len(cave[0]), 0) while len(lights) != 0: let l = lights.pop_back() var r = l.r var c = l.c let d = l.d if r < 0 or r >= len(cave) or c < 0 or c >= len(cave[0]): continue if energized[r][c] & d: continue while True: if r < 0 or r >= len(cave) or c < 0 or c >= len(cave[0]): break energized[r][c] |= d let cur = cave[r][c] if d == UP: if cur == "\\": lights.push_back(Light(r, c - 1, LEFT)) break elif cur == "/": lights.push_back(Light(r, c + 1, RIGHT)) break elif cur == "-": lights.push_back(Light(r, c - 1, LEFT)) lights.push_back(Light(r, c + 1, RIGHT)) break r -= 1 elif d == DOWN: if cur == "\\": lights.push_back(Light(r, c + 1, RIGHT)) break elif cur == "/": lights.push_back(Light(r, c - 1, LEFT)) break elif cur == "-": lights.push_back(Light(r, c + 1, RIGHT)) lights.push_back(Light(r, c - 1, LEFT)) break r += 1 elif d == LEFT: if cur == "\\": lights.push_back(Light(r - 1, c, UP)) break elif cur == "/": lights.push_back(Light(r + 1, c, DOWN)) break elif cur == "|": lights.push_back(Light(r - 1, c, UP)) lights.push_back(Light(r + 1, c, DOWN)) break c -= 1 elif d == RIGHT: if cur == "\\": lights.push_back(Light(r + 1, c, DOWN)) break elif cur == "/": lights.push_back(Light(r - 1, c, UP)) break elif cur == "|": lights.push_back(Light(r + 1, c, DOWN)) lights.push_back(Light(r - 1, c, UP)) break c += 1 var total = 0 for i in range(0, len(energized)): for j in range(0, len(energized[0])): if energized[i][j] != 0: total += 1 return total fn part2(cave: DynamicVector[String]) -> Int: var m = 0 for i in range(0, len(cave)): m = max(m, part1(cave, Light(i, 0, RIGHT))) m = max(m, part1(cave, Light(i, len(cave[0]) - 1, LEFT))) for i in range(0, len(cave[0])): m = max(m, part1(cave, Light(0, i, DOWN))) m = max(m, part1(cave, Light(len(cave) - 1, i, UP))) return m fn main() raises: var cave = DynamicVector[String]() with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") for i in range(0, len(lines)): if len(lines[i]) == 0: continue cave.push_back(lines[i]) print(part1(cave)) print(part2(cave)) --- 2023/mojo/day17.🔥 --- from collections.vector import DynamicVector from utils.static_tuple import StaticTuple alias UP = 0 alias DOWN = 1 alias LEFT = 2 alias RIGHT = 3 @value @register_passable struct Data(CollectionElement): var w: Int var r: Int var c: Int var s: Int var d: Int fn popMin(inout q: DynamicVector[Data]) -> Data: var m = 0 for i in range(1, len(q)): if q[i].w < q[m].w: m = i let tmpD = q[m] var tmpQ = DynamicVector[Data]() for i in range(0, len(q)): if i != m: tmpQ.push_back(q[i]) q = tmpQ ^ return tmpD fn part1(blocks: DynamicVector[String]) raises -> Int: let vr = StaticTuple[4](-1, 1, 0, 0) let vc = StaticTuple[4](0, 0, -1, 1) let ldw0 = len(blocks) let ldw1 = len(blocks[0]) let ldw2 = 4 let ldw3 = 4 var weights = DynamicVector[Int]() weights.resize(ldw0 * ldw1 * ldw2 * ldw3, 1 << 31) var q = DynamicVector[Data]() q.push_back(Data(0, 0, 0, 0, RIGHT)) weights[0] = 0 while len(q) != 0: let data = popMin(q) let w = data.w let r = data.r let c = data.c let s = data.s let d = data.d if r == len(blocks) - 1 and c == len(blocks[0]) - 1: return w var dirs = DynamicVector[Int]() dirs.push_back(d) if d == LEFT or d == RIGHT: dirs.push_back(UP) dirs.push_back(DOWN) if d == UP or d == DOWN: dirs.push_back(LEFT) dirs.push_back(RIGHT) for i in range(0, len(dirs)): let nr = r + vr[dirs[i]] let nc = c + vc[dirs[i]] let ns: Int if dirs[i] != d or r == 0 and c == 0: ns = 1 else: ns = s + 1 if ns > 3 or nr < 0 or nr >= len(blocks) or nc < 0 or nc >= len(blocks[0]): continue # https://en.wikipedia.org/wiki/Row-_and_column-major_order#Address_calculation_in_general let wi = ns + ldw3 * (dirs[i] + ldw2 * (nc + ldw1 * nr)) let nw = w + atol(blocks[nr][nc]) if nw < weights[wi]: weights[wi] = nw q.push_back(Data(nw, nr, nc, ns, dirs[i])) return 0 fn part2(blocks: DynamicVector[String]) raises -> Int: let vr = StaticTuple[4](-1, 1, 0, 0) let vc = StaticTuple[4](0, 0, -1, 1) let ldw0 = len(blocks) let ldw1 = len(blocks[0]) let ldw2 = 4 let ldw3 = 11 var weights = DynamicVector[Int]() weights.resize(ldw0 * ldw1 * ldw2 * ldw3, 1 << 31) var q = DynamicVector[Data]() q.push_back(Data(0, 0, 0, 0, RIGHT)) weights[0] = 0 while len(q) != 0: let data = popMin(q) let w = data.w let r = data.r let c = data.c let s = data.s let d = data.d let isStart = r == 0 and c == 0 let initialized = s >= 4 if r == len(blocks) - 1 and c == len(blocks[0]) - 1 and initialized: return w var dirs = DynamicVector[Int]() dirs.push_back(d) if (d == LEFT or d == RIGHT) and (initialized or isStart): dirs.push_back(UP) dirs.push_back(DOWN) if (d == UP or d == DOWN) and (initialized or isStart): dirs.push_back(LEFT) dirs.push_back(RIGHT) for i in range(0, len(dirs)): let nr = r + vr[dirs[i]] let nc = c + vc[dirs[i]] let ns: Int if i != 0 or isStart: ns = 1 else: ns = s + 1 if ns > 10 or nr < 0 or nr >= len(blocks) or nc < 0 or nc >= len(blocks[0]): continue # https://en.wikipedia.org/wiki/Row-_and_column-major_order#Address_calculation_in_general let wi = ns + ldw3 * (dirs[i] + ldw2 * (nc + ldw1 * nr)) let nw = w + atol(blocks[nr][nc]) if nw < weights[wi]: weights[wi] = nw q.push_back(Data(nw, nr, nc, ns, dirs[i])) return 0 fn main() raises: var blocks = DynamicVector[String]() with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") for i in range(0, len(lines)): if len(lines[i]) == 0: continue blocks.push_back(lines[i]) print(part1(blocks)) print(part2(blocks)) --- 2023/mojo/day18.🔥 --- from collections.vector import DynamicVector from math import min, max, abs from python import Python alias SIMD_T = SIMD[DType.int64, 1024] fn solve(xs: DynamicVector[Int], ys: DynamicVector[Int], steps: Int) -> Int: # https://en.wikipedia.org/wiki/Shoelace_formula#Example var ax = SIMD_T() var ay = SIMD_T() for i in range(0, len(xs) - 1): ax[i] = xs[i] ay[i] = ys[i + 1] var sx = SIMD_T() var sy = SIMD_T() for i in range(1, len(xs)): sx[i] = xs[i] sy[i] = ys[i - 1] ax *= ay sx *= sy var area = abs(ax.reduce_add() - sx.reduce_add()).to_int() area /= 2 # https://en.wikipedia.org/wiki/Pick%27s_theorem#Formula let b = steps let i = (area - b / 2 + 1).to_int() return i + b fn part1(moves: DynamicVector[String]) raises -> Int: var xs = DynamicVector[Int]() var ys = DynamicVector[Int]() xs.append(0) ys.append(0) var steps = 0 for i in range(0, len(moves)): let split = moves[i].split(" ") let dir = split[0] let step = atol(split[1]) var nx = xs[len(xs) - 1] var ny = ys[len(ys) - 1] if dir == "R": nx += step elif dir == "L": nx -= step elif dir == "U": ny += step elif dir == "D": ny -= step steps += step xs.append(nx) ys.append(ny) return solve(xs, ys, steps) fn part2(moves: DynamicVector[String]) raises -> Int: let int = Python.evaluate("int") var xs = DynamicVector[Int]() var ys = DynamicVector[Int]() xs.append(0) ys.append(0) var steps = 0 for i in range(0, len(moves)): let split = moves[i].split(" ") let hex = split[2] let step = int(hex[2:-2], 16).to_float64().to_int() let dir = hex[len(hex) - 2] var nx = xs[len(xs) - 1] var ny = ys[len(ys) - 1] if dir == 0: nx += step elif dir == 2: nx -= step elif dir == 3: ny += step elif dir == 1: ny -= step steps += step xs.append(nx) ys.append(ny) return solve(xs, ys, steps) fn main() raises: var moves = DynamicVector[String]() with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") for i in range(0, len(lines)): if len(lines[i]) == 0: continue moves.push_back(lines[i]) print(part1(moves)) print(part2(moves)) --- 2023/mojo/day19.🔥 --- from collections.vector import DynamicVector @value @register_passable struct Part(CollectionElement): var x: Int var m: Int var a: Int var s: Int @value struct WorkflowItem(CollectionElement): var cat: String var less: Bool var size: Int var dst: String @value struct Workflow(CollectionElement): var id: String var items: DynamicVector[WorkflowItem] fn part1(workflows: DynamicVector[Workflow], parts: DynamicVector[Part]) -> Int: var sum = 0 for i in range(0, len(parts)): let p = parts[i] var cur: String = "in" while cur != "A" and cur != "R": var wi = 0 while wi < len(workflows) and workflows[wi].id != cur: wi += 1 let items = workflows[wi].items for j in range(0, len(items)): let item = items[j] var hit = False if item.cat == "x": hit = p.x < item.size if item.less else p.x > item.size elif item.cat == "m": hit = p.m < item.size if item.less else p.m > item.size elif item.cat == "a": hit = p.a < item.size if item.less else p.a > item.size elif item.cat == "s": hit = p.s < item.size if item.less else p.s > item.size else: hit = True if hit: cur = item.dst break if cur == "A": sum = sum + p.x + p.m + p.a + p.s return sum @value @register_passable struct Range(CollectionElement): var min: Int var max: Int @value struct State(CollectionElement): var id: String var x: Range var m: Range var a: Range var s: Range fn part2(workflows: DynamicVector[Workflow]) -> Int: var combiantions = 0 var q = DynamicVector[State]() var iq = 0 q.push_back( State( "in", Range(1, 4000), Range(1, 4000), Range(1, 4000), Range(1, 4000), ) ) while iq != len(q): var s = q[iq] iq += 1 if s.id == "R": continue if s.id == "A": combiantions += ( (s.x.max - s.x.min + 1) * (s.m.max - s.m.min + 1) * (s.a.max - s.a.min + 1) * (s.s.max - s.s.min + 1) ) continue var wi = 0 while wi < len(workflows) and workflows[wi].id != s.id: wi += 1 let items = workflows[wi].items for j in range(0, len(items)): let item = items[j] var ns = s ns.id = item.dst if item.cat == "x": if item.less: ns.x.max = item.size - 1 s.x.min = item.size else: ns.x.min = item.size + 1 s.x.max = item.size elif item.cat == "m": if item.less: ns.m.max = item.size - 1 s.m.min = item.size else: ns.m.min = item.size + 1 s.m.max = item.size elif item.cat == "a": if item.less: ns.a.max = item.size - 1 s.a.min = item.size else: ns.a.min = item.size + 1 s.a.max = item.size elif item.cat == "s": if item.less: ns.s.max = item.size - 1 s.s.min = item.size else: ns.s.min = item.size + 1 s.s.max = item.size q.push_back(ns) return combiantions fn main() raises: var workflows = DynamicVector[Workflow]() var parts = DynamicVector[Part]() with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") var i = 0 while i < len(lines): if len(lines[i]) == 0: i += 1 break let split = lines[i].split("{") var w = Workflow(split[0], DynamicVector[WorkflowItem]()) let itemsSplit = split[1].split(",") for j in range(0, len(itemsSplit)): let itemStr = itemsSplit[j] if itemStr[len(itemStr) - 1] == "}": w.items.push_back( WorkflowItem(".", False, 0, itemStr[0 : len(itemStr) - 1]) ) break let tailsSplit = itemStr[2:].split(":") w.items.push_back( WorkflowItem( itemStr[0], itemStr[1] == "<", atol(tailsSplit[0]), tailsSplit[1], ) ) j += 1 workflows.push_back(w) i += 1 while i < len(lines): if len(lines[i]) == 0: i += 1 break let trim = lines[i][1 : len(lines[i]) - 1] let split = trim.split(",") parts.push_back( Part( atol(split[0].split("=")[1]), atol(split[1].split("=")[1]), atol(split[2].split("=")[1]), atol(split[3].split("=")[1]), ) ) i += 1 print(part1(workflows, parts)) print(part2(workflows)) --- 2023/mojo/day2.🔥 --- from python import Python struct CubeCount: var red: Int var green: Int var blue: Int fn __init__(inout self): self.red = 0 self.green = 0 self.blue = 0 fn setDefaults(inout self): self.red = 12 self.green = 13 self.blue = 14 fn isValid(self) -> Bool: return self.red >= 0 and self.green >= 0 and self.blue >= 0 struct Split: var p1: String var p2: String fn __init__(inout self, p1: String, p2: String): self.p1 = p1 self.p2 = p2 fn split(string: String, delim: String) -> Split: for i in range(len(string)): if string[i] == delim: return Split(string[0:i], string[i + 1 :]) return Split(string, String("")) fn max(a: Int, b: Int) -> Int: if a >= b: return a return b fn part1(line: String) raises -> Int: # [Game X| <rounds>] let t = split(line, ":") # [ <round>| <round>; <round>; ...] var rounds = split(t.p2[:-1], ";") while len(rounds.p1) != 0: let round = rounds.p1 rounds = split(rounds.p2[:], ";") var cc = CubeCount() cc.setDefaults() # [ <draw>| <draw>, <draw>, ...] var draws = split(round, ",") while len(draws.p1) != 0: let draw = draws.p1[1:] draws = split(draws.p2[:], ",") # [X|<color>] let t = split(draw, " ") let n = atol(t.p1) if t.p2 == "red": cc.red -= n elif t.p2 == "green": cc.green -= n elif t.p2 == "blue": cc.blue -= n if not cc.isValid(): return 0 # [Game|X] return atol(split(t.p1, " ").p2) fn part2(line: String) raises -> Int: # [Game X| <rounds>] let t = split(line, ":") var cc = CubeCount() # [ <round>| <round>; <round>; ...] var rounds = split(t.p2[:-1], ";") while len(rounds.p1) != 0: let round = rounds.p1 rounds = split(rounds.p2[:], ";") # [ <draw>| <draw>, <draw>, ...] var draws = split(round, ",") while len(draws.p1) != 0: let draw = draws.p1[1:] draws = split(draws.p2[:], ",") # [X|<color>] let t = split(draw, " ") let n = atol(t.p1) if t.p2 == "red": cc.red = max(cc.red, n) elif t.p2 == "green": cc.green = max(cc.green, n) elif t.p2 == "blue": cc.blue = max(cc.blue, n) return cc.red * cc.green * cc.blue def main(): var py = Python() let sys = py.import_module("sys") var part1Sum = 0 var part2Sum = 0 for line in sys.stdin: part1Sum += part1(py.__str__(line)) part2Sum += part2(py.__str__(line)) print(part1Sum) print(part2Sum) --- 2023/mojo/day20.🔥 --- from collections.vector import DynamicVector from math import lcm @value struct Pair(CollectionElement): var first: String var second: Bool @value struct Module(CollectionElement): var type: Int var connections: DynamicVector[String] var flipped: Bool var inputStrs: DynamicVector[String] var inputPulses: DynamicVector[Bool] fn find(v: DynamicVector[String], elem: String) -> Int: for i in range(0, len(v)): if v[i] == elem: return i return -1 fn part1(modules: DynamicVector[String], i: DynamicVector[Module]) -> Int: var infos = i var low = 0 var high = 0 for _ in range(0, 1000): var q = DynamicVector[Pair]() var qi = 0 q.push_back(Pair("broadcaster", False)) while qi < len(q): let p = q[qi] qi += 1 let cur = p.first var pulse = p.second if pulse: high += 1 else: low += 1 let mi = find(modules, cur) var curInfo = infos[mi] if curInfo.type == 1: if pulse: continue pulse = not curInfo.flipped curInfo.flipped = not curInfo.flipped elif curInfo.type == 2: var allHigh = True for i in range(0, len(curInfo.inputPulses)): allHigh = allHigh & curInfo.inputPulses[i] pulse = not allHigh infos[mi] = curInfo for i in range(0, len(curInfo.connections)): let c = curInfo.connections[i] let j = find(modules, c) var cInfo = infos[j] if cInfo.type == 2: let k = find(cInfo.inputStrs, cur) cInfo.inputPulses[k] = pulse infos[j] = cInfo q.push_back(Pair(c, pulse)) return low * high fn part2(modules: DynamicVector[String], i: DynamicVector[Module]) -> Int: var infos = i let rxParent = infos[find(modules, "rx")].inputStrs[0] let subEndings = infos[find(modules, rxParent)].inputStrs var cycles = DynamicVector[Int]() var push = 1 while len(cycles) != 4: var q = DynamicVector[Pair]() var qi = 0 q.push_back(Pair("broadcaster", False)) while qi < len(q): let p = q[qi] qi += 1 let cur = p.first var pulse = p.second if find(subEndings, cur) != -1 and not pulse: cycles.push_back(push) var mi = 0 while mi < len(modules) and modules[mi] != cur: mi += 1 var curInfo = infos[mi] if curInfo.type == 1: if pulse: continue pulse = not curInfo.flipped curInfo.flipped = not curInfo.flipped elif curInfo.type == 2: var allHigh = True for i in range(0, len(curInfo.inputPulses)): allHigh = allHigh & curInfo.inputPulses[i] pulse = not allHigh infos[mi] = curInfo for i in range(0, len(curInfo.connections)): let c = curInfo.connections[i] let j = find(modules, c) var cInfo = infos[j] if cInfo.type == 2: let k = find(cInfo.inputStrs, cur) cInfo.inputPulses[k] = pulse infos[j] = cInfo q.push_back(Pair(c, pulse)) push += 1 var total = 1 for i in range(0, len(cycles)): total = lcm(total, cycles[i]) return total fn main() raises: var modules = DynamicVector[String]() var infos = DynamicVector[Module]() with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") for i in range(0, len(lines)): if len(lines[i]) == 0: continue let line = lines[i] let split = line.split(" -> ") let connections = split[1].split(", ") var t = 0 var id = split[0] if split[0][0] == "%": t = 1 id = split[0][1:] elif split[0][0] == "&": t = 2 id = split[0][1:] let module = Module( t, connections, False, DynamicVector[String](), DynamicVector[Bool](), ) modules.push_back(id) infos.push_back(module) modules.push_back("rx") infos.push_back( Module( 0, DynamicVector[String](), False, DynamicVector[String](), DynamicVector[Bool](), ) ) for i in range(0, len(modules)): let cs = infos[i].connections for ci in range(0, len(cs)): let j = find(modules, cs[ci]) if infos[j].type == 2 or cs[ci] == "rx": infos[j].inputStrs.push_back(modules[i]) infos[j].inputPulses.push_back(False) print(part1(modules, infos)) print(part2(modules, infos)) --- 2023/mojo/day21.🔥 --- from utils.static_tuple import StaticTuple from collections.vector import DynamicVector @value struct Pair[T: CollectionElement, R: CollectionElement](CollectionElement): var a: T var b: R fn contains(v: DynamicVector[Pair[Int, Int]], elem: Pair[Int, Int]) -> Bool: for i in range(0, len(v)): if v[i].a == elem.a and v[i].b == elem.b: return True return False fn getReachedPlotCount(garden: DynamicVector[String], steps: Int) -> Int: var start = Pair(0, 0) for r in range(0, len(garden)): let c = garden[r].find("S") if c != -1: start = Pair(r,c) break var visited = DynamicVector[Pair[Int, Int]]() var queue = DynamicVector[Pair[Int, Int]]() var qFront = 0 queue.push_back(start) queue.push_back(Pair(-1, -1)) var step = 0 while qFront < len(queue): let f = queue[qFront] qFront += 1 if f.a == -1: if step == steps: break step += 1 visited.clear() if qFront < len(queue): queue.push_back(Pair(-1, -1)) continue if contains(visited, f): continue visited.push_back(f) let vr = StaticTuple[4](0, 0, 1, -1) let vc = StaticTuple[4](1, -1, 0, 0) for i in range(0, len(vr)): let nr = f.a + vr[i] let nc = f.b + vc[i] if ( nr < 0 or nr >= len(garden) or nc < 0 or nc >= len(garden[0]) or garden[nr][nc] == "#" ): continue let p = Pair(nr, nc) queue.push_back(p) return len(visited) fn part1(garden: DynamicVector[String]) -> Int: return getReachedPlotCount(garden, 64) fn part2(garden: DynamicVector[String]) -> Int: let n = 26501365; let oddCovered = getReachedPlotCount(garden, 131); let oddDiamond = getReachedPlotCount(garden, 65); let evenCovered = getReachedPlotCount(garden, 130); let evenDiamond = getReachedPlotCount(garden, 64); let repetition = ((2 * n + 1) / len(garden[0])).to_int(); let dist = ((repetition - 1) / 2).to_int(); let totalOdd = dist + 1 + (dist + 1) * dist; let totalEven = dist + (dist - 1) * dist; return totalOdd * oddCovered + totalEven * evenCovered - (dist + 1) * (oddCovered - oddDiamond) + dist * (evenCovered - evenDiamond); fn main() raises: with open("/dev/stdin", "r") as stdin: let input = stdin.read() let garden = input.split("\n") print(part1(garden)) print(part2(garden)) --- 2023/mojo/day22.🔥 --- from collections.vector import DynamicVector from algorithm import max, min @value struct Pair[T: CollectionElement, R: CollectionElement](CollectionElement): var a: T var b: R @value @register_passable struct Point: var x: Int var y: Int var z: Int @value @register_passable struct Brick(CollectionElement): var id: Int var begin: Point var end: Point @value struct CollisionData(CollectionElement): var id: Int var supports: DynamicVector[Int] var supportedBy: DynamicVector[Int] alias CollisionDataStorage = DynamicVector[CollisionData] fn find(v: DynamicVector[Int], elem: Int) -> Int: for i in range(0, len(v)): if v[i] == elem: return i return -1 fn find(v: CollisionDataStorage, id: Int) -> Int: for i in range(0, len(v)): if v[i].id == id: return i return -1 fn findOrInsert(inout v: CollisionDataStorage, id: Int) -> Int: let idx = find(v, id) if idx != -1: return idx v.push_back(CollisionData(id, DynamicVector[Int](), DynamicVector[Int]())) return len(v) - 1 fn simulateGravity(owned b: DynamicVector[Brick]) -> CollisionDataStorage: var bricks = b ^ for i in range(0, len(bricks)): for j in range(0, len(bricks) - 1): if bricks[j].begin.z > bricks[j + 1].begin.z: let tmp = bricks[j] bricks[j] = bricks[j + 1] bricks[j + 1] = tmp var storage = CollisionDataStorage() for i in range(0, len(bricks)): let id = bricks[i].id let b = bricks[i].begin let e = bricks[i].end _ = findOrInsert(storage, id) var maybeCollides = DynamicVector[Pair[Int, Int]]() var collisionZ = 1 for j in range(0, len(bricks)): let ci = bricks[j].id let cb = bricks[j].begin let ce = bricks[j].end if id == ci: continue let xb = max(cb.x, b.x) let xe = min(ce.x, e.x) let yb = max(cb.y, b.y) let ye = min(ce.y, e.y) if xb > xe or yb > ye: continue if ce.z + 1 <= b.z: collisionZ = max(collisionZ, ce.z + 1) maybeCollides.push_back(Pair(ci, ce.z + 1)) let fall = b.z - collisionZ # Workaround for https://github.com/modularml/mojo/issues/1546. bricks[i].begin = Point(b.x, b.y, b.z - fall) bricks[i].end = Point(e.x, e.y, e.z - fall) for j in range(0, len(maybeCollides)): let colliderId = maybeCollides[j].a let colliderZ = maybeCollides[j].b if colliderZ == collisionZ: storage[findOrInsert(storage, colliderId)].supports.push_back(id) storage[findOrInsert(storage, id)].supportedBy.push_back(colliderId) return storage fn part1(collisionDatas: CollisionDataStorage) -> Int: var removed = 0 for i in range(0, len(collisionDatas)): let data = collisionDatas[i] var canRemove = True for j in range(0, len(data.supports)): let supportData = collisionDatas[find(collisionDatas, data.supports[j])] canRemove = canRemove and len(supportData.supportedBy) > 1 removed += 1 if canRemove else 0 return removed fn part2(collisionDatas: CollisionDataStorage) -> Int: var total = 0 for i in range(0, len(collisionDatas)): var visited = DynamicVector[Int]() var queue = DynamicVector[Int]() var qFront = 0 let cur = collisionDatas[i] queue.push_back(cur.id) visited.push_back(cur.id) var falling = 0 while qFront < len(queue): let b = queue[qFront] qFront += 1 let supporteds = collisionDatas[find(collisionDatas, b)].supports for j in range(0, len(supporteds)): let supported = supporteds[j] if find(visited, supported) != -1: continue let supporters = collisionDatas[ find(collisionDatas, supported) ].supportedBy var supportersFalling = True for k in range(0, len(supporters)): let supporter = supporters[k] supportersFalling = supportersFalling and ( find(visited, supporter) != -1 ) if supportersFalling: queue.push_back(supported) visited.push_back(supported) falling += 1 total += falling return total fn main() raises: fn parsePoint(point: String) raises -> Point: let coords = point.split(",") return Point(atol(coords[0]), atol(coords[1]), atol(coords[2])) with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") var bricks = DynamicVector[Brick]() for i in range(0, len(lines)): let line = lines[i] if len(line) == 0: continue let split = line.split("~") bricks.push_back( Brick(len(bricks), parsePoint(split[0]), parsePoint(split[1])) ) let collisionDatas = simulateGravity(bricks ^) print(part1(collisionDatas)) print(part2(collisionDatas)) --- 2023/mojo/day23.🔥 --- from collections.vector import DynamicVector from utils.static_tuple import StaticTuple from algorithm import max @value struct Pair[T: CollectionElement, U: CollectionElement](CollectionElement): var a: T var b: U @value @register_passable struct IntPair(CollectionElement): var a: Int var b: Int fn __eq__(self, other: Self) -> Bool: return self.a == other.a and self.b == other.b alias Point = IntPair alias Dir = IntPair alias Edge = IntPair alias dirs = StaticTuple[4, Dir](Dir(0, 1), Dir(0, -1), Dir(1, 0), Dir(-1, 0)) fn find(v: DynamicVector[IntPair], elem: IntPair) -> Int: for i in range(0, len(v)): if v[i] == elem: return i return -1 fn erase(inout v: DynamicVector[IntPair], elem: IntPair): var tmp = DynamicVector[IntPair]() for i in range(0, len(v)): if not v[i] == elem: tmp.push_back(v[i]) v = tmp fn find(v: DynamicVector[Int], elem: Int) -> Int: for i in range(0, len(v)): if v[i] == elem: return i return -1 fn erase(inout v: DynamicVector[Int], elem: Int): var tmp = DynamicVector[Int]() for i in range(0, len(v)): if not v[i] == elem: tmp.push_back(v[i]) v = tmp fn stepInDir(map: DynamicVector[String], pos: Point, d: Dir) -> Point: let nr = pos.a + d.a let nc = pos.b + d.b if nr < 0 or nr >= len(map) or nc < 0 or nc >= len(map[0]) or map[nr][nc] == "#": return Point(-1, -1) return Point(nr, nc) fn traverse( map: DynamicVector[String], pos: Point, steps: Int, inout visited: DynamicVector[Point], ) -> Int: if find(visited, pos) != -1: return 0 visited.push_back(pos) let r = pos.a let c = pos.b let cur = map[r][c] var res = 0 if r == len(map) - 1: res = steps elif cur == ">": res = traverse(map, IntPair(r, c + 1), steps + 1, visited) elif cur == "^": res = traverse(map, IntPair(r - 1, c), steps + 1, visited) elif cur == "<": res = traverse(map, IntPair(r, c - 1), steps + 1, visited) elif cur == "v": res = traverse(map, IntPair(r + 1, c), steps + 1, visited) else: for i in range(0, len(dirs)): let np = stepInDir(map, pos, dirs[i]) if np.a == -1: continue res = max(res, traverse(map, np, steps + 1, visited)) erase(visited, pos) return res fn part1(map: DynamicVector[String]) -> Int: var visited = DynamicVector[Point]() return traverse(map, Point(0, map[0].find(".")), 0, visited) fn traverse2( map: DynamicVector[DynamicVector[Edge]], pos: Int, steps: Int, inout visited: DynamicVector[Int], ) -> Int: if find(visited, pos) != -1: return 0 visited.push_back(pos) if pos == len(map) - 1: erase(visited, pos) return steps var res = 0 for i in range(0, len(map[pos])): let edge = map[pos][i] res = max(res, traverse2(map, edge.a, steps + edge.b, visited)) erase(visited, pos) return res fn part2(map: DynamicVector[String]) -> Int: var pois = DynamicVector[Pair[Int, Point]]() pois.push_back(Pair(len(pois), Point(0, map[0].find(".")))) for r in range(0, len(map)): for c in range(0, len(map[0])): if map[r][c] != ".": continue var roads = 0 for i in range(0, len(dirs)): let np = stepInDir(map, Point(r, c), dirs[i]) if np.a == -1: continue roads += 1 if roads > 2: pois.push_back(Pair(len(pois), Point(r, c))) pois.push_back(Pair(len(pois), Point(len(map) - 1, map[len(map) - 1].find(".")))) var edges = DynamicVector[DynamicVector[Edge]]() edges.resize(len(pois), DynamicVector[Edge]()) for pi in range(0, len(pois)): let pid = pois[pi].a let p = pois[pi].b var visited = DynamicVector[Point]() var queue = DynamicVector[Pair[Int, Point]]() var qFront = 0 queue.push_back(Pair(0, p)) while qFront < len(queue): let data = queue[qFront] qFront += 1 let s = data.a let p = data.b var pid2 = -1 for pi2 in range(0, len(pois)): let poi2 = pois[pi2] if poi2.a != pid and poi2.b == p: pid2 = poi2.a break if pid2 != -1: if find(edges[pid], IntPair(pid2, s)) == -1: edges[pid].push_back(IntPair(pid2, s)) if find(edges[pid2], IntPair(pid, s)) == -1: edges[pid2].push_back(IntPair(pid, s)) continue if find(visited, p) != -1: continue visited.push_back(p) for i in range(0, len(dirs)): let np = stepInDir(map, p, dirs[i]) if np.a == -1: continue queue.push_back(Pair(s + 1, np)) var visited2 = DynamicVector[Int]() return traverse2(edges, 0, 0, visited2) fn main() raises: with open("/dev/stdin", "r") as stdin: let input = stdin.read() let map = input.split("\n") print(part1(map)) print(part2(map)) --- 2023/mojo/day24.🔥 --- from collections.vector import DynamicVector from math import round, abs alias epsilon = 1e-3 alias Vec3 = SIMD[DType.int64, 4] @value @register_passable struct Hailstone(CollectionElement): var pos: Vec3 var dir: Vec3 fn intersect(h1: Hailstone, h2: Hailstone) -> SIMD[DType.float64, 2]: let p1 = h1.pos.cast[DType.float64]() let d1 = h1.dir.cast[DType.float64]() let p2 = h2.pos.cast[DType.float64]() let d2 = h2.dir.cast[DType.float64]() let a = d1[1] / d1[0] let c = p1[1] - a * p1[0] let b = d2[1] / d2[0] let d = p2[1] - b * p2[0] if abs(a - b) < epsilon: return SIMD[DType.float64, 2](-1, -1) let x = (d - c) / (a - b) let t1 = (x - p1[0]) / d1[0] let t2 = (x - p2[0]) / d2[0] if t1 < 0 or t2 < 0: return SIMD[DType.float64, 2](-1, -1) return SIMD[DType.float64, 2](t1, t2) fn part1(hailstones: DynamicVector[Hailstone]) -> Int: let begin: Float64 = 200000000000000 let end: Float64 = 400000000000000 var cnt = 0 for i in range(0, len(hailstones)): for j in range(i + 1, len(hailstones)): let ts = intersect(hailstones[i], hailstones[j]) if ts[0] == -1: continue let p = hailstones[i].pos.cast[DType.float64]() let d = hailstones[i].dir.cast[DType.float64]() let np = p + ts[0] * d if begin <= np[0] <= end and begin <= np[1] <= end: cnt += 1 return cnt fn part2(hailstones: DynamicVector[Hailstone]) -> Int: let n = 250 for x in range(-n, n + 1): for y in range(-n, n + 1): for z in range(-n, n + 1): let cv = Vec3(x, y, z) let p0 = hailstones[0].pos let d0 = hailstones[0].dir - cv let p1 = hailstones[1].pos let d1 = hailstones[1].dir - cv if d0[0] == 0 or d1[0] == 0: continue let fts = intersect(Hailstone(p0, d0), Hailstone(p1, d1)) if fts[0] == -1: continue if abs(round(fts[0]) - fts[0]) >= epsilon: continue let ts = fts.cast[DType.int64]() let intersection = p0 + ts[0] * d0 if intersection[3] != p1[3] + ts[1] * d1[3]: continue var hit = True for i in range(2, len(hailstones)): let cp = hailstones[i].pos let nd = hailstones[i].dir - cv let tt = (intersection[0] - cp[0]) / nd[0] hit = hit and intersection == cp + nd * tt if hit: return intersection.reduce_add().to_int() return 0 fn main() raises: fn parseVec3(point: String) raises -> Vec3: let coords = point.split(", ") return Vec3(atol(coords[0]), atol(coords[1]), atol(coords[2])) with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") var hailstones = DynamicVector[Hailstone]() for i in range(0, len(lines)): let line = lines[i] if len(line) == 0: continue let split = line.split(" @ ") hailstones.push_back(Hailstone(parseVec3(split[0]), parseVec3(split[1]))) print(part1(hailstones)) print(part2(hailstones)) --- 2023/mojo/day25.🔥 --- from collections.vector import DynamicVector from random import random_ui64, seed @value struct StrMapData(CollectionElement): var k: String var v: DynamicVector[String] @value struct IntPair(CollectionElement): var a: Int var b: Int fn find(v: DynamicVector[StrMapData], elem: StrMapData) -> Int: for i in range(0, len(v)): if v[i].k == elem.k: return i return -1 fn findOrInsert(inout v: DynamicVector[StrMapData], elem: StrMapData) -> Int: let idx = find(v, elem) if idx != -1: return idx v.push_back(elem) return len(v) - 1 fn find(v: DynamicVector[String], elem: String) -> Int: for i in range(0, len(v)): if v[i] == elem: return i return -1 fn findOrInsert(inout v: DynamicVector[String], elem: String) -> Int: let idx = find(v, elem) if idx != -1: return idx v.push_back(elem) return len(v) - 1 fn find(v: DynamicVector[Int], elem: Int) -> Int: for i in range(0, len(v)): if v[i] == elem: return i return -1 fn findOrInsert(inout v: DynamicVector[Int], elem: Int) -> Int: let idx = find(v, elem) if idx != -1: return idx v.push_back(elem) return len(v) - 1 fn erase(inout v: DynamicVector[IntPair], idx: Int): var tmp = DynamicVector[IntPair]() for i in range(0, len(v)): if i != idx: tmp.push_back(v[i]) v = tmp fn erase(inout v: DynamicVector[DynamicVector[Int]], idx: Int): var tmp = DynamicVector[DynamicVector[Int]]() for i in range(0, len(v)): if i != idx: tmp.push_back(v[i]) v = tmp fn part1(map: DynamicVector[StrMapData]) -> Int: var node2id = DynamicVector[String]() for i in range(0, len(map)): node2id.push_back(map[i].k) var originalSubsets = DynamicVector[DynamicVector[Int]]() var originalEdges = DynamicVector[IntPair]() for i in range(0, len(map)): originalSubsets.push_back(DynamicVector[Int]()) originalSubsets[len(originalSubsets) - 1].push_back(find(node2id, map[i].k)) for j in range(0, len(map[i].v)): originalEdges.push_back( IntPair(find(node2id, map[i].k), find(node2id, map[i].v[j])) ) seed() while True: var subsets = originalSubsets var edges = originalEdges while len(subsets) > 2: let n = random_ui64(0, len(edges) - 1).to_int() let b = edges[n].a let e = edges[n].b erase(edges, n) var s1 = -1 var s2 = -1 for i in range(0, len(subsets)): if find(subsets[i], b) != -1: s1 = i if find(subsets[i], e) != -1: s2 = i if s1 == s2: continue for i in range(0, len(subsets[s2])): _ = findOrInsert(subsets[s1], subsets[s2][i]) erase(subsets, s2) var cuts = 0 for i in range(0, len(originalEdges)): if ( find(subsets[0], originalEdges[i].a) != -1 and find(subsets[1], originalEdges[i].b) != -1 ): cuts += 1 if cuts == 3: return len(subsets[0]) * len(subsets[1]) fn part2() -> Int: return 0 fn main() raises: var map = DynamicVector[StrMapData]() with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") for i in range(0, len(lines)): let line = lines[i] if len(line) == 0: continue var split = line.split(": ") let head = split[0] split = split[1].split(" ") for i in range(0, len(split)): let dst = split[i] let hi = findOrInsert(map, StrMapData(head, DynamicVector[String]())) map[hi].v.push_back(dst) let ci = findOrInsert(map, StrMapData(dst, DynamicVector[String]())) map[ci].v.push_back(head) print(part1(map ^)) print(part2()) --- 2023/mojo/day3.🔥 --- from collections.vector import DynamicVector from python import Python @value @register_passable struct Number(CollectionElement): var line: Int var begin: Int var end: Int var val: Int @value @register_passable struct Symbol(CollectionElement): var row: Int var col: Int fn part1(inout lines: PythonObject) raises -> Int: var py = Python() var symbols = DynamicVector[Symbol]() var numbers = DynamicVector[Number]() var li = 0 for line in lines: var ci = 0 let lineLen = len(py.__str__(line)) while ci < lineLen: if isdigit(ord(py.__str__(line[ci]))): let b = ci while ci < lineLen and isdigit(ord(py.__str__(line[ci]))): ci += 1 let str: String = py.__str__(line) let val = atol(str[b:ci]) numbers.push_back(Number(li, b, ci - 1, val)) continue let tok = line[ci] if tok != "." and tok != "\n": symbols.push_back(Symbol(li, ci)) ci += 1 li += 1 var out = 0 var ni = 0 while ni < len(numbers): var si = 0 while si < len(symbols): if ( symbols[si].row >= numbers[ni].line - 1 and symbols[si].row <= numbers[ni].line + 1 and symbols[si].col >= numbers[ni].begin - 1 and symbols[si].col <= numbers[ni].end + 1 ): out += numbers[ni].val si += 1 ni += 1 return out fn part2(inout lines: PythonObject) raises -> Int: var py = Python() var symbols = DynamicVector[Symbol]() var numbers = DynamicVector[Number]() var li = 0 for line in lines: var ci = 0 let lineLen = len(py.__str__(line)) while ci < lineLen: if isdigit(ord(py.__str__(line[ci]))): let b = ci while ci < lineLen and isdigit(ord(py.__str__(line[ci]))): ci += 1 let str: String = py.__str__(line) let val = atol(str[b:ci]) numbers.push_back(Number(li, b, ci - 1, val)) continue let tok = line[ci] if tok == "*" and tok != "\n": symbols.push_back(Symbol(li, ci)) ci += 1 li += 1 var out = 0 var si = 0 while si < len(symbols): var adjNums = DynamicVector[Int]() var ni = 0 while ni < len(numbers): if ( symbols[si].row >= numbers[ni].line - 1 and symbols[si].row <= numbers[ni].line + 1 and symbols[si].col >= numbers[ni].begin - 1 and symbols[si].col <= numbers[ni].end + 1 ): adjNums.push_back(numbers[ni].val) ni += 1 if len(adjNums) == 2: out += adjNums[0] * adjNums[1] si += 1 return out fn main() raises: let py = Python() let sys = py.import_module("sys") var lines = PythonObject([]) for line in sys.stdin: _ = lines.append(line) print(part1(lines)) print(part2(lines)) --- 2023/mojo/day4.🔥 --- from collections.vector import DynamicVector from collections.vector import InlinedFixedVector from python import Python fn part1(line: String) raises -> Int: var py = Python() let headerSplit = PythonObject(line).split(":") let nums = headerSplit[1].split("|") var winningStr = nums[0].split(" ") var ownStr = nums[1].split("\n")[0].split(" ") var winningNums = DynamicVector[Int]() var ownNums = DynamicVector[Int]() for w in winningStr: let s = py.__str__(w) if len(s) > 0: winningNums.push_back(atol(s)) for o in ownStr: let s = py.__str__(o) if len(s) > 0: ownNums.push_back(atol(s)) var score = 0 for i in range(0, len(ownNums)): for j in range(0, len(winningNums)): if ownNums[i] == winningNums[j]: if score == 0: score = 1 else: score <<= 1 return score fn part2(line: String, inout cache: InlinedFixedVector[Int]) raises -> Int: var py = Python() let headerSplit = PythonObject(line).split(":") let nums = headerSplit[1].split("|") var winningStr = nums[0].split(" ") var ownStr = nums[1].split("\n")[0].split(" ") var winningNums = DynamicVector[Int]() var ownNums = DynamicVector[Int]() for w in winningStr: let s = py.__str__(w) if len(s) > 0: winningNums.push_back(atol(s)) for o in ownStr: let s = py.__str__(o) if len(s) > 0: ownNums.push_back(atol(s)) let id = atol(py.__str__(headerSplit[0].split(" ")[-1])) cache[id] += 1 var cnt = 1 for i in range(0, len(ownNums)): for j in range(0, len(winningNums)): if ownNums[i] == winningNums[j] and id + cnt < len(cache): cache[id + cnt] += cache[id] cnt += 1 return cache[id] fn main() raises: var py = Python() let sys = py.import_module("sys") var lines = PythonObject([]) var cnt = 0 for line in sys.stdin: _ = lines.append(line) cnt += 1 var part1Sum = 0 var part2Sum = 0 var cache = InlinedFixedVector[Int](cnt + 1) for i in range(0, cnt + 1): cache.append(0) for line in lines: part1Sum += part1(py.__str__(line)) part2Sum += part2(py.__str__(line), cache) print(part1Sum) print(part2Sum) --- 2023/mojo/day5.🔥 --- from math import min, max from math.limit import max_finite from python import Python from collections.vector import DynamicVector fn part1(input: String) raises -> Int: var lines = input.split("\n") # This is a hack to trigger the processing of the last map. lines.append("placeholder") let seedsStr = lines[0].split(": ")[1].split(" ") var seeds = DynamicVector[Int]() for i in range(0, seedsStr.size): seeds.append(atol(seedsStr[i])) var map = DynamicVector[Int]() for i in range(3, lines.size): if len(lines[i]) == 0: continue let splitStr = lines[i].split(" ") if splitStr.size != 3: # reached the end of a map var newSeeds = DynamicVector[Int]() for j in range(0, seeds.size): for k in range(0, map.size, 3): let dst = map[k] let src = map[k + 1] let l = map[k + 2] if seeds[j] >= src and seeds[j] < src + l: newSeeds.append(dst + seeds[j] - src) break else: newSeeds.append(seeds[j]) seeds = newSeeds map.clear() continue map.append(atol(splitStr[0])) map.append(atol(splitStr[1])) map.append(atol(splitStr[2])) var m: Int = seeds[0] for i in range(1, seeds.size): m = min(m, seeds[i]) return m @value @register_passable struct Range(CollectionElement): var b: Int var e: Int fn part2(input: String) raises -> Int: var lines = input.split("\n") # This is a hack to trigger the processing of the last map. lines.append("placeholder") let seedsStr = lines[0].split(": ")[1].split(" ") var seeds = DynamicVector[Range]() for i in range(0, seedsStr.size, 2): let b = atol(seedsStr[i]) let l = atol(seedsStr[i + 1]) seeds.append(Range(b, b + l)) var map = DynamicVector[Int]() for i in range(3, lines.size): if len(lines[i]) == 0: continue let splitStr = lines[i].split(" ") if splitStr.size != 3: # reached the end of a map var newSeeds = DynamicVector[Range]() while seeds.size != 0: let r = seeds.pop_back() for k in range(0, map.size, 3): let dst = map[k] let mb = map[k + 1] let me = mb + map[k + 2] let ib = max(r.b, mb) let ie = min(r.e, me) if ib >= ie: continue newSeeds.append(Range(ib + dst - mb, ie + dst - mb)) if r.b < ib: seeds.append(Range(r.b, ib)) if r.e > ie: seeds.append(Range(ie, r.e)) break else: newSeeds.append(r) seeds = newSeeds map.clear() continue map.append(atol(splitStr[0])) map.append(atol(splitStr[1])) map.append(atol(splitStr[2])) var m = seeds[0].b for i in range(1, seeds.size): m = min(m, seeds[i].b) return m fn main() raises: let py = Python() let sys = py.import_module("sys") let input = sys.stdin.read().__str__() print(part1(input)) print(part2(input)) --- 2023/mojo/day6.🔥 --- from math import min, max from math.limit import max_finite from python import Python from collections.vector import DynamicVector fn part1(input: String) raises -> Int: let lines = input.split("\n") var times = DynamicVector[Int]() var distances = DynamicVector[Int]() let timeStrs = lines[0].split(":")[1].split(" ") for i in range(0, len(timeStrs)): if len(timeStrs[i]) > 0: times.append(atol(timeStrs[i])) let distStrs = lines[1].split(":")[1].split(" ") for i in range(0, len(distStrs)): if len(distStrs[i]) > 0: distances.append(atol(distStrs[i])) var out = 1 for i in range(0, len(times)): var cnt = 0 let t = times[i] let d = distances[i] for j in range(0, t + 1): if (t - j) * j > d: cnt += 1 out *= cnt return out fn part2(input: String) raises -> Int: let lines = input.split("\n") var filteredTimeStr = String() var filteredDistanceStr = String() let timeStrs = lines[0].split(":")[1].split(" ") for i in range(0, len(timeStrs)): if len(timeStrs[i]) > 0: filteredTimeStr += timeStrs[i] let distStrs = lines[1].split(":")[1].split(" ") for i in range(0, len(distStrs)): if len(distStrs[i]) > 0: filteredDistanceStr += distStrs[i] var out = 0 let t = atol(filteredTimeStr) let d = atol(filteredDistanceStr) for j in range(0, t + 1): if (t - j) * j > d: out += 1 return out fn main() raises: let py = Python() let sys = py.import_module("sys") let input = sys.stdin.read().__str__() print(part1(input)) print(part2(input)) --- 2023/mojo/day7.🔥 --- from python import Python from collections.vector import DynamicVector from collections.vector import InlinedFixedVector from algorithm.sort import sort @value struct Hand(CollectionElement, Stringable): var kind: Int var value: Int var str: String fn __str__(self) -> String: return "(" + str(self.kind) + ", " + str(self.value) + ", " + self.str + ")" fn handLess(a: Hand, b: Hand, cards: String) -> Bool: if a.kind == b.kind: var i = 0 while i < len(a.str) and a.str[i] == b.str[i]: i += 1 return cards.rfind(a.str[i]) < cards.rfind(b.str[i]) return a.kind < b.kind fn part1(input: String) raises -> Int: let lines = input.split("\n") let cards = String("23456789TJQKA") var hands = DynamicVector[Hand]() for i in range(0, len(lines)): if len(lines[i]) == 0: continue let split = lines[i].split(" ") var cnt = DynamicVector[Int]() cnt.resize(13, 0) for j in range(0, len(split[0])): cnt[cards.rfind(split[0][j])] += 1 sort(cnt) var filteredCnt = DynamicVector[Int]() for j in range(len(cnt) - 1, -1, -1): if cnt[j] != 0: filteredCnt.push_back(cnt[j]) let kind: Int if filteredCnt[0] == 5: kind = 6 elif filteredCnt[0] == 4: kind = 5 elif filteredCnt[0] == 3 and filteredCnt[1] == 2: kind = 4 elif filteredCnt[0] == 3: kind = 3 elif filteredCnt[0] == 2 and filteredCnt[1] == 2: kind = 2 elif filteredCnt[0] == 2: kind = 1 else: kind = 0 hands.append(Hand(kind, atol(split[1]), split[0])) for i in range(0, len(hands)): for j in range(0, len(hands) - 1): if handLess(hands[j + 1], hands[j], cards): let tmp = hands[j + 1] hands[j + 1] = hands[j] hands[j] = tmp var sum = 0 for i in range(0, len(hands)): sum += (i + 1) * hands[i].value return sum fn part2(input: String) raises -> Int: let lines = input.split("\n") let cards = String("J23456789TQKA") var hands = DynamicVector[Hand]() for i in range(0, len(lines)): if len(lines[i]) == 0: continue let split = lines[i].split(" ") var jokers = 0 var removedJokers = String() for j in range(0, len(split[0])): if split[0][j] == "J": jokers += 1 continue removedJokers += split[0][j] var cnt = DynamicVector[Int]() cnt.resize(13, 0) for j in range(0, len(removedJokers)): cnt[cards.rfind(removedJokers[j])] += 1 sort(cnt) var filteredCnt = DynamicVector[Int]() for j in range(len(cnt) - 1, -1, -1): if cnt[j] != 0: filteredCnt.push_back(cnt[j]) let kind: Int if ( jokers == 5 or filteredCnt[0] == 5 or (jokers == 1 and filteredCnt[0] == 4) or jokers == 4 or (jokers == 3 and filteredCnt[0] == 2) or (jokers == 2 and filteredCnt[0] == 3) ): kind = 6 elif ( filteredCnt[0] == 4 or (jokers == 1 and filteredCnt[0] == 3) or (jokers == 3 and filteredCnt[0] == 1) or (jokers == 2 and filteredCnt[0] == 2) ): kind = 5 elif (filteredCnt[0] == 3 and filteredCnt[1] == 2) or ( jokers == 1 and filteredCnt[0] == 2 and filteredCnt[1] == 2 ): kind = 4 elif ( filteredCnt[0] == 3 or (jokers == 1 and filteredCnt[0] == 2) or (jokers == 2 and filteredCnt[0] == 1) ): kind = 3 elif filteredCnt[0] == 2 and filteredCnt[1] == 2: kind = 2 elif filteredCnt[0] == 2 or (jokers == 1 and filteredCnt[0] == 1): kind = 1 else: kind = 0 hands.append(Hand(kind, atol(split[1]), split[0])) for i in range(0, len(hands)): for j in range(0, len(hands) - 1): if handLess(hands[j + 1], hands[j], cards): let tmp = hands[j + 1] hands[j + 1] = hands[j] hands[j] = tmp var sum = 0 for i in range(0, len(hands)): sum += (i + 1) * hands[i].value return sum fn main() raises: let input: String with open("/dev/stdin", "r") as stdin: input = stdin.read() print(part1(input)) print(part2(input)) --- 2023/mojo/day8.🔥 --- from collections.vector import DynamicVector from math import lcm @value struct Pair(CollectionElement, Stringable): var a: String var b: String fn __str__(self) -> String: return "(" + str(self.a) + ", " + str(self.b) + ")" fn part1(input: String) raises -> Int: let lines = input.split("\n") var nodes = DynamicVector[String]() var paths = DynamicVector[Pair]() for i in range(2, len(lines)): if len(lines[i]) == 0: continue let split = lines[i].split(" = ") let lr = split[1].split(", ") nodes.append(split[0]) paths.append(Pair(lr[0][1:], lr[1][:-1])) var node: String = "AAA" var i = 0 var size = 0 while node != "ZZZ": var nodeIdx = -1 for i in range(0, len(nodes)): if nodes[i] == node: nodeIdx = i break if lines[0][i] == "L": node = paths[nodeIdx].a else: node = paths[nodeIdx].b i = (i + 1) % len(lines[0]) size += 1 return size fn part2(input: String) raises -> Int: let lines = input.split("\n") var nodes = DynamicVector[String]() var paths = DynamicVector[Pair]() var starts = DynamicVector[String]() for i in range(2, len(lines)): if len(lines[i]) == 0: continue let split = lines[i].split(" = ") let lr = split[1].split(", ") nodes.append(split[0]) paths.append(Pair(lr[0][1:], lr[1][:-1])) if split[0][2] == "A": starts.append(split[0]) var out: Int = 1 for si in range(0, len(starts)): var node = starts[si] var i = 0 var size = 0 while node[2] != "Z": var nodeIdx = -1 for i in range(0, len(nodes)): if nodes[i] == node: nodeIdx = i break if lines[0][i] == "L": node = paths[nodeIdx].a else: node = paths[nodeIdx].b i = (i + 1) % len(lines[0]) size += 1 out = lcm(out, size) return out fn main() raises: let input: String with open("/dev/stdin", "r") as stdin: input = stdin.read() print(part1(input)) print(part2(input)) --- 2023/mojo/day9.🔥 --- fn part1(sequences: DynamicVector[DynamicVector[Int]]) -> Int: var out = 0 for i in range(0, len(sequences)): let vec = sequences[i] out += vec[len(vec) - 1] return out fn part2(sequences: DynamicVector[DynamicVector[Int]]) -> Int: var out = 0 for i in range(len(sequences) - 1, -1, -1): out = sequences[i][0] - out return out def main(): var part1Sum = 0 var part2Sum = 0 with open("/dev/stdin", "r") as stdin: let input = stdin.read() let lines = input.split("\n") for i in range(0, len(lines)): if len(lines[i]) == 0: continue var sequences = DynamicVector[DynamicVector[Int]]() var s = DynamicVector[Int]() let nums = lines[i].split(" ") for j in range(0, len(nums)): s.push_back(atol(nums[j])) sequences.push_back(s ^) while True: var tmp = DynamicVector[Int]() var allZeros = True let back = sequences[len(sequences) - 1] for j in range(0, len(back) - 1): let diff = back[j + 1] - back[j] allZeros = allZeros and diff == 0 tmp.push_back(diff) if allZeros: break sequences.push_back(tmp ^) part1Sum += part1(sequences) part2Sum += part2(sequences) print(part1Sum) print(part2Sum) --- 2023/rust/.gitignore --- /target/ --- 2023/rust/Cargo.lock --- # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "ahash" version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ "getrandom", "once_cell", "version_check", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "day1" version = "0.1.0" [[package]] name = "day10" version = "0.1.0" [[package]] name = "day11" version = "0.1.0" [[package]] name = "day12" version = "0.1.0" dependencies = [ "memoize", ] [[package]] name = "day13" version = "0.1.0" [[package]] name = "day14" version = "0.1.0" [[package]] name = "day15" version = "0.1.0" [[package]] name = "day16" version = "0.1.0" [[package]] name = "day17" version = "0.1.0" [[package]] name = "day18" version = "0.1.0" [[package]] name = "day19" version = "0.1.0" [[package]] name = "day2" version = "0.1.0" [[package]] name = "day20" version = "0.1.0" [[package]] name = "day21" version = "0.1.0" [[package]] name = "day22" version = "0.1.0" [[package]] name = "day23" version = "0.1.0" [[package]] name = "day24" version = "0.1.0" [[package]] name = "day25" version = "0.1.0" dependencies = [ "rand", ] [[package]] name = "day3" version = "0.1.0" [[package]] name = "day4" version = "0.1.0" [[package]] name = "day5" version = "0.1.0" [[package]] name = "day6" version = "0.1.0" [[package]] name = "day7" version = "0.1.0" [[package]] name = "day8" version = "0.1.0" [[package]] name = "day9" version = "0.1.0" [[package]] name = "getrandom" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", "wasi", ] [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "lru" version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" dependencies = [ "hashbrown", ] [[package]] name = "memoize" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7500eb334b820fcb9d8bfb9061d75fe910ed6302f690b24f3abaa133a581479c" dependencies = [ "lazy_static", "lru", "memoize-inner", ] [[package]] name = "memoize-inner" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bfde264c318ec8c2de5c39e0ba3910fac8d1065e3b947b183ebd884b799719b" dependencies = [ "lazy_static", "proc-macro2", "quote", "syn", ] [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", "rand_core", ] [[package]] name = "rand_chacha" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core", ] [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] [[package]] name = "syn" version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" --- 2023/rust/Cargo.toml --- [workspace] members = [ "day1", "day2", "day3", "day4", "day5", "day6", "day7", "day8", "day9", "day10", "day11", "day12", "day13", "day14", "day15", "day16", "day17", "day18", "day19", "day20", "day21", "day22", "day23", "day24", "day25", ] resolver = "2" --- 2023/rust/day1/Cargo.toml --- [package] name = "day1" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day1/src/main.rs --- use std::{collections::HashMap, io}; fn part1(lines: &[String]) -> u32 { let line_to_sum = |line: &String| { let mut it = line .chars() .filter(|c| c.is_ascii_digit()) .map(|d| d.to_digit(10).unwrap()); let first = it.next().unwrap(); let last = it.last().unwrap_or(first); 10 * first + last }; lines.iter().map(line_to_sum).sum() } fn part2(lines: &[String]) -> u32 { let keywords = [ ("one", 1), ("two", 2), ("three", 3), ("four", 4), ("five", 5), ("six", 6), ("seven", 7), ("eight", 8), ("nine", 9), ]; let keyword_map: HashMap<String, _> = keywords .into_iter() .map(|(s, i)| (String::from(s), i)) .collect(); let mut sum = 0; for line in lines { let digits: Vec<u32> = line .chars() .enumerate() .filter_map(|(idx, c)| -> Option<u32> { if c.is_ascii_digit() { return c.to_digit(10); } for n in 3..=5 { let substr: String = line.chars().skip(idx).take(n).collect(); if keyword_map.contains_key(&substr) { return Some(*keyword_map.get(&substr).unwrap()); } } None }) .collect(); sum += 10 * digits.first().unwrap() + digits.last().unwrap(); } sum } fn main() { let mut lines = Vec::<String>::new(); let stdin = io::stdin(); for line in stdin.lines() { lines.push(line.unwrap()); } println!("{}", part1(&lines)); println!("{}", part2(&lines)); } --- 2023/rust/day10/Cargo.toml --- [package] name = "day10" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day10/src/main.rs --- use std::{collections::VecDeque, io, str::from_utf8}; fn part1(grid: &[String], start: &(usize, usize)) -> i32 { let mut queue = VecDeque::new(); let mut visited = Vec::new(); queue.push_back((start.0 as i32, start.1 as i32)); visited.push((start.0 as i32, start.1 as i32)); queue.push_back((-1, -1)); let mut steps = 0; while !queue.is_empty() { let (r, c) = queue.pop_front().unwrap(); if r == -1 && c == -1 { steps += 1; if !queue.is_empty() { queue.push_back((-1, -1)); } } static VR: [i32; 4] = [0, 0, 1, -1]; static VC: [i32; 4] = [1, -1, 0, 0]; static DST: [&str; 4] = ["-J7", "-FL", "|LJ", "|F7"]; static ORG: [&str; 4] = ["S-FL", "S-J7", "S|F7", "S|JL"]; for i in 0..VR.len() { let (tr, tc) = (r + VR[i], c + VC[i]); if tr < 0 || tr as usize >= grid.len() || tc < 0 || tc as usize >= grid[0].len() || ORG[i] .find(grid[r as usize].chars().nth(c as usize).unwrap()) .is_none() { continue; } if DST[i] .find(grid[tr as usize].chars().nth(tc as usize).unwrap()) .is_some() && !visited.contains(&(tr, tc)) { queue.push_back((tr, tc)); visited.push((tr, tc)); } } } steps - 1 } fn part2(grid: &[String], start: &(usize, usize)) -> i32 { let vr = [0, 0, 1, -1]; let vc = [1, -1, 0, 0]; let mut queue = VecDeque::new(); let mut visited = Vec::new(); queue.push_back((start.0 as i32, start.1 as i32)); visited.push((start.0 as i32, start.1 as i32)); let mut start_dirs: u8 = 0; while !queue.is_empty() { let (r, c) = queue.pop_front().unwrap(); static DST: [&str; 4] = ["-J7", "-FL", "|LJ", "|F7"]; static ORG: [&str; 4] = ["S-FL", "S-J7", "S|F7", "S|JL"]; for i in 0..vr.len() { let (tr, tc) = (r + vr[i], c + vc[i]); let c = grid[r as usize].chars().nth(c as usize).unwrap(); if tr < 0 || tr as usize >= grid.len() || tc < 0 || tc as usize >= grid[0].len() || ORG[i].find(c).is_none() { continue; } if DST[i] .find(grid[tr as usize].chars().nth(tc as usize).unwrap()) .is_some() && !visited.contains(&(tr, tc)) { if c == 'S' { start_dirs |= 1 << i; } queue.push_back((tr, tc)); visited.push((tr, tc)); } } } let mut scaled_grid: Vec<String> = vec![from_utf8(&vec![b'.'; grid[0].len() * 2 + 1]) .unwrap() .to_string()]; for i in 0..grid.len() { let mut tmp = String::from("."); for j in 0..grid[0].len() { if !visited.contains(&(i as i32, j as i32)) { tmp += ".."; continue; } let mut c = grid[i].chars().nth(j).unwrap(); if c == 'S' { c = match start_dirs { 0b0101 => 'F', 0b1001 => 'L', 0b0110 => '7', 0b1010 => 'J', 0b0011 => '-', 0b1100 => '|', _ => unreachable!(), } } tmp.push(c); tmp.push(if String::from("FL-").contains(c) { '-' } else { '.' }); } scaled_grid.push(tmp.clone()); scaled_grid.push(tmp); for c in unsafe { scaled_grid.last_mut().unwrap().as_bytes_mut() } { *c = if String::from("F7|").contains(*c as char) { b'|' } else { b'.' } } } queue.clear(); visited.clear(); queue.push_back((0, 0)); visited.push((0, 0)); while !queue.is_empty() { let (r, c) = queue.pop_front().unwrap(); for i in 0..vr.len() { let (tr, tc) = (r + vr[i], c + vc[i]); let c = scaled_grid[r as usize].chars().nth(c as usize).unwrap(); if tr < 0 || tr as usize >= scaled_grid.len() || tc < 0 || tc as usize >= scaled_grid[0].len() { continue; } if c == '.' && !visited.contains(&(tr, tc)) { queue.push_back((tr, tc)); visited.push((tr, tc)); } } } let mut cnt = 0; for i in (1..scaled_grid.len()).step_by(2) { for j in (1..scaled_grid[i].len()).step_by(2) { if !visited.contains(&(i as i32, j as i32)) && scaled_grid[i].as_bytes()[j] == b'.' { cnt += 1; }; } } cnt } fn main() { let stdin = io::stdin(); let mut grid = Vec::new(); let mut start: (usize, usize) = (0, 0); for res_line in stdin.lines() { let line = res_line.unwrap(); if let Some(n) = line.find('S') { start = (grid.len(), n); } grid.push(line); } println!("{}", part1(&grid, &start)); println!("{}", part2(&grid, &start)); } --- 2023/rust/day11/Cargo.toml --- [package] name = "day11" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day11/src/main.rs --- use std::{collections::BTreeSet, io, mem::swap}; fn part1(grid: &[String]) -> usize { let mut galaxies = Vec::new(); let mut occupied_cols = BTreeSet::new(); let mut occupied_rows = BTreeSet::new(); grid.iter().enumerate().for_each(|(ri, r)| { r.chars().enumerate().for_each(|(ci, c)| { if c == '#' { galaxies.push((ri, ci)); occupied_rows.insert(ri); occupied_cols.insert(ci); } }); }); let mut total_dist: usize = 0; galaxies.iter().enumerate().for_each(|(ri, g1)| { galaxies.iter().skip(ri).for_each(|g2| { let (mut a, mut b) = g1; let (mut c, mut d) = g2; if a > c { swap(&mut a, &mut c); } if b > d { swap(&mut b, &mut d); } let mut dist: usize = c - a + d - b; for k in a..c { if !occupied_rows.contains(&k) { dist += 1 } } for k in b..d { if !occupied_cols.contains(&k) { dist += 1 } } total_dist += dist; }) }); total_dist } fn part2(grid: &[String]) -> usize { let mut galaxies = Vec::new(); let mut occupied_cols = BTreeSet::new(); let mut occupied_rows = BTreeSet::new(); grid.iter().enumerate().for_each(|(ri, r)| { r.chars().enumerate().for_each(|(ci, c)| { if c == '#' { galaxies.push((ri, ci)); occupied_rows.insert(ri); occupied_cols.insert(ci); } }); }); let mut total_dist: usize = 0; galaxies.iter().enumerate().for_each(|(ri, g1)| { galaxies.iter().skip(ri).for_each(|g2| { let (mut a, mut b) = g1; let (mut c, mut d) = g2; if a > c { swap(&mut a, &mut c); } if b > d { swap(&mut b, &mut d); } let mut dist: usize = c - a + d - b; for k in a..c { if !occupied_rows.contains(&k) { dist += 1000000 - 1 } } for k in b..d { if !occupied_cols.contains(&k) { dist += 1000000 - 1 } } total_dist += dist; }) }); total_dist } fn main() { let stdin = io::stdin(); let mut grid = Vec::new(); for line in stdin.lines() { grid.push(line.unwrap()); } println!("{}", part1(&grid)); println!("{}", part2(&grid)); } --- 2023/rust/day12/Cargo.toml --- [package] name = "day12" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] memoize = "0.4.1" --- 2023/rust/day12/src/main.rs --- use memoize::memoize; use std::io; #[memoize] fn part1(line: String, groups: Vec<usize>, mut li: usize, gi: usize) -> usize { if li >= line.len() { return (gi == groups.len()) as usize; } while li < line.len() { let base_char = line.chars().nth(li).unwrap(); if base_char == '.' { li += 1; continue; } if gi == groups.len() { if base_char == '#' { return 0; } li += 1; continue; } let base_idx = li; while li < line.len() && (line.as_bytes()[li] == b'?' || line.as_bytes()[li] == b'#') { li += 1; } let next_group = groups[gi]; let can_replace = li - base_idx >= next_group && (base_idx + next_group == line.len() || line.chars().nth(base_idx + next_group).unwrap() != '#'); let replaced = if can_replace { part1( line.clone(), groups.clone(), base_idx + 1 + next_group, gi + 1, ) } else { 0 }; let skipped = if base_char == '?' { part1(line, groups, base_idx + 1, gi) } else { 0 }; return replaced + skipped; } (gi == groups.len()) as usize } fn main() { let mut part1_sum = 0; let mut part2_sum = 0; let stdin = io::stdin(); for line in stdin.lines() { let split = line .unwrap() .split(' ') .map(|s| s.to_string()) .collect::<Vec<String>>(); let springs = split[0].to_string(); let groups = split[1] .split(',') .map(|s| s.parse::<usize>().unwrap()) .collect::<Vec<usize>>(); let expanded_springs = vec![&springs; 4] .into_iter() .fold(String::from(&springs), |acc, s| acc + "?" + &s); let mut expanded_groups = groups.clone(); for _ in 0..4 { expanded_groups.append(&mut groups.clone()); } part1_sum += part1(springs, groups, 0, 0); part2_sum += part1(expanded_springs, expanded_groups, 0, 0); } println!("{}", part1_sum); println!("{}", part2_sum); } --- 2023/rust/day13/Cargo.toml --- [package] name = "day13" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day13/src/main.rs --- use std::io; fn part1(block: &[String]) -> usize { let get_mirror = |block: &[String], reflections: &[usize]| { reflections .iter() .find_map(|&r| { let mut mirror = true; for i in 0..r { let opposite = r + (r - i) - 1; if opposite >= block.len() { continue; } mirror &= block[i] == block[opposite]; } if mirror { Some(r) } else { None } }) .unwrap_or(0) }; let refl_rows = block .iter() .enumerate() .filter_map(|(idx, r)| { if idx + 1 >= block.len() { return None; } if *r == block[idx + 1] { Some(idx + 1) } else { None } }) .collect::<Vec<usize>>(); let x = get_mirror(block, &refl_rows); if x != 0 { return x * 100; } let mut rotated = Vec::new(); for i in 0..block[0].len() { let mut col = String::new(); for r in block { col.push(r.chars().nth(i).unwrap()) } rotated.push(col) } let refl_cols = rotated .iter() .enumerate() .filter_map(|(idx, r)| { if idx + 1 >= rotated.len() { return None; } if *r == rotated[idx + 1] { Some(idx + 1) } else { None } }) .collect::<Vec<usize>>(); get_mirror(&rotated, &refl_cols) } fn part2(block: &[String]) -> usize { let count_diff = |a: &String, b: &String| -> usize { a.chars().zip(b.chars()).filter(|(c1, c2)| c1 != c2).count() }; let get_mirror = |block: &[String], reflections: &[usize]| { reflections .iter() .find_map(|&r| { let mut mirror = true; let mut correction = false; for i in 0..r { let opposite = r + (r - i) - 1; if opposite >= block.len() { continue; } let diff = count_diff(&block[i], &block[opposite]); mirror &= diff == 0 || (diff == 1 && !correction); correction |= diff != 0; } if mirror && correction { Some(r) } else { None } }) .unwrap_or(0) }; let refl_rows = block .iter() .enumerate() .filter_map(|(idx, r)| { if idx + 1 >= block.len() { return None; } if count_diff(r, &block[idx + 1]) <= 1 { Some(idx + 1) } else { None } }) .collect::<Vec<usize>>(); let x = get_mirror(block, &refl_rows); if x != 0 { return x * 100; } let mut rotated = Vec::new(); for i in 0..block[0].len() { let mut col = String::new(); for r in block { col.push(r.chars().nth(i).unwrap()) } rotated.push(col) } let refl_cols = rotated .iter() .enumerate() .filter_map(|(idx, r)| { if idx + 1 >= rotated.len() { return None; } if count_diff(r, &rotated[idx + 1]) <= 1 { Some(idx + 1) } else { None } }) .collect::<Vec<usize>>(); get_mirror(&rotated, &refl_cols) } fn main() { let mut part1_sum = 0; let mut part2_sum = 0; let stdin = io::stdin(); let mut block = Vec::<String>::new(); for res_line in stdin.lines() { let res = res_line.unwrap(); if !res.is_empty() { block.push(res); continue; } part1_sum += part1(&block); part2_sum += part2(&block); block.clear(); } part1_sum += part1(&block); part2_sum += part2(&block); println!("{}", part1_sum); println!("{}", part2_sum); } --- 2023/rust/day14/Cargo.toml --- [package] name = "day14" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day14/src/main.rs --- use std::collections::HashMap; use std::io; fn part1(block: &[String]) -> usize { let mut weight = 0; for c in 0..block[0].len() { let mut stop = 0; for r in 0..block.len() { let cur = block[r].as_bytes()[c]; if cur == b'#' { stop = r + 1; continue; } if cur == b'O' { weight += block.len() - stop; stop += 1; } } } weight } fn part2(mut block: Vec<String>) -> usize { let mut val_to_n = HashMap::<usize, usize>::new(); let mut iters = Vec::<usize>::new(); let mut cycle_idx = 0; let mut cycle_base = 0; let mut prev_cycle_end = 0; let mut detect_cycle = false; let row_count = block.len(); let col_count = block[0].len(); let target = 1_000_000_000; for n in 0..target { let mut weight = 0; // Tilt north for c in 0..col_count { let mut stop = 0; for r in 0..row_count { let cur = block[r].as_bytes()[c]; if cur == b'#' { stop = r + 1; continue; } if cur == b'O' { unsafe { block[r].as_bytes_mut()[c] = b'.'; block[stop].as_bytes_mut()[c] = b'O'; } stop += 1; } } } // Tilt west for r in block.iter_mut() { let mut stop = 0; for c in 0..col_count { let cur = r.as_bytes()[c]; if cur == b'#' { stop = c + 1; continue; } if cur == b'O' { unsafe { r.as_bytes_mut()[c] = b'.'; r.as_bytes_mut()[stop] = b'O'; } stop += 1; } } } // Tilt south for c in 0..col_count { let mut stop = row_count - 1; for r in (0..row_count).rev() { let cur = block[r].as_bytes()[c]; if cur == b'#' { stop = r.saturating_sub(1); continue; } if cur == b'O' { unsafe { block[r].as_bytes_mut()[c] = b'.'; block[stop].as_bytes_mut()[c] = b'O'; } weight += row_count - stop; stop = stop.saturating_sub(1); } } } // Tilt east for r in block.iter_mut() { let mut stop = col_count - 1; for c in (0..col_count).rev() { let cur = r.as_bytes()[c]; if cur == b'#' { stop = c.saturating_sub(1); continue; } if cur == b'O' { unsafe { r.as_bytes_mut()[c] = b'.'; r.as_bytes_mut()[stop] = b'O'; } stop = stop.saturating_sub(1); } } } if detect_cycle { detect_cycle = weight == iters[cycle_idx + 1]; cycle_idx += 1; } if val_to_n.contains_key(&weight) { if detect_cycle { if iters[cycle_base] == weight { if prev_cycle_end == *val_to_n.get(&weight).unwrap() { break; } prev_cycle_end = n; } } else { cycle_base = *val_to_n.get(&weight).unwrap(); cycle_idx = cycle_base; detect_cycle = true; } } val_to_n.insert(weight, n); iters.push(weight); } if detect_cycle { let diff = iters.len() - prev_cycle_end; let m = (target - prev_cycle_end - 1) % diff; return iters[prev_cycle_end + m]; } iters[target - 1] } fn main() { let stdin = io::stdin(); let mut block = Vec::<String>::new(); for line in stdin.lines() { block.push(line.unwrap()); } println!("{}", part1(&block)); println!("{}", part2(block)); } --- 2023/rust/day15/Cargo.toml --- [package] name = "day15" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day15/src/main.rs --- use std::io; fn part1(line: &str) -> usize { line.split(',') .map(|s| { let mut hash: usize = 0; for b in s.as_bytes() { hash += *b as usize; hash *= 17; hash %= 256; } hash }) .sum() } fn part2(line: &str) -> usize { let mut boxes = vec![Vec::<(String, i32)>::new(); 256]; for s in line.split(',') { let last = *s.as_bytes().last().unwrap(); let rm = last == b'-'; let delim = if rm { '-' } else { '=' }; let label = s.split(delim).next().unwrap(); let mut hash: usize = 0; for b in label.as_bytes() { hash += *b as usize; hash *= 17; hash %= 256; } let b = &mut boxes[hash]; if rm { *b = b.iter().filter(|&(l, _)| l != label).cloned().collect(); continue; } let val = (last - b'0') as i32; if let Some(i) = b.iter().position(|(l, _)| l == label) { b[i].1 = val; } else { b.push((label.to_string(), val)); } } boxes .iter() .enumerate() .filter(|(_, b)| !b.is_empty()) .map(|(i, b)| { b.iter() .enumerate() .map(|(j, &(_, v))| (i + 1) * (j + 1) * (v as usize)) .sum::<usize>() }) .sum() } fn main() { let stdin = io::stdin(); for res_line in stdin.lines() { let line = res_line.unwrap(); println!("{}", part1(&line)); println!("{}", part2(&line)); } } --- 2023/rust/day16/Cargo.toml --- [package] name = "day16" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day16/src/main.rs --- use std::{cmp::max, io}; #[derive(Clone, Copy)] enum LightDir { Up = 1 << 0, Down = 1 << 1, Left = 1 << 2, Right = 1 << 3, } struct Light { r: i32, c: i32, d: LightDir, } impl Light { fn create(r: i32, c: i32, d: LightDir) -> Light { Light { r, c, d } } } fn part1(cave: &[String], start: Light) -> usize { let mut lights = vec![start]; let mut energized = vec![vec![0; cave[0].len()]; cave.len()]; while let Some(Light { mut r, mut c, d }) = lights.pop() { if r < 0 || r as usize >= cave.len() || c < 0 || c as usize >= cave[0].len() { continue; } if energized[r as usize][c as usize] & d as i32 != 0 { continue; } loop { if r < 0 || r as usize >= cave.len() || c < 0 || c as usize >= cave[0].len() { break; } energized[r as usize][c as usize] |= d as i32; let cur = cave[r as usize].chars().nth(c as usize).unwrap(); match d { LightDir::Up => { match cur { '\\' => { lights.push(Light::create(r, c - 1, LightDir::Left)); break; } '/' => { lights.push(Light::create(r, c + 1, LightDir::Right)); break; } '-' => { lights.push(Light::create(r, c - 1, LightDir::Left)); lights.push(Light::create(r, c + 1, LightDir::Right)); break; } _ => {} } r -= 1; } LightDir::Down => { match cur { '\\' => { lights.push(Light::create(r, c + 1, LightDir::Right)); break; } '/' => { lights.push(Light::create(r, c - 1, LightDir::Left)); break; } '-' => { lights.push(Light::create(r, c + 1, LightDir::Right)); lights.push(Light::create(r, c - 1, LightDir::Left)); break; } _ => {} } r += 1; } LightDir::Left => { match cur { '\\' => { lights.push(Light::create(r - 1, c, LightDir::Up)); break; } '/' => { lights.push(Light::create(r + 1, c, LightDir::Down)); break; } '|' => { lights.push(Light::create(r - 1, c, LightDir::Up)); lights.push(Light::create(r + 1, c, LightDir::Down)); break; } _ => {} } c -= 1; } LightDir::Right => { match cur { '\\' => { lights.push(Light::create(r + 1, c, LightDir::Down)); break; } '/' => { lights.push(Light::create(r - 1, c, LightDir::Up)); break; } '|' => { lights.push(Light::create(r + 1, c, LightDir::Down)); lights.push(Light::create(r - 1, c, LightDir::Up)); break; } _ => {} } c += 1; } } } } energized .iter() .map(|r| r.iter().filter(|&c| *c != 0).count()) .sum() } fn part2(cave: &[String]) -> usize { let mut m = 0; for i in 0..cave.len() { m = max(m, part1(cave, Light::create(i as i32, 0, LightDir::Right))); m = max( m, part1( cave, Light::create(i as i32, cave[0].len() as i32 - 1, LightDir::Left), ), ); } for i in 0..cave[0].len() { m = max(m, part1(cave, Light::create(0, i as i32, LightDir::Down))); m = max( m, part1( cave, Light::create(cave.len() as i32 - 1, i as i32, LightDir::Up), ), ); } m } fn main() { let stdin = io::stdin(); let mut cave = Vec::<String>::new(); for line in stdin.lines() { cave.push(line.unwrap()); } println!("{}", part1(&cave, Light::create(0, 0, LightDir::Right))); println!("{}", part2(&cave)); } --- 2023/rust/day17/Cargo.toml --- [package] name = "day17" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day17/src/main.rs --- use std::{collections::BinaryHeap, io}; #[derive(Debug, Eq)] struct Data { w: usize, r: i32, c: i32, s: i32, d: Dir, } impl Data { fn create(w: usize, r: i32, c: i32, s: i32, d: Dir) -> Data { Data { w, r, c, s, d } } } impl PartialEq for Data { fn eq(&self, other: &Self) -> bool { self.w == other.w && self.r == other.r && self.c == other.c && self.s == other.s && self.d == other.d } } impl Ord for Data { fn cmp(&self, other: &Self) -> std::cmp::Ordering { other.w.cmp(&self.w) } } impl PartialOrd for Data { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { Some(self.cmp(other)) } } #[derive(Debug, PartialEq, Eq, Clone, Copy)] enum Dir { Up, Down, Left, Right, } const VD: [(i32, i32); 4] = [(-1, 0), (1, 0), (0, -1), (0, 1)]; const NDS: [[Dir; 2]; 4] = [ [Dir::Left, Dir::Right], [Dir::Left, Dir::Right], [Dir::Up, Dir::Down], [Dir::Up, Dir::Down], ]; fn part1(blocks: &[String]) -> usize { let mut visited = [[[[false; 4]; 4]; 150]; 150]; let mut q = BinaryHeap::<Data>::new(); q.push(Data::create( (blocks[0].as_bytes()[1] - b'0') as usize, 0, 1, 1, Dir::Right, )); q.push(Data::create( (blocks[1].as_bytes()[0] - b'0') as usize, 1, 0, 1, Dir::Down, )); while !q.is_empty() { let Data { w, r, c, s, d } = q.pop().unwrap(); if r as usize == blocks.len() - 1 && c as usize == blocks[0].len() - 1 { return w; } if visited[r as usize][c as usize][d as usize][s as usize] { continue; } visited[r as usize][c as usize][d as usize][s as usize] = true; if s < 3 { let (vr, vc) = VD[d as usize]; let nr = r + vr; let nc = c + vc; if nr >= 0 && nr < blocks.len().try_into().unwrap() && nc >= 0 && nc < blocks[0].len().try_into().unwrap() { q.push(Data::create( w + (blocks[nr as usize].as_bytes()[nc as usize] - b'0') as usize, nr, nc, s + 1, d, )); } } for nd in NDS[d as usize] { let (vr, vc) = VD[nd as usize]; let nr = r + vr; let nc = c + vc; if nr < 0 || nr >= blocks.len().try_into().unwrap() || nc < 0 || nc >= blocks[0].len().try_into().unwrap() { continue; } q.push(Data::create( w + (blocks[nr as usize].as_bytes()[nc as usize] - b'0') as usize, nr, nc, 1, nd, )); } } 0 } fn part2(blocks: &[String]) -> usize { let mut visited = [[[[false; 11]; 4]; 150]; 150]; let mut q = BinaryHeap::<Data>::new(); q.push(Data::create( (blocks[0].as_bytes()[1] - b'0') as usize, 0, 1, 1, Dir::Right, )); q.push(Data::create( (blocks[1].as_bytes()[0] - b'0') as usize, 1, 0, 1, Dir::Down, )); while !q.is_empty() { let Data { w, r, c, s, d } = q.pop().unwrap(); if r as usize == blocks.len() - 1 && c as usize == blocks[0].len() - 1 && s >= 4 { return w; } if visited[r as usize][c as usize][d as usize][s as usize] { continue; } visited[r as usize][c as usize][d as usize][s as usize] = true; if s < 10 { let (vr, vc) = VD[d as usize]; let nr = r + vr; let nc = c + vc; if nr >= 0 && nr < blocks.len().try_into().unwrap() && nc >= 0 && nc < blocks[0].len().try_into().unwrap() { q.push(Data::create( w + (blocks[nr as usize].as_bytes()[nc as usize] - b'0') as usize, nr, nc, s + 1, d, )); } if s < 4 { continue; } } for nd in NDS[d as usize] { let (vr, vc) = VD[nd as usize]; let nr = r + vr; let nc = c + vc; if nr < 0 || nr >= blocks.len().try_into().unwrap() || nc < 0 || nc >= blocks[0].len().try_into().unwrap() { continue; } q.push(Data::create( w + (blocks[nr as usize].as_bytes()[nc as usize] - b'0') as usize, nr, nc, 1, nd, )); } } 0 } fn main() { let stdin = io::stdin(); let mut blocks = Vec::<String>::new(); for line in stdin.lines() { blocks.push(line.unwrap()); } println!("{}", part1(&blocks)); println!("{}", part2(&blocks)); } --- 2023/rust/day18/Cargo.toml --- [package] name = "day18" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day18/src/main.rs --- use std::io; fn solve(coords: &[(i32, i32)], steps: i32) -> isize { // https://en.wikipedia.org/wiki/Shoelace_formula#Example let xs: Vec<i32> = coords.iter().map(|&(x, _)| x).collect(); let ys: Vec<i32> = coords.iter().map(|&(_, y)| y).collect(); let a: isize = xs .iter() .zip(ys.iter().skip(1)) .map(|(&x, &y)| x as isize * y as isize) .sum(); let s: isize = ys .iter() .zip(xs.iter().skip(1)) .map(|(&x, &y)| x as isize * y as isize) .sum(); // https://en.wikipedia.org/wiki/Pick%27s_theorem#Formula let a = (a - s).abs() / 2; let b = steps as isize; let i = a - (b / 2) + 1; i + b } fn part1(moves: &[String]) -> isize { let ms: Vec<(char, i32)> = moves .iter() .map(|l| { let split: Vec<&str> = l.split(' ').collect(); ( split[0].chars().next().unwrap(), split[1].parse::<i32>().unwrap(), ) }) .collect(); let mut steps = 0; let mut coords = Vec::<(i32, i32)>::new(); coords.push((0, 0)); for (dir, step) in ms.iter() { let (mut x, mut y) = coords.last().unwrap(); steps += step; match dir { 'U' => y += step, 'D' => y -= step, 'R' => x += step, 'L' => x -= step, _ => unreachable!(), } coords.push((x, y)); } solve(&coords, steps) } fn part2(moves: &[String]) -> isize { let ms: Vec<(char, i32)> = moves .iter() .map(|l| { let split: Vec<&str> = l.split(' ').collect(); let hex = split[2]; ( hex.chars().nth(7).unwrap(), i32::from_str_radix(&hex[2..=6], 16).unwrap(), ) }) .collect(); let mut steps = 0; let mut coords = Vec::<(i32, i32)>::new(); coords.push((0, 0)); for (dir, step) in ms.iter() { let (mut x, mut y) = coords.last().unwrap(); steps += step; match dir { '3' => y += step, '1' => y -= step, '0' => x += step, '2' => x -= step, _ => unreachable!(), } coords.push((x, y)); } solve(&coords, steps) } fn main() { let stdin = io::stdin(); let mut moves = Vec::<String>::new(); for line in stdin.lines() { moves.push(line.unwrap()); } println!("{}", part1(&moves)); println!("{}", part2(&moves)); } --- 2023/rust/day19/Cargo.toml --- [package] name = "day19" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day19/src/main.rs --- use std::collections::{HashMap, VecDeque}; use std::io; type WorkflowT = HashMap<String, Vec<(char, char, i32, String)>>; type PartT = Vec<(i32, i32, i32, i32)>; fn part1(workflows: &WorkflowT, parts: &[(i32, i32, i32, i32)]) -> usize { let mut sum = 0; for (x, m, a, s) in parts { let mut current = "in"; while current != "A" && current != "R" { for (cat, op, size, dst) in workflows.get(current).unwrap() { let less = *op == '<'; #[allow(unused_assignments)] let mut hit = false; match cat { 'x' => hit = if less { x < size } else { x > size }, 'm' => hit = if less { m < size } else { m > size }, 'a' => hit = if less { a < size } else { a > size }, 's' => hit = if less { s < size } else { s > size }, _ => hit = true, } if hit { current = &dst; break; } } } if current == "A" { sum += (x + m + a + s) as usize; } } sum } #[derive(Clone, Debug)] struct State { cur: String, x: (i32, i32), m: (i32, i32), a: (i32, i32), s: (i32, i32), } fn part2(workflows: &WorkflowT) -> usize { let mut combinations = 0; let mut q: VecDeque<State> = VecDeque::new(); q.push_back(State { cur: "in".to_owned(), x: (1, 4000), m: (1, 4000), a: (1, 4000), s: (1, 4000), }); while !q.is_empty() { let mut st = q.pop_front().unwrap(); if st.cur == "R" { continue; } if st.cur == "A" { combinations += (st.x.1 - st.x.0 + 1) as usize * (st.m.1 - st.m.0 + 1) as usize * (st.a.1 - st.a.0 + 1) as usize * (st.s.1 - st.s.0 + 1) as usize; continue; } for (cat, op, size, dst) in workflows.get(&st.cur).unwrap() { st.cur = dst.to_string(); let mut nst = st.clone(); let less = *op == '<'; match cat { 'x' => { if less { nst.x.1 = size - 1; st.x.0 = *size; } else { nst.x.0 = size + 1; st.x.1 = *size; } } 'm' => { if less { nst.m.1 = size - 1; st.m.0 = *size; } else { nst.m.0 = size + 1; st.m.1 = *size; } } 'a' => { if less { nst.a.1 = size - 1; st.a.0 = *size; } else { nst.a.0 = size + 1; st.a.1 = *size; } } 's' => { if less { nst.s.1 = size - 1; st.s.0 = *size; } else { nst.s.0 = size + 1; st.s.1 = *size; } } _ => {} } q.push_back(nst); } } combinations } fn main() { let mut workflows: WorkflowT = WorkflowT::new(); let mut parts: PartT = PartT::new(); for res_line in io::stdin().lines() { let line = res_line.unwrap(); if line.is_empty() { break; } let mut split = line.split('{'); let wf = split.next().unwrap().to_string(); let items: Vec<(char, char, i32, String)> = split .next() .unwrap() .split(',') .map(|s| { if s.ends_with('}') { return ('.', '.', 0, s[0..s.len() - 1].to_string()); } let mut split = s[2..].split(':'); let n = split.next().unwrap().parse::<i32>().unwrap(); let d = split.next().unwrap().to_string(); (s.chars().next().unwrap(), s.chars().nth(1).unwrap(), n, d) }) .collect(); workflows.insert(wf, items); } for res_line in io::stdin().lines() { let line = res_line.unwrap(); let x: &[_] = &['{', '}']; let part: Vec<i32> = line .trim_matches(x) .split(',') .map(|s| s.split('=').next_back().unwrap().parse::<i32>().unwrap()) .collect(); parts.push((part[0], part[1], part[2], part[3])); } println!("{}", part1(&workflows, &parts)); println!("{}", part2(&workflows)); } --- 2023/rust/day2/Cargo.toml --- [package] name = "day2" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day2/src/main.rs --- use std::{ cmp, io::{self}, }; struct CubeCount { red: i32, green: i32, blue: i32, } impl Default for CubeCount { fn default() -> Self { Self { red: 12, green: 13, blue: 14, } } } impl CubeCount { fn is_valid(&self) -> bool { self.red >= 0 && self.green >= 0 && self.blue >= 0 } } fn part1(line: &str) -> i32 { let tokens: Vec<&str> = line.split(':').collect(); let valid = tokens[1] .split(';') .map(|s| { let mut cc = CubeCount::default(); s.split(',').for_each(|s| { let cubes: Vec<&str> = s.trim().split(' ').collect(); let n: i32 = cubes[0].parse::<i32>().unwrap(); match cubes[1] { "red" => cc.red -= n, "green" => cc.green -= n, "blue" => cc.blue -= n, _ => panic!("invalid color"), } }); cc.is_valid() }) .fold(true, |init, v| init & v); if !valid { return 0; } tokens[0] .trim() .split(' ') .nth(1) .unwrap() .parse::<i32>() .unwrap() } fn part2(line: &str) -> i32 { let tokens: Vec<&str> = line.split(':').collect(); let mut cc = CubeCount { red: 0, green: 0, blue: 0, }; tokens[1].split(';').for_each(|s| { s.split(',').for_each(|s| { let cubes: Vec<&str> = s.trim().split(' ').collect(); let n: i32 = cubes[0].parse::<i32>().unwrap(); match cubes[1] { "red" => cc.red = cmp::max(cc.red, n), "green" => cc.green = cmp::max(cc.green, n), "blue" => cc.blue = cmp::max(cc.blue, n), _ => panic!("invalid color"), } }) }); cc.red * cc.green * cc.blue } fn main() { let mut part1_sum = 0; let mut part2_sum = 0; let stdin = io::stdin(); for line in stdin.lines() { part1_sum += part1(line.as_ref().unwrap()); part2_sum += part2(line.as_ref().unwrap()); } println!("{}", part1_sum); println!("{}", part2_sum); } --- 2023/rust/day20/Cargo.toml --- [package] name = "day20" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day20/src/main.rs --- use std::collections::{HashMap, VecDeque}; use std::io; #[derive(Default, Clone, PartialEq, Eq, Debug)] enum Type { #[default] None, FlipFlop, Conjunction, } #[derive(Default, Clone, Debug)] struct Module { t: Type, id: String, connections: Vec<String>, inputs: HashMap<String, bool>, flipped: bool, } type ModuleInfosT = HashMap<String, Module>; fn gcd(mut a: usize, mut b: usize) -> usize { while a != b { if a > b { a -= b } else { b -= a } } a } fn part1(mut module_infos: ModuleInfosT) -> usize { let mut low = 0; let mut high = 0; for _ in 0..1000 { let mut q = VecDeque::<(String, bool)>::new(); q.push_back((String::from("broadcaster"), false)); while !q.is_empty() { let mut new_infos = module_infos.clone(); let (cur, mut pulse) = q.pop_front().unwrap(); if pulse { high += 1 } else { low += 1 } let info = module_infos.get_mut(&cur).unwrap(); if info.t == Type::FlipFlop { if pulse { continue; } pulse = !info.flipped; info.flipped = !info.flipped; } else if info.t == Type::Conjunction { let all_high = info.inputs.iter().fold(true, |acc, e| acc & e.1); pulse = !all_high } if !new_infos.contains_key(&cur) { continue; } for c in info.connections.iter() { let cur_info = new_infos.get_mut(c).unwrap(); if cur_info.t == Type::Conjunction { cur_info.inputs.insert(cur.clone(), pulse); } q.push_back((c.to_string(), pulse)); } new_infos.insert(cur, info.clone()); module_infos = new_infos; } } low * high } fn part2(mut module_infos: ModuleInfosT) -> usize { let sub_endings = module_infos .get( module_infos .get("rx") .unwrap() .inputs .keys() .next() .unwrap(), ) .unwrap() .inputs .clone(); let mut cycles: Vec<usize> = Vec::new(); let mut push = 1; while cycles.len() != 4 { let mut q = VecDeque::<(String, bool)>::new(); q.push_back((String::from("broadcaster"), false)); while !q.is_empty() { let mut new_infos = module_infos.clone(); let (cur, mut pulse) = q.pop_front().unwrap(); if sub_endings.contains_key(&cur) && !pulse { cycles.push(push); } let info = module_infos.get_mut(&cur).unwrap(); if info.t == Type::FlipFlop { if pulse { continue; } pulse = !info.flipped; info.flipped = !info.flipped; } else if info.t == Type::Conjunction { let all_high = info.inputs.iter().fold(true, |acc, e| acc & e.1); pulse = !all_high } if !new_infos.contains_key(&cur) { continue; } for c in info.connections.iter() { let cur_info = new_infos.get_mut(c).unwrap(); if cur_info.t == Type::Conjunction { cur_info.inputs.insert(cur.clone(), pulse); } q.push_back((c.to_string(), pulse)); } new_infos.insert(cur, info.clone()); module_infos = new_infos; } push += 1; } cycles.iter().fold(1, |acc, n| acc * n / gcd(acc, *n)) } fn main() { let mut module_infos: ModuleInfosT = ModuleInfosT::new(); for res_line in io::stdin().lines() { let line = res_line.unwrap(); let mut split = line.split("->"); let m = split.next().unwrap().trim(); let conenctions: Vec<String> = split .next() .unwrap() .trim() .split(',') .map(|s| s.trim().to_string()) .collect(); let mut module = Module { id: m[1..].to_owned(), connections: conenctions, ..Module::default() }; match m.chars().next().unwrap() { '%' => module.t = Type::FlipFlop, '&' => module.t = Type::Conjunction, _ => module.id = m.to_string(), } module_infos.insert(module.id.clone(), module); } module_infos.insert( "rx".to_owned(), Module { id: "rx".to_owned(), ..Default::default() }, ); let mut connected_infos = module_infos.clone(); for (m, i) in module_infos { for c in i.connections { let ci = connected_infos.get_mut(&c).unwrap(); if ci.t == Type::Conjunction || c == "rx" { ci.inputs.insert(m.clone(), false); } } } println!("{}", part1(connected_infos.clone())); println!("{}", part2(connected_infos)); } --- 2023/rust/day21/Cargo.toml --- [package] name = "day21" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day21/src/main.rs --- use std::collections::HashSet; use std::collections::VecDeque; use std::io; fn get_reached_plot_count(garden: &[String], start: &(usize, usize), steps: usize) -> usize { let mut queue = VecDeque::new(); let mut visited = HashSet::new(); queue.push_back((start.0 as i32, start.1 as i32)); queue.push_back((-1, -1)); let mut step = 0; while !queue.is_empty() { let (r, c) = queue.pop_front().unwrap(); if r == -1 && c == -1 { if step == steps { break; } step += 1; visited.clear(); if !queue.is_empty() { queue.push_back((-1, -1)); } continue; } if !visited.insert((r, c)) { continue; } static DIRS: [(i32, i32); 4] = [(0, 1), (0, -1), (1, 0), (-1, 0)]; for (dr, dc) in DIRS.iter() { let (nr, nc) = (r + dr, c + dc); if nr < 0 || nr as usize >= garden.len() || nc < 0 || nc as usize >= garden[0].len() || garden[nr as usize].chars().nth(nc as usize).unwrap() == '#' { continue; } queue.push_back((nr, nc)); } } visited.len() } fn part1(garden: &[String], start: &(usize, usize)) -> usize { get_reached_plot_count(garden, start, 64) } fn part2(garden: &[String], start: &(usize, usize)) -> usize { let n = 26501365; let odd_covered = get_reached_plot_count(garden, start, 131); let odd_diamond = get_reached_plot_count(garden, start, 65); let even_covered = get_reached_plot_count(garden, start, 130); let even_diamond = get_reached_plot_count(garden, start, 64); let repetition = (2 * n + 1) / garden[0].len(); let dist = (repetition - 1) / 2; let total_odd = dist + 1 + (dist + 1) * dist; let total_even = dist + (dist - 1) * dist; total_odd * odd_covered + total_even * even_covered - (dist + 1) * (odd_covered - odd_diamond) + dist * (even_covered - even_diamond) } fn main() { let stdin = io::stdin(); let mut garden = Vec::new(); let mut start: (usize, usize) = (0, 0); for res_line in stdin.lines() { let line = res_line.unwrap(); if let Some(n) = line.find('S') { start = (garden.len(), n); } garden.push(line); } println!("{}", part1(&garden, &start)); println!("{}", part2(&garden, &start)); } --- 2023/rust/day22/Cargo.toml --- [package] name = "day22" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day22/src/main.rs --- use std::cmp::max; use std::cmp::min; use std::collections::HashMap; use std::collections::HashSet; use std::collections::VecDeque; use std::io; #[derive(Clone, Debug)] struct Point { x: i32, y: i32, z: i32, } #[derive(Clone, Debug)] struct Brick { id: usize, begin: Point, end: Point, } #[derive(Default, Debug)] struct CollisionData { supports: Vec<usize>, supported_by: Vec<usize>, } type CollisionDataMap = HashMap<usize, CollisionData>; fn simulate_gravity(mut bricks: Vec<Brick>) -> CollisionDataMap { bricks.sort_by(|rhs, lhs| rhs.begin.z.cmp(&lhs.begin.z)); let mut collision_datas = CollisionDataMap::new(); let mut fallen_bricks = bricks.clone(); for Brick { id: i, begin: mut b, end: mut e, } in bricks { collision_datas.insert(i, CollisionData::default()); let mut falling_bricks = Vec::new(); let mut maybe_collides = Vec::new(); let mut z_collision = 1; for Brick { id: ci, begin: cb, end: ce, } in &fallen_bricks { if i == *ci { continue; } falling_bricks.push(Brick { id: *ci, begin: cb.clone(), end: ce.clone(), }); let (xb, xe) = (max(cb.x, b.x), min(ce.x, e.x)); let (yb, ye) = (max(cb.y, b.y), min(ce.y, e.y)); if xb > xe || yb > ye { continue; } if ce.z < b.z { z_collision = max(z_collision, ce.z + 1); maybe_collides.push((*ci, ce.z + 1)); } } let fall = b.z - z_collision; b.z -= fall; e.z -= fall; falling_bricks.push(Brick { id: i, begin: b, end: e, }); for (id, z) in maybe_collides { if z == z_collision { let mut d1 = collision_datas .insert(id, CollisionData::default()) .unwrap_or_default(); d1.supports.push(i); collision_datas.insert(id, d1); let mut d2 = collision_datas .insert(i, CollisionData::default()) .unwrap_or_default(); d2.supported_by.push(id); collision_datas.insert(i, d2); } } fallen_bricks = falling_bricks; } collision_datas } fn part1(collision_datas: &CollisionDataMap) -> usize { collision_datas .iter() .filter(|(_, data)| { data.supports .iter() .all(|supported| collision_datas.get(supported).unwrap().supported_by.len() > 1) }) .count() } fn part2(collision_datas: &CollisionDataMap) -> usize { let mut total = 0; for &block in collision_datas.keys() { let mut queue = VecDeque::new(); let mut visited = HashSet::new(); queue.push_back(block); visited.insert(block); let mut falling = 0; while !queue.is_empty() { let b = queue.pop_front().unwrap(); for &supported in collision_datas.get(&b).unwrap().supports.iter() { if visited.contains(&supported) { continue; } let supporters_falling = collision_datas .get(&supported) .unwrap() .supported_by .iter() .all(|supporter| visited.contains(supporter)); if supporters_falling { queue.push_back(supported); visited.insert(supported); falling += 1; } } } total += falling; } total } fn main() { let stdin = io::stdin(); let mut bricks = Vec::new(); for res_line in stdin.lines() { let line = res_line.unwrap(); let points = line .split('~') .map(|s| { let split: Vec<&str> = s.split(',').collect(); Point { x: split[0].parse::<i32>().unwrap(), y: split[1].parse::<i32>().unwrap(), z: split[2].parse::<i32>().unwrap(), } }) .collect::<Vec<Point>>(); bricks.push(Brick { id: bricks.len(), begin: points[0].to_owned(), end: points[1].to_owned(), }); } let collision_datas = simulate_gravity(bricks); println!("{}", part1(&collision_datas)); println!("{}", part2(&collision_datas)); } --- 2023/rust/day23/Cargo.toml --- [package] name = "day23" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day23/src/main.rs --- use std::cmp::max; use std::collections::HashSet; use std::collections::VecDeque; use std::io; const DIRS: [(i32, i32); 4] = [(1, 0), (-1, 0), (0, -1), (0, 1)]; fn step_in_dir(map: &[String], r: usize, c: usize, d: (i32, i32)) -> Option<(usize, usize)> { let nr_i = r as i32 + d.0; let nc_i = c as i32 + d.1; let nr = nr_i as usize; let nc = nc_i as usize; if nr_i < 0 || nr >= map.len() || nc_i < 0 || nc >= map[0].len() || map[nr].chars().nth(nc).unwrap() == '#' { None } else { Some((nr, nc)) } } fn part1(map: &[String]) -> Option<usize> { fn traverse( map: &[String], pos: (usize, usize), steps: usize, visited: &mut HashSet<(usize, usize)>, ) -> usize { if !visited.insert(pos) { return 0; } let (r, c) = pos; let cur = map[r].chars().nth(c).unwrap(); let mut res = 0; if r == map.len() - 1 { res = steps; } else if cur == '>' { res = traverse(map, (r, c + 1), steps + 1, visited); } else if cur == '^' { res = traverse(map, (r - 1, c), steps + 1, visited); } else if cur == '<' { res = traverse(map, (r, c - 1), steps + 1, visited); } else if cur == 'v' { res = traverse(map, (r + 1, c), steps + 1, visited); } else { for (nr, nc) in DIRS.iter().filter_map(|&d| step_in_dir(map, r, c, d)) { res = max(res, traverse(map, (nr, nc), steps + 1, visited)) } } res } let mut visited = HashSet::new(); Some(traverse(map, (0, map[0].find('.')?), 0, &mut visited)) } fn part2(map: &[String]) -> Option<usize> { fn traverse( map: &[HashSet<(usize, usize)>], pos: usize, steps: usize, visited: &mut HashSet<usize>, ) -> usize { if !visited.insert(pos) { return 0; } if pos == map.len() - 1 { visited.remove(&pos); return steps; } let res = map[pos].iter().fold(0, |acc, &(dst, w)| { max(acc, traverse(map, dst, steps + w, visited)) }); visited.remove(&pos); res } let mut pois = Vec::new(); pois.push((pois.len(), 0, map[0].find('.')?)); for (ri, r) in map.iter().enumerate() { for (ci, c) in r.chars().enumerate() { if c != '.' { continue; } let roads = DIRS .iter() .filter(|&&d| step_in_dir(map, ri, ci, d).is_some()) .count(); if roads > 2 { pois.push((pois.len(), ri, ci)); } } } pois.push((pois.len(), map.len() - 1, map.last()?.find('.')?)); let mut edges = vec![HashSet::<(usize, usize)>::new(); pois.len()]; for &(pid, pr, pc) in pois.iter() { let mut visited = HashSet::new(); let mut q = VecDeque::new(); q.push_back((0, pr, pc)); while !q.is_empty() { let (s, r, c) = q.pop_front()?; if let Some(pid2) = pois .iter() .filter(|&&(ni, nr, nc)| ni != pid && nr == r && nc == c) .map(|(i, _, _)| *i) .next() { edges[pid].insert((pid2, s)); edges[pid2].insert((pid, s)); continue; } if !visited.insert((r, c)) { continue; } for (nr, nc) in DIRS.iter().filter_map(|&d| step_in_dir(map, r, c, d)) { q.push_back((s + 1, nr, nc)); } } } let mut visited = HashSet::new(); Some(traverse(&edges, 0, 0, &mut visited)) } fn main() { let stdin = io::stdin(); let mut map = Vec::new(); for line in stdin.lines() { map.push(line.unwrap()); } println!("{}", part1(&map).unwrap_or_default()); println!("{}", part2(&map).unwrap_or_default()); } --- 2023/rust/day24/Cargo.toml --- [package] name = "day24" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day24/src/main.rs --- use std::io; use std::ops; const EPSILON: f64 = 1e-3; #[derive(Clone, Copy, Debug, PartialEq, Eq)] struct Vec3 { x: i64, y: i64, z: i64, } impl ops::Add<Vec3> for Vec3 { type Output = Vec3; fn add(self, rhs: Vec3) -> Self::Output { Vec3 { x: self.x + rhs.x, y: self.y + rhs.y, z: self.z + rhs.z, } } } impl ops::Sub<Vec3> for Vec3 { type Output = Vec3; fn sub(self, rhs: Vec3) -> Self::Output { Vec3 { x: self.x - rhs.x, y: self.y - rhs.y, z: self.z - rhs.z, } } } impl ops::Mul<i64> for Vec3 { type Output = Vec3; fn mul(self, rhs: i64) -> Self::Output { Vec3 { x: self.x * rhs, y: self.y * rhs, z: self.z * rhs, } } } #[derive(Clone, Debug)] struct Hailstone { pos: Vec3, dir: Vec3, } fn intersect(h1: &Hailstone, h2: &Hailstone) -> Option<(f64, f64)> { let Hailstone { pos: p1, dir: d1 } = h1; let Hailstone { pos: p2, dir: d2 } = h2; let fp1 = (p1.x as f64, p1.y as f64); let fd1 = (d1.x as f64, d1.y as f64); let fp2 = (p2.x as f64, p2.y as f64); let fd2 = (d2.x as f64, d2.y as f64); let a = fd1.1 / fd1.0; let c = fp1.1 - a * fp1.0; let b = fd2.1 / fd2.0; let d = fp2.1 - b * fp2.0; if (a - b).abs() < EPSILON { return None; } let x = (d - c) / (a - b); let t1 = (x - fp1.0) / fd1.0; let t2 = (x - fp2.0) / fd2.0; if t1 < 0.0 || t2 < 0.0 { return None; } Some((t1, t2)) } fn part1(hailstones: &[Hailstone]) -> usize { const BEGIN: f64 = 200000000000000.0; const END: f64 = 400000000000000.0; let mut cnt = 0_usize; for (idx, h1) in hailstones.iter().enumerate() { for h2 in hailstones.iter().skip(idx + 1) { if let Some((t1, _)) = intersect(h1, h2) { let Hailstone { pos, dir } = h1; let x = pos.x as f64 + t1 * dir.x as f64; let y = pos.y as f64 + t1 * dir.y as f64; if (BEGIN..=END).contains(&x) && (BEGIN..=END).contains(&y) { cnt += 1; } } } } cnt } fn part2(hailstones: &[Hailstone]) -> i64 { const N: i64 = 250; for x in -N..=N { for y in -N..=N { for z in -N..=N { let cv = Vec3 { x, y, z }; let Hailstone { pos: p0, dir: td0 } = hailstones[0]; let Hailstone { pos: p1, dir: td1 } = hailstones[1]; let d0 = td0 - cv; let d1 = td1 - cv; if d0.x == 0 || d1.x == 0 { continue; } if let Some((ft1, ft2)) = intersect( &Hailstone { pos: p0, dir: d0 }, &Hailstone { pos: p1, dir: d1 }, ) { if (ft1.round() - ft1).abs() >= EPSILON || (ft2.round() - ft2).abs() >= EPSILON { continue; } let (t1, t2) = (ft1 as i64, ft2 as i64); let intersection = p0 + d0 * t1; let Vec3 { x: ix, y: iy, z: iz, } = intersection; if iz != p1.z + t2 * d1.z { continue; } if hailstones .iter() .skip(2) .all(|&Hailstone { pos: cp, dir: cd }| { let nd = cd - cv; let tt = (ix - cp.x) / nd.x; intersection == cp + nd * tt }) { return ix + iy + iz; } } } } } 0 } fn main() { let stdin = io::stdin(); let mut hailstones = Vec::new(); for res_line in stdin.lines() { let line = res_line.unwrap(); let vecs = line .split('@') .map(|s| { let split: Vec<&str> = s.split(',').map(|s| s.trim()).collect(); Vec3 { x: split[0].parse::<i64>().unwrap(), y: split[1].parse::<i64>().unwrap(), z: split[2].parse::<i64>().unwrap(), } }) .collect::<Vec<Vec3>>(); hailstones.push(Hailstone { pos: vecs[0].to_owned(), dir: vecs[1].to_owned(), }); } println!("{}", part1(&hailstones)); println!("{}", part2(&hailstones)); } --- 2023/rust/day25/Cargo.toml --- [package] name = "day25" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] rand = "0.8.5" --- 2023/rust/day25/src/main.rs --- use std::collections::{HashMap, HashSet}; use std::io; use rand::Rng; fn part1(components: &HashMap<String, HashSet<String>>) -> usize { let mut node2id = HashMap::new(); for node in components.keys() { node2id.insert(node, node2id.len()); } let mut original_subsets = Vec::new(); let mut original_edges = Vec::new(); for (n, es) in components { original_subsets.push(HashSet::new()); original_subsets.last_mut().unwrap().insert(node2id[n]); for e in es { original_edges.push((node2id[n], node2id[e])); } } loop { let mut subsets = original_subsets.clone(); let mut edges = original_edges.clone(); while subsets.len() > 2 { let n = rand::thread_rng().gen_range(0..edges.len()); let (b, e) = edges.remove(n); let (mut s1, mut s2) = (0, 0); for (i, s) in subsets.iter().enumerate() { if s.contains(&b) { s1 = i; } if s.contains(&e) { s2 = i; } } if s1 == s2 { continue; } let ns1: HashSet<_> = subsets[s1].union(&subsets[s2]).copied().collect(); subsets = subsets .iter() .enumerate() .filter(|&(i, _)| i != s1 && i != s2) .map(|(_, v)| v.to_owned()) .collect(); subsets.push(ns1); } let cnt = edges .iter() .filter(|(b, e)| subsets[0].contains(b) && subsets[1].contains(e)) .count(); if cnt == 3 { return subsets[0].len() * subsets[1].len(); } } } fn part2() -> i64 { 0 } fn main() { let stdin = io::stdin(); let mut components: HashMap<String, HashSet<String>> = HashMap::new(); for res_line in stdin.lines() { let line = res_line.unwrap(); let split = line .split(':') .map(|s| s.trim().to_owned()) .collect::<Vec<String>>(); let head = split[0].clone(); let edges = split[1] .split(' ') .map(|s| s.trim().to_owned()) .collect::<Vec<String>>(); for edge in edges { components .entry(head.clone()) .or_default() .insert(edge.clone()); components .entry(edge.clone()) .or_default() .insert(head.clone()); } } println!("{}", part1(&components)); println!("{}", part2()); } --- 2023/rust/day3/Cargo.toml --- [package] name = "day3" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day3/src/main.rs --- use std::io; fn part1(lines: &[String]) -> i32 { let symbols: Vec<(i32, i32, char)> = lines .iter() .enumerate() .flat_map(|(r, v)| { let s: Vec<(i32, i32, char)> = v .chars() .enumerate() .filter(|(_c, v)| *v != '.' && !v.is_ascii_digit()) .map(move |(c, v)| (r as i32, c as i32, v)) .collect(); s }) .collect(); let mut nums: Vec<(i32, i32, i32, i32)> = Vec::new(); for (idx, line) in lines.iter().enumerate() { let mut i = 0; while i < line.len() { if !line.chars().nth(i).unwrap().is_ascii_digit() { i += 1; continue; } let b = i; while i < line.len() && line.chars().nth(i).unwrap().is_ascii_digit() { i += 1 } nums.push(( idx.try_into().unwrap(), b.try_into().unwrap(), (i - 1).try_into().unwrap(), line[b..i].to_string().parse::<i32>().unwrap(), )); } } nums.iter() .filter(|(l, b, e, _n)| { symbols .iter() .filter(|(sr, sc, _s)| *sr >= l - 1 && *sr <= l + 1 && *sc >= b - 1 && *sc <= e + 1) .peekable() .peek() .is_some() }) .map(|(_, _, _, n)| *n) .sum() } fn part2(lines: &[String]) -> i32 { let symbols: Vec<(i32, i32, char)> = lines .iter() .enumerate() .flat_map(|(r, v)| { let s: Vec<(i32, i32, char)> = v .chars() .enumerate() .filter(|(_c, v)| *v == '*') .map(move |(c, v)| (r as i32, c as i32, v)) .collect(); s }) .collect(); let mut nums: Vec<(i32, i32, i32, i32)> = Vec::new(); for (idx, line) in lines.iter().enumerate() { let mut i = 0; while i < line.len() { if !line.chars().nth(i).unwrap().is_ascii_digit() { i += 1; continue; } let b = i; while i < line.len() && line.chars().nth(i).unwrap().is_ascii_digit() { i += 1 } nums.push(( idx.try_into().unwrap(), b.try_into().unwrap(), (i - 1).try_into().unwrap(), line[b..i].to_string().parse::<i32>().unwrap(), )); } } symbols .iter() .filter_map(|(sr, sc, _s)| { let ans: Vec<i32> = nums .iter() .filter(|(l, b, e, _n)| { *sr >= l - 1 && *sr <= l + 1 && *sc >= b - 1 && *sc <= e + 1 }) .map(|(_, _, _, n)| *n) .collect(); if ans.len() != 2 { None } else { Some(ans[0] * ans[1]) } }) .sum() } fn main() { let mut lines = Vec::<String>::new(); let stdin = io::stdin(); for line in stdin.lines() { lines.push(line.unwrap()); } println!("{}", part1(&lines)); println!("{}", part2(&lines)); } --- 2023/rust/day4/Cargo.toml --- [package] name = "day4" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day4/src/main.rs --- use std::io; fn part1(line: &str) -> i32 { let nums: Vec<Vec<i32>> = line .split(':') .next_back() .unwrap() .split('|') .map(|str| { str.split(' ') .filter(|s| !s.is_empty()) .map(|s| s.parse::<i32>().unwrap()) .collect::<Vec<i32>>() }) .collect(); nums[1].iter().filter(|n| nums[0].contains(n)).fold( 0, |acc, _| { if acc == 0 { 1 } else { acc << 1 } }, ) } fn part2(line: &str, cache: &mut Vec<i32>) -> i32 { let mut split_header = line.split(':'); let id = split_header .next() .unwrap() .split(' ') .next_back() .unwrap() .parse::<usize>() .unwrap(); let nums: Vec<Vec<i32>> = line .split(':') .next_back() .unwrap() .split('|') .map(|str| { str.split(' ') .filter(|s| !s.is_empty()) .map(|s| s.parse::<i32>().unwrap()) .collect::<Vec<i32>>() }) .collect(); cache[id] += 1; nums[1] .iter() .filter(|n| nums[0].contains(n)) .enumerate() .for_each(|(i, _)| { if id + i + 1 < cache.len() { cache[id + i + 1] += cache[id] } }); cache[id] } fn main() { let mut lines = Vec::<String>::new(); let stdin = io::stdin(); for line in stdin.lines() { lines.push(line.unwrap()); } let mut part1_sum = 0; let mut part2_sum = 0; let mut cache: Vec<i32> = vec![0; lines.len() + 1]; for line in lines.iter() { part1_sum += part1(line); part2_sum += part2(line, &mut cache); } println!("{}", part1_sum); println!("{}", part2_sum); } --- 2023/rust/day5/Cargo.toml --- [package] name = "day5" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day5/src/main.rs --- use std::io; fn part1(lines: &[String]) -> u32 { let mut nums: Vec<u32> = lines .get(0) .unwrap() .split(':') .next_back() .unwrap() .trim() .split(' ') .map(|s| s.parse::<u32>().unwrap()) .collect(); let mut tmp = nums.clone(); for line in lines.iter().skip(1) { if line.is_empty() || line.split(' ').count() < 3 { nums = tmp.clone(); continue; } let mapping = line .trim() .split(' ') .map(|s| s.parse::<u32>().unwrap()) .collect::<Vec<u32>>(); for (idx, &n) in nums.iter().enumerate() { let end: usize = mapping[1] as usize + mapping[2] as usize; if n >= mapping[1] && (n as usize) < end { tmp[idx] = mapping[0] + (n - mapping[1]); } } } tmp.into_iter().min().unwrap() } fn part2(lines: &[String]) -> u32 { let ranges: Vec<u32> = lines .get(0) .unwrap() .split(':') .next_back() .unwrap() .trim() .split(' ') .map(|s| s.parse::<u32>().unwrap()) .collect(); let mut nums = Vec::<u32>::new(); for i in (0..ranges.len()).step_by(2) { for n in 0..ranges[i + 1] { nums.push(ranges[i] + n); } } drop(ranges); let mut tmp = nums.clone(); for line in lines.iter().skip(1) { if line.is_empty() || line.split(' ').count() < 3 { nums.clear(); nums.shrink_to_fit(); nums = tmp.clone(); continue; } let mapping = line .trim() .split(' ') .map(|s| s.parse::<u32>().unwrap()) .collect::<Vec<u32>>(); for (idx, &n) in nums.iter().enumerate() { let end: usize = mapping[1] as usize + mapping[2] as usize; if n >= mapping[1] && (n as usize) < end { tmp[idx] = mapping[0] + (n - mapping[1]); } } } tmp.into_iter().min().unwrap() } fn main() { let mut lines = Vec::<String>::new(); let stdin = io::stdin(); for line in stdin.lines() { lines.push(line.unwrap()); } println!("{}", part1(&lines)); println!("{}", part2(&lines)); } --- 2023/rust/day6/Cargo.toml --- [package] name = "day6" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day6/src/main.rs --- use std::io; fn part1(lines: &[String]) -> u32 { let nums = lines .iter() .map(|line| { line.split(':') .nth(1) .unwrap() .split(' ') .filter(|s| !s.is_empty()) .map(|s| s.parse::<u32>().unwrap()) .collect::<Vec<u32>>() }) .collect::<Vec<Vec<u32>>>(); let mut out = 1; for i in 0..nums[0].len() { let t = nums[0][i]; let d = nums[1][i]; let mut cnt = 0; for j in 0..=t { if (t - j) * j > d { cnt += 1; } } out *= cnt; } out } fn part2(lines: &[String]) -> u32 { let nums = lines .iter() .map(|line| { line.split(':') .nth(1) .unwrap() .chars() .filter(|c| !c.is_whitespace()) .collect::<String>() .parse::<usize>() .unwrap() }) .collect::<Vec<usize>>(); let mut out = 0; let t = nums[0]; let d = nums[1]; for j in 0..=t { if (t - j) * j > d { out += 1; } } out } fn main() { let mut lines = Vec::<String>::new(); let stdin = io::stdin(); for line in stdin.lines() { lines.push(line.unwrap()); } println!("{}", part1(&lines)); println!("{}", part2(&lines)); } --- 2023/rust/day7/Cargo.toml --- [package] name = "day7" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day7/src/main.rs --- use std::io; fn part1(lines: &[String]) -> i32 { let cards = "23456789TJQKA"; let mut nums = lines .iter() .map(|line| { let split = line.split(' ').collect::<Vec<&str>>(); let mut cnt = [0; 13]; split[0].chars().for_each(|x| { cnt[cards.find(x).unwrap()] += 1; }); cnt.sort(); cnt.reverse(); let filtered = cnt.into_iter().filter(|&x| x != 0).collect::<Vec<i32>>(); let kind = match &filtered[..] { [5] => 6, [4, ..] => 5, [3, 2] => 4, [3, ..] => 3, [2, 2, ..] => 2, [2, ..] => 1, _ => 0, }; (kind, split[1].parse::<i32>().unwrap(), split[0]) }) .collect::<Vec<(i32, i32, &str)>>(); nums.sort_by(|a, b| { if a.0 == b.0 { let (ac, bc) = a.2.chars().zip(b.2.chars()).find(|(f, s)| f != s).unwrap(); return cards.find(ac).unwrap().cmp(&cards.find(bc).unwrap()); } a.0.cmp(&b.0) }); nums.iter() .enumerate() .map(|(i, v)| (i + 1) as i32 * v.1) .sum() } fn part2(lines: &[String]) -> i32 { let cards = "J23456789TQKA"; let mut nums = lines .iter() .map(|line| { let split = line.split(' ').collect::<Vec<&str>>(); let mut cnt = [0; 13]; split[0].chars().filter(|&x| x != 'J').for_each(|x| { cnt[cards.find(x).unwrap()] += 1; }); cnt.sort(); cnt.reverse(); let jokers = split[0].chars().map(|x| if x == 'J' { 1 } else { 0 }).sum(); let filtered = cnt.into_iter().filter(|&x| x != 0).collect::<Vec<i32>>(); let kind = match (jokers, &filtered[..]) { (0, [5]) | (5, []) | (1, [4]) | (4, [..]) | (3, [2]) | (2, [3]) => 6, (0, [4, ..]) | (1, [3, ..]) | (3, [1, ..]) | (2, [2, ..]) => 5, (0, [3, 2]) | (1, [2, 2]) => 4, (0, [3, ..]) | (1, [2, ..]) | (2, [1, ..]) => 3, (0, [2, 2, ..]) => 2, (0, [2, ..]) | (1, [1, ..]) => 1, _ => 0, }; (kind, split[1].parse::<i32>().unwrap(), split[0]) }) .collect::<Vec<(i32, i32, &str)>>(); nums.sort_by(|a, b| { if a.0 == b.0 { let (ac, bc) = a.2.chars().zip(b.2.chars()).find(|(f, s)| f != s).unwrap(); return cards.find(ac).unwrap().cmp(&cards.find(bc).unwrap()); } a.0.cmp(&b.0) }); nums.iter() .enumerate() .map(|(i, v)| (i + 1) as i32 * v.1) .sum() } fn main() { let mut lines = Vec::<String>::new(); let stdin = io::stdin(); for line in stdin.lines() { lines.push(line.unwrap()); } println!("{}", part1(&lines)); println!("{}", part2(&lines)); } --- 2023/rust/day8/Cargo.toml --- [package] name = "day8" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day8/src/main.rs --- use std::collections::HashMap; use std::io; fn gcd(mut a: usize, mut b: usize) -> usize { while a != b { if a > b { a -= b } else { b -= a } } a } fn part1(lines: &[String]) -> i32 { let mut m: HashMap<String, (String, String)> = HashMap::new(); lines.iter().skip(2).for_each(|l| { let split = l.split('=').collect::<Vec<&str>>(); let dests = split[1].split(',').collect::<Vec<&str>>(); m.insert( split[0].trim().to_owned(), ( dests[0].trim()[1..].to_string(), dests[1].trim()[..3].to_string(), ), ); }); let dirs = &lines[0]; let mut node = "AAA"; let mut i = 0; let mut size = 0; while node != "ZZZ" { node = if dirs.as_bytes()[i] == b'L' { &m[node].0 } else { &m[node].1 }; i = (i + 1) % dirs.len(); size += 1; } size } fn part2(lines: &[String]) -> usize { let mut m: HashMap<String, (String, String)> = HashMap::new(); lines.iter().skip(2).for_each(|l| { let split = l.split('=').collect::<Vec<&str>>(); let dests = split[1].split(',').collect::<Vec<&str>>(); m.insert( split[0].trim().to_owned(), ( dests[0].trim()[1..].to_string(), dests[1].trim()[..3].to_string(), ), ); }); let dirs = &lines[0]; m.iter() .filter(|(k, _)| k.as_bytes()[2] == b'A') .map(|(k, _)| { let mut i = 0; let mut size = 0; let mut node = k; while node.as_bytes()[2] != b'Z' { node = if dirs.as_bytes()[i] == b'L' { &m[node].0 } else { &m[node].1 }; i = (i + 1) % dirs.len(); size += 1; } size }) .fold(1_usize, |init, a| init * a / gcd(init, a)) } fn main() { let mut lines = Vec::<String>::new(); let stdin = io::stdin(); for line in stdin.lines() { lines.push(line.unwrap()); } println!("{}", part1(&lines)); println!("{}", part2(&lines)); } --- 2023/rust/day9/Cargo.toml --- [package] name = "day9" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] --- 2023/rust/day9/src/main.rs --- use std::io; fn part1(sequences: &[Vec<i32>]) -> i32 { sequences.iter().map(|v| v.last().unwrap()).sum::<i32>() } fn part2(sequences: &[Vec<i32>]) -> i32 { sequences .iter() .rev() .map(|v| v.first().unwrap()) .fold(0, |init, n| n - init) } fn main() { let mut part1_sum = 0; let mut part2_sum = 0; let stdin = io::stdin(); for line in stdin.lines() { let initial_seq: Vec<i32> = line .unwrap() .split(' ') .map(|s| s.parse::<i32>().unwrap()) .collect(); let mut sequences: Vec<Vec<i32>> = Vec::new(); sequences.push(initial_seq); loop { let s = &sequences.last().unwrap(); let mut prev = s[0]; let tmp: Vec<i32> = s .iter() .skip(1) .map(|&n| { let tmp = n - prev; prev = n; tmp }) .collect(); if tmp.iter().sum::<i32>() == 0 { break; } sequences.push(tmp); } part1_sum += part1(&sequences); part2_sum += part2(&sequences); } println!("{}", part1_sum); println!("{}", part2_sum); } --- README.md --- # advent-of-code Advent of Code Solutions in C++, Rust, Java, Kotlin, Swift and Mojo 🔥 --- .editorconfig --- # EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true [*] charset = utf-8 insert_final_newline = true [*.mojo] indent_style = space indent_size = 4 end_of_line = lf trim_trailing_whitespace = true max_line_length = 88 --- .github/ISSUE_TEMPLATE/bug-report.md --- --- name: Bug report about: Create a report to help us improve title: 'Bug report: [Insert statement here]' labels: 'bug' assignees: 'Moosems' --- **Describe the bug** A clear and concise description of what the bug is. **How to reproduce:** Describe the steps to reproduce the behavior. This should include code. File structure may also be important. **What should happen instead (expected behavior):** A clear and concise description of what you expected to happen. **Minimum reproducible example:** If possible, provide an MRE (Minimum Reproducible Example (https://stackoverflow.com/help/minimal-reproducible-example)). **Terminal output:** Please give your terminal output here: ```console Insert all commands and the output here ``` **System (please fill in the following information):** - OS: [Insert OS here] - Mojo Version: [insert mojo --version output here] **Additional context** Add any other context about the problem here. --- .github/ISSUE_TEMPLATE/feature-request.md --- --- name: Feature request about: Suggest an idea for this project title: 'Feature request: [Insert idea or proposal here]' labels: 'enhancement' assignees: 'Moosems' --- **Is this a proposed type/function or a code improvement suggestment?** [Insert answer here] **Describe the type/function/code improvement you would like to see:** [Insert answer here] **Are you willing to implement this yourself? If not, why is it worth spending time on?** [Insert answer here] **Additional context** Add any other context about the suggestion here. --- .github/workflows/package.yaml --- name: Package and release on: push: branches: - main jobs: run-tests: name: Release package runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Install modular run: | echo ${{ secrets.AUTH_TOKEN }} curl https://get.modular.com | MODULAR_AUTH=${{ secrets.AUTH_TOKEN }} sh - - name: Install Mojo run: modular install mojo - name: Add to PATH run: echo "/home/runner/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH - name: Create package run: mojo package types -o types.mojopkg - name: Upload package to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.TOKEN }} file: types.mojopkg tag: ${{ github.ref }} overwrite: true --- .github/workflows/run_tests.yaml --- name: Run Mojo tests on: push: branches: - "*" jobs: run-tests: name: Run tests runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Install modular run: | curl https://get.modular.com | MODULAR_AUTH=${{ secrets.AUTH_TOKEN }} sh - - name: Install Mojo run: modular install mojo - name: Add to PATH run: echo "/home/runner/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH - name: Run tests run: mojo tests.mojo --- LICENSE --- MIT License Copyright (c) 2023 Moosems Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Mojo-Types This repo contains some useful types and functions to use in Mojo. To use a type/function, simply copy the `types` folder and import it into your project. Documentation on each type can be found in the respective README of the folder. <br> Documentation should follow a style similar to that used in the official [Mojo Docs](https://docs.modular.com/mojo/). ## Contributing: To add a type/function: put it in its own folder which has a main file (same name as the folder) and a README containing documentation and open a PR. <br> To update docs: open a PR with your fixes and they will be reviewed shortly thereafter. ## Here are the types/functions currently in the repo: - ### `Array` (type) - ### `Matrix` (type) - ### `input()` (function) - ### `Pair` (type) - ### `DodgyString` (type) (found in `dodgy`) - ### `SetInt` (type) (found in `set`) --- tests.mojo --- # Import all test functions from test files from types.array.test_array import test_array from types.set.test_set_int import test_set from types.matrix.test_matrix import test_matrix from types.dodgy.test_dodgy import test_dodgy # Test basic imports from types import Array, DodgyString, input, Pair, SetInt, Matrix # Run tests fn main(): print("Starting tests") print("Basic imports succeeded") test_array() test_set() test_matrix() test_dodgy() print("Test complete") --- types/__init__.mojo --- from .array import Array from .dodgy import DodgyString from .input import input from .pair import Pair from .set import SetInt from .matrix import Matrix --- types/array/README.md --- # array *Module* <br> Implements the `Array`` struct. ### Purpose: This struct is used when you want to store a dynamic array of values. <br> This is NOT a Mojo builtin, so it needs to be imported <br> ## `Array` This section defines a special `Array` type. <br> It is a dynamic array that can hold any type. ### **Notes:** <br> Some types don't work as they should due to traits not being implemented yet, this requires some dodgy types to be added. <br> E.G. "candidate not viable: argument #1 cannot bind generic !mlirtype to memory-only type 'String'". <br> --- |Type|Status| |---|---| |`Int`|Works without dodgy types| |`FloatLiteral`|Works without dodgy types| |`Bool`|Works without dodgy types| |`Tuple`|Needs dodgy types (Not implemented yet)| |`String`|Needs dodgy types (Implemented as `DodgyString`)| ### **Parameters:** - T (`AnyType`): The elements ### **Fields:** - real_list (`Pointer[T]`): The actual list of elements - list_len (`Int`): The number of elements in the list - capacity (`Int`): The number of elements that can be stored in the list ### **Functions:** #### `__init__` > `fn __init__(inout self, default_value: T, capacity: Int = 10) -> None:` Constructs a new `Array` with a default value and a capacity. ##### **Args:** - default_value (`T`): The default value to fill the array with - capacity (`Int`): The initial capacity of the array ##### **Returns:** - `None` #### `__init__` > `fn __init__[*Ts: AnyType](inout self, owned given_list: ListLiteral[Ts]) -> None:` Constructs a new `Array` from a list literal. ##### **Args:** - given_list (`ListLiteral[Ts]`): The list literal to construct the array from ##### **Returns:** - `None` #### `__getitem__` > `fn __getitem__(borrowed self, i: Int) -> T:` Gets an element from the array. ##### **Args:** - i (`Int`): The index of the element to get ##### **Returns:** - `T`: The element at the given index #### `__setitem__` > `fn __setitem__(borrowed self, loc: Int, item: T):` Sets an element in the array. ##### **Args:** - loc (`Int`): The index of the element to set - item (`T`): The value to set the element to ##### **Returns:** - `None` #### `__del__` > `fn __del__(owned self):` Frees the memory used by the array. ##### **Args:** - `None` ##### **Returns:** - `None` #### `__len__` > `fn __len__(borrowed self) -> Int:` Gets the length of the array. ##### **Args:** - `None` ##### **Returns:** - `Int`: The length of the array #### `__copyinit__` > `fn __copyinit__(inout self, other: Self):` Copies the contents of another `Array` into this one. ##### **Args:** - other (`Self`): The `Array` to copy ##### **Returns:** - `None` #### `__moveinit__` > `fn __moveinit__(inout self, owned other: Self):` Moves the contents of another `Array` into this one. ##### **Args:** - other (`Self`): The `Array` to move ##### **Returns:** - `None` #### `push_back` > `fn push_back(inout self, item: T):` Adds an element to the end of the array. ##### **Args:** - item (`T`): The element to add ##### **Returns:** - `None` #### `append` > `fn append(inout self, item: T):` Adds an element to the end of the array (thin wrapper around `push_back`). ##### **Args:** - item (`T`): The element to add ##### **Returns:** - `None` #### `__iter__` > `fn __iter__(self) -> ListIterator[T]:` Gets an iterator for the array. ##### **Args:** - `None` ##### **Returns:** - `ListIterator[T]`: The iterator #### `apply_function` > `fn apply_function[T2: AnyType, func: fn(T) -> T2](owned self) -> Array[T2]:` Applies a function to every element in the array. ##### **Args:** - func (`fn(T) -> T2`): The function to apply ##### **Returns:** - `Array[T2]`: The new array with the function applied to every element #### `remove_at` > `fn remove_at(inout self, loc: Int):` Removes an element from the array. ##### **Args:** - loc (`Int`): The index of the element to remove ##### **Returns:** - `None` <br> ### **Example:** ```mojo from types import Array from types import DodgyString fn main(): let array_capacity = 5 let dodgystrings = Array[DodgyString](DodgyString("1"), array_capacity) fn str_to_int(str: DodgyString) -> Int: return str.to_string().to_int() let ints = dodgystrings.apply_function[Int, str_to_int]() let ints = Array[Int](1, array_capacity) let floats: Array[FloatLiteral] = [3.14, .3000000004] ``` --- types/array/__init__.mojo --- from .array import Array --- types/array/array.mojo --- from memory.unsafe import Pointer from memory.memory import memcpy struct Array[T: AnyType]: var real_list: Pointer[T] var list_len: Int var capacity: Int fn __init__(inout self, default_value: T, capacity: Int = 10) -> None: self.list_len = capacity if capacity > 0 else 1 self.capacity = self.list_len * 2 self.real_list = Pointer[T].alloc(self.capacity) for i in range(self.list_len): self[i] = default_value fn __init__[*Ts: AnyType](inout self, owned given_list: ListLiteral[Ts]) -> None: let given_list_len = len(given_list) self.list_len = 0 self.capacity = given_list_len * 2 self.real_list = Pointer[T].alloc(self.capacity) let src = Pointer.address_of(given_list).bitcast[T]() for i in range(given_list_len): self.push_back(src.load(i)) fn __getitem__(borrowed self, i: Int) -> T: if i >= self.list_len: print("Warning: you're trying to get an index out of bounds, memory violation") return self.real_list.load(0) return self.real_list.load(i) fn __setitem__(inout self, loc: Int, item: T) -> None: if loc > self.capacity: print("Warning: you're trying to set an index out of bounds, doing nothing") return if loc > self.list_len: let old_len = self.list_len self.list_len = loc + 1 for i in range(old_len, self.list_len): self.real_list.store(i, item) return self.real_list.store(loc, item) fn __del__(owned self) -> None: self.real_list.free() fn __len__(borrowed self) -> Int: return self.list_len fn __copyinit__(inout self, other: Self) -> None: self.list_len = other.list_len self.capacity = self.list_len * 2 self.real_list = Pointer[T].alloc(self.capacity) memcpy[T](self.real_list, other.real_list, self.list_len) fn __moveinit__(inout self, owned other: Self) -> None: self.real_list = other.real_list self.list_len = other.list_len self.capacity = other.capacity memcpy[T](self.real_list, other.real_list, self.list_len) fn push_back(inout self, item: T) -> None: # If list has grown beyond allocated capacity, allocate a new list if self.list_len >= self.capacity: let new_capacity = self.list_len + 1 let new_list = Pointer[T].alloc(new_capacity) memcpy(new_list, self.real_list, self.list_len) self.real_list.free() self.real_list = new_list self.capacity = new_capacity self.real_list.store(self.list_len, item) self.list_len += 1 fn append(inout self, item: T) -> None: self.push_back(item) fn __iter__(self) -> ListIterator[T]: return ListIterator[T](self.real_list, self.list_len) fn apply_function[T2: AnyType, func: fn(T) -> T2](owned self) -> Array[T2]: var result = Array[T2](func(self[0]), self.capacity) result.list_len = self.list_len for i in range(self.list_len): result[i] = func(self[i]) return result fn remove_at(inout self, loc: Int) -> None: if loc >= self.list_len: print("Warning: you're trying to remove an index out of bounds, doing nothing") return for i in range(loc, self.list_len - 1): self[i] = self[i + 1] self.list_len -= 1 struct ListIterator[T: AnyType]: var storage: Pointer[T] var offset: Int var max: Int fn __init__(inout self, storage: Pointer[T], max: Int): self.offset = 0 self.max = max self.storage = storage fn __len__(self) -> Int: return self.max - self.offset fn __next__(inout self) -> T: let ret = self.storage.load(self.offset) self.offset += 1 return ret --- types/array/test_array.mojo --- from .array import Array fn test_array() -> None: # Test basic usage var a = Array[Int](0, 10) for i in range(10): a[i] = i @noncapturing fn square(x: Int) -> Int: return x * x # Test function application let b = a.apply_function[Int, square]() for item in b: print(item) # Test lengths debug_assert(a.__len__() == b.__len__(), "Length should be the same") # Test usage of list var c: Array[Int] = [2, 5] for i in range(9): c.append(i) # Test item removal c.remove_at(5) debug_assert(c[5] == 4, "Item should be 6") debug_assert(c.__len__() == 10, "Should be ten long") # Test moveinit let d: Array[Int] = c^ # Test copyinit var e = d let f = e.apply_function[Int, square]() e[0] = 25 debug_assert(e[0] != f[0], "Values should not change in f") --- types/dodgy/README.md --- # dodgy *Module* <br> Implements the `DodgyString` struct (will include more dodgy types in the future). ## **Purpose:** This struct is used when you want to store a string in certain structs (e.g. `Array`). <br> This is NOT a Mojo builtin, so it needs to be imported <br> ## `DodgyString` This section defines a special `DodgyString` type. <br> It is a wrapper around `String` that allows it to be used in an `Array`. ### **Parameters:** - None ### **Fields:** - data (`Pointer[Int8]`): The actual string data - len (`Int`): The length of the string ### **Functions:** #### `__init__` > `fn __init__(str: StringLiteral) -> DodgyString:` Constructs a new `DodgyString` from a `StringLiteral`. ##### **Args:** - str (`StringLiteral`): The string literal to construct the `DodgyString` from ##### **Returns:** - `DodgyString`: The new `DodgyString` #### `init` > `fn __init__(str: String) -> DodgyString:` Constructs a new `DodgyString` from a `String` ##### **Args:** - str (`String`): The string to construct the `DodgyString` from ##### **Returns:** - `DodgyString`: The new `DodgyString` #### `to_string` > `fn to_string(self) -> String:` Converts the `DodgyString` to a `String`. ##### **Args:** - self (`DodgyString`): The `DodgyString` to convert ##### **Returns:** - `String`: The `String` representation of the `DodgyString` #### `to_string_ref` > `fn to_string_ref(self) -> StringRef:` Converts the `DodgyString` to a `StringRef`. ##### **Args:** - self (`DodgyString`): The `DodgyString` to convert ##### **Returns:** - `StringRef`: The `StringRef` representation of the `DodgyString` <br> ### **Example:** ```mojo from types import DodgyString fn main(): let dodgy = DodgyString("Hello, world!") let string = dodgy.to_string() print(string) ``` --- types/dodgy/__init__.mojo --- from .dodgy import DodgyString --- types/dodgy/dodgy.mojo --- from memory import memcpy, memset_zero @value @register_passable("trivial") struct DodgyString: var data: Pointer[Int8] var len: Int fn __init__(str: StringLiteral) -> DodgyString: let l = str.__len__() let s = String(str) let p = Pointer[Int8].alloc(l) for i in range(l): p.store(i, s._buffer[i]) return DodgyString(p, l) fn __init__(str: String) -> DodgyString: let l = str.__len__() let p = Pointer[Int8].alloc(l) for i in range(l): p.store(i, str._buffer[i]) return DodgyString(p, l) fn to_string(self) -> String: let ptr = Pointer[Int8]().alloc(self.len) memcpy(ptr, self.data, self.len) return String(ptr, self.len) fn to_string_ref(self) -> StringRef: let ptr = Pointer[Int8]().alloc(self.len + 1) memcpy(ptr, self.data.bitcast[Int8](), self.len) memset_zero(ptr.offset(self.len), 1) return StringRef( ptr.bitcast[__mlir_type.`!pop.scalar<si8>`]().address, self.len ) --- types/dodgy/test_dodgy.mojo --- from .dodgy import DodgyString fn test_dodgy() -> None: let x = DodgyString("Example") let y = DodgyString(String("Example")) --- types/input/README.md --- # input *Module* <br> Implements the `input` function. ### **Purpose:** This function is used when you want to get input from the user. <br> This is NOT a Mojo builtin, so it needs to be imported <br> ## `input` > `fn input(prompt: StringLiteral) -> String:` This section defines a special runtime `input` function. <br> It is a wrapper around the Python `input` function. ### **Parameters:** - prompt (`StringLiteral`): The prompt to display to the user ### **Returns:** - `String`: The user's input ## `input` > `fn input(prompt: String = String("")) -> String:` This section defines a special runtime `input` function. <br> It is a wrapper around the Python `input` function. ### **Parameters:** - prompt (`String`): The prompt to display to the user ### **Returns:** - `String`: The user's input ## `input` > `fn input[prompt: StringLiteral]() -> String:` This section defines a special compile-time `input` function. <br> It is a wrapper around the Python `input` function. ### **Parameters:** - prompt (`StringLiteral`): The prompt to display to the user ### **Returns:** - `String`: The user's input ## `input` > `fn input[prompt: String]() -> String:` This section defines a special compile-time `input` function. <br> It is a wrapper around the Python `input` function. ### **Parameters:** - prompt (`String`): The prompt to display to the user ### **Returns:** - `String`: The user's input <br> ### **Example:** ```mojo from types import input fn main(): let user_input: String = input("Enter something: ") print("You entered: " + user_input) let user_input2: String = input() print("You entered: " + user_input2) if user_input == user_input2: print("They're the same!") else: print("They're different!") ``` --- types/input/__init__.mojo --- from .input import input --- types/input/input.mojo --- from python import Python, PythonObject fn input(prompt: StringLiteral) -> String: try: let builtins = Python.import_module("builtins") let input_function = builtins.input let user_input: PythonObject = input_function(String(prompt)) return user_input.to_string() except: return String("") fn input(prompt: String = String("")) -> String: try: let builtins = Python.import_module("builtins") let input_function = builtins.input let user_input: PythonObject = input_function(prompt) return user_input.to_string() except: return String("") fn input[prompt: StringLiteral]() -> String: try: let builtins = Python.import_module("builtins") let input_function = builtins.input let user_input: PythonObject = input_function(String(prompt)) return user_input.to_string() except: return String("") fn input[prompt: String]() -> String: try: let builtins = Python.import_module("builtins") let input_function = builtins.input let user_input: PythonObject = input_function(prompt) return user_input.to_string() except: return String("") --- types/matrix/README.md --- # matrix *Module* <br> Implements the `Matrix` struct. ### **Purpose:** This struct is used when you want to store a 2D matrix of Float32 values. <br> This is NOT a Mojo builtin, so it needs to be imported <br> ## `Matrix` This section defines a special `Matrix` type. <br> It is a 2D matrix of values. **Notes: ** <br> The `Matrix` type is implemented as a single long `Pointer` that uses some simple math to manage memory. ### **Fields:** - data (`Pointer[Float32]`): The actual matrix of elements - height (`Int`): The height of the matrix - width (`Int`): The width of the matrix - total_items (`Int`): The total number of items in the matrix ### **Functions:** #### `__init__` > `fn __init__(inout self, owned default_value: Float32, height: Int, width: Int) -> None:` Constructs a new `Matrix` with a default value, height and width. ##### **Args:** - default_value (`Float32`): The default value to fill the matrix with - height (`Int`): The height of the matrix - width (`Int`): The width of the matrix ##### **Returns:** - `None` #### `__getitem__` > `fn __getitem__[row: Int, column: Int](borrowed self) -> Float32:` Gets an element from the matrix. ##### **Args:** - row (`Int`): The row of the element to get - column (`Int`): The column of the element to get ##### **Returns:** - `Float32`: The element at the given row and column #### `__setitem__` > `fn __setitem__[row: Int, column: Int](inout self, item: Float32) -> None:` Sets an element in the matrix. ##### **Args:** - row (`Int`): The row of the element to set - column (`Int`): The column of the element to set - item (`Float32`): The value to set the element to ##### **Returns:** - `None` #### `__del__` > `fn __del__(owned self) -> None:` Frees the memory used by the matrix. ##### **Returns:** - `None` #### `__len__` > `fn __len__(borrowed self) -> Int:` Gets the total number of items in the matrix. ##### **Returns:** - `Int`: The total number of items in the matrix #### `__copyinit__` > `fn __copyinit__(inout self, other: Self) -> None:` Copies the contents of another `Matrix` into this one. ##### **Args:** - other (`Self`): The `Matrix` to copy ##### **Returns:** - `None` #### `__moveinit__` > `fn __moveinit__(inout self, owned other: Self) -> None:` Moves the contents of another `Matrix` into this one. ##### **Args:** - other (`Self`): The `Matrix` to move ##### **Returns:** - `None` #### `__lt__` > `fn __lt__(borrowed self, rhs: Matrix) -> Bool:` Checks if this `Matrix` is less than another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to compare to ##### **Returns:** - `Bool`: Whether this `Matrix` is less than the other `Matrix` #### `__gt__` > `fn __gt__(borrowed self, rhs: Matrix) -> Bool:` Checks if this `Matrix` is greater than another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to compare to ##### **Returns:** - `Bool`: Whether this `Matrix` is greater than the other `Matrix` #### `__eq__` > `fn __eq__(borrowed self, rhs: Matrix) -> Bool:` Checks if this `Matrix` is equal to another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to compare to ##### **Returns:** - `Bool`: Whether this `Matrix` is equal to the other `Matrix` #### `__ne__` > `fn __ne__(borrowed self, rhs: Matrix) -> Bool:` Checks if this `Matrix` is not equal to another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to compare to ##### **Returns:** - `Bool`: Whether this `Matrix` is not equal to the other `Matrix` #### `__ge__` > `fn __ge__(borrowed self, rhs: Matrix) -> Bool:` Checks if this `Matrix` is greater than or equal to another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to compare to ##### **Returns:** - `Bool`: Whether this `Matrix` is greater than or equal to the other `Matrix` #### `__le__` > `fn __le__(borrowed self, rhs: Matrix) -> Bool:` Checks if this `Matrix` is less than or equal to another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to compare to ##### **Returns:** - `Bool`: Whether this `Matrix` is less than or equal to the other `Matrix` #### `__add__` > `fn __add__(borrowed self, rhs: Matrix) -> Matrix:` Adds this `Matrix` to another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to add to ##### **Returns:** - `Matrix`: The result of adding this `Matrix` to the other `Matrix` #### `__sub__` > `fn __sub__(borrowed self, rhs: Matrix) -> Matrix:` Subtracts another `Matrix` from this `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to subtract from this `Matrix` ##### **Returns:** - `Matrix`: The result of subtracting the other `Matrix` from this `Matrix` #### `__mul__` > `fn __mul__(borrowed self, rhs: Matrix) -> Matrix:` Multiplies this `Matrix` by another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to multiply by ##### **Returns:** - `Matrix`: The result of multiplying this `Matrix` by the other `Matrix` #### `__truediv__` > `fn __truediv__(borrowed self, rhs: Matrix) -> Matrix:` Divides this `Matrix` by another `Matrix`. ##### **Args:** - rhs (`Matrix`): The `Matrix` to divide by ##### **Returns:** - `Matrix`: The result of dividing this `Matrix` by the other `Matrix` #### `__add__` > `fn __add__(borrowed self, rhs: Float32) -> Matrix:` Adds a `Float32` to this `Matrix`. ##### **Args:** - rhs (`Float32`): The `Float32` to add to this `Matrix` ##### **Returns:** - `Matrix`: The result of adding the `Float32` to this `Matrix` #### `__sub__` > `fn __sub__(borrowed self, rhs: Float32) -> Matrix:` Subtracts a `Float32` from this `Matrix`. ##### **Args:** - rhs (`Float32`): The `Float32` to subtract from this `Matrix` ##### **Returns:** - `Matrix`: The result of subtracting the `Float32` from this `Matrix` #### `__mul__` > `fn __mul__(borrowed self, rhs: Float32) -> Matrix:` Multiplies this `Matrix` by a `Float32`. ##### **Args:** - rhs (`Float32`): The `Float32` to multiply this `Matrix` by ##### **Returns:** - `Matrix`: The result of multiplying this `Matrix` by the `Float32` #### `__truediv__` > `fn __truediv__(borrowed self, rhs: Float32) -> Matrix:` Divides this `Matrix` by a `Float32`. ##### **Args:** - rhs (`Float32`): The `Float32` to divide this `Matrix` by ##### **Returns:** - `Matrix`: The result of dividing this `Matrix` by the `Float32` #### `apply_function` > `fn apply_function[func: fn(Float32) -> Float32](borrowed self) -> Matrix:` Applies a function to this `Matrix`. ##### **Parameters:** - func (`fn(Float32) -> Float32`): The function to apply ##### **Returns:** - `Matrix`: The result of applying the function to this `Matrix` #### `print_all` > `fn print_all(borrowed self) -> None:` Prints the contents of the matrix to the console. ##### **Returns:** - `None` <br> ### **Example:** ```mojo from types import Matrix fn main(): var matrix = Matrix(Float32(0.0), 2, 3) @noncapturing fn add_one(num: Float32) -> Float32: return num + 1.0 matrix = matrix.apply_function[add_one]() matrix.print_all() ``` --- types/matrix/__init__.mojo --- from .matrix import Matrix --- types/matrix/matrix.mojo --- from memory.unsafe import Pointer struct Matrix: """Simple 2D Matrix that uses Float32.""" # Expects when doing math with other Matrices that they all have the same dimensions var data: Pointer[Float32] var height: Int var width: Int var total_items: Int fn __init__(inout self, owned default_value: Float32, height: Int, width: Int) -> None: self.height = height if height > 0 else 1 self.width = width if width > 0 else 1 self.total_items = self.height * self.width self.data = Pointer[Float32].alloc(self.total_items) for i in range(self.total_items): self.data.store(i, default_value) # fn __init__[*Ts: ListLiteral[Float32]](inout self, owned given_list: ListLiteral[Ts]) -> None: # self.height = given_list.__len__() # self.width = given_list.get[0, ListLiteral[Float32]]().__len__() # self.total_items = self.height * self.width # self.data = Pointer[Float32].alloc(self.total_items) # let lists = Pointer.address_of(given_list).bitcast[ListLiteral[Float32]]() # var current_loc = 0 # for i in range(self.height): # var current_list: ListLiteral[Float32] = lists.load(i) # let list_elems = Pointer.address_of(current_list).bitcast[Float32]() # for j in range(self.width): # self.data.store(current_loc, list_elems.load(j)) # current_loc += 1 fn __getitem__(borrowed self, row: Int, column: Int) -> Float32: let loc: Int = (row * self.width) + column if loc > self.total_items: print("Warning: you're trying to get an index out of bounds, memory violation") return self.data.load(0) return self.data.load(loc) fn __setitem__(inout self, row: Int, column: Int, item: Float32) -> None: let loc: Int = (row * self.width) + column if loc > self.total_items: print("Warning: you're trying to set an index out of bounds, doing nothing") return self.data.store(loc, item) fn __del__(owned self) -> None: self.data.free() fn __len__(borrowed self) -> Int: return self.total_items fn __copyinit__(inout self, other: Self) -> None: self.height = other.height self.width = other.width self.total_items = other.total_items self.data = Pointer[Float32].alloc(self.total_items) memcpy[Float32](self.data, other.data, self.total_items) fn __moveinit__(inout self, owned other: Self) -> None: self.height = other.height self.width = other.width self.total_items = other.total_items self.data = Pointer[Float32].alloc(self.total_items) memcpy[Float32](self.data, other.data, self.total_items) fn __lt__(borrowed self, rhs: Matrix) -> Bool: for i in range(self.height): for j in range(self.width): if self[i, j] < rhs[i, j]: return True return False fn __gt__(borrowed self, rhs: Matrix) -> Bool: for i in range(self.height): for j in range(self.width): if self[i, j] > rhs[i, j]: return True return False fn __eq__(borrowed self, rhs: Matrix) -> Bool: for i in range(self.height): for j in range(self.width): let self_val: Float32 = self[i, j] let rhs_val: Float32 = rhs[i, j] if self_val < rhs_val or self_val > rhs_val: return False return True fn __ne__(borrowed self, rhs: Matrix) -> Bool: return not self == rhs fn __ge__(borrowed self, rhs: Matrix) -> Bool: return self > rhs or self == rhs fn __le__(borrowed self, rhs: Matrix) -> Bool: return self < rhs or self == rhs fn __add__(borrowed self, rhs: Matrix) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = self[i, j] + rhs[i, j] return new_matrix fn __sub__(borrowed self, rhs: Matrix) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = self[i, j] - rhs[i, j] return new_matrix fn __mul__(borrowed self, rhs: Matrix) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = self[i, j] * rhs[i, j] return new_matrix fn __truediv__(borrowed self, rhs: Matrix) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = self[i, j] / rhs[i, j] return new_matrix fn __add__(borrowed self, rhs: Float32) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = self[i, j] + rhs return new_matrix fn __sub__(borrowed self, rhs: Float32) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = self[i, j] - rhs return new_matrix fn __mul__(borrowed self, rhs: Float32) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = self[i, j] * rhs return new_matrix fn __truediv__(borrowed self, rhs: Float32) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = self[i, j] / rhs return new_matrix fn apply_function[func: fn(Float32) -> Float32](borrowed self) -> Matrix: var new_matrix: Matrix = Matrix(Float32(0.0), self.height, self.width) for i in range(self.height): for j in range(self.width): new_matrix[i, j] = func(self[i, j]) return new_matrix fn print_all(borrowed self) -> None: print("[") for i in range(self.height): print_no_newline(" [") for j in range(self.width): print_no_newline(self[i, j]) if j != self.width - 1: print_no_newline(", ") print("]," if i != self.height - 1 else "]") print("]") --- types/matrix/test_matrix.mojo --- from .matrix import Matrix fn test_matrix() -> None: var test_matrix: Matrix = Matrix(Float32(3.14), 2, 2) test_matrix.print_all() let second_test_matrix: Matrix = Matrix(Float32(3.14), 2, 2) debug_assert(not test_matrix < second_test_matrix, "Should not be less") debug_assert(not test_matrix > second_test_matrix, "Should not be more") debug_assert(test_matrix == second_test_matrix, "Should be equal") debug_assert(not test_matrix != second_test_matrix, "Should not be not equal") debug_assert(test_matrix >= second_test_matrix, "Should be greater than or equal") debug_assert(test_matrix <= second_test_matrix, "Should be less than or equal") test_matrix[0, 0] = Float32(1.5) test_matrix[0, 1] = Float32(.33) test_matrix[1, 0] = Float32(6.5) test_matrix[1, 1] = Float32(2.5) debug_assert(test_matrix < second_test_matrix, "Should be less") debug_assert(not test_matrix > second_test_matrix, "Should not be more") debug_assert(not test_matrix == second_test_matrix, "Should not be equal") debug_assert(test_matrix != second_test_matrix, "Should be not equal") debug_assert(not test_matrix >= second_test_matrix, "Should not be greater than or equal") debug_assert(test_matrix <= second_test_matrix, "Should be less than or equal") # No more debug_asserts because its been pretty well tested let third_test_matrix: Matrix = test_matrix + second_test_matrix let fourth_test_matrix: Matrix = test_matrix - second_test_matrix let fifth_test_matrix: Matrix = test_matrix * second_test_matrix let sixth_test_matrix: Matrix = test_matrix / second_test_matrix let seventh_test_matrix: Matrix = test_matrix + Float32(1.0) let eighth_test_matrix: Matrix = test_matrix - Float32(1.0) let ninth_test_matrix: Matrix = test_matrix * Float32(1.0) let tenth_test_matrix: Matrix = test_matrix / Float32(1.0) @noncapturing fn test_func(x: Float32) -> Float32: return x * Float32(2.0) let eleventh_test_matrix: Matrix = test_matrix.apply_function[test_func]() # let second_test: Matrix[] = [[Float32(1.5), Float32(.33)], [Float32(6.5), Float32(2.5)]] --- types/pair/README.md --- # pair *Module* <br> Implements the `Pair` struct. ### **Purpose:** This struct is used when you want to store a pair of values. <br> This is NOT a Mojo builtin, so it needs to be imported <br> ## `Pair` This section defines a special `Pair` type. <br> It is a pair of two values. **Notes: ** <br> Some types don't work as they should due to traits not being implemented yet, this requires some dodgy types to be added. <br> E.G. "candidate not viable: argument #1 cannot bind generic !mlirtype to memory-only type 'String'". <br> --- |Type|Status| |---|---| |`Int`|Works without dodgy types| |`FloatLiteral`|Works without dodgy types| |`Bool`|Works without dodgy types| |`Tuple`|Works without dodgy types| |`String`|Needs dodgy types (Implemented as `DodgyString`)| ### **Parameters:** - T (`AnyType`): The first element - T2 (`AnyType`): The second element ### **Fields:** - inner_list (`ListLiteral[T, T2]`): The actual pair of elements ### **Functions:** #### `__init__` > `fn __init__(inout self, first: T, second: T2) -> None:` Constructs a new `Pair` with two values. ##### **Args:** - first (`T`): The first value - second (`T2`): The second value ##### **Returns:** - `None` #### `__copyinit__` > `fn __copyinit__(inout self, other: Self) -> None:` Copies the contents of another `Pair` into this one. ##### **Args:** - other (`Self`): The `Pair` to copy ##### **Returns:** - `None` #### `__getitem__` > `fn __getitem__[i: Int, T: AnyType](borrowed self) -> T:` Gets an element from the pair. ##### **Args:** - i (`Int`): The index of the element to get ##### **Returns:** - `T`: The element at the given index #### `apply_function` > `fn apply_function[T3: AnyType, T4: AnyType, func: fn(T, T2) -> ListLiteral[T3, T4]](owned self) -> Pair[T3, T4]:` Applies a function to the pair. ##### **Args:** - func (`fn(T, T2) -> ListLiteral[T3, T4]`): The function to apply ##### **Returns:** - `Pair[T3, T4]`: The new pair with the function applied to it <br> ### **Example:** ```mojo from types import Pair fn main(): let pair = Pair[Int, FloatLiteral](1, 3.14) @noncapturing fn add_one_and_two(num: Int, num2: FloatLiteral) -> ListLiteral[Int, FloatLiteral]: return ListLiteral[Int, FloatLiteral](num + 1, num2 + 2.0) let new_pair = pair.apply_function[Int, FloatLiteral, add_one_and_two]() ``` --- types/pair/__init__.mojo --- from .pair import Pair --- types/pair/pair.mojo --- struct Pair[T: AnyType, T2: AnyType]: var inner_list: ListLiteral[T, T2] fn __init__(inout self, first: T, second: T2) -> None: self.inner_list = ListLiteral[T, T2](first, second) fn __copyinit__(inout self, other: Self) -> None: self.inner_list = ListLiteral[T, T2](other.inner_list.get[0, T](), other.inner_list.get[1, T2]()) fn __getitem__[i: Int, T: AnyType](borrowed self) -> T: return self.inner_list.get[i, T]() fn apply_function[T3: AnyType, T4: AnyType, func: fn(T, T2) -> ListLiteral[T3, T4]](owned self) -> Pair[T3, T4]: let result = func(self.inner_list.get[0, T](), self.inner_list.get[1, T2]()) return Pair[T3, T4](result.get[0, T3](), result.get[1, T4]()) --- types/set/README.md --- # Set _Module_ Implements a very simple `SetInt` struct. ### Purpose: This struct is used when you want to store unique values (no duplicates), and you want to be able to check if a value exists in O(1) amortized time <br> This is NOT a Mojo builtin, so it needs to be imported <br> ### **Parameters:** - None ### **Fields:** - None ### **Functions:** #### `__init__` > `fn __init__(inout self) -> None:` Constructs a new `SetInt` with a default capacity (capacity_default = 10). ##### **Args:** - `None` ##### **Returns:** - `None` #### `__del__` > `fn __del__(owned self) -> None:` Destructs a `SetInt`. ##### **Args:** - `None` ##### **Returns:** - `None` #### `contains` > `fn contains(self, value: Int) -> Bool` Checks if value is already in `SetInt`. ##### **Args:** - value(`Int`): The value to check. ##### **Returns:** - `Bool`: True if value is in `SetInt`, False otherwise. #### `add` > `fn add(self, value: Int) -> None:` Add a value to `SetInt`. ##### **Args:** - value(`Int`): The value to add. ##### **Returns:** - `None` #### `remove` > `fn remove(self, value: Int) -> None:` Remove a value from `SetInt`. ##### **Args:** - value(`Int`): The unique value to remove. ##### **Returns:** - `None` #### `print_all` > `fn print_all(self) -> None:` Print all values in `SetInt`. ##### **Args:** - `None` ##### **Returns:** - `None` ### **Example:** ```mojo from types import SetInt fn main(): var set = SetInt() set.add(1) set.add(2) if set.contains(1): print("Set contains 1") set.remove(1) ``` --- types/set/__init__.mojo --- from .set_int import SetInt --- types/set/set_int.mojo --- from memory.unsafe import Pointer from memory import memcpy, memset_zero from math import abs struct SetInt: alias min_size = 10 var size: Int var _filled: Int var data: Pointer[Int] var flag_for_zero_value: Bool fn __init__(inout self): self.size = self.min_size self._filled = 0 self.flag_for_zero_value = False self.data = Pointer[Int].alloc(self.min_size) memset_zero(self.data, self.min_size) fn __init__(inout self, new_min_size: Int): self.size = new_min_size self._filled = 0 self.flag_for_zero_value = False self.data = Pointer[Int].alloc(self.min_size) memset_zero(self.data, self.min_size) fn __del__(owned self): self.data.free() fn __hash(self, value: Int) -> Int: return abs(value) % self.size fn __contains(self, value: Int) -> Int: if value == 0 and not self.flag_for_zero_value: return -1 for i in range(self.size): let index = (self.__hash(value) + i) % self.size if self.data[index] == value: return index return -1 fn contains(self, value: Int) -> Bool: return self.__contains(value) >= 0 fn add(inout self, value: Int): if value == 0: self.flag_for_zero_value = True return if not self.contains(value): self._filled += 1 for i in range(self.size): let index = (self.__hash(value) + i) % self.size if self.data[i] == 0: self.data.store(i, value) break self.__resize() fn remove(inout self, value: Int): let index = self.__contains(value) if index >= 0 and value == 0: self.flag_for_zero_value = False elif index >= 0: self._filled -= 1 for i in range(self.size): let index = (self.__hash(value) + i) % self.size if self.data[index] == value: self.data.store(index, 0) break self.__resize() fn __resize(inout self): # in the array we always want to have more space than the number of elements in the set to reduce collisions let capacity_ratio = self._filled / self.size # we first check the capacity ratio before resizing (So how many values we have in the array compared to the size of the array) # if the capacity ratio is less than the resize factor down (0.25) we reduce the size of the array if capacity_ratio < .25 and self.size // 2 >= self.min_size: self._resize_array(self.size // 2) # if the capacity ratio is more than the resize factor up (0.5) we increase the size of the array if capacity_ratio > 0.5: self._resize_array(self.size * 2 + 1) fn _resize_array(inout self, new_size: Int): let new_data = Pointer[Int].alloc(new_size) memset_zero(new_data, new_size) memcpy(new_data, self.data, self.size) self.data.free() self.data = new_data self.size = new_size fn print_all(self): print_no_newline("[") for i in range(self.size): if self.data[i] != 0: print_no_newline(self.data[i], ",") if self.flag_for_zero_value: print_no_newline(0, ",") print("]") --- types/set/test_set_int.mojo --- from .set_int import SetInt fn test_set(): var test = SetInt() for i in range(15, 20): test.add(i) for i in range(20): test.add(i) let filled = test._filled for i in range(20): test.add(i) debug_assert(filled != test._filled, "Hash function is not working correctly") var count = 0 for i in range(40): if test.contains(i): count += 1 print("Values where added correctly:", count == 20) test.print_all() for i in range(5, 10): test.remove(i) count = 0 for i in range(40): if test.contains(i): count += 1 print("Values were removed correctly:", count == 15) --- LICENSE --- MIT License Copyright (c) 2024 Carlos Oviedo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Mojo :fire: Language Syntax Highlighting for Vim ![alt text](syntax-example.png "Highlight Example") How to install -------------- Write this line in your vimrc: ``` Plug 'ovikrai/mojo-syntax' ``` --- ftdetect/mojo.vim --- autocmd BufRead,BufNewFile *.mojo,*.🔥 call s:set_mojo_filetype() function! s:set_mojo_filetype() abort if &filetype !=# 'mojo' set filetype=mojo endif endfunction --- indent/mojo.vim --- " include python indent file runtime indent/python.vim --- syntax/mojo.vim --- " Mojo syntax file for Vim " Based on: https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/mojo.vim " Quit when a syntax file was already loaded. if exists("b:current_syntax") finish endif " We need nocompatible mode in order to continue lines with backslashes. " Original setting will be restored. let s:cpo_save = &cpo set cpo&vim " These keywords are based on Python syntax highlight, and adds to it struct, " fn, alias, var, let " syn keyword mojoStatement False None True syn keyword mojoStatement as assert break continue del global syn keyword mojoStatement lambda nonlocal pass return with yield syn keyword mojoStatement class def nextgroup=mojoFunction skipwhite syn keyword mojoStatement struct fn trait nextgroup=mojoFunction skipwhite syn keyword mojoStatement alias var let syn keyword mojoStatement inout owned borrowed syn keyword mojoConditional elif else if syn keyword mojoRepeat for while syn keyword mojoOperator and in is not or syn keyword mojoException except finally raise try syn keyword mojoInclude from import self syn keyword mojoAsync async await syn keyword mojoModifier raises capturing escaping " Soft keywords " These keywords do not mean anything unless used in the right context. " See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords " for more on this. syn match mojoConditional "^\s*\zscase\%(\s\+.*:.*$\)\@=" syn match mojoConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@=" " Decorators " A dot must be allowed because of @MyClass.myfunc decorators. syn match mojoDecorator "@" display contained syn match mojoDecoratorName "@\s*\h\%(\w\|\.\)*" display contains=pythonDecorator " Python 3.5 introduced the use of the same symbol for matrix multiplication: " https://www.python.org/dev/peps/pep-0465/. We now have to exclude the " symbol from highlighting when used in that context. " Single line multiplication. syn match mojoMatrixMultiply \ "\%(\w\|[])]\)\s*@" \ contains=ALLBUT,mojoDecoratorName,mojoDecorator,mojoFunction,mojoDoctestValue \ transparent " Multiplication continued on the next line after backslash. syn match mojoMatrixMultiply \ "[^\\]\\\s*\n\%(\s*\.\.\.\s\)\=\s\+@" \ contains=ALLBUT,mojoDecoratorName,mojoDecorator,mojoFunction,mojoDoctestValue \ transparent " Multiplication in a parenthesized expression over multiple lines with @ at " the start of each continued line; very similar to decorators and complex. syn match mojoMatrixMultiply \ "^\s*\%(\%(>>>\|\.\.\.\)\s\+\)\=\zs\%(\h\|\%(\h\|[[(]\).\{-}\%(\w\|[])]\)\)\s*\n\%(\s*\.\.\.\s\)\=\s\+@\%(.\{-}\n\%(\s*\.\.\.\s\)\=\s\+@\)*" \ contains=ALLBUT,mojoDecoratorName,mojoDecorator,mojoFunction,mojoDoctestValue \ transparent syn match mojoFunction "\h\w*" display contained syn match mojoComment "#.*$" contains=mojoTodo,@Spell syn keyword mojoTodo FIXME NOTE NOTES TODO contained " Triple-quoted strings can contain doctests. syn region mojoString matchgroup=mojoQuotes \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1" \ contains=mojoEscape,@Spell syn region mojoString matchgroup=mojoTripleQuotes \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend \ contains=mojoEscape,mojoSpaceError,mojoDoctest,@Spell syn region mojoRawString matchgroup=mojoQuotes \ start=+[uU]\=[rR]\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1" \ contains=@Spell syn region mojoRawString matchgroup=pythonTripleQuotes \ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend \ contains=pythonSpaceError,mojoDoctest,@Spell syn match mojoEscape +\\[abfnrtv'"\\]+ contained syn match mojoEscape "\\\o\{1,3}" contained syn match mojoEscape "\\x\x\{2}" contained syn match mojoEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained " Python allows case-insensitive Unicode IDs: http://www.unicode.org/charts/ syn match mojoEscape "\\N{\a\+\%(\s\a\+\)*}" contained syn match mojoEscape "\\$" " It is very important to understand all details before changing the " regular expressions below or their order. " The word boundaries are *not* the floating-point number boundaries " because of a possible leading or trailing decimal point. " The expressions below ensure that all valid number literals are " highlighted, and invalid number literals are not. For example, " " - a decimal point in '4.' at the end of a line is highlighted, " - a second dot in 1.0.0 is not highlighted, " - 08 is not highlighted, " - 08e0 or 08j are highlighted, " " and so on, as specified in the 'Python Language Reference'. " https://docs.python.org/reference/lexical_analysis.html#numeric-literals " numbers (including complex) syn match mojoNumber "\<0[oO]\%(_\=\o\)\+\>" syn match mojoNumber "\<0[xX]\%(_\=\x\)\+\>" syn match mojoNumber "\<0[bB]\%(_\=[01]\)\+\>" syn match mojoNumber "\<\%([1-9]\%(_\=\d\)*\|0\+\%(_\=0\)*\)\>" syn match mojoNumber "\<\d\%(_\=\d\)*[jJ]\>" syn match mojoNumber "\<\d\%(_\=\d\)*[eE][+-]\=\d\%(_\=\d\)*[jJ]\=\>" syn match mojoNumber \ "\<\d\%(_\=\d\)*\.\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\%(\W\|$\)\@=" syn match mojoNumber \ "\%(^\|\W\)\zs\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\>" " The built-ins are added in the same order of appearance in Mojo stdlib docs " https://docs.modular.com/mojo/lib.html " " Built-in functions syn keyword mojoBuiltin slice constrained debug_assert put_new_line print syn keyword mojoBuiltin print_no_newline len range rebind element_type syn keyword mojoBuiltin ord chr atol isdigit index address string " Built-in types syn keyword mojoType Byte ListLiteral CoroutineContext Coroutine DType syn keyword mojoType dtype type invalid bool int8 si8 unit8 ui8 int16 syn keyword mojoType si16 unit16 ui16 int32 si32 uint32 ui32 int64 syn keyword mojoType si64 uint64 ui64 bfloat16 bf16 float16 f16 float32 syn keyword mojoType f32 float64 f64 Error FloatLiteral Int Attr SIMD syn keyword mojoType Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 syn keyword mojoType Float16 Float32 Float64 element_type _65x13_type syn keyword mojoType String StringLiteral StringRef Tuple AnyType syn keyword mojoType NoneType None Lifetime " avoid highlighting attributes as builtins syn match mojoAttribute /\.\h\w*/hs=s+1 \ contains=ALLBUT,mojoBuiltin,mojoFunction,mojoAsync \ transparent " From the 'Python Library Reference' class hierarchy at the bottom. " http://docs.python.org/library/exceptions.html " builtin base exceptions (used mostly as base classes for other exceptions) syn keyword mojoExceptions BaseException Exception syn keyword mojoExceptions ArithmeticError BufferError LookupError " builtin exceptions (actually raised) syn keyword mojoExceptions AssertionError AttributeError EOFError syn keyword mojoExceptions FloatingPointError GeneratorExit ImportError syn keyword mojoExceptions IndentationError IndexError KeyError syn keyword mojoExceptions KeyboardInterrupt MemoryError syn keyword mojoExceptions ModuleNotFoundError NameError syn keyword mojoExceptions NotImplementedError OSError OverflowError syn keyword mojoExceptions RecursionError ReferenceError RuntimeError syn keyword mojoExceptions StopAsyncIteration StopIteration SyntaxError syn keyword mojoExceptions SystemError SystemExit TabError TypeError syn keyword mojoExceptions UnboundLocalError UnicodeDecodeError syn keyword mojoExceptions UnicodeEncodeError UnicodeError syn keyword mojoExceptions UnicodeTranslateError ValueError syn keyword mojoExceptions ZeroDivisionError " builtin exception aliases for OSError syn keyword mojoExceptions EnvironmentError IOError WindowsError " builtin OS exceptions in Python 3 syn keyword mojoExceptions BlockingIOError BrokenPipeError syn keyword mojoExceptions ChildProcessError ConnectionAbortedError syn keyword mojoExceptions ConnectionError ConnectionRefusedError syn keyword mojoExceptions ConnectionResetError FileExistsError syn keyword mojoExceptions FileNotFoundError InterruptedError syn keyword mojoExceptions IsADirectoryError NotADirectoryError syn keyword mojoExceptions PermissionError ProcessLookupError TimeoutError " builtin warnings syn keyword mojoExceptions BytesWarning DeprecationWarning FutureWarning syn keyword mojoExceptions ImportWarning PendingDeprecationWarning syn keyword mojoExceptions ResourceWarning RuntimeWarning syn keyword mojoExceptions SyntaxWarning UnicodeWarning syn keyword mojoExceptions UserWarning Warning " trailing whitespace syn match mojoSpaceError display excludenl "\s\+$" " mixed tabs and spaces syn match mojoSpaceError display " \+\t" syn match mojoSpaceError display "\t\+ " " Do not spell doctests inside strings. " Notice that the end of a string, will end the contained " doctest too. Thus, we do *not* need to have it as an end pattern. syn region mojoDoctest \ start="^\s*>>>\s" end="^\s*$" \ contained contains=ALLBUT,mojoDoctest,mojoFunction,@Spell syn region mojoDoctestValue \ start=+^\s*\%(>>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$" \ contained syn region mojoDoctest \ start="^\s*>>>" end="^\s*$" \ contained contains=@NoSpell " Sync at the beginning of class, function, or method definition. syn sync match mojoSync grouphere NONE "^\%(def\|class\)\s\+\h\w*\s*[(:]" " The default highlight links. Can be overridden later. hi def link mojoStatement Statement hi def link mojoConditional Conditional hi def link mojoRepeat Repeat hi def link mojoOperator Operator hi def link mojoException Exception hi def link mojoInclude Include hi def link mojoAsync Statement hi def link mojoDecorator Define hi def link mojoDecoratorName Function hi def link mojoFunction Function hi def link mojoComment Comment hi def link mojoTodo Todo hi def link mojoString String hi def link mojoRawString String hi def link mojoQuotes String hi def link mojoTripleQuotes mojoQuotes hi def link mojoEscape Special hi def link mojoNumber Number hi def link mojoBuiltin Function hi def link mojoType Type hi def link mojoExceptions Structure hi def link mojoSpaceError Error hi def link mojoDoctest Special hi def link mojoDoctestValue Define hi def link mojoModifier Statement let b:current_syntax = "mojo" let &cpo = s:cpo_save unlet s:cpo_save --- LICENSE --- MIT License Copyright (c) 2023 rd4com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- > :heart: part of the effort for the community > https://github.com/Lynet101/Mojo_community-lib > ⚠️ Has not been tested, not to use as-is # some console styling ```python fn main(): var t=pp_() t["clr"] #clear screen t["fgblack"] t["bgwhite"] t | "mojo" t["fgwhite"] t["bgblack"] t | "rocks" t["reset"] t["fgred"] t["bold_on"] t["slow_blink"] t | "!!!" t["reset"] t() #newline t | "normal" ``` # doc > bg is background and fg is foreground > t | String(123) for numbers > t() for new line - reset *reset to default style* - clr *clear the screen* - bold_on - bold_off - italic_on - italic_off - underline_on - underline_off - slow_blink - fast_blink - blink_off - invert - fgblack - fgred - fgreen - fgyellow - fgblue - fgpurple - fgcyan - fgwhite - bgblack - bgred - bgreen - bgyellow - bgblue - bgpurple - bgcyan - bgwhite --- console-style.mojo --- struct pp_: fn __init__(inout self): _ = 1 fn __add__(self:Self,rhs:String): try: print_no_newline(rhs) except: print("bug") #@parameter fn __or__(self:Self,rhs:String): try: print_no_newline(rhs) except: print("bug") fn found(self,arg: String): print_no_newline(chr(27)) print_no_newline(arg) fn __getitem__(self:Self,arg:String): if arg == "reset": self.found("[0m") return if arg == "clr": self.found("[2J") return if arg == "bold_on": self.found("[1m") return if arg == "bold_off": self.found("[2m") return if arg == "italic_on": self.found("[3m") return if arg == "italic_off": self.found("[23m") return if arg == "underline_on": self.found("[4m") return if arg == "underline_off": self.found("[24m") return if arg == "slow_blink": self.found("[5m") return if arg == "fast_blink": self.found("[6m") return if arg == "blink_off": self.found("[25m") return if arg == "invert": self.found("[27m") return if arg == "fgblack": self.found("[0;30m") return if arg == "fgred": self.found("[0;31m") return if arg == "fgreen": self.found("[0;32m") return if arg == "fgyellow": self.found("[0;33m") return if arg == "fgblue": self.found("[0;34m") return if arg == "fgpurple": self.found("[0;35m") return if arg == "fgcyan": self.found("[0;36m") return if arg == "fgwhite": self.found("[0;37m") return if arg == "bgblack": self.found("[40m") return if arg == "bgred": self.found("[41m") return if arg == "bgreen": self.found("[42m") return if arg == "bgyellow": self.found("[43m") return if arg == "bgblue": self.found("[44m") return if arg == "bgpurple": self.found("[45m") return if arg == "bgcyan": self.found("[46m") return if arg == "bgwhite": self.found("[47m") return fn __call__(self:Self): print("") --- LICENSE --- MIT License Copyright (c) 2023 Maxim Zaks Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # mojo-trees Experimental Tree data structures in Mojo --- fiby_tree/__init__.mojo --- from .fiby_tree import FibyTree --- fiby_tree/fiby_tree.mojo --- from math.bit import bit_length from utils.list import VariadicList struct FibyTree[T: AnyType, cmp: fn(T, T) -> Int, to_str: fn(T) -> String]: alias Union = 0 alias Intersection = 1 alias Difference = 2 alias SymetricDifference = 3 alias OtherDifference = 4 alias IsDisjoint = 5 alias IsSubset = 6 alias IsSuperset = 7 var elements: DynamicVector[T] var left: DynamicVector[UInt16] var right: DynamicVector[UInt16] var deleted: Int var max_depth: UInt16 var balanced: Bool fn __init__(inout self, *elements: T): self.elements = DynamicVector[T]() self.left = DynamicVector[UInt16]() self.right = DynamicVector[UInt16]() self.deleted = 0 self.max_depth = 0 self.balanced = False let elements_list: VariadicList[T] = elements for i in range(len(elements_list)): self.add(elements[i]) fn __moveinit__(inout self, owned existing: Self): self.elements = existing.elements self.left = existing.left self.right = existing.right self.deleted = existing.deleted self.max_depth = existing.max_depth self.balanced = existing.balanced @always_inline("nodebug") fn has_left(self, parent: UInt16) -> Bool: return (self.left[parent.to_int()] != parent).__bool__() @always_inline("nodebug") fn has_right(self, parent: UInt16) -> Bool: return (self.right[parent.to_int()] != parent).__bool__() fn add(inout self, element: T): if self.__len__() == 0: self._set_root(element) self._set_max_depth(1) return var parent = 0 var depth: UInt16 = 1 while True: let diff = cmp(self.elements[parent], element) if diff == 0: return depth += 1 if diff > 0: let left = self.left[parent].to_int() if left == parent: self._add_left(parent, element) break else: parent = left else: let right = self.right[parent].to_int() if right == parent: self._add_right(parent, element) break else: parent = right self.balanced = False self._set_max_depth(depth) if self.max_depth > self._optimal_depth() ** 2: self.balance() @always_inline("nodebug") fn _set_max_depth(inout self, candidate: UInt16): if self.max_depth < candidate: self.max_depth = candidate fn _optimal_depth(self) -> UInt16: return bit_length(UInt16(self.__len__())) @always_inline("nodebug") fn _set_root(inout self, element: T): if len(self.elements) == 0: self.elements.push_back(element) self.left.push_back(0) self.right.push_back(0) else: self.elements[0] = element self.left[0] = 0 self.right[0] = 0 if self.deleted > 0: self.deleted -= 1 @always_inline("nodebug") fn _add_left(inout self, parent: UInt16, element: T): let index = len(self.elements) self.elements.push_back(element) self.left.push_back(index) self.right.push_back(index) self.left[parent.to_int()] = index @always_inline("nodebug") fn _add_right(inout self, parent: UInt16, element: T): let index = len(self.elements) self.elements.push_back(element) self.left.push_back(index) self.right.push_back(index) self.right[parent.to_int()] = index @always_inline("nodebug") fn delete(inout self, element: T) -> Bool: let index_tuple = self._get_index(element) let parent = index_tuple.get[0, Int]() let index = index_tuple.get[1, Int]() if index == -1: return False self.balanced = False if self._is_leaf(index): self._delete_leaf(index, parent) return True if self.has_left(index) and not self.has_right(index): if index == 0: let left = self.left[0] self.elements[0] = self.elements[left.to_int()] if self.has_left(left): self.left[0] = self.left[left.to_int()] else: self.left[0] = 0 if self.has_right(left): self.right[0] = self.right[left.to_int()] else: self.right[0] = 0 else: if self.left[parent] == index: self.left[parent] = self.left[index] else: self.right[parent] = self.left[index] self.deleted += 1 return True if self.has_right(index) and not self.has_left(index): if index == 0: let right = self.right[0] self.elements[0] = self.elements[right.to_int()] if self.has_left(right): self.left[0] = self.left[right.to_int()] else: self.left[0] = 0 if self.has_right(right): self.right[0] = self.right[right.to_int()] else: self.right[0] = 0 else: if self.left[parent] == index: self.left[parent] = self.right[index] else: self.right[parent] = self.right[index] self.deleted += 1 return True return self._swap_with_next_smaller_leaf(index) @always_inline("nodebug") fn sorted_elements(self) -> UnsafeFixedVector[T]: let number_of_elements = self.__len__() var result = UnsafeFixedVector[T](number_of_elements) if number_of_elements == 0: return result var stack = DynamicVector[UInt16](self.max_depth.to_int()) var current: UInt16 = 0 while len(result) < number_of_elements: if len(result) == 0 or cmp(result[len(result) - 1], self.elements[self.left[current.to_int()].to_int()]) < 0: while self.has_left(current): stack.push_back(current) current = self.left[current.to_int()] result.append(self.elements[current.to_int()]) if self.has_right(current): current = self.right[current.to_int()] else: current = stack.pop_back() return result fn clear(inout self): self.elements.clear() self.left.clear() self.right.clear() self.deleted = 0 self.max_depth = 0 self.balanced = False fn union(self, other: Self) -> Self: var result = Self() let combined: UnsafeFixedVector[T] if other.__len__() == 0: combined = self.sorted_elements() elif self.__len__() == 0: combined = other.sorted_elements() else: combined = self._combine[Self.Union](other) result._balance_with(combined) return result^ fn union_inplace(inout self, other: Self): if other.__len__() == 0: return if self.__len__() == 0: self._balance_with(other.sorted_elements()) return let combined = self._combine[Self.Union](other) self._balance_with(combined) fn intersection(self, other: Self) -> Self: var result = FibyTree[T, cmp, to_str]() if other.__len__() == 0: return result^ if self.__len__() == 0: return result^ let combined = self._combine[Self.Intersection](other) result._balance_with(combined) return result^ fn intersection_inplace(inout self, other: Self): if other.__len__() == 0: self.clear() return if self.__len__() == 0: self.clear() return let combined = self._combine[Self.Intersection](other) self._balance_with(combined) fn difference(self, other: Self) -> Self: var result = FibyTree[T, cmp, to_str]() let combined: UnsafeFixedVector[T] if other.__len__() == 0 or self.__len__() == 0: combined = self.sorted_elements() else: combined = self._combine[Self.Difference](other) result._balance_with(combined) return result^ fn difference_inplace(inout self, other: Self): if other.__len__() == 0 or self.__len__() == 0: return let combined = self._combine[Self.Difference](other) self._balance_with(combined) fn other_difference_inplace(inout self, other: Self): if other.__len__() == 0: self.clear() return if self.__len__() == 0: self._balance_with(other.sorted_elements()) return let combined = self._combine[Self.OtherDifference](other) self._balance_with(combined) fn symmetric_difference(self, other: Self) -> Self: var result = FibyTree[T, cmp, to_str]() let combined: UnsafeFixedVector[T] if other.__len__() == 0: combined = self.sorted_elements() elif self.__len__() == 0: combined = other.sorted_elements() else: combined = self._combine[Self.SymetricDifference](other) result._balance_with(combined) return result^ fn symmetric_difference_inplace(inout self, other: Self): if other.__len__() == 0: return if self.__len__() == 0: self._balance_with(other.sorted_elements()) return let combined = self._combine[Self.SymetricDifference](other) self._balance_with(combined) @always_inline("nodebug") fn _combine[type: Int](self, other: Self) -> UnsafeFixedVector[T]: let num1 = self.__len__() let num2 = other.__len__() # assert(num1 > 0) # assert(num2 > 0) var combined = UnsafeFixedVector[T](num1 + num2) var cur1: UInt16 = 0 var cur2: UInt16 = 0 var stack1 = DynamicVector[UInt16](self.max_depth.to_int()) var stack2 = DynamicVector[UInt16](other.max_depth.to_int()) var last_returned1 = UnsafeFixedVector[T](1) var last_returned2 = UnsafeFixedVector[T](1) var e1 = self._sorted_iter(cur1, stack1, last_returned1) last_returned1.append(e1) var e2 = other._sorted_iter(cur2, stack2, last_returned2) last_returned2.append(e2) var compute1 = False var compute2 = False var cursor1 = 1 var cursor2 = 1 var increase1 = False var increase2 = False while True: if compute1 and cursor1 < num1: e1 = self._sorted_iter(cur1, stack1, last_returned1) last_returned1.clear() last_returned1.append(e1) increase1 = True if compute2 and cursor2 < num2: e2 = other._sorted_iter(cur2, stack2, last_returned2) last_returned2.clear() last_returned2.append(e2) increase2 = True let diff = cmp(e1, e2) if diff < 0: if num1 == 1 and num2 == 1: @parameter if type == Self.Union or type == Self.Difference or type == Self.SymetricDifference: combined.append(e1) @parameter if type == Self.Union or type == Self.SymetricDifference or type == Self.OtherDifference: combined.append(e2) break if cursor1 < num1: @parameter if type == Self.Union or type == Self.Difference or type == Self.SymetricDifference: if len(combined) == 0 or cmp(combined[len(combined) - 1], e1) < 0: combined.append(e1) compute1 = cursor1 < num1 compute2 = False else: @parameter if type == Self.Union or type == Self.SymetricDifference or type == Self.OtherDifference: if len(combined) == 0 or cmp(combined[len(combined) - 1], e2) < 0: combined.append(e2) compute1 = False compute2 = cursor2 < num2 elif diff > 0: if num1 == 1 and num2 == 1: @parameter if type == Self.Union or type == Self.SymetricDifference or type == Self.OtherDifference: combined.append(e2) @parameter if type == Self.Union or type == Self.Difference or type == Self.SymetricDifference: combined.append(e1) break if cursor2 < num2: @parameter if type == Self.Union or type == Self.SymetricDifference or type == Self.OtherDifference: if len(combined) == 0 or cmp(combined[len(combined) - 1], e2) < 0: combined.append(e2) compute1 = False compute2 = cursor2 < num2 else: @parameter if type == Self.Union or type == Self.Difference or type == Self.SymetricDifference: if len(combined) == 0 or cmp(combined[len(combined) - 1], e1) < 0: combined.append(e1) compute1 = cursor1 < num1 compute2 = False else: @parameter if type == Self.Union or type == Self.Intersection: if len(combined) == 0 or cmp(combined[len(combined) - 1], e1) < 0: combined.append(e1) compute1 = cursor1 < num1 compute2 = cursor2 < num2 if increase1 and cursor1 < num1: cursor1 += 1 increase1 = False if increase2 and cursor2 < num2: cursor2 += 1 increase2 = False @parameter if type == Self.Intersection: if cursor1 >= num1 or cursor2 >= num2: break else: if cursor1 >= num1 and cursor2 >= num2: break return combined fn is_subset(self, other: Self) -> Bool: return self._check[Self.IsSubset](other) fn is_superset(self, other: Self) -> Bool: return self._check[Self.IsSuperset](other) fn is_disjoint(self, other: Self) -> Bool: return self._check[Self.IsDisjoint](other) @always_inline("nodebug") fn _check[type: Int](self, other: Self) -> Bool: let num1 = self.__len__() let num2 = other.__len__() @parameter if type == Self.IsSubset: if num1 == 0: return True if num1 > num2 or num2 == 0: return False @parameter if type == Self.IsSuperset: if num2 == 0: return True if num1 < num2 or num1 == 0: return False @parameter if type == Self.IsDisjoint: if num1 == 0 or num2 == 0: return True var cur1: UInt16 = 0 var cur2: UInt16 = 0 var stack1 = DynamicVector[UInt16](self.max_depth.to_int()) var stack2 = DynamicVector[UInt16](other.max_depth.to_int()) var last_returned1 = UnsafeFixedVector[T](1) var last_returned2 = UnsafeFixedVector[T](1) var e1 = self._sorted_iter(cur1, stack1, last_returned1) last_returned1.append(e1) var e2 = other._sorted_iter(cur2, stack2, last_returned2) last_returned2.append(e2) var compute1 = False var compute2 = False var cursor1 = 1 var cursor2 = 1 var increase1 = False var increase2 = False var num_eq = 0 while True: if compute1 and cursor1 < num1: e1 = self._sorted_iter(cur1, stack1, last_returned1) last_returned1.clear() last_returned1.append(e1) increase1 = True if compute2 and cursor2 < num2: e2 = other._sorted_iter(cur2, stack2, last_returned2) last_returned2.clear() last_returned2.append(e2) increase2 = True let diff = cmp(e1, e2) if diff == 0: @parameter if type == Self.IsDisjoint: return False compute1 = cursor1 < num1 compute2 = cursor2 < num2 num_eq += 1 else: if diff < 0: @parameter if type == Self.IsSubset: break compute1 = True compute2 = cursor1 >= num1 else: @parameter if type == Self.IsSuperset: break compute1 = cursor2 >= num2 compute2 = True if increase1 and cursor1 < num1: cursor1 += 1 increase1 = False if increase2 and cursor2 < num2: cursor2 += 1 increase2 = False if cursor1 >= num1 and cursor2 >= num2: break @parameter if type == Self.IsSuperset: return num_eq == num2 @parameter if type == Self.IsSubset: return num_eq == num1 @parameter if type == Self.IsDisjoint: return True return False @always_inline("nodebug") fn _sorted_iter(self, inout current: UInt16, inout stack: DynamicVector[UInt16], inout last_returned: UnsafeFixedVector[T]) -> T: # using UnsafeFixedVector[T](1) as poor mans Optional for last_returned if len(last_returned) == 0 or cmp(last_returned[0], self.elements[self.left[current.to_int()].to_int()]) < 0: while self.has_left(current): stack.push_back(current) current = self.left[current.to_int()] let result = self.elements[current.to_int()] if self.has_right(current): current = self.right[current.to_int()] else: current = stack.pop_back() return result @always_inline("nodebug") fn __len__(self) -> Int: return len(self.elements) - self.deleted @always_inline("nodebug") fn __contains__(self, element: T) -> Bool: return self._get_index(element).get[1, Int]() > -1 fn _get_index(self, element: T) -> (Int, Int): if self.__len__() == 0: return -1, -1 if self.balanced: return self._get_index_balanced(element) var parent = 0 var index = 0 while True: let diff = cmp(self.elements[index], element) if diff == 0: return parent, index if diff > 0: let left = self.left[index].to_int() if left == index: return index, -1 else: parent = index index = left else: let right = self.right[index].to_int() if right == index: return index, -1 else: parent = index index = right fn _get_index_balanced(self, element: T) -> (Int, Int): var parent = 0 var index = 0 let len = self.__len__() while index < len: let diff = cmp(element, self.elements[index]) if diff == 0: return parent, index parent = index index = (index + 1) * 2 + (diff >> 63) return parent, -1 fn min_index(self) -> Int: if self.__len__() < 2: return self.__len__() - 1 if self.balanced: return (1 << (self.max_depth.to_int() - 1)) - 1 var cand = self.left[0] while self.has_left(cand): cand = self.left[cand.to_int()] return cand.to_int() fn max_index(self) -> Int: let size = self.__len__() if size < 2: return size - 1 if self.balanced: if size == (1 << self.max_depth.to_int()) - 1: return size - 1 return (1 << (self.max_depth.to_int() - 1)) - 2 var cand = self.right[0] while self.has_right(cand): cand = self.right[cand.to_int()] return cand.to_int() fn _swap_with_next_smaller_leaf(inout self, index: UInt16) -> Bool: var parent = index var candidate = self.left[index.to_int()] if candidate == index: return False while True: if self._is_leaf(candidate): self.elements[index.to_int()] = self.elements[candidate.to_int()] self._delete_leaf(candidate.to_int(), parent.to_int()) return True let right = self.right[candidate.to_int()] if right == candidate: self.elements[index.to_int()] = self.elements[candidate.to_int()] self.right[parent.to_int()] = self.left[candidate.to_int()] self.deleted += 1 return True else: parent = candidate candidate = right @always_inline("nodebug") fn _is_leaf(self, index: UInt16) -> Bool: return (self.left[index.to_int()] == index).__bool__() and (self.right[index.to_int()] == index).__bool__() @always_inline("nodebug") fn _delete_leaf(inout self, index: Int, parent: Int): self.deleted += 1 if self.left[parent] == index: self.left[parent] = parent else: self.right[parent] = parent fn balance(inout self): if self.balanced: return let sorted_elements = self.sorted_elements() self._balance_with(sorted_elements) @always_inline("nodebug") fn _balance_with(inout self, sorted_elements: UnsafeFixedVector[T]): let new_size = len(sorted_elements) self.elements.resize(new_size) self.left.resize(new_size) self.right.resize(new_size) var i: Int = 0 self._eytzinger(i, 1, sorted_elements) for index in range(new_size): let l = (index + 1) * 2 - 1 let r = (index + 1) * 2 if l < self.__len__(): self.left[index] = l else: self.left[index] = index if r < self.__len__(): self.right[index] = r else: self.right[index] = index self.deleted = 0 self.balanced = True self.max_depth = self._optimal_depth() fn _eytzinger(inout self, inout i: Int, k: Int, v: UnsafeFixedVector[T]): if k <= len(v): self._eytzinger(i, k * 2, v) self.elements[k - 1] = v[i] i += 1 self._eytzinger(i, k * 2 + 1, v) fn print_tree(self, root: UInt16 = 0): if self.__len__() == 0: print("・") return self._print("", 0) fn _print(self, indentation: String, index: UInt16): if len(indentation) > 0: print(indentation, "-", to_str(self.elements[index.to_int()])) else: print("-", to_str(self.elements[index.to_int()])) if self.has_left(index): self._print(indentation + " ", self.left[index.to_int()]) elif self.has_right(index): print(indentation + " ", "- ・") if self.has_right(index): self._print(indentation + " ", self.right[index.to_int()]) --- fiby_tree_int_benchmarks.mojo --- from fiby_tree import FibyTree from time import now from random import random_si64 fn cmp_int(a: Int, b: Int) -> Int: return a - b fn its(a: Int) -> String: return String(a) fn fiby() -> FibyTree[Int, cmp_int, its]: return FibyTree[Int, cmp_int, its]() fn perf_test_random_add(size: Int, min: Int = -30000, max: Int = 30000) -> Float64: var total = 0 var tik = now() var tok = now() var f = fiby() for _ in range(size): let i = random_si64(min, max).to_int() tik = now() f.add(i) tok = now() total += (tok - tik) return total / size fn perf_test_ordered_add(size: Int) -> Float64: var total = 0 var tik = now() var f = fiby() var tok = now() total += tok - tik for i in range(size): tik = now() f.add(i) tok = now() total += (tok - tik) total += (tok - tik) return total / size fn perf_test_contains(size: Int, balanced: Bool, inout found: Int) -> Float64: var f = fiby() for _ in range(size): let i = random_si64(-size, size).to_int() f.add(i) if balanced: f.balance() var total = 0 var tik = now() var tok = now() var res = DynamicVector[Bool](size) for i in range(size): tik = now() let r = f.__contains__(i) tok = now() res.push_back(r) total += (tok - tik) var count = 0 for i in range(len(res)): if res[i]: count += 1 found = count return total / size fn perf_test_delete(size: Int, balanced: Bool, inout found: Int) -> Float64: var f = fiby() for _ in range(size): let i = random_si64(-size, size).to_int() f.add(i) if balanced: f.balance() var total = 0 var tik = now() var tok = now() var res = DynamicVector[Bool](size) for i in range(size): tik = now() let r = f.delete(i) tok = now() res.push_back(r) total += (tok - tik) var count = 0 for i in range(len(res)): if res[i]: count += 1 found = count return total / size fn perf_test_union(size: Int, balanced: Bool) -> Float64: var f1 = fiby() var f2 = fiby() for _ in range(size): let i1 = random_si64(-size, size).to_int() f1.add(i1) let i2 = random_si64(-size, size).to_int() f2.add(i2) if balanced: f1.balance() f2.balance() let s1 = f1.__len__() let s2 = f2.__len__() let tik = now() f1.union_inplace(f2) let tok = now() # print(s1, s2, f1.__len__()) return (tok - tik) / Float64(size) fn perf_test_intersection(size: Int, balanced: Bool) -> Float64: var f1 = fiby() var f2 = fiby() for _ in range(size): let i1 = random_si64(-size, size).to_int() f1.add(i1) let i2 = random_si64(-size, size).to_int() f2.add(i2) if balanced: f1.balance() f2.balance() let s1 = f1.__len__() let s2 = f2.__len__() let tik = now() f1.intersection_inplace(f2) let tok = now() # print(s1, s2, f1.__len__()) return (tok - tik) / Float64(size) fn perf_test_difference(size: Int, balanced: Bool) -> Float64: var f1 = fiby() var f2 = fiby() for _ in range(size): let i1 = random_si64(-size, size).to_int() f1.add(i1) let i2 = random_si64(-size, size).to_int() f2.add(i2) if balanced: f1.balance() f2.balance() let s1 = f1.__len__() let s2 = f2.__len__() let tik = now() f1.difference_inplace(f2) let tok = now() # print(s1, s2, f1.__len__()) return (tok - tik) / Float64(size) fn perf_test_symmetric_difference(size: Int, balanced: Bool) -> Float64: var f1 = fiby() var f2 = fiby() for _ in range(size): let i1 = random_si64(-size, size).to_int() f1.add(i1) let i2 = random_si64(-size, size).to_int() f2.add(i2) if balanced: f1.balance() f2.balance() let s1 = f1.__len__() let s2 = f2.__len__() let tik = now() f1.symmetric_difference_inplace(f2) let tok = now() # print(s1, s2, f1.__len__()) return (tok - tik) / Float64(size) fn main(): print("===Random Add===") print(perf_test_random_add(10)) print(perf_test_random_add(100)) print(perf_test_random_add(300)) print(perf_test_random_add(500)) print(perf_test_random_add(1_000)) print(perf_test_random_add(3_000)) print(perf_test_random_add(9_000)) print(perf_test_random_add(15_000)) print(perf_test_random_add(30_000)) print(perf_test_random_add(50_000)) print("===Ordered Add===") print(perf_test_ordered_add(10)) print(perf_test_ordered_add(100)) print(perf_test_ordered_add(300)) print(perf_test_ordered_add(500)) print(perf_test_ordered_add(1_000)) print(perf_test_ordered_add(3_000)) print(perf_test_ordered_add(9_000)) print(perf_test_ordered_add(15_000)) print(perf_test_ordered_add(30_000)) print(perf_test_ordered_add(50_000)) var r = 0 print("===Contains===") print(perf_test_contains(10, False, r)) print(perf_test_contains(100, False, r)) print(perf_test_contains(300, False, r)) print(perf_test_contains(500, False, r)) print(perf_test_contains(1_000, False, r)) print(perf_test_contains(3_000, False, r)) print(perf_test_contains(9_000, False, r)) print(perf_test_contains(15_000, False, r)) print(perf_test_contains(30_000, False, r)) print(perf_test_contains(50_000, False, r)) print("===Contains Balanced===") print(perf_test_contains(10, True, r)) print(perf_test_contains(100, True, r)) print(perf_test_contains(300, True, r)) print(perf_test_contains(500, True, r)) print(perf_test_contains(1_000, True, r)) print(perf_test_contains(3_000, True, r)) print(perf_test_contains(9_000, True, r)) print(perf_test_contains(15_000, True, r)) print(perf_test_contains(30_000, True, r)) print(perf_test_contains(50_000, True, r)) print("===Delete===") print(perf_test_delete(10, False, r)) print(perf_test_delete(100, False, r)) print(perf_test_delete(300, False, r)) print(perf_test_delete(500, False, r)) print(perf_test_delete(1_000, False, r)) print(perf_test_delete(3_000, False, r)) print(perf_test_delete(9_000, False, r)) print(perf_test_delete(15_000, False, r)) print(perf_test_delete(30_000, False, r)) print(perf_test_delete(50_000, False, r)) print("===Delete Balanced===") print(perf_test_delete(10, True, r)) print(perf_test_delete(100, True, r)) print(perf_test_delete(300, True, r)) print(perf_test_delete(500, True, r)) print(perf_test_delete(1_000, True, r)) print(perf_test_delete(3_000, True, r)) print(perf_test_delete(9_000, True, r)) print(perf_test_delete(15_000, True, r)) print(perf_test_delete(30_000, True, r)) print(perf_test_delete(50_000, True, r)) print("===Union===") print(perf_test_union(10, False)) print(perf_test_union(100, False)) print(perf_test_union(300, False)) print(perf_test_union(500, False)) print(perf_test_union(1_000, False)) print(perf_test_union(3_000, False)) print(perf_test_union(9_000, False)) print(perf_test_union(15_000, False)) print(perf_test_union(30_000, False)) print(perf_test_union(50_000, False)) print("===Union Balanced===") print(perf_test_union(10, True)) print(perf_test_union(100, True)) print(perf_test_union(300, True)) print(perf_test_union(500, True)) print(perf_test_union(1_000, True)) print(perf_test_union(3_000, True)) print(perf_test_union(9_000, True)) print(perf_test_union(15_000, True)) print(perf_test_union(30_000, True)) print(perf_test_union(50_000, True)) print("===Intersection===") print(perf_test_intersection(10, False)) print(perf_test_intersection(100, False)) print(perf_test_intersection(300, False)) print(perf_test_intersection(500, False)) print(perf_test_intersection(1_000, False)) print(perf_test_intersection(3_000, False)) print(perf_test_intersection(9_000, False)) print(perf_test_intersection(15_000, False)) print(perf_test_intersection(30_000, False)) print(perf_test_intersection(50_000, False)) print("===Intersection Balanced===") print(perf_test_intersection(10, True)) print(perf_test_intersection(100, True)) print(perf_test_intersection(300, True)) print(perf_test_intersection(500, True)) print(perf_test_intersection(1_000, True)) print(perf_test_intersection(3_000, True)) print(perf_test_intersection(9_000, True)) print(perf_test_intersection(15_000, True)) print(perf_test_intersection(30_000, True)) print(perf_test_intersection(50_000, True)) print("===Difference===") print(perf_test_difference(10, False)) print(perf_test_difference(100, False)) print(perf_test_difference(300, False)) print(perf_test_difference(500, False)) print(perf_test_difference(1_000, False)) print(perf_test_difference(3_000, False)) print(perf_test_difference(9_000, False)) print(perf_test_difference(15_000, False)) print(perf_test_difference(30_000, False)) print(perf_test_difference(50_000, False)) print("===Difference Balanced===") print(perf_test_difference(10, True)) print(perf_test_difference(100, True)) print(perf_test_difference(300, True)) print(perf_test_difference(500, True)) print(perf_test_difference(1_000, True)) print(perf_test_difference(3_000, True)) print(perf_test_difference(9_000, True)) print(perf_test_difference(15_000, True)) print(perf_test_difference(30_000, True)) print(perf_test_difference(50_000, True)) print("===Symmetric Difference===") print(perf_test_symmetric_difference(10, False)) print(perf_test_symmetric_difference(100, False)) print(perf_test_symmetric_difference(300, False)) print(perf_test_symmetric_difference(500, False)) print(perf_test_symmetric_difference(1_000, False)) print(perf_test_symmetric_difference(3_000, False)) print(perf_test_symmetric_difference(9_000, False)) print(perf_test_symmetric_difference(15_000, False)) print(perf_test_symmetric_difference(30_000, False)) print(perf_test_symmetric_difference(50_000, False)) print("===Symmetric Difference Balanced===") print(perf_test_symmetric_difference(10, True)) print(perf_test_symmetric_difference(100, True)) print(perf_test_symmetric_difference(300, True)) print(perf_test_symmetric_difference(500, True)) print(perf_test_symmetric_difference(1_000, True)) print(perf_test_symmetric_difference(3_000, True)) print(perf_test_symmetric_difference(9_000, True)) print(perf_test_symmetric_difference(15_000, True)) print(perf_test_symmetric_difference(30_000, True)) print(perf_test_symmetric_difference(50_000, True)) --- fiby_tree_int_tests.mojo --- from testing import * from fiby_tree import FibyTree fn int_eq(a: Int, b: Int) -> Bool: return a == b fn int_cmp(a: Int, b: Int) -> Int: return a - b fn int_to_str(a: Int) -> String: return String(a) fn assert_vec(a: UnsafeFixedVector[Int], b: UnsafeFixedVector[Int]): if assert_equal(len(a), len(b)): for i in range(len(a)): _ = assert_equal(a[i], b[i]) else: print("Length", len(a), "is not equal to", len(b)) fn vec[T: AnyType](*elements: T) -> UnsafeFixedVector[T]: let elements_list: VariadicList[T] = elements var result = UnsafeFixedVector[T](len(elements_list)) for i in range(len(elements_list)): result.append(elements[i]) return result fn fiby(*elements: Int) -> FibyTree[Int, int_cmp, int_to_str]: let elements_list: VariadicList[Int] = elements var tree = FibyTree[Int, int_cmp, int_to_str]() for i in range(len(elements_list)): tree.add(elements[i]) return tree^ fn assert_tree(tree: FibyTree[Int, int_cmp, int_to_str], count: Int, max_depth: Int): if not assert_equal(tree.__len__(), count): print("Length assertion failed") if not assert_equal(tree.max_depth, max_depth): print("depth assertion failed") fn test_start_with_empty_tree(): var bst = fiby() assert_tree(bst, 0, 0) bst.add(13) assert_tree(bst, 1, 1) bst.add(15) assert_tree(bst, 2, 2) _= assert_true(bst.delete(13)) assert_tree(bst, 1, 2) _= assert_true(bst.delete(15)) assert_tree(bst, 0, 2) _= assert_false(bst.__contains__(15)) bst.balance() assert_tree(bst, 0, 0) fn test_longer_sequence_dedup_and_balance(): var bst = fiby(5, 6, 3, 8, 11, 34, 56, 12, 48, 11, 9) assert_vec(bst.sorted_elements(), vec(3, 5, 6, 8, 9, 11, 12, 34, 48, 56)) assert_tree(bst, 10, 7) bst.balance() assert_tree(bst, 10, 4) _= assert_true(bst.delete(8)) assert_vec(bst.sorted_elements(), vec(3, 5, 6, 9, 11, 12, 34, 48, 56)) assert_tree(bst, 9, 4) let elements = bst.sorted_elements() for i in range(len(elements)): _= assert_true(bst.delete(elements[i])) assert_tree(bst, 0, 4) bst.add(13) assert_tree(bst, 1, 4) bst.clear() assert_tree(bst, 0, 0) fn test_add_ascending(): var bst = fiby() for i in range(10): bst.add(i) assert_vec(bst.sorted_elements(), vec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) assert_tree(bst, 10, 10) bst.balance() assert_tree(bst, 10, 4) for i in range(10): _= assert_true(bst.__contains__(i)) fn test_union_inplace(): var b1 = fiby(1, 2, 3) b1.union_inplace(fiby()) assert_vec(b1.sorted_elements(), vec(1, 2, 3)) var b2 = fiby() b2.union_inplace(b1) assert_vec(b2.sorted_elements(), vec(1, 2, 3)) b1.union_inplace(fiby(3, 4, 1)) assert_vec(b1.sorted_elements(), vec(1, 2, 3, 4)) b1.union_inplace(fiby(2, 3)) assert_vec(b1.sorted_elements(), vec(1, 2, 3, 4)) b1.union_inplace(fiby(9, 12, 11, 10)) assert_vec(b1.sorted_elements(), vec(1, 2, 3, 4, 9, 10, 11, 12)) b2 = fiby(1) b2.union_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec(1)) b2.union_inplace(fiby(2)) assert_vec(b2.sorted_elements(), vec(1, 2)) b2 = fiby(2) b2.union_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec(1, 2)) fn test_union(): var b1 = fiby(1, 2, 3) var b3 = b1.union(fiby()) assert_vec(b3.sorted_elements(), vec(1, 2, 3)) var b2 = fiby() b3 = b2.union(b1) assert_vec(b3.sorted_elements(), vec(1, 2, 3)) b3 = b1.union(fiby(3, 4, 1)) assert_vec(b3.sorted_elements(), vec(1, 2, 3, 4)) b3 = b1.union(fiby(2, 3)) assert_vec(b3.sorted_elements(), vec(1, 2, 3, 4)) b3 = b1.union(fiby(9, 12, 11, 10)) assert_vec(b3.sorted_elements(), vec(1, 2, 3, 4, 9, 10, 11, 12)) b2 = fiby(1) b3 = b2.union(fiby(1)) assert_vec(b3.sorted_elements(), vec(1)) b2.union_inplace(fiby(2)) assert_vec(b2.sorted_elements(), vec(1, 2)) b2 = fiby(2) b2.union_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec(1, 2)) fn test_intersection_inplace(): var b1 = fiby(1, 2, 3) b1.intersection_inplace(fiby(3, 4, 1, 6, 7, 10)) assert_vec(b1.sorted_elements(), vec(1, 3)) b1.intersection_inplace(fiby()) assert_vec(b1.sorted_elements(), vec[Int]()) b1.intersection_inplace(fiby(3, 4, 1)) assert_vec(b1.sorted_elements(), vec[Int]()) var b2 = fiby(3, 4, 1, 6, 7, 10) b2.intersection_inplace(fiby(1, 2, 3, 8)) assert_vec(b2.sorted_elements(), vec(1, 3)) b2 = fiby(1) b2.intersection_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec(1)) b2 = fiby(1) b2.intersection_inplace(fiby(2)) assert_vec(b2.sorted_elements(), vec[Int]()) b2 = fiby(2) b2.intersection_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec[Int]()) fn test_difference_inplace(): var b1 = fiby(1, 2, 3) b1.difference_inplace(fiby(5, 6, 7, 1)) assert_vec(b1.sorted_elements(), vec(2, 3)) b1.difference_inplace(fiby()) assert_vec(b1.sorted_elements(), vec(2, 3)) b1.difference_inplace(fiby(1, 12, 34)) assert_vec(b1.sorted_elements(), vec(2, 3)) var b2 = fiby() b2.difference_inplace(fiby(1, 2, 3)) assert_tree(b2, 0, 0) b2 = fiby(1) b2.difference_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec[Int]()) b2 = fiby(1) b2.difference_inplace(fiby(2)) assert_vec(b2.sorted_elements(), vec(1)) b2 = fiby(2) b2.difference_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec(2)) fn test_other_difference_inplace(): var b1 = fiby(1, 2, 3) b1.other_difference_inplace(fiby(5, 6, 7, 1)) assert_vec(b1.sorted_elements(), vec(5, 6, 7)) b1.other_difference_inplace(fiby()) assert_vec(b1.sorted_elements(), vec[Int]()) b1 = fiby(1, 2, 3) b1.other_difference_inplace(fiby(0, 1, 12, 34)) assert_vec(b1.sorted_elements(), vec(0, 12, 34)) var b2 = fiby() b2.other_difference_inplace(fiby(1, 2, 3)) assert_vec(b2.sorted_elements(), vec(1, 2, 3)) b2 = fiby(1) b2.other_difference_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec[Int]()) b2 = fiby(1) b2.other_difference_inplace(fiby(2)) assert_vec(b2.sorted_elements(), vec(2)) b2 = fiby(2) b2.other_difference_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec(1)) fn test_symmetric_difference_inplace(): var b1 = fiby(1, 2, 3) b1.symmetric_difference_inplace(fiby(3, 4, 5)) assert_vec(b1.sorted_elements(), vec(1, 2, 4, 5)) b1.symmetric_difference_inplace(fiby(0, 2, 8, 5, 13)) assert_vec(b1.sorted_elements(), vec(0, 1, 4, 8, 13)) b1.symmetric_difference_inplace(fiby()) assert_vec(b1.sorted_elements(), vec(0, 1, 4, 8, 13)) var b2 = fiby() b2.symmetric_difference_inplace(fiby(1, 2, 3)) assert_vec(b2.sorted_elements(), vec(1, 2, 3)) b2 = fiby() b2.symmetric_difference_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec(1)) b2 = fiby(1) b2.symmetric_difference_inplace(fiby()) assert_vec(b2.sorted_elements(), vec(1)) b2 = fiby(1) b2.symmetric_difference_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec[Int]()) b2 = fiby(1) b2.symmetric_difference_inplace(fiby(2)) assert_vec(b2.sorted_elements(), vec(1, 2)) b2 = fiby(2) b2.symmetric_difference_inplace(fiby(1)) assert_vec(b2.sorted_elements(), vec(1, 2)) fn test_disjoint(): _= assert_true(fiby().is_disjoint(fiby())) _= assert_true(fiby().is_disjoint(fiby(1))) _= assert_true(fiby(1).is_disjoint(fiby())) _= assert_true(fiby(1).is_disjoint(fiby(2))) _= assert_false(fiby(1).is_disjoint(fiby(1))) _= assert_true(fiby(1, 3).is_disjoint(fiby(2, 5, 6))) _= assert_true(fiby(1, 3, 5).is_disjoint(fiby(2, 0, 7))) _= assert_false(fiby(1, 3, 5).is_disjoint(fiby(2, 5))) _= assert_false(fiby(1, 5).is_disjoint(fiby(2, 5))) fn test_subset(): _= assert_true(fiby().is_subset(fiby())) _= assert_true(fiby().is_subset(fiby(1, 2, 3))) _= assert_true(fiby(3).is_subset(fiby(3))) _= assert_true(fiby(3).is_subset(fiby(1, 2, 3))) _= assert_true(fiby(3, 1).is_subset(fiby(1, 2, 3))) _= assert_true(fiby(3, 1, 2).is_subset(fiby(1, 2, 3))) _= assert_false(fiby(1).is_subset(fiby(3))) _= assert_false(fiby(3, 1, 2, 5).is_subset(fiby(1, 2, 3))) _= assert_false(fiby(3, 1, 5).is_subset(fiby(1, 2, 3))) fn test_superset(): _= assert_false(fiby(1).is_superset(fiby(2))) _= assert_false(fiby(1, 5, 8).is_superset(fiby(1, 5, 8, 9))) _= assert_false(fiby(1, 5, 8).is_superset(fiby(1, 5, 9))) _= assert_true(fiby().is_superset(fiby())) _= assert_true(fiby(1).is_superset(fiby(1))) _= assert_true(fiby(1, 5, 8, 9).is_superset(fiby(1, 5, 8, 9))) _= assert_true(fiby(1, 5, 8, 9).is_superset(fiby(1, 5, 8))) _= assert_true(fiby(0, 1, 5, 8, 9).is_superset(fiby(1, 5, 8))) fn test_min_index(): _= assert_equal(fiby().min_index(), -1) _= assert_equal(fiby(1).min_index(), 0) _= assert_equal(fiby(1, 2, 3, 4).min_index(), 0) _= assert_equal(fiby(3, 4, 1, 2).min_index(), 2) var f = fiby(3, 4, 1, 2) f.balance() _= assert_equal(f.min_index(), 3) f = fiby(1, 3, 2, 4, 5) _= assert_equal(f.min_index(), 0) f = fiby(3, 1, 2, 4, 5) _= assert_equal(f.min_index(), 1) f = fiby(3, 2, 1, 4, 5) _= assert_equal(f.min_index(), 2) f = fiby(3, 2, 4, 1, 5) _= assert_equal(f.min_index(), 3) f = fiby(3, 2, 4, 5, 1) _= assert_equal(f.min_index(), 4) f = fiby(1, 3, 2, 4, 5) f.balance() _= assert_equal(f.min_index(), 3) f = fiby(3, 1, 2, 4, 5) f.balance() _= assert_equal(f.min_index(), 3) f = fiby(3, 2, 1, 4, 5) f.balance() _= assert_equal(f.min_index(), 3) f = fiby(3, 2, 4, 1, 5) f.balance() _= assert_equal(f.min_index(), 3) f = fiby(3, 2, 4, 5, 1) f.balance() _= assert_equal(f.min_index(), 3) fn test_max_index(): _= assert_equal(fiby().max_index(), -1) _= assert_equal(fiby(1).max_index(), 0) _= assert_equal(fiby(1, 2, 3, 4).max_index(), 3) _= assert_equal(fiby(3, 4, 1, 2).max_index(), 1) var f = fiby(3, 4, 1, 2) f.balance() _= assert_equal(f.max_index(), 2) f = fiby(3, 4, 1, 2, 5, 6, 0) f.balance() _= assert_equal(f.max_index(), 6) _= assert_equal(f.elements[6], 6) f = fiby(1, 3, 2, 4, 5) _= assert_equal(f.max_index(), 4) f = fiby(3, 1, 2, 5, 4) _= assert_equal(f.max_index(), 3) f = fiby(3, 2, 5, 4, 1) _= assert_equal(f.max_index(), 2) f = fiby(3, 5, 4, 1, 2) _= assert_equal(f.max_index(), 1) f = fiby(5, 2, 4, 5, 3) _= assert_equal(f.max_index(), 0) f = fiby(1, 3, 2, 4, 5) f.balance() _= assert_equal(f.max_index(), 2) f = fiby(3, 1, 2, 5, 4) f.balance() _= assert_equal(f.max_index(), 2) f = fiby(3, 2, 5, 4, 1) f.balance() _= assert_equal(f.max_index(), 2) f = fiby(3, 5, 4, 1, 2) f.balance() _= assert_equal(f.max_index(), 2) f = fiby(5, 2, 4, 5, 3) f.balance() _= assert_equal(f.max_index(), 2) _= assert_equal(f.elements[2], 5) fn main(): test_start_with_empty_tree() test_longer_sequence_dedup_and_balance() test_add_ascending() test_union_inplace() test_intersection_inplace() test_difference_inplace() test_other_difference_inplace() test_symmetric_difference_inplace() # Uncomment once https://github.com/modularml/mojo/issues/500 is shipped # test_union() test_disjoint() test_subset() test_superset() test_min_index() test_max_index() print("SUCCESS!!!") --- fiby_tree_string_benachmarks.mojo --- from fiby_tree import FibyTree from helpers import cmp_strl, stsl from time import now from math import min fn main(): var tik = now() var ft = FibyTree[StringLiteral, cmp_strl, stsl]('Lorem', 'ipsum', 'dolor', 'sit', 'amet,', 'consectetur', 'adipiscing', 'elit.', 'Quisque', 'orci', 'urna,', 'pretium', 'et', 'porta', 'ac,', 'porttitor', 'sit', 'amet', 'sem.', 'Fusce', 'sagittis', 'lorem', 'neque,', 'vitae', 'sollicitudin', 'elit', 'suscipit', 'et.', 'In', 'interdum', 'convallis', 'nisl', 'in', 'ornare.', 'Vestibulum', 'ante', 'ipsum', 'primis', 'in', 'faucibus', 'orci', 'luctus', 'et', 'ultrices', 'posuere', 'cubilia', 'curae;', 'Aliquam', 'erat', 'volutpat.', 'Morbi', 'mollis', 'iaculis', 'lectus', 'ac', 'tincidunt.', 'Fusce', 'nisi', 'lacus,', 'semper', 'eu', 'dignissim', 'et,', 'malesuada', 'non', 'mi.', 'Sed', 'euismod', 'urna', 'vel', 'elit', 'faucibus,', 'eu', 'bibendum', 'ante', 'fringilla.', 'Curabitur', 'tempus', 'in', 'turpis', 'at', 'mattis.', 'Aliquam', 'erat', 'volutpat.', 'Donec', 'maximus', 'elementum', 'felis,', 'sit', 'amet', 'dignissim', 'augue', 'tincidunt', 'blandit.', 'Aliquam', 'fermentum,', 'est', 'eu', 'mollis.') var tok = now() var duration = tok - tik print("Create 100 entry set in", duration, "ns") print("Set len:", ft.__len__()) tik = now() ft.balance() tok = now() duration = tok - tik print("Balanced the set in:", duration, "ns") tik = now() let elements = ft.sorted_elements() tok = now() duration = tok - tik print("Get sorted elements in:", duration, "ns") var total = 0 for i in range(len(elements)): tik = now() let r = ft.__contains__(elements[i]) tok = now() total += tok - tik print("Check contains in:", total / len(elements), "ns on avg per element") total = 0 for i in range(len(elements)): tik = now() let r = ft.delete(elements[i]) tok = now() total += tok - tik print("Delete all in:", total / len(elements), "ns on avg per element") --- helpers/__init__.mojo --- from .helpers import cmp_strl, stsl, int_to_str --- helpers/helpers.mojo --- from math import min fn int_to_str(i: Int) -> String: return String(i) fn int_eq(i1: Int, i2: Int) -> Bool: return i1 == i2 fn cmp_strl(a: StringLiteral, b: StringLiteral) -> Int: let l = min(len(a), len(b)) let p1 = DTypePointer[DType.int8](a.data()).bitcast[DType.uint8]() let p2 = DTypePointer[DType.int8](b.data()).bitcast[DType.uint8]() let diff = memcmp(p1, p2, l) return diff if diff != 0 else len(a) - len(b) fn stsl(a: StringLiteral) -> String: return a --- lcrs_tree_sample.mojo --- from left_child_right_sibling import LCRSTree, LCRSTreeBuilder from helpers import int_to_str fn v1(i: UInt16, e: Int) -> Bool: print(i, e) return True fn main(): var t = LCRSTree(12) let n1 = t.add_child(15) let n2 = t.add_child(24) let n3 = t.add_child(75) _ = t.add_child(88) _ = t.add_child(45, n1) _ = t.add_child(55, n1) _ = t.add_child(590, n2) _ = t.add_child(670, n2) let all_dfs = t.get_dfs_indices() for i in range(len(all_dfs)): print(t[all_dfs[i]]) print("---") let all_bfs = t.get_bfs_indices() for i in range(len(all_bfs)): print(t[all_bfs[i]]) _ = t.swap_nodes(n1, n3) print("---") let all_bfs2 = t.get_bfs_indices() for i in range(len(all_bfs2)): print(t[all_bfs2[i]]) t.print_tree[int_to_str]() _ = t.prepend_root(123) _ = t.prepend_root(321) t.print_tree[int_to_str]() var t2 = LCRSTreeBuilder(1) .node(5) .leaf(7) .up() .node(10) .node(15) .leaf(13) .leaf(17) .up() .node(45) .tree() t2.print_tree[int_to_str]() _ = t.add_tree(t2) t.print_tree[int_to_str]() t.traverse_dfs[v1]() print("-----") t.traverse_bfs[v1]() let ancestors = t.ancestor_indices(17) print(t[17], len(ancestors)) for i in range(len(ancestors)): print(ancestors[i]) t.compact_dfs() print("======") t.traverse_dfs[v1]() t.print_tree[int_to_str]() t.compact_bfs() print("======") t.traverse_dfs[v1]() t.print_tree[int_to_str]() print("t len:", t.__len__()) print("remove node 3") t.remove(3) print("t len:", t.__len__()) t.print_tree[int_to_str]() --- left_child_right_sibling/__init__.mojo --- from .lcrs_tree import LCRSTree from .lcrs_tree_builder import LCRSTreeBuilder --- left_child_right_sibling/lcrs_tree.mojo --- struct LCRSTree[T: AnyType]: var elements: DynamicVector[T] var left_child: DynamicVector[UInt16] var right_sibling: DynamicVector[UInt16] var parent: DynamicVector[UInt16] var deleted: DynamicVector[UInt16] fn __init__(inout self, root: T): self.elements = DynamicVector[T]() self.left_child = DynamicVector[UInt16]() self.right_sibling = DynamicVector[UInt16]() self.parent = DynamicVector[UInt16]() self.deleted = DynamicVector[UInt16]() self.elements.push_back(root) self.left_child.push_back(0) self.right_sibling.push_back(0) self.parent.push_back(0) fn __moveinit__(inout self, owned existing: Self): self.elements = existing.elements self.left_child = existing.left_child self.right_sibling = existing.right_sibling self.parent = existing.parent self.deleted = existing.deleted fn add_child(inout self, node: T, parent_index: UInt16 = 0) -> UInt16: var node_index = len(self.elements) if len(self.deleted) == 0: self.elements.push_back(node) self.left_child.push_back(node_index) self.right_sibling.push_back(node_index) self.parent.push_back(parent_index) else: node_index = self.deleted.pop_back().to_int() self.elements[node_index] = node self.left_child[node_index] = node_index self.right_sibling[node_index] = node_index self.parent[node_index] = parent_index self._add_as_last_child(parent_index, node_index) return node_index fn add_tree(inout self, tree: Self, parent_index: UInt16 = 0) -> UInt16: let new_root = len(self.elements) for i in range(len(tree.elements)): self.elements.push_back(tree.elements[i]) self.left_child.push_back(tree.left_child[i] + new_root) self.right_sibling.push_back(tree.right_sibling[i] + new_root) self.parent.push_back(tree.parent[i] + new_root) self.parent[new_root] = 0 for i in range(len(tree.deleted)): self.deleted.push_back(tree.deleted[i] + new_root) self._add_as_last_child(parent_index, new_root) return new_root fn _add_as_last_child(inout self, parent_index: UInt16, node_index: UInt16): var current_child = self.left_child[parent_index.to_int()] if current_child == parent_index: self.left_child[parent_index.to_int()] = node_index else: var right_sibling = self.right_sibling[current_child.to_int()] while right_sibling != current_child: current_child = right_sibling right_sibling = self.right_sibling[current_child.to_int()] self.right_sibling[current_child.to_int()] = node_index fn prepend_root(inout self, element: T) -> UInt16: var old_parent_index = len(self.elements) if len(self.deleted) == 0: self.elements.push_back(self.elements[0]) self.left_child.push_back(self.left_child[0]) self.right_sibling.push_back(old_parent_index) self.parent.push_back(0) else: old_parent_index = self.deleted.pop_back().to_int() self.elements[old_parent_index] = self.elements[0] self.left_child[old_parent_index] = self.left_child[0] self.right_sibling[old_parent_index] = old_parent_index self.parent[old_parent_index] = 0 self.elements[0] = element self.left_child[0] = old_parent_index var child = self.left_child[old_parent_index] self.parent[child.to_int()] = old_parent_index while self.right_sibling[child.to_int()] != child: child = self.right_sibling[child.to_int()] self.parent[child.to_int()] = old_parent_index return old_parent_index fn __getitem__(self, node_index: UInt16) -> T: return self.elements[node_index.to_int()] fn __setitem__(inout self, node_index: UInt16, element: T): self.elements[node_index.to_int()] = element fn __len__(self: Self) -> Int: return len(self.elements) - len(self.deleted) fn swap_elements(inout self, index_a: UInt16, index_b: UInt16): let temp = self.elements[index_a.to_int()] self.elements[index_a.to_int()] = self.elements[index_b.to_int()] self.elements[index_b.to_int()] = temp fn swap_nodes(inout self, index_a: UInt16, index_b: UInt16) -> Bool: if index_a == index_b: return False if self.is_leaf(index_a) and self.is_leaf(index_b): self.swap_elements(index_a, index_b) return True if self.are_siblings(index_a, index_b): self._swap_siblings(index_a, index_b) return True if not self.is_root(index_a) and not self.is_root(index_b): self._swap_nodes(index_a, index_b) return False fn is_leaf(self, index: UInt16) -> Bool: return (self.left_child[index.to_int()] == index).__bool__() fn is_root(self, index: UInt16) -> Bool: return (self.parent[index.to_int()] == index).__bool__() fn are_siblings(self, index_a: UInt16, index_b: UInt16) -> Bool: return (self.parent[index_a.to_int()] == self.parent[index_b.to_int()]).__bool__() fn _swap_siblings(inout self, index_a: UInt16, index_b: UInt16): let parent = self.parent[index_a.to_int()] let children = self.children_indices(parent) var children_index_left = -1 var children_index_right = -1 for i in range(len(children)): if children[i] == index_a or children[i] == index_b: if children_index_left == -1: children_index_left = i else: children_index_right = i break let left_sibling = children[children_index_left] let right_sibling = children[children_index_right] let left_sibling_of_right = children[children_index_right - 1] if children_index_left == 0: self.left_child[parent.to_int()] = right_sibling let prev_right_sibling_of_left = self.right_sibling[left_sibling.to_int()] if children_index_right == len(children) - 1: self.right_sibling[left_sibling.to_int()] = left_sibling else: self.right_sibling[left_sibling.to_int()] = self.right_sibling[right_sibling.to_int()] if left_sibling == left_sibling_of_right: self.right_sibling[right_sibling.to_int()] = left_sibling else: self.right_sibling[right_sibling.to_int()] = prev_right_sibling_of_left self.right_sibling[left_sibling_of_right.to_int()] = left_sibling fn _swap_nodes(inout self, index_a: UInt16, index_b: UInt16): let parent_a = self.parent[index_a.to_int()] let parent_b = self.parent[index_b.to_int()] self.parent[index_a.to_int()] = parent_b self.parent[index_b.to_int()] = parent_a let right_sibling_a = self.right_sibling[index_a.to_int()] let right_sibling_b = self.right_sibling[index_b.to_int()] if self.left_child[parent_a.to_int()] == index_a: self.left_child[parent_a.to_int()] = index_b else: var left_sibling = self.left_child[parent_a.to_int()] while self.right_sibling[left_sibling.to_int()] != index_a: left_sibling = self.right_sibling[left_sibling.to_int()] self.right_sibling[left_sibling.to_int()] = index_b if self.left_child[parent_b.to_int()] == index_b: self.left_child[parent_b.to_int()] = index_a else: var left_sibling = self.left_child[parent_b.to_int()] while self.right_sibling[left_sibling.to_int()] != index_b: left_sibling = self.right_sibling[left_sibling.to_int()] self.right_sibling[left_sibling.to_int()] = index_a if right_sibling_a != index_a: self.right_sibling[index_b.to_int()] = right_sibling_a else: self.right_sibling[index_b.to_int()] = index_b if right_sibling_b != index_b: self.right_sibling[index_a.to_int()] = right_sibling_b else: self.right_sibling[index_a.to_int()] = index_a fn children_indices(self, parent_index: UInt16) -> DynamicVector[UInt16]: var result = DynamicVector[UInt16]() var current_child = self.left_child[parent_index.to_int()] if current_child == parent_index: return result result.push_back(current_child) var right_sibling = self.right_sibling[current_child.to_int()] while right_sibling != current_child: result.push_back(right_sibling) current_child = right_sibling right_sibling = self.right_sibling[current_child.to_int()] return result fn children_count(self, parent_index: UInt16) -> Int: var result = 0 var current_child = self.left_child[parent_index.to_int()] if current_child == parent_index: return result result += 1 var right_sibling = self.right_sibling[current_child.to_int()] while right_sibling != current_child: result += 1 current_child = right_sibling right_sibling = self.right_sibling[current_child.to_int()] return result fn ancestor_indices(self, child_index: UInt16) -> DynamicVector[UInt16]: var result = DynamicVector[UInt16]() var ancestor = child_index while ancestor != self.parent[ancestor.to_int()]: ancestor = self.parent[ancestor.to_int()] result.push_back(ancestor) return result fn get_dfs_indices(self, root: UInt16 = 0) -> DynamicVector[UInt16]: var result = DynamicVector[UInt16]() if len(self.elements) <= root.to_int(): return result result.push_back(root) self._dfs(root, result) return result fn _dfs(self, index: UInt16, inout result: DynamicVector[UInt16]): let child = self.left_child[index.to_int()] if child == index: let sibling = self.right_sibling[index.to_int()] if sibling == index: return result.push_back(sibling) self._dfs(sibling, result) else: result.push_back(child) self._dfs(child, result) let sibling = self.right_sibling[index.to_int()] if sibling == index: return result.push_back(sibling) self._dfs(sibling, result) fn traverse_dfs[visitor: fn(UInt16, T) -> Bool](self, root: UInt16 = 0) -> None: if len(self.elements) > root.to_int(): self._traverse_dfs[visitor](root, True) fn _traverse_dfs[visitor: fn(UInt16, T) -> Bool](self, index: UInt16, root: Bool = False) -> None: if visitor(index, self.elements[index.to_int()]): let child = self.left_child[index.to_int()] if child == index: if root: return let sibling = self.right_sibling[index.to_int()] if sibling == index: return self._traverse_dfs[visitor](sibling) else: self._traverse_dfs[visitor](child) let sibling = self.right_sibling[index.to_int()] if sibling == index: return self._traverse_dfs[visitor](sibling) fn get_bfs_indices(self, root: UInt16 = 0) -> DynamicVector[UInt16]: var result = DynamicVector[UInt16]() if len(self.elements) <= root.to_int(): return result result.push_back(root) var visited = 0 while len(result) > visited: let index = result[visited] var child = self.left_child[result[visited].to_int()] if child != index: result.push_back(child) var sibling = self.right_sibling[child.to_int()] while sibling != child: result.push_back(sibling) child = sibling sibling = self.right_sibling[child.to_int()] visited += 1 return result fn traverse_bfs[visitor: fn(UInt16, T) -> Bool](self, root: UInt16 = 0) -> None: if len(self.elements) <= root.to_int(): return if visitor(root, self.elements[root.to_int()]): var visited = 0 # Could be implemented with stack allocated pointer var result = UnsafeFixedVector[UInt16](len(self.elements)) result.append(root) while len(result) > visited: let index = result[visited] var child = self.left_child[result[visited].to_int()] if child != index: result.append(child) if not visitor(child, self.elements[child.to_int()]): return var sibling = self.right_sibling[child.to_int()] while sibling != child: result.append(sibling) if not visitor(sibling, self.elements[sibling.to_int()]): return child = sibling sibling = self.right_sibling[child.to_int()] visited += 1 fn remove(inout self, index: UInt16): if index == 0: self.elements.clear() self.left_child.clear() self.right_sibling.clear() self.parent.clear() return let parent = self.parent[index.to_int()] if parent != index: var parent_child = self.left_child[parent.to_int()] if parent_child == index: if self.right_sibling[index.to_int()] != index: self.left_child[parent.to_int()] = self.right_sibling[index.to_int()] else: self.left_child[parent.to_int()] = parent else: while self.right_sibling[parent_child.to_int()] != index: parent_child = self.right_sibling[parent_child.to_int()] if self.right_sibling[index.to_int()] == index: self.right_sibling[parent_child.to_int()] = parent_child else: self.right_sibling[parent_child.to_int()] = self.right_sibling[index.to_int()] let indecies_to_remove = self.get_bfs_indices(index) for i in range(len(indecies_to_remove)): self.deleted.push_back(indecies_to_remove[i]) fn compact_dfs(inout self, root_index: UInt16 = 0): let indices = self.get_dfs_indices(root_index) self._compact(indices) fn compact_bfs(inout self, root_index: UInt16 = 0): let indices = self.get_bfs_indices(root_index) self._compact(indices) fn _compact(inout self, indices: DynamicVector[UInt16]): let old_len = len(self.elements) let new_len = len(indices) var map = DynamicVector[Int](old_len) for i in range(new_len): map[indices[i].to_int()] = i var new_elements = DynamicVector[T](new_len) for i in range(new_len): new_elements.push_back(self.elements[indices[i].to_int()]) self.elements = new_elements var new_left_child = DynamicVector[UInt16](new_len) for i in range(new_len): new_left_child.push_back(map[self.left_child[indices[i].to_int()].to_int()]) self.left_child = new_left_child var new_right_sibling = DynamicVector[UInt16](new_len) for i in range(new_len): new_right_sibling.push_back(map[self.right_sibling[indices[i].to_int()].to_int()]) self.right_sibling = new_right_sibling var new_parent = DynamicVector[UInt16](new_len) for i in range(new_len): new_parent.push_back(map[self.parent[indices[i].to_int()].to_int()]) self.parent = new_parent self.deleted.clear() fn print_tree[to_str: fn(T) -> String](inout self, root: UInt16 = 0): self._print[to_str]("", 0) fn _print[to_str: fn(T) -> String](inout self, indentation: String, index: UInt16): if len(indentation) > 10: return if len(indentation) > 0: print(indentation, "-", to_str(self[index.to_int()])) else: print("-", to_str(self[index.to_int()])) let children = self.children_indices(index) for i in range(len(children)): self._print[to_str](indentation + " ", children[i]) --- left_child_right_sibling/lcrs_tree_builder.mojo --- from .lcrs_tree import LCRSTree struct LCRSTreeBuilder[T: AnyType]: var _tree: LCRSTree[T] var _queue: DynamicVector[UInt16] fn __init__(inout self, root: T): self._tree = LCRSTree(root) self._queue = DynamicVector[UInt16]() self._queue.push_back(0) fn __moveinit__(inout self, owned existing: Self): self._tree = existing._tree^ self._queue = existing._queue fn node(owned self, node: T) -> LCRSTreeBuilder[T]: let last = self._queue[len(self._queue) - 1] self._queue.push_back(self._tree.add_child(node, last)) return self^ fn leaf(owned self, node: T) -> LCRSTreeBuilder[T]: let last = self._queue[len(self._queue) - 1] _ = self._tree.add_child(node, last) return self^ fn up(owned self) -> LCRSTreeBuilder[T]: _ = self._queue.pop_back() return self^ fn tree(owned self) -> LCRSTree[T]: return self._tree^ --- trie_dict/__init__.mojo --- from .dict import TrieDict --- trie_dict/dict.mojo --- struct TrieDict[Value: AnyType]: var chars: DynamicVector[Int8] var next: DynamicVector[UInt16] var sibling: DynamicVector[UInt16] var value_index: DynamicVector[UInt8] var values: DynamicVector[Value] var deleted: UInt8 fn __init__(inout self): self.chars = DynamicVector[Int8]() self.next = DynamicVector[UInt16]() self.sibling = DynamicVector[UInt16]() self.value_index = DynamicVector[UInt8]() self.values = DynamicVector[Value]() self.deleted = 0 fn __len__(self) -> Int: return len(self.values) - self.deleted.to_int() fn __contains__(self, key: String) -> Bool: let chars = key._buffer let key_char_offset = self._find_prefix_count(chars) let key_offset = key_char_offset.get[0, Int]() let char_index = key_char_offset.get[1, Int]() if key_offset == len(chars): return self.value_index[char_index] > 0 return False fn get(self, key: String, default: Value) -> Value: let chars = key._buffer let key_char_offset = self._find_prefix_count(chars) let key_offset = key_char_offset.get[0, Int]() let char_index = key_char_offset.get[1, Int]() if key_offset == len(chars): if self.value_index[char_index] > 0: return self.values[(self.value_index[char_index] - 1).to_int()] return default fn delete(inout self, key: String): let chars = key._buffer let key_char_offset = self._find_prefix_count(chars) let key_offset = key_char_offset.get[0, Int]() let char_index = key_char_offset.get[1, Int]() if key_offset == len(chars): if self.value_index[char_index] > 0: self.value_index[char_index] = 0 self.deleted += 1 fn put(inout self, key: String, value: Value): let chars = key._buffer let key_char_offset = self._find_prefix_count(chars) let key_offset = key_char_offset.get[0, Int]() let char_index = key_char_offset.get[1, Int]() if key_offset == len(chars): if self.value_index[char_index] == 0: self.values.push_back(value) self.value_index[char_index] = UInt8(len(self.values)) return # replace self.values[(self.value_index[char_index] - 1).to_int()] = value return if len(self.chars) > char_index: if char_index == len(self.chars) - 1: self.next[char_index] = UInt16(len(self.chars)) else: self.sibling[char_index] = UInt16(len(self.chars)) for i in range(key_offset, len(chars)): self.chars.push_back(chars[i]) let self_index = UInt16(len(self.sibling)) self.sibling.push_back(self_index) self.next.push_back(self_index + 1) self.value_index.push_back(0) self.next[len(self.next) - 1] -= 1 self.values.push_back(value) self.value_index[len(self.next) - 1] = UInt8(len(self.values)) fn _find_prefix_count(self, key: DynamicVector[Int8]) -> (Int, Int): if len(self.chars) == 0: return 0, 0 var char_index = 0 for key_index in range(len(key)): while True: if self.chars[char_index] != key[key_index]: if self._has_sibling(char_index): char_index = self.sibling[char_index].to_int() else: return key_index, char_index else: if self._has_next(char_index): char_index = self.next[char_index].to_int() break else: return key_index + 1, char_index return len(key), char_index - 1 fn _has_sibling(self, char_index: Int) -> Bool: return self.sibling[char_index].to_int() != char_index fn _has_next(self, char_index: Int) -> Bool: return self.next[char_index].to_int() != char_index fn debug(self): print("Num nodes:", len(self.next)) print("Num values:", len(self.values)) var s1: String = "Chars: [" for i in range(len(self.chars)): s1 += String(self.chars[i].to_int()) s1 += "," s1 += "]" print(s1) s1 = "Next: [" for i in range(len(self.next)): s1 += String(self.next[i]) s1 += "," s1 += "]" print(s1) s1 = "Sibling: [" for i in range(len(self.sibling)): s1 += String(self.sibling[i]) s1 += "," s1 += "]" print(s1) s1 = "Value index: [" for i in range(len(self.value_index)): s1 += String(self.value_index[i]) s1 += "," s1 += "]" print(s1) --- trie_dict_benchmarks.mojo --- from time import now from trie_dict import TrieDict fn vec[T: AnyType](*elements: T) -> DynamicVector[T]: let elements_list: VariadicList[T] = elements var result = DynamicVector[T](len(elements_list)) for i in range(len(elements_list)): result.push_back(elements[i]) return result fn main(): let corpus = vec('Lorem', 'ipsum', 'dolor', 'sit', 'amet,', 'consectetur', 'adipiscing', 'elit.', 'Quisque', 'orci', 'urna,', 'pretium', 'et', 'porta', 'ac,', 'porttitor', 'sit', 'amet', 'sem.', 'Fusce', 'sagittis', 'lorem', 'neque,', 'vitae', 'sollicitudin', 'elit', 'suscipit', 'et.', 'In', 'interdum', 'convallis', 'nisl', 'in', 'ornare.', 'Vestibulum', 'ante', 'ipsum', 'primis', 'in', 'faucibus', 'orci', 'luctus', 'et', 'ultrices', 'posuere', 'cubilia', 'curae;', 'Aliquam', 'erat', 'volutpat.', 'Morbi', 'mollis', 'iaculis', 'lectus', 'ac', 'tincidunt.', 'Fusce', 'nisi', 'lacus,', 'semper', 'eu', 'dignissim', 'et,', 'malesuada', 'non', 'mi.', 'Sed', 'euismod', 'urna', 'vel', 'elit', 'faucibus,', 'eu', 'bibendum', 'ante', 'fringilla.', 'Curabitur', 'tempus', 'in', 'turpis', 'at', 'mattis.', 'Aliquam', 'erat', 'volutpat.', 'Donec', 'maximus', 'elementum', 'felis,', 'sit', 'amet', 'dignissim', 'augue', 'tincidunt', 'blandit.', 'Aliquam', 'fermentum,', 'est', 'eu', 'mollis.') var t = TrieDict[Int]() var tik = now() var tok = now() var total = 0 for i in range(len(corpus)): tik = now() t.put(corpus[i], i) tok = now() total += tok - tik print("Add 100 elements in", total / len(corpus), "ns on avg per entry") for i in range(len(corpus)): tik = now() let r = t.__contains__(corpus[i]) tok = now() total += tok - tik print("Lookup 100 elements in", total / len(corpus), "ns on avg per entry") for i in range(len(corpus)): tik = now() let r = t.delete(corpus[i]) tok = now() total += tok - tik print("Delete 100 elements in", total / len(corpus), "ns on avg per entry") print("Dict len:", t.__len__()) --- trie_dict_sample.mojo --- from trie_dict import TrieDict fn main(): var t = TrieDict[Int]() _ = t.put("Maxim", 12) t.debug() _ = t.put("Max", 11) t.debug() _ = t.put("Marina", 13) t.debug() _ = t.put("Marinala", 14) t.debug() _ = t.put("Leo", 15) t.debug() _ = t.put("Daria", 16) t.debug() _ = t.put("Dario", 17) t.debug() _ = t.put("Dominique", 18) t.debug() print("Marina", t.__contains__("Marina")) print("Mari", t.__contains__("Mari")) print("Dominique", t.__contains__("Dominique")) print("Dominique", t.get("Dominique", 0)) print("Dom", t.get("Dom", 0)) print("Daria", t.get("Daria", 0)) _ = t.put("Daria", 26) print("Daria", t.get("Daria", 0)) --- .github/workflows/package.yml --- name: Package and release on: push: branches: - main jobs: run-tests: name: Release package runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Install modular run: | curl -s https://get.modular.com | sh - modular auth examples - name: Install Mojo run: modular install nightly/mojo - name: Add to PATH run: echo "/home/runner/.modular/pkg/packages.modular.com_nightly_mojo/bin/" >> $GITHUB_PATH - name: Create package run: mojo package blazeseq -o blazeseq.mojopkg - name: Upload package to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.TOKEN }} file: blazeseq.mojopkg tag: ${{ github.ref }} overwrite: true --- .github/workflows/run-tests.yml --- name: Run Mojo tests on: push: branches: - "*" jobs: run-tests: name: Run tests runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Install modular run: | curl -s https://get.modular.com | sh - modular auth examples - name: Install Mojo run: modular install nightly/mojo - name: Add to PATH run: echo "/home/runner/.modular/pkg/packages.modular.com_nightly_mojo/bin/" >> $GITHUB_PATH - name: Log everything run: pwd ls - name: Run tests run: mojo run test/tests.mojo --- .gitignore --- *.* data/* benchmark/* blazeseq/* !benchmark/*.mojo !blazeseq/*.mojo !.gitignore !cli.mojo # pixi environments .pixi # pixi environments .pixi *.egg-info --- README.md --- # BlazeSeq🔥 [![Run Mojo tests](https://github.com/MoSafi2/BlazeSeq/actions/workflows/run-tests.yml/badge.svg)](https://github.com/MoSafi2/BlazeSeq/actions/workflows/run-tests.yml) **29/07 UPDATE: The Tensor pacakge was recently deprecated from the Mojo stdlib breaking BlazeSeq main branch. I am currently re-writing BlazeSeq, check out the "dev" branch to check the state of the project. WIP** BlazeSeq is a performant and versatile FASTQ format parser that provide FASTQ parsing with fine-control knobs. It can be further utilized in several application as quality control tooling, kmer-generation, alignment ... etc. It currently provides two main options: `CoordParser` a minimal-copy parser that can do limited validation of records similar to Rust's [Needletail](https://github.com/onecodex/needletail/tree/master) and `RecordParser` which is ~3X slower but also provides compile-time optional quality schema and ASCII validation of the records. **Note**: BlazeSeq is a re-write of the earlier `MojoFastTrim` which can still be accessed from [here](https://github.com/MoSafi2/BlazeSeq/tree/MojoFastTrim). ## Key Features * Zero-overhead control over parser validation guarantees through Mojo's compile time meta-programming. * Multiple parsing modes with progressive validation/performance compromise. * Parsing speed up to 5Gb/s from disk on modern hardware. * Different aggregation statistics modules (Length & Quality distribution, GC-content .. etc.) ## Installation `BlazeSeq` is always updated to the latest `Mojo nightly` on Ubuntu, Mac or WSL2 on windows as `Mojo` is moving forward quite fast. You can get `BlazeSeq` source code as well as pre-compiled CLI tool from the releases page, you can clone and compile the repository yourself. ```bash git clone [add repo] cd [repo] mojo build blazeseq/cli.mojo -o blazeseq_cli //CLI tool mojo pkg blazeseq //mojo pkg ``` ## Getting started ### Command line ```bash blazeseq_cli [options] /path/to/file ``` Check `blazeseq_cli --help` for full list of options ### Interactive usage * Basic usage ```mojo from blazeseq import RecordParser, CoordParser fn main(): alias validate_ascii = True alias validate_quality = True # Schema can be: generic, sanger, solexa, illumina_1.3, illumina_1.5, illumina_1.8 var schema = "sanger" var parser = RecordParser[validate_ascii, validate_quality](path="path/to/your/file.fastq", schema) # Only validates read headers and Ids length matching, 3X faster on average. # parser = CoordParser(path="path/to/your/file.fastq") parser.next() # Lazily get the next FASTQ record parser.parse_all() # Parse all records, fast error check. ``` ### Examples * Get total number of reads and base pairs (fast mode) ```mojo from blazeseq import CoordParser fn main(): var total_reads = 0 var total_base_pairs = 0 parser = CoordParser("path/to/your/file.fastq") while True: try: var read = parser.next() total_reads += 1 total_base_pairs += len(read) except: print(total_reads, total_base_pairs) break ``` **Lazy parse, collect record statistics**. for now only works with `RecordParser`, the `FullStats` aggregator is the only one present (_more options are under development_). ```mojo from blazeseq import RecordParser, FullStats fn main() raises: var parser = RecordParser(path="data/8_Swamp_S1B_MATK_2019_minq7.fastq") var stats = FullStats() while True: try: var record = parser.next() stats.tally(record) except: print(stats) break ``` ## Performance **Disclaimer:** Performance reporting is a tricky business on the best of days. Consider the following numbers as approximate of `BlazeSeq` single-core performance targets on modern hardware. It also serve as internal metrics to track improvements as `BlazeSeq` and `Mojo` evolve. All code used in benchmarks are present in the `benchmark` directory of the repository. Download the datasets from the following links. Compile and run the benchmarking scripts as follow. ### Setup All tests were carried out on a personal PC with Intel core-i7 13700K processor, 32 GB of DDR6 memory equipped with 2TB Samsung 980 pro NVME hard drive and running Ubuntu 22.04 and Mojo 24.2. benchmarking scripts were compiled using the following command `mojo build /path/to/file.mojo` and run using `hyperfine "<binary> /path/to/file.fastq" --warmup 2`. ### Datasets 5 datasets with progressively bigger sizes and number of reads were used for benchmarking. * [Raposa. (2020).](https://zenodo.org/records/3736457/files/9_Swamp_S2B_rbcLa_2019_minq7.fastq?download=1) (40K reads) * [Biofast benchmark dataset](https://github.com/lh3/biofast/releases/tag/biofast-data-v1) (5.5M reads) * [Elsafi Mabrouk et. al,](https://www.ebi.ac.uk/ena/browser/view/SRR16012060) (12.2M reads) * [Galonska et. al,](https://www.ebi.ac.uk/ena/browser/view/SRR4381936) (27.7M reads) * [Galonska et. al,](https://www.ebi.ac.uk/ena/browser/view/SRR4381933) (R1 only - 169.8M reads) ## Results ### FASTQ parsing | reads | CoordParser | RecordParser (no validation) | RecordParser <br> (quality schama validation) | RecordParser (complete validation) | | ------ | --------------- | ---------------------------- | --------------------------------------------- | ---------------------------------- | | 40k | 13.7 ± 5.0 ms | 18.2 ± 4.7 ms | 26.0 ± 4.9 ms | 50.3 ± 6.3 ms | | 5.5M | 244.8 ± 4.3 ms | 696.9 ± 2.7 ms | 935.8 ± 6.3 ms | 1.441 ± 0.024 s | | 12.2M | 669.4 ms ± 3.2 ms| 1.671 ± 0.08 s | 2.198 ± 0.014 s | 3.428 ± 0.042 s | | 27.7M | 1.247 ± 0.07 s | 3.478 ± 0.08 s | 3.92 ± 0.030 s | 4.838 ± 0.034 s | | 169.8M | 17.84 s ± 0.04 s| 37.863 ± 0.237 s | 40.430 ± 1.648 s | 54.969 ± 0.232 s | ## Functional testing A dataset of toy valid/invalid FASTQ files were used for testing. the dataset were obtained from the [**BioJava**](https://github.com/biojava/biojava/tree/master/biojava-genome%2Fsrc%2Ftest%2Fresources%2Forg%2Fbiojava%2Fnbio%2Fgenome%2Fio%2Ffastq) project. The same test dataset is used for the [**Biopython**](https://biopython.org/) and [**BioPerl**](https://bioperl.org/) FASTQ parsers as well. ## Roadmap Some points of the following roadmap are tightly coupled with Mojo's evolution, as Mojo matures more options will be added. * [ ] parallel processing of Fastq files (requires stable concurrency model and concurrency primitives from Mojo) * [ ] Parsing over continuous (decompression , network) streams (requires Mojo implementation or binding to decompression and networking libraries). * [ ] Reporting output as JSON, HTML? Python inter-op for plotting?. * [ ] Comprehensive testing of basic aggregate statistics (GC Content, quality distribution per base pair, read-length distribution ... etc) vs Industry standards * [ ] Passing custom list of aggregator to the parser. ## Contribution This project welcomes all contributions! Here are some ways if you are interested: * **Bug reports**: BlazeSeq is still new, bugs and rough-edges are expected. If you encounter any bugs, please create an issue. * **Feature requests**: If you have ideas for new features, feel free to create an issue or a pull request. * **Code contributions**: Pull requests that improve existing code or add new functionalities are welcome. ## License This project is licensed under the MIT License. --- benchmark/__init__.mojo --- --- benchmark/benchmark_all_parser_modes.mojo --- from blazeseq import RecordParser, CoordParser from sys import argv from time import now fn main() raises: var vars = argv() var path = vars[1] record_parser_validate_all(path) record_parser_quality_only(path) coord_parser(path) fn record_parser_validate_all(path: String) raises: var tic = now() var parser = RecordParser[validate_ascii=True, validate_quality=True]( path, "illumina_1.8" ) var read_no = 0 var base_number = 0 var qu_numeber = 0 while True: try: var read = parser.next() read_no += 1 base_number += len(read) qu_numeber += read.QuStr.num_elements() except Error: break var toc = now() var time_fun = round((toc - tic) / 1e9) print( "RecordParser with ASCII and quality validation.\n", "time spent in parsing:", (toc - tic) / 1e9, ) print(read_no, base_number, qu_numeber) fn record_parser_quality_only(path: String) raises: var tic = now() var parser = RecordParser[validate_ascii=False, validate_quality=True]( path, "illumina_1.8" ) var read_no = 0 var base_number = 0 var qu_numeber = 0 while True: try: var read = parser.next() read_no += 1 base_number += len(read) qu_numeber += read.QuStr.num_elements() except Error: break var toc = now() var time_fun = round((toc - tic) / 1e9) print( "RecordParser with quality validation.\n", "time spent in parsing:", (toc - tic) / 1e9, ) print(read_no, base_number, qu_numeber) fn coord_parser(path: String) raises: var tic = now() var parser = CoordParser(path) var read_no = 0 var base_number = 0 var qu_numeber = 0 while True: try: var read = parser.next() read_no += 1 base_number += read.seq_len().to_int() qu_numeber += read.qu_len().to_int() except Error: break var toc = now() var time_fun = round((toc - tic) / 1e9) print( "CoordParser with basic validation.\n", "time spent in parsing:", (toc - tic) / 1e9, ) print(read_no, base_number, qu_numeber) --- benchmark/benchmark_coord_parser.mojo --- from blazeseq import CoordParser from sys import argv fn main() raises: var vars = argv() var path = vars[1] var parser = CoordParser(path) var read_no = 0 var base_number = 0 var qu_numeber = 0 while True: try: var read = parser.next() read_no += 1 base_number += int(read.seq_len()) qu_numeber += int(read.qu_len()) except Error: break print(read_no, base_number, qu_numeber) --- benchmark/benchmark_record_parser_allvalid.mojo --- from blazeseq import RecordParser from sys import argv fn main() raises: var vars = argv() var path = vars[1] var parser = RecordParser[validate_ascii=True, validate_quality=True]( path, "illumina_1.8" ) var read_no = 0 var base_number = 0 var qu_numeber = 0 while True: try: var read = parser.next() read_no += 1 base_number += len(read) qu_numeber += read.QuStr.num_elements() except Error: break print(read_no, base_number, qu_numeber) --- benchmark/benchmark_record_parser_novalid.mojo --- from blazeseq import RecordParser from sys import argv fn main() raises: var vars = argv() var path = vars[1] var parser = RecordParser[validate_ascii=False, validate_quality=False]( path, "illumina_1.8" ) var read_no = 0 var base_number = 0 var qu_numeber = 0 while True: try: var read = parser.next() read_no += 1 base_number += len(read) qu_numeber += read.QuStr.num_elements() except Error: break print(read_no, base_number, qu_numeber) --- benchmark/benchmark_record_parser_qu_valid.mojo --- from blazeseq import RecordParser from sys import argv fn main() raises: var vars = argv() var path = vars[1] var parser = RecordParser[validate_ascii=False, validate_quality=True]( path, "illumina_1.8" ) var read_no = 0 var base_number = 0 var qu_numeber = 0 while True: try: var read = parser.next() read_no += 1 base_number += len(read) qu_numeber += read.QuStr.num_elements() except Error: break print(read_no, base_number, qu_numeber) --- blazeseq/CONSTS.mojo --- from blazeseq.helpers import QualitySchema alias KB = 1024 alias MB = 1024 * KB alias GB = 1024 * MB alias USE_SIMD = True alias read_header = 64 alias quality_header = 43 alias new_line = 10 alias carriage_return = 13 alias U8 = DType.uint8 alias simd_width: Int = simdwidthof[U8]() alias DEFAULT_CAPACITY = 64 * KB alias MAX_SHIFT = 30 alias MAX_CAPACITY = 2**MAX_SHIFT # Values for schemas are derived from # https://github.com/BioJulia/FASTX.jl/blob/master/src/fastq/quality.jl # Also check: https://www.biostars.org/p/90845/ # Generic is the minimum and maximum value of all possible schemas schemas alias generic_schema = QualitySchema("Generic", 33, 126, 33) alias sanger_schema = QualitySchema("Sanger", 33, 126, 33) alias solexa_schema = QualitySchema("Solexa", 59, 126, 64) alias illumina_1_3_schema = QualitySchema("Illumina v1.3", 64, 126, 64) alias illumina_1_5_schema = QualitySchema("Illumina v1.5", 66, 126, 64) alias illumina_1_8 = QualitySchema("Illumina v1.8", 33, 126, 33) --- blazeseq/__init__.mojo --- from .parser import CoordParser, RecordParser from .record import RecordCoord from .record import FastqRecord from .iostream import BufferedWriter, BufferedLineIterator from .stats import FullStats --- blazeseq/helpers.mojo --- import math from algorithm import vectorize from blazeseq.CONSTS import * from tensor import Tensor from collections.vector import * from tensor import Tensor from collections.list import List ######################### Character find functions ################################### @always_inline fn arg_true[simd_width: Int](v: SIMD[DType.bool, simd_width]) -> Int: for i in range(simd_width): if v[i]: return i return -1 @always_inline fn find_chr_next_occurance_simd[ T: DType ](in_tensor: Tensor[T], chr: Int, start: Int = 0) -> Int: """ Function to find the next occurance of character using SIMD instruction. Checks are in-bound. no-risk of overflowing the tensor. """ var len = in_tensor.num_elements() - start var aligned = start + math.align_down(len, simd_width) for s in range(start, aligned, simd_width): var v = in_tensor.load[width=simd_width](s) var mask = v == chr if mask.reduce_or(): return s + arg_true(mask) for i in range(aligned, in_tensor.num_elements()): if in_tensor[i] == chr: return i return -1 @always_inline fn find_chr_next_occurance_iter[ T: DType ](in_tensor: Tensor[T], chr: Int, start: Int = 0) -> Int: """ Generic Function to find the next occurance of character Iterativly. No overhead for tensors < 1,000 items while being easier to debug. """ for i in range(start, in_tensor.num_elements()): if in_tensor[i] == chr: return i return -1 fn find_chr_last_occurance[ T: DType ](in_tensor: Tensor[T], start: Int, end: Int, chr: Int) -> Int: for i in range(end - 1, start - 1, -1): if in_tensor[i] == chr: return i return -1 # @always_inline # fn find_chr_all_occurances[T: DType](in_tensor: Tensor[T], chr: Int) -> List[Int]: # var holder = List[Int]() # @parameter # fn inner[simd_width: Int](size: Int): # var simd_vec = in_tensor.load[simd_width](size) # var bool_vec = simd_vec == chr # if bool_vec.reduce_or(): # for i in range(len(bool_vec)): # if bool_vec[i]: # holder.append(size + i) # vectorize[inner, simd_width](in_tensor.num_elements()) # return holder ################################ Tensor slicing ################################################ @always_inline fn slice_tensor[ T: DType, USE_SIMD: Bool = True ](in_tensor: Tensor[T], start: Int, end: Int) -> Tensor[T]: if start >= end: return Tensor[T](0) @parameter if USE_SIMD: return slice_tensor_simd(in_tensor, start, end) else: return slice_tensor_iter(in_tensor, start, end) @always_inline fn slice_tensor_simd[ T: DType ](in_tensor: Tensor[T], start: Int, end: Int) -> Tensor[T]: """ Generic Function that returns a python-style tensor slice from start till end (not inclusive). """ var out_tensor: Tensor[T] = Tensor[T](end - start) @parameter fn inner[simd_width: Int](size: Int): var transfer = in_tensor.load[width=simd_width](start + size) out_tensor.store[width=simd_width](size, transfer) vectorize[inner, simd_width](out_tensor.num_elements()) return out_tensor @always_inline fn slice_tensor_iter[ T: DType ](in_tensor: Tensor[T], start: Int, end: Int) -> Tensor[T]: var out_tensor = Tensor[T](end - start) for i in range(start, end): out_tensor[i - start] = in_tensor[i] return out_tensor @always_inline fn write_to_buff[T: DType](src: Tensor[T], inout dest: Tensor[T], start: Int): """ Copy a small tensor into a larger tensor given an index at the large tensor. Implemented iteratively due to small gain from copying less then 1MB tensor using SIMD. Assumes copying is always in bounds. Bound checking is the responsbility of the caller. """ for i in range(src.num_elements()): dest[start + i] = src[i] # The Function does not provide bounds checks on purpose, the bounds checks is the callers responsibility @always_inline fn cpy_tensor[ T: DType # simd_width: Int ]( inout dest: Tensor[T], src: Tensor[T], num_elements: Int, dest_strt: Int = 0, src_strt: Int = 0, ): var dest_ptr: DTypePointer[T] = dest._ptr + dest_strt var src_ptr: DTypePointer[T] = src._ptr + src_strt memcpy(dest_ptr, src_ptr, num_elements) ## Alternative method # @parameter # fn inner[simd_width: Int](size: Int): # var transfer = src.load[width=simd_width](src_strt + size) # dest.store[width=simd_width](dest_strt + size, transfer) # vectorize[inner, simd_width](num_elements) ################################ Next line Ops ############################## # The next line OPs is dependent on find_chr_next_occurance and slice_tensor @always_inline fn get_next_line[ T: DType, USE_SIMD: Bool = True ](in_tensor: Tensor[T], start: Int) -> Tensor[T]: """Function to get the next line using either SIMD instruction (default) or iterativly. """ var in_start = start while in_tensor[in_start] == new_line: # Skip leadin \n print("skipping \n") in_start += 1 if in_start >= in_tensor.num_elements(): return Tensor[T](0) @parameter if USE_SIMD: var next_line_pos = find_chr_next_occurance_simd( in_tensor, new_line, in_start ) if next_line_pos == -1: next_line_pos = ( in_tensor.num_elements() ) # If no line separator found, return the reminder of the string, behaviour subject to change return slice_tensor_simd(in_tensor, in_start, next_line_pos) else: var next_line_pos = find_chr_next_occurance_iter( in_tensor, new_line, in_start ) if next_line_pos == -1: next_line_pos = ( in_tensor.num_elements() ) # If no line separator found, return the reminder of the string, behaviour subject to change return slice_tensor_iter(in_tensor, in_start, next_line_pos) @always_inline fn get_next_line_index[ T: DType, USE_SIMD: Bool = True ](in_tensor: Tensor[T], start: Int) -> Int: var in_start = start @parameter if USE_SIMD: var next_line_pos = find_chr_next_occurance_simd( in_tensor, new_line, in_start ) if next_line_pos == -1: return -1 return next_line_pos else: var next_line_pos = find_chr_next_occurance_iter( in_tensor, new_line, in_start ) if next_line_pos == -1: return -1 return next_line_pos ############################# Fastq recod-related Ops ################################ fn find_last_read_header( in_tensor: Tensor[U8], start: Int = 0, end: Int = -1 ) -> Int: var end_inner: Int if end == -1: end_inner = in_tensor.num_elements() else: end_inner = end var last_chr = find_chr_last_occurance( in_tensor, start, end_inner, read_header ) if in_tensor[last_chr - 1] == new_line: return last_chr else: end_inner = last_chr if (end_inner - start) < 4: return -1 last_chr = find_last_read_header(in_tensor, start, end_inner) return last_chr @value struct QualitySchema(Stringable, CollectionElement): var SCHEMA: StringLiteral var LOWER: UInt8 var UPPER: UInt8 var OFFSET: UInt8 fn __init__( inout self, schema: StringLiteral, lower: Int, upper: Int, offset: Int ): self.SCHEMA = schema self.UPPER = upper self.LOWER = lower self.OFFSET = offset fn __str__(self) -> String: return ( String("Quality schema: ") + self.SCHEMA + "\nLower: " + str(self.LOWER) + "\nUpper: " + str(self.UPPER) + "\nOffset: " + str(self.OFFSET) ) --- blazeseq/iostream.mojo --- from memory.memory import memcpy from blazeseq.helpers import get_next_line_index, slice_tensor, cpy_tensor from blazeseq.CONSTS import ( simd_width, U8, DEFAULT_CAPACITY, MAX_CAPACITY, MAX_SHIFT, carriage_return, ) from pathlib import Path import time from tensor import Tensor from utils.static_tuple import InlineArray # Implement functionality from: Buffer-Reudx rust cate allowing for BufferedReader that supports partial reading and filling , # https://github.com/dignifiedquire/buffer-redux # Minimial Implementation that support only line iterations # BUG in resizing buffer: One extra line & bad consumed and file coordinates. trait reader: fn read_bytes(inout self, amt: Int) raises -> Tensor[U8]: ... fn read_to_buffer( inout self, inout buf: Tensor[U8], buf_pos: Int, amt: Int ) raises -> Int: ... fn __moveinit__(inout self, owned other: Self): ... struct FileReader(reader): var handle: FileHandle fn __init__(inout self, path: Path) raises: self.handle = open(path, "r") @always_inline fn read_bytes(inout self, amt: Int = -1) raises -> Tensor[U8]: return self.handle.read_bytes(amt) # Does not work well currently @always_inline fn read_to_buffer( inout self, inout buf: Tensor[U8], buf_pos: Int, amt: Int ) raises -> Int: var out = self.read_bytes(amt) if out.num_elements() == 0: return 0 cpy_tensor[U8](buf, out, out.num_elements(), buf_pos, 0) return out.num_elements() fn __moveinit__(inout self, owned other: Self): self.handle = other.handle^ struct TensorReader(reader): var pos: Int var source: Tensor[U8] fn __init__(inout self, source: Tensor[U8]): self.source = source self.pos = 0 @always_inline fn read_bytes(inout self, amt: Int) raises -> Tensor[U8]: var ele = min(amt, self.source.num_elements() - self.pos) if ele == 0: return Tensor[U8](0) var out = Tensor[U8](ele) cpy_tensor[U8](out, self.source, out.num_elements(), 0, self.pos) self.pos += out.num_elements() return out fn read_to_buffer( inout self, inout buf: Tensor[U8], buf_pos: Int, amt: Int ) raises -> Int: var ele = min(amt, self.source.num_elements() - self.pos) if ele == 0: return 0 cpy_tensor[U8](buf, self.source, ele, buf_pos, self.pos) self.pos += ele return ele fn __moveinit__(inout self, owned other: Self): self.source = other.source^ self.pos = other.pos # BUG Last line is not returned if the file does not end with line end seperator # TODO: when in EOF Flush the buffer struct BufferedLineIterator[T: reader, check_ascii: Bool = False]( Sized, Stringable ): """A poor man's BufferedReader and LineIterator that takes as input a FileHandle or an in-memory Tensor and provides a buffered reader on-top with default capactiy. """ var source: FileReader var buf: Tensor[U8] var head: Int var end: Int var consumed: Int fn __init__( inout self, source: Path, capacity: Int = DEFAULT_CAPACITY ) raises: if source.exists(): self.source = FileReader(source) else: raise Error("Provided file not found for read") self.buf = Tensor[U8](capacity) self.head = 0 self.end = 0 self.consumed = 0 _ = self._fill_buffer() self.consumed = 0 # Hack to make the initial buffer full non-consuming # fn __init__( # inout self, source: Tensor[U8], capacity: Int = DEFAULT_CAPACITY # ) raises: # self.source = TensorReader(source) # self.buf = Tensor[U8](capacity) # self.head = 0 # self.end = 0 # self.consumed = 0 # _ = self._fill_buffer() # self.consumed = 0 # Hack to make the initial buffer full non-consuming # fn __init__(inout self, owned source: T, capacity: Int = DEFAULT_CAPACITY) raises: # self.source = source^ # self.buf = Tensor[U8](capacity) # self.head = 0 # self.end = 0 # self.consumed = 0 # _ = self._fill_buffer() # self.consumed = 0 # Hack to make the initial buffer full non-consuming @always_inline fn read_next_line(inout self) raises -> Tensor[U8]: var line_coord = self._line_coord() return slice_tensor[U8](self.buf, line_coord.start, line_coord.end) @always_inline fn read_next_coord(inout self) raises -> Slice: var line_coord = self._line_coord() return slice( line_coord.start + self.consumed, line_coord.end + self.consumed ) @always_inline fn read_n_coords[ lines: Int ](inout self) raises -> List[Slice]: return self._read_n_line[lines]() @always_inline fn _fill_buffer(inout self) raises -> Int: """Returns the number of bytes read into the buffer.""" self._left_shift() var nels = self.uninatialized_space() var in_buf = self.source.read_bytes(nels) if in_buf.num_elements() == 0: raise Error("EOF") if in_buf.num_elements() < nels: self._resize_buf(in_buf.num_elements() - nels, MAX_CAPACITY) self._store[self.check_ascii](in_buf, in_buf.num_elements()) self.consumed += nels return in_buf.num_elements() @always_inline fn _line_coord(inout self) raises -> Slice: if self._check_buf_state(): _ = self._fill_buffer() var coord: Slice var line_start = self.head var line_end = get_next_line_index(self.buf, self.head) coord = Slice(line_start, line_end) # Handle small buffers if coord.end == -1 and self.head == 0: for i in range(MAX_SHIFT): if coord.end != -1: return self._handle_windows_sep(coord) else: coord = self._line_coord_missing_line() # Handle incomplete lines across two chunks if coord.end == -1: _ = self._fill_buffer() return self._handle_windows_sep(self._line_coord_incomplete_line()) self.head = line_end + 1 # Handling Windows-syle line seperator if self.buf[line_end] == carriage_return: line_end -= 1 return slice(line_start, line_end) # TODO: Handle small Buffers, handle windows seperator, simplify @always_inline fn _read_n_line[lines: Int](inout self) raises -> List[Slice]: var coords = List[Slice](Slice(-1, -1)) var internal_head = self.head # TODO: Provide unrolling later using the @parameter for op for i in range(lines): if internal_head >= self.end: internal_head -= self.head # Resetting coordinates for read lines to the new buffer coordinates for j in range(i): coords[j] = Slice( coords[j].start - self.head, coords[j].end - self.head ) _ = self._fill_buffer() # self.head is reset to 0 var coord: Slice var line_start = internal_head var line_end = get_next_line_index(self.buf, internal_head) coord = Slice(line_start, line_end) # Handle small buffers if coord.end == -1 and self.head == 0: for i in range(MAX_SHIFT): if coord.end != -1: coords[i] = self._handle_windows_sep(coord) continue else: coord = self._line_coord_missing_line(internal_head) # Handle incomplete lines across two chunks if coord.end == -1: # Restting corrdinates to new buffer internal_head -= self.head line_start = internal_head for j in range(i): coords[j] = Slice( coords[j].start - self.head, coords[j].end - self.head ) _ = self._fill_buffer() # self.head is 0 # Try again to read the complete line var completet_line = self._line_coord_incomplete_line( internal_head ) coords[i] = completet_line line_end = completet_line.end internal_head = line_end + 1 coords[i] = self._handle_windows_sep(slice(line_start, line_end)) self.head = internal_head return coords @always_inline fn _line_coord_incomplete_line(inout self) raises -> Slice: if self._check_buf_state(): _ = self._fill_buffer() var line_start = self.head var line_end = get_next_line_index(self.buf, self.head) self.head = line_end + 1 if self.buf[line_end] == carriage_return: line_end -= 1 return slice(line_start, line_end) # Overload to allow reading missing line from a specific point @always_inline fn _line_coord_incomplete_line(inout self, pos: Int) raises -> Slice: if self._check_buf_state(): _ = self._fill_buffer() var line_start = pos var line_end = get_next_line_index(self.buf, pos) return slice(line_start, line_end) @always_inline fn _line_coord_missing_line(inout self) raises -> Slice: self._resize_buf(self.capacity(), MAX_CAPACITY) _ = self._fill_buffer() var line_start = self.head var line_end = get_next_line_index(self.buf, self.head) self.head = line_end + 1 return slice(line_start, line_end) @always_inline fn _line_coord_missing_line(inout self, pos: Int) raises -> Slice: self._resize_buf(self.capacity(), MAX_CAPACITY) _ = self._fill_buffer() var line_start = pos var line_end = get_next_line_index(self.buf, pos) return slice(line_start, line_end) @always_inline fn _store[ check_ascii: Bool = False ](inout self, in_tensor: Tensor[U8], amt: Int) raises: @parameter if check_ascii: self._check_ascii(in_tensor) cpy_tensor[U8](self.buf, in_tensor, amt, self.end, 0) self.end += amt @always_inline fn _left_shift(inout self): if self.head == 0: return var no_items = self.len() cpy_tensor[U8](self.buf, self.buf, no_items, 0, self.head) self.head = 0 self.end = no_items @always_inline fn _check_buf_state(inout self) -> Bool: if self.head >= self.end: self.head = 0 self.end = 0 return True else: return False @always_inline fn _resize_buf(inout self, amt: Int, max_capacity: Int) raises: if self.capacity() == max_capacity: raise Error("Buffer is at max capacity") var nels: Int if self.capacity() + amt > max_capacity: nels = max_capacity else: nels = self.capacity() + amt var x = Tensor[U8](nels) var nels_to_copy = min(self.capacity(), self.capacity() + amt) cpy_tensor[U8](x, self.buf, nels_to_copy, 0, 0) self.buf = x @always_inline @staticmethod fn _check_ascii(in_tensor: Tensor[U8]) raises: var aligned = math.align_down(in_tensor.num_elements(), simd_width) # alias bit_mask = 0xA0 # Between 32 and 127, makes a problems with 10 alias bit_mask = 0x80 # Non negative for i in range(0, aligned, simd_width): var vec = in_tensor.load[width=simd_width](i) var mask = vec & bit_mask for i in range(len(mask)): if mask[i] != 0: raise Error("Non ASCII letters found") for i in range(aligned, in_tensor.num_elements()): if in_tensor[i] & bit_mask != 0: raise Error("Non ASCII letters found") @always_inline fn _handle_windows_sep(self, in_slice: Slice) -> Slice: if self.buf[in_slice.end] != carriage_return: return in_slice return Slice(in_slice.start, in_slice.end - 1) ########################## Helpers functions, have no side effects ####################### @always_inline fn map_pos_2_buf(self, file_pos: Int) -> Int: return file_pos - self.consumed @always_inline fn len(self) -> Int: return self.end - self.head @always_inline fn capacity(self) -> Int: return self.buf.num_elements() @always_inline fn uninatialized_space(self) -> Int: return self.capacity() - self.end @always_inline fn usable_space(self) -> Int: return self.uninatialized_space() + self.head @always_inline fn __len__(self) -> Int: return self.end - self.head @always_inline fn __str__(self) -> String: var out = Tensor[U8](self.len()) cpy_tensor[U8](out, self.buf, self.len(), 0, self.head) return String(out._steal_ptr().bitcast[DType.uint8](), self.len()) fn __getitem__(self, index: Int) raises -> Scalar[U8]: if self.head <= index <= self.end: return self.buf[index] else: raise Error("Out of bounds") fn __getitem__(self, slice: Slice) raises -> Tensor[U8]: if slice.start >= self.head and slice.end <= self.end: var out = Tensor[U8](slice.end - slice.start) cpy_tensor[U8]( out, self.buf, slice.end - slice.start, 0, slice.start ) return out else: raise Error("Out of bounds") # TODO: Add a resize if the buffer is too small struct BufferedWriter: var sink: FileHandle var buf: Tensor[U8] var cursor: Int var written: Int fn __init__(inout self, out_path: String, buf_size: Int) raises: self.sink = open(out_path, "w") self.buf = Tensor[U8](buf_size) self.cursor = 0 self.written = 0 fn ingest(inout self, source: Tensor[U8]) raises -> Bool: if source.num_elements() > self.uninatialized_space(): self.flush_buffer() cpy_tensor[U8](self.buf, source, source.num_elements(), self.cursor, 0) self.cursor += source.num_elements() return True fn flush_buffer(inout self) raises: var out = Tensor[U8](self.cursor) cpy_tensor[U8](out, self.buf, self.cursor, 0, 0) var out_string = StringRef(out._steal_ptr(), self.cursor) self.sink.write(out_string) self.written += self.cursor self.cursor = 0 fn _resize_buf(inout self, amt: Int, max_capacity: Int = MAX_CAPACITY): var new_capacity = 0 if self.buf.num_elements() + amt > max_capacity: new_capacity = max_capacity else: new_capacity = self.buf.num_elements() + amt var new_tensor = Tensor[U8](new_capacity) cpy_tensor[U8](new_tensor, self.buf, self.cursor, 0, 0) swap(self.buf, new_tensor) fn uninatialized_space(self) -> Int: return self.capacity() - self.cursor fn capacity(self) -> Int: return self.buf.num_elements() fn close(inout self) raises: self.flush_buffer() self.sink.close() --- blazeseq/parser.mojo --- from blazeseq.record import FastqRecord, RecordCoord from .helpers import ( find_last_read_header, get_next_line, ) from blazeseq.CONSTS import * from blazeseq.stats import FullStats from blazeseq.iostream import BufferedLineIterator, FileReader import time struct RecordParser[validate_ascii: Bool = True, validate_quality: Bool = True]: var stream: BufferedLineIterator[FileReader, check_ascii=validate_ascii] var quality_schema: QualitySchema fn __init__(inout self, path: String, schema: String = "generic") raises -> None: self.stream = BufferedLineIterator[FileReader, check_ascii=validate_ascii]( path, DEFAULT_CAPACITY ) self.quality_schema = self._parse_schema(schema) fn parse_all(inout self) raises: while True: var record: FastqRecord record = self._parse_record() # print(record) record.validate_record() # ASCII validation is carried out in the reader @parameter if validate_quality: record.validate_quality_schema() @always_inline fn next(inout self) raises -> FastqRecord: """Method that lazily returns the Next record in the file.""" var record: FastqRecord record = self._parse_record() record.validate_record() # ASCII validation is carried out in the reader @parameter if validate_quality: record.validate_quality_schema() return record @always_inline fn _parse_record(inout self) raises -> FastqRecord: var line1 = self.stream.read_next_line() var line2 = self.stream.read_next_line() var line3 = self.stream.read_next_line() var line4 = self.stream.read_next_line() return FastqRecord(line1, line2, line3, line4, self.quality_schema) @staticmethod @always_inline fn _parse_schema(quality_format: String) -> QualitySchema: var schema: QualitySchema if quality_format == "sanger": schema = sanger_schema elif quality_format == "solexa": schema = solexa_schema elif quality_format == "illumina_1.3": schema = illumina_1_3_schema elif quality_format == "illumina_1.5": schema = illumina_1_5_schema elif quality_format == "illumina_1.8": schema = illumina_1_8 elif quality_format == "generic": schema = generic_schema else: print( """Uknown quality schema please choose one of 'sanger', 'solexa'," " 'illumina_1.3', 'illumina_1.5' 'illumina_1.8', or 'generic'. Parsing with generic schema.""" ) return generic_schema return schema struct CoordParser: var stream: BufferedLineIterator[FileReader] fn __init__(inout self, path: String) raises -> None: self.stream = BufferedLineIterator[FileReader](path, DEFAULT_CAPACITY) @always_inline fn parse_all(inout self) raises: while True: var record: RecordCoord record = self._parse_record() record.validate() @always_inline fn next(inout self) raises -> RecordCoord: var read: RecordCoord read = self._parse_record() read.validate() return read @always_inline fn _parse_record(inout self) raises -> RecordCoord: var line1 = self.stream.read_next_coord() if self.stream.buf[self.stream.map_pos_2_buf(line1.start)] != read_header: raise Error("Sequence Header is corrupt") var line2 = self.stream.read_next_coord() var line3 = self.stream.read_next_coord() if self.stream.buf[self.stream.map_pos_2_buf(line3.start)] != quality_header: raise Error("Quality Header is corrupt") var line4 = self.stream.read_next_coord() return RecordCoord(line1, line2, line3, line4) @always_inline fn _parse_record2(inout self) raises -> RecordCoord: var coords = self.stream.read_n_coords[4]() var n = 0 if self.stream.buf[coords[0].start] != read_header: print(coords[n], StringRef(self.stream.buf._ptr + coords[n].start, coords[n].end - coords[n].start)) raise Error("Sequence Header is corrupt") if self.stream.buf[coords[2].start] != quality_header: raise Error("Quality Header is corrupt") return RecordCoord(coords[0], coords[1], coords[2], coords[3]) --- blazeseq/record.mojo --- from blazeseq.helpers import slice_tensor, write_to_buff from blazeseq.CONSTS import * from blazeseq.iostream import BufferedLineIterator from utils.variant import Variant from tensor import Tensor from utils import Span from math import align_down, remainder alias TU8 = Tensor[U8] alias schema = Variant[String, QualitySchema] @value struct FastqRecord(Sized, Stringable, CollectionElement): """Struct that represent a single FastaQ record.""" var SeqHeader: TU8 var SeqStr: TU8 var QuHeader: TU8 var QuStr: TU8 var quality_schema: QualitySchema fn __init__( inout self, SH: TU8, SS: TU8, QH: TU8, QS: TU8, quality_schema: schema = "generic", ) raises: self.SeqHeader = SH self.QuHeader = QH self.SeqStr = SS self.QuStr = QS if quality_schema.isa[String](): self.quality_schema = self._parse_schema(quality_schema[String]) else: self.quality_schema = quality_schema[QualitySchema] fn __init__( inout self, SH: String, SS: String, QH: String, QS: String, quality_schema: schema = "generic", ): self.SeqHeader = Tensor[U8](SH.as_bytes()) self.SeqStr = Tensor[U8](SS.as_bytes()) self.QuHeader = Tensor[U8](QH.as_bytes()) self.QuStr = Tensor[U8](QS.as_bytes()) if quality_schema.isa[String](): var q: String = quality_schema[String] self.quality_schema = self._parse_schema(q) else: self.quality_schema = quality_schema[QualitySchema] @always_inline fn get_seq(self) -> String: var temp = self.SeqStr return String(temp._steal_ptr(), temp.num_elements()) @always_inline fn get_qulity(self) -> String: var temp = self.QuStr return String(temp._steal_ptr(), temp.num_elements()) @always_inline fn get_qulity_scores(self, quality_format: String) -> Tensor[U8]: var schema = self._parse_schema((quality_format)) return self.QuStr - schema.OFFSET @always_inline fn get_qulity_scores(self, schema: QualitySchema) -> Tensor[U8]: return self.QuStr - schema.OFFSET @always_inline fn get_qulity_scores(self, offset: UInt8) -> Tensor[U8]: return self.QuStr - offset @always_inline fn get_header(self) -> String: var temp = self.SeqHeader return String(temp._steal_ptr(), temp.num_elements()) @always_inline fn wirte_record(self) -> Tensor[U8]: return self.__concat_record_tensor() @always_inline fn validate_record(self) raises: if self.SeqHeader[0] != read_header: raise Error("Sequence Header is corrupt") if self.QuHeader[0] != quality_header: raise Error("Quality Header is corrupt") if self.len_record() != self.len_quality(): raise Error("Corrput Lengths") if self.len_qu_header() > 1: if self.len_qu_header() != self.len_seq_header(): raise Error("Quality Header is corrupt") if self.len_qu_header() > 1: for i in range(1, self.len_qu_header()): if self.QuHeader[i] != self.SeqHeader[i]: raise Error("Non matching headers") @always_inline fn validate_quality_schema(self) raises: for i in range(self.len_quality()): if ( self.QuStr[i] > self.quality_schema.UPPER or self.QuStr[i] < self.quality_schema.LOWER ): raise Error( "Corrput quality score according to proivded schema" ) @always_inline fn total_length(self) -> Int: return ( self.len_seq_header() + self.len_record() + self.len_qu_header() + self.len_quality() + 4 ) @always_inline fn __concat_record_tensor(self) -> Tensor[U8]: var final_list = List[UInt8](capacity=self.total_length()) for i in range(self.len_seq_header()): final_list.append(self.SeqHeader[i]) final_list.append(10) for i in range(self.len_record()): final_list.append(self.SeqStr[i]) final_list.append(10) for i in range(self.len_qu_header()): final_list.append(self.QuHeader[i]) final_list.append(10) for i in range(self.len_quality()): final_list.append(self.QuStr[i]) final_list.append(10) return Tensor[U8](final_list) @always_inline fn __concat_record_str(self) -> String: if self.total_length() == 0: return "" var line1 = self.SeqHeader var line1_str = String(line1._steal_ptr(), self.len_seq_header() + 1) var line2 = self.SeqStr var line2_str = String(line2._steal_ptr(), self.len_record() + 1) var line3 = self.QuHeader var line3_str = String(line3._steal_ptr(), self.len_qu_header() + 1) var line4 = self.QuStr var line4_str = String(line4._steal_ptr(), self.len_quality() + 1) return ( line1_str + "\n" + line2_str + "\n" + line3_str + "\n" + line4_str + "\n" ) @staticmethod @always_inline fn _parse_schema(quality_format: String) -> QualitySchema: var schema: QualitySchema if quality_format == "sanger": schema = sanger_schema elif quality_format == "solexa": schema = solexa_schema elif quality_format == "illumina_1.3": schema = illumina_1_3_schema elif quality_format == "illumina_1.5": schema = illumina_1_5_schema elif quality_format == "illumina_1.8": schema = illumina_1_8 elif quality_format == "generic": schema = generic_schema else: print( "Uknown quality schema please choose one of 'sanger', 'solexa'," " 'illumina_1.3', 'illumina_1.5' 'illumina_1.8', or 'generic'" ) return generic_schema return schema # BUG: returns Smaller strings that expected. @always_inline fn __str__(self) -> String: return self.__concat_record_str() @always_inline fn __len__(self) -> Int: return self.SeqStr.num_elements() @always_inline fn len_record(self) -> Int: return self.SeqStr.num_elements() @always_inline fn len_quality(self) -> Int: return self.QuStr.num_elements() @always_inline fn len_qu_header(self) -> Int: return self.QuHeader.num_elements() @always_inline fn len_seq_header(self) -> Int: return self.SeqHeader.num_elements() @always_inline fn hash[bits: Int = 3, length: Int = 64 // bits](self) -> UInt64: """Hashes the first xx bp (if possible) into one 64bit. Max length is 64/nBits per bp. """ @parameter if length < 32: return self._hash_packed(self.SeqStr._ptr, length) return self._hash_additive(self.SeqStr._ptr, length) @staticmethod fn _hash_packed[bits: Int = 3](bytes: DTypePointer[DType.uint8], length: Int) -> UInt64: """ Hash the DNA strand to into 64bits unsigned number using xbit encoding. If the length of the bytes strand is longer than 32 bps, the hash is truncated for the first 32 bps. """ alias rnge: Int = 64 // bits var hash: UInt64 = 0 var mask = (0b1 << bits) - 1 for i in range(min(rnge, length)): # Mask for for first <n> significant bits. var base_val = bytes[i] & mask hash = (hash << bits) | int(base_val) return hash @staticmethod fn _hash_additive[bits: Int = 3](bytes: DTypePointer[DType.uint8], length: Int) -> UInt64: """Hashes DNA sequences longer than 32bps. It hashes 16bps spans of the sequences and using 2 or 3 bit encoding and adds them to the hash. """ constrained[bits <=3, "Additive hashing can only hash up to 3bit resolution"]() var full_hash: UInt64 = 0 var mask = (0b1 << bits) - 1 var rounds = align_down(length, 16) var rem = length % 16 for round in range(rounds): var interim_hash: UInt64 = 0 @parameter for i in range(16): var base_val = bytes[i + 16*round] & mask interim_hash = interim_hash << bits | int(base_val) full_hash = full_hash + interim_hash if rem > 0: var interim_hash: UInt64 = 0 for i in range(rem): var base_val = bytes[i + 16*rounds] & mask interim_hash = interim_hash << bits | int(base_val) full_hash = full_hash + interim_hash return full_hash @always_inline fn __hash__(self) -> Int: return int(self.hash()) @always_inline fn __eq__(self, other: Self) -> Bool: return self.__hash__() == other.__hash__() fn __ne__(self, other: Self) -> Bool: return self.__hash__() != other.__hash__() @value struct RecordCoord(Sized, Stringable, CollectionElement): """Struct that represent coordinates of a FastqRecord in a chunk. Provides minimal validation of the record. Mainly used for fast parsing. """ var SeqHeader: Slice var SeqStr: Slice var QuHeader: Slice var QuStr: Slice fn __init__( inout self, SH: Slice, SS: Slice, QH: Slice, QS: Slice, ): self.SeqHeader = SH self.SeqStr = SS self.QuHeader = QH self.QuStr = QS @always_inline fn validate(self) raises: if self.seq_len() != self.qu_len(): raise Error("Corrput Lengths") if ( self.qu_header_len() > 1 and self.qu_header_len() != self.seq_header_len() ): raise Error("Corrput Lengths") @always_inline fn seq_len(self) -> Int32: return self.SeqStr.end - self.SeqStr.start @always_inline fn qu_len(self) -> Int32: return self.QuStr.end - self.QuStr.start @always_inline fn qu_header_len(self) -> Int32: return self.QuHeader.end - self.QuHeader.start @always_inline fn seq_header_len(self) -> Int32: return self.SeqHeader.end - self.SeqHeader.start fn __len__(self) -> Int: return int(self.seq_len()) fn __str__(self) -> String: return ( String("SeqHeader: ") + str(self.SeqHeader.start) + "..." + str(self.SeqHeader.end) + "\nSeqStr: " + str(self.SeqStr.start) + "..." + str(self.SeqStr.end) + "\nQuHeader: " + str(self.QuHeader.start) + "..." + str(self.QuHeader.end) + "\nQuStr: " + str(self.QuStr.start) + "..." + str(self.QuStr.end) ) --- blazeseq/stats.mojo --- """This module should hold aggregate statistics about all the record which have been queried by the Parser, regardless of the caller function. """ from blazeseq.record import FastqRecord from blazeseq.helpers import write_to_buff from blazeseq.helpers import cpy_tensor from tensor import TensorShape from collections import Dict, KeyElement import time from tensor import Tensor from python import Python from utils.static_tuple import StaticTuple alias py_lib: String = "./.pixi/envs/default/lib/python3.12/site-packages/" fn hash_list() -> List[UInt64]: var li: List[UInt64] = List[UInt64]( _seq_to_hash("AGATCGGAAGAG"), _seq_to_hash("TGGAATTCTCGG"), _seq_to_hash("GATCGTCGGACT"), _seq_to_hash("CTGTCTCTTATA"), _seq_to_hash("AAAAAAAAAAAA"), _seq_to_hash("GGGGGGGGGGGG"), ) return li alias WIDTH = 5 alias MAX_READS = 1_000_000 alias MAX_QUALITY = 93 trait Analyser(CollectionElement, Stringable): fn tally_read(inout self, record: FastqRecord): ... fn report(self) -> Tensor[DType.int64]: ... fn __str__(self) -> String: ... @value struct FullStats(Stringable, CollectionElement): var num_reads: Int64 var total_bases: Int64 var bp_dist: BasepairDistribution var len_dist: LengthDistribution var qu_dist: QualityDistribution var cg_content: CGContent var dup_reads: DupReads var kmer_content: KmerContent fn __init__(inout self): self.num_reads = 0 self.total_bases = 0 self.len_dist = LengthDistribution() self.bp_dist = BasepairDistribution() self.qu_dist = QualityDistribution() self.cg_content = CGContent() self.dup_reads = DupReads() self.kmer_content = KmerContent(hash_list(), 12) @always_inline fn tally(inout self, record: FastqRecord): self.num_reads += 1 self.total_bases += record.len_record() self.bp_dist.tally_read(record) self.len_dist.tally_read(record) self.cg_content.tally_read(record) # Almost Free self.dup_reads.tally_read(record) self.kmer_content.tally_read(record) # BUG: There is a bug here which causes core dumped self.qu_dist.tally_read( record ) # Expensive operation, a lot of memory access @always_inline fn plot(inout self) raises: self.bp_dist.plot() self.cg_content.plot() self.len_dist.plot() self.qu_dist.plot() self.dup_reads.plot() fn __str__(self) -> String: return ( String("Number of Reads: ") + str(self.num_reads) + ". \n" + "Number of bases: " + str(self.total_bases) + str(self.bp_dist) + str(self.len_dist) + str(self.qu_dist) + str(self.cg_content) + str(self.kmer_content) + str(self.dup_reads) ) @value struct BasepairDistribution(Analyser): var bp_dist: Tensor[DType.int64] var max_length: Int fn __init__(inout self): var shape = TensorShape(VariadicList[Int](1, WIDTH)) self.bp_dist = Tensor[DType.int64](shape) self.max_length = 0 fn tally_read(inout self, record: FastqRecord): if record.len_record() > self.max_length: self.max_length = record.len_record() var new_tensor = grow_matrix( self.bp_dist, TensorShape(self.max_length, WIDTH) ) swap(self.bp_dist, new_tensor) for i in range(record.len_record()): # Remineder of first 5 bits seperates N from T var base_val = int((record.SeqStr[i] & 0b11111) % WIDTH) var index = VariadicList[Int](i, base_val) self.bp_dist[index] += 1 fn report(self) -> Tensor[DType.int64]: return self.bp_dist fn plot(self) raises: Python.add_to_path(py_lib) var plt = Python.import_module("matplotlib.pyplot") var arr = matrix_to_numpy(self.bp_dist) var x = plt.subplots() # Create a figure var fig = x[0] var ax = x[1] ax.plot(arr) fig.savefig("BasepairDistribution.png") fn __str__(self) -> String: return String("\nBase_pair_dist_matrix: ") + str(self.report()) @value struct CGContent(Analyser): var cg_content: Tensor[DType.int64] fn __init__(inout self): self.cg_content = Tensor[DType.int64](100) fn tally_read(inout self, record: FastqRecord): var cg_num = 0 for index in range(0, record.len_record()): if ( record.SeqStr[index] & 0b111 == 3 or record.SeqStr[index] & 0b111 == 7 ): cg_num += 1 var read_cg_content = int(round(cg_num * 100 / record.len_record())) self.cg_content[read_cg_content] += 1 fn report(self) -> Tensor[DType.int64]: return self.cg_content fn plot(self) raises: Python.add_to_path(py_lib) var plt = Python.import_module("matplotlib.pyplot") var arr = tensor_to_numpy_1d(self.cg_content) var x = plt.subplots() # Create a figure var fig = x[0] var ax = x[1] ax.plot(arr) fig.savefig("CGContent.png") fn __str__(self) -> String: return String("\nThe CpG content tensor is: ") + str(self.cg_content) # TODO: You should extraplolate from the number of reads in the unique reads to how it would look like for everything. @value struct DupReads(Analyser): var unique_dict: Dict[FastqRecord, Int64] var unique_reads: Int var count_at_max: Int var n: Int var corrected_counts: Dict[Int, Float64] fn __init__(inout self): self.unique_dict = Dict[FastqRecord, Int64]() self.unique_reads = 0 self.count_at_max = 0 self.n = 0 self.corrected_counts = Dict[Int, Float64]() fn tally_read(inout self, record: FastqRecord): self.n += 1 if record in self.unique_dict: try: self.unique_dict[record] += 1 return except: print("error") pass if self.unique_reads <= MAX_READS: self.unique_dict[record] = 1 self.unique_reads += 1 if self.unique_reads == MAX_READS: self.count_at_max = self.n else: pass fn predict_reads(inout self): # Construct Duplication levels dict var dup_dict = Dict[Int, Int]() for entry in self.unique_dict.values(): if int(entry[]) in dup_dict: try: dup_dict[int(entry[])] += 1 except: print("error") else: dup_dict[int(entry[])] = 0 # Correct reads levels var corrected_reads = Dict[Int, Float64]() for entry in dup_dict: try: var count = dup_dict[entry[]] var level = entry[] var corrected_count = self.correct_values( level, count, self.count_at_max, self.n ) corrected_reads[level] = corrected_count except: print("Error") self.corrected_counts = corrected_reads # Check how it is done in Falco. @staticmethod fn correct_values( dup_level: Int, count_at_level: Int, count_at_max: Int, total_count: Int ) -> Float64: if count_at_max == total_count: return count_at_level if total_count - count_at_level < count_at_max: return count_at_level var pNotSeeingAtLimit: Float64 = 1 var limitOfCaring = Float64(1) - ( count_at_level / (count_at_level + 0.01) ) for i in range(count_at_max): pNotSeeingAtLimit *= ((total_count - i) - dup_level) / ( total_count - i ) if pNotSeeingAtLimit < limitOfCaring: pNotSeeingAtLimit = 0 break var pSeeingAtLimit: Float64 = 1 - pNotSeeingAtLimit var trueCount = count_at_level / pSeeingAtLimit return trueCount fn report(self) -> Tensor[DType.int64]: var report = Tensor[DType.int64](1) report[0] = len(self.unique_dict) return report fn __str__(self) -> String: return String("\nNumber of duplicated reads is") + str(self.report()) fn plot(inout self) raises: self.predict_reads() # Make this a matrix var temp_tensor = Tensor[DType.int64]( len(self.corrected_counts) * 2 + 1 ) var i = 0 for index in self.corrected_counts: print(index[]) print(self.corrected_counts[index[]]) temp_tensor[i * 2] = index[] temp_tensor[i * 2 + 1] = self.corrected_counts[index[]] i += 1 var np = Python.import_module("numpy") var arr = tensor_to_numpy_1d(temp_tensor) np.save("arr_DupReads.npy", arr) @value struct LengthDistribution(Analyser): var length_vector: Tensor[DType.int64] fn __init__(inout self): self.length_vector = Tensor[DType.int64](0) fn tally_read(inout self, record: FastqRecord): if record.len_record() > self.length_vector.num_elements(): var new_tensor = grow_tensor( self.length_vector, record.len_record() ) swap(self.length_vector, new_tensor) self.length_vector[record.len_record() - 1] += 1 @always_inline fn length_average(self, num_reads: Int) -> Float64: var cum: Int64 = 0 for i in range(self.length_vector.num_elements()): cum += self.length_vector[i] * (i + 1) return int(cum) / num_reads fn report(self) -> Tensor[DType.int64]: return self.length_vector fn plot(self) raises: Python.add_to_path(py_lib) var plt = Python.import_module("matplotlib.pyplot") var np = Python.import_module("numpy") var mtp = Python.import_module("matplotlib") var arr = tensor_to_numpy_1d(self.length_vector) var x = plt.subplots() # Create a figure var fig = x[0] var ax = x[1] var arr2 = np.insert(arr, 0, 0) var arr3 = np.append(arr2, 0) ax.plot(arr3) ax.xaxis.set_major_locator(mtp.ticker.MaxNLocator(integer=True)) ax.set_xlim(np.argmax(arr3 > 0) - 1, len(arr3) - 1) ax.set_ylim(0) fig.savefig("LengthDistribution.png") fn __str__(self) -> String: return String("\nLength Distribution: ") + str(self.length_vector) # TODO: FIX this struct to reflect FastQC @value struct QualityDistribution(Analyser): var qu_dist: Tensor[DType.int64] var max_length: Int var max_qu: Int fn __init__(inout self): var shape = TensorShape(1, 40) self.qu_dist = Tensor[DType.int64](shape) self.max_length = 0 self.max_qu = 0 fn tally_read(inout self, record: FastqRecord): if record.len_quality() > self.max_length: self.max_length = record.len_record() var new_shape = TensorShape(self.max_length, 40) var new_tensor = grow_matrix(self.qu_dist, new_shape) swap(self.qu_dist, new_tensor) for i in range(record.len_quality()): var base_qu = int(record.QuStr[i] - record.quality_schema.OFFSET) var index = VariadicList[Int](i, base_qu) self.qu_dist[index] += 1 if base_qu > self.max_qu: self.max_qu = base_qu # Use this answer for plotting: https://stackoverflow.com/questions/58053594/how-to-create-a-boxplot-from-data-with-weights # TODO: Make an abbreviator of the plot to get always between 50-60 bars per plot # TODO: Stylize the plot fn plot(self) raises: var arr = matrix_to_numpy(self.qu_dist) Python.add_to_path(py_lib) var np = Python.import_module("numpy") var plt = Python.import_module("matplotlib.pyplot") var sns = Python.import_module("seaborn") var py_builtin = Python.import_module("builtins") np.save("arr_qu.npy", arr) ################# Quality Histogram ################## var mean_line = np.sum(arr * np.arange(1, 41), axis=1) / np.sum( arr, axis=1 ) var cum_sum = np.cumsum(arr, axis=1) var total_counts = np.reshape(np.sum(arr, axis=1), (100, 1)) var median = np.argmax(cum_sum > total_counts / 2, axis=1) var Q75 = np.argmax(cum_sum > total_counts * 0.75, axis=1) var Q25 = np.argmax(cum_sum > total_counts * 0.25, axis=1) var IQR = Q75 - Q25 var whislo = np.full(len(IQR), None) var whishi = np.full(len(IQR), None) var x = plt.subplots() var fig = x[0] var ax = x[1] var l = py_builtin.list() for i in range(len(IQR)): var stat: PythonObject = py_builtin.dict() stat["med"] = median[i] stat["q1"] = Q25[i] stat["q3"] = Q75[i] stat["whislo"] = whislo[i] stat["whishi"] = whishi[i] l.append(stat) ax.bxp(l, showfliers=False) ax.plot(mean_line) fig.savefig("QualityDistribution.png") ############################################################### ### Quality Heatmap ### ############################################################### var y = plt.subplots() var fig2 = y[0] var ax2 = y[1] sns.heatmap(np.flipud(arr).T, cmap="Blues", robust=True, ax=ax2) fig2.savefig("QualityDistributionHeatMap.png") fn report(self) -> Tensor[DType.int64]: var final_shape = TensorShape(self.max_qu, self.max_length) var final_t = Tensor[DType.int64](final_shape) for i in range(self.max_qu): for j in range(self.max_length): var index = VariadicList[Int](i, j) final_t[index] = self.qu_dist[index] return final_t fn __str__(self) -> String: return String("\nQuality_dist_matrix: ") + str(self.report()) @value struct KmerContent[bits: Int = 3](Analyser): var kmer_len: Int var hash_counts: Tensor[DType.int64] var hash_list: List[UInt64] fn __init__(inout self, hashes: List[UInt64], kmer_len: Int = 0): self.kmer_len = min(kmer_len, 64 // bits) self.hash_list = hashes self.hash_counts = Tensor[DType.int64](len(self.hash_list)) fn report(self) -> Tensor[DType.int64]: return self.hash_counts # TODO: Check if it will be easier to use the bool_tuple and hashes as a list instead @always_inline fn tally_read(inout self, record: FastqRecord): var hash: UInt64 = 0 var end = 0 # Make a custom bit mask of 1s by certain length var mask: UInt64 = (0b1 << self.kmer_len * bits) - 1 var neg_mask = mask >> bits var bit_shift = (0b1 << bits) - 1 # Check initial Kmer if len(self.hash_list) > 0: self._check_hashes(hash) for i in range(end, record.len_record()): # Remove the most signifcant 3 bits hash = hash & neg_mask # Mask for the least sig. three bits, add to hash var rem = record.SeqStr[i] & bit_shift hash = (hash << bits) + int(rem) if len(self.hash_list) > 0: self._check_hashes(hash) @always_inline fn _check_hashes(inout self, hash: UInt64): for i in range(len(self.hash_list)): if hash == self.hash_list[i]: self.hash_counts[i] += 1 fn __str__(self) -> String: return String("\nhash count table is ") + str(self.hash_counts) # TODO: Make this also parametrized on the number of bits per bp fn _seq_to_hash(seq: String) -> UInt64: var hash = 0 for i in range(0, len(seq)): # Remove the most signifcant 3 bits hash = hash & 0x1FFFFFFFFFFFFFFF # Mask for the least sig. three bits, add to hash var rem = ord(seq[i]) & 0b111 hash = (hash << 3) + int(rem) return hash # TODO: Make this also parametrized on the number of bits per bp, this now works only for 3bits fn _hash_to_seq(hash: UInt64) -> String: var inner = hash var out: String = "" var sig2bit: UInt64 for i in range(21, -1, -1): sig2bit = (inner >> (i * 3)) & 0b111 if sig2bit == 1: out += "A" if sig2bit == 3: out += "C" if sig2bit == 7: out += "G" if sig2bit == 4: out += "T" if sig2bit == 6: out += "N" return out def tensor_to_numpy_1d[T: DType](tensor: Tensor[T]) -> PythonObject: Python.add_to_path(py_lib) np = Python.import_module("numpy") ar = np.zeros(tensor.num_elements()) for i in range(tensor.num_elements()): ar.itemset(i, tensor[i]) return ar def matrix_to_numpy[T: DType](tensor: Tensor[T]) -> PythonObject: np = Python.import_module("numpy") ar = np.zeros([tensor.shape()[0], tensor.shape()[1]]) for i in range(tensor.shape()[0]): for j in range(tensor.shape()[1]): ar.itemset((i, j), tensor[i, j]) return ar fn grow_tensor[ T: DType, ](old_tensor: Tensor[T], num_ele: Int) -> Tensor[T]: var new_tensor = Tensor[T](num_ele) cpy_tensor(new_tensor, old_tensor, old_tensor.num_elements(), 0, 0) return new_tensor fn grow_matrix[ T: DType ](old_tensor: Tensor[T], new_shape: TensorShape) -> Tensor[T]: var new_tensor = Tensor[T](new_shape) for i in range(old_tensor.shape()[0]): for j in range(old_tensor.shape()[1]): new_tensor[VariadicList(i, j)] = old_tensor[VariadicList(i, j)] return new_tensor # TODO: Add module for adapter content @value struct AdapterContent(Analyser): fn tally_read(inout self, read: FastqRecord): pass fn report(self) -> Tensor[DType.int64]: return Tensor[DType.int64]() fn __str__(self) -> String: return "" --- cli.mojo --- import time from sys import argv from blazeseq.parser import CoordParser, RecordParser from blazeseq.iostream import FileReader from blazeseq.stats import FullStats fn main() raises: var fast_mode = False var validate_ascii = False var validate_quality = False var vars = argv() if len(vars) == 1: print(help_msg) if vars[1] == "-h" or vars[1] == "--help": print(help_msg) var path = vars[len(vars) - 1] for opt in vars: if opt == "--validate-ascii": validate_ascii = True if opt == "-a": validate_ascii = True if opt == "--fast-mode": fast_mode = True if opt == "-f": fast_mode = True if opt == "--validate-quality": validate_quality = True if opt == "-q": validate_quality = True var schema: StringRef = "generic" if validate_quality: for i in range(len(vars)): if vars[i] == "-q" or vars[i] == "--validate-quality": if vars[i + 1] != "-" or vars[i + 1] != "--": schema = vars[i + 1] if fast_mode: var parser = CoordParser(path) run_coord_parser(parser) else: run_record_parser(path, validate_ascii, validate_quality, schema) fn run_record_parser( path: String, validate_ascii: Bool, validate_quality: Bool, schema: StringRef ) raises: if validate_ascii and validate_quality: var parser = RecordParser[validate_ascii=True, validate_quality=True]( path, schema ) run_record_parser_session(parser) elif validate_ascii and not validate_quality: var parser = RecordParser[validate_ascii=True, validate_quality=False]( path, schema ) run_record_parser_session(parser) elif not validate_ascii and validate_quality: var parser = RecordParser[validate_ascii=False, validate_quality=True]( path, schema ) run_record_parser_session(parser) elif not validate_ascii and not validate_quality: var parser = RecordParser[validate_ascii=False, validate_quality=False]( path, schema ) run_record_parser_session(parser) fn run_record_parser_session(inout parser: RecordParser) raises: var reads = 0 var strt = time.now() while True: try: var record = parser.next() reads += 1 if reads % 1_000_000 == 0: var current = time.now() var reads_p_min: Float64 = reads / ((current - strt) / 1e9) * 60 var rounded = int(round(reads_p_min)) print("\33[H") print("\033[J") print("Number of reads processed is:", reads) print("Speed:", rounded, "reads/min") except: var current = time.now() var elapsed = (current - strt) / 1e9 var reads_p_min: Float64 = reads / ((current - strt) / 1e9) * 60 var rounded = int(round(reads_p_min)) print( "total of", reads, " reads parsed in:", elapsed, "seconds.\n", "Average speed:", rounded, "reads/min", ) break fn run_coord_parser(inout parser: CoordParser) raises: var reads = 0 var strt = time.now() while True: try: var record = parser.next() reads += 1 if reads % 1_000_000 == 0: var current = time.now() var reads_p_min: Float64 = reads / ((current - strt) / 1e9) * 60 var rounded = int(round(reads_p_min)) print("\33[H") print("\033[J") print("Number of reads processed is:", reads) print("Speed:", rounded, "reads/min") except: var current = time.now() var elapsed = (current - strt) / 1e9 var reads_p_min: Float64 = reads / ((current - strt) / 1e9) * 60 var rounded = int(round(reads_p_min)) print("\33[H") print("\033[J") print( "total of", reads, " reads parsed in:", elapsed, "seconds.\n", "Average speed:", rounded, "reads/min", ) break alias help_msg = """ Usage: blazeseq [OPTION]... path/to/file Options: -h, --help: Prints this help message. -f, --fast-mode: Use a faster parser (). Use a faster parser (may skip some validations). -a, --validate-ascii [schema]: Validate that the input file is ASCII encoded (not available in fast-mode). -q, --validate-quality: Perform additional quality checks on the parsed data (not available in fast-mode). Description: Blaze-seq is a verstaile FASTQ parser, It offers different options to control the parsing behavior: Fast Mode: Using -f or --fast-mode enables a faster parser but only validates read headers/matching ID lengths. This can be useful for initial processing of large files. Validation: By default, all data is assumed to be valid. You can enable specific validations using the following options: -a or --validate-ascii: Ensures the file is encoded in ASCII characters. -q or --validate-quality: Performs checks on the read quality according to the provided quality schema. availble schemas are (sanger, solexa, illumina_1.3', 'illumina_1.5' 'illumina_1.8'). The program currently only outputs limited parsing information, including the number of records processed and the parsing speed (reads per minute). """ --- test/__init__.mojo --- --- test/test_coord_parser.mojo --- """Testing for the parser on test suite of valid and invalid FASTQ files used for testing by BioJava, BioPerl, and Biopython projects. File were downloaded from BioJava. 'https://github.com/biojava/biojava/tree/master/biojava-genome%2Fsrc%2Ftest%2Fresources%2Forg%2Fbiojava%2Fnbio%2Fgenome%2Fio%2Ffastq' As CoordParser only checks the headers and lengths of the of record component, tests were limited to only those cases. """ from blazeseq import CoordParser from testing import assert_raises alias test_dir = "test/test_data/fastq_parser/" alias corrput_qu_score = "Corrput quality score according to proivded schema" alias EOF = "EOF" alias cor_len = "Corrput Lengths" alias cor_seq_hed = "Sequence Header is corrupt" alias cor_qu_hed = "Quality Header is corrupt" alias non_mat_hed = "Non matching headers" fn test_invalid_file(file: String, msg: String = "") raises: try: var parser = CoordParser(test_dir + file) parser.parse_all() except Error: var err_msg = Error._message() if err_msg == msg: return else: print(err_msg) print(file) raise fn test_valid_file(file: String, schema: String = "generic") raises: try: var parser = CoordParser(test_dir + file) parser.parse_all() except Error: var err_msg = Error._message() if err_msg == "EOF": return else: print(file) print(err_msg) raise fn test_invalid() raises: test_invalid_file("empty.fastq", EOF) test_invalid_file("error_long_qual.fastq", cor_len) test_invalid_file("error_no_qual.fastq", cor_len) test_invalid_file("error_trunc_in_plus.fastq", cor_len) test_invalid_file("error_trunc_at_qual.fastq", cor_len) test_invalid_file("error_double_qual.fastq", cor_seq_hed) test_invalid_file("error_trunc_at_seq.fastq", cor_qu_hed) test_invalid_file("error_trunc_in_seq.fastq", cor_qu_hed) test_invalid_file("error_trunc_in_title.fastq", cor_qu_hed) test_invalid_file("error_double_seq.fastq", cor_qu_hed) test_invalid_file("error_trunc_at_plus.fastq", cor_qu_hed) test_invalid_file("solexa-invalid-description.fastq", cor_seq_hed) test_invalid_file("solexa-invalid-repeat-description.fastq", cor_len) test_invalid_file("sanger-invalid-description.fastq", cor_seq_hed) test_invalid_file("sanger-invalid-repeat-description.fastq", cor_len) test_invalid_file("illumina-invalid-description.fastq", cor_seq_hed) test_invalid_file("illumina-invalid-repeat-description.fastq", cor_len) test_invalid_file("error_short_qual.fastq", cor_len) test_invalid_file("error_trunc_in_qual.fastq", cor_len) ### CoordParsers fails fests of the record content, as it can not provide guarantees about record content ##### # test_invalid_file("error_diff_ids.fastq", non_mat_hed) # test_invalid_file("error_qual_null.fastq", corrput_qu_score) # test_invalid_file("error_qual_vtab.fastq", corrput_qu_score) # test_invalid_file("error_tabs.fastq", cor_seq_hed) # test_invalid_file("error_qual_tab.fastq", cor_seq_hed) # test_invalid_file("error_qual_unit_sep.fastq", corrput_qu_score) fn test_valid() raises: test_valid_file("example.fastq") test_valid_file("illumina_example.fastq", "illumina_1.3") test_valid_file("illumina_faked.fastq", "illumina_1.3") test_valid_file("illumina_full_range_as_illumina.fastq", "illumina_1.3") test_valid_file("illumina_full_range_as_sanger.fastq", "sanger") test_valid_file("illumina_full_range_as_solexa.fastq", "solexa") test_valid_file("illumina_full_range_original_illumina.fastq", "illumina_1.3") test_valid_file("longreads_as_illumina.fastq", "illumina_1.3") test_valid_file("longreads_as_sanger.fastq", "sanger") test_valid_file("longreads_as_solexa.fastq", "solexa") test_valid_file("misc_dna_as_illumina.fastq", "illumina_1.3") test_valid_file("misc_dna_as_sanger.fastq", "sanger") test_valid_file("misc_dna_as_solexa.fastq", "solexa") test_valid_file("misc_dna_original_sanger.fastq", "sanger") test_valid_file("misc_rna_as_illumina.fastq", "illumina_1.3") test_valid_file("misc_rna_as_sanger.fastq", "sanger") test_valid_file("misc_rna_as_solexa.fastq", "solexa") test_valid_file("misc_rna_original_sanger.fastq", "sanger") test_valid_file("sanger_93.fastq", "sanger") test_valid_file("sanger_faked.fastq", "sanger") test_valid_file("sanger_full_range_as_illumina.fastq", "illumina_1.3") test_valid_file("sanger_full_range_as_sanger.fastq", "sanger") test_valid_file("sanger_full_range_as_solexa.fastq", "solexa") test_valid_file("sanger_full_range_original_sanger.fastq", "sanger") test_valid_file("solexa_example.fastq", "solexa") test_valid_file("solexa_faked.fastq", "solexa") test_valid_file("solexa_full_range_as_illumina.fastq", "illumina_1.3") test_valid_file("solexa_full_range_as_sanger.fastq", "sanger") test_valid_file("solexa_full_range_as_solexa.fastq", "solexa") test_valid_file("solexa_full_range_original_solexa.fastq", "solexa") test_valid_file("test1_sanger.fastq", "sanger") test_valid_file("test2_solexa.fastq", "solexa") test_valid_file("test3_illumina.fastq", "illumina_1.3") test_valid_file("wrapping_as_illumina.fastq", "illumina_1.3") test_valid_file("wrapping_as_sanger.fastq", "sanger") test_valid_file("wrapping_as_solexa.fastq", "solexa") fn main() raises: test_invalid() test_valid() --- test/test_data/fastq_parser/empty.fastq --- --- test/test_data/fastq_parser/error_diff_ids.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_124 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_double_qual.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_double_seq.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_long_qual.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWYY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_no_qual.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGC +SLXA-B3_649_FC8437_R1_1_1_850_123 @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 --- test/test_data/fastq_parser/error_qual_del.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_qual_escape.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_qual_null.fastq --- @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_qual_space.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYY WWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_qual_tab.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYY YYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_qual_unit_sep.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_qual_vtab.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYY YYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_short_qual.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYS @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/error_spaces.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAA TACCTTTGTA GAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYY YYYYYYYYYW YWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGA AAGAGAAATG AGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYY WYYYYWWYYY WYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTT GATCATGATG ATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYY YYYYWYYWYY SYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAA GTTTTTCTCA ACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYY YYYYYYYYYW WWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTT AATGGCATAC ACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYY YWYYYYWYWW UWWWQQ --- test/test_data/fastq_parser/error_tabs.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAA TACCTTTGTA GAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYY YYYYYYYYYW YWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGA AAGAGAAATG AGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYY WYYYYWWYYY WYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTT GATCATGATG ATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYY YYYYWYYWYY SYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAA GTTTTTCTCA ACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYY YYYYYYYYYW WWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTT AATGGCATAC ACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYY YWYYYYWYWW UWWWQQ --- test/test_data/fastq_parser/error_trunc_at_plus.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA --- test/test_data/fastq_parser/error_trunc_at_qual.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 --- test/test_data/fastq_parser/error_trunc_at_seq.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 --- test/test_data/fastq_parser/error_trunc_in_plus.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC --- test/test_data/fastq_parser/error_trunc_in_qual.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQ --- test/test_data/fastq_parser/error_trunc_in_seq.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGG --- test/test_data/fastq_parser/error_trunc_in_title.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_ --- test/test_data/fastq_parser/example.fastq --- @EAS54_6_R1_2_1_413_324 CCCTTCTTGTCTTCAGCGTTTCTCC + ;;3;;;;;;;;;;;;7;;;;;;;88 @EAS54_6_R1_2_1_540_792 TTGGCAGGCCAAGGCCGATGGATCA + ;;;;;;;;;;;7;;;;;-;;;3;83 @EAS54_6_R1_2_1_443_348 GTTGCTTCTGGCGTGGGTGGGGGGG + ;;;;;;;;;;;9;7;;.7;393333 --- test/test_data/fastq_parser/illumina-invalid-description.fastq --- invalid description ACTG + ZZZZ --- test/test_data/fastq_parser/illumina-invalid-repeat-description.fastq --- @description ACTG +invalid repeat description ZZZZ --- test/test_data/fastq_parser/illumina_example.fastq --- @SNPSTER:5:1:3:167#0/1 TTACCAATGACCAAATCNAAGAAATGACTCGCAAGG +SNPSTER:5:1:3:167#0/1 aa\aba_aaaaaa^`a^D[ZQ\`^`[`_`WEYT[[_ @SNPSTER:5:1:3:1080#0/1 TCTACCATGAACAAAATGTGACTCATATCTAAACCA +SNPSTER:5:1:3:1080#0/1 a_aa_``a[`_^`_^^_K[N[^`_`_S_Z`]^_^^^ @SNPSTER:5:1:3:393#0/1 CAACCATCAGCATGAGCCTGTCGCATTGCATTCATC +SNPSTER:5:1:3:393#0/1 aaaab^baaaaaa]XJZ`a^_a]aa`_Z_[`aa`aa @SNPSTER:5:1:3:115#0/1 AAGGTTAGTGCTGAGGTTGACTTAGTTCATCAGCAA +SNPSTER:5:1:3:115#0/1 aaab_a`a_`aaa_Y][`^_aa_Y_aaa_aa_aa_a @SNPSTER:5:1:3:910#0/1 GTTTGAATATTAGACATAATTTATCCTCAATTAAGG +SNPSTER:5:1:3:910#0/1 `aaa]]_a]ba^a__^b\[aaa]a^_a^^YGS`[U[ @SNPSTER:5:1:3:1602#0/1 CAACTCACTAAAAACCAAGCTGTCGCTACTTCCCAA +SNPSTER:5:1:3:1602#0/1 aaaaaaaaaaaaa^aaa`Xa`^^a`a^^^^^^a_T^ @SNPSTER:5:1:3:1993#0/1 GCACCAACAGAAACAACCTGATTAGCGGCGTTGACA +SNPSTER:5:1:3:1993#0/1 abbbbbbabbaabbaaaaaaa`aaaa_a`a__^_`Z @SNPSTER:5:1:3:646#0/1 TTTCCGTTCTGGTGATTCGTCTAAGAAGTTTAAGAT +SNPSTER:5:1:3:646#0/1 aaaa`]`___Y]\[[`aVLY\_YYXTTTX``YVYS_ @SNPSTER:5:1:3:64#0/1 GCTTTATCAAGATAATTTTTCGACTCATCAGAAATA +SNPSTER:5:1:3:64#0/1 aaabbaaa``baa^]bbbaaaZ``a]S_`]X[Y^_X @SNPSTER:5:1:3:1919#0/1 AGGAGGAAGCGGAGNAGTCCAAATGTTTTTGAGATG +SNPSTER:5:1:3:1919#0/1 _aaaaaaaaaaa`^D\a`aaaZS_a^aaaa_`a`_a @SNPSTER:5:1:3:795#0/1 CTTGAATGGCAGATTTAATACCAGCATCACCCATGC +SNPSTER:5:1:3:795#0/1 aba\aabUbaaW_bbbaabaaa_][aaaa_``]`[_ @SNPSTER:5:1:3:1183#0/1 GCTTTCCTGCTCCTGTTGAGTTTATTGCTGCCGTCA +SNPSTER:5:1:3:1183#0/1 `abbbbabbabbb`Q`_H[^abbaa`\`_R[`]_^Y @SNPSTER:5:1:3:2017#0/1 GAAAACACCAATCTTTCCAAGCAACAGCAGGTTTCC +SNPSTER:5:1:3:2017#0/1 a___bbbbbbbabaaaaaaa^aabaaaaaa`[_aaa @SNPSTER:5:1:4:413#0/1 GCTCTTACTTTGCGACCTTTCGCCATCAACTAACGA +SNPSTER:5:1:4:413#0/1 abbbbbabaab^baaabaaba^ab`aa]^aa]`a`[ @SNPSTER:5:1:4:1951#0/1 AGGGACGGCCTCATCAGGGTTAGGAACATTAGAGCC +SNPSTER:5:1:4:1951#0/1 aaaa^aaaaaaa``_W\]`Y````^_V]`aa^_^aa @SNPSTER:5:1:4:429#0/1 CAAGGCCACGACGCAATGGAGAAAGACGGAGAGCGC +SNPSTER:5:1:4:429#0/1 a`_`a`aW`_Z\]`\\XU\WXV\XXX_\RKKOX[\` @SNPSTER:5:1:4:432#0/1 AGCGCCGTGGATGCCTGACCGTACCGAGGCTAACCC +SNPSTER:5:1:4:432#0/1 a_a`a`_```^`````^aaaX\aaaQ]]N]`Y`\`a @SNPSTER:5:1:4:1977#0/1 GATTATGCGCCAAATGCTTACTCAAGCTCAAACGGC +SNPSTER:5:1:4:1977#0/1 aaaaaabbaaba]_aabaaababaaaa`aa_aaa`a @SNPSTER:5:1:4:1017#0/1 GGCGAAAGGTGGCAAAGTAAGAGCTTCTCGAGCTGC +SNPSTER:5:1:4:1017#0/1 abbbaaa`_XFZaaa`^^aa`a`aabaa]WZZa_X_ @SNPSTER:5:1:4:1382#0/1 CCAGCAAGGAAGCCAAGATGGGAAAGGTCATGCGGC +SNPSTER:5:1:4:1382#0/1 aaaaaaZ_```aaa]]]W_``````^YT`^`^aYV_ @SNPSTER:5:1:4:1988#0/1 GCTCACCTTTAGCATCAACAGGCCACAACCAACCAG +SNPSTER:5:1:4:1988#0/1 aaabbabaaaaabbaaaabaaaaabaab`_aaaba` @SNPSTER:5:1:4:507#0/1 CAGGTTGTTTCTGTTGGTGCTGATATTGCTTTTGAT +SNPSTER:5:1:4:507#0/1 aaba_b``aaaa__a\^]^`aZ^a\a]WYaaaa][` @SNPSTER:5:1:4:1263#0/1 GATGATGCTCGTTATGGTTTCCGTTGCTGCCATCTC +SNPSTER:5:1:4:1263#0/1 aababbaab```baa`\aaa\_Q\a__a_``_a`aa @SNPSTER:5:1:4:1035#0/1 CGTAAATTCAGCGCCTTCCATGATGAGACAGGCCGT +SNPSTER:5:1:4:1035#0/1 a_aababbaaa`Z_`baaaa`Z_a]^O]_^XW__Z] @SNPSTER:5:1:4:615#0/1 AGTCAACCTCAGCACTAACCTTGCGAGTCATTTCTT +SNPSTER:5:1:4:615#0/1 `Vaabb`aba_W`babaaa_aa\_WZ\`^^abbaab @SNPSTER:5:1:4:1571#0/1 CTGAGTCCGATGCTGTTCAACCACTAATAGGTAAGA +SNPSTER:5:1:4:1571#0/1 aaaaaaaaaaa`aaa_a`Y_ab_aa`[a^\Y[_Y_] @SNPSTER:5:1:4:711#0/1 TATTACCCTTCTGAATGTCACGCTGATTATTTTGAC +SNPSTER:5:1:4:711#0/1 a`aa`^_^aa]a]_]a^^^_ZY\a[[_`]`aaaXUQ @SNPSTER:5:1:4:800#0/1 TCATGCGCTCTAATCTCTGGGCATCTGGCTATGATG +SNPSTER:5:1:4:800#0/1 aaaba`a`a_ba_a\a^a[[U]_a^`WQUaYaZ[`W @SNPSTER:5:1:5:52#0/1 ACTAAAATGCAACTGGACAATCAGAAAGAGATTGCC +SNPSTER:5:1:5:52#0/1 aaa`aaabbaaaabbb`aaaba\a^a^a`b`aaaa` @SNPSTER:5:1:5:243#0/1 TTGGGAGGGTGTCAATCCTGACGGTTATTTCCTAGA +SNPSTER:5:1:5:243#0/1 abaaaaa`a_aaaaaaaa_Y_a`^\_]aaa``_V\] @SNPSTER:5:1:5:93#0/1 CAGGTTGCGCCGCCAAAACGTCGGCTACAGTAACTT +SNPSTER:5:1:5:93#0/1 a^ba^abbbaaaaa^]X`a`[a``Y[[TMROVZWS] @SNPSTER:5:1:5:101#0/1 TAATTTGCATACTGACCAAGAACGTGATTACTTCAT +SNPSTER:5:1:5:101#0/1 `[`aaaa_X`_`aa_``_X\Z`_`\_\`_^__`[[_ @SNPSTER:5:1:5:477#0/1 GCTACACGCAGGACGCTTTTTCACGTTCTGGTTGGT +SNPSTER:5:1:5:477#0/1 Wa]\_^a_a`XW\a`aaaa]a`^^_]]]]BBBBBBB @SNPSTER:5:1:5:567#0/1 TCGGCTACAGTAACTTTTCCCAGCCTCAATCTCATC +SNPSTER:5:1:5:567#0/1 a`aaa_^Z]\\_`V]aa_R\`WY\]_^VUZ_^XS]X @SNPSTER:5:1:5:1241#0/1 CTGGTATGGTTGACGCCGGATTTGAGAATCAAAAAG +SNPSTER:5:1:5:1241#0/1 abba_bba]aabaa`aa_ZU`bb\``Y`a`]``baa @SNPSTER:5:1:5:1088#0/1 ACCGCATGGAAATGAAGACGGCCATTAGCTGTACCA +SNPSTER:5:1:5:1088#0/1 a`aa_aa]^_`aa`_^V^_X_Y^U_^KRUVJPRYWZ @SNPSTER:5:1:5:1306#0/1 TATTTTGCAAGCTATTTAACTGGCGGCGATTTCGTA +SNPSTER:5:1:5:1306#0/1 a_aaaaZ_`]__a_```^_^^XUY[]XTWWBBBBBB @SNPSTER:5:1:5:917#0/1 GTATAATAACCACCATCATGGCGACCATCCAAAGGA +SNPSTER:5:1:5:917#0/1 a`aaa`baaa^aa_`a_^a`_^Z^]YV\WWU^WNYW @SNPSTER:5:1:5:1480#0/1 GCTCCCCCAACTTGATATTAATAACACTATAGACCA +SNPSTER:5:1:5:1480#0/1 abbbbbaa[^abbbab`bbaaba`b`abaa]ZZ``R @SNPSTER:5:1:5:1498#0/1 GCGGTGCACTTTATGCGGACACTTCCTACAGGTAGC +SNPSTER:5:1:5:1498#0/1 abba^`aabbba_aabaaaaaabbaaaaa```Y]]_ @SNPSTER:5:1:5:334#0/1 GGTCGTCTTATTACCATTTCAACTACTCCGGTTATC +SNPSTER:5:1:5:334#0/1 `a_bbaabbabbbaa_abbbaaaaYaaa`VZ\aaaa @SNPSTER:5:1:5:1587#0/1 GTTCTGGTTGGTTGTGGCCTGTTGATGCTAAAGGTG +SNPSTER:5:1:5:1587#0/1 aabbbba`aaaaaa_aaaaa``a```aa``_^_`T_ @SNPSTER:5:1:5:1879#0/1 AAGTAATCACGTTCTTGGTCAGTATGCAAATTAGCA +SNPSTER:5:1:5:1879#0/1 `bb`b_aa_abaaaaaba_aaa`aaaa``aaa^a_\ @SNPSTER:5:1:5:160#0/1 TGTATCCATCTGAATGCAATGAAGAAAACCACCATT +SNPSTER:5:1:5:160#0/1 aa_\abaaaaaa``a`a[`a]```]````^X_`^`[ @SNPSTER:5:1:5:722#0/1 AGCATTAAGCTCAGGAAATGCAGCAGCAAGATAATC +SNPSTER:5:1:5:722#0/1 a\aabbaa^aba_YX]```Z_aZ`_X[_]X[aa`a` @SNPSTER:5:1:5:2008#0/1 GTTTTGTTTCTGGTGCTATGGCTAAAGCTGGTAAAG +SNPSTER:5:1:5:2008#0/1 a_`aaa]aaa`a`Zaa_^^a`a_a_`__``_Y_YZ^ @SNPSTER:5:1:5:201#0/1 CATCATGGTAACGCTGCATGAAGTAATCACGTTCTT +SNPSTER:5:1:5:201#0/1 aaaa]`a_\aaaaa_`a^``\Z]]``^_Y^_Y\_Y] @SNPSTER:5:1:5:774#0/1 ATTTCTTACCTATTAGTGGTTGAACAGCATCGGACT +SNPSTER:5:1:5:774#0/1 abbbbbbbaababba^`Y`aa^abaa^`ab\__`ab @SNPSTER:5:1:5:1639#0/1 TCAGGTTGTTTCTGTTGGTGCTGATATTGCTTTTGA +SNPSTER:5:1:5:1639#0/1 abaaa_baaabaaa`aaa^^aa``aaaa^_aaaa]] @SNPSTER:5:1:6:262#0/1 GCTTATCAACAGAAGGAGTCTACTGCTCGCGTTGCG +SNPSTER:5:1:6:262#0/1 abbbabbaaaaaa``]`a_aaaaaaa`\Y_]_a`^` @SNPSTER:5:1:6:1838#0/1 GAAAGAGATTGCCGAGATGCAAAATGAGACTCAAAA +SNPSTER:5:1:6:1838#0/1 a^ZZ`ab``aaaaa^aaaaaaa_Zaaaa`aaa^][` @SNPSTER:5:1:6:2029#0/1 AAGTCGCCGACTGAATGCCAGCAATCTCTTTTTGAG +SNPSTER:5:1:6:2029#0/1 aa`]b`aaaaa`a]`_`aa__a`a_`____`^__^_ @SNPSTER:5:1:6:706#0/1 TGACCAGTGTTTCCAGTCCGTTCAGTTGTTGCAGTG +SNPSTER:5:1:6:706#0/1 aZaaa`^`aabbaa^[`a`X`a^\Z_`W]_V]\]\^ @SNPSTER:5:1:6:297#0/1 AACAGCTTTATCAATACCATGAAAAATATCAACCAC +SNPSTER:5:1:6:297#0/1 a[aaaabbb_bba^aabaaa^a`_\[``aa]`aaaa @SNPSTER:5:1:6:40#0/1 AGTACCTCGCAACGGCTGCGGACGACCAGGGCGAGC +SNPSTER:5:1:6:40#0/1 aa`aaaaaaaa^a`aaaaa`^X]_W`[G[[_W_M\X @SNPSTER:5:1:6:1929#0/1 AGAAGTCGTCATTTGGCGAGAAAGCTCAGTCTCAGG +SNPSTER:5:1:6:1929#0/1 ]a]]a`baab_aaa^`aa``a````__W^^a`a``` @SNPSTER:5:1:6:830#0/1 GCAAGCTATTTAACTGGCGGCGATTGCGTACCCGAC +SNPSTER:5:1:6:830#0/1 aaaa``b_bbbaa``U[\``YUNV`BBBBBBBBBBB @SNPSTER:5:1:6:95#0/1 TGATTTCTTACCTATTAGTGGTTGAACAGCATCGGA +SNPSTER:5:1:6:95#0/1 aa_aaaaabaaaa`a`Z`^`a_a````][_X_aa^] @SNPSTER:5:1:6:2024#0/1 ATCATAAAACGCCTCTAATCGGTCGTCAGCCAACGT +SNPSTER:5:1:6:2024#0/1 aabbabbaabaaaaaabaaa`aVaa[a`__``_`[Q @SNPSTER:5:1:6:1568#0/1 ATAGCCAGATGCCCAGAGATTAGAGCGCATGACAAG +SNPSTER:5:1:6:1568#0/1 aaaaba]`aa`aaaV`_`[``a``_a``^_\]_[W^ @SNPSTER:5:1:6:929#0/1 AGAAAAGCGGCATGGTCAATATAACCAGTAGTGTTA +SNPSTER:5:1:6:929#0/1 aaaaa`^_`^`aa`[\`__a_a__^]^[[[PZ`_`` @SNPSTER:5:1:6:1615#0/1 CCAAATGTTTTTGAGATGGCAGCAACGGAAACCATA +SNPSTER:5:1:6:1615#0/1 aa]\]aa`aaaa`]``a``a``a]]```]]Za`S^a @SNPSTER:5:1:6:1903#0/1 TGCTGATGCTTCCCCTGCTGGTATGGTTGACGCCGG +SNPSTER:5:1:6:1903#0/1 aaa\_aaba`aaaa`[aa_a_Q_a`^\`a^a^`a`a @SNPSTER:5:1:6:1336#0/1 ATAACCCTGAAACAAATGCTTAGGGATTTTATTGGT +SNPSTER:5:1:6:1336#0/1 aa_`baaaa``aa__aaabaaaaa]Z_baa`aa_YY @SNPSTER:5:1:6:1091#0/1 TGTTTTCCGTAAATTCAGCGCCTTCCATGATGAGAC +SNPSTER:5:1:6:1091#0/1 aaaaaaa_][Y]a``\_[_X\_aa^[W]XWVOUXZ` @SNPSTER:5:1:6:467#0/1 GAACAGCATCGGACTCAGATAGTAATCCACGCTCTT +SNPSTER:5:1:6:467#0/1 a`aa_X`bbaaa`aaa`^`aaa_aaa`^__Y_`\^b @SNPSTER:5:1:6:108#0/1 CGGCGCCAGTTTGAATATTAGACATAATTTATCCTC +SNPSTER:5:1:6:108#0/1 aaabaa_S_Zaa\[_`Zaa[\]]]`^]aaa[`_a^^ @SNPSTER:5:1:6:1775#0/1 CAGTAGTAATTCCTGCTTTATCAAGATAATTTTTCG +SNPSTER:5:1:6:1775#0/1 aaa^aa^`^a`aaaaa`a`a_```a`^`^a``a_a` @SNPSTER:5:1:6:671#0/1 GCTGCTGAACGCCCTCTTAAGGATATTCGCGATGAG +SNPSTER:5:1:6:671#0/1 aaaaaaaa```aaa`_a_Z][\^_\^a^\`Z[^]ZX @SNPSTER:5:1:6:1439#0/1 AACATAGTGCCATGCTCAGGAACAAAGAAACGCGGC +SNPSTER:5:1:6:1439#0/1 ^`b`a_a_aaa\aaaaaaaa`aaa]]`_`^^_a`^` @SNPSTER:5:1:6:1682#0/1 CCAACGCGTCAGTTTTTGACAGAATCGTTAGTTGAT +SNPSTER:5:1:6:1682#0/1 ab``a`aaZaaaZaa____`\^V`_`__WBBBBBBB @SNPSTER:5:1:6:1105#0/1 CGTGGCCTTGCTATTGACTCTACTGTAGACATTTTT +SNPSTER:5:1:6:1105#0/1 a`aaaa`baaaaaaa__aaa`__]Q\WWTWX`aaaa @SNPSTER:5:1:6:1408#0/1 AGGAGCAGGAAAGCGAGGGTATCCTACAAAGTCCAG +SNPSTER:5:1:6:1408#0/1 a_aaaaa^a`a^a`]]aZaZ_aaaaaa]ZY]_aa`` @SNPSTER:5:1:6:598#0/1 TTCTGCGTCATGGAAGCGATAAAACTCTGCAGGTTG +SNPSTER:5:1:6:598#0/1 aaaa^_aa```W]a]TYY]_Y]_`Z^[[LWXQYT]Y @SNPSTER:5:1:6:1417#0/1 ATCAATACCATGAAAAATATCAACCACACCAGAAGC +SNPSTER:5:1:6:1417#0/1 [aa_`bbbb`bbaa^_bbbbb_bbbbaabb^`^aab @SNPSTER:5:1:6:898#0/1 GGAAAGGATACTCGTGATTATCTTGCTGCTGCATTT +SNPSTER:5:1:6:898#0/1 `_aaa_``baab`_a^^bbababa]``V]`[``aba @SNPSTER:5:1:7:944#0/1 TGAATGCAATGAAGAAAACCACCATTACCAGCATTA +SNPSTER:5:1:7:944#0/1 a]a`a[^``a]__a_`a`__`_``aa__^\W]`aaa @SNPSTER:5:1:7:1959#0/1 AACAGCCATATAACTGGTAGCTTTAAGCGGCTCACC +SNPSTER:5:1:7:1959#0/1 aabaaaaa`aaaa``aaXa``_``aa_`___^a__a @SNPSTER:5:1:7:1303#0/1 ATACGAAAGACCAGGTATATGCACAAAATGAGATGC +SNPSTER:5:1:7:1303#0/1 aaaaa`___^_`R__W_`___`Z^__^\_ZZX^^\_ @SNPSTER:5:1:7:1738#0/1 GACGACATTAGAAATATCCTTTGCAGTAGCGCCAAT +SNPSTER:5:1:7:1738#0/1 abbbbaYabba`bba^aabaaaaa^a``aa^aaZ__ @SNPSTER:5:1:7:1494#0/1 ACTTTACCGCTACTAAATGCCGCGGATTGGTTTCNC +SNPSTER:5:1:7:1494#0/1 aabba`ba^baaaa__SaSaa`aaaWaa___a`[BB @SNPSTER:5:1:7:1051#0/1 TCAATACCATGAAAAATATCAACCACACCAGAAGCA +SNPSTER:5:1:7:1051#0/1 a_aaaa`_`a]_``__a_a_```_a^^\]ZX\^]__ @SNPSTER:5:1:7:1447#0/1 TGCGTTTATGGTACGCTGGACTTTGTAGGATACCCT +SNPSTER:5:1:7:1447#0/1 aaab`aaaaaa]aa__aa_^`aaa[^_`\^^aaa^Q @SNPSTER:5:1:7:1662#0/1 CGGCAATCTCTTTCTGATTGTCCAGTTGCATTTTAG +SNPSTER:5:1:7:1662#0/1 aaabbaababaabaaaaaa`^aa``^aaa`aaaa`^ @SNPSTER:5:1:7:1471#0/1 CCACCAGCAAGAGCAGAAGCAATACCGCCAGCAATA +SNPSTER:5:1:7:1471#0/1 aaaabbaaaaaaaaa``^`a`aaaaa^a`]\a]X_] @SNPSTER:5:1:7:1677#0/1 GTGATATTGGTCGTATGGTTCTTGCTGCCGAGGGTC +SNPSTER:5:1:7:1677#0/1 aabaabbabb`bbaaaba`abbaab`\aaa_aaaSa @SNPSTER:5:1:7:1312#0/1 TTTCAGGGTTATTTGAATATCTATAACAACTATTTT +SNPSTER:5:1:7:1312#0/1 aaaaa\]a_a`aaa`__a_aaa`a`a`a`^a_aaaa @SNPSTER:5:1:7:628#0/1 GAAGTGTCCGCATAAAGTGCACCGCATGGAAATGAA +SNPSTER:5:1:7:628#0/1 _aa```a`a__`a`\`__a`a`^YZ[_ZZV_a\TZ` @SNPSTER:5:1:7:641#0/1 TAGCAGCAAGGTCCATATCTGACTTTTTGTTAACGT +SNPSTER:5:1:7:641#0/1 a``_aY^`^\_^_^^a^a_a_\]aaa`aU]`]_[U[ @SNPSTER:5:1:8:786#0/1 TTATGTTTGGTGCTATTGCTGGCGGTTTTTTTTTTT +SNPSTER:5:1:8:786#0/1 ab`a\_bba`^]^a^aaZ]_XZZ]XBBBBBBBBBBB @SNPSTER:5:1:8:1346#0/1 CCGCCCCGAAGGGGACGAAAAATGGTTTTTAGAGAA +SNPSTER:5:1:8:1346#0/1 abbaaaa^Y]]`a]Y_a^^V[_`]_^aaba\U\]_] @SNPSTER:5:1:8:270#0/1 GTTCTGGTGATTCGTCTAAGAAGTTTAAGATTGCTG +SNPSTER:5:1:8:270#0/1 aaaaba\]a^aaa`aab``]__a_aaa\W[a`aaa` @SNPSTER:5:1:8:431#0/1 ACAATTGCTTAGGGATTTTATTGGTATCAGGGTTAA +SNPSTER:5:1:8:431#0/1 aaaaba^aaa`a]]`aaab`aaa_]`aa_`Z`^aaa @SNPSTER:5:1:8:2037#0/1 ATTAGAGCGCATGACAAGTAAAGGACGGTTNTCAGC +SNPSTER:5:1:8:2037#0/1 a`_a`a_a`a`_a`___`Ya_^`^____WTDN]\Y\ @SNPSTER:5:1:8:1699#0/1 ACATTATTGCCCGGCGTACGAGGAAGGACGTCAATA +SNPSTER:5:1:8:1699#0/1 aaaaaaaaabbaaaaa_aba]`a]``^]^a^`a]^\ @SNPSTER:5:1:8:694#0/1 AGCATAAGCAGCTTGCAGACCCATAATGTCAATAGA +SNPSTER:5:1:8:694#0/1 a`aaba]^aa]`ba\^]]`____aa^aZ\]]]a___ @SNPSTER:5:1:8:77#0/1 CGGGATGAACATAATAAGCAATGACGGCAGCAATAA +SNPSTER:5:1:8:77#0/1 abbb_aa_aa`b`]a`[`a_^a`__a`[W]WZSYOW @SNPSTER:5:1:8:446#0/1 TCACAGGTTGCGCCGCCAAAACGTCGGCTACAGTAA +SNPSTER:5:1:8:446#0/1 ab_aa^`^aaaaa_V_a[[[`_ZZa`\]]Y]OVXZY @SNPSTER:5:1:8:1466#0/1 GCTATCAGTATTTTTGTGTGCNTGAGTATGGTACAG +SNPSTER:5:1:8:1466#0/1 abbbbbbb`abbbbba`X_a^D^aaa`a_Z_`aaZ] @SNPSTER:5:1:8:203#0/1 GCCCATCGCAGTTCGCTACACGCAGGACGCTTTTTC +SNPSTER:5:1:8:203#0/1 abbbaab`_V\aaaaaa`b`a^aa^\[_[`Y^`a^a @SNPSTER:5:1:8:1833#0/1 CGCATAAATTTGAGCAGATTTGTCGTCACAGGTTGC +SNPSTER:5:1:8:1833#0/1 aaaaa`^`aaaa]`aaaZaaaa`aa_a``\``\a_a @SNPSTER:5:1:8:481#0/1 AAAACATACAATTGGGAGGGTGTCAATCCTGACGGT +SNPSTER:5:1:8:481#0/1 aaaaaabaaaabb`]^`\aa_aaaaaaa_a``a`^] @SNPSTER:5:1:8:1506#0/1 TCGCAAGGTTAGTGCTGAGGTTGACTTAGTTCATCA +SNPSTER:5:1:8:1506#0/1 aa`a_R__`a_Z__ab`\`^`a][aa`Z[aaa]a^V @SNPSTER:5:1:8:1886#0/1 CAATACCATCAGCTTTACCGTCTTTCCAGAAATTGT +SNPSTER:5:1:8:1886#0/1 aaaaaaa\aaaabaaaaaaa_aa`a`a\_Z]Z_`a\ @SNPSTER:5:1:8:1807#0/1 TGCTGAGGGTCAGTGGTATCGTTATGCGCCTTCGTA +SNPSTER:5:1:8:1807#0/1 aabaaaaaa^`U`_aa]`aaaaaaaaa`aaaaaaVB @SNPSTER:5:1:8:1817#0/1 CAATCTGCCGACCACTCGCGATTCAATCATGACTTC +SNPSTER:5:1:8:1817#0/1 a`^abaabbaaaaaaaa`a`^^^a^]_^^^_Y^_^_ @SNPSTER:5:1:8:364#0/1 CTTAGGGATTTTATTGGTATCAGGGTTAATCGTGCC +SNPSTER:5:1:8:364#0/1 ab`_```[abbbab`R__aba]`^^`a]`aaY`aa` @SNPSTER:5:1:9:777#0/1 AATAAGACGACCAATCTGACCAGCAAGGAAGCCAAG +SNPSTER:5:1:9:777#0/1 abbabaaaba`aaab]_T^``]Z_`^SXZ\S\`[__ @SNPSTER:5:1:9:912#0/1 CCGGTTATCGCTGGCGACTCCTTCGAGATGGACGCC +SNPSTER:5:1:9:912#0/1 `a```aaa_``a__a[`Z`a`aa^X]WX_QT[`^[` @SNPSTER:5:1:9:751#0/1 TTCGTCTAAGAAGTTTAAGATTGCTGAGGGTCAGTG +SNPSTER:5:1:9:751#0/1 aaaa`_a]^`Z[a`a`Y[`Xaa\^^UY\Y\XVV^Z] @SNPSTER:5:1:9:569#0/1 ACCTATCCTTGCGCAGCTCGAGAAGCTCTTACTTTG +SNPSTER:5:1:9:569#0/1 aabbabaabbaaaa^[aaaZ``a`^a`_a`Y\___W @SNPSTER:5:1:9:975#0/1 AGTCTGAAACATGATTAAACTCCTAAGCAGAAAACC +SNPSTER:5:1:9:975#0/1 `b`abaaabbbbbabbbababaaba_Z_``Za`aaa @SNPSTER:5:1:9:1091#0/1 ACTTCCTACAGGTAGCGTTGACCCTAATTTTGGTCG +SNPSTER:5:1:9:1091#0/1 a`bbaabaaa_`_a`^Xa_Q__`aaaYaaa_TX_`Y @SNPSTER:5:1:9:1307#0/1 CCGACGACCAAAATTAGGGTCAACGCTACCTGTAGG +SNPSTER:5:1:9:1307#0/1 aaa`aa]\_V\a_a`^\Z^U]PaV[^_SU\SJOVR[ @SNPSTER:5:1:9:1108#0/1 GACCCATAATGTCAATAGATGTGGTAGAAGTCGTCA +SNPSTER:5:1:9:1108#0/1 a_a`a_b_a`U\`__aXa_a_]W]]`T]UPW^^RZ^ @SNPSTER:5:1:9:234#0/1 ATCATGACTTCGTGATAAAAGATTGAGTGTGAGGTT +SNPSTER:5:1:9:234#0/1 aaa_`_\`aaa`\_]_YYX_]]_a`XTY]SQY_P]` @SNPSTER:5:1:9:156#0/1 CCAGATAGTAATCCACGCTCTTTTAAAATGTCAACA +SNPSTER:5:1:9:156#0/1 ab^a`aaa^aa`aa`a`a_`_`a^VT[^\YS[WT[S @SNPSTER:5:1:9:503#0/1 AACCATCAGCATGAGCCTGTCGCATTGCATTCATCA +SNPSTER:5:1:9:503#0/1 aaaaabaa]`aaY`_aaa_aa^``b`__`aaZ_`aa @SNPSTER:5:1:9:1493#0/1 TTCAAGAAGGTGATAAGCAGGAGAAACATACGAAGG +SNPSTER:5:1:9:1493#0/1 aaaa`\]```Wa^a]]a`^aa_`[T^`]a_WOR^\\ @SNPSTER:5:1:9:1175#0/1 CGTGCCAAGAAAAGCGGCATGGTCAATATAACCAGT +SNPSTER:5:1:9:1175#0/1 a_aaaaaa_aaaaa`^^^^a]Z]`_`a\a__`a_Z[ @SNPSTER:5:1:9:534#0/1 GTTCTTATTACCCTTCTGAATGTCACGCTGATTATT +SNPSTER:5:1:9:534#0/1 _ababbaaaaababa`bXaab^aaa_aaa`_aa^aa @SNPSTER:5:1:9:1688#0/1 AACTTCGGGATGAAAATGCTCACAATGACAAATCTG +SNPSTER:5:1:9:1688#0/1 ^abbabaaaaaaaa``aabab_ba\aa_aa`^aaaa @SNPSTER:5:1:9:1446#0/1 GTTAACGTATTTAGCCACATAGAAACCAACAGCCAT +SNPSTER:5:1:9:1446#0/1 abb`bab_bbba]`bbba\b`aaaaab[_a]_aa`^ @SNPSTER:5:1:10:488#0/1 TTACTAAAATGCAACTGGACAATCAGAAAGAGATTG +SNPSTER:5:1:10:488#0/1 abaabaaa`a]aaaa``]_`a`aa]]]`[QY]\`_] @SNPSTER:5:1:10:1525#0/1 ACTCTTTCTCAATCCCCAATGCTTGGCTTCCATAAG +SNPSTER:5:1:10:1525#0/1 aabbbabbaa[^abba`Y]aaaaaaa`aaaa^_YZ_ @SNPSTER:5:1:10:1459#0/1 GGCTGCGGACGACCAGGGCGAGCGCCAGAACGTTTT +SNPSTER:5:1:10:1459#0/1 a`aa`a`_`a`^a_P]``a^``a^aaa^_Z_`\aaa @SNPSTER:5:1:10:1670#0/1 TGCTTGGCACGTTCGTCAAGGACTGGTTTAGATATG +SNPSTER:5:1:10:1670#0/1 a`bab]U_b`UZaa^]_^\U[IZa\]]a[JMPWS]Q @SNPSTER:5:1:10:692#0/1 CATAAAAAGTAAAAATGTCTACAGTAGAGTCAATAG +SNPSTER:5:1:10:692#0/1 aabaaaa``]^``]aaZ]aaa```^`X_\\_aaa^] @SNPSTER:5:1:10:1681#0/1 GATGTTATTTCTTCATTTGGAGGTAAAACCTCTTAT +SNPSTER:5:1:10:1681#0/1 a`ab_aaabaaaaba`aaaa`aa[aa`aaaaa`a_` @SNPSTER:5:1:10:957#0/1 GCATAAAGTGCACCGCATGGAAATGAAGACGGCCAT +SNPSTER:5:1:10:957#0/1 aabbaa_U^`aaaaU^aaZX_aa`]_]U]OLS[``a @SNPSTER:5:1:10:463#0/1 CCTGACGGTTATTTCCTAGACAAATTAGAGCCAATA +SNPSTER:5:1:10:463#0/1 abaaaaaa^a\aaaaaa``X`aa]a`a^^^a`]`a] @SNPSTER:5:1:10:209#0/1 AGGAAGGACGTCAATAGTCACACAGTCCTTGACGGT +SNPSTER:5:1:10:209#0/1 aaaaaa^`aa`aaZaZ]]aaaa`Z`[a`a][]``YQ @SNPSTER:5:1:10:849#0/1 TTATCTTGCTGCTGCATTTCCTGAGCTTAATGCTTG +SNPSTER:5:1:10:849#0/1 aa`a^aa\^`QZa[WYaaaY]a]W[WaaZZ_Y\a^S @SNPSTER:5:1:10:354#0/1 AATTTTTGACGCACGTTTTCTTCTGCGTCAGTAAGA +SNPSTER:5:1:10:354#0/1 aabbbbbaaaaaaaa`aabaaaaaaa^_a`[`aa`a @SNPSTER:5:1:10:877#0/1 TTATCGAACTCAACGCCCTGCATACGAAAAGACAGA +SNPSTER:5:1:10:877#0/1 aaaa`a_^]a^`a[UU^]\NU]a]YTU\]XOSZ[U] @SNPSTER:5:1:10:1396#0/1 AAGATGGGAAAGGTCATGCGGCATACGCTCGGCGCC +SNPSTER:5:1:10:1396#0/1 aa`aa`^`aa^`]Xaaa`a[`a_aaa`a`[R]a^a` @SNPSTER:5:1:10:407#0/1 CTGTTTGGTTCGCTTTGAGTCTTCTTCGGTTCCGAC +SNPSTER:5:1:10:407#0/1 abbabb^aabbabbba^a``aaaabaa_X]a`_Z^` @SNPSTER:5:1:10:555#0/1 TGACGATGTAGCTTTAGGTGTCTGTAAAACAGGTGC +SNPSTER:5:1:10:555#0/1 aaaaa`a`a]_`a`a\V[S]_aaX`Z^`_]W][[_a @SNPSTER:5:1:10:857#0/1 TACAGTAGAGTCAATAGCAAGGCCACGACGCAATGG +SNPSTER:5:1:10:857#0/1 a`_`a`_W][\_``a\[S[[U\Z^_VTZRTTZ_^TZ @SNPSTER:5:1:10:914#0/1 TAGGTGTCTGTAAAACAGGTGCCGAAGAAGCTGGAG +SNPSTER:5:1:10:914#0/1 a`a`^`a^a]``a^^Z[Q\ZXZ\]]VWZYXW_]XXU @SNPSTER:5:1:10:9#0/1 TTTGCCGCAAGCTGGCTGCTGAACGCCCTCTTAAGG +SNPSTER:5:1:10:9#0/1 a^a]bbaaX_Z_a_abN[`[`a]PPaabVYG]ZBBB @SNPSTER:5:1:10:634#0/1 GGATTACTATCTGAGTCCGATGCTGTTCAACCACTA +SNPSTER:5:1:10:634#0/1 aaabba_bab_b___```a_aa^aa_`__`_V``a` @SNPSTER:5:1:10:1963#0/1 GGAAACACTGGTCATAATCATGGTGGCGAATAAGTA +SNPSTER:5:1:10:1963#0/1 aaa_`aa`aaa^aaaaaaa^``_Y``a`_`_```UZ @SNPSTER:5:1:10:1549#0/1 AACGTGAAAAAGCGTCCTGCGTGTAGCGAACTGCGA +SNPSTER:5:1:10:1549#0/1 abab^`a]`]``ba__aaaaa^a`]aa`^^^_`aZX @SNPSTER:5:1:10:630#0/1 AACCAACAGCCATATAACTGGTAGCTTTAAGCGGCT +SNPSTER:5:1:10:630#0/1 aaaa`a^`a^__a\a^`_a_`_`_]a_aYPR[^PZ] @SNPSTER:5:1:10:1858#0/1 ACCTTGCTGCTAAAGGTCTAGGAGCTAAAGAATGGA +SNPSTER:5:1:10:1858#0/1 `bbaaaaaaaaaaaaa^aaaaa\aaa][`a_`_a`] @SNPSTER:5:1:10:834#0/1 GTCGGCTACAGTAACTTTTCCCAGCCTCAATCTCAT +SNPSTER:5:1:10:834#0/1 _aaaa`a``]^_``Zaaba[^`][[^a_^W`YaaZ` @SNPSTER:5:1:10:749#0/1 AAGCGGCATGGTCAATATAACCAGTAGTGTTAACAG +SNPSTER:5:1:10:749#0/1 a``_`W\ab`^__a`aaaaa__YT[\ZZ`^a\`_`` @SNPSTER:5:1:10:1604#0/1 CGTGAGAGTGTCAAAAACGATAAACCAACCATCAGC +SNPSTER:5:1:10:1604#0/1 aa_aaa^a^a`a]``a`aa``\Z_``\[^a^^_QX_ @SNPSTER:5:1:10:1369#0/1 TGATGGTATTGGCTCTAATTTGTCTAGGAAATAACC +SNPSTER:5:1:10:1369#0/1 a`_a`]\`a`_[_a`ZOS[a_NX\ZVPYY[Y\VZ\` @SNPSTER:5:1:10:1288#0/1 AATTCATCCATTAACTTCTCAGTAACAGATACAAAC +SNPSTER:5:1:10:1288#0/1 abbbaabbbabbaaabaaaa`_aaaaa^`aaaaa`a @SNPSTER:5:1:10:854#0/1 CTGATAGCAGTCGGCGTGTGAATCATTAGCCTTGCG +SNPSTER:5:1:10:854#0/1 abbab`]^aba`XWYJ\T^Q\aba`a`ZNV`bbaW_ @SNPSTER:5:1:10:197#0/1 CCTGCGTGTAGCGAACTGCGATGGGCATACTGTAAC +SNPSTER:5:1:10:197#0/1 abaaaa`a^a`aa_]a^]_XSZ]^]`\]X_^VU]^` @SNPSTER:5:1:10:189#0/1 ACATAAAAAGTAAAAATGTCTACAGTAGAGTCAATA +SNPSTER:5:1:10:189#0/1 ababa_a`]a^aa`[[a_^baa_U]\a^__\a``^^ @SNPSTER:5:1:11:98#0/1 TCTCGAAGGAGTCGCCAGCGATAACCGAGGTAGTTG +SNPSTER:5:1:11:98#0/1 aaaaa_`a^X]^^]]^V\YYY[[XQ^[S[YJRYN]R @SNPSTER:5:1:11:1784#0/1 CTGAATTGTTCGCGTTTACCTTGCGTGTACGCGCAG +SNPSTER:5:1:11:1784#0/1 abbaabbaaabaa_abbaaaaaaaaaa_a^__aa`a @SNPSTER:5:1:11:1451#0/1 GACAATCAGAAAGAGATTGCCGAGATGCAAAATGAG +SNPSTER:5:1:11:1451#0/1 aaaXY`a]`aaZ^Z\O`baba]`aT_]_\ZTWa_VZ @SNPSTER:5:1:11:1305#0/1 TTAATCCACTGTTCACCATAAACGTGACGATGAGGG +SNPSTER:5:1:11:1305#0/1 aa`]`aa_aaa_``````a_`_`\Y[W]XLZOZ^[^ @SNPSTER:5:1:11:641#0/1 ACGGCAGCAATAAACTCAACAGGAGCAGGAAAGCGA +SNPSTER:5:1:11:641#0/1 aa`]a]\[[aaaaa[^^_a[VYV_\[VUNV_\ZBBB @SNPSTER:5:1:11:827#0/1 CCAGAAATTGTTCCAAGTATCGGCAACAGCTTTATC +SNPSTER:5:1:11:827#0/1 aabbaaaba\abaaa_Y_aba_``aa_^X[abbaa^ @SNPSTER:5:1:11:1627#0/1 ATCATGACTTCGTGATAAAAGATTGAGTGTGAGGTT +SNPSTER:5:1:11:1627#0/1 aaaa`a`aaaaa^a__\^[X`Y```\_Y_\^[`_\^ @SNPSTER:5:1:11:1762#0/1 TGTCAAAAACGATAAACCAACCATCAGCATGAGCCT +SNPSTER:5:1:11:1762#0/1 abaaaaaabbaaaaaaaa_aaaaaa`]aaa`aaaaa @SNPSTER:5:1:11:1729#0/1 CGCGTTCTTGCAAATCACCAGAAGGCGGTTCCTGAA +SNPSTER:5:1:11:1729#0/1 aaaa`aaaaZaaaaaaaaaaaaa`_a^a[_aa`^T\ @SNPSTER:5:1:11:1010#0/1 TACACGCAGGACGCTTTTTCACGTTCTGGTTGGTTG +SNPSTER:5:1:11:1010#0/1 aaaa`]`_Z```\`_aaa`_a\_`a\_WVY_\X^aX @SNPSTER:5:1:11:1924#0/1 CAGGCTTCTGCCGTTTTGGATTTAACCGAAGATGAT +SNPSTER:5:1:11:1924#0/1 aaaabaaa`aaab^aaaaa``aaa`aaa^_`__`__ @SNPSTER:5:1:11:1014#0/1 TGCACAAAATGAGATGCTTGCTTATCAACAGAAGGA +SNPSTER:5:1:11:1014#0/1 a_aaaaaaab`aaaaaaaa^aabaaa__^^^`^^__ @SNPSTER:5:1:11:1920#0/1 ACCATGATTATGACCAGTGTTTCCAGTCCGTTCAGT +SNPSTER:5:1:11:1920#0/1 abbaaaaa`aaaaa_`a]a___aa_aZ^^aZ_`\`Z @SNPSTER:5:1:11:1748#0/1 TTGGGGATTGAGAAAGAGTAGAAATGCCACAAGCCT +SNPSTER:5:1:11:1748#0/1 abbaa`]aaaaa]`aa`a_aa```aaaaaa`]aaaa @SNPSTER:5:1:11:730#0/1 TCCCGTCAACATTCAAACGGCCTGTCTCATCATGGA +SNPSTER:5:1:11:730#0/1 a``^aa_a`^`aa____Z[UW[`[^W_[W_UR_Z[Z @SNPSTER:5:1:11:1677#0/1 TTATTTGTCTCCAGCCACTTAAGTGAGGTGATTTAT +SNPSTER:5:1:11:1677#0/1 ab_baaa[b`a_^aab`aaa]_^Y_Y_^U_Pa_^]\ @SNPSTER:5:1:11:193#0/1 TGCTCACAATGACAAATCTGTCCACGGAGTGCTTAA +SNPSTER:5:1:11:193#0/1 aababaaaaaa^aa`^`a``^aa]a^^Y\V_``^BB @SNPSTER:5:1:11:1952#0/1 GATTTGGAGGCATGAAAACATACAATTGGGAGGGTG +SNPSTER:5:1:11:1952#0/1 a`aaaaaaaaaaaaaaaaaaaaa]S]_aa`_``]X` @SNPSTER:5:1:11:1429#0/1 CGCTTCGATAAAAATGATTGGCGTATCCAACCTGCA +SNPSTER:5:1:11:1429#0/1 a`aaaaa`aa_XY]a^]``\\a]]W_`a[N\a_^_] @SNPSTER:5:1:12:1643#0/1 AAGCTGTTCAGAATCAGAATGAGCCGCAACTTCGGG +SNPSTER:5:1:12:1643#0/1 aaabaa`aaaaaaaaaaaaa`^abaaa^`aaaaa`` @SNPSTER:5:1:12:28#0/1 TCATAGGCAGTCGGGAGGGTAGTCGGAACCGAAGAA +SNPSTER:5:1:12:28#0/1 aba`R\aaa`Q]``]L]`aO\_Z__[T^W_YTY_T\ @SNPSTER:5:1:12:1800#0/1 ATCCCGTCAACATTCAAACGGCCTGTCTCATCATGG +SNPSTER:5:1:12:1800#0/1 aabbbbaaaaaaaaaaaaa___a`a^a``_a`^``` @SNPSTER:5:1:12:717#0/1 CTGCTTTATCAAGATAATTTTTCGACTCATCAGAAA +SNPSTER:5:1:12:717#0/1 abbbbbbabaabaabaabbbbba`a`b``a_a``ab @SNPSTER:5:1:12:1167#0/1 ACCTATCCTTGCGCAGCTCGAGAAGCTCTTACTTTG +SNPSTER:5:1:12:1167#0/1 aabbabaaba^aaa`]aaa^a^_X_`b`aa\_aa`] @SNPSTER:5:1:12:1414#0/1 ACNTTGCGTGTACGCGCAGGAAACACTGACGTTCTT +SNPSTER:5:1:12:1414#0/1 a^D\aabaaa_aaaa_aa`]aaaa`aa^[`]_aaaa @SNPSTER:5:1:12:1668#0/1 TCTACTGCTCGCGTTGCGTCTATTATGGAAAACACC +SNPSTER:5:1:12:1668#0/1 abbbbbabbbabb`aabbabaaaaa`^a\a`_baab @SNPSTER:5:1:12:117#0/1 CTGGTATTAAATCTGCCATTCAAGGCTCTAATGTTC +SNPSTER:5:1:12:117#0/1 abbb`bbbbbabbb`bbabbaaaaaaa`a__aa`aa @SNPSTER:5:1:12:65#0/1 GCCTGTCTCATCATGGAAGGCGCTGAATTTACGGAA +SNPSTER:5:1:12:65#0/1 a^``aa`a_^a\\a]aQ\aa_a_aa^U``a^UaaT^ @SNPSTER:5:1:12:47#0/1 ATGGCGAGAAATAAAAGTCTGAAACATGATTAAACT +SNPSTER:5:1:12:47#0/1 abbbab`b`a`baa_Ya`abb`_aa`bb`bb``aab @SNPSTER:5:1:12:1580#0/1 GTAGAGGCTTTGCTATTCAGCGTTTGATGAATGCAA +SNPSTER:5:1:12:1580#0/1 a``aa`ababaaaa`aaa^`aa_aaYV_`_]]``Z_ @SNPSTER:5:1:12:1107#0/1 TAACAATACTGTAGGCATGGGTGATGCTGGTATTAA +SNPSTER:5:1:12:1107#0/1 a`a^`^a]_aY^__[^Y_]_ZXY\__]_XPW]a`]_ @SNPSTER:5:1:12:1547#0/1 CCCTTCTGAATGTCACGCTGATTATTTTGACTTTGA +SNPSTER:5:1:12:1547#0/1 aaaaaaaa`^```aaaaaaa_aa_aaaa`[_`aaZX @SNPSTER:5:1:12:1388#0/1 TAACGCTGCATGAAGTAATCACGTTCTTGGTCAGTA +SNPSTER:5:1:12:1388#0/1 aaababa`aaaaWaa]^_aa_aaZ_a__`]]aa_]` @SNPSTER:5:1:12:929#0/1 ATCTCTACCATGAACAAAATGTGACTCATATCTAAA +SNPSTER:5:1:12:929#0/1 aaababa^aa`W]a]a`__aa^V`^a]_a_a]a``` @SNPSTER:5:1:12:312#0/1 ACAGGTAGCGTTGACCCTAATTTTGGTCGTCGGGTA +SNPSTER:5:1:12:312#0/1 ```a`X]W_aaaa__aa_a`baa_YZV`X^]Z^]BB @SNPSTER:5:1:12:679#0/1 CTGCTGGTATGGTTGACGCCGGATTTGAGAATCAAA +SNPSTER:5:1:12:679#0/1 ab`bb__aab]X_aU\_Z_^TX]abaQ\UZ_baaab @SNPSTER:5:1:12:1892#0/1 CTTGCTGGTGGCGCCATGTCTAAATTGTTTGGAGGC +SNPSTER:5:1:12:1892#0/1 aabbaabaW`b_b_\^a`Z__TVaaaa\\_`___a^ @SNPSTER:5:1:13:1932#0/1 TACCTTGCGTGTACGCGCAGGAAACACTGACGTTCT +SNPSTER:5:1:13:1932#0/1 aabababbbaa`baaab_abaaaa`aaa___a^aaa @SNPSTER:5:1:13:1226#0/1 TAAGTTCATGAAGGATGGTGTTAATGCCACTCCTCT +SNPSTER:5:1:13:1226#0/1 aa[_aaa`bbaaaa`a`^^]aa[`a``a`^a_aa`a @SNPSTER:5:1:13:605#0/1 TTATACCGTCAAGGACTGTGTGACTATTGACGTCCT +SNPSTER:5:1:13:605#0/1 abaaa``Z_^[``][^aX]T]W[]a_a]NZXT[^^a @SNPSTER:5:1:13:978#0/1 TCGGTACGGTCAGGCATCCACGGCGCTTTAAAATAG +SNPSTER:5:1:13:978#0/1 a``]^`]U][^[XT\[`W^[^XVZ\[a`aUUU[aVB @SNPSTER:5:1:13:1912#0/1 GGTTGGACTTGGTGGCAAGTCTGCCGCTGATAAAGG +SNPSTER:5:1:13:1912#0/1 aa^`aaaaaaaa\aaa^aa^a_aaaaaaa\``][`a @SNPSTER:5:1:13:1230#0/1 TAGGGTCAACGCTACCTGTAGGAAGTGTCCGCATAA +SNPSTER:5:1:13:1230#0/1 aabaa^``ba_abaaab`_aaa```YR^a```aaaa @SNPSTER:5:1:13:617#0/1 AATGTTTTCCGTAAATTCAGCGCCTTCCATGATGAG +SNPSTER:5:1:13:617#0/1 aabaabbaaaaaaa`aa`a\aa_`aa`__`[]`\\] @SNPSTER:5:1:13:1500#0/1 TTGCTGGTCAGATTGGTCGTCTTATTACCATTTCAA +SNPSTER:5:1:13:1500#0/1 aaaa``[^a]`_aa_[__a_^a`[`a_`]S_`^_]U @SNPSTER:5:1:13:535#0/1 AGTCTCATTTTGCATCTCGGCAATCTCTTTCTGATT +SNPSTER:5:1:13:535#0/1 ab`bbaabbba_abaaaaV]`aaa_aaaaaaa_X[a @SNPSTER:5:1:13:650#0/1 CTGAGGGGTTGACCAAGCGAAGCGCGGTAGGTTTTC +SNPSTER:5:1:13:650#0/1 abbab___ab`bbba`]a_`aaa_a^X]`ZW\bba` @SNPSTER:5:1:13:541#0/1 GCACCAGAAACAAAACTAGGGGCGGCCTCATCAGGG +SNPSTER:5:1:13:541#0/1 abbabaaabaabbabaaa``^aaaa_`\[OV^RY[] @SNPSTER:5:1:13:1957#0/1 AGAGCCTCGATACGCTCAAAGTCAAAATAATCAGCG +SNPSTER:5:1:13:1957#0/1 a``aa``a_`_`a``WXHY]LQVR``]BBBBBBBBB @SNPSTER:5:1:13:1589#0/1 CAAAAATTAAAATTTTTACCGCTTCGGCGTTATAAC +SNPSTER:5:1:13:1589#0/1 aba`\aaaa[_^baaaaaaa``a`a_^``^`a`_Y_ @SNPSTER:5:1:13:611#0/1 CGCAAAGCATTGGGATTATCATAAAACGCCTCTAAT +SNPSTER:5:1:13:611#0/1 abbbbbaaaba`__abbabaabbaaa`^``aabaaa @SNPSTER:5:1:13:1223#0/1 TAGCCGACGTTTTGGCGGCGCAACCTGTGACGACAA +SNPSTER:5:1:13:1223#0/1 abbabbabbabbb`^`]Z\ZXTa`aZU[O[]_^WHY @SNPSTER:5:1:13:1448#0/1 TCAAATAACCCTGAAACAAATGCTTAGGGATTTTAT +SNPSTER:5:1:13:1448#0/1 aba_W_^Xabaa^_aaaaXaa^`aa`[_]^aaaaUa @SNPSTER:5:1:13:1523#0/1 TCCTTTATCAGCGGCAGCCTTGCCACCAAGTCCCAC +SNPSTER:5:1:13:1523#0/1 a`aaaa\aaaX`]][[RDXU]MV\X\^OYLQ_^JQ_ @SNPSTER:5:1:13:69#0/1 CAGAATCGTTAGTTGATGGCGAAAGGTCGCAAAGTA +SNPSTER:5:1:13:69#0/1 aab^aa]bab`Y^aaY`X^`aYN\[_\_aaZ^QVXX @SNPSTER:5:1:13:629#0/1 CGAAATCATCTTCGGTTAAATCCAAAACGGCAGAAG +SNPSTER:5:1:13:629#0/1 a\aaab^ab_bba__X`PYY_^_X_\^LLJWNWT[W @SNPSTER:5:1:13:125#0/1 CAGCATCAGTGACGACATTAGAAATATCCTTTGCAG +SNPSTER:5:1:13:125#0/1 aaabaaaaa_aaaa^_Y]_]\XW\YSZ_^Z[]Y\YZ @SNPSTER:5:1:13:1813#0/1 CACTCATCCTTAATACCTTTCTTTTTGGGGTAATTA +SNPSTER:5:1:13:1813#0/1 aaaab`aaaaa^]aaaaaaaaaaaaaaaaaX``a`a @SNPSTER:5:1:13:1776#0/1 ACATACATATCACCATTATCGAACTCAACGCCCTGC +SNPSTER:5:1:13:1776#0/1 aaababaa_ababaaaa_aba_Zaaaaaa`aaa`aa @SNPSTER:5:1:13:1195#0/1 AGCTTTAGCCATAGCACCAGAAACAAAACTAGGGGC +SNPSTER:5:1:13:1195#0/1 ^\abbbaaabbba`aaaaa``aaaaaabaa_X][`a @SNPSTER:5:1:13:1307#0/1 AGCAATAAACTCAACAGGAGCAGGAAAGCGAGGGTA +SNPSTER:5:1:13:1307#0/1 aabaabaaa`baaa`aa][Ya_XZ_a_Ya^WL[_Y` @SNPSTER:5:1:13:1123#0/1 GTCCAAATGTTNTTGAGATGGCAGCAACGGAAACCA +SNPSTER:5:1:13:1123#0/1 aabaa_abb`^D^ba`a`a`]a^`aaa`_]_aaa`` @SNPSTER:5:1:13:424#0/1 TTGACACTCTCACGTTGGCTGACGACCGATTAGAGG +SNPSTER:5:1:13:424#0/1 aaaaa``aaaaaa^^`]T_a]\_Y]_]TS__V]Z\` @SNPSTER:5:1:13:62#0/1 TCATGGTAACGCTGCATGAAGTAATCACGTTCTTGG +SNPSTER:5:1:13:62#0/1 a]abbb^]Z^^`a^WNa_]]_Z^Ua[[Y\X[O\^]a @SNPSTER:5:1:13:553#0/1 AGCTTTAAGCGGCTCACCTTTAGCATCAACAGGCCA +SNPSTER:5:1:13:553#0/1 `]bbbbaaaa]Zaaaaa_aaba_aaaa[T_^VYaaa @SNPSTER:5:1:13:327#0/1 GATGCTGGTATTAAATCTGCCATTCAAGGCTCTAAT +SNPSTER:5:1:13:327#0/1 aaa`baaa_abbaa`baaaaaZaaa`\]Yaaa_Q^a @SNPSTER:5:1:13:1023#0/1 GAACAAAATGTGACTCATATCTAAACCAGTCCTTGA +SNPSTER:5:1:13:1023#0/1 U`bbbbb`ba`Z``bbababbbababaa]^abbb_` @SNPSTER:5:1:14:1511#0/1 GGTACGGTCAGGCATCCACGGCGCTTTAAAATAGTT +SNPSTER:5:1:14:1511#0/1 aa^`baa`a```a^aaa`a]`aaaaa`X]^^a^a_a @SNPSTER:5:1:14:992#0/1 CAAATGACGACTTCTACCACATCTATTGACATTATG +SNPSTER:5:1:14:992#0/1 abbaa_aaaaabbabaa`aa`bababa]``aaaaa` @SNPSTER:5:1:14:590#0/1 GAGTCAAGTTACTGAACAATCCGTACGTTTCCAGAC +SNPSTER:5:1:14:590#0/1 abbabbb^abbaa_aaaaabaa^aaaXabaaaaaaa @SNPSTER:5:1:14:925#0/1 TGACAAGTAAAGGACGGTTGTCAGCGTCATAAGAGG +SNPSTER:5:1:14:925#0/1 aaaaa`[`aa`_a_\SQ]a]`__[\[_]^a_^_\[` @SNPSTER:5:1:14:687#0/1 GCTGTTGGTTTCTATGTGGCTAAATACGTTAACAAA +SNPSTER:5:1:14:687#0/1 ^abaaaY^abbabaaV`\_abaaab``_aa`a`aaa @SNPSTER:5:1:14:2006#0/1 GATGCTTCCTCTGCTGGTATGGTTGACGCCGGATTT +SNPSTER:5:1:14:2006#0/1 aa`aaaaaaaa`aa`aaVa_a_Z`a`______WY`_ @SNPSTER:5:1:14:1633#0/1 TGGAAGGCGCTGAATTTACGGAAAACATTATTAATG +SNPSTER:5:1:14:1633#0/1 a\`Ya```_`a__`\`_a^a\__\YNWVOQ\UYa^_ @SNPSTER:5:1:14:119#0/1 CCTAAGCAGAAAACCTACCGCGCTTCGCTTGGTCAA +SNPSTER:5:1:14:119#0/1 aba[W`bX`SHX`aaa`aa`a[a__`_`[^X^W`X^ @SNPSTER:5:1:14:1189#0/1 GAAGCCCCTGCAATTAAAATTGTTGACCACCTACAT +SNPSTER:5:1:14:1189#0/1 _aa]\ab]`[Yaabb_XVab_^_a__Z]``aaaa^b @SNPSTER:5:1:14:1929#0/1 CATCAGCATGAGCCTGTCGCATTGCATTCATCAAAC +SNPSTER:5:1:14:1929#0/1 aaaaaaaa`_a`aa`_^``a``__`X___^`^\`_` @SNPSTER:5:1:14:166#0/1 ATACAATTGGGAGAGTGTCAATCCTGACGGTTATTT +SNPSTER:5:1:14:166#0/1 aaab_aaaaaa`a]`\`_a_Z_aa]\T^X]W^_``` @SNPSTER:5:1:14:1174#0/1 GGCATGGTCAATATAACCAGTAGTGTTAACAGTCGG +SNPSTER:5:1:14:1174#0/1 aababb^aaaababaaa`a``a_`aabaa^^a``]^ @SNPSTER:5:1:14:532#0/1 ATGGAACAACTCACTAAAAACCAAGCTGTCGCTACT +SNPSTER:5:1:14:532#0/1 a_aa\\a_aaa``ba`^]\aaaa`]\``\]S]ZV\_ @SNPSTER:5:1:14:1707#0/1 TAGCATTGTGCCAATTCATCCATTAACTTCTCAGTA +SNPSTER:5:1:14:1707#0/1 abba^abbabbb`\abbbbba`aab`bbaaaa```b @SNPSTER:5:1:14:900#0/1 GACGCTGACAACCGTCCTTTACTTGTCATGCGCTCT +SNPSTER:5:1:14:900#0/1 a``[aaTa_aa\YX]Z`bba]^aaR_\_[FOL[a^a @SNPSTER:5:1:14:1187#0/1 ATACGAAGGCGCATAACGATACCACTGACCCTCAGC +SNPSTER:5:1:14:1187#0/1 abaaaa]]Z_Zaaa__\W^`a\`_`^M^_^_`a]X[ @SNPSTER:5:1:14:1502#0/1 CAATTGGGAGGGTGTCAATCCTGACGGTTATTTCCT +SNPSTER:5:1:14:1502#0/1 aaaaaaaa^`aa^a_`^_aaaaaaa``^a``aaaa` @SNPSTER:5:1:14:1615#0/1 TTATAACCTCACACTCAATCTTTTATCACGAAGTCA +SNPSTER:5:1:14:1615#0/1 aaaaaaaaaaaa_a``_`a_aaaaa````[W\[[_X @SNPSTER:5:1:14:1920#0/1 GATAAGCTGGTTCTCACTTCTGTTACTCCAGCTTCT +SNPSTER:5:1:14:1920#0/1 aaaabab_aaWaaaaZ]_aa_a`^[^\`[]`a_a`B @SNPSTER:5:1:14:1907#0/1 TCGTTTTCCGCCTACTGCGACTAAAGAGATTCAGTA +SNPSTER:5:1:14:1907#0/1 aab_aaaaaaaaaa`aaaaaaaaa`a_a_aaa]^_X @SNPSTER:5:1:14:880#0/1 AAATGTGACTCATATCTAAACCAGTCCTTGACGAAC +SNPSTER:5:1:14:880#0/1 abbbbabaabaabab`baaaaaabaaabaZ^`a``` @SNPSTER:5:1:14:1894#0/1 GGCAGACTTGCCACCAAGTCCAACCAAATCAAGCAA +SNPSTER:5:1:14:1894#0/1 abbbaabbaabb`bba`a`ababab`b_`aaaab`^ @SNPSTER:5:1:14:812#0/1 CTGCTGGTATGGTTGACGCCGGATTTGAGAATCAAA +SNPSTER:5:1:14:812#0/1 ab_a`U\aba[Yaa_`_Q__W\\abaXXW\`baaab @SNPSTER:5:1:14:1719#0/1 TGCAATGAAGAAAACCACCATTACCAGCATTAACCG +SNPSTER:5:1:14:1719#0/1 aab_abb`aaa_aaaaaaa`aaabaaaaY`a``aaa @SNPSTER:5:1:15:1951#0/1 ATTACATCACTCCTTCTGCACGTAATTTTTGACGCA +SNPSTER:5:1:15:1951#0/1 aa`aa`abaaaabaaaaaa_aaYUU``aaa`_a_a_ @SNPSTER:5:1:15:1390#0/1 CGAGAAGCTCTTACTTTGCGACCTTTCGCCATCAAC +SNPSTER:5:1:15:1390#0/1 a^]a``aa`^]`Y^[``P]VZ\a\^a^X]_O\^V^_ @SNPSTER:5:1:15:311#0/1 TTATCTTGCTGCTGCATTTCCTGAGCTTAATGCTTG +SNPSTER:5:1:15:311#0/1 abaabaa_`a`a`Y`aa`aaa``[^^`_XZ`\]``` @SNPSTER:5:1:15:1101#0/1 TTACCTCCAAATGAAGAAATAACATCATGGTAACGC +SNPSTER:5:1:15:1101#0/1 aaa`aa``_`_a]^\U_^_a___\a_]`^VX^_^X^ @SNPSTER:5:1:15:1891#0/1 TTGCTGCCGTCATTGCTTATTATGTTCATCCCGTCA +SNPSTER:5:1:15:1891#0/1 aabbbbaab`_ab`^`aaa``Z_a\aa_]]a`_``` --- test/test_data/fastq_parser/illumina_faked.fastq --- @Test PHRED qualities from 40 to 0 inclusive ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTN + hgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@ --- test/test_data/fastq_parser/illumina_full_range_as_illumina.fastq --- @FAKE0005 Original version has PHRED scores from 62 to 0 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACG + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ @FAKE0006 Original version has PHRED scores from 0 to 62 inclusive (in that order) GCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@ --- test/test_data/fastq_parser/illumina_full_range_as_sanger.fastq --- @FAKE0005 Original version has PHRED scores from 62 to 0 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACG + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ @FAKE0006 Original version has PHRED scores from 0 to 62 inclusive (in that order) GCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + _^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! --- test/test_data/fastq_parser/illumina_full_range_as_solexa.fastq --- @FAKE0005 Original version has PHRED scores from 62 to 0 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACG + ;;>@BCEFGHJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ @FAKE0006 Original version has PHRED scores from 0 to 62 inclusive (in that order) GCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJHGFECB@>;; --- test/test_data/fastq_parser/illumina_full_range_original_illumina.fastq --- @FAKE0005 Original version has PHRED scores from 62 to 0 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACG + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ @FAKE0006 Original version has PHRED scores from 0 to 62 inclusive (in that order) GCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@ --- test/test_data/fastq_parser/longreads_as_illumina.fastq --- @FSRRS4401BE7HA [length=395] [gc=36.46] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=95] tcagTTAAGATGGGATAATATCCTCAGATTGCGTGATGAACTTTGTTCTGGTGGAGGAGAAGGAAGTGCATTCGACGTATGCCCGTTTGTCGATATTTGtatttaaagtaatccgtcacaaatcagtgacataaatattatttagatttcgggagcaactttatttattccacaagcaggtttaaattttaaatttaaattattgcagaagactttaaattaacctcgttgtcggagtcatttgttcggttattggtcgaaagtaaccncgggaagtgccgaaaactaacaaacaaaagaagatagtgaaattttaattaaaanaaatagccaaacgtaactaactaaaacggacccgtcgaggaactgccaacggacgacacagggagtagnnn + eeeccccccc`UUU^UWWeegffhhhhhhhhhhhhhhhhhhggghhhhhhhhhfgfeeeee\\\\ceeeeeeeeeeeeeec^^^YRPOSNVU\YTMMMSMRKKKRUUNNNNS[`aa```\bbeccccccccYUUUbceeee\[`a`\ZYRRRPPP[\\\XXZaWWXeeeeeeccacaccc\WWSSQRPMMKKKLKKKKKKKKPPRRMMLLLPVPPPKKKKKQQTTTPRPPQPMLLMKRRRPPKMKKRLLKKMKKLLKRTPPPQRMMLL@KKKKLLKLLLLXKKKKW\KKLKKKLKKKKLLLQUYXYTLMMPKKKKPPNNKKKK@KKPXPVLLKKKKLRMKLLKKPVKKKKLLLJPPPPRMOROOOOKKKOSSSOOORUZXUUUQMNNZV][Z@@@ @FSRRS4401BRRTC [length=145] [gc=38.62] [flows=800] [phred_min=0] [phred_max=38] [trimmed_length=74] tcagCCAGCAATTCCGACTTAATTGTTCTTCTTCCATCATTCATCTCGACTAACAGTTCTACGATTAATGAGTTTGGCtttaatttgttgttcattattgtcacaattacactactgagactgccaaggcacncagggataggnn + eeeeeeeeecccceeeefecccca`````\[SSSS__a\TTTYaaaaa__^WYW[^[WXWXW[WSSSQZ\\RKKKTPSKKKPPKKKMKKQPVVVTTTTPRKMMLLPPPTVTWMNNRSSWW][[ZZZZXXSSN@NSKKKTVWTT@@ @FSRRS4401B64ST [length=382] [gc=40.58] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=346] tcagTTTTCTTAAATTACTTGAATCTGTTGAAGTGGATGTCCACTTTTGTATGCCAAATATGCCCAGCGTATACGATCTTGGCCACATCTCCACATAATCATCAGTCGGATGCAAAAAGCGATTAAACTAAAAATGAATGCGTTTTTAGATGAGTAAATAGGTAATACTTTGTTTAAATAATAAATGTCACAAACAGAACGCGGATTACAGTACCTGAAAATAGTTGTACTGTATCTGTGCCGGCACTTCCTCGGCCCTGAGAAGTTGTCCCGTTGTTTCCATTCGCACCATCCAATGGCCAAAGTTTGCGAAGAATCTGTTCCGTTCCATTACCAATTGTTTTTCCATGctgagactgccaaggcacacaggggataggnn + hhhhbbbbh^^UUUhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhUUUUh`hhhhh^^^hhhhbbbhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhUURRRdhbdYYRRW\NLLLLKW\]]^^YQLNNNNV]bddhdhggghhhhhhhhhdZZXXPPPXXa^^^habghhhhhhggghhggghhhhhhhhhhhhhhhhhhaabbhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhfffhhhhhhhhhc^\\\chhhggghhhhhhhhhggghhhhhhhhhhggghggghhhhhhhhhhhhhhhhhhhhhh^]ZXXWW\\TLLLLM__`dfhhhhhhhhhgg^^^^dhhheeXXXZdhhaa@@ @FSRRS4401EJ0YH [length=381] [gc=48.29] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=343] tcagTTTTTGGAGAATTCCGTCAGGGACGGCATGGCATATTTGTGGGTTCGGCACGGCGTCCTGGCCAAGAAGAAGAAGACGAATTAGCCCGTTAATTTAATGACACCTTCCCCAATTTTGCAGCAATGATTGGTTCATTCTTGGCGGTGCGTTTTTGTGCTTCGTCGAATTGTTGGCCATTTTGGTCCACCGGCCATCATCTTTACGCTATCCGACTGATTGGAAATCACCGCCTAGCATTTTGCCGAAGATTGTTGCGTTGTACGGCCATGTGCTGATTGTTTACATTGGCATTCTTGGCAATTTGTCCTTGGTCGGCTTTGACGGCAAATTTGCGGTGTTAAGTctgagactgccaaggcacacagggggatagggnn + hhhh^^^^^hhhhhhhhhhhhhhggghhhhhhhhhhhhhggghhggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggghhhhhggghhhhhhhhhhh````hh]]]]hhhhhhhhhhhhhhhhhhhhhhhhhhddhddZRRRRRcVhhhhhhhhhhhhhhhhhhhhhbb__gghhhhhhhhhhhhhhhhggghhhhhhhhhhhhhhhhhhhggghhhhhhhhhhhhhaaaahgbcbghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggghhhggbbchhhhhhggghhbbbg\bbhhhhhhhhhfffhhhhhhgggggghhhhhhhhhhhhhhhggghhggd^^]]^dedd^NNNNNZYWOLL@@ @FSRRS4401BK0IB [length=507] [gc=49.31] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=208] tcagTTGACCGGCGTTGTGTAACAATAATTCATTATTCTGAGACGATGCCAATGTAATCGACGGTTTATGCCCAATTATTCCCATCTATGCTTAACTGATCAAATACTATTTGCATTACGTCACGAAATTGCGCGAACACCGCCGGCCGACAATAATTTATACCGGACATACCGGAGTTGATGGTAATCGGTAAAGAGTTTTATTTAATTATntattatcnctattaattattgttancaacaatgtgcacgctntgccgcccgccgccgccgtgtcggtaggaccccggacggacccggacccggttcgggtacccgttttcgggttcccggaaccgtttttcgggtacccggttttttcggggggccccccggtaaaaaaccggggaaccccctaaaacgggtaaacgtaccgtaagggaccccctaaacgggggccccgaaaaaccgggacccaaaccggggggaaacggttaaaggggggggaagtaggngnnnnnnnnnnnn + eee`__eeeeeeeeeeggaYYY_aeeeeffghghhhhhhhhhhhhhhhhhhhhhhheeeeeeeee^\a`_PPPWWOPP[[WWZ^``accb^^^cc````c`UUUc^ccc\\\\\``]^]][[[\[PPPWW[[^^^``^XTTT\`aaa__^\]]^__PPPSQYYcc`^^^ceeeeeeeeeeeeea````[[OOOOMQQ\NNNNWKLLPPPPPP@QRLLNQS@RVYUUUU[ZWQQNMMS@SUTQPPVVTTRMLMQR@QRPPQPPPQKKLKKQPP\\TLLLLLLKPQKKKKKKLKKKLPKKKKLKKPTTLLKKKKPRPPPMKKKKKKKKJJPPPMMPPMMPKKKKKKKKKJRKKKKKLLQQLLLLLNNLLLLTTNNIINLLQQLLIIKKKKIIKKKKKKMPMKIKKKKIIIKKKKKKKKKKKKKKKKKKKKKKKHKKLKKKKKKHKKKKKIINNMHKKKNNNKKKKKKKKKKKMHHRRLLLKKKKKKKKKKGOKKK@M@@@@@@@@@@@@ @FSRRS4401ARCCB [length=258] [gc=46.90] [flows=800] [phred_min=0] [phred_max=38] [trimmed_length=193] tcagTTATTGCAGTCGTTCCGCGCCATCGCCGGTAACCGTCCGCGTGTTATTCTGTGTATCGGCCAACCTTCGTATAACTTCGTATAATGTATGCTATACGAAGTTATTACGATCTATACCGGCGAAACTCAGCCGAAAGGTCTCGCGGTAGAGCCTATGAGCTGCCCGACCGATGCATTTAAATTTCCGGGGATCGtcgctgatctgagactgccaaaggcacactagggggataggnnnnnnnnnnnnnnnnnnnn + eee[WYY_ceeeeeeeffecb`````a__OOOOSU[ZUURQQRUUVUQQSRRSW[[\^^SSSTYY]`a```_[[\\a\YTTTYaac^^\acccceeebbbbbbbeebccceeeeeca``\\WWWWOOOS][[[XXUWWZWWX[WWX^aaaa`\^^^ccaaa__^^WWWWXLLLQRVVVPKKKKKKKKLLPPTQ[[OOPTW`_][[[[[SRQVVVPPKKKLLRV\\\VTKLLLLRSUUU@@@@@@@@@@@@@@@@@@@@ @FSRRS4401CM938 [length=453] [gc=44.15] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=418] tcagGTTTTAAATCGCTTTCCAAGGAATTTGAGTCTAAATCCGGTGGATCCCATCAGTACAAATGCGGCGACAAGGCCGTGAAAACACTGCTTAATTCTTTGCACTTTTTGGCCACCTTTTTGGAAATGTTGTTTTGTGTTCTCAAAATTTTCCATCTCAGAACAAACATTCCATCGGGCTGATGTTGTGGCTTTTGGCGCGCGAAGTGCTGCTACTGCGCGGCAAAATCAGTCGCCAGACCGGTTTTGTTGTGGACGACAAAGTGATCATGCCTGACTTGTACTTCTACCGCGATCCGCAAGCGCGAATTGGTCACATAGTTATAGAATTTTTGAGCCTTTTTCTTGACATAAAAAGTGTGGTTTTAAAAATTTCCTGGCAGGACCCACGCCAACGTTCAGGAATAATATCTTTTAAAAAGctgagactgccaaggcacacaggggataggn + hhhhhbb]]UUUhhhhbbbhhhhhhhhggghhhhhfUUUhhhhhhhhhhggghhhhhhhhbbbhhhhhhhhhhhhhhhhhh____hhhhhhhhhhhhhggghhhh^^^\ZhhddhYYNNNNNVTSSY^haaVQQSSdWddbdab\_______gghhhhhhhhhhaaahhhhhhhhhggghhhhhhhhhhhhhbbbbhhhhhhhhhhhhhhhhhhhhhhhhhhhhUUUUcdhhgda^^c_VVVVVQQQQcWXddhhhhhhhggghhhhhhhhggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggghhhhhhhhhhhhhhh\\^\\hhhhh^^^\ZhURcccWQLLKKKRW\\YYLLLLKKLLLJJJRROUUZ_URWOOOWNYWWX[Yafhhhhhhhhhed[^eTTOOLLLLLTYZZZY]^_b[[VXXXdddddd____ddddd@ @FSRRS4401EQLIK [length=411] [gc=34.31] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=374] tcagTTTAATTTGGTGCTTCCTTTCAATTCCTTAGTTTAAACTTGGCACTGAAGTCTCGCATTTATAACTAGAGCCCGGATTTTAGAGGCTAAAAAGTTTTCCAGATTTCAAAATTTATTTCGAAACTATTTTTCTGATTGTGATGTGACGGATTTCTAAATTAAATCGAAATGATGTGTATTGAACTTAACAAGTGATTTTTATCAGATTTTGTCAATGAATAAATTTTAATTTAAATCTCTTTCTAACACTTTCATGATTAAAATCTAACAAAGCGCGACCAGTATGTGAGAAGAGCAAAAACAACAAAAAGTGCTAGCACTAAAGAAGGTTCGAACCCAACACATAACGTAAGAGTTACCGGGAAGAAAACCACTctgagactgccaaggcacacagggggataggnn + hhh^UUU^^ggghhhhhhhhhfffhhhhhhhhhhhfffggghhhhhhhhhhhhhhhhhhhhfffhhhhhhhhhhggghhh____hhhhdhdPPPPOOLLLLQQ^\WLLLYLLLLLLLKKKKRRLLLTYRKLLLLYPaadddghhhhhhhhhhha^^`PQQOOOMMMY^\OQSfhhhhhhhhhhhhhhhhhhdbbgga\NNLKKQP^^[TLOOQ\Ueaa^YX[\PPNSSSSNNLNNVV^^fdhddgh`bbhhhggghhhhhhhbbb`hhhgggggghhhhhhhhhhhhhhhhhhhhhhddPNNLLWQQZLLLLMVVV_dhhhhhh^^^hhhhhhhhhhhggghhhhhhhhhhhhhhhhhhhhXXSQQVVVTTTT`dZhdddddhhhhh^^XVTT]_\\YRKKKKKRRRRU@@ @FSRRS4401AOV6A [length=309] [gc=22.98] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=273] tcagTTTTCAAATTTTCCGAAATTTGCTGTTTGGTAGAAGGCAAATTATTTGATTGAATTTTGTATTTATTTAAAACAATTTATTTTAAAATAATAATTTTCCATTGACTTTTTACATTTAATTGATTTTATTATGCATTTTATATTTGTTTTCTAAATATTCGTTTGCAAACTCACGTTGAAATTGTATTAAACTCGAAATTAGAGTTTTTGAAATTAATTTTTATGTAGCATAATATTTTAAACATATTGGAATTTTATAAAACATTATATTTTTctgagactgccaaggcacacagggggataggn + hhhhbbbbhZZZbbbbhhh^^^ggghhhhggghhhhhhhhhhggghhhggghhhhhhh____hehbbbhb``ZZZZdc^a__cUUSSTTTT[[[fhh]]``hhhhhhhhZZZYYhhh^^^bbbhhhZZZZheehhhhhbbbahahddcbSSSS^Saaad^dhhhbgghhZZZghhhhhhggZZZgghhhhhZZZhhhhggghhhhhh]]^^]hddaffYYPPPPNSUeaeaa^\Z\`^XVVVPPPXYd```ccacVVVV\NPPPPQQc`__aUWZZZhWgghhhhhZZZZ^]hdbbbaNNNNNZVST\@ @FSRRS4401EG0ZW [length=424] [gc=23.82] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=389] tcagTTTTGATCTTTTAATAATGAATTTTAATGTGTTAAAATGATTGCATTGATGGCATAACCGCATTTAAATTAATTACATGAAGTGTAAGTATGAAATTTTCCTTTCCAAATTGCAAAAACTAAAATTTAAAATTTATCGTAAAAATTAACATATATTTTAAACGATTTTAAGAAACATTTGTAAATTATATTTTTGTGAAGCGTTCAAACAAAAATAAACAATAAAATATTTTTCTATTTAATAGCAAAACATTTGACGATGAAAAGGAAAATGCGGGTTTGAAAATGGGCTTTGCCATGCTATTTTCATAATAACATATTTTTATTATGAATAATAAATTTACATACAATATATACAGTCTTAAATTTATTCATAATATTTTTGAGAATctgagactgccaaggcacacaggggataggn + hh`XSSSTddhh\\\]hhhhhhhhhbbbbhhghhhbbZZZZhhhhhhhhhhhhhhhhhhhhhhhhheZZUUUcchhhhhhhhhhhhhhhhhhhddXSSSQQSS__UUUbb[[acc`\LLLLLQ[KKKKUTXNNOO\\\WbhhhZ]]\\ggZZhhhhhhbb__^^^hhh____hb^UUUghccbh^a^^bb[ddPPPPPaSaccbaZ\_aVVV]NNNNL\RQR^SQRKKKN\PKKKKLYSdZ^^dhhhhhbbbbh]ZZZhhhhhhh[[__^\NNNNV\`XXXWW[[SSTThdddhhhhhhhhhhhhh[XXXghhhhhhhhhhh^^^^^hhhhhhhhhhhb`bZTTTRXdhhhhhhhhhhhhhhhhggXXXgggh`\`ddee_\MMMMM`c___ccddddehhhZZZXVVeebbb_QSSSX^ecc@ --- test/test_data/fastq_parser/longreads_as_sanger.fastq --- @FSRRS4401BE7HA [length=395] [gc=36.46] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=95] tcagTTAAGATGGGATAATATCCTCAGATTGCGTGATGAACTTTGTTCTGGTGGAGGAGAAGGAAGTGCATTCGACGTATGCCCGTTTGTCGATATTTGtatttaaagtaatccgtcacaaatcagtgacataaatattatttagatttcgggagcaactttatttattccacaagcaggtttaaattttaaatttaaattattgcagaagactttaaattaacctcgttgtcggagtcatttgttcggttattggtcgaaagtaaccncgggaagtgccgaaaactaacaaacaaaagaagatagtgaaattttaattaaaanaaatagccaaacgtaactaactaaaacggacccgtcgaggaactgccaacggacgacacagggagtagnnn + FFFDDDDDDDA666?688FFHGGIIIIIIIIIIIIIIIIIIHHHIIIIIIIIIGHGFFFFF====DFFFFFFFFFFFFFFD???:3104/76=:5...4.3,,,366////4<ABBAAA=CCFDDDDDDDD:666CDFFFF=<ABA=;:333111<===99;B889FFFFFFDDBDBDDD=8844231..,,,-,,,,,,,,1133..---17111,,,,,22555131121.--.,33311,.,,3--,,.,,--,3511123..--!,,,,--,----9,,,,8=,,-,,,-,,,,---26:9:5-..1,,,,11//,,,,!,,1917--,,,,-3.,--,,17,,,,---+11113.030000,,,044400036;96662.//;7><;!!! @FSRRS4401BRRTC [length=145] [gc=38.62] [flows=800] [phred_min=0] [phred_max=38] [trimmed_length=74] tcagCCAGCAATTCCGACTTAATTGTTCTTCTTCCATCATTCATCTCGACTAACAGTTCTACGATTAATGAGTTTGGCtttaatttgttgttcattattgtcacaattacactactgagactgccaaggcacncagggataggnn + FFFFFFFFFDDDDFFFFGFDDDDBAAAAA=<4444@@B=555:BBBBB@@?8:8<?<89898<84442;==3,,,514,,,11,,,.,,21777555513,..--1115758.//34488><<;;;;9944/!/4,,,57855!! @FSRRS4401B64ST [length=382] [gc=40.58] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=346] tcagTTTTCTTAAATTACTTGAATCTGTTGAAGTGGATGTCCACTTTTGTATGCCAAATATGCCCAGCGTATACGATCTTGGCCACATCTCCACATAATCATCAGTCGGATGCAAAAAGCGATTAAACTAAAAATGAATGCGTTTTTAGATGAGTAAATAGGTAATACTTTGTTTAAATAATAAATGTCACAAACAGAACGCGGATTACAGTACCTGAAAATAGTTGTACTGTATCTGTGCCGGCACTTCCTCGGCCCTGAGAAGTTGTCCCGTTGTTTCCATTCGCACCATCCAATGGCCAAAGTTTGCGAAGAATCTGTTCCGTTCCATTACCAATTGTTTTTCCATGctgagactgccaaggcacacaggggataggnn + IIIICCCCI??666IIIIIIIIIIIIIIIIIIIIIIIIIIIIII6666IAIIIII???IIIICCCIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII66333EICE::338=/----,8=>>??:2-////7>CEEIEIHHHIIIIIIIIIE;;9911199B???IBCHIIIIIIHHHIIHHHIIIIIIIIIIIIIIIIIIBBCCIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIGGGIIIIIIIIID?===DIIIHHHIIIIIIIIIHHHIIIIIIIIIIHHHIHHHIIIIIIIIIIIIIIIIIIIIII?>;9988==5----.@@AEGIIIIIIIIIHH????EIIIFF999;EIIBB!! @FSRRS4401EJ0YH [length=381] [gc=48.29] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=343] tcagTTTTTGGAGAATTCCGTCAGGGACGGCATGGCATATTTGTGGGTTCGGCACGGCGTCCTGGCCAAGAAGAAGAAGACGAATTAGCCCGTTAATTTAATGACACCTTCCCCAATTTTGCAGCAATGATTGGTTCATTCTTGGCGGTGCGTTTTTGTGCTTCGTCGAATTGTTGGCCATTTTGGTCCACCGGCCATCATCTTTACGCTATCCGACTGATTGGAAATCACCGCCTAGCATTTTGCCGAAGATTGTTGCGTTGTACGGCCATGTGCTGATTGTTTACATTGGCATTCTTGGCAATTTGTCCTTGGTCGGCTTTGACGGCAAATTTGCGGTGTTAAGTctgagactgccaaggcacacagggggatagggnn + IIII?????IIIIIIIIIIIIIIHHHIIIIIIIIIIIIIHHHIIHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIHHHIIIIIHHHIIIIIIIIIIIAAAAII>>>>IIIIIIIIIIIIIIIIIIIIIIIIIIEEIEE;33333D7IIIIIIIIIIIIIIIIIIIIICC@@HHIIIIIIIIIIIIIIIIHHHIIIIIIIIIIIIIIIIIIIHHHIIIIIIIIIIIIIBBBBIHCDCHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIHHHIIIHHCCDIIIIIIHHHIICCCH=CCIIIIIIIIIGGGIIIIIIHHHHHHIIIIIIIIIIIIIIIHHHIIHHE??>>?EFEE?/////;:80--!! @FSRRS4401BK0IB [length=507] [gc=49.31] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=208] tcagTTGACCGGCGTTGTGTAACAATAATTCATTATTCTGAGACGATGCCAATGTAATCGACGGTTTATGCCCAATTATTCCCATCTATGCTTAACTGATCAAATACTATTTGCATTACGTCACGAAATTGCGCGAACACCGCCGGCCGACAATAATTTATACCGGACATACCGGAGTTGATGGTAATCGGTAAAGAGTTTTATTTAATTATntattatcnctattaattattgttancaacaatgtgcacgctntgccgcccgccgccgccgtgtcggtaggaccccggacggacccggacccggttcgggtacccgttttcgggttcccggaaccgtttttcgggtacccggttttttcggggggccccccggtaaaaaaccggggaaccccctaaaacgggtaaacgtaccgtaagggaccccctaaacgggggccccgaaaaaccgggacccaaaccggggggaaacggttaaaggggggggaagtaggngnnnnnnnnnnnn + FFFA@@FFFFFFFFFFHHB:::@BFFFFGGHIHIIIIIIIIIIIIIIIIIIIIIIIFFFFFFFFF?=BA@11188011<<88;?AABDDC???DDAAAADA666D?DDD=====AA>?>><<<=<11188<<???AA?9555=ABBB@@?=>>?@@11142::DDA???DFFFFFFFFFFFFFBAAAA<<0000.22=////8,--111111!23--/24!37:6666<;822/..4!46521177553.-.23!231121112,,-,,211==5------,12,,,,,,-,,,-1,,,,-,,155--,,,,13111.,,,,,,,,++111..11..1,,,,,,,,,+3,,,,,--22-----//----55//**/--22--**,,,,**,,,,,,.1.,*,,,,***,,,,,,,,,,,,,,,,,,,,,,,),,-,,,,,,),,,,,**//.),,,///,,,,,,,,,,,.))33---,,,,,,,,,,(0,,,!.!!!!!!!!!!!! @FSRRS4401ARCCB [length=258] [gc=46.90] [flows=800] [phred_min=0] [phred_max=38] [trimmed_length=193] tcagTTATTGCAGTCGTTCCGCGCCATCGCCGGTAACCGTCCGCGTGTTATTCTGTGTATCGGCCAACCTTCGTATAACTTCGTATAATGTATGCTATACGAAGTTATTACGATCTATACCGGCGAAACTCAGCCGAAAGGTCTCGCGGTAGAGCCTATGAGCTGCCCGACCGATGCATTTAAATTTCCGGGGATCGtcgctgatctgagactgccaaaggcacactagggggataggnnnnnnnnnnnnnnnnnnnn + FFF<8::@DFFFFFFFGGFDCAAAAAB@@000046<;66322366762243348<<=??4445::>ABAAA@<<==B=:555:BBD??=BDDDDFFFCCCCCCCFFCDDDFFFFFDBAA==88880004><<<99688;889<889?BBBBA=???DDBBB@@??88889---237771,,,,,,,,--1152<<00158A@><<<<<43277711,,,--37===75,----34666!!!!!!!!!!!!!!!!!!!! @FSRRS4401CM938 [length=453] [gc=44.15] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=418] tcagGTTTTAAATCGCTTTCCAAGGAATTTGAGTCTAAATCCGGTGGATCCCATCAGTACAAATGCGGCGACAAGGCCGTGAAAACACTGCTTAATTCTTTGCACTTTTTGGCCACCTTTTTGGAAATGTTGTTTTGTGTTCTCAAAATTTTCCATCTCAGAACAAACATTCCATCGGGCTGATGTTGTGGCTTTTGGCGCGCGAAGTGCTGCTACTGCGCGGCAAAATCAGTCGCCAGACCGGTTTTGTTGTGGACGACAAAGTGATCATGCCTGACTTGTACTTCTACCGCGATCCGCAAGCGCGAATTGGTCACATAGTTATAGAATTTTTGAGCCTTTTTCTTGACATAAAAAGTGTGGTTTTAAAAATTTCCTGGCAGGACCCACGCCAACGTTCAGGAATAATATCTTTTAAAAAGctgagactgccaaggcacacaggggataggn + IIIIICC>>666IIIICCCIIIIIIIIHHHIIIIIG666IIIIIIIIIIHHHIIIIIIIICCCIIIIIIIIIIIIIIIIII@@@@IIIIIIIIIIIIIHHHIIII???=;IIEEI:://///7544:?IBB72244E8EECEBC=@@@@@@@HHIIIIIIIIIIBBBIIIIIIIIIHHHIIIIIIIIIIIIICCCCIIIIIIIIIIIIIIIIIIIIIIIIIIII6666DEIIHEB??D@777772222D89EEIIIIIIIHHHIIIIIIIIHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIHHHIIIIIIIIIIIIIII==?==IIIII???=;I63DDD82--,,,38==::----,,---+++33066;@6380008/:889<:BGIIIIIIIIIFE<?F5500-----5:;;;:>?@C<<7999EEEEEE@@@@EEEEE! @FSRRS4401EQLIK [length=411] [gc=34.31] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=374] tcagTTTAATTTGGTGCTTCCTTTCAATTCCTTAGTTTAAACTTGGCACTGAAGTCTCGCATTTATAACTAGAGCCCGGATTTTAGAGGCTAAAAAGTTTTCCAGATTTCAAAATTTATTTCGAAACTATTTTTCTGATTGTGATGTGACGGATTTCTAAATTAAATCGAAATGATGTGTATTGAACTTAACAAGTGATTTTTATCAGATTTTGTCAATGAATAAATTTTAATTTAAATCTCTTTCTAACACTTTCATGATTAAAATCTAACAAAGCGCGACCAGTATGTGAGAAGAGCAAAAACAACAAAAAGTGCTAGCACTAAAGAAGGTTCGAACCCAACACATAACGTAAGAGTTACCGGGAAGAAAACCACTctgagactgccaaggcacacagggggataggnn + III?666??HHHIIIIIIIIIGGGIIIIIIIIIIIGGGHHHIIIIIIIIIIIIIIIIIIIIGGGIIIIIIIIIIHHHIII@@@@IIIIEIE111100----22?=8---:-------,,,,33---5:3,----:1BBEEEHIIIIIIIIIIIB??A122000...:?=024GIIIIIIIIIIIIIIIIIIECCHHB=//-,,21??<5-002=6FBB?:9<=11/4444//-//77??GEIEEHIACCIIIHHHIIIIIIICCCAIIIHHHHHHIIIIIIIIIIIIIIIIIIIIIIEE1//--822;----.777@EIIIIII???IIIIIIIIIIIHHHIIIIIIIIIIIIIIIIIIII994227775555AE;IEEEEEIIIII??9755>@==:3,,,,,33336!! @FSRRS4401AOV6A [length=309] [gc=22.98] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=273] tcagTTTTCAAATTTTCCGAAATTTGCTGTTTGGTAGAAGGCAAATTATTTGATTGAATTTTGTATTTATTTAAAACAATTTATTTTAAAATAATAATTTTCCATTGACTTTTTACATTTAATTGATTTTATTATGCATTTTATATTTGTTTTCTAAATATTCGTTTGCAAACTCACGTTGAAATTGTATTAAACTCGAAATTAGAGTTTTTGAAATTAATTTTTATGTAGCATAATATTTTAAACATATTGGAATTTTATAAAACATTATATTTTTctgagactgccaaggcacacagggggataggn + IIIICCCCI;;;CCCCIII???HHHIIIIHHHIIIIIIIIIIHHHIIIHHHIIIIIII@@@@IFICCCICAA;;;;ED?B@@D66445555<<<GII>>AAIIIIIIII;;;::III???CCCIII;;;;IFFIIIIICCCBIBIEEDC4444?4BBBE?EIIICHHII;;;HIIIIIIHH;;;HHIIIII;;;IIIIHHHIIIIII>>??>IEEBGG::1111/46FBFBB?=;=A?97771119:EAAADDBD7777=/111122DA@@B68;;;I8HHIIIII;;;;?>IECCCB/////;745=! @FSRRS4401EG0ZW [length=424] [gc=23.82] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=389] tcagTTTTGATCTTTTAATAATGAATTTTAATGTGTTAAAATGATTGCATTGATGGCATAACCGCATTTAAATTAATTACATGAAGTGTAAGTATGAAATTTTCCTTTCCAAATTGCAAAAACTAAAATTTAAAATTTATCGTAAAAATTAACATATATTTTAAACGATTTTAAGAAACATTTGTAAATTATATTTTTGTGAAGCGTTCAAACAAAAATAAACAATAAAATATTTTTCTATTTAATAGCAAAACATTTGACGATGAAAAGGAAAATGCGGGTTTGAAAATGGGCTTTGCCATGCTATTTTCATAATAACATATTTTTATTATGAATAATAAATTTACATACAATATATACAGTCTTAAATTTATTCATAATATTTTTGAGAATctgagactgccaaggcacacaggggataggn + IIA94445EEII===>IIIIIIIIICCCCIIHIIICC;;;;IIIIIIIIIIIIIIIIIIIIIIIIIF;;666DDIIIIIIIIIIIIIIIIIIIEE94442244@@666CC<<BDDA=-----2<,,,,659//00===8CIII;>>==HH;;IIIIIICC@@???III@@@@IC?666HIDDCI?B??CC<EE11111B4BDDCB;=@B777>////-=323?423,,,/=1,,,,-:4E;??EIIIIICCCCI>;;;IIIIIII<<@@?=////7=A99988<<4455IEEEIIIIIIIIIIIII<999HIIIIIIIIIII?????IIIIIIIIIIICAC;55539EIIIIIIIIIIIIIIIIHH999HHHIA=AEEFF@=.....AD@@@DDEEEEFIII;;;977FFCCC@24449?FDD! --- test/test_data/fastq_parser/longreads_as_solexa.fastq --- @FSRRS4401BE7HA [length=395] [gc=36.46] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=95] tcagTTAAGATGGGATAATATCCTCAGATTGCGTGATGAACTTTGTTCTGGTGGAGGAGAAGGAAGTGCATTCGACGTATGCCCGTTTGTCGATATTTGtatttaaagtaatccgtcacaaatcagtgacataaatattatttagatttcgggagcaactttatttattccacaagcaggtttaaattttaaatttaaattattgcagaagactttaaattaacctcgttgtcggagtcatttgttcggttattggtcgaaagtaaccncgggaagtgccgaaaactaacaaacaaaagaagatagtgaaattttaattaaaanaaatagccaaacgtaactaactaaaacggacccgtcgaggaactgccaacggacgacacagggagtagnnn + eeeccccccc`UUU^UWWeegffhhhhhhhhhhhhhhhhhhggghhhhhhhhhfgfeeeee\\\\ceeeeeeeeeeeeeec^^^YRPOSNVU\YTMMMSMRKKKRUUNNNNS[`aa```\bbeccccccccYUUUbceeee\[`a`\ZYRRRPPP[\\\XXZaWWXeeeeeeccacaccc\WWSSQRPMMKKKLKKKKKKKKPPRRMMLLLPVPPPKKKKKQQTTTPRPPQPMLLMKRRRPPKMKKRLLKKMKKLLKRTPPPQRMMLL;KKKKLLKLLLLXKKKKW\KKLKKKLKKKKLLLQUYXYTLMMPKKKKPPNNKKKK;KKPXPVLLKKKKLRMKLLKKPVKKKKLLLJPPPPRMOROOOOKKKOSSSOOORUZXUUUQMNNZV][Z;;; @FSRRS4401BRRTC [length=145] [gc=38.62] [flows=800] [phred_min=0] [phred_max=38] [trimmed_length=74] tcagCCAGCAATTCCGACTTAATTGTTCTTCTTCCATCATTCATCTCGACTAACAGTTCTACGATTAATGAGTTTGGCtttaatttgttgttcattattgtcacaattacactactgagactgccaaggcacncagggataggnn + eeeeeeeeecccceeeefecccca`````\[SSSS__a\TTTYaaaaa__^WYW[^[WXWXW[WSSSQZ\\RKKKTPSKKKPPKKKMKKQPVVVTTTTPRKMMLLPPPTVTWMNNRSSWW][[ZZZZXXSSN;NSKKKTVWTT;; @FSRRS4401B64ST [length=382] [gc=40.58] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=346] tcagTTTTCTTAAATTACTTGAATCTGTTGAAGTGGATGTCCACTTTTGTATGCCAAATATGCCCAGCGTATACGATCTTGGCCACATCTCCACATAATCATCAGTCGGATGCAAAAAGCGATTAAACTAAAAATGAATGCGTTTTTAGATGAGTAAATAGGTAATACTTTGTTTAAATAATAAATGTCACAAACAGAACGCGGATTACAGTACCTGAAAATAGTTGTACTGTATCTGTGCCGGCACTTCCTCGGCCCTGAGAAGTTGTCCCGTTGTTTCCATTCGCACCATCCAATGGCCAAAGTTTGCGAAGAATCTGTTCCGTTCCATTACCAATTGTTTTTCCATGctgagactgccaaggcacacaggggataggnn + hhhhbbbbh^^UUUhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhUUUUh`hhhhh^^^hhhhbbbhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhUURRRdhbdYYRRW\NLLLLKW\]]^^YQLNNNNV]bddhdhggghhhhhhhhhdZZXXPPPXXa^^^habghhhhhhggghhggghhhhhhhhhhhhhhhhhhaabbhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhfffhhhhhhhhhc^\\\chhhggghhhhhhhhhggghhhhhhhhhhggghggghhhhhhhhhhhhhhhhhhhhhh^]ZXXWW\\TLLLLM__`dfhhhhhhhhhgg^^^^dhhheeXXXZdhhaa;; @FSRRS4401EJ0YH [length=381] [gc=48.29] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=343] tcagTTTTTGGAGAATTCCGTCAGGGACGGCATGGCATATTTGTGGGTTCGGCACGGCGTCCTGGCCAAGAAGAAGAAGACGAATTAGCCCGTTAATTTAATGACACCTTCCCCAATTTTGCAGCAATGATTGGTTCATTCTTGGCGGTGCGTTTTTGTGCTTCGTCGAATTGTTGGCCATTTTGGTCCACCGGCCATCATCTTTACGCTATCCGACTGATTGGAAATCACCGCCTAGCATTTTGCCGAAGATTGTTGCGTTGTACGGCCATGTGCTGATTGTTTACATTGGCATTCTTGGCAATTTGTCCTTGGTCGGCTTTGACGGCAAATTTGCGGTGTTAAGTctgagactgccaaggcacacagggggatagggnn + hhhh^^^^^hhhhhhhhhhhhhhggghhhhhhhhhhhhhggghhggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggghhhhhggghhhhhhhhhhh````hh]]]]hhhhhhhhhhhhhhhhhhhhhhhhhhddhddZRRRRRcVhhhhhhhhhhhhhhhhhhhhhbb__gghhhhhhhhhhhhhhhhggghhhhhhhhhhhhhhhhhhhggghhhhhhhhhhhhhaaaahgbcbghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggghhhggbbchhhhhhggghhbbbg\bbhhhhhhhhhfffhhhhhhgggggghhhhhhhhhhhhhhhggghhggd^^]]^dedd^NNNNNZYWOLL;; @FSRRS4401BK0IB [length=507] [gc=49.31] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=208] tcagTTGACCGGCGTTGTGTAACAATAATTCATTATTCTGAGACGATGCCAATGTAATCGACGGTTTATGCCCAATTATTCCCATCTATGCTTAACTGATCAAATACTATTTGCATTACGTCACGAAATTGCGCGAACACCGCCGGCCGACAATAATTTATACCGGACATACCGGAGTTGATGGTAATCGGTAAAGAGTTTTATTTAATTATntattatcnctattaattattgttancaacaatgtgcacgctntgccgcccgccgccgccgtgtcggtaggaccccggacggacccggacccggttcgggtacccgttttcgggttcccggaaccgtttttcgggtacccggttttttcggggggccccccggtaaaaaaccggggaaccccctaaaacgggtaaacgtaccgtaagggaccccctaaacgggggccccgaaaaaccgggacccaaaccggggggaaacggttaaaggggggggaagtaggngnnnnnnnnnnnn + eee`__eeeeeeeeeeggaYYY_aeeeeffghghhhhhhhhhhhhhhhhhhhhhhheeeeeeeee^\a`_PPPWWOPP[[WWZ^``accb^^^cc````c`UUUc^ccc\\\\\``]^]][[[\[PPPWW[[^^^``^XTTT\`aaa__^\]]^__PPPSQYYcc`^^^ceeeeeeeeeeeeea````[[OOOOMQQ\NNNNWKLLPPPPPP;QRLLNQS;RVYUUUU[ZWQQNMMS;SUTQPPVVTTRMLMQR;QRPPQPPPQKKLKKQPP\\TLLLLLLKPQKKKKKKLKKKLPKKKKLKKPTTLLKKKKPRPPPMKKKKKKKKJJPPPMMPPMMPKKKKKKKKKJRKKKKKLLQQLLLLLNNLLLLTTNNHHNLLQQLLHHKKKKHHKKKKKKMPMKHKKKKHHHKKKKKKKKKKKKKKKKKKKKKKKGKKLKKKKKKGKKKKKHHNNMGKKKNNNKKKKKKKKKKKMGGRRLLLKKKKKKKKKKFOKKK;M;;;;;;;;;;;; @FSRRS4401ARCCB [length=258] [gc=46.90] [flows=800] [phred_min=0] [phred_max=38] [trimmed_length=193] tcagTTATTGCAGTCGTTCCGCGCCATCGCCGGTAACCGTCCGCGTGTTATTCTGTGTATCGGCCAACCTTCGTATAACTTCGTATAATGTATGCTATACGAAGTTATTACGATCTATACCGGCGAAACTCAGCCGAAAGGTCTCGCGGTAGAGCCTATGAGCTGCCCGACCGATGCATTTAAATTTCCGGGGATCGtcgctgatctgagactgccaaaggcacactagggggataggnnnnnnnnnnnnnnnnnnnn + eee[WYY_ceeeeeeeffecb`````a__OOOOSU[ZUURQQRUUVUQQSRRSW[[\^^SSSTYY]`a```_[[\\a\YTTTYaac^^\acccceeebbbbbbbeebccceeeeeca``\\WWWWOOOS][[[XXUWWZWWX[WWX^aaaa`\^^^ccaaa__^^WWWWXLLLQRVVVPKKKKKKKKLLPPTQ[[OOPTW`_][[[[[SRQVVVPPKKKLLRV\\\VTKLLLLRSUUU;;;;;;;;;;;;;;;;;;;; @FSRRS4401CM938 [length=453] [gc=44.15] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=418] tcagGTTTTAAATCGCTTTCCAAGGAATTTGAGTCTAAATCCGGTGGATCCCATCAGTACAAATGCGGCGACAAGGCCGTGAAAACACTGCTTAATTCTTTGCACTTTTTGGCCACCTTTTTGGAAATGTTGTTTTGTGTTCTCAAAATTTTCCATCTCAGAACAAACATTCCATCGGGCTGATGTTGTGGCTTTTGGCGCGCGAAGTGCTGCTACTGCGCGGCAAAATCAGTCGCCAGACCGGTTTTGTTGTGGACGACAAAGTGATCATGCCTGACTTGTACTTCTACCGCGATCCGCAAGCGCGAATTGGTCACATAGTTATAGAATTTTTGAGCCTTTTTCTTGACATAAAAAGTGTGGTTTTAAAAATTTCCTGGCAGGACCCACGCCAACGTTCAGGAATAATATCTTTTAAAAAGctgagactgccaaggcacacaggggataggn + hhhhhbb]]UUUhhhhbbbhhhhhhhhggghhhhhfUUUhhhhhhhhhhggghhhhhhhhbbbhhhhhhhhhhhhhhhhhh____hhhhhhhhhhhhhggghhhh^^^\ZhhddhYYNNNNNVTSSY^haaVQQSSdWddbdab\_______gghhhhhhhhhhaaahhhhhhhhhggghhhhhhhhhhhhhbbbbhhhhhhhhhhhhhhhhhhhhhhhhhhhhUUUUcdhhgda^^c_VVVVVQQQQcWXddhhhhhhhggghhhhhhhhggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggghhhhhhhhhhhhhhh\\^\\hhhhh^^^\ZhURcccWQLLKKKRW\\YYLLLLKKLLLJJJRROUUZ_URWOOOWNYWWX[Yafhhhhhhhhhed[^eTTOOLLLLLTYZZZY]^_b[[VXXXdddddd____ddddd; @FSRRS4401EQLIK [length=411] [gc=34.31] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=374] tcagTTTAATTTGGTGCTTCCTTTCAATTCCTTAGTTTAAACTTGGCACTGAAGTCTCGCATTTATAACTAGAGCCCGGATTTTAGAGGCTAAAAAGTTTTCCAGATTTCAAAATTTATTTCGAAACTATTTTTCTGATTGTGATGTGACGGATTTCTAAATTAAATCGAAATGATGTGTATTGAACTTAACAAGTGATTTTTATCAGATTTTGTCAATGAATAAATTTTAATTTAAATCTCTTTCTAACACTTTCATGATTAAAATCTAACAAAGCGCGACCAGTATGTGAGAAGAGCAAAAACAACAAAAAGTGCTAGCACTAAAGAAGGTTCGAACCCAACACATAACGTAAGAGTTACCGGGAAGAAAACCACTctgagactgccaaggcacacagggggataggnn + hhh^UUU^^ggghhhhhhhhhfffhhhhhhhhhhhfffggghhhhhhhhhhhhhhhhhhhhfffhhhhhhhhhhggghhh____hhhhdhdPPPPOOLLLLQQ^\WLLLYLLLLLLLKKKKRRLLLTYRKLLLLYPaadddghhhhhhhhhhha^^`PQQOOOMMMY^\OQSfhhhhhhhhhhhhhhhhhhdbbgga\NNLKKQP^^[TLOOQ\Ueaa^YX[\PPNSSSSNNLNNVV^^fdhddgh`bbhhhggghhhhhhhbbb`hhhgggggghhhhhhhhhhhhhhhhhhhhhhddPNNLLWQQZLLLLMVVV_dhhhhhh^^^hhhhhhhhhhhggghhhhhhhhhhhhhhhhhhhhXXSQQVVVTTTT`dZhdddddhhhhh^^XVTT]_\\YRKKKKKRRRRU;; @FSRRS4401AOV6A [length=309] [gc=22.98] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=273] tcagTTTTCAAATTTTCCGAAATTTGCTGTTTGGTAGAAGGCAAATTATTTGATTGAATTTTGTATTTATTTAAAACAATTTATTTTAAAATAATAATTTTCCATTGACTTTTTACATTTAATTGATTTTATTATGCATTTTATATTTGTTTTCTAAATATTCGTTTGCAAACTCACGTTGAAATTGTATTAAACTCGAAATTAGAGTTTTTGAAATTAATTTTTATGTAGCATAATATTTTAAACATATTGGAATTTTATAAAACATTATATTTTTctgagactgccaaggcacacagggggataggn + hhhhbbbbhZZZbbbbhhh^^^ggghhhhggghhhhhhhhhhggghhhggghhhhhhh____hehbbbhb``ZZZZdc^a__cUUSSTTTT[[[fhh]]``hhhhhhhhZZZYYhhh^^^bbbhhhZZZZheehhhhhbbbahahddcbSSSS^Saaad^dhhhbgghhZZZghhhhhhggZZZgghhhhhZZZhhhhggghhhhhh]]^^]hddaffYYPPPPNSUeaeaa^\Z\`^XVVVPPPXYd```ccacVVVV\NPPPPQQc`__aUWZZZhWgghhhhhZZZZ^]hdbbbaNNNNNZVST\; @FSRRS4401EG0ZW [length=424] [gc=23.82] [flows=800] [phred_min=0] [phred_max=40] [trimmed_length=389] tcagTTTTGATCTTTTAATAATGAATTTTAATGTGTTAAAATGATTGCATTGATGGCATAACCGCATTTAAATTAATTACATGAAGTGTAAGTATGAAATTTTCCTTTCCAAATTGCAAAAACTAAAATTTAAAATTTATCGTAAAAATTAACATATATTTTAAACGATTTTAAGAAACATTTGTAAATTATATTTTTGTGAAGCGTTCAAACAAAAATAAACAATAAAATATTTTTCTATTTAATAGCAAAACATTTGACGATGAAAAGGAAAATGCGGGTTTGAAAATGGGCTTTGCCATGCTATTTTCATAATAACATATTTTTATTATGAATAATAAATTTACATACAATATATACAGTCTTAAATTTATTCATAATATTTTTGAGAATctgagactgccaaggcacacaggggataggn + hh`XSSSTddhh\\\]hhhhhhhhhbbbbhhghhhbbZZZZhhhhhhhhhhhhhhhhhhhhhhhhheZZUUUcchhhhhhhhhhhhhhhhhhhddXSSSQQSS__UUUbb[[acc`\LLLLLQ[KKKKUTXNNOO\\\WbhhhZ]]\\ggZZhhhhhhbb__^^^hhh____hb^UUUghccbh^a^^bb[ddPPPPPaSaccbaZ\_aVVV]NNNNL\RQR^SQRKKKN\PKKKKLYSdZ^^dhhhhhbbbbh]ZZZhhhhhhh[[__^\NNNNV\`XXXWW[[SSTThdddhhhhhhhhhhhhh[XXXghhhhhhhhhhh^^^^^hhhhhhhhhhhb`bZTTTRXdhhhhhhhhhhhhhhhhggXXXgggh`\`ddee_\MMMMM`c___ccddddehhhZZZXVVeebbb_QSSSX^ecc; --- test/test_data/fastq_parser/misc_dna_as_illumina.fastq --- @FAKE0007 Original version has lower case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTA + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0008 Original version has mixed case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) gTcatAGcgTcatAGcgTcatAGcgTcatAGcgTcatAGcg + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0009 Original version has lower case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) tcagtcagtcagtcagtcagtcagtcagtcagtcagtcagt + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0010 Original version has mixed case ambiguous DNA and PHRED scores of 40, 30, 20, 10 (cycled) gatcrywsmkhbvdnGATCRYWSMKHBVDN + h^TJh^TJh^TJh^TJh^TJh^TJh^TJh^ --- test/test_data/fastq_parser/misc_dna_as_sanger.fastq --- @FAKE0007 Original version has lower case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTA + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0008 Original version has mixed case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) gTcatAGcgTcatAGcgTcatAGcgTcatAGcgTcatAGcg + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0009 Original version has lower case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) tcagtcagtcagtcagtcagtcagtcagtcagtcagtcagt + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0010 Original version has mixed case ambiguous DNA and PHRED scores of 40, 30, 20, 10 (cycled) gatcrywsmkhbvdnGATCRYWSMKHBVDN + I?5+I?5+I?5+I?5+I?5+I?5+I?5+I? --- test/test_data/fastq_parser/misc_dna_as_solexa.fastq --- @FAKE0007 Original version has lower case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTA + ;;>@BCEFGHJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0008 Original version has mixed case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) gTcatAGcgTcatAGcgTcatAGcgTcatAGcgTcatAGcg + ;;>@BCEFGHJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0009 Original version has lower case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) tcagtcagtcagtcagtcagtcagtcagtcagtcagtcagt + ;;>@BCEFGHJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0010 Original version has mixed case ambiguous DNA and PHRED scores of 40, 30, 20, 10 (cycled) gatcrywsmkhbvdnGATCRYWSMKHBVDN + h^TJh^TJh^TJh^TJh^TJh^TJh^TJh^ --- test/test_data/fastq_parser/misc_dna_original_sanger.fastq --- @FAKE0007 Original version has lower case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTA + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0008 Original version has mixed case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) gTcatAGcgTcatAGcgTcatAGcgTcatAGcgTcatAGcg + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0009 Original version has lower case unambiguous DNA with PHRED scores from 0 to 40 inclusive (in that order) tcagtcagtcagtcagtcagtcagtcagtcagtcagtcagt + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0010 Original version has mixed case ambiguous DNA and PHRED scores of 40, 30, 20, 10 (cycled) gatcrywsmkhbvdnGATCRYWSMKHBVDN + I?5+I?5+I?5+I?5+I?5+I?5+I?5+I? --- test/test_data/fastq_parser/misc_rna_as_illumina.fastq --- @FAKE0011 Original version has lower case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) ACGUACGUACGUACGUACGUACGUACGUACGUACGUACGUA + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0012 Original version has mixed case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) gUcauAGcgUcauAGcgUcauAGcgUcauAGcgUcauAGcg + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0013 Original version has lower case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) ucagucagucagucagucagucagucagucagucagucagu + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0014 Original version has mixed case ambiguous RNA with PHRED scores from 35 to 40 inclusive (cycled) gaucrywsmkhbvdnGAUCRYWSMKHBVDN + cdefghcdefghcdefghcdefghcdefgh --- test/test_data/fastq_parser/misc_rna_as_sanger.fastq --- @FAKE0011 Original version has lower case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) ACGUACGUACGUACGUACGUACGUACGUACGUACGUACGUA + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0012 Original version has mixed case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) gUcauAGcgUcauAGcgUcauAGcgUcauAGcgUcauAGcg + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0013 Original version has lower case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) ucagucagucagucagucagucagucagucagucagucagu + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0014 Original version has mixed case ambiguous RNA with PHRED scores from 35 to 40 inclusive (cycled) gaucrywsmkhbvdnGAUCRYWSMKHBVDN + DEFGHIDEFGHIDEFGHIDEFGHIDEFGHI --- test/test_data/fastq_parser/misc_rna_as_solexa.fastq --- @FAKE0011 Original version has lower case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) ACGUACGUACGUACGUACGUACGUACGUACGUACGUACGUA + ;;>@BCEFGHJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0012 Original version has mixed case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) gUcauAGcgUcauAGcgUcauAGcgUcauAGcgUcauAGcg + ;;>@BCEFGHJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0013 Original version has lower case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) ucagucagucagucagucagucagucagucagucagucagu + ;;>@BCEFGHJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh @FAKE0014 Original version has mixed case ambiguous RNA with PHRED scores from 35 to 40 inclusive (cycled) gaucrywsmkhbvdnGAUCRYWSMKHBVDN + cdefghcdefghcdefghcdefghcdefgh --- test/test_data/fastq_parser/misc_rna_original_sanger.fastq --- @FAKE0011 Original version has lower case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) ACGUACGUACGUACGUACGUACGUACGUACGUACGUACGUA + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0012 Original version has mixed case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) gUcauAGcgUcauAGcgUcauAGcgUcauAGcgUcauAGcg + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0013 Original version has lower case unambiguous RNA with PHRED scores from 0 to 40 inclusive (in that order) ucagucagucagucagucagucagucagucagucagucagu + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI @FAKE0014 Original version has mixed case ambiguous RNA with PHRED scores from 35 to 40 inclusive (cycled) gaucrywsmkhbvdnGAUCRYWSMKHBVDN + DEFGHIDEFGHIDEFGHIDEFGHIDEFGHI --- test/test_data/fastq_parser/sanger-invalid-description.fastq --- invalid description ACTG + ZZZZ --- test/test_data/fastq_parser/sanger-invalid-repeat-description.fastq --- @description ACTG +invalid repeat description ZZZZ --- test/test_data/fastq_parser/sanger_93.fastq --- @Test PHRED qualities from 93 to 0 inclusive ACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGACTGAN + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! --- test/test_data/fastq_parser/sanger_faked.fastq --- @Test PHRED qualities from 40 to 0 inclusive ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTN + IHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! --- test/test_data/fastq_parser/sanger_full_range_as_illumina.fastq --- @FAKE0001 Original version has PHRED scores from 93 to 0 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTAC + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @FAKE0002 Original version has PHRED scores from 0 to 93 inclusive (in that order) CATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@ --- test/test_data/fastq_parser/sanger_full_range_as_sanger.fastq --- @FAKE0001 Original version has PHRED scores from 93 to 0 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTAC + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ @FAKE0002 Original version has PHRED scores from 0 to 93 inclusive (in that order) CATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! --- test/test_data/fastq_parser/sanger_full_range_as_solexa.fastq --- @FAKE0001 Original version has PHRED scores from 93 to 0 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTAC + ;;>@BCEFGHJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @FAKE0002 Original version has PHRED scores from 0 to 93 inclusive (in that order) CATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJHGFECB@>;; --- test/test_data/fastq_parser/sanger_full_range_original_sanger.fastq --- @FAKE0001 Original version has PHRED scores from 93 to 0 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTAC + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ @FAKE0002 Original version has PHRED scores from 0 to 93 inclusive (in that order) CATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! --- test/test_data/fastq_parser/solexa-invalid-description.fastq --- invalid description ACTG + ZZZZ --- test/test_data/fastq_parser/solexa-invalid-repeat-description.fastq --- @description ACTG +invalid repeat description ZZZZ --- test/test_data/fastq_parser/solexa_example.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA +SLXA-B3_649_FC8437_R1_1_1_610_79 YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA +SLXA-B3_649_FC8437_R1_1_1_397_389 YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/solexa_faked.fastq --- @slxa_0001_1_0001_01 ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTNNNNNN +slxa_0001_1_0001_01 hgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<; --- test/test_data/fastq_parser/solexa_full_range_as_illumina.fastq --- @FAKE0003 Original version has Solexa scores from 62 to -5 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT + AABBCCDDEEFGHIJJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ @FAKE0004 Original version has Solexa scores from -5 to 62 inclusive (in that order) TGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJJIHGFEEDDCCBBAA --- test/test_data/fastq_parser/solexa_full_range_as_sanger.fastq --- @FAKE0003 Original version has Solexa scores from 62 to -5 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT + ""##$$%%&&'()*++,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ @FAKE0004 Original version has Solexa scores from -5 to 62 inclusive (in that order) TGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + _^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,++*)('&&%%$$##"" --- test/test_data/fastq_parser/solexa_full_range_as_solexa.fastq --- @FAKE0003 Original version has Solexa scores from 62 to -5 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT + ;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ @FAKE0004 Original version has Solexa scores from -5 to 62 inclusive (in that order) TGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<; --- test/test_data/fastq_parser/solexa_full_range_original_solexa.fastq --- @FAKE0003 Original version has Solexa scores from 62 to -5 inclusive (in that order) ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT + ;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ @FAKE0004 Original version has Solexa scores from -5 to 62 inclusive (in that order) TGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA + ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<; --- test/test_data/fastq_parser/test1_sanger.fastq --- @SRR005406.1 FB9GE3J10GA1VT length=326 TATTGACAAAGTAGTTCTACTTTACAAATTTTATTTTTTGTTACATTTCCATATACGCTTCTAAAACTTCTTTGGCAATCGTTTGATTTGGTTTGGAAGATTCATCATTTAAGTGTGGTAAAACAACGCTAATTGCAATTTCAGGATTTTCGTACGGCGCATAAGCCACCAAGTTACTATTAACCGTTGTATGGTTTACTCCATTAGCATCTGTTGCTTGCGTTTCGGCGGTCCCTGTTTTAGCAGCAATCGAAAACTTGTCTGATTTTAAACCACGTGCAGTTGTAAAAGGACTAGTTCCATTTACTACATTATAGAAACCTTTG +SRR005406.1 FB9GE3J10GA1VT length=326 DDDDDDDDDDDDDDDDDDDD@??DB?2211116335553?..@CDDDDDDDDDDDDDDDDD@9995@BBBDDDDDDDDDDDDDDDD;;;BBDDD@@@@BDDDDDDDB@@@DDDDDDDB888888>DDDDDDDDDDDDDDDDDDDDDDDDDBB@DDDDDDDDDDDD>;;;;DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCDDDDDCCCCCCCC@<<<BBCCCCCBBB>>===>>>>===>>?>>===>>>>>>>>>>@??>>>>>>>>==::3317=>?>>>>>>>?>>>>>>>=======8...../ @SRR005406.2 FB9GE3J10GFIYY length=126 TATTNACTAAATAGTACGGCGGATAATCCCACGATGACGAATATACATTTCTTTGTATAAAATCTTCATAATCTTGGGCTTTGCCAATTGTATCGCATAATGCTCGGGTTAAAAGNTTGAATGATG +SRR005406.2 FB9GE3J10GFIYY length=126 2000!22:0000,8662000058866600030>=<<<<===?=>=97222800084:6....0200999999;66000289666666;;;=;:;==;;:::9666997......,!4499984444 @SRR005406.3 FB9GE3J10GF5B6 length=313 TATTGACAAACAAAGAGGTCAAAACTTTAAGTATCTGAACCCGACGAATTAATTCTAAATATCTAATATCGATTACCTAACTAAATTACACTAAGTTAATTAAATGTAGTATATAATCATTTAAAACTAATTAATTATTTAGTATAATGAAAGACAAGAGGTGATTGTATGTTAACCACAAATCTAGAAACAAGGAAGTTCTGTAGTATTGACATTACCATCTAACAACGGACAGAAACCAAAAGCAGACCAAGAATATATAGTGATGTATTCTGATGATGGGACAATTACGTTAGTCCCTAAATTACAAGAT +SRR005406.3 FB9GE3J10GF5B6 length=313 CCCCCCC777=@BBDB@<>>99905111--605=DA>44111=@@@444433;;<5111<9D=555@BCCCCCCCCCCCCCC@@@CCCCCCA@@CCCCC==777@CCCCCDD@@@@@@;111////3@;;@@DDCCC666<BBC@@@@@<<<CBC@@@CCCCCCCCCCBB@<<<<BB8211128@88///1/6BBBB2455;CCCCCCCCCCCCCCCCCCCC999CCCCCC>>>@CCC>>2225966:::::::<::666<<<<<<<<661116<<<<<<<<<::::666<6667::6661111665:666:< @SRR005406.4 FB9GE3J10GFJI3 length=103 TATTGACGCTTCTGCACCTGGCGGTCTAGTTCTTGAAAAATTCGGCTTTACTCCTGAAAATGTGGTTAATACCTATAAATCACTATAAATAAACGATAAAAAA +SRR005406.4 FB9GE3J10GFJI3 length=103 ?<<<<<?<<<>=9<<<<<:4448<???????BAAB;;@::BBEB?466:@AAAAAA?AAAAAA???????AAAAAAAAAAAAAAAAAAAAAA;88470666.. @SRR005406.5 FB9GE3J10GGNFL length=53 TATTGACCAGGTGGATCTTCAACTAATAAGACAAAGGAACTGTCAATTTCAAT +SRR005406.5 FB9GE3J10GGNFL length=53 A??<<<?<<<<<7799>=7799:>===<8:8:8<:==8488863220002888 @SRR005406.6 FB9GE3J10GGVOP length=283 TATTGACAAAAAAAAGAAATTTGAGATTCCTTTTTTACCTAGAATCTCAAATTCTCTCTTTTTTATTTCTATTAACCAATCCGGCGCATTGGAATATCATTGTTATCTGGATGAACCAATAAATATTGAATAACATCAATATTGCTTGCTTGGAATGAGGCTGCACATGCTTGCAAATATAAGTCCCACATTCGATAGAAGCGCTCGTCCTTTTTCGTCAACAATTTCTGTTTCTATATTATGGTAAGTTTTTTGTCCAATGTTCCAGCGTCAATTGATATCT +SRR005406.6 FB9GE3J10GGVOP length=283 ==:9:::...0...09***>>?????::::55:::5><<(=?==>=7722088::<66......2(((8099:<<;;<<<977779:;772223>=?>>>>>??@=?=888<6666699=555=;=<<<<@=??=??>>>;;677;>>>==6667>>?6677;>?=<<<<<<6600066:6666;;::26666696----66833---33-----15*552,,,8888.4,,,02922,,,025531,,,,,,,,(,,,,,103356666......4110010 @SRR005406.7 FB9GE3J10F6RK3 length=267 TATTGACAATCCAATTATTCTTCATTTTGGCTCCTCCGATAATTTTTCTTATAATAAAAGAAAGGTTGTTTGTTCTCTTCACACGGTTATCTATTGTTCCTGACCCTTGAAAAAGGGCATTCTTGCAGAAATACCTATAGAAAATTATAGCACAAACTGTATATTCATTCACTAGTTATAACAAACTTTTTTAAGAAAACCCGCGATCTTCTTACGAAGGGGTTGATTCACTGCTTTCATCGATCCGTATTTTCACTTAATTTTTTT +SRR005406.7 FB9GE3J10F6RK3 length=267 >===>===:999<<221999112:665522380000033866444118))25<<6....2***002207;;?=>AAAAAAAAAAAAA???AAAAAAAA????@??>=;;5551111116=====??@A????<???==;;2222::2==>>>?;;;??@?@???;777;;??@?A??A??676;=<4333--**-------66.3336666-----,,,,,,55*222555955,004442222234,,,,,,,,033,,,,,,,,, @SRR005406.8 FB9GE3J10F5CXD length=306 TATTGACCAGTTACTGCCTATCCCAATGTGGATCATATTCCCTGGTTTTACTTCGAGAGAAGCGGGTGGTGGAGCGCTTCATGGCTCAGGAAGTTATCCATTACAATACTTACAATACGTATTAGGGAAAGAGATTCAAGCGGTTACGGGAACCGCAACGTATCAGCAAGGAGCGACGGATAGTCAATGTAATTTAGCTTTGAAATTTGCTGAAGGGACGCTGGGCAATATTTTTATTAATGTTGGTTTAAAGATACCTAGTGAAATGACCATTTGTGGGACGAAAGGGCAAATCGTTATTCCTAA +SRR005406.8 FB9GE3J10F5CXD length=306 BBBBDDDDDDDD>?>B??@BDBBBDCCCDDDEEEDDDDDDDDDDD==>>?8006?BBDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD99999>DDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDD<<;@CC@@@@@C>>999<<<:=//97=?==74......./84666:======:::=<:33363::;<<7<::3336311;<:::<1111611 @SRR005406.9 FB9GE3J10F5GHC length=286 TATTGACAACAGTATGACGGAAGTCTAACCAAGGTGTTCCGCCTTGTTTGTAAGCTTCAATAATTTCTTCTGGAAAACCAGCATCTTCTAACTGACTCATCATTTGAGCTGGAACATTTTGATTAGTAACAACAAAGAATTGGCTGCCATTTGTGTTAGGACCAGCATTTGCCATTGACAATGCGCCACGCAAATTGAAACATCCCGAGAAAATTCATCCTCAAATGCTTCTCCATAAATACTTTCGCCGCCCATTCCTGTTCCGGTTGGGTCACCGCCTTGAATC +SRR005406.9 FB9GE3J10F5GHC length=286 C@@@CCCCCCCCCCCCCCDC@@=>>=BBBB33556=@BDBB==@@=@CC=688CCCCBBBA@@C@@A@@DD==5555AA:BBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC===@CCCCCCCCCCCCCCCCCCCCCCC<<<CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCB???B::44412B<<<A814444??B====<<333>@@@>>><<@@@@@@/////3973......6:434778877..111.44379774446661 @SRR005406.10 FB9GE3J10GF2TX length=292 TATTGACCTTTTCATAGAAATGATATTCAGCTTTGAAAGATTACCAAATAGTCTAATTCCTACAGCACCCGTCCAGTCATCATTAATGGACGTACCATCAGGATAATGAACCTCTTCATTTTCATAAAATAATTGATCATTCAGGAATGTCTGAATTTTTTTCCCATCATAGCGAACCAGCAGTTTATATTGTTGGCCACTTAGTAATGTTGGTCCCGGAATATTAGTTAGCCATTTACCGCCTGGTTGTCCTAATTGCCAGCGGCCGTCACGATTATAAGCAAAAGNTTCG +SRR005406.10 FB9GE3J10GF2TX length=292 CCCCA=====CCCCCCCCEEEEEEEEEEEEEEEDCCCFCBC9777==CCBCCCCCC@@AAACCCCCCCCCCCGGCCCCCCCC====@CCCCCCCCCCCCCAAB===CCBBBBDCDBB@////;@3////:44BBDDDB@<<<C<<<<@ABB@999///////111@@@@88<@@BBCCCBBCCCCCCBCCCC??;;;;CCCCCCCCCCC;:442442<<<<@@@@@CCCCC>>>>>CCC@@@@@96666111666::66666:::66666:<<<<<<<<<<<<<<66!6666 @SRR005406.11 FB9GE3J10GG7K6 length=278 TATTGACTCTGTACACTGGCAAAATAGAGATATTATAAAGAAAGTAATCGCCGTTATTGATATGATTGAAAGCTTTGGCGATGTACGTTTGGCGGAAGGCATGAAAAAAGAAAATGCTTCAGCTGACGGCTGGTCGGACATTTAATTTAGAAAAAGGTCAGTTTCCATTGAATATTGTCACTGAAAAATAAAAAGCACCCCCGCAAGGTCAAACTTGCGGGGTGCTTTCTCAAGGCTACTTTAAAACATGTAGCGACTTTTCAACGATGGCATCGGTC +SRR005406.11 FB9GE3J10GG7K6 length=278 =<??@@@@??A??<<<>>?=::::=0<:==><<:<00003,,,6800688::==<<979998=??><999?????A====AAAAAAAAAAA???????===??46:::4<((((<?@@@???@AAAAAA<<888?AAAA?@????<42560000.334447;::677;;7777;>><===<64.....6)))))---------)---------3332201215*2,,,2.5,,,,,,22,,,,,0-3)41010355633,,,1331,,,,,,,111,, @SRR005406.12 FB9GE3J10F9XLN length=307 TATTGACTTAGTTTCAACAAAAAAGGCAAAGTCCTGTTACCAATGAAAGACTTATTAATAGAAGGAACGTTTCGTGCAAATGAACGAGGCTTTGGTTTTGTAACCATCGATCCTGAAGAACCAGATGTTTACATTCCTAAAGAGGCAACGAACTTTGCAATGGATGGGGACACGGTTTTAATCGACGTGATCCAACATGCGGATCCTTTTTCAGATCGCGGCGCAGAAGGTAAAGTCAAAGAAATTAAAGAGCGAGCAGTGAGCCAAGTTGTCGGAGAATTTGTGGCATATAGTGAAGAAGAAATGG +SRR005406.12 FB9GE3J10F9XLN length=307 FFFFFFFFFFFFFFFFFFGGGGGGIIIIIIHFFFHIIIIIGGGHIFFFFFEEEEFFFFFFFFFFFFFEB>>>BEFFFFFFFFFFFFFFFFBBBFFEEEEFBBBEEFFFFFFFFFFFFFEEEEFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFFFFFFGEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEEEEEEBBBEEEAA@EEEEEEB;;;B=888@@@@@@@@@@@@???@@@@@@@@@@@@@@@7777877@@@@@@@@@@@==:74437=A @SRR005406.13 FB9GE3J10GBYB5 length=328 TATTGACAGACGTTACTGGTGTTGTAGAATTGCCAGAAGGTACTGAAATGGTAATGCCTGGTGATAACGTTGCTATGGACGTTGAATTAATTCACCCAATCGCTATCGAAGACGGAACTCGTTTCTCTATTCGTGAAGGCGGACGTACTGTAGGTTCAGGCGTTGTTACTGAAATCGTTAAATAATTAACTTTTTAACTATAGCTTTAACCAGCGTAAAAACTGGGGTATTCGGACGTAAGACCAGAGAATTTATTCTCTGGTTCTTTTTTTGTTTAGAAATTGGCTGGACTAAAAAATAGCCAATTGGCTTGTTTTAGCAGTCTTTG +SRR005406.13 FB9GE3J10GBYB5 length=328 A???CCCCAAAA<<<C?<=<;<<CCCCCCCCCCA==<@@@AAA@A<<<ACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC;;99334;333;;@@CCCCCCCCCCCC@@@@CCCCCCCCICCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCAA???CCCCCCCC?77::AAC:::::CCC-99999ACCA<666666//////////////47<CCCCCCCCCCBB@;;:::;;;:665555::5551133331:)))15::::::7777776--------*447----555555/050624-------- @SRR005406.14 FB9GE3J10F8C2A length=52 TATTGACACTTATTGCTACTGTTAAAGACAGTATAGTCAATTTCATCCACTG +SRR005406.14 FB9GE3J10F8C2A length=52 AAAAAAA??B@?<<<<<<:=>22333:6<::<<<<>=923300882228822 @SRR005406.15 FB9GE3J10F6A4M length=141 TATTGACAGAGTAAGTGAGCGAAGCAGTGAACTTACTACGGGGCGCCCGTTACAGCCAACGGTATGCGAAGAATCAAGTACCGTATGAGGTTATTATGAGAAATAATAGCGAATTAAGGTGGTATCACGAAATGACAACTT +SRR005406.15 FB9GE3J10F6A4M length=141 <888<<>=>??<<<<?????<>>?BBBB??=>>>==::0....0-0006:<<46222221228:999==;7789<>>99898????>><<<<=<22177::::=7488???>>>>=??<<8888===:6...;944..... @SRR005406.16 FB9GE3J10F8B91 length=244 TATTGACGTGACATCATCACAATCGGAAGTAACAATTCCTAATGAGCGATGTTCTGGTTTCAATGATAATTCTTTTGCTAATGCCGGATCGACATTGGGAATGACTTTCATACTTAGGACATTTGTCGCCTAGACGATCATTTTTCTATGAGAAATCCTCCTTTATTCAGCTTTCTTTTAAATCAATACCAGTATTTTTTCTTTGTCTAACTATTTTTTTGTATAATTTCGGCATGTAGGCCCT +SRR005406.16 FB9GE3J10F8B91 length=244 A???===?<<<????><<<<????44448:??B??BBFFFAA?BBAA??>>:<<=44333<<?@@@@AAAAAAAAAAAAAAAAAAAAAAAAAA???AAAAAA????=888<=??:61128<<8862;===><<<>;;;;;67=76;*66:>;;:66666976634.+..44...........*......------------(((-*--396640086620<*99000,,,,,,,22,,,,,,,, @SRR005406.17 FB9GE3J10GG5LS length=312 TATTGACCTTTTTTCAGGATCTGAAATATCTTGGAAAAGAATCTGATTGATTGTCTGCCACACAGCGCCTTGATTGCTGCGAATAAGGTGCTCTCTTAAAAATAAAAAGCCGAGCCCAACGATTAATCCTCCCACCAATGAAATCACCATTTTTTTGTTAAATGAGATACCTTTCACTTCTACGTTTTTTCTTTTCCACTTTGTTGCCTCCCAAATAAATTGATTAAGCACCGCGACAAAAAAAGCCTTGCACAACAAAAAAAGGGCAAGACATCTCGTATCATTCACTATAACAAAAATACAGAATTTTAA +SRR005406.17 FB9GE3J10GG5LS length=312 @<<<@@CC::??87;<<CDDCCA===?;????33////911<?AFFCCCCCCCCCCAAACCCCCAAACCCCCCCCCCCCCCCC@@@AACCCCBBB;;33333A33333@@@CCCCCCCCGCCCCCCCCCCCCCCAACCCCCAAAAC?::///////1))77<>BC>>>??CCAAAAA?777<:1///////*-**66AACCCC==CCA9999>96/,,,999999477<<>C?>><<3355533<55555:::722/////,,-----4747771115:555557:::51111155::55+55111::::55 @SRR005406.18 FB9GE3J10F5ZAJ length=258 TATTGACACTTGTTGGCGTAAAGCTGGATCTAGCGCGCTCGTTGGTTCATCGTACCCAAGAACTTTTGGCTTCATTGCTAAGGCACGAGCAAGTGCAACTCGTTGTTTTTGTCCACCGGAAAGTTGGTACGTATAGAGTTTTTCTTTACCAGCCAAGCCCAATTTTTCCAGTAATTCTAAAGCTTCTTGCTGACTTTTTGTCTTTTCTTTCTTTAGTACTATGTAGGTGACGTTAAAGGTAATTTGTTTTAACTAAAC +SRR005406.18 FB9GE3J10F5ZAJ length=258 @??=>>><842277=====9::<>>??BBB?@@@??A?B9:8<<???@@@==<A??????==>4444<<>????@@AAAAAAAAAAAAAAAAAAAAAAAAAAAAA;@@@@A2AAAAAAAAAAAAAAAAAAAAAAAAAA;;;;;A222AAAAAAAA@@>>>??22222;;==<>>??A;;;AAAAAA???>>==;4331--)-----3***-**.3-*,2,,,,,,522022,,,,,,,,,**,,,,)))),,,(,,,, @SRR005406.19 FB9GE3J10GD4Z8 length=224 TATTGACAAGCCGTTATTTATTTGAACAAACCAAACGTCGTCCTGTGATCTTACCAGTTATCATGGAAGCGACGCAACGCAAGCGTCCCAAAAATAACGCATAGTTCGTCCTGATAAAAGCAGGTGATTTTAGGAGAAATTCTTCTAAAGTCATCTGTTTCTTTTTTGAACTTTCTTCTATAAATATGGTACTATTAATCAGAGCGTCTAGAAAGTAAAAGGGA +SRR005406.19 FB9GE3J10GD4Z8 length=224 A???AAAAA@@@A@@?????555:::>?????666:BBAAAAAFFAAAAAAAAAAAAAAAAAAAAAAAAAAAAA???AAAAA@@?@<<<44444?22AAAAAAAAAAAAA??A?83331==;;;;==11111;===;:::;;;=?;00.437:==:000062:::62778;AAAAAAAAAAAAAAA;886;AAA>>>==;;;;<6600-6---663****00,* @SRR005406.20 FB9GE3J10GGM2A length=159 TATTGACCTAACTGGCGACGTTCCCATTGTTTGATCGCTTGTTGCACTCCTGAACGTTCATCTTCTCGCCAGCTTGCTAATCGTTCATCGGTTGCATCAGTGACAGTTAACAACGCTTCTTTGATTGCCTGAATCGACTCTTTGCCATGTTATTCGTCT +SRR005406.20 FB9GE3J10GGM2A length=159 ??==???><33289998===?A??<>:::???<>=??8:::<=????????@@BA<==??@??====>==99999<<>>>=?><<<????@??=>><<<;;:;777211.477943......444444.......943......4...433..0:==66 @SRR005406.21 FB9GE3J10GB4C1 length=255 TATTGACAAGAGGTTCTTTTTTTAAAGTCCAACGCAATATTTGTTAAAGGACCAAGGGCAATGATTGAGCAATCGGTAGCTTGTTGAAAGGTTTGTGCTAAATAGTCAGCAGCGGAAAGCGCTTGTGCTTGGATTTTGCTAGTTCTGGGGAAATAAGTTTCACCTAAACCATCCATGCCATGTGTATCTTGTGCACTAACAAATGGCCGTTTTAAAGGGCTAGCAGCCCCTTGGTAGACAGGAATATCTAAGCGA +SRR005406.21 FB9GE3J10GB4C1 length=255 A???AAA@<<333<36///////00A6)33AA?@@===;ABA=55<<C33044<<<<@@@@CCCCAAAACCCCCCCCA;<<@@AC?@@B;;44495A@;444;7@?AAACCCCCCCCCCCCCAAAACCCC666DBCCCCCCCBB@933////<<887335@?CCCCCCCCACAAAAACCCCCCCCCCCCCCCCCCCCCCA333>9999999:C999<<<<>>>>77333331>>>?C>??<=<<C:::7:6662- @SRR005406.22 FB9GE3J10F9BU2 length=243 TATTGACCGGGTTGGGACAACGGAAATTTGATCAATTAGTGCAAAAGTTCCAACCGCATCCTACTAAAACAGAGGGCTATCAAAATGTTTCCGCTAGCTTTCAAGAGGTTTATGCCTTTAAAGAAGAACAAATTGTTTCCGAAGCGAACCGATTGACAACGATTCAAGAAACTTTTTCTCAACAAGAAAAATCGAAGAAATTTCTGTATCAACGGATTTCTTTTGATTGGCACTATTTTGTGG +SRR005406.22 FB9GE3J10F9BU2 length=243 AAA?@??B@@@44///22=:68885733399>>==332428:??@=B999:==A?@==;::<<80....2-99:::;;==<3333<>;;;==:<<@?<877:;===76111=666666;;;;;66==<<<<<867;;;;76776;?;;;;??????????;;00044...24......*6663......----33-------660886333333--,,,,,...2225,,,25,,,,,,2*,, @SRR005406.23 FB9GE3J10F441T length=186 TATTGACCGCTGGCGATTATTACGCCATTATGGGCTTGCCAATTGCCAAAGTAGCCCGACTACTAAAAGAATTCAACTAATAAAAGACAGTCCTTTTCATTCGTCAAAAAGAGAAAGGACTGTCTTTTACTATGCAAACTATTAGGTGCCTGTTTGGCAAACGTGTATCATTGAACCCATAAATTG +SRR005406.23 FB9GE3J10F441T length=186 AAAAAAAA?====@?A@@????B???AAA??:::>>?????@BBBAAAAAAAAAAAAAAAAAAA8888A<:A@????@??<3333=5A?AA@AAAAAAAAAAAAA;;@@:?+88AA<<;???AA??????:??<;;;;;;7;;==:99667;20066:::;6663668664............... @SRR005406.24 FB9GE3J10F7Z4H length=265 TATTGACGTATGATTGCAAATGGTCGCGATGCTGACTTTATCGTATTAGAACCAACCATGGAATTAGCAGCCACTTATTTAGATGGCGTAGAACGTTATCGAGCATAAGACACAAGAAAAAGCTTGCGGAAATTTATCCGCAAGTCTTTTTTTATAATTCTTTTGGTAAAATCGCAGAAGTGATTTCTTTGTTTTCATAGGCAATAAAAAAATCGATTAATTGCTTGTCAAATTGCTCAATATCCTCTTTTAGGTAAAAGGGGAG +SRR005406.24 FB9GE3J10F7Z4H length=265 AAAAAAAA@???>??<99::>>??A???BEEEBBBFBBBAABBAFAAA@??@@??????<<<<???????AAAAAAAAAAAAAAAAAAAAAAAAAA???AAAAAA@??==;99934......4;;997:;<???>77222;=6664.0000006'::==:7777::/00026:<<<<8<=6660..4.606****36888-------------386,,,,0055552,,,40555522240004833336666606655444-(( @SRR005406.25 FB9GE3J10GB7RT length=294 TATTGACCTTTGGCGATGAACGGACAGTTGATGCCCATATCAAAAAATTACGACAAAAAATTGAAAAAGTGGGTCCTCAAGTCATCCAAACGGTTTGGGGCGTAGGGTATAAATTCGACGATTCAGGTGTTGCTTAATGAAGTATTTGTATCAACAATTACTTGCTTTTATAGGTGTGATTGCTCTGATTATTCTCATTGTCGGAACGTCTTTCACACAATTGACCAAGCGCACAATGCAAGAAAATAACTNTGAACAGCTGTATGGTTATGCAGAATCGGCTTTAGAAACACG +SRR005406.25 FB9GE3J10GB7RT length=294 DDDDDDDDDDD???>BBDDDDDDDDDEDEEEEDDDDDDDDB5555//>>->AB@//////@>>444;;DDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBB>>>DDDDD5666>DDDBBBDDBBBBDDDDDD>==DDDDDDBB<<<<<DB5522555BDD9355CCCCCCCBB>>>CCCCCCBBBCCCC:31-6<!<=<666:<========<<<==::666;66661116:<::366 @SRR005406.26 FB9GE3J10GE3O0 length=300 TATTGACACGTTGATGAAGTATAGTTATAGCAGGTGGAATGAAAGGATTTGTTGAGAGAATGGTGTCGTTTTCGGCAATAATGTTATTTTGGTATATTTTCCGGTAATTGTGCTCTTTGCGTGCAATTTTCTCGTGTCCACTTTTTCCCTAACGGAACGTTGGAAAATAAAAGCACCGGATTTGGCCATTTCCGTTTTTATTCATAGGGATCCATGAGTTATCCAAAGATAGTTATGATGAATCGATTATGCCGTTATTTTGTGTATTTCTTATTTTTGTTATTAGGAGTCNCTTGTTCG +SRR005406.26 FB9GE3J10GE3O0 length=300 ????@@@???@?<=====?BAAAEAAAAABBBB@?88::??>>>??;===A>>?B?????<;;==<;6.2222277;====?@???<87499/600....0000-6677==??@????AAAA<888AAAAA:?@???>::50000000:,:=86766;;>>=<887;7++++6:<<=6666::<<<7720000;48887>,,;AAAA<;;>>>???<:::::::<<<5/588;88888844488;77633333777744445)301,,,1,,1,,,,,1)),,,311,,,,!,,,,,010 @SRR005406.27 FB9GE3J10F961T length=261 TATTGACCAAATCTTCCATCGTCAACACGTCTTTACGTAAAAGTGGCGCTGACATCTCATCGCGCATATCACGACCTGGTTGGGATTAAACTAGCAATAATATCTGTGAGTGTTTCTGAACCTACTTCTAACTCAGTAGCTAATTGATTCACTGGTAACTGTTTCAATTTTTCGATAGCTTCTGCTGTCCCTAATTCTTTAGAAGCAATCTCTGCTTTTTCTAAAATTGCTTGTGCTACTGGATAACTTTCTGGGTGAATG +SRR005406.27 FB9GE3J10F961T length=261 <<AAAA<<333<<<AAAAAFCCCDA@?@ACCCDDD@A=CCEEC<<<AAACCCCCAAACCCCCCCCCCCCCCCC<<<@<<<<00033300033/>A@@@CCCCCCCCCCCCAAACCCAC;;;;ACCCCCCCCCA@@@ACCCCCCCCCCCCCCCCCCCCCCCC>>>>99333339>>AACCCCCCCCCA::99?ACCCCCCCCCCCCCCCCCAAA99//////*//////49;??<<<C?<<<771/-4---2,---2*---- @SRR005406.28 FB9GE3J10GHEKM length=303 TATTGACCGTGGGCCATTCAGAACGAACAGGCGTTGTCGTGGAACCACGTTTATCGACCCAATGGTTTGTAAAAATGGGACCATTAGCTGAAAAAGCAATAGAAAATCAAGAAACAGAAGACGCTGTTGAATTTTATCCACCACGCTTCAATCAAACATTTTTACGTTGGATGGAAATATTCATGACTGGGTTATTTCGCGACAATTATGGTGGGCCACCAAATTCCTGCTTGGTATCACAAAGAAACGGGCGAGATGTATGTTGGGATGGAAGAGCCAGCCGACAGTGAAACTGGGTCAAGA +SRR005406.28 FB9GE3J10GHEKM length=303 ??????>B=<:779999999<::<<:=7133378868<<<00222258:88872<>?>>>=====9998,.....600089:9::<;;602222299999897777768<><<<<:<<<?=><<<?<8332<<=;;0;776666=====9944...3......366**3366.......8888888:600066:00066;<<<;;;;:::600--32200,,,22,,,22258555240,0440*),1,,,3,10013313...,,,44333,,,,,111,,,,,01,,,,,,,,,,,,,,,, @SRR005406.29 FB9GE3J10GG2GS length=287 TATTGACACGAACACAAAACCAAATGGCGATTTTACTAGATGAATATGGCGGTGTTGTCGGTTTAGCAACACTAGAAGATTTACTAGAAGAAATCGTTGGTGAAATTGACGATGAAACAGATGAAGTAGAAAATTTATATACACAAGTGGCTGACAATGAATATTTGGTTCAAGGACGCATGTTAATTGACGAATTTAATGAAGTATTTGAAACAGATTTACACATGAGCGATGTTGATACAATGGCAGGTTACTTAATTACAGCATTAGGAACCATTCCTGATAGG +SRR005406.29 FB9GE3J10GG2GS length=287 DDDDDDDDDDDDDDDDDDDBB000???BDBBBDDDD>BBDDDC@@>DDDD>>?DDDDDD>>999DDDDDDDDDDDDDDDDDDDDDB?>>BBBBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBB<<<BDDDDDDCCCCCCCCCBBBBBCCCCCCCCCB>>>>>:::<<333:==::::;;::::66111;;66666<<=<<<=== @SRR005406.30 FB9GE3J10F471Q length=217 TATTGACTAACTGTTGATGAAGATTTTTTAAAACGATACCGTTCAATAGAATCAGAAATTTTTCAACTTGTTGGAACGGTTAATGGGCGTAGACTTACTGAACAAGAAGTGCTGCAAGCCTGCCGTTATCCCTATGTACGTGGAATGAAGACTTCCTTTGATCTTGATTTTGTTGAAAATAGCAGCTATTCATTAACAGATACTATTCTTGATCCTA +SRR005406.30 FB9GE3J10F471Q length=217 ??????94333<@???>===:<8..........8:/:<<<>=88:9<==:::;;;000...22989<<====889998??????????AAAA??????<888<<=<<<?>=><<<<????<886=??><32286====;730000444437744..005:::::<<<7877<,+00....*46846666;;;;>>>>>666;>><<::999960000 @SRR005406.31 FB9GE3J10F426I length=307 TATTGACATTTCTTCTAACGCAAAGAAGCCGTTTGAATCTAAGGCATATTCTTCTCCTGGAATACCTAGTTTTTTCGGACGACCACCTGTCGCGATTAAAATGTGCGGCGCCGTATATTCTGTCCCATTGACTTCAATTGTTTGCTCCCCAGTAAACGTAGCGTAACCATGGATACGTTCAATGTTGTTACTGTCTAAACCACGATTATACGCACCATGTAAGAAGTCGATATATTTTTCACGATTTTCAACTAATTGTTTAAAGCTAAAATTTTTGATTTCAACATCAAACCCATAGCCTGCTGTG +SRR005406.31 FB9GE3J10F426I length=307 DDDDDDDDDDDDDDDDDDDCB888@=BDDDD@@@BEEEEFDDCEEDDDDDDDDDDDDDDDDDDDBB>>?:AAAAAD:::>DDDDDDDDDDDDDD???DDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD9999BDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDBBBDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDCCCCCCCCBB>>>DDDCCAAHAACCCCCC>>>>===:::==633333<<<<<<;=33333=======<:::<<<<=<<<<<====<<6611 @SRR005406.32 FB9GE3J10F6BG7 length=259 TATTGACCCTGTTTCAACCACCCGAATGCGAACAACTTTTTTCCCTTAACGTTTGACCATTTGTCAGTTTCATCATGACGATAAAGACCGCAAACACCATGATAAAGAACCACATCCGATCTGAAAAAATCGGATAATTGGTTGCCCAATTTTTATAAGCTGGAATGAAATTTAGTCCAAAACGAGCAGGCCTTGCACAAAGCCAATCACCAACCAATCAATCCCCATGCAAAGAACGTCTCAACAGGCTAACTGTCTG +SRR005406.32 FB9GE3J10F6BG7 length=259 AAAAAAAA???>><<<<882228?===>===<:112400004:77((223=:;70222:;;992;;>444<<@@AAB@@???A??=144??@===AAAAAAAAAAAA<<??AAA???AAAA?A444444??@??????????==>>;77666659)00;;96666:600.44638........./888888:::;;:;00066;;9;;;;=;;444455222,,,,2225220,**,25222,,,,,,11,,,0101,, @SRR005406.33 FB9GE3J10F9KOX length=209 TATTGACCACAACTTCGTTATGATGGCCGTTCAGCCATTTGTGGCCGCGCTGCTGGAATTACAATAGAGACAACCGTTTTACCCTTTATTTTACGGGGCGTTCATTTATTGGGCATTGATTCGGTTAATGTTGGTATGGACAAACGAAAATAGTCTGGCAACGTCTTGCCACTGATTTAGACATCACTAGAAAAGCTGTGTATCAAGAG +SRR005406.33 FB9GE3J10F9KOX length=209 8777222227=::987<=797988882202258822300080002258<<====9999<<?<<<??A????==??;22..8844***0,,,,00....0*00660003037744466;;;;===77...4333.00....477774,,,,.+;9434....04663344469666666<<:::<<<666600006368666---3331- @SRR005406.34 FB9GE3J10F6OEX length=253 TATTGACTGATCGGCTGGCTAGAAGTATCGTTGATTTAAATTCGATTATTTCTTCTTTAAACAACTTAGGAGTGACTATCACCTTCTTAGATAATGCTTTAACCTTTGAGCCAAATAAAAGTGATTCTATGCAAACATTAATGATGAACATGTTAGGGAGTTTTGCGCAATTTGAAAGAGATTTAATCGTGACAAGAACGCAAGAAGGAAACAGTGGCACCGGGCAAATAATAAGAACTATCGAGAAGGACGT +SRR005406.34 FB9GE3J10F6OEX length=253 ???=>>????<999<<@@BBBBAAAFAAFFAA?BBBBA?<//4:?@@?888AAAAAAAAAA?==AAAA998=AAAAAAAAAAAAAAAAAAAA???==433<<=?<<:<<?????AA>>>>AAAAAAAAAAA???AAAAAAA??;;;AA?6776AAA???;?????76666;:660..66::644662:6666::931133333---------*66-,,2,,,,,,,,,2**,002,,,,,2252,,,,,,,,, @SRR005406.35 FB9GE3J10GFGOK length=115 TATTGACAGCAATTCTGACATGAACTTCTTGCGCTTCTGCTTCTTTAATAAATGAATAATGCGTCGAATAGTGGTCCCGCGAACAATCGAATCATCTACTAAAATGTACTTTTTT +SRR005406.35 FB9GE3J10GFGOK length=115 =77799979<999997<<?=????ABB???BB??>>=====80...2235556889979:<<=???????@????999=;?<777777;;9666666660...206999336844 @SRR005406.36 FB9GE3J10F9575 length=187 TATTGACACGTACTGGTGGAGGCGGCTTAAACGTGGCCGTGCCTTTACATCTCACCGTTTCCACGGTAAACTAAAAACAACGCCGTCAATTGCGTAAAGCAAGCATGGTTGCAAAAGGCGATTACAAACGTATCCGCCAACAATTAGCAAGAATGAAATAAACAACTCGGTGACTTTTAGATTACCG +SRR005406.36 FB9GE3J10F9575 length=187 <??<<<???@B?<9::??======9222000685662208:22000;778::::::=2000085<9800006,,,,,0,,9666:788887==>?>8877<<<==<64333911111.;9;;;=>233<??;=;:;667755566=97....776....26662288866664.............. @SRR005406.37 FB9GE3J10GBYFL length=199 TATTGACTCAACTGGTAACACGCTTAGTTTCACGCCAGCTGGTGTTGCTAATTTCAAGCCACTTTTTTCAATGGCATTCCCTGCAACCTCATCATCAACGACCATAATTCTGGAAATATTCAATTTTGTCGCCCATAAATTTGCCACTTGTCCATGAATCAAACGTCATCAATTCTTACGCCAATAATACTCATTGTAA +SRR005406.37 FB9GE3J10GBYFL length=199 ?<<<<<?>=>>=<<<<99:88???A??888::8A?=???AAA??????@????<999?>>>=4444448999>?>>>??????@@@??<<=<<<<<>=?><:::2226383.....433.........*43...........444477::======:66644664....666<:655=<;;;;;;6666;:966661-- @SRR005406.38 FB9GE3J10GB8MA length=82 TATTGACCTAAAGCAGCATCAAAAGGATTAACTGTCACAAATGGTAGTGCTTCATTGTCAGGAATTCAACAAATTATTTTTG +SRR005406.38 FB9GE3J10GB8MA length=82 AAAAAA@@A?<798:<<;88....22/::<<<:>=<<:22299979====>====>=999443399;=<<855992111116 @SRR005406.39 FB9GE3J10GEJA4 length=133 TATTGACCGTTGGCCTAATGTACCCGTCAACTTAGAAACGTTGCGGATTATTTTACCTAGCTCTGTTGCCTTAGCAATGGTCGGGTTCATTGAATCTTTATTGACGATCCCCATTGTAGCAAAATGACAGCGA +SRR005406.39 FB9GE3J10GEJA4 length=133 AAAAAAAAA===<????>???=4448=7==??A?????BABBABA>>>>AAAAAA==4==AAAAAAAAAAAAAAAAA???AAAAAAAAAAAAA@?=444=AAAAAAAAAAA?A???A<<<<<99=>6...... @SRR005406.40 FB9GE3J10GE3D1 length=65 TCACCTCAACACCCATGCGTACCGGTGCGGCGTAACGTGGTAGAGCTGCCGGTACACGAAGGAAG +SRR005406.40 FB9GE3J10GE3D1 length=65 ==<::2022000006888::866666530065322000006<86682222008800080000000 @SRR005406.41 FB9GE3J10GHD3J length=71 TATTGACTTACATAATTTTTGTCCATATTTAAATAAAAAGAGAGCATGGAATCATCCATCCCTCTTCAAAT +SRR005406.41 FB9GE3J10GHD3J length=71 ?===>>??@<<<<?=77=77=*::99<:::660,,,,,,3)05:888::88888:88880000,0000802 @SRR005406.42 FB9GE3J10F8BTA length=176 TATTGACAGAATTAATAATTCTTTACTACGTGTCACTGCTGTATACAGCAAATTTCGTTGCAGCATTCGGCTATACTGATGAACCATTGGCAGTAACACCATGCGGAATTCACTACCTTGCGCTTTATGAATCGAACAACATACGATAGCGTTAATTTTATCCATTCATTTCTTTA +SRR005406.42 FB9GE3J10F8BTA length=176 9==799:::::::55000003000304<<<==<>??BB@???>==>=922222229<88==??===??@??????????@@@@<888<@@><<<?:7122==;7220.7;;=9411111=;::;;;>7<<>==<::=900062443477......226..*44886......+++. @SRR005406.43 FB9GE3J10F931O length=277 TATTGACAAAAGAAAAATTAGTTTAAGTTTGAGTTACAACTGGCGTTACCATTTATTATTTCTGGGATTCGAACGGCTACCGTTTTAATTATTGGTACGGCCACGTTGGCGGCGTTAATTGGAGCAGGTGGTTTAGGGACCTTCATTTTATTTAGGAATTGATCGAAATAATTTATCGTTGATTTTTATTTGGAGCTCTTTCATCAGCTGCACTAGCAGTCTTATTTAATTATGGAATTCATTGGTTAGGAAAAGACGAATGGGCGGCGACTAATCA +SRR005406.43 FB9GE3J10F931O length=277 =:::<<<22229/////23)=<<<>=7../347<<:>==<===?<<<?=<<999=66=;;:;222229=;22299668;=7222..6633:442333@====>=?<<8888???8888==@@@?@8444<??<<;;;;=0...2......***3....4...44....4......+..8834......)))---13386;6666;;;;;<;;;;;;8<<;;;8888999,,,,,,,,2,,,,2,,,,,,0,,,,,),,,,,,,,1,,00101,,,,, @SRR005406.44 FB9GE3J10GEX35 length=57 TATTGACATGAAAAGCAAAGAAACGACTGCTGCTAAAGTGCAAATGAAAAGATCAAC +SRR005406.44 FB9GE3J10GEX35 length=57 ????@??===9555620003,,,3:4<<<<<>=9330866800088....0*88<86 @SRR005406.45 FB9GE3J10GHBI8 length=316 TATTGACTACTCCGACAAGGGATTGACGGAAATCAAGATTTTTATAAACCAGCGTGGCGTTCGGAAGCCAAAACTACCTTCAAGCAACGCGTTTTTTAACAGGTAAATATGCAACAGACAAGCAATACGATAATAAATTAAATTCGTTAATTGCGGTTTATAACTTAACGCAATTTGATTTACCAAAAACAGTGGACGGTTTGATTATCCAATCTAAAATAAGCTGTCGGAAGCGGAACAGCAACAAATGCATTTTCCAGTCTATGATGGGATCAATTATAATCGAAGTGGTAGCTATCCCGTGGCCAGTGTACGG +SRR005406.45 FB9GE3J10GHBI8 length=316 6<CCCCC@??AAC@@?CCCCA;====ACCCC@AACCCB;;;;9<+333<<5<<AA<<<?@CB<<<<9<<////>6-33<<CCCCCCCCCCC7776334439@>:333;5CCAAACCCCCCCCAAAACCCAAACC:::??CCACCCC::::CCCCAAAACA7:::CCCCC>::::::><<=@?11//33//-9=???A>????AAACCC99999>A?;;;>33>>>?<83333<?CC?>>>???885:::555:::;::::::::::::::::::::::::555::1111-55404------42224464422---- @SRR005406.46 FB9GE3J10GCTJ7 length=217 TATTGACAATTCTTTCGTGAAAAATAGGCGTCACGCTAGCAATAATAATCGTATATCCTTGTAAACATTCCGCTAACTCTTTGCCACCAATTTCACTGTCGACTGTAAAATGCTTCACGGTGCCTATTTTTCTAAGCTCGTCAAGTGTTCAGGAAAATTTGACCAAAACTACTGGAATTCACTATGGCTAATTTTTTGTTTTTTAACATGACTAAAC +SRR005406.46 FB9GE3J10GCTJ7 length=217 ;7779997722258868,0.....3)82308<<===??:::??????????<<::78866800002,8888<899:=::222777;99::;;<<<<?>=???=>>?322388?><:;=>;97.........4,77::===6676===6666.00.224447644....24*..4444..0688666688330000000(*****;;940--3----, @SRR005406.47 FB9GE3J10GFAI9 length=298 TATTGACAGCTTCCGCAGTTATTGTTATGGGAAGTGTTGCCCTCTCTAATCAAGAGTTAGGAGCATTATATCCGTGGACAGCCACATTTTTTTTGATAGATGGTCGAATAGAAAGCACCGGCTATCCCCTTGCATTAGCAATCGGCATTATTATCTTGGTATCAGCAGTCGGTTTCTTTATGACCTTTCACCATTTTCAAAAAAGGGAGGATTTTGAAATAATGGCACTTGATTTTATCGAAATTTTAAAAGTTNTTTTTCTTGGCATTGTAGAGGGGATTACCGAATGGCTGCCTAT +SRR005406.47 FB9GE3J10GFAI9 length=298 DDDDDDDDDDDDDDDDDDHFDDDDDDEDAAABBDDDDDD;;>ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDAA////////>@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDC?::666ACBBB00005//////222/3350000;444:ADDDDDDDDD@@4000848000000....22;--!2=??:4--77?????????:::::?????????====777??= @SRR005406.48 FB9GE3J10F9S1A length=317 TATTGACTTTAAAGGCCGTTTCATCGTTTGCGCCCCCTTAGTAATAATAAAATGAACAAAATGCTCCCTAATGTTCCGACAACCACGCTGACAGGAATTTCATAGGGGGCAATCAATACTCGTGCTAAAATATCACAGATTAACAAGAATAAACTTCCACAAATCCCAGTTAACCACAAGGTATTTTTCATATGATCGCCATAACGTAAAGACACTAGATTGGGAATCACAACTCCTAAAAACGGAATATTCCCCACCATCAATAAAACGATGGCACTTGCTAAAGCAACCAGCGTCAAACCTAAAAACTGAATTCG +SRR005406.48 FB9GE3J10F9S1A length=317 ?DDDDDDDDDDDD????>CCCBCCDEEEEEEDIIIIIEFFF>DDDDDDDDDBBBBDD>>>>BBDDDDDD??>BDDDBBBBBBDDDDDDDDDDDDDDDBBBDDDB55555>BDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>>>DDDDDDD999BBDDDDDDDDDDDDDD>>>BDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDCCCCCCCCCCCCCCCCCCCCC;;;;;CBB44><<<>>>>>>>>>>>>>>>>>>>>>><<<>><<<<==<<<::666:=:6631166<666666633366<< @SRR005406.49 FB9GE3J10GA69G length=204 TATTGACTCCAGTTAAGGGCATTGAGTATTCCTCTAAAGGTGTTCCTCGCTTGAAGACAGAAGGAGGATATCTTACTGCAAATAAAAACTATGTGACAGCTGCTGGAAATACCAATAACAATTACTTTATCACTAATCCAAAAAAAGTTAAGCTCTTAATTGATGATTTGTTTTTACAATAATACTGAGTTTAACTAAAAAAGG +SRR005406.49 FB9GE3J10GA69G length=204 CCCCCCCCCCCCCCCCCCEEEEGGGIIIIIIIIIIIIIIIIIIIICCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC888C@CCCCCC:CCCCCCCCCCCCCCCCCCCICCCCCCCC??5555AAAC?CBBCBA?@@3//////<11))9ACCCCCCCCCCC::444455855ACAA:::>>AA><:9666//-//////// @SRR005406.50 FB9GE3J10F75UF length=82 TATTGACTACTGAGACAGGGAATCACCAATGGCATAAACACCAGGAATTTTTGTTCTCATTTCTTGGTCTGTTCTANACACC +SRR005406.50 FB9GE3J10F75UF length=82 AAAAAAAAAAAAAAAAAABB??ABFAAAABBBCCBAA?A<===>>::44222=..===<444<<=@@=?=4339<9!69966 @SRR005406.51 FB9GE3J10F8M65 length=254 TATTGACCCAAGTTGCCAAAAGATGGTTTATTTGAAATTGAAGCAGTTGCTGTCAAAGGATAATTTTTAAGATGTTTCTGAGGGAAAAAGGATTGCATTCTTTACTGATTAAGGGGAACAATCCTTTTAGAATAAAAAGAAGAAGGAAACGATCCTATGAATGAAAAAAAGAGCAAGCATTATTTGAATATGATGCGAAACTATCAATTTCTGAAGCAATTCCGATGGGATTGCAACACGTTGTCGCGGCAGTA +SRR005406.51 FB9GE3J10F8M65 length=254 CAAACCAAA??@ACCCCCCCAA8AACCC@A113CCCEEDDEEHIICCCCCCCCCCCCCCDCCC=====CCCCCCCCCCDCC???=====AA:CCCCCCCCCCCCCDCCCCCCCCDDAACCCCCCCCCCCCCCC:::::C::CCCCC???CCICCCCCBCC?77///////7)>A??BCA???CCCCCCCCCCCCCCAAACCCAAAACCCCC@CAAA?<<<<>CC<<3317?CC>>71138C<7775:5555555 @SRR005406.52 FB9GE3J10GC7US length=304 TATTGACCATCAATGAAAATTTACAAAGTGTGCTAAATGCGTTGCTCAATATTGCCTTTGGCTTAATCAAATACTTTGTTCTGGCATTAGATTATGTGATAGACAAACTCTTTAGTTTAAATTTATTAGAAGGAGTATTACCAGATTTATTCTCCACTACTGGTGCTATTTACAACAAATTATTCAGTGTTGTAGGGATTCTCCTTTTTACATTTGTGATTGTCATTTCAGTGAAGGTATTTTTTTGAAAAAGGAATCAGCAAGGCATTAATCCGTTTGGTATTTTCACCTTAATCTATGTGGG +SRR005406.52 FB9GE3J10GC7US length=304 EEEEEEEEEEEEEEEEEEEGEEEEEGGGGGGGGIIIIIIIIIIIIEEEEEEEEEEEAAAEEEDDDDEEDDDEEE===DDDEEEEEEEEEEEEEEEEEEEEEEEEAAADEEEEEEEEEEDDDAAADEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDEEEEEEE;;;;;EEEDDDEDDDDDDDDDDDDDDDDDDD===@8;;;;66711111::55>??@@?????>AA6666./......6..../9;;;;;;9;;;;//... @SRR005406.53 FB9GE3J10F6637 length=268 TATTGACTGATGAAATTGCTAGTGCACAGTTAGTGGCTGGTGAAGAAGAACAATTGCTAGAAGAACGCAATAAACTGAACAATTTTCAAAAGATTGCTGATGCACTGACGATTAGTTATGCTGCGCTAAATGGTGAAGACGATAGTAGTTTGGATAAAATCGGAACAAGTATGAATGAACTCGCTTCGATTGAATCCCTTGATCCAGAATATAAATCATTGTCAGATACTGTTCAAAATGCCTACTACTTACTACAAGAAGCTAGTGG +SRR005406.53 FB9GE3J10F6637 length=268 GGGGFFFFFFFFFFFFFFHHHHGGHHIHHHHFFFFHHHHHGGHHHFFFFFFFFFFFFFFFFFFFFFFFFFG???GFFFFFFFFFFGGCCCCCBGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGFGGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFIIIIIIIIIIGGGGGEEE>>>>EEEEEEE@@@@@AAA@@@@@@AAAAA:::: @SRR005406.54 FB9GE3J10F6CI6 length=308 TATTGACACCCGCTTTTCCTGAAATATTTGCCAAATCAACATTTTGGGCAGCTTCCAGCAAAGCCCAACCATGCGTATCCGCAAATAGCCGTAATTTTTCAATTGAACTTTTACCGATTCCTCGTTTTGGTTCATTGACAATTCGTTCAAAACTAATCGAATCATCTGGATTGGCAATCAAACTTAAATAAGCCAAAATATCTTTAATTTCTTTACGGTCGTAGAATTTATGTCCGCCCACCATGGTATACGGAATATTAGATTTCAAGAGCATTTCTTCCACTACACGGGATTGGGCATTGGTCCGA +SRR005406.54 FB9GE3J10F6CI6 length=308 GBBBGGFG??=GGGGFFGHBC>?>HGIIIHHHCEEHHHHHFHHHHCCCGGFFGGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFIIIIIFFFFFFFFF@@@@FFFFFFFFFFGG????FFFFFFFFFFFFFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGFFFFFFCCCCFFFFFFFFFFFFFFFFFFIIIIIIGGGGGFFEEEEEEEEEEEEEEFB==@@AAAAA@@@@@@@@:::??@@@@@@566:?@@@A@A====????@@:::@A::::=?B<8 @SRR005406.55 FB9GE3J10F5XQA length=325 TATTGACAAGGTGTGCATCACCGAAGTCAAGCGTTTTTCGTTACAGTTTTAGGTGTTGCAGTGGGTGGTACAGTTTTTATTAGCACCATCATTAAGTTAGAATTATTTACGATACGTGAATGGTTAAGTTTACCGTATGGCGCAAAAAATTTTACGGATGAGACAAAAAAAATAAAAGAGGTGAATGTGATGCGGTTAGATAAATTTTTAAAAGTTTCTCGCATTAATTAAAAGAAGAACAGTTGCCAAAGAAGTCGCTGATAAAGGTCGGATTCAAAATCAACGGAGTCTTAGCCAAATCTTCTAGTACTGTGAAGATTGGTCG +SRR005406.55 FB9GE3J10F5XQA length=325 EEEEEEEEEEEEEEEEEEGGGGGGGGGGIGIIHIIIIIIGGGGIIEEEEEEEEEEEEEEEEEEEEEEEEEEED=====AEEEEEEEEEEEEAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEAA====DEEEEEEEEEEEEEEE99;:442622/7AFFGGAA=?////////?----?==@EEEEEEEEEEEEEEEEDDD@@@@;;555DDEEEEE=DDDD??111111111116DDDDDDDDDD??777??@@@@@@@@@@@??:::6666666....66../.699??>>==::777=@@@@@@@@@@@@@@@@=====7331 @SRR005406.56 FB9GE3J10GGI2A length=279 TATTGACATTGGAGAAACACTAAAAGAAGCAAGATTGCAGAAGAACATCTCAATTGATGAACTGCAACAAATGACAAAAATTCAAAAAAGATATTTAGAAATTATTGAACAAAACGATTTTGAGTCCTTACCAGGCACCTTTTATGTGCGGGCGTTTATCCGCCAATATGCAAGTGCGGTCGGCTTAGATGGCAATCAATTGGTAGATATCTATGATGGCAAAGAACCAGCAATTGTCGAAGAACCCAAGCCAGTGTATGAAGAGCTTGAAGGATCAAC +SRR005406.56 FB9GE3J10GGI2A length=279 EEEEEEEEEEEEED==;EEEEAAAAEEEEEEEEEGGGGGGGHHHHEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEBBBBBBEEEEEEEEEFFFEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE@@@@DDDEEEEEEEEEEEEDDDDDDDDDD<<<@DDDDA;::::;;@D?7777::::?@@@@@@?:::::11176;;96/../ @SRR005406.57 FB9GE3J10GBE5F length=312 TATTGACAGCATTCAATGACAGGTTCAACTTTTGTTCTGTTCCATAAATATTTGTCTAAACAATTGAATTAATAGTACAATAGTCTAGTAAGATAGATCATTGAACGGGGTGGAATAGGCGTGAAAAAGGGAAATGTTAGCGTTTTTTGTTCGGGCTATCGGTTTTATCATTAACTGCTTGTCGGGAACCAAAAGAAAAGAAAGTGACCGCTTCAACGGAGGCATCCTCTAAAGTTGAAGAGACGAATGAAAAAACCAGTGAAACAATTGATAAGACAAACGAACAAGCGAGCAGCAGTGTCGAGTCTAACG +SRR005406.57 FB9GE3J10GBE5F length=312 DDDDDDDDDDDDDDDDDDGFDDDDDDDDD9999922BDDDDDDCCBBBDDDDDDDDDDDBB==@@866@@DDDDDDDDDDDDDDDB@@@DDDDDDDDDDDDD>>>800004//44BAAABBB@/////@::---4<:??DDD9;===>D88DDDB???DDDDDDDBB@BBDDDDDDDDDDDDDDDD???>BBDDDDDDDDDDDDDB>>>DDDDDDDCCDBBBCCCCCCCC@@@CC@<<;@CA???::8/........3:::.13>>>??>>>>>?>?>>>>?>>>>>??>>>>?>>>>>>>?>?>?=7777= @SRR005406.58 FB9GE3J10GBLFV length=297 TATTGACACAAAATTAGTCCTTGTTTTTCTTAATTTCTTCTTGTTTACAGTATAATAAATAATGAAGAAGATTTGAAGAAATTGCATAGATTAGGAGGACTTCTTTTGACAAAAAAATTAATATCAATGGGGCATCGTAGGATTAGGTGGGATTGCCCACGAATTTGCTTCAACGTTTAAACAAGAAACTAGCCAACTTGCAGCTGTTGCTTCACGGACATTGTCTAAAGCAGAACAATTTGCCGCTGATTATTCAATCCCTAAAGCCTATGGTTCTTATGAAGAATTGCTAGCAGA +SRR005406.58 FB9GE3J10GBLFV length=297 CCCCCCCCCCCCC==4<;>>446/////>01@@;;;>225=BB@@@AA@ACCCCCCCCC=::====BDD@=555===CDDD===ABCCB@AABCA@AA@CCCCCC@9;;;///////;;++@@@BAAAACCCCCCCCCCC@@@BCCCCC<<666<@CB<9<@CCCCCCBCCCCCB<<<CC<<88<<<<CCBCCC???CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCBBBBCCC444C>>><<<<<<<<<<<<<:::<<<<<<<<<<::::<<<<:::<<<<<<<<<<<<<<< @SRR005406.59 FB9GE3J10GGCGR length=292 TATTGACGGGCTTTTTGGGTGTTTGCAAAATGCAGCTTCGCGTAGTTCGCTAATAAGTCTAGGCCGCCTTTTTTCAAAATACGGGCGGCTACTTGGTCTGATTTGCTGCCAGCACCAGAGGGCACAGAGAAACCCAATTCTGCAGATTCTTTGTCTAACTCTTCTAAAAAAGCAGCGCGGCTAATAATAGAGGCGGCAGCAACAGCAACATGATACTGCTCTCCTTTAGTGACGAAGAACAATTTTTCAGTGACTTGATTTTTTTCATTACGAACATATTTCCGATAGTTTA +SRR005406.59 FB9GE3J10GGCGR length=292 FFFFFFFFFFGBBBBBF??>GGIIHHHHIIIIIIIIIIIIIIIIIFFFFFFFFGGGFFFFFGGGGFBB000000A3333CAACGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGFGG@@@FFFFFFFFFF@@@FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDDDDDDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGIIIIIGGGIIGGGIIIGGGGBBBGGG@@@@A@@@@@???9<@@@99@@@@AAAA@@@???@@@@@@===??@@ @SRR005406.60 FB9GE3J10GD4OO length=214 TATTGACTATACTTCTCCTTTTGCCACTCAACATTTTTTGCAATAACTTGCATATTTTTATGCACTAGGAGGAAATATATATGAACAACGGTACAGTAAAATGGTTTAACGCAGACAAAGGTTTTGGATTTATTACAGGTGAAGATGGCAATGATGTATTTGCACATTTTTCAGCTATTCAATCAGATGGATTTAAAACTTTGACGAGGCAACG +SRR005406.60 FB9GE3J10GD4OO length=214 AAAAAAAAA??B====::222299<<:<<<<:933333399<=978@?AAAAAA@@@@;A2AAAAAAAAAAA???AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?A@??888888888==???@AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA88888AAAAAA???AAA@?==8866-------3...6----------- @SRR005406.61 FB9GE3J10GAGW5 length=307 TATTGACCCTTTCTCAACTAATATTAAAAACTATCTGTCTCAATATTTTCGAATTTCCTGTAAATTACTGATAAATAAAAACAGCTCCTTTTGCGTATACTTATATTATCAGCACCTAAAGGAGGAACTTTCTTGAAGCAAAAAAATCTACTCACTTATCAATCACTTGCCGCCTTGTTGCTAGTATTCAGTCTCTTTAGTTTAACCCATCGGTTTCTTTTGCCACCCGTTCTAGAAAACGCCTGTTTCAGTTGAACTAGAAATTGGAGGGCTGCCTGGTGATGAATCGATGAATCGGTTGACGATG +SRR005406.61 FB9GE3J10GAGW5 length=307 DDDDDDDBB@@@=DDDBA855HD??///55@D8BBDDDDDDDDDB5550>>>>222BBDDDBBBDDDDDDDDDDDDDDDDDDDDDDDD;;;;BBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBB@///////<<BDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>855555CCCBCC<<585?9==9;88::?;=00/;;;000008==AA113::>>>=====:::::::3337========>?>>>>>======:777711111==::::: @SRR005406.62 FB9GE3J10GE8JF length=332 TATTGACTTAAAATTATTTTATACAAGCCTTATTATTTGGTTAGTAACTTTTAACAACGGAGGGTGATAAAAATGAAGAAGTACAAAAAGTTTTGTTTTTTAGGTTGTTGGGTTATTACCTTTGGTTTTAGCTAGTTGTGGTACAAATACTGCTACAAATGATTCACAAGATATAACCGAAAAAAAAGTAGAACAGGTAGCGACTTTGGCTGCAGGGACACCTGTTCAAAGTTTAGATCCAGCAACTGCTGTTGATCAAACGAGTATGACTTTATTATCCAACGTGATGGAAGGTTTATATCGATTAGATGAAAAAAATCAACCGCAACCAG +SRR005406.62 FB9GE3J10GE8JF length=332 FFFFFFFFFFFEE8876666;AEEFFFFFFFFFFFFFFCC===EFFFFFFFFFFFFFFFFFFFFEDDDFFFFFEEEEFFFFFFFEEE88?22228000000988//?=FFFFDDDDDEFFFFFEE====EDDDFFFFFFFFFFFFFFFFFFFFFFFAAAFFEEEEFFFFFFFFE==;;D99999999FFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEBBBEBBBEEEEFEEEEGFFFFEEEEE@@@@@???@@@@555=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@??555??@@@@@CC>>>96.......69<<<<<=????:7 @SRR005406.63 FB9GE3J10GBIY5 length=345 TATTGAAAATTCCAGACGTGCTTTTAAAAGCATGTATGCAATTTTTGTAGAATCTGACATTTTTTTGTATTTATCGCTAGCAATAAGTACTTTTGGGAATTGATAGAATAATTCATTGTAAATACGGTTTACATTAAAAAATTTGAAGTTGTTCATATAAGATCCCTCTTTTCTTAGTTAAAAATTTATCTATTAATTTATTTAGTAAGCGTTCTTTTTTTAAGAATACCAAAACATTATTTAAAATAAAGCAATTTTTATTTTTAGTAGTAAGATAGTAAAGTAGTAAGATAGTAAAGTAGTAAGATAGTAAAGTAGTAAGATAGTATAATAGTAAAGTAGTAG +SRR005406.63 FB9GE3J10GBIY5 length=345 FFFEEBBBBEEEEFFFFFFFFFGGIIIIGGGHIIIIIIIIIIIIIFFFFFFFFFFFFFF???????FFFFFFFFFFFFFFFFFFFFFFFFBBBB>>>EEFFFFFFFFFFFFFFFFFFFF===FFFB@@==AFF77000055DDFFFFFFFFFFFFFFFFFFFE=;;EEBBBBA==?FDD55;;;EEEFFFFFFFFFBBBFFFFFFEEEFB;;;;9988666;;EEE@??@EEEEEE;;;EEE@??:::66>=::111333:::::@@>?=777@@@@@@777@@@@===@@@@@@@@@@@@@@@@@@@@@@@@@@@@@===?@@@@@@@=:::?@===@C<7700 @SRR005406.64 FB9GE3J10F789E length=279 TATTGACGAAAATGGCATGTTGGATGTCAAAACAAGGGGAACAATTGACAGAAGAAGCGTTAGAGAAATGGGGAAATGATTTACCTACTGCGATTCTTGCTTATAATGACGCCTTTGCAATCGGTGTGATACATACGTTAGCCGCACACGGTATAAAGGTTCCTGAAGAAATTAGTGTCATGGGGATCAATGATATCTCTATTTCTCAATATGTCTCACCACCGCTATCCTCTGTCCATGCCTTTACTGAAGAAATGGGCGAGACAGGCATTTAATTTA +SRR005406.64 FB9GE3J10F789E length=279 FFFFFFDA;;66@@EFFFFFFEEEFFEE7777@AA@@FFF8;;=EDFFFFFFFDDDEFFFFFFFFFFFEEEFFFAA@@D@@ADDDAAAFFFFFFFFFFFFFFFDDDFFFFEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDDDDFFFDDDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFFFFGGGGFIIIFFFFFFFFGGGGGGFEEEEEG@@@@???@@@@@@@@===?@@@?>=1..66...6 @SRR005406.65 FB9GE3J10F7QSM length=290 TATTGACAATCGTAGCAAAAGCGTTACATGATGTTTTAAATGAAGAATTAACGATGGATCAAATCGAACAATTATTGGAAAATCCTAAATCTGTTGATCATGGAGATGTGGCTTTTCCAGCCTTTTCATTAGCTAAAATTTATCGTAAAGCACCACAACAAATTGCAGCAGAATTAGCAGAAAAATTGATGGCACAAATTTTGAAAAAATTGAAGTGGTAGGACCTTATTTAAACTTTTTCATGAATAAAGAAGCAGTCAGTCAAGCTGTTATTGGCGCAGTAGTCAAAG +SRR005406.65 FB9GE3J10F7QSM length=290 FFFFFFFFFFFFFFFFDDFFEEFGFFFFFFFFFBBBBFEEBCCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;==;;;DDFFFFFFFFFFFFFFFFFFFFFFFFFFFF=;;;DDFFAA;;;;EEFFFFFA====FFFFFFFF===EFFFFFFFFFEEEFFFFFFFFFFFFFFFFDD;;;;;FFFFFFFFFFFFFFFF=<000007<<FFFFFEEEB<<<=EEEE99:@AEEEEEEEEEBAA??@@?:;;:??@@@@@@@@@?=:::@@::::@@@@@@@;99...0 @SRR005406.66 FB9GE3J10F8U00 length=327 TATTGACATTAAAGACCTCAATAATTTGTCCCGTAAACACTTGACTGATTAAAAAGAACAGGAAGCCGGCGACCAAGTACGTAATAAAGCTAAGTTTAACAAATTTACGCAACACCTTCGTTTCCCCTAAACCATAGTATCGGCTGAGTAATGGTTGCGCCCCTTGCCCAATCCCTGTAAAATGGCAATCACAATAATATTGAGATTGGCAACAATCGCATAAGCTGAAATCGCCACATGACCAACTAAGTTTAACAAAACAATATTAAATAAAAACATGACAAAGGCCGAAGAAAATTCATTTAAAAAGGAGGAAAAACCAATCGA +SRR005406.66 FB9GE3J10F8U00 length=327 DDDDDDDDDDDDDCAAADGEEFGDFDDDDDDDDDB::999DDDDDDDDDDDDDDA;00;ACCCCBCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@=====0333300AAAADDDDDDDDDDDDDDDCCCCDDDDDDDDDDDDDCBBBDDDD?6666BBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDB888BBDDDDDDDDDDDDD????????????????>>??==:::722222:8?????====??????????=:::111.....99099...117755>>>? @SRR005406.67 FB9GE3J10F6BBR length=293 TATTGACACTGGAAAAATTAGAAATGGCTTCGTTATGGCTGATTTTACCCGCTTTATTAACTGCTTTTGTGATTGGTAACGCCTATCAATGGTTGCAAGCTGCTCTGGCTAAAATATGCCAACCTTTTGAAGAAAAGCAAAGCATACTGGTAAGCTTTGGTGCAGCCTGTATTTTTCTCTTTGTTATTTTAATGCCAAGATTACTATTTTCAGGACAATCTTTTATGCATTTAGTTCCTAGTTTTGGTAGTCAACAAGCTTGGTATATCTTGGTGATCGCTGCGATAATGAAA +SRR005406.67 FB9GE3J10F6BBR length=293 DDDDDDDDDDDDDDDDD;>0EEDDDDDDDDDDEEGEDDDDDDDDFDA;;;BACCDDAAAADDDDDDDDDCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCC:DDDDDDDD999996DDDDDDDD999CDD9999CDDDBD==::444444???8:8DDDDDDD@78888::9????====?=:::???????===:::???===?7777:==7711. @SRR005406.68 FB9GE3J10F6992 length=315 TATTGACTAAAAACTTAAGTGACTGCTGCGAGAGATAACGATAGGTTAAAACAGCATGTTAGAAATCTCATGAGTACTGATATGGCGAGAGAATATAAAAAATTAAGTAAAGAACATGGGCAAGTTAAAGAAAAATATAGTGGTCTTGTAGAGCGATTTAATGAAAATGTAAATGATTATAATGAGTTGCTTGAAGAAAACAAGTCTTTAAAGTCTAAAATAAGCGATTTAAAGCGTGATGTGAGTTTAATCTATGAAAGCACTAAGGAATTCCTTAAGGAACGTACAGACGGCTTAAAAGCCTTTTAAAAACGG +SRR005406.68 FB9GE3J10F6992 length=315 FFFFFFFGEEDDEG====CBHHHHHHHIIIIIIIIIIIIIIIIIIFFFFFGIGIFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB;;5555FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFG;;;;FFG;>>FFFFFFFFFFFFFFFFFFFFFFFBBBBCFFFFFBBBCCGFFFF@@@@EEEEEEE::<==AEEEEEEFGGIIIA@@@@AAAA@@@@AAAA@A@@==========@@@@AAAAA@@@@AA::::?BBB82...........29B @SRR005406.69 FB9GE3J10GEIPX length=283 TATTGACATGGGCGCCTGCTAAAATAGTCGTCCCATCCATGGCTGTTTTCTTTCAGCTGAATTTTGCCTTTGGTCCCTGTAGCATGCCCGCCACTGTGATCGATGTCAACGACCACATCGCCATTGTCATCCCCATGAACGACTTCTGAACCATTTCCAGTAATTGACACTTGGTTGGATACCGTGTCTGTACTCCCCGCCGCTGAAGAAGTCACTAAACTACGATATTCCATATAATAAGGTGCTTCAATATGGGCCATTTTAACGACTAATTTTTTGTTGT +SRR005406.69 FB9GE3J10GEIPX length=283 DDDDDDDDDDDDDCCCDDFFFFFEGDEEFEEEEEEEEFHHFFFDC6996@333>AHHHHAA1666@CD@@@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDDDDDDCCCCCDDDDDDDDDDDDC>>>CDDDDDDDBBBDDDA<<<DDDDDDDBBBDDDBB@:::==::::777777:::==???????99::993++11 @SRR005406.70 FB9GE3J10GDRSJ length=287 TATTGACTAGACGACTCTGAAGGCGCTAAAAAATAGGGCGAATATCTTCAAGGATCACTGTCTGATACTTTGGAAGGCTTAAAAGTAACTGTGACGCCTGTCCCAATGGCCGTTCGTTTAGATCGTACCTTAAAGGGGACTTCCAAATCGCTGTTCGTGGTTGGAGTGCCGACTATTCAGACCCAATTAACTTCTTAGATTTATTAGAAAGCTCAACTTCTAATAACCGTGGACGTTACAGCAATCCTGAATACGATAAATTCATTGCTGCGTACCAAAACCACAGA +SRR005406.70 FB9GE3J10GDRSJ length=287 <<<899>><979===>=<:::<8:8??468844:(3333.32:8<<<=79999899??@@?AA@@@?BA??422288922....00**69<==????=????883338????????AAA<<<<==;;::.........,44433...06==>??????AAAA867???@@??;;;??;;;>>766677<;666;;>;;;>=>>;;;;0000;<;;;<9;;<;;;;;:::<<<<=<>>=<<:555567663334663....001111431,,,,,,,,,,,,,)131, @SRR005406.71 FB9GE3J10F60K5 length=319 TATTGACCTTTTTTACGTAATGGGTTTTAAATTCTTATTATCAGTTTCTGGCGTAATTACACGCTCTCCAATTGTCACTTGGCCTTTAGTTGGTTTCACCAAAGCATTTAAATGTTGCAATAGCGTTGATTTGCCACTGCCAGTATGACCGACAATCGCTGTATAAGAGCCGTCTTGAATCGTTAAATTAATATCGAATAATGCCCGTTGCTCAAAAGGAGTATTGGGTTGGTAAGTAAAATCTACTTGTTTAAAACGGATGTCCATAACCAATCCACCATCCCTTCTTCTGTTAAATAATTCGTTGGCACAACAACCG +SRR005406.71 FB9GE3J10F60K5 length=319 BBB@AA55//////66B5CBB111DDB:111..85>?5588BBDDD??;??BBDDDDDDDDDDDDDD>>????BBDDDDDDDDDDDDB?<<>>DDBBBBDBBBBBDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDGGDDDDDDCCCCCCB:666333::====>>>>>>>>>>>>>>>>>>>>>>>>::663<<<;<::::;1..11<;6664::<<;:11116 @SRR005406.72 FB9GE3J10F60V0 length=322 TATTGACACACATTCTTTTAGATGATGGTTTAATTTGATTTAGAAGTAACTGATATCGACCGTGATGCAAACGAAATCGTAACAGTTGTTAAAAACGAAAGGCGTCTTGAAAAACAAAAAAGGCGTTAACGTACCAGGCGTTTCTGTAAACTTACCAGGGATCACTGAAAAAGATGCTAATGATATCCGTTTCGGAATTGGTCAAGGAATTGACTTTATCGCAGCTAGCTTCGTTCGTCGTGCTTCTGACGTTTTAGAAATCACTAAAATTTTAGAAGAAGAAAACGCAACACACATCCAAATCATTCCTAAAATCGAAAAA +SRR005406.72 FB9GE3J10F60V0 length=322 FFFFEEEFFFFFFEA6666;EEFIIGBB588BB777BBFFHFIEEEEBBBEFFFFFFFFFFFFFFFFFFFFFFBBBFFFFFFFFFFFEBB<<FFFA844488EEEEEEFFFFFFF>>>>>>EEEFFFFFFFFFFFFFFEEEFFFFFFFFFFFEEEEEFFFFFFFFFE=====FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGFFFFFGFFFEEEEE=::9<@EEEEE???=@CC7111117;<;;;<@97.........;<>@?@@@@@@@@@===@@@@?7771119<<77777....797..... @SRR005406.73 FB9GE3J10GC6TX length=309 TATTGACAATGCAGGATTGTTAGCATCTAACTCGGTAACATCGAAAAAGGTATTATAGGTTACGTAAAAGGCATCACTTGTTTTGGCATACGCCCCCCATGAAACTTAACTTAAAGCCTGTTTCACCTTCTGCATTACGAGTTATTTCTACCATGTAATCTTTACCTAAAGTCAACTGAGCACCAGTGGTTGTATCTTTAACAACCAATGAATTGGGTACCATGGTTAAGCCAGGAACTGGTTCGTATGTGTCCGTAATCACGGCATTTTCCATCAAATAATTATTTTGATTCACAGCTAACGTCCAAA +SRR005406.73 FB9GE3J10GC6TX length=309 FFFFFFFFFFFFFFFFFFHGGIIIIIIIIIIIIIIHHHHIHHH;;;77GCCAGGFFFGGGGFFFFFFFFBCCGFFFFFFFGGGGGGCCFFCA000000AAFFFFF@CBBBBBBBGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGFFFFFFFFFFFFFFG@@@GGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFIGGGGGFFFBBBBBBBEEEEEFGGGGGIGAAAAAAAAA@AAAAAA@@@@@777777@@@AABB777771111=@====@@AAA@@@A@::666 @SRR005406.74 FB9GE3J10GBFJH length=297 TATTGACCGCAATTAACTTACCACTAATGGTCCACTCGCGCGCTAATTCATGATTTTGGGCAATCATTAAACTCAATTCTGCGACACCAGGTGTATACATTTTGGCTAAATCATGATGGTTTAACACCGCTTCTGTTGCTTCAAGACTTAGTACACCAATATTTTTTTGATGAATTGCTAGAACTTCTTCTAACACATTGTCACTTCCTTTCACGGGCTGCCTTTTTTCTATTTGATGAAGCAAGGGTTTGAACAACCGTTATCGTCGCTCAAACCCTTGCTTCTTTATACATTTGG +SRR005406.74 FB9GE3J10GBFJH length=297 DDDDDDDDDCCCCCCCCDDDDDDDDDDDDDDDAAADDDDDEDDEHDDDDDDDDDDDDCAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBAA///////AADDCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>>>>CCCDDDDD=@>800//////8/D==DDDDDDDAAAAD???????==::::???????????===???????=:444:??????=:7777 @SRR005406.75 FB9GE3J10F69YQ length=250 TATTGACAAACAAGCTGTGGCAACTCTGCGCCTGTCGTTTGTTCTACATCAAAGACAGGCGTTAAAAAATAGCGCATCTCTTTGACAATTTCTCCATTTTCATCCGTAACTTTTTTCCCATTCTTATCGACTTTATCTTTAAAATAAGGGGCATACACATACAGTGCTTTGCTGTCCTTTTTTTACTTGACGATCTTAACTTTTTCCACGCATTGTAACCAGCTACACGACGTATGTTTGGTATTTTGTG +SRR005406.75 FB9GE3J10F69YQ length=250 CCCCCCAAA<<77<@CCCDDDDEEGGGIIIIIIIIIIIIIIIIIICCCCCCCCCDCCCCCCCC777777C.CCCCCCCCCCCCCCCCCCCCCDCCCCCCCCCCCC;;;;9555111000>>@@3355@CCCCCCCBCCCCCCCCBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC<<<<<<<:4))?CCA6//////6/////6669<66/222<?888?CC??>CCC88331777<740944//4+2 @SRR005406.76 FB9GE3J10F7LD9 length=297 TATTGACTAATATTTGTGATTCAGAAATTATAATACAAATATTTTCAATAGGACATAGGAGTACTATCTACAAAAAATAATTTATGTAGGAAACATGCAAAAGAAGAGGGTATATTAGAAAATAGTCCAGTTTCTATTGAAATCTTAACTGTTGAAGCACCTGCAAAAAAAGTGATATATAACTGAATTAGATAAAGATGTTATCTTTCTACTTGGTTTTANGTCAAATTAATTAGCTTAGAATAGTTATAATTAACTATAAATAAAAATATAGACTCTCTTTGTATAGAGAGTCTA +SRR005406.76 FB9GE3J10F7LD9 length=297 DDDDDDDDDDDDDDDDDDEDDEED;;;DDDDDDDDD@@@GFFFFFDDDDDDDDDDDDDDDDDDDDDDDDBB555555@3?DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBB::///////:@BCCDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDD>999DDCCCCC!BB@CCC5555555:C:::AAAA@=:::11.6644647..........6,67====:777=========66666./ @SRR005406.77 FB9GE3J10F5CU0 length=327 TATTGACAAATCTTGATATTTTTTTCTTCGCTTTGTTTAATTTTCACGGACTAATTTTTTCGTTATCCTCTTCAATATCCTTTAAGAAAAGTTAGACTCTTTTGTTTGACCCGAAGCGATTGCTTCGAGCGATTTTTCCCATTTTTCCGTTTAGTTCAGGTGTCACAAGTGATGGATTCACCAAGTCTAATAGTTGCTTTCCTTTGGCAGAGACACTTAAACCGCTATTGGTTCGTTCCATCAATTCTGATTTAATCAGTTTTTCAATAATTTCAGCTCGCGTTGCCGGTGTGCCTAAACTGTGTTTCTCCATTTTTCCTAACAACG +SRR005406.77 FB9GE3J10F5CU0 length=327 C???AA@330<<<<<<64///////6).AAAAAA@000@@00--6<>AA44633//////<<..A>@@CCCC?@@@?CAAA;;44433::A44-;;@@?<C><@---3555;C???ACCCCCCCC?@@ACCC=====C@@@=;;;;CC@---AA>>@@@@@A>??C???AACCCCCCCCCCCCCCCCAAA???AAAAAAA2200199CACCCCCCCCCCCCCCCCCCCC??88333388CC???C::::5555::6:::::::5555:5511155:::::;;;;;;;;;;;;:::;:::;;;;;::47022--------*--00024 @SRR005406.78 FB9GE3J10GGF8C length=294 TATTGACAAGACCACTGGAATTCCAGCCCTTTGGCCGCATGCAACGTCATTAAGGTTACCTGCGAAGAGCTCTCTTCTAAATTATCTAAATCAGAAACCAAGGCTAAATCTGTTAAGAAATCCGCCAATTTTGTTTCTTCGCCATTTGGATCGTCGTTGTTTTGCGCTTCAAACGTTTATCAAATTCTTGTGTCACAGATAAAATTCGTCCAAGTTTCTAAGCGAGCTTGAGACTCTAATTATTTGCGCCATCAAGCTTCCCGATAACCACTACGTTGTAAGTTTCTTCACATT +SRR005406.78 FB9GE3J10GGF8C length=294 ;==:999::80226022222222233:99000899:8<<>A?ABAA=====??B@8889989??<<<<????????????@??>???@@????@??>>>4488??<<<???AAAAA??????>><<882112</22=88===:;222220:9;;;;;:600..3468643...68.......00006<=;;==>>>;;;>;76133335-------,,*,,,,5222225222552,,,220,,,130,,,,,,,,,,,,,,,,,,,,,003331,,,,,,,,,,3,,3,,,,, @SRR005406.79 FB9GE3J10GDQIK length=303 TATTGACCATGAATTTCGCCCACCAAGTCATCAATTTGACCCATAATTGGGCGGATTTCTACTTCTGGATCTAGTAAACCTGTTGGTCGAATGATTTGTTGAACAACAGTCTCTGTTTGTTCCATTTCATAAGGGCCTGGTGTTGCCGATACATAAACAATTTGGTTTACATGTTGTTCAAATTCTTCTAAACGAAGCGGTCGGTTATCAAGTGCACTTGGTAAACGGAAACCATAGTCCACTAACATTTGTTTCCGTGCTCGGTCGCCATTATACATTCCTCTAATTTGCGGCATTGTTACA +SRR005406.79 FB9GE3J10GDQIK length=303 DDDDDDDDDDDDDDDDDDDDE<77>>CDDDDDDDDDDBB888>855BBDDB?;;B???DDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDD???DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD55555<<DBBBDDDDDDDDDDDDDBBBBBDDDDBBBBBDDDDDDDD>>>666>>D<<<BBBBDD88<BDDBBBBBBDBBBDDDDDD===;;=000000...77A@@@CCCCCCAA:61116../66<7;;<====::::<<:::;66555574......5844455566<<<< @SRR005406.80 FB9GE3J10GC0BC length=271 TATTGACTGTGTCTAAGTCATTTCGAATGCCGCCAATATAACAAATCCCTAAATCCATAGATTCAGCCGCAATGGCCATGTTTTGCGCAGCAATCGTTGTATCAACGGCAGCTACTAATAATGATTCTGGTGTCTTTAGGGGTTCTAATGATTGCCCCTCTTTTGACAAAATCGTTGCATGACGATACAAATCAGCAACAAAAACNTAGAACACACCAGTGTTAACGACATAGTCTTCACAATTCGCTAAACGTCCCAATTCTCTGCGTAG +SRR005406.80 FB9GE3J10GC0BC length=271 DDDDDDDDDDDDDDDDDDGGGGGGGGGEEFFEEDFEFDDDDDAAAAAADDDDCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<00000;AA0000;BDDDDDDDDDDDDDDD?>>DDDC>999DDDDD>!>>DDDDDDDC@@BBBBB@????DDD??@<<<BDBBBDDD??????????????====?==:::== @SRR005406.81 FB9GE3J10GDP18 length=210 GGGTCATCGACGACGTCATTGATGAAGAGCGAGCGATTGAGGATGCCCGCGCCGCCGAGGCCGCCCGTGAGCAGGCACTCCGCGACAAGCTTCTCCGAGGCAGCGTCAAGTATCGCGGCCACGTCAAGCGATGAGGGTAGCAGCGTCACATCGACAGTGCCGCAAGGAGACTGGAAAAGGAATAATCGGCAGACTGATGGACTGCCGGTA +SRR005406.81 FB9GE3J10GDP18 length=210 DDDDDDDDDDDDDDDDDDFFGFFHHHGGGHGIIIHHFFGFFFFFF===DDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDDBBBDD@@@@@@BBDDDDDB@@@DDDB@@@DDDDDDDDDDDDDDD@8888?DDDDDDDDDDDDDDDDDDDDDDD???BBDDDBBBBDD===9554644444=??B::555<<<<<<DDDDDD @SRR005406.82 FB9GE3J10F7NKF length=244 TATTGACTTGAAGATTGTAATTATGATAAAATCATCATCATGACCGATGCGGATACCGATGGTGCCCATATTCAAGTGTTGCTATTAACGTTCTTCTATCGTTATATGAAACCATTAATTGAAGCCGGCAAAGTCTATATTGCCTTACCACCTCTTTATAAAGTTTCTAAAGGAACTGGAAAAAATCAGTCATTGAGTATGCTTGGACCGATGGTGAATTGGCAGAAGTGATTGATAAAGTTGG +SRR005406.82 FB9GE3J10F7NKF length=244 ??????>99999712220897758<==77<88::????AAAAABA??@???8998<=<:;9867222;;=====?>???A===AAAAAAA??<<<<=>=;70004=:;111116==>>==<8888???=>>>?>>=;;;;::::66699000:977793773.....+.....++444400344466676;;6666;=<;;;;;;;=;;;:::99988442222222522222522,,,255,, @SRR005406.83 FB9GE3J10F5T2N length=313 TATTGACTCAAAAGGTAAATGGTATGAAACCATTACAGGAACGGCGGCTAGATATGAGGCTGCAACAGCTAGTAAATACGTGTCGAATTTAGGACTTTTATAAATAATAATTTTGTCGCCTTTTTTTACACCTAAAGCGGCTAATTGATATGCCCGTTTCAAAATTTCTTGATGGCTTTCACCATAAGTTGTTTCTAAGCCAAGTGCAGGAAAAGCAGGCAAAGATTCATCAAAAATATTGGAACAGTTGGTGTTTTTTCNGCGGCTTCTTGATAGTTTGTGTAGAGGTTTAATGGTTGATAATCAAGTTAAG +SRR005406.83 FB9GE3J10F5T2N length=313 DDDDDDDDDDDDDDC;77>ADDGFDDAAAGGGGGFHFFHGGEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;;;;;;;DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;;;;???DDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDDDDDDDDCCC9999DDDBBBDDDDDDDDDDDDDDD@<088<<<;:=>>>>:711177711!7:7777????====????:;:=::::?????????:::=9966666/..... @SRR005406.84 FB9GE3J10GCT5C length=289 TATTGACTACAAGTATTAACCAATATTGCCTTATTGGTTGGTGTCTTAATCATGATGTTCCGTCAAAATGTGGAACTGGCATGGGCTACAATTGCTTCTACGCCGATTGCGATTTTAATTGCGGTCTTTGTGATTAGCAAGGCGCGCAAAGGTATAGGTCGATTTACAGCAAGATGAAGTGGGTAAATTAAATGGCTATATGGATGAAAAATTAGTGGGCAACGTGTGATTATTACTAATGGCTTACAAGAAGAAACCATTGACGGCTTTTTAGAGCAAATGAAAAGTT +SRR005406.84 FB9GE3J10GCT5C length=289 CCCCCCCCCCCCCCCCC?@AAAACAA@@4444@99==::CCCCDCAACAAAACCCCCCBBAA?;6666<<<CCCCBCCCCC@766;@CCCCCCCCCCCCCCCCCCCCCCCA@;;;;;;66@@;;;?CCCC>CCCCCC@9777<0111///111/1111?CACCCCCCCCCCCCCA>999>33/7///:>555>>>>>CCCC999??=:;::>>2>>331138CCCC??@CCCCCCCCCCCBBBCC;:::;:::111::5::7772551----4672----------247 @SRR005406.85 FB9GE3J10GCNS1 length=298 TATTGACGCCCAGTGTTAAGTATTCTTTTTGCAATTGCTTTACTGGCTTCGGGTCAAAATTCAACGATTACAGGTACGCTGTCAGGACAAATTGTAATGGAAGGCTTTATCCATTTAAAAATGCCGTTGTGGGCAAGACGAGTGTTAACTCGTTTGTTAGCAATTGTGCCAGTCATTATCTGTGTCATTATTTATGGCGGTAGCGAAACGGCTGTTGAAGACTTGTTGCTTTATACGCAAGTTTTCCTAAGTATTGCTTTGCCAGTGTCGATTATTCCTTTAACGATGTATACAAGTG +SRR005406.85 FB9GE3J10GCNS1 length=298 EEEEEEEE===DDEEEEEFEEEEEEAAAAAEEEFFEEEFFFEEEEDDDDEDDDEEEEEEDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEED;;7DEEEE777>>DDDEEEEEEEEE===DDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDBBBDDDDDDDDDDDDDDDDD@::::71/11777=@@@@@@@====@@@?::7771111777777::::?@@::::@=: @SRR005406.86 FB9GE3J10F5BL0 length=309 TATTGACTAGTAGAAGCAGAAGAAGAGTTACAAATTTTTAGAGGTGAAATTAACAAGCCCGGCTTTATTCAGCAACTATTTCAGCTTTATCAAGAAATGCGCGAAGGCAATATTGAGATTGCGGAGCTTTATCCATTCTTAGAAAAACAAACGGAGAACCCTAAAGGACAAGATTTACAACTTAAGTTTCAAGATTTAACGTTAATTTTTACGCGATTCCAATTACAAATGAGTCAGTATGGCTATGAATCAGCGGAGATTATTCAACATTTAAGCGAGTATTTACAAACGGTTGATTTGTCGAATGTT +SRR005406.86 FB9GE3J10F5BL0 length=309 FFFFFFFFFFFFFFFEEEGGGIFFFFFFFE@88877000;@@EFE;488DDEEEFFFFFFEEAAAEDAAADFFFFFFF===EEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFAAAFEEEEEFFFFFFFFFEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEEEEEEEEEEEEEEFFFGFFEEEEF@===@@@@@@@@@@@@@@@@@@@?:::@@@@@@@@@@@@@@@@@@@@@@???@@@@@@@@@=43 @SRR005406.87 FB9GE3J10GF21A length=311 TATTGACCAAAAAAGGACAATAAGATTGCCAAACTAGAATTTACGTTTACTGGTCTGAAACCAACAAACCAAGCGTAACCATGCACGATTGGGTAAACGGAGAATAAAAAAAGAACTTGCCCCCTCACATTAAGCAAGTTAGCAAGTTCCTCACGCAATCTTCCGGACTGCTAGATTATTTTAGCATATTTGCGTGAGGACTTCTAAAATAAATTATTTTGGAGGTCCTACTTATGGGATTAATGACAGGATACAACATGACAAAAGAGGAGTACGAAGTCACACAGGCTGTACTGGAGCGACTAGATTAA +SRR005406.87 FB9GE3J10GF21A length=311 FFFFFFFFAAA===EEFFFE;::BBEEB::555;BEEBB555;;BEFFFEEEEFFE;555:::::[email protected]@@00000@<EEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE====BFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGFFFGGGGGGGGGGGGGGGGGGGGFFIIIFFGG@@@:::@@@@@@@@@@@@@@@@@???@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?:::77 @SRR005406.88 FB9GE3J10GBION length=319 TATTGACTTGCTTCAAGTGACAAGGGCTCTTCACCAGTGTTTTCAAGTGTCGTTTGGATAAGCGCCGTTCGATTGCTGACAAAAATTAAAAGCTAAATGAATCGTTAGATCGTCTAATTCATAGGTTTGCTCTAGGCGCCCAGGATAATAAGACAGGTCCATGCGGTTGCTTTGGCTTAAATCATAGGTTTCTCCCGTTTTTTTATTTTTGACCGTTAATTTGTTTAAACTTGCCGCCAAGTTTACTGGATATTCTTCCGCAATAATCAATGGCCCCACAAAACCACCCAGTAGCTCTTTATTGCTTTTTTCAGGTAAA +SRR005406.88 FB9GE3J10GBION length=319 FFFFFFFFFFFFFFFFFFFGIEEEEFFFFFFFHFFFFFB====EEFFFFFFE>>>EEEFEEEFFFFFFFFFFFFFFFFFF00000881111ACA555FFFFFFEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF===EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBBBF=======FFFFFFFFFEEEEEE@@@EBBBEEEEEEEEB@==<<B@@@E@@:::=@@@@@@@@@@@@@@@@@@>=77....72......:=??@@@@@?===@@@????======@?44433: @SRR005406.89 FB9GE3J10F7ODR length=312 TATTGACCTTTAATATTGCGCGGAATATTAAAGTCAAAAGTGTATTCTAAATTAAACCATTCTTTCGCTTTATTAGCAGGTACATTCGTAGGCAATGAAAAAATCATTTTGTACATTTGCGCATATGCTTTTTTAAACTTCCTAGCTTTTGCTTGTGCGAGGTTTCTAGGATTTTGCATTTTAAATTCTAGCGAAATCCTGAAGCGTTATTACTAAAACTTTCATCGTTTGCATTATAAGTCATAGACATTTGATAGATTAATCGTTCTAATCGGTCTAACAGTATTTTCTTGTGTTGTATCCGAACTTAGG +SRR005406.89 FB9GE3J10F7ODR length=312 DDDDDDDDDDDDDDDDDDEEEDDCCCBDDDDD@@@5555@BDDDDDDD@@@DDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDBGBBBBDDDCCCCDDDDDDDDDDDDDDDDDDBDDDDDDDDD??DDDDDDDDDDDDDDDDDDDDDDDDDDDDBB@1111@A@1111::D55=BDDDDDDB999DDDDD>999>DDDDDDDCBB777CCCCCCCCDFFFFFFFDCCCCCC?777::==>?>?>====>??:::>777=?=====::9//...../,0:9:::=:7777::::::=77 @SRR005406.90 FB9GE3J10GC3M6 length=321 TATTGACTTTGGCTCGTAAAGAATTTTATCGTGAAAAGTTTGTTTATTCATGGGGCGCTTTAACGGTAGATAGTATTTTGTTTGGCTGCTTGTTTATCGGTTATGCGGTTGCTGGCTATTACGCCGCACGACCAGCTGGTGGCAATCAAGTTATCAATCACTTTTTGTTGTTTCCGTCAGATGATGTTTGGTTTAACGGATTGATTGGATTAAGTATTTCCTTGATTGGTTTATTCTTTTTGTATCAATATTTAGCCGAAACAACTGTTACTTTAGGTGAGGGATTTGAGGAAGCGCGGTTGACACGCTTTTTGGTAAAAA +SRR005406.90 FB9GE3J10GC3M6 length=321 DDDDDDDCCCDCCCDDDCCCC@@111180@@CC1116CDCDDDDDDAAACDDDDA@9C666@@D8868@DDDDDD@@@@A777AAACDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBB@<<<<<@AADDDDDDDDDDFDD??????????????????????????777:???::33337=???????????????????777:??==::5???77 @SRR005406.91 FB9GE3J10GCLRU length=287 TATTGACTTTTATCTACTTGTTCATCTTTGGCAGTTAAAATCAAAATAGGCGTGTCAATTTTTTCTCGACGAAGTGCCTTGGTAATTTCTAAGCCATCCATACCAGGAAGCATTACATCTAAAATTATAAAATCATATTGATTAGACAAAGCTAATTCGAAGCCGTTTTTACCATCTTCAGAAGTAGTCACCTGATAGCCTTTCTTTTTCCAAATTAAAGGTTAACAAAGTTAAATCGATGGTTCATCATCGACGACAAGTACTTTTTCATTACATACTCCTTCAAG +SRR005406.91 FB9GE3J10GCLRU length=287 CCCCCCCCCCCCCCCCCCEEEDDEEEFEGGGGGGIIHHHGGGGIGCC>CCCBFBA<<<333333<-BCCBCCCCCCCCCCCCCCCCCCCDCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC::6666CCCCCCCCCCCCCAA555@@@9997<>?<:<<7/////77:>AA:>>>>>>>::::CCCAAAA=66//////-----//666990027877<<?<<<?11...17999////7:::555::::::::::::5555/54----2--------,--- @SRR005406.92 FB9GE3J10F5P1J length=310 TATTGACGGAGTGAATAAAATGAAATTAATTGGGATCGTCGGATCAAACGCTGATTCTTCTTATAATCGGTTACTACTGCAATATATTGGCAAAGAGTTTTATAAAATGTTCGACTTGGAAATTTTAGAAATTAAAGATATTCCAATGTTTAATCAAAGTAAGGATCAAACGAACAGTGTCTTGATTCAGAATATGAATCGCAAAATTTTACAAGCAGACGGCGTAATTATTGCGACGCCCGAACATAACCATACCATTCCTGCCGGTTTGAAAAGTGTGTTAGAATGGTTATCTTTCAAAATTCATCCG +SRR005406.92 FB9GE3J10F5P1J length=310 FFFFFFFFFFFFFFFFFFIFGHCCCCCBBBBHHHHHHHFHHHHHHFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFG7777G76666GFFFFFFFFFFFFFFCCCCFFGGGFFGGGFFFFBBCCFFFG;;;CCGFFFFFGGGFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF?????GFFFFGGEGIIIIIGGGGGIIIIGGGGGGGGGGIAAAAAAAAAA@@??===@::77111=1111:=@@@@@@@AAAAAAAAAA@@@@::::@??==::: @SRR005406.93 FB9GE3J10GCZP7 length=288 TATTGACGGGGAGGAGCGCTCATGTCAAAAATTGTTGCACGTATGGAAAAAATGAAAGACGGAAATTTAAGTGGTATCCAACGACATAATCAACGAGAAACCAATAATCATTCCAATCCTGATATTGATATTGAGAAATCTCACTTGAATTATGACTTAGTCAATCCTGGTTCAATCAATTATCGGGAGAAAATCAAACAAATCATTGAGAGCCAACGAATCAGTAAACGNGCGGTTAGAAAAGACGCAGTCCTTGTGAACGAATGGATAATCACTAGTGATACCGTT +SRR005406.93 FB9GE3J10GCZP7 length=288 EEEEEEEEEEEAAADEEEFHEFEEEECCCCCEEEEEEEFEHHEEEE??????EE;;;EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDEEEEEEEE===EEEEEEEED@@@@@B@@?DDDDD===BB!BBDD<<<B<<<<B777>>=:::=:7777::?@@@???@@@@@?777::@:111177= @SRR005406.94 FB9GE3J10GDHEM length=311 TATTGACTCGGTTTTTTAATTGACTGATGTTTGGTCTTTCGTTGCCGAACGAACGTTAGTCATTTGTTTAGCTTTTGTGATGTTCACAGTTAAATCGTTGTCGCGGTTGTTTTCCCCAACAATCATTCCTTCGTAAACTTCTGTCGTTGGTTCAACGAAAACTGTACCACGTTCTTCAATACTCATGATTGAGTAAGTCGTTGCTTTACCAGTATCGATTGAAACTAGTGCACCTTGATGACGGCCACCATCGTTCCTTGAATCATTGGTAAGTATTGATCGAAGGTGTGGTTCATAATACCATAACCACG +SRR005406.94 FB9GE3J10GDHEM length=311 CCCCCCCCD==444444BB00BBEDDDDEEDD876@@CD=622@B=====BDDB@===@BAA555A222B@AAACAA=@ACCCCCCCCCCCCCCCCCCCCCCCCCBBA@3/334444==9DCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC>>>444>>BCCCCCCCCCCC@@<999<:11..16<::1111::<<:44466661..36::::6666::<:611111:<66338879334.... @SRR005406.95 FB9GE3J10F8SXK length=300 TATTGACGAAGTGACGATTGCTTTAAGATAGTCAGACGCAGAGTCACAAGGAATAAATGTCGGCTTTTCTCCATCATGCCGGATGGGGCACAATGGTTAATTGCTCTGGTTGAGTGCCTAATGTTTGGAAGAGTCGTGTAATTTCTTTACTTGAACGGTAACTGTTTAATAATTGATAGGTTCCAACAGAACGGCTGGTTTCGTTAACCAATAAATCATGAGCTTCAGAAAATTCAATGGCTGTATTAAAAATGGCTTGATTTTCATCACCAGCTAAAGTAAAACTAGCTTTAGGGAAAG +SRR005406.95 FB9GE3J10F8SXK length=300 DDDDDDDDDDDDDDDDDDGGIIIIIEGGEEFEEEEDEEEEEEFEEDDDDDDDDB9::DDDDDDDDDDDB599DDDDDD5655DB5000@ABA@>>?>>BBBBDDDDDDDDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCCCCCCCB>>>>>>>@AA????777.......45558855.11166:::<<788511184....57///.../....... @SRR005406.96 FB9GE3J10GFJ2M length=287 TATTGACTAGAAATTGAACAAACGAAAGCAATGCTAAAAAATACAGTATATCTTAGCGTTAGATAATGCAGGCGCGTGGCTGGAAAAAGAATACTTGAACGAATTAATGCCGCAGACGATGCTGACGGCGGAGGAATGGATTGAGCGGATCAATGCCGTGACTATTCCAGAAATCCAAGAAGTAGCCAAACGCTTGGAACTTCAAGCGATCTTCTTTTTGGAAGGAGAAACAGAAAATGAATTAAAAAGACTATGCACAAATTAAAGAAACATTGTATACAGAAACA +SRR005406.96 FB9GE3J10GFJ2M length=287 CCCCCCCCCCCCCCAAAAB===BC666=@CEEEDD:9::::B0DDCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDBB;;/////5,,;;@A@577ACCCCCCC@AACCAAACCCCCCCCCCCCC766ACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC666CCCCCCCCCCCC@@665;;BBBBBBBC;;;;:?BAA>>911/////////====:@@@<<44446///////...4,88:::::<<<<<<<<<<<<<:66666::6666666:5 @SRR005406.97 FB9GE3J10F5I1E length=313 TATTGACACTTCCTAAAAATAACCAATTGGATCAAAAATTTTTAAAAAGTAACCATTTACACAGTAGCAAGGTGAAGCTACCGTTAAACGAGGCATTCAAAAAAGAAACTAGAAGCCAAATTAGCAACTTTGAGTTTTCCAGAGGGGAAACCAAGCAAAAATGCGAGTATCCGTCGAGGCAATGGCACTTTTGAAATTGTTCCTGAAGAACAAGGCACAGTAGTGGACACACAGCGCTTAAATCAGCAGATTATTGCGGATGTTGAAGCGGGAAAAGGCAACTATCAATACAATGCCAAAGATTTTTATAAAG +SRR005406.97 FB9GE3J10F5I1E length=313 DDDDDDDDDDDB@6/////?,,55AAADDDDDDDDDDD::644,,,,,7,,,55BDDDBBBBDDDDDDDDDDDDDDDDDDDDDDDDBB99799DDDDD;;;;?<B+++>DDDDDDDDBBBBBBDDDDDDDDDDDDDDD>>>>D5555DDD88669BDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBBB<<<DDDDDDDDDDDDDDDDDDDDCCCCCCCCCCCCCCCCCDDDDDDDDDDDD>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>9666: @SRR005406.98 FB9GE3J10GBCDF length=326 TATTGACGGAAATCCTTTTTCTTTCCACAGCATGTATTTGTATTGGTAAACTTCAAAAATATCCAAGTATGATTCAATCAATGGATCAAGAGTAATAGTGTATAAATCAGACTTGCGCATAATTTCTAAAATTCGCGTTTTTTCGTGATTAACTTTTTCATCAATAATCGCTTTGCGTTGCGCTTTTGTGGTCATTTTTTATACACCCCCCTTTTATTTTTAAAATTTTTGACCTAACGACACGCGTGACTGCCCCCTACCCTATCCCCCGACAAAAAATTTGAATCAGATTTGATAGGGGGGCTTCTATTTTTTAAAATAAGATG +SRR005406.98 FB9GE3J10GBCDF length=326 DDDDDDDDDBBBDDD::::;>---BBDDDDDDDEDEEEEGGGGFFDDDDDDBBB====88->?BBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD777777DD5DDDDDDD@@@@@DDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDD999999D6DDD:@@@CCDDDDD?>999CC99-----=@AAAAACCCCCCCC>>>>>:::<<<<==---::::<<<666.68;;;;<<<>::::>>><<<::::;;;;86=<;1./..........+//5455 @SRR005406.99 FB9GE3J10F85M5 length=311 TATTGACGTCTGGCCTAAACAAATGTTGCTCACTTCCATTCGCCGTGGCGAATCGGAAATTTTAACACATGGTGATACTGTTATGCATGTTGGCGATGTGCTCATTATTTTGACCGATGAAAAACTCGCTTACCAAGTCAAAAAAGAGATTTATCAAAAAACTTTACCGAATGATTTAGTGAATTAAAGAAAGCCGCTGAACCTGAGTTCAGCAGCTTTTCTTTTTTTCTTATGACTTGTTTTTTAATTTTTTTGAATTGTTTTTGTACCGTTTTAGATTGATTAGCGTTTTCATTTGTGCTATTATATCC +SRR005406.99 FB9GE3J10F85M5 length=311 DDDDDDDDDDDDDDDD??@B666BBBDDDDDDD@@>>EDEDEEEFDDDDDDDDDDD999DDBBBBBBDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDD>7755@@BBBDB@58888>DDDDDBBBDDDDDDBBBBBBD?DDDDDDDD<<<AAADDDD8DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<<<DDDB<<5555>6;;;;66C,,BCAAAA;;//////55+++++++558888::<:66-6:==<<<<<::6666:=666:==<:::<>>><666:<===::11 @SRR005406.100 FB9GE3J10F72OQ length=310 TATTGACTTTACTCTTACCAAATGGTGAGAATACAATTGCGGTTATGGGTGGGACAACAATGGCCATGGTGGCCGAAAATATGGGATCACTAGAAACTGAAAAACGTCATAATTTGTTTGTTCCAGCCAGAGGAGGGATTGGTGAAGCAGTTTCTGTCCAAGCCAATTCAATTAGTGCTGTAATGGCCAACAAAACGGGTGGTAACTACCGGGCGTTATATGTCCCAGAACAATTGAGTCGTGAAACGTATAATAGTTTATTACAAGAACCCTCGATTCAAGAAGTTCTTACGTTAATTAGTCATGCCAA +SRR005406.100 FB9GE3J10F72OQ length=310 FFFFFFFFFFEEEEEFFEEEEEIEEFFFFFEIEIEEEEIEFHFEIEEEEFBBBEBBBEEEEFFFFFEEEEFFE@A77;;;>EFFFFFFFFFFFBBBGFFFFFFFFEEEFEEEFFFEBBBBBBEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEB=;;;BEEEEEEEEFFGGFFFFGG?@@@@@@@@@@@@@@@@@@@@@??777??@@@@@@@@@@@@@@@@@@@@@@@???@@@@@@4444 @SRR005406.101 FB9GE3J10GDRX9 length=278 TATTGACTTGAAGCACACAATGTTTACTTCGTGAAACCGAATGAATTACAAAAACTAGAAGATGCAGTGATGAATGAAGGCAAATACGCAGTAAATCCAGCGATTGTCGGTAACTCTGCAGAAAAAATTGCTGAATTAGCAGGAATTAGCGTACCAAAAGGCACAAAAATTTTAGTCGCTGAATTAGAAGGTGCAGGTCCAGAATATCCATTATCAAGAGAAAAATTATCGCCAGTTTTAGCAATGATGAAATCAAACAATGCAGAGCATGCTTTTAG +SRR005406.101 FB9GE3J10GDRX9 length=278 DDDDDDDCCCCCDDDDDDGGGEEFFFEDDDDDDAAADDDDDCDCCCCB@55555@C:CCDDDDDDDDDDDDDDDDCCCCCD;;:DDDDDDDDAAADDDDDDDDDDDDDDDDDDDDDDDDDD;;;;;;DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCAA/////1111:DBDDDDCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@?88888880BDDDDDDDDDDDDDDDD???????????:7667=??===???===???== @SRR005406.102 FB9GE3J10GEJFW length=337 TATTGACTTATTTATGTAATTTTTAATTAATAAGCGTATTTTAGCATTTGAAAAGAGAAGTTGTACATAATATGTGAATAAAAAGATTTGTTTCTTATTTTCTAGAGTGATAGGGCGATATAAAAAAGGTTGCTATTTTTTCGTTCAAAGTGAACAAAGAATCGTTTGTTATTTAGTTGGGGTAACTAATGATTCTTGTTATAAAAAGCGCTTACAATTCGTGTGATGAGAGTAGTACGCATGTTTGTGCAAAAGTGACAAAAAAGAGAAGGTAGGGTGTTTTAATAGAAAAAAATTTTAATAAAAAGGAGAGTTTGTCGTGGAGAAAAATGTGTCT +SRR005406.102 FB9GE3J10GEJFW length=337 EEEEEEEEEEEEEEEB;::<<EEE@@11;;EDDEEEEEAAAAEEEEEEEDDDEEEEEEEEEEEDDDEEEEEEEEEDDD@555//?8???C355DDDEEEEEEEEEEEEEEEEEEEEEEEEEBBBB@@EEEEEEEE;;;;;;DEEEEEEEEEDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDDEEEEEEEEEEEEEEED=====EEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@@@@@@@@@@@@@@<<<<<;:/77===@@@@@@=555577@@@:::<<775443++877777778???@@@@@@?????=55444@@@@@?: @SRR005406.103 FB9GE3J10GGXSQ length=324 TATTGTACCAAGAAAAAATAAACCGTCAACTTTGACCAAGCACGGTTATTTTAAATAATTAACATGGTCACCGTCTTAAACGGCTCTACATCAGAGAGGTATGTTGAAGCATATCTCTCTTTTCATTTTCATTATAGCACTATTTTCCCGAAAAGTACGAATAAATTTAGCGTTAATCCGTGAAATCCTAAAAGCTGTTAAAAATGACAAGAAAAATACCGTCTACTTTGACCGGTACGGTTTATTTTTATAACTAAATTGGTCACCGTCTCGGACGGCTCTACACTAGAGAGGTGTGTTGATGCATCTCTCTCTTTTCATCTA +SRR005406.103 FB9GE3J10GGXSQ length=324 AAA<<9>@A>36//////6***<<?<9<??AA@=633<<<<?<33334////000-4;333363@BCAAAACCCCCCCCCA;;;@CCCAAAAAAACCCCCCCCCAA@@?CCCCCCCA;;5666CCCCCCCCCCCCAA><:11///////17788?A<A9::>:::444=>>>CCAAAC>?????:444ACCCCCA???A===:3<<<996///////*//;;9;<<<33387<99;;9//////,****-*--6-,,,----,-45777::555:5555:::;::::::555:;;;;:::;;;;:::77755-------47777 @SRR005406.104 FB9GE3J10GAANJ length=331 TATTGACTGCCTTTAACCATAATGCAATTGATAGCAAACATTTTGAAAAAGTCCTAGAAATTTCTTCATCAACCTTTACGCGAAAAATTGGACAATTAAACCAATGGCTCCAAAAATATCAGATTGAAATCAATTTAAAACGTACCAACGTGTTGGTGGGCAAAGAAAAAGATATCCGGATTTTCTTTATGATGCTTTTTTGGAACAATTACTCTGAAGGGGATTGGCCGTTGCAGACGATTAACTAAAAAAGAGTCCATAGTCTCTTTCGAACGTTTAAAACNTTCTGTTTCCTTCAATACAACACAAGTATTTTAACAAAAGCTTGTTA +SRR005406.104 FB9GE3J10GAANJ length=331 DDDDDDDDDDDDDDDD>>>DDFDFEEEEGGGEFEEEDDDD@@@@@55555BDDDDDDDDDBBBDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDD??>>BDDDDDDDDDDDDDDDDDDDDDDDDDD>>>DDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBB6666><DDB>BBD<<666555DDDDDDD<<<<D<<<99==>>>>>99;9CCCC@@@AA==00007.......5-::::<<==<<<<<::333336==<<<<<;!666./...55....5;;::7:77775/......./3531555<3333 @SRR005406.105 FB9GE3J10F8CXB length=288 TATTGACAAAACGATATAATCAAACGTCTTACCAGCAAAGTATTCGACCCAATCATTTTCATCAATATTGCCATAAAAGGCATCTGTTGAAAATTGACTGACATGATCATAAAGTTCTTTGTCTAATTCAACAATTGAGACCTGGCACTTTTTTTTCTTCCATCAAATAGCTAGTCATTCGCCCATTACCTGGACCAAATTCCAAGACATCACTATTTTCTTTGATTTGTGCTACGATTTTCCCAACACTGGTACTCTCGTCTGTTTCCATTTCAAAATCATACTTCA +SRR005406.105 FB9GE3J10F8CXB length=288 FEEEFFFFFFFDDAAAFFFEECCCFEEEEFHFFEGGGGIIGGGGIFFFFFFFFFFAAAAFFFFFFFFFFFFFFFAAAAEEFFFFFFFFEDDEEFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFFFFFFFA=0000000061FFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEDDDDFFFFFFFFFFDD=:::EEEEEEEEEEEEEEEEBB7777777?:;@@@@@@@@@@@@@???@@@@@@@77773111:==667::@@ @SRR005406.106 FB9GE3J10GGHX8 length=313 TATTGACGCTGTCGAGCCATCTCCTAAAATTTACTTTTTGTCAAAAGTTTACTTTTGTTCAATCGCTTGTAAAAAAGACTTTTCGTAACATGTTCGTTGCCGGTAATTTCACGGCGATGATTTGGGCTTAAATAACCCACCATGGCTTTAGGAACAAAATGCGCTTGTTTTGACTCTTTATACTGAAGTGCATAAGTATCTGCTAAAACAGTGTAATCTAAATCACCATTATCAAAAAGATTGGCTCCTGTGCCAATTTCTTTCACTACTTGAACATCAATTTCATTCAATTTTACGTGTTCTTTATCCCAAA +SRR005406.106 FB9GE3J10GGHX8 length=313 ==B====@@AACCBBBCBBBAA@=50000111-644444@1>00006111-@???=A::AACCCCCCBB=76<<62A+<0000;;4;;@@BBCCCCCCCCCCCCAA@@@AA@BA@@DDAA788BAAAACCCCCBBBB@<99B@@@@@@@B6666@CCCCCCCCCCCCCCCCCCCCCCCCCGCCCCCCCCCCCCCCCCCCCCCC;5555?BCCCCCCCCCCCCCCBBBCCCCCC33344B4CC>>><<<<<<<<<<<:::<<<<<<<<<<<<<<<<<<<<<:::<<<6666<<<<<<<8<<<<<<<<<<::111 @SRR005406.107 FB9GE3J10F9LNG length=283 TATTGACTTTCTTCACGTAGGATAGCATCTGAATCACGGACGATTTGTAATTTATCTTCTGTAATTTCACCAAGCACACGAATACCTAATCCTGGTCCTGGGAATGGTTGGCGCCAAACGATTGCATCAGGCATGCCAAGTTCAGTTCCTAAGGCACGAACTTCGTCTTTGAATAATGTATTTAAAGGTTCAATTAATTCAAATTGCATGTCTTCAGGAAGACCACCAACGTTGTGATGTGATTTAATTGTTTGCGCGGTTTCTGTACCAGATTCGATGACGT +SRR005406.107 FB9GE3J10F9LNG length=283 DDDDDDDDDDCCCCDDDDDDDDDEEEEEEEEEEEDEDFFDDDDDDCA;;;DDDDBCCDDDA9::AADDDDDDDDDDDDDDCCAAAADDCCA>>>>>77833377@CDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDDDDDDDD???CCCCDDDCCCCDDDDDDDDDDDDDDDDDDDBBAAAADDD@@888<DDDDDDDDDDDD@@::==:333:=========????==777::???????=: @SRR005406.108 FB9GE3J10GCXKV length=313 TATTGACTAGTGATATGATATTTGGGCTTTTTGCCTTATTAGGATTCCAATTTAGCCCGCGAATCGCAAATGATAAAGGAACAAAACTTTGGCGAATTGATTCTGATGCGGATTATCACGAACTTAATACACTATCACAAAATAAAATCAATTTAACACTTATTCAAACTTATTGGGAAGAAATCCTTCGGGTAGCAGGTTCCTTAAAATCAGGTAAAGTTAATGCGACAGAGTTAACAAAAGCACTTCAACGAAATGGGCAACCAACAGAGCTAGGTAAAGCTATTACTGAATATGGGAAAGTGTATAAAAA +SRR005406.108 FB9GE3J10GCXKV length=313 FFFFFFFEEEFFFFFFFFFFFFFFFGGGGGHFGGGIIGFFFFGFFFEEEEEEFDA===FFFFFFFFFFFFFFFFEDDFFFFFEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFDDAFFFFFFFFFFFFFFFFFFFFFFFFFFFFDDDDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFEEEFEEFFFBBBBEEEEEEEE@===?@@@@@@@@@@@::::@@@@@@????@@@@@@@@@@@@@===?@=:::@@@@@@>11171.... @SRR005406.109 FB9GE3J10F7503 length=283 TATTGACATCGAAGCAGCAGATAATGAAGTACAAGTACGCCGCTTTGAACGTGAAGGCGTAGAGAAATGTATTGTAAGTTTTGATAAATCAACAGAAACATTTGAATTAACAGAATCTGATACGCACCAAAGCTATCAATTCGATAACATCGATATTGTAGCAATGGAAATTTACGACTTAATTCAATAATTAATCGTCCTACATTTTAATAAGGGAGTGGAGTAGAAGCACCAAAGCTTCTGGTTCACTCTCTTCTCGTATTATCCAGTCAAGTTGTAGCAA +SRR005406.109 FB9GE3J10F7503 length=283 GGGGFFFFFFFFFFFFFFHHHHHGGHHHHHIHHHHHGHGGIIIIIFIIIFFFFFFFFFFFFFFFGGGFFFFFFFFFFFFFFFFFGCCCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBBBBFFFFFFFFFFCCCCGGFFFFFFEEFGGBEFEEEEEEEEEEEEFBGGGGGGIAAAAA@@@AAAAAAAAA@@@@@@A@@@@@@@:::?:33 @SRR005406.110 FB9GE3J10F6S8A length=53 TACCATTCGCCTCAATCGTGCTACCGCCATCGCCCGCCGCACTCTCGCTGCTA +SRR005406.110 FB9GE3J10F6S8A length=53 FFFGCCCGFFFFFFFFGGHHHHHCCCGFHHCC999=GIHHCCCHFFFFFFFFF @SRR005406.111 FB9GE3J10GCII7 length=285 TATTGACTTCGGGTCTACGACTACATACTCATTCGCCCTATTCAGACTCGCTTTCGCTGCGGCTCCGTCTCTTCGACTTAACCTCGCATGCAATCGTAACTCGCCGGTTCATTCTACAAAAGGCACGCCATCACTCATTAACGAGCTTTGACTTGTTGTAGGCACACGGTTTCAGGATCTATTTCACTCCCCTTCGGGTNCTTTTCACCTTTCCCTCACGGTACTGGTTCACTATCGGTCACTAGGGAGTATTTAGCCTTGGCGGGATCGGTCCCCGNGGATTCC +SRR005406.111 FB9GE3J10GCII7 length=285 CCCCCCCCCCCCCCCCCCIIIIIIIIIIHHIFFFEEEEGGGGGGICCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC@@@CCBB411@@@8////11-///0!888==?CCCCCCC;;759>CCCCCCCCCCCC>999>CCCCC@@BC:61/116::64....4440404....3.....!..4.... @SRR005406.112 FB9GE3J10F6MK7 length=293 TATTGACAATGGTGGTACCGTTTGGTGGTACAAGCAATTATTTTGGGACAAATCCAATCGCTTTTGCAGCACCTAGAGCAGGTCATGAACCAGTCGTGTTTGATATGGCTACGACAGTACAGGCGTGGGGGAAAATTTTAGATGCACGTTCAAGAGATGTTGAAATTCCCGACACGTGGGCAGTAGACGAAAAAGGCCAGCCAACGACTGATCCTTATGAAGTACGAGGTTTATTGCCGATTTCAGGACCAAAAGGATATGGACTAATGATGATGGTCGATGTCTTAGTCCGG +SRR005406.112 FB9GE3J10F6MK7 length=293 FFFFFFFEEEFFFFFFFFHIIGGGGHIGHHHHHHHHHEEE6666E99;A888FFFFFFFFFEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGEFEEBBBAEEEEEEEEE@@@EE??:::??@@==?@@@@@@@@:::=@@@@@@@@@@@@=7777770.... @SRR005406.113 FB9GE3J10GATOR length=304 TATTGACGAATCGTCTTTATGATATCGCAGAAGAGCGTTTGGAACACACGTACAACGAAACAGCGCGCTTTGCCTTTGCGCTTCATTTACAAAGTACGATTGAACGTGTCAAAGAAGGTCATGTGATTGTCCATCCTGATTTAAATAATGTCCGTAAAAACATGAAAAAAGAATTTCAAGTAGCCTTAGATTTATCTTCTATTATTGAAGAAGAGAACAACATAGAGATTTCCTTTCGATGAAATTGGCTTTATTAGTATTGTTTTTANCTATTAATGTCGGTAAAGAAGAAAGAACTCCAAAG +SRR005406.113 FB9GE3J10GATOR length=304 DDDDDDDDDDDDDDDDDDEEFFFFFHIGHIIIIIIIIIIIHHHHIDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDD>>>>>D8BB7777788++BBDDDDDDDDDDDDDDDDDDDDB>>>DB>>>>DDDDDDDDDDDCCCCCCCCCA::444::<444:A???@CC=777:=::;;==:777:>>>>>7!77====::1111==776955:55....//.....: @SRR005406.114 FB9GE3J10GEY7G length=329 TATTGACCGTTGTTTCTTCCAAATAATATCAGTATGAACAATGTAAAAATCAGCTTCTTCTATTATTTCATGTAGATCTAAAAAAAATTGTTTTAACTTTTCAATTGAAAAAACTTCATTATCTAAAAAAGTCTTATAACAAATATTTTCATCTGTTTGATTTTTTGGATCTATCAACTTTTTGTATTCAACAAAATGCATAGCTTTTTTTCCATCAATTGAATATTTAGTCCGAAATTGTTCCCATTTTTTCTCGAATTCTGTCTCGTAATATGTCTTTTCAAAAGTTAAACTCGTTATCGAATATTCTTCAAAAATTAAAATCGCTT +SRR005406.114 FB9GE3J10GEY7G length=329 DDDDDDDDDDC@666@==@@@@@@AADDDDDDEEEFFDDBBCD@55555@@DDDDDDDDDDDDDD;;;DDDDDHDDH>8////////>>HBBBBFCA77738>CFCA///55:CCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@@@@@@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>>>>>>>DDDDDDDDDDDDDDDDDDDDDDDDDDDD@44444711111172???????????????????=::::?7773334:??<<>????????????=9;;;956.....6600009;>?77 @SRR005406.115 FB9GE3J10F5HWQ length=294 TATTGACGCTTAGAACGCGACAAAATTGAAAATGAATATCAAGAGCTATTGATATTCATTGCGGACTTAGAGGACATTTTAGCCCGCCCAGAACGCGTCATTGAAATCATTAAAACAGAGTTAAATGACGTTCGCACAAAATTTGGTGATGCACGACGCACAGAATTATTAGTAGGTGAAGTCTTAAGTCTTGAAGATGAAGATTTAATCGAAGAAGAAGAAGTCGTGATTACGTTAACCAATAACGGCTACATTAAGCGGATGGCAAACTCCGAATTCCGGGCGCAACGCCGC +SRR005406.115 FB9GE3J10F5HWQ length=294 FFFFFFFFFFFFFFFFFFIIIGGGGHHHHIIHHHHIIIIIIIIIIFFFFFFFFFFFFFFFFGGGFGCCCFFGGGGG7777=GFFFF>>?FFFFFFFFFFFFFFFFFFFF9962227AFFF7799=FFFFGGGGFFFG====GGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGFFFFFFFFFFIIIIIIIIIIIIIIIIIIGGGGGGIIIIIAAAAAAAA8888@@@@AA@@A@@@@@@@@====??:::==??@@@@@73 @SRR005406.116 FB9GE3J10GCDCC length=55 TATTGACTACCAATCAGATGATTGTTCAAAAAGCACTTTCAGGAAAAAATTTAAG +SRR005406.116 FB9GE3J10GCDCC length=55 CAAACCCCCAAAAAACCCEEEEB877B??@@?DDDEFGGBBBE::??88CCC2-B @SRR005406.117 FB9GE3J10GGFWL length=316 TATTGACACAATCATTTCTGGTAGTAAATTTAATGTTTCACAGGCAATTTGCGTCGTAACGGTTGCCATCCCTTGACCGATACAAGCAGCACTTGTGCGGACATGTATTTTTCCTTCTTCAACAGAAATAATACAACGCCCTGTATCAGGTAGCCCCACACCCACGCCACTATTTTTAAAGAAACTAGAAATTCCAGCAACTTCCGCTTGTTCATAGACGTCTTTAACCGCTAACAAGGCTTCTTTTAACGCCGCATTTTTCGAGACCAATTGTCCATTCGGTAAAGTATCTCCTGGGGCGACGGCATTTTTAAAG +SRR005406.117 FB9GE3J10GGFWL length=316 EEEEEEEEEEEEEEAAAEEEEEEEEEEEEEEAAACEEEEEEECCCDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAAADDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDEAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDD==77@@@@@@@@@@@@@@@@@@@@@@@??=:::@???@@@@@@@@@@@@:::5545=;@@@???@@@@@@555 @SRR005406.118 FB9GE3J10GBR0C length=80 TATTGACTTCTATTAAAATATGCGAATTAGTATATTACACGTTTTCAATGTGTTTCATTGTTGATTAATTAGAATTTTAG +SRR005406.118 FB9GE3J10GBR0C length=80 CCCCCCCCCCCCBB7774=4=>DB>@@@=CCDFFGCCDDDECCC@===CCCCCCCCCCCCCCCCBBCC===B@@555556 @SRR005406.119 FB9GE3J10GF9S3 length=305 TATTGACGATTCTTTTTTACCTATCTATCCTCTGGTAGCTATGGTAGCATATTTTGATTTTCTCGAAAAGGTGCAGCCATTTTTCTTTTCGTTTTAAAAGTATTTGAATTTTCAGACAATAAATGCTATAGTCTTTTTATATTTTAAAATTTCAGAAAAGGAGCCCTATTATCTTGTCTACCTCACTCACTATTCGCTTAGTTGCCGAAGCAGATTGGCCCGCATTACATGCCTTGGACCAAATCATTTGGAACAAAAAAGATACCCCTGCCGAGATACAACCACTCTCGCTTGCGGCATATACG +SRR005406.119 FB9GE3J10GF9S3 length=305 CCCCCCCCCCCC<<<<<:C77+==DDEDEEDDEEBBBEDEDDDEDCCCCCC????<<=CCCA8?@<<<<AAA>AAA><</////:****9>??>>CCCBA@@@CA@@@CCCCCCCCCCCCCCCCCCCCBAA;;/////7-:////////---177////116<///=B>??CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC???ACCCCCCCCC9988333<<CC?>>>>>CC8833111<<?>75---44777,,,,,,4*--//2276::::::1115:5550677542------24422777 @SRR005406.120 FB9GE3J10F8VQI length=338 TATTGACTGCTAAAAGATAACTCTTAGCTACTGGCTGTTGACACTTTCGACAACGAAAGCGCTGCAGCAAAATCGAAACAACTGGAATTAATTCATAGAGATGTAGAGGCTGGTGGCAACCTTGACAGTGGGAAGGGGGCCACCACAAAGAACGCCCTACTGGTAAGCGCTCCGCCACTAAGCATAAAAAAGAACCGAAACAGGCACCAATCAAAAAGAGACTTAAGAAAAACATAGGTTACCTCCTTAAAAAATAAACTACGCTTTTTTTAAACTTTTTCGTTTGACTAGACAAATCTTTTTTTGTTAGGAATAAATAAAAGAAAACAAGAAATAGG +SRR005406.120 FB9GE3J10F8VQI length=338 EDDDFFFFFFE====AAABFFFFFFFGGGIIIIIIIGGGGGGGGGFFFFFFFFFF===AADFFFFFFF====DDFFFED;;=DFFFFAAAAAAAFFFFFFFFFFFFFFFFFFFFFFF====AAFFFFFFAAAEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD======EFFFFFFFFFFFFFFFFFFFFFFFFGGEEEEEEEE?77774;EE??>A?>>>>>9........0+++6<><96..........;33322=@>==@@@???@@?=:76.......0++0....0...0....0----0-26;<600.. @SRR005406.121 FB9GE3J10GAMWB length=273 TATTGACCGGGCGCACCCAACTTGGTATCCTGCAGGCGAAGAGGAAAGCATTGTTCGCGAGATGATTGACATGTTGCTAACAACTGGCTCGGTCAGCGTGAAAAAATTCCGTGAAGCAACTGCCATTATGATGAGTTGTAAGCGATCCATCAAAGCCAATCATTACCTCAACGAGCAACAAGCACGCGTGCTATTAAAAGATTTAGCCTTGTGCGAAAATCCGTTTAATTGTCCGCATGGACGTCCGGTGCTGATTCATTTTACGAATTCAGA +SRR005406.121 FB9GE3J10GAMWB length=273 EEEEFFFFFFEEEEFFFFB:;::::BEFFEEEEIEEEEFIHFFFHFFFFFFFBBBBEFFFFFFFFFFFFFFFFFFFFFFFEBBBEFFFFFFFFFFFFFFFIIIIIIGGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEFFFFBBBEFFFFFFFFFEB===EEFEEEEEEFFFFFFGFEEEEFFGGF@@@@@@@@@:::@7777?@@@@@@@:77 @SRR005406.122 FB9GE3J10F8GN7 length=194 ACGCGATTTCCAGCACCGACGGCTGGACAAAGACGCCGCGAAGGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAACGATGCAGGCATGGCCACCAGCATCTGCATGAGCTTGACAAACGCGCCAAAGTGCGGCGTCGTCCGCAGATTGAACTTGAGCCGCTCCGCCACCTGGACTGGATCCGA +SRR005406.122 FB9GE3J10F8GN7 length=194 FFFFGG>>>CCFFFC===HGGGFHHHHHDDDHIHHHHHIHHIHHHFFFCCCCFFFFGGGGGGGGGGGFFFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF@??GFFFGG???GFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF @SRR005406.123 FB9GE3J10GELDB length=296 TATTGACAGAAAAATTAAGCTCATTTTAATCGTGAGCGCGTACCAGAACGGGTTGTTCATGCCAAAGGTGCTGGTGCTCATGGGATTTTCAAGGTGAGCCAATCAATGGCACAATATACTAAAGCCGATTTTTTATCTGAAGTTGGCAAAGAAACACCTTTATTCGCTCGTTTTTCAACTGTAGCTGGAGAGTTAGGTTCATCAGATACATTGCGTGATCCTCGCGGTTTTGCGCTTAAATTCTATACAGACGAAGGAAATTACGACTTAGTTGGCAATAATACGCCCATTTTTTT +SRR005406.123 FB9GE3J10GELDB length=296 EEEEEEEEEEEEEE==66CEEEEEEEEAAACCGGGGGGGGIIIIIEEEEEEEEEDDDEEEEEEEEEEEEEEEEEEEEEEEEAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE@@@@@@EEEEEEEEEEEEEEEEEEEEEDDDEEEEEEEEEEEEDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDBB====DDDDDD@@@@@@@===????@@@@@@@@@@@@@@@@@@@?:::::?=766....... @SRR005406.124 FB9GE3J10F7NBJ length=290 TATTGACGTGAGGACATTGAAGCATTTGTCGAAATTCATATTGAACAAGGCAATATTTTAGAGAACGAAAAGCTCCAAGTCGGTGTTGTTCATAGTATTGTAGGGCAACGTCGCTACACGGTTAACTTAAAAGGGCAAGCCAATCATGCAGGCACTACGCCAATGAGTTACCGTCATGATGCGGTATATGGCTTTGCTAAAATTTGTGCAGAAGCCATTGATCGTGCGAACGAAATTGGGGATCCGTTAGTTTTAACATTCGGCAAAGTCATTCCGAAACCCAATACAGT +SRR005406.124 FB9GE3J10F7NBJ length=290 DDDDDDDDDDDDDDDDDDDDDDFDDDAAADDDDDDDDDEDDDDDDDDDDDDDDDDCCCCDDDDDDDDCCCAAACDDDDDDDDDDDDDAAACCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCA;999AAC@??BDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBB@<<73111:=?::::::==?===777???>77111777311==?????: @SRR005406.125 FB9GE3J10F62T5 length=246 TATTGACAGAACAGGCACATGAATTGGTTTCTAACATGTATTACGACCAAGAAATTATCTTGACAGAAGATAATCACGAAGCAACAGAGTTTATCATTTAAAACAACGAAAGAGGAGAGCTTTATGGGAACACGAACAGCAATTTTAAAGAACAAGCAGACGGAACGTATCAAGGCATATATTGTCACTGGGACGGTTATATAGAGGGCGTAGGCGCTGTTTTATATGAACATTACCAAGACCTAG +SRR005406.125 FB9GE3J10F62T5 length=246 AAAAAAAAAAAAAAA@@?ABB??????AA??6::AABB?A?????<<<????==994<<??<<<<?????A???AAA????>>>==?=:22272==2227777=22=>????8==>8;3.....,.....87:877;777........2.,,977::;>?>6666==<90000026:==88666966..----3**--658883-----*83336-,,,,,,,,*2,,,,,,,,,,,,,,,,,,,1 @SRR005406.126 FB9GE3J10GF8K4 length=314 TATTGACTAAACCTAGTCCTGCGCCTCCTCGGTTTGTTTGACGGGCAGTATCTAATCGGAAAAATTGTTCAAAAATTCGGGCTAATTTTTCTGGTGGAACAGTAGGGCCATGATTTGTAAAATAAATATTTACTCGTTGATTTTCATTATCAACTTTAGTGGAAAGAGAGATGGTTGTTCCTGCATAGCTGTAGTTAATGGCATTTTGAACTAAGTTATCAAAAACTCTTTGCATTTTATCGACATCAAGATGAATAGACAAAGCCTCAGTAAAATCTGTTTCAATAGTTAACTGTTTTTGTTTCAACATAAGG +SRR005406.126 FB9GE3J10GF8K4 length=314 EEEEEEEEDDDEAAAAAEEEEEEEEEEEEABCAAEEEEEEEEFEGEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE<<<EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDEEEEEEEEEEE@@@EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDD@DDD@@@AADDDDDDDDDDDDDDDDDDDD@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:5557:@@>;;;;996/.....6222;;;;713377 @SRR005406.127 FB9GE3J10GG48M length=301 TATTGACGTCAAAAATTAACCTGTTTTTTTCTAGCATCTGGCTTACCTCATAAAGAATTAGCGGCACAAATTGCCAGACAAGCCAACGTGTTAAATAGTGAAGAAGAATTTGCCGTAGTTTTTTGCGGCCATTGGGATTACCTTTTGAAGAAGCGGAATATTTTATGGAAGATTTCCGTCAAACAGGCGCAATTGATCGTTCAGTCTTATTTATGAACTTAGCGAATGATCCAGCCATTGAACGGATTGCAACGCCTAGAATGGCTTTGACAGCCGCTGAATATTTAGCTTATGAAAAGGG +SRR005406.127 FB9GE3J10GG48M length=301 FFFFFFFFFFDDDDD@?0088@@0000000@1EEFFFFFGGGGGIFFEEEFFFFEEEDDDFEEEFFF===EEFFFFFEEEEEFFFFAAAEFFFFFFFFFFFFFFFFFFFFFFFAAA?6000000=?AAAACAA444?FFF786666BBFFFFFFFFFFFFAAAAEDB?B?FA4446667E888EFEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFGGGFFFGGGGGFFFFFFFGGF@@@@@@@@@===@@@@@@?::::@@@@@===@@@@?::777=@A><;96....... @SRR005406.128 FB9GE3J10GGSU1 length=308 TATTGACGATACTTTAATAGAAGAAATAAAAAAAGACCAGTTCTTATGATGTCGGGTTACAAATGGCGATGAATTACTTAAGCTATCAATTACGTTCAAAGAAAGAGATTTTTACTTATTTAAAAGAGAAAGAAATTGTACCTGAAGATCGAGTAAAAATCGTTCAACGTTTAGAAGAGCTGCGGTTGTTGGATGATGCAATTTTTAGTGAAAGTTACGTACGTACAGCTATGCGAACCAGTGATAAGGGACCACGAAATGTGGCACAACAATTAAAGCAAAAAGGCATTAGTGAAGAAGATATTCAG +SRR005406.128 FB9GE3J10GGSU1 length=308 FFFFFFFFFFFFFFFFFGGIIIIIIIIFFFFFFFIIIIIIIIIGGGGFFFFFG====?FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFG???FFFFEEDDDFG4499996666GGFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBBBBBFFFFFFFFFFIIIIIIGGGIIIIIIIIIIGGGGGGGGGG@@@@A===AAAAAAA@@@AAAA@@===@@@@@@??????@@@@@@@?===?@@@@===???@@ @SRR005406.129 FB9GE3J10F7UPT length=57 TATTGACTAAGCATAAACTTTCTATTTTCATTTGCTCATGAATAAAAATAACTTTCG +SRR005406.129 FB9GE3J10F7UPT length=57 ????@?=9778::20002000:4<..2299@@@===>A?::99111112))8::662 @SRR005406.130 FB9GE3J10F9NEN length=309 TATTGACGTATATAGTGAAATTTTAAAACGTTCTGCTAAAAAGCTAAAAGATAATCGCTTCGCAGTGGTCACCATTTCTGATGTCAGAGATAAAAAAGGCTTTTATCAAGATTTAACTGGTTTGACTAAGAGAGCATTTAGCACAGAAGGCTTATATTTCTACAATGACATGATTTTGTTAAACGCAGTTGGTTCGGGTTCGCTAAGAGCTAGACGTTTGATGAACAATAGAAAAGTAACCAGAATGCACCAAAATGTATTAGTCTTTTATAAAGGAAATCCGAAAAATATTAATCAACATTTCGTAAG +SRR005406.130 FB9GE3J10F9NEN length=309 EEEFFFFFFFFFFFFFE555333311FFEB::;BFHE77000III@@@@ABEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEAAA===BBEEEEEFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEEEEEEEEEEEEEEEEEEBBAAEEEE@@@77777::@@@@>>@A=:111.0....<<777;=:711111?;@@>>???@@@:::=12110 @SRR005406.131 FB9GE3J10GCNVX length=313 TATTGACGTCTGTTTTGTCCTTTAGTAACGTGTCATACGGGATTTCTAACGCTGGATTCAATTCTGGTATTTTACCAGATTCAGCATAATAATAACGAACTTCTATTCCAAATACTTCAAGTAACAACGCAGCCATATTTGCTTCTAAAACGACTGTACGTGGTGACTTTTCAATAATCTTAGCAAAACGTTCTACGTTTGCTGGATAACCATTAAAGGTAATTTGTCGATTTCGGGTTTTCTAGTTCTAAACGAACCAAGTGCTGAACAAGATCTTCTTCACTGACAACCGCTATTTGGGCTGGATCTGGTT +SRR005406.131 FB9GE3J10GCNVX length=313 DDDDDDDDDDDDDDDDB:FFEEEEDDDDFFFFGGGGGGIIGGGGGDDDDDDDDDDDDDDDDDDDDDDBB9999BDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDD>>>DDDDDDDDDDDDDDDDDDDDD>>>>DDDDDDDDDDDDDDDDD>>>>DDDDDDDDDDDDD>>>>DDDDDDDDDDDDDDDDDDDDDBBB<<<<=933/.===?6?7003399@@6666CBCC<:::<<>>>>>33336<====:::<666::=======:::6666:::6666:>>>>==<<<===3111 @SRR005406.132 FB9GE3J10F9LYA length=127 TATTGACAACAACCGTCCATGAACGGGTTGTCTGAATATGGCTACAATCAATAGATCTGTTTTTTCATGCGCGCCACACTCCCACCGCCACCGCCGTTTAGGCGACGCCTATTGAAAAAGGTAGGCA +SRR005406.132 FB9GE3J10F9LYA length=127 AAA?@@A????????<<<?<999<7779927<=====???BBBBAAAAAA@?=><<<:8......89<<>>??AAAAAAAAAAAAAAAAAAAAAA??887779:660....378.......4,874. @SRR005406.133 FB9GE3J10F73XH length=315 TATTGACGACCCTTCTTTTCGGCTTTTTTATTAAATTCCTCGAATCGCTTCCATGCCTTTAATCGTGGTTGAGGCTGTTCGCAAACTTTGGTAAAATTTGTTTCTTCGCTTAATTGGACGATGGTCTTGTTCAATCAGATTATTCAGATACTTGATTGTTCGATGTTCTGTTGTTATATACAGTCCATTTTTCTGAAGGCACTCTTAATAGAGGGTGCTTTATCCGTTACTAGAACCTTTGGTTCTCCAAACTGGTTCTTCAGTCGTTTTAGAAAAGCATACGCAGCCTGTGTGTCGCGCTTTTTCCGTAACCAG +SRR005406.133 FB9GE3J10F73XH length=315 EEEEEEEEEEEEBB;;;A@EEDE44====@//77DEEEEEEEDEEDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE777D@A6666@@EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEBBBBBEEEEEEEEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDBBBDDDDD@@@@@:::==@@@@@@???@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@7777=@===::/44===@ @SRR005406.134 FB9GE3J10GG7KI length=294 TATTGACTTCGTAGTTAGGATTTCCCATAATTGCTGCTGATAAAGTAGATTTACCAGTTCCATTAGGTCCCATAATTGCATGGATTTCTCCAGTATTAATTGTTAAATCGACTCCTTTTAGAATCTTTTTATCTTCAATTGATACGTGTAAATTTTTGATTTCTAACACAGACATGTACAATTCCCTCCAACTTGTTTTAATCGTTTTTCCGTTTCTCACTCATTTTAGTCCTAATTGAGAATGAATCGCAAATTACAATTGCTAAAAATAAACAACTCTTATCATCAAATTTT +SRR005406.134 FB9GE3J10GG7KI length=294 CCCCCCAAACCCCCCCC?@@ACCCCCA=<<CCCCCCCCCC=666CA>AA@@@?@@<644<<<>AAB@9466<@ACCCBBBAA@@664;033AABA3333AA@33444?@ACA;;;;;;;;;;;AA99:::@3@?CCCCCCCCCCCCCCCAAA::::3333339044AACCCCCCCCCCCCC:::::>==999>>>:>8869.66/////<6/***/2>??>>>:CCC77+11<777777<>?CCC::;;;;::11/55::5555::::::+++:8;:::::555644------- @SRR005406.135 FB9GE3J10F5M3I length=307 TATTGACCGTTGTTTCATTAAAATAACGCATAATTGAAAAGTCCTTAACAAAATAGGCCACATTGTCGTAGCTATCACCATTGACACGATAAAGACTATTTGAATTTAACACACGAAAATACTCGCCATTATCTCCCAAGCCATTAATCGGATAAACAAATAACAAAATGCTTGTCACTAACCCAATCCCTAAAACGGCCAAAAGACTTGGAGAAATATAACGACTCAACCATTCAAAAGCCGAGTTCATGTGTTTTTTGATCTTTTCCATGCTTTCACCTCATCTAGAAATCATAGGCCAAAAGNG +SRR005406.135 FB9GE3J10F5M3I length=307 EEEEEEEEEEEEEEDDDEGEEGGAAACEEFFEEEDB;===ECCBEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDD@??:911111999:?=>@@=:::;<<<<<@@@=7777@@@???=:::@@@===?===@@@@@??>96666..../!6 @SRR005406.136 FB9GE3J10GGOKO length=299 TATTGACGTAATTAATGTTAGAATGGCCGCATTCCCGAAGTCAGGCTGGATTGCAACTAGAGCAATTAATACAAAAACGAGCATCAACGGTCGCCCGGCAGCTTGTTTAAATTGATCCATGCCTCCATTAATTGTCTTTTGTCGCCGTGCTAAAATATAAGACAGATACCAGACAACCATAATTTTTTAAATACTCAGCTGGTTGCATCGAAAACCCACCAATCTCAATCCAACCACGTGCGCCGTTAATTTCTTTCCCGATACCAGGAATCCGAACGGCTAAAACCNTAACCGTAATT +SRR005406.136 FB9GE3J10GGOKO length=299 DDDDDDDDDDD@@@@BDDFGDDDEEFEEEEEEEDDEEEEEGGGFFDDDDDDDDDDDDDDDDDDDDBBBBDDDBBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDD@;;;;;DDDDDDDDDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDD@:444//////20A3;?BDDDDDDDDDDDDBBBDDDDDDB15577@CCC?::::CC@;:::@@;;;::7777=========>==3337=========777777:==7777!7:===711111 @SRR005406.137 FB9GE3J10F936N length=294 TATTGACTAAAACAAAGCCGTTTTTTCTTTTTCGGCGGTTGTGTCTTTTTCTTGTAACTCGACTTCGATGAGGTGTTGGATGCATGTCTAGCAGCTCGCGAGCCTGAATTTGCGGTTGGCATAAATAGCAACTCCTTTGTTATACTTTCAAAACTTTATGAATCTAGTGTGTCTGAATATATTGTTCCACTGCGTCGAGATAAGGGATTCGCGGTGCGATTCCAAAAGATAATTCAATTCCTTCTTTCTCGATGAGTGCAAGCGGCATAGTATTTTTTTCCAGTAACTGCTTTT +SRR005406.137 FB9GE3J10F936N length=294 FFFFFFFFDDD@@777;DFE444444@/////E@@@@@@@EEFE;55555DDDDDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFDDDFFFFED;;;AADDFFFFFFFFFFFFFDDDFFFFFFFFFEEEEFFFFFFFFFFFFFDDDEFFFFFFFFFEEE<<<=::::BEEEEEEEEEEEBBBBEB==@@@@@@@@@@@@@@@@@@@<<9600.........<96666966.... @SRR005406.138 FB9GE3J10GDIYE length=268 TATTGACAGTTACTCAAATCGGAAAGTCTGAAAAATAGATCGTTTTTATTAATTTTCTTATTGAAAGAATATGCGGATTTGAAAAAATTAAACTCTTTCGACAGAGGATGCGCTAGCAATCATGCAAAACAAAGTAGAGCAACTTTATGATATGGATTATTTTTGTCTCAAGAACCGCTAGCCATAGAGGCCATTGACGAAACATTGCAGACCAAAAATTACAAGAAGCCATTGTTCTTTTTTGAACAAATTAATCCAAAGAAAAATT +SRR005406.138 FB9GE3J10GDIYE length=268 AAA?@@A?@@@898<<><99993448::8A:@@88<,<<<83.....2**00....2*-858;:<<74498=?<<<====?57::::AA+++====AA====AAAAAAA???AAAAAAAAA@@??<<<<?+++<?<???@@@AAAA;:;;===944........4*88866:9<??;67777;??>>=?>;;;AAAAAAAAAAAAAAAA?>6666=5444*2555002,,,,,,00,,,,,,,,,11,,,,,-,4553336004443. @SRR005406.139 FB9GE3J10GF4J6 length=240 TATTGACGCTATAAAGGAGTAAATTAATGAAAAAAGTAGTTATAACTAGTTCTATGTTAGCGGTTTTGTTGTCGGGATTTCTCGTTACCCCTATTTCTGCTTACGCTTTGGAACGCTCTAAGGGAACTACTGAAGAAACGGTGGCTTCAGAAACATCTCTAACGGAGCAACAAATGAGTAGCGGTGTCACTGAAGAAATGAATCCAAGCATCAATAAATTCTCAAAGAGGAAACAGAAAC +SRR005406.139 FB9GE3J10GF4J6 length=240 A???AAAA==<?>@@??;23200::4453......08*<<<<=?AAAAAAAAAAAAAAAAAAAAAA?311=?AA===????AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?776?????;;;AAAAAAAAAAAAAAA?@@>;6666000;<<;;99;;;;;63----,,,,,,,,,,,*,,,,,,,200,, @SRR005406.140 FB9GE3J10GAGU6 length=184 TATTGACTGTCGGCATAGACTTACAAGTAAATCATCTTCGCAGTGTCCATGATGGTAGCCTTACCGTGATTGCGACGCCCAATCACTCGGGAAAGACCCTTCAAGTTTGGGAAGCAAAAATTTATAACGCAGACCACCAATTGACGAGCGTGGGGCGTTGTACTTTAACAAATCGACAAAAAAA +SRR005406.140 FB9GE3J10GAGU6 length=184 AAAAAAAAAAAAAAAAAAFFFFAAAAFFAAAABBFFAAAFFFFFFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?644==?<;;;;=><?<332.778;;34........)3:;==?@AAAAAAAAAAAAAAAAAAAAAAAA812226;A?????A222AAA@?3383800 @SRR005406.141 FB9GE3J10F8SG6 length=299 TATTGACCTTTCACTAAATCTTGTAATGAATCACGGGTGATAGGATCTAAAGCACCAAAAGGTTCATCCATTAGAATAATATCTTGATTGGCAGCTAAAGCCCGCACAACGCCGATTCTTTGTTGTTGTCCCCCAGAAAGTTCATTGGGATAGCGGTCTAACATTTCTCGTGGTAACTCAACCAAATCAATCATTTTTTCGGCTATCTTATTGCGTTCTTCCACAGGTACTTTTAATAATTTAGGCACTAAAACGATATTTTCACGAATGGTCATGTGAGGCATCAAGCCGATATTTTG +SRR005406.141 FB9GE3J10F8SG6 length=299 CCDDDDDDDDDDDDDCCCAAADDAAADDDEEEFEDEEEEDDGFDDDDDDDDDDDDD666688@@@@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;;;CDDDDDDDDDDDDDDDDDD;;;DDDDDDDD>AAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@@@@@@DDDDDDDDDDDDDDC998<@DDDDD@:::?:444088===;888?@>>=11.117:6==::::?????????????????????????????=::11..6 @SRR005406.142 FB9GE3J10F85A8 length=292 TATTGACGCAAAAACAAATTGCAGAGAAAGAACAAGCAAATTTATTTTTATGTATATTAACAGCATTGTTACATGATATTGGCGATGAAAAATTTAACGAAAGTGAAGAGGCTGGCTTGCTAAAGGTGCAACAATGGTTGGAAGCAAATAACGTATCAACAGAGCAAACGAATCACATCCTTTCCATTATTGCTAATATGTCCTTTAAAGGAGGAAATACTGGGAAAACAGTTACTACATTAGAAGGAAAAGTGGTCCAGGATGCGGATCGATTAGATGCCATCGGTGCGTA +SRR005406.142 FB9GE3J10F85A8 length=292 EEEEEEEEE55555@111@@EEEEEEEEEEAACAABEEEEECDE55555@8@@DEEEEEEEEEEEEEDDDDEEEEEEEEEEEEEEEEEEEEEE==11=AEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDAAAAEEAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE===EEEEE@@:DDD@@::44777;DDDDDDDDDDDDDDD7711117===>>=??@@@???===?@@@@@@@@@????===@@7733 @SRR005406.143 FB9GE3J10GHBRG length=303 TATTGACTTGTCAAACTCCATTAAATTTGCTGACAAGGCTATCGGTTCTTCGGAATTCTGATAGAGTTTCCCAGTTGCCTCCAATACTTCTGTTAATTGATTGATGCTTTGCAACCATATCCGAAAAAGAATGATTACTGAACCACCTAGAATTACTAAGCTAATTAAATAAACGTAGTTCTCCTCAATTCCTTTGGCTAAAAGGTAGAGTGGATCTTCCATGCCCCATCTACGTAATCCAAACAAAAAATTACTAAAAAAATACAAGACTGCTGATAACGCCAATATTCCCAAACTAAAAAA +SRR005406.143 FB9GE3J10GHBRG length=303 FFFFFFFFFFFFFFFGCCCHHH999999CHHHHHGGHHHIIIIHHFFGGGFFFFFFFFFFFFFFFFFFFCCCGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCCCFFCCBBFFFFGGGFFFFFGGGFFFFFFFFFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAAAAEEB<<::EGGEGEEBBGGGGGGGG@@@@@@AA9@@99<<<<9@9@@@A@A@??===@@@@@@@@@A@@@@AB<<<72...... @SRR005406.144 FB9GE3J10F9HP1 length=307 TATTGACGATTTAGTCAAGGGTGTTTTTTATAATGGTGGTCAATACCAAGTGATTTTAGGAACTGGTATTGTGACTAAAGTGTATGATGAAATAGAAAAACTTGGAATCAATGTTGTGTCAAAAGCAGAGCAAACAGCAATTTTAAAAAATAATGAAACGGGCATGCGCAAAACAATGCGCATTTTAAGTGAAATATTCATTCCAATTGTTCCAGTAATTGCAGCAACAGGATTGTTCCTAGGGTTAAAAGGTGTTATTTTTAACGATACTTTTTTACAATTATTCGGAGCAAGTGTAGCCAATATT +SRR005406.144 FB9GE3J10F9HP1 length=307 EEEEEEEEEEEEDDDA??444;;//////;/88ECDEEEEEEEEEEEEEEEEEEEEEEDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE??//////3//FA447EEEEEEEEEEEEEEEEEEEEEEEE====EEEEEDDDEEEEEEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDD=<;:[email protected];9;6/....../699999.117===?@@@?777::====@@@ @SRR005406.145 FB9GE3J10GE79M length=231 CTCCTCCTCCTCCTCCTCCTCCCTGACCCCTTTCCCTTGCTCTTCGTCACACGACCGCACGGGGCAGATTGAGTTTACAGAGGAGGAGCAGGAGGCCATGCGACAACTGCGACGCGTCGAAGTGCTCGCGTGTGGCGTGCCTCGTGCACTCCTCACTGCTCTCGACATCATGTGCGCATTCCTGTAACGAAAACCGGACAACAGAGGGCGACTTCTCCGTCGAATCCGGAT +SRR005406.145 FB9GE3J10GE79M length=231 AAAAAAAAAAAAAAAA?==<555633....000--344<>???AAAAAAAAAAAAAB?@?????AAAA?===<AAAAAA===?????=888888<??@@AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA???????@?@????;;;??;;;?@@???>?>;;;>;6000:656:..004711----,5---1------*--833155,000,,,255522 @SRR005406.146 FB9GE3J10F83HP length=323 TATTGACGGGCACTGAGCTTTGGTGAAAAAGAAATCAGGACTATGGAACAGCAATACCAACAATTACTAGAGGACTATAATTGTGGAGAATTACTAGTTCCCAAATGGTTTTCAACTATCCAAAGCAAGGGATTGAGATTTTTAGGTTTATTTCGATAGAATAAAAATAAAAACAGGAGTTTAAGGAATGAAACTAAACGGGATTATTATGATAGCAGTTGTTGGAAGCGTTTTATCTGGCTGTGGTTGGCAAAATCGAAAGAGGAATCACAGAAAGTACAAACCGTACAAACAAACAATGTAAATACTGAAAGAAACAAGAG +SRR005406.146 FB9GE3J10F83HP length=323 DDDDDDDBBBDDDDDDDDDDGDDDDBBBBBEDDFFHHIIIIIIIIDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;;;;DDDDDDDDD;;;DDDD@@@:@AAB@://5556?DDDDDDDDDDDDDDDDC666644-----4-BBBB@BBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDC@@@CCCCCC@???5555:8@@@@==?@=:..../....68:...6..111====:::7777;:::===:757777=00073577===8:58771......6006.. @SRR005406.147 FB9GE3J10GD4ZW length=301 TATTGACTTAGAAGATATTACTGAAGGTGAATTATCAATTGGGGACAAAGTCATGAATGACGTTGCACCGAAAGATCGTGATATTGCCATGGTTTTCCAAAACTATGCGCTTTACCCGCATATGACTGTTTTTGATAACATGGCCTTTGGTTTAAACTAAGAAAATATGATAAAGCTGAAATTAAAAAACGGGTGGAAATGCTGCGGATATTCTGGGCTTAACAGAGTACTTACAGCGTAAACCTGCGGCGCTTTCTGGTGGACAACGCCAACGTGTTGCACTTGGCCGGGCAATTGTCCG +SRR005406.147 FB9GE3J10GD4ZW length=301 DDDDDDDDDDDDDDDDDDDDDB@@@BB@@@@BBDDDDDDDBB@@@@@@@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBB;888@@@@DD@@;DDDDDDDDDDDDDDDDBDFFC<4/5555@?BBBDDDDDDDDDDDDD5022249B@40000B<DDDDDDDDDDDDDD==5/////::C:333000::ABCDDDDDDDDDDDDCCCCDDFFFFFFFFFFFFDDDFFFDDDDD>?>>>>>>??>>>>>===:3337:::::=========7777::311777===:::: @SRR005406.148 FB9GE3J10GCT40 length=305 TATTGACTCATTATTGCTTTTGCGGCACAAGTTCAAAAAGTGTTTAAACGTATTATTCCAGAAGTTGTTCAAACGTTCTTAGTACCGTTTTTCGTCTTGTTGATTGCCTTACCAATTGGTTTCTTAGTAATTGGGCCAATCGTTAGCATGCTAACAGATTTATTAAGCGCTGGCTTTACAGCATTAATGAGTTTCTCACCAGCTTTGTATGGTTTGATTCTTGGTTTCTTCTGGCAAGTCTTAGTTATTTTTGGTTTACATTGGAGCGTTGTGCCATTAGCTATTATGCAAGTGACACAAGAAGG +SRR005406.148 FB9GE3J10GCT40 length=305 FFFFFFFFFFFFFFFFFBBBBEEFFFFFHHHEEI;;;;;EEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEBBBBBEEEEEFFFFFFFFFFFFFBBBBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBBBFFFFFFFFFFEEEEEEBB===EEEEFFFGGGGGFEEEB=7777777@@>@@@@@??:::@:777?@@??????@@@@@===?@@@@@@@@@==:555== @SRR005406.149 FB9GE3J10GCMWF length=328 TATTGACCGTACCTGGTAATAATTGCATTAAGAAAAACGTAAATCGTTGCGATTAACCACAAAGTGATAATCATGAAAAAGATCCGTTTAAGAAAATATTTTCCAAAACTATTCAATAATGACACCTCCGAGATTTTTTTGACTTCCTCAGTTATTTTCGTTAAAGTAATGACTAGATAGACCACAATAATAGATAGGGTGAACACATGAAAACTTTTAAATGGCCAATTATTACAGCCGTTATTTCCAGTATCGGCATTTTTCTTTACTTATTAATAAGTAAAGAACCTATCACTACCTCCTCATTATCAGATACCTTCTTTATTCG +SRR005406.149 FB9GE3J10GCMWF length=328 FFFEEEFFFFFFFFFFFFFFFFHFFFGGGHHHFFFFFHIB>>>EEFFFFFFFFFFFFFFFBBBEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEBBBBEEFFFFFFFFFFEEEFFFFFFFFBBBEFF===;===FFFFFFFFFFFFFFBBBBEBBBBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEBBGBEEEEEEEEBBBBBBEEEEB===BBB=@@@@@@@@>>97.....0...;@>>C::::=::77777=?@@@@@@@@@@@@@@@@@@@@@@@@???@@::777:@=:7777 @SRR005406.150 FB9GE3J10GAL2D length=219 TATTGACAAATCAATTGTTTTTTGTTTCTGCTGGTGACAATTGATCAATTTTTTCCTATCTGTGCTGCATGTTCTGGTTTTAGTAACGGATTATTAATACTAGGTGCCGTGGCAGCTGTCGTTGGTGTTAATAAGATAGGATACTGTTGATAAATTCGTCCATCGCTTGTGCTTGTAAAGCAATATCTGTCCAAGCCGCAGTTGTCTCTTCACTCGTTA +SRR005406.150 FB9GE3J10GAL2D length=219 ????@?>220::88822......6(**<4<<>9:88:=88::>?A@@A55::55BB+AAAAAAAAAAAA@@?897993332;7-88??????AAAAA??@??888<888???????@<888AA<<<AAAAAAAA;;;???=>?=:00066=666::::=6667;>=>?=<<>>>>;222;;>>?=?>>><;;000;<6669;:::::9663---33222 @SRR005406.151 FB9GE3J10F87JY length=303 TATTGACTTTGAAAACTACGCAAGAAATACCTAACTGAGCGGAGGGGAAGCAATGAGAAATCCAAAAGGAACGACCGATCAGCTATTTAAAAGTTTAGCTGAATACAATCCAACAACGAATGAAGCCATGTCTAAAATAGCGAAAGTCCTAGTCCCTTTAGGAATCGCTATTTTAGGCATTCTTTTTATGATTGAATTGGCGAATACCCAAAAGAAATTTCAATCAGAAGACGGTGGTTTGACAATCGAGATATTAACTAACATTGCATTGAAGTATGTGATCGCGTACGTCTGTATTATGGG +SRR005406.151 FB9GE3J10F87JY length=303 EEEEEEEEEDDDDEEDAAACEEEFEEDB===EEEEEEEEEEEE;;;;AAABBEEEEEEEEDDDEEEEEEEEEEEEEEEEEEEEEED776666@5556@EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE@@@@EEEED@@@555;;DEEEEEEEEEEEEEEEEEEEEEEEEE@665===DDDDDDDDDDDDBBBBBBBDDDDDD@@@@@@@@====@@@@=777@?=:::@@@@@@@@@@@@@@@@@@@@@@@@@@:7777? @SRR005406.152 FB9GE3J10F66X1 length=279 TATTGACGTGCCGGGAGACCTAAGTAAGCATAATTTTTGCCAGTCTTATAGTTCTTCATCTGCTTCATTTCCTCACTACGTTTCATCATTTCTTCATAGAATGTTTCAATGCAAGAAAGCAAGTCTTCTTTTCTATAGTAGACATTTGCCATCACAGAACCTAAGTCCGCAAGGTCAGCATTTTTCGGGTCAAGAATATACAGTTTTGAATCTGTATGAAGCAAGGCTTCAATCAGTGTCAGTATAAAGTAAGTTTCCGCCACCTGTACCACCAGCAAT +SRR005406.152 FB9GE3J10F66X1 length=279 DDDDDDDDDDDDDDDDDDEEGGEEDDDDDFFDDIIIGGGGGIIIIDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD??2CDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDD@@@DDDDDDA<<<ADDDD=99/.........;996../6;:96....6696/ @SRR005406.153 FB9GE3J10F8U94 length=334 TATTGACGTTGGCGGTAAAATTTTCAGCAATTTAGCAACATCTTTCATCGGTTTTTCAGTTTGTTCAGGTTGGTTAATAATTAGTTTGTTTTTGGTTTGGACTTCCGTGACTAGGTTTTGTAAAAAGTAATCATTTTCCAAGGTTATTTCATCGTCTAAACAATATTTAATGAATTGTGTCAGTTCAGTTTTTAAGTGGGCCAGTGTTTTTTCTTTTGTAAATAAGGCTTCAAATGTTGCGAAAATATCGGAAGAAAGTGTGTCTTCTTCTAACACTTCTTTGTCTAAAAGGAATCGCAATCATTGGTTGAGTCGCATCGCCAATGACGACGGG +SRR005406.153 FB9GE3J10F8U94 length=334 EEEEEEEEEEEEEDDDDE@@6;;;;BEFFFFFGGGGIIIIIIIIIEEEEEEEEEEEEEEEEEAAAEEEEEEDDDDEEEEEEEEEEEEEEEEEEEEEEEDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDEEEEEDDDEEEEEEEEEEEEEEEEDDDDDEEEEEEEEEEEEEEEEED;;;;;@@EE@<<CCCE@@555555DEEE:DDDDDDDDDDDDDDDDDDDDDDDDDDDD@@@@@@@?::::@@@@@@@@@@@@=43377:::==9996:711117722:??===@=:777777@@?????@@@@@@@@@@:5555?@@ @SRR005406.154 FB9GE3J10F7IHL length=177 TATTGACGATCAGGAGTTTTCTATGAAAAGTCTTACCGTTGAAGCAAAAAATGCTTTGTCTGATTTTGTCTATGATGTGAACCATAAGCTGATGGGCGATTTTGTTAGTATGAGTAATGATGAAATCCTGCGTTTTCAGAAGATGGAAAAGCTCTTAAGAAAATAAATCTCTCGTCG +SRR005406.154 FB9GE3J10F7IHL length=177 AAAAAAAAAAAAAAAA?=@??2?=:44448?A??A?AFAABEEAE77::77AAAAAAAAA=====AAAAAAAAAAAA???AAAAAAAAAA???>>><483333>27@????@@?@?????<811.47;:84......499992444............=777;>333?=<<<:4... @SRR005406.155 FB9GE3J10GEO1E length=286 TATTGACAATTGCTGCTTCTTCTAAGCTCCCTAAGGCTAAAGCATGACTTAAAGTGACTTTGCCAAACATCTTTGCTTGTTCTGTATAATCAACAAATTTATTAAATTCATAAAGTCCCAAAGTATCACGGGCGTGTAAATGAACATCAATTTTTTTATTAAATGTGGTAGCTAATTCAAATATTTTTGCGATTGAATGATCCACATGACGATCCACAAGGGCTGGATCAACGCCGCCGACATGAGTTGCCCCCATGCGTAAGGCTTCGCGCATCAAAGGTTCGTA +SRR005406.155 FB9GE3J10GEO1E length=286 DDDDDDDDDDDDDDDDDDDDDDDEEEEE@@@FFIGGFFGGGFFFEBBBDD;;;BDDDDDDDB????DDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD:::DDDDDDDDDDDDBB@<44///////411:::BBDDBBBDD<<<D@:555<;:::::DDDDDDDDDDDDDDDDDDDDDDDDDDDDBB@555>>CC@>>>@CCCBBBBCCC@@@@;666331116:::;<66666666:;:::1111<:::61111 @SRR005406.156 FB9GE3J10F87QH length=313 TATTGACAATTTATCGTGATTGGTGCCATAACCGTTGTTAGTTTTGCCGTATTGTTTGTCGGTTTTTTTGTGGGAATGGATAAACTTTCGACGAAAAACTAATCAGGCCTTACTAGAAGTAATAAATGATCAAGAAATGATTGCTTCACCAAACACTCAATTAGACTCCCAAGTAATTGCTAATAGTTCGCCTTTTGGGGGCGAAGTTGTGACCAATCGTTCAAAAAATATTGATGGTTACACGGTGGAGTGGAGTAATTTACGTAGCAGATATAGCTTTTTCAGAAATTCGATTGACTGGAATGAAGTCTAT +SRR005406.156 FB9GE3J10F87QH length=313 DDDDDDDDDDDDDDDDDDCCCDDDDDDD@>>EEEDDDDDEDDDEEDDDDDDDDDBBBDDDDD>>>>>:7B,>>DDDDDDDBBBBDDDD9999>DDDDD>?06BBDDDBBB8879>>DDDBBBDDDDDDDDDDDDBBBDDDDDDDDD>>>>DDDDDDDD>>>>>DDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCB888888C2@@CC>5555CCCCCC>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>:::::==:333::<<<==;<<:::::<:::<==<:6 @SRR005406.157 FB9GE3J10F5WAH length=304 TATTGACGCCAGGTGTTTCGCTAATAAAACCTGAAGGCGCCTTTTATCTATTCCCGAATGTCAAAAAAACAATTAGAAATTTGTGGGTATGATAACGTGACTAATTGGGTGGAAGATTTATTACAAGAAGCGCATGTTGCTCTGGTAACGGGAGAGGGCTTTGGTGCACCAGAACATGTGCGGATGAGCTATGCGACAGATTTAATGACGTTAGAAAAAGCGATTGAGCGAATGAACGACTTTATAGAAAAGAAACGGATTCAGCACAACGCCTAAAAGAATAAACTAAGAAATGAACGGAGAG +SRR005406.157 FB9GE3J10F5WAH length=304 FFFFFFFFFFFFFFGGGFHFFHHHC6666==GHHHFFHFHGHHIIIGFFFFFFFFFFFFFFF??FFF??G::GGFFFFFFGCCBFFFFFFFFFFFFFFFFFCBBFFFFFFGGGGFF???GFFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFF@@@GGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGFFFFFFFFFFFIIIIIIIGGGGIIGGGIIIIIIGEEEEEE@=1111:22217:@@@@@@@@@@@@@=775555=@@A@@@AAAAAA@@@@@@@@@@?77 @SRR005406.158 FB9GE3J10GDPDC length=315 TATTGACTATTTACAATTATATGGTGTGACCACACAACAATTTTTAGGTAACATCTTTAGCAAGCTATGTGGCGATTGGTATTGTGCCATTCAACCTTATTAAGGGCCTCTTAGTCAGTGGTGTTTTTCTAGTACTACATGCGAAGTTATTGCCATGGCTATCAAAAAAACAACATACTATTCAGAAAAAAACACCGTTAACAAAATAAATGATAAAAAACCTGCTGTTGAACAATGTTTGACAGTGGGTTTTTAAAATTTACGCCTAAAAGAAAAGAGGTTGTCATAATCTGTCATCATTCTGTTAAAAAATAA +SRR005406.158 FB9GE3J10GDPDC length=315 FFFFFFFFFFFFFEEE==;EFEBBBFFE===FFFFFFFEE77777;880DDCCDD8;;CDDFFFFFFFFFFFFEDDDFFFFFFFFFFFFFFFEEEEFEDAAAAFFFAAADFFFFFFFFFFFFAAAAAAEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAAAAAA?F66EEEEFFFEEEFF=======FFFFFAAAAEAAAAFFFFFFFF@@@@::::BEEEEEEEEEFFFEB:::EEEEE@?::111......666699..0.177=////=;@@@@@@@@@@@@@@@@@@@@@@@@???@======:// @SRR005406.159 FB9GE3J10GGLRL length=281 TATTGACGTAAACTTGGACGCTCCATGACAGCTTTAGGTGCTGGCTCTGCCATTGCCAGTGCTACAGGAAAACAAGGACAGTCGGGTAGTTCTGGTAGGACACAAGCAGATCACACCCGTCCAGACGGACAGGAAAAATCAACACTTGGAAAACGTATCGGACAAACAATCGGAGCAGTTGCTGATACCAAAGATAAAATCGTTGATTCTGCTGGTAATCTCAAAGAACAGGTTAAGGATATTCCGACCAATGCAAGATATGCAGTGTATCAAGGAAAATA +SRR005406.159 FB9GE3J10GGLRL length=281 FFFFFFFFFEEEFEEEEFFFFFFFFFGHHHHHIIIHBBBEEHGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFEBBBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF======BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGIGGGGFFFFEEEFFFFFFFFFFFFEE@@@@@@@@@@@@@@@@@@@@@@@@7711111...96 @SRR005406.160 FB9GE3J10F7XFC length=307 TATTGACAAATGGAAATTATGAAGCATTTGCTCGACCAAGAAAACCAAAAGGTGTAGATGACAAGAGTGCCTACATCGTTGGTGGTGGCCTAGCAGGTTTAGCAACGGCTGTTTTCTTAATTCGTGACGGTCAAATGAAGGGCGAAAATATTCACATTTTTTGAAGAACTTACGCTGTCTGGCGGTTCTTTAGATGGTAAATTTATTCCCCATGATGGCTTTGTCACTCGCGGCGGACGCGAAATGGAAAACCATTTCGAGTGTTTGTGGGATCTATTTCGTTCGGTACCATCATTAGAAGTAGAAG +SRR005406.160 FB9GE3J10F7XFC length=307 DAAAADEEEEEEEEEEAAAECCCEEEEEEEEEEHHEEA@@@@@=CA0006::DDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDEEEEEEEEEEFEED///555@EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEA@@=<<858@DDDDDDDDDDDDDDDDDDB====7777;?@@@@@@@@@?7323337>?=;99=73223333:@@@@@@@@@@@@@@@@@@@ @SRR005406.161 FB9GE3J10GGF9Y length=244 TATTGACTCGTTTGATTCTTTGGCCCCATTACCGTTACCACAAGCCCCCAATGCGAAAATAGCTGCGGTTGCTAACACTGTTGTTGCTAGAGTTTTGAACTTCATTTTTTTCTCTCCCTTAAAAAATTTATAAAACAATTTGCTCGCCACGTTCTGGCAATATTCTTTCACCATACGGGTTTTCCAGTTTTTCTGGTTTTAACGTATGGATTGGAACCAATTACTTGAGGTTCAATCAATGCAA +SRR005406.161 FB9GE3J10GGF9Y length=244 AAAAAAAAAAAAA?@???<<<:93333::=?AA?<<<==?=?<932444<<====<<??A:AAAAAAAAAAAAAAAAA???AAA??@????<3332:;:<<966.......8*3...............(0....4/2:::;>@?AAAAAAAAAA?????;666;222=??;;;??;;;???????A@@@@8<,;;@@@@AAA;2;;;6600----,,00,,,2,,,,222240,,25555522 @SRR005406.162 FB9GE3J10F6PGW length=312 TATTGACAACGGTCAGATCCCCTTTTTCGTTTTGATTTAGGGCCTTGACTATTTATTTTAGTCGTAGCTGATTGCCCAGCTTCATAACTAGTTGAAATTCCGTCATCTTCATACATATTAAAAAGAAAGTGGTGCCATTTGGATAAATCAAGAAAGATCGTTGATCTCGTTGGATTTCCTTTGGATTGTTGTTTGGATTCGTCATTGGGATAATACTGCCATCTTTGACGAAAACGGGCACCTTCCACAGCGGTGTTTTTACTCCATTTAAGACACGGCCACCTTGATATTTTTCGCCTGTAAATAAGTCAA +SRR005406.162 FB9GE3J10F6PGW length=312 DDDDDDDDDDDDDDDDD@5511666///8----88?AAADDDCCCBDDDDDBB@A55558>9>BDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@@@@@@@DDDDDDDDDDFDCBA:44/////4---:@BBBDDDD???BBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCC@@@BCCCCCCCC@@@@CCCCCC@@@@@:?@>??>>>>>>>>>>>=>>>>>>>>?>>>>??=========1111111::::8877==700/6:.. @SRR005406.163 FB9GE3J10GG2XA length=302 TATTGACTTCTTCATATTTGTCTTGTAAGCCTTGCTCCGTTAATTGACTTAATAAGTTTGATAACATACCACCAGGTACTTGATAAATCAAGGTTTTCGGTTCCGTATCTTTAACTTTAGGGTTTAAAATGCCTTCACTTCTAAAGCGATCACGAATCGGATTGAAATAGTCAGCAATCTCTGTTACTTTTTCCATATTTAAACCTGTTTCAAAGCCTAAATCTTCTAACGCGATGGCTACAGATTCTGTGGCTGGTTGACTCGTACCGCCAGCGAAAGAAGAGATAGCTGTATCGATGATA +SRR005406.163 FB9GE3J10GG2XA length=302 FFFFFFFFFFFFFFFFFFGGGGGGGIIIIIIGGGGGGGGFFFFFFFFFEEEDDDDFFFFFFFFFFFFFFFFFFFFFFFFFFFFD===FFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFFFFAA====DDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE==;;;AAFFFDDDFFFFFD@;;;;ADDEEEEEEEEEFFFFEEEEEEEEBBBBEEEEEE?@@::::@@@@777:=???@@@=::::=:7111:9=?:::???@@@@@@@@@@??77 @SRR005406.164 FB9GE3J10F73FH length=306 TATTGACTTTTAAAGATGTCCCTACAACAGTATTAGAAATAAATATAAAAGATGATTGTATAACTTGTATTGATTTTGAAGATAAAAAAACTAATGGATATTTTTAATAAACTAAGAGAAAAAATATATGATCGAATTTATTACAATTATCAGATGTCTGTTAAAGATAGTGGTAGTAAGAAGAGAGCAAATTTAGATGGGTTGTTCATAGAGTACTTAGTTCAATATAAATATAATAACCAAATAGACGCTGTTATGGGATTGAGCTATACTCCTTCATATAATAAACAGAGAAGTATTTCTTAA +SRR005406.164 FB9GE3J10F73FH length=306 FFFFFFFDDDDEEAAAAFFEFFFGFFGGGGGFFFFFFFFFBBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDDDFFD5000000C8--CAACFF88888A?4666DDDDDFF>?BBD?A5DEFFFFFFFFFFFFDDDFFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFF===AFFFFFFFFDDDFFFFFFFFFFEEEFFFFFGGGGEEEGFFFFFFEEFBBBE@@???@@@@@@@@@@@:::=@@@@@@@@@@@@@@@=777=777==@=::7767...;.... @SRR005406.165 FB9GE3J10F7EQV length=330 TATTGACAAAACGGAAGCTTTACAACGGAGCCTTACGAACAGATTTATTCCAATACTGGGGAACACGTCCACCAAGAAAACCACGGGAAGACTAAGAAAGCTGGTGTAAAAAATGAAGGAAGCTGTATTTTTACAAGAAGTGAAAGAAATTCAATTACTAAAAAATGCCTTGACATTATTAGACTGGGATTCATCAACTGGGATGCCAGAAAAAGTAGTCCTTTTCGAGGAGAAGTAGAAGGGTATTTAACCGGATTATATTTTGAACGAAGTATTGGCCCAGTTATTCAAGAAGCATTGGCCTATTTTGAGACACGCCCTGAAGAATTA +SRR005406.165 FB9GE3J10F7EQV length=330 DDDDDDDDDDDDDD::>BDDEDDDDDDDDDDDDDFEEEEEDEDDDDDBBBBBBDDDD??????BBDDDDDDDDDDD>>>>DDDDDBBBBBDDDDDDDDDDDDDDDDD777777BBBBDDDDDDDDDDDDDDDDDDDDDDDDD>>>D===DDDDDDDDD<555566BBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDD1>>9955339=AAAA====?=;0000000.........48::7736666::::::;;;;;666666<<::666:=========<<66666=<<;<<<666::../585...... @SRR005406.166 FB9GE3J10GGXN5 length=320 TATTGACAGTTTTAATTGGTGGTCAGAAATTTATTTGGAAACGAGTAGAACGTGATCAAGAATTAATCGATGTACTGACCGAGCAATTAGTTAATTTTTGGGAAAACAACGTAATCAAAAGCATTGAACCTATTATTGACGGAAGTAAGGCAACAGCTGACTTTTTAAAGGATAAGTATAGCGACATAGAAGAAACGCAAACCACTTTACCTGCTTCATTCGATGAATTGATAGATACAAAAAAATGAAATGAAGAAAAACCAAAAAAGAGTTGGATGTAGCTATTAAGAAAAATTAGAAAATAGAAAATAAAAAGCGAA +SRR005406.166 FB9GE3J10GGXN5 length=320 DDDDDDDDDDDDD@@2299DDDDDDDDDDD666BBB96666@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@@@@DDDDD@;;;;;;DDDDDDDDDD;;;;@DDDDDDDDDDDDDDDDDBBBDBBBBDDDDDDDDDDDDDDD88888888BBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDB>>>BDDDDCCCCCCCC@@@BB???===?=?///////66...666.........333330=2===::777:========7777:77770======8:777772662077... @SRR005406.167 FB9GE3J10F7K75 length=289 TATTGACCAACTTCAAAATGAACAGCTAAAACATACCATTCATCTTCTGATAACTGACCAATTGCTTCTGTTGTTTCTTGTGCAATTTTCAACGTTTCTGGTGTTAGTTCCGTAAATAACGTCCGATCAACACCAGATAATGTCGTTCCTTCTCTTGAACGATTCAGCATCTCATTGAGATGGTTAATCAAAATCGTCCACTGTAATTCCGTTGGTTCAATTTTTGCTTCTGCTAATCGCGCACTGGTTTGTTTGATAATCGATTGTAGTCTTTTCTGGTTCAGCTACG +SRR005406.167 FB9GE3J10F7K75 length=289 CCCCCCAA===CCCAAAABBBBBBD>>555554EDEEDEECC@@?CCCCAA@CCCCAAACCCCBAAA@====CCCCCDDCCCCCCCCCCCCCCCCCCCICCCCCCCCCCCCCCAAACCDCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC@@@CCCCCCCCCCCCCCCCCC@@@BBDD@<<<4444:?B???BBF?:4111<<800110//69/////9@@@@@@@@>>>@C99999966:423...3:6666::::<<<<<<<<<:66/<<<<<:661111 @SRR005406.168 FB9GE3J10F9KNW length=304 TATTGACGGAAAATACTTTCTTTATTAGGTGCGATGGCTAATGCTTTAGCAGAACGTGGATTTACTACGACAATTGTTCATTTTCCAACATTTACAGTAGAAATGAAACAAGCCATTGGTCGCGATCAAGTTGGTGAAAAGCTCGATGCAGTAAAAAAATCCCCTNTATTAATGATTGATGACATTGGTGCGGAATCCATGACTAGTTGGATTCGTGACGACGTTTTTAAGCGTAATCTTGCAATACCGAATGCAAGAACAATTTAGTTTACTTTTTTCTCTTCCAATCTAGAATTTAAAAAGT +SRR005406.168 FB9GE3J10F9KNW length=304 DDDDDDDDDDDB07.>11180008=@B558BDDDDDDDDDDDDEEDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDA>>DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD==>BDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDFEEB<4///////::BB:A!DD>>>>BDDDDDDDDDDDDDDDDDD====DDDDDDDDDDDDDDDDDD<<<=====70////333ACACACCDDDDD;;;:>>>===<6333.36:975545//../......7+.....:://.5/........../. @SRR005406.169 FB9GE3J10GBCML length=310 TATTGACGAACGTCCATAATTCATACGTACGACCTGTTTTAATTTTTTTCTTTTAGGATTGCCAAACTGGCGGATAAAGATTTCCACATCTTTCCCTATGTATGCTGCGTAGCCAGAAGCTGGCAATTCTTCATGAGGAACAGCGGTGTGAGCGCTGGATAAGCGCCCACTTTGAGCTGTTTCGGTTGGTTTTTCAGCAGGGAAAAAAACTGGCTCTAAATATCCAATGAGTAGAACTGTTAAAAAAACAGCAGTAAAGGCCCAAAATCGCTTCATTTTTTCCCCTCTCATCTTATTTTTCTTTCACTTA +SRR005406.169 FB9GE3J10GBCML length=310 DDDDDDDDDDDDDDDDDDEEEEDEDEEDDDDDDDAB0000??///////8,388FBBBDDDDDB@@@DDBB@@@DDDDDDDDDBBBBDBBBBBBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD???DDDDDDDDDDDDDD==5555/:?BCCC00///////:?CCBDDCCCCCIDDD@@@BCCCDDDDBBBDF>>>>;99?3>>>??===77333777368::86./........../2:::871117::22:00,711177 @SRR005406.170 FB9GE3J10F8X3O length=211 TATTGACAAAGCAGATAAAAACGGTAACAGTTGGCAGTGTTTCTCTACATGATAAAGATATTCCGTTACAAACAAAAATTTATTATGAAGTGAAATCTTCCGAACGTCCAGCCAACTATGGCGGAATCACAGAAGAATGGGGCATGAATGATGTCTTGGACACGACCCATGATTCGTTTCACAAGGAAATGGCACGCTATTACGAACTATG +SRR005406.170 FB9GE3J10F8X3O length=211 AAAAAAA==<@@@B??77777??:3))27><<::>?=:88<<>:?AAAAAAAAAAAA:<<???9910200009,,,,,000)0094022===>?<<<<????>>==>==8666111;==;665<<<<<??AAAAAAAAAAA?AAAAAAAAAAAA??????AA?A??@;=<00004.....43......233666333-----3333881-- @SRR005406.171 FB9GE3J10GBX0E length=297 TATTGACAAACCATGAACCACCAAACAAATAACGATGGCTGTCAAAGCACCCATGGCATCCAACATAACATCTTGAAAAAGAGGGGGTCCTTCCGCCTGTGATCATTTGATGAAATTCATCTAAACCTGCATAGCCAGTAGCAGCTAGCCAGGAAACAACAGCTGTTAAAAACAGGCCTTTGATTCTTGGCACTAATCCAATGAACCAACTACCACCTAATAGAAAATACGTACCAAAATGGGCTCCCTTACGAAATAAAAAATTCAACAAATTTACTATAACCACTAGCTTGAATG +SRR005406.171 FB9GE3J10GBX0E length=297 @@<<66611144@<64444@AD===@BBB@99@@@CCCCCDDEEECCCCCCCCCCCCCCCCCCCCCCDDB@@@<</////<,/////@ADDDDBA@@ACCCCCCCAAACCCCCCCCCCCCCCCCCC@@ACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC@@@@==FF?C3@@CCCCCCCCCCCCCCCCC;;;CCCCCCC??????CCCCCCCCCCCCCCCCCCCBCCCCCCCCBB>999>@<::779............7344434::<<<<<36111<<<<:1116:::<66 @SRR005406.172 FB9GE3J10GA1RN length=110 TATTGACGGTTGCTGCATATCAGTACCAACCGTAAAAGTAAATTCCACATTCGTAGCTACGCCCCAGTCTCCCTGTTTGTTCATGGCCACCAGTGAAAAAGCTCCTGCTT +SRR005406.172 FB9GE3J10GA1RN length=110 <?=???@??998::AAA@????BBAAA????BE??????11.<<=<===99998>=>><<<<<????@@?????@????>>A@?==<<=====;9.....06;0006... @SRR005406.173 FB9GE3J10GACWJ length=306 TATTGACGGGCATGTTAAAAGGGCCAGGAATTTATAACCCAATTGATTACATTGACAATGCCACAGCGCGACGGAATACCGTTTTACAACTAATGGTCGACAATAAAAAACTATCTCAAGAAGAAGCCAATCAAGAAGCGAGTGTTAACTTAGCGAGTTTATTAAATGACACCTATGTTGGCGACGAAAATAGTTACAAATATCCATATTATTTTGATGCGGTAATTGATGAAGCGGTCAATCGTTATAAATTTAAAGAAGAAGATATTTTAAATAAAGGCTACAAGATTTACACTTCTTTAAATC +SRR005406.173 FB9GE3J10GACWJ length=306 DDDDDDDDDDDDDDDDDDDDD@@??B55552228@BB222DDDCCBDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDD@@@BDDDAAAAAACB3DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;;;9>DDDDDD>>>BBDDDDDDDDDDDDDDB@@@CCCCCBBBBCCBBB@@@BCCCCCCA====7711....85564467777===:77155>?????>>>>>>??>>==7777>====57 @SRR005406.174 FB9GE3J10F67J0 length=295 TATTGACAATCGTTGTGGAATTAATGGGAACCATTGAACCAGCTAAAACCTATATCATGAAAGCTTTAGAAAAAGGCAAACATATTGTGACTGCCAATAAAGATTTACTGGCGCAACATGGGAGTGAATTAGTAGCGTTAGCCCAAAAACATCATTGTGATTTATATTACGAAGCAAGTGTTGCTGGCGGGATTCCAATTTTAAGAACAATTGCTAATAGCTTAGCGGCAGACAATATTCAACAAGTTTTAGGGATTGTGAACGGTACGACGAATTATATGCTTACGCAAATTGG +SRR005406.174 FB9GE3J10F67J0 length=295 FEEEFFFFFFFFDAAAEE@@@@EEE4448888EEEEEEFFFFFGFFFFFEEEEEFFFFFFFFFFDAADFFFFFFAAAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDDDFFFFFFFFFFFFFFFFFFFFF=====AEFFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFFFFFFDDDFEEEEDD777;AAFDDDFFFFFFFFFGGFIBBBFGGGGGGGFFFIEEBEEEEEE@::::@@@@@@@@@@@@=:::@=====@@@@@@@@?:777:@@@@@==== @SRR005406.175 FB9GE3J10GDQ05 length=246 AACCAGCATACGAATGCTTAAATCAAGCATATTGCGAAATCAAAAACCGCCAAGGGAAAATGGTAAACGGAGTATTCGTCAAAGAAGCCGATTTGTAAGGCTCGAGGTGGAAGAGATGCGAATTATTCTACCGATTGAACCAAAACCACAAAGTCGCCCAAGATTTGCTAGACGTGGGAATTATGTTCAAACCTACGAAGATAGCGCTATGAGAGCCTAATAAAACAAAAAGGTAAAAGCGTATCT +SRR005406.175 FB9GE3J10GDQ05 length=246 AA?===@AAAAAAAAAAAIIIIIFIIIIIEAAAAA>>>><8.....00:88::<>>88889=?AAAAAAAAAAAAAAAAA===?=AAAAAAAAAAAAAAAAAAA?==<<<<<<AAAAAAAAAAAAAAA??8333777766677;;==5?;;;?AA????@@AA222;A@@A?AAAA;;;;AAAAAAAA?<<<<<AAAAAAA;;;;;;<:::;600-,,,,,,11,,*****222)))),,2222,, @SRR005406.176 FB9GE3J10F5HKZ length=295 TATTGACCCAGACCGTTTTTGGTCTCGGTAGCTCAGTTGGTAGAGCAATGGATTGAAGCTCCATGTGTCGGCAGTTCGATTCTGTCCCGCGCCATCCAAGAAAAATTTGCGGGTGTAGTTTAGTGGTAAAACCACAGCCTTCCAAGCTGTTGTCGCGAGTTCGATTCTCGTCACCCGCTTTTTTCTTATTTGGGGCCTATAGCTCAGCTGGTTAGAGCGCACGCCTGATAAGCGTGAGGTCGATGGTTCGAGTCCATTTAGGCCCATTTTATTTCTTGGGGAAGTACTCAAGTGG +SRR005406.176 FB9GE3J10F5HKZ length=295 DDDDDDDDDCCCDDDDDDAA;;0;DDFFDDDDEGGGGGGEEFEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCDDAAADDDDDDDDDDDDDDDDDDDDDDDDCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDBBD;;DDDD>>>>DDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDAAADDDDDBBBDDDBB===???????????===:::=11..92426........-/.69666;;>> @SRR005406.177 FB9GE3J10GB0RQ length=274 TATTGACGAACACAAAGACCACAACCTGTACAGTCTTCTAAAGAAACTTGGATACGATACATCAACCCATCTGTGCCACGCATTTCGCGCATGGCAAAACCTGCAGGTGCTTCTTTCAGTTCTTCTTCATCCGCTAAAAATGGTCGAATAGCCGCATGTGGACAAACAAAGGCACATTCATTACACATCGTACACTTATCCATTTGCCACTCAGGCACTTCTAACGCAATGCCTACGTTTTTCATAAGCCGCAGTGCCCATAGGATGGCACCCG +SRR005406.177 FB9GE3J10GB0RQ length=274 DDDDDDDDDDDDDDDDDAAAEEFGEEGGGFGGFEDDDDDDEDD>>;DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDC@666677DDDDDDDDDDDDDDDDDDDDCCCCDDDDDDDDDD;;;;;DDDDDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDDDDDDDDDDDDDDDAAADDDDDDDD@?40008>/////0?D===>???????:::>>=1../.666...6 @SRR005406.178 FB9GE3J10F6EL0 length=307 TATTGACATTCTTTTTTTGTACTGGTGATGATGAATCGTGGATGAATAATTCAGAAATCGTGGAAGAGGTCCAGAGATTATCAAAACAACTGAATTCTAATCTTATAAACGATAAGCGACCACTACCAAAAATAGATCCCGATAAGCTAACGAAAGAAGAATACCAGCGCTTATTAGACTTAGGTTATCAAGTAAACGATATTAAGAAAGCTCTCGGACTGGGAACAACCACATTTCAAACTGGCGAAAGGCAAATGGCATAGAAAACATAATTAAGCGAAAAGAAAATAACAAAGTAGAGGAGAAA +SRR005406.178 FB9GE3J10F6EL0 length=307 DDDDDDDDCCC;;;;;;;D6FEEEGGGGGGGGGGGFFEEEDDDDDDDDDCCCDDAAADDDDDDDCCCDDDDDDDDDDDDDDDDDDDDAAADDCCCCDCCCDDDDDDDDDDDDDDDDDDDDDDDDDDD>::::@4BB?66:CDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDDDDDDDDDDDDDDD??>CCDCCCDDDDDDDDDDDDDDDDDDCC?@<<<<@@@DDDDDDDDD@::4444:???=:::???????>===?:7111176>>>====???7777=>>>>?>>???????::::??777 @SRR005406.179 FB9GE3J10GARFQ length=291 TATTGACAAGAAACTGGCAAAGAAAGTCCCACTAATTGGTTCATTTCTTCAATTAATTGATTAAGGGAAATGGCAACTTCGGTACCCACATTATAAACATGTCCCAACGCTTCACTTTTGGTTGCTACTAAATTTAATGCAGTTAGGACATCCTCAATGTAGATAAAGTCACGTGTTTGCTGACCATCTCCAAATATTTGAAATTGGCTCGCTTGCCCTTGCTCTAATTGGATATAACGATCCATCAAAATGGACAGGACACCAGAATAGGGTGAAAGAAGGTATTTTTGA +SRR005406.179 FB9GE3J10GARFQ length=291 DDDDDDDDDD>>>DDDDDDEEEEEEEEEEEEEEDEEDDDDDDDDDDB;;>DD6655>>BDBB>>???>>>DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>>>DDDDDDDDDDDDDDDDDDDDB><<<<<DDDDBB999DDDDDDDDDDBB955BBCC>>>>>>>CCCBB>>>BBBBBCCC>>>>>>>>>>>>>=<:666:;;:97754/......../4.....// @SRR005406.180 FB9GE3J10GGK7T length=93 TATTGACAATTGTCGAGATAAGACATCATTTTTAGTCTTATTAAACCCGACGCCTTTACCGACAGCTACTTTCTCCTGTCCTTCGTCAAGAAC +SRR005406.180 FB9GE3J10GGK7T length=93 AAAAAAAAAAAAAAAAAAFAAFAFAFEB:::::?B2BAACAAAIIAAAAAAAAAAAAAAAAAAAAAAAAAA??>AA?@?<;::7600000000 @SRR005406.181 FB9GE3J10GG0XK length=306 TATTGACACTAAGCGCCTGATTAATTTGTAAAGCCAATGCTTTAATCTCCACAATTTCAGCAGGAGTGGCTACTTTTAGAAATTGAATATGGTCTTCGTTAATAAAAGGATCATCCAGACGATCTTCTTTGTAATAAAATTCAATAATGGGCGTCACTAATTTAGTGCCCTCTTCAATCGCTAAACGCTTTGAAAAACTTCCTGCCGCATAATTACGTACGACAACTTCCAAAGGAATCATTTCTACGGCCTGAATTAATTGTTCGTGTTCAGATTACTTTTTTGATAAAATGNTTGGGAATCTTT +SRR005406.181 FB9GE3J10GG0XK length=306 CCCCCCCCCC@@AACCCBBEBB==33362@@B=@@CDEEEEEEEEABBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCA@====CCBCCCCCCCCCCCCCCCCCCCCCGCCCCCCCCCCCCCCCC@@@CCCCCCCCCCCCCCGCCCCCGCCCCCCCCCCCCCCCCCCB@44444;CCBBBCCCCCCCCCCCCCB999>@>333<@@@@@@9922<<9996624...338666:::<66666<<<<:::<661.....11..44466::11!..433444.... @SRR005406.182 FB9GE3J10GG2HY length=294 TATTGACAAAGCTAATAAAATTTACGTTTGGCTTTCCGTTTAAAAGTCGTTTCGTCAGTTAAAATCTGTTGTTTTACCAATTGCTGAGTCAATGTTGAACCACCAGAAGAACCGCCGATACCTGTCGCATCAGAAATCAACGCTCGAACTAGCGCTTTTGGTACCACCCCATGATGTTCTTCAAAATATTCATCTTCTGTTGAAATAATGGCTTTTTTAGCAATGGAGACATTTGATCGCCATTAATTCGTGTCCGAATTAAATCTGATTTGATGTTAGCAATCGGAGTACCAT +SRR005406.182 FB9GE3J10GG2HY length=294 DDDDDDD522>>BC>80000222/8800055?BDDDBB7;;DEED@=@@DDDDDBBBBBB@@@@BBDBBBDDDDDDCCBGDDDDDDDDDDDDDDDDDDDDDBBBDDDDB@@@@DBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;;;;DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>>B:33//////0;????ACCCCCCCCCCCCBBBBBCCB===??>>===777>>>>>>>>===>>>>>>=====777:>========= @SRR005406.183 FB9GE3J10F5TMD length=319 TATTGACGGAGTTAAACGCTTCTGTCCCGACCTCATCTTTTTATTTTGCTTGTCGTTCTTTGATTTTCGTGAGTAAAGATTGAACATGCTGGCGTGCCGAAGCTTCATCTTCTTGAAGCATCTTTCCGATAAAATAAAGGAGCCGCCCACTGCTAATACTTCTTTTGCTTCCACATACTCTATAAAGTTTGTTTCATCAATCCCACCAGTTGGTAAAAATTGAACATCAATAAAACGGGCCACTTAAACTTTTGATGGCTTTAACCCGCCGTAAATATCGGCTAGGGAAAAATTTAACCACTCGTAAGCCATACGCCAG +SRR005406.183 FB9GE3J10F5TMD length=319 CCCCCCCCCCBBBCCCCCEEEEEEEEEEEE:>@GFEEFFFFAE0000CCCCCCCCCCCBAAAACCCCCCBCCCCCCCCDCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCA=77777CCCCCCCCCCCCCCC@@@CCCCGCCCCCCCBB@@<6666@@CCCCCCCCCCCCBB@<<<@@@?4000;BBBBBBBCCB445;;;;;?=F>>>CCC<<9966//////////6//////..47....998......44...4226:<<<6366<:::<:11111..334,,4466666:666:::::::6666 @SRR005406.184 FB9GE3J10F68CM length=306 TATTGACAATCGAATTAATAATTCGCGAAGATGGTTCAGTCACGATAGATGGGGAAAAAGTAGCAGATGTTTTAATTTCTGGAGAGAAGAATAATCAAATTACTTTAGATGTTACTAACCAAGCAAAGGTTCCTTTACCTGAAACTGGTGGCATAGGACGCTTGTGGTTTTACTTGATAGCGATTAGTACATTCGTGATAGCGGGTGTTTATCTCTTTATTAGACGACCAGAAGGGAGTGTGTAATCAATGAAAAACGCACGTTGGTTAAGTATTTGCGTCATGCTACTCGCTTCTTTTCGGGTTT +SRR005406.184 FB9GE3J10F68CM length=306 DDDDDDDDDDDBBBDDDDDDDBBCEDDEDDEEEEFGGGFFEEEEFDDDDD555555///5?0DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDBBBDDDDDDDDDBBBDDDDDDDDDDDDDBBBBDDDDB<555B<<<<BDDDDDDDDDDDDDDD>>9966DDDDDDDDDDDDDDDDDDDDDDDDBBBDDDD<666BBBBDDDDDDCCCGGC>;99=AA@93333336AA@=777:;<;::111116:<<<<666666=====3333:============:631116<;:.../+- @SRR005406.185 FB9GE3J10F7ANZ length=282 TATTGACTACTGCCTGATTTTCTTGACGTTACTCCACCAACCCATTGCTCTTTCGATGTGATTGTTGTAAATGCTGAAACTTCATCTGCCAAAGAAATGGTATCTACCGTTGTTCCTGGTAGTCGATAGGGATCTACAGTTGGCCAATAGCTGGAATTAAATTGAACCTCGTCATCATTATATACGTACATCATTCCGTCACCAGTGTGCCAGCCACGTTTATTTTCTTTATTCCCTGCTTCAAAAGATGCAGTGCACTTTGAATACAAGCCTAGCCCAAAA +SRR005406.185 FB9GE3J10F7ANZ length=282 FFFFFFFFFFFFFFFFFFFFECBBCEEEFFBBBFFFFFFFFFFBCAEEEFEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEFFFFFFFFFFFFFFFFFFFFEEEEEFFFFFFFFFFF;444448888D<<8;;;;;;BEEBAB779474?@@@@@???@@@@@@@@@??=====@@?::111. @SRR005406.186 FB9GE3J10GDCJK length=283 TATTGACTTGCCTTCAACGACACCTGAAAAAGAGCCACCATATGTCCAGCGAGCAATGGTATTATTTAAAACAGTCTTAGTATCTCCTTTTATATAGATATCCCAAGTATCATTACTAGCAGGATAGCCGCCGCCACCAACAATATCCCAACCTGAACTATACCCACGACTTTTATCGGTCGTTGAATAATCTAAGCTTGTCGGTTTTGCGCCTGAATAAGCCATACCATCGCCACCTAAGGACCCATCACCATTCGCTGTTCCCACTTCAATTGTTGTATTT +SRR005406.186 FB9GE3J10GDCJK length=283 DDEEFFFFFFEEEEEEEFFFFFFF@;00000;0EEFFFFFFFFIIFFFFFFFFFFEE???CD??333111193??FFFFFFFFFFEEAAAAAAEFFFFFFFDDDFFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFAAAAEFFFFFFFFFFFFFFFFDDDDFEDDDFFFFEDDDEFFFFFFFFFFFFFF776666@DFFFFFFEFGFFFFFFFFFFFFFFGGFFFGGGGGGG@@@@@@@???@@@@@@@@@@@@?????@@@===?@@?? @SRR005406.187 FB9GE3J10GBR7U length=330 TATTGACAGTTAAACAAAAAAATACTTATATTTTGCTTGTTATTTATTCATTTTAATCTTATTCAAAAAAAGAAACAGCTAAAACGACTGTGAAAACAAAGTATTGAAAATAAAGCAGAATAAATATTCATTTTTATTTGAAATTCACGAATAAAAAACAAACAATCAATCGAACGCTTGTTATTTAAAAACATAATCAGTTTTTTCTCTTTCTATTTTCCAATCTATGAGTAATAAAATATATGAATCTACATTTAAGTCATTTTTATTATCAAATATTCTGAATATTATAAGAATTGGAGTTTTTATCTATGAGTGACAAAGAACTAA +SRR005406.187 FB9GE3J10GBR7U length=330 DCCCDDDDDDDDDDD;;@@@@@IIIIIGGGDDDDDDDDCBBC622>==>>>>11770>@DDBBC6666999C+++ADDDDDDDDDDDDDDD@66668333CDDBDDDDDC:777ACDDDDDCCCDDDDDDDDDD>@///?BDDDDDDDDDDD@@@@@@D///DDDDDDDDDDDDDDDDDDDDDD6655555>7>>>DDDDCCCC><D3C999CBD6444??@BBBBDDDDDDDD@8888DDBBBB??????????=>>>=:6......04;9;==????????????===????=999../......./;;;;;=:777:111:==7111 @SRR005406.188 FB9GE3J10F8JOH length=238 TATTGACTAGCTATGAAGGGGATTTAAACAAGACAATGTGGCAGGATATTGCTGATGATCAAGGTGTTTCCTTAGAAGAATTTATGAAAATATGACCCCTGAATCTTTTGCCAACAGTGTAGCTAAACTGGATCAACAGCGCGAGGAAAGCAAGAATAACTGGCCTGCAGAAGACTATGCTACAATTACCAAACGTTTAGAAAAAGCTTAGATAAATTGTTGCCACAGAATCAGCCAA +SRR005406.188 FB9GE3J10F8JOH length=238 AAAAAAAA?@@?>8222755558000223.2==B>===<??>>>>?????@@AAAAAAAAAAAAAAAAA??669=???99;;;=6733338.???<==?AAA@AA<<<<888???AAAAA???AAAAAAA????AAA???=???0000006=7422979660000>??>;666;????><<4333446.-----36--*3----------38666699944444899442555555,, @SRR005406.189 FB9GE3J10GG47Y length=307 TATTGACGACGAATCTCTTCAAATAAAATATGTGTACGTCCAACTTTTGCATACTCCATTGAACTCATCCCTTCAAAAACACCAACAATTGGCGGTTGAACACGGCCAAAATCATCCAAAGTATTCAATTGGATTTCTAAAACTTGGTTATTTTTTAAAGACTGCTCTAAGTATTCTTCAATTTCTTCTGTTGTCTGTTGCGGTAAGCGTTCAAATGCTCTCTTAGAATATTCGTCAGAAGCTTCGATTCCTTCTTGTAACTCCCCCAATGCAAAAGCGGTCGCCCATTTCAGTTCAAAGGGACGAT +SRR005406.189 FB9GE3J10GG47Y length=307 DDDDDDDDDDDDDDDDDDDE<<<@DDDDDDDEFFFFFEDDDDEEDDDDBBBDDDDDDDDDDDDDDDDDDDDDA6/////82>>>>>@B6666DDDDD@@@BDDDDDDDDDDDDDDDD@@@BBDDDDDDDDDDDDDDDDDDDDDBBBBBB?777777????==DDDDD??>>BDDDDDB>>>BBBDDDDDDDDDDDDDDDDDDDDDDDDDDDB999DCCCCCCCCBBBCCCCCCCBBBCCCCCCDD>>>???>>>>>=:777=7700066:86...17:=========>>>>==:::=>??>>>?>:7 @SRR005406.190 FB9GE3J10GEEO7 length=291 TATTGACGGGCGGCACACTTTCGACCTTTTCTTATAGTGCCAGTGGTGCCTTATTAAGTTATTTCGGTCATGTTGCTTGTCAAGCAGCTGGGGCCAAAGCGGGGTCAGCATCATTGGGATTAGTGCCGTTGGTGGTTTCTTACACAACGTTGGTCAGTTGCTAACGACCTCTTTCTTTGCTCATTCGTGGGCGCCGATGCTGTACTTACCATTTCTATCTCTGTTTGGGTTACTTTCGGGGATTGCCATTGGGATTGCCGCTAATTATTTACTACAACATGTCCAGACGTT +SRR005406.190 FB9GE3J10GEEO7 length=291 A@@@BBCCC=766@ACCDAAAAAA4400005-4@@@A@=>>>>>@<<544@<<334463350006440<<@@@@@ABBB@AABBAAE@;0000;;111;5////5;A@BBDDCCCCCCAAACCCCCCCCCCCCCCCCC@::<CCCCCCCCCCCCCCCCCCCCCCCCCCCCC666CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCBB>>>CCCCBBBCCCCCCCCC@@>9666661116:<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:11 @SRR005406.191 FB9GE3J10GB4AI length=312 TATTGACTTGAAAAAGAATATATTCATTCCCAATATCGCCAGTATCTTCAAATGTTAATAATTTTGAAAATGTTTCTCCTGTTTTTTTGTTCAGCAATGGTTAAGCTACCATTGTTTTCAATTTTCACTTGAATAAATTCGTTTTCCATTTCATTTGTTGCTGGTTGAGCCAAAAGACTTCCTTCAAAAGCTTTCGGTTCTCCTTGAATCAATGCAAAGCTATCCCAAGAGAATGGCGCCATTTCTTTGACAGATAATTCGACCGTTAAGTATTTAGCCATGTACGGTTGACGGAAGGCATCTTTAGGTAAA +SRR005406.191 FB9GE3J10GB4AI length=312 DDDDBBFB>7/////>00?>CDDDDDDDDDDC@@>DDDDDDDDDDDDDDBBBDDDDDDDDDDDD>85555BB@@@A:>>>>///////@11DDDDDDDDDDDDDDDDDDDDDD45000<<@::::BBDDDDDDDDDDBBB<5555<<B@BBDDDDD966BBDDDDDDDDDDBBBBDDDDDDDDDD9999DDDDDDDDDDDDDDDB=<<DDDDDDD555CC>99999CCCCCCCCCCCCCCC555C>>>>>><<<666::>>>666<>>><<<>>>>><<<>>>>>>><<<>>>>>>>>>:::=>>>>>>>>> @SRR005406.192 FB9GE3J10GGB72 length=311 TATTGACATTGGGTTTTCGCCAATTCCGTTTTCGGATGCTTTTTTACTTGGTACCTGTTCAATTAACTATGATGTCACGGCTGCATAAAATTTTTGGTTCAGTCTTGGTCTGAAAGCTTAGGGAAAAGTTTAACCAAAGAATTAGTAGTGGTTAGTTTAGGTAAGAGCGCAGTCGGAAATATTCTAAAAGTGATTCCTGTTGTCGGAACTGTGACTGGTGGCATGGTCAATGCTTCAGTTGCAGTAGCAATTACGGAAGCGCTTGGCTGGGTTACCGTCAAAATGTTAAACGATGGTGTTGATATCTTTGA +SRR005406.192 FB9GE3J10GGB72 length=311 CCCC@BBC@@666B===8677CC7777800==@778CDD==FFFFDA//CCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDA;9966DDD>>::/0DDDDDDDAAADDDDDDDDDDDDDDCCCCCDCC3388@@DDDDDDDDDDDDDDDDDDDDDDDDCCCDDDDDDDDDDDDCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD???????????????????????????????;::??????====???????:444??????===?? @SRR005406.193 FB9GE3J10F6S3M length=239 TATTGACCCTCCTTAATTTTTATTTCATTTACACCTGTAAAATTTTCAAATTCTTTTAATGAGGGATAGGCACCAAACTTTTTTATCTCTCCATCCACAATGGTTATCGGTAAGACACTAATGCCATTTTTATCTATTAATGATTTGACTTCCTCATTTTCCAAAAATACATTTGGTTCAATTGTTAAGCTATGACGTTCCACTTCGTAATTTGTTTCTCGTTGAATTTCTGTAATGTT +SRR005406.193 FB9GE3J10F6S3M length=239 ????@@??94//87<<558552)))::??@=====AA=44437775:9:<<:8....22-99999:;:;;99:<:600......,(66<999=>>??????????@?AA?<<<<AAAAAAAAA888;;@@@A2AAAAAAAAAA;;;?>===;;724...........4*66666::86<<<<><000066:;9999<;;;;;;;;;9000;:66...5.5552,,,,,,2*,,,,2,,, @SRR005406.194 FB9GE3J10GAL1A length=214 TATTGACTATATTATTTGGCTTAAGTTTGGCGACAATCGGTTGGCTAGCTTTAACAATTTTACTAGAGATGCCTGTTTTATTAGGATTCGTCGCTGGACATGTTACCTATATGATTGGTCTAGGTTTTGCATACAGTAATATGATGACGACTGGTATGAGCTTGTTAGAGGAGAAAGTATTTTGGCGACGGCAATTACGTTATTTAATACACTT +SRR005406.194 FB9GE3J10GAL1A length=214 AAA?@@@@??????=<<=::::>>?=<<?<??@??????A8888:=@@><::<<<11....02/<<<<:;====9222.223=777788<????AAAAAAAAAAAAAA????<<66...878.....15;=====?@?????;;;;>;;666:::974...44.....8.........+........46---------3------33.1668-- @SRR005406.195 FB9GE3J10GEPF2 length=283 TATGACAGCTGCCAAAAGTAATTTGAGTCCTGTTCAACGAGTTGTTTCTGTTTTAGCTGAGATTTTTACACCATTGATTCCTGCACTTGTTATCGGGGGATTGATTTTAGGATTCCGCAATATTTTGGAAGGGGTTCCATTTGGCTTTCTTGATGGTCAAACAATCGTGGAAGTTTCTCAATTTTGGAATGGAGTCAATTCATTCTTATGGTTAATCGGCGAAGCAATTTCCTACTTTTGCCAGTTGGATTACGTGGAGTATTACGAAGAAATGGAACCACAC +SRR005406.195 FB9GE3J10GEPF2 length=283 AAAAAAAAAAB@@????94++<<????BBBAEAABBB?B?9::<888@>@????AAAAAAAA;;;;;AAAAAAAAAAAAAAAAAAAAAAAAAAA66666==?AA????AA???@?====;4.....4444......666:;>>??@AA?<<AAAAAAAAAAAAAAAA????>=:::<.344....44448333996666699:;;;:60000099952220222,,,,,,,,*,,,,,,,,,,,,,,,,,,,,1,,,,0,,,,,,4300-,,,,,,,,,01,, @SRR005406.196 FB9GE3J10F7ZWL length=269 TATTGACTCTCTAACGGAATGATTTGTTCGTTAGAAGAGCTAGGATATTCAGACAATGTCGTACCAAAAGCCTATGCTGAAGGGATTTATTATTTACCTCAAGAAGCAGTGAATGGGACACCTGTTTTCCCTTATTTAGACATGGATGATGCGATTATTGAATTATCCAATTACACCAAACCGTGCCGATGCATTAAGTATGAGGAGGGGTAGCCTATGAAGTTGGCGCAATTTATCGTCAAACGCCTCAGTTTAATGACTCCCGAACT +SRR005406.196 FB9GE3J10F7ZWL length=269 CCCCCCCBAACCCCCCC;;==CCCA=55=3556<AACCCCCCEEDCCCAAACCCCCCCCCAAACCCCCB@@@ACCCCCCCC;;;;;;;AAAC:;;?ACBCCCCCCCCCCCCCC@;;;CCCCCCCCCCCCCCBBCCCCCCCCCCCCCCAAAAC?@555?CCCCCC>33311777A700///00A<:7777>A>>9999AAAA222229>>>>9-22A><<<<777777<>>><777<<111177;;72-,-------,------2777,1 @SRR005406.197 FB9GE3J10GDSQU length=287 TATTGACAATTCACTACTCCTTTCGGCAAGACTTGATCAAAAATTTTAAACAATTCCAACAGACTTAATGATGTGCTCGAGGATGGATGAATCACAACAGTATTACCTGCTGCCAACGCTGGTGCTAATTTCCAAGCACCCATTAATAAGGGGAAATTCCACGGAATAATTTGACCCACAACACCGATGGGTTCTTTCACAACAATGGATAACGTATCCTTATCAAATTCTTTGACAGACCCTTCTTCTCCACGAATCACACTAGCAAAATACCGAAATGGTCTGCA +SRR005406.197 FB9GE3J10GDSQU length=287 DDDDDDDDDDDDDDDDDDDEFFFFFFFHHHFGEEDDDDDD9661111---8:@>>>>>>@DDDBBBBBDDDDDDDDDB@@@@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDBB;;;??DDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCCBBBBCCBB<;;@BCBBBCCCCCI>>>>>>?>>===>?>>>?>====::8066/.../.666:::: @SRR005406.198 FB9GE3J10GFHLA length=299 TATTGACACTGTTCTAAAATAAATTTCTCTAACCACAGTTGTTGTTGTTCGAAATATAACCAACCTTCTGTTGATAACGCTTCATTCGTTAAGAAAGGCAAATACAATAGATGGCTTAAGTGCCGAATCTCATAAATTGTTTCTTTTGATAAATGTTCTTGTTTTTGTTTTTGTGAGGAGGCCTTCACTGAATGAACCTCAGAAAGCAATGGGTTTGTTGAAGAGAAGCTGCTATTAATCCGATGCTCGCGTAGATAGCTTTTGGCGGCAGGCGTCAGAAAACTGCCTACAGGAAACAA +SRR005406.198 FB9GE3J10GFHLA length=299 FFFFFFFFFFFFFEB;;;;EFFFFBBBEFHFFFFFFFGGGGGHHHFFFFFFEEEFFFFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFE>=>>EEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF====FFFFFFFFFFFFFFFFFFFF66666FFFFFFFFFEEEEFFFFFFFFFBBBBFFFF===FFFFFEEEFFFEEEEEEEEEEEEEFFFFFFFFFEFFEEEE@@====@@@@@?===?7777@@@?=====::::=@@@@@@@@=7777@777==? @SRR005406.199 FB9GE3J10GGFON length=308 TATTGACCGTTCAATCTGTCTCTGTTACGGAAACAATTTAACCATAAAATAAAGCACTTGGGCGCTAGCGCGCGCCAAGTGCTTTTGTTTAAATATTTAATACTTTATCTAAGAAATCTTTTGTTTCGAGGGTTTTGAGGATTTTCAAAGACTTGCTCTGGCGAACCATCTTCTAGGAAGTTACCGCCATCAATGAACATTACTCGATTAGCCACTTCTTTTGCAAAGCCCATTTCGTGAGTAACGATGACCATTGTCATTCCTTGTTTTGCTAAATCTTTCATTACACCAAGAACATCGCCAACCTA +SRR005406.199 FB9GE3J10GGFON length=308 CCCCCCCCCCCBBBCCCCEEDDFEFEEC????CCCCFFGCCCBBB@@@@5//-66@BAAAA==:@CCCCCCCCCCCDCCCB=4440@744111@@11144B@;11159B====@DCCCCCCB=/--@@@:11////032@@9999@@B@@@BBBBBCC@@@@<6666BBDDCCCB<<<<@BCCC@@<<<@BBBBCC???CCCCCCCCCCC?????;99>CCB>>>>>BCCBB>>>CCBCCBBBBC<<<<<<<<<<<<<<:<::63.....34833338::::::::::::::::::66666666<<<< @SRR005406.200 FB9GE3J10GEEFP length=136 TATTGACTTTCAAATAGCGTCCGCGGATTTCTTTTTTGGTCTATGAATAAAATACTGGAAACTTAAATTGCATCACGAATAGAAAAAATAGGGCGTATTATTGCCAACTAAGTCGTAATTTCCTTCGTCTGTATAG +SRR005406.200 FB9GE3J10GEEFP length=136 >:::==<22222002,88<<:6656630003,,,,,,22(8<<:::::....6-868888<;22,,,00889888:<66886......0(0000,9=<=:11223<;=>874343........3378733499934 @SRR005406.201 FB9GE3J10GEOL5 length=274 TATTGACTTCAATAAATTGAGGGCTTTTCCAAAAAATTAGTTTGTTCACTATGTTTTCTTGTCGTATTTCATGTTAGTATAAGGAAAAAGTGTTCAGTTGATTAGTTGAAGATTTAGAGTGTGGGACATAAGTCGATTAGGCTTGTCTCTCATGTTCTGTCTTTTTTTATGTCATCATTCACTAAACTAATAAATAATTGGAGGTATTTTATGAACTAAATTTTTTACAGCCCAACGTTTAAAAGACACCGCCTATGTAACAGTCGGTGCATTC +SRR005406.201 FB9GE3J10GEOL5 length=274 AAAAAA@@?=>==11066880003....00......22(8588624<=?AAAA????@44=?AAAAAAAAAAAAAAAAAAAAAA;;;;;???AAAAAAAAAAAAAAAAAAAA888AAAAAAAAAAAAAAAAAAAA?;;;AAAAAAAAAAAAA@?=;;79..........'888888<>>??=700068306----**--336---3----3+33332189444444.988800002;888;;;;;0777666677666663333766303331, @SRR005406.202 FB9GE3J10F7DD8 length=274 TATTGACCAGAAAGCCATGTCTTACCAAATGATGTAGACATGAGTGTACAATTAGCTAAAAATATCAAGTTAAATATTCCATTGATGAGTGCCAGTATGGATACTGTTACAGATAGTAATATGGCAATTGCGATGGCTCGTCAAGGTGGACTAGGTGTCGTACATAAAAATATGACTGTCGCCCAACAAGCAGACGAAGTACGTAAAGTCAAACGTTCTGAAAGCGGCGTTATCATTGATCCATTCTTTCAACACCAACAAACTTAGTAGCGGA +SRR005406.202 FB9GE3J10F7DD8 length=274 DDDDDDDDDDDDDDDDDDEEFEEEEEDDEEEEEEEEFFFGIHHGHDDDDDDDDDDDDDDDDDDDDDDD@@@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDB88888=2BDCCCDD=>888887BDDDDDDDDDDDDDDDDBBBDDDDDDDDDC@@@BCCCC@;;777CCC@@@CCA@?:::71......977....44..../...6::: @SRR005406.203 FB9GE3J10GEE35 length=316 TATTGACTCAAAGAAAAAGAAATAAAGGAGTCGTTTGTGATTATCGATGGATTTACGTTATTGCTATTTTTATTTGTCGTCGTTATGTATGGTTACTTTTACTTCGTACGTAAAAGTATTGTAATTCCGGCTGCAAAACATCCTACAACAAAATATCTAGTTGTCTTTTTTTAGTTTAATGATTCTGGCCAATGCATTTTCGGCAGGAGATAAATTGAAATGATTCGAAGTGTGTTATATATTTTGATCATCTTCTAGTTTTTCTTTACGATGCAAGTAGGTTTTGCGGAGGACTGTATTATTACGCATTCCTTTT +SRR005406.203 FB9GE3J10GEE35 length=316 AAAAAAC<<64465<<85A---A@>>6409==<AA@@5<=AA@?A@AA@@@@@AC@<003:AAA??777::<+++<5AABBBAAAAAAAAACCC@@??CCCC::CBCCC?;333/176<<:02213;;@;9;@@@CCCC=CCCCCCCAA5555@8CBBCCAAA:9311111111)))008===AAAAA????CCAA@@@@CCCCCAAAA9222/994///44777??CCCC>><<??><11////46766442--,44----11+//:::::::5511152////0422400264424-11115:7766644//,, @SRR005406.204 FB9GE3J10GDQG8 length=323 TATTGACATCGTAAAAAAGTCAACTTTTCCTTAGCTACAAAAATTTTATTTACCTGTATCTTATTCAATTTAATTGGTGGTGTCTTATTTGGTTTCTTGGTATCACTTACGGTGCCATTCCAAGATTTGCCAAAAGATAGTTTCTTCTTTACGTCGATTGCTGGAAAATTAGAAAAAACCACCCTACAGATTTTAGTTGAAGCTATGTTCGCCAATATTGTGGTTAATACAGCCGTATTAGTGAGTATGCGAATGAAAGNTGACGCCGGCAAAGTCGTGGCCATTTATTTTCATTATCTTTATCTTTGCTTTCCTTGGTTTTA +SRR005406.204 FB9GE3J10GDQG8 length=323 DDDDDDDDDDDD88;;;;BBBDDDDDDD@@;;@EEEDDDDDDD<;;;0@DDDDDDDDDDDDDDDDD@@;;;BBBBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBB;;;;?DDDDDDDDDDDDDDDDDDDDDDDDDDDD8555@@<A//////443999ADDDDD9999BDDDDDDDDDDDDDDDDDDDDDFDDDCCC@@@@CCCBBBCCCCCCCCCCCC>>>==777==111.!68:::........::66...::8......00:===========6...6/............./ @SRR005406.205 FB9GE3J10GGSCC length=299 TATTGACTTACCTAAAGTCGGAAACCAAGTATATTCCACCATGCGCTCCGTTACTTCAATATCGACTTCTTTTGCTCGCACGTGTACTACATCACCAAAATGCAAAGAAGAAAGCTCTTCGTACATGTCTTCATATTCCAAGGTGTGTTCTAATGCTACCATGCTAATAGTGTGCGTTACTTTTGGTTCATGAATACGGTCTTTATCAAACAATGACTGGCCCCTATTTTTTAAGCTCATCAACTGTTTTACATTCCGAATTTTCACGTTTTCCAATTCTTCGGTTACTATCATTTACA +SRR005406.205 FB9GE3J10GGSCC length=299 EEEEEEEEEEEEEEEEDDE@@777DDDDEEEEEEEEEEEEEGGGFEEEEEEEEEEEEEEEEEEEEEEEE====EEEEEEEEEEEEEEEEEEEEEEEAAAAEEEEEEEEEEDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDE====EEEEEEEEEEEEEEEEEDDDEEEEEEEEEEEEDDDDDD:::://444/99DDDDDDAB===::@@@==:::@=:::@@@:777@@@====:::7777:?@@@@@@@::::::@@@ @SRR005406.206 FB9GE3J10F6E5C length=322 TATTGACTTAAATGTTTCAATGGAAGCAATCGTCCGCAAAATGTTTTCTTCCTCATTGTAAGCAGGAATGATTAAAAGTACCTTCATAAAGAGAAACACCTTTCCACTTTTTCTCTAACAAAACCCCTCACTTACACAAAACAATTTATTGTTGAACATTTCTAACATTTGTGCTAAGGCTTCTTGCCAAGTAGGAATTTTAAAGCCTAACGCTTCTGTTTTACTTAAATCCATGACAGAATATTGTGGTCTTTGCGCCTTTTGTGGAAATTGAGTTGAATCCCACTGGCAATACTTCCACTTCAGTATCTTTTAAAATTTT +SRR005406.206 FB9GE3J10F6E5C length=322 B>>>BBDDDDDBBBBDDDDD@@@DDDDDDDDDDDDD>55558?====?55BBDDDDDDDDDDDDDDDDDDGGGDDDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDB99988>0DAFBB9=557777>7>DDDDDDDDDDDD::999>DDBBB:444@11140444:11140@BDDDDBBBDDDDDDDDDDDDDDBB====DDDDDDDDDDDDDDDCCCCCC>;11;;CBBBCCCCCCCCCDCCC>>>>>>666>>>>=::::>8::666===<<<<;;:611163::;;<<=<:::::>>>>>>>>>>=<<;33333++++ @SRR005406.207 FB9GE3J10GC9TJ length=286 TATTGACCAAGCCATTCAAGCCCAATTTGATCAACCATTACCATTAGTGACAAGCGCTGGGACCACAGACTTAGCTGAATTTACTAAATCAGACAATACATTTGATTGCGTTGTCTTTGGACCAGGTGTGACCACTACTGCACACCAAGTCGACGAATATGTCGAAATTGATAATTATTTAGATATGATTGATAAGTATCAAGCGATAGCAAAAAGTTATTTAAATTAAAAAAATGTCGCGCCTGAATCATAAAAATCAGGCGTGACATTTTTTATAAGGTTTATT +SRR005406.207 FB9GE3J10GC9TJ length=286 DDDDDDDDCCCCDDDDDDDDDDDAAAADDDDDDDDDAABDDDDBBACCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDAAACDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDFDDDDDDDD99>>>99DDDDDDDDDDD?>===711...69;;;9999666.......+..669999.. @SRR005406.208 FB9GE3J10GAJOM length=292 TATTGACTTTGAGGTTGCTAACGCATCTTCAAAGCCACCTGCACCAACAAACCGTGTTACGCCAGGTGCAGCTACCATAGCCATTGCTCCAACGCCTACTGTTTCAGTAATTGCACTATCCCCGACATCAGGATTTCCGTCTTCTTCGCTGAAACCAGTGAAGTAAAGACCTTTTGGTGTATTTACTGGTGCGGTATGCCATTGATCGCCTGTTTCTGCAATCCGAACCCCAAAGTTCACGCCGTTACGAGTCATCGTTGTGACAATCGTTCCGTTGGTATCTTTACGGGCA +SRR005406.208 FB9GE3J10GAJOM length=292 DDDDDDDDDB??>DBB>?@DDDDDDEEDDDDDDDDD@>>DDDDDD>>>88877DBBBDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>>>>DDDDDDDDDDD>>7BDDBBBD>>>DDDDDDDDDDDDDDB999>>DDDDDDDDDDDDDDD5555<<5BBBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCB>>>BCCCCCBBBBBBCBBB>;;;BC>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>===:6311:: @SRR005406.209 FB9GE3J10GG53Z length=299 TATTGACTAACTATGCAAGAGATGGCCAATATCGCTCGTCTTAAAAAAGGGAAACTTTTTAAAGGCACAAGTTGAAGATGGGTCATATCAATATTTTGAGATTTACAATATTAAAAAAAATCTGCAGTCAGTTTCAGTGACAGCAAGACACATTGGTTTTATGGCAAATAAGAATTTCATTATTAATTCATTTACTGCTAACGGAAATGGCACGCAAATCATGAACAATTTAAAGCTGCATTTAACGTTTAAGCAACGGTTTAGTTATTTGTCGAATGTCGGTACTACACATCAATTTA +SRR005406.209 FB9GE3J10GG53Z length=299 CCCCCCCCCCCCCCCCCCGFFFFFGIIHGGGIIIIIIEEEGI@@@@@@CCC???CDDHEECCCAAACCCCCCC@AACCCCCCCCCCCCCCCCCCCCCCCCCCCCCDA@BB33////////9;@BBDDCCCCCCCCCCCCCCCCCCCCCCC@@@@@@CCCCCBCBB<<<<88<<<<<@CCCCCCCCCCCCC???CCBCCCCCC44222????B::::99>@@@@==<<<@//////996///////4.................3..3.....4788983666:::666:66666::::: @SRR005406.210 FB9GE3J10GB81Y length=122 TATTGACCGTCACTCTGACTTCTGATGAGAAAAACAAAGGCTTACTTGACCCTTATGTGATTATGAAAAATCCCAAAGATTCTGAATCACTGGCTATTGATATTCTGACATTCCTTACGGGG +SRR005406.210 FB9GE3J10GB81Y length=122 AAAAAAAAAAAAAAAAAAFFFFFIIFFE?::==7?+++55BBAA?=?AAAAAAAA???===:<58.....200888896==?=<<<??????@??????????=>=@@<<66643397.... @SRR005406.211 FB9GE3J10F8JHS length=296 TATTGACAGGTTGTTCATCGTTTGAAAGAACTAGTCGGTTTACCGATTGGCATGAATGTCGAACCTGTTGATGAAAATTTAGACTTAGCTTCAACGAGAGTTTCGATTGAACCAGGTAGAAAAGCATCAGCAGCTACTTTCAAAAAAGCCAATGAACTGGGTTTGGATTTTATCTTATTGACAGGTAATCCAGGAACTGGCGTGACCAACGACTTGATTGCTGAGAACGTGGCCTTAGCCAAAAAACATTTTGATGGCATCATTATTGACCGGAAAAATGCACAGTTCAGGCGTAG +SRR005406.211 FB9GE3J10F8JHS length=296 DDDDDDDDDDDDBBBDDDEIEFD>FFFEEEFEEEEEEGGGFFFGGDDDDDDDDDDDDDDDDBBBBBDDDDDD?5588??DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDAABBB<BBBDDDDDDDD999DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCCCC>>>CCB;;;;CCBB@@;;;;933+66>>>=========:666.//..44....1;;;6666=======666: @SRR005406.212 FB9GE3J10F8U2Y length=325 TATTGACATTCTAAACCATGTTATACTTTAGATACTTATTTTTTAGGTAGGAATTAAATGGCACTACTACTATTCTTTTTGTTTTATCGCCCTACTAGGATTTGGTATATTAAAAATTAATAACCGCAGTATCCTCGGCGGTATCACTCTGGCTTCTGGCACCTTATTGTCATTAGTCACCTTACTATTTATCGGACTAGACAAAATTTATTTACATTTTAAGAATGGCGACCTAATTACTTTGGCAATTGCTTATCTATTAATTCCCTCTGTGTTTATCGGCATTTGCCTTTACTTTATTTTTAACTCACGTACGATGCAAAAC +SRR005406.212 FB9GE3J10F8U2Y length=325 DDDDDDDDDDDAA;;;;AADDGDDDEGEEDDDHHFGC@//////8>>-85>>>772228>>CDDDDDDDDDDDDDDDDDD:////@9@@DDDDDDDDDDDDDD:858CBAA/////55..===DDDDCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDFCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>>>D;;;DDD4444::@@@DDDDDAAAADDDDDDDDDDD?????????????????????????????777??????????????????????????????8:::=::7777:::::56 @SRR005406.213 FB9GE3J10GB7Y5 length=283 TATTGACGACAGAATTACGGGAAAAGATGGGCTTGGTATTACAGGATGCTTTCATGTTTTATGGAGATATTGCTGGAAATATCCGTTTACTGAATCCAACTATCACAGATGAACAAATTAAACAGGCTGCGGAATTTGTTCAGGCGGATAAATTTATCCACACGTTACCCAATACCTATCATGCGAAAGTCATTGAACGAGGAGCGAGTTATTCTAGCGGACAACGTCAATTAATTTCGTTTGCACGAACGATTGTGACTGATCCCAAAATTTTAGTTTTAGA +SRR005406.213 FB9GE3J10GB7Y5 length=283 DDDDDDDDDDDDDDDDDDD@@@@8872@BDDDDDDDB@@@EEFEIDDDDDDDDDDDDDDBB;@@BBDDDDDDDDDD;;;BBBBBDDDDDDB@@@BBBBBDDDDDDDDDDDDBBB;;;DDDDDB=@@DDDDDDDDDDDBBBBDDDDDDDDDDDDDDD???DDDDDDDDDDDDDDDDDDDDDDDDDD;;;BDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCCCCDDDDDCCCCCCCCCCDDDCCC>?>>====>?>>>??>>>>7777==::::27....:== @SRR005406.214 FB9GE3J10F670P length=309 TATTGACAGGGAGTGGAGTAGAAGCACCAAAGCTTCTGGTTCACTCTCTTCTCGTATTATCCAGTCAAGTTGTAGCAATAGCTTAGTGGGAGTTTAAGAATTATATAACAAAAATCACTGGCACTTCTCAATCAGGGGAGTGCCAGTGATGCTTTTTAGTTGCACTTCTTTCCTTTTTCTGTGAAAATAGTTTGGGTATCAAAGTAATTGATTCTTTTTTTTAAAGCCTCGTCCCTTGAAAATGCGCCTTTTTTGAAATATTTGAAGAATATTTCATTAAAAATATAGAAAATTCTCTTGCATTCTTTG +SRR005406.214 FB9GE3J10F670P length=309 DDDDDDDBBBBBBBDDDDDDDDBB@@>>888BBDDDDDEDEEGGGDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDBB99:?BDDDDDDDDDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDB>9996DDDDDD699DDDDDDDDDDDDA??222////////0077;;=;;70007777777??7444....../.55:344:<<==:::744488.......70::8..11::<;<<:8661114445 @SRR005406.215 FB9GE3J10F70U3 length=283 TATTGACTTCCGTACCTGCTTGACGACCATAAATGATAATATCGGCGATGGCATTGCCTCCGATACGGTTTTGACCATGTAAGCCACCTGTTAATTCACCAGCAGCATATAGACCTTTAATTGGTGTGCCATCTTCACGTAAAACTTCTGTTTTCGTGTTGATTTTCACGCCACCCATTGTGTGGTGAATCCCTGGTGCAATTTTAATTGCGTAGTAAGGCGCTGTGCTTAAGTCAGCTTCCATGCCAGTTGTCCGGCCAAATTGTTTGTCATCTTTGGCTAA +SRR005406.215 FB9GE3J10F70U3 length=283 DDDDDDDDDDDDDDCCCCEHFFFHEDEEEFEEEDDDDDGGEDEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDAAAADDDDDDDDCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCCDDDDD8888BDDDDBBBBDDDDDDD@<<<<<DDD:::==77566......666/..9==:7777:??????? @SRR005406.216 FB9GE3J10GAPPK length=297 TATTGACGATTGATCACTGGTGGCAGCATCGCTGAACCAGCGAAAACTGCAATCCACAAGAACATCCCACCAAATAGAATGGCGGTCGTTTTTAACCAACCAGGACGTTTGCTTTTGTCGCCACCTTGACGATCAAAACGGTAAACATATTTGTGCATTAGATAGAAAACATAACCCCCAGCCATCGCACCTAAGATATATGTGGTTAATCCGAGAGGTTGTGCGGTTCCTTTTGAAAATAGAGACATCGCCGCTAACATGATTGTTAATAAACCAAGTAATAGTAAGGTATTGTCG +SRR005406.216 FB9GE3J10GAPPK length=297 DDDDDDDDDDDDDDDDDDEDAAAADEFFEDDDFFHHEDEGGDDDDDDDDDDDDDDDDDDDDDDDDDDDAAADDDDDDDDDDDAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDCCCCCDCCAAAADDDDDDDDDDDDDDDCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDCC@@@@@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@D00000000008000086?@@D???????????????=::::..........==>:::??????=:::??:::: @SRR005406.217 FB9GE3J10GGUSS length=291 TATTGACAAGGTAAGAAACGTCCAGAACGTTCAGATAAGCGTTCAAAAGAAACGGAACCCACGACCAGCGATAGCAGGTGCTGATGGAACCTCAGAAGAGCTAGCAGATAACTTTGTCTTTGGTTTCCATGCCACTGTTGAGGCGTTGCAGCAAGGACGCGGGAATAAATTGTTTTTACAAGAAGATGCTCGTGGCGAGAAAATTGAGCAATTAAAACAAGCAGCGAAAGAACAGGCTGTTCCAGTTAAATGGGTGCCTAAAGCAAAATTAGATACGATGAGTGATCACGG +SRR005406.217 FB9GE3J10GGUSS length=291 EEEEEEEEEEE@88;666@EECCEEDDEEDDEEEEEDDEE@@@E????;333;8>==FE>@AADEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEA===DEEEEEEEEAA===AAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE@@@FA6/////66FFGFEEEEEEEEEEEEEEEEEEDDDD@@BC<<551111946>DDDDD@ABDDDDDDDDDDDDBBB@7777@@===@?===??@::3333::@@@@@@@@@@@@@@@@??=== @SRR005406.218 FB9GE3J10GFBPZ length=293 TATTGACACACCATAACGTAACATAGCAACGCGATCTGGTCCTAAGCCAAAGGCAAATCCTGAGTACTCTGTTGGATCAATCCCTGACATTTGTAATACATCTGGATGAACCATCCCCGCACCTAAAATTTCAATCCAACCTGTATGTTTGCAGACGTTACAACCTGCGCCGCCACATTTAAAACAGCTAACATCTACTTCGACTGAAGGTTCTAGTAAAAGGGAAATAGCTAGGACGTAAACGAATTTTACGATCTTCACCAAACTATTTTTTCATCATGACTTCTAACGTT +SRR005406.218 FB9GE3J10GFBPZ length=293 AAAAAAAAAAAAAAAAAAAAAAACABBCCFEAAEEEFFFFEEAEEAAAAAAAAA:::::9AAA?@?A?AAAAA889??@@@????@@@A===AAAAAAAAAAAAAAAAAAAAAA??<<=3=:74........44449====>>?@??;;;???>=???>?;6666;>?===<6965000000626+66<;;9666;966336863-----33813320200,,,***2,2222,,,2052222,*),,,,,13011,,,,,,,,,0,),,,,,,,,111,,,11100,,,,,, @SRR005406.219 FB9GE3J10GFC1M length=286 TATTGACCTATGTCATTGGTCGAAAAGATTTCTTGGTTTTCTTTTTTCCTTTGCATACTTCATGAGTATCGTCTTTAAGTCATTGGAAATTACCATGGTAACGTATGCCATCTTTGGCGTAATTATTGCGTTAATTTTTGTTGCAAGTCCAAAAAGGCAAACCTGTAGCAGAAAGTGCTGGTTCCGCCAGTGCCACCACTGATTTTGATGATGATGACGATTACGATGACGGGTTTTAAAAGAAAAGGAGGAACTGAAATGACGGAAACAACAAGAAAAAGTCGTG +SRR005406.219 FB9GE3J10GFC1M length=286 AA??@@CCAAAAAAAAB443<9////<-000A;;<<///3@33::33??--2CCCCAA677<CAAACCCCCCAAACC@@?@@CCCCCCCAA=@@A@@;;666;CCCCCCCCCCCC@@@?CCCCCCCCCCBCCAA333333+*:>?@A>@@9:::9@@@A9:::AACCCCCAAACCCCCC::::CCAAACCCCCC999AAA9922229>CCCCCCCCCCCCCCC>>><71111/////55640****---,,---44---44::::::2:55551111111:::::: @SRR005406.220 FB9GE3J10F693E length=265 TATTGACAACAGATACAATTAGTTTTACGGCACTGAATAATGCGTATGAAGGAATTTATCGTTTAGATGATAAAAGCAAGCCGCAACCAGCAGGAGCTAAAGAAAAAGTGCAAGTCAGTGATGATGGTCTGACGTACACAGTGAAACTAAGAGAAGAAGCAAAATGGTCCAATGGTGATCCTGTCACAGCTGCCGATTATGTTTTTAGTTGGCAACGTACAGCAGATCCTCAGACTGGCGCTGAGTATGCTTTATTTTCAAGAAA +SRR005406.220 FB9GE3J10F693E length=265 DDDDDDDDDDDDDDDDDDDD>?5558BBBBBBDDDDC@>>DDDDDDD?8999DDDDDDBBBDDDBBBDDDDDDDDDDDDDDDDD??>>DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD>>>BDDDDDDDDDDDDD9999BDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDB=<<<=DDDDB9..99DDDDCCCBBBBC>>>>99;>>>>>@CCAC@>=966655...8..../..5444 @SRR005406.221 FB9GE3J10GFV1Q length=278 TATTGACCAGACACACAAGCATTTTTTACCGTATGTTGTCGCATATTTCTCTGATCGCTGCGGTCGACAAAATGTCGCCTATGCCACGGTACATTTAGACGAAACCACGCCCCATATGCACTTAGGAATTGTGCCTATGTACGAAGGGCGATTGAGCAGTAAACAGGTGTTTAGTCGGCAAAATTTGTTAGAGATTCAAGAAGAATTGCCAACCTATTTGCAAGAACGAGGCTATGCTATTGAGCGTGGACTCCGTGGGAGTCCGCAAAAGCATTTAT +SRR005406.221 FB9GE3J10GFV1Q length=278 EEFFFFFFFFFFFFFFFEEEI777777;BHHEEEEFFIEIIFFGHFFEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEGGGFFFFFFFFFFFFFFFFGEEEFFFGEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFFFFFFEEEFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGFFFFFG@@@@@?===@@553@@@@@@>1133:@?111=@ @SRR005406.222 FB9GE3J10F8AH4 length=197 TATTGACGCAAGAATTTAATCCAGAAGAGATAGATGAGAACCAACCGATTGATGTGCGAATTGATTATGTTCAATCATTTCAAGCGTTAAGTAATAGCTATGAAGCATTAGTGACCTATGATGAATACAATGATGAAATGGAAAATCACCAGCTTTAGCTGAGCAAGTCCATTTGATTGAAGAACAGATAGGAACAT +SRR005406.222 FB9GE3J10F8AH4 length=197 AAAAAAAAAA@A???::885::@@?????ABABA????88::8888<<<<>>>???@????==999??BA?===@AA@?<988<??3333<<==?=><<<<===???@@AA???AAAAAAAA???@=?====944...4......44...3.....7999963444686460..66:::88866664343----313 @SRR005406.223 FB9GE3J10F6KLZ length=142 TATTGACAGAGTAAGTGAGCGAAGCAGTGAACTTACTACGGGCGCCCGTTACAGCCAACGGTATGCGAAGAATCAAGTACCGTATGAGGTTATTATTGAGAAATAATAGCGAATTAAGGTGGTATCACGAAATGACAAACTT +SRR005406.223 FB9GE3J10F6KLZ length=142 AAAAAAAAAAAAAAAAAAIIHHEAFFCBAB?=::7==723332.766::<;0688822122;7799=?@AAAAAAAAAAAAAAAAAAAA???AAAAAAAA888===AAAA?AAAA????AAAAAAAAAAA??>;:7733... @SRR005406.224 FB9GE3J10GGN8L length=101 TATTGACATTGAATGTCACTTCTTGATTGGCTAATAAGCGTTTGTAAGAGTCCATCACAATCGAAATAACGCCAGAATAAGGCGAATTAGGGTTTTGGTTT +SRR005406.224 FB9GE3J10GGN8L length=101 FFFFFFFFFFFFFFFFFFIIIIIIHHHHHHHHHHHGGHHGHIIIIFFFFFFFFFFFFFFFFFFFFFGGGGFFFFFFFFFFFFFFFFFFFFFFGGGGFFFFF @SRR005406.225 FB9GE3J10F56ZB length=287 TATTGACTAACAGAAGGCGCCATTAAAATTGATGGTATTGACACGAAAAAATGAACCGTAGTGATGTCCGATCTGTATTTGGAATGGTATTGCAAGATGCTTGGTTGTATAAAGGTACCATTGCAGATAACATTCGTTTTGGGAAGTTAGATGCCACGGATTATGAAGTTGTCGATGCAGCGAAAACGGCCAATGTGGATCACTTCATTCGGACAATGCCAGACGGGTATGAAATGGAAATCAATTCTGAGGGAGATAACGTTTCCCTTGGTCAAAAACATTGTTGA +SRR005406.225 FB9GE3J10F56ZB length=287 DDDDDDDDDDDDDDDDDDDDDD665555B@@@DDDDDDBBBHHAB//////>>>>>>BDDDDDBBBDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDD@@@@@@DDD:22566DB668BDDDDDDDDDDDDDD?8888858BBDDDDDDDDDDDDDDDDDDDDD?;;;;;DDDDDDDDDDDDDDDDDDDDDDDDDDDDD>999DDDDDDDDDDDCCCCCCB@777?C??555@CCBBBCCCCC>:::>>>=======:777777733:89:000777-117447: @SRR005406.226 FB9GE3J10F80H6 length=228 TATTGACATTTAATTATAAAGGAGCGAAATTTCATGGCACGCGTAGAAAGTTTTGAATTAGATCACAACACAGTAAAAGCACCATATGTTCGCCTTGCTGGCACAGAACAAAATGGTGATGCGTTAGTCGAAAAATATGACTTACGTTTCTTACAACCAAACAAAGATGCCCTACCAACAGGCGCATTACACACGTTGGAACATTTATTAGCAGTTAACATGCGTGAT +SRR005406.226 FB9GE3J10F80H6 length=228 @???@@@=22066338000022,53000000038<999=?A??AA?????4444349>>=>=@AA?A?????@?444449@???AAAAAAAAAAAAAAAAAAAAAAAAA33338????@???====:9;:111100*=====>??AA?;;77;==977......+.+886;;=>;;;;;;;>><>>>?;96669966000064:<<;;;>>?AAAA<:::8;::555, @SRR005406.227 FB9GE3J10F5OGA length=74 TATTGACGACCAGTAAAATAATGTCGCGCAGGTGGCGTTTCAGCATCGACCATTAACCAAGCCAGTTAAAAGTT +SRR005406.227 FB9GE3J10F5OGA length=74 ?????>>?===:<922227--:<:<===??????8:8::><>>AA@@??===>?<<99234<??==><<<<<11 @SRR005406.228 FB9GE3J10GACJS length=240 TATTGACACGTACTGGTGGAGGCGGCTTAAAACGTGGCCGTGCCTTTACATCTCACCGTTTCCACGGTAAAACTAAAAACAACGCCGTCAATTGCGTAAAGCAAGCATGGTTGCAAAAGGCGATTACAAACGTATCCGCCAACAATTAGCAAGAATGAAATAAAACAACTCGGTGACTTTTAGATTACCGTCAAGAGAAACAAGATATTAGGAGGAATTCAACATGGCACGTGTTAAAGG +SRR005406.228 FB9GE3J10GACJS length=240 AAAABBBAAAAAA?@BA88:<9977=<<.3337<9:<::8>?BBBAAAAAAAAAAAAAAAA===?@?=755596*****0**6999=??@@@AAAAAAA???@@AAAA44448?????@?<<<??AA?A??AAAA?????;;;AAAAAAAAAAAAAA222?::::?77?AAAAAAAA??=;60......-------8---3.069;;;;;9334464,,,,,,055222222,,,002,, @SRR005406.229 FB9GE3J10F45GR length=281 TATTGACGTTGGATACTTTCTTTGCAGTCCGCGGGTATGTGCTAATAAAACGCCTAAAACATGTTCTGAGATAGAAACACTATGGATTCCGCTACCATTAGACAACAGAATGCCTTTTTCTCTTAATTTATCAAAATCCATATAATCAGCACCAGCAGAAATGAGCTGAATCCATTTTAGGTGACTAGTATCAGAGGCTAATAAACGCGGACCAATTTCTTTATGCCAGCCTAACATAATTTCGATTGCCTCTTCTTCAGCAGAGGATAAATGATCGGTAG +SRR005406.229 FB9GE3J10F45GR length=281 DDDDDDDDDDBBBBDDDDBB555??BDBBBBBBBDDCBCDDDDDEDDDDDBBBBDDD9997?DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD7788BBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBB5339///9<ACCCBB@CCCCC555999@@>::<<==>>>>>>>>>>>>><<<>><<<:666=<631 @SRR005406.230 FB9GE3J10GCSZU length=85 TATTGACGTTATTGGTCCCACAATGTTATTACTATCTAATGGAATCACAGATGCTATTGTTTGGTTATATAATGCAACTGGGTTC +SRR005406.230 FB9GE3J10GCSZU length=85 ?=?=>>=:<97779979933.77==???<<<????????=??=::9????=???=====12233//98=>>======79222006 @SRR005406.231 FB9GE3J10GFSGB length=60 TATTGACTAAAATAAGTACGGCGGATAATCCCCACCGATGACGAATATACATTTCTTTTG +SRR005406.231 FB9GE3J10GFSGB length=60 ??A?A@?<<<<<3++9:====:99=====999=4++48??AA???@???@?>>>=.,,,2 @SRR005406.232 FB9GE3J10F6851 length=139 TATTGACTAATAAGCGTATTTTAGCATTTGAAAAGAGAAGTTGTACATAATATGTGAATAAAAAGATTTGTTTCTTATTTTCTAGAGTGATAGGGCGATATAAAAAAGGTTGCTATTTTTTCGTTCAAAGTGAACAAAG +SRR005406.232 FB9GE3J10F6851 length=139 DDDDDDDDDDDDDDDDDD;8888DDDDDDD;<==EFFFHHIIIIIDDDDDDDDDDDDDDCCCCCDDDDDDBBBDDDD@@@@DDDDDDDDDDD===DDDDDD@@@AA@DDDDDDBA//////44++:<@B<<:<<<2224 @SRR005406.233 FB9GE3J10F487B length=291 TATTGACGAGTGGGGAAGATTTCGAAGAAAGTAAACCGGCGCCGGATATTTATCTGCACACGTTACAAGAATTAGCTGTTGCGCCACAGGAATGTATAGCCATTGAAGATTCAGAAAAAGGCATTGCCTCTGCCAAAGAAGCTGGGCTAGAAGTTTGGGCTATGCGCGATGAACACTTTGGGATGGATCAAAGTCAAGCGGATGCCTTCTTAACACAACTAAGTGATATTTAGTAAAAAAATTAGTGAAAATCGGATCGATGAAAGCAGTGAATCAACCCCTTGTAAGAAG +SRR005406.233 FB9GE3J10F487B length=291 DDDDDDDDDDDDDDD;;5@CED@;;;DDFFFE???FFGGGGFFFGDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBA</////44BCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBBBBBDDDDDDDCC;777@CCCBB777;BI>>>>>66@@/C==333137:::======>=========73333====3337??>>>> @SRR005406.234 FB9GE3J10GBCSB length=252 TATTGACTCAAAAACTTTTAAGTATCTGAACCCGACGAATTAATTCTAAATATCTAATATCGATTACCTAACTAAATTACACTAAGTTAATTAAATGTAGTATATAATCATTTAAAACTAATTAATTATTTAGTATAATGAAAGACAAGAGGTGATTGTATGTTAACCACAAAATCTAGAAAACAAGGAAGTTCTGTAGTATTGACATTACCATCTAACAACGGACAGAAACCAAAAGCAGACCAAGAATAT +SRR005406.234 FB9GE3J10GBCSB length=252 FFFFFFFEE77000;EF33::;:BEHFBBBBBHFFEEEEBBBBEEA;777BBFFFFFFFFFFEEEFFFFFFFFFFFEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEFFFFE=<<EEFFFFFFFFFFFFFFFEE===EEFFFFFFFFFFFFFFFFFFFEEEEEE;666EEFDD666;EEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGFFEEEEE@@<<6666<@EEEEEE@@@@@@@ @SRR005406.235 FB9GE3J10F70GW length=301 TATTGACGATATACCAGGAGAAACAACAGGAATTCAAAACAAGGACTTTAAGGATTCGTCTTCTGCGCCACAAGGCGGTAATCTTCTTGACCTATCTTTTGGGCAATATGATACCTATAGCGCCTTACAATTAGCACAGTACGTTTCCACTGTCGCAAATAATGGTATCCGCGTGCAACCCCATGTGGTAGAAGGAATCTATGGCAATGATGAAAATGGAGCTTTAGGAAAAATTTTAAAAGAAATTGAACCAAAAGTTTTGAATAAGGTGAATATTTCTGAAGACCAGATAGGAATTCTT +SRR005406.235 FB9GE3J10F70GW length=301 DDDDDDDDDDDDDDDDDDDD9988BDDDDDDD??@????B55??AA111>>55655ABDDDDDBBBDDBBBDDDDDD>???>?DDDDBBBDDDDDD>>>>D?????BBBBBDDDDDDDDDDDBB>>>>DDBBBDDDDDDDDDDBBB>>>>BDDDBB888>BDDDDDDDDDDDDDDBBBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDB<<<<B;999>CCCC@@;;;;;>>>>99<9C988<663333=<<<<;==6331666<<:11166::::<==><<<>>>>>>>>>>>>>>> @SRR005406.236 FB9GE3J10GGMYR length=240 TATTGACCCGAAGCTTTCTCTGCATGATGACCGGTTGATTGAAAGCGTTCTAAATAACTGAATTCACTATGATTATCTGCAACGATTAAAACATGTTTAAAGAAAGGTTGGTTGCTATCTGAATCCTGAATAAACAAAGATTCAATGGGCTCTTCAATCACTACGTTTTAGGAACGTATAAGAAACGCCACTATTCATGAAAGCTGCATGAGCTGCTGTCAGCTTATCTTCTCTGGTAAT +SRR005406.236 FB9GE3J10GGMYR length=240 >===<<999==:7222272==??A?ABBBBBB??BB?BBBB????????=8444848===;;;<>>??==>>????@=>>>>=>=7774446-99000006930066465555===>=>=>>====9994.....,,,.,449944....43333444797663.......33...66886600.06:33163333633----3666666999;;;;;888889988880,,,,,,22,, @SRR005406.237 FB9GE3J10GA6QP length=260 TATTGACTTCTGGGTTCAAAATTGCGATGCGTGACCTTTCCATTCGAGGGGCCGGAAACCTTCTTGGTGCCCAACAACATGGCTTCATTGATTCGGTTGGGTTTGATATGTACTCACAGATGTTATCTGAGGCAGTTGCTCGTAAACAAGGGAAAAATATCCAAGACCAAAAAACGTCTGTTGAAATTGATTTGGGCATTGATGCTTATATTCCAGGAACGTACATTACAGACGAACGACAAAAAATTGAAATTTATAAA +SRR005406.237 FB9GE3J10GA6QP length=260 FFFFFFFFFFFFFFFGGCEEEHHHHHHHHHIIIIIIHHHGGHHHHFF;;;;CCBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGG??????FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGG?????GGFFFFFFFFFIIIIIIFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFIIIGGGGGGGGGGIIIIIIIIIIIIIIII@AAAAAAAA@=;888 @SRR005406.238 FB9GE3J10GDQ75 length=90 TATTGACAGCTGTATCTAACAGTTCATTCCCTGTATTGAAATTTAAAAATGGGGCGTCAAGAATTTGTAATGAGACGTTTTTCTTGCTTC +SRR005406.238 FB9GE3J10GDQ75 length=90 AAAAAAAAAAAAAAAAAAEAIIIFFFFFBIIIFAB???>>>800,,,,,0....2*26<<===>?<<599=>>?=97511116**00000 @SRR005406.239 FB9GE3J10F5XU4 length=70 TATTGACGTTAAGTTACCGAGAATACTTATTTAGTACATATACTGTATTTACACAATTTGGCTTTCTAAT +SRR005406.239 FB9GE3J10F5XU4 length=70 AAAAAAAA@@??A888@@????????AAAAAAABAAEAEFFFFIIAAAAAAAAA???><=990006,226 @SRR005406.240 FB9GE3J10GA2UR length=210 TATTGACAAGCTGAAACAGAAGAACACCTCCGCTTGAAGCAGCTTTTTGCGGAAAAGTGTTTACGCGAAAAGCTGTCCTTTCAAGTTGAGGCATACTTACCCACCTTGAAGCAACGCCCAGATTTACTCATTGGCAAGATAGCCATTGAAATTCAATGTAGCCCATTGCCAATTAAACGTTTGGTGGAACGGACAGAGACTTATCAAGCT +SRR005406.240 FB9GE3J10GA2UR length=210 FFFFFFFFFFFFFFFFFFIIHHGHHFHFHGGHIHHHHHHHHHHEHIIEGGGFFFFFGIGFFFFFFFFCCCCGGFFFFFFFFGGGFFFFGGGFFFFFFFFFFFFGGGGFFFFFFFFFGGGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF @SRR005406.241 FB9GE3J10GEMB1 length=290 TATTGACTAAGCACAATAAGCAGTAAGCTGCCACCAATAAAGCCAATTTTCTTGTATCTACTTAATTTTTCCATATTATACATTGTTCTTATTGGTTCCTTTCTTTTTAGTTTAGGCGCATAAAGTATTCGCCTGCTTCTTTTTTTAAGACACGCCAATTCATGGAATACTCACCACTGACATTCATTTCAGAAATGACAAAACTTCCATCAGAGTTTACATGCTCCACATAAGCTACGTGTCCATATTGCGTACTAGAACCAGCTACACCATTTGTAAAAATAACAGCA +SRR005406.241 FB9GE3J10GEMB1 length=290 EEEEEEEEEEEEEEEEEEGGGIIGGGGGGIGGEEEGGGAAAGGGGEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDEEEEEEEEEEEA;111=DEEEEEEEEEEEEEEEEEEEEEEEECCCCCCCEEDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEED@@@DEEEEAC1116@77777DEEEEEEDDDBBBDDDDDDDDDDDDDDDDDDDDDDD@@@@@:::::@@@@@@@@@@@@@@@@@@@=:777==71///6;99 @SRR005406.242 FB9GE3J10F5H2N length=103 TATTGACAGCAATTGCTTGGATGCGCGTTCGTGTTTCTTCAGTTACCTTTGAACTACCATTCAATGCGTAAGAAACGGTCGAGATTGATACGCCTGCTTTTTT +SRR005406.242 FB9GE3J10F5H2N length=103 AAAAAAAAAAAAAAAAAAEEEFFFFFFFFAFAA:::B;>?AA???@@???AAAAAAAAAAAAAAAAAAAAAAAAA===AAAAAAAAAAAAAAAAAAA566643 @SRR005406.243 FB9GE3J10F5HV5 length=244 TATTGACTGAACAAGTACCAAACAAGAGTTCTATTATTTGTTGCATCGAAAGACGGCATTCAAAGAAAATTTCAAAGAAGAAACGGGAGAGGAATTAACTAGTAAAACGTATTCTTTAAAGAAATTTCAGCAAGTGAACAACCAAAATAGAAATAAAGTAAAGATTCTCTAAAAGAGATTTAGAGAATGAGCGGCGATCTATTGGCCTAGAAGAAAATCTTACACCATTTATTACATGAAGAAG +SRR005406.243 FB9GE3J10F5HV5 length=244 ;777<<=9222255;8022000503:8<:::99777111804<<==9222272<<::;:88000204,,00020002,,00000000,0<66000088<::90....437-3.......44,,,...444444843444......224*.....,,,.3,,+.+..623.....4+33...6633...4633------3--------33863311-,,,,,,2,,,,,2,,**,2,,,2,,,,, @SRR005406.244 FB9GE3J10GFX03 length=236 TATTGACTAACGATTGATCAGTTCGGGCGTTGTTCGCTTGAAAATTTGCATAGCCGGATAAACGTTTTGTCACTCCTGCCCATTCTTCAGAATAATAGTTTTTAGGTCCACGTTCATCAAATTCCACTAACTGAATTTGTTGATCCTTAACAACGACATCAATTAAAGCCGTATAGCCGCCATCAAACACGACTTCATGATGATAATAATCCCCTTGAACTTCTCCGATTTCTGGA +SRR005406.244 FB9GE3J10GFX03 length=236 FFFFFFFFFFFFFFFFFFHHHHHHEEEGEEEFFFHFHHHHHHHHHFFFFFFFFGGGGFFBBBFFBBBBBBGFFFFFFFFFFFFFFGGGFFFFFFFFFFFFFFFFCCCGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFIIIIIIIIIIIIIIIIGGGI @SRR005406.245 FB9GE3J10GGAR8 length=275 TATTGACTGTTCGAGGGTTTTGAGGATTTTCAAAGACTTGCTCTGGCGAACCATCTTCTAGGAAGTTACCGCCATCAATGAACATTACTCGATTAGCCACTTCTTTTGCAAAGCCCATTTCGTGAGTAACGATGACCATTGTCATTCCTTGTTTTGCTAAATCTTTCATTACACCAAGAACATCGCCAACCATTTCTGGATCAAGGGCTGATGTTGGCTCATCGAAAAGCATGATATCAGGATTCATCGCTAACGCACGTGCAATTGCGACTACG +SRR005406.245 FB9GE3J10GGAR8 length=275 FFFFFFFFGGEECC5553333===EEHHIHHHHHHGIIIIIIIHHFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBBBBFFFFFFCCCFFFFFFFFFFFFFFFFFFCCCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGFGGGFFFFFFFFFFFFFFFFFFFFFIIIIIIIIIIIIIIIIIIIIIIGGGGGGGAAAAAAAAAAAAAAAAA@@@@AAAAAA=:: @SRR005406.246 FB9GE3J10GD918 length=187 TATTGACAAAATTATTTATTTCTTTTTTTTGTCTTTTCATGCAATTTCCCAGTATTTAAATAAATAATCCCTAGGAAAAGGACAGGGGTTACAACAAACCCAAACTGTGGCTTCAAAAACATCATTGCAAACATTGAGAATAGTAAAAAAACATTTAGACAGCTGACATACCATTTCCGCAGTCCAT +SRR005406.246 FB9GE3J10GD918 length=187 AAAAAA@==;622*0000,,,300000000<'8....69>>>>>344==AAAAA?AAAAA666<?<;<422:9998888??5@???AAAA=888AAAAAAAA===??=??===6122228,@@@@@AAAAAAAAAAAAAAAAAA3333322?*?;;;AAAAAAAAAAAAAA@?222766...4444. @SRR005406.247 FB9GE3J10F6C1H length=324 TATTGACACTTAGGCAACGTTTCTTCTAAAGATTTAGCTGCAAAAGAAAAAGAAGTAGACCAACTACAAAAAGAACAAGCGAAAAAGATTGCCCAACAAGCAGCTGAATTAAAAGCCAAAAATGAAAAAATTGCCAAAGAAAATGCAGAAATTGCGGCAAAAAACAAAGCGGAAAAGAACGTTATGAAAAAGAAGTCGCTGAATACAACAAGCATAAGAACGAAAACAGCTATGTCAATGAAGCGATTAGTAAAAACCTAGTGTTCGATCAATCTGTCGTGACGAAAGACACGAAAATTTCGTCGATTAAAGGCGGAAAATTTA +SRR005406.247 FB9GE3J10F6C1H length=324 FFFFFFFFFFFFFFIIIGHIIHFFFFGDDDHIIIIHHHHHHIIIHFBBBBBFFFFFFFFFFFFFFFG===;;CAFFFFFCA07770AAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEEFG77777;GGFFFFFFFFFFFFFFFFFFFFFFFFFF7777707<<<FF==77;;BGFFFFFFFG;;;;;BGFFFFFFFFFFFFFFFFFFFFFFFEGEEFB>>>>BEGGGGGGIIIIIIIIIIG@:::@@???7777::@@@AAAAAAAAAAAAAAAAAAAAAAAA???@@===::311:;<<@B...1.88B;;........ @SRR005406.248 FB9GE3J10GA69A length=294 TATTGACGGAGAAATTCACATGTTGGAAGCGACAGCAGAAGCGATCCAGACCCAAATGATTAAAAAAGGTGAAGTATTACAGGTAGCAAGAGTAGCTGGGATTACCGCCGCAAAACGAACGTTTGAATGGATTCCTTTGTGTCATTTGGTTGCTTTGACAAAGTGTGAAATTCAGTTTGATTGGCGCAATCAAACTTGTTTAGAAGTACGTTGCTTTACAAAAACAGTGGGTTCAACTGGCGTTGAAATGGAAGCGCTAACAGGTGTGCAGGCAGCACTCTTAACAATTTATGA +SRR005406.248 FB9GE3J10GA69A length=294 FFFFFFFFFFFFFFFFFFIIIIIIIIIIIIIIIIIIIIIIIIIIIFFFFFFFFFFFFFFCC055555CCFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGFFFFFFFFFFFFFFFFFFFFFGGGFFFFFFFFFFFGC@@@GFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFIGGGGEEEGGFF>>>BBGGGGGGGGGGGGAAAA@@@@AAAA???@@AAAAAAAAAAAAAAA@@@33333=A11187BB @SRR005406.249 FB9GE3J10GBPSH length=286 TATTGACATAAAGCTGTAGAAGAAATTGGCTTAAAAGATGTGGTAACGCAAGTGGGTGACCGCTATGTTGTAGAAGAAATGCGTAAAAATGATTACAATTTTGGTGGCGAACAATCTGGTCACATGATCTTTTTTAGATTACAACACAACAGGTGATGGCATGCTTTCAGGGATTCAATTGTTGAATGTTATGAAGCAAACGGGCAAAAATTATCTGAATTAGCGGATGAAGTGACGATTTATCCACAAAAATTAGTCAATATTCGTGTCACAGATAAAAATGGTG +SRR005406.249 FB9GE3J10GBPSH length=286 FFFFFFFFF@@@FFFFFFHHHHGHHHHHHHHHHHHEEEHHHHHHHFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGFFFFF?????FFFFFFFFFCCCCCCBGGFFFFFFFFFFFFFFFFFFFFF@0000007AFFFFFFFFFFFFFFFFFFFFFFFFFFG@@@GFFFFFFFFFFFFGGGFFFFFFFFFFFFFFFFFFFGCC77777GGGFFFEEGGGGIIIIGGGGGGGIIIIIIIIGGGGAA@@@@@AAA@@@AAAAAAAAAAAAAAAAAA@@@@@@AA@@ @SRR005406.250 FB9GE3J10F6I2T length=302 TATTGACAATTGTAAGACCACTAAGGATTTTTGGGCGGCAGCGACTTGGAGCTCTTGTAAAAGCGCACTGCGTTCCTTTTCTTTATTCTTTTGATCTTGAGAATCTTCTAAAAATGCCGAAAAGAAATGTTGGGAAGAGAGCGTAATCAGTTTAGAAATGCTCTTGATGGTAGCTTTATGTTGATCCATTCTTCTGCCTCCTTTACGAATAAAATAGAATAAAACTCAAATGACTAATTACCTGTATTTTACCTAATTTTGTGATAAAATTCAAGAAAATATGTTCGCCTTCAATAATTATG +SRR005406.250 FB9GE3J10F6I2T length=302 FFFFFFFFFFFIGIIFFFHHIHHHHHFBBBBBHHC>==GHHHHHHFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGG>>>CGFFBBBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGFFFFFFFFFFFFFFFFFFFFFFFFCCCGGFFFFFFFFFFIIIIGGGGIIIGGGIIIIIIIIIIGGGGGA::::??@AA@@@@@@@@@4444477@@@@@@@@AA@A@@@@@@:::==?????@@A --- test/test_data/fastq_parser/test2_solexa.fastq --- @SLXA-B3_649_FC8437_R1_1_1_610_79 GATGTGCAATACCTTTGTAGAGGAA + YYYYYYYYYYYYYYYYYYWYWYYSU @SLXA-B3_649_FC8437_R1_1_1_397_389 GGTTTGAGAAAGAGAAATGAGATAA + YYYYYYYYYWYYYYWWYYYWYWYWW @SLXA-B3_649_FC8437_R1_1_1_850_123 GAGGGTGTTGATCATGATGATGGCG +SLXA-B3_649_FC8437_R1_1_1_850_123 YYYYYYYYYYYYYWYYWYYSYYYSY @SLXA-B3_649_FC8437_R1_1_1_362_549 GGAAACAAAGTTTTTCTCAACATAG +SLXA-B3_649_FC8437_R1_1_1_362_549 YYYYYYYYYYYYYYYYYYWWWWYWY @SLXA-B3_649_FC8437_R1_1_1_183_714 GTATTATTTAATGGCATACACTCAA +SLXA-B3_649_FC8437_R1_1_1_183_714 YYYYYYYYYYWYYYYWYWWUWWWQQ --- test/test_data/fastq_parser/test3_illumina.fastq --- @FC12044_91407_8_200_406_24 GTTAGCTCCCACCTTAAGATGTTTA +FC12044_91407_8_200_406_24 SXXTXXXXXXXXXTTSUXSSXKTMQ @FC12044_91407_8_200_720_610 CTCTGTGGCACCCCATCCCTCACTT +FC12044_91407_8_200_720_610 OXXXXXXXXXXXXXXXXXTSXQTXU @FC12044_91407_8_200_345_133 GATTTTTTAACAATAAACGTACATA +FC12044_91407_8_200_345_133 OQTOOSFORTFFFIIOFFFFFFFFF @FC12044_91407_8_200_106_131 GTTGCCCAGGCTCGTCTTGAACTCC +FC12044_91407_8_200_106_131 XXXXXXXXXXXXXXSXXXXISTXQS @FC12044_91407_8_200_916_471 TGATTGAAGGTAGGGTAGCATACTG +FC12044_91407_8_200_916_471 XXXXXXXXXXXXXXXUXXUSXXTXW @FC12044_91407_8_200_57_85 GCTCCAATAGCGCAGAGGAAACCTG +FC12044_91407_8_200_57_85 XFXMXSXXSXXXOSQROOSROFQIQ @FC12044_91407_8_200_10_437 GCTGCTTGGGAGGCTGAGGCAGGAG +FC12044_91407_8_200_10_437 USXSXXXXXXUXXXSXQXXUQXXKS @FC12044_91407_8_200_154_436 AGACCTTTGGATACAATGAACGACT +FC12044_91407_8_200_154_436 MKKMQTSRXMSQTOMRFOOIFFFFF @FC12044_91407_8_200_336_64 AGGGAATTTTAGAGGAGGGCTGCCG +FC12044_91407_8_200_336_64 STQMOSXSXSQXQXXKXXXKFXFFK @FC12044_91407_8_200_620_233 TCTCCATGTTGGTCAGGCTGGTCTC +FC12044_91407_8_200_620_233 XXXXXXXXXXXXXXXXXXXXXSXSW @FC12044_91407_8_200_902_349 TGAACGTCGAGACGCAAGGCCCGCC +FC12044_91407_8_200_902_349 XMXSSXMXXSXQSXTSQXFKSKTOF @FC12044_91407_8_200_40_618 CTGTCCCCACGGCGGGGGGGCCTGG +FC12044_91407_8_200_40_618 TXXXXSXXXXXXXXXXXXXRKFOXS @FC12044_91407_8_200_83_511 GATGTACTCTTACACCCAGACTTTG +FC12044_91407_8_200_83_511 SOXXXXXUXXXXXXQKQKKROOQSU @FC12044_91407_8_200_76_246 TCAAGGGTGGATCTTGGCTCCCAGT +FC12044_91407_8_200_76_246 XTXTUXXXXXRXXXTXXSUXSRFXQ @FC12044_91407_8_200_303_427 TTGCGACAGAGTTTTGCTCTTGTCC +FC12044_91407_8_200_303_427 XXQROXXXXIXFQXXXOIQSSXUFF @FC12044_91407_8_200_31_299 TCTGCTCCAGCTCCAAGACGCCGCC +FC12044_91407_8_200_31_299 XRXTSXXXRXXSXQQOXQTSQSXKQ @FC12044_91407_8_200_553_135 TACGGAGCCGCGGGCGGGAAAGGCG +FC12044_91407_8_200_553_135 XSQQXXXXXXXXXXSXXMFFQXTKU @FC12044_91407_8_200_139_74 CCTCCCAGGTTCAAGCGATTATCCT +FC12044_91407_8_200_139_74 RMXUSXTXXQXXQUXXXSQISISSO @FC12044_91407_8_200_108_33 GTCATGGCGGCCCGCGCGGGGAGCG +FC12044_91407_8_200_108_33 OOOSSXXSXXOMKMOFMKFOKFFFF @FC12044_91407_8_200_980_965 ACAGTGGGTTCTTAAAGAAGAGTCG +FC12044_91407_8_200_980_965 TOSSRXXXSSMSXMOMXIRXOXFFS @FC12044_91407_8_200_981_857 AACGAGGGGCGCGACTTGACCTTGG +FC12044_91407_8_200_981_857 RXMSSXXXXSXQXQXFSXQFQKMXS @FC12044_91407_8_200_8_865 TTTCCCACCCCAGGAAGCCTTGGAC +FC12044_91407_8_200_8_865 XXXFKOROMKOORMIMRIIKKORFF @FC12044_91407_8_200_292_484 TCAGCCTCCGTGCCCAGCCCACTCC +FC12044_91407_8_200_292_484 XQXOSXXXXXUXXXXIXXXXQTOXF @FC12044_91407_8_200_675_16 CTCGGGAGGCTGAGGCAGGGGGGTT +FC12044_91407_8_200_675_16 OXTXXXSXXQXXOXXKMXXMXOKQF @FC12044_91407_8_200_285_136 CCAAATCTTGAATTGTAGCTCCCCT +FC12044_91407_8_200_285_136 OSXOQXXXXXSXXUXXTXXXXTRMS --- test/test_data/fastq_parser/wrapping_as_illumina.fastq --- @SRR014849.50939 EIXKN4201BA2EC length=135 GAAATTTCAGGGCCACCTTTTTTTTGATAGAATAATGGAGAAAATTAAAAGCTGTACATATACCAATGAACAATAAATCAATACATAAAAAAGGAGAAGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGG + Zb^Ld`N\[d`NaZ[aZc]UOKHDA[\YT[_W[aZ\aZ[Zd`SF_WeaUI[Y\[[\\\[\Z\aY`X[[aZ\aZ\d`OY[aY[[\[[e`WPJC^UZ[`X\[R]T_V_W[`[Ga\I`\H[[Q^TVa\Ia\Ic^LY\S @SRR014849.110027 EIXKN4201APUB0 length=131 CTTCAAATGATTCCGGGACTGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTTCGGTTCCAACTCGCCGTCCGAATAATCCGTTCAAAATCTTGGCCTGTCAAAACGACTTTACGACCAGAACGATCCG + \aYY_[FY\T`X^Vd`OY\[[^U_V[R^T[_ZDc^La\HYYO\S[c^Ld`Nc_QAZaZaYaY`XZZ\[aZZ[aZ[aZ[aZY`Z[`ZWeaVJ\[aZaY`X[PY\eaUG[\[[d`OXTUZ[Q\\`W\\\Y_W\ @SRR014849.203935 EIXKN4201B4HU6 length=144 AACCCGTCCCATCAAAGATTTTGGTTGGAACCCGAAAGGGTTTTGAATTCAAACCCCTTTCGGTTCCAACTATTCAATTGTTTAACTTTTTTTAAATTGATGGTCTGTTGGACCATTTGTAATAATCCCCATCGGAATTTCTTT + `Z_ZDVT^YB[[Xd`PZ\d`RDaZaZ`ZaZ_ZDXd`Pd`Pd`RD[aZ`ZWd`Oc_RCd`P\aZ`ZaZaZY\YaZYaY`XYd`O`X[e`WPJEAc^LaZS[YYN[Z\Y`XWLT^U\b]JW[[RZ\SYc`RD[Z\WLXM`\HYa\I --- test/test_data/fastq_parser/wrapping_as_sanger.fastq --- @SRR014849.50939 EIXKN4201BA2EC length=135 GAAATTTCAGGGCCACCTTTTTTTTGATAGAATAATGGAGAAAATTAAAAGCTGTACATATACCAATGAACAATAAATCAATACATAAAAAAGGAGAAGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGG + ;C?-EA/=<EA/B;<B;D>60,)%"<=:5<@8<B;=B;<;EA4'@8FB6*<:=<<===<=;=B:A9<<B;=B;=EA0:<B:<<=<<FA81+$?6;<A9=<3>5@7@8<A<(B=*A=)<<2?57B=*B=*D?-:=4 @SRR014849.110027 EIXKN4201APUB0 length=131 CTTCAAATGATTCCGGGACTGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTTCGGTTCCAACTCGCCGTCCGAATAATCCGTTCAAAATCTTGGCCTGTCAAAACGACTTTACGACCAGAACGATCCG + =B::@<':=5A9?7EA0:=<<?6@7<3?5<@;%D?-B=)::0=4<D?-EA/D@2";B;B:B:A9;;=<B;;<B;<B;<B;:A;<A;8FB7+=<B;B:A9<1:=FB6(<=<<EA0956;<2==A8===:@8= @SRR014849.203935 EIXKN4201B4HU6 length=144 AACCCGTCCCATCAAAGATTTTGGTTGGAACCCGAAAGGGTTTTGAATTCAAACCCCTTTCGGTTCCAACTATTCAATTGTTTAACTTTTTTTAAATTGATGGTCTGTTGGACCATTTGTAATAATCCCCATCGGAATTTCTTT + A;@;%75?:#<<9EA1;=EA3%B;B;A;B;@;%9EA1EA1EA3%<B;A;8EA0D@3$EA1=B;A;B;B;:=:B;:B:A9:EA0A9<FA81+&"D?-B;4<::/<;=:A98-5?6=C>+8<<3;=4:DA3%<;=8-9.A=):B=* --- test/test_data/fastq_parser/wrapping_as_solexa.fastq --- @SRR014849.50939 EIXKN4201BA2EC length=135 GAAATTTCAGGGCCACCTTTTTTTTGATAGAATAATGGAGAAAATTAAAAGCTGTACATATACCAATGAACAATAAATCAATACATAAAAAAGGAGAAGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGG + Zb^Ld`N\[d`NaZ[aZc]UOKGB;[\YT[_W[aZ\aZ[Zd`SE_WeaUH[Y\[[\\\[\Z\aY`X[[aZ\aZ\d`OY[aY[[\[[e`WPJ@^UZ[`X\[R]T_V_W[`[Fa\H`\G[[Q^TVa\Ha\Hc^LY\S @SRR014849.110027 EIXKN4201APUB0 length=131 CTTCAAATGATTCCGGGACTGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTTCGGTTCCAACTCGCCGTCCGAATAATCCGTTCAAAATCTTGGCCTGTCAAAACGACTTTACGACCAGAACGATCCG + \aYY_[EY\T`X^Vd`OY\[[^U_V[R^T[_ZBc^La\GYYO\S[c^Ld`Nc_Q;ZaZaYaY`XZZ\[aZZ[aZ[aZ[aZY`Z[`ZWeaVJ\[aZaY`X[PY\eaUF[\[[d`OXTUZ[Q\\`W\\\Y_W\ @SRR014849.203935 EIXKN4201B4HU6 length=144 AACCCGTCCCATCAAAGATTTTGGTTGGAACCCGAAAGGGTTTTGAATTCAAACCCCTTTCGGTTCCAACTATTCAATTGTTTAACTTTTTTTAAATTGATGGTCTGTTGGACCATTTGTAATAATCCCCATCGGAATTTCTTT + `Z_ZBVT^Y>[[Xd`PZ\d`RBaZaZ`ZaZ_ZBXd`Pd`Pd`RB[aZ`ZWd`Oc_R@d`P\aZ`ZaZaZY\YaZYaY`XYd`O`X[e`WPJC;c^LaZS[YYN[Z\Y`XWLT^U\b]JW[[RZ\SYc`RB[Z\WLXM`\GYa\H --- test/test_fastq_record.mojo --- from MojoFastTrim import FastqRecord from MojoFastTrim.helpers import get_next_line from testing import assert_equal, assert_false, assert_true fn get_fastq_records() raises -> DynamicVector[Tensor[DType.int8]]: var vec = DynamicVector[Tensor[DType.int8]](capacity=4) let f = open("data/fastq_test.fastq", "r") let t = f.read_bytes() var offset = 0 for i in range(4): let line = get_next_line(t, offset) vec.push_back(line) offset += line.num_elements() + 1 return vec fn valid_fastq_record() raises: let valid_vec = get_fastq_records() var read = FastqRecord(valid_vec[0], valid_vec[1], valid_vec[2], valid_vec[3]) assert_false(len(read) == 0) assert_false(len(read.__str__()) == 0) read._empty_record() assert_true(len(read) == 0) assert_true(len(read.__str__()) == 0) fn invalid_record() raises: # Add tests here pass fn main() raises: valid_fastq_record() --- test/test_helpers.mojo --- from tensor import Tensor from random.random import rand from testing.testing import assert_true, assert_false, assert_equal, assert_not_equal from blazeseq.helpers import * alias T = DType.int8 fn test_tensor[T: DType](num_ele: Int) -> Tensor[T]: var test_tensor = Tensor[T](num_ele) rand[T](test_tensor._ptr, num_ele) return test_tensor fn test_find_chr_next_occurance_simd() raises: var in_tensor = Tensor[T](50) in_tensor[40] = 10 var result_happy = find_chr_next_occurance_simd(in_tensor, chr=10, start=0) var result_not_found = find_chr_next_occurance_simd(in_tensor, chr=80, start=0) assert_equal(result_happy, 40) assert_equal(result_not_found, -1) fn test_find_chr_next_occurance_simd_short_tensor() raises: var in_tesnor = Tensor[T](5) in_tesnor[4] = 64 var result_happy = find_chr_next_occurance_simd(in_tesnor, 64) var result_not_found = find_chr_next_occurance_simd(in_tesnor, 10) assert_equal(result_happy, 4) assert_equal(result_not_found, -1) # fn test_find_chr_all_occurances_short_tensor() raises: # var in_tesnor = Tensor[T](5) # in_tesnor[1] = 10 # in_tesnor[4] = 10 # var x = find_chr_all_occurances(in_tesnor, 10) # assert_equal(len(x), 2) # assert_equal(x[0], 1) # assert_equal(x[1], 4) # fn test_find_chr_all_occurances_long_tensor() raises: # var in_tensor = Tensor[T](500) # in_tensor[100] = 10 # in_tensor[105] = 10 # in_tensor[300] = 10 # in_tensor[200] = 10 # in_tensor[201] = 10 # var x = find_chr_all_occurances(in_tensor, 10) # assert_equal(len(x), 5) # assert_equal(x[0], 100) # assert_equal(x[1], 105) # assert_equal(x[2], 200) # assert_equal(x[3], 201) # assert_equal(x[4], 300) # var x2 = find_chr_all_occurances(in_tensor, 0) # assert_equal(len(x2), 495) fn test_find_last_read_header() raises: var in_tensor = Tensor[T](50) in_tensor[30] = 10 in_tensor[31] = 64 in_tensor[44] = 64 in_tensor[46] = 64 in_tensor[35] = 64 var last = find_last_read_header(in_tensor) assert_equal(last, 31) fn test_find_last_read_header_last() raises: var in_tensor = Tensor[T](50) in_tensor[49] = 64 in_tensor[48] = 10 var last = find_last_read_header(in_tensor) assert_equal(last, 49) fn main() raises: test_find_chr_next_occurance_simd() test_find_chr_next_occurance_simd_short_tensor() # test_find_chr_all_occurances_short_tensor() # test_find_chr_all_occurances_long_tensor() test_find_last_read_header() test_find_last_read_header_last() --- test/test_iostream.mojo --- --- test/test_record_parser.mojo --- """Testing for the parser on test suite of valid and invalid FASTQ files used for testing by BioJava, BioPerl, and Biopython projects. File were downloaded from BioJava. 'https://github.com/biojava/biojava/tree/master/biojava-genome%2Fsrc%2Ftest%2Fresources%2Forg%2Fbiojava%2Fnbio%2Fgenome%2Fio%2Ffastq' Truncated files were padded with 1, 2, or 3, extra line terminators to prevent `EOF` errors and to allow for record validation using the `validate_record` function. Multi-line FASTQ tests are removed as Blazeseq does not support multi-line FASTQ. """ from blazeseq import RecordParser from testing import assert_raises alias test_dir = "test/test_data/fastq_parser/" alias corrput_qu_score = "Corrput quality score according to proivded schema" alias EOF = "EOF" alias cor_len = "Corrput Lengths" alias cor_seq_hed = "Sequence Header is corrupt" alias cor_qu_hed = "Quality Header is corrupt" alias non_mat_hed = "Non matching headers" fn test_invalid_file(file: String, msg: String = "") raises: with assert_raises(contains=msg): var parser = RecordParser(test_dir + file) parser.parse_all() fn test_valid_file(file: String, schema: String = "generic") raises: var parser = RecordParser[validate_ascii=True, validate_quality=True]( test_dir + file, schema ) try: parser.parse_all() except Error: var err_msg = Error._message() if err_msg == "EOF": pass else: print(err_msg) print(file) raise fn test_valid() raises: test_valid_file("example.fastq") test_valid_file("illumina_example.fastq", "illumina_1.3") test_valid_file("illumina_faked.fastq", "illumina_1.3") test_valid_file("illumina_full_range_as_illumina.fastq", "illumina_1.3") test_valid_file("illumina_full_range_as_sanger.fastq", "sanger") test_valid_file("illumina_full_range_as_solexa.fastq", "solexa") test_valid_file("illumina_full_range_original_illumina.fastq", "illumina_1.3") test_valid_file("longreads_as_illumina.fastq", "illumina_1.3") test_valid_file("longreads_as_sanger.fastq", "sanger") test_valid_file("longreads_as_solexa.fastq", "solexa") test_valid_file("misc_dna_as_illumina.fastq", "illumina_1.3") test_valid_file("misc_dna_as_sanger.fastq", "sanger") test_valid_file("misc_dna_as_solexa.fastq", "solexa") test_valid_file("misc_dna_original_sanger.fastq", "sanger") test_valid_file("misc_rna_as_illumina.fastq", "illumina_1.3") test_valid_file("misc_rna_as_sanger.fastq", "sanger") test_valid_file("misc_rna_as_solexa.fastq", "solexa") test_valid_file("misc_rna_original_sanger.fastq", "sanger") test_valid_file("sanger_93.fastq", "sanger") test_valid_file("sanger_faked.fastq", "sanger") test_valid_file("sanger_full_range_as_illumina.fastq", "illumina_1.3") test_valid_file("sanger_full_range_as_sanger.fastq", "sanger") test_valid_file("sanger_full_range_as_solexa.fastq", "solexa") test_valid_file("sanger_full_range_original_sanger.fastq", "sanger") test_valid_file("solexa_example.fastq", "solexa") test_valid_file("solexa_faked.fastq", "solexa") test_valid_file("solexa_full_range_as_illumina.fastq", "illumina_1.3") test_valid_file("solexa_full_range_as_sanger.fastq", "sanger") test_valid_file("solexa_full_range_as_solexa.fastq", "solexa") test_valid_file("solexa_full_range_original_solexa.fastq", "solexa") test_valid_file("test1_sanger.fastq", "sanger") test_valid_file("test2_solexa.fastq", "solexa") test_valid_file("test3_illumina.fastq", "illumina_1.3") test_valid_file("wrapping_as_illumina.fastq", "illumina_1.3") test_valid_file("wrapping_as_sanger.fastq", "sanger") test_valid_file("wrapping_as_solexa.fastq", "solexa") fn test_invalid() raises: test_invalid_file("empty.fastq", EOF) test_invalid_file("error_diff_ids.fastq", non_mat_hed) test_invalid_file("error_long_qual.fastq", cor_len) test_invalid_file("error_no_qual.fastq", cor_len) test_invalid_file("error_trunc_in_plus.fastq", cor_len) test_invalid_file("error_trunc_at_qual.fastq", cor_len) test_invalid_file("error_double_qual.fastq", cor_seq_hed) test_invalid_file("error_trunc_at_seq.fastq", cor_qu_hed) test_invalid_file("error_trunc_in_seq.fastq", cor_qu_hed) test_invalid_file("error_trunc_in_title.fastq", cor_qu_hed) test_invalid_file("error_double_seq.fastq", cor_qu_hed) test_invalid_file("error_trunc_at_plus.fastq", cor_qu_hed) test_invalid_file("error_qual_null.fastq", corrput_qu_score) test_invalid_file("error_qual_space.fastq", corrput_qu_score) test_invalid_file("error_spaces.fastq", corrput_qu_score) test_invalid_file("error_qual_vtab.fastq", corrput_qu_score) test_invalid_file("error_tabs.fastq", corrput_qu_score) test_invalid_file("error_qual_tab.fastq", corrput_qu_score) test_invalid_file("error_qual_del.fastq", corrput_qu_score) test_invalid_file("error_qual_escape.fastq", corrput_qu_score) test_invalid_file("solexa-invalid-description.fastq", cor_seq_hed) test_invalid_file("solexa-invalid-repeat-description.fastq", cor_qu_hed) test_invalid_file("sanger-invalid-description.fastq", cor_seq_hed) test_invalid_file("sanger-invalid-repeat-description.fastq", cor_qu_hed) test_invalid_file("illumina-invalid-description.fastq", cor_seq_hed) test_invalid_file("illumina-invalid-repeat-description.fastq", cor_qu_hed) test_invalid_file("error_qual_unit_sep.fastq", corrput_qu_score) test_invalid_file("error_short_qual.fastq", cor_len) test_invalid_file("error_trunc_in_qual.fastq", cor_len) fn main() raises: test_invalid() test_valid() --- test/tests.mojo --- from sys import external_call from collections import List from os import listdir fn main() raises: var test_files: List[String] = listdir("/home/") var valid_files: List[String] = List[String]() for file_str in test_files: var tmp = file_str[] if tmp != String("tests.mojo") and tmp.endswith(".mojo"): valid_files.append(tmp) for test_file in valid_files: var thrown_away = external_call["system", Int, StringRef]( (String("mojo run /home/") + test_file[])._strref_dangerous() ) --- README.md --- # This is a script to install the mojo programming language on Archlinux and Fedora. Since mojo needs a version of ncurses that is not available on normal way on Arch, you need to do some extra steps to get mojo working. ## Arch Installation You can install mojo either with an AUR helper like `yay` or `paru` by installing the `mojo` package or doing it manually with the following command. ```bash python <(curl -sSL https://raw.githubusercontent.com/Sharktheone/arch-mojo/main/src/install.py) ``` <details> <summary> ### Options: </summary> Install mojo globally: ```bash python <(curl -sSL https://raw.githubusercontent.com/Sharktheone/arch-mojo/main/src/install.py) --global ``` Change working directory: ```bash python <(curl -sSL https://raw.githubusercontent.com/Sharktheone/arch-mojo/main/src/install.py) --dir=/tmp/arch-mojo ``` </details> ## Fedora Installation First install modular with the official instructions [Modular](https://developer.modular.com/download) ```bash python <(curl -sSL https://raw.githubusercontent.com/Sharktheone/arch-mojo/main/src/install.py) --fedora ``` <details> <summary> ### Options: </summary> Install mojo globally: ```bash python <(curl -sSL https://raw.githubusercontent.com/Sharktheone/arch-mojo/main/src/install.py) --global --fedora ``` Change working directory: ```bash python <(curl -sSL https://raw.githubusercontent.com/Sharktheone/arch-mojo/main/src/install.py) --dir=/tmp/arch-mojo --fedora ``` </details> ### Missing shared libs You might get an error about a missing shared library `libpanel.so.6` when mojo is self testing. That's because modular and python ignores the `LD_LIBRARY_PATH` environment variable. If you use `mojo` itself it should be set (after you restarted your terminal). If not add it to your `.bashrc` or `.zshrc`: ```bash export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.local/lib/arch-mojo ``` --- aur/modular/.SRCINFO --- pkgbase = modular pkgdesc = Modular installation tool - Repository: https://github.com/Sharktheone/arch-mojo pkgver = 0.9.2 pkgrel = 2 url = https://developer.modular.com/download install = modular.install arch = x86_64 license = custom:modular depends = python depends = python-pip depends = libxml2 depends = mojo-libs source = https://dl.modular.com/public/installer/deb/debian/pool/any-version/main/m/mo/modular_0.9.2/modular-v0.9.2-amd64.deb sha256sums = fabfe388c31e50bf684b321ad314e09fc348aefe2fd8da9fd33f32e3a98058d2 pkgname = modular --- aur/modular/PKGBUILD --- #Maintainer: Sharktheone <[email protected]> #Contributor: Janrupf <[email protected]> pkgname=modular pkgver=0.9.2 pkgrel=2 pkgdesc="Modular installation tool - Repository: https://github.com/Sharktheone/arch-mojo" url="https://developer.modular.com/download" license=("custom:modular") depends=( "python" "python-pip" "libxml2" "mojo-libs" ) arch=("x86_64") source=("https://dl.modular.com/public/installer/deb/debian/pool/any-version/main/m/mo/modular_$pkgver/modular-v$pkgver-amd64.deb") sha256sums=("fabfe388c31e50bf684b321ad314e09fc348aefe2fd8da9fd33f32e3a98058d2") install="modular.install" package() { bsdtar -xf data.tar -C "$pkgdir/" } --- aur/modular/modular.install --- pre_remove() { # use normal user su $SUDO_USER runuser -l $SUDO_USER -c "modular clean" runuser -l $SUDO_USER -c "rm -rf ~/.modular" echo "mojo removed!" } --- aur/mojo-git/.SRCINFO --- pkgbase = mojo-git pkgdesc = Mojo Programming Language - Repository: https://github.com/Sharktheone/arch-mojo pkgver = 24.4 pkgrel = 2 url = https://developer.modular.com/download install = mojo-git.install arch = x86_64 license = custom:modular depends = modular depends = mojo-libs depends = python depends = libbsd depends = libmd depends = icu depends = xz depends = glibc depends = gcc-libs depends = ncurses depends = zlib pkgname = mojo-git --- aur/mojo-git/PKGBUILD --- #Maintainer: Sharktheone <[email protected]> pkgname=mojo-git pkgver=24.4 pkgrel=2 pkgdesc="Mojo Programming Language - Repository: https://github.com/Sharktheone/arch-mojo" url="https://developer.modular.com/download" license=("custom:modular") depends=( "modular" "mojo-libs" "python" "libbsd" "libmd" "icu" "xz" "glibc" "gcc-libs" "ncurses" "zlib" ) arch=("x86_64") install=mojo-git.install package() { export LD_LIBRARY_PATH="~/.local/lib/arch-mojo:$LD_LIBRARY_PATH" modular install mojo } --- aur/mojo-git/mojo-git.install --- pre_upgrade() { echo "removing old mojo files..." runuser -l $SUDO_USER -c "modular clean" runuser -l $SUDO_USER -c "modular install mojo" echo "new mojo version installed!" } pre_remove() { # use normal user su $SUDO_USER runuser -l $SUDO_USER -c "modular clean" echo "mojo removed!" } --- aur/mojo-libs/.SRCINFO --- pkgbase = mojo-libs pkgdesc = Shared libraries required for the Mojo Programming Language (ncruses, libedit) pkgver = 0.1 pkgrel = 3 url = https://github.com/Sharktheone/arch-mojo arch = x86_64 depends = python source = https://raw.githubusercontent.com/Sharktheone/arch-mojo/676397111f633adab2580c87d4b031d7282541c7/src/install_libs.py sha256sums = bed33dcf5cc71021ab39d62fe5f2c7e9f880035de57f9de5583a46c5ec87cfed pkgname = mojo-libs --- aur/mojo-libs/PKGBUILD --- #Maintainer: Sharktheone <[email protected]> pkgname=mojo-libs pkgver=0.1 pkgrel=3 pkgdesc="Shared libraries required for the Mojo Programming Language (ncruses, libedit)" url="https://github.com/Sharktheone/arch-mojo" depends=( "python" ) arch=("x86_64") source=("https://raw.githubusercontent.com/Sharktheone/arch-mojo/676397111f633adab2580c87d4b031d7282541c7/src/install_libs.py") sha256sums=("bed33dcf5cc71021ab39d62fe5f2c7e9f880035de57f9de5583a46c5ec87cfed") package() { python3 install_libs.py } --- aur/mojo/.SRCINFO --- pkgbase = mojo pkgdesc = metapackage for mojo (installs mojo-git and modular) - Repository: https://github.com/Sharktheone/arch-mojo pkgver = 0.0.1 pkgrel = 1 url = https://developer.modular.com/download arch = x86_64 license = custom:modular depends = modular depends = mojo-git pkgname = mojo --- aur/mojo/PKGBUILD --- #Maintainer: Sharktheone <[email protected]> pkgname=mojo pkgver=0.0.1 pkgrel=1 pkgdesc="metapackage for mojo (installs mojo-git and modular) - Repository: https://github.com/Sharktheone/arch-mojo" url="https://developer.modular.com/download" license=("custom:modular") depends=( "modular" "mojo-git" ) arch=("x86_64") --- src/install_libs.py --- import os.path import shutil import subprocess import sys import urllib.request INSTALL_DIR = "~/.local/lib/arch-mojo" ARCH = "x86_64-linux-gnu" TEMP_DIR = "/tmp/mojo_libs" def print_help(): print("Usage: python3 install_libs.py [options]") print("Options:") print(" --dir <path> | -d <path> : Install directory") print(" --arch <arch> | -a <arch> : Architecture") print(" --help | -h : Display this help message") print(" --fedora | -f : Install Fedora libraries") exit(0) def get_rc_path() -> str: shell = os.getenv("SHELL") if shell is not None: match shell.split("/")[-1]: case "bash": return f"~/.bashrc" case "zsh": return "~/.zshrc" case "fish": return "~/.config/fish/config.fish" case _: sys.stderr.write(f"\033[91mError: Shell {shell} not supported\033[0m\n") exit(1) def print_failture_information() -> None: sys.stdout.write( "\n\033[41;37mTL;DR: If you see errors, ignore them or report them to " "https://https://github.com/Sharktheone/arch-mojo and restart your shell\033[0m\n") sys.stdout.write( "\n\033[91mPlease note that you might be seeing some errors about some components that weren't installed " "correctly\033[0m\n") sys.stdout.write( "\n\033[91mFor more information see here: " "https://github.com/Sharktheone/arch-mojo?tab=readme-ov-file#missing-shared-libs\033[0m\n") sys.stdout.write( "\n\033[91mPlease do not report any installation errors to Modular, as this is not an official " "installation method\033[0m\n") sys.stdout.write( "\n\033[91mIf you encounter any issues, please report them to " "https://github.com/Sharktheone/arch-mojo/issues\033[0m\n") sys.stdout.write("It would also be nice if you starred the repo, thanks! ❤️\n") class MojoLibs: def __init__(self): self.install_dir = INSTALL_DIR self.arch = ARCH self.handle_args() self.install_dir = os.path.expanduser(self.install_dir) self.install_dir = os.path.expandvars(self.install_dir) os.makedirs(TEMP_DIR, exist_ok=True) os.makedirs(self.install_dir, exist_ok=True) self.install_libs() print_failture_information() self.add_lib_path() def handle_args(self): skip_next = False def assert_next_arg(idx): if idx + 1 >= len(sys.argv[1:]): print("Error: Missing argument for " + sys.argv[idx]) exit(1) for i, arg in enumerate(sys.argv[1:]): if skip_next: skip_next = False continue if arg == "--dir" or arg == "-d": assert_next_arg(i) self.install_dir = sys.argv[i + 1] skip_next = True elif arg == "--arch" or arg == "-a": assert_next_arg(i) self.arch = sys.argv[i + 1] skip_next = True elif arg == "--help" or arg == "-h": print_help() elif arg == "--fedora" or arg == "-f": self.install_fedora() exit(0) else: print_help() def install_fedora(self): sys.stderr.write("Error: Fedora installation not supported yet\n") # TODO exit(1) def install_libs(self): print(f"Installing libraries to `{self.install_dir}` for `{self.arch}`") libncruses = "https://ftp.debian.org/debian/pool/main/n/ncurses/libncurses6_6.4-4_amd64.deb" libedit = "https://ftp.debian.org/debian/pool/main/libe/libedit/libedit2_3.1-20221030-2_amd64.deb" # download deb libraries urllib.request.urlretrieve(libncruses, os.path.join(TEMP_DIR, "libncurses.deb")) urllib.request.urlretrieve(libedit, os.path.join(TEMP_DIR, "libedit.deb")) subprocess.run(f"cd {TEMP_DIR} && ar -vx libncurses.deb && tar -xf data.tar.xz", shell=True, check=True) subprocess.run(f"cd {TEMP_DIR} && ar -vx libedit.deb && tar -xf data.tar.xz", shell=True, check=True) try: os.makedirs(self.install_dir) except FileExistsError: pass # move the needed libraries shutil.copy(f"{TEMP_DIR}/lib/{self.arch}/libncurses.so.6.4", os.path.join(self.install_dir, "libncurses.so.6")) shutil.copy(f"{TEMP_DIR}/usr/lib/{self.arch}/libform.so.6.4", os.path.join(self.install_dir, "libform.so.6")) shutil.copy(f"{TEMP_DIR}/usr/lib/{self.arch}/libpanel.so.6.4", os.path.join(self.install_dir, "libpanel.so.6")) shutil.copy(f"{TEMP_DIR}/usr/lib/{self.arch}/libedit.so.2.0.70", os.path.join(self.install_dir, "libedit.so.2")) def add_lib_path(self): lib_path = os.getenv("LD_LIBRARY_PATH") # check if the path is already in the LD_LIBRARY_PATH if lib_path is not None: paths = lib_path.split(":") install_dir = os.path.abspath(self.install_dir) install_dir = os.path.expanduser(install_dir) install_dir = os.path.expandvars(install_dir) for p in paths: p = os.path.abspath(p) p = os.path.expanduser(p) p = os.path.expandvars(p) if p == install_dir: return path = get_rc_path() path = os.path.expanduser(path) shell = os.getenv("SHELL") command = None if shell is not None: if "fish" in shell: command = f"set -x LD_LIBRARY_PATH {self.install_dir} $LD_LIBRARY_PATH\n" else: # Default to Bash/Zsh syntax command = f"export LD_LIBRARY_PATH={self.install_dir}:$LD_LIBRARY_PATH\n" else: sys.stderr.write(f"\033[91mError: Unable to detect shell. Please manually add the following to your shell configuration:\n{command}\033[0m\n") return with open(path, "a") as f: f.write(command) if __name__ == "__main__": MojoLibs() print("Please restart your shell or re-soruce your shell configuration file") --- src/install_token.py --- import os import shutil import subprocess import sys import urllib.request from getpass import getpass class Mojo(object): __slots__ = ( "args", "arch", "home", "working_dir", "mojo_lib_path_from_home", "mojo_lib_path", "install_global", "onlyMojo", "fedora", "skip_next_arg", "authenticated", "rc_path", "rc_file", "token", "modular" ) def __init__(self, args: list[str], home: str | None = "~"): self.args = args self.arch = "x86_64-linux-gnu" self.home = home if home is not None else "~" self.working_dir = "~/.local/arch-mojo" self.mojo_lib_path_from_home = ".local/lib/mojo" self.mojo_lib_path = f"{self.home}/{self.mojo_lib_path_from_home}" self.install_global = False self.onlyMojo = False self.fedora = False self.skip_next_arg = False self.authenticated = False self.rc_path = None self.rc_file = None self.token = "" self.modular = shutil.which("modular") is not None self.handle_args() self.is_authenticated() self.fedora_os() self.install_modular() self.ncurses() self.install_mojo() self.print_failture_information() self.handle_rc() def _help(self) -> int: sys.stdout.write("Usage: python3 install_token.py [options]\n") sys.stdout.write("Options:\n") sys.stdout.write(" --dir=<path> | -d=<path> : Set the working directory\n") sys.stdout.write(" --global | -g : Install the libs globally\n") sys.stdout.write(" --help | -h : Show this help message\n") sys.stdout.write(" --mojo | -m : Only install mojo (modular must be installed)\n") sys.stdout.write(" --fedora | -f : Install for fedora\n") sys.stdout.write(" --modular-token <token> : Set the modular token\n") return 0 def is_authenticated(self) -> None: if self.modular: result = subprocess.run(["modular", "config-list"], capture_output=True).stdout.decode("utf-8") self.authenticated = "user.id" in result else: self.authenticated = False return None def handle_args(self) -> None: for arg in self.args: if self.skip_next_arg: self.skip_next_arg = False continue if arg.startswith("--dir="): self.working_dir = arg.split("=")[1] elif arg.startswith("-d="): self.working_dir = arg.split("=")[1] elif arg == "--global": self.install_global = True elif arg == "-g": self.install_global = True elif arg == "--mojo": self.onlyMojo = True elif arg == "-m": self.onlyMojo = True elif arg == "--fedora": self.fedora = True elif arg == "-f": self.fedora = True elif arg == "--modular-token": index = self.args.index(arg) + 1 if index >= len(self.args): sys.stdout.write("\nNo token provided") exit(1) elif self.token is not None: if self.token == "" or not self.token.startswith("mut_") or len(self.token) != 36: sys.stdout.write("\nInvalid token") exit(1) self.token = self.args[index] self.skip_next_arg = True elif arg == "--help" or arg == "-h": exit(self._help()) self.working_dir = self.working_dir.replace("~", self.home) if not self.working_dir.endswith("/"): self.working_dir += "/" if self.onlyMojo and not self.modular: sys.stdout.write("\nModular must be installed to install mojo") exit(1) try: os.makedirs(self.working_dir) except FileExistsError: pass def fedora_os(self) -> None: url = "https://ftp.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.4-4_amd64.deb" if self.fedora: subprocess.run("sudo dnf install binutils", shell=True) urllib.request.urlretrieve(url, f"{self.working_dir}/libtinfo.deb") subprocess.run(f"cd {self.working_dir} && ar -vx libtinfo.deb && tar -xf data.tar.xz", shell=True) if self.install_global: shutil.copy(f"{self.working_dir}/lib/{self.arch}/libtinfo.so.6.4", "/usr/lib/") os.symlink("/usr/lib/libtinfo.so.6.4", "/usr/lib/libtinfo.so.6") else: os.mkdir(f"{self.mojo_lib_path}") shutil.copy(f"{self.working_dir}/lib/{self.arch}/libtinfo.so.6.4", f"{self.mojo_lib_path}/libtinfo.so.6") def install_modular(self) -> None: repo = "https://github.com/Sharktheone/arch-mojo" # install modular if not installed if not self.modular: if shutil.which("git") is None: sys.stdout.write("\nPlease install git to continue") exit(1) # download PKGBUILD if not os.path.exists(f"{self.working_dir}/source/.git"): os.makedirs(f"{self.working_dir}/source") subprocess.run(f"git clone {repo} {self.working_dir}/source", shell=True) else: subprocess.run(f"cd {self.working_dir}/source && git pull", shell=True) subprocess.run(f"cd {self.working_dir}/source/aur/modular && makepkg -si", shell=True) # authenticate in modular if not self.authenticated: if self.token is None: self.token = os.getenv("MODULAR_TOKEN") if self.token is None: self.token = getpass("Please enter your Modular auth token: ") status = subprocess.run(f"LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{self.mojo_lib_path} modular auth {self.token}", shell=True) if status.returncode != 0: sys.stdout.write(f"Failed to authenticate modular using token: '{self.token}'") exit(1) def ncurses(self) -> None: url1 = "https://ftp.debian.org/debian/pool/main/n/ncurses/libncurses6_6.4-4_amd64.deb" url2 = "https://ftp.debian.org/debian/pool/main/libe/libedit/libedit2_3.1-20221030-2_amd64.deb" # download ncurses lib urllib.request.urlretrieve(url1, f"{self.working_dir}/libncurses.deb") urllib.request.urlretrieve(url2,f"{self.working_dir}/libedit.deb") subprocess.run(f"cd {self.working_dir} && ar -vx libncurses.deb && tar -xf data.tar.xz", shell=True) subprocess.run(f"cd {self.working_dir} && ar -vx libedit.deb && tar -xf data.tar.xz", shell=True) # copy libs if self.install_global: shutil.copy(f"{self.working_dir}/lib/{self.arch}/libncurses.so.6.4", "/lib/libncurses.so.6.4") shutil.copy(f"{self.working_dir}/usr/lib/{self.arch}/libform.so.6.4", "/usr/lib/libform.so.6.4") shutil.copy(f"{self.working_dir}/usr/lib/{self.arch}/libpanel.so.6.4", "/usr/lib/libpanel.so.6.4") shutil.copy(f"{self.working_dir}/usr/lib/{self.arch}/libedit.so.2.0.70", "/usr/lib/libedit.so.2.0.70") os.symlink("/lib/libncurses.so.6.4", "/lib/libncurses.so.6") os.symlink("/usr/lib/libform.so.6.4", "/usr/lib/libform.so.6") os.symlink("/usr/lib/libpanel.so.6.4", "/usr/lib/libpanel.so.6") os.symlink("/usr/lib/libedit.so.2.0.70", "/usr/lib/libedit.so.2") else: try: os.makedirs(f"{self.mojo_lib_path}") except FileExistsError: pass shutil.copy(f"{self.working_dir}/lib/{self.arch}/libncurses.so.6.4", f"{self.mojo_lib_path}/libncurses.so.6") shutil.copy(f"{self.working_dir}/usr/lib/{self.arch}/libform.so.6.4", f"{self.mojo_lib_path}/libform.so.6") shutil.copy(f"{self.working_dir}/usr/lib/{self.arch}/libpanel.so.6.4", f"{self.mojo_lib_path}/libpanel.so.6") shutil.copy(f"{self.working_dir}/usr/lib/{self.arch}/libedit.so.2.0.70", f"{self.mojo_lib_path}/libedit.so.2") def install_mojo(self) -> None: # install mojo mojo = shutil.which(f"{self.home}/.modular/pkg/packages.modular.com_mojo/bin/mojo") is not None if mojo: sys.stdout.write("Mojo is already installed... cleaning up") subprocess.run(f"{self.home}/.modular/pkg/packages.modular.com_mojo/bin/modular clean", shell=True) exit(0) else: subprocess.run(f"LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{self.mojo_lib_path} modular install mojo", shell=True) # fix crashdb directory not found: os.makedirs(f"{self.home}/.modular/crashdb", exist_ok=True) def get_shell_path(self) -> str | None: path = input("\nPlease enter the path to your shell rc file (e.g. ~/.bashrc for bash) or press ENTER to skip:") if path == "": return None return path.replace("~", self.home) def get_shell(self, found=None, file=None): if found is not None: yn = input(f"\nFound {found} shell, add exports to {file}? [y/N/other]: ") yn = yn.lower() if yn == "y": return file elif yn == "n": return None elif yn == "other" or yn == "o": return self.get_shell_path() elif yn == "": sys.stdout.write("\nSkipping...") return None else: sys.stdout.write("\nInvalid input") return self.get_shell(found, file) else: return self.get_shell_path() def get_rc_path(self) -> str | None: shell = os.getenv("SHELL") if shell is not None: match shell.split("/")[-1]: case "bash": return self.get_shell("bash", f"{self.home}/.bashrc") case "zsh": return self.get_shell("zsh", f"{self.home}/.zshrc") case _: path = self.get_shell_path() if path == "": return None return path.replace("~", self.home) else: return self.get_shell() def print_manual_instructions(self) -> None: sys.stdout.write("\nPlease add the following lines to your shell rc file:") sys.stdout.write(f"\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/{self.mojo_lib_path_from_home}") sys.stdout.write("\nexport PATH=$PATH:~/.modular/pkg/packages.modular.com_mojo/bin/") def handle_rc(self) -> None: self.rc_path = self.get_rc_path() if self.rc_path is None: sys.stdout.write("\nSkipping rc file installation") mojo = shutil.which(f"{self.home}/.modular/pkg/packages.modular.com_mojo/bin/mojo") is not None if mojo: self.print_manual_instructions() exit(0) else: exit(1) else: with open(self.rc_path, "a") as self.rc_file: if self.rc_file is None: sys.stdout.write(f"\nCould not open {self.rc_path}, skipping...") self.print_manual_instructions() exit(0) # check if exports are already in rc file ld_path = os.getenv("LD_LIBRARY_PATH") path = os.getenv("PATH") if ld_path is None or not f"~/{self.mojo_lib_path_from_home}" in ld_path and not self.mojo_lib_path in ld_path: sys.stdout.write("wrote lib path") self.rc_file.write(f"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/{self.mojo_lib_path_from_home}\n") if path is None or not "~/.modular/pkg/packages.modular.com_mojo/bin/" in path: if not f"{self.home}/.modular/pkg/packages.modular.com_mojo/bin/" in path: sys.stdout.write("wrote path") self.rc_file.write("export PATH=$PATH:~/.modular/pkg/packages.modular.com_mojo/bin/\n") sys.stdout.write(f"\nPlease restart your shell or run `source {self.rc_path}` to complete the installation\n") def print_failture_information(self) -> None: sys.stdout.write("\n\033[41;37mTL;DR: If you see errors, ignore them or report them to https://https://github.com/Sharktheone/arch-mojo and restart your shell\033[0m\n") sys.stdout.write("\n\033[91mPlease note that you might be seeing some errors about some components that weren't installed correctly\033[0m\n") sys.stdout.write("\n\033[91mFor more information see here: https://github.com/Sharktheone/arch-mojo?tab=readme-ov-file#missing-shared-libs\033[0m\n") sys.stdout.write("\n\033[91mPlease do not report any installation errors to Modular, as this is not an official installation method\033[0m\n") sys.stdout.write("\n\033[91mIf you encounter any issues, please report them to https://github.com/Sharktheone/arch-mojo/issues\033[0m\n") sys.stdout.write("It would also be nice if you starred the repo, thanks! ❤️\n") if __name__ == "__main__": Mojo(args=sys.argv, home=os.getenv("HOME")) sys.exit(0) --- .gitignore --- .DS_Store .vscode *.pyc engine --- LICENSE --- GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) 2023 Viet-Anh NGUYEN This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>. --- README.md --- # Chess.Mojo 🔥 The first UCI chess engine in the Mojo language. (**WORK IN PROGRESS.**) ![Chess.Mojo](./chess.mojo.png) ## Note - The current engine is not optimized for speed. It is just a proof of concept. - The source code was based on [sunfish](https://github.com/thomasahle/sunfish/). ## Roadmap - [x] Basic UCI support. - [x] Runable engine. - [x] Integrate simple GUI for testing. - [ ] Use native Mojo data structures for speed: - [ ] History. - [ ] Board hashing. - [ ] Move generation. - [ ] Integrate NNUE. - [ ] Multi-threading. - [ ] Add Mojo GUI. ## Usage - Install [Mojo](https://docs.modular.com/mojo/manual/get-started/). - Run `mojo engine.mojo` to start the engine. ## Run with simple UI (In terminal) - Install Python >= 3.8. - Install required packages ```bash pip install -r requirements.txt ``` - Start the GUI: ```bash chmod +x ./engine.mojo python play -cmd ./engine.mojo ``` **Note**: The engine can be run with any UCI compatible GUI. The simple UI is just for quick testing. ## Debugging - Build the engine with full debug information: ```bash mojo build --debug-level full engine.mojo ``` - Run the engine with `mojo debug` and use the console just like `gdb` or `lldb`: ```bash mojo debug engine ``` ## References - This chess engine is based on [sunfish](https://github.com/thomasahle/sunfish/). --- engine.mojo --- #!/usr/bin/env mojo from python import Python fn isupper(c: String) -> Bool: return ord("A") <= ord(c) <= ord("Z") fn islower(c: String) -> Bool: return ord("a") <= ord(c) <= ord("z") fn isspace(c: String) -> Bool: return c == " " or c == "\n" fn upper(c: String) -> String: if islower(c): return chr(ord(c) - ord("a") + ord("A")) return c fn lower(c: String) -> String: if isupper(c): return chr(ord(c) - ord("A") + ord("a")) return c fn switchcase(c: String) -> String: if isupper(c): return lower(c) return upper(c) fn switchcase(c: Int) -> Int: if isupper(chr(c)): return ord(lower(chr(c))) return ord(upper(chr(c))) fn swapboard(board: String) -> String: """Reverse and swap the case of a board.""" var ret: String = "" for i in range(len(board) - 1, -1, -1): let c: String = board[i] if isupper(c): ret += lower(c) else: ret += upper(c) return ret fn abs(x: Int) -> Int: if x < 0: return -x return x fn max(x: Int, y: Int) -> Int: if x > y: return x return y fn min(x: Int, y: Int) -> Int: if x < y: return x return y struct Position: """ A state of a game. board -- a 120 char representation of the board score -- the board evaluation wc -- the castling rights, [west/queen side, east/king side] bc -- the opponent castling rights, [west/king side, east/queen side] ep - the en passant square kp - the king passant square. """ var board: String var score: Int var wc: (Int, Int) var bc: (Int, Int) var ep: Int var kp: Int var direction_N: Int var direction_E: Int var direction_S: Int var direction_W: Int var A1: Int var H1: Int var A8: Int var H8: Int fn __init__(inout self, board: String, score: Int, wc: (Int, Int), bc: (Int, Int), ep: Int, kp: Int): self.board = board self.score = score self.wc = wc self.bc = bc self.ep = ep self.kp = kp # Constants self.direction_N = -10 self.direction_E = 1 self.direction_S = 10 self.direction_W = -1 # Our board is represented as a 120 character string. The padding allows for # fast detection of moves that don't stay within the board. self.A1, self.H1, self.A8, self.H8 = 91, 98, 21, 28 fn __copyinit__(inout self, other: Position): self.board = other.board self.score = other.score self.wc = other.wc self.bc = other.bc self.ep = other.ep self.kp = other.kp # Constants self.direction_N = -10 self.direction_E = 1 self.direction_S = 10 self.direction_W = -1 # Our board is represented as a 120 character string. The padding allows for # fast detection of moves that don't stay within the board. self.A1, self.H1, self.A8, self.H8 = 91, 98, 21, 28 def gen_moves(inout self) -> DynamicVector[(Int, Int, Int)]: # Lists of possible moves for each piece type. # N, E, S, W = -10, 1, 10, -1 let N: Int = -10 let E: Int = 1 let S: Int = 10 let W: Int = -1 let p_directions = Python.dict() p_directions["P"] = (N, N+N, N+W, N+E) p_directions["N"] = (N+N+E, E+N+E, E+S+E, S+S+E, S+S+W, W+S+W, W+N+W, N+N+W) p_directions["B"] = (N+E, S+E, S+W, N+W) p_directions["R"] = (N, E, S, W) p_directions["Q"] = (N, E, S, W, N+E, S+E, S+W, N+W) p_directions["K"] = (N, E, S, W, N+E, S+E, S+W, N+W) generated_moves = DynamicVector[(Int, Int, Int)]() # For each of our pieces, iterate through each possible 'ray' of moves, # as defined in the 'directions' map. The rays are broken e.g. by # captures or immediately in case of pieces such as knights. for i in range(len(self.board)): let p: String = self.board[i] if not isupper(p): continue for d_py in p_directions[p]: let d = d_py.to_float64().to_int() # TODO: Fix it var j: Int = i while True: j = j + d q = self.board[j] # Stay inside the board, and off friendly pieces if isspace(q) or isupper(q): break # Pawn move, double move and capture if p == "P": if (d == N or d == N + N) and q != ".": break if d == N + N and (i < self.A1 + N or self.board[i + N] != "."): break if ( (d == N + W or d == N + E) and q == "." and (j != self.ep and j != self.kp and j != self.kp - 1 and j != self.kp + 1) ): break # If we move to the last row, we can be anything if self.A8 <= j <= self.H8: generated_moves.push_back((i, j, ord("N"))) generated_moves.push_back((i, j, ord("B"))) generated_moves.push_back((i, j, ord("R"))) generated_moves.push_back((i, j, ord("Q"))) break # Move it generated_moves.push_back((i, j, 0)) # Stop crawlers from sliding, and sliding after captures if (p == "P" or p == "N" or p == "K") or islower(q): break # Castling, by sliding the rook next to the king if i == self.A1 and self.board[j + E] == "K" and self.wc.get[0, Int](): generated_moves.push_back((j + E, j + W, 0)) if i == self.H1 and self.board[j + W] == "K" and self.wc.get[1, Int](): generated_moves.push_back((j + W, j + E, 0)) return generated_moves fn rotate(self, nullmove: Bool=False) -> Position: """Rotates the board, preserving enpassant, unless nullmove.""" return Position( swapboard(self.board), -self.score, self.bc, self.wc, 119 - self.ep if self.ep and not nullmove else 0, 119 - self.kp if self.kp and not nullmove else 0, ) def value(self, move: (Int, Int, Int)) -> Int: let pst = Python.dict() pst["P"] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 100, 0, 0, 178, 183, 186, 173, 202, 182, 185, 190, 0, 0, 107, 129, 121, 144, 140, 131, 144, 107, 0, 0, 83, 116, 98, 115, 114, 100, 115, 87, 0, 0, 74, 103, 110, 109, 106, 101, 100, 77, 0, 0, 78, 109, 105, 89, 90, 98, 103, 81, 0, 0, 69, 108, 93, 63, 64, 86, 103, 69, 0, 0, 100, 100, 100, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) pst["N"] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 214, 227, 205, 205, 270, 225, 222, 210, 0, 0, 277, 274, 380, 244, 284, 342, 276, 266, 0, 0, 290, 347, 281, 354, 353, 307, 342, 278, 0, 0, 304, 304, 325, 317, 313, 321, 305, 297, 0, 0, 279, 285, 311, 301, 302, 315, 282, 280, 0, 0, 262, 290, 293, 302, 298, 295, 291, 266, 0, 0, 257, 265, 282, 280, 282, 280, 257, 260, 0, 0, 206, 257, 254, 256, 261, 245, 258, 211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) pst["B"] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 261, 242, 238, 244, 297, 213, 283, 270, 0, 0, 309, 340, 355, 278, 281, 351, 322, 298, 0, 0, 311, 359, 288, 361, 372, 310, 348, 306, 0, 0, 345, 337, 340, 354, 346, 345, 335, 330, 0, 0, 333, 330, 337, 343, 337, 336, 320, 327, 0, 0, 334, 345, 344, 335, 328, 345, 340, 335, 0, 0, 339, 340, 331, 326, 327, 326, 340, 336, 0, 0, 313, 322, 305, 308, 306, 305, 310, 310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) pst["R"] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 508, 512, 483, 516, 512, 535, 529, 0, 0, 534, 508, 535, 546, 534, 541, 513, 539, 0, 0, 498, 514, 507, 512, 524, 506, 504, 494, 0, 0, 479, 484, 495, 492, 497, 475, 470, 473, 0, 0, 451, 444, 463, 458, 466, 450, 433, 449, 0, 0, 437, 451, 437, 454, 454, 444, 453, 433, 0, 0, 426, 441, 448, 453, 450, 436, 435, 426, 0, 0, 449, 455, 461, 484, 477, 461, 448, 447, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) pst["Q"] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 935, 930, 921, 825, 998, 953, 1017, 955, 0, 0, 943, 961, 989, 919, 949, 1005, 986, 953, 0, 0, 927, 972, 961, 989, 1001, 992, 972, 931, 0, 0, 930, 913, 951, 946, 954, 949, 916, 923, 0, 0, 915, 914, 927, 924, 928, 919, 909, 907, 0, 0, 899, 923, 916, 918, 913, 918, 913, 902, 0, 0, 893, 911, 929, 910, 914, 914, 908, 891, 0, 0, 890, 899, 898, 916, 898, 893, 895, 887, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) pst["K"] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60004, 60054, 60047, 59901, 59901, 60060, 60083, 59938, 0, 0, 59968, 60010, 60055, 60056, 60056, 60055, 60010, 60003, 0, 0, 59938, 60012, 59943, 60044, 59933, 60028, 60037, 59969, 0, 0, 59945, 60050, 60011, 59996, 59981, 60013, 60000, 59951, 0, 0, 59945, 59957, 59948, 59972, 59949, 59953, 59992, 59950, 0, 0, 59953, 59958, 59957, 59921, 59936, 59968, 59971, 59968, 0, 0, 59996, 60003, 59986, 59950, 59943, 59982, 60013, 60004, 0, 0, 60017, 60030, 59997, 59986, 60006, 59999, 60040, 60018, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) let i: Int = move.get[0, Int]() let j: Int = move.get[1, Int]() let prom: String = chr(move.get[2, Int]()) let p: String = self.board[i] let q: String = self.board[j] # Actual move var score: Int = (pst[p][j] - pst[p][i]).to_float64().to_int() # TODO: Fix it # Capture if islower(q): score += pst[upper(q)][119 - j].to_float64().to_int() # TODO: Fix it # Castling check detection if abs(j - self.kp) < 2: score += pst["K"][119 - j].to_float64().to_int() # TODO: Fix it # Castling if p == "K" and abs(i - j) == 2: score += pst["R"][(i + j) // 2].to_float64().to_int() # TODO: Fix it score -= pst["R"][self.A1 if j < i else self.H1].to_float64().to_int() # TODO: Fix it # Special pawn stuff if p == "P": if self.A8 <= j <= self.H8: score += pst[prom][j].to_float64().to_int() - pst["P"][j].to_float64().to_int() # TODO: Fix it if j == self.ep: score += pst["P"][119 - (j + self.direction_S)].to_float64().to_int() # TODO: Fix it return score def move(self, move: (Int, Int, Int)) -> Position: var i: Int = move.get[0, Int]() var j: Int = move.get[1, Int]() var prom: String = chr(move.get[2, Int]()) var p: String = self.board[i] var q: String = self.board[j] fn put(board: String, i: Int, p: String) -> String: return board[:i] + p + board[i + 1 :] # Copy variables and reset ep and kp var board = self.board var wc: (Int, Int) = self.wc var bc: (Int, Int) = self.bc var ep: Int = 0 var kp: Int = 0 var score: Int = self.score + self.value(move) # Actual move board = put(board, j, board[i]) board = put(board, i, ".") # Castling rights, we move the rook or capture the opponent's if i == self.A1: wc = (0, wc.get[1, Int]()) if i == self.H1: wc = (wc.get[0, Int](), 0) if j == self.A8: bc = (bc.get[0, Int](), 0) if j == self.H8: bc = (0, bc.get[1, Int]()) # Castling if p == "K": wc = (0, 0) if abs(j - i) == 2: kp = (i + j) // 2 board = put(board, self.A1 if j < i else self.H1, ".") board = put(board, kp, "R") # Pawn promotion, double move and en passant capture if p == "P": if self.A8 <= j <= self.H8: board = put(board, j, prom) if j - i == 2 * self.direction_N: ep = i + self.direction_N if j == self.ep: board = put(board, j + self.direction_S, ".") # We rotate the returned position, so it's ready for the next player return Position(board, score, wc, bc, ep, kp).rotate() fn board_str_to_numbers(board: String) -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int): """Encode 120 char board to 30 Ints with 32 bits each.""" # TODO: Encode the chessboard more efficiently var ret: DynamicVector[Int] = DynamicVector[Int]() for i in range(len(board)//4): let c1: String = board[i*4] let c2: String = board[i*4 + 1] let c3: String = board[i*4 + 2] let c4: String = board[i*4 + 3] let n: Int = ord(c1) + ord(c2) * 256 + ord(c3) * 65536 + ord(c4) * 16777216 ret.push_back(n) return (ret[0], ret[1], ret[2], ret[3], ret[4], ret[5], ret[6], ret[7], ret[8], ret[9], ret[10], ret[11], ret[12], ret[13], ret[14], ret[15], ret[16], ret[17], ret[18], ret[19], ret[20], ret[21], ret[22], ret[23], ret[24], ret[25], ret[26], ret[27], ret[28], ret[29]) fn numbers_to_board_str(board: DynamicVector[Int]) -> String: """Decode 30 Ints with 32 bits each to 120 char board.""" var ret: String = "" for i in range(len(board)): let n: Int = board[i] let c1: String = chr(n % 256) let c2: String = chr((n // 256) % 256) let c3: String = chr((n // 65536) % 256) let c4: String = chr((n // 16777216) % 256) ret += c1 + c2 + c3 + c4 return ret fn get_tp_score_key(pos: Position, depth: Int, can_null: Int) -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int): let e = board_str_to_numbers(pos.board) return ( e.get[0, Int](), e.get[1, Int](), e.get[2, Int](), e.get[3, Int](), e.get[4, Int](), e.get[5, Int](), e.get[6, Int](), e.get[7, Int](), e.get[8, Int](), e.get[9, Int](), e.get[10, Int](), e.get[11, Int](), e.get[12, Int](), e.get[13, Int](), e.get[14, Int](), e.get[15, Int](), e.get[16, Int](), e.get[17, Int](), e.get[18, Int](), e.get[19, Int](), e.get[20, Int](), e.get[21, Int](), e.get[22, Int](), e.get[23, Int](), e.get[24, Int](), e.get[25, Int](), e.get[26, Int](), e.get[27, Int](), e.get[28, Int](), e.get[29, Int](), pos.score, pos.wc.get[0, Int](), pos.wc.get[1, Int](), pos.bc.get[0, Int](), pos.bc.get[1, Int](), pos.ep, pos.kp, depth, can_null ) fn get_tp_move_key(pos: Position) -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int): let e = board_str_to_numbers(pos.board) return ( e.get[0, Int](), e.get[1, Int](), e.get[2, Int](), e.get[3, Int](), e.get[4, Int](), e.get[5, Int](), e.get[6, Int](), e.get[7, Int](), e.get[8, Int](), e.get[9, Int](), e.get[10, Int](), e.get[11, Int](), e.get[12, Int](), e.get[13, Int](), e.get[14, Int](), e.get[15, Int](), e.get[16, Int](), e.get[17, Int](), e.get[18, Int](), e.get[19, Int](), e.get[20, Int](), e.get[21, Int](), e.get[22, Int](), e.get[23, Int](), e.get[24, Int](), e.get[25, Int](), e.get[26, Int](), e.get[27, Int](), e.get[28, Int](), e.get[29, Int](), pos.score, pos.wc.get[0, Int](), pos.wc.get[1, Int](), pos.bc.get[0, Int](), pos.bc.get[1, Int](), pos.ep, pos.kp ) fn get_history_key(pos: Position) -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int): let e = board_str_to_numbers(pos.board) return ( e.get[0, Int](), e.get[1, Int](), e.get[2, Int](), e.get[3, Int](), e.get[4, Int](), e.get[5, Int](), e.get[6, Int](), e.get[7, Int](), e.get[8, Int](), e.get[9, Int](), e.get[10, Int](), e.get[11, Int](), e.get[12, Int](), e.get[13, Int](), e.get[14, Int](), e.get[15, Int](), e.get[16, Int](), e.get[17, Int](), e.get[18, Int](), e.get[19, Int](), e.get[20, Int](), e.get[21, Int](), e.get[22, Int](), e.get[23, Int](), e.get[24, Int](), e.get[25, Int](), e.get[26, Int](), e.get[27, Int](), e.get[28, Int](), e.get[29, Int](), pos.score, pos.wc.get[0, Int](), pos.wc.get[1, Int](), pos.bc.get[0, Int](), pos.bc.get[1, Int](), pos.ep, pos.kp ) def py_position_to_position(pos: PythonObject) -> Position: var board_numbers = DynamicVector[Int]() for i in range(30): board_numbers.push_back(pos[i].to_float64().to_int()) # TODO: Fix it let board = numbers_to_board_str(board_numbers) # score: Int, wc: (Int, Int), bc: (Int, Int), ep: Int, kp: Int return Position( board, pos[30].to_float64().to_int(), # TODO: Fix it (pos[31].to_float64().to_int(), pos[32].to_float64().to_int()), # TODO: Fix it (pos[33].to_float64().to_int(), pos[34].to_float64().to_int()), # TODO: Fix it pos[35].to_float64().to_int(), # TODO: Fix it pos[36].to_float64().to_int(), # TODO: Fix it ) def py_move_to_move(move: PythonObject) -> (Int, Int, Int): return move[0].to_float64().to_int(), move[1].to_float64().to_int(), move[2].to_float64().to_int() # TODO: Fix it fn print_move(move: (Int, Int, Int)): let a: String = render(move.get[0, Int]()) + render(move.get[1, Int]()) + lower(chr(move.get[2, Int]())) print(a) # lower <= s(pos) <= upper struct Searcher: """A class that can search a position to a given depth.""" var tp_score: PythonObject var tp_move: PythonObject var history: PythonObject var nodes: Int var MATE_LOWER: Int var MATE_UPPER: Int def __init__(inout self): let py = Python.import_module("builtins") self.tp_score = py.dict() self.tp_move = py.dict() self.history = py.set() self.nodes = 0 # Mate value must be greater than 8*queen + 2*(rook+knight+bishop) # King value is set to twice this value such that if the opponent is # 8 queens up, but we got the king, we still exceed MATE_VALUE. # When a MATE is detected, we'll set the score to MATE_UPPER - plies to get there # E.g. Mate in 3 will be MATE_UPPER - 6 # piece = {"P": 100, "N": 280, "B": 320, "R": 479, "Q": 929, "K": 60000} # self.MATE_LOWER = piece["K"] - 10 * piece["Q"] # self.MATE_UPPER = piece["K"] + 10 * piece["Q"] self.MATE_LOWER = 60000 - 10 * 929 self.MATE_UPPER = 60000 + 10 * 929 def bound(inout self, pos: Position, gamma: Int, depth: Int, can_null: Int=1) -> Int: """ Let s* be the "true" score of the sub-tree we are searching. The method returns r, where if gamma > s* then s* <= r < gamma (A better upper bound) if gamma <= s* then gamma <= r <= s* (A better lower bound).""" self.nodes += 1 # Depth <= 0 is QSearch. Here any position is searched as deeply as is needed for # calmness, and from this point on there is no difference in behaviour depending on # depth, so so there is no reason to keep different depths in the transposition table. depth = max(depth, 0) # Sunfish is a king-capture engine, so we should always check if we # still have a king. Notice since this is the only termination check, # the remaining code has to be comfortable with being mated, stalemated # or able to capture the opponent king. if pos.score <= -self.MATE_LOWER: return -self.MATE_UPPER # Look in the table if we have already searched this position before. # We also need to be sure, that the stored search was over the same # nodes as the current search. var entry_py: PythonObject = self.tp_score.get(get_tp_score_key(pos, depth, can_null), (-self.MATE_UPPER, self.MATE_UPPER)) var entry: (Int, Int) = (entry_py[0].to_float64().to_int(), entry_py[1].to_float64().to_int()) # TODO: Fix it if entry.get[0, Int]() >= gamma: return entry.get[0, Int]() if entry.get[1, Int]() < gamma: return entry.get[1, Int]() # Let's not repeat positions. We don't chat # - at the root (can_null=False) since it is in history, but not a draw. # - at depth=0, since it would be expensive and break "futulity pruning". if can_null and depth > 0 and self.history.__contains__(get_history_key(pos)): return 0 # Generator of moves to search in order. # This allows us to define the moves, but only calculate them if needed. # Run through the moves, shortcutting when possible var best: Int = -self.MATE_UPPER def check(inout pos: Position, tp_move: PythonObject, inout best: Int, move: (Int, Int, Int), score: Int) -> Bool: best = max(best, score) if best >= gamma: # Save the move for pv construction and killer heuristic if move.get[2, Int]() != -1: let key = get_tp_move_key(pos) tp_move.__setitem__(key, ( move.get[0, Int](), move.get[1, Int](), move.get[2, Int](), )) return True return False # First try not moving at all. We only do this if there is at least one major # piece left on the board, since otherwise zugzwangs are too dangerous. # FIXME: We also can't null move if we can capture the opponent king. # Since if we do, we won't spot illegal moves that could lead to stalemate. # For now we just solve this by not using null-move in very unbalanced positions. # TODO: We could actually use null-move in QS as well. Not sure it would be very useful. # But still.... We just have to move stand-pat to be before null-move. #if depth > 2 and can_null and any(c in pos.board for c in "RBNQ"): #if depth > 2 and can_null and any(c in pos.board for c in "RBNQ") and abs(pos.score) < 500: var should_stop: Bool = False if depth > 2 and can_null and abs(pos.score) < 500: var score_1: Int = -self.bound(pos.rotate(nullmove=True), 1 - gamma, depth - 3) should_stop = check(pos, self.tp_move, best, (-1, -1, -1), score_1) if not should_stop: # For QSearch we have a different kind of null-move, namely we can just stop # and not capture anything else. if depth == 0: should_stop = check(pos, self.tp_move, best, (-1, -1, -1), pos.score) var val_lower: Int = 0 if not should_stop: # Look for the strongest ove from last time, the hash-move. var killer_py: PythonObject = self.tp_move.get(get_tp_move_key(pos)) var killer: (Int, Int, Int) = (-1, -1, -1) if not Python.is_type(killer_py, Python.none()): killer = (killer_py[0].to_float64().to_int(), killer_py[1].to_float64().to_int(), killer_py[2].to_float64().to_int()) # TODO: Fix it # If there isn't one, try to find one with a more shallow search. # This is known as Internal Iterative Deepening (IID). We set # can_null=True, since we want to make sure we actually find a move. if Python.is_type(killer_py, Python.none()) and depth > 2: self.bound(pos, gamma, depth - 3, can_null=0) killer_py = self.tp_move.get(get_tp_move_key(pos)) if not Python.is_type(killer_py, Python.none()): killer = (killer_py[0].to_float64().to_int(), killer_py[1].to_float64().to_int(), killer_py.to_float64().to_int()) # TODO: Fix it # If depth == 0 we only try moves with high intrinsic score (captures and # promotions). Otherwise we do all moves. This is called quiescent search. QS = 40 QS_A = 140 val_lower = QS - depth * QS_A # Only play the move if it would be included at the current val-limit, # since otherwise we'd get search instability. # We will search it again in the main loop below, but the tp will fix # things for us. if not Python.is_type(killer_py, Python.none()) and pos.value(killer) >= val_lower: should_stop = check(pos, self.tp_move, best, killer, -self.bound(pos.move(killer), 1 - gamma, depth - 1)) # Then all the other moves if not should_stop: var pos_moves: DynamicVector[(Int, Int, Int)] = pos.gen_moves() var values: DynamicVector[Int] = DynamicVector[Int]() for i in range(len(pos_moves)): var move: (Int, Int, Int) = pos_moves[i] values.push_back(pos.value(move)) # Sort the moves by their static score reversed, so the best moves are first for i in range(len(pos_moves)): for j in range(i + 1, len(pos_moves)): if values[i] < values[j]: values[i], values[j] = values[j], values[i] pos_moves[i], pos_moves[j] = pos_moves[j], pos_moves[i] for i in range(len(pos_moves)): var move: (Int, Int, Int) = pos_moves[i] var val: Int = values[i] # Quiescent search if val < val_lower: break # If the new score is less than gamma, the opponent will for sure just # stand pat, since ""pos.score + val < gamma === -(pos.score + val) >= 1-gamma"" # This is known as futility pruning. if depth <= 1 and pos.score + val < gamma: # Need special case for MATE, since it would normally be caught # before standing pat. should_stop = check(pos, self.tp_move, best, move, pos.score + val if val < self.MATE_LOWER else self.MATE_UPPER) # We can also break, since we have ordered the moves by value, # so it can't get any better than this. break should_stop = check(pos, self.tp_move, best, move, -self.bound(pos.move(move), 1 - gamma, depth - 1)) if should_stop: break # Stalemate checking is a bit tricky: Say we failed low, because # we can't (legally) move and so the (real) score is -infty. # At the next depth we are allowed to just return r, -infty <= r < gamma, # which is normally fine. # However, what if gamma = -10 and we don't have any legal moves? # Then the score is actually a draw and we should fail high! # Thus, if best < gamma and best < 0 we need to double check what we are doing. # We will fix this problem another way: We add the requirement to bound, that # it always returns MATE_UPPER if the king is capturable. Even if another move # was also sufficient to go above gamma. If we see this value we know we are either # mate, or stalemate. It then suffices to check whether we're in check. # Note that at low depths, this may not actually be true, since maybe we just pruned # all the legal moves. So sunfish may report "mate", but then after more search # realize it's not a mate after all. That's fair. # This is too expensive to test at depth == 0 if depth > 2 and best == -self.MATE_UPPER: flipped = pos.rotate(nullmove=True) # Hopefully this is already in the TT because of null-move in_check = self.bound(flipped, self.MATE_UPPER, 0) == self.MATE_UPPER best = -self.MATE_LOWER if in_check else 0 # Table part 2 if best >= gamma: var key = get_tp_score_key(pos, depth, can_null) self.tp_score.__setitem__(key, (best, entry.get[1, Int]())) if best < gamma: var key = get_tp_score_key(pos, depth, can_null) self.tp_score.__setitem__(key, (entry.get[0, Int](), best)) return best def search(inout self, history: PythonObject, depth: Int) -> DynamicVector[(Int, Int, (Int, Int, Int))]: """Iterative deepening MTD-bi search.""" let py = Python.import_module("builtins") self.nodes = 0 self.history = py.set(history) self.tp_score.clear() var gamma: Int = 0 # In finished games, we could potentially go far enough to cause a recursion # limit exception. Hence we bound the ply. We also can't start at 0, since # that's quiscent search, and we don't always play legal moves there. var moves = DynamicVector[(Int, Int, (Int, Int, Int))]() # The inner loop is a binary search on the score of the position. # Inv: lower <= score <= upper # 'while lower != upper' would work, but it's too much effort to spend # on what's probably not going to change the move played. # lower, upper = -self.MATE_LOWER, self.MATE_LOWER var lower: Int = -self.MATE_LOWER var upper: Int = self.MATE_LOWER let EVAL_ROUGHNESS: Int = 15 var i: Int = 0 while lower < upper - EVAL_ROUGHNESS: i += 1 score = self.bound(py_position_to_position(history[py.len(history) - 1]), gamma, depth, can_null=0) if score >= gamma: lower = score if score < gamma: upper = score let new_pos: Position = py_position_to_position(history[py.len(history) - 1]) let key = get_tp_move_key(new_pos) let move_py: PythonObject = self.tp_move.get(key) var move: (Int, Int, Int) = (0, 0, 0) if not Python.is_type(move_py, Python.none()): move = py_move_to_move(move_py) moves.push_back((gamma, score, move)) gamma = (lower + upper + 1) // 2 return moves fn parse(c: String) -> Int: let A1 = 91 let fil = ord(c[0]) - ord("a") let rank = ord(c[1]) - ord('0') - 1 return A1 + fil - 10 * rank fn render(i: Int) -> String: let A1 = 91 let rank = (i - A1) // 10 let fil = (i - A1) % 10 var ret = chr(fil + ord("a")) ret += (-rank + 1) return ret def go(inout hist: PythonObject, inout args: PythonObject, depth: Int=3): let py = Python.import_module("builtins") # var 1, btime, winc, binc = [int(a) / 1000 for a in args[2::2]] let wtime: Int = 2 let btime: Int = 2 let winc: Int = 2 let binc: Int = 2 # TODO: Stop when thinking too long var move_str: String = "" for depth in range(1, depth): var searcher: Searcher = Searcher() # TODO: Stop when in the middle of the depth let moves: DynamicVector[(Int, Int, (Int, Int, Int))] = searcher.search(hist, depth) for i in range(len(moves)): let gamma: Int = moves[i].get[0, Int]() let score: Int = moves[i].get[1, Int]() let move: (Int, Int, Int) = moves[i].get[2, (Int, Int, Int)]() # The only way we can be sure to have the real move in tp_move, # is if we have just failed high. if score >= gamma: var i = move.get[0, Int]() var j = move.get[1, Int]() if py.len(hist) % 2 == 0: i, j = 119 - i, 119 - j move_str = render(i) + render(j) + lower(chr(move.get[2, Int]())) print("info depth", depth, "score cp", score, "pv", move_str) print("bestmove", move_str or '(none)') def main(): let py = Python.import_module("builtins") initial = ( " \n" # 0 - 9 " \n" # 10 - 19 " rnbqkbnr\n" # 20 - 29 " pppppppp\n" # 30 - 39 " ........\n" # 40 - 49 " ........\n" # 50 - 59 " ........\n" # 60 - 69 " ........\n" # 70 - 79 " PPPPPPPP\n" # 80 - 89 " RNBQKBNR\n" # 90 - 99 " \n" # 100 -109 " \n" # 110 -119 ) let e = board_str_to_numbers(initial) let init_pos: PythonObject = py.tuple([e.get[0, Int](), e.get[1, Int](), e.get[2, Int](), e.get[3, Int](), e.get[4, Int](), e.get[5, Int](), e.get[6, Int](), e.get[7, Int](), e.get[8, Int](), e.get[9, Int](), e.get[10, Int](), e.get[11, Int](), e.get[12, Int](), e.get[13, Int](), e.get[14, Int](), e.get[15, Int](), e.get[16, Int](), e.get[17, Int](), e.get[18, Int](), e.get[19, Int](), e.get[20, Int](), e.get[21, Int](), e.get[22, Int](), e.get[23, Int](), e.get[24, Int](), e.get[25, Int](), e.get[26, Int](), e.get[27, Int](), e.get[28, Int](), e.get[29, Int](), 0, True, True, True, True, 0, 0]) var hist: PythonObject = py.list() hist.append(init_pos) while True: try: var args = PythonObject() args = py.input().split() if args[0] == "uci": print("id name chess.mojo") print("uciok") elif args[0] == "isready": print("readyok") elif args[0] == "quit": break elif args[0] == "position" and args[1] == "startpos": hist = py.list() hist.append(init_pos) let argc: Int = py.len(args).to_float64().to_int() # TODO: Fix it var ply: Int = 0 for ii in range(3, argc): move = args[ii] let move_0: String = chr(py.ord(move[0]).to_float64().to_int()) + chr(py.ord(move[1]).to_float64().to_int()) let move_1: String = chr(py.ord(move[2]).to_float64().to_int()) + chr(py.ord(move[3]).to_float64().to_int()) var i: Int = parse(move_0) var j: Int = parse(move_1) var prom: Int = 0 if py.len(move) > 4: prom = ord(upper(chr(py.ord(move[4]).to_float64().to_int()))) if ply % 2 == 1: # Flipped board i = 119 - i j = 119 - j let last_pos: PythonObject = hist[py.len(hist) - 1] var new_pos: Position = py_position_to_position(last_pos) new_pos = new_pos.move((i, j, prom)) hist.append(get_history_key(new_pos)) ply += 1 elif args[0] == "go": go(hist, args, depth=3) elif args[0] == "speedtest": import time let start = time.now() hist = py.list() hist.append(init_pos) let loop_start = time.now() go(hist, args, depth=3) let loop_end = time.now() print("Time:", (loop_end - loop_start) / 1000000000, "s") else: print("Unknown command:", args) except e: print(e) --- play.py --- #!/usr/bin/env python import chess.engine import json import argparse import random import sys import asyncio import pathlib import logging import math parser = argparse.ArgumentParser() parser.add_argument("-cmd", nargs="?", help="Command of (UCI) engine to use") parser.add_argument("-conf", nargs="?", help="Location of engines.json file to use") parser.add_argument("-name", nargs="?", help="Name of engine to use from conf") parser.add_argument("-selfplay", action="store_true", help="Play against itself") parser.add_argument("-debug", action="store_true", help="Enable debugging of engine") parser.add_argument("-movetime", type=int, default=0, help="Movetime in ms") parser.add_argument("-nodes", type=int, default=0, help="Maximum nodes") parser.add_argument( "-pvs", nargs="?", const=3, default=0, type=int, help="Show Principal Variations (when mcts)", ) parser.add_argument( "-fen", help="Start from given position", default="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", ) async def load_engine_from_cmd(cmd, debug=False): _, engine = await chess.engine.popen_uci(cmd.split()) if hasattr(engine, "debug"): engine.debug(debug) return engine async def load_engine_from_conf(engine_args, name, debug=False): args = next(a for a in engine_args if a["name"] == name) curdir = str(pathlib.Path(__file__).parent) popen_args = {} if "workingDirectory" in args: popen_args["cwd"] = args["workingDirectory"].replace("$FILE", curdir) cmd = args["command"].split() if cmd[0] == "$PYTHON": cmd[0] = sys.executable if args["protocol"] == "uci": _, engine = await chess.engine.popen_uci(cmd, **popen_args) elif args["protocol"] == "xboard": _, engine = await chess.engine.popen_xboard(cmd, **popen_args) if hasattr(engine, "debug"): engine.debug(debug) await engine.configure( {opt["name"]: opt["value"] for opt in args.get("options", [])} ) return engine def get_user_move(board): # Get well-formated move move = None while move is None: san_option = random.choice([board.san(m) for m in board.legal_moves]) uci_option = random.choice([m.uci() for m in board.legal_moves]) uci = input(f"Your move (e.g. {san_option} or {uci_option}): ") if uci in ("quit", "exit"): return None for parse in (board.parse_san, chess.Move.from_uci): try: move = parse(uci) except ValueError: pass # Check legality if move not in board.legal_moves: print("Illegal move.") return get_user_move(board) return move def get_user_color(): color = "" while color not in ("white", "black"): color = input("Do you want to be white or black? ") return chess.WHITE if color == "white" else chess.BLACK def print_unicode_board(board, perspective=chess.WHITE): """Prints the position from a given perspective.""" sc, ec = "\x1b[0;30;107m", "\x1b[0m" for r in range(8) if perspective == chess.BLACK else range(7, -1, -1): line = [f"{sc} {r+1}"] for c in range(8) if perspective == chess.WHITE else range(7, -1, -1): color = "\x1b[48;5;255m" if (r + c) % 2 == 1 else "\x1b[48;5;253m" if board.move_stack: if board.move_stack[-1].to_square == 8 * r + c: color = "\x1b[48;5;153m" elif board.move_stack[-1].from_square == 8 * r + c: color = "\x1b[48;5;153m" piece = board.piece_at(8 * r + c) line.append( color + (chess.UNICODE_PIECE_SYMBOLS[piece.symbol()] if piece else " ") ) print(" " + " ".join(line) + f" {sc} {ec}") if perspective == chess.WHITE: print(f" {sc} a b c d e f g h {ec}\n") else: print(f" {sc} h g f e d c b a {ec}\n") async def get_engine_move(engine, board, limit, game_id, multipv, debug=False): # XBoard engine doesn't support multipv, and there python-chess doesn't support # getting the first PV while playing a game. if isinstance(engine, chess.engine.XBoardProtocol): play_result = await engine.play(board, limit, game=game_id) return play_result.move multipv = min(multipv, board.legal_moves.count()) with await engine.analysis( board, limit, game=game_id, info=chess.engine.INFO_ALL, multipv=multipv or None ) as analysis: infos = [None for _ in range(multipv)] first = True async for new_info in analysis: # If multipv = 0 it means we don't want them at all, # but uci requires MultiPV to be at least 1. if multipv and "multipv" in new_info: infos[new_info["multipv"] - 1] = new_info # Parse optional arguments into a dict if debug and "string" in new_info: print(new_info["string"]) if not debug and all(infos) and "score" in analysis.info: if not first: # print('\n'*(multipv+1), end='') print(f"\u001b[1A\u001b[K" * (multipv + 1), end="") else: first = False info = analysis.info score = info["score"].relative score = ( f"Score: {score.score()}" if score.score() is not None else f"Mate in {score.mate()}" ) print( f'{score}, nodes: {info.get("nodes", "N/A")}, nps: {info.get("nps", "N/A")},' f' time: {float(info.get("time", 0)):.1f}', end="", ) print() for info in infos: if "pv" in info: variation = board.variation_san(info["pv"][:10]) else: variation = "" if "score" in info: score = info["score"].relative score = ( math.tanh(score.score() / 600) if score.score() is not None else score.mate() ) key, *val = info.get("string", "").split() if key == "pv_nodes": nodes = int(val[0]) rel = nodes / analysis.info["nodes"] score_rel = f"({score:.2f}, {rel*100:.0f}%)" else: score_rel = f"({score:.2f})" else: score_rel = "" # Something about N print(f'{info["multipv"]}: {score_rel} {variation}') return analysis.info["pv"][0] async def play(engine, board, selfplay, pvs, time_limit, debug=False): if not selfplay: user_color = get_user_color() else: user_color = chess.WHITE if not board: board = chess.Board() game_id = random.random() while not board.is_game_over(): print_unicode_board(board, perspective=user_color) if not selfplay and user_color == board.turn: move = get_user_move(board) if move is None: return else: move = await get_engine_move( engine, board, time_limit, game_id, pvs, debug=debug ) print(f" My move: {board.san(move)}") board.push(move) # Print status print_unicode_board(board, perspective=user_color) print("Result:", board.result()) async def main(): args = parser.parse_args() if args.debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.ERROR) if not args.conf: if args.cmd: engine = await load_engine_from_cmd(args.cmd, debug=args.debug) else: path = pathlib.Path(__file__).parent / "engines.json" if not path.is_file(): print("Unable to locate engines.json file.") return conf = json.load(path.open()) else: if args.conf: conf = json.load(open(args.conf)) else: path = pathlib.Path(__file__).parent / "engines.json" if not path.is_file(): print("Unable to locate engines.json file.") return conf = json.load(path.open()) engine = await load_engine_from_conf(conf, args.name, debug=args.debug) if "author" in engine.id: print(f"Playing against {engine.id['name']} by {engine.id['author']}.") else: print(f"Playing against {engine.id['name']}.") board = chess.Board(args.fen) if args.movetime: limit = chess.engine.Limit(time=args.movetime / 1000) elif args.nodes: limit = chess.engine.Limit(nodes=args.nodes) else: limit = chess.engine.Limit( white_clock=30, black_clock=30, white_inc=1, black_inc=1 ) try: await play( engine, board, selfplay=args.selfplay, pvs=args.pvs, time_limit=limit, debug=args.debug, ) finally: print("\nGoodbye!") await engine.quit() asyncio.set_event_loop_policy(chess.engine.EventLoopPolicy()) try: asyncio.run(main()) except KeyboardInterrupt: pass --- requirements.txt --- chess==1.9.4 --- .github/workflows/test.yml --- name: Run Tests on: ["push"] jobs: test: runs-on: ubuntu-latest environment: basic steps: - name: Check out repository code uses: actions/checkout@v2 - name: Install dependencies run: | curl https://get.modular.com | MODULAR_AUTH=${{ secrets.MODULAR_AUTH }} sh - modular auth ${{ secrets.MODULAR_AUTH }} modular install mojo pip install pytest pip install git+https://github.com/guidorice/mojo-pytest.git - name: Unit Tests run: | export MODULAR_HOME="/home/runner/.modular" export PATH="/home/runner/.modular/pkg/packages.modular.com_mojo/bin:$PATH" pytest bash run_examples.sh --- .gitignore --- # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ --- .pre-commit-config.yaml --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: local hooks: - id: mojo-format name: mojo-format entry: mojo format -l 120 language: system files: '\.(mojo|🔥)$' stages: [commit] --- LICENSE --- MIT License Copyright (c) 2024 Mikhail Tavarez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Prism ![Mojo 24.4](https://img.shields.io/badge/Mojo%F0%9F%94%A5-24.4-purple) A Budding CLI Library! Inspired by: `Cobra`! > [!NOTE] > This library will often have breaking changes and it should not be used for anything in production. ## Usage WIP: Documentation, but you should be able to figure out how to use the library by looking at the examples. You should be able to build the package by running `mojo package prism -I external`. For the easiest method, I recommend just copying the entire external folder into your repository, then copy the `prism` folder into the external folder as well. > NOTE: It seems like `.mojopkg` files don't like being part of another package, eg. sticking all of your external deps in an `external` or `vendor` package. The only way I've gotten mojopkg files to work is to be in the same directory as the file being executed, and that directory cannot be a mojo package. ### Basic Command and Subcommand Here's an example of a basic command and subcommand! ![Basic Example](https://github.com/thatstoasty/prism/blob/main/demos/images/chromeria.png) ![Chromeria](https://github.com/thatstoasty/prism/blob/main/demos/tapes/hello-chromeria.gif) ### Command Flags Commands can have typed flags added to them to enable different behaviors. ```mojo var root_command = Arc(Command( name="logger", description="Base command.", run=handler )) root_command[].flags.add_string_flag(name="type", shorthand="t", usage="Formatting type: [json, custom]") ``` ![Logging](https://github.com/thatstoasty/prism/blob/main/demos/tapes/logging.gif) ### Command Aliases Commands can also be aliased to enable different ways to call the same command. You can change the command underneath the alias and maintain the same behavior. ```mojo var tool_command = Arc(Command( name="tool", description="This is a dummy command!", run=tool_func, aliases=List[String]("object", "thing") )) ``` ![Aliases](https://github.com/thatstoasty/prism/blob/main/demos/tapes/aliases.gif) ### Pre and Post Run Hooks Commands can be configured to run pre-hook and post-hook functions before and after the command's main run function. ```mojo fn pre_hook(command: Arc[Command], args: List[String]) -> None: print("Pre-hook executed!") return None fn post_hook(command: Arc[Command], args: List[String]) -> None: print("Post-hook executed!") return None fn init() -> None: var root_command = Arc(Command( name="printer", description="Base command.", run=printer, pre_run=pre_hook, post_run=post_hook, )) ``` ![Printer](https://github.com/thatstoasty/prism/blob/main/demos/tapes/printer.gif) ### Persistent Flags and Hooks Flags and hooks can also be inherited by children commands! This can be useful for setting global flags or hooks that should be applied to all child commands. ```mojo fn init() -> None: var root_command = Arc(Command(name="nested", description="Base command.", run=base)) var get_command = Arc(Command( name="get", description="Base command for getting some data.", run=print_information, persistent_pre_run=pre_hook, persistent_post_run=post_hook, )) get_command[].flags.persistent_flags.add_bool_flag(name="lover", shorthand="l", usage="Are you an animal lover?") ``` ![Persistent](https://github.com/thatstoasty/prism/blob/main/demos/tapes/persistent.gif) ### Required flags Flags can be grouped together to enable relationships between them. This can be used to enable different behaviors based on the flags that are passed. By default flags are considered optional. If you want your command to report an error when a flag has not been set, mark it as required: ```mojo var tool_command = Arc(Command( name="tool", description="This is a dummy command!", run=tool_func, aliases=List[String]("object", "thing") )) tool_command[].flags.add_bool_flag(name="required", shorthand="r", usage="Always required.") tool_command[].mark_flag_required("required") ``` Same for persistent flags: ```mojo var root_command = Arc(Command( name="my", description="This is a dummy command!", run=test, )) root_command[].persistent_flags.add_bool_flag(name="free", shorthand="f", usage="Always required.") root_command[].mark_persistent_flag_required("free") ``` ### Flag Groups If you have different flags that must be provided together (e.g. if they provide the `--color` flag they MUST provide the `--formatting` flag as well) then Prism can enforce that requirement: ```mojo var tool_command = Arc(Command( name="tool", description="This is a dummy command!", run=tool_func, aliases=List[String]("object", "thing") )) tool_command[].flags.add_string_flag(name="color", shorthand="c", usage="Text color", default="#3464eb") tool_command[].flags.add_string_flag(name="formatting", shorthand="f", usage="Text formatting") tool_command[].mark_flags_required_together("color", "formatting") ``` You can also prevent different flags from being provided together if they represent mutually exclusive options such as specifying an output format as either `--color` or `--hue` but never both: ```mojo var tool_command = Arc(Command( name="tool", description="This is a dummy command!", run=tool_func, aliases=List[String]("object", "thing") )) tool_command[].add_string_flag(name="color", shorthand="c", usage="Text color", default="#3464eb") tool_command[].add_string_flag(name="hue", shorthand="x", usage="Text color", default="#3464eb") tool_command[].mark_flags_mutually_exclusive("color", "hue") ``` If you want to require at least one flag from a group to be present, you can use `mark_flags_one_required`. This can be combined with `mark_flags_mutually_exclusive` to enforce exactly one flag from a given group: ```mojo var tool_command = Arc(Command( name="tool", description="This is a dummy command!", run=tool_func, aliases=List[String]("object", "thing") )) tool_command[].flags.add_string_flag(name="color", shorthand="c", usage="Text color", default="#3464eb") tool_command[].flags.add_string_flag(name="formatting", shorthand="f", usage="Text formatting") tool_command[].mark_flags_one_required("color", "formatting") tool_command[].mark_flags_mutually_exclusive("color", "formatting") ``` In these cases: - both local and persistent flags can be used - NOTE: the group is only enforced on commands where every flag is defined - a flag may appear in multiple groups - a group may contain any number of flags ![Flag Groups](https://github.com/thatstoasty/prism/blob/main/demos/tapes/flag_groups.gif) > NOTE: If you want to enforce a rule on persistent flags, then the child command must be added to the parent command **BEFORE** setting the rule. See `examples/flag_groups/child.mojo` for an example. ```mojo fn init() -> None: var root_command = Arc(Command( name="my", description="This is a dummy command!", run=test, )) # Persistent flags are defined on the parent command. root_command[].persistent_flags.add_bool_flag(name="required", shorthand="r", usage="Always required.") root_command[].persistent_flags.add_string_flag(name="host", shorthand="h", usage="Host") root_command[].persistent_flags.add_string_flag(name="port", shorthand="p", usage="Port") root_command[].mark_persistent_flag_required("required") var tool_command = Arc(Command( name="tool", description="This is a dummy command!", run=tool_func )) tool_command[].flags.add_bool_flag(name="also", shorthand="a", usage="Also always required.") tool_command[].flags.add_string_flag(name="uri", shorthand="u", usage="URI") # Child commands are added to the parent command. root_command[].add_command(tool_command) # Rules are set on the child command, which can include persistent flags inherited from the parent command. # When executing `mark_flags_required_together()` or `mark_flags_mutually_exclusive()`, # the inherited flags from all parents will merged into the tool_command[].flags FlagSet. tool_command[].mark_flag_required("also") tool_command[].mark_flags_required_together("host", "port") tool_command[].mark_flags_mutually_exclusive("host", "uri") root_command[].execute() ``` ![Flag Groups 2](https://github.com/thatstoasty/prism/blob/main/demos/tapes/flag_groups-2.gif) ### Positional and Custom Arguments Validation of positional arguments can be specified using the `arg_validator` field of `Command`. The following validators are built in: - Number of arguments: - `no_args` - report an error if there are any positional args. - `arbitrary_args` - accept any number of args. - `minimum_n_args[Int]` - report an error if less than N positional args are provided. - `maximum_n_args[Int]` - report an error if more than N positional args are provided. - `exact_args[Int]` - report an error if there are not exactly N positional args. - `range_args[min, max]` - report an error if the number of args is not between min and max. - Content of the arguments: - `only_valid_args` - report an error if there are any positional args not specified in the `valid_args` field of `Command`, which can optionally be set to a list of valid values for positional args. If `arg_validator` is undefined, it defaults to `arbitrary_args`. > NOTE: `match_all` is unstable at the moment. I will work on ironing it out in the near future. This most likely does not work. Moreover, `match_all[arg_validators: List[ArgValidator]]` enables combining existing checks with arbitrary other checks. For instance, if you want to report an error if there are not exactly N positional args OR if there are any positional args that are not in the ValidArgs field of Command, you can call `match_all` on `exact_args` and `only_valid_args`, as shown below: ```mojo fn test_match_all(): var result = match_all[ List[ArgValidator]( range_args[0, 1](), valid_args[List[String]("Pineapple")]() ) ]()(List[String]("abc", "123")) testing.assert_equal(result.value()[], "Command accepts between 0 to 1 argument(s). Received: 2.") ``` ![Arg Validators](https://github.com/thatstoasty/prism/blob/main/demos/tapes/arg_validators.gif) ### Help Commands Commands are configured to accept a `--help` flag by default. This will print the output of a default help function. You can also configure a custom help function to be run when the `--help` flag is passed. ```mojo fn help_func(command: Arc[Command]) -> String: return "" fn init() -> None: var root_command = Arc(Command( name="hello", description="This is a dummy command!", run=test, )) var hello_command = Arc(Command(name="chromeria", description="This is a dummy command!", run=hello, help=help_func)) ``` ![Help](https://github.com/thatstoasty/prism/blob/main/demos/tapes/help.gif) ## Notes - Flags can have values passed by using the `=` operator. Like `--count=5` OR like `--count 5`. - This library leans towards Errors as values over raising Exceptions. - `Optional[Error]` would be much cleaner for Command `erroring_run` functions. For now return `Error()` if there's no `Error` to return. ## TODO ### Repository - [ ] Add a description ### Documentation ### Features - Add find suggestion logic to `Command` struct. - Enable usage function to return the results of a usage function upon calling wrong functions or commands. - Replace print usage with writers to enable stdout/stderr/file writing. - Update default help command to improve available commands and flags section. ### Improvements - Tree traversal improvements. - Once we have `Result[T]`, I will refactor raising functions to return results instead. ### Bugs - `Command` has 2 almost indentical init functions because setting a default `arg_validator` value, breaks the compiler as of 24.2. --- build_examples.sh --- #!/bin/bash export MOJO_PYTHON_LIBRARY=$(which python3) echo -e "Building binaries for all examples...\n" mojo build examples/aliases/root.mojo -o examples/aliases mojo build examples/hello_world/root.mojo -o examples/hello_world mojo build examples/hello_chromeria/root.mojo -o examples/aliases/hello_chromeria mojo build examples/nested/nested.mojo -o examples/nested mojo build examples/printer/printer.mojo -o examples/printer mojo build examples/read_csv/root.mojo -o examples/read_csv mojo build examples/logging/root.mojo -o examples/logging mojo build examples/persistent/root.mojo -o examples/persistent mojo build examples/flag_groups/root.mojo -o examples/my sleep 5 echo -e "Generating tapes...\n" --- demos/tapes/aliases.tape --- Output demos/tapes/aliases.gif Set Shell "zsh" Set FontSize 20 Set Width 1200 Set Height 400 Type "mojo build examples/aliases/root.mojo -o aliases" Sleep 500ms Enter Sleep 2s Type "./aliases" Sleep 500ms Enter Sleep 2s Type "./aliases tool" Sleep 500ms Enter Sleep 2s Type "./aliases object" Sleep 500ms Enter Sleep 2s Type "./aliases thing" Sleep 500ms Enter Sleep 1s Sleep 5s --- demos/tapes/arg_validators.tape --- Output demos/tapes/arg_validators.gif Set Shell "zsh" Set FontSize 20 Set Width 1200 Set Height 600 Type "mojo build examples/arg_validators/root.mojo -o validators" Sleep 500ms Enter Sleep 2s Type "./validators Hello from Mojo!" Sleep 500ms Enter Sleep 2s Type "./validators no_args Hello from Mojo!" Sleep 500ms Enter Sleep 2s Type "./validators valid_args Hello from Mojo!" Sleep 500ms Enter Sleep 2s Type "./validators minimum_n_args Hello from Mojo!" Sleep 500ms Enter Sleep 2s Type "./validators maximum_n_args Hello from Mojo!" Sleep 500ms Enter Sleep 2s Type "./validators exact_args Hello from Mojo!" Sleep 500ms Enter Sleep 2s Type "./validators range_args Hello from Mojo!" Sleep 500ms Enter Sleep 1s Sleep 5s --- demos/tapes/flag_groups-2.tape --- Output demos/tapes/flag_groups-2.gif Set Shell "zsh" Set FontSize 20 Set Width 1200 Set Height 600 Type "mojo build examples/flag_groups/child.mojo -o group" Sleep 500ms Enter Sleep 4s Type "./group tool --required -a --host=www.example.com --port 8080" Sleep 500ms Enter Sleep 2s Type "./group tool --required -a --host www.example.com" Sleep 500ms Enter Sleep 2s Type "./group tool --required --also --host www.example.com --uri abcdef --port 8080" Sleep 500ms Enter Sleep 2s Type "./group tool" Sleep 500ms Enter Sleep 1s Sleep 5s --- demos/tapes/flag_groups.tape --- Output demos/tapes/flag_groups.gif Set Shell "zsh" Set FontSize 20 Set Width 1200 Set Height 600 Type "mojo build examples/flag_groups/parent.mojo -o group" Sleep 500ms Enter Sleep 3s Type "./group --required --host=www.example.com --port 8080" Sleep 500ms Enter Sleep 2s Type "./group --required --host www.example.com" Sleep 500ms Enter Sleep 2s Type "./group --required --host www.example.com --uri abcdef --port 8080" Sleep 500ms Enter Sleep 2s Type "./group" Sleep 500ms Enter Sleep 1s Sleep 5s --- demos/tapes/hello-chromeria.tape --- Output demos/tapes/hello-chromeria.gif Set Shell "zsh" Set FontSize 23 Set Width 1200 Set Height 300 Type "mojo build examples/hello_chromeria/root.mojo -o hello" Sleep 500ms Enter Sleep 1500ms Type "./hello" Sleep 500ms Enter Sleep 1500ms Type "./hello chromeria" Sleep 500ms Enter Sleep 5s --- demos/tapes/help.tape --- Output demos/tapes/help.gif Set Shell "zsh" Set FontSize 20 Set Width 1200 Set Height 600 Type "mojo build examples/flag_groups/child.mojo -o group" Sleep 500ms Enter Sleep 3s Type "./group --help" Sleep 500ms Enter Sleep 5s --- demos/tapes/logging.tape --- Output demos/tapes/logging.gif Set Shell "zsh" Set FontSize 20 Set Width 1200 Set Height 400 Type "mojo build examples/logging/root.mojo -o logger" Sleep 500ms Enter Sleep 4s Type "./logger 'My message.'" Sleep 500ms Enter Sleep 2s Type "./logger 'My message.' --type json" Sleep 500ms Enter Sleep 2s Type "./logger 'My message.' -t custom" Sleep 500ms Enter Sleep 1s Sleep 5s --- demos/tapes/nested/nested-1.tape --- Output demos/tapes/nested-1.gif Set Shell "zsh" Set FontSize 32 Set Width 1200 Set Height 600 Type "mojo run examples/nested/nested.mojo" Sleep 500ms Enter Sleep 5s --- demos/tapes/nested/nested-2.tape --- # VHS documentation # # Output: # Output <path>.gif Create a GIF output at the given <path> # Output <path>.mp4 Create an MP4 output at the given <path> # Output <path>.webm Create a WebM output at the given <path> # # Require: # Require <string> Ensure a program is on the $PATH to proceed # # Settings: # Set FontSize <number> Set the font size of the terminal # Set FontFamily <string> Set the font family of the terminal # Set Height <number> Set the height of the terminal # Set Width <number> Set the width of the terminal # Set LetterSpacing <float> Set the font letter spacing (tracking) # Set LineHeight <float> Set the font line height # Set LoopOffset <float>% Set the starting frame offset for the GIF loop # Set Theme <json|string> Set the theme of the terminal # Set Padding <number> Set the padding of the terminal # Set Framerate <number> Set the framerate of the recording # Set PlaybackSpeed <float> Set the playback speed of the recording # Set MarginFill <file|#000000> Set the file or color the margin will be filled with. # Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set. # Set BorderRadius <number> Set terminal border radius, in pixels. # Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight) # Set WindowBarSize <number> Set window bar size, in pixels. Default is 40. # Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms. # # Sleep: # Sleep <time> Sleep for a set amount of <time> in seconds # # Type: # Type[@<time>] "<characters>" Type <characters> into the terminal with a # <time> delay between each character # # Keys: # Escape[@<time>] [number] Press the Escape key # Backspace[@<time>] [number] Press the Backspace key # Delete[@<time>] [number] Press the Delete key # Insert[@<time>] [number] Press the Insert key # Down[@<time>] [number] Press the Down key # Enter[@<time>] [number] Press the Enter key # Space[@<time>] [number] Press the Space key # Tab[@<time>] [number] Press the Tab key # Left[@<time>] [number] Press the Left Arrow key # Right[@<time>] [number] Press the Right Arrow key # Up[@<time>] [number] Press the Up Arrow key # Down[@<time>] [number] Press the Down Arrow key # PageUp[@<time>] [number] Press the Page Up key # PageDown[@<time>] [number] Press the Page Down key # Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C) # # Display: # Hide Hide the subsequent commands from the output # Show Show the subsequent commands in the output Output demos/tapes/nested-2.gif Set Shell "zsh" Set FontSize 30 Set Width 1200 Set Height 600 Type "mojo run examples/nested/nested.mojo get" Sleep 500ms Enter Sleep 5s --- demos/tapes/nested/nested-3.tape --- # VHS documentation # # Output: # Output <path>.gif Create a GIF output at the given <path> # Output <path>.mp4 Create an MP4 output at the given <path> # Output <path>.webm Create a WebM output at the given <path> # # Require: # Require <string> Ensure a program is on the $PATH to proceed # # Settings: # Set FontSize <number> Set the font size of the terminal # Set FontFamily <string> Set the font family of the terminal # Set Height <number> Set the height of the terminal # Set Width <number> Set the width of the terminal # Set LetterSpacing <float> Set the font letter spacing (tracking) # Set LineHeight <float> Set the font line height # Set LoopOffset <float>% Set the starting frame offset for the GIF loop # Set Theme <json|string> Set the theme of the terminal # Set Padding <number> Set the padding of the terminal # Set Framerate <number> Set the framerate of the recording # Set PlaybackSpeed <float> Set the playback speed of the recording # Set MarginFill <file|#000000> Set the file or color the margin will be filled with. # Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set. # Set BorderRadius <number> Set terminal border radius, in pixels. # Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight) # Set WindowBarSize <number> Set window bar size, in pixels. Default is 40. # Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms. # # Sleep: # Sleep <time> Sleep for a set amount of <time> in seconds # # Type: # Type[@<time>] "<characters>" Type <characters> into the terminal with a # <time> delay between each character # # Keys: # Escape[@<time>] [number] Press the Escape key # Backspace[@<time>] [number] Press the Backspace key # Delete[@<time>] [number] Press the Delete key # Insert[@<time>] [number] Press the Insert key # Down[@<time>] [number] Press the Down key # Enter[@<time>] [number] Press the Enter key # Space[@<time>] [number] Press the Space key # Tab[@<time>] [number] Press the Tab key # Left[@<time>] [number] Press the Left Arrow key # Right[@<time>] [number] Press the Right Arrow key # Up[@<time>] [number] Press the Up Arrow key # Down[@<time>] [number] Press the Down Arrow key # PageUp[@<time>] [number] Press the Page Up key # PageDown[@<time>] [number] Press the Page Down key # Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C) # # Display: # Hide Hide the subsequent commands from the output # Show Show the subsequent commands in the output Output demos/tapes/nested-3.gif Require echo Set Shell "zsh" Set FontSize 30 Set Width 1200 Set Height 600 Type "mojo run examples/nested/nested.mojo get cat" Sleep 500ms Enter Sleep 5s --- demos/tapes/nested/nested-4.tape --- # VHS documentation # # Output: # Output <path>.gif Create a GIF output at the given <path> # Output <path>.mp4 Create an MP4 output at the given <path> # Output <path>.webm Create a WebM output at the given <path> # # Require: # Require <string> Ensure a program is on the $PATH to proceed # # Settings: # Set FontSize <number> Set the font size of the terminal # Set FontFamily <string> Set the font family of the terminal # Set Height <number> Set the height of the terminal # Set Width <number> Set the width of the terminal # Set LetterSpacing <float> Set the font letter spacing (tracking) # Set LineHeight <float> Set the font line height # Set LoopOffset <float>% Set the starting frame offset for the GIF loop # Set Theme <json|string> Set the theme of the terminal # Set Padding <number> Set the padding of the terminal # Set Framerate <number> Set the framerate of the recording # Set PlaybackSpeed <float> Set the playback speed of the recording # Set MarginFill <file|#000000> Set the file or color the margin will be filled with. # Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set. # Set BorderRadius <number> Set terminal border radius, in pixels. # Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight) # Set WindowBarSize <number> Set window bar size, in pixels. Default is 40. # Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms. # # Sleep: # Sleep <time> Sleep for a set amount of <time> in seconds # # Type: # Type[@<time>] "<characters>" Type <characters> into the terminal with a # <time> delay between each character # # Keys: # Escape[@<time>] [number] Press the Escape key # Backspace[@<time>] [number] Press the Backspace key # Delete[@<time>] [number] Press the Delete key # Insert[@<time>] [number] Press the Insert key # Down[@<time>] [number] Press the Down key # Enter[@<time>] [number] Press the Enter key # Space[@<time>] [number] Press the Space key # Tab[@<time>] [number] Press the Tab key # Left[@<time>] [number] Press the Left Arrow key # Right[@<time>] [number] Press the Right Arrow key # Up[@<time>] [number] Press the Up Arrow key # Down[@<time>] [number] Press the Down Arrow key # PageUp[@<time>] [number] Press the Page Up key # PageDown[@<time>] [number] Press the Page Down key # Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C) # # Display: # Hide Hide the subsequent commands from the output # Show Show the subsequent commands in the output Output demos/tapes/nested-4.gif Require echo Set Shell "zsh" Set FontSize 25 Set Width 1200 Set Height 600 Type "mojo run examples/nested/nested.mojo get cat --count=3" Sleep 500ms Enter Sleep 5s --- demos/tapes/persistent.tape --- Output demos/tapes/persistent.gif Set Shell "zsh" Set FontSize 20 Set Width 1200 Set Height 400 # Type "mojo build examples/persistent/root.mojo -o pet_facts" Sleep 500ms Enter # Sleep 1500ms # Type "./pet_facts get dog -l" Sleep 500ms Enter Type "mojo run examples/persistent/root.mojo get dog -l" Sleep 500ms Enter Sleep 3s Sleep 5s --- demos/tapes/printer.tape --- Output demos/tapes/printer.gif Set Shell "zsh" Set FontSize 23 Set Width 1200 Set Height 400 Type "mojo build examples/printer/printer.mojo -o printer" Sleep 500ms Enter Sleep 4s Type "./printer 'Blue Drafter'" Sleep 500ms Enter Sleep 2s Type "./printer 'Red Drafter' --color #e02214 --formatting underline" Sleep 500ms Enter Sleep 1s Sleep 5s --- examples/__init__.mojo --- --- examples/aliases/__init__.mojo --- --- examples/aliases/root.mojo --- from prism import Command, CommandArc fn test(command: Arc[Command], args: List[String]) -> None: print("Pass tool, object, or thing as a subcommand!") fn tool_func(command: Arc[Command], args: List[String]) -> None: print("My tool!") fn init() -> None: var root_command = Arc( Command( name="my", description="This is a dummy command!", run=test, ) ) var tool_command = Arc( Command( name="tool", description="This is a dummy command!", run=tool_func, aliases=List[String]("object", "thing") ) ) root_command[].add_command(tool_command) root_command[].execute() fn main() -> None: init() --- examples/arg_validators/__init__.mojo --- --- examples/arg_validators/root.mojo --- from prism import Command, CommandArc, no_args, valid_args, minimum_n_args, maximum_n_args, exact_args, range_args fn test(command: Arc[Command], args: List[String]) -> None: var cmd = command for arg in args: print("Received", arg[]) fn hello(command: Arc[Command], args: List[String]) -> None: var cmd = command print(cmd[].name, "Hello from Chromeria!") fn init() -> None: var root_command = Arc( Command( name="hello", description="This is a dummy command!", run=test, ) ) var no_args_command = Arc( Command(name="no_args", description="This is a dummy command!", run=hello, arg_validator=no_args) ) var valid_args_command = Arc( Command( name="valid_args", description="This is a dummy command!", run=hello, arg_validator=valid_args[List[String]("Red", "Blue")](), ) ) var minimum_n_args_command = Arc( Command( name="minimum_n_args", description="This is a dummy command!", run=hello, arg_validator=minimum_n_args[4]() ) ) var maximum_n_args_command = Arc( Command( name="maximum_n_args", description="This is a dummy command!", run=hello, arg_validator=maximum_n_args[1]() ) ) var exact_args_command = Arc( Command(name="exact_args", description="This is a dummy command!", run=hello, arg_validator=exact_args[1]()) ) var range_args_command = Arc( Command(name="range_args", description="This is a dummy command!", run=hello, arg_validator=range_args[0, 1]()) ) root_command[].add_command(no_args_command) root_command[].add_command(valid_args_command) root_command[].add_command(minimum_n_args_command) root_command[].add_command(maximum_n_args_command) root_command[].add_command(exact_args_command) root_command[].add_command(range_args_command) root_command[].execute() fn main() -> None: init() --- examples/flag_groups/__init__.mojo --- --- examples/flag_groups/child.mojo --- from prism import Command, CommandArc fn test(command: Arc[Command], args: List[String]) -> None: print("Pass tool, object, or thing as a subcommand!") fn tool_func(command: Arc[Command], args: List[String]) -> None: print("My tool!") fn init() -> None: var root_command = Arc( Command( name="my", description="This is a dummy command!", run=test, ) ) root_command[].persistent_flags.add_bool_flag(name="required", shorthand="r", usage="Always required.") root_command[].persistent_flags.add_string_flag(name="host", shorthand="h", usage="Host") root_command[].persistent_flags.add_string_flag(name="port", shorthand="p", usage="Port") root_command[].mark_persistent_flag_required("required") var tool_command = Arc(Command(name="tool", description="This is a dummy command!", run=tool_func)) tool_command[].flags.add_bool_flag(name="also", shorthand="a", usage="Also always required.") tool_command[].flags.add_string_flag(name="uri", shorthand="u", usage="URI") root_command[].add_command(tool_command) # Make sure to add the child command to the parent before marking flags. # add_command() will merge persistent flags from the parent into the child's flags. tool_command[].mark_flag_required("also") tool_command[].mark_flags_required_together("host", "port") tool_command[].mark_flags_mutually_exclusive("host", "uri") root_command[].execute() fn main() -> None: init() --- examples/flag_groups/parent.mojo --- from prism import Command fn test(command: Arc[Command], args: List[String]) -> None: print("Pass tool, object, or thing as a subcommand!") fn tool_func(command: Arc[Command], args: List[String]) -> None: print("My tool!") fn init() -> None: var root_command = Arc( Command( name="my", description="This is a dummy command!", run=test, ) ) root_command[].persistent_flags.add_bool_flag(name="required", shorthand="r", usage="Always required.") root_command[].persistent_flags.add_string_flag(name="host", shorthand="h", usage="Host") root_command[].persistent_flags.add_string_flag(name="port", shorthand="p", usage="Port") root_command[].persistent_flags.add_string_flag(name="uri", shorthand="u", usage="URI") root_command[].mark_flags_required_together("host", "port") root_command[].mark_flags_mutually_exclusive("host", "uri") root_command[].mark_flag_required("required") root_command[].execute() fn main() -> None: init() --- examples/hello_chromeria/__init__.mojo --- --- examples/hello_chromeria/root.mojo --- from prism import Command fn test(command: Arc[Command], args: List[String]) -> None: print("Pass chromeria as a subcommand!") fn hello(command: Arc[Command], args: List[String]) -> None: print("Hello from Chromeria!") fn init() -> None: var root_command = Arc( Command( name="hello", description="This is a dummy command!", run=test, ) ) var hello_command = Arc(Command(name="chromeria", description="This is a dummy command!", run=hello)) root_command[].add_command(hello_command) root_command[].execute() fn main() -> None: init() --- examples/hello_world/__init__.mojo --- --- examples/hello_world/printer.mojo --- from prism import Command, CommandArc fn printer(command: Arc[Command], args: List[String]) -> None: if len(args) == 0: print("No args provided.") return print(args[0]) return fn build_printer_command() -> Arc[Command]: var cmd = Arc( Command( name="printer", description="Print the first arg.", run=printer, ) ) return cmd --- examples/hello_world/root.mojo --- from prism import Command, CommandArc from examples.hello_world.say import ( build_say_command, build_hello_command, build_goodbye_command, ) from examples.hello_world.printer import build_printer_command fn test(command: Arc[Command], args: List[String]) -> None: var cmd = command for item in cmd[].flags.flags: print(item[].name, item[].value.value()[]) return None fn init() -> None: var root_command = Arc( Command( name="tones", description="This is a dummy command!", run=test, ) ) root_command[].flags.add_string_flag(name="env", shorthand="e", usage="Environment.") var say_command = build_say_command() var hello_command = build_hello_command() var goodbye_command = build_goodbye_command() var printer_command = build_printer_command() say_command[].add_command(goodbye_command) say_command[].add_command(hello_command) root_command[].add_command(say_command) root_command[].add_command(printer_command) root_command[].execute() fn main() -> None: init() --- examples/hello_world/say.mojo --- from prism import Flag, Command from prism.command import CommandArc fn say(command: Arc[Command], args: List[String]) -> None: print("Shouldn't be here!") return None fn say_hello(command: Arc[Command], args: List[String]) -> None: print("Hello World!") return None fn say_goodbye(command: Arc[Command], args: List[String]) -> None: print("Goodbye World!") return None # for some reason returning the command object without setting it to variable breaks the compiler fn build_say_command() -> Arc[Command]: return Arc( Command( name="say", description="Say something to someone", run=say, ) ) fn build_hello_command() -> Arc[Command]: var cmd = Arc( Command( name="hello", description="Say hello to someone", run=say_hello, ) ) return cmd fn build_goodbye_command() -> Arc[Command]: var cmd = Arc( Command( name="goodbye", description="Say goodbye to someone", run=say_goodbye, ) ) return cmd --- examples/nested/README.md --- # Nested ![Nested Example](https://github.com/thatstoasty/prism/blob/feature/documentation/demos/images/nested.png) Start by navigating to the `nested` example directory. `cd examples/nested` Run the example by using the following command, we're not specifying a subcommand so we should be executing the root command. ![Nested 1](https://github.com/thatstoasty/prism/blob/feature/documentation/demos/tapes/nested/nested-1.gif) Now try running it with a subcommand. ![Nested 1](https://github.com/thatstoasty/prism/blob/feature/documentation/demos/tapes/nested/nested-2.gif) Let's follow the suggestion and add the cat subcommand. ![Nested 1](https://github.com/thatstoasty/prism/blob/feature/documentation/demos/tapes/nested/nested-3.gif) Now try running it with a flag to get three facts. ![Nested 1](https://github.com/thatstoasty/prism/blob/feature/documentation/demos/tapes/nested/nested-4.gif) Let's try running it from a compiled binary instead. Start by setting your `MOJO_PYTHON_LIBRARY` environment variable to your default python3 installation. We need to do this because we're using the `requests` module via Python interop. `export MOJO_PYTHON_LIBRARY=$(which python3)` Compile the example file into a binary. `mojo build nested.mojo` Now run the previous command, but with the binary instead. `./nested --count 3` You should get the same result as before! But, what about command information? ```bash ./nested get cat --help Get some cat facts! Usage: nested get cat [args] [flags] Available commands: Available flags: -h, --help Displays help information about the command. -c, --count Number of facts to get. Use "root get cat [command] --help" for more information about a command. ``` Usage information will be printed the console by passing the `--help` flag. --- examples/nested/__init__.mojo --- --- examples/nested/nested.mojo --- from prism import Command, CommandArc from python import Python, PythonObject fn base(command: Arc[Command], args: List[String]) -> None: print("This is the base command!") return None fn print_information(command: Arc[Command], args: List[String]) -> None: print("Pass cat or dog as a subcommand, and see what you get!") return None fn get_cat_fact(command: Arc[Command], args: List[String]) -> Error: var cmd = command var flags = cmd[].flags var lover = flags.get_as_bool("lover") if lover and lover.value()[]: print("Hello fellow cat lover!") try: var requests = Python.import_module("requests") # URL you want to send a GET request to var url = "https://cat-fact.herokuapp.com/facts/" # Send the GET request var response = requests.get(url) # Check if the request was successful (status code 200) if response.status_code == 200: var count = flags.get_as_int("count") if not count: return Error("Count flag was not found.") var body = response.json() for i in range(count.value()[]): print(body[i]["text"]) else: return Error("Request failed!") except e: return e return Error() fn get_dog_breeds(command: Arc[Command], args: List[String]) -> Error: try: var requests = Python.import_module("requests") # URL you want to send a GET request to var url = "https://dog.ceo/api/breeds/list/all" # Send the GET request var response = requests.get(url) # Check if the request was successful (status code 200) if response.status_code == 200: print(response.json()["message"]) else: return Error("Request failed!") except e: return e return Error() fn init() -> None: var root_command = Arc(Command(name="nested", description="Base command.", run=base)) var get_command = Arc( Command( name="get", description="Base command for getting some data.", run=print_information, ) ) var cat_command = Arc( Command( name="cat", description="Get some cat facts!", erroring_run=get_cat_fact, ) ) cat_command[].flags.add_int_flag(name="count", shorthand="c", usage="Number of facts to get.", default=1) cat_command[].flags.add_bool_flag(name="lover", shorthand="l", usage="Are you a cat lover?") var dog_command = Arc( Command( name="dog", description="Get some dog breeds!", erroring_run=get_dog_breeds, ) ) get_command[].add_command(cat_command) get_command[].add_command(dog_command) root_command[].add_command(get_command) root_command[].execute() fn main() -> None: init() --- examples/persistent/__init__.mojo --- --- examples/persistent/root.mojo --- from prism import Command, CommandArc from python import Python, PythonObject fn base(command: Arc[Command], args: List[String]) -> None: print("This is the base command!") return None fn print_information(command: Arc[Command], args: List[String]) -> None: print("Pass cat or dog as a subcommand, and see what you get!") return None fn get_cat_fact(command: Arc[Command], args: List[String]) -> Error: var cmd = command var flags = cmd[].flags var lover = flags.get_as_bool("lover") if lover and lover.value()[]: print("Hello fellow cat lover!") try: var requests = Python.import_module("requests") # URL you want to send a GET request to var url = "https://cat-fact.herokuapp.com/facts/" # Send the GET request var response = requests.get(url) # Check if the request was successful (status code 200) if response.status_code == 200: var count = flags.get_as_int("count") if not count: return Error("Count flag was not found.") var body = response.json() for i in range(count.value()[]): print(body[i]["text"]) else: return Error("Request failed!") except e: return e return Error() fn get_dog_breeds(command: Arc[Command], args: List[String]) -> Error: var cmd = command var flags = cmd[].flags var lover = flags.get_as_bool("lover") if lover and lover.value()[]: print("Hello fellow dog lover!") try: var requests = Python.import_module("requests") # URL you want to send a GET request to var url = "https://dog.ceo/api/breeds/list/all" # Send the GET request var response = requests.get(url) # Check if the request was successful (status code 200) if response.status_code == 200: print(response.json()["message"]) else: return Error("Request failed!") except e: return e return Error() fn pre_hook(command: Arc[Command], args: List[String]) -> None: print("Pre-hook executed!") fn post_hook(command: Arc[Command], args: List[String]) -> None: print("Post-hook executed!") fn init() -> None: var root_command = Arc(Command(name="nested", description="Base command.", run=base)) var get_command = Arc( Command( name="get", description="Base command for getting some data.", run=print_information, persistent_pre_run=pre_hook, persistent_post_run=post_hook, ) ) get_command[].persistent_flags.add_bool_flag(name="lover", shorthand="l", usage="Are you an animal lover?") var cat_command = Arc( Command( name="cat", description="Get some cat facts!", erroring_run=get_cat_fact, ) ) cat_command[].flags.add_int_flag(name="count", shorthand="c", usage="Number of facts to get.") var dog_command = Arc( Command( name="dog", description="Get some dog breeds!", erroring_run=get_dog_breeds, ) ) get_command[].add_command(cat_command) get_command[].add_command(dog_command) root_command[].add_command(get_command) root_command[].execute() fn main() -> None: init() --- examples/printer/__init__.mojo --- --- examples/printer/printer.mojo --- from prism import Command, CommandArc, exact_args from external.mist import TerminalStyle fn printer(command: Arc[Command], args: List[String]) -> None: var cmd = command if len(args) <= 0: print("No text to print! Pass in some text as a positional argument.") return None var color = cmd[].flags.get_as_string("color") var formatting = cmd[].flags.get_as_string("formatting") var style = TerminalStyle() if not color: color = String("") if not formatting: formatting = String("") if color.or_else("") != "": style = style.foreground(style.profile.color(color.value()[])) var formatting_value = formatting.or_else("") if formatting_value == "": print(style.render(args[0])) return None if formatting.value()[] == "bold": style = style.bold() elif formatting.value()[] == "underline": style = style.underline() elif formatting.value()[] == "italic": style = style.italic() print(style.render(args[0])) return None fn pre_hook(command: Arc[Command], args: List[String]) -> None: print("Pre-hook executed!") return None fn post_hook(command: Arc[Command], args: List[String]) -> None: print("Post-hook executed!") return None fn init() -> None: var root_command = Arc( Command( name="printer", description="Base command.", run=printer, pre_run=pre_hook, post_run=post_hook, arg_validator=exact_args[1](), ) ) root_command[].flags.add_string_flag(name="color", shorthand="c", usage="Text color", default="#3464eb") root_command[].flags.add_string_flag(name="formatting", shorthand="f", usage="Text formatting") root_command[].execute() fn main() -> None: init() --- external/__init__.mojo --- --- external/gojo/__init__.mojo --- --- external/gojo/bufio/__init__.mojo --- from .bufio import Reader, Writer, ReadWriter from .scan import Scanner, scan_words, scan_bytes, scan_lines --- external/gojo/bufio/bufio.mojo --- import ..io from ..builtins import copy, panic from ..builtins.bytes import UInt8, index_byte from ..strings import StringBuilder alias MIN_READ_BUFFER_SIZE = 16 alias MAX_CONSECUTIVE_EMPTY_READS = 100 alias DEFAULT_BUF_SIZE = 4096 alias ERR_INVALID_UNREAD_BYTE = "bufio: invalid use of unread_byte" alias ERR_INVALID_UNREAD_RUNE = "bufio: invalid use of unread_rune" alias ERR_BUFFER_FULL = "bufio: buffer full" alias ERR_NEGATIVE_COUNT = "bufio: negative count" alias ERR_NEGATIVE_READ = "bufio: reader returned negative count from Read" alias ERR_NEGATIVE_WRITE = "bufio: writer returned negative count from write" # buffered input struct Reader[R: io.Reader](Sized, io.Reader, io.ByteReader, io.ByteScanner): """Implements buffering for an io.Reader object.""" var buf: List[UInt8] var reader: R # reader provided by the client var read_pos: Int var write_pos: Int # buf read and write positions var last_byte: Int # last byte read for unread_byte; -1 means invalid var last_rune_size: Int # size of last rune read for unread_rune; -1 means invalid var err: Error fn __init__( inout self, owned reader: R, buf: List[UInt8] = List[UInt8](capacity=DEFAULT_BUF_SIZE), read_pos: Int = 0, write_pos: Int = 0, last_byte: Int = -1, last_rune_size: Int = -1, ): self.buf = buf self.reader = reader^ self.read_pos = read_pos self.write_pos = write_pos self.last_byte = last_byte self.last_rune_size = last_rune_size self.err = Error() fn __moveinit__(inout self, owned existing: Self): self.buf = existing.buf^ self.reader = existing.reader^ self.read_pos = existing.read_pos self.write_pos = existing.write_pos self.last_byte = existing.last_byte self.last_rune_size = existing.last_rune_size self.err = existing.err^ # size returns the size of the underlying buffer in bytes. fn __len__(self) -> Int: return len(self.buf) # reset discards any buffered data, resets all state, and switches # the buffered reader to read from r. # Calling reset on the zero value of [Reader] initializes the internal buffer # to the default size. # Calling self.reset(b) (that is, resetting a [Reader] to itself) does nothing. # fn reset[R: io.Reader](self, reader: R): # # If a Reader r is passed to NewReader, NewReader will return r. # # Different layers of code may do that, and then later pass r # # to reset. Avoid infinite recursion in that case. # if self == reader: # return # # if self.buf == nil: # # self.buf = make(List[UInt8], DEFAULT_BUF_SIZE) # self.reset(self.buf, r) fn reset(inout self, buf: List[UInt8], owned reader: R): self = Reader[R]( buf=buf, reader=reader^, last_byte=-1, last_rune_size=-1, ) fn fill(inout self): """Reads a new chunk into the buffer.""" # Slide existing data to beginning. if self.read_pos > 0: var current_capacity = self.buf.capacity self.buf = self.buf[self.read_pos : self.write_pos] self.buf.reserve(current_capacity) self.write_pos -= self.read_pos self.read_pos = 0 # Compares to the length of the entire List[UInt8] object, including 0 initialized positions. # IE. var b = List[UInt8](capacity=4096), then trying to write at b[4096] and onwards will fail. if self.write_pos >= self.buf.capacity: panic("bufio.Reader: tried to fill full buffer") # Read new data: try a limited number of times. var i: Int = MAX_CONSECUTIVE_EMPTY_READS while i > 0: # TODO: Using temp until slicing can return a Reference var temp = List[UInt8](capacity=DEFAULT_BUF_SIZE) var bytes_read: Int var err: Error bytes_read, err = self.reader.read(temp) if bytes_read < 0: panic(ERR_NEGATIVE_READ) bytes_read = copy(self.buf, temp, self.write_pos) self.write_pos += bytes_read if err: self.err = err return if bytes_read > 0: return i -= 1 self.err = Error(io.ERR_NO_PROGRESS) fn read_error(inout self) -> Error: if not self.err: return Error() var err = self.err self.err = Error() return err fn peek(inout self, number_of_bytes: Int) -> (List[UInt8], Error): """Returns the next n bytes without advancing the reader. The bytes stop being valid at the next read call. If Peek returns fewer than n bytes, it also returns an error explaining why the read is short. The error is [ERR_BUFFER_FULL] if number_of_bytes is larger than b's buffer size. Calling Peek prevents a [Reader.unread_byte] or [Reader.unread_rune] call from succeeding until the next read operation. Args: number_of_bytes: The number of bytes to peek. """ if number_of_bytes < 0: return List[UInt8](), Error(ERR_NEGATIVE_COUNT) self.last_byte = -1 self.last_rune_size = -1 while self.write_pos - self.read_pos < number_of_bytes and self.write_pos - self.read_pos < self.buf.capacity: self.fill() # self.write_pos-self.read_pos < self.buf.capacity => buffer is not full if number_of_bytes > self.buf.capacity: return self.buf[self.read_pos : self.write_pos], Error(ERR_BUFFER_FULL) # 0 <= n <= self.buf.capacity var err = Error() var available_space = self.write_pos - self.read_pos if available_space < number_of_bytes: # not enough data in buffer err = self.read_error() if not err: err = Error(ERR_BUFFER_FULL) return self.buf[self.read_pos : self.read_pos + number_of_bytes], err fn discard(inout self, number_of_bytes: Int) -> (Int, Error): """Discard skips the next n bytes, returning the number of bytes discarded. If Discard skips fewer than n bytes, it also returns an error. If 0 <= number_of_bytes <= self.buffered(), Discard is guaranteed to succeed without reading from the underlying io.Reader. """ if number_of_bytes < 0: return 0, Error(ERR_NEGATIVE_COUNT) if number_of_bytes == 0: return 0, Error() self.last_byte = -1 self.last_rune_size = -1 var remain = number_of_bytes while True: var skip = self.buffered() if skip == 0: self.fill() skip = self.buffered() if skip > remain: skip = remain self.read_pos += skip remain -= skip if remain == 0: return number_of_bytes, Error() fn read(inout self, inout dest: List[UInt8]) -> (Int, Error): """Reads data into dest. It returns the number of bytes read into dest. The bytes are taken from at most one Read on the underlying [Reader], hence n may be less than len(src). To read exactly len(src) bytes, use io.ReadFull(b, src). If the underlying [Reader] can return a non-zero count with io.EOF, then this Read method can do so as well; see the [io.Reader] docs.""" var space_available = dest.capacity - len(dest) if space_available == 0: if self.buffered() > 0: return 0, Error() return 0, self.read_error() var bytes_read: Int = 0 if self.read_pos == self.write_pos: if space_available >= len(self.buf): # Large read, empty buffer. # Read directly into dest to avoid copy. var bytes_read: Int var err: Error bytes_read, err = self.reader.read(dest) self.err = err if bytes_read < 0: panic(ERR_NEGATIVE_READ) if bytes_read > 0: self.last_byte = int(dest[bytes_read - 1]) self.last_rune_size = -1 return bytes_read, self.read_error() # One read. # Do not use self.fill, which will loop. self.read_pos = 0 self.write_pos = 0 var bytes_read: Int var err: Error bytes_read, err = self.reader.read(self.buf) if bytes_read < 0: panic(ERR_NEGATIVE_READ) if bytes_read == 0: return 0, self.read_error() self.write_pos += bytes_read # copy as much as we can # Note: if the slice panics here, it is probably because # the underlying reader returned a bad count. See issue 49795. bytes_read = copy(dest, self.buf[self.read_pos : self.write_pos]) self.read_pos += bytes_read self.last_byte = int(self.buf[self.read_pos - 1]) self.last_rune_size = -1 return bytes_read, Error() fn read_byte(inout self) -> (UInt8, Error): """Reads and returns a single byte from the internal buffer. If no byte is available, returns an error.""" self.last_rune_size = -1 while self.read_pos == self.write_pos: if self.err: return UInt8(0), self.read_error() self.fill() # buffer is empty var c = self.buf[self.read_pos] self.read_pos += 1 self.last_byte = int(c) return c, Error() fn unread_byte(inout self) -> Error: """Unreads the last byte. Only the most recently read byte can be unread. unread_byte returns an error if the most recent method called on the [Reader] was not a read operation. Notably, [Reader.peek], [Reader.discard], and [Reader.write_to] are not considered read operations. """ if self.last_byte < 0 or self.read_pos == 0 and self.write_pos > 0: return Error(ERR_INVALID_UNREAD_BYTE) # self.read_pos > 0 or self.write_pos == 0 if self.read_pos > 0: self.read_pos -= 1 else: # self.read_pos == 0 and self.write_pos == 0 self.write_pos = 1 self.buf[self.read_pos] = self.last_byte self.last_byte = -1 self.last_rune_size = -1 return Error() # # read_rune reads a single UTF-8 encoded Unicode character and returns the # # rune and its size in bytes. If the encoded rune is invalid, it consumes one byte # # and returns unicode.ReplacementChar (U+FFFD) with a size of 1. # fn read_rune(inout self) (r rune, size int, err error): # for self.read_pos+utf8.UTFMax > self.write_pos and !utf8.FullRune(self.buf[self.read_pos:self.write_pos]) and self.err == nil and self.write_pos-self.read_pos < self.buf.capacity: # self.fill() # self.write_pos-self.read_pos < len(buf) => buffer is not full # self.last_rune_size = -1 # if self.read_pos == self.write_pos: # return 0, 0, self.read_poseadErr() # r, size = rune(self.buf[self.read_pos]), 1 # if r >= utf8.RuneSelf: # r, size = utf8.DecodeRune(self.buf[self.read_pos:self.write_pos]) # self.read_pos += size # self.last_byte = int(self.buf[self.read_pos-1]) # self.last_rune_size = size # return r, size, nil # # unread_rune unreads the last rune. If the most recent method called on # # the [Reader] was not a [Reader.read_rune], [Reader.unread_rune] returns an error. (In this # # regard it is stricter than [Reader.unread_byte], which will unread the last byte # # from any read operation.) # fn unread_rune() error: # if self.last_rune_size < 0 or self.read_pos < self.last_rune_size: # return ERR_INVALID_UNREAD_RUNE # self.read_pos -= self.last_rune_size # self.last_byte = -1 # self.last_rune_size = -1 # return nil fn buffered(self) -> Int: """Returns the number of bytes that can be read from the current buffer. Returns: The number of bytes that can be read from the current buffer. """ return self.write_pos - self.read_pos fn read_slice(inout self, delim: UInt8) -> (List[UInt8], Error): """Reads until the first occurrence of delim in the input, returning a slice pointing at the bytes in the buffer. It includes the first occurrence of the delimiter. The bytes stop being valid at the next read. If read_slice encounters an error before finding a delimiter, it returns all the data in the buffer and the error itself (often io.EOF). read_slice fails with error [ERR_BUFFER_FULL] if the buffer fills without a delim. Because the data returned from read_slice will be overwritten by the next I/O operation, most clients should use [Reader.read_bytes] or read_string instead. read_slice returns err != nil if and only if line does not end in delim. Args: delim: The delimiter to search for. Returns: The List[UInt8] from the internal buffer. """ var err = Error() var s = 0 # search start index var line: List[UInt8] = List[UInt8](capacity=DEFAULT_BUF_SIZE) while True: # Search buffer. var i = index_byte(self.buf[self.read_pos + s : self.write_pos], delim) if i >= 0: i += s line = self.buf[self.read_pos : self.read_pos + i + 1] self.read_pos += i + 1 break # Pending error? if self.err: line = self.buf[self.read_pos : self.write_pos] self.read_pos = self.write_pos err = self.read_error() break # Buffer full? if self.buffered() >= self.buf.capacity: self.read_pos = self.write_pos line = self.buf err = Error(ERR_BUFFER_FULL) break s = self.write_pos - self.read_pos # do not rescan area we scanned before self.fill() # buffer is not full # Handle last byte, if any. var i = len(line) - 1 if i >= 0: self.last_byte = int(line[i]) self.last_rune_size = -1 return line, err fn read_line(inout self) raises -> (List[UInt8], Bool): """Low-level line-reading primitive. Most callers should use [Reader.read_bytes]('\n') or [Reader.read_string]('\n') instead or use a [Scanner]. read_line tries to return a single line, not including the end-of-line bytes. If the line was too long for the buffer then isPrefix is set and the beginning of the line is returned. The rest of the line will be returned from future calls. isPrefix will be false when returning the last fragment of the line. The returned buffer is only valid until the next call to read_line. read_line either returns a non-nil line or it returns an error, never both. The text returned from read_line does not include the line end ("\r\n" or "\n"). No indication or error is given if the input ends without a final line end. Calling [Reader.unread_byte] after read_line will always unread the last byte read (possibly a character belonging to the line end) even if that byte is not part of the line returned by read_line. """ var line: List[UInt8] var err: Error line, err = self.read_slice(ord("\n")) if err and str(err) == ERR_BUFFER_FULL: # Handle the case where "\r\n" straddles the buffer. if len(line) > 0 and line[len(line) - 1] == ord("\r"): # Put the '\r' back on buf and drop it from line. # Let the next call to read_line check for "\r\n". if self.read_pos == 0: # should be unreachable raise Error("bufio: tried to rewind past start of buffer") self.read_pos -= 1 line = line[: len(line) - 1] return line, True if len(line) == 0: return line, False if line[len(line) - 1] == ord("\n"): var drop = 1 if len(line) > 1 and line[len(line) - 2] == ord("\r"): drop = 2 line = line[: len(line) - drop] return line, False fn collect_fragments(inout self, delim: UInt8) -> (List[List[UInt8]], List[UInt8], Int, Error): """Reads until the first occurrence of delim in the input. It returns (slice of full buffers, remaining bytes before delim, total number of bytes in the combined first two elements, error). Args: delim: The delimiter to search for. """ # Use read_slice to look for delim, accumulating full buffers. var err = Error() var full_buffers = List[List[UInt8]]() var total_len = 0 var frag = List[UInt8](capacity=4096) while True: frag, err = self.read_slice(delim) if not err: break var read_slice_error = err if str(read_slice_error) != ERR_BUFFER_FULL: err = read_slice_error break # Make a copy of the buffer. var buf = List[UInt8](frag) full_buffers.append(buf) total_len += len(buf) total_len += len(frag) return full_buffers, frag, total_len, err fn read_bytes(inout self, delim: UInt8) -> (List[UInt8], Error): """Reads until the first occurrence of delim in the input, returning a slice containing the data up to and including the delimiter. If read_bytes encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). read_bytes returns err != nil if and only if the returned data does not end in delim. For simple uses, a Scanner may be more convenient. Args: delim: The delimiter to search for. Returns: The List[UInt8] from the internal buffer. """ var full: List[List[UInt8]] var frag: List[UInt8] var n: Int var err: Error full, frag, n, err = self.collect_fragments(delim) # Allocate new buffer to hold the full pieces and the fragment. var buf = List[UInt8](capacity=n) n = 0 # copy full pieces and fragment in. for i in range(len(full)): var buffer = full[i] n += copy(buf, buffer, n) _ = copy(buf, frag, n) return buf, err fn read_string(inout self, delim: UInt8) -> (String, Error): """Reads until the first occurrence of delim in the input, returning a string containing the data up to and including the delimiter. If read_string encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). read_string returns err != nil if and only if the returned data does not end in delim. For simple uses, a Scanner may be more convenient. Args: delim: The delimiter to search for. Returns: The String from the internal buffer. """ var full: List[List[UInt8]] var frag: List[UInt8] var n: Int var err: Error full, frag, n, err = self.collect_fragments(delim) # Allocate new buffer to hold the full pieces and the fragment. var buf = StringBuilder(capacity=n) # copy full pieces and fragment in. for i in range(len(full)): var buffer = full[i] _ = buf.write(Span(buffer)) _ = buf.write(Span(frag)) return str(buf), err fn write_to[W: io.Writer](inout self, inout writer: W) -> (Int64, Error): """Writes the internal buffer to the writer. This may make multiple calls to the [Reader.Read] method of the underlying [Reader]. If the underlying reader supports the [Reader.WriteTo] method, this calls the underlying [Reader.WriteTo] without buffering. write_to implements io.WriterTo. Args: writer: The writer to write to. Returns: The number of bytes written. """ self.last_byte = -1 self.last_rune_size = -1 var bytes_written: Int64 var err: Error bytes_written, err = self.write_buf(writer) if err: return bytes_written, err # internal buffer not full, fill before writing to writer if (self.write_pos - self.read_pos) < self.buf.capacity: self.fill() while self.read_pos < self.write_pos: # self.read_pos < self.write_pos => buffer is not empty var bw: Int64 var err: Error bw, err = self.write_buf(writer) bytes_written += bw self.fill() # buffer is empty return bytes_written, Error() fn write_buf[W: io.Writer](inout self, inout writer: W) -> (Int64, Error): """Writes the [Reader]'s buffer to the writer. Args: writer: The writer to write to. Returns: The number of bytes written. """ # Nothing to write if self.read_pos == self.write_pos: return Int64(0), Error() # Write the buffer to the writer, if we hit EOF it's fine. That's not a failure condition. var bytes_written: Int var err: Error var buf_to_write = self.buf[self.read_pos : self.write_pos] bytes_written, err = writer.write(Span(buf_to_write)) if err: return Int64(bytes_written), err if bytes_written < 0: panic(ERR_NEGATIVE_WRITE) self.read_pos += bytes_written return Int64(bytes_written), Error() # fn new_reader_size[R: io.Reader](owned reader: R, size: Int) -> Reader[R]: # """Returns a new [Reader] whose buffer has at least the specified # size. If the argument io.Reader is already a [Reader] with large enough # size, it returns the underlying [Reader]. # Args: # reader: The reader to read from. # size: The size of the buffer. # Returns: # The new [Reader]. # """ # # # Is it already a Reader? # # b, ok := rd.(*Reader) # # if ok and self.buf.capacity >= size: # # return b # var r = Reader(reader ^) # r.reset(List[UInt8](capacity=max(size, MIN_READ_BUFFER_SIZE)), reader ^) # return r # fn new_reader[R: io.Reader](reader: R) -> Reader[R]: # """Returns a new [Reader] whose buffer has the default size. # Args: # reader: The reader to read from. # Returns: # The new [Reader]. # """ # return new_reader_size(reader, DEFAULT_BUF_SIZE) # buffered output struct Writer[W: io.Writer](Sized, io.Writer, io.ByteWriter, io.StringWriter, io.ReaderFrom): """Implements buffering for an [io.Writer] object. # If an error occurs writing to a [Writer], no more data will be # accepted and all subsequent writes, and [Writer.flush], will return the error. # After all data has been written, the client should call the # [Writer.flush] method to guarantee all data has been forwarded to # the underlying [io.Writer].""" var buf: List[UInt8] var bytes_written: Int var writer: W var err: Error fn __init__( inout self, owned writer: W, buf: List[UInt8] = List[UInt8](capacity=DEFAULT_BUF_SIZE), bytes_written: Int = 0, ): self.buf = buf self.bytes_written = bytes_written self.writer = writer^ self.err = Error() fn __moveinit__(inout self, owned existing: Self): self.buf = existing.buf^ self.bytes_written = existing.bytes_written self.writer = existing.writer^ self.err = existing.err^ fn __len__(self) -> Int: """Returns the size of the underlying buffer in bytes.""" return len(self.buf) fn reset(inout self, owned writer: W): """Discards any unflushed buffered data, clears any error, and resets b to write its output to w. Calling reset on the zero value of [Writer] initializes the internal buffer to the default size. Calling w.reset(w) (that is, resetting a [Writer] to itself) does nothing. Args: writer: The writer to write to. """ # # If a Writer w is passed to new_writer, new_writer will return w. # # Different layers of code may do that, and then later pass w # # to reset. Avoid infinite recursion in that case. # if self == writer: # return # if self.buf == nil: # self.buf = make(List[UInt8], DEFAULT_BUF_SIZE) self.err = Error() self.bytes_written = 0 self.writer = writer^ fn flush(inout self) -> Error: """Writes any buffered data to the underlying [io.Writer].""" # Prior to attempting to flush, check if there's a pre-existing error or if there's nothing to flush. var err = Error() if self.err: return self.err if self.bytes_written == 0: return err var bytes_written: Int = 0 bytes_written, err = self.writer.write(self.buf[0 : self.bytes_written]) # If the write was short, set a short write error and try to shift up the remaining bytes. if bytes_written < self.bytes_written and not err: err = Error(io.ERR_SHORT_WRITE) if err: if bytes_written > 0 and bytes_written < self.bytes_written: _ = copy(self.buf, self.buf[bytes_written : self.bytes_written]) self.bytes_written -= bytes_written self.err = err return err # Reset the buffer self.buf = List[UInt8](capacity=self.buf.capacity) self.bytes_written = 0 return err fn available(self) -> Int: """Returns how many bytes are unused in the buffer.""" return self.buf.capacity - len(self.buf) fn available_buffer(self) raises -> List[UInt8]: """Returns an empty buffer with self.available() capacity. This buffer is intended to be appended to and passed to an immediately succeeding [Writer.write] call. The buffer is only valid until the next write operation on self. Returns: An empty buffer with self.available() capacity. """ return self.buf[self.bytes_written :][:0] fn buffered(self) -> Int: """Returns the number of bytes that have been written into the current buffer. Returns: The number of bytes that have been written into the current buffer. """ return self.bytes_written fn write(inout self, src: List[UInt8]) -> (Int, Error): """Writes the contents of src into the buffer. It returns the number of bytes written. If nn < len(src), it also returns an error explaining why the write is short. Args: src: The bytes to write. Returns: The number of bytes written. """ var total_bytes_written: Int = 0 var src_copy = src var err = Error() while len(src_copy) > self.available() and not self.err: var bytes_written: Int = 0 if self.buffered() == 0: # Large write, empty buffer. # write directly from p to avoid copy. bytes_written, err = self.writer.write(src_copy) self.err = err else: bytes_written = copy(self.buf, src_copy, self.bytes_written) self.bytes_written += bytes_written _ = self.flush() total_bytes_written += bytes_written src_copy = src_copy[bytes_written : len(src_copy)] if self.err: return total_bytes_written, self.err var n = copy(self.buf, src_copy, self.bytes_written) self.bytes_written += n total_bytes_written += n return total_bytes_written, err fn write_byte(inout self, src: UInt8) -> (Int, Error): """Writes a single byte to the internal buffer. Args: src: The byte to write. """ if self.err: return 0, self.err # If buffer is full, flush to the underlying writer. var err = self.flush() if self.available() <= 0 and err: return 0, self.err self.buf.append(src) self.bytes_written += 1 return 1, Error() # # WriteRune writes a single Unicode code point, returning # # the number of bytes written and any error. # fn WriteRune(r rune) (size int, err error): # # Compare as uint32 to correctly handle negative runes. # if uint32(r) < utf8.RuneSelf: # err = self.write_posriteByte(byte(r)) # if err != nil: # return 0, err # return 1, nil # if self.err != nil: # return 0, self.err # n := self.available() # if n < utf8.UTFMax: # if self.flush(); self.err != nil: # return 0, self.err # n = self.available() # if n < utf8.UTFMax: # # Can only happen if buffer is silly small. # return self.write_posriteString(string(r)) # size = utf8.EncodeRune(self.buf[self.bytes_written:], r) # self.bytes_written += size # return size, nil fn write_string(inout self, src: String) -> (Int, Error): """Writes a string to the internal buffer. It returns the number of bytes written. If the count is less than len(s), it also returns an error explaining why the write is short. Args: src: The string to write. Returns: The number of bytes written. """ return self.write(src.as_bytes_slice()) fn read_from[R: io.Reader](inout self, inout reader: R) -> (Int64, Error): """Implements [io.ReaderFrom]. If the underlying writer supports the read_from method, this calls the underlying read_from. If there is buffered data and an underlying read_from, this fills the buffer and writes it before calling read_from. Args: reader: The reader to read from. Returns: The number of bytes read. """ if self.err: return Int64(0), self.err var bytes_read: Int = 0 var total_bytes_written: Int64 = 0 var err = Error() while True: if self.available() == 0: var err = self.flush() if err: return total_bytes_written, err var nr = 0 while nr < MAX_CONSECUTIVE_EMPTY_READS: # TODO: should really be using a slice that returns refs and not a copy. # Read into remaining unused space in the buffer. We need to reserve capacity for the slice otherwise read will never hit EOF. var sl = self.buf[self.bytes_written : len(self.buf)] sl.reserve(self.buf.capacity) bytes_read, err = reader.read(sl) if bytes_read > 0: bytes_read = copy(self.buf, sl, self.bytes_written) if bytes_read != 0 or err: break nr += 1 if nr == MAX_CONSECUTIVE_EMPTY_READS: return Int64(bytes_read), Error(io.ERR_NO_PROGRESS) self.bytes_written += bytes_read total_bytes_written += Int64(bytes_read) if err: break if err and str(err) == io.EOF: # If we filled the buffer exactly, flush preemptively. if self.available() == 0: err = self.flush() else: err = Error() return total_bytes_written, Error() fn new_writer_size[W: io.Writer](owned writer: W, size: Int) -> Writer[W]: """Returns a new [Writer] whose buffer has at least the specified size. If the argument io.Writer is already a [Writer] with large enough size, it returns the underlying [Writer].""" # Is it already a Writer? # b, ok := w.(*Writer) # if ok and self.buf.capacity >= size: # return b var buf_size = size if buf_size <= 0: buf_size = DEFAULT_BUF_SIZE return Writer[W]( buf=List[UInt8](capacity=size), writer=writer^, bytes_written=0, ) fn new_writer[W: io.Writer](owned writer: W) -> Writer[W]: """Returns a new [Writer] whose buffer has the default size. # If the argument io.Writer is already a [Writer] with large enough buffer size, # it returns the underlying [Writer].""" return new_writer_size[W](writer^, DEFAULT_BUF_SIZE) # buffered input and output struct ReadWriter[R: io.Reader, W: io.Writer](): """ReadWriter stores pointers to a [Reader] and a [Writer]. It implements [io.ReadWriter].""" var reader: R var writer: W fn __init__(inout self, owned reader: R, owned writer: W): self.reader = reader^ self.writer = writer^ # new_read_writer fn new_read_writer[R: io.Reader, W: io.Writer](owned reader: R, owned writer: W) -> ReadWriter[R, W]: """Allocates a new [ReadWriter] that dispatches to r and w.""" return ReadWriter[R, W](reader^, writer^) --- external/gojo/bufio/scan.mojo --- import math from collections import Optional import ..io from ..builtins import copy, panic, Error from ..builtins.bytes import Byte, index_byte from .bufio import MAX_CONSECUTIVE_EMPTY_READS alias MAX_INT: Int = 2147483647 struct Scanner[R: io.Reader](): """Scanner provides a convenient Interface for reading data such as a file of newline-delimited lines of text. Successive calls to the [Scanner.Scan] method will step through the 'tokens' of a file, skipping the bytes between the tokens. The specification of a token is defined by a split function of type [SplitFunction]; the default split function breaks the input Into lines with line termination stripped. [Scanner.split] fntions are defined in this package for scanning a file Into lines, bytes, UTF-8-encoded runes, and space-delimited words. The client may instead provide a custom split function. Scanning stops unrecoverably at EOF, the first I/O error, or a token too large to fit in the [Scanner.buffer]. When a scan stops, the reader may have advanced arbitrarily far past the last token. Programs that need more control over error handling or large tokens, or must run sequential scans on a reader, should use [bufio.Reader] instead.""" var reader: R # The reader provided by the client. var split: SplitFunction # The function to split the tokens. var max_token_size: Int # Maximum size of a token; modified by tests. var token: List[Byte] # Last token returned by split. var buf: List[Byte] # buffer used as argument to split. var start: Int # First non-processed byte in buf. var end: Int # End of data in buf. var empties: Int # Count of successive empty tokens. var scan_called: Bool # Scan has been called; buffer is in use. var done: Bool # Scan has finished. var err: Error fn __init__( inout self, owned reader: R, split: SplitFunction = scan_lines, max_token_size: Int = MAX_SCAN_TOKEN_SIZE, token: List[Byte] = List[Byte](capacity=io.BUFFER_SIZE), buf: List[Byte] = List[Byte](capacity=io.BUFFER_SIZE), start: Int = 0, end: Int = 0, empties: Int = 0, scan_called: Bool = False, done: Bool = False, ): self.reader = reader^ self.split = split self.max_token_size = max_token_size self.token = token self.buf = buf self.start = start self.end = end self.empties = empties self.scan_called = scan_called self.done = done self.err = Error() fn current_token_as_bytes(self) -> List[Byte]: """Returns the most recent token generated by a call to [Scanner.Scan]. The underlying array may point to data that will be overwritten by a subsequent call to Scan. It does no allocation. """ return self.token fn current_token(self) -> String: """Returns the most recent token generated by a call to [Scanner.Scan] as a newly allocated string holding its bytes.""" return String(self.token) fn scan(inout self) raises -> Bool: """Advances the [Scanner] to the next token, which will then be available through the [Scanner.current_token_as_bytes] or [Scanner.current_token] method. It returns False when there are no more tokens, either by reaching the end of the input or an error. After Scan returns False, the [Scanner.Err] method will return any error that occurred during scanning, except if it was [io.EOF], [Scanner.Err]. Scan raises an Error if the split function returns too many empty tokens without advancing the input. This is a common error mode for scanners. """ if self.done: return False self.scan_called = True # Loop until we have a token. while True: # See if we can get a token with what we already have. # If we've run out of data but have an error, give the split function # a chance to recover any remaining, possibly empty token. if (self.end > self.start) or self.err: var advance: Int var token = List[Byte](capacity=io.BUFFER_SIZE) var err = Error() var at_eof = False if self.err: at_eof = True advance, token, err = self.split(self.buf[self.start : self.end], at_eof) if err: if str(err) == str(ERR_FINAL_TOKEN): self.token = token self.done = True # When token is not nil, it means the scanning stops # with a trailing token, and thus the return value # should be True to indicate the existence of the token. return len(token) != 0 self.set_err(err) return False if not self.advance(advance): return False self.token = token if len(token) != 0: if not self.err or advance > 0: self.empties = 0 else: # Returning tokens not advancing input at EOF. self.empties += 1 if self.empties > MAX_CONSECUTIVE_EMPTY_READS: panic("bufio.Scan: too many empty tokens without progressing") return True # We cannot generate a token with what we are holding. # If we've already hit EOF or an I/O error, we are done. if self.err: # Shut it down. self.start = 0 self.end = 0 return False # Must read more data. # First, shift data to beginning of buffer if there's lots of empty space # or space is needed. if self.start > 0 and (self.end == len(self.buf) or self.start > int(len(self.buf) / 2)): _ = copy(self.buf, self.buf[self.start : self.end]) self.end -= self.start self.start = 0 # Is the buffer full? If so, resize. if self.end == len(self.buf): # Guarantee no overflow in the multiplication below. if len(self.buf) >= self.max_token_size or len(self.buf) > int(MAX_INT / 2): self.set_err(Error(str(ERR_TOO_LONG))) return False var new_size = len(self.buf) * 2 if new_size == 0: new_size = START_BUF_SIZE # Make a new List[Byte] buffer and copy the elements in new_size = min(new_size, self.max_token_size) var new_buf = List[Byte](capacity=new_size) _ = copy(new_buf, self.buf[self.start : self.end]) self.buf = new_buf self.end -= self.start self.start = 0 # Finally we can read some input. Make sure we don't get stuck with # a misbehaving Reader. Officially we don't need to do this, but let's # be extra careful: Scanner is for safe, simple jobs. var loop = 0 while True: var bytes_read: Int var sl = self.buf[self.end : len(self.buf)] var err: Error # Catch any reader errors and set the internal error field to that err instead of bubbling it up. bytes_read, err = self.reader.read(sl) _ = copy(self.buf, sl, self.end) if bytes_read < 0 or len(self.buf) - self.end < bytes_read: self.set_err(Error(str(ERR_BAD_READ_COUNT))) break self.end += bytes_read if err: self.set_err(err) break if bytes_read > 0: self.empties = 0 break loop += 1 if loop > MAX_CONSECUTIVE_EMPTY_READS: self.set_err(Error(io.ERR_NO_PROGRESS)) break fn set_err(inout self, err: Error): """Set the internal error field to the provided error. Args: err: The error to set. """ if self.err: var value = str(self.err) if value == "" or value == io.EOF: self.err = err else: self.err = err fn advance(inout self, n: Int) -> Bool: """Consumes n bytes of the buffer. It reports whether the advance was legal. Args: n: The number of bytes to advance the buffer by. Returns: True if the advance was legal, False otherwise. """ if n < 0: self.set_err(Error(str(ERR_NEGATIVE_ADVANCE))) return False if n > self.end - self.start: self.set_err(Error(str(ERR_ADVANCE_TOO_FAR))) return False self.start += n return True fn buffer(inout self, buf: List[Byte], max: Int) raises: """Sets the initial buffer to use when scanning and the maximum size of buffer that may be allocated during scanning. The maximum token size must be less than the larger of max and cap(buf). If max <= cap(buf), [Scanner.Scan] will use this buffer only and do no allocation. By default, [Scanner.Scan] uses an Internal buffer and sets the maximum token size to [MAX_SCAN_TOKEN_SIZE]. buffer raises an Error if it is called after scanning has started. Args: buf: The buffer to use when scanning. max: The maximum size of buffer that may be allocated during scanning. Raises: Error: If called after scanning has started. """ if self.scan_called: raise Error("buffer called after Scan") # self.buf = buf[0:buf.capacity()] self.max_token_size = max # # split sets the split function for the [Scanner]. # # The default split function is [scan_lines]. # # # # split panics if it is called after scanning has started. # fn split(inout self, split_function: SplitFunction) raises: # if self.scan_called: # raise Error("split called after Scan") # self.split = split_function # SplitFunction is the signature of the split function used to tokenize the # input. The arguments are an initial substring of the remaining unprocessed # data and a flag, at_eof, that reports whether the [Reader] has no more data # to give. The return values are the number of bytes to advance the input # and the next token to return to the user, if any, plus an error, if any. # # Scanning stops if the function returns an error, in which case some of # the input may be discarded. If that error is [ERR_FINAL_TOKEN], scanning # stops with no error. A non-nil token delivered with [ERR_FINAL_TOKEN] # will be the last token, and a nil token with [ERR_FINAL_TOKEN] # immediately stops the scanning. # # Otherwise, the [Scanner] advances the input. If the token is not nil, # the [Scanner] returns it to the user. If the token is nil, the # Scanner reads more data and continues scanning; if there is no more # data--if at_eof was True--the [Scanner] returns. If the data does not # yet hold a complete token, for instance if it has no newline while # scanning lines, a [SplitFunction] can return (0, nil, nil) to signal the # [Scanner] to read more data Into the slice and try again with a # longer slice starting at the same poInt in the input. # # The function is never called with an empty data slice unless at_eof # is True. If at_eof is True, however, data may be non-empty and, # as always, holds unprocessed text. alias SplitFunction = fn (data: List[Byte], at_eof: Bool) -> ( Int, List[Byte], Error, ) # # Errors returned by Scanner. alias ERR_TOO_LONG = Error("bufio.Scanner: token too long") alias ERR_NEGATIVE_ADVANCE = Error("bufio.Scanner: SplitFunction returns negative advance count") alias ERR_ADVANCE_TOO_FAR = Error("bufio.Scanner: SplitFunction returns advance count beyond input") alias ERR_BAD_READ_COUNT = Error("bufio.Scanner: Read returned impossible count") # ERR_FINAL_TOKEN is a special sentinel error value. It is Intended to be # returned by a split function to indicate that the scanning should stop # with no error. If the token being delivered with this error is not nil, # the token is the last token. # # The value is useful to stop processing early or when it is necessary to # deliver a final empty token (which is different from a nil token). # One could achieve the same behavior with a custom error value but # providing one here is tidier. # See the emptyFinalToken example for a use of this value. alias ERR_FINAL_TOKEN = Error("final token") # MAX_SCAN_TOKEN_SIZE is the maximum size used to buffer a token # unless the user provides an explicit buffer with [Scanner.buffer]. # The actual maximum token size may be smaller as the buffer # may need to include, for instance, a newline. alias MAX_SCAN_TOKEN_SIZE = 64 * 1024 alias START_BUF_SIZE = 4096 # Size of initial allocation for buffer. fn new_scanner[R: io.Reader](owned reader: R) -> Scanner[R]: """Returns a new [Scanner] to read from r. The split function defaults to [scan_lines].""" return Scanner(reader^) ###### split functions ###### fn scan_bytes(data: List[Byte], at_eof: Bool) -> (Int, List[Byte], Error): """Split function for a [Scanner] that returns each byte as a token.""" if at_eof and data.capacity == 0: return 0, List[Byte](), Error() return 1, data[0:1], Error() # var errorRune = List[Byte](string(utf8.RuneError)) # # ScanRunes is a split function for a [Scanner] that returns each # # UTF-8-encoded rune as a token. The sequence of runes returned is # # equivalent to that from a range loop over the input as a string, which # # means that erroneous UTF-8 encodings translate to U+FFFD = "\xef\xbf\xbd". # # Because of the Scan Interface, this makes it impossible for the client to # # distinguish correctly encoded replacement runes from encoding errors. # fn ScanRunes(data List[Byte], at_eof Bool) (advance Int, token List[Byte], err error): # if at_eof and data.capacity == 0: # return 0, nil, nil # # Fast path 1: ASCII. # if data[0] < utf8.RuneSelf: # return 1, data[0:1], nil # # Fast path 2: Correct UTF-8 decode without error. # _, width := utf8.DecodeRune(data) # if width > 1: # # It's a valid encoding. Width cannot be one for a correctly encoded # # non-ASCII rune. # return width, data[0:width], nil # # We know it's an error: we have width==1 and implicitly r==utf8.RuneError. # # Is the error because there wasn't a full rune to be decoded? # # FullRune distinguishes correctly between erroneous and incomplete encodings. # if !at_eof and !utf8.FullRune(data): # # Incomplete; get more bytes. # return 0, nil, nil # # We have a real UTF-8 encoding error. Return a properly encoded error rune # # but advance only one byte. This matches the behavior of a range loop over # # an incorrectly encoded string. # return 1, errorRune, nil fn drop_carriage_return(data: List[Byte]) -> List[Byte]: """Drops a terminal \r from the data. Args: data: The data to strip. Returns: The stripped data. """ # In the case of a \r ending without a \n, indexing on -1 doesn't work as it finds a null terminator instead of \r. if data.capacity > 0 and data[data.capacity - 1] == ord("\r"): return data[0 : data.capacity - 1] return data # TODO: Doing modification of token and err in these split functions, so we don't have to return any memory only types as part of the return tuple. fn scan_lines(data: List[Byte], at_eof: Bool) -> (Int, List[Byte], Error): """Split function for a [Scanner] that returns each line of text, stripped of any trailing end-of-line marker. The returned line may be empty. The end-of-line marker is one optional carriage return followed by one mandatory newline. The last non-empty line of input will be returned even if it has no newline. Args: data: The data to split. at_eof: Whether the data is at the end of the file. Returns: The number of bytes to advance the input. """ if at_eof and data.capacity == 0: return 0, List[Byte](), Error() var i = index_byte(data, ord("\n")) if i >= 0: # We have a full newline-terminated line. return i + 1, drop_carriage_return(data[0:i]), Error() # If we're at EOF, we have a final, non-terminated line. Return it. # if at_eof: return data.capacity, drop_carriage_return(data), Error() # Request more data. # return 0 fn is_space(r: UInt8) -> Bool: alias ALL_WHITESPACES: String = " \t\n\r\x0b\f" if chr(int(r)) in ALL_WHITESPACES: return True return False # TODO: Handle runes and utf8 decoding. For now, just assuming single byte length. fn scan_words(data: List[Byte], at_eof: Bool) -> (Int, List[Byte], Error): """Split function for a [Scanner] that returns each space-separated word of text, with surrounding spaces deleted. It will never return an empty string. The definition of space is set by unicode.IsSpace. """ # Skip leading spaces. var start = 0 var width = 0 while start < data.capacity: width = len(data[0]) if not is_space(data[0]): break start += width # Scan until space, marking end of word. var i = 0 width = 0 start = 0 while i < data.capacity: width = len(data[i]) if is_space(data[i]): return i + width, data[start:i], Error() i += width # If we're at EOF, we have a final, non-empty, non-terminated word. Return it. if at_eof and data.capacity > start: return data.capacity, data[start:], Error() # Request more data. return start, List[Byte](), Error() --- external/gojo/builtins/__init__.mojo --- from .bytes import Byte, index_byte, has_suffix, has_prefix, to_string from .attributes import cap, copy from .errors import exit, panic alias Rune = Int32 --- external/gojo/builtins/attributes.mojo --- fn copy[T: CollectionElement](inout target: List[T], source: List[T], start: Int = 0) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: target: The buffer to copy into. source: The buffer to copy from. start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(len(source)): if i + start > len(target): target[i + start] = source[i] else: target.append(source[i]) count += 1 return count fn copy( inout target: List[UInt8], source: DTypePointer[DType.uint8], source_start: Int, source_end: Int, target_start: Int = 0, ) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: target: The buffer to copy into. source: The buffer to copy from. source_start: The index to start copying from. source_end: The index to stop copying at. target_start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(source_start, source_end): if i + target_start > len(target): target[i + target_start] = source[i] else: target.append(source[i]) count += 1 return count # fn copy[T: CollectionElement](inout target: Span[T], source: Span[T], start: Int = 0) -> Int: # """Copies the contents of source into target at the same index. Returns the number of bytes copied. # Added a start parameter to specify the index to start copying into. # Args: # target: The buffer to copy into. # source: The buffer to copy from. # start: The index to start copying into. # Returns: # The number of bytes copied. # """ # var count = 0 # for i in range(len(source)): # target[i + start] = source[i] # count += 1 # return count fn cap[T: CollectionElement](iterable: List[T]) -> Int: """Returns the capacity of the List. Args: iterable: The List to get the capacity of. """ return iterable.capacity --- external/gojo/builtins/bytes.mojo --- alias Byte = UInt8 fn equals(left: List[UInt8], right: List[UInt8]) -> Bool: if len(left) != len(right): return False for i in range(len(left)): if left[i] != right[i]: return False return True fn has_prefix(bytes: List[Byte], prefix: List[Byte]) -> Bool: """Reports whether the List[Byte] struct begins with prefix. Args: bytes: The List[Byte] struct to search. prefix: The prefix to search for. Returns: True if the List[Byte] struct begins with prefix; otherwise, False. """ var len_comparison = len(bytes) >= len(prefix) var prefix_comparison = equals(bytes[0 : len(prefix)], prefix) return len_comparison and prefix_comparison fn has_suffix(bytes: List[Byte], suffix: List[Byte]) -> Bool: """Reports whether the List[Byte] struct ends with suffix. Args: bytes: The List[Byte] struct to search. suffix: The prefix to search for. Returns: True if the List[Byte] struct ends with suffix; otherwise, False. """ var len_comparison = len(bytes) >= len(suffix) var suffix_comparison = equals(bytes[len(bytes) - len(suffix) : len(bytes)], suffix) return len_comparison and suffix_comparison fn index_byte(bytes: List[Byte], delim: Byte) -> Int: """Return the index of the first occurrence of the byte delim. Args: bytes: The List[Byte] struct to search. delim: The byte to search for. Returns: The index of the first occurrence of the byte delim. """ for i in range(len(bytes)): if bytes[i] == delim: return i return -1 fn index_byte(bytes: DTypePointer[DType.uint8], size: Int, delim: Byte) -> Int: """Return the index of the first occurrence of the byte delim. Args: bytes: The DTypePointer[DType.int8] struct to search. size: The size of the bytes pointer. delim: The byte to search for. Returns: The index of the first occurrence of the byte delim. """ for i in range(size): if UInt8(bytes[i]) == delim: return i return -1 fn to_string(bytes: List[Byte]) -> String: """Makes a deepcopy of the List[Byte] supplied and converts it to a string. If it's not null terminated, it will append a null byte. Args: bytes: The List[Byte] struct to convert. Returns: The string representation of the List[Byte] struct. """ var copy = List[Byte](bytes) if copy[-1] != 0: copy.append(0) return String(copy) --- external/gojo/builtins/errors.mojo --- from sys import exit fn panic[T: Stringable](message: T, code: Int = 1): """Panics the program with the given message and exit code. Args: message: The message to panic with. code: The exit code to panic with. """ print("panic:", message) exit(code) --- external/gojo/fmt/__init__.mojo --- from .fmt import sprintf, printf, sprintf_str --- external/gojo/fmt/fmt.mojo --- """Formatting options General %v the value in a default format when printing structs, the plus flag (%+v) adds field names Boolean %t the word true or false Integer %d base 10 %q a single-quoted character literal. %x base 16, with lower-case letters for a-f %X base 16, with upper-case letters for A-F Floating-point and complex constituents: %f decimal point but no exponent, e.g. 123.456 String and slice of bytes (treated equivalently with these verbs): %s the uninterpreted bytes of the string or slice %q a double-quoted string TODO: - Add support for more formatting options - Switch to buffered writing to avoid multiple string concatenations - Add support for width and precision formatting options - Handle escaping for String's %q """ from utils.variant import Variant from math import floor from ..builtins import Byte alias Args = Variant[String, Int, Float64, Bool, List[Byte]] fn replace_first(s: String, old: String, new: String) -> String: """Replace the first occurrence of a substring in a string. Args: s: The original string. old: The substring to be replaced. new: The new substring. Returns: The string with the first occurrence of the old substring replaced by the new one. """ # Find the first occurrence of the old substring var index = s.find(old) # If the old substring is found, replace it if index != -1: return s[:index] + new + s[index + len(old) :] # If the old substring is not found, return the original string return s fn find_first_verb(s: String, verbs: List[String]) -> String: """Find the first occurrence of a verb in a string. Args: s: The original string. verbs: The list of verbs to search for. Returns: The verb to replace. """ var index = -1 var verb: String = "" for v in verbs: var i = s.find(v[]) if i != -1 and (index == -1 or i < index): index = i verb = v[] return verb alias BASE10_TO_BASE16 = List[String]( "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", ) fn convert_base10_to_base16(value: Int) -> String: """Converts a base 10 number to base 16. Args: value: Base 10 number. Returns: Base 16 number as a String. """ var val: Float64 = 0.0 var result: Float64 = value var base16: String = "" while result > 1: var temp = result / 16 var floor_result = floor(temp) var remainder = temp - floor_result result = floor_result val = 16 * remainder base16 = BASE10_TO_BASE16[int(val)] + base16 return base16 fn format_string(format: String, arg: String) -> String: var verb = find_first_verb(format, List[String]("%s", "%q")) var arg_to_place = arg if verb == "%q": arg_to_place = '"' + arg + '"' return replace_first(format, String("%s"), arg) fn format_bytes(format: String, arg: List[Byte]) -> String: var argument = arg if argument[-1] != 0: argument.append(0) return format_string(format, argument) fn format_integer(format: String, arg: Int) -> String: var verb = find_first_verb(format, List[String]("%x", "%X", "%d", "%q")) var arg_to_place = str(arg) if verb == "%x": arg_to_place = str(convert_base10_to_base16(arg)).lower() elif verb == "%X": arg_to_place = str(convert_base10_to_base16(arg)).upper() elif verb == "%q": arg_to_place = "'" + str(arg) + "'" return replace_first(format, verb, arg_to_place) fn format_float(format: String, arg: Float64) -> String: return replace_first(format, str("%f"), str(arg)) fn format_boolean(format: String, arg: Bool) -> String: var value: String = "False" if arg: value = "True" return replace_first(format, String("%t"), value) # If the number of arguments does not match the number of format specifiers alias BadArgCount = "(BAD ARG COUNT)" fn sprintf(formatting: String, *args: Args) -> String: var text = formatting var raw_percent_count = formatting.count("%%") * 2 var formatter_count = formatting.count("%") - raw_percent_count if formatter_count != len(args): return BadArgCount for i in range(len(args)): var argument = args[i] if argument.isa[String](): text = format_string(text, argument[String]) elif argument.isa[List[Byte]](): text = format_bytes(text, argument[List[Byte]]) elif argument.isa[Int](): text = format_integer(text, argument[Int]) elif argument.isa[Float64](): text = format_float(text, argument[Float64]) elif argument.isa[Bool](): text = format_boolean(text, argument[Bool]) return text # TODO: temporary until we have arg packing. fn sprintf_str(formatting: String, args: List[String]) raises -> String: var text = formatting var formatter_count = formatting.count("%") if formatter_count > len(args): raise Error("Not enough arguments for format string") elif formatter_count < len(args): raise Error("Too many arguments for format string") for i in range(len(args)): text = format_string(text, args[i]) return text fn printf(formatting: String, *args: Args) raises: var text = formatting var raw_percent_count = formatting.count("%%") * 2 var formatter_count = formatting.count("%") - raw_percent_count if formatter_count > len(args): raise Error("Not enough arguments for format string") elif formatter_count < len(args): raise Error("Too many arguments for format string") for i in range(len(args)): var argument = args[i] if argument.isa[String](): text = format_string(text, argument[String]) elif argument.isa[List[Byte]](): text = format_bytes(text, argument[List[Byte]]) elif argument.isa[Int](): text = format_integer(text, argument[Int]) elif argument.isa[Float64](): text = format_float(text, argument[Float64]) elif argument.isa[Bool](): text = format_boolean(text, argument[Bool]) else: raise Error("Unknown for argument #" + str(i)) print(text) --- external/gojo/io/__init__.mojo --- from .traits import ( Reader, Writer, Seeker, Closer, ReadWriter, ReadCloser, WriteCloser, ReadWriteCloser, ReadSeeker, ReadSeekCloser, WriteSeeker, ReadWriteSeeker, ReaderFrom, WriterReadFrom, WriterTo, ReaderWriteTo, ReaderAt, WriterAt, ByteReader, ByteScanner, ByteWriter, RuneReader, RuneScanner, StringWriter, SEEK_START, SEEK_CURRENT, SEEK_END, ERR_SHORT_WRITE, ERR_NO_PROGRESS, ERR_SHORT_BUFFER, EOF, ) from .io import write_string, read_at_least, read_full, read_all, BUFFER_SIZE alias i1 = __mlir_type.i1 alias i1_1 = __mlir_attr.`1: i1` alias i1_0 = __mlir_attr.`0: i1` --- external/gojo/io/io.mojo --- from collections.optional import Optional from ..builtins import cap, copy, Byte, panic from .traits import ERR_UNEXPECTED_EOF alias BUFFER_SIZE = 4096 fn write_string[W: Writer](inout writer: W, string: String) -> (Int, Error): """Writes the contents of the string s to w, which accepts a slice of bytes. If w implements [StringWriter], [StringWriter.write_string] is invoked directly. Otherwise, [Writer.write] is called exactly once. Args: writer: The writer to write to. string: The string to write. Returns: The number of bytes written and an error, if any. """ return writer.write(string.as_bytes()) fn write_string[W: StringWriter](inout writer: W, string: String) -> (Int, Error): """Writes the contents of the string s to w, which accepts a slice of bytes. If w implements [StringWriter], [StringWriter.write_string] is invoked directly. Otherwise, [Writer.write] is called exactly once. Args: writer: The writer to write to. string: The string to write. Returns: The number of bytes written and an error, if any.""" return writer.write_string(string) fn read_at_least[R: Reader](inout reader: R, inout dest: List[Byte], min: Int) -> (Int, Error): """Reads from r into buf until it has read at least min bytes. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading fewer than min bytes, read_at_least returns [ERR_UNEXPECTED_EOF]. If min is greater than the length of buf, read_at_least returns [ERR_SHORT_BUFFER]. On return, n >= min if and only if err == nil. If r returns an error having read at least min bytes, the error is dropped. Args: reader: The reader to read from. dest: The buffer to read into. min: The minimum number of bytes to read. Returns: The number of bytes read.""" var error = Error() if len(dest) < min: return 0, Error(io.ERR_SHORT_BUFFER) var total_bytes_read: Int = 0 while total_bytes_read < min and not error: var bytes_read: Int bytes_read, error = reader.read(dest) total_bytes_read += bytes_read if total_bytes_read >= min: error = Error() elif total_bytes_read > 0 and str(error): error = Error(ERR_UNEXPECTED_EOF) return total_bytes_read, error fn read_full[R: Reader](inout reader: R, inout dest: List[Byte]) -> (Int, Error): """Reads exactly len(buf) bytes from r into buf. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading some but not all the bytes, read_full returns [ERR_UNEXPECTED_EOF]. On return, n == len(buf) if and only if err == nil. If r returns an error having read at least len(buf) bytes, the error is dropped. """ return read_at_least(reader, dest, len(dest)) # fn copy_n[W: Writer, R: Reader](dst: W, src: R, n: Int64) raises -> Int64: # """Copies n bytes (or until an error) from src to dst. # It returns the number of bytes copied and the earliest # error encountered while copying. # On return, written == n if and only if err == nil. # If dst implements [ReaderFrom], the copy is implemented using it. # """ # var written = copy(dst, LimitReader(src, n)) # if written == n: # return n # if written < n: # # src stopped early; must have been EOF. # raise Error(ERR_UNEXPECTED_EOF) # return written # fn copy[W: Writer, R: Reader](dst: W, src: R, n: Int64) -> Int64: # """copy copies from src to dst until either EOF is reached # on src or an error occurs. It returns the number of bytes # copied and the first error encountered while copying, if any. # A successful copy returns err == nil, not err == EOF. # Because copy is defined to read from src until EOF, it does # not treat an EOF from Read as an error to be reported. # If src implements [WriterTo], # the copy is implemented by calling src.WriteTo(dst). # Otherwise, if dst implements [ReaderFrom], # the copy is implemented by calling dst.ReadFrom(src). # """ # return copy_buffer(dst, src, nil) # # CopyBuffer is identical to copy except that it stages through the # # provided buffer (if one is required) rather than allocating a # # temporary one. If buf is nil, one is allocated; otherwise if it has # # zero length, CopyBuffer panics. # # # # If either src implements [WriterTo] or dst implements [ReaderFrom], # # buf will not be used to perform the copy. # fn CopyBuffer(dst Writer, src Reader, buf bytes) (written int64, err error) { # if buf != nil and len(buf) == 0 { # panic("empty buffer in CopyBuffer") # } # return copy_buffer(dst, src, buf) # } # fn copy_buffer[W: Writer, R: Reader](dst: W, src: R, buf: Span[Byte]) raises -> Int64: # """Actual implementation of copy and CopyBuffer. # if buf is nil, one is allocated. # """ # var nr: Int # nr = src.read(buf) # while True: # if nr > 0: # var nw: Int # nw = dst.write(get_slice(buf, 0, nr)) # if nw < 0 or nr < nw: # nw = 0 # var written = Int64(nw) # if nr != nw: # raise Error(ERR_SHORT_WRITE) # return written # fn copy_buffer[W: Writer, R: ReaderWriteTo](dst: W, src: R, buf: Span[Byte]) -> Int64: # return src.write_to(dst) # fn copy_buffer[W: WriterReadFrom, R: Reader](dst: W, src: R, buf: Span[Byte]) -> Int64: # return dst.read_from(src) # # LimitReader returns a Reader that reads from r # # but stops with EOF after n bytes. # # The underlying implementation is a *LimitedReader. # fn LimitReader(r Reader, n int64) Reader { return &LimitedReader{r, n} } # # A LimitedReader reads from R but limits the amount of # # data returned to just N bytes. Each call to Read # # updates N to reflect the new amount remaining. # # Read returns EOF when N <= 0 or when the underlying R returns EOF. # struct LimitedReader(): # var R: Reader # underlying reader # N int64 # max bytes remaining # fn (l *LimitedReader) Read(p bytes) (n Int, err error) { # if l.N <= 0 { # return 0, EOF # } # if int64(len(p)) > l.N { # p = p[0:l.N] # } # n, err = l.R.Read(p) # l.N -= int64(n) # return # } # # NewSectionReader returns a [SectionReader] that reads from r # # starting at offset off and stops with EOF after n bytes. # fn NewSectionReader(r ReaderAt, off int64, n int64) *SectionReader { # var remaining int64 # const maxint64 = 1<<63 - 1 # if off <= maxint64-n { # remaining = n + off # } else { # # Overflow, with no way to return error. # # Assume we can read up to an offset of 1<<63 - 1. # remaining = maxint64 # } # return &SectionReader{r, off, off, remaining, n} # } # # SectionReader implements Read, Seek, and ReadAt on a section # # of an underlying [ReaderAt]. # type SectionReader struct { # r ReaderAt # constant after creation # base int64 # constant after creation # off int64 # limit int64 # constant after creation # n int64 # constant after creation # } # fn (s *SectionReader) Read(p bytes) (n Int, err error) { # if s.off >= s.limit { # return 0, EOF # } # if max := s.limit - s.off; int64(len(p)) > max { # p = p[0:max] # } # n, err = s.r.ReadAt(p, s.off) # s.off += int64(n) # return # } # alias errWhence = "Seek: invalid whence" # alias errOffset = "Seek: invalid offset" # fn (s *SectionReader) Seek(offset int64, whence Int) (int64, error) { # switch whence { # default: # return 0, errWhence # case SEEK_START: # offset += s.base # case SEEK_CURRENT: # offset += s.off # case SEEK_END: # offset += s.limit # } # if offset < s.base { # return 0, errOffset # } # s.off = offset # return offset - s.base, nil # } # fn (s *SectionReader) ReadAt(p bytes, off int64) (n Int, err error) { # if off < 0 or off >= s.capacity { # return 0, EOF # } # off += s.base # if max := s.limit - off; int64(len(p)) > max { # p = p[0:max] # n, err = s.r.ReadAt(p, off) # if err == nil { # err = EOF # } # return n, err # } # return s.r.ReadAt(p, off) # } # # Size returns the size of the section in bytes. # fn (s *SectionReader) Size() int64 { return s.limit - s.base } # # Outer returns the underlying [ReaderAt] and offsets for the section. # # # # The returned values are the same that were passed to [NewSectionReader] # # when the [SectionReader] was created. # fn (s *SectionReader) Outer() (r ReaderAt, off int64, n int64) { # return s.r, s.base, s.n # } # # An OffsetWriter maps writes at offset base to offset base+off in the underlying writer. # type OffsetWriter struct { # w WriterAt # base int64 # the original offset # off int64 # the current offset # } # # NewOffsetWriter returns an [OffsetWriter] that writes to w # # starting at offset off. # fn NewOffsetWriter(w WriterAt, off int64) *OffsetWriter { # return &OffsetWriter{w, off, off} # } # fn (o *OffsetWriter) Write(p bytes) (n Int, err error) { # n, err = o.w.WriteAt(p, o.off) # o.off += int64(n) # return # } # fn (o *OffsetWriter) WriteAt(p bytes, off int64) (n Int, err error) { # if off < 0 { # return 0, errOffset # } # off += o.base # return o.w.WriteAt(p, off) # } # fn (o *OffsetWriter) Seek(offset int64, whence Int) (int64, error) { # switch whence { # default: # return 0, errWhence # case SEEK_START: # offset += o.base # case SEEK_CURRENT: # offset += o.off # } # if offset < o.base { # return 0, errOffset # } # o.off = offset # return offset - o.base, nil # } # # TeeReader returns a [Reader] that writes to w what it reads from r. # # All reads from r performed through it are matched with # # corresponding writes to w. There is no internal buffering - # # the write must complete before the read completes. # # Any error encountered while writing is reported as a read error. # fn TeeReader(r Reader, w Writer) Reader { # return &teeReader{r, w} # } # type teeReader struct { # r Reader # w Writer # } # fn (t *teeReader) Read(p bytes) (n Int, err error) { # n, err = t.r.Read(p) # if n > 0 { # if n, err := t.w.Write(p[:n]); err != nil { # return n, err # } # } # return # } # # Discard is a [Writer] on which all Write calls succeed # # without doing anything. # var Discard Writer = discard{} # type discard struct{} # # discard implements ReaderFrom as an optimization so copy to # # io.Discard can avoid doing unnecessary work. # var _ ReaderFrom = discard{} # fn (discard) Write(p bytes) (Int, error) { # return len(p), nil # } # fn (discard) write_string(s string) (Int, error) { # return len(s), nil # } # var blackHolePool = sync.Pool{ # New: fn() any { # b := make(bytes, 8192) # return &b # }, # } # fn (discard) ReadFrom(r Reader) (n int64, err error) { # bufp := blackHolePool.Get().(*bytes) # readSize := 0 # for { # readSize, err = r.Read(*bufp) # n += int64(readSize) # if err != nil { # blackHolePool.Put(bufp) # if err == EOF { # return n, nil # } # return # } # } # } # # NopCloser returns a [ReadCloser] with a no-op Close method wrapping # # the provided [Reader] r. # # If r implements [WriterTo], the returned [ReadCloser] will implement [WriterTo] # # by forwarding calls to r. # fn NopCloser(r Reader) ReadCloser { # if _, ok := r.(WriterTo); ok { # return nopCloserWriterTo{r} # } # return nopCloser{r} # } # type nopCloser struct { # Reader # } # fn (nopCloser) Close() error { return nil } # type nopCloserWriterTo struct { # Reader # } # fn (nopCloserWriterTo) Close() error { return nil } # fn (c nopCloserWriterTo) WriteTo(w Writer) (n int64, err error) { # return c.Reader.(WriterTo).WriteTo(w) # } fn read_all[R: Reader](inout reader: R) -> (List[Byte], Error): """Reads from r until an error or EOF and returns the data it read. A successful call returns err == nil, not err == EOF. Because ReadAll is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported. Args: reader: The reader to read from. Returns: The data read.""" var dest = List[Byte](capacity=BUFFER_SIZE) var at_eof: Bool = False while True: var temp = List[Byte](capacity=BUFFER_SIZE) var bytes_read: Int var err: Error bytes_read, err = reader.read(temp) var err_message = str(err) if err_message != "": if err_message != EOF: return dest, err at_eof = True # If new bytes will overflow the result, resize it. # if some bytes were written, how do I append before returning result on the last one? if len(dest) + len(temp) > dest.capacity: dest.reserve(dest.capacity * 2) dest.extend(temp) if at_eof: return dest, err --- external/gojo/io/traits.mojo --- from collections.optional import Optional from ..builtins import Byte alias Rune = Int32 # Package io provides basic interfaces to I/O primitives. # Its primary job is to wrap existing implementations of such primitives, # such as those in package os, into shared public interfaces that # abstract the fntionality, plus some other related primitives. # # Because these interfaces and primitives wrap lower-level operations with # various implementations, unless otherwise informed clients should not # assume they are safe for parallel execution. # Seek whence values. alias SEEK_START = 0 # seek relative to the origin of the file alias SEEK_CURRENT = 1 # seek relative to the current offset alias SEEK_END = 2 # seek relative to the end # ERR_SHORT_WRITE means that a write accepted fewer bytes than requested # but failed to return an explicit error. alias ERR_SHORT_WRITE = "short write" # ERR_INVALID_WRITE means that a write returned an impossible count. alias ERR_INVALID_WRITE = "invalid write result" # ERR_SHORT_BUFFER means that a read required a longer buffer than was provided. alias ERR_SHORT_BUFFER = "short buffer" # EOF is the error returned by Read when no more input is available. # (Read must return EOF itself, not an error wrapping EOF, # because callers will test for EOF using ==.) # fntions should return EOF only to signal a graceful end of input. # If the EOF occurs unexpectedly in a structured data stream, # the appropriate error is either [ERR_UNEXPECTED_EOF] or some other error # giving more detail. alias EOF = "EOF" # ERR_UNEXPECTED_EOF means that EOF was encountered in the # middle of reading a fixed-size block or data structure. alias ERR_UNEXPECTED_EOF = "unexpected EOF" # ERR_NO_PROGRESS is returned by some clients of a [Reader] when # many calls to Read have failed to return any data or error, # usually the sign of a broken [Reader] implementation. alias ERR_NO_PROGRESS = "multiple Read calls return no data or error" trait Reader(Movable): """Reader is the trait that wraps the basic Read method. Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting for more. When Read encounters an error or end-of-file condition after successfully reading n > 0 bytes, it returns the number of bytes read. It may return the (non-nil) error from the same call or return the error (and n == 0) from a subsequent call. An instance of this general case is that a Reader returning a non-zero number of bytes at the end of the input stream may return either err == EOF or err == nil. The next Read should return 0, EOF. Callers should always process the n > 0 bytes returned before considering the error err. Doing so correctly handles I/O errors that happen after reading some bytes and also both of the allowed EOF behaviors. If len(p) == 0, Read should always return n == 0. It may return a non-nil error if some error condition is known, such as EOF. Implementations of Read are discouraged from returning a zero byte count with a nil error, except when len(p) == 0. Callers should treat a return of 0 and nil as indicating that nothing happened; in particular it does not indicate EOF. Implementations must not retain p.""" fn read(inout self, inout dest: List[Byte]) -> (Int, Error): ... trait Writer(Movable): """Writer is the trait that wraps the basic Write method. Write writes len(p) bytes from p to the underlying data stream. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. Write must return a non-nil error if it returns n < len(p). Write must not modify the slice data, even temporarily. Implementations must not retain p. """ fn write(inout self, src: List[Byte]) -> (Int, Error): ... trait Closer(Movable): """ Closer is the trait that wraps the basic Close method. The behavior of Close after the first call is undefined. Specific implementations may document their own behavior. """ fn close(inout self) -> Error: ... trait Seeker(Movable): """ Seeker is the trait that wraps the basic Seek method. Seek sets the offset for the next Read or Write to offset, interpreted according to whence: [SEEK_START] means relative to the start of the file, [SEEK_CURRENT] means relative to the current offset, and [SEEK_END] means relative to the end (for example, offset = -2 specifies the penultimate byte of the file). Seek returns the new offset relative to the start of the file or an error, if any. Seeking to an offset before the start of the file is an error. Seeking to any positive offset may be allowed, but if the new offset exceeds the size of the underlying object the behavior of subsequent I/O operations is implementation-dependent. """ fn seek(inout self, offset: Int64, whence: Int) -> (Int64, Error): ... trait ReadWriter(Reader, Writer): ... trait ReadCloser(Reader, Closer): ... trait WriteCloser(Writer, Closer): ... trait ReadWriteCloser(Reader, Writer, Closer): ... trait ReadSeeker(Reader, Seeker): ... trait ReadSeekCloser(Reader, Seeker, Closer): ... trait WriteSeeker(Writer, Seeker): ... trait ReadWriteSeeker(Reader, Writer, Seeker): ... trait ReaderFrom: """ReaderFrom is the trait that wraps the ReadFrom method. ReadFrom reads data from r until EOF or error. The return value n is the number of bytes read. Any error except EOF encountered during the read is also returned. The [copy] function uses [ReaderFrom] if available.""" fn read_from[R: Reader](inout self, inout reader: R) -> (Int64, Error): ... trait WriterReadFrom(Writer, ReaderFrom): ... trait WriterTo: """WriterTo is the trait that wraps the WriteTo method. WriteTo writes data to w until there's no more data to write or when an error occurs. The return value n is the number of bytes written. Any error encountered during the write is also returned. The copy function uses WriterTo if available.""" fn write_to[W: Writer](inout self, inout writer: W) -> (Int64, Error): ... trait ReaderWriteTo(Reader, WriterTo): ... trait ReaderAt: """ReaderAt is the trait that wraps the basic ReadAt method. ReadAt reads len(p) bytes into p starting at offset off in the underlying input source. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. When ReadAt returns n < len(p), it returns a non-nil error explaining why more bytes were not returned. In this respect, ReadAt is stricter than Read. Even if ReadAt returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, ReadAt blocks until either all the data is available or an error occurs. In this respect ReadAt is different from Read. If the n = len(p) bytes returned by ReadAt are at the end of the input source, ReadAt may return either err == EOF or err == nil. If ReadAt is reading from an input source with a seek offset, ReadAt should not affect nor be affected by the underlying seek offset. Clients of ReadAt can execute parallel ReadAt calls on the same input source. Implementations must not retain p.""" fn read_at(self, inout dest: List[Byte], off: Int64) -> (Int, Error): ... trait WriterAt: """WriterAt is the trait that wraps the basic WriteAt method. WriteAt writes len(p) bytes from p to the underlying data stream at offset off. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. WriteAt must return a non-nil error if it returns n < len(p). If WriteAt is writing to a destination with a seek offset, WriteAt should not affect nor be affected by the underlying seek offset. Clients of WriteAt can execute parallel WriteAt calls on the same destination if the ranges do not overlap. Implementations must not retain p.""" fn write_at(self, src: Span[Byte], off: Int64) -> (Int, Error): ... trait ByteReader: """ByteReader is the trait that wraps the read_byte method. read_byte reads and returns the next byte from the input or any error encountered. If read_byte returns an error, no input byte was consumed, and the returned byte value is undefined. read_byte provides an efficient trait for byte-at-time processing. A [Reader] that does not implement ByteReader can be wrapped using bufio.NewReader to add this method.""" fn read_byte(inout self) -> (Byte, Error): ... trait ByteScanner(ByteReader): """ByteScanner is the trait that adds the unread_byte method to the basic read_byte method. unread_byte causes the next call to read_byte to return the last byte read. If the last operation was not a successful call to read_byte, unread_byte may return an error, unread the last byte read (or the byte prior to the last-unread byte), or (in implementations that support the [Seeker] trait) seek to one byte before the current offset.""" fn unread_byte(inout self) -> Error: ... trait ByteWriter: """ByteWriter is the trait that wraps the write_byte method.""" fn write_byte(inout self, byte: Byte) -> (Int, Error): ... trait RuneReader: """RuneReader is the trait that wraps the read_rune method. read_rune reads a single encoded Unicode character and returns the rune and its size in bytes. If no character is available, err will be set.""" fn read_rune(inout self) -> (Rune, Int): ... trait RuneScanner(RuneReader): """RuneScanner is the trait that adds the unread_rune method to the basic read_rune method. unread_rune causes the next call to read_rune to return the last rune read. If the last operation was not a successful call to read_rune, unread_rune may return an error, unread the last rune read (or the rune prior to the last-unread rune), or (in implementations that support the [Seeker] trait) seek to the start of the rune before the current offset.""" fn unread_rune(inout self) -> Rune: ... trait StringWriter: """StringWriter is the trait that wraps the WriteString method.""" fn write_string(inout self, src: String) -> (Int, Error): ... --- external/gojo/strings/__init__.mojo --- from .builder import StringBuilder from .reader import Reader, new_reader --- external/gojo/strings/builder.mojo --- import ..io from ..builtins import Byte struct StringBuilder[growth_factor: Float32 = 2]( Stringable, Sized, io.Writer, io.StringWriter, io.ByteWriter, ): """ A string builder class that allows for efficient string management and concatenation. This class is useful when you need to build a string by appending multiple strings together. The performance increase is not linear. Compared to string concatenation, I've observed around 20-30x faster for writing and rending ~4KB and up to 2100x-2300x for ~4MB. This is because it avoids the overhead of creating and destroying many intermediate strings and performs memcopy operations. The result is a more efficient when building larger string concatenations. It is generally not recommended to use this class for small concatenations such as a few strings like `a + b + c + d` because the overhead of creating the string builder and appending the strings is not worth the performance gain. Example: ``` from strings.builder import StringBuilder var sb = StringBuilder() sb.write_string("Hello ") sb.write_string("World!") print(sb) # Hello World! ``` """ var data: DTypePointer[DType.uint8] var size: Int var capacity: Int @always_inline fn __init__(inout self, *, capacity: Int = 4096): constrained[growth_factor >= 1.25]() self.data = DTypePointer[DType.uint8]().alloc(capacity) self.size = 0 self.capacity = capacity @always_inline fn __moveinit__(inout self, owned other: Self): self.data = other.data self.size = other.size self.capacity = other.capacity other.data = DTypePointer[DType.uint8]() other.size = 0 other.capacity = 0 @always_inline fn __del__(owned self): if self.data: self.data.free() @always_inline fn __len__(self) -> Int: """ Returns the length of the string builder. Returns: The length of the string builder. """ return self.size @always_inline fn __str__(self) -> String: """ Converts the string builder to a string. Returns: The string representation of the string builder. Returns an empty string if the string builder is empty. """ var copy = DTypePointer[DType.uint8]().alloc(self.size) memcpy(copy, self.data, self.size) return StringRef(copy, self.size) @always_inline fn render( self: Reference[Self], ) -> StringSlice[self.is_mutable, self.lifetime]: """ Return a StringSlice view of the data owned by the builder. Slightly faster than __str__, 10-20% faster in limited testing. Returns: The string representation of the string builder. Returns an empty string if the string builder is empty. """ return StringSlice[self.is_mutable, self.lifetime](unsafe_from_utf8_strref=StringRef(self[].data, self[].size)) @always_inline fn _resize(inout self, capacity: Int) -> None: """ Resizes the string builder buffer. Args: capacity: The new capacity of the string builder buffer. """ var new_data = DTypePointer[DType.uint8]().alloc(capacity) memcpy(new_data, self.data, self.size) self.data.free() self.data = new_data self.capacity = capacity return None @always_inline fn _write(inout self, src: Span[Byte]) -> (Int, Error): """ Appends a byte Span to the builder buffer. Args: src: The byte array to append. """ if len(src) > self.capacity - self.size: var new_capacity = int(self.capacity * growth_factor) if new_capacity < self.capacity + len(src): new_capacity = self.capacity + len(src) self._resize(new_capacity) memcpy(self.data.offset(self.size), src._data, len(src)) self.size += len(src) return len(src), Error() @always_inline fn write(inout self, src: List[Byte]) -> (Int, Error): """ Appends a byte Span to the builder buffer. Args: src: The byte array to append. """ var span = Span(src) return self._write(span) @always_inline fn write_string(inout self, src: String) -> (Int, Error): """ Appends a string to the builder buffer. Args: src: The string to append. """ return self._write(src.as_bytes_slice()) @always_inline fn write_byte(inout self, byte: UInt8) -> (Int, Error): var span = Span(List[UInt8](byte)) return self._write(span) --- external/gojo/strings/reader.mojo --- import ..io from ..builtins import Byte, copy, panic @value struct Reader( Sized, io.Reader, io.ReaderAt, io.ByteReader, io.ByteScanner, io.Seeker, io.WriterTo, ): """A Reader that implements the [io.Reader], [io.ReaderAt], [io.ByteReader], [io.ByteScanner], [io.Seeker], and [io.WriterTo] traits by reading from a string. The zero value for Reader operates like a Reader of an empty string. """ var string: String var read_pos: Int64 # current reading index var prev_rune: Int # index of previous rune; or < 0 fn __init__(inout self, string: String = ""): self.string = string self.read_pos = 0 self.prev_rune = -1 fn __len__(self) -> Int: """Returns the number of bytes of the unread portion of the string. Returns: int: the number of bytes of the unread portion of the string. """ if self.read_pos >= Int64(len(self.string)): return 0 return int(Int64(len(self.string)) - self.read_pos) fn size(self) -> Int64: """Returns the original length of the underlying string. size is the number of bytes available for reading via [Reader.read_at]. The returned value is always the same and is not affected by calls to any other method. Returns: The original length of the underlying string. """ return Int64(len(self.string)) fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Reads from the underlying string into the provided List[Byte] object. Implements the [io.Reader] trait. Args: dest: The destination List[Byte] object to read into. Returns: The number of bytes read into dest. """ if self.read_pos >= Int64(len(self.string)): return 0, Error(io.EOF) self.prev_rune = -1 var bytes_written = copy(dest, self.string[int(self.read_pos) :].as_bytes()) self.read_pos += Int64(bytes_written) return bytes_written, Error() fn read_at(self, inout dest: List[Byte], off: Int64) -> (Int, Error): """Reads from the Reader into the dest List[Byte] starting at the offset off. It returns the number of bytes read into dest and an error if any. Implements the [io.ReaderAt] trait. Args: dest: The destination List[Byte] object to read into. off: The byte offset to start reading from. Returns: The number of bytes read into dest. """ # cannot modify state - see io.ReaderAt if off < 0: return 0, Error("strings.Reader.read_at: negative offset") if off >= Int64(len(self.string)): return 0, Error(io.EOF) var error = Error() var copied_elements_count = copy(dest, self.string[int(off) :].as_bytes()) if copied_elements_count < len(dest): error = Error(io.EOF) return copied_elements_count, error fn read_byte(inout self) -> (Byte, Error): """Reads the next byte from the underlying string. Implements the [io.ByteReader] trait. Returns: The next byte from the underlying string. """ self.prev_rune = -1 if self.read_pos >= Int64(len(self.string)): return Byte(0), Error(io.EOF) var b = self.string[int(self.read_pos)] self.read_pos += 1 return Byte(ord(b)), Error() fn unread_byte(inout self) -> Error: """Unreads the last byte read. Only the most recent byte read can be unread. Implements the [io.ByteScanner] trait. """ if self.read_pos <= 0: return Error("strings.Reader.unread_byte: at beginning of string") self.prev_rune = -1 self.read_pos -= 1 return Error() # # read_rune implements the [io.RuneReader] trait. # fn read_rune() (ch rune, size int, err error): # if self.read_pos >= Int64(len(self.string)): # self.prev_rune = -1 # return 0, 0, io.EOF # self.prev_rune = int(self.read_pos) # if c = self.string[self.read_pos]; c < utf8.RuneSelf: # self.read_pos += 1 # return rune(c), 1, nil # ch, size = utf8.DecodeRuneInString(self.string[self.read_pos:]) # self.read_pos += Int64(size) # return # # unread_rune implements the [io.RuneScanner] trait. # fn unread_rune() error: # if self.read_pos <= 0: # return errors.New("strings.Reader.unread_rune: at beginning of string") # if self.prev_rune < 0: # return errors.New("strings.Reader.unread_rune: previous operation was not read_rune") # self.read_pos = Int64(self.prev_rune) # self.prev_rune = -1 # return nil fn seek(inout self, offset: Int64, whence: Int) -> (Int64, Error): """Seeks to a new position in the underlying string. The next read will start from that position. Implements the [io.Seeker] trait. Args: offset: The offset to seek to. whence: The seek mode. It can be one of [io.SEEK_START], [io.SEEK_CURRENT], or [io.SEEK_END]. Returns: The new position in the string. """ self.prev_rune = -1 var position: Int64 = 0 if whence == io.SEEK_START: position = offset elif whence == io.SEEK_CURRENT: position = self.read_pos + offset elif whence == io.SEEK_END: position = Int64(len(self.string)) + offset else: return Int64(0), Error("strings.Reader.seek: invalid whence") if position < 0: return Int64(0), Error("strings.Reader.seek: negative position") self.read_pos = position return position, Error() fn write_to[W: io.Writer](inout self, inout writer: W) -> (Int64, Error): """Writes the remaining portion of the underlying string to the provided writer. Implements the [io.WriterTo] trait. Args: writer: The writer to write the remaining portion of the string to. Returns: The number of bytes written to the writer. """ self.prev_rune = -1 if self.read_pos >= Int64(len(self.string)): return Int64(0), Error() var chunk_to_write = self.string[int(self.read_pos) :] var bytes_written: Int var err: Error bytes_written, err = io.write_string(writer, chunk_to_write) if bytes_written > len(chunk_to_write): panic("strings.Reader.write_to: invalid write_string count") self.read_pos += Int64(bytes_written) if bytes_written != len(chunk_to_write) and not err: err = Error(io.ERR_SHORT_WRITE) return Int64(bytes_written), err # TODO: How can I differentiate between the two write_to methods when the writer implements both traits? # fn write_to[W: io.StringWriter](inout self, inout writer: W) raises -> Int64: # """Writes the remaining portion of the underlying string to the provided writer. # Implements the [io.WriterTo] trait. # Args: # writer: The writer to write the remaining portion of the string to. # Returns: # The number of bytes written to the writer. # """ # self.prev_rune = -1 # if self.read_pos >= Int64(len(self.string)): # return 0 # var chunk_to_write = self.string[self.read_pos:] # var bytes_written = io.write_string(writer, chunk_to_write) # if bytes_written > len(chunk_to_write): # raise Error("strings.Reader.write_to: invalid write_string count") # self.read_pos += Int64(bytes_written) # if bytes_written != len(chunk_to_write): # raise Error(io.ERR_SHORT_WRITE) # return Int64(bytes_written) fn reset(inout self, string: String): """Resets the [Reader] to be reading from the beginning of the provided string. Args: string: The string to read from. """ self.string = string self.read_pos = 0 self.prev_rune = -1 fn new_reader(string: String = "") -> Reader: """Returns a new [Reader] reading from the provided string. It is similar to [bytes.new_buffer] but more efficient and non-writable. Args: string: The string to read from. """ return Reader(string) --- external/hue/__init__.mojo --- from .color import Color --- external/hue/color.mojo --- import math from .math import cube, clamp01, sq, pi, max_float64 from .hsluv import hSLuvD65, LuvLCh_to_HPLuv, LuvLch_to_HSLuv # This is the tolerance used when comparing colors using AlmostEqualColor. alias Delta = 1.0 / 255.0 # This is the default reference white point. alias D65 = List[Float64](0.95047, 1.00000, 1.08883) # And another one. alias D50 = List[Float64](0.96422, 1.00000, 0.82521) @value struct Color(Stringable): var R: Float64 var G: Float64 var B: Float64 fn __str__(self) -> String: return "Color(" + String(self.R) + ", " + String(self.G) + ", " + String(self.B) + ")" fn linear_rgb(self) -> (Float64, Float64, Float64): """Converts the color into the linear Color space (see http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/). """ var r = linearize(self.R) var g = linearize(self.G) var b = linearize(self.B) return r, g, b fn xyz(self) -> (Float64, Float64, Float64): var r: Float64 var g: Float64 var b: Float64 r, g, b = self.linear_rgb() var x: Float64 var y: Float64 var z: Float64 x, y, z = linear_rgb_to_xyz(r, g, b) return x, y, z fn Luv_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to CIE L*u*v* space, taking into account a given reference white. (i.e. the monitor's white) L* is in [0..1] and both u* and v* are in about [-1..1].""" var x: Float64 var y: Float64 var z: Float64 x, y, z = self.xyz() var l: Float64 var u: Float64 var v: Float64 l, u, v = xyz_to_Luv_white_ref(x, y, z, wref) return l, u, v fn LuvLCh_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): var l: Float64 var u: Float64 var v: Float64 l, u, v = self.Luv_white_ref(wref) return Luv_To_LuvLCh(l, u, v) fn HSLuv(self) -> (Float64, Float64, Float64): """Order: sColor -> Linear Color -> CIEXYZ -> CIELUV -> LuvLCh -> HSLuv. HSLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. """ var wref: List[Float64] = hSLuvD65 var l: Float64 var c: Float64 var h: Float64 l, c, h = self.LuvLCh_white_ref(wref) return LuvLch_to_HSLuv(l, c, h) fn distance_HSLuv(self, c2: Self) -> Float64: var h1: Float64 var s1: Float64 var l1: Float64 var h2: Float64 var s2: Float64 var l2: Float64 h1, s1, l1 = self.HSLuv() h2, s2, l2 = c2.HSLuv() return math.sqrt(sq((h1 - h2) / 100.0) + sq(s1 - s2) + sq(l1 - l2)) fn is_valid(self) -> Bool: """Checks whether the color exists in RGB space, i.e. all values are in [0..1].""" return 0.0 <= self.R and self.R <= 1.0 and 0.0 <= self.G and self.G <= 1.0 and 0.0 <= self.B and self.B <= 1.0 fn clamped(self) -> Self: """Clamps the color to the [0..1] range. If the color is valid already, this is a no-op.""" return Color(clamp01(self.R), clamp01(self.G), clamp01(self.B)) fn distance_rgb(self, c2: Self) -> Float64: """Computes the distance between two colors in RGB space. This is not a good measure! Rather do it in Lab space.""" return math.sqrt(sq(self.R - c2.R) + sq(self.G - c2.G) + sq(self.B - c2.B)) fn distance_linear_rgb(self, c2: Self) -> Float64: """Computes the distance between two colors in linear RGB space. This is not useful for measuring how humans perceive color, but might be useful for other things, like dithering.""" var r1: Float64 var g1: Float64 var b1: Float64 r1, g1, b1 = self.linear_rgb() var r2: Float64 var g2: Float64 var b2: Float64 r2, g2, b2 = c2.linear_rgb() return math.sqrt(sq(r1 - r2) + sq(g1 - g2) + sq(b1 - b2)) fn distance_riemersma(self, c2: Self) -> Float64: """Color distance algorithm developed by Thiadmer Riemersma. It uses RGB coordinates, but he claims it has similar results to CIELUV. This makes it both fast and accurate. Sources: https:#www.compuphase.com/cmetric.htm https:#github.com/lucasb-eyer/go-colorful/issues/52.""" var rAvg = (self.R + c2.R) / 2.0 # Deltas var dR = self.R - c2.R var dG = self.G - c2.G var dB = self.B - c2.B return math.sqrt(((2 + rAvg) * dR * dR) + (4 * dG * dG) + (2 + (1 - rAvg)) * dB * dB) fn almost_equal_rgb(self, c2: Self) -> Bool: """Check for equality between colors within the tolerance Delta (1/255).""" return abs(self.R - c2.R) + abs(self.G - c2.G) + abs(self.B - c2.B) < 3.0 * Delta fn hsv(self) -> (Float64, Float64, Float64): """Hsv returns the Hue [0..360], Saturation and Value [0..1] of the color.""" var min = min(min(self.R, self.G), self.B) var v = max(max(self.R, self.G), self.B) var C = v - min var s = 0.0 if v != 0.0: s = C / v var h = 0.0 # We use 0 instead of undefined as in wp. if min != v: if v == self.R: h = (self.G - self.B) / C % 6.0 if v == self.G: h = (self.B - self.R) / C + 2.0 if v == self.B: h = (self.R - self.G) / C + 4.0 h *= 60.0 if h < 0.0: h += 360.0 return h, s, v fn hsl(self) -> (Float64, Float64, Float64): """Hsl returns the Hue [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color.""" var min = min(min(self.R, self.G), self.B) var max = max(max(self.R, self.G), self.B) var l = (max + min) / 2.0 if min == max: return 0.0, 0.0, l var s = 0.0 if l < 0.5: s = (max - min) / (max + min) else: s = (max - min) / (2.0 - max - min) var h = 0.0 if max == self.R: h = (self.G - self.B) / (max - min) elif max == self.G: h = 2.0 + (self.B - self.R) / (max - min) else: h = 4.0 + (self.R - self.G) / (max - min) h *= 60.0 if h < 0.0: h += 360.0 return h, s, l # fn hex(self) -> String: # """Hex returns the hex "html" representation of the color, as in #ff0080.""" # # Add 0.5 for rounding # return "#" + {UInt8(self.R * 255.0 + 0.5):02x} + {UInt8(self.G * 255.0 + 0.5):02x} + {UInt8(self.B * 255.0 + 0.5):02x} # # return fmt.Sprintf("#%02x%02x%02x", uint8(col.R*255.0+0.5), uint8(col.G*255.0+0.5), uint8(col.B*255.0+0.5)) fn fast_linear_rgb(self) -> (Float64, Float64, Float64): """Is much faster than and almost as accurate as LinearRgb. BUT it is important to NOTE that they only produce good results for valid colors r,g,b in [0,1].""" return delinearize_fast(self.R), delinearize_fast(self.G), delinearize_fast(self.B) fn blend_linear_rgb(self, c2: Self, t: Float64) -> Self: """Blends two colors in the Linear RGB color-space. Unlike BlendRgb, this will not produce dark color around the center. t == 0 results in c1, t == 1 results in c2.""" var r1: Float64 var g1: Float64 var b1: Float64 r1, g1, b1 = self.linear_rgb() var r2: Float64 var g2: Float64 var b2: Float64 r2, g2, b2 = c2.linear_rgb() return fast_linear_rgb( r1 + t * (r2 - r1), g1 + t * (g2 - g1), b1 + t * (b2 - b1), ) fn xyy(self) -> (Float64, Float64, Float64): """Converts the given color to CIE xyY space using D65 as reference white. (Note that the reference white is only used for black input.) x, y and Y are in [0..1].""" var X: Float64 var Y: Float64 var Z: Float64 X, Y, Z = self.xyz() return xyz_to_xyY(X, Y, Z) fn xyy_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to CIE xyY space, taking into account a given reference white. (i.e. the monitor's white) (Note that the reference white is only used for black input.) x, y and Y are in [0..1].""" var X: Float64 var Y2: Float64 var Z: Float64 X, Y2, Z = self.xyz() return xyz_to_xyY_white_ref(X, Y2, Z, wref) fn lab(self) -> (Float64, Float64, Float64): """Converts the given color to CIE L*a*b* space using D65 as reference white.""" var x: Float64 var y: Float64 var z: Float64 x, y, z = self.xyz() return xyz_to_lab(x, y, z) fn lab_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to CIE L*a*b* space, taking into account a given reference white. (i.e. the monitor's white).""" var x: Float64 var y: Float64 var z: Float64 x, y, z = self.xyz() return xyz_to_lab_white_ref(x, y, z, wref) fn distance_lab(self, other: Self) -> Float64: """DistanceLab is a good measure of visual similarity between two colors! A result of 0 would mean identical colors, while a result of 1 or higher means the colors differ a lot.""" var l1: Float64 var a1: Float64 var b1: Float64 l1, a1, b1 = self.lab() var l2: Float64 var a2: Float64 var b2: Float64 l2, a2, b2 = other.lab() return math.sqrt(sq(l1 - l2) + sq(a1 - a2) + sq(b1 - b2)) fn distance_cie76(self, other: Self) -> Float64: """DistanceCIE76 is the same as DistanceLab.""" return self.distance_lab(other) fn distance_cie94(self, other: Self) -> Float64: """Uses the CIE94 formula to calculate color distance. More accurate than DistanceLab, but also more work.""" var l1: Float64 var a1: Float64 var b1: Float64 l1, a1, b1 = self.lab() var l2: Float64 var a2: Float64 var b2: Float64 l2, a2, b2 = other.lab() # NOTE: Since all those formulas expect L,a,b values 100x larger than we # have them in this library, we either need to adjust all constants # in the formula, or convert the ranges of L,a,b before, and then # scale the distances down again. The latter is less error-prone. l1 *= 100.0 a1 *= 100.0 b1 *= 100.0 l2 *= 100.0 a2 *= 100.0 b2 *= 100.0 var kl = 1.0 # 2.0 for textiles var kc = 1.0 var kh = 1.0 var k1 = 0.045 # 0.048 for textiles var k2 = 0.015 # 0.014 for textiles. var deltaL = l1 - l2 var c1 = math.sqrt(sq(a1) + sq(b1)) var c2 = math.sqrt(sq(a2) + sq(b2)) var deltaCab = c1 - c2 # Not taking Sqrt here for stability, and it's unnecessary. var deltaHab2 = sq(a1 - a2) + sq(b1 - b2) - sq(deltaCab) var sl = 1.0 var sc = 1.0 + k1 * c1 var sh = 1.0 + k2 * c1 var vL2 = sq(deltaL / (kl * sl)) var vC2 = sq(deltaCab / (kc * sc)) var vH2 = deltaHab2 / sq(kh * sh) return math.sqrt(vL2 + vC2 + vH2) * 0.01 # See above. fn distance_ciede2000(self, other: Self) -> Float64: """DistanceCIEDE2000 uses the Delta E 2000 formula to calculate color distance. It is more expensive but more accurate than both DistanceLab and DistanceCIE94.""" return self.distance_ciede2000klch(other, 1.0, 1.0, 1.0) fn distance_ciede2000klch(self, other: Self, kl: Float64, kc: Float64, kh: Float64) -> Float64: """DistanceCIEDE2000klch uses the Delta E 2000 formula with custom values for the weighting factors kL, kC, and kH.""" var l1: Float64 var a1: Float64 var b1: Float64 l1, a1, b1 = self.lab() var l2: Float64 var a2: Float64 var b2: Float64 l2, a2, b2 = other.lab() # As with CIE94, we scale up the ranges of L,a,b beforehand and scale # them down again afterwards. l1 *= 100.0 a1 *= 100.0 b1 *= 100.0 l2 *= 100.0 a2 *= 100.0 b2 *= 100.0 var cab1 = math.sqrt(sq(a1) + sq(b1)) var cab2 = math.sqrt(sq(a2) + sq(b2)) var cabmean = (cab1 + cab2) / 2 var p: Float64 = 25.0 var g = 0.5 * (1 - math.sqrt((cabmean**7) / ((cabmean**7) + (p**7)))) var ap1 = (1 + g) * a1 var ap2 = (1 + g) * a2 var cp1 = math.sqrt(sq(ap1) + sq(b1)) var cp2 = math.sqrt(sq(ap2) + sq(b2)) var hp1 = 0.0 if b1 != ap1 or ap1 != 0: hp1 = math.atan2(b1, ap1) if hp1 < 0: hp1 += pi * 2 hp1 *= 180 / pi var hp2 = 0.0 if b2 != ap2 or ap2 != 0: hp2 = math.atan2(b2, ap2) if hp2 < 0: hp2 += pi * 2 hp2 *= 180 / pi var deltaLp = l2 - l1 var deltaCp = cp2 - cp1 var dhp = 0.0 var cpProduct = cp1 * cp2 if cpProduct != 0: dhp = hp2 - hp1 if dhp > 180: dhp -= 360 elif dhp < -180: dhp += 360 var deltaHp = 2 * math.sqrt(cpProduct) * math.sin(dhp / 2 * pi / 180) var lpmean = (l1 + l2) / 2 var cpmean = (cp1 + cp2) / 2 var hpmean = hp1 + hp2 if cpProduct != 0: hpmean /= 2 if abs(hp1 - hp2) > 180: if hp1 + hp2 < 360: hpmean += 180 else: hpmean -= 180 var t = 1 - 0.17 * math.cos((hpmean - 30) * pi / 180) + 0.24 * math.cos( 2 * hpmean * pi / 180 ) + 0.32 * math.cos((3 * hpmean + 6) * pi / 180) - 0.2 * math.cos((4 * hpmean - 63) * pi / 180) var deltaTheta = 30 * math.exp(-sq((hpmean - 275) / 25)) var rc = 2 * math.sqrt((cpmean**7) / ((cpmean**7) + (p**7))) var sl = 1 + (0.015 * sq(lpmean - 50)) / math.sqrt(20 + sq(lpmean - 50)) var sc = 1 + 0.045 * cpmean var sh = 1 + 0.015 * cpmean * t var rt = -math.sin(2 * deltaTheta * pi / 180) * rc return ( math.sqrt( sq(deltaLp / (kl * sl)) + sq(deltaCp / (kc * sc)) + sq(deltaHp / (kh * sh)) + rt * (deltaCp / (kc * sc)) * (deltaHp / (kh * sh)) ) * 0.01 ) fn blend_lab(self, c2: Self, t: Float64) -> Self: """BlendLab blends two colors in the L*a*b* color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2.""" var l1: Float64 var a1: Float64 var b1: Float64 l1, a1, b1 = self.lab() var l2: Float64 var a2: Float64 var b2: Float64 l2, a2, b2 = c2.lab() return lab(l1 + t * (l2 - l1), a1 + t * (a2 - a1), b1 + t * (b2 - b1)) fn luv(self) -> (Float64, Float64, Float64): """Converts the given color to CIE L*u*v* space using D65 as reference white. L* is in [0..1] and both u* and v* are in about [-1..1].""" var x: Float64 var y: Float64 var z: Float64 x, y, z = self.xyz() return xyz_to_Luv(x, y, z) fn distance_luv(self, c2: Self) -> Float64: """DistanceLuv is a good measure of visual similarity between two colors! A result of 0 would mean identical colors, while a result of 1 or higher means the colors differ a lot.""" var l1: Float64 var u1: Float64 var v1: Float64 l1, u1, v1 = self.luv() var l2: Float64 var u2: Float64 var v2: Float64 l2, u2, v2 = c2.luv() return math.sqrt(sq(l1 - l2) + sq(u1 - u2) + sq(v1 - v2)) fn blend_luv(self, c2: Self, t: Float64) -> Self: """BlendLuv blends two colors in the CIE-L*u*v* color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2.""" var l1: Float64 var u1: Float64 var v1: Float64 l1, u1, v1 = self.luv() var l2: Float64 var u2: Float64 var v2: Float64 l2, u2, v2 = c2.luv() return Luv(l1 + t * (l2 - l1), u1 + t * (u2 - u1), v1 + t * (v2 - v1)) fn hcl(self) -> (Float64, Float64, Float64): """Converts the given color to HCL space using D65 as reference white. H values are in [0..360], C and L values are in [0..1] although C can overshoot 1.0.""" return self.hcl_white_ref(D65) fn hcl_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to HCL space, taking into account a given reference white. (i.e. the monitor's white) H values are in [0..360], C and L values are in [0..1].""" var L: Float64 var a: Float64 var b: Float64 L, a, b = self.lab_white_ref(wref) return lab_to_hcl(L, a, b) fn blend_hcl(self, other: Self, t: Float64) -> Self: """BlendHcl blends two colors in the CIE-L*C*h° color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2.""" var h1: Float64 var c1: Float64 var l1: Float64 h1, c1, l1 = self.hcl() var h2: Float64 var c2: Float64 var l2: Float64 h2, c2, l2 = other.hcl() # https:#github.com/lucasb-eyer/go-colorful/pull/60 if c1 <= 0.00015 and c2 >= 0.00015: h1 = h2 elif c2 <= 0.00015 and c1 >= 0.00015: h2 = h1 # We know that h are both in [0..360] return hcl(interp_angle(h1, h2, t), c1 + t * (c2 - c1), l1 + t * (l2 - l1)).clamped() fn LuvLCh(self) -> (Float64, Float64, Float64): """Converts the given color to LuvLCh space using D65 as reference white. h values are in [0..360], C and L values are in [0..1] although C can overshoot 1.0.""" return self.Luv_LCh_white_ref(D65) fn Luv_LCh_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to LuvLCh space, taking into account a given reference white. (i.e. the monitor's white) h values are in [0..360], c and l values are in [0..1].""" var l: Float64 var u: Float64 var v: Float64 l, u, v = self.Luv_white_ref(wref) return Luv_To_LuvLCh(l, u, v) fn blend_Luv_LCh(self, other: Self, t: Float64) -> Self: """BlendLuvLCh blends two colors in the cylindrical CIELUV color space. t == 0 results in c1, t == 1 results in c2.""" var l1: Float64 var c1: Float64 var h1: Float64 l1, c1, h1 = self.LuvLCh() var l2: Float64 var c2: Float64 var h2: Float64 l2, c2, h2 = other.LuvLCh() # We know that h are both in [0..360] return LuvLCh(l1 + t * (l2 - l1), c1 + t * (c2 - c1), interp_angle(h1, h2, t)) fn HPLuv(self) -> (Float64, Float64, Float64): """HPLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. Note that HPLuv can only represent pastel colors, and so the Saturation value could be much larger than 1 for colors it can't represent.""" var l: Float64 var c: Float64 var h: Float64 l, c, h = self.LuvLCh_white_ref(hSLuvD65) return LuvLCh_to_HPLuv(l, c, h) fn interp_angle(a0: Float64, a1: Float64, t: Float64) -> Float64: """Utility used by Hxx color-spaces for interpolating between two angles in [0,360].""" # Based on the answer here: http://stackoverflow.com/a/14498790/2366315 # With potential proof that it works here: http://math.stackexchange.com/a/2144499 var delta = ((((a1 - a0) % 360.0) + 540.0)) % 360.0 - 180.0 return (a0 + t * delta + 360.0) % 360.0 ### HSV ### ########### # From http://en.wikipedia.org/wiki/HSL_and_HSV # Note that h is in [0..360] and s,v in [0..1] fn hsv(h: Float64, s: Float64, v: Float64) -> Color: """Hsv creates a new Color given a Hue in [0..360], a Saturation and a Value in [0..1].""" var hp = h / 60.0 var C = v * s var X = C * (1.0 - abs((hp % 2.0) - 1.0)) var m = v - C var r = 0.0 var g = 0.0 var b = 0.0 if 0.0 <= hp and hp < 1.0: r = C g = X elif 1.0 <= hp and hp < 2.0: r = X g = C elif 2.0 <= hp and hp < 3.0: g = C b = X elif 3.0 <= hp and hp < 4.0: g = X b = C elif 4.0 <= hp and hp < 5.0: r = X b = C elif 5.0 <= hp and hp < 6.0: r = C b = X return Color(m + r, m + g, m + b) ## HSL ## ######### fn hsl(h: Float64, s: Float64, l: Float64) -> Color: """Hsl creates a new Color given a Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1].""" if s == 0: return Color(l, l, l) var r: Float64 var g: Float64 var b: Float64 var t1: Float64 var t2: Float64 var tr: Float64 var tg: Float64 var tb: Float64 if l < 0.5: t1 = l * (1.0 + s) else: t1 = l + s - l * s t2 = 2 * l - t1 var h_copy = h h_copy /= 360 tr = h_copy + 1.0 / 3.0 tg = h_copy tb = h_copy - 1.0 / 3.0 if tr < 0: tr += 1 if tr > 1: tr -= 1 if tg < 0: tg += 1 if tg > 1: tg -= 1 if tb < 0: tb += 1 if tb > 1: tb -= 1 # Red if 6 * tr < 1: r = t2 + (t1 - t2) * 6 * tr elif 2 * tr < 1: r = t1 elif 3 * tr < 2: r = t2 + (t1 - t2) * (2.0 / 3.0 - tr) * 6 else: r = t2 # Green if 6 * tg < 1: g = t2 + (t1 - t2) * 6 * tg elif 2 * tg < 1: g = t1 elif 3 * tg < 2: g = t2 + (t1 - t2) * (2.0 / 3.0 - tg) * 6 else: g = t2 # Blue if 6 * tb < 1: b = t2 + (t1 - t2) * 6 * tb elif 2 * tb < 1: b = t1 elif 3 * tb < 2: b = t2 + (t1 - t2) * (2.0 / 3.0 - tb) * 6 else: b = t2 return Color(r, g, b) ## Hex ## ######### # # Hex parses a "html" hex color-string, either in the 3 "#f0c" or 6 "#ff1034" digits form. # func Hex(scol string) (Color, error) { # format := "#%02x%02x%02x" # factor := 1.0 / 255.0 # if len(scol) == 4 { # format = "#%1x%1x%1x" # factor = 1.0 / 15.0 # } # var r, g, b UInt8 # n, err := fmt.Sscanf(scol, format, &r, &g, &b) # if err != nil { # return Color{}, err # } # if n != 3 { # return Color{}, fmt.Errorf("color: %v is not a hex-color", scol) # } # return Color{float64(r) * factor, float64(g) * factor, float64(b) * factor}, nil # } ## Linear ## ####### # A much faster and still quite precise linearization using a 6th-order Taylor approximation. # See the accompanying Jupyter notebook for derivation of the constants. fn linearize_fast(v: Float64) -> Float64: var v1 = v - 0.5 var v2 = v1 * v1 var v3 = v2 * v1 var v4 = v2 * v2 return ( -0.248750514614486 + 0.925583310193438 * v + 1.16740237321695 * v2 + 0.280457026598666 * v3 - 0.0757991963780179 * v4 ) fn delinearize_fast(v: Float64) -> Float64: if v > 0.2: var v1 = v - 0.6 var v2 = v1 * v1 var v3 = v2 * v1 var v4 = v2 * v2 var v5 = v3 * v2 return ( 0.442430344268235 + 0.592178981271708 * v - 0.287864782562636 * v2 + 0.253214392068985 * v3 - 0.272557158129811 * v4 + 0.325554383321718 * v5 ) elif v > 0.03: var v1 = v - 0.115 var v2 = v1 * v1 var v3 = v2 * v1 var v4 = v2 * v2 var v5 = v3 * v2 return ( 0.194915592891669 + 1.55227076330229 * v - 3.93691860257828 * v2 + 18.0679839248761 * v3 - 101.468750302746 * v4 + 632.341487393927 * v5 ) else: var v1 = v - 0.015 var v2 = v1 * v1 var v3 = v2 * v1 var v4 = v2 * v2 var v5 = v3 * v2 return ( 0.0519565234928877 + 5.09316778537561 * v - 99.0338180489702 * v2 + 3484.52322764895 * v3 - 150028.083412663 * v4 + 7168008.42971613 * v5 ) # FastLinearRgb is much faster than and almost as accurate as LinearRgb. # BUT it is important to NOTE that they only produce good results for valid inputs r,g,b in [0,1]. fn fast_linear_rgb(r: Float64, g: Float64, b: Float64) -> Color: return Color(delinearize_fast(r), delinearize_fast(g), delinearize_fast(b)) fn xyz_to_xyY(X: Float64, Y: Float64, Z: Float64) -> (Float64, Float64, Float64): return xyz_to_xyY_white_ref(X, Y, Z, D65) fn xyz_to_xyY_white_ref(X: Float64, Y: Float64, Z: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var Yout = Y var N = X + Y + Z var x = X var y = Y if abs(N) < 1e-14: x = wref[0] / (wref[0] + wref[1] + wref[2]) y = wref[1] / (wref[0] + wref[1] + wref[2]) else: x = x / N y = y / N return x, y, Yout fn xyy_to_xyz(x: Float64, y: Float64, Y: Float64) -> (Float64, Float64, Float64): var Yout = y var X = x var Z = 0.0 if -1e-14 < y and y < 1e-14: X = 0.0 Z = 0.0 else: X = Y / y * x Z = Y / y * (1.0 - x - y) return x, y, Yout fn xyy(x: Float64, y: Float64, Y: Float64) -> Color: var X: Float64 var new_Y: Float64 var Z: Float64 X, new_Y, Z = xyy_to_xyz(x, y, Y) return xyz(X, new_Y, Z) # / L*a*b* #/ ####### # http://en.wikipedia.org/wiki/Lab_color_space#CIELAB-CIEXYZ_conversions # For L*a*b*, we need to L*a*b*<->XYZ->RGB and the first one is device dependent. fn lab_f(t: Float64) -> Float64: if t > 6.0 / 29.0 * 6.0 / 29.0 * 6.0 / 29.0: return math.cbrt(t) return t / 3.0 * 29.0 / 6.0 * 29.0 / 6.0 + 4.0 / 29.0 fn xyz_to_lab(x: Float64, y: Float64, z: Float64) -> (Float64, Float64, Float64): """Use D65 white as reference point by default. http://www.fredmiranda.com/forum/topic/1035332 http://en.wikipedia.org/wiki/Standard_illuminant.""" return xyz_to_lab_white_ref(x, y, z, D65) fn xyz_to_lab_white_ref(x: Float64, y: Float64, z: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var fy = lab_f(y / wref[1]) var l = 1.16 * fy - 0.16 var a = 5.0 * (lab_f(x / wref[0]) - fy) var b = 2.0 * (fy - lab_f(z / wref[2])) return l, a, b fn lab_finv(t: Float64) -> Float64: if t > 6.0 / 29.0: return t * t * t return 3.0 * 6.0 / 29.0 * 6.0 / 29.0 * (t - 4.0 / 29.0) fn lab_to_xyz(l: Float64, a: Float64, b: Float64) -> (Float64, Float64, Float64): """D65 white (see above).""" return lab_to_xyz_white_ref(l, a, b, D65) fn lab_to_xyz_white_ref(l: Float64, a: Float64, b: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var l2 = (l + 0.16) / 1.16 var x = wref[0] * lab_finv(l2 + a / 5.0) var y = wref[1] * lab_finv(l2) var z = wref[2] * lab_finv(l2 - b / 2.0) return x, y, z fn lab(l: Float64, a: Float64, b: Float64) -> Color: """Generates a color by using data given in CIE L*a*b* space using D65 as reference white. WARNING: many combinations of `l`, `a`, and `b` values do not have corresponding valid RGB values, check the FAQ in the README if you're unsure.""" var x: Float64 var y: Float64 var z: Float64 x, y, z = lab_to_xyz(l, a, b) return xyz(x, y, z) fn lab_white_ref(l: Float64, a: Float64, b: Float64, wref: List[Float64]) -> Color: """Generates a color by using data given in CIE L*a*b* space, taking into account a given reference white. (i.e. the monitor's white).""" var x: Float64 var y: Float64 var z: Float64 x, y, z = lab_to_xyz_white_ref(l, a, b, wref) return xyz(x, y, z) # / L*u*v* #/ ####### # http://en.wikipedia.org/wiki/CIELUV#XYZ_.E2.86.92_CIELUV_and_CIELUV_.E2.86.92_XYZ_conversions # For L*u*v*, we need to L*u*v*<->XYZ<->RGB and the first one is device dependent. fn xyz_to_Luv(x: Float64, y: Float64, z: Float64) -> (Float64, Float64, Float64): """Use D65 white as reference point by default.""" return xyz_to_Luv_white_ref(x, y, z, D65) fn luv_to_xyz(l: Float64, u: Float64, v: Float64) -> (Float64, Float64, Float64): """Use D65 white as reference point by default.""" return luv_to_xyz_white_ref(l, u, v, D65) fn Luv(l: Float64, u: Float64, v: Float64) -> Color: """Generates a color by using data given in CIE L*u*v* space using D65 as reference white. L* is in [0..1] and both u* and v* are in about [-1..1] WARNING: many combinations of `l`, `u`, and `v` values do not have corresponding valid RGB values, check the FAQ in the README if you're unsure.""" var x: Float64 var y: Float64 var z: Float64 x, y, z = luv_to_xyz(l, u, v) return xyz(x, y, z) fn Luv_white_ref(l: Float64, u: Float64, v: Float64, wref: List[Float64]) -> Color: """Generates a color by using data given in CIE L*u*v* space, taking into account a given reference white. (i.e. the monitor's white) L* is in [0..1] and both u* and v* are in about [-1..1].""" var x: Float64 var y: Float64 var z: Float64 x, y, z = luv_to_xyz_white_ref(l, u, v, wref) return xyz(x, y, z) ## HCL ## ######### # HCL is nothing else than L*a*b* in cylindrical coordinates! # (this was wrong on English wikipedia, I fixed it, let's hope the fix stays.) # But it is widely popular since it is a "correct HSV" # http://www.hunterlab.com/appnotes/an09_96a.pdf fn lab_to_hcl(L: Float64, a: Float64, b: Float64) -> (Float64, Float64, Float64): var h = 0.0 if abs(b - a) > 1e-4 and abs(a) > 1e-4: h = (57.29577951308232087721 * math.atan2(b, a) + 360.0) % 360.0 # Rad2Deg var c = math.sqrt(sq(a) + sq(b)) var l = L return h, c, l fn hcl(h: Float64, c: Float64, l: Float64) -> Color: """Generates a color by using data given in HCL space using D65 as reference white. H values are in [0..360], C and L values are in [0..1] WARNING: many combinations of `h`, `c`, and `l` values do not have corresponding valid RGB values, check the FAQ in the README if you're unsure.""" return hcl_white_ref(h, c, l, D65) fn hcl_to_Lab(h: Float64, c: Float64, l: Float64) -> (Float64, Float64, Float64): var H = 0.01745329251994329576 * h # Deg2Rad var a = c * math.cos(H) var b = c * math.sin(H) var L = l return L, a, b fn hcl_white_ref(h: Float64, c: Float64, l: Float64, wref: List[Float64]) -> Color: """Generates a color by using data given in HCL space, taking into account a given reference white. (i.e. the monitor's white) H values are in [0..360], C and L values are in [0..1].""" var L: Float64 var a: Float64 var b: Float64 L, a, b = hcl_to_Lab(h, c, l) return lab_white_ref(L, a, b, wref) fn LuvLCh(l: Float64, c: Float64, h: Float64) -> Color: """Generates a color by using data given in LuvLCh space using D65 as reference white. h values are in [0..360], C and L values are in [0..1] WARNING: many combinations of `l`, `c`, and `h` values do not have corresponding valid RGB values, check the FAQ in the README if you're unsure.""" return LuvLCh_white_ref(l, c, h, D65) fn LuvLChToLuv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): var H = 0.01745329251994329576 * h # Deg2Rad var u = c * math.cos(H) var v = c * math.sin(H) var L = l return L, u, v fn LuvLCh_white_ref(l: Float64, c: Float64, h: Float64, wref: List[Float64]) -> Color: """Generates a color by using data given in LuvLCh space, taking into account a given reference white. (i.e. the monitor's white) h values are in [0..360], C and L values are in [0..1].""" var L: Float64 var u: Float64 var v: Float64 L, u, v = LuvLChToLuv(l, c, h) return Luv_white_ref(L, u, v, wref) fn clamped(color: Color) -> Color: return Color(clamp01(color.R), clamp01(color.G), clamp01(color.B)) fn linearize(v: Float64) -> Float64: if v <= 0.04045: return v / 12.92 var lhs: Float64 = (v + 0.055) / 1.055 var rhs: Float64 = 2.4 return lhs**rhs fn linear_rgb_to_xyz(r: Float64, g: Float64, b: Float64) -> (Float64, Float64, Float64): var x: Float64 = 0.41239079926595948 * r + 0.35758433938387796 * g + 0.18048078840183429 * b var y: Float64 = 0.21263900587151036 * r + 0.71516867876775593 * g + 0.072192315360733715 * b var z: Float64 = 0.019330818715591851 * r + 0.11919477979462599 * g + 0.95053215224966058 * b return x, y, z fn luv_to_xyz_white_ref(l: Float64, u: Float64, v: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var y: Float64 if l <= 0.08: y = wref[1] * l * 100.0 * 3.0 / 29.0 * 3.0 / 29.0 * 3.0 / 29.0 else: y = wref[1] * cube((l + 0.16) / 1.16) var un: Float64 = 0 var vn: Float64 = 0 un, vn = xyz_to_uv(wref[0], wref[1], wref[2]) var x: Float64 = 0 var z: Float64 = 0 if l != 0.0: var ubis = (u / (13.0 * l)) + un var vbis = (v / (13.0 * l)) + vn x = y * 9.0 * ubis / (4.0 * vbis) z = y * (12.0 - (3.0 * ubis) - (20.0 * vbis)) / (4.0 * vbis) else: x = 0.0 y = 0.0 return x, y, z fn xyz_to_uv(x: Float64, y: Float64, z: Float64) -> (Float64, Float64): """For this part, we do as R's graphics.hcl does, not as wikipedia does. Or is it the same.""" var denom = x + (15.0 * y) + (3.0 * z) var u: Float64 var v: Float64 if denom == 0.0: u = 0.0 v = 0.0 return u, v u = 4.0 * x / denom v = 9.0 * y / denom return u, v fn xyz_to_Luv_white_ref(x: Float64, y: Float64, z: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var l: Float64 if y / wref[1] <= 6.0 / 29.0 * 6.0 / 29.0 * 6.0 / 29.0: l = y / wref[1] * (29.0 / 3.0 * 29.0 / 3.0 * 29.0 / 3.0) / 100.0 else: l = 1.16 * math.cbrt(y / wref[1]) - 0.16 var ubis: Float64 var vbis: Float64 ubis, vbis = xyz_to_uv(x, y, z) var un: Float64 var vn: Float64 un, vn = xyz_to_uv(wref[0], wref[1], wref[2]) var u: Float64 var v: Float64 u = 13.0 * l * (ubis - un) v = 13.0 * l * (vbis - vn) return l, u, v fn Luv_To_LuvLCh(L: Float64, u: Float64, v: Float64) -> (Float64, Float64, Float64): # Oops, floating point workaround necessary if u ~= v and both are very small (i.e. almost zero). var h: Float64 if abs(v - u) > 1e-4 and abs(u) > 1e-4: h = (57.29577951308232087721 * math.atan2(v, u) + 360.0) % 360.0 # Rad2Deg else: h = 0.0 var l = L var c = math.sqrt(sq(u) + sq(v)) return l, c, h fn xyz_to_linear_rgb(x: Float64, y: Float64, z: Float64) -> (Float64, Float64, Float64): """Converts from CIE XYZ-space to Linear Color space.""" var r = (3.2409699419045214 * x) - (1.5373831775700935 * y) - (0.49861076029300328 * z) var g = (-0.96924363628087983 * x) + (1.8759675015077207 * y) + (0.041555057407175613 * z) var b = (0.055630079696993609 * x) - (0.20397695888897657 * y) + (1.0569715142428786 * z) return r, g, b fn delinearize(v: Float64) -> Float64: if v <= 0.0031308: return 12.92 * v return 1.055 * (v ** (1.0 / 2.4)) - 0.055 fn linear_rgb(r: Float64, g: Float64, b: Float64) -> Color: return Color(delinearize(r), delinearize(g), delinearize(b)) fn xyz(x: Float64, y: Float64, z: Float64) -> Color: var r: Float64 var g: Float64 var b: Float64 r, g, b = xyz_to_linear_rgb(x, y, z) return linear_rgb(r, g, b) --- external/hue/color_gens.mojo --- from random import randn_float64 from .color import Color, hsv, hcl # Various ways to generate single random colors fn fast_warm_color() -> Color: """Creates a random dark, "warm" color through a restricted HSV space.""" return hsv(randn_float64() * 360.0, 0.5 + randn_float64() * 0.3, 0.3 + randn_float64() * 0.3) fn warm_color() -> Color: """Creates a random dark, "warm" color through restricted HCL space. This is slower than FastWarmColor but will likely give you colors which have the same "warmness" if you run it many times.""" var c = random_warm() while not c.is_valid(): c = random_warm() return c fn random_warm() -> Color: return hcl(randn_float64() * 360.0, 0.1 + randn_float64() * 0.3, 0.2 + randn_float64() * 0.3) fn fast_happy_color() -> Color: """Creates a random bright, "pimpy" color through a restricted HSV space.""" return hsv(randn_float64() * 360.0, 0.7 + randn_float64() * 0.3, 0.6 + randn_float64() * 0.3) fn happy_color() -> Color: """Creates a random bright, "pimpy" color through restricted HCL space. This is slower than FastHappyColor but will likely give you colors which have the same "brightness" if you run it many times.""" var c = random_pimp() while not c.is_valid(): c = random_pimp() return c fn random_pimp() -> Color: return hcl(randn_float64() * 360.0, 0.5 + randn_float64() * 0.3, 0.5 + randn_float64() * 0.3) --- external/hue/happy_palettegen.mojo --- from random import randn_float64 from .color import Color, hsv, lab_to_hcl from .soft_palettegen import soft_palette_ex, SoftPaletteSettings fn fast_happy_palette(colors_count: Int) -> List[Color]: """Uses the HSV color space to generate colors with similar S,V but distributed evenly along their Hue. This is fast but not always pretty. If you've got time to spare, use Lab (the non-fast below).""" var colors = List[Color](capacity=colors_count) for _ in range(colors_count): colors.append(Color(0, 0, 0)) var i = 0 while i < colors_count: colors[i] = hsv( Float64(i) * (360.0 / Float64(colors_count)), 0.8 + randn_float64() * 0.2, 0.65 + randn_float64() * 0.2 ) i += 1 return colors fn happy_palette(colors_count: Int) raises -> List[Color]: fn pimpy(l: Float64, a: Float64, b: Float64) -> Bool: var h: Float64 var c: Float64 var l_new: Float64 l_new, c, h = lab_to_hcl(l, a, b) return 0.3 <= c and 0.4 <= l and l <= 0.8 return soft_palette_ex(colors_count, SoftPaletteSettings(pimpy, 50, True)) --- external/hue/hsluv.mojo --- from .math import cube, clamp01, sq, pi, max_float64 from .color import Color, linear_rgb, xyz_to_linear_rgb, luv_to_xyz_white_ref import math alias hSLuvD65 = List[Float64](0.95045592705167, 1.0, 1.089057750759878) fn LuvLCh_to_HSLuv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): """[-1..1] but the code expects it to be [-100..100].""" var c_new = c * 100.0 var l_new = l * 100.0 var s: Float64 var max_val: Float64 if l_new > 99.9999999 or l_new < 0.00000001: s = 0.0 else: max_val = max_chroma_for_lh(l_new, h) s = c_new / max_val * 100.0 return h, clamp01(s / 100.0), clamp01(l_new / 100.0) fn HSLuvToLuvLCh(h: Float64, s: Float64, l: Float64) -> (Float64, Float64, Float64): var tmp_l = l * 100.0 var tmp_s = s * 100.0 var c: Float64 var max: Float64 if tmp_l > 99.9999999 or tmp_l < 0.00000001: c = 0.0 else: max = max_chroma_for_lh(l, h) c = max / 100.0 * tmp_s # c is [-100..100], but for LCh it's supposed to be almost [-1..1] return clamp01(l / 100.0), c / 100.0, h fn LuvLCh_to_Luv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): var H: Float64 = 0.01745329251994329576 * h # Deg2Rad var u = c * math.cos(H) var v = c * math.sin(H) return l, u, v fn LuvLCh_to_HPLuv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): """[-1..1] but the code expects it to be [-100..100].""" var c_new = c * 100.0 var l_new = l * 100.0 var s: Float64 var max_val: Float64 if l_new > 99.9999999 or l_new < 0.00000001: s = 0.0 else: max_val = max_safe_chroma_for_l(l_new) s = c_new / max_val * 100.0 return h, s / 100.0, l_new / 100.0 fn HPLuv_to_LuvLCh(h: Float64, s: Float64, l: Float64) -> (Float64, Float64, Float64): var l_new = l * 100.0 var s_new = s * 100.0 var c: Float64 var max_val: Float64 if l_new > 99.9999999 or l_new < 0.00000001: c = 0.0 else: max_val = max_safe_chroma_for_l(l_new) c = max_val / 100.0 * s_new return l_new / 100.0, c / 100.0, h fn HSLuv(h: Float64, s: Float64, l: Float64) -> Color: """Creates a new Color from values in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. The returned color values are clamped (using .Clamped), so this will never output an invalid color.""" # HSLuv -> LuvLCh -> CIELUV -> CIEXYZ -> Linear RGB -> sRGB var l_new: Float64 var c: Float64 var h_new: Float64 l_new, c, h_new = HSLuvToLuvLCh(h, s, l) var L: Float64 var u: Float64 var v: Float64 L, u, v = LuvLCh_to_Luv(l_new, c, h_new) var x: Float64 var y: Float64 var z: Float64 x, y, z = luv_to_xyz_white_ref(l, u, v, hSLuvD65) var R: Float64 var G: Float64 var B: Float64 R, G, B = xyz_to_linear_rgb(x, y, z) return linear_rgb(R, G, B).clamped() fn LuvLch_to_HSLuv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): # [-1..1] but the code expects it to be [-100..100] var tmp_l: Float64 = l * 100.0 var tmp_c: Float64 = c * 100.0 var s: Float64 var max_val: Float64 if tmp_l > 99.9999999 or tmp_l < 0.00000001: s = 0.0 else: max_val = max_chroma_for_lh(tmp_l, h) s = tmp_c / max_val * 100.0 return h, clamp01(s / 100.0), clamp01(tmp_l / 100.0) fn HPLuv(h: Float64, s: Float64, l: Float64) -> Color: """HPLuv creates a new Color from values in the HPLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. The returned color values are clamped (using .Clamped), so this will never output an invalid color.""" # HPLuv -> LuvLCh -> CIELUV -> CIEXYZ -> Linear RGB -> sRGB var l_new: Float64 var c: Float64 var h_new: Float64 l_new, c, h_new = HPLuv_to_LuvLCh(h, s, l) var L: Float64 var u: Float64 var v: Float64 L, u, v = LuvLCh_to_Luv(l_new, c, h_new) var x: Float64 var y: Float64 var z: Float64 x, y, z = luv_to_xyz_white_ref(l, u, v, hSLuvD65) var R: Float64 var G: Float64 var B: Float64 R, G, B = xyz_to_linear_rgb(x, y, z) return linear_rgb(R, G, B).clamped() fn HSLuv(self: Color) -> (Float64, Float64, Float64): """HSLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1].""" # sRGB -> Linear RGB -> CIEXYZ -> CIELUV -> LuvLCh -> HSLuv var l: Float64 var c: Float64 var h: Float64 l, c, h = self.LuvLCh_white_ref(hSLuvD65) return LuvLCh_to_HSLuv(l, c, h) fn HPLuv(self: Color) -> (Float64, Float64, Float64): """HPLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. Note that HPLuv can only represent pastel colors, and so the Saturation value could be much larger than 1 for colors it can't represent.""" # sRGB -> Linear RGB -> CIEXYZ -> CIELUV -> LuvLCh -> HSLuv var l: Float64 var c: Float64 var h: Float64 l, c, h = self.LuvLCh_white_ref(hSLuvD65) return LuvLCh_to_HPLuv(l, c, h) fn DistanceHPLuv(self: Color, other: Color) -> Float64: """DistanceHPLuv calculates Euclidean distance in the HPLuv colorspace. No idea how useful this is. The Hue value is divided by 100 before the calculation, so that H, S, and L have the same relative ranges.""" var h1: Float64 var s1: Float64 var l1: Float64 h1, s1, l1 = self.HPLuv() var h2: Float64 var s2: Float64 var l2: Float64 h2, s2, l2 = other.HPLuv() return math.sqrt(sq((h1 - h2) / 100.0) + sq(s1 - s2) + sq(l1 - l2)) alias m = List[List[Float64]]( List[Float64](3.2409699419045214, -1.5373831775700935, -0.49861076029300328), List[Float64](-0.96924363628087983, 1.8759675015077207, 0.041555057407175613), List[Float64](0.055630079696993609, -0.20397695888897657, 1.0569715142428786), ) alias kappa = 903.2962962962963 alias epsilon = 0.0088564516790356308 fn get_bounds(l: Float64) -> List[List[Float64]]: var sub2: Float64 var sub1 = (l + 16.0**3.0) / 1560896.0 var ret = List[List[Float64]]( List[Float64](0, 0), List[Float64](0, 0), List[Float64](0, 0), List[Float64](0, 0), List[Float64](0, 0), List[Float64](0, 0), ) if sub1 > epsilon: sub2 = sub1 else: sub2 = l / kappa for i in range(len(m)): var k = 0 while k < 2: var top1 = (284517.0 * m[i][0] - 94839.0 * m[i][2]) * sub2 var top2 = (838422.0 * m[i][2] + 769860.0 * m[i][1] + 731718.0 * m[i][0]) * l * sub2 - 769860.0 * Float64( k ) * l var bottom = (632260.0 * m[i][2] - 126452.0 * m[i][1]) * sub2 + 126452.0 * Float64(k) ret[i * 2 + k][0] = top1 / bottom ret[i * 2 + k][1] = top2 / bottom k += 1 return ret fn length_of_ray_until_intersect(theta: Float64, x: Float64, y: Float64) -> Float64: return y / (math.sin(theta) - x * math.cos(theta)) fn max_chroma_for_lh(l: Float64, h: Float64) -> Float64: var hRad = h / 360.0 * pi * 2.0 var minLength = max_float64 var bounds = get_bounds(l) for i in range(len(bounds)): var line = bounds[i] var length = length_of_ray_until_intersect(hRad, line[0], line[1]) if length > 0.0 and length < minLength: minLength = length return minLength fn max_safe_chroma_for_l(l: Float64) -> Float64: var min_length = max_float64 for line in get_bounds(l): var m1 = line[][0] var b1 = line[][1] var x = intersect_line_line(m1, b1, -1.0 / m1, 0.0) var dist = distance_from_pole(x, b1 + x * m1) if dist < min_length: min_length = dist return min_length fn intersect_line_line(x1: Float64, y1: Float64, x2: Float64, y2: Float64) -> Float64: return (y1 - y2) / (x2 - x1) fn distance_from_pole(x: Float64, y: Float64) -> Float64: return math.sqrt(sq(x) + sq(y)) --- external/hue/math.mojo --- from utils.numerics import max_finite fn cube(v: Float64) -> Float64: return v * v * v fn sq(v: Float64) -> Float64: return v * v fn clamp01(v: Float64) -> Float64: """Clamps from 0 to 1.""" return max(0.0, min(v, 1.0)) alias pi: Float64 = 3.141592653589793238462643383279502884197169399375105820974944592307816406286 alias max_float64: Float64 = max_finite[DType.float64]() --- external/hue/soft_palettegen.mojo --- from collections.optional import Optional from random import random_si64 from utils.numerics import inf import math from .math import sq from .color import lab # The algorithm works in L*a*b* color space and converts to RGB in the end. # L* in [0..1], a* and b* in [-1..1] @register_passable("trivial") struct lab_t(EqualityComparable): var L: Float64 var A: Float64 var B: Float64 fn __init__(inout self, L: Float64, A: Float64, B: Float64): self.L = L self.A = A self.B = B fn __eq__(self, other: lab_t) -> Bool: return self.L == other.L and self.A == other.A and self.B == other.B fn __ne__(self, other: lab_t) -> Bool: return self.L != other.L or self.A != other.A or self.B != other.B fn in_stack(haystack: List[lab_t], upto: Int, needle: lab_t) -> Bool: var i = 0 while i < upto and i < len(haystack): if haystack[i] == needle: return True i += 1 return False fn labs_2_cols(labs: List[lab_t]) -> List[Color]: var lab_count = len(labs) var cols = List[Color](capacity=lab_count) for _ in range(lab_count): cols.append(Color(0.0, 0.0, 0.0)) for i in range(lab_count): cols[i] = lab(labs[i].L, labs[i].A, labs[i].B) return cols alias CheckColorFn = fn (l: Float64, a: Float64, b: Float64) -> Bool @value struct SoftPaletteSettings: # A fntion which can be used to restrict the allowed color-space. var check_color: Optional[CheckColorFn] # The higher, the better quality but the slower. Usually two figures. var iterations: Int # Use up to 160000 or 8000 samples of the L*a*b* space (and thus calls to CheckColor). # Set this to true only if your CheckColor shapes the Lab space weirdly. var many_samples: Bool # That's faster than using colorful's DistanceLab since we would have to # convert back and forth for that. Here is no conversion. fn lab_dist(lab1: lab_t, lab2: lab_t) -> Float64: return math.sqrt(sq(lab1.L - lab2.L) + sq(lab1.A - lab2.A) + sq(lab1.B - lab2.B)) # A wrapper which uses common parameters. fn soft_palette(colors_count: Int) raises -> List[Color]: return soft_palette_ex(colors_count, SoftPaletteSettings(None, 50, False)) alias LAB_DELTA = 1e-6 fn lab_eq(lab1: lab_t, lab2: lab_t) -> Bool: return abs(lab1.L - lab2.L) < LAB_DELTA and abs(lab1.A - lab2.A) < LAB_DELTA and abs(lab1.B - lab2.B) < LAB_DELTA fn soft_palette_ex(colors_count: Int, settings: SoftPaletteSettings) raises -> List[Color]: """Yeah, windows-stype Foo, FooEx, screw you golang... Uses K-means to cluster the color-space and return the means of the clusters as a new palette of distinctive colors. Falls back to K-medoid if the mean happens to fall outside of the color-space, which can only happen if you specify a CheckColor fntion.""" # Checks whether it's a valid RGB and also fulfills the potentially provided constraint. @always_inline fn check(col: lab_t) -> Bool: var c = lab(col.L, col.A, col.B) return c.is_valid() and settings.check_color.value()[](col.L, col.A, col.B) # Sample the color space. These will be the points k-means is run on. var dl = 0.05 var dab = 0.1 if settings.many_samples: dl = 0.01 dab = 0.05 var samples = List[lab_t](capacity=int(1.0 / dl * 2.0 / dab * 2.0 / dab)) var l = 0.0 while l <= 1.0: var a = -1.0 while a <= 1.0: var b = -1.0 while b <= 1.0: var labt = lab_t(l, a, b) if check(labt): samples.append(labt) b += dab a += dab l += dl # That would cause some infinite loops down there... if len(samples) < colors_count: raise Error( String("palettegen: more colors requested ") + str(colors_count) + " than samples available " + str(len(samples)) + " Your requested color count may be wrong, you might want to use many samples or your constraint fntion" " makes the valid color space too small" ) elif len(samples) == colors_count: return labs_2_cols(samples) # Oops? # We take the initial means out of the samples, so they are in fact medoids. # This helps us avoid infinite loops or arbitrary cutoffs with too restrictive constraints. var means = List[lab_t](capacity=colors_count) for _ in range(colors_count): means.append(lab_t(0.0, 0.0, 0.0)) var i = 0 while i < colors_count: i += 1 means[i] = samples[int(random_si64(0, len(samples)))] while in_stack(means, i, means[i]): means[i] = samples[int(random_si64(0, len(samples)))] var clusters = List[Int](capacity=len(samples)) for _ in range(len(samples)): clusters.append(0) var samples_used = List[Bool](capacity=len(samples)) for _ in range(len(samples)): samples_used.append(False) # The actual k-means/medoid iterations i = 0 while i < settings.iterations: # Reassing the samples to clusters, i.e. to their closest mean. # By the way, also check if any sample is used as a medoid and if so, mark that. for j in range(len(samples)): samples_used[j] = False var mindist = inf[DType.float64]() for k in range(len(means)): var dist = lab_dist(samples[j], means[k]) if dist < mindist: mindist = dist clusters[j] = k # Mark samples which are used as a medoid. if lab_eq(samples[j], means[k]): samples_used[i] = True # Compute new means according to the samples. for k in range(len(means)): # The new mean is the average of all samples belonging to it.. var nsamples = 0 var newmean = lab_t(0.0, 0.0, 0.0) for j in range(len(samples)): if clusters[j] == k: nsamples += 1 newmean.L += samples[j].L newmean.A += samples[j].A newmean.B += samples[j].B if nsamples > 0: newmean.L /= Float64(nsamples) newmean.A /= Float64(nsamples) newmean.B /= Float64(nsamples) else: # That mean doesn't have any samples? Get a new mean from the sample list! var inewmean = int(random_si64(0, len(samples_used))) while samples_used[inewmean]: inewmean = int(random_si64(0, len(samples_used))) newmean = samples[inewmean] samples_used[inewmean] = True # But now we still need to check whether the new mean is an allowed color. if nsamples > 0 and check(newmean): # It does, life's good (TM) means[k] = newmean else: # New mean isn't an allowed color or doesn't have any samples! # Switch to medoid mode and pick the closest (unused) sample. # This should always find something thanks to len(samples) >= colors_count var mindist = inf[DType.float64]() for l in range(len(samples)): if not samples_used[l]: var dist = lab_dist(samples[l], newmean) if dist < mindist: mindist = dist newmean = samples[l] i += 1 return labs_2_cols(means) --- external/hue/sort.mojo --- # # An element represents a single element of a set. It is used to # # implement a disjoint-set forest. # type element struct: # parent *element # Parent element # rank int # Rank (approximate depth) of the subtree with this element as root # # newElement creates a singleton set and returns its sole element. # fn newElement() *element: # s = &element{ # s.parent = s # return s # # find returns an arbitrary element of a set when invoked on any element of # # the set, The important feature is that it returns the same value when # # invoked on any element of the set. Consequently, it can be used to test if # # two elements belong to the same set. # fn (e *element) find() *element: # for e.parent != e: # e.parent = e.parent.parent # e = e.parent # return e # # union establishes the union of two sets when given an element from each set. # # Afterwards, the original sets no longer exist as separate entities. # fn union(e1, e2 *element): # # Ensure the two elements aren't already part of the same union. # e1Root = e1.find() # e2Root = e2.find() # if e1Root == e2Root: # return # # Create a union by making the shorter tree point to the root of the # # larger tree. # switch: # case e1Root.rank < e2Root.rank: # e1Root.parent = e2Root # case e1Root.rank > e2Root.rank: # e2Root.parent = e1Root # default: # e2Root.parent = e1Root # e1Root.rank++ # # An edgeIdxs describes an edge in a graph or tree. The vertices in the edge # # are indexes into a list of Color values. # type edgeIdxs [2]int # # An edgeDistance is a map from an edge (pair of indices) to a distance # # between the two vertices. # type edgeDistance map[edgeIdxs]float64 # # allToAllDistancesCIEDE2000 computes the CIEDE2000 distance between each pair of # # colors. It returns a map from a pair of indices (u, v) with u < v to a # # distance. # fn allToAllDistancesCIEDE2000(cs []Color) edgeDistance: # nc = len(cs) # m = make(edgeDistance, nc*nc) # for u = 0; u < nc-1; u++: # for v = u + 1; v < nc; v++: # m[edgeIdxs{u, v] = cs[u].DistanceCIEDE2000(cs[v]) # return m # # sortEdges sorts all edges in a distance map by increasing vertex distance. # fn sortEdges(m edgeDistance) []edgeIdxs: # es = make([]edgeIdxs, 0, len(m)) # for uv = range m: # es = append(es, uv) # sort.Slice(es, fn(i, j int) bool: # return m[es[i]] < m[es[j]] # ) # return es # # minSpanTree computes a minimum spanning tree from a vertex count and a # # distance-sorted edge list. It returns the subset of edges that belong to # # the tree, including both (u, v) and (v, u) for each edge. # fn minSpanTree(nc int, es []edgeIdxs) map[edgeIdxs]struct{: # # Start with each vertex in its own set. # elts = make([]*element, nc) # for i = range elts: # elts[i] = newElement() # # Run Kruskal's algorithm to construct a minimal spanning tree. # mst = make(map[edgeIdxs]struct{, nc) # for _, uv = range es: # u, v = uv[0], uv[1] # if elts[u].find() == elts[v].find(): # continue # Same set: edge would introduce a cycle. # mst[uv] = struct{{ # mst[edgeIdxs{v, u] = struct{{ # union(elts[u], elts[v]) # return mst # # traverseMST walks a minimum spanning tree in prefix order. # fn traverseMST(mst map[edgeIdxs]struct{, root int) []int: # # Compute a list of neighbors for each vertex. # neighs = make(map[int][]int, len(mst)) # for uv = range mst: # u, v = uv[0], uv[1] # neighs[u] = append(neighs[u], v) # for u, vs = range neighs: # sort.Ints(vs) # copy(neighs[u], vs) # # Walk the tree from a given vertex. # order = make([]int, 0, len(neighs)) # visited = make(map[int]bool, len(neighs)) # var walkFrom fn(int) # walkFrom = fn(r int): # # Visit the starting vertex. # order = append(order, r) # visited[r] = true # # Recursively visit each child in turn. # for _, c = range neighs[r]: # if !visited[c]: # walkFrom(c) # walkFrom(root) # return order # # Sorted sorts a list of Color values. Sorting is not a well-defined operation # # for colors so the intention here primarily is to order colors so that the # # transition from one to the next is fairly smooth. # fn Sorted(cs []Color) []Color: # # Do nothing in trivial cases. # newCs = make([]Color, len(cs)) # if len(cs) < 2: # copy(newCs, cs) # return newCs # # Compute the distance from each color to every other color. # dists = allToAllDistancesCIEDE2000(cs) # # Produce a list of edges in increasing order of the distance between # # their vertices. # edges = sortEdges(dists) # # Construct a minimum spanning tree from the list of edges. # mst = minSpanTree(len(cs), edges) # # Find the darkest color in the list. # var black Color # var dIdx int # Index of darkest color # light = math.MaxFloat64 # Lightness of darkest color (distance from black) # for i, c = range cs: # d = black.DistanceCIEDE2000(c) # if d < light: # dIdx = i # light = d # # Traverse the tree starting from the darkest color. # idxs = traverseMST(mst, dIdx) # # Convert the index list to a list of colors, overwriting the input. # for i, idx = range idxs: # newCs[i] = cs[idx] # return newCs --- external/hue/warm_palettegen.mojo --- from random import randn_float64 from .color import hsv, lab_to_hcl from .soft_palettegen import soft_palette_ex, SoftPaletteSettings fn fast_warm_palette(colors_count: Int) -> List[Color]: """Uses the hsv color space to generate colors with similar S,V but distributed evenly along their Hue. This is fast but not always pretty. If you've got time to spare, use Lab (the non-fast below). Args: colors_count: The number of colors to generate. Returns: A list of colors. """ var colors = List[Color](capacity=colors_count) for _ in range(colors_count): colors.append(Color(0, 0, 0)) var i = 0 while i < colors_count: colors[i] = hsv( Float64(i) * (360.0 / Float64(colors_count)), 0.55 + randn_float64() * 0.2, 0.35 + randn_float64() * 0.2 ) i += 1 return colors fn warm_palette(colors_count: Int) raises -> List[Color]: fn warmy(l: Float64, a: Float64, b: Float64) -> Bool: var h: Float64 var c: Float64 var l_new: Float64 h, c, l_new = lab_to_hcl(l, a, b) return 0.1 <= c and c <= 0.4 and 0.2 <= l and l <= 0.5 return soft_palette_ex(colors_count, SoftPaletteSettings(warmy, 50, True)) --- external/mist/__init__.mojo --- from .color import Color from .style import TerminalStyle, new_style from .profile import ( Profile, ASCII, ANSI, ANSI256, TRUE_COLOR, ASCII_PROFILE, ANSI_PROFILE, ANSI256_PROFILE, TRUE_COLOR_PROFILE, AnyColor, NoColor, ) from .renderers import ( render_as_color, render_with_background_color, red, green, blue, yellow, cyan, gray, magenta, red_background, green_background, blue_background, yellow_background, cyan_background, gray_background, magenta_background, bold, italic, underline, faint, crossout, overline, ) --- external/mist/ansi_colors.mojo --- # RGB values of ANSI colors (0-255). alias ANSI_HEX_CODES = List[String]( "#000000", "#000000", "#800000", "#008000", "#808000", "#000080", "#800080", "#008080", "#c0c0c0", "#808080", "#ff0000", "#00ff00", "#ffff00", "#0000ff", "#ff00ff", "#00ffff", "#ffffff", "#000000", "#00005f", "#000087", "#0000af", "#0000d7", "#0000ff", "#005f00", "#005f5f", "#005f87", "#005faf", "#005fd7", "#005fff", "#008700", "#00875f", "#008787", "#0087af", "#0087d7", "#0087ff", "#00af00", "#00af5f", "#00af87", "#00afaf", "#00afd7", "#00afff", "#00d700", "#00d75f", "#00d787", "#00d7af", "#00d7d7", "#00d7ff", "#00ff00", "#00ff5f", "#00ff87", "#00ffaf", "#00ffd7", "#00ffff", "#5f0000", "#5f005f", "#5f0087", "#5f00af", "#5f00d7", "#5f00ff", "#5f5f00", "#5f5f5f", "#5f5f87", "#5f5faf", "#5f5fd7", "#5f5fff", "#5f8700", "#5f875f", "#5f8787", "#5f87af", "#5f87d7", "#5f87ff", "#5faf00", "#5faf5f", "#5faf87", "#5fafaf", "#5fafd7", "#5fafff", "#5fd700", "#5fd75f", "#5fd787", "#5fd7af", "#5fd7d7", "#5fd7ff", "#5fff00", "#5fff5f", "#5fff87", "#5fffaf", "#5fffd7", "#5fffff", "#870000", "#87005f", "#870087", "#8700af", "#8700d7", "#8700ff", "#875f00", "#875f5f", "#875f87", "#875faf", "#875fd7", "#875fff", "#878700", "#87875f", "#878787", "#8787af", "#8787d7", "#8787ff", "#87af00", "#87af5f", "#87af87", "#87afaf", "#87afd7", "#87afff", "#87d700", "#87d75f", "#87d787", "#87d7af", "#87d7d7", "#87d7ff", "#87ff00", "#87ff5f", "#87ff87", "#87ffaf", "#87ffd7", "#87ffff", "#af0000", "#af005f", "#af0087", "#af00af", "#af00d7", "#af00ff", "#af5f00", "#af5f5f", "#af5f87", "#af5faf", "#af5fd7", "#af5fff", "#af8700", "#af875f", "#af8787", "#af87af", "#af87d7", "#af87ff", "#afaf00", "#afaf5f", "#afaf87", "#afafaf", "#afafd7", "#afafff", "#afd700", "#afd75f", "#afd787", "#afd7af", "#afd7d7", "#afd7ff", "#afff00", "#afff5f", "#afff87", "#afffaf", "#afffd7", "#afffff", "#d70000", "#d7005f", "#d70087", "#d700af", "#d700d7", "#d700ff", "#d75f00", "#d75f5f", "#d75f87", "#d75faf", "#d75fd7", "#d75fff", "#d78700", "#d7875f", "#d78787", "#d787af", "#d787d7", "#d787ff", "#d7af00", "#d7af5f", "#d7af87", "#d7afaf", "#d7afd7", "#d7afff", "#d7d700", "#d7d75f", "#d7d787", "#d7d7af", "#d7d7d7", "#d7d7ff", "#d7ff00", "#d7ff5f", "#d7ff87", "#d7ffaf", "#d7ffd7", "#d7ffff", "#ff0000", "#ff005f", "#ff0087", "#ff00af", "#ff00d7", "#ff00ff", "#ff5f00", "#ff5f5f", "#ff5f87", "#ff5faf", "#ff5fd7", "#ff5fff", "#ff8700", "#ff875f", "#ff8787", "#ff87af", "#ff87d7", "#ff87ff", "#ffaf00", "#ffaf5f", "#ffaf87", "#ffafaf", "#ffafd7", "#ffafff", "#ffd700", "#ffd75f", "#ffd787", "#ffd7af", "#ffd7d7", "#ffd7ff", "#ffff00", "#ffff5f", "#ffff87", "#ffffaf", "#ffffd7", "#ffffff", "#080808", "#121212", "#1c1c1c", "#262626", "#303030", "#3a3a3a", "#444444", "#4e4e4e", "#585858", "#626262", "#6c6c6c", "#767676", "#808080", "#8a8a8a", "#949494", "#9e9e9e", "#a8a8a8", "#b2b2b2", "#bcbcbc", "#c6c6c6", "#d0d0d0", "#dadada", "#e4e4e4", "#eeeeee", ) --- external/mist/color.mojo --- from collections.dict import Dict, KeyElement from utils.variant import Variant import external.hue from external.hue.math import max_float64 from .ansi_colors import ANSI_HEX_CODES alias foreground = "38" alias background = "48" alias AnyColor = Variant[NoColor, ANSIColor, ANSI256Color, RGBColor] trait Equalable: fn __eq__(self: Self, other: Self) -> Bool: ... trait NotEqualable: fn __ne__(self: Self, other: Self) -> Bool: ... trait Color(Movable, Copyable, Equalable, NotEqualable, CollectionElement): fn sequence(self, is_background: Bool) -> String: """Sequence returns the ANSI Sequence for the color.""" ... @value struct NoColor(Color, Stringable): fn __eq__(self, other: NoColor) -> Bool: return True fn __ne__(self, other: NoColor) -> Bool: return False fn sequence(self, is_background: Bool) -> String: return "" fn __str__(self) -> String: """String returns the ANSI Sequence for the color and the text.""" return "" @value struct ANSIColor(Color, Stringable): """ANSIColor is a color (0-15) as defined by the ANSI Standard.""" var value: Int fn __eq__(self, other: ANSIColor) -> Bool: return self.value == other.value fn __ne__(self, other: ANSIColor) -> Bool: return self.value != other.value fn sequence(self, is_background: Bool) -> String: """Returns the ANSI Sequence for the color and the text. Args: is_background: Whether the color is a background color. """ var modifier: Int = 0 if is_background: modifier += 10 if self.value < 8: return str(modifier + self.value + 30) else: return str(modifier + self.value - 8 + 90) fn __str__(self) -> String: """String returns the ANSI Sequence for the color and the text.""" return ANSI_HEX_CODES[self.value] fn convert_to_rgb(self) -> hue.Color: """Converts an ANSI color to hue.Color by looking up the hex value and converting it.""" var hex: String = ANSI_HEX_CODES[self.value] return hex_to_rgb(hex) @value struct ANSI256Color(Color, Stringable): """ANSI256Color is a color (16-255) as defined by the ANSI Standard.""" var value: Int fn __eq__(self, other: ANSI256Color) -> Bool: return self.value == other.value fn __ne__(self, other: ANSI256Color) -> Bool: return self.value != other.value fn sequence(self, is_background: Bool) -> String: """Returns the ANSI Sequence for the color and the text. Args: is_background: Whether the color is a background color. """ var prefix: String = foreground if is_background: prefix = background return prefix + ";5;" + str(self.value) fn __str__(self) -> String: """String returns the ANSI Sequence for the color and the text.""" return ANSI_HEX_CODES[self.value] fn convert_to_rgb(self) -> hue.Color: """Converts an ANSI color to hue.Color by looking up the hex value and converting it.""" var hex: String = ANSI_HEX_CODES[self.value] return hex_to_rgb(hex) fn convert_base16_to_base10(value: String) -> Int: """Converts a base 16 number to base 10. https://www.catalyst2.com/knowledgebase/dictionary/hexadecimal-base-16-numbers/#:~:text=To%20convert%20the%20hex%20number,16%20%2B%200%20%3D%2016). Args: value: Hexadecimal number. Returns: Base 10 number. """ var mapping = Dict[String, Int]() mapping["0"] = 0 mapping["1"] = 1 mapping["2"] = 2 mapping["3"] = 3 mapping["4"] = 4 mapping["5"] = 5 mapping["6"] = 6 mapping["7"] = 7 mapping["8"] = 8 mapping["9"] = 9 mapping["a"] = 10 mapping["b"] = 11 mapping["c"] = 12 mapping["d"] = 13 mapping["e"] = 14 mapping["f"] = 15 # We assume mapping.find always returns a value considering the value passed in is a valid hex value # and the mapping has all the values. var length = len(value) var total: Int = 0 for i in range(length - 1, -1, -1): var exponent = length - 1 - i total += mapping.find(value[i]).value()[] * (16**exponent) return total fn hex_to_rgb(value: String) -> hue.Color: """Converts a hex color to hue.Color. Args: value: Hex color value. Returns: Color. """ var hex = value[1:] alias indices = List[Int](0, 2, 4) var results = List[Int]() for i in indices: results.append(convert_base16_to_base10(hex[i[] : i[] + 2])) return hue.Color(results[0], results[1], results[2]) @value struct RGBColor(Color): """RGBColor is a hex-encoded color, e.g. '#abcdef'.""" var value: String fn __init__(inout self, value: String): self.value = value.lower() fn __eq__(self, other: RGBColor) -> Bool: return self.value == other.value fn __ne__(self, other: RGBColor) -> Bool: return self.value != other.value fn sequence(self, is_background: Bool) -> String: """Returns the ANSI Sequence for the color and the text. Args: is_background: Whether the color is a background color. """ var rgb = hex_to_rgb(self.value) var prefix = foreground if is_background: prefix = background return prefix + String(";2;") + str(int(rgb.R)) + ";" + str(int(rgb.G)) + ";" + str(int(rgb.B)) fn convert_to_rgb(self) -> hue.Color: """Converts the Hex code value to hue.Color.""" return hex_to_rgb(self.value) fn ansi256_to_ansi(value: Int) -> ANSIColor: """Converts an ANSI256 color to an ANSI color. Args: value: ANSI256 color value. """ var r: Int = 0 var md = max_float64 var h = hex_to_rgb(ANSI_HEX_CODES[value]) var i: Int = 0 while i <= 15: var hb = hex_to_rgb(ANSI_HEX_CODES[i]) var d = h.distance_HSLuv(hb) if d < md: md = d r = i i += 1 return ANSIColor(r) fn v2ci(value: Float64) -> Int: if value < 48: return 0 elif value < 115: return 1 else: return int((value - 35) / 40) fn hex_to_ansi256(color: hue.Color) -> ANSI256Color: """Converts a hex code to a ANSI256 color. Args: color: Hex code color from hue.Color. """ # Calculate the nearest 0-based color index at 16..231 # Originally had * 255 in each of these var r: Float64 = v2ci(color.R) # 0..5 each var g: Float64 = v2ci(color.G) var b: Float64 = v2ci(color.B) var ci: Int = int((36 * r) + (6 * g) + b) # 0..215 # Calculate the represented colors back from the index alias i2cv = InlineArray[Int, 6](0, 0x5F, 0x87, 0xAF, 0xD7, 0xFF) var cr = i2cv[int(r)] # r/g/b, 0..255 each var cg = i2cv[int(g)] var cb = i2cv[int(b)] # Calculate the nearest 0-based gray index at 232..255 var gray_index: Int var average = (r + g + b) / 3 if average > 238: gray_index = 23 else: gray_index = int((average - 3) / 10) # 0..23 var gv = 8 + 10 * gray_index # same value for r/g/b, 0..255 # Return the one which is nearer to the original input rgb value # Originall had / 255.0 for r, g, and b in each of these var c2 = hue.Color(cr, cg, cb) var g2 = hue.Color(gv, gv, gv) var color_dist = color.distance_HSLuv(c2) var gray_dist = color.distance_HSLuv(g2) if color_dist <= gray_dist: return ANSI256Color(16 + ci) return ANSI256Color(232 + gray_index) --- external/mist/hyperlink.mojo --- from .style import osc, st fn hyperlink(link: String, name: String) -> String: """Creates a hyperlink using OSC8. Args: link: The URL to link to. name: The text to display. Returns: The hyperlink text. """ return osc + "8;;" + link + st + name + osc + "8;;" + st --- external/mist/notification.mojo --- from .style import osc, st fn notify(title: String, body: String): """Sends a notification to the terminal. Args: title: The title of the notification. body: The body of the notification. """ print(osc + "777;notify;" + title + ";" + body + st, end="") --- external/mist/profile.mojo --- import os from .color import ( NoColor, ANSIColor, ANSI256Color, RGBColor, AnyColor, hex_to_ansi256, ansi256_to_ansi, hex_to_rgb, ) alias TRUE_COLOR: Int = 0 alias ANSI256: Int = 1 alias ANSI: Int = 2 alias ASCII: Int = 3 alias TRUE_COLOR_PROFILE = Profile(TRUE_COLOR) alias ANSI256_PROFILE = Profile(ANSI256) alias ANSI_PROFILE = Profile(ANSI) alias ASCII_PROFILE = Profile(ASCII) # TODO: UNIX systems only for now. Need to add Windows, POSIX, and SOLARIS support. fn get_color_profile() -> Profile: """Queries the terminal to determine the color profile it supports. ASCII, ANSI, ANSI256, or TRUE_COLOR. """ # if not o.isTTY(): # return Ascii if os.getenv("GOOGLE_CLOUD_SHELL", "false") == "true": return Profile(TRUE_COLOR) var term = os.getenv("TERM").lower() var color_term = os.getenv("COLORTERM").lower() # COLORTERM is used by some terminals to indicate TRUE_COLOR support. if color_term == "24bit": pass elif color_term == "truecolor": if term.startswith("screen"): # tmux supports TRUE_COLOR, screen only ANSI256 if os.getenv("TERM_PROGRAM") != "tmux": return Profile(ANSI256) return Profile(TRUE_COLOR) elif color_term == "yes": pass elif color_term == "true": return Profile(ANSI256) # TERM is used by most terminals to indicate color support. if term == "xterm-kitty" or term == "wezterm" or term == "xterm-ghostty": return Profile(TRUE_COLOR) elif term == "linux": return Profile(ANSI) if "256color" in term: return Profile(ANSI256) if "color" in term: return Profile(ANSI) if "ansi" in term: return Profile(ANSI) return Profile(ASCII) @value struct Profile: alias valid = InlineArray[Int, 4](TRUE_COLOR, ANSI256, ANSI, ASCII) var value: Int fn __init__(inout self, value: Int) -> None: """ Initialize a new profile with the given profile type. Args: value: The setting to use for this profile. Valid values: [TRUE_COLOR, ANSI256, ANSI, ASCII]. """ if value not in Self.valid: self.value = TRUE_COLOR return self.value = value fn __init__(inout self) -> None: """ Initialize a new profile with the given profile type. """ self = get_color_profile() fn convert(self, color: AnyColor) -> AnyColor: """Degrades a color based on the terminal profile. Args: color: The color to convert to the current profile. """ if self.value == ASCII: return NoColor() if color.isa[NoColor](): return color[NoColor] elif color.isa[ANSIColor](): return color[ANSIColor] elif color.isa[ANSI256Color](): if self.value == ANSI: return ansi256_to_ansi(color[ANSIColor].value) return color[ANSI256Color] elif color.isa[RGBColor](): var h = hex_to_rgb(color[RGBColor].value) if self.value != TRUE_COLOR: var ansi256 = hex_to_ansi256(h) if self.value == ANSI: return ansi256_to_ansi(ansi256.value) return ansi256 return color[RGBColor] # If it somehow gets here, just return No Color until I can figure out how to just return whatever color was passed in. return color[NoColor] fn color(self, value: String) -> AnyColor: """Color creates a Color from a string. Valid inputs are hex colors, as well as ANSI color codes (0-15, 16-255). If an invalid input is passed in, NoColor() is returned which will not apply any coloring. Args: value: The string to convert to a color. """ if len(value) == 0: return NoColor() if self.value == ASCII: return NoColor() if value[0] == "#": var c = RGBColor(value) return self.convert(c) else: var i = 0 try: i = atol(value) except e: return NoColor() if i < 16: var c = ANSIColor(i) return self.convert(c) elif i < 256: var c = ANSI256Color(i) return self.convert(c) return NoColor() --- external/mist/renderers.mojo --- from .style import TerminalStyle from .profile import Profile alias RED = "#E88388" alias GREEN = "#A8CC8C" alias YELLOW = "#DBAB79" alias BLUE = "#71BEF2" alias MAGENTA = "#D290E4" alias CYAN = "#66C2CD" alias GRAY = "#B9BFCA" # Convenience functions for quick style application fn render_as_color(text: String, color: String) -> String: var profile = Profile() return TerminalStyle.new().foreground(profile.color(color)).render(text) fn red(text: String) -> String: """Apply red color to the text.""" return render_as_color(text, RED) fn green(text: String) -> String: """Apply green color to the text.""" return render_as_color(text, GREEN) fn yellow(text: String) -> String: """Apply yellow color to the text.""" return render_as_color(text, YELLOW) fn blue(text: String) -> String: """Apply blue color to the text.""" return render_as_color(text, BLUE) fn magenta(text: String) -> String: """Apply magenta color to the text.""" return render_as_color(text, MAGENTA) fn cyan(text: String) -> String: """Apply cyan color to the text.""" return render_as_color(text, CYAN) fn gray(text: String) -> String: """Apply gray color to the text.""" return render_as_color(text, GRAY) fn render_with_background_color(text: String, color: String) -> String: var profile = Profile() return TerminalStyle.new().background(profile.color(color)).render(text) fn red_background(text: String) -> String: """Apply red background color to the text.""" return render_with_background_color(text, RED) fn green_background(text: String) -> String: """Apply green background color to the text.""" return render_with_background_color(text, GREEN) fn yellow_background(text: String) -> String: """Apply yellow background color to the text.""" return render_with_background_color(text, YELLOW) fn blue_background(text: String) -> String: """Apply blue background color to the text.""" return render_with_background_color(text, BLUE) fn magenta_background(text: String) -> String: """Apply magenta background color to the text.""" return render_with_background_color(text, MAGENTA) fn cyan_background(text: String) -> String: """Apply cyan background color to the text.""" return render_with_background_color(text, CYAN) fn gray_background(text: String) -> String: """Apply gray background color to the text.""" return render_with_background_color(text, GRAY) fn bold(text: String) -> String: return TerminalStyle.new().bold().render(text) fn faint(text: String) -> String: return TerminalStyle.new().faint().render(text) fn italic(text: String) -> String: return TerminalStyle.new().italic().render(text) fn underline(text: String) -> String: return TerminalStyle.new().underline().render(text) fn overline(text: String) -> String: return TerminalStyle.new().overline().render(text) fn crossout(text: String) -> String: return TerminalStyle.new().crossout().render(text) --- external/mist/screen.mojo --- from external.gojo.fmt import sprintf from .style import bel, csi, reset, osc from .color import AnyColor, NoColor, ANSIColor, ANSI256Color, RGBColor # Sequence definitions. ## Cursor positioning. alias cursor_up_seq = "%dA" alias cursor_down_seq = "%dB" alias cursor_forward_seq = "%dC" alias cursor_back_seq = "%dD" alias cursor_next_line_seq = "%dE" alias cursor_previous_line_seq = "%dF" alias cursor_horizontal_seq = "%dG" alias cursor_position_seq = "%d;%dH" alias erase_display_seq = "%dJ" alias erase_line_seq = "%dK" alias scroll_up_seq = "%dS" alias scroll_down_seq = "%dT" alias save_cursor_position_seq = "s" alias restore_cursor_position_seq = "u" alias change_scrolling_region_seq = "%d;%dr" alias insert_line_seq = "%dL" alias delete_line_seq = "%dM" ## Explicit values for EraseLineSeq. alias erase_line_right_seq = "0K" alias erase_line_left_seq = "1K" alias erase_entire_line_seq = "2K" ## Mouse alias enable_mouse_press_seq = "?9h" # press only (X10) alias disable_mouse_press_seq = "?9l" alias enable_mouse_seq = "?1000h" # press, release, wheel alias disable_mouse_seq = "?1000l" alias enable_mouse_hilite_seq = "?1001h" # highlight alias disable_mouse_hilite_seq = "?1001l" alias enable_mouse_cell_motion_seq = "?1002h" # press, release, move on pressed, wheel alias disable_mouse_cell_motion_seq = "?1002l" alias enable_mouse_all_motion_seq = "?1003h" # press, release, move, wheel alias disable_mouse_all_motion_seq = "?1003l" alias enable_mouse_extended_mode_seq = "?1006h" # press, release, move, wheel, extended coordinates alias disable_mouse_extended_mode_seq = "?1006l" alias enable_mouse_pixels_mode_seq = "?1016h" # press, release, move, wheel, extended pixel coordinates alias disable_mouse_pixels_mode_seq = "?1016l" ## Screen alias restore_screen_seq = "?47l" alias save_screen_seq = "?47h" alias alt_screen_seq = "?1049h" alias exit_alt_screen_seq = "?1049l" ## Bracketed paste. ## https:#en.wikipedia.org/wiki/Bracketed-paste alias enable_bracketed_paste_seq = "?2004h" alias disable_bracketed_paste_seq = "?2004l" alias start_bracketed_paste_seq = "200~" alias end_bracketed_paste_seq = "201~" ## Session alias set_window_title_seq = "2;%s" + bel alias set_foreground_color_seq = "10;%s" + bel alias set_background_color_seq = "11;%s" + bel alias set_cursor_color_seq = "12;%s" + bel alias show_cursor_seq = "?25h" alias hide_cursor_seq = "?25l" fn __string__mul__(input_string: String, n: Int) -> String: var result: String = "" for _ in range(n): result += input_string return result fn reset_terminal(): """Reset the terminal to its default style, removing any active styles.""" print(csi + reset + "m", end="") fn set_foreground_color(color: AnyColor): """Sets the default foreground color. Args: color: The color to set. """ var c: String = "" if color.isa[ANSIColor](): c = color[ANSIColor].sequence(False) elif color.isa[ANSI256Color](): c = color[ANSI256Color].sequence(False) elif color.isa[RGBColor](): c = color[RGBColor].sequence(False) print(osc + set_foreground_color_seq, c, end="") fn set_background_color(color: AnyColor): """Sets the default background color. Args: color: The color to set. """ var c: String = "" if color.isa[NoColor](): pass elif color.isa[ANSIColor](): c = color[ANSIColor].sequence(True) elif color.isa[ANSI256Color](): c = color[ANSI256Color].sequence(True) elif color.isa[RGBColor](): c = color[RGBColor].sequence(True) print(osc + set_background_color_seq, c, end="") fn set_cursor_color(color: AnyColor): """Sets the cursor color. Args: color: The color to set. """ var c: String = "" if color.isa[NoColor](): pass elif color.isa[ANSIColor](): c = color[ANSIColor].sequence(True) elif color.isa[ANSI256Color](): c = color[ANSI256Color].sequence(True) elif color.isa[RGBColor](): c = color[RGBColor].sequence(True) print(osc + set_cursor_color_seq, c, end="") fn restore_screen(): """Restores a previously saved screen state.""" print(csi + restore_screen_seq, end="") fn save_screen(): """Saves the screen state.""" print(csi + save_screen_seq, end="") fn alt_screen(): """Switches to the alternate screen buffer. The former view can be restored with ExitAltScreen().""" print(csi + alt_screen_seq, end="") fn exit_alt_screen(): """Exits the alternate screen buffer and returns to the former terminal view.""" print(csi + exit_alt_screen_seq, end="") fn clear_screen(): """Clears the visible portion of the terminal.""" print(sprintf(csi + erase_display_seq, UInt16(2)), end="") move_cursor(1, 1) fn move_cursor(row: UInt16, column: Int): """Moves the cursor to a given position. Args: row: The row to move to. column: The column to move to. """ print(sprintf(csi + cursor_position_seq, row, column), end="") fn hide_cursor(): """TODO: Show and Hide cursor don't seem to work ATM. HideCursor hides the cursor.""" print(csi + hide_cursor_seq, end="") fn show_cursor(): """Shows the cursor.""" print(csi + show_cursor_seq, end="") fn save_cursor_position(): """Saves the cursor position.""" print(csi + save_cursor_position_seq, end="") fn restore_cursor_position(): """Restores a saved cursor position.""" print(csi + restore_cursor_position_seq, end="") fn cursor_up(n: Int): """Moves the cursor up a given number of lines. Args: n: The number of lines to move up. """ print(sprintf(csi + cursor_up_seq, n), end="") fn cursor_down(n: Int): """Moves the cursor down a given number of lines. Args: n: The number of lines to move down. """ print(sprintf(csi + cursor_down_seq, n), end="") fn cursor_forward(n: Int): """Moves the cursor up a given number of lines. Args: n: The number of lines to move forward. """ print(sprintf(csi + cursor_forward_seq, n), end="") fn cursor_back(n: Int): """Moves the cursor backwards a given number of cells. Args: n: The number of cells to move back. """ print(sprintf(csi + cursor_back_seq, n), end="") fn cursor_next_line(n: Int): """Moves the cursor down a given number of lines and places it at the beginning of the line. Args: n: The number of lines to move down. """ print(sprintf(csi + cursor_next_line_seq, n), end="") fn cursor_prev_line(n: Int): """Moves the cursor up a given number of lines and places it at the beginning of the line. Args: n: The number of lines to move back. """ print(sprintf(csi + cursor_previous_line_seq, n), end="") fn clear_line(): """Clears the current line.""" print(csi + erase_entire_line_seq, end="") fn clear_line_left(): """Clears the line to the left of the cursor.""" print(csi + erase_line_left_seq, end="") fn clear_line_right(): """Clears the line to the right of the cursor.""" print(csi + erase_line_right_seq, end="") fn clear_lines(n: Int): """Clears a given number of lines. Args: n: The number of lines to clear. """ var clear_line = sprintf(csi + erase_line_seq, UInt16(2)) var cursor_up = sprintf(csi + cursor_up_seq, UInt16(1)) var movement = __string__mul__(cursor_up + clear_line, n) print(clear_line + movement, end="") fn change_scrolling_region(top: UInt16, bottom: UInt16): """Sets the scrolling region of the terminal. Args: top: The top of the scrolling region. bottom: The bottom of the scrolling region. """ print(sprintf(csi + change_scrolling_region_seq, top, bottom), end="") fn insert_lines(n: Int): """Inserts the given number of lines at the top of the scrollable region, pushing lines below down. Args: n: The number of lines to insert. """ print(sprintf(csi + insert_line_seq, n), end="") fn delete_lines(n: Int): """Deletes the given number of lines, pulling any lines in the scrollable region below up. Args: n: The number of lines to delete. """ print(sprintf(csi + delete_line_seq, n), end="") fn enable_mouse_press(): """Enables X10 mouse mode. Button press events are sent only.""" print(csi + enable_mouse_press_seq, end="") fn disable_mouse_press(): """Disables X10 mouse mode.""" print(csi + disable_mouse_press_seq, end="") fn enable_mouse(): """Enables Mouse Tracking mode.""" print(csi + enable_mouse_seq, end="") fn disable_mouse(): """Disables Mouse Tracking mode.""" print(csi + disable_mouse_seq, end="") fn enable_mouse_hilite(): """Enables Hilite Mouse Tracking mode.""" print(csi + enable_mouse_hilite_seq, end="") fn disable_mouse_hilite(): """Disables Hilite Mouse Tracking mode.""" print(csi + disable_mouse_hilite_seq, end="") fn enable_mouse_cell_motion(): """Enables Cell Motion Mouse Tracking mode.""" print(csi + enable_mouse_cell_motion_seq, end="") fn disable_mouse_cell_motion(): """Disables Cell Motion Mouse Tracking mode.""" print(csi + disable_mouse_cell_motion_seq, end="") fn enable_mouse_all_motion(): """Enables All Motion Mouse mode.""" print(csi + enable_mouse_all_motion_seq, end="") fn disable_mouse_all_motion(): """Disables All Motion Mouse mode.""" print(csi + disable_mouse_all_motion_seq, end="") fn enable_mouse_extended_mode(): """Enables Extended Mouse mode (SGR). This should be enabled in conjunction with EnableMouseCellMotion, and EnableMouseAllMotion.""" print(csi + enable_mouse_extended_mode_seq, end="") fn disable_mouse_extended_mode(): """Disables Extended Mouse mode (SGR).""" print(csi + disable_mouse_extended_mode_seq, end="") fn enable_mouse_pixels_mode(): """Enables Pixel Motion Mouse mode (SGR-Pixels). This should be enabled in conjunction with EnableMouseCellMotion, and EnableMouseAllMotion.""" print(csi + enable_mouse_pixels_mode_seq, end="") fn disable_mouse_pixels_mode(): """Disables Pixel Motion Mouse mode (SGR-Pixels).""" print(csi + disable_mouse_pixels_mode_seq, end="") fn set_window_title(title: String): """Sets the terminal window title. Args: title: The title to set. """ print(osc + set_window_title_seq, title, end="") fn enable_bracketed_paste(): """Enables bracketed paste.""" print(csi + enable_bracketed_paste_seq, end="") fn disable_bracketed_paste(): """Disables bracketed paste.""" print(csi + disable_bracketed_paste_seq, end="") --- external/mist/style.mojo --- from external.gojo.strings import StringBuilder from .color import ( Color, NoColor, ANSIColor, ANSI256Color, RGBColor, AnyColor, hex_to_rgb, hex_to_ansi256, ansi256_to_ansi, ) from .profile import get_color_profile, ASCII import time # Text formatting sequences alias reset = "0" alias bold = "1" alias faint = "2" alias italic = "3" alias underline = "4" alias blink = "5" alias reverse = "7" alias crossout = "9" alias overline = "53" # ANSI Operations alias escape = chr(27) # Escape character alias bel = "\a" # Bell alias csi = escape + "[" # Control Sequence Introducer alias osc = escape + "]" # Operating System Command alias st = escape + chr(92) # String Terminator - Might not work, haven't tried. 92 should be a raw backslash # clear terminal and return cursor to top left alias clear = escape + "[2J" + escape + "[H" @value struct TerminalStyle: """TerminalStyle stores a list of styles to format text with. These styles are ANSI sequences which modify text (and control the terminal). In reality, these styles are turning visual terminal features on and off around the text it's styling. This struct should be considered immutable and each style added returns a new instance of itself rather than modifying the struct in place. It's recommended to use the `new` static method to create a new instance of TerminalStyle so that you can chain style methods together. Example: ``` from mist import TerminalStyle var style = TerminalStyle.new().foreground("#E88388").render("red") print(style.render("Hello World")) ``` """ var styles: List[String] var profile: Profile @always_inline fn __init__(inout self, profile: Profile, *, styles: List[String] = List[String]()): """Constructs a TerminalStyle. Use new instead of __init__ to chain function calls. Args: profile: The color profile to use for color conversion. styles: A list of ANSI styles to apply to the text. """ self.styles = styles self.profile = profile @always_inline fn __init__(inout self, *, styles: List[String] = List[String]()): """Constructs a TerminalStyle. Use new instead of __init__ to chain function calls. Args: styles: A list of ANSI styles to apply to the text. """ self.styles = styles self.profile = Profile() @staticmethod fn new(profile: Profile, *, styles: List[String] = List[String]()) -> Self: """Constructs a TerminalStyle. Use new instead of __init__ to chain function calls. Args: profile: The color profile to use for color conversion. styles: A list of ANSI styles to apply to the text. """ return Self(profile, styles=styles) @staticmethod fn new(styles: List[String] = List[String]()) -> Self: """Constructs a TerminalStyle. Use new instead of __init__ to chain function calls. Args: styles: A list of ANSI styles to apply to the text. """ return Self(styles=styles) @always_inline fn copy(self) -> Self: """Creates a deepcopy of Self and returns that. Immutability instead of mutating the object.""" return Self(self.profile, styles=self.get_styles()) @always_inline fn _add_style(self, style: String) -> Self: """Creates a deepcopy of Self, adds a style to it's list of styles, and returns that. Immutability instead of mutating the object. Args: style: The ANSI style to add to the list of styles. """ var new_styles = self.get_styles() new_styles.append(style) return Self(self.profile, styles=new_styles) @always_inline fn get_styles(self) -> List[String]: """Return a deepcopy of the styles list.""" return List[String](self.styles) @always_inline fn bold(self) -> Self: """Makes the text bold when rendered.""" return self._add_style(bold) @always_inline fn faint(self) -> Self: """Makes the text faint when rendered.""" return self._add_style(faint) @always_inline fn italic(self) -> Self: """Makes the text italic when rendered.""" return self._add_style(italic) @always_inline fn underline(self) -> Self: """Makes the text underlined when rendered.""" return self._add_style(underline) @always_inline fn blink(self) -> Self: """Makes the text blink when rendered.""" return self._add_style(blink) @always_inline fn reverse(self) -> Self: """Makes the text have reversed background and foreground colors when rendered.""" return self._add_style(reverse) @always_inline fn crossout(self) -> Self: """Makes the text crossed out when rendered.""" return self._add_style(crossout) @always_inline fn overline(self) -> Self: """Makes the text overlined when rendered.""" return self._add_style(overline) @always_inline fn background(self, color: AnyColor) -> Self: """Set the background color of the text when it's rendered. Args: color: The color value to set the background to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new TerminalStyle with the background color set. """ if color.isa[NoColor](): return Self(self.profile, styles=self.styles) var sequence: String = "" if color.isa[ANSIColor](): var c = color[ANSIColor] sequence = c.sequence(True) elif color.isa[ANSI256Color](): var c = color[ANSI256Color] sequence = c.sequence(True) elif color.isa[RGBColor](): var c = color[RGBColor] sequence = c.sequence(True) return self._add_style(sequence) @always_inline fn background(self, color_value: String) -> Self: """Shorthand for using the style profile to set the background color of the text. Args: color_value: The color value to set the background to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new TerminalStyle with the background color set. """ return self.background(self.profile.color(color_value)) @always_inline fn background(self, color_value: StringLiteral) -> Self: """Shorthand for using the style profile to set the background color of the text. Args: color_value: The color value to set the background to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new TerminalStyle with the background color set. """ return self.background(self.profile.color(color_value)) @always_inline fn foreground(self, color: AnyColor) -> Self: """Set the foreground color of the text. Args: color: The color value to set the foreground to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new TerminalStyle with the foreground color set. """ if color.isa[NoColor](): return Self(self.profile, styles=self.styles) var sequence: String = "" if color.isa[ANSIColor](): var c = color[ANSIColor] sequence = c.sequence(False) elif color.isa[ANSI256Color](): var c = color[ANSI256Color] sequence = c.sequence(False) elif color.isa[RGBColor](): var c = color[RGBColor] sequence = c.sequence(False) return self._add_style(sequence) @always_inline fn foreground(self, color_value: String) -> Self: """Shorthand for using the style profile to set the foreground color of the text. Args: color_value: The color value to set the foreground to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new TerminalStyle with the foreground color set. """ return self.foreground(self.profile.color(color_value)) @always_inline fn foreground(self, color_value: StringLiteral) -> Self: """Shorthand for using the style profile to set the foreground color of the text. Args: color_value: The color value to set the foreground to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new TerminalStyle with the foreground color set. """ return self.foreground(self.profile.color(color_value)) @always_inline fn render(self, text: String) -> String: """Renders text with the styles applied to it. Args: text: The text to render with the styles applied. Returns: The text with the styles applied. """ if self.profile.value == ASCII: return text if len(self.styles) == 0: return text var builder = StringBuilder() _ = builder.write_string(csi) for i in range(len(self.styles)): _ = builder.write_string(";") _ = builder.write_string(self.styles[i]) _ = builder.write_string("m") _ = builder.write_string(text) _ = builder.write_string(csi) _ = builder.write_string(reset) _ = builder.write_string("m") return builder.render() fn new_style() -> TerminalStyle: """Creates a new TerminalStyle with no styles applied. Returns: A new TerminalStyle with the given color profile. """ return TerminalStyle.new() fn new_style(profile: Profile) -> TerminalStyle: """Creates a new TerminalStyle with no styles applied. Args: profile: The color profile to use for color conversion. Returns: A new TerminalStyle with the given color profile. """ return TerminalStyle.new(profile) --- prism/__init__.mojo --- from .command import ( Command, CommandArc, CommandFunction, ArgValidator, ) from .args import no_args, valid_args, arbitrary_args, minimum_n_args, maximum_n_args, exact_args, range_args, match_all from .flag import Flag from .flag_set import FlagSet --- prism/args.mojo --- from memory.arc import Arc from collections.optional import Optional import external.gojo.fmt from .command import CommandArc, ArgValidator fn no_args(command: CommandArc, args: List[String]) -> Optional[String]: """Returns an error if the command has any arguments. Args: command: Reference to the command being executed. args: The arguments to check. """ var cmd = command if len(args) > 0: return fmt.sprintf("The command `%s` does not take any arguments.", cmd[].name) return None fn arbitrary_args(command: CommandArc, args: List[String]) -> Optional[String]: """Never returns an error. Args: command: Reference to the command being executed. args: The arguments to check. """ return None fn minimum_n_args[n: Int]() -> ArgValidator: """Returns an error if there is not at least n arguments. Params: n: The minimum number of arguments. Returns: A function that checks the number of arguments. """ fn less_than_n_args(command: CommandArc, args: List[String]) -> Optional[String]: var cmd = command if len(args) < n: return fmt.sprintf( "The command `%s` accepts at least %d argument(s). Received: %d.", cmd[].name, n, len(args), ) return None return less_than_n_args fn maximum_n_args[n: Int]() -> ArgValidator: """Returns an error if there are more than n arguments. Params: n: The maximum number of arguments. Returns: A function that checks the number of arguments. """ fn more_than_n_args(command: CommandArc, args: List[String]) -> Optional[String]: var cmd = command if len(args) > n: return fmt.sprintf( "The command `%s` accepts at most %d argument(s). Received: %d.", cmd[].name, n, len(args) ) return None return more_than_n_args fn exact_args[n: Int]() -> ArgValidator: """Returns an error if there are not exactly n arguments. Params: n: The number of arguments. Returns: A function that checks the number of arguments. """ fn exactly_n_args(command: CommandArc, args: List[String]) -> Optional[String]: var cmd = command if len(args) != n: return fmt.sprintf( "The command `%s` accepts exactly %d argument(s). Received: %d.", cmd[].name, n, len(args) ) return None return exactly_n_args fn valid_args[valid: List[String]]() -> ArgValidator: """Returns an error if threre are any positional args that are not in the command's valid_args. Params: valid: The valid arguments to check against. """ fn only_valid_args(command: CommandArc, args: List[String]) -> Optional[String]: var cmd = command if len(valid) > 0: for arg in args: if arg[] not in valid: return fmt.sprintf("Invalid argument: `%s`, for the command `%s`.", arg[], cmd[].name) return None return only_valid_args fn range_args[minimum: Int, maximum: Int]() -> ArgValidator: """Returns an error if there are not exactly n arguments. Params: minimum: The minimum number of arguments. maximum: The maximum number of arguments. Returns: A function that checks the number of arguments. """ fn range_n_args(command: CommandArc, args: List[String]) -> Optional[String]: var cmd = command if len(args) < minimum or len(args) > maximum: return fmt.sprintf( "The command `%s`, accepts between %d to %d argument(s). Received: %d.", cmd[].name, minimum, maximum, len(args), ) return None return range_n_args # TODO: Having some issues with varadic list of functions, so using List for now. fn match_all[arg_validators: List[ArgValidator]]() -> ArgValidator: """Returns an error if any of the arg_validators return an error. Params: arg_validators: A list of ArgValidator functions that check the arguments. Returns: A function that checks all the arguments using the arg_validators list.. """ fn match_all_args(command: CommandArc, args: List[String]) -> Optional[String]: for i in range(len(arg_validators)): var error = arg_validators[i](command, args) if error: return error return None return match_all_args fn get_args(arguments: List[String]) -> List[String]: """Parses flags and args from the args passed via the command line and adds them to their appropriate collections. Args: arguments: The arguments passed via the command line. Returns: The arguments that are not flags. """ var args = List[String]() for i in range(len(arguments)): # Argument is not a shorthand or full flag. var argument = arguments[i] if not (argument.startswith("-", 0, 1)): args.append(argument) return args --- prism/command.mojo --- from sys import argv from collections.optional import Optional from memory.arc import Arc import external.gojo.fmt from external.gojo.builtins import panic from external.gojo.strings import StringBuilder from .flag import Flag, get_flags, REQUIRED, REQUIRED_AS_GROUP, ONE_REQUIRED, MUTUALLY_EXCLUSIVE from .flag_set import FlagSet, process_flag_for_group_annotation, validate_flag_groups from .args import arbitrary_args, get_args from .vector import to_string fn get_args_as_list() -> List[String]: """Returns the arguments passed to the executable as a list of strings.""" var args = argv() var args_list = List[String]() var i = 1 while i < len(args): args_list.append(args[i]) i += 1 return args_list fn default_help(command: Arc[Command]) -> String: var cmd = command """Prints the help information for the command.""" var builder = StringBuilder() _ = builder.write_string(cmd[].description) if cmd[].aliases: _ = builder.write_string("\n\nAliases:") _ = builder.write_string(fmt.sprintf("\n %s", to_string(cmd[].aliases))) # Build usage statement arguments depending on the command's children and flags. var full_command = cmd[]._full_command() _ = builder.write_string(fmt.sprintf("\n\nUsage:\n %s%s", full_command, String(" [args]"))) if len(cmd[].children) > 0: _ = builder.write_string(" [command]") if len(cmd[].flags) > 0: _ = builder.write_string(" [flags]") if cmd[].children: _ = builder.write_string("\n\nAvailable commands:") for child in cmd[].children: _ = builder.write_string(fmt.sprintf("\n %s", str(child[][]))) if cmd[].flags.flags: _ = builder.write_string("\n\nAvailable flags:") for flag in cmd[].flags.flags: _ = builder.write_string(fmt.sprintf("\n -%s, --%s %s", flag[].shorthand, flag[].name, flag[].usage)) _ = builder.write_string( fmt.sprintf('\n\nUse "%s [command] --help" for more information about a command.', full_command) ) return str(builder) alias CommandArc = Arc[Command] alias CommandFunction = fn (command: Arc[Command], args: List[String]) -> None alias CommandFunctionErr = fn (command: Arc[Command], args: List[String]) -> Error alias HelpFunction = fn (Arc[Command]) -> String alias ArgValidator = fn (command: Arc[Command], args: List[String]) escaping -> Optional[String] alias ParentVisitorFn = fn (parent: Command) capturing -> None # Set to True to traverse all parents' persistent pre and post run hooks. If False, it'll only run the first match. # If False, starts from the child command and goes up the parent chain. If True, starts from root and goes down. # TODO: For now it's locked to False until file scope variables. alias ENABLE_TRAVERSE_RUN_HOOKS = False fn parse_command_from_args(start: Command) -> (Command, List[String]): var args = get_args_as_list() var number_of_args = len(args) var command = start var children = command.children var leftover_args_start_index = 0 # Start at 1 to start slice at the first remaining arg, not the last child command. for arg in args: for command_ref in children: if command_ref[][].name == arg[] or arg[] in command_ref[][].aliases: command = command_ref[][] children = command.children leftover_args_start_index += 1 break # If the there are more or equivalent args to the index, then there are remaining args to pass to the command. var remaining_args = List[String]() if number_of_args >= leftover_args_start_index: remaining_args = args[leftover_args_start_index:number_of_args] return command, remaining_args # TODO: For parent Arc[Optional[Self]] works but Optional[Arc[Self]] causes compiler issues. @value struct Command(CollectionElement): """A struct representing a command that can be executed from the command line. Args: name: The name of the command. description: The description of the command. arg_validator: The function to validate the arguments passed to the command. valid_args: The valid arguments for the command. run: The function to run when the command is executed. pre_run: The function to run before the command is executed. post_run: The function to run after the command is executed. erroring_run: The function to run when the command is executed that returns an error. erroring_pre_run: The function to run before the command is executed that returns an error. erroring_post_run: The function to run after the command is executed that returns an error. persisting_pre_run: The function to run before the command is executed. This persists to children. persisting_post_run: The function to run after the command is executed. This persists to children. persisting_erroring_pre_run: The function to run before the command is executed that returns an error. This persists to children. persisting_erroring_post_run: The function to run after the command is executed that returns an error. This persists to children. help: The function to generate help text for the command. """ var name: String var description: String # Aliases that can be used instead of the first word in name. var aliases: List[String] # Generates help text. var help: HelpFunction # The group id under which this subcommand is grouped in the 'help' output of its parent. var group_id: String var pre_run: Optional[CommandFunction] var run: Optional[CommandFunction] var post_run: Optional[CommandFunction] var erroring_pre_run: Optional[CommandFunctionErr] var erroring_run: Optional[CommandFunctionErr] var erroring_post_run: Optional[CommandFunctionErr] var persistent_pre_run: Optional[CommandFunction] var persistent_post_run: Optional[CommandFunction] var persistent_erroring_pre_run: Optional[CommandFunctionErr] var persistent_erroring_post_run: Optional[CommandFunctionErr] var arg_validator: ArgValidator var valid_args: List[String] # Local flags for the command. TODO: Use this field to store cached results for local flags. var local_flags: FlagSet # Local flags that also persist to children. var persistent_flags: FlagSet # It is all local, persistent, and inherited flags. var flags: FlagSet # Cached results from self._merge_flags(). var _inherited_flags: FlagSet var children: List[Arc[Self]] var parent: Arc[Optional[Self]] fn __init__( inout self, name: String, description: String, aliases: List[String] = List[String](), valid_args: List[String] = List[String](), run: Optional[CommandFunction] = None, pre_run: Optional[CommandFunction] = None, post_run: Optional[CommandFunction] = None, erroring_run: Optional[CommandFunctionErr] = None, erroring_pre_run: Optional[CommandFunctionErr] = None, erroring_post_run: Optional[CommandFunctionErr] = None, persistent_pre_run: Optional[CommandFunction] = None, persistent_post_run: Optional[CommandFunction] = None, persistent_erroring_pre_run: Optional[CommandFunctionErr] = None, persistent_erroring_post_run: Optional[CommandFunctionErr] = None, help: HelpFunction = default_help, ): if not run and not erroring_run: panic("A command must have a run or erroring_run function.") self.name = name self.description = description self.aliases = aliases self.help = help self.group_id = "" self.pre_run = pre_run self.run = run self.post_run = post_run self.erroring_pre_run = erroring_pre_run self.erroring_run = erroring_run self.erroring_post_run = erroring_post_run self.persistent_pre_run = persistent_pre_run self.persistent_post_run = persistent_post_run self.persistent_erroring_pre_run = persistent_erroring_pre_run self.persistent_erroring_post_run = persistent_erroring_post_run self.arg_validator = arbitrary_args self.valid_args = valid_args self.children = List[Arc[Self]]() self.parent = Arc[Optional[Command]](None) # These need to be mutable so we can add flags to them. self.flags = FlagSet() self.local_flags = FlagSet() self.persistent_flags = FlagSet() self._inherited_flags = FlagSet() self.flags.add_bool_flag(name="help", shorthand="h", usage="Displays help information about the command.") # TODO: Why do we have 2 almost indentical init functions? Setting a default arg_validator value, breaks the compiler as of 24.2. fn __init__( inout self, name: String, description: String, arg_validator: ArgValidator, aliases: List[String] = List[String](), valid_args: List[String] = List[String](), run: Optional[CommandFunction] = None, pre_run: Optional[CommandFunction] = None, post_run: Optional[CommandFunction] = None, erroring_run: Optional[CommandFunctionErr] = None, erroring_pre_run: Optional[CommandFunctionErr] = None, erroring_post_run: Optional[CommandFunctionErr] = None, persistent_pre_run: Optional[CommandFunction] = None, persistent_post_run: Optional[CommandFunction] = None, persistent_erroring_pre_run: Optional[CommandFunctionErr] = None, persistent_erroring_post_run: Optional[CommandFunctionErr] = None, help: HelpFunction = default_help, ): if not run and not erroring_run: panic("A command must have a run or erroring_run function.") self.name = name self.description = description self.aliases = aliases self.help = help self.group_id = "" self.pre_run = pre_run self.run = run self.post_run = post_run self.erroring_pre_run = erroring_pre_run self.erroring_run = erroring_run self.erroring_post_run = erroring_post_run self.persistent_pre_run = persistent_pre_run self.persistent_post_run = persistent_post_run self.persistent_erroring_pre_run = persistent_erroring_pre_run self.persistent_erroring_post_run = persistent_erroring_post_run self.children = List[Arc[Self]]() self.parent = Arc[Optional[Command]](None) self.arg_validator = arg_validator self.valid_args = valid_args self.flags = FlagSet() self.local_flags = FlagSet() self.persistent_flags = FlagSet() self._inherited_flags = FlagSet() self.flags.add_bool_flag(name="help", shorthand="h", usage="Displays help information about the command.") fn __copyinit__(inout self, existing: Self): self.name = existing.name self.description = existing.description self.aliases = existing.aliases self.help = existing.help self.group_id = existing.group_id self.pre_run = existing.pre_run self.run = existing.run self.post_run = existing.post_run self.erroring_pre_run = existing.erroring_pre_run self.erroring_run = existing.erroring_run self.erroring_post_run = existing.erroring_post_run self.persistent_pre_run = existing.persistent_pre_run self.persistent_post_run = existing.persistent_post_run self.persistent_erroring_pre_run = existing.persistent_erroring_pre_run self.persistent_erroring_post_run = existing.persistent_erroring_post_run self.arg_validator = existing.arg_validator self.valid_args = existing.valid_args self.flags = existing.flags self.local_flags = existing.local_flags self.persistent_flags = existing.persistent_flags self._inherited_flags = existing._inherited_flags self.children = existing.children self.parent = existing.parent fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.description = existing.description^ self.aliases = existing.aliases^ self.help = existing.help self.group_id = existing.group_id^ self.pre_run = existing.pre_run^ self.run = existing.run^ self.post_run = existing.post_run^ self.erroring_pre_run = existing.erroring_pre_run^ self.erroring_run = existing.erroring_run^ self.erroring_post_run = existing.erroring_post_run^ self.persistent_pre_run = existing.persistent_pre_run^ self.persistent_post_run = existing.persistent_post_run^ self.persistent_erroring_pre_run = existing.persistent_erroring_pre_run^ self.persistent_erroring_post_run = existing.persistent_erroring_post_run^ self.arg_validator = existing.arg_validator^ self.valid_args = existing.valid_args^ self.flags = existing.flags^ self.local_flags = existing.local_flags^ self.persistent_flags = existing.persistent_flags^ self._inherited_flags = existing._inherited_flags^ self.children = existing.children^ self.parent = existing.parent^ fn __str__(self) -> String: return fmt.sprintf("(Name: %s, Description: %s)", self.name, self.description) fn __repr__(inout self) -> String: var parent_name: String = "" if self.has_parent(): parent_name = self.parent[].value()[].name return ( "Name: " + self.name + "\nDescription: " + self.description + "\nArgs: " + to_string(self.valid_args) + "\nFlags: " + str(self.flags) + "\nCommands: " + to_string(self.children) + "\nParent: " + parent_name ) fn _full_command(self) -> String: """Traverses up the parent command tree to build the full command as a string.""" if self.has_parent(): var ancestor: String = self.parent[].value()[]._full_command() return ancestor + " " + self.name else: return self.name fn _root(self) -> Arc[Command]: """Returns the root command of the command tree.""" if self.has_parent(): return self.parent[].value()[]._root() return self fn validate_flag_groups(self): var group_status = Dict[String, Dict[String, Bool]]() var one_required_group_status = Dict[String, Dict[String, Bool]]() var mutually_exclusive_group_status = Dict[String, Dict[String, Bool]]() @always_inline fn flag_checker(flag: Flag) capturing: var err = process_flag_for_group_annotation(self.flags, flag, REQUIRED_AS_GROUP, group_status) if err: panic("Failed to process flag for REQUIRED_AS_GROUP annotation: " + str(err)) err = process_flag_for_group_annotation(self.flags, flag, ONE_REQUIRED, one_required_group_status) if err: panic("Failed to process flag for ONE_REQUIRED annotation: " + str(err)) err = process_flag_for_group_annotation( self.flags, flag, MUTUALLY_EXCLUSIVE, mutually_exclusive_group_status ) if err: panic("Failed to process flag for MUTUALLY_EXCLUSIVE annotation: " + str(err)) self.flags.visit_all[flag_checker]() # Validate required flag groups validate_flag_groups(group_status, one_required_group_status, mutually_exclusive_group_status) fn execute(inout self) -> None: """Traverses the arguments passed to the executable and executes the last command in the branch.""" # Traverse from the root command through the children to find a match for the current argument. # Any additional arguments past the last matched command name are considered arguments. # TODO: Tree traversal is new to me, there's probably a better way to do this. # Always execute from the root command, regardless of what command was executed in main. if self.has_parent(): var root = self._root() return root[].execute() var remaining_args: List[String] var command: Self command, remaining_args = parse_command_from_args(self) var command_ref = Arc(command) # Merge local and inherited flags command_ref[]._merge_flags() # Add all parents to the list to check if they have persistent pre/post hooks. var parents = List[Self]() @parameter fn append_parents(parent: Self) capturing -> None: parents.append(parent) command_ref[].visit_parents[append_parents]() # If ENABLE_TRAVERSE_RUN_HOOKS is True, reverse the list to start from the root command rather than # from the child. This is because all of the persistent hooks will be run. @parameter if ENABLE_TRAVERSE_RUN_HOOKS: parents.reverse() # Get the flags for the command to be executed. # store flags as a mutable ref var err: Error remaining_args, err = get_flags(command_ref[].flags, remaining_args) if err: panic(err) # Check if the help flag was passed var help_passed = command_ref[].flags.get_as_bool("help") if help_passed.value()[] == True: print(command.help(command_ref)) return None # Validate individual required flags (eg: flag is required) err = command_ref[].validate_required_flags() if err: panic(err) # Validate flag groups (eg: one of required, mutually exclusive, required together) command_ref[].validate_flag_groups() # Validate the remaining arguments var error_message = command_ref[].arg_validator(command_ref, remaining_args) if error_message: panic(error_message.value()[]) # Run the persistent pre-run hooks. for parent in parents: if parent[].persistent_erroring_pre_run: err = parent[].persistent_erroring_pre_run.value()[](command_ref, remaining_args) if err: panic(err) @parameter if not ENABLE_TRAVERSE_RUN_HOOKS: break else: if parent[].persistent_pre_run: parent[].persistent_pre_run.value()[](command_ref, remaining_args) @parameter if not ENABLE_TRAVERSE_RUN_HOOKS: break # Run the pre-run hooks. if command_ref[].pre_run: command.pre_run.value()[](command_ref, remaining_args) elif command_ref[].erroring_pre_run: err = command.erroring_pre_run.value()[](command_ref, remaining_args) if err: panic(err) # Run the function's commands. if command_ref[].run: command_ref[].run.value()[](command_ref, remaining_args) else: err = command_ref[].erroring_run.value()[](command_ref, remaining_args) if err: panic(err) # Run the persistent post-run hooks. for parent in parents: if parent[].persistent_erroring_post_run: err = parent[].persistent_erroring_post_run.value()[](command_ref, remaining_args) if err: panic(err) @parameter if not ENABLE_TRAVERSE_RUN_HOOKS: break else: if parent[].persistent_post_run: parent[].persistent_post_run.value()[](command_ref, remaining_args) @parameter if not ENABLE_TRAVERSE_RUN_HOOKS: break # Run the post-run hooks. if command_ref[].post_run: command.post_run.value()[](command_ref, remaining_args) elif command_ref[].erroring_post_run: err = command.erroring_post_run.value()[](command_ref, remaining_args) if err: panic(err) fn inherited_flags(self) -> FlagSet: """Returns the flags for the command and inherited flags from its parent. Returns: The flags for the command and its parent. """ var i_flags = FlagSet() @always_inline fn add_parent_persistent_flags(parent: Self) capturing -> None: if parent.persistent_flags: i_flags += parent.persistent_flags self.visit_parents[add_parent_persistent_flags]() return i_flags fn _merge_flags(inout self): """Returns all flags for the command and inherited flags from its parent.""" # Set mutability of flag set by initializing it as a var. self.flags += self.persistent_flags self._inherited_flags = self.inherited_flags() self.flags += self._inherited_flags fn add_command(inout self: Self, inout command: Arc[Command]): """Adds child command and set's child's parent attribute to self. Args: command: The command to add as a child of self. """ var cmd = command self.children.append(command) cmd[].parent = self fn mark_flag_required(inout self, flag_name: String) -> None: """Marks the given flag with annotations so that Prism errors if the command is invoked without the flag. Args: flag_name: The name of the flag to mark as required. """ var err = self.flags.set_annotation(flag_name, REQUIRED, List[String]("true")) if err: panic(err) fn mark_flags_required_together(inout self, *flag_names: String) -> None: """Marks the given flags with annotations so that Prism errors if the command is invoked with a subset (but not all) of the given flags. Args: flag_names: The names of the flags to mark as required together. """ self._merge_flags() for flag_name in flag_names: var maybe_flag = self.flags.lookup(flag_name[]) if not maybe_flag: panic(fmt.sprintf("Failed to find flag %s and mark it as being required in a flag group", flag_name[])) var flag = maybe_flag.value()[] # TODO: This inline join logic is temporary until we can pass around varadic lists or cast it to a list. var result: String = "" for i in range(len(flag_names)): result += flag_names[i] if i != len(flag_names) - 1: result += " " flag[].annotations[REQUIRED_AS_GROUP] = List[String](result) var err = self.flags.set_annotation( flag_name[], REQUIRED_AS_GROUP, flag[].annotations.get(REQUIRED_AS_GROUP, List[String]()) ) if err: panic(err) fn mark_flags_one_required(inout self, *flag_names: String) -> None: """Marks the given flags with annotations so that Prism errors if the command is invoked without at least one flag from the given set of flags. Args: flag_names: The names of the flags to mark as required. """ self._merge_flags() for flag_name in flag_names: var maybe_flag = self.flags.lookup(flag_name[]) if not maybe_flag: panic( fmt.sprintf("Failed to find flag %s and mark it as being in a one-required flag group", flag_name[]) ) var flag = maybe_flag.value()[] var result: String = "" for i in range(len(flag_names)): result += flag_names[i] if i != len(flag_names) - 1: result += " " flag[].annotations[ONE_REQUIRED] = result var err = self.flags.set_annotation( flag_name[], ONE_REQUIRED, flag[].annotations.get(ONE_REQUIRED, List[String]()) ) if err: panic(err) fn mark_flags_mutually_exclusive(inout self, *flag_names: String) -> None: """Marks the given flags with annotations so that Prism errors if the command is invoked with more than one flag from the given set of flags. Args: flag_names: The names of the flags to mark as mutually exclusive. """ self._merge_flags() for flag_name in flag_names: var maybe_flag = self.flags.lookup(flag_name[]) if not maybe_flag: panic( fmt.sprintf( "Failed to find flag %s and mark it as being in a mutually exclusive flag group", flag_name[] ) ) var flag = maybe_flag.value()[] var result: String = "" for i in range(len(flag_names)): result += flag_names[i] if i != len(flag_names) - 1: result += " " flag[].annotations[MUTUALLY_EXCLUSIVE] = result var err = self.flags.set_annotation( flag_name[], MUTUALLY_EXCLUSIVE, flag[].annotations.get(MUTUALLY_EXCLUSIVE, List[String]()) ) if err: panic(err) fn mark_persistent_flag_required(inout self, flag_name: String) -> None: """Marks the given persistent flag with annotations so that Prism errors if the command is invoked without the flag. Args: flag_name: The name of the flag to mark as required. """ # self._merge_flags() var err = self.persistent_flags.set_annotation(flag_name, REQUIRED, List[String]("true")) if err: panic(err) fn has_parent(self) -> Bool: """Returns True if the command has a parent, False otherwise.""" return self.parent[].__bool__() fn visit_parents[func: ParentVisitorFn](self) -> None: """Visits all parents of the command and invokes func on each parent. Params: func: The function to invoke on each parent. """ if self.has_parent(): func(self.parent[].value()[]) self.parent[].value()[].visit_parents[func]() fn validate_required_flags(self) -> Error: """Validates all required flags are present and returns an error otherwise.""" var missing_flag_names = List[String]() fn check_required_flag(flag: Flag) capturing -> None: var required_annotation = flag.annotations.get(REQUIRED, List[String]()) if required_annotation: if required_annotation[0] == "true" and not flag.changed: missing_flag_names.append(flag.name) self.flags.visit_all[check_required_flag]() if len(missing_flag_names) > 0: return Error("required flag(s) " + to_string(missing_flag_names) + " not set") return Error() --- prism/flag.mojo --- from collections.optional import Optional # Individual flag annotations alias REQUIRED = "REQUIRED" # Flag Group annotations alias REQUIRED_AS_GROUP = "REQUIRED_AS_GROUP" alias ONE_REQUIRED = "ONE_REQUIRED" alias MUTUALLY_EXCLUSIVE = "MUTUALLY_EXCLUSIVE" @value struct Flag(CollectionElement, Stringable): """Represents a flag that can be passed via the command line. Flags are passed in via --name or -shorthand and can have a value associated with them. """ var name: String var shorthand: String var usage: String var value: Optional[String] var default: String var type: String var annotations: Dict[String, List[String]] var changed: Bool @always_inline fn __init__( inout self, name: String, shorthand: String, usage: String, value: Optional[String], default: String, type: String, ) -> None: """Initializes a new Flag. Args: name: The name of the flag. shorthand: The shorthand of the flag. usage: The usage of the flag. value: The value of the flag. default: The default value of the flag. type: The type of the flag. """ self.name = name self.shorthand = shorthand self.usage = usage self.value = value self.default = default self.type = type self.annotations = Dict[String, List[String]]() self.changed = False @always_inline fn __str__(self) -> String: return ( String("(Name: ") + self.name + String(", Shorthand: ") + self.shorthand + String(", Usage: ") + self.usage + String(")") ) @always_inline fn __eq__(self, other: Self) -> Bool: return ( self.name == other.name and self.shorthand == other.shorthand and self.usage == other.usage and self.value.value()[] == other.value.value()[] and self.default == other.default and self.type == other.type and self.changed == other.changed ) @always_inline fn __ne__(self, other: Self) -> Bool: return not self == other @always_inline fn set_value(inout self, value: String) -> None: """Sets the value of the flag. Args: value: The value to set. """ self.value = value self.changed = True @always_inline fn split(text: String, sep: String, max_split: Int = -1) -> List[String]: try: return text.split(sep, max_split) except: return List[String](text) fn parse_flag(i: Int, argument: String, arguments: List[String], flags: FlagSet) -> Tuple[String, String, Int, Error]: """Parses a flag and returns the name, value, and the index to increment by. Args: i: The current index in the arguments list. argument: The argument to parse. arguments: The list of arguments passed via the command line. flags: The flags passed via the command line. """ # Flag with value set like "--flag=<value>" if argument.find("=") != -1: var flag = split(argument, "=") var name = flag[0][2:] var value = flag[1] if name not in flags.get_names(): return name, value, 0, Error("Command does not accept the flag supplied: " + name) return name, value, 1, Error() # Flag with value set like "--flag <value>" var name = argument[2:] if name not in flags.get_names(): return name, String(""), 0, Error("Command does not accept the flag supplied: " + name) # If it's a bool flag, set it to True and only increment the index by 1 (one arg used). if flags.get_as_bool(name): return name, String("True"), 1, Error() if i + 1 >= len(arguments): return ( name, String(""), 0, Error("Flag `" + name + "` requires a value to be set but reached the end of arguments."), ) if arguments[i + 1].startswith("-", 0, 1): return ( name, String(""), 0, Error("Flag `" + name + "` requires a value to be set but found another flag instead."), ) # Increment index by 2 because 2 args were used (one for name and value). return name, arguments[i + 1], 2, Error() fn parse_shorthand_flag( i: Int, argument: String, arguments: List[String], flags: FlagSet ) -> Tuple[String, String, Int, Error]: """Parses a shorthand flag and returns the name, value, and the index to increment by. Args: i: The current index in the arguments list. argument: The argument to parse. arguments: The list of arguments passed via the command line. flags: The flags passed via the command line. Returns: The name, value, the index to increment by, and an error if one occurred. """ # Flag with value set like "-f=<value>" if argument.find("=") != -1: var flag = split(argument, "=") var shorthand = flag[0][1:] var value = flag[1] var name = flags.lookup_name(shorthand).value() if name[] not in flags.get_names(): return name[], value, 0, Error("Command does not accept the flag supplied: " + name[]) return name[], value, 1, Error() # Flag with value set like "-f <value>" var shorthand = argument[1:] var result = flags.lookup_name(shorthand) if not result: return shorthand, String(""), 0, Error("Did not find name for shorthand: " + shorthand) var name = result.value() # If it's a bool flag, set it to True and only increment the index by 1 (one arg used). if flags.get_as_bool(name[]): return name[], String("True"), 1, Error() if i + 1 >= len(arguments): return ( name[], String(""), 0, Error("Flag `" + name[] + "` requires a value to be set but reached the end of arguments."), ) if arguments[i + 1].startswith("-", 0, 1): return ( name[], String(""), 0, Error("Flag `" + name[] + "` requires a value to be set but found another flag instead."), ) # Increment index by 2 because 2 args were used (one for name and value). return name[], arguments[i + 1], 2, Error() # TODO: This parsing is dirty atm, will come back around and clean it up. fn get_flags(inout flags: FlagSet, arguments: List[String]) -> (List[String], Error): """Parses flags and args from the args passed via the command line and adds them to their appropriate collections. Args: flags: The flags passed via the command line. arguments: The arguments passed via the command line. """ var remaining_args = List[String]() var i = 0 while i < len(arguments): var argument = arguments[i] # Positional argument if not argument.startswith("-", 0, 1): remaining_args.append(argument) i += 1 continue var name: String = "" var value: String = "" var increment_by: Int = 0 var err = Error() # Full flag if argument.startswith("--", 0, 2): name, value, increment_by, err = parse_flag(i, argument, arguments, flags) # Shorthand flag elif argument.startswith("-", 0, 1): name, value, increment_by, err = parse_shorthand_flag(i, argument, arguments, flags) if err: return remaining_args, err # Set the value of the flag directly, no more set_value function. var flag = flags.lookup(name) if not flag: return List[String](), Error("No flag found with the name: " + name) flag.value()[][].set_value(value) i += increment_by return remaining_args, Error() --- prism/flag_set.mojo --- from external.gojo.builtins import panic import external.gojo.fmt from .flag import Flag from .vector import to_string alias FlagVisitorFn = fn (Flag) capturing -> None fn string_to_bool(value: String) -> Bool: """Converts a string to a boolean. Args: value: The string to convert to a boolean. Returns: The boolean equivalent of the string. """ var truthy = List[String]("true", "True", "1") for t in truthy: if value == t[]: return True return False fn string_to_float(s: String) raises -> Float64: try: # locate decimal point var dot_pos = s.find(".") # grab the integer part of the number var int_str = s[0:dot_pos] # grab the decimal part of the number var num_str = s[dot_pos + 1 : len(s)] # set the numerator to be the integer equivalent var numerator = atol(num_str) # construct denom_str to be "1" + "0"s for the length of the fraction var denom_str = String() for _ in range(len(num_str)): denom_str += "0" var denominator = atol("1" + denom_str) # school-level maths here :) var frac = numerator / denominator # return the number as a Float64 var result: Float64 = atol(int_str) + frac return result except: raise Error("string_to_float: Failed to convert " + s + " to a float.") @value struct FlagSet(Stringable, Sized, Boolable, EqualityComparable): var flags: List[Flag] fn __init__(inout self) -> None: self.flags = List[Flag]() fn __init__(inout self, flag_set: Self) -> None: self = flag_set fn __str__(self) -> String: var result = String("Flags: [") for i in range(self.flags.size): var f = self.flags[i] result += str(f) if i != self.flags.size - 1: result += String(", ") result += String("]") return result fn __len__(self) -> Int: return self.flags.size fn __bool__(self) -> Bool: return self.flags.__bool__() fn __contains__(self, value: Flag) -> Bool: for flag in self.flags: if flag[] == value: return True return False fn __eq__(self, other: Self) -> Bool: if len(self.flags) != len(other.flags): return False for i in range(len(self.flags)): var f = self.flags[i] var other_f = other.flags[i] if f != other_f: return False return True fn __ne__(self, other: Self) -> Bool: return not self == other fn __add__(inout self, other: Self) -> Self: var new = Self(self) for flag in other.flags: new.flags.append(flag[]) return new fn __iadd__(inout self, other: Self): self.add_flag_set(other) fn lookup(self: Reference[Self], name: String) -> Optional[Reference[Flag, self.is_mutable, self.lifetime]]: """Returns an mutable or immutable reference to a Flag with the given name. Mutable if FlagSet is mutable, immutable if FlagSet is immutable. Args: name: The name of the flag to return. Returns: Optional Reference to the Flag. """ for i in range(len(self[].flags)): if self[].flags[i].name == name: return self[].flags.__get_ref(i) return None fn lookup_with_type( self: Reference[Self], name: String, type: String ) -> Optional[Reference[Flag, self.is_mutable, self.lifetime]]: """Returns an mutable or immutable reference to a Flag with the given name. Mutable if FlagSet is mutable, immutable if FlagSet is immutable. Args: name: The name of the flag to return. type: The type of the flag to return. Returns: Optional Reference to the Flag. """ for i in range(len(self[].flags)): if self[].flags[i].name == name and self[].flags[i].type == type: return self[].flags.__get_ref(i) return None fn get_as_string(self, name: String) -> Optional[String]: """Returns the value of a flag as a String. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var result = self.lookup_with_type(name, "String") if not result: return None var flag = result.value()[] if not flag[].value: return flag[].default return flag[].value fn get_as_bool(self, name: String) -> Optional[Bool]: """Returns the value of a flag as a Bool. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var result = self.lookup_with_type(name, "Bool") if not result: return None var flag = result.value()[] if not flag[].value: return string_to_bool(flag[].default) return string_to_bool(flag[].value.value()[]) fn get_as_int(self, name: String) -> Optional[Int]: """Returns the value of a flag as an Int. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var result = self.lookup_with_type(name, "Int") if not result: return None var flag = result.value()[] # TODO: I don't like this swallowing up a failure to convert to int. Maybe return a tuple of optional and error? try: if not flag[].value: return atol(flag[].default) return atol(flag[].value.value()[]) except e: return None fn get_as_int8(self, name: String) -> Optional[Int8]: """Returns the value of a flag as a Int8. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_int(name) if not value: return None return Int8(value.value()[]) fn get_as_int16(self, name: String) -> Optional[Int16]: """Returns the value of a flag as a Int16. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_int(name) if not value: return None return Int16(value.value()[]) fn get_as_int32(self, name: String) -> Optional[Int32]: """Returns the value of a flag as a Int32. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_int(name) if not value: return None return Int32(value.value()[]) fn get_as_int64(self, name: String) -> Optional[Int64]: """Returns the value of a flag as a Int64. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_int(name) if not value: return None return Int64(value.value()[]) fn get_as_uint8(self, name: String) -> Optional[UInt8]: """Returns the value of a flag as a UInt8. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_int(name) if not value: return None return UInt8(value.value()[]) fn get_as_uint16(self, name: String) -> Optional[UInt16]: """Returns the value of a flag as a UInt16. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_int(name) if not value: return None return UInt16(value.value()[]) fn get_as_uint32(self, name: String) -> Optional[UInt32]: """Returns the value of a flag as a UInt32. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_int(name) if not value: return None return UInt32(value.value()[]) fn get_as_uint64(self, name: String) -> Optional[UInt64]: """Returns the value of a flag as a UInt64. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_int(name) if not value: return None return UInt64(value.value()[]) fn get_as_float16(self, name: String) -> Optional[Float16]: """Returns the value of a flag as a Float64. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_float64(name) if not value: return None return Float16(value.value()[]) fn get_as_float32(self, name: String) -> Optional[Float32]: """Returns the value of a flag as a Float64. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var value = self.get_as_float64(name) if not value: return None return Float32(value.value()[]) fn get_as_float64(self, name: String) -> Optional[Float64]: """Returns the value of a flag as a Float64. If it isn't set, then return the default value. Args: name: The name of the flag to return. """ var result = self.lookup_with_type(name, "Float64") if not result: return None var flag = result.value()[] # TODO: I don't like this swallowing up a failure to convert to int. Maybe return a tuple of optional and error? try: if not flag[].value: return string_to_float(flag[].default) return string_to_float(flag[].value.value()[]) except e: return None # fn get_flags_with_values(self) -> List[Reference[Flag, i1_0, __lifetime_of(self)]]: # """Returns a list of immutable references to all flags in the flag set that have values set.""" # var result = List[Reference[Flag, i1_0, __lifetime_of(self)]]() # for flag in self.flags: # if flag[].value.value()[][] != "": # result.append(flag) # return result fn get_names(self) -> List[String]: """Returns a list of names of all flags in the flag set.""" var result = List[String]() for flag in self.flags: result.append(flag[].name) return result fn get_shorthands(self) -> List[String]: """Returns a list of shorthands of all flags in the flag set.""" var result = List[String]() for flag in self.flags: result.append(flag[].shorthand) return result fn lookup_name(self, shorthand: String) -> Optional[String]: """Returns the name of a flag given its shorthand. Args: shorthand: The shorthand of the flag to lookup. """ for flag in self.flags: if flag[].shorthand == shorthand: return flag[].name return None fn _add_flag( inout self, name: String, usage: String, default: String, type: String, shorthand: String = "" ) -> None: """Adds a flag to the flag set. Valid type values: [String, Bool, Int, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float16, Float32, Float64] Args: name: The name of the flag. usage: The usage of the flag. default: The default value of the flag. type: The type of the flag. shorthand: The shorthand of the flag. """ # Use var to set the mutability of flag, then add it to the list var flag = Flag(name=name, shorthand=shorthand, usage=usage, value=None, default=str(default), type=type) self.flags.append(flag) fn add_bool_flag( inout self, name: String, usage: String, shorthand: String = "", default: Bool = False, ) -> None: """Adds a Bool flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Bool", shorthand) fn add_string_flag( inout self, name: String, usage: String, shorthand: String = "", default: String = "", ) -> None: """Adds a String flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "String", shorthand) fn add_int_flag(inout self, name: String, usage: String, shorthand: String = "", default: Int = 0) -> None: """Adds an Int flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Int", shorthand) fn add_int8_flag(inout self, name: String, usage: String, shorthand: String = "", default: Int8 = 0) -> None: """Adds an Int8 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Int8", shorthand) fn add_int16_flag(inout self, name: String, usage: String, shorthand: String = "", default: Int16 = 0) -> None: """Adds an Int16 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Int16", shorthand) fn add_int32_flag(inout self, name: String, usage: String, shorthand: String = "", default: Int32 = 0) -> None: """Adds an Int32 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Int32", shorthand) fn add_int64_flag(inout self, name: String, usage: String, shorthand: String = "", default: Int64 = 0) -> None: """Adds an Int64 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Int64", shorthand) fn add_uint8_flag(inout self, name: String, usage: String, shorthand: String = "", default: UInt8 = 0) -> None: """Adds a UInt8 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "UInt8", shorthand) fn add_uint16_flag(inout self, name: String, usage: String, shorthand: String = "", default: UInt16 = 0) -> None: """Adds a UInt16 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "UInt16", shorthand) fn add_uint32_flag(inout self, name: String, usage: String, shorthand: String = "", default: UInt32 = 0) -> None: """Adds a UInt32 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "UInt32", shorthand) fn add_uint64_flag(inout self, name: String, usage: String, shorthand: String = "", default: UInt64 = 0) -> None: """Adds a UInt64 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "UInt64", shorthand) fn add_float16_flag(inout self, name: String, usage: String, shorthand: String = "", default: Float16 = 0) -> None: """Adds a Float16 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Float16", shorthand) fn add_float32_flag(inout self, name: String, usage: String, shorthand: String = "", default: Float32 = 0) -> None: """Adds a Float32 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Float32", shorthand) fn add_float64_flag(inout self, name: String, usage: String, shorthand: String = "", default: Float64 = 0) -> None: """Adds a Float64 flag to the flag set. Args: name: The name of the flag. usage: The usage of the flag. shorthand: The shorthand of the flag. default: The default value of the flag. """ self._add_flag(name, usage, str(default), "Float64", shorthand) fn set_annotation(inout self, name: String, key: String, values: List[String]) -> Error: """Sets an annotation for a flag. Args: name: The name of the flag to set the annotation for. key: The key of the annotation. values: The values of the annotation. """ var result = self.lookup(name) if not result: return Error("FlagSet.set_annotation: Could not find flag with name: " + name) result.value()[][].annotations[key] = values return Error() fn visit_all[visitor: FlagVisitorFn](self) -> None: """Visits all flags in the flag set. Params: visitor: The visitor function to call for each flag. """ for flag in self.flags: visitor(flag[]) fn add_flag_set(inout self, new_set: Self) -> None: """Adds flags from another FlagSet. If a flag is already present, the flag from the new set is ignored. Args: new_set: The flag set to add. """ @always_inline fn add_flag(flag: Flag) capturing -> None: if not self.lookup(flag.name): self.flags.append(flag) new_set.visit_all[add_flag]() fn process_flag_for_group_annotation( flags: FlagSet, flag: Reference[Flag], annotation: String, inout group_status: Dict[String, Dict[String, Bool]], ) -> Error: var group_info = flag[].annotations.get(annotation, List[String]()) if group_info: for group in group_info: var group_name = group[] if len(group_status.get(group_name, Dict[String, Bool]())) == 0: var flag_names = List[String]() try: flag_names = group_name.split(sep=" ") except e: return Error("process_flag_for_group_annotation: Failed to split group names: " + str(e)) # Only consider this flag group at all if all the flags are defined. if not has_all_flags(flags, flag_names): continue for name in flag_names: var entry = Dict[String, Bool]() entry[name[]] = False group_status[group[]] = entry # If flag.changed = True, then it had a value set on it. try: group_status[group[]][flag[].name] = flag[].changed except e: return Error("process_flag_for_group_annotation: Failed to set group status: " + str(e)) return Error() fn has_all_flags(flags: FlagSet, flag_names: List[String]) -> Bool: for name in flag_names: if not flags.lookup(name[]): return False return True fn validate_required_flag_group(data: Dict[String, Dict[String, Bool]]) -> None: """Validates that all flags in a group are set if any are set. This is for flags that are marked as required via `Command().mark_flags_required_together()`. Args: data: The dictionary of flag groups to validate. """ # Within each group, is a Dict of flag name and if they're set. # If it's unset then add to a list to check the condition of all required flags being set. for pair in data.items(): var unset = List[String]() for flag in pair[].value.items(): if not flag[].value: unset.append(flag[].key) if len(unset) == len(pair[].value) or len(unset) == 0: continue # Sort values, so they can be tested/scripted against consistently. # unset.sort() var keys = List[String]() for key in pair[].value.keys(): keys.append(key[]) panic( fmt.sprintf( "if any flags in the group, %s, are set they must all be set; missing %s", to_string(keys), to_string(unset), ) ) fn validate_one_required_flag_group(data: Dict[String, Dict[String, Bool]]) -> None: """Validates that at least one flag in a group is set. This is for flags that are marked as required via `Command().mark_flag_required()`. Args: data: The dictionary of flag groups to validate. """ # Check if at least one key is set. for pair in data.items(): var set = List[String]() for flag in pair[].value.items(): if flag[].value: set.append(flag[].key) if len(set) >= 1: continue # Sort values, so they can be tested/scripted against consistently. # unset.sort() var keys = List[String]() for key in pair[].value.keys(): keys.append(key[]) panic(fmt.sprintf("at least one of the flags in the group %s is required", to_string(keys))) fn validate_mutually_exclusive_flag_group(data: Dict[String, Dict[String, Bool]]) -> None: """Validates that only one flag in a group is set. This is for flags that are marked as required via `Command().mark_flags_mutually_exclusive()`. Args: data: The dictionary of flag groups to validate. """ # Check if more than one mutually exclusive flag is set. for pair in data.items(): var set = List[String]() for flag in pair[].value.items(): if flag[].value: set.append(flag[].key) if len(set) == 0 or len(set) == 1: continue # Sort values, so they can be tested/scripted against consistently. # unset.sort() var keys = List[String]() for key in pair[].value.keys(): keys.append(key[]) panic( fmt.sprintf( "if any flags in the group %s are set none of the others can be; %s were all set", to_string(keys), to_string(set), ) ) fn validate_flag_groups( group_status: Dict[String, Dict[String, Bool]], one_required_group_status: Dict[String, Dict[String, Bool]], mutually_exclusive_group_status: Dict[String, Dict[String, Bool]], ) -> None: """Validates the status of flag groups. Checks for flag groups that are required together, at least one required, and mutually exclusive. Status is a map of maps containing the flag name and if it's been set. Args: group_status: The status of flag groups that are required together. one_required_group_status: The status of flag groups that require at least one flag to be set. mutually_exclusive_group_status: The status of flag groups that are mutually exclusive. """ validate_required_flag_group(group_status) validate_one_required_flag_group(one_required_group_status) validate_mutually_exclusive_flag_group(mutually_exclusive_group_status) --- prism/vector.mojo --- from memory.arc import Arc fn to_string[T: StringableCollectionElement](vector: List[T]) -> String: var result = String("[") for i in range(vector.size): result += str(vector[i]) if i < vector.size - 1: result += String(", ") result += String("]") return result fn to_string[T: StringableCollectionElement](vector: List[Arc[T]]) -> String: var result = String("[") for i in range(vector.size): var flag = vector[i] result += str(flag[]) if i < vector.size - 1: result += String(", ") result += String("]") return result --- run_examples.sh --- #!/bin/bash export MOJO_PYTHON_LIBRARY=$(which python3) mkdir ./temp mojo package prism -I ./external -o ./temp/prism.mojopkg echo -e "Building binaries for all examples...\n" mojo build examples/aliases/root.mojo -o temp/aliases mojo build examples/hello_world/root.mojo -o temp/hello_world # mojo build examples/nested/nested.mojo -o temp/nested mojo build examples/printer/printer.mojo -o temp/printer # mojo build examples/persistent/root.mojo -o temp/persistent mojo build examples/flag_groups/parent.mojo -o temp/parent mojo build examples/flag_groups/child.mojo -o temp/child mojo build examples/arg_validators/root.mojo -o temp/validators echo -e "Executing examples...\n" cd temp ./aliases my thing ./hello_world say hello # ./nested get cat --count 5 -l ./printer "sample-text" --formatting=underline # ./persistent get cat --count 2 --lover # ./persistent get dog -l ./parent --required --host=www.example.com --port 8080 ./parent --required --host www.example.com ./parent --required --host www.example.com --uri abcdef --port 8080 ./parent ./child tool --required -a --host=www.example.com --port 8080 ./child tool --required -a --host www.example.com ./child tool --required --also --host www.example.com --uri abcdef --port 8080 ./validators Hello from Mojo! ./validators no_args Hello from Mojo! ./validators valid_args Hello from Mojo! ./validators minimum_n_args Hello from Mojo! ./validators maximum_n_args Hello from Mojo! ./validators exact_args Hello from Mojo! ./validators range_args Hello from Mojo! cd .. rm -R ./temp --- tests/__init__.mojo --- --- tests/test_args.mojo --- from memory.arc import Arc from tests.wrapper import MojoTest from prism import CommandArc, Command from prism.args import ( no_args, valid_args, arbitrary_args, minimum_n_args, maximum_n_args, exact_args, range_args, match_all, ArgValidator, ) fn dummy(command: CommandArc, args: List[String]) -> None: return None fn test_no_args(): var test = MojoTest("Testing args.no_args") var cmd = Command(name="root", description="Base command.", run=dummy) var result = no_args(Arc(cmd), List[String]("abc")) test.assert_equal(result.value()[], String("The command `root` does not take any arguments.")) fn test_valid_args(): var test = MojoTest("Testing args.valid_args") var cmd = Command(name="root", description="Base command.", run=dummy) var result = valid_args[List[String]("Pineapple")]()(Arc(cmd), List[String]("abc")) test.assert_equal(result.value()[], "Invalid argument: `abc`, for the command `root`.") fn test_arbitrary_args(): var test = MojoTest("Testing args.arbitrary_args") var cmd = Command(name="root", description="Base command.", run=dummy) var result = arbitrary_args(Arc(cmd), List[String]("abc", "blah", "blah")) # If the result is anything but None, fail the test. if result is not None: test.assert_false(True) fn test_minimum_n_args(): var test = MojoTest("Testing args.minimum_n_args") var cmd = Command(name="root", description="Base command.", run=dummy) var result = minimum_n_args[3]()(Arc(cmd), List[String]("abc", "123")) test.assert_equal(result.value()[], "The command `root` accepts at least 3 argument(s). Received: 2.") fn test_maximum_n_args(): var test = MojoTest("Testing args.maximum_n_args") var cmd = Command(name="root", description="Base command.", run=dummy) var result = maximum_n_args[1]()(Arc(cmd), List[String]("abc", "123")) test.assert_equal(result.value()[], "The command `root` accepts at most 1 argument(s). Received: 2.") fn test_exact_args(): var test = MojoTest("Testing args.exact_args") var cmd = Command(name="root", description="Base command.", run=dummy) var result = exact_args[1]()(Arc(cmd), List[String]("abc", "123")) test.assert_equal(result.value()[], "The command `root` accepts exactly 1 argument(s). Received: 2.") fn test_range_args(): var test = MojoTest("Testing args.range_args") var cmd = Command(name="root", description="Base command.", run=dummy) var result = range_args[0, 1]()(Arc(cmd), List[String]("abc", "123")) test.assert_equal(result.value()[], "The command `root`, accepts between 0 to 1 argument(s). Received: 2.") # fn test_match_all(): # var test = MojoTest("Testing args.match_all") # var cmd = Command(name="root", description="Base command.", run=dummy) # var args = List[String]("abc", "123") # alias validators = List[ArgValidator]( # range_args[0, 1](), # valid_args[List[String]("Pineapple")]() # ) # var validator = match_all[validators]() # var results = validator(cmd, args) # test.assert_equal(results.value()[], "Command accepts between 0 to 1 argument(s). Received: 2.") fn main(): test_no_args() test_valid_args() test_arbitrary_args() test_minimum_n_args() test_maximum_n_args() test_exact_args() test_range_args() # test_match_all() --- tests/test_command.mojo --- from tests.wrapper import MojoTest from prism.command import Command, CommandArc from prism.flag_set import FlagSet fn test_command_operations(): var test = MojoTest("Testing Command.new") fn dummy(command: CommandArc, args: List[String]) -> None: return None var cmd = Arc(Command(name="root", description="Base command.", run=dummy)) var get_all_flags_test = MojoTest("Testing Command.get_all_flags") var flags = cmd[].flags.flags for flag in flags: get_all_flags_test.assert_equal(String("help"), flag[].name) var add_command_test = MojoTest("Testing Command.add_command") var child_cmd = Arc(Command(name="child", description="Child command.", run=dummy)) cmd[].add_command(child_cmd) child_cmd[].flags.add_string_flag(name="color", shorthand="c", usage="Text color", default="#3464eb") var full_command_test = MojoTest("Testing Command._full_command") full_command_test.assert_equal(child_cmd[]._full_command(), "root child") # var help_test = MojoTest("Testing Command.help") # cmd.help() fn main(): test_command_operations() --- tests/test_flags.mojo --- from memory.arc import Arc from tests.wrapper import MojoTest from prism.flag import Flag, get_flags, parse_flag, parse_shorthand_flag from prism.flag_set import FlagSet, string_to_bool, string_to_float fn test_string_to_bool(): var test = MojoTest("Testing string_to_bool") var truthy = List[String]("true", "True", "1") for t in truthy: test.assert_true(string_to_bool(t[])) fn test_string_to_float() raises: var test = MojoTest("Testing string_to_float") var floats = List[String]("1.0", "1.000000005", "12345667.12345667") var results = List[Float64](1.0, 1.000000005, 12345667.12345667) for i in range(len(floats)): test.assert_true(string_to_float(floats[i]) == results[i]) fn test_get_flags(): var test = MojoTest("Testing get_flags") var flag_set = FlagSet() flag_set.add_string_flag("key", "description", "default") flag_set.add_bool_flag("flag", "description", "False") var flags = List[String]("--key=value", "positional", "--flag") var remaining_args: List[String] var err: Error remaining_args, err = get_flags(flag_set, flags) test.assert_equal(flag_set.get_as_string("key").value()[], "value") test.assert_equal(flag_set.get_as_bool("flag").value()[], True) fn test_parse_flag() raises: var test = MojoTest("Testing parse_flag") var flag_set = FlagSet() flag_set.add_string_flag(name="key", usage="description", default="default") flag_set.add_bool_flag(name="flag", usage="description", default=False) var name: String var value: String var increment_by: Int var err: Error name, value, increment_by, err = parse_flag(0, String("--key"), List[String]("--key", "value"), flag_set) test.assert_equal(name, "key") test.assert_equal(value, "value") test.assert_equal(increment_by, 2) name, value, increment_by, err = parse_flag(0, String("--key=value"), List[String]("--key=value"), flag_set) test.assert_equal(name, "key") test.assert_equal(value, "value") test.assert_equal(increment_by, 1) fn test_parse_shorthand_flag() raises: var test = MojoTest("Testing parse_shorthand_flag") var flag_set = FlagSet() flag_set.add_string_flag(name="key", usage="description", default="default", shorthand="k") flag_set.add_bool_flag(name="flag", usage="description", default=False, shorthand="f") var name: String var value: String var increment_by: Int var err: Error name, value, increment_by, err = parse_shorthand_flag(0, String("-k"), List[String]("-k", "value"), flag_set) test.assert_equal(name, "key") test.assert_equal(value, "value") test.assert_equal(increment_by, 2) name, value, increment_by, err = parse_shorthand_flag(0, String("-k=value"), List[String]("-k=value"), flag_set) test.assert_equal(name, "key") test.assert_equal(value, "value") test.assert_equal(increment_by, 1) fn main() raises: test_string_to_bool() test_string_to_float() test_get_flags() test_parse_flag() test_parse_shorthand_flag() --- tests/wrapper.mojo --- from testing import testing @value struct MojoTest: """ A utility struct for testing. """ var test_name: String fn __init__(inout self, test_name: String): self.test_name = test_name print("# " + test_name) fn assert_true(self, cond: Bool, message: String = ""): try: if message == "": testing.assert_true(cond) else: testing.assert_true(cond, message) except e: print(e) fn assert_false(self, cond: Bool, message: String = ""): try: if message == "": testing.assert_false(cond) else: testing.assert_false(cond, message) except e: print(e) fn assert_equal[T: testing.Testable](self, left: T, right: T): try: testing.assert_equal(left, right) except e: print(e) --- .github/ISSUE_TEMPLATE/bug_report.md --- --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. --- .github/ISSUE_TEMPLATE/feature_request.md --- --- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. --- .github/workflows/run_tests.yaml --- name: NuMojo Unit Tests on: pull_request: workflow_dispatch: permissions: contents: read pull-requests: read jobs: testing-numojo: name: with ${{ matrix.os }} strategy: fail-fast: false matrix: os: ["ubuntu-latest", "macos-14"] runs-on: ${{ matrix.os }} timeout-minutes: 30 defaults: run: shell: bash env: DEBIAN_FRONTEND: noninteractive steps: - name: Checkout repo uses: actions/checkout@v4 - name: Download Modular installer run: | curl -s https://get.modular.com | sh - - name: Activate virtualenv run: | python3 -m venv $HOME/venv/ . $HOME/venv/bin/activate echo PATH=$PATH >> $GITHUB_ENV - name: Install Mojo run: | modular install mojo - name: Set path Mojo run: | echo "MODULAR_HOME=$HOME/.modular" >> $GITHUB_ENV echo "$HOME/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH - name: Run tests run: | pip install numpy mojo test tests -I . --- .github/workflows/test_pre_commit.yaml --- name: Run pre-commit on: # Run pre-commit on pull requests pull_request: # Add a workflow_dispatch event to run pre-commit manually workflow_dispatch: permissions: contents: read pull-requests: read jobs: lint: runs-on: "ubuntu-latest" timeout-minutes: 30 defaults: run: shell: bash env: DEBIAN_FRONTEND: noninteractive steps: - name: Checkout repo uses: actions/checkout@v4 - name: Download Modular installer run: | curl -s https://get.modular.com | sh - - name: Set path Mojo run: | modular install mojo echo "MODULAR_HOME=/home/runner/.modular" >> $GITHUB_ENV echo "/home/runner/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH - name: Install pre-commit run: | pip install pre-commit pre-commit install - name: Run pre-commit run: pre-commit run --all-files --- .gitignore --- # Build directory /build /dist /local /.vscode .DS_Store *.html *.css *.py mojo numojo.mojopkg .gitignore bench.mojo test_ndarray.ipynb /venv --- .pre-commit-config.yaml --- repos: - repo: local hooks: - id: mojo-format name: mojo-format entry: mojo format language: system files: '\.(mojo|🔥|py)$' stages: [commit] --- CONTRIBUTING.md --- # Contributing to NuMojo Thank you for your interest in contributing to NuMojo! We appreciate your efforts to make this project better. Below are some guidelines to help you contribute effectively. ## Style Guide Please follow the Mojo standard library style guide for all contributions. Consistency in code style helps maintain readability and ease of collaboration. Key points include: - Use clear, descriptive names for variables and functions. - Write concise, well-documented code. - Adhere to formatting conventions for indentation, spacing, and line breaks. Additionally refer to `style guide.md` for docstring and nameing conventions. ## Pull Requests When submitting pull requests: - Ensure they are small but complete. A pull request should introduce at least a minimally viable version of the feature you are adding. - Include tests for your contributions where applicable. - Provide a clear and concise description of what your pull request accomplishes. ## Just Do It If you have an idea or want to work on something, go ahead and do it! You don’t need to ask for permission before starting. In fact, we prefer if you avoid “licking the cookie” by claiming tasks without following through. We would rather recieve 5 different ways of accomplishing something and then choose the best one or combine then than not recieve any feature at all. ## Directory Structure Organize your additions into the appropriate submodule or file, if one does not exist feel free to make it and we can figure out where it goes during the pull request checks. This helps keep the project structured and maintainable. For example: - If you’re adding a statistics function, place it in the `stats` submodule. - If a stats module does not yet exist put the code in a directory called stats in a file with a name that describes the sub disipline of statistics the code enables, along with a `__init__.mojo` - For a kernel density estimation function, add it to the `kde.mojo` file within the `stats` directory. Following this structure ensures that similar functionalities are grouped together, making the codebase easier to navigate. ## Contribution Process 1. **Fork the Repository**: Create a personal fork of the repository on GitHub. 2. **Clone Your Fork**: Clone your forked repository to your local machine. ```sh git clone https://github.com/your-username/numojo.git ``` 3. **Create a Branch**: Create a new branch for your feature or bugfix. ```sh git checkout -b feature-name ``` 4. **Make Your Changes**: Implement your changes in your branch. 5. **Commit Your Changes**: Commit your changes with a clear and descriptive commit message. ```sh git commit -m "Add feature XYZ" ``` 6. **Push Your Changes**: Push your branch to your fork on GitHub. ```sh git push origin feature-name ``` 7. **Submit a Pull Request**: Open a pull request to the `main` branch of the original repository. --- LICENSE --- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---- LLVM Exceptions to the Apache 2.0 License ---- As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into an Object form of such source code, you may redistribute such embedded portions in such Object form without complying with the conditions of Sections 4(a), 4(b) and 4(d) of the License. In addition, if you combine or link compiled forms of this Software with software that is licensed under the GPLv2 ("Combined Software") and if a court of competent jurisdiction determines that the patent provision (Section 3), the indemnity provision (Section 9) or other Section of the License conflicts with the conditions of the GPLv2, you may retroactively and prospectively choose to deem waived or otherwise exclude such Section(s) of the License, but only in their entirety and only with respect to the Combined Software. ============================================================================== Software from third parties included in the LLVM Project: ============================================================================== The LLVM Project contains third party software which is under different license terms. All such code will be identified clearly using at least one of two mechanisms: 1) It will be in a separate directory tree with its own `LICENSE.txt` or `LICENSE` file at the top containing the specific license and restrictions which apply to that software, or 2) It will contain specific license and restriction terms at the top of every file. --- README.MD --- <a name="readme-top"></a> <!-- add these later --> <!-- [![MIT License][license-shield]][] --> <div align="center"> <a href=""> <img src="./assets/numojo_logo.png" alt="Logo" width="350" height="350"> </a> <h1 align="center" style="font-size: 3em; color: white; font-family: 'Avenir'; text-shadow: 1px 1px orange;">NuMojo</h1> <p align="center"> NuMojo is a library for numerical computing in Mojo 🔥 similar to NumPy, SciPy in Python. <br /> <!-- when we create docs --> <a href="https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo-Examples-and-Benchmarks/blob/main/docs/README.md"><strong>Explore the docs» </strong></a> <br> <a href="https://discord.com/channels/1149778565756366939/1149778566603620455"><strong>Check out our Discord» </strong></a> <br /> <!-- <br /> --> <!-- <a href="">View Demo</a> · <a href="">Report Bug</a> · <a href="">Request Feature</a> --> </p> </div> <details> <summary>Table of Contents</summary> <ol> <li> <a href="#about-the-project">About The Project</a> <ul> <li><a href="#what-numojo-is"> What NuMojo is </a></li> <li><a href="#what-numojo-is-not">What NuMojo is not</a></li> </ul> </li> <a href="#goals-roadmap">Goals/Roadmap</a> <ul> <li><a href="#long-term-goals">Long term goals</a></li> </ul> <li><a href="#usage">Usage</a></li> <li><a href="#how-to-install">How to install</a></li> <li><a href="#contributing">Contributing</a></li> <li><a href="#warnings">Warnings</a></li> <li><a href="#license">License</a></li> <li><a href="#acknowledgments">Acknowledgments</a></li> </ol> </details> ## About the project ### What NuMojo is NuMojo intends to capture a wide swath of numerics capability present in the Python packages NumPy, SciPy and Scikit. NuMojo intends to try and get the most out of the capabilities of Mojo including vectorization, parallelization, and GPU acceleration(once available). Currently, NuMojo extends (most of) the standard library math functions to work on array inputs. NuMojo intends to try and get the most out of the capabilities of Mojo including vectorization, parallelization, and GPU acceleration(once available). Currently, NuMojo extends (most of) the standard library math functions to work on array inputs. NuMojo intends to be a building block for other Mojo packages that need fast math under the hood without the added weight of a ML back and forward propagation system ### What NuMojo is not NuMojo is not a machine learning library, it will never include back-propagation in the base library. ## Goals / Roadmap For a detailed roadmap, please refer to the [Roadmap.md](Roadmap.md) file. Our main goal is to implement a fast, comprehensive numerics library in Mojo. Following are some brief long-term goals, ### Long term goals * Linear Algebra * Native n-dimensional array types * Vectorized, Parallelized math operations * Array manipulation - vstack, slicing, concat etc. * Calculus * Integration & Derivatives etc * Optimizers * Function approximators * Sorting ## Usage An example goes as follows. ```mojo import numojo as nm fn main() raises: # Generate two 1000x1000 matrices with random float64 values var A = nm.NDArray[nm.f64](shape=List[Int](1000,1000), random=True) var B = nm.NDArray[nm.f64](1000,1000, random=True) # Print AB print(nm.linalg.matmul_parallelized(A, B)) ``` Please find all the available functions [here](features.md) ## How to install There are two approach to install and use the Numojo package. ### Build package This approach invovles building a standalone package file `mojopkg`. 1. Clone the repository. 1. Build the package using `mojo pacakge numojo` 1. Move the numojo.mojopkg into the directory containing the your code. ### Inlcude NuMojo's path for compiler and LSP This approach does not require buiding a package file. Instead, when you compile your code, you can include the path of NuMojo reporsitory with the following command: ```console mojo run -I "../NuMojo" example.mojo ``` This is more flexible as you are able to edit the NuMojo source files when testing your code. In order to allow VSCode LSP to resolve the imported `numojo` package, you can: 1. Go to preference page of VSCode. 1. Got to `Mojo › Lsp: Include Dirs` 1. Click `add item` and write the path where the Numojo repository is located, e.g. `/Users/Name/Programs/NuMojo`. 1. Restart the Mojo LSP server. Now VSCode can show function hints for the Numojo pakcage! ## Contributing Any contributions you make are **greatly appreciated**. For more details and guidelines on contributions, please check [here](CONTRIBUTING.md) ## Warnings This library is still very much a work in progress and may change at any time. ## License Distributed under the Apache 2.0 License with LLVM Exceptions. See [LICENSE](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/LICENSE) and the LLVM [License](https://llvm.org/LICENSE.txt) for more information. ## Acknowledgements * Built in native [Mojo](https://github.com/modularml/mojo) which was created by [Modular](https://github.com/modularml) --- Roadmap.md --- # ROADMAP Overall the goal is to make a powerful and broad featured library for numerical and scientific computing. In order to make a transition from python easy we should largely follow the conventions of numpy and scipy, but we should allow for the flexibility to do things differently where it improves user experience or greatly effects performance. With that in mind NuMojo as a project is in an early stage of development. If you notice a missing feature either build it and make a pull request or make a feature request. ## TASKS * Implement array version all SIMDable standard library math functions (mostly done waiting on std lib [issue 2492](https://github.com/modularml/mojo/issues/2492)) * Build statistics functions * Build optimizers (newton raphson, bisection,etc) * Build function approximators ## N-dimensional Arrays Now that Modular has decided to no longer support array and to open source and deprecate it NuMojo intends to take array and Make it our own Once they do. Which means that we will be trying to add many of the features from numpy.array that array currently lacks, while not sacrificing performance. ## Notional organization of functions and features * Most common functions at top level like in numpy (trig, basic stats, masking, querying, and mapping) * Other features should be organized either by type of math or intended utilization * Statistics probably merits its own sub module * Regression could either be a submodule of statistics or its own module * kernel density estimators almost certainly should be part of the statistics sub module * It is tempting to make a algebra, calculus and trig submodules however that may end up being confusing as those topics include so many things, it may be better to organize what would be there into functional applications instead * An Ordinary differential equations submodule would include solvers and utilities * The optimizer sub module could mirror scipy.optimize but minimally should include all of those functions * There will need to be discussions and bike shedding about both organization of the library and what does and doesn't belong. --- features.md --- ## Available MATH functions include: abs, floor, ceil, trunc, round, roundeven, round_half_down, round_half_up, rsqrt, exp2, exp, log, log2, tanh, reciprocal, acos, asin, atan, cos, sin, tan, acosh, asinh, atanh, cosh, sinh, expm1, log10, log1p, cbrt, pow, mod, mul, sub, add, div, copysign, atan2, hypot, nextafter, scalb, remainder ## Array Routines arange, linspace, logspace, geomspace zeros, eye, identity, ones, fill ## Stats sum, prod, mean, mode, median, maxT, minT, pvariance, variance, pstdev, stdev --- numojo/__init__.mojo --- """ An Array Mathematics library for Mojo. """ from .core import * from .math import * from .math.statistics import stats # Constants alias pi = core.constants.Constants.pi alias e = core.constants.Constants.e alias c = core.constants.Constants.c --- numojo/core/__init__.mojo --- # ARRAYS from .ndarray import * from .array_creation_routines import * from .array_manipulation_routines import * from .constants import * from .datatypes import * --- numojo/core/_array_funcs.mojo --- # from ..traits.NDArrayTraits import NDArrayBackend from algorithm.functional import parallelize, vectorize, num_physical_cores from .ndarray import NDArray """ Implementing backend for array keeping it simple for now """ fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD compatible function to a NDArray and returns a new NDArray. Parameters: dtype: The NDArray element type. func: The SIMD compatible function to act on the NDArray. Args: array: A NDArray. Returns: A new NDArray that is the result of applying the function to the NDArray. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, func[dtype, opt_nelts](simd_data) ) vectorize[closure, opt_nelts](array.num_elements()) return result_array fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD compatible function to two NDArrays and returns a new NDArray. Raises: Error if the two arrays do not have the same shape. Parameters: dtype: The NDArray element type. func: The SIMD compatible function to act on the NDArrays. Args: array1: A NDArray. array2: A NDArray. Returns: A new NDArray that is the result of applying the function to the input NDArrays. """ if array1.shape() != array2.shape(): raise Error("Shape Mismatch error shapes must match for this function") var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=opt_nelts](i) var simd_data2 = array2.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, func[dtype, opt_nelts](simd_data1, simd_data2) ) vectorize[closure, opt_nelts](result_array.num_elements()) return result_array fn math_func_one_array_one_SIMD_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ](array: NDArray[dtype], scalar: SIMD[dtype, 1]) raises -> NDArray[dtype]: """ Apply a SIMD compatible function to a NDArray and a SIMD value and returns a new NDArray. Parameters: dtype: The NDArray element type. func: The SIMD compatible function to act on the NDArray and SIMD value. Args: array: A NDArray. scalar: A scalar value. Returns: A new NDArray that is the result of applying the function to the input NDArray and SIMD value. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, func[dtype, opt_nelts](simd_data1, scalar) ) vectorize[closure, opt_nelts](result_array.num_elements()) return result_array --- numojo/core/array_creation_routines.mojo --- """ Array creation routine. """ # ===----------------------------------------------------------------------=== # # ARRAY CREATION ROUTINES # Last updated: 2024-06-16 # ===----------------------------------------------------------------------=== # """ # TODO (In order of priority) 1) Add function overload for List, VariadicList types 2) Implement axis argument for the NDArray creation functions 3) Implement Row/Column Major option """ from algorithm import parallelize from builtin.math import pow from .ndarray import NDArray, NDArrayShape from .utility_funcs import is_inttype, is_floattype # ===------------------------------------------------------------------------===# # Arranged Value NDArray generation # ===------------------------------------------------------------------------===# fn arange[ dtype: DType = DType.float64 ]( start: Scalar[dtype], stop: Scalar[dtype], step: Scalar[dtype] = Scalar[dtype](1), ) raises -> NDArray[dtype]: """ Function that computes a series of values starting from "start" to "stop" with given "step" size. Raises: Error if both dtype and dtype are integers or if dtype is a float and dtype is an integer. Parameters: dtype: Datatype of the output array. Args: start: Scalar[dtype] - Start value. stop: Scalar[dtype] - End value. step: Scalar[dtype] - Step size between each element (default 1). Returns: A NDArray of datatype `dtype` with elements ranging from `start` to `stop` incremented with `step`. """ # if (is_floattype[dtype]() and is_inttype[dtype]()) or ( # is_inttype[dtype]() and is_inttype[dtype]() # ): # raise Error( # "Both input and output datatypes cannot be integers. If the input is a float, the output must also be a float." # ) var num: Int = ((stop - start) / step).__int__() var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(num, size=num)) for idx in range(num): result.data[idx] = start + step * idx return result # ===------------------------------------------------------------------------===# # Linear Spacing NDArray Generation # ===------------------------------------------------------------------------===# # I think defaulting parallelization to False is better fn linspace[ dtype: DType ]( start: Scalar[dtype], stop: Scalar[dtype], num: Int = 50, endpoint: Bool = True, parallel: Bool = False, ) raises -> NDArray[dtype]: """ Function that computes a series of linearly spaced values starting from "start" to "stop" with given size. Wrapper function for _linspace_serial, _linspace_parallel. Raises: Error if dtype is an integer. Parameters: dtype: Datatype of the output array. Args: start: Start value. stop: End value. num: No of linearly spaced elements. endpoint: Specifies whether to include endpoint in the final NDArray, defaults to True. parallel: Specifies whether the linspace should be calculated using parallelization, deafults to False. Returns: A NDArray of datatype `dtype` with elements ranging from `start` to `stop` with num elements. """ # if (is_inttype[dtype]() and is_inttype[dtype]()) or ( # is_floattype[dtype]() and is_inttype[dtype]() # ): # raise Error( # "Both input and output datatypes cannot be integers. If the input is a float, the output must also be a float." # ) constrained[not dtype.is_integral()]() if parallel: return _linspace_parallel[dtype](start, stop, num, endpoint) else: return _linspace_serial[dtype](start, stop, num, endpoint) fn _linspace_serial[ dtype: DType ]( start: SIMD[dtype, 1], stop: SIMD[dtype, 1], num: Int, endpoint: Bool = True, ) raises -> NDArray[dtype]: """ Generate a linearly spaced NDArray of `num` elements between `start` and `stop` using naive for loop. Parameters: dtype: Datatype of the output NDArray elements. Args: start: The starting value of the NDArray. stop: The ending value of the NDArray. num: The number of elements in the NDArray. endpoint: Whether to include the `stop` value in the NDArray. Defaults to True. Returns: A NDArray of `dtype` with `num` linearly spaced elements between `start` and `stop`. """ var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(num)) if endpoint: var step: SIMD[dtype, 1] = (stop - start) / (num - 1) for i in range(num): result.data[i] = start + step * i else: var step: SIMD[dtype, 1] = (stop - start) / num for i in range(num): result.data[i] = start + step * i return result fn _linspace_parallel[ dtype: DType ]( start: SIMD[dtype, 1], stop: SIMD[dtype, 1], num: Int, endpoint: Bool = True ) raises -> NDArray[dtype]: """ Generate a linearly spaced NDArray of `num` elements between `start` and `stop` using parallelization. Parameters: dtype: Datatype of the NDArray elements. Args: start: The starting value of the NDArray. stop: The ending value of the NDArray. num: The number of elements in the NDArray. endpoint: Whether to include the `stop` value in the NDArray. Defaults to True. Returns: A NDArray of `dtype` with `num` linearly spaced elements between `start` and `stop`. """ var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(num)) alias nelts = simdwidthof[dtype]() if endpoint: var step: SIMD[dtype, 1] = (stop - start) / (num - 1.0) @parameter fn parallelized_linspace(idx: Int) -> None: result.data[idx] = start + step * idx parallelize[parallelized_linspace](num) else: var step: SIMD[dtype, 1] = (stop - start) / num @parameter fn parallelized_linspace1(idx: Int) -> None: result.data[idx] = start + step * idx parallelize[parallelized_linspace1](num) return result # ===------------------------------------------------------------------------===# # Logarithmic Spacing NDArray Generation # ===------------------------------------------------------------------------===# fn logspace[ dtype: DType ]( start: Scalar[dtype], stop: Scalar[dtype], num: Int, endpoint: Bool = True, base: Scalar[dtype] = 10.0, parallel: Bool = False, ) raises -> NDArray[dtype]: """ Generate a logrithmic spaced NDArray of `num` elements between `start` and `stop`. Wrapper function for _logspace_serial, _logspace_parallel functions. Raises: Error if dtype is an integer. Parameters: dtype: Datatype of the output array. Args: start: The starting value of the NDArray. stop: The ending value of the NDArray. num: The number of elements in the NDArray. endpoint: Whether to include the `stop` value in the NDArray. Defaults to True. base: Base value of the logarithm, defaults to 10. parallel: Specifies whether to calculate the logarithmic spaced values using parallelization. Returns: - A NDArray of `dtype` with `num` logarithmic spaced elements between `start` and `stop`. """ constrained[not dtype.is_integral()]() # if (is_inttype[dtype]() and is_inttype[dtype]()) or ( # is_floattype[dtype]() and is_inttype[dtype]() # ): # raise Error( # "Both input and output datatypes cannot be integers. If the input is a float, the output must also be a float." # ) if parallel: return _logspace_parallel[dtype]( start, stop, num, base, endpoint, ) else: return _logspace_serial[dtype]( start, stop, num, base, endpoint, ) fn _logspace_serial[ dtype: DType ]( start: Scalar[dtype], stop: Scalar[dtype], num: Int, base: Scalar[dtype], endpoint: Bool = True, ) raises -> NDArray[dtype]: """ Generate a logarithmic spaced NDArray of `num` elements between `start` and `stop` using naive for loop. Parameters: dtype: Datatype of the NDArray elements. Args: start: The starting value of the NDArray. stop: The ending value of the NDArray. num: The number of elements in the NDArray. base: Base value of the logarithm, defaults to 10. endpoint: Whether to include the `stop` value in the NDArray. Defaults to True. Returns: A NDArray of `dtype` with `num` logarithmic spaced elements between `start` and `stop`. """ var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(num)) if endpoint: var step: Scalar[dtype] = (stop - start) / (num - 1) for i in range(num): result.data[i] = base ** (start + step * i) else: var step: Scalar[dtype] = (stop - start) / num for i in range(num): result.data[i] = base ** (start + step * i) return result fn _logspace_parallel[ dtype: DType ]( start: Scalar[dtype], stop: Scalar[dtype], num: Int, base: Scalar[dtype], endpoint: Bool = True, ) raises -> NDArray[dtype]: """ Generate a logarithmic spaced NDArray of `num` elements between `start` and `stop` using parallelization. Parameters: dtype: Datatype of the NDArray elements. Args: start: The starting value of the NDArray. stop: The ending value of the NDArray. num: The number of elements in the NDArray. base: Base value of the logarithm, defaults to 10. endpoint: Whether to include the `stop` value in the NDArray. Defaults to True. Returns: A NDArray of `dtype` with `num` logarithmic spaced elements between `start` and `stop`. """ var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(num)) if endpoint: var step: Scalar[dtype] = (stop - start) / (num - 1) @parameter fn parallelized_logspace(idx: Int) -> None: result.data[idx] = base ** (start + step * idx) parallelize[parallelized_logspace](num) else: var step: Scalar[dtype] = (stop - start) / num @parameter fn parallelized_logspace1(idx: Int) -> None: result.data[idx] = base ** (start + step * idx) parallelize[parallelized_logspace1](num) return result # ! Outputs wrong values for Integer type, works fine for float type. fn geomspace[ dtype: DType ]( start: Scalar[dtype], stop: Scalar[dtype], num: Int, endpoint: Bool = True, ) raises -> NDArray[dtype]: """ Generate a NDArray of `num` elements between `start` and `stop` in a geometric series. Raises: Error if dtype is an integer. Parameters: dtype: Datatype of the input values. Args: start: The starting value of the NDArray. stop: The ending value of the NDArray. num: The number of elements in the NDArray. endpoint: Whether to include the `stop` value in the NDArray. Defaults to True. Returns: A NDArray of `dtype` with `num` geometrically spaced elements between `start` and `stop`. """ constrained[not dtype.is_integral()]() # if (is_inttype[dtype]() and is_inttype[dtype]()) or ( # is_floattype[dtype]() and is_inttype[dtype]() # ): # raise Error( # "Both input and output datatypes cannot be integers. If the input is a float, the output must also be a float." # ) var a: Scalar[dtype] = start if endpoint: var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(num)) var r: Scalar[dtype] = (stop / start) ** (1 / (num - 1)) for i in range(num): result.data[i] = a * r**i return result else: var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(num)) var r: Scalar[dtype] = (stop / start) ** (1 / (num)) for i in range(num): result.data[i] = a * r**i return result # ===------------------------------------------------------------------------===# # Commonly used NDArray Generation routines # ===------------------------------------------------------------------------===# # empty basically has to be either random or zero, can't return a purely empty matrix I think. fn empty[dtype: DType](*shape: Int) raises -> NDArray[dtype]: """ Generate a NDArray of given shape with arbitrary values. Parameters: dtype: Datatype of the NDArray elements. Args: shape: Shape of the NDArray. Returns: A NDArray of `dtype` with given `shape`. """ return NDArray[dtype](shape, fill=0) fn zeros[dtype: DType](*shape: Int) raises -> NDArray[dtype]: """ Generate a NDArray of zeros with given shape. Parameters: dtype: Datatype of the NDArray elements. Args: shape: Shape of the NDArray. Returns: A NDArray of `dtype` with given `shape`. """ return NDArray[dtype](shape, random=False) fn eye[dtype: DType](N: Int, M: Int) raises -> NDArray[dtype]: """ Return a 2-D NDArray with ones on the diagonal and zeros elsewhere. Parameters: dtype: Datatype of the NDArray elements. Args: N: Number of rows in the matrix. M: Number of columns in the matrix. Returns: A NDArray of `dtype` with size N x M and ones on the diagonals. """ var result: NDArray[dtype] = NDArray[dtype](N, M, random=False) var one = Scalar[dtype](1) for i in range(min(N, M)): result.store[1](i, i, val=one) return result fn identity[dtype: DType](N: Int) raises -> NDArray[dtype]: """ Generate an identity matrix of size N x N. Parameters: dtype: Datatype of the NDArray elements. Args: N: Size of the matrix. Returns: A NDArray of `dtype` with size N x N and ones on the diagonals. """ var result: NDArray[dtype] = NDArray[dtype](N, N, random=False) var one = Scalar[dtype](1) for i in range(N): result.store[1](i, i, val=one) return result fn ones[dtype: DType](*shape: Int) raises -> NDArray[dtype]: """ Generate a NDArray of ones with given shape filled with ones. Parameters: dtype: Datatype of the NDArray. Args: shape: Shape of the NDArray. Returns: A NDArray of `dtype` with given `shape`. """ var tens_shape: VariadicList[Int] = shape var res = NDArray[dtype](tens_shape) for i in range(res.num_elements()): res.store(i, SIMD[dtype, 1](1)) return res fn full[ dtype: DType ](*shape: Int, fill_value: Scalar[dtype]) raises -> NDArray[dtype]: """ Generate a NDArray of `fill_value` with given shape. Parameters: dtype: Datatype of the NDArray elements. Args: shape: Shape of the NDArray. fill_value: Value to be splatted over the NDArray. Returns: A NDArray of `dtype` with given `shape`. """ return NDArray[dtype](shape, fill=fill_value) fn full[ dtype: DType ](shape: VariadicList[Int], fill_value: Scalar[dtype]) raises -> NDArray[dtype]: """ Generate a NDArray of `fill_value` with given shape. Parameters: dtype: Datatype of the NDArray elements. Args: shape: Shape of the NDArray. fill_value: Value to be splatted over the NDArray. Returns: A NDArray of `dtype` with given `shape`. """ var tens_value: SIMD[dtype, 1] = SIMD[dtype, 1](fill_value) return NDArray[dtype](shape, fill=tens_value) fn diagflat[ dtype: DType ](inout v: NDArray[dtype], k: Int = 0) raises -> NDArray[dtype]: """ Generate a 2-D NDArray with the flattened input as the diagonal. Parameters: dtype: Datatype of the NDArray elements. Args: v: NDArray to be flattened and used as the diagonal. k: Diagonal offset. Returns: A 2-D NDArray with the flattened input as the diagonal. """ v.reshape(v.ndshape.ndsize, 1) var n: Int = v.ndshape.ndsize + abs(k) var result: NDArray[dtype] = NDArray[dtype](n, n, random=False) for i in range(n): print(n * i + i + k) result.store(n * i + i + k, v.data[i]) return result fn tri(): pass fn tril(): pass fn triu(): pass --- numojo/core/array_manipulation_routines.mojo --- """ Array manipulation routines. """ # ===----------------------------------------------------------------------=== # # ARRAY MANIPULATION ROUTINES # Last updated: 2024-08-03 # ===----------------------------------------------------------------------=== # fn copyto(): pass fn ndim[dtype: DType](array: NDArray[dtype]) -> Int: """ Returns the number of dimensions of the NDArray. Args: array: A NDArray. Returns: The number of dimensions of the NDArray. """ return array.ndim fn shape[dtype: DType](array: NDArray[dtype]) -> NDArrayShape: """ Returns the shape of the NDArray. Args: array: A NDArray. Returns: The shape of the NDArray. """ return array.ndshape fn size[dtype: DType](array: NDArray[dtype], axis: Int) raises -> Int: """ Returns the size of the NDArray. Args: array: A NDArray. axis: The axis to get the size of. Returns: The size of the NDArray. """ return array.ndshape[axis] fn reshape[ dtype: DType ]( inout array: NDArray[dtype], shape: VariadicList[Int], order: String = "C" ) raises: """ Reshapes the NDArray to given Shape. Raises: Error: If the number of elements do not match. Args: array: A NDArray. shape: Variadic integers of shape. order: Order of the array - Row major `C` or Column major `F`. """ var num_elements_new: Int = 1 var ndim_new: Int = 0 for i in shape: num_elements_new *= i ndim_new += 1 if array.ndshape.ndsize != num_elements_new: raise Error("Cannot reshape: Number of elements do not match.") var shape_new: List[Int] = List[Int]() for i in range(ndim_new): shape_new.append(shape[i]) var temp: Int = 1 for j in range(i + 1, ndim_new): # temp temp *= shape[j] array.ndim = ndim_new array.ndshape = NDArrayShape(shape=shape_new) array.stride = NDArrayStride(shape=shape_new, order=order) array.order = order fn ravel[dtype: DType](inout array: NDArray[dtype], order: String = "C") raises: """ Returns the raveled version of the NDArray. """ if array.ndim == 1: print("Array is already 1D") return else: if order == "C": reshape[dtype](array, array.ndshape.ndsize, order="C") else: reshape[dtype](array, array.ndshape.ndsize, order="F") fn where[ dtype: DType ]( inout x: NDArray[dtype], scalar: SIMD[dtype, 1], mask: NDArray[DType.bool] ) raises: """ Replaces elements in `x` with `scalar` where `mask` is True. Parameters: dtype: DType. Args: x: A NDArray. scalar: A SIMD value. mask: A NDArray. """ for i in range(x.ndshape.ndsize): if mask.data[i] == True: x.data.store(i, scalar) # TODO: do it with vectorization fn where[ dtype: DType ](inout x: NDArray[dtype], y: NDArray[dtype], mask: NDArray[DType.bool]) raises: """ Replaces elements in `x` with elements from `y` where `mask` is True. Raises: ShapeMismatchError: If the shapes of `x` and `y` do not match. Parameters: dtype: DType. Args: x: NDArray[dtype]. y: NDArray[dtype]. mask: NDArray[DType.bool]. """ if x.ndshape != y.ndshape: raise Error("Shape mismatch error: x and y must have the same shape") for i in range(x.ndshape.ndsize): if mask.data[i] == True: x.data.store(i, y.data[i]) fn flip[dtype: DType](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Flips the NDArray along the given axis. Parameters: dtype: DType. Args: array: A NDArray. Returns: The flipped NDArray. """ if array.ndim != 1: raise Error("Flip is only supported for 1D arrays") var result: NDArray[dtype] = NDArray[dtype]( shape=array.ndshape, order=array.order ) for i in range(array.ndshape.ndsize): result.data.store(i, array.data[array.ndshape.ndsize - i - 1]) return result --- numojo/core/constants.mojo --- """ Constants """ # ===----------------------------------------------------------------------=== # # Implements Constants # Last updated: 2024-06-16 # ===----------------------------------------------------------------------=== # @value struct Constants(AnyType): """Define constants. Use alias for compile time evaluation of indefinite precision. ```mojo import numojo as nm fn main(): var pi: Float64 = nm.pi print("Float64:", pi*pi*pi*pi*pi*pi) print("Literal:", nm.pi*nm.pi*nm.pi*nm.pi*nm.pi*nm.pi) ``` ```console Float64: 961.38919357530415 Literal: 961.38919357530449 ``` """ alias c = 299_792_458 alias pi = 3.1415926535897932384626433832795028841971693937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555954930381966446229489 alias e = 2.71828182845904523536028747135266249775724609375 fn __init__(inout self): """ Initializes the constants. """ pass fn __del__(owned self): """ Deletes the constants. """ pass --- numojo/core/datatypes.mojo --- """ Datatypes Module - Implements datatypes aliases, conversions """ # ===----------------------------------------------------------------------=== # # Datatypes Module - Implements datatypes aliases, conversions # Last updated: 2024-06-18 # ===----------------------------------------------------------------------=== # # Rust-like data type alias """alias for `DType.int8`""" alias i8 = DType.int8 """Data type alias for DType.int8""" alias i16 = DType.int16 """Data type alias for DType.int16""" alias i32 = DType.int32 """Data type alias for DType.int32""" alias i64 = DType.int64 """Data type alias for DType.int64""" alias u8 = DType.uint8 """Data type alias for DType.uint8""" alias u16 = DType.uint16 """Data type alias for DType.uint16""" alias u32 = DType.uint32 """Data type alias for DType.uint32""" alias u64 = DType.uint64 """Data type alias for DType.uint64""" alias f16 = DType.float16 """Data type alias for DType.float16""" alias f32 = DType.float32 """Data type alias for DType.float32""" alias f64 = DType.float64 """Data type alias for DType.float64""" --- numojo/core/ndarray.mojo --- """ Implements N-Dimensional Array """ # ===----------------------------------------------------------------------=== # # Implements ROW MAJOR N-DIMENSIONAL ARRAYS # Last updated: 2024-07-14 # ===----------------------------------------------------------------------=== # """ # TODO 1) Add NDArray, NDArrayShape constructor overload for List, VariadicList types etc to cover more cases 3) Generalize mdot, rdot to take any IxJx...xKxL and LxMx...xNxP matrix and matmul it into IxJx..xKxMx...xNxP array. 4) Vectorize row(), col() to retrieve rows and columns for 2D arrays 5) Add __getitem__() overload for (Slice, Int) 7) Add vectorization for _get_index 8) Write more explanatory Error("") statements 9) Vectorize the for loops inside getitem or move these checks to compile time to try and remove the overhead from constantly checking 10) Add List[Int] and Variadic[Int] Shape args for __init__ to make it more flexible """ from builtin.type_aliases import AnyLifetime from random import rand, random_si64, random_float64 from builtin.math import pow from builtin.bool import all as allb from builtin.bool import any as anyb from algorithm import parallelize, vectorize import . _array_funcs as _af from ..math.statistics.stats import mean, prod, sum from ..math.statistics.cumulative_reduce import ( cumsum, cumprod, cummean, maxT, minT, ) import . sort as sort import .. math as math from ..traits import Backend from ..math.check import any, all from ..math.arithmetic import abs from .ndarray_utils import ( _get_index, _traverse_iterative, to_numpy, bool_to_numeric, ) from ..math.math_funcs import Vectorized from .utility_funcs import is_inttype from ..math.linalg.matmul import matmul_parallelized from .array_manipulation_routines import reshape @register_passable("trivial") struct NDArrayShape[dtype: DType = DType.int32](Stringable): """Implements the NDArrayShape.""" # Fields var ndsize: Int """Total no of elements in the corresponding array.""" var ndshape: DTypePointer[dtype] """Shape of the corresponding array.""" var ndlen: Int """Length of ndshape.""" @always_inline("nodebug") fn __init__(inout self, *shape: Int) raises: """ Initializes the NDArrayShape with variable shape dimensions. Args: shape: Variable number of integers representing the shape dimensions. """ self.ndsize = 1 self.ndlen = len(shape) self.ndshape = DTypePointer[dtype].alloc(len(shape)) memset_zero(self.ndshape, len(shape)) for i in range(len(shape)): self.ndshape[i] = shape[i] self.ndsize *= shape[i] @always_inline("nodebug") fn __init__(inout self, *shape: Int, size: Int) raises: """ Initializes the NDArrayShape with variable shape dimensions and a specified size. Args: shape: Variable number of integers representing the shape dimensions. size: The total number of elements in the array. """ self.ndsize = size self.ndlen = len(shape) self.ndshape = DTypePointer[dtype].alloc(len(shape)) memset_zero(self.ndshape, len(shape)) var count: Int = 1 for i in range(len(shape)): self.ndshape[i] = shape[i] count *= shape[i] if count != size: raise Error("Cannot create NDArray: shape and size mismatch") @always_inline("nodebug") fn __init__(inout self, shape: List[Int]): """ Initializes the NDArrayShape with a list of shape dimensions. Args: shape: A list of integers representing the shape dimensions. """ self.ndsize = 1 self.ndlen = len(shape) self.ndshape = DTypePointer[dtype].alloc(len(shape)) memset_zero(self.ndshape, len(shape)) for i in range(len(shape)): self.ndshape[i] = shape[i] self.ndsize *= shape[i] @always_inline("nodebug") fn __init__(inout self, shape: List[Int], size: Int) raises: """ Initializes the NDArrayShape with a list of shape dimensions and a specified size. Args: shape: A list of integers representing the shape dimensions. size: The specified size of the NDArrayShape. """ self.ndsize = ( size # maybe I should add a check here to make sure it matches ) self.ndlen = len(shape) self.ndshape = DTypePointer[dtype].alloc(len(shape)) memset_zero(self.ndshape, len(shape)) var count: Int = 1 for i in range(len(shape)): self.ndshape[i] = shape[i] count *= shape[i] if count != size: raise Error("Cannot create NDArray: shape and size mismatch") @always_inline("nodebug") fn __init__(inout self, shape: VariadicList[Int]): """ Initializes the NDArrayShape with a list of shape dimensions. Args: shape: A list of integers representing the shape dimensions. """ self.ndsize = 1 self.ndlen = len(shape) self.ndshape = DTypePointer[dtype].alloc(len(shape)) memset_zero(self.ndshape, len(shape)) for i in range(len(shape)): self.ndshape[i] = shape[i] self.ndsize *= shape[i] @always_inline("nodebug") fn __init__(inout self, shape: VariadicList[Int], size: Int) raises: """ Initializes the NDArrayShape with a list of shape dimensions and a specified size. Args: shape: A list of integers representing the shape dimensions. size: The specified size of the NDArrayShape. """ self.ndsize = ( size # maybe I should add a check here to make sure it matches ) self.ndlen = len(shape) self.ndshape = DTypePointer[dtype].alloc(len(shape)) memset_zero(self.ndshape, len(shape)) var count: Int = 1 for i in range(len(shape)): self.ndshape[i] = shape[i] count *= shape[i] if count != size: raise Error("Cannot create NDArray: shape and size mismatch") @always_inline("nodebug") fn __init__(inout self, shape: NDArrayShape) raises: """ Initializes the NDArrayShape with another NDArrayShape. Args: shape: Another NDArrayShape to initialize from. """ self.ndsize = shape.ndsize self.ndlen = shape.ndlen self.ndshape = DTypePointer[dtype].alloc(shape.ndlen) memset_zero(self.ndshape, shape.ndlen) for i in range(shape.ndlen): self.ndshape[i] = shape[i] fn __copy__(inout self, other: Self): """ Copy from other into self. """ self.ndsize = other.ndsize self.ndlen = other.ndlen self.ndshape = DTypePointer[dtype].alloc(other.ndlen) memcpy(self.ndshape, other.ndshape, other.ndlen) @always_inline("nodebug") fn __getitem__(self, index: Int) raises -> Int: """ Get shape at specified index. """ if index >= self.ndlen: raise Error("Index out of bound") if index >= 0: return self.ndshape[index].__int__() else: return self.ndshape[self.ndlen + index].__int__() @always_inline("nodebug") fn __setitem__(inout self, index: Int, val: Int) raises: """ Set shape at specified index. """ if index >= self.ndlen: raise Error("Index out of bound") if index >= 0: self.ndshape[index] = val else: self.ndshape[self.ndlen + index] = val @always_inline("nodebug") fn size(self) -> Int: """ Get Size of array described by arrayshape. """ return self.ndsize @always_inline("nodebug") fn len(self) -> Int: """ Get number of dimensions of the array described by arrayshape. """ return self.ndlen @always_inline("nodebug") fn __str__(self: Self) -> String: """ Return a string of the shape of the array described by arrayshape. """ var result: String = "Shape: [" for i in range(self.ndlen): if i == self.ndlen - 1: result += self.ndshape[i].__str__() else: result += self.ndshape[i].__str__() + ", " return result + "]" @always_inline("nodebug") fn __eq__(self, other: Self) raises -> Bool: """ Check if two arrayshapes have identical dimensions. """ for i in range(self.ndlen): if self[i] != other[i]: return False return True @always_inline("nodebug") fn __ne__(self, other: Self) raises -> Bool: """ Check if two arrayshapes don't have identical dimensions. """ return not self.__eq__(other) @always_inline("nodebug") fn __contains__(self, val: Int) raises -> Bool: """ Check if any of the dimensions are equal to a value. """ for i in range(self.ndlen): if self[i] == val: return True return False # can be used for vectorized index calculation @always_inline("nodebug") fn load[width: Int = 1](self, index: Int) raises -> SIMD[dtype, width]: """ SIMD load dimensional information. """ # if index >= self.ndlen: # raise Error("Index out of bound") return self.ndshape.load[width=width](index) # can be used for vectorized index retrieval @always_inline("nodebug") fn store[ width: Int = 1 ](inout self, index: Int, val: SIMD[dtype, width]) raises: """ SIMD store dimensional information. """ # if index >= self.ndlen: # raise Error("Index out of bound") self.ndshape.store[width=width](index, val) @always_inline("nodebug") fn load_int(self, index: Int) -> Int: """ SIMD load dimensional information. """ return self.ndshape.load[width=1](index).__int__() @always_inline("nodebug") fn store_int(inout self, index: Int, val: Int): """ SIMD store dimensional information. """ self.ndshape.store[width=1](index, val) @register_passable("trivial") struct NDArrayStride[dtype: DType = DType.int32](Stringable): """Implements the NDArrayStride.""" # Fields var ndoffset: Int var ndstride: DTypePointer[dtype] var ndlen: Int @always_inline("nodebug") fn __init__( inout self, *stride: Int, offset: Int = 0 ): # maybe we should add checks for offset? self.ndoffset = offset self.ndlen = stride.__len__() self.ndstride = DTypePointer[dtype].alloc(stride.__len__()) for i in range(stride.__len__()): self.ndstride[i] = stride[i] @always_inline("nodebug") fn __init__(inout self, stride: List[Int], offset: Int = 0): self.ndoffset = offset self.ndlen = stride.__len__() self.ndstride = DTypePointer[dtype].alloc(self.ndlen) memset_zero(self.ndstride, self.ndlen) for i in range(self.ndlen): self.ndstride[i] = stride[i] @always_inline("nodebug") fn __init__(inout self, stride: VariadicList[Int], offset: Int = 0): self.ndoffset = offset self.ndlen = stride.__len__() self.ndstride = DTypePointer[dtype].alloc(self.ndlen) memset_zero(self.ndstride, self.ndlen) for i in range(self.ndlen): self.ndstride[i] = stride[i] @always_inline("nodebug") fn __init__(inout self, stride: NDArrayStride): self.ndoffset = stride.ndoffset self.ndlen = stride.ndlen self.ndstride = DTypePointer[dtype].alloc(stride.ndlen) for i in range(self.ndlen): self.ndstride[i] = stride.ndstride[i] @always_inline("nodebug") fn __init__( inout self, stride: NDArrayStride, offset: Int = 0 ): # separated two methods to remove if condition self.ndoffset = offset self.ndlen = stride.ndlen self.ndstride = DTypePointer[dtype].alloc(stride.ndlen) for i in range(self.ndlen): self.ndstride[i] = stride.ndstride[i] @always_inline("nodebug") fn __init__( inout self, *shape: Int, offset: Int = 0, order: String = "C" ) raises: self.ndoffset = offset self.ndlen = shape.__len__() self.ndstride = DTypePointer[dtype].alloc(self.ndlen) memset_zero(self.ndstride, self.ndlen) if order == "C": for i in range(self.ndlen): var temp: Int = 1 for j in range(i + 1, self.ndlen): temp = temp * shape[j] self.ndstride[i] = temp elif order == "F": self.ndstride[0] = 1 for i in range(0, self.ndlen - 1): self.ndstride[i + 1] = self.ndstride[i] * shape[i] else: raise Error( "Invalid order: Only C style row major `C` & Fortran style" " column major `F` are supported" ) @always_inline("nodebug") fn __init__( inout self, shape: List[Int], offset: Int = 0, order: String = "C" ) raises: self.ndoffset = offset self.ndlen = shape.__len__() self.ndstride = DTypePointer[dtype].alloc(self.ndlen) memset_zero(self.ndstride, self.ndlen) if order == "C": for i in range(self.ndlen): var temp: Int = 1 for j in range(i + 1, self.ndlen): temp = temp * shape[j] self.ndstride[i] = temp elif order == "F": self.ndstride[0] = 1 for i in range(0, self.ndlen - 1): self.ndstride[i + 1] = self.ndstride[i] * shape[i] else: raise Error( "Invalid order: Only C style row major `C` & Fortran style" " column major `F` are supported" ) @always_inline("nodebug") fn __init__( inout self, shape: VariadicList[Int], offset: Int = 0, order: String = "C", ) raises: self.ndoffset = offset self.ndlen = shape.__len__() self.ndstride = DTypePointer[dtype].alloc(self.ndlen) memset_zero(self.ndstride, self.ndlen) if order == "C": for i in range(self.ndlen): var temp: Int = 1 for j in range(i + 1, self.ndlen): temp = temp * shape[j] self.ndstride[i] = temp elif order == "F": self.ndstride[0] = 1 for i in range(0, self.ndlen - 1): self.ndstride[i + 1] = self.ndstride[i] * shape[i] else: raise Error( "Invalid order: Only C style row major `C` & Fortran style" " column major `F` are supported" ) @always_inline("nodebug") fn __init__( inout self, owned shape: NDArrayShape, offset: Int = 0, order: String = "C", ) raises: self.ndoffset = offset self.ndlen = shape.ndlen self.ndstride = DTypePointer[dtype].alloc(shape.ndlen) memset_zero(self.ndstride, shape.ndlen) if order == "C": if shape.ndlen == 1: self.ndstride[0] = 1 else: for i in range(shape.ndlen): var temp: Int = 1 for j in range(i + 1, shape.ndlen): temp = temp * shape[j] self.ndstride[i] = temp elif order == "F": self.ndstride[0] = 1 for i in range(0, self.ndlen - 1): self.ndstride[i + 1] = self.ndstride[i] * shape[i] else: raise Error( "Invalid order: Only C style row major `C` & Fortran style" " column major `F` are supported" ) fn __copy__(inout self, other: Self): self.ndoffset = other.ndoffset self.ndlen = other.ndlen self.ndstride = DTypePointer[dtype].alloc(other.ndlen) memcpy(self.ndstride, other.ndstride, other.ndlen) @always_inline("nodebug") fn __getitem__(self, index: Int) raises -> Int: if index >= self.ndlen: raise Error("Index out of bound") if index >= 0: return self.ndstride[index].__int__() else: return self.ndstride[self.ndlen + index].__int__() @always_inline("nodebug") fn __setitem__(inout self, index: Int, val: Int) raises: if index >= self.ndlen: raise Error("Index out of bound") if index >= 0: self.ndstride[index] = val else: self.ndstride[self.ndlen + index] = val @always_inline("nodebug") fn len(self) -> Int: return self.ndlen @always_inline("nodebug") fn __str__(self: Self) -> String: var result: String = "Stride: [" for i in range(self.ndlen): if i == self.ndlen - 1: result += self.ndstride[i].__str__() else: result += self.ndstride[i].__str__() + ", " return result + "]" @always_inline("nodebug") fn __eq__(self, other: Self) raises -> Bool: for i in range(self.ndlen): if self[i] != other[i]: return False return True @always_inline("nodebug") fn __ne__(self, other: Self) raises -> Bool: return not self.__eq__(other) @always_inline("nodebug") fn __contains__(self, val: Int) raises -> Bool: for i in range(self.ndlen): if self[i] == val: return True return False @always_inline("nodebug") fn load[width: Int = 1](self, index: Int) raises -> SIMD[dtype, width]: # if index >= self.ndlen: # raise Error("Index out of bound") return self.ndstride.load[width=width](index) @always_inline("nodebug") fn store[ width: Int = 1 ](inout self, index: Int, val: SIMD[dtype, width]) raises: # if index >= self.ndlen: # raise Error("Index out of bound") self.ndstride.store[width=width](index, val) @always_inline("nodebug") fn load_unsafe[width: Int = 1](self, index: Int) -> Int: return self.ndstride.load[width=width](index).__int__() @always_inline("nodebug") fn store_unsafe[ width: Int = 1 ](inout self, index: Int, val: SIMD[dtype, width]): self.ndstride.store[width=width](index, val) @value struct _NDArrayIter[ is_mutable: Bool, //, lifetime: AnyLifetime[is_mutable].type, dtype: DType, forward: Bool = True, ]: """Iterator for NDArray. Parameters: is_mutable: Whether the iterator is mutable. lifetime: The lifetime of the underlying NDArray data. dtype: The data type of the item. forward: The iteration direction. `False` is backwards. """ var index: Int var array: NDArray[dtype] var length: Int fn __init__( inout self, array: NDArray[dtype], length: Int, ): self.index = 0 if forward else length self.length = length self.array = array fn __iter__(self) -> Self: return self fn __next__(inout self) raises -> NDArray[dtype]: @parameter if forward: var current_index = self.index self.index += 1 return self.array.__getitem__(current_index) else: var current_index = self.index self.index -= 1 return self.array.__getitem__(current_index) fn __len__(self) -> Int: @parameter if forward: return self.length - self.index else: return self.index # ===----------------------------------------------------------------------===# # NDArray # ===----------------------------------------------------------------------===# struct NDArray[dtype: DType = DType.float64]( Stringable, Representable, CollectionElement, Sized ): """The N-dimensional array (NDArray). Parameters: dtype: Type of item in NDArray. Default type is DType.float64. The array can be uniquely defined by the following: 1. The data buffer of all items. 2. The shape of the array. 3. The stride in each dimension 4. The number of dimensions 5. The datatype of the elements 6. The order of the array: Row vs Columns major """ var data: DTypePointer[dtype] """Data buffer of the items in the NDArray.""" var ndim: Int """Number of Dimensions.""" var ndshape: NDArrayShape """Size and shape of NDArray.""" var stride: NDArrayStride """Contains offset, strides.""" var coefficient: NDArrayStride """Contains offset, coefficient.""" var datatype: DType """The datatype of memory.""" var order: String "Memory layout of array C (C order row major) or F (Fortran order col major)." alias simd_width: Int = simdwidthof[dtype]() # """Vector size of the data type.""" # ===-------------------------------------------------------------------===# # Life cycle methods # ===-------------------------------------------------------------------===# # default constructor @always_inline("nodebug") fn __init__( inout self, *shape: Int, random: Bool = False, order: String = "C" ) raises: """ NDArray initialization for variadic shape. Args: shape: Variadic shape. random: Set the values randomly. order: Memory order C or F. Example: NDArray[DType.int8](3,2,4) Returns an zero array with shape 3 x 2 x 4. """ self.ndim = shape.__len__() # I cannot name self.ndshape as self.shape as lsp gives unrecognized variable error self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) # I gotta make coefficients empty, but let's just keep it like for now self.coefficient = NDArrayStride(shape, offset=0, order=order) self.datatype = dtype self.order = order self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) memset_zero(self.data, self.ndshape.ndsize) if random: rand[dtype](self.data, self.ndshape.ndsize) @always_inline("nodebug") fn __init__( inout self, shape: List[Int], random: Bool = False, order: String = "C", ) raises: """ NDArray initialization for list shape. Args: shape: List of shape. random: Set the values randomly. order: Memory order C or F. Example: NDArray[DType.float16](VariadicList[Int](3, 2, 4), random=True) Returns an array with shape 3 x 2 x 4 and randomly values. """ self.ndim = shape.__len__() self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) self.coefficient = NDArrayStride(shape, offset=0, order=order) self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) memset_zero(self.data, self.ndshape.ndsize) self.datatype = dtype self.order = order if random: rand[dtype](self.data, self.ndshape.ndsize) @always_inline("nodebug") fn __init__( inout self, shape: VariadicList[Int], random: Bool = False, order: String = "C", ) raises: """ NDArray initialization for variadic shape. Args: shape: Variadic List shape. random: Set the values randomly. order: Memory order C or F. Example: NDArray[DType.float16](VariadicList[Int](3, 2, 4), random=True) Returns an array with shape 3 x 2 x 4 and randomly values. """ self.ndim = shape.__len__() self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) self.coefficient = NDArrayStride(shape, offset=0, order=order) self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) memset_zero(self.data, self.ndshape.ndsize) self.datatype = dtype self.order = order if random: rand[dtype](self.data, self.ndshape.ndsize) @always_inline("nodebug") fn __init__( inout self, *shape: Int, fill: Scalar[dtype], order: String = "C", ) raises: """ NDArray initialization for variadic shape with option to fill. Args: shape: Variadic shape. fill: Set all the values to this. order: Memory order C or F. Example: NDArray[DType.float16](VariadicList[Int](3, 2, 4), random=True) Returns an array with shape 3 x 2 x 4 and randomly values. """ self.ndim = shape.__len__() self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) self.coefficient = NDArrayStride(shape, offset=0, order=order) self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) memset_zero(self.data, self.ndshape.ndsize) self.datatype = dtype self.order = order for i in range(self.ndshape.ndsize): self.data[i] = fill @always_inline("nodebug") fn __init__( inout self, shape: List[Int], fill: Scalar[dtype], order: String = "C", ) raises: """ NDArray initialization for variadic shape with option to fill. Args: shape: List of shape. fill: Set all the values to this. order: Memory order C or F. Example: NDArray[DType.float16](VariadicList[Int](3, 2, 4), random=True) Returns an array with shape 3 x 2 x 4 and randomly values. """ self.ndim = shape.__len__() self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) self.coefficient = NDArrayStride(shape, offset=0, order=order) self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) memset_zero(self.data, self.ndshape.ndsize) self.datatype = dtype self.order = order for i in range(self.ndshape.ndsize): self.data[i] = fill @always_inline("nodebug") fn __init__( inout self, shape: VariadicList[Int], fill: Scalar[dtype], order: String = "C", ) raises: """ NDArray initialization for List of shape with option to fill. Args: shape: Variadic List of shape. fill: Set all the values to this. order: Memory order C or F. Example: NDArray[DType.float16](VariadicList[Int](3, 2, 4), random=True) Returns an array with shape 3 x 2 x 4 and randomly values. """ self.ndim = shape.__len__() self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) self.coefficient = NDArrayStride(shape, offset=0, order=order) self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) memset_zero(self.data, self.ndshape.ndsize) self.datatype = dtype self.order = order for i in range(self.ndshape.ndsize): self.data[i] = fill @always_inline("nodebug") fn __init__( inout self, shape: NDArrayShape, random: Bool = False, order: String = "C", ) raises: """ NDArray initialization for NDArrayShape. Args: shape: Variadic shape. random: Set all the values randomly. order: Memory order C or F. Example: NDArray[DType.float16](VariadicList[Int](3, 2, 4), random=True) Returns an array with shape 3 x 2 x 4 and randomly values. """ self.ndim = shape.ndlen self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, order=order) self.coefficient = NDArrayStride(shape, order=order) self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) memset_zero(self.data, self.ndshape.ndsize) self.datatype = dtype self.order = order if random: rand[dtype](self.data, self.ndshape.ndsize) @always_inline("nodebug") fn __init__( inout self, shape: NDArrayShape, fill: Scalar[dtype], order: String = "C", ) raises: """ NDArray initialization for NDArrayShape with option to fill. Args: shape: Variadic shape. fill: Set all the the values to this. order: Memory order C or F. Example: NDArray[DType.float16](VariadicList[Int](3, 2, 4), random=True) Returns an array with shape 3 x 2 x 4 and randomly values. """ self.ndim = shape.ndlen self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, order=order) self.coefficient = NDArrayStride(shape, order=order) self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) memset_zero(self.data, self.ndshape.ndsize) self.datatype = dtype self.order = order for i in range(self.ndshape.ndsize): self.data[i] = fill fn __init__( inout self, data: List[SIMD[dtype, 1]], shape: List[Int], order: String = "C", ) raises: """ NDArray initialization from list of data. Args: data: List of data. shape: List of shape. order: Memory order C or F. Example: `NDArray[DType.int8](List[Int8](1,2,3,4,5,6), shape=List[Int](2,3))` Returns an array with shape 3 x 2 with input values. """ self.ndim = shape.__len__() self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) self.coefficient = NDArrayStride(shape, offset=0, order=order) self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) self.datatype = dtype self.order = order memset_zero(self.data, self.ndshape.ndsize) for i in range(self.ndshape.ndsize): self.data[i] = data[i] @always_inline("nodebug") fn __init__( inout self, *shape: Int, min: Scalar[dtype], max: Scalar[dtype], order: String = "C", ) raises: """ NDArray initialization for variadic shape with random values between min and max. Args: shape: Variadic shape. min: Minimum value for the NDArray. max: Maximum value for the NDArray. order: Memory order C or F. Example: ```mojo import numojo as nm fn main() raises: var A = nm.NDArray[DType.float16](2, 2, min=0.0, max=10.0) print(A) ``` A is an array with shape 2 x 2 and randomly values between 0 and 10. The output goes as follows. ```console [[ 6.046875 6.98046875 ] [ 6.6484375 1.736328125 ]] 2-D array Shape: [2, 2] DType: float16 ``` """ self.ndim = shape.__len__() self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) self.coefficient = NDArrayStride(shape, offset=0, order=order) self.datatype = dtype self.order = order self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) if dtype.is_floating_point(): for i in range(self.ndshape.ndsize): self.data.store( i, random_float64( min.cast[DType.float64](), max.cast[DType.float64]() ).cast[dtype](), ) elif dtype.is_integral(): for i in range(self.ndshape.ndsize): self.data.store( i, random_si64(int(min), int(max)).cast[dtype]() ) @always_inline("nodebug") fn __init__( inout self, shape: List[Int], min: Scalar[dtype], max: Scalar[dtype], order: String = "C", ) raises: """ NDArray initialization for list shape with random values between min and max. Args: shape: List of shape. min: Minimum value for the NDArray. max: Maximum value for the NDArray. order: Memory order C or F. Example: ```mojo import numojo as nm fn main() raises: var A = nm.NDArray[DType.float16](List[Int](2, 2), min=0.0, max=10.0) print(A) ``` A is an array with shape 2 x 2 and randomly values between 0 and 10. The output goes as follows. ```console [[ 6.046875 6.98046875 ] [ 6.6484375 1.736328125 ]] 2-D array Shape: [2, 2] DType: float16 ``` """ self.ndim = shape.__len__() self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(shape, offset=0, order=order) self.coefficient = NDArrayStride(shape, offset=0, order=order) self.datatype = dtype self.order = order self.data = DTypePointer[dtype].alloc(self.ndshape.ndsize) if dtype.is_floating_point(): for i in range(self.ndshape.ndsize): self.data.store( i, random_float64( min.cast[DType.float64](), max.cast[DType.float64]() ).cast[dtype](), ) elif dtype.is_integral(): for i in range(self.ndshape.ndsize): self.data.store( i, random_si64(int(min), int(max)).cast[dtype]() ) fn __init__( inout self, text: String, order: String = "C", ) raises: """ NDArray initialization from string representation of an ndarray. The shape can be inferred from the string representation. The literals will be casted to the dtype of the NDArray. Note: StringLiteral is also allowed as input as it is coerced to String type before it is passed into the function. Example: ```mojo import numojo as nm fn main() raises: var A = nm.NDArray[DType.int8]("[[[1,2],[3,4]],[[5,6],[7,8]]]") var B = nm.NDArray[DType.float16]("[[1,2,3,4],[5,6,7,8]]") var C = nm.NDArray[DType.float32]("[0.1, -2.3, 41.5, 19.29145, -199]") var D = nm.NDArray[DType.int32]("[0.1, -2.3, 41.5, 19.29145, -199]") print(A) print(B) print(C) print(D) ``` The output goes as follows. Note that the numbers are automatically casted to the dtype of the NDArray. ```console [[[ 1 2 ] [ 3 4 ]] [[ 5 6 ] [ 7 8 ]]] 3-D array Shape: [2, 2, 2] DType: int8 [[ 1.0 2.0 3.0 4.0 ] [ 5.0 6.0 7.0 8.0 ]] 2-D array Shape: [2, 4] DType: float16 [ 0.10000000149011612 2.2999999523162842 41.5 19.291450500488281 199.0 ] 1-D array Shape: [5] DType: float32 [ 0 2 41 19 199 ] 1-D array Shape: [5] DType: int32 ``` Args: text: String representation of an ndarray. order: Memory order C or F. """ var data = List[Scalar[dtype]]() """Inferred data buffer of the array""" var shape = List[Int]() """Inferred shape of the array""" var bytes = text.as_bytes() var ndim = 0 """Inferred number_as_str of dimensions.""" var level = 0 """Current level of the array.""" var number_as_str: String = "" for i in range(len(bytes)): var b = bytes[i] if chr(int(b)) == "[": level += 1 ndim = max(ndim, level) if len(shape) < ndim: shape.append(0) shape[level - 1] = 0 if isdigit(b) or chr(int(b)) == ".": number_as_str = number_as_str + chr(int(b)) if (chr(int(b)) == ",") or (chr(int(b)) == "]"): if number_as_str != "": var number = atof(number_as_str).cast[dtype]() data.append(number) # Add the number to the data buffer number_as_str = "" # Clean the number cache shape[-1] = shape[-1] + 1 if chr(int(b)) == "]": level = level - 1 if level < 0: raise ("Unmatched left and right brackets!") if level > 0: shape[level - 1] = shape[level - 1] + 1 self.__init__(data=data, shape=shape, order=order) # Why do these last two constructors exist? # constructor when rank, ndim, weights, first_index(offset) are known fn __init__( inout self, ndim: Int, offset: Int, size: Int, shape: List[Int], strides: List[Int], coefficient: List[Int], order: String = "C", ) raises: """ Extremely specific NDArray initializer. """ self.ndim = ndim self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(stride=strides, offset=0) self.coefficient = NDArrayStride(stride=coefficient, offset=offset) self.datatype = dtype self.order = order self.data = DTypePointer[dtype].alloc(size) memset_zero(self.data, size) # for creating views fn __init__( inout self, data: DTypePointer[dtype], ndim: Int, offset: Int, shape: List[Int], strides: List[Int], coefficient: List[Int], order: String = "C", ) raises: """ Extremely specific NDArray initializer. """ self.ndim = ndim self.ndshape = NDArrayShape(shape) self.stride = NDArrayStride(strides, offset=0, order=order) self.coefficient = NDArrayStride( coefficient, offset=offset, order=order ) self.datatype = dtype self.order = order self.data = data + self.stride.ndoffset @always_inline("nodebug") fn __copyinit__(inout self, other: Self): """ Copy other into self. """ self.ndim = other.ndim self.ndshape = other.ndshape self.stride = other.stride self.coefficient = other.coefficient self.datatype = other.datatype self.order = other.order self.data = DTypePointer[dtype].alloc(other.ndshape.size()) memcpy(self.data, other.data, other.ndshape.size()) @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): """ Move other into self. """ self.ndim = existing.ndim self.ndshape = existing.ndshape self.stride = existing.stride self.coefficient = existing.coefficient self.datatype = existing.datatype self.order = existing.order self.data = existing.data @always_inline("nodebug") fn __del__(owned self): self.data.free() # ===-------------------------------------------------------------------===# # Set and get dunders # ===-------------------------------------------------------------------===# @always_inline("nodebug") fn __setitem__(inout self, index: Int, val: SIMD[dtype, 1]) raises: """ Set the value of a single index. """ if index >= self.ndshape.ndsize: raise Error("Invalid index: index out of bound") if index >= 0: self.data.store[width=1](index, val) else: self.data.store[width=1](index + self.ndshape.ndsize, val) @always_inline("nodebug") fn __setitem__(inout self, *index: Int, val: SIMD[dtype, 1]) raises: """ Set the value at the index list. """ if index.__len__() != self.ndim: raise Error("Error: Length of Indices do not match the shape") for i in range(index.__len__()): if index[i] >= self.ndshape[i]: raise Error("Error: Elements of `index` exceed the array shape") var idx: Int = _get_index(index, self.coefficient) self.data.store[width=1](idx, val) @always_inline("nodebug") fn __setitem__( inout self, index: List[Int], val: SIMD[dtype, 1], ) raises: """ Set the value at the index list. """ if index.__len__() != self.ndim: raise Error("Error: Length of Indices do not match the shape") for i in range(index.__len__()): if index[i] >= self.ndshape[i]: raise Error("Error: Elements of `index` exceed the array shape") var idx: Int = _get_index(index, self.coefficient) self.data.store[width=1](idx, val) @always_inline("nodebug") fn __setitem__( inout self, index: VariadicList[Int], val: SIMD[dtype, 1], ) raises: """ Set the value at the index corisponding to the varaidic list. """ if index.__len__() != self.ndim: raise Error("Error: Length of Indices do not match the shape") for i in range(index.__len__()): if index[i] >= self.ndshape[i]: raise Error("Error: Elements of `index` exceed the array shape") var idx: Int = _get_index(index, self.coefficient) self.data.store[width=1](idx, val) fn get_scalar(self, index: Int) raises -> SIMD[dtype, 1]: """ Linearly retreive a value from the underlying Pointer. Example: ```console > Array.get_scalar(15) ``` returns the item of index 15 from the array's data buffer. Not that it is different from `item()` as `get_scalar` does not checked against C-order or F-order. ```console > # A is a 3x3 matrix, F-order (column-major) > A.get_scalar(3) # Row 0, Col 1 > A.item(3) # Row 1, Col 0 ``` """ if index >= self.ndshape.ndsize: raise Error("Invalid index: index out of bound") if index >= 0: return self.data.load[width=1](index) else: return self.data.load[width=1](index + self.ndshape.ndsize) fn __getitem__(self, idx: Int) raises -> Self: """ Retreive a slice of the array corrisponding to the index at the first dimension. Example: `arr[1]` returns the second row of the array. """ var slice_list = List[Slice]() slice_list.append(Slice(idx, idx + 1)) # 0-d array always return itself if self.ndim == 0: return self if self.ndim > 1: for i in range(1, self.ndim): var size_at_dim: Int = self.ndshape[i] slice_list.append(Slice(0, size_at_dim)) var narr: Self = self.__getitem__(slice_list) if self.ndim == 1: narr.ndim = 0 narr.ndshape.ndshape[0] = 0 return narr fn _adjust_slice_(self, inout span: Slice, dim: Int): if span.start < 0: span.start = dim + span.start if not span._has_end(): span.end = dim elif span.end < 0: span.end = dim + span.end if span.end > dim: span.end = dim if span.end < span.start: span.start = 0 span.end = 0 fn __getitem__(self, owned *slices: Slice) raises -> Self: """ Retreive slices of an array from variadic slices. Example: `arr[1:3, 2:4]` returns the corresponding sliced array (2 x 2). """ var n_slices: Int = slices.__len__() if n_slices > self.ndim: raise Error("Error: No of slices exceed the array dimensions.") var slice_list: List[Slice] = List[Slice]() for i in range(len(slices)): slice_list.append(slices[i]) if n_slices < self.ndim: for i in range(n_slices, self.ndim): slice_list.append(Slice(0, self.ndshape[i])) var narr: Self = self[slice_list] return narr fn __getitem__(self, owned slices: List[Slice]) raises -> Self: """ Retreive slices of an array from list of slices. Example: `arr[1:3, 2:4]` returns the corresponding sliced array (2 x 2). """ var n_slices: Int = slices.__len__() if n_slices > self.ndim or n_slices < self.ndim: raise Error("Error: No of slices do not match shape") var ndims: Int = 0 var spec: List[Int] = List[Int]() var count: Int = 0 for i in range(slices.__len__()): self._adjust_slice_(slices[i], self.ndshape[i]) if ( slices[i].start >= self.ndshape[i] or slices[i].end > self.ndshape[i] ): raise Error("Error: Slice value exceeds the array shape") spec.append(slices[i].unsafe_indices()) if slices[i].unsafe_indices() != 1: ndims += 1 else: count += 1 if count == slices.__len__(): ndims = 1 var nshape: List[Int] = List[Int]() var ncoefficients: List[Int] = List[Int]() var nstrides: List[Int] = List[Int]() var nnum_elements: Int = 1 var j: Int = 0 count = 0 for _ in range(ndims): while spec[j] == 1: count += 1 j += 1 if j >= self.ndim: break nshape.append(slices[j].unsafe_indices()) nnum_elements *= slices[j].unsafe_indices() ncoefficients.append(self.stride[j] * slices[j].step) j += 1 if count == slices.__len__(): nshape.append(1) nnum_elements = 1 ncoefficients.append(1) var noffset: Int = 0 if self.order == "C": noffset = 0 for i in range(ndims): var temp_stride: Int = 1 for j in range(i + 1, ndims): # temp temp_stride *= nshape[j] nstrides.append(temp_stride) for i in range(slices.__len__()): noffset += slices[i].start * self.stride[i] elif self.order == "F": noffset = 0 nstrides.append(1) for i in range(0, ndims - 1): nstrides.append(nstrides[i] * nshape[i]) for i in range(slices.__len__()): noffset += slices[i].start * self.stride[i] var narr = Self( ndims, noffset, nnum_elements, nshape, nstrides, ncoefficients, order=self.order, ) var index = List[Int]() for _ in range(ndims): index.append(0) _traverse_iterative[dtype]( self, narr, nshape, ncoefficients, nstrides, noffset, index, 0 ) return narr fn __getitem__(self, owned *slices: Variant[Slice, Int]) raises -> Self: """ Get items by a series of either slices or integers. A decrease of dimensions may or may not happen when `__getitem__` is called on an ndarray. An ndarray of X-D array can become Y-D array after `__getitem__` where `Y <= X`. Whether the dimension decerases or not depends on: 1. What types of arguments are passed into `__getitem__`. 2. The number of arguments that are passed in `__getitem__`. PRINCIPAL: The number of dimensions to be decreased is determined by the number of `Int` passed in `__getitem__`. For example, `A` is a 10x10x10 ndarray (3-D). Then, - `A[1, 2, 3]` leads to a 0-D array (scalar), since there are 3 integers. - `A[1, 2]` leads to a 1-D array (vector), since there are 2 integers, so the dimension decreases by 2. - `A[1]` leads to a 2-D array (matrix), since there is 1 integer, so the dimension decreases by 1. The number of dimensions will not decrease when Slice is passed in `__getitem__` or no argument is passed in for a certain dimension (it is an implicit slide and a slide of all items will be used). Take the same example `A` with 10x10x10 in shape. Then, - `A[1:4, 2:5, 3:6]`, leads to a 3-D array (no decrease in dimension), since there are 3 slices. - `A[2:8]`, leads to a 3-D array (no decrease in dimension), since there are 1 explicit slice and 2 implicit slices. When there is a mixture of int and slices passed into `__getitem__`, the number of integers will be the number of dimensions to be decreased. Example, - `A[1:4, 2, 2]`, leads to a 1-D array (vector), since there are 2 integers, so the dimension decreases by 2. Note that, even though a slice contains one row, it does not reduce the dimensions. Example, - `A[1:2, 2:3, 3:4]`, leads to a 3-D array (no decrease in dimension), since there are 3 slices. Note that, when the number of integers equals to the number of dimensions, the final outcome is an 0-D array instead of a number. The user has to upack the 0-D array with the method`A.item(0)` to get the corresponding number. This behavior is different from numpy where the latter returns a number. More examples for 1-D, 2-D, and 3-D arrays. ```console A is a matrix [[ -128 -95 65 -11 ] [ 8 -72 -116 45 ] [ 45 111 -30 4 ] [ 84 -120 -115 7 ]] 2-D array Shape: [4, 4] DType: int8 A[0] [ -128 -95 65 -11 ] 1-D array Shape: [4] DType: int8 A[0, 1] -95 0-D array Shape: [0] DType: int8 A[Slice(1,3)] [[ 8 -72 -116 45 ] [ 45 111 -30 4 ]] 2-D array Shape: [2, 4] DType: int8 A[1, Slice(2,4)] [ -116 45 ] 1-D array Shape: [2] DType: int8 A[Slice(1,3), Slice(1,3)] [[ -72 -116 ] [ 111 -30 ]] 2-D array Shape: [2, 2] DType: int8 A.item(0,1) as Scalar -95 ============================== A is a vector [ 43 -127 -30 -111 ] 1-D array Shape: [4] DType: int8 A[0] 43 0-D array Shape: [0] DType: int8 A[Slice(1,3)] [ -127 -30 ] 1-D array Shape: [2] DType: int8 A.item(0) as Scalar 43 ============================== A is a 3darray [[[ -22 47 22 110 ] [ 88 6 -105 39 ] [ -22 51 105 67 ] [ -61 -116 60 -44 ]] [[ 33 65 125 -35 ] [ -65 123 57 64 ] [ 38 -110 33 98 ] [ -59 -17 68 -6 ]] [[ -68 -58 -37 -86 ] [ -4 101 104 -113 ] [ 103 1 4 -47 ] [ 124 -2 -60 -105 ]] [[ 114 -110 0 -30 ] [ -58 105 7 -10 ] [ 112 -116 66 69 ] [ 83 -96 -124 48 ]]] 3-D array Shape: [4, 4, 4] DType: int8 A[0] [[ -22 47 22 110 ] [ 88 6 -105 39 ] [ -22 51 105 67 ] [ -61 -116 60 -44 ]] 2-D array Shape: [4, 4] DType: int8 A[0, 1] [ 88 6 -105 39 ] 1-D array Shape: [4] DType: int8 A[0, 1, 2] -105 0-D array Shape: [0] DType: int8 A[Slice(1,3)] [[[ 33 65 125 -35 ] [ -65 123 57 64 ] [ 38 -110 33 98 ] [ -59 -17 68 -6 ]] [[ -68 -58 -37 -86 ] [ -4 101 104 -113 ] [ 103 1 4 -47 ] [ 124 -2 -60 -105 ]]] 3-D array Shape: [2, 4, 4] DType: int8 A[1, Slice(2,4)] [[ 38 -110 33 98 ] [ -59 -17 68 -6 ]] 2-D array Shape: [2, 4] DType: int8 A[Slice(1,3), Slice(1,3), 2] [[ 57 33 ] [ 104 4 ]] 2-D array Shape: [2, 2] DType: int8 A.item(0,1,2) as Scalar -105 ``` Args: slices: A series of either Slice or Int. Returns: An ndarray with a smaller or equal dimension of the original one. """ var n_slices: Int = slices.__len__() if n_slices > self.ndim: raise Error("Error: No of slices greater than rank of array") var slice_list: List[Slice] = List[Slice]() var count_int = 0 # Count the number of Int in the argument for i in range(len(slices)): if slices[i].isa[Slice](): slice_list.append(slices[i]._get_ptr[Slice]()[0]) elif slices[i].isa[Int](): count_int += 1 var int: Int = slices[i]._get_ptr[Int]()[0] slice_list.append(Slice(int, int + 1)) if n_slices < self.ndim: for i in range(n_slices, self.ndim): var size_at_dim: Int = self.ndshape[i] slice_list.append(Slice(0, size_at_dim)) var narr: Self = self.__getitem__(slice_list) if count_int == self.ndim: narr.ndim = 0 narr.ndshape.ndshape[0] = 0 return narr fn __getitem__(self, index: List[Int]) raises -> Self: """ Get items of array from a list of indices. It always gets the first dimension. Example: ```console > var A = nm.NDArray[nm.i8](3,random=True) > print(A) [ 14 97 -59 ] 1-D array Shape: [3] DType: int8 > > print(A[List[Int](2,1,0,1,2)]) [ -59 97 14 97 -59 ] 1-D array Shape: [5] DType: int8 > > var B = nm.NDArray[nm.i8](3, 3,random=True) > print(B) [[ -4 112 -94 ] [ -48 -40 66 ] [ -2 -94 -18 ]] 2-D array Shape: [3, 3] DType: int8 > > print(B[List[Int](2,1,0,1,2)]) [[ -2 -94 -18 ] [ -48 -40 66 ] [ -4 112 -94 ] [ -48 -40 66 ] [ -2 -94 -18 ]] 2-D array Shape: [5, 3] DType: int8 > > var C = nm.NDArray[nm.i8](3, 3, 3,random=True) > print(C) [[[ -126 -88 -79 ] [ 14 78 99 ] [ -32 3 -42 ]] [[ 56 -45 -71 ] [ -13 18 -102 ] [ 4 83 26 ]] [[ 61 -73 86 ] [ -125 -84 66 ] [ 32 21 53 ]]] 3-D array Shape: [3, 3, 3] DType: int8 > > print(C[List[Int](2,1,0,1,2)]) [[[ 61 -73 86 ] [ -125 -84 66 ] [ 32 21 53 ]] [[ 56 -45 -71 ] [ -13 18 -102 ] [ 4 83 26 ]] [[ -126 -88 -79 ] [ 14 78 99 ] [ -32 3 -42 ]] [[ 56 -45 -71 ] [ -13 18 -102 ] [ 4 83 26 ]] [[ 61 -73 86 ] [ -125 -84 66 ] [ 32 21 53 ]]] 3-D array Shape: [5, 3, 3] DType: int8 ``` Args: index: List[Int]. Returns: NDArray with items from the list of indices. """ # Shape of the result should be # Number of indice * shape from dim-1 # So just change the first number of the ndshape var ndshape = self.ndshape ndshape.ndshape.__setitem__(0, len(index)) ndshape.ndsize = 1 for i in range(ndshape.ndlen): ndshape.ndsize *= int(ndshape.ndshape[i]) var result = NDArray[dtype](ndshape) var size_per_item = ndshape.ndsize // len(index) # Fill in the values for i in range(len(index)): for j in range(size_per_item): result.data.store[width=1]( i * size_per_item + j, self[int(index[i])].item(j) ) return result fn __getitem__(self, index: NDArray[DType.index]) raises -> Self: """ Get items of array from an array of indices. Refer to `__getitem__(self, index: List[Int])`. Example: ```console > var X = nm.NDArray[nm.i8](3,random=True) > print(X) [ 32 21 53 ] 1-D array Shape: [3] DType: int8 > print(X.argsort()) [ 1 0 2 ] 1-D array Shape: [3] DType: index > print(X[X.argsort()]) [ 21 32 53 ] 1-D array Shape: [3] DType: int8 ``` """ var new_index = List[Int]() for i in index: new_index.append(int(i.item(0))) return self.__getitem__(new_index) fn __getitem__(self, mask: NDArray[DType.bool]) raises -> Self: """ Get items of array corrisponding to a mask. Example: ``` var A = numojo.core.NDArray[numojo.i16](6, random=True) var mask = A > 0 print(A) print(mask) print(A[mask]) ``` Args: mask: NDArray with Dtype.bool. Returns: NDArray with items from the mask. """ var true: List[Int] = List[Int]() for i in range(mask.ndshape.ndsize): if mask.data.load[width=1](i): true.append(i) var result = Self(true.__len__(), random=False) for i in range(true.__len__()): result.data.store[width=1](i, self.get_scalar(true[i])) return result fn __setitem__(inout self, mask: NDArray[DType.bool], value: Self) raises: """ Set the value of the array at the indices where the mask is true. """ if ( mask.ndshape != self.ndshape ): # this behavious could be removed potentially raise Error("Mask and array must have the same shape") for i in range(mask.ndshape.ndsize): if mask.data.load[width=1](i): self.data.store[width=1](i, value.data.load[width=1](i)) # ===-------------------------------------------------------------------===# # Operator dunders # ===-------------------------------------------------------------------===# # We should make a version that checks nonzero/not_nan fn __bool__(self) raises -> Bool: """ If all true return true. """ if self.dtype == DType.bool: if self.all(): return True else: return False raise Error( "core:ndarray:NDArray:__bool__: Bool is currently only implemented" " for DType.bool" ) # compiler doesn't accept this # fn __setitem__(inout self, mask: NDArray[DType.bool], value: Scalar[dtype]) raises: # """ # Set the value of the array at the indices where the mask is true. # """ # if mask.ndshape != self.ndshape: # this behavious could be removed potentially # raise Error("Mask and array must have the same shape") # for i in range(mask.ndshape.ndsize): # if mask.data.load[width=1](i): # print(value) # self.data.store[width=1](i, value) fn __int__(self) raises -> Int: """Get Int representation of the array. Similar to Numpy, only 0-D arrays or length-1 arrays can be converted to scalars. Example: ```console > var A = NDArray[dtype](6, random=True) > print(int(A)) Unhandled exception caught during execution: Only 0-D arrays or length-1 arrays can be converted to scalars mojo: error: execution exited with a non-zero result: 1 > var B = NDArray[dtype](1, 1, random=True) > print(int(B)) 14 ``` Returns: Int representation of the array """ if (self.size() == 1) or (self.ndim == 0): return int(self.get_scalar(0)) else: raise ( "Only 0-D arrays or length-1 arrays can be converted to scalars" ) fn __pos__(self) raises -> Self: """ Unary positve returens self unless boolean type. """ if self.dtype.is_bool(): raise Error( "ndarray:NDArrray:__pos__: pos does not except bool type arrays" ) return self fn __neg__(self) raises -> Self: """ Unary negative returens self unless boolean type. For bolean use `__invert__`(~) """ if self.dtype.is_bool(): raise Error( "ndarray:NDArrray:__pos__: pos does not except bool type arrays" ) return self * -1.0 @always_inline("nodebug") fn __eq__(self, other: Self) raises -> NDArray[DType.bool]: """ Itemwise equivelence. """ return math.equal[dtype](self, other) @always_inline("nodebug") fn __eq__(self, other: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Itemwise equivelence between scalar and Array. """ return math.equal[dtype](self, other) @always_inline("nodebug") fn __ne__(self, other: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Itemwise nonequivelence. """ return math.not_equal[dtype](self, other) @always_inline("nodebug") fn __ne__(self, other: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Itemwise nonequivelence between scalar and Array. """ return math.not_equal[dtype](self, other) @always_inline("nodebug") fn __lt__(self, other: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Itemwise less than. """ return math.less[dtype](self, other) @always_inline("nodebug") fn __lt__(self, other: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Itemwise less than between scalar and Array. """ return math.less[dtype](self, other) @always_inline("nodebug") fn __le__(self, other: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Itemwise less than or equal to. """ return math.less_equal[dtype](self, other) @always_inline("nodebug") fn __le__(self, other: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Itemwise less than or equal to between scalar and Array. """ return math.less_equal[dtype](self, other) @always_inline("nodebug") fn __gt__(self, other: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Itemwise greater than. """ return math.greater[dtype](self, other) @always_inline("nodebug") fn __gt__(self, other: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Itemwise greater than between scalar and Array. """ return math.greater[dtype](self, other) @always_inline("nodebug") fn __ge__(self, other: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Itemwise greater than or equal to. """ return math.greater_equal[dtype](self, other) @always_inline("nodebug") fn __ge__(self, other: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Itemwise less than or equal to between scalar and Array. """ return math.greater_equal[dtype](self, other) fn __add__(inout self, other: SIMD[dtype, 1]) raises -> Self: """ Enables `array + scalar`. """ return math.add[dtype](self, other) fn __add__(inout self, other: Self) raises -> Self: """ Enables `array + array`. """ return math.add[dtype](self, other) fn __radd__(inout self, rhs: SIMD[dtype, 1]) raises -> Self: """ Enables `scalar + array`. """ return math.add[dtype](self, rhs) # TODO make an inplace version of arithmetic functions for the i dunders fn __iadd__(inout self, other: SIMD[dtype, 1]) raises: """ Enables `array += scalar`. """ self = _af.math_func_one_array_one_SIMD_in_one_array_out[ dtype, SIMD.__add__ ](self, other) fn __iadd__(inout self, other: Self) raises: """ Enables `array *= array`. """ self = _af.math_func_2_array_in_one_array_out[dtype, SIMD.__add__]( self, other ) fn __sub__(self, other: SIMD[dtype, 1]) raises -> Self: """ Enables `array - scalar`. """ return math.sub[dtype](self, other) fn __sub__(self, other: Self) raises -> Self: """ Enables `array - array`. """ return math.sub[dtype](self, other) fn __rsub__(self, s: SIMD[dtype, 1]) raises -> Self: """ Enables `scalar - array`. """ return math.sub[dtype](s, self) fn __isub__(inout self, s: SIMD[dtype, 1]) raises: """ Enables `array -= scalar`. """ self = self - s fn __isub__(inout self, s: Self) raises: """ Enables `array -= array`. """ self = self - s fn __matmul__(self, other: Self) raises -> Self: return matmul_parallelized(self, other) fn __mul__(self, other: SIMD[dtype, 1]) raises -> Self: """ Enables `array * scalar`. """ return math.mul[dtype](self, other) fn __mul__(self, other: Self) raises -> Self: """ Enables `array * array`. """ return math.mul[dtype](self, other) fn __rmul__(self, s: SIMD[dtype, 1]) raises -> Self: """ Enables `scalar * array`. """ return math.mul[dtype](self, s) fn __imul__(inout self, s: SIMD[dtype, 1]) raises: """ Enables `array *= scalar`. """ self = self * s fn __imul__(inout self, s: Self) raises: """ Enables `array *= array`. """ self = self * s fn __abs__(self) -> Self: return abs(self) fn __invert__(self) raises -> Self: """ Elementwise inverse (~ or not), only for bools and integral types. """ return math.invert[dtype](self) fn __pow__(self, p: Int) -> Self: return self._elementwise_pow(p) fn __pow__(self, p: Self) raises -> Self: if self.ndshape.ndsize != p.ndshape.ndsize: raise Error("Both arrays must have same number of elements") var result = Self(self.ndshape) alias nelts = simdwidthof[dtype]() @parameter fn vectorized_pow[simd_width: Int](index: Int) -> None: result.data.store[width=simd_width]( index, self.data.load[width=simd_width](index) ** p.load[width=simd_width](index), ) vectorize[vectorized_pow, nelts](self.ndshape.ndsize) return result fn __ipow__(inout self, p: Int): self = self.__pow__(p) fn _elementwise_pow(self, p: Int) -> Self: alias simd_width: Int = simdwidthof[dtype]() var new_vec = self @parameter fn array_scalar_vectorize[simd_width: Int](index: Int) -> None: new_vec.data.store[width=simd_width]( index, pow(self.data.load[width=simd_width](index), p) ) vectorize[array_scalar_vectorize, simd_width](self.ndshape.ndsize) return new_vec fn __truediv__(self, other: SIMD[dtype, 1]) raises -> Self: """ Enables `array / scalar`. """ return math.div[dtype](self, other) fn __truediv__(self, other: Self) raises -> Self: """ Enables `array / array`. """ return math.div[dtype](self, other) fn __itruediv__(inout self, s: SIMD[dtype, 1]) raises: """ Enables `array /= scalar`. """ self = self.__truediv__(s) fn __itruediv__(inout self, other: Self) raises: """ Enables `array /= array`. """ self = self.__truediv__(other) fn __rtruediv__(self, s: SIMD[dtype, 1]) raises -> Self: """ Enables `scalar / array`. """ return math.div[dtype](s, self) fn __floordiv__(self, other: SIMD[dtype, 1]) raises -> Self: """ Enables `array // scalar`. """ return math.floor_div[dtype](self, other) fn __floordiv__(self, other: Self) raises -> Self: """ Enables `array // array`. """ return math.floor_div[dtype](self, other) fn __ifloordiv__(inout self, s: SIMD[dtype, 1]) raises: """ Enables `array //= scalar`. """ self = self.__floordiv__(s) fn __ifloordiv__(inout self, other: Self) raises: """ Enables `array //= array`. """ self = self.__floordiv__(other) fn __rfloordiv__(self, s: SIMD[dtype, 1]) raises -> Self: """ Enables `scalar // array`. """ return math.floor_div[dtype](s, self) fn __mod__(inout self, other: SIMD[dtype, 1]) raises -> Self: """ Enables `array % scalar`. """ return math.mod[dtype](self, other) fn __mod__(inout self, other: NDArray[dtype]) raises -> Self: """ Enables `array % array`. """ return math.mod[dtype](self, other) fn __imod__(inout self, other: SIMD[dtype, 1]) raises: """ Enables `array %= scalar`. """ self = math.mod[dtype](self, other) fn __imod__(inout self, other: NDArray[dtype]) raises: """ Enables `array %= array`. """ self = math.mod[dtype](self, other) fn __rmod__(inout self, other: SIMD[dtype, 1]) raises -> Self: """ Enables `scalar % array`. """ return math.mod[dtype](other, self) # ===-------------------------------------------------------------------===# # Trait implementations # ===-------------------------------------------------------------------===# fn __str__(self) -> String: """ Enables str(array) """ try: return ( self._array_to_string(0, 0) + "\n" + str(self.ndim) + "-D array " + self.ndshape.__str__() + " DType: " + self.dtype.__str__() ) except e: print("Cannot convert array to string", e) return "" fn __repr__(self) -> String: """ Compute the "official" string representation of NDArray. An example is: ```mojo fn main() raises: var A = NDArray[DType.int8](List[Scalar[DType.int8]](14,97,-59,-4,112,), shape=List[Int](5,)) print(repr(A)) ``` It prints what can be used to construct the array itself: ```console NDArray[DType.int8](List[Scalar[DType.int8]](14,97,-59,-4,112,), shape=List[Int](5,)) ``` """ try: var result: String = str("NDArray[DType.") + str(self.dtype) + str( "](List[Scalar[DType." ) + str(self.dtype) + str("]](") if self.size() > 6: for i in range(6): result = result + str(self.load[width=1](i)) + str(",") result = result + " ... " else: for i in self: result = result + str(i) + str(",") result = result + str("), shape=List[Int](") for i in range(self.ndshape.ndlen): result = result + str(self.ndshape.ndshape[i]) + "," result = result + str("))") return result except e: print("Cannot convert array to string", e) return "" # Should len be size or number of dimensions instead of the first dimension shape? fn __len__(self) -> Int: return int(self.ndshape.ndshape[0]) fn __iter__(self) raises -> _NDArrayIter[__lifetime_of(self), dtype]: """Iterate over elements of the NDArray, returning copied value. Returns: An iterator of NDArray elements. Notes: Need to add lifetimes after the new release. """ return _NDArrayIter[__lifetime_of(self), dtype]( array=self, length=self.ndshape[0], ) fn __reversed__( self, ) raises -> _NDArrayIter[__lifetime_of(self), dtype, forward=False]: """Iterate backwards over elements of the NDArray, returning copied value. Returns: A reversed iterator of NDArray elements. """ return _NDArrayIter[__lifetime_of(self), dtype, forward=False]( array=self, length=self.ndshape[0], ) fn _array_to_string(self, dimension: Int, offset: Int) raises -> String: if self.ndim == 0: return str(self.item(0)) if dimension == self.ndim - 1: var result: String = str("[\t") var number_of_items = self.ndshape[dimension] if number_of_items <= 6: # Print all items for i in range(number_of_items): result = ( result + self.load[width=1]( offset + i * self.stride[dimension] ).__str__() ) result = result + "\t" else: # Print first 3 and last 3 items for i in range(3): result = ( result + self.load[width=1]( offset + i * self.stride[dimension] ).__str__() ) result = result + "\t" result = result + "...\t" for i in range(number_of_items - 3, number_of_items): result = ( result + self.load[width=1]( offset + i * self.stride[dimension] ).__str__() ) result = result + "\t" result = result + "]" return result else: var result: String = str("[") var number_of_items = self.ndshape[dimension] if number_of_items <= 6: # Print all items for i in range(number_of_items): if i == 0: result = result + self._array_to_string( dimension + 1, offset + i * self.stride[dimension].__int__(), ) if i > 0: result = ( result + str(" ") * (dimension + 1) + self._array_to_string( dimension + 1, offset + i * self.stride[dimension].__int__(), ) ) if i < (number_of_items - 1): result = result + "\n" else: # Print first 3 and last 3 items for i in range(3): if i == 0: result = result + self._array_to_string( dimension + 1, offset + i * self.stride[dimension].__int__(), ) if i > 0: result = ( result + str(" ") * (dimension + 1) + self._array_to_string( dimension + 1, offset + i * self.stride[dimension].__int__(), ) ) if i < (number_of_items - 1): result += "\n" result = result + "...\n" for i in range(number_of_items - 3, number_of_items): result = ( result + str(" ") * (dimension + 1) + self._array_to_string( dimension + 1, offset + i * self.stride[dimension].__int__(), ) ) if i < (number_of_items - 1): result = result + "\n" result = result + "]" return result # ===-------------------------------------------------------------------===# # Methods # ===-------------------------------------------------------------------===# fn vdot(self, other: Self) raises -> SIMD[dtype, 1]: """ Inner product of two vectors. """ if self.ndshape.ndsize != other.ndshape.ndsize: raise Error("The lengths of two vectors do not match.") var sum = Scalar[dtype](0) for i in range(self.ndshape.ndsize): sum = sum + self.get_scalar(i) * other.get_scalar(i) return sum fn mdot(self, other: Self) raises -> Self: """ Dot product of two matrix. Matrix A: M * N. Matrix B: N * L. """ if (self.ndim != 2) or (other.ndim != 2): raise Error("The array should have only two dimensions (matrix).") if self.ndshape[1] != other.ndshape[0]: raise Error( "Second dimension of A does not match first dimension of B." ) var new_matrix = Self(self.ndshape[0], other.ndshape[1]) for row in range(self.ndshape[0]): for col in range(other.ndshape[1]): new_matrix.__setitem__( List[Int](row, col), self[row : row + 1, :].vdot(other[:, col : col + 1]), ) return new_matrix fn row(self, id: Int) raises -> Self: """Get the ith row of the matrix.""" if self.ndim > 2: raise Error("Only support 2-D array (matrix).") var width = self.ndshape[1] var buffer = Self(width) for i in range(width): buffer.__setitem__(i, self.data.load[width=1](i + id * width)) return buffer fn col(self, id: Int) raises -> Self: """Get the ith column of the matrix.""" if self.ndim > 2: raise Error("Only support 2-D array (matrix).") var width = self.ndshape[1] var height = self.ndshape[0] var buffer = Self(height) for i in range(height): buffer.__setitem__(i, self.data.load[width=1](id + i * width)) return buffer # # * same as mdot fn rdot(self, other: Self) raises -> Self: """ Dot product of two matrix. Matrix A: M * N. Matrix B: N * L. """ if (self.ndim != 2) or (other.ndim != 2): raise Error("The array should have only two dimensions (matrix).") if self.ndshape.ndshape[1] != other.ndshape.ndshape[0]: raise Error( "Second dimension of A does not match first dimension of B." ) var new_matrix = Self(self.ndshape[0], other.ndshape[1]) for row in range(self.ndshape[0]): for col in range(other.ndshape[1]): new_matrix.__setitem__( col + row * other.ndshape[1], self.row(row).vdot(other.col(col)), ) return new_matrix fn size(self) -> Int: """ Function to retreive size. """ return self.ndshape.ndsize fn num_elements(self) -> Int: """ Function to retreive size (compatability). """ return self.ndshape.ndsize # should this return the List[Int] shape and self.ndshape be used instead of making it a no input function call? fn shape(self) -> NDArrayShape: """ Get the shape as an NDArray Shape. To get a list of shape call this then list """ return self.ndshape fn load[width: Int = 1](self, index: Int) -> SIMD[dtype, width]: """ Loads a SIMD element of size `width` at the given index `index`. """ return self.data.load[width=width](index) # # TODO: we should add checks to make sure user don't load out of bound indices, but that will overhead, figure out later fn load[width: Int = 1](self, *index: Int) raises -> SIMD[dtype, width]: """ Loads a SIMD element of size `width` at given variadic indices argument. """ var idx: Int = _get_index(index, self.coefficient) return self.data.load[width=width](idx) fn store[width: Int](inout self, index: Int, val: SIMD[dtype, width]): """ Stores the SIMD element of size `width` at index `index`. """ self.data.store[width=width](index, val) fn store[ width: Int = 1 ](inout self, *index: Int, val: SIMD[dtype, width]) raises: """ Stores the SIMD element of size `width` at the given variadic indices argument. """ var idx: Int = _get_index(index, self.coefficient) self.data.store[width=width](idx, val) # # not urgent: argpartition, byteswap, choose, conj, dump, getfield # # partition, put, repeat, searchsorted, setfield, squeeze, swapaxes, take, # # tobyets, tofile, view # TODO: Implement axis parameter for all # ===-------------------------------------------------------------------===# # Operations along an axis # ===-------------------------------------------------------------------===# fn all(self) raises -> Bool: """ If all true return true. """ # make this a compile time check # Respnse to above compile time errors are way harder to read at the moment. if not (self.dtype.is_bool() or self.dtype.is_integral()): raise Error("Array elements must be Boolean or Integer.") # We might need to figure out how we want to handle truthyness before can do this alias nelts: Int = simdwidthof[dtype]() var result: Bool = True @parameter fn vectorized_all[simd_width: Int](idx: Int) -> None: result = result and allb( (self.data + idx).simd_strided_load[width=simd_width](1) ) vectorize[vectorized_all, nelts](self.ndshape.ndsize) return result fn any(self) raises -> Bool: """ True if any true. """ # make this a compile time check if not (self.dtype.is_bool() or self.dtype.is_integral()): raise Error("Array elements must be Boolean or Integer.") alias nelts: Int = simdwidthof[dtype]() var result: Bool = False @parameter fn vectorized_any[simd_width: Int](idx: Int) -> None: result = result or anyb( (self.data + idx).simd_strided_load[width=simd_width](1) ) vectorize[vectorized_any, nelts](self.ndshape.ndsize) return result fn argmax(self) -> Int: """ Get location in pointer of max value. """ var result: Int = 0 var max_val: SIMD[dtype, 1] = self.load[width=1](0) for i in range(1, self.ndshape.ndsize): var temp: SIMD[dtype, 1] = self.load[width=1](i) if temp > max_val: max_val = temp result = i return result fn argmin(self) -> Int: """ Get location in pointer of min value. """ var result: Int = 0 var min_val: SIMD[dtype, 1] = self.load[width=1](0) for i in range(1, self.ndshape.ndsize): var temp: SIMD[dtype, 1] = self.load[width=1](i) if temp < min_val: min_val = temp result = i return result fn argsort(self) raises -> NDArray[DType.index]: """ Sort the NDArray and return the sorted indices. See `numojo.core.sort.argsort()`. Returns: The indices of the sorted NDArray. """ return sort.argsort(self) fn astype[type: DType](inout self) raises -> NDArray[type]: """ Convert type of array. """ # I wonder if we can do this operation inplace instead of allocating memory. alias nelts = simdwidthof[dtype]() var narr: NDArray[type] = NDArray[type]( self.ndshape, random=False, order=self.order ) # narr.datatype = type @parameter if type == DType.bool: @parameter fn vectorized_astype[width: Int](idx: Int) -> None: (narr.unsafe_ptr() + idx).simd_strided_store[width]( self.load[width](idx).cast[type](), 1 ) vectorize[vectorized_astype, nelts](self.ndshape.ndsize) else: @parameter if self.dtype == DType.bool: @parameter fn vectorized_astypenb_from_b[width: Int](idx: Int) -> None: narr.store[width]( idx, (self.data + idx) .simd_strided_load[width](1) .cast[type](), ) vectorize[vectorized_astypenb_from_b, nelts]( self.ndshape.ndsize ) else: @parameter fn vectorized_astypenb[width: Int](idx: Int) -> None: narr.store[width](idx, self.load[width](idx).cast[type]()) vectorize[vectorized_astypenb, nelts](self.ndshape.ndsize) return narr # fn clip(self): # pass # fn compress(self): # pass # fn copy(self): # pass fn cumprod(self) -> Scalar[dtype]: """ Cumulative product of a array. Returns: The cumulative product of the array as a SIMD Value of `dtype`. """ return cumprod[dtype](self) fn cumsum(self) -> Scalar[dtype]: """ Cumulative Sum of a array. Returns: The cumulative sum of the array as a SIMD Value of `dtype`. """ return cumsum[dtype](self) fn diagonal(self): pass fn fill(inout self, val: Scalar[dtype]) -> Self: """ Fill all items of array with value. """ alias simd_width: Int = simdwidthof[dtype]() @parameter fn vectorized_fill[simd_width: Int](index: Int) -> None: self.data.store[width=simd_width](index, val) vectorize[vectorized_fill, simd_width](self.ndshape.ndsize) return self fn flatten(inout self, inplace: Bool = False) raises -> Optional[Self]: """ Convert shape of array to one dimensional. """ # inplace has some problems right now # if inplace: # self.ndshape = NDArrayShape(self.ndshape.ndsize, size=self.ndshape.ndsize) # self.stride = NDArrayStride(shape = self.ndshape, offset=0) # return self var res: NDArray[dtype] = NDArray[dtype]( self.ndshape.ndsize, random=False ) alias simd_width: Int = simdwidthof[dtype]() @parameter fn vectorized_flatten[simd_width: Int](index: Int) -> None: res.data.store[width=simd_width]( index, self.data.load[width=simd_width](index) ) vectorize[vectorized_flatten, simd_width](self.ndshape.ndsize) if inplace: self = res return None else: return res fn item(self, *index: Int) raises -> SIMD[dtype, 1]: """ Return the scalar at the coordinates. If one index is given, get the i-th item of the array. It first scans over the first row, even it is a colume-major array. If more than one index is given, the length of the indices must match the number of dimensions of the array. Example: ```console > var A = nm.NDArray[dtype](3, 3, random=True, order="F") > print(A) [[ 14 -4 -48 ] [ 97 112 -40 ] [ -59 -94 66 ]] 2-D array Shape: [3, 3] DType: int8 > for i in A: > print(i) # Return rows [ 14 -4 -48 ] 1-D array Shape: [3] DType: int8 [ 97 112 -40 ] 1-D array Shape: [3] DType: int8 [ -59 -94 66 ] 1-D array Shape: [3] DType: int8 > for i in range(A.size()): > print(A.item(i)) # Return 0-d arrays c stride Stride: [3, 1] 14 c stride Stride: [3, 1] -4 c stride Stride: [3, 1] -48 c stride Stride: [3, 1] 97 c stride Stride: [3, 1] 112 c stride Stride: [3, 1] -40 c stride Stride: [3, 1] -59 c stride Stride: [3, 1] -94 c stride Stride: [3, 1] 66 ============================== ``` Args: index: The coordinates of the item. Returns: A scalar matching the dtype of the array. """ # If one index is given if index.__len__() == 1: if index[0] < self.size(): if ( self.order == "F" ): # column-major should be converted to row-major # The following code can be taken out as a function that # convert any index to coordinates according to the order var c_stride = NDArrayStride(shape=self.ndshape) var c_coordinates = List[Int]() var idx: Int = index[0] for i in range(c_stride.ndlen): var coordinate = idx // c_stride[i] idx = idx - c_stride[i] * coordinate c_coordinates.append(coordinate) return self.data.load[width=1]( _get_index(c_coordinates, self.stride) ) return self.data.load[width=1](index[0]) else: raise Error("Error: Elements of `index` exceed the array size") # If more than one index is given if index.__len__() != self.ndim: raise Error("Error: Length of Indices do not match the shape") for i in range(index.__len__()): if index[i] >= self.ndshape[i]: raise Error("Error: Elements of `index` exceed the array shape") return self.data.load[width=1](_get_index(index, self.stride)) fn max(self, axis: Int = 0) raises -> Self: """ Max on axis. """ var ndim: Int = self.ndim var shape: List[Int] = List[Int]() for i in range(ndim): shape.append(self.ndshape[i]) if axis > ndim - 1: raise Error("axis cannot be greater than the rank of the array") var result_shape: List[Int] = List[Int]() var axis_size: Int = shape[axis] var slices: List[Slice] = List[Slice]() for i in range(ndim): if i != axis: result_shape.append(shape[i]) slices.append(Slice(0, shape[i])) else: slices.append(Slice(0, 0)) print(result_shape.__str__()) var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(result_shape)) slices[axis] = Slice(0, 1) result = self[slices] for i in range(1, axis_size): slices[axis] = Slice(i, i + 1) var arr_slice = self[slices] var mask1 = greater(arr_slice, result) var mask2 = less(arr_slice, result) # Wherever result is less than the new slice it is set to zero # Wherever arr_slice is greater than the old result it is added to fill those zeros result = add( result * bool_to_numeric[dtype](mask2), arr_slice * bool_to_numeric[dtype](mask1), ) return result fn min(self, axis: Int = 0) raises -> Self: """ Min on axis. """ var ndim: Int = self.ndim var shape: List[Int] = List[Int]() for i in range(ndim): shape.append(self.ndshape[i]) if axis > ndim - 1: raise Error("axis cannot be greater than the rank of the array") var result_shape: List[Int] = List[Int]() var axis_size: Int = shape[axis] var slices: List[Slice] = List[Slice]() for i in range(ndim): if i != axis: result_shape.append(shape[i]) slices.append(Slice(0, shape[i])) else: slices.append(Slice(0, 0)) var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(result_shape)) slices[axis] = Slice(0, 1) result = self[slices] for i in range(1, axis_size): slices[axis] = Slice(i, i + 1) var arr_slice = self[slices] var mask1 = less(arr_slice, result) var mask2 = greater(arr_slice, result) # Wherever result is greater than the new slice it is set to zero # Wherever arr_slice is less than the old result it is added to fill those zeros result = add( result * bool_to_numeric[dtype](mask2), arr_slice * bool_to_numeric[dtype](mask1), ) return result fn mean(self: Self, axis: Int) raises -> Self: """ Mean of array elements over a given axis. Args: array: NDArray. axis: The axis along which the mean is performed. Returns: An NDArray. """ return mean(self, axis) fn mean(self) raises -> Scalar[dtype]: """ Cumulative mean of a array. Returns: The cumulative mean of the array as a SIMD Value of `dtype`. """ return cummean[dtype](self) # fn nonzero(self): # pass fn prod(self: Self, axis: Int) raises -> Self: """ Product of array elements over a given axis. Args: array: NDArray. axis: The axis along which the product is performed. Returns: An NDArray. """ return prod(self, axis) # fn ravel(self): # pass # fn resize(self): # pass # fn round(self): # pass # for python compat this should be inplace fn sort(self) raises -> Self: """ Sort the array using quickstort. """ return sort.quick_sort(self) fn sum(self: Self, axis: Int) raises -> Self: """ Sum of array elements over a given axis. Args: axis: The axis along which the sum is performed. Returns: An NDArray. """ return sum(self, axis) # fn stdev(self): # pass # fn tolist(self): # pass # fn tostring(self): # pass # fn trace(self): # pass # fn transpose(self): # pass # fn variance(self): # pass # Technically it only changes the ArrayDescriptor and not the fundamental data fn reshape(inout self, *shape: Int, order: String = "C") raises: """ Reshapes the NDArray to given Shape. Args: shape: Variadic list of shape. order: Order of the array - Row major `C` or Column major `F`. """ var s: VariadicList[Int] = shape reshape[dtype](self, s, order=order) fn unsafe_ptr(self) -> DTypePointer[dtype, 0]: """ Retreive pointer without taking ownership. """ return self.data fn to_numpy(self) raises -> PythonObject: """ Convert to a numpy array. """ return to_numpy(self) --- numojo/core/ndarray_utils.mojo --- """ Implements N-DIMENSIONAL ARRAY UTILITY FUNCTIONS """ # ===----------------------------------------------------------------------=== # # Implements N-DIMENSIONAL ARRAY UTILITY FUNCTIONS # Last updated: 2024-06-20 # ===----------------------------------------------------------------------=== # from python import Python from .ndarray import NDArray, NDArrayShape, NDArrayStride # TODO: there's some problem with using narr[idx] in traverse function, Make sure to correct this before v0.1 fn _get_index(indices: List[Int], weights: NDArrayShape) raises -> Int: """ Get the index of a multi-dimensional array from a list of indices and weights. Args: indices: The list of indices. weights: The weights of the indices. Returns: The scalar index of the multi-dimensional array. """ var idx: Int = 0 for i in range(weights.ndlen): idx += indices[i] * weights[i] return idx fn _get_index(indices: VariadicList[Int], weights: NDArrayShape) raises -> Int: """ Get the index of a multi-dimensional array from a list of indices and weights. Args: indices: The list of indices. weights: The weights of the indices. Returns: The scalar index of the multi-dimensional array. """ var idx: Int = 0 for i in range(weights.ndlen): idx += indices[i] * weights[i] return idx fn _get_index(indices: List[Int], weights: NDArrayStride) raises -> Int: """ Get the index of a multi-dimensional array from a list of indices and weights. Args: indices: The list of indices. weights: The weights of the indices. Returns: The scalar index of the multi-dimensional array. """ var idx: Int = 0 for i in range(weights.ndlen): idx += indices[i] * weights[i] return idx fn _get_index(indices: VariadicList[Int], weights: NDArrayStride) raises -> Int: """ Get the index of a multi-dimensional array from a list of indices and weights. Args: indices: The list of indices. weights: The weights of the indices. Returns: The scalar index of the multi-dimensional array. """ var idx: Int = 0 for i in range(weights.ndlen): idx += indices[i] * weights[i] return idx fn _get_index(indices: List[Int], weights: List[Int]) -> Int: """ Get the index of a multi-dimensional array from a list of indices and weights. Args: indices: The list of indices. weights: The weights of the indices. Returns: The scalar index of the multi-dimensional array. """ var idx: Int = 0 for i in range(weights.__len__()): idx += indices[i] * weights[i] return idx fn _get_index(indices: VariadicList[Int], weights: VariadicList[Int]) -> Int: """ Get the index of a multi-dimensional array from a list of indices and weights. Args: indices: The list of indices. weights: The weights of the indices. Returns: The scalar index of the multi-dimensional array. """ var idx: Int = 0 for i in range(weights.__len__()): idx += indices[i] * weights[i] return idx fn _traverse_iterative[ dtype: DType ]( orig: NDArray[dtype], inout narr: NDArray[dtype], ndim: List[Int], coefficients: List[Int], strides: List[Int], offset: Int, inout index: List[Int], depth: Int, ) raises: """ Traverse a multi-dimensional array in a iterative manner. Raises: Error: If the index is out of bound. Parameters: dtype: The data type of the NDArray elements. Args: orig: The original array. narr: The array to store the result. ndim: The number of dimensions of the array. coefficients: The coefficients to traverse the sliced part of the original array. strides: The strides to traverse the new NDArray `narr`. offset: The offset to the first element of the original NDArray. index: The list of indices. depth: The depth of the indices. """ if depth == ndim.__len__(): var idx = offset + _get_index(index, coefficients) var nidx = _get_index(index, strides) var temp = orig.data.load[width=1](idx) if nidx >= narr.ndshape.ndsize: raise Error("Invalid index: index out of bound") else: narr.data.store[width=1](nidx, temp) return for i in range(ndim[depth]): index[depth] = i var newdepth = depth + 1 _traverse_iterative( orig, narr, ndim, coefficients, strides, offset, index, newdepth ) fn bool_to_numeric[ dtype: DType ](array: NDArray[DType.bool]) raises -> NDArray[dtype]: """ Convert a boolean NDArray to a numeric NDArray. Parameters: dtype: The data type of the output NDArray elements. Args: array: The boolean NDArray to convert. Returns: The converted NDArray of type `dtype` with 1s (True) and 0s (False). """ # Can't use simd becuase of bit packing error var res: NDArray[dtype] = NDArray[dtype](array.shape()) for i in range(array.size()): var t: Bool = array.item(i) if t: res.data[i] = 1 else: res.data[i] = 0 return res fn to_numpy[dtype: DType](array: NDArray[dtype]) raises -> PythonObject: """ Convert a NDArray to a numpy array. Example: ```console var arr = NDArray[DType.float32](3, 3, 3) var np_arr = to_numpy(arr) var np_arr1 = arr.to_numpy() ``` Parameters: dtype: The data type of the NDArray elements. Args: array: The NDArray to convert. Returns: The converted numpy array. """ try: var np = Python.import_module("numpy") np.set_printoptions(4) var dimension = array.ndim var np_arr_dim = PythonObject([]) for i in range(dimension): np_arr_dim.append(array.ndshape[i]) # Implement a dictionary for this later var numpyarray: PythonObject var np_dtype = np.float64 if dtype == DType.float16: np_dtype = np.float16 elif dtype == DType.float32: np_dtype = np.float32 elif dtype == DType.int64: np_dtype = np.int64 elif dtype == DType.int32: np_dtype = np.int32 elif dtype == DType.int16: np_dtype = np.int16 elif dtype == DType.int8: np_dtype = np.int8 numpyarray = np.empty(np_arr_dim, dtype=np_dtype) var pointer = numpyarray.__array_interface__["data"][0] var pointer_d = DTypePointer[array.dtype](address=pointer) memcpy(pointer_d, array.data, array.num_elements()) _ = array return numpyarray^ except e: print("Error in converting to numpy", e) return PythonObject() --- numojo/core/random.mojo --- """ Random values array generation. """ # ===----------------------------------------------------------------------=== # # Implements RANDOM # Last updated: 2024-06-18 # ===----------------------------------------------------------------------=== # import random from .ndarray import NDArray fn rand[dtype: DType](*shape: Int) raises -> NDArray[dtype]: """ Generate a random NDArray of the given shape and dtype. Example: ```py var arr = numojo.core.random.rand[numojo.i16](3,2,4) print(arr) ``` Parameters: dtype: The data type of the NDArray elements. Args: shape: The shape of the NDArray. Returns: The generated NDArray of type `dtype` filled with random values. """ return NDArray[dtype](shape, random=True) --- numojo/core/sort.mojo --- """ Implements sort functions """ # ===----------------------------------------------------------------------=== # # Sort Module - Implements sort functions # Last updated: 2024-06-20 # ===----------------------------------------------------------------------=== # import math from algorithm import vectorize from ..core.ndarray import NDArray, NDArrayShape """ TODO: 1) Add more sorting algorithms. 2) Add argument "inplace" for some functions. 3) Add axis. """ # ===------------------------------------------------------------------------===# # Bubble sort # ===------------------------------------------------------------------------===# fn bubble_sort[dtype: DType](ndarray: NDArray[dtype]) raises -> NDArray[dtype]: """ Bubble sort the NDArray. Average complexity: O(n^2) comparisons, O(n^2) swaps. Worst-case complexity: O(n^2) comparisons, O(n^2) swaps. Worst-case space complexity: O(n). Example: ```py var arr = numojo.core.random.rand[numojo.i16](100) var sorted_arr = numojo.core.sort.bubble_sort(arr) print(sorted_arr) ``` Parameters: dtype: The input element type. Args: ndarray: An NDArray. Returns: The sorted NDArray. """ var result: NDArray[dtype] = ndarray var length = ndarray.size() for i in range(length): for j in range(length - i - 1): if result.data.load[width=1](j) > result.data.load[width=1](j + 1): var temp = result.data.load[width=1](j) result.data.store[width=1](j, result.data.load[width=1](j + 1)) result.data.store[width=1](j + 1, temp) return result # ===------------------------------------------------------------------------===# # Quick sort # ===------------------------------------------------------------------------===# fn _partition( inout ndarray: NDArray, left: Int, right: Int, pivot_index: Int ) raises -> Int: """Do partition for the data buffer of ndarray. Args: ndarray: An NDArray. left: Left index of the partition. right: Right index of the partition. pivot_index: Input pivot index Returns: New pivot index. """ var pivot_value = ndarray.get_scalar(pivot_index) var _value_at_pivot = ndarray.get_scalar(pivot_index) ndarray.__setitem__(pivot_index, ndarray.get_scalar(right)) ndarray.__setitem__(right, _value_at_pivot) var store_index = left for i in range(left, right): if ndarray.get_scalar(i) < pivot_value: var _value_at_store = ndarray.get_scalar(store_index) ndarray.__setitem__(store_index, ndarray.get_scalar(i)) ndarray.__setitem__(i, _value_at_store) store_index = store_index + 1 var _value_at_store = ndarray.get_scalar(store_index) ndarray.__setitem__(store_index, ndarray.get_scalar(right)) ndarray.__setitem__(right, _value_at_store) return store_index fn quick_sort_inplace[ dtype: DType ](inout ndarray: NDArray[dtype], left: Int, right: Int,) raises: """ Quick sort (in-place) the NDArray. Parameters: dtype: The input element type. Args: ndarray: An NDArray. left: Left index of the partition. right: Right index of the partition. """ if right > left: var pivot_index = left + (right - left) // 2 var pivot_new_index = _partition(ndarray, left, right, pivot_index) quick_sort_inplace(ndarray, left, pivot_new_index - 1) quick_sort_inplace(ndarray, pivot_new_index + 1, right) fn quick_sort[ dtype: DType ](ndarray: NDArray[dtype],) raises -> NDArray[dtype]: """ Quick sort the NDArray. Adopt in-place partition. Average complexity: O(nlogn). Worst-case complexity: O(n^2). Worst-case space complexity: O(n). Unstable. Example: ```py var arr = numojo.core.random.rand[numojo.i16](100) var sorted_arr = numojo.core.sort.quick_sort(arr) print(sorted_arr) ``` Parameters: dtype: The input element type. Args: ndarray: An NDArray. Returns: The sorted NDArray. """ var result: NDArray[dtype] = ndarray var length = ndarray.size() quick_sort_inplace(result, 0, length - 1) return result # ===------------------------------------------------------------------------===# # Binary sort # ===------------------------------------------------------------------------===# fn binary_sort[ dtype: DType = DType.float64 ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Binary sorting of NDArray. Example: ```py var arr = numojo.core.random.rand[numojo.i16](100) var sorted_arr = numojo.core.sort.binary_sort(arr) print(sorted_arr) ``` Parameters: dtype: The element type. Args: array: A NDArray. Returns: The sorted NDArray of type `dtype`. """ @parameter if dtype != array.dtype: alias dtype = array.dtype var result: NDArray[dtype] = NDArray[dtype](array.shape()) for i in range(array.ndshape.ndsize): result.store(i, array.get_scalar(i).cast[dtype]()) var n = array.num_elements() for end in range(n, 1, -1): for i in range(1, end): if result[i - 1] > result[i]: var temp: Scalar[dtype] = result.get_scalar(i - 1) result[i - 1] = result[i] result.store(i, temp) return result # ===------------------------------------------------------------------------===# # Argsort using quick sort algorithm # ===------------------------------------------------------------------------===# fn _argsort_partition( inout ndarray: NDArray, inout idx_array: NDArray, left: Int, right: Int, pivot_index: Int, ) raises -> Int: """Do partition for the indices of the data buffer of ndarray. Args: ndarray: An NDArray. idx_array: An NDArray. left: Left index of the partition. right: Right index of the partition. pivot_index: Input pivot index Returns: New pivot index. """ var pivot_value = ndarray.get_scalar(pivot_index) var _value_at_pivot = ndarray.get_scalar(pivot_index) ndarray.__setitem__(pivot_index, ndarray.get_scalar(right)) ndarray.__setitem__(right, _value_at_pivot) var _value_at_pivot_index = idx_array.get_scalar(pivot_index) idx_array.__setitem__(pivot_index, idx_array.get_scalar(right)) idx_array.__setitem__(right, _value_at_pivot_index) var store_index = left for i in range(left, right): if ndarray.get_scalar(i) < pivot_value: var _value_at_store = ndarray.get_scalar(store_index) ndarray.__setitem__(store_index, ndarray.get_scalar(i)) ndarray.__setitem__(i, _value_at_store) var _value_at_store_index = idx_array.get_scalar(store_index) idx_array.__setitem__(store_index, idx_array.get_scalar(i)) idx_array.__setitem__(i, _value_at_store_index) store_index = store_index + 1 var _value_at_store = ndarray.get_scalar(store_index) ndarray.__setitem__(store_index, ndarray.get_scalar(right)) ndarray.__setitem__(right, _value_at_store) var _value_at_store_index = idx_array.get_scalar(store_index) idx_array.__setitem__(store_index, idx_array.get_scalar(right)) idx_array.__setitem__(right, _value_at_store_index) return store_index fn argsort_inplace[ dtype: DType ]( inout ndarray: NDArray[dtype], inout idx_array: NDArray[DType.index], left: Int, right: Int, ) raises: """ Conduct Argsort (in-place) based on the NDArray using quick sort. Parameters: dtype: The input element type. Args: ndarray: An NDArray. idx_array: An NDArray of the indices. left: Left index of the partition. right: Right index of the partition. """ if right > left: var pivot_index = left + (right - left) // 2 var pivot_new_index = _argsort_partition( ndarray, idx_array, left, right, pivot_index ) argsort_inplace(ndarray, idx_array, left, pivot_new_index - 1) argsort_inplace(ndarray, idx_array, pivot_new_index + 1, right) fn argsort[ dtype: DType ](ndarray: NDArray[dtype],) raises -> NDArray[DType.index]: """ Argsort of the NDArray using quick sort algorithm. Example: ```py var arr = numojo.core.random.rand[numojo.i16](100) var sorted_arr = numojo.core.sort.argsort(arr) print(sorted_arr) ``` Parameters: dtype: The input element type. Args: ndarray: An NDArray. Returns: The indices of the sorted NDArray. """ var array: NDArray[dtype] = ndarray var length = array.size() var idx_array = NDArray[DType.index](length) for i in range(length): idx_array.__setitem__(i, i) argsort_inplace(array, idx_array, 0, length - 1) return idx_array --- numojo/core/utility_funcs.mojo --- """ Type related utility functions. """ # ===----------------------------------------------------------------------=== # # Implements Utility functions # Last updated: 2024-06-15 # ===----------------------------------------------------------------------=== # fn is_inttype[dtype: DType]() -> Bool: """ Check if the given dtype is an integer type at compile time. Parameters: dtype: DType. Returns: Bool: True if the given dtype is an integer type, False otherwise. """ if ( dtype == DType.int8 or dtype == DType.int16 or dtype == DType.int32 or dtype == DType.int64 ): return True return False fn is_inttype(dtype: DType) -> Bool: """ Check if the given dtype is an integer type at run time. Args: dtype: DType. Returns: Bool: True if the given dtype is an integer type, False otherwise. """ if ( dtype == DType.int8 or dtype == DType.int16 or dtype == DType.int32 or dtype == DType.int64 ): return True return False fn is_floattype[dtype: DType]() -> Bool: """ Check if the given dtype is a floating point type at compile time. Parameters: dtype: DType. Returns: Bool: True if the given dtype is a floating point type, False otherwise. """ if ( dtype == DType.float16 or dtype == DType.float32 or dtype == DType.float64 ): return True return False fn is_floattype(dtype: DType) -> Bool: """ Check if the given dtype is a floating point type at run time. Args: dtype: DType. Returns: Bool: True if the given dtype is a floating point type, False otherwise. """ if ( dtype == DType.float16 or dtype == DType.float32 or dtype == DType.float64 ): return True return False --- numojo/math/__init__.mojo --- from .arithmetic import * from .check import * from .trig import * from .comparison import * from .linalg import * from .statistics import * from .calculus import * from .math_funcs import ( Vectorized, VectorizedParallelized, VectorizedUnroll, VectorizedVerbose, VectorizedParallelizedNWorkers, ) from .interpolate import * --- numojo/math/arithmetic.mojo --- """ Implements array arithmetic """ # ===----------------------------------------------------------------------=== # # implements arithmetic functions # Last updated: 2024-07-14 # ===----------------------------------------------------------------------=== # import math import . math_funcs as _mf from ..core.ndarray import NDArray, NDArrayShape from algorithm import parallelize from algorithm import Static2DTileUnitFunc as Tile2DFunc # ===------------------------------------------------------------------------===# # Addition/Subtraction # ===------------------------------------------------------------------------===# fn add[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Perform addition on two arrays. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: The elementwise sum of `array1` and`array2`. """ return backend().math_func_2_array_in_one_array_out[dtype, SIMD.__add__]( array1, array2 ) fn add[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](array: NDArray[dtype], scalar: Scalar[dtype]) raises -> NDArray[dtype]: """ Perform addition on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. scalar: A NDArray. Returns: The elementwise sum of `array1` and`array2`. """ return backend().math_func_1_array_1_scalar_in_one_array_out[ dtype, SIMD.__add__ ](array, scalar) fn add[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](scalar: Scalar[dtype], array: NDArray[dtype]) raises -> NDArray[dtype]: """ Perform addition on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: scalar: A NDArray. array: A NDArray. Returns: The elementwise sum of `array1` and`array2`. """ return add[dtype, backend=backend](array, scalar) fn add[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](owned *values: Variant[NDArray[dtype], Scalar[dtype]]) raises -> NDArray[ dtype ]: """ Perform addition on a list of arrays and a scalars. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: values: A list of arrays or Scalars to be added. Returns: The elementwise sum of `array1` and`array2`. """ var array_list: List[NDArray[dtype]] = List[NDArray[dtype]]() var scalar_part: Scalar[dtype] = 0 for val in values: if val[].isa[NDArray[dtype]](): array_list.append(val[].take[NDArray[dtype]]()) elif val[].isa[Scalar[dtype]](): scalar_part += val[].take[Scalar[dtype]]() if len(array_list) == 0: raise Error( "math:arithmetic:add(*values:Variant[NDArray[dtype],Scalar[dtype]]):" " No arrays in arguaments" ) var result_array: NDArray[dtype] = NDArray[dtype](array_list[0].shape()) for array in array_list: result_array = add[dtype, backend=backend](result_array, array) result_array = add[dtype, backend=backend](result_array, scalar_part) return result_array fn sub[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Perform subtraction on two arrays. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: The elementwise difference of `array1` and`array2`. """ return backend().math_func_2_array_in_one_array_out[dtype, SIMD.__sub__]( array1, array2 ) fn sub[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](array: NDArray[dtype], scalar: Scalar[dtype]) raises -> NDArray[dtype]: """ Perform subtraction on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. scalar: A NDArray. Returns: The elementwise difference of `array1` and`array2`. """ return backend().math_func_1_array_1_scalar_in_one_array_out[ dtype, SIMD.__sub__ ](array, scalar) fn sub[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](scalar: Scalar[dtype], array: NDArray[dtype]) raises -> NDArray[dtype]: """ Perform subtraction on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: scalar: A NDArray. array: A NDArray. Returns: The elementwise difference of `array1` and`array2`. """ return sub[dtype, backend=backend](array, scalar) fn diff[ dtype: DType = DType.float64 ](array: NDArray[dtype], n: Int) raises -> NDArray[dtype]: """ Compute the n-th order difference of the input array. Parameters: dtype: The element type. Args: array: A array. n: The order of the difference. Returns: The n-th order difference of the input array. """ var array1: NDArray[dtype] = NDArray[dtype]( NDArrayShape(array.num_elements()) ) for i in range(array.num_elements()): array1.store(i, array.get_scalar(i)) for num in range(n): var result: NDArray[dtype] = NDArray[dtype]( NDArrayShape(array.num_elements() - (num + 1)) ) for i in range(array1.num_elements() - 1): result.store(i, (array1.load[1](i + 1) - array1.load[1](i))) array1 = result return array1 # ===------------------------------------------------------------------------===# # Multiplication/Division # ===------------------------------------------------------------------------===# fn copysign[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Copy the sign of the first NDArray and apply it to the second NDArray. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: The second NDArray multipied by the sign of the first NDArray. """ return backend().math_func_2_array_in_one_array_out[dtype, math.copysign]( array1, array2 ) fn mod[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise modulo of array1 and array2. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: A NDArray equal to array1 % array2. """ return backend().math_func_2_array_in_one_array_out[dtype, SIMD.__mod__]( array1, array2 ) fn mod[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](array: NDArray[dtype], scalar: Scalar[dtype]) raises -> NDArray[dtype]: """ Perform subtraction on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. scalar: A NDArray. Returns: The elementwise difference of `array1` and`array2`. """ return backend().math_func_1_array_1_scalar_in_one_array_out[ dtype, SIMD.__mod__ ](array, scalar) fn mod[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](scalar: Scalar[dtype], array: NDArray[dtype]) raises -> NDArray[dtype]: """ Perform subtraction on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: scalar: A NDArray. array: A NDArray. Returns: The elementwise difference of `array1` and`array2`. """ return mod[dtype, backend=backend](array, scalar) fn mul[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise product of array1 and array2. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: A NDArray equal to array1*array2. """ return backend().math_func_2_array_in_one_array_out[dtype, SIMD.__mul__]( array1, array2 ) fn mul[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](array: NDArray[dtype], scalar: Scalar[dtype]) raises -> NDArray[dtype]: """ Perform multiplication on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. scalar: A NDArray. Returns: The elementwise product of `array1` and`array2`. """ return backend().math_func_1_array_1_scalar_in_one_array_out[ dtype, SIMD.__mul__ ](array, scalar) fn mul[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](scalar: Scalar[dtype], array: NDArray[dtype]) raises -> NDArray[dtype]: """ Perform multiplication on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: scalar: A NDArray. array: A NDArray. Returns: The elementwise product of `array1` and`array2`. """ return mul[dtype, backend=backend](array, scalar) fn mul[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](owned *values: Variant[NDArray[dtype], Scalar[dtype]]) raises -> NDArray[ dtype ]: """ Perform multiplication on a list of arrays an arrays and a scalars. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: values: A list of arrays or Scalars to be added. Returns: The elementwise product of `array1` and`array2`. """ var array_list: List[NDArray[dtype]] = List[NDArray[dtype]]() var scalar_part: Scalar[dtype] = 0 for val in values: if val[].isa[NDArray[dtype]](): array_list.append(val[].take[NDArray[dtype]]()) elif val[].isa[Scalar[dtype]](): scalar_part += val[].take[Scalar[dtype]]() if len(array_list) == 0: raise Error( "math:arithmetic:mul(*values:Variant[NDArray[dtype],Scalar[dtype]]):" " No arrays in arguaments" ) var result_array: NDArray[dtype] = NDArray[dtype](array_list[0].shape()) for array in array_list: result_array = mul[dtype, backend=backend](result_array, array) result_array = mul[dtype, backend=backend](result_array, scalar_part) return result_array fn div[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise quotent of array1 and array2. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: A NDArray equal to array1/array2. """ return backend().math_func_2_array_in_one_array_out[ dtype, SIMD.__truediv__ ](array1, array2) fn div[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](array: NDArray[dtype], scalar: Scalar[dtype]) raises -> NDArray[dtype]: """ Perform true division on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. scalar: A NDArray. Returns: The elementwise quotient of `array1` and`array2`. """ return backend().math_func_1_array_1_scalar_in_one_array_out[ dtype, SIMD.__truediv__ ](array, scalar) fn div[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](scalar: Scalar[dtype], array: NDArray[dtype]) raises -> NDArray[dtype]: """ Perform true division on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: scalar: A NDArray. array: A NDArray. Returns: The elementwise quotient of `array1` and`array2`. """ return div[dtype, backend=backend](array, scalar) fn floor_div[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise quotent of array1 and array2. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: A NDArray equal to array1/array2. """ return backend().math_func_2_array_in_one_array_out[ dtype, SIMD.__floordiv__ ](array1, array2) fn floor_div[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](array: NDArray[dtype], scalar: Scalar[dtype]) raises -> NDArray[dtype]: """ Perform true division on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. scalar: A NDArray. Returns: The elementwise quotient of `array1` and`array2`. """ return backend().math_func_1_array_1_scalar_in_one_array_out[ dtype, SIMD.__floordiv__ ](array, scalar) fn floor_div[ dtype: DType, backend: _mf.Backend = _mf.Vectorized, ](scalar: Scalar[dtype], array: NDArray[dtype]) raises -> NDArray[dtype]: """ Perform true division on between an array and a scalar. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: scalar: A NDArray. array: A NDArray. Returns: The elementwise quotient of `array1` and`array2`. """ return floor_div[dtype, backend=backend](array, scalar) fn fma[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ]( array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ return backend().math_func_fma(array1, array2, array3) fn fma[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ]( array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1] ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A a new NDArray that is NDArray with the function func applied. """ return backend().math_func_fma(array1, array2, simd) fn remainder[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise remainders of NDArray. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: A NDArray equal to array1//array2. """ return backend().math_func_2_array_in_one_array_out[dtype, math.remainder]( array1, array2 ) # fn reciprocal[ # dtype: DType, backend: _mf.Backend = _mf.Vectorized # ](NDArray: NDArray[dtype]) -> NDArray[dtype]: # """ # Elementwise reciprocals of array1 and array2. # Constraints: # Both arrays must have the same shapes. # Parameters: # dtype: The element type. # backend: Sets utility function origin, defualts to `Vectorized`. # Args: # NDArray: A NDArray. # Returns: # A NDArray equal to 1/NDArray. # """ # return backend().math_func_1_array_in_one_array_out[ # dtype, math.reciprocal # ](NDArray) # ===------------------------------------------------------------------------===# # Exponents/Roots # ===------------------------------------------------------------------------===# fn cbrt[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise cuberoot of NDArray. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to NDArray**(1/3). """ return backend().math_func_1_array_in_one_array_out[dtype, math.cbrt](array) # fn pow[dtype: DType, # backend: _mf.Backend = _mf.Vectorized](array1: NDArray[dtype], intval: Int) -> NDArray[dtype]: # """ # Elementwise NDArray to the power of intval. # Constraints: # Both arrays must have the same shapes. # Parameters: # dtype: The element type. # backend: Sets utility function origin, defualts to `Vectorized`. # Args: # array1: A NDArray. # intval: An integer. # Returns: # A NDArray equal to NDArray**intval. # """ # return backend().math_func_simd_int[dtype, math.pow](array1, intval) fn rsqrt[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise reciprocal squareroot of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to 1/NDArray**(1/2). """ return backend().math_func_1_array_in_one_array_out[dtype, math.rsqrt]( array ) fn sqrt[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise squareroot of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to NDArray**(1/2). """ return backend().math_func_1_array_in_one_array_out[dtype, math.sqrt](array) fn exp2[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Calculate elementwise two to the power of NDArray[i]. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray with the shape of `NDArray` with values equal to the 2 to the power of the value in the original NDArray at each position. """ return backend().math_func_1_array_in_one_array_out[dtype, math.exp2](array) fn exp[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Calculate elementwise euler's constant(e) to the power of NDArray[i]. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray with the shape of `NDArray` with values equal to the e to the power of the value in the original NDArray at each position. """ return backend().math_func_1_array_in_one_array_out[dtype, math.exp](array) fn expm1[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Calculate elementwise euler's constant(e) to the power of NDArray[i] minus1. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray with the shape of `NDArray` with values equal to the negative one plus e to the power of the value in the original NDArray at each position. """ return backend().math_func_1_array_in_one_array_out[dtype, math.expm1]( array ) # this is a temporary doc, write a more explanatory one fn scalb[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Calculate the scalb of array1 and array2. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: A NDArray. array2: A NDArray. Returns: A NDArray with the shape of `NDArray` with values equal to the negative one plus e to the power of the value in the original NDArray at each position. """ return backend().math_func_2_array_in_one_array_out[dtype, math.scalb]( array1, array2 ) # ===------------------------------------------------------------------------===# # Logarithms # ===------------------------------------------------------------------------===# fn log[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise natural logarithm of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to ln(NDArray). """ return backend().math_func_1_array_in_one_array_out[dtype, math.log](array) alias ln = log """ Natural Log equivelent to log """ fn log2[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise logarithm base two of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to log_2(NDArray). """ return backend().math_func_1_array_in_one_array_out[dtype, math.log2](array) fn log10[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise logarithm base ten of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to log_10(NDArray). """ return backend().math_func_1_array_in_one_array_out[dtype, math.log10]( array ) fn log1p[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise natural logarithm of 1 plus NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to ln(NDArray+1). """ return backend().math_func_1_array_in_one_array_out[dtype, math.log1p]( array ) # ===------------------------------------------------------------------------===# # Rounding and Similiar concepts # ===------------------------------------------------------------------------===# fn tabs[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise absolute value of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to abs(NDArray). """ return backend().math_func_1_array_in_one_array_out[dtype, SIMD.__abs__]( array ) fn tfloor[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise round down to nearest whole number of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to floor(NDArray). """ return backend().math_func_1_array_in_one_array_out[dtype, SIMD.__floor__]( array ) fn tceil[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise round up to nearest whole number of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to ceil(NDArray). """ return backend().math_func_1_array_in_one_array_out[dtype, SIMD.__ceil__]( array ) fn ttrunc[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise remove decimal value from float whole number of NDArray. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to trunc(NDArray). """ return backend().math_func_1_array_in_one_array_out[dtype, SIMD.__trunc__]( array ) fn tround[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise round NDArray to whole number. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to trunc(NDArray). """ return backend().math_func_1_array_in_one_array_out[dtype, SIMD.__round__]( array ) fn roundeven[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Performs elementwise banker's rounding on the elements of a NDArray. Parameters: dtype: The dtype of the input and output array. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: Array to perform rounding on. Returns: The elementwise banker's rounding of NDArray. This rounding goes to the nearest integer with ties toward the nearest even integer. """ return backend().math_func_1_array_in_one_array_out[dtype, SIMD.roundeven]( array ) # fn round_half_down[ # dtype: DType, backend: _mf.Backend = _mf.Vectorized # ](NDArray: NDArray[dtype]) -> NDArray[dtype]: # """ # Rounds ties towards the smaller integer. # Parameters: # dtype: The dtype of the input and output array. # backend: Sets utility function origin, defualts to `Vectorized`. # Args: # NDArray: array to perform rounding on. # Returns: # The elementwise rounding of x evaluating ties towards the smaller integer. # """ # return backend().math_func_1_array_in_one_array_out[ # dtype, SIMD.__round_half_down # ](NDArray) # fn round_half_up[ # dtype: DType, backend: _mf.Backend = _mf.Vectorized # ](NDArray: NDArray[dtype]) -> NDArray[dtype]: # """ # Rounds ties towards the larger integer. # Parameters: # dtype: The dtype of the input and output array. # backend: Sets utility function origin, defualts to `Vectorized`. # Args: # NDArray: array to perform rounding on. # Returns: # The elementwise rounding of x evaluating ties towards the larger integer. # """ # return backend().math_func_1_array_in_one_array_out[ # dtype, math.round_half_up # ](NDArray) fn nextafter[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Computes the nextafter of the inputs. Parameters: dtype: The dtype of the input and output array. Constraints: must be a floating-point type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array1: The first input argument. array2: The second input argument. Returns: The nextafter of the inputs. """ return backend().math_func_2_array_in_one_array_out[dtype, math.nextafter]( array1, array2 ) # ===------------------------------------------------------------------------===# # Boolean Arithmetic # ===------------------------------------------------------------------------===# fn invert[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Elementwise invert of an array. Constraints: The array must be either a boolean or integral array. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized`. Args: array: A NDArray. Returns: A NDArray equal to the bitwise inversion of array. """ constrained[ dtype.is_integral() or dtype.is_integral(), "Only Bools and integral types can be invertedd.", ]() return backend().math_func_1_array_in_one_array_out[dtype, SIMD.__invert__]( array ) --- numojo/math/calculus/__init__.mojo --- from .differentiation import * from .integral import * --- numojo/math/calculus/differentiation.mojo --- # ===----------------------------------------------------------------------=== # # implements basic Integral functions # Last updated: 2024-07-02 # ===----------------------------------------------------------------------=== # import math import .. math_funcs as _mf import ... core as core from ...core.ndarray import NDArray, NDArrayShape from ...core.utility_funcs import is_inttype, is_floattype """TODO: 1) add a Variant[NDArray, Scalar, ...] to include all possibilities 2) add edge_order """ fn gradient[ dtype: DType ](x: NDArray[dtype], spacing: Scalar[dtype]) raises -> NDArray[dtype]: """ Compute the gradient of y over x using the trapezoidal rule. Parameters: dtype: Input data type. Args: x: An array. spacing: An array of the same shape as x containing the spacing between adjacent elements. Constraints: `fdtype` must be a floating-point type if `idtype` is not a floating-point type. Returns: The integral of y over x using the trapezoidal rule. """ var result: NDArray[dtype] = NDArray[dtype](x.shape(), random=False) var space: NDArray[dtype] = core.arange[dtype]( 1, x.num_elements() + 1, step=spacing ) var hu: Scalar[dtype] = space.get_scalar(1) var hd: Scalar[dtype] = space.get_scalar(0) result.store( 0, (x.get_scalar(1) - x.get_scalar(0)) / (hu - hd), ) hu = space.get_scalar(x.num_elements() - 1) hd = space.get_scalar(x.num_elements() - 2) result.store( x.num_elements() - 1, ( x.get_scalar(x.num_elements() - 1) - x.get_scalar(x.num_elements() - 2) ) / (hu - hd), ) for i in range(1, x.num_elements() - 1): var hu: Scalar[dtype] = space.get_scalar(i + 1) - space.get_scalar(i) var hd: Scalar[dtype] = space.get_scalar(i) - space.get_scalar(i - 1) var fi: Scalar[dtype] = ( hd**2 * x.get_scalar(i + 1) + (hu**2 - hd**2) * x.get_scalar(i) - hu**2 * x.get_scalar(i - 1) ) / (hu * hd * (hu + hd)) result.store(i, fi) return result --- numojo/math/calculus/integral.mojo --- # ===----------------------------------------------------------------------=== # # implements basic Integral functions # Last updated: 2024-06-18 # ===----------------------------------------------------------------------=== # import math import .. math_funcs as _mf from ...core.ndarray import NDArray, NDArrayShape from ...core.utility_funcs import is_inttype, is_floattype from algorithm import parallelize from algorithm import Static2DTileUnitFunc as Tile2DFunc # naive loop implementation, optimize later fn trapz[ dtype: DType = DType.float64 ](y: NDArray[dtype], x: NDArray[dtype]) raises -> SIMD[dtype, 1]: """ Compute the integral of y over x using the trapezoidal rule. Parameters: dtype: The element type. Args: y: An array. x: An array. Constraints: `x` and `y` must have the same shape. `fdtype` must be a floating-point type if `idtype` is not a floating-point type. Returns: The integral of y over x using the trapezoidal rule. """ if x.shape() != y.shape(): raise Error("x and y must have the same shape") # move this check to compile time using constrained? if is_inttype[dtype]() and not is_floattype[dtype](): raise Error( "output dtype `Fdtype` must be a floating-point type if input dtype" " `Idtype` is not a floating-point type" ) var integral: SIMD[dtype] = 0.0 for i in range(x.num_elements() - 1): var temp = (x.get_scalar(i + 1) - x.get_scalar(i)) * ( y.get_scalar(i) + y.get_scalar(i + 1) ) / 2.0 integral += temp return integral --- numojo/math/check.mojo --- """ Implements Checking routines: currently not SIMD due to bool bit packing issue """ # ===----------------------------------------------------------------------=== # # CHECK ROUTINES # Last updated: 2024-06-16 # ===----------------------------------------------------------------------=== # import math import . math_funcs as _mf from ..core.ndarray import NDArray # fn is_power_of_2[ # dtype: DType, backend: _mf.Backend = _mf.Vectorized # ](array: NDArray[dtype]) -> NDArray[DType.bool]: # return backend().math_func_is[dtype, math.is_power_of_2](array) # fn is_even[ # dtype: DType, backend: _mf.Backend = _mf.Vectorized # ](array: NDArray[dtype]) -> NDArray[DType.bool]: # return backend().math_func_is[dtype, math.is_even](array) # fn is_odd[ # dtype: DType, backend: _mf.Backend = _mf.Vectorized # ](array: NDArray[dtype]) -> NDArray[DType.bool]: # return backend().math_func_is[dtype, math.is_odd](array) fn isinf[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Checks if each element of the input array is infinite. Parameters: dtype: DType - Data type of the input array. backend: _mf.Backend - Backend to use for the operation. Defaults to _mf.Vectorized. Args: array: NDArray[dtype] - Input array to check. Returns: NDArray[DType.bool] - A array of the same shape as `array` with True for infinite elements and False for others. """ # return backend().math_func_is[dtype, math.isinf](array) var result_array: NDArray[DType.bool] = NDArray[DType.bool](array.shape()) for i in range(result_array.size()): result_array.store(i, math.isinf(array.get_scalar(i))) return result_array fn isfinite[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Checks if each element of the input array is finite. Parameters: dtype: DType - Data type of the input array. backend: _mf.Backend - Backend to use for the operation. Defaults to _mf.Vectorized. Args: array: NDArray[dtype] - Input array to check. Returns: NDArray[DType.bool] - A array of the same shape as `array` with True for finite elements and False for others. """ # return backend().math_func_is[dtype, math.isfinite](array) var result_array: NDArray[DType.bool] = NDArray[DType.bool](array.shape()) for i in range(result_array.size()): result_array.store(i, math.isfinite(array.get_scalar(i))) return result_array fn isnan[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Checks if each element of the input array is NaN. Parameters: dtype: DType - Data type of the input array. backend: _mf.Backend - Backend to use for the operation. Defaults to _mf.Vectorized. Args: array: NDArray[dtype] - Input array to check. Returns: NDArray[DType.bool] - A array of the same shape as `array` with True for NaN elements and False for others. """ # return backend().math_func_is[dtype, math.isnan](array) var result_array: NDArray[DType.bool] = NDArray[DType.bool](array.shape()) for i in range(result_array.size()): result_array.store(i, math.isnan(array.get_scalar(i))) return result_array fn any(array: NDArray[DType.bool]) raises -> Scalar[DType.bool]: """ If any True. Args: array: A NDArray. Returns: A boolean scalar """ var result = Scalar[DType.bool](False) # alias opt_nelts: Int = simdwidthof[DType.bool]() # @parameter # fn vectorize_sum[simd_width: Int](idx: Int) -> None: # var simd_data = array.load[width=simd_width](idx) # result &= simd_data.reduce_or() # vectorize[vectorize_sum, opt_nelts](array.num_elements()) # return result for i in range(array.size()): result |= array.get_scalar(i) return result fn allt(array: NDArray[DType.bool]) raises -> Scalar[DType.bool]: """ If all True. Args: array: A NDArray. Returns: A boolean scalar """ var result = Scalar[DType.bool](True) # alias opt_nelts: Int = simdwidthof[DType.bool]() # @parameter # fn vectorize_sum[simd_width: Int](idx: Int) -> None: # var simd_data = array.load[width=simd_width](idx) # result |= simd_data.reduce_and() # vectorize[vectorize_sum, opt_nelts](array.num_elements()) # return result for i in range(array.size()): result &= array.get_scalar(i) return result --- numojo/math/comparison.mojo --- """ Implements comparison math currently not using backend due to bool bitpacking issue """ # ===----------------------------------------------------------------------=== # # Implements comparison functions # Last updated: 2024-06-16 # ===----------------------------------------------------------------------=== # import math import . math_funcs as _mf from ..core.ndarray import NDArray # ===-------------------------------------a-----------------------------------===# # Simple Elementwise Comparisons # ===------------------------------------------------------------------------===# fn greater[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are greater than values in y. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. array2: Second NDArray to compare. Returns: A NDArray containing True if the corresponding element in x is greater than the corresponding element in y, otherwise False. An element of the result NDArray will be True if the corresponding element in x is greater than the corresponding element in y, and False otherwise. """ return backend().math_func_compare_2_arrays[dtype, SIMD.__gt__]( array1, array2 ) fn greater[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], scalar: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are greater than a scalar. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. scalar: Scalar to compare. Returns: A NDArray containing True if the element in x is greater than the scalar, otherwise False. An element of the result NDArray will be True if the element in x is greater than the scalar, and False otherwise. """ return backend().math_func_compare_array_and_scalar[dtype, SIMD.__gt__]( array1, scalar ) fn greater_equal[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are greater than or equal to values in y. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. array2: Second NDArray to compare. Returns: A NDArray containing True if the corresponding element in x is greater than or equal to the corresponding element in y, otherwise False. An element of the result NDArray will be True if the corresponding element in x is greater than or equal to the corresponding element in y, and False otherwise. """ return backend().math_func_compare_2_arrays[dtype, SIMD.__ge__]( array1, array2 ) fn greater_equal[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], scalar: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are greater than or equal to a scalar. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. scalar: Scalar to compare. Returns: A NDArray containing True if the element in x is greater than or equal to the scalar, otherwise False. An element of the result NDArray will be True if the element in x is greater than or equal to the scalar, and False otherwise. """ return backend().math_func_compare_array_and_scalar[dtype, SIMD.__ge__]( array1, scalar ) fn less[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are to values in y. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. array2: Second NDArray to compare. Returns: A NDArray containing True if the corresponding element in x is or equal to the corresponding element in y, otherwise False. An element of the result NDArray will be True if the corresponding element in x is or equal to the corresponding element in y, and False otherwise. """ return backend().math_func_compare_2_arrays[dtype, SIMD.__lt__]( array1, array2 ) fn less[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], scalar: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are to a scalar. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. scalar: Scalar to compare. Returns: A NDArray containing True if the element in x is or equal to the scalar, otherwise False. An element of the result NDArray will be True if the element in x is or equal to the scalar, and False otherwise. """ return backend().math_func_compare_array_and_scalar[dtype, SIMD.__lt__]( array1, scalar ) fn less_equal[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are less than or equal to values in y. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. array2: Second NDArray to compare. Returns: A NDArray containing True if the corresponding element in x is less than or equal to the corresponding element in y, otherwise False. An element of the result NDArray will be True if the corresponding element in x is less than or equal to the corresponding element in y, and False otherwise. """ return backend().math_func_compare_2_arrays[dtype, SIMD.__le__]( array1, array2 ) fn less_equal[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], scalar: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are less than or equal to a scalar. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. scalar: Scalar to compare. Returns: A NDArray containing True if the element in x is less than or equal to the scalar, otherwise False. An element of the result NDArray will be True if the element in x is less than or equal to the scalar, and False otherwise. """ return backend().math_func_compare_array_and_scalar[dtype, SIMD.__le__]( array1, scalar ) fn equal[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are equal to values in y. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. array2: Second NDArray to compare. Returns: A NDArray containing True if the corresponding element in x is equal to the corresponding element in y, otherwise False. An element of the result NDArray will be True if the corresponding element in x is equal to the corresponding element in y, and False otherwise. """ return backend().math_func_compare_2_arrays[dtype, SIMD.__eq__]( array1, array2 ) # if array1.shape() != array2.shape(): # raise Error( # "Shape Mismatch error shapes must match for this function" # ) # var result_array: NDArray[DType.bool] = NDArray[DType.bool](array1.shape()) # for i in range(result_array.size()): # result_array[i] = array1[i]==array2[i] # return result_array fn equal[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], scalar: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are equal to a scalar. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. scalar: Scalar to compare. Returns: A NDArray containing True if the element in x is equal to the scalar, otherwise False. An element of the result NDArray will be True if the element in x is equal to the scalar, and False otherwise. """ return backend().math_func_compare_array_and_scalar[dtype, SIMD.__eq__]( array1, scalar ) fn not_equal[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are not equal to values in y. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. array2: Second NDArray to compare. Returns: A NDArray containing True if the corresponding element in x is not equal to the corresponding element in y, otherwise False. An element of the result NDArray will be True if the corresponding element in x is not equal to the corresponding element in y, and False otherwise. """ return backend().math_func_compare_2_arrays[dtype, SIMD.__ne__]( array1, array2 ) # if array1.shape() != array2.shape(): # raise Error( # "Shape Mismatch error shapes must match for this function" # ) # var result_array: NDArray[DType.bool] = NDArray[DType.bool](array1.shape()) # for i in range(result_array.size()): # result_array[i] = array1[i]!=array2[i] # return result_array fn not_equal[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], scalar: SIMD[dtype, 1]) raises -> NDArray[DType.bool]: """ Performs elementwise check of whether values in x are not equal to values in y. Parameters: dtype: The dtype of the input NDArray. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: First NDArray to compare. scalar: Scalar to compare. Returns: A NDArray containing True if the element in x is not equal to the scalar, otherwise False. An element of the result NDArray will be True if the element in x is not equal to the scalar, and False otherwise. """ return backend().math_func_compare_array_and_scalar[dtype, SIMD.__ne__]( array1, scalar ) --- numojo/math/interpolate.mojo --- """ Interpolate Module - Implements interpolation functions """ # ===----------------------------------------------------------------------=== # # Interpolate Module - Implements interpolation functions # Last updated: 2024-06-14 # ===----------------------------------------------------------------------=== # from ..core.ndarray import NDArray, NDArrayShape """ # TODO: 1) Cross check all the functions with numpy 2) Add support for axis argument """ fn interp1d[ dtype: DType = DType.float64 ]( xi: NDArray[dtype], x: NDArray[dtype], y: NDArray[dtype], type: String = "linear", fill_method: String = "interpolate", ) raises -> NDArray[dtype]: """ Interpolate the values of y at the points xi. Parameters: dtype: The element type. Args: xi: An Array. x: An Array. y: An Array. type: The interpolation method. fill_method: The fill value. Returns: The interpolated values of y at the points xi as An Array of `dtype`. """ # linear if type == "linear" and fill_method == "extrapolate": return _interp1d_linear_extrapolate(xi, x, y) elif type == "linear" and fill_method == "interpolate": return _interp1d_linear_interpolate(xi, x, y) # quadratic # elif method == "quadratic" and fill_value == "extrapolate": # return _interp1d_quadratic_extrapolate(xi, x, y) # elif method == "quadratic" and fill_value == "interpolate": # return _interp1d_quadratic_interpolate(xi, x, y) # cubic # elif method == "cubic" and fill_value == "extrapolate": # return _interp1d_cubic_extrapolate(xi, x, y) # elif method == "cubic" and fill_value == "interpolate": # return _interp1d_cubic_interpolate(xi, x, y) else: print("Invalid interpolation method: " + type) return NDArray[dtype]() fn _interp1d_linear_interpolate[ dtype: DType ](xi: NDArray[dtype], x: NDArray[dtype], y: NDArray[dtype]) raises -> NDArray[ dtype ]: """ Linear interpolation of the (x, y) values at the points xi. Parameters: dtype: The element type. Args: xi: An Array. x: An Array. y: An Array. Returns: The linearly interpolated values of y at the points xi as An Array of `dtype`. """ var result = NDArray[dtype](xi.shape()) for i in range(xi.num_elements()): if xi.data[i] <= x.data[0]: result.data.store[width=1](i, y.data[0]) elif xi.data[i] >= x.data[x.num_elements() - 1]: result.data.store[width=1](i, y.data[y.num_elements() - 1]) else: var j = 0 while xi.data[i] > x.data[j]: j += 1 var x0 = x.data[j - 1] var x1 = x.data[j] var y0 = y.data[j - 1] var y1 = y.data[j] var t = (xi.data[i] - x0) / (x1 - x0) result.data.store[width=1](i, y0 + t * (y1 - y0)) return result fn _interp1d_linear_extrapolate[ dtype: DType ](xi: NDArray[dtype], x: NDArray[dtype], y: NDArray[dtype]) raises -> NDArray[ dtype ]: """ Linear extrapolation of the (x, y) values at the points xi. Parameters: dtype: The element type. Args: xi: An Array. x: An Array. y: An Array. Returns: The linearly extrapolated values of y at the points xi as An Array of `dtype`. """ var result = NDArray[dtype](xi.shape()) for i in range(xi.num_elements()): if xi.data.load[width=1](i) <= x.data.load[width=1](0): var slope = (y.data[1] - y.data[0]) / (x.data[1] - x.data[0]) result.data[i] = y.data[0] + slope * (xi.data[i] - x.data[0]) elif xi.data[i] >= x.data[x.num_elements() - 1]: var slope = ( y.data[y.num_elements() - 1] - y.data[y.num_elements() - 2] ) / (x.data[x.num_elements() - 1] - x.data[x.num_elements() - 2]) result.data[i] = y.data[y.num_elements() - 1] + slope * ( xi.data[i] - x.data[x.num_elements() - 1] ) else: var j = 0 while xi.data[i] > x.data[j]: j += 1 var x0 = x.data[j - 1] var x1 = x.data[j] var y0 = y.data[j - 1] var y1 = y.data[j] var t = (xi.data[i] - x0) / (x1 - x0) result.data[i] = y0 + t * (y1 - y0) return result # fn _interp1d_quadratic_interpolate[ # dtype: DType # ](xi: NDArray[dtype], x: NDArray[dtype], y: NDArray[dtype]) raises -> NDArray[ # dtype # ]: # """ # Quadratic interpolation of the (x, y) values at the points xi. # Parameters: # dtype: The element type. # Args: # xi: An Array. # x: An Array. # y: An Array. # Returns: # The quadratically interpolated values of y at the points xi as An Array of `dtype`. # """ # var result = NDArray[dtype](xi.shape()) # for i in range(xi.num_elements()): # if xi[i] <= x[0]: # result[i] = y[0] # elif xi[i] >= x[x.num_elements() - 1]: # result[i] = y[y.num_elements() - 1] # else: # var j = 1 # while xi[i] > x[j]: # j += 1 # var x0 = x[j - 2] # var x1 = x[j - 1] # var x2 = x[j] # var y0 = y[j - 2] # var y1 = y[j - 1] # var y2 = y[j] # var t = (xi[i] - x1) / (x2 - x1) # var a = y0 # var b = y1 # var c = y2 # result[i] = a * t * t + b * t + c # return result # fn _interp1d_quadratic_extrapolate[ # dtype: DType # ](xi: NDArray[dtype], x: NDArray[dtype], y: NDArray[dtype]) raises -> NDArray[ # dtype # ]: # """ # Quadratic extrapolation of the (x, y) values at the points xi. # Parameters: # dtype: The element type. # Args: # xi: An Array. # x: An Array. # y: An Array. # Returns: # The quadratically extrapolated values of y at the points xi as An Array of `dtype`. # """ # var result = NDArray[dtype](xi.shape()) # for i in range(xi.num_elements()): # if xi[i] <= x[0]: # var slope = (y[1] - y[0]) / (x[1] - x[0]) # var intercept = y[0] - slope * x[0] # result[i] = intercept + slope * xi[i] # elif xi[i] >= x[x.num_elements() - 1]: # var slope = (y[y.num_elements() - 1] - y[y.num_elements() - 2]) / ( # x[x.num_elements() - 1] - x[x.num_elements() - 2] # ) # var intercept = y[y.num_elements() - 1] - slope * x[ # x.num_elements() - 1 # ] # result[i] = intercept + slope * xi[i] # else: # var j = 1 # while xi[i] > x[j]: # j += 1 # var x0 = x[j - 2] # var x1 = x[j - 1] # var x2 = x[j] # var y0 = y[j - 2] # var y1 = y[j - 1] # var y2 = y[j] # var t = (xi[i] - x1) / (x2 - x1) # var a = y0 # var b = y1 # var c = y2 # result[i] = a * t * t + b * t + c # return result # fn _interp1d_cubic_interpolate[ # dtype: DType # ](xi: NDArray[dtype], x: NDArray[dtype], y: NDArray[dtype]) raises -> NDArray[ # dtype # ]: # """ # Cubic interpolation of the (x, y) values at the points xi. # Parameters: # dtype: The element type. # Args: # xi: An Array. # x: An Array. # y: An Array. # Returns: # The cubically interpolated values of y at the points xi as An Array of `dtype`. # """ # var result = NDArray[dtype](xi.shape()) # for i in range(xi.num_elements()): # if xi[i] <= x[0]: # result[i] = y[0] # elif xi[i] >= x[x.num_elements() - 1]: # result[i] = y[y.num_elements() - 1] # else: # var j = 0 # while xi[i] > x[j]: # j += 1 # # Ensure we have enough points for cubic interpolation # # var j = math.max(j, 2) # # var j = math.min(j, x.num_elements() - 2) # var x0 = x[j - 2] # var x1 = x[j - 1] # var x2 = x[j] # var x3 = x[j + 1] # var y0 = y[j - 2] # var y1 = y[j - 1] # var y2 = y[j] # var y3 = y[j + 1] # var t = (xi[i] - x1) / (x2 - x1) # # Cubic interpolation formula # var a0 = (y3 - y2) - (y0 + y1) # var a1 = y0 - y1 - a0 # var a2 = y2 - y0 # var a3 = y1 # result.store(i, (a0 * t) * (t * t) + (a1 * t) * (t + a2) * (t + a3)) # return result # fn _interp1d_cubic_extrapolate[ # dtype: DType # ](xi: NDArray[dtype], x: NDArray[dtype], y: NDArray[dtype]) raises -> NDArray[ # dtype # ]: # """ # Cubic extrapolation of the (x, y) values at the points xi. # Parameters: # dtype: The element type. # Args: # xi: An Array. # x: An Array. # y: An Array. # Returns: # The cubically extrapolated values of y at the points xi as An Array of `dtype`. # """ # var result = NDArray[dtype](xi.shape()) # for i in range(xi.num_elements()): # if (xi[i] <= x[0]): # var t = (xi[i] - x[0]) / (x[1] - x[0]) # var a0: NDArray[dtype] = (y[2] - y[1]) + (y[1]-y[0]) # var a1 = y[0] - y[1] - a0 # var a2 = y[1] - y[0] # var a3 = y[0] # result[i] = a0 * t * t * t + a1 * t * t + a2 * t + a3 # elif xi[i] >= x[x.num_elements() - 1]: # var t = (xi[i] - x[x.num_elements() - 2]) / ( # x[x.num_elements() - 1] - x[x.num_elements() - 2] # ) # var a0 = y[y.num_elements() - 1] - y[y.num_elements() - 2] - y[ # y.num_elements() - 3 # ] + y[y.num_elements() - 2] # var a1 = y[y.num_elements() - 3] - y[y.num_elements() - 2] - a0 # var a2 = y[y.num_elements() - 2] - y[y.num_elements() - 3] # var a3 = y[y.num_elements() - 2] # result[i] = a0 * t * t * t + a1 * t * t + a2 * t + a3 # else: # var j = 1 # while xi[i] > x[j]: # j += 1 # var x0 = x[j - 2] # var x1 = x[j - 1] # var x2 = x[j] # var x3 = x[j + 1] # var y0 = y[j - 2] # var y1 = y[j - 1] # var y2 = y[j] # var y3 = y[j + 1] # var t = (xi[i] - x1) / (x2 - x1) # var a0 = y3 - y2 - y0 + y1 # var a1 = y0 - y1 - a0 # var a2 = y2 - y0 # var a3 = y1 # result[i] = a0 * t * t * t + a1 * t * t + a2 * t + a3 # return result --- numojo/math/linalg/__init__.mojo --- from .linalg import * from .matmul import * --- numojo/math/linalg/linalg.mojo --- """ Linear Algebra misc. functions """ # ===----------------------------------------------------------------------=== # # implements basic Linear Algebra functions # Last updated: 2024-06-18 # ===----------------------------------------------------------------------=== # import math import .. math_funcs as _mf from ...core.ndarray import NDArray, NDArrayShape from algorithm import parallelize from algorithm import Static2DTileUnitFunc as Tile2DFunc fn cross[ dtype: DType = DType.float64 ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Compute the cross product of two arrays. Parameters dtype: The element type. Args: array1: A array. array2: A array. Constraints: `array1` and `array2` must be of shape (3,). Returns: The cross product of two arrays. """ if array1.ndshape.ndlen == array2.ndshape.ndlen == 3: var array3: NDArray[dtype] = NDArray[dtype](NDArrayShape(3)) array3.store( 0, ( array1.get_scalar(1) * array2.get_scalar(2) - array1.get_scalar(2) * array2.get_scalar(1) ), ) array3.store( 1, ( array1.get_scalar(2) * array2.get_scalar(0) - array1.get_scalar(0) * array2.get_scalar(2) ), ) array3.store( 2, ( array1.get_scalar(0) * array2.get_scalar(1) - array1.get_scalar(1) * array2.get_scalar(0) ), ) return array3 else: raise Error( "Cross product is not supported for arrays of shape " + array1.shape().__str__() + " and " + array2.shape().__str__() ) --- numojo/math/linalg/matmul.mojo --- """ Matrix multiplication functions for NDArrays """ # ===----------------------------------------------------------------------=== # # implements matmul functions # Last updated: 2024-06-18 # ===----------------------------------------------------------------------=== # import math import .. math_funcs as _mf from ...core.ndarray import NDArray, NDArrayShape from algorithm import parallelize, vectorize from algorithm import Static2DTileUnitFunc as Tile2DFunc # Perform 2D tiling on the iteration space defined by end_x and end_y. fn tile[tiled_fn: Tile2DFunc, tile_x: Int, tile_y: Int](end_x: Int, end_y: Int): # Note: this assumes that ends are multiples of the tiles. for y in range(0, end_y, tile_y): for x in range(0, end_x, tile_x): tiled_fn[tile_x, tile_y](x, y) # https://docs.modular.com/mojo/notebooks/Matmul fn matmul_tiled_unrolled_parallelized[ dtype: DType ](A: NDArray[dtype], B: NDArray[dtype]) raises -> NDArray[dtype]: """ Matrix multiplication vectorized, tiled, unrolled, and parallelized. """ alias nelts = max(simdwidthof[dtype](), 16) var C: NDArray[dtype] = NDArray[dtype]( A.ndshape.load_int(0), B.ndshape.load_int(1) ) var t0 = A.ndshape.load_int(0) var t1 = A.ndshape.load_int(1) var t2 = B.ndshape.load_int(1) @parameter fn calculate_A_rows(m: Int): @parameter fn calc_tile[tile_x: Int, tile_y: Int](x: Int, y: Int): for k in range(y, y + tile_y): @parameter fn dot[nelts: Int](n: Int): C.store( m * t2 + (n + x), val=C.load[nelts](m * t2 + (n + x)) + A.load(m * t1 + k) * B.load[nelts](k * t2 + (n + x)), ) alias unroll_factor = tile_x // nelts vectorize[ dot, nelts, size=tile_x, unroll_factor=unroll_factor ]() alias tile_size = 4 tile[calc_tile, nelts * tile_size, tile_size](t1, t2) parallelize[calculate_A_rows](t0, t0) return C fn matmul_parallelized[ dtype: DType ](A: NDArray[dtype], B: NDArray[dtype]) raises -> NDArray[dtype]: """ Matrix multiplication Vectorized and parallelized. Conduct `matmul` using `vectorize` and `parallelize`. Reference: https://docs.modular.com/mojo/notebooks/Matmul Compared to the reference, this function increases the size of the SIMD vector from the default width to 16. The purpose is to increase the performance via SIMD. The function reduces the execution time by ~50 percent compared to matmul_parallelized and matmul_tiled_unrolled_parallelized for large matrices. """ alias nelts = max(simdwidthof[dtype](), 16) var C: NDArray[dtype] = NDArray[dtype]( A.ndshape.load_int(0), B.ndshape.load_int(1) ) var t0 = A.ndshape.load_int(0) var t1 = A.ndshape.load_int(1) var t2 = B.ndshape.load_int(1) @parameter fn calculate_A_rows(m: Int): for k in range(t1): @parameter fn dot[nelts: Int](n: Int): C.store( m * t2 + n, val=C.load[nelts](m * t2 + n) + A.load(m * t1 + k) * B.load[nelts](k * t2 + n), ) vectorize[dot, nelts](t2) parallelize[calculate_A_rows](t0, t0) return C fn matmul_naive[ dtype: DType ](A: NDArray[dtype], B: NDArray[dtype]) raises -> NDArray[dtype]: """ Matrix multiplication with three nested loops. """ var C: NDArray[dtype] = NDArray[dtype]( A.ndshape.load_int(0), B.ndshape.load_int(1) ) for m in range(C.ndshape.load_int(0)): for k in range(A.ndshape.load_int(1)): for n in range(C.ndshape.load_int(1)): C.store(m, n, val=C.load(m, n) + A.load(m, k) * B.load(k, n)) return C --- numojo/math/math_funcs.mojo --- """ Implements backend functions for mathematics """ # ===----------------------------------------------------------------------=== # # Implements generic reusable functions for math # Last updated: 2024-06-16 # ===----------------------------------------------------------------------=== # from testing import assert_raises from algorithm.functional import parallelize, vectorize, num_physical_cores from ..traits.backend import Backend from ..core.ndarray import NDArray, NDArrayShape # TODO Add string method to give name struct Vectorized(Backend): """ Vectorized Backend Struct. Parameters unroll_factor: factor by which loops are unrolled. Defualt Numojo computation backend takes advantage of SIMD. Uses defualt simdwidth. """ fn __init__(inout self: Self): pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if ( array1.shape() != array2.shape() and array1.shape() != array3.shape() ): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() # var op_count:Int =0 @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = array2.load[width=simdwidth](i) var simd_data3 = array3.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, SIMD.fma(simd_data1, simd_data2, simd_data3) ) # op_count+=1 vectorize[closure, opt_nelts](array1.num_elements()) # print(op_count) return result_array fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = array2.load[width=simdwidth](i) # var simd_data3 = array3.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, SIMD.fma(simd_data1, simd_data2, simd) ) vectorize[closure, opt_nelts](array1.num_elements()) return result_array fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD function of one variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts](array.num_elements()) return result_array fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = array2.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data1, simd_data2) ) vectorize[closure, opt_nelts](result_array.num_elements()) return result_array fn math_func_1_array_1_scalar_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. scalar: A Scalars. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array.load[width=simdwidth](i) var simd_data2 = scalar result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data1, simd_data2) ) vectorize[closure, opt_nelts](result_array.num_elements()) return result_array fn math_func_compare_2_arrays[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[DType.bool]: if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = array2.load[width=simdwidth](i) # result_array.store[width=simdwidth]( # i, func[dtype, simdwidth](simd_data1, simd_data2) # ) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](array1.num_elements()) return result_array # TODO: add this function for other backends fn math_func_compare_array_and_scalar[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], scalar: SIMD[dtype, 1] ) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = SIMD[dtype, simdwidth].splat(scalar) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](array1.num_elements()) return result_array fn math_func_is[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ DType.bool, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array.shape() ) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts](array.num_elements()) return result_array fn math_func_simd_int[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w], Int) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype], intval: Int) raises -> NDArray[dtype]: var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data, intval) ) vectorize[closure, opt_nelts](array.num_elements()) return result_array # This provides a way to bypass bitpacking issues with Bool fn bool_simd_store[ width: Int ](ptr: DTypePointer[DType.bool], start: Int, val: SIMD[DType.bool, width]): """ Work around function for storing bools from a simd into a DTypePointer. Parameters: width: Number of items to be retrieved. Args: ptr: Pointer to be retreived from. start: Start position in pointer. val: Value to store at locations. """ (ptr + start).simd_strided_store[width=width, T=Int](val, 1) struct VectorizedUnroll[unroll_factor: Int = 1](Backend): """ Vectorized Backend Struct. Parameters unroll_factor: factor by which loops are unrolled. Defualt Numojo computation backend takes advantage of SIMD. Uses defualt simdwidth. """ fn __init__(inout self: Self): pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if ( array1.shape() != array2.shape() and array1.shape() != array3.shape() ): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = array2.load[width=simdwidth](i) var simd_data3 = array3.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, SIMD.fma(simd_data1, simd_data2, simd_data3) ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array1.num_elements() ) return result_array fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = array2.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, SIMD.fma(simd_data1, simd_data2, simd) ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array1.num_elements() ) return result_array fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD function of one variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array.num_elements() ) return result_array fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = array2.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data1, simd_data2) ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array1.num_elements() ) return result_array fn math_func_1_array_1_scalar_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. scalar: A Scalars. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array.load[width=simdwidth](i) var simd_data2 = scalar result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data1, simd_data2) ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array.num_elements() ) return result_array fn math_func_compare_2_arrays[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[DType.bool]: if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = array2.load[width=simdwidth](i) # result_array.store[width=simdwidth]( # i, func[dtype, simdwidth](simd_data1, simd_data2) # ) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array1.num_elements() ) return result_array fn math_func_compare_array_and_scalar[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], scalar: SIMD[dtype, 1] ) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i) var simd_data2 = SIMD[dtype, simdwidth].splat(scalar) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array1.num_elements() ) return result_array fn math_func_is[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ DType.bool, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array.shape() ) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array.num_elements() ) return result_array fn math_func_simd_int[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w], Int) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype], intval: Int) raises -> NDArray[dtype]: var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data, intval) ) vectorize[closure, opt_nelts, unroll_factor=unroll_factor]( array.num_elements() ) return result_array struct Parallelized(Backend): """ Parrallelized Backend Struct. Currently an order of magnitude slower than Vectorized for most functions. No idea why, Not Reccomened for use at this Time. """ fn __init__(inout self: Self): pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if ( array1.shape() != array2.shape() and array1.shape() != array3.shape() ): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) var simd_data3 = array3.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, SIMD.fma(simd_data1, simd_data2, simd_data3), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() # @parameter # fn remainder_closure[simdwidth: Int](i: Int): # var simd_data1 = array1.load[width=simdwidth](i+remainder_offset) # var simd_data2 = array2.load[width=simdwidth](i+remainder_offset) # var simd_data3 = array3.load[width=simdwidth](i+remainder_offset) # result_array.store[width=simdwidth]( # i+remainder_offset, SIMD.fma(simd_data1,simd_data2,simd_data3) # ) # vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape. Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, SIMD.fma(simd_data1, simd_data2, simd), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() # @parameter # fn remainder_closure[simdwidth: Int](i: Int): # var simd_data1 = array1.load[width=simdwidth](i+remainder_offset) # var simd_data2 = array2.load[width=simdwidth](i+remainder_offset) # result_array.store[width=simdwidth]( # i+remainder_offset, SIMD.fma(simd_data1,simd_data2,simd) # ) # vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD function of one variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array.num_elements() // num_cores @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() # @parameter # fn remainder_closure[simdwidth: Int](i: Int): # var simd_data = array.load[width=simdwidth](i+remainder_offset) # result_array.store[width=simdwidth]( # i+remainder_offset, func[dtype, simdwidth](simd_data) # ) # vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() # @parameter # fn remainder_closure[simdwidth: Int](i: Int): # var simd_data1 = array1.load[width=simdwidth](i+remainder_offset) # var simd_data2 = array2.load[width=simdwidth](i+remainder_offset) # result_array.store[width=simdwidth]( # i+remainder_offset, func[dtype, simdwidth](simd_data1, simd_data2) # ) # vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_1_array_1_scalar_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. scalar: A Scalars. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array.num_elements() // num_cores @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = scalar result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() return result_array fn math_func_compare_2_arrays[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[DType.bool]: if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) # result_array.store[width=simdwidth]( # i + comps_per_core * j, # func[dtype, simdwidth](simd_data1, simd_data2), # ) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() # @parameter # fn remainder_closure[simdwidth: Int](i: Int): # var simd_data1 = array1.load[width=simdwidth](i+remainder_offset) # var simd_data2 = array2.load[width=simdwidth](i+remainder_offset) # result_array.store[width=simdwidth]( # i+remainder_offset, func[dtype, simdwidth](simd_data1, simd_data2) # ) # vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_compare_array_and_scalar[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], scalar: SIMD[dtype, 1] ) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = SIMD[dtype, simdwidth].splat(scalar) # result_array.store[width=simdwidth]( # i + comps_per_core * j, # func[dtype, simdwidth](simd_data1, simd_data2), # ) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() return result_array fn math_func_is[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ DType.bool, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array.shape() ) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array.num_elements() // num_cores @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() # @parameter # fn remainder_closure[simdwidth: Int](i: Int): # var simd_data = array.load[width=simdwidth](i+remainder_offset) # result_array.store[width=simdwidth]( # i+remainder_offset, func[dtype, simdwidth](simd_data) # ) # vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_simd_int[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w], Int) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype], intval: Int) raises -> NDArray[dtype]: var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data, intval) ) vectorize[closure, opt_nelts](array.num_elements()) return result_array struct VectorizedParallelized(Backend): """ Vectorized and Parrallelized Backend Struct. Currently an order of magnitude slower than Vectorized for most functions. No idea why, Not Reccomened for use at this Time. """ fn __init__(inout self: Self): pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if ( array1.shape() != array2.shape() and array1.shape() != array3.shape() ): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) var simd_data3 = array3.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, SIMD.fma(simd_data1, simd_data2, simd_data3), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = array2.load[width=simdwidth](i + remainder_offset) var simd_data3 = array3.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, SIMD.fma(simd_data1, simd_data2, simd_data3), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape. Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = 1 var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, SIMD.fma(simd_data1, simd_data2, simd), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = array2.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, SIMD.fma(simd_data1, simd_data2, simd) ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD function of one variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() var num_cores: Int = num_physical_cores() var comps_per_core: Int = array.num_elements() // num_cores var comps_remainder: Int = array.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, func[dtype, simdwidth](simd_data) ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = array2.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_1_array_1_scalar_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. scalar: A Scalars. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() var num_cores: Int = num_physical_cores() var comps_per_core: Int = array.num_elements() // num_cores var comps_remainder: Int = array.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = scalar result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array.load[width=simdwidth](i + remainder_offset) var simd_data2 = scalar result_array.store[width=simdwidth]( i + remainder_offset, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_compare_2_arrays[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[DType.bool]: if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) # result_array.store[width=simdwidth]( # i + comps_per_core * j, # func[dtype, simdwidth](simd_data1, simd_data2), # ) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = array2.load[width=simdwidth](i + remainder_offset) # result_array.store[width=simdwidth]( # i + remainder_offset, # func[dtype, simdwidth](simd_data1, simd_data2), # ) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_compare_array_and_scalar[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], scalar: SIMD[dtype, 1] ) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = SIMD[dtype, simdwidth].splat(scalar) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = SIMD[dtype, simdwidth].splat(scalar) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_is[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ DType.bool, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array.shape() ) alias opt_nelts = simdwidthof[dtype]() var num_cores: Int = num_physical_cores() var comps_per_core: Int = array.num_elements() // num_cores var comps_remainder: Int = array.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure]() @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, func[dtype, simdwidth](simd_data) ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_simd_int[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w], Int) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype], intval: Int) raises -> NDArray[dtype]: var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data, intval) ) vectorize[closure, opt_nelts](array.num_elements()) return result_array struct VectorizedParallelizedNWorkers[num_cores: Int = num_physical_cores()]( Backend ): """ Vectorized and Parrallelized Backend Struct with manual setting of number of workers. Speed ups can be acheived by dividing the work across a number of cores, for Windows this number seems to be less than `num_physical_cores()`. """ fn __init__(inout self: Self): pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape. Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if ( array1.shape() != array2.shape() and array1.shape() != array3.shape() ): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() # #var num_cores: Int = num_physical_cores() # var simd_ops_per_core: Int = opt_nelts * (array1.num_elements() // opt_nelts) // num_cores var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core # var op_count:Int=0 @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) var simd_data3 = array3.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, SIMD.fma(simd_data1, simd_data2, simd_data3), ) # op_count+=1 vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure](num_cores, num_cores) @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = array2.load[width=simdwidth](i + remainder_offset) var simd_data3 = array3.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, SIMD.fma(simd_data1, simd_data2, simd_data3), ) # op_count+=1 # print(op_count) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape. Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = 1 # var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, SIMD.fma(simd_data1, simd_data2, simd), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure](num_cores, num_cores) @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = array2.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, SIMD.fma(simd_data1, simd_data2, simd) ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD function of one variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() # var num_cores: Int = num_physical_cores() var comps_per_core: Int = array.num_elements() // num_cores var comps_remainder: Int = array.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure](num_cores, num_cores) @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, func[dtype, simdwidth](simd_data) ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() # var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure](num_cores, num_cores) @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = array2.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_1_array_1_scalar_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. scalar: A Scalars. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() var comps_per_core: Int = array.num_elements() // num_cores var comps_remainder: Int = array.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = scalar result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure](num_cores, num_cores) @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array.load[width=simdwidth](i + remainder_offset) var simd_data2 = scalar result_array.store[width=simdwidth]( i + remainder_offset, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_compare_2_arrays[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[DType.bool]: if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() # var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = array2.load[width=simdwidth]( i + comps_per_core * j ) # result_array.store[width=simdwidth]( # i + comps_per_core * j, # func[dtype, simdwidth](simd_data1, simd_data2), # ) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure](num_cores, num_cores) @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = array2.load[width=simdwidth](i + remainder_offset) # result_array.store[width=simdwidth]( # i + remainder_offset, # func[dtype, simdwidth](simd_data1, simd_data2), # ) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_compare_array_and_scalar[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], scalar: SIMD[dtype, 1] ) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() # var num_cores: Int = num_physical_cores() var comps_per_core: Int = array1.num_elements() // num_cores var comps_remainder: Int = array1.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth]( i + comps_per_core * j ) var simd_data2 = SIMD[dtype, simdwidth].splat(scalar) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure](num_cores, num_cores) @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data1 = array1.load[width=simdwidth](i + remainder_offset) var simd_data2 = SIMD[dtype, simdwidth].splat(scalar) bool_simd_store[simdwidth]( result_array.unsafe_ptr(), i, func[dtype, simdwidth](simd_data1, simd_data2), ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_is[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ DType.bool, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array.shape() ) alias opt_nelts = simdwidthof[dtype]() # var num_cores: Int = num_physical_cores() var comps_per_core: Int = array.num_elements() // num_cores var comps_remainder: Int = array.num_elements() % num_cores var remainder_offset: Int = num_cores * comps_per_core @parameter fn par_closure(j: Int): @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth]( i + comps_per_core * j ) result_array.store[width=simdwidth]( i + comps_per_core * j, func[dtype, simdwidth](simd_data) ) vectorize[closure, opt_nelts](comps_per_core) parallelize[par_closure](num_cores, num_cores) @parameter fn remainder_closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i + remainder_offset) result_array.store[width=simdwidth]( i + remainder_offset, func[dtype, simdwidth](simd_data) ) vectorize[remainder_closure, opt_nelts](comps_remainder) return result_array fn math_func_simd_int[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w], Int) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype], intval: Int) raises -> NDArray[dtype]: var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() @parameter fn closure[simdwidth: Int](i: Int): var simd_data = array.load[width=simdwidth](i) result_array.store[width=simdwidth]( i, func[dtype, simdwidth](simd_data, intval) ) vectorize[closure, opt_nelts](array.num_elements()) return result_array struct Naive(Backend): """ Naive Backend Struct. Just loops for SIMD[Dtype, 1] equations """ fn __init__(inout self: Self): pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if ( array1.shape() != array2.shape() and array1.shape() != array3.shape() ): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() for i in range(array1.num_elements()): var simd_data1 = array1.load[width=1](i) var simd_data2 = array2.load[width=1](i) var simd_data3 = array3.load[width=1](i) result_array.store[width=1]( i, SIMD.fma(simd_data1, simd_data2, simd_data3) ) return result_array fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() for i in range(array1.num_elements()): var simd_data1 = array1.load[width=1](i) var simd_data2 = array2.load[width=1](i) result_array.store[width=1]( i, SIMD.fma(simd_data1, simd_data2, simd) ) return result_array fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD function of one variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) for i in range(array.num_elements()): var simd_data = func[dtype, 1](array.load[width=1](i)) result_array.store[width=1](i, simd_data) return result_array fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) for i in range(array1.num_elements()): var simd_data1 = array1.load[width=1](i) var simd_data2 = array2.load[width=1](i) result_array.store[width=1]( i, func[dtype, 1](simd_data1, simd_data2) ) return result_array fn math_func_1_array_1_scalar_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. scalar: A Scalars. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) for i in range(array.num_elements()): var simd_data1 = array.load[width=1](i) var simd_data2 = scalar result_array.store[width=1]( i, func[dtype, 1](simd_data1, simd_data2) ) return result_array fn math_func_compare_2_arrays[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[DType.bool]: if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) for i in range(array1.num_elements()): var simd_data1 = array1.load[width=1](i) var simd_data2 = array2.load[width=1](i) # result_array.store[width=1]( # i, func[dtype, 1](simd_data1, simd_data2) # ) bool_simd_store[1]( result_array.unsafe_ptr(), i, func[dtype, 1](simd_data1, simd_data2), ) return result_array fn math_func_compare_array_and_scalar[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], scalar: SIMD[dtype, 1] ) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) for i in range(array1.num_elements()): var simd_data1 = array1.load[width=1](i) var simd_data2 = scalar bool_simd_store[1]( result_array.unsafe_ptr(), i, func[dtype, 1](simd_data1, simd_data2), ) return result_array fn math_func_is[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ DType.bool, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array.shape() ) for i in range(array.num_elements()): var simd_data = func[dtype, 1](array.load[width=1](i)) result_array.store[width=1](i, simd_data) return result_array fn math_func_simd_int[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w], Int) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype], intval: Int) raises -> NDArray[dtype]: var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) for i in range(array.num_elements()): var simd_data1 = array.load[width=1](i) result_array.store[width=1](i, func[dtype, 1](simd_data1, intval)) return result_array struct VectorizedVerbose(Backend): """ Vectorized Backend Struct. Defualt Numojo computation backend takes advantage of SIMD. Uses defualt simdwidth. """ fn __init__(inout self: Self): pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if ( array1.shape() != array2.shape() and array1.shape() != array3.shape() ): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array1.num_elements() // opt_nelts), opt_nelts ): var simd_data1 = array1.load[width=opt_nelts](i) var simd_data2 = array2.load[width=opt_nelts](i) var simd_data3 = array3.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, SIMD.fma(simd_data1, simd_data2, simd_data3) ) if array1.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array1.num_elements() // opt_nelts), array1.num_elements(), ): var simd_data1 = array1.load[width=1](i) var simd_data2 = array2.load[width=1](i) var simd_data3 = array3.load[width=1](i) result_array.store[width=1]( i, SIMD.fma(simd_data1, simd_data2, simd_data3) ) return result_array fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array1.num_elements() // opt_nelts), opt_nelts ): var simd_data1 = array1.load[width=opt_nelts](i) var simd_data2 = array2.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, SIMD.fma(simd_data1, simd_data2, simd) ) if array1.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array1.num_elements() // opt_nelts), array1.num_elements(), ): var simd_data1 = array1.load[width=1](i) var simd_data2 = array2.load[width=1](i) result_array.store[width=1]( i, SIMD.fma(simd_data1, simd_data2, simd) ) return result_array fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD function of one variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. Returns: A new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array.num_elements() // opt_nelts), opt_nelts ): var simd_data = array.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, func[dtype, opt_nelts](simd_data) ) if array.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array.num_elements() // opt_nelts), array.num_elements(), ): var simd_data = func[dtype, 1](array.load[width=1](i)) result_array.store[width=1](i, simd_data) return result_array fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. """ if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array1.num_elements() // opt_nelts), opt_nelts ): var simd_data1 = array1.load[width=opt_nelts](i) var simd_data2 = array2.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, func[dtype, opt_nelts](simd_data1, simd_data2) ) if array1.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array1.num_elements() // opt_nelts), array1.num_elements(), ): var simd_data1 = array1.load[width=1](i) var simd_data2 = array2.load[width=1](i) result_array.store[width=1]( i, func[dtype, 1](simd_data1, simd_data2) ) return result_array fn math_func_1_array_1_scalar_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. scalar: A Scalars. Returns: A a new NDArray that is NDArray with the function func applied. """ var result_array: NDArray[dtype] = NDArray[dtype](array.shape()) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array.num_elements() // opt_nelts), opt_nelts ): var simd_data1 = array.load[width=opt_nelts](i) var simd_data2 = scalar result_array.store[width=opt_nelts]( i, func[dtype, opt_nelts](simd_data1, simd_data2) ) if array.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array.num_elements() // opt_nelts), array.num_elements(), ): var simd_data1 = array.load[width=1](i) var simd_data2 = scalar result_array.store[width=1]( i, func[dtype, 1](simd_data1, simd_data2) ) return result_array fn math_func_compare_2_arrays[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[DType.bool]: if array1.shape() != array2.shape(): raise Error( "Shape Mismatch error shapes must match for this function" ) var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array1.num_elements() // opt_nelts), opt_nelts ): var simd_data1 = array1.load[width=opt_nelts](i) var simd_data2 = array2.load[width=opt_nelts](i) # result_array.store[width=simdwidth]( # i, func[dtype, opt_nelts](simd_data1, simd_data2) # ) bool_simd_store[opt_nelts]( result_array.unsafe_ptr(), i, func[dtype, opt_nelts](simd_data1, simd_data2), ) if array1.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array1.num_elements() // opt_nelts), array1.num_elements(), ): var simd_data1 = array1.load[width=1](i) var simd_data2 = array2.load[width=1](i) # result_array.store[width=1]( # i, func[dtype, 1](simd_data1, simd_data2) # ) bool_simd_store[1]( result_array.unsafe_ptr(), i, func[dtype, 1](simd_data1, simd_data2), ) return result_array fn math_func_compare_array_and_scalar[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array1.shape() ) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array1.num_elements() // opt_nelts), opt_nelts ): var simd_data1 = array1.load[width=opt_nelts](i) var simd_data2 = SIMD[dtype, opt_nelts].splat(scalar) bool_simd_store[opt_nelts]( result_array.unsafe_ptr(), i, func[dtype, opt_nelts](simd_data1, simd_data2), ) if array1.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array1.num_elements() // opt_nelts), array1.num_elements(), ): var simd_data1 = array1.load[width=1](i) var simd_data2 = SIMD[dtype, 1].splat(scalar) bool_simd_store[1]( result_array.unsafe_ptr(), i, func[dtype, 1](simd_data1, simd_data2), ) return result_array fn math_func_is[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ DType.bool, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[DType.bool]: var result_array: NDArray[DType.bool] = NDArray[DType.bool]( array.shape() ) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array.num_elements() // opt_nelts), opt_nelts ): var simd_data = array.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, func[dtype, opt_nelts](simd_data) ) if array.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array.num_elements() // opt_nelts), array.num_elements(), ): var simd_data = func[dtype, 1](array.load[width=1](i)) result_array.store[width=1](i, simd_data) return result_array fn math_func_simd_int[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w], Int) -> SIMD[ type, simd_w ], ](self: Self, array1: NDArray[dtype], intval: Int) raises -> NDArray[dtype]: var result_array: NDArray[dtype] = NDArray[dtype](array1.shape()) alias opt_nelts = simdwidthof[dtype]() for i in range( 0, opt_nelts * (array1.num_elements() // opt_nelts), opt_nelts ): var simd_data1 = array1.load[width=opt_nelts](i) result_array.store[width=opt_nelts]( i, func[dtype, opt_nelts](simd_data1, intval) ) if array1.num_elements() % opt_nelts != 0: for i in range( opt_nelts * (array1.num_elements() // opt_nelts), array1.num_elements(), ): var simd_data1 = array1.load[width=1](i) result_array.store[width=1]( i, func[dtype, 1](simd_data1, intval) ) return result_array --- numojo/math/statistics/__init__.mojo --- from .cumulative_reduce import * from .stats import * --- numojo/math/statistics/cumulative_reduce.mojo --- """ Cumulative reduction statistics functions for NDArrays """ # ===----------------------------------------------------------------------=== # # Statistics Module - Implements cumulative reduce functions # Last updated: 2024-06-16 # ===----------------------------------------------------------------------=== # import math from algorithm import vectorize from ...core.ndarray import NDArray, NDArrayShape from ...core.utility_funcs import is_inttype, is_floattype from ...core.sort import binary_sort """ TODO: 1) Add support for axis parameter. 2) Currently, constrained is crashing mojo, so commented it out and added raise Error. Check later. 3) Relax constrained[] to let user get whatever output they want, but make a warning instead. """ # ===------------------------------------------------------------------------===# # Reduce Cumulative Operations # ===------------------------------------------------------------------------===# fn cumsum[ dtype: DType = DType.float64 ](array: NDArray[dtype]) -> SIMD[dtype, 1]: """Sum of all items of an array. Parameters: dtype: The element type. Args: array: An NDArray. Returns: The sum of all items in the array as a SIMD Value of `dtype`. """ var result = Scalar[dtype]() alias opt_nelts: Int = simdwidthof[dtype]() @parameter fn vectorize_sum[simd_width: Int](idx: Int) -> None: var simd_data = array.load[width=simd_width](idx) result += simd_data.reduce_add() vectorize[vectorize_sum, opt_nelts](array.num_elements()) return result fn cumprod[ dtype: DType = DType.float64 ](array: NDArray[dtype]) -> SIMD[dtype, 1]: """Product of all items in an array. Parameters: dtype: The element type. Args: array: An NDArray. Returns: The product of all items in the array as a SIMD Value of `dtype`. """ var result: SIMD[dtype, 1] = SIMD[dtype, 1](1.0) alias opt_nelts = simdwidthof[dtype]() @parameter fn vectorize_sum[simd_width: Int](idx: Int) -> None: var simd_data = array.load[width=simd_width](idx) result *= simd_data.reduce_mul() vectorize[vectorize_sum, opt_nelts](array.num_elements()) return result # ===------------------------------------------------------------------------===# # Statistics Cumulative Operations # ===------------------------------------------------------------------------===# fn cummean[ dtype: DType = DType.float64 ](array: NDArray[dtype]) raises -> SIMD[dtype, 1]: """Arithmatic mean of all items of an array. Parameters: dtype: The element type. Args: array: An NDArray. Returns: The mean of all of the member values of array as a SIMD Value of `dtype`. """ # constrained[is_inttype[ dtype]() and is_inttype[dtype](), "Input and output both cannot be `Integer` datatype as it may lead to precision errors"]() if is_inttype[dtype]() and is_inttype[dtype](): raise Error( "Input and output cannot be `Int` datatype as it may lead to" " precision errors" ) return cumsum[dtype](array) / (array.num_elements()) fn mode[ dtype: DType = DType.float64 ](array: NDArray[dtype]) raises -> SIMD[dtype, 1]: """Mode of all items of an array. Parameters: dtype: The element type. Args: array: An NDArray. Returns: The mode of all of the member values of array as a SIMD Value of `dtype`. """ var sorted_array: NDArray[dtype] = binary_sort[dtype](array) var max_count = 0 var mode_value = sorted_array.item(0) var current_count = 1 for i in range(1, array.num_elements()): if sorted_array[i] == sorted_array[i - 1]: current_count += 1 else: if current_count > max_count: max_count = current_count mode_value = sorted_array.item(i - 1) current_count = 1 if current_count > max_count: mode_value = sorted_array.item(array.num_elements() - 1) return mode_value # * IMPLEMENT median high and low fn median[ dtype: DType = DType.float64 ](array: NDArray[dtype]) raises -> SIMD[dtype, 1]: """Median value of all items of an array. Parameters: dtype: The element type. Args: array: An NDArray. Returns: The median of all of the member values of array as a SIMD Value of `dtype`. """ var sorted_array = binary_sort[dtype](array) var n = array.num_elements() if n % 2 == 1: return sorted_array.item(n // 2) else: return (sorted_array.item(n // 2 - 1) + sorted_array.item(n // 2)) / 2 # for max and min, I can later change to the latest reduce.max, reduce.min() fn maxT[ dtype: DType = DType.float64 ](array: NDArray[dtype]) raises -> SIMD[dtype, 1]: """ Maximum value of a array. Parameters: dtype: The element type. Args: array: A NDArray. Returns: The maximum of all of the member values of array as a SIMD Value of `dtype`. """ # TODO: Test this alias opt_nelts = simdwidthof[dtype]() var max_value = NDArray[dtype](NDArrayShape(opt_nelts)) for i in range(opt_nelts): max_value[i] = array[0] # var max_value: SIMD[ dtype, opt_nelts] = SIMD[ dtype, opt_nelts](array[0]) @parameter fn vectorized_max[simd_width: Int](idx: Int) -> None: max_value.store[width=simd_width]( 0, SIMD.max( max_value.load[width=simd_width](0), array.load[width=simd_width](idx), ), ) vectorize[vectorized_max, opt_nelts](array.num_elements()) var result: Scalar[dtype] = Scalar[dtype](max_value.get_scalar(0)) for i in range(max_value.__len__()): if max_value.get_scalar(i) > result: result = max_value.get_scalar(i) return result fn minT[ dtype: DType = DType.float64 ](array: NDArray[dtype]) raises -> SIMD[dtype, 1]: """ Minimum value of a array. Parameters: dtype: The element type. Args: array: A NDArray. Returns: The minimum of all of the member values of array as a SIMD Value of `dtype`. """ alias opt_nelts = simdwidthof[dtype]() var min_value = NDArray[dtype](NDArrayShape(opt_nelts)) for i in range(opt_nelts): min_value[i] = array[0] @parameter fn vectorized_min[simd_width: Int](idx: Int) -> None: min_value.store[width=simd_width]( 0, SIMD.min( min_value.load[width=simd_width](0), array.load[width=simd_width](idx), ), ) vectorize[vectorized_min, opt_nelts](array.num_elements()) var result: Scalar[dtype] = Scalar[dtype](min_value.get_scalar(0)) for i in range(min_value.__len__()): if min_value.get_scalar(i) < result: result = min_value.get_scalar(i) return result fn cumpvariance[ dtype: DType = DType.float64 ](array: NDArray[dtype], mu: Optional[Scalar[dtype]] = None) raises -> SIMD[ dtype, 1 ]: """ Population variance of a array. Parameters: dtype: The element type.. Args: array: A NDArray. mu: The mean of the array, if provided. Returns: The variance of all of the member values of array as a SIMD Value of `dtype`. """ # constrained[is_inttype[ dtype]() and is_inttype[dtype](), "Input and output both cannot be `Integer` datatype as it may lead to precision errors"]() if is_inttype[dtype]() and is_inttype[dtype](): raise Error( "Input and output cannot be `Int` datatype as it may lead to" " precision errors" ) var mean_value: Scalar[dtype] if not mu: mean_value = cummean[dtype](array) else: mean_value = mu.value()[] var result = Scalar[dtype]() for i in range(array.num_elements()): result += (array.get_scalar(i) - mean_value) ** 2 return result / (array.num_elements()) fn cumvariance[ dtype: DType = DType.float64 ](array: NDArray[dtype], mu: Optional[Scalar[dtype]] = None) raises -> SIMD[ dtype, 1 ]: """ Variance of a array. Parameters: dtype: The element type. Args: array: A NDArray. mu: The mean of the array, if provided. Returns: The variance of all of the member values of array as a SIMD Value of `dtype`. """ # constrained[is_inttype[ dtype]() and is_inttype[dtype](), "Input and output both cannot be `Integer` datatype as it may lead to precision errors"]() if is_inttype[dtype]() and is_inttype[dtype](): raise Error( "Input and output cannot be `Int` datatype as it may lead to" " precision errors" ) var mean_value: Scalar[dtype] if not mu: mean_value = cummean[dtype](array) else: mean_value = mu.value()[] var result = Scalar[dtype]() for i in range(array.num_elements()): result += (array.get_scalar(i) - mean_value) ** 2 return result / (array.num_elements() - 1) fn cumpstdev[ dtype: DType = DType.float64 ](array: NDArray[dtype], mu: Optional[Scalar[dtype]] = None) raises -> SIMD[ dtype, 1 ]: """ Population standard deviation of a array. Parameters: dtype: The element type. Args: array: A NDArray. mu: The mean of the array, if provided. Returns: The standard deviation of all of the member values of array as a SIMD Value of `dtype`. """ # constrained[is_inttype[ dtype]() and is_inttype[dtype](), "Input and output both cannot be `Integer` datatype as it may lead to precision errors"]() if is_inttype[dtype]() and is_inttype[dtype](): raise Error( "Input and output cannot be `Int` datatype as it may lead to" " precision errors" ) return math.sqrt(cumpvariance[dtype](array, mu)) fn cumstdev[ dtype: DType = DType.float64 ](array: NDArray[dtype], mu: Optional[Scalar[dtype]] = None) raises -> SIMD[ dtype, 1 ]: """ Standard deviation of a array. Parameters: dtype: The element type. Args: array: A NDArray. mu: The mean of the array, if provided. Returns: The standard deviation of all of the member values of array as a SIMD Value of `dtype`. """ # constrained[is_inttype[ dtype]() and is_inttype[dtype](), "Input and output both cannot be `Integer` datatype as it may lead to precision errors"]() if is_inttype[dtype]() and is_inttype[dtype](): raise Error( "Input and output cannot be `Int` datatype as it may lead to" " precision errors" ) return math.sqrt(cumvariance[dtype](array, mu)) # this roughly seems to be just an alias for min in numpy fn amin[ dtype: DType = DType.float64 ](array: NDArray[dtype]) raises -> SIMD[dtype, 1]: """ Minimum value of an array. Parameters: dtype: The element type. Args: array: An array. Returns: The minimum of all of the member values of array as a SIMD Value of `dtype`. """ return minT[dtype](array) # this roughly seems to be just an alias for max in numpy fn amax[ dtype: DType = DType.float64 ](array: NDArray[dtype]) raises -> SIMD[dtype, 1]: """ Maximum value of a array. Parameters: dtype: The element type. Args: array: A array. Returns: The maximum of all of the member values of array as a SIMD Value of `dtype`. """ return maxT[dtype](array) fn mimimum[ dtype: DType = DType.float64 ](s1: SIMD[dtype, 1], s2: SIMD[dtype, 1]) -> SIMD[dtype, 1]: """ Minimum value of two SIMD values. Parameters: dtype: The element type. Args: s1: A SIMD Value. s2: A SIMD Value. Returns: The minimum of the two SIMD Values as a SIMD Value of `dtype`. """ return SIMD.min(s1, s2) fn maximum[ dtype: DType = DType.float64 ](s1: SIMD[dtype, 1], s2: SIMD[dtype, 1]) -> SIMD[dtype, 1]: """ Maximum value of two SIMD values. Parameters: dtype: The element type. Args: s1: A SIMD Value. s2: A SIMD Value. Returns: The maximum of the two SIMD Values as a SIMD Value of `dtype`. """ return SIMD.max(s1, s2) fn minimum[ dtype: DType = DType.float64 ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Element wise minimum of two arrays. Parameters: dtype: The element type. Args: array1: An array. array2: An array. Returns: The element wise minimum of the two arrays as a array of `dtype`. """ var result: NDArray[dtype] = NDArray[dtype](array1.shape()) alias nelts = simdwidthof[dtype]() if array1.shape() != array2.shape(): raise Error("array shapes are not the same") @parameter fn vectorized_min[simd_width: Int](idx: Int) -> None: result.store[width=simd_width]( idx, SIMD.min( array1.load[width=simd_width](idx), array2.load[width=simd_width](idx), ), ) vectorize[vectorized_min, nelts](array1.num_elements()) return result fn maximum[ dtype: DType = DType.float64 ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Element wise maximum of two arrays. Parameters: dtype: The element type. Args: array1: A array. array2: A array. Returns: The element wise maximum of the two arrays as a array of `dtype`. """ var result: NDArray[dtype] = NDArray[dtype](array1.shape()) alias nelts = simdwidthof[dtype]() if array1.shape() != array2.shape(): raise Error("array shapes are not the same") @parameter fn vectorized_max[simd_width: Int](idx: Int) -> None: result.store[width=simd_width]( idx, SIMD.max( array1.load[width=simd_width](idx), array2.load[width=simd_width](idx), ), ) vectorize[vectorized_max, nelts](array1.num_elements()) return result # * for loop version works fine for argmax and argmin, need to vectorize it fn argmax[dtype: DType](array: NDArray[dtype]) raises -> Int: """ Argmax of a array. Parameters: dtype: The element type. Args: array: A array. Returns: The index of the maximum value of the array. """ if array.num_elements() == 0: raise Error("array is empty") var idx: Int = 0 var max_val: Scalar[dtype] = array.get_scalar(0) for i in range(1, array.num_elements()): if array.get_scalar(i) > max_val: max_val = array.get_scalar(i) idx = i return idx fn argmin[dtype: DType](array: NDArray[dtype]) raises -> Int: """ Argmin of a array. Parameters: dtype: The element type. Args: array: A array. Returns: The index of the minimum value of the array. """ if array.num_elements() == 0: raise Error("array is empty") var idx: Int = 0 var min_val: Scalar[dtype] = array.get_scalar(0) for i in range(1, array.num_elements()): if array.get_scalar(i) < min_val: min_val = array.get_scalar(i) idx = i return idx --- numojo/math/statistics/stats.mojo --- """ Statistics functions for NDArray """ # ===----------------------------------------------------------------------=== # # implements array stats function and supporting functions # Last updated: 2024-06-18 # ===----------------------------------------------------------------------=== # # from numojo.core.NDArray import NDArray from ...core.ndarray import NDArray from .. import mul fn sum(array: NDArray, axis: Int = 0) raises -> NDArray[array.dtype]: """Sum of array elements over a given axis. Args: array: NDArray. axis: The axis along which the sum is performed. Returns: An NDArray. """ var ndim: Int = array.ndim var shape: List[Int] = List[Int]() for i in range(ndim): shape.append(array.ndshape[i]) if axis > ndim - 1: raise Error("axis cannot be greater than the rank of the array") var result_shape: List[Int] = List[Int]() var axis_size: Int = shape[axis] var slices: List[Slice] = List[Slice]() for i in range(ndim): if i != axis: result_shape.append(shape[i]) slices.append(Slice(0, shape[i])) else: slices.append(Slice(0, 0)) var result: NDArray[array.dtype] = NDArray[array.dtype]( NDArrayShape(result_shape) ) for i in range(axis_size): slices[axis] = Slice(i, i + 1) var arr_slice = array[slices] result += arr_slice return result fn sumall(array: NDArray) raises -> Scalar[array.dtype]: """Sum of all items in the array. Example: ```console > print(A) [[ 0.1315377950668335 0.458650141954422 0.21895918250083923 ] [ 0.67886471748352051 0.93469291925430298 0.51941639184951782 ] [ 0.034572109580039978 0.52970021963119507 0.007698186207562685 ]] 2-D array Shape: [3, 3] DType: float32 > print(nm.math.stats.sumall(A)) 3.5140917301177979 ``` Args: array: NDArray. Returns: Scalar. """ var result = Scalar[array.dtype](0) for i in range(array.ndshape.ndsize): result[0] += array.data[i] return result fn prod(array: NDArray, axis: Int = 0) raises -> NDArray[array.dtype]: """Product of array elements over a given axis. Args: array: NDArray. axis: The axis along which the product is performed. Returns: An NDArray. """ var ndim: Int = array.ndim var shape: List[Int] = List[Int]() for i in range(ndim): shape.append(array.ndshape[i]) if axis > ndim - 1: raise Error("axis cannot be greater than the rank of the array") var result_shape: List[Int] = List[Int]() var axis_size: Int = shape[axis] var slices: List[Slice] = List[Slice]() for i in range(ndim): if i != axis: result_shape.append(shape[i]) slices.append(Slice(0, shape[i])) else: slices.append(Slice(0, 0)) var result: NDArray[array.dtype] = NDArray[array.dtype]( NDArrayShape(result_shape) ) slices[axis] = Slice(0, 1) result = array[slices] for i in range(1, axis_size): slices[axis] = Slice(i, i + 1) var arr_slice = array[slices] result = mul[array.dtype](result, arr_slice) return result fn prodall(array: NDArray) raises -> Scalar[array.dtype]: """Product of all items in the array. Example: ```console > print(A) [[ 0.1315377950668335 0.458650141954422 0.21895918250083923 ] [ 0.67886471748352051 0.93469291925430298 0.51941639184951782 ] [ 0.034572109580039978 0.52970021963119507 0.007698186207562685 ]] 2-D array Shape: [3, 3] DType: float32 > print(nm.math.stats.prodall(A)) 6.1377261317829834e-07 ``` Args: array: NDArray. Returns: Scalar. """ var result = Scalar[array.dtype](1) for i in range(array.ndshape.ndsize): result[0] *= array.data[i] return result fn mean(array: NDArray, axis: Int = 0) raises -> NDArray[array.dtype]: """ Mean of array elements over a given axis. Args: array: NDArray. axis: The axis along which the mean is performed. Returns: An NDArray. """ return sum(array, axis) / Scalar[array.dtype](array.ndshape[axis]) fn meanall(array: NDArray) raises -> Float64: """Mean of all items in the array. Example: ```console > print(A) [[ 0.1315377950668335 0.458650141954422 0.21895918250083923 ] [ 0.67886471748352051 0.93469291925430298 0.51941639184951782 ] [ 0.034572109580039978 0.52970021963119507 0.007698186207562685 ]] 2-D array Shape: [3, 3] DType: float32 > print(nm.math.stats.meanall(A)) 0.39045463667975533 ``` Args: array: NDArray. Returns: Float64. """ return ( sumall(array).cast[DType.float64]() / Int32(array.ndshape.ndsize).cast[DType.float64]() ) fn max[ dtype: DType ](array: NDArray[dtype], axis: Int = 0) raises -> NDArray[dtype]: """Maximums of array elements over a given axis. Args: array: NDArray. axis: The axis along which the sum is performed. Returns: An NDArray. """ var ndim: Int = array.ndim var shape: List[Int] = List[Int]() for i in range(ndim): shape.append(array.ndshape[i]) if axis > ndim - 1: raise Error("axis cannot be greater than the rank of the array") var result_shape: List[Int] = List[Int]() var axis_size: Int = shape[axis] var slices: List[Slice] = List[Slice]() for i in range(ndim): if i != axis: result_shape.append(shape[i]) slices.append(Slice(0, shape[i])) else: slices.append(Slice(0, 0)) print(result_shape.__str__()) var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(result_shape)) slices[axis] = Slice(0, 1) result = array[slices] for i in range(1, axis_size): slices[axis] = Slice(i, i + 1) var arr_slice = array[slices] var mask1 = greater(arr_slice, result) var mask2 = less(arr_slice, result) # Wherever result is less than the new slice it is set to zero # Wherever arr_slice is greater than the old result it is added to fill those zeros result = add( result * bool_to_numeric[dtype](mask2), arr_slice * bool_to_numeric[dtype](mask1), ) return result fn min[ dtype: DType ](array: NDArray[dtype], axis: Int = 0) raises -> NDArray[dtype]: """Minumums of array elements over a given axis. Args: array: NDArray. axis: The axis along which the sum is performed. Returns: An NDArray. """ var ndim: Int = array.ndim var shape: List[Int] = List[Int]() for i in range(ndim): shape.append(array.ndshape[i]) if axis > ndim - 1: raise Error("axis cannot be greater than the rank of the array") var result_shape: List[Int] = List[Int]() var axis_size: Int = shape[axis] var slices: List[Slice] = List[Slice]() for i in range(ndim): if i != axis: result_shape.append(shape[i]) slices.append(Slice(0, shape[i])) else: slices.append(Slice(0, 0)) var result: NDArray[dtype] = NDArray[dtype](NDArrayShape(result_shape)) slices[axis] = Slice(0, 1) result = array[slices] for i in range(1, axis_size): slices[axis] = Slice(i, i + 1) var arr_slice = array[slices] var mask1 = less(arr_slice, result) var mask2 = greater(arr_slice, result) # Wherever result is greater than the new slice it is set to zero # Wherever arr_slice is less than the old result it is added to fill those zeros result = add( result * bool_to_numeric[dtype](mask2), arr_slice * bool_to_numeric[dtype](mask1), ) return result --- numojo/math/trig.mojo --- """ Implements Trigonometry functions for arrays. """ # ===----------------------------------------------------------------------=== # # Implements Trigonometry functions # Last updated: 2024-06-16 # ===----------------------------------------------------------------------=== # import math import . math_funcs as _mf from .arithmetic import sqrt, fma from ..core.ndarray import NDArray # TODO: add dtype in backends and pass it here. # ===------------------------------------------------------------------------===# # Inverse Trig # ===------------------------------------------------------------------------===# fn acos[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply acos also known as inverse cosine . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array. Returns: The elementwise acos of `array` in radians. """ return backend().math_func_1_array_in_one_array_out[dtype, math.acos](array) fn asin[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply asin also known as inverse sine . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array. Returns: The elementwise asin of `array` in radians. """ return backend().math_func_1_array_in_one_array_out[dtype, math.asin](array) fn atan[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply atan also known as inverse tangent . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array. Returns: The elementwise atan of `array` in radians. """ return backend().math_func_1_array_in_one_array_out[dtype, math.atan](array) fn atan2[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply atan2 also known as inverse tangent. [atan2 wikipedia](https://en.wikipedia.org/wiki/Atan2). Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: An Array. array2: An Array. Returns: The elementwise atan2 of `array1` and`array2` in radians. """ return backend().math_func_2_array_in_one_array_out[dtype, math.atan2]( array1, array2 ) # ===------------------------------------------------------------------------===# # Trig # ===------------------------------------------------------------------------===# fn cos[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply cos also known as cosine. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array assumed to be in radian. Returns: The elementwise cos of `array`. """ return backend().math_func_1_array_in_one_array_out[dtype, math.cos](array) fn sin[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply sin also known as sine . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array assumed to be in radian. Returns: The elementwise sin of `array`. """ return backend().math_func_1_array_in_one_array_out[dtype, math.sin](array) fn tan[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply tan also known as tangent . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array assumed to be in radian. Returns: The elementwise tan of `array`. """ return backend().math_func_1_array_in_one_array_out[dtype, math.tan](array) fn hypot[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply hypot also known as hypotenuse which finds the longest section of a right triangle given the other two sides. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: An Array. array2: An Array. Returns: The elementwise hypotenuse of `array1` and`array2`. """ return backend().math_func_2_array_in_one_array_out[dtype, math.hypot]( array1, array2 ) fn hypot_fma[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array1: NDArray[dtype], array2: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply hypot also known as hypotenuse which finds the longest section of a right triangle given the other two sides. Constraints: Both arrays must have the same shapes. Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array1: An Array. array2: An Array. Returns: The elementwise hypotenuse of `array1` and`array2`. """ var array2_squared = fma[dtype, backend=backend]( array2, array2, SIMD[dtype, 1](0) ) return sqrt[dtype, backend=backend]( fma[dtype, backend=backend](array1, array1, array2_squared) ) # ===------------------------------------------------------------------------===# # Inverse Hyperbolic Trig # ===------------------------------------------------------------------------===# fn acosh[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply acosh also known as inverse hyperbolic cosine . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array. Returns: The elementwise acosh of `array` in radians. """ return backend().math_func_1_array_in_one_array_out[dtype, math.acosh]( array ) fn asinh[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply asinh also known as inverse hyperbolic sine . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array. Returns: The elementwise asinh of `array` in radians. """ return backend().math_func_1_array_in_one_array_out[dtype, math.asinh]( array ) fn atanh[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply atanh also known as inverse hyperbolic tangent . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array. Returns: The elementwise atanh of `array` in radians. """ return backend().math_func_1_array_in_one_array_out[dtype, math.atanh]( array ) # ===------------------------------------------------------------------------===# # Hyperbolic Trig # ===------------------------------------------------------------------------===# fn cosh[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply cosh also known as hyperbolic cosine . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array assumed to be in radian. Returns: The elementwise cosh of `array`. """ return backend().math_func_1_array_in_one_array_out[dtype, math.cosh](array) fn sinh[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply sin also known as hyperbolic sine . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array assumed to be in radian. Returns: The elementwise sinh of `array`. """ return backend().math_func_1_array_in_one_array_out[dtype, math.sinh](array) fn tanh[ dtype: DType, backend: _mf.Backend = _mf.Vectorized ](array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply tan also known as hyperbolic tangent . Parameters: dtype: The element type. backend: Sets utility function origin, defualts to `Vectorized. Args: array: An Array assumed to be in radian. Returns: The elementwise tanh of `array`. """ return backend().math_func_1_array_in_one_array_out[dtype, math.tanh](array) --- numojo/traits/NDArrayTraits.mojo --- from ..core.ndarray import NDArray # Blocked by lack of trait paramaterization # trait Arraylike: # fn load[width: Int](self, idx: Int) -> SIMD[dtype, width]: # """ # Loads a SIMD element of size `width` at the given index `idx`. # """ # ... # fn store[width: Int](inout self, idx: Int, val: SIMD[dtype, width]): # """ # Stores the SIMD element of size `width` at index `idx`. # """ # ... # trait NDArrayBackend: # """ # A trait that defines backends for calculations in the rest of the library. # """ # fn __init__(inout self: Self): # """ # Initialize the backend. # """ # ... # fn math_func_1_array_in_one_array_out[ # dtype: DType, # func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ # type, simd_w # ], # ](self: Self, array: Arraylike) -> Arraylike: # """ # Apply a SIMD function of one variable and one return to a NDArray # Parameters: # dtype: The element type. # func: the SIMD function to to apply. # Args: # array: A NDArray # Returns: # A a new NDArray that is NDArray with the function func applied. # """ # ... # fn math_func_2_array_in_one_array_out[ # dtype: DType, # func: fn[type: DType, simd_w: Int] ( # SIMD[type, simd_w], SIMD[type, simd_w] # ) -> SIMD[type, simd_w], # ]( # self: Self, array1: Arraylike, array2: Arraylike # ) raises -> Arraylike: # """ # Apply a SIMD function of two variable and one return to a NDArray # Constraints: # Both arrays must have the same shape # Parameters: # dtype: The element type. # func: the SIMD function to to apply. # Args: # array1: A NDArray # array2: A NDArray # Returns: # A a new NDArray that is NDArray with the function func applied. # """ # ... # fn math_func_one_array_one_SIMD_in_one_array_out[ # dtype: DType, # func: fn[type: DType, simd_w: Int] ( # SIMD[type, simd_w], SIMD[type, simd_w] # ) -> SIMD[type, simd_w], # ]( # self: Self, array: Arraylike, scalar: Scalar[dtype] # ) -> Arraylike: # """ # Apply a SIMD function of two variable and one return to a NDArray # Constraints: # Both arrays must have the same shape # Parameters: # dtype: The element type. # func: the SIMD function to to apply. # Args: # array: A NDArray # scalar: A Scalar # Returns: # A a new NDArray that is NDArray with the function func applied. # """ # ... --- numojo/traits/__init__.mojo --- """ Defines Numojo Traits """ from .backend import Backend --- numojo/traits/backend.mojo --- # ===----------------------------------------------------------------------=== # # Defines computational backend traits # ===----------------------------------------------------------------------=== # from ..core.ndarray import NDArray trait Backend: """ A trait that defines backends for calculations in the rest of the library. """ fn __init__(inout self: Self): """ Initialize the backend. """ pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], array3: NDArray[dtype], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. array3: A NDArray. Returns: A a new NDArray that is NDArray with the function func applied. Raises: If shapes are missmatched or there is a access error. """ pass fn math_func_fma[ dtype: DType, ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype], simd: SIMD[dtype, 1], ) raises -> NDArray[dtype]: """ Apply a SIMD level fuse multipy add function of three variables and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. Args: array1: A NDArray. array2: A NDArray. simd: A SIMD[dtype,1] value to be added. Returns: A new NDArray that is NDArray with the function func applied. """ pass fn math_func_1_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ type, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[dtype]: """ Apply a SIMD function of one variable and one return to a NDArray. Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. Returns: A new NDArray that is NDArray with the function func applied. """ ... fn math_func_2_array_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A new NDArray that is NDArray with the function func applied. """ ... fn math_func_1_array_1_scalar_in_one_array_out[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[type, simd_w], ]( self: Self, array: NDArray[dtype], scalar: Scalar[dtype] ) raises -> NDArray[dtype]: """ Apply a SIMD function of two variable and one return to a NDArray. Constraints: Both arrays must have the same shape Parameters: dtype: The element type. func: The SIMD function to to apply. Args: array: A NDArray. scalar: A Scalars. Returns: A new NDArray that is NDArray with the function func applied. """ ... fn math_func_compare_2_arrays[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], array2: NDArray[dtype] ) raises -> NDArray[DType.bool]: """ Apply a SIMD comparision function of two variable. Constraints: Both arrays must have the same shape. Parameters: dtype: The element type. func: The SIMD comparision function to to apply. Args: array1: A NDArray. array2: A NDArray. Returns: A new Boolean NDArray that is NDArray with the function func applied. """ ... fn math_func_compare_array_and_scalar[ dtype: DType, func: fn[type: DType, simd_w: Int] ( SIMD[type, simd_w], SIMD[type, simd_w] ) -> SIMD[DType.bool, simd_w], ]( self: Self, array1: NDArray[dtype], scalar: SIMD[dtype, 1] ) raises -> NDArray[DType.bool]: """ Apply a SIMD comparision function of two variable. Constraints: Both arrays must have the same shape. Parameters: dtype: The element type. func: The SIMD comparision function to to apply. Args: array1: A NDArray. scalar: A scalar. Returns: A new Boolean NDArray that is NDArray with the function func applied. """ ... fn math_func_is[ dtype: DType, func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w]) -> SIMD[ DType.bool, simd_w ], ](self: Self, array: NDArray[dtype]) raises -> NDArray[DType.bool]: ... # fn math_func_simd_int[ # dtype: DType, # func: fn[type: DType, simd_w: Int] (SIMD[type, simd_w], Int) -> SIMD[ # type, simd_w # ], # ](self: Self, array1: NDArray[dtype], intval: Int) raises -> NDArray[dtype]: # ... --- style guide.md --- # Numojo Style Guide In the interest of keeping our code clean and consistent, and enabling some automation for documentation the following simple standards will be required for new commits. ## File Level All files must begin with a triple quoted docstring describing the functionality created by the file. It should be a single sentence with the first letter capitalized and ending with a period. ```python """ Document docstring describing what it does, if it is in an init file it will be the docstring for the module. """ ``` All aliases and file-level variable definitions must have a docstring that describes what they are placed below the declaration. ```python alias Example = Int """ Aliases can be explained with docstrings and should if they exist in the global scope.""" ``` Aliases should be snake_case if they are a value and CamelCase if they are a type. With the exception of the `DType` mapping types ex: `f32`. Alias names should clearly indicate what they are for and in addition to their docstring require no further information to understand assuming the reader understands the Mojo, and the domain. ## Functions Functions should be snake_case, and describe what they do in as few words as possible, such that in addition to the docstring no further info is required. The first line of a function docstring should summarize what the function does. ```python """ Description of the function. """ ``` Next add the parameters, arguments, and returns if there are any separated from the summary by a new line. For functions and parameters start with either `Parameters:` or `Args:` followed by a new line-separated list of the parameters or arguments with the name of the parameter/arg followed by a `:` and a description the description should be a sentence starting with a capital letter and ending with a period. For returns separated from previous lines by a new line and start with `Returns:` then go to a new line and write a brief description of the return value, again as a sentence starting with a capitol letter and ending with a period. If the function does not return the `Returns:` section should be omitted. There is no need to add the type name to the arguments or parameters as the compiler handles that. ```rust fn func[param:Copyable](arg1:param)->param: """ Description of the function. Parameters: param: Each parameter should be listed and described. Args: arg1: Each argument should be listed and described. Returns: Describe what is returned. """ ... ``` If the function has compile time constraints or raises `Error`s include sections similar to return that specify those constraints and possible errors. ```python """ Raises: A description of the errors raised by the function. Constraints: If the functions use compile time constraints they should be listed here. """ ``` ## Structs Structs should be CamelCase and describe what they do in as few words as possible, such that in addition to the docstring no further info is required. The first line of a struct docstring should summarize what the struct does. It is not necessary to reiterate the structs name in the docstring. The parameters, and constraints of a struct should be included in the struct docstring in a similar way to functions. ```rust struct AStruct[param:AnyType](AnyType): """ Struct docstring describes basically what a struct does. Constraints: Limitations placed on the struct. Parameters: param: An example parameter. """ ... ``` Fields and aliases should have a docstring below them describing what they are. They should be no longer than a single sentence and should start with a capital letter and end with a period. ```rust struct AStruct[param:AnyType](AnyType): """ Struct docstring describes basically what a struct does. Constraints: Limitations placed on the struct. Parameters: param: An example parameter. """ var field: Int64 """ Field Descriptions go below each field.""" ... ``` Struct methods should follow the same rules as functions. ## Traits Traits follow the same rules as Structs but there are no fields in traits. --- style_example.mojo --- """ Document docstring decribing what it does, if it is in an init file it will be the docstring for the module """ # ===----------------------------------------------------------------------=== # # Subsection header, used to divide code in a file by functional parts (ingored by doc generation) # ===----------------------------------------------------------------------=== # alias Example = Int """Aliases can be explained with docstrings and should if they exist in the global scope.""" fn func[param: Copyable](arg1: param) -> param: """ Description of the function. Constraints: If the functions use compile time constraints they should be listed here. Parameters: param: Each parameter should be listed and described. Args: arg1: Each arguament should be listed and described. Returns: Describe what is returned. """ return arg1 fn func1[param: Copyable](arg1: param) raises -> param: """ Description of the function. Parameters: param: Each parameter should be listed and described. Args: arg1: Each arguament should be listed and described. Raises: A description of the errors raised by the function. Returns: Describe what is returned. """ return arg1 struct AStruct[param: AnyType](AnyType): """ Struct docstring describing basically what a struct does. Constraints: Limitations placed on the struct. Parameters: param: An example parameter. """ var field: Int64 """Field Descriptions go below each field.""" fn func(self) -> None: """ Function docstring like previosly shown. """ return None trait ATrait: """ Describe the trait. """ fn func(self) -> None: """ Function docstring like previosly shown. """ pass --- test.mojo --- # import numojo as nj import time from benchmark.compiler import keep from python import Python from random import seed # import numojo as nm from numojo import * # alias backend = nm.VectorizedParallelizedNWorkers[8] # def main(): # var array = nm.NDArray[nm.f64](10,10, order="F") # for i in range(array.size()): # array[i]=i # var res = array.sum(axis=1) # # for i in range(10): # # for j in range(10): # # print(array[i,j]) # print(res) fn main() raises: var A = arange[i16](1, 7, 1) print(A) var temp = flip(A) print(temp) # A.reshape(2, 3, order="F") # nm.ravel(A) # print(A) # var B = arange[i16](0, 12, 1) # B.reshape(3, 2, 2, order="F") # ravel(B, order="C") # print(B) # print(A) # var B = SIMD[i16, 1](15502) # print(B) # print(A >= SIMD[i16, 1](10)) # for i in A: # print(i) # var array = arange[i16](0, 12, 1) # array.reshape(3, 2, 2) # print(array) # print("x[0]", array.item(0)) # print("x[1]", array.item(1)) # print("x[2]", array.item(2)) # swapaxis(array, 0, -1) # print(array.ndshape) # swapaxis(array, 0, 2) # print(array.ndshape) # moveaxis(array, 0, 2) # array.reshape(2, 2, 3, order="C") # swapaxis(array, 0, 1) # print(array) # print("x[0]", array.item(0)) # print("x[1]", array.item(1)) # print("x[2]", array.item(2)) # moveaxis(array, 0, 1) # print(array.ndshape) # var B = NDArray[i16](3, 3, random=True) # print(B) # A[A > 10.0] = B # print(A) # var gt = A > 10.0 # print(gt) # var ge = A >= Scalar[i16](10) # print(ge) # var lt = A < Scalar[i16](10) # print(lt) # var le = A <= Scalar[i16](10) # print(le) # var eq = A == Scalar[i16](10) # print(eq) # var ne = A != Scalar[i16](10) # print(ne) # var mask = A[A > Scalar[i16](10)] # print(mask) # seed(10) # var B = NDArray[i16](3, 3, random=True) # print(B) # var gta = A > B # print(gta) # var gte = A >= B # print(gte) # var lt = A < B # print(lt) # var le = A <= B # print(le) # var eq = A == B # print(eq) # var ne = A != B # print(ne) # var mask = A[A > B] # print(mask) # var temp = A * SIMD[i8, 1](2) # print(temp) # var temp1 = temp == 0 # var temp2 = A[temp] # print(temp2) # var temp2 = A[A%2 == 0] # print(temp2) # print(temp2.at(0)) # print(temp2.ndshape, temp2.stride, temp2.ndshape._size) # def main(): # # CONSTRUCTORS TEST # var arr1 = numojo.NDArray[numojo.f32](3,4,5, random=True) # print(arr1) # print("ndim: ", arr1.ndim) # print("shape: ", arr1.ndshape) # print("strides: ", arr1.stride) # print("size: ", arr1.ndshape.ndsize) # print("offset: ", arr1.stride.ndoffset) # print("dtype: ", arr1.dtype) # print() # var arr2 = numojo.NDArray[numojo.f32](VariadicList[Int](3, 4, 5), random=True) # print(arr2) # print("ndim: ", arr2.ndim) # print("shape: ", arr2.ndshape) # print("strides: ", arr2.stride) # print("size: ", arr2.ndshape.ndsize) # print("offset: ", arr2.stride.ndoffset) # print("dtype: ", arr2.dtype) # var arr3 = numojo.NDArray[numojo.f32](VariadicList[Int](3, 4, 5), fill = 10.0) # print(arr3) # print("ndim: ", arr3.ndim) # print("shape: ", arr3.ndshape) # print("strides: ", arr3.stride) # print("size: ", arr3.ndshape.ndsize) # print("offset: ", arr3.stride.ndoffset) # print("dtype: ", arr3.dtype) # var arr4 = numojo.NDArray[numojo.f32](List[Int](3, 4, 5), random=True) # print(arr4) # print("ndim: ", arr4.ndim) # print("shape: ", arr4.ndshape) # print("strides: ", arr4.stride) # print("size: ", arr4.ndshape.ndsize) # print("offset: ", arr4.stride.ndoffset) # print("dtype: ", arr4.dtype) # var arr5 = numojo.NDArray[numojo.f32](numojo.NDArrayShape(3,4,5), random=True) # print(arr5) # print("ndim: ", arr5.ndim) # print("shape: ", arr5.ndshape) # print("strides: ", arr5.stride) # print("size: ", arr5.ndshape.ndsize) # print("offset: ", arr5.stride.ndoffset) # print("dtype: ", arr5.dtype) # var arr6 = numojo.NDArray[numojo.f32](data=List[SIMD[numojo.f32, 1]](1,2,3,4,5,6,7,8,9,10), shape= # List[Int](2,5)) # print(arr6) # print("ndim: ", arr6.ndim) # print("shape: ", arr6.ndshape) # print("strides: ", arr6.stride) # print("size: ", arr6.ndshape.ndsize) # print("offset: ", arr6.stride.ndoffset) # print("dtype: ", arr6.dtype) # var x = numojo.linspace[numojo.f32](0.0, 60.0, 60) # var x = numojo.ones[numojo.f32](3, 2) # var x = numojo.logspace[numojo.f32](-3, 0, 60) # var x = arange[f32](0.0, 24.0, step=1) # x.reshape(2, 3, 4, order="C") # print(x[0,0,0], x[0,0,1], x[1,1,1], x[1,2,3]) # print(x) # var slicedx = x[0:1, :, 1:2] # print(slicedx) # print() # var y = numojo.arange[numojo.f32](0.0, 24.0, step=1) # y.reshape(2,3,4, order="F") # print(y[0,0,0], y[0,0,1], y[1,1,1], y[1,2,3]) # print(y) # print(y.order) # var slicedy = y[:, :, 1:2] # print(slicedy) # var x = numojo.full[numojo.f32](3, 2, fill_value=16.0) # var x = numojo.NDArray[numojo.f32](data=List[SIMD[numojo.f32, 1]](1,2,3,4,5,6,7,8,9,10,11,12), shape=List[Int](2,3,2), # order="F") # print(x) # print(x.stride) # var y = numojo.NDArray[numojo.f32](data=List[SIMD[numojo.f32, 1]](1,2,3,4,5,6,7,8,9,10,11,12), shape=List[Int](2,3,2), # order="C") # print(y) # print(y.stride) # print() # var summed = numojo.stats.sum(x,0) # print(summed) # print(numojo.stats.mean(x,0)) # print(numojo.stats.cumprod(x)) # var maxval = x.max(axis=0) # print(maxval) # var arr = numojo.NDArray[numojo.f32](data=List[SIMD[numojo.f32, 1]](1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0), # shape=List[Int](3,3), order="C") # var raw = List[Int32]() # for _ in range(16): # raw.append(random.randn_float64()*10) # var arr1 = numojo.NDArray[numojo.i32](data=raw, shape=List[Int](4,4), order="C") # var arr = numojo.NDArray[DType.int8](3,3,3, random=True, order="C") # var arr1 = numojo.NDArray[DType.bool](data=List[SIMD[DType.bool, 1]](False, False, False, True), # shape=List[Int](2,2)) # print(arr1) # print(arr1[0,1]) # print(arr1[0:1, :]) # print(arr1[1:2, 3:4]) # var array = nj.NDArray[nj.f64](10,10) # for i in range(array.size()): # array[i] = i # # for i in range(10): # # for j in range(10): # # print(array[i, j]) # var res = array.sum(axis=0) # print(res) # var arr2 = numojo.NDArray[numojo.f32](data=List[SIMD[numojo.f32, 1]](1.0, 2.0, 4.0, 7.0, 11.0, 16.0), # shape=List[Int](6)) # var np = Python.import_module("numpy") # var np_arr = numojo.to_numpy(arr2) # print(np_arr) # var result = numojo.math.calculus.differentiation.gradient[numojo.f32](arr2, spacing=1.0) # print(result) # print(arr1.any()) # print(arr1.all()) # print(arr1.argmax()) # print(arr1.argmin()) # print(arr1.astype[numojo.i16]()) # print(arr1.flatten(inplace=True)) # print(r.ndshape, r.stride, r.ndshape.ndsize) # var t0 = time.now() # var res = numojo.math.linalg.matmul_tiled_unrolled_parallelized[numojo.f32](arr, arr1) # print((time.now()-t0)/1e9) # var res = numojo.math.linalg.matmul_tiled_unrolled_parallelized[numojo.f32](arr, arr1) # print(res) # print(arr) # print("2x3x1") # var sliced = arr[:, :, 1:2] # print(sliced) # print("1x3x4") # var sliced1 = arr[::2, :] # print(sliced1) # print("1x3x1") # var sliced2 = arr[1:2, :, 2:3] # print(sliced2) # var result = numojo.NDArray(3, 3) # numojo.math.linalg.dot[t10=3, t11=3, t21=3, dtype=numojo.f32](result, arr, arr1) # print(result) # fn main() raises: # var size:VariadicList[Int] = VariadicList[Int](16,128,256,512,1024) # alias size1: StaticIntTuple[5] = StaticIntTuple[5](16,128,256,512,1024) # var times:List[Float64] = List[Float64]() # alias type:DType = DType.float64 # measure_time[type, size1](size, times) # fn measure_time[dtype:DType, size1: StaticIntTuple[5]](size:VariadicList[Int], inout times:List[Float64]) raises: # for i in range(size.__len__()): # var arr1 = numojo.NDArray[dtype](size[i], size[i], random=True) # var arr2 = numojo.NDArray[dtype](size[i], size[i], random=True) # var arr_mul = numojo.NDArray[dtype](size[i], size[i]) # var t0 = time.now() # @parameter # for i in range(50): # numojo.math.linalg.dot[t10=size1[i], t11=size1[i], t21=size1[i], dtype=dtype](arr_mul, arr1, arr2) # # var arr_mul = numojo.math.linalg.matmul_parallelized[dtype](arr1, arr2) # # var arr_mul = numojo.math.linalg.matmul_tiled_unrolled_parallelized[dtype](arr1, arr2) # keep(arr_mul.unsafe_ptr()) # times.append(((time.now()-t0)/1e9)/50) # for i in range(size.__len__()): # print(times[i]) # fn main() raises: # alias type:DType = DType.float16 # measure_time[type]() # fn measure_time[dtype:DType]() raises: # var size:VariadicList[Int] = VariadicList[Int](16,128,256,512,1024) # alias size1: StaticIntTuple[5] = StaticIntTuple[5](16,128,256,512,1024) # var n = 4 # alias m = 4 # var arr1 = numojo.NDArray[dtype](size[n], size[n], random=True) # var arr2 = numojo.NDArray[dtype](size[n], size[n], random=True) # var arr_mul = numojo.NDArray[dtype](size[n], size[n]) # var t0 = time.now() # for _ in range(50): # numojo.math.linalg.dot[t10=size1[m], t11=size1[m], t21=size1[m], dtype=dtype](arr_mul, arr1, arr2) # # var arr_mul = numojo.math.linalg.matmul_parallelized[dtype](arr1, arr2) # # var arr_mul = numojo.math.linalg.matmul_tiled_unrolled_parallelized[dtype](arr1, arr2) # keep(arr_mul.unsafe_ptr()) # print(((time.now()-t0)/1e9)/50) --- tests/README.md --- # Testing guide Inorder to ensure that all of our code works and that a new code doesn't break old code we need to instate a testing policy (which we can hopefully implement a CI/CD process for running). Due to the similiarity with NumPy, a Numpy equivelent comparison will be our method for confirming validity. The functions contained in utils_for_test.mojo `check` and `check_is_close` will be used to compare NuMojo results with NumPy equivelents. Each test must be in it's own def function and begin with the word test example `test_arange`. This allows the `mojo test` command to find it. A single function can cover multiple similiar tests but they should have unique strings to identify which check failed. --- tests/test_array_creation.mojo --- import numojo as nm from time import now from python import Python, PythonObject from utils_for_test import check, check_is_close def test_arange(): var np = Python.import_module("numpy") check( nm.arange[nm.i64](0, 100), np.arange(0, 100, dtype=np.int64), "Arange is broken", ) check( nm.arange[nm.f64](0, 100), np.arange(0, 100, dtype=np.float64), "Arange is broken", ) def test_linspace(): var np = Python.import_module("numpy") check( nm.linspace[nm.f64](0, 100), np.linspace(0, 100, dtype=np.float64), "Linspace is broken", ) def test_logspace(): var np = Python.import_module("numpy") check_is_close( nm.logspace[nm.f64](0, 100, 5), np.logspace(0, 100, 5, dtype=np.float64), "Logspace is broken", ) def test_geomspace(): var np = Python.import_module("numpy") check_is_close( nm.geomspace[nm.f64](1, 100, 5), np.geomspace(1, 100, 5, dtype=np.float64), "Logspace is broken", ) def test_zeros(): var np = Python.import_module("numpy") check( nm.zeros[nm.f64](10, 10, 10, 10), np.zeros((10, 10, 10, 10), dtype=np.float64), "Zeros is broken", ) def test_ones(): var np = Python.import_module("numpy") check( nm.ones[nm.f64](10, 10, 10, 10), np.ones((10, 10, 10, 10), dtype=np.float64), "Ones is broken", ) def test_full(): var np = Python.import_module("numpy") check( nm.full[nm.f64](10, 10, 10, 10, fill_value=10), np.full((10, 10, 10, 10), 10, dtype=np.float64), "Full is broken", ) def test_identity(): var np = Python.import_module("numpy") check( nm.identity[nm.i64](100), np.identity(100, dtype=np.int64), "Identity is broken", ) def test_eye(): var np = Python.import_module("numpy") check( nm.eye[nm.i64](100, 100), np.eye(100, 100, dtype=np.int64), "Eye is broken", ) def main(): var np = Python.import_module("numpy") var arr = nm.arange[nm.f64](0, 100) arr.reshape(10, 10) var np_arr = np.arange(0, 100).reshape(10, 10) # Arange like flat arrays # check(nm.arange[nm.i64](0,100),np.arange(0,100,dtype=np.int64),"Arange is broken") # check(nm.linspace[nm.i64](0,100),np.linspace(0,100,dtype=np.float64),"Linspace is broken") # check_is_close(nm.logspace[nm.i64](0,100,5),np.logspace(0,100,5,dtype=np.float64),"Logspace is broken") # check_is_close(nm.geomspace[nm.i64](1,100,5),np.geomspace(1,100,5,dtype=np.float64),"Logspace is broken") # print((arr@arr).to_numpy()-np.matmul(np_arr,np_arr)) print( nm.matmul_naive[nm.f64](arr, arr).to_numpy() ) # -np.matmul(np_arr,np_arr)) print(np.matmul(np_arr, np_arr)) # # Basic ND arrays # print(nm.sin[nm.f64](nm.arange[nm.f64](0,15))) # print( np.sin(np.arange(0,15, dtype=np.float64))) # check(nm.zeros[nm.f64](10,10,10,10),np.zeros((10,10,10,10),dtype=np.float64),"Zeros is broken") # check(nm.ones[nm.f64](10,10,10,10),np.ones((10,10,10,10),dtype=np.float64),"Ones is broken") # check(nm.full[nm.f64](10,10,10,10,fill_value=10),np.full((10,10,10,10),10,dtype=np.float64),"Full is broken") # # 2d Linalg related arrays # check(nm.identity[nm.i64](100),np.identity(100,dtype=np.int64),"Identity is broken") # check(nm.eye[nm.i64](100,100),np.eye(100,100,dtype=np.int64),"Eye is broken") --- tests/test_math.mojo --- import numojo as nm from time import now from python import Python, PythonObject from utils_for_test import check, check_is_close def test_add_array(): var np = Python.import_module("numpy") var arr = nm.arange[nm.f64](0, 15) check(nm.add[nm.f64](arr, 5.0), np.arange(0, 15) + 5, "Add array + scalar") check( nm.add[nm.f64](arr, arr), np.arange(0, 15) + np.arange(0, 15), "Add array + array", ) def test_add_array_par(): var np = Python.import_module("numpy") var arr = nm.arange[nm.f64](0, 500) check( nm.add[ nm.f64, backend = nm.math.math_funcs.VectorizedParallelizedNWorkers[6], ](arr, 5.0), np.arange(0, 500) + 5, "Add array + scalar", ) check( nm.add[nm.f64, nm.math.math_funcs.VectorizedParallelizedNWorkers[6]]( arr, arr ), np.arange(0, 500) + np.arange(0, 500), "Add array + array", ) def test_sin(): var np = Python.import_module("numpy") var arr = nm.arange[nm.f64](0, 15) check_is_close( nm.sin[nm.f64](arr), np.sin(np.arange(0, 15)), "Add array + scalar" ) def test_sin_par(): var np = Python.import_module("numpy") var arr = nm.arange[nm.f64](0, 15) check_is_close( nm.sin[ nm.f64, backend = nm.math.math_funcs.VectorizedParallelizedNWorkers[6], ](arr), np.sin(np.arange(0, 15)), "Add array + scalar", ) def test_matmul(): var np = Python.import_module("numpy") var arr = nm.arange[nm.f64](0, 100) arr.reshape(10, 10) var np_arr = np.arange(0, 100).reshape(10, 10) check_is_close( arr @ arr, np.matmul(np_arr, np_arr), "Dunder matmul is broken" ) # The only matmul that currently works is par (__matmul__) # check_is_close(nm.matmul_tiled_unrolled_parallelized(arr,arr),np.matmul(np_arr,np_arr),"TUP matmul is broken") --- tests/test_sort.mojo --- import numojo as nm from time import now from python import Python, PythonObject from utils_for_test import check, check_is_close def test_sort_1d(): arr = nm.NDArray(25, random=True) var np = Python.import_module("numpy") arr_sorted = arr.sort() np_arr_sorted = np.sort(arr.to_numpy()) return check(arr_sorted, np_arr_sorted, "quick sort is broken") # ND sorting currently works differently than numpy which has an on axis # def test_sort_2d(): # arr = nm.NDArray(5,5,random=True) # var np = Python.import_module("numpy") # arr_sorted = arr.sort() # print(arr_sorted) # np_arr_sorted = np.sort(arr.to_numpy()) # print(np_arr_sorted) # return check(arr_sorted,np_arr_sorted, "quick sort is broken") # def main(): # test_sort_1d() # # test_sort_2d() --- tests/utils_for_test.mojo --- from python import Python, PythonObject from testing.testing import assert_true import numojo as nm fn check(array: nm.NDArray, np_sol: PythonObject, st: String) raises: var np = Python.import_module("numpy") assert_true(np.all(np.equal(array.to_numpy(), np_sol)), st) fn check_is_close(array: nm.NDArray, np_sol: PythonObject, st: String) raises: var np = Python.import_module("numpy") assert_true(np.all(np.isclose(array.to_numpy(), np_sol)), st) --- .github/ISSUE_TEMPLATE/bug_report.md --- --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. --- .github/ISSUE_TEMPLATE/feature_request.md --- --- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. --- .github/workflows/main.yml --- name: Main pipeline on: push: branches: - main permissions: contents: write jobs: setup: name: Setup environment and install dependencies runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Install modular run: | curl -s https://get.modular.com | sh - modular auth examples - name: Install Mojo run: modular install mojo - name: Add to PATH run: echo "/home/runner/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH test: name: Run tests runs-on: ubuntu-latest needs: setup steps: - name: Run the test suite run: mojo run_tests.mojo package: name: Create package runs-on: ubuntu-latest needs: setup steps: - name: Run the package command run: mojo package lightbug_http -o lightbug_http.mojopkg - name: Upload package to release uses: svenstaro/upload-release-action@v2 with: file: lightbug_http.mojopkg tag: latest-build overwrite: true --- .gitignore --- *.📦 .DS_Store .mojoenv install_id --- .mojoenv.example --- MOJO_AUTH=<your_modular_auth_token> --- CODE_OF_CONDUCT.md --- # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at @saviorand. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. --- CONTRIBUTING.md --- <!-- omit in toc --> # Contributing to lightbug_http First off, thanks for taking the time to contribute! ❤️ All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: > - Star the project > - Tweet about it > - Refer this project in your project's readme > - Mention the project at local meetups and tell your friends/colleagues <!-- omit in toc --> ## Table of Contents - [I Have a Question](#i-have-a-question) - [I Want To Contribute](#i-want-to-contribute) - [Reporting Bugs](#reporting-bugs) - [Suggesting Enhancements](#suggesting-enhancements) - [Your First Code Contribution](#your-first-code-contribution) - [Improving The Documentation](#improving-the-documentation) - [Styleguides](#styleguides) - [Commit Messages](#commit-messages) - [Join The Project Team](#join-the-project-team) ## I Have a Question > If you want to ask a question, we assume that you have read the available [Documentation](https://github.com/saviorand/). Before you ask a question, it is best to search for existing [Issues](https://github.com/saviorand/lightbug_http/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. If you then still feel the need to ask a question and need clarification, we recommend the following: - Open an [Issue](https://github.com/saviorand/lightbug_http/issues/new). - Provide as much context as you can about what you're running into. - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. We will then take care of the issue as soon as possible. <!-- You might want to create a separate issue tag for questions and include it in this description. People should then tag their issues accordingly. Depending on how large the project is, you may want to outsource the questioning, e.g. to Stack Overflow or Gitter. You may add additional contact and information possibilities: - IRC - Slack - Gitter - Stack Overflow tag - Blog - FAQ - Roadmap - E-Mail List - Forum --> ## I Want To Contribute > ### Legal Notice <!-- omit in toc --> > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. ### Reporting Bugs <!-- omit in toc --> #### Before Submitting a Bug Report A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. - Make sure that you are using the latest version. - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://github.com/saviorand/). If you are looking for support, you might want to check [this section](#i-have-a-question)). - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/saviorand/lightbug_httpissues?q=label%3Abug). - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. - Collect information about the bug: - Stack trace (Traceback) - OS, Platform and Version (Windows, Linux, macOS, x86, ARM) - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. - Possibly your input and the output - Can you reliably reproduce the issue? And can you also reproduce it with older versions? <!-- omit in toc --> #### How Do I Submit a Good Bug Report? > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent directly to [the author](https://www.linkedin.com/in/valentin-erokhin-24969a14a/). We use GitHub issues to track bugs and errors. If you run into an issue with the project: - Open an [Issue](https://github.com/saviorand/lightbug_http/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) - Explain the behavior you would expect and the actual behavior. - Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. - Provide the information you collected in the previous section. Once it's filed: - The project team will label the issue accordingly. - A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. - If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). ### Suggesting Enhancements This section guides you through submitting an enhancement suggestion for lightbug_http, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. <!-- omit in toc --> #### Before Submitting an Enhancement - Make sure that you are using the latest version. - Read the [documentation](https://github.com/saviorand/) carefully and find out if the functionality is already covered, maybe by an individual configuration. - Perform a [search](https://github.com/saviorand/lightbug_http/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. <!-- omit in toc --> #### How Do I Submit a Good Enhancement Suggestion? Enhancement suggestions are tracked as [GitHub issues](https://github.com/saviorand/lightbug_http/issues). - Use a **clear and descriptive title** for the issue to identify the suggestion. - Provide a **step-by-step description of the suggested enhancement** in as many details as possible. - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. - **Explain why this enhancement would be useful** to most lightbug_http users. You may also want to point out the other projects that solved it better and which could serve as inspiration. <!-- omit in toc --> ## Attribution This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! --- LICENSE --- MIT License Copyright (c) 2023 Valentin Erokhin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- Makefile --- lightbug: cd docker && \ docker compose up --build --- README.md --- <a name="readme-top"></a> <!-- PROJECT LOGO --> <br /> <div align="center"> <img src="static/logo.png" alt="Logo" width="250" height="250"> <h3 align="center">Lightbug</h3> <p align="center"> 🐝 A Mojo HTTP framework with wings 🔥 <br/> ![Written in Mojo][language-shield] [![MIT License][license-shield]][license-url] ![Build status][build-shield] <br/> [![Join our Discord][discord-shield]][discord-url] [![Contributors Welcome][contributors-shield]][contributors-url] </p> </div> ## Overview Lightbug is a simple and sweet HTTP framework for Mojo that builds on best practice from systems programming, such as the Golang [FastHTTP](https://github.com/valyala/fasthttp/) and Rust [may_minihttp](https://github.com/Xudong-Huang/may_minihttp/). This is not production ready yet. We're aiming to keep up with new developments in Mojo, but it might take some time to get to a point when this is safe to use in real-world applications. Lightbug currently has the following features: - [x] Pure Mojo networking! No dependencies on Python by default - [x] TCP-based server and client implementation - [x] Assign your own custom handler to a route - [x] Craft HTTP requests and responses with built-in primitives - [x] Everything is fully typed, with no `def` functions used We're working on support for the following (contributors welcome!): - [ ] [SSL/HTTPS support](https://github.com/saviorand/lightbug_http/issues/20) - [ ] UDP support - [ ] [Better error handling](https://github.com/saviorand/lightbug_http/issues/3), [improved form/multipart and JSON support](https://github.com/saviorand/lightbug_http/issues/4) - [ ] [Multiple simultaneous connections](https://github.com/saviorand/lightbug_http/issues/5), [parallelization and performance optimizations](https://github.com/saviorand/lightbug_http/issues/6) - [ ] [WebSockets](https://github.com/saviorand/lightbug_http/issues/7), [HTTP 2.0/3.0 support](https://github.com/saviorand/lightbug_http/issues/8) - [ ] [ASGI spec conformance](https://github.com/saviorand/lightbug_http/issues/17) The test coverage is also something we're working on. The plan is to get to a feature set similar to Python frameworks like [Starlette](https://github.com/encode/starlette), but with better performance. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- GETTING STARTED --> ## Getting Started The only hard dependencies for `lightbug_http` are Mojo and [Git](https://docs.github.com/en/get-started/getting-started-with-git). Learn how to get up and running with Mojo on the [Modular website](https://www.modular.com/max/mojo). The Docker installation was removed with the changes in Modular CLI. It will be available once Modular provides needed functionality for Docker setups. Once you have Mojo set up locally, 1. Clone the repo ```sh git clone https://github.com/saviorand/lightbug_http.git ``` 2. Switch to the project directory: ```sh cd lightbug_http ``` then run: ```sh mojo lightbug.🔥 ``` Open `localhost:8080` in your browser. You should see a welcome screen. Congrats 🥳 You're using Lightbug! 2. Add your handler in `lightbug.🔥` by passing a struct that satisfies the following trait: ```mojo trait HTTPService: fn func(self, req: HTTPRequest) raises -> HTTPResponse: ... ``` For example, to make a `Printer` service that simply prints the request to console: ```mojo @value struct Printer(HTTPService): fn func(self, req: HTTPRequest) raises -> HTTPResponse: var body = req.body_raw print(String(body)) return OK(body) ``` Routing is not in scope for this library, but you can easily set up routes yourself: ```mojo @value struct ExampleRouter(HTTPService): fn func(self, req: HTTPRequest) raises -> HTTPResponse: var body = req.body_raw var uri = req.uri() if uri.path() == "/": print("I'm on the index path!") if uri.path() == "/first": print("I'm on /first!") elif uri.path() == "/second": print("I'm on /second!") elif uri.path() == "/echo": print(String(body)) return OK(body) ``` We plan to add routing in a future library called `lightbug_api`, see [Roadmap](#roadmap) for more details. 3. Run `mojo lightbug.🔥`. This will start up a server listening on `localhost:8080`. Or, if you prefer to import the server into your own app: ```mojo from lightbug_http.sys.server import SysServer from lightbug_http.service import Printer fn main() raises: var server = SysServer() var handler = Printer() server.listen_and_serve("0.0.0.0:8080", handler) ``` Feel free to change the settings in `listen_and_serve()` to serve on a particular host and port. <p align="right">(<a href="#readme-top">back to top</a>)</p> ### Serving static files The default welcome screen shows an example of how to serve files like images or HTML using Lightbug. Mojo has built-in `open`, `read` and `read_bytes` methods that you can use to read files from e.g. a `static` directory and serve them on a route: ```mojo @value struct Welcome(HTTPService): fn func(self, req: HTTPRequest) raises -> HTTPResponse: var uri = req.uri() if uri.path() == "/": var html: Bytes with open("static/lightbug_welcome.html", "r") as f: html = f.read_bytes() return OK(html, "text/html; charset=utf-8") if uri.path() == "/logo.png": var image: Bytes with open("static/logo.png", "r") as f: image = f.read_bytes() return OK(image, "image/png") return NotFound(uri.path()) ``` ### Using the client Create a file, e.g `client.mojo` with the following code. Run `mojo client.mojo` to execute the request to a given URL. ```mojo fn test_request(inout client: MojoClient) raises -> None: var uri = URI("http://httpbin.org/status/404") var request = HTTPRequest(uri) var response = client.do(request) # print status code print("Response:", response.header.status_code()) # print raw headers # print("Headers:", response.header.headers()) # print parsed headers (only some are parsed for now) print("Content-Type:", String(response.header.content_type())) print("Content-Length", response.header.content_length()) print("Connection:", response.header.connection_close()) print("Server:", String(response.header.server())) # print body print(String(response.get_body())) ``` Pure Mojo-based client is available by default. This client is also used internally for testing the server. ## Switching between pure Mojo and Python implementations By default, Lightbug uses the pure Mojo implementation for networking. To use Python's `socket` library instead, just import the `PythonServer` instead of the `SysServer` with the following line: ```mojo from lightbug_http.python.server import PythonServer ``` You can then use all the regular server commands in the same way as with the default server. <!-- ROADMAP --> ## Roadmap <div align="center"> <img src="static/roadmap.png" alt="Logo" width="695" height="226"> </div> Our vision is to develop three libraries, with `lightbug_http` (this repo) as a starting point: - `lightbug_http` - HTTP infrastructure and basic API development - `lightbug_api` - (coming later in 2024!) Tools to make great APIs fast, with support for OpenAPI spec and domain driven design - `lightbug_web` - (release date TBD) Full-stack web framework for Mojo, similar to NextJS or SvelteKit The idea is to get to a point where the entire codebase of a simple modern web application can be written in Mojo. We don't make any promises, though -- this is just a vision, and whether we get there or not depends on many factors, including the support of the community. See the [open issues](https://github.com/saviorand/lightbug_http/issues) and submit your own to help drive the development of Lightbug. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- CONTRIBUTING --> ## Contributing Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. See [CONTRIBUTING.md](./CONTRIBUTING.md) for more details on how to contribute. If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! 1. Fork the Project 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) 4. Push to the Branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LICENSE --> ## License Distributed under the MIT License. See `LICENSE.txt` for more information. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- CONTACT --> ## Contact [Valentin Erokhin](https://www.valentin.wiki/) Project Link: [https://github.com/saviorand/mojo-web](https://github.com/saviorand/mojo-web) <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- ACKNOWLEDGMENTS --> ## Acknowledgments We were drawing a lot on the following projects: * [FastHTTP](https://github.com/valyala/fasthttp/) (Golang) * [may_minihttp](https://github.com/Xudong-Huang/may_minihttp/) (Rust) * [FireTCP](https://github.com/Jensen-holm/FireTCP) (One of the earliest Mojo TCP implementations!) <p align="right">(<a href="#readme-top">back to top</a>)</p> ## Contributors Want your name to show up here? See [CONTRIBUTING.md](./CONTRIBUTING.md)! <a href="https://github.com/saviorand/lightbug_http/graphs/contributors"> <img src="https://contrib.rocks/image?repo=saviorand/lightbug_http&max=100" /> </a> <sub>Made with [contrib.rocks](https://contrib.rocks).</sub> <!-- MARKDOWN LINKS & IMAGES --> <!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --> [build-shield]: https://img.shields.io/github/actions/workflow/status/saviorand/lightbug_http/.github%2Fworkflows%2Fpackage.yml [language-shield]: https://img.shields.io/badge/language-mojo-orange [license-shield]: https://img.shields.io/github/license/saviorand/lightbug_http?logo=github [license-url]: https://github.com/saviorand/lightbug_http/blob/main/LICENSE [contributors-shield]: https://img.shields.io/badge/contributors-welcome!-blue [contributors-url]: https://github.com/saviorand/lightbug_http#contributing [discord-shield]: https://img.shields.io/discord/1192127090271719495?style=flat&logo=discord&logoColor=white [discord-url]: https://discord.gg/VFWETkTgrr --- bench.mojo --- import benchmark from lightbug_http.sys.server import SysServer from lightbug_http.python.server import PythonServer from lightbug_http.service import TechEmpowerRouter from tests.utils import ( TestStruct, FakeResponder, new_fake_listener, FakeServer, getRequest, ) fn main(): try: var server = SysServer(tcp_keep_alive=True) var handler = TechEmpowerRouter() server.listen_and_serve("0.0.0.0:8080", handler) except e: print("Error starting server: " + e.__str__()) return fn lightbug_benchmark_server(): var server_report = benchmark.run[run_fake_server](max_iters=1) print("Server: ") server_report.print(benchmark.Unit.ms) fn lightbug_benchmark_misc() -> None: var direct_set_report = benchmark.run[init_test_and_set_a_direct](max_iters=1) var recreating_set_report = benchmark.run[init_test_and_set_a_copy](max_iters=1) print("Direct set: ") direct_set_report.print(benchmark.Unit.ms) print("Recreating set: ") recreating_set_report.print(benchmark.Unit.ms) fn run_fake_server(): var handler = FakeResponder() var listener = new_fake_listener(2, getRequest) var server = FakeServer(listener, handler) server.serve() fn init_test_and_set_a_copy() -> None: var test = TestStruct("a", "b") _ = test.set_a_copy("c") fn init_test_and_set_a_direct() -> None: var test = TestStruct("a", "b") _ = test.set_a_direct("c") --- client.mojo --- from lightbug_http.http import HTTPRequest, encode from lightbug_http.header import RequestHeader from lightbug_http.uri import URI from lightbug_http.sys.client import MojoClient fn test_request(inout client: MojoClient) raises -> None: var uri = URI("http://httpbin.org/status/404") try: uri.parse() except e: print("error parsing uri: " + e.__str__()) var request = HTTPRequest(uri) var response = client.do(request) # print status code print("Response:", response.header.status_code()) # print raw headers # print("Headers:", response.header.headers()) # print parsed headers (only some are parsed for now) print("Content-Type:", String(response.header.content_type())) print("Content-Length", response.header.content_length()) print("Server:", String(response.header.server())) print("Is connection set to connection-close? ", response.header.connection_close()) # print body print(String(response.get_body_bytes())) fn main() raises -> None: var client = MojoClient() test_request(client) --- docker/docker-compose.yml --- version: '3.8' services: mojo-runner: build: context: ../ # Set the context to the parent directory of the Dockerfile dockerfile: ./docker/lightbug.dockerfile args: userid: 1000 groupid: 1000 username: mojo image: mojo-runner ports: - "8080:8080" --- docker/lightbug.dockerfile --- # Thanks to Chillheart (https://github.com/Chilledheart/mojo-docker-images) for the original Dockerfile! FROM ubuntu:22.04 ARG userid=1000 ARG groupid=1000 ARG username=mojo ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -qq && apt-get upgrade -y && \ apt-get install -y apt-utils curl sudo git && \ apt-get install -y libedit2 libncurses-dev apt-transport-https \ ca-certificates gnupg libxml2-dev python3 python3-pip python3-dev python3.10-venv && \ apt-get clean RUN mkdir ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf RUN groupadd -g $groupid $username \ && useradd -m -s /bin/bash -u $userid -g $groupid $username \ && mkdir -p /home/$username && chown $userid:$groupid /home/$username RUN echo "$username ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/$username RUN echo "export HOME=/home/$username" >> /home/$username/.bashrc RUN echo 'export MODULAR_HOME="$HOME/.modular"' >> /home/$username/.bashrc RUN echo 'export PATH="$HOME/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> /home/$username/.bashrc WORKDIR /home/$username/ COPY .mojoenv ./.mojoenv COPY docker/run.sh ./run.sh RUN chmod +x ./run.sh USER $username EXPOSE 8080 CMD ["./run.sh"] --- docker/run.sh --- #!/bin/bash # Extract username from the $HOME variable username=$(basename $HOME) set -a source .mojoenv set +a # Install the modular package curl https://get.modular.com | sudo -u $username MODULAR_AUTH=$MOJO_AUTH bash - # Install the mojo package sudo -u $username modular install mojo export MODULAR_HOME="$HOME/.modular" export PATH="$HOME/.modular/pkg/packages.modular.com_mojo/bin:$PATH" git clone https://github.com/saviorand/lightbug_http.git ./src cd src mojo bench.mojo --- external/__init__.mojo --- --- external/gojo/__init__.mojo --- --- external/gojo/bufio/__init__.mojo --- from .bufio import Reader, Writer, ReadWriter from .scan import Scanner, scan_words, scan_bytes, scan_lines --- external/gojo/bufio/bufio.mojo --- import ..io from ..builtins import copy, panic from ..builtins.bytes import UInt8, index_byte from ..strings import StringBuilder alias MIN_READ_BUFFER_SIZE = 16 alias MAX_CONSECUTIVE_EMPTY_READS = 100 alias DEFAULT_BUF_SIZE = 8200 alias ERR_INVALID_UNREAD_BYTE = "bufio: invalid use of unread_byte" alias ERR_INVALID_UNREAD_RUNE = "bufio: invalid use of unread_rune" alias ERR_BUFFER_FULL = "bufio: buffer full" alias ERR_NEGATIVE_COUNT = "bufio: negative count" alias ERR_NEGATIVE_READ = "bufio: reader returned negative count from Read" alias ERR_NEGATIVE_WRITE = "bufio: writer returned negative count from write" # buffered input struct Reader[R: io.Reader](Sized, io.Reader, io.ByteReader, io.ByteScanner): """Implements buffering for an io.Reader object.""" var buf: List[UInt8] var reader: R # reader provided by the client var read_pos: Int var write_pos: Int # buf read and write positions var last_byte: Int # last byte read for unread_byte; -1 means invalid var last_rune_size: Int # size of last rune read for unread_rune; -1 means invalid var err: Error fn __init__( inout self, owned reader: R, buf: List[UInt8] = List[UInt8](capacity=DEFAULT_BUF_SIZE), read_pos: Int = 0, write_pos: Int = 0, last_byte: Int = -1, last_rune_size: Int = -1, ): self.buf = buf self.reader = reader^ self.read_pos = read_pos self.write_pos = write_pos self.last_byte = last_byte self.last_rune_size = last_rune_size self.err = Error() fn __moveinit__(inout self, owned existing: Self): self.buf = existing.buf^ self.reader = existing.reader^ self.read_pos = existing.read_pos self.write_pos = existing.write_pos self.last_byte = existing.last_byte self.last_rune_size = existing.last_rune_size self.err = existing.err^ # size returns the size of the underlying buffer in bytes. fn __len__(self) -> Int: return len(self.buf) # reset discards any buffered data, resets all state, and switches # the buffered reader to read from r. # Calling reset on the zero value of [Reader] initializes the internal buffer # to the default size. # Calling self.reset(b) (that is, resetting a [Reader] to itself) does nothing. # fn reset[R: io.Reader](self, reader: R): # # If a Reader r is passed to NewReader, NewReader will return r. # # Different layers of code may do that, and then later pass r # # to reset. Avoid infinite recursion in that case. # if self == reader: # return # # if self.buf == nil: # # self.buf = make(List[UInt8], DEFAULT_BUF_SIZE) # self.reset(self.buf, r) fn reset(inout self, buf: List[UInt8], owned reader: R): self = Reader[R]( buf=buf, reader=reader^, last_byte=-1, last_rune_size=-1, ) fn fill(inout self): """Reads a new chunk into the buffer.""" # Slide existing data to beginning. if self.read_pos > 0: var current_capacity = self.buf.capacity self.buf = self.buf[self.read_pos : self.write_pos] self.buf.reserve(current_capacity) self.write_pos -= self.read_pos self.read_pos = 0 # Compares to the length of the entire List[UInt8] object, including 0 initialized positions. # IE. var b = List[UInt8](capacity=8200), then trying to write at b[8200] and onwards will fail. if self.write_pos >= self.buf.capacity: panic("bufio.Reader: tried to fill full buffer") # Read new data: try a limited number of times. var i: Int = MAX_CONSECUTIVE_EMPTY_READS while i > 0: # TODO: Using temp until slicing can return a Reference var temp = List[UInt8](capacity=DEFAULT_BUF_SIZE) var bytes_read: Int var err: Error bytes_read, err = self.reader.read(temp) if bytes_read < 0: panic(ERR_NEGATIVE_READ) bytes_read = copy(self.buf, temp, self.write_pos) self.write_pos += bytes_read if err: self.err = err return if bytes_read > 0: return i -= 1 self.err = Error(io.ERR_NO_PROGRESS) fn read_error(inout self) -> Error: if not self.err: return Error() var err = self.err self.err = Error() return err fn peek(inout self, number_of_bytes: Int) -> (List[UInt8], Error): """Returns the next n bytes without advancing the reader. The bytes stop being valid at the next read call. If Peek returns fewer than n bytes, it also returns an error explaining why the read is short. The error is [ERR_BUFFER_FULL] if number_of_bytes is larger than b's buffer size. Calling Peek prevents a [Reader.unread_byte] or [Reader.unread_rune] call from succeeding until the next read operation. Args: number_of_bytes: The number of bytes to peek. """ if number_of_bytes < 0: return List[UInt8](), Error(ERR_NEGATIVE_COUNT) self.last_byte = -1 self.last_rune_size = -1 while self.write_pos - self.read_pos < number_of_bytes and self.write_pos - self.read_pos < self.buf.capacity: self.fill() # self.write_pos-self.read_pos < self.buf.capacity => buffer is not full if number_of_bytes > self.buf.capacity: return self.buf[self.read_pos : self.write_pos], Error(ERR_BUFFER_FULL) # 0 <= n <= self.buf.capacity var err = Error() var available_space = self.write_pos - self.read_pos if available_space < number_of_bytes: # not enough data in buffer err = self.read_error() if not err: err = Error(ERR_BUFFER_FULL) return self.buf[self.read_pos : self.read_pos + number_of_bytes], err fn discard(inout self, number_of_bytes: Int) -> (Int, Error): """Discard skips the next n bytes, returning the number of bytes discarded. If Discard skips fewer than n bytes, it also returns an error. If 0 <= number_of_bytes <= self.buffered(), Discard is guaranteed to succeed without reading from the underlying io.Reader. """ if number_of_bytes < 0: return 0, Error(ERR_NEGATIVE_COUNT) if number_of_bytes == 0: return 0, Error() self.last_byte = -1 self.last_rune_size = -1 var remain = number_of_bytes while True: var skip = self.buffered() if skip == 0: self.fill() skip = self.buffered() if skip > remain: skip = remain self.read_pos += skip remain -= skip if remain == 0: return number_of_bytes, Error() fn read(inout self, inout dest: List[UInt8]) -> (Int, Error): """Reads data into dest. It returns the number of bytes read into dest. The bytes are taken from at most one Read on the underlying [Reader], hence n may be less than len(src). To read exactly len(src) bytes, use io.ReadFull(b, src). If the underlying [Reader] can return a non-zero count with io.EOF, then this Read method can do so as well; see the [io.Reader] docs.""" var space_available = dest.capacity - len(dest) if space_available == 0: if self.buffered() > 0: return 0, Error() return 0, self.read_error() var bytes_read: Int = 0 if self.read_pos == self.write_pos: if space_available >= len(self.buf): # Large read, empty buffer. # Read directly into dest to avoid copy. var bytes_read: Int var err: Error bytes_read, err = self.reader.read(dest) self.err = err if bytes_read < 0: panic(ERR_NEGATIVE_READ) if bytes_read > 0: self.last_byte = int(dest[bytes_read - 1]) self.last_rune_size = -1 return bytes_read, self.read_error() # One read. # Do not use self.fill, which will loop. self.read_pos = 0 self.write_pos = 0 var bytes_read: Int var err: Error bytes_read, err = self.reader.read(self.buf) if bytes_read < 0: panic(ERR_NEGATIVE_READ) if bytes_read == 0: return 0, self.read_error() self.write_pos += bytes_read # copy as much as we can # Note: if the slice panics here, it is probably because # the underlying reader returned a bad count. See issue 49795. bytes_read = copy(dest, self.buf[self.read_pos : self.write_pos]) self.read_pos += bytes_read self.last_byte = int(self.buf[self.read_pos - 1]) self.last_rune_size = -1 return bytes_read, Error() fn read_byte(inout self) -> (UInt8, Error): """Reads and returns a single byte from the internal buffer. If no byte is available, returns an error.""" self.last_rune_size = -1 while self.read_pos == self.write_pos: if self.err: return UInt8(0), self.read_error() self.fill() # buffer is empty var c = self.buf[self.read_pos] self.read_pos += 1 self.last_byte = int(c) return c, Error() fn unread_byte(inout self) -> Error: """Unreads the last byte. Only the most recently read byte can be unread. unread_byte returns an error if the most recent method called on the [Reader] was not a read operation. Notably, [Reader.peek], [Reader.discard], and [Reader.write_to] are not considered read operations. """ if self.last_byte < 0 or self.read_pos == 0 and self.write_pos > 0: return Error(ERR_INVALID_UNREAD_BYTE) # self.read_pos > 0 or self.write_pos == 0 if self.read_pos > 0: self.read_pos -= 1 else: # self.read_pos == 0 and self.write_pos == 0 self.write_pos = 1 self.buf[self.read_pos] = self.last_byte self.last_byte = -1 self.last_rune_size = -1 return Error() # # read_rune reads a single UTF-8 encoded Unicode character and returns the # # rune and its size in bytes. If the encoded rune is invalid, it consumes one byte # # and returns unicode.ReplacementChar (U+FFFD) with a size of 1. # fn read_rune(inout self) (r rune, size int, err error): # for self.read_pos+utf8.UTFMax > self.write_pos and !utf8.FullRune(self.buf[self.read_pos:self.write_pos]) and self.err == nil and self.write_pos-self.read_pos < self.buf.capacity: # self.fill() # self.write_pos-self.read_pos < len(buf) => buffer is not full # self.last_rune_size = -1 # if self.read_pos == self.write_pos: # return 0, 0, self.read_poseadErr() # r, size = rune(self.buf[self.read_pos]), 1 # if r >= utf8.RuneSelf: # r, size = utf8.DecodeRune(self.buf[self.read_pos:self.write_pos]) # self.read_pos += size # self.last_byte = int(self.buf[self.read_pos-1]) # self.last_rune_size = size # return r, size, nil # # unread_rune unreads the last rune. If the most recent method called on # # the [Reader] was not a [Reader.read_rune], [Reader.unread_rune] returns an error. (In this # # regard it is stricter than [Reader.unread_byte], which will unread the last byte # # from any read operation.) # fn unread_rune() error: # if self.last_rune_size < 0 or self.read_pos < self.last_rune_size: # return ERR_INVALID_UNREAD_RUNE # self.read_pos -= self.last_rune_size # self.last_byte = -1 # self.last_rune_size = -1 # return nil fn buffered(self) -> Int: """Returns the number of bytes that can be read from the current buffer. Returns: The number of bytes that can be read from the current buffer. """ return self.write_pos - self.read_pos fn read_slice(inout self, delim: UInt8) -> (List[UInt8], Error): """Reads until the first occurrence of delim in the input, returning a slice pointing at the bytes in the buffer. It includes the first occurrence of the delimiter. The bytes stop being valid at the next read. If read_slice encounters an error before finding a delimiter, it returns all the data in the buffer and the error itself (often io.EOF). read_slice fails with error [ERR_BUFFER_FULL] if the buffer fills without a delim. Because the data returned from read_slice will be overwritten by the next I/O operation, most clients should use [Reader.read_bytes] or read_string instead. read_slice returns err != nil if and only if line does not end in delim. Args: delim: The delimiter to search for. Returns: The List[UInt8] from the internal buffer. """ var err = Error() var s = 0 # search start index var line: List[UInt8] = List[UInt8](capacity=DEFAULT_BUF_SIZE) while True: # Search buffer. var i = index_byte(self.buf[self.read_pos + s : self.write_pos], delim) if i >= 0: i += s line = self.buf[self.read_pos : self.read_pos + i + 1] self.read_pos += i + 1 break # Pending error? if self.err: line = self.buf[self.read_pos : self.write_pos] self.read_pos = self.write_pos err = self.read_error() break # Buffer full? if self.buffered() >= self.buf.capacity: self.read_pos = self.write_pos line = self.buf err = Error(ERR_BUFFER_FULL) break s = self.write_pos - self.read_pos # do not rescan area we scanned before self.fill() # buffer is not full # Handle last byte, if any. var i = len(line) - 1 if i >= 0: self.last_byte = int(line[i]) self.last_rune_size = -1 return line, err fn read_line(inout self) raises -> (List[UInt8], Bool): """Low-level line-reading primitive. Most callers should use [Reader.read_bytes]('\n') or [Reader.read_string]('\n') instead or use a [Scanner]. read_line tries to return a single line, not including the end-of-line bytes. If the line was too long for the buffer then isPrefix is set and the beginning of the line is returned. The rest of the line will be returned from future calls. isPrefix will be false when returning the last fragment of the line. The returned buffer is only valid until the next call to read_line. read_line either returns a non-nil line or it returns an error, never both. The text returned from read_line does not include the line end ("\r\n" or "\n"). No indication or error is given if the input ends without a final line end. Calling [Reader.unread_byte] after read_line will always unread the last byte read (possibly a character belonging to the line end) even if that byte is not part of the line returned by read_line. """ var line: List[UInt8] var err: Error line, err = self.read_slice(ord("\n")) if err and str(err) == ERR_BUFFER_FULL: # Handle the case where "\r\n" straddles the buffer. if len(line) > 0 and line[len(line) - 1] == ord("\r"): # Put the '\r' back on buf and drop it from line. # Let the next call to read_line check for "\r\n". if self.read_pos == 0: # should be unreachable raise Error("bufio: tried to rewind past start of buffer") self.read_pos -= 1 line = line[: len(line) - 1] return line, True if len(line) == 0: return line, False if line[len(line) - 1] == ord("\n"): var drop = 1 if len(line) > 1 and line[len(line) - 2] == ord("\r"): drop = 2 line = line[: len(line) - drop] return line, False fn collect_fragments(inout self, delim: UInt8) -> (List[List[UInt8]], List[UInt8], Int, Error): """Reads until the first occurrence of delim in the input. It returns (slice of full buffers, remaining bytes before delim, total number of bytes in the combined first two elements, error). Args: delim: The delimiter to search for. """ # Use read_slice to look for delim, accumulating full buffers. var err = Error() var full_buffers = List[List[UInt8]]() var total_len = 0 var frag = List[UInt8](capacity=8200) while True: frag, err = self.read_slice(delim) if not err: break var read_slice_error = err if str(read_slice_error) != ERR_BUFFER_FULL: err = read_slice_error break # Make a copy of the buffer. var buf = List[UInt8](frag) full_buffers.append(buf) total_len += len(buf) total_len += len(frag) return full_buffers, frag, total_len, err fn read_bytes(inout self, delim: UInt8) -> (List[UInt8], Error): """Reads until the first occurrence of delim in the input, returning a slice containing the data up to and including the delimiter. If read_bytes encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). read_bytes returns err != nil if and only if the returned data does not end in delim. For simple uses, a Scanner may be more convenient. Args: delim: The delimiter to search for. Returns: The List[UInt8] from the internal buffer. """ var full: List[List[UInt8]] var frag: List[UInt8] var n: Int var err: Error full, frag, n, err = self.collect_fragments(delim) # Allocate new buffer to hold the full pieces and the fragment. var buf = List[UInt8](capacity=n) n = 0 # copy full pieces and fragment in. for i in range(len(full)): var buffer = full[i] n += copy(buf, buffer, n) _ = copy(buf, frag, n) return buf, err fn read_string(inout self, delim: UInt8) -> (String, Error): """Reads until the first occurrence of delim in the input, returning a string containing the data up to and including the delimiter. If read_string encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). read_string returns err != nil if and only if the returned data does not end in delim. For simple uses, a Scanner may be more convenient. Args: delim: The delimiter to search for. Returns: The String from the internal buffer. """ var full: List[List[UInt8]] var frag: List[UInt8] var n: Int var err: Error full, frag, n, err = self.collect_fragments(delim) # Allocate new buffer to hold the full pieces and the fragment. var buf = StringBuilder(capacity=n) # copy full pieces and fragment in. for i in range(len(full)): var buffer = full[i] _ = buf.write(Span(buffer)) _ = buf.write(Span(frag)) return str(buf), err # fn write_to[W: io.Writer](inout self, inout writer: W) -> (Int64, Error): # """Writes the internal buffer to the writer. This may make multiple calls to the [Reader.Read] method of the underlying [Reader]. # If the underlying reader supports the [Reader.WriteTo] method, # this calls the underlying [Reader.WriteTo] without buffering. # write_to implements io.WriterTo. # Args: # writer: The writer to write to. # Returns: # The number of bytes written. # """ # self.last_byte = -1 # self.last_rune_size = -1 # var bytes_written: Int64 # var err: Error # bytes_written, err = self.write_buf(writer) # if err: # return bytes_written, err # # internal buffer not full, fill before writing to writer # if (self.write_pos - self.read_pos) < self.buf.capacity: # self.fill() # while self.read_pos < self.write_pos: # # self.read_pos < self.write_pos => buffer is not empty # var bw: Int64 # var err: Error # bw, err = self.write_buf(writer) # bytes_written += bw # self.fill() # buffer is empty # return bytes_written, Error() # fn write_buf[W: io.Writer](inout self, inout writer: W) -> (Int64, Error): # """Writes the [Reader]'s buffer to the writer. # Args: # writer: The writer to write to. # Returns: # The number of bytes written. # """ # # Nothing to write # if self.read_pos == self.write_pos: # return Int64(0), Error() # # Write the buffer to the writer, if we hit EOF it's fine. That's not a failure condition. # var bytes_written: Int # var err: Error # var buf_to_write = self.buf[self.read_pos : self.write_pos] # bytes_written, err = writer.write(Span(buf_to_write)) # if err: # return Int64(bytes_written), err # if bytes_written < 0: # panic(ERR_NEGATIVE_WRITE) # self.read_pos += bytes_written # return Int64(bytes_written), Error() # fn new_reader_size[R: io.Reader](owned reader: R, size: Int) -> Reader[R]: # """Returns a new [Reader] whose buffer has at least the specified # size. If the argument io.Reader is already a [Reader] with large enough # size, it returns the underlying [Reader]. # Args: # reader: The reader to read from. # size: The size of the buffer. # Returns: # The new [Reader]. # """ # # # Is it already a Reader? # # b, ok := rd.(*Reader) # # if ok and self.buf.capacity >= size: # # return b # var r = Reader(reader ^) # r.reset(List[UInt8](capacity=max(size, MIN_READ_BUFFER_SIZE)), reader ^) # return r # fn new_reader[R: io.Reader](reader: R) -> Reader[R]: # """Returns a new [Reader] whose buffer has the default size. # Args: # reader: The reader to read from. # Returns: # The new [Reader]. # """ # return new_reader_size(reader, DEFAULT_BUF_SIZE) # buffered output # TODO: Reader and Writer maybe should not take ownership of the underlying reader/writer? Seems okay for now. struct Writer[W: io.Writer](Sized, io.Writer, io.ByteWriter, io.StringWriter): """Implements buffering for an [io.Writer] object. # If an error occurs writing to a [Writer], no more data will be # accepted and all subsequent writes, and [Writer.flush], will return the error. # After all data has been written, the client should call the # [Writer.flush] method to guarantee all data has been forwarded to # the underlying [io.Writer].""" var buf: List[UInt8] var bytes_written: Int var writer: W var err: Error fn __init__( inout self, owned writer: W, buf: List[UInt8] = List[UInt8](capacity=DEFAULT_BUF_SIZE), bytes_written: Int = 0, ): self.buf = buf self.bytes_written = bytes_written self.writer = writer^ self.err = Error() fn __moveinit__(inout self, owned existing: Self): self.buf = existing.buf^ self.bytes_written = existing.bytes_written self.writer = existing.writer^ self.err = existing.err^ fn __len__(self) -> Int: """Returns the size of the underlying buffer in bytes.""" return len(self.buf) fn reset(inout self, owned writer: W): """Discards any unflushed buffered data, clears any error, and resets b to write its output to w. Calling reset on the zero value of [Writer] initializes the internal buffer to the default size. Calling w.reset(w) (that is, resetting a [Writer] to itself) does nothing. Args: writer: The writer to write to. """ # # If a Writer w is passed to new_writer, new_writer will return w. # # Different layers of code may do that, and then later pass w # # to reset. Avoid infinite recursion in that case. # if self == writer: # return # if self.buf == nil: # self.buf = make(List[UInt8], DEFAULT_BUF_SIZE) self.err = Error() self.bytes_written = 0 self.writer = writer^ fn flush(inout self) -> Error: """Writes any buffered data to the underlying [io.Writer].""" # Prior to attempting to flush, check if there's a pre-existing error or if there's nothing to flush. var err = Error() if self.err: return self.err if self.bytes_written == 0: return err var bytes_written: Int = 0 bytes_written, err = self.writer.write(Span(self.buf[0 : self.bytes_written])) # If the write was short, set a short write error and try to shift up the remaining bytes. if bytes_written < self.bytes_written and not err: err = Error(io.ERR_SHORT_WRITE) if err: if bytes_written > 0 and bytes_written < self.bytes_written: _ = copy(self.buf, self.buf[bytes_written : self.bytes_written]) self.bytes_written -= bytes_written self.err = err return err # Reset the buffer self.buf = List[UInt8](capacity=self.buf.capacity) self.bytes_written = 0 return err fn available(self) -> Int: """Returns how many bytes are unused in the buffer.""" return self.buf.capacity - len(self.buf) fn available_buffer(self) raises -> List[UInt8]: """Returns an empty buffer with self.available() capacity. This buffer is intended to be appended to and passed to an immediately succeeding [Writer.write] call. The buffer is only valid until the next write operation on self. Returns: An empty buffer with self.available() capacity. """ return self.buf[self.bytes_written :][:0] fn buffered(self) -> Int: """Returns the number of bytes that have been written into the current buffer. Returns: The number of bytes that have been written into the current buffer. """ return self.bytes_written fn write(inout self, src: Span[UInt8]) -> (Int, Error): """Writes the contents of src into the buffer. It returns the number of bytes written. If nn < len(src), it also returns an error explaining why the write is short. Args: src: The bytes to write. Returns: The number of bytes written. """ var total_bytes_written: Int = 0 var src_copy = src var err = Error() while len(src_copy) > self.available() and not self.err: var bytes_written: Int = 0 if self.buffered() == 0: # Large write, empty buffer. # write directly from p to avoid copy. bytes_written, err = self.writer.write(src_copy) self.err = err else: bytes_written = copy(self.buf, src_copy, self.bytes_written) self.bytes_written += bytes_written _ = self.flush() total_bytes_written += bytes_written src_copy = src_copy[bytes_written : len(src_copy)] if self.err: return total_bytes_written, self.err var n = copy(self.buf, src_copy, self.bytes_written) self.bytes_written += n total_bytes_written += n return total_bytes_written, err fn write_byte(inout self, src: UInt8) -> (Int, Error): """Writes a single byte to the internal buffer. Args: src: The byte to write. """ if self.err: return 0, self.err # If buffer is full, flush to the underlying writer. var err = self.flush() if self.available() <= 0 and err: return 0, self.err self.buf.append(src) self.bytes_written += 1 return 1, Error() # # WriteRune writes a single Unicode code point, returning # # the number of bytes written and any error. # fn WriteRune(r rune) (size int, err error): # # Compare as uint32 to correctly handle negative runes. # if uint32(r) < utf8.RuneSelf: # err = self.write_posriteByte(byte(r)) # if err != nil: # return 0, err # return 1, nil # if self.err != nil: # return 0, self.err # n := self.available() # if n < utf8.UTFMax: # if self.flush(); self.err != nil: # return 0, self.err # n = self.available() # if n < utf8.UTFMax: # # Can only happen if buffer is silly small. # return self.write_posriteString(string(r)) # size = utf8.EncodeRune(self.buf[self.bytes_written:], r) # self.bytes_written += size # return size, nil fn write_string(inout self, src: String) -> (Int, Error): """Writes a string to the internal buffer. It returns the number of bytes written. If the count is less than len(s), it also returns an error explaining why the write is short. Args: src: The string to write. Returns: The number of bytes written. """ return self.write(src.as_bytes_slice()) fn read_from[R: io.Reader](inout self, inout reader: R) -> (Int64, Error): """Implements [io.ReaderFrom]. If the underlying writer supports the read_from method, this calls the underlying read_from. If there is buffered data and an underlying read_from, this fills the buffer and writes it before calling read_from. Args: reader: The reader to read from. Returns: The number of bytes read. """ if self.err: return Int64(0), self.err var bytes_read: Int = 0 var total_bytes_written: Int64 = 0 var err = Error() while True: if self.available() == 0: var err = self.flush() if err: return total_bytes_written, err var nr = 0 while nr < MAX_CONSECUTIVE_EMPTY_READS: # TODO: should really be using a slice that returns refs and not a copy. # Read into remaining unused space in the buffer. We need to reserve capacity for the slice otherwise read will never hit EOF. var sl = self.buf[self.bytes_written : len(self.buf)] sl.reserve(self.buf.capacity) bytes_read, err = reader.read(sl) if bytes_read > 0: bytes_read = copy(self.buf, sl, self.bytes_written) if bytes_read != 0 or err: break nr += 1 if nr == MAX_CONSECUTIVE_EMPTY_READS: return Int64(bytes_read), Error(io.ERR_NO_PROGRESS) self.bytes_written += bytes_read total_bytes_written += Int64(bytes_read) if err: break if err and str(err) == io.EOF: # If we filled the buffer exactly, flush preemptively. if self.available() == 0: err = self.flush() else: err = Error() return total_bytes_written, Error() fn new_writer_size[W: io.Writer](owned writer: W, size: Int) -> Writer[W]: """Returns a new [Writer] whose buffer has at least the specified size. If the argument io.Writer is already a [Writer] with large enough size, it returns the underlying [Writer].""" # Is it already a Writer? # b, ok := w.(*Writer) # if ok and self.buf.capacity >= size: # return b var buf_size = size if buf_size <= 0: buf_size = DEFAULT_BUF_SIZE return Writer[W]( buf=List[UInt8](capacity=size), writer=writer^, bytes_written=0, ) fn new_writer[W: io.Writer](owned writer: W) -> Writer[W]: """Returns a new [Writer] whose buffer has the default size. # If the argument io.Writer is already a [Writer] with large enough buffer size, # it returns the underlying [Writer].""" return new_writer_size[W](writer^, DEFAULT_BUF_SIZE) # buffered input and output struct ReadWriter[R: io.Reader, W: io.Writer](): """ReadWriter stores pointers to a [Reader] and a [Writer]. It implements [io.ReadWriter].""" var reader: R var writer: W fn __init__(inout self, owned reader: R, owned writer: W): self.reader = reader^ self.writer = writer^ # new_read_writer fn new_read_writer[R: io.Reader, W: io.Writer](owned reader: R, owned writer: W) -> ReadWriter[R, W]: """Allocates a new [ReadWriter] that dispatches to r and w.""" return ReadWriter[R, W](reader^, writer^) --- external/gojo/bufio/scan.mojo --- import math from collections import Optional import ..io from ..builtins import copy, panic, Error from ..builtins.bytes import Byte, index_byte from .bufio import MAX_CONSECUTIVE_EMPTY_READS alias MAX_INT: Int = 2147483647 struct Scanner[R: io.Reader](): """Scanner provides a convenient Interface for reading data such as a file of newline-delimited lines of text. Successive calls to the [Scanner.Scan] method will step through the 'tokens' of a file, skipping the bytes between the tokens. The specification of a token is defined by a split function of type [SplitFunction]; the default split function breaks the input Into lines with line termination stripped. [Scanner.split] fntions are defined in this package for scanning a file Into lines, bytes, UTF-8-encoded runes, and space-delimited words. The client may instead provide a custom split function. Scanning stops unrecoverably at EOF, the first I/O error, or a token too large to fit in the [Scanner.buffer]. When a scan stops, the reader may have advanced arbitrarily far past the last token. Programs that need more control over error handling or large tokens, or must run sequential scans on a reader, should use [bufio.Reader] instead.""" var reader: R # The reader provided by the client. var split: SplitFunction # The function to split the tokens. var max_token_size: Int # Maximum size of a token; modified by tests. var token: List[Byte] # Last token returned by split. var buf: List[Byte] # buffer used as argument to split. var start: Int # First non-processed byte in buf. var end: Int # End of data in buf. var empties: Int # Count of successive empty tokens. var scan_called: Bool # Scan has been called; buffer is in use. var done: Bool # Scan has finished. var err: Error fn __init__( inout self, owned reader: R, split: SplitFunction = scan_lines, max_token_size: Int = MAX_SCAN_TOKEN_SIZE, token: List[Byte] = List[Byte](capacity=io.BUFFER_SIZE), buf: List[Byte] = List[Byte](capacity=io.BUFFER_SIZE), start: Int = 0, end: Int = 0, empties: Int = 0, scan_called: Bool = False, done: Bool = False, ): self.reader = reader^ self.split = split self.max_token_size = max_token_size self.token = token self.buf = buf self.start = start self.end = end self.empties = empties self.scan_called = scan_called self.done = done self.err = Error() fn current_token_as_bytes(self) -> List[Byte]: """Returns the most recent token generated by a call to [Scanner.Scan]. The underlying array may point to data that will be overwritten by a subsequent call to Scan. It does no allocation. """ return self.token fn current_token(self) -> String: """Returns the most recent token generated by a call to [Scanner.Scan] as a newly allocated string holding its bytes.""" return String(self.token) fn scan(inout self) raises -> Bool: """Advances the [Scanner] to the next token, which will then be available through the [Scanner.current_token_as_bytes] or [Scanner.current_token] method. It returns False when there are no more tokens, either by reaching the end of the input or an error. After Scan returns False, the [Scanner.Err] method will return any error that occurred during scanning, except if it was [io.EOF], [Scanner.Err]. Scan raises an Error if the split function returns too many empty tokens without advancing the input. This is a common error mode for scanners. """ if self.done: return False self.scan_called = True # Loop until we have a token. while True: # See if we can get a token with what we already have. # If we've run out of data but have an error, give the split function # a chance to recover any remaining, possibly empty token. if (self.end > self.start) or self.err: var advance: Int var token = List[Byte](capacity=io.BUFFER_SIZE) var err = Error() var at_eof = False if self.err: at_eof = True advance, token, err = self.split(self.buf[self.start : self.end], at_eof) if err: if str(err) == str(ERR_FINAL_TOKEN): self.token = token self.done = True # When token is not nil, it means the scanning stops # with a trailing token, and thus the return value # should be True to indicate the existence of the token. return len(token) != 0 self.set_err(err) return False if not self.advance(advance): return False self.token = token if len(token) != 0: if not self.err or advance > 0: self.empties = 0 else: # Returning tokens not advancing input at EOF. self.empties += 1 if self.empties > MAX_CONSECUTIVE_EMPTY_READS: panic("bufio.Scan: too many empty tokens without progressing") return True # We cannot generate a token with what we are holding. # If we've already hit EOF or an I/O error, we are done. if self.err: # Shut it down. self.start = 0 self.end = 0 return False # Must read more data. # First, shift data to beginning of buffer if there's lots of empty space # or space is needed. if self.start > 0 and (self.end == len(self.buf) or self.start > int(len(self.buf) / 2)): _ = copy(self.buf, self.buf[self.start : self.end]) self.end -= self.start self.start = 0 # Is the buffer full? If so, resize. if self.end == len(self.buf): # Guarantee no overflow in the multiplication below. if len(self.buf) >= self.max_token_size or len(self.buf) > int(MAX_INT / 2): self.set_err(Error(str(ERR_TOO_LONG))) return False var new_size = len(self.buf) * 2 if new_size == 0: new_size = START_BUF_SIZE # Make a new List[Byte] buffer and copy the elements in new_size = min(new_size, self.max_token_size) var new_buf = List[Byte](capacity=new_size) _ = copy(new_buf, self.buf[self.start : self.end]) self.buf = new_buf self.end -= self.start self.start = 0 # Finally we can read some input. Make sure we don't get stuck with # a misbehaving Reader. Officially we don't need to do this, but let's # be extra careful: Scanner is for safe, simple jobs. var loop = 0 while True: var bytes_read: Int var sl = self.buf[self.end : len(self.buf)] var err: Error # Catch any reader errors and set the internal error field to that err instead of bubbling it up. bytes_read, err = self.reader.read(sl) _ = copy(self.buf, sl, self.end) if bytes_read < 0 or len(self.buf) - self.end < bytes_read: self.set_err(Error(str(ERR_BAD_READ_COUNT))) break self.end += bytes_read if err: self.set_err(err) break if bytes_read > 0: self.empties = 0 break loop += 1 if loop > MAX_CONSECUTIVE_EMPTY_READS: self.set_err(Error(io.ERR_NO_PROGRESS)) break fn set_err(inout self, err: Error): """Set the internal error field to the provided error. Args: err: The error to set. """ if self.err: var value = str(self.err) if value == "" or value == io.EOF: self.err = err else: self.err = err fn advance(inout self, n: Int) -> Bool: """Consumes n bytes of the buffer. It reports whether the advance was legal. Args: n: The number of bytes to advance the buffer by. Returns: True if the advance was legal, False otherwise. """ if n < 0: self.set_err(Error(str(ERR_NEGATIVE_ADVANCE))) return False if n > self.end - self.start: self.set_err(Error(str(ERR_ADVANCE_TOO_FAR))) return False self.start += n return True fn buffer(inout self, buf: List[Byte], max: Int) raises: """Sets the initial buffer to use when scanning and the maximum size of buffer that may be allocated during scanning. The maximum token size must be less than the larger of max and cap(buf). If max <= cap(buf), [Scanner.Scan] will use this buffer only and do no allocation. By default, [Scanner.Scan] uses an Internal buffer and sets the maximum token size to [MAX_SCAN_TOKEN_SIZE]. buffer raises an Error if it is called after scanning has started. Args: buf: The buffer to use when scanning. max: The maximum size of buffer that may be allocated during scanning. Raises: Error: If called after scanning has started. """ if self.scan_called: raise Error("buffer called after Scan") # self.buf = buf[0:buf.capacity()] self.max_token_size = max # # split sets the split function for the [Scanner]. # # The default split function is [scan_lines]. # # # # split panics if it is called after scanning has started. # fn split(inout self, split_function: SplitFunction) raises: # if self.scan_called: # raise Error("split called after Scan") # self.split = split_function # SplitFunction is the signature of the split function used to tokenize the # input. The arguments are an initial substring of the remaining unprocessed # data and a flag, at_eof, that reports whether the [Reader] has no more data # to give. The return values are the number of bytes to advance the input # and the next token to return to the user, if any, plus an error, if any. # # Scanning stops if the function returns an error, in which case some of # the input may be discarded. If that error is [ERR_FINAL_TOKEN], scanning # stops with no error. A non-nil token delivered with [ERR_FINAL_TOKEN] # will be the last token, and a nil token with [ERR_FINAL_TOKEN] # immediately stops the scanning. # # Otherwise, the [Scanner] advances the input. If the token is not nil, # the [Scanner] returns it to the user. If the token is nil, the # Scanner reads more data and continues scanning; if there is no more # data--if at_eof was True--the [Scanner] returns. If the data does not # yet hold a complete token, for instance if it has no newline while # scanning lines, a [SplitFunction] can return (0, nil, nil) to signal the # [Scanner] to read more data Into the slice and try again with a # longer slice starting at the same poInt in the input. # # The function is never called with an empty data slice unless at_eof # is True. If at_eof is True, however, data may be non-empty and, # as always, holds unprocessed text. alias SplitFunction = fn (data: List[Byte], at_eof: Bool) -> (Int, List[Byte], Error) # # Errors returned by Scanner. alias ERR_TOO_LONG = Error("bufio.Scanner: token too long") alias ERR_NEGATIVE_ADVANCE = Error("bufio.Scanner: SplitFunction returns negative advance count") alias ERR_ADVANCE_TOO_FAR = Error("bufio.Scanner: SplitFunction returns advance count beyond input") alias ERR_BAD_READ_COUNT = Error("bufio.Scanner: Read returned impossible count") # ERR_FINAL_TOKEN is a special sentinel error value. It is Intended to be # returned by a split function to indicate that the scanning should stop # with no error. If the token being delivered with this error is not nil, # the token is the last token. # # The value is useful to stop processing early or when it is necessary to # deliver a final empty token (which is different from a nil token). # One could achieve the same behavior with a custom error value but # providing one here is tidier. # See the emptyFinalToken example for a use of this value. alias ERR_FINAL_TOKEN = Error("final token") # MAX_SCAN_TOKEN_SIZE is the maximum size used to buffer a token # unless the user provides an explicit buffer with [Scanner.buffer]. # The actual maximum token size may be smaller as the buffer # may need to include, for instance, a newline. alias MAX_SCAN_TOKEN_SIZE = 64 * 1024 alias START_BUF_SIZE = 8200 # Size of initial allocation for buffer. fn new_scanner[R: io.Reader](owned reader: R) -> Scanner[R]: """Returns a new [Scanner] to read from r. The split function defaults to [scan_lines].""" return Scanner(reader^) ###### split functions ###### fn scan_bytes(data: List[Byte], at_eof: Bool) -> (Int, List[Byte], Error): """Split function for a [Scanner] that returns each byte as a token.""" if at_eof and data.capacity == 0: return 0, List[Byte](), Error() return 1, data[0:1], Error() # var errorRune = List[Byte](string(utf8.RuneError)) # # ScanRunes is a split function for a [Scanner] that returns each # # UTF-8-encoded rune as a token. The sequence of runes returned is # # equivalent to that from a range loop over the input as a string, which # # means that erroneous UTF-8 encodings translate to U+FFFD = "\xef\xbf\xbd". # # Because of the Scan Interface, this makes it impossible for the client to # # distinguish correctly encoded replacement runes from encoding errors. # fn ScanRunes(data List[Byte], at_eof Bool) (advance Int, token List[Byte], err error): # if at_eof and data.capacity == 0: # return 0, nil, nil # # Fast path 1: ASCII. # if data[0] < utf8.RuneSelf: # return 1, data[0:1], nil # # Fast path 2: Correct UTF-8 decode without error. # _, width := utf8.DecodeRune(data) # if width > 1: # # It's a valid encoding. Width cannot be one for a correctly encoded # # non-ASCII rune. # return width, data[0:width], nil # # We know it's an error: we have width==1 and implicitly r==utf8.RuneError. # # Is the error because there wasn't a full rune to be decoded? # # FullRune distinguishes correctly between erroneous and incomplete encodings. # if !at_eof and !utf8.FullRune(data): # # Incomplete; get more bytes. # return 0, nil, nil # # We have a real UTF-8 encoding error. Return a properly encoded error rune # # but advance only one byte. This matches the behavior of a range loop over # # an incorrectly encoded string. # return 1, errorRune, nil fn drop_carriage_return(data: List[Byte]) -> List[Byte]: """Drops a terminal \r from the data. Args: data: The data to strip. Returns: The stripped data. """ # In the case of a \r ending without a \n, indexing on -1 doesn't work as it finds a null terminator instead of \r. if data.capacity > 0 and data[data.capacity - 1] == ord("\r"): return data[0 : data.capacity - 1] return data # TODO: Doing modification of token and err in these split functions, so we don't have to return any memory only types as part of the return tuple. fn scan_lines(data: List[Byte], at_eof: Bool) -> (Int, List[Byte], Error): """Split function for a [Scanner] that returns each line of text, stripped of any trailing end-of-line marker. The returned line may be empty. The end-of-line marker is one optional carriage return followed by one mandatory newline. The last non-empty line of input will be returned even if it has no newline. Args: data: The data to split. at_eof: Whether the data is at the end of the file. Returns: The number of bytes to advance the input. """ if at_eof and data.capacity == 0: return 0, List[Byte](), Error() var i = index_byte(data, ord("\n")) if i >= 0: # We have a full newline-terminated line. return i + 1, drop_carriage_return(data[0:i]), Error() # If we're at EOF, we have a final, non-terminated line. Return it. # if at_eof: return data.capacity, drop_carriage_return(data), Error() # Request more data. # return 0 fn is_space(r: UInt8) -> Bool: alias ALL_WHITESPACES: String = " \t\n\r\x0b\f" if chr(int(r)) in ALL_WHITESPACES: return True return False # TODO: Handle runes and utf8 decoding. For now, just assuming single byte length. fn scan_words(data: List[Byte], at_eof: Bool) -> (Int, List[Byte], Error): """Split function for a [Scanner] that returns each space-separated word of text, with surrounding spaces deleted. It will never return an empty string. The definition of space is set by unicode.IsSpace. """ # Skip leading spaces. var start = 0 var width = 0 while start < data.capacity: width = len(data[0]) if not is_space(data[0]): break start += width # Scan until space, marking end of word. var i = 0 width = 0 start = 0 while i < data.capacity: width = len(data[i]) if is_space(data[i]): return i + width, data[start:i], Error() i += width # If we're at EOF, we have a final, non-empty, non-terminated word. Return it. if at_eof and data.capacity > start: return data.capacity, data[start:], Error() # Request more data. return start, List[Byte](), Error() --- external/gojo/builtins/__init__.mojo --- from .bytes import Byte, index_byte, has_suffix, has_prefix, to_string from .list import equals from .attributes import cap, copy from .errors import exit, panic alias Rune = Int32 --- external/gojo/builtins/attributes.mojo --- fn copy[T: CollectionElement](inout target: List[T], source: List[T], start: Int = 0) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: target: The buffer to copy into. source: The buffer to copy from. start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(len(source)): if i + start > len(target): target[i + start] = source[i] else: target.append(source[i]) count += 1 return count fn copy[T: CollectionElement](inout target: Span[T, True], source: Span[T], start: Int = 0) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: target: The buffer to copy into. source: The buffer to copy from. start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(len(source)): target[i + start] = source[i] count += 1 return count fn cap[T: CollectionElement](iterable: List[T]) -> Int: """Returns the capacity of the List. Args: iterable: The List to get the capacity of. """ return iterable.capacity --- external/gojo/builtins/bytes.mojo --- alias Byte = UInt8 fn has_prefix(bytes: List[Byte], prefix: List[Byte]) -> Bool: """Reports whether the List[Byte] struct begins with prefix. Args: bytes: The List[Byte] struct to search. prefix: The prefix to search for. Returns: True if the List[Byte] struct begins with prefix; otherwise, False. """ var len_comparison = len(bytes) >= len(prefix) var prefix_comparison = equals(bytes[0 : len(prefix)], prefix) return len_comparison and prefix_comparison fn has_suffix(bytes: List[Byte], suffix: List[Byte]) -> Bool: """Reports whether the List[Byte] struct ends with suffix. Args: bytes: The List[Byte] struct to search. suffix: The prefix to search for. Returns: True if the List[Byte] struct ends with suffix; otherwise, False. """ var len_comparison = len(bytes) >= len(suffix) var suffix_comparison = equals(bytes[len(bytes) - len(suffix) : len(bytes)], suffix) return len_comparison and suffix_comparison fn index_byte(bytes: List[Byte], delim: Byte) -> Int: """Return the index of the first occurrence of the byte delim. Args: bytes: The List[Byte] struct to search. delim: The byte to search for. Returns: The index of the first occurrence of the byte delim. """ for i in range(len(bytes)): if bytes[i] == delim: return i return -1 fn to_string(bytes: List[Byte]) -> String: """Makes a deepcopy of the List[Byte] supplied and converts it to a string. If it's not null terminated, it will append a null byte. Args: bytes: The List[Byte] struct to convert. Returns: The string representation of the List[Byte] struct. """ var copy = List[Byte](bytes) if copy[-1] != 0: copy.append(0) return String(copy) --- external/gojo/builtins/errors.mojo --- from sys import exit fn panic[T: Stringable](message: T, code: Int = 1): """Panics the program with the given message and exit code. Args: message: The message to panic with. code: The exit code to panic with. """ print("panic:", message) exit(code) --- external/gojo/bytes/__init__.mojo --- from .buffer import Buffer, new_buffer from .reader import Reader, new_reader --- external/gojo/bytes/buffer.mojo --- import ..io from ..builtins import cap, copy, Byte, panic, index_byte alias Rune = Int32 # SMALL_BUFFER_SIZE is an initial allocation minimal capacity. alias SMALL_BUFFER_SIZE: Int = 64 # The ReadOp constants describe the last action performed on # the buffer, so that unread_rune and unread_byte can check for # invalid usage. op_read_runeX constants are chosen such that # converted to Int they correspond to the rune size that was read. alias ReadOp = Int8 # Don't use iota for these, as the values need to correspond with the # names and comments, which is easier to see when being explicit. alias OP_READ: ReadOp = -1 # Any other read operation. alias OP_INVALID: ReadOp = 0 # Non-read operation. alias OP_READ_RUNE1: ReadOp = 1 # read rune of size 1. alias OP_READ_RUNE2: ReadOp = 2 # read rune of size 2. alias OP_READ_RUNE3: ReadOp = 3 # read rune of size 3. alias OP_READ_RUNE4: ReadOp = 4 # read rune of size 4. alias MAX_INT: Int = 2147483647 # MIN_READ is the minimum slice size passed to a read call by # [Buffer.read_from]. As long as the [Buffer] has at least MIN_READ bytes beyond # what is required to hold the contents of r, read_from will not grow the # underlying buffer. alias MIN_READ: Int = 512 # ERR_TOO_LARGE is passed to panic if memory cannot be allocated to store data in a buffer. alias ERR_TOO_LARGE = "buffer.Buffer: too large" alias ERR_NEGATIVE_READ = "buffer.Buffer: reader returned negative count from read" alias ERR_SHORT_WRITE = "short write" # TODO: Removed read_from and write_to for now. Until the span arg trait issue is resolved. # https://github.com/modularml/mojo/issues/2917 @value struct Buffer( Copyable, Stringable, Sized, io.ReadWriter, io.StringWriter, io.ByteReader, io.ByteWriter, # WriterTo, # ReaderFrom, ): """A Buffer is a variable-sized buffer of bytes with [Buffer.read] and [Buffer.write] methods. The zero value for Buffer is an empty buffer ready to use. """ var buf: List[Byte] # contents are the bytes buf[off : len(buf)] var off: Int # read at &buf[off], write at &buf[len(buf)] var last_read: ReadOp # last read operation, so that unread* can work correctly. fn __init__(inout self, owned buf: List[Byte]): self.buf = buf self.off = 0 self.last_read = OP_INVALID fn bytes(self) -> List[Byte]: """Returns a slice of length self.buf.capacity holding the unread portion of the buffer. The slice is valid for use only until the next buffer modification (that is, only until the next call to a method like [Buffer.read], [Buffer.write], [Buffer.reset], or [Buffer.truncate]). The slice aliases the buffer content at least until the next buffer modification, so immediate changes to the slice will affect the result of future reads. """ return self.buf[self.off : len(self.buf)] # fn available_buffer(self) raises -> List[Byte]: # """Returns an empty buffer with self.Available() capacity. # This buffer is intended to be appended to and # passed to an immediately succeeding [Buffer.write] call. # The buffer is only valid until the next write operation on self. # """ # return self.buf[len(self.buf) :] fn __str__(self) -> String: """Returns the contents of the unread portion of the buffer as a string. If the [Buffer] is a nil pointer, it returns "<nil>". To build strings more efficiently, see the strings.Builder type. Creates a copy of the readable buffer and returns it as a string. """ var valid_bytes = self.buf[self.off : len(self.buf)] valid_bytes.append(0) return String(valid_bytes) fn empty(self) -> Bool: """Reports whether the unread portion of the buffer is empty.""" return len(self.buf) <= self.off fn __len__(self) -> Int: """Returns the number of bytes of the unread portion of the buffer; self.buf.capacity == len(self.List[Byte]()).""" return len(self.buf) - self.off fn cap(self) -> Int: """Cap returns the capacity of the buffer's underlying byte slice, that is, the total space allocated for the buffer's data.""" return cap(self.buf) fn available(self) -> Int: """Returns how many bytes are unused in the buffer.""" return self.buf.capacity - len(self.buf) fn truncate(inout self, position: Int) raises: """Discards all but the first n unread bytes from the buffer but continues to use the same allocated storage. It panics if position is negative or greater than the length of the buffer. Args: position: The position to truncate the buffer to. """ if position == 0: self.reset() return self.last_read = OP_INVALID if position < 0 or position > self.buf.capacity: raise Error("buffer.Buffer: truncation out of range") self.buf = self.buf[: self.off + position] fn reset(inout self): """Resets the buffer to be empty, but it retains the underlying storage for use by future writes. reset is the same as [buffer.truncate](0).""" self.buf = List[Byte](capacity=self.buf.capacity) self.off = 0 self.last_read = OP_INVALID fn try_grow_by_reslice(inout self, n: Int) -> (Int, Bool): """Inlineable version of grow for the fast-case where the internal buffer only needs to be resliced. It returns the index where bytes should be written and whether it succeeded.""" var buffer_already_used = len(self.buf) if n <= self.buf.capacity - buffer_already_used: # FIXME: It seems like reslicing in go can extend the length of the slice. Doens't work like that for my get slice impl. # Instead, just add bytes of len(n) to the end of the buffer for now. # self.buf = self.buf[: l + n] self.buf.reserve(self.buf.capacity + n) return buffer_already_used, True return 0, False fn grow(inout self, n: Int) -> Int: """Grows the buffer to guarantee space for n more bytes. It returns the index where bytes should be written. If the buffer can't grow it will panic with ERR_TOO_LARGE.""" var write_at: Int = len(self.buf) # If buffer is empty, reset to recover space. if write_at == 0 and self.off != 0: self.reset() # Try to grow by means of a reslice. var i: Int var ok: Bool i, ok = self.try_grow_by_reslice(n) if ok: return i # If buffer length is 0 and elements being added is less than small_buffer_size, resize the buffer and write from the beginning. if self.buf.capacity == 0 and n <= SMALL_BUFFER_SIZE: self.buf.reserve(SMALL_BUFFER_SIZE) return 0 var c = cap(self.buf) if Float64(n) <= c / 2 - write_at: # We can slide things down instead of allocating a new # slice. We only need m+n <= c to slide, but # we instead var capacity get twice as large so we # don't spend all our time copying. _ = copy(self.buf, self.buf[self.off :]) elif c > MAX_INT - c - n: panic(ERR_TOO_LARGE) # TODO: Commented out this branch because growing the slice here and then at the end is redundant? # else: # # Add self.off to account for self.buf[:self.off] being sliced off the front. # # var sl = self.buf[self.off :] # # self.buf = self.grow_slice(sl, self.off + n) # Restore self.off and len(self.buf). self.off = 0 # FIXME: It seems like reslicing in go can extend the length of the slice. Doens't work like that for my get slice impl. # Instead, just add bytes of len(n) to the end of the buffer for now. # self.buf = self.buf[: m + n] self.buf.reserve(self.buf.capacity + n) return write_at fn Grow(inout self, n: Int): """Grows the buffer's capacity, if necessary, to guarantee space for another n bytes. After grow(n), at least n bytes can be written to the buffer without another allocation. If n is negative, grow will panic. If the buffer can't grow it will panic with [ERR_TOO_LARGE]. """ if n < 0: panic("buffer.Buffer.Grow: negative count") var m = self.grow(n) self.buf = self.buf[:m] fn write(inout self, src: Span[Byte]) -> (Int, Error): """Appends the contents of p to the buffer, growing the buffer as needed. The return value n is the length of p; err is always nil. If the buffer becomes too large, write will panic with [ERR_TOO_LARGE]. Args: src: The bytes to write to the buffer. Returns: The number of bytes written to the buffer. """ self.last_read = OP_INVALID var write_at: Int var ok: Bool write_at, ok = self.try_grow_by_reslice(len(src)) if not ok: write_at = self.grow(len(src)) var bytes_written = copy(self.buf, src, write_at) return bytes_written, Error() fn write_string(inout self, src: String) -> (Int, Error): """Appends the contents of s to the buffer, growing the buffer as needed. The return value n is the length of s; err is always nil. If the buffer becomes too large, write_string will panic with [ERR_TOO_LARGE]. Args: src: The bytes to write to the buffer. Returns: The number of bytes written to the buffer. """ # self.last_read = OP_INVALID # var write_at: Int # var ok: Bool # write_at, ok = self.try_grow_by_reslice(len(src)) # if not ok: # m = self.grow(len(src)) # var b = self.buf[m:] return self.write(src.as_bytes_slice()) # fn read_from[R: Reader](inout self, inout reader: R) -> (Int64, Error): # """Reads data from r until EOF and appends it to the buffer, growing # the buffer as needed. The return value n is the number of bytes read. Any # error except io.EOF encountered during the read is also returned. If the # buffer becomes too large, read_from will panic with [ERR_TOO_LARGE]. # Args: # reader: The reader to read from. # Returns: # The number of bytes read from the reader. # """ # self.last_read = OP_INVALID # var total_bytes_read: Int64 = 0 # while True: # _ = self.grow(MIN_READ) # var span = Span(self.buf) # var bytes_read: Int # var err: Error # bytes_read, err = reader.read(span) # if bytes_read < 0: # panic(ERR_NEGATIVE_READ) # total_bytes_read += bytes_read # var err_message = str(err) # if err_message != "": # if err_message == io.EOF: # return total_bytes_read, Error() # return total_bytes_read, err fn grow_slice(self, inout b: List[Byte], n: Int) -> List[Byte]: """Grows b by n, preserving the original content of self. If the allocation fails, it panics with ERR_TOO_LARGE. """ # TODO(http:#golang.org/issue/51462): We should rely on the append-make # pattern so that the compiler can call runtime.growslice. For example: # return append(b, make(bytes, n)...) # This avoids unnecessary zero-ing of the first b.capacity bytes of the # allocated slice, but this pattern causes b to escape onto the heap. # # Instead use the append-make pattern with a nil slice to ensure that # we allocate buffers rounded up to the closest size class. var c = b.capacity + n # ensure enough space for n elements if c < 2 * cap(b): # The growth rate has historically always been 2x. In the future, # we could rely purely on append to determine the growth rate. c = 2 * cap(b) var resized_buffer = List[Byte](capacity=c) _ = copy(resized_buffer, b) # var b2: List[Byte] = List[Byte]() # b2._vector.reserve(c) # # var b2 = append(bytes(nil), make(bytes, c)...) # _ = copy(b2, b) # return b2[:b.capacity] # b._vector.reserve(c) return resized_buffer[: b.capacity] # fn write_to[W: Writer](inout self, inout writer: W) -> (Int64, Error): # """Writes data to w until the buffer is drained or an error occurs. # The return value n is the number of bytes written; it always fits into an # Int, but it is int64 to match the io.WriterTo trait. Any error # encountered during the write is also returned. # Args: # writer: The writer to write to. # Returns: # The number of bytes written to the writer. # """ # self.last_read = OP_INVALID # var bytes_to_write = len(self.buf) # var total_bytes_written: Int64 = 0 # if bytes_to_write > 0: # # TODO: Replace usage of this intermeidate slice when normal slicing, once slice references work. # var sl = Span(self.buf[self.off : bytes_to_write]) # var bytes_written: Int # var err: Error # bytes_written, err = writer.write(sl) # if bytes_written > bytes_to_write: # panic("bytes.Buffer.write_to: invalid write count") # self.off += bytes_written # total_bytes_written = Int64(bytes_written) # var err_message = str(err) # if err_message != "": # return total_bytes_written, err # # all bytes should have been written, by definition of write method in io.Writer # if bytes_written != bytes_to_write: # return total_bytes_written, Error(ERR_SHORT_WRITE) # # Buffer is now empty; reset. # self.reset() # return total_bytes_written, Error() fn write_byte(inout self, byte: Byte) -> (Int, Error): """Appends the byte c to the buffer, growing the buffer as needed. The returned error is always nil, but is included to match [bufio.Writer]'s write_byte. If the buffer becomes too large, write_byte will panic with [ERR_TOO_LARGE]. Args: byte: The byte to write to the buffer. Returns: The number of bytes written to the buffer. """ self.last_read = OP_INVALID var write_at: Int var ok: Bool write_at, ok = self.try_grow_by_reslice(1) if not ok: write_at = self.grow(1) _ = copy(self.buf, List[Byte](byte), write_at) return write_at, Error() # fn write_rune(inout self, r: Rune) -> Int: # """Appends the UTF-8 encoding of Unicode code point r to the # buffer, returning its length and an error, which is always nil but is # included to match [bufio.Writer]'s write_rune. The buffer is grown as needed; # if it becomes too large, write_rune will panic with [ERR_TOO_LARGE]. # """ # # Compare as uint32 to correctly handle negative runes. # if UInt32(r) < utf8.RuneSelf: # self.write_byte(Byte(r)) # return 1 # self.last_read = OP_INVALID # var write_at: Int # var ok: Bool # write_at, ok = self.try_grow_by_reslice(utf8.UTFMax) # if not ok: # write_at = self.grow(utf8.UTFMax) # self.buf = utf8.AppendRune(self.buf[:write_at], r) # return len(self.buf) - write_at fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Reads the next len(dest) bytes from the buffer or until the buffer is drained. The return value n is the number of bytes read. If the buffer has no data to return, err is io.EOF (unless len(dest) is zero); otherwise it is nil. Args: dest: The buffer to read into. Returns: The number of bytes read from the buffer. """ self.last_read = OP_INVALID if self.empty(): # Buffer is empty, reset to recover space. self.reset() if dest.capacity == 0: return 0, Error() return 0, Error(io.EOF) var bytes_read = copy(dest, self.buf[self.off : len(self.buf)]) self.off += bytes_read if bytes_read > 0: self.last_read = OP_READ return bytes_read, Error() fn next(inout self, number_of_bytes: Int) raises -> List[Byte]: """Returns a slice containing the next n bytes from the buffer, advancing the buffer as if the bytes had been returned by [Buffer.read]. If there are fewer than n bytes in the buffer, next returns the entire buffer. The slice is only valid until the next call to a read or write method. Args: number_of_bytes: The number of bytes to read from the buffer. Returns: A slice containing the next n bytes from the buffer. """ self.last_read = OP_INVALID var m = len(self) var bytes_to_read = number_of_bytes if bytes_to_read > m: bytes_to_read = m var data = self.buf[self.off : self.off + bytes_to_read] self.off += bytes_to_read if bytes_to_read > 0: self.last_read = OP_READ return data fn read_byte(inout self) -> (Byte, Error): """Reads and returns the next byte from the buffer. If no byte is available, it returns error io.EOF. """ if self.empty(): # Buffer is empty, reset to recover space. self.reset() return Byte(0), Error(io.EOF) var byte = self.buf[self.off] self.off += 1 self.last_read = OP_READ return byte, Error() # read_rune reads and returns the next UTF-8-encoded # Unicode code point from the buffer. # If no bytes are available, the error returned is io.EOF. # If the bytes are an erroneous UTF-8 encoding, it # consumes one byte and returns U+FFFD, 1. # fn read_rune(self) (r rune, size Int, err error) # if self.empty() # # Buffer is empty, reset to recover space. # self.reset() # return 0, 0, io.EOF # # c := self.buf[self.off] # if c < utf8.RuneSelf # self.off+= 1 # self.last_read = OP_READ_RUNE1 # return rune(c), 1, nil # # r, n := utf8.DecodeRune(self.buf[self.off:]) # self.off += n # self.last_read = ReadOp(n) # return r, n, nil # # unread_rune unreads the last rune returned by [Buffer.read_rune]. # If the most recent read or write operation on the buffer was # not a successful [Buffer.read_rune], unread_rune returns an error. (In this regard # it is stricter than [Buffer.unread_byte], which will unread the last byte # from any read operation.) # fn unread_rune(self): # if self.last_read <= OP_INVALID # return errors.New("buffer.Buffer: unread_rune: previous operation was not a successful read_rune") # # if self.off >= Int(self.last_read) # self.off -= Int(self.last_read) # # self.last_read = OP_INVALID # return nil # var err_unread_byte = errors.New("buffer.Buffer: unread_byte: previous operation was not a successful read") fn unread_byte(inout self) -> Error: """Unreads the last byte returned by the most recent successful read operation that read at least one byte. If a write has happened since the last read, if the last read returned an error, or if the read read zero bytes, unread_byte returns an error. """ if self.last_read == OP_INVALID: return Error("buffer.Buffer: unread_byte: previous operation was not a successful read") self.last_read = OP_INVALID if self.off > 0: self.off -= 1 return Error() fn read_bytes(inout self, delim: Byte) -> (List[Byte], Error): """Reads until the first occurrence of delim in the input, returning a slice containing the data up to and including the delimiter. If read_bytes encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). read_bytes returns err != nil if and only if the returned data does not end in delim. Args: delim: The delimiter to read until. Returns: A List[Byte] struct containing the data up to and including the delimiter. """ var slice: List[Byte] var err: Error slice, err = self.read_slice(delim) # return a copy of slice. The buffer's backing array may # be overwritten by later calls. var line = List[Byte](capacity=io.BUFFER_SIZE) for i in range(len(slice)): line.append(slice[i]) return line, Error() fn read_slice(inout self, delim: Byte) -> (List[Byte], Error): """Like read_bytes but returns a reference to internal buffer data. Args: delim: The delimiter to read until. Returns: A List[Byte] struct containing the data up to and including the delimiter. """ var at_eof = False var i = index_byte(self.buf[self.off : len(self.buf)], delim) var end = self.off + i + 1 if i < 0: end = len(self.buf) at_eof = True var line = self.buf[self.off : end] self.off = end self.last_read = OP_READ if at_eof: return line, Error(io.EOF) return line, Error() fn read_string(inout self, delim: Byte) -> (String, Error): """Reads until the first occurrence of delim in the input, returning a string containing the data up to and including the delimiter. If read_string encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). read_string returns err != nil if and only if the returned data does not end in delim. Args: delim: The delimiter to read until. Returns: A string containing the data up to and including the delimiter. """ var slice: List[Byte] var err: Error slice, err = self.read_slice(delim) slice.append(0) return String(slice), err fn new_buffer() -> Buffer: """Creates and initializes a new [Buffer] using buf as its` initial contents. The new [Buffer] takes ownership of buf, and the caller should not use buf after this call. new_buffer is intended to prepare a [Buffer] to read existing data. It can also be used to set the initial size of the internal buffer for writing. To do that, buf should have the desired capacity but a length of zero. In most cases, new([Buffer]) (or just declaring a [Buffer] variable) is sufficient to initialize a [Buffer]. """ var b = List[Byte](capacity=io.BUFFER_SIZE) return Buffer(b^) fn new_buffer(owned buf: List[Byte]) -> Buffer: """Creates and initializes a new [Buffer] using buf as its` initial contents. The new [Buffer] takes ownership of buf, and the caller should not use buf after this call. new_buffer is intended to prepare a [Buffer] to read existing data. It can also be used to set the initial size of the internal buffer for writing. To do that, buf should have the desired capacity but a length of zero. In most cases, new([Buffer]) (or just declaring a [Buffer] variable) is sufficient to initialize a [Buffer]. Args: buf: The bytes to use as the initial contents of the buffer. Returns: A new [Buffer] initialized with the provided bytes. """ return Buffer(buf^) fn new_buffer(owned s: String) -> Buffer: """Creates and initializes a new [Buffer] using string s as its initial contents. It is intended to prepare a buffer to read an existing string. In most cases, new([Buffer]) (or just declaring a [Buffer] variable) is sufficient to initialize a [Buffer]. Args: s: The string to use as the initial contents of the buffer. Returns: A new [Buffer] initialized with the provided string. """ var bytes_buffer = List[Byte](s.as_bytes()) return Buffer(bytes_buffer^) --- external/gojo/bytes/reader.mojo --- from collections.optional import Optional from ..builtins import cap, copy, Byte, panic import ..io @value struct Reader( Copyable, Sized, io.Reader, io.ReaderAt, # io.WriterTo, io.Seeker, io.ByteReader, io.ByteScanner, ): """A Reader implements the io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, io.ByteScanner, and io.RuneScanner Interfaces by reading from a byte slice. Unlike a [Buffer], a Reader is read-only and supports seeking. The zero value for Reader operates like a Reader of an empty slice. """ var buffer: List[Byte] var index: Int64 # current reading index var prev_rune: Int # index of previous rune; or < 0 fn __len__(self) -> Int: """len returns the number of bytes of the unread portion of the slice.""" if self.index >= len(self.buffer): return 0 return int(len(self.buffer) - self.index) fn size(self) -> Int: """Returns the original length of the underlying byte slice. Size is the number of bytes available for reading via [Reader.ReadAt]. The result is unaffected by any method calls except [Reader.Reset].""" return len(self.buffer) fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Reads from the internal buffer into the dest List[Byte] struct. Implements the [io.Reader] Interface. Args: dest: The destination List[Byte] struct to read into. Returns: Int: The number of bytes read into dest.""" if self.index >= len(self.buffer): return 0, Error(io.EOF) self.prev_rune = -1 var unread_bytes = self.buffer[int(self.index) : len(self.buffer)] var bytes_read = copy(dest, unread_bytes) self.index += bytes_read return bytes_read, Error() fn read_at(self, inout dest: List[Byte], off: Int64) -> (Int, Error): """Reads len(dest) bytes into dest beginning at byte offset off. Implements the [io.ReaderAt] Interface. Args: dest: The destination List[Byte] struct to read into. off: The offset to start reading from. Returns: Int: The number of bytes read into dest. """ # cannot modify state - see io.ReaderAt if off < 0: return 0, Error("bytes.Reader.read_at: negative offset") if off >= Int64(len(self.buffer)): return 0, Error(io.EOF) var unread_bytes = self.buffer[int(off) : len(self.buffer)] var bytes_written = copy(dest, unread_bytes) if bytes_written < len(dest): return 0, Error(io.EOF) return bytes_written, Error() fn read_byte(inout self) -> (Byte, Error): """Reads and returns a single byte from the internal buffer. Implements the [io.ByteReader] Interface.""" self.prev_rune = -1 if self.index >= len(self.buffer): return UInt8(0), Error(io.EOF) var byte = self.buffer[int(self.index)] self.index += 1 return byte, Error() fn unread_byte(inout self) -> Error: """Unreads the last byte read by moving the read position back by one. Complements [Reader.read_byte] in implementing the [io.ByteScanner] Interface. """ if self.index <= 0: return Error("bytes.Reader.unread_byte: at beginning of slice") self.prev_rune = -1 self.index -= 1 return Error() # # read_rune implements the [io.RuneReader] Interface. # fn read_rune(self) (ch rune, size Int, err error): # if self.index >= Int64(len(self.buffer)): # self.prev_rune = -1 # return 0, 0, io.EOF # self.prev_rune = Int(self.index) # if c := self.buffer[self.index]; c < utf8.RuneSelf: # self.index+= 1 # return rune(c), 1, nil # ch, size = utf8.DecodeRune(self.buffer[self.index:]) # self.index += Int64(size) # return # # unread_rune complements [Reader.read_rune] in implementing the [io.RuneScanner] Interface. # fn unread_rune(self) error: # if self.index <= 0: # return errors.New("bytes.Reader.unread_rune: at beginning of slice") # if self.prev_rune < 0: # return errors.New("bytes.Reader.unread_rune: previous operation was not read_rune") # self.index = Int64(self.prev_rune) # self.prev_rune = -1 # return nil fn seek(inout self, offset: Int64, whence: Int) -> (Int64, Error): """Moves the read position to the specified offset from the specified whence. Implements the [io.Seeker] Interface. Args: offset: The offset to move to. whence: The reference point for offset. Returns: The new position in which the next read will start from. """ self.prev_rune = -1 var position: Int64 = 0 if whence == io.SEEK_START: position = offset elif whence == io.SEEK_CURRENT: position = self.index + offset elif whence == io.SEEK_END: position = len(self.buffer) + offset else: return Int64(0), Error("bytes.Reader.seek: invalid whence") if position < 0: return Int64(0), Error("bytes.Reader.seek: negative position") self.index = position return position, Error() # fn write_to[W: io.Writer](inout self, inout writer: W) -> (Int64, Error): # """Writes data to w until the buffer is drained or an error occurs. # implements the [io.WriterTo] Interface. # Args: # writer: The writer to write to. # """ # self.prev_rune = -1 # if self.index >= len(self.buffer): # return Int64(0), Error() # var bytes = Span(self.buffer[int(self.index) : len(self.buffer)]) # var write_count: Int # var err: Error # write_count, err = writer.write(bytes) # if write_count > len(bytes): # panic("bytes.Reader.write_to: invalid Write count") # self.index += write_count # if write_count != len(bytes): # return Int64(write_count), Error(io.ERR_SHORT_WRITE) # return Int64(write_count), Error() fn reset(inout self, buffer: List[Byte]): """Resets the [Reader.Reader] to be reading from b. Args: buffer: The new buffer to read from. """ self.buffer = buffer self.index = 0 self.prev_rune = -1 fn new_reader(buffer: List[Byte]) -> Reader: """Returns a new [Reader.Reader] reading from b. Args: buffer: The new buffer to read from. """ return Reader(buffer, 0, -1) fn new_reader(buffer: String) -> Reader: """Returns a new [Reader.Reader] reading from b. Args: buffer: The new buffer to read from. """ return Reader(buffer.as_bytes(), 0, -1) --- external/gojo/fmt/__init__.mojo --- from .fmt import sprintf, printf, sprintf_str --- external/gojo/fmt/fmt.mojo --- """Formatting options General %v the value in a default format when printing structs, the plus flag (%+v) adds field names Boolean %t the word true or false Integer %d base 10 %q a single-quoted character literal. %x base 16, with lower-case letters for a-f %X base 16, with upper-case letters for A-F Floating-point and complex constituents: %f decimal point but no exponent, e.g. 123.456 String and slice of bytes (treated equivalently with these verbs): %s the uninterpreted bytes of the string or slice %q a double-quoted string TODO: - Add support for more formatting options - Switch to buffered writing to avoid multiple string concatenations - Add support for width and precision formatting options - Handle escaping for String's %q """ from utils.variant import Variant from math import floor from ..builtins import Byte alias Args = Variant[String, Int, Float64, Bool, List[Byte]] fn replace_first(s: String, old: String, new: String) -> String: """Replace the first occurrence of a substring in a string. Args: s: The original string old: The substring to be replaced new: The new substring Returns: The string with the first occurrence of the old substring replaced by the new one. """ # Find the first occurrence of the old substring var index = s.find(old) # If the old substring is found, replace it if index != -1: return s[:index] + new + s[index + len(old) :] # If the old substring is not found, return the original string return s fn find_first_verb(s: String, verbs: List[String]) -> String: """Find the first occurrence of a verb in a string. Args: s: The original string verbs: The list of verbs to search for. Returns: The verb to replace. """ var index = -1 var verb: String = "" for v in verbs: var i = s.find(v[]) if i != -1 and (index == -1 or i < index): index = i verb = v[] return verb alias BASE10_TO_BASE16 = List[String]("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f") fn convert_base10_to_base16(value: Int) -> String: """Converts a base 10 number to base 16. Args: value: Base 10 number. Returns: Base 16 number as a String. """ var val: Float64 = 0.0 var result: Float64 = value var base16: String = "" while result > 1: var temp = result / 16 var floor_result = floor(temp) var remainder = temp - floor_result result = floor_result val = 16 * remainder base16 = BASE10_TO_BASE16[int(val)] + base16 return base16 fn format_string(format: String, arg: String) -> String: var verb = find_first_verb(format, List[String]("%s", "%q")) var arg_to_place = arg if verb == "%q": arg_to_place = '"' + arg + '"' return replace_first(format, String("%s"), arg) fn format_bytes(format: String, arg: List[Byte]) -> String: var argument = arg if argument[-1] != 0: argument.append(0) return format_string(format, argument) fn format_integer(format: String, arg: Int) -> String: var verb = find_first_verb(format, List[String]("%x", "%X", "%d", "%q")) var arg_to_place = str(arg) if verb == "%x": arg_to_place = str(convert_base10_to_base16(arg)).lower() elif verb == "%X": arg_to_place = str(convert_base10_to_base16(arg)).upper() elif verb == "%q": arg_to_place = "'" + str(arg) + "'" return replace_first(format, verb, arg_to_place) fn format_float(format: String, arg: Float64) -> String: return replace_first(format, str("%f"), str(arg)) fn format_boolean(format: String, arg: Bool) -> String: var value: String = "False" if arg: value = "True" return replace_first(format, String("%t"), value) # If the number of arguments does not match the number of format specifiers alias BadArgCount = "(BAD ARG COUNT)" fn sprintf(formatting: String, *args: Args) -> String: var text = formatting var raw_percent_count = formatting.count("%%") * 2 var formatter_count = formatting.count("%") - raw_percent_count if formatter_count != len(args): return BadArgCount for i in range(len(args)): var argument = args[i] if argument.isa[String](): text = format_string(text, argument[String]) elif argument.isa[List[Byte]](): text = format_bytes(text, argument[List[Byte]]) elif argument.isa[Int](): text = format_integer(text, argument[Int]) elif argument.isa[Float64](): text = format_float(text, argument[Float64]) elif argument.isa[Bool](): text = format_boolean(text, argument[Bool]) return text # TODO: temporary until we have arg packing. fn sprintf_str(formatting: String, args: List[String]) raises -> String: var text = formatting var formatter_count = formatting.count("%") if formatter_count > len(args): raise Error("Not enough arguments for format string") elif formatter_count < len(args): raise Error("Too many arguments for format string") for i in range(len(args)): text = format_string(text, args[i]) return text fn printf(formatting: String, *args: Args) raises: var text = formatting var raw_percent_count = formatting.count("%%") * 2 var formatter_count = formatting.count("%") - raw_percent_count if formatter_count > len(args): raise Error("Not enough arguments for format string") elif formatter_count < len(args): raise Error("Too many arguments for format string") for i in range(len(args)): var argument = args[i] if argument.isa[String](): text = format_string(text, argument[String]) elif argument.isa[List[Byte]](): text = format_bytes(text, argument[List[Byte]]) elif argument.isa[Int](): text = format_integer(text, argument[Int]) elif argument.isa[Float64](): text = format_float(text, argument[Float64]) elif argument.isa[Bool](): text = format_boolean(text, argument[Bool]) else: raise Error("Unknown for argument #" + str(i)) print(text) --- external/gojo/io/__init__.mojo --- from .traits import ( Reader, Writer, Seeker, Closer, ReadWriter, ReadCloser, WriteCloser, ReadWriteCloser, ReadSeeker, ReadSeekCloser, WriteSeeker, ReadWriteSeeker, ReaderFrom, WriterReadFrom, WriterTo, ReaderWriteTo, ReaderAt, WriterAt, ByteReader, ByteScanner, ByteWriter, RuneReader, RuneScanner, StringWriter, SEEK_START, SEEK_CURRENT, SEEK_END, ERR_SHORT_WRITE, ERR_NO_PROGRESS, ERR_SHORT_BUFFER, EOF, ) from .io import write_string, read_at_least, read_full, read_all, BUFFER_SIZE alias i1 = __mlir_type.i1 alias i1_1 = __mlir_attr.`1: i1` alias i1_0 = __mlir_attr.`0: i1` --- external/gojo/io/io.mojo --- from collections.optional import Optional from ..builtins import cap, copy, Byte, panic from .traits import ERR_UNEXPECTED_EOF alias BUFFER_SIZE = 8200 fn write_string[W: Writer](inout writer: W, string: String) -> (Int, Error): """Writes the contents of the string s to w, which accepts a slice of bytes. If w implements [StringWriter], [StringWriter.write_string] is invoked directly. Otherwise, [Writer.write] is called exactly once. Args: writer: The writer to write to. string: The string to write. Returns: The number of bytes written and an error, if any. """ return writer.write(string.as_bytes_slice()) fn write_string[W: StringWriter](inout writer: W, string: String) -> (Int, Error): """Writes the contents of the string s to w, which accepts a slice of bytes. If w implements [StringWriter], [StringWriter.write_string] is invoked directly. Otherwise, [Writer.write] is called exactly once. Args: writer: The writer to write to. string: The string to write. Returns: The number of bytes written and an error, if any.""" return writer.write_string(string) fn read_at_least[R: Reader](inout reader: R, inout dest: List[Byte], min: Int) -> (Int, Error): """Reads from r into buf until it has read at least min bytes. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading fewer than min bytes, read_at_least returns [ERR_UNEXPECTED_EOF]. If min is greater than the length of buf, read_at_least returns [ERR_SHORT_BUFFER]. On return, n >= min if and only if err == nil. If r returns an error having read at least min bytes, the error is dropped. Args: reader: The reader to read from. dest: The buffer to read into. min: The minimum number of bytes to read. Returns: The number of bytes read.""" var error = Error() if len(dest) < min: return 0, Error(io.ERR_SHORT_BUFFER) var total_bytes_read: Int = 0 while total_bytes_read < min and not error: var bytes_read: Int bytes_read, error = reader.read(dest) total_bytes_read += bytes_read if total_bytes_read >= min: error = Error() elif total_bytes_read > 0 and str(error): error = Error(ERR_UNEXPECTED_EOF) return total_bytes_read, error fn read_full[R: Reader](inout reader: R, inout dest: List[Byte]) -> (Int, Error): """Reads exactly len(buf) bytes from r into buf. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading some but not all the bytes, read_full returns [ERR_UNEXPECTED_EOF]. On return, n == len(buf) if and only if err == nil. If r returns an error having read at least len(buf) bytes, the error is dropped. """ return read_at_least(reader, dest, len(dest)) # fn copy_n[W: Writer, R: Reader](dst: W, src: R, n: Int64) raises -> Int64: # """Copies n bytes (or until an error) from src to dst. # It returns the number of bytes copied and the earliest # error encountered while copying. # On return, written == n if and only if err == nil. # If dst implements [ReaderFrom], the copy is implemented using it. # """ # var written = copy(dst, LimitReader(src, n)) # if written == n: # return n # if written < n: # # src stopped early; must have been EOF. # raise Error(ERR_UNEXPECTED_EOF) # return written # fn copy[W: Writer, R: Reader](dst: W, src: R, n: Int64) -> Int64: # """copy copies from src to dst until either EOF is reached # on src or an error occurs. It returns the number of bytes # copied and the first error encountered while copying, if any. # A successful copy returns err == nil, not err == EOF. # Because copy is defined to read from src until EOF, it does # not treat an EOF from Read as an error to be reported. # If src implements [WriterTo], # the copy is implemented by calling src.WriteTo(dst). # Otherwise, if dst implements [ReaderFrom], # the copy is implemented by calling dst.ReadFrom(src). # """ # return copy_buffer(dst, src, nil) # # CopyBuffer is identical to copy except that it stages through the # # provided buffer (if one is required) rather than allocating a # # temporary one. If buf is nil, one is allocated; otherwise if it has # # zero length, CopyBuffer panics. # # # # If either src implements [WriterTo] or dst implements [ReaderFrom], # # buf will not be used to perform the copy. # fn CopyBuffer(dst Writer, src Reader, buf bytes) (written int64, err error) { # if buf != nil and len(buf) == 0 { # panic("empty buffer in CopyBuffer") # } # return copy_buffer(dst, src, buf) # } # fn copy_buffer[W: Writer, R: Reader](dst: W, src: R, buf: Span[Byte]) raises -> Int64: # """Actual implementation of copy and CopyBuffer. # if buf is nil, one is allocated. # """ # var nr: Int # nr = src.read(buf) # while True: # if nr > 0: # var nw: Int # nw = dst.write(get_slice(buf, 0, nr)) # if nw < 0 or nr < nw: # nw = 0 # var written = Int64(nw) # if nr != nw: # raise Error(ERR_SHORT_WRITE) # return written # fn copy_buffer[W: Writer, R: ReaderWriteTo](dst: W, src: R, buf: Span[Byte]) -> Int64: # return src.write_to(dst) # fn copy_buffer[W: WriterReadFrom, R: Reader](dst: W, src: R, buf: Span[Byte]) -> Int64: # return dst.read_from(src) # # LimitReader returns a Reader that reads from r # # but stops with EOF after n bytes. # # The underlying implementation is a *LimitedReader. # fn LimitReader(r Reader, n int64) Reader { return &LimitedReader{r, n} } # # A LimitedReader reads from R but limits the amount of # # data returned to just N bytes. Each call to Read # # updates N to reflect the new amount remaining. # # Read returns EOF when N <= 0 or when the underlying R returns EOF. # struct LimitedReader(): # var R: Reader # underlying reader # N int64 # max bytes remaining # fn (l *LimitedReader) Read(p bytes) (n Int, err error) { # if l.N <= 0 { # return 0, EOF # } # if int64(len(p)) > l.N { # p = p[0:l.N] # } # n, err = l.R.Read(p) # l.N -= int64(n) # return # } # # NewSectionReader returns a [SectionReader] that reads from r # # starting at offset off and stops with EOF after n bytes. # fn NewSectionReader(r ReaderAt, off int64, n int64) *SectionReader { # var remaining int64 # const maxint64 = 1<<63 - 1 # if off <= maxint64-n { # remaining = n + off # } else { # # Overflow, with no way to return error. # # Assume we can read up to an offset of 1<<63 - 1. # remaining = maxint64 # } # return &SectionReader{r, off, off, remaining, n} # } # # SectionReader implements Read, Seek, and ReadAt on a section # # of an underlying [ReaderAt]. # type SectionReader struct { # r ReaderAt # constant after creation # base int64 # constant after creation # off int64 # limit int64 # constant after creation # n int64 # constant after creation # } # fn (s *SectionReader) Read(p bytes) (n Int, err error) { # if s.off >= s.limit { # return 0, EOF # } # if max := s.limit - s.off; int64(len(p)) > max { # p = p[0:max] # } # n, err = s.r.ReadAt(p, s.off) # s.off += int64(n) # return # } # alias errWhence = "Seek: invalid whence" # alias errOffset = "Seek: invalid offset" # fn (s *SectionReader) Seek(offset int64, whence Int) (int64, error) { # switch whence { # default: # return 0, errWhence # case SEEK_START: # offset += s.base # case SEEK_CURRENT: # offset += s.off # case SEEK_END: # offset += s.limit # } # if offset < s.base { # return 0, errOffset # } # s.off = offset # return offset - s.base, nil # } # fn (s *SectionReader) ReadAt(p bytes, off int64) (n Int, err error) { # if off < 0 or off >= s.capacity { # return 0, EOF # } # off += s.base # if max := s.limit - off; int64(len(p)) > max { # p = p[0:max] # n, err = s.r.ReadAt(p, off) # if err == nil { # err = EOF # } # return n, err # } # return s.r.ReadAt(p, off) # } # # Size returns the size of the section in bytes. # fn (s *SectionReader) Size() int64 { return s.limit - s.base } # # Outer returns the underlying [ReaderAt] and offsets for the section. # # # # The returned values are the same that were passed to [NewSectionReader] # # when the [SectionReader] was created. # fn (s *SectionReader) Outer() (r ReaderAt, off int64, n int64) { # return s.r, s.base, s.n # } # # An OffsetWriter maps writes at offset base to offset base+off in the underlying writer. # type OffsetWriter struct { # w WriterAt # base int64 # the original offset # off int64 # the current offset # } # # NewOffsetWriter returns an [OffsetWriter] that writes to w # # starting at offset off. # fn NewOffsetWriter(w WriterAt, off int64) *OffsetWriter { # return &OffsetWriter{w, off, off} # } # fn (o *OffsetWriter) Write(p bytes) (n Int, err error) { # n, err = o.w.WriteAt(p, o.off) # o.off += int64(n) # return # } # fn (o *OffsetWriter) WriteAt(p bytes, off int64) (n Int, err error) { # if off < 0 { # return 0, errOffset # } # off += o.base # return o.w.WriteAt(p, off) # } # fn (o *OffsetWriter) Seek(offset int64, whence Int) (int64, error) { # switch whence { # default: # return 0, errWhence # case SEEK_START: # offset += o.base # case SEEK_CURRENT: # offset += o.off # } # if offset < o.base { # return 0, errOffset # } # o.off = offset # return offset - o.base, nil # } # # TeeReader returns a [Reader] that writes to w what it reads from r. # # All reads from r performed through it are matched with # # corresponding writes to w. There is no internal buffering - # # the write must complete before the read completes. # # Any error encountered while writing is reported as a read error. # fn TeeReader(r Reader, w Writer) Reader { # return &teeReader{r, w} # } # type teeReader struct { # r Reader # w Writer # } # fn (t *teeReader) Read(p bytes) (n Int, err error) { # n, err = t.r.Read(p) # if n > 0 { # if n, err := t.w.Write(p[:n]); err != nil { # return n, err # } # } # return # } # # Discard is a [Writer] on which all Write calls succeed # # without doing anything. # var Discard Writer = discard{} # type discard struct{} # # discard implements ReaderFrom as an optimization so copy to # # io.Discard can avoid doing unnecessary work. # var _ ReaderFrom = discard{} # fn (discard) Write(p bytes) (Int, error) { # return len(p), nil # } # fn (discard) write_string(s string) (Int, error) { # return len(s), nil # } # var blackHolePool = sync.Pool{ # New: fn() any { # b := make(bytes, 8192) # return &b # }, # } # fn (discard) ReadFrom(r Reader) (n int64, err error) { # bufp := blackHolePool.Get().(*bytes) # readSize := 0 # for { # readSize, err = r.Read(*bufp) # n += int64(readSize) # if err != nil { # blackHolePool.Put(bufp) # if err == EOF { # return n, nil # } # return # } # } # } # # NopCloser returns a [ReadCloser] with a no-op Close method wrapping # # the provided [Reader] r. # # If r implements [WriterTo], the returned [ReadCloser] will implement [WriterTo] # # by forwarding calls to r. # fn NopCloser(r Reader) ReadCloser { # if _, ok := r.(WriterTo); ok { # return nopCloserWriterTo{r} # } # return nopCloser{r} # } # type nopCloser struct { # Reader # } # fn (nopCloser) Close() error { return nil } # type nopCloserWriterTo struct { # Reader # } # fn (nopCloserWriterTo) Close() error { return nil } # fn (c nopCloserWriterTo) WriteTo(w Writer) (n int64, err error) { # return c.Reader.(WriterTo).WriteTo(w) # } fn read_all[R: Reader](inout reader: R) -> (List[Byte], Error): """Reads from r until an error or EOF and returns the data it read. A successful call returns err == nil, not err == EOF. Because ReadAll is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported. Args: reader: The reader to read from. Returns: The data read.""" var dest = List[Byte](capacity=BUFFER_SIZE) var at_eof: Bool = False while True: var temp = List[Byte](capacity=BUFFER_SIZE) var bytes_read: Int var err: Error bytes_read, err = reader.read(temp) var err_message = str(err) if err_message != "": if err_message != EOF: return dest, err at_eof = True # If new bytes will overflow the result, resize it. # if some bytes were written, how do I append before returning result on the last one? if len(dest) + len(temp) > dest.capacity: dest.reserve(dest.capacity * 2) dest.extend(temp) if at_eof: return dest, err --- external/gojo/io/traits.mojo --- from collections.optional import Optional from ..builtins import Byte alias Rune = Int32 # Package io provides basic interfaces to I/O primitives. # Its primary job is to wrap existing implementations of such primitives, # such as those in package os, into shared public interfaces that # abstract the fntionality, plus some other related primitives. # # Because these interfaces and primitives wrap lower-level operations with # various implementations, unless otherwise informed clients should not # assume they are safe for parallel execution. # Seek whence values. alias SEEK_START = 0 # seek relative to the origin of the file alias SEEK_CURRENT = 1 # seek relative to the current offset alias SEEK_END = 2 # seek relative to the end # ERR_SHORT_WRITE means that a write accepted fewer bytes than requested # but failed to return an explicit error. alias ERR_SHORT_WRITE = "short write" # ERR_INVALID_WRITE means that a write returned an impossible count. alias ERR_INVALID_WRITE = "invalid write result" # ERR_SHORT_BUFFER means that a read required a longer buffer than was provided. alias ERR_SHORT_BUFFER = "short buffer" # EOF is the error returned by Read when no more input is available. # (Read must return EOF itself, not an error wrapping EOF, # because callers will test for EOF using ==.) # fntions should return EOF only to signal a graceful end of input. # If the EOF occurs unexpectedly in a structured data stream, # the appropriate error is either [ERR_UNEXPECTED_EOF] or some other error # giving more detail. alias EOF = "EOF" # ERR_UNEXPECTED_EOF means that EOF was encountered in the # middle of reading a fixed-size block or data structure. alias ERR_UNEXPECTED_EOF = "unexpected EOF" # ERR_NO_PROGRESS is returned by some clients of a [Reader] when # many calls to Read have failed to return any data or error, # usually the sign of a broken [Reader] implementation. alias ERR_NO_PROGRESS = "multiple Read calls return no data or error" trait Reader(Movable): """Reader is the trait that wraps the basic Read method. Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting for more. When Read encounters an error or end-of-file condition after successfully reading n > 0 bytes, it returns the number of bytes read. It may return the (non-nil) error from the same call or return the error (and n == 0) from a subsequent call. An instance of this general case is that a Reader returning a non-zero number of bytes at the end of the input stream may return either err == EOF or err == nil. The next Read should return 0, EOF. Callers should always process the n > 0 bytes returned before considering the error err. Doing so correctly handles I/O errors that happen after reading some bytes and also both of the allowed EOF behaviors. If len(p) == 0, Read should always return n == 0. It may return a non-nil error if some error condition is known, such as EOF. Implementations of Read are discouraged from returning a zero byte count with a nil error, except when len(p) == 0. Callers should treat a return of 0 and nil as indicating that nothing happened; in particular it does not indicate EOF. Implementations must not retain p.""" fn read(inout self, inout dest: List[Byte]) -> (Int, Error): ... trait Writer(Movable): """Writer is the trait that wraps the basic Write method. Write writes len(p) bytes from p to the underlying data stream. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. Write must return a non-nil error if it returns n < len(p). Write must not modify the slice data, even temporarily. Implementations must not retain p. """ fn write(inout self, src: Span[Byte]) -> (Int, Error): ... trait Closer(Movable): """ Closer is the trait that wraps the basic Close method. The behavior of Close after the first call is undefined. Specific implementations may document their own behavior. """ fn close(inout self) -> Error: ... trait Seeker(Movable): """ Seeker is the trait that wraps the basic Seek method. Seek sets the offset for the next Read or Write to offset, interpreted according to whence: [SEEK_START] means relative to the start of the file, [SEEK_CURRENT] means relative to the current offset, and [SEEK_END] means relative to the end (for example, offset = -2 specifies the penultimate byte of the file). Seek returns the new offset relative to the start of the file or an error, if any. Seeking to an offset before the start of the file is an error. Seeking to any positive offset may be allowed, but if the new offset exceeds the size of the underlying object the behavior of subsequent I/O operations is implementation-dependent. """ fn seek(inout self, offset: Int64, whence: Int) -> (Int64, Error): ... trait ReadWriter(Reader, Writer): ... trait ReadCloser(Reader, Closer): ... trait WriteCloser(Writer, Closer): ... trait ReadWriteCloser(Reader, Writer, Closer): ... trait ReadSeeker(Reader, Seeker): ... trait ReadSeekCloser(Reader, Seeker, Closer): ... trait WriteSeeker(Writer, Seeker): ... trait ReadWriteSeeker(Reader, Writer, Seeker): ... trait ReaderFrom: """ReaderFrom is the trait that wraps the ReadFrom method. ReadFrom reads data from r until EOF or error. The return value n is the number of bytes read. Any error except EOF encountered during the read is also returned. The [copy] function uses [ReaderFrom] if available.""" fn read_from[R: Reader](inout self, inout reader: R) -> (Int64, Error): ... trait WriterReadFrom(Writer, ReaderFrom): ... trait WriterTo: """WriterTo is the trait that wraps the WriteTo method. WriteTo writes data to w until there's no more data to write or when an error occurs. The return value n is the number of bytes written. Any error encountered during the write is also returned. The copy function uses WriterTo if available.""" fn write_to[W: Writer](inout self, inout writer: W) -> (Int64, Error): ... trait ReaderWriteTo(Reader, WriterTo): ... trait ReaderAt: """ReaderAt is the trait that wraps the basic ReadAt method. ReadAt reads len(p) bytes into p starting at offset off in the underlying input source. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. When ReadAt returns n < len(p), it returns a non-nil error explaining why more bytes were not returned. In this respect, ReadAt is stricter than Read. Even if ReadAt returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, ReadAt blocks until either all the data is available or an error occurs. In this respect ReadAt is different from Read. If the n = len(p) bytes returned by ReadAt are at the end of the input source, ReadAt may return either err == EOF or err == nil. If ReadAt is reading from an input source with a seek offset, ReadAt should not affect nor be affected by the underlying seek offset. Clients of ReadAt can execute parallel ReadAt calls on the same input source. Implementations must not retain p.""" fn read_at(self, inout dest: List[Byte], off: Int64) -> (Int, Error): ... trait WriterAt: """WriterAt is the trait that wraps the basic WriteAt method. WriteAt writes len(p) bytes from p to the underlying data stream at offset off. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. WriteAt must return a non-nil error if it returns n < len(p). If WriteAt is writing to a destination with a seek offset, WriteAt should not affect nor be affected by the underlying seek offset. Clients of WriteAt can execute parallel WriteAt calls on the same destination if the ranges do not overlap. Implementations must not retain p.""" fn write_at(self, src: Span[Byte], off: Int64) -> (Int, Error): ... trait ByteReader: """ByteReader is the trait that wraps the read_byte method. read_byte reads and returns the next byte from the input or any error encountered. If read_byte returns an error, no input byte was consumed, and the returned byte value is undefined. read_byte provides an efficient trait for byte-at-time processing. A [Reader] that does not implement ByteReader can be wrapped using bufio.NewReader to add this method.""" fn read_byte(inout self) -> (Byte, Error): ... trait ByteScanner(ByteReader): """ByteScanner is the trait that adds the unread_byte method to the basic read_byte method. unread_byte causes the next call to read_byte to return the last byte read. If the last operation was not a successful call to read_byte, unread_byte may return an error, unread the last byte read (or the byte prior to the last-unread byte), or (in implementations that support the [Seeker] trait) seek to one byte before the current offset.""" fn unread_byte(inout self) -> Error: ... trait ByteWriter: """ByteWriter is the trait that wraps the write_byte method.""" fn write_byte(inout self, byte: Byte) -> (Int, Error): ... trait RuneReader: """RuneReader is the trait that wraps the read_rune method. read_rune reads a single encoded Unicode character and returns the rune and its size in bytes. If no character is available, err will be set.""" fn read_rune(inout self) -> (Rune, Int): ... trait RuneScanner(RuneReader): """RuneScanner is the trait that adds the unread_rune method to the basic read_rune method. unread_rune causes the next call to read_rune to return the last rune read. If the last operation was not a successful call to read_rune, unread_rune may return an error, unread the last rune read (or the rune prior to the last-unread rune), or (in implementations that support the [Seeker] trait) seek to the start of the rune before the current offset.""" fn unread_rune(inout self) -> Rune: ... trait StringWriter: """StringWriter is the trait that wraps the WriteString method.""" fn write_string(inout self, src: String) -> (Int, Error): ... --- external/gojo/net/__init__.mojo --- """Adapted from go's net package A good chunk of the leg work here came from the lightbug_http project! https://github.com/saviorand/lightbug_http/tree/main """ --- external/gojo/net/address.mojo --- @value struct NetworkType: var value: String alias empty = NetworkType("") alias tcp = NetworkType("tcp") alias tcp4 = NetworkType("tcp4") alias tcp6 = NetworkType("tcp6") alias udp = NetworkType("udp") alias udp4 = NetworkType("udp4") alias udp6 = NetworkType("udp6") alias ip = NetworkType("ip") alias ip4 = NetworkType("ip4") alias ip6 = NetworkType("ip6") alias unix = NetworkType("unix") trait Addr(CollectionElement, Stringable): fn network(self) -> String: """Name of the network (for example, "tcp", "udp").""" ... @value struct TCPAddr(Addr): """Addr struct representing a TCP address. Args: ip: IP address. port: Port number. zone: IPv6 addressing zone. """ var ip: String var port: Int var zone: String # IPv6 addressing zone fn __init__(inout self): self.ip = String("127.0.0.1") self.port = 8000 self.zone = "" fn __init__(inout self, ip: String, port: Int): self.ip = ip self.port = port self.zone = "" fn __str__(self) -> String: if self.zone != "": return join_host_port(str(self.ip) + "%" + self.zone, str(self.port)) return join_host_port(self.ip, str(self.port)) fn network(self) -> String: return NetworkType.tcp.value fn resolve_internet_addr(network: String, address: String) raises -> TCPAddr: var host: String = "" var port: String = "" var portnum: Int = 0 if ( network == NetworkType.tcp.value or network == NetworkType.tcp4.value or network == NetworkType.tcp6.value or network == NetworkType.udp.value or network == NetworkType.udp4.value or network == NetworkType.udp6.value ): if address != "": var host_port = split_host_port(address) host = host_port.host port = str(host_port.port) portnum = atol(port.__str__()) elif network == NetworkType.ip.value or network == NetworkType.ip4.value or network == NetworkType.ip6.value: if address != "": host = address elif network == NetworkType.unix.value: raise Error("Unix addresses not supported yet") else: raise Error("unsupported network type: " + network) return TCPAddr(host, portnum) alias missingPortError = Error("missing port in address") alias tooManyColonsError = Error("too many colons in address") struct HostPort(Stringable): var host: String var port: Int fn __init__(inout self, host: String, port: Int): self.host = host self.port = port fn __str__(self) -> String: return join_host_port(self.host, str(self.port)) fn join_host_port(host: String, port: String) -> String: if host.find(":") != -1: # must be IPv6 literal return "[" + host + "]:" + port return host + ":" + port fn split_host_port(hostport: String) raises -> HostPort: var host: String = "" var port: String = "" var colon_index = hostport.rfind(":") var j: Int = 0 var k: Int = 0 if colon_index == -1: raise missingPortError if hostport[0] == "[": var end_bracket_index = hostport.find("]") if end_bracket_index == -1: raise Error("missing ']' in address") if end_bracket_index + 1 == len(hostport): raise missingPortError elif end_bracket_index + 1 == colon_index: host = hostport[1:end_bracket_index] j = 1 k = end_bracket_index + 1 else: if hostport[end_bracket_index + 1] == ":": raise tooManyColonsError else: raise missingPortError else: host = hostport[:colon_index] if host.find(":") != -1: raise tooManyColonsError if hostport[j:].find("[") != -1: raise Error("unexpected '[' in address") if hostport[k:].find("]") != -1: raise Error("unexpected ']' in address") port = hostport[colon_index + 1 :] if port == "": raise missingPortError if host == "": raise Error("missing host") return HostPort(host, atol(port)) --- external/gojo/net/dial.mojo --- from .tcp import TCPAddr, TCPConnection, resolve_internet_addr from .socket import Socket from .address import split_host_port @value struct Dialer: var local_address: TCPAddr fn dial(self, network: String, address: String) raises -> TCPConnection: var tcp_addr = resolve_internet_addr(network, address) var socket = Socket(local_address=self.local_address) socket.connect(tcp_addr.ip, tcp_addr.port) return TCPConnection(socket^) fn dial_tcp(network: String, remote_address: TCPAddr) raises -> TCPConnection: """Connects to the address on the named network. The network must be "tcp", "tcp4", or "tcp6". Args: network: The network type. remote_address: The remote address to connect to. Returns: The TCP connection. """ # TODO: Add conversion of domain name to ip address return Dialer(remote_address).dial(network, remote_address.ip + ":" + str(remote_address.port)) fn dial_tcp(network: String, remote_address: String) raises -> TCPConnection: """Connects to the address on the named network. The network must be "tcp", "tcp4", or "tcp6". Args: network: The network type. remote_address: The remote address to connect to. Returns: The TCP connection. """ var address = split_host_port(remote_address) return Dialer(TCPAddr(address.host, address.port)).dial(network, remote_address) --- external/gojo/net/fd.mojo --- from collections.optional import Optional import ..io from ..builtins import Byte from ..syscall.file import close from ..syscall.types import c_char from ..syscall.net import ( recv, send, strlen, ) alias O_RDWR = 0o2 trait FileDescriptorBase(io.Reader, io.Writer, io.Closer): ... struct FileDescriptor(FileDescriptorBase): var fd: Int var is_closed: Bool # This takes ownership of a POSIX file descriptor. fn __moveinit__(inout self, owned existing: Self): self.fd = existing.fd self.is_closed = existing.is_closed fn __init__(inout self, fd: Int): self.fd = fd self.is_closed = False fn __del__(owned self): if not self.is_closed: var err = self.close() if err: print(str(err)) fn close(inout self) -> Error: """Mark the file descriptor as closed.""" var close_status = close(self.fd) if close_status == -1: return Error("FileDescriptor.close: Failed to close socket") self.is_closed = True return Error() fn dup(self) -> Self: """Duplicate the file descriptor.""" var new_fd = external_call["dup", Int, Int](self.fd) return Self(new_fd) # TODO: Need faster approach to copying data from the file descriptor to the buffer. fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Receive data from the file descriptor and write it to the buffer provided.""" var ptr = Pointer[UInt8]().alloc(dest.capacity) var bytes_received = recv(self.fd, ptr, dest.capacity, 0) if bytes_received == -1: return 0, Error("Failed to receive message from socket.") var int8_ptr = ptr.bitcast[Int8]() for i in range(bytes_received): dest.append(int8_ptr[i]) if bytes_received < dest.capacity: return bytes_received, Error(io.EOF) return bytes_received, Error() fn write(inout self, src: List[Byte]) -> (Int, Error): """Write data from the buffer to the file descriptor.""" var header_pointer = Pointer[Int8](src.data.address).bitcast[UInt8]() var bytes_sent = send(self.fd, header_pointer, strlen(header_pointer), 0) if bytes_sent == -1: return 0, Error("Failed to send message") return bytes_sent, Error() --- external/gojo/net/ip.mojo --- from utils.variant import Variant from utils.static_tuple import StaticTuple from sys.info import os_is_linux, os_is_macos from ..syscall.types import ( c_int, c_char, c_void, c_uint, ) from ..syscall.net import ( addrinfo, addrinfo_unix, AF_INET, SOCK_STREAM, AI_PASSIVE, sockaddr, sockaddr_in, htons, ntohs, inet_pton, inet_ntop, getaddrinfo, getaddrinfo_unix, gai_strerror, to_char_ptr, c_charptr_to_string, ) alias AddrInfo = Variant[addrinfo, addrinfo_unix] fn get_addr_info(host: String) raises -> AddrInfo: var status: Int32 = 0 if os_is_macos(): var servinfo = Pointer[addrinfo]().alloc(1) servinfo.store(addrinfo()) var hints = addrinfo() hints.ai_family = AF_INET hints.ai_socktype = SOCK_STREAM hints.ai_flags = AI_PASSIVE var host_ptr = to_char_ptr(host) var status = getaddrinfo( host_ptr, Pointer[UInt8](), Pointer.address_of(hints), Pointer.address_of(servinfo), ) if status != 0: print("getaddrinfo failed to execute with status:", status) var msg_ptr = gai_strerror(c_int(status)) _ = external_call["printf", c_int, Pointer[c_char], Pointer[c_char]]( to_char_ptr("gai_strerror: %s"), msg_ptr ) var msg = c_charptr_to_string(msg_ptr) print("getaddrinfo error message: ", msg) if not servinfo: print("servinfo is null") raise Error("Failed to get address info. Pointer to addrinfo is null.") return servinfo.load() elif os_is_linux(): var servinfo = Pointer[addrinfo_unix]().alloc(1) servinfo.store(addrinfo_unix()) var hints = addrinfo_unix() hints.ai_family = AF_INET hints.ai_socktype = SOCK_STREAM hints.ai_flags = AI_PASSIVE var host_ptr = to_char_ptr(host) var status = getaddrinfo_unix( host_ptr, Pointer[UInt8](), Pointer.address_of(hints), Pointer.address_of(servinfo), ) if status != 0: print("getaddrinfo failed to execute with status:", status) var msg_ptr = gai_strerror(c_int(status)) _ = external_call["printf", c_int, Pointer[c_char], Pointer[c_char]]( to_char_ptr("gai_strerror: %s"), msg_ptr ) var msg = c_charptr_to_string(msg_ptr) print("getaddrinfo error message: ", msg) if not servinfo: print("servinfo is null") raise Error("Failed to get address info. Pointer to addrinfo is null.") return servinfo.load() else: raise Error("Windows is not supported yet! Sorry!") fn get_ip_address(host: String) raises -> String: """Get the IP address of a host.""" # Call getaddrinfo to get the IP address of the host. var result = get_addr_info(host) var ai_addr: Pointer[sockaddr] var address_family: Int32 = 0 var address_length: UInt32 = 0 if result.isa[addrinfo](): var addrinfo = result[addrinfo] ai_addr = addrinfo.ai_addr address_family = addrinfo.ai_family address_length = addrinfo.ai_addrlen else: var addrinfo = result[addrinfo_unix] ai_addr = addrinfo.ai_addr address_family = addrinfo.ai_family address_length = addrinfo.ai_addrlen if not ai_addr: print("ai_addr is null") raise Error("Failed to get IP address. getaddrinfo was called successfully, but ai_addr is null.") # Cast sockaddr struct to sockaddr_in struct and convert the binary IP to a string using inet_ntop. var addr_in = ai_addr.bitcast[sockaddr_in]().load() return convert_binary_ip_to_string(addr_in.sin_addr.s_addr, address_family, address_length).strip() fn convert_port_to_binary(port: Int) -> UInt16: return htons(UInt16(port)) fn convert_binary_port_to_int(port: UInt16) -> Int: return int(ntohs(port)) fn convert_ip_to_binary(ip_address: String, address_family: Int) -> UInt32: var ip_buffer = Pointer[c_void].alloc(4) var status = inet_pton(address_family, to_char_ptr(ip_address), ip_buffer) if status == -1: print("Failed to convert IP address to binary") return ip_buffer.bitcast[c_uint]().load() fn convert_binary_ip_to_string(owned ip_address: UInt32, address_family: Int32, address_length: UInt32) -> String: """Convert a binary IP address to a string by calling inet_ntop. Args: ip_address: The binary IP address. address_family: The address family of the IP address. address_length: The length of the address. Returns: The IP address as a string. """ # It seems like the len of the buffer depends on the length of the string IP. # Allocating 10 works for localhost (127.0.0.1) which I suspect is 9 bytes + 1 null terminator byte. So max should be 16 (15 + 1). var ip_buffer = Pointer[c_void].alloc(16) var ip_address_ptr = Pointer.address_of(ip_address).bitcast[c_void]() _ = inet_ntop(address_family, ip_address_ptr, ip_buffer, 16) var string_buf = ip_buffer.bitcast[Int8]() var index = 0 while True: if string_buf[index] == 0: break index += 1 return StringRef(string_buf, index) fn build_sockaddr_pointer(ip_address: String, port: Int, address_family: Int) -> Pointer[sockaddr]: """Build a sockaddr pointer from an IP address and port number. https://learn.microsoft.com/en-us/windows/win32/winsock/sockaddr-2 https://learn.microsoft.com/en-us/windows/win32/api/ws2def/ns-ws2def-sockaddr_in. """ var bin_port = convert_port_to_binary(port) var bin_ip = convert_ip_to_binary(ip_address, address_family) var ai = sockaddr_in(address_family, bin_port, bin_ip, StaticTuple[c_char, 8]()) return Pointer[sockaddr_in].address_of(ai).bitcast[sockaddr]() --- external/gojo/net/net.mojo --- from memory.arc import Arc import ..io from ..builtins import Byte from .socket import Socket from .address import Addr, TCPAddr alias DEFAULT_BUFFER_SIZE = 8200 trait Conn(io.Writer, io.Reader, io.Closer): fn __init__(inout self, owned socket: Socket): ... """Conn is a generic stream-oriented network connection.""" fn local_address(self) -> TCPAddr: """Returns the local network address, if known.""" ... fn remote_address(self) -> TCPAddr: """Returns the local network address, if known.""" ... # fn set_deadline(self, t: time.Time) -> Error: # """Sets the read and write deadlines associated # with the connection. It is equivalent to calling both # SetReadDeadline and SetWriteDeadline. # A deadline is an absolute time after which I/O operations # fail instead of blocking. The deadline applies to all future # and pending I/O, not just the immediately following call to # read or write. After a deadline has been exceeded, the # connection can be refreshed by setting a deadline in the future. # If the deadline is exceeded a call to read or write or to other # I/O methods will return an error that wraps os.ErrDeadlineExceeded. # This can be tested using errors.Is(err, os.ErrDeadlineExceeded). # The error's Timeout method will return true, but note that there # are other possible errors for which the Timeout method will # return true even if the deadline has not been exceeded. # An idle timeout can be implemented by repeatedly extending # the deadline after successful read or write calls. # A zero value for t means I/O operations will not time out.""" # ... # fn set_read_deadline(self, t: time.Time) -> Error: # """Sets the deadline for future read calls # and any currently-blocked read call. # A zero value for t means read will not time out.""" # ... # fn set_write_deadline(self, t: time.Time) -> Error: # """Sets the deadline for future write calls # and any currently-blocked write call. # Even if write times out, it may return n > 0, indicating that # some of the data was successfully written. # A zero value for t means write will not time out.""" # ... @value struct Connection(Conn): """Connection is a concrete generic stream-oriented network connection. It is used as the internal connection for structs like TCPConnection. Args: fd: The file descriptor of the connection. """ var fd: Arc[Socket] fn __init__(inout self, owned socket: Socket): self.fd = Arc(socket^) fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Reads data from the underlying file descriptor. Args: dest: The buffer to read data into. Returns: The number of bytes read, or an error if one occurred. """ var bytes_written: Int = 0 var err = Error() bytes_written, err = self.fd[].read(dest) if err: if str(err) != io.EOF: return 0, err return bytes_written, err fn write(inout self, src: List[Byte]) -> (Int, Error): """Writes data to the underlying file descriptor. Args: src: The buffer to read data into. Returns: The number of bytes written, or an error if one occurred. """ var bytes_read: Int = 0 var err = Error() bytes_read, err = self.fd[].write(src) if err: return 0, err return bytes_read, err fn close(inout self) -> Error: """Closes the underlying file descriptor. Returns: An error if one occurred, or None if the file descriptor was closed successfully. """ return self.fd[].close() fn local_address(self) -> TCPAddr: """Returns the local network address. The Addr returned is shared by all invocations of local_address, so do not modify it. """ return self.fd[].local_address fn remote_address(self) -> TCPAddr: """Returns the remote network address. The Addr returned is shared by all invocations of remote_address, so do not modify it. """ return self.fd[].remote_address --- external/gojo/net/socket.mojo --- from collections.optional import Optional from ..builtins import Byte from ..syscall.file import close from ..syscall.types import ( c_void, c_uint, c_char, c_int, ) from ..syscall.net import ( sockaddr, sockaddr_in, addrinfo, addrinfo_unix, socklen_t, socket, connect, recv, send, shutdown, inet_pton, inet_ntoa, inet_ntop, to_char_ptr, htons, ntohs, strlen, getaddrinfo, getaddrinfo_unix, gai_strerror, c_charptr_to_string, bind, listen, accept, setsockopt, getsockopt, getsockname, getpeername, AF_INET, SOCK_STREAM, SHUT_RDWR, AI_PASSIVE, SOL_SOCKET, SO_REUSEADDR, SO_RCVTIMEO, ) from .fd import FileDescriptor, FileDescriptorBase from .ip import ( convert_binary_ip_to_string, build_sockaddr_pointer, convert_binary_port_to_int, ) from .address import Addr, TCPAddr, HostPort alias SocketClosedError = Error("Socket: Socket is already closed") struct Socket(FileDescriptorBase): """Represents a network file descriptor. Wraps around a file descriptor and provides network functions. Args: local_address: The local address of the socket (local address if bound). remote_address: The remote address of the socket (peer's address if connected). address_family: The address family of the socket. socket_type: The socket type. protocol: The protocol. """ var sockfd: FileDescriptor var address_family: Int var socket_type: UInt8 var protocol: UInt8 var local_address: TCPAddr var remote_address: TCPAddr var _closed: Bool var _is_connected: Bool fn __init__( inout self, local_address: TCPAddr = TCPAddr(), remote_address: TCPAddr = TCPAddr(), address_family: Int = AF_INET, socket_type: UInt8 = SOCK_STREAM, protocol: UInt8 = 0, ) raises: """Create a new socket object. Args: local_address: The local address of the socket (local address if bound). remote_address: The remote address of the socket (peer's address if connected). address_family: The address family of the socket. socket_type: The socket type. protocol: The protocol. """ self.address_family = address_family self.socket_type = socket_type self.protocol = protocol var fd = socket(address_family, SOCK_STREAM, 0) if fd == -1: raise Error("Socket creation error") self.sockfd = FileDescriptor(int(fd)) self.local_address = local_address self.remote_address = remote_address self._closed = False self._is_connected = False fn __init__( inout self, fd: Int32, address_family: Int, socket_type: UInt8, protocol: UInt8, local_address: TCPAddr = TCPAddr(), remote_address: TCPAddr = TCPAddr(), ): """ Create a new socket object when you already have a socket file descriptor. Typically through socket.accept(). Args: fd: The file descriptor of the socket. address_family: The address family of the socket. socket_type: The socket type. protocol: The protocol. local_address: Local address of socket. remote_address: Remote address of port. """ self.sockfd = FileDescriptor(int(fd)) self.address_family = address_family self.socket_type = socket_type self.protocol = protocol self.local_address = local_address self.remote_address = remote_address self._closed = False self._is_connected = True fn __moveinit__(inout self, owned existing: Self): self.sockfd = existing.sockfd^ self.address_family = existing.address_family self.socket_type = existing.socket_type self.protocol = existing.protocol self.local_address = existing.local_address^ self.remote_address = existing.remote_address^ self._closed = existing._closed self._is_connected = existing._is_connected # fn __enter__(self) -> Self: # return self # fn __exit__(inout self) raises: # if self._is_connected: # self.shutdown() # if not self._closed: # self.close() fn __del__(owned self): if self._is_connected: self.shutdown() if not self._closed: var err = self.close() _ = self.sockfd.fd if err: print("Failed to close socket during deletion:", str(err)) @always_inline fn accept(self) raises -> Self: """Accept a connection. The socket must be bound to an address and listening for connections. The return value is a connection where conn is a new socket object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ var their_addr_ptr = Pointer[sockaddr].alloc(1) var sin_size = socklen_t(sizeof[socklen_t]()) var new_sockfd = accept(self.sockfd.fd, their_addr_ptr, Pointer[socklen_t].address_of(sin_size)) if new_sockfd == -1: raise Error("Failed to accept connection") var remote = self.get_peer_name() return Self( new_sockfd, self.address_family, self.socket_type, self.protocol, self.local_address, TCPAddr(remote.host, remote.port), ) fn listen(self, backlog: Int = 0) raises: """Enable a server to accept connections. Args: backlog: The maximum number of queued connections. Should be at least 0, and the maximum is system-dependent (usually 5). """ var queued = backlog if backlog < 0: queued = 0 if listen(self.sockfd.fd, queued) == -1: raise Error("Failed to listen for connections") @always_inline fn bind(inout self, address: String, port: Int) raises: """Bind the socket to address. The socket must not already be bound. (The format of address depends on the address family). When a socket is created with Socket(), it exists in a name space (address family) but has no address assigned to it. bind() assigns the address specified by addr to the socket referred to by the file descriptor sockfd. addrlen specifies the size, in bytes, of the address structure pointed to by addr. Traditionally, this operation is called 'assigning a name to a socket'. Args: address: String - The IP address to bind the socket to. port: The port number to bind the socket to. """ var sockaddr_pointer = build_sockaddr_pointer(address, port, self.address_family) if bind(self.sockfd.fd, sockaddr_pointer, sizeof[sockaddr_in]()) == -1: _ = shutdown(self.sockfd.fd, SHUT_RDWR) raise Error("Binding socket failed. Wait a few seconds and try again?") var local = self.get_sock_name() self.local_address = TCPAddr(local.host, local.port) @always_inline fn file_no(self) -> Int32: """Return the file descriptor of the socket.""" return self.sockfd.fd @always_inline fn get_sock_name(self) raises -> HostPort: """Return the address of the socket.""" if self._closed: raise SocketClosedError # TODO: Add check to see if the socket is bound and error if not. var local_address_ptr = Pointer[sockaddr].alloc(1) var local_address_ptr_size = socklen_t(sizeof[sockaddr]()) var status = getsockname( self.sockfd.fd, local_address_ptr, Pointer[socklen_t].address_of(local_address_ptr_size), ) if status == -1: raise Error("Socket.get_sock_name: Failed to get address of local socket.") var addr_in = local_address_ptr.bitcast[sockaddr_in]().load() return HostPort( host=convert_binary_ip_to_string(addr_in.sin_addr.s_addr, AF_INET, 16), port=convert_binary_port_to_int(addr_in.sin_port), ) fn get_peer_name(self) raises -> HostPort: """Return the address of the peer connected to the socket.""" if self._closed: raise SocketClosedError # TODO: Add check to see if the socket is bound and error if not. var remote_address_ptr = Pointer[sockaddr].alloc(1) var remote_address_ptr_size = socklen_t(sizeof[sockaddr]()) var status = getpeername( self.sockfd.fd, remote_address_ptr, Pointer[socklen_t].address_of(remote_address_ptr_size), ) if status == -1: raise Error("Socket.get_peer_name: Failed to get address of remote socket.") # Cast sockaddr struct to sockaddr_in to convert binary IP to string. var addr_in = remote_address_ptr.bitcast[sockaddr_in]().load() return HostPort( host=convert_binary_ip_to_string(addr_in.sin_addr.s_addr, AF_INET, 16), port=convert_binary_port_to_int(addr_in.sin_port), ) fn get_socket_option(self, option_name: Int) raises -> Int: """Return the value of the given socket option. Args: option_name: The socket option to get. """ var option_value_pointer = Pointer[c_void].alloc(1) var option_len = socklen_t(sizeof[socklen_t]()) var option_len_pointer = Pointer.address_of(option_len) var status = getsockopt( self.sockfd.fd, SOL_SOCKET, option_name, option_value_pointer, option_len_pointer, ) if status == -1: raise Error("Socket.get_sock_opt failed with status: " + str(status)) return option_value_pointer.bitcast[Int]().load() fn set_socket_option(self, option_name: Int, owned option_value: UInt8 = 1) raises: """Return the value of the given socket option. Args: option_name: The socket option to set. option_value: The value to set the socket option to. """ var option_value_pointer = Pointer[c_void].address_of(option_value) var option_len = sizeof[socklen_t]() var status = setsockopt(self.sockfd.fd, SOL_SOCKET, option_name, option_value_pointer, option_len) if status == -1: raise Error("Socket.set_sock_opt failed with status: " + str(status)) fn connect(inout self, address: String, port: Int) raises: """Connect to a remote socket at address. Args: address: String - The IP address to connect to. port: The port number to connect to. """ var sockaddr_pointer = build_sockaddr_pointer(address, port, self.address_family) if connect(self.sockfd.fd, sockaddr_pointer, sizeof[sockaddr_in]()) == -1: self.shutdown() raise Error("Socket.connect: Failed to connect to the remote socket at: " + address + ":" + str(port)) var remote = self.get_peer_name() self.remote_address = TCPAddr(remote.host, remote.port) fn write(inout self: Self, src: List[Byte]) -> (Int, Error): """Send data to the socket. The socket must be connected to a remote socket. Args: src: The data to send. Returns: The number of bytes sent. """ var bytes_written: Int var err: Error bytes_written, err = self.sockfd.write(src) if err: return 0, err return bytes_written, Error() fn send_all(self, src: List[Byte], max_attempts: Int = 3) raises: """Send data to the socket. The socket must be connected to a remote socket. Args: src: The data to send. max_attempts: The maximum number of attempts to send the data. """ var header_pointer = src.unsafe_ptr() var total_bytes_sent = 0 var attempts = 0 # Try to send all the data in the buffer. If it did not send all the data, keep trying but start from the offset of the last successful send. while total_bytes_sent < len(src): if attempts > max_attempts: raise Error("Failed to send message after " + str(max_attempts) + " attempts.") var bytes_sent = send( self.sockfd.fd, header_pointer.offset(total_bytes_sent), strlen(header_pointer.offset(total_bytes_sent)), 0, ) if bytes_sent == -1: raise Error("Failed to send message, wrote" + String(total_bytes_sent) + "bytes before failing.") total_bytes_sent += bytes_sent attempts += 1 fn send_to(inout self, src: List[Byte], address: String, port: Int) raises -> Int: """Send data to the a remote address by connecting to the remote socket before sending. The socket must be not already be connected to a remote socket. Args: src: The data to send. address: The IP address to connect to. port: The port number to connect to. """ var header_pointer = Pointer[Int8](src.data.address).bitcast[UInt8]() self.connect(address, port) var bytes_written: Int var err: Error bytes_written, err = self.write(src) if err: raise err return bytes_written fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Receive data from the socket.""" # Not ideal since we can't use the pointer from the List[Byte] struct directly. So we use a temporary pointer to receive the data. # Then we copy all the data over. var bytes_written: Int var err: Error bytes_written, err = self.sockfd.read(dest) if err: if str(err) != "EOF": return 0, err return bytes_written, Error() fn shutdown(self): _ = shutdown(self.sockfd.fd, SHUT_RDWR) fn close(inout self) -> Error: """Mark the socket closed. Once that happens, all future operations on the socket object will fail. The remote end will receive no more data (after queued data is flushed). """ self.shutdown() var err = self.sockfd.close() if err: return err self._closed = True return Error() # TODO: Trying to set timeout fails, but some other options don't? # fn get_timeout(self) raises -> Seconds: # """Return the timeout value for the socket.""" # return self.get_socket_option(SO_RCVTIMEO) # fn set_timeout(self, owned duration: Seconds) raises: # """Set the timeout value for the socket. # Args: # duration: Seconds - The timeout duration in seconds. # """ # self.set_socket_option(SO_RCVTIMEO, duration) fn send_file(self, file: FileHandle, offset: Int = 0) raises: self.send_all(file.read_bytes()) --- external/gojo/net/tcp.mojo --- from ..builtins import Byte from ..syscall.net import SO_REUSEADDR from .net import Connection, Conn from .address import TCPAddr, NetworkType, split_host_port from .socket import Socket # Time in nanoseconds alias Duration = Int alias DEFAULT_BUFFER_SIZE = 8200 alias DEFAULT_TCP_KEEP_ALIVE = Duration(15 * 1000 * 1000 * 1000) # 15 seconds fn resolve_internet_addr(network: String, address: String) raises -> TCPAddr: var host: String = "" var port: String = "" var portnum: Int = 0 if ( network == NetworkType.tcp.value or network == NetworkType.tcp4.value or network == NetworkType.tcp6.value or network == NetworkType.udp.value or network == NetworkType.udp4.value or network == NetworkType.udp6.value ): if address != "": var host_port = split_host_port(address) host = host_port.host port = str(host_port.port) portnum = atol(port.__str__()) elif network == NetworkType.ip.value or network == NetworkType.ip4.value or network == NetworkType.ip6.value: if address != "": host = address elif network == NetworkType.unix.value: raise Error("Unix addresses not supported yet") else: raise Error("unsupported network type: " + network) return TCPAddr(host, portnum) # TODO: For now listener is paired with TCP until we need to support # more than one type of Connection or Listener @value struct ListenConfig(CollectionElement): var keep_alive: Duration fn listen(self, network: String, address: String) raises -> TCPListener: var tcp_addr = resolve_internet_addr(network, address) var socket = Socket(local_address=tcp_addr) socket.bind(tcp_addr.ip, tcp_addr.port) socket.set_socket_option(SO_REUSEADDR, 1) socket.listen() print(str("Listening on ") + str(socket.local_address)) return TCPListener(socket^, self, network, address) trait Listener(Movable): # Raising here because a Result[Optional[Connection], Error] is funky. fn accept(self) raises -> Connection: ... fn close(inout self) -> Error: ... fn addr(self) raises -> TCPAddr: ... @value struct TCPConnection(Conn): """TCPConn is an implementation of the Conn interface for TCP network connections. Args: connection: The underlying Connection. """ var _connection: Connection fn __init__(inout self, connection: Connection): self._connection = connection fn __init__(inout self, owned socket: Socket): self._connection = Connection(socket^) fn __moveinit__(inout self, owned existing: Self): self._connection = existing._connection^ fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Reads data from the underlying file descriptor. Args: dest: The buffer to read data into. Returns: The number of bytes read, or an error if one occurred. """ var bytes_written: Int var err: Error bytes_written, err = self._connection.read(dest) if err: if str(err) != io.EOF: return 0, err return bytes_written, Error() fn write(inout self, src: List[Byte]) -> (Int, Error): """Writes data to the underlying file descriptor. Args: src: The buffer to read data into. Returns: The number of bytes written, or an error if one occurred. """ var bytes_written: Int var err: Error bytes_written, err = self._connection.write(src) if err: return 0, err return bytes_written, Error() fn close(inout self) -> Error: """Closes the underlying file descriptor. Returns: An error if one occurred, or None if the file descriptor was closed successfully. """ return self._connection.close() fn local_address(self) -> TCPAddr: """Returns the local network address. The Addr returned is shared by all invocations of local_address, so do not modify it. Returns: The local network address. """ return self._connection.local_address() fn remote_address(self) -> TCPAddr: """Returns the remote network address. The Addr returned is shared by all invocations of remote_address, so do not modify it. Returns: The remote network address. """ return self._connection.remote_address() fn listen_tcp(network: String, local_address: TCPAddr) raises -> TCPListener: """Creates a new TCP listener. Args: network: The network type. local_address: The local address to listen on. """ return ListenConfig(DEFAULT_TCP_KEEP_ALIVE).listen(network, local_address.ip + ":" + str(local_address.port)) fn listen_tcp(network: String, local_address: String) raises -> TCPListener: """Creates a new TCP listener. Args: network: The network type. local_address: The address to listen on. The format is "host:port". """ return ListenConfig(DEFAULT_TCP_KEEP_ALIVE).listen(network, local_address) struct TCPListener(Listener): var _file_descriptor: Socket var listen_config: ListenConfig var network_type: String var address: String fn __init__( inout self, owned file_descriptor: Socket, listen_config: ListenConfig, network_type: String, address: String, ): self._file_descriptor = file_descriptor^ self.listen_config = listen_config self.network_type = network_type self.address = address fn __moveinit__(inout self, owned existing: Self): self._file_descriptor = existing._file_descriptor^ self.listen_config = existing.listen_config^ self.network_type = existing.network_type self.address = existing.address fn listen(self) raises -> Self: return self.listen_config.listen(self.network_type, self.address) fn accept(self) raises -> Connection: return Connection(self._file_descriptor.accept()) fn accept_tcp(self) raises -> TCPConnection: return TCPConnection(self._file_descriptor.accept()) fn close(inout self) -> Error: return self._file_descriptor.close() fn addr(self) raises -> TCPAddr: return resolve_internet_addr(self.network_type, self.address) --- external/gojo/strings/__init__.mojo --- from .builder import StringBuilder from .reader import Reader, new_reader --- external/gojo/strings/builder.mojo --- import ..io from ..builtins import Byte @value struct StringBuilder[growth_factor: Float32 = 2](Stringable, Sized, io.Writer, io.StringWriter): """ A string builder class that allows for efficient string management and concatenation. This class is useful when you need to build a string by appending multiple strings together. The performance increase is not linear. Compared to string concatenation, I've observed around 20-30x faster for writing and rending ~4KB and up to 2100x-2300x for ~4MB. This is because it avoids the overhead of creating and destroying many intermediate strings and performs memcopy operations. The result is a more efficient when building larger string concatenations. It is generally not recommended to use this class for small concatenations such as a few strings like `a + b + c + d` because the overhead of creating the string builder and appending the strings is not worth the performance gain. Example: ``` from strings.builder import StringBuilder var sb = StringBuilder() sb.write_string("Hello ") sb.write_string("World!") print(sb) # Hello World! ``` """ var data: DTypePointer[DType.uint8] var size: Int var capacity: Int @always_inline fn __init__(inout self, *, capacity: Int = 8200): constrained[growth_factor >= 1.25]() self.data = DTypePointer[DType.uint8]().alloc(capacity) self.size = 0 self.capacity = capacity @always_inline fn __del__(owned self): if self.data: self.data.free() @always_inline fn __len__(self) -> Int: """ Returns the length of the string builder. Returns: The length of the string builder. """ return self.size @always_inline fn __str__(self) -> String: """ Converts the string builder to a string. Returns: The string representation of the string builder. Returns an empty string if the string builder is empty. """ var copy = DTypePointer[DType.uint8]().alloc(self.size) memcpy(copy, self.data, self.size) return StringRef(copy, self.size) @always_inline fn render(self) -> StringSlice[is_mutable=False, lifetime=ImmutableStaticLifetime]: """ Return a StringSlice view of the data owned by the builder. Slightly faster than __str__, 10-20% faster in limited testing. Returns: The string representation of the string builder. Returns an empty string if the string builder is empty. """ return StringSlice[is_mutable=False, lifetime=ImmutableStaticLifetime](unsafe_from_utf8_strref=StringRef(self.data, self.size)) @always_inline fn _resize(inout self, capacity: Int) -> None: """ Resizes the string builder buffer. Args: capacity: The new capacity of the string builder buffer. """ var new_data = DTypePointer[DType.uint8]().alloc(capacity) memcpy(new_data, self.data, self.size) self.data.free() self.data = new_data self.capacity = capacity return None @always_inline fn write(inout self, src: Span[Byte]) -> (Int, Error): """ Appends a byte Span to the builder buffer. Args: src: The byte array to append. """ if len(src) > self.capacity - self.size: var new_capacity = int(self.capacity * growth_factor) if new_capacity < self.capacity + len(src): new_capacity = self.capacity + len(src) self._resize(new_capacity) memcpy(self.data.offset(self.size), src._data, len(src)) self.size += len(src) return len(src), Error() @always_inline fn write_string(inout self, src: String) -> (Int, Error): """ Appends a string to the builder buffer. Args: src: The string to append. """ return self.write(src.as_bytes_slice()) --- external/gojo/strings/reader.mojo --- import ..io from ..builtins import Byte, copy, panic @value struct Reader(Sized, io.Reader, io.ReaderAt, io.ByteReader, io.ByteScanner, io.Seeker, io.WriterTo): """A Reader that implements the [io.Reader], [io.ReaderAt], [io.ByteReader], [io.ByteScanner], [io.Seeker], and [io.WriterTo] traits by reading from a string. The zero value for Reader operates like a Reader of an empty string. """ var string: String var read_pos: Int64 # current reading index var prev_rune: Int # index of previous rune; or < 0 fn __init__(inout self, string: String = ""): self.string = string self.read_pos = 0 self.prev_rune = -1 fn __len__(self) -> Int: """Returns the number of bytes of the unread portion of the string. Returns: int: the number of bytes of the unread portion of the string. """ if self.read_pos >= Int64(len(self.string)): return 0 return int(Int64(len(self.string)) - self.read_pos) fn size(self) -> Int64: """Returns the original length of the underlying string. size is the number of bytes available for reading via [Reader.read_at]. The returned value is always the same and is not affected by calls to any other method. Returns: The original length of the underlying string. """ return Int64(len(self.string)) fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Reads from the underlying string into the provided List[Byte] object. Implements the [io.Reader] trait. Args: dest: The destination List[Byte] object to read into. Returns: The number of bytes read into dest. """ if self.read_pos >= Int64(len(self.string)): return 0, Error(io.EOF) self.prev_rune = -1 var bytes_written = copy(dest, self.string[int(self.read_pos) :].as_bytes()) self.read_pos += Int64(bytes_written) return bytes_written, Error() fn read_at(self, inout dest: List[Byte], off: Int64) -> (Int, Error): """Reads from the Reader into the dest List[Byte] starting at the offset off. It returns the number of bytes read into dest and an error if any. Implements the [io.ReaderAt] trait. Args: dest: The destination List[Byte] object to read into. off: The byte offset to start reading from. Returns: The number of bytes read into dest. """ # cannot modify state - see io.ReaderAt if off < 0: return 0, Error("strings.Reader.read_at: negative offset") if off >= Int64(len(self.string)): return 0, Error(io.EOF) var error = Error() var copied_elements_count = copy(dest, self.string[int(off) :].as_bytes()) if copied_elements_count < len(dest): error = Error(io.EOF) return copied_elements_count, Error() fn read_byte(inout self) -> (Byte, Error): """Reads the next byte from the underlying string. Implements the [io.ByteReader] trait. Returns: The next byte from the underlying string. """ self.prev_rune = -1 if self.read_pos >= Int64(len(self.string)): return Byte(0), Error(io.EOF) var b = self.string[int(self.read_pos)] self.read_pos += 1 return Byte(ord(b)), Error() fn unread_byte(inout self) -> Error: """Unreads the last byte read. Only the most recent byte read can be unread. Implements the [io.ByteScanner] trait. """ if self.read_pos <= 0: return Error("strings.Reader.unread_byte: at beginning of string") self.prev_rune = -1 self.read_pos -= 1 return Error() # # read_rune implements the [io.RuneReader] trait. # fn read_rune() (ch rune, size int, err error): # if self.read_pos >= Int64(len(self.string)): # self.prev_rune = -1 # return 0, 0, io.EOF # self.prev_rune = int(self.read_pos) # if c = self.string[self.read_pos]; c < utf8.RuneSelf: # self.read_pos += 1 # return rune(c), 1, nil # ch, size = utf8.DecodeRuneInString(self.string[self.read_pos:]) # self.read_pos += Int64(size) # return # # unread_rune implements the [io.RuneScanner] trait. # fn unread_rune() error: # if self.read_pos <= 0: # return errors.New("strings.Reader.unread_rune: at beginning of string") # if self.prev_rune < 0: # return errors.New("strings.Reader.unread_rune: previous operation was not read_rune") # self.read_pos = Int64(self.prev_rune) # self.prev_rune = -1 # return nil fn seek(inout self, offset: Int64, whence: Int) -> (Int64, Error): """Seeks to a new position in the underlying string. The next read will start from that position. Implements the [io.Seeker] trait. Args: offset: The offset to seek to. whence: The seek mode. It can be one of [io.SEEK_START], [io.SEEK_CURRENT], or [io.SEEK_END]. Returns: The new position in the string. """ self.prev_rune = -1 var position: Int64 = 0 if whence == io.SEEK_START: position = offset elif whence == io.SEEK_CURRENT: position = self.read_pos + offset elif whence == io.SEEK_END: position = Int64(len(self.string)) + offset else: return Int64(0), Error("strings.Reader.seek: invalid whence") if position < 0: return Int64(0), Error("strings.Reader.seek: negative position") self.read_pos = position return position, Error() fn write_to[W: io.Writer](inout self, inout writer: W) -> (Int64, Error): """Writes the remaining portion of the underlying string to the provided writer. Implements the [io.WriterTo] trait. Args: writer: The writer to write the remaining portion of the string to. Returns: The number of bytes written to the writer. """ self.prev_rune = -1 if self.read_pos >= Int64(len(self.string)): return Int64(0), Error() var chunk_to_write = self.string[int(self.read_pos) :] var bytes_written: Int var err: Error bytes_written, err = io.write_string(writer, chunk_to_write) if bytes_written > len(chunk_to_write): panic("strings.Reader.write_to: invalid write_string count") self.read_pos += Int64(bytes_written) if bytes_written != len(chunk_to_write) and not err: err = Error(io.ERR_SHORT_WRITE) return Int64(bytes_written), err # TODO: How can I differentiate between the two write_to methods when the writer implements both traits? # fn write_to[W: io.StringWriter](inout self, inout writer: W) raises -> Int64: # """Writes the remaining portion of the underlying string to the provided writer. # Implements the [io.WriterTo] trait. # Args: # writer: The writer to write the remaining portion of the string to. # Returns: # The number of bytes written to the writer. # """ # self.prev_rune = -1 # if self.read_pos >= Int64(len(self.string)): # return 0 # var chunk_to_write = self.string[self.read_pos:] # var bytes_written = io.write_string(writer, chunk_to_write) # if bytes_written > len(chunk_to_write): # raise Error("strings.Reader.write_to: invalid write_string count") # self.read_pos += Int64(bytes_written) # if bytes_written != len(chunk_to_write): # raise Error(io.ERR_SHORT_WRITE) # return Int64(bytes_written) fn reset(inout self, string: String): """Resets the [Reader] to be reading from the beginning of the provided string. Args: string: The string to read from. """ self.string = string self.read_pos = 0 self.prev_rune = -1 fn new_reader(string: String = "") -> Reader: """Returns a new [Reader] reading from the provided string. It is similar to [bytes.new_buffer] but more efficient and non-writable. Args: string: The string to read from. """ return Reader(string) --- external/gojo/syscall/__init__.mojo --- from .net import FD_STDIN, FD_STDOUT, FD_STDERR # Adapted from https://github.com/crisadamo/mojo-Libc . Huge thanks to Cristian! # C types alias c_void = UInt8 alias c_char = UInt8 alias c_schar = Int8 alias c_uchar = UInt8 alias c_short = Int16 alias c_ushort = UInt16 alias c_int = Int32 alias c_uint = UInt32 alias c_long = Int64 alias c_ulong = UInt64 alias c_float = Float32 alias c_double = Float64 # `Int` is known to be machine's width alias c_size_t = Int alias c_ssize_t = Int alias ptrdiff_t = Int64 alias intptr_t = Int64 alias uintptr_t = UInt64 --- external/gojo/syscall/file.mojo --- from . import c_int, c_char, c_void, c_size_t, c_ssize_t # --- ( File Related Syscalls & Structs )--------------------------------------- alias O_NONBLOCK = 16384 alias O_ACCMODE = 3 alias O_CLOEXEC = 524288 fn close(fildes: c_int) -> c_int: """Libc POSIX `close` function Reference: https://man7.org/linux/man-pages/man3/close.3p.html Fn signature: int close(int fildes). Args: fildes: A File Descriptor to close. Returns: Upon successful completion, 0 shall be returned; otherwise, -1 shall be returned and errno set to indicate the error. """ return external_call["close", c_int, c_int](fildes) fn open[*T: AnyType](path: UnsafePointer[c_char], oflag: c_int) -> c_int: """Libc POSIX `open` function Reference: https://man7.org/linux/man-pages/man3/open.3p.html Fn signature: int open(const char *path, int oflag, ...). Args: path: A pointer to a C string containing the path to open. oflag: The flags to open the file with. Returns: A File Descriptor or -1 in case of failure """ return external_call["open", c_int, UnsafePointer[c_char], c_int](path, oflag) # FnName, RetType # Args fn read(fildes: c_int, buf: UnsafePointer[c_void], nbyte: c_size_t) -> c_int: """Libc POSIX `read` function Reference: https://man7.org/linux/man-pages/man3/read.3p.html Fn signature: sssize_t read(int fildes, void *buf, size_t nbyte). Args: fildes: A File Descriptor. buf: A pointer to a buffer to store the read data. nbyte: The number of bytes to read. Returns: The number of bytes read or -1 in case of failure. """ return external_call["read", c_ssize_t, c_int, UnsafePointer[c_void], c_size_t](fildes, buf, nbyte) fn write(fildes: c_int, buf: UnsafePointer[c_void], nbyte: c_size_t) -> c_int: """Libc POSIX `write` function Reference: https://man7.org/linux/man-pages/man3/write.3p.html Fn signature: ssize_t write(int fildes, const void *buf, size_t nbyte). Args: fildes: A File Descriptor. buf: A pointer to a buffer to write. nbyte: The number of bytes to write. Returns: The number of bytes written or -1 in case of failure. """ return external_call["write", c_ssize_t, c_int, UnsafePointer[c_void], c_size_t](fildes, buf, nbyte) --- external/gojo/syscall/net.mojo --- from . import c_char, c_int, c_ushort, c_uint, c_size_t, c_ssize_t from .types import strlen from .file import O_CLOEXEC, O_NONBLOCK from utils.static_tuple import StaticTuple alias IPPROTO_IPV6 = 41 alias IPV6_V6ONLY = 26 alias EPROTONOSUPPORT = 93 # Adapted from https://github.com/gabrieldemarmiesse/mojo-stdlib-extensions/ . Huge thanks to Gabriel! alias FD_STDIN: c_int = 0 alias FD_STDOUT: c_int = 1 alias FD_STDERR: c_int = 2 alias SUCCESS = 0 alias GRND_NONBLOCK: UInt8 = 1 alias char_pointer = DTypePointer[DType.uint8] # --- ( error.h Constants )----------------------------------------------------- alias EPERM = 1 alias ENOENT = 2 alias ESRCH = 3 alias EINTR = 4 alias EIO = 5 alias ENXIO = 6 alias E2BIG = 7 alias ENOEXEC = 8 alias EBADF = 9 alias ECHILD = 10 alias EAGAIN = 11 alias ENOMEM = 12 alias EACCES = 13 alias EFAULT = 14 alias ENOTBLK = 15 alias EBUSY = 16 alias EEXIST = 17 alias EXDEV = 18 alias ENODEV = 19 alias ENOTDIR = 20 alias EISDIR = 21 alias EINVAL = 22 alias ENFILE = 23 alias EMFILE = 24 alias ENOTTY = 25 alias ETXTBSY = 26 alias EFBIG = 27 alias ENOSPC = 28 alias ESPIPE = 29 alias EROFS = 30 alias EMLINK = 31 alias EPIPE = 32 alias EDOM = 33 alias ERANGE = 34 alias EWOULDBLOCK = EAGAIN fn to_char_ptr(s: String) -> DTypePointer[DType.uint8]: """Only ASCII-based strings.""" var ptr = DTypePointer[DType.uint8]().alloc(len(s)) for i in range(len(s)): ptr.store(i, ord(s[i])) return ptr fn c_charptr_to_string(s: DTypePointer[DType.uint8]) -> String: return String(s, strlen(s)) fn cftob(val: c_int) -> Bool: """Convert C-like failure (-1) to Bool.""" return rebind[Bool](val > 0) # --- ( Network Related Constants )--------------------------------------------- alias sa_family_t = c_ushort alias socklen_t = c_uint alias in_addr_t = c_uint alias in_port_t = c_ushort # Address Family Constants alias AF_UNSPEC = 0 alias AF_UNIX = 1 alias AF_LOCAL = AF_UNIX alias AF_INET = 2 alias AF_AX25 = 3 alias AF_IPX = 4 alias AF_APPLETALK = 5 alias AF_NETROM = 6 alias AF_BRIDGE = 7 alias AF_ATMPVC = 8 alias AF_X25 = 9 alias AF_INET6 = 10 alias AF_ROSE = 11 alias AF_DECnet = 12 alias AF_NETBEUI = 13 alias AF_SECURITY = 14 alias AF_KEY = 15 alias AF_NETLINK = 16 alias AF_ROUTE = AF_NETLINK alias AF_PACKET = 17 alias AF_ASH = 18 alias AF_ECONET = 19 alias AF_ATMSVC = 20 alias AF_RDS = 21 alias AF_SNA = 22 alias AF_IRDA = 23 alias AF_PPPOX = 24 alias AF_WANPIPE = 25 alias AF_LLC = 26 alias AF_CAN = 29 alias AF_TIPC = 30 alias AF_BLUETOOTH = 31 alias AF_IUCV = 32 alias AF_RXRPC = 33 alias AF_ISDN = 34 alias AF_PHONET = 35 alias AF_IEEE802154 = 36 alias AF_CAIF = 37 alias AF_ALG = 38 alias AF_NFC = 39 alias AF_VSOCK = 40 alias AF_KCM = 41 alias AF_QIPCRTR = 42 alias AF_MAX = 43 # Protocol family constants alias PF_UNSPEC = AF_UNSPEC alias PF_UNIX = AF_UNIX alias PF_LOCAL = AF_LOCAL alias PF_INET = AF_INET alias PF_AX25 = AF_AX25 alias PF_IPX = AF_IPX alias PF_APPLETALK = AF_APPLETALK alias PF_NETROM = AF_NETROM alias PF_BRIDGE = AF_BRIDGE alias PF_ATMPVC = AF_ATMPVC alias PF_X25 = AF_X25 alias PF_INET6 = AF_INET6 alias PF_ROSE = AF_ROSE alias PF_DECnet = AF_DECnet alias PF_NETBEUI = AF_NETBEUI alias PF_SECURITY = AF_SECURITY alias PF_KEY = AF_KEY alias PF_NETLINK = AF_NETLINK alias PF_ROUTE = AF_ROUTE alias PF_PACKET = AF_PACKET alias PF_ASH = AF_ASH alias PF_ECONET = AF_ECONET alias PF_ATMSVC = AF_ATMSVC alias PF_RDS = AF_RDS alias PF_SNA = AF_SNA alias PF_IRDA = AF_IRDA alias PF_PPPOX = AF_PPPOX alias PF_WANPIPE = AF_WANPIPE alias PF_LLC = AF_LLC alias PF_CAN = AF_CAN alias PF_TIPC = AF_TIPC alias PF_BLUETOOTH = AF_BLUETOOTH alias PF_IUCV = AF_IUCV alias PF_RXRPC = AF_RXRPC alias PF_ISDN = AF_ISDN alias PF_PHONET = AF_PHONET alias PF_IEEE802154 = AF_IEEE802154 alias PF_CAIF = AF_CAIF alias PF_ALG = AF_ALG alias PF_NFC = AF_NFC alias PF_VSOCK = AF_VSOCK alias PF_KCM = AF_KCM alias PF_QIPCRTR = AF_QIPCRTR alias PF_MAX = AF_MAX # Socket Type constants alias SOCK_STREAM = 1 alias SOCK_DGRAM = 2 alias SOCK_RAW = 3 alias SOCK_RDM = 4 alias SOCK_SEQPACKET = 5 alias SOCK_DCCP = 6 alias SOCK_PACKET = 10 alias SOCK_CLOEXEC = O_CLOEXEC alias SOCK_NONBLOCK = O_NONBLOCK # Address Information alias AI_PASSIVE = 1 alias AI_CANONNAME = 2 alias AI_NUMERICHOST = 4 alias AI_V4MAPPED = 2048 alias AI_ALL = 256 alias AI_ADDRCONFIG = 1024 alias AI_IDN = 64 alias INET_ADDRSTRLEN = 16 alias INET6_ADDRSTRLEN = 46 alias SHUT_RD = 0 alias SHUT_WR = 1 alias SHUT_RDWR = 2 alias SOL_SOCKET = 65535 # Socket Options alias SO_DEBUG = 1 alias SO_REUSEADDR = 4 alias SO_TYPE = 4104 alias SO_ERROR = 4103 alias SO_DONTROUTE = 16 alias SO_BROADCAST = 32 alias SO_SNDBUF = 4097 alias SO_RCVBUF = 4098 alias SO_KEEPALIVE = 8 alias SO_OOBINLINE = 256 alias SO_LINGER = 128 alias SO_REUSEPORT = 512 alias SO_RCVLOWAT = 4100 alias SO_SNDLOWAT = 4099 alias SO_RCVTIMEO = 4102 alias SO_SNDTIMEO = 4101 alias SO_RCVTIMEO_OLD = 4102 alias SO_SNDTIMEO_OLD = 4101 alias SO_ACCEPTCONN = 2 # unsure of these socket options, they weren't available via python alias SO_NO_CHECK = 11 alias SO_PRIORITY = 12 alias SO_BSDCOMPAT = 14 alias SO_PASSCRED = 16 alias SO_PEERCRED = 17 alias SO_SECURITY_AUTHENTICATION = 22 alias SO_SECURITY_ENCRYPTION_TRANSPORT = 23 alias SO_SECURITY_ENCRYPTION_NETWORK = 24 alias SO_BINDTODEVICE = 25 alias SO_ATTACH_FILTER = 26 alias SO_DETACH_FILTER = 27 alias SO_GET_FILTER = SO_ATTACH_FILTER alias SO_PEERNAME = 28 alias SO_TIMESTAMP = 29 alias SO_TIMESTAMP_OLD = 29 alias SO_PEERSEC = 31 alias SO_SNDBUFFORCE = 32 alias SO_RCVBUFFORCE = 33 alias SO_PASSSEC = 34 alias SO_TIMESTAMPNS = 35 alias SO_TIMESTAMPNS_OLD = 35 alias SO_MARK = 36 alias SO_TIMESTAMPING = 37 alias SO_TIMESTAMPING_OLD = 37 alias SO_PROTOCOL = 38 alias SO_DOMAIN = 39 alias SO_RXQ_OVFL = 40 alias SO_WIFI_STATUS = 41 alias SCM_WIFI_STATUS = SO_WIFI_STATUS alias SO_PEEK_OFF = 42 alias SO_NOFCS = 43 alias SO_LOCK_FILTER = 44 alias SO_SELECT_ERR_QUEUE = 45 alias SO_BUSY_POLL = 46 alias SO_MAX_PACING_RATE = 47 alias SO_BPF_EXTENSIONS = 48 alias SO_INCOMING_CPU = 49 alias SO_ATTACH_BPF = 50 alias SO_DETACH_BPF = SO_DETACH_FILTER alias SO_ATTACH_REUSEPORT_CBPF = 51 alias SO_ATTACH_REUSEPORT_EBPF = 52 alias SO_CNX_ADVICE = 53 alias SCM_TIMESTAMPING_OPT_STATS = 54 alias SO_MEMINFO = 55 alias SO_INCOMING_NAPI_ID = 56 alias SO_COOKIE = 57 alias SCM_TIMESTAMPING_PKTINFO = 58 alias SO_PEERGROUPS = 59 alias SO_ZEROCOPY = 60 alias SO_TXTIME = 61 alias SCM_TXTIME = SO_TXTIME alias SO_BINDTOIFINDEX = 62 alias SO_TIMESTAMP_NEW = 63 alias SO_TIMESTAMPNS_NEW = 64 alias SO_TIMESTAMPING_NEW = 65 alias SO_RCVTIMEO_NEW = 66 alias SO_SNDTIMEO_NEW = 67 alias SO_DETACH_REUSEPORT_BPF = 68 # --- ( Network Related Structs )----------------------------------------------- @value @register_passable("trivial") struct in_addr: var s_addr: in_addr_t @value @register_passable("trivial") struct in6_addr: var s6_addr: StaticTuple[c_char, 16] @value @register_passable("trivial") struct sockaddr: var sa_family: sa_family_t var sa_data: StaticTuple[c_char, 14] @value @register_passable("trivial") struct sockaddr_in: var sin_family: sa_family_t var sin_port: in_port_t var sin_addr: in_addr var sin_zero: StaticTuple[c_char, 8] @value @register_passable("trivial") struct sockaddr_in6: var sin6_family: sa_family_t var sin6_port: in_port_t var sin6_flowinfo: c_uint var sin6_addr: in6_addr var sin6_scope_id: c_uint @value @register_passable("trivial") struct addrinfo: """Struct field ordering can vary based on platform. For MacOS, I had to swap the order of ai_canonname and ai_addr. https://stackoverflow.com/questions/53575101/calling-getaddrinfo-directly-from-python-ai-addr-is-null-pointer. """ var ai_flags: c_int var ai_family: c_int var ai_socktype: c_int var ai_protocol: c_int var ai_addrlen: socklen_t var ai_canonname: DTypePointer[DType.uint8] var ai_addr: UnsafePointer[sockaddr] var ai_next: UnsafePointer[addrinfo] fn __init__( inout self, ai_flags: c_int = 0, ai_family: c_int = 0, ai_socktype: c_int = 0, ai_protocol: c_int = 0, ai_addrlen: socklen_t = 0, ai_canonname: DTypePointer[DType.uint8] = DTypePointer[DType.uint8](), ai_addr: UnsafePointer[sockaddr] = UnsafePointer[sockaddr](), ai_next: UnsafePointer[addrinfo] = UnsafePointer[addrinfo](), ): self.ai_flags = ai_flags self.ai_family = ai_family self.ai_socktype = ai_socktype self.ai_protocol = ai_protocol self.ai_addrlen = ai_addrlen self.ai_canonname = ai_canonname self.ai_addr = ai_addr self.ai_next = ai_next # fn __init__() -> Self: # return Self(0, 0, 0, 0, 0, DTypePointer[DType.uint8](), UnsafePointer[sockaddr](), UnsafePointer[addrinfo]()) @value @register_passable("trivial") struct addrinfo_unix: """Struct field ordering can vary based on platform. For MacOS, I had to swap the order of ai_canonname and ai_addr. https://stackoverflow.com/questions/53575101/calling-getaddrinfo-directly-from-python-ai-addr-is-null-pointer. """ var ai_flags: c_int var ai_family: c_int var ai_socktype: c_int var ai_protocol: c_int var ai_addrlen: socklen_t var ai_addr: UnsafePointer[sockaddr] var ai_canonname: DTypePointer[DType.uint8] var ai_next: UnsafePointer[addrinfo] fn __init__( inout self, ai_flags: c_int = 0, ai_family: c_int = 0, ai_socktype: c_int = 0, ai_protocol: c_int = 0, ai_addrlen: socklen_t = 0, ai_canonname: DTypePointer[DType.uint8] = DTypePointer[DType.uint8](), ai_addr: UnsafePointer[sockaddr] = UnsafePointer[sockaddr](), ai_next: UnsafePointer[addrinfo] = UnsafePointer[addrinfo](), ): self.ai_flags = ai_flags self.ai_family = ai_family self.ai_socktype = ai_socktype self.ai_protocol = ai_protocol self.ai_addrlen = ai_addrlen self.ai_canonname = ai_canonname self.ai_addr = ai_addr self.ai_next = ai_next # --- ( Network Related Syscalls & Structs )------------------------------------ fn htonl(hostlong: c_uint) -> c_uint: """Libc POSIX `htonl` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint32_t htonl(uint32_t hostlong). Args: hostlong: A 32-bit integer in host byte order. Returns: The value provided in network byte order. """ return external_call["htonl", c_uint, c_uint](hostlong) fn htons(hostshort: c_ushort) -> c_ushort: """Libc POSIX `htons` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint16_t htons(uint16_t hostshort). Args: hostshort: A 16-bit integer in host byte order. Returns: The value provided in network byte order. """ return external_call["htons", c_ushort, c_ushort](hostshort) fn ntohl(netlong: c_uint) -> c_uint: """Libc POSIX `ntohl` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint32_t ntohl(uint32_t netlong). Args: netlong: A 32-bit integer in network byte order. Returns: The value provided in host byte order. """ return external_call["ntohl", c_uint, c_uint](netlong) fn ntohs(netshort: c_ushort) -> c_ushort: """Libc POSIX `ntohs` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint16_t ntohs(uint16_t netshort). Args: netshort: A 16-bit integer in network byte order. Returns: The value provided in host byte order. """ return external_call["ntohs", c_ushort, c_ushort](netshort) fn inet_ntop( af: c_int, src: DTypePointer[DType.uint8], dst: DTypePointer[DType.uint8], size: socklen_t ) -> DTypePointer[DType.uint8]: """Libc POSIX `inet_ntop` function Reference: https://man7.org/linux/man-pages/man3/inet_ntop.3p.html. Fn signature: const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size). Args: af: Address Family see AF_ aliases. src: A pointer to a binary address. dst: A pointer to a buffer to store the result. size: The size of the buffer. Returns: A pointer to the buffer containing the result. """ return external_call[ "inet_ntop", DTypePointer[DType.uint8], # FnName, RetType c_int, DTypePointer[DType.uint8], DTypePointer[DType.uint8], socklen_t, # Args ](af, src, dst, size) fn inet_pton(af: c_int, src: DTypePointer[DType.uint8], dst: DTypePointer[DType.uint8]) -> c_int: """Libc POSIX `inet_pton` function Reference: https://man7.org/linux/man-pages/man3/inet_ntop.3p.html Fn signature: int inet_pton(int af, const char *restrict src, void *restrict dst). Args: af: Address Family see AF_ aliases. src: A pointer to a string containing the address. dst: A pointer to a buffer to store the result. Returns: 1 on success, 0 if the input is not a valid address, -1 on error. """ return external_call[ "inet_pton", c_int, # FnName, RetType c_int, DTypePointer[DType.uint8], DTypePointer[DType.uint8], # Args ](af, src, dst) fn inet_addr(cp: DTypePointer[DType.uint8]) -> in_addr_t: """Libc POSIX `inet_addr` function Reference: https://man7.org/linux/man-pages/man3/inet_addr.3p.html Fn signature: in_addr_t inet_addr(const char *cp). Args: cp: A pointer to a string containing the address. Returns: The address in network byte order. """ return external_call["inet_addr", in_addr_t, DTypePointer[DType.uint8]](cp) fn inet_ntoa(addr: in_addr) -> DTypePointer[DType.uint8]: """Libc POSIX `inet_ntoa` function Reference: https://man7.org/linux/man-pages/man3/inet_addr.3p.html Fn signature: char *inet_ntoa(struct in_addr in). Args: in: A pointer to a string containing the address. Returns: The address in network byte order. """ return external_call["inet_ntoa", DTypePointer[DType.uint8], in_addr](addr) fn socket(domain: c_int, type: c_int, protocol: c_int) -> c_int: """Libc POSIX `socket` function Reference: https://man7.org/linux/man-pages/man3/socket.3p.html Fn signature: int socket(int domain, int type, int protocol). Args: domain: Address Family see AF_ aliases. type: Socket Type see SOCK_ aliases. protocol: The protocol to use. Returns: A File Descriptor or -1 in case of failure. """ return external_call["socket", c_int, c_int, c_int, c_int](domain, type, protocol) # FnName, RetType # Args fn setsockopt( socket: c_int, level: c_int, option_name: c_int, option_value: DTypePointer[DType.uint8], option_len: socklen_t, ) -> c_int: """Libc POSIX `setsockopt` function Reference: https://man7.org/linux/man-pages/man3/setsockopt.3p.html Fn signature: int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len). Args: socket: A File Descriptor. level: The protocol level. option_name: The option to set. option_value: A pointer to the value to set. option_len: The size of the value. Returns: 0 on success, -1 on error. """ return external_call[ "setsockopt", c_int, # FnName, RetType c_int, c_int, c_int, DTypePointer[DType.uint8], socklen_t, # Args ](socket, level, option_name, option_value, option_len) fn getsockopt( socket: c_int, level: c_int, option_name: c_int, option_value: DTypePointer[DType.uint8], option_len: UnsafePointer[socklen_t], ) -> c_int: """Libc POSIX `getsockopt` function Reference: https://man7.org/linux/man-pages/man3/getsockopt.3p.html Fn signature: int getsockopt(int socket, int level, int option_name, void *restrict option_value, socklen_t *restrict option_len). Args: socket: A File Descriptor. level: The protocol level. option_name: The option to get. option_value: A pointer to the value to get. option_len: DTypePointer to the size of the value. Returns: 0 on success, -1 on error. """ return external_call[ "getsockopt", c_int, # FnName, RetType c_int, c_int, c_int, DTypePointer[DType.uint8], UnsafePointer[socklen_t], # Args ](socket, level, option_name, option_value, option_len) fn getsockname(socket: c_int, address: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t]) -> c_int: """Libc POSIX `getsockname` function Reference: https://man7.org/linux/man-pages/man3/getsockname.3p.html Fn signature: int getsockname(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len). Args: socket: A File Descriptor. address: A pointer to a buffer to store the address of the peer. address_len: A pointer to the size of the buffer. Returns: 0 on success, -1 on error. """ return external_call[ "getsockname", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](socket, address, address_len) fn getpeername(sockfd: c_int, addr: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t]) -> c_int: """Libc POSIX `getpeername` function Reference: https://man7.org/linux/man-pages/man2/getpeername.2.html Fn signature: int getpeername(int socket, struct sockaddr *restrict addr, socklen_t *restrict address_len). Args: sockfd: A File Descriptor. addr: A pointer to a buffer to store the address of the peer. address_len: A pointer to the size of the buffer. Returns: 0 on success, -1 on error. """ return external_call[ "getpeername", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](sockfd, addr, address_len) fn bind(socket: c_int, address: UnsafePointer[sockaddr], address_len: socklen_t) -> c_int: """Libc POSIX `bind` function Reference: https://man7.org/linux/man-pages/man3/bind.3p.html Fn signature: int bind(int socket, const struct sockaddr *address, socklen_t address_len). """ return external_call["bind", c_int, c_int, UnsafePointer[sockaddr], socklen_t]( # FnName, RetType # Args socket, address, address_len ) fn listen(socket: c_int, backlog: c_int) -> c_int: """Libc POSIX `listen` function Reference: https://man7.org/linux/man-pages/man3/listen.3p.html Fn signature: int listen(int socket, int backlog). Args: socket: A File Descriptor. backlog: The maximum length of the queue of pending connections. Returns: 0 on success, -1 on error. """ return external_call["listen", c_int, c_int, c_int](socket, backlog) fn accept(socket: c_int, address: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t]) -> c_int: """Libc POSIX `accept` function Reference: https://man7.org/linux/man-pages/man3/accept.3p.html Fn signature: int accept(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len). Args: socket: A File Descriptor. address: A pointer to a buffer to store the address of the peer. address_len: A pointer to the size of the buffer. Returns: A File Descriptor or -1 in case of failure. """ return external_call[ "accept", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](socket, address, address_len) fn connect(socket: c_int, address: UnsafePointer[sockaddr], address_len: socklen_t) -> c_int: """Libc POSIX `connect` function Reference: https://man7.org/linux/man-pages/man3/connect.3p.html Fn signature: int connect(int socket, const struct sockaddr *address, socklen_t address_len). Args: socket: A File Descriptor. address: A pointer to the address to connect to. address_len: The size of the address. Returns: 0 on success, -1 on error. """ return external_call["connect", c_int, c_int, UnsafePointer[sockaddr], socklen_t]( # FnName, RetType # Args socket, address, address_len ) fn recv(socket: c_int, buffer: DTypePointer[DType.uint8], length: c_size_t, flags: c_int) -> c_ssize_t: """Libc POSIX `recv` function Reference: https://man7.org/linux/man-pages/man3/recv.3p.html Fn signature: ssize_t recv(int socket, void *buffer, size_t length, int flags). """ return external_call[ "recv", c_ssize_t, # FnName, RetType c_int, DTypePointer[DType.uint8], c_size_t, c_int, # Args ](socket, buffer, length, flags) fn send(socket: c_int, buffer: DTypePointer[DType.uint8], length: c_size_t, flags: c_int) -> c_ssize_t: """Libc POSIX `send` function Reference: https://man7.org/linux/man-pages/man3/send.3p.html Fn signature: ssize_t send(int socket, const void *buffer, size_t length, int flags). Args: socket: A File Descriptor. buffer: A pointer to the buffer to send. length: The size of the buffer. flags: Flags to control the behaviour of the function. Returns: The number of bytes sent or -1 in case of failure. """ return external_call[ "send", c_ssize_t, # FnName, RetType c_int, DTypePointer[DType.uint8], c_size_t, c_int, # Args ](socket, buffer, length, flags) fn shutdown(socket: c_int, how: c_int) -> c_int: """Libc POSIX `shutdown` function Reference: https://man7.org/linux/man-pages/man3/shutdown.3p.html Fn signature: int shutdown(int socket, int how). Args: socket: A File Descriptor. how: How to shutdown the socket. Returns: 0 on success, -1 on error. """ return external_call["shutdown", c_int, c_int, c_int](socket, how) # FnName, RetType # Args fn getaddrinfo( nodename: DTypePointer[DType.uint8], servname: DTypePointer[DType.uint8], hints: UnsafePointer[addrinfo], res: UnsafePointer[UnsafePointer[addrinfo]], ) -> c_int: """Libc POSIX `getaddrinfo` function Reference: https://man7.org/linux/man-pages/man3/getaddrinfo.3p.html Fn signature: int getaddrinfo(const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, struct addrinfo **restrict res). """ return external_call[ "getaddrinfo", c_int, # FnName, RetType DTypePointer[DType.uint8], DTypePointer[DType.uint8], UnsafePointer[addrinfo], # Args UnsafePointer[UnsafePointer[addrinfo]], # Args ](nodename, servname, hints, res) fn getaddrinfo_unix( nodename: DTypePointer[DType.uint8], servname: DTypePointer[DType.uint8], hints: UnsafePointer[addrinfo_unix], res: UnsafePointer[UnsafePointer[addrinfo_unix]], ) -> c_int: """Libc POSIX `getaddrinfo` function Reference: https://man7.org/linux/man-pages/man3/getaddrinfo.3p.html Fn signature: int getaddrinfo(const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, struct addrinfo **restrict res). """ return external_call[ "getaddrinfo", c_int, # FnName, RetType DTypePointer[DType.uint8], DTypePointer[DType.uint8], UnsafePointer[addrinfo_unix], # Args UnsafePointer[UnsafePointer[addrinfo_unix]], # Args ](nodename, servname, hints, res) fn gai_strerror(ecode: c_int) -> DTypePointer[DType.uint8]: """Libc POSIX `gai_strerror` function Reference: https://man7.org/linux/man-pages/man3/gai_strerror.3p.html Fn signature: const char *gai_strerror(int ecode). Args: ecode: The error code. Returns: A pointer to a string describing the error. """ return external_call["gai_strerror", DTypePointer[DType.uint8], c_int](ecode) # FnName, RetType # Args # fn inet_pton(address_family: Int, address: String) -> Int: # var ip_buf_size = 4 # if address_family == AF_INET6: # ip_buf_size = 16 # var ip_buf = DTypePointer[DType.uint8].alloc(ip_buf_size) # var conv_status = inet_pton(rebind[c_int](address_family), to_char_ptr(address), ip_buf) # return int(ip_buf.bitcast[c_uint]().load()) --- external/gojo/syscall/types.mojo --- fn strlen(s: DTypePointer[DType.uint8]) -> c_size_t: """Libc POSIX `strlen` function Reference: https://man7.org/linux/man-pages/man3/strlen.3p.html Fn signature: size_t strlen(const char *s). Args: s: A pointer to a C string. Returns: The length of the string. """ return external_call["strlen", c_size_t, DTypePointer[DType.uint8]](s) --- external/gojo/tests/__init__.mojo --- --- external/gojo/tests/wrapper.mojo --- from testing import testing @value struct MojoTest: """ A utility struct for testing. """ var test_name: String fn __init__(inout self, test_name: String): self.test_name = test_name print("# " + test_name) fn assert_true(self, cond: Bool, message: String = ""): try: if message == "": testing.assert_true(cond) else: testing.assert_true(cond, message) except e: print(e) fn assert_false(self, cond: Bool, message: String = ""): try: if message == "": testing.assert_false(cond) else: testing.assert_false(cond, message) except e: print(e) fn assert_equal[T: testing.Testable](self, left: T, right: T): try: testing.assert_equal(left, right) except e: print(e) --- external/gojo/unicode/__init__.mojo --- from .utf8 import string_iterator, rune_count_in_string --- external/gojo/unicode/utf8/__init__.mojo --- """Almost all of the actual implementation in this module was written by @mzaks (https://github.com/mzaks)! This would not be possible without his help. """ from .runes import string_iterator, rune_count_in_string --- external/gojo/unicode/utf8/runes.mojo --- """Almost all of the actual implementation in this module was written by @mzaks (https://github.com/mzaks)! This would not be possible without his help. """ from ...builtins import Rune from algorithm.functional import vectorize from memory.unsafe import DTypePointer from sys.info import simdwidthof from bit import countl_zero # The default lowest and highest continuation byte. alias locb = 0b10000000 alias hicb = 0b10111111 alias RUNE_SELF = 0x80 # Characters below RuneSelf are represented as themselves in a single byte # acceptRange gives the range of valid values for the second byte in a UTF-8 # sequence. @value struct AcceptRange(CollectionElement): var lo: UInt8 # lowest value for second byte. var hi: UInt8 # highest value for second byte. # ACCEPT_RANGES has size 16 to avoid bounds checks in the code that uses it. alias ACCEPT_RANGES = List[AcceptRange]( AcceptRange(locb, hicb), AcceptRange(0xA0, hicb), AcceptRange(locb, 0x9F), AcceptRange(0x90, hicb), AcceptRange(locb, 0x8F), ) # These names of these constants are chosen to give nice alignment in the # table below. The first nibble is an index into acceptRanges or F for # special one-byte cases. The second nibble is the Rune length or the # Status for the special one-byte case. alias xx = 0xF1 # invalid: size 1 alias as1 = 0xF0 # ASCII: size 1 alias s1 = 0x02 # accept 0, size 2 alias s2 = 0x13 # accept 1, size 3 alias s3 = 0x03 # accept 0, size 3 alias s4 = 0x23 # accept 2, size 3 alias s5 = 0x34 # accept 3, size 4 alias s6 = 0x04 # accept 0, size 4 alias s7 = 0x44 # accept 4, size 4 # first is information about the first byte in a UTF-8 sequence. var first = List[UInt8]( # 1 2 3 4 5 6 7 8 9 A B C D E F as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, # 0x00-0x0F as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, # 0x10-0x1F as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, # 0x20-0x2F as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, # 0x30-0x3F as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, # 0x40-0x4F as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, # 0x50-0x5F as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, # 0x60-0x6F as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, as1, # 0x70-0x7F # 1 2 3 4 5 6 7 8 9 A B C D E F xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, # 0x80-0x8F xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, # 0x90-0x9F xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, # 0xA0-0xAF xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, # 0xB0-0xBF xx, xx, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, # 0xC0-0xCF s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, # 0xD0-0xDF s2, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s4, s3, s3, # 0xE0-0xEF s5, s6, s6, s6, s7, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, # 0xF0-0xFF ) alias simd_width_u8 = simdwidthof[DType.uint8]() fn rune_count_in_string(s: String) -> Int: """Count the number of runes in a string. Args: s: The string to count runes in. Returns: The number of runes in the string. """ var p = DTypePointer[DType.uint8](s.unsafe_uint8_ptr()) var string_byte_length = len(s) var result = 0 @parameter fn count[simd_width: Int](offset: Int): result += int(((p.load[width=simd_width](offset) >> 6) != 0b10).reduce_add()) vectorize[count, simd_width_u8](string_byte_length) return result --- external/libc.mojo --- from utils import StaticTuple from lightbug_http.io.bytes import Bytes alias IPPROTO_IPV6 = 41 alias IPV6_V6ONLY = 26 alias EPROTONOSUPPORT = 93 # Adapted from https://github.com/gabrieldemarmiesse/mojo-stdlib-extensions/ . Huge thanks to Gabriel! alias FD_STDIN: c_int = 0 alias FD_STDOUT: c_int = 1 alias FD_STDERR: c_int = 2 alias SUCCESS = 0 alias GRND_NONBLOCK: UInt8 = 1 alias char_UnsafePointer = UnsafePointer[c_char] # Adapted from https://github.com/crisadamo/mojo-Libc . Huge thanks to Cristian! # C types alias c_void = UInt8 alias c_char = UInt8 alias c_schar = Int8 alias c_uchar = UInt8 alias c_short = Int16 alias c_ushort = UInt16 alias c_int = Int32 alias c_uint = UInt32 alias c_long = Int64 alias c_ulong = UInt64 alias c_float = Float32 alias c_double = Float64 # `Int` is known to be machine's width alias c_size_t = Int alias c_ssize_t = Int alias ptrdiff_t = Int64 alias intptr_t = Int64 alias uintptr_t = UInt64 # --- ( error.h Constants )----------------------------------------------------- alias EPERM = 1 alias ENOENT = 2 alias ESRCH = 3 alias EINTR = 4 alias EIO = 5 alias ENXIO = 6 alias E2BIG = 7 alias ENOEXEC = 8 alias EBADF = 9 alias ECHILD = 10 alias EAGAIN = 11 alias ENOMEM = 12 alias EACCES = 13 alias EFAULT = 14 alias ENOTBLK = 15 alias EBUSY = 16 alias EEXIST = 17 alias EXDEV = 18 alias ENODEV = 19 alias ENOTDIR = 20 alias EISDIR = 21 alias EINVAL = 22 alias ENFILE = 23 alias EMFILE = 24 alias ENOTTY = 25 alias ETXTBSY = 26 alias EFBIG = 27 alias ENOSPC = 28 alias ESPIPE = 29 alias EROFS = 30 alias EMLINK = 31 alias EPIPE = 32 alias EDOM = 33 alias ERANGE = 34 alias EWOULDBLOCK = EAGAIN fn to_char_ptr(s: String) -> UnsafePointer[c_char]: """Only ASCII-based strings.""" var ptr = UnsafePointer[c_char]().alloc(len(s)) for i in range(len(s)): ptr[i] = ord(s[i]) return ptr fn to_char_ptr(s: Bytes) -> UnsafePointer[c_char]: var ptr = UnsafePointer[c_char]().alloc(len(s)) for i in range(len(s)): ptr[i] = int(s[i]) return ptr fn c_charptr_to_string(s: UnsafePointer[c_char]) -> String: return String(s.bitcast[UInt8](), strlen(s)) fn cftob(val: c_int) -> Bool: """Convert C-like failure (-1) to Bool.""" return rebind[Bool](val > 0) # --- ( Network Related Constants )--------------------------------------------- alias sa_family_t = c_ushort alias socklen_t = c_uint alias in_addr_t = c_uint alias in_port_t = c_ushort # Address Family Constants alias AF_UNSPEC = 0 alias AF_UNIX = 1 alias AF_LOCAL = AF_UNIX alias AF_INET = 2 alias AF_AX25 = 3 alias AF_IPX = 4 alias AF_APPLETALK = 5 alias AF_NETROM = 6 alias AF_BRIDGE = 7 alias AF_ATMPVC = 8 alias AF_X25 = 9 alias AF_INET6 = 10 alias AF_ROSE = 11 alias AF_DECnet = 12 alias AF_NETBEUI = 13 alias AF_SECURITY = 14 alias AF_KEY = 15 alias AF_NETLINK = 16 alias AF_ROUTE = AF_NETLINK alias AF_PACKET = 17 alias AF_ASH = 18 alias AF_ECONET = 19 alias AF_ATMSVC = 20 alias AF_RDS = 21 alias AF_SNA = 22 alias AF_IRDA = 23 alias AF_PPPOX = 24 alias AF_WANPIPE = 25 alias AF_LLC = 26 alias AF_CAN = 29 alias AF_TIPC = 30 alias AF_BLUETOOTH = 31 alias AF_IUCV = 32 alias AF_RXRPC = 33 alias AF_ISDN = 34 alias AF_PHONET = 35 alias AF_IEEE802154 = 36 alias AF_CAIF = 37 alias AF_ALG = 38 alias AF_NFC = 39 alias AF_VSOCK = 40 alias AF_KCM = 41 alias AF_QIPCRTR = 42 alias AF_MAX = 43 alias PF_UNSPEC = AF_UNSPEC alias PF_UNIX = AF_UNIX alias PF_LOCAL = AF_LOCAL alias PF_INET = AF_INET alias PF_AX25 = AF_AX25 alias PF_IPX = AF_IPX alias PF_APPLETALK = AF_APPLETALK alias PF_NETROM = AF_NETROM alias PF_BRIDGE = AF_BRIDGE alias PF_ATMPVC = AF_ATMPVC alias PF_X25 = AF_X25 alias PF_INET6 = AF_INET6 alias PF_ROSE = AF_ROSE alias PF_DECnet = AF_DECnet alias PF_NETBEUI = AF_NETBEUI alias PF_SECURITY = AF_SECURITY alias PF_KEY = AF_KEY alias PF_NETLINK = AF_NETLINK alias PF_ROUTE = AF_ROUTE alias PF_PACKET = AF_PACKET alias PF_ASH = AF_ASH alias PF_ECONET = AF_ECONET alias PF_ATMSVC = AF_ATMSVC alias PF_RDS = AF_RDS alias PF_SNA = AF_SNA alias PF_IRDA = AF_IRDA alias PF_PPPOX = AF_PPPOX alias PF_WANPIPE = AF_WANPIPE alias PF_LLC = AF_LLC alias PF_CAN = AF_CAN alias PF_TIPC = AF_TIPC alias PF_BLUETOOTH = AF_BLUETOOTH alias PF_IUCV = AF_IUCV alias PF_RXRPC = AF_RXRPC alias PF_ISDN = AF_ISDN alias PF_PHONET = AF_PHONET alias PF_IEEE802154 = AF_IEEE802154 alias PF_CAIF = AF_CAIF alias PF_ALG = AF_ALG alias PF_NFC = AF_NFC alias PF_VSOCK = AF_VSOCK alias PF_KCM = AF_KCM alias PF_QIPCRTR = AF_QIPCRTR alias PF_MAX = AF_MAX # Socket Type constants alias SOCK_STREAM = 1 alias SOCK_DGRAM = 2 alias SOCK_RAW = 3 alias SOCK_RDM = 4 alias SOCK_SEQPACKET = 5 alias SOCK_DCCP = 6 alias SOCK_PACKET = 10 alias SOCK_CLOEXEC = O_CLOEXEC alias SOCK_NONBLOCK = O_NONBLOCK # Address Information alias AI_PASSIVE = 1 alias AI_CANONNAME = 2 alias AI_NUMERICHOST = 4 alias AI_V4MAPPED = 8 alias AI_ALL = 16 alias AI_ADDRCONFIG = 32 alias AI_IDN = 64 alias INET_ADDRSTRLEN = 16 alias INET6_ADDRSTRLEN = 46 alias SHUT_RD = 0 alias SHUT_WR = 1 alias SHUT_RDWR = 2 alias SOL_SOCKET = 1 alias SO_DEBUG = 1 alias SO_REUSEADDR = 2 alias SO_TYPE = 3 alias SO_ERROR = 4 alias SO_DONTROUTE = 5 alias SO_BROADCAST = 6 alias SO_SNDBUF = 7 alias SO_RCVBUF = 8 alias SO_KEEPALIVE = 9 alias SO_OOBINLINE = 10 alias SO_NO_CHECK = 11 alias SO_PRIORITY = 12 alias SO_LINGER = 13 alias SO_BSDCOMPAT = 14 alias SO_REUSEPORT = 15 alias SO_PASSCRED = 16 alias SO_PEERCRED = 17 alias SO_RCVLOWAT = 18 alias SO_SNDLOWAT = 19 alias SO_RCVTIMEO = 20 alias SO_SNDTIMEO = 21 alias SO_RCVTIMEO_OLD = 20 alias SO_SNDTIMEO_OLD = 21 alias SO_SECURITY_AUTHENTICATION = 22 alias SO_SECURITY_ENCRYPTION_TRANSPORT = 23 alias SO_SECURITY_ENCRYPTION_NETWORK = 24 alias SO_BINDTODEVICE = 25 alias SO_ATTACH_FILTER = 26 alias SO_DETACH_FILTER = 27 alias SO_GET_FILTER = SO_ATTACH_FILTER alias SO_PEERNAME = 28 alias SO_TIMESTAMP = 29 alias SO_TIMESTAMP_OLD = 29 alias SO_ACCEPTCONN = 30 alias SO_PEERSEC = 31 alias SO_SNDBUFFORCE = 32 alias SO_RCVBUFFORCE = 33 alias SO_PASSSEC = 34 alias SO_TIMESTAMPNS = 35 alias SO_TIMESTAMPNS_OLD = 35 alias SO_MARK = 36 alias SO_TIMESTAMPING = 37 alias SO_TIMESTAMPING_OLD = 37 alias SO_PROTOCOL = 38 alias SO_DOMAIN = 39 alias SO_RXQ_OVFL = 40 alias SO_WIFI_STATUS = 41 alias SCM_WIFI_STATUS = SO_WIFI_STATUS alias SO_PEEK_OFF = 42 alias SO_NOFCS = 43 alias SO_LOCK_FILTER = 44 alias SO_SELECT_ERR_QUEUE = 45 alias SO_BUSY_POLL = 46 alias SO_MAX_PACING_RATE = 47 alias SO_BPF_EXTENSIONS = 48 alias SO_INCOMING_CPU = 49 alias SO_ATTACH_BPF = 50 alias SO_DETACH_BPF = SO_DETACH_FILTER alias SO_ATTACH_REUSEPORT_CBPF = 51 alias SO_ATTACH_REUSEPORT_EBPF = 52 alias SO_CNX_ADVICE = 53 alias SCM_TIMESTAMPING_OPT_STATS = 54 alias SO_MEMINFO = 55 alias SO_INCOMING_NAPI_ID = 56 alias SO_COOKIE = 57 alias SCM_TIMESTAMPING_PKTINFO = 58 alias SO_PEERGROUPS = 59 alias SO_ZEROCOPY = 60 alias SO_TXTIME = 61 alias SCM_TXTIME = SO_TXTIME alias SO_BINDTOIFINDEX = 62 alias SO_TIMESTAMP_NEW = 63 alias SO_TIMESTAMPNS_NEW = 64 alias SO_TIMESTAMPING_NEW = 65 alias SO_RCVTIMEO_NEW = 66 alias SO_SNDTIMEO_NEW = 67 alias SO_DETACH_REUSEPORT_BPF = 68 # --- ( Network Related Structs )----------------------------------------------- @value @register_passable("trivial") struct in_addr: var s_addr: in_addr_t @value @register_passable("trivial") struct in6_addr: var s6_addr: StaticTuple[c_char, 16] @value @register_passable("trivial") struct sockaddr: var sa_family: sa_family_t var sa_data: StaticTuple[c_char, 14] @value @register_passable("trivial") struct sockaddr_in: var sin_family: sa_family_t var sin_port: in_port_t var sin_addr: in_addr var sin_zero: StaticTuple[c_char, 8] @value @register_passable("trivial") struct sockaddr_in6: var sin6_family: sa_family_t var sin6_port: in_port_t var sin6_flowinfo: c_uint var sin6_addr: in6_addr var sin6_scope_id: c_uint @value @register_passable("trivial") struct addrinfo: var ai_flags: c_int var ai_family: c_int var ai_socktype: c_int var ai_protocol: c_int var ai_addrlen: socklen_t var ai_addr: UnsafePointer[sockaddr] var ai_canonname: UnsafePointer[c_char] # FIXME(cristian): This should be UnsafePointer[addrinfo] var ai_next: UnsafePointer[c_void] fn __init__() -> Self: return Self( 0, 0, 0, 0, 0, UnsafePointer[sockaddr](), UnsafePointer[c_char](), UnsafePointer[c_void]() ) fn strlen(s: UnsafePointer[c_char]) -> c_size_t: """Libc POSIX `strlen` function Reference: https://man7.org/linux/man-pages/man3/strlen.3p.html Fn signature: size_t strlen(const char *s). Args: s: A UnsafePointer to a C string. Returns: The length of the string. """ return external_call["strlen", c_size_t, UnsafePointer[c_char]](s) # --- ( Network Related Syscalls & Structs )------------------------------------ fn htonl(hostlong: c_uint) -> c_uint: """Libc POSIX `htonl` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint32_t htonl(uint32_t hostlong). Args: hostlong: A 32-bit integer in host byte order. Returns: The value provided in network byte order. """ return external_call["htonl", c_uint, c_uint](hostlong) fn htons(hostshort: c_ushort) -> c_ushort: """Libc POSIX `htons` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint16_t htons(uint16_t hostshort). Args: hostshort: A 16-bit integer in host byte order. Returns: The value provided in network byte order. """ return external_call["htons", c_ushort, c_ushort](hostshort) fn ntohl(netlong: c_uint) -> c_uint: """Libc POSIX `ntohl` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint32_t ntohl(uint32_t netlong). Args: netlong: A 32-bit integer in network byte order. Returns: The value provided in host byte order. """ return external_call["ntohl", c_uint, c_uint](netlong) fn ntohs(netshort: c_ushort) -> c_ushort: """Libc POSIX `ntohs` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint16_t ntohs(uint16_t netshort). Args: netshort: A 16-bit integer in network byte order. Returns: The value provided in host byte order. """ return external_call["ntohs", c_ushort, c_ushort](netshort) fn inet_ntop( af: c_int, src: UnsafePointer[c_void], dst: UnsafePointer[c_char], size: socklen_t ) -> UnsafePointer[c_char]: """Libc POSIX `inet_ntop` function Reference: https://man7.org/linux/man-pages/man3/inet_ntop.3p.html. Fn signature: const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size). Args: af: Address Family see AF_ aliases. src: A UnsafePointer to a binary address. dst: A UnsafePointer to a buffer to store the result. size: The size of the buffer. Returns: A UnsafePointer to the buffer containing the result. """ return external_call[ "inet_ntop", UnsafePointer[c_char], # FnName, RetType c_int, UnsafePointer[c_void], UnsafePointer[c_char], socklen_t, # Args ](af, src, dst, size) fn inet_pton(af: c_int, src: UnsafePointer[c_char], dst: UnsafePointer[c_void]) -> c_int: """Libc POSIX `inet_pton` function Reference: https://man7.org/linux/man-pages/man3/inet_ntop.3p.html Fn signature: int inet_pton(int af, const char *restrict src, void *restrict dst). Args: af: Address Family see AF_ aliases. src: A UnsafePointer to a string containing the address. dst: A UnsafePointer to a buffer to store the result. Returns: 1 on success, 0 if the input is not a valid address, -1 on error. """ return external_call[ "inet_pton", c_int, # FnName, RetType c_int, UnsafePointer[c_char], UnsafePointer[c_void], # Args ](af, src, dst) fn inet_addr(cp: UnsafePointer[c_char]) -> in_addr_t: """Libc POSIX `inet_addr` function Reference: https://man7.org/linux/man-pages/man3/inet_addr.3p.html Fn signature: in_addr_t inet_addr(const char *cp). Args: cp: A UnsafePointer to a string containing the address. Returns: The address in network byte order. """ return external_call["inet_addr", in_addr_t, UnsafePointer[c_char]](cp) fn inet_ntoa(addr: in_addr) -> UnsafePointer[c_char]: """Libc POSIX `inet_ntoa` function Reference: https://man7.org/linux/man-pages/man3/inet_addr.3p.html Fn signature: char *inet_ntoa(struct in_addr in). Args: in: A UnsafePointer to a string containing the address. Returns: The address in network byte order. """ return external_call["inet_ntoa", UnsafePointer[c_char], in_addr](addr) fn socket(domain: c_int, type: c_int, protocol: c_int) -> c_int: """Libc POSIX `socket` function Reference: https://man7.org/linux/man-pages/man3/socket.3p.html Fn signature: int socket(int domain, int type, int protocol). Args: domain: Address Family see AF_ aliases. type: Socket Type see SOCK_ aliases. protocol: The protocol to use. Returns: A File Descriptor or -1 in case of failure. """ return external_call[ "socket", c_int, c_int, c_int, c_int # FnName, RetType # Args ](domain, type, protocol) fn setsockopt( socket: c_int, level: c_int, option_name: c_int, option_value: UnsafePointer[c_void], option_len: socklen_t, ) -> c_int: """Libc POSIX `setsockopt` function Reference: https://man7.org/linux/man-pages/man3/setsockopt.3p.html Fn signature: int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len). Args: socket: A File Descriptor. level: The protocol level. option_name: The option to set. option_value: A UnsafePointer to the value to set. option_len: The size of the value. Returns: 0 on success, -1 on error. """ return external_call[ "setsockopt", c_int, # FnName, RetType c_int, c_int, c_int, UnsafePointer[c_void], socklen_t, # Args ](socket, level, option_name, option_value, option_len) fn getsockname( socket: c_int, address: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t] ) -> c_int: """Libc POSIX `getsockname` function Reference: https://man7.org/linux/man-pages/man3/getsockname.3p.html Fn signature: int getsockname(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len). Args: socket: A File Descriptor. address: A UnsafePointer to a buffer to store the address of the peer. address_len: A UnsafePointer to the size of the buffer. Returns: 0 on success, -1 on error. """ return external_call[ "getsockname", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](socket, address, address_len) fn getpeername( sockfd: c_int, addr: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t] ) -> c_int: """Libc POSIX `getpeername` function Reference: https://man7.org/linux/man-pages/man2/getpeername.2.html Fn signature: int getpeername(int socket, struct sockaddr *restrict addr, socklen_t *restrict address_len). Args: sockfd: A File Descriptor. addr: A UnsafePointer to a buffer to store the address of the peer. address_len: A UnsafePointer to the size of the buffer. Returns: 0 on success, -1 on error. """ return external_call[ "getpeername", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](sockfd, addr, address_len) fn bind(socket: c_int, address: UnsafePointer[sockaddr], address_len: socklen_t) -> c_int: """Libc POSIX `bind` function Reference: https://man7.org/linux/man-pages/man3/bind.3p.html Fn signature: int bind(int socket, const struct sockaddr *address, socklen_t address_len). """ return external_call[ "bind", c_int, c_int, UnsafePointer[sockaddr], socklen_t # FnName, RetType # Args ](socket, address, address_len) fn listen(socket: c_int, backlog: c_int) -> c_int: """Libc POSIX `listen` function Reference: https://man7.org/linux/man-pages/man3/listen.3p.html Fn signature: int listen(int socket, int backlog). Args: socket: A File Descriptor. backlog: The maximum length of the queue of pending connections. Returns: 0 on success, -1 on error. """ return external_call["listen", c_int, c_int, c_int](socket, backlog) fn accept( socket: c_int, address: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t] ) -> c_int: """Libc POSIX `accept` function Reference: https://man7.org/linux/man-pages/man3/accept.3p.html Fn signature: int accept(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len). Args: socket: A File Descriptor. address: A UnsafePointer to a buffer to store the address of the peer. address_len: A UnsafePointer to the size of the buffer. Returns: A File Descriptor or -1 in case of failure. """ return external_call[ "accept", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](socket, address, address_len) fn connect(socket: c_int, address: UnsafePointer[sockaddr], address_len: socklen_t) -> c_int: """Libc POSIX `connect` function Reference: https://man7.org/linux/man-pages/man3/connect.3p.html Fn signature: int connect(int socket, const struct sockaddr *address, socklen_t address_len). Args: socket: A File Descriptor. address: A UnsafePointer to the address to connect to. address_len: The size of the address. Returns: 0 on success, -1 on error. """ return external_call[ "connect", c_int, c_int, UnsafePointer[sockaddr], socklen_t # FnName, RetType # Args ](socket, address, address_len) # fn recv( # socket: c_int, buffer: UnsafePointer[c_void], length: c_size_t, flags: c_int # ) -> c_ssize_t: # """Libc POSIX `recv` function # Reference: https://man7.org/linux/man-pages/man3/recv.3p.html # Fn signature: ssize_t recv(int socket, void *buffer, size_t length, int flags). # """ # return external_call[ # "recv", # c_ssize_t, # FnName, RetType # c_int, # UnsafePointer[c_void], # c_size_t, # c_int, # Args # ](socket, buffer, length, flags) fn recv( socket: c_int, buffer: DTypePointer[DType.uint8], length: c_size_t, flags: c_int, ) -> c_ssize_t: """Libc POSIX `recv` function Reference: https://man7.org/linux/man-pages/man3/recv.3p.html Fn signature: ssize_t recv(int socket, void *buffer, size_t length, int flags). """ return external_call[ "recv", c_ssize_t, # FnName, RetType c_int, DTypePointer[DType.uint8], c_size_t, c_int, # Args ](socket, buffer, length, flags) fn send( socket: c_int, buffer: UnsafePointer[c_void], length: c_size_t, flags: c_int ) -> c_ssize_t: """Libc POSIX `send` function Reference: https://man7.org/linux/man-pages/man3/send.3p.html Fn signature: ssize_t send(int socket, const void *buffer, size_t length, int flags). Args: socket: A File Descriptor. buffer: A UnsafePointer to the buffer to send. length: The size of the buffer. flags: Flags to control the behaviour of the function. Returns: The number of bytes sent or -1 in case of failure. """ return external_call[ "send", c_ssize_t, # FnName, RetType c_int, UnsafePointer[c_void], c_size_t, c_int, # Args ](socket, buffer, length, flags) fn shutdown(socket: c_int, how: c_int) -> c_int: """Libc POSIX `shutdown` function Reference: https://man7.org/linux/man-pages/man3/shutdown.3p.html Fn signature: int shutdown(int socket, int how). Args: socket: A File Descriptor. how: How to shutdown the socket. Returns: 0 on success, -1 on error. """ return external_call["shutdown", c_int, c_int, c_int]( # FnName, RetType # Args socket, how ) fn getaddrinfo( nodename: UnsafePointer[c_char], servname: UnsafePointer[c_char], hints: UnsafePointer[addrinfo], res: UnsafePointer[UnsafePointer[addrinfo]], ) -> c_int: """Libc POSIX `getaddrinfo` function Reference: https://man7.org/linux/man-pages/man3/getaddrinfo.3p.html Fn signature: int getaddrinfo(const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, struct addrinfo **restrict res). """ return external_call[ "getaddrinfo", c_int, # FnName, RetType UnsafePointer[c_char], UnsafePointer[c_char], UnsafePointer[addrinfo], # Args UnsafePointer[UnsafePointer[addrinfo]], # Args ](nodename, servname, hints, res) fn gai_strerror(ecode: c_int) -> UnsafePointer[c_char]: """Libc POSIX `gai_strerror` function Reference: https://man7.org/linux/man-pages/man3/gai_strerror.3p.html Fn signature: const char *gai_strerror(int ecode). Args: ecode: The error code. Returns: A UnsafePointer to a string describing the error. """ return external_call[ "gai_strerror", UnsafePointer[c_char], c_int # FnName, RetType # Args ](ecode) fn inet_pton(address_family: Int, address: String) -> Int: var ip_buf_size = 4 if address_family == AF_INET6: ip_buf_size = 16 var ip_buf = UnsafePointer[c_void].alloc(ip_buf_size) var conv_status = inet_pton( rebind[c_int](address_family), to_char_ptr(address), ip_buf ) return int(ip_buf.bitcast[c_uint]()) # --- ( File Related Syscalls & Structs )--------------------------------------- alias O_NONBLOCK = 16384 alias O_ACCMODE = 3 alias O_CLOEXEC = 524288 fn close(fildes: c_int) -> c_int: """Libc POSIX `close` function Reference: https://man7.org/linux/man-pages/man3/close.3p.html Fn signature: int close(int fildes). Args: fildes: A File Descriptor to close. Returns: Upon successful completion, 0 shall be returned; otherwise, -1 shall be returned and errno set to indicate the error. """ return external_call["close", c_int, c_int](fildes) fn open[*T: AnyType](path: UnsafePointer[c_char], oflag: c_int, *args: *T) -> c_int: """Libc POSIX `open` function Reference: https://man7.org/linux/man-pages/man3/open.3p.html Fn signature: int open(const char *path, int oflag, ...). Args: path: A UnsafePointer to a C string containing the path to open. oflag: The flags to open the file with. args: The optional arguments. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "open", c_int, UnsafePointer[c_char], c_int # FnName, RetType # Args ](path, oflag, args) fn openat[ *T: AnyType ](fd: c_int, path: UnsafePointer[c_char], oflag: c_int, *args: *T) -> c_int: """Libc POSIX `open` function Reference: https://man7.org/linux/man-pages/man3/open.3p.html Fn signature: int openat(int fd, const char *path, int oflag, ...). Args: fd: A File Descriptor. path: A UnsafePointer to a C string containing the path to open. oflag: The flags to open the file with. args: The optional arguments. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "openat", c_int, c_int, UnsafePointer[c_char], c_int # FnName, RetType # Args ](fd, path, oflag, args) fn printf[*T: AnyType](format: UnsafePointer[c_char], *args: *T) -> c_int: """Libc POSIX `printf` function Reference: https://man7.org/linux/man-pages/man3/fprintf.3p.html Fn signature: int printf(const char *restrict format, ...). Args: format: A UnsafePointer to a C string containing the format. args: The optional arguments. Returns: The number of bytes written or -1 in case of failure. """ return external_call[ "printf", c_int, # FnName, RetType UnsafePointer[c_char], # Args ](format, args) fn sprintf[ *T: AnyType ](s: UnsafePointer[c_char], format: UnsafePointer[c_char], *args: *T) -> c_int: """Libc POSIX `sprintf` function Reference: https://man7.org/linux/man-pages/man3/fprintf.3p.html Fn signature: int sprintf(char *restrict s, const char *restrict format, ...). Args: s: A UnsafePointer to a buffer to store the result. format: A UnsafePointer to a C string containing the format. args: The optional arguments. Returns: The number of bytes written or -1 in case of failure. """ return external_call[ "sprintf", c_int, UnsafePointer[c_char], UnsafePointer[c_char] # FnName, RetType # Args ](s, format, args) fn read(fildes: c_int, buf: UnsafePointer[c_void], nbyte: c_size_t) -> c_int: """Libc POSIX `read` function Reference: https://man7.org/linux/man-pages/man3/read.3p.html Fn signature: sssize_t read(int fildes, void *buf, size_t nbyte). Args: fildes: A File Descriptor. buf: A UnsafePointer to a buffer to store the read data. nbyte: The number of bytes to read. Returns: The number of bytes read or -1 in case of failure. """ return external_call["read", c_ssize_t, c_int, UnsafePointer[c_void], c_size_t]( fildes, buf, nbyte ) fn write(fildes: c_int, buf: UnsafePointer[c_void], nbyte: c_size_t) -> c_int: """Libc POSIX `write` function Reference: https://man7.org/linux/man-pages/man3/write.3p.html Fn signature: ssize_t write(int fildes, const void *buf, size_t nbyte). Args: fildes: A File Descriptor. buf: A UnsafePointer to a buffer to write. nbyte: The number of bytes to write. Returns: The number of bytes written or -1 in case of failure. """ return external_call["write", c_ssize_t, c_int, UnsafePointer[c_void], c_size_t]( fildes, buf, nbyte ) # --- ( Testing Functions ) ---------------------------------------------------- fn __test_getaddrinfo__(): var ip_addr = "127.0.0.1" var port = 8083 var servinfo = UnsafePointer[addrinfo]().alloc(1) servinfo[0] = addrinfo() var hints = addrinfo() hints.ai_family = AF_INET hints.ai_socktype = SOCK_STREAM hints.ai_flags = AI_PASSIVE # var hints_ptr = var status = getaddrinfo( to_char_ptr(ip_addr), UnsafePointer[UInt8](), UnsafePointer.address_of(hints), UnsafePointer.address_of(servinfo), ) var msg_ptr = gai_strerror(c_int(status)) _ = external_call["printf", c_int, UnsafePointer[c_char], UnsafePointer[c_char]]( to_char_ptr("gai_strerror: %s"), msg_ptr ) var msg = c_charptr_to_string(msg_ptr) print("getaddrinfo satus: " + msg) # fn __test_socket_client__(): # var ip_addr = "127.0.0.1" # The server's hostname or IP address # var port = 8080 # The port used by the server # var address_family = AF_INET # var ip_buf = UnsafePointer[c_void].alloc(4) # var conv_status = inet_pton(address_family, to_char_ptr(ip_addr), ip_buf) # var raw_ip = ip_buf.bitcast[c_uint]() # print("inet_pton: " + raw_ip.__str__() + " :: status: " + conv_status.__str__()) # var bin_port = htons(UInt16(port)) # print("htons: " + "\n" + bin_port.__str__()) # var ai = sockaddr_in(address_family, bin_port, raw_ip, StaticTuple[c_char, 8]()) # var ai_ptr = UnsafePointer[sockaddr_in].address_of(ai).bitcast[sockaddr]() # var sockfd = socket(address_family, SOCK_STREAM, 0) # if sockfd == -1: # print("Socket creation error") # print("sockfd: " + "\n" + sockfd.__str__()) # if connect(sockfd, ai_ptr, sizeof[sockaddr_in]()) == -1: # _ = shutdown(sockfd, SHUT_RDWR) # print("Connection error") # return # Ensure to exit if connection fails # var msg = to_char_ptr("Hello, world Server") # var bytes_sent = send(sockfd, msg, strlen(msg), 0) # if bytes_sent == -1: # print("Failed to send message") # else: # print("Message sent") # var buf_size = 1024 # var buf = UnsafePointer[UInt8]().alloc(buf_size) # var bytes_recv = recv(sockfd, buf, buf_size, 0) # if bytes_recv == -1: # print("Failed to receive message") # else: # print("Received Message: ") # print(String(buf.bitcast[UInt8](), bytes_recv)) # _ = shutdown(sockfd, SHUT_RDWR) # var close_status = close(sockfd) # if close_status == -1: # print("Failed to close socket") # fn __test_socket_server__() raises: # var ip_addr = "127.0.0.1" # var port = 8083 # var address_family = AF_INET # var ip_buf_size = 4 # if address_family == AF_INET6: # ip_buf_size = 16 # var ip_buf = UnsafePointer[c_void].alloc(ip_buf_size) # var conv_status = inet_pton(address_family, to_char_ptr(ip_addr), ip_buf) # var raw_ip = ip_buf.bitcast[c_uint]() # print("inet_pton: " + raw_ip.__str__() + " :: status: " + conv_status.__str__()) # var bin_port = htons(UInt16(port)) # print("htons: " + "\n" + bin_port.__str__()) # var ai = sockaddr_in(address_family, bin_port, raw_ip, StaticTuple[c_char, 8]()) # var ai_ptr = UnsafePointer[sockaddr_in].address_of(ai).bitcast[sockaddr]() # var sockfd = socket(address_family, SOCK_STREAM, 0) # if sockfd == -1: # print("Socket creation error") # print("sockfd: " + "\n" + sockfd.__str__()) # var yes: Int = 1 # if ( # setsockopt( # sockfd, # SOL_SOCKET, # SO_REUSEADDR, # UnsafePointer[Int].address_of(yes).bitcast[c_void](), # sizeof[Int](), # ) # == -1 # ): # print("set socket options failed") # if bind(sockfd, ai_ptr, sizeof[sockaddr_in]()) == -1: # # close(sockfd) # _ = shutdown(sockfd, SHUT_RDWR) # print("Binding socket failed. Wait a few seconds and try again?") # if listen(sockfd, c_int(128)) == -1: # print("Listen failed.\n on sockfd " + sockfd.__str__()) # print( # "server: started at " # + ip_addr # + ":" # + port.__str__() # + " on sockfd " # + sockfd.__str__() # + "Waiting for connections..." # ) # var their_addr_ptr = UnsafePointer[sockaddr].alloc(1) # var sin_size = socklen_t(sizeof[socklen_t]()) # var new_sockfd = accept( # sockfd, their_addr_ptr, UnsafePointer[socklen_t].address_of(sin_size) # ) # if new_sockfd == -1: # print("Accept failed") # # close(sockfd) # _ = shutdown(sockfd, SHUT_RDWR) # var msg = "Hello, Mojo!" # if send(new_sockfd, to_char_ptr(msg).bitcast[c_void](), len(msg), 0) == -1: # print("Failed to send response") # print("Message sent succesfully") # _ = shutdown(sockfd, SHUT_RDWR) # var close_status = close(new_sockfd) # if close_status == -1: # print("Failed to close new_sockfd") --- external/morrow.mojo --- # From Morrow package https://github.com/mojoto/morrow.mojo/tree/cc6625e16829acc55bcea060dd2ea5d6a4b6c676 # Including like this until better package management is available alias _MAX_TIMESTAMP: Int = 32503737600 alias MAX_TIMESTAMP = _MAX_TIMESTAMP alias MAX_TIMESTAMP_MS = MAX_TIMESTAMP * 1000 alias MAX_TIMESTAMP_US = MAX_TIMESTAMP * 1_000_000 @always_inline fn c_gettimeofday() -> CTimeval: var tv = CTimeval() var p_tv = Pointer[CTimeval].address_of(tv) external_call["gettimeofday", NoneType, Pointer[CTimeval], Int32](p_tv, 0) return tv @always_inline fn c_gmtime(owned tv_sec: Int) -> CTm: var p_tv_sec = Pointer[Int].address_of(tv_sec) var tm = external_call["gmtime", Pointer[CTm], Pointer[Int]](p_tv_sec).load() return tm @always_inline fn c_localtime(owned tv_sec: Int) -> CTm: var p_tv_sec = Pointer[Int].address_of(tv_sec) var tm = external_call["localtime", Pointer[CTm], Pointer[Int]](p_tv_sec).load() return tm @value struct TimeZone: var offset: Int var name: String fn __init__(inout self, offset: Int, name: String = ""): self.offset = offset self.name = name fn __str__(self) -> String: return self.name fn is_none(self) -> Bool: return self.name == "None" @staticmethod fn none() -> TimeZone: return TimeZone(0, "None") @staticmethod fn local() -> TimeZone: var local_t = c_localtime(0) return TimeZone(int(local_t.tm_gmtoff), "local") @staticmethod fn from_utc(utc_str: String) raises -> TimeZone: if len(utc_str) == 0: raise Error("utc_str is empty") if utc_str == "utc" or utc_str == "UTC" or utc_str == "Z": return TimeZone(0, "utc") var p = 3 if len(utc_str) > 3 and utc_str[0:3] == "UTC" else 0 var sign = -1 if utc_str[p] == "-" else 1 if utc_str[p] == "+" or utc_str[p] == "-": p += 1 if ( len(utc_str) < p + 2 or not isdigit(ord(utc_str[p])) or not isdigit(ord(utc_str[p + 1])) ): raise Error("utc_str format is invalid") var hours: Int = atol(utc_str[p : p + 2]) p += 2 var minutes: Int if len(utc_str) <= p: minutes = 0 elif len(utc_str) == p + 3 and utc_str[p] == ":": minutes = atol(utc_str[p + 1 : p + 3]) elif len(utc_str) == p + 2 and isdigit(ord(utc_str[p])): minutes = atol(utc_str[p : p + 2]) else: minutes = 0 raise Error("utc_str format is invalid") var offset: Int = sign * (hours * 3600 + minutes * 60) return TimeZone(offset) fn format(self) -> String: var sign: String var offset_abs: Int if self.offset < 0: sign = "-" offset_abs = -self.offset else: sign = "+" offset_abs = self.offset var hh = offset_abs // 3600 var mm = offset_abs % 3600 return sign + rjust(hh, 2, "0") + ":" + rjust(mm, 2, "0") @value @register_passable("trivial") struct CTm: var tm_sec: Int32 # Seconds var tm_min: Int32 # Minutes var tm_hour: Int32 # Hour var tm_mday: Int32 # Day of the month var tm_mon: Int32 # Month var tm_year: Int32 # Year minus 1900 var tm_wday: Int32 # Day of the week var tm_yday: Int32 # Day of the year var tm_isdst: Int32 # Daylight savings flag var tm_gmtoff: Int64 # localtime zone offset seconds fn __init__() -> Self: return Self { tm_sec: 0, tm_min: 0, tm_hour: 0, tm_mday: 0, tm_mon: 0, tm_year: 0, tm_wday: 0, tm_yday: 0, tm_isdst: 0, tm_gmtoff: 0, } @value struct Morrow: var year: Int var month: Int var day: Int var hour: Int var minute: Int var second: Int var microsecond: Int var tz: TimeZone fn __init__( inout self, year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Int = 0, microsecond: Int = 0, tz: TimeZone = TimeZone.none(), ) raises: self.year = year self.month = month self.day = day self.hour = hour self.minute = minute self.second = second self.microsecond = microsecond self.tz = tz fn __str__(self) raises -> String: return self.isoformat() fn isoformat( self, sep: String = "T", timespec: StringLiteral = "auto" ) raises -> String: """Return the time formatted according to ISO. The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'. If self.tzinfo is not None, the UTC offset is also attached, giving giving a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'. Optional argument sep specifies the separator between date and time, default 'T'. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are 'auto', 'hours', 'minutes', 'seconds', 'milliseconds' and 'microseconds'. """ var date_str = ( rjust(self.year, 4, "0") + "-" + rjust(self.month, 2, "0") + "-" + rjust(self.day, 2, "0") ) var time_str = String("") if timespec == "auto" or timespec == "microseconds": time_str = ( rjust(self.hour, 2, "0") + ":" + rjust(self.minute, 2, "0") + ":" + rjust(self.second, 2, "0") + "." + rjust(self.microsecond, 6, "0") ) elif timespec == "milliseconds": time_str = ( rjust(self.hour, 2, "0") + ":" + rjust(self.minute, 2, "0") + ":" + rjust(self.second, 2, "0") + "." + rjust(self.microsecond // 1000, 3, "0") ) elif timespec == "seconds": time_str = ( rjust(self.hour, 2, "0") + ":" + rjust(self.minute, 2, "0") + ":" + rjust(self.second, 2, "0") ) elif timespec == "minutes": time_str = rjust(self.hour, 2, "0") + ":" + rjust(self.minute, 2, "0") elif timespec == "hours": time_str = rjust(self.hour, 2, "0") else: raise Error() if self.tz.is_none(): return sep.join(date_str, time_str) else: return sep.join(date_str, time_str) + self.tz.format() @staticmethod fn now() raises -> Self: var t = c_gettimeofday() return Self._fromtimestamp(t, False) @staticmethod fn utcnow() raises -> Self: var t = c_gettimeofday() return Self._fromtimestamp(t, True) @staticmethod fn _fromtimestamp(t: CTimeval, utc: Bool) raises -> Self: var tm: CTm var tz: TimeZone if utc: tm = c_gmtime(t.tv_sec) tz = TimeZone(0, "UTC") else: tm = c_localtime(t.tv_sec) tz = TimeZone(int(tm.tm_gmtoff), "local") var result = Self( int(tm.tm_year) + 1900, int(tm.tm_mon) + 1, int(tm.tm_mday), int(tm.tm_hour), int(tm.tm_min), int(tm.tm_sec), t.tv_usec, tz, ) return result @staticmethod fn fromtimestamp(timestamp: Float64) raises -> Self: var timestamp_ = normalize_timestamp(timestamp) var t = CTimeval(int(timestamp_)) return Self._fromtimestamp(t, False) @staticmethod fn utcfromtimestamp(timestamp: Float64) raises -> Self: var timestamp_ = normalize_timestamp(timestamp) var t = CTimeval(int(timestamp_)) return Self._fromtimestamp(t, True) @value @register_passable("trivial") struct CTimeval: var tv_sec: Int # Seconds var tv_usec: Int # Microseconds fn __init__(tv_sec: Int = 0, tv_usec: Int = 0) -> Self: return Self {tv_sec: tv_sec, tv_usec: tv_usec} def normalize_timestamp(timestamp: Float64) -> Float64: """Normalize millisecond and microsecond timestamps into normal timestamps.""" if timestamp > MAX_TIMESTAMP: if timestamp < MAX_TIMESTAMP_MS: timestamp /= 1000 elif timestamp < MAX_TIMESTAMP_US: timestamp /= 1_000_000 else: raise Error( "The specified timestamp " + timestamp.__str__() + "is too large." ) return timestamp fn _repeat_string(string: String, n: Int) -> String: var result: String = "" for _ in range(n): result += string return result fn rjust(string: String, width: Int, fillchar: String = " ") -> String: var extra = width - len(string) return _repeat_string(fillchar, extra) + string fn rjust(string: Int, width: Int, fillchar: String = " ") -> String: return rjust(string.__str__(), width, fillchar) --- lightbug.🔥 --- from lightbug_http import * fn main() raises: var server = SysServer() var handler = Welcome() server.listen_and_serve("0.0.0.0:8080", handler) --- lightbug_http/__init__.mojo --- from lightbug_http.http import HTTPRequest, HTTPResponse, OK from lightbug_http.service import HTTPService, Welcome from lightbug_http.sys.server import SysServer from lightbug_http.tests.run import run_tests trait DefaultConstructible: fn __init__(inout self) raises: ... --- lightbug_http/client.mojo --- from lightbug_http.http import HTTPRequest, HTTPResponse trait Client: fn __init__(inout self) raises: ... fn __init__(inout self, host: StringLiteral, port: Int) raises: ... fn do(self, req: HTTPRequest) raises -> HTTPResponse: ... --- lightbug_http/error.mojo --- from lightbug_http.http import HTTPResponse from lightbug_http.header import ResponseHeader from lightbug_http.io.bytes import bytes # TODO: Custom error handlers provided by the user @value struct ErrorHandler: fn Error(self) -> HTTPResponse: return HTTPResponse(ResponseHeader(), bytes("TODO")) --- lightbug_http/header.mojo --- from external.gojo.bufio import Reader from lightbug_http.strings import ( strHttp11, strHttp10, strSlash, strMethodGet, rChar, nChar, colonChar, whitespace, tab ) from lightbug_http.io.bytes import Bytes, Byte, BytesView, bytes_equal, bytes, index_byte, compare_case_insensitive, next_line, last_index_byte alias statusOK = 200 @value struct RequestHeader: var disable_normalization: Bool var no_http_1_1: Bool var __connection_close: Bool var __content_length: Int var __content_length_bytes: Bytes var __method: Bytes var __request_uri: Bytes var proto: Bytes var __host: Bytes var __content_type: Bytes var __user_agent: Bytes var __transfer_encoding: Bytes var raw_headers: Bytes var __trailer: Bytes fn __init__(inout self) -> None: self.disable_normalization = False self.no_http_1_1 = False self.__connection_close = False self.__content_length = 0 self.__content_length_bytes = Bytes() self.__method = Bytes() self.__request_uri = Bytes() self.proto = Bytes() self.__host = Bytes() self.__content_type = Bytes() self.__user_agent = Bytes() self.__transfer_encoding = Bytes() self.raw_headers = Bytes() self.__trailer = Bytes() fn __init__(inout self, host: String) -> None: self.disable_normalization = False self.no_http_1_1 = False self.__connection_close = False self.__content_length = 0 self.__content_length_bytes = Bytes() self.__method = Bytes() self.__request_uri = Bytes() self.proto = Bytes() self.__host = bytes(host) self.__content_type = Bytes() self.__user_agent = Bytes() self.__transfer_encoding = Bytes() self.raw_headers = Bytes() self.__trailer = Bytes() fn __init__(inout self, rawheaders: Bytes) -> None: self.disable_normalization = False self.no_http_1_1 = False self.__connection_close = False self.__content_length = 0 self.__content_length_bytes = Bytes() self.__method = Bytes() self.__request_uri = Bytes() self.proto = Bytes() self.__host = Bytes() self.__content_type = Bytes() self.__user_agent = Bytes() self.__transfer_encoding = Bytes() self.raw_headers = rawheaders self.__trailer = Bytes() fn __init__( inout self, disable_normalization: Bool, no_http_1_1: Bool, connection_close: Bool, content_length: Int, content_length_bytes: Bytes, method: Bytes, request_uri: Bytes, proto: Bytes, host: Bytes, content_type: Bytes, user_agent: Bytes, transfer_encoding: Bytes, raw_headers: Bytes, trailer: Bytes, ) -> None: self.disable_normalization = disable_normalization self.no_http_1_1 = no_http_1_1 self.__connection_close = connection_close self.__content_length = content_length self.__content_length_bytes = content_length_bytes self.__method = method self.__request_uri = request_uri self.proto = proto self.__host = host self.__content_type = content_type self.__user_agent = user_agent self.__transfer_encoding = transfer_encoding self.raw_headers = raw_headers self.__trailer = trailer fn set_content_type(inout self, content_type: String) -> Self: self.__content_type = bytes(content_type) return self fn set_content_type_bytes(inout self, content_type: Bytes) -> Self: self.__content_type = content_type return self fn content_type(self) -> BytesView: return BytesView(unsafe_ptr=self.__content_type.unsafe_ptr(), len=self.__content_type.size) fn set_host(inout self, host: String) -> Self: self.__host = bytes(host) return self fn set_host_bytes(inout self, host: Bytes) -> Self: self.__host = host return self fn host(self) -> BytesView: return BytesView(unsafe_ptr=self.__host.unsafe_ptr(), len=self.__host.size) fn set_user_agent(inout self, user_agent: String) -> Self: self.__user_agent = bytes(user_agent) return self fn set_user_agent_bytes(inout self, user_agent: Bytes) -> Self: self.__user_agent = user_agent return self fn user_agent(self) -> BytesView: return BytesView(unsafe_ptr=self.__user_agent.unsafe_ptr(), len=self.__user_agent.size) fn set_method(inout self, method: String) -> Self: self.__method = bytes(method) return self fn set_method_bytes(inout self, method: Bytes) -> Self: self.__method = method return self fn method(self) -> BytesView: if len(self.__method) == 0: return strMethodGet.as_bytes_slice() return BytesView(unsafe_ptr=self.__method.unsafe_ptr(), len=self.__method.size) fn set_protocol(inout self, proto: String) -> Self: self.no_http_1_1 = False # hardcoded until HTTP/2 is supported self.proto = bytes(proto) return self fn set_protocol_bytes(inout self, proto: Bytes) -> Self: self.no_http_1_1 = False # hardcoded until HTTP/2 is supported self.proto = proto return self fn protocol_str(self) -> String: if len(self.proto) == 0: return strHttp11 return String(self.proto) fn protocol(self) -> BytesView: if len(self.proto) == 0: return strHttp11.as_bytes_slice() return BytesView(unsafe_ptr=self.proto.unsafe_ptr(), len=self.proto.size) fn content_length(self) -> Int: return self.__content_length fn set_content_length(inout self, content_length: Int) -> Self: self.__content_length = content_length return self fn set_content_length_bytes(inout self, content_length: Bytes) -> Self: self.__content_length_bytes = content_length return self fn set_request_uri(inout self, request_uri: String) -> Self: self.__request_uri = request_uri.as_bytes_slice() return self fn set_request_uri_bytes(inout self, request_uri: Bytes) -> Self: self.__request_uri = request_uri return self fn request_uri(self) -> BytesView: if len(self.__request_uri) <= 1: return BytesView(unsafe_ptr=strSlash.as_bytes_slice().unsafe_ptr(), len=2) return BytesView(unsafe_ptr=self.__request_uri.unsafe_ptr(), len=self.__request_uri.size) fn set_transfer_encoding(inout self, transfer_encoding: String) -> Self: self.__transfer_encoding = bytes(transfer_encoding) return self fn set_transfer_encoding_bytes(inout self, transfer_encoding: Bytes) -> Self: self.__transfer_encoding = transfer_encoding return self fn transfer_encoding(self) -> BytesView: return BytesView(unsafe_ptr=self.__transfer_encoding.unsafe_ptr(), len=self.__transfer_encoding.size) fn set_trailer(inout self, trailer: String) -> Self: self.__trailer = bytes(trailer) return self fn set_trailer_bytes(inout self, trailer: Bytes) -> Self: self.__trailer = trailer return self fn trailer(self) -> BytesView: return BytesView(unsafe_ptr=self.__trailer.unsafe_ptr(), len=self.__trailer.size) fn trailer_str(self) -> String: return String(self.__trailer) fn set_connection_close(inout self) -> Self: self.__connection_close = True return self fn reset_connection_close(inout self) -> Self: if self.__connection_close == False: return self else: self.__connection_close = False return self fn connection_close(self) -> Bool: return self.__connection_close fn headers(self) -> String: return String(self.raw_headers) fn parse_raw(inout self, inout r: Reader) raises -> Int: var first_byte = r.peek(1) if len(first_byte) == 0: raise Error("Failed to read first byte from request header") var buf: Bytes var e: Error buf, e = r.peek(r.buffered()) if e: raise Error("Failed to read request header: " + e.__str__()) if len(buf) == 0: raise Error("Failed to read request header, empty buffer") var end_of_first_line = self.parse_first_line(buf) var header_len = self.read_raw_headers(buf[end_of_first_line:]) self.parse_headers(buf[end_of_first_line:]) return end_of_first_line + header_len fn parse_first_line(inout self, buf: Bytes) raises -> Int: var b_next = buf var b = Bytes() while len(b) == 0: try: b, b_next = next_line(b_next) except e: raise Error("Failed to read first line from request, " + e.__str__()) var first_whitespace = index_byte(b, bytes(whitespace, pop=False)[0]) if first_whitespace <= 0: raise Error("Could not find HTTP request method in request line: " + String(b)) _ = self.set_method_bytes(b[:first_whitespace]) var last_whitespace = last_index_byte(b, bytes(whitespace, pop=False)[0]) + 1 if last_whitespace < 0: raise Error("Could not find request target or HTTP version in request line: " + String(b)) elif last_whitespace == 0: raise Error("Request URI is empty: " + String(b)) var proto = b[last_whitespace :] if len(proto) != len(bytes(strHttp11, pop=False)): raise Error("Invalid protocol, HTTP version not supported: " + String(proto)) _ = self.set_protocol_bytes(proto) _ = self.set_request_uri_bytes(b[first_whitespace+1:last_whitespace]) return len(buf) - len(b_next) fn parse_headers(inout self, buf: Bytes) raises -> None: _ = self.set_content_length(-2) var s = headerScanner() s.set_b(buf) while s.next(): if len(s.key()) > 0: self.parse_header(s.key(), s.value()) fn parse_header(inout self, key: Bytes, value: Bytes) raises -> None: if index_byte(key, bytes(colonChar, pop=False)[0]) == -1 or index_byte(key, bytes(tab, pop=False)[0]) != -1: raise Error("Invalid header key: " + String(key)) var key_first = key[0].__xor__(0x20) if key_first == bytes("h", pop=False)[0] or key_first == bytes("H", pop=False)[0]: if compare_case_insensitive(key, bytes("host", pop=False)): _ = self.set_host_bytes(bytes(value)) return elif key_first == bytes("u", pop=False)[0] or key_first == bytes("U", pop=False)[0]: if compare_case_insensitive(key, bytes("user-agent", pop=False)): _ = self.set_user_agent_bytes(bytes(value)) return elif key_first == bytes("c", pop=False)[0] or key_first == bytes("C", pop=False)[0]: if compare_case_insensitive(key, bytes("content-type", pop=False)): _ = self.set_content_type_bytes(bytes(value)) return if compare_case_insensitive(key, bytes("content-length", pop=False)): if self.content_length() != -1: _ = self.set_content_length(atol(value)) return if compare_case_insensitive(key, bytes("connection", pop=False)): if compare_case_insensitive(bytes(value), bytes("close", pop=False)): _ = self.set_connection_close() else: _ = self.reset_connection_close() return elif key_first == bytes("t", pop=False)[0] or key_first == bytes("T", pop=False)[0]: if compare_case_insensitive(key, bytes("transfer-encoding", pop=False)): _ = self.set_transfer_encoding_bytes(bytes(value, pop=False)) return if compare_case_insensitive(key, bytes("trailer", pop=False)): _ = self.set_trailer_bytes(bytes(value, pop=False)) return if self.content_length() < 0: _ = self.set_content_length(0) return fn read_raw_headers(inout self, buf: Bytes) raises -> Int: var n = index_byte(buf, bytes(nChar, pop=False)[0]) if n == -1: self.raw_headers = self.raw_headers[:0] raise Error("Failed to find a newline in headers") if n == 0 or (n == 1 and (buf[0] == bytes(rChar, pop=False)[0])): # empty line -> end of headers return n + 1 n += 1 var b = buf var m = n while True: b = b[m:] m = index_byte(b, bytes(nChar, pop=False)[0]) if m == -1: raise Error("Failed to find a newline in headers") m += 1 n += m if m == 2 and (b[0] == bytes(rChar, pop=False)[0]) or m == 1: self.raw_headers = self.raw_headers + buf[:n] return n @value struct ResponseHeader: var disable_normalization: Bool var no_http_1_1: Bool var __connection_close: Bool var __status_code: Int var __status_message: Bytes var __protocol: Bytes var __content_length: Int var __content_length_bytes: Bytes var __content_type: Bytes var __content_encoding: Bytes var __server: Bytes var __trailer: Bytes var raw_headers: Bytes fn __init__( inout self, ) -> None: self.disable_normalization = False self.no_http_1_1 = False self.__connection_close = False self.__status_code = 200 self.__status_message = Bytes() self.__protocol = Bytes() self.__content_length = 0 self.__content_length_bytes = Bytes() self.__content_type = Bytes() self.__content_encoding = Bytes() self.__server = Bytes() self.__trailer = Bytes() self.raw_headers = Bytes() fn __init__( inout self, raw_headers: Bytes, ) -> None: self.disable_normalization = False self.no_http_1_1 = False self.__connection_close = False self.__status_code = 200 self.__status_message = Bytes() self.__protocol = Bytes() self.__content_length = 0 self.__content_length_bytes = Bytes() self.__content_type = Bytes() self.__content_encoding = Bytes() self.__server = Bytes() self.__trailer = Bytes() self.raw_headers = raw_headers fn __init__( inout self, status_code: Int, status_message: Bytes, content_type: Bytes, ) -> None: self.disable_normalization = False self.no_http_1_1 = False self.__connection_close = False self.__status_code = status_code self.__status_message = status_message self.__protocol = Bytes() self.__content_length = 0 self.__content_length_bytes = Bytes() self.__content_type = content_type self.__content_encoding = Bytes() self.__server = Bytes() self.__trailer = Bytes() self.raw_headers = Bytes() fn __init__( inout self, status_code: Int, status_message: Bytes, content_type: Bytes, content_encoding: Bytes, ) -> None: self.disable_normalization = False self.no_http_1_1 = False self.__connection_close = False self.__status_code = status_code self.__status_message = status_message self.__protocol = Bytes() self.__content_length = 0 self.__content_length_bytes = Bytes() self.__content_type = content_type self.__content_encoding = content_encoding self.__server = Bytes() self.__trailer = Bytes() self.raw_headers = Bytes() fn __init__( inout self, connection_close: Bool, status_code: Int, status_message: Bytes, content_type: Bytes, ) -> None: self.disable_normalization = False self.no_http_1_1 = False self.__connection_close = connection_close self.__status_code = status_code self.__status_message = status_message self.__protocol = Bytes() self.__content_length = 0 self.__content_length_bytes = Bytes() self.__content_type = content_type self.__content_encoding = Bytes() self.__server = Bytes() self.__trailer = Bytes() self.raw_headers = Bytes() fn __init__( inout self, disable_normalization: Bool, no_http_1_1: Bool, connection_close: Bool, status_code: Int, status_message: Bytes, protocol: Bytes, content_length: Int, content_length_bytes: Bytes, content_type: Bytes, content_encoding: Bytes, server: Bytes, trailer: Bytes, ) -> None: self.disable_normalization = disable_normalization self.no_http_1_1 = no_http_1_1 self.__connection_close = connection_close self.__status_code = status_code self.__status_message = status_message self.__protocol = protocol self.__content_length = content_length self.__content_length_bytes = content_length_bytes self.__content_type = content_type self.__content_encoding = content_encoding self.__server = server self.__trailer = trailer self.raw_headers = Bytes() fn set_status_code(inout self, code: Int) -> Self: self.__status_code = code return self fn status_code(self) -> Int: if self.__status_code == 0: return statusOK return self.__status_code fn set_status_message(inout self, message: Bytes) -> Self: self.__status_message = message return self fn status_message(self) -> BytesView: return BytesView(unsafe_ptr=self.__status_message.unsafe_ptr(), len=self.__status_message.size) fn status_message_str(self) -> String: return String(self.status_message()) fn content_type(self) -> BytesView: return BytesView(unsafe_ptr=self.__content_type.unsafe_ptr(), len=self.__content_type.size) fn set_content_type(inout self, content_type: String) -> Self: self.__content_type = bytes(content_type) return self fn set_content_type_bytes(inout self, content_type: Bytes) -> Self: self.__content_type = content_type return self fn content_encoding(self) -> BytesView: return BytesView(unsafe_ptr=self.__content_encoding.unsafe_ptr(), len=self.__content_encoding.size) fn set_content_encoding(inout self, content_encoding: String) -> Self: self.__content_encoding = bytes(content_encoding) return self fn set_content_encoding_bytes(inout self, content_encoding: Bytes) -> Self: self.__content_encoding = content_encoding return self fn content_length(self) -> Int: return self.__content_length fn set_content_length(inout self, content_length: Int) -> Self: self.__content_length = content_length return self fn set_content_length_bytes(inout self, content_length: Bytes) -> Self: self.__content_length_bytes = content_length return self fn server(self) -> BytesView: return BytesView(unsafe_ptr=self.__server.unsafe_ptr(), len=self.__server.size) fn set_server(inout self, server: String) -> Self: self.__server = bytes(server) return self fn set_server_bytes(inout self, server: Bytes) -> Self: self.__server = server return self fn set_protocol(inout self, proto: String) -> Self: self.no_http_1_1 = False # hardcoded until HTTP/2 is supported self.__protocol = bytes(proto) return self fn set_protocol_bytes(inout self, protocol: Bytes) -> Self: self.no_http_1_1 = False # hardcoded until HTTP/2 is supported self.__protocol = protocol return self fn protocol_str(self) -> String: if len(self.__protocol) == 0: return strHttp11 return String(self.__protocol) fn protocol(self) -> BytesView: if len(self.__protocol) == 0: return BytesView(unsafe_ptr=strHttp11.as_bytes_slice().unsafe_ptr(), len=8) return BytesView(unsafe_ptr=self.__protocol.unsafe_ptr(), len=self.__protocol.size) fn set_trailer(inout self, trailer: String) -> Self: self.__trailer = bytes(trailer) return self fn set_trailer_bytes(inout self, trailer: Bytes) -> Self: self.__trailer = trailer return self fn trailer(self) -> BytesView: return BytesView(unsafe_ptr=self.__trailer.unsafe_ptr(), len=self.__trailer.size) fn trailer_str(self) -> String: return String(self.trailer()) fn set_connection_close(inout self) -> Self: self.__connection_close = True return self fn reset_connection_close(inout self) -> Self: if self.__connection_close == False: return self else: self.__connection_close = False return self fn connection_close(self) -> Bool: return self.__connection_close fn headers(self) -> String: return String(self.raw_headers) fn parse_raw(inout self, inout r: Reader) raises -> Int: var first_byte = r.peek(1) if len(first_byte) == 0: raise Error("Failed to read first byte from response header") var buf: Bytes var e: Error buf, e = r.peek(r.buffered()) if e: raise Error("Failed to read response header: " + e.__str__()) if len(buf) == 0: raise Error("Failed to read response header, empty buffer") var end_of_first_line = self.parse_first_line(buf) var header_len = self.read_raw_headers(buf[end_of_first_line:]) self.parse_headers(buf[end_of_first_line:]) return end_of_first_line + header_len fn parse_first_line(inout self, buf: Bytes) raises -> Int: var b_next = buf var b = Bytes() while len(b) == 0: try: b, b_next = next_line(b_next) except e: raise Error("Failed to read first line from response, " + e.__str__()) var first_whitespace = index_byte(b, bytes(whitespace, pop=False)[0]) if first_whitespace <= 0: raise Error("Could not find HTTP version in response line: " + String(b)) _ = self.set_protocol(b[:first_whitespace+2]) var end_of_status_code = first_whitespace+5 # status code is always 3 digits, this calculation includes null terminator var status_code = atol(b[first_whitespace+1:end_of_status_code]) _ = self.set_status_code(status_code) var status_text = b[end_of_status_code :] if len(status_text) > 1: _ = self.set_status_message(status_text) return len(buf) - len(b_next) fn parse_headers(inout self, buf: Bytes) raises -> None: _ = self.set_content_length(-2) var s = headerScanner() s.set_b(buf) while s.next(): if len(s.key()) > 0: self.parse_header(s.key(), s.value()) fn parse_header(inout self, key: Bytes, value: Bytes) raises -> None: if index_byte(key, bytes(colonChar, pop=False)[0]) == -1 or index_byte(key, bytes(tab, pop=False)[0]) != -1: raise Error("Invalid header key: " + String(key)) var key_first = key[0].__xor__(0x20) if key_first == bytes("c", pop=False)[0] or key_first == bytes("C", pop=False)[0]: if compare_case_insensitive(key, bytes("content-type", pop=False)): _ = self.set_content_type_bytes(bytes(value)) return if compare_case_insensitive(key, bytes("content-encoding", pop=False)): _ = self.set_content_encoding_bytes(bytes(value)) return if compare_case_insensitive(key, bytes("content-length", pop=False)): if self.content_length() != -1: var content_length = value _ = self.set_content_length(atol(content_length)) _ = self.set_content_length_bytes(bytes(content_length)) return if compare_case_insensitive(key, bytes("connection", pop=False)): if compare_case_insensitive(bytes(value), bytes("close", pop=False)): _ = self.set_connection_close() else: _ = self.reset_connection_close() return elif key_first == bytes("s", pop=False)[0] or key_first == bytes("S", pop=False)[0]: if compare_case_insensitive(key, bytes("server", pop=False)): _ = self.set_server_bytes(bytes(value)) return elif key_first == bytes("t", pop=False)[0] or key_first == bytes("T", pop=False)[0]: if compare_case_insensitive(key, bytes("transfer-encoding", pop=False)): if not compare_case_insensitive(value, bytes("identity", pop=False)): _ = self.set_content_length(-1) return if compare_case_insensitive(key, bytes("trailer", pop=False)): _ = self.set_trailer_bytes(bytes(value)) fn read_raw_headers(inout self, buf: Bytes) raises -> Int: var n = index_byte(buf, bytes(nChar, pop=False)[0]) if n == -1: self.raw_headers = self.raw_headers[:0] raise Error("Failed to find a newline in headers") if n == 0 or (n == 1 and (buf[0] == bytes(rChar, pop=False)[0])): # empty line -> end of headers return n + 1 n += 1 var b = buf var m = n while True: b = b[m:] m = index_byte(b, bytes(nChar, pop=False)[0]) if m == -1: raise Error("Failed to find a newline in headers") m += 1 n += m if m == 2 and (b[0] == bytes(rChar, pop=False)[0]) or m == 1: self.raw_headers = self.raw_headers + buf[:n] return n struct headerScanner: var __b: Bytes var __key: Bytes var __value: Bytes var __subslice_len: Int var disable_normalization: Bool var __next_colon: Int var __next_line: Int var __initialized: Bool fn __init__(inout self) -> None: self.__b = Bytes() self.__key = Bytes() self.__value = Bytes() self.__subslice_len = 0 self.disable_normalization = False self.__next_colon = 0 self.__next_line = 0 self.__initialized = False fn b(self) -> Bytes: return self.__b fn set_b(inout self, b: Bytes) -> None: self.__b = b fn key(self) -> Bytes: return self.__key fn set_key(inout self, key: Bytes) -> None: self.__key = key fn value(self) -> Bytes: return self.__value fn set_value(inout self, value: Bytes) -> None: self.__value = value fn subslice_len(self) -> Int: return self.__subslice_len fn set_subslice_len(inout self, n: Int) -> None: self.__subslice_len = n fn next_colon(self) -> Int: return self.__next_colon fn set_next_colon(inout self, n: Int) -> None: self.__next_colon = n fn next_line(self) -> Int: return self.__next_line fn set_next_line(inout self, n: Int) -> None: self.__next_line = n fn initialized(self) -> Bool: return self.__initialized fn set_initialized(inout self) -> None: self.__initialized = True fn next(inout self) raises -> Bool: if not self.initialized(): self.set_next_colon(-1) self.set_next_line(-1) self.set_initialized() var b_len = len(self.b()) if b_len >= 2 and (self.b()[0] == bytes(rChar, pop=False)[0]) and (self.b()[1] == bytes(nChar, pop=False)[0]): self.set_b(self.b()[2:]) self.set_subslice_len(2) return False if b_len >= 1 and (self.b()[0] == bytes(nChar, pop=False)[0]): self.set_b(self.b()[1:]) self.set_subslice_len(self.subslice_len() + 1) return False var colon: Int if self.next_colon() >= 0: colon = self.next_colon() self.set_next_colon(-1) else: colon = index_byte(self.b(), bytes(colonChar, pop=False)[0]) var newline = index_byte(self.b(), bytes(nChar, pop=False)[0]) if newline < 0: raise Error("Invalid header, did not find a newline at the end of the header") if newline < colon: raise Error("Invalid header, found a newline before the colon") if colon < 0: raise Error("Invalid header, did not find a colon") var jump_to = colon + 1 self.set_key(self.b()[:jump_to]) while len(self.b()) > jump_to and (self.b()[jump_to] == bytes(whitespace, pop=False)[0]): jump_to += 1 self.set_next_line(self.next_line() - 1) self.set_subslice_len(self.subslice_len() + jump_to) self.set_b(self.b()[jump_to:]) if self.next_line() >= 0: jump_to = self.next_line() self.set_next_line(-1) else: jump_to = index_byte(self.b(), bytes(nChar, pop=False)[0]) if jump_to < 0: raise Error("Invalid header, did not find a newline") jump_to += 1 self.set_value(self.b()[:jump_to]) self.set_subslice_len(self.subslice_len() + jump_to) self.set_b(self.b()[jump_to:]) if jump_to > 0 and (self.value()[jump_to-1] == bytes(rChar, pop=False)[0]): jump_to -= 1 while jump_to > 0 and (self.value()[jump_to-1] == bytes(whitespace, pop=False)[0]): jump_to -= 1 self.set_value(self.value()[:jump_to]) return True --- lightbug_http/http.mojo --- from time import now from external.morrow import Morrow from external.gojo.strings.builder import StringBuilder from external.gojo.bufio import Reader from lightbug_http.uri import URI from lightbug_http.io.bytes import Bytes, BytesView, bytes from lightbug_http.header import RequestHeader, ResponseHeader from lightbug_http.io.sync import Duration from lightbug_http.net import Addr, TCPAddr from lightbug_http.strings import strHttp11, strHttp, strSlash, whitespace, rChar, nChar trait Request: fn __init__(inout self, uri: URI): ... fn __init__( inout self, header: RequestHeader, uri: URI, body: Bytes, parsed_uri: Bool, server_is_tls: Bool, timeout: Duration, disable_redirect_path_normalization: Bool, ): ... fn set_host(inout self, host: String) -> Self: ... fn set_host_bytes(inout self, host: Bytes) -> Self: ... fn host(self) -> String: ... fn set_request_uri(inout self, request_uri: String) -> Self: ... fn set_request_uri_bytes(inout self, request_uri: Bytes) -> Self: ... fn request_uri(inout self) -> String: ... fn set_connection_close(inout self) -> Self: ... fn connection_close(self) -> Bool: ... trait Response: fn __init__(inout self, header: ResponseHeader, body: Bytes): ... fn set_status_code(inout self, status_code: Int) -> Self: ... fn status_code(self) -> Int: ... fn set_connection_close(inout self) -> Self: ... fn connection_close(self) -> Bool: ... @value struct HTTPRequest(Request): var header: RequestHeader var __uri: URI var body_raw: Bytes var parsed_uri: Bool var server_is_tls: Bool var timeout: Duration var disable_redirect_path_normalization: Bool fn __init__(inout self, uri: URI): self.header = RequestHeader("127.0.0.1") self.__uri = uri self.body_raw = Bytes() self.parsed_uri = False self.server_is_tls = False self.timeout = Duration() self.disable_redirect_path_normalization = False fn __init__(inout self, uri: URI, headers: RequestHeader): self.header = headers self.__uri = uri self.body_raw = Bytes() self.parsed_uri = False self.server_is_tls = False self.timeout = Duration() self.disable_redirect_path_normalization = False fn __init__(inout self, uri: URI, buf: Bytes, headers: RequestHeader): self.header = headers self.__uri = uri self.body_raw = buf self.parsed_uri = False self.server_is_tls = False self.timeout = Duration() self.disable_redirect_path_normalization = False fn __init__( inout self, header: RequestHeader, uri: URI, body: Bytes, parsed_uri: Bool, server_is_tls: Bool, timeout: Duration, disable_redirect_path_normalization: Bool, ): self.header = header self.__uri = uri self.body_raw = body self.parsed_uri = parsed_uri self.server_is_tls = server_is_tls self.timeout = timeout self.disable_redirect_path_normalization = disable_redirect_path_normalization fn get_body_bytes(self) -> BytesView: return BytesView(unsafe_ptr=self.body_raw.unsafe_ptr(), len=self.body_raw.size) fn set_body_bytes(inout self, body: Bytes) -> Self: self.body_raw = body return self fn set_host(inout self, host: String) -> Self: _ = self.__uri.set_host(host) return self fn set_host_bytes(inout self, host: Bytes) -> Self: _ = self.__uri.set_host_bytes(host) return self fn host(self) -> String: return self.__uri.host_str() fn set_request_uri(inout self, request_uri: String) -> Self: _ = self.header.set_request_uri(request_uri.as_bytes()) self.parsed_uri = False return self fn set_request_uri_bytes(inout self, request_uri: Bytes) -> Self: _ = self.header.set_request_uri_bytes(request_uri) return self fn request_uri(inout self) -> String: if self.parsed_uri: _ = self.set_request_uri_bytes(self.__uri.request_uri()) return self.header.request_uri() fn uri(self) -> URI: return self.__uri fn set_connection_close(inout self) -> Self: _ = self.header.set_connection_close() return self fn connection_close(self) -> Bool: return self.header.connection_close() fn read_body(inout self, inout r: Reader, content_length: Int, header_len: Int, max_body_size: Int) raises -> None: if content_length > max_body_size: raise Error("Request body too large") _ = r.discard(header_len) var body_buf: Bytes body_buf, _ = r.peek(r.buffered()) _ = self.set_body_bytes(bytes(body_buf)) @value struct HTTPResponse(Response): var header: ResponseHeader var stream_immediate_header_flush: Bool var stream_body: Bool var body_raw: Bytes var skip_reading_writing_body: Bool var raddr: TCPAddr var laddr: TCPAddr fn __init__(inout self, body_bytes: Bytes): self.header = ResponseHeader( 200, bytes("OK"), bytes("application/octet-stream"), ) self.stream_immediate_header_flush = False self.stream_body = False self.body_raw = body_bytes self.skip_reading_writing_body = False self.raddr = TCPAddr() self.laddr = TCPAddr() fn __init__(inout self, header: ResponseHeader, body_bytes: Bytes): self.header = header self.stream_immediate_header_flush = False self.stream_body = False self.body_raw = body_bytes self.skip_reading_writing_body = False self.raddr = TCPAddr() self.laddr = TCPAddr() fn get_body_bytes(self) -> BytesView: return BytesView(unsafe_ptr=self.body_raw.unsafe_ptr(), len=self.body_raw.size) fn get_body(self) -> Bytes: return self.body_raw fn set_body_bytes(inout self, body: Bytes) -> Self: self.body_raw = body return self fn set_status_code(inout self, status_code: Int) -> Self: _ = self.header.set_status_code(status_code) return self fn status_code(self) -> Int: return self.header.status_code() fn set_connection_close(inout self) -> Self: _ = self.header.set_connection_close() return self fn connection_close(self) -> Bool: return self.header.connection_close() fn read_body(inout self, inout r: Reader, header_len: Int) raises -> None: _ = r.discard(header_len) var body_buf: Bytes body_buf, _ = r.peek(r.buffered()) _ = self.set_body_bytes(bytes(body_buf)) fn OK(body: StringLiteral) -> HTTPResponse: return HTTPResponse( ResponseHeader(200, bytes("OK"), bytes("text/plain")), bytes(body), ) fn OK(body: StringLiteral, content_type: String) -> HTTPResponse: return HTTPResponse( ResponseHeader(200, bytes("OK"), bytes(content_type)), bytes(body), ) fn OK(body: String) -> HTTPResponse: return HTTPResponse( ResponseHeader(200, bytes("OK"), bytes("text/plain")), bytes(body), ) fn OK(body: String, content_type: String) -> HTTPResponse: return HTTPResponse( ResponseHeader(200, bytes("OK"), bytes(content_type)), bytes(body), ) fn OK(body: Bytes) -> HTTPResponse: return HTTPResponse( ResponseHeader(200, bytes("OK"), bytes("text/plain")), body, ) fn OK(body: Bytes, content_type: String) -> HTTPResponse: return HTTPResponse( ResponseHeader(200, bytes("OK"), bytes(content_type)), body, ) fn OK(body: Bytes, content_type: String, content_encoding: String) -> HTTPResponse: return HTTPResponse( ResponseHeader(200, bytes("OK"), bytes(content_type), bytes(content_encoding)), body, ) fn NotFound(path: String) -> HTTPResponse: return HTTPResponse( ResponseHeader(404, bytes("Not Found"), bytes("text/plain")), bytes("path " + path + " not found"), ) fn encode(req: HTTPRequest) raises -> StringSlice[False, ImmutableStaticLifetime]: var builder = StringBuilder() _ = builder.write(req.header.method()) _ = builder.write_string(whitespace) if len(req.uri().path_bytes()) > 1: _ = builder.write_string(req.uri().path()) else: _ = builder.write_string(strSlash) _ = builder.write_string(whitespace) _ = builder.write(req.header.protocol()) _ = builder.write_string(rChar) _ = builder.write_string(nChar) if len(req.header.host()) > 0: _ = builder.write_string("Host: ") _ = builder.write(req.header.host()) _ = builder.write_string(rChar) _ = builder.write_string(nChar) if len(req.body_raw) > 0: if len(req.header.content_type()) > 0: _ = builder.write_string("Content-Type: ") _ = builder.write(req.header.content_type()) _ = builder.write_string(rChar) _ = builder.write_string(nChar) _ = builder.write_string("Content-Length: ") _ = builder.write_string(len(req.body_raw).__str__()) _ = builder.write_string(rChar) _ = builder.write_string(nChar) _ = builder.write_string("Connection: ") if req.connection_close(): _ = builder.write_string("close") else: _ = builder.write_string("keep-alive") _ = builder.write_string(rChar) _ = builder.write_string(nChar) _ = builder.write_string(rChar) _ = builder.write_string(nChar) if len(req.body_raw) > 0: _ = builder.write(req.get_body_bytes()) return StringSlice[False, ImmutableStaticLifetime](unsafe_from_utf8_ptr=builder.render().unsafe_ptr(), len=builder.size) fn encode(res: HTTPResponse) raises -> Bytes: var current_time = String() try: current_time = Morrow.utcnow().__str__() except e: print("Error getting current time: " + str(e)) current_time = str(now()) var builder = StringBuilder() _ = builder.write(res.header.protocol()) _ = builder.write_string(whitespace) _ = builder.write_string(res.header.status_code().__str__()) _ = builder.write_string(whitespace) _ = builder.write(res.header.status_message()) _ = builder.write_string(rChar) _ = builder.write_string(nChar) _ = builder.write_string("Server: lightbug_http") _ = builder.write_string(rChar) _ = builder.write_string(nChar) _ = builder.write_string("Content-Type: ") _ = builder.write(res.header.content_type()) _ = builder.write_string(rChar) _ = builder.write_string(nChar) if len(res.header.content_encoding()) > 0: _ = builder.write_string("Content-Encoding: ") _ = builder.write(res.header.content_encoding()) _ = builder.write_string(rChar) _ = builder.write_string(nChar) if len(res.body_raw) > 0: _ = builder.write_string("Content-Length: ") _ = builder.write_string(len(res.body_raw).__str__()) _ = builder.write_string(rChar) _ = builder.write_string(nChar) else: _ = builder.write_string("Content-Length: 0") _ = builder.write_string(rChar) _ = builder.write_string(nChar) _ = builder.write_string("Connection: ") if res.connection_close(): _ = builder.write_string("close") else: _ = builder.write_string("keep-alive") _ = builder.write_string(rChar) _ = builder.write_string(nChar) _ = builder.write_string("Date: ") _ = builder.write_string(current_time) _ = builder.write_string(rChar) _ = builder.write_string(nChar) _ = builder.write_string(rChar) _ = builder.write_string(nChar) if len(res.body_raw) > 0: _ = builder.write(res.get_body_bytes()) return builder.render().as_bytes_slice() fn split_http_string(buf: Bytes) raises -> (String, String, String): var request = String(buf) var request_first_line_headers_body = request.split("\r\n\r\n") if len(request_first_line_headers_body) == 0: raise Error("Invalid HTTP string, did not find a double newline") var request_first_line_headers = request_first_line_headers_body[0] var request_body = String() if len(request_first_line_headers_body) > 1: request_body = request_first_line_headers_body[1] var request_first_line_headers_list = request_first_line_headers.split("\r\n", 1) var request_first_line = String() var request_headers = String() if len(request_first_line_headers_list) == 0: raise Error("Invalid HTTP string, did not find a newline in the first line") if len(request_first_line_headers_list) == 1: request_first_line = request_first_line_headers_list[0] else: request_first_line = request_first_line_headers_list[0] request_headers = request_first_line_headers_list[1] return (request_first_line, request_headers, request_body) --- lightbug_http/io/__init__.mojo --- --- lightbug_http/io/bytes.mojo --- from python import PythonObject from lightbug_http.strings import nChar, rChar alias Byte = UInt8 alias Bytes = List[Byte] alias BytesView = Span[is_mutable=False, T=Byte, lifetime=ImmutableStaticLifetime] fn bytes(s: StringLiteral, pop: Bool = True) -> Bytes: # This is currently null-terminated, which we don't want in HTTP responses var buf = String(s)._buffer if pop: _ = buf.pop() return buf fn bytes(s: String, pop: Bool = True) -> Bytes: # This is currently null-terminated, which we don't want in HTTP responses var buf = s._buffer if pop: _ = buf.pop() return buf fn bytes_equal(a: Bytes, b: Bytes) -> Bool: return String(a) == String(b) fn index_byte(buf: Bytes, c: Byte) -> Int: for i in range(len(buf)): if buf[i] == c: return i return -1 fn last_index_byte(buf: Bytes, c: Byte) -> Int: for i in range(len(buf)-1, -1, -1): if buf[i] == c: return i return -1 fn compare_case_insensitive(a: Bytes, b: Bytes) -> Bool: if len(a) != len(b): return False for i in range(len(a) - 1): if (a[i] | 0x20) != (b[i] | 0x20): return False return True fn next_line(b: Bytes) raises -> (Bytes, Bytes): var n_next = index_byte(b, bytes(nChar, pop=False)[0]) if n_next < 0: raise Error("next_line: newline not found") var n = n_next if n > 0 and (b[n-1] == bytes(rChar, pop=False)[0]): n -= 1 return (b[:n+1], b[n_next+1:]) @value @register_passable("trivial") struct UnsafeString: var data: Pointer[UInt8] var len: Int fn __init__(str: StringLiteral) -> UnsafeString: var l = str.__len__() var s = String(str) var p = Pointer[UInt8].alloc(l) for i in range(l): p.store(i, s._buffer[i]) return UnsafeString(p, l) fn __init__(str: String) -> UnsafeString: var l = str.__len__() var p = Pointer[UInt8].alloc(l) for i in range(l): p.store(i, str._buffer[i]) return UnsafeString(p, l) fn to_string(self) -> String: var s = String(self.data, self.len) return s --- lightbug_http/io/sync.mojo --- # Time in nanoseconds alias Duration = Int --- lightbug_http/net.mojo --- from lightbug_http.strings import NetworkType from lightbug_http.io.bytes import Bytes from lightbug_http.io.sync import Duration from lightbug_http.sys.net import SysConnection from external.libc import ( c_void, AF_INET, sockaddr, sockaddr_in, socklen_t, getsockname, getpeername, ntohs, inet_ntop ) alias default_buffer_size = 4096 alias default_tcp_keep_alive = Duration(15 * 1000 * 1000 * 1000) # 15 seconds trait Net(DefaultConstructible): fn __init__(inout self) raises: ... fn __init__(inout self, keep_alive: Duration) raises: ... # A listen method should be implemented on structs that implement Net. # Signature is not enforced for now. # fn listen(inout self, network: String, addr: String) raises -> Listener: # ... trait ListenConfig: fn __init__(inout self, keep_alive: Duration) raises: ... # A listen method should be implemented on structs that implement ListenConfig. # Signature is not enforced for now. # fn listen(inout self, network: String, address: String) raises -> Listener: # ... trait Listener(Movable): fn __init__(inout self) raises: ... fn __init__(inout self, addr: TCPAddr) raises: ... fn accept(borrowed self) raises -> SysConnection: ... fn close(self) raises: ... fn addr(self) -> TCPAddr: ... trait Connection(Movable): fn __init__(inout self, laddr: String, raddr: String) raises: ... fn __init__(inout self, laddr: TCPAddr, raddr: TCPAddr) raises: ... fn read(self, inout buf: Bytes) raises -> Int: ... fn write(self, buf: Bytes) raises -> Int: ... fn close(self) raises: ... fn local_addr(inout self) raises -> TCPAddr: ... fn remote_addr(self) raises -> TCPAddr: ... trait Addr(CollectionElement): fn __init__(inout self): ... fn __init__(inout self, ip: String, port: Int): ... fn network(self) -> String: ... fn string(self) -> String: ... alias TCPAddrList = List[TCPAddr] @value struct TCPAddr(Addr): var ip: String var port: Int var zone: String # IPv6 addressing zone fn __init__(inout self): self.ip = String("127.0.0.1") self.port = 8000 self.zone = "" fn __init__(inout self, ip: String, port: Int): self.ip = ip self.port = port self.zone = "" fn network(self) -> String: return NetworkType.tcp.value fn string(self) -> String: if self.zone != "": return join_host_port(self.ip + "%" + self.zone, self.port.__str__()) return join_host_port(self.ip, self.port.__str__()) fn resolve_internet_addr(network: String, address: String) raises -> TCPAddr: var host: String = "" var port: String = "" var portnum: Int = 0 if ( network == NetworkType.tcp.value or network == NetworkType.tcp4.value or network == NetworkType.tcp6.value or network == NetworkType.udp.value or network == NetworkType.udp4.value or network == NetworkType.udp6.value ): if address != "": var host_port = split_host_port(address) host = host_port.host port = host_port.port portnum = atol(port.__str__()) elif ( network == NetworkType.ip.value or network == NetworkType.ip4.value or network == NetworkType.ip6.value ): if address != "": host = address elif network == NetworkType.unix.value: raise Error("Unix addresses not supported yet") else: raise Error("unsupported network type: " + network) return TCPAddr(host, portnum) fn join_host_port(host: String, port: String) -> String: if host.find(":") != -1: # must be IPv6 literal return "[" + host + "]:" + port return host + ":" + port alias missingPortError = Error("missing port in address") alias tooManyColonsError = Error("too many colons in address") struct HostPort: var host: String var port: String fn __init__(inout self, host: String, port: String): self.host = host self.port = port fn split_host_port(hostport: String) raises -> HostPort: var host: String = "" var port: String = "" var colon_index = hostport.rfind(":") var j: Int = 0 var k: Int = 0 if colon_index == -1: raise missingPortError if hostport[0] == "[": var end_bracket_index = hostport.find("]") if end_bracket_index == -1: raise Error("missing ']' in address") if end_bracket_index + 1 == len(hostport): raise missingPortError elif end_bracket_index + 1 == colon_index: host = hostport[1:end_bracket_index] j = 1 k = end_bracket_index + 1 else: if hostport[end_bracket_index + 1] == ":": raise tooManyColonsError else: raise missingPortError else: host = hostport[:colon_index] if host.find(":") != -1: raise tooManyColonsError if hostport[j:].find("[") != -1: raise Error("unexpected '[' in address") if hostport[k:].find("]") != -1: raise Error("unexpected ']' in address") port = hostport[colon_index + 1 :] if port == "": raise missingPortError if host == "": raise Error("missing host") return HostPort(host, port) fn convert_binary_port_to_int(port: UInt16) -> Int: return int(ntohs(port)) fn convert_binary_ip_to_string( owned ip_address: UInt32, address_family: Int32, address_length: UInt32 ) -> String: """Convert a binary IP address to a string by calling inet_ntop. Args: ip_address: The binary IP address. address_family: The address family of the IP address. address_length: The length of the address. Returns: The IP address as a string. """ # It seems like the len of the buffer depends on the length of the string IP. # Allocating 10 works for localhost (127.0.0.1) which I suspect is 9 bytes + 1 null terminator byte. So max should be 16 (15 + 1). var ip_buffer = UnsafePointer[c_void].alloc(16) var ip_address_ptr = UnsafePointer.address_of(ip_address).bitcast[c_void]() _ = inet_ntop(address_family, ip_address_ptr, ip_buffer, 16) var string_buf = ip_buffer.bitcast[Int8]() var index = 0 while True: if string_buf[index] == 0: break index += 1 return StringRef(string_buf, index) fn get_sock_name(fd: Int32) raises -> HostPort: """Return the address of the socket.""" var local_address_ptr = UnsafePointer[sockaddr].alloc(1) var local_address_ptr_size = socklen_t(sizeof[sockaddr]()) var status = getsockname( fd, local_address_ptr, UnsafePointer[socklen_t].address_of(local_address_ptr_size), ) if status == -1: raise Error("get_sock_name: Failed to get address of local socket.") var addr_in = local_address_ptr.bitcast[sockaddr_in]()[] return HostPort( host=convert_binary_ip_to_string(addr_in.sin_addr.s_addr, AF_INET, 16), port=convert_binary_port_to_int(addr_in.sin_port).__str__(), ) fn get_peer_name(fd: Int32) raises -> HostPort: """Return the address of the peer connected to the socket.""" var remote_address_ptr = UnsafePointer[sockaddr].alloc(1) var remote_address_ptr_size = socklen_t(sizeof[sockaddr]()) var status = getpeername( fd, remote_address_ptr, UnsafePointer[socklen_t].address_of(remote_address_ptr_size), ) if status == -1: raise Error("get_peer_name: Failed to get address of remote socket.") # Cast sockaddr struct to sockaddr_in to convert binary IP to string. var addr_in = remote_address_ptr.bitcast[sockaddr_in]()[] return HostPort( host=convert_binary_ip_to_string(addr_in.sin_addr.s_addr, AF_INET, 16), port=convert_binary_port_to_int(addr_in.sin_port).__str__(), ) --- lightbug_http/python/__init__.mojo --- from python import Python, PythonObject @value struct Modules: var builtins: PythonObject var socket: PythonObject fn __init__(inout self) -> None: self.builtins = self.__load_builtins() self.socket = self.__load_socket() @staticmethod fn __load_socket() -> PythonObject: try: var socket = Python.import_module("socket") return socket except e: print("Failed to import socket module") return None @staticmethod fn __load_builtins() -> PythonObject: try: var builtins = Python.import_module("builtins") return builtins except e: print("Failed to import builtins module") return None --- lightbug_http/python/client.mojo --- from lightbug_http.client import Client from lightbug_http.http import HTTPRequest, HTTPResponse from lightbug_http.python import Modules from lightbug_http.io.bytes import Bytes, UnsafeString, bytes from lightbug_http.strings import CharSet struct PythonClient(Client): var pymodules: Modules var socket: PythonObject var name: String var host: StringLiteral var port: Int fn __init__(inout self) raises: self.pymodules = Modules() self.socket = self.pymodules.socket.socket() self.host = "127.0.0.1" self.port = 8888 self.name = "lightbug_http_client" fn __init__(inout self, host: StringLiteral, port: Int) raises: self.pymodules = Modules() self.socket = self.pymodules.socket.socket() self.host = host self.port = port self.name = "lightbug_http_client" fn do(self, req: HTTPRequest) raises -> HTTPResponse: var uri = req.uri() try: _ = uri.parse() except e: print("error parsing uri: " + e.__str__()) var host = String(uri.host()) if host == "": raise Error("URI is nil") var is_tls = False if uri.is_https(): is_tls = True var host_port = host.split(":") var host_str = host_port[0] var port = atol(host_port[1]) _ = self.socket.connect((UnsafeString(host_str.__str__()), port)) var data = self.pymodules.builtins.bytes( String(req.body_raw), CharSet.utf8.value ) _ = self.socket.sendall(data) var res = self.socket.recv(1024).decode() _ = self.socket.close() return HTTPResponse(bytes(res)) --- lightbug_http/python/net.mojo --- from lightbug_http.python import Modules from lightbug_http.io.bytes import Bytes, UnsafeString, bytes from lightbug_http.io.sync import Duration from lightbug_http.net import ( Net, TCPAddr, Listener, ListenConfig, resolve_internet_addr, default_buffer_size, ) from lightbug_http.net import Connection, default_tcp_keep_alive from lightbug_http.strings import CharSet @value struct PythonTCPListener: var __pymodules: PythonObject var __addr: TCPAddr var socket: PythonObject fn __init__(inout self) raises: self.__pymodules = None self.__addr = TCPAddr("localhost", 8080) self.socket = None fn __init__(inout self, addr: TCPAddr) raises: self.__pymodules = None self.__addr = addr self.socket = None fn __init__(inout self, pymodules: PythonObject, addr: TCPAddr) raises: self.__pymodules = pymodules self.__addr = addr self.socket = None fn __init__( inout self, pymodules: PythonObject, addr: TCPAddr, socket: PythonObject ) raises: self.__pymodules = pymodules self.__addr = addr self.socket = socket @always_inline fn accept(self) raises -> PythonConnection: var conn_addr = self.socket.accept() return PythonConnection(self.__pymodules, conn_addr) fn close(self) raises: if self.socket == None: raise Error("socket is None, cannot close") _ = self.socket.close() fn addr(self) -> TCPAddr: return self.__addr struct PythonListenConfig: var __pymodules: Modules var __keep_alive: Duration fn __init__(inout self): self.__keep_alive = default_tcp_keep_alive self.__pymodules = Modules() fn __init__(inout self, keep_alive: Duration): self.__keep_alive = keep_alive self.__pymodules = Modules() fn listen(inout self, network: String, address: String) raises -> PythonTCPListener: var addr = resolve_internet_addr(network, address) var listener = PythonTCPListener( self.__pymodules.builtins, addr, self.__pymodules.socket.socket( self.__pymodules.socket.AF_INET, self.__pymodules.socket.SOCK_STREAM, ), ) _ = listener.socket.bind((UnsafeString(addr.ip), addr.port)) _ = listener.socket.listen() print("Listening on " + String(addr.ip) + ":" + String(addr.port)) return listener @value struct PythonConnection(Connection): var pymodules: PythonObject var conn: PythonObject var raddr: PythonObject var laddr: PythonObject fn __init__(inout self, laddr: String, raddr: String) raises: self.conn = None self.raddr = PythonObject(raddr) self.laddr = PythonObject(laddr) self.pymodules = Modules().builtins fn __init__(inout self, laddr: TCPAddr, raddr: TCPAddr) raises: self.conn = None self.raddr = PythonObject(raddr.ip + ":" + raddr.port.__str__()) self.laddr = PythonObject(laddr.ip + ":" + laddr.port.__str__()) self.pymodules = Modules().builtins fn __init__(inout self, pymodules: PythonObject, py_conn_addr: PythonObject) raises: self.conn = py_conn_addr[0] self.raddr = py_conn_addr[1] self.laddr = "" self.pymodules = pymodules fn read(self, inout buf: Bytes) raises -> Int: var data = self.conn.recv(default_buffer_size) buf = bytes( self.pymodules.bytes.decode(data, CharSet.utf8.value).__str__() ) return len(buf) fn write(self, buf: Bytes) raises -> Int: var data = self.pymodules.bytes(String(buf), CharSet.utf8.value) _ = self.conn.sendall(data) return len(buf) fn close(self) raises: _ = self.conn.close() fn local_addr(inout self) raises -> TCPAddr: if self.laddr.__str__() == "": self.laddr = self.conn.getsockname() return TCPAddr(self.laddr[0].__str__(), self.laddr[1].__int__()) fn remote_addr(self) raises -> TCPAddr: return TCPAddr(self.raddr[0].__str__(), self.raddr[1].__int__()) struct PythonNet: var __lc: PythonListenConfig fn __init__(inout self): self.__lc = PythonListenConfig(default_tcp_keep_alive) fn __init__(inout self, keep_alive: Duration) raises: self.__lc = PythonListenConfig(keep_alive) fn listen(inout self, network: String, addr: String) raises -> PythonTCPListener: return self.__lc.listen(network, addr) --- lightbug_http/python/server.mojo --- from lightbug_http.server import DefaultConcurrency from lightbug_http.net import Listener from lightbug_http.http import HTTPRequest, encode, split_http_string from lightbug_http.uri import URI from lightbug_http.header import RequestHeader from lightbug_http.python.net import ( PythonTCPListener, PythonNet, PythonConnection, ) from lightbug_http.python import Modules from lightbug_http.service import HTTPService from lightbug_http.io.sync import Duration from lightbug_http.io.bytes import Bytes from lightbug_http.error import ErrorHandler from lightbug_http.strings import NetworkType struct PythonServer: var pymodules: Modules var error_handler: ErrorHandler var name: String var max_concurrent_connections: Int var tcp_keep_alive: Bool var ln: PythonTCPListener fn __init__(inout self) raises: self.pymodules = Modules() self.error_handler = ErrorHandler() self.name = "lightbug_http" self.max_concurrent_connections = 1000 self.tcp_keep_alive = False self.ln = PythonTCPListener() fn __init__(inout self, error_handler: ErrorHandler) raises: self.pymodules = Modules() self.error_handler = error_handler self.name = "lightbug_http" self.max_concurrent_connections = 1000 self.tcp_keep_alive = False self.ln = PythonTCPListener() fn get_concurrency(self) -> Int: var concurrency = self.max_concurrent_connections if concurrency <= 0: concurrency = DefaultConcurrency return concurrency fn listen_and_serve[ T: HTTPService ](inout self, address: String, handler: T) raises -> None: var __net = PythonNet() var listener = __net.listen(NetworkType.tcp4.value, address) self.serve(listener, handler) fn serve[ T: HTTPService ](inout self, ln: PythonTCPListener, handler: T) raises -> None: self.ln = ln while True: var conn = self.ln.accept() var buf = Bytes() var read_len = conn.read(buf) if read_len == 0: conn.close() break var request_first_line: String var request_headers: String var request_body: String request_first_line, request_headers, request_body = split_http_string(buf) var uri = URI(request_first_line) try: uri.parse() except: conn.close() raise Error("Failed to parse request line") var header = RequestHeader(request_headers.as_bytes()) try: header.parse_raw(request_first_line) except: conn.close() raise Error("Failed to parse request header") var res = handler.func( HTTPRequest( uri, buf, header, ) ) var res_encoded = encode(res) _ = conn.write(res_encoded.as_bytes_slice()) conn.close() --- lightbug_http/server.mojo --- from lightbug_http.error import ErrorHandler from lightbug_http.service import HTTPService from lightbug_http.net import Listener alias DefaultConcurrency: Int = 256 * 1024 trait ServerTrait: fn __init__( inout self, addr: String, service: HTTPService, error_handler: ErrorHandler ): ... fn get_concurrency(self) -> Int: ... fn listen_and_serve(self, address: String, handler: HTTPService) raises -> None: ... fn serve(self, ln: Listener, handler: HTTPService) raises -> None: ... --- lightbug_http/service.mojo --- from lightbug_http.http import HTTPRequest, HTTPResponse, OK, NotFound from lightbug_http.io.bytes import Bytes, bytes trait HTTPService: fn func(self, req: HTTPRequest) raises -> HTTPResponse: ... @value struct Printer(HTTPService): fn func(self, req: HTTPRequest) raises -> HTTPResponse: var body = req.body_raw print(String(body)) return OK(body) @value struct Welcome(HTTPService): fn func(self, req: HTTPRequest) raises -> HTTPResponse: var uri = req.uri() if uri.path() == "/": var html: Bytes with open("static/lightbug_welcome.html", "r") as f: html = f.read_bytes() return OK(html, "text/html; charset=utf-8") if uri.path() == "/logo.png": var image: Bytes with open("static/logo.png", "r") as f: image = f.read_bytes() return OK(image, "image/png") return NotFound(uri.path()) @value struct ExampleRouter(HTTPService): fn func(self, req: HTTPRequest) raises -> HTTPResponse: var body = req.body_raw var uri = req.uri() if uri.path() == "/": print("I'm on the index path!") if uri.path() == "/first": print("I'm on /first!") elif uri.path() == "/second": print("I'm on /second!") elif uri.path() == "/echo": print(String(body)) return OK(body) @value struct TechEmpowerRouter(HTTPService): fn func(self, req: HTTPRequest) raises -> HTTPResponse: # var body = req.body_raw var uri = req.uri() if uri.path() == "/plaintext": return OK("Hello, World!", "text/plain") elif uri.path() == "/json": return OK('{"message": "Hello, World!"}', "application/json") return OK("Hello world!") # text/plain is the default --- lightbug_http/strings.mojo --- from lightbug_http.io.bytes import Bytes alias strSlash = "/" alias strHttp = "http" alias http = "http" alias strHttps = "https" alias https = "https" alias strHttp11 = "HTTP/1.1" alias strHttp10 = "HTTP/1.0" alias strMethodGet = "GET" alias rChar = "\r" alias nChar = "\n" alias colonChar = ":" alias empty_string = "" alias whitespace = " " alias tab = "\t" @value struct NetworkType: var value: String alias empty = NetworkType("") alias tcp = NetworkType("tcp") alias tcp4 = NetworkType("tcp4") alias tcp6 = NetworkType("tcp6") alias udp = NetworkType("udp") alias udp4 = NetworkType("udp4") alias udp6 = NetworkType("udp6") alias ip = NetworkType("ip") alias ip4 = NetworkType("ip4") alias ip6 = NetworkType("ip6") alias unix = NetworkType("unix") @value struct ConnType: var value: String alias empty = ConnType("") alias http = ConnType("http") alias websocket = ConnType("websocket") @value struct RequestMethod: var value: String alias get = RequestMethod("GET") alias post = RequestMethod("POST") alias put = RequestMethod("PUT") alias delete = RequestMethod("DELETE") alias head = RequestMethod("HEAD") alias patch = RequestMethod("PATCH") alias options = RequestMethod("OPTIONS") @value struct CharSet: var value: String alias utf8 = CharSet("utf-8") @value struct MediaType: var value: String alias empty = MediaType("") alias plain = MediaType("text/plain") alias json = MediaType("application/json") @value struct Message: var type: String alias empty = Message("") alias http_start = Message("http.response.start") --- lightbug_http/sys/__init__.mojo --- --- lightbug_http/sys/client.mojo --- from external.gojo.bufio import Reader, Scanner, scan_words, scan_bytes from external.gojo.bytes import buffer from external.libc import ( c_int, AF_INET, SOCK_STREAM, socket, connect, send, recv, close, ) from lightbug_http.client import Client from lightbug_http.net import default_buffer_size from lightbug_http.http import HTTPRequest, HTTPResponse, encode, split_http_string from lightbug_http.header import ResponseHeader from lightbug_http.sys.net import create_connection from lightbug_http.io.bytes import Bytes struct MojoClient(Client): var fd: c_int var host: StringLiteral var port: Int var name: String fn __init__(inout self) raises: self.fd = socket(AF_INET, SOCK_STREAM, 0) self.host = "127.0.0.1" self.port = 8888 self.name = "lightbug_http_client" fn __init__(inout self, host: StringLiteral, port: Int) raises: self.fd = socket(AF_INET, SOCK_STREAM, 0) self.host = host self.port = port self.name = "lightbug_http_client" fn do(self, req: HTTPRequest) raises -> HTTPResponse: """ The `do` method is responsible for sending an HTTP request to a server and receiving the corresponding response. It performs the following steps: 1. Creates a connection to the server specified in the request. 2. Sends the request body using the connection. 3. Receives the response from the server. 4. Closes the connection. 5. Returns the received response as an `HTTPResponse` object. Note: The code assumes that the `HTTPRequest` object passed as an argument has a valid URI with a host and port specified. Parameters ---------- req : HTTPRequest : An `HTTPRequest` object representing the request to be sent. Returns ------- HTTPResponse : The received response. Raises ------ Error : If there is a failure in sending or receiving the message. """ var uri = req.uri() var host = String(uri.host()) if host == "": raise Error("URI is nil") var is_tls = False if uri.is_https(): is_tls = True var host_str: String var port: Int if host.__contains__(":"): var host_port = host.split(":") host_str = host_port[0] port = atol(host_port[1]) else: host_str = host if is_tls: port = 443 else: port = 80 var conn = create_connection(self.fd, host_str, port) var req_encoded = encode(req) var bytes_sent = conn.write(req_encoded) if bytes_sent == -1: raise Error("Failed to send message") var new_buf = Bytes(capacity=default_buffer_size) var bytes_recv = conn.read(new_buf) if bytes_recv == 0: conn.close() var buf = buffer.new_buffer(new_buf^) var reader = Reader(buf^) var error = Error() # # Ugly hack for now in case the default buffer is too large and we read additional responses from the server # var newline_in_body = response_body.find("\r\n") # if newline_in_body != -1: # response_body = response_body[:newline_in_body] var header = ResponseHeader() var first_line_and_headers_len = 0 try: first_line_and_headers_len = header.parse_raw(reader) except e: conn.close() error = Error("Failed to parse response headers: " + e.__str__()) var response = HTTPResponse(header, Bytes()) try: response.read_body(reader, first_line_and_headers_len,) except e: error = Error("Failed to read request body: " + e.__str__()) # var total_recv = bytes_recv # while header.content_length() > total_recv: # if header.content_length() != 0 and header.content_length() != -2: # var remaining_body = Bytes() # var read_len = conn.read(remaining_body) # response_body += remaining_body # total_recv += read_len conn.close() return response --- lightbug_http/sys/net.mojo --- from utils import StaticTuple from lightbug_http.net import ( Listener, ListenConfig, Connection, TCPAddr, Net, resolve_internet_addr, default_buffer_size, default_tcp_keep_alive, get_peer_name, ) from lightbug_http.strings import NetworkType from lightbug_http.io.bytes import Bytes, bytes from lightbug_http.io.sync import Duration from external.libc import ( c_void, c_int, c_uint, c_char, in_addr, sockaddr, sockaddr_in, socklen_t, AI_PASSIVE, AF_INET, AF_INET6, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR, SHUT_RDWR, htons, inet_pton, to_char_ptr, socket, connect, setsockopt, listen, accept, send, recv, bind, shutdown, close, ) from sys.info import os_is_macos from time import sleep trait AnAddrInfo: fn get_ip_address(self, host: String) raises -> in_addr: """ TODO: Once default functions can be implemented in traits, this function should use the functions currently implemented in the `addrinfo_macos` and `addrinfo_unix` structs. """ ... fn getaddrinfo[ T: AnAddrInfo ]( nodename: UnsafePointer[c_char], servname: UnsafePointer[c_char], hints: UnsafePointer[T], res: UnsafePointer[UnsafePointer[T]], ) -> c_int: """ Overwrites the existing libc `getaddrinfo` function to use the AnAddrInfo trait. Libc POSIX `getaddrinfo` function Reference: https://man7.org/linux/man-pages/man3/getaddrinfo.3p.html Fn signature: int getaddrinfo(const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, struct addrinfo **restrict res). """ return external_call[ "getaddrinfo", c_int, # FnName, RetType UnsafePointer[c_char], UnsafePointer[c_char], UnsafePointer[T], # Args UnsafePointer[UnsafePointer[T]], # Args ](nodename, servname, hints, res) @value struct SysListener: """ A TCP listener that listens for incoming connections and can accept them. """ var fd: c_int var __addr: TCPAddr fn __init__(inout self) raises: self.__addr = TCPAddr("localhost", 8080) self.fd = socket(AF_INET, SOCK_STREAM, 0) fn __init__(inout self, addr: TCPAddr) raises: self.__addr = addr self.fd = socket(AF_INET, SOCK_STREAM, 0) fn __init__(inout self, addr: TCPAddr, fd: c_int) raises: self.__addr = addr self.fd = fd fn accept(self) raises -> SysConnection: var their_addr_ptr = UnsafePointer[sockaddr].alloc(1) var sin_size = socklen_t(sizeof[socklen_t]()) var new_sockfd = accept( self.fd, their_addr_ptr, UnsafePointer[socklen_t].address_of(sin_size) ) if new_sockfd == -1: print("Failed to accept connection, system accept() returned an error.") var peer = get_peer_name(new_sockfd) return SysConnection( self.__addr, TCPAddr(peer.host, atol(peer.port)), new_sockfd ) fn close(self) raises: _ = shutdown(self.fd, SHUT_RDWR) var close_status = close(self.fd) if close_status == -1: print("Failed to close new_sockfd") fn addr(self) -> TCPAddr: return self.__addr struct SysListenConfig(ListenConfig): var __keep_alive: Duration fn __init__(inout self) raises: self.__keep_alive = default_tcp_keep_alive fn __init__(inout self, keep_alive: Duration) raises: self.__keep_alive = keep_alive fn listen(inout self, network: String, address: String) raises -> SysListener: var addr = resolve_internet_addr(network, address) var address_family = AF_INET var ip_buf_size = 4 if address_family == AF_INET6: ip_buf_size = 16 var ip_buf = UnsafePointer[c_void].alloc(ip_buf_size) var conv_status = inet_pton(address_family, to_char_ptr(addr.ip), ip_buf) var raw_ip = ip_buf.bitcast[c_uint]()[] var bin_port = htons(UInt16(addr.port)) var ai = sockaddr_in(address_family, bin_port, raw_ip, StaticTuple[c_char, 8]()) var ai_ptr = UnsafePointer[sockaddr_in].address_of(ai).bitcast[sockaddr]() var sockfd = socket(address_family, SOCK_STREAM, 0) if sockfd == -1: print("Socket creation error") var yes: Int = 1 _ = setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, UnsafePointer[Int].address_of(yes).bitcast[c_void](), sizeof[Int](), ) var bind_success = False var bind_fail_logged = False while not bind_success: var bind = bind(sockfd, ai_ptr, sizeof[sockaddr_in]()) if bind == 0: bind_success = True else: if not bind_fail_logged: print("Bind attempt failed. The address might be in use or the socket might not be available.") print("Retrying. Might take 10-15 seconds.") bind_fail_logged = True print(".", end="", flush=True) _ = shutdown(sockfd, SHUT_RDWR) sleep(1) if listen(sockfd, c_int(128)) == -1: print("Listen failed.\n on sockfd " + sockfd.__str__()) var listener = SysListener(addr, sockfd) print( "\n🔥🐝 Lightbug is listening on " + "http://" + addr.ip + ":" + addr.port.__str__() ) print("Ready to accept connections...") return listener @value struct SysConnection(Connection): var fd: c_int var raddr: TCPAddr var laddr: TCPAddr fn __init__(inout self, laddr: String, raddr: String) raises: self.raddr = resolve_internet_addr(NetworkType.tcp4.value, raddr) self.laddr = resolve_internet_addr(NetworkType.tcp4.value, laddr) self.fd = socket(AF_INET, SOCK_STREAM, 0) fn __init__(inout self, laddr: TCPAddr, raddr: TCPAddr) raises: self.raddr = raddr self.laddr = laddr self.fd = socket(AF_INET, SOCK_STREAM, 0) fn __init__(inout self, laddr: TCPAddr, raddr: TCPAddr, fd: c_int) raises: self.raddr = raddr self.laddr = laddr self.fd = fd fn read(self, inout buf: Bytes) raises -> Int: var bytes_recv = recv(self.fd, DTypePointer[DType.uint8](buf.unsafe_ptr()).offset(buf.size), buf.capacity - buf.size, 0) if bytes_recv == -1: return 0 buf.size += bytes_recv if bytes_recv == 0: return 0 if bytes_recv < buf.capacity: return bytes_recv return bytes_recv fn write(self, msg: String) raises -> Int: if send(self.fd, to_char_ptr(msg).bitcast[c_void](), len(msg), 0) == -1: print("Failed to send response") return len(msg) fn write(self, buf: Bytes) raises -> Int: if send(self.fd, to_char_ptr(buf).bitcast[c_void](), len(buf), 0) == -1: print("Failed to send response") return len(buf) fn close(self) raises: _ = shutdown(self.fd, SHUT_RDWR) var close_status = close(self.fd) if close_status == -1: print("Failed to close new_sockfd") fn local_addr(inout self) raises -> TCPAddr: return self.laddr fn remote_addr(self) raises -> TCPAddr: return self.raddr struct SysNet: var __lc: SysListenConfig fn __init__(inout self) raises: self.__lc = SysListenConfig(default_tcp_keep_alive) fn __init__(inout self, keep_alive: Duration) raises: self.__lc = SysListenConfig(keep_alive) fn listen(inout self, network: String, addr: String) raises -> SysListener: return self.__lc.listen(network, addr) @value @register_passable("trivial") struct addrinfo_macos(AnAddrInfo): """ For MacOS, I had to swap the order of ai_canonname and ai_addr. https://stackoverflow.com/questions/53575101/calling-getaddrinfo-directly-from-python-ai-addr-is-null-pointer. """ var ai_flags: c_int var ai_family: c_int var ai_socktype: c_int var ai_protocol: c_int var ai_addrlen: socklen_t var ai_canonname: UnsafePointer[c_char] var ai_addr: UnsafePointer[sockaddr] var ai_next: UnsafePointer[c_void] fn __init__() -> Self: return Self( 0, 0, 0, 0, 0, UnsafePointer[c_char](), UnsafePointer[sockaddr](), UnsafePointer[c_void]() ) fn get_ip_address(self, host: String) raises -> in_addr: """ Returns an IP address based on the host. This is a MacOS-specific implementation. Args: host: String - The host to get the IP from. Returns: UInt32 - The IP address. """ var host_ptr = to_char_ptr(host) var servinfo = UnsafePointer[Self]().alloc(1) initialize_pointee_move(servinfo, Self()) var hints = Self() hints.ai_family = AF_INET hints.ai_socktype = SOCK_STREAM hints.ai_flags = AI_PASSIVE var error = getaddrinfo[Self]( host_ptr, UnsafePointer[UInt8](), UnsafePointer.address_of(hints), UnsafePointer.address_of(servinfo), ) if error != 0: print("getaddrinfo failed") raise Error("Failed to get IP address. getaddrinfo failed.") var addrinfo = servinfo[] var ai_addr = addrinfo.ai_addr if not ai_addr: print("ai_addr is null") raise Error( "Failed to get IP address. getaddrinfo was called successfully, but" " ai_addr is null." ) var addr_in = ai_addr.bitcast[sockaddr_in]()[] return addr_in.sin_addr @value @register_passable("trivial") struct addrinfo_unix(AnAddrInfo): """ Standard addrinfo struct for Unix systems. Overwrites the existing libc `getaddrinfo` function to adhere to the AnAddrInfo trait. """ var ai_flags: c_int var ai_family: c_int var ai_socktype: c_int var ai_protocol: c_int var ai_addrlen: socklen_t var ai_addr: UnsafePointer[sockaddr] var ai_canonname: UnsafePointer[c_char] var ai_next: UnsafePointer[c_void] fn __init__() -> Self: return Self( 0, 0, 0, 0, 0, UnsafePointer[sockaddr](), UnsafePointer[c_char](), UnsafePointer[c_void]() ) fn get_ip_address(self, host: String) raises -> in_addr: """ Returns an IP address based on the host. This is a Unix-specific implementation. Args: host: String - The host to get IP from. Returns: UInt32 - The IP address. """ var host_ptr = to_char_ptr(String(host)) var servinfo = UnsafePointer[Self]().alloc(1) initialize_pointee_move(servinfo, Self()) var hints = Self() hints.ai_family = AF_INET hints.ai_socktype = SOCK_STREAM hints.ai_flags = AI_PASSIVE var error = getaddrinfo[Self]( host_ptr, UnsafePointer[UInt8](), UnsafePointer.address_of(hints), UnsafePointer.address_of(servinfo), ) if error != 0: print("getaddrinfo failed") raise Error("Failed to get IP address. getaddrinfo failed.") var addrinfo = servinfo[] var ai_addr = addrinfo.ai_addr if not ai_addr: print("ai_addr is null") raise Error( "Failed to get IP address. getaddrinfo was called successfully, but" " ai_addr is null." ) var addr_in = ai_addr.bitcast[sockaddr_in]()[] return addr_in.sin_addr fn create_connection(sock: c_int, host: String, port: UInt16) raises -> SysConnection: """ Connect to a server using a socket. Args: sock: Int32 - The socket file descriptor. host: String - The host to connect to. port: UInt16 - The port to connect to. Returns: Int32 - The socket file descriptor. """ var ip: in_addr if os_is_macos(): ip = addrinfo_macos().get_ip_address(host) else: ip = addrinfo_unix().get_ip_address(host) # Convert ip address to network byte order. var addr: sockaddr_in = sockaddr_in( AF_INET, htons(port), ip, StaticTuple[c_char, 8](0, 0, 0, 0, 0, 0, 0, 0) ) var addr_ptr = UnsafePointer[sockaddr_in].address_of(addr).bitcast[sockaddr]() if connect(sock, addr_ptr, sizeof[sockaddr_in]()) == -1: _ = shutdown(sock, SHUT_RDWR) raise Error("Failed to connect to server") var laddr = TCPAddr() var raddr = TCPAddr(host, int(port)) var conn = SysConnection(sock, laddr, raddr) return conn --- lightbug_http/sys/server.mojo --- from external.gojo.bufio import Reader, Scanner, scan_words, scan_bytes from external.gojo.bytes import buffer from lightbug_http.server import DefaultConcurrency from lightbug_http.net import Listener, default_buffer_size from lightbug_http.http import HTTPRequest, encode, split_http_string from lightbug_http.uri import URI from lightbug_http.header import RequestHeader from lightbug_http.sys.net import SysListener, SysConnection, SysNet from lightbug_http.service import HTTPService from lightbug_http.io.sync import Duration from lightbug_http.io.bytes import Bytes, bytes from lightbug_http.error import ErrorHandler from lightbug_http.strings import NetworkType alias default_max_request_body_size = 4 * 1024 * 1024 # 4MB @value struct SysServer: """ A Mojo-based server that accept incoming requests and delivers HTTP services. """ var error_handler: ErrorHandler var name: String var __address: String var max_concurrent_connections: Int var max_requests_per_connection: Int var __max_request_body_size: Int var tcp_keep_alive: Bool var ln: SysListener fn __init__(inout self) raises: self.error_handler = ErrorHandler() self.name = "lightbug_http" self.__address = "127.0.0.1" self.max_concurrent_connections = 1000 self.max_requests_per_connection = 0 self.__max_request_body_size = default_max_request_body_size self.tcp_keep_alive = False self.ln = SysListener() fn __init__(inout self, tcp_keep_alive: Bool) raises: self.error_handler = ErrorHandler() self.name = "lightbug_http" self.__address = "127.0.0.1" self.max_concurrent_connections = 1000 self.max_requests_per_connection = 0 self.__max_request_body_size = default_max_request_body_size self.tcp_keep_alive = tcp_keep_alive self.ln = SysListener() fn __init__(inout self, own_address: String) raises: self.error_handler = ErrorHandler() self.name = "lightbug_http" self.__address = own_address self.max_concurrent_connections = 1000 self.max_requests_per_connection = 0 self.__max_request_body_size = default_max_request_body_size self.tcp_keep_alive = False self.ln = SysListener() fn __init__(inout self, error_handler: ErrorHandler) raises: self.error_handler = error_handler self.name = "lightbug_http" self.__address = "127.0.0.1" self.max_concurrent_connections = 1000 self.max_requests_per_connection = 0 self.__max_request_body_size = default_max_request_body_size self.tcp_keep_alive = False self.ln = SysListener() fn __init__(inout self, max_request_body_size: Int) raises: self.error_handler = ErrorHandler() self.name = "lightbug_http" self.__address = "127.0.0.1" self.max_concurrent_connections = 1000 self.max_requests_per_connection = 0 self.__max_request_body_size = max_request_body_size self.tcp_keep_alive = False self.ln = SysListener() fn __init__(inout self, max_request_body_size: Int, tcp_keep_alive: Bool) raises: self.error_handler = ErrorHandler() self.name = "lightbug_http" self.__address = "127.0.0.1" self.max_concurrent_connections = 1000 self.max_requests_per_connection = 0 self.__max_request_body_size = max_request_body_size self.tcp_keep_alive = tcp_keep_alive self.ln = SysListener() fn address(self) -> String: return self.__address fn set_address(inout self, own_address: String) -> Self: self.__address = own_address return self fn max_request_body_size(self) -> Int: return self.__max_request_body_size fn set_max_request_body_size(inout self, size: Int) -> Self: self.__max_request_body_size = size return self fn get_concurrency(self) -> Int: """ Retrieve the concurrency level which is either the configured max_concurrent_connections or the DefaultConcurrency. Returns: Int: concurrency level for the server. """ var concurrency = self.max_concurrent_connections if concurrency <= 0: concurrency = DefaultConcurrency return concurrency fn listen_and_serve[ T: HTTPService ](inout self, address: String, handler: T) raises -> None: """ Listen for incoming connections and serve HTTP requests. Args: address : String - The address (host:port) to listen on. handler : HTTPService - An object that handles incoming HTTP requests. """ var __net = SysNet() var listener = __net.listen(NetworkType.tcp4.value, address) _ = self.set_address(address) self.serve(listener, handler) fn serve[T: HTTPService](inout self, ln: SysListener, handler: T) raises -> None: """ Serve HTTP requests. Args: ln : SysListener - TCP server that listens for incoming connections. handler : HTTPService - An object that handles incoming HTTP requests. Raises: If there is an error while serving requests. """ self.ln = ln while True: var conn = self.ln.accept() self.serve_connection(conn, handler) fn serve_connection[T: HTTPService](inout self, conn: SysConnection, handler: T) raises -> None: """ Serve a single connection. Args: conn : SysConnection - A connection object that represents a client connection. handler : HTTPService - An object that handles incoming HTTP requests. Raises: If there is an error while serving the connection. """ var b = Bytes(capacity=default_buffer_size) var bytes_recv = conn.read(b) if bytes_recv == 0: conn.close() return var buf = buffer.new_buffer(b^) var reader = Reader(buf^) var error = Error() var max_request_body_size = self.max_request_body_size() if max_request_body_size <= 0: max_request_body_size = default_max_request_body_size var req_number = 0 while True: req_number += 1 if req_number > 1: var b = Bytes(capacity=default_buffer_size) var bytes_recv = conn.read(b) if bytes_recv == 0: conn.close() break buf = buffer.new_buffer(b^) reader = Reader(buf^) var header = RequestHeader() var first_line_and_headers_len = 0 try: first_line_and_headers_len = header.parse_raw(reader) except e: error = Error("Failed to parse request headers: " + e.__str__()) var uri = URI(self.address() + String(header.request_uri())) try: uri.parse() except e: error = Error("Failed to parse request line:" + e.__str__()) if header.content_length() > 0: if max_request_body_size > 0 and header.content_length() > max_request_body_size: error = Error("Request body too large") var request = HTTPRequest( uri, Bytes(), header, ) try: request.read_body(reader, header.content_length(), first_line_and_headers_len, max_request_body_size) except e: error = Error("Failed to read request body: " + e.__str__()) var res = handler.func(request) if not self.tcp_keep_alive: _ = res.set_connection_close() var res_encoded = encode(res) _ = conn.write(res_encoded) if not self.tcp_keep_alive: conn.close() return --- lightbug_http/uri.mojo --- from lightbug_http.io.bytes import Bytes, BytesView, bytes_equal, bytes from lightbug_http.strings import ( strSlash, strHttp11, strHttp10, strHttp, http, strHttps, https, ) @value struct URI: var __path_original: Bytes var __scheme: Bytes var __path: Bytes var __query_string: Bytes var __hash: Bytes var __host: Bytes var __http_version: Bytes var disable_path_normalization: Bool var __full_uri: Bytes var __request_uri: Bytes var __username: Bytes var __password: Bytes fn __init__( inout self, full_uri: String, ) -> None: self.__path_original = Bytes() self.__scheme = Bytes() self.__path = Bytes() self.__query_string = Bytes() self.__hash = Bytes() self.__host = Bytes() self.__http_version = Bytes() self.disable_path_normalization = False self.__full_uri = bytes(full_uri, pop=False) self.__request_uri = Bytes() self.__username = Bytes() self.__password = Bytes() fn __init__( inout self, full_uri: String, host: String ) -> None: self.__path_original = Bytes() self.__scheme = Bytes() self.__path = Bytes() self.__query_string = Bytes() self.__hash = Bytes() self.__host = bytes(host) self.__http_version = Bytes() self.disable_path_normalization = False self.__full_uri = bytes(full_uri) self.__request_uri = Bytes() self.__username = Bytes() self.__password = Bytes() fn __init__( inout self, scheme: String, host: String, path: String, ) -> None: self.__path_original = bytes(path) self.__scheme = scheme.as_bytes() self.__path = normalise_path(bytes(path), self.__path_original) self.__query_string = Bytes() self.__hash = Bytes() self.__host = bytes(host) self.__http_version = Bytes() self.disable_path_normalization = False self.__full_uri = Bytes() self.__request_uri = Bytes() self.__username = Bytes() self.__password = Bytes() fn __init__( inout self, path_original: Bytes, path: Bytes, scheme: Bytes, query_string: Bytes, hash: Bytes, host: Bytes, http_version: Bytes, disable_path_normalization: Bool, full_uri: Bytes, request_uri: Bytes, username: Bytes, password: Bytes, ): self.__path_original = path_original self.__scheme = scheme self.__path = path self.__query_string = query_string self.__hash = hash self.__host = host self.__http_version = http_version self.disable_path_normalization = disable_path_normalization self.__full_uri = full_uri self.__request_uri = request_uri self.__username = username self.__password = password fn path_original(self) -> BytesView: return BytesView(unsafe_ptr=self.__path_original.unsafe_ptr(), len=self.__path_original.size) fn set_path(inout self, path: String) -> Self: self.__path = normalise_path(bytes(path), self.__path_original) return self fn set_path_bytes(inout self, path: Bytes) -> Self: self.__path = normalise_path(path, self.__path_original) return self fn path(self) -> String: if len(self.__path) == 0: return strSlash return String(self.__path) fn path_bytes(self) -> BytesView: if len(self.__path) == 0: return BytesView(unsafe_ptr=strSlash.as_bytes_slice().unsafe_ptr(), len=2) return BytesView(unsafe_ptr=self.__path.unsafe_ptr(), len=self.__path.size) fn set_scheme(inout self, scheme: String) -> Self: self.__scheme = bytes(scheme) return self fn set_scheme_bytes(inout self, scheme: Bytes) -> Self: self.__scheme = scheme return self fn scheme(self) -> BytesView: if len(self.__scheme) == 0: return BytesView(unsafe_ptr=strHttp.as_bytes_slice().unsafe_ptr(), len=5) return BytesView(unsafe_ptr=self.__scheme.unsafe_ptr(), len=self.__scheme.size) fn http_version(self) -> BytesView: if len(self.__http_version) == 0: return BytesView(unsafe_ptr=strHttp11.as_bytes_slice().unsafe_ptr(), len=9) return BytesView(unsafe_ptr=self.__http_version.unsafe_ptr(), len=self.__http_version.size) fn http_version_str(self) -> String: return self.__http_version fn set_http_version(inout self, http_version: String) -> Self: self.__http_version = bytes(http_version) return self fn set_http_version_bytes(inout self, http_version: Bytes) -> Self: self.__http_version = http_version return self fn is_http_1_1(self) -> Bool: return bytes_equal(self.http_version(), bytes(strHttp11, pop=False)) fn is_http_1_0(self) -> Bool: return bytes_equal(self.http_version(), bytes(strHttp10, pop=False)) fn is_https(self) -> Bool: return bytes_equal(self.__scheme, bytes(https, pop=False)) fn is_http(self) -> Bool: return bytes_equal(self.__scheme, bytes(http, pop=False)) or len(self.__scheme) == 0 fn set_request_uri(inout self, request_uri: String) -> Self: self.__request_uri = bytes(request_uri) return self fn set_request_uri_bytes(inout self, request_uri: Bytes) -> Self: self.__request_uri = request_uri return self fn request_uri(self) -> BytesView: return BytesView(unsafe_ptr=self.__request_uri.unsafe_ptr(), len=self.__request_uri.size) fn set_query_string(inout self, query_string: String) -> Self: self.__query_string = bytes(query_string) return self fn set_query_string_bytes(inout self, query_string: Bytes) -> Self: self.__query_string = query_string return self fn query_string(self) -> BytesView: return BytesView(unsafe_ptr=self.__query_string.unsafe_ptr(), len=self.__query_string.size) fn set_hash(inout self, hash: String) -> Self: self.__hash = bytes(hash) return self fn set_hash_bytes(inout self, hash: Bytes) -> Self: self.__hash = hash return self fn hash(self) -> BytesView: return BytesView(unsafe_ptr=self.__hash.unsafe_ptr(), len=self.__hash.size) fn set_host(inout self, host: String) -> Self: self.__host = bytes(host) return self fn set_host_bytes(inout self, host: Bytes) -> Self: self.__host = host return self fn host(self) -> BytesView: return BytesView(unsafe_ptr=self.__host.unsafe_ptr(), len=self.__host.size) fn host_str(self) -> String: return self.__host fn full_uri(self) -> BytesView: return BytesView(unsafe_ptr=self.__full_uri.unsafe_ptr(), len=self.__full_uri.size) fn set_username(inout self, username: String) -> Self: self.__username = bytes(username) return self fn set_username_bytes(inout self, username: Bytes) -> Self: self.__username = username return self fn username(self) -> BytesView: return BytesView(unsafe_ptr=self.__username.unsafe_ptr(), len=self.__username.size) fn set_password(inout self, password: String) -> Self: self.__password = bytes(password) return self fn set_password_bytes(inout self, password: Bytes) -> Self: self.__password = password return self fn password(self) -> BytesView: return BytesView(unsafe_ptr=self.__password.unsafe_ptr(), len=self.__password.size) fn parse(inout self) raises -> None: var raw_uri = String(self.__full_uri) var proto_str = String(strHttp11) var is_https = False var proto_end = raw_uri.find("://") var remainder_uri: String if proto_end >= 0: proto_str = raw_uri[:proto_end] if proto_str == https: is_https = True remainder_uri = raw_uri[proto_end + 3:] else: remainder_uri = raw_uri _ = self.set_scheme_bytes(proto_str.as_bytes_slice()) var path_start = remainder_uri.find("/") var host_and_port: String var request_uri: String if path_start >= 0: host_and_port = remainder_uri[:path_start] request_uri = remainder_uri[path_start:] _ = self.set_host_bytes(bytes(host_and_port[:path_start], pop=False)) else: host_and_port = remainder_uri request_uri = strSlash _ = self.set_host_bytes(bytes(host_and_port, pop=False)) if is_https: _ = self.set_scheme_bytes(bytes(https, pop=False)) else: _ = self.set_scheme_bytes(bytes(http, pop=False)) var n = request_uri.find("?") if n >= 0: self.__path_original = bytes(request_uri[:n], pop=False) self.__query_string = bytes(request_uri[n + 1 :], pop=False) else: self.__path_original = bytes(request_uri, pop=False) self.__query_string = Bytes() _ = self.set_path_bytes(normalise_path(self.__path_original, self.__path_original)) _ = self.set_request_uri_bytes(bytes(request_uri, pop=False)) fn normalise_path(path: Bytes, path_original: Bytes) -> Bytes: # TODO: implement return path --- run_tests.mojo --- from tests.test_io import test_io from tests.test_http import test_http from tests.test_header import test_header from tests.test_uri import test_uri # from lightbug_http.test.test_client import test_client fn main() raises: test_io() test_http() test_header() test_uri() # test_client() --- static/lightbug_welcome.html --- <!DOCTYPE html> <html> <head> <title>Welcome to Lightbug!</title> <style> body { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; text-align: center; background-color: #22242F; margin: 60px; } .header { font-size: 2.3em; font-weight: bold; color: #fff; } .sub-header { margin-top: 20px; font-size: 2em; color: #fff; } .intro-text { margin-top: 20px; font-size: 1.5em; color: #fff; } code { font-family: monospace; background-color: #808080; padding: 8px 4px 4px 4px; margin-left: 2px; border-radius: 4px; } code:hover { background-color: #131B23; } img { max-width: 35%; height: auto; } .fire { width: 1.2em; height: auto; } </style> </head> <body> <div class="header">Welcome to Lightbug!</div> <div class="sub-header">A Mojo HTTP framework with wings</div> <div class="intro-text">To get started, edit <code>lightbug.🔥</code></div> <img src="logo.png" alt="Lightbug Image"> </body> </html> --- static/test.txt --- Hello, Mojo!Hello, Mojo!Hello, Mojo!Hello, Mojo!Hello, Mojo! 日本人 中國的 ~=[]()%+{}@;’#!$_&- éè ;∞¥₤€ --- tests/__init__.mojo --- --- tests/test_client.mojo --- from external.gojo.tests.wrapper import MojoTest from external.morrow import Morrow from tests.utils import ( default_server_conn_string, getRequest, ) from lightbug_http.python.client import PythonClient from lightbug_http.sys.client import MojoClient from lightbug_http.http import HTTPRequest, encode from lightbug_http.uri import URI from lightbug_http.header import RequestHeader from lightbug_http.io.bytes import bytes def test_client(): var mojo_client = MojoClient() var py_client = PythonClient() test_mojo_client_lightbug_external_req(mojo_client) test_python_client_lightbug(py_client) fn test_mojo_client_lightbug(client: MojoClient) raises: var test = MojoTest("test_mojo_client_lightbug") var res = client.do( HTTPRequest( URI(default_server_conn_string), bytes("Hello world!"), RequestHeader(getRequest), ) ) test.assert_equal( String(res.body_raw[0:112]), String( "HTTP/1.1 200 OK\r\nServer: lightbug_http\r\nContent-Type:" " text/plain\r\nContent-Length: 12\r\nConnection: close\r\nDate: " ), ) fn test_mojo_client_lightbug_external_req(client: MojoClient) raises: var test = MojoTest("test_mojo_client_lightbug_external_req") var req = HTTPRequest( URI("http://grandinnerastoundingspell.neverssl.com/online/"), ) try: var res = client.do(req) test.assert_equal(res.header.status_code(), 200) except e: print(e) fn test_python_client_lightbug(client: PythonClient) raises: var test = MojoTest("test_python_client_lightbug") var res = client.do( HTTPRequest( URI(default_server_conn_string), bytes("Hello world!"), RequestHeader(getRequest), ) ) test.assert_equal( String(res.body_raw[0:112]), String( "HTTP/1.1 200 OK\r\nServer: lightbug_http\r\nContent-Type:" " text/plain\r\nContent-Length: 12\r\nConnection: close\r\nDate: " ), ) --- tests/test_header.mojo --- from external.gojo.tests.wrapper import MojoTest from external.gojo.bytes import buffer from external.gojo.bufio import Reader from lightbug_http.header import RequestHeader, ResponseHeader from lightbug_http.io.bytes import Bytes, bytes from lightbug_http.strings import empty_string from lightbug_http.net import default_buffer_size def test_header(): test_parse_request_header() test_parse_response_header() def test_parse_request_header(): var test = MojoTest("test_parse_request_header") var headers_str = bytes('''GET /index.html HTTP/1.1\r\nHost: example.com\r\nUser-Agent: Mozilla/5.0\r\nContent-Type: text/html\r\nContent-Length: 1234\r\nConnection: close\r\nTrailer: end-of-message\r\n\r\n''') var header = RequestHeader() var b = Bytes(headers_str) var buf = buffer.new_buffer(b^) var reader = Reader(buf^) _ = header.parse_raw(reader) test.assert_equal(String(header.request_uri()), "/index.html") test.assert_equal(String(header.protocol()), "HTTP/1.1") test.assert_equal(header.no_http_1_1, False) test.assert_equal(String(header.host()), String("example.com")) test.assert_equal(String(header.user_agent()), "Mozilla/5.0") test.assert_equal(String(header.content_type()), "text/html") test.assert_equal(header.content_length(), 1234) test.assert_equal(header.connection_close(), True) def test_parse_response_header(): var test = MojoTest("test_parse_response_header") var headers_str = bytes('''HTTP/1.1 200 OK\r\nServer: example.com\r\nUser-Agent: Mozilla/5.0\r\nContent-Type: text/html\r\nContent-Encoding: gzip\r\nContent-Length: 1234\r\nConnection: close\r\nTrailer: end-of-message\r\n\r\n''') var header = ResponseHeader() var b = Bytes(headers_str) var buf = buffer.new_buffer(b^) var reader = Reader(buf^) _ = header.parse_raw(reader) test.assert_equal(String(header.protocol()), "HTTP/1.1") test.assert_equal(header.no_http_1_1, False) test.assert_equal(header.status_code(), 200) test.assert_equal(String(header.status_message()), "OK") test.assert_equal(String(header.server()), "example.com") test.assert_equal(String(header.content_type()), "text/html") test.assert_equal(String(header.content_encoding()), "gzip") test.assert_equal(header.content_length(), 1234) test.assert_equal(header.connection_close(), True) test.assert_equal(header.trailer_str(), "end-of-message") --- tests/test_http.mojo --- from external.gojo.tests.wrapper import MojoTest from lightbug_http.io.bytes import Bytes, bytes from lightbug_http.http import HTTPRequest, HTTPResponse, split_http_string, encode from lightbug_http.header import RequestHeader from lightbug_http.uri import URI from tests.utils import ( default_server_conn_string, getRequest, ) def test_http(): test_split_http_string() test_encode_http_request() test_encode_http_response() def test_split_http_string(): var test = MojoTest("test_split_http_string") var cases = Dict[StringLiteral, List[StringLiteral]]() cases["GET /index.html HTTP/1.1\r\nHost: www.example.com\r\nUser-Agent: Mozilla/5.0\r\nContent-Type: text/html\r\nContent-Length: 1234\r\nConnection: close\r\nTrailer: end-of-message\r\n\r\nHello, World!\0"] = List("GET /index.html HTTP/1.1", "Host: www.example.com\r\nUser-Agent: Mozilla/5.0\r\nContent-Type: text/html\r\nContent-Length: 1234\r\nConnection: close\r\nTrailer: end-of-message", "Hello, World!") for c in cases.items(): var buf = bytes((c[].key)) request_first_line, request_headers, request_body = split_http_string(buf) test.assert_equal(request_first_line, c[].value[0]) test.assert_equal(request_headers, String(c[].value[1])) test.assert_equal(request_body, c[].value[2]) def test_encode_http_request(): var test = MojoTest("test_encode_http_request") var uri = URI(default_server_conn_string) var req = HTTPRequest( uri, String("Hello world!").as_bytes(), RequestHeader(getRequest), ) var req_encoded = encode(req) test.assert_equal(String(req_encoded), "GET / HTTP/1.1\r\nContent-Length: 12\r\nConnection: keep-alive\r\n\r\nHello world!") def test_encode_http_response(): var test = MojoTest("test_encode_http_response") var res = HTTPResponse( bytes("Hello, World!"), ) var res_encoded = encode(res) var res_str = String(res_encoded) # Since we cannot compare the exact date, we will only compare the headers until the date and the body var expected_full = "HTTP/1.1 200 OK\r\nServer: lightbug_http\r\nContent-Type: application/octet-stream\r\nContent-Length: 13\r\nConnection: keep-alive\r\nDate: 2024-06-02T13:41:50.766880+00:00\r\n\r\nHello, World!" var expected_headers_len = 124 var hello_world_len = len(String("Hello, World!")) - 1 # -1 for the null terminator var date_header_len = len(String("Date: 2024-06-02T13:41:50.766880+00:00")) var expected_split = String(expected_full).split("\r\n\r\n") var expected_headers = expected_split[0] var expected_body = expected_split[1] test.assert_equal(res_str[:expected_headers_len], expected_headers[:len(expected_headers) - date_header_len]) test.assert_equal(res_str[(len(res_str) - hello_world_len):len(res_str) + 1], expected_body) --- tests/test_io.mojo --- from external.gojo.tests.wrapper import MojoTest from lightbug_http.io.bytes import Bytes, bytes_equal, bytes def test_io(): test_string_literal_to_bytes() fn test_string_literal_to_bytes() raises: var test = MojoTest("test_string_to_bytes") var cases = Dict[StringLiteral, Bytes]() cases[""] = Bytes() cases["Hello world!"] = List[UInt8](72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33) cases["\0"] = List[UInt8](0) cases["\0\0\0\0"] = List[UInt8](0, 0, 0, 0) cases["OK"] = List[UInt8](79, 75) cases["HTTP/1.1 200 OK"] = List[UInt8](72, 84, 84, 80, 47, 49, 46, 49, 32, 50, 48, 48, 32, 79, 75) for c in cases.items(): test.assert_true(bytes_equal(bytes(c[].key), c[].value)) fn test_string_to_bytes() raises: var test = MojoTest("test_string_to_bytes") var cases = Dict[String, Bytes]() cases[String("")] = Bytes() cases[String("Hello world!")] = List[UInt8](72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33) cases[String("\0")] = List[UInt8](0) cases[String("\0\0\0\0")] = List[UInt8](0, 0, 0, 0) cases[String("OK")] = List[UInt8](79, 75) cases[String("HTTP/1.1 200 OK")] = List[UInt8](72, 84, 84, 80, 47, 49, 46, 49, 32, 50, 48, 48, 32, 79, 75) for c in cases.items(): test.assert_true(bytes_equal(bytes(c[].key), c[].value)) --- tests/test_net.mojo --- def test_net(): test_split_host_port() def test_split_host_port(): ... --- tests/test_uri.mojo --- from external.gojo.tests.wrapper import MojoTest from lightbug_http.uri import URI from lightbug_http.strings import empty_string from lightbug_http.io.bytes import Bytes def test_uri(): test_uri_no_parse_defaults() test_uri_parse_http_with_port() test_uri_parse_https_with_port() test_uri_parse_http_with_path() test_uri_parse_https_with_path() test_uri_parse_http_basic() test_uri_parse_http_basic_www() test_uri_parse_http_with_query_string() test_uri_parse_http_with_hash() test_uri_parse_http_with_query_string_and_hash() def test_uri_no_parse_defaults(): var test = MojoTest("test_uri_no_parse_defaults") var uri = URI("http://example.com") test.assert_equal(String(uri.full_uri()), "http://example.com") test.assert_equal(String(uri.scheme()), "http") test.assert_equal(String(uri.path()), "/") def test_uri_parse_http_with_port(): var test = MojoTest("test_uri_parse_http_with_port") var uri = URI("http://example.com:8080/index.html") _ = uri.parse() test.assert_equal(String(uri.scheme()), "http") test.assert_equal(String(uri.host()), "example.com:8080") test.assert_equal(String(uri.path()), "/index.html") test.assert_equal(String(uri.path_original()), "/index.html") test.assert_equal(String(uri.request_uri()), "/index.html") test.assert_equal(String(uri.http_version()), "HTTP/1.1") test.assert_equal(uri.is_http_1_0(), False) test.assert_equal(uri.is_http_1_1(), True) test.assert_equal(uri.is_https(), False) test.assert_equal(uri.is_http(), True) test.assert_equal(String(uri.query_string()), String(empty_string.as_bytes_slice())) def test_uri_parse_https_with_port(): var test = MojoTest("test_uri_parse_https_with_port") var uri = URI("https://example.com:8080/index.html") _ = uri.parse() test.assert_equal(String(uri.scheme()), "https") test.assert_equal(String(uri.host()), "example.com:8080") test.assert_equal(String(uri.path()), "/index.html") test.assert_equal(String(uri.path_original()), "/index.html") test.assert_equal(String(uri.request_uri()), "/index.html") test.assert_equal(uri.is_https(), True) test.assert_equal(uri.is_http(), False) test.assert_equal(String(uri.query_string()), String(empty_string.as_bytes_slice())) def test_uri_parse_http_with_path(): var test = MojoTest("test_uri_parse_http_with_path") uri = URI("http://example.com/index.html") _ = uri.parse() test.assert_equal(String(uri.scheme()), "http") test.assert_equal(String(uri.host()), "example.com") test.assert_equal(String(uri.path()), "/index.html") test.assert_equal(String(uri.path_original()), "/index.html") test.assert_equal(String(uri.request_uri()), "/index.html") test.assert_equal(uri.is_https(), False) test.assert_equal(uri.is_http(), True) test.assert_equal(String(uri.query_string()), String(empty_string.as_bytes_slice())) def test_uri_parse_https_with_path(): var test = MojoTest("test_uri_parse_https_with_path") uri = URI("https://example.com/index.html") _ = uri.parse() test.assert_equal(String(uri.scheme()), "https") test.assert_equal(String(uri.host()), "example.com") test.assert_equal(String(uri.path()), "/index.html") test.assert_equal(String(uri.path_original()), "/index.html") test.assert_equal(String(uri.request_uri()), "/index.html") test.assert_equal(uri.is_https(), True) test.assert_equal(uri.is_http(), False) test.assert_equal(String(uri.query_string()), String(empty_string.as_bytes_slice())) def test_uri_parse_http_basic(): var test = MojoTest("test_uri_parse_http_basic") uri = URI("http://example.com") _ = uri.parse() test.assert_equal(String(uri.scheme()), "http") test.assert_equal(String(uri.host()), "example.com") test.assert_equal(String(uri.path()), "/") test.assert_equal(String(uri.path_original()), "/") test.assert_equal(String(uri.http_version()), "HTTP/1.1") test.assert_equal(String(uri.request_uri()), "/") test.assert_equal(String(uri.query_string()), String(empty_string.as_bytes_slice())) def test_uri_parse_http_basic_www(): var test = MojoTest("test_uri_parse_http_basic_www") uri = URI("http://www.example.com") _ = uri.parse() test.assert_equal(String(uri.scheme()), "http") test.assert_equal(String(uri.host()), "www.example.com") test.assert_equal(String(uri.path()), "/") test.assert_equal(String(uri.path_original()), "/") test.assert_equal(String(uri.request_uri()), "/") test.assert_equal(String(uri.http_version()), "HTTP/1.1") test.assert_equal(String(uri.query_string()), String(empty_string.as_bytes_slice())) def test_uri_parse_http_with_query_string(): ... def test_uri_parse_http_with_hash(): ... def test_uri_parse_http_with_query_string_and_hash(): ... --- tests/utils.mojo --- from python import Python, PythonObject from lightbug_http.io.bytes import Bytes from lightbug_http.error import ErrorHandler from lightbug_http.uri import URI from lightbug_http.http import HTTPRequest, HTTPResponse, ResponseHeader from lightbug_http.net import Listener, Addr, Connection, TCPAddr from lightbug_http.service import HTTPService, OK from lightbug_http.server import ServerTrait from lightbug_http.client import Client from lightbug_http.io.bytes import bytes alias default_server_conn_string = "http://localhost:8080" alias getRequest = bytes( "GET /foobar?baz HTTP/1.1\r\nHost: google.com\r\nUser-Agent: aaa/bbb/ccc/ddd/eee" " Firefox Chrome MSIE Opera\r\n" + "Referer: http://example.com/aaa?bbb=ccc\r\nCookie: foo=bar; baz=baraz;" " aa=aakslsdweriwereowriewroire\r\n\r\n" ) alias defaultExpectedGetResponse = bytes( "HTTP/1.1 200 OK\r\nServer: lightbug_http\r\nContent-Type:" " text/plain\r\nContent-Length: 12\r\nConnection: close\r\nDate: \r\n\r\nHello" " world!" ) @parameter fn new_httpx_client() -> PythonObject: try: var httpx = Python.import_module("httpx") return httpx except e: print("Could not set up httpx client: " + e.__str__()) return None fn new_fake_listener(request_count: Int, request: Bytes) -> FakeListener: return FakeListener(request_count, request) struct ReqInfo: var full_uri: URI var host: String var is_tls: Bool fn __init__(inout self, full_uri: URI, host: String, is_tls: Bool): self.full_uri = full_uri self.host = host self.is_tls = is_tls struct FakeClient(Client): """FakeClient doesn't actually send any requests, but it extracts useful information from the input. """ var name: String var host: StringLiteral var port: Int var req_full_uri: URI var req_host: String var req_is_tls: Bool fn __init__(inout self) raises: self.host = "127.0.0.1" self.port = 8888 self.name = "lightbug_http_fake_client" self.req_full_uri = URI("") self.req_host = "" self.req_is_tls = False fn __init__(inout self, host: StringLiteral, port: Int) raises: self.host = host self.port = port self.name = "lightbug_http_fake_client" self.req_full_uri = URI("") self.req_host = "" self.req_is_tls = False fn do(self, req: HTTPRequest) raises -> HTTPResponse: return OK(String(defaultExpectedGetResponse)) fn extract(inout self, req: HTTPRequest) raises -> ReqInfo: var full_uri = req.uri() try: _ = full_uri.parse() except e: print("error parsing uri: " + e.__str__()) self.req_full_uri = full_uri var host = String(full_uri.host()) if host == "": raise Error("URI host is nil") self.req_host = host var is_tls = full_uri.is_https() self.req_is_tls = is_tls return ReqInfo(full_uri, host, is_tls) struct FakeServer(ServerTrait): var __listener: FakeListener var __handler: FakeResponder fn __init__(inout self, listener: FakeListener, handler: FakeResponder): self.__listener = listener self.__handler = handler fn __init__( inout self, addr: String, service: HTTPService, error_handler: ErrorHandler ): self.__listener = FakeListener() self.__handler = FakeResponder() fn get_concurrency(self) -> Int: return 1 fn listen_and_serve(self, address: String, handler: HTTPService) raises -> None: ... fn serve(inout self) -> None: while not self.__listener.closed: try: _ = self.__listener.accept() except e: print(e) fn serve(self, ln: Listener, handler: HTTPService) raises -> None: ... @value struct FakeResponder(HTTPService): fn func(self, req: HTTPRequest) raises -> HTTPResponse: var method = String(req.header.method()) if method != "GET": raise Error("Did not expect a non-GET request! Got: " + method) return OK(bytes("Hello, world!")) @value struct FakeConnection(Connection): fn __init__(inout self, laddr: String, raddr: String) raises: ... fn __init__(inout self, laddr: TCPAddr, raddr: TCPAddr) raises: ... fn read(self, inout buf: Bytes) raises -> Int: return 0 fn write(self, buf: Bytes) raises -> Int: return 0 fn close(self) raises: ... fn local_addr(inout self) raises -> TCPAddr: return TCPAddr() fn remote_addr(self) raises -> TCPAddr: return TCPAddr() @value struct FakeListener: var request_count: Int var request: Bytes var closed: Bool fn __init__(inout self): self.request_count = 0 self.request = Bytes() self.closed = False fn __init__(inout self, addr: TCPAddr): self.request_count = 0 self.request = Bytes() self.closed = False fn __init__(inout self, request_count: Int, request: Bytes): self.request_count = request_count self.request = request self.closed = False @always_inline fn accept(self) raises -> FakeConnection: return FakeConnection() fn close(self) raises: pass fn addr(self) -> TCPAddr: return TCPAddr() @value struct TestStruct: var a: String var b: String var c: Bytes var d: Int var e: TestStructNested fn __init__(inout self, a: String, b: String) -> None: self.a = a self.b = b self.c = bytes("c") self.d = 1 self.e = TestStructNested("a", 1) fn set_a_direct(inout self, a: String) -> Self: self.a = a return self fn set_a_copy(self, a: String) -> Self: return Self(a, self.b) @value struct TestStructNested: var a: String var b: Int fn __init__(inout self, a: String, b: Int) -> None: self.a = a self.b = b fn set_a_direct(inout self, a: String) -> Self: self.a = a return self fn set_a_copy(self, a: String) -> Self: return Self(a, self.b) --- .gitignore --- # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ .DS_Store --- LICENSE --- MIT License Copyright (c) 2024 Martin Dudek Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # momograd ![''](/imgs/momograd.jpg) ## A Learning Journey: Micrograd in Mojo 🔥 This project represents an implementation of Andrej Karpathy's Python based [micrograd](https://github.com/karpathy/micrograd) library in the [Mojo](https://docs.modular.com/mojo) programming language. `micrograd` is a tiny scalar-valued autograd engine and a neural net library on top of it with PyTorch-like API. For an in depth explanation of what it is about and it's implementation details, don't miss to watch Andrej's excellent YouTube video [The spelled-out intro to neural networks and backpropagation: building micrograd](https://www.youtube.com/watch?v=VMj-3S1tku0). `momograd` aims to follow `micrograd's` clean implementation structure with no intention to go beyond its functionality, but to learn how things can be done in Mojo. Expect to encounter bugs and sharp edges here. `momograd.x` ventures further into exploring Mojo's unique capabilities, focusing on optimizations such as vectorization and parallelization. This extension serves as a playground for delving into more advanced Mojo-specific enhancements, pushing beyond the original implementation logic of `micrograd` to explore how performance and efficiency can be improved within the Mojo sphere. ## momograd.engine The `Value` struct of `momograd.engine` represents the basic building block for the computational graph. ``` python from momograd.engine import Value fn main() raises: var a = Value(3,"a") var b = Value(2,"b") var c = a + b c.label = 'c' # optional label var d = c ** a d.label = 'd' # calulating the gradients of the computational graph d.backward() print(d) # <data: 125.0, grad: 1.0> print("\nComputational graph:") d.print_branch() ``` See [demo_engine.mojo](https://github.com/dorjeduck/momograd/blob/main/demo_engine.mojo) for a more elaborate example. ## momograd.nn Following the implementation of `micrograd`, `momograd.nn` contains two structs for building neuronal networks, `Neuron` and `Layer`, and an implementation of a Multi-Layer Perceptron, `MLP`. See [demo_nn.mojo](https://github.com/dorjeduck/momograd/blob/main/demo_nn.mojo) for a basic example how to use these structs in Mojo. ## momograd.x Playground for Mojo specific optimizations. ## Benchmarks The `micrograd` github repository includes a full demo of training an 2-layer neural network (MLP) binary classifier ([demo.ipynb](https://github.com/karpathy/micrograd/blob/master/demo.ipynb)). In order to be able to run basic benchmark comparisons, we include the core of it in [binary_classifier.py](https://github.com/dorjeduck/momograd/blob/main/binary_classifier.py), and reimplemented it in Mojo using `momograd`: [binary_classifier.mojo](https://github.com/dorjeduck/momograd/blob/main/binary_classifier.mojo). [binary_classifier_x.mojo](https://github.com/dorjeduck/momograd/blob/main/binary_classifier_x.mojo) takes advantage of our experimental momograd.x package. Please take the following benchmark results with a grain of salt. We basically ignored everything mentioned in the excellent blog post by Konstantinos Krommydas, [How to Be Confident in Your Performance Benchmarking](https://www.modular.com/blog/how-to-be-confident-in-your-performance-benchmarking). Here we just measured the time the training loops took for 100 epochs and various sample size inputs for [binary_classifier.py](https://github.com/dorjeduck/momograd/blob/main/binary_classifier.py) and [binary_classifier.mojo](https://github.com/dorjeduck/momograd/blob/main/binary_classifier.mojo), averaged over a couple of runs, and joyfully observed how fast Mojo actually is. &nbsp; <div align="center"> | samples| micrograd (sec) | momograd (sec) | momograd.x (sec) | speedup micro/momo | speedup micro/momo.x | speedup momo/momo.x | | --- | --- |---| --- | --- | ---| --- | | 20 | 5.64 | 0.15 | 0.13 | 36.6x | 44.9x | 1.2x | | 40 | 18.37 | 0.31 | 0.23 | 59.1x | 79.8x | 1.3x | | 60 | 35.06 | 0.48 | 0.35 | 72.7x | 100.1x | 1.4x | | 80 | 53.93 | 0.63 | 0.48 | 86.1x | 112.6x | 1.3x | | 100 | 73.91 | 0.82 | 0.61 | 90.5x | 122.0x | 1.3x | | 120 | 94.01 | 0.97 | 0.71 | 96.8x | 132.3x | 1.4x | | 140 | 113.46 | 1.16 | 0.84 | 97.7x | 134.4x | 1.4x | | 160 | 131.64 | 1.28 | 0.91 | 102.5x | 144.6x | 1.4x | | 180 | 149.30 | 1.46 | 1.01 | 102.6x | 148.5x | 1.4x | | 200 | 168.71 | 1.70 | 1.28 | 99.1x | 131.7x | 1.3x | &nbsp; ![''](/imgs/chart_time_comparison.png) &nbsp; ![''](/imgs/chart_speedup_comparison.png) </div> For instructions on running benchmarks, see [Benchmark Instructions](benchmarks/BENCHMARK_INSTRUCTIONS.md). ## Changelog * 2024.06.07 * Updated to Mojo 24.4 * 2024.03.31 * Introduced momograd.x: A new package focusing on Mojo-specific performance enhancements. * `momograd.x` boosts `momograd` performance by 1.4x through MLP layer-level parallelization for forward pass. * 2024.03.29 * Initial repository setup and commit. ## License MIT --- benchmarks/BENCHMARK_INSTRUCTIONS.md --- We include the scripts for running these basic benchmarks in the `benchmarks` folder. On a unix like system you can run these in the terminal: Besides Mojo, install the required Python libs: ```bash pip install matplotlib, micrograd, numpy, pandas, scikit-learn ``` Execute the following commands to run the benchmarks, average and combine the benchmark results and create the charts and markdown table. ``` bash cd ./benchmarks # Usage: ./run_benchmarks.sh <epochs> 'sample_sizes' [rounds] ./run_benchmarks.sh 100 '20 50 100 150 200' 5 python combine_benchmark_results.py python create_charts_and_md.py ``` This repo contains the benchmark results from our local machine for reference. You might want to delete the `./benchmarks/results` folder before running your own benchmarks. --- benchmarks/combine_benchmark_results.py --- import pandas as pd import glob def process_and_combine_csv(type): # Build the file pattern based on the file_type argument pattern = f'results/benchmark_{type}_*.csv' csv_files = glob.glob(pattern) df_list = [pd.read_csv(file) for file in csv_files if csv_files] if df_list: combined_df = pd.concat(df_list, ignore_index=True) grouped_df = combined_df.groupby(['n_samples', 'n_epochs'], as_index=False).mean() output_file = f'results/benchmarks_{type}_averaged.csv' grouped_df.to_csv(output_file, index=False) print(f"Averaged data saved to {output_file}") return output_file else: print(f"No CSV files matched the pattern {pattern}.") return None # Process and save averaged benchmarks for both mojo and py by calling the function with the respective type momograd_file = process_and_combine_csv('momograd') momogradx_file = process_and_combine_csv('momogradx') micrograd_file = process_and_combine_csv('micrograd') # Function to combine the averaged benchmark files of mojo and py into one def combine_averaged_benchmarks(momograd_file, momogradx_file,micrograd_file): if momograd_file and micrograd_file and momogradx_file: df_momograd = pd.read_csv(momograd_file) df_momogradx = pd.read_csv(momogradx_file) df_micrograd = pd.read_csv(micrograd_file) # Rename columns to indicate type df_momograd.rename(columns={'time': 'time_momograd', 'accuracy': 'accuracy_momograd'}, inplace=True) df_momogradx.rename(columns={'time': 'time_momogradx', 'accuracy': 'accuracy_momogradx'}, inplace=True) df_micrograd.rename(columns={'time': 'time_micrograd', 'accuracy': 'accuracy_micrograd'}, inplace=True) # First merge df_momograd and df_momogradx combined_df = pd.merge(df_momograd, df_momogradx, on=['n_samples', 'n_epochs']) # Then merge the result with df_micrograd combined_df = pd.merge(combined_df, df_micrograd, on=['n_samples', 'n_epochs']) # Reorder columns to have time values next to each other, then accuracy values combined_df = combined_df[['n_samples', 'n_epochs', 'time_micrograd', 'time_momograd','time_momogradx', 'accuracy_micrograd', 'accuracy_momograd', 'accuracy_momogradx']] # Save the combined DataFrame to a new CSV file combined_df.to_csv('results/benchmarks_comparison.csv', index=False) print("Combined averaged benchmarks saved to results/benchmarks_comparison.csv") else: print("Could not find both mojo and py benchmark files.") # Combine the mojo and py benchmarks into one file combine_averaged_benchmarks(momograd_file,momogradx_file, micrograd_file) --- benchmarks/create_charts_and_md.py --- import pandas as pd import matplotlib.pyplot as plt import numpy as np # Load the combined benchmarks data df = pd.read_csv('results/benchmarks_comparison.csv') # Set the plot style plt.style.use('seaborn-darkgrid' if 'seaborn-darkgrid' in plt.style.available else 'classic') # Create a new figure and set its size fig, ax = plt.subplots(figsize=(12, 7)) # Plotting n_groups = len(df) index = np.arange(n_groups) bar_width = 0.35 # Plotting Py bars and text annotations bars_micrograd = ax.bar(index - bar_width/2, df['time_micrograd'], bar_width, label='micrograd', alpha=0.8) # Plotting Mojo bars and text annotations bars_momograd = ax.bar(index + bar_width/2, df['time_momograd'], bar_width, label='momograd', alpha=0.8, color='orange') # Function to add text annotations above bars with increased distance def add_value_labels(bars): for bar in bars: height = bar.get_height() # Increase the vertical distance; adjust the multiplier as needed vertical_distance = 3 # Increase or adjust as needed ax.text(bar.get_x() + bar.get_width() / 2., height + vertical_distance, '{:.2f}'.format(height), ha='center', va='bottom', rotation=90) # Adding labels and title ax.set_xlabel('samples') ax.set_ylabel('Time (s)') ax.set_title('Time Comparison micrograd / momograd') # Set the x-ticks to be the indexes with n_samples as labels ax.set_xticks(index) ax.set_xticklabels(df['n_samples'].astype(str)) # Adjust the x-axis limits to reduce the gap between the y-axis and the first bar ax.set_xlim(-0.5, n_groups - 0.5) # Add value labels add_value_labels(bars_micrograd) add_value_labels(bars_momograd) # Place the legend in the upper left corner of the plot ax.legend(loc='upper left') # Adjust y-axis limit to accommodate text annotations ymax = df[['time_momograd', 'time_micrograd']].max().max() # Find the maximum value y_limit_buffer = 30 ax.set_ylim(0, ymax + y_limit_buffer) plt.tight_layout() # Save the plot to a file plt.savefig('charts/chart_time_comparison.png', dpi=300, bbox_inches="tight") print("Time comparison chart has been saved to 'charts/chart_time_comparison.png'") # Calculate the speedup factor for each row df['speedup'] = df['time_micrograd'] / df['time_momograd'] # Create a new figure for the speedup chart plt.figure(figsize=(10, 6)) # Plotting the speedup factor as a bar chart plt.bar(df['n_samples'].astype(str), df['speedup'], color='orange', label='Speedup Factor (Py/Mojo)') # Adding labels and title plt.xlabel('samples') plt.ylabel('Speedup Factor (micrograd/momograd)') plt.title('Speedup of momograd over micrograd by samples') # Adding x-ticks for clarity plt.xticks(rotation=45) plt.tight_layout() # Save the plot to a file plt.savefig('charts/chart_speedup_comparison.png', dpi=300) print("Speedup comparison chart has been saved to 'charts/chart_speedup_comparison.png'") ## markdown table # Calculate the speedup factor for each row df['speedup_micro_momo'] = df['time_micrograd'] / df['time_momograd'] df['speedup_micro_momox'] = df['time_micrograd'] / df['time_momogradx'] df['speedup_momo_momox'] = df['time_momograd'] / df['time_momogradx'] # Open a Markdown file to write the table with open('results/benchmark_results.md', 'w') as md_file: # Write the table header md_file.write('# Benchmark Results\n\n') md_file.write('| samples | micrograd (sec) | momograd (sec) | momograd.x (sec) | speedup micro/momo | speedup micro/momo.x | speedup momo/momo.x |\n') md_file.write('| --- | --- |---| --- | --- | ---| --- |\n') # Iterate over each row in the DataFrame and write the table row for index, row in df.iterrows(): md_file.write(f"| {int(row['n_samples'])} | {row['time_micrograd']:.2f} | {row['time_momograd']:.2f} | {row['time_momogradx']:.2f} | {row['speedup_micro_momo']:.1f}x | {row['speedup_micro_momox']:.1f}x | {row['speedup_momo_momox']:.1f}x |\n") print("Markdown table has been written to 'results/benchmark_results.md'") --- benchmarks/results/benchmark_micrograd_20240325_194353.csv --- n_samples,n_epochs,time,accuracy 20,100,5.501450061798096,1.0 40,100,18.15193796157837,1.0 60,100,34.85137414932251,1.0 80,100,55.069464921951294,1.0 100,100,75.1777069568634,1.0 120,100,95.08159804344177,1.0 140,100,113.34918689727783,1.0 160,100,133.18515515327454,1.0 180,100,149.8881220817566,1.0 200,100,168.80316495895386,1.0 --- benchmarks/results/benchmark_micrograd_20240325_195846.csv --- n_samples,n_epochs,time,accuracy 20,100,5.589963912963867,1.0 40,100,18.288732767105103,1.0 60,100,34.45664191246033,1.0 80,100,53.649574995040894,1.0 100,100,73.88351011276245,1.0 120,100,94.39376997947693,1.0 140,100,113.53578281402588,1.0 160,100,130.38056302070618,1.0 180,100,149.41601467132568,1.0 200,100,169.58489108085632,1.0 --- benchmarks/results/benchmark_micrograd_20240325_201320.csv --- n_samples,n_epochs,time,accuracy 20,100,5.61487603187561,1.0 40,100,18.696485996246338,1.0 60,100,34.864234924316406,1.0 80,100,53.913877964019775,1.0 100,100,73.49435806274414,1.0 120,100,94.08545589447021,1.0 140,100,113.27753686904907,1.0 160,100,130.6343128681183,1.0 180,100,149.15324902534485,1.0 200,100,168.58109402656555,1.0 --- benchmarks/results/benchmark_micrograd_20240325_202935.csv --- n_samples,n_epochs,time,accuracy 20,100,5.973331928253174,1.0 40,100,18.35682988166809,1.0 60,100,36.61719608306885,1.0 80,100,53.44642782211304,1.0 100,100,73.51700592041016,1.0 120,100,93.40988993644714,1.0 140,100,113.84309887886047,1.0 160,100,130.8801691532135,1.0 180,100,149.14161109924316,1.0 200,100,168.1179177761078,1.0 --- benchmarks/results/benchmark_micrograd_20240325_204707.csv --- n_samples,n_epochs,time,accuracy 20,100,5.530424118041992,1.0 40,100,18.369855165481567,1.0 60,100,34.52221989631653,1.0 80,100,53.55967402458191,1.0 100,100,73.48361086845398,1.0 120,100,93.10315918922424,1.0 140,100,113.27025699615479,1.0 160,100,133.13186407089233,1.0 180,100,148.90441393852234,1.0 200,100,168.47614812850952,1.0 --- benchmarks/results/benchmark_momograd_20240331_134906.csv --- n_samples,n_epochs,time,accuracy 20,100,0.15354000000000001,1.0 40,100,0.29850300000000002,1.0 60,100,0.47632799999999997,1.0 80,100,0.61416599999999999,1.0 100,100,0.80657999999999996,1.0 120,100,0.95693600000000001,1.0 140,100,1.1140300000000001,1.0 160,100,1.3060769999999999,1.0 180,100,1.4636309999999999,1.0 200,100,1.7094499999999999,1.0 --- benchmarks/results/benchmark_momograd_20240331_135009.csv --- n_samples,n_epochs,time,accuracy 20,100,0.153589,1.0 40,100,0.31648399999999999,1.0 60,100,0.48011100000000001,1.0 80,100,0.61906399999999995,1.0 100,100,0.819353,1.0 120,100,0.96576300000000004,1.0 140,100,1.1304369999999999,1.0 160,100,1.2787470000000001,1.0 180,100,1.4423010000000001,1.0 200,100,1.682877,1.0 --- benchmarks/results/benchmark_momograd_20240331_135109.csv --- n_samples,n_epochs,time,accuracy 20,100,0.15801599999999999,1.0 40,100,0.31188100000000002,1.0 60,100,0.49233100000000002,1.0 80,100,0.62309400000000004,1.0 100,100,0.81351799999999996,1.0 120,100,0.98229299999999997,1.0 140,100,1.1134299999999999,1.0 160,100,1.2635270000000001,1.0 180,100,1.462337,1.0 200,100,1.7126060000000001,1.0 --- benchmarks/results/benchmark_momograd_20240331_135213.csv --- n_samples,n_epochs,time,accuracy 20,100,0.15693499999999999,1.0 40,100,0.31426799999999999,1.0 60,100,0.475101,1.0 80,100,0.63025200000000003,1.0 100,100,0.82424799999999998,1.0 120,100,0.96498300000000004,1.0 140,100,1.1101760000000001,1.0 160,100,1.2823009999999999,1.0 180,100,1.4510339999999999,1.0 200,100,1.697265,1.0 --- benchmarks/results/benchmark_momograd_20240331_135316.csv --- n_samples,n_epochs,time,accuracy 20,100,0.149648,1.0 40,100,0.31203700000000001,1.0 60,100,0.48633900000000002,1.0 80,100,0.64342699999999997,1.0 100,100,0.81788400000000006,1.0 120,100,0.98385900000000004,1.0 140,100,1.337188,1.0 160,100,1.2907949999999999,1.0 180,100,1.4562839999999999,1.0 200,100,1.713916,1.0 --- benchmarks/results/benchmark_momogradx_20240331_134906.csv --- n_samples,n_epochs,time,accuracy 20,100,0.14333199999999999,1.0 40,100,0.23097599999999999,1.0 60,100,0.36366700000000002,1.0 80,100,0.48757800000000001,1.0 100,100,0.587121,1.0 120,100,0.75501799999999997,1.0 140,100,0.78928100000000001,1.0 160,100,0.86884700000000004,1.0 180,100,1.0226679999999999,1.0 200,100,1.345062,1.0 --- benchmarks/results/benchmark_momogradx_20240331_135009.csv --- n_samples,n_epochs,time,accuracy 20,100,0.11909400000000001,1.0 40,100,0.23259199999999999,1.0 60,100,0.33910600000000002,1.0 80,100,0.46889599999999998,1.0 100,100,0.62408600000000003,1.0 120,100,0.66990000000000005,1.0 140,100,0.796211,1.0 160,100,0.86902999999999997,1.0 180,100,1.004883,1.0 200,100,1.3147789999999999,1.0 --- benchmarks/results/benchmark_momogradx_20240331_135109.csv --- n_samples,n_epochs,time,accuracy 20,100,0.121266,1.0 40,100,0.23261899999999999,1.0 60,100,0.372971,1.0 80,100,0.49690299999999998,1.0 100,100,0.58972599999999997,1.0 120,100,0.71176300000000003,1.0 140,100,0.842669,1.0 160,100,0.96830300000000002,1.0 180,100,0.98887499999999995,1.0 200,100,1.228475,1.0 --- benchmarks/results/benchmark_momogradx_20240331_135213.csv --- n_samples,n_epochs,time,accuracy 20,100,0.13661599999999999,1.0 40,100,0.220807,1.0 60,100,0.33605099999999999,1.0 80,100,0.48664099999999999,1.0 100,100,0.61511499999999997,1.0 120,100,0.68238799999999999,1.0 140,100,0.86702599999999996,1.0 160,100,0.96552899999999997,1.0 180,100,0.98186600000000002,1.0 200,100,1.1602049999999999,1.0 --- benchmarks/results/benchmark_momogradx_20240331_135316.csv --- n_samples,n_epochs,time,accuracy 20,100,0.107697,1.0 40,100,0.234847,1.0 60,100,0.340059,1.0 80,100,0.45543400000000001,1.0 100,100,0.61318700000000004,1.0 120,100,0.734155,1.0 140,100,0.92652900000000005,1.0 160,100,0.88138000000000005,1.0 180,100,1.028421,1.0 200,100,1.354555,1.0 --- benchmarks/results/benchmark_results.md --- # Benchmark Results | samples | micrograd (sec) | momograd (sec) | momograd.x (sec) | speedup micro/momo | speedup micro/momo.x | speedup momo/momo.x | | --- | --- |---| --- | --- | ---| --- | | 20 | 5.64 | 0.15 | 0.13 | 36.6x | 44.9x | 1.2x | | 40 | 18.37 | 0.31 | 0.23 | 59.1x | 79.8x | 1.3x | | 60 | 35.06 | 0.48 | 0.35 | 72.7x | 100.1x | 1.4x | | 80 | 53.93 | 0.63 | 0.48 | 86.1x | 112.6x | 1.3x | | 100 | 73.91 | 0.82 | 0.61 | 90.5x | 122.0x | 1.3x | | 120 | 94.01 | 0.97 | 0.71 | 96.8x | 132.3x | 1.4x | | 140 | 113.46 | 1.16 | 0.84 | 97.7x | 134.4x | 1.4x | | 160 | 131.64 | 1.28 | 0.91 | 102.5x | 144.6x | 1.4x | | 180 | 149.30 | 1.46 | 1.01 | 102.6x | 148.5x | 1.4x | | 200 | 168.71 | 1.70 | 1.28 | 99.1x | 131.7x | 1.3x | --- benchmarks/results/benchmarks_comparison.csv --- n_samples,n_epochs,time_micrograd,time_momograd,time_momogradx,accuracy_micrograd,accuracy_momograd,accuracy_momogradx 20,100,5.642009210586548,0.1543455999999999,0.1256009999999999,1.0,1.0,1.0 40,100,18.372768354415893,0.3106345999999999,0.2303681999999999,1.0,1.0,1.0 60,100,35.06233339309692,0.482042,0.3503708,1.0,1.0,1.0 80,100,53.927803945541385,0.6260006,0.4790903999999999,1.0,1.0,1.0 100,100,73.91123838424683,0.8163165999999998,0.605847,1.0,1.0,1.0 120,100,94.01477460861204,0.9707668,0.7106448,1.0,1.0,1.0 140,100,113.4551724910736,1.1610522,0.8443432,1.0,1.0,1.0 160,100,131.64241285324096,1.2842894,0.9106178,1.0,1.0,1.0 180,100,149.30068216323852,1.4551174,1.0053426,1.0,1.0,1.0 200,100,168.71264319419862,1.7032228,1.2806152,1.0,1.0,1.0 --- benchmarks/results/benchmarks_micrograd_averaged.csv --- n_samples,n_epochs,time,accuracy 20,100,5.642009210586548,1.0 40,100,18.372768354415893,1.0 60,100,35.06233339309692,1.0 80,100,53.927803945541385,1.0 100,100,73.91123838424683,1.0 120,100,94.01477460861204,1.0 140,100,113.45517249107361,1.0 160,100,131.64241285324096,1.0 180,100,149.30068216323852,1.0 200,100,168.71264319419862,1.0 --- benchmarks/results/benchmarks_momograd_averaged.csv --- n_samples,n_epochs,time,accuracy 20,100,0.15434559999999997,1.0 40,100,0.3106345999999999,1.0 60,100,0.482042,1.0 80,100,0.6260006,1.0 100,100,0.8163165999999998,1.0 120,100,0.9707668,1.0 140,100,1.1610521999999999,1.0 160,100,1.2842894,1.0 180,100,1.4551174,1.0 200,100,1.7032228,1.0 --- benchmarks/results/benchmarks_momogradx_averaged.csv --- n_samples,n_epochs,time,accuracy 20,100,0.12560099999999996,1.0 40,100,0.23036819999999994,1.0 60,100,0.3503708,1.0 80,100,0.4790903999999999,1.0 100,100,0.605847,1.0 120,100,0.7106448,1.0 140,100,0.8443432,1.0 160,100,0.9106178,1.0 180,100,1.0053426,1.0 200,100,1.2806152,1.0 --- benchmarks/run_benchmarks.sh --- #!/bin/bash # Check for at least 2 arguments if [ "$#" -lt 2 ]; then echo "Usage: $0 <epochs> 'sample_sizes' [rounds]" exit 1 fi # Assign command line arguments to variables epochs=$1 sample_sizes=($2) # Sample sizes are passed in quotes, e.g., "20 50 100" # If rounds is not provided, default to 1 rounds=${3:-1} # Create the results directory if it does not exist mkdir -p "results" # Main loop to run the specified number of rounds for (( r=1; r<=rounds; r++ )); do # Generate a timestamp for the current time # For example, YYYYMMDD_HHMMSS format stamp=$(date "+%Y%m%d_%H%M%S") echo "Round $r of $rounds" for samples in "${sample_sizes[@]}"; do echo "Running binary_classifier.mojo with ${samples} samples for ${epochs} training epochs." momograd_output="results/benchmark_momograd_${stamp}.csv" mojo ../binary_classifier.mojo $epochs $samples --silent --csv $momograd_output done for samples in "${sample_sizes[@]}"; do echo "Running binary_classifier.mojo with ${samples} samples for ${epochs} training epochs." momogradx_output="results/benchmark_momogradx_${stamp}.csv" mojo ../binary_classifier_x.mojo $epochs $samples --silent --csv $momogradx_output done echo " " # Loop through the sample sizes and call the Python program with each size for samples in "${sample_sizes[@]}"; do echo "Running binary_classifier.py with ${samples} samples for ${epochs} training epochs." #micrograd_output="results/benchmark_micrograd_${stamp}.csv" #python ../binary_classifier.py --epochs=$epochs --samples=$samples --silent --csv --csv_file_path=$micrograd_output done echo " " done echo "All runs completed." --- binary_classifier.mojo --- from python import Python from python.object import PythonObject from time import now from random import seed from sys import argv from collections.vector import InlinedFixedVector from momograd.engine import Value, ValueList from momograd.nn import Neuron, Layer, MLP from momograd.util import append_to_file def logging(txt: String, silent: Bool = False) -> None: if not silent: print(txt) fn main() raises: seed(37) var N_EPOCHS = 50 # number of training steps var N_SAMPLES = 50 # number of training samples var SILENT = False var CSV_FILE_PATH: String = "benchmark_mojo.csv" var BENCHMARK_CSV = False var args = argv() # ... to enable benchmark automation ;-) if len(args) > 1: N_EPOCHS = atol(args[1]) if len(args) > 2: N_SAMPLES = atol(args[2]) if len(args) > 3 and args[3] == "--silent": SILENT = True if len(args) > 4 and args[4] == "--csv": BENCHMARK_CSV = True if len(args) > 5: CSV_FILE_PATH = args[5] var nin = 2 var nouts = VariadicList[Int](16, 16, 1) var model = MLP(nin, nouts) var params = model.parameters() logging("Number of parameters: " + str(len(params)), SILENT) var skdata = Python.import_module("sklearn.datasets") var out = skdata.make_moons(N_SAMPLES) var npx = out[0] var npy = out[1] var input = InlinedFixedVector[ValueList](N_SAMPLES) var yb = InlinedFixedVector[Value](N_SAMPLES) for i in range(N_SAMPLES): input[i] = ValueList(npx[i][0].to_float64(), npx[i][1].to_float64()) yb[i] = 2 * Value(npy[i].to_float64()) - 1 var scores = ValueList(N_SAMPLES) var data_loss = Value(0) var reg_loss = Value(0) var accuracy: Float16 = 0.0 var learning_rate: Float64 = 0.1 var start_time = now() for epoch in range(N_EPOCHS): # Forward pass: Compute scores for inputs for i in range(N_SAMPLES): scores[i] = model(input[i])[0] # compute loss data_loss = Value(0) accuracy = 0.0 # svm "max-margin" loss for i in range(N_SAMPLES): data_loss += (1 - scores[i] * yb[i]).relu() if (scores[i].data_ptr.load() > 0) == (yb[i].data_ptr.load() > 0): accuracy += 1 accuracy /= N_SAMPLES data_loss = data_loss / N_SAMPLES reg_loss = Value(0) for i in range(len(params)): reg_loss += params[i].load() * params[i].load() var total_loss = 1e-4 * reg_loss + data_loss # Print loss for this epoch. logging( "Epoch " + str(epoch) + ": loss = " + str(total_loss.data_ptr.load()) + " (accuracy:" + str(accuracy * 100) + "%)", SILENT, ) # Zero gradients before backpropagation. for i in range(len(params)): params[i].load().grad_ptr.store(0.0) # Backward pass: Compute gradients. total_loss.backward() learning_rate = 1.0 - 0.9 * epoch / 100 # Parameter update: Apply gradient descent. for i in range(len(params)): if params[i].load().grad_ptr.load() != 0.0: params[i].load().data_ptr.store( params[i].load().data_ptr.load() - learning_rate * params[i].load().grad_ptr.load() ) var elapsed_time = now() - start_time if BENCHMARK_CSV: append_to_file( CSV_FILE_PATH, str(N_SAMPLES) + "," + str(N_EPOCHS) + "," + str(elapsed_time / 1000000000) + "," + str(accuracy), "n_samples,n_epochs,time,accuracy", ) --- binary_classifier.py --- import csv import argparse import random import numpy as np import time from sklearn.datasets import make_moons, make_blobs # pip install micrograd ... from micrograd.engine import Value from micrograd.nn import MLP # Create the parser parser = argparse.ArgumentParser(description="Process some integers.") # Add arguments for N_EPOCHS, N_SAMPLES, and SILENT with their default values parser.add_argument('--epochs', type=int, default=50, help='Number of epochs (default: 50)') parser.add_argument('--samples', type=int, default=100, help='Number of training samples (default: 100)') parser.add_argument('--silent', action='store_true', help='Run in silent mode (default: False)') parser.add_argument('--csv', action='store_true', help='Write result to benchmark file (default: False)') parser.add_argument('--csv_file_path', type=str, default="benchmark_py.csv", help='Optional, file path for the csv (default: "benchmark_py.csv")') # Parse the command line arguments args = parser.parse_args() # Assign the parsed arguments to variables N_EPOCHS = args.epochs N_SAMPLES = args.samples SILENT = args.silent BENCHMARK_CSV = args.csv CSV_FILE_PATH = args.csv_file_path np.random.seed(1337) random.seed(1337) X, y = make_moons(n_samples=N_SAMPLES) y = y*2 - 1 # make y be -1 or 1 # initialize a model model = MLP(2, [16, 16, 1]) # 2-layer neural network if not SILENT: print(model) print("number of parameters", len(model.parameters())) # loss function def loss(batch_size=None): # inline DataLoader :) if batch_size is None: Xb, yb = X, y else: ri = np.random.permutation(X.shape[0])[:batch_size] Xb, yb = X[ri], y[ri] inputs = [list(map(Value, xrow)) for xrow in Xb] # forward the model to get scores scores = list(map(model, inputs)) # svm "max-margin" loss losses = [(1 + -yi*scorei).relu() for yi, scorei in zip(yb, scores)] data_loss = sum(losses) * (1.0 / len(losses)) # L2 regularization alpha = 1e-4 reg_loss = alpha * sum((p*p for p in model.parameters())) total_loss = data_loss + reg_loss # also get accuracy accuracy = [(yi > 0) == (scorei.data > 0) for yi, scorei in zip(yb, scores)] return total_loss, sum(accuracy) / len(accuracy) total_loss, acc = loss() if not SILENT: # Print detailed information about the parameters print( f"Running Configuration:\n- Number of Training Epochs (N_EPOCHS): {N_EPOCHS}") print(f"- Number of Samples (N_SAMPLES): {N_SAMPLES}") # Start measuring time at the beginning of the optimization loop start_time = time.time() # optimization for k in range(N_EPOCHS): # forward total_loss, acc = loss() if not SILENT: print(f"step {k} loss {total_loss.data}, accuracy {acc*100}%") # backward model.zero_grad() total_loss.backward() # update (sgd) learning_rate = 1.0 - 0.9*k/100 for p in model.parameters(): p.data -= learning_rate * p.grad # Calculate elapsed time after the loop completes elapsed_time = time.time() - start_time # Optionally, print the elapsed time if not SILENT: print("Training completed. Total elapsed time: {:.2f} seconds".format(elapsed_time)) if BENCHMARK_CSV: # Open the file to append the benchmarking results with open(CSV_FILE_PATH, 'a', newline='') as file: writer = csv.writer(file) # Check if the file is empty to add the header file.seek(0, 2) # Move to the end of the file to check its size if file.tell() == 0: # File is empty, so we write the' header writer.writerow(['n_samples', 'n_epochs', 'time', 'accuracy']) # Append the benchmarking results writer.writerow([N_SAMPLES, N_EPOCHS, elapsed_time, acc]) --- binary_classifier_x.mojo --- from python import Python from python.object import PythonObject from time import now from random import seed from sys import argv from collections.vector import InlinedFixedVector from momograd.x.engine import ValueX, ValueXList from momograd.x.nn import NeuronX, LayerX, MLPX from momograd.x.util import append_to_file def logging(txt: String, silent: Bool = False) -> None: if not silent: print(txt) fn main() raises: seed(37) var N_EPOCHS = 50 # number of training steps var N_SAMPLES = 50 # number of training samples var SILENT = False var CSV_FILE_PATH: String = "benchmark_mojo.csv" var BENCHMARK_CSV = False var args = argv() # ... to enable benchmark automation ;-) if len(args) > 1: N_EPOCHS = atol(args[1]) if len(args) > 2: N_SAMPLES = atol(args[2]) if len(args) > 3 and args[3] == "--silent": SILENT = True if len(args) > 4 and args[4] == "--csv": BENCHMARK_CSV = True if len(args) > 5: CSV_FILE_PATH = args[5] var nin = 2 var nouts = VariadicList[Int](16, 16, 1) var model = MLPX(nin, nouts) var params = model.parameters() logging("Number of parameters: " + str(len(params)), SILENT) var skdata = Python.import_module("sklearn.datasets") var out = skdata.make_moons(N_SAMPLES) var npx = out[0] var npy = out[1] var input = InlinedFixedVector[ValueXList](N_SAMPLES) var yb = InlinedFixedVector[ValueX](N_SAMPLES) for i in range(N_SAMPLES): input[i] = ValueXList(npx[i][0].to_float64(), npx[i][1].to_float64()) yb[i] = 2 * ValueX(npy[i].to_float64()) - 1 var scores = ValueXList(N_SAMPLES) var data_loss = ValueX(0) var reg_loss = ValueX(0) var accuracy: Float16 = 0.0 var learning_rate: Float64 = 0.1 var start_time = now() for epoch in range(N_EPOCHS): # Forward pass: Compute scores for inputs for i in range(N_SAMPLES): scores[i] = model(input[i])[0] # compute loss data_loss = ValueX(0) accuracy = 0.0 # svm "max-margin" loss for i in range(N_SAMPLES): data_loss += (1 - scores[i] * yb[i]).relu() if (scores[i].data_ptr.load() > 0) == (yb[i].data_ptr.load() > 0): accuracy += 1 accuracy /= N_SAMPLES data_loss = data_loss / N_SAMPLES reg_loss = ValueX(0) for i in range(len(params)): reg_loss += params[i].load() * params[i].load() var total_loss = 1e-4 * reg_loss + data_loss # Print loss for this epoch. logging( "Epoch " + str(epoch) + ": loss = " + str(total_loss.data_ptr.load()) + " (accuracy:" + str(accuracy * 100) + "%)", SILENT, ) # Zero gradients before backpropagation. for i in range(len(params)): params[i].load().grad_ptr.store(0.0) # Backward pass: Compute gradients. total_loss.backward() learning_rate = 1.0 - 0.9 * epoch / 100 # Parameter update: Apply gradient descent. for i in range(len(params)): if params[i].load().grad_ptr.load() != 0.0: params[i].load().data_ptr.store( params[i].load().data_ptr.load() - learning_rate * params[i].load().grad_ptr.load() ) var elapsed_time = now() - start_time if BENCHMARK_CSV: append_to_file( CSV_FILE_PATH, str(N_SAMPLES) + "," + str(N_EPOCHS) + "," + str(elapsed_time / 1000000000) + "," + str(accuracy), "n_samples,n_epochs,time,accuracy", ) --- demo_engine.mojo --- from momograd.engine import Value fn main() raises: var a = Value(-4.0,"a") var b = Value(2.0,"b") var c = a + b c.label = 'c' var d = a * b + b**3 d.label = 'd' c += c + 1 c += 1 + c + (-a) d += d * 2 + (b + a).relu() d += 3 * d + (b - a).relu() var e = c - d e.label = 'e' var f = e**2 f.label = 'f' var g = f / 2.0 g.label = 'g' g += 10.0 / f g.backward() print(g) print(a) print(b) # print the computational graph ... g.print_branch() --- demo_engine_x.mojo --- from momograd.x.engine import ValueX fn main() raises: var a = ValueX(-4.0,"a") var b = ValueX(2.0,"b") var c = a + b c.label = 'c' var d = a * b + b**3 d.label = 'd' c += c + 1 c += 1 + c + (-a) d += d * 2 + (b + a).relu() d += 3 * d + (b - a).relu() var e = c - d e.label = 'e' var f = e**2 f.label = 'f' var g = f / 2.0 g.label = 'g' g += 10.0 / f g.backward() print(g) print(a) print(b) # print the computational graph ... g.print_branch() --- demo_nn.mojo --- from momograd.engine import Value, ValueList from momograd.nn import Neuron,Layer,MLP fn main() raises: # Define input (xs) var xs = VariadicList[ValueList]( ValueList(2.0, 3.0, -1.0), ValueList(3.0, -1.0, 0.5), ValueList(3.0, -1.0, 0.5), ValueList(1.0, 1.0, -1.0)) var nin: Int = len(xs[0]) #number of input values ################# # Single Neuron # ################# var nr:Neuron = Neuron(nin) print("Output single Neuron:") print(nr(xs[0])) ################ # Single Layer # ################ var ly:Layer = Layer(nin,5) print("\nOutput single Layer:") print(ly(xs[0])) ############ # Demo MLP # ############ print("\nDemo MLP\n") # Define ground truth var ys = ValueList(1.0, -1.0, -1.0, 1.0) # Setup neural network input size and output layers structure. var nouts = VariadicList[Int](4, 4, 1) var model = MLP(nin, nouts) # Set learning rate and number of training epochs. var learning_rate = 0.01 var n_epochs = 100 # Retrieve model parameters for training. var params = model.parameters() # training variables var ypred = ValueList(len(xs)) var loss:Value = Value(0) # Begin training process. print("Training:\n") for i in range(n_epochs): # Forward pass: Compute predictions (ypred) for inputs (xs). for i in range(len(xs)): ypred[i] = model(xs[i])[0] # Loss calculation: Sum squared errors between predictions (ypred) and actuals (ys). loss = Value(0) for i in range(len(xs)): loss += (ypred[i] - ys[i])**2 # Print loss for this epoch. print("Epoch " + str(i) + ": loss =", loss.data_ptr.load()) # Zero gradients before backpropagation. for i in range(len(params)): params[i].load().grad_ptr.store(0.0) # Backward pass: Compute gradients. loss.backward() # Parameter update: Apply gradient descent. for i in range(len(params)): if params[i].load().grad_ptr.load() != 0.0: params[i].load().data_ptr.store(params[i].load().data_ptr.load() - learning_rate * params[i].load().grad_ptr.load()) # Display prediction and corresponding ground truth values. print("\nPrediction:\n") for i in range(len(ypred)): print(str(ypred[i].data_ptr.load()) + " (ground truth: " + str(ys[i].data_ptr.load()) + ")") --- demo_nn_x.mojo --- from momograd.x.engine import ValueX, ValueXList from momograd.x.nn import NeuronX,LayerX,MLPX fn main() raises: # Define input (xs) var xs = VariadicList[ValueXList]( ValueXList(2.0, 3.0, -1.0), ValueXList(3.0, -1.0, 0.5), ValueXList(3.0, -1.0, 0.5), ValueXList(1.0, 1.0, -1.0)) var nin: Int = len(xs[0]) #number of input values ################# # Single NeuronX # ################# var nr:NeuronX = NeuronX(nin) print("Output single NeuronX:") print(nr(xs[0])) ################ # Single LayerX # ################ var ly:LayerX = LayerX(nin,5) print("\nOutput single LayerX:") print(ly(xs[0])) ############ # Demo MLPX # ############ print("\nDemo MLPX\n") # Define ground truth var ys = ValueXList(1.0, -1.0, -1.0, 1.0) # Setup neural network input size and output layers structure. var nouts = VariadicList[Int](4, 4, 1) var model = MLPX(nin, nouts) # Set learning rate and number of training epochs. var learning_rate = 0.01 var n_epochs = 100 # Retrieve model parameters for training. var params = model.parameters() # training variables var ypred = ValueXList(len(xs)) var loss:ValueX = ValueX(0) # Begin training process. print("Training:\n") for i in range(n_epochs): # Forward pass: Compute predictions (ypred) for inputs (xs). for i in range(len(xs)): ypred[i] = model(xs[i])[0] # Loss calculation: Sum squared errors between predictions (ypred) and actuals (ys). loss = ValueX(0) for i in range(len(xs)): loss += (ypred[i] - ys[i])**2 # Print loss for this epoch. print("Epoch " + str(i) + ": loss =", loss.data_ptr.load()) # Zero gradients before backpropagation. for i in range(len(params)): params[i].load().grad_ptr.store(0.0) # Backward pass: Compute gradients. loss.backward() # Parameter update: Apply gradient descent. for i in range(len(params)): if params[i].load().grad_ptr.load() != 0.0: params[i].load().data_ptr.store(params[i].load().data_ptr.load() - learning_rate * params[i].load().grad_ptr.load()) # Display prediction and corresponding ground truth values. print("\nPrediction:\n") for i in range(len(ypred)): print(str(ypred[i].data_ptr.load()) + " (ground truth: " + str(ys[i].data_ptr.load()) + ")") --- momograd/__init__.mojo --- --- momograd/engine.mojo --- from collections.list import List from math import log,exp from time import now from .util import ValueList # Define a value struct that can be passed through computational graph nodes @register_passable("trivial") struct Value(CollectionElement, Stringable): # LegacyPointers for the value's data and its gradient for backpropagation var data_ptr: LegacyPointer[Float64] var grad_ptr: LegacyPointer[Float64] var label: StringRef # Previous values in the computation graph, and a function pointer for the backward pass var _prev: ValueList var _backward: fn ( prev: ValueList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None # Operation identifier and a timestamp to manage computation order var _op: StringRef var _topo_stamp:LegacyPointer[Int] # A static method that does nothing, used as the default backward operation @staticmethod fn nothing_to_do( prev: ValueList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: pass fn __init__(inout self, data: Float64, label: StringRef = ""): self.data_ptr = LegacyPointer[Float64].alloc(1) self.data_ptr.store(data) self.grad_ptr = LegacyPointer[Float64].alloc(1) self.grad_ptr.store(0.0) self._prev = ValueList(0) self._backward = Value.nothing_to_do self.label = label self._op = " " # topo helper self._topo_stamp = LegacyPointer[Int]().alloc(1) self._topo_stamp.store(0) fn __init__( inout self, data: Float64, prev: ValueList, op: StringRef, label: StringRef = '', ): self.data_ptr = LegacyPointer[Float64].alloc(1) self.data_ptr.store(data) self.grad_ptr = LegacyPointer[Float64].alloc(1) self.grad_ptr.store(0.0) self.label = label # internal variables used for autograd graph construction self._backward = Value.nothing_to_do self._prev = prev self._op = op # topo helper self._topo_stamp = LegacyPointer[Int]().alloc(1) self._topo_stamp.store(0) # Operator overloads for adding, multiplying etc, creating new Values in the graph @always_inline fn __add__(self, other: Value) -> Value: var prev = ValueList(2) prev[0] = self prev[1] = other var out = Value(self.data_ptr[0] + other.data_ptr[0], prev, "+") fn _backward( prev: ValueList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: prev[0].grad_ptr.store(prev[0].grad_ptr[0] + grad_ptr[0]) prev[1].grad_ptr.store(prev[1].grad_ptr[0] + grad_ptr[0]) out._backward = _backward return out @always_inline fn __mul__(self, other: Value) -> Value: var prev = ValueList(2) prev[0] = self prev[1] = other var out = Value(self.data_ptr[0] * other.data_ptr[0], prev, "*") fn _backward( prev: ValueList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: prev[0].grad_ptr.store( prev[0].grad_ptr[0] + prev[1].data_ptr[0] * grad_ptr[0] ) prev[1].grad_ptr.store( prev[1].grad_ptr[0] + prev[0].data_ptr[0] * grad_ptr[0] ) out._backward = _backward return out @always_inline fn __pow__(self, other: Value) -> Value: var prev = ValueList(2) prev[0] = self prev[1] = other var out = Value(self.data_ptr[0] ** other.data_ptr[0], prev, "**") fn _backward( prev: ValueList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: prev[0].grad_ptr.store( prev[0].grad_ptr[0] + grad_ptr[0] * ( prev[1].data_ptr[0] * prev[0].data_ptr[0] ** (prev[1].data_ptr[0] - 1) ) ) prev[1].grad_ptr.store( prev[1].grad_ptr[0] + grad_ptr[0] * log(prev[0].data_ptr[0]) * (prev[0].data_ptr[0] ** prev[1].data_ptr[0]) ) out._backward = _backward return out @always_inline fn tanh(self) -> Value: var prev = ValueList(1) prev[0] = self var val:Float64 = (exp(2*self.data_ptr[0]) - 1)/(exp(2*self.data_ptr[0]) + 1) var out = Value(val, prev, "tanh") fn _backward( prev: ValueList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: # tanh(x) d/dx = 1 - tanh(x)^2 prev[0].grad_ptr.store( prev[0].grad_ptr[0] + (1-data_ptr[0]**2) * grad_ptr[0] ) out._backward = _backward return out @always_inline fn relu(self) -> Value: var prev = ValueList(1) prev[0] = self var val: Float64 = self.data_ptr[0] if val <= 0: val = 0 var out = Value(val, prev, "ReLU") fn _backward( prev: ValueList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: if data_ptr[0] > 0: prev[0].grad_ptr[0] += grad_ptr[0] out._backward = _backward return out @always_inline fn __add__(self, other: Float64) -> Value: return self + Value(other) @always_inline fn __iadd__(inout self,other:Value) -> None: # A new Value is created to maintain the integrity of the computational graph. # The label is transferred to the new Value. var label = self.label self.label = '' self = self + other # not sure if Mojo is happy with this ;-) self.label = label @always_inline fn __isub__(inout self,other:Value) -> None: # A new Value is created to maintain the integrity of the computational graph. # The label is transferred to the new Value. var label = self.label self.label = '' self = self - other self.label = label @always_inline fn __neg__(self) -> Value: return self * -1 @always_inline fn __sub__(self, other: Float64) -> Value: return self + (-other) @always_inline fn __sub__(self, other: Value) -> Value: return self + (-other) @always_inline fn __mul__(self, other: Float64) -> Value: return self * Value(other) @always_inline fn __truediv__(self, other: Float64) -> Value: return self * other**-1 @always_inline fn __truediv__(self, other: Value) -> Value: return self * other**-1 @always_inline fn __pow__(self, other: Float64) -> Value: return self.__pow__(Value(other)) # --- reverse ... @always_inline fn __radd__(self, other: Float64) -> Value: return self + other @always_inline fn __rsub__(self, other: Float64) -> Value: return (-self) + other @always_inline fn __rmul__(self, other: Float64) -> Value: return self * other @always_inline fn __rtruediv__(self, other: Float64) -> Value: # other / self return other * self**-1 # Performs the backward pass, computing gradients in reverse topological order. fn backward(self) raises: # topological order all of the children in the graph var topo: List[Value] = List[Value]() Value._build_topo(self, topo,now()) topo.reverse() topo[0].grad_ptr.store(1.0) ## calculating the gradients for i in range(len(topo)): if len(topo[i]._prev) > 0: topo[i]._backward(topo[i]._prev, topo[i].grad_ptr, topo[i].data_ptr) # Builds a topological order of the computation graph for the backward pass. @staticmethod fn _build_topo(value: Value, inout topo: List[Value],stamp:Int): if value._topo_stamp[0] == stamp: return value._topo_stamp[0] = stamp # mark value as visited for this topo run for i in range(len(value._prev)): Value._build_topo(value._prev[i], topo,stamp) topo.append(value) # Returns a string representation of the Value, including data and gradient. fn __str__(self) -> String: var out = "<data: " + str(self.data_ptr[0]) + ", grad: " + str(self.grad_ptr[0]) + ">" if len(self.label)>0: out += " (var " + str(self.label) + ") " return out # Recursively prints the branches of the computation graph. fn print_branch(self, depth: Int = 0): var ind: String = "" for i in range(depth): ind += " " print(ind + self.__str__()) if len(self._prev) > 0: print(ind + " -------- (" + str(self._op) + ") --------") for i in range(len(self._prev)): self._prev[i].print_branch(depth + 1) --- momograd/nn.mojo --- from collections.list import List from random import seed, random_float64 from .engine import Value, ValueList # Define the Neuron structure with weights, bias, and activation function @register_passable("trivial") struct Neuron: var w: ValueList # Weight values for the neuron var b: Value # Bias value for the neuron var b_ptr: LegacyPointer[Value] # LegacyPointer to the bias to facilitate updates var nin: Int # Number of inputs to the neuron var nonlin: Bool # Boolean flag to use a non-linear activation function # Initialize neuron with random weights and bias fn __init__(inout self, nin: Int, nonlin: Bool = True): self.w = ValueList(nin) self.b = Value(random_float64(-1, 1)) self.b_ptr = LegacyPointer[Value].alloc(1) self.b_ptr.store(self.b) self.nin = nin self.nonlin = nonlin for i in range(nin): self.w[i] = Value(random_float64(-1, 1)) # Define how a neuron processes input values fn __call__(self, input: ValueList) -> Value: var result = self.b # Start with the bias # Compute the weighted sum of inputs for i in range(self.nin): result = result + self.w[i] * input[i] # Apply the non-linear activation function if specified if self.nonlin: return result.relu() else: return result # Add neuron parameters to a dynamic vector for optimization @always_inline fn add_parameters(self, inout params: List[LegacyPointer[Value]]) -> None: for i in range(self.nin): params.append(self.w.get_val_ptr(i)) params.append(self.b_ptr) # Define the Layer structure containing multiple neurons @register_passable("trivial") struct Layer: var neurons: LegacyPointer[Neuron] # Dynamic array of neurons in the layer var nin: Int # Number of inputs to the layer var nout: Int # Number of outputs/neurons in the layer # Initialize the layer with specified number of neurons and optional non-linearity fn __init__(inout self, nin: Int, nout: Int, nonlin: Bool = True): self.nin = nin self.nout = nout self.neurons = LegacyPointer[Neuron].alloc(nout) for i in range(nout): self.neurons[i] = Neuron(nin, nonlin) # Define how the layer processes input values fn __call__(self, input: ValueList) -> ValueList: var result = ValueList(self.nout) # Pass input through each neuron and return the outputs for i in range(self.nout): result[i] = self.neurons[i](input) return result # Collecting layer parameters @always_inline fn add_parameters(self, inout params: List[LegacyPointer[Value]]) -> None: for i in range(self.nout): self.neurons[i].add_parameters(params) # Define of a MLP (Multi-Layer Perceptron) structure with multiple layers @register_passable("trivial") struct MLP: var layers: LegacyPointer[Layer] # Dynamic array of layers in the MLP var nin: Int # Number of inputs to the MLP var num_layers: Int # Total number of layers in the MLP # Initialize the MLP with specified layer configurations fn __init__(inout self, nin: Int, nouts: VariadicList[Int]): self.nin = nin self.num_layers = len(nouts) self.layers = LegacyPointer[Layer].alloc(self.num_layers) # Initialize each layer based on the configuration self.layers.store(0, Layer(nin, nouts[0], True)) for i in range(1, self.num_layers): self.layers.store(i, Layer(nouts[i - 1], nouts[i], i < self.num_layers - 1)) # Define how the MLP processes input values through its layers fn __call__(self, input: ValueList) -> ValueList: var result = input for i in range(self.num_layers): result = self.layers[i](result) return result # Collects and returns all trainable parameters of the MLP. fn parameters(self) -> List[LegacyPointer[Value]]: var params = List[LegacyPointer[Value]]() for i in range(self.num_layers): self.layers[i].add_parameters(params) return params --- momograd/util.mojo --- from collections.vector import InlinedFixedVector from collections.list import List from .engine import Value @register_passable("trivial") struct ValueList(Sized, Stringable): var _values: LegacyPointer[Value] var _len: Int fn __init__(inout self, length: Int = 0): self._len = length if length > 0: self._values = LegacyPointer[Value].alloc(length) memset_zero(self._values, length) else: self._values = LegacyPointer[Value]() fn __init__(inout self, *vv: Float64): self._len = len(vv) if self._len > 0: self._values = LegacyPointer[Value].alloc(self._len) for i in range(self._len): self._values[i] = Value(vv[i]) else: self._values = LegacyPointer[Value]() fn __init__(inout self, vv: VariadicList[Float64]): self._len = len(vv) if self._len > 0: self._values = LegacyPointer[Value].alloc(self._len) for i in range(self._len): self._values[i] = Value(vv[i]) else: self._values = LegacyPointer[Value]() fn __init__(inout self, vv: List[Float64]): self._len = len(vv) if self._len > 0: self._values = LegacyPointer[Value].alloc(self._len) for i in range(self._len): self._values[i] = Value(vv[i]) else: self._values = LegacyPointer[Value]() fn __len__(self) -> Int: return self._len fn __getitem__(self, idx: Int) -> Value: return self._values[idx] fn __setitem__(self, idx: Int, value: Value): self._values[idx] = value fn __str__(self) -> String: if self._len == 0: return "empty value list" var result = self._values[0].__str__() for i in range(1, self._len): result += "\n" + self._values[i].__str__() return result fn get_val_ptr(self, idx: Int) -> LegacyPointer[Value]: return self._values + idx fn append_to_file( file_name: String, content: String, first_line_for_empty_file: String = "" ) raises: var f: FileHandle var prev: String = "" try: f = open(file_name, "r") prev = f.read() f.close() except: prev = first_line_for_empty_file f = open(file_name, "w") f.write(prev + "\n" + content) f.close() --- momograd/x/__init__.mojo --- --- momograd/x/engine.mojo --- from collections.list import List from math import log,exp from time import now from .util import ValueXList # Define a value struct that can be passed through computational graph nodes @register_passable("trivial") struct ValueX(CollectionElement, Stringable): # LegacyPointers for the value's data and its gradient for backpropagation var data_ptr: LegacyPointer[Float64] var grad_ptr: LegacyPointer[Float64] var label: StringRef # Previous values in the computation graph, and a function pointer for the backward pass var _prev: ValueXList var _backward: fn ( prev: ValueXList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None # Operation identifier and a timestamp to manage computation order var _op: StringRef var _topo_stamp:LegacyPointer[Int] # A static method that does nothing, used as the default backward operation @staticmethod fn nothing_to_do( prev: ValueXList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: pass fn __init__(inout self, data: Float64, label: StringRef = ""): self.data_ptr = LegacyPointer[Float64].alloc(1) self.data_ptr.store(data) self.grad_ptr = LegacyPointer[Float64].alloc(1) self.grad_ptr.store(0.0) self._prev = ValueXList(0) self._backward = ValueX.nothing_to_do self.label = label self._op = " " # topo helper self._topo_stamp = LegacyPointer[Int]().alloc(1) self._topo_stamp.store(0) fn __init__( inout self, data: Float64, prev: ValueXList, op: StringRef, label: StringRef = '', ): self.data_ptr = LegacyPointer[Float64].alloc(1) self.data_ptr.store(data) self.grad_ptr = LegacyPointer[Float64].alloc(1) self.grad_ptr.store(0.0) self.label = label # internal variables used for autograd graph construction self._backward = ValueX.nothing_to_do self._prev = prev self._op = op # topo helper self._topo_stamp = LegacyPointer[Int]().alloc(1) self._topo_stamp.store(0) # Operator overloads for adding, multiplying etc, creating new Values in the graph @always_inline fn __add__(self, other: ValueX) -> ValueX: var prev = ValueXList(2) prev[0] = self prev[1] = other var out = ValueX(self.data_ptr[0] + other.data_ptr[0], prev, "+") fn _backward( prev: ValueXList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: prev[0].grad_ptr.store(prev[0].grad_ptr[0] + grad_ptr[0]) prev[1].grad_ptr.store(prev[1].grad_ptr[0] + grad_ptr[0]) out._backward = _backward return out @always_inline fn __mul__(self, other: ValueX) -> ValueX: var prev = ValueXList(2) prev[0] = self prev[1] = other var out = ValueX(self.data_ptr[0] * other.data_ptr[0], prev, "*") fn _backward( prev: ValueXList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: prev[0].grad_ptr.store( prev[0].grad_ptr[0] + prev[1].data_ptr[0] * grad_ptr[0] ) prev[1].grad_ptr.store( prev[1].grad_ptr[0] + prev[0].data_ptr[0] * grad_ptr[0] ) out._backward = _backward return out @always_inline fn __pow__(self, other: ValueX) -> ValueX: var prev = ValueXList(2) prev[0] = self prev[1] = other var out = ValueX(self.data_ptr[0] ** other.data_ptr[0], prev, "**") fn _backward( prev: ValueXList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: prev[0].grad_ptr.store( prev[0].grad_ptr[0] + grad_ptr[0] * ( prev[1].data_ptr[0] * prev[0].data_ptr[0] ** (prev[1].data_ptr[0] - 1) ) ) prev[1].grad_ptr.store( prev[1].grad_ptr[0] + grad_ptr[0] * log(prev[0].data_ptr[0]) * (prev[0].data_ptr[0] ** prev[1].data_ptr[0]) ) out._backward = _backward return out @always_inline fn tanh(self) -> ValueX: var prev = ValueXList(1) prev[0] = self var val:Float64 = (exp(2*self.data_ptr[0]) - 1)/(exp(2*self.data_ptr[0]) + 1) var out = ValueX(val, prev, "tanh") fn _backward( prev: ValueXList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: # tanh(x) d/dx = 1 - tanh(x)^2 prev[0].grad_ptr.store( prev[0].grad_ptr[0] + (1-data_ptr[0]**2) * grad_ptr[0] ) out._backward = _backward return out @always_inline fn relu(self) -> ValueX: var prev = ValueXList(1) prev[0] = self var val: Float64 = self.data_ptr[0] if val <= 0: val = 0 var out = ValueX(val, prev, "ReLU") fn _backward( prev: ValueXList, grad_ptr: LegacyPointer[Float64], data_ptr: LegacyPointer[Float64] ) -> None: if data_ptr[0] > 0: prev[0].grad_ptr[0] += grad_ptr[0] out._backward = _backward return out @always_inline fn __add__(self, other: Float64) -> ValueX: return self + ValueX(other) @always_inline fn __iadd__(inout self,other:ValueX) -> None: # A new ValueX is created to maintain the integrity of the computational graph. # The label is transferred to the new ValueX. var label = self.label self.label = '' self = self + other # not sure if Mojo is happy with this ;-) self.label = label @always_inline fn __isub__(inout self,other:ValueX) -> None: # A new ValueX is created to maintain the integrity of the computational graph. # The label is transferred to the new ValueX. var label = self.label self.label = '' self = self - other self.label = label @always_inline fn __neg__(self) -> ValueX: return self * -1 @always_inline fn __sub__(self, other: Float64) -> ValueX: return self + (-other) @always_inline fn __sub__(self, other: ValueX) -> ValueX: return self + (-other) @always_inline fn __mul__(self, other: Float64) -> ValueX: return self * ValueX(other) @always_inline fn __truediv__(self, other: Float64) -> ValueX: return self * other**-1 @always_inline fn __truediv__(self, other: ValueX) -> ValueX: return self * other**-1 @always_inline fn __pow__(self, other: Float64) -> ValueX: return self.__pow__(ValueX(other)) # --- reverse ... @always_inline fn __radd__(self, other: Float64) -> ValueX: return self + other @always_inline fn __rsub__(self, other: Float64) -> ValueX: return (-self) + other @always_inline fn __rmul__(self, other: Float64) -> ValueX: return self * other @always_inline fn __rtruediv__(self, other: Float64) -> ValueX: # other / self return other * self**-1 # Performs the backward pass, computing gradients in reverse topological order. fn backward(self) raises: # topological order all of the children in the graph var topo: List[ValueX] = List[ValueX]() ValueX._build_topo(self, topo,now()) topo.reverse() topo[0].grad_ptr.store(1.0) ## calculating the gradients for i in range(len(topo)): if len(topo[i]._prev) > 0: topo[i]._backward(topo[i]._prev, topo[i].grad_ptr, topo[i].data_ptr) # Builds a topological order of the computation graph for the backward pass. @staticmethod fn _build_topo(value: ValueX, inout topo: List[ValueX],stamp:Int): if value._topo_stamp[0] == stamp: return value._topo_stamp[0] = stamp # mark value as visited for this topo run for i in range(len(value._prev)): ValueX._build_topo(value._prev[i], topo,stamp) topo.append(value) # Returns a string representation of the ValueX, including data and gradient. fn __str__(self) -> String: var out = "<data: " + str(self.data_ptr[0]) + ", grad: " + str(self.grad_ptr[0]) + ">" if len(self.label)>0: out += " (var " + str(self.label) + ") " return out # Recursively prints the branches of the computation graph. fn print_branch(self, depth: Int = 0): var ind: String = "" for i in range(depth): ind += " " print(ind + self.__str__()) if len(self._prev) > 0: print(ind + " -------- (" + str(self._op) + ") --------") for i in range(len(self._prev)): self._prev[i].print_branch(depth + 1) --- momograd/x/nn.mojo --- from collections.list import List from random import seed, random_float64 from .engine import ValueX, ValueXList from algorithm import parallelize # Define the NeuronX structure with weights, bias, and activation function @register_passable("trivial") struct NeuronX: var w: ValueXList # Weight values for the neuron var b: ValueX # Bias value for the neuron var b_ptr: LegacyPointer[ValueX] # LegacyPointer to the bias to facilitate updates var nin: Int # Number of inputs to the neuron var nonlin: Bool # Boolean flag to use a non-linear activation function # Initialize neuron with random weights and bias fn __init__(inout self, nin: Int, nonlin: Bool = True): self.w = ValueXList(nin) self.b = ValueX(random_float64(-1, 1)) self.b_ptr = LegacyPointer[ValueX].alloc(1) self.b_ptr.store(self.b) self.nin = nin self.nonlin = nonlin for i in range(nin): self.w[i] = ValueX(random_float64(-1, 1)) # Define how a neuron processes input values fn __call__(self, input: ValueXList) -> ValueX: var result = self.b # Start with the bias # Compute the weighted sum of inputs for i in range(self.nin): result = result + self.w[i] * input[i] # Apply the non-linear activation function if specified if self.nonlin: return result.relu() else: return result # Add neuron parameters to a dynamic vector for optimization @always_inline fn add_parameters(self, inout params: List[LegacyPointer[ValueX]]) -> None: for i in range(self.nin): params.append(self.w.get_val_ptr(i)) params.append(self.b_ptr) # Define the LayerX structure containing multiple neurons @register_passable("trivial") struct LayerX: var neurons: LegacyPointer[NeuronX] # Dynamic array of neurons in the layer var nin: Int # Number of inputs to the layer var nout: Int # Number of outputs/neurons in the layer # Initialize the layer with specified number of neurons and optional non-linearity fn __init__(inout self, nin: Int, nout: Int, nonlin: Bool = True): self.nin = nin self.nout = nout self.neurons = LegacyPointer[NeuronX].alloc(nout) for i in range(nout): self.neurons[i] = NeuronX(nin, nonlin) # Define how the layer processes input values fn __call__(self, input: ValueXList) -> ValueXList: var result = ValueXList(self.nout) # Pass input through each neuron and return the outputs @parameter fn _call_neurons(i: Int): result[i] = self.neurons[i](input) parallelize[_call_neurons](self.nout, self.nout) return result # Collecting layer parameters @always_inline fn add_parameters(self, inout params: List[LegacyPointer[ValueX]]) -> None: for i in range(self.nout): self.neurons[i].add_parameters(params) # Define of a MLPX (Multi-LayerX Perceptron) structure with multiple layers @register_passable("trivial") struct MLPX: var layers: LegacyPointer[LayerX] # Dynamic array of layers in the MLPX var nin: Int # Number of inputs to the MLPX var num_layers: Int # Total number of layers in the MLPX # Initialize the MLPX with specified layer configurations fn __init__(inout self, nin: Int, nouts: VariadicList[Int]): self.nin = nin self.num_layers = len(nouts) self.layers = LegacyPointer[LayerX].alloc(self.num_layers) # Initialize each layer based on the configuration self.layers.store(0, LayerX(nin, nouts[0], True)) for i in range(1, self.num_layers): self.layers.store(i, LayerX(nouts[i - 1], nouts[i], i < self.num_layers - 1)) # Define how the MLPX processes input values through its layers fn __call__(self, input: ValueXList) -> ValueXList: var result = input for i in range(self.num_layers): result = self.layers[i](result) return result # Collects and returns all trainable parameters of the MLPX. fn parameters(self) -> List[LegacyPointer[ValueX]]: var params = List[LegacyPointer[ValueX]]() for i in range(self.num_layers): self.layers[i].add_parameters(params) return params --- momograd/x/util.mojo --- from collections.vector import InlinedFixedVector from collections.list import List from .engine import ValueX @register_passable("trivial") struct ValueXList(Sized, Stringable): var _values: LegacyPointer[ValueX] var _len: Int fn __init__(inout self, length: Int = 0): self._len = length if length > 0: self._values = LegacyPointer[ValueX].alloc(length) memset_zero(self._values, length) else: self._values = LegacyPointer[ValueX]() fn __init__(inout self, *vv: Float64): self._len = len(vv) if self._len > 0: self._values = LegacyPointer[ValueX].alloc(self._len) for i in range(self._len): self._values[i] = ValueX(vv[i]) else: self._values = LegacyPointer[ValueX]() fn __init__(inout self, vv: VariadicList[Float64]): self._len = len(vv) if self._len > 0: self._values = LegacyPointer[ValueX].alloc(self._len) for i in range(self._len): self._values[i] = ValueX(vv[i]) else: self._values = LegacyPointer[ValueX]() fn __init__(inout self, vv: List[Float64]): self._len = len(vv) if self._len > 0: self._values = LegacyPointer[ValueX].alloc(self._len) for i in range(self._len): self._values[i] = ValueX(vv[i]) else: self._values = LegacyPointer[ValueX]() fn __len__(self) -> Int: return self._len fn __getitem__(self, idx: Int) -> ValueX: return self._values[idx] fn __setitem__(self, idx: Int, value: ValueX): self._values[idx] = value fn __str__(self) -> String: if self._len == 0: return "empty value list" var result = self._values[0].__str__() for i in range(1, self._len): result += "\n" + self._values[i].__str__() return result fn get_val_ptr(self, idx: Int) -> LegacyPointer[ValueX]: return self._values + idx fn append_to_file( file_name: String, content: String, first_line_for_empty_file: String = "" ) raises: var f: FileHandle var prev: String = "" try: f = open(file_name, "r") prev = f.read() f.close() except: prev = first_line_for_empty_file f = open(file_name, "w") f.write(prev + "\n" + content) f.close() --- Dockerfile --- # https://github.com/modularml/mojo/blob/main/examples/docker/Dockerfile.mojosdk # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # Example command line: # Use no-cache to force docker to rebuild layers of the image by downloading the SDK from the repos # docker build --no-cache \ # --build-arg AUTH_KEY=<your-modular-auth-key> # --pull -t modular/mojo-v0.2-`date '+%Y%d%m-%H%M'` \ # --file Dockerfile.mojosdk . FROM ubuntu:20.04 ARG DEFAULT_TZ=America/Los_Angeles ENV DEFAULT_TZ=$DEFAULT_TZ ARG MODULAR_HOME=/home/user/.modular ENV MODULAR_HOME=$MODULAR_HOME RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive TZ=$DEFAULT_TZ apt-get install -y \ tzdata \ vim \ sudo \ curl \ python3 \ pip \ wget RUN curl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-py38_23.5.2-0-Linux-x86_64.sh > /tmp/miniconda.sh \ && chmod +x /tmp/miniconda.sh \ && /tmp/miniconda.sh -b -p /opt/conda ENV PATH=/opt/conda/bin:$PATH RUN conda init ARG AUTH_KEY=DEFAULT_KEY ENV AUTH_KEY=$AUTH_KEY RUN curl https://get.modular.com | MODULAR_AUTH=$AUTH_KEY sh - RUN modular auth $AUTH_KEY && \ modular install mojo RUN useradd -m -u 1000 user RUN chown -R user $MODULAR_HOME ENV PATH="$MODULAR_HOME/pkg/packages.modular.com_mojo/bin:$PATH" RUN pip install \ jupyterlab \ ipykernel \ matplotlib \ ipywidgets \ gradio USER user WORKDIR $HOME/app COPY --chown=user . $HOME/app RUN wget -c https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin RUN wget -c https://huggingface.co/karpathy/tinyllamas/resolve/main/stories42M.bin RUN wget -c https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.bin # CMD ["mojo", "llama2.mojo"] CMD ["python3", "gradio_app.py"] --- LICENSE --- MIT License Copyright (c) 2023 Aydyn Tairov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- ## llama2.🔥 <p align="center"> <img src="assets/llama2-m1-cpu.jpeg" width="500" alt="llama2.mojo benchmark"> </p> Have you ever wanted to inference a baby Llama 2 model in pure Mojo? No? Well, now you can! supported version: [Mojo 24.3](https://docs.modular.com/mojo/changelog#v243-2024-05-02) With the release of [Mojo](https://www.modular.com/blog/mojo-its-finally-here), I was inspired to take my Python port of [llama2.py](https://github.com/tairov/llama2.py) and transition it to Mojo. The result? A version that leverages Mojo's SIMD & vectorization primitives, boosting the Python performance by nearly 250x. Impressively, after few native improvements the Mojo version outperforms the original `llama2.c` by 30% in multi-threaded inference. As well as it outperforms `llama.cpp` on baby-llama inference on CPU by 20%. This showcases the potential of hardware-level optimizations through Mojo's advanced features. ## supported models At the moment, the following models were successfully executed via `llama2.mojo`: | Models | |------------------------------| | stories 260K, 15M, 42M, 110M | | Tinyllama-1.1B-Chat-v0.2 | ### extensive benchmark on Apple M1 Max [mojo vs 6 programming languages](https://engiware.com/benchmark/llama2-ports-extensive-benchmarks-mac-m1-max.html) ### benchmark (updated) **Mac M1 Max (6 threads)** | Model | [llama2.c](https://github.com/karpathy/llama2.c) (OMP/parallelized) | **llama2.mojo** (parallelized) | llama.cpp (CPU, 6 threads) | [llama2.py](https://github.com/tairov/llama2.py) | |-----------------|---------------------------------------------------------------------|--------------------------------|-----------------|--------------------------------------------------| | stories15M.bin | 730 tok/s | 1025 tok/s | 890 tok/s | 38 tok/s (pypi) | | stories42M.bin | 270 tok/s | 490 tok/s | 420 tok/s | - | | stories110M.bin | 102 tok/s | 195 tok/s | 187 tok/s | - | | TinyLlama-1.1B | - | 23 tok/s | - | - | **Ubuntu 20.04, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz, 6 cores, 12 threads** | Model | [llama2.c](https://github.com/karpathy/llama2.c) (OMP/parallelized) | **llama2.mojo** (parallelized) | llama2.mojo (naive matmul) | [llama2.py](https://github.com/tairov/llama2.py) | |-----------------|---------------------------------------------------------------------|--------------------------------|----------------------------|--------------------------------------------------| | stories15M.bin | 435 tok/s | 440 tok/s | 67.26 tok/s | 1.3 tok/s | | stories110M.bin | 64 tok/s | 63 tok/s | 9.20 tok/s | - | | TinyLlama-1.1B | 7.25 tok/s | 7.25 tok/s | - | - | ## prerequisites Make sure you have installed and [configured mojo on your environment](https://docs.modular.com/mojo/manual/get-started/index.html) Or you can use [mojo playground](https://playground.modular.com/) to run this model. ## try the 🔥 magic HuggingFace - https://huggingface.co/spaces/radames/Gradio-llama2.mojo ## feel the 🔥 magic First, navigate to the folder when you keep your projects and clone this repository to this folder: ```bash git clone https://github.com/tairov/llama2.mojo.git ``` Then, open the repository folder: ```bash cd llama2.mojo ``` Now, let's download the model ```bash wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin ``` Then, just run the Mojo ```bash mojo llama2.mojo stories15M.bin -s 100 -n 256 -t 0.5 -i "Mojo is a language" ``` **example output** ``` num hardware threads: 6 SIMD vector width: 16 checkpoint size: 60816028 [ 57 MB ] n layers: 6 vocab size: 32000 Mojo is a language that people like to talk. Hephones are very different from other people. He has a big book with many pictures and words. He likes to look at the pictures and learn new things. One day, Mojo was playing with his friends in the park. They were running and laughing and having fun. Mojo told them about his book and his friends. They listened and looked at the pictures. Then, they saw a picture of a big, scary monster. They were very scared and ran away. Mojo was sad that his book was gone. He told his friends about the monster and they all felt very sad. Mojo's friends tried to make him feel better, but nothing worked. Mojo never learned his language again. achieved tok/s: 440.21739130434781 ``` ## running via Docker ```bash docker build --build-arg AUTH_KEY=<your-modular-auth-key> -t llama2.mojo . docker run -it llama2.mojo ``` With Gradio UI: ```bash # uncomment the last line in Dockerfile CMD ["python", "gradio_app.py"] docker run -it -p 0.0.0.0:7860:7860 llama2.mojo ``` ## citing llama2.🔥 If you use or discuss llama2.mojo in your academic research, please cite the project to help spread awareness: ``` @misc{llama2.mojo, author = {Aydyn Tairov}, title = {Inference Llama2 in one file of pure Mojo}, year = {2023}, month = {09}, howpublished = {\url{https://github.com/tairov/llama2.mojo}}, note = {Llama2 Mojo, MIT License} } ``` We kindly request that you include a link to the GitHub repository in published papers. This will allow interested readers to easily find the latest updates and extensions to the project. `llama2.mojo` aims to encourage academic research on efficient implementations of transformer architectures, the `llama` model, and applications of the `mojo` programming language. Citing the project helps growth of the knowledge community around these topics. We appreciate your support through referencing `llama2.mojo`! ## play with Tinyllama-1.1B-Chat-v0.2 The [TinyLlama](https://github.com/jzhang38/TinyLlama) is a 1.1B Llama model trained on 3 trillion tokens. This compactness allows it to cater to a multitude of applications demanding a restricted computation and memory footprint. This is also the reason why we select it as the first model to support. First, navigate to the folder when you keep your projects and clone this repository to this folder: ```bash git clone https://github.com/tairov/llama2.mojo.git ``` Then, open the repository folder: ```bash cd llama2.mojo ``` Now, let's download the model and the tokenizer ```bash wget https://huggingface.co/kirp/TinyLlama-1.1B-Chat-v0.2-bin/resolve/main/tok_tl-chat.bin wget https://huggingface.co/kirp/TinyLlama-1.1B-Chat-v0.2-bin/resolve/main/tl-chat.bin ``` Then, just run the Mojo ```bash mojo llama2.mojo tl-chat.bin \ -z tok_tl-chat.bin \ -n 256 -t 0 -s 100 -i "<|im_start|>user\nGive me a python function to generate Fibonacci sequence<|im_end|>\n<|im_start|>assistant\n" ``` **example output** ``` num hardware threads: 6 SIMD vector width: 16 checkpoint size: 4400767004 [ 4196 MB ] n layers: 22 vocab size: 32003 <|im_start|>user Give me a python function to generate Fibonacci sequence<|im_end|> <|im_start|>assistant Sure, here's a Python function that generates the Fibonacci sequence: def fibonacci(n): if n <= 0: return 0 elif n == 1: return 1 else: return fibonacci(n-1) + fibonacci(n-2) This function takes an integer n as a parameter and returns the next Fibonacci number. It uses a recursive approach to calculate the Fibonacci numbers, starting from 0 and working up. The function returns the value it found at the current level of the recursion, which can be either 0 or a Fibonacci number. ``` ## license MIT --- gradio_app.py --- import gradio as gr import subprocess import sys from pathlib import Path async def generate(prompt, model_name, seed=0, temperature=0.5, num_tokens=256): # stream stout base = ""#"../model/" tokenizer_name = "tokenizer.bin" if model_name == "tl-chat.bin": tokenizer_name = 'tok_tl-chat.bin' process = subprocess.Popen( [ "mojo", "llama2.mojo", Path(base + model_name), "-s", str(seed), "-n", str(num_tokens), "-t", str(temperature), "-i", prompt, "-z", Path(base + tokenizer_name) ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) text = "" for char in iter(lambda: process.stdout.read(1), b""): char_decoded = char.decode("utf-8", errors="ignore") text += char_decoded yield text with gr.Blocks() as demo: gr.Markdown( """ # llama2.🔥 ## [Mojo](https://docs.modular.com/mojo/) implementation of [llama2.c](https://github.com/karpathy/llama2.c) by [@tairov](https://github.com/tairov) Source: https://github.com/tairov/llama2.mojo """ ) with gr.Row(): with gr.Column(): prompt = gr.Textbox(label="Prompt", placeholder="Add your prompt here...") seed = gr.Slider( minimum=0, maximum=2**53, value=0, step=1, label="Seed", randomize=True, ) temperature = gr.Slider( minimum=0.0, maximum=2.0, step=0.01, value=0.0, label="Temperature" ) num_tokens = gr.Slider( minimum=1, maximum=256, value=256, label="Number of tokens" ) model_name = gr.Dropdown( ["stories15M.bin", "stories42M.bin", "stories110M.bin", "tl-chat.bin"], value="stories15M.bin", label="Model Size", ) with gr.Row(): stop = gr.Button("Stop") run = gr.Button("Run") with gr.Column(scale=2): output_text = gr.Textbox(label="Generated Text") # update maximum number of tokens based on model size model_name.change( lambda x: gr.update(maximum=1024) if x == "stories110M.bin" or x == "stories42M.bin" or x == "tl-chat.bin" else gr.update(maximum=256), model_name, num_tokens, queue=False, ) click_event = run.click( fn=generate, inputs=[prompt, model_name, seed, temperature, num_tokens], outputs=output_text, ) stop.click(fn=None, inputs=None, outputs=None, cancels=[click_event]) demo.queue() demo.launch(server_name="0.0.0.0") --- llama2.mojo --- from algorithm import sum from algorithm import vectorize, parallelize from builtin import string from math import round from memory import memset_zero, memcpy, stack_allocation from memory.unsafe import DTypePointer, bitcast from tensor import rand from sys.info import num_performance_cores from sys import argv from tensor import Tensor, TensorShape, TensorSpec from collections import List, Dict # The SIMD vector width. from sys.info import simdwidthof import math import os import random import time alias NUM_CONFIG_INT = 7 var workers = 0 alias nelts = (4 * simdwidthof[DType.float32]()) alias BufferPtrType = DTypePointer[DType.uint8] alias BufferPtrFloat32 = DTypePointer[DType.float32] alias PointerStrings = Pointer[String] alias TensorF32 = Tensor[DType.float32] @register_passable struct Accumulator[T: DType, width: Int]: # ideally this could be SIMD[T, width] but the width # in accumulate() method is compared by identity var data: DTypePointer[T] @always_inline fn __init__() -> Self: # allocate a DTypePointer on stack that doesn't need to be freed. var data = stack_allocation[width, T]() memset_zero(data, width) return Self {data: data} @always_inline fn accumulate[_width: Int](inout self, val: SIMD[T, _width]) -> None: # This is a hack to make sure both SIMD have _width length. # SIMD[T, width] += SIMD[T, _width] is always an error. var newVal = self.data.load[width=_width]() + val self.data.store[width=_width](newVal) @always_inline fn total(self) -> SIMD[T, 1]: return self.data.load[width=width]().reduce_add() @value struct TensorSlice: # Provides a view into a tensor representing a 1D slice on its first or first 2 dimensions. # Same function signatures as Tensor but without owning the data. var _data: BufferPtrFloat32 var _shape: TensorShape fn __init__(inout self, t: TensorF32, layer: Int) raises: var elements_per_layer = t.num_elements() // t.dim(0) self._data = t.data().offset(layer * elements_per_layer) if t.rank() == 2: self._shape = TensorShape(t.dim(1)) elif t.rank() == 3: self._shape = TensorShape(t.dim(1), t.dim(2)) else: # Compiler complains if _shape not defined self._shape = TensorShape(1) raise Error("TensorSlice: rank greater than 3 not implemented.") fn __init__(inout self, t: TensorF32, layer: Int, row: Int) raises: var elements_per_layer = t.num_elements() // t.dim(0) var elements_per_row = elements_per_layer // t.dim(1) self._data = t.data().offset( layer * elements_per_layer + row * elements_per_row ) if t.rank() == 3: self._shape = TensorShape(t.dim(2)) elif t.rank() == 1: # Compiler complains if _shape not defined self._shape = TensorShape(1) raise Error( "Trying to slice a 1D Tensor by layer and row. This requires a" " 3D Tensor." ) else: # Compiler complains if _shape not defined self._shape = TensorShape(1) raise Error("TensorSlice: rank greater than 3 not implemented.") fn data(self) -> BufferPtrFloat32: return self._data fn shape(self) -> TensorShape: return self._shape fn num_elements(self) -> Int: return self._shape.num_elements() fn dim(self, idx: Int) -> Int: return self._shape[idx] fn rank(self) -> Int: return self._shape.rank() fn load[width: Int](self, idx: Int) -> SIMD[DType.float32, nelts]: return self._data.load[width=nelts](idx) fn load[width: Int](self, *indices: Int) -> SIMD[DType.float32, nelts]: if len(VariadicList(indices)) > 2: print( "Warning: TensorSlice only supports 1D and 2D indexing. " " Results are unlikely to be correct." ) return self.load[width=nelts](indices[0] * self._shape[1] + indices[1]) fn load[ width: Int ](self, indices: StaticIntTuple[2]) -> SIMD[DType.float32, nelts]: return self._data.load[width=nelts]( indices[0] * self._shape[1] + indices[1] ) fn __getitem__(self, idx: Int) -> SIMD[DType.float32, 1]: return self._data.load[width=1](idx) fn store[nelts: Int](self, idx: Int, val: SIMD[DType.float32, nelts]): return self._data.store[width=nelts](idx, val) fn __setitem__(self, idx: Int, val: SIMD[DType.float32, 1]): return self.store[1](idx, val) # not optimal concat fn str_concat(s1: String, s2: String) -> String: var l1 = len(s1) var l2 = len(s2) var str = List[Int8](capacity=l1 + l2 + 1) memcpy(str.data, s1._buffer.data, l1) memcpy(str.data + l1, s2._buffer.data, l2) str[l1 + l2] = 0 str.size = l1 + l2 + 1 return str^ fn string_compare(a: String, b: String) -> Int: var index = 0 while a._buffer[index] != 0 and b._buffer[index] != 0: if a._buffer[index] < b._buffer[index]: return -1 if a._buffer[index] > b._buffer[index]: return 1 index += 1 if a._buffer[index] != 0 and b._buffer[index] == 0: return 1 if a._buffer[index] == 0 and b._buffer[index] != 0: return -1 _ = (a, b) return 0 fn wrap(token: String) -> String: alias a = String("\\n") alias b = String("\\t") alias c = String("'") alias d = String('"') if token == a: return String(List[Int8](0x0A, 0)) if token == b: return String(List[Int8](0x09, 0)) if token == c: return String(List[Int8](0x27, 0)) if token == d: return String(List[Int8](0x22, 0)) return token fn string_from_bytes(owned bytes: List[Int8]) -> String: bytes.append(0) return bytes^ @value struct Tokenizer: var vocab: List[String] var vocab_scores: List[Float32] var max_token_length: Int var vocab_size: Int var map_vocab_to_index: Dict[String, Int] fn __init__(inout self, vocab_size: Int, filename: String) raises: with open(filename, "rb") as f: @parameter fn read_bytes_as[dtype: DType](size: Int) raises -> SIMD[dtype, 1]: # a List that keeps ownership of the pointer var bytes = f.read_bytes(size) # copy one element of new type after casting pointer var result = bytes.data.bitcast[SIMD[dtype, 1]]()[0] # orginal List and data can be destroyed _ = bytes return result self.vocab_size = vocab_size self.vocab_scores = List[Float32](capacity=self.vocab_size) self.vocab = List[String](capacity=self.vocab_size) self.map_vocab_to_index = Dict[String, Int]() self.max_token_length = int(read_bytes_as[DType.int32](4)) # read vocab_scores & vocab values (tokens) for i in range(self.vocab_size): var score = read_bytes_as[DType.float32](4) var slen = int(read_bytes_as[DType.int32](4)) var token = string_from_bytes(f.read_bytes(slen)) self.vocab.append(token^) self.vocab_scores.append(score) self.map_vocab_to_index[self.vocab[i]] = i fn find(self, token_o: String) -> Int: var token = wrap(token_o) var index = self.map_vocab_to_index.find(token) if index: return index.value()[] return -1 @value struct Config: var dim: Int var kv_dim: Int var hidden_dim: Int var n_layers: Int var n_heads: Int var n_kv_heads: Int var kv_mul: Int var vocab_size: Int var seq_len: Int var head_size: Int var shared_weights: Bool fn __init__(inout self, fileName: String, print_config: Bool) raises: var f = open(fileName, "r") # reading 7 vars of type DType.int32 from the file var bytes_of_config_params = NUM_CONFIG_INT * sizeof[DType.int32]() # config_data_raw id Tensor[DType.int8] with bytes_of_config_params elements var config_data_raw = f.read_bytes(bytes_of_config_params) f.close() # correct Tensor type and shape for easy reading, without copying data var int32_ptr = config_data_raw.steal_data().bitcast[Int32]() var config_data = Tensor(TensorShape(NUM_CONFIG_INT), int32_ptr) self.dim = int(config_data[0]) self.hidden_dim = int(config_data[1]) self.n_layers = int(config_data[2]) self.n_heads = int(config_data[3]) self.n_kv_heads = int(config_data[4]) self.vocab_size = int(config_data[5]) self.seq_len = int(config_data[6]) self.head_size = self.dim // self.n_heads self.kv_dim = (self.n_kv_heads * self.dim) // self.n_heads self.kv_mul = self.n_heads // self.n_kv_heads # negative vocab size is hacky way of signaling unshared weights. bit yikes. self.shared_weights = self.vocab_size > 0 if not self.shared_weights: self.vocab_size = -self.vocab_size if print_config: print("config: dim, hidden_dim", self.dim, self.hidden_dim) print("config: n_layers, n_heads", self.n_layers, self.n_heads) print("config: vocab_size, seq_len", self.vocab_size, self.seq_len) print("config: head_size", self.head_size) print("config: kv_dim, kv_mul", self.kv_dim, self.kv_mul) @value struct RunState: var x: TensorF32 # activation at current time stamp (dim,) var xb: TensorF32 # same, but inside a residual branch (dim,) var xb2: TensorF32 # an additional buffer just for convenience (dim,) var hb: TensorF32 # buffer for hidden dimension in the ffn (hidden_dim,) var hb2: TensorF32 # buffer for hidden dimension in the ffn (hidden_dim,) var q: TensorF32 # query (dim,) var k: TensorSlice # key (kv_dim,) var v: TensorSlice # value (kv_dim,) var att: TensorF32 # buffer for scores/attention values (n_heads, seq_len) var logits: TensorF32 # output logits var key_cache: TensorF32 # (layer, seq_len, dim) var value_cache: TensorF32 # (layer, seq_len, dim) fn __init__(inout self, config: Config) raises: self.x = TensorF32(config.dim) self.xb = TensorF32(config.dim) self.xb2 = TensorF32(config.dim) self.hb = TensorF32(config.hidden_dim) self.hb2 = TensorF32(config.hidden_dim) self.q = TensorF32(config.dim) self.att = TensorF32(config.n_heads, config.seq_len) self.logits = TensorF32(config.vocab_size) self.key_cache = TensorF32( config.n_layers, config.seq_len, config.kv_dim ) self.value_cache = TensorF32( config.n_layers, config.seq_len, config.kv_dim ) # So their updates flow to the caches, k and v are slices with shared memory. # Initialize with placeholders. The real tensors reference layer and position during forward pass. self.k = TensorSlice(TensorF32(TensorShape(1, config.kv_dim)), 1) self.v = TensorSlice(TensorF32(TensorShape(1, config.kv_dim)), 1) @value struct TransformerWeights: var token_embedding_table: TensorF32 var freq_cis_real: TensorF32 var freq_cis_imag: TensorF32 var rms_att_weight: TensorF32 var wq: TensorF32 var wk: TensorF32 var wv: TensorF32 var wo: TensorF32 var rms_ffn_weight: TensorF32 var w1: TensorF32 var w3: TensorF32 var w2: TensorF32 var rms_final_weight: TensorF32 var wcls: TensorF32 fn __init__(inout self, file_name: String, config: Config) raises: var bytes_read = 0 var f = open(file_name, "r") # throw away config data _ = f.read_bytes(NUM_CONFIG_INT * sizeof[DType.int32]()) bytes_read += NUM_CONFIG_INT * sizeof[DType.int32]() @parameter fn read_weights(*dims: Int) raises -> TensorF32: var shape = TensorShape(dims) # The created tensor takes a 1D shape equal to bytes read # So we can't reshape to target shape because dims don't match var tmp = f.read_bytes( shape.num_elements() * sizeof[DType.float32]() ) bytes_read += shape.num_elements() * sizeof[DType.float32]() var data = tmp.steal_data().bitcast[Float32]() return TensorF32(shape, data) self.token_embedding_table = read_weights(config.vocab_size, config.dim) self.rms_att_weight = read_weights(config.n_layers, config.dim) self.wq = read_weights(config.n_layers, config.dim, config.dim) self.wk = read_weights(config.n_layers, config.kv_dim, config.dim) self.wv = read_weights(config.n_layers, config.kv_dim, config.dim) self.wo = read_weights(config.n_layers, config.dim, config.dim) self.rms_ffn_weight = read_weights(config.n_layers, config.dim) self.w1 = read_weights(config.n_layers, config.hidden_dim, config.dim) self.w2 = read_weights(config.n_layers, config.dim, config.hidden_dim) self.w3 = read_weights(config.n_layers, config.hidden_dim, config.dim) self.rms_final_weight = read_weights(config.dim) # maybe need modifying for different model # config.head_size // 2 for stories and tinyllama-1.1 self.freq_cis_real = read_weights(config.seq_len, config.head_size // 2) self.freq_cis_imag = read_weights(config.seq_len, config.head_size // 2) if config.shared_weights: self.wcls = self.token_embedding_table else: self.wcls = read_weights(config.vocab_size, config.dim) f.close() print( "Total bytes read:", bytes_read, "Estimated checkpoint size: ", bytes_read // 1024 // 1024, "MB", ) @always_inline fn rmsnorm( inout o: BufferPtrFloat32, x: BufferPtrFloat32, weight: BufferPtrFloat32, size: Int, ) -> None: # Calculate sum of squares var tmp = Accumulator[DType.float32, nelts]() @parameter fn _sum2[_nelts: Int](j: Int): tmp.accumulate(x.offset(j).load[width=_nelts](0) ** 2) vectorize[_sum2, nelts](size) var ss: Float32 = tmp.total() ss = ss / size + 1e-5 ss = 1.0 / math.sqrt(ss) # Normalize and scale @parameter fn _norm[_nelts: Int](j: Int): var val = weight.load[width=_nelts](j) * ss * x.load[width=_nelts](j) o.offset(j).store[width=_nelts](0, val) vectorize[_norm, nelts](size) @always_inline fn rmsnorm(inout o: TensorF32, x: TensorF32, weight: TensorF32): rmsnorm(o._ptr, x.data(), weight.data(), weight.dim(weight.rank() - 1)) @always_inline fn rmsnorm(inout o: TensorF32, x: TensorF32, weight: TensorSlice): rmsnorm(o._ptr, x.data(), weight.data(), weight.dim(weight.rank() - 1)) @always_inline fn softmax(inout x: TensorF32) -> None: softmax(x, 0, x.dim(0)) @always_inline fn softmax(inout x: TensorF32, start: Int, end: Int): var max_val: Float32 = -1e9 @parameter fn _max[_nelts: Int](ii: Int): var val = x.load[width=_nelts](start + ii).reduce_max() if val > max_val: max_val = val vectorize[_max, nelts](end - start) var acc = Accumulator[DType.float32, nelts]() @parameter fn _exp[_nelts: Int](ii: Int): var val = math.exp(x.load[width=_nelts](start + ii) - max_val) x.store[width=_nelts](start + ii, val) acc.accumulate(val) vectorize[_exp, nelts](end - start) var ssum = acc.total() @parameter fn _norm[_nelts: Int](ii: Int): x.store[width=_nelts]( start + ii, x.load[width=_nelts](start + ii) / ssum ) vectorize[_norm, nelts](end - start) @always_inline fn batch_matmul[ n: Int ]( C: StaticTuple[BufferPtrFloat32, n], A: BufferPtrFloat32, B: StaticTuple[BufferPtrFloat32, n], rows: Int, cols: Int, ): @parameter fn compute_row(i: Int): var tmp = StaticTuple[Accumulator[DType.float32, nelts], n]() @unroll for k in range(n): tmp[k] = Accumulator[DType.float32, nelts]() var row_offset = i * cols @parameter fn dot[_nelts: Int](j: Int): var a = A.load[width=_nelts](j) @unroll for k in range(n): tmp[k].accumulate(a * B[k].load[width=_nelts](row_offset + j)) vectorize[dot, nelts](cols) @unroll for k in range(n): C[k].store(i, tmp[k].total()) parallelize[compute_row](rows, workers) @always_inline fn matmul(C: TensorF32, A: TensorF32, B: TensorF32) raises: # B (d,n) @ A (n,) -> C (d,) matmul_dimension_checks(A.shape(), B.shape()) batch_matmul[1]( StaticTuple[BufferPtrFloat32, 1](C.data()), A.data(), StaticTuple[BufferPtrFloat32, 1](B.data()), B.dim(0), B.dim(1), ) @always_inline fn matmul(C: TensorF32, A: TensorF32, B: TensorSlice) raises: # B (d,n) @ A (n,) -> C (d,) matmul_dimension_checks(A.shape(), B.shape()) batch_matmul[1]( StaticTuple[BufferPtrFloat32, 1](C.data()), A.data(), StaticTuple[BufferPtrFloat32, 1](B.data()), B.dim(0), B.dim(1), ) @always_inline fn matmul(C: TensorSlice, A: TensorF32, B: TensorSlice) raises: # B (d,n) @ A (n,) -> C (d,) matmul_dimension_checks(A.shape(), B.shape()) batch_matmul[1]( StaticTuple[BufferPtrFloat32, 1]( C.data(), ), A.data(), StaticTuple[BufferPtrFloat32, 1](B.data()), B.dim(0), B.dim(1), ) fn matmul_dimension_checks(a: TensorShape, b: TensorShape) raises: if a[0] != b[1]: raise Error( "matmul dimension mismatch. A rows (dim 0) not equal to B columns" " (dim 1)" ) if b.rank() != 2: raise Error("matmul expects B to be a 2D matrix") # Apply RoPE rotation to the q and k vectors for each head # rotate odd and even dim @always_inline fn rope_rotation_llama( inout state: RunState, freq_cis_real_row: TensorSlice, freq_cis_imag_row: TensorSlice, config: Config, ) -> None: # stories model, llama2 var head_size = config.head_size @parameter fn head_loop(i: Int): # Simple vectorization with (head_size // 2) steps gave junk transformer output. # Maybe because the nelt ranges end up overlapping between the steps. for j in range(0, config.head_size, 2): var fcr = freq_cis_real_row[j // 2] var fci = freq_cis_imag_row[j // 2] var q0 = state.q[i * head_size + j] var q1 = state.q[i * head_size + j + 1] state.q[i * head_size + j] = q0 * fcr - q1 * fci state.q[i * head_size + j + 1] = q0 * fci + q1 * fcr if i < config.n_kv_heads: var k0 = state.k[i * head_size + j] var k1 = state.k[i * head_size + j + 1] state.k[i * head_size + j] = k0 * fcr - k1 * fci state.k[i * head_size + j + 1] = k0 * fci + k1 * fcr parallelize[head_loop](config.n_heads, workers) @always_inline fn transformer( token: Int, pos: Int, config: Config, inout state: RunState, weights: TransformerWeights, ) raises -> None: # A few convenience variables var dim = config.dim var hidden_dim = config.hidden_dim var head_size = config.head_size var kv_dim = config.kv_dim var kv_mul = config.kv_mul # Copy the token embedding into x var content_row = weights.token_embedding_table.data().offset(token * dim) memcpy(state.x.data(), content_row, dim) # Pluck out the "pos" row of freq_cis_real and freq_cis_imag var freq_cis_real_row = TensorSlice(weights.freq_cis_real, pos) var freq_cis_imag_row = TensorSlice(weights.freq_cis_imag, pos) # Forward all the layers for l in range(config.n_layers): # Attention rmsnorm rmsnorm(state.xb, state.x, TensorSlice(weights.rms_att_weight, l)) # QKV matmuls for this position var loff = l * config.seq_len * config.kv_dim state.k = TensorSlice(state.key_cache, l, pos) state.v = TensorSlice(state.value_cache, l, pos) if kv_dim == dim: batch_matmul[3]( StaticTuple[BufferPtrFloat32, 3]( state.q.data(), state.k.data(), state.v.data() ), state.xb.data(), StaticTuple[BufferPtrFloat32, 3]( TensorSlice(weights.wq, l).data(), TensorSlice(weights.wk, l).data(), TensorSlice(weights.wv, l).data(), ), dim, dim, ) else: matmul(state.q, state.xb, TensorSlice(weights.wq, l)) batch_matmul[2]( StaticTuple[BufferPtrFloat32, 2]( state.k.data(), state.v.data() ), state.xb.data(), StaticTuple[BufferPtrFloat32, 2]( TensorSlice(weights.wk, l).data(), TensorSlice(weights.wv, l).data(), ), kv_dim, dim, ) # Apply RoPE rotation to the q and k vectors for each head rope_rotation_llama(state, freq_cis_real_row, freq_cis_imag_row, config) memset_zero(state.xb.data(), state.xb.num_elements()) # Multihead attention. Iterate over all heads in parallel. @parameter fn loop_over_heads(h: Int): # Get the query vector for this head var q_offset = h * head_size # Index of attention scores for this head var att_offset = h * config.seq_len # Iterate over all timesteps, including the current one for t in range(pos + 1): # Starting index of the key vector for this head and at this timestep var k_offset = loff + t * kv_dim + (h // kv_mul) * head_size # Calculate the attention score as the dot product of q and k var score: Float32 = 0.0 @parameter fn score_fn[_nelts: Int](i: Int): score += ( state.q.load[width=_nelts](q_offset + i) * state.key_cache.load[width=_nelts](k_offset + i) ).reduce_add() vectorize[score_fn, nelts](head_size) score /= math.sqrt[DType.float32, 1](head_size) # Save the score to the attention buffer state.att[att_offset + t] = score # Softmax the scores to get attention weights, from 0..pos inclusively softmax(state.att, att_offset, att_offset + pos + 1) # Weighted sum of the values, store back into xb var xb_offset = h * head_size for t in range(pos + 1): # Starting index of the value vector for this head and at this timestep var v_offset = loff + t * kv_dim + (h // kv_mul) * head_size # Get the attention weight for this timestep var a = state.att[att_offset + t] # Accumulate the weighted value into xb @parameter fn xb_accumulate[_nelts: Int](i: Int): var xbi = state.xb.load[width=_nelts]( xb_offset + i ) + a * state.value_cache.load[width=_nelts](v_offset + i) state.xb.store[width=_nelts](xb_offset + i, xbi) vectorize[xb_accumulate, nelts](head_size) parallelize[loop_over_heads](config.n_heads, workers) # Final matrix multiplication to get the output of the attention matmul(state.xb2, state.xb, TensorSlice(weights.wo, l)) # Residual connection back into x state.x = state.x + state.xb2 # FFN rmsnorm rmsnorm(state.xb, state.x, TensorSlice(weights.rms_ffn_weight, l)) # Calculate self.w1(x) and self.w3(x) for FFN batch_matmul[2]( StaticTuple[BufferPtrFloat32, 2](state.hb.data(), state.hb2.data()), state.xb.data(), StaticTuple[BufferPtrFloat32, 2]( TensorSlice(weights.w1, l).data(), TensorSlice(weights.w3, l).data(), ), hidden_dim, dim, ) @parameter fn silu[_nelts: Int](i: Int): var initial_hb = state.hb.load[width=_nelts](i) # Apply SiLU activation function (silu(x) = x * sigmoid(x)) var hbi = initial_hb * (1.0 / (1.0 + math.exp(-initial_hb))) # Elementwise multiply with w3(x) state.hb.store[width=_nelts]( i, hbi * state.hb2.load[width=_nelts](i) ) vectorize[silu, nelts](hidden_dim) # Final matrix multiplication to get the output of the FFN matmul(state.xb, state.hb, TensorSlice(weights.w2, l)) # Residual connection state.x = state.x + state.xb # Final rmsnorm rmsnorm(state.x, state.x, weights.rms_final_weight) # Classifier into logits matmul(state.logits, state.x, weights.wcls) fn sample(probabilities: TensorF32) -> Int: var n = probabilities.dim(0) # Sample index from probabilities, they must sum to 1 # get random value within (min, max) float32 range var r = rand[DType.float32](1) var cdf: Float32 = 0.0 for i in range(n): cdf += probabilities[i] if r[0] < cdf: return i return n - 1 # In case of rounding errors fn bpe_encode(inout tokens: List[Int], text: String, tok: Tokenizer): for pos in range(len(text)): var char = text[pos] var id = tok.find(char) if id == -1: print("Not a good prompt token at pos ", pos) return tokens.append(id) while True: var best_score = Float32(-1e10) var best_id = -1 var best_idx = -1 for i in range(len(tokens) - 1): # Check if we can merge the pair (tokens[i], tokens[i+1]) var str = str_concat(tok.vocab[tokens[i]], tok.vocab[tokens[i + 1]]) var id = tok.find(str) if id != -1 and tok.vocab_scores[id] > best_score: best_score = tok.vocab_scores[id] best_id = id best_idx = i if best_idx == -1: # We couldn't find any more pairs to merge, so we're done break # Merge the consecutive pair (best_idx, best_idx+1) into new token best_id tokens[best_idx] = best_id # Delete token at position best_idx+1, shift the entire sequence back 1 var _tokens = List[Int]() for i in range(0, best_idx + 1): _tokens.append(tokens[i]) for i in range(best_idx + 2, len(tokens)): _tokens.append(tokens[i]) tokens = _tokens^ fn time_in_ms() -> Int: # Returns time in milliseconds for benchmarking the model speed return time.now() // 1_000_000 fn print_usage(): print("Usage: mojo llama2.mojo <checkpoint> [options]") print( 'Example: mojo llama2.mojo stories15M.bin -s 99 -n 256 -t 0.5 -i "Llama' ' is an animal"' ) print("Options:") print(" -s <int> random seed, default time.now()") print(" -t <float> temperature in [0,1.0], default 1.0") print( " -n <int> number of steps to run for, default 256. 0 = max_seq_len" ) print(" -i <string> input prompt") print(" -z tokenizer path") print(" -j number of workers to use, default num_cores()") fn main() raises: workers = num_performance_cores() var tokenizer = StringRef("tokenizer.bin") var checkpoint = StringRef("stories15M.bin") var temperature = 0.9 var steps = 256 var prompt = String("") var rng_seed: Int = time.now() var print_config = 0 @parameter fn argparse() raises -> Int: var args = argv() if len(args) < 2: return 0 checkpoint = args[1] for i in range(2, len(args), 2): if args[i] == "-p": print("Option not supported: ", args[i]) if args[i] == "-n": steps = atol(args[i + 1]) if args[i] == "-z": tokenizer = args[i + 1] if args[i] == "-s": rng_seed = atol(args[i + 1]) if args[i] == "-i": prompt = args[i + 1] if args[i] == "-j": workers = atol(args[i + 1]) if args[i] == "-pc": print_config = atol(args[i + 1]) if args[i] == "-t": var val = args[i + 1] temperature = 0.0 # hacky parse float, keep only 1 digit for c in range(0, len(val)): if val[c] == ".": temperature += atol(val[c + 1]) * 0.1 break else: temperature = atol(val[c]) if temperature < -1e9 or temperature > (1 + 1e9): print("Wrong temperature value", temperature) return 0 return 1 var res = argparse() if res == 0: print_usage() return print("num parallel workers:", workers, " SIMD width:", nelts) random.seed(rng_seed) var config = Config(checkpoint, print_config == 1) var weights = TransformerWeights(checkpoint, config) if steps <= 0 or steps > config.seq_len: steps = config.seq_len var tok = Tokenizer(config.vocab_size, tokenizer) print( "n layers:", config.n_layers, "| vocab size:", tok.vocab_size, ) # Create and initialize the application RunState var state = RunState(config) # Process the prompt, if any var prompt_tokens = List[Int]() if prompt: bpe_encode(prompt_tokens, prompt, tok) # Start the main loop var start = 0 # Used to time our code, only initialized after the first iteration var next_token = 0 # Will store the next token in the sequence # Initialize with token 1 (=BOS), as done in Llama-2 sentencepiece tokenizer var token = 1 # Position in the sequence var pos = 0 while pos < steps: # Forward the transformer to get logits for the next token transformer(token, pos, config, state, weights) if pos < len(prompt_tokens): next_token = prompt_tokens[pos] else: # Sample the next token if temperature == 0.0: # Greedy argmax sampling: take the token with the highest probability next_token = int(state.logits.argmax()[0]) else: # Apply the temperature to the logits for q in range(config.vocab_size): state.logits[q] = state.logits[q] / temperature # Apply softmax to the logits to get the probabilities for the next token softmax(state.logits) # Sample from this distribution to get the next token next_token = sample(state.logits) # Finish generating when EOS, BOS appear if next_token == 1 or next_token == 2: break var token_str: String = tok.vocab[next_token] if token == 1 and token_str._buffer[0] == ord(" "): token_str = token_str[1:] print(token_str, end="") # Advance forward token = next_token pos += 1 if start == 0: start = time_in_ms() var end = time_in_ms() print("\nachieved tok/s: ", (pos - 1) / (end - start) * 1000) --- .gitignore --- /main /main.asm --- LICENSE --- MIT License Copyright (c) 2023 Henk-Jan Lebbink Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- MinTermSet.mojo --- from bit import pop_count from tools import get_bit, get_dk_mask from to_string import PrintType, minterms_to_string, minterm_to_string from MySet import MySet struct MinTermSet[T: DType, N_BITS: Int](CollectionElement, Sized, Stringable): alias Q = List[Scalar[T]] alias n_sets = N_BITS + 1 var n_elements: Int var max_bit_count: Int var is_sorted: Bool var data: List[Self.Q] fn __init__(inout self): self.n_elements = 0 self.max_bit_count = 0 self.is_sorted = True self.data = List[Self.Q](capacity=Self.n_sets) for i in range(Self.n_sets): self.data.append(Self.Q()) fn __eq__(self, other: Self) -> Bool: if not (self.is_sorted) or not (other.is_sorted): print( "WARNING performance: MinTermSet: __eq__: self or other is not" " sorted!" ) # return False if len(self) != len(other): # print("MinTermSet eq: returns False (A)") return False for i in range(Self.n_sets): if self.data[i].size != other.data[i].size: # print("MinTermSet eq: returns False (B)" + str(i)) return False for i in range(Self.n_sets): if not (Self.equal(self.data[i], other.data[i])): # print("MinTermSet eq: returns False (C)" + str(i)) return False # print("MinTermSet eq: returns True (D)") return True fn __ne__(self, other: Self) -> Bool: return not (self == other) @staticmethod fn equal(v1: Self.Q, v2: Self.Q) -> Bool: for i in range(v1.size): if v1[i] != v2[i]: return False return True # trait Sized fn __len__(self) -> Int: return self.n_elements # trait Copyable fn __copyinit__(inout self, existing: Self): self.n_elements = existing.n_elements self.max_bit_count = existing.max_bit_count self.is_sorted = existing.is_sorted self.data = existing.data # trait Movable fn __moveinit__(inout self, owned existing: Self): self.n_elements = existing.n_elements self.max_bit_count = existing.max_bit_count self.is_sorted = existing.is_sorted self.data = existing.data^ # trait Stringable fn __str__(self) -> String: return self.to_string[PrintType.VERBOSE](N_BITS) fn to_string[P: PrintType](self, number_vars: Int) -> String: var result: String = "" for i in range(Self.n_sets): result += minterms_to_string[T, P](self.data[i], number_vars) return result fn sort(inout self): if self.is_sorted: return for i in range(Self.n_sets): sort[T](self.data[i]) self.is_sorted = True fn add[ CHECK_CONTAINS: Bool = True, SHOW_INFO: Bool = False ](inout self, value: Scalar[T]): alias dk_mask: Scalar[T] = get_dk_mask[T]() var n_bits_set = int(pop_count(value & dk_mask)) # @parameter # if SHOW_INFO: # print("INFO: 7bd7968f: adding value: check_duplicate=" +str(check_duplicate) +"; value=" + minterm_to_string[T, PrintType.VERBOSE](value, bit_width) + "; n_bits_set="+str(n_bits_set)) self.n_elements += 1 if self.max_bit_count < n_bits_set: self.max_bit_count = n_bits_set # @parameter # if SHOW_INFO: # print("INFO: currently present: n_bits_set=" + str(n_bits_set) + "; size=" + str(self.data[n_bits_set].size)) @parameter if CHECK_CONTAINS: var already_present = False for i in range(self.data[n_bits_set].size): if self.data[n_bits_set][i] == value: already_present = True break if not already_present: self.data[n_bits_set].append(value) self.is_sorted = False else: self.data[n_bits_set].append(value) self.is_sorted = False fn get(self, n_bits_set: Int) -> Self.Q: debug_assert(n_bits_set < Self.n_sets, "invalid idx") return self.data[n_bits_set] fn to_set(self) -> MySet[T]: var result = MySet[T]() for i in range(Self.n_sets): var x = self.data[i] for j in range(len(x)): result.add[CHECK_CONTAINS=False](x[j]) return result^ --- MyMap.mojo --- from collections import Dict, KeyElement from collections.optional import Optional @value struct SIMDKey[T: DType](KeyElement): var d: Scalar[T] fn init(inout self, d: Scalar[T]): self.d = d fn __hash__(self) -> Int: return int(self.d) fn __eq__(self, other: Self) -> Bool: return self.d == other.d struct MyMap2[Key2: DType, Value: CollectionElement]( CollectionElement, Sized, Stringable ): alias Key = SIMDKey[Key2] var data: Dict[Self.Key, Value] @always_inline("nodebug") fn __init__(inout self): self.data = Dict[Self.Key, Value]() self.data.__init__() # trait CollectionElement @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.data = Dict[Self.Key, Value]() for i in range(len(self.data)): self.data._insert(self.data._entries[i].take()) # trait CollectionElement @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): self.data = existing.data^ # trait CollectionElement @always_inline("nodebug") fn __del__(owned self: Self): pass # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: var result: String = "{" var size = len(self.data) if size > 0: for i in range(size - 1): var de = self.data._entries[i].take() # result += str(de.key) + "->" + str(de.value) return result + "}" # trait Sized @always_inline("nodebug") fn __len__(self) -> Int: return len(self.data) fn add(inout self, key: Self.Key, owned value: Value): self.data._insert(key, value) fn remove(inout self, key: Self.Key): try: _ = self.data.pop(key) except: pass fn get(self, key: Self.Key) -> Value: return self.data.find(key).take() @always_inline("nodebug") fn contains(self, key: Self.Key) -> Bool: return self.data.__contains__(key) fn values(self) -> List[Value]: var result = List[Value]() for i in range(len(self.data)): result.append(self.data._entries[i].take().value) return result struct MyMap[Key: DType, Value: CollectionElement]( CollectionElement, Sized, Stringable ): var keys: List[SIMD[Key, 1]] var values: List[Value] @always_inline("nodebug") fn get_values(self) -> List[Value]: return self.values @always_inline("nodebug") fn __init__(inout self): self.keys = List[SIMD[Key, 1]]() self.values = List[Value]() # trait CollectionElement @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.keys.__copyinit__(existing.keys) self.values.__copyinit__(existing.values) # trait CollectionElement @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): self.keys = existing.keys^ self.values = existing.values^ # trait CollectionElement @always_inline("nodebug") fn __del__(owned self: Self): pass # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: var result: String = "{" var size = len(self.keys) if size > 0: for i in range(size - 1): result += str(self.keys[i]) + "-> value," result += str(self.keys[size - 1]) + "-> value" return result + "}" # trait Sized @always_inline("nodebug") fn __len__(self) -> Int: return len(self.keys) fn add(inout self, key: Scalar[Key], owned value: Value): for i in range(len(self.keys)): if key == self.keys[i]: self.values[i] = value^ return self.keys.append(key) self.values.append(value^) fn remove(inout self, key: Scalar[Key]): var size = len(self.keys) for i in range(size): if key == self.keys[i]: if i == size - 1: _ = self.keys.pop() _ = self.values.pop() else: self.keys[i] = self.keys.pop() self.values[i] = self.values.pop() return fn get(self, key: Scalar[Key]) -> Value: for i in range(len(self.keys)): if key == self.keys[i]: return self.values[i] print("ERROR: MyMa: cannot return an empty element") return self.values[0] @always_inline("nodebug") fn contains(self, key: Scalar[Key]) -> Bool: for i in range(len(self.keys)): if key == self.keys[i]: return True return False --- MySet.mojo --- from tools import eq_dynamic_vector struct MySet[T: DType](CollectionElement, Sized, Stringable): var data: List[Scalar[T]] var is_sorted: Bool @always_inline("nodebug") fn __init__(inout self): self.data = List[SIMD[T, 1]]() self.is_sorted = True # trait CollectionElement @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.data.__copyinit__(existing.data) self.is_sorted = existing.is_sorted # trait CollectionElement @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): self.data = existing.data^ self.is_sorted = existing.is_sorted # trait CollectionElement @always_inline("nodebug") fn __del__(owned self: Self): pass # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: var result: String = "[" var size = len(self.data) if size > 0: for i in range(size - 1): result += str(self.data[i]) + "," result += str(self.data[size - 1]) return result + "]" # trait Sized @always_inline("nodebug") fn __len__(self) -> Int: return len(self.data) fn __eq__(self, other: Self) -> Bool: if self.is_sorted and other.is_sorted: return eq_dynamic_vector[T](self.data, other.data) print("WARNING performance: MySet:__eq__ on unsorted data") var a = self a.sort() var b = other b.sort() return a == b fn __ne__(self, other: Self) -> Bool: return not (self == other) @always_inline("nodebug") fn add[CHECK_CONTAINS: Bool = True](inout self, value: SIMD[T, 1]): @parameter if CHECK_CONTAINS: if self.contains(value): return self.data.append(value) self.is_sorted = False @always_inline("nodebug") fn add[CHECK_CONTAINS: Bool = True](inout self, values: MySet[T]): for i in range(len(values)): # this can be done more efficient self.add[CHECK_CONTAINS](values.data[i]) fn remove(inout self, value: Scalar[T]): var size = len(self.data) for i in range(size): if value == self.data[i]: if i == (size - 1): _ = self.data.pop() # NOTE this set is still sorted! else: self.data[i] = self.data.pop() self.is_sorted = False return @always_inline("nodebug") fn remove(inout self, values: MySet[T]): for i in range(len(values)): # this can be done more efficient self.remove(values.data[i]) @always_inline("nodebug") fn sort(inout self): if self.is_sorted: return else: sort[T](self.data) self.is_sorted = True @always_inline("nodebug") fn contains(self, value: Scalar[T]) -> Bool: if self.is_sorted: for i in range(len(self.data)): if value <= self.data[i]: return value == self.data[i] else: for i in range(len(self.data)): if value == self.data[i]: return True return False struct MySetStr(CollectionElement, Sized, Stringable): var data: List[String] @always_inline("nodebug") fn __init__(inout self): self.data = List[String]() # trait CollectionElement @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.data.__copyinit__(existing.data) # trait CollectionElement @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): self.data = existing.data^ # trait CollectionElement @always_inline("nodebug") fn __del__(owned self: Self): pass # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: var result: String = "[" var size = len(self.data) if size > 0: for i in range(size - 1): result += str(self.data[i]) + "," result += str(self.data[size - 1]) return result + "]" # trait Sized @always_inline("nodebug") fn __len__(self) -> Int: return len(self.data) fn add(inout self, value: String): for i in range(len(self.data)): if value == self.data[i]: return self.data.append(value) fn contains(self, value: String) -> Bool: for i in range(len(self.data)): if value == self.data[i]: return True return False --- README.md --- # quine-mccluskey-mojo Implementation of Quine-McCluskey and Petrick Methods in Modular Mojo The Quine-McCluskey method is an exact algorithm used for Boolean function simplification. While traditionally applied in digital circuit design and optimization, I would like to use it for optimizing software. This method takes a set of minterms representing a Boolean function and systematically combines them to identify things called prime implicants. Through grouping terms with similar binary representations, the algorithm constructs a table, in which we can identify essential prime implicants. The outcome is a minimal sum-of-products (SOP) expression, representing a simplified form of the given Boolean function. Petrick's method, another exact technique used in digital circuit design, is used for solving cyclic covering problems. It constructs a matrix based on the prime implicants derived from the Quine-McCluskey method and subsequently applying a process to identify the minimal cover. This minimal cover represents the smallest form of the given Boolean function. The logic in a programming language can be described as a Boolean function, as outlined in the following Truth-Table: ``` ABCD -> y 0: 0000 -> 1 1: 0001 -> 0 2: 0010 -> 1 3: 0011 -> 1 4: 0100 -> 1 5: 0101 -> 1 6: 0110 -> 1 7: 0111 -> 1 8: 1000 -> 1 9: 1001 -> 1 10: 1010 -> 1 11: 1011 -> 1 12: 1100 -> 1 13: 1101 -> 1 14: 1110 -> 0 15: 1111 -> 0 ``` This function maps four input boolean variables `A` to `D` to a result `y`. Without much effort, an inefficient formula can be derived for this function, specifically the disjunction of all 13 terms (conjunctions) that map to 1, expressed as `y = (~A ^ ~B ^ ~C ^ ~D) v ... v (A ^ B ^ ~C ^ D)`. We can do better than that, and find a much more optimized representation. The Quine-McCluskey method simplifies this truth-table to: ``` ABCD -> y 0XX0 -> 1 X0X0 -> 1 XX00 -> 1 01XX -> 1 10XX -> 1 0X1X -> 1 1X0X -> 1 X01X -> 1 X10X -> 1 ``` Additionally, Petricks method simplifies this truth-table to: ``` ABCD -> y 01XX -> 1 1X0X -> 1 0XX0 -> 1 X01X -> 1 ``` Which gives us the following formula: `y = (~A ^ B) v (A ^ ~C) v (~A ^ ~D) v (~B ^ C)` The Mojo code has a parameter `SHOW_INFO: Bool` which, when set to true, will display intermediate steps. This allows us to observe how the Boolean function is incrementally simplified throughout the process. ## And what has this to do with Mojo? Petrick's method addresses the covering problem, a known NP-complete problem: thus exact algorithm *may* take exponetial time in the worst cast. Having a efficient implementation is not a luxery. But more important, with Mojo, this algorithm can be run at **compile time**. We can extract logic from our programming language, minimize it to its absolute minimum, and produce high-performance code. While compile time may be notable slower, consider it an investment in achieving faster runtime performance. Attempting to write this algorithm as a template program in C++ may not be the most pleasant experience... Hence Mojo. --- TruthTable.mojo --- from collections.vector import InlinedFixedVector from quine_mccluskey import reduce_qm, reduce_qm_classic from tools import get_bit, set_bit, clear_bit, get_minterm_type from to_string import PrintType, minterms_to_string, minterm_to_string from MySet import MySet struct TruthTable[N_BITS_INPUT: Int](Stringable): alias N_BITS_OUTPUT = 1 # currently, only one single output alias MinTermType: DType = get_minterm_type[N_BITS_INPUT]() alias MAX_VALUE: Int = 1 << N_BITS_INPUT var data: MySet[Self.MinTermType] var is_compressed: Bool var is_decompressed: Bool # initialize truth table with with every row false @always_inline("nodebug") fn __init__(inout self): self.data = MySet[Self.MinTermType]() self.is_compressed = True self.is_decompressed = True fn __init__(inout self, implicants: VariadicList[Int], compress: Bool): self.__init__() self.set_true(implicants) if compress: self.compress() @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.data = existing.data self.is_compressed = existing.is_compressed self.is_decompressed = existing.is_decompressed @always_inline("nodebug") fn set_true(inout self, implicant: Int): if implicant < Self.MAX_VALUE: self.data.add(Scalar[Self.MinTermType](implicant)) self.is_compressed = False # NOTE: no need to update is_decompressed since only values without unknowns can be added @always_inline("nodebug") fn set_true(inout self, implicants: VariadicList[Int]): for i in range(len(implicants)): self.set_true(implicants[i]) @always_inline("nodebug") fn get_value(self, idx: Int) -> Int: @parameter if N_BITS_INPUT <= 4: return int(self.data.data[idx].__and__(0xF)) if N_BITS_INPUT <= 8: return int(self.data.data[idx].__and__(0xFF)) elif N_BITS_INPUT <= 16: return int(self.data.data[idx].__and__(0xFFFF)) elif N_BITS_INPUT <= 32: return int(self.data.data[idx].__and__(0xFFFF_FFFF)) else: print("ERROR: 855c5c76: Not implemented yet") return 0 @always_inline("nodebug") fn get_unknown(self, idx: Int) -> Int: @parameter if N_BITS_INPUT <= 4: return int(self.data.data[idx] >> 4) elif N_BITS_INPUT <= 8: return int(self.data.data[idx] >> 8) elif N_BITS_INPUT <= 16: return int(self.data.data[idx] >> 16) elif N_BITS_INPUT <= 32: return int(self.data.data[idx] >> 32) else: print("ERROR: 61fd61ff: Not implemented yet") return 0 @always_inline("nodebug") fn sort(inout self): self.data.sort() @always_inline("nodebug") fn compress[USE_CLASSIC_METHOD: Bool = False, SHOW_INFO: Bool = False](inout self): if self.is_compressed: return self.sort() @parameter if USE_CLASSIC_METHOD: self.data = reduce_qm_classic[Self.MinTermType, N_BITS_INPUT, SHOW_INFO](self.data) else: self.data = reduce_qm[Self.MinTermType, N_BITS_INPUT, SHOW_INFO](self.data) self.is_compressed = True self.is_decompressed = False self.sort() @always_inline("nodebug") fn decompress[SHOW_INFO: Bool = False](inout self): if self.is_decompressed: return var new_data = MySet[Self.MinTermType]() for i in range(len(self.data)): Self.flatten(self.get_value(i), self.get_unknown(i), 0, new_data) self.data = new_data self.is_compressed = False self.is_decompressed = True self.sort() @staticmethod fn flatten(value: Scalar[Self.MinTermType], unknown: Scalar[Self.MinTermType], pos: Int, inout r: MySet[Self.MinTermType]): if unknown == 0: # there are no unknown (dont knows) anymore, use the value as is r.add(value) return for new_pos in range(pos, N_BITS_INPUT): if get_bit(unknown, new_pos): var unknown_new = clear_bit(unknown, new_pos) Self.flatten(clear_bit(value, new_pos), unknown_new, new_pos+1, r) Self.flatten(set_bit(value, new_pos), unknown_new, new_pos+1, r) # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: return "; is_compressed = " + str(self.is_compressed) + "; is_decompressed = " + str(self.is_decompressed) + "; data = \n" + self.to_string[PrintType.VERBOSE]() fn to_string[P: PrintType](self) -> String: return minterms_to_string[Self.MinTermType, P, 100](self.data.data, N_BITS_INPUT) @staticmethod fn default_names() -> InlinedFixedVector[StringLiteral, N_BITS_INPUT]: var result = InlinedFixedVector[StringLiteral, N_BITS_INPUT](N_BITS_INPUT) for i in range(N_BITS_INPUT): # TODO: do char arithmetic 'A'+i if i == 0: result[i] = "A" if i == 1: result[i] = "B" if i == 2: result[i] = "C" if i == 3: result[i] = "D" if i == 4: result[i] = "E" if i == 5: result[i] = "F" if i == 6: result[i] = "G" if i == 7: result[i] = "H" if i == 8: result[i] = "U" return result fn pretty_print_blif(self, model_name: StringLiteral = "Example", variable_names: InlinedFixedVector[StringLiteral, N_BITS_INPUT] = Self.default_names()) -> String: var result: String = ".model " + str(model_name) + "\n.inputs" for i in range(N_BITS_INPUT): result += " " + str(variable_names[i]) # convert StringLiteral to String result += "\n.outputs" for i in range(Self.N_BITS_OUTPUT): result += " F" + str(i) result += "\n" for i in range(Self.N_BITS_OUTPUT): result += ".names" for j in range(N_BITS_INPUT): result += " " + str(variable_names[j]) # convert StringLiteral to String result += " F" + str((Self.N_BITS_OUTPUT - 1) - i) + "\n" for j in range(len(self.data)): result += minterm_to_string[Self.MinTermType, PrintType.BIN](self.data.data[j], N_BITS_INPUT) + " 1\n" result += ".end\n" return result --- cnf_to_dnf.mojo --- from tools import get_bit, delete_indices from bit import pop_count fn convert_cnf_to_dnf[ T: DType, SHOW_INFO: Bool ](cnf: List[Scalar[T]], n_bits: Int) -> List[Scalar[T]]: var result_dnf = List[Scalar[T]]() var result_dnf_next = List[Scalar[T]]() var first = True for i in range(len(cnf)): var disjunction = cnf[i] if first: first = False for pos in range(n_bits): if get_bit(disjunction, pos): result_dnf.append(1 << pos) else: for pos in range(n_bits): if get_bit(disjunction, pos): var x: Scalar[T] = 1 << pos for j in range(len(result_dnf)): var z = x.__or__(result_dnf[j]) update_dnf(result_dnf_next, z) result_dnf = result_dnf_next result_dnf_next.clear() return result_dnf # convert_cnf_to_dnf_minimal: for Petricks method, we only need one of the smallest # conjunction of the DNF, convert_cnf_to_dnf would compute all conjunctions of the DNF # which could be computationally challenging, hence convert_cnf_to_dnf_minimal only # computes the smallest ones fn convert_cnf_to_dnf_minimal[ T: DType, EARLY_PRUNE: Bool, SHOW_INFO: Bool ](cnf: List[Scalar[T]], n_bits: Int) -> List[Scalar[T]]: var result_dnf = List[Scalar[T]]() @parameter if EARLY_PRUNE: var n_disjunctions = len(cnf) var n_disjunction_done = 0 for i1 in range(n_disjunctions): var disjunction = cnf[i1] @parameter if SHOW_INFO: print( "INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress " + str(n_disjunction_done) + " of " + str(n_disjunctions), end="", ) if n_disjunction_done == 0: for pos in range(n_bits): if get_bit(disjunction, pos): result_dnf.append(1 << pos) else: var result_dnf_next = List[Scalar[T]]() var smallest_cnf_size: Int = 0x7FFF_FFFF var max_size: Int = 0 var n_pruned: Int = 0 var n_not_pruned: Int = 0 for pos in range(n_bits): if get_bit(disjunction, pos): var x: Scalar[T] = 1 << pos for j in range(len(result_dnf)): var z: Scalar[T] = x.__or__(result_dnf[j]) # Early prune CNFs that cannot become the smallest cnf var conjunction_size: Int = int(pop_count(z)) if conjunction_size < smallest_cnf_size: smallest_cnf_size = conjunction_size max_size = conjunction_size + ( n_disjunctions - n_disjunction_done ) var consider_z = True if max_size < conjunction_size: consider_z = False # print("INFO: 8668d0bc: Pruning conjunction: the current minimum is " + str(smallest_cnf_size), end='') # print(" and the remaining disjunctions is " + str((n_disjunctions - n_disjunction_done)), end='') # print(", thus this conjunction with size " + str(conjunction_size) + " can never be the smallest"); n_pruned += 1 else: n_not_pruned += 1 if consider_z: update_dnf[T](result_dnf_next, z) @parameter if SHOW_INFO: print( "; result_dnf_next=" + str(len(result_dnf_next)) + "; n_pruned=" + str(n_pruned) + "; n_not_prunned=" + str(n_not_pruned) + "; max_size=" + str(max_size) + "; smallest_cnf_size=" + str(smallest_cnf_size) ) result_dnf = result_dnf_next^ n_disjunction_done += 1 else: # do a late prune, can be 20 times slower result_dnf = convert_cnf_to_dnf[T, SHOW_INFO](cnf, n_bits) # select only the smallest DNFs var smallest_cnf_size = 0x7FFF_FFFF for i in range(len(result_dnf)): var conjunction = result_dnf[i] var count = int(pop_count(conjunction)) if count < smallest_cnf_size: smallest_cnf_size = count var result_dnf_minimal = List[Scalar[T]]() for i in range(len(result_dnf)): var conjunction = result_dnf[i] var count = int(pop_count(conjunction)) if count == smallest_cnf_size: result_dnf_minimal.append(conjunction) return result_dnf_minimal # update the DNF one item at a time fn update_dnf_1[ T: DType ]( dnf: DTypePointer[T], dnf_length: Int, z: Scalar[T], begin_index: Int, inout index_to_delete: List[Int], ) -> Bool: for index in range(begin_index, dnf_length): var q = dnf[index] # var q = dnf.load(index) # seems slower... var p = z.__or__(q) if p == z: # z is subsumed under q: no need to add z return False elif p == q: # q is subsumed under z: add z and remove q index_to_delete.append(index) return True # update the DNF N items at a time fn update_dnf_N[ T: DType, SIZE: Int ]( dnf: DTypePointer[T], z: SIMD[T, SIZE], begin_index: Int, inout index_to_delete: List[Int], ) -> Bool: alias zeros = SIMD[DType.bool, SIZE](False) var q2: SIMD[T, SIZE] = dnf.load[width=SIZE]() var p2 = z.__or__(q2) var mask1 = p2 == z if mask1 != zeros: # z is subsumed under q: no need to add z return False var mask2 = p2 == q2 if mask2 != zeros: # q is subsumed under z: add z and remove q for i in range(SIZE): if mask2[i]: index_to_delete.append(begin_index + i) break return True return False fn update_dnf[ T: DType, N_BITS_BLOCK: Int = 0 ](inout dnf: List[Scalar[T]], z: SIMD[T, 1]): var index_to_delete = List[Int]() @parameter if N_BITS_BLOCK < 1: var ptr: DTypePointer[T] = DTypePointer[T](dnf.unsafe_ptr()) var add_z = update_dnf_1[T](ptr, len(dnf), z, 0, index_to_delete) if add_z: delete_indices[T, True](dnf, index_to_delete) dnf.append(z) return else: # NOTE: folling code is broken alias BLOCK_SIZE = 1 << N_BITS_BLOCK alias zeros = SIMD[DType.bool, BLOCK_SIZE](False) var size = len(dnf) var n_blocks: Int = size >> N_BITS_BLOCK # print("update_dnf: len(dnf)=" + str(len(dnf)) + "; n_blocks=" + str(n_blocks)) var z2 = SIMD[T, BLOCK_SIZE](z) # broadcast z to all positions in z2 var ptr: DTypePointer[T] = DTypePointer[T](dnf.unsafe_ptr()) var add_z = False for block in range(n_blocks): add_z = update_dnf_N[T, BLOCK_SIZE](ptr, z2, 0, index_to_delete) if add_z: break ptr += BLOCK_SIZE * T.sizeof() if not add_z: var start_tail_index = n_blocks << N_BITS_BLOCK add_z = update_dnf_1[T]( ptr, len(dnf), z, start_tail_index, index_to_delete ) if add_z: delete_indices[T, True](dnf, index_to_delete) dnf.append(z) --- main.mojo --- from time import now from TruthTable import TruthTable from cnf_to_dnf import convert_cnf_to_dnf_minimal, convert_cnf_to_dnf from unit_tests import run_all_unit_tests, test_compress_decompress from to_string import ( PrintType, cnf_to_string, dnf_to_string, ) fn cnf2dnf_bigtest_1[QUIET: Bool](): alias DT = DType.uint32 alias n_bits = 16 alias n_conjunctions = 500 alias n_disjunctions = 8 var cnf1 = List[Scalar[DT]]() for i in range(n_conjunctions): var conjunction: Scalar[DT] = 0 for j in range(n_disjunctions): var r = random.random_ui64(0, 0xFFFF_FFFF).cast[DT]() % n_bits conjunction |= 1 << r cnf1.append(conjunction) @parameter if not QUIET: print("CNF = " + cnf_to_string[DT](cnf1)) # var dnf1 = convert_cnf_to_dnf[DT, False](cnf1, n_bits) var dnf1 = convert_cnf_to_dnf_minimal[DT, True, False](cnf1, n_bits) @parameter if not QUIET: print("DNF = " + dnf_to_string[DT](dnf1)) fn cnf2dnf_bigtest_2[QUIET: Bool](): alias DT = DType.uint32 alias n_bits = 32 alias n_conjunctions = 20 alias n_disjunctions = 8 var cnf1 = List[Scalar[DT]]() for i in range(n_conjunctions): var conjunction: Scalar[DT] = 0 for j in range(n_disjunctions): var r = random.random_ui64(0, 0xFFFF_FFFF).cast[DT]() % n_bits conjunction |= 1 << r cnf1.append(conjunction) @parameter if not QUIET: print("CNF = " + cnf_to_string[DT](cnf1)) alias EARLY_PRUNE = True alias SHOW_INFO = False var dnf1 = convert_cnf_to_dnf_minimal[DT, EARLY_PRUNE, SHOW_INFO]( cnf1, n_bits ) @parameter if not QUIET: print("DNF = " + dnf_to_string[DT](dnf1)) fn cnf2dnf_bigtest_3[QUIET: Bool = False](): alias DT = DType.uint64 alias n_bits = 32 alias n_conjunctions = 10 alias n_disjunctions = 8 var cnf1 = List[Scalar[DT]]() for i in range(n_conjunctions): var conjunction: Scalar[DT] = 0 for j in range(n_disjunctions): var r = random.random_ui64(0, 0xFFFF_FFFF).cast[DT]() % n_bits conjunction |= 1 << r cnf1.append(conjunction) if not QUIET: print("CNF = " + cnf_to_string[DT](cnf1)) # var dnf1 = convert_cnf_to_dnf[DT, True](cnf1, n_bits) var dnf1 = convert_cnf_to_dnf_minimal[DT, True, False](cnf1, n_bits) if not QUIET: print("DNF = " + dnf_to_string[DT](dnf1)) # found very hard example when generating popcnt_6_3 fn cnf2dnf_bigtest_4[QUIET: Bool = False](): alias DT = DType.uint64 alias n_bits = 64 var cnf1 = List[Scalar[DT]]() cnf1.append(1 << 0 | 1 << 1 | 1 << 2 | 1 << 3) cnf1.append(1 << 4 | 1 << 5 | 1 << 6 | 1 << 7) cnf1.append(1 << 3 | 1 << 7 | 1 << 11) cnf1.append(1 << 8 | 1 << 9 | 1 << 10 | 1 << 11) cnf1.append(1 << 12 | 1 << 13 | 1 << 14 | 1 << 15) cnf1.append(1 << 2 | 1 << 15 | 1 << 19) cnf1.append(1 << 16 | 1 << 17 | 1 << 18 | 1 << 19) cnf1.append(1 << 10 | 1 << 18 | 1 << 22) cnf1.append(1 << 6 | 1 << 14 | 1 << 23) cnf1.append(1 << 20 | 1 << 21 | 1 << 22 | 1 << 23) cnf1.append(1 << 24 | 1 << 25 | 1 << 26 | 1 << 27) cnf1.append(1 << 1 | 1 << 27 | 1 << 31) cnf1.append(1 << 28 | 1 << 29 | 1 << 30 | 1 << 31) cnf1.append(1 << 9 | 1 << 30 | 1 << 34) cnf1.append(1 << 5 | 1 << 26 | 1 << 35) cnf1.append(1 << 32 | 1 << 33 | 1 << 34 | 1 << 35) cnf1.append(1 << 21 | 1 << 33 | 1 << 37) cnf1.append(1 << 17 | 1 << 29 | 1 << 38) cnf1.append(1 << 13 | 1 << 25 | 1 << 39) cnf1.append(1 << 36 | 1 << 37 | 1 << 38 | 1 << 39) cnf1.append(1 << 40 | 1 << 41 | 1 << 42 | 1 << 43) cnf1.append(1 << 0 | 1 << 43 | 1 << 47) cnf1.append(1 << 44 | 1 << 45 | 1 << 46 | 1 << 47) cnf1.append(1 << 8 | 1 << 46 | 1 << 50) cnf1.append(1 << 4 | 1 << 42 | 1 << 51) cnf1.append(1 << 48 | 1 << 49 | 1 << 50 | 1 << 51) cnf1.append(1 << 20 | 1 << 49 | 1 << 53) cnf1.append(1 << 16 | 1 << 45 | 1 << 54) cnf1.append(1 << 12 | 1 << 41 | 1 << 55) cnf1.append(1 << 52 | 1 << 53 | 1 << 54 | 1 << 55) cnf1.append(1 << 36 | 1 << 52 | 1 << 56) cnf1.append(1 << 32 | 1 << 48 | 1 << 57) cnf1.append(1 << 28 | 1 << 44 | 1 << 58) cnf1.append(1 << 24 | 1 << 40 | 1 << 59) cnf1.append(1 << 56 | 1 << 57 | 1 << 58 | 1 << 59) # CNF = (0 | 1 | 2 | 3) & (4 | 5 | 6 | 7) & (3 | 7 | 11) & (8 | 9 | 10 | 11) & (12 | 13 | 14 | 15) & (2 | 15 | 19) & (16 | 17 | 18 | 19) & (10 | 18 | 22) & (6 | 14 | 23) & (20 | 21 | 22 | 23) & (24 | 25 | 26 | 27) & (1 | 27 | 31) & (28 | 29 | 30 | 31) & (9 | 30 | 34) & (5 | 26 | 35) & (32 | 33 | 34 | 35) & (21 | 33 | 37) & (17 | 29 | 38) & (13 | 25 | 39) & (36 | 37 | 38 | 39) & (40 | 41 | 42 | 43) & (0 | 43 | 47) & (44 | 45 | 46 | 47) & (8 | 46 | 50) & (4 | 42 | 51) & (48 | 49 | 50 | 51) & (20 | 49 | 53) & (16 | 45 | 54) & (12 | 41 | 55) & (52 | 53 | 54 | 55) & (36 | 52 | 56) & (32 | 48 | 57) & (28 | 44 | 58) & (24 | 40 | 59) & (56 | 57 | 58 | 59) @parameter if not QUIET: print("CNF = " + cnf_to_string[DT](cnf1)) # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 2 of 35; result_dnf_next=16; n_pruned=0; n_not_prunned=48; max_size=35; smallest_cnf_size=2 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 3 of 35; result_dnf_next=37; n_pruned=0; n_not_prunned=64; max_size=35; smallest_cnf_size=3 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 4 of 35; result_dnf_next=148; n_pruned=0; n_not_prunned=148; max_size=35; smallest_cnf_size=4 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 5 of 35; result_dnf_next=175; n_pruned=0; n_not_prunned=444; max_size=34; smallest_cnf_size=4 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 6 of 35; result_dnf_next=403; n_pruned=0; n_not_prunned=700; max_size=34; smallest_cnf_size=5 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 7 of 35; result_dnf_next=547; n_pruned=0; n_not_prunned=1209; max_size=33; smallest_cnf_size=5 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 8 of 35; result_dnf_next=707; n_pruned=0; n_not_prunned=1641; max_size=32; smallest_cnf_size=5 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 9 of 35; result_dnf_next=1160; n_pruned=0; n_not_prunned=2828; max_size=32; smallest_cnf_size=6 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 10 of 35; result_dnf_next=4640; n_pruned=0; n_not_prunned=4640; max_size=32; smallest_cnf_size=7 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 11 of 35; result_dnf_next=6140; n_pruned=0; n_not_prunned=13920; max_size=31; smallest_cnf_size=7 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 12 of 35; result_dnf_next=14483; n_pruned=0; n_not_prunned=24560; max_size=31; smallest_cnf_size=8 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 13 of 35; result_dnf_next=21578; n_pruned=0; n_not_prunned=43449; max_size=30; smallest_cnf_size=8 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 14 of 35; result_dnf_next=31135; n_pruned=0; n_not_prunned=64734; max_size=29; smallest_cnf_size=8 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 15 of 35; result_dnf_next=51655; n_pruned=0; n_not_prunned=124540; max_size=29; smallest_cnf_size=9 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 16 of 35; result_dnf_next=84437; n_pruned=0; n_not_prunned=154965; max_size=28; smallest_cnf_size=9 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 17 of 35; result_dnf_next=134781; n_pruned=0; n_not_prunned=253311; max_size=27; smallest_cnf_size=9 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 18 of 35; result_dnf_next=209163; n_pruned=0; n_not_prunned=404343; max_size=27; smallest_cnf_size=10 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 19 of 35; result_dnf_next=272184; n_pruned=0; n_not_prunned=836652; max_size=26; smallest_cnf_size=1INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 20 of 35; result_dnf_next=1088736; n_pruned=0; n_not_prunned=1088736; max_size=26; smallest_cnf_size=11 # INFO: 5693ff80: convert_cnf_to_dnf_minimal: progress 21 of 35; result_dnf_next=1566900; n_pruned=0; n_not_prunned=3266208; max_size=25; smallest_cnf_size=11 alias EARLY_PRUNE = True alias SHOW_INFO = True var dnf1 = convert_cnf_to_dnf_minimal[DT, EARLY_PRUNE, SHOW_INFO]( cnf1, n_bits ) @parameter if not QUIET: print("DNF = " + dnf_to_string[DT](dnf1)) fn test_static_compress(): alias implicants = VariadicList( 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ) # example needs Petricks method; has no primary essential prime implicants alias TT1 = TruthTable[4](implicants, compress=False) print("TT1 = " + TT1.pretty_print_blif()) # static compression fails v0.7.0 # /__w/modular/modular/Kernels/mojo/stdlib/algorithm/sort.mojo:231:1: note: failed to interpret function @$stdlib::$algorithm::$sort::sort[$stdlib::$builtin::$dtype::DType]($stdlib::$collections::$vector::List[$stdlib::$builtin::$simd::SIMD[*(0,0), {1}]]&),_231x9_type=ui8 # /__w/modular/modular/Kernels/mojo/stdlib/algorithm/sort.mojo:244:15: note: failed to evaluate call # /__w/modular/modular/Kernels/mojo/stdlib/algorithm/sort.mojo:198:1: note: failed to interpret function @$stdlib::$algorithm::$sort::sort[$stdlib::$builtin::$dtype::DType]($stdlib::$memory::$unsafe::Pointer[$stdlib::$builtin::$simd::SIMD[*(0,0), {1}], {{0}}]&,$stdlib::$builtin::$int::Int),_198x9_type=ui8 # /__w/modular/modular/Kernels/mojo/stdlib/algorithm/sort.mojo:215:47: note: failed to evaluate call # /__w/modular/modular/Kernels/mojo/stdlib/algorithm/sort.mojo:94:1: note: failed to interpret function @$stdlib::$algorithm::$sort::_quicksort[AnyRegType,fn[AnyRegType]($0, $0, /) capturing -> $stdlib::$builtin::$bool::Bool]($stdlib::$memory::$unsafe::Pointer[*(0,0), {{0}}],$stdlib::$builtin::$int::Int),_95x5_type=scalar<ui8>,_95x23_cmp_fn=@"$stdlib::$algorithm::$sort::sort[$stdlib::$builtin::$dtype::DType]($stdlib::$memory::$unsafe::Pointer[$stdlib::$builtin::$simd::SIMD[*(0,0), {1}], {{0}}]&,$stdlib::$builtin::$int::Int)__less_than_equal[AnyRegType]($0,$0)"<:dtype ui8, :type ?> # /__w/modular/modular/Kernels/mojo/stdlib/algorithm/sort.mojo:100:60: note: failed to evaluate call # /__w/modular/modular/Kernels/mojo/stdlib/algorithm/sort.mojo:89:1: note: failed to interpret function @$stdlib::$algorithm::$sort::_estimate_initial_height($stdlib::$builtin::$int::Int) # /__w/modular/modular/Kernels/mojo/stdlib/algorithm/sort.mojo:91:51: note: failed to fold operation pop.call_llvm_intrinsic{fastmathFlags: #pop<fmf none>, intrin: "llvm.ctlz" : !kgen.string}(13 : index, #pop<simd false> : !pop.scalar<bool>) # mojo: error: failed to run the pass manager # alias TT2 = TruthTable[4](implicants, compress=True) # print("TT2 = " + TT2.pretty_print_blif()) fn main(): var start_time_ns = now() run_all_unit_tests[QUIET=True]() test_compress_decompress(n_tests=2000) # crash # test_static_compress() # crashes if you uncomment the static code... # cnf2dnf_bigtest_1[False]() # 2 seconds # cnf2dnf_bigtest_2[False]() # 2.6 seconds # cnf2dnf_bigtest_3[False]() # 0.006 seconds # cnf2dnf_bigtest_4[False]() # impossible large! eons # NOTE benchmark was removed from the language # benchmark.run[cnf2dnf_bigtest_1[True]]().print() # benchmark.run[cnf2dnf_bigtest_2[True]]().print() # benchmark.run[cnf2dnf_bigtest_3[True]]().print() var elapsed_time_ns = now() - start_time_ns print("Elapsed time " + str(elapsed_time_ns) + " ns", end="") print(" = " + str(Float32(elapsed_time_ns) / 1_000) + " μs", end="") print(" = " + str(Float32(elapsed_time_ns) / 1_000_000) + " ms", end="") print(" = " + str(Float32(elapsed_time_ns) / 1_000_000_000) + " s", end="") print(" = " + str(Float32(elapsed_time_ns) / 60_000_000_000) + " min") --- petrick.mojo --- from MyMap import MyMap from MySet import MySet from cnf_to_dnf import convert_cnf_to_dnf_minimal, convert_cnf_to_dnf from tools import get_bit, get_dk_offset, get_dk_mask from to_string import ( PrintType, minterm_to_string, minterms_to_string, cnf_to_string, dnf_to_string, ) # using PI_table_1 = std::map<PI, std::unordered_set<MT>>; # using PI_table_2 = std::map<MT, std::unordered_set<PI>>; fn convert_1to2[ PI: DType, MT: DType ](pi_table1: MyMap[PI, MySet[MT]]) -> MyMap[MT, MySet[PI]]: var all_minterms = MySet[MT]() for i in range(len(pi_table1)): all_minterms.add(pi_table1.values[i]) var pi_table2 = MyMap[MT, MySet[PI]]() for i in range(len(all_minterms)): var mt = all_minterms.data[i] var set2 = MySet[PI]() for j in range(len(pi_table1)): var x = pi_table1.keys[j] var set = pi_table1.values[j] if set.contains(mt): set2.add(x) pi_table2.add(mt, set2^) return pi_table2^ fn convert_2to1[ PI: DType, MT: DType ](pi_table2: MyMap[MT, MySet[PI]]) -> MyMap[PI, MySet[MT]]: return convert_1to2[MT, PI](pi_table2) fn create_prime_implicant_table[ PI: DType, MT: DType ](prime_implicants: MySet[PI], minterms: MySet[MT],) -> MyMap[PI, MySet[MT]]: alias DK_OFFSET: Int = get_dk_offset[PI]() alias DATA_MASK: SIMD[PI, 1] = get_dk_mask[PI]() var results = MyMap[PI, MySet[MT]]() for i in range(len(prime_implicants)): var pi: SIMD[PI, 1] = prime_implicants.data[i] var dont_know: SIMD[PI, 1] = (pi >> DK_OFFSET) var q: SIMD[PI, 1] = (DATA_MASK & pi) | dont_know # print("pi = " + minterm_to_string[PI, PrintType.BIN_VERBOSE](pi, 4) + "; dont_know=" + int_to_bin_string(dont_know, 4) +"; q = " + int_to_bin_string(q, 8)) var set = MySet[MT]() for j in range(len(minterms)): var mt: SIMD[MT, 1] = minterms.data[j] # print("mt = " + minterm_to_string[MT, PrintType.BIN_VERBOSE](mt, 4)) if (mt.cast[PI]() | dont_know) == q: # print("INFO: e03f53aa: create_prime_implicant_table: inserting mt " + minterm_to_string[MT, PrintType.BIN_VERBOSE](mt, 4) +"; " + int_to_bin_string(mt, 8)) set.add(mt) results.add(pi, set^) return results fn identify_primary_essential_pi2[ PI: DType, MT: DType ](pi_table2: MyMap[MT, MySet[PI]]) -> TmpStruct1[PI, MT]: # find distinguished row and selected primary essential implicants var selected_pi = MySet[PI]() var values = pi_table2.get_values() for i in range(len(values)): var pi_set: MySet[PI] = values[i] if len(pi_set) == 1: # we found a distinguished row / minterm mt selected_pi.add(pi_set.data[0]) var mt_to_be_deleted = List[SIMD[MT, 1]]() for i in range(len(pi_table2)): var mt: SIMD[MT, 1] = pi_table2.keys[i] var pi_set: MySet[PI] = pi_table2.values[i] for j in range(len(selected_pi)): var pi: SIMD[PI, 1] = selected_pi.data[j] if pi_set.contains(pi): mt_to_be_deleted.append(mt) break var result = TmpStruct1[PI, MT]() result.pi_table2 = pi_table2 for i in range(len(mt_to_be_deleted)): result.pi_table2.remove(mt_to_be_deleted[i]) for i in range(len(selected_pi)): result.essential_pi.append(selected_pi.data[i]) return result^ fn subset[T: DType](sub_set: MySet[T], super_set: MySet[T]) -> Bool: for i in range(len(sub_set)): if not super_set.contains(sub_set.data[i]): return False return True # Given two rows a and b in a reduced prime implicant table, a is said to dominate b, if a # has checks in all the columns in which b has checks and a and b are not interchangeable. # Two identical rows (columns) a and b of a reduced prime table are said to be interchangeable. fn row_dominance[ PI: DType, MT: DType ](pi_table2: MyMap[MT, MySet[PI]]) -> MyMap[MT, MySet[PI]]: var mt_to_be_deleted = MySet[MT]() for i in range(len(pi_table2)): var mt1 = pi_table2.keys[i] if not mt_to_be_deleted.contains(mt1): var pi_set1 = pi_table2.values[i] for j in range(len(pi_table2)): var mt2 = pi_table2.keys[j] if mt1 != mt2: var pi_set2 = pi_table2.values[j] if subset(pi_set1, pi_set2): mt_to_be_deleted.add(mt2) var pi_table1_out = pi_table2 for i in range(len(mt_to_be_deleted)): pi_table1_out.remove(mt_to_be_deleted.data[i]) return pi_table1_out # Given two columns a and b in a reduced prime implicant table, a is said to dominate b, if # a has checks in all the rows in which b has checks and a and b are not interchangeable. # Two identical rows (columns) a and b of a reduced prime table are said to be interchangeable. # eg prime implicant table: # 00X1 0X01 101X X011 # 1 = 0001 |XX.. # 3 = 0011 |X..X # 11 = 1011 |..XX # # cam be reduced based on column dominance to prime implicant table: # 00X1 X011 # 1 = 0001 |X. # 3 = 0011 |XX # 11 = 1011 |.X # # column 00X1 dominates column 0X01, thus column 0X01 can be removed, and X011 dominates 101X, # thus 101X can be removed. fn column_dominance[ PI: DType, MT: DType ](pi_table2: MyMap[MT, MySet[PI]]) -> MyMap[MT, MySet[PI]]: var pi_table1: MyMap[PI, MySet[MT]] = convert_2to1[PI, MT](pi_table2) var all_pi: List[SIMD[PI, 1]] = pi_table1.keys var pi_to_be_deleted = MySet[PI]() for i in range(len(all_pi)): var pi1: SIMD[PI, 1] = all_pi[i] var mt_set1: MySet[MT] = pi_table1.get(pi1) for j in range(i + 1, len(all_pi)): var pi2 = all_pi[j] var mt_set2: MySet[MT] = pi_table1.get(pi2) var q1: Bool = subset(mt_set1, mt_set2) var q2: Bool = subset(mt_set2, mt_set1) if q1 and q2: pass elif q1: # if pi1 dominates pi2, then remove pi2 pi_to_be_deleted.add(pi1) elif q2: pi_to_be_deleted.add(pi2) var result = pi_table2 for i in range(len(result)): result.values[i].remove(pi_to_be_deleted) return result fn petricks_method[ PI: DType, MT: DType, N_BITS: Int, SHOW_INFO: Bool ](pi_table2: MyMap[MT, MySet[PI]],) -> List[List[SIMD[PI, 1]]]: alias VT = DType.uint32 # variable Type # create translation to translate the pi table to a cnf var translation1 = MyMap[PI, SIMD[VT, 1]]() var translation2 = MyMap[VT, SIMD[PI, 1]]() var variable_id: SIMD[VT, 1] = 0 for i in range(len(pi_table2)): var mt: SIMD[MT, 1] = pi_table2.keys[i] var pi_set: MySet[PI] = pi_table2.values[i] for j in range(len(pi_set)): var pi: SIMD[PI, 1] = pi_set.data[j] if not translation1.contains(pi): translation1.add(pi, variable_id) translation2.add(variable_id, pi) variable_id += 1 # give an error if we have too many variables var n_variables = variable_id if n_variables > 64: print( "ERROR: too many variables (" + str(n_variables) + ") for cnf_to_dnf" ) # convert pi table to cnf alias Q = DType.uint64 var cnf = List[SIMD[Q, 1]]() for i in range(len(pi_table2)): var mt: SIMD[MT, 1] = pi_table2.keys[i] var pi_set: MySet[PI] = pi_table2.values[i] var disjunction: SIMD[Q, 1] = 0 for j in range(len(pi_set)): var pi: SIMD[PI, 1] = pi_set.data[j] var mt: SIMD[VT, 1] = translation1.get(pi) disjunction |= 1 << mt.cast[Q]() cnf.append(disjunction) # convert cnf to dnf @parameter if SHOW_INFO: print("INFO: dee2adb6: CNF = " + cnf_to_string[Q](cnf)) alias EARLY_PRUNE = True var smallest_conjunctions = convert_cnf_to_dnf_minimal[ Q, EARLY_PRUNE=EARLY_PRUNE, SHOW_INFO=SHOW_INFO ](cnf, int(n_variables)) @parameter if SHOW_INFO: print( "INFO: 756c1db8: DNF = " + dnf_to_string[Q](smallest_conjunctions) ) # translate the smallest conjunctions back var result = List[List[SIMD[PI, 1]]]() for i in range(len(smallest_conjunctions)): var conj: SIMD[Q, 1] = smallest_conjunctions[i] var x = List[SIMD[PI, 1]]() for j in range(Q.sizeof() * 8): if tools.get_bit[Q](conj, j): var key: SIMD[VT, 1] = SIMD[VT, 1](j) var pi: SIMD[PI, 1] = translation2.get(key) x.append(pi) result.append(x) return result struct TmpStruct1[PI: DType, MT: DType]: var pi_table2: MyMap[MT, MySet[PI]] var essential_pi: List[SIMD[PI, 1]] @always_inline("nodebug") fn __init__(inout self): self.pi_table2 = MyMap[MT, MySet[PI]]() self.essential_pi = List[SIMD[PI, 1]]() @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): self.pi_table2 = existing.pi_table2^ self.essential_pi = existing.essential_pi^ fn to_string_pi_table1[ N_BITS: Int, PI: DType, MT: DType ](pi_table1: MyMap[PI, MySet[MT]]) -> String: var all_mt_set = MySet[MT]() for i in range(len(pi_table1)): all_mt_set.add(pi_table1.values[i]) var all_mt = all_mt_set.data sort[MT](all_mt) var result: String = "\t" for i in range(len(pi_table1)): var pi = pi_table1.keys[i] result += minterm_to_string[PI, PrintType.BIN](pi, N_BITS) + " " result += "\n" for i in range(len(all_mt)): var mt = all_mt[i] var covered_by_prime_implicants = 0 var tmp: String = "" for j in range(len(pi_table1)): var mt_set = pi_table1.values[j] if mt_set.contains(mt): tmp += "X" covered_by_prime_implicants += 1 else: tmp += "." result += minterm_to_string[MT, PrintType.BIN](mt, N_BITS) if covered_by_prime_implicants == 1: result += "*" # found a distinguished row result += "\t|" + tmp + "\n" return result fn to_string_pi_table2[ N_BITS: Int, PI: DType, MT: DType ](pi_table2: MyMap[MT, MySet[PI]]) -> String: if len(pi_table2) == 0: return "EMPTY\n" var all_pi_set = MySet[PI]() var all_mt = List[SIMD[MT, 1]]() for i in range(len(pi_table2)): all_mt.append(pi_table2.keys[i]) all_pi_set.add(pi_table2.values[i]) var all_pi = all_pi_set.data sort[PI](all_pi) sort[MT](all_mt) var result: String = "\t\t " for i in range(len(all_pi)): result += minterm_to_string[PI, PrintType.BIN](all_pi[i], N_BITS) + " " result += "\n" for i in range(len(all_mt)): var mt = all_mt[i] var pi_set = pi_table2.get(mt) result += ( str(mt) + "\t = " + minterm_to_string[MT, PrintType.BIN](mt, N_BITS) + "\t|" ) for j in range(len(all_pi)): if pi_set.contains(all_pi[j]): result += "X" else: result += "." result += "\n" return result fn print_pi_table1_raw[ PI: DType, MT: DType, N_BITS: Int ](pi_table1: MyMap[PI, MySet[MT]]): for i in range(len(pi_table1)): var pi = pi_table1.keys[i] var mt_set = pi_table1.values[i] print(minterm_to_string[PI, PrintType.BIN](pi, N_BITS) + " -> ", end="") for j in range(len(mt_set)): print( minterm_to_string[MT, PrintType.BIN](mt_set.data[j], N_BITS) + " ", end="", ) print("") # petrick_simplify is the main entry point fn petrick_simplify[ PI: DType, MT: DType, N_BITS: Int, SHOW_INFO: Bool = True ](prime_implicants: MySet[PI], minterms: MySet[MT]) -> MySet[PI]: # 1] create prime implicant table var pi_table1: MyMap[PI, MySet[MT]] = create_prime_implicant_table[PI, MT]( prime_implicants, minterms ) # print_pi_table1_raw[PI, MT, N_BITS](pi_table1) @parameter if SHOW_INFO: print("1] created PI table:") print(to_string_pi_table1[N_BITS, PI, MT](pi_table1)) # 2] identify primary essential prime implicants var primary: TmpStruct1[PI, MT] = identify_primary_essential_pi2[PI, MT]( convert_1to2[PI, MT](pi_table1) ) # print_pi_table1_raw[MT, PI, N_BITS](primary.pi_table2) @parameter if SHOW_INFO: print("2] identified primary essential PIs:") print(to_string_pi_table2[N_BITS, PI, MT](primary.pi_table2)) # print_pi_table1_raw[MT, PI, N_BITS](primary.pi_table2) var pi_table3: MyMap[MT, MySet[PI]] = row_dominance[PI, MT]( primary.pi_table2 ) @parameter if SHOW_INFO: print("3] reduced based on row dominance:") print(to_string_pi_table2[N_BITS, PI, MT](pi_table3)) var pi_table4: MyMap[MT, MySet[PI]] = column_dominance[PI, MT](pi_table3) @parameter if SHOW_INFO: print("4] reduced based on column dominance:") print(to_string_pi_table2[N_BITS, PI, MT](pi_table4)) # identify secondary essential prime implicants var secondary: TmpStruct1[PI, MT] = identify_primary_essential_pi2[PI, MT]( pi_table4 ) @parameter if SHOW_INFO: print("5] identified secondary essential PIs:") print(to_string_pi_table2[N_BITS, PI, MT](secondary.pi_table2)) var pi_table6: MyMap[MT, MySet[PI]] = row_dominance[PI, MT]( secondary.pi_table2 ) @parameter if SHOW_INFO: print("6] reduced based on row dominance:") print(to_string_pi_table2[N_BITS, PI, MT](pi_table6)) var pi_table7: MyMap[MT, MySet[PI]] = column_dominance[PI, MT](pi_table6) @parameter if SHOW_INFO: print("7] reduced based on column dominance:") print(to_string_pi_table2[N_BITS, PI, MT](pi_table7)) var essential_pi = MySet[PI]() if len(pi_table7) > 0: # remaining problem is a cyclic covering problem: use petricks method to find minimal solutions var pi_vector_petricks: List[List[SIMD[PI, 1]]] = petricks_method[ PI, MT, N_BITS, SHOW_INFO ](pi_table7) # take the first from Petricks method, but it could be that alternatives can yield better machine instructions... if len(pi_vector_petricks) > 0: var x = pi_vector_petricks[0] for i in range(x.size): essential_pi.add[False](x[i]) @parameter if SHOW_INFO: print( "8] reduce with Petricks method: number essential PIs = " + str(len(essential_pi)) ) for i in range(len(pi_vector_petricks)): print( "Petricks yield: " + minterms_to_string[PI](pi_vector_petricks[i], N_BITS) ) else: var pi_set = MySet[PI]() for i in range(len(pi_table7)): pi_set.add[False](pi_table7.values[i]) for i in range(len(pi_set)): essential_pi.add[False](pi_set.data[i]) for i in range(len(primary.essential_pi)): essential_pi.add[False](primary.essential_pi[i]) @parameter if SHOW_INFO: print( "INFO: b650c460: adding primary essential PI to result: " + minterm_to_string[PI](primary.essential_pi[i], N_BITS) ) for i in range(len(secondary.essential_pi)): essential_pi.add[False](secondary.essential_pi[i]) @parameter if SHOW_INFO: print( "INFO: e2c83d65: adding secondary essential PI to result: " + minterm_to_string[PI](secondary.essential_pi[i], N_BITS) ) return essential_pi^ --- quine_mccluskey.mojo --- from collections.vector import InlinedFixedVector from bit import pop_count from MinTermSet import MinTermSet from petrick import petrick_simplify from to_string import PrintType, minterm_to_string, minterms_to_string from MySet import MySet from tools import get_dk_offset, eq_dynamic_vector fn crash(): var x = List[Int](0) var y = x[100000000] print(y) struct Checked[N_BITS: Int]: var data: InlinedFixedVector[DTypePointer[DType.bool], N_BITS + 1] fn __init__(inout self): self.data = InlinedFixedVector[DTypePointer[DType.bool], N_BITS + 1]( N_BITS + 1 ) fn at(self, bit_count: Int) -> DTypePointer[DType.bool]: debug_assert( bit_count < N_BITS + 1, "Checked:at: position 'bit_count' out of range", ) return self.data.__getitem__(bit_count) fn init(inout self, bit_count: Int, size: Int): debug_assert( bit_count < N_BITS + 1, "Checked:at: position 'bit_count' out of range", ) self.data[bit_count] = DTypePointer[DType.bool].alloc(size) for i in range(size): self.data[bit_count][i] = False fn is_gray_code[T: DType](a: SIMD[T, 1], b: SIMD[T, 1]) -> Bool: return pop_count(a ^ b) == 1 fn replace_complements[T: DType](a: SIMD[T, 1], b: SIMD[T, 1]) -> SIMD[T, 1]: alias dk_offset = get_dk_offset[T]() var neq = a ^ b return a | neq | (neq << dk_offset) fn reduce_minterms_CLASSIC[ T: DType, N_BITS: Int, SHOW_INFO: Bool ](minterms: MySet[T]) -> MySet[T]: alias P = PrintType.BIN @parameter if SHOW_INFO: print("INFO: 65525e46: entering reduce_minterms_CLASSIC") var total_comparisons = 0 var max = len(minterms) var checked = List[SIMD[DType.bool, 1]](max) for i in range(max): checked[i] = False var new_minterms = MySet[T]() for i in range(max): var term_i = minterms.data[i] for j in range(i + 1, max): @parameter if SHOW_INFO: total_comparisons += 1 var term_j = minterms.data[j] # If a gray code pair is found, replace the bit position that differs with a don't care. if is_gray_code(term_i, term_j): checked[i] = True checked[j] = True var new_mt = replace_complements[T](term_i, term_j) @parameter if SHOW_INFO: print( "INFO: 09f28d3a: term_i:" + minterm_to_string[T, P](term_i, N_BITS), end="", ) print( "; term_j:" + minterm_to_string[T, P](term_j, N_BITS), end="", ) print("; new_mt:" + minterm_to_string[T, P](new_mt, N_BITS)) new_minterms.add(new_mt) @parameter if SHOW_INFO: print("INFO: 393bb38d: total_comparisons = " + str(total_comparisons)) # appending all reduced terms to a new vector for i in range(max): if not checked[i]: @parameter if SHOW_INFO: print( "INFO: 6dc50c80: adding existing minterm:" + minterm_to_string[T, P](minterms.data[i], N_BITS) ) new_minterms.add(minterms.data[i]) new_minterms.sort() return new_minterms^ @always_inline("nodebug") fn reduce_minterms[ T: DType, N_BITS: Int, SHOW_INFO: Bool ](minterms: MinTermSet[T, N_BITS]) -> MinTermSet[T, N_BITS]: @parameter if SHOW_INFO: print("INFO: a0ab5759: entering: reduce_minterms") var total_comparisons: Int = 0 var new_minterms = MinTermSet[T, N_BITS]() var checked_X = Checked[N_BITS]() var max_bit_count = minterms.max_bit_count # print("INFO: 491ff4b6: max_bit_count=" + str(max_bit_count)) for bit_count in range(max_bit_count + 1): var max: Int = len(minterms.get(bit_count)) # print("INFO: f6241b1f: bit_count = " + str(bit_count) + "; max = " + str(max)) checked_X.init(bit_count, max) for bit_count in range(max_bit_count): var minterms_i = minterms.get(bit_count) var minterms_j = minterms.get(bit_count + 1) var max_i = len(minterms_i) var max_j = len(minterms_j) @parameter if SHOW_INFO: total_comparisons += max_i * max_j print( "INFO: 413d6ad8: max_i = " + str(max_i) + "; max_j = " + str(max_j) + "; total_comparisons = " + str(total_comparisons) ) # print("INFO: 5fa644ad: minterms_i: " + minterms_to_string[Self.MinTermType, 3](minterms_i, 10)) # print("INFO: 84923df6: minterms_j: " + minterms_to_string[T, 3](minterms_j, 10)) # print("\n\n") # print("minterms_i: " + minterms_to_string(minterms_i) + "\n") var checked_i = checked_X.at(bit_count) var checked_j = checked_X.at(bit_count + 1) for i in range(max_i): var term_i = minterms_i[i] for j in range(max_j): var term_j = minterms_j[j] # If a gray code pair is found, replace the bit position that differs with a don't care. if is_gray_code(term_i, term_j): checked_i[i] = True checked_j[j] = True var new_mt = replace_complements(term_i, term_j) @parameter if SHOW_INFO: print( "INFO: 09f28d3a: term_i:" + minterm_to_string[T](term_i, N_BITS), end="", ) print( "; term_j:" + minterm_to_string[T](term_j, N_BITS), end="", ) print( "; new_mt:" + minterm_to_string[T](new_mt, N_BITS) ) new_minterms.add(new_mt) @parameter if SHOW_INFO: print("INFO: 393bb38d: total_comparisons=" + str(total_comparisons)) # print("INFO: 0fa954e7: new_minterms=" + new_minterms.to_string[PrintType.BIN](N_BITS)) for bit_count in range(max_bit_count + 1): var checked_i = checked_X.at(bit_count) var minterms_i = minterms.get(bit_count) for i in range(len(minterms_i)): if not checked_i[i]: new_minterms.add(minterms_i[i]) new_minterms.sort() return new_minterms fn reduce_qm_classic[ T: DType, N_BITS: Int, SHOW_INFO: Bool ](owned minterms_input: MySet[T]) -> MySet[T]: var minterms = minterms_input var iteration: Int = 0 var fixed_point: Bool = False while not fixed_point: var next_minterms = reduce_minterms_CLASSIC[T, N_BITS, SHOW_INFO]( minterms ) @parameter if SHOW_INFO: print( "INFO: 361a49a4: reduce_qm: iteration " + str(iteration) + "; minterms " + str(len(minterms)) + "; next minterms " + str(len(next_minterms)) ) print( "INFO: 49ecfd1e: old minterms = " + minterms_to_string[T](minterms.data, N_BITS) ) print( "INFO: ed11b7c0: new minterms = " + minterms_to_string[T](next_minterms.data, N_BITS) ) iteration += 1 # both are sorted, minterms is not sorted the first iteration, but that is ok. fixed_point = minterms == next_minterms minterms = next_minterms^ return petrick_simplify[T, T, N_BITS, SHOW_INFO](minterms, minterms_input) fn reduce_qm[ T: DType, N_BITS: Int, SHOW_INFO: Bool ](owned minterms_input: MySet[T]) -> MySet[T]: var iteration: Int = 0 var fixed_point: Bool = False var minterms = MinTermSet[T, N_BITS]() for i in range(len(minterms_input)): minterms.add[CHECK_CONTAINS=False, SHOW_INFO=SHOW_INFO]( minterms_input.data[i] ) minterms.sort() while not fixed_point: var next_minterms = reduce_minterms[T, N_BITS, SHOW_INFO](minterms) @parameter if SHOW_INFO: print( "INFO: 361a49a4: reduce_qm: iteration " + str(iteration) + "; minterms " + str(len(minterms)) + "; next minterms " + str(len(next_minterms)) ) print( "INFO: 49ecfd1e: old minterms = " + minterms.to_string[PrintType.BIN](N_BITS) ) print( "INFO: ed11b7c0: new minterms = " + next_minterms.to_string[PrintType.BIN](N_BITS) ) iteration += 1 fixed_point = minterms == next_minterms minterms = next_minterms^ return petrick_simplify[T, T, N_BITS, SHOW_INFO]( minterms.to_set(), minterms_input ) --- to_string.mojo --- from tools import get_bit, get_dk_offset from MySet import MySet, MySetStr @register_passable("trivial") struct PrintType(Stringable): var value: Int alias VERBOSE = PrintType(0) alias HEX = PrintType(1) alias BIN = PrintType(2) alias BIN_VERBOSE = PrintType(3) fn __eq__(self: Self, other: PrintType) -> Bool: return self.value == other.value fn __init__(value: Int) -> Self: return Self {value: value} fn __str__(self) -> String: if self == PrintType.VERBOSE: return "VERBOSE" elif self == PrintType.HEX: return "HEX" elif self == PrintType.BIN: return "BIN" elif self == PrintType.BIN_VERBOSE: return "BIN_VERBOSE" else: return "UNKNOWN" fn vector_to_string(v: List[Int]) -> String: var result: String = "" for i in range(len(v)): result += str(v[i]) return result fn cnf_to_string[T: DType](cnf: List[Scalar[T]]) -> String: return cnf_dnf_to_string[T, True](cnf) fn cnf_to_string2(cnf: List[List[String]]) -> String: return cnf_dnf_to_string2[True](cnf) fn dnf_to_string[T: DType](dnf: List[Scalar[T]]) -> String: return cnf_dnf_to_string[T, False](dnf) fn dnf_to_string2(dnf: List[List[String]]) -> String: return cnf_dnf_to_string2[False](dnf) fn cnf_dnf_to_string[T: DType, IS_CNF: Bool](cnf: List[Scalar[T]]) -> String: alias N_BITS = T.sizeof() * 8 var cnf_copy = cnf sort[T](cnf_copy) var result: String = "" var first_disj = True for i in range(cnf_copy.size): var disj = cnf_copy[i] if first_disj: first_disj = False else: if IS_CNF: result += "&" else: result += "|" result += " (" var first_e = True for pos in range(N_BITS): if get_bit(disj, pos): if first_e: first_e = False else: if IS_CNF: result += "|" else: result += "&" result += str(pos) result += ") " return result.strip() fn cnf_dnf_to_string2[IS_CNF: Bool](cnf: List[List[String]]) -> String: var conjunctions = MySetStr() for i in range(cnf.size): var conj = cnf[i] # sort[String](conj) # TODO cannot sort String in v0.6.1 var s: String = " (" var first = True for j in range(conj.size): if first: first = False else: if IS_CNF: s += "|" else: s += "&" s += conj[j] s += ") " conjunctions.add(s^) var result: String = "" var first = True for i in range(len(conjunctions)): if first: first = False else: if IS_CNF: result += "&" else: result += "|" result += conjunctions.data[i] return result fn minterms_to_string[ T: DType, P: PrintType = PrintType.BIN, CAP: Int = 0 ](minterms: List[SIMD[T, 1]], n_vars: Int) -> String: var result: String = "" var cap2 = CAP if CAP == 0: cap2 = 0xFFFF_FFFF # something large var s = min(len(minterms), cap2) for i in range(s): result += minterm_to_string[T, P](minterms[i], n_vars) @parameter if P == PrintType.VERBOSE: result += "\n" else: result += " " if len(minterms) > s: result += "..." return result fn minterm_to_string[ T: DType, P: PrintType = PrintType.BIN ](mt: SIMD[T, 1], n_bits: Int) -> String: @parameter if P == PrintType.BIN: return minterm_to_bin_string(mt, n_bits) elif P == PrintType.BIN_VERBOSE: return ( minterm_to_bin_string(mt, n_bits) + " (" + int_to_bin_string(mt, n_bits * 2) + ")" ) elif P == PrintType.VERBOSE: return minterm_to_bin_string(mt, n_bits) + "=" + str(mt) else: return "ERROR" fn minterm_to_bin_string[T: DType](mt: SIMD[T, 1], n_bits: Int) -> String: alias dk_offset: Int = get_dk_offset[T]() # print("INFO minterm_to_bin_string dk_offset "+str(dk_offset)) var result: String = "" for i in range(n_bits): var pos = (n_bits - i) - 1 # traverse in backwards order var pos_X = pos + dk_offset # print("pos "+str(pos)+"; pos_X " + str(pos_X)) if tools.get_bit(mt, pos_X): result += "X" elif tools.get_bit(mt, pos): result += "1" else: result += "0" return result fn int_to_bin_string[T: DType](v: SIMD[T, 1], n_bits: Int) -> String: var result: String = "" for i in range(n_bits): var pos = (n_bits - i) - 1 # traverse in backwards order if tools.get_bit(v, pos): result += "1" else: result += "0" return result --- tools.mojo --- fn get_bit[T: DType](v: Scalar[T], pos: Int) -> Bool: return ((v >> pos).__and__(1)) == 1 fn set_bit[T: DType](v: Scalar[T], pos: Int) -> Scalar[T]: return v.__or__(Scalar[T](1) << pos) fn clear_bit[T: DType](v: Scalar[T], pos: Int) -> Scalar[T]: return v.__and__((Scalar[T](1) << pos).__invert__()) fn get_minterm_type[bit_width: Int]() -> DType: @parameter if bit_width <= 4: return DType.uint8 elif bit_width <= 8: return DType.uint16 elif bit_width <= 16: return DType.uint32 elif bit_width <= 32: return DType.uint64 else: constrained[False]() return DType.uint64 fn get_dk_offset[T: DType]() -> Int: alias n_bytes = T.sizeof() @parameter if n_bytes == 1: return 4 elif n_bytes == 2: return 8 elif n_bytes == 4: return 16 elif n_bytes == 8: return 32 else: constrained[False]() return 32 fn get_dk_mask[T: DType]() -> Scalar[T]: alias n_bytes = T.sizeof() @parameter if n_bytes == 1: return 0xF elif n_bytes == 2: return 0xFF elif n_bytes == 4: return 0xFFFF elif n_bytes == 8: return 0xFFFF_FFFF else: constrained[False]() return 0xFFFF_FFFF # delete index by moving the last element into the deleted index fn delete_index[T: DType](inout v: List[Scalar[T]], idx: Int): var s = v.size if idx == s - 1: _ = v.pop() else: v[idx] = v.pop() fn delete_indices[ T: DType, idx_sorted: Bool = False ](inout v: List[Scalar[T]], inout indices: List[Int]): var i_size = indices.size @parameter if not idx_sorted: sort(indices) for i in range(i_size): var j = (i_size - i) - 1 delete_index[T](v, indices[j]) fn eq_dynamic_vector[ T: DType ](v1: List[Scalar[T]], v2: List[Scalar[T]]) -> Bool: if len(v1) != len(v2): return False for i in range(len(v1)): if v1[i] != v2[i]: return False return True # fn my_cast[T: DType, SIZE: Int](v: List[SIMD[T, SIZE]]) -> DTypePointer[T]: # return rebind[DTypePointer[T]](v.data.value) --- unit_tests.mojo --- from random import random_ui64 from TruthTable import TruthTable from MySet import MySet from cnf_to_dnf import convert_cnf_to_dnf_minimal, convert_cnf_to_dnf from to_string import ( PrintType, minterms_to_string, cnf_to_string, dnf_to_string, ) fn run_all_unit_tests[QUIET: Bool](): truth_table_test1[QUIET]() truth_table_test2[QUIET]() truth_table_test3[QUIET]() truth_table_test4[QUIET]() truth_table_test5[QUIET]() truth_table_test6[QUIET]() test_cnf2dnf_0[QUIET]() test_cnf2dnf_1[QUIET]() fn truth_table_test1[QUIET: Bool](): var tt = TruthTable[3]() tt.set_true(0b011) tt.set_true(0b100) tt.set_true(0b101) tt.set_true(0b110) tt.set_true(0b111) # uncompressed: # ABC ->F0 # 011 -> 1 # 100 -> 1 # 101 -> 1 # 110 -> 1 # 111 -> 1 # # compressed: # ABC ->F0 # X11 -> 1 # 1XX -> 1 tt.sort() var data1 = tt.data if not QUIET: print("original: " + tt.to_string[PrintType.BIN]()) tt.compress[USE_CLASSIC_METHOD=False, SHOW_INFO=False]() if not QUIET: print("compressed: " + tt.to_string[PrintType.BIN]()) tt.decompress() var data2 = tt.data if not QUIET: print("decompressed: " + tt.to_string[PrintType.BIN]() + "\n") if data1 != data2: print("ERROR UT: truth_table_test1: NOT EQUAL!") # example needs Petricks method; has no primary essential prime implicants fn truth_table_test2[QUIET: Bool](): alias N_BITS = 4 var tt = TruthTable[N_BITS]() alias implicants = VariadicList( 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ) # example needs Petricks method; has no primary essential prime implicants for i in range(len(implicants)): tt.set_true(implicants[i]) # ABCD # 0: 0000 -> 1 # 1: 0001 -> 0 # 2: 0010 -> 1 # 3: 0011 -> 1 # 4: 0100 -> 1 # 5: 0101 -> 1 # 6: 0110 -> 1 # 7: 0111 -> 1 # 8: 1000 -> 1 # 9: 1001 -> 1 # 10: 1010 -> 1 # 11: 1011 -> 1 # 12: 1100 -> 1 # 13: 1101 -> 1 # 14: 1110 -> 0 # 15: 1111 -> 0 tt.sort() var data1 = tt.data if not QUIET: print("original: " + tt.to_string[PrintType.BIN]()) tt.compress[USE_CLASSIC_METHOD=False, SHOW_INFO=False]() if not QUIET: print("compressed: " + tt.to_string[PrintType.BIN]()) tt.decompress() var data2 = tt.data if not QUIET: print("decompressed: " + tt.to_string[PrintType.BIN]() + "\n") if data1 != data2: print("ERROR UT: truth_table_test2: NOT EQUAL!") # (x̄3x̄0), (x̄3x1), (x2x̄1), (x3x̄2) // manually checked with https://www.mathematik.uni-marburg.de/~thormae/lectures/ti1/code/qmc/ # 0XX0 0X1X X10X 10XX : identical with observed # A'D' + A'C + BC' + AB' // result from http://www.32x8.com/var4.html # 0XX0 0X1X X10X 10XX : identical with observed # A~B + ~C~D + ~AC + B~C // result from https://ictlab.kz/extra/Kmap/ # 10XX XX00 0X1X X10X : NOT identical with thormae # A' B + B' C + A C' + C' D' // result from logic Friday # 01XX X01X 1X0X XX00 ??? mess: not sure what causes this # 10XX X10X 0X1X XX11 fn truth_table_test3[QUIET: Bool](): alias N_BITS = 4 var tt = TruthTable[N_BITS]() alias implicants = VariadicList( 0, 2, 5, 6, 7, 8, 10, 12, 13, 14, 15 ) # has primary essential prime implicants; Petricks method is not needed for i in range(len(implicants)): tt.set_true(implicants[i]) # ABCD # 0: 0000 -> 1 # 1: 0001 -> 0 # 2: 0010 -> 1 # 3: 0011 -> 0 # 4: 0100 -> 0 # 5: 0101 -> 1 # 6: 0110 -> 1 # 7: 0111 -> 1 # 8: 1000 -> 1 # 9: 1001 -> 0 # 10: 1010 -> 1 # 11: 1011 -> 0 # 12: 1100 -> 1 # 13: 1101 -> 1 # 14: 1110 -> 1 # 15: 1111 -> 1 tt.sort() var data1 = tt.data if not QUIET: print("original: " + tt.to_string[PrintType.BIN]()) tt.compress[USE_CLASSIC_METHOD=True, SHOW_INFO=False]() if not QUIET: print("compressed: " + tt.to_string[PrintType.BIN]()) tt.decompress() var data2 = tt.data if not QUIET: print("decompressed: " + tt.to_string[PrintType.BIN]() + "\n") if data1 != data2: print("ERROR UT: truth_table_test3: NOT EQUAL!") # (x̄2x̄0) ∨ (x2x0) ∨ (x1x̄0) ∨ (x3x̄0) // manually checked with https://www.mathematik.uni-marburg.de/~thormae/lectures/ti1/code/qmc/ # X0X0 X1X1 XX10 1XX0 # C~D + BD + A~D + ~B~D // result from https://ictlab.kz/extra/Kmap/ # XX10 X1X1 1XX0 X0X0 : identical with thormae # B'D' + CD' + BD + AD' // result from http://www.32x8.com/var4.html # X0X0 XX10 X1X1 1XX0 : identical with thormae # B D + B' D' + A D' + C D' // result from logic Friday # X1X1 X0X0 1XX0 XX10 : identical with thormae fn truth_table_test4[QUIET: Bool](): var tt = TruthTable[8]() tt.set_true(0b11100111) tt.set_true(0b11100001) tt.set_true(0b01100001) tt.set_true(0b00100001) tt.sort() var data1 = tt.data if not QUIET: print("original: " + tt.to_string[PrintType.BIN]()) tt.compress[SHOW_INFO=False]() if not QUIET: print("compressed: " + tt.to_string[PrintType.BIN]()) tt.decompress() var data2 = tt.data if not QUIET: print("decompressed: " + tt.to_string[PrintType.BIN]() + "\n") if data1 != data2: print("ERROR UT: truth_table_test4: NOT EQUAL!") # bug: fixed! fn truth_table_test5[QUIET: Bool](): alias implicants = VariadicList( 0b0001, 0b0011, 0b0101, 0b1000, 0b1010, 0b1011, 0b1101 ) var tt = TruthTable[4]() for i in range(len(implicants)): tt.set_true(implicants[i]) tt.sort() var data1 = tt.data if not QUIET: print("original: " + tt.to_string[PrintType.BIN]()) tt.compress[USE_CLASSIC_METHOD=False, SHOW_INFO=False]() if not QUIET: print("compressed: " + tt.to_string[PrintType.BIN]()) tt.decompress() var data2 = tt.data if not QUIET: print("decompressed: " + tt.to_string[PrintType.BIN]() + "\n") if data1 != data2: print("ERROR UT: truth_table_test5: NOT EQUAL!") # y = (x3x̄2x̄0) ∨ (x2x̄1x0) ∨ (x̄3x̄2x0) ∨ (x̄2x1x0) # y = 10X0 X101 00X1 X011 # http://www.32x8.com/qmm4_____A-B-C-D_____m_1-3-5-8-10-11-13___________option-4_____988791976079822295658 # y = A'B'D + B'CD + BC'D + AB'D' # y = 00X1 X011 X101 10X0 # old c++ code: # y = A'B'D + AB'D' + B'CD + BC'D # y = 00X1 10X0 X011 X101 # obs mojo: 101X 10X0 0X01 X101 # obs c++ : 10X0 X101 0X01 101X # bug: fixed! fn truth_table_test6[QUIET: Bool](): var tt = TruthTable[4]() tt.set_true(0b0000) tt.set_true(0b0010) tt.set_true(0b0011) tt.set_true(0b0100) tt.set_true(0b0101) tt.set_true(0b0110) tt.set_true(0b1011) tt.set_true(0b1111) tt.sort() var data1 = tt.data if not QUIET: print("original: " + tt.to_string[PrintType.BIN]()) tt.compress[USE_CLASSIC_METHOD=True, SHOW_INFO=False]() if not QUIET: print("compressed: " + tt.to_string[PrintType.BIN]()) tt.decompress() var data2 = tt.data if not QUIET: print("decompressed: " + tt.to_string[PrintType.BIN]() + "\n") if data1 != data2: print("ERROR UT: truth_table_test6: NOT EQUAL!") # y = (x3x̄2x̄0) ∨ (x2x̄1x0) ∨ (x̄3x̄2x0) ∨ (x̄2x1x0) # y = 10X0 X101 00X1 X011 # http://www.32x8.com/qmm4_____A-B-C-D_____m_1-3-5-8-10-11-13___________option-4_____988791976079822295658 # y = A'B'D + B'CD + BC'D + AB'D' # y = 00X1 X011 X101 10X0 # old c++ code: # y = A'B'D + AB'D' + B'CD + BC'D # y = 00X1 10X0 X011 X101 # obs mojo: 101X 10X0 0X01 X101 # obs c++ : 10X0 X101 0X01 101X fn test_compress_decompress(n_tests: Int = 1): fn test_compress_decompress_1x[N_BITS: Int](n_minterms: Int) -> Bool: alias MAX_MINTERM = (1 << N_BITS) - 1 var tt1 = TruthTable[N_BITS]() var tt2 = TruthTable[N_BITS]() alias P = PrintType.BIN var minterm_set = MySet[tt1.MinTermType]() for i in range(n_minterms): minterm_set.add(random_ui64(0, MAX_MINTERM).cast[tt1.MinTermType]()) for i in range(len(minterm_set)): tt1.set_true(int(minterm_set.data[i])) tt2.set_true(int(minterm_set.data[i])) tt1.sort() var minterms_1a = tt1.data tt1.compress[USE_CLASSIC_METHOD=True]() var minterms_2a = tt1.data tt1.decompress() var minterms_3a = tt1.data tt2.sort() var minterms_1b = tt2.data tt2.compress[USE_CLASSIC_METHOD=False]() var minterms_2b = tt2.data tt2.decompress() var minterms_3b = tt2.data var error = False # if not tools.eq_dynamic_vector[tt1.MinTermType](minterms_2a, minterms_2b): # print("methods do not give equal results: minterms_2a != minterms_2b") # print("minterms_2a:" + minterms_to_string[tt1.MinTermType, P](minterms_2a, N_BITS)) # print("minterms_2b:" + minterms_to_string[tt1.MinTermType, P](minterms_2b, N_BITS)) # error = True if not (minterms_1a == minterms_3a): print( "ERROR UT: decompression failed: minterms_1a != minterms_3a;" " N_BITS=" + str(N_BITS) ) print( "minterms_1a:" + minterms_to_string[tt1.MinTermType, P]( minterms_1a.data, N_BITS ) ) print( "minterms_3a:" + minterms_to_string[tt1.MinTermType, P]( minterms_3a.data, N_BITS ) ) print( "minterms_2a:" + minterms_to_string[tt1.MinTermType, P]( minterms_2a.data, N_BITS ) ) error = True if not (minterms_1b == minterms_3b): print( "ERROR UT: decompression failed: minterms_1b != minterms_3b;" " N_BITS=" + str(N_BITS) ) print( "minterms_1b:" + minterms_to_string[tt1.MinTermType, P]( minterms_1b.data, N_BITS ) ) print( "minterms_3b:" + minterms_to_string[tt1.MinTermType, P]( minterms_3b.data, N_BITS ) ) print( "minterms_2b:" + minterms_to_string[tt1.MinTermType, P]( minterms_2b.data, N_BITS ) ) error = True return error for i in range(n_tests): var n_minterms = int(random_ui64(1, 50)) if test_compress_decompress_1x[2](n_minterms): return if test_compress_decompress_1x[3](n_minterms): return if test_compress_decompress_1x[4](n_minterms): return if test_compress_decompress_1x[5](n_minterms): return if test_compress_decompress_1x[6](n_minterms): return if test_compress_decompress_1x[7](n_minterms): return if test_compress_decompress_1x[8](n_minterms): return if test_compress_decompress_1x[9](n_minterms): return if test_compress_decompress_1x[10](n_minterms): return if test_compress_decompress_1x[11](n_minterms): return if (i & 0xFF) == 0: print( "INFO UT: test_compress_decompress: progress " + str(i) + "/" + str(n_tests) ) fn cnf2dnf_check[ T: DType, QUIET: Bool ]( name: String, cnf: List[SIMD[T, 1]], expected_CNF: String, dnf1: List[SIMD[T, 1]], expected_DNF1: String, dnf2: List[SIMD[T, 1]], expected_DNF2: String, ): var observed_CNF = cnf_to_string[T](cnf) var observed_DNF1 = dnf_to_string[T](dnf1) var observed_DNF2 = dnf_to_string[T](dnf2) if observed_CNF != expected_CNF: print("ERROR UT: " + name) print("observed_CNF='" + observed_CNF + "'") print("expected_CNF='" + expected_CNF + "'") if observed_DNF1 != expected_DNF1: print("ERROR UT: " + name) print("observed_DNF1='" + observed_DNF1 + "'") print("expected_DNF1='" + expected_DNF1 + "'") if observed_DNF2 != expected_DNF2: print("ERROR UT: " + name) print("observed_DNF2='" + observed_DNF2 + "'") print("expected_DNF2='" + expected_DNF2 + "'") if not QUIET: print("INFO UT: " + name + ": observed_CNF=" + observed_CNF) print("INFO UT: " + name + ": expected_CNF=" + expected_CNF) print("INFO UT: " + name + ": observed_DNF1=" + observed_DNF1) print("INFO UT: " + name + ": expected_DNF1=" + expected_DNF1) print("INFO UT: " + name + ": observed_DNF2=" + observed_DNF2) print("INFO UT: " + name + ": expected_DNF2=" + expected_DNF2) print("") # CNF = (1|2) & (3|4) # DNF = (1&3) | (2&3) | (1&4) | (2&4) fn test_cnf2dnf_0[QUIET: Bool](): alias T = DType.uint32 alias N_BITS = 8 var cnf = List[SIMD[T, 1]]() cnf.append((1 << 1) | (1 << 2)) cnf.append((1 << 3) | (1 << 4)) var dnf1 = convert_cnf_to_dnf[T, SHOW_INFO=False](cnf, N_BITS) var dnf2 = convert_cnf_to_dnf_minimal[T, EARLY_PRUNE=True, SHOW_INFO=False]( cnf, N_BITS ) var expected_CNF = "(1|2) & (3|4)" var expected_DNF1 = "(1&3) | (2&3) | (1&4) | (2&4)" var expected_DNF2 = "(1&3) | (2&3) | (1&4) | (2&4)" cnf2dnf_check[T, QUIET]( "test_cnf2dnf_0", cnf, expected_CNF, dnf1, expected_DNF1, dnf2, expected_DNF2, ) # CNF = (1|2) & (1|3) & (3|4) & (2|5) & (4|6) & (5|6) # DNF = (1&4&5) | (2&3&4&5) | (2&3&6) | (1&2&4&6) | (1&3&5&6) fn test_cnf2dnf_1[QUIET: Bool](): alias T = DType.uint32 alias N_BITS = 8 var cnf = List[SIMD[T, 1]]() cnf.append((1 << 1) | (1 << 2)) cnf.append((1 << 3) | (1 << 4)) cnf.append((1 << 1) | (1 << 3)) cnf.append((1 << 5) | (1 << 6)) cnf.append((1 << 2) | (1 << 5)) cnf.append((1 << 4) | (1 << 6)) # answer according to wolfram: # abdf acef ade bcde bcf # 145 1246 1356 2345 236 # DNF = (145) & (2345) & (236) & (1246) & (1356) # DNF (x1 || x2) && (x1 || x3) && (x3 || x4) && (x2 || x5) && (x4 || x6) && (x5 || x6) var dnf1 = convert_cnf_to_dnf[T, SHOW_INFO=False](cnf, N_BITS) var dnf2 = convert_cnf_to_dnf_minimal[T, EARLY_PRUNE=True, SHOW_INFO=False]( cnf, N_BITS ) var expected_CNF = "(1|2) & (1|3) & (3|4) & (2|5) & (4|6) & (5|6)" var expected_DNF1 = "(1&4&5) | (2&3&4&5) | (2&3&6) | (1&2&4&6) | (1&3&5&6)" var expected_DNF2 = "(1&4&5) | (2&3&6)" cnf2dnf_check[T, QUIET]( "test_cnf2dnf_1", cnf, expected_CNF, dnf1, expected_DNF1, dnf2, expected_DNF2, ) --- .github/workflows/test.yml --- name: Run Tests on: ["push"] jobs: test: runs-on: ubuntu-22.04 steps: - name: Check out repository code uses: actions/checkout@v2 - name: Install dependencies run: | curl https://get.modular.com | sh - modular auth ${{ secrets.MODULAR_AUTH }} modular install --install-version 24.4.0 mojo pip install . - name: Integration Tests run: | export MODULAR_HOME="/home/runner/.modular" export PATH="/home/runner/.modular/pkg/packages.modular.com_mojo/bin:$PATH" export PYTHONPATH=/home/runner/work/mojo-pytest/mojo-pytest/example_src make test --- .gitignore --- .vscode/ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ --- LICENSE --- MIT License Copyright (c) 2024 Alex G Rice Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- Makefile --- .PHONY: test test: pwd mojo --version # run tests for example_src/ project (they should all pass) pytest --mojo-include example_src/ example_tests/ > pytest.out cat pytest.out # check test collection (this count needs to be updated manually when tests are updated) grep "collected 6 items" pytest.out --- README.md --- # mojo-pytest [![Run Tests](https://github.com/guidorice/mojo-pytest/actions/workflows/test.yml/badge.svg)](https://github.com/guidorice/mojo-pytest/actions/workflows/test.yml) [Mojo🔥](https://github.com/modularml/mojo) language test runner plugin for [pytest](https://docs.pytest.org). Try it for your mixed Python and Mojo codebases! ## Design This package implements a `pytest` plugin to discover and run Mojo tests, alongside your Python tests. Although `pytest` does not have any awareness of Mojo source or package structure, `pytest` is extensible. In summary, `plugin.py` calls `mojo test` in a sub-process and parses the outputs and exit codes. ## Usage 1. Create your Mojo tests according to the manual: https://docs.modular.com/mojo/tools/testing . 2. Install `pytest` and `pytest-mojo` plugin using the [pyproject](./pyproject.toml) file: ```shell # (optional) create and activate a virtualenv python3 -m venv venv/ source venv/bin/activate # install from github pip install git+https://github.com/guidorice/mojo-pytest.git # or install from cloned repository pip install . # verify pytest and the Mojo plugin are installed pytest --version pip show pytest-mojo ``` 3. See the example project for one possible filesystem layout: - `example_src/` has it's tests in the `example_tests/` folder. - Remember the [Mojo manual](https://docs.modular.com/mojo/tools/testing) explains that tests are allowed to be in the same folder as Mojo code, or different folder, or even as Mojo code in docstrings! So this example project is just one possibility. 4. Mojo tests and Python tests are all run via `pytest`! Use the plugin's `--mojo-include` option to include your Mojo packages. ```shell # this example_src/ contains a Python package which is also called from Mojo, # so we must add it using PYTHONPATH. Please note that the full path may be required! $ export PYTHONPATH=/Users/you/project/example_src/ # Use the plugin's --mojo-include option to tell mojo where to find `my_package` $ pytest --mojo-include example_src/ example_tests/ ================================ test session starts ================================ platform darwin -- Python 3.11.9, pytest-8.2.2, pluggy-1.5.0 rootdir: /Users/you/project plugins: mojo-24.4.0 collected 6 items example_tests/my_package/my_test.mojo . [ 16%] example_tests/my_package/test_fibonacci.mojo .. [ 50%] example_tests/my_package/test_fibonacci.py . [ 66%] example_tests/my_package/test_fire.🔥 . [ 83%] example_tests/my_package/test_random_tensor.mojo . [100%] ================================= 6 passed in 6.47s ================================= ``` 👆🏽 Notice how your Python tests are run alongside your mojo tests. 5. Mojo binary packages are also supported with `--mojo-include`. For example, this could be used in a CI/CD script: ```shell $ mojo package example_src/my_package -o build/my_package.mojopkg # or .📦 $ pytest --mojo-include build/ example_tests/ ... ... (same pytest output as above) ... ``` See also, the [pytest docs](https://docs.pytest.org) for many more options. ## Example Project In the `example_src/` directory is a Mojo package with a couple of modules. There is also a Python module, which we call in two ways (from `pytest`, and from Mojo). Here is an overview: ```shell example_src ├── main.mojo # main entry point. run with `mojo example_src/main.mojo` └── my_package ├── __init__.mojo # this is both Mojo package, and a Python package. ├── __init__.py ├── fibonacci.mojo # Mojo implementation ├── fibonacci.py # Python implementation └── random_tensor.mojo # random tensor stuff example_tests └── my_package ├── my_test.mojo # files can be named xxx_test as well as test_xxx. ├── test_fibonacci.mojo # tests the Mojo impl and the Python impl. ├── test_fibonacci.py # tests the Python impl (pure Python). ├── test_fire.🔥 # tests are collected for fire extension too. └── test_random_tensor.mojo # tests the Mojo impl. ``` ## Links - Writing tests in Mojo: https://docs.modular.com/mojo/tools/testing . - Non-Python tests in `pytest`: https://pytest.org/en/7.4.x/example/nonpython.html#non-python-tests - C test runner: https://pytest-c-testrunner.readthedocs.io/ - Pytest docs: https://docs.pytest.org --- example_src/main.mojo --- from my_package.random_tensor import random_tensor from my_package.fibonacci import fibonacci def main(): print(random_tensor[DType.float64]()) print("fibonacci sequence:") for n in range(2, 11): print(fibonacci(n)) --- example_src/my_package/__init__.mojo --- --- example_src/my_package/__init__.py --- --- example_src/my_package/fibonacci.mojo --- fn fibonacci(n: Int) -> Int: """ The Nth Fibonacci number. """ if n <= 1: return n var a = 0 var b = 1 for _ in range(2, n + 1): a, b = b, a + b return b --- example_src/my_package/fibonacci.py --- def fibonacci(n: int) -> int: """ The Nth Fibonacci number. """ if n <= 1: return n a = 0 b = 1 for _ in range(2, n + 1): a, b = b, a + b return b --- example_src/my_package/random_tensor.mojo --- from python import Python from tensor import Tensor, TensorShape fn random_tensor[T: DType]() raises -> Tensor[T]: """ Wraps Tensor.rand() and multiplies a few tensors. """ var Shape = TensorShape(100, 1) return Tensor[T].rand(Shape) * Tensor[T].rand(Shape) * Tensor[T].rand(Shape) --- example_tests/my_package/my_test.mojo --- from testing import assert_true def my_test(): """ Tests that modules named with ***_test (suffix) are also discovered. """ assert_true(True) --- example_tests/my_package/test_fibonacci.mojo --- from python import Python from testing import assert_equal from my_package.fibonacci import fibonacci def test_fibonacci(): """ Test fibonacci 10th number. """ var expect = 55 var got = fibonacci(10) assert_equal(got, expect) def test_fibonacci_reference(): """ Test mojo fibonacci versus python "reference" implementation. """ var py = Python.import_module("my_package.fibonacci") for n in range(0, 10): var expect = py.fibonacci(n) var got = fibonacci(n) assert_equal(got, expect) --- example_tests/my_package/test_fibonacci.py --- from my_package.fibonacci import fibonacci def test_fibonacci(): """ Tests fibonacci module (py) using python. """ assert fibonacci(10) == 55 --- example_tests/my_package/test_fire.🔥 --- from testing import assert_true def test_emoji(): """ Testing the discovery of this file extension. """ assert_true(True) --- example_tests/my_package/test_random_tensor.mojo --- from testing import assert_true, assert_false from utils.numerics import isfinite, isnan from my_package.random_tensor import random_tensor def test_random_tensor(): """ Validate the random_tensor module in my_package. """ alias T = DType.float64 var t = random_tensor[T]() var sample_value = t[0] assert_false(isnan(sample_value)) assert_true(isfinite(sample_value)) --- pyproject.toml --- [tool.poetry] name = "pytest-mojo" version = "24.4.0" description = "Mojo🔥 language test runner plugin for pytest. (aka pytest-mojo)" authors = ["Alex G Rice <[email protected]>"] license = "MIT" readme = "README.md" repository = "https://github.com/guidorice/mojo-pytest" packages = [ { include = "pytest_mojo" }, ] [tool.poetry.dependencies] python = "^3.8" pytest = "*" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.poetry.plugins.pytest11] mojo = "pytest_mojo.plugin" --- pytest_mojo/__init__.py --- --- pytest_mojo/plugin.py --- import json import subprocess from pathlib import Path from typing import Any import shlex from pytest import File, Item, Package, Parser MOJO_TEST = ["mojo", "test", "--diagnostic-format", "json"] """ Mojo command to be run by this pytest plugin. """ TEST_PREFIX = "test_" """ Examples of test prefix: `test_something.mojo` or `test_xyz.🔥` """ TEST_SUFFIX = "_test" """ Examples of test suffix: `something_test.mojo` or `xyz_test.🔥` """ def pytest_collect_file(parent: Package, file_path: Path) -> File | None: """ Pytest hook """ if file_path.suffix in (".mojo", ".🔥") and ( file_path.stem.startswith(TEST_PREFIX) or file_path.stem.endswith(TEST_SUFFIX) ): return MojoTestFile.from_parent(parent, path=file_path) return None def pytest_addoption(parser: Parser): """ Pytest hook """ parser.addoption("--mojo-include", help="Mojo package include path.") class MojoTestFile(File): """ `mojo test --collect-only` the source file, then parse the stdout and exit code into one or more `MojoTestItem`. """ def collect(self): mojo_include_path = self.config.getoption("--mojo-include") mojo_src = str(self.path) shell_cmd = MOJO_TEST.copy() shell_cmd.append("--collect-only") if mojo_include_path: shell_cmd.extend(["-I", mojo_include_path]) shell_cmd.append(mojo_src) process = subprocess.run(shell_cmd, capture_output=True, text=True) # early-out of there was a mojo parser error (tests cannot be discovered in this case) if not process.stdout and process.returncode != 0: raise MojoTestException(process.stderr) # parsed collected tests and generate MojoTestItems for each child report = json.loads(process.stdout) for test_metadata in report.get("children", []): id = test_metadata.get("id", None) tokens = id.split("::") name = tokens[1] yield MojoTestItem.from_parent( self, name=name, spec=test_metadata, ) class MojoTestItem(Item): def __init__(self, *, name: str, parent, spec: dict[str, Any], **kwargs): super().__init__(name, parent, **kwargs) self.spec = spec def runtest(self): mojo_include_path = self.config.getoption("--mojo-include") shell_cmd = MOJO_TEST.copy() if mojo_include_path: shell_cmd.extend(["-I", mojo_include_path]) target = self.spec.get("id", None) # `mojo test`` apparently needs shell=True to work. shell_cmd.append(shlex.quote(target)) shell_cmd_str = " ".join(shell_cmd) process = subprocess.run(shell_cmd_str, capture_output=True, text=True, shell=True) # early-out of there was a mojo parser error (tests cannot be discovered in this case) print("stdout:", process.stdout) print("stderr:", process.stderr) if not process.stdout and process.returncode != 0: raise MojoTestException(process.stderr) report = json.loads(process.stdout) kind = report.get("kind", None) error = report.get("error", None) if error: raise MojoTestException(kind + ":"+ report.get("stdErr") + report.get("stdOut")) def repr_failure(self, excinfo): return str(excinfo) def reportinfo(self): line_num = self.spec.get("startLine", 0) return self.path, line_num, self.name class MojoTestException(Exception): pass --- .gitattributes --- # Set the default behavior, in case people don't have core.autocrlf set. * text=auto # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. *.asm text *.mojo text # Declare files that will always have CRLF line endings on checkout. *.sln text eol=crlf # Declare files that will always have LF line endings on checkout. *.sh test eol=lf # Denote all files that are truly binary and should not be modified. *.png binary --- .gitignore --- /main /disassemble/main /disassemble/sort_network.mojopkg --- LICENSE --- MIT License Copyright (c) 2023 Henk-Jan Lebbink Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # High Performance Sorting in Mojo Efficient sorting in Modular Mojo optimized for small datasets (with a number of elements less than or equal to 128). The primary objective is to create a drop-in replacement for the `sort[type: DType](inout v: DynamicVector[SIMD[type, 1]])` function, using sorting networks when the dataset is 128 elements or fewer. However, there are still a few areas that need refinement. The sorting networks are shamelessly borrowed from the work of [Bert Dobbelaere](https://bertdobbelaere.github.io/sorting_networks_extended.html) who did all the hard searching! ## Performance compared to stdlib sort I would love to present comprehensive scientific results, complete with boxplots, once a proper statistics library is available for computing standard deviations and confidence intervals. If you find yourself in need of ideas for a useful Mojo project, please consider it. In the meantime, humble time taken (in ns) of the minimum of total 1_000_000 runs is what I can present. 1. In the `mojo` column, you'll find a call to: `sort[type: DType](inout v: DynamicVector[SIMD[type, 1]]` with the specified type and vector size. These numbers are average ns of a run of 1000 samples, and this is done 10000 times and only the minimum is reported. 2. Under the `netw_SIMD` column is a call to the sorting network: `fn sort_network[T: DType, width: Int, ascending: Bool = True](v: SIMD[T, width]) -> SIMD[T, width]`. If you are sceptical (and you should be), please take a look at the code in the `test_performance` function. 3. In column `netw_vec` is a similar function that uses a DTypePointer instead of a SIMD registers, `fn sort_network[type: DType, ascending: Bool = True](inout v: DTypePointer[type], size: Int)`. Note that mojo is able to cheat (a bit) by optimizing over multiple sample steps. Results from Sapphire Rapids (Intel(R) Xeon(R) w5-2455X 3.19 GHz) ``` size mojo netw_SIMD netw_vec uint64 8 20.273000717163086 13.581000328063965 4.6510000228881836 uint64 16 23.427999496459961 22.229000091552734 17.906999588012695 uint64 32 89.584999084472656 52.423000335693359 53.023998260498047 uint64 64 147.78300476074219 144.59100341796875 141.26400756835938 uint64 128 312.09100341796875 341.37298583984375 339.8699951171875 int64 8 20.659999847412109 13.581000328063965 4.8870000839233398 int64 16 24.968999862670898 22.239999771118164 18.802000045776367 int64 32 85.327003479003906 55.11199951171875 53.051998138427734 int64 64 150.22099304199219 144.59100341796875 144.75700378417969 int64 128 322.68798828125 341.3909912109375 340.40399169921875 float64 8 22.27400016784668 18.808000564575195 6.7069997787475586 float64 16 24.620000839233398 31.35099983215332 20.356000900268555 float64 32 81.494003295898438 67.047996520996094 66.035003662109375 float64 64 150.78700256347656 172.62100219726562 166.50799560546875 float64 128 331.7349853515625 404.89401245117188 411.49600219726562 uint32 8 20.590000152587891 7.3559999465942383 2.3519999980926514 uint32 16 23.315000534057617 11.532999992370605 4.7659997940063477 uint32 32 81.68499755859375 22.245000839233398 14.359000205993652 uint32 64 135.843994140625 53.701999664306641 53.279998779296875 uint32 128 286.82101440429688 116.65699768066406 117.87899780273438 int32 8 21.63800048828125 7.3579998016357422 2.4739999771118164 int32 16 23.562999725341797 11.534000396728516 5.0029997825622559 int32 32 82.912002563476562 22.243000030517578 14.378999710083008 int32 64 143.15400695800781 56.402999877929688 52.959999084472656 int32 128 288.4530029296875 122.76100158691406 117.63999938964844 float32 8 21.847000122070312 15.956999778747559 4.9879999160766602 float32 16 24.704999923706055 28.111000061035156 11.850000381469727 float32 32 83.470001220703125 50.549999237060547 37.381000518798828 float32 64 144.34100341796875 107.47599792480469 100.47000122070312 float32 128 329.67401123046875 219.9219970703125 221.28599548339844 uint16 8 23.617000579833984 5.3600001335144043 2.3429999351501465 uint16 16 27.139999389648438 23.76300048828125 6.9120001792907715 uint16 32 95.140998840332031 23.583999633789062 10.407999992370605 uint16 64 172.92799377441406 55.355998992919922 43.13800048828125 uint16 128 349.23599243164062 92.987998962402344 86.794998168945312 int16 8 22.202999114990234 5.3649997711181641 2.3369998931884766 int16 16 27.21299934387207 24.965999603271484 6.9099998474121094 int16 32 100.19100189208984 23.583999633789062 10.407999992370605 int16 64 184.5469970703125 55.359001159667969 41.124000549316406 int16 128 404.385009765625 92.977996826171875 86.78399658203125 float16 8 20.812999725341797 16.593999862670898 5.2340002059936523 float16 16 25.663999557495117 41.544998168945312 15.77400016784668 float16 32 83.755996704101562 52.127998352050781 23.106000900268555 float16 64 153.06500244140625 103.88200378417969 90.084999084472656 float16 128 351.635009765625 167.30299377441406 167.4010009765625 uint8 8 20.913999557495117 6.5199999809265137 2.0220000743865967 uint8 16 25.128000259399414 11.020999908447266 3.7279999256134033 uint8 32 93.383003234863281 32.431999206542969 11.883999824523926 uint8 64 167.77999877929688 34.359001159667969 12.085000038146973 uint8 128 380.62701416015625 53.615001678466797 34.665000915527344 int8 8 20.586000442504883 6.5199999809265137 2.0190000534057617 int8 16 25.600000381469727 11.022000312805176 3.562000036239624 int8 32 85.268997192382812 32.435001373291016 11.329000473022461 int8 64 141.73300170898438 32.689998626708984 12.116000175476074 int8 128 308.25698852539062 53.620998382568359 34.612998962402344 ``` ``` Results from Emerald Rapids (Intel(R) Xeon(R) ?? 1.7 GHz) size mojo netw_SIMD netw_vec uint64 8 27.791000366210938 20.422000885009766 7.3550000190734863 uint64 16 32.803001403808594 33.422000885009766 27.797000885009766 uint64 32 122.26399993896484 82.86199951171875 83.290000915527344 uint64 64 223.39799499511719 228.552001953125 227.84500122070312 uint64 128 478.69100952148438 538.88897705078125 536.98602294921875 int64 8 26.641000747680664 20.422000885009766 7.3610000610351562 int64 16 32.807998657226562 33.424999237060547 27.790000915527344 int64 32 117.85600280761719 82.860000610351562 83.291999816894531 int64 64 223.14300537109375 228.55099487304688 227.82200622558594 int64 128 484.18499755859375 538.8900146484375 536.98199462890625 float64 8 30.49799919128418 27.63599967956543 10.373000144958496 float64 16 35.863998413085938 48.244998931884766 31.976999282836914 float64 32 145.55900573730469 102.96800231933594 101.15399932861328 float64 64 268.17498779296875 252.70399475097656 260.26901245117188 float64 128 596.2239990234375 657.43402099609375 667.83599853515625 uint32 8 27.006999969482422 11.060999870300293 3.7309999465942383 uint32 16 34.424999237060547 17.33799934387207 7.0060000419616699 uint32 32 116.31300354003906 33.462001800537109 22.275999069213867 uint32 64 204.51199340820312 84.58599853515625 82.709999084472656 uint32 128 442.9119873046875 179.36799621582031 179.79100036621094 int32 8 28.940999984741211 10.868000030517578 3.7190001010894775 int32 16 38.169998168945312 17.339000701904297 6.9850001335144043 int32 32 147.83000183105469 33.451999664306641 22.235000610351562 int32 64 284.40301513671875 84.636001586914062 82.153999328613281 int32 128 641.84600830078125 179.36399841308594 179.90400695800781 float32 8 28.200000762939453 25.253999710083008 7.9130001068115234 float32 16 34.761001586914062 41.203998565673828 17.174999237060547 float32 32 120.22899627685547 75.650001525878906 59.050998687744141 float32 64 221.822998046875 157.47200012207031 154.09199523925781 float32 128 518.968994140625 339.24099731445312 340.75 uint16 8 28.165000915527344 8.0579996109008789 3.5130000114440918 uint16 16 32.837001800537109 22.895000457763672 6.3600001335144043 uint16 32 114.80500030517578 35.465000152587891 15.109000205993652 uint16 64 204.48300170898438 83.19000244140625 61.066001892089844 uint16 128 453.56900024414062 139.95399475097656 132.66499328613281 int16 8 28.25200080871582 8.0649995803833008 3.5039999485015869 int16 16 33.259998321533203 22.892999649047852 6.3569998741149902 int16 32 114.947998046875 35.465999603271484 15.116999626159668 int16 64 207.40299987792969 83.19000244140625 61.062000274658203 int16 128 452.95498657226562 139.83700561523438 132.86399841308594 float16 8 27.378999710083008 24.954999923706055 7.8639998435974121 float16 16 33.935001373291016 49.456001281738281 16.621000289916992 float16 32 117.83300018310547 80.332000732421875 36.534999847412109 float16 64 221.02099609375 152.37399291992188 129.11700439453125 float16 128 522.46002197265625 245.54800415039062 243.36000061035156 uint8 8 27.99799919128418 9.7910003662109375 3.0350000858306885 uint8 16 32.863998413085938 16.569999694824219 5.6020002365112305 uint8 32 113.04599761962891 32.797000885009766 9.6079998016357422 uint8 64 205.45799255371094 51.645000457763672 18.542999267578125 uint8 128 447.67498779296875 80.572998046875 56.722000122070312 int8 8 28.150999069213867 9.7969999313354492 3.0339999198913574 int8 16 32.794998168945312 16.569999694824219 5.5999999046325684 int8 32 118.37799835205078 32.793998718261719 9.6129999160766602 int8 64 212.61599731445312 51.645000457763672 18.607000350952148 int8 128 457.52200317382812 80.58599853515625 56.761001586914062 ``` Overall, a sorting network is about 4 times faster. Note that sorts of size 64 are currently not reported due to a bug. If you are in a position to address this issue, please take a look at https://github.com/modularml/mojo/issues/1505. Note that the performance of float code is notably different compared to sorts with integer of the same size. I think it can be attributed to nan checking, as explained later on. ## How does it work? A sorting network represents the smallest number of comparisons and swaps required to sort an array. For instance, the sorting network for 16 inputs has 61 compare/exchange elements (CEs) organized into 9 layers. Layers consist of parallel CE operations, allowing them to be executed in any order. However, the order of the layers remains fixed. The big advantage of sorting networks is that they can be implemented without any data-dependent control flow. Thus, a single sorting network is just a linear branch-free sequence of instructions. Just what we need. For some interesting details see [here](https://jix.one/proving-50-year-old-sorting-networks-optimal-part-1/). ![net16](https://github.com/HJLebbink/sort-networks-mojo/blob/main/img/sort-network-16.png "Sorting Network 16") The above sorting network has been proven to be minimal [https://arxiv.org/abs/1310.6271], no need to worry about that. What remains is our quest to find the most efficient method to implement this on our current hardware. ## Is the code efficient? I like to restrict this question to code generated by the Mojo compiler (version 0.7.0) for AVX-512 capabable architectures. Next is the assembly code of one of the nine layers in a network that sorts 16 uint32 elements. ```asm vmovdqa64 zmm0, ZMMWORD PTR [r13+rax*1+0x0] vpermd zmm3, zmm0, zmm1 vpminud zmm2, zmm1, zmm3 mov ax, 0xb552 kmovd k1, eax vpmaxud zmm2{k1}, zmm1, zmm3 ``` To start, `zmm0` is loaded with permutation indices, which hold the static information in the layer indicating how elements should be exchanged. In the subsequent `vpermd` instruction, the data in zmm1 is permuted and stored in `zmm3`. We then obtain the minimum (`vpminud`) between the original data (`zmm1`) and the permuted data (`zmm0`), storing the result in `zmm2`. Here comes a clever trick – we also compute the maximum values (`vpmaxud`), and only overwrite the minimum values based on a static mask (`k1`) that indicates the lower side of the compare/exchange element. Repeat this for all layers and you sorted the data without any branches, and with minimal memory access. For sorting 16 uint32 values, I can't think of anything more efficient. ## Why Mojo? I view Mojo as a smart assembler. While I would love to manually write all the sorting functionality in assembly, the myriad combinations of array lengths and data types make it somewhat impractical. Luckily, Mojo diligently generates similarly efficient code for int32, int16, sorting in ascending or descending order, and more. Is the Mojo code flawless? No, you could blame LLVM for the following unnecessary nan check: ```asm vmovaps zmm0, ZMMWORD PTR [r15+rax*1] vpermps zmm0, zmm0, zmm1 vminps zmm2, zmm0, zmm1 vcmpunordps k1, zmm1, zmm1 vmovaps zmm2{k1}, zmm0 vmaxps zmm1, zmm0, zmm1 vmovaps zmm1{k1}, zmm0 mov ax, 0xb552 kmovd k1, eax vmovaps zmm2{k1}, zmm1 ``` Compared to the code for sorting 16 uint16 values, the first three instructions are unchanged (but are now for float32 instead of uint32). The [`vcmpunordps`](https://github.com/HJLebbink/asm-dude/wiki/CMPPS) instruction is new, which stores in mask `k1` the values in the data (`zmm1`) that are nan. However, there are several reasons why there cannot be any nans in `zmm1`. The simplest reason is that the previous layer already includes the exact same nan tests. Next, the minimum and maximum values, which happen to contain no nan values, are overwritten with the permuted data (which could also contain nan values, but that doesn't seem to be of interest). Removing the nan tests would result in the same optimal code. If there were a way to toy with the strictness of floating points, perhaps this unnecessary code could be trimmed. If you know a way, let me know! --- disassemble/asm/int16_128.asm --- 0x00000000000061b5 <+757>: call 0x5470 <clock_gettime@plt> 0x00000000000061ba <+762>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x300] 0x00000000000061c2 <+770>: vpshufd zmm0,zmm11,0xb1 0x00000000000061c9 <+777>: vmovdqa64 zmm8,ZMMWORD PTR [rsp+0x180] 0x00000000000061d1 <+785>: vpshufd zmm1,zmm8,0xb1 0x00000000000061d8 <+792>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x340] 0x00000000000061e0 <+800>: vpshufd zmm2,zmm10,0xb1 0x00000000000061e7 <+807>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x140] 0x00000000000061ef <+815>: vpshufd zmm3,zmm9,0xb1 0x00000000000061f6 <+822>: vpminsw zmm4,zmm9,zmm3 0x00000000000061fc <+828>: vpminsw zmm5,zmm10,zmm2 0x0000000000006202 <+834>: vpminsw zmm6,zmm8,zmm1 0x0000000000006208 <+840>: vpminsw zmm7,zmm11,zmm0 0x000000000000620e <+846>: mov eax,0xcccccccc 0x0000000000006213 <+851>: kmovd k1,eax 0x0000000000006217 <+855>: vpmaxsw zmm7{k1},zmm11,zmm0 0x000000000000621d <+861>: vpmaxsw zmm6{k1},zmm8,zmm1 0x0000000000006223 <+867>: vpmaxsw zmm5{k1},zmm10,zmm2 0x0000000000006229 <+873>: vpmaxsw zmm4{k1},zmm9,zmm3 0x000000000000622f <+879>: vprold zmm0,zmm4,0x10 0x0000000000006236 <+886>: vprold zmm1,zmm5,0x10 0x000000000000623d <+893>: vprold zmm2,zmm6,0x10 0x0000000000006244 <+900>: vprold zmm3,zmm7,0x10 0x000000000000624b <+907>: vpminsw zmm8,zmm7,zmm3 0x0000000000006251 <+913>: vpminsw zmm9,zmm6,zmm2 0x0000000000006257 <+919>: vpminsw zmm10,zmm5,zmm1 0x000000000000625d <+925>: vpminsw zmm11,zmm4,zmm0 0x0000000000006263 <+931>: mov eax,0xaaaaaaaa 0x0000000000006268 <+936>: kmovd k2,eax 0x000000000000626c <+940>: vpmaxsw zmm9{k2},zmm6,zmm2 0x0000000000006272 <+946>: vpmaxsw zmm8{k2},zmm7,zmm3 0x0000000000006278 <+952>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57ebe] # 0x5e140 0x0000000000006282 <+962>: vmovdqa64 zmm3,zmm9 0x0000000000006288 <+968>: vpermt2w zmm3,zmm2,zmm8 0x000000000000628e <+974>: vpmaxsw zmm11{k2},zmm4,zmm0 0x0000000000006294 <+980>: kmovd DWORD PTR [rsp+0x3c],k2 0x000000000000629b <+987>: vpmaxsw zmm10{k2},zmm5,zmm1 0x00000000000062a1 <+993>: vpermi2w zmm2,zmm11,zmm10 0x00000000000062a7 <+999>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57ecf] # 0x5e180 0x00000000000062b1 <+1009>: vmovdqa64 zmm1,zmm10 0x00000000000062b7 <+1015>: vpermt2w zmm1,zmm0,zmm11 0x00000000000062bd <+1021>: vpermi2w zmm0,zmm8,zmm9 0x00000000000062c3 <+1027>: vpmaxsw zmm4,zmm8,zmm0 0x00000000000062c9 <+1033>: mov eax,0x2222bb2b 0x00000000000062ce <+1038>: kmovd k2,eax 0x00000000000062d2 <+1042>: vpminsw zmm4{k2},zmm8,zmm0 0x00000000000062d8 <+1048>: vpmaxsw zmm0,zmm10,zmm1 0x00000000000062de <+1054>: vpminsw zmm0{k2},zmm10,zmm1 0x00000000000062e4 <+1060>: vpminsw zmm1,zmm11,zmm2 0x00000000000062ea <+1066>: mov eax,0xd4dd4444 0x00000000000062ef <+1071>: kmovd k2,eax 0x00000000000062f3 <+1075>: vpmaxsw zmm1{k2},zmm11,zmm2 0x00000000000062f9 <+1081>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57ebd] # 0x5e1c0 0x0000000000006303 <+1091>: vmovdqa64 zmm5,zmm1 0x0000000000006309 <+1097>: vpermt2w zmm5,zmm2,zmm0 0x000000000000630f <+1103>: vpminsw zmm6,zmm9,zmm3 0x0000000000006315 <+1109>: vpmaxsw zmm6{k2},zmm9,zmm3 0x000000000000631b <+1115>: vpermi2w zmm2,zmm6,zmm4 0x0000000000006321 <+1121>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57ed5] # 0x5e200 0x000000000000632b <+1131>: vmovdqa64 zmm7,zmm4 0x0000000000006331 <+1137>: vpermt2w zmm7,zmm3,zmm6 0x0000000000006337 <+1143>: vpermi2w zmm3,zmm0,zmm1 0x000000000000633d <+1149>: vpmaxsw zmm8,zmm0,zmm3 0x0000000000006343 <+1155>: mov eax,0x90669f 0x0000000000006348 <+1160>: kmovd k2,eax 0x000000000000634c <+1164>: vpminsw zmm8{k2},zmm0,zmm3 0x0000000000006352 <+1170>: vpmaxsw zmm0,zmm4,zmm7 0x0000000000006358 <+1176>: vpminsw zmm0{k2},zmm4,zmm7 0x000000000000635e <+1182>: vpminsw zmm3,zmm6,zmm2 0x0000000000006364 <+1188>: mov eax,0xf9660900 0x0000000000006369 <+1193>: kmovd k2,eax 0x000000000000636d <+1197>: vpmaxsw zmm3{k2},zmm6,zmm2 0x0000000000006373 <+1203>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57ec3] # 0x5e240 0x000000000000637d <+1213>: vmovdqa64 zmm4,zmm3 0x0000000000006383 <+1219>: vpermt2w zmm4,zmm2,zmm0 0x0000000000006389 <+1225>: vpminsw zmm6,zmm1,zmm5 0x000000000000638f <+1231>: vpmaxsw zmm6{k2},zmm1,zmm5 0x0000000000006395 <+1237>: vpermi2w zmm2,zmm6,zmm8 0x000000000000639b <+1243>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57edb] # 0x5e280 0x00000000000063a5 <+1253>: vpminsw zmm5,zmm6,zmm2 0x00000000000063ab <+1259>: mov eax,0x66009600 0x00000000000063b0 <+1264>: kmovd k2,eax 0x00000000000063b4 <+1268>: vmovdqa64 zmm7,zmm5 0x00000000000063ba <+1274>: vpmaxsw zmm7{k2},zmm6,zmm2 0x00000000000063c0 <+1280>: vpermt2w zmm6,zmm1,zmm8 0x00000000000063c6 <+1286>: vpermi2w zmm1,zmm3,zmm0 0x00000000000063cc <+1292>: vpmaxsw zmm2,zmm0,zmm1 0x00000000000063d2 <+1298>: mov eax,0x690066 0x00000000000063d7 <+1303>: kmovd k3,eax 0x00000000000063db <+1307>: vpminsw zmm2{k3},zmm0,zmm1 0x00000000000063e1 <+1313>: vpmaxsw zmm0,zmm8,zmm6 0x00000000000063e7 <+1319>: vpminsw zmm0{k3},zmm8,zmm6 0x00000000000063ed <+1325>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57ec9] # 0x5e2c0 0x00000000000063f7 <+1335>: vmovdqa64 zmm6,zmm7 0x00000000000063fd <+1341>: vpermt2w zmm6,zmm1,zmm0 0x0000000000006403 <+1347>: vpminsw zmm8,zmm3,zmm4 0x0000000000006409 <+1353>: vmovdqa64 zmm9,zmm8 0x000000000000640f <+1359>: vpmaxsw zmm9{k2},zmm3,zmm4 0x0000000000006415 <+1365>: vpermi2w zmm1,zmm9,zmm2 0x000000000000641b <+1371>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57edb] # 0x5e300 0x0000000000006425 <+1381>: vpermt2w zmm8,zmm3,zmm2 0x000000000000642b <+1387>: vpermt2w zmm5,zmm3,zmm0 0x0000000000006431 <+1393>: vpmaxsw zmm3,zmm2,zmm1 0x0000000000006437 <+1399>: mov eax,0x9069090 0x000000000000643c <+1404>: kmovd k2,eax 0x0000000000006440 <+1408>: vmovdqa64 zmm4,zmm3 0x0000000000006446 <+1414>: vpminsw zmm4{k2},zmm2,zmm1 0x000000000000644c <+1420>: vpminsw zmm1,zmm7,zmm5 0x0000000000006452 <+1426>: vpminsw zmm2,zmm9,zmm8 0x0000000000006458 <+1432>: mov eax,0x9096090 0x000000000000645d <+1437>: kmovd k3,eax 0x0000000000006461 <+1441>: vmovdqa64 zmm10,zmm2 0x0000000000006467 <+1447>: vpmaxsw zmm10{k3},zmm9,zmm8 0x000000000000646d <+1453>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57ec9] # 0x5e340 0x0000000000006477 <+1463>: vpermi2w zmm8,zmm10,zmm4 0x000000000000647d <+1469>: kmovd k4,ebx 0x0000000000006481 <+1473>: vmovdqu16 zmm8{k4},zmm1 0x0000000000006487 <+1479>: vpmaxsw zmm9,zmm0,zmm6 0x000000000000648d <+1485>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x57ee9] # 0x5e380 0x0000000000006497 <+1495>: vpermi2w zmm11,zmm4,zmm10 0x000000000000649d <+1501>: mov eax,0x80000000 0x00000000000064a2 <+1506>: kmovd k4,eax 0x00000000000064a6 <+1510>: vpmaxsw zmm1{k3},zmm7,zmm5 0x00000000000064ac <+1516>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57f0a] # 0x5e3c0 0x00000000000064b6 <+1526>: vpermi2w zmm5,zmm1,zmm2 0x00000000000064bc <+1532>: vmovdqu16 zmm11{k4},zmm9 0x00000000000064c2 <+1538>: vpminsw zmm9{k2},zmm0,zmm6 0x00000000000064c8 <+1544>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57f2e] # 0x5e400 0x00000000000064d2 <+1554>: vpermi2w zmm0,zmm5,zmm9 0x00000000000064d8 <+1560>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57f5e] # 0x5e440 0x00000000000064e2 <+1570>: vpermi2w zmm2,zmm1,zmm3 0x00000000000064e8 <+1576>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57f8e] # 0x5e480 0x00000000000064f2 <+1586>: vpermi2w zmm3,zmm9,zmm2 0x00000000000064f8 <+1592>: vpmaxsw zmm2,zmm9,zmm3 0x00000000000064fe <+1598>: mov eax,0x6096960 0x0000000000006503 <+1603>: kmovd k2,eax 0x0000000000006507 <+1607>: vpminsw zmm2{k2},zmm9,zmm3 0x000000000000650d <+1613>: vpmaxsw zmm3,zmm4,zmm11 0x0000000000006513 <+1619>: mov eax,0x86096960 0x0000000000006518 <+1624>: kmovd k2,eax 0x000000000000651c <+1628>: vpminsw zmm3{k2},zmm4,zmm11 0x0000000000006522 <+1634>: vpminsw zmm4,zmm1,zmm0 0x0000000000006528 <+1640>: vpminsw zmm5,zmm10,zmm8 0x000000000000652e <+1646>: mov eax,0x6969069 0x0000000000006533 <+1651>: kmovd k2,eax 0x0000000000006537 <+1655>: vpmaxsw zmm4{k2},zmm1,zmm0 0x000000000000653d <+1661>: mov eax,0x6969068 0x0000000000006542 <+1666>: kmovd k2,eax 0x0000000000006546 <+1670>: vpmaxsw zmm5{k2},zmm10,zmm8 0x000000000000654c <+1676>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57f6a] # 0x5e4c0 0x0000000000006556 <+1686>: vmovdqa64 zmm1,zmm4 0x000000000000655c <+1692>: vpermt2w zmm1,zmm0,zmm2 0x0000000000006562 <+1698>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57f94] # 0x5e500 0x000000000000656c <+1708>: vmovdqa64 zmm7,zmm2 0x0000000000006572 <+1714>: vpermt2w zmm7,zmm6,zmm4 0x0000000000006578 <+1720>: vpermi2w zmm0,zmm5,zmm3 0x000000000000657e <+1726>: vpermi2w zmm6,zmm3,zmm5 0x0000000000006584 <+1732>: vpmaxsw zmm8,zmm2,zmm7 0x000000000000658a <+1738>: vpmaxsw zmm9,zmm3,zmm6 0x0000000000006590 <+1744>: vpminsw zmm10,zmm4,zmm1 0x0000000000006596 <+1750>: vpminsw zmm11,zmm5,zmm0 0x000000000000659c <+1756>: mov eax,0xf0690f 0x00000000000065a1 <+1761>: kmovd k2,eax 0x00000000000065a5 <+1765>: vpmaxsw zmm10{k2},zmm4,zmm1 0x00000000000065ab <+1771>: vpmaxsw zmm11{k2},zmm5,zmm0 0x00000000000065b1 <+1777>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57fc5] # 0x5e580 0x00000000000065bb <+1787>: vmovdqa64 zmm1,zmm10 0x00000000000065c1 <+1793>: vpermt2w zmm1,zmm0,zmm8 0x00000000000065c7 <+1799>: vpermi2w zmm0,zmm11,zmm9 0x00000000000065cd <+1805>: mov eax,0x960f00 0x00000000000065d2 <+1810>: kmovd k2,eax 0x00000000000065d6 <+1814>: vpminsw zmm8{k2},zmm2,zmm7 0x00000000000065dc <+1820>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57f5a] # 0x5e540 0x00000000000065e6 <+1830>: vmovdqa64 zmm4,zmm8 0x00000000000065ec <+1836>: vpermt2w zmm4,zmm2,zmm10 0x00000000000065f2 <+1842>: vpminsw zmm9{k2},zmm3,zmm6 0x00000000000065f8 <+1848>: vpermi2w zmm2,zmm9,zmm11 0x00000000000065fe <+1854>: vpmaxsw zmm3,zmm8,zmm4 0x0000000000006604 <+1860>: mov eax,0x690f09 0x0000000000006609 <+1865>: kmovd k2,eax 0x000000000000660d <+1869>: vpminsw zmm3{k2},zmm8,zmm4 0x0000000000006613 <+1875>: vpmaxsw zmm4,zmm9,zmm2 0x0000000000006619 <+1881>: vpminsw zmm4{k2},zmm9,zmm2 0x000000000000661f <+1887>: vpmaxsw zmm2,zmm10,zmm1 0x0000000000006625 <+1893>: mov eax,0x6f0f6960 0x000000000000662a <+1898>: kmovd k2,eax 0x000000000000662e <+1902>: vpminsw zmm2{k2},zmm10,zmm1 0x0000000000006634 <+1908>: vpmaxsw zmm1,zmm11,zmm0 0x000000000000663a <+1914>: vpminsw zmm1{k2},zmm11,zmm0 0x0000000000006640 <+1920>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57f76] # 0x5e5c0 0x000000000000664a <+1930>: vpermw zmm5,zmm0,zmm3 0x0000000000006650 <+1936>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57fa6] # 0x5e600 0x000000000000665a <+1946>: vpermw zmm7,zmm6,zmm2 0x0000000000006660 <+1952>: vpermw zmm0,zmm0,zmm4 0x0000000000006666 <+1958>: vpermw zmm6,zmm6,zmm1 0x000000000000666c <+1964>: vpminsw zmm8,zmm3,zmm5 0x0000000000006672 <+1970>: vpmaxsw zmm3,zmm3,zmm5 0x0000000000006678 <+1976>: mov eax,0x6069f 0x000000000000667d <+1981>: kmovd k2,eax 0x0000000000006681 <+1985>: vmovdqu16 zmm3{k2},zmm8 0x0000000000006687 <+1991>: vpminsw zmm5,zmm4,zmm0 0x000000000000668d <+1997>: vpmaxsw zmm0,zmm4,zmm0 0x0000000000006693 <+2003>: vmovdqu16 zmm0{k2},zmm5 0x0000000000006699 <+2009>: vpmaxsw zmm4,zmm2,zmm7 0x000000000000669f <+2015>: mov eax,0x69f0600 0x00000000000066a4 <+2020>: kmovd k2,eax 0x00000000000066a8 <+2024>: vpminsw zmm4{k2},zmm2,zmm7 0x00000000000066ae <+2030>: vpmaxsw zmm2,zmm1,zmm6 0x00000000000066b4 <+2036>: vpminsw zmm2{k2},zmm1,zmm6 0x00000000000066ba <+2042>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57f7c] # 0x5e640 0x00000000000066c4 <+2052>: vmovdqa64 zmm6,zmm3 0x00000000000066ca <+2058>: vpermt2w zmm6,zmm1,zmm4 0x00000000000066d0 <+2064>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57fa6] # 0x5e680 0x00000000000066da <+2074>: vmovdqa64 zmm9,zmm4 0x00000000000066e0 <+2080>: vpermt2w zmm9,zmm7,zmm8 0x00000000000066e6 <+2086>: vpermi2w zmm1,zmm0,zmm2 0x00000000000066ec <+2092>: vpermi2w zmm7,zmm2,zmm5 0x00000000000066f2 <+2098>: vpmaxsw zmm5,zmm3,zmm6 0x00000000000066f8 <+2104>: mov eax,0x90f6 0x00000000000066fd <+2109>: kmovd k2,eax 0x0000000000006701 <+2113>: vpminsw zmm5{k2},zmm3,zmm6 0x0000000000006707 <+2119>: vpmaxsw zmm3,zmm0,zmm1 0x000000000000670d <+2125>: vpminsw zmm3{k2},zmm0,zmm1 0x0000000000006713 <+2131>: vpmaxsw zmm0,zmm4,zmm9 0x0000000000006719 <+2137>: mov eax,0x90f69000 0x000000000000671e <+2142>: kmovd k2,eax 0x0000000000006722 <+2146>: vpminsw zmm0{k2},zmm4,zmm9 0x0000000000006728 <+2152>: vpmaxsw zmm1,zmm2,zmm7 0x000000000000672e <+2158>: vpminsw zmm1{k2},zmm2,zmm7 0x0000000000006734 <+2164>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57f82] # 0x5e6c0 0x000000000000673e <+2174>: vmovdqa64 zmm6,zmm5 0x0000000000006744 <+2180>: vpermt2w zmm6,zmm4,zmm0 0x000000000000674a <+2186>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57fac] # 0x5e700 0x0000000000006754 <+2196>: vmovdqa64 zmm2,zmm0 0x000000000000675a <+2202>: vpermt2w zmm2,zmm7,zmm5 0x0000000000006760 <+2208>: vpermi2w zmm4,zmm3,zmm1 0x0000000000006766 <+2214>: vpermi2w zmm7,zmm1,zmm3 0x000000000000676c <+2220>: vpmaxsw zmm8,zmm0,zmm2 0x0000000000006772 <+2226>: mov eax,0xe8e06666 0x0000000000006777 <+2231>: kmovd k2,eax 0x000000000000677b <+2235>: vpminsw zmm8{k2},zmm0,zmm2 0x0000000000006781 <+2241>: vpmaxsw zmm2,zmm5,zmm6 0x0000000000006787 <+2247>: mov eax,0xe8e0 0x000000000000678c <+2252>: kmovd k3,eax 0x0000000000006790 <+2256>: vpminsw zmm2{k3},zmm5,zmm6 0x0000000000006796 <+2262>: vpmaxsw zmm5,zmm1,zmm7 0x000000000000679c <+2268>: vpminsw zmm5{k2},zmm1,zmm7 0x00000000000067a2 <+2274>: vpmaxsw zmm6,zmm3,zmm4 0x00000000000067a8 <+2280>: vpminsw zmm6{k3},zmm3,zmm4 0x00000000000067ae <+2286>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57f88] # 0x5e740 0x00000000000067b8 <+2296>: vmovdqa64 zmm7,zmm2 0x00000000000067be <+2302>: vpermt2w zmm7,zmm3,zmm8 0x00000000000067c4 <+2308>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57fb2] # 0x5e780 0x00000000000067ce <+2318>: vmovdqa64 zmm9,zmm8 0x00000000000067d4 <+2324>: vpermt2w zmm9,zmm1,zmm2 0x00000000000067da <+2330>: vpermi2w zmm3,zmm6,zmm5 0x00000000000067e0 <+2336>: mov rbx,QWORD PTR [rsp+0xd0] 0x00000000000067e8 <+2344>: vpermi2w zmm1,zmm5,zmm6 0x00000000000067ee <+2350>: vpminsw zmm10,zmm5,zmm1 0x00000000000067f4 <+2356>: mov eax,0xb3931331 0x00000000000067f9 <+2361>: kmovd k3,eax 0x00000000000067fd <+2365>: vmovdqa64 zmm0,zmm10 0x0000000000006803 <+2371>: vpmaxsw zmm0{k3},zmm5,zmm1 0x0000000000006809 <+2377>: vpmaxsw zmm5,zmm6,zmm3 0x000000000000680f <+2383>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57fa7] # 0x5e7c0 0x0000000000006819 <+2393>: vpermi2w zmm1,zmm0,zmm5 0x000000000000681f <+2399>: vpminsw zmm4,zmm8,zmm9 0x0000000000006825 <+2405>: mov eax,0x2 0x000000000000682a <+2410>: kmovd k2,eax 0x000000000000682e <+2414>: vmovdqu16 zmm1{k2},zmm4 0x0000000000006834 <+2420>: mov eax,0x8880088 0x0000000000006839 <+2425>: kmovd k2,eax 0x000000000000683d <+2429>: vpmaxsw zmm4{k3},zmm8,zmm9 0x0000000000006843 <+2435>: vbroadcasti64x4 zmm8,YMMWORD PTR [rip+0x57893] # 0x5e0e0 0x000000000000684d <+2445>: vpermi2d zmm8,zmm4,zmm5 0x0000000000006853 <+2451>: vpminsw zmm5{k2},zmm6,zmm3 0x0000000000006859 <+2457>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57f9d] # 0x5e800 0x0000000000006863 <+2467>: vpermi2w zmm6,zmm5,zmm0 0x0000000000006869 <+2473>: mov rax,QWORD PTR [rsp+0xd8] 0x0000000000006871 <+2481>: mov QWORD PTR [rsp+0x1e0],rax 0x0000000000006879 <+2489>: vpmaxsw zmm3,zmm2,zmm7 0x000000000000687f <+2495>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x57ff7] # 0x5e880 0x0000000000006889 <+2505>: vpermi2w zmm9,zmm4,zmm10 0x000000000000688f <+2511>: mov eax,0x40000000 0x0000000000006894 <+2516>: kmovd k3,eax 0x0000000000006898 <+2520>: vmovdqu16 zmm6{k3},zmm3 0x000000000000689e <+2526>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x58018] # 0x5e8c0 0x00000000000068a8 <+2536>: vpermi2w zmm10,zmm9,zmm3 0x00000000000068ae <+2542>: vpminsw zmm3{k2},zmm2,zmm7 0x00000000000068b4 <+2548>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57f82] # 0x5e840 0x00000000000068be <+2558>: vpermi2w zmm2,zmm3,zmm8 0x00000000000068c4 <+2564>: vpminsw zmm7,zmm4,zmm10 0x00000000000068ca <+2570>: vpmaxsw zmm8,zmm5,zmm6 0x00000000000068d0 <+2576>: mov eax,0x4a00ca4c 0x00000000000068d5 <+2581>: kmovd k2,eax 0x00000000000068d9 <+2585>: vpmaxsw zmm4,zmm4,zmm10 0x00000000000068df <+2591>: mov eax,0xc48cd9ac 0x00000000000068e4 <+2596>: kmovd k3,eax 0x00000000000068e8 <+2600>: vmovdqu16 zmm4{k3},zmm7 0x00000000000068ee <+2606>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58088] # 0x5e980 0x00000000000068f8 <+2616>: vpermi2w zmm9,zmm4,zmm8 0x00000000000068fe <+2622>: vpminsw zmm8{k2},zmm5,zmm6 0x0000000000006904 <+2628>: vpminsw zmm5,zmm0,zmm1 0x000000000000690a <+2634>: mov eax,0x3b732651 0x000000000000690f <+2639>: kmovd k2,eax 0x0000000000006913 <+2643>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x580e3] # 0x5ea00 0x000000000000691d <+2653>: vpermi2w zmm6,zmm4,zmm5 0x0000000000006923 <+2659>: vpmaxsw zmm5{k2},zmm0,zmm1 0x0000000000006929 <+2665>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57fcd] # 0x5e900 0x0000000000006933 <+2675>: vpermi2w zmm0,zmm5,zmm8 0x0000000000006939 <+2681>: mov eax,0x4 0x000000000000693e <+2686>: kmovd k2,eax 0x0000000000006942 <+2690>: vmovdqu16 zmm0{k2},zmm7 0x0000000000006948 <+2696>: vpmaxsw zmm1,zmm3,zmm2 0x000000000000694e <+2702>: mov eax,0xa00ca4c 0x0000000000006953 <+2707>: kmovd k2,eax 0x0000000000006957 <+2711>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57fdf] # 0x5e940 0x0000000000006961 <+2721>: vpermi2w zmm7,zmm8,zmm5 0x0000000000006967 <+2727>: mov eax,0x20000000 0x000000000000696c <+2732>: kmovd k3,eax 0x0000000000006970 <+2736>: vmovdqu16 zmm7{k3},zmm1 0x0000000000006976 <+2742>: vpminsw zmm1{k2},zmm3,zmm2 0x000000000000697c <+2748>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5803a] # 0x5e9c0 0x0000000000006986 <+2758>: vpermi2w zmm2,zmm1,zmm9 0x000000000000698c <+2764>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x580aa] # 0x5ea40 0x0000000000006996 <+2774>: vpermi2w zmm3,zmm6,zmm1 0x000000000000699c <+2780>: vpmaxsw zmm6,zmm4,zmm3 0x00000000000069a2 <+2786>: mov eax,0x88ca8888 0x00000000000069a7 <+2791>: kmovd k2,eax 0x00000000000069ab <+2795>: vpminsw zmm6{k2},zmm4,zmm3 0x00000000000069b1 <+2801>: vpmaxsw zmm3,zmm1,zmm2 0x00000000000069b7 <+2807>: mov eax,0x2466 0x00000000000069bc <+2812>: kmovd k2,eax 0x00000000000069c0 <+2816>: vpminsw zmm3{k2},zmm1,zmm2 0x00000000000069c6 <+2822>: vpmaxsw zmm1,zmm5,zmm0 0x00000000000069cc <+2828>: mov eax,0x88ca888c 0x00000000000069d1 <+2833>: kmovd k2,eax 0x00000000000069d5 <+2837>: vpminsw zmm1{k2},zmm5,zmm0 0x00000000000069db <+2843>: vpmaxsw zmm0,zmm8,zmm7 0x00000000000069e1 <+2849>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58095] # 0x5ea80 0x00000000000069eb <+2859>: vmovdqa64 zmm4,zmm3 0x00000000000069f1 <+2865>: vpermt2w zmm4,zmm2,zmm6 0x00000000000069f7 <+2871>: mov eax,0x20002466 0x00000000000069fc <+2876>: kmovd k2,eax 0x0000000000006a00 <+2880>: vpminsw zmm0{k2},zmm8,zmm7 0x0000000000006a06 <+2886>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x580b0] # 0x5eac0 0x0000000000006a10 <+2896>: vmovdqa64 zmm7,zmm6 0x0000000000006a16 <+2902>: vpermt2w zmm7,zmm5,zmm3 0x0000000000006a1c <+2908>: vpermi2w zmm2,zmm0,zmm1 0x0000000000006a22 <+2914>: vpermi2w zmm5,zmm1,zmm0 0x0000000000006a28 <+2920>: vpmaxsw zmm8,zmm6,zmm7 0x0000000000006a2e <+2926>: mov eax,0xeeca8888 0x0000000000006a33 <+2931>: kmovd k3,eax 0x0000000000006a37 <+2935>: vpminsw zmm8{k3},zmm6,zmm7 0x0000000000006a3d <+2941>: vpmaxsw zmm6,zmm3,zmm4 0x0000000000006a43 <+2947>: mov eax,0xac88 0x0000000000006a48 <+2952>: kmovd k2,eax 0x0000000000006a4c <+2956>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x580ea] # 0x5eb40 0x0000000000006a56 <+2966>: vmovdqa64 zmm9,zmm8 0x0000000000006a5c <+2972>: vpermt2w zmm9,zmm7,zmm6 0x0000000000006a62 <+2978>: vpminsw zmm6{k2},zmm3,zmm4 0x0000000000006a68 <+2984>: vpmaxsw zmm3,zmm1,zmm5 0x0000000000006a6e <+2990>: vpminsw zmm3{k3},zmm1,zmm5 0x0000000000006a74 <+2996>: vpmaxsw zmm1,zmm0,zmm2 0x0000000000006a7a <+3002>: vpermi2w zmm7,zmm3,zmm1 0x0000000000006a80 <+3008>: vpminsw zmm1{k2},zmm0,zmm2 0x0000000000006a86 <+3014>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58070] # 0x5eb00 0x0000000000006a90 <+3024>: vmovdqa64 zmm2,zmm6 0x0000000000006a96 <+3030>: vpermt2w zmm2,zmm0,zmm8 0x0000000000006a9c <+3036>: vpermi2w zmm0,zmm1,zmm3 0x0000000000006aa2 <+3042>: vpmaxsw zmm4,zmm6,zmm2 0x0000000000006aa8 <+3048>: mov eax,0x44caaa 0x0000000000006aad <+3053>: kmovd k2,eax 0x0000000000006ab1 <+3057>: vpminsw zmm4{k2},zmm6,zmm2 0x0000000000006ab7 <+3063>: vpmaxsw zmm2,zmm1,zmm0 0x0000000000006abd <+3069>: vpminsw zmm2{k2},zmm1,zmm0 0x0000000000006ac3 <+3075>: vpmaxsw zmm0,zmm8,zmm9 0x0000000000006ac9 <+3081>: mov eax,0xaaaccc88 0x0000000000006ace <+3086>: kmovd k2,eax 0x0000000000006ad2 <+3090>: vpminsw zmm0{k2},zmm8,zmm9 0x0000000000006ad8 <+3096>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5809e] # 0x5eb80 0x0000000000006ae2 <+3106>: vmovdqa64 zmm5,zmm4 0x0000000000006ae8 <+3112>: vpermt2w zmm5,zmm1,zmm0 0x0000000000006aee <+3118>: vpmaxsw zmm6,zmm3,zmm7 0x0000000000006af4 <+3124>: vpminsw zmm6{k2},zmm3,zmm7 0x0000000000006afa <+3130>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x580bc] # 0x5ebc0 0x0000000000006b04 <+3140>: vmovdqa64 zmm7,zmm0 0x0000000000006b0a <+3146>: vpermt2w zmm7,zmm3,zmm4 0x0000000000006b10 <+3152>: vpermi2w zmm1,zmm2,zmm6 0x0000000000006b16 <+3158>: vpermi2w zmm3,zmm6,zmm2 0x0000000000006b1c <+3164>: vpmaxsw zmm8,zmm0,zmm7 0x0000000000006b22 <+3170>: mov eax,0xcaacaa88 0x0000000000006b27 <+3175>: kmovd k2,eax 0x0000000000006b2b <+3179>: vpminsw zmm8{k2},zmm0,zmm7 0x0000000000006b31 <+3185>: vpmaxsw zmm0,zmm4,zmm5 0x0000000000006b37 <+3191>: mov eax,0xaacaac 0x0000000000006b3c <+3196>: kmovd k3,eax 0x0000000000006b40 <+3200>: vpminsw zmm0{k3},zmm4,zmm5 0x0000000000006b46 <+3206>: vpmaxsw zmm4,zmm6,zmm3 0x0000000000006b4c <+3212>: vpminsw zmm4{k2},zmm6,zmm3 0x0000000000006b52 <+3218>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x580a4] # 0x5ec00 0x0000000000006b5c <+3228>: vmovdqa64 zmm5,zmm0 0x0000000000006b62 <+3234>: vpermt2w zmm5,zmm3,zmm8 0x0000000000006b68 <+3240>: vpmaxsw zmm6,zmm2,zmm1 0x0000000000006b6e <+3246>: vpminsw zmm6{k3},zmm2,zmm1 0x0000000000006b74 <+3252>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x580c2] # 0x5ec40 0x0000000000006b7e <+3262>: vmovdqa64 zmm2,zmm8 0x0000000000006b84 <+3268>: vpermt2w zmm2,zmm1,zmm0 0x0000000000006b8a <+3274>: vpermi2w zmm3,zmm6,zmm4 0x0000000000006b90 <+3280>: vpermi2w zmm1,zmm4,zmm6 0x0000000000006b96 <+3286>: vpmaxsw zmm7,zmm8,zmm2 0x0000000000006b9c <+3292>: mov eax,0xaccaccc8 0x0000000000006ba1 <+3297>: kmovd k3,eax 0x0000000000006ba5 <+3301>: vpminsw zmm7{k3},zmm8,zmm2 0x0000000000006bab <+3307>: vpmaxsw zmm2,zmm0,zmm5 0x0000000000006bb1 <+3313>: mov eax,0x4ccacca 0x0000000000006bb6 <+3318>: kmovd k2,eax 0x0000000000006bba <+3322>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x580fc] # 0x5ecc0 0x0000000000006bc4 <+3332>: vmovdqa64 zmm9,zmm7 0x0000000000006bca <+3338>: vpermt2w zmm9,zmm8,zmm2 0x0000000000006bd0 <+3344>: vpminsw zmm2{k2},zmm0,zmm5 0x0000000000006bd6 <+3350>: vpmaxsw zmm0,zmm4,zmm1 0x0000000000006bdc <+3356>: vpminsw zmm0{k3},zmm4,zmm1 0x0000000000006be2 <+3362>: vpmaxsw zmm1,zmm6,zmm3 0x0000000000006be8 <+3368>: vpermi2w zmm8,zmm0,zmm1 0x0000000000006bee <+3374>: vpminsw zmm1{k2},zmm6,zmm3 0x0000000000006bf4 <+3380>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58082] # 0x5ec80 0x0000000000006bfe <+3390>: vmovdqa64 zmm4,zmm2 0x0000000000006c04 <+3396>: vpermt2w zmm4,zmm3,zmm7 0x0000000000006c0a <+3402>: vpermi2w zmm3,zmm1,zmm0 0x0000000000006c10 <+3408>: vpmaxsw zmm5,zmm2,zmm4 0x0000000000006c16 <+3414>: mov eax,0xaaaaaaa 0x0000000000006c1b <+3419>: kmovd k3,eax 0x0000000000006c1f <+3423>: vpminsw zmm5{k3},zmm2,zmm4 0x0000000000006c25 <+3429>: vpmaxsw zmm2,zmm1,zmm3 0x0000000000006c2b <+3435>: vpmaxsw zmm4,zmm7,zmm9 0x0000000000006c31 <+3441>: mov eax,0xaaaaaaa8 0x0000000000006c36 <+3446>: kmovd k4,eax 0x0000000000006c3a <+3450>: vpminsw zmm4{k4},zmm7,zmm9 0x0000000000006c40 <+3456>: vpmaxsw zmm6,zmm0,zmm8 0x0000000000006c46 <+3462>: mov eax,0xe0000000 0x0000000000006c4b <+3467>: kmovd k2,eax 0x0000000000006c4f <+3471>: vpblendmw zmm7{k2},zmm5,zmm2 0x0000000000006c55 <+3477>: vpminsw zmm2{k3},zmm1,zmm3 0x0000000000006c5b <+3483>: mov eax,0x7 0x0000000000006c60 <+3488>: kmovd k3,eax 0x0000000000006c64 <+3492>: vpblendmw zmm1{k3},zmm4,zmm6 0x0000000000006c6a <+3498>: vpminsw zmm6{k4},zmm0,zmm8 0x0000000000006c70 <+3504>: vpblendmw zmm0{k2},zmm2,zmm5 0x0000000000006c76 <+3510>: vpblendmw zmm3{k3},zmm6,zmm4 0x0000000000006c7c <+3516>: vpminsw zmm8,zmm2,zmm7 0x0000000000006c82 <+3522>: vpminsw zmm9,zmm6,zmm1 0x0000000000006c88 <+3528>: vpmaxsw zmm0,zmm5,zmm0 0x0000000000006c8e <+3534>: vpmaxsw zmm8{k2},zmm2,zmm7 0x0000000000006c94 <+3540>: vpmaxsw zmm9{k3},zmm6,zmm1 0x0000000000006c9a <+3546>: vpmaxsw zmm1,zmm4,zmm3 0x0000000000006ca0 <+3552>: vpminsw zmm2,zmm8,zmm1 0x0000000000006ca6 <+3558>: vpmaxsw zmm1,zmm1,zmm8 0x0000000000006cac <+3564>: vshufi64x2 zmm3,zmm1,zmm0,0xee 0x0000000000006cb3 <+3571>: vshufi64x2 zmm4,zmm2,zmm0,0x4e 0x0000000000006cba <+3578>: vshufi64x2 zmm5,zmm9,zmm1,0x4e 0x0000000000006cc1 <+3585>: vinserti64x4 zmm6,zmm9,ymm2,0x1 0x0000000000006cc8 <+3592>: vpmaxsw zmm7,zmm1,zmm4 0x0000000000006cce <+3598>: mov eax,0xffff0000 0x0000000000006cd3 <+3603>: kmovd k2,eax 0x0000000000006cd7 <+3607>: vmovdqa64 zmm8,zmm7 0x0000000000006cdd <+3613>: vpminsw zmm8{k2},zmm1,zmm4 0x0000000000006ce3 <+3619>: vpmaxsw zmm1,zmm9,zmm6 0x0000000000006ce9 <+3625>: vpminsw zmm1{k2},zmm9,zmm6 0x0000000000006cef <+3631>: vpminsw zmm4,zmm2,zmm5 0x0000000000006cf5 <+3637>: vpmaxsw zmm0,zmm0,zmm3 0x0000000000006cfb <+3643>: vpmaxsw zmm2,zmm2,zmm5 0x0000000000006d01 <+3649>: vshufi64x2 zmm3,zmm2,zmm4,0xe4 0x0000000000006d08 <+3656>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57fee] # 0x5ed00 0x0000000000006d12 <+3666>: vpermi2q zmm5,zmm1,zmm2 0x0000000000006d18 <+3672>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5801e] # 0x5ed40 0x0000000000006d22 <+3682>: vmovdqa64 zmm6,zmm8 0x0000000000006d28 <+3688>: vpermt2q zmm6,zmm2,zmm4 0x0000000000006d2e <+3694>: vinserti32x4 zmm4,zmm6,xmm0,0x3 0x0000000000006d35 <+3701>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58041] # 0x5ed80 0x0000000000006d3f <+3711>: vpermi2q zmm6,zmm0,zmm8 0x0000000000006d45 <+3717>: vpermi2q zmm2,zmm3,zmm1 0x0000000000006d4b <+3723>: vinserti32x4 zmm2,zmm2,xmm7,0x3 0x0000000000006d52 <+3730>: vpminsw zmm7,zmm3,zmm2 0x0000000000006d58 <+3736>: vpmaxsw zmm2,zmm3,zmm2 0x0000000000006d5e <+3742>: mov al,0xcc 0x0000000000006d60 <+3744>: kmovd k2,eax 0x0000000000006d64 <+3748>: vpblendmq zmm3{k2},zmm2,zmm7 0x0000000000006d6a <+3754>: vpmaxsw zmm9,zmm0,zmm6 0x0000000000006d70 <+3760>: mov eax,0xff00 0x0000000000006d75 <+3765>: kmovd k2,eax 0x0000000000006d79 <+3769>: vpmaxsw zmm10,zmm8,zmm4 0x0000000000006d7f <+3775>: mov eax,0xff00ff00 0x0000000000006d84 <+3780>: kmovd k3,eax 0x0000000000006d88 <+3784>: vmovdqa64 zmm11,zmm10 0x0000000000006d8e <+3790>: vpminsw zmm11{k3},zmm8,zmm4 0x0000000000006d94 <+3796>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58062] # 0x5ee00 0x0000000000006d9e <+3806>: vmovdqa64 zmm8,zmm11 0x0000000000006da4 <+3812>: vpermt2q zmm8,zmm4,zmm7 0x0000000000006daa <+3818>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5808c] # 0x5ee40 0x0000000000006db4 <+3828>: vpermt2q zmm8,zmm7,zmm9 0x0000000000006dba <+3834>: vpminsw zmm9{k2},zmm0,zmm6 0x0000000000006dc0 <+3840>: vpmaxsw zmm0,zmm1,zmm5 0x0000000000006dc6 <+3846>: vpminsw zmm0{k3},zmm1,zmm5 0x0000000000006dcc <+3852>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57fea] # 0x5edc0 0x0000000000006dd6 <+3862>: vpermi2q zmm1,zmm0,zmm2 0x0000000000006ddc <+3868>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5809a] # 0x5ee80 0x0000000000006de6 <+3878>: vpermi2q zmm2,zmm9,zmm11 0x0000000000006dec <+3884>: vpermi2q zmm4,zmm3,zmm0 0x0000000000006df2 <+3890>: vpermt2q zmm4,zmm7,zmm10 0x0000000000006df8 <+3896>: vpminsw zmm5,zmm3,zmm4 0x0000000000006dfe <+3902>: vpmaxsw zmm3,zmm3,zmm4 0x0000000000006e04 <+3908>: mov al,0xaa 0x0000000000006e06 <+3910>: kmovd k2,eax 0x0000000000006e0a <+3914>: vpblendmq zmm4{k2},zmm3,zmm5 0x0000000000006e10 <+3920>: vpmaxsw zmm6,zmm9,zmm2 0x0000000000006e16 <+3926>: mov eax,0xf0f0f0 0x0000000000006e1b <+3931>: kmovd k2,eax 0x0000000000006e1f <+3935>: vpmaxsw zmm7,zmm11,zmm8 0x0000000000006e25 <+3941>: mov eax,0xf0f0f0f0 0x0000000000006e2a <+3946>: kmovd k3,eax 0x0000000000006e2e <+3950>: vmovdqa64 zmm10,zmm7 0x0000000000006e34 <+3956>: vpminsw zmm10{k3},zmm11,zmm8 0x0000000000006e3a <+3962>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x580bc] # 0x5ef00 0x0000000000006e44 <+3972>: vmovdqa64 zmm11,zmm10 0x0000000000006e4a <+3978>: vpermt2d zmm11,zmm8,zmm5 0x0000000000006e50 <+3984>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x580e6] # 0x5ef40 0x0000000000006e5a <+3994>: vpermt2d zmm11,zmm5,zmm6 0x0000000000006e60 <+4000>: vpminsw zmm6{k2},zmm9,zmm2 0x0000000000006e66 <+4006>: vpmaxsw zmm2,zmm0,zmm1 0x0000000000006e6c <+4012>: vpminsw zmm2{k3},zmm0,zmm1 0x0000000000006e72 <+4018>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58044] # 0x5eec0 0x0000000000006e7c <+4028>: vpermi2d zmm0,zmm2,zmm3 0x0000000000006e82 <+4034>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x580f4] # 0x5ef80 0x0000000000006e8c <+4044>: vpermi2d zmm1,zmm6,zmm10 0x0000000000006e92 <+4050>: vpermi2d zmm8,zmm4,zmm2 0x0000000000006e98 <+4056>: vpermt2d zmm8,zmm5,zmm7 0x0000000000006e9e <+4062>: vpminsw zmm3,zmm4,zmm8 0x0000000000006ea4 <+4068>: vpmaxsw zmm4,zmm4,zmm8 0x0000000000006eaa <+4074>: mov ax,0xaaaa 0x0000000000006eae <+4078>: kmovd k2,eax 0x0000000000006eb2 <+4082>: vpblendmd zmm5{k2},zmm4,zmm3 0x0000000000006eb8 <+4088>: vpmaxsw zmm7,zmm6,zmm1 0x0000000000006ebe <+4094>: mov eax,0xccccccc 0x0000000000006ec3 <+4099>: kmovd k2,eax 0x0000000000006ec7 <+4103>: vpmaxsw zmm8,zmm2,zmm0 0x0000000000006ecd <+4109>: vpminsw zmm8{k1},zmm2,zmm0 0x0000000000006ed3 <+4115>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x580e3] # 0x5efc0 0x0000000000006edd <+4125>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm5 0x0000000000006ee5 <+4133>: vpermt2w zmm5,zmm9,zmm8 0x0000000000006eeb <+4139>: vpmaxsw zmm0,zmm10,zmm11 0x0000000000006ef1 <+4145>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58105] # 0x5f000 0x0000000000006efb <+4155>: vpermt2w zmm5,zmm2,zmm0 0x0000000000006f01 <+4161>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm5 0x0000000000006f09 <+4169>: vpminsw zmm0{k1},zmm10,zmm11 0x0000000000006f0f <+4175>: vpermi2w zmm9,zmm0,zmm3 0x0000000000006f15 <+4181>: vpermt2w zmm9,zmm2,zmm7 0x0000000000006f1b <+4187>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm9 0x0000000000006f23 <+4195>: vpminsw zmm7{k2},zmm6,zmm1 0x0000000000006f29 <+4201>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5810d] # 0x5f040 0x0000000000006f33 <+4211>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm8 0x0000000000006f3b <+4219>: vpermi2w zmm1,zmm8,zmm4 0x0000000000006f41 <+4225>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm1 0x0000000000006f49 <+4233>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5812d] # 0x5f080 0x0000000000006f53 <+4243>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm7 0x0000000000006f5b <+4251>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm0 0x0000000000006f63 <+4259>: vpermi2w zmm1,zmm7,zmm0 0x0000000000006f69 <+4265>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm1 0x0000000000006f71 <+4273>: vpxor xmm0,xmm0,xmm0 0x0000000000006f75 <+4277>: vmovdqa XMMWORD PTR [rsp+0xf0],xmm0 0x0000000000006f7e <+4286>: lea rsi,[rsp+0xf0] 0x0000000000006f86 <+4294>: mov edi,0x1 0x0000000000006f8b <+4299>: vzeroupper 0x0000000000006f8e <+4302>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int16_16.asm --- 0x00000000000060a6 <+582>: call 0x5470 <clock_gettime@plt> 0x00000000000060ab <+587>: mov rbx,QWORD PTR [rsp+0xc0] 0x00000000000060b3 <+595>: mov rax,QWORD PTR [rsp+0xc8] 0x00000000000060bb <+603>: mov QWORD PTR [rsp+0x150],rax 0x00000000000060c3 <+611>: vmovdqa ymm0,YMMWORD PTR [rip+0x57035] # 0x5d100 0x00000000000060cb <+619>: vmovdqu ymm2,YMMWORD PTR [rsp+0x10] 0x00000000000060d1 <+625>: vpermw ymm0,ymm0,ymm2 0x00000000000060d7 <+631>: vpminsw ymm1,ymm2,ymm0 0x00000000000060db <+635>: mov ax,0xf2b0 0x00000000000060df <+639>: kmovd k1,eax 0x00000000000060e3 <+643>: vpmaxsw ymm1{k1},ymm2,ymm0 0x00000000000060e9 <+649>: vmovdqa ymm0,YMMWORD PTR [rip+0x5702f] # 0x5d120 0x00000000000060f1 <+657>: vpermw ymm0,ymm0,ymm1 0x00000000000060f7 <+663>: vpminsw ymm2,ymm1,ymm0 0x00000000000060fb <+667>: mov ax,0xdcc4 0x00000000000060ff <+671>: kmovd k1,eax 0x0000000000006103 <+675>: vpmaxsw ymm2{k1},ymm1,ymm0 0x0000000000006109 <+681>: vmovdqa ymm0,YMMWORD PTR [rip+0x5702f] # 0x5d140 0x0000000000006111 <+689>: vpermw ymm0,ymm0,ymm2 0x0000000000006117 <+695>: vpminsw ymm1,ymm2,ymm0 0x000000000000611b <+699>: mov ax,0xef08 0x000000000000611f <+703>: kmovd k1,eax 0x0000000000006123 <+707>: vpmaxsw ymm1{k1},ymm2,ymm0 0x0000000000006129 <+713>: vmovdqa ymm0,YMMWORD PTR [rip+0x5702f] # 0x5d160 0x0000000000006131 <+721>: vpermw ymm0,ymm0,ymm1 0x0000000000006137 <+727>: vpminsw ymm2,ymm1,ymm0 0x000000000000613b <+731>: mov ax,0xb552 0x000000000000613f <+735>: kmovd k1,eax 0x0000000000006143 <+739>: vpmaxsw ymm2{k1},ymm1,ymm0 0x0000000000006149 <+745>: vmovdqa ymm0,YMMWORD PTR [rip+0x5702f] # 0x5d180 0x0000000000006151 <+753>: vpermw ymm0,ymm0,ymm2 0x0000000000006157 <+759>: vpmaxsw ymm1,ymm2,ymm0 0x000000000000615b <+763>: mov ax,0x14d6 0x000000000000615f <+767>: kmovd k1,eax 0x0000000000006163 <+771>: vpminsw ymm1{k1},ymm2,ymm0 0x0000000000006169 <+777>: vmovdqa ymm0,YMMWORD PTR [rip+0x5702f] # 0x5d1a0 0x0000000000006171 <+785>: vpermw ymm0,ymm0,ymm1 0x0000000000006177 <+791>: vpmaxsw ymm2,ymm1,ymm0 0x000000000000617b <+795>: mov ax,0x24da 0x000000000000617f <+799>: kmovd k1,eax 0x0000000000006183 <+803>: vpminsw ymm2{k1},ymm1,ymm0 0x0000000000006189 <+809>: vpshufb ymm0,ymm2,YMMWORD PTR [rip+0x5702e] # 0x5d1c0 0x0000000000006192 <+818>: vpmaxsw ymm1,ymm2,ymm0 0x0000000000006196 <+822>: mov ax,0x1554 0x000000000000619a <+826>: kmovd k1,eax 0x000000000000619e <+830>: vpminsw ymm1{k1},ymm2,ymm0 0x00000000000061a4 <+836>: vmovdqa ymm0,YMMWORD PTR [rip+0x57034] # 0x5d1e0 0x00000000000061ac <+844>: vpermd ymm0,ymm0,ymm1 0x00000000000061b1 <+849>: vpminsw ymm2,ymm1,ymm0 0x00000000000061b5 <+853>: vpmaxsw ymm0,ymm1,ymm0 0x00000000000061b9 <+857>: vpblendd ymm1,ymm0,ymm2,0x14 0x00000000000061bf <+863>: vmovdqa ymm0,YMMWORD PTR [rip+0x57039] # 0x5d200 0x00000000000061c7 <+871>: vmovdqu YMMWORD PTR [rsp+0x130],ymm1 0x00000000000061d0 <+880>: vpermw ymm0,ymm0,ymm1 0x00000000000061d6 <+886>: vmovdqu YMMWORD PTR [rsp+0x280],ymm0 0x00000000000061df <+895>: mov bp,0xaa8 0x00000000000061e3 <+899>: vpxor xmm0,xmm0,xmm0 0x00000000000061e7 <+903>: vmovdqa XMMWORD PTR [rsp+0xe0],xmm0 0x00000000000061f0 <+912>: lea rsi,[rsp+0xe0] 0x00000000000061f8 <+920>: mov edi,0x1 0x00000000000061fd <+925>: vzeroupper 0x0000000000006200 <+928>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int16_32.asm --- 0x00000000000060bb <+603>: call 0x5470 <clock_gettime@plt> 0x00000000000060c0 <+608>: mov rbx,QWORD PTR [rsp+0xa0] 0x00000000000060c8 <+616>: mov rax,QWORD PTR [rsp+0xa8] 0x00000000000060d0 <+624>: mov QWORD PTR [rsp+0x150],rax 0x00000000000060d8 <+632>: vmovdqu64 zmm2,ZMMWORD PTR [rsp+0x110] 0x00000000000060e3 <+643>: vprold zmm0,zmm2,0x10 0x00000000000060ea <+650>: vpminsw zmm1,zmm2,zmm0 0x00000000000060f0 <+656>: mov eax,0xaaaaaaaa 0x00000000000060f5 <+661>: kmovd k1,eax 0x00000000000060f9 <+665>: vpmaxsw zmm1{k1},zmm2,zmm0 0x00000000000060ff <+671>: vpshufd zmm0,zmm1,0xb1 0x0000000000006106 <+678>: vpminsw zmm2,zmm1,zmm0 0x000000000000610c <+684>: mov eax,0xcccccccc 0x0000000000006111 <+689>: kmovd k1,eax 0x0000000000006115 <+693>: vpmaxsw zmm2{k1},zmm1,zmm0 0x000000000000611b <+699>: vpshufd zmm0,zmm2,0x4e 0x0000000000006122 <+706>: vpminsw zmm1,zmm2,zmm0 0x0000000000006128 <+712>: mov eax,0xf0f0f0f0 0x000000000000612d <+717>: kmovd k1,eax 0x0000000000006131 <+721>: vpmaxsw zmm1{k1},zmm2,zmm0 0x0000000000006137 <+727>: vpxor xmm0,xmm0,xmm0 0x000000000000613b <+731>: vpermq zmm0,zmm1,0x4e 0x0000000000006142 <+738>: vpminsw zmm2,zmm1,zmm0 0x0000000000006148 <+744>: mov eax,0xff00ff00 0x000000000000614d <+749>: kmovd k1,eax 0x0000000000006151 <+753>: vpmaxsw zmm2{k1},zmm1,zmm0 0x0000000000006157 <+759>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fdf] # 0x5d140 0x0000000000006161 <+769>: vpermw zmm0,zmm0,zmm2 0x0000000000006167 <+775>: vpminsw zmm1,zmm2,zmm0 0x000000000000616d <+781>: mov eax,0xf7117710 0x0000000000006172 <+786>: kmovd k1,eax 0x0000000000006176 <+790>: vpmaxsw zmm1{k1},zmm2,zmm0 0x000000000000617c <+796>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56ffa] # 0x5d180 0x0000000000006186 <+806>: vpermw zmm0,zmm0,zmm1 0x000000000000618c <+812>: vpmaxsw zmm2,zmm1,zmm0 0x0000000000006192 <+818>: mov eax,0x249a26da 0x0000000000006197 <+823>: kmovd k1,eax 0x000000000000619b <+827>: vpminsw zmm2{k1},zmm1,zmm0 0x00000000000061a1 <+833>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57015] # 0x5d1c0 0x00000000000061ab <+843>: vpermw zmm0,zmm0,zmm2 0x00000000000061b1 <+849>: vpmaxsw zmm1,zmm2,zmm0 0x00000000000061b7 <+855>: mov eax,0x2079be 0x00000000000061bc <+860>: kmovd k1,eax 0x00000000000061c0 <+864>: vpminsw zmm1{k1},zmm2,zmm0 0x00000000000061c6 <+870>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57030] # 0x5d200 0x00000000000061d0 <+880>: vpermw zmm0,zmm0,zmm1 0x00000000000061d6 <+886>: vpmaxsw zmm2,zmm1,zmm0 0x00000000000061dc <+892>: mov eax,0x40edf8 0x00000000000061e1 <+897>: kmovd k1,eax 0x00000000000061e5 <+901>: vpminsw zmm2{k1},zmm1,zmm0 0x00000000000061eb <+907>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5704b] # 0x5d240 0x00000000000061f5 <+917>: vpermw zmm0,zmm0,zmm2 0x00000000000061fb <+923>: vpmaxsw zmm1,zmm2,zmm0 0x0000000000006201 <+929>: mov eax,0x880deaa 0x0000000000006206 <+934>: kmovd k1,eax 0x000000000000620a <+938>: vpminsw zmm1{k1},zmm2,zmm0 0x0000000000006210 <+944>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57066] # 0x5d280 0x000000000000621a <+954>: vpermw zmm0,zmm0,zmm1 0x0000000000006220 <+960>: vpmaxsw zmm2,zmm1,zmm0 0x0000000000006226 <+966>: mov eax,0x480fa84 0x000000000000622b <+971>: kmovd k1,eax 0x000000000000622f <+975>: vpminsw zmm2{k1},zmm1,zmm0 0x0000000000006235 <+981>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57081] # 0x5d2c0 0x000000000000623f <+991>: vpermw zmm0,zmm0,zmm2 0x0000000000006245 <+997>: vpmaxsw zmm1,zmm2,zmm0 0x000000000000624b <+1003>: mov eax,0x818e644 0x0000000000006250 <+1008>: kmovd k1,eax 0x0000000000006254 <+1012>: vpminsw zmm1{k1},zmm2,zmm0 0x000000000000625a <+1018>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5709c] # 0x5d300 0x0000000000006264 <+1028>: vpermw zmm0,zmm0,zmm1 0x000000000000626a <+1034>: vpmaxsw zmm2,zmm1,zmm0 0x0000000000006270 <+1040>: mov eax,0x22ccb20 0x0000000000006275 <+1045>: kmovd k1,eax 0x0000000000006279 <+1049>: vpminsw zmm2{k1},zmm1,zmm0 0x000000000000627f <+1055>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570b7] # 0x5d340 0x0000000000006289 <+1065>: vpermw zmm0,zmm0,zmm2 0x000000000000628f <+1071>: vpmaxsw zmm1,zmm2,zmm0 0x0000000000006295 <+1077>: mov eax,0x54aad48 0x000000000000629a <+1082>: kmovd k1,eax 0x000000000000629e <+1086>: vpminsw zmm1{k1},zmm2,zmm0 0x00000000000062a4 <+1092>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570d2] # 0x5d380 0x00000000000062ae <+1102>: vmovdqu64 ZMMWORD PTR [rsp+0x270],zmm1 0x00000000000062b9 <+1113>: vpermw zmm0,zmm0,zmm1 0x00000000000062bf <+1119>: vmovdqu64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x00000000000062c7 <+1127>: mov ebp,0xaaaaaa8 0x00000000000062cc <+1132>: vpxor xmm0,xmm0,xmm0 0x00000000000062d0 <+1136>: vmovdqa XMMWORD PTR [rsp+0xc0],xmm0 0x00000000000062d9 <+1145>: lea rsi,[rsp+0xc0] 0x00000000000062e1 <+1153>: mov edi,0x1 0x00000000000062e6 <+1158>: vzeroupper 0x00000000000062e9 <+1161>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int16_64.asm --- 0x0000000000006100 <+640>: call 0x5470 <clock_gettime@plt> 0x0000000000006105 <+645>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x140] 0x000000000000610d <+653>: vpshufd zmm0,zmm5,0xb1 0x0000000000006114 <+660>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x180] 0x000000000000611c <+668>: vpshufd zmm1,zmm4,0xb1 0x0000000000006123 <+675>: vpminsw zmm2,zmm4,zmm1 0x0000000000006129 <+681>: vpminsw zmm3,zmm5,zmm0 0x000000000000612f <+687>: mov eax,0xcccccccc 0x0000000000006134 <+692>: kmovd k1,eax 0x0000000000006138 <+696>: vpmaxsw zmm3{k1},zmm5,zmm0 0x000000000000613e <+702>: vpmaxsw zmm2{k1},zmm4,zmm1 0x0000000000006144 <+708>: vprold zmm0,zmm2,0x10 0x000000000000614b <+715>: vprold zmm1,zmm3,0x10 0x0000000000006152 <+722>: vpminsw zmm4,zmm3,zmm1 0x0000000000006158 <+728>: vpminsw zmm5,zmm2,zmm0 0x000000000000615e <+734>: mov eax,0xaaaaaaaa 0x0000000000006163 <+739>: kmovd k1,eax 0x0000000000006167 <+743>: vpmaxsw zmm5{k1},zmm2,zmm0 0x000000000000616d <+749>: vpmaxsw zmm4{k1},zmm3,zmm1 0x0000000000006173 <+755>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f83] # 0x5d100 0x000000000000617d <+765>: vpermi2w zmm0,zmm5,zmm4 0x0000000000006183 <+771>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56fb3] # 0x5d140 0x000000000000618d <+781>: vpermi2w zmm1,zmm4,zmm5 0x0000000000006193 <+787>: vpmaxsw zmm2,zmm4,zmm1 0x0000000000006199 <+793>: mov eax,0x2222bb2b 0x000000000000619e <+798>: kmovd k1,eax 0x00000000000061a2 <+802>: vpminsw zmm2{k1},zmm4,zmm1 0x00000000000061a8 <+808>: vpminsw zmm1,zmm5,zmm0 0x00000000000061ae <+814>: mov eax,0xd4dd4444 0x00000000000061b3 <+819>: kmovd k1,eax 0x00000000000061b7 <+823>: vpmaxsw zmm1{k1},zmm5,zmm0 0x00000000000061bd <+829>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fb9] # 0x5d180 0x00000000000061c7 <+839>: vpermi2w zmm0,zmm1,zmm2 0x00000000000061cd <+845>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x56fe9] # 0x5d1c0 0x00000000000061d7 <+855>: vpermi2w zmm3,zmm2,zmm1 0x00000000000061dd <+861>: vpmaxsw zmm4,zmm2,zmm3 0x00000000000061e3 <+867>: mov eax,0x90669f 0x00000000000061e8 <+872>: kmovd k1,eax 0x00000000000061ec <+876>: vpminsw zmm4{k1},zmm2,zmm3 0x00000000000061f2 <+882>: vpminsw zmm2,zmm1,zmm0 0x00000000000061f8 <+888>: mov eax,0xf9660900 0x00000000000061fd <+893>: kmovd k1,eax 0x0000000000006201 <+897>: vpmaxsw zmm2{k1},zmm1,zmm0 0x0000000000006207 <+903>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fef] # 0x5d200 0x0000000000006211 <+913>: vpermi2w zmm0,zmm2,zmm4 0x0000000000006217 <+919>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5701f] # 0x5d240 0x0000000000006221 <+929>: vpermi2w zmm1,zmm2,zmm4 0x0000000000006227 <+935>: vpmaxsw zmm3,zmm4,zmm1 0x000000000000622d <+941>: mov eax,0x690066 0x0000000000006232 <+946>: kmovd k1,eax 0x0000000000006236 <+950>: vpminsw zmm3{k1},zmm4,zmm1 0x000000000000623c <+956>: vpminsw zmm1,zmm2,zmm0 0x0000000000006242 <+962>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57074] # 0x5d2c0 0x000000000000624c <+972>: vpermi2w zmm4,zmm1,zmm3 0x0000000000006252 <+978>: mov eax,0x66009600 0x0000000000006257 <+983>: kmovd k1,eax 0x000000000000625b <+987>: vpmaxsw zmm1{k1},zmm2,zmm0 0x0000000000006261 <+993>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57015] # 0x5d280 0x000000000000626b <+1003>: vpermi2w zmm0,zmm1,zmm3 0x0000000000006271 <+1009>: vpmaxsw zmm2,zmm3,zmm0 0x0000000000006277 <+1015>: mov eax,0x9069090 0x000000000000627c <+1020>: kmovd k1,eax 0x0000000000006280 <+1024>: vpminsw zmm2{k1},zmm3,zmm0 0x0000000000006286 <+1030>: vpminsw zmm0,zmm1,zmm4 0x000000000000628c <+1036>: mov eax,0x9096090 0x0000000000006291 <+1041>: kmovd k1,eax 0x0000000000006295 <+1045>: vpmaxsw zmm0{k1},zmm1,zmm4 0x000000000000629b <+1051>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5705b] # 0x5d300 0x00000000000062a5 <+1061>: vpermi2w zmm1,zmm0,zmm2 0x00000000000062ab <+1067>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5708b] # 0x5d340 0x00000000000062b5 <+1077>: vpermi2w zmm3,zmm2,zmm0 0x00000000000062bb <+1083>: vpmaxsw zmm4,zmm2,zmm3 0x00000000000062c1 <+1089>: mov eax,0x6096960 0x00000000000062c6 <+1094>: kmovd k1,eax 0x00000000000062ca <+1098>: vpminsw zmm4{k1},zmm2,zmm3 0x00000000000062d0 <+1104>: vpminsw zmm2,zmm0,zmm1 0x00000000000062d6 <+1110>: mov eax,0x6969069 0x00000000000062db <+1115>: kmovd k1,eax 0x00000000000062df <+1119>: vpmaxsw zmm2{k1},zmm0,zmm1 0x00000000000062e5 <+1125>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57091] # 0x5d380 0x00000000000062ef <+1135>: vpermi2w zmm0,zmm2,zmm4 0x00000000000062f5 <+1141>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570c1] # 0x5d3c0 0x00000000000062ff <+1151>: vpermi2w zmm1,zmm4,zmm2 0x0000000000006305 <+1157>: vpmaxsw zmm3,zmm4,zmm1 0x000000000000630b <+1163>: vpminsw zmm5,zmm2,zmm0 0x0000000000006311 <+1169>: mov eax,0xf0690f 0x0000000000006316 <+1174>: kmovd k1,eax 0x000000000000631a <+1178>: vpmaxsw zmm5{k1},zmm2,zmm0 0x0000000000006320 <+1184>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57116] # 0x5d440 0x000000000000632a <+1194>: vpermi2w zmm0,zmm5,zmm3 0x0000000000006330 <+1200>: mov eax,0x960f00 0x0000000000006335 <+1205>: kmovd k1,eax 0x0000000000006339 <+1209>: vpminsw zmm3{k1},zmm4,zmm1 0x000000000000633f <+1215>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570b7] # 0x5d400 0x0000000000006349 <+1225>: vpermi2w zmm1,zmm3,zmm5 0x000000000000634f <+1231>: vpmaxsw zmm2,zmm3,zmm1 0x0000000000006355 <+1237>: mov eax,0x690f09 0x000000000000635a <+1242>: kmovd k1,eax 0x000000000000635e <+1246>: vpminsw zmm2{k1},zmm3,zmm1 0x0000000000006364 <+1252>: vpmaxsw zmm1,zmm5,zmm0 0x000000000000636a <+1258>: mov eax,0x6f0f6960 0x000000000000636f <+1263>: kmovd k1,eax 0x0000000000006373 <+1267>: vpminsw zmm1{k1},zmm5,zmm0 0x0000000000006379 <+1273>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570fd] # 0x5d480 0x0000000000006383 <+1283>: vpermw zmm0,zmm0,zmm2 0x0000000000006389 <+1289>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5712d] # 0x5d4c0 0x0000000000006393 <+1299>: vpermw zmm3,zmm3,zmm1 0x0000000000006399 <+1305>: vpminsw zmm4,zmm2,zmm0 0x000000000000639f <+1311>: vpmaxsw zmm0,zmm2,zmm0 0x00000000000063a5 <+1317>: mov eax,0x6069f 0x00000000000063aa <+1322>: kmovd k1,eax 0x00000000000063ae <+1326>: vmovdqu16 zmm0{k1},zmm4 0x00000000000063b4 <+1332>: vpmaxsw zmm2,zmm1,zmm3 0x00000000000063ba <+1338>: mov eax,0x69f0600 0x00000000000063bf <+1343>: kmovd k1,eax 0x00000000000063c3 <+1347>: vpminsw zmm2{k1},zmm1,zmm3 0x00000000000063c9 <+1353>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5712d] # 0x5d500 0x00000000000063d3 <+1363>: vpermi2w zmm1,zmm0,zmm2 0x00000000000063d9 <+1369>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5715d] # 0x5d540 0x00000000000063e3 <+1379>: vpermi2w zmm3,zmm2,zmm4 0x00000000000063e9 <+1385>: vpmaxsw zmm4,zmm0,zmm1 0x00000000000063ef <+1391>: mov eax,0x90f6 0x00000000000063f4 <+1396>: kmovd k1,eax 0x00000000000063f8 <+1400>: vpminsw zmm4{k1},zmm0,zmm1 0x00000000000063fe <+1406>: vpmaxsw zmm0,zmm2,zmm3 0x0000000000006404 <+1412>: mov eax,0x90f69000 0x0000000000006409 <+1417>: kmovd k1,eax 0x000000000000640d <+1421>: vpminsw zmm0{k1},zmm2,zmm3 0x0000000000006413 <+1427>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57163] # 0x5d580 0x000000000000641d <+1437>: vpermi2w zmm1,zmm0,zmm4 0x0000000000006423 <+1443>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57193] # 0x5d5c0 0x000000000000642d <+1453>: vpermi2w zmm2,zmm4,zmm0 0x0000000000006433 <+1459>: vpmaxsw zmm3,zmm4,zmm2 0x0000000000006439 <+1465>: mov eax,0xe8e0 0x000000000000643e <+1470>: kmovd k1,eax 0x0000000000006442 <+1474>: vpminsw zmm3{k1},zmm4,zmm2 0x0000000000006448 <+1480>: vpmaxsw zmm2,zmm0,zmm1 0x000000000000644e <+1486>: mov eax,0xe8e06666 0x0000000000006453 <+1491>: kmovd k1,eax 0x0000000000006457 <+1495>: vpminsw zmm2{k1},zmm0,zmm1 0x000000000000645d <+1501>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57199] # 0x5d600 0x0000000000006467 <+1511>: vpermi2w zmm0,zmm2,zmm3 0x000000000000646d <+1517>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x571c9] # 0x5d640 0x0000000000006477 <+1527>: vpermi2w zmm1,zmm3,zmm2 0x000000000000647d <+1533>: vpmaxsw zmm4,zmm3,zmm1 0x0000000000006483 <+1539>: vpminsw zmm5,zmm2,zmm0 0x0000000000006489 <+1545>: mov eax,0xb3931331 0x000000000000648e <+1550>: kmovd k1,eax 0x0000000000006492 <+1554>: vpmaxsw zmm5{k1},zmm2,zmm0 0x0000000000006498 <+1560>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5721e] # 0x5d6c0 0x00000000000064a2 <+1570>: vpermi2w zmm0,zmm5,zmm4 0x00000000000064a8 <+1576>: mov eax,0x8880088 0x00000000000064ad <+1581>: kmovd k1,eax 0x00000000000064b1 <+1585>: vpminsw zmm4{k1},zmm3,zmm1 0x00000000000064b7 <+1591>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x571bf] # 0x5d680 0x00000000000064c1 <+1601>: vpermi2w zmm1,zmm4,zmm5 0x00000000000064c7 <+1607>: vpmaxsw zmm2,zmm4,zmm1 0x00000000000064cd <+1613>: mov eax,0xa00ca4c 0x00000000000064d2 <+1618>: kmovd k1,eax 0x00000000000064d6 <+1622>: vpminsw zmm2{k1},zmm4,zmm1 0x00000000000064dc <+1628>: vpmaxsw zmm1,zmm5,zmm0 0x00000000000064e2 <+1634>: mov eax,0xc48cd9ac 0x00000000000064e7 <+1639>: kmovd k1,eax 0x00000000000064eb <+1643>: vpminsw zmm1{k1},zmm5,zmm0 0x00000000000064f1 <+1649>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57205] # 0x5d700 0x00000000000064fb <+1659>: vpermi2w zmm0,zmm2,zmm1 0x0000000000006501 <+1665>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57235] # 0x5d740 0x000000000000650b <+1675>: vpermi2w zmm3,zmm1,zmm2 0x0000000000006511 <+1681>: vpmaxsw zmm4,zmm1,zmm3 0x0000000000006517 <+1687>: mov eax,0x88ca8888 0x000000000000651c <+1692>: kmovd k1,eax 0x0000000000006520 <+1696>: vpminsw zmm4{k1},zmm1,zmm3 0x0000000000006526 <+1702>: vpmaxsw zmm1,zmm2,zmm0 0x000000000000652c <+1708>: mov eax,0x2466 0x0000000000006531 <+1713>: kmovd k1,eax 0x0000000000006535 <+1717>: vpminsw zmm1{k1},zmm2,zmm0 0x000000000000653b <+1723>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5723b] # 0x5d780 0x0000000000006545 <+1733>: vpermi2w zmm0,zmm1,zmm4 0x000000000000654b <+1739>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5726b] # 0x5d7c0 0x0000000000006555 <+1749>: vpermi2w zmm2,zmm4,zmm1 0x000000000000655b <+1755>: vpmaxsw zmm3,zmm4,zmm2 0x0000000000006561 <+1761>: mov eax,0xeeca8888 0x0000000000006566 <+1766>: kmovd k1,eax 0x000000000000656a <+1770>: vpminsw zmm3{k1},zmm4,zmm2 0x0000000000006570 <+1776>: vpmaxsw zmm2,zmm1,zmm0 0x0000000000006576 <+1782>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x572c0] # 0x5d840 0x0000000000006580 <+1792>: vpermi2w zmm4,zmm3,zmm2 0x0000000000006586 <+1798>: mov eax,0xac88 0x000000000000658b <+1803>: kmovd k1,eax 0x000000000000658f <+1807>: vpminsw zmm2{k1},zmm1,zmm0 0x0000000000006595 <+1813>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57261] # 0x5d800 0x000000000000659f <+1823>: vpermi2w zmm0,zmm2,zmm3 0x00000000000065a5 <+1829>: vpmaxsw zmm1,zmm2,zmm0 0x00000000000065ab <+1835>: mov eax,0x44caaa 0x00000000000065b0 <+1840>: kmovd k1,eax 0x00000000000065b4 <+1844>: vpminsw zmm1{k1},zmm2,zmm0 0x00000000000065ba <+1850>: vpmaxsw zmm0,zmm3,zmm4 0x00000000000065c0 <+1856>: mov eax,0xaaaccc88 0x00000000000065c5 <+1861>: kmovd k1,eax 0x00000000000065c9 <+1865>: vpminsw zmm0{k1},zmm3,zmm4 0x00000000000065cf <+1871>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x572a7] # 0x5d880 0x00000000000065d9 <+1881>: vpermi2w zmm2,zmm1,zmm0 0x00000000000065df <+1887>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x572d7] # 0x5d8c0 0x00000000000065e9 <+1897>: vpermi2w zmm3,zmm0,zmm1 0x00000000000065ef <+1903>: vpmaxsw zmm4,zmm0,zmm3 0x00000000000065f5 <+1909>: mov eax,0xcaacaa88 0x00000000000065fa <+1914>: kmovd k1,eax 0x00000000000065fe <+1918>: vpminsw zmm4{k1},zmm0,zmm3 0x0000000000006604 <+1924>: vpmaxsw zmm0,zmm1,zmm2 0x000000000000660a <+1930>: mov eax,0xaacaac 0x000000000000660f <+1935>: kmovd k1,eax 0x0000000000006613 <+1939>: vpminsw zmm0{k1},zmm1,zmm2 0x0000000000006619 <+1945>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x572dd] # 0x5d900 0x0000000000006623 <+1955>: vpermi2w zmm1,zmm0,zmm4 0x0000000000006629 <+1961>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5730d] # 0x5d940 0x0000000000006633 <+1971>: vpermi2w zmm2,zmm4,zmm0 0x0000000000006639 <+1977>: vpmaxsw zmm3,zmm4,zmm2 0x000000000000663f <+1983>: mov eax,0xaccaccc8 0x0000000000006644 <+1988>: kmovd k1,eax 0x0000000000006648 <+1992>: vpminsw zmm3{k1},zmm4,zmm2 0x000000000000664e <+1998>: vpmaxsw zmm2,zmm0,zmm1 0x0000000000006654 <+2004>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57362] # 0x5d9c0 0x000000000000665e <+2014>: vpermi2w zmm4,zmm3,zmm2 0x0000000000006664 <+2020>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm4 0x000000000000666c <+2028>: mov eax,0x4ccacca 0x0000000000006671 <+2033>: kmovd k1,eax 0x0000000000006675 <+2037>: vpminsw zmm2{k1},zmm0,zmm1 0x000000000000667b <+2043>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x572fb] # 0x5d980 0x0000000000006685 <+2053>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm3 0x000000000000668d <+2061>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm2 0x0000000000006695 <+2069>: vpermi2w zmm0,zmm2,zmm3 0x000000000000669b <+2075>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm0 0x00000000000066a3 <+2083>: mov rbx,QWORD PTR [rsp+0xd0] 0x00000000000066ab <+2091>: mov rax,QWORD PTR [rsp+0xd8] 0x00000000000066b3 <+2099>: mov QWORD PTR [rsp+0x1d0],rax 0x00000000000066bb <+2107>: vpxor xmm0,xmm0,xmm0 0x00000000000066bf <+2111>: vmovdqa XMMWORD PTR [rsp+0xf0],xmm0 0x00000000000066c8 <+2120>: lea rsi,[rsp+0xf0] 0x00000000000066d0 <+2128>: mov edi,0x1 0x00000000000066d5 <+2133>: vzeroupper 0x00000000000066d8 <+2136>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int16_8.asm --- 0x0000000000006072 <+562>: call 0x5470 <clock_gettime@plt> 0x0000000000006077 <+567>: mov rbx,QWORD PTR [rsp+0xb0] 0x000000000000607f <+575>: mov r12,QWORD PTR [rsp+0xb8] 0x0000000000006087 <+583>: vmovdqa xmm2,XMMWORD PTR [rsp] 0x000000000000608c <+588>: vpshufd xmm0,xmm2,0xb1 0x0000000000006091 <+593>: vpminsw xmm1,xmm2,xmm0 0x0000000000006095 <+597>: vpmaxsw xmm0,xmm2,xmm0 0x0000000000006099 <+601>: vpblendd xmm0,xmm1,xmm0,0xa 0x000000000000609f <+607>: vpshufd xmm1,xmm0,0x4e 0x00000000000060a4 <+612>: vpminsw xmm2,xmm0,xmm1 0x00000000000060a8 <+616>: vpmaxsw xmm0,xmm0,xmm1 0x00000000000060ac <+620>: vpblendd xmm0,xmm2,xmm0,0xc 0x00000000000060b2 <+626>: vprold xmm1,xmm0,0x10 0x00000000000060b9 <+633>: vpminsw xmm2,xmm0,xmm1 0x00000000000060bd <+637>: vpmaxsw xmm0,xmm0,xmm1 0x00000000000060c1 <+641>: vpblendw xmm0,xmm2,xmm0,0xaa 0x00000000000060c7 <+647>: vpshufd xmm1,xmm0,0xd8 0x00000000000060cc <+652>: vpminsw xmm2,xmm0,xmm1 0x00000000000060d0 <+656>: vpmaxsw xmm0,xmm0,xmm1 0x00000000000060d4 <+660>: vpblendd xmm0,xmm0,xmm2,0x2 0x00000000000060da <+666>: vpshufb xmm1,xmm0,XMMWORD PTR [rip+0x5701d] # 0x5d100 0x00000000000060e3 <+675>: vpminsw xmm2,xmm0,xmm1 0x00000000000060e7 <+679>: vpmaxsw xmm0,xmm0,xmm1 0x00000000000060eb <+683>: vpblendw xmm0,xmm0,xmm2,0xa 0x00000000000060f1 <+689>: vpshufb xmm1,xmm0,XMMWORD PTR [rip+0x57016] # 0x5d110 0x00000000000060fa <+698>: vpminsw xmm2,xmm0,xmm1 0x00000000000060fe <+702>: vmovdqa XMMWORD PTR [rsp],xmm2 0x0000000000006103 <+707>: vpmaxsw xmm0,xmm0,xmm1 0x0000000000006107 <+711>: vmovdqa XMMWORD PTR [rsp+0x230],xmm0 0x0000000000006110 <+720>: vpxor xmm0,xmm0,xmm0 0x0000000000006114 <+724>: vmovdqa XMMWORD PTR [rsp+0xd0],xmm0 0x000000000000611d <+733>: lea rsi,[rsp+0xd0] 0x0000000000006125 <+741>: mov edi,0x1 0x000000000000612a <+746>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int32_128.asm --- 0x0000000000006300 <+960>: call 0x5470 <clock_gettime@plt> 0x0000000000006305 <+965>: vmovdqa64 zmm17,ZMMWORD PTR [rsp+0x140] 0x000000000000630d <+973>: vpshufd zmm0,zmm17,0x4e 0x0000000000006314 <+980>: vmovdqa64 zmm19,ZMMWORD PTR [rsp+0x400] 0x000000000000631c <+988>: vpshufd zmm1,zmm19,0x4e 0x0000000000006323 <+995>: vmovdqa64 zmm21,ZMMWORD PTR [rsp+0x380] 0x000000000000632b <+1003>: vpshufd zmm2,zmm21,0x4e 0x0000000000006332 <+1010>: vmovdqa64 zmm16,ZMMWORD PTR [rsp+0x180] 0x000000000000633a <+1018>: vpshufd zmm3,zmm16,0x4e 0x0000000000006341 <+1025>: vmovdqa64 zmm20,ZMMWORD PTR [rsp+0x3c0] 0x0000000000006349 <+1033>: vpshufd zmm4,zmm20,0x4e 0x0000000000006350 <+1040>: vmovdqa64 zmm18,ZMMWORD PTR [rsp+0x440] 0x0000000000006358 <+1048>: vpshufd zmm5,zmm18,0x4e 0x000000000000635f <+1055>: vmovdqa64 zmm22,ZMMWORD PTR [rsp+0x340] 0x0000000000006367 <+1063>: vpshufd zmm6,zmm22,0x4e 0x000000000000636e <+1070>: vmovdqa64 zmm23,ZMMWORD PTR [rsp+0x300] 0x0000000000006376 <+1078>: vpshufd zmm7,zmm23,0x4e 0x000000000000637d <+1085>: vpminsd zmm8,zmm23,zmm7 0x0000000000006383 <+1091>: vpminsd zmm9,zmm22,zmm6 0x0000000000006389 <+1097>: vpminsd zmm10,zmm18,zmm5 0x000000000000638f <+1103>: vpminsd zmm11,zmm20,zmm4 0x0000000000006395 <+1109>: vpminsd zmm12,zmm16,zmm3 0x000000000000639b <+1115>: vpminsd zmm13,zmm21,zmm2 0x00000000000063a1 <+1121>: vpminsd zmm14,zmm19,zmm1 0x00000000000063a7 <+1127>: vpminsd zmm15,zmm17,zmm0 0x00000000000063ad <+1133>: vpmaxsd zmm7,zmm23,zmm7 0x00000000000063b3 <+1139>: vpmaxsd zmm6,zmm22,zmm6 0x00000000000063b9 <+1145>: vpmaxsd zmm5,zmm18,zmm5 0x00000000000063bf <+1151>: vpmaxsd zmm4,zmm20,zmm4 0x00000000000063c5 <+1157>: vpmaxsd zmm3,zmm16,zmm3 0x00000000000063cb <+1163>: vpmaxsd zmm2,zmm21,zmm2 0x00000000000063d1 <+1169>: vpmaxsd zmm1,zmm19,zmm1 0x00000000000063d7 <+1175>: vpmaxsd zmm0,zmm17,zmm0 0x00000000000063dd <+1181>: vshufps zmm16,zmm15,zmm0,0xe4 0x00000000000063e4 <+1188>: vshufps zmm17,zmm14,zmm1,0xe4 0x00000000000063eb <+1195>: vshufps zmm18,zmm13,zmm2,0xe4 0x00000000000063f2 <+1202>: vshufps zmm19,zmm12,zmm3,0xe4 0x00000000000063f9 <+1209>: vshufps zmm20,zmm11,zmm4,0xe4 0x0000000000006400 <+1216>: vshufps zmm21,zmm10,zmm5,0xe4 0x0000000000006407 <+1223>: vshufps zmm22,zmm9,zmm6,0xe4 0x000000000000640e <+1230>: vshufps zmm23,zmm8,zmm7,0xe4 0x0000000000006415 <+1237>: vshufps zmm0,zmm15,zmm0,0xb1 0x000000000000641c <+1244>: vshufps zmm14,zmm14,zmm1,0xb1 0x0000000000006423 <+1251>: vshufps zmm13,zmm13,zmm2,0xb1 0x000000000000642a <+1258>: vshufps zmm12,zmm12,zmm3,0xb1 0x0000000000006431 <+1265>: vshufps zmm11,zmm11,zmm4,0xb1 0x0000000000006438 <+1272>: vshufps zmm10,zmm10,zmm5,0xb1 0x000000000000643f <+1279>: vshufps zmm9,zmm9,zmm6,0xb1 0x0000000000006446 <+1286>: vshufps zmm8,zmm8,zmm7,0xb1 0x000000000000644d <+1293>: vpminsd zmm1,zmm23,zmm8 0x0000000000006453 <+1299>: vpminsd zmm2,zmm22,zmm9 0x0000000000006459 <+1305>: vpminsd zmm24,zmm21,zmm10 0x000000000000645f <+1311>: vpminsd zmm4,zmm20,zmm11 0x0000000000006465 <+1317>: vpminsd zmm6,zmm19,zmm12 0x000000000000646b <+1323>: vpminsd zmm5,zmm18,zmm13 0x0000000000006471 <+1329>: vpminsd zmm7,zmm17,zmm14 0x0000000000006477 <+1335>: vpminsd zmm3,zmm16,zmm0 0x000000000000647d <+1341>: mov ax,0xaaaa 0x0000000000006481 <+1345>: kmovd k6,eax 0x0000000000006485 <+1349>: vpmaxsd zmm3{k6},zmm16,zmm0 0x000000000000648b <+1355>: vpmaxsd zmm7{k6},zmm17,zmm14 0x0000000000006491 <+1361>: vpmaxsd zmm5{k6},zmm18,zmm13 0x0000000000006497 <+1367>: vpmaxsd zmm6{k6},zmm19,zmm12 0x000000000000649d <+1373>: vpmaxsd zmm4{k6},zmm20,zmm11 0x00000000000064a3 <+1379>: vpmaxsd zmm24{k6},zmm21,zmm10 0x00000000000064a9 <+1385>: vpmaxsd zmm2{k6},zmm22,zmm9 0x00000000000064af <+1391>: vpmaxsd zmm1{k6},zmm23,zmm8 0x00000000000064b5 <+1397>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58cc1] # 0x5f180 0x00000000000064bf <+1407>: vmovdqa64 zmm11,zmm2 0x00000000000064c5 <+1413>: vpermt2d zmm11,zmm9,zmm1 0x00000000000064cb <+1419>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58ceb] # 0x5f1c0 0x00000000000064d5 <+1429>: vpermt2d zmm11,zmm0,zmm24 0x00000000000064db <+1435>: vpermi2d zmm9,zmm6,zmm4 0x00000000000064e1 <+1441>: vpermt2d zmm9,zmm0,zmm5 0x00000000000064e7 <+1447>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x58d0f] # 0x5f200 0x00000000000064f1 <+1457>: vmovdqa64 zmm8,zmm7 0x00000000000064f7 <+1463>: vpermt2d zmm8,zmm14,zmm5 0x00000000000064fd <+1469>: vpermi2d zmm14,zmm3,zmm24 0x0000000000006503 <+1475>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x58d33] # 0x5f240 0x000000000000650d <+1485>: vmovdqa64 zmm12,zmm4 0x0000000000006513 <+1491>: vpermt2d zmm12,zmm10,zmm6 0x0000000000006519 <+1497>: vshufi64x2 zmm15,zmm6,zmm7,0xbe 0x0000000000006520 <+1504>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58d56] # 0x5f280 0x000000000000652a <+1514>: vpermt2d zmm15,zmm0,zmm5 0x0000000000006530 <+1520>: vpermi2d zmm10,zmm1,zmm2 0x0000000000006536 <+1526>: vshufi64x2 zmm13,zmm2,zmm3,0xbe 0x000000000000653d <+1533>: vpermt2d zmm13,zmm0,zmm24 0x0000000000006543 <+1539>: vpmaxsd zmm18,zmm24,zmm13 0x0000000000006549 <+1545>: mov ax,0x2222 0x000000000000654d <+1549>: kmovd k2,eax 0x0000000000006551 <+1553>: vmovdqa64 zmm0,zmm18 0x0000000000006557 <+1559>: vpminsd zmm0{k2},zmm24,zmm13 0x000000000000655d <+1565>: vpmaxsd zmm19,zmm1,zmm10 0x0000000000006563 <+1571>: mov ax,0x2b22 0x0000000000006567 <+1575>: kmovd k1,eax 0x000000000000656b <+1579>: vmovdqa64 zmm13,zmm19 0x0000000000006571 <+1585>: vpminsd zmm13{k1},zmm1,zmm10 0x0000000000006577 <+1591>: vpmaxsd zmm16,zmm5,zmm15 0x000000000000657d <+1597>: vpminsd zmm20,zmm7,zmm8 0x0000000000006583 <+1603>: mov ax,0x44d4 0x0000000000006587 <+1607>: kmovd k3,eax 0x000000000000658b <+1611>: vmovdqa64 zmm1,zmm20 0x0000000000006591 <+1617>: vpmaxsd zmm1{k3},zmm7,zmm8 0x0000000000006597 <+1623>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x58ddf] # 0x5f380 0x00000000000065a1 <+1633>: vmovdqa64 zmm7,zmm1 0x00000000000065a7 <+1639>: vpermt2d zmm7,zmm10,zmm16 0x00000000000065ad <+1645>: vmovdqa64 zmm8,zmm16 0x00000000000065b3 <+1651>: vpminsd zmm8{k2},zmm5,zmm15 0x00000000000065b9 <+1657>: vpmaxsd zmm15,zmm4,zmm12 0x00000000000065bf <+1663>: vpminsd zmm21,zmm6,zmm9 0x00000000000065c5 <+1669>: mov ax,0x4444 0x00000000000065c9 <+1673>: kmovd k4,eax 0x00000000000065cd <+1677>: vmovdqa64 zmm5,zmm21 0x00000000000065d3 <+1683>: vpmaxsd zmm5{k4},zmm6,zmm9 0x00000000000065d9 <+1689>: mov ax,0x966 0x00000000000065dd <+1693>: kmovd k2,eax 0x00000000000065e1 <+1697>: vshufi32x4 zmm7{k2},zmm5,zmm15,0xde 0x00000000000065e8 <+1704>: vmovdqa64 zmm6,zmm15 0x00000000000065ee <+1710>: vpminsd zmm6{k1},zmm4,zmm12 0x00000000000065f4 <+1716>: vpminsd zmm15,zmm3,zmm14 0x00000000000065fa <+1722>: vpminsd zmm4,zmm2,zmm11 0x0000000000006600 <+1728>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58cb6] # 0x5f2c0 0x000000000000660a <+1738>: vmovdqa64 zmm12,zmm6 0x0000000000006610 <+1744>: vpermt2d zmm12,zmm9,zmm21 0x0000000000006616 <+1750>: mov ax,0x6690 0x000000000000661a <+1754>: kmovd k1,eax 0x000000000000661e <+1758>: vpermi2d zmm9,zmm13,zmm4 0x0000000000006624 <+1764>: vshufi32x4 zmm9{k1},zmm15,zmm0,0x48 0x000000000000662b <+1771>: vpmaxsd zmm15{k3},zmm3,zmm14 0x0000000000006631 <+1777>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x58cc5] # 0x5f300 0x000000000000663b <+1787>: vmovdqa64 zmm16,zmm15 0x0000000000006641 <+1793>: vpermt2d zmm16,zmm17,zmm4 0x0000000000006647 <+1799>: vmovdqa64 zmm14,zmm4 0x000000000000664d <+1805>: vpmaxsd zmm14{k4},zmm2,zmm11 0x0000000000006653 <+1811>: vshufi32x4 zmm12{k1},zmm20,zmm8,0x48 0x000000000000665a <+1818>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58cdc] # 0x5f340 0x0000000000006664 <+1828>: vpermt2d zmm16,zmm2,zmm0 0x000000000000666a <+1834>: vpermi2d zmm17,zmm1,zmm21 0x0000000000006670 <+1840>: vpermt2d zmm17,zmm2,zmm8 0x0000000000006676 <+1846>: vpermi2d zmm10,zmm15,zmm18 0x000000000000667c <+1852>: vshufi32x4 zmm10{k2},zmm14,zmm19,0xde 0x0000000000006683 <+1859>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58d33] # 0x5f3c0 0x000000000000668d <+1869>: vmovdqa64 zmm3,zmm13 0x0000000000006693 <+1875>: vpermt2d zmm3,zmm2,zmm14 0x0000000000006699 <+1881>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58d5d] # 0x5f400 0x00000000000066a3 <+1891>: vpermt2d zmm3,zmm4,zmm0 0x00000000000066a9 <+1897>: vpermi2d zmm2,zmm6,zmm5 0x00000000000066af <+1903>: vpermt2d zmm2,zmm4,zmm8 0x00000000000066b5 <+1909>: vpminsd zmm18,zmm6,zmm2 0x00000000000066bb <+1915>: vpmaxsd zmm11,zmm6,zmm2 0x00000000000066c1 <+1921>: mov ax,0x699 0x00000000000066c5 <+1925>: kmovd k1,eax 0x00000000000066c9 <+1929>: vpblendmd zmm2{k1},zmm11,zmm18 0x00000000000066cf <+1935>: vpminsd zmm19,zmm13,zmm3 0x00000000000066d5 <+1941>: vpmaxsd zmm13,zmm13,zmm3 0x00000000000066db <+1947>: vpblendmd zmm3{k1},zmm13,zmm19 0x00000000000066e1 <+1953>: vpmaxsd zmm6,zmm0,zmm10 0x00000000000066e7 <+1959>: mov ax,0x90 0x00000000000066eb <+1963>: kmovd k1,eax 0x00000000000066ef <+1967>: vpmaxsd zmm20,zmm15,zmm16 0x00000000000066f5 <+1973>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x58ec1] # 0x5f5c0 0x00000000000066ff <+1983>: vmovdqa64 zmm4,zmm3 0x0000000000006705 <+1989>: vpermt2q zmm4,zmm21,zmm20 0x000000000000670b <+1995>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x58eeb] # 0x5f600 0x0000000000006715 <+2005>: vpermt2d zmm4,zmm22,zmm6 0x000000000000671b <+2011>: vpminsd zmm6{k1},zmm0,zmm10 0x0000000000006721 <+2017>: vpmaxsd zmm0,zmm8,zmm7 0x0000000000006727 <+2023>: vpmaxsd zmm23,zmm1,zmm17 0x000000000000672d <+2029>: vpermi2q zmm21,zmm2,zmm23 0x0000000000006733 <+2035>: vpermt2d zmm21,zmm22,zmm0 0x0000000000006739 <+2041>: vmovdqa64 zmm22,zmm0 0x000000000000673f <+2047>: vpminsd zmm22{k1},zmm8,zmm7 0x0000000000006745 <+2053>: vpminsd zmm0,zmm1,zmm17 0x000000000000674b <+2059>: vpminsd zmm17,zmm15,zmm16 0x0000000000006751 <+2065>: vpminsd zmm1,zmm14,zmm9 0x0000000000006757 <+2071>: vpminsd zmm10,zmm5,zmm12 0x000000000000675d <+2077>: mov ax,0x900 0x0000000000006761 <+2081>: kmovd k1,eax 0x0000000000006765 <+2085>: vmovdqa64 zmm7,zmm10 0x000000000000676b <+2091>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58d8b] # 0x5f500 0x0000000000006775 <+2101>: vpermt2q zmm11,zmm8,zmm10 0x000000000000677b <+2107>: vpmaxsd zmm10{k1},zmm5,zmm12 0x0000000000006781 <+2113>: vmovdqa64 zmm24,ZMMWORD PTR [rip+0x58cb5] # 0x5f440 0x000000000000678b <+2123>: vpermt2d zmm7,zmm24,zmm18 0x0000000000006791 <+2129>: vpermi2d zmm24,zmm1,zmm19 0x0000000000006797 <+2135>: vpermt2q zmm13,zmm8,zmm1 0x000000000000679d <+2141>: vmovdqa64 zmm18,zmm1 0x00000000000067a3 <+2147>: vpmaxsd zmm18{k1},zmm14,zmm9 0x00000000000067a9 <+2153>: mov ax,0x9960 0x00000000000067ad <+2157>: kmovd k1,eax 0x00000000000067b1 <+2161>: vpblendmd zmm15{k1},zmm17,zmm20 0x00000000000067b7 <+2167>: vpblendmd zmm12{k1},zmm0,zmm23 0x00000000000067bd <+2173>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58cb9] # 0x5f480 0x00000000000067c7 <+2183>: vpermt2d zmm7,zmm9,zmm12 0x00000000000067cd <+2189>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58ce9] # 0x5f4c0 0x00000000000067d7 <+2199>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x58d9f] # 0x5f580 0x00000000000067e1 <+2209>: vpermt2q zmm0,zmm14,zmm22 0x00000000000067e7 <+2215>: vpmaxsd zmm5,zmm22,zmm21 0x00000000000067ed <+2221>: mov ax,0x69 0x00000000000067f1 <+2225>: kmovd k1,eax 0x00000000000067f5 <+2229>: vmovdqa64 zmm1,zmm5 0x00000000000067fb <+2235>: vpminsd zmm1{k1},zmm22,zmm21 0x0000000000006801 <+2241>: vmovdqa64 zmm21,zmm22 0x0000000000006807 <+2247>: vpermt2d zmm21,zmm8,zmm12 0x000000000000680d <+2253>: mov ax,0x6606 0x0000000000006811 <+2257>: kmovd k2,eax 0x0000000000006815 <+2261>: vmovdqa32 zmm21{k2},zmm11 0x000000000000681b <+2267>: vpermt2d zmm24,zmm9,zmm15 0x0000000000006821 <+2273>: vpermi2d zmm8,zmm6,zmm15 0x0000000000006827 <+2279>: vmovdqa32 zmm8{k2},zmm13 0x000000000000682d <+2285>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x58d09] # 0x5f540 0x0000000000006837 <+2295>: vpminsd zmm9,zmm18,zmm24 0x000000000000683d <+2301>: mov ax,0x9600 0x0000000000006841 <+2305>: kmovd k2,eax 0x0000000000006845 <+2309>: vmovdqa64 zmm13,zmm9 0x000000000000684b <+2315>: vpmaxsd zmm13{k2},zmm18,zmm24 0x0000000000006851 <+2321>: vmovdqa64 zmm20,zmm18 0x0000000000006857 <+2327>: vpermt2d zmm20,zmm16,zmm3 0x000000000000685d <+2333>: vpermt2q zmm17,zmm14,zmm6 0x0000000000006863 <+2339>: mov ax,0x6066 0x0000000000006867 <+2343>: kmovd k3,eax 0x000000000000686b <+2347>: vmovdqa32 zmm20{k3},zmm17 0x0000000000006871 <+2353>: vpermi2d zmm16,zmm10,zmm2 0x0000000000006877 <+2359>: vmovdqa32 zmm16{k3},zmm0 0x000000000000687d <+2365>: vpmaxsd zmm17,zmm12,zmm16 0x0000000000006883 <+2371>: mov ax,0x66 0x0000000000006887 <+2375>: kmovd k3,eax 0x000000000000688b <+2379>: vpmaxsd zmm22,zmm15,zmm20 0x0000000000006891 <+2385>: vpmaxsd zmm19,zmm6,zmm4 0x0000000000006897 <+2391>: vpminsd zmm18,zmm3,zmm8 0x000000000000689d <+2397>: vpminsd zmm14,zmm2,zmm21 0x00000000000068a3 <+2403>: mov ax,0x6600 0x00000000000068a7 <+2407>: kmovd k4,eax 0x00000000000068ab <+2411>: vmovdqa64 zmm0,zmm14 0x00000000000068b1 <+2417>: vpmaxsd zmm0{k4},zmm2,zmm21 0x00000000000068b7 <+2423>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x58d7f] # 0x5f640 0x00000000000068c1 <+2433>: vmovdqa64 zmm11,zmm18 0x00000000000068c7 <+2439>: vpermt2q zmm11,zmm23,zmm9 0x00000000000068cd <+2445>: vmovdqa64 zmm24,ZMMWORD PTR [rip+0x58e69] # 0x5f740 0x00000000000068d7 <+2455>: vpermt2d zmm9,zmm24,zmm18 0x00000000000068dd <+2461>: vmovdqa64 zmm2,zmm18 0x00000000000068e3 <+2467>: vpmaxsd zmm2{k4},zmm3,zmm8 0x00000000000068e9 <+2473>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x58ecd] # 0x5f7c0 0x00000000000068f3 <+2483>: vmovdqa64 zmm8,zmm0 0x00000000000068f9 <+2489>: vpermt2d zmm8,zmm25,zmm17 0x00000000000068ff <+2495>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x58ef7] # 0x5f800 0x0000000000006909 <+2505>: vpermi2d zmm25,zmm2,zmm22 0x000000000000690f <+2511>: vpermt2d zmm25,zmm18,zmm19 0x0000000000006915 <+2517>: vmovdqa64 zmm26,zmm19 0x000000000000691b <+2523>: vpminsd zmm26{k1},zmm6,zmm4 0x0000000000006921 <+2529>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x58dd5] # 0x5f700 0x000000000000692b <+2539>: vmovdqa64 zmm21,zmm22 0x0000000000006931 <+2545>: vpermt2q zmm21,zmm19,zmm26 0x0000000000006937 <+2551>: vpermi2q zmm19,zmm17,zmm1 0x000000000000693d <+2557>: vpminsd zmm17{k3},zmm12,zmm16 0x0000000000006943 <+2563>: vmovdqa64 zmm12,zmm22 0x0000000000006949 <+2569>: vpminsd zmm12{k3},zmm15,zmm20 0x000000000000694f <+2575>: vpminsd zmm22,zmm10,zmm7 0x0000000000006955 <+2581>: vmovdqa64 zmm15,zmm22 0x000000000000695b <+2587>: vpermt2d zmm15,zmm24,zmm14 0x0000000000006961 <+2593>: vpermt2q zmm14,zmm23,zmm22 0x0000000000006967 <+2599>: vpmaxsd zmm22{k2},zmm10,zmm7 0x000000000000696d <+2605>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58d09] # 0x5f680 0x0000000000006977 <+2615>: vpminsd zmm6,zmm26,zmm25 0x000000000000697d <+2621>: vpmaxsd zmm4,zmm26,zmm25 0x0000000000006983 <+2627>: vmovdqa64 zmm7,zmm26 0x0000000000006989 <+2633>: vpermt2d zmm7,zmm3,zmm12 0x000000000000698f <+2639>: mov ax,0x999 0x0000000000006993 <+2643>: kmovd k2,eax 0x0000000000006997 <+2647>: vmovdqa32 zmm7{k2},zmm11 0x000000000000699d <+2653>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x58d19] # 0x5f6c0 0x00000000000069a7 <+2663>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x58dcf] # 0x5f780 0x00000000000069b1 <+2673>: vpermt2d zmm9,zmm16,zmm12 0x00000000000069b7 <+2679>: vpminsd zmm10,zmm13,zmm9 0x00000000000069bd <+2685>: vpmaxsd zmm11,zmm13,zmm9 0x00000000000069c3 <+2691>: vmovdqa64 zmm20,zmm13 0x00000000000069c9 <+2697>: vpermt2d zmm20,zmm23,zmm2 0x00000000000069cf <+2703>: mov ax,0x9990 0x00000000000069d3 <+2707>: kmovd k3,eax 0x00000000000069d7 <+2711>: vmovdqa32 zmm20{k3},zmm21 0x00000000000069dd <+2717>: vpermi2d zmm23,zmm22,zmm0 0x00000000000069e3 <+2723>: vmovdqa32 zmm23{k3},zmm19 0x00000000000069e9 <+2729>: vpermt2d zmm15,zmm16,zmm17 0x00000000000069ef <+2735>: vpermi2d zmm3,zmm1,zmm17 0x00000000000069f5 <+2741>: vmovdqa32 zmm3{k2},zmm14 0x00000000000069fb <+2747>: vpermt2d zmm8,zmm18,zmm5 0x0000000000006a01 <+2753>: vpminsd zmm16,zmm0,zmm3 0x0000000000006a07 <+2759>: vpminsd zmm19,zmm22,zmm15 0x0000000000006a0d <+2765>: vpmaxsd zmm13,zmm22,zmm15 0x0000000000006a13 <+2771>: mov ax,0x6090 0x0000000000006a17 <+2775>: kmovd k3,eax 0x0000000000006a1b <+2779>: vpblendmd zmm5{k3},zmm19,zmm13 0x0000000000006a21 <+2785>: vpmaxsd zmm14,zmm17,zmm23 0x0000000000006a27 <+2791>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x58e0f] # 0x5f840 0x0000000000006a31 <+2801>: vpermi2d zmm15,zmm5,zmm16 0x0000000000006a37 <+2807>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58e3f] # 0x5f880 0x0000000000006a41 <+2817>: vpermi2d zmm9,zmm15,zmm14 0x0000000000006a47 <+2823>: mov ax,0x1 0x0000000000006a4b <+2827>: kmovd k2,eax 0x0000000000006a4f <+2831>: vmovdqa32 zmm9{k2},zmm10 0x0000000000006a55 <+2837>: mov ax,0x9090 0x0000000000006a59 <+2841>: kmovd k2,eax 0x0000000000006a5d <+2845>: vmovdqa64 ymm21,YMMWORD PTR [rip+0x58679] # 0x5f0e0 0x0000000000006a67 <+2855>: vpermi2d zmm21,zmm14,zmm16 0x0000000000006a6d <+2861>: vpminsd zmm14{k2},zmm17,zmm23 0x0000000000006a73 <+2867>: vpmaxsd zmm24,zmm12,zmm20 0x0000000000006a79 <+2873>: vpminsd zmm17,zmm2,zmm7 0x0000000000006a7f <+2879>: vpmaxsd zmm15,zmm1,zmm8 0x0000000000006a85 <+2885>: vmovdqa32 zmm10{k3},zmm11 0x0000000000006a8b <+2891>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x58eeb] # 0x5f980 0x0000000000006a95 <+2901>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x59061] # 0x5fb00 0x0000000000006a9f <+2911>: vpermi2d zmm22,zmm10,zmm19 0x0000000000006aa5 <+2917>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x59091] # 0x5fb40 0x0000000000006aaf <+2927>: vpermi2d zmm23,zmm22,zmm17 0x0000000000006ab5 <+2933>: vpermt2d zmm23,zmm18,zmm24 0x0000000000006abb <+2939>: vshufi64x2 zmm19,zmm17,zmm15,0xff 0x0000000000006ac2 <+2946>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x590b4] # 0x5fb80 0x0000000000006acc <+2956>: vpermi2d zmm22,zmm24,zmm19 0x0000000000006ad2 <+2962>: vmovdqa64 zmm19,zmm24 0x0000000000006ad8 <+2968>: vpminsd zmm19{k2},zmm12,zmm20 0x0000000000006ade <+2974>: mov ax,0x906 0x0000000000006ae2 <+2978>: kmovd k2,eax 0x0000000000006ae6 <+2982>: vpblendmd zmm20{k2},zmm4,zmm6 0x0000000000006aec <+2988>: vpminsd zmm24,zmm1,zmm8 0x0000000000006af2 <+2994>: vpblendmd zmm8{k2},zmm15,zmm24 0x0000000000006af8 <+3000>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x58dbe] # 0x5f8c0 0x0000000000006b02 <+3010>: vpermi2d zmm12,zmm8,zmm21 0x0000000000006b08 <+3016>: mov ax,0x8000 0x0000000000006b0c <+3020>: kmovd k2,eax 0x0000000000006b10 <+3024>: vmovdqa32 zmm12{k2},zmm4 0x0000000000006b16 <+3030>: mov ax,0x909 0x0000000000006b1a <+3034>: kmovd k2,eax 0x0000000000006b1e <+3038>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x58dd8] # 0x5f900 0x0000000000006b28 <+3048>: vpminsd zmm1,zmm10,zmm23 0x0000000000006b2e <+3054>: mov ax,0x9069 0x0000000000006b32 <+3058>: kmovd k3,eax 0x0000000000006b36 <+3062>: vpmaxsd zmm1{k3},zmm10,zmm23 0x0000000000006b3c <+3068>: vpermt2d zmm10,zmm21,zmm17 0x0000000000006b42 <+3074>: vpermi2d zmm21,zmm5,zmm16 0x0000000000006b48 <+3080>: vpmaxsd zmm16{k2},zmm0,zmm3 0x0000000000006b4e <+3086>: vpmaxsd zmm17{k2},zmm2,zmm7 0x0000000000006b54 <+3092>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58de2] # 0x5f940 0x0000000000006b5e <+3102>: vpermi2d zmm2,zmm10,zmm19 0x0000000000006b64 <+3108>: vpermt2d zmm2,zmm18,zmm6 0x0000000000006b6a <+3114>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58e4c] # 0x5f9c0 0x0000000000006b74 <+3124>: vpermi2d zmm0,zmm14,zmm24 0x0000000000006b7a <+3130>: mov ax,0xf909 0x0000000000006b7e <+3134>: kmovd k2,eax 0x0000000000006b82 <+3138>: vmovdqa32 zmm21{k2},zmm0 0x0000000000006b88 <+3144>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58e6e] # 0x5fa00 0x0000000000006b92 <+3154>: vpminsd zmm0,zmm17,zmm2 0x0000000000006b98 <+3160>: mov ax,0x696 0x0000000000006b9c <+3164>: kmovd k3,eax 0x0000000000006ba0 <+3168>: vpmaxsd zmm0{k3},zmm17,zmm2 0x0000000000006ba6 <+3174>: vpermt2d zmm17,zmm3,zmm11 0x0000000000006bac <+3180>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58e8a] # 0x5fa40 0x0000000000006bb6 <+3190>: vpermi2d zmm2,zmm17,zmm19 0x0000000000006bbc <+3196>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58eba] # 0x5fa80 0x0000000000006bc6 <+3206>: vpermi2d zmm6,zmm2,zmm4 0x0000000000006bcc <+3212>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58eea] # 0x5fac0 0x0000000000006bd6 <+3222>: vpermi2d zmm2,zmm14,zmm15 0x0000000000006bdc <+3228>: vpermi2d zmm3,zmm16,zmm13 0x0000000000006be2 <+3234>: mov ax,0x6f60 0x0000000000006be6 <+3238>: kmovd k2,eax 0x0000000000006bea <+3242>: vmovdqa32 zmm3{k2},zmm2 0x0000000000006bf0 <+3248>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58fc6] # 0x5fbc0 0x0000000000006bfa <+3258>: vpermi2d zmm4,zmm20,zmm22 0x0000000000006c00 <+3264>: vpmaxsd zmm2,zmm14,zmm3 0x0000000000006c06 <+3270>: mov ax,0x6960 0x0000000000006c0a <+3274>: kmovd k2,eax 0x0000000000006c0e <+3278>: vpminsd zmm2{k2},zmm14,zmm3 0x0000000000006c14 <+3284>: vpmaxsd zmm10,zmm19,zmm6 0x0000000000006c1a <+3290>: vpminsd zmm10{k2},zmm19,zmm6 0x0000000000006c20 <+3296>: vpmaxsd zmm6,zmm20,zmm4 0x0000000000006c26 <+3302>: mov ax,0x609 0x0000000000006c2a <+3306>: kmovd k4,eax 0x0000000000006c2e <+3310>: vpminsd zmm6{k4},zmm20,zmm4 0x0000000000006c34 <+3316>: vpmaxsd zmm11,zmm8,zmm12 0x0000000000006c3a <+3322>: mov ax,0x8609 0x0000000000006c3e <+3326>: kmovd k4,eax 0x0000000000006c42 <+3330>: vpminsd zmm11{k4},zmm8,zmm12 0x0000000000006c48 <+3336>: vpminsd zmm8,zmm5,zmm9 0x0000000000006c4e <+3342>: vpminsd zmm4,zmm16,zmm21 0x0000000000006c54 <+3348>: vpmaxsd zmm4{k3},zmm16,zmm21 0x0000000000006c5a <+3354>: mov ax,0x9068 0x0000000000006c5e <+3358>: kmovd k3,eax 0x0000000000006c62 <+3362>: vpmaxsd zmm8{k3},zmm5,zmm9 0x0000000000006c68 <+3368>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x58f8e] # 0x5fc00 0x0000000000006c72 <+3378>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59004] # 0x5fc80 0x0000000000006c7c <+3388>: vmovdqa64 zmm9,zmm4 0x0000000000006c82 <+3394>: vpermt2d zmm9,zmm5,zmm11 0x0000000000006c88 <+3400>: vpermi2d zmm5,zmm0,zmm6 0x0000000000006c8e <+3406>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x59028] # 0x5fcc0 0x0000000000006c98 <+3416>: vmovdqa64 zmm13,zmm6 0x0000000000006c9e <+3422>: vpermt2d zmm13,zmm12,zmm10 0x0000000000006ca4 <+3428>: vpmaxsd zmm14,zmm10,zmm5 0x0000000000006caa <+3434>: mov ax,0xf00 0x0000000000006cae <+3438>: kmovd k3,eax 0x0000000000006cb2 <+3442>: vmovdqa64 zmm3,zmm14 0x0000000000006cb8 <+3448>: vpminsd zmm3{k3},zmm10,zmm5 0x0000000000006cbe <+3454>: vmovdqa64 zmm15,zmm10 0x0000000000006cc4 <+3460>: vpermt2d zmm15,zmm7,zmm1 0x0000000000006cca <+3466>: vpermi2d zmm7,zmm2,zmm8 0x0000000000006cd0 <+3472>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x58f66] # 0x5fc40 0x0000000000006cda <+3482>: vmovdqa64 zmm10,zmm8 0x0000000000006ce0 <+3488>: vpermt2d zmm10,zmm16,zmm4 0x0000000000006ce6 <+3494>: vpermi2d zmm12,zmm11,zmm2 0x0000000000006cec <+3500>: vpminsd zmm17,zmm11,zmm12 0x0000000000006cf2 <+3506>: vpmaxsd zmm5,zmm11,zmm12 0x0000000000006cf8 <+3512>: mov ax,0x96 0x0000000000006cfc <+3516>: kmovd k4,eax 0x0000000000006d00 <+3520>: vmovdqa32 zmm5{k4},zmm17 0x0000000000006d06 <+3526>: vpminsd zmm11,zmm6,zmm13 0x0000000000006d0c <+3532>: vpmaxsd zmm6,zmm6,zmm13 0x0000000000006d12 <+3538>: vmovdqa32 zmm6{k4},zmm11 0x0000000000006d18 <+3544>: vpmaxsd zmm12,zmm2,zmm9 0x0000000000006d1e <+3550>: mov ax,0x96f0 0x0000000000006d22 <+3554>: kmovd k4,eax 0x0000000000006d26 <+3558>: vpmaxsd zmm13,zmm8,zmm10 0x0000000000006d2c <+3564>: vpminsd zmm13{k4},zmm8,zmm10 0x0000000000006d32 <+3570>: vpminsd zmm18,zmm4,zmm7 0x0000000000006d38 <+3576>: mov al,0xc 0x0000000000006d3a <+3578>: kmovd k5,eax 0x0000000000006d3e <+3582>: vpmaxsd zmm4,zmm4,zmm7 0x0000000000006d44 <+3588>: vpblendmq zmm8{k5},zmm18,zmm4 0x0000000000006d4a <+3594>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x58fac] # 0x5fd00 0x0000000000006d54 <+3604>: vmovdqa64 zmm10,zmm8 0x0000000000006d5a <+3610>: vpermt2d zmm10,zmm7,zmm13 0x0000000000006d60 <+3616>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x58fd6] # 0x5fd40 0x0000000000006d6a <+3626>: vpermt2d zmm10,zmm19,zmm12 0x0000000000006d70 <+3632>: vpminsd zmm12{k3},zmm2,zmm9 0x0000000000006d76 <+3638>: mov rbx,QWORD PTR [rsp+0xd0] 0x0000000000006d7e <+3646>: mov rax,QWORD PTR [rsp+0xd8] 0x0000000000006d86 <+3654>: mov QWORD PTR [rsp+0x1e0],rax 0x0000000000006d8e <+3662>: vpermi2d zmm16,zmm1,zmm0 0x0000000000006d94 <+3668>: vpmaxsd zmm2,zmm1,zmm16 0x0000000000006d9a <+3674>: vpminsd zmm2{k4},zmm1,zmm16 0x0000000000006da0 <+3680>: vpminsd zmm1,zmm0,zmm15 0x0000000000006da6 <+3686>: vpmaxsd zmm0,zmm0,zmm15 0x0000000000006dac <+3692>: vpblendmq zmm9{k5},zmm1,zmm0 0x0000000000006db2 <+3698>: vpermi2d zmm7,zmm9,zmm2 0x0000000000006db8 <+3704>: vpermt2d zmm7,zmm19,zmm14 0x0000000000006dbe <+3710>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x58fb8] # 0x5fd80 0x0000000000006dc8 <+3720>: vmovdqa64 zmm15,zmm12 0x0000000000006dce <+3726>: vpermt2d zmm15,zmm14,zmm18 0x0000000000006dd4 <+3732>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x58fe2] # 0x5fdc0 0x0000000000006dde <+3742>: vpermt2d zmm15,zmm16,zmm17 0x0000000000006de4 <+3748>: vpermi2d zmm14,zmm3,zmm1 0x0000000000006dea <+3754>: vpermt2d zmm14,zmm16,zmm11 0x0000000000006df0 <+3760>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59006] # 0x5fe00 0x0000000000006dfa <+3770>: vmovdqa64 zmm11,zmm6 0x0000000000006e00 <+3776>: vpermt2d zmm11,zmm1,zmm3 0x0000000000006e06 <+3782>: vpermi2d zmm1,zmm5,zmm12 0x0000000000006e0c <+3788>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x5902a] # 0x5fe40 0x0000000000006e16 <+3798>: vmovdqa64 zmm17,zmm13 0x0000000000006e1c <+3804>: vpermt2d zmm17,zmm16,zmm4 0x0000000000006e22 <+3810>: vpermi2d zmm16,zmm2,zmm0 0x0000000000006e28 <+3816>: vpmaxsd zmm18,zmm2,zmm16 0x0000000000006e2e <+3822>: vpminsd zmm18{k2},zmm2,zmm16 0x0000000000006e34 <+3828>: vpmaxsd zmm16,zmm13,zmm17 0x0000000000006e3a <+3834>: vpminsd zmm16{k2},zmm13,zmm17 0x0000000000006e40 <+3840>: vpmaxsd zmm2,zmm5,zmm1 0x0000000000006e46 <+3846>: vpminsd zmm2{k1},zmm5,zmm1 0x0000000000006e4c <+3852>: vpmaxsd zmm0,zmm6,zmm11 0x0000000000006e52 <+3858>: vpminsd zmm0{k1},zmm6,zmm11 0x0000000000006e58 <+3864>: vpmaxsd zmm5,zmm3,zmm14 0x0000000000006e5e <+3870>: mov ax,0xf09 0x0000000000006e62 <+3874>: kmovd k1,eax 0x0000000000006e66 <+3878>: vpminsd zmm5{k1},zmm3,zmm14 0x0000000000006e6c <+3884>: vpmaxsd zmm4,zmm12,zmm15 0x0000000000006e72 <+3890>: vpminsd zmm4{k1},zmm12,zmm15 0x0000000000006e78 <+3896>: vpminsd zmm3,zmm9,zmm7 0x0000000000006e7e <+3902>: vpminsd zmm1,zmm8,zmm10 0x0000000000006e84 <+3908>: mov ax,0x90f0 0x0000000000006e88 <+3912>: kmovd k1,eax 0x0000000000006e8c <+3916>: vpmaxsd zmm1{k1},zmm8,zmm10 0x0000000000006e92 <+3922>: vpmaxsd zmm3{k1},zmm9,zmm7 0x0000000000006e98 <+3928>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58fde] # 0x5fe80 0x0000000000006ea2 <+3938>: vpxor xmm8,xmm8,xmm8 0x0000000000006ea7 <+3943>: vpermd zmm8,zmm6,zmm3 0x0000000000006ead <+3949>: vpxor xmm11,xmm11,xmm11 0x0000000000006eb2 <+3954>: vpermd zmm11,zmm6,zmm1 0x0000000000006eb8 <+3960>: vpxor xmm12,xmm12,xmm12 0x0000000000006ebd <+3965>: vpermd zmm12,zmm6,zmm4 0x0000000000006ec3 <+3971>: vpermd zmm6,zmm6,zmm5 0x0000000000006ec9 <+3977>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x58fed] # 0x5fec0 0x0000000000006ed3 <+3987>: vpxor xmm10,xmm10,xmm10 0x0000000000006ed8 <+3992>: vpermd zmm10,zmm7,zmm0 0x0000000000006ede <+3998>: vpxor xmm14,xmm14,xmm14 0x0000000000006ee3 <+4003>: vpermd zmm14,zmm7,zmm2 0x0000000000006ee9 <+4009>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5900d] # 0x5ff00 0x0000000000006ef3 <+4019>: vpermd zmm13,zmm7,zmm16 0x0000000000006ef9 <+4025>: vpxor xmm9,xmm9,xmm9 0x0000000000006efe <+4030>: vpermd zmm9,zmm7,zmm18 0x0000000000006f04 <+4036>: vpmaxsd zmm7,zmm18,zmm9 0x0000000000006f0a <+4042>: mov ax,0x600 0x0000000000006f0e <+4046>: kmovd k1,eax 0x0000000000006f12 <+4050>: vpminsd zmm7{k1},zmm18,zmm9 0x0000000000006f18 <+4056>: vpmaxsd zmm9,zmm16,zmm13 0x0000000000006f1e <+4062>: vpminsd zmm9{k1},zmm16,zmm13 0x0000000000006f24 <+4068>: vpmaxsd zmm15,zmm2,zmm14 0x0000000000006f2a <+4074>: mov ax,0x6 0x0000000000006f2e <+4078>: kmovd k1,eax 0x0000000000006f32 <+4082>: vpminsd zmm16,zmm4,zmm12 0x0000000000006f38 <+4088>: vpminsd zmm17,zmm1,zmm11 0x0000000000006f3e <+4094>: mov ax,0xf960 0x0000000000006f42 <+4098>: kmovd k2,eax 0x0000000000006f46 <+4102>: vpmaxsd zmm11,zmm1,zmm11 0x0000000000006f4c <+4108>: vpblendmd zmm13{k2},zmm17,zmm11 0x0000000000006f52 <+4114>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59024] # 0x5ff80 0x0000000000006f5c <+4124>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x5905a] # 0x5ffc0 0x0000000000006f66 <+4134>: vmovdqa64 zmm19,zmm13 0x0000000000006f6c <+4140>: vpermt2d zmm19,zmm1,zmm9 0x0000000000006f72 <+4146>: vpermt2d zmm19,zmm18,zmm16 0x0000000000006f78 <+4152>: vpmaxsd zmm16{k2},zmm4,zmm12 0x0000000000006f7e <+4158>: vmovdqa64 zmm20,zmm16 0x0000000000006f84 <+4164>: vpermt2d zmm20,zmm1,zmm11 0x0000000000006f8a <+4170>: vpermt2d zmm20,zmm18,zmm15 0x0000000000006f90 <+4176>: vmovdqa64 zmm21,zmm15 0x0000000000006f96 <+4182>: vpminsd zmm21{k1},zmm2,zmm14 0x0000000000006f9c <+4188>: vpmaxsd zmm2,zmm0,zmm10 0x0000000000006fa2 <+4194>: vpminsd zmm12,zmm5,zmm6 0x0000000000006fa8 <+4200>: vpmaxsd zmm11,zmm3,zmm8 0x0000000000006fae <+4206>: vmovdqa64 zmm4,zmm12 0x0000000000006fb4 <+4212>: vpmaxsd zmm4{k2},zmm5,zmm6 0x0000000000006fba <+4218>: vmovdqa64 zmm5,zmm4 0x0000000000006fc0 <+4224>: vpermt2d zmm5,zmm1,zmm11 0x0000000000006fc6 <+4230>: vpermt2d zmm5,zmm18,zmm2 0x0000000000006fcc <+4236>: vmovdqa64 zmm6,zmm2 0x0000000000006fd2 <+4242>: vpminsd zmm6{k1},zmm0,zmm10 0x0000000000006fd8 <+4248>: vpminsd zmm0,zmm3,zmm8 0x0000000000006fde <+4254>: vpblendmd zmm11{k2},zmm0,zmm11 0x0000000000006fe4 <+4260>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x58f52] # 0x5ff40 0x0000000000006fee <+4270>: vmovdqa64 zmm8,zmm6 0x0000000000006ff4 <+4276>: vpermt2d zmm8,zmm10,zmm4 0x0000000000006ffa <+4282>: vpermi2d zmm10,zmm21,zmm16 0x0000000000007000 <+4288>: vpermi2d zmm1,zmm11,zmm7 0x0000000000007006 <+4294>: vpermt2d zmm1,zmm18,zmm12 0x000000000000700c <+4300>: vmovdqa64 zmm12,zmm9 0x0000000000007012 <+4306>: vpermt2d zmm12,zmm18,zmm17 0x0000000000007018 <+4312>: vpermi2d zmm18,zmm7,zmm0 0x000000000000701e <+4318>: vpmaxsd zmm14,zmm7,zmm18 0x0000000000007024 <+4324>: mov ax,0x9000 0x0000000000007028 <+4328>: kmovd k1,eax 0x000000000000702c <+4332>: vmovdqa64 zmm2,zmm14 0x0000000000007032 <+4338>: vpminsd zmm2{k1},zmm7,zmm18 0x0000000000007038 <+4344>: vpmaxsd zmm0,zmm9,zmm12 0x000000000000703e <+4350>: vmovdqa64 zmm3,zmm0 0x0000000000007044 <+4356>: vpminsd zmm3{k1},zmm9,zmm12 0x000000000000704a <+4362>: vpminsd zmm12,zmm11,zmm1 0x0000000000007050 <+4368>: vpminsd zmm9,zmm13,zmm19 0x0000000000007056 <+4374>: vpminsd zmm7,zmm4,zmm5 0x000000000000705c <+4380>: vpminsd zmm15,zmm16,zmm20 0x0000000000007062 <+4386>: vpmaxsd zmm17,zmm13,zmm19 0x0000000000007068 <+4392>: mov ax,0x6f09 0x000000000000706c <+4396>: kmovd k1,eax 0x0000000000007070 <+4400>: vmovdqa32 zmm9{k1},zmm17 0x0000000000007076 <+4406>: vpmaxsd zmm15{k1},zmm16,zmm20 0x000000000000707c <+4412>: vpmaxsd zmm10,zmm21,zmm10 0x0000000000007082 <+4418>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x58f74] # 0x60000 0x000000000000708c <+4428>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x58faa] # 0x60040 0x0000000000007096 <+4438>: vpermt2d zmm0,zmm19,zmm17 0x000000000000709c <+4444>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x58fda] # 0x60080 0x00000000000070a6 <+4454>: vmovdqa64 zmm21,zmm15 0x00000000000070ac <+4460>: vpermt2d zmm21,zmm16,zmm10 0x00000000000070b2 <+4466>: mov ax,0x117 0x00000000000070b6 <+4470>: kmovd k2,eax 0x00000000000070ba <+4474>: vmovdqa32 zmm21{k2},zmm0 0x00000000000070c0 <+4480>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x58ff6] # 0x600c0 0x00000000000070ca <+4490>: vmovdqa64 zmm17,zmm3 0x00000000000070d0 <+4496>: vpermt2d zmm17,zmm18,zmm9 0x00000000000070d6 <+4502>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x59020] # 0x60100 0x00000000000070e0 <+4512>: vpermt2d zmm17,zmm20,zmm15 0x00000000000070e6 <+4518>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x59090] # 0x60180 0x00000000000070f0 <+4528>: vmovdqa64 zmm23,zmm10 0x00000000000070f6 <+4534>: vpermt2d zmm23,zmm22,zmm15 0x00000000000070fc <+4540>: mov ax,0xe8e0 0x0000000000007100 <+4544>: kmovd k3,eax 0x0000000000007104 <+4548>: vpmaxsd zmm0,zmm15,zmm21 0x000000000000710a <+4554>: vpminsd zmm0{k3},zmm15,zmm21 0x0000000000007110 <+4560>: vmovdqa64 zmm21,zmm15 0x0000000000007116 <+4566>: vpermt2d zmm21,zmm13,zmm9 0x000000000000711c <+4572>: mov ax,0x9999 0x0000000000007120 <+4576>: kmovd k4,eax 0x0000000000007124 <+4580>: vmovdqa32 zmm21{k4},zmm10 0x000000000000712a <+4586>: vpmaxsd zmm1,zmm11,zmm1 0x0000000000007130 <+4592>: vmovdqa32 zmm12{k1},zmm1 0x0000000000007136 <+4598>: vpmaxsd zmm7{k1},zmm4,zmm5 0x000000000000713c <+4604>: vpmaxsd zmm4,zmm6,zmm8 0x0000000000007142 <+4610>: vpermi2d zmm13,zmm7,zmm12 0x0000000000007148 <+4616>: vmovdqa32 zmm13{k4},zmm4 0x000000000000714e <+4622>: vpermi2d zmm18,zmm2,zmm12 0x0000000000007154 <+4628>: vpermt2d zmm18,zmm20,zmm7 0x000000000000715a <+4634>: vpermt2d zmm14,zmm19,zmm1 0x0000000000007160 <+4640>: vpermi2d zmm16,zmm7,zmm4 0x0000000000007166 <+4646>: vmovdqa32 zmm16{k2},zmm14 0x000000000000716c <+4652>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x58fca] # 0x60140 0x0000000000007176 <+4662>: vmovdqa64 zmm5,zmm9 0x000000000000717c <+4668>: vpermt2d zmm5,zmm1,zmm3 0x0000000000007182 <+4674>: mov ax,0xe880 0x0000000000007186 <+4678>: kmovd k1,eax 0x000000000000718a <+4682>: vmovdqa32 zmm5{k1},zmm23 0x0000000000007190 <+4688>: vpermi2d zmm1,zmm12,zmm2 0x0000000000007196 <+4694>: vpermi2d zmm22,zmm4,zmm7 0x000000000000719c <+4700>: vmovdqa32 zmm1{k1},zmm22 0x00000000000071a2 <+4706>: vpminsd zmm15,zmm12,zmm1 0x00000000000071a8 <+4712>: vpmaxsd zmm14,zmm12,zmm1 0x00000000000071ae <+4718>: vpblendmd zmm11{k3},zmm14,zmm15 0x00000000000071b4 <+4724>: vpminsd zmm12,zmm9,zmm5 0x00000000000071ba <+4730>: vpmaxsd zmm19,zmm9,zmm5 0x00000000000071c0 <+4736>: vpblendmd zmm9{k3},zmm19,zmm12 0x00000000000071c6 <+4742>: vpmaxsd zmm5,zmm7,zmm16 0x00000000000071cc <+4748>: vpminsd zmm5{k3},zmm7,zmm16 0x00000000000071d2 <+4754>: vpmaxsd zmm6,zmm2,zmm18 0x00000000000071d8 <+4760>: mov ax,0x6666 0x00000000000071dc <+4764>: kmovd k1,eax 0x00000000000071e0 <+4768>: vpminsd zmm6{k1},zmm2,zmm18 0x00000000000071e6 <+4774>: vpmaxsd zmm7,zmm3,zmm17 0x00000000000071ec <+4780>: vpminsd zmm7{k1},zmm3,zmm17 0x00000000000071f2 <+4786>: vpmaxsd zmm1,zmm4,zmm13 0x00000000000071f8 <+4792>: vpmaxsd zmm4,zmm10,zmm21 0x00000000000071fe <+4798>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58fb8] # 0x601c0 0x0000000000007208 <+4808>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x590ae] # 0x602c0 0x0000000000007212 <+4818>: vmovdqa64 zmm18,zmm11 0x0000000000007218 <+4824>: vpermt2d zmm18,zmm2,zmm6 0x000000000000721e <+4830>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x590d8] # 0x60300 0x0000000000007228 <+4840>: vmovdqa64 zmm16,zmm1 0x000000000000722e <+4846>: vpermt2d zmm16,zmm8,zmm5 0x0000000000007234 <+4852>: mov ax,0x4c6c 0x0000000000007238 <+4856>: kmovd k1,eax 0x000000000000723c <+4860>: vpermi2d zmm2,zmm9,zmm7 0x0000000000007242 <+4866>: vpermi2d zmm8,zmm4,zmm0 0x0000000000007248 <+4872>: vmovdqa32 zmm2{k1},zmm8 0x000000000000724e <+4878>: vpmaxsd zmm8,zmm9,zmm2 0x0000000000007254 <+4884>: vpminsd zmm8{k1},zmm9,zmm2 0x000000000000725a <+4890>: vmovdqa64 zmm2,zmm9 0x0000000000007260 <+4896>: vpermt2d zmm2,zmm3,zmm0 0x0000000000007266 <+4902>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58f90] # 0x60200 0x0000000000007270 <+4912>: vmovdqa64 zmm10,zmm4 0x0000000000007276 <+4918>: vpermt2d zmm10,zmm9,zmm2 0x000000000000727c <+4924>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x58fba] # 0x60240 0x0000000000007286 <+4934>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x590b0] # 0x60340 0x0000000000007290 <+4944>: vmovdqa64 zmm13,zmm7 0x0000000000007296 <+4950>: vpermt2d zmm13,zmm20,zmm19 0x000000000000729c <+4956>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x590da] # 0x60380 0x00000000000072a6 <+4966>: vpermt2d zmm13,zmm19,zmm0 0x00000000000072ac <+4972>: vpminsd zmm17,zmm7,zmm13 0x00000000000072b2 <+4978>: mov ax,0x1331 0x00000000000072b6 <+4982>: kmovd k3,eax 0x00000000000072ba <+4986>: vmovdqa64 zmm2,zmm17 0x00000000000072c0 <+4992>: vpmaxsd zmm2{k3},zmm7,zmm13 0x00000000000072c6 <+4998>: vpermt2d zmm7,zmm21,zmm12 0x00000000000072cc <+5004>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x58faa] # 0x60280 0x00000000000072d6 <+5014>: vmovdqa64 zmm13,zmm0 0x00000000000072dc <+5020>: vpermt2d zmm13,zmm12,zmm4 0x00000000000072e2 <+5026>: mov ax,0x3632 0x00000000000072e6 <+5030>: kmovd k2,eax 0x00000000000072ea <+5034>: vmovdqa32 zmm13{k2},zmm7 0x00000000000072f0 <+5040>: vpermi2d zmm21,zmm6,zmm15 0x00000000000072f6 <+5046>: vpermi2d zmm12,zmm5,zmm1 0x00000000000072fc <+5052>: vmovdqa32 zmm12{k2},zmm21 0x0000000000007302 <+5058>: vpermi2d zmm3,zmm11,zmm5 0x0000000000007308 <+5064>: vpermi2d zmm9,zmm1,zmm3 0x000000000000730e <+5070>: vmovdqa32 zmm18{k1},zmm16 0x0000000000007314 <+5076>: vpermi2d zmm20,zmm6,zmm14 0x000000000000731a <+5082>: vpermt2d zmm20,zmm19,zmm5 0x0000000000007320 <+5088>: vpminsd zmm16,zmm6,zmm20 0x0000000000007326 <+5094>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x59090] # 0x603c0 0x0000000000007330 <+5104>: vpermi2d zmm7,zmm2,zmm8 0x0000000000007336 <+5110>: mov ax,0x2 0x000000000000733a <+5114>: kmovd k2,eax 0x000000000000733e <+5118>: vmovdqa32 zmm7{k2},zmm16 0x0000000000007344 <+5124>: vpmaxsd zmm14,zmm11,zmm18 0x000000000000734a <+5130>: vpminsd zmm14{k1},zmm11,zmm18 0x0000000000007350 <+5136>: vpmaxsd zmm15,zmm1,zmm9 0x0000000000007356 <+5142>: mov ax,0x888 0x000000000000735a <+5146>: kmovd k1,eax 0x000000000000735e <+5150>: vpmaxsd zmm11,zmm5,zmm12 0x0000000000007364 <+5156>: mov ax,0x88 0x0000000000007368 <+5160>: kmovd k2,eax 0x000000000000736c <+5164>: vpmaxsd zmm16{k3},zmm6,zmm20 0x0000000000007372 <+5170>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59144] # 0x604c0 0x000000000000737c <+5180>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5923a] # 0x605c0 0x0000000000007386 <+5190>: vpermi2d zmm3,zmm16,zmm17 0x000000000000738c <+5196>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x5926a] # 0x60600 0x0000000000007396 <+5206>: vpermi2d zmm17,zmm3,zmm14 0x000000000000739c <+5212>: vpminsd zmm3,zmm16,zmm17 0x00000000000073a2 <+5218>: mov ax,0x2653 0x00000000000073a6 <+5222>: kmovd k3,eax 0x00000000000073aa <+5226>: vmovdqa64 zmm6,zmm3 0x00000000000073b0 <+5232>: vpmaxsd zmm6{k3},zmm16,zmm17 0x00000000000073b6 <+5238>: vpermt2d zmm16,zmm18,zmm14 0x00000000000073bc <+5244>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x5913a] # 0x60500 0x00000000000073c6 <+5254>: vpermt2d zmm16,zmm17,zmm11 0x00000000000073cc <+5260>: vpminsd zmm11{k2},zmm5,zmm12 0x00000000000073d2 <+5266>: vpmaxsd zmm12,zmm0,zmm13 0x00000000000073d8 <+5272>: vpermi2d zmm18,zmm2,zmm8 0x00000000000073de <+5278>: vpermt2d zmm18,zmm17,zmm12 0x00000000000073e4 <+5284>: vpminsd zmm12{k2},zmm0,zmm13 0x00000000000073ea <+5290>: vpmaxsd zmm5,zmm4,zmm10 0x00000000000073f0 <+5296>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59046] # 0x60440 0x00000000000073fa <+5306>: vpermi2d zmm0,zmm11,zmm5 0x0000000000007400 <+5312>: vpminsd zmm5{k1},zmm4,zmm10 0x0000000000007406 <+5318>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x58ff0] # 0x60400 0x0000000000007410 <+5328>: vpermi2d zmm10,zmm5,zmm12 0x0000000000007416 <+5334>: mov ax,0x4000 0x000000000000741a <+5338>: kmovd k2,eax 0x000000000000741e <+5342>: vmovdqa32 zmm10{k2},zmm15 0x0000000000007424 <+5348>: vmovdqa64 zmm4,zmm15 0x000000000000742a <+5354>: vpminsd zmm4{k1},zmm1,zmm9 0x0000000000007430 <+5360>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59046] # 0x60480 0x000000000000743a <+5370>: vpermi2d zmm1,zmm0,zmm4 0x0000000000007440 <+5376>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x590f6] # 0x60540 0x000000000000744a <+5386>: vpminsd zmm20,zmm14,zmm16 0x0000000000007450 <+5392>: vpmaxsd zmm9,zmm14,zmm16 0x0000000000007456 <+5398>: vmovdqa64 zmm16,zmm14 0x000000000000745c <+5404>: vpermt2d zmm16,zmm13,zmm11 0x0000000000007462 <+5410>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59114] # 0x60580 0x000000000000746c <+5420>: vpermt2d zmm16,zmm0,zmm4 0x0000000000007472 <+5426>: vpermi2d zmm13,zmm8,zmm12 0x0000000000007478 <+5432>: vpermt2d zmm13,zmm0,zmm5 0x000000000000747e <+5438>: vpminsd zmm17,zmm8,zmm18 0x0000000000007484 <+5444>: vpmaxsd zmm8,zmm8,zmm18 0x000000000000748a <+5450>: mov ax,0xc48c 0x000000000000748e <+5454>: kmovd k1,eax 0x0000000000007492 <+5458>: vpblendmd zmm0{k1},zmm8,zmm17 0x0000000000007498 <+5464>: vpminsd zmm14,zmm2,zmm7 0x000000000000749e <+5470>: mov ax,0x2651 0x00000000000074a2 <+5474>: kmovd k2,eax 0x00000000000074a6 <+5478>: mov al,0x2 0x00000000000074a8 <+5480>: kmovd k3,eax 0x00000000000074ac <+5484>: vpblendmq zmm18{k3},zmm6,zmm14 0x00000000000074b2 <+5490>: vbroadcasti64x4 zmm19,YMMWORD PTR [rip+0x57c64] # 0x5f120 0x00000000000074bc <+5500>: vpermt2d zmm8,zmm19,zmm14 0x00000000000074c2 <+5506>: vpmaxsd zmm14{k2},zmm2,zmm7 0x00000000000074c8 <+5512>: vpmaxsd zmm7,zmm12,zmm13 0x00000000000074ce <+5518>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x59168] # 0x60640 0x00000000000074d8 <+5528>: vpermi2d zmm2,zmm14,zmm0 0x00000000000074de <+5534>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x59198] # 0x60680 0x00000000000074e8 <+5544>: vpermi2d zmm15,zmm2,zmm7 0x00000000000074ee <+5550>: mov ax,0x4 0x00000000000074f2 <+5554>: kmovd k2,eax 0x00000000000074f6 <+5558>: vmovdqa32 zmm15{k2},zmm3 0x00000000000074fc <+5564>: vpmaxsd zmm21,zmm11,zmm16 0x0000000000007502 <+5570>: mov ax,0xca4c 0x0000000000007506 <+5574>: kmovd k2,eax 0x000000000000750a <+5578>: vpblendmd zmm2{k1},zmm9,zmm20 0x0000000000007510 <+5584>: vpmaxsd zmm22,zmm5,zmm10 0x0000000000007516 <+5590>: vbroadcasti64x4 zmm23,YMMWORD PTR [rip+0x57be0] # 0x5f100 0x0000000000007520 <+5600>: vpermi2d zmm23,zmm20,zmm22 0x0000000000007526 <+5606>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x591d0] # 0x60700 0x0000000000007530 <+5616>: vpermi2d zmm20,zmm21,zmm23 0x0000000000007536 <+5622>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x59380] # 0x608c0 0x0000000000007540 <+5632>: vpermi2d zmm23,zmm18,zmm2 0x0000000000007546 <+5638>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x593b0] # 0x60900 0x0000000000007550 <+5648>: vpermi2d zmm18,zmm23,zmm21 0x0000000000007556 <+5654>: vpminsd zmm21{k2},zmm11,zmm16 0x000000000000755c <+5660>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x5915a] # 0x606c0 0x0000000000007566 <+5670>: vpermi2d zmm16,zmm7,zmm17 0x000000000000756c <+5676>: vmovdqa64 zmm11,zmm7 0x0000000000007572 <+5682>: vpminsd zmm11{k2},zmm12,zmm13 0x0000000000007578 <+5688>: vpmaxsd zmm17,zmm4,zmm1 0x000000000000757e <+5694>: mov ax,0xa00 0x0000000000007582 <+5698>: kmovd k2,eax 0x0000000000007586 <+5702>: mov ax,0x4a00 0x000000000000758a <+5706>: kmovd k1,eax 0x000000000000758e <+5710>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x591a8] # 0x60740 0x0000000000007598 <+5720>: vpermi2d zmm12,zmm11,zmm22 0x000000000000759e <+5726>: vbroadcasti64x4 zmm23,YMMWORD PTR [rip+0x57b98] # 0x5f140 0x00000000000075a8 <+5736>: vpermi2d zmm23,zmm11,zmm22 0x00000000000075ae <+5742>: vmovdqa64 zmm7,zmm22 0x00000000000075b4 <+5748>: vpminsd zmm7{k1},zmm5,zmm10 0x00000000000075ba <+5754>: mov ax,0x1111 0x00000000000075be <+5758>: kmovd k1,eax 0x00000000000075c2 <+5762>: vpblendmd zmm5{k1},zmm7,zmm16 0x00000000000075c8 <+5768>: mov ax,0x2000 0x00000000000075cc <+5772>: kmovd k1,eax 0x00000000000075d0 <+5776>: vmovdqa32 zmm5{k1},zmm17 0x00000000000075d6 <+5782>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x591a0] # 0x60780 0x00000000000075e0 <+5792>: vmovdqa64 zmm13,zmm0 0x00000000000075e6 <+5798>: vpermt2d zmm13,zmm10,zmm14 0x00000000000075ec <+5804>: vpermi2d zmm10,zmm2,zmm6 0x00000000000075f2 <+5810>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x591c4] # 0x607c0 0x00000000000075fc <+5820>: vpermi2d zmm22,zmm10,zmm21 0x0000000000007602 <+5826>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x591f4] # 0x60800 0x000000000000760c <+5836>: vpermi2d zmm16,zmm22,zmm17 0x0000000000007612 <+5842>: vpermt2d zmm9,zmm19,zmm3 0x0000000000007618 <+5848>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5921e] # 0x60840 0x0000000000007622 <+5858>: vpermi2d zmm3,zmm21,zmm9 0x0000000000007628 <+5864>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x5924e] # 0x60880 0x0000000000007632 <+5874>: vpermi2d zmm19,zmm3,zmm17 0x0000000000007638 <+5880>: vmovdqa64 zmm9,zmm17 0x000000000000763e <+5886>: vpminsd zmm9{k2},zmm4,zmm1 0x0000000000007644 <+5892>: mov ax,0x3111 0x0000000000007648 <+5896>: kmovd k2,eax 0x000000000000764c <+5900>: vpblendmd zmm10{k2},zmm9,zmm20 0x0000000000007652 <+5906>: mov ax,0x211 0x0000000000007656 <+5910>: kmovd k2,eax 0x000000000000765a <+5914>: vmovdqa32 zmm12{k2},zmm8 0x0000000000007660 <+5920>: mov ax,0x8840 0x0000000000007664 <+5924>: kmovd k2,eax 0x0000000000007668 <+5928>: vmovdqa32 zmm13{k2},zmm23 0x000000000000766e <+5934>: vpminsd zmm8,zmm6,zmm18 0x0000000000007674 <+5940>: vpmaxsd zmm3,zmm6,zmm18 0x000000000000767a <+5946>: mov ax,0x8888 0x000000000000767e <+5950>: kmovd k2,eax 0x0000000000007682 <+5954>: vpblendmd zmm4{k2},zmm3,zmm8 0x0000000000007688 <+5960>: vpmaxsd zmm1,zmm21,zmm19 0x000000000000768e <+5966>: mov ax,0x2466 0x0000000000007692 <+5970>: kmovd k3,eax 0x0000000000007696 <+5974>: vpminsd zmm1{k3},zmm21,zmm19 0x000000000000769c <+5980>: vpmaxsd zmm17,zmm2,zmm16 0x00000000000076a2 <+5986>: mov ax,0x888c 0x00000000000076a6 <+5990>: kmovd k4,eax 0x00000000000076aa <+5994>: mov ax,0x88ca 0x00000000000076ae <+5998>: vpmaxsd zmm6,zmm14,zmm15 0x00000000000076b4 <+6004>: vpminsd zmm6{k4},zmm14,zmm15 0x00000000000076ba <+6010>: kmovd k4,eax 0x00000000000076be <+6014>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x593b8] # 0x60a80 0x00000000000076c8 <+6024>: vpermt2d zmm3,zmm15,zmm17 0x00000000000076ce <+6030>: vpminsd zmm17{k4},zmm2,zmm16 0x00000000000076d4 <+6036>: vpmaxsd zmm2,zmm0,zmm13 0x00000000000076da <+6042>: vpermi2d zmm15,zmm6,zmm2 0x00000000000076e0 <+6048>: vmovdqa64 zmm16,zmm2 0x00000000000076e6 <+6054>: vpminsd zmm16{k4},zmm0,zmm13 0x00000000000076ec <+6060>: vpmaxsd zmm14,zmm11,zmm12 0x00000000000076f2 <+6066>: vpminsd zmm14{k3},zmm11,zmm12 0x00000000000076f8 <+6072>: vpmaxsd zmm2,zmm7,zmm5 0x00000000000076fe <+6078>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x59278] # 0x60980 0x0000000000007708 <+6088>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x592ae] # 0x609c0 0x0000000000007712 <+6098>: vpermt2d zmm8,zmm13,zmm17 0x0000000000007718 <+6104>: vpermt2d zmm8,zmm18,zmm1 0x000000000000771e <+6110>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x592d8] # 0x60a00 0x0000000000007728 <+6120>: vpminsd zmm11,zmm17,zmm8 0x000000000000772e <+6126>: mov ax,0x1135 0x0000000000007732 <+6130>: kmovd k3,eax 0x0000000000007736 <+6134>: vmovdqa64 zmm0,zmm11 0x000000000000773c <+6140>: vpmaxsd zmm0{k3},zmm17,zmm8 0x0000000000007742 <+6146>: vpermt2d zmm17,zmm12,zmm1 0x0000000000007748 <+6152>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x592ee] # 0x60a40 0x0000000000007752 <+6162>: vpermi2d zmm12,zmm16,zmm14 0x0000000000007758 <+6168>: vpermt2d zmm12,zmm8,zmm2 0x000000000000775e <+6174>: vmovdqa64 zmm19,zmm2 0x0000000000007764 <+6180>: vpminsd zmm19{k1},zmm7,zmm5 0x000000000000776a <+6186>: vpmaxsd zmm9,zmm9,zmm10 0x0000000000007770 <+6192>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x591c6] # 0x60940 0x000000000000777a <+6202>: vmovdqa64 zmm7,zmm19 0x0000000000007780 <+6208>: vpermt2d zmm7,zmm20,zmm14 0x0000000000007786 <+6214>: vpmaxsd zmm10,zmm6,zmm15 0x000000000000778c <+6220>: vpminsd zmm10{k2},zmm6,zmm15 0x0000000000007792 <+6226>: vpermt2d zmm6,zmm13,zmm16 0x0000000000007798 <+6232>: vpermt2d zmm6,zmm18,zmm14 0x000000000000779e <+6238>: vpermt2d zmm17,zmm8,zmm9 0x00000000000077a4 <+6244>: vpermi2d zmm20,zmm9,zmm1 0x00000000000077aa <+6250>: vpmaxsd zmm8,zmm14,zmm12 0x00000000000077b0 <+6256>: mov ax,0xac88 0x00000000000077b4 <+6260>: kmovd k1,eax 0x00000000000077b8 <+6264>: vpmaxsd zmm13,zmm4,zmm3 0x00000000000077be <+6270>: vpminsd zmm13{k2},zmm4,zmm3 0x00000000000077c4 <+6276>: vpminsd zmm3,zmm16,zmm6 0x00000000000077ca <+6282>: vmovdqa64 zmm2,zmm3 0x00000000000077d0 <+6288>: vpmaxsd zmm2{k3},zmm16,zmm6 0x00000000000077d6 <+6294>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x592e0] # 0x60ac0 0x00000000000077e0 <+6304>: vmovdqa64 zmm4,zmm0 0x00000000000077e6 <+6310>: vpermt2d zmm4,zmm5,zmm13 0x00000000000077ec <+6316>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x5930a] # 0x60b00 0x00000000000077f6 <+6326>: vpermi2d zmm5,zmm2,zmm10 0x00000000000077fc <+6332>: vpermt2d zmm5,zmm6,zmm8 0x0000000000007802 <+6338>: vpminsd zmm8{k1},zmm14,zmm12 0x0000000000007808 <+6344>: vpmaxsd zmm12,zmm1,zmm17 0x000000000000780e <+6350>: vpermt2d zmm4,zmm6,zmm12 0x0000000000007814 <+6356>: vmovdqa64 zmm15,zmm12 0x000000000000781a <+6362>: vpminsd zmm15{k1},zmm1,zmm17 0x0000000000007820 <+6368>: vpmaxsd zmm7,zmm19,zmm7 0x0000000000007826 <+6374>: vpmaxsd zmm6,zmm9,zmm20 0x000000000000782c <+6380>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x5930a] # 0x60b40 0x0000000000007836 <+6390>: vmovdqa64 zmm17,zmm13 0x000000000000783c <+6396>: vpermt2d zmm17,zmm16,zmm0 0x0000000000007842 <+6402>: vpermi2d zmm16,zmm10,zmm2 0x0000000000007848 <+6408>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x5932e] # 0x60b80 0x0000000000007852 <+6418>: vmovdqa64 zmm9,zmm6 0x0000000000007858 <+6424>: vpermt2d zmm9,zmm12,zmm15 0x000000000000785e <+6430>: vpermi2d zmm12,zmm7,zmm8 0x0000000000007864 <+6436>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59352] # 0x60bc0 0x000000000000786e <+6446>: vmovdqa64 zmm18,zmm15 0x0000000000007874 <+6452>: vpermt2d zmm18,zmm1,zmm11 0x000000000000787a <+6458>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x5937c] # 0x60c00 0x0000000000007884 <+6468>: vpermt2d zmm18,zmm11,zmm6 0x000000000000788a <+6474>: vpermi2d zmm1,zmm8,zmm3 0x0000000000007890 <+6480>: vpermt2d zmm1,zmm11,zmm7 0x0000000000007896 <+6486>: vpminsd zmm11,zmm8,zmm1 0x000000000000789c <+6492>: vpmaxsd zmm3,zmm8,zmm1 0x00000000000078a2 <+6498>: mov ax,0xcaaa 0x00000000000078a6 <+6502>: kmovd k1,eax 0x00000000000078aa <+6506>: vmovdqa32 zmm3{k1},zmm11 0x00000000000078b0 <+6512>: vpminsd zmm14,zmm15,zmm18 0x00000000000078b6 <+6518>: vpmaxsd zmm1,zmm15,zmm18 0x00000000000078bc <+6524>: vmovdqa32 zmm1{k1},zmm14 0x00000000000078c2 <+6530>: vpmaxsd zmm18,zmm7,zmm12 0x00000000000078c8 <+6536>: mov ax,0x44 0x00000000000078cc <+6540>: kmovd k1,eax 0x00000000000078d0 <+6544>: vpmaxsd zmm8,zmm10,zmm16 0x00000000000078d6 <+6550>: mov ax,0xcc88 0x00000000000078da <+6554>: kmovd k3,eax 0x00000000000078de <+6558>: vpminsd zmm8{k3},zmm10,zmm16 0x00000000000078e4 <+6564>: vpmaxsd zmm16,zmm2,zmm5 0x00000000000078ea <+6570>: mov ax,0xaaac 0x00000000000078ee <+6574>: kmovd k2,eax 0x00000000000078f2 <+6578>: vpmaxsd zmm10,zmm13,zmm17 0x00000000000078f8 <+6584>: vpminsd zmm10{k3},zmm13,zmm17 0x00000000000078fe <+6590>: vpmaxsd zmm17,zmm0,zmm4 0x0000000000007904 <+6596>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x593b2] # 0x60cc0 0x000000000000790e <+6606>: vmovdqa64 zmm13,zmm10 0x0000000000007914 <+6612>: vpermt2d zmm13,zmm15,zmm17 0x000000000000791a <+6618>: vpermi2d zmm15,zmm8,zmm16 0x0000000000007920 <+6624>: vpminsd zmm16{k2},zmm2,zmm5 0x0000000000007926 <+6630>: vpminsd zmm17{k2},zmm0,zmm4 0x000000000000792c <+6636>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x593ca] # 0x60d00 0x0000000000007936 <+6646>: vmovdqa64 zmm19,zmm1 0x000000000000793c <+6652>: vpermt2d zmm19,zmm4,zmm17 0x0000000000007942 <+6658>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x593f4] # 0x60d40 0x000000000000794c <+6668>: vpermi2d zmm4,zmm3,zmm16 0x0000000000007952 <+6674>: vpermt2d zmm4,zmm0,zmm18 0x0000000000007958 <+6680>: vpminsd zmm18{k1},zmm7,zmm12 0x000000000000795e <+6686>: vpmaxsd zmm2,zmm6,zmm9 0x0000000000007964 <+6692>: vpermt2d zmm19,zmm0,zmm2 0x000000000000796a <+6698>: vmovdqa64 zmm5,zmm2 0x0000000000007970 <+6704>: vpminsd zmm5{k1},zmm6,zmm9 0x0000000000007976 <+6710>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x592c0] # 0x60c40 0x0000000000007980 <+6720>: vmovdqa64 zmm6,zmm17 0x0000000000007986 <+6726>: vpermt2d zmm6,zmm2,zmm10 0x000000000000798c <+6732>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x592ea] # 0x60c80 0x0000000000007996 <+6742>: vpermt2q zmm6,zmm0,zmm1 0x000000000000799c <+6748>: vpermi2d zmm2,zmm16,zmm8 0x00000000000079a2 <+6754>: vpermt2q zmm2,zmm0,zmm3 0x00000000000079a8 <+6760>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x593ce] # 0x60d80 0x00000000000079b2 <+6770>: vmovdqa64 zmm9,zmm5 0x00000000000079b8 <+6776>: vpermt2d zmm9,zmm7,zmm14 0x00000000000079be <+6782>: vpermi2d zmm7,zmm18,zmm11 0x00000000000079c4 <+6788>: vpmaxsd zmm11,zmm16,zmm2 0x00000000000079ca <+6794>: mov ax,0xcaac 0x00000000000079ce <+6798>: kmovd k1,eax 0x00000000000079d2 <+6802>: vpminsd zmm11{k1},zmm16,zmm2 0x00000000000079d8 <+6808>: vpmaxsd zmm12,zmm17,zmm6 0x00000000000079de <+6814>: vpminsd zmm12{k1},zmm17,zmm6 0x00000000000079e4 <+6820>: vpmaxsd zmm2,zmm18,zmm7 0x00000000000079ea <+6826>: mov ax,0xaa 0x00000000000079ee <+6830>: kmovd k2,eax 0x00000000000079f2 <+6834>: vpminsd zmm2{k2},zmm18,zmm7 0x00000000000079f8 <+6840>: vpmaxsd zmm6,zmm3,zmm4 0x00000000000079fe <+6846>: vpminsd zmm6{k1},zmm3,zmm4 0x0000000000007a04 <+6852>: vpmaxsd zmm18,zmm8,zmm15 0x0000000000007a0a <+6858>: mov ax,0xaa88 0x0000000000007a0e <+6862>: kmovd k3,eax 0x0000000000007a12 <+6866>: vpminsd zmm18{k3},zmm8,zmm15 0x0000000000007a18 <+6872>: vpmaxsd zmm4,zmm5,zmm9 0x0000000000007a1e <+6878>: vpminsd zmm4{k2},zmm5,zmm9 0x0000000000007a24 <+6884>: vpmaxsd zmm5,zmm1,zmm19 0x0000000000007a2a <+6890>: vpminsd zmm5{k1},zmm1,zmm19 0x0000000000007a30 <+6896>: vpmaxsd zmm7,zmm10,zmm13 0x0000000000007a36 <+6902>: vpminsd zmm7{k3},zmm10,zmm13 0x0000000000007a3c <+6908>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5937a] # 0x60dc0 0x0000000000007a46 <+6918>: vmovdqa64 zmm10,zmm7 0x0000000000007a4c <+6924>: vpermt2d zmm10,zmm1,zmm12 0x0000000000007a52 <+6930>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x593a4] # 0x60e00 0x0000000000007a5c <+6940>: vmovdqa64 zmm8,zmm5 0x0000000000007a62 <+6946>: vpermt2d zmm8,zmm15,zmm12 0x0000000000007a68 <+6952>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x593ce] # 0x60e40 0x0000000000007a72 <+6962>: vpermt2d zmm8,zmm3,zmm4 0x0000000000007a78 <+6968>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x593fe] # 0x60e80 0x0000000000007a82 <+6978>: vmovdqa64 zmm9,zmm4 0x0000000000007a88 <+6984>: vpermt2d zmm9,zmm13,zmm5 0x0000000000007a8e <+6990>: vpermi2d zmm1,zmm18,zmm11 0x0000000000007a94 <+6996>: vpermi2d zmm15,zmm6,zmm11 0x0000000000007a9a <+7002>: vpermt2d zmm15,zmm3,zmm2 0x0000000000007aa0 <+7008>: vpermi2d zmm13,zmm2,zmm6 0x0000000000007aa6 <+7014>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59410] # 0x60ec0 0x0000000000007ab0 <+7024>: vmovdqa64 zmm16,zmm12 0x0000000000007ab6 <+7030>: vpermt2d zmm16,zmm3,zmm7 0x0000000000007abc <+7036>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x5943a] # 0x60f00 0x0000000000007ac6 <+7046>: vpermt2d zmm16,zmm14,zmm5 0x0000000000007acc <+7052>: vpermi2d zmm3,zmm11,zmm18 0x0000000000007ad2 <+7058>: vpermt2d zmm3,zmm14,zmm6 0x0000000000007ad8 <+7064>: vpminsd zmm19,zmm11,zmm3 0x0000000000007ade <+7070>: vpmaxsd zmm14,zmm11,zmm3 0x0000000000007ae4 <+7076>: mov ax,0xacca 0x0000000000007ae8 <+7080>: kmovd k1,eax 0x0000000000007aec <+7084>: vpblendmd zmm11{k1},zmm14,zmm19 0x0000000000007af2 <+7090>: vpminsd zmm17,zmm12,zmm16 0x0000000000007af8 <+7096>: vpmaxsd zmm16,zmm12,zmm16 0x0000000000007afe <+7102>: vpblendmd zmm12{k1},zmm16,zmm17 0x0000000000007b04 <+7108>: vpmaxsd zmm20,zmm2,zmm13 0x0000000000007b0a <+7114>: mov ax,0x4cc 0x0000000000007b0e <+7118>: kmovd k2,eax 0x0000000000007b12 <+7122>: vpmaxsd zmm21,zmm6,zmm15 0x0000000000007b18 <+7128>: vpmaxsd zmm3,zmm18,zmm1 0x0000000000007b1e <+7134>: mov ax,0xccc8 0x0000000000007b22 <+7138>: kmovd k3,eax 0x0000000000007b26 <+7142>: vpminsd zmm3{k3},zmm18,zmm1 0x0000000000007b2c <+7148>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x5948a] # 0x60fc0 0x0000000000007b36 <+7158>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x594c0] # 0x61000 0x0000000000007b40 <+7168>: vmovdqa64 zmm18,zmm11 0x0000000000007b46 <+7174>: vpermt2d zmm18,zmm25,zmm3 0x0000000000007b4c <+7180>: vpermt2d zmm18,zmm1,zmm21 0x0000000000007b52 <+7186>: vpminsd zmm21{k1},zmm6,zmm15 0x0000000000007b58 <+7192>: vmovdqa64 zmm6,zmm21 0x0000000000007b5e <+7198>: vpermt2d zmm6,zmm25,zmm19 0x0000000000007b64 <+7204>: vpermt2d zmm6,zmm1,zmm20 0x0000000000007b6a <+7210>: vpminsd zmm20{k2},zmm2,zmm13 0x0000000000007b70 <+7216>: vpmaxsd zmm2,zmm4,zmm9 0x0000000000007b76 <+7222>: vpmaxsd zmm13,zmm5,zmm8 0x0000000000007b7c <+7228>: vpmaxsd zmm15,zmm7,zmm10 0x0000000000007b82 <+7234>: vpminsd zmm15{k3},zmm7,zmm10 0x0000000000007b88 <+7240>: vmovdqa64 zmm7,zmm12 0x0000000000007b8e <+7246>: vpermt2d zmm7,zmm25,zmm15 0x0000000000007b94 <+7252>: vpermt2d zmm7,zmm1,zmm13 0x0000000000007b9a <+7258>: vpminsd zmm13{k1},zmm5,zmm8 0x0000000000007ba0 <+7264>: vmovdqa64 zmm5,zmm13 0x0000000000007ba6 <+7270>: vpermt2d zmm5,zmm25,zmm17 0x0000000000007bac <+7276>: vpermt2d zmm5,zmm1,zmm2 0x0000000000007bb2 <+7282>: vpminsd zmm2{k2},zmm4,zmm9 0x0000000000007bb8 <+7288>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5937e] # 0x60f40 0x0000000000007bc2 <+7298>: vmovdqa64 zmm8,zmm15 0x0000000000007bc8 <+7304>: vpermt2d zmm8,zmm4,zmm16 0x0000000000007bce <+7310>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x593a8] # 0x60f80 0x0000000000007bd8 <+7320>: vmovdqa64 zmm10,zmm2 0x0000000000007bde <+7326>: vpermt2d zmm10,zmm9,zmm13 0x0000000000007be4 <+7332>: vpermi2d zmm4,zmm3,zmm14 0x0000000000007bea <+7338>: vpermi2d zmm9,zmm20,zmm21 0x0000000000007bf0 <+7344>: vpmaxsd zmm14,zmm21,zmm6 0x0000000000007bf6 <+7350>: vpminsd zmm14{k6},zmm21,zmm6 0x0000000000007bfc <+7356>: vpmaxsd zmm6,zmm13,zmm5 0x0000000000007c02 <+7362>: vpminsd zmm6{k6},zmm13,zmm5 0x0000000000007c08 <+7368>: vpmaxsd zmm5,zmm11,zmm18 0x0000000000007c0e <+7374>: vpminsd zmm5{k6},zmm11,zmm18 0x0000000000007c14 <+7380>: vpmaxsd zmm11,zmm12,zmm7 0x0000000000007c1a <+7386>: kmovw WORD PTR [rsp+0x3e],k6 0x0000000000007c20 <+7392>: vpminsd zmm11{k6},zmm12,zmm7 0x0000000000007c26 <+7398>: vpmaxsd zmm7,zmm20,zmm9 0x0000000000007c2c <+7404>: mov ax,0xaaa 0x0000000000007c30 <+7408>: kmovd k2,eax 0x0000000000007c34 <+7412>: vpmaxsd zmm12,zmm2,zmm10 0x0000000000007c3a <+7418>: vpminsd zmm12{k2},zmm2,zmm10 0x0000000000007c40 <+7424>: mov ax,0xe000 0x0000000000007c44 <+7428>: kmovd k1,eax 0x0000000000007c48 <+7432>: vpblendmd zmm10{k1},zmm12,zmm7 0x0000000000007c4e <+7438>: vmovdqa64 zmm13,zmm7 0x0000000000007c54 <+7444>: vpminsd zmm13{k2},zmm20,zmm9 0x0000000000007c5a <+7450>: vpmaxsd zmm2,zmm3,zmm4 0x0000000000007c60 <+7456>: mov ax,0xaaa8 0x0000000000007c64 <+7460>: kmovd k2,eax 0x0000000000007c68 <+7464>: vpmaxsd zmm9,zmm15,zmm8 0x0000000000007c6e <+7470>: vpminsd zmm9{k2},zmm15,zmm8 0x0000000000007c74 <+7476>: mov ax,0x7 0x0000000000007c78 <+7480>: kmovd k3,eax 0x0000000000007c7c <+7484>: vpblendmd zmm8{k3},zmm9,zmm2 0x0000000000007c82 <+7490>: vpminsd zmm2{k2},zmm3,zmm4 0x0000000000007c88 <+7496>: vpblendmd zmm3{k3},zmm2,zmm9 0x0000000000007c8e <+7502>: vpblendmd zmm4{k1},zmm13,zmm12 0x0000000000007c94 <+7508>: vpminsd zmm15,zmm5,zmm11 0x0000000000007c9a <+7514>: vpminsd zmm16,zmm14,zmm6 0x0000000000007ca0 <+7520>: vpminsd zmm17,zmm13,zmm10 0x0000000000007ca6 <+7526>: vpminsd zmm7,zmm2,zmm8 0x0000000000007cac <+7532>: vpmaxsd zmm7{k3},zmm2,zmm8 0x0000000000007cb2 <+7538>: vpmaxsd zmm2,zmm12,zmm4 0x0000000000007cb8 <+7544>: vpmaxsd zmm4,zmm6,zmm14 0x0000000000007cbe <+7550>: vpmaxsd zmm17{k1},zmm13,zmm10 0x0000000000007cc4 <+7556>: vpmaxsd zmm5,zmm11,zmm5 0x0000000000007cca <+7562>: vpmaxsd zmm3,zmm9,zmm3 0x0000000000007cd0 <+7568>: vpminsd zmm6,zmm16,zmm3 0x0000000000007cd6 <+7574>: vpminsd zmm9,zmm17,zmm5 0x0000000000007cdc <+7580>: vpmaxsd zmm5,zmm5,zmm17 0x0000000000007ce2 <+7586>: vpmaxsd zmm3,zmm3,zmm16 0x0000000000007ce8 <+7592>: vpminsd zmm10,zmm9,zmm3 0x0000000000007cee <+7598>: vpminsd zmm8,zmm15,zmm6 0x0000000000007cf4 <+7604>: vpminsd zmm11,zmm5,zmm4 0x0000000000007cfa <+7610>: vpmaxsd zmm9,zmm3,zmm9 0x0000000000007d00 <+7616>: vpmaxsd zmm6,zmm6,zmm15 0x0000000000007d06 <+7622>: vpmaxsd zmm12,zmm4,zmm5 0x0000000000007d0c <+7628>: vshufi64x2 zmm13,zmm9,zmm12,0x4e 0x0000000000007d13 <+7635>: vshufi64x2 zmm5,zmm6,zmm9,0x4e 0x0000000000007d1a <+7642>: vshufi64x2 zmm14,zmm10,zmm11,0x4e 0x0000000000007d21 <+7649>: vshufi64x2 zmm15,zmm8,zmm10,0x4e 0x0000000000007d28 <+7656>: vshufi64x2 zmm16,zmm12,zmm2,0xee 0x0000000000007d2f <+7663>: vshufi64x2 zmm17,zmm7,zmm6,0x4e 0x0000000000007d36 <+7670>: vshufi64x2 zmm18,zmm11,zmm2,0x4e 0x0000000000007d3d <+7677>: vinserti64x4 zmm19,zmm7,ymm8,0x1 0x0000000000007d44 <+7684>: vpmaxsd zmm4,zmm6,zmm15 0x0000000000007d4a <+7690>: mov ax,0xff00 0x0000000000007d4e <+7694>: kmovd k1,eax 0x0000000000007d52 <+7698>: vmovdqa64 zmm3,zmm4 0x0000000000007d58 <+7704>: vpminsd zmm3{k1},zmm6,zmm15 0x0000000000007d5e <+7710>: vpmaxsd zmm6,zmm9,zmm14 0x0000000000007d64 <+7716>: vpminsd zmm15,zmm10,zmm5 0x0000000000007d6a <+7722>: vpmaxsd zmm10,zmm10,zmm5 0x0000000000007d70 <+7728>: vshufi64x2 zmm20,zmm10,zmm15,0xe4 0x0000000000007d77 <+7735>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x592bf] # 0x61040 0x0000000000007d81 <+7745>: vmovdqa64 zmm5,zmm20 0x0000000000007d87 <+7751>: vpermt2q zmm5,zmm21,zmm3 0x0000000000007d8d <+7757>: vinserti32x4 zmm22,zmm5,xmm6,0x3 0x0000000000007d94 <+7764>: vmovdqa64 zmm5,zmm6 0x0000000000007d9a <+7770>: vpminsd zmm5{k1},zmm9,zmm14 0x0000000000007da0 <+7776>: vpmaxsd zmm6,zmm7,zmm19 0x0000000000007da6 <+7782>: vpminsd zmm6{k1},zmm7,zmm19 0x0000000000007dac <+7788>: vpmaxsd zmm7,zmm12,zmm18 0x0000000000007db2 <+7794>: vpminsd zmm9,zmm11,zmm13 0x0000000000007db8 <+7800>: vpmaxsd zmm11,zmm11,zmm13 0x0000000000007dbe <+7806>: vshufi64x2 zmm19,zmm11,zmm9,0xe4 0x0000000000007dc5 <+7813>: vmovdqa64 zmm13,zmm19 0x0000000000007dcb <+7819>: vpermt2q zmm13,zmm21,zmm5 0x0000000000007dd1 <+7825>: vinserti32x4 zmm23,zmm13,xmm7,0x3 0x0000000000007dd8 <+7832>: vpminsd zmm7{k1},zmm12,zmm18 0x0000000000007dde <+7838>: vpminsd zmm12,zmm8,zmm17 0x0000000000007de4 <+7844>: vpmaxsd zmm8,zmm8,zmm17 0x0000000000007dea <+7850>: vpmaxsd zmm2,zmm2,zmm16 0x0000000000007df0 <+7856>: vshufi64x2 zmm13,zmm8,zmm12,0xe4 0x0000000000007df7 <+7863>: vmovdqa64 zmm14,zmm5 0x0000000000007dfd <+7869>: vpermt2q zmm14,zmm21,zmm15 0x0000000000007e03 <+7875>: vinserti32x4 zmm14,zmm14,xmm11,0x3 0x0000000000007e0a <+7882>: vmovdqa64 zmm11,zmm3 0x0000000000007e10 <+7888>: vpermt2q zmm11,zmm21,zmm12 0x0000000000007e16 <+7894>: vinserti32x4 zmm17,zmm11,xmm10,0x3 0x0000000000007e1d <+7901>: vmovdqa64 zmm10,zmm7 0x0000000000007e23 <+7907>: vpermt2q zmm10,zmm21,zmm9 0x0000000000007e29 <+7913>: vinserti32x4 zmm12,zmm10,xmm2,0x3 0x0000000000007e30 <+7920>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59246] # 0x61080 0x0000000000007e3a <+7930>: vpermi2q zmm18,zmm6,zmm8 0x0000000000007e40 <+7936>: vpermi2q zmm21,zmm13,zmm6 0x0000000000007e46 <+7942>: vinserti32x4 zmm4,zmm21,xmm4,0x3 0x0000000000007e4d <+7949>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x59269] # 0x610c0 0x0000000000007e57 <+7959>: vpermi2q zmm11,zmm2,zmm7 0x0000000000007e5d <+7965>: vpminsd zmm21,zmm20,zmm22 0x0000000000007e63 <+7971>: vpmaxsd zmm16,zmm20,zmm22 0x0000000000007e69 <+7977>: mov al,0xcc 0x0000000000007e6b <+7979>: kmovd k1,eax 0x0000000000007e6f <+7983>: vpblendmq zmm10{k1},zmm16,zmm21 0x0000000000007e75 <+7989>: vpminsd zmm20,zmm13,zmm4 0x0000000000007e7b <+7995>: vpmaxsd zmm13,zmm13,zmm4 0x0000000000007e81 <+8001>: vpblendmq zmm8{k1},zmm13,zmm20 0x0000000000007e87 <+8007>: vpminsd zmm22,zmm19,zmm23 0x0000000000007e8d <+8013>: vpmaxsd zmm19,zmm19,zmm23 0x0000000000007e93 <+8019>: vpblendmq zmm9{k1},zmm19,zmm22 0x0000000000007e99 <+8025>: vpmaxsd zmm15,zmm3,zmm17 0x0000000000007e9f <+8031>: mov ax,0xf0f0 0x0000000000007ea3 <+8035>: kmovd k1,eax 0x0000000000007ea7 <+8039>: vmovdqa64 zmm4,zmm15 0x0000000000007ead <+8045>: vpminsd zmm4{k1},zmm3,zmm17 0x0000000000007eb3 <+8051>: vpmaxsd zmm3,zmm5,zmm14 0x0000000000007eb9 <+8057>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x5923d] # 0x61100 0x0000000000007ec3 <+8067>: vmovdqa64 zmm23,zmm10 0x0000000000007ec9 <+8073>: vpermt2q zmm23,zmm17,zmm4 0x0000000000007ecf <+8079>: vpermt2q zmm23,zmm0,zmm3 0x0000000000007ed5 <+8085>: vmovdqa64 zmm24,zmm3 0x0000000000007edb <+8091>: vpminsd zmm24{k1},zmm5,zmm14 0x0000000000007ee1 <+8097>: vpmaxsd zmm5,zmm6,zmm18 0x0000000000007ee7 <+8103>: vpminsd zmm5{k1},zmm6,zmm18 0x0000000000007eed <+8109>: vpmaxsd zmm3,zmm7,zmm12 0x0000000000007ef3 <+8115>: vmovdqa64 zmm6,zmm9 0x0000000000007ef9 <+8121>: vpermt2q zmm6,zmm17,zmm24 0x0000000000007eff <+8127>: vpermt2q zmm6,zmm0,zmm3 0x0000000000007f05 <+8133>: vmovdqa64 zmm14,zmm3 0x0000000000007f0b <+8139>: vpminsd zmm14{k1},zmm7,zmm12 0x0000000000007f11 <+8145>: vpmaxsd zmm3,zmm2,zmm11 0x0000000000007f17 <+8151>: mov ax,0xf0 0x0000000000007f1b <+8155>: kmovd k1,eax 0x0000000000007f1f <+8159>: vmovdqa64 zmm7,zmm24 0x0000000000007f25 <+8165>: vpermt2q zmm7,zmm17,zmm21 0x0000000000007f2b <+8171>: vpermt2q zmm7,zmm0,zmm19 0x0000000000007f31 <+8177>: vmovdqa64 zmm12,zmm4 0x0000000000007f37 <+8183>: vpermt2q zmm12,zmm17,zmm20 0x0000000000007f3d <+8189>: vpermt2q zmm12,zmm0,zmm16 0x0000000000007f43 <+8195>: vmovdqa64 zmm16,zmm14 0x0000000000007f49 <+8201>: vpermt2q zmm16,zmm17,zmm22 0x0000000000007f4f <+8207>: vpermt2q zmm16,zmm0,zmm3 0x0000000000007f55 <+8213>: vpminsd zmm3{k1},zmm2,zmm11 0x0000000000007f5b <+8219>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x591db] # 0x61140 0x0000000000007f65 <+8229>: vpermi2q zmm2,zmm5,zmm13 0x0000000000007f6b <+8235>: vpermi2q zmm17,zmm8,zmm5 0x0000000000007f71 <+8241>: vpermt2q zmm17,zmm0,zmm15 0x0000000000007f77 <+8247>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x591ff] # 0x61180 0x0000000000007f81 <+8257>: vpermi2q zmm0,zmm3,zmm14 0x0000000000007f87 <+8263>: vpminsd zmm11,zmm10,zmm23 0x0000000000007f8d <+8269>: vpmaxsd zmm10,zmm10,zmm23 0x0000000000007f93 <+8275>: mov al,0xaa 0x0000000000007f95 <+8277>: kmovd k1,eax 0x0000000000007f99 <+8281>: vpblendmq zmm21{k1},zmm10,zmm11 0x0000000000007f9f <+8287>: vpminsd zmm13,zmm8,zmm17 0x0000000000007fa5 <+8293>: vpmaxsd zmm8,zmm8,zmm17 0x0000000000007fab <+8299>: vpblendmq zmm20{k1},zmm8,zmm13 0x0000000000007fb1 <+8305>: vpminsd zmm15,zmm9,zmm6 0x0000000000007fb7 <+8311>: vpmaxsd zmm6,zmm9,zmm6 0x0000000000007fbd <+8317>: vpblendmq zmm22{k1},zmm6,zmm15 0x0000000000007fc3 <+8323>: vpminsd zmm9,zmm4,zmm12 0x0000000000007fc9 <+8329>: vpminsd zmm17,zmm24,zmm7 0x0000000000007fcf <+8335>: vpmaxsd zmm18,zmm3,zmm0 0x0000000000007fd5 <+8341>: mov ax,0xccc 0x0000000000007fd9 <+8345>: kmovd k1,eax 0x0000000000007fdd <+8349>: vpminsd zmm19,zmm5,zmm2 0x0000000000007fe3 <+8355>: vpmaxsd zmm4,zmm4,zmm12 0x0000000000007fe9 <+8361>: vpminsd zmm12,zmm14,zmm16 0x0000000000007fef <+8367>: vpmaxsd zmm7,zmm24,zmm7 0x0000000000007ff5 <+8373>: vpmaxsd zmm2,zmm5,zmm2 0x0000000000007ffb <+8379>: vshufps zmm5,zmm2,zmm19,0xe4 0x0000000000008002 <+8386>: vpmaxsd zmm2,zmm14,zmm16 0x0000000000008008 <+8392>: vshufps zmm16,zmm7,zmm17,0xe4 0x000000000000800f <+8399>: vshufps zmm14,zmm4,zmm9,0xe4 0x0000000000008016 <+8406>: vshufps zmm9,zmm2,zmm12,0xe4 0x000000000000801d <+8413>: vmovaps zmm12,zmm14 0x0000000000008023 <+8419>: vpermt2d zmm12,zmm25,zmm13 0x0000000000008029 <+8425>: vmovdqa64 ZMMWORD PTR [rsp+0x800],zmm21 0x0000000000008031 <+8433>: vmovaps ZMMWORD PTR [rsp+0x700],zmm14 0x0000000000008039 <+8441>: vpermt2d zmm21,zmm25,zmm14 0x000000000000803f <+8447>: vmovaps zmm13,zmm16 0x0000000000008045 <+8453>: vpermt2d zmm13,zmm25,zmm11 0x000000000000804b <+8459>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm22 0x0000000000008053 <+8467>: vmovaps ZMMWORD PTR [rsp+0x680],zmm16 0x000000000000805b <+8475>: vpermt2d zmm22,zmm25,zmm16 0x0000000000008061 <+8481>: vmovdqa64 ZMMWORD PTR [rsp+0x840],zmm20 0x0000000000008069 <+8489>: vpermt2d zmm20,zmm25,zmm5 0x000000000000806f <+8495>: vpermi2d zmm25,zmm9,zmm15 0x0000000000008075 <+8501>: vpermt2d zmm25,zmm1,zmm18 0x000000000000807b <+8507>: vmovdqa64 ZMMWORD PTR [rsp+0x880],zmm25 0x0000000000008083 <+8515>: vpminsd zmm18{k1},zmm3,zmm0 0x0000000000008089 <+8521>: vpermt2d zmm12,zmm1,zmm10 0x000000000000808f <+8527>: vmovdqa64 ZMMWORD PTR [rsp+0x6c0],zmm12 0x0000000000008097 <+8535>: vpermt2d zmm21,zmm1,zmm7 0x000000000000809d <+8541>: vmovdqa64 ZMMWORD PTR [rsp+0x640],zmm21 0x00000000000080a5 <+8549>: vpermt2d zmm13,zmm1,zmm6 0x00000000000080ab <+8555>: vmovdqa64 ZMMWORD PTR [rsp+0x5c0],zmm13 0x00000000000080b3 <+8563>: vpermt2d zmm22,zmm1,zmm2 0x00000000000080b9 <+8569>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm22 0x00000000000080c1 <+8577>: vpermt2d zmm20,zmm1,zmm4 0x00000000000080c7 <+8583>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm20 0x00000000000080cf <+8591>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x590e7] # 0x611c0 0x00000000000080d9 <+8601>: vmovaps ZMMWORD PTR [rsp+0x780],zmm5 0x00000000000080e1 <+8609>: vpermi2d zmm0,zmm5,zmm8 0x00000000000080e7 <+8615>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm0 0x00000000000080ef <+8623>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59107] # 0x61200 0x00000000000080f9 <+8633>: vmovaps ZMMWORD PTR [rsp+0x740],zmm9 0x0000000000008101 <+8641>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm18 0x0000000000008109 <+8649>: vpermi2d zmm0,zmm18,zmm9 0x000000000000810f <+8655>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm0 0x0000000000008117 <+8663>: vpxor xmm0,xmm0,xmm0 0x000000000000811b <+8667>: vmovdqa XMMWORD PTR [rsp+0xf0],xmm0 0x0000000000008124 <+8676>: lea rsi,[rsp+0xf0] 0x000000000000812c <+8684>: mov edi,0x1 0x0000000000008131 <+8689>: vzeroupper 0x0000000000008134 <+8692>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int32_16.asm --- 0x00000000000060ab <+603>: call 0x5470 <clock_gettime@plt> 0x00000000000060b0 <+608>: mov rbx,QWORD PTR [rsp+0xa0] 0x00000000000060b8 <+616>: mov rax,QWORD PTR [rsp+0xa8] 0x00000000000060c0 <+624>: mov QWORD PTR [rsp+0x150],rax 0x00000000000060c8 <+632>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5706e] # 0x5d140 0x00000000000060d2 <+642>: vmovdqu64 zmm2,ZMMWORD PTR [rsp+0x110] 0x00000000000060dd <+653>: vpermd zmm0,zmm0,zmm2 0x00000000000060e3 <+659>: vpminsd zmm1,zmm2,zmm0 0x00000000000060e9 <+665>: mov ax,0xf2b0 0x00000000000060ed <+669>: kmovd k1,eax 0x00000000000060f1 <+673>: vpmaxsd zmm1{k1},zmm2,zmm0 0x00000000000060f7 <+679>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5707f] # 0x5d180 0x0000000000006101 <+689>: vpermd zmm0,zmm0,zmm1 0x0000000000006107 <+695>: vpminsd zmm2,zmm1,zmm0 0x000000000000610d <+701>: mov ax,0xdcc4 0x0000000000006111 <+705>: kmovd k1,eax 0x0000000000006115 <+709>: vpmaxsd zmm2{k1},zmm1,zmm0 0x000000000000611b <+715>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5709b] # 0x5d1c0 0x0000000000006125 <+725>: vpermd zmm0,zmm0,zmm2 0x000000000000612b <+731>: vpminsd zmm1,zmm2,zmm0 0x0000000000006131 <+737>: mov ax,0xef08 0x0000000000006135 <+741>: kmovd k1,eax 0x0000000000006139 <+745>: vpmaxsd zmm1{k1},zmm2,zmm0 0x000000000000613f <+751>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570b7] # 0x5d200 0x0000000000006149 <+761>: vpermd zmm0,zmm0,zmm1 0x000000000000614f <+767>: vpminsd zmm2,zmm1,zmm0 0x0000000000006155 <+773>: mov ax,0xb552 0x0000000000006159 <+777>: kmovd k1,eax 0x000000000000615d <+781>: vpmaxsd zmm2{k1},zmm1,zmm0 0x0000000000006163 <+787>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570d3] # 0x5d240 0x000000000000616d <+797>: vpermd zmm0,zmm0,zmm2 0x0000000000006173 <+803>: vpmaxsd zmm1,zmm2,zmm0 0x0000000000006179 <+809>: mov ax,0x14d6 0x000000000000617d <+813>: kmovd k1,eax 0x0000000000006181 <+817>: vpminsd zmm1{k1},zmm2,zmm0 0x0000000000006187 <+823>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570ef] # 0x5d280 0x0000000000006191 <+833>: vpermd zmm0,zmm0,zmm1 0x0000000000006197 <+839>: vpmaxsd zmm2,zmm1,zmm0 0x000000000000619d <+845>: mov ax,0x24da 0x00000000000061a1 <+849>: kmovd k1,eax 0x00000000000061a5 <+853>: vpminsd zmm2{k1},zmm1,zmm0 0x00000000000061ab <+859>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5710b] # 0x5d2c0 0x00000000000061b5 <+869>: vpermd zmm0,zmm0,zmm2 0x00000000000061bb <+875>: vpmaxsd zmm1,zmm2,zmm0 0x00000000000061c1 <+881>: mov ax,0x1554 0x00000000000061c5 <+885>: kmovd k1,eax 0x00000000000061c9 <+889>: vpminsd zmm1{k1},zmm2,zmm0 0x00000000000061cf <+895>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57127] # 0x5d300 0x00000000000061d9 <+905>: vpermq zmm0,zmm0,zmm1 0x00000000000061df <+911>: vpmaxsd zmm2,zmm1,zmm0 0x00000000000061e5 <+917>: mov ax,0x330 0x00000000000061e9 <+921>: kmovd k1,eax 0x00000000000061ed <+925>: vpminsd zmm2{k1},zmm1,zmm0 0x00000000000061f3 <+931>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57143] # 0x5d340 0x00000000000061fd <+941>: vmovdqu64 ZMMWORD PTR [rsp+0x270],zmm2 0x0000000000006208 <+952>: vpermd zmm0,zmm0,zmm2 0x000000000000620e <+958>: vmovdqu64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x0000000000006216 <+966>: mov bp,0xaa8 0x000000000000621a <+970>: vpxor xmm0,xmm0,xmm0 0x000000000000621e <+974>: vmovdqa XMMWORD PTR [rsp+0xc0],xmm0 0x0000000000006227 <+983>: lea rsi,[rsp+0xc0] 0x000000000000622f <+991>: mov edi,0x1 0x0000000000006234 <+996>: vzeroupper 0x0000000000006237 <+999>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int32_32.asm --- 0x0000000000006100 <+640>: call 0x5470 <clock_gettime@plt> 0x0000000000006105 <+645>: mov rbx,QWORD PTR [rsp+0xd0] 0x000000000000610d <+653>: mov rax,QWORD PTR [rsp+0xd8] 0x0000000000006115 <+661>: mov QWORD PTR [rsp+0x1d0],rax 0x000000000000611d <+669>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x140] 0x0000000000006125 <+677>: vpshufd zmm0,zmm5,0xb1 0x000000000000612c <+684>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x180] 0x0000000000006134 <+692>: vpshufd zmm1,zmm4,0xb1 0x000000000000613b <+699>: vpminsd zmm2,zmm4,zmm1 0x0000000000006141 <+705>: vpminsd zmm3,zmm5,zmm0 0x0000000000006147 <+711>: mov ax,0xaaaa 0x000000000000614b <+715>: kmovd k1,eax 0x000000000000614f <+719>: vpmaxsd zmm3{k1},zmm5,zmm0 0x0000000000006155 <+725>: vpmaxsd zmm2{k1},zmm4,zmm1 0x000000000000615b <+731>: vpshufd zmm0,zmm2,0x4e 0x0000000000006162 <+738>: vpshufd zmm1,zmm3,0x4e 0x0000000000006169 <+745>: vpminsd zmm4,zmm3,zmm1 0x000000000000616f <+751>: vpminsd zmm5,zmm2,zmm0 0x0000000000006175 <+757>: vpmaxsd zmm1,zmm3,zmm1 0x000000000000617b <+763>: vshufps zmm1,zmm4,zmm1,0xe4 0x0000000000006182 <+770>: vpmaxsd zmm0,zmm2,zmm0 0x0000000000006188 <+776>: vshufps zmm0,zmm5,zmm0,0xe4 0x000000000000618f <+783>: vpxor xmm2,xmm2,xmm2 0x0000000000006193 <+787>: vpermpd zmm2,zmm1,0x4e 0x000000000000619a <+794>: vpxor xmm3,xmm3,xmm3 0x000000000000619e <+798>: vpermpd zmm3,zmm0,0x4e 0x00000000000061a5 <+805>: vpminsd zmm4,zmm0,zmm3 0x00000000000061ab <+811>: vpminsd zmm5,zmm1,zmm2 0x00000000000061b1 <+817>: mov ax,0xf0f0 0x00000000000061b5 <+821>: kmovd k1,eax 0x00000000000061b9 <+825>: vpmaxsd zmm5{k1},zmm1,zmm2 0x00000000000061bf <+831>: vpmaxsd zmm4{k1},zmm0,zmm3 0x00000000000061c5 <+837>: vshufi64x2 zmm0,zmm4,zmm4,0x4e 0x00000000000061cc <+844>: vshufi64x2 zmm1,zmm5,zmm5,0x4e 0x00000000000061d3 <+851>: vpminsd zmm2,zmm5,zmm1 0x00000000000061d9 <+857>: vpminsd zmm3,zmm4,zmm0 0x00000000000061df <+863>: mov ax,0xff00 0x00000000000061e3 <+867>: kmovd k1,eax 0x00000000000061e7 <+871>: vpmaxsd zmm3{k1},zmm4,zmm0 0x00000000000061ed <+877>: vpmaxsd zmm2{k1},zmm5,zmm1 0x00000000000061f3 <+883>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f03] # 0x5d100 0x00000000000061fd <+893>: vmovdqa64 zmm1,zmm3 0x0000000000006203 <+899>: vpermt2d zmm1,zmm0,zmm2 0x0000000000006209 <+905>: vpermi2d zmm0,zmm2,zmm3 0x000000000000620f <+911>: vpmaxsd zmm4,zmm2,zmm0 0x0000000000006215 <+917>: mov ax,0x8ee 0x0000000000006219 <+921>: kmovd k1,eax 0x000000000000621d <+925>: vpminsd zmm4{k1},zmm2,zmm0 0x0000000000006223 <+931>: vpminsd zmm0,zmm3,zmm1 0x0000000000006229 <+937>: mov ax,0x7710 0x000000000000622d <+941>: kmovd k1,eax 0x0000000000006231 <+945>: vpmaxsd zmm0{k1},zmm3,zmm1 0x0000000000006237 <+951>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56eff] # 0x5d140 0x0000000000006241 <+961>: vmovdqa64 zmm2,zmm0 0x0000000000006247 <+967>: vpermt2d zmm2,zmm1,zmm4 0x000000000000624d <+973>: vpermi2d zmm1,zmm4,zmm0 0x0000000000006253 <+979>: vpmaxsd zmm3,zmm4,zmm1 0x0000000000006259 <+985>: mov ax,0x249a 0x000000000000625d <+989>: kmovd k1,eax 0x0000000000006261 <+993>: vpminsd zmm3{k1},zmm4,zmm1 0x0000000000006267 <+999>: vpminsd zmm1,zmm0,zmm2 0x000000000000626d <+1005>: mov ax,0xd925 0x0000000000006271 <+1009>: kmovd k1,eax 0x0000000000006275 <+1013>: vpmaxsd zmm1{k1},zmm0,zmm2 0x000000000000627b <+1019>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56efb] # 0x5d180 0x0000000000006285 <+1029>: vmovdqa64 zmm2,zmm3 0x000000000000628b <+1035>: vpermt2d zmm2,zmm0,zmm1 0x0000000000006291 <+1041>: vpermi2d zmm0,zmm1,zmm3 0x0000000000006297 <+1047>: vpmaxsd zmm4,zmm3,zmm0 0x000000000000629d <+1053>: mov ax,0x20 0x00000000000062a1 <+1057>: kmovd k1,eax 0x00000000000062a5 <+1061>: vpminsd zmm4{k1},zmm3,zmm0 0x00000000000062ab <+1067>: vpminsd zmm0,zmm1,zmm2 0x00000000000062b1 <+1073>: mov ax,0x8641 0x00000000000062b5 <+1077>: kmovd k1,eax 0x00000000000062b9 <+1081>: vpmaxsd zmm0{k1},zmm1,zmm2 0x00000000000062bf <+1087>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56ef7] # 0x5d1c0 0x00000000000062c9 <+1097>: vpermi2d zmm1,zmm4,zmm0 0x00000000000062cf <+1103>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x56f27] # 0x5d200 0x00000000000062d9 <+1113>: vpermi2d zmm2,zmm0,zmm4 0x00000000000062df <+1119>: vpmaxsd zmm3,zmm4,zmm2 0x00000000000062e5 <+1125>: mov ax,0x40 0x00000000000062e9 <+1129>: kmovd k1,eax 0x00000000000062ed <+1133>: vpminsd zmm3{k1},zmm4,zmm2 0x00000000000062f3 <+1139>: vpminsd zmm2,zmm0,zmm1 0x00000000000062f9 <+1145>: mov ax,0x1207 0x00000000000062fd <+1149>: kmovd k1,eax 0x0000000000006301 <+1153>: vpmaxsd zmm2{k1},zmm0,zmm1 0x0000000000006307 <+1159>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f2f] # 0x5d240 0x0000000000006311 <+1169>: vpermi2d zmm0,zmm2,zmm3 0x0000000000006317 <+1175>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f5f] # 0x5d280 0x0000000000006321 <+1185>: vpermi2d zmm1,zmm2,zmm3 0x0000000000006327 <+1191>: vpmaxsd zmm4,zmm3,zmm1 0x000000000000632d <+1197>: mov ax,0x880 0x0000000000006331 <+1201>: vpminsd zmm5,zmm2,zmm0 0x0000000000006337 <+1207>: mov cx,0x2155 0x000000000000633b <+1211>: kmovd k1,ecx 0x000000000000633f <+1215>: vpmaxsd zmm5{k1},zmm2,zmm0 0x0000000000006345 <+1221>: kmovd k1,eax 0x0000000000006349 <+1225>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fad] # 0x5d300 0x0000000000006353 <+1235>: vpermi2d zmm0,zmm5,zmm4 0x0000000000006359 <+1241>: vpminsd zmm4{k1},zmm3,zmm1 0x000000000000635f <+1247>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f57] # 0x5d2c0 0x0000000000006369 <+1257>: vpermi2d zmm1,zmm4,zmm5 0x000000000000636f <+1263>: vpmaxsd zmm2,zmm4,zmm1 0x0000000000006375 <+1269>: mov ax,0x480 0x0000000000006379 <+1273>: vpmaxsd zmm3,zmm5,zmm0 0x000000000000637f <+1279>: mov cx,0xfa84 0x0000000000006383 <+1283>: kmovd k1,ecx 0x0000000000006387 <+1287>: vpminsd zmm3{k1},zmm5,zmm0 0x000000000000638d <+1293>: kmovd k1,eax 0x0000000000006391 <+1297>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fe5] # 0x5d380 0x000000000000639b <+1307>: vpermi2d zmm0,zmm3,zmm2 0x00000000000063a1 <+1313>: vpminsd zmm2{k1},zmm4,zmm1 0x00000000000063a7 <+1319>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f8f] # 0x5d340 0x00000000000063b1 <+1329>: vpermi2d zmm1,zmm2,zmm3 0x00000000000063b7 <+1335>: vpmaxsd zmm4,zmm3,zmm0 0x00000000000063bd <+1341>: mov ax,0xe644 0x00000000000063c1 <+1345>: kmovd k1,eax 0x00000000000063c5 <+1349>: vpminsd zmm4{k1},zmm3,zmm0 0x00000000000063cb <+1355>: vpmaxsd zmm0,zmm2,zmm1 0x00000000000063d1 <+1361>: mov ax,0x818 0x00000000000063d5 <+1365>: kmovd k1,eax 0x00000000000063d9 <+1369>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5701d] # 0x5d400 0x00000000000063e3 <+1379>: vpermi2d zmm3,zmm4,zmm0 0x00000000000063e9 <+1385>: vpminsd zmm0{k1},zmm2,zmm1 0x00000000000063ef <+1391>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56fc7] # 0x5d3c0 0x00000000000063f9 <+1401>: vpermi2d zmm1,zmm0,zmm4 0x00000000000063ff <+1407>: vpmaxsd zmm2,zmm4,zmm3 0x0000000000006405 <+1413>: mov ax,0xcb20 0x0000000000006409 <+1417>: kmovd k1,eax 0x000000000000640d <+1421>: vpminsd zmm2{k1},zmm4,zmm3 0x0000000000006413 <+1427>: vpmaxsd zmm3,zmm0,zmm1 0x0000000000006419 <+1433>: mov ax,0x22c 0x000000000000641d <+1437>: kmovd k1,eax 0x0000000000006421 <+1441>: vpminsd zmm3{k1},zmm0,zmm1 0x0000000000006427 <+1447>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5700f] # 0x5d440 0x0000000000006431 <+1457>: vpermi2d zmm0,zmm3,zmm2 0x0000000000006437 <+1463>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5703f] # 0x5d480 0x0000000000006441 <+1473>: vpermi2d zmm1,zmm2,zmm3 0x0000000000006447 <+1479>: vpmaxsd zmm4,zmm2,zmm1 0x000000000000644d <+1485>: mov ax,0xad48 0x0000000000006451 <+1489>: kmovd k1,eax 0x0000000000006455 <+1493>: vpminsd zmm4{k1},zmm2,zmm1 0x000000000000645b <+1499>: vpmaxsd zmm1,zmm3,zmm0 0x0000000000006461 <+1505>: mov ax,0x54a 0x0000000000006465 <+1509>: kmovd k1,eax 0x0000000000006469 <+1513>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5708d] # 0x5d500 0x0000000000006473 <+1523>: vpermi2d zmm2,zmm4,zmm1 0x0000000000006479 <+1529>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm2 0x0000000000006481 <+1537>: vpminsd zmm1{k1},zmm3,zmm0 0x0000000000006487 <+1543>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5702f] # 0x5d4c0 0x0000000000006491 <+1553>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm4 0x0000000000006499 <+1561>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm1 0x00000000000064a1 <+1569>: vpermi2d zmm0,zmm1,zmm4 0x00000000000064a7 <+1575>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm0 0x00000000000064af <+1583>: vpxor xmm0,xmm0,xmm0 0x00000000000064b3 <+1587>: vmovdqa XMMWORD PTR [rsp+0xf0],xmm0 0x00000000000064bc <+1596>: lea rsi,[rsp+0xf0] 0x00000000000064c4 <+1604>: mov edi,0x1 0x00000000000064c9 <+1609>: vzeroupper 0x00000000000064cc <+1612>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int32_64.asm --- 0x00000000000061b0 <+752>: call 0x5470 <clock_gettime@plt> 0x00000000000061b5 <+757>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x140] 0x00000000000061bd <+765>: vpshufd zmm0,zmm9,0x4e 0x00000000000061c4 <+772>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x340] 0x00000000000061cc <+780>: vpshufd zmm1,zmm10,0x4e 0x00000000000061d3 <+787>: vmovdqa64 zmm8,ZMMWORD PTR [rsp+0x180] 0x00000000000061db <+795>: vpshufd zmm2,zmm8,0x4e 0x00000000000061e2 <+802>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x300] 0x00000000000061ea <+810>: vpshufd zmm3,zmm11,0x4e 0x00000000000061f1 <+817>: vpminsd zmm4,zmm11,zmm3 0x00000000000061f7 <+823>: vpminsd zmm5,zmm8,zmm2 0x00000000000061fd <+829>: vpminsd zmm6,zmm10,zmm1 0x0000000000006203 <+835>: vpminsd zmm7,zmm9,zmm0 0x0000000000006209 <+841>: vpmaxsd zmm3,zmm11,zmm3 0x000000000000620f <+847>: vpmaxsd zmm2,zmm8,zmm2 0x0000000000006215 <+853>: vpmaxsd zmm1,zmm10,zmm1 0x000000000000621b <+859>: vpmaxsd zmm0,zmm9,zmm0 0x0000000000006221 <+865>: vshufps zmm8,zmm7,zmm0,0xe4 0x0000000000006228 <+872>: vshufps zmm9,zmm6,zmm1,0xe4 0x000000000000622f <+879>: vshufps zmm10,zmm5,zmm2,0xe4 0x0000000000006236 <+886>: vshufps zmm11,zmm4,zmm3,0xe4 0x000000000000623d <+893>: vshufps zmm7,zmm7,zmm0,0xb1 0x0000000000006244 <+900>: vshufps zmm1,zmm6,zmm1,0xb1 0x000000000000624b <+907>: vshufps zmm2,zmm5,zmm2,0xb1 0x0000000000006252 <+914>: vshufps zmm3,zmm4,zmm3,0xb1 0x0000000000006259 <+921>: vpminsd zmm4,zmm11,zmm3 0x000000000000625f <+927>: vpminsd zmm0,zmm10,zmm2 0x0000000000006265 <+933>: vpminsd zmm5,zmm9,zmm1 0x000000000000626b <+939>: vpminsd zmm6,zmm8,zmm7 0x0000000000006271 <+945>: mov ax,0xaaaa 0x0000000000006275 <+949>: kmovd k1,eax 0x0000000000006279 <+953>: vpmaxsd zmm6{k1},zmm8,zmm7 0x000000000000627f <+959>: vpmaxsd zmm5{k1},zmm9,zmm1 0x0000000000006285 <+965>: vpmaxsd zmm0{k1},zmm10,zmm2 0x000000000000628b <+971>: kmovw WORD PTR [rsp+0x3e],k1 0x0000000000006291 <+977>: vpmaxsd zmm4{k1},zmm11,zmm3 0x0000000000006297 <+983>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57edf] # 0x5e180 0x00000000000062a1 <+993>: vpermi2d zmm1,zmm0,zmm4 0x00000000000062a7 <+999>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57f0f] # 0x5e1c0 0x00000000000062b1 <+1009>: vpermi2d zmm7,zmm1,zmm5 0x00000000000062b7 <+1015>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57f3f] # 0x5e200 0x00000000000062c1 <+1025>: vpermi2d zmm8,zmm6,zmm5 0x00000000000062c7 <+1031>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57f6f] # 0x5e240 0x00000000000062d1 <+1041>: vpermi2d zmm2,zmm4,zmm0 0x00000000000062d7 <+1047>: vshufi64x2 zmm1,zmm0,zmm6,0xbe 0x00000000000062de <+1054>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57f98] # 0x5e280 0x00000000000062e8 <+1064>: vpermi2d zmm3,zmm1,zmm5 0x00000000000062ee <+1070>: vpmaxsd zmm9,zmm5,zmm3 0x00000000000062f4 <+1076>: mov ax,0x2222 0x00000000000062f8 <+1080>: kmovd k1,eax 0x00000000000062fc <+1084>: vmovdqa64 zmm1,zmm9 0x0000000000006302 <+1090>: vpminsd zmm1{k1},zmm5,zmm3 0x0000000000006308 <+1096>: vpmaxsd zmm5,zmm4,zmm2 0x000000000000630e <+1102>: mov ax,0x2b22 0x0000000000006312 <+1106>: kmovd k1,eax 0x0000000000006316 <+1110>: vmovdqa64 zmm11,zmm5 0x000000000000631c <+1116>: vpminsd zmm11{k1},zmm4,zmm2 0x0000000000006322 <+1122>: vpminsd zmm2,zmm6,zmm8 0x0000000000006328 <+1128>: vpminsd zmm4,zmm0,zmm7 0x000000000000632e <+1134>: mov ax,0x4444 0x0000000000006332 <+1138>: kmovd k1,eax 0x0000000000006336 <+1142>: mov ax,0x44d4 0x000000000000633a <+1146>: kmovd k2,eax 0x000000000000633e <+1150>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57f78] # 0x5e2c0 0x0000000000006348 <+1160>: vpermi2d zmm3,zmm11,zmm4 0x000000000000634e <+1166>: mov ax,0x6690 0x0000000000006352 <+1170>: kmovd k3,eax 0x0000000000006356 <+1174>: vshufi32x4 zmm3{k3},zmm2,zmm1,0x48 0x000000000000635d <+1181>: vpmaxsd zmm2{k2},zmm6,zmm8 0x0000000000006363 <+1187>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57f93] # 0x5e300 0x000000000000636d <+1197>: vpermi2d zmm8,zmm2,zmm4 0x0000000000006373 <+1203>: vmovdqa64 zmm6,zmm4 0x0000000000006379 <+1209>: vpmaxsd zmm6{k1},zmm0,zmm7 0x000000000000637f <+1215>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57fb7] # 0x5e340 0x0000000000006389 <+1225>: vpermi2d zmm7,zmm8,zmm1 0x000000000000638f <+1231>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57fe7] # 0x5e380 0x0000000000006399 <+1241>: vpermi2d zmm8,zmm2,zmm9 0x000000000000639f <+1247>: mov ax,0x966 0x00000000000063a3 <+1251>: kmovd k1,eax 0x00000000000063a7 <+1255>: vshufi32x4 zmm8{k1},zmm6,zmm5,0xde 0x00000000000063ae <+1262>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58008] # 0x5e3c0 0x00000000000063b8 <+1272>: vpermi2d zmm0,zmm11,zmm6 0x00000000000063be <+1278>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58038] # 0x5e400 0x00000000000063c8 <+1288>: vpermi2d zmm4,zmm0,zmm1 0x00000000000063ce <+1294>: vpminsd zmm10,zmm11,zmm4 0x00000000000063d4 <+1300>: vpmaxsd zmm9,zmm11,zmm4 0x00000000000063da <+1306>: mov ax,0x699 0x00000000000063de <+1310>: kmovd k1,eax 0x00000000000063e2 <+1314>: vpblendmd zmm0{k1},zmm9,zmm10 0x00000000000063e8 <+1320>: vpmaxsd zmm5,zmm1,zmm8 0x00000000000063ee <+1326>: mov ax,0x90 0x00000000000063f2 <+1330>: kmovd k1,eax 0x00000000000063f6 <+1334>: vpmaxsd zmm11,zmm2,zmm7 0x00000000000063fc <+1340>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x581ba] # 0x5e5c0 0x0000000000006406 <+1350>: vpermi2q zmm12,zmm0,zmm11 0x000000000000640c <+1356>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x581ea] # 0x5e600 0x0000000000006416 <+1366>: vpermi2d zmm4,zmm12,zmm5 0x000000000000641c <+1372>: vpminsd zmm5{k1},zmm1,zmm8 0x0000000000006422 <+1378>: vpminsd zmm1,zmm2,zmm7 0x0000000000006428 <+1384>: vpminsd zmm2,zmm6,zmm3 0x000000000000642e <+1390>: mov ax,0x900 0x0000000000006432 <+1394>: kmovd k1,eax 0x0000000000006436 <+1398>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58000] # 0x5e440 0x0000000000006440 <+1408>: vpermi2d zmm8,zmm2,zmm10 0x0000000000006446 <+1414>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x580b0] # 0x5e500 0x0000000000006450 <+1424>: vpermi2q zmm10,zmm9,zmm2 0x0000000000006456 <+1430>: vpmaxsd zmm2{k1},zmm6,zmm3 0x000000000000645c <+1436>: mov ax,0x9960 0x0000000000006460 <+1440>: kmovd k1,eax 0x0000000000006464 <+1444>: vpblendmd zmm7{k1},zmm1,zmm11 0x000000000000646a <+1450>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x5800c] # 0x5e480 0x0000000000006474 <+1460>: vpermi2d zmm6,zmm8,zmm7 0x000000000000647a <+1466>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5803c] # 0x5e4c0 0x0000000000006484 <+1476>: vpermi2d zmm3,zmm5,zmm7 0x000000000000648a <+1482>: mov ax,0x6606 0x000000000000648e <+1486>: kmovd k1,eax 0x0000000000006492 <+1490>: vmovdqa32 zmm3{k1},zmm10 0x0000000000006498 <+1496>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x5809e] # 0x5e540 0x00000000000064a2 <+1506>: vpermi2d zmm9,zmm2,zmm0 0x00000000000064a8 <+1512>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x580ce] # 0x5e580 0x00000000000064b2 <+1522>: vpermi2q zmm8,zmm1,zmm5 0x00000000000064b8 <+1528>: mov ax,0x6066 0x00000000000064bc <+1532>: kmovd k1,eax 0x00000000000064c0 <+1536>: vmovdqa32 zmm9{k1},zmm8 0x00000000000064c6 <+1542>: vpmaxsd zmm10,zmm7,zmm9 0x00000000000064cc <+1548>: vpmaxsd zmm8,zmm5,zmm4 0x00000000000064d2 <+1554>: vpminsd zmm1,zmm0,zmm3 0x00000000000064d8 <+1560>: vpminsd zmm11,zmm2,zmm6 0x00000000000064de <+1566>: mov ax,0x6600 0x00000000000064e2 <+1570>: kmovd k1,eax 0x00000000000064e6 <+1574>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x58150] # 0x5e640 0x00000000000064f0 <+1584>: vpermi2q zmm12,zmm1,zmm11 0x00000000000064f6 <+1590>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x581c0] # 0x5e6c0 0x0000000000006500 <+1600>: vpermi2d zmm13,zmm11,zmm1 0x0000000000006506 <+1606>: vpmaxsd zmm1{k1},zmm0,zmm3 0x000000000000650c <+1612>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x582aa] # 0x5e7c0 0x0000000000006516 <+1622>: vpermi2d zmm0,zmm1,zmm10 0x000000000000651c <+1628>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x582da] # 0x5e800 0x0000000000006526 <+1638>: vpermi2d zmm3,zmm0,zmm8 0x000000000000652c <+1644>: mov ax,0x69 0x0000000000006530 <+1648>: kmovd k1,eax 0x0000000000006534 <+1652>: vpminsd zmm8{k1},zmm5,zmm4 0x000000000000653a <+1658>: mov rbx,QWORD PTR [rsp+0xd0] 0x0000000000006542 <+1666>: mov rax,QWORD PTR [rsp+0xd8] 0x000000000000654a <+1674>: mov QWORD PTR [rsp+0x1e0],rax 0x0000000000006552 <+1682>: mov ax,0x66 0x0000000000006556 <+1686>: kmovd k2,eax 0x000000000000655a <+1690>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5821c] # 0x5e780 0x0000000000006564 <+1700>: vpermi2q zmm0,zmm10,zmm8 0x000000000000656a <+1706>: vmovdqa64 zmm4,zmm10 0x0000000000006570 <+1712>: vpminsd zmm4{k2},zmm7,zmm9 0x0000000000006576 <+1718>: mov ax,0x9600 0x000000000000657a <+1722>: kmovd k2,eax 0x000000000000657e <+1726>: vpmaxsd zmm11{k2},zmm2,zmm6 0x0000000000006584 <+1732>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x580f2] # 0x5e680 0x000000000000658e <+1742>: vpermi2d zmm2,zmm8,zmm4 0x0000000000006594 <+1748>: mov ax,0x999 0x0000000000006598 <+1752>: kmovd k2,eax 0x000000000000659c <+1756>: vmovdqa32 zmm2{k2},zmm12 0x00000000000065a2 <+1762>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58154] # 0x5e700 0x00000000000065ac <+1772>: vpermi2d zmm5,zmm13,zmm4 0x00000000000065b2 <+1778>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58184] # 0x5e740 0x00000000000065bc <+1788>: vpermi2d zmm6,zmm11,zmm1 0x00000000000065c2 <+1794>: mov ax,0x9990 0x00000000000065c6 <+1798>: kmovd k2,eax 0x00000000000065ca <+1802>: vmovdqa32 zmm6{k2},zmm0 0x00000000000065d0 <+1808>: vpmaxsd zmm7,zmm4,zmm6 0x00000000000065d6 <+1814>: mov ax,0x9090 0x00000000000065da <+1818>: kmovd k2,eax 0x00000000000065de <+1822>: vpminsd zmm0,zmm11,zmm5 0x00000000000065e4 <+1828>: vpminsd zmm9,zmm1,zmm2 0x00000000000065ea <+1834>: vpmaxsd zmm5,zmm11,zmm5 0x00000000000065f0 <+1840>: mov ax,0x6090 0x00000000000065f4 <+1844>: kmovd k3,eax 0x00000000000065f8 <+1848>: vmovdqa32 zmm0{k3},zmm5 0x00000000000065fe <+1854>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x58338] # 0x5e940 0x0000000000006608 <+1864>: vpermi2d zmm10,zmm0,zmm9 0x000000000000660e <+1870>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x58368] # 0x5e980 0x0000000000006618 <+1880>: vpermi2d zmm11,zmm10,zmm7 0x000000000000661e <+1886>: vmovdqa ymm10,YMMWORD PTR [rip+0x57aba] # 0x5e0e0 0x0000000000006626 <+1894>: vpermi2d zmm10,zmm7,zmm9 0x000000000000662c <+1900>: vpminsd zmm7{k2},zmm4,zmm6 0x0000000000006632 <+1906>: vpminsd zmm4,zmm8,zmm3 0x0000000000006638 <+1912>: vpmaxsd zmm3,zmm8,zmm3 0x000000000000663e <+1918>: mov ax,0x906 0x0000000000006642 <+1922>: kmovd k2,eax 0x0000000000006646 <+1926>: vpblendmd zmm6{k2},zmm3,zmm4 0x000000000000664c <+1932>: mov ax,0x909 0x0000000000006650 <+1936>: kmovd k2,eax 0x0000000000006654 <+1940>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x581e2] # 0x5e840 0x000000000000665e <+1950>: vpermi2d zmm8,zmm0,zmm9 0x0000000000006664 <+1956>: vpmaxsd zmm9{k2},zmm1,zmm2 0x000000000000666a <+1962>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5820c] # 0x5e880 0x0000000000006674 <+1972>: vpermi2d zmm1,zmm7,zmm4 0x000000000000667a <+1978>: mov ax,0xf909 0x000000000000667e <+1982>: kmovd k2,eax 0x0000000000006682 <+1986>: vmovdqa32 zmm8{k2},zmm1 0x0000000000006688 <+1992>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5822e] # 0x5e8c0 0x0000000000006692 <+2002>: vpermi2d zmm1,zmm7,zmm3 0x0000000000006698 <+2008>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5825e] # 0x5e900 0x00000000000066a2 <+2018>: vpermi2d zmm2,zmm9,zmm5 0x00000000000066a8 <+2024>: mov ax,0x6f60 0x00000000000066ac <+2028>: kmovd k2,eax 0x00000000000066b0 <+2032>: vmovdqa32 zmm2{k2},zmm1 0x00000000000066b6 <+2038>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58300] # 0x5e9c0 0x00000000000066c0 <+2048>: vpermi2d zmm3,zmm6,zmm10 0x00000000000066c6 <+2054>: vpmaxsd zmm1,zmm7,zmm2 0x00000000000066cc <+2060>: mov ax,0x6960 0x00000000000066d0 <+2064>: kmovd k2,eax 0x00000000000066d4 <+2068>: vpminsd zmm1{k2},zmm7,zmm2 0x00000000000066da <+2074>: vpmaxsd zmm2,zmm6,zmm3 0x00000000000066e0 <+2080>: mov ax,0x609 0x00000000000066e4 <+2084>: kmovd k3,eax 0x00000000000066e8 <+2088>: vpminsd zmm2{k3},zmm6,zmm3 0x00000000000066ee <+2094>: vpminsd zmm3,zmm0,zmm11 0x00000000000066f4 <+2100>: vpminsd zmm4,zmm9,zmm8 0x00000000000066fa <+2106>: mov ax,0x696 0x00000000000066fe <+2110>: kmovd k3,eax 0x0000000000006702 <+2114>: vpmaxsd zmm4{k3},zmm9,zmm8 0x0000000000006708 <+2120>: mov ax,0x9069 0x000000000000670c <+2124>: kmovd k3,eax 0x0000000000006710 <+2128>: vpmaxsd zmm3{k3},zmm0,zmm11 0x0000000000006716 <+2134>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x582e0] # 0x5ea00 0x0000000000006720 <+2144>: vpermi2d zmm0,zmm1,zmm3 0x0000000000006726 <+2150>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58310] # 0x5ea40 0x0000000000006730 <+2160>: vpermi2d zmm5,zmm3,zmm4 0x0000000000006736 <+2166>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58340] # 0x5ea80 0x0000000000006740 <+2176>: vpermi2d zmm6,zmm4,zmm2 0x0000000000006746 <+2182>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x58370] # 0x5eac0 0x0000000000006750 <+2192>: vpermi2d zmm7,zmm2,zmm1 0x0000000000006756 <+2198>: vpminsd zmm8,zmm2,zmm7 0x000000000000675c <+2204>: vpmaxsd zmm2,zmm2,zmm7 0x0000000000006762 <+2210>: mov ax,0x96 0x0000000000006766 <+2214>: kmovd k3,eax 0x000000000000676a <+2218>: vmovdqa32 zmm2{k3},zmm8 0x0000000000006770 <+2224>: vpmaxsd zmm7,zmm1,zmm6 0x0000000000006776 <+2230>: mov ax,0xf00 0x000000000000677a <+2234>: vpmaxsd zmm9,zmm3,zmm5 0x0000000000006780 <+2240>: mov cx,0x96f0 0x0000000000006784 <+2244>: kmovd k3,ecx 0x0000000000006788 <+2248>: vpminsd zmm9{k3},zmm3,zmm5 0x000000000000678e <+2254>: vpminsd zmm3,zmm4,zmm0 0x0000000000006794 <+2260>: vpmaxsd zmm0,zmm4,zmm0 0x000000000000679a <+2266>: mov cl,0xc 0x000000000000679c <+2268>: kmovd k3,ecx 0x00000000000067a0 <+2272>: vpblendmq zmm4{k3},zmm3,zmm0 0x00000000000067a6 <+2278>: kmovd k3,eax 0x00000000000067aa <+2282>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x5834c] # 0x5eb00 0x00000000000067b4 <+2292>: vpermi2d zmm5,zmm4,zmm9 0x00000000000067ba <+2298>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x5837c] # 0x5eb40 0x00000000000067c4 <+2308>: vpermi2d zmm10,zmm5,zmm7 0x00000000000067ca <+2314>: vpminsd zmm7{k3},zmm1,zmm6 0x00000000000067d0 <+2320>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x583a6] # 0x5eb80 0x00000000000067da <+2330>: vpermi2d zmm1,zmm7,zmm3 0x00000000000067e0 <+2336>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x583d6] # 0x5ebc0 0x00000000000067ea <+2346>: vpermi2d zmm3,zmm1,zmm8 0x00000000000067f0 <+2352>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x58406] # 0x5ec00 0x00000000000067fa <+2362>: vpermi2d zmm1,zmm2,zmm7 0x0000000000006800 <+2368>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58436] # 0x5ec40 0x000000000000680a <+2378>: vpermi2d zmm5,zmm9,zmm0 0x0000000000006810 <+2384>: vpmaxsd zmm6,zmm9,zmm5 0x0000000000006816 <+2390>: vpminsd zmm6{k2},zmm9,zmm5 0x000000000000681c <+2396>: vpmaxsd zmm5,zmm2,zmm1 0x0000000000006822 <+2402>: vpminsd zmm5{k1},zmm2,zmm1 0x0000000000006828 <+2408>: vpmaxsd zmm1,zmm7,zmm3 0x000000000000682e <+2414>: mov ax,0xf09 0x0000000000006832 <+2418>: kmovd k1,eax 0x0000000000006836 <+2422>: vpminsd zmm1{k1},zmm7,zmm3 0x000000000000683c <+2428>: vpminsd zmm2,zmm4,zmm10 0x0000000000006842 <+2434>: mov ax,0x90f0 0x0000000000006846 <+2438>: kmovd k1,eax 0x000000000000684a <+2442>: vpmaxsd zmm2{k1},zmm4,zmm10 0x0000000000006850 <+2448>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58426] # 0x5ec80 0x000000000000685a <+2458>: vpxor xmm3,xmm3,xmm3 0x000000000000685e <+2462>: vpermd zmm3,zmm0,zmm2 0x0000000000006864 <+2468>: vpxor xmm4,xmm4,xmm4 0x0000000000006868 <+2472>: vpermd zmm4,zmm0,zmm1 0x000000000000686e <+2478>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58448] # 0x5ecc0 0x0000000000006878 <+2488>: vpxor xmm7,xmm7,xmm7 0x000000000000687c <+2492>: vpermd zmm7,zmm0,zmm5 0x0000000000006882 <+2498>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58474] # 0x5ed00 0x000000000000688c <+2508>: vpxor xmm8,xmm8,xmm8 0x0000000000006891 <+2513>: vpermd zmm8,zmm0,zmm6 0x0000000000006897 <+2519>: vpmaxsd zmm0,zmm6,zmm8 0x000000000000689d <+2525>: mov ax,0x600 0x00000000000068a1 <+2529>: kmovd k1,eax 0x00000000000068a5 <+2533>: vpminsd zmm0{k1},zmm6,zmm8 0x00000000000068ab <+2539>: vpmaxsd zmm6,zmm5,zmm7 0x00000000000068b1 <+2545>: mov ax,0x6 0x00000000000068b5 <+2549>: kmovd k1,eax 0x00000000000068b9 <+2553>: vpminsd zmm8,zmm1,zmm4 0x00000000000068bf <+2559>: vpmaxsd zmm9,zmm2,zmm3 0x00000000000068c5 <+2565>: mov ax,0xf960 0x00000000000068c9 <+2569>: kmovd k2,eax 0x00000000000068cd <+2573>: vmovdqa64 zmm10,zmm8 0x00000000000068d3 <+2579>: vpmaxsd zmm10{k2},zmm1,zmm4 0x00000000000068d9 <+2585>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5849d] # 0x5ed80 0x00000000000068e3 <+2595>: vmovdqa64 zmm4,zmm10 0x00000000000068e9 <+2601>: vpermt2d zmm4,zmm1,zmm9 0x00000000000068ef <+2607>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x584c7] # 0x5edc0 0x00000000000068f9 <+2617>: vpermt2d zmm4,zmm11,zmm6 0x00000000000068ff <+2623>: vpminsd zmm6{k1},zmm5,zmm7 0x0000000000006905 <+2629>: vpminsd zmm2,zmm2,zmm3 0x000000000000690b <+2635>: vpblendmd zmm3{k2},zmm2,zmm9 0x0000000000006911 <+2641>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58425] # 0x5ed40 0x000000000000691b <+2651>: vpermi2d zmm5,zmm6,zmm10 0x0000000000006921 <+2657>: vpermi2d zmm1,zmm3,zmm0 0x0000000000006927 <+2663>: vpermt2d zmm1,zmm11,zmm8 0x000000000000692d <+2669>: vpermi2d zmm11,zmm0,zmm2 0x0000000000006933 <+2675>: vpmaxsd zmm2,zmm0,zmm11 0x0000000000006939 <+2681>: mov ax,0x9000 0x000000000000693d <+2685>: kmovd k1,eax 0x0000000000006941 <+2689>: vpmaxsd zmm7,zmm3,zmm1 0x0000000000006947 <+2695>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x5856f] # 0x5eec0 0x0000000000006951 <+2705>: vpermi2d zmm8,zmm2,zmm7 0x0000000000006957 <+2711>: vpminsd zmm2{k1},zmm0,zmm11 0x000000000000695d <+2717>: vpminsd zmm0,zmm3,zmm1 0x0000000000006963 <+2723>: vpminsd zmm1,zmm10,zmm4 0x0000000000006969 <+2729>: mov ax,0x6f09 0x000000000000696d <+2733>: kmovd k1,eax 0x0000000000006971 <+2737>: vmovdqa32 zmm0{k1},zmm7 0x0000000000006977 <+2743>: vpmaxsd zmm1{k1},zmm10,zmm4 0x000000000000697d <+2749>: vpmaxsd zmm3,zmm6,zmm5 0x0000000000006983 <+2755>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58473] # 0x5ee00 0x000000000000698d <+2765>: vpermi2d zmm4,zmm1,zmm0 0x0000000000006993 <+2771>: mov ax,0x9999 0x0000000000006997 <+2775>: kmovd k1,eax 0x000000000000699b <+2779>: vmovdqa32 zmm4{k1},zmm3 0x00000000000069a1 <+2785>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58495] # 0x5ee40 0x00000000000069ab <+2795>: vpermi2d zmm5,zmm2,zmm0 0x00000000000069b1 <+2801>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x584c5] # 0x5ee80 0x00000000000069bb <+2811>: vpermi2d zmm6,zmm5,zmm1 0x00000000000069c1 <+2817>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58535] # 0x5ef00 0x00000000000069cb <+2827>: vpermi2d zmm5,zmm1,zmm3 0x00000000000069d1 <+2833>: mov ax,0x117 0x00000000000069d5 <+2837>: kmovd k1,eax 0x00000000000069d9 <+2841>: vmovdqa32 zmm5{k1},zmm8 0x00000000000069df <+2847>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x58557] # 0x5ef40 0x00000000000069e9 <+2857>: vpermi2d zmm7,zmm0,zmm2 0x00000000000069ef <+2863>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58587] # 0x5ef80 0x00000000000069f9 <+2873>: vpermi2d zmm8,zmm3,zmm1 0x00000000000069ff <+2879>: mov ax,0xe880 0x0000000000006a03 <+2883>: kmovd k1,eax 0x0000000000006a07 <+2887>: vmovdqa32 zmm7{k1},zmm8 0x0000000000006a0d <+2893>: vpminsd zmm8,zmm0,zmm7 0x0000000000006a13 <+2899>: vpmaxsd zmm7,zmm0,zmm7 0x0000000000006a19 <+2905>: mov ax,0xe8e0 0x0000000000006a1d <+2909>: kmovd k1,eax 0x0000000000006a21 <+2913>: vpblendmd zmm9{k1},zmm7,zmm8 0x0000000000006a27 <+2919>: vpmaxsd zmm0,zmm1,zmm5 0x0000000000006a2d <+2925>: vpminsd zmm0{k1},zmm1,zmm5 0x0000000000006a33 <+2931>: vpmaxsd zmm1,zmm2,zmm6 0x0000000000006a39 <+2937>: mov ax,0x6666 0x0000000000006a3d <+2941>: kmovd k1,eax 0x0000000000006a41 <+2945>: vpminsd zmm1{k1},zmm2,zmm6 0x0000000000006a47 <+2951>: vpmaxsd zmm2,zmm3,zmm4 0x0000000000006a4d <+2957>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58569] # 0x5efc0 0x0000000000006a57 <+2967>: vpermi2d zmm3,zmm1,zmm7 0x0000000000006a5d <+2973>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58599] # 0x5f000 0x0000000000006a67 <+2983>: vpermi2d zmm5,zmm3,zmm0 0x0000000000006a6d <+2989>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x585c9] # 0x5f040 0x0000000000006a77 <+2999>: vpermi2d zmm3,zmm9,zmm1 0x0000000000006a7d <+3005>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x585f9] # 0x5f080 0x0000000000006a87 <+3015>: vpermi2d zmm4,zmm2,zmm0 0x0000000000006a8d <+3021>: mov ax,0x4c6c 0x0000000000006a91 <+3025>: kmovd k1,eax 0x0000000000006a95 <+3029>: vmovdqa32 zmm3{k1},zmm4 0x0000000000006a9b <+3035>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5861b] # 0x5f0c0 0x0000000000006aa5 <+3045>: vpermi2d zmm4,zmm9,zmm0 0x0000000000006aab <+3051>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x5864b] # 0x5f100 0x0000000000006ab5 <+3061>: vpermi2d zmm6,zmm2,zmm4 0x0000000000006abb <+3067>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5867b] # 0x5f140 0x0000000000006ac5 <+3077>: vpermi2d zmm4,zmm1,zmm8 0x0000000000006acb <+3083>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x586ab] # 0x5f180 0x0000000000006ad5 <+3093>: vpermi2d zmm7,zmm0,zmm2 0x0000000000006adb <+3099>: mov ax,0x3632 0x0000000000006adf <+3103>: kmovd k2,eax 0x0000000000006ae3 <+3107>: vmovdqa32 zmm7{k2},zmm4 0x0000000000006ae9 <+3113>: vpmaxsd zmm8,zmm0,zmm7 0x0000000000006aef <+3119>: mov ax,0x88 0x0000000000006af3 <+3123>: kmovd k2,eax 0x0000000000006af7 <+3127>: vpmaxsd zmm10,zmm9,zmm3 0x0000000000006afd <+3133>: vpminsd zmm10{k1},zmm9,zmm3 0x0000000000006b03 <+3139>: vpminsd zmm4,zmm1,zmm5 0x0000000000006b09 <+3145>: mov ax,0x1331 0x0000000000006b0d <+3149>: kmovd k1,eax 0x0000000000006b11 <+3153>: vpmaxsd zmm4{k1},zmm1,zmm5 0x0000000000006b17 <+3159>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5871f] # 0x5f240 0x0000000000006b21 <+3169>: vpermi2d zmm1,zmm4,zmm10 0x0000000000006b27 <+3175>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x5874f] # 0x5f280 0x0000000000006b31 <+3185>: vpermi2d zmm9,zmm1,zmm8 0x0000000000006b37 <+3191>: vmovdqa64 zmm3,zmm8 0x0000000000006b3d <+3197>: vpminsd zmm3{k2},zmm0,zmm7 0x0000000000006b43 <+3203>: vpmaxsd zmm1,zmm2,zmm6 0x0000000000006b49 <+3209>: mov ax,0x888 0x0000000000006b4d <+3213>: kmovd k1,eax 0x0000000000006b51 <+3217>: vpminsd zmm1{k1},zmm2,zmm6 0x0000000000006b57 <+3223>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x5865f] # 0x5f1c0 0x0000000000006b61 <+3233>: vpermi2d zmm6,zmm4,zmm10 0x0000000000006b67 <+3239>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5868f] # 0x5f200 0x0000000000006b71 <+3249>: vpermi2d zmm2,zmm1,zmm3 0x0000000000006b77 <+3255>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5873f] # 0x5f2c0 0x0000000000006b81 <+3265>: vpermi2d zmm0,zmm10,zmm3 0x0000000000006b87 <+3271>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x5876f] # 0x5f300 0x0000000000006b91 <+3281>: vpermi2d zmm5,zmm0,zmm1 0x0000000000006b97 <+3287>: vpmaxsd zmm7,zmm3,zmm5 0x0000000000006b9d <+3293>: mov ax,0xca4c 0x0000000000006ba1 <+3297>: kmovd k1,eax 0x0000000000006ba5 <+3301>: vpminsd zmm8,zmm10,zmm9 0x0000000000006bab <+3307>: vpmaxsd zmm9,zmm10,zmm9 0x0000000000006bb1 <+3313>: mov ax,0xc48c 0x0000000000006bb5 <+3317>: kmovd k2,eax 0x0000000000006bb9 <+3321>: vpblendmd zmm0{k2},zmm9,zmm8 0x0000000000006bbf <+3327>: vpminsd zmm10,zmm4,zmm6 0x0000000000006bc5 <+3333>: mov ax,0x2653 0x0000000000006bc9 <+3337>: kmovd k2,eax 0x0000000000006bcd <+3341>: vbroadcasti64x4 zmm11,YMMWORD PTR [rip+0x57549] # 0x5e120 0x0000000000006bd7 <+3351>: vpermi2d zmm11,zmm9,zmm10 0x0000000000006bdd <+3357>: vpmaxsd zmm10{k2},zmm4,zmm6 0x0000000000006be3 <+3363>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58753] # 0x5f340 0x0000000000006bed <+3373>: vpermi2d zmm4,zmm7,zmm8 0x0000000000006bf3 <+3379>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58803] # 0x5f400 0x0000000000006bfd <+3389>: vpermi2d zmm6,zmm10,zmm0 0x0000000000006c03 <+3395>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58833] # 0x5f440 0x0000000000006c0d <+3405>: vpermi2d zmm8,zmm6,zmm7 0x0000000000006c13 <+3411>: vpminsd zmm7{k1},zmm3,zmm5 0x0000000000006c19 <+3417>: vpmaxsd zmm3,zmm1,zmm2 0x0000000000006c1f <+3423>: mov ax,0xa00 0x0000000000006c23 <+3427>: kmovd k1,eax 0x0000000000006c27 <+3431>: vbroadcasti64x4 zmm5,YMMWORD PTR [rip+0x574cf] # 0x5e100 0x0000000000006c31 <+3441>: vpermi2d zmm5,zmm7,zmm3 0x0000000000006c37 <+3447>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x5877f] # 0x5f3c0 0x0000000000006c41 <+3457>: vpermi2d zmm6,zmm7,zmm3 0x0000000000006c47 <+3463>: vpminsd zmm3{k1},zmm1,zmm2 0x0000000000006c4d <+3469>: mov ax,0x1111 0x0000000000006c51 <+3473>: kmovd k1,eax 0x0000000000006c55 <+3477>: vpblendmd zmm2{k1},zmm3,zmm4 0x0000000000006c5b <+3483>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5871b] # 0x5f380 0x0000000000006c65 <+3493>: vpermi2d zmm4,zmm0,zmm10 0x0000000000006c6b <+3499>: mov ax,0x8840 0x0000000000006c6f <+3503>: kmovd k1,eax 0x0000000000006c73 <+3507>: vmovdqa32 zmm4{k1},zmm5 0x0000000000006c79 <+3513>: mov ax,0x211 0x0000000000006c7d <+3517>: kmovd k1,eax 0x0000000000006c81 <+3521>: vmovdqa32 zmm6{k1},zmm11 0x0000000000006c87 <+3527>: vpminsd zmm5,zmm10,zmm8 0x0000000000006c8d <+3533>: vpmaxsd zmm8,zmm10,zmm8 0x0000000000006c93 <+3539>: mov ax,0x8888 0x0000000000006c97 <+3543>: kmovd k1,eax 0x0000000000006c9b <+3547>: vpblendmd zmm9{k1},zmm8,zmm5 0x0000000000006ca1 <+3553>: vpmaxsd zmm1,zmm7,zmm6 0x0000000000006ca7 <+3559>: mov ax,0x2466 0x0000000000006cab <+3563>: kmovd k2,eax 0x0000000000006caf <+3567>: vpminsd zmm1{k2},zmm7,zmm6 0x0000000000006cb5 <+3573>: vpmaxsd zmm6,zmm0,zmm4 0x0000000000006cbb <+3579>: mov ax,0x88ca 0x0000000000006cbf <+3583>: kmovd k2,eax 0x0000000000006cc3 <+3587>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x588f3] # 0x5f5c0 0x0000000000006ccd <+3597>: vpermi2d zmm7,zmm8,zmm6 0x0000000000006cd3 <+3603>: vpminsd zmm6{k2},zmm0,zmm4 0x0000000000006cd9 <+3609>: vpmaxsd zmm0,zmm3,zmm2 0x0000000000006cdf <+3615>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58797] # 0x5f480 0x0000000000006ce9 <+3625>: vpermi2d zmm2,zmm5,zmm6 0x0000000000006cef <+3631>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x587c7] # 0x5f4c0 0x0000000000006cf9 <+3641>: vpermi2d zmm3,zmm2,zmm1 0x0000000000006cff <+3647>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x587f7] # 0x5f500 0x0000000000006d09 <+3657>: vpermi2d zmm2,zmm6,zmm1 0x0000000000006d0f <+3663>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58827] # 0x5f540 0x0000000000006d19 <+3673>: vpermi2d zmm4,zmm2,zmm0 0x0000000000006d1f <+3679>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58857] # 0x5f580 0x0000000000006d29 <+3689>: vpermi2d zmm2,zmm0,zmm1 0x0000000000006d2f <+3695>: vpmaxsd zmm5,zmm1,zmm4 0x0000000000006d35 <+3701>: mov ax,0xac88 0x0000000000006d39 <+3705>: kmovd k2,eax 0x0000000000006d3d <+3709>: vpmaxsd zmm8,zmm9,zmm7 0x0000000000006d43 <+3715>: vpminsd zmm8{k1},zmm9,zmm7 0x0000000000006d49 <+3721>: vpminsd zmm7,zmm6,zmm3 0x0000000000006d4f <+3727>: mov ax,0x1135 0x0000000000006d53 <+3731>: kmovd k1,eax 0x0000000000006d57 <+3735>: vmovdqa64 zmm9,zmm7 0x0000000000006d5d <+3741>: vpmaxsd zmm9{k1},zmm6,zmm3 0x0000000000006d63 <+3747>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58893] # 0x5f600 0x0000000000006d6d <+3757>: vpermi2d zmm3,zmm9,zmm8 0x0000000000006d73 <+3763>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x588c3] # 0x5f640 0x0000000000006d7d <+3773>: vpermi2d zmm6,zmm3,zmm5 0x0000000000006d83 <+3779>: vpminsd zmm5{k2},zmm1,zmm4 0x0000000000006d89 <+3785>: vpmaxsd zmm0,zmm0,zmm2 0x0000000000006d8f <+3791>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x588e7] # 0x5f680 0x0000000000006d99 <+3801>: vpermi2d zmm1,zmm8,zmm9 0x0000000000006d9f <+3807>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58917] # 0x5f6c0 0x0000000000006da9 <+3817>: vpermi2d zmm2,zmm0,zmm5 0x0000000000006daf <+3823>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58947] # 0x5f700 0x0000000000006db9 <+3833>: vpermi2d zmm3,zmm5,zmm7 0x0000000000006dbf <+3839>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58977] # 0x5f740 0x0000000000006dc9 <+3849>: vpermi2d zmm4,zmm3,zmm0 0x0000000000006dcf <+3855>: vpminsd zmm3,zmm5,zmm4 0x0000000000006dd5 <+3861>: vpmaxsd zmm4,zmm5,zmm4 0x0000000000006ddb <+3867>: mov ax,0xcaaa 0x0000000000006ddf <+3871>: kmovd k1,eax 0x0000000000006de3 <+3875>: vmovdqa32 zmm4{k1},zmm3 0x0000000000006de9 <+3881>: vpmaxsd zmm5,zmm0,zmm2 0x0000000000006def <+3887>: mov ax,0x44 0x0000000000006df3 <+3891>: kmovd k1,eax 0x0000000000006df7 <+3895>: vpmaxsd zmm7,zmm8,zmm1 0x0000000000006dfd <+3901>: mov ax,0xcc88 0x0000000000006e01 <+3905>: kmovd k2,eax 0x0000000000006e05 <+3909>: vpminsd zmm7{k2},zmm8,zmm1 0x0000000000006e0b <+3915>: vpmaxsd zmm1,zmm9,zmm6 0x0000000000006e11 <+3921>: mov ax,0xaaac 0x0000000000006e15 <+3925>: kmovd k2,eax 0x0000000000006e19 <+3929>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x589dd] # 0x5f800 0x0000000000006e23 <+3939>: vpermi2d zmm8,zmm7,zmm1 0x0000000000006e29 <+3945>: vpminsd zmm1{k2},zmm9,zmm6 0x0000000000006e2f <+3951>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58a07] # 0x5f840 0x0000000000006e39 <+3961>: vpermi2d zmm6,zmm4,zmm1 0x0000000000006e3f <+3967>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58a37] # 0x5f880 0x0000000000006e49 <+3977>: vpermi2d zmm9,zmm6,zmm5 0x0000000000006e4f <+3983>: vpminsd zmm5{k1},zmm0,zmm2 0x0000000000006e55 <+3989>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58921] # 0x5f780 0x0000000000006e5f <+3999>: vpermi2d zmm0,zmm1,zmm7 0x0000000000006e65 <+4005>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58951] # 0x5f7c0 0x0000000000006e6f <+4015>: vpermi2q zmm2,zmm0,zmm4 0x0000000000006e75 <+4021>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58a41] # 0x5f8c0 0x0000000000006e7f <+4031>: vpermi2d zmm6,zmm5,zmm3 0x0000000000006e85 <+4037>: vpmaxsd zmm3,zmm1,zmm2 0x0000000000006e8b <+4043>: mov ax,0xcaac 0x0000000000006e8f <+4047>: kmovd k1,eax 0x0000000000006e93 <+4051>: vpminsd zmm3{k1},zmm1,zmm2 0x0000000000006e99 <+4057>: vpmaxsd zmm0,zmm5,zmm6 0x0000000000006e9f <+4063>: mov ax,0xaa 0x0000000000006ea3 <+4067>: kmovd k2,eax 0x0000000000006ea7 <+4071>: vpminsd zmm0{k2},zmm5,zmm6 0x0000000000006ead <+4077>: vpmaxsd zmm1,zmm4,zmm9 0x0000000000006eb3 <+4083>: vpminsd zmm1{k1},zmm4,zmm9 0x0000000000006eb9 <+4089>: vpmaxsd zmm2,zmm7,zmm8 0x0000000000006ebf <+4095>: mov ax,0xaa88 0x0000000000006ec3 <+4099>: kmovd k1,eax 0x0000000000006ec7 <+4103>: vpminsd zmm2{k1},zmm7,zmm8 0x0000000000006ecd <+4109>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58a29] # 0x5f900 0x0000000000006ed7 <+4119>: vpermi2d zmm4,zmm2,zmm3 0x0000000000006edd <+4125>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58a59] # 0x5f940 0x0000000000006ee7 <+4135>: vpermi2d zmm5,zmm1,zmm3 0x0000000000006eed <+4141>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58a89] # 0x5f980 0x0000000000006ef7 <+4151>: vpermi2d zmm6,zmm5,zmm0 0x0000000000006efd <+4157>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58ab9] # 0x5f9c0 0x0000000000006f07 <+4167>: vpermi2d zmm5,zmm0,zmm1 0x0000000000006f0d <+4173>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x58ae9] # 0x5fa00 0x0000000000006f17 <+4183>: vpermi2d zmm7,zmm3,zmm2 0x0000000000006f1d <+4189>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58b19] # 0x5fa40 0x0000000000006f27 <+4199>: vpermi2d zmm8,zmm7,zmm1 0x0000000000006f2d <+4205>: vpminsd zmm7,zmm3,zmm8 0x0000000000006f33 <+4211>: vpmaxsd zmm3,zmm3,zmm8 0x0000000000006f39 <+4217>: mov ax,0xacca 0x0000000000006f3d <+4221>: kmovd k1,eax 0x0000000000006f41 <+4225>: vpblendmd zmm8{k1},zmm3,zmm7 0x0000000000006f47 <+4231>: vpmaxsd zmm9,zmm1,zmm6 0x0000000000006f4d <+4237>: vpmaxsd zmm10,zmm2,zmm4 0x0000000000006f53 <+4243>: mov ax,0xccc8 0x0000000000006f57 <+4247>: kmovd k2,eax 0x0000000000006f5b <+4251>: vpminsd zmm10{k2},zmm2,zmm4 0x0000000000006f61 <+4257>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58b15] # 0x5fa80 0x0000000000006f6b <+4267>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm8 0x0000000000006f73 <+4275>: vpermt2d zmm8,zmm4,zmm10 0x0000000000006f79 <+4281>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58b3d] # 0x5fac0 0x0000000000006f83 <+4291>: vpermt2d zmm8,zmm2,zmm9 0x0000000000006f89 <+4297>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm8 0x0000000000006f91 <+4305>: vpminsd zmm9{k1},zmm1,zmm6 0x0000000000006f97 <+4311>: vpmaxsd zmm1,zmm0,zmm5 0x0000000000006f9d <+4317>: mov ax,0x4cc 0x0000000000006fa1 <+4321>: kmovd k1,eax 0x0000000000006fa5 <+4325>: vpermi2d zmm4,zmm9,zmm7 0x0000000000006fab <+4331>: vpermt2d zmm4,zmm2,zmm1 0x0000000000006fb1 <+4337>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm4 0x0000000000006fb9 <+4345>: vpminsd zmm1{k1},zmm0,zmm5 0x0000000000006fbf <+4351>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58b37] # 0x5fb00 0x0000000000006fc9 <+4361>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm9 0x0000000000006fd1 <+4369>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm1 0x0000000000006fd9 <+4377>: vpermi2d zmm0,zmm1,zmm9 0x0000000000006fdf <+4383>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm0 0x0000000000006fe7 <+4391>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58b4f] # 0x5fb40 0x0000000000006ff1 <+4401>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm10 0x0000000000006ff9 <+4409>: vpermi2d zmm0,zmm10,zmm3 0x0000000000006fff <+4415>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm0 0x0000000000007007 <+4423>: vpxor xmm0,xmm0,xmm0 0x000000000000700b <+4427>: vmovdqa XMMWORD PTR [rsp+0xf0],xmm0 0x0000000000007014 <+4436>: lea rsi,[rsp+0xf0] 0x000000000000701c <+4444>: mov edi,0x1 0x0000000000007021 <+4449>: vzeroupper 0x0000000000007024 <+4452>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int32_8.asm --- 0x0000000000006086 <+566>: call 0x5470 <clock_gettime@plt> 0x000000000000608b <+571>: mov rbx,QWORD PTR [rsp+0xc0] 0x0000000000006093 <+579>: mov r12,QWORD PTR [rsp+0xc8] 0x000000000000609b <+587>: vmovdqu ymm2,YMMWORD PTR [rsp+0x10] 0x00000000000060a1 <+593>: vpshufd ymm0,ymm2,0x4e 0x00000000000060a6 <+598>: vpminsd ymm1,ymm2,ymm0 0x00000000000060ab <+603>: vpmaxsd ymm0,ymm2,ymm0 0x00000000000060b0 <+608>: vpblendd ymm0,ymm1,ymm0,0xcc 0x00000000000060b6 <+614>: vxorps xmm1,xmm1,xmm1 0x00000000000060ba <+618>: vpermq ymm1,ymm0,0x4e 0x00000000000060c0 <+624>: vpminsd ymm2,ymm0,ymm1 0x00000000000060c5 <+629>: vpmaxsd ymm0,ymm0,ymm1 0x00000000000060ca <+634>: vpblendd ymm0,ymm2,ymm0,0xf0 0x00000000000060d0 <+640>: vpshufd ymm1,ymm0,0xb1 0x00000000000060d5 <+645>: vpminsd ymm2,ymm0,ymm1 0x00000000000060da <+650>: vpmaxsd ymm0,ymm0,ymm1 0x00000000000060df <+655>: vpblendd ymm0,ymm2,ymm0,0xaa 0x00000000000060e5 <+661>: vxorps xmm1,xmm1,xmm1 0x00000000000060e9 <+665>: vpermq ymm1,ymm0,0xd8 0x00000000000060ef <+671>: vpminsd ymm2,ymm0,ymm1 0x00000000000060f4 <+676>: vpmaxsd ymm0,ymm0,ymm1 0x00000000000060f9 <+681>: vpblendd ymm0,ymm0,ymm2,0xc 0x00000000000060ff <+687>: vmovdqa ymm1,YMMWORD PTR [rip+0x56ff9] # 0x5d100 0x0000000000006107 <+695>: vpermd ymm1,ymm1,ymm0 0x000000000000610c <+700>: vpminsd ymm2,ymm0,ymm1 0x0000000000006111 <+705>: vpmaxsd ymm0,ymm0,ymm1 0x0000000000006116 <+710>: vpblendd ymm0,ymm0,ymm2,0xa 0x000000000000611c <+716>: vmovdqa ymm1,YMMWORD PTR [rip+0x56ffc] # 0x5d120 0x0000000000006124 <+724>: vpermd ymm1,ymm1,ymm0 0x0000000000006129 <+729>: vpminsd ymm2,ymm0,ymm1 0x000000000000612e <+734>: vmovdqu YMMWORD PTR [rsp+0x10],ymm2 0x0000000000006134 <+740>: vpmaxsd ymm0,ymm0,ymm1 0x0000000000006139 <+745>: vmovdqu YMMWORD PTR [rsp+0x240],ymm0 0x0000000000006142 <+754>: vpxor xmm0,xmm0,xmm0 0x0000000000006146 <+758>: vmovdqa XMMWORD PTR [rsp+0xe0],xmm0 0x000000000000614f <+767>: lea rsi,[rsp+0xe0] 0x0000000000006157 <+775>: mov edi,0x1 0x000000000000615c <+780>: vzeroupper 0x000000000000615f <+783>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int8_128.asm --- 0x0000000000006110 <+640>: call 0x5470 <clock_gettime@plt> 0x0000000000006115 <+645>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x100] 0x000000000000611d <+653>: vprold zmm0,zmm5,0x10 0x0000000000006124 <+660>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x140] 0x000000000000612c <+668>: vprold zmm1,zmm4,0x10 0x0000000000006133 <+675>: vpminsb zmm2,zmm4,zmm1 0x0000000000006139 <+681>: vpminsb zmm3,zmm5,zmm0 0x000000000000613f <+687>: movabs rax,0xcccccccccccccccc 0x0000000000006149 <+697>: kmovq k1,rax 0x000000000000614e <+702>: vpmaxsb zmm3{k1},zmm5,zmm0 0x0000000000006154 <+708>: vpmaxsb zmm2{k1},zmm4,zmm1 0x000000000000615a <+714>: vbroadcasti32x4 zmm0,XMMWORD PTR [rip+0x5779c] # 0x5d900 0x0000000000006164 <+724>: vpshufb zmm1,zmm2,zmm0 0x000000000000616a <+730>: vpshufb zmm0,zmm3,zmm0 0x0000000000006170 <+736>: vpminsb zmm4,zmm3,zmm0 0x0000000000006176 <+742>: vpminsb zmm5,zmm2,zmm1 0x000000000000617c <+748>: movabs rax,0xaaaaaaaaaaaaaaaa 0x0000000000006186 <+758>: kmovq k2,rax 0x000000000000618b <+763>: vpmaxsb zmm5{k2},zmm2,zmm1 0x0000000000006191 <+769>: kmovq QWORD PTR [rsp+0x190],k2 0x000000000000619b <+779>: vpmaxsb zmm4{k2},zmm3,zmm0 0x00000000000061a1 <+785>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f95] # 0x5d140 0x00000000000061ab <+795>: vpermb zmm1,zmm0,zmm4 0x00000000000061b1 <+801>: vpermb zmm0,zmm0,zmm5 0x00000000000061b7 <+807>: vpminsb zmm2,zmm5,zmm0 0x00000000000061bd <+813>: vpminsb zmm3,zmm4,zmm1 0x00000000000061c3 <+819>: movabs rax,0xdddd44d4d4dd4444 0x00000000000061cd <+829>: kmovq k2,rax 0x00000000000061d2 <+834>: vpmaxsb zmm3{k2},zmm4,zmm1 0x00000000000061d8 <+840>: vpmaxsb zmm2{k2},zmm5,zmm0 0x00000000000061de <+846>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f98] # 0x5d180 0x00000000000061e8 <+856>: vpermb zmm1,zmm0,zmm2 0x00000000000061ee <+862>: vpermb zmm0,zmm0,zmm3 0x00000000000061f4 <+868>: vpminsb zmm4,zmm3,zmm0 0x00000000000061fa <+874>: vpminsb zmm5,zmm2,zmm1 0x0000000000006200 <+880>: movabs rax,0xff6f9960f9660900 0x000000000000620a <+890>: kmovq k2,rax 0x000000000000620f <+895>: vpmaxsb zmm5{k2},zmm2,zmm1 0x0000000000006215 <+901>: vpmaxsb zmm4{k2},zmm3,zmm0 0x000000000000621b <+907>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f9b] # 0x5d1c0 0x0000000000006225 <+917>: vpermb zmm1,zmm0,zmm4 0x000000000000622b <+923>: vpermb zmm0,zmm0,zmm5 0x0000000000006231 <+929>: vpminsb zmm2,zmm5,zmm0 0x0000000000006237 <+935>: vpminsb zmm3,zmm4,zmm1 0x000000000000623d <+941>: movabs rax,0xff96ff9966009600 0x0000000000006247 <+951>: kmovq k2,rax 0x000000000000624c <+956>: vpmaxsb zmm3{k2},zmm4,zmm1 0x0000000000006252 <+962>: vpmaxsb zmm2{k2},zmm5,zmm0 0x0000000000006258 <+968>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f9e] # 0x5d200 0x0000000000006262 <+978>: vpermb zmm1,zmm0,zmm2 0x0000000000006268 <+984>: vpermb zmm0,zmm0,zmm3 0x000000000000626e <+990>: vpminsb zmm4,zmm3,zmm0 0x0000000000006274 <+996>: vpminsb zmm5,zmm2,zmm1 0x000000000000627a <+1002>: movabs rax,0xf6f96f6f09096090 0x0000000000006284 <+1012>: kmovq k2,rax 0x0000000000006289 <+1017>: vpmaxsb zmm5{k2},zmm2,zmm1 0x000000000000628f <+1023>: vpmaxsb zmm4{k2},zmm3,zmm0 0x0000000000006295 <+1029>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fa1] # 0x5d240 0x000000000000629f <+1039>: vmovdqa64 zmm1,zmm5 0x00000000000062a5 <+1045>: vpermt2b zmm1,zmm0,zmm4 0x00000000000062ab <+1051>: vpermi2b zmm0,zmm4,zmm5 0x00000000000062b1 <+1057>: vpmaxsb zmm2,zmm4,zmm0 0x00000000000062b7 <+1063>: movabs rax,0x6096960f9696f96 0x00000000000062c1 <+1073>: kmovq k2,rax 0x00000000000062c6 <+1078>: vpminsb zmm2{k2},zmm4,zmm0 0x00000000000062cc <+1084>: vpminsb zmm0,zmm5,zmm1 0x00000000000062d2 <+1090>: movabs rax,0x79f6969f06969068 0x00000000000062dc <+1100>: kmovq k2,rax 0x00000000000062e1 <+1105>: vpmaxsb zmm0{k2},zmm5,zmm1 0x00000000000062e7 <+1111>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f8f] # 0x5d280 0x00000000000062f1 <+1121>: vpermb zmm3,zmm1,zmm2 0x00000000000062f7 <+1127>: vpermb zmm1,zmm1,zmm0 0x00000000000062fd <+1133>: vpmaxsb zmm4,zmm0,zmm1 0x0000000000006303 <+1139>: movabs rax,0x960f00ff0f96f0 0x000000000000630d <+1149>: kmovq k2,rax 0x0000000000006312 <+1154>: vpminsb zmm4{k2},zmm0,zmm1 0x0000000000006318 <+1160>: vpmaxsb zmm0,zmm2,zmm3 0x000000000000631e <+1166>: vpminsb zmm0{k2},zmm2,zmm3 0x0000000000006324 <+1172>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f92] # 0x5d2c0 0x000000000000632e <+1182>: vpermb zmm2,zmm1,zmm0 0x0000000000006334 <+1188>: vpermb zmm1,zmm1,zmm4 0x000000000000633a <+1194>: vpmaxsb zmm3,zmm4,zmm1 0x0000000000006340 <+1200>: movabs rax,0x690f096f0f6960 0x000000000000634a <+1210>: kmovq k2,rax 0x000000000000634f <+1215>: vpminsb zmm3{k2},zmm4,zmm1 0x0000000000006355 <+1221>: vpmaxsb zmm1,zmm0,zmm2 0x000000000000635b <+1227>: vpminsb zmm1{k2},zmm0,zmm2 0x0000000000006361 <+1233>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f95] # 0x5d300 0x000000000000636b <+1243>: vpshufb zmm2,zmm1,zmm0 0x0000000000006371 <+1249>: vpshufb zmm0,zmm3,zmm0 0x0000000000006377 <+1255>: vpmaxsb zmm4,zmm3,zmm0 0x000000000000637d <+1261>: movabs rax,0x6069f069f0600 0x0000000000006387 <+1271>: kmovq k2,rax 0x000000000000638c <+1276>: vpminsb zmm4{k2},zmm3,zmm0 0x0000000000006392 <+1282>: vpmaxsb zmm0,zmm1,zmm2 0x0000000000006398 <+1288>: vpminsb zmm0{k2},zmm1,zmm2 0x000000000000639e <+1294>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f98] # 0x5d340 0x00000000000063a8 <+1304>: vpermb zmm2,zmm1,zmm0 0x00000000000063ae <+1310>: vpermb zmm1,zmm1,zmm4 0x00000000000063b4 <+1316>: vpmaxsb zmm3,zmm4,zmm1 0x00000000000063ba <+1322>: movabs rax,0x90f690f69000 0x00000000000063c4 <+1332>: kmovq k2,rax 0x00000000000063c9 <+1337>: vpminsb zmm3{k2},zmm4,zmm1 0x00000000000063cf <+1343>: vpmaxsb zmm1,zmm0,zmm2 0x00000000000063d5 <+1349>: vpminsb zmm1{k2},zmm0,zmm2 0x00000000000063db <+1355>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f9b] # 0x5d380 0x00000000000063e5 <+1365>: vpermb zmm2,zmm0,zmm1 0x00000000000063eb <+1371>: vpermb zmm0,zmm0,zmm3 0x00000000000063f1 <+1377>: vpmaxsb zmm4,zmm3,zmm0 0x00000000000063f7 <+1383>: movabs rax,0xe8e0e8e06666 0x0000000000006401 <+1393>: kmovq k2,rax 0x0000000000006406 <+1398>: vpminsb zmm4{k2},zmm3,zmm0 0x000000000000640c <+1404>: vpmaxsb zmm0,zmm1,zmm2 0x0000000000006412 <+1410>: vpminsb zmm0{k2},zmm1,zmm2 0x0000000000006418 <+1416>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f9e] # 0x5d3c0 0x0000000000006422 <+1426>: vpermb zmm2,zmm1,zmm0 0x0000000000006428 <+1432>: vpermb zmm1,zmm1,zmm4 0x000000000000642e <+1438>: vpmaxsb zmm3,zmm4,zmm1 0x0000000000006434 <+1444>: movabs rax,0x88800884c6cecce 0x000000000000643e <+1454>: kmovq k2,rax 0x0000000000006443 <+1459>: vpminsb zmm3{k2},zmm4,zmm1 0x0000000000006449 <+1465>: vpmaxsb zmm1,zmm0,zmm2 0x000000000000644f <+1471>: vpminsb zmm1{k2},zmm0,zmm2 0x0000000000006455 <+1477>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fa1] # 0x5d400 0x000000000000645f <+1487>: vmovdqa64 zmm2,zmm1 0x0000000000006465 <+1493>: vpermt2b zmm2,zmm0,zmm3 0x000000000000646b <+1499>: vpermi2b zmm0,zmm3,zmm1 0x0000000000006471 <+1505>: vpmaxsb zmm4,zmm3,zmm0 0x0000000000006477 <+1511>: movabs rax,0x4a00ca4cc48cd9ae 0x0000000000006481 <+1521>: kmovq k2,rax 0x0000000000006486 <+1526>: vpminsb zmm4{k2},zmm3,zmm0 0x000000000000648c <+1532>: vpmaxsb zmm0,zmm1,zmm2 0x0000000000006492 <+1538>: movabs rax,0xa00ca4cc48cd9ac 0x000000000000649c <+1548>: kmovq k2,rax 0x00000000000064a1 <+1553>: vpminsb zmm0{k2},zmm1,zmm2 0x00000000000064a7 <+1559>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f8f] # 0x5d440 0x00000000000064b1 <+1569>: vmovdqa64 zmm2,zmm0 0x00000000000064b7 <+1575>: vpermt2b zmm2,zmm1,zmm4 0x00000000000064bd <+1581>: vpermi2b zmm1,zmm4,zmm0 0x00000000000064c3 <+1587>: vpmaxsb zmm3,zmm4,zmm1 0x00000000000064c9 <+1593>: movabs rax,0x2000246688ca888c 0x00000000000064d3 <+1603>: kmovq k2,rax 0x00000000000064d8 <+1608>: vpminsb zmm3{k2},zmm4,zmm1 0x00000000000064de <+1614>: vpmaxsb zmm1,zmm0,zmm2 0x00000000000064e4 <+1620>: movabs rax,0x246688ca8888 0x00000000000064ee <+1630>: kmovq k2,rax 0x00000000000064f3 <+1635>: vpminsb zmm1{k2},zmm0,zmm2 0x00000000000064f9 <+1641>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f7d] # 0x5d480 0x0000000000006503 <+1651>: vpermb zmm2,zmm0,zmm1 0x0000000000006509 <+1657>: vpermb zmm0,zmm0,zmm3 0x000000000000650f <+1663>: vpmaxsb zmm4,zmm3,zmm0 0x0000000000006515 <+1669>: movabs rax,0xac88eeca8888 0x000000000000651f <+1679>: kmovq k2,rax 0x0000000000006524 <+1684>: vpminsb zmm4{k2},zmm3,zmm0 0x000000000000652a <+1690>: vpmaxsb zmm0,zmm1,zmm2 0x0000000000006530 <+1696>: vpminsb zmm0{k2},zmm1,zmm2 0x0000000000006536 <+1702>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f80] # 0x5d4c0 0x0000000000006540 <+1712>: vpermb zmm2,zmm1,zmm0 0x0000000000006546 <+1718>: vpermb zmm1,zmm1,zmm4 0x000000000000654c <+1724>: vpmaxsb zmm3,zmm4,zmm1 0x0000000000006552 <+1730>: movabs rax,0x44caaaaaaccc88 0x000000000000655c <+1740>: kmovq k2,rax 0x0000000000006561 <+1745>: vpminsb zmm3{k2},zmm4,zmm1 0x0000000000006567 <+1751>: vpmaxsb zmm1,zmm0,zmm2 0x000000000000656d <+1757>: vpminsb zmm1{k2},zmm0,zmm2 0x0000000000006573 <+1763>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f83] # 0x5d500 0x000000000000657d <+1773>: vpermb zmm2,zmm0,zmm1 0x0000000000006583 <+1779>: vpermb zmm0,zmm0,zmm3 0x0000000000006589 <+1785>: vpmaxsb zmm4,zmm3,zmm0 0x000000000000658f <+1791>: movabs rax,0xaacaaccaacaa88 0x0000000000006599 <+1801>: kmovq k2,rax 0x000000000000659e <+1806>: vpminsb zmm4{k2},zmm3,zmm0 0x00000000000065a4 <+1812>: vpmaxsb zmm0,zmm1,zmm2 0x00000000000065aa <+1818>: vpminsb zmm0{k2},zmm1,zmm2 0x00000000000065b0 <+1824>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f86] # 0x5d540 0x00000000000065ba <+1834>: vpermb zmm2,zmm1,zmm0 0x00000000000065c0 <+1840>: vpermb zmm1,zmm1,zmm4 0x00000000000065c6 <+1846>: vpmaxsb zmm3,zmm4,zmm1 0x00000000000065cc <+1852>: movabs rax,0x4ccaccaaccaccc8 0x00000000000065d6 <+1862>: kmovq k2,rax 0x00000000000065db <+1867>: vpminsb zmm3{k2},zmm4,zmm1 0x00000000000065e1 <+1873>: vpmaxsb zmm1,zmm0,zmm2 0x00000000000065e7 <+1879>: vpminsb zmm1{k2},zmm0,zmm2 0x00000000000065ed <+1885>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f89] # 0x5d580 0x00000000000065f7 <+1895>: vpermb zmm2,zmm0,zmm1 0x00000000000065fd <+1901>: vpermb zmm0,zmm0,zmm3 0x0000000000006603 <+1907>: vpmaxsb zmm4,zmm3,zmm0 0x0000000000006609 <+1913>: movabs rax,0xaaaaaaaaaaaaaa8 0x0000000000006613 <+1923>: kmovq k2,rax 0x0000000000006618 <+1928>: vpmaxsb zmm5,zmm1,zmm2 0x000000000000661e <+1934>: vpminsb zmm5{k2},zmm1,zmm2 0x0000000000006624 <+1940>: movabs rax,0xe000000000000007 0x000000000000662e <+1950>: kmovq k3,rax 0x0000000000006633 <+1955>: vpblendmb zmm1{k3},zmm5,zmm4 0x0000000000006639 <+1961>: vpminsb zmm4{k2},zmm3,zmm0 0x000000000000663f <+1967>: vpblendmb zmm0{k3},zmm4,zmm5 0x0000000000006645 <+1973>: vpminsb zmm2,zmm4,zmm1 0x000000000000664b <+1979>: vpmaxsb zmm2{k3},zmm4,zmm1 0x0000000000006651 <+1985>: vpmaxsb zmm0,zmm5,zmm0 0x0000000000006657 <+1991>: vshufi64x2 zmm1,zmm2,zmm0,0xee 0x000000000000665e <+1998>: vinserti64x4 zmm3,zmm2,ymm0,0x1 0x0000000000006665 <+2005>: vpmaxsb zmm4,zmm2,zmm3 0x000000000000666b <+2011>: movabs rax,0xffffffff00000000 0x0000000000006675 <+2021>: kmovq k2,rax 0x000000000000667a <+2026>: vpminsb zmm4{k2},zmm2,zmm3 0x0000000000006680 <+2032>: vpmaxsb zmm0,zmm0,zmm1 0x0000000000006686 <+2038>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f30] # 0x5d5c0 0x0000000000006690 <+2048>: vpermi2q zmm1,zmm0,zmm4 0x0000000000006696 <+2054>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x56f60] # 0x5d600 0x00000000000066a0 <+2064>: vpermi2q zmm2,zmm4,zmm0 0x00000000000066a6 <+2070>: vpmaxsb zmm3,zmm4,zmm2 0x00000000000066ac <+2076>: movabs rax,0xffff0000ffff0000 0x00000000000066b6 <+2086>: kmovq k2,rax 0x00000000000066bb <+2091>: vpminsb zmm3{k2},zmm4,zmm2 0x00000000000066c1 <+2097>: vpmaxsb zmm2,zmm0,zmm1 0x00000000000066c7 <+2103>: mov eax,0xffff0000 0x00000000000066cc <+2108>: kmovq k2,rax 0x00000000000066d1 <+2113>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x56fa5] # 0x5d680 0x00000000000066db <+2123>: vpermi2q zmm4,zmm3,zmm2 0x00000000000066e1 <+2129>: vpminsb zmm2{k2},zmm0,zmm1 0x00000000000066e7 <+2135>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f4f] # 0x5d640 0x00000000000066f1 <+2145>: vpermi2q zmm0,zmm2,zmm3 0x00000000000066f7 <+2151>: vpmaxsb zmm1,zmm2,zmm0 0x00000000000066fd <+2157>: movabs rax,0xff00ff00ff00 0x0000000000006707 <+2167>: vpmaxsb zmm5,zmm3,zmm4 0x000000000000670d <+2173>: movabs rcx,0xff00ff00ff00ff00 0x0000000000006717 <+2183>: kmovq k2,rcx 0x000000000000671c <+2188>: vpminsb zmm5{k2},zmm3,zmm4 0x0000000000006722 <+2194>: kmovq k2,rax 0x0000000000006727 <+2199>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x56fcf] # 0x5d700 0x0000000000006731 <+2209>: vpermi2d zmm3,zmm5,zmm1 0x0000000000006737 <+2215>: vpminsb zmm1{k2},zmm2,zmm0 0x000000000000673d <+2221>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56f79] # 0x5d6c0 0x0000000000006747 <+2231>: vpermi2d zmm0,zmm1,zmm5 0x000000000000674d <+2237>: vpmaxsb zmm2,zmm5,zmm3 0x0000000000006753 <+2243>: movabs rax,0xf0f0f0f0f0f0f0f0 0x000000000000675d <+2253>: kmovq k2,rax 0x0000000000006762 <+2258>: vpminsb zmm2{k2},zmm5,zmm3 0x0000000000006768 <+2264>: vpmaxsb zmm3,zmm1,zmm0 0x000000000000676e <+2270>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57008] # 0x5d780 0x0000000000006778 <+2280>: vpermi2w zmm4,zmm2,zmm3 0x000000000000677e <+2286>: movabs rax,0xf0f0f0f0f0f0f0 0x0000000000006788 <+2296>: kmovq k2,rax 0x000000000000678d <+2301>: vpminsb zmm3{k2},zmm1,zmm0 0x0000000000006793 <+2307>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fa3] # 0x5d740 0x000000000000679d <+2317>: vpermi2w zmm0,zmm3,zmm2 0x00000000000067a3 <+2323>: mov rbx,QWORD PTR [rsp+0x90] 0x00000000000067ab <+2331>: mov rax,QWORD PTR [rsp+0x98] 0x00000000000067b3 <+2339>: mov QWORD PTR [rsp+0x188],rax 0x00000000000067bb <+2347>: vpmaxsb zmm5,zmm2,zmm4 0x00000000000067c1 <+2353>: vpminsb zmm5{k1},zmm2,zmm4 0x00000000000067c7 <+2359>: vpmaxsb zmm1,zmm3,zmm0 0x00000000000067cd <+2365>: movabs rax,0xccccccccccccccc 0x00000000000067d7 <+2375>: kmovq k1,rax 0x00000000000067dc <+2380>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5701a] # 0x5d800 0x00000000000067e6 <+2390>: vpermi2b zmm2,zmm5,zmm1 0x00000000000067ec <+2396>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm2 0x00000000000067f4 <+2404>: vpminsb zmm1{k1},zmm3,zmm0 0x00000000000067fa <+2410>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fbc] # 0x5d7c0 0x0000000000006804 <+2420>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm5 0x000000000000680c <+2428>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm1 0x0000000000006814 <+2436>: vpermi2b zmm0,zmm1,zmm5 0x000000000000681a <+2442>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x0000000000006822 <+2450>: vpxor xmm0,xmm0,xmm0 0x0000000000006826 <+2454>: vmovdqa XMMWORD PTR [rsp+0xb0],xmm0 0x000000000000682f <+2463>: lea rsi,[rsp+0xb0] 0x0000000000006837 <+2471>: mov edi,0x1 0x000000000000683c <+2476>: vzeroupper 0x000000000000683f <+2479>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int8_16.asm --- 0x0000000000006092 <+562>: call 0x5470 <clock_gettime@plt> 0x0000000000006097 <+567>: vmovdqa xmm2,XMMWORD PTR [rsp] 0x000000000000609c <+572>: vpshufb xmm0,xmm2,XMMWORD PTR [rip+0x5705b] # 0x5d100 0x00000000000060a5 <+581>: vpminsb xmm1,xmm2,xmm0 0x00000000000060aa <+586>: mov ax,0xf2b0 0x00000000000060ae <+590>: kmovd k1,eax 0x00000000000060b2 <+594>: vpmaxsb xmm1{k1},xmm2,xmm0 0x00000000000060b8 <+600>: vpshufb xmm0,xmm1,XMMWORD PTR [rip+0x5704f] # 0x5d110 0x00000000000060c1 <+609>: vpminsb xmm2,xmm1,xmm0 0x00000000000060c6 <+614>: mov ax,0xdcc4 0x00000000000060ca <+618>: kmovd k1,eax 0x00000000000060ce <+622>: vpmaxsb xmm2{k1},xmm1,xmm0 0x00000000000060d4 <+628>: vpshufb xmm0,xmm2,XMMWORD PTR [rip+0x57043] # 0x5d120 0x00000000000060dd <+637>: vpminsb xmm1,xmm2,xmm0 0x00000000000060e2 <+642>: mov ax,0xef08 0x00000000000060e6 <+646>: kmovd k1,eax 0x00000000000060ea <+650>: vpmaxsb xmm1{k1},xmm2,xmm0 0x00000000000060f0 <+656>: vpshufb xmm0,xmm1,XMMWORD PTR [rip+0x57037] # 0x5d130 0x00000000000060f9 <+665>: mov rbx,QWORD PTR [rsp+0xc0] 0x0000000000006101 <+673>: vpminsb xmm2,xmm1,xmm0 0x0000000000006106 <+678>: mov ax,0xb552 0x000000000000610a <+682>: kmovd k1,eax 0x000000000000610e <+686>: vpmaxsb xmm2{k1},xmm1,xmm0 0x0000000000006114 <+692>: vpshufb xmm0,xmm2,XMMWORD PTR [rip+0x57023] # 0x5d140 0x000000000000611d <+701>: mov r12,QWORD PTR [rsp+0xc8] 0x0000000000006125 <+709>: vpmaxsb xmm1,xmm2,xmm0 0x000000000000612a <+714>: mov ax,0x14d6 0x000000000000612e <+718>: kmovd k1,eax 0x0000000000006132 <+722>: vpminsb xmm1{k1},xmm2,xmm0 0x0000000000006138 <+728>: vpshufb xmm0,xmm1,XMMWORD PTR [rip+0x5700f] # 0x5d150 0x0000000000006141 <+737>: vpmaxsb xmm2,xmm1,xmm0 0x0000000000006146 <+742>: mov ax,0x24da 0x000000000000614a <+746>: kmovd k1,eax 0x000000000000614e <+750>: vpminsb xmm2{k1},xmm1,xmm0 0x0000000000006154 <+756>: vpshufb xmm0,xmm2,XMMWORD PTR [rip+0x57003] # 0x5d160 0x000000000000615d <+765>: vpmaxsb xmm1,xmm2,xmm0 0x0000000000006162 <+770>: mov ax,0x1554 0x0000000000006166 <+774>: kmovd k1,eax 0x000000000000616a <+778>: vpminsb xmm1{k1},xmm2,xmm0 0x0000000000006170 <+784>: vpshufb xmm0,xmm1,XMMWORD PTR [rip+0x56ff7] # 0x5d170 0x0000000000006179 <+793>: vpminsb xmm2,xmm1,xmm0 0x000000000000617e <+798>: vpmaxsb xmm0,xmm1,xmm0 0x0000000000006183 <+803>: vpblendw xmm0,xmm0,xmm2,0x14 0x0000000000006189 <+809>: vmovdqa XMMWORD PTR [rsp+0x20],xmm0 0x000000000000618f <+815>: vpshufb xmm0,xmm0,XMMWORD PTR [rip+0x56fe8] # 0x5d180 0x0000000000006198 <+824>: vmovdqa XMMWORD PTR [rsp+0x220],xmm0 0x00000000000061a1 <+833>: vpxor xmm0,xmm0,xmm0 0x00000000000061a5 <+837>: vmovdqa XMMWORD PTR [rsp+0xe0],xmm0 0x00000000000061ae <+846>: lea rsi,[rsp+0xe0] 0x00000000000061b6 <+854>: mov edi,0x1 0x00000000000061bb <+859>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int8_32.asm --- 0x00000000000060b5 <+581>: call 0x5470 <clock_gettime@plt> 0x00000000000060ba <+586>: mov rbx,QWORD PTR [rsp+0xc0] 0x00000000000060c2 <+594>: vmovdqu ymm2,YMMWORD PTR [rsp] 0x00000000000060c7 <+599>: vpshufb ymm0,ymm2,YMMWORD PTR [rip+0x57030] # 0x5d100 0x00000000000060d0 <+608>: mov rax,QWORD PTR [rsp+0xc8] 0x00000000000060d8 <+616>: mov QWORD PTR [rsp+0x150],rax 0x00000000000060e0 <+624>: vpminsb ymm1,ymm2,ymm0 0x00000000000060e5 <+629>: mov eax,0xaaaaaaaa 0x00000000000060ea <+634>: kmovd k1,eax 0x00000000000060ee <+638>: vpmaxsb ymm1{k1},ymm2,ymm0 0x00000000000060f4 <+644>: vprold ymm0,ymm1,0x10 0x00000000000060fb <+651>: vpminsb ymm2,ymm1,ymm0 0x0000000000006100 <+656>: vpmaxsb ymm0,ymm1,ymm0 0x0000000000006105 <+661>: vpblendw ymm0,ymm2,ymm0,0xaa 0x000000000000610b <+667>: vpshufd ymm1,ymm0,0xb1 0x0000000000006110 <+672>: vpminsb ymm2,ymm0,ymm1 0x0000000000006115 <+677>: vpmaxsb ymm0,ymm0,ymm1 0x000000000000611a <+682>: vpblendd ymm0,ymm2,ymm0,0xaa 0x0000000000006120 <+688>: vpshufd ymm1,ymm0,0x4e 0x0000000000006125 <+693>: vpminsb ymm2,ymm0,ymm1 0x000000000000612a <+698>: vpmaxsb ymm0,ymm0,ymm1 0x000000000000612f <+703>: vpblendd ymm0,ymm2,ymm0,0xcc 0x0000000000006135 <+709>: vmovdqa ymm1,YMMWORD PTR [rip+0x56fe3] # 0x5d120 0x000000000000613d <+717>: vpermb ymm1,ymm1,ymm0 0x0000000000006143 <+723>: vpminsb ymm2,ymm0,ymm1 0x0000000000006148 <+728>: mov eax,0xf7117710 0x000000000000614d <+733>: kmovd k1,eax 0x0000000000006151 <+737>: vpmaxsb ymm2{k1},ymm0,ymm1 0x0000000000006157 <+743>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fe1] # 0x5d140 0x000000000000615f <+751>: vpermb ymm0,ymm0,ymm2 0x0000000000006165 <+757>: vpmaxsb ymm1,ymm2,ymm0 0x000000000000616a <+762>: mov eax,0x249a26da 0x000000000000616f <+767>: kmovd k1,eax 0x0000000000006173 <+771>: vpminsb ymm1{k1},ymm2,ymm0 0x0000000000006179 <+777>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fdf] # 0x5d160 0x0000000000006181 <+785>: vpermb ymm0,ymm0,ymm1 0x0000000000006187 <+791>: vpmaxsb ymm2,ymm1,ymm0 0x000000000000618c <+796>: mov eax,0x2079be 0x0000000000006191 <+801>: kmovd k1,eax 0x0000000000006195 <+805>: vpminsb ymm2{k1},ymm1,ymm0 0x000000000000619b <+811>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fdd] # 0x5d180 0x00000000000061a3 <+819>: vpermb ymm0,ymm0,ymm2 0x00000000000061a9 <+825>: vpmaxsb ymm1,ymm2,ymm0 0x00000000000061ae <+830>: mov eax,0x40edf8 0x00000000000061b3 <+835>: kmovd k1,eax 0x00000000000061b7 <+839>: vpminsb ymm1{k1},ymm2,ymm0 0x00000000000061bd <+845>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fdb] # 0x5d1a0 0x00000000000061c5 <+853>: vpermb ymm0,ymm0,ymm1 0x00000000000061cb <+859>: vpmaxsb ymm2,ymm1,ymm0 0x00000000000061d0 <+864>: mov eax,0x880deaa 0x00000000000061d5 <+869>: kmovd k1,eax 0x00000000000061d9 <+873>: vpminsb ymm2{k1},ymm1,ymm0 0x00000000000061df <+879>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fd9] # 0x5d1c0 0x00000000000061e7 <+887>: vpermb ymm0,ymm0,ymm2 0x00000000000061ed <+893>: vpmaxsb ymm1,ymm2,ymm0 0x00000000000061f2 <+898>: mov eax,0x480fa84 0x00000000000061f7 <+903>: kmovd k1,eax 0x00000000000061fb <+907>: vpminsb ymm1{k1},ymm2,ymm0 0x0000000000006201 <+913>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fd7] # 0x5d1e0 0x0000000000006209 <+921>: vpermb ymm0,ymm0,ymm1 0x000000000000620f <+927>: vpmaxsb ymm2,ymm1,ymm0 0x0000000000006214 <+932>: mov eax,0x818e644 0x0000000000006219 <+937>: kmovd k1,eax 0x000000000000621d <+941>: vpminsb ymm2{k1},ymm1,ymm0 0x0000000000006223 <+947>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fd5] # 0x5d200 0x000000000000622b <+955>: vpermb ymm0,ymm0,ymm2 0x0000000000006231 <+961>: vpmaxsb ymm1,ymm2,ymm0 0x0000000000006236 <+966>: mov eax,0x22ccb20 0x000000000000623b <+971>: kmovd k1,eax 0x000000000000623f <+975>: vpminsb ymm1{k1},ymm2,ymm0 0x0000000000006245 <+981>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fd3] # 0x5d220 0x000000000000624d <+989>: vpermb ymm0,ymm0,ymm1 0x0000000000006253 <+995>: vpmaxsb ymm2,ymm1,ymm0 0x0000000000006258 <+1000>: mov eax,0x54aad48 0x000000000000625d <+1005>: kmovd k1,eax 0x0000000000006261 <+1009>: vpminsb ymm2{k1},ymm1,ymm0 0x0000000000006267 <+1015>: vmovdqa ymm0,YMMWORD PTR [rip+0x56fd1] # 0x5d240 0x000000000000626f <+1023>: vmovdqu YMMWORD PTR [rsp+0x130],ymm2 0x0000000000006278 <+1032>: vpermb ymm0,ymm0,ymm2 0x000000000000627e <+1038>: vmovdqu YMMWORD PTR [rsp+0x280],ymm0 0x0000000000006287 <+1047>: mov ebp,0xaaaaaa8 0x000000000000628c <+1052>: vpxor xmm0,xmm0,xmm0 0x0000000000006290 <+1056>: vmovdqa XMMWORD PTR [rsp+0xe0],xmm0 0x0000000000006299 <+1065>: lea rsi,[rsp+0xe0] 0x00000000000062a1 <+1073>: mov edi,0x1 0x00000000000062a6 <+1078>: vzeroupper 0x00000000000062a9 <+1081>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int8_64.asm --- 0x00000000000060b8 <+584>: call 0x5470 <clock_gettime@plt> 0x00000000000060bd <+589>: mov rbx,QWORD PTR [rsp+0x90] 0x00000000000060c5 <+597>: vmovdqu64 zmm2,ZMMWORD PTR [rsp+0x100] 0x00000000000060cd <+605>: vprold zmm0,zmm2,0x10 0x00000000000060d4 <+612>: vpminsb zmm1,zmm2,zmm0 0x00000000000060da <+618>: movabs rax,0xcccccccccccccccc 0x00000000000060e4 <+628>: kmovq k1,rax 0x00000000000060e9 <+633>: vpmaxsb zmm1{k1},zmm2,zmm0 0x00000000000060ef <+639>: vpshufb zmm0,zmm1,ZMMWORD PTR [rip+0x57047] # 0x5d140 0x00000000000060f9 <+649>: vpminsb zmm2,zmm1,zmm0 0x00000000000060ff <+655>: movabs rax,0xaaaaaaaaaaaaaaaa 0x0000000000006109 <+665>: kmovq k1,rax 0x000000000000610e <+670>: vpmaxsb zmm2{k1},zmm1,zmm0 0x0000000000006114 <+676>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57062] # 0x5d180 0x000000000000611e <+686>: vpermb zmm0,zmm0,zmm2 0x0000000000006124 <+692>: vpminsb zmm1,zmm2,zmm0 0x000000000000612a <+698>: movabs rax,0xdddd44d4d4dd4444 0x0000000000006134 <+708>: kmovq k1,rax 0x0000000000006139 <+713>: vpmaxsb zmm1{k1},zmm2,zmm0 0x000000000000613f <+719>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57077] # 0x5d1c0 0x0000000000006149 <+729>: vpermb zmm0,zmm0,zmm1 0x000000000000614f <+735>: vpminsb zmm2,zmm1,zmm0 0x0000000000006155 <+741>: movabs rax,0xff6f9960f9660900 0x000000000000615f <+751>: kmovq k1,rax 0x0000000000006164 <+756>: vpmaxsb zmm2{k1},zmm1,zmm0 0x000000000000616a <+762>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5708c] # 0x5d200 0x0000000000006174 <+772>: vpermb zmm0,zmm0,zmm2 0x000000000000617a <+778>: vpminsb zmm1,zmm2,zmm0 0x0000000000006180 <+784>: movabs rax,0xff96ff9966009600 0x000000000000618a <+794>: kmovq k1,rax 0x000000000000618f <+799>: vpmaxsb zmm1{k1},zmm2,zmm0 0x0000000000006195 <+805>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570a1] # 0x5d240 0x000000000000619f <+815>: vpermb zmm0,zmm0,zmm1 0x00000000000061a5 <+821>: vpminsb zmm2,zmm1,zmm0 0x00000000000061ab <+827>: movabs rax,0xf6f96f6f09096090 0x00000000000061b5 <+837>: kmovq k1,rax 0x00000000000061ba <+842>: vpmaxsb zmm2{k1},zmm1,zmm0 0x00000000000061c0 <+848>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570b6] # 0x5d280 0x00000000000061ca <+858>: vpermb zmm0,zmm0,zmm2 0x00000000000061d0 <+864>: vpmaxsb zmm1,zmm2,zmm0 0x00000000000061d6 <+870>: movabs rax,0x6096960f9696f96 0x00000000000061e0 <+880>: kmovq k1,rax 0x00000000000061e5 <+885>: vpminsb zmm1{k1},zmm2,zmm0 0x00000000000061eb <+891>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570cb] # 0x5d2c0 0x00000000000061f5 <+901>: vpermb zmm0,zmm0,zmm1 0x00000000000061fb <+907>: vpmaxsb zmm2,zmm1,zmm0 0x0000000000006201 <+913>: movabs rax,0x960f00ff0f96f0 0x000000000000620b <+923>: kmovq k1,rax 0x0000000000006210 <+928>: vpminsb zmm2{k1},zmm1,zmm0 0x0000000000006216 <+934>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570e0] # 0x5d300 0x0000000000006220 <+944>: vpermb zmm0,zmm0,zmm2 0x0000000000006226 <+950>: vpmaxsb zmm1,zmm2,zmm0 0x000000000000622c <+956>: movabs rax,0x690f096f0f6960 0x0000000000006236 <+966>: kmovq k1,rax 0x000000000000623b <+971>: vpminsb zmm1{k1},zmm2,zmm0 0x0000000000006241 <+977>: vpshufb zmm0,zmm1,ZMMWORD PTR [rip+0x570f5] # 0x5d340 0x000000000000624b <+987>: mov rax,QWORD PTR [rsp+0x98] 0x0000000000006253 <+995>: mov QWORD PTR [rsp+0x150],rax 0x000000000000625b <+1003>: vpmaxsb zmm2,zmm1,zmm0 0x0000000000006261 <+1009>: movabs rax,0x6069f069f0600 0x000000000000626b <+1019>: kmovq k1,rax 0x0000000000006270 <+1024>: vpminsb zmm2{k1},zmm1,zmm0 0x0000000000006276 <+1030>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57100] # 0x5d380 0x0000000000006280 <+1040>: vpermb zmm0,zmm0,zmm2 0x0000000000006286 <+1046>: vpmaxsb zmm1,zmm2,zmm0 0x000000000000628c <+1052>: movabs rax,0x90f690f69000 0x0000000000006296 <+1062>: kmovq k1,rax 0x000000000000629b <+1067>: vpminsb zmm1{k1},zmm2,zmm0 0x00000000000062a1 <+1073>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57115] # 0x5d3c0 0x00000000000062ab <+1083>: vpermb zmm0,zmm0,zmm1 0x00000000000062b1 <+1089>: vpmaxsb zmm2,zmm1,zmm0 0x00000000000062b7 <+1095>: movabs rax,0xe8e0e8e06666 0x00000000000062c1 <+1105>: kmovq k1,rax 0x00000000000062c6 <+1110>: vpminsb zmm2{k1},zmm1,zmm0 0x00000000000062cc <+1116>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5712a] # 0x5d400 0x00000000000062d6 <+1126>: vpermb zmm0,zmm0,zmm2 0x00000000000062dc <+1132>: vpmaxsb zmm1,zmm2,zmm0 0x00000000000062e2 <+1138>: movabs rax,0x88800884c6cecce 0x00000000000062ec <+1148>: kmovq k1,rax 0x00000000000062f1 <+1153>: vpminsb zmm1{k1},zmm2,zmm0 0x00000000000062f7 <+1159>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5713f] # 0x5d440 0x0000000000006301 <+1169>: vpermb zmm0,zmm0,zmm1 0x0000000000006307 <+1175>: vpmaxsb zmm2,zmm1,zmm0 0x000000000000630d <+1181>: movabs rax,0xa00ca4cc48cd9ac 0x0000000000006317 <+1191>: kmovq k1,rax 0x000000000000631c <+1196>: vpminsb zmm2{k1},zmm1,zmm0 0x0000000000006322 <+1202>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57154] # 0x5d480 0x000000000000632c <+1212>: vpermb zmm0,zmm0,zmm2 0x0000000000006332 <+1218>: vpmaxsb zmm1,zmm2,zmm0 0x0000000000006338 <+1224>: movabs rax,0x246688ca8888 0x0000000000006342 <+1234>: kmovq k1,rax 0x0000000000006347 <+1239>: vpminsb zmm1{k1},zmm2,zmm0 0x000000000000634d <+1245>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57169] # 0x5d4c0 0x0000000000006357 <+1255>: vpermb zmm0,zmm0,zmm1 0x000000000000635d <+1261>: vpmaxsb zmm2,zmm1,zmm0 0x0000000000006363 <+1267>: movabs rax,0xac88eeca8888 0x000000000000636d <+1277>: kmovq k1,rax 0x0000000000006372 <+1282>: vpminsb zmm2{k1},zmm1,zmm0 0x0000000000006378 <+1288>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5717e] # 0x5d500 0x0000000000006382 <+1298>: vpermb zmm0,zmm0,zmm2 0x0000000000006388 <+1304>: vpmaxsb zmm1,zmm2,zmm0 0x000000000000638e <+1310>: movabs rax,0x44caaaaaaccc88 0x0000000000006398 <+1320>: kmovq k1,rax 0x000000000000639d <+1325>: vpminsb zmm1{k1},zmm2,zmm0 0x00000000000063a3 <+1331>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57193] # 0x5d540 0x00000000000063ad <+1341>: vpermb zmm0,zmm0,zmm1 0x00000000000063b3 <+1347>: vpmaxsb zmm2,zmm1,zmm0 0x00000000000063b9 <+1353>: movabs rax,0xaacaaccaacaa88 0x00000000000063c3 <+1363>: kmovq k1,rax 0x00000000000063c8 <+1368>: vpminsb zmm2{k1},zmm1,zmm0 0x00000000000063ce <+1374>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x571a8] # 0x5d580 0x00000000000063d8 <+1384>: vpermb zmm0,zmm0,zmm2 0x00000000000063de <+1390>: vpmaxsb zmm1,zmm2,zmm0 0x00000000000063e4 <+1396>: movabs rax,0x4ccaccaaccaccc8 0x00000000000063ee <+1406>: kmovq k1,rax 0x00000000000063f3 <+1411>: vpminsb zmm1{k1},zmm2,zmm0 0x00000000000063f9 <+1417>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x571bd] # 0x5d5c0 0x0000000000006403 <+1427>: vmovdqu64 ZMMWORD PTR [rsp+0x270],zmm1 0x000000000000640e <+1438>: vpermb zmm0,zmm0,zmm1 0x0000000000006414 <+1444>: vmovdqu64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x000000000000641c <+1452>: movabs r13,0xaaaaaaaaaaaaaa8 0x0000000000006426 <+1462>: vpxor xmm0,xmm0,xmm0 0x000000000000642a <+1466>: vmovdqa XMMWORD PTR [rsp+0xb0],xmm0 0x0000000000006433 <+1475>: lea rsi,[rsp+0xb0] 0x000000000000643b <+1483>: mov edi,0x1 0x0000000000006440 <+1488>: vzeroupper 0x0000000000006443 <+1491>: call 0x5470 <clock_gettime@plt> --- disassemble/asm/int8_8.asm --- 0x000000000005bd27 <+775>: call r14 0x000000000005bd2a <+778>: mov r15,QWORD PTR [rsp+0xc0] 0x000000000005bd32 <+786>: mov rax,QWORD PTR [rsp+0xc8] 0x000000000005bd3a <+794>: mov QWORD PTR [rsp+0x128],rax 0x000000000005bd42 <+802>: vmovdqa xmm2,XMMWORD PTR [rsp] 0x000000000005bd47 <+807>: vprold xmm0,xmm2,0x10 0x000000000005bd4e <+814>: vpminsb xmm1,xmm2,xmm0 0x000000000005bd53 <+819>: vpmaxsb xmm0,xmm2,xmm0 0x000000000005bd58 <+824>: vpblendw xmm0,xmm1,xmm0,0xa 0x000000000005bd5e <+830>: vpshufd xmm1,xmm0,0xe1 0x000000000005bd63 <+835>: vpminsb xmm2,xmm0,xmm1 0x000000000005bd68 <+840>: vpmaxsb xmm0,xmm0,xmm1 0x000000000005bd6d <+845>: vpblendd xmm0,xmm2,xmm0,0x2 0x000000000005bd73 <+851>: movabs rax,0xfffffffffffd56d8 0x000000000005bd7d <+861>: vpshufb xmm1,xmm0,XMMWORD PTR [r13+rax*1+0x0] 0x000000000005bd84 <+868>: vpminsb xmm2,xmm0,xmm1 0x000000000005bd89 <+873>: mov ax,0xaa 0x000000000005bd8d <+877>: kmovd k1,eax 0x000000000005bd91 <+881>: vpmaxsb xmm2{k1},xmm0,xmm1 0x000000000005bd97 <+887>: vpshuflw xmm0,xmm2,0xd8 0x000000000005bd9c <+892>: vpminsb xmm1,xmm2,xmm0 0x000000000005bda1 <+897>: vpmaxsb xmm0,xmm2,xmm0 0x000000000005bda6 <+902>: vpblendw xmm0,xmm0,xmm1,0x2 0x000000000005bdac <+908>: movabs rax,0xfffffffffffd56e8 0x000000000005bdb6 <+918>: vpshufb xmm1,xmm0,XMMWORD PTR [r13+rax*1+0x0] 0x000000000005bdbd <+925>: vpmaxsb xmm2,xmm0,xmm1 0x000000000005bdc2 <+930>: mov ax,0xa 0x000000000005bdc6 <+934>: kmovd k1,eax 0x000000000005bdca <+938>: vpminsb xmm2{k1},xmm0,xmm1 0x000000000005bdd0 <+944>: movabs rax,0xfffffffffffd56f8 0x000000000005bdda <+954>: vmovdqa XMMWORD PTR [rsp+0x240],xmm2 0x000000000005bde3 <+963>: vpshufb xmm0,xmm2,XMMWORD PTR [r13+rax*1+0x0] 0x000000000005bdea <+970>: vmovdqa XMMWORD PTR [rsp+0x230],xmm0 0x000000000005bdf3 <+979>: vpxor xmm0,xmm0,xmm0 0x000000000005bdf7 <+983>: vmovdqa XMMWORD PTR [rsp+0xe0],xmm0 0x000000000005be00 <+992>: lea rsi,[rsp+0xe0] 0x000000000005be08 <+1000>: mov edi,0x1 0x000000000005be0d <+1005>: call r14 --- disassemble/int16_128.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d90 <+0>: push rbp 0x0000000000005d91 <+1>: mov rbp,rsp 0x0000000000005d94 <+4>: push r15 0x0000000000005d96 <+6>: push r14 0x0000000000005d98 <+8>: push r13 0x0000000000005d9a <+10>: push r12 0x0000000000005d9c <+12>: push rbx 0x0000000000005d9d <+13>: and rsp,0xffffffffffffffc0 0x0000000000005da1 <+17>: sub rsp,0x640 0x0000000000005da8 <+24>: call 0x2feb0 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005dad <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005db1 <+33>: mov ebx,0x81 0x0000000000005db6 <+38>: xor r14d,r14d 0x0000000000005db9 <+41>: vxorps xmm1,xmm1,xmm1 0x0000000000005dbd <+45>: vxorps xmm3,xmm3,xmm3 0x0000000000005dc1 <+49>: vxorps xmm2,xmm2,xmm2 0x0000000000005dc5 <+53>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005dd0 <+64>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000005dd8 <+72>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005de0 <+80>: vmovaps ZMMWORD PTR [rsp+0x180],zmm3 0x0000000000005de8 <+88>: vmovaps ZMMWORD PTR [rsp+0x140],zmm2 0x0000000000005df0 <+96>: vzeroupper 0x0000000000005df3 <+99>: call 0x2ee00 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005df8 <+104>: mov edx,0x64 0x0000000000005dfd <+109>: mov rdi,rax 0x0000000000005e00 <+112>: xor esi,esi 0x0000000000005e02 <+114>: call 0x2f210 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005e07 <+119>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000005e0f <+127>: vmovaps ZMMWORD PTR [rsp+0x500],zmm0 0x0000000000005e17 <+135>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005e1f <+143>: vmovaps ZMMWORD PTR [rsp+0x540],zmm0 0x0000000000005e27 <+151>: vmovaps zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000005e2f <+159>: vmovaps ZMMWORD PTR [rsp+0x580],zmm0 0x0000000000005e37 <+167>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005e3f <+175>: vmovaps ZMMWORD PTR [rsp+0x5c0],zmm0 0x0000000000005e47 <+183>: mov ecx,r14d 0x0000000000005e4a <+186>: and ecx,0x7f 0x0000000000005e4d <+189>: mov WORD PTR [rsp+rcx*2+0x500],ax 0x0000000000005e55 <+197>: vmovaps zmm0,ZMMWORD PTR [rsp+0x500] 0x0000000000005e5d <+205>: vmovaps zmm1,ZMMWORD PTR [rsp+0x540] 0x0000000000005e65 <+213>: vmovaps zmm3,ZMMWORD PTR [rsp+0x580] 0x0000000000005e6d <+221>: vmovaps zmm2,ZMMWORD PTR [rsp+0x5c0] 0x0000000000005e75 <+229>: dec rbx 0x0000000000005e78 <+232>: inc r14 0x0000000000005e7b <+235>: cmp rbx,0x1 0x0000000000005e7f <+239>: ja 0x5dd0 <main+64> 0x0000000000005e85 <+245>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005e8d <+253>: vmovaps ZMMWORD PTR [rsp+0x140],zmm2 0x0000000000005e95 <+261>: vmovaps ZMMWORD PTR [rsp+0x180],zmm3 0x0000000000005e9d <+269>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000005ea5 <+277>: mov edi,0x80 0x0000000000005eaa <+282>: vzeroupper 0x0000000000005ead <+285>: call 0x8d90 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005eb2 <+290>: mov rbx,rax 0x0000000000005eb5 <+293>: test rax,rax 0x0000000000005eb8 <+296>: jle 0x5ecf <main+319> 0x0000000000005eba <+298>: mov edi,0x1 0x0000000000005ebf <+303>: mov rsi,rbx 0x0000000000005ec2 <+306>: call 0x2e2e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005ec7 <+311>: mov r14,rax 0x0000000000005eca <+314>: mov r15,rbx 0x0000000000005ecd <+317>: jmp 0x5ed5 <main+325> 0x0000000000005ecf <+319>: xor r14d,r14d 0x0000000000005ed2 <+322>: xor r15d,r15d 0x0000000000005ed5 <+325>: lea rdx,[rip+0x581e4] # 0x5e0c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005edc <+332>: mov ecx,0x80 0x0000000000005ee1 <+337>: mov rdi,r14 0x0000000000005ee4 <+340>: mov rsi,rbx 0x0000000000005ee7 <+343>: xor eax,eax 0x0000000000005ee9 <+345>: call 0x57c0 <snprintf@plt> 0x0000000000005eee <+350>: cdqe 0x0000000000005ef0 <+352>: inc rax 0x0000000000005ef3 <+355>: mov QWORD PTR [rsp+0x70],r14 0x0000000000005ef8 <+360>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005efd <+365>: mov QWORD PTR [rsp+0x80],r15 0x0000000000005f05 <+373>: lea rdx,[rip+0x581c4] # 0x5e0d0 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005f0c <+380>: lea rdi,[rsp+0x210] 0x0000000000005f14 <+388>: lea rsi,[rsp+0x70] 0x0000000000005f19 <+393>: mov ecx,0x7 0x0000000000005f1e <+398>: call 0xe3e0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005f23 <+403>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000005f28 <+408>: test rdi,rdi 0x0000000000005f2b <+411>: je 0x5f32 <main+418> 0x0000000000005f2d <+413>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f32 <+418>: mov edi,0x1 0x0000000000005f37 <+423>: mov esi,0x3 0x0000000000005f3c <+428>: call 0x2e2e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005f41 <+433>: xor ecx,ecx 0x0000000000005f43 <+435>: data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005f50 <+448>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005f54 <+452>: inc rcx 0x0000000000005f57 <+455>: cmp rcx,0x3 0x0000000000005f5b <+459>: jne 0x5f50 <main+448> 0x0000000000005f5d <+461>: mov WORD PTR [rax],0x203a 0x0000000000005f62 <+466>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005f66 <+470>: mov QWORD PTR [rsp+0x88],rax 0x0000000000005f6e <+478>: mov QWORD PTR [rsp+0x90],0x3 0x0000000000005f7a <+490>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000005f86 <+502>: lea rdi,[rsp+0x228] 0x0000000000005f8e <+510>: lea rsi,[rsp+0x210] 0x0000000000005f96 <+518>: lea rdx,[rsp+0x88] 0x0000000000005f9e <+526>: call 0xdfa0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005fa3 <+531>: mov rdi,QWORD PTR [rsp+0x88] 0x0000000000005fab <+539>: test rdi,rdi 0x0000000000005fae <+542>: je 0x5fb5 <main+549> 0x0000000000005fb0 <+544>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005fb5 <+549>: mov rdi,QWORD PTR [rsp+0x210] 0x0000000000005fbd <+557>: test rdi,rdi 0x0000000000005fc0 <+560>: je 0x5fc7 <main+567> 0x0000000000005fc2 <+562>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005fc7 <+567>: lea rbx,[rsp+0x2d0] 0x0000000000005fcf <+575>: mov rdi,rbx 0x0000000000005fd2 <+578>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000005fda <+586>: vmovaps zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000005fe2 <+594>: vmovaps zmm2,ZMMWORD PTR [rsp+0x180] 0x0000000000005fea <+602>: vmovaps zmm3,ZMMWORD PTR [rsp+0x140] 0x0000000000005ff2 <+610>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=128> 0x0000000000005ff7 <+615>: lea rdi,[rsp+0x240] 0x0000000000005fff <+623>: lea rsi,[rsp+0x228] 0x0000000000006007 <+631>: mov rdx,rbx 0x000000000000600a <+634>: vzeroupper 0x000000000000600d <+637>: call 0xdfa0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006012 <+642>: mov rdi,QWORD PTR [rsp+0x2d0] 0x000000000000601a <+650>: test rdi,rdi 0x000000000000601d <+653>: je 0x6024 <main+660> 0x000000000000601f <+655>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006024 <+660>: mov rdi,QWORD PTR [rsp+0x228] 0x000000000000602c <+668>: test rdi,rdi 0x000000000000602f <+671>: je 0x6036 <main+678> 0x0000000000006031 <+673>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006036 <+678>: lea rdi,[rsp+0x240] 0x000000000000603e <+686>: call 0x9840 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006043 <+691>: mov rdi,QWORD PTR [rsp+0x240] 0x000000000000604b <+699>: test rdi,rdi 0x000000000000604e <+702>: je 0x6055 <main+709> 0x0000000000006050 <+704>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006055 <+709>: vxorps xmm0,xmm0,xmm0 0x0000000000006059 <+713>: vmovaps XMMWORD PTR [rsp+0x40],xmm0 0x000000000000605f <+719>: mov ebx,0x1 0x0000000000006064 <+724>: lea rsi,[rsp+0x40] 0x0000000000006069 <+729>: mov edi,0x1 0x000000000000606e <+734>: call 0x5470 <clock_gettime@plt> 0x0000000000006073 <+739>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x100] 0x000000000000607b <+747>: vpshufd zmm0,zmm11,0xb1 0x0000000000006082 <+754>: vmovdqa64 zmm8,ZMMWORD PTR [rsp+0x1c0] 0x000000000000608a <+762>: vpshufd zmm1,zmm8,0xb1 0x0000000000006091 <+769>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x140] 0x0000000000006099 <+777>: vpshufd zmm2,zmm10,0xb1 0x00000000000060a0 <+784>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x180] 0x00000000000060a8 <+792>: vpshufd zmm3,zmm9,0xb1 0x00000000000060af <+799>: vpminsw zmm4,zmm9,zmm3 0x00000000000060b5 <+805>: vpminsw zmm5,zmm10,zmm2 0x00000000000060bb <+811>: vpminsw zmm6,zmm8,zmm1 0x00000000000060c1 <+817>: vpminsw zmm7,zmm11,zmm0 0x00000000000060c7 <+823>: mov eax,0xcccccccc 0x00000000000060cc <+828>: kmovd k1,eax 0x00000000000060d0 <+832>: vpmaxsw zmm7{k1},zmm11,zmm0 0x00000000000060d6 <+838>: vpmaxsw zmm6{k1},zmm8,zmm1 0x00000000000060dc <+844>: vpmaxsw zmm5{k1},zmm10,zmm2 0x00000000000060e2 <+850>: vpmaxsw zmm4{k1},zmm9,zmm3 0x00000000000060e8 <+856>: vprold zmm0,zmm4,0x10 0x00000000000060ef <+863>: vprold zmm1,zmm5,0x10 0x00000000000060f6 <+870>: vprold zmm2,zmm6,0x10 0x00000000000060fd <+877>: vprold zmm3,zmm7,0x10 0x0000000000006104 <+884>: vpminsw zmm8,zmm7,zmm3 0x000000000000610a <+890>: vpminsw zmm9,zmm6,zmm2 0x0000000000006110 <+896>: vpminsw zmm10,zmm5,zmm1 0x0000000000006116 <+902>: vpminsw zmm11,zmm4,zmm0 0x000000000000611c <+908>: mov eax,0xaaaaaaaa 0x0000000000006121 <+913>: kmovd k2,eax 0x0000000000006125 <+917>: vpmaxsw zmm9{k2},zmm6,zmm2 0x000000000000612b <+923>: vpmaxsw zmm8{k2},zmm7,zmm3 0x0000000000006131 <+929>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57005] # 0x5d140 0x000000000000613b <+939>: vmovdqa64 zmm3,zmm9 0x0000000000006141 <+945>: vpermt2w zmm3,zmm2,zmm8 0x0000000000006147 <+951>: vpmaxsw zmm11{k2},zmm4,zmm0 0x000000000000614d <+957>: kmovd DWORD PTR [rsp+0x3c],k2 0x0000000000006154 <+964>: vpmaxsw zmm10{k2},zmm5,zmm1 0x000000000000615a <+970>: vpermi2w zmm2,zmm11,zmm10 0x0000000000006160 <+976>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57016] # 0x5d180 0x000000000000616a <+986>: vmovdqa64 zmm1,zmm10 0x0000000000006170 <+992>: vpermt2w zmm1,zmm0,zmm11 0x0000000000006176 <+998>: vpermi2w zmm0,zmm8,zmm9 0x000000000000617c <+1004>: vpmaxsw zmm4,zmm8,zmm0 0x0000000000006182 <+1010>: mov eax,0x2222bb2b 0x0000000000006187 <+1015>: kmovd k2,eax 0x000000000000618b <+1019>: vpminsw zmm4{k2},zmm8,zmm0 0x0000000000006191 <+1025>: vpmaxsw zmm0,zmm10,zmm1 0x0000000000006197 <+1031>: vpminsw zmm0{k2},zmm10,zmm1 0x000000000000619d <+1037>: vpminsw zmm1,zmm11,zmm2 0x00000000000061a3 <+1043>: mov eax,0xd4dd4444 0x00000000000061a8 <+1048>: kmovd k2,eax 0x00000000000061ac <+1052>: vpmaxsw zmm1{k2},zmm11,zmm2 0x00000000000061b2 <+1058>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57004] # 0x5d1c0 0x00000000000061bc <+1068>: vmovdqa64 zmm5,zmm1 0x00000000000061c2 <+1074>: vpermt2w zmm5,zmm2,zmm0 0x00000000000061c8 <+1080>: vpminsw zmm6,zmm9,zmm3 0x00000000000061ce <+1086>: vpmaxsw zmm6{k2},zmm9,zmm3 0x00000000000061d4 <+1092>: vpermi2w zmm2,zmm6,zmm4 0x00000000000061da <+1098>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5701c] # 0x5d200 0x00000000000061e4 <+1108>: vmovdqa64 zmm7,zmm4 0x00000000000061ea <+1114>: vpermt2w zmm7,zmm3,zmm6 0x00000000000061f0 <+1120>: vpermi2w zmm3,zmm0,zmm1 0x00000000000061f6 <+1126>: vpmaxsw zmm8,zmm0,zmm3 0x00000000000061fc <+1132>: mov eax,0x90669f 0x0000000000006201 <+1137>: kmovd k2,eax 0x0000000000006205 <+1141>: vpminsw zmm8{k2},zmm0,zmm3 0x000000000000620b <+1147>: vpmaxsw zmm0,zmm4,zmm7 0x0000000000006211 <+1153>: vpminsw zmm0{k2},zmm4,zmm7 0x0000000000006217 <+1159>: vpminsw zmm3,zmm6,zmm2 0x000000000000621d <+1165>: mov eax,0xf9660900 0x0000000000006222 <+1170>: kmovd k2,eax 0x0000000000006226 <+1174>: vpmaxsw zmm3{k2},zmm6,zmm2 0x000000000000622c <+1180>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5700a] # 0x5d240 0x0000000000006236 <+1190>: vmovdqa64 zmm4,zmm3 0x000000000000623c <+1196>: vpermt2w zmm4,zmm2,zmm0 0x0000000000006242 <+1202>: vpminsw zmm6,zmm1,zmm5 0x0000000000006248 <+1208>: vpmaxsw zmm6{k2},zmm1,zmm5 0x000000000000624e <+1214>: vpermi2w zmm2,zmm6,zmm8 0x0000000000006254 <+1220>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57022] # 0x5d280 0x000000000000625e <+1230>: vpminsw zmm5,zmm6,zmm2 0x0000000000006264 <+1236>: mov eax,0x66009600 0x0000000000006269 <+1241>: kmovd k2,eax 0x000000000000626d <+1245>: vmovdqa64 zmm7,zmm5 0x0000000000006273 <+1251>: vpmaxsw zmm7{k2},zmm6,zmm2 0x0000000000006279 <+1257>: vpermt2w zmm6,zmm1,zmm8 0x000000000000627f <+1263>: vpermi2w zmm1,zmm3,zmm0 0x0000000000006285 <+1269>: vpmaxsw zmm2,zmm0,zmm1 0x000000000000628b <+1275>: mov eax,0x690066 0x0000000000006290 <+1280>: kmovd k3,eax 0x0000000000006294 <+1284>: vpminsw zmm2{k3},zmm0,zmm1 0x000000000000629a <+1290>: vpmaxsw zmm0,zmm8,zmm6 0x00000000000062a0 <+1296>: vpminsw zmm0{k3},zmm8,zmm6 0x00000000000062a6 <+1302>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57010] # 0x5d2c0 0x00000000000062b0 <+1312>: vmovdqa64 zmm6,zmm7 0x00000000000062b6 <+1318>: vpermt2w zmm6,zmm1,zmm0 0x00000000000062bc <+1324>: vpminsw zmm8,zmm3,zmm4 0x00000000000062c2 <+1330>: vmovdqa64 zmm9,zmm8 0x00000000000062c8 <+1336>: vpmaxsw zmm9{k2},zmm3,zmm4 0x00000000000062ce <+1342>: vpermi2w zmm1,zmm9,zmm2 0x00000000000062d4 <+1348>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57022] # 0x5d300 0x00000000000062de <+1358>: vpermt2w zmm8,zmm3,zmm2 0x00000000000062e4 <+1364>: vpermt2w zmm5,zmm3,zmm0 0x00000000000062ea <+1370>: vpmaxsw zmm3,zmm2,zmm1 0x00000000000062f0 <+1376>: mov eax,0x9069090 0x00000000000062f5 <+1381>: kmovd k2,eax 0x00000000000062f9 <+1385>: vmovdqa64 zmm4,zmm3 0x00000000000062ff <+1391>: vpminsw zmm4{k2},zmm2,zmm1 0x0000000000006305 <+1397>: vpminsw zmm1,zmm7,zmm5 0x000000000000630b <+1403>: vpminsw zmm2,zmm9,zmm8 0x0000000000006311 <+1409>: mov eax,0x9096090 0x0000000000006316 <+1414>: kmovd k3,eax 0x000000000000631a <+1418>: vmovdqa64 zmm10,zmm2 0x0000000000006320 <+1424>: vpmaxsw zmm10{k3},zmm9,zmm8 0x0000000000006326 <+1430>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57010] # 0x5d340 0x0000000000006330 <+1440>: vpermi2w zmm8,zmm10,zmm4 0x0000000000006336 <+1446>: kmovd k4,ebx 0x000000000000633a <+1450>: vmovdqu16 zmm8{k4},zmm1 0x0000000000006340 <+1456>: vpmaxsw zmm9,zmm0,zmm6 0x0000000000006346 <+1462>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x57030] # 0x5d380 0x0000000000006350 <+1472>: vpermi2w zmm11,zmm4,zmm10 0x0000000000006356 <+1478>: mov eax,0x80000000 0x000000000000635b <+1483>: kmovd k4,eax 0x000000000000635f <+1487>: vpmaxsw zmm1{k3},zmm7,zmm5 0x0000000000006365 <+1493>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57051] # 0x5d3c0 0x000000000000636f <+1503>: vpermi2w zmm5,zmm1,zmm2 0x0000000000006375 <+1509>: vmovdqu16 zmm11{k4},zmm9 0x000000000000637b <+1515>: vpminsw zmm9{k2},zmm0,zmm6 0x0000000000006381 <+1521>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57075] # 0x5d400 0x000000000000638b <+1531>: vpermi2w zmm0,zmm5,zmm9 0x0000000000006391 <+1537>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x570a5] # 0x5d440 0x000000000000639b <+1547>: vpermi2w zmm2,zmm1,zmm3 0x00000000000063a1 <+1553>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x570d5] # 0x5d480 0x00000000000063ab <+1563>: vpermi2w zmm3,zmm9,zmm2 0x00000000000063b1 <+1569>: vpmaxsw zmm2,zmm9,zmm3 0x00000000000063b7 <+1575>: mov eax,0x6096960 0x00000000000063bc <+1580>: kmovd k2,eax 0x00000000000063c0 <+1584>: vpminsw zmm2{k2},zmm9,zmm3 0x00000000000063c6 <+1590>: vpmaxsw zmm3,zmm4,zmm11 0x00000000000063cc <+1596>: mov eax,0x86096960 0x00000000000063d1 <+1601>: kmovd k2,eax 0x00000000000063d5 <+1605>: vpminsw zmm3{k2},zmm4,zmm11 0x00000000000063db <+1611>: vpminsw zmm4,zmm1,zmm0 0x00000000000063e1 <+1617>: vpminsw zmm5,zmm10,zmm8 0x00000000000063e7 <+1623>: mov eax,0x6969069 0x00000000000063ec <+1628>: kmovd k2,eax 0x00000000000063f0 <+1632>: vpmaxsw zmm4{k2},zmm1,zmm0 0x00000000000063f6 <+1638>: mov eax,0x6969068 0x00000000000063fb <+1643>: kmovd k2,eax 0x00000000000063ff <+1647>: vpmaxsw zmm5{k2},zmm10,zmm8 0x0000000000006405 <+1653>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570b1] # 0x5d4c0 0x000000000000640f <+1663>: vmovdqa64 zmm1,zmm4 0x0000000000006415 <+1669>: vpermt2w zmm1,zmm0,zmm2 0x000000000000641b <+1675>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x570db] # 0x5d500 0x0000000000006425 <+1685>: vmovdqa64 zmm7,zmm2 0x000000000000642b <+1691>: vpermt2w zmm7,zmm6,zmm4 0x0000000000006431 <+1697>: vpermi2w zmm0,zmm5,zmm3 0x0000000000006437 <+1703>: vpermi2w zmm6,zmm3,zmm5 0x000000000000643d <+1709>: vpmaxsw zmm8,zmm2,zmm7 0x0000000000006443 <+1715>: vpmaxsw zmm9,zmm3,zmm6 0x0000000000006449 <+1721>: vpminsw zmm10,zmm4,zmm1 0x000000000000644f <+1727>: vpminsw zmm11,zmm5,zmm0 0x0000000000006455 <+1733>: mov eax,0xf0690f 0x000000000000645a <+1738>: kmovd k2,eax 0x000000000000645e <+1742>: vpmaxsw zmm10{k2},zmm4,zmm1 0x0000000000006464 <+1748>: vpmaxsw zmm11{k2},zmm5,zmm0 0x000000000000646a <+1754>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5710c] # 0x5d580 0x0000000000006474 <+1764>: vmovdqa64 zmm1,zmm10 0x000000000000647a <+1770>: vpermt2w zmm1,zmm0,zmm8 0x0000000000006480 <+1776>: vpermi2w zmm0,zmm11,zmm9 0x0000000000006486 <+1782>: mov eax,0x960f00 0x000000000000648b <+1787>: kmovd k2,eax 0x000000000000648f <+1791>: vpminsw zmm8{k2},zmm2,zmm7 0x0000000000006495 <+1797>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x570a1] # 0x5d540 0x000000000000649f <+1807>: vmovdqa64 zmm4,zmm8 0x00000000000064a5 <+1813>: vpermt2w zmm4,zmm2,zmm10 0x00000000000064ab <+1819>: vpminsw zmm9{k2},zmm3,zmm6 0x00000000000064b1 <+1825>: vpermi2w zmm2,zmm9,zmm11 0x00000000000064b7 <+1831>: vpmaxsw zmm3,zmm8,zmm4 0x00000000000064bd <+1837>: mov eax,0x690f09 0x00000000000064c2 <+1842>: kmovd k2,eax 0x00000000000064c6 <+1846>: vpminsw zmm3{k2},zmm8,zmm4 0x00000000000064cc <+1852>: vpmaxsw zmm4,zmm9,zmm2 0x00000000000064d2 <+1858>: vpminsw zmm4{k2},zmm9,zmm2 0x00000000000064d8 <+1864>: vpmaxsw zmm2,zmm10,zmm1 0x00000000000064de <+1870>: mov eax,0x6f0f6960 0x00000000000064e3 <+1875>: kmovd k2,eax 0x00000000000064e7 <+1879>: vpminsw zmm2{k2},zmm10,zmm1 0x00000000000064ed <+1885>: vpmaxsw zmm1,zmm11,zmm0 0x00000000000064f3 <+1891>: vpminsw zmm1{k2},zmm11,zmm0 0x00000000000064f9 <+1897>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570bd] # 0x5d5c0 0x0000000000006503 <+1907>: vpermw zmm5,zmm0,zmm3 0x0000000000006509 <+1913>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x570ed] # 0x5d600 0x0000000000006513 <+1923>: vpermw zmm7,zmm6,zmm2 0x0000000000006519 <+1929>: vpermw zmm0,zmm0,zmm4 0x000000000000651f <+1935>: vpermw zmm6,zmm6,zmm1 0x0000000000006525 <+1941>: vpminsw zmm8,zmm3,zmm5 0x000000000000652b <+1947>: vpmaxsw zmm3,zmm3,zmm5 0x0000000000006531 <+1953>: mov eax,0x6069f 0x0000000000006536 <+1958>: kmovd k2,eax 0x000000000000653a <+1962>: vmovdqu16 zmm3{k2},zmm8 0x0000000000006540 <+1968>: vpminsw zmm5,zmm4,zmm0 0x0000000000006546 <+1974>: vpmaxsw zmm0,zmm4,zmm0 0x000000000000654c <+1980>: vmovdqu16 zmm0{k2},zmm5 0x0000000000006552 <+1986>: vpmaxsw zmm4,zmm2,zmm7 0x0000000000006558 <+1992>: mov eax,0x69f0600 0x000000000000655d <+1997>: kmovd k2,eax 0x0000000000006561 <+2001>: vpminsw zmm4{k2},zmm2,zmm7 0x0000000000006567 <+2007>: vpmaxsw zmm2,zmm1,zmm6 0x000000000000656d <+2013>: vpminsw zmm2{k2},zmm1,zmm6 0x0000000000006573 <+2019>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570c3] # 0x5d640 0x000000000000657d <+2029>: vmovdqa64 zmm6,zmm3 0x0000000000006583 <+2035>: vpermt2w zmm6,zmm1,zmm4 0x0000000000006589 <+2041>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x570ed] # 0x5d680 0x0000000000006593 <+2051>: vmovdqa64 zmm9,zmm4 0x0000000000006599 <+2057>: vpermt2w zmm9,zmm7,zmm8 0x000000000000659f <+2063>: vpermi2w zmm1,zmm0,zmm2 0x00000000000065a5 <+2069>: vpermi2w zmm7,zmm2,zmm5 0x00000000000065ab <+2075>: vpmaxsw zmm5,zmm3,zmm6 0x00000000000065b1 <+2081>: mov eax,0x90f6 0x00000000000065b6 <+2086>: kmovd k2,eax 0x00000000000065ba <+2090>: vpminsw zmm5{k2},zmm3,zmm6 0x00000000000065c0 <+2096>: vpmaxsw zmm3,zmm0,zmm1 0x00000000000065c6 <+2102>: vpminsw zmm3{k2},zmm0,zmm1 0x00000000000065cc <+2108>: vpmaxsw zmm0,zmm4,zmm9 0x00000000000065d2 <+2114>: mov eax,0x90f69000 0x00000000000065d7 <+2119>: kmovd k2,eax 0x00000000000065db <+2123>: vpminsw zmm0{k2},zmm4,zmm9 0x00000000000065e1 <+2129>: vpmaxsw zmm1,zmm2,zmm7 0x00000000000065e7 <+2135>: vpminsw zmm1{k2},zmm2,zmm7 0x00000000000065ed <+2141>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x570c9] # 0x5d6c0 0x00000000000065f7 <+2151>: vmovdqa64 zmm6,zmm5 0x00000000000065fd <+2157>: vpermt2w zmm6,zmm4,zmm0 0x0000000000006603 <+2163>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x570f3] # 0x5d700 0x000000000000660d <+2173>: vmovdqa64 zmm2,zmm0 0x0000000000006613 <+2179>: vpermt2w zmm2,zmm7,zmm5 0x0000000000006619 <+2185>: vpermi2w zmm4,zmm3,zmm1 0x000000000000661f <+2191>: vpermi2w zmm7,zmm1,zmm3 0x0000000000006625 <+2197>: vpmaxsw zmm8,zmm0,zmm2 0x000000000000662b <+2203>: mov eax,0xe8e06666 0x0000000000006630 <+2208>: kmovd k2,eax 0x0000000000006634 <+2212>: vpminsw zmm8{k2},zmm0,zmm2 0x000000000000663a <+2218>: vpmaxsw zmm2,zmm5,zmm6 0x0000000000006640 <+2224>: mov eax,0xe8e0 0x0000000000006645 <+2229>: kmovd k3,eax 0x0000000000006649 <+2233>: vpminsw zmm2{k3},zmm5,zmm6 0x000000000000664f <+2239>: vpmaxsw zmm5,zmm1,zmm7 0x0000000000006655 <+2245>: vpminsw zmm5{k2},zmm1,zmm7 0x000000000000665b <+2251>: vpmaxsw zmm6,zmm3,zmm4 0x0000000000006661 <+2257>: vpminsw zmm6{k3},zmm3,zmm4 0x0000000000006667 <+2263>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x570cf] # 0x5d740 0x0000000000006671 <+2273>: vmovdqa64 zmm7,zmm2 0x0000000000006677 <+2279>: vpermt2w zmm7,zmm3,zmm8 0x000000000000667d <+2285>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570f9] # 0x5d780 0x0000000000006687 <+2295>: vmovdqa64 zmm9,zmm8 0x000000000000668d <+2301>: vpermt2w zmm9,zmm1,zmm2 0x0000000000006693 <+2307>: vpermi2w zmm3,zmm6,zmm5 0x0000000000006699 <+2313>: mov rbx,QWORD PTR [rsp+0x40] 0x000000000000669e <+2318>: vpermi2w zmm1,zmm5,zmm6 0x00000000000066a4 <+2324>: vpminsw zmm10,zmm5,zmm1 0x00000000000066aa <+2330>: mov eax,0xb3931331 0x00000000000066af <+2335>: kmovd k3,eax 0x00000000000066b3 <+2339>: vmovdqa64 zmm0,zmm10 0x00000000000066b9 <+2345>: vpmaxsw zmm0{k3},zmm5,zmm1 0x00000000000066bf <+2351>: vpmaxsw zmm5,zmm6,zmm3 0x00000000000066c5 <+2357>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570f1] # 0x5d7c0 0x00000000000066cf <+2367>: vpermi2w zmm1,zmm0,zmm5 0x00000000000066d5 <+2373>: vpminsw zmm4,zmm8,zmm9 0x00000000000066db <+2379>: mov eax,0x2 0x00000000000066e0 <+2384>: kmovd k2,eax 0x00000000000066e4 <+2388>: vmovdqu16 zmm1{k2},zmm4 0x00000000000066ea <+2394>: mov eax,0x8880088 0x00000000000066ef <+2399>: kmovd k2,eax 0x00000000000066f3 <+2403>: vpmaxsw zmm4{k3},zmm8,zmm9 0x00000000000066f9 <+2409>: vbroadcasti64x4 zmm8,YMMWORD PTR [rip+0x569dd] # 0x5d0e0 0x0000000000006703 <+2419>: vpermi2d zmm8,zmm4,zmm5 0x0000000000006709 <+2425>: vpminsw zmm5{k2},zmm6,zmm3 0x000000000000670f <+2431>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x570e7] # 0x5d800 0x0000000000006719 <+2441>: vpermi2w zmm6,zmm5,zmm0 0x000000000000671f <+2447>: mov rax,QWORD PTR [rsp+0x48] 0x0000000000006724 <+2452>: mov QWORD PTR [rsp+0x60],rax 0x0000000000006729 <+2457>: vpmaxsw zmm3,zmm2,zmm7 0x000000000000672f <+2463>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x57147] # 0x5d880 0x0000000000006739 <+2473>: vpermi2w zmm9,zmm4,zmm10 0x000000000000673f <+2479>: mov eax,0x40000000 0x0000000000006744 <+2484>: kmovd k3,eax 0x0000000000006748 <+2488>: vmovdqu16 zmm6{k3},zmm3 0x000000000000674e <+2494>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x57168] # 0x5d8c0 0x0000000000006758 <+2504>: vpermi2w zmm10,zmm9,zmm3 0x000000000000675e <+2510>: vpminsw zmm3{k2},zmm2,zmm7 0x0000000000006764 <+2516>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x570d2] # 0x5d840 0x000000000000676e <+2526>: vpermi2w zmm2,zmm3,zmm8 0x0000000000006774 <+2532>: vpminsw zmm7,zmm4,zmm10 0x000000000000677a <+2538>: vpmaxsw zmm8,zmm5,zmm6 0x0000000000006780 <+2544>: mov eax,0x4a00ca4c 0x0000000000006785 <+2549>: kmovd k2,eax 0x0000000000006789 <+2553>: vpmaxsw zmm4,zmm4,zmm10 0x000000000000678f <+2559>: mov eax,0xc48cd9ac 0x0000000000006794 <+2564>: kmovd k3,eax 0x0000000000006798 <+2568>: vmovdqu16 zmm4{k3},zmm7 0x000000000000679e <+2574>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x571d8] # 0x5d980 0x00000000000067a8 <+2584>: vpermi2w zmm9,zmm4,zmm8 0x00000000000067ae <+2590>: vpminsw zmm8{k2},zmm5,zmm6 0x00000000000067b4 <+2596>: vpminsw zmm5,zmm0,zmm1 0x00000000000067ba <+2602>: mov eax,0x3b732651 0x00000000000067bf <+2607>: kmovd k2,eax 0x00000000000067c3 <+2611>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57233] # 0x5da00 0x00000000000067cd <+2621>: vpermi2w zmm6,zmm4,zmm5 0x00000000000067d3 <+2627>: vpmaxsw zmm5{k2},zmm0,zmm1 0x00000000000067d9 <+2633>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5711d] # 0x5d900 0x00000000000067e3 <+2643>: vpermi2w zmm0,zmm5,zmm8 0x00000000000067e9 <+2649>: mov eax,0x4 0x00000000000067ee <+2654>: kmovd k2,eax 0x00000000000067f2 <+2658>: vmovdqu16 zmm0{k2},zmm7 0x00000000000067f8 <+2664>: vpmaxsw zmm1,zmm3,zmm2 0x00000000000067fe <+2670>: mov eax,0xa00ca4c 0x0000000000006803 <+2675>: kmovd k2,eax 0x0000000000006807 <+2679>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5712f] # 0x5d940 0x0000000000006811 <+2689>: vpermi2w zmm7,zmm8,zmm5 0x0000000000006817 <+2695>: mov eax,0x20000000 0x000000000000681c <+2700>: kmovd k3,eax 0x0000000000006820 <+2704>: vmovdqu16 zmm7{k3},zmm1 0x0000000000006826 <+2710>: vpminsw zmm1{k2},zmm3,zmm2 0x000000000000682c <+2716>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5718a] # 0x5d9c0 0x0000000000006836 <+2726>: vpermi2w zmm2,zmm1,zmm9 0x000000000000683c <+2732>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x571fa] # 0x5da40 0x0000000000006846 <+2742>: vpermi2w zmm3,zmm6,zmm1 0x000000000000684c <+2748>: vpmaxsw zmm6,zmm4,zmm3 0x0000000000006852 <+2754>: mov eax,0x88ca8888 0x0000000000006857 <+2759>: kmovd k2,eax 0x000000000000685b <+2763>: vpminsw zmm6{k2},zmm4,zmm3 0x0000000000006861 <+2769>: vpmaxsw zmm3,zmm1,zmm2 0x0000000000006867 <+2775>: mov eax,0x2466 0x000000000000686c <+2780>: kmovd k2,eax 0x0000000000006870 <+2784>: vpminsw zmm3{k2},zmm1,zmm2 0x0000000000006876 <+2790>: vpmaxsw zmm1,zmm5,zmm0 0x000000000000687c <+2796>: mov eax,0x88ca888c 0x0000000000006881 <+2801>: kmovd k2,eax 0x0000000000006885 <+2805>: vpminsw zmm1{k2},zmm5,zmm0 0x000000000000688b <+2811>: vpmaxsw zmm0,zmm8,zmm7 0x0000000000006891 <+2817>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x571e5] # 0x5da80 0x000000000000689b <+2827>: vmovdqa64 zmm4,zmm3 0x00000000000068a1 <+2833>: vpermt2w zmm4,zmm2,zmm6 0x00000000000068a7 <+2839>: mov eax,0x20002466 0x00000000000068ac <+2844>: kmovd k2,eax 0x00000000000068b0 <+2848>: vpminsw zmm0{k2},zmm8,zmm7 0x00000000000068b6 <+2854>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57200] # 0x5dac0 0x00000000000068c0 <+2864>: vmovdqa64 zmm7,zmm6 0x00000000000068c6 <+2870>: vpermt2w zmm7,zmm5,zmm3 0x00000000000068cc <+2876>: vpermi2w zmm2,zmm0,zmm1 0x00000000000068d2 <+2882>: vpermi2w zmm5,zmm1,zmm0 0x00000000000068d8 <+2888>: vpmaxsw zmm8,zmm6,zmm7 0x00000000000068de <+2894>: mov eax,0xeeca8888 0x00000000000068e3 <+2899>: kmovd k3,eax 0x00000000000068e7 <+2903>: vpminsw zmm8{k3},zmm6,zmm7 0x00000000000068ed <+2909>: vpmaxsw zmm6,zmm3,zmm4 0x00000000000068f3 <+2915>: mov eax,0xac88 0x00000000000068f8 <+2920>: kmovd k2,eax 0x00000000000068fc <+2924>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5723a] # 0x5db40 0x0000000000006906 <+2934>: vmovdqa64 zmm9,zmm8 0x000000000000690c <+2940>: vpermt2w zmm9,zmm7,zmm6 0x0000000000006912 <+2946>: vpminsw zmm6{k2},zmm3,zmm4 0x0000000000006918 <+2952>: vpmaxsw zmm3,zmm1,zmm5 0x000000000000691e <+2958>: vpminsw zmm3{k3},zmm1,zmm5 0x0000000000006924 <+2964>: vpmaxsw zmm1,zmm0,zmm2 0x000000000000692a <+2970>: vpermi2w zmm7,zmm3,zmm1 0x0000000000006930 <+2976>: vpminsw zmm1{k2},zmm0,zmm2 0x0000000000006936 <+2982>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x571c0] # 0x5db00 0x0000000000006940 <+2992>: vmovdqa64 zmm2,zmm6 0x0000000000006946 <+2998>: vpermt2w zmm2,zmm0,zmm8 0x000000000000694c <+3004>: vpermi2w zmm0,zmm1,zmm3 0x0000000000006952 <+3010>: vpmaxsw zmm4,zmm6,zmm2 0x0000000000006958 <+3016>: mov eax,0x44caaa 0x000000000000695d <+3021>: kmovd k2,eax 0x0000000000006961 <+3025>: vpminsw zmm4{k2},zmm6,zmm2 0x0000000000006967 <+3031>: vpmaxsw zmm2,zmm1,zmm0 0x000000000000696d <+3037>: vpminsw zmm2{k2},zmm1,zmm0 0x0000000000006973 <+3043>: vpmaxsw zmm0,zmm8,zmm9 0x0000000000006979 <+3049>: mov eax,0xaaaccc88 0x000000000000697e <+3054>: kmovd k2,eax 0x0000000000006982 <+3058>: vpminsw zmm0{k2},zmm8,zmm9 0x0000000000006988 <+3064>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x571ee] # 0x5db80 0x0000000000006992 <+3074>: vmovdqa64 zmm5,zmm4 0x0000000000006998 <+3080>: vpermt2w zmm5,zmm1,zmm0 0x000000000000699e <+3086>: vpmaxsw zmm6,zmm3,zmm7 0x00000000000069a4 <+3092>: vpminsw zmm6{k2},zmm3,zmm7 0x00000000000069aa <+3098>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5720c] # 0x5dbc0 0x00000000000069b4 <+3108>: vmovdqa64 zmm7,zmm0 0x00000000000069ba <+3114>: vpermt2w zmm7,zmm3,zmm4 0x00000000000069c0 <+3120>: vpermi2w zmm1,zmm2,zmm6 0x00000000000069c6 <+3126>: vpermi2w zmm3,zmm6,zmm2 0x00000000000069cc <+3132>: vpmaxsw zmm8,zmm0,zmm7 0x00000000000069d2 <+3138>: mov eax,0xcaacaa88 0x00000000000069d7 <+3143>: kmovd k2,eax 0x00000000000069db <+3147>: vpminsw zmm8{k2},zmm0,zmm7 0x00000000000069e1 <+3153>: vpmaxsw zmm0,zmm4,zmm5 0x00000000000069e7 <+3159>: mov eax,0xaacaac 0x00000000000069ec <+3164>: kmovd k3,eax 0x00000000000069f0 <+3168>: vpminsw zmm0{k3},zmm4,zmm5 0x00000000000069f6 <+3174>: vpmaxsw zmm4,zmm6,zmm3 0x00000000000069fc <+3180>: vpminsw zmm4{k2},zmm6,zmm3 0x0000000000006a02 <+3186>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x571f4] # 0x5dc00 0x0000000000006a0c <+3196>: vmovdqa64 zmm5,zmm0 0x0000000000006a12 <+3202>: vpermt2w zmm5,zmm3,zmm8 0x0000000000006a18 <+3208>: vpmaxsw zmm6,zmm2,zmm1 0x0000000000006a1e <+3214>: vpminsw zmm6{k3},zmm2,zmm1 0x0000000000006a24 <+3220>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57212] # 0x5dc40 0x0000000000006a2e <+3230>: vmovdqa64 zmm2,zmm8 0x0000000000006a34 <+3236>: vpermt2w zmm2,zmm1,zmm0 0x0000000000006a3a <+3242>: vpermi2w zmm3,zmm6,zmm4 0x0000000000006a40 <+3248>: vpermi2w zmm1,zmm4,zmm6 0x0000000000006a46 <+3254>: vpmaxsw zmm7,zmm8,zmm2 0x0000000000006a4c <+3260>: mov eax,0xaccaccc8 0x0000000000006a51 <+3265>: kmovd k3,eax 0x0000000000006a55 <+3269>: vpminsw zmm7{k3},zmm8,zmm2 0x0000000000006a5b <+3275>: vpmaxsw zmm2,zmm0,zmm5 0x0000000000006a61 <+3281>: mov eax,0x4ccacca 0x0000000000006a66 <+3286>: kmovd k2,eax 0x0000000000006a6a <+3290>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x5724c] # 0x5dcc0 0x0000000000006a74 <+3300>: vmovdqa64 zmm9,zmm7 0x0000000000006a7a <+3306>: vpermt2w zmm9,zmm8,zmm2 0x0000000000006a80 <+3312>: vpminsw zmm2{k2},zmm0,zmm5 0x0000000000006a86 <+3318>: vpmaxsw zmm0,zmm4,zmm1 0x0000000000006a8c <+3324>: vpminsw zmm0{k3},zmm4,zmm1 0x0000000000006a92 <+3330>: vpmaxsw zmm1,zmm6,zmm3 0x0000000000006a98 <+3336>: vpermi2w zmm8,zmm0,zmm1 0x0000000000006a9e <+3342>: vpminsw zmm1{k2},zmm6,zmm3 0x0000000000006aa4 <+3348>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x571d2] # 0x5dc80 0x0000000000006aae <+3358>: vmovdqa64 zmm4,zmm2 0x0000000000006ab4 <+3364>: vpermt2w zmm4,zmm3,zmm7 0x0000000000006aba <+3370>: vpermi2w zmm3,zmm1,zmm0 0x0000000000006ac0 <+3376>: vpmaxsw zmm5,zmm2,zmm4 0x0000000000006ac6 <+3382>: mov eax,0xaaaaaaa 0x0000000000006acb <+3387>: kmovd k3,eax 0x0000000000006acf <+3391>: vpminsw zmm5{k3},zmm2,zmm4 0x0000000000006ad5 <+3397>: vpmaxsw zmm2,zmm1,zmm3 0x0000000000006adb <+3403>: vpmaxsw zmm4,zmm7,zmm9 0x0000000000006ae1 <+3409>: mov eax,0xaaaaaaa8 0x0000000000006ae6 <+3414>: kmovd k4,eax 0x0000000000006aea <+3418>: vpminsw zmm4{k4},zmm7,zmm9 0x0000000000006af0 <+3424>: vpmaxsw zmm6,zmm0,zmm8 0x0000000000006af6 <+3430>: mov eax,0xe0000000 0x0000000000006afb <+3435>: kmovd k2,eax 0x0000000000006aff <+3439>: vpblendmw zmm7{k2},zmm5,zmm2 0x0000000000006b05 <+3445>: vpminsw zmm2{k3},zmm1,zmm3 0x0000000000006b0b <+3451>: mov eax,0x7 0x0000000000006b10 <+3456>: kmovd k3,eax 0x0000000000006b14 <+3460>: vpblendmw zmm1{k3},zmm4,zmm6 0x0000000000006b1a <+3466>: vpminsw zmm6{k4},zmm0,zmm8 0x0000000000006b20 <+3472>: vpblendmw zmm0{k2},zmm2,zmm5 0x0000000000006b26 <+3478>: vpblendmw zmm3{k3},zmm6,zmm4 0x0000000000006b2c <+3484>: vpminsw zmm8,zmm2,zmm7 0x0000000000006b32 <+3490>: vpminsw zmm9,zmm6,zmm1 0x0000000000006b38 <+3496>: vpmaxsw zmm0,zmm5,zmm0 0x0000000000006b3e <+3502>: vpmaxsw zmm8{k2},zmm2,zmm7 0x0000000000006b44 <+3508>: vpmaxsw zmm9{k3},zmm6,zmm1 0x0000000000006b4a <+3514>: vpmaxsw zmm1,zmm4,zmm3 0x0000000000006b50 <+3520>: vpminsw zmm2,zmm8,zmm1 0x0000000000006b56 <+3526>: vpmaxsw zmm1,zmm1,zmm8 0x0000000000006b5c <+3532>: vshufi64x2 zmm3,zmm1,zmm0,0xee 0x0000000000006b63 <+3539>: vshufi64x2 zmm4,zmm2,zmm0,0x4e 0x0000000000006b6a <+3546>: vshufi64x2 zmm5,zmm9,zmm1,0x4e 0x0000000000006b71 <+3553>: vinserti64x4 zmm6,zmm9,ymm2,0x1 0x0000000000006b78 <+3560>: vpmaxsw zmm7,zmm1,zmm4 0x0000000000006b7e <+3566>: mov eax,0xffff0000 0x0000000000006b83 <+3571>: kmovd k2,eax 0x0000000000006b87 <+3575>: vmovdqa64 zmm8,zmm7 0x0000000000006b8d <+3581>: vpminsw zmm8{k2},zmm1,zmm4 0x0000000000006b93 <+3587>: vpmaxsw zmm1,zmm9,zmm6 0x0000000000006b99 <+3593>: vpminsw zmm1{k2},zmm9,zmm6 0x0000000000006b9f <+3599>: vpminsw zmm4,zmm2,zmm5 0x0000000000006ba5 <+3605>: vpmaxsw zmm0,zmm0,zmm3 0x0000000000006bab <+3611>: vpmaxsw zmm2,zmm2,zmm5 0x0000000000006bb1 <+3617>: vshufi64x2 zmm3,zmm2,zmm4,0xe4 0x0000000000006bb8 <+3624>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x5713e] # 0x5dd00 0x0000000000006bc2 <+3634>: vpermi2q zmm5,zmm1,zmm2 0x0000000000006bc8 <+3640>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5716e] # 0x5dd40 0x0000000000006bd2 <+3650>: vmovdqa64 zmm6,zmm8 0x0000000000006bd8 <+3656>: vpermt2q zmm6,zmm2,zmm4 0x0000000000006bde <+3662>: vinserti32x4 zmm4,zmm6,xmm0,0x3 0x0000000000006be5 <+3669>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57191] # 0x5dd80 0x0000000000006bef <+3679>: vpermi2q zmm6,zmm0,zmm8 0x0000000000006bf5 <+3685>: vpermi2q zmm2,zmm3,zmm1 0x0000000000006bfb <+3691>: vinserti32x4 zmm2,zmm2,xmm7,0x3 0x0000000000006c02 <+3698>: vpminsw zmm7,zmm3,zmm2 0x0000000000006c08 <+3704>: vpmaxsw zmm2,zmm3,zmm2 0x0000000000006c0e <+3710>: mov al,0xcc 0x0000000000006c10 <+3712>: kmovd k2,eax 0x0000000000006c14 <+3716>: vpblendmq zmm3{k2},zmm2,zmm7 0x0000000000006c1a <+3722>: vpmaxsw zmm9,zmm0,zmm6 0x0000000000006c20 <+3728>: mov eax,0xff00 0x0000000000006c25 <+3733>: kmovd k2,eax 0x0000000000006c29 <+3737>: vpmaxsw zmm10,zmm8,zmm4 0x0000000000006c2f <+3743>: mov eax,0xff00ff00 0x0000000000006c34 <+3748>: kmovd k3,eax 0x0000000000006c38 <+3752>: vmovdqa64 zmm11,zmm10 0x0000000000006c3e <+3758>: vpminsw zmm11{k3},zmm8,zmm4 0x0000000000006c44 <+3764>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x571b2] # 0x5de00 0x0000000000006c4e <+3774>: vmovdqa64 zmm8,zmm11 0x0000000000006c54 <+3780>: vpermt2q zmm8,zmm4,zmm7 0x0000000000006c5a <+3786>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x571dc] # 0x5de40 0x0000000000006c64 <+3796>: vpermt2q zmm8,zmm7,zmm9 0x0000000000006c6a <+3802>: vpminsw zmm9{k2},zmm0,zmm6 0x0000000000006c70 <+3808>: vpmaxsw zmm0,zmm1,zmm5 0x0000000000006c76 <+3814>: vpminsw zmm0{k3},zmm1,zmm5 0x0000000000006c7c <+3820>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5713a] # 0x5ddc0 0x0000000000006c86 <+3830>: vpermi2q zmm1,zmm0,zmm2 0x0000000000006c8c <+3836>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x571ea] # 0x5de80 0x0000000000006c96 <+3846>: vpermi2q zmm2,zmm9,zmm11 0x0000000000006c9c <+3852>: vpermi2q zmm4,zmm3,zmm0 0x0000000000006ca2 <+3858>: vpermt2q zmm4,zmm7,zmm10 0x0000000000006ca8 <+3864>: vpminsw zmm5,zmm3,zmm4 0x0000000000006cae <+3870>: vpmaxsw zmm3,zmm3,zmm4 0x0000000000006cb4 <+3876>: mov al,0xaa 0x0000000000006cb6 <+3878>: kmovd k2,eax 0x0000000000006cba <+3882>: vpblendmq zmm4{k2},zmm3,zmm5 0x0000000000006cc0 <+3888>: vpmaxsw zmm6,zmm9,zmm2 0x0000000000006cc6 <+3894>: mov eax,0xf0f0f0 0x0000000000006ccb <+3899>: kmovd k2,eax 0x0000000000006ccf <+3903>: vpmaxsw zmm7,zmm11,zmm8 0x0000000000006cd5 <+3909>: mov eax,0xf0f0f0f0 0x0000000000006cda <+3914>: kmovd k3,eax 0x0000000000006cde <+3918>: vmovdqa64 zmm10,zmm7 0x0000000000006ce4 <+3924>: vpminsw zmm10{k3},zmm11,zmm8 0x0000000000006cea <+3930>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x5720c] # 0x5df00 0x0000000000006cf4 <+3940>: vmovdqa64 zmm11,zmm10 0x0000000000006cfa <+3946>: vpermt2d zmm11,zmm8,zmm5 0x0000000000006d00 <+3952>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57236] # 0x5df40 0x0000000000006d0a <+3962>: vpermt2d zmm11,zmm5,zmm6 0x0000000000006d10 <+3968>: vpminsw zmm6{k2},zmm9,zmm2 0x0000000000006d16 <+3974>: vpmaxsw zmm2,zmm0,zmm1 0x0000000000006d1c <+3980>: vpminsw zmm2{k3},zmm0,zmm1 0x0000000000006d22 <+3986>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57194] # 0x5dec0 0x0000000000006d2c <+3996>: vpermi2d zmm0,zmm2,zmm3 0x0000000000006d32 <+4002>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57244] # 0x5df80 0x0000000000006d3c <+4012>: vpermi2d zmm1,zmm6,zmm10 0x0000000000006d42 <+4018>: vpermi2d zmm8,zmm4,zmm2 0x0000000000006d48 <+4024>: vpermt2d zmm8,zmm5,zmm7 0x0000000000006d4e <+4030>: vpminsw zmm3,zmm4,zmm8 0x0000000000006d54 <+4036>: vpmaxsw zmm4,zmm4,zmm8 0x0000000000006d5a <+4042>: mov ax,0xaaaa 0x0000000000006d5e <+4046>: kmovd k2,eax 0x0000000000006d62 <+4050>: vpblendmd zmm5{k2},zmm4,zmm3 0x0000000000006d68 <+4056>: vpmaxsw zmm7,zmm6,zmm1 0x0000000000006d6e <+4062>: mov eax,0xccccccc 0x0000000000006d73 <+4067>: kmovd k2,eax 0x0000000000006d77 <+4071>: vpmaxsw zmm8,zmm2,zmm0 0x0000000000006d7d <+4077>: vpminsw zmm8{k1},zmm2,zmm0 0x0000000000006d83 <+4083>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x57233] # 0x5dfc0 0x0000000000006d8d <+4093>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm5 0x0000000000006d95 <+4101>: vpermt2w zmm5,zmm9,zmm8 0x0000000000006d9b <+4107>: vpmaxsw zmm0,zmm10,zmm11 0x0000000000006da1 <+4113>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57255] # 0x5e000 0x0000000000006dab <+4123>: vpermt2w zmm5,zmm2,zmm0 0x0000000000006db1 <+4129>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm5 0x0000000000006db9 <+4137>: vpminsw zmm0{k1},zmm10,zmm11 0x0000000000006dbf <+4143>: vpermi2w zmm9,zmm0,zmm3 0x0000000000006dc5 <+4149>: vpermt2w zmm9,zmm2,zmm7 0x0000000000006dcb <+4155>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm9 0x0000000000006dd3 <+4163>: vpminsw zmm7{k2},zmm6,zmm1 0x0000000000006dd9 <+4169>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5725d] # 0x5e040 0x0000000000006de3 <+4179>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm8 0x0000000000006deb <+4187>: vpermi2w zmm1,zmm8,zmm4 0x0000000000006df1 <+4193>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm1 0x0000000000006df9 <+4201>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5727d] # 0x5e080 0x0000000000006e03 <+4211>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm7 0x0000000000006e0b <+4219>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm0 0x0000000000006e13 <+4227>: vpermi2w zmm1,zmm7,zmm0 0x0000000000006e19 <+4233>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm1 0x0000000000006e21 <+4241>: vpxor xmm0,xmm0,xmm0 0x0000000000006e25 <+4245>: vmovdqa XMMWORD PTR [rsp+0x50],xmm0 0x0000000000006e2b <+4251>: lea rsi,[rsp+0x50] 0x0000000000006e30 <+4256>: mov edi,0x1 0x0000000000006e35 <+4261>: vzeroupper 0x0000000000006e38 <+4264>: call 0x5470 <clock_gettime@plt> 0x0000000000006e3d <+4269>: mov r12,QWORD PTR [rsp+0x50] 0x0000000000006e42 <+4274>: sub r12,rbx 0x0000000000006e45 <+4277>: mov rbx,QWORD PTR [rsp+0x58] 0x0000000000006e4a <+4282>: mov edi,0x80 0x0000000000006e4f <+4287>: call 0x8d90 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006e54 <+4292>: mov r14,rax 0x0000000000006e57 <+4295>: test rax,rax 0x0000000000006e5a <+4298>: jle 0x6e71 <main+4321> 0x0000000000006e5c <+4300>: mov edi,0x1 0x0000000000006e61 <+4305>: mov rsi,r14 0x0000000000006e64 <+4308>: call 0x2e2e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006e69 <+4313>: mov r15,rax 0x0000000000006e6c <+4316>: mov r13,r14 0x0000000000006e6f <+4319>: jmp 0x6e77 <main+4327> 0x0000000000006e71 <+4321>: xor r15d,r15d 0x0000000000006e74 <+4324>: xor r13d,r13d 0x0000000000006e77 <+4327>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x300] 0x0000000000006e7f <+4335>: vpmaxsw zmm0,zmm0,ZMMWORD PTR [rsp+0x480] 0x0000000000006e87 <+4343>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000006e8f <+4351>: mov eax,0x2aaaaaaa 0x0000000000006e94 <+4356>: kmovd k1,eax 0x0000000000006e98 <+4360>: kmovd DWORD PTR [rsp+0x38],k1 0x0000000000006e9f <+4367>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x340] 0x0000000000006ea7 <+4375>: vpmaxsw zmm0,zmm0,ZMMWORD PTR [rsp+0x440] 0x0000000000006eaf <+4383>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x0000000000006eb7 <+4391>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x380] 0x0000000000006ebf <+4399>: vpmaxsw zmm0,zmm0,ZMMWORD PTR [rsp+0x3c0] 0x0000000000006ec7 <+4407>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000006ecf <+4415>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x400] 0x0000000000006ed7 <+4423>: vpmaxsw zmm0,zmm0,ZMMWORD PTR [rsp+0x4c0] 0x0000000000006edf <+4431>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000006ee7 <+4439>: imul r12,r12,0x3b9aca00 0x0000000000006eee <+4446>: sub rbx,QWORD PTR [rsp+0x60] 0x0000000000006ef3 <+4451>: lea rdx,[rip+0x571c6] # 0x5e0c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006efa <+4458>: mov ecx,0x80 0x0000000000006eff <+4463>: mov rdi,r15 0x0000000000006f02 <+4466>: mov rsi,r14 0x0000000000006f05 <+4469>: xor eax,eax 0x0000000000006f07 <+4471>: vzeroupper 0x0000000000006f0a <+4474>: call 0x57c0 <snprintf@plt> 0x0000000000006f0f <+4479>: cdqe 0x0000000000006f11 <+4481>: inc rax 0x0000000000006f14 <+4484>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000006f1c <+4492>: mov QWORD PTR [rsp+0xa8],rax 0x0000000000006f24 <+4500>: mov QWORD PTR [rsp+0xb0],r13 0x0000000000006f2c <+4508>: lea rdx,[rip+0x571ad] # 0x5e0e0 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x0000000000006f33 <+4515>: lea rdi,[rsp+0x258] 0x0000000000006f3b <+4523>: lea rsi,[rsp+0xa0] 0x0000000000006f43 <+4531>: mov ecx,0x6 0x0000000000006f48 <+4536>: call 0xe3e0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006f4d <+4541>: mov rdi,QWORD PTR [rsp+0xa0] 0x0000000000006f55 <+4549>: test rdi,rdi 0x0000000000006f58 <+4552>: je 0x6f5f <main+4559> 0x0000000000006f5a <+4554>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006f5f <+4559>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006f67 <+4567>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x300] 0x0000000000006f6f <+4575>: kmovd k1,DWORD PTR [rsp+0x38] 0x0000000000006f76 <+4582>: vpminsw zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x480] 0x0000000000006f7e <+4590>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000006f86 <+4598>: kmovd k1,DWORD PTR [rsp+0x3c] 0x0000000000006f8d <+4605>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000006f95 <+4613>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x340] 0x0000000000006f9d <+4621>: vpminsw zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x440] 0x0000000000006fa5 <+4629>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x0000000000006fad <+4637>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000006fb5 <+4645>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x380] 0x0000000000006fbd <+4653>: vpminsw zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x3c0] 0x0000000000006fc5 <+4661>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000006fcd <+4669>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000006fd5 <+4677>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x400] 0x0000000000006fdd <+4685>: vpminsw zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x4c0] 0x0000000000006fe5 <+4693>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000006fed <+4701>: add rbx,r12 0x0000000000006ff0 <+4704>: mov edi,0x1 0x0000000000006ff5 <+4709>: mov esi,0x3 0x0000000000006ffa <+4714>: vzeroupper 0x0000000000006ffd <+4717>: call 0x2e2e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000007002 <+4722>: xor ecx,ecx 0x0000000000007004 <+4724>: data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000007010 <+4736>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000007014 <+4740>: inc rcx 0x0000000000007017 <+4743>: cmp rcx,0x3 0x000000000000701b <+4747>: jne 0x7010 <main+4736> 0x000000000000701d <+4749>: mov WORD PTR [rax],0x203a 0x0000000000007022 <+4754>: mov BYTE PTR [rax+0x2],0x0 0x0000000000007026 <+4758>: mov QWORD PTR [rsp+0xb8],rax 0x000000000000702e <+4766>: mov QWORD PTR [rsp+0xc0],0x3 0x000000000000703a <+4778>: mov QWORD PTR [rsp+0xc8],0x3 0x0000000000007046 <+4790>: lea rdi,[rsp+0x270] 0x000000000000704e <+4798>: lea rsi,[rsp+0x258] 0x0000000000007056 <+4806>: lea rdx,[rsp+0xb8] 0x000000000000705e <+4814>: call 0xdfa0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000007063 <+4819>: mov rdi,QWORD PTR [rsp+0xb8] 0x000000000000706b <+4827>: test rdi,rdi 0x000000000000706e <+4830>: je 0x7075 <main+4837> 0x0000000000007070 <+4832>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007075 <+4837>: mov rdi,QWORD PTR [rsp+0x258] 0x000000000000707d <+4845>: test rdi,rdi 0x0000000000007080 <+4848>: je 0x7087 <main+4855> 0x0000000000007082 <+4850>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007087 <+4855>: lea r14,[rsp+0x2e8] 0x000000000000708f <+4863>: mov rdi,r14 0x0000000000007092 <+4866>: vmovaps zmm0,ZMMWORD PTR [rsp+0x180] 0x000000000000709a <+4874>: vmovaps zmm1,ZMMWORD PTR [rsp+0x140] 0x00000000000070a2 <+4882>: vmovaps zmm2,ZMMWORD PTR [rsp+0x100] 0x00000000000070aa <+4890>: vmovaps zmm3,ZMMWORD PTR [rsp+0x1c0] 0x00000000000070b2 <+4898>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=128> 0x00000000000070b7 <+4903>: lea rdi,[rsp+0x288] 0x00000000000070bf <+4911>: lea rsi,[rsp+0x270] 0x00000000000070c7 <+4919>: mov rdx,r14 0x00000000000070ca <+4922>: vzeroupper 0x00000000000070cd <+4925>: call 0xdfa0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000070d2 <+4930>: mov rdi,QWORD PTR [rsp+0x2e8] 0x00000000000070da <+4938>: test rdi,rdi 0x00000000000070dd <+4941>: je 0x70e4 <main+4948> 0x00000000000070df <+4943>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000070e4 <+4948>: mov rdi,QWORD PTR [rsp+0x270] 0x00000000000070ec <+4956>: test rdi,rdi 0x00000000000070ef <+4959>: je 0x70f6 <main+4966> 0x00000000000070f1 <+4961>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000070f6 <+4966>: lea rdi,[rsp+0x288] 0x00000000000070fe <+4974>: call 0x9840 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000007103 <+4979>: mov rdi,QWORD PTR [rsp+0x288] 0x000000000000710b <+4987>: test rdi,rdi 0x000000000000710e <+4990>: je 0x7115 <main+4997> 0x0000000000007110 <+4992>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007115 <+4997>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x000000000000711d <+5005>: vpaddw zmm0,zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000007125 <+5013>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x140] 0x000000000000712d <+5021>: vpaddw zmm1,zmm1,ZMMWORD PTR [rsp+0x1c0] 0x0000000000007135 <+5029>: vpaddw zmm0,zmm0,zmm1 0x000000000000713b <+5035>: vextracti64x4 ymm1,zmm0,0x1 0x0000000000007142 <+5042>: vpaddw ymm0,ymm0,ymm1 0x0000000000007146 <+5046>: vextracti128 xmm1,ymm0,0x1 0x000000000000714c <+5052>: vpaddw xmm0,xmm0,xmm1 0x0000000000007150 <+5056>: vpshufd xmm1,xmm0,0xee 0x0000000000007155 <+5061>: vpaddw xmm0,xmm0,xmm1 0x0000000000007159 <+5065>: vpshufd xmm1,xmm0,0x55 0x000000000000715e <+5070>: vpaddw xmm0,xmm0,xmm1 0x0000000000007162 <+5074>: vpsrld xmm1,xmm0,0x10 0x0000000000007167 <+5079>: vpaddw xmm0,xmm0,xmm1 0x000000000000716b <+5083>: vmovw eax,xmm0 0x0000000000007171 <+5089>: vmovw WORD PTR [rsp+0x36],xmm0 0x0000000000007179 <+5097>: lea rcx,[rsp+0x36] 0x000000000000717e <+5102>: mov QWORD PTR [rsp+0x68],rcx 0x0000000000007183 <+5107>: mov rdi,rbx 0x0000000000007186 <+5110>: vzeroupper 0x0000000000007189 <+5113>: call 0x8d90 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000718e <+5118>: mov r14,rax 0x0000000000007191 <+5121>: test rax,rax 0x0000000000007194 <+5124>: jle 0x71ab <main+5147> 0x0000000000007196 <+5126>: mov edi,0x1 0x000000000000719b <+5131>: mov rsi,r14 0x000000000000719e <+5134>: call 0x2e2e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000071a3 <+5139>: mov r15,rax 0x00000000000071a6 <+5142>: mov r12,r14 0x00000000000071a9 <+5145>: jmp 0x71b1 <main+5153> 0x00000000000071ab <+5147>: xor r15d,r15d 0x00000000000071ae <+5150>: xor r12d,r12d 0x00000000000071b1 <+5153>: lea rdx,[rip+0x56f08] # 0x5e0c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000071b8 <+5160>: mov rdi,r15 0x00000000000071bb <+5163>: mov rsi,r14 0x00000000000071be <+5166>: mov rcx,rbx 0x00000000000071c1 <+5169>: xor eax,eax 0x00000000000071c3 <+5171>: call 0x57c0 <snprintf@plt> 0x00000000000071c8 <+5176>: cdqe 0x00000000000071ca <+5178>: inc rax 0x00000000000071cd <+5181>: mov QWORD PTR [rsp+0xd0],r15 0x00000000000071d5 <+5189>: mov QWORD PTR [rsp+0xd8],rax 0x00000000000071dd <+5197>: mov QWORD PTR [rsp+0xe0],r12 0x00000000000071e5 <+5205>: lea rdx,[rip+0x56f04] # 0x5e0f0 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x00000000000071ec <+5212>: lea rdi,[rsp+0x2a0] 0x00000000000071f4 <+5220>: lea rsi,[rsp+0xd0] 0x00000000000071fc <+5228>: mov ecx,0xb 0x0000000000007201 <+5233>: call 0xe3e0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000007206 <+5238>: mov rdi,QWORD PTR [rsp+0xd0] 0x000000000000720e <+5246>: test rdi,rdi 0x0000000000007211 <+5249>: je 0x7218 <main+5256> 0x0000000000007213 <+5251>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007218 <+5256>: mov edi,0x1 0x000000000000721d <+5261>: mov esi,0x4 0x0000000000007222 <+5266>: call 0x2e2e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000007227 <+5271>: xor ecx,ecx 0x0000000000007229 <+5273>: nop DWORD PTR [rax+0x0] 0x0000000000007230 <+5280>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000007234 <+5284>: inc rcx 0x0000000000007237 <+5287>: cmp rcx,0x4 0x000000000000723b <+5291>: jne 0x7230 <main+5280> 0x000000000000723d <+5293>: mov DWORD PTR [rax],0x736e20 0x0000000000007243 <+5299>: mov QWORD PTR [rsp+0xe8],rax 0x000000000000724b <+5307>: mov QWORD PTR [rsp+0xf0],0x4 0x0000000000007257 <+5319>: mov QWORD PTR [rsp+0xf8],0x4 0x0000000000007263 <+5331>: lea rdi,[rsp+0x2b8] 0x000000000000726b <+5339>: lea rsi,[rsp+0x2a0] 0x0000000000007273 <+5347>: lea rdx,[rsp+0xe8] 0x000000000000727b <+5355>: call 0xdfa0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000007280 <+5360>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000007288 <+5368>: test rdi,rdi 0x000000000000728b <+5371>: je 0x7292 <main+5378> 0x000000000000728d <+5373>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007292 <+5378>: mov rdi,QWORD PTR [rsp+0x2a0] 0x000000000000729a <+5386>: test rdi,rdi 0x000000000000729d <+5389>: je 0x72a4 <main+5396> 0x000000000000729f <+5391>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000072a4 <+5396>: lea rdi,[rsp+0x2b8] 0x00000000000072ac <+5404>: call 0x9840 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000072b1 <+5409>: mov rdi,QWORD PTR [rsp+0x2b8] 0x00000000000072b9 <+5417>: test rdi,rdi 0x00000000000072bc <+5420>: je 0x72c3 <main+5427> 0x00000000000072be <+5422>: call 0x2e300 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000072c3 <+5427>: call 0x2a700 <KGEN_CompilerRT_DestroyGlobals()> 0x00000000000072c8 <+5432>: xor eax,eax 0x00000000000072ca <+5434>: lea rsp,[rbp-0x28] 0x00000000000072ce <+5438>: pop rbx 0x00000000000072cf <+5439>: pop r12 0x00000000000072d1 <+5441>: pop r13 0x00000000000072d3 <+5443>: pop r14 0x00000000000072d5 <+5445>: pop r15 0x00000000000072d7 <+5447>: pop rbp 0x00000000000072d8 <+5448>: ret End of assembler dump. --- disassemble/int16_16.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d30 <+0>: push rbp 0x0000000000005d31 <+1>: push r15 0x0000000000005d33 <+3>: push r14 0x0000000000005d35 <+5>: push r13 0x0000000000005d37 <+7>: push r12 0x0000000000005d39 <+9>: push rbx 0x0000000000005d3a <+10>: sub rsp,0x228 0x0000000000005d41 <+17>: call 0x2f010 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d46 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d4a <+26>: mov ebx,0x11 0x0000000000005d4f <+31>: xor r14d,r14d 0x0000000000005d52 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005d60 <+48>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x0000000000005d66 <+54>: vzeroupper 0x0000000000005d69 <+57>: call 0x2df60 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d6e <+62>: mov edx,0x64 0x0000000000005d73 <+67>: mov rdi,rax 0x0000000000005d76 <+70>: xor esi,esi 0x0000000000005d78 <+72>: call 0x2e370 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005d7d <+77>: vpbroadcastw ymm0,r14d 0x0000000000005d83 <+83>: vpcmpeqw k1,ymm0,YMMWORD PTR [rip+0x56353] # 0x5c0e0 0x0000000000005d8d <+93>: vmovdqu ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000005d93 <+99>: vpbroadcastw ymm0{k1},eax 0x0000000000005d99 <+105>: dec rbx 0x0000000000005d9c <+108>: inc r14 0x0000000000005d9f <+111>: cmp rbx,0x1 0x0000000000005da3 <+115>: ja 0x5d60 <main+48> 0x0000000000005da5 <+117>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x0000000000005dab <+123>: mov edi,0x10 0x0000000000005db0 <+128>: vzeroupper 0x0000000000005db3 <+131>: call 0x7ef0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005db8 <+136>: mov rbx,rax 0x0000000000005dbb <+139>: test rax,rax 0x0000000000005dbe <+142>: jle 0x5dd5 <main+165> 0x0000000000005dc0 <+144>: mov edi,0x1 0x0000000000005dc5 <+149>: mov rsi,rbx 0x0000000000005dc8 <+152>: call 0x2d440 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005dcd <+157>: mov r14,rax 0x0000000000005dd0 <+160>: mov r15,rbx 0x0000000000005dd3 <+163>: jmp 0x5ddb <main+171> 0x0000000000005dd5 <+165>: xor r14d,r14d 0x0000000000005dd8 <+168>: xor r15d,r15d 0x0000000000005ddb <+171>: lea rdx,[rip+0x5644e] # 0x5c230 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005de2 <+178>: mov ecx,0x10 0x0000000000005de7 <+183>: mov rdi,r14 0x0000000000005dea <+186>: mov rsi,rbx 0x0000000000005ded <+189>: xor eax,eax 0x0000000000005def <+191>: call 0x57c0 <snprintf@plt> 0x0000000000005df4 <+196>: cdqe 0x0000000000005df6 <+198>: inc rax 0x0000000000005df9 <+201>: mov QWORD PTR [rsp+0x60],r14 0x0000000000005dfe <+206>: mov QWORD PTR [rsp+0x68],rax 0x0000000000005e03 <+211>: mov QWORD PTR [rsp+0x70],r15 0x0000000000005e08 <+216>: lea rdx,[rip+0x56431] # 0x5c240 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e0f <+223>: lea rdi,[rsp+0xf0] 0x0000000000005e17 <+231>: lea rsi,[rsp+0x60] 0x0000000000005e1c <+236>: mov ecx,0x7 0x0000000000005e21 <+241>: call 0xd540 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e26 <+246>: mov rdi,QWORD PTR [rsp+0x60] 0x0000000000005e2b <+251>: test rdi,rdi 0x0000000000005e2e <+254>: je 0x5e35 <main+261> 0x0000000000005e30 <+256>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e35 <+261>: mov edi,0x1 0x0000000000005e3a <+266>: mov esi,0x3 0x0000000000005e3f <+271>: call 0x2d440 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e44 <+276>: xor ecx,ecx 0x0000000000005e46 <+278>: cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005e50 <+288>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005e54 <+292>: inc rcx 0x0000000000005e57 <+295>: cmp rcx,0x3 0x0000000000005e5b <+299>: jne 0x5e50 <main+288> 0x0000000000005e5d <+301>: mov WORD PTR [rax],0x203a 0x0000000000005e62 <+306>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005e66 <+310>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005e6b <+315>: mov QWORD PTR [rsp+0x80],0x3 0x0000000000005e77 <+327>: mov QWORD PTR [rsp+0x88],0x3 0x0000000000005e83 <+339>: lea rdi,[rsp+0x108] 0x0000000000005e8b <+347>: lea rsi,[rsp+0xf0] 0x0000000000005e93 <+355>: lea rdx,[rsp+0x78] 0x0000000000005e98 <+360>: call 0xd100 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005e9d <+365>: mov rdi,QWORD PTR [rsp+0x78] 0x0000000000005ea2 <+370>: test rdi,rdi 0x0000000000005ea5 <+373>: je 0x5eac <main+380> 0x0000000000005ea7 <+375>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005eac <+380>: mov rdi,QWORD PTR [rsp+0xf0] 0x0000000000005eb4 <+388>: test rdi,rdi 0x0000000000005eb7 <+391>: je 0x5ebe <main+398> 0x0000000000005eb9 <+393>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ebe <+398>: lea rbx,[rsp+0x1f8] 0x0000000000005ec6 <+406>: mov rdi,rbx 0x0000000000005ec9 <+409>: vmovups ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000005ecf <+415>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=16> 0x0000000000005ed4 <+420>: lea rdi,[rsp+0x120] 0x0000000000005edc <+428>: lea rsi,[rsp+0x108] 0x0000000000005ee4 <+436>: mov rdx,rbx 0x0000000000005ee7 <+439>: vzeroupper 0x0000000000005eea <+442>: call 0xd100 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005eef <+447>: mov rdi,QWORD PTR [rsp+0x1f8] 0x0000000000005ef7 <+455>: test rdi,rdi 0x0000000000005efa <+458>: je 0x5f01 <main+465> 0x0000000000005efc <+460>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f01 <+465>: mov rdi,QWORD PTR [rsp+0x108] 0x0000000000005f09 <+473>: test rdi,rdi 0x0000000000005f0c <+476>: je 0x5f13 <main+483> 0x0000000000005f0e <+478>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f13 <+483>: lea rdi,[rsp+0x120] 0x0000000000005f1b <+491>: call 0x89a0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f20 <+496>: mov rdi,QWORD PTR [rsp+0x120] 0x0000000000005f28 <+504>: test rdi,rdi 0x0000000000005f2b <+507>: je 0x5f32 <main+514> 0x0000000000005f2d <+509>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f32 <+514>: vxorps xmm0,xmm0,xmm0 0x0000000000005f36 <+518>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 0x0000000000005f3c <+524>: lea rsi,[rsp+0x30] 0x0000000000005f41 <+529>: mov edi,0x1 0x0000000000005f46 <+534>: call 0x5470 <clock_gettime@plt> 0x0000000000005f4b <+539>: mov rbx,QWORD PTR [rsp+0x30] 0x0000000000005f50 <+544>: mov rax,QWORD PTR [rsp+0x38] 0x0000000000005f55 <+549>: mov QWORD PTR [rsp+0x50],rax 0x0000000000005f5a <+554>: vmovdqa ymm0,YMMWORD PTR [rip+0x5619e] # 0x5c100 0x0000000000005f62 <+562>: vmovdqu ymm2,YMMWORD PTR [rsp+0x10] 0x0000000000005f68 <+568>: vpermw ymm0,ymm0,ymm2 0x0000000000005f6e <+574>: vpminsw ymm1,ymm2,ymm0 0x0000000000005f72 <+578>: mov ax,0xf2b0 0x0000000000005f76 <+582>: kmovd k1,eax 0x0000000000005f7a <+586>: vpmaxsw ymm1{k1},ymm2,ymm0 0x0000000000005f80 <+592>: vmovdqa ymm0,YMMWORD PTR [rip+0x56198] # 0x5c120 0x0000000000005f88 <+600>: vpermw ymm0,ymm0,ymm1 0x0000000000005f8e <+606>: vpminsw ymm2,ymm1,ymm0 0x0000000000005f92 <+610>: mov ax,0xdcc4 0x0000000000005f96 <+614>: kmovd k1,eax 0x0000000000005f9a <+618>: vpmaxsw ymm2{k1},ymm1,ymm0 0x0000000000005fa0 <+624>: vmovdqa ymm0,YMMWORD PTR [rip+0x56198] # 0x5c140 0x0000000000005fa8 <+632>: vpermw ymm0,ymm0,ymm2 0x0000000000005fae <+638>: vpminsw ymm1,ymm2,ymm0 0x0000000000005fb2 <+642>: mov ax,0xef08 0x0000000000005fb6 <+646>: kmovd k1,eax 0x0000000000005fba <+650>: vpmaxsw ymm1{k1},ymm2,ymm0 0x0000000000005fc0 <+656>: vmovdqa ymm0,YMMWORD PTR [rip+0x56198] # 0x5c160 0x0000000000005fc8 <+664>: vpermw ymm0,ymm0,ymm1 0x0000000000005fce <+670>: vpminsw ymm2,ymm1,ymm0 0x0000000000005fd2 <+674>: mov ax,0xb552 0x0000000000005fd6 <+678>: kmovd k1,eax 0x0000000000005fda <+682>: vpmaxsw ymm2{k1},ymm1,ymm0 0x0000000000005fe0 <+688>: vmovdqa ymm0,YMMWORD PTR [rip+0x56198] # 0x5c180 0x0000000000005fe8 <+696>: vpermw ymm0,ymm0,ymm2 0x0000000000005fee <+702>: vpmaxsw ymm1,ymm2,ymm0 0x0000000000005ff2 <+706>: mov ax,0x14d6 0x0000000000005ff6 <+710>: kmovd k1,eax 0x0000000000005ffa <+714>: vpminsw ymm1{k1},ymm2,ymm0 0x0000000000006000 <+720>: vmovdqa ymm0,YMMWORD PTR [rip+0x56198] # 0x5c1a0 0x0000000000006008 <+728>: vpermw ymm0,ymm0,ymm1 0x000000000000600e <+734>: vpmaxsw ymm2,ymm1,ymm0 0x0000000000006012 <+738>: mov ax,0x24da 0x0000000000006016 <+742>: kmovd k1,eax 0x000000000000601a <+746>: vpminsw ymm2{k1},ymm1,ymm0 0x0000000000006020 <+752>: vpshufb ymm0,ymm2,YMMWORD PTR [rip+0x56197] # 0x5c1c0 0x0000000000006029 <+761>: vpmaxsw ymm1,ymm2,ymm0 0x000000000000602d <+765>: mov ax,0x1554 0x0000000000006031 <+769>: kmovd k1,eax 0x0000000000006035 <+773>: vpminsw ymm1{k1},ymm2,ymm0 0x000000000000603b <+779>: vmovdqa ymm0,YMMWORD PTR [rip+0x5619d] # 0x5c1e0 0x0000000000006043 <+787>: vpermd ymm0,ymm0,ymm1 0x0000000000006048 <+792>: vpminsw ymm2,ymm1,ymm0 0x000000000000604c <+796>: vpmaxsw ymm0,ymm1,ymm0 0x0000000000006050 <+800>: vpblendd ymm1,ymm0,ymm2,0x14 0x0000000000006056 <+806>: vmovdqa ymm0,YMMWORD PTR [rip+0x561a2] # 0x5c200 0x000000000000605e <+814>: vmovdqu YMMWORD PTR [rsp+0x1d0],ymm1 0x0000000000006067 <+823>: vpermw ymm0,ymm0,ymm1 0x000000000000606d <+829>: vmovdqu YMMWORD PTR [rsp+0x1b0],ymm0 0x0000000000006076 <+838>: mov bp,0xaa8 0x000000000000607a <+842>: vpxor xmm0,xmm0,xmm0 0x000000000000607e <+846>: vmovdqa XMMWORD PTR [rsp+0x40],xmm0 0x0000000000006084 <+852>: lea rsi,[rsp+0x40] 0x0000000000006089 <+857>: mov edi,0x1 0x000000000000608e <+862>: vzeroupper 0x0000000000006091 <+865>: call 0x5470 <clock_gettime@plt> 0x0000000000006096 <+870>: mov r13,QWORD PTR [rsp+0x40] 0x000000000000609b <+875>: sub r13,rbx 0x000000000000609e <+878>: mov rbx,QWORD PTR [rsp+0x48] 0x00000000000060a3 <+883>: mov edi,0x10 0x00000000000060a8 <+888>: call 0x7ef0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000060ad <+893>: mov r14,rax 0x00000000000060b0 <+896>: test rax,rax 0x00000000000060b3 <+899>: jle 0x60ca <main+922> 0x00000000000060b5 <+901>: mov edi,0x1 0x00000000000060ba <+906>: mov rsi,r14 0x00000000000060bd <+909>: call 0x2d440 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000060c2 <+914>: mov r15,rax 0x00000000000060c5 <+917>: mov r12,r14 0x00000000000060c8 <+920>: jmp 0x60d0 <main+928> 0x00000000000060ca <+922>: xor r15d,r15d 0x00000000000060cd <+925>: xor r12d,r12d 0x00000000000060d0 <+928>: vmovdqu ymm0,YMMWORD PTR [rsp+0x1b0] 0x00000000000060d9 <+937>: vpmaxsw ymm0,ymm0,YMMWORD PTR [rsp+0x1d0] 0x00000000000060e2 <+946>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x00000000000060e8 <+952>: kmovd k1,ebp 0x00000000000060ec <+956>: kmovw WORD PTR [rsp+0xc],k1 0x00000000000060f2 <+962>: imul r13,r13,0x3b9aca00 0x00000000000060f9 <+969>: sub rbx,QWORD PTR [rsp+0x50] 0x00000000000060fe <+974>: lea rdx,[rip+0x5612b] # 0x5c230 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006105 <+981>: mov ecx,0x10 0x000000000000610a <+986>: mov rdi,r15 0x000000000000610d <+989>: mov rsi,r14 0x0000000000006110 <+992>: xor eax,eax 0x0000000000006112 <+994>: vzeroupper 0x0000000000006115 <+997>: call 0x57c0 <snprintf@plt> 0x000000000000611a <+1002>: cdqe 0x000000000000611c <+1004>: inc rax 0x000000000000611f <+1007>: mov QWORD PTR [rsp+0x90],r15 0x0000000000006127 <+1015>: mov QWORD PTR [rsp+0x98],rax 0x000000000000612f <+1023>: mov QWORD PTR [rsp+0xa0],r12 0x0000000000006137 <+1031>: lea rdx,[rip+0x56112] # 0x5c250 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x000000000000613e <+1038>: lea rdi,[rsp+0x138] 0x0000000000006146 <+1046>: lea rsi,[rsp+0x90] 0x000000000000614e <+1054>: mov ecx,0x6 0x0000000000006153 <+1059>: call 0xd540 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006158 <+1064>: mov rdi,QWORD PTR [rsp+0x90] 0x0000000000006160 <+1072>: test rdi,rdi 0x0000000000006163 <+1075>: je 0x616a <main+1082> 0x0000000000006165 <+1077>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000616a <+1082>: vmovdqu ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000006170 <+1088>: vmovdqu ymm1,YMMWORD PTR [rsp+0x1b0] 0x0000000000006179 <+1097>: kmovw k1,WORD PTR [rsp+0xc] 0x000000000000617f <+1103>: vpminsw ymm0{k1},ymm1,YMMWORD PTR [rsp+0x1d0] 0x000000000000618a <+1114>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x0000000000006190 <+1120>: add rbx,r13 0x0000000000006193 <+1123>: mov edi,0x1 0x0000000000006198 <+1128>: mov esi,0x3 0x000000000000619d <+1133>: vzeroupper 0x00000000000061a0 <+1136>: call 0x2d440 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000061a5 <+1141>: xor ecx,ecx 0x00000000000061a7 <+1143>: nop WORD PTR [rax+rax*1+0x0] 0x00000000000061b0 <+1152>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000061b4 <+1156>: inc rcx 0x00000000000061b7 <+1159>: cmp rcx,0x3 0x00000000000061bb <+1163>: jne 0x61b0 <main+1152> 0x00000000000061bd <+1165>: mov WORD PTR [rax],0x203a 0x00000000000061c2 <+1170>: mov BYTE PTR [rax+0x2],0x0 0x00000000000061c6 <+1174>: mov QWORD PTR [rsp+0xa8],rax 0x00000000000061ce <+1182>: mov QWORD PTR [rsp+0xb0],0x3 0x00000000000061da <+1194>: mov QWORD PTR [rsp+0xb8],0x3 0x00000000000061e6 <+1206>: lea rdi,[rsp+0x150] 0x00000000000061ee <+1214>: lea rsi,[rsp+0x138] 0x00000000000061f6 <+1222>: lea rdx,[rsp+0xa8] 0x00000000000061fe <+1230>: call 0xd100 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006203 <+1235>: mov rdi,QWORD PTR [rsp+0xa8] 0x000000000000620b <+1243>: test rdi,rdi 0x000000000000620e <+1246>: je 0x6215 <main+1253> 0x0000000000006210 <+1248>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006215 <+1253>: mov rdi,QWORD PTR [rsp+0x138] 0x000000000000621d <+1261>: test rdi,rdi 0x0000000000006220 <+1264>: je 0x6227 <main+1271> 0x0000000000006222 <+1266>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006227 <+1271>: lea r14,[rsp+0x210] 0x000000000000622f <+1279>: mov rdi,r14 0x0000000000006232 <+1282>: vmovups ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000006238 <+1288>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=16> 0x000000000000623d <+1293>: lea rdi,[rsp+0x168] 0x0000000000006245 <+1301>: lea rsi,[rsp+0x150] 0x000000000000624d <+1309>: mov rdx,r14 0x0000000000006250 <+1312>: vzeroupper 0x0000000000006253 <+1315>: call 0xd100 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006258 <+1320>: mov rdi,QWORD PTR [rsp+0x210] 0x0000000000006260 <+1328>: test rdi,rdi 0x0000000000006263 <+1331>: je 0x626a <main+1338> 0x0000000000006265 <+1333>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000626a <+1338>: mov rdi,QWORD PTR [rsp+0x150] 0x0000000000006272 <+1346>: test rdi,rdi 0x0000000000006275 <+1349>: je 0x627c <main+1356> 0x0000000000006277 <+1351>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000627c <+1356>: lea rdi,[rsp+0x168] 0x0000000000006284 <+1364>: call 0x89a0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006289 <+1369>: mov rdi,QWORD PTR [rsp+0x168] 0x0000000000006291 <+1377>: test rdi,rdi 0x0000000000006294 <+1380>: je 0x629b <main+1387> 0x0000000000006296 <+1382>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000629b <+1387>: vmovdqu ymm1,YMMWORD PTR [rsp+0x10] 0x00000000000062a1 <+1393>: vextracti128 xmm0,ymm1,0x1 0x00000000000062a7 <+1399>: vpaddw xmm0,xmm1,xmm0 0x00000000000062ab <+1403>: vpshufd xmm1,xmm0,0xee 0x00000000000062b0 <+1408>: vpaddw xmm0,xmm0,xmm1 0x00000000000062b4 <+1412>: vpshufd xmm1,xmm0,0x55 0x00000000000062b9 <+1417>: vpaddw xmm0,xmm0,xmm1 0x00000000000062bd <+1421>: vpsrld xmm1,xmm0,0x10 0x00000000000062c2 <+1426>: vpaddw xmm0,xmm0,xmm1 0x00000000000062c6 <+1430>: vmovw eax,xmm0 0x00000000000062cc <+1436>: vmovw WORD PTR [rsp+0xe],xmm0 0x00000000000062d4 <+1444>: lea rcx,[rsp+0xe] 0x00000000000062d9 <+1449>: mov QWORD PTR [rsp+0x58],rcx 0x00000000000062de <+1454>: mov rdi,rbx 0x00000000000062e1 <+1457>: vzeroupper 0x00000000000062e4 <+1460>: call 0x7ef0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000062e9 <+1465>: mov r14,rax 0x00000000000062ec <+1468>: test rax,rax 0x00000000000062ef <+1471>: jle 0x6306 <main+1494> 0x00000000000062f1 <+1473>: mov edi,0x1 0x00000000000062f6 <+1478>: mov rsi,r14 0x00000000000062f9 <+1481>: call 0x2d440 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000062fe <+1486>: mov r15,rax 0x0000000000006301 <+1489>: mov r12,r14 0x0000000000006304 <+1492>: jmp 0x630c <main+1500> 0x0000000000006306 <+1494>: xor r15d,r15d 0x0000000000006309 <+1497>: xor r12d,r12d 0x000000000000630c <+1500>: lea rdx,[rip+0x55f1d] # 0x5c230 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006313 <+1507>: mov rdi,r15 0x0000000000006316 <+1510>: mov rsi,r14 0x0000000000006319 <+1513>: mov rcx,rbx 0x000000000000631c <+1516>: xor eax,eax 0x000000000000631e <+1518>: call 0x57c0 <snprintf@plt> 0x0000000000006323 <+1523>: cdqe 0x0000000000006325 <+1525>: inc rax 0x0000000000006328 <+1528>: mov QWORD PTR [rsp+0xc0],r15 0x0000000000006330 <+1536>: mov QWORD PTR [rsp+0xc8],rax 0x0000000000006338 <+1544>: mov QWORD PTR [rsp+0xd0],r12 0x0000000000006340 <+1552>: lea rdx,[rip+0x55f19] # 0x5c260 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x0000000000006347 <+1559>: lea rdi,[rsp+0x180] 0x000000000000634f <+1567>: lea rsi,[rsp+0xc0] 0x0000000000006357 <+1575>: mov ecx,0xb 0x000000000000635c <+1580>: call 0xd540 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006361 <+1585>: mov rdi,QWORD PTR [rsp+0xc0] 0x0000000000006369 <+1593>: test rdi,rdi 0x000000000000636c <+1596>: je 0x6373 <main+1603> 0x000000000000636e <+1598>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006373 <+1603>: mov edi,0x1 0x0000000000006378 <+1608>: mov esi,0x4 0x000000000000637d <+1613>: call 0x2d440 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006382 <+1618>: xor ecx,ecx 0x0000000000006384 <+1620>: data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006390 <+1632>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006394 <+1636>: inc rcx 0x0000000000006397 <+1639>: cmp rcx,0x4 0x000000000000639b <+1643>: jne 0x6390 <main+1632> 0x000000000000639d <+1645>: mov DWORD PTR [rax],0x736e20 0x00000000000063a3 <+1651>: mov QWORD PTR [rsp+0xd8],rax 0x00000000000063ab <+1659>: mov QWORD PTR [rsp+0xe0],0x4 0x00000000000063b7 <+1671>: mov QWORD PTR [rsp+0xe8],0x4 0x00000000000063c3 <+1683>: lea rdi,[rsp+0x198] 0x00000000000063cb <+1691>: lea rsi,[rsp+0x180] 0x00000000000063d3 <+1699>: lea rdx,[rsp+0xd8] 0x00000000000063db <+1707>: call 0xd100 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000063e0 <+1712>: mov rdi,QWORD PTR [rsp+0xd8] 0x00000000000063e8 <+1720>: test rdi,rdi 0x00000000000063eb <+1723>: je 0x63f2 <main+1730> 0x00000000000063ed <+1725>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000063f2 <+1730>: mov rdi,QWORD PTR [rsp+0x180] 0x00000000000063fa <+1738>: test rdi,rdi 0x00000000000063fd <+1741>: je 0x6404 <main+1748> 0x00000000000063ff <+1743>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006404 <+1748>: lea rdi,[rsp+0x198] 0x000000000000640c <+1756>: call 0x89a0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006411 <+1761>: mov rdi,QWORD PTR [rsp+0x198] 0x0000000000006419 <+1769>: test rdi,rdi 0x000000000000641c <+1772>: je 0x6423 <main+1779> 0x000000000000641e <+1774>: call 0x2d460 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006423 <+1779>: call 0x29860 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006428 <+1784>: xor eax,eax 0x000000000000642a <+1786>: add rsp,0x228 0x0000000000006431 <+1793>: pop rbx 0x0000000000006432 <+1794>: pop r12 0x0000000000006434 <+1796>: pop r13 0x0000000000006436 <+1798>: pop r14 0x0000000000006438 <+1800>: pop r15 0x000000000000643a <+1802>: pop rbp 0x000000000000643b <+1803>: ret End of assembler dump. --- disassemble/int16_32.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d30 <+0>: push rbp 0x0000000000005d31 <+1>: push r15 0x0000000000005d33 <+3>: push r14 0x0000000000005d35 <+5>: push r13 0x0000000000005d37 <+7>: push r12 0x0000000000005d39 <+9>: push rbx 0x0000000000005d3a <+10>: sub rsp,0x288 0x0000000000005d41 <+17>: call 0x2f100 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d46 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d4a <+26>: mov ebx,0x21 0x0000000000005d4f <+31>: xor r14d,r14d 0x0000000000005d52 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005d60 <+48>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x0000000000005d6b <+59>: vzeroupper 0x0000000000005d6e <+62>: call 0x2e050 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d73 <+67>: mov edx,0x64 0x0000000000005d78 <+72>: mov rdi,rax 0x0000000000005d7b <+75>: xor esi,esi 0x0000000000005d7d <+77>: call 0x2e460 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005d82 <+82>: vpbroadcastw zmm0,r14d 0x0000000000005d88 <+88>: vpcmpeqw k1,zmm0,ZMMWORD PTR [rip+0x5636e] # 0x5c100 0x0000000000005d92 <+98>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0xd0] 0x0000000000005d9d <+109>: vpbroadcastw zmm0{k1},eax 0x0000000000005da3 <+115>: dec rbx 0x0000000000005da6 <+118>: inc r14 0x0000000000005da9 <+121>: cmp rbx,0x1 0x0000000000005dad <+125>: ja 0x5d60 <main+48> 0x0000000000005daf <+127>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x0000000000005dba <+138>: mov edi,0x20 0x0000000000005dbf <+143>: vzeroupper 0x0000000000005dc2 <+146>: call 0x7fe0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005dc7 <+151>: mov rbx,rax 0x0000000000005dca <+154>: test rax,rax 0x0000000000005dcd <+157>: jle 0x5de4 <main+180> 0x0000000000005dcf <+159>: mov edi,0x1 0x0000000000005dd4 <+164>: mov rsi,rbx 0x0000000000005dd7 <+167>: call 0x2d530 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005ddc <+172>: mov r14,rax 0x0000000000005ddf <+175>: mov r15,rbx 0x0000000000005de2 <+178>: jmp 0x5dea <main+186> 0x0000000000005de4 <+180>: xor r14d,r14d 0x0000000000005de7 <+183>: xor r15d,r15d 0x0000000000005dea <+186>: lea rdx,[rip+0x565cf] # 0x5c3c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005df1 <+193>: mov ecx,0x20 0x0000000000005df6 <+198>: mov rdi,r14 0x0000000000005df9 <+201>: mov rsi,rbx 0x0000000000005dfc <+204>: xor eax,eax 0x0000000000005dfe <+206>: call 0x57c0 <snprintf@plt> 0x0000000000005e03 <+211>: cdqe 0x0000000000005e05 <+213>: inc rax 0x0000000000005e08 <+216>: mov QWORD PTR [rsp+0x40],r14 0x0000000000005e0d <+221>: mov QWORD PTR [rsp+0x48],rax 0x0000000000005e12 <+226>: mov QWORD PTR [rsp+0x50],r15 0x0000000000005e17 <+231>: lea rdx,[rip+0x565b2] # 0x5c3d0 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e1e <+238>: lea rdi,[rsp+0x110] 0x0000000000005e26 <+246>: lea rsi,[rsp+0x40] 0x0000000000005e2b <+251>: mov ecx,0x7 0x0000000000005e30 <+256>: call 0xd630 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e35 <+261>: mov rdi,QWORD PTR [rsp+0x40] 0x0000000000005e3a <+266>: test rdi,rdi 0x0000000000005e3d <+269>: je 0x5e44 <main+276> 0x0000000000005e3f <+271>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e44 <+276>: mov edi,0x1 0x0000000000005e49 <+281>: mov esi,0x3 0x0000000000005e4e <+286>: call 0x2d530 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e53 <+291>: xor ecx,ecx 0x0000000000005e55 <+293>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005e60 <+304>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005e64 <+308>: inc rcx 0x0000000000005e67 <+311>: cmp rcx,0x3 0x0000000000005e6b <+315>: jne 0x5e60 <main+304> 0x0000000000005e6d <+317>: mov WORD PTR [rax],0x203a 0x0000000000005e72 <+322>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005e76 <+326>: mov QWORD PTR [rsp+0x58],rax 0x0000000000005e7b <+331>: mov QWORD PTR [rsp+0x60],0x3 0x0000000000005e84 <+340>: mov QWORD PTR [rsp+0x68],0x3 0x0000000000005e8d <+349>: lea rdi,[rsp+0x128] 0x0000000000005e95 <+357>: lea rsi,[rsp+0x110] 0x0000000000005e9d <+365>: lea rdx,[rsp+0x58] 0x0000000000005ea2 <+370>: call 0xd1f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005ea7 <+375>: mov rdi,QWORD PTR [rsp+0x58] 0x0000000000005eac <+380>: test rdi,rdi 0x0000000000005eaf <+383>: je 0x5eb6 <main+390> 0x0000000000005eb1 <+385>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005eb6 <+390>: mov rdi,QWORD PTR [rsp+0x110] 0x0000000000005ebe <+398>: test rdi,rdi 0x0000000000005ec1 <+401>: je 0x5ec8 <main+408> 0x0000000000005ec3 <+403>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ec8 <+408>: lea rbx,[rsp+0x1d0] 0x0000000000005ed0 <+416>: mov rdi,rbx 0x0000000000005ed3 <+419>: vmovups zmm0,ZMMWORD PTR [rsp+0xd0] 0x0000000000005ede <+430>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=32> 0x0000000000005ee3 <+435>: lea rdi,[rsp+0x140] 0x0000000000005eeb <+443>: lea rsi,[rsp+0x128] 0x0000000000005ef3 <+451>: mov rdx,rbx 0x0000000000005ef6 <+454>: vzeroupper 0x0000000000005ef9 <+457>: call 0xd1f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005efe <+462>: mov rdi,QWORD PTR [rsp+0x1d0] 0x0000000000005f06 <+470>: test rdi,rdi 0x0000000000005f09 <+473>: je 0x5f10 <main+480> 0x0000000000005f0b <+475>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f10 <+480>: mov rdi,QWORD PTR [rsp+0x128] 0x0000000000005f18 <+488>: test rdi,rdi 0x0000000000005f1b <+491>: je 0x5f22 <main+498> 0x0000000000005f1d <+493>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f22 <+498>: lea rdi,[rsp+0x140] 0x0000000000005f2a <+506>: call 0x8a90 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f2f <+511>: mov rdi,QWORD PTR [rsp+0x140] 0x0000000000005f37 <+519>: test rdi,rdi 0x0000000000005f3a <+522>: je 0x5f41 <main+529> 0x0000000000005f3c <+524>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f41 <+529>: vxorps xmm0,xmm0,xmm0 0x0000000000005f45 <+533>: vmovaps XMMWORD PTR [rsp+0x10],xmm0 0x0000000000005f4b <+539>: lea rsi,[rsp+0x10] 0x0000000000005f50 <+544>: mov edi,0x1 0x0000000000005f55 <+549>: call 0x5470 <clock_gettime@plt> 0x0000000000005f5a <+554>: mov rbx,QWORD PTR [rsp+0x10] 0x0000000000005f5f <+559>: mov rax,QWORD PTR [rsp+0x18] 0x0000000000005f64 <+564>: mov QWORD PTR [rsp+0x30],rax 0x0000000000005f69 <+569>: vmovdqu64 zmm2,ZMMWORD PTR [rsp+0xd0] 0x0000000000005f74 <+580>: vprold zmm0,zmm2,0x10 0x0000000000005f7b <+587>: vpminsw zmm1,zmm2,zmm0 0x0000000000005f81 <+593>: mov eax,0xaaaaaaaa 0x0000000000005f86 <+598>: kmovd k1,eax 0x0000000000005f8a <+602>: vpmaxsw zmm1{k1},zmm2,zmm0 0x0000000000005f90 <+608>: vpshufd zmm0,zmm1,0xb1 0x0000000000005f97 <+615>: vpminsw zmm2,zmm1,zmm0 0x0000000000005f9d <+621>: mov eax,0xcccccccc 0x0000000000005fa2 <+626>: kmovd k1,eax 0x0000000000005fa6 <+630>: vpmaxsw zmm2{k1},zmm1,zmm0 0x0000000000005fac <+636>: vpshufd zmm0,zmm2,0x4e 0x0000000000005fb3 <+643>: vpminsw zmm1,zmm2,zmm0 0x0000000000005fb9 <+649>: mov eax,0xf0f0f0f0 0x0000000000005fbe <+654>: kmovd k1,eax 0x0000000000005fc2 <+658>: vpmaxsw zmm1{k1},zmm2,zmm0 0x0000000000005fc8 <+664>: vpxor xmm0,xmm0,xmm0 0x0000000000005fcc <+668>: vpermq zmm0,zmm1,0x4e 0x0000000000005fd3 <+675>: vpminsw zmm2,zmm1,zmm0 0x0000000000005fd9 <+681>: mov eax,0xff00ff00 0x0000000000005fde <+686>: kmovd k1,eax 0x0000000000005fe2 <+690>: vpmaxsw zmm2{k1},zmm1,zmm0 0x0000000000005fe8 <+696>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5614e] # 0x5c140 0x0000000000005ff2 <+706>: vpermw zmm0,zmm0,zmm2 0x0000000000005ff8 <+712>: vpminsw zmm1,zmm2,zmm0 0x0000000000005ffe <+718>: mov eax,0xf7117710 0x0000000000006003 <+723>: kmovd k1,eax 0x0000000000006007 <+727>: vpmaxsw zmm1{k1},zmm2,zmm0 0x000000000000600d <+733>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56169] # 0x5c180 0x0000000000006017 <+743>: vpermw zmm0,zmm0,zmm1 0x000000000000601d <+749>: vpmaxsw zmm2,zmm1,zmm0 0x0000000000006023 <+755>: mov eax,0x249a26da 0x0000000000006028 <+760>: kmovd k1,eax 0x000000000000602c <+764>: vpminsw zmm2{k1},zmm1,zmm0 0x0000000000006032 <+770>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56184] # 0x5c1c0 0x000000000000603c <+780>: vpermw zmm0,zmm0,zmm2 0x0000000000006042 <+786>: vpmaxsw zmm1,zmm2,zmm0 0x0000000000006048 <+792>: mov eax,0x2079be 0x000000000000604d <+797>: kmovd k1,eax 0x0000000000006051 <+801>: vpminsw zmm1{k1},zmm2,zmm0 0x0000000000006057 <+807>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5619f] # 0x5c200 0x0000000000006061 <+817>: vpermw zmm0,zmm0,zmm1 0x0000000000006067 <+823>: vpmaxsw zmm2,zmm1,zmm0 0x000000000000606d <+829>: mov eax,0x40edf8 0x0000000000006072 <+834>: kmovd k1,eax 0x0000000000006076 <+838>: vpminsw zmm2{k1},zmm1,zmm0 0x000000000000607c <+844>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x561ba] # 0x5c240 0x0000000000006086 <+854>: vpermw zmm0,zmm0,zmm2 0x000000000000608c <+860>: vpmaxsw zmm1,zmm2,zmm0 0x0000000000006092 <+866>: mov eax,0x880deaa 0x0000000000006097 <+871>: kmovd k1,eax 0x000000000000609b <+875>: vpminsw zmm1{k1},zmm2,zmm0 0x00000000000060a1 <+881>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x561d5] # 0x5c280 0x00000000000060ab <+891>: vpermw zmm0,zmm0,zmm1 0x00000000000060b1 <+897>: vpmaxsw zmm2,zmm1,zmm0 0x00000000000060b7 <+903>: mov eax,0x480fa84 0x00000000000060bc <+908>: kmovd k1,eax 0x00000000000060c0 <+912>: vpminsw zmm2{k1},zmm1,zmm0 0x00000000000060c6 <+918>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x561f0] # 0x5c2c0 0x00000000000060d0 <+928>: vpermw zmm0,zmm0,zmm2 0x00000000000060d6 <+934>: vpmaxsw zmm1,zmm2,zmm0 0x00000000000060dc <+940>: mov eax,0x818e644 0x00000000000060e1 <+945>: kmovd k1,eax 0x00000000000060e5 <+949>: vpminsw zmm1{k1},zmm2,zmm0 0x00000000000060eb <+955>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5620b] # 0x5c300 0x00000000000060f5 <+965>: vpermw zmm0,zmm0,zmm1 0x00000000000060fb <+971>: vpmaxsw zmm2,zmm1,zmm0 0x0000000000006101 <+977>: mov eax,0x22ccb20 0x0000000000006106 <+982>: kmovd k1,eax 0x000000000000610a <+986>: vpminsw zmm2{k1},zmm1,zmm0 0x0000000000006110 <+992>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56226] # 0x5c340 0x000000000000611a <+1002>: vpermw zmm0,zmm0,zmm2 0x0000000000006120 <+1008>: vpmaxsw zmm1,zmm2,zmm0 0x0000000000006126 <+1014>: mov eax,0x54aad48 0x000000000000612b <+1019>: kmovd k1,eax 0x000000000000612f <+1023>: vpminsw zmm1{k1},zmm2,zmm0 0x0000000000006135 <+1029>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56241] # 0x5c380 0x000000000000613f <+1039>: vmovdqu64 ZMMWORD PTR [rsp+0x240],zmm1 0x0000000000006147 <+1047>: vpermw zmm0,zmm0,zmm1 0x000000000000614d <+1053>: vmovdqu64 ZMMWORD PTR [rsp+0x200],zmm0 0x0000000000006155 <+1061>: mov ebp,0xaaaaaa8 0x000000000000615a <+1066>: vpxor xmm0,xmm0,xmm0 0x000000000000615e <+1070>: vmovdqa XMMWORD PTR [rsp+0x20],xmm0 0x0000000000006164 <+1076>: lea rsi,[rsp+0x20] 0x0000000000006169 <+1081>: mov edi,0x1 0x000000000000616e <+1086>: vzeroupper 0x0000000000006171 <+1089>: call 0x5470 <clock_gettime@plt> 0x0000000000006176 <+1094>: mov r13,QWORD PTR [rsp+0x20] 0x000000000000617b <+1099>: sub r13,rbx 0x000000000000617e <+1102>: mov rbx,QWORD PTR [rsp+0x28] 0x0000000000006183 <+1107>: mov edi,0x20 0x0000000000006188 <+1112>: call 0x7fe0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000618d <+1117>: mov r14,rax 0x0000000000006190 <+1120>: test rax,rax 0x0000000000006193 <+1123>: jle 0x61aa <main+1146> 0x0000000000006195 <+1125>: mov edi,0x1 0x000000000000619a <+1130>: mov rsi,r14 0x000000000000619d <+1133>: call 0x2d530 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000061a2 <+1138>: mov r15,rax 0x00000000000061a5 <+1141>: mov r12,r14 0x00000000000061a8 <+1144>: jmp 0x61b0 <main+1152> 0x00000000000061aa <+1146>: xor r15d,r15d 0x00000000000061ad <+1149>: xor r12d,r12d 0x00000000000061b0 <+1152>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0x200] 0x00000000000061b8 <+1160>: vpmaxsw zmm0,zmm0,ZMMWORD PTR [rsp+0x240] 0x00000000000061c0 <+1168>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x00000000000061cb <+1179>: kmovd k1,ebp 0x00000000000061cf <+1183>: kmovd DWORD PTR [rsp+0xc],k1 0x00000000000061d6 <+1190>: imul r13,r13,0x3b9aca00 0x00000000000061dd <+1197>: sub rbx,QWORD PTR [rsp+0x30] 0x00000000000061e2 <+1202>: lea rdx,[rip+0x561d7] # 0x5c3c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000061e9 <+1209>: mov ecx,0x20 0x00000000000061ee <+1214>: mov rdi,r15 0x00000000000061f1 <+1217>: mov rsi,r14 0x00000000000061f4 <+1220>: xor eax,eax 0x00000000000061f6 <+1222>: vzeroupper 0x00000000000061f9 <+1225>: call 0x57c0 <snprintf@plt> 0x00000000000061fe <+1230>: cdqe 0x0000000000006200 <+1232>: inc rax 0x0000000000006203 <+1235>: mov QWORD PTR [rsp+0x70],r15 0x0000000000006208 <+1240>: mov QWORD PTR [rsp+0x78],rax 0x000000000000620d <+1245>: mov QWORD PTR [rsp+0x80],r12 0x0000000000006215 <+1253>: lea rdx,[rip+0x561c4] # 0x5c3e0 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x000000000000621c <+1260>: lea rdi,[rsp+0x158] 0x0000000000006224 <+1268>: lea rsi,[rsp+0x70] 0x0000000000006229 <+1273>: mov ecx,0x6 0x000000000000622e <+1278>: call 0xd630 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006233 <+1283>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000006238 <+1288>: test rdi,rdi 0x000000000000623b <+1291>: je 0x6242 <main+1298> 0x000000000000623d <+1293>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006242 <+1298>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0xd0] 0x000000000000624d <+1309>: vmovdqu64 zmm1,ZMMWORD PTR [rsp+0x200] 0x0000000000006255 <+1317>: kmovd k1,DWORD PTR [rsp+0xc] 0x000000000000625c <+1324>: vpminsw zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x240] 0x0000000000006264 <+1332>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x000000000000626f <+1343>: add rbx,r13 0x0000000000006272 <+1346>: mov edi,0x1 0x0000000000006277 <+1351>: mov esi,0x3 0x000000000000627c <+1356>: vzeroupper 0x000000000000627f <+1359>: call 0x2d530 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006284 <+1364>: xor ecx,ecx 0x0000000000006286 <+1366>: cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006290 <+1376>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006294 <+1380>: inc rcx 0x0000000000006297 <+1383>: cmp rcx,0x3 0x000000000000629b <+1387>: jne 0x6290 <main+1376> 0x000000000000629d <+1389>: mov WORD PTR [rax],0x203a 0x00000000000062a2 <+1394>: mov BYTE PTR [rax+0x2],0x0 0x00000000000062a6 <+1398>: mov QWORD PTR [rsp+0x88],rax 0x00000000000062ae <+1406>: mov QWORD PTR [rsp+0x90],0x3 0x00000000000062ba <+1418>: mov QWORD PTR [rsp+0x98],0x3 0x00000000000062c6 <+1430>: lea rdi,[rsp+0x170] 0x00000000000062ce <+1438>: lea rsi,[rsp+0x158] 0x00000000000062d6 <+1446>: lea rdx,[rsp+0x88] 0x00000000000062de <+1454>: call 0xd1f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000062e3 <+1459>: mov rdi,QWORD PTR [rsp+0x88] 0x00000000000062eb <+1467>: test rdi,rdi 0x00000000000062ee <+1470>: je 0x62f5 <main+1477> 0x00000000000062f0 <+1472>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000062f5 <+1477>: mov rdi,QWORD PTR [rsp+0x158] 0x00000000000062fd <+1485>: test rdi,rdi 0x0000000000006300 <+1488>: je 0x6307 <main+1495> 0x0000000000006302 <+1490>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006307 <+1495>: lea r14,[rsp+0x1e8] 0x000000000000630f <+1503>: mov rdi,r14 0x0000000000006312 <+1506>: vmovups zmm0,ZMMWORD PTR [rsp+0xd0] 0x000000000000631d <+1517>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=32> 0x0000000000006322 <+1522>: lea rdi,[rsp+0x188] 0x000000000000632a <+1530>: lea rsi,[rsp+0x170] 0x0000000000006332 <+1538>: mov rdx,r14 0x0000000000006335 <+1541>: vzeroupper 0x0000000000006338 <+1544>: call 0xd1f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x000000000000633d <+1549>: mov rdi,QWORD PTR [rsp+0x1e8] 0x0000000000006345 <+1557>: test rdi,rdi 0x0000000000006348 <+1560>: je 0x634f <main+1567> 0x000000000000634a <+1562>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000634f <+1567>: mov rdi,QWORD PTR [rsp+0x170] 0x0000000000006357 <+1575>: test rdi,rdi 0x000000000000635a <+1578>: je 0x6361 <main+1585> 0x000000000000635c <+1580>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006361 <+1585>: lea rdi,[rsp+0x188] 0x0000000000006369 <+1593>: call 0x8a90 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x000000000000636e <+1598>: mov rdi,QWORD PTR [rsp+0x188] 0x0000000000006376 <+1606>: test rdi,rdi 0x0000000000006379 <+1609>: je 0x6380 <main+1616> 0x000000000000637b <+1611>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006380 <+1616>: vmovdqu64 zmm1,ZMMWORD PTR [rsp+0xd0] 0x000000000000638b <+1627>: vextracti64x4 ymm0,zmm1,0x1 0x0000000000006392 <+1634>: vpaddw ymm0,ymm1,ymm0 0x0000000000006396 <+1638>: vextracti128 xmm1,ymm0,0x1 0x000000000000639c <+1644>: vpaddw xmm0,xmm0,xmm1 0x00000000000063a0 <+1648>: vpshufd xmm1,xmm0,0xee 0x00000000000063a5 <+1653>: vpaddw xmm0,xmm0,xmm1 0x00000000000063a9 <+1657>: vpshufd xmm1,xmm0,0x55 0x00000000000063ae <+1662>: vpaddw xmm0,xmm0,xmm1 0x00000000000063b2 <+1666>: vpsrld xmm1,xmm0,0x10 0x00000000000063b7 <+1671>: vpaddw xmm0,xmm0,xmm1 0x00000000000063bb <+1675>: vmovw eax,xmm0 0x00000000000063c1 <+1681>: vmovw WORD PTR [rsp+0xa],xmm0 0x00000000000063c9 <+1689>: lea rcx,[rsp+0xa] 0x00000000000063ce <+1694>: mov QWORD PTR [rsp+0x38],rcx 0x00000000000063d3 <+1699>: mov rdi,rbx 0x00000000000063d6 <+1702>: vzeroupper 0x00000000000063d9 <+1705>: call 0x7fe0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000063de <+1710>: mov r14,rax 0x00000000000063e1 <+1713>: test rax,rax 0x00000000000063e4 <+1716>: jle 0x63fb <main+1739> 0x00000000000063e6 <+1718>: mov edi,0x1 0x00000000000063eb <+1723>: mov rsi,r14 0x00000000000063ee <+1726>: call 0x2d530 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000063f3 <+1731>: mov r15,rax 0x00000000000063f6 <+1734>: mov r12,r14 0x00000000000063f9 <+1737>: jmp 0x6401 <main+1745> 0x00000000000063fb <+1739>: xor r15d,r15d 0x00000000000063fe <+1742>: xor r12d,r12d 0x0000000000006401 <+1745>: lea rdx,[rip+0x55fb8] # 0x5c3c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006408 <+1752>: mov rdi,r15 0x000000000000640b <+1755>: mov rsi,r14 0x000000000000640e <+1758>: mov rcx,rbx 0x0000000000006411 <+1761>: xor eax,eax 0x0000000000006413 <+1763>: call 0x57c0 <snprintf@plt> 0x0000000000006418 <+1768>: cdqe 0x000000000000641a <+1770>: inc rax 0x000000000000641d <+1773>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000006425 <+1781>: mov QWORD PTR [rsp+0xa8],rax 0x000000000000642d <+1789>: mov QWORD PTR [rsp+0xb0],r12 0x0000000000006435 <+1797>: lea rdx,[rip+0x55fb4] # 0x5c3f0 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x000000000000643c <+1804>: lea rdi,[rsp+0x1a0] 0x0000000000006444 <+1812>: lea rsi,[rsp+0xa0] 0x000000000000644c <+1820>: mov ecx,0xb 0x0000000000006451 <+1825>: call 0xd630 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006456 <+1830>: mov rdi,QWORD PTR [rsp+0xa0] 0x000000000000645e <+1838>: test rdi,rdi 0x0000000000006461 <+1841>: je 0x6468 <main+1848> 0x0000000000006463 <+1843>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006468 <+1848>: mov edi,0x1 0x000000000000646d <+1853>: mov esi,0x4 0x0000000000006472 <+1858>: call 0x2d530 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006477 <+1863>: xor ecx,ecx 0x0000000000006479 <+1865>: nop DWORD PTR [rax+0x0] 0x0000000000006480 <+1872>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006484 <+1876>: inc rcx 0x0000000000006487 <+1879>: cmp rcx,0x4 0x000000000000648b <+1883>: jne 0x6480 <main+1872> 0x000000000000648d <+1885>: mov DWORD PTR [rax],0x736e20 0x0000000000006493 <+1891>: mov QWORD PTR [rsp+0xb8],rax 0x000000000000649b <+1899>: mov QWORD PTR [rsp+0xc0],0x4 0x00000000000064a7 <+1911>: mov QWORD PTR [rsp+0xc8],0x4 0x00000000000064b3 <+1923>: lea rdi,[rsp+0x1b8] 0x00000000000064bb <+1931>: lea rsi,[rsp+0x1a0] 0x00000000000064c3 <+1939>: lea rdx,[rsp+0xb8] 0x00000000000064cb <+1947>: call 0xd1f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000064d0 <+1952>: mov rdi,QWORD PTR [rsp+0xb8] 0x00000000000064d8 <+1960>: test rdi,rdi 0x00000000000064db <+1963>: je 0x64e2 <main+1970> 0x00000000000064dd <+1965>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064e2 <+1970>: mov rdi,QWORD PTR [rsp+0x1a0] 0x00000000000064ea <+1978>: test rdi,rdi 0x00000000000064ed <+1981>: je 0x64f4 <main+1988> 0x00000000000064ef <+1983>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064f4 <+1988>: lea rdi,[rsp+0x1b8] 0x00000000000064fc <+1996>: call 0x8a90 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006501 <+2001>: mov rdi,QWORD PTR [rsp+0x1b8] 0x0000000000006509 <+2009>: test rdi,rdi 0x000000000000650c <+2012>: je 0x6513 <main+2019> 0x000000000000650e <+2014>: call 0x2d550 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006513 <+2019>: call 0x29950 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006518 <+2024>: xor eax,eax 0x000000000000651a <+2026>: add rsp,0x288 0x0000000000006521 <+2033>: pop rbx 0x0000000000006522 <+2034>: pop r12 0x0000000000006524 <+2036>: pop r13 0x0000000000006526 <+2038>: pop r14 0x0000000000006528 <+2040>: pop r15 0x000000000000652a <+2042>: pop rbp 0x000000000000652b <+2043>: ret End of assembler dump. --- disassemble/int16_64.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d50 <+0>: push rbp 0x0000000000005d51 <+1>: mov rbp,rsp 0x0000000000005d54 <+4>: push r15 0x0000000000005d56 <+6>: push r14 0x0000000000005d58 <+8>: push r13 0x0000000000005d5a <+10>: push r12 0x0000000000005d5c <+12>: push rbx 0x0000000000005d5d <+13>: and rsp,0xffffffffffffffc0 0x0000000000005d61 <+17>: sub rsp,0x440 0x0000000000005d68 <+24>: call 0x2f560 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d6d <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005d71 <+33>: mov ebx,0x41 0x0000000000005d76 <+38>: xor r14d,r14d 0x0000000000005d79 <+41>: vxorps xmm1,xmm1,xmm1 0x0000000000005d7d <+45>: nop DWORD PTR [rax] 0x0000000000005d80 <+48>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005d88 <+56>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005d90 <+64>: vzeroupper 0x0000000000005d93 <+67>: call 0x2e4b0 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d98 <+72>: mov edx,0x64 0x0000000000005d9d <+77>: mov rdi,rax 0x0000000000005da0 <+80>: xor esi,esi 0x0000000000005da2 <+82>: call 0x2e8c0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005da7 <+87>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005daf <+95>: vmovaps ZMMWORD PTR [rsp+0x380],zmm0 0x0000000000005db7 <+103>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005dbf <+111>: vmovaps ZMMWORD PTR [rsp+0x3c0],zmm0 0x0000000000005dc7 <+119>: mov ecx,r14d 0x0000000000005dca <+122>: and ecx,0x3f 0x0000000000005dcd <+125>: mov WORD PTR [rsp+rcx*2+0x380],ax 0x0000000000005dd5 <+133>: vmovaps zmm0,ZMMWORD PTR [rsp+0x380] 0x0000000000005ddd <+141>: vmovaps zmm1,ZMMWORD PTR [rsp+0x3c0] 0x0000000000005de5 <+149>: dec rbx 0x0000000000005de8 <+152>: inc r14 0x0000000000005deb <+155>: cmp rbx,0x1 0x0000000000005def <+159>: ja 0x5d80 <main+48> 0x0000000000005df1 <+161>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005df9 <+169>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005e01 <+177>: mov edi,0x40 0x0000000000005e06 <+182>: vzeroupper 0x0000000000005e09 <+185>: call 0x8440 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005e0e <+190>: mov rbx,rax 0x0000000000005e11 <+193>: test rax,rax 0x0000000000005e14 <+196>: jle 0x5e2b <main+219> 0x0000000000005e16 <+198>: mov edi,0x1 0x0000000000005e1b <+203>: mov rsi,rbx 0x0000000000005e1e <+206>: call 0x2d990 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e23 <+211>: mov r14,rax 0x0000000000005e26 <+214>: mov r15,rbx 0x0000000000005e29 <+217>: jmp 0x5e31 <main+225> 0x0000000000005e2b <+219>: xor r14d,r14d 0x0000000000005e2e <+222>: xor r15d,r15d 0x0000000000005e31 <+225>: lea rdx,[rip+0x57bc8] # 0x5da00 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005e38 <+232>: mov ecx,0x40 0x0000000000005e3d <+237>: mov rdi,r14 0x0000000000005e40 <+240>: mov rsi,rbx 0x0000000000005e43 <+243>: xor eax,eax 0x0000000000005e45 <+245>: call 0x57c0 <snprintf@plt> 0x0000000000005e4a <+250>: cdqe 0x0000000000005e4c <+252>: inc rax 0x0000000000005e4f <+255>: mov QWORD PTR [rsp+0x70],r14 0x0000000000005e54 <+260>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005e59 <+265>: mov QWORD PTR [rsp+0x80],r15 0x0000000000005e61 <+273>: lea rdx,[rip+0x57ba8] # 0x5da10 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e68 <+280>: lea rdi,[rsp+0x190] 0x0000000000005e70 <+288>: lea rsi,[rsp+0x70] 0x0000000000005e75 <+293>: mov ecx,0x7 0x0000000000005e7a <+298>: call 0xda90 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e7f <+303>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000005e84 <+308>: test rdi,rdi 0x0000000000005e87 <+311>: je 0x5e8e <main+318> 0x0000000000005e89 <+313>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e8e <+318>: mov edi,0x1 0x0000000000005e93 <+323>: mov esi,0x3 0x0000000000005e98 <+328>: call 0x2d990 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e9d <+333>: xor ecx,ecx 0x0000000000005e9f <+335>: nop 0x0000000000005ea0 <+336>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005ea4 <+340>: inc rcx 0x0000000000005ea7 <+343>: cmp rcx,0x3 0x0000000000005eab <+347>: jne 0x5ea0 <main+336> 0x0000000000005ead <+349>: mov WORD PTR [rax],0x203a 0x0000000000005eb2 <+354>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005eb6 <+358>: mov QWORD PTR [rsp+0x88],rax 0x0000000000005ebe <+366>: mov QWORD PTR [rsp+0x90],0x3 0x0000000000005eca <+378>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000005ed6 <+390>: lea rdi,[rsp+0x1a8] 0x0000000000005ede <+398>: lea rsi,[rsp+0x190] 0x0000000000005ee6 <+406>: lea rdx,[rsp+0x88] 0x0000000000005eee <+414>: call 0xd650 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005ef3 <+419>: mov rdi,QWORD PTR [rsp+0x88] 0x0000000000005efb <+427>: test rdi,rdi 0x0000000000005efe <+430>: je 0x5f05 <main+437> 0x0000000000005f00 <+432>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f05 <+437>: mov rdi,QWORD PTR [rsp+0x190] 0x0000000000005f0d <+445>: test rdi,rdi 0x0000000000005f10 <+448>: je 0x5f17 <main+455> 0x0000000000005f12 <+450>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f17 <+455>: lea rbx,[rsp+0x250] 0x0000000000005f1f <+463>: mov rdi,rbx 0x0000000000005f22 <+466>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005f2a <+474>: vmovaps zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000005f32 <+482>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=64> 0x0000000000005f37 <+487>: lea rdi,[rsp+0x1c0] 0x0000000000005f3f <+495>: lea rsi,[rsp+0x1a8] 0x0000000000005f47 <+503>: mov rdx,rbx 0x0000000000005f4a <+506>: vzeroupper 0x0000000000005f4d <+509>: call 0xd650 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005f52 <+514>: mov rdi,QWORD PTR [rsp+0x250] 0x0000000000005f5a <+522>: test rdi,rdi 0x0000000000005f5d <+525>: je 0x5f64 <main+532> 0x0000000000005f5f <+527>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f64 <+532>: mov rdi,QWORD PTR [rsp+0x1a8] 0x0000000000005f6c <+540>: test rdi,rdi 0x0000000000005f6f <+543>: je 0x5f76 <main+550> 0x0000000000005f71 <+545>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f76 <+550>: lea rdi,[rsp+0x1c0] 0x0000000000005f7e <+558>: call 0x8ef0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f83 <+563>: mov rdi,QWORD PTR [rsp+0x1c0] 0x0000000000005f8b <+571>: test rdi,rdi 0x0000000000005f8e <+574>: je 0x5f95 <main+581> 0x0000000000005f90 <+576>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f95 <+581>: vxorps xmm0,xmm0,xmm0 0x0000000000005f99 <+585>: vmovaps XMMWORD PTR [rsp+0x40],xmm0 0x0000000000005f9f <+591>: lea rsi,[rsp+0x40] 0x0000000000005fa4 <+596>: mov edi,0x1 0x0000000000005fa9 <+601>: call 0x5470 <clock_gettime@plt> 0x0000000000005fae <+606>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x100] 0x0000000000005fb6 <+614>: vpshufd zmm0,zmm5,0xb1 0x0000000000005fbd <+621>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x140] 0x0000000000005fc5 <+629>: vpshufd zmm1,zmm4,0xb1 0x0000000000005fcc <+636>: vpminsw zmm2,zmm4,zmm1 0x0000000000005fd2 <+642>: vpminsw zmm3,zmm5,zmm0 0x0000000000005fd8 <+648>: mov eax,0xcccccccc 0x0000000000005fdd <+653>: kmovd k1,eax 0x0000000000005fe1 <+657>: vpmaxsw zmm3{k1},zmm5,zmm0 0x0000000000005fe7 <+663>: vpmaxsw zmm2{k1},zmm4,zmm1 0x0000000000005fed <+669>: vprold zmm0,zmm2,0x10 0x0000000000005ff4 <+676>: vprold zmm1,zmm3,0x10 0x0000000000005ffb <+683>: vpminsw zmm4,zmm3,zmm1 0x0000000000006001 <+689>: vpminsw zmm5,zmm2,zmm0 0x0000000000006007 <+695>: mov eax,0xaaaaaaaa 0x000000000000600c <+700>: kmovd k1,eax 0x0000000000006010 <+704>: vpmaxsw zmm5{k1},zmm2,zmm0 0x0000000000006016 <+710>: vpmaxsw zmm4{k1},zmm3,zmm1 0x000000000000601c <+716>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570da] # 0x5d100 0x0000000000006026 <+726>: vpermi2w zmm0,zmm5,zmm4 0x000000000000602c <+732>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5710a] # 0x5d140 0x0000000000006036 <+742>: vpermi2w zmm1,zmm4,zmm5 0x000000000000603c <+748>: vpmaxsw zmm2,zmm4,zmm1 0x0000000000006042 <+754>: mov eax,0x2222bb2b 0x0000000000006047 <+759>: kmovd k1,eax 0x000000000000604b <+763>: vpminsw zmm2{k1},zmm4,zmm1 0x0000000000006051 <+769>: vpminsw zmm1,zmm5,zmm0 0x0000000000006057 <+775>: mov eax,0xd4dd4444 0x000000000000605c <+780>: kmovd k1,eax 0x0000000000006060 <+784>: vpmaxsw zmm1{k1},zmm5,zmm0 0x0000000000006066 <+790>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57110] # 0x5d180 0x0000000000006070 <+800>: vpermi2w zmm0,zmm1,zmm2 0x0000000000006076 <+806>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57140] # 0x5d1c0 0x0000000000006080 <+816>: vpermi2w zmm3,zmm2,zmm1 0x0000000000006086 <+822>: vpmaxsw zmm4,zmm2,zmm3 0x000000000000608c <+828>: mov eax,0x90669f 0x0000000000006091 <+833>: kmovd k1,eax 0x0000000000006095 <+837>: vpminsw zmm4{k1},zmm2,zmm3 0x000000000000609b <+843>: vpminsw zmm2,zmm1,zmm0 0x00000000000060a1 <+849>: mov eax,0xf9660900 0x00000000000060a6 <+854>: kmovd k1,eax 0x00000000000060aa <+858>: vpmaxsw zmm2{k1},zmm1,zmm0 0x00000000000060b0 <+864>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57146] # 0x5d200 0x00000000000060ba <+874>: vpermi2w zmm0,zmm2,zmm4 0x00000000000060c0 <+880>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57176] # 0x5d240 0x00000000000060ca <+890>: vpermi2w zmm1,zmm2,zmm4 0x00000000000060d0 <+896>: vpmaxsw zmm3,zmm4,zmm1 0x00000000000060d6 <+902>: mov eax,0x690066 0x00000000000060db <+907>: kmovd k1,eax 0x00000000000060df <+911>: vpminsw zmm3{k1},zmm4,zmm1 0x00000000000060e5 <+917>: vpminsw zmm1,zmm2,zmm0 0x00000000000060eb <+923>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x571cb] # 0x5d2c0 0x00000000000060f5 <+933>: vpermi2w zmm4,zmm1,zmm3 0x00000000000060fb <+939>: mov eax,0x66009600 0x0000000000006100 <+944>: kmovd k1,eax 0x0000000000006104 <+948>: vpmaxsw zmm1{k1},zmm2,zmm0 0x000000000000610a <+954>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5716c] # 0x5d280 0x0000000000006114 <+964>: vpermi2w zmm0,zmm1,zmm3 0x000000000000611a <+970>: vpmaxsw zmm2,zmm3,zmm0 0x0000000000006120 <+976>: mov eax,0x9069090 0x0000000000006125 <+981>: kmovd k1,eax 0x0000000000006129 <+985>: vpminsw zmm2{k1},zmm3,zmm0 0x000000000000612f <+991>: vpminsw zmm0,zmm1,zmm4 0x0000000000006135 <+997>: mov eax,0x9096090 0x000000000000613a <+1002>: kmovd k1,eax 0x000000000000613e <+1006>: vpmaxsw zmm0{k1},zmm1,zmm4 0x0000000000006144 <+1012>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x571b2] # 0x5d300 0x000000000000614e <+1022>: vpermi2w zmm1,zmm0,zmm2 0x0000000000006154 <+1028>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x571e2] # 0x5d340 0x000000000000615e <+1038>: vpermi2w zmm3,zmm2,zmm0 0x0000000000006164 <+1044>: vpmaxsw zmm4,zmm2,zmm3 0x000000000000616a <+1050>: mov eax,0x6096960 0x000000000000616f <+1055>: kmovd k1,eax 0x0000000000006173 <+1059>: vpminsw zmm4{k1},zmm2,zmm3 0x0000000000006179 <+1065>: vpminsw zmm2,zmm0,zmm1 0x000000000000617f <+1071>: mov eax,0x6969069 0x0000000000006184 <+1076>: kmovd k1,eax 0x0000000000006188 <+1080>: vpmaxsw zmm2{k1},zmm0,zmm1 0x000000000000618e <+1086>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x571e8] # 0x5d380 0x0000000000006198 <+1096>: vpermi2w zmm0,zmm2,zmm4 0x000000000000619e <+1102>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57218] # 0x5d3c0 0x00000000000061a8 <+1112>: vpermi2w zmm1,zmm4,zmm2 0x00000000000061ae <+1118>: vpmaxsw zmm3,zmm4,zmm1 0x00000000000061b4 <+1124>: vpminsw zmm5,zmm2,zmm0 0x00000000000061ba <+1130>: mov eax,0xf0690f 0x00000000000061bf <+1135>: kmovd k1,eax 0x00000000000061c3 <+1139>: vpmaxsw zmm5{k1},zmm2,zmm0 0x00000000000061c9 <+1145>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5726d] # 0x5d440 0x00000000000061d3 <+1155>: vpermi2w zmm0,zmm5,zmm3 0x00000000000061d9 <+1161>: mov eax,0x960f00 0x00000000000061de <+1166>: kmovd k1,eax 0x00000000000061e2 <+1170>: vpminsw zmm3{k1},zmm4,zmm1 0x00000000000061e8 <+1176>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5720e] # 0x5d400 0x00000000000061f2 <+1186>: vpermi2w zmm1,zmm3,zmm5 0x00000000000061f8 <+1192>: vpmaxsw zmm2,zmm3,zmm1 0x00000000000061fe <+1198>: mov eax,0x690f09 0x0000000000006203 <+1203>: kmovd k1,eax 0x0000000000006207 <+1207>: vpminsw zmm2{k1},zmm3,zmm1 0x000000000000620d <+1213>: vpmaxsw zmm1,zmm5,zmm0 0x0000000000006213 <+1219>: mov eax,0x6f0f6960 0x0000000000006218 <+1224>: kmovd k1,eax 0x000000000000621c <+1228>: vpminsw zmm1{k1},zmm5,zmm0 0x0000000000006222 <+1234>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57254] # 0x5d480 0x000000000000622c <+1244>: vpermw zmm0,zmm0,zmm2 0x0000000000006232 <+1250>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57284] # 0x5d4c0 0x000000000000623c <+1260>: vpermw zmm3,zmm3,zmm1 0x0000000000006242 <+1266>: vpminsw zmm4,zmm2,zmm0 0x0000000000006248 <+1272>: vpmaxsw zmm0,zmm2,zmm0 0x000000000000624e <+1278>: mov eax,0x6069f 0x0000000000006253 <+1283>: kmovd k1,eax 0x0000000000006257 <+1287>: vmovdqu16 zmm0{k1},zmm4 0x000000000000625d <+1293>: vpmaxsw zmm2,zmm1,zmm3 0x0000000000006263 <+1299>: mov eax,0x69f0600 0x0000000000006268 <+1304>: kmovd k1,eax 0x000000000000626c <+1308>: vpminsw zmm2{k1},zmm1,zmm3 0x0000000000006272 <+1314>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57284] # 0x5d500 0x000000000000627c <+1324>: vpermi2w zmm1,zmm0,zmm2 0x0000000000006282 <+1330>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x572b4] # 0x5d540 0x000000000000628c <+1340>: vpermi2w zmm3,zmm2,zmm4 0x0000000000006292 <+1346>: vpmaxsw zmm4,zmm0,zmm1 0x0000000000006298 <+1352>: mov eax,0x90f6 0x000000000000629d <+1357>: kmovd k1,eax 0x00000000000062a1 <+1361>: vpminsw zmm4{k1},zmm0,zmm1 0x00000000000062a7 <+1367>: vpmaxsw zmm0,zmm2,zmm3 0x00000000000062ad <+1373>: mov eax,0x90f69000 0x00000000000062b2 <+1378>: kmovd k1,eax 0x00000000000062b6 <+1382>: vpminsw zmm0{k1},zmm2,zmm3 0x00000000000062bc <+1388>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x572ba] # 0x5d580 0x00000000000062c6 <+1398>: vpermi2w zmm1,zmm0,zmm4 0x00000000000062cc <+1404>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x572ea] # 0x5d5c0 0x00000000000062d6 <+1414>: vpermi2w zmm2,zmm4,zmm0 0x00000000000062dc <+1420>: vpmaxsw zmm3,zmm4,zmm2 0x00000000000062e2 <+1426>: mov eax,0xe8e0 0x00000000000062e7 <+1431>: kmovd k1,eax 0x00000000000062eb <+1435>: vpminsw zmm3{k1},zmm4,zmm2 0x00000000000062f1 <+1441>: vpmaxsw zmm2,zmm0,zmm1 0x00000000000062f7 <+1447>: mov eax,0xe8e06666 0x00000000000062fc <+1452>: kmovd k1,eax 0x0000000000006300 <+1456>: vpminsw zmm2{k1},zmm0,zmm1 0x0000000000006306 <+1462>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x572f0] # 0x5d600 0x0000000000006310 <+1472>: vpermi2w zmm0,zmm2,zmm3 0x0000000000006316 <+1478>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57320] # 0x5d640 0x0000000000006320 <+1488>: vpermi2w zmm1,zmm3,zmm2 0x0000000000006326 <+1494>: vpmaxsw zmm4,zmm3,zmm1 0x000000000000632c <+1500>: vpminsw zmm5,zmm2,zmm0 0x0000000000006332 <+1506>: mov eax,0xb3931331 0x0000000000006337 <+1511>: kmovd k1,eax 0x000000000000633b <+1515>: vpmaxsw zmm5{k1},zmm2,zmm0 0x0000000000006341 <+1521>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57375] # 0x5d6c0 0x000000000000634b <+1531>: vpermi2w zmm0,zmm5,zmm4 0x0000000000006351 <+1537>: mov eax,0x8880088 0x0000000000006356 <+1542>: kmovd k1,eax 0x000000000000635a <+1546>: vpminsw zmm4{k1},zmm3,zmm1 0x0000000000006360 <+1552>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57316] # 0x5d680 0x000000000000636a <+1562>: vpermi2w zmm1,zmm4,zmm5 0x0000000000006370 <+1568>: vpmaxsw zmm2,zmm4,zmm1 0x0000000000006376 <+1574>: mov eax,0xa00ca4c 0x000000000000637b <+1579>: kmovd k1,eax 0x000000000000637f <+1583>: vpminsw zmm2{k1},zmm4,zmm1 0x0000000000006385 <+1589>: vpmaxsw zmm1,zmm5,zmm0 0x000000000000638b <+1595>: mov eax,0xc48cd9ac 0x0000000000006390 <+1600>: kmovd k1,eax 0x0000000000006394 <+1604>: vpminsw zmm1{k1},zmm5,zmm0 0x000000000000639a <+1610>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5735c] # 0x5d700 0x00000000000063a4 <+1620>: vpermi2w zmm0,zmm2,zmm1 0x00000000000063aa <+1626>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5738c] # 0x5d740 0x00000000000063b4 <+1636>: vpermi2w zmm3,zmm1,zmm2 0x00000000000063ba <+1642>: vpmaxsw zmm4,zmm1,zmm3 0x00000000000063c0 <+1648>: mov eax,0x88ca8888 0x00000000000063c5 <+1653>: kmovd k1,eax 0x00000000000063c9 <+1657>: vpminsw zmm4{k1},zmm1,zmm3 0x00000000000063cf <+1663>: vpmaxsw zmm1,zmm2,zmm0 0x00000000000063d5 <+1669>: mov eax,0x2466 0x00000000000063da <+1674>: kmovd k1,eax 0x00000000000063de <+1678>: vpminsw zmm1{k1},zmm2,zmm0 0x00000000000063e4 <+1684>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57392] # 0x5d780 0x00000000000063ee <+1694>: vpermi2w zmm0,zmm1,zmm4 0x00000000000063f4 <+1700>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x573c2] # 0x5d7c0 0x00000000000063fe <+1710>: vpermi2w zmm2,zmm4,zmm1 0x0000000000006404 <+1716>: vpmaxsw zmm3,zmm4,zmm2 0x000000000000640a <+1722>: mov eax,0xeeca8888 0x000000000000640f <+1727>: kmovd k1,eax 0x0000000000006413 <+1731>: vpminsw zmm3{k1},zmm4,zmm2 0x0000000000006419 <+1737>: vpmaxsw zmm2,zmm1,zmm0 0x000000000000641f <+1743>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57417] # 0x5d840 0x0000000000006429 <+1753>: vpermi2w zmm4,zmm3,zmm2 0x000000000000642f <+1759>: mov eax,0xac88 0x0000000000006434 <+1764>: kmovd k1,eax 0x0000000000006438 <+1768>: vpminsw zmm2{k1},zmm1,zmm0 0x000000000000643e <+1774>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x573b8] # 0x5d800 0x0000000000006448 <+1784>: vpermi2w zmm0,zmm2,zmm3 0x000000000000644e <+1790>: vpmaxsw zmm1,zmm2,zmm0 0x0000000000006454 <+1796>: mov eax,0x44caaa 0x0000000000006459 <+1801>: kmovd k1,eax 0x000000000000645d <+1805>: vpminsw zmm1{k1},zmm2,zmm0 0x0000000000006463 <+1811>: vpmaxsw zmm0,zmm3,zmm4 0x0000000000006469 <+1817>: mov eax,0xaaaccc88 0x000000000000646e <+1822>: kmovd k1,eax 0x0000000000006472 <+1826>: vpminsw zmm0{k1},zmm3,zmm4 0x0000000000006478 <+1832>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x573fe] # 0x5d880 0x0000000000006482 <+1842>: vpermi2w zmm2,zmm1,zmm0 0x0000000000006488 <+1848>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5742e] # 0x5d8c0 0x0000000000006492 <+1858>: vpermi2w zmm3,zmm0,zmm1 0x0000000000006498 <+1864>: vpmaxsw zmm4,zmm0,zmm3 0x000000000000649e <+1870>: mov eax,0xcaacaa88 0x00000000000064a3 <+1875>: kmovd k1,eax 0x00000000000064a7 <+1879>: vpminsw zmm4{k1},zmm0,zmm3 0x00000000000064ad <+1885>: vpmaxsw zmm0,zmm1,zmm2 0x00000000000064b3 <+1891>: mov eax,0xaacaac 0x00000000000064b8 <+1896>: kmovd k1,eax 0x00000000000064bc <+1900>: vpminsw zmm0{k1},zmm1,zmm2 0x00000000000064c2 <+1906>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57434] # 0x5d900 0x00000000000064cc <+1916>: vpermi2w zmm1,zmm0,zmm4 0x00000000000064d2 <+1922>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57464] # 0x5d940 0x00000000000064dc <+1932>: vpermi2w zmm2,zmm4,zmm0 0x00000000000064e2 <+1938>: vpmaxsw zmm3,zmm4,zmm2 0x00000000000064e8 <+1944>: mov eax,0xaccaccc8 0x00000000000064ed <+1949>: kmovd k1,eax 0x00000000000064f1 <+1953>: vpminsw zmm3{k1},zmm4,zmm2 0x00000000000064f7 <+1959>: vpmaxsw zmm2,zmm0,zmm1 0x00000000000064fd <+1965>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x574b9] # 0x5d9c0 0x0000000000006507 <+1975>: vpermi2w zmm4,zmm3,zmm2 0x000000000000650d <+1981>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm4 0x0000000000006515 <+1989>: mov eax,0x4ccacca 0x000000000000651a <+1994>: kmovd k1,eax 0x000000000000651e <+1998>: vpminsw zmm2{k1},zmm0,zmm1 0x0000000000006524 <+2004>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57452] # 0x5d980 0x000000000000652e <+2014>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm3 0x0000000000006536 <+2022>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm2 0x000000000000653e <+2030>: vpermi2w zmm0,zmm2,zmm3 0x0000000000006544 <+2036>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x000000000000654c <+2044>: mov rbx,QWORD PTR [rsp+0x40] 0x0000000000006551 <+2049>: mov rax,QWORD PTR [rsp+0x48] 0x0000000000006556 <+2054>: mov QWORD PTR [rsp+0x60],rax 0x000000000000655b <+2059>: vpxor xmm0,xmm0,xmm0 0x000000000000655f <+2063>: vmovdqa XMMWORD PTR [rsp+0x50],xmm0 0x0000000000006565 <+2069>: lea rsi,[rsp+0x50] 0x000000000000656a <+2074>: mov edi,0x1 0x000000000000656f <+2079>: vzeroupper 0x0000000000006572 <+2082>: call 0x5470 <clock_gettime@plt> 0x0000000000006577 <+2087>: mov r12,QWORD PTR [rsp+0x50] 0x000000000000657c <+2092>: sub r12,rbx 0x000000000000657f <+2095>: mov r13,QWORD PTR [rsp+0x58] 0x0000000000006584 <+2100>: mov edi,0x40 0x0000000000006589 <+2105>: call 0x8440 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000658e <+2110>: mov r14,rax 0x0000000000006591 <+2113>: test rax,rax 0x0000000000006594 <+2116>: jle 0x65ab <main+2139> 0x0000000000006596 <+2118>: mov edi,0x1 0x000000000000659b <+2123>: mov rsi,r14 0x000000000000659e <+2126>: call 0x2d990 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000065a3 <+2131>: mov r15,rax 0x00000000000065a6 <+2134>: mov rbx,r14 0x00000000000065a9 <+2137>: jmp 0x65b0 <main+2144> 0x00000000000065ab <+2139>: xor r15d,r15d 0x00000000000065ae <+2142>: xor ebx,ebx 0x00000000000065b0 <+2144>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x280] 0x00000000000065b8 <+2152>: vpmaxsw zmm0,zmm0,ZMMWORD PTR [rsp+0x2c0] 0x00000000000065c0 <+2160>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x00000000000065c8 <+2168>: mov eax,0xaaaaaaa 0x00000000000065cd <+2173>: kmovd k1,eax 0x00000000000065d1 <+2177>: kmovd DWORD PTR [rsp+0x3c],k1 0x00000000000065d8 <+2184>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x300] 0x00000000000065e0 <+2192>: vpmaxsw zmm0,zmm0,ZMMWORD PTR [rsp+0x340] 0x00000000000065e8 <+2200>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x00000000000065f0 <+2208>: mov eax,0xaaaaaaa8 0x00000000000065f5 <+2213>: kmovd k1,eax 0x00000000000065f9 <+2217>: kmovd DWORD PTR [rsp+0x38],k1 0x0000000000006600 <+2224>: imul r12,r12,0x3b9aca00 0x0000000000006607 <+2231>: sub r13,QWORD PTR [rsp+0x60] 0x000000000000660c <+2236>: lea rdx,[rip+0x573ed] # 0x5da00 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006613 <+2243>: mov ecx,0x40 0x0000000000006618 <+2248>: mov rdi,r15 0x000000000000661b <+2251>: mov rsi,r14 0x000000000000661e <+2254>: xor eax,eax 0x0000000000006620 <+2256>: vzeroupper 0x0000000000006623 <+2259>: call 0x57c0 <snprintf@plt> 0x0000000000006628 <+2264>: cdqe 0x000000000000662a <+2266>: inc rax 0x000000000000662d <+2269>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000006635 <+2277>: mov QWORD PTR [rsp+0xa8],rax 0x000000000000663d <+2285>: mov QWORD PTR [rsp+0xb0],rbx 0x0000000000006645 <+2293>: lea rdx,[rip+0x573d4] # 0x5da20 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x000000000000664c <+2300>: lea rdi,[rsp+0x1d8] 0x0000000000006654 <+2308>: lea rsi,[rsp+0xa0] 0x000000000000665c <+2316>: mov ecx,0x6 0x0000000000006661 <+2321>: call 0xda90 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006666 <+2326>: mov rdi,QWORD PTR [rsp+0xa0] 0x000000000000666e <+2334>: test rdi,rdi 0x0000000000006671 <+2337>: je 0x6678 <main+2344> 0x0000000000006673 <+2339>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006678 <+2344>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000006680 <+2352>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x280] 0x0000000000006688 <+2360>: kmovd k1,DWORD PTR [rsp+0x3c] 0x000000000000668f <+2367>: vpminsw zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x2c0] 0x0000000000006697 <+2375>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x000000000000669f <+2383>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x00000000000066a7 <+2391>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x300] 0x00000000000066af <+2399>: kmovd k1,DWORD PTR [rsp+0x38] 0x00000000000066b6 <+2406>: vpminsw zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x340] 0x00000000000066be <+2414>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x00000000000066c6 <+2422>: add r13,r12 0x00000000000066c9 <+2425>: mov edi,0x1 0x00000000000066ce <+2430>: mov esi,0x3 0x00000000000066d3 <+2435>: vzeroupper 0x00000000000066d6 <+2438>: call 0x2d990 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000066db <+2443>: xor ecx,ecx 0x00000000000066dd <+2445>: nop DWORD PTR [rax] 0x00000000000066e0 <+2448>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000066e4 <+2452>: inc rcx 0x00000000000066e7 <+2455>: cmp rcx,0x3 0x00000000000066eb <+2459>: jne 0x66e0 <main+2448> 0x00000000000066ed <+2461>: mov WORD PTR [rax],0x203a 0x00000000000066f2 <+2466>: mov BYTE PTR [rax+0x2],0x0 0x00000000000066f6 <+2470>: mov QWORD PTR [rsp+0xb8],rax 0x00000000000066fe <+2478>: mov QWORD PTR [rsp+0xc0],0x3 0x000000000000670a <+2490>: mov QWORD PTR [rsp+0xc8],0x3 0x0000000000006716 <+2502>: lea rdi,[rsp+0x1f0] 0x000000000000671e <+2510>: lea rsi,[rsp+0x1d8] 0x0000000000006726 <+2518>: lea rdx,[rsp+0xb8] 0x000000000000672e <+2526>: call 0xd650 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006733 <+2531>: mov rdi,QWORD PTR [rsp+0xb8] 0x000000000000673b <+2539>: test rdi,rdi 0x000000000000673e <+2542>: je 0x6745 <main+2549> 0x0000000000006740 <+2544>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006745 <+2549>: mov rdi,QWORD PTR [rsp+0x1d8] 0x000000000000674d <+2557>: test rdi,rdi 0x0000000000006750 <+2560>: je 0x6757 <main+2567> 0x0000000000006752 <+2562>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006757 <+2567>: lea r14,[rsp+0x268] 0x000000000000675f <+2575>: mov rdi,r14 0x0000000000006762 <+2578>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x000000000000676a <+2586>: vmovaps zmm1,ZMMWORD PTR [rsp+0x140] 0x0000000000006772 <+2594>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=64> 0x0000000000006777 <+2599>: lea rdi,[rsp+0x208] 0x000000000000677f <+2607>: lea rsi,[rsp+0x1f0] 0x0000000000006787 <+2615>: mov rdx,r14 0x000000000000678a <+2618>: vzeroupper 0x000000000000678d <+2621>: call 0xd650 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006792 <+2626>: mov rdi,QWORD PTR [rsp+0x268] 0x000000000000679a <+2634>: test rdi,rdi 0x000000000000679d <+2637>: je 0x67a4 <main+2644> 0x000000000000679f <+2639>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000067a4 <+2644>: mov rdi,QWORD PTR [rsp+0x1f0] 0x00000000000067ac <+2652>: test rdi,rdi 0x00000000000067af <+2655>: je 0x67b6 <main+2662> 0x00000000000067b1 <+2657>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000067b6 <+2662>: lea rdi,[rsp+0x208] 0x00000000000067be <+2670>: call 0x8ef0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000067c3 <+2675>: mov rdi,QWORD PTR [rsp+0x208] 0x00000000000067cb <+2683>: test rdi,rdi 0x00000000000067ce <+2686>: je 0x67d5 <main+2693> 0x00000000000067d0 <+2688>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000067d5 <+2693>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x00000000000067dd <+2701>: vpaddw zmm0,zmm0,ZMMWORD PTR [rsp+0x140] 0x00000000000067e5 <+2709>: vextracti64x4 ymm1,zmm0,0x1 0x00000000000067ec <+2716>: vpaddw ymm0,ymm0,ymm1 0x00000000000067f0 <+2720>: vextracti128 xmm1,ymm0,0x1 0x00000000000067f6 <+2726>: vpaddw xmm0,xmm0,xmm1 0x00000000000067fa <+2730>: vpshufd xmm1,xmm0,0xee 0x00000000000067ff <+2735>: vpaddw xmm0,xmm0,xmm1 0x0000000000006803 <+2739>: vpshufd xmm1,xmm0,0x55 0x0000000000006808 <+2744>: vpaddw xmm0,xmm0,xmm1 0x000000000000680c <+2748>: vpsrld xmm1,xmm0,0x10 0x0000000000006811 <+2753>: vpaddw xmm0,xmm0,xmm1 0x0000000000006815 <+2757>: vmovw eax,xmm0 0x000000000000681b <+2763>: vmovw WORD PTR [rsp+0x36],xmm0 0x0000000000006823 <+2771>: lea rcx,[rsp+0x36] 0x0000000000006828 <+2776>: mov QWORD PTR [rsp+0x68],rcx 0x000000000000682d <+2781>: mov rdi,r13 0x0000000000006830 <+2784>: vzeroupper 0x0000000000006833 <+2787>: call 0x8440 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006838 <+2792>: mov r14,rax 0x000000000000683b <+2795>: test rax,rax 0x000000000000683e <+2798>: jle 0x6855 <main+2821> 0x0000000000006840 <+2800>: mov edi,0x1 0x0000000000006845 <+2805>: mov rsi,r14 0x0000000000006848 <+2808>: call 0x2d990 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000684d <+2813>: mov r15,rax 0x0000000000006850 <+2816>: mov rbx,r14 0x0000000000006853 <+2819>: jmp 0x685a <main+2826> 0x0000000000006855 <+2821>: xor r15d,r15d 0x0000000000006858 <+2824>: xor ebx,ebx 0x000000000000685a <+2826>: lea rdx,[rip+0x5719f] # 0x5da00 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006861 <+2833>: mov rdi,r15 0x0000000000006864 <+2836>: mov rsi,r14 0x0000000000006867 <+2839>: mov rcx,r13 0x000000000000686a <+2842>: xor eax,eax 0x000000000000686c <+2844>: call 0x57c0 <snprintf@plt> 0x0000000000006871 <+2849>: cdqe 0x0000000000006873 <+2851>: inc rax 0x0000000000006876 <+2854>: mov QWORD PTR [rsp+0xd0],r15 0x000000000000687e <+2862>: mov QWORD PTR [rsp+0xd8],rax 0x0000000000006886 <+2870>: mov QWORD PTR [rsp+0xe0],rbx 0x000000000000688e <+2878>: lea rdx,[rip+0x5719b] # 0x5da30 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x0000000000006895 <+2885>: lea rdi,[rsp+0x220] 0x000000000000689d <+2893>: lea rsi,[rsp+0xd0] 0x00000000000068a5 <+2901>: mov ecx,0xb 0x00000000000068aa <+2906>: call 0xda90 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000068af <+2911>: mov rdi,QWORD PTR [rsp+0xd0] 0x00000000000068b7 <+2919>: test rdi,rdi 0x00000000000068ba <+2922>: je 0x68c1 <main+2929> 0x00000000000068bc <+2924>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000068c1 <+2929>: mov edi,0x1 0x00000000000068c6 <+2934>: mov esi,0x4 0x00000000000068cb <+2939>: call 0x2d990 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000068d0 <+2944>: xor ecx,ecx 0x00000000000068d2 <+2946>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x00000000000068e0 <+2960>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000068e4 <+2964>: inc rcx 0x00000000000068e7 <+2967>: cmp rcx,0x4 0x00000000000068eb <+2971>: jne 0x68e0 <main+2960> 0x00000000000068ed <+2973>: mov DWORD PTR [rax],0x736e20 0x00000000000068f3 <+2979>: mov QWORD PTR [rsp+0xe8],rax 0x00000000000068fb <+2987>: mov QWORD PTR [rsp+0xf0],0x4 0x0000000000006907 <+2999>: mov QWORD PTR [rsp+0xf8],0x4 0x0000000000006913 <+3011>: lea rdi,[rsp+0x238] 0x000000000000691b <+3019>: lea rsi,[rsp+0x220] 0x0000000000006923 <+3027>: lea rdx,[rsp+0xe8] 0x000000000000692b <+3035>: call 0xd650 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006930 <+3040>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000006938 <+3048>: test rdi,rdi 0x000000000000693b <+3051>: je 0x6942 <main+3058> 0x000000000000693d <+3053>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006942 <+3058>: mov rdi,QWORD PTR [rsp+0x220] 0x000000000000694a <+3066>: test rdi,rdi 0x000000000000694d <+3069>: je 0x6954 <main+3076> 0x000000000000694f <+3071>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006954 <+3076>: lea rdi,[rsp+0x238] 0x000000000000695c <+3084>: call 0x8ef0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006961 <+3089>: mov rdi,QWORD PTR [rsp+0x238] 0x0000000000006969 <+3097>: test rdi,rdi 0x000000000000696c <+3100>: je 0x6973 <main+3107> 0x000000000000696e <+3102>: call 0x2d9b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006973 <+3107>: call 0x29db0 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006978 <+3112>: xor eax,eax 0x000000000000697a <+3114>: lea rsp,[rbp-0x28] 0x000000000000697e <+3118>: pop rbx 0x000000000000697f <+3119>: pop r12 0x0000000000006981 <+3121>: pop r13 0x0000000000006983 <+3123>: pop r14 0x0000000000006985 <+3125>: pop r15 0x0000000000006987 <+3127>: pop rbp 0x0000000000006988 <+3128>: ret End of assembler dump. --- disassemble/int16_8.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d10 <+0>: push rbp 0x0000000000005d11 <+1>: push r15 0x0000000000005d13 <+3>: push r14 0x0000000000005d15 <+5>: push r13 0x0000000000005d17 <+7>: push r12 0x0000000000005d19 <+9>: push rbx 0x0000000000005d1a <+10>: sub rsp,0x1e8 0x0000000000005d21 <+17>: call 0x2eef0 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d26 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d2a <+26>: mov ebx,0x9 0x0000000000005d2f <+31>: xor r14d,r14d 0x0000000000005d32 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005d40 <+48>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x0000000000005d46 <+54>: call 0x2de40 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d4b <+59>: mov edx,0x64 0x0000000000005d50 <+64>: mov rdi,rax 0x0000000000005d53 <+67>: xor esi,esi 0x0000000000005d55 <+69>: call 0x2e250 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005d5a <+74>: vpbroadcastw xmm0,r14d 0x0000000000005d60 <+80>: vpcmpeqw k1,xmm0,XMMWORD PTR [rip+0x56386] # 0x5c0f0 0x0000000000005d6a <+90>: vmovdqa xmm0,XMMWORD PTR [rsp+0x10] 0x0000000000005d70 <+96>: vpbroadcastw xmm0{k1},eax 0x0000000000005d76 <+102>: dec rbx 0x0000000000005d79 <+105>: inc r14 0x0000000000005d7c <+108>: cmp rbx,0x1 0x0000000000005d80 <+112>: ja 0x5d40 <main+48> 0x0000000000005d82 <+114>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x0000000000005d88 <+120>: mov edi,0x8 0x0000000000005d8d <+125>: call 0x7dd0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005d92 <+130>: mov rbx,rax 0x0000000000005d95 <+133>: test rax,rax 0x0000000000005d98 <+136>: jle 0x5daf <main+159> 0x0000000000005d9a <+138>: mov edi,0x1 0x0000000000005d9f <+143>: mov rsi,rbx 0x0000000000005da2 <+146>: call 0x2d320 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005da7 <+151>: mov r14,rax 0x0000000000005daa <+154>: mov r15,rbx 0x0000000000005dad <+157>: jmp 0x5db5 <main+165> 0x0000000000005daf <+159>: xor r14d,r14d 0x0000000000005db2 <+162>: xor r15d,r15d 0x0000000000005db5 <+165>: lea rdx,[rip+0x56374] # 0x5c130 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005dbc <+172>: mov ecx,0x8 0x0000000000005dc1 <+177>: mov rdi,r14 0x0000000000005dc4 <+180>: mov rsi,rbx 0x0000000000005dc7 <+183>: xor eax,eax 0x0000000000005dc9 <+185>: call 0x57c0 <snprintf@plt> 0x0000000000005dce <+190>: cdqe 0x0000000000005dd0 <+192>: inc rax 0x0000000000005dd3 <+195>: mov QWORD PTR [rsp+0x50],r14 0x0000000000005dd8 <+200>: mov QWORD PTR [rsp+0x58],rax 0x0000000000005ddd <+205>: mov QWORD PTR [rsp+0x60],r15 0x0000000000005de2 <+210>: lea rdx,[rip+0x56357] # 0x5c140 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005de9 <+217>: lea rdi,[rsp+0xf8] 0x0000000000005df1 <+225>: lea rsi,[rsp+0x50] 0x0000000000005df6 <+230>: mov ecx,0x7 0x0000000000005dfb <+235>: call 0xd420 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e00 <+240>: mov rdi,QWORD PTR [rsp+0x50] 0x0000000000005e05 <+245>: test rdi,rdi 0x0000000000005e08 <+248>: je 0x5e0f <main+255> 0x0000000000005e0a <+250>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e0f <+255>: mov edi,0x1 0x0000000000005e14 <+260>: mov esi,0x3 0x0000000000005e19 <+265>: call 0x2d320 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e1e <+270>: xor ecx,ecx 0x0000000000005e20 <+272>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005e24 <+276>: inc rcx 0x0000000000005e27 <+279>: cmp rcx,0x3 0x0000000000005e2b <+283>: jne 0x5e20 <main+272> 0x0000000000005e2d <+285>: mov WORD PTR [rax],0x203a 0x0000000000005e32 <+290>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005e36 <+294>: mov QWORD PTR [rsp+0x68],rax 0x0000000000005e3b <+299>: mov QWORD PTR [rsp+0x70],0x3 0x0000000000005e44 <+308>: mov QWORD PTR [rsp+0x78],0x3 0x0000000000005e4d <+317>: lea rdi,[rsp+0x110] 0x0000000000005e55 <+325>: lea rsi,[rsp+0xf8] 0x0000000000005e5d <+333>: lea rdx,[rsp+0x68] 0x0000000000005e62 <+338>: call 0xcfe0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005e67 <+343>: mov rdi,QWORD PTR [rsp+0x68] 0x0000000000005e6c <+348>: test rdi,rdi 0x0000000000005e6f <+351>: je 0x5e76 <main+358> 0x0000000000005e71 <+353>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e76 <+358>: mov rdi,QWORD PTR [rsp+0xf8] 0x0000000000005e7e <+366>: test rdi,rdi 0x0000000000005e81 <+369>: je 0x5e88 <main+376> 0x0000000000005e83 <+371>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e88 <+376>: lea rbx,[rsp+0x1b8] 0x0000000000005e90 <+384>: mov rdi,rbx 0x0000000000005e93 <+387>: vmovaps xmm0,XMMWORD PTR [rsp+0x10] 0x0000000000005e99 <+393>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=8> 0x0000000000005e9e <+398>: lea rdi,[rsp+0x128] 0x0000000000005ea6 <+406>: lea rsi,[rsp+0x110] 0x0000000000005eae <+414>: mov rdx,rbx 0x0000000000005eb1 <+417>: call 0xcfe0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005eb6 <+422>: mov rdi,QWORD PTR [rsp+0x1b8] 0x0000000000005ebe <+430>: test rdi,rdi 0x0000000000005ec1 <+433>: je 0x5ec8 <main+440> 0x0000000000005ec3 <+435>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ec8 <+440>: mov rdi,QWORD PTR [rsp+0x110] 0x0000000000005ed0 <+448>: test rdi,rdi 0x0000000000005ed3 <+451>: je 0x5eda <main+458> 0x0000000000005ed5 <+453>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005eda <+458>: lea rdi,[rsp+0x128] 0x0000000000005ee2 <+466>: call 0x8880 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005ee7 <+471>: mov rdi,QWORD PTR [rsp+0x128] 0x0000000000005eef <+479>: test rdi,rdi 0x0000000000005ef2 <+482>: je 0x5ef9 <main+489> 0x0000000000005ef4 <+484>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ef9 <+489>: vxorps xmm0,xmm0,xmm0 0x0000000000005efd <+493>: vmovaps XMMWORD PTR [rsp+0x20],xmm0 0x0000000000005f03 <+499>: lea rsi,[rsp+0x20] 0x0000000000005f08 <+504>: mov edi,0x1 0x0000000000005f0d <+509>: call 0x5470 <clock_gettime@plt> 0x0000000000005f12 <+514>: mov rbx,QWORD PTR [rsp+0x20] 0x0000000000005f17 <+519>: mov r12,QWORD PTR [rsp+0x28] 0x0000000000005f1c <+524>: vmovdqa xmm2,XMMWORD PTR [rsp+0x10] 0x0000000000005f22 <+530>: vpshufd xmm0,xmm2,0xb1 0x0000000000005f27 <+535>: vpminsw xmm1,xmm2,xmm0 0x0000000000005f2b <+539>: vpmaxsw xmm0,xmm2,xmm0 0x0000000000005f2f <+543>: vpblendd xmm0,xmm1,xmm0,0xa 0x0000000000005f35 <+549>: vpshufd xmm1,xmm0,0x4e 0x0000000000005f3a <+554>: vpminsw xmm2,xmm0,xmm1 0x0000000000005f3e <+558>: vpmaxsw xmm0,xmm0,xmm1 0x0000000000005f42 <+562>: vpblendd xmm0,xmm2,xmm0,0xc 0x0000000000005f48 <+568>: vprold xmm1,xmm0,0x10 0x0000000000005f4f <+575>: vpminsw xmm2,xmm0,xmm1 0x0000000000005f53 <+579>: vpmaxsw xmm0,xmm0,xmm1 0x0000000000005f57 <+583>: vpblendw xmm0,xmm2,xmm0,0xaa 0x0000000000005f5d <+589>: vpshufd xmm1,xmm0,0xd8 0x0000000000005f62 <+594>: vpminsw xmm2,xmm0,xmm1 0x0000000000005f66 <+598>: vpmaxsw xmm0,xmm0,xmm1 0x0000000000005f6a <+602>: vpblendd xmm0,xmm0,xmm2,0x2 0x0000000000005f70 <+608>: vpshufb xmm1,xmm0,XMMWORD PTR [rip+0x56187] # 0x5c100 0x0000000000005f79 <+617>: vpminsw xmm2,xmm0,xmm1 0x0000000000005f7d <+621>: vpmaxsw xmm0,xmm0,xmm1 0x0000000000005f81 <+625>: vpblendw xmm0,xmm0,xmm2,0xa 0x0000000000005f87 <+631>: vpshufb xmm1,xmm0,XMMWORD PTR [rip+0x56180] # 0x5c110 0x0000000000005f90 <+640>: vpminsw xmm2,xmm0,xmm1 0x0000000000005f94 <+644>: vmovdqa XMMWORD PTR [rsp+0x10],xmm2 0x0000000000005f9a <+650>: vpmaxsw xmm0,xmm0,xmm1 0x0000000000005f9e <+654>: vmovdqa XMMWORD PTR [rsp+0xe0],xmm0 0x0000000000005fa7 <+663>: vpxor xmm0,xmm0,xmm0 0x0000000000005fab <+667>: vmovdqa XMMWORD PTR [rsp+0x30],xmm0 0x0000000000005fb1 <+673>: lea rsi,[rsp+0x30] 0x0000000000005fb6 <+678>: mov edi,0x1 0x0000000000005fbb <+683>: call 0x5470 <clock_gettime@plt> 0x0000000000005fc0 <+688>: mov r13,QWORD PTR [rsp+0x30] 0x0000000000005fc5 <+693>: sub r13,rbx 0x0000000000005fc8 <+696>: mov rbx,QWORD PTR [rsp+0x38] 0x0000000000005fcd <+701>: mov edi,0x8 0x0000000000005fd2 <+706>: call 0x7dd0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005fd7 <+711>: mov r14,rax 0x0000000000005fda <+714>: test rax,rax 0x0000000000005fdd <+717>: jle 0x5ff4 <main+740> 0x0000000000005fdf <+719>: mov edi,0x1 0x0000000000005fe4 <+724>: mov rsi,r14 0x0000000000005fe7 <+727>: call 0x2d320 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005fec <+732>: mov r15,rax 0x0000000000005fef <+735>: mov rbp,r14 0x0000000000005ff2 <+738>: jmp 0x5ff9 <main+745> 0x0000000000005ff4 <+740>: xor r15d,r15d 0x0000000000005ff7 <+743>: xor ebp,ebp 0x0000000000005ff9 <+745>: vmovdqa xmm0,XMMWORD PTR [rsp+0xe0] 0x0000000000006002 <+754>: vpblendw xmm0,xmm0,XMMWORD PTR [rsp+0x10],0x2a 0x000000000000600a <+762>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x0000000000006010 <+768>: imul r13,r13,0x3b9aca00 0x0000000000006017 <+775>: sub rbx,r12 0x000000000000601a <+778>: lea rdx,[rip+0x5610f] # 0x5c130 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006021 <+785>: mov ecx,0x8 0x0000000000006026 <+790>: mov rdi,r15 0x0000000000006029 <+793>: mov rsi,r14 0x000000000000602c <+796>: xor eax,eax 0x000000000000602e <+798>: call 0x57c0 <snprintf@plt> 0x0000000000006033 <+803>: cdqe 0x0000000000006035 <+805>: inc rax 0x0000000000006038 <+808>: mov QWORD PTR [rsp+0x80],r15 0x0000000000006040 <+816>: mov QWORD PTR [rsp+0x88],rax 0x0000000000006048 <+824>: mov QWORD PTR [rsp+0x90],rbp 0x0000000000006050 <+832>: lea rdx,[rip+0x560f9] # 0x5c150 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x0000000000006057 <+839>: lea rdi,[rsp+0x140] 0x000000000000605f <+847>: lea rsi,[rsp+0x80] 0x0000000000006067 <+855>: mov ecx,0x6 0x000000000000606c <+860>: call 0xd420 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006071 <+865>: mov rdi,QWORD PTR [rsp+0x80] 0x0000000000006079 <+873>: test rdi,rdi 0x000000000000607c <+876>: je 0x6083 <main+883> 0x000000000000607e <+878>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006083 <+883>: add rbx,r13 0x0000000000006086 <+886>: mov edi,0x1 0x000000000000608b <+891>: mov esi,0x3 0x0000000000006090 <+896>: call 0x2d320 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006095 <+901>: xor ecx,ecx 0x0000000000006097 <+903>: nop WORD PTR [rax+rax*1+0x0] 0x00000000000060a0 <+912>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000060a4 <+916>: inc rcx 0x00000000000060a7 <+919>: cmp rcx,0x3 0x00000000000060ab <+923>: jne 0x60a0 <main+912> 0x00000000000060ad <+925>: mov WORD PTR [rax],0x203a 0x00000000000060b2 <+930>: mov BYTE PTR [rax+0x2],0x0 0x00000000000060b6 <+934>: mov QWORD PTR [rsp+0x98],rax 0x00000000000060be <+942>: mov QWORD PTR [rsp+0xa0],0x3 0x00000000000060ca <+954>: mov QWORD PTR [rsp+0xa8],0x3 0x00000000000060d6 <+966>: lea rdi,[rsp+0x158] 0x00000000000060de <+974>: lea rsi,[rsp+0x140] 0x00000000000060e6 <+982>: lea rdx,[rsp+0x98] 0x00000000000060ee <+990>: call 0xcfe0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000060f3 <+995>: mov rdi,QWORD PTR [rsp+0x98] 0x00000000000060fb <+1003>: test rdi,rdi 0x00000000000060fe <+1006>: je 0x6105 <main+1013> 0x0000000000006100 <+1008>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006105 <+1013>: mov rdi,QWORD PTR [rsp+0x140] 0x000000000000610d <+1021>: test rdi,rdi 0x0000000000006110 <+1024>: je 0x6117 <main+1031> 0x0000000000006112 <+1026>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006117 <+1031>: lea r14,[rsp+0x1d0] 0x000000000000611f <+1039>: mov rdi,r14 0x0000000000006122 <+1042>: vmovaps xmm0,XMMWORD PTR [rsp+0x10] 0x0000000000006128 <+1048>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si16,_74x26_size=8> 0x000000000000612d <+1053>: lea rdi,[rsp+0x170] 0x0000000000006135 <+1061>: lea rsi,[rsp+0x158] 0x000000000000613d <+1069>: mov rdx,r14 0x0000000000006140 <+1072>: call 0xcfe0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006145 <+1077>: mov rdi,QWORD PTR [rsp+0x1d0] 0x000000000000614d <+1085>: test rdi,rdi 0x0000000000006150 <+1088>: je 0x6157 <main+1095> 0x0000000000006152 <+1090>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006157 <+1095>: mov rdi,QWORD PTR [rsp+0x158] 0x000000000000615f <+1103>: test rdi,rdi 0x0000000000006162 <+1106>: je 0x6169 <main+1113> 0x0000000000006164 <+1108>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006169 <+1113>: lea rdi,[rsp+0x170] 0x0000000000006171 <+1121>: call 0x8880 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006176 <+1126>: mov rdi,QWORD PTR [rsp+0x170] 0x000000000000617e <+1134>: test rdi,rdi 0x0000000000006181 <+1137>: je 0x6188 <main+1144> 0x0000000000006183 <+1139>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006188 <+1144>: vmovdqa xmm1,XMMWORD PTR [rsp+0x10] 0x000000000000618e <+1150>: vpshufd xmm0,xmm1,0xee 0x0000000000006193 <+1155>: vpaddw xmm0,xmm1,xmm0 0x0000000000006197 <+1159>: vpshufd xmm1,xmm0,0x55 0x000000000000619c <+1164>: vpaddw xmm0,xmm0,xmm1 0x00000000000061a0 <+1168>: vpsrld xmm1,xmm0,0x10 0x00000000000061a5 <+1173>: vpaddw xmm0,xmm0,xmm1 0x00000000000061a9 <+1177>: vmovw eax,xmm0 0x00000000000061af <+1183>: vmovw WORD PTR [rsp+0xe],xmm0 0x00000000000061b7 <+1191>: lea rcx,[rsp+0xe] 0x00000000000061bc <+1196>: mov QWORD PTR [rsp+0x48],rcx 0x00000000000061c1 <+1201>: mov rdi,rbx 0x00000000000061c4 <+1204>: call 0x7dd0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000061c9 <+1209>: mov r14,rax 0x00000000000061cc <+1212>: test rax,rax 0x00000000000061cf <+1215>: jle 0x61e6 <main+1238> 0x00000000000061d1 <+1217>: mov edi,0x1 0x00000000000061d6 <+1222>: mov rsi,r14 0x00000000000061d9 <+1225>: call 0x2d320 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000061de <+1230>: mov r15,rax 0x00000000000061e1 <+1233>: mov r12,r14 0x00000000000061e4 <+1236>: jmp 0x61ec <main+1244> 0x00000000000061e6 <+1238>: xor r15d,r15d 0x00000000000061e9 <+1241>: xor r12d,r12d 0x00000000000061ec <+1244>: lea rdx,[rip+0x55f3d] # 0x5c130 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000061f3 <+1251>: mov rdi,r15 0x00000000000061f6 <+1254>: mov rsi,r14 0x00000000000061f9 <+1257>: mov rcx,rbx 0x00000000000061fc <+1260>: xor eax,eax 0x00000000000061fe <+1262>: call 0x57c0 <snprintf@plt> 0x0000000000006203 <+1267>: cdqe 0x0000000000006205 <+1269>: inc rax 0x0000000000006208 <+1272>: mov QWORD PTR [rsp+0xb0],r15 0x0000000000006210 <+1280>: mov QWORD PTR [rsp+0xb8],rax 0x0000000000006218 <+1288>: mov QWORD PTR [rsp+0xc0],r12 0x0000000000006220 <+1296>: lea rdx,[rip+0x55f39] # 0x5c160 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x0000000000006227 <+1303>: lea rdi,[rsp+0x188] 0x000000000000622f <+1311>: lea rsi,[rsp+0xb0] 0x0000000000006237 <+1319>: mov ecx,0xb 0x000000000000623c <+1324>: call 0xd420 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006241 <+1329>: mov rdi,QWORD PTR [rsp+0xb0] 0x0000000000006249 <+1337>: test rdi,rdi 0x000000000000624c <+1340>: je 0x6253 <main+1347> 0x000000000000624e <+1342>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006253 <+1347>: mov edi,0x1 0x0000000000006258 <+1352>: mov esi,0x4 0x000000000000625d <+1357>: call 0x2d320 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006262 <+1362>: xor ecx,ecx 0x0000000000006264 <+1364>: data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006270 <+1376>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006274 <+1380>: inc rcx 0x0000000000006277 <+1383>: cmp rcx,0x4 0x000000000000627b <+1387>: jne 0x6270 <main+1376> 0x000000000000627d <+1389>: mov DWORD PTR [rax],0x736e20 0x0000000000006283 <+1395>: mov QWORD PTR [rsp+0xc8],rax 0x000000000000628b <+1403>: mov QWORD PTR [rsp+0xd0],0x4 0x0000000000006297 <+1415>: mov QWORD PTR [rsp+0xd8],0x4 0x00000000000062a3 <+1427>: lea rdi,[rsp+0x1a0] 0x00000000000062ab <+1435>: lea rsi,[rsp+0x188] 0x00000000000062b3 <+1443>: lea rdx,[rsp+0xc8] 0x00000000000062bb <+1451>: call 0xcfe0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000062c0 <+1456>: mov rdi,QWORD PTR [rsp+0xc8] 0x00000000000062c8 <+1464>: test rdi,rdi 0x00000000000062cb <+1467>: je 0x62d2 <main+1474> 0x00000000000062cd <+1469>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000062d2 <+1474>: mov rdi,QWORD PTR [rsp+0x188] 0x00000000000062da <+1482>: test rdi,rdi 0x00000000000062dd <+1485>: je 0x62e4 <main+1492> 0x00000000000062df <+1487>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000062e4 <+1492>: lea rdi,[rsp+0x1a0] 0x00000000000062ec <+1500>: call 0x8880 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000062f1 <+1505>: mov rdi,QWORD PTR [rsp+0x1a0] 0x00000000000062f9 <+1513>: test rdi,rdi 0x00000000000062fc <+1516>: je 0x6303 <main+1523> 0x00000000000062fe <+1518>: call 0x2d340 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006303 <+1523>: call 0x29740 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006308 <+1528>: xor eax,eax 0x000000000000630a <+1530>: add rsp,0x1e8 0x0000000000006311 <+1537>: pop rbx 0x0000000000006312 <+1538>: pop r12 0x0000000000006314 <+1540>: pop r13 0x0000000000006316 <+1542>: pop r14 0x0000000000006318 <+1544>: pop r15 0x000000000000631a <+1546>: pop rbp 0x000000000000631b <+1547>: ret End of assembler dump. --- disassemble/int32_128.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005e10 <+0>: push rbp 0x0000000000005e11 <+1>: mov rbp,rsp 0x0000000000005e14 <+4>: push r15 0x0000000000005e16 <+6>: push r14 0x0000000000005e18 <+8>: push r13 0x0000000000005e1a <+10>: push r12 0x0000000000005e1c <+12>: push rbx 0x0000000000005e1d <+13>: and rsp,0xffffffffffffffc0 0x0000000000005e21 <+17>: sub rsp,0xa40 0x0000000000005e28 <+24>: call 0x31170 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005e2d <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005e31 <+33>: mov ebx,0x81 0x0000000000005e36 <+38>: xor r14d,r14d 0x0000000000005e39 <+41>: vxorps xmm5,xmm5,xmm5 0x0000000000005e3d <+45>: vxorps xmm6,xmm6,xmm6 0x0000000000005e41 <+49>: vxorps xmm7,xmm7,xmm7 0x0000000000005e45 <+53>: vxorps xmm4,xmm4,xmm4 0x0000000000005e49 <+57>: vxorps xmm3,xmm3,xmm3 0x0000000000005e4d <+61>: vxorps xmm2,xmm2,xmm2 0x0000000000005e51 <+65>: vxorps xmm1,xmm1,xmm1 0x0000000000005e55 <+69>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005e60 <+80>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm5 0x0000000000005e68 <+88>: vmovaps ZMMWORD PTR [rsp+0x200],zmm6 0x0000000000005e70 <+96>: vmovaps ZMMWORD PTR [rsp+0x2c0],zmm0 0x0000000000005e78 <+104>: vmovaps ZMMWORD PTR [rsp+0x180],zmm7 0x0000000000005e80 <+112>: vmovaps ZMMWORD PTR [rsp+0x140],zmm4 0x0000000000005e88 <+120>: vmovaps ZMMWORD PTR [rsp+0x100],zmm3 0x0000000000005e90 <+128>: vmovaps ZMMWORD PTR [rsp+0x280],zmm2 0x0000000000005e98 <+136>: vmovaps ZMMWORD PTR [rsp+0x240],zmm1 0x0000000000005ea0 <+144>: vzeroupper 0x0000000000005ea3 <+147>: call 0x300c0 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005ea8 <+152>: mov edx,0x64 0x0000000000005ead <+157>: mov rdi,rax 0x0000000000005eb0 <+160>: xor esi,esi 0x0000000000005eb2 <+162>: call 0x304d0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005eb7 <+167>: vmovaps zmm0,ZMMWORD PTR [rsp+0x2c0] 0x0000000000005ebf <+175>: vmovaps ZMMWORD PTR [rsp+0x800],zmm0 0x0000000000005ec7 <+183>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000005ecf <+191>: vmovaps ZMMWORD PTR [rsp+0x840],zmm0 0x0000000000005ed7 <+199>: vmovaps zmm0,ZMMWORD PTR [rsp+0x200] 0x0000000000005edf <+207>: vmovaps ZMMWORD PTR [rsp+0x880],zmm0 0x0000000000005ee7 <+215>: vmovaps zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000005eef <+223>: vmovaps ZMMWORD PTR [rsp+0x8c0],zmm0 0x0000000000005ef7 <+231>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005eff <+239>: vmovaps ZMMWORD PTR [rsp+0x900],zmm0 0x0000000000005f07 <+247>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005f0f <+255>: vmovaps ZMMWORD PTR [rsp+0x940],zmm0 0x0000000000005f17 <+263>: vmovaps zmm0,ZMMWORD PTR [rsp+0x280] 0x0000000000005f1f <+271>: vmovaps ZMMWORD PTR [rsp+0x980],zmm0 0x0000000000005f27 <+279>: vmovaps zmm0,ZMMWORD PTR [rsp+0x240] 0x0000000000005f2f <+287>: vmovaps ZMMWORD PTR [rsp+0x9c0],zmm0 0x0000000000005f37 <+295>: mov ecx,r14d 0x0000000000005f3a <+298>: and ecx,0x7f 0x0000000000005f3d <+301>: mov DWORD PTR [rsp+rcx*4+0x800],eax 0x0000000000005f44 <+308>: vmovaps zmm1,ZMMWORD PTR [rsp+0x9c0] 0x0000000000005f4c <+316>: vmovaps zmm2,ZMMWORD PTR [rsp+0x980] 0x0000000000005f54 <+324>: vmovaps zmm3,ZMMWORD PTR [rsp+0x940] 0x0000000000005f5c <+332>: vmovaps zmm4,ZMMWORD PTR [rsp+0x900] 0x0000000000005f64 <+340>: vmovaps zmm0,ZMMWORD PTR [rsp+0x800] 0x0000000000005f6c <+348>: vmovaps zmm5,ZMMWORD PTR [rsp+0x840] 0x0000000000005f74 <+356>: vmovaps zmm6,ZMMWORD PTR [rsp+0x880] 0x0000000000005f7c <+364>: vmovaps zmm7,ZMMWORD PTR [rsp+0x8c0] 0x0000000000005f84 <+372>: dec rbx 0x0000000000005f87 <+375>: inc r14 0x0000000000005f8a <+378>: cmp rbx,0x1 0x0000000000005f8e <+382>: ja 0x5e60 <main+80> 0x0000000000005f94 <+388>: vmovaps ZMMWORD PTR [rsp+0x100],zmm3 0x0000000000005f9c <+396>: vmovaps ZMMWORD PTR [rsp+0x140],zmm4 0x0000000000005fa4 <+404>: vmovaps ZMMWORD PTR [rsp+0x180],zmm7 0x0000000000005fac <+412>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm5 0x0000000000005fb4 <+420>: vmovaps ZMMWORD PTR [rsp+0x200],zmm6 0x0000000000005fbc <+428>: vmovaps ZMMWORD PTR [rsp+0x240],zmm1 0x0000000000005fc4 <+436>: vmovaps ZMMWORD PTR [rsp+0x280],zmm2 0x0000000000005fcc <+444>: vmovaps ZMMWORD PTR [rsp+0x2c0],zmm0 0x0000000000005fd4 <+452>: mov edi,0x80 0x0000000000005fd9 <+457>: vzeroupper 0x0000000000005fdc <+460>: call 0xa050 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005fe1 <+465>: mov rbx,rax 0x0000000000005fe4 <+468>: test rax,rax 0x0000000000005fe7 <+471>: jle 0x5ffe <main+494> 0x0000000000005fe9 <+473>: mov edi,0x1 0x0000000000005fee <+478>: mov rsi,rbx 0x0000000000005ff1 <+481>: call 0x2f5a0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005ff6 <+486>: mov r14,rax 0x0000000000005ff9 <+489>: mov r15,rbx 0x0000000000005ffc <+492>: jmp 0x6004 <main+500> 0x0000000000005ffe <+494>: xor r14d,r14d 0x0000000000006001 <+497>: xor r15d,r15d 0x0000000000006004 <+500>: lea rdx,[rip+0x5b235] # 0x61240 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000600b <+507>: mov ecx,0x80 0x0000000000006010 <+512>: mov rdi,r14 0x0000000000006013 <+515>: mov rsi,rbx 0x0000000000006016 <+518>: xor eax,eax 0x0000000000006018 <+520>: call 0x57c0 <snprintf@plt> 0x000000000000601d <+525>: cdqe 0x000000000000601f <+527>: inc rax 0x0000000000006022 <+530>: mov QWORD PTR [rsp+0x70],r14 0x0000000000006027 <+535>: mov QWORD PTR [rsp+0x78],rax 0x000000000000602c <+540>: mov QWORD PTR [rsp+0x80],r15 0x0000000000006034 <+548>: lea rdx,[rip+0x5b215] # 0x61250 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x000000000000603b <+555>: lea rdi,[rsp+0x310] 0x0000000000006043 <+563>: lea rsi,[rsp+0x70] 0x0000000000006048 <+568>: mov ecx,0x7 0x000000000000604d <+573>: call 0xf6a0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006052 <+578>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000006057 <+583>: test rdi,rdi 0x000000000000605a <+586>: je 0x6061 <main+593> 0x000000000000605c <+588>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006061 <+593>: mov edi,0x1 0x0000000000006066 <+598>: mov esi,0x3 0x000000000000606b <+603>: call 0x2f5a0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006070 <+608>: xor ecx,ecx 0x0000000000006072 <+610>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006080 <+624>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006084 <+628>: inc rcx 0x0000000000006087 <+631>: cmp rcx,0x3 0x000000000000608b <+635>: jne 0x6080 <main+624> 0x000000000000608d <+637>: mov WORD PTR [rax],0x203a 0x0000000000006092 <+642>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006096 <+646>: mov QWORD PTR [rsp+0x88],rax 0x000000000000609e <+654>: mov QWORD PTR [rsp+0x90],0x3 0x00000000000060aa <+666>: mov QWORD PTR [rsp+0x98],0x3 0x00000000000060b6 <+678>: lea rdi,[rsp+0x328] 0x00000000000060be <+686>: lea rsi,[rsp+0x310] 0x00000000000060c6 <+694>: lea rdx,[rsp+0x88] 0x00000000000060ce <+702>: call 0xf260 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000060d3 <+707>: mov rdi,QWORD PTR [rsp+0x88] 0x00000000000060db <+715>: test rdi,rdi 0x00000000000060de <+718>: je 0x60e5 <main+725> 0x00000000000060e0 <+720>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000060e5 <+725>: mov rdi,QWORD PTR [rsp+0x310] 0x00000000000060ed <+733>: test rdi,rdi 0x00000000000060f0 <+736>: je 0x60f7 <main+743> 0x00000000000060f2 <+738>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000060f7 <+743>: lea rbx,[rsp+0x3d0] 0x00000000000060ff <+751>: mov rdi,rbx 0x0000000000006102 <+754>: vmovaps zmm0,ZMMWORD PTR [rsp+0x2c0] 0x000000000000610a <+762>: vmovaps zmm1,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006112 <+770>: vmovaps zmm2,ZMMWORD PTR [rsp+0x200] 0x000000000000611a <+778>: vmovaps zmm3,ZMMWORD PTR [rsp+0x180] 0x0000000000006122 <+786>: vmovaps zmm4,ZMMWORD PTR [rsp+0x140] 0x000000000000612a <+794>: vmovaps zmm5,ZMMWORD PTR [rsp+0x100] 0x0000000000006132 <+802>: vmovaps zmm6,ZMMWORD PTR [rsp+0x280] 0x000000000000613a <+810>: vmovaps zmm7,ZMMWORD PTR [rsp+0x240] 0x0000000000006142 <+818>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=128> 0x0000000000006147 <+823>: lea rdi,[rsp+0x340] 0x000000000000614f <+831>: lea rsi,[rsp+0x328] 0x0000000000006157 <+839>: mov rdx,rbx 0x000000000000615a <+842>: vzeroupper 0x000000000000615d <+845>: call 0xf260 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006162 <+850>: mov rdi,QWORD PTR [rsp+0x3d0] 0x000000000000616a <+858>: test rdi,rdi 0x000000000000616d <+861>: je 0x6174 <main+868> 0x000000000000616f <+863>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006174 <+868>: mov rdi,QWORD PTR [rsp+0x328] 0x000000000000617c <+876>: test rdi,rdi 0x000000000000617f <+879>: je 0x6186 <main+886> 0x0000000000006181 <+881>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006186 <+886>: lea rdi,[rsp+0x340] 0x000000000000618e <+894>: call 0xab00 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006193 <+899>: mov rdi,QWORD PTR [rsp+0x340] 0x000000000000619b <+907>: test rdi,rdi 0x000000000000619e <+910>: je 0x61a5 <main+917> 0x00000000000061a0 <+912>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000061a5 <+917>: vxorps xmm0,xmm0,xmm0 0x00000000000061a9 <+921>: vmovaps XMMWORD PTR [rsp+0x40],xmm0 0x00000000000061af <+927>: lea rsi,[rsp+0x40] 0x00000000000061b4 <+932>: mov edi,0x1 0x00000000000061b9 <+937>: call 0x5470 <clock_gettime@plt> 0x00000000000061be <+942>: vmovdqa64 zmm17,ZMMWORD PTR [rsp+0x280] 0x00000000000061c6 <+950>: vpshufd zmm0,zmm17,0x4e 0x00000000000061cd <+957>: vmovdqa64 zmm19,ZMMWORD PTR [rsp+0x200] 0x00000000000061d5 <+965>: vpshufd zmm1,zmm19,0x4e 0x00000000000061dc <+972>: vmovdqa64 zmm21,ZMMWORD PTR [rsp+0x180] 0x00000000000061e4 <+980>: vpshufd zmm2,zmm21,0x4e 0x00000000000061eb <+987>: vmovdqa64 zmm16,ZMMWORD PTR [rsp+0x2c0] 0x00000000000061f3 <+995>: vpshufd zmm3,zmm16,0x4e 0x00000000000061fa <+1002>: vmovdqa64 zmm20,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006202 <+1010>: vpshufd zmm4,zmm20,0x4e 0x0000000000006209 <+1017>: vmovdqa64 zmm18,ZMMWORD PTR [rsp+0x240] 0x0000000000006211 <+1025>: vpshufd zmm5,zmm18,0x4e 0x0000000000006218 <+1032>: vmovdqa64 zmm22,ZMMWORD PTR [rsp+0x140] 0x0000000000006220 <+1040>: vpshufd zmm6,zmm22,0x4e 0x0000000000006227 <+1047>: vmovdqa64 zmm23,ZMMWORD PTR [rsp+0x100] 0x000000000000622f <+1055>: vpshufd zmm7,zmm23,0x4e 0x0000000000006236 <+1062>: vpminsd zmm8,zmm23,zmm7 0x000000000000623c <+1068>: vpminsd zmm9,zmm22,zmm6 0x0000000000006242 <+1074>: vpminsd zmm10,zmm18,zmm5 0x0000000000006248 <+1080>: vpminsd zmm11,zmm20,zmm4 0x000000000000624e <+1086>: vpminsd zmm12,zmm16,zmm3 0x0000000000006254 <+1092>: vpminsd zmm13,zmm21,zmm2 0x000000000000625a <+1098>: vpminsd zmm14,zmm19,zmm1 0x0000000000006260 <+1104>: vpminsd zmm15,zmm17,zmm0 0x0000000000006266 <+1110>: vpmaxsd zmm7,zmm23,zmm7 0x000000000000626c <+1116>: vpmaxsd zmm6,zmm22,zmm6 0x0000000000006272 <+1122>: vpmaxsd zmm5,zmm18,zmm5 0x0000000000006278 <+1128>: vpmaxsd zmm4,zmm20,zmm4 0x000000000000627e <+1134>: vpmaxsd zmm3,zmm16,zmm3 0x0000000000006284 <+1140>: vpmaxsd zmm2,zmm21,zmm2 0x000000000000628a <+1146>: vpmaxsd zmm1,zmm19,zmm1 0x0000000000006290 <+1152>: vpmaxsd zmm0,zmm17,zmm0 0x0000000000006296 <+1158>: vshufps zmm16,zmm15,zmm0,0xe4 0x000000000000629d <+1165>: vshufps zmm17,zmm14,zmm1,0xe4 0x00000000000062a4 <+1172>: vshufps zmm18,zmm13,zmm2,0xe4 0x00000000000062ab <+1179>: vshufps zmm19,zmm12,zmm3,0xe4 0x00000000000062b2 <+1186>: vshufps zmm20,zmm11,zmm4,0xe4 0x00000000000062b9 <+1193>: vshufps zmm21,zmm10,zmm5,0xe4 0x00000000000062c0 <+1200>: vshufps zmm22,zmm9,zmm6,0xe4 0x00000000000062c7 <+1207>: vshufps zmm23,zmm8,zmm7,0xe4 0x00000000000062ce <+1214>: vshufps zmm0,zmm15,zmm0,0xb1 0x00000000000062d5 <+1221>: vshufps zmm14,zmm14,zmm1,0xb1 0x00000000000062dc <+1228>: vshufps zmm13,zmm13,zmm2,0xb1 0x00000000000062e3 <+1235>: vshufps zmm12,zmm12,zmm3,0xb1 0x00000000000062ea <+1242>: vshufps zmm11,zmm11,zmm4,0xb1 0x00000000000062f1 <+1249>: vshufps zmm10,zmm10,zmm5,0xb1 0x00000000000062f8 <+1256>: vshufps zmm9,zmm9,zmm6,0xb1 0x00000000000062ff <+1263>: vshufps zmm8,zmm8,zmm7,0xb1 0x0000000000006306 <+1270>: vpminsd zmm1,zmm23,zmm8 0x000000000000630c <+1276>: vpminsd zmm2,zmm22,zmm9 0x0000000000006312 <+1282>: vpminsd zmm24,zmm21,zmm10 0x0000000000006318 <+1288>: vpminsd zmm4,zmm20,zmm11 0x000000000000631e <+1294>: vpminsd zmm6,zmm19,zmm12 0x0000000000006324 <+1300>: vpminsd zmm5,zmm18,zmm13 0x000000000000632a <+1306>: vpminsd zmm7,zmm17,zmm14 0x0000000000006330 <+1312>: vpminsd zmm3,zmm16,zmm0 0x0000000000006336 <+1318>: mov ax,0xaaaa 0x000000000000633a <+1322>: kmovd k6,eax 0x000000000000633e <+1326>: vpmaxsd zmm3{k6},zmm16,zmm0 0x0000000000006344 <+1332>: vpmaxsd zmm7{k6},zmm17,zmm14 0x000000000000634a <+1338>: vpmaxsd zmm5{k6},zmm18,zmm13 0x0000000000006350 <+1344>: vpmaxsd zmm6{k6},zmm19,zmm12 0x0000000000006356 <+1350>: vpmaxsd zmm4{k6},zmm20,zmm11 0x000000000000635c <+1356>: vpmaxsd zmm24{k6},zmm21,zmm10 0x0000000000006362 <+1362>: vpmaxsd zmm2{k6},zmm22,zmm9 0x0000000000006368 <+1368>: vpmaxsd zmm1{k6},zmm23,zmm8 0x000000000000636e <+1374>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58e08] # 0x5f180 0x0000000000006378 <+1384>: vmovdqa64 zmm11,zmm2 0x000000000000637e <+1390>: vpermt2d zmm11,zmm9,zmm1 0x0000000000006384 <+1396>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58e32] # 0x5f1c0 0x000000000000638e <+1406>: vpermt2d zmm11,zmm0,zmm24 0x0000000000006394 <+1412>: vpermi2d zmm9,zmm6,zmm4 0x000000000000639a <+1418>: vpermt2d zmm9,zmm0,zmm5 0x00000000000063a0 <+1424>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x58e56] # 0x5f200 0x00000000000063aa <+1434>: vmovdqa64 zmm8,zmm7 0x00000000000063b0 <+1440>: vpermt2d zmm8,zmm14,zmm5 0x00000000000063b6 <+1446>: vpermi2d zmm14,zmm3,zmm24 0x00000000000063bc <+1452>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x58e7a] # 0x5f240 0x00000000000063c6 <+1462>: vmovdqa64 zmm12,zmm4 0x00000000000063cc <+1468>: vpermt2d zmm12,zmm10,zmm6 0x00000000000063d2 <+1474>: vshufi64x2 zmm15,zmm6,zmm7,0xbe 0x00000000000063d9 <+1481>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58e9d] # 0x5f280 0x00000000000063e3 <+1491>: vpermt2d zmm15,zmm0,zmm5 0x00000000000063e9 <+1497>: vpermi2d zmm10,zmm1,zmm2 0x00000000000063ef <+1503>: vshufi64x2 zmm13,zmm2,zmm3,0xbe 0x00000000000063f6 <+1510>: vpermt2d zmm13,zmm0,zmm24 0x00000000000063fc <+1516>: vpmaxsd zmm18,zmm24,zmm13 0x0000000000006402 <+1522>: mov ax,0x2222 0x0000000000006406 <+1526>: kmovd k2,eax 0x000000000000640a <+1530>: vmovdqa64 zmm0,zmm18 0x0000000000006410 <+1536>: vpminsd zmm0{k2},zmm24,zmm13 0x0000000000006416 <+1542>: vpmaxsd zmm19,zmm1,zmm10 0x000000000000641c <+1548>: mov ax,0x2b22 0x0000000000006420 <+1552>: kmovd k1,eax 0x0000000000006424 <+1556>: vmovdqa64 zmm13,zmm19 0x000000000000642a <+1562>: vpminsd zmm13{k1},zmm1,zmm10 0x0000000000006430 <+1568>: vpmaxsd zmm16,zmm5,zmm15 0x0000000000006436 <+1574>: vpminsd zmm20,zmm7,zmm8 0x000000000000643c <+1580>: mov ax,0x44d4 0x0000000000006440 <+1584>: kmovd k3,eax 0x0000000000006444 <+1588>: vmovdqa64 zmm1,zmm20 0x000000000000644a <+1594>: vpmaxsd zmm1{k3},zmm7,zmm8 0x0000000000006450 <+1600>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x58f26] # 0x5f380 0x000000000000645a <+1610>: vmovdqa64 zmm7,zmm1 0x0000000000006460 <+1616>: vpermt2d zmm7,zmm10,zmm16 0x0000000000006466 <+1622>: vmovdqa64 zmm8,zmm16 0x000000000000646c <+1628>: vpminsd zmm8{k2},zmm5,zmm15 0x0000000000006472 <+1634>: vpmaxsd zmm15,zmm4,zmm12 0x0000000000006478 <+1640>: vpminsd zmm21,zmm6,zmm9 0x000000000000647e <+1646>: mov ax,0x4444 0x0000000000006482 <+1650>: kmovd k4,eax 0x0000000000006486 <+1654>: vmovdqa64 zmm5,zmm21 0x000000000000648c <+1660>: vpmaxsd zmm5{k4},zmm6,zmm9 0x0000000000006492 <+1666>: mov ax,0x966 0x0000000000006496 <+1670>: kmovd k2,eax 0x000000000000649a <+1674>: vshufi32x4 zmm7{k2},zmm5,zmm15,0xde 0x00000000000064a1 <+1681>: vmovdqa64 zmm6,zmm15 0x00000000000064a7 <+1687>: vpminsd zmm6{k1},zmm4,zmm12 0x00000000000064ad <+1693>: vpminsd zmm15,zmm3,zmm14 0x00000000000064b3 <+1699>: vpminsd zmm4,zmm2,zmm11 0x00000000000064b9 <+1705>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58dfd] # 0x5f2c0 0x00000000000064c3 <+1715>: vmovdqa64 zmm12,zmm6 0x00000000000064c9 <+1721>: vpermt2d zmm12,zmm9,zmm21 0x00000000000064cf <+1727>: mov ax,0x6690 0x00000000000064d3 <+1731>: kmovd k1,eax 0x00000000000064d7 <+1735>: vpermi2d zmm9,zmm13,zmm4 0x00000000000064dd <+1741>: vshufi32x4 zmm9{k1},zmm15,zmm0,0x48 0x00000000000064e4 <+1748>: vpmaxsd zmm15{k3},zmm3,zmm14 0x00000000000064ea <+1754>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x58e0c] # 0x5f300 0x00000000000064f4 <+1764>: vmovdqa64 zmm16,zmm15 0x00000000000064fa <+1770>: vpermt2d zmm16,zmm17,zmm4 0x0000000000006500 <+1776>: vmovdqa64 zmm14,zmm4 0x0000000000006506 <+1782>: vpmaxsd zmm14{k4},zmm2,zmm11 0x000000000000650c <+1788>: vshufi32x4 zmm12{k1},zmm20,zmm8,0x48 0x0000000000006513 <+1795>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58e23] # 0x5f340 0x000000000000651d <+1805>: vpermt2d zmm16,zmm2,zmm0 0x0000000000006523 <+1811>: vpermi2d zmm17,zmm1,zmm21 0x0000000000006529 <+1817>: vpermt2d zmm17,zmm2,zmm8 0x000000000000652f <+1823>: vpermi2d zmm10,zmm15,zmm18 0x0000000000006535 <+1829>: vshufi32x4 zmm10{k2},zmm14,zmm19,0xde 0x000000000000653c <+1836>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58e7a] # 0x5f3c0 0x0000000000006546 <+1846>: vmovdqa64 zmm3,zmm13 0x000000000000654c <+1852>: vpermt2d zmm3,zmm2,zmm14 0x0000000000006552 <+1858>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x58ea4] # 0x5f400 0x000000000000655c <+1868>: vpermt2d zmm3,zmm4,zmm0 0x0000000000006562 <+1874>: vpermi2d zmm2,zmm6,zmm5 0x0000000000006568 <+1880>: vpermt2d zmm2,zmm4,zmm8 0x000000000000656e <+1886>: vpminsd zmm18,zmm6,zmm2 0x0000000000006574 <+1892>: vpmaxsd zmm11,zmm6,zmm2 0x000000000000657a <+1898>: mov ax,0x699 0x000000000000657e <+1902>: kmovd k1,eax 0x0000000000006582 <+1906>: vpblendmd zmm2{k1},zmm11,zmm18 0x0000000000006588 <+1912>: vpminsd zmm19,zmm13,zmm3 0x000000000000658e <+1918>: vpmaxsd zmm13,zmm13,zmm3 0x0000000000006594 <+1924>: vpblendmd zmm3{k1},zmm13,zmm19 0x000000000000659a <+1930>: vpmaxsd zmm6,zmm0,zmm10 0x00000000000065a0 <+1936>: mov ax,0x90 0x00000000000065a4 <+1940>: kmovd k1,eax 0x00000000000065a8 <+1944>: vpmaxsd zmm20,zmm15,zmm16 0x00000000000065ae <+1950>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x59008] # 0x5f5c0 0x00000000000065b8 <+1960>: vmovdqa64 zmm4,zmm3 0x00000000000065be <+1966>: vpermt2q zmm4,zmm21,zmm20 0x00000000000065c4 <+1972>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x59032] # 0x5f600 0x00000000000065ce <+1982>: vpermt2d zmm4,zmm22,zmm6 0x00000000000065d4 <+1988>: vpminsd zmm6{k1},zmm0,zmm10 0x00000000000065da <+1994>: vpmaxsd zmm0,zmm8,zmm7 0x00000000000065e0 <+2000>: vpmaxsd zmm23,zmm1,zmm17 0x00000000000065e6 <+2006>: vpermi2q zmm21,zmm2,zmm23 0x00000000000065ec <+2012>: vpermt2d zmm21,zmm22,zmm0 0x00000000000065f2 <+2018>: vmovdqa64 zmm22,zmm0 0x00000000000065f8 <+2024>: vpminsd zmm22{k1},zmm8,zmm7 0x00000000000065fe <+2030>: vpminsd zmm0,zmm1,zmm17 0x0000000000006604 <+2036>: vpminsd zmm17,zmm15,zmm16 0x000000000000660a <+2042>: vpminsd zmm1,zmm14,zmm9 0x0000000000006610 <+2048>: vpminsd zmm10,zmm5,zmm12 0x0000000000006616 <+2054>: mov ax,0x900 0x000000000000661a <+2058>: kmovd k1,eax 0x000000000000661e <+2062>: vmovdqa64 zmm7,zmm10 0x0000000000006624 <+2068>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58ed2] # 0x5f500 0x000000000000662e <+2078>: vpermt2q zmm11,zmm8,zmm10 0x0000000000006634 <+2084>: vpmaxsd zmm10{k1},zmm5,zmm12 0x000000000000663a <+2090>: vmovdqa64 zmm24,ZMMWORD PTR [rip+0x58dfc] # 0x5f440 0x0000000000006644 <+2100>: vpermt2d zmm7,zmm24,zmm18 0x000000000000664a <+2106>: vpermi2d zmm24,zmm1,zmm19 0x0000000000006650 <+2112>: vpermt2q zmm13,zmm8,zmm1 0x0000000000006656 <+2118>: vmovdqa64 zmm18,zmm1 0x000000000000665c <+2124>: vpmaxsd zmm18{k1},zmm14,zmm9 0x0000000000006662 <+2130>: mov ax,0x9960 0x0000000000006666 <+2134>: kmovd k1,eax 0x000000000000666a <+2138>: vpblendmd zmm15{k1},zmm17,zmm20 0x0000000000006670 <+2144>: vpblendmd zmm12{k1},zmm0,zmm23 0x0000000000006676 <+2150>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58e00] # 0x5f480 0x0000000000006680 <+2160>: vpermt2d zmm7,zmm9,zmm12 0x0000000000006686 <+2166>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58e30] # 0x5f4c0 0x0000000000006690 <+2176>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x58ee6] # 0x5f580 0x000000000000669a <+2186>: vpermt2q zmm0,zmm14,zmm22 0x00000000000066a0 <+2192>: vpmaxsd zmm5,zmm22,zmm21 0x00000000000066a6 <+2198>: mov ax,0x69 0x00000000000066aa <+2202>: kmovd k1,eax 0x00000000000066ae <+2206>: vmovdqa64 zmm1,zmm5 0x00000000000066b4 <+2212>: vpminsd zmm1{k1},zmm22,zmm21 0x00000000000066ba <+2218>: vmovdqa64 zmm21,zmm22 0x00000000000066c0 <+2224>: vpermt2d zmm21,zmm8,zmm12 0x00000000000066c6 <+2230>: mov ax,0x6606 0x00000000000066ca <+2234>: kmovd k2,eax 0x00000000000066ce <+2238>: vmovdqa32 zmm21{k2},zmm11 0x00000000000066d4 <+2244>: vpermt2d zmm24,zmm9,zmm15 0x00000000000066da <+2250>: vpermi2d zmm8,zmm6,zmm15 0x00000000000066e0 <+2256>: vmovdqa32 zmm8{k2},zmm13 0x00000000000066e6 <+2262>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x58e50] # 0x5f540 0x00000000000066f0 <+2272>: vpminsd zmm9,zmm18,zmm24 0x00000000000066f6 <+2278>: mov ax,0x9600 0x00000000000066fa <+2282>: kmovd k2,eax 0x00000000000066fe <+2286>: vmovdqa64 zmm13,zmm9 0x0000000000006704 <+2292>: vpmaxsd zmm13{k2},zmm18,zmm24 0x000000000000670a <+2298>: vmovdqa64 zmm20,zmm18 0x0000000000006710 <+2304>: vpermt2d zmm20,zmm16,zmm3 0x0000000000006716 <+2310>: vpermt2q zmm17,zmm14,zmm6 0x000000000000671c <+2316>: mov ax,0x6066 0x0000000000006720 <+2320>: kmovd k3,eax 0x0000000000006724 <+2324>: vmovdqa32 zmm20{k3},zmm17 0x000000000000672a <+2330>: vpermi2d zmm16,zmm10,zmm2 0x0000000000006730 <+2336>: vmovdqa32 zmm16{k3},zmm0 0x0000000000006736 <+2342>: vpmaxsd zmm17,zmm12,zmm16 0x000000000000673c <+2348>: mov ax,0x66 0x0000000000006740 <+2352>: kmovd k3,eax 0x0000000000006744 <+2356>: vpmaxsd zmm22,zmm15,zmm20 0x000000000000674a <+2362>: vpmaxsd zmm19,zmm6,zmm4 0x0000000000006750 <+2368>: vpminsd zmm18,zmm3,zmm8 0x0000000000006756 <+2374>: vpminsd zmm14,zmm2,zmm21 0x000000000000675c <+2380>: mov ax,0x6600 0x0000000000006760 <+2384>: kmovd k4,eax 0x0000000000006764 <+2388>: vmovdqa64 zmm0,zmm14 0x000000000000676a <+2394>: vpmaxsd zmm0{k4},zmm2,zmm21 0x0000000000006770 <+2400>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x58ec6] # 0x5f640 0x000000000000677a <+2410>: vmovdqa64 zmm11,zmm18 0x0000000000006780 <+2416>: vpermt2q zmm11,zmm23,zmm9 0x0000000000006786 <+2422>: vmovdqa64 zmm24,ZMMWORD PTR [rip+0x58fb0] # 0x5f740 0x0000000000006790 <+2432>: vpermt2d zmm9,zmm24,zmm18 0x0000000000006796 <+2438>: vmovdqa64 zmm2,zmm18 0x000000000000679c <+2444>: vpmaxsd zmm2{k4},zmm3,zmm8 0x00000000000067a2 <+2450>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x59014] # 0x5f7c0 0x00000000000067ac <+2460>: vmovdqa64 zmm8,zmm0 0x00000000000067b2 <+2466>: vpermt2d zmm8,zmm25,zmm17 0x00000000000067b8 <+2472>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x5903e] # 0x5f800 0x00000000000067c2 <+2482>: vpermi2d zmm25,zmm2,zmm22 0x00000000000067c8 <+2488>: vpermt2d zmm25,zmm18,zmm19 0x00000000000067ce <+2494>: vmovdqa64 zmm26,zmm19 0x00000000000067d4 <+2500>: vpminsd zmm26{k1},zmm6,zmm4 0x00000000000067da <+2506>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x58f1c] # 0x5f700 0x00000000000067e4 <+2516>: vmovdqa64 zmm21,zmm22 0x00000000000067ea <+2522>: vpermt2q zmm21,zmm19,zmm26 0x00000000000067f0 <+2528>: vpermi2q zmm19,zmm17,zmm1 0x00000000000067f6 <+2534>: vpminsd zmm17{k3},zmm12,zmm16 0x00000000000067fc <+2540>: vmovdqa64 zmm12,zmm22 0x0000000000006802 <+2546>: vpminsd zmm12{k3},zmm15,zmm20 0x0000000000006808 <+2552>: vpminsd zmm22,zmm10,zmm7 0x000000000000680e <+2558>: vmovdqa64 zmm15,zmm22 0x0000000000006814 <+2564>: vpermt2d zmm15,zmm24,zmm14 0x000000000000681a <+2570>: vpermt2q zmm14,zmm23,zmm22 0x0000000000006820 <+2576>: vpmaxsd zmm22{k2},zmm10,zmm7 0x0000000000006826 <+2582>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58e50] # 0x5f680 0x0000000000006830 <+2592>: vpminsd zmm6,zmm26,zmm25 0x0000000000006836 <+2598>: vpmaxsd zmm4,zmm26,zmm25 0x000000000000683c <+2604>: vmovdqa64 zmm7,zmm26 0x0000000000006842 <+2610>: vpermt2d zmm7,zmm3,zmm12 0x0000000000006848 <+2616>: mov ax,0x999 0x000000000000684c <+2620>: kmovd k2,eax 0x0000000000006850 <+2624>: vmovdqa32 zmm7{k2},zmm11 0x0000000000006856 <+2630>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x58e60] # 0x5f6c0 0x0000000000006860 <+2640>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x58f16] # 0x5f780 0x000000000000686a <+2650>: vpermt2d zmm9,zmm16,zmm12 0x0000000000006870 <+2656>: vpminsd zmm10,zmm13,zmm9 0x0000000000006876 <+2662>: vpmaxsd zmm11,zmm13,zmm9 0x000000000000687c <+2668>: vmovdqa64 zmm20,zmm13 0x0000000000006882 <+2674>: vpermt2d zmm20,zmm23,zmm2 0x0000000000006888 <+2680>: mov ax,0x9990 0x000000000000688c <+2684>: kmovd k3,eax 0x0000000000006890 <+2688>: vmovdqa32 zmm20{k3},zmm21 0x0000000000006896 <+2694>: vpermi2d zmm23,zmm22,zmm0 0x000000000000689c <+2700>: vmovdqa32 zmm23{k3},zmm19 0x00000000000068a2 <+2706>: vpermt2d zmm15,zmm16,zmm17 0x00000000000068a8 <+2712>: vpermi2d zmm3,zmm1,zmm17 0x00000000000068ae <+2718>: vmovdqa32 zmm3{k2},zmm14 0x00000000000068b4 <+2724>: vpermt2d zmm8,zmm18,zmm5 0x00000000000068ba <+2730>: vpminsd zmm16,zmm0,zmm3 0x00000000000068c0 <+2736>: vpminsd zmm19,zmm22,zmm15 0x00000000000068c6 <+2742>: vpmaxsd zmm13,zmm22,zmm15 0x00000000000068cc <+2748>: mov ax,0x6090 0x00000000000068d0 <+2752>: kmovd k3,eax 0x00000000000068d4 <+2756>: vpblendmd zmm5{k3},zmm19,zmm13 0x00000000000068da <+2762>: vpmaxsd zmm14,zmm17,zmm23 0x00000000000068e0 <+2768>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x58f56] # 0x5f840 0x00000000000068ea <+2778>: vpermi2d zmm15,zmm5,zmm16 0x00000000000068f0 <+2784>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58f86] # 0x5f880 0x00000000000068fa <+2794>: vpermi2d zmm9,zmm15,zmm14 0x0000000000006900 <+2800>: mov ax,0x1 0x0000000000006904 <+2804>: kmovd k2,eax 0x0000000000006908 <+2808>: vmovdqa32 zmm9{k2},zmm10 0x000000000000690e <+2814>: mov ax,0x9090 0x0000000000006912 <+2818>: kmovd k2,eax 0x0000000000006916 <+2822>: vmovdqa64 ymm21,YMMWORD PTR [rip+0x587c0] # 0x5f0e0 0x0000000000006920 <+2832>: vpermi2d zmm21,zmm14,zmm16 0x0000000000006926 <+2838>: vpminsd zmm14{k2},zmm17,zmm23 0x000000000000692c <+2844>: vpmaxsd zmm24,zmm12,zmm20 0x0000000000006932 <+2850>: vpminsd zmm17,zmm2,zmm7 0x0000000000006938 <+2856>: vpmaxsd zmm15,zmm1,zmm8 0x000000000000693e <+2862>: vmovdqa32 zmm10{k3},zmm11 0x0000000000006944 <+2868>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59032] # 0x5f980 0x000000000000694e <+2878>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x591a8] # 0x5fb00 0x0000000000006958 <+2888>: vpermi2d zmm22,zmm10,zmm19 0x000000000000695e <+2894>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x591d8] # 0x5fb40 0x0000000000006968 <+2904>: vpermi2d zmm23,zmm22,zmm17 0x000000000000696e <+2910>: vpermt2d zmm23,zmm18,zmm24 0x0000000000006974 <+2916>: vshufi64x2 zmm19,zmm17,zmm15,0xff 0x000000000000697b <+2923>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x591fb] # 0x5fb80 0x0000000000006985 <+2933>: vpermi2d zmm22,zmm24,zmm19 0x000000000000698b <+2939>: vmovdqa64 zmm19,zmm24 0x0000000000006991 <+2945>: vpminsd zmm19{k2},zmm12,zmm20 0x0000000000006997 <+2951>: mov ax,0x906 0x000000000000699b <+2955>: kmovd k2,eax 0x000000000000699f <+2959>: vpblendmd zmm20{k2},zmm4,zmm6 0x00000000000069a5 <+2965>: vpminsd zmm24,zmm1,zmm8 0x00000000000069ab <+2971>: vpblendmd zmm8{k2},zmm15,zmm24 0x00000000000069b1 <+2977>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x58f05] # 0x5f8c0 0x00000000000069bb <+2987>: vpermi2d zmm12,zmm8,zmm21 0x00000000000069c1 <+2993>: mov ax,0x8000 0x00000000000069c5 <+2997>: kmovd k2,eax 0x00000000000069c9 <+3001>: vmovdqa32 zmm12{k2},zmm4 0x00000000000069cf <+3007>: mov ax,0x909 0x00000000000069d3 <+3011>: kmovd k2,eax 0x00000000000069d7 <+3015>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x58f1f] # 0x5f900 0x00000000000069e1 <+3025>: vpminsd zmm1,zmm10,zmm23 0x00000000000069e7 <+3031>: mov ax,0x9069 0x00000000000069eb <+3035>: kmovd k3,eax 0x00000000000069ef <+3039>: vpmaxsd zmm1{k3},zmm10,zmm23 0x00000000000069f5 <+3045>: vpermt2d zmm10,zmm21,zmm17 0x00000000000069fb <+3051>: vpermi2d zmm21,zmm5,zmm16 0x0000000000006a01 <+3057>: vpmaxsd zmm16{k2},zmm0,zmm3 0x0000000000006a07 <+3063>: vpmaxsd zmm17{k2},zmm2,zmm7 0x0000000000006a0d <+3069>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58f29] # 0x5f940 0x0000000000006a17 <+3079>: vpermi2d zmm2,zmm10,zmm19 0x0000000000006a1d <+3085>: vpermt2d zmm2,zmm18,zmm6 0x0000000000006a23 <+3091>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58f93] # 0x5f9c0 0x0000000000006a2d <+3101>: vpermi2d zmm0,zmm14,zmm24 0x0000000000006a33 <+3107>: mov ax,0xf909 0x0000000000006a37 <+3111>: kmovd k2,eax 0x0000000000006a3b <+3115>: vmovdqa32 zmm21{k2},zmm0 0x0000000000006a41 <+3121>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58fb5] # 0x5fa00 0x0000000000006a4b <+3131>: vpminsd zmm0,zmm17,zmm2 0x0000000000006a51 <+3137>: mov ax,0x696 0x0000000000006a55 <+3141>: kmovd k3,eax 0x0000000000006a59 <+3145>: vpmaxsd zmm0{k3},zmm17,zmm2 0x0000000000006a5f <+3151>: vpermt2d zmm17,zmm3,zmm11 0x0000000000006a65 <+3157>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58fd1] # 0x5fa40 0x0000000000006a6f <+3167>: vpermi2d zmm2,zmm17,zmm19 0x0000000000006a75 <+3173>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x59001] # 0x5fa80 0x0000000000006a7f <+3183>: vpermi2d zmm6,zmm2,zmm4 0x0000000000006a85 <+3189>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x59031] # 0x5fac0 0x0000000000006a8f <+3199>: vpermi2d zmm2,zmm14,zmm15 0x0000000000006a95 <+3205>: vpermi2d zmm3,zmm16,zmm13 0x0000000000006a9b <+3211>: mov ax,0x6f60 0x0000000000006a9f <+3215>: kmovd k2,eax 0x0000000000006aa3 <+3219>: vmovdqa32 zmm3{k2},zmm2 0x0000000000006aa9 <+3225>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5910d] # 0x5fbc0 0x0000000000006ab3 <+3235>: vpermi2d zmm4,zmm20,zmm22 0x0000000000006ab9 <+3241>: vpmaxsd zmm2,zmm14,zmm3 0x0000000000006abf <+3247>: mov ax,0x6960 0x0000000000006ac3 <+3251>: kmovd k2,eax 0x0000000000006ac7 <+3255>: vpminsd zmm2{k2},zmm14,zmm3 0x0000000000006acd <+3261>: vpmaxsd zmm10,zmm19,zmm6 0x0000000000006ad3 <+3267>: vpminsd zmm10{k2},zmm19,zmm6 0x0000000000006ad9 <+3273>: vpmaxsd zmm6,zmm20,zmm4 0x0000000000006adf <+3279>: mov ax,0x609 0x0000000000006ae3 <+3283>: kmovd k4,eax 0x0000000000006ae7 <+3287>: vpminsd zmm6{k4},zmm20,zmm4 0x0000000000006aed <+3293>: vpmaxsd zmm11,zmm8,zmm12 0x0000000000006af3 <+3299>: mov ax,0x8609 0x0000000000006af7 <+3303>: kmovd k4,eax 0x0000000000006afb <+3307>: vpminsd zmm11{k4},zmm8,zmm12 0x0000000000006b01 <+3313>: vpminsd zmm8,zmm5,zmm9 0x0000000000006b07 <+3319>: vpminsd zmm4,zmm16,zmm21 0x0000000000006b0d <+3325>: vpmaxsd zmm4{k3},zmm16,zmm21 0x0000000000006b13 <+3331>: mov ax,0x9068 0x0000000000006b17 <+3335>: kmovd k3,eax 0x0000000000006b1b <+3339>: vpmaxsd zmm8{k3},zmm5,zmm9 0x0000000000006b21 <+3345>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x590d5] # 0x5fc00 0x0000000000006b2b <+3355>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x5914b] # 0x5fc80 0x0000000000006b35 <+3365>: vmovdqa64 zmm9,zmm4 0x0000000000006b3b <+3371>: vpermt2d zmm9,zmm5,zmm11 0x0000000000006b41 <+3377>: vpermi2d zmm5,zmm0,zmm6 0x0000000000006b47 <+3383>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x5916f] # 0x5fcc0 0x0000000000006b51 <+3393>: vmovdqa64 zmm13,zmm6 0x0000000000006b57 <+3399>: vpermt2d zmm13,zmm12,zmm10 0x0000000000006b5d <+3405>: vpmaxsd zmm14,zmm10,zmm5 0x0000000000006b63 <+3411>: mov ax,0xf00 0x0000000000006b67 <+3415>: kmovd k3,eax 0x0000000000006b6b <+3419>: vmovdqa64 zmm3,zmm14 0x0000000000006b71 <+3425>: vpminsd zmm3{k3},zmm10,zmm5 0x0000000000006b77 <+3431>: vmovdqa64 zmm15,zmm10 0x0000000000006b7d <+3437>: vpermt2d zmm15,zmm7,zmm1 0x0000000000006b83 <+3443>: vpermi2d zmm7,zmm2,zmm8 0x0000000000006b89 <+3449>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x590ad] # 0x5fc40 0x0000000000006b93 <+3459>: vmovdqa64 zmm10,zmm8 0x0000000000006b99 <+3465>: vpermt2d zmm10,zmm16,zmm4 0x0000000000006b9f <+3471>: vpermi2d zmm12,zmm11,zmm2 0x0000000000006ba5 <+3477>: vpminsd zmm17,zmm11,zmm12 0x0000000000006bab <+3483>: vpmaxsd zmm5,zmm11,zmm12 0x0000000000006bb1 <+3489>: mov ax,0x96 0x0000000000006bb5 <+3493>: kmovd k4,eax 0x0000000000006bb9 <+3497>: vmovdqa32 zmm5{k4},zmm17 0x0000000000006bbf <+3503>: vpminsd zmm11,zmm6,zmm13 0x0000000000006bc5 <+3509>: vpmaxsd zmm6,zmm6,zmm13 0x0000000000006bcb <+3515>: vmovdqa32 zmm6{k4},zmm11 0x0000000000006bd1 <+3521>: vpmaxsd zmm12,zmm2,zmm9 0x0000000000006bd7 <+3527>: mov ax,0x96f0 0x0000000000006bdb <+3531>: kmovd k4,eax 0x0000000000006bdf <+3535>: vpmaxsd zmm13,zmm8,zmm10 0x0000000000006be5 <+3541>: vpminsd zmm13{k4},zmm8,zmm10 0x0000000000006beb <+3547>: vpminsd zmm18,zmm4,zmm7 0x0000000000006bf1 <+3553>: mov al,0xc 0x0000000000006bf3 <+3555>: kmovd k5,eax 0x0000000000006bf7 <+3559>: vpmaxsd zmm4,zmm4,zmm7 0x0000000000006bfd <+3565>: vpblendmq zmm8{k5},zmm18,zmm4 0x0000000000006c03 <+3571>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x590f3] # 0x5fd00 0x0000000000006c0d <+3581>: vmovdqa64 zmm10,zmm8 0x0000000000006c13 <+3587>: vpermt2d zmm10,zmm7,zmm13 0x0000000000006c19 <+3593>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x5911d] # 0x5fd40 0x0000000000006c23 <+3603>: vpermt2d zmm10,zmm19,zmm12 0x0000000000006c29 <+3609>: vpminsd zmm12{k3},zmm2,zmm9 0x0000000000006c2f <+3615>: mov rbx,QWORD PTR [rsp+0x40] 0x0000000000006c34 <+3620>: mov rax,QWORD PTR [rsp+0x48] 0x0000000000006c39 <+3625>: mov QWORD PTR [rsp+0x60],rax 0x0000000000006c3e <+3630>: vpermi2d zmm16,zmm1,zmm0 0x0000000000006c44 <+3636>: vpmaxsd zmm2,zmm1,zmm16 0x0000000000006c4a <+3642>: vpminsd zmm2{k4},zmm1,zmm16 0x0000000000006c50 <+3648>: vpminsd zmm1,zmm0,zmm15 0x0000000000006c56 <+3654>: vpmaxsd zmm0,zmm0,zmm15 0x0000000000006c5c <+3660>: vpblendmq zmm9{k5},zmm1,zmm0 0x0000000000006c62 <+3666>: vpermi2d zmm7,zmm9,zmm2 0x0000000000006c68 <+3672>: vpermt2d zmm7,zmm19,zmm14 0x0000000000006c6e <+3678>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x59108] # 0x5fd80 0x0000000000006c78 <+3688>: vmovdqa64 zmm15,zmm12 0x0000000000006c7e <+3694>: vpermt2d zmm15,zmm14,zmm18 0x0000000000006c84 <+3700>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x59132] # 0x5fdc0 0x0000000000006c8e <+3710>: vpermt2d zmm15,zmm16,zmm17 0x0000000000006c94 <+3716>: vpermi2d zmm14,zmm3,zmm1 0x0000000000006c9a <+3722>: vpermt2d zmm14,zmm16,zmm11 0x0000000000006ca0 <+3728>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59156] # 0x5fe00 0x0000000000006caa <+3738>: vmovdqa64 zmm11,zmm6 0x0000000000006cb0 <+3744>: vpermt2d zmm11,zmm1,zmm3 0x0000000000006cb6 <+3750>: vpermi2d zmm1,zmm5,zmm12 0x0000000000006cbc <+3756>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x5917a] # 0x5fe40 0x0000000000006cc6 <+3766>: vmovdqa64 zmm17,zmm13 0x0000000000006ccc <+3772>: vpermt2d zmm17,zmm16,zmm4 0x0000000000006cd2 <+3778>: vpermi2d zmm16,zmm2,zmm0 0x0000000000006cd8 <+3784>: vpmaxsd zmm18,zmm2,zmm16 0x0000000000006cde <+3790>: vpminsd zmm18{k2},zmm2,zmm16 0x0000000000006ce4 <+3796>: vpmaxsd zmm16,zmm13,zmm17 0x0000000000006cea <+3802>: vpminsd zmm16{k2},zmm13,zmm17 0x0000000000006cf0 <+3808>: vpmaxsd zmm2,zmm5,zmm1 0x0000000000006cf6 <+3814>: vpminsd zmm2{k1},zmm5,zmm1 0x0000000000006cfc <+3820>: vpmaxsd zmm0,zmm6,zmm11 0x0000000000006d02 <+3826>: vpminsd zmm0{k1},zmm6,zmm11 0x0000000000006d08 <+3832>: vpmaxsd zmm5,zmm3,zmm14 0x0000000000006d0e <+3838>: mov ax,0xf09 0x0000000000006d12 <+3842>: kmovd k1,eax 0x0000000000006d16 <+3846>: vpminsd zmm5{k1},zmm3,zmm14 0x0000000000006d1c <+3852>: vpmaxsd zmm4,zmm12,zmm15 0x0000000000006d22 <+3858>: vpminsd zmm4{k1},zmm12,zmm15 0x0000000000006d28 <+3864>: vpminsd zmm3,zmm9,zmm7 0x0000000000006d2e <+3870>: vpminsd zmm1,zmm8,zmm10 0x0000000000006d34 <+3876>: mov ax,0x90f0 0x0000000000006d38 <+3880>: kmovd k1,eax 0x0000000000006d3c <+3884>: vpmaxsd zmm1{k1},zmm8,zmm10 0x0000000000006d42 <+3890>: vpmaxsd zmm3{k1},zmm9,zmm7 0x0000000000006d48 <+3896>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x5912e] # 0x5fe80 0x0000000000006d52 <+3906>: vpxor xmm8,xmm8,xmm8 0x0000000000006d57 <+3911>: vpermd zmm8,zmm6,zmm3 0x0000000000006d5d <+3917>: vpxor xmm11,xmm11,xmm11 0x0000000000006d62 <+3922>: vpermd zmm11,zmm6,zmm1 0x0000000000006d68 <+3928>: vpxor xmm12,xmm12,xmm12 0x0000000000006d6d <+3933>: vpermd zmm12,zmm6,zmm4 0x0000000000006d73 <+3939>: vpermd zmm6,zmm6,zmm5 0x0000000000006d79 <+3945>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5913d] # 0x5fec0 0x0000000000006d83 <+3955>: vpxor xmm10,xmm10,xmm10 0x0000000000006d88 <+3960>: vpermd zmm10,zmm7,zmm0 0x0000000000006d8e <+3966>: vpxor xmm14,xmm14,xmm14 0x0000000000006d93 <+3971>: vpermd zmm14,zmm7,zmm2 0x0000000000006d99 <+3977>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5915d] # 0x5ff00 0x0000000000006da3 <+3987>: vpermd zmm13,zmm7,zmm16 0x0000000000006da9 <+3993>: vpxor xmm9,xmm9,xmm9 0x0000000000006dae <+3998>: vpermd zmm9,zmm7,zmm18 0x0000000000006db4 <+4004>: vpmaxsd zmm7,zmm18,zmm9 0x0000000000006dba <+4010>: mov ax,0x600 0x0000000000006dbe <+4014>: kmovd k1,eax 0x0000000000006dc2 <+4018>: vpminsd zmm7{k1},zmm18,zmm9 0x0000000000006dc8 <+4024>: vpmaxsd zmm9,zmm16,zmm13 0x0000000000006dce <+4030>: vpminsd zmm9{k1},zmm16,zmm13 0x0000000000006dd4 <+4036>: vpmaxsd zmm15,zmm2,zmm14 0x0000000000006dda <+4042>: mov ax,0x6 0x0000000000006dde <+4046>: kmovd k1,eax 0x0000000000006de2 <+4050>: vpminsd zmm16,zmm4,zmm12 0x0000000000006de8 <+4056>: vpminsd zmm17,zmm1,zmm11 0x0000000000006dee <+4062>: mov ax,0xf960 0x0000000000006df2 <+4066>: kmovd k2,eax 0x0000000000006df6 <+4070>: vpmaxsd zmm11,zmm1,zmm11 0x0000000000006dfc <+4076>: vpblendmd zmm13{k2},zmm17,zmm11 0x0000000000006e02 <+4082>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59174] # 0x5ff80 0x0000000000006e0c <+4092>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x591aa] # 0x5ffc0 0x0000000000006e16 <+4102>: vmovdqa64 zmm19,zmm13 0x0000000000006e1c <+4108>: vpermt2d zmm19,zmm1,zmm9 0x0000000000006e22 <+4114>: vpermt2d zmm19,zmm18,zmm16 0x0000000000006e28 <+4120>: vpmaxsd zmm16{k2},zmm4,zmm12 0x0000000000006e2e <+4126>: vmovdqa64 zmm20,zmm16 0x0000000000006e34 <+4132>: vpermt2d zmm20,zmm1,zmm11 0x0000000000006e3a <+4138>: vpermt2d zmm20,zmm18,zmm15 0x0000000000006e40 <+4144>: vmovdqa64 zmm21,zmm15 0x0000000000006e46 <+4150>: vpminsd zmm21{k1},zmm2,zmm14 0x0000000000006e4c <+4156>: vpmaxsd zmm2,zmm0,zmm10 0x0000000000006e52 <+4162>: vpminsd zmm12,zmm5,zmm6 0x0000000000006e58 <+4168>: vpmaxsd zmm11,zmm3,zmm8 0x0000000000006e5e <+4174>: vmovdqa64 zmm4,zmm12 0x0000000000006e64 <+4180>: vpmaxsd zmm4{k2},zmm5,zmm6 0x0000000000006e6a <+4186>: vmovdqa64 zmm5,zmm4 0x0000000000006e70 <+4192>: vpermt2d zmm5,zmm1,zmm11 0x0000000000006e76 <+4198>: vpermt2d zmm5,zmm18,zmm2 0x0000000000006e7c <+4204>: vmovdqa64 zmm6,zmm2 0x0000000000006e82 <+4210>: vpminsd zmm6{k1},zmm0,zmm10 0x0000000000006e88 <+4216>: vpminsd zmm0,zmm3,zmm8 0x0000000000006e8e <+4222>: vpblendmd zmm11{k2},zmm0,zmm11 0x0000000000006e94 <+4228>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x590a2] # 0x5ff40 0x0000000000006e9e <+4238>: vmovdqa64 zmm8,zmm6 0x0000000000006ea4 <+4244>: vpermt2d zmm8,zmm10,zmm4 0x0000000000006eaa <+4250>: vpermi2d zmm10,zmm21,zmm16 0x0000000000006eb0 <+4256>: vpermi2d zmm1,zmm11,zmm7 0x0000000000006eb6 <+4262>: vpermt2d zmm1,zmm18,zmm12 0x0000000000006ebc <+4268>: vmovdqa64 zmm12,zmm9 0x0000000000006ec2 <+4274>: vpermt2d zmm12,zmm18,zmm17 0x0000000000006ec8 <+4280>: vpermi2d zmm18,zmm7,zmm0 0x0000000000006ece <+4286>: vpmaxsd zmm14,zmm7,zmm18 0x0000000000006ed4 <+4292>: mov ax,0x9000 0x0000000000006ed8 <+4296>: kmovd k1,eax 0x0000000000006edc <+4300>: vmovdqa64 zmm2,zmm14 0x0000000000006ee2 <+4306>: vpminsd zmm2{k1},zmm7,zmm18 0x0000000000006ee8 <+4312>: vpmaxsd zmm0,zmm9,zmm12 0x0000000000006eee <+4318>: vmovdqa64 zmm3,zmm0 0x0000000000006ef4 <+4324>: vpminsd zmm3{k1},zmm9,zmm12 0x0000000000006efa <+4330>: vpminsd zmm12,zmm11,zmm1 0x0000000000006f00 <+4336>: vpminsd zmm9,zmm13,zmm19 0x0000000000006f06 <+4342>: vpminsd zmm7,zmm4,zmm5 0x0000000000006f0c <+4348>: vpminsd zmm15,zmm16,zmm20 0x0000000000006f12 <+4354>: vpmaxsd zmm17,zmm13,zmm19 0x0000000000006f18 <+4360>: mov ax,0x6f09 0x0000000000006f1c <+4364>: kmovd k1,eax 0x0000000000006f20 <+4368>: vmovdqa32 zmm9{k1},zmm17 0x0000000000006f26 <+4374>: vpmaxsd zmm15{k1},zmm16,zmm20 0x0000000000006f2c <+4380>: vpmaxsd zmm10,zmm21,zmm10 0x0000000000006f32 <+4386>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x590c4] # 0x60000 0x0000000000006f3c <+4396>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x590fa] # 0x60040 0x0000000000006f46 <+4406>: vpermt2d zmm0,zmm19,zmm17 0x0000000000006f4c <+4412>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x5912a] # 0x60080 0x0000000000006f56 <+4422>: vmovdqa64 zmm21,zmm15 0x0000000000006f5c <+4428>: vpermt2d zmm21,zmm16,zmm10 0x0000000000006f62 <+4434>: mov ax,0x117 0x0000000000006f66 <+4438>: kmovd k2,eax 0x0000000000006f6a <+4442>: vmovdqa32 zmm21{k2},zmm0 0x0000000000006f70 <+4448>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59146] # 0x600c0 0x0000000000006f7a <+4458>: vmovdqa64 zmm17,zmm3 0x0000000000006f80 <+4464>: vpermt2d zmm17,zmm18,zmm9 0x0000000000006f86 <+4470>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x59170] # 0x60100 0x0000000000006f90 <+4480>: vpermt2d zmm17,zmm20,zmm15 0x0000000000006f96 <+4486>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x591e0] # 0x60180 0x0000000000006fa0 <+4496>: vmovdqa64 zmm23,zmm10 0x0000000000006fa6 <+4502>: vpermt2d zmm23,zmm22,zmm15 0x0000000000006fac <+4508>: mov ax,0xe8e0 0x0000000000006fb0 <+4512>: kmovd k3,eax 0x0000000000006fb4 <+4516>: vpmaxsd zmm0,zmm15,zmm21 0x0000000000006fba <+4522>: vpminsd zmm0{k3},zmm15,zmm21 0x0000000000006fc0 <+4528>: vmovdqa64 zmm21,zmm15 0x0000000000006fc6 <+4534>: vpermt2d zmm21,zmm13,zmm9 0x0000000000006fcc <+4540>: mov ax,0x9999 0x0000000000006fd0 <+4544>: kmovd k4,eax 0x0000000000006fd4 <+4548>: vmovdqa32 zmm21{k4},zmm10 0x0000000000006fda <+4554>: vpmaxsd zmm1,zmm11,zmm1 0x0000000000006fe0 <+4560>: vmovdqa32 zmm12{k1},zmm1 0x0000000000006fe6 <+4566>: vpmaxsd zmm7{k1},zmm4,zmm5 0x0000000000006fec <+4572>: vpmaxsd zmm4,zmm6,zmm8 0x0000000000006ff2 <+4578>: vpermi2d zmm13,zmm7,zmm12 0x0000000000006ff8 <+4584>: vmovdqa32 zmm13{k4},zmm4 0x0000000000006ffe <+4590>: vpermi2d zmm18,zmm2,zmm12 0x0000000000007004 <+4596>: vpermt2d zmm18,zmm20,zmm7 0x000000000000700a <+4602>: vpermt2d zmm14,zmm19,zmm1 0x0000000000007010 <+4608>: vpermi2d zmm16,zmm7,zmm4 0x0000000000007016 <+4614>: vmovdqa32 zmm16{k2},zmm14 0x000000000000701c <+4620>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5911a] # 0x60140 0x0000000000007026 <+4630>: vmovdqa64 zmm5,zmm9 0x000000000000702c <+4636>: vpermt2d zmm5,zmm1,zmm3 0x0000000000007032 <+4642>: mov ax,0xe880 0x0000000000007036 <+4646>: kmovd k1,eax 0x000000000000703a <+4650>: vmovdqa32 zmm5{k1},zmm23 0x0000000000007040 <+4656>: vpermi2d zmm1,zmm12,zmm2 0x0000000000007046 <+4662>: vpermi2d zmm22,zmm4,zmm7 0x000000000000704c <+4668>: vmovdqa32 zmm1{k1},zmm22 0x0000000000007052 <+4674>: vpminsd zmm15,zmm12,zmm1 0x0000000000007058 <+4680>: vpmaxsd zmm14,zmm12,zmm1 0x000000000000705e <+4686>: vpblendmd zmm11{k3},zmm14,zmm15 0x0000000000007064 <+4692>: vpminsd zmm12,zmm9,zmm5 0x000000000000706a <+4698>: vpmaxsd zmm19,zmm9,zmm5 0x0000000000007070 <+4704>: vpblendmd zmm9{k3},zmm19,zmm12 0x0000000000007076 <+4710>: vpmaxsd zmm5,zmm7,zmm16 0x000000000000707c <+4716>: vpminsd zmm5{k3},zmm7,zmm16 0x0000000000007082 <+4722>: vpmaxsd zmm6,zmm2,zmm18 0x0000000000007088 <+4728>: mov ax,0x6666 0x000000000000708c <+4732>: kmovd k1,eax 0x0000000000007090 <+4736>: vpminsd zmm6{k1},zmm2,zmm18 0x0000000000007096 <+4742>: vpmaxsd zmm7,zmm3,zmm17 0x000000000000709c <+4748>: vpminsd zmm7{k1},zmm3,zmm17 0x00000000000070a2 <+4754>: vpmaxsd zmm1,zmm4,zmm13 0x00000000000070a8 <+4760>: vpmaxsd zmm4,zmm10,zmm21 0x00000000000070ae <+4766>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59108] # 0x601c0 0x00000000000070b8 <+4776>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x591fe] # 0x602c0 0x00000000000070c2 <+4786>: vmovdqa64 zmm18,zmm11 0x00000000000070c8 <+4792>: vpermt2d zmm18,zmm2,zmm6 0x00000000000070ce <+4798>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x59228] # 0x60300 0x00000000000070d8 <+4808>: vmovdqa64 zmm16,zmm1 0x00000000000070de <+4814>: vpermt2d zmm16,zmm8,zmm5 0x00000000000070e4 <+4820>: mov ax,0x4c6c 0x00000000000070e8 <+4824>: kmovd k1,eax 0x00000000000070ec <+4828>: vpermi2d zmm2,zmm9,zmm7 0x00000000000070f2 <+4834>: vpermi2d zmm8,zmm4,zmm0 0x00000000000070f8 <+4840>: vmovdqa32 zmm2{k1},zmm8 0x00000000000070fe <+4846>: vpmaxsd zmm8,zmm9,zmm2 0x0000000000007104 <+4852>: vpminsd zmm8{k1},zmm9,zmm2 0x000000000000710a <+4858>: vmovdqa64 zmm2,zmm9 0x0000000000007110 <+4864>: vpermt2d zmm2,zmm3,zmm0 0x0000000000007116 <+4870>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x590e0] # 0x60200 0x0000000000007120 <+4880>: vmovdqa64 zmm10,zmm4 0x0000000000007126 <+4886>: vpermt2d zmm10,zmm9,zmm2 0x000000000000712c <+4892>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x5910a] # 0x60240 0x0000000000007136 <+4902>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x59200] # 0x60340 0x0000000000007140 <+4912>: vmovdqa64 zmm13,zmm7 0x0000000000007146 <+4918>: vpermt2d zmm13,zmm20,zmm19 0x000000000000714c <+4924>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x5922a] # 0x60380 0x0000000000007156 <+4934>: vpermt2d zmm13,zmm19,zmm0 0x000000000000715c <+4940>: vpminsd zmm17,zmm7,zmm13 0x0000000000007162 <+4946>: mov ax,0x1331 0x0000000000007166 <+4950>: kmovd k3,eax 0x000000000000716a <+4954>: vmovdqa64 zmm2,zmm17 0x0000000000007170 <+4960>: vpmaxsd zmm2{k3},zmm7,zmm13 0x0000000000007176 <+4966>: vpermt2d zmm7,zmm21,zmm12 0x000000000000717c <+4972>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x590fa] # 0x60280 0x0000000000007186 <+4982>: vmovdqa64 zmm13,zmm0 0x000000000000718c <+4988>: vpermt2d zmm13,zmm12,zmm4 0x0000000000007192 <+4994>: mov ax,0x3632 0x0000000000007196 <+4998>: kmovd k2,eax 0x000000000000719a <+5002>: vmovdqa32 zmm13{k2},zmm7 0x00000000000071a0 <+5008>: vpermi2d zmm21,zmm6,zmm15 0x00000000000071a6 <+5014>: vpermi2d zmm12,zmm5,zmm1 0x00000000000071ac <+5020>: vmovdqa32 zmm12{k2},zmm21 0x00000000000071b2 <+5026>: vpermi2d zmm3,zmm11,zmm5 0x00000000000071b8 <+5032>: vpermi2d zmm9,zmm1,zmm3 0x00000000000071be <+5038>: vmovdqa32 zmm18{k1},zmm16 0x00000000000071c4 <+5044>: vpermi2d zmm20,zmm6,zmm14 0x00000000000071ca <+5050>: vpermt2d zmm20,zmm19,zmm5 0x00000000000071d0 <+5056>: vpminsd zmm16,zmm6,zmm20 0x00000000000071d6 <+5062>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x591e0] # 0x603c0 0x00000000000071e0 <+5072>: vpermi2d zmm7,zmm2,zmm8 0x00000000000071e6 <+5078>: mov ax,0x2 0x00000000000071ea <+5082>: kmovd k2,eax 0x00000000000071ee <+5086>: vmovdqa32 zmm7{k2},zmm16 0x00000000000071f4 <+5092>: vpmaxsd zmm14,zmm11,zmm18 0x00000000000071fa <+5098>: vpminsd zmm14{k1},zmm11,zmm18 0x0000000000007200 <+5104>: vpmaxsd zmm15,zmm1,zmm9 0x0000000000007206 <+5110>: mov ax,0x888 0x000000000000720a <+5114>: kmovd k1,eax 0x000000000000720e <+5118>: vpmaxsd zmm11,zmm5,zmm12 0x0000000000007214 <+5124>: mov ax,0x88 0x0000000000007218 <+5128>: kmovd k2,eax 0x000000000000721c <+5132>: vpmaxsd zmm16{k3},zmm6,zmm20 0x0000000000007222 <+5138>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59294] # 0x604c0 0x000000000000722c <+5148>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5938a] # 0x605c0 0x0000000000007236 <+5158>: vpermi2d zmm3,zmm16,zmm17 0x000000000000723c <+5164>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x593ba] # 0x60600 0x0000000000007246 <+5174>: vpermi2d zmm17,zmm3,zmm14 0x000000000000724c <+5180>: vpminsd zmm3,zmm16,zmm17 0x0000000000007252 <+5186>: mov ax,0x2653 0x0000000000007256 <+5190>: kmovd k3,eax 0x000000000000725a <+5194>: vmovdqa64 zmm6,zmm3 0x0000000000007260 <+5200>: vpmaxsd zmm6{k3},zmm16,zmm17 0x0000000000007266 <+5206>: vpermt2d zmm16,zmm18,zmm14 0x000000000000726c <+5212>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x5928a] # 0x60500 0x0000000000007276 <+5222>: vpermt2d zmm16,zmm17,zmm11 0x000000000000727c <+5228>: vpminsd zmm11{k2},zmm5,zmm12 0x0000000000007282 <+5234>: vpmaxsd zmm12,zmm0,zmm13 0x0000000000007288 <+5240>: vpermi2d zmm18,zmm2,zmm8 0x000000000000728e <+5246>: vpermt2d zmm18,zmm17,zmm12 0x0000000000007294 <+5252>: vpminsd zmm12{k2},zmm0,zmm13 0x000000000000729a <+5258>: vpmaxsd zmm5,zmm4,zmm10 0x00000000000072a0 <+5264>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59196] # 0x60440 0x00000000000072aa <+5274>: vpermi2d zmm0,zmm11,zmm5 0x00000000000072b0 <+5280>: vpminsd zmm5{k1},zmm4,zmm10 0x00000000000072b6 <+5286>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x59140] # 0x60400 0x00000000000072c0 <+5296>: vpermi2d zmm10,zmm5,zmm12 0x00000000000072c6 <+5302>: mov ax,0x4000 0x00000000000072ca <+5306>: kmovd k2,eax 0x00000000000072ce <+5310>: vmovdqa32 zmm10{k2},zmm15 0x00000000000072d4 <+5316>: vmovdqa64 zmm4,zmm15 0x00000000000072da <+5322>: vpminsd zmm4{k1},zmm1,zmm9 0x00000000000072e0 <+5328>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59196] # 0x60480 0x00000000000072ea <+5338>: vpermi2d zmm1,zmm0,zmm4 0x00000000000072f0 <+5344>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x59246] # 0x60540 0x00000000000072fa <+5354>: vpminsd zmm20,zmm14,zmm16 0x0000000000007300 <+5360>: vpmaxsd zmm9,zmm14,zmm16 0x0000000000007306 <+5366>: vmovdqa64 zmm16,zmm14 0x000000000000730c <+5372>: vpermt2d zmm16,zmm13,zmm11 0x0000000000007312 <+5378>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59264] # 0x60580 0x000000000000731c <+5388>: vpermt2d zmm16,zmm0,zmm4 0x0000000000007322 <+5394>: vpermi2d zmm13,zmm8,zmm12 0x0000000000007328 <+5400>: vpermt2d zmm13,zmm0,zmm5 0x000000000000732e <+5406>: vpminsd zmm17,zmm8,zmm18 0x0000000000007334 <+5412>: vpmaxsd zmm8,zmm8,zmm18 0x000000000000733a <+5418>: mov ax,0xc48c 0x000000000000733e <+5422>: kmovd k1,eax 0x0000000000007342 <+5426>: vpblendmd zmm0{k1},zmm8,zmm17 0x0000000000007348 <+5432>: vpminsd zmm14,zmm2,zmm7 0x000000000000734e <+5438>: mov ax,0x2651 0x0000000000007352 <+5442>: kmovd k2,eax 0x0000000000007356 <+5446>: mov al,0x2 0x0000000000007358 <+5448>: kmovd k3,eax 0x000000000000735c <+5452>: vpblendmq zmm18{k3},zmm6,zmm14 0x0000000000007362 <+5458>: vbroadcasti64x4 zmm19,YMMWORD PTR [rip+0x57db4] # 0x5f120 0x000000000000736c <+5468>: vpermt2d zmm8,zmm19,zmm14 0x0000000000007372 <+5474>: vpmaxsd zmm14{k2},zmm2,zmm7 0x0000000000007378 <+5480>: vpmaxsd zmm7,zmm12,zmm13 0x000000000000737e <+5486>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x592b8] # 0x60640 0x0000000000007388 <+5496>: vpermi2d zmm2,zmm14,zmm0 0x000000000000738e <+5502>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x592e8] # 0x60680 0x0000000000007398 <+5512>: vpermi2d zmm15,zmm2,zmm7 0x000000000000739e <+5518>: mov ax,0x4 0x00000000000073a2 <+5522>: kmovd k2,eax 0x00000000000073a6 <+5526>: vmovdqa32 zmm15{k2},zmm3 0x00000000000073ac <+5532>: vpmaxsd zmm21,zmm11,zmm16 0x00000000000073b2 <+5538>: mov ax,0xca4c 0x00000000000073b6 <+5542>: kmovd k2,eax 0x00000000000073ba <+5546>: vpblendmd zmm2{k1},zmm9,zmm20 0x00000000000073c0 <+5552>: vpmaxsd zmm22,zmm5,zmm10 0x00000000000073c6 <+5558>: vbroadcasti64x4 zmm23,YMMWORD PTR [rip+0x57d30] # 0x5f100 0x00000000000073d0 <+5568>: vpermi2d zmm23,zmm20,zmm22 0x00000000000073d6 <+5574>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x59320] # 0x60700 0x00000000000073e0 <+5584>: vpermi2d zmm20,zmm21,zmm23 0x00000000000073e6 <+5590>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x594d0] # 0x608c0 0x00000000000073f0 <+5600>: vpermi2d zmm23,zmm18,zmm2 0x00000000000073f6 <+5606>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59500] # 0x60900 0x0000000000007400 <+5616>: vpermi2d zmm18,zmm23,zmm21 0x0000000000007406 <+5622>: vpminsd zmm21{k2},zmm11,zmm16 0x000000000000740c <+5628>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x592aa] # 0x606c0 0x0000000000007416 <+5638>: vpermi2d zmm16,zmm7,zmm17 0x000000000000741c <+5644>: vmovdqa64 zmm11,zmm7 0x0000000000007422 <+5650>: vpminsd zmm11{k2},zmm12,zmm13 0x0000000000007428 <+5656>: vpmaxsd zmm17,zmm4,zmm1 0x000000000000742e <+5662>: mov ax,0xa00 0x0000000000007432 <+5666>: kmovd k2,eax 0x0000000000007436 <+5670>: mov ax,0x4a00 0x000000000000743a <+5674>: kmovd k1,eax 0x000000000000743e <+5678>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x592f8] # 0x60740 0x0000000000007448 <+5688>: vpermi2d zmm12,zmm11,zmm22 0x000000000000744e <+5694>: vbroadcasti64x4 zmm23,YMMWORD PTR [rip+0x57ce8] # 0x5f140 0x0000000000007458 <+5704>: vpermi2d zmm23,zmm11,zmm22 0x000000000000745e <+5710>: vmovdqa64 zmm7,zmm22 0x0000000000007464 <+5716>: vpminsd zmm7{k1},zmm5,zmm10 0x000000000000746a <+5722>: mov ax,0x1111 0x000000000000746e <+5726>: kmovd k1,eax 0x0000000000007472 <+5730>: vpblendmd zmm5{k1},zmm7,zmm16 0x0000000000007478 <+5736>: mov ax,0x2000 0x000000000000747c <+5740>: kmovd k1,eax 0x0000000000007480 <+5744>: vmovdqa32 zmm5{k1},zmm17 0x0000000000007486 <+5750>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x592f0] # 0x60780 0x0000000000007490 <+5760>: vmovdqa64 zmm13,zmm0 0x0000000000007496 <+5766>: vpermt2d zmm13,zmm10,zmm14 0x000000000000749c <+5772>: vpermi2d zmm10,zmm2,zmm6 0x00000000000074a2 <+5778>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x59314] # 0x607c0 0x00000000000074ac <+5788>: vpermi2d zmm22,zmm10,zmm21 0x00000000000074b2 <+5794>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x59344] # 0x60800 0x00000000000074bc <+5804>: vpermi2d zmm16,zmm22,zmm17 0x00000000000074c2 <+5810>: vpermt2d zmm9,zmm19,zmm3 0x00000000000074c8 <+5816>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5936e] # 0x60840 0x00000000000074d2 <+5826>: vpermi2d zmm3,zmm21,zmm9 0x00000000000074d8 <+5832>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x5939e] # 0x60880 0x00000000000074e2 <+5842>: vpermi2d zmm19,zmm3,zmm17 0x00000000000074e8 <+5848>: vmovdqa64 zmm9,zmm17 0x00000000000074ee <+5854>: vpminsd zmm9{k2},zmm4,zmm1 0x00000000000074f4 <+5860>: mov ax,0x3111 0x00000000000074f8 <+5864>: kmovd k2,eax 0x00000000000074fc <+5868>: vpblendmd zmm10{k2},zmm9,zmm20 0x0000000000007502 <+5874>: mov ax,0x211 0x0000000000007506 <+5878>: kmovd k2,eax 0x000000000000750a <+5882>: vmovdqa32 zmm12{k2},zmm8 0x0000000000007510 <+5888>: mov ax,0x8840 0x0000000000007514 <+5892>: kmovd k2,eax 0x0000000000007518 <+5896>: vmovdqa32 zmm13{k2},zmm23 0x000000000000751e <+5902>: vpminsd zmm8,zmm6,zmm18 0x0000000000007524 <+5908>: vpmaxsd zmm3,zmm6,zmm18 0x000000000000752a <+5914>: mov ax,0x8888 0x000000000000752e <+5918>: kmovd k2,eax 0x0000000000007532 <+5922>: vpblendmd zmm4{k2},zmm3,zmm8 0x0000000000007538 <+5928>: vpmaxsd zmm1,zmm21,zmm19 0x000000000000753e <+5934>: mov ax,0x2466 0x0000000000007542 <+5938>: kmovd k3,eax 0x0000000000007546 <+5942>: vpminsd zmm1{k3},zmm21,zmm19 0x000000000000754c <+5948>: vpmaxsd zmm17,zmm2,zmm16 0x0000000000007552 <+5954>: mov ax,0x888c 0x0000000000007556 <+5958>: kmovd k4,eax 0x000000000000755a <+5962>: mov ax,0x88ca 0x000000000000755e <+5966>: vpmaxsd zmm6,zmm14,zmm15 0x0000000000007564 <+5972>: vpminsd zmm6{k4},zmm14,zmm15 0x000000000000756a <+5978>: kmovd k4,eax 0x000000000000756e <+5982>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x59508] # 0x60a80 0x0000000000007578 <+5992>: vpermt2d zmm3,zmm15,zmm17 0x000000000000757e <+5998>: vpminsd zmm17{k4},zmm2,zmm16 0x0000000000007584 <+6004>: vpmaxsd zmm2,zmm0,zmm13 0x000000000000758a <+6010>: vpermi2d zmm15,zmm6,zmm2 0x0000000000007590 <+6016>: vmovdqa64 zmm16,zmm2 0x0000000000007596 <+6022>: vpminsd zmm16{k4},zmm0,zmm13 0x000000000000759c <+6028>: vpmaxsd zmm14,zmm11,zmm12 0x00000000000075a2 <+6034>: vpminsd zmm14{k3},zmm11,zmm12 0x00000000000075a8 <+6040>: vpmaxsd zmm2,zmm7,zmm5 0x00000000000075ae <+6046>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x593c8] # 0x60980 0x00000000000075b8 <+6056>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x593fe] # 0x609c0 0x00000000000075c2 <+6066>: vpermt2d zmm8,zmm13,zmm17 0x00000000000075c8 <+6072>: vpermt2d zmm8,zmm18,zmm1 0x00000000000075ce <+6078>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x59428] # 0x60a00 0x00000000000075d8 <+6088>: vpminsd zmm11,zmm17,zmm8 0x00000000000075de <+6094>: mov ax,0x1135 0x00000000000075e2 <+6098>: kmovd k3,eax 0x00000000000075e6 <+6102>: vmovdqa64 zmm0,zmm11 0x00000000000075ec <+6108>: vpmaxsd zmm0{k3},zmm17,zmm8 0x00000000000075f2 <+6114>: vpermt2d zmm17,zmm12,zmm1 0x00000000000075f8 <+6120>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x5943e] # 0x60a40 0x0000000000007602 <+6130>: vpermi2d zmm12,zmm16,zmm14 0x0000000000007608 <+6136>: vpermt2d zmm12,zmm8,zmm2 0x000000000000760e <+6142>: vmovdqa64 zmm19,zmm2 0x0000000000007614 <+6148>: vpminsd zmm19{k1},zmm7,zmm5 0x000000000000761a <+6154>: vpmaxsd zmm9,zmm9,zmm10 0x0000000000007620 <+6160>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x59316] # 0x60940 0x000000000000762a <+6170>: vmovdqa64 zmm7,zmm19 0x0000000000007630 <+6176>: vpermt2d zmm7,zmm20,zmm14 0x0000000000007636 <+6182>: vpmaxsd zmm10,zmm6,zmm15 0x000000000000763c <+6188>: vpminsd zmm10{k2},zmm6,zmm15 0x0000000000007642 <+6194>: vpermt2d zmm6,zmm13,zmm16 0x0000000000007648 <+6200>: vpermt2d zmm6,zmm18,zmm14 0x000000000000764e <+6206>: vpermt2d zmm17,zmm8,zmm9 0x0000000000007654 <+6212>: vpermi2d zmm20,zmm9,zmm1 0x000000000000765a <+6218>: vpmaxsd zmm8,zmm14,zmm12 0x0000000000007660 <+6224>: mov ax,0xac88 0x0000000000007664 <+6228>: kmovd k1,eax 0x0000000000007668 <+6232>: vpmaxsd zmm13,zmm4,zmm3 0x000000000000766e <+6238>: vpminsd zmm13{k2},zmm4,zmm3 0x0000000000007674 <+6244>: vpminsd zmm3,zmm16,zmm6 0x000000000000767a <+6250>: vmovdqa64 zmm2,zmm3 0x0000000000007680 <+6256>: vpmaxsd zmm2{k3},zmm16,zmm6 0x0000000000007686 <+6262>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59430] # 0x60ac0 0x0000000000007690 <+6272>: vmovdqa64 zmm4,zmm0 0x0000000000007696 <+6278>: vpermt2d zmm4,zmm5,zmm13 0x000000000000769c <+6284>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x5945a] # 0x60b00 0x00000000000076a6 <+6294>: vpermi2d zmm5,zmm2,zmm10 0x00000000000076ac <+6300>: vpermt2d zmm5,zmm6,zmm8 0x00000000000076b2 <+6306>: vpminsd zmm8{k1},zmm14,zmm12 0x00000000000076b8 <+6312>: vpmaxsd zmm12,zmm1,zmm17 0x00000000000076be <+6318>: vpermt2d zmm4,zmm6,zmm12 0x00000000000076c4 <+6324>: vmovdqa64 zmm15,zmm12 0x00000000000076ca <+6330>: vpminsd zmm15{k1},zmm1,zmm17 0x00000000000076d0 <+6336>: vpmaxsd zmm7,zmm19,zmm7 0x00000000000076d6 <+6342>: vpmaxsd zmm6,zmm9,zmm20 0x00000000000076dc <+6348>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x5945a] # 0x60b40 0x00000000000076e6 <+6358>: vmovdqa64 zmm17,zmm13 0x00000000000076ec <+6364>: vpermt2d zmm17,zmm16,zmm0 0x00000000000076f2 <+6370>: vpermi2d zmm16,zmm10,zmm2 0x00000000000076f8 <+6376>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x5947e] # 0x60b80 0x0000000000007702 <+6386>: vmovdqa64 zmm9,zmm6 0x0000000000007708 <+6392>: vpermt2d zmm9,zmm12,zmm15 0x000000000000770e <+6398>: vpermi2d zmm12,zmm7,zmm8 0x0000000000007714 <+6404>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x594a2] # 0x60bc0 0x000000000000771e <+6414>: vmovdqa64 zmm18,zmm15 0x0000000000007724 <+6420>: vpermt2d zmm18,zmm1,zmm11 0x000000000000772a <+6426>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x594cc] # 0x60c00 0x0000000000007734 <+6436>: vpermt2d zmm18,zmm11,zmm6 0x000000000000773a <+6442>: vpermi2d zmm1,zmm8,zmm3 0x0000000000007740 <+6448>: vpermt2d zmm1,zmm11,zmm7 0x0000000000007746 <+6454>: vpminsd zmm11,zmm8,zmm1 0x000000000000774c <+6460>: vpmaxsd zmm3,zmm8,zmm1 0x0000000000007752 <+6466>: mov ax,0xcaaa 0x0000000000007756 <+6470>: kmovd k1,eax 0x000000000000775a <+6474>: vmovdqa32 zmm3{k1},zmm11 0x0000000000007760 <+6480>: vpminsd zmm14,zmm15,zmm18 0x0000000000007766 <+6486>: vpmaxsd zmm1,zmm15,zmm18 0x000000000000776c <+6492>: vmovdqa32 zmm1{k1},zmm14 0x0000000000007772 <+6498>: vpmaxsd zmm18,zmm7,zmm12 0x0000000000007778 <+6504>: mov ax,0x44 0x000000000000777c <+6508>: kmovd k1,eax 0x0000000000007780 <+6512>: vpmaxsd zmm8,zmm10,zmm16 0x0000000000007786 <+6518>: mov ax,0xcc88 0x000000000000778a <+6522>: kmovd k3,eax 0x000000000000778e <+6526>: vpminsd zmm8{k3},zmm10,zmm16 0x0000000000007794 <+6532>: vpmaxsd zmm16,zmm2,zmm5 0x000000000000779a <+6538>: mov ax,0xaaac 0x000000000000779e <+6542>: kmovd k2,eax 0x00000000000077a2 <+6546>: vpmaxsd zmm10,zmm13,zmm17 0x00000000000077a8 <+6552>: vpminsd zmm10{k3},zmm13,zmm17 0x00000000000077ae <+6558>: vpmaxsd zmm17,zmm0,zmm4 0x00000000000077b4 <+6564>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x59502] # 0x60cc0 0x00000000000077be <+6574>: vmovdqa64 zmm13,zmm10 0x00000000000077c4 <+6580>: vpermt2d zmm13,zmm15,zmm17 0x00000000000077ca <+6586>: vpermi2d zmm15,zmm8,zmm16 0x00000000000077d0 <+6592>: vpminsd zmm16{k2},zmm2,zmm5 0x00000000000077d6 <+6598>: vpminsd zmm17{k2},zmm0,zmm4 0x00000000000077dc <+6604>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5951a] # 0x60d00 0x00000000000077e6 <+6614>: vmovdqa64 zmm19,zmm1 0x00000000000077ec <+6620>: vpermt2d zmm19,zmm4,zmm17 0x00000000000077f2 <+6626>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59544] # 0x60d40 0x00000000000077fc <+6636>: vpermi2d zmm4,zmm3,zmm16 0x0000000000007802 <+6642>: vpermt2d zmm4,zmm0,zmm18 0x0000000000007808 <+6648>: vpminsd zmm18{k1},zmm7,zmm12 0x000000000000780e <+6654>: vpmaxsd zmm2,zmm6,zmm9 0x0000000000007814 <+6660>: vpermt2d zmm19,zmm0,zmm2 0x000000000000781a <+6666>: vmovdqa64 zmm5,zmm2 0x0000000000007820 <+6672>: vpminsd zmm5{k1},zmm6,zmm9 0x0000000000007826 <+6678>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x59410] # 0x60c40 0x0000000000007830 <+6688>: vmovdqa64 zmm6,zmm17 0x0000000000007836 <+6694>: vpermt2d zmm6,zmm2,zmm10 0x000000000000783c <+6700>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5943a] # 0x60c80 0x0000000000007846 <+6710>: vpermt2q zmm6,zmm0,zmm1 0x000000000000784c <+6716>: vpermi2d zmm2,zmm16,zmm8 0x0000000000007852 <+6722>: vpermt2q zmm2,zmm0,zmm3 0x0000000000007858 <+6728>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5951e] # 0x60d80 0x0000000000007862 <+6738>: vmovdqa64 zmm9,zmm5 0x0000000000007868 <+6744>: vpermt2d zmm9,zmm7,zmm14 0x000000000000786e <+6750>: vpermi2d zmm7,zmm18,zmm11 0x0000000000007874 <+6756>: vpmaxsd zmm11,zmm16,zmm2 0x000000000000787a <+6762>: mov ax,0xcaac 0x000000000000787e <+6766>: kmovd k1,eax 0x0000000000007882 <+6770>: vpminsd zmm11{k1},zmm16,zmm2 0x0000000000007888 <+6776>: vpmaxsd zmm12,zmm17,zmm6 0x000000000000788e <+6782>: vpminsd zmm12{k1},zmm17,zmm6 0x0000000000007894 <+6788>: vpmaxsd zmm2,zmm18,zmm7 0x000000000000789a <+6794>: mov ax,0xaa 0x000000000000789e <+6798>: kmovd k2,eax 0x00000000000078a2 <+6802>: vpminsd zmm2{k2},zmm18,zmm7 0x00000000000078a8 <+6808>: vpmaxsd zmm6,zmm3,zmm4 0x00000000000078ae <+6814>: vpminsd zmm6{k1},zmm3,zmm4 0x00000000000078b4 <+6820>: vpmaxsd zmm18,zmm8,zmm15 0x00000000000078ba <+6826>: mov ax,0xaa88 0x00000000000078be <+6830>: kmovd k3,eax 0x00000000000078c2 <+6834>: vpminsd zmm18{k3},zmm8,zmm15 0x00000000000078c8 <+6840>: vpmaxsd zmm4,zmm5,zmm9 0x00000000000078ce <+6846>: vpminsd zmm4{k2},zmm5,zmm9 0x00000000000078d4 <+6852>: vpmaxsd zmm5,zmm1,zmm19 0x00000000000078da <+6858>: vpminsd zmm5{k1},zmm1,zmm19 0x00000000000078e0 <+6864>: vpmaxsd zmm7,zmm10,zmm13 0x00000000000078e6 <+6870>: vpminsd zmm7{k3},zmm10,zmm13 0x00000000000078ec <+6876>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x594ca] # 0x60dc0 0x00000000000078f6 <+6886>: vmovdqa64 zmm10,zmm7 0x00000000000078fc <+6892>: vpermt2d zmm10,zmm1,zmm12 0x0000000000007902 <+6898>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x594f4] # 0x60e00 0x000000000000790c <+6908>: vmovdqa64 zmm8,zmm5 0x0000000000007912 <+6914>: vpermt2d zmm8,zmm15,zmm12 0x0000000000007918 <+6920>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5951e] # 0x60e40 0x0000000000007922 <+6930>: vpermt2d zmm8,zmm3,zmm4 0x0000000000007928 <+6936>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x5954e] # 0x60e80 0x0000000000007932 <+6946>: vmovdqa64 zmm9,zmm4 0x0000000000007938 <+6952>: vpermt2d zmm9,zmm13,zmm5 0x000000000000793e <+6958>: vpermi2d zmm1,zmm18,zmm11 0x0000000000007944 <+6964>: vpermi2d zmm15,zmm6,zmm11 0x000000000000794a <+6970>: vpermt2d zmm15,zmm3,zmm2 0x0000000000007950 <+6976>: vpermi2d zmm13,zmm2,zmm6 0x0000000000007956 <+6982>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59560] # 0x60ec0 0x0000000000007960 <+6992>: vmovdqa64 zmm16,zmm12 0x0000000000007966 <+6998>: vpermt2d zmm16,zmm3,zmm7 0x000000000000796c <+7004>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x5958a] # 0x60f00 0x0000000000007976 <+7014>: vpermt2d zmm16,zmm14,zmm5 0x000000000000797c <+7020>: vpermi2d zmm3,zmm11,zmm18 0x0000000000007982 <+7026>: vpermt2d zmm3,zmm14,zmm6 0x0000000000007988 <+7032>: vpminsd zmm19,zmm11,zmm3 0x000000000000798e <+7038>: vpmaxsd zmm14,zmm11,zmm3 0x0000000000007994 <+7044>: mov ax,0xacca 0x0000000000007998 <+7048>: kmovd k1,eax 0x000000000000799c <+7052>: vpblendmd zmm11{k1},zmm14,zmm19 0x00000000000079a2 <+7058>: vpminsd zmm17,zmm12,zmm16 0x00000000000079a8 <+7064>: vpmaxsd zmm16,zmm12,zmm16 0x00000000000079ae <+7070>: vpblendmd zmm12{k1},zmm16,zmm17 0x00000000000079b4 <+7076>: vpmaxsd zmm20,zmm2,zmm13 0x00000000000079ba <+7082>: mov ax,0x4cc 0x00000000000079be <+7086>: kmovd k2,eax 0x00000000000079c2 <+7090>: vpmaxsd zmm21,zmm6,zmm15 0x00000000000079c8 <+7096>: vpmaxsd zmm3,zmm18,zmm1 0x00000000000079ce <+7102>: mov ax,0xccc8 0x00000000000079d2 <+7106>: kmovd k3,eax 0x00000000000079d6 <+7110>: vpminsd zmm3{k3},zmm18,zmm1 0x00000000000079dc <+7116>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x595da] # 0x60fc0 0x00000000000079e6 <+7126>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59610] # 0x61000 0x00000000000079f0 <+7136>: vmovdqa64 zmm18,zmm11 0x00000000000079f6 <+7142>: vpermt2d zmm18,zmm25,zmm3 0x00000000000079fc <+7148>: vpermt2d zmm18,zmm1,zmm21 0x0000000000007a02 <+7154>: vpminsd zmm21{k1},zmm6,zmm15 0x0000000000007a08 <+7160>: vmovdqa64 zmm6,zmm21 0x0000000000007a0e <+7166>: vpermt2d zmm6,zmm25,zmm19 0x0000000000007a14 <+7172>: vpermt2d zmm6,zmm1,zmm20 0x0000000000007a1a <+7178>: vpminsd zmm20{k2},zmm2,zmm13 0x0000000000007a20 <+7184>: vpmaxsd zmm2,zmm4,zmm9 0x0000000000007a26 <+7190>: vpmaxsd zmm13,zmm5,zmm8 0x0000000000007a2c <+7196>: vpmaxsd zmm15,zmm7,zmm10 0x0000000000007a32 <+7202>: vpminsd zmm15{k3},zmm7,zmm10 0x0000000000007a38 <+7208>: vmovdqa64 zmm7,zmm12 0x0000000000007a3e <+7214>: vpermt2d zmm7,zmm25,zmm15 0x0000000000007a44 <+7220>: vpermt2d zmm7,zmm1,zmm13 0x0000000000007a4a <+7226>: vpminsd zmm13{k1},zmm5,zmm8 0x0000000000007a50 <+7232>: vmovdqa64 zmm5,zmm13 0x0000000000007a56 <+7238>: vpermt2d zmm5,zmm25,zmm17 0x0000000000007a5c <+7244>: vpermt2d zmm5,zmm1,zmm2 0x0000000000007a62 <+7250>: vpminsd zmm2{k2},zmm4,zmm9 0x0000000000007a68 <+7256>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x594ce] # 0x60f40 0x0000000000007a72 <+7266>: vmovdqa64 zmm8,zmm15 0x0000000000007a78 <+7272>: vpermt2d zmm8,zmm4,zmm16 0x0000000000007a7e <+7278>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x594f8] # 0x60f80 0x0000000000007a88 <+7288>: vmovdqa64 zmm10,zmm2 0x0000000000007a8e <+7294>: vpermt2d zmm10,zmm9,zmm13 0x0000000000007a94 <+7300>: vpermi2d zmm4,zmm3,zmm14 0x0000000000007a9a <+7306>: vpermi2d zmm9,zmm20,zmm21 0x0000000000007aa0 <+7312>: vpmaxsd zmm14,zmm21,zmm6 0x0000000000007aa6 <+7318>: vpminsd zmm14{k6},zmm21,zmm6 0x0000000000007aac <+7324>: vpmaxsd zmm6,zmm13,zmm5 0x0000000000007ab2 <+7330>: vpminsd zmm6{k6},zmm13,zmm5 0x0000000000007ab8 <+7336>: vpmaxsd zmm5,zmm11,zmm18 0x0000000000007abe <+7342>: vpminsd zmm5{k6},zmm11,zmm18 0x0000000000007ac4 <+7348>: vpmaxsd zmm11,zmm12,zmm7 0x0000000000007aca <+7354>: kmovw WORD PTR [rsp+0x3a],k6 0x0000000000007ad0 <+7360>: vpminsd zmm11{k6},zmm12,zmm7 0x0000000000007ad6 <+7366>: vpmaxsd zmm7,zmm20,zmm9 0x0000000000007adc <+7372>: mov ax,0xaaa 0x0000000000007ae0 <+7376>: kmovd k2,eax 0x0000000000007ae4 <+7380>: vpmaxsd zmm12,zmm2,zmm10 0x0000000000007aea <+7386>: vpminsd zmm12{k2},zmm2,zmm10 0x0000000000007af0 <+7392>: mov ax,0xe000 0x0000000000007af4 <+7396>: kmovd k1,eax 0x0000000000007af8 <+7400>: vpblendmd zmm10{k1},zmm12,zmm7 0x0000000000007afe <+7406>: vmovdqa64 zmm13,zmm7 0x0000000000007b04 <+7412>: vpminsd zmm13{k2},zmm20,zmm9 0x0000000000007b0a <+7418>: vpmaxsd zmm2,zmm3,zmm4 0x0000000000007b10 <+7424>: mov ax,0xaaa8 0x0000000000007b14 <+7428>: kmovd k2,eax 0x0000000000007b18 <+7432>: vpmaxsd zmm9,zmm15,zmm8 0x0000000000007b1e <+7438>: vpminsd zmm9{k2},zmm15,zmm8 0x0000000000007b24 <+7444>: mov ax,0x7 0x0000000000007b28 <+7448>: kmovd k3,eax 0x0000000000007b2c <+7452>: vpblendmd zmm8{k3},zmm9,zmm2 0x0000000000007b32 <+7458>: vpminsd zmm2{k2},zmm3,zmm4 0x0000000000007b38 <+7464>: vpblendmd zmm3{k3},zmm2,zmm9 0x0000000000007b3e <+7470>: vpblendmd zmm4{k1},zmm13,zmm12 0x0000000000007b44 <+7476>: vpminsd zmm15,zmm5,zmm11 0x0000000000007b4a <+7482>: vpminsd zmm16,zmm14,zmm6 0x0000000000007b50 <+7488>: vpminsd zmm17,zmm13,zmm10 0x0000000000007b56 <+7494>: vpminsd zmm7,zmm2,zmm8 0x0000000000007b5c <+7500>: vpmaxsd zmm7{k3},zmm2,zmm8 0x0000000000007b62 <+7506>: vpmaxsd zmm2,zmm12,zmm4 0x0000000000007b68 <+7512>: vpmaxsd zmm4,zmm6,zmm14 0x0000000000007b6e <+7518>: vpmaxsd zmm17{k1},zmm13,zmm10 0x0000000000007b74 <+7524>: vpmaxsd zmm5,zmm11,zmm5 0x0000000000007b7a <+7530>: vpmaxsd zmm3,zmm9,zmm3 0x0000000000007b80 <+7536>: vpminsd zmm6,zmm16,zmm3 0x0000000000007b86 <+7542>: vpminsd zmm9,zmm17,zmm5 0x0000000000007b8c <+7548>: vpmaxsd zmm5,zmm5,zmm17 0x0000000000007b92 <+7554>: vpmaxsd zmm3,zmm3,zmm16 0x0000000000007b98 <+7560>: vpminsd zmm10,zmm9,zmm3 0x0000000000007b9e <+7566>: vpminsd zmm8,zmm15,zmm6 0x0000000000007ba4 <+7572>: vpminsd zmm11,zmm5,zmm4 0x0000000000007baa <+7578>: vpmaxsd zmm9,zmm3,zmm9 0x0000000000007bb0 <+7584>: vpmaxsd zmm6,zmm6,zmm15 0x0000000000007bb6 <+7590>: vpmaxsd zmm12,zmm4,zmm5 0x0000000000007bbc <+7596>: vshufi64x2 zmm13,zmm9,zmm12,0x4e 0x0000000000007bc3 <+7603>: vshufi64x2 zmm5,zmm6,zmm9,0x4e 0x0000000000007bca <+7610>: vshufi64x2 zmm14,zmm10,zmm11,0x4e 0x0000000000007bd1 <+7617>: vshufi64x2 zmm15,zmm8,zmm10,0x4e 0x0000000000007bd8 <+7624>: vshufi64x2 zmm16,zmm12,zmm2,0xee 0x0000000000007bdf <+7631>: vshufi64x2 zmm17,zmm7,zmm6,0x4e 0x0000000000007be6 <+7638>: vshufi64x2 zmm18,zmm11,zmm2,0x4e 0x0000000000007bed <+7645>: vinserti64x4 zmm19,zmm7,ymm8,0x1 0x0000000000007bf4 <+7652>: vpmaxsd zmm4,zmm6,zmm15 0x0000000000007bfa <+7658>: mov ax,0xff00 0x0000000000007bfe <+7662>: kmovd k1,eax 0x0000000000007c02 <+7666>: vmovdqa64 zmm3,zmm4 0x0000000000007c08 <+7672>: vpminsd zmm3{k1},zmm6,zmm15 0x0000000000007c0e <+7678>: vpmaxsd zmm6,zmm9,zmm14 0x0000000000007c14 <+7684>: vpminsd zmm15,zmm10,zmm5 0x0000000000007c1a <+7690>: vpmaxsd zmm10,zmm10,zmm5 0x0000000000007c20 <+7696>: vshufi64x2 zmm20,zmm10,zmm15,0xe4 0x0000000000007c27 <+7703>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x5940f] # 0x61040 0x0000000000007c31 <+7713>: vmovdqa64 zmm5,zmm20 0x0000000000007c37 <+7719>: vpermt2q zmm5,zmm21,zmm3 0x0000000000007c3d <+7725>: vinserti32x4 zmm22,zmm5,xmm6,0x3 0x0000000000007c44 <+7732>: vmovdqa64 zmm5,zmm6 0x0000000000007c4a <+7738>: vpminsd zmm5{k1},zmm9,zmm14 0x0000000000007c50 <+7744>: vpmaxsd zmm6,zmm7,zmm19 0x0000000000007c56 <+7750>: vpminsd zmm6{k1},zmm7,zmm19 0x0000000000007c5c <+7756>: vpmaxsd zmm7,zmm12,zmm18 0x0000000000007c62 <+7762>: vpminsd zmm9,zmm11,zmm13 0x0000000000007c68 <+7768>: vpmaxsd zmm11,zmm11,zmm13 0x0000000000007c6e <+7774>: vshufi64x2 zmm19,zmm11,zmm9,0xe4 0x0000000000007c75 <+7781>: vmovdqa64 zmm13,zmm19 0x0000000000007c7b <+7787>: vpermt2q zmm13,zmm21,zmm5 0x0000000000007c81 <+7793>: vinserti32x4 zmm23,zmm13,xmm7,0x3 0x0000000000007c88 <+7800>: vpminsd zmm7{k1},zmm12,zmm18 0x0000000000007c8e <+7806>: vpminsd zmm12,zmm8,zmm17 0x0000000000007c94 <+7812>: vpmaxsd zmm8,zmm8,zmm17 0x0000000000007c9a <+7818>: vpmaxsd zmm2,zmm2,zmm16 0x0000000000007ca0 <+7824>: vshufi64x2 zmm13,zmm8,zmm12,0xe4 0x0000000000007ca7 <+7831>: vmovdqa64 zmm14,zmm5 0x0000000000007cad <+7837>: vpermt2q zmm14,zmm21,zmm15 0x0000000000007cb3 <+7843>: vinserti32x4 zmm14,zmm14,xmm11,0x3 0x0000000000007cba <+7850>: vmovdqa64 zmm11,zmm3 0x0000000000007cc0 <+7856>: vpermt2q zmm11,zmm21,zmm12 0x0000000000007cc6 <+7862>: vinserti32x4 zmm17,zmm11,xmm10,0x3 0x0000000000007ccd <+7869>: vmovdqa64 zmm10,zmm7 0x0000000000007cd3 <+7875>: vpermt2q zmm10,zmm21,zmm9 0x0000000000007cd9 <+7881>: vinserti32x4 zmm12,zmm10,xmm2,0x3 0x0000000000007ce0 <+7888>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59396] # 0x61080 0x0000000000007cea <+7898>: vpermi2q zmm18,zmm6,zmm8 0x0000000000007cf0 <+7904>: vpermi2q zmm21,zmm13,zmm6 0x0000000000007cf6 <+7910>: vinserti32x4 zmm4,zmm21,xmm4,0x3 0x0000000000007cfd <+7917>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x593b9] # 0x610c0 0x0000000000007d07 <+7927>: vpermi2q zmm11,zmm2,zmm7 0x0000000000007d0d <+7933>: vpminsd zmm21,zmm20,zmm22 0x0000000000007d13 <+7939>: vpmaxsd zmm16,zmm20,zmm22 0x0000000000007d19 <+7945>: mov al,0xcc 0x0000000000007d1b <+7947>: kmovd k1,eax 0x0000000000007d1f <+7951>: vpblendmq zmm10{k1},zmm16,zmm21 0x0000000000007d25 <+7957>: vpminsd zmm20,zmm13,zmm4 0x0000000000007d2b <+7963>: vpmaxsd zmm13,zmm13,zmm4 0x0000000000007d31 <+7969>: vpblendmq zmm8{k1},zmm13,zmm20 0x0000000000007d37 <+7975>: vpminsd zmm22,zmm19,zmm23 0x0000000000007d3d <+7981>: vpmaxsd zmm19,zmm19,zmm23 0x0000000000007d43 <+7987>: vpblendmq zmm9{k1},zmm19,zmm22 0x0000000000007d49 <+7993>: vpmaxsd zmm15,zmm3,zmm17 0x0000000000007d4f <+7999>: mov ax,0xf0f0 0x0000000000007d53 <+8003>: kmovd k1,eax 0x0000000000007d57 <+8007>: vmovdqa64 zmm4,zmm15 0x0000000000007d5d <+8013>: vpminsd zmm4{k1},zmm3,zmm17 0x0000000000007d63 <+8019>: vpmaxsd zmm3,zmm5,zmm14 0x0000000000007d69 <+8025>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x5938d] # 0x61100 0x0000000000007d73 <+8035>: vmovdqa64 zmm23,zmm10 0x0000000000007d79 <+8041>: vpermt2q zmm23,zmm17,zmm4 0x0000000000007d7f <+8047>: vpermt2q zmm23,zmm0,zmm3 0x0000000000007d85 <+8053>: vmovdqa64 zmm24,zmm3 0x0000000000007d8b <+8059>: vpminsd zmm24{k1},zmm5,zmm14 0x0000000000007d91 <+8065>: vpmaxsd zmm5,zmm6,zmm18 0x0000000000007d97 <+8071>: vpminsd zmm5{k1},zmm6,zmm18 0x0000000000007d9d <+8077>: vpmaxsd zmm3,zmm7,zmm12 0x0000000000007da3 <+8083>: vmovdqa64 zmm6,zmm9 0x0000000000007da9 <+8089>: vpermt2q zmm6,zmm17,zmm24 0x0000000000007daf <+8095>: vpermt2q zmm6,zmm0,zmm3 0x0000000000007db5 <+8101>: vmovdqa64 zmm14,zmm3 0x0000000000007dbb <+8107>: vpminsd zmm14{k1},zmm7,zmm12 0x0000000000007dc1 <+8113>: vpmaxsd zmm3,zmm2,zmm11 0x0000000000007dc7 <+8119>: mov ax,0xf0 0x0000000000007dcb <+8123>: kmovd k1,eax 0x0000000000007dcf <+8127>: vmovdqa64 zmm7,zmm24 0x0000000000007dd5 <+8133>: vpermt2q zmm7,zmm17,zmm21 0x0000000000007ddb <+8139>: vpermt2q zmm7,zmm0,zmm19 0x0000000000007de1 <+8145>: vmovdqa64 zmm12,zmm4 0x0000000000007de7 <+8151>: vpermt2q zmm12,zmm17,zmm20 0x0000000000007ded <+8157>: vpermt2q zmm12,zmm0,zmm16 0x0000000000007df3 <+8163>: vmovdqa64 zmm16,zmm14 0x0000000000007df9 <+8169>: vpermt2q zmm16,zmm17,zmm22 0x0000000000007dff <+8175>: vpermt2q zmm16,zmm0,zmm3 0x0000000000007e05 <+8181>: vpminsd zmm3{k1},zmm2,zmm11 0x0000000000007e0b <+8187>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5932b] # 0x61140 0x0000000000007e15 <+8197>: vpermi2q zmm2,zmm5,zmm13 0x0000000000007e1b <+8203>: vpermi2q zmm17,zmm8,zmm5 0x0000000000007e21 <+8209>: vpermt2q zmm17,zmm0,zmm15 0x0000000000007e27 <+8215>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5934f] # 0x61180 0x0000000000007e31 <+8225>: vpermi2q zmm0,zmm3,zmm14 0x0000000000007e37 <+8231>: vpminsd zmm11,zmm10,zmm23 0x0000000000007e3d <+8237>: vpmaxsd zmm10,zmm10,zmm23 0x0000000000007e43 <+8243>: mov al,0xaa 0x0000000000007e45 <+8245>: kmovd k1,eax 0x0000000000007e49 <+8249>: vpblendmq zmm21{k1},zmm10,zmm11 0x0000000000007e4f <+8255>: vpminsd zmm13,zmm8,zmm17 0x0000000000007e55 <+8261>: vpmaxsd zmm8,zmm8,zmm17 0x0000000000007e5b <+8267>: vpblendmq zmm20{k1},zmm8,zmm13 0x0000000000007e61 <+8273>: vpminsd zmm15,zmm9,zmm6 0x0000000000007e67 <+8279>: vpmaxsd zmm6,zmm9,zmm6 0x0000000000007e6d <+8285>: vpblendmq zmm22{k1},zmm6,zmm15 0x0000000000007e73 <+8291>: vpminsd zmm9,zmm4,zmm12 0x0000000000007e79 <+8297>: vpminsd zmm17,zmm24,zmm7 0x0000000000007e7f <+8303>: vpmaxsd zmm18,zmm3,zmm0 0x0000000000007e85 <+8309>: mov ax,0xccc 0x0000000000007e89 <+8313>: kmovd k1,eax 0x0000000000007e8d <+8317>: vpminsd zmm19,zmm5,zmm2 0x0000000000007e93 <+8323>: vpmaxsd zmm4,zmm4,zmm12 0x0000000000007e99 <+8329>: vpminsd zmm12,zmm14,zmm16 0x0000000000007e9f <+8335>: vpmaxsd zmm7,zmm24,zmm7 0x0000000000007ea5 <+8341>: vpmaxsd zmm2,zmm5,zmm2 0x0000000000007eab <+8347>: vshufps zmm5,zmm2,zmm19,0xe4 0x0000000000007eb2 <+8354>: vpmaxsd zmm2,zmm14,zmm16 0x0000000000007eb8 <+8360>: vshufps zmm16,zmm7,zmm17,0xe4 0x0000000000007ebf <+8367>: vshufps zmm14,zmm4,zmm9,0xe4 0x0000000000007ec6 <+8374>: vshufps zmm9,zmm2,zmm12,0xe4 0x0000000000007ecd <+8381>: vmovaps zmm12,zmm14 0x0000000000007ed3 <+8387>: vpermt2d zmm12,zmm25,zmm13 0x0000000000007ed9 <+8393>: vmovdqa64 ZMMWORD PTR [rsp+0x740],zmm21 0x0000000000007ee1 <+8401>: vmovaps ZMMWORD PTR [rsp+0x640],zmm14 0x0000000000007ee9 <+8409>: vpermt2d zmm21,zmm25,zmm14 0x0000000000007eef <+8415>: vmovaps zmm13,zmm16 0x0000000000007ef5 <+8421>: vpermt2d zmm13,zmm25,zmm11 0x0000000000007efb <+8427>: vmovdqa64 ZMMWORD PTR [rsp+0x700],zmm22 0x0000000000007f03 <+8435>: vmovaps ZMMWORD PTR [rsp+0x5c0],zmm16 0x0000000000007f0b <+8443>: vpermt2d zmm22,zmm25,zmm16 0x0000000000007f11 <+8449>: vmovdqa64 ZMMWORD PTR [rsp+0x780],zmm20 0x0000000000007f19 <+8457>: vpermt2d zmm20,zmm25,zmm5 0x0000000000007f1f <+8463>: vpermi2d zmm25,zmm9,zmm15 0x0000000000007f25 <+8469>: vpermt2d zmm25,zmm1,zmm18 0x0000000000007f2b <+8475>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm25 0x0000000000007f33 <+8483>: vpminsd zmm18{k1},zmm3,zmm0 0x0000000000007f39 <+8489>: vpermt2d zmm12,zmm1,zmm10 0x0000000000007f3f <+8495>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm12 0x0000000000007f47 <+8503>: vpermt2d zmm21,zmm1,zmm7 0x0000000000007f4d <+8509>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm21 0x0000000000007f55 <+8517>: vpermt2d zmm13,zmm1,zmm6 0x0000000000007f5b <+8523>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm13 0x0000000000007f63 <+8531>: vpermt2d zmm22,zmm1,zmm2 0x0000000000007f69 <+8537>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm22 0x0000000000007f71 <+8545>: vpermt2d zmm20,zmm1,zmm4 0x0000000000007f77 <+8551>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm20 0x0000000000007f7f <+8559>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59237] # 0x611c0 0x0000000000007f89 <+8569>: vmovaps ZMMWORD PTR [rsp+0x6c0],zmm5 0x0000000000007f91 <+8577>: vpermi2d zmm0,zmm5,zmm8 0x0000000000007f97 <+8583>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm0 0x0000000000007f9f <+8591>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59257] # 0x61200 0x0000000000007fa9 <+8601>: vmovaps ZMMWORD PTR [rsp+0x680],zmm9 0x0000000000007fb1 <+8609>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm18 0x0000000000007fb9 <+8617>: vpermi2d zmm0,zmm18,zmm9 0x0000000000007fbf <+8623>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm0 0x0000000000007fc7 <+8631>: vpxor xmm0,xmm0,xmm0 0x0000000000007fcb <+8635>: vmovdqa XMMWORD PTR [rsp+0x50],xmm0 0x0000000000007fd1 <+8641>: lea rsi,[rsp+0x50] 0x0000000000007fd6 <+8646>: mov edi,0x1 0x0000000000007fdb <+8651>: vzeroupper 0x0000000000007fde <+8654>: call 0x5470 <clock_gettime@plt> 0x0000000000007fe3 <+8659>: mov r12,QWORD PTR [rsp+0x50] 0x0000000000007fe8 <+8664>: sub r12,rbx 0x0000000000007feb <+8667>: mov rbx,QWORD PTR [rsp+0x58] 0x0000000000007ff0 <+8672>: mov edi,0x80 0x0000000000007ff5 <+8677>: call 0xa050 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000007ffa <+8682>: mov r14,rax 0x0000000000007ffd <+8685>: test rax,rax 0x0000000000008000 <+8688>: jle 0x8017 <main+8711> 0x0000000000008002 <+8690>: mov edi,0x1 0x0000000000008007 <+8695>: mov rsi,r14 0x000000000000800a <+8698>: call 0x2f5a0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000800f <+8703>: mov r15,rax 0x0000000000008012 <+8706>: mov r13,r14 0x0000000000008015 <+8709>: jmp 0x801d <main+8717> 0x0000000000008017 <+8711>: xor r15d,r15d 0x000000000000801a <+8714>: xor r13d,r13d 0x000000000000801d <+8717>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x480] 0x0000000000008025 <+8725>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x700] 0x000000000000802d <+8733>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm0 0x0000000000008035 <+8741>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x500] 0x000000000000803d <+8749>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x5c0] 0x0000000000008045 <+8757>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x000000000000804d <+8765>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x580] 0x0000000000008055 <+8773>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x740] 0x000000000000805d <+8781>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000008065 <+8789>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x600] 0x000000000000806d <+8797>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x640] 0x0000000000008075 <+8805>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x000000000000807d <+8813>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x400] 0x0000000000008085 <+8821>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x6c0] 0x000000000000808d <+8829>: vmovdqa64 ZMMWORD PTR [rsp+0x200],zmm0 0x0000000000008095 <+8837>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x680] 0x000000000000809d <+8845>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x7c0] 0x00000000000080a5 <+8853>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x00000000000080ad <+8861>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x540] 0x00000000000080b5 <+8869>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x780] 0x00000000000080bd <+8877>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x00000000000080c5 <+8885>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x440] 0x00000000000080cd <+8893>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x4c0] 0x00000000000080d5 <+8901>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x00000000000080dd <+8909>: mov ax,0x2aaa 0x00000000000080e1 <+8913>: kmovd k1,eax 0x00000000000080e5 <+8917>: kmovw WORD PTR [rsp+0x38],k1 0x00000000000080eb <+8923>: imul r12,r12,0x3b9aca00 0x00000000000080f2 <+8930>: sub rbx,QWORD PTR [rsp+0x60] 0x00000000000080f7 <+8935>: lea rdx,[rip+0x59142] # 0x61240 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000080fe <+8942>: mov ecx,0x80 0x0000000000008103 <+8947>: mov rdi,r15 0x0000000000008106 <+8950>: mov rsi,r14 0x0000000000008109 <+8953>: xor eax,eax 0x000000000000810b <+8955>: vzeroupper 0x000000000000810e <+8958>: call 0x57c0 <snprintf@plt> 0x0000000000008113 <+8963>: cdqe 0x0000000000008115 <+8965>: inc rax 0x0000000000008118 <+8968>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000008120 <+8976>: mov QWORD PTR [rsp+0xa8],rax 0x0000000000008128 <+8984>: mov QWORD PTR [rsp+0xb0],r13 0x0000000000008130 <+8992>: lea rdx,[rip+0x59129] # 0x61260 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x0000000000008137 <+8999>: lea rdi,[rsp+0x358] 0x000000000000813f <+9007>: lea rsi,[rsp+0xa0] 0x0000000000008147 <+9015>: mov ecx,0x6 0x000000000000814c <+9020>: call 0xf6a0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000008151 <+9025>: mov rdi,QWORD PTR [rsp+0xa0] 0x0000000000008159 <+9033>: test rdi,rdi 0x000000000000815c <+9036>: je 0x8163 <main+9043> 0x000000000000815e <+9038>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000008163 <+9043>: kmovw k1,WORD PTR [rsp+0x3a] 0x0000000000008169 <+9049>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x240] 0x0000000000008171 <+9057>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x480] 0x0000000000008179 <+9065>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x700] 0x0000000000008181 <+9073>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm0 0x0000000000008189 <+9081>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x2c0] 0x0000000000008191 <+9089>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x500] 0x0000000000008199 <+9097>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x5c0] 0x00000000000081a1 <+9105>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x00000000000081a9 <+9113>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x1c0] 0x00000000000081b1 <+9121>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x580] 0x00000000000081b9 <+9129>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x740] 0x00000000000081c1 <+9137>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x00000000000081c9 <+9145>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x280] 0x00000000000081d1 <+9153>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x600] 0x00000000000081d9 <+9161>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x640] 0x00000000000081e1 <+9169>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x00000000000081e9 <+9177>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x200] 0x00000000000081f1 <+9185>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x400] 0x00000000000081f9 <+9193>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x6c0] 0x0000000000008201 <+9201>: vmovdqa64 ZMMWORD PTR [rsp+0x200],zmm0 0x0000000000008209 <+9209>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000008211 <+9217>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x680] 0x0000000000008219 <+9225>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x7c0] 0x0000000000008221 <+9233>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x0000000000008229 <+9241>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000008231 <+9249>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x540] 0x0000000000008239 <+9257>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x780] 0x0000000000008241 <+9265>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000008249 <+9273>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000008251 <+9281>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x440] 0x0000000000008259 <+9289>: kmovw k1,WORD PTR [rsp+0x38] 0x000000000000825f <+9295>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x4c0] 0x0000000000008267 <+9303>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x000000000000826f <+9311>: add rbx,r12 0x0000000000008272 <+9314>: mov edi,0x1 0x0000000000008277 <+9319>: mov esi,0x3 0x000000000000827c <+9324>: vzeroupper 0x000000000000827f <+9327>: call 0x2f5a0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000008284 <+9332>: xor ecx,ecx 0x0000000000008286 <+9334>: cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000008290 <+9344>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000008294 <+9348>: inc rcx 0x0000000000008297 <+9351>: cmp rcx,0x3 0x000000000000829b <+9355>: jne 0x8290 <main+9344> 0x000000000000829d <+9357>: mov WORD PTR [rax],0x203a 0x00000000000082a2 <+9362>: mov BYTE PTR [rax+0x2],0x0 0x00000000000082a6 <+9366>: mov QWORD PTR [rsp+0xb8],rax 0x00000000000082ae <+9374>: mov QWORD PTR [rsp+0xc0],0x3 0x00000000000082ba <+9386>: mov QWORD PTR [rsp+0xc8],0x3 0x00000000000082c6 <+9398>: lea rdi,[rsp+0x370] 0x00000000000082ce <+9406>: lea rsi,[rsp+0x358] 0x00000000000082d6 <+9414>: lea rdx,[rsp+0xb8] 0x00000000000082de <+9422>: call 0xf260 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000082e3 <+9427>: mov rdi,QWORD PTR [rsp+0xb8] 0x00000000000082eb <+9435>: test rdi,rdi 0x00000000000082ee <+9438>: je 0x82f5 <main+9445> 0x00000000000082f0 <+9440>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000082f5 <+9445>: mov rdi,QWORD PTR [rsp+0x358] 0x00000000000082fd <+9453>: test rdi,rdi 0x0000000000008300 <+9456>: je 0x8307 <main+9463> 0x0000000000008302 <+9458>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000008307 <+9463>: lea r14,[rsp+0x3e8] 0x000000000000830f <+9471>: mov rdi,r14 0x0000000000008312 <+9474>: vmovaps zmm0,ZMMWORD PTR [rsp+0x200] 0x000000000000831a <+9482>: vmovaps zmm1,ZMMWORD PTR [rsp+0x140] 0x0000000000008322 <+9490>: vmovaps zmm2,ZMMWORD PTR [rsp+0x280] 0x000000000000832a <+9498>: vmovaps zmm3,ZMMWORD PTR [rsp+0x1c0] 0x0000000000008332 <+9506>: vmovaps zmm4,ZMMWORD PTR [rsp+0x2c0] 0x000000000000833a <+9514>: vmovaps zmm5,ZMMWORD PTR [rsp+0x240] 0x0000000000008342 <+9522>: vmovaps zmm6,ZMMWORD PTR [rsp+0x180] 0x000000000000834a <+9530>: vmovaps zmm7,ZMMWORD PTR [rsp+0x100] 0x0000000000008352 <+9538>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=128> 0x0000000000008357 <+9543>: lea rdi,[rsp+0x388] 0x000000000000835f <+9551>: lea rsi,[rsp+0x370] 0x0000000000008367 <+9559>: mov rdx,r14 0x000000000000836a <+9562>: vzeroupper 0x000000000000836d <+9565>: call 0xf260 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000008372 <+9570>: mov rdi,QWORD PTR [rsp+0x3e8] 0x000000000000837a <+9578>: test rdi,rdi 0x000000000000837d <+9581>: je 0x8384 <main+9588> 0x000000000000837f <+9583>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000008384 <+9588>: mov rdi,QWORD PTR [rsp+0x370] 0x000000000000838c <+9596>: test rdi,rdi 0x000000000000838f <+9599>: je 0x8396 <main+9606> 0x0000000000008391 <+9601>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000008396 <+9606>: lea rdi,[rsp+0x388] 0x000000000000839e <+9614>: call 0xab00 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000083a3 <+9619>: mov rdi,QWORD PTR [rsp+0x388] 0x00000000000083ab <+9627>: test rdi,rdi 0x00000000000083ae <+9630>: je 0x83b5 <main+9637> 0x00000000000083b0 <+9632>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000083b5 <+9637>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x00000000000083bd <+9645>: vpaddd zmm0,zmm0,ZMMWORD PTR [rsp+0x240] 0x00000000000083c5 <+9653>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x100] 0x00000000000083cd <+9661>: vpaddd zmm1,zmm1,ZMMWORD PTR [rsp+0x1c0] 0x00000000000083d5 <+9669>: vpaddd zmm0,zmm0,zmm1 0x00000000000083db <+9675>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x200] 0x00000000000083e3 <+9683>: vpaddd zmm1,zmm1,ZMMWORD PTR [rsp+0x2c0] 0x00000000000083eb <+9691>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x180] 0x00000000000083f3 <+9699>: vpaddd zmm2,zmm2,ZMMWORD PTR [rsp+0x280] 0x00000000000083fb <+9707>: vpaddd zmm1,zmm1,zmm2 0x0000000000008401 <+9713>: vpaddd zmm0,zmm1,zmm0 0x0000000000008407 <+9719>: vextracti64x4 ymm1,zmm0,0x1 0x000000000000840e <+9726>: vpaddd ymm0,ymm0,ymm1 0x0000000000008412 <+9730>: vextracti128 xmm1,ymm0,0x1 0x0000000000008418 <+9736>: vpaddd xmm0,xmm0,xmm1 0x000000000000841c <+9740>: vpshufd xmm1,xmm0,0xee 0x0000000000008421 <+9745>: vpaddd xmm0,xmm0,xmm1 0x0000000000008425 <+9749>: vpshufd xmm1,xmm0,0x55 0x000000000000842a <+9754>: vpaddd xmm0,xmm0,xmm1 0x000000000000842e <+9758>: vmovd eax,xmm0 0x0000000000008432 <+9762>: vmovd DWORD PTR [rsp+0x3c],xmm0 0x0000000000008438 <+9768>: lea rcx,[rsp+0x3c] 0x000000000000843d <+9773>: mov QWORD PTR [rsp+0x68],rcx 0x0000000000008442 <+9778>: mov rdi,rbx 0x0000000000008445 <+9781>: vzeroupper 0x0000000000008448 <+9784>: call 0xa050 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000844d <+9789>: mov r14,rax 0x0000000000008450 <+9792>: test rax,rax 0x0000000000008453 <+9795>: jle 0x846a <main+9818> 0x0000000000008455 <+9797>: mov edi,0x1 0x000000000000845a <+9802>: mov rsi,r14 0x000000000000845d <+9805>: call 0x2f5a0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000008462 <+9810>: mov r15,rax 0x0000000000008465 <+9813>: mov r12,r14 0x0000000000008468 <+9816>: jmp 0x8470 <main+9824> 0x000000000000846a <+9818>: xor r15d,r15d 0x000000000000846d <+9821>: xor r12d,r12d 0x0000000000008470 <+9824>: lea rdx,[rip+0x58dc9] # 0x61240 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000008477 <+9831>: mov rdi,r15 0x000000000000847a <+9834>: mov rsi,r14 0x000000000000847d <+9837>: mov rcx,rbx 0x0000000000008480 <+9840>: xor eax,eax 0x0000000000008482 <+9842>: call 0x57c0 <snprintf@plt> 0x0000000000008487 <+9847>: cdqe 0x0000000000008489 <+9849>: inc rax 0x000000000000848c <+9852>: mov QWORD PTR [rsp+0xd0],r15 0x0000000000008494 <+9860>: mov QWORD PTR [rsp+0xd8],rax 0x000000000000849c <+9868>: mov QWORD PTR [rsp+0xe0],r12 0x00000000000084a4 <+9876>: lea rdx,[rip+0x58dc5] # 0x61270 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x00000000000084ab <+9883>: lea rdi,[rsp+0x3a0] 0x00000000000084b3 <+9891>: lea rsi,[rsp+0xd0] 0x00000000000084bb <+9899>: mov ecx,0xb 0x00000000000084c0 <+9904>: call 0xf6a0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000084c5 <+9909>: mov rdi,QWORD PTR [rsp+0xd0] 0x00000000000084cd <+9917>: test rdi,rdi 0x00000000000084d0 <+9920>: je 0x84d7 <main+9927> 0x00000000000084d2 <+9922>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000084d7 <+9927>: mov edi,0x1 0x00000000000084dc <+9932>: mov esi,0x4 0x00000000000084e1 <+9937>: call 0x2f5a0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000084e6 <+9942>: xor ecx,ecx 0x00000000000084e8 <+9944>: nop DWORD PTR [rax+rax*1+0x0] 0x00000000000084f0 <+9952>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000084f4 <+9956>: inc rcx 0x00000000000084f7 <+9959>: cmp rcx,0x4 0x00000000000084fb <+9963>: jne 0x84f0 <main+9952> 0x00000000000084fd <+9965>: mov DWORD PTR [rax],0x736e20 0x0000000000008503 <+9971>: mov QWORD PTR [rsp+0xe8],rax 0x000000000000850b <+9979>: mov QWORD PTR [rsp+0xf0],0x4 0x0000000000008517 <+9991>: mov QWORD PTR [rsp+0xf8],0x4 0x0000000000008523 <+10003>: lea rdi,[rsp+0x3b8] 0x000000000000852b <+10011>: lea rsi,[rsp+0x3a0] 0x0000000000008533 <+10019>: lea rdx,[rsp+0xe8] 0x000000000000853b <+10027>: call 0xf260 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000008540 <+10032>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000008548 <+10040>: test rdi,rdi 0x000000000000854b <+10043>: je 0x8552 <main+10050> 0x000000000000854d <+10045>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000008552 <+10050>: mov rdi,QWORD PTR [rsp+0x3a0] 0x000000000000855a <+10058>: test rdi,rdi 0x000000000000855d <+10061>: je 0x8564 <main+10068> 0x000000000000855f <+10063>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000008564 <+10068>: lea rdi,[rsp+0x3b8] 0x000000000000856c <+10076>: call 0xab00 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000008571 <+10081>: mov rdi,QWORD PTR [rsp+0x3b8] 0x0000000000008579 <+10089>: test rdi,rdi 0x000000000000857c <+10092>: je 0x8583 <main+10099> 0x000000000000857e <+10094>: call 0x2f5c0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000008583 <+10099>: call 0x2b9c0 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000008588 <+10104>: xor eax,eax 0x000000000000858a <+10106>: lea rsp,[rbp-0x28] 0x000000000000858e <+10110>: pop rbx 0x000000000000858f <+10111>: pop r12 0x0000000000008591 <+10113>: pop r13 0x0000000000008593 <+10115>: pop r14 0x0000000000008595 <+10117>: pop r15 0x0000000000008597 <+10119>: pop rbp 0x0000000000008598 <+10120>: ret End of assembler dump. --- disassemble/int32_16.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d20 <+0>: push rbp 0x0000000000005d21 <+1>: push r15 0x0000000000005d23 <+3>: push r14 0x0000000000005d25 <+5>: push r13 0x0000000000005d27 <+7>: push r12 0x0000000000005d29 <+9>: push rbx 0x0000000000005d2a <+10>: sub rsp,0x288 0x0000000000005d31 <+17>: call 0x2f040 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d36 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d3a <+26>: mov ebx,0x11 0x0000000000005d3f <+31>: xor r14d,r14d 0x0000000000005d42 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005d50 <+48>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x0000000000005d5b <+59>: vzeroupper 0x0000000000005d5e <+62>: call 0x2df90 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d63 <+67>: mov edx,0x64 0x0000000000005d68 <+72>: mov rdi,rax 0x0000000000005d6b <+75>: xor esi,esi 0x0000000000005d6d <+77>: call 0x2e3a0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005d72 <+82>: vpbroadcastd zmm0,r14d 0x0000000000005d78 <+88>: vpcmpeqd k1,zmm0,ZMMWORD PTR [rip+0x5637e] # 0x5c100 0x0000000000005d82 <+98>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0xd0] 0x0000000000005d8d <+109>: vpbroadcastd zmm0{k1},eax 0x0000000000005d93 <+115>: dec rbx 0x0000000000005d96 <+118>: inc r14 0x0000000000005d99 <+121>: cmp rbx,0x1 0x0000000000005d9d <+125>: ja 0x5d50 <main+48> 0x0000000000005d9f <+127>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x0000000000005daa <+138>: mov edi,0x10 0x0000000000005daf <+143>: vzeroupper 0x0000000000005db2 <+146>: call 0x7f20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005db7 <+151>: mov rbx,rax 0x0000000000005dba <+154>: test rax,rax 0x0000000000005dbd <+157>: jle 0x5dd4 <main+180> 0x0000000000005dbf <+159>: mov edi,0x1 0x0000000000005dc4 <+164>: mov rsi,rbx 0x0000000000005dc7 <+167>: call 0x2d470 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005dcc <+172>: mov r14,rax 0x0000000000005dcf <+175>: mov r15,rbx 0x0000000000005dd2 <+178>: jmp 0x5dda <main+186> 0x0000000000005dd4 <+180>: xor r14d,r14d 0x0000000000005dd7 <+183>: xor r15d,r15d 0x0000000000005dda <+186>: lea rdx,[rip+0x5659f] # 0x5c380 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005de1 <+193>: mov ecx,0x10 0x0000000000005de6 <+198>: mov rdi,r14 0x0000000000005de9 <+201>: mov rsi,rbx 0x0000000000005dec <+204>: xor eax,eax 0x0000000000005dee <+206>: call 0x57c0 <snprintf@plt> 0x0000000000005df3 <+211>: cdqe 0x0000000000005df5 <+213>: inc rax 0x0000000000005df8 <+216>: mov QWORD PTR [rsp+0x40],r14 0x0000000000005dfd <+221>: mov QWORD PTR [rsp+0x48],rax 0x0000000000005e02 <+226>: mov QWORD PTR [rsp+0x50],r15 0x0000000000005e07 <+231>: lea rdx,[rip+0x56582] # 0x5c390 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e0e <+238>: lea rdi,[rsp+0x110] 0x0000000000005e16 <+246>: lea rsi,[rsp+0x40] 0x0000000000005e1b <+251>: mov ecx,0x7 0x0000000000005e20 <+256>: call 0xd570 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e25 <+261>: mov rdi,QWORD PTR [rsp+0x40] 0x0000000000005e2a <+266>: test rdi,rdi 0x0000000000005e2d <+269>: je 0x5e34 <main+276> 0x0000000000005e2f <+271>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e34 <+276>: mov edi,0x1 0x0000000000005e39 <+281>: mov esi,0x3 0x0000000000005e3e <+286>: call 0x2d470 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e43 <+291>: xor ecx,ecx 0x0000000000005e45 <+293>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005e50 <+304>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005e54 <+308>: inc rcx 0x0000000000005e57 <+311>: cmp rcx,0x3 0x0000000000005e5b <+315>: jne 0x5e50 <main+304> 0x0000000000005e5d <+317>: mov WORD PTR [rax],0x203a 0x0000000000005e62 <+322>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005e66 <+326>: mov QWORD PTR [rsp+0x58],rax 0x0000000000005e6b <+331>: mov QWORD PTR [rsp+0x60],0x3 0x0000000000005e74 <+340>: mov QWORD PTR [rsp+0x68],0x3 0x0000000000005e7d <+349>: lea rdi,[rsp+0x128] 0x0000000000005e85 <+357>: lea rsi,[rsp+0x110] 0x0000000000005e8d <+365>: lea rdx,[rsp+0x58] 0x0000000000005e92 <+370>: call 0xd130 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005e97 <+375>: mov rdi,QWORD PTR [rsp+0x58] 0x0000000000005e9c <+380>: test rdi,rdi 0x0000000000005e9f <+383>: je 0x5ea6 <main+390> 0x0000000000005ea1 <+385>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ea6 <+390>: mov rdi,QWORD PTR [rsp+0x110] 0x0000000000005eae <+398>: test rdi,rdi 0x0000000000005eb1 <+401>: je 0x5eb8 <main+408> 0x0000000000005eb3 <+403>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005eb8 <+408>: lea rbx,[rsp+0x1d0] 0x0000000000005ec0 <+416>: mov rdi,rbx 0x0000000000005ec3 <+419>: vmovups zmm0,ZMMWORD PTR [rsp+0xd0] 0x0000000000005ece <+430>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=16> 0x0000000000005ed3 <+435>: lea rdi,[rsp+0x140] 0x0000000000005edb <+443>: lea rsi,[rsp+0x128] 0x0000000000005ee3 <+451>: mov rdx,rbx 0x0000000000005ee6 <+454>: vzeroupper 0x0000000000005ee9 <+457>: call 0xd130 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005eee <+462>: mov rdi,QWORD PTR [rsp+0x1d0] 0x0000000000005ef6 <+470>: test rdi,rdi 0x0000000000005ef9 <+473>: je 0x5f00 <main+480> 0x0000000000005efb <+475>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f00 <+480>: mov rdi,QWORD PTR [rsp+0x128] 0x0000000000005f08 <+488>: test rdi,rdi 0x0000000000005f0b <+491>: je 0x5f12 <main+498> 0x0000000000005f0d <+493>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f12 <+498>: lea rdi,[rsp+0x140] 0x0000000000005f1a <+506>: call 0x89d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f1f <+511>: mov rdi,QWORD PTR [rsp+0x140] 0x0000000000005f27 <+519>: test rdi,rdi 0x0000000000005f2a <+522>: je 0x5f31 <main+529> 0x0000000000005f2c <+524>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f31 <+529>: vxorps xmm0,xmm0,xmm0 0x0000000000005f35 <+533>: vmovaps XMMWORD PTR [rsp+0x10],xmm0 0x0000000000005f3b <+539>: lea rsi,[rsp+0x10] 0x0000000000005f40 <+544>: mov edi,0x1 0x0000000000005f45 <+549>: call 0x5470 <clock_gettime@plt> 0x0000000000005f4a <+554>: mov rbx,QWORD PTR [rsp+0x10] 0x0000000000005f4f <+559>: mov rax,QWORD PTR [rsp+0x18] 0x0000000000005f54 <+564>: mov QWORD PTR [rsp+0x30],rax 0x0000000000005f59 <+569>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x561dd] # 0x5c140 0x0000000000005f63 <+579>: vmovdqu64 zmm2,ZMMWORD PTR [rsp+0xd0] 0x0000000000005f6e <+590>: vpermd zmm0,zmm0,zmm2 0x0000000000005f74 <+596>: vpminsd zmm1,zmm2,zmm0 0x0000000000005f7a <+602>: mov ax,0xf2b0 0x0000000000005f7e <+606>: kmovd k1,eax 0x0000000000005f82 <+610>: vpmaxsd zmm1{k1},zmm2,zmm0 0x0000000000005f88 <+616>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x561ee] # 0x5c180 0x0000000000005f92 <+626>: vpermd zmm0,zmm0,zmm1 0x0000000000005f98 <+632>: vpminsd zmm2,zmm1,zmm0 0x0000000000005f9e <+638>: mov ax,0xdcc4 0x0000000000005fa2 <+642>: kmovd k1,eax 0x0000000000005fa6 <+646>: vpmaxsd zmm2{k1},zmm1,zmm0 0x0000000000005fac <+652>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5620a] # 0x5c1c0 0x0000000000005fb6 <+662>: vpermd zmm0,zmm0,zmm2 0x0000000000005fbc <+668>: vpminsd zmm1,zmm2,zmm0 0x0000000000005fc2 <+674>: mov ax,0xef08 0x0000000000005fc6 <+678>: kmovd k1,eax 0x0000000000005fca <+682>: vpmaxsd zmm1{k1},zmm2,zmm0 0x0000000000005fd0 <+688>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56226] # 0x5c200 0x0000000000005fda <+698>: vpermd zmm0,zmm0,zmm1 0x0000000000005fe0 <+704>: vpminsd zmm2,zmm1,zmm0 0x0000000000005fe6 <+710>: mov ax,0xb552 0x0000000000005fea <+714>: kmovd k1,eax 0x0000000000005fee <+718>: vpmaxsd zmm2{k1},zmm1,zmm0 0x0000000000005ff4 <+724>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56242] # 0x5c240 0x0000000000005ffe <+734>: vpermd zmm0,zmm0,zmm2 0x0000000000006004 <+740>: vpmaxsd zmm1,zmm2,zmm0 0x000000000000600a <+746>: mov ax,0x14d6 0x000000000000600e <+750>: kmovd k1,eax 0x0000000000006012 <+754>: vpminsd zmm1{k1},zmm2,zmm0 0x0000000000006018 <+760>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5625e] # 0x5c280 0x0000000000006022 <+770>: vpermd zmm0,zmm0,zmm1 0x0000000000006028 <+776>: vpmaxsd zmm2,zmm1,zmm0 0x000000000000602e <+782>: mov ax,0x24da 0x0000000000006032 <+786>: kmovd k1,eax 0x0000000000006036 <+790>: vpminsd zmm2{k1},zmm1,zmm0 0x000000000000603c <+796>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5627a] # 0x5c2c0 0x0000000000006046 <+806>: vpermd zmm0,zmm0,zmm2 0x000000000000604c <+812>: vpmaxsd zmm1,zmm2,zmm0 0x0000000000006052 <+818>: mov ax,0x1554 0x0000000000006056 <+822>: kmovd k1,eax 0x000000000000605a <+826>: vpminsd zmm1{k1},zmm2,zmm0 0x0000000000006060 <+832>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56296] # 0x5c300 0x000000000000606a <+842>: vpermq zmm0,zmm0,zmm1 0x0000000000006070 <+848>: vpmaxsd zmm2,zmm1,zmm0 0x0000000000006076 <+854>: mov ax,0x330 0x000000000000607a <+858>: kmovd k1,eax 0x000000000000607e <+862>: vpminsd zmm2{k1},zmm1,zmm0 0x0000000000006084 <+868>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x562b2] # 0x5c340 0x000000000000608e <+878>: vmovdqu64 ZMMWORD PTR [rsp+0x240],zmm2 0x0000000000006096 <+886>: vpermd zmm0,zmm0,zmm2 0x000000000000609c <+892>: vmovdqu64 ZMMWORD PTR [rsp+0x200],zmm0 0x00000000000060a4 <+900>: mov bp,0xaa8 0x00000000000060a8 <+904>: vpxor xmm0,xmm0,xmm0 0x00000000000060ac <+908>: vmovdqa XMMWORD PTR [rsp+0x20],xmm0 0x00000000000060b2 <+914>: lea rsi,[rsp+0x20] 0x00000000000060b7 <+919>: mov edi,0x1 0x00000000000060bc <+924>: vzeroupper 0x00000000000060bf <+927>: call 0x5470 <clock_gettime@plt> 0x00000000000060c4 <+932>: mov r13,QWORD PTR [rsp+0x20] 0x00000000000060c9 <+937>: sub r13,rbx 0x00000000000060cc <+940>: mov rbx,QWORD PTR [rsp+0x28] 0x00000000000060d1 <+945>: mov edi,0x10 0x00000000000060d6 <+950>: call 0x7f20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000060db <+955>: mov r14,rax 0x00000000000060de <+958>: test rax,rax 0x00000000000060e1 <+961>: jle 0x60f8 <main+984> 0x00000000000060e3 <+963>: mov edi,0x1 0x00000000000060e8 <+968>: mov rsi,r14 0x00000000000060eb <+971>: call 0x2d470 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000060f0 <+976>: mov r15,rax 0x00000000000060f3 <+979>: mov r12,r14 0x00000000000060f6 <+982>: jmp 0x60fe <main+990> 0x00000000000060f8 <+984>: xor r15d,r15d 0x00000000000060fb <+987>: xor r12d,r12d 0x00000000000060fe <+990>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0x200] 0x0000000000006106 <+998>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x240] 0x000000000000610e <+1006>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x0000000000006119 <+1017>: kmovd k1,ebp 0x000000000000611d <+1021>: kmovw WORD PTR [rsp+0xa],k1 0x0000000000006123 <+1027>: imul r13,r13,0x3b9aca00 0x000000000000612a <+1034>: sub rbx,QWORD PTR [rsp+0x30] 0x000000000000612f <+1039>: lea rdx,[rip+0x5624a] # 0x5c380 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006136 <+1046>: mov ecx,0x10 0x000000000000613b <+1051>: mov rdi,r15 0x000000000000613e <+1054>: mov rsi,r14 0x0000000000006141 <+1057>: xor eax,eax 0x0000000000006143 <+1059>: vzeroupper 0x0000000000006146 <+1062>: call 0x57c0 <snprintf@plt> 0x000000000000614b <+1067>: cdqe 0x000000000000614d <+1069>: inc rax 0x0000000000006150 <+1072>: mov QWORD PTR [rsp+0x70],r15 0x0000000000006155 <+1077>: mov QWORD PTR [rsp+0x78],rax 0x000000000000615a <+1082>: mov QWORD PTR [rsp+0x80],r12 0x0000000000006162 <+1090>: lea rdx,[rip+0x56237] # 0x5c3a0 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x0000000000006169 <+1097>: lea rdi,[rsp+0x158] 0x0000000000006171 <+1105>: lea rsi,[rsp+0x70] 0x0000000000006176 <+1110>: mov ecx,0x6 0x000000000000617b <+1115>: call 0xd570 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006180 <+1120>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000006185 <+1125>: test rdi,rdi 0x0000000000006188 <+1128>: je 0x618f <main+1135> 0x000000000000618a <+1130>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000618f <+1135>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0xd0] 0x000000000000619a <+1146>: vmovdqu64 zmm1,ZMMWORD PTR [rsp+0x200] 0x00000000000061a2 <+1154>: kmovw k1,WORD PTR [rsp+0xa] 0x00000000000061a8 <+1160>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x240] 0x00000000000061b0 <+1168>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x00000000000061bb <+1179>: add rbx,r13 0x00000000000061be <+1182>: mov edi,0x1 0x00000000000061c3 <+1187>: mov esi,0x3 0x00000000000061c8 <+1192>: vzeroupper 0x00000000000061cb <+1195>: call 0x2d470 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000061d0 <+1200>: xor ecx,ecx 0x00000000000061d2 <+1202>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x00000000000061e0 <+1216>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000061e4 <+1220>: inc rcx 0x00000000000061e7 <+1223>: cmp rcx,0x3 0x00000000000061eb <+1227>: jne 0x61e0 <main+1216> 0x00000000000061ed <+1229>: mov WORD PTR [rax],0x203a 0x00000000000061f2 <+1234>: mov BYTE PTR [rax+0x2],0x0 0x00000000000061f6 <+1238>: mov QWORD PTR [rsp+0x88],rax 0x00000000000061fe <+1246>: mov QWORD PTR [rsp+0x90],0x3 0x000000000000620a <+1258>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000006216 <+1270>: lea rdi,[rsp+0x170] 0x000000000000621e <+1278>: lea rsi,[rsp+0x158] 0x0000000000006226 <+1286>: lea rdx,[rsp+0x88] 0x000000000000622e <+1294>: call 0xd130 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006233 <+1299>: mov rdi,QWORD PTR [rsp+0x88] 0x000000000000623b <+1307>: test rdi,rdi 0x000000000000623e <+1310>: je 0x6245 <main+1317> 0x0000000000006240 <+1312>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006245 <+1317>: mov rdi,QWORD PTR [rsp+0x158] 0x000000000000624d <+1325>: test rdi,rdi 0x0000000000006250 <+1328>: je 0x6257 <main+1335> 0x0000000000006252 <+1330>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006257 <+1335>: lea r14,[rsp+0x1e8] 0x000000000000625f <+1343>: mov rdi,r14 0x0000000000006262 <+1346>: vmovups zmm0,ZMMWORD PTR [rsp+0xd0] 0x000000000000626d <+1357>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=16> 0x0000000000006272 <+1362>: lea rdi,[rsp+0x188] 0x000000000000627a <+1370>: lea rsi,[rsp+0x170] 0x0000000000006282 <+1378>: mov rdx,r14 0x0000000000006285 <+1381>: vzeroupper 0x0000000000006288 <+1384>: call 0xd130 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x000000000000628d <+1389>: mov rdi,QWORD PTR [rsp+0x1e8] 0x0000000000006295 <+1397>: test rdi,rdi 0x0000000000006298 <+1400>: je 0x629f <main+1407> 0x000000000000629a <+1402>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000629f <+1407>: mov rdi,QWORD PTR [rsp+0x170] 0x00000000000062a7 <+1415>: test rdi,rdi 0x00000000000062aa <+1418>: je 0x62b1 <main+1425> 0x00000000000062ac <+1420>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000062b1 <+1425>: lea rdi,[rsp+0x188] 0x00000000000062b9 <+1433>: call 0x89d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000062be <+1438>: mov rdi,QWORD PTR [rsp+0x188] 0x00000000000062c6 <+1446>: test rdi,rdi 0x00000000000062c9 <+1449>: je 0x62d0 <main+1456> 0x00000000000062cb <+1451>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000062d0 <+1456>: vmovdqu64 zmm1,ZMMWORD PTR [rsp+0xd0] 0x00000000000062db <+1467>: vextracti64x4 ymm0,zmm1,0x1 0x00000000000062e2 <+1474>: vpaddd ymm0,ymm1,ymm0 0x00000000000062e6 <+1478>: vextracti128 xmm1,ymm0,0x1 0x00000000000062ec <+1484>: vpaddd xmm0,xmm0,xmm1 0x00000000000062f0 <+1488>: vpshufd xmm1,xmm0,0xee 0x00000000000062f5 <+1493>: vpaddd xmm0,xmm0,xmm1 0x00000000000062f9 <+1497>: vpshufd xmm1,xmm0,0x55 0x00000000000062fe <+1502>: vpaddd xmm0,xmm0,xmm1 0x0000000000006302 <+1506>: vmovd eax,xmm0 0x0000000000006306 <+1510>: vmovd DWORD PTR [rsp+0xc],xmm0 0x000000000000630c <+1516>: lea rcx,[rsp+0xc] 0x0000000000006311 <+1521>: mov QWORD PTR [rsp+0x38],rcx 0x0000000000006316 <+1526>: mov rdi,rbx 0x0000000000006319 <+1529>: vzeroupper 0x000000000000631c <+1532>: call 0x7f20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006321 <+1537>: mov r14,rax 0x0000000000006324 <+1540>: test rax,rax 0x0000000000006327 <+1543>: jle 0x633e <main+1566> 0x0000000000006329 <+1545>: mov edi,0x1 0x000000000000632e <+1550>: mov rsi,r14 0x0000000000006331 <+1553>: call 0x2d470 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006336 <+1558>: mov r15,rax 0x0000000000006339 <+1561>: mov r12,r14 0x000000000000633c <+1564>: jmp 0x6344 <main+1572> 0x000000000000633e <+1566>: xor r15d,r15d 0x0000000000006341 <+1569>: xor r12d,r12d 0x0000000000006344 <+1572>: lea rdx,[rip+0x56035] # 0x5c380 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000634b <+1579>: mov rdi,r15 0x000000000000634e <+1582>: mov rsi,r14 0x0000000000006351 <+1585>: mov rcx,rbx 0x0000000000006354 <+1588>: xor eax,eax 0x0000000000006356 <+1590>: call 0x57c0 <snprintf@plt> 0x000000000000635b <+1595>: cdqe 0x000000000000635d <+1597>: inc rax 0x0000000000006360 <+1600>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000006368 <+1608>: mov QWORD PTR [rsp+0xa8],rax 0x0000000000006370 <+1616>: mov QWORD PTR [rsp+0xb0],r12 0x0000000000006378 <+1624>: lea rdx,[rip+0x56031] # 0x5c3b0 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x000000000000637f <+1631>: lea rdi,[rsp+0x1a0] 0x0000000000006387 <+1639>: lea rsi,[rsp+0xa0] 0x000000000000638f <+1647>: mov ecx,0xb 0x0000000000006394 <+1652>: call 0xd570 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006399 <+1657>: mov rdi,QWORD PTR [rsp+0xa0] 0x00000000000063a1 <+1665>: test rdi,rdi 0x00000000000063a4 <+1668>: je 0x63ab <main+1675> 0x00000000000063a6 <+1670>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000063ab <+1675>: mov edi,0x1 0x00000000000063b0 <+1680>: mov esi,0x4 0x00000000000063b5 <+1685>: call 0x2d470 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000063ba <+1690>: xor ecx,ecx 0x00000000000063bc <+1692>: nop DWORD PTR [rax+0x0] 0x00000000000063c0 <+1696>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000063c4 <+1700>: inc rcx 0x00000000000063c7 <+1703>: cmp rcx,0x4 0x00000000000063cb <+1707>: jne 0x63c0 <main+1696> 0x00000000000063cd <+1709>: mov DWORD PTR [rax],0x736e20 0x00000000000063d3 <+1715>: mov QWORD PTR [rsp+0xb8],rax 0x00000000000063db <+1723>: mov QWORD PTR [rsp+0xc0],0x4 0x00000000000063e7 <+1735>: mov QWORD PTR [rsp+0xc8],0x4 0x00000000000063f3 <+1747>: lea rdi,[rsp+0x1b8] 0x00000000000063fb <+1755>: lea rsi,[rsp+0x1a0] 0x0000000000006403 <+1763>: lea rdx,[rsp+0xb8] 0x000000000000640b <+1771>: call 0xd130 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006410 <+1776>: mov rdi,QWORD PTR [rsp+0xb8] 0x0000000000006418 <+1784>: test rdi,rdi 0x000000000000641b <+1787>: je 0x6422 <main+1794> 0x000000000000641d <+1789>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006422 <+1794>: mov rdi,QWORD PTR [rsp+0x1a0] 0x000000000000642a <+1802>: test rdi,rdi 0x000000000000642d <+1805>: je 0x6434 <main+1812> 0x000000000000642f <+1807>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006434 <+1812>: lea rdi,[rsp+0x1b8] 0x000000000000643c <+1820>: call 0x89d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006441 <+1825>: mov rdi,QWORD PTR [rsp+0x1b8] 0x0000000000006449 <+1833>: test rdi,rdi 0x000000000000644c <+1836>: je 0x6453 <main+1843> 0x000000000000644e <+1838>: call 0x2d490 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006453 <+1843>: call 0x29890 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006458 <+1848>: xor eax,eax 0x000000000000645a <+1850>: add rsp,0x288 0x0000000000006461 <+1857>: pop rbx 0x0000000000006462 <+1858>: pop r12 0x0000000000006464 <+1860>: pop r13 0x0000000000006466 <+1862>: pop r14 0x0000000000006468 <+1864>: pop r15 0x000000000000646a <+1866>: pop rbp 0x000000000000646b <+1867>: ret End of assembler dump. --- disassemble/int32_32.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d50 <+0>: push rbp 0x0000000000005d51 <+1>: mov rbp,rsp 0x0000000000005d54 <+4>: push r15 0x0000000000005d56 <+6>: push r14 0x0000000000005d58 <+8>: push r13 0x0000000000005d5a <+10>: push r12 0x0000000000005d5c <+12>: push rbx 0x0000000000005d5d <+13>: and rsp,0xffffffffffffffc0 0x0000000000005d61 <+17>: sub rsp,0x440 0x0000000000005d68 <+24>: call 0x2f340 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d6d <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005d71 <+33>: mov ebx,0x21 0x0000000000005d76 <+38>: xor r14d,r14d 0x0000000000005d79 <+41>: vxorps xmm1,xmm1,xmm1 0x0000000000005d7d <+45>: nop DWORD PTR [rax] 0x0000000000005d80 <+48>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005d88 <+56>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005d90 <+64>: vzeroupper 0x0000000000005d93 <+67>: call 0x2e290 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d98 <+72>: mov edx,0x64 0x0000000000005d9d <+77>: mov rdi,rax 0x0000000000005da0 <+80>: xor esi,esi 0x0000000000005da2 <+82>: call 0x2e6a0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005da7 <+87>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005daf <+95>: vmovaps ZMMWORD PTR [rsp+0x380],zmm0 0x0000000000005db7 <+103>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005dbf <+111>: vmovaps ZMMWORD PTR [rsp+0x3c0],zmm0 0x0000000000005dc7 <+119>: mov ecx,r14d 0x0000000000005dca <+122>: and ecx,0x1f 0x0000000000005dcd <+125>: mov DWORD PTR [rsp+rcx*4+0x380],eax 0x0000000000005dd4 <+132>: vmovaps zmm0,ZMMWORD PTR [rsp+0x380] 0x0000000000005ddc <+140>: vmovaps zmm1,ZMMWORD PTR [rsp+0x3c0] 0x0000000000005de4 <+148>: dec rbx 0x0000000000005de7 <+151>: inc r14 0x0000000000005dea <+154>: cmp rbx,0x1 0x0000000000005dee <+158>: ja 0x5d80 <main+48> 0x0000000000005df0 <+160>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005df8 <+168>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005e00 <+176>: mov edi,0x20 0x0000000000005e05 <+181>: vzeroupper 0x0000000000005e08 <+184>: call 0x8220 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005e0d <+189>: mov rbx,rax 0x0000000000005e10 <+192>: test rax,rax 0x0000000000005e13 <+195>: jle 0x5e2a <main+218> 0x0000000000005e15 <+197>: mov edi,0x1 0x0000000000005e1a <+202>: mov rsi,rbx 0x0000000000005e1d <+205>: call 0x2d770 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e22 <+210>: mov r14,rax 0x0000000000005e25 <+213>: mov r15,rbx 0x0000000000005e28 <+216>: jmp 0x5e30 <main+224> 0x0000000000005e2a <+218>: xor r14d,r14d 0x0000000000005e2d <+221>: xor r15d,r15d 0x0000000000005e30 <+224>: lea rdx,[rip+0x57709] # 0x5d540 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005e37 <+231>: mov ecx,0x20 0x0000000000005e3c <+236>: mov rdi,r14 0x0000000000005e3f <+239>: mov rsi,rbx 0x0000000000005e42 <+242>: xor eax,eax 0x0000000000005e44 <+244>: call 0x57c0 <snprintf@plt> 0x0000000000005e49 <+249>: cdqe 0x0000000000005e4b <+251>: inc rax 0x0000000000005e4e <+254>: mov QWORD PTR [rsp+0x70],r14 0x0000000000005e53 <+259>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005e58 <+264>: mov QWORD PTR [rsp+0x80],r15 0x0000000000005e60 <+272>: lea rdx,[rip+0x576e9] # 0x5d550 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e67 <+279>: lea rdi,[rsp+0x190] 0x0000000000005e6f <+287>: lea rsi,[rsp+0x70] 0x0000000000005e74 <+292>: mov ecx,0x7 0x0000000000005e79 <+297>: call 0xd870 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e7e <+302>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000005e83 <+307>: test rdi,rdi 0x0000000000005e86 <+310>: je 0x5e8d <main+317> 0x0000000000005e88 <+312>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e8d <+317>: mov edi,0x1 0x0000000000005e92 <+322>: mov esi,0x3 0x0000000000005e97 <+327>: call 0x2d770 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e9c <+332>: xor ecx,ecx 0x0000000000005e9e <+334>: xchg ax,ax 0x0000000000005ea0 <+336>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005ea4 <+340>: inc rcx 0x0000000000005ea7 <+343>: cmp rcx,0x3 0x0000000000005eab <+347>: jne 0x5ea0 <main+336> 0x0000000000005ead <+349>: mov WORD PTR [rax],0x203a 0x0000000000005eb2 <+354>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005eb6 <+358>: mov QWORD PTR [rsp+0x88],rax 0x0000000000005ebe <+366>: mov QWORD PTR [rsp+0x90],0x3 0x0000000000005eca <+378>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000005ed6 <+390>: lea rdi,[rsp+0x1a8] 0x0000000000005ede <+398>: lea rsi,[rsp+0x190] 0x0000000000005ee6 <+406>: lea rdx,[rsp+0x88] 0x0000000000005eee <+414>: call 0xd430 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005ef3 <+419>: mov rdi,QWORD PTR [rsp+0x88] 0x0000000000005efb <+427>: test rdi,rdi 0x0000000000005efe <+430>: je 0x5f05 <main+437> 0x0000000000005f00 <+432>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f05 <+437>: mov rdi,QWORD PTR [rsp+0x190] 0x0000000000005f0d <+445>: test rdi,rdi 0x0000000000005f10 <+448>: je 0x5f17 <main+455> 0x0000000000005f12 <+450>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f17 <+455>: lea rbx,[rsp+0x250] 0x0000000000005f1f <+463>: mov rdi,rbx 0x0000000000005f22 <+466>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005f2a <+474>: vmovaps zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000005f32 <+482>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=32> 0x0000000000005f37 <+487>: lea rdi,[rsp+0x1c0] 0x0000000000005f3f <+495>: lea rsi,[rsp+0x1a8] 0x0000000000005f47 <+503>: mov rdx,rbx 0x0000000000005f4a <+506>: vzeroupper 0x0000000000005f4d <+509>: call 0xd430 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005f52 <+514>: mov rdi,QWORD PTR [rsp+0x250] 0x0000000000005f5a <+522>: test rdi,rdi 0x0000000000005f5d <+525>: je 0x5f64 <main+532> 0x0000000000005f5f <+527>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f64 <+532>: mov rdi,QWORD PTR [rsp+0x1a8] 0x0000000000005f6c <+540>: test rdi,rdi 0x0000000000005f6f <+543>: je 0x5f76 <main+550> 0x0000000000005f71 <+545>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f76 <+550>: lea rdi,[rsp+0x1c0] 0x0000000000005f7e <+558>: call 0x8cd0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f83 <+563>: mov rdi,QWORD PTR [rsp+0x1c0] 0x0000000000005f8b <+571>: test rdi,rdi 0x0000000000005f8e <+574>: je 0x5f95 <main+581> 0x0000000000005f90 <+576>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f95 <+581>: vxorps xmm0,xmm0,xmm0 0x0000000000005f99 <+585>: vmovaps XMMWORD PTR [rsp+0x40],xmm0 0x0000000000005f9f <+591>: lea rsi,[rsp+0x40] 0x0000000000005fa4 <+596>: mov edi,0x1 0x0000000000005fa9 <+601>: call 0x5470 <clock_gettime@plt> 0x0000000000005fae <+606>: mov rbx,QWORD PTR [rsp+0x40] 0x0000000000005fb3 <+611>: mov rax,QWORD PTR [rsp+0x48] 0x0000000000005fb8 <+616>: mov QWORD PTR [rsp+0x60],rax 0x0000000000005fbd <+621>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x100] 0x0000000000005fc5 <+629>: vpshufd zmm0,zmm5,0xb1 0x0000000000005fcc <+636>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x140] 0x0000000000005fd4 <+644>: vpshufd zmm1,zmm4,0xb1 0x0000000000005fdb <+651>: vpminsd zmm2,zmm4,zmm1 0x0000000000005fe1 <+657>: vpminsd zmm3,zmm5,zmm0 0x0000000000005fe7 <+663>: mov ax,0xaaaa 0x0000000000005feb <+667>: kmovd k1,eax 0x0000000000005fef <+671>: vpmaxsd zmm3{k1},zmm5,zmm0 0x0000000000005ff5 <+677>: vpmaxsd zmm2{k1},zmm4,zmm1 0x0000000000005ffb <+683>: vpshufd zmm0,zmm2,0x4e 0x0000000000006002 <+690>: vpshufd zmm1,zmm3,0x4e 0x0000000000006009 <+697>: vpminsd zmm4,zmm3,zmm1 0x000000000000600f <+703>: vpminsd zmm5,zmm2,zmm0 0x0000000000006015 <+709>: vpmaxsd zmm1,zmm3,zmm1 0x000000000000601b <+715>: vshufps zmm1,zmm4,zmm1,0xe4 0x0000000000006022 <+722>: vpmaxsd zmm0,zmm2,zmm0 0x0000000000006028 <+728>: vshufps zmm0,zmm5,zmm0,0xe4 0x000000000000602f <+735>: vpxor xmm2,xmm2,xmm2 0x0000000000006033 <+739>: vpermpd zmm2,zmm1,0x4e 0x000000000000603a <+746>: vpxor xmm3,xmm3,xmm3 0x000000000000603e <+750>: vpermpd zmm3,zmm0,0x4e 0x0000000000006045 <+757>: vpminsd zmm4,zmm0,zmm3 0x000000000000604b <+763>: vpminsd zmm5,zmm1,zmm2 0x0000000000006051 <+769>: mov ax,0xf0f0 0x0000000000006055 <+773>: kmovd k1,eax 0x0000000000006059 <+777>: vpmaxsd zmm5{k1},zmm1,zmm2 0x000000000000605f <+783>: vpmaxsd zmm4{k1},zmm0,zmm3 0x0000000000006065 <+789>: vshufi64x2 zmm0,zmm4,zmm4,0x4e 0x000000000000606c <+796>: vshufi64x2 zmm1,zmm5,zmm5,0x4e 0x0000000000006073 <+803>: vpminsd zmm2,zmm5,zmm1 0x0000000000006079 <+809>: vpminsd zmm3,zmm4,zmm0 0x000000000000607f <+815>: mov ax,0xff00 0x0000000000006083 <+819>: kmovd k1,eax 0x0000000000006087 <+823>: vpmaxsd zmm3{k1},zmm4,zmm0 0x000000000000608d <+829>: vpmaxsd zmm2{k1},zmm5,zmm1 0x0000000000006093 <+835>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57063] # 0x5d100 0x000000000000609d <+845>: vmovdqa64 zmm1,zmm3 0x00000000000060a3 <+851>: vpermt2d zmm1,zmm0,zmm2 0x00000000000060a9 <+857>: vpermi2d zmm0,zmm2,zmm3 0x00000000000060af <+863>: vpmaxsd zmm4,zmm2,zmm0 0x00000000000060b5 <+869>: mov ax,0x8ee 0x00000000000060b9 <+873>: kmovd k1,eax 0x00000000000060bd <+877>: vpminsd zmm4{k1},zmm2,zmm0 0x00000000000060c3 <+883>: vpminsd zmm0,zmm3,zmm1 0x00000000000060c9 <+889>: mov ax,0x7710 0x00000000000060cd <+893>: kmovd k1,eax 0x00000000000060d1 <+897>: vpmaxsd zmm0{k1},zmm3,zmm1 0x00000000000060d7 <+903>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5705f] # 0x5d140 0x00000000000060e1 <+913>: vmovdqa64 zmm2,zmm0 0x00000000000060e7 <+919>: vpermt2d zmm2,zmm1,zmm4 0x00000000000060ed <+925>: vpermi2d zmm1,zmm4,zmm0 0x00000000000060f3 <+931>: vpmaxsd zmm3,zmm4,zmm1 0x00000000000060f9 <+937>: mov ax,0x249a 0x00000000000060fd <+941>: kmovd k1,eax 0x0000000000006101 <+945>: vpminsd zmm3{k1},zmm4,zmm1 0x0000000000006107 <+951>: vpminsd zmm1,zmm0,zmm2 0x000000000000610d <+957>: mov ax,0xd925 0x0000000000006111 <+961>: kmovd k1,eax 0x0000000000006115 <+965>: vpmaxsd zmm1{k1},zmm0,zmm2 0x000000000000611b <+971>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5705b] # 0x5d180 0x0000000000006125 <+981>: vmovdqa64 zmm2,zmm3 0x000000000000612b <+987>: vpermt2d zmm2,zmm0,zmm1 0x0000000000006131 <+993>: vpermi2d zmm0,zmm1,zmm3 0x0000000000006137 <+999>: vpmaxsd zmm4,zmm3,zmm0 0x000000000000613d <+1005>: mov ax,0x20 0x0000000000006141 <+1009>: kmovd k1,eax 0x0000000000006145 <+1013>: vpminsd zmm4{k1},zmm3,zmm0 0x000000000000614b <+1019>: vpminsd zmm0,zmm1,zmm2 0x0000000000006151 <+1025>: mov ax,0x8641 0x0000000000006155 <+1029>: kmovd k1,eax 0x0000000000006159 <+1033>: vpmaxsd zmm0{k1},zmm1,zmm2 0x000000000000615f <+1039>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57057] # 0x5d1c0 0x0000000000006169 <+1049>: vpermi2d zmm1,zmm4,zmm0 0x000000000000616f <+1055>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57087] # 0x5d200 0x0000000000006179 <+1065>: vpermi2d zmm2,zmm0,zmm4 0x000000000000617f <+1071>: vpmaxsd zmm3,zmm4,zmm2 0x0000000000006185 <+1077>: mov ax,0x40 0x0000000000006189 <+1081>: kmovd k1,eax 0x000000000000618d <+1085>: vpminsd zmm3{k1},zmm4,zmm2 0x0000000000006193 <+1091>: vpminsd zmm2,zmm0,zmm1 0x0000000000006199 <+1097>: mov ax,0x1207 0x000000000000619d <+1101>: kmovd k1,eax 0x00000000000061a1 <+1105>: vpmaxsd zmm2{k1},zmm0,zmm1 0x00000000000061a7 <+1111>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5708f] # 0x5d240 0x00000000000061b1 <+1121>: vpermi2d zmm0,zmm2,zmm3 0x00000000000061b7 <+1127>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570bf] # 0x5d280 0x00000000000061c1 <+1137>: vpermi2d zmm1,zmm2,zmm3 0x00000000000061c7 <+1143>: vpmaxsd zmm4,zmm3,zmm1 0x00000000000061cd <+1149>: mov ax,0x880 0x00000000000061d1 <+1153>: vpminsd zmm5,zmm2,zmm0 0x00000000000061d7 <+1159>: mov cx,0x2155 0x00000000000061db <+1163>: kmovd k1,ecx 0x00000000000061df <+1167>: vpmaxsd zmm5{k1},zmm2,zmm0 0x00000000000061e5 <+1173>: kmovd k1,eax 0x00000000000061e9 <+1177>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5710d] # 0x5d300 0x00000000000061f3 <+1187>: vpermi2d zmm0,zmm5,zmm4 0x00000000000061f9 <+1193>: vpminsd zmm4{k1},zmm3,zmm1 0x00000000000061ff <+1199>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570b7] # 0x5d2c0 0x0000000000006209 <+1209>: vpermi2d zmm1,zmm4,zmm5 0x000000000000620f <+1215>: vpmaxsd zmm2,zmm4,zmm1 0x0000000000006215 <+1221>: mov ax,0x480 0x0000000000006219 <+1225>: vpmaxsd zmm3,zmm5,zmm0 0x000000000000621f <+1231>: mov cx,0xfa84 0x0000000000006223 <+1235>: kmovd k1,ecx 0x0000000000006227 <+1239>: vpminsd zmm3{k1},zmm5,zmm0 0x000000000000622d <+1245>: kmovd k1,eax 0x0000000000006231 <+1249>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57145] # 0x5d380 0x000000000000623b <+1259>: vpermi2d zmm0,zmm3,zmm2 0x0000000000006241 <+1265>: vpminsd zmm2{k1},zmm4,zmm1 0x0000000000006247 <+1271>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570ef] # 0x5d340 0x0000000000006251 <+1281>: vpermi2d zmm1,zmm2,zmm3 0x0000000000006257 <+1287>: vpmaxsd zmm4,zmm3,zmm0 0x000000000000625d <+1293>: mov ax,0xe644 0x0000000000006261 <+1297>: kmovd k1,eax 0x0000000000006265 <+1301>: vpminsd zmm4{k1},zmm3,zmm0 0x000000000000626b <+1307>: vpmaxsd zmm0,zmm2,zmm1 0x0000000000006271 <+1313>: mov ax,0x818 0x0000000000006275 <+1317>: kmovd k1,eax 0x0000000000006279 <+1321>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5717d] # 0x5d400 0x0000000000006283 <+1331>: vpermi2d zmm3,zmm4,zmm0 0x0000000000006289 <+1337>: vpminsd zmm0{k1},zmm2,zmm1 0x000000000000628f <+1343>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57127] # 0x5d3c0 0x0000000000006299 <+1353>: vpermi2d zmm1,zmm0,zmm4 0x000000000000629f <+1359>: vpmaxsd zmm2,zmm4,zmm3 0x00000000000062a5 <+1365>: mov ax,0xcb20 0x00000000000062a9 <+1369>: kmovd k1,eax 0x00000000000062ad <+1373>: vpminsd zmm2{k1},zmm4,zmm3 0x00000000000062b3 <+1379>: vpmaxsd zmm3,zmm0,zmm1 0x00000000000062b9 <+1385>: mov ax,0x22c 0x00000000000062bd <+1389>: kmovd k1,eax 0x00000000000062c1 <+1393>: vpminsd zmm3{k1},zmm0,zmm1 0x00000000000062c7 <+1399>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5716f] # 0x5d440 0x00000000000062d1 <+1409>: vpermi2d zmm0,zmm3,zmm2 0x00000000000062d7 <+1415>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5719f] # 0x5d480 0x00000000000062e1 <+1425>: vpermi2d zmm1,zmm2,zmm3 0x00000000000062e7 <+1431>: vpmaxsd zmm4,zmm2,zmm1 0x00000000000062ed <+1437>: mov ax,0xad48 0x00000000000062f1 <+1441>: kmovd k1,eax 0x00000000000062f5 <+1445>: vpminsd zmm4{k1},zmm2,zmm1 0x00000000000062fb <+1451>: vpmaxsd zmm1,zmm3,zmm0 0x0000000000006301 <+1457>: mov ax,0x54a 0x0000000000006305 <+1461>: kmovd k1,eax 0x0000000000006309 <+1465>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x571ed] # 0x5d500 0x0000000000006313 <+1475>: vpermi2d zmm2,zmm4,zmm1 0x0000000000006319 <+1481>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm2 0x0000000000006321 <+1489>: vpminsd zmm1{k1},zmm3,zmm0 0x0000000000006327 <+1495>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5718f] # 0x5d4c0 0x0000000000006331 <+1505>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm4 0x0000000000006339 <+1513>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm1 0x0000000000006341 <+1521>: vpermi2d zmm0,zmm1,zmm4 0x0000000000006347 <+1527>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x000000000000634f <+1535>: vpxor xmm0,xmm0,xmm0 0x0000000000006353 <+1539>: vmovdqa XMMWORD PTR [rsp+0x50],xmm0 0x0000000000006359 <+1545>: lea rsi,[rsp+0x50] 0x000000000000635e <+1550>: mov edi,0x1 0x0000000000006363 <+1555>: vzeroupper 0x0000000000006366 <+1558>: call 0x5470 <clock_gettime@plt> 0x000000000000636b <+1563>: mov r12,QWORD PTR [rsp+0x50] 0x0000000000006370 <+1568>: sub r12,rbx 0x0000000000006373 <+1571>: mov rbx,QWORD PTR [rsp+0x58] 0x0000000000006378 <+1576>: mov edi,0x20 0x000000000000637d <+1581>: call 0x8220 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006382 <+1586>: mov r14,rax 0x0000000000006385 <+1589>: test rax,rax 0x0000000000006388 <+1592>: jle 0x639f <main+1615> 0x000000000000638a <+1594>: mov edi,0x1 0x000000000000638f <+1599>: mov rsi,r14 0x0000000000006392 <+1602>: call 0x2d770 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006397 <+1607>: mov r15,rax 0x000000000000639a <+1610>: mov r13,r14 0x000000000000639d <+1613>: jmp 0x63a5 <main+1621> 0x000000000000639f <+1615>: xor r15d,r15d 0x00000000000063a2 <+1618>: xor r13d,r13d 0x00000000000063a5 <+1621>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x280] 0x00000000000063ad <+1629>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x2c0] 0x00000000000063b5 <+1637>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x00000000000063bd <+1645>: mov ax,0xaaa 0x00000000000063c1 <+1649>: kmovd k1,eax 0x00000000000063c5 <+1653>: kmovw WORD PTR [rsp+0x3a],k1 0x00000000000063cb <+1659>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x300] 0x00000000000063d3 <+1667>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x340] 0x00000000000063db <+1675>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x00000000000063e3 <+1683>: mov ax,0xaaa8 0x00000000000063e7 <+1687>: kmovd k1,eax 0x00000000000063eb <+1691>: kmovw WORD PTR [rsp+0x38],k1 0x00000000000063f1 <+1697>: imul r12,r12,0x3b9aca00 0x00000000000063f8 <+1704>: sub rbx,QWORD PTR [rsp+0x60] 0x00000000000063fd <+1709>: lea rdx,[rip+0x5713c] # 0x5d540 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006404 <+1716>: mov ecx,0x20 0x0000000000006409 <+1721>: mov rdi,r15 0x000000000000640c <+1724>: mov rsi,r14 0x000000000000640f <+1727>: xor eax,eax 0x0000000000006411 <+1729>: vzeroupper 0x0000000000006414 <+1732>: call 0x57c0 <snprintf@plt> 0x0000000000006419 <+1737>: cdqe 0x000000000000641b <+1739>: inc rax 0x000000000000641e <+1742>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000006426 <+1750>: mov QWORD PTR [rsp+0xa8],rax 0x000000000000642e <+1758>: mov QWORD PTR [rsp+0xb0],r13 0x0000000000006436 <+1766>: lea rdx,[rip+0x57123] # 0x5d560 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x000000000000643d <+1773>: lea rdi,[rsp+0x1d8] 0x0000000000006445 <+1781>: lea rsi,[rsp+0xa0] 0x000000000000644d <+1789>: mov ecx,0x6 0x0000000000006452 <+1794>: call 0xd870 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006457 <+1799>: mov rdi,QWORD PTR [rsp+0xa0] 0x000000000000645f <+1807>: test rdi,rdi 0x0000000000006462 <+1810>: je 0x6469 <main+1817> 0x0000000000006464 <+1812>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006469 <+1817>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000006471 <+1825>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x280] 0x0000000000006479 <+1833>: kmovw k1,WORD PTR [rsp+0x3a] 0x000000000000647f <+1839>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x2c0] 0x0000000000006487 <+1847>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x000000000000648f <+1855>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000006497 <+1863>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x300] 0x000000000000649f <+1871>: kmovw k1,WORD PTR [rsp+0x38] 0x00000000000064a5 <+1877>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x340] 0x00000000000064ad <+1885>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x00000000000064b5 <+1893>: add rbx,r12 0x00000000000064b8 <+1896>: mov edi,0x1 0x00000000000064bd <+1901>: mov esi,0x3 0x00000000000064c2 <+1906>: vzeroupper 0x00000000000064c5 <+1909>: call 0x2d770 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000064ca <+1914>: xor ecx,ecx 0x00000000000064cc <+1916>: nop DWORD PTR [rax+0x0] 0x00000000000064d0 <+1920>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000064d4 <+1924>: inc rcx 0x00000000000064d7 <+1927>: cmp rcx,0x3 0x00000000000064db <+1931>: jne 0x64d0 <main+1920> 0x00000000000064dd <+1933>: mov WORD PTR [rax],0x203a 0x00000000000064e2 <+1938>: mov BYTE PTR [rax+0x2],0x0 0x00000000000064e6 <+1942>: mov QWORD PTR [rsp+0xb8],rax 0x00000000000064ee <+1950>: mov QWORD PTR [rsp+0xc0],0x3 0x00000000000064fa <+1962>: mov QWORD PTR [rsp+0xc8],0x3 0x0000000000006506 <+1974>: lea rdi,[rsp+0x1f0] 0x000000000000650e <+1982>: lea rsi,[rsp+0x1d8] 0x0000000000006516 <+1990>: lea rdx,[rsp+0xb8] 0x000000000000651e <+1998>: call 0xd430 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006523 <+2003>: mov rdi,QWORD PTR [rsp+0xb8] 0x000000000000652b <+2011>: test rdi,rdi 0x000000000000652e <+2014>: je 0x6535 <main+2021> 0x0000000000006530 <+2016>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006535 <+2021>: mov rdi,QWORD PTR [rsp+0x1d8] 0x000000000000653d <+2029>: test rdi,rdi 0x0000000000006540 <+2032>: je 0x6547 <main+2039> 0x0000000000006542 <+2034>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006547 <+2039>: lea r14,[rsp+0x268] 0x000000000000654f <+2047>: mov rdi,r14 0x0000000000006552 <+2050>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x000000000000655a <+2058>: vmovaps zmm1,ZMMWORD PTR [rsp+0x140] 0x0000000000006562 <+2066>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=32> 0x0000000000006567 <+2071>: lea rdi,[rsp+0x208] 0x000000000000656f <+2079>: lea rsi,[rsp+0x1f0] 0x0000000000006577 <+2087>: mov rdx,r14 0x000000000000657a <+2090>: vzeroupper 0x000000000000657d <+2093>: call 0xd430 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006582 <+2098>: mov rdi,QWORD PTR [rsp+0x268] 0x000000000000658a <+2106>: test rdi,rdi 0x000000000000658d <+2109>: je 0x6594 <main+2116> 0x000000000000658f <+2111>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006594 <+2116>: mov rdi,QWORD PTR [rsp+0x1f0] 0x000000000000659c <+2124>: test rdi,rdi 0x000000000000659f <+2127>: je 0x65a6 <main+2134> 0x00000000000065a1 <+2129>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000065a6 <+2134>: lea rdi,[rsp+0x208] 0x00000000000065ae <+2142>: call 0x8cd0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000065b3 <+2147>: mov rdi,QWORD PTR [rsp+0x208] 0x00000000000065bb <+2155>: test rdi,rdi 0x00000000000065be <+2158>: je 0x65c5 <main+2165> 0x00000000000065c0 <+2160>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000065c5 <+2165>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x00000000000065cd <+2173>: vpaddd zmm0,zmm0,ZMMWORD PTR [rsp+0x140] 0x00000000000065d5 <+2181>: vextracti64x4 ymm1,zmm0,0x1 0x00000000000065dc <+2188>: vpaddd ymm0,ymm0,ymm1 0x00000000000065e0 <+2192>: vextracti128 xmm1,ymm0,0x1 0x00000000000065e6 <+2198>: vpaddd xmm0,xmm0,xmm1 0x00000000000065ea <+2202>: vpshufd xmm1,xmm0,0xee 0x00000000000065ef <+2207>: vpaddd xmm0,xmm0,xmm1 0x00000000000065f3 <+2211>: vpshufd xmm1,xmm0,0x55 0x00000000000065f8 <+2216>: vpaddd xmm0,xmm0,xmm1 0x00000000000065fc <+2220>: vmovd eax,xmm0 0x0000000000006600 <+2224>: vmovd DWORD PTR [rsp+0x3c],xmm0 0x0000000000006606 <+2230>: lea rcx,[rsp+0x3c] 0x000000000000660b <+2235>: mov QWORD PTR [rsp+0x68],rcx 0x0000000000006610 <+2240>: mov rdi,rbx 0x0000000000006613 <+2243>: vzeroupper 0x0000000000006616 <+2246>: call 0x8220 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000661b <+2251>: mov r14,rax 0x000000000000661e <+2254>: test rax,rax 0x0000000000006621 <+2257>: jle 0x6638 <main+2280> 0x0000000000006623 <+2259>: mov edi,0x1 0x0000000000006628 <+2264>: mov rsi,r14 0x000000000000662b <+2267>: call 0x2d770 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006630 <+2272>: mov r15,rax 0x0000000000006633 <+2275>: mov r12,r14 0x0000000000006636 <+2278>: jmp 0x663e <main+2286> 0x0000000000006638 <+2280>: xor r15d,r15d 0x000000000000663b <+2283>: xor r12d,r12d 0x000000000000663e <+2286>: lea rdx,[rip+0x56efb] # 0x5d540 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006645 <+2293>: mov rdi,r15 0x0000000000006648 <+2296>: mov rsi,r14 0x000000000000664b <+2299>: mov rcx,rbx 0x000000000000664e <+2302>: xor eax,eax 0x0000000000006650 <+2304>: call 0x57c0 <snprintf@plt> 0x0000000000006655 <+2309>: cdqe 0x0000000000006657 <+2311>: inc rax 0x000000000000665a <+2314>: mov QWORD PTR [rsp+0xd0],r15 0x0000000000006662 <+2322>: mov QWORD PTR [rsp+0xd8],rax 0x000000000000666a <+2330>: mov QWORD PTR [rsp+0xe0],r12 0x0000000000006672 <+2338>: lea rdx,[rip+0x56ef7] # 0x5d570 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x0000000000006679 <+2345>: lea rdi,[rsp+0x220] 0x0000000000006681 <+2353>: lea rsi,[rsp+0xd0] 0x0000000000006689 <+2361>: mov ecx,0xb 0x000000000000668e <+2366>: call 0xd870 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006693 <+2371>: mov rdi,QWORD PTR [rsp+0xd0] 0x000000000000669b <+2379>: test rdi,rdi 0x000000000000669e <+2382>: je 0x66a5 <main+2389> 0x00000000000066a0 <+2384>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000066a5 <+2389>: mov edi,0x1 0x00000000000066aa <+2394>: mov esi,0x4 0x00000000000066af <+2399>: call 0x2d770 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000066b4 <+2404>: xor ecx,ecx 0x00000000000066b6 <+2406>: cs nop WORD PTR [rax+rax*1+0x0] 0x00000000000066c0 <+2416>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000066c4 <+2420>: inc rcx 0x00000000000066c7 <+2423>: cmp rcx,0x4 0x00000000000066cb <+2427>: jne 0x66c0 <main+2416> 0x00000000000066cd <+2429>: mov DWORD PTR [rax],0x736e20 0x00000000000066d3 <+2435>: mov QWORD PTR [rsp+0xe8],rax 0x00000000000066db <+2443>: mov QWORD PTR [rsp+0xf0],0x4 0x00000000000066e7 <+2455>: mov QWORD PTR [rsp+0xf8],0x4 0x00000000000066f3 <+2467>: lea rdi,[rsp+0x238] 0x00000000000066fb <+2475>: lea rsi,[rsp+0x220] 0x0000000000006703 <+2483>: lea rdx,[rsp+0xe8] 0x000000000000670b <+2491>: call 0xd430 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006710 <+2496>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000006718 <+2504>: test rdi,rdi 0x000000000000671b <+2507>: je 0x6722 <main+2514> 0x000000000000671d <+2509>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006722 <+2514>: mov rdi,QWORD PTR [rsp+0x220] 0x000000000000672a <+2522>: test rdi,rdi 0x000000000000672d <+2525>: je 0x6734 <main+2532> 0x000000000000672f <+2527>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006734 <+2532>: lea rdi,[rsp+0x238] 0x000000000000673c <+2540>: call 0x8cd0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006741 <+2545>: mov rdi,QWORD PTR [rsp+0x238] 0x0000000000006749 <+2553>: test rdi,rdi 0x000000000000674c <+2556>: je 0x6753 <main+2563> 0x000000000000674e <+2558>: call 0x2d790 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006753 <+2563>: call 0x29b90 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006758 <+2568>: xor eax,eax 0x000000000000675a <+2570>: lea rsp,[rbp-0x28] 0x000000000000675e <+2574>: pop rbx 0x000000000000675f <+2575>: pop r12 0x0000000000006761 <+2577>: pop r13 0x0000000000006763 <+2579>: pop r14 0x0000000000006765 <+2581>: pop r15 0x0000000000006767 <+2583>: pop rbp 0x0000000000006768 <+2584>: ret End of assembler dump. --- disassemble/int32_64.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d90 <+0>: push rbp 0x0000000000005d91 <+1>: mov rbp,rsp 0x0000000000005d94 <+4>: push r15 0x0000000000005d96 <+6>: push r14 0x0000000000005d98 <+8>: push r13 0x0000000000005d9a <+10>: push r12 0x0000000000005d9c <+12>: push rbx 0x0000000000005d9d <+13>: and rsp,0xffffffffffffffc0 0x0000000000005da1 <+17>: sub rsp,0x640 0x0000000000005da8 <+24>: call 0x2ff40 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005dad <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005db1 <+33>: mov ebx,0x41 0x0000000000005db6 <+38>: xor r14d,r14d 0x0000000000005db9 <+41>: vxorps xmm1,xmm1,xmm1 0x0000000000005dbd <+45>: vxorps xmm3,xmm3,xmm3 0x0000000000005dc1 <+49>: vxorps xmm2,xmm2,xmm2 0x0000000000005dc5 <+53>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005dd0 <+64>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000005dd8 <+72>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005de0 <+80>: vmovaps ZMMWORD PTR [rsp+0x180],zmm3 0x0000000000005de8 <+88>: vmovaps ZMMWORD PTR [rsp+0x140],zmm2 0x0000000000005df0 <+96>: vzeroupper 0x0000000000005df3 <+99>: call 0x2ee90 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005df8 <+104>: mov edx,0x64 0x0000000000005dfd <+109>: mov rdi,rax 0x0000000000005e00 <+112>: xor esi,esi 0x0000000000005e02 <+114>: call 0x2f2a0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005e07 <+119>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000005e0f <+127>: vmovaps ZMMWORD PTR [rsp+0x500],zmm0 0x0000000000005e17 <+135>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005e1f <+143>: vmovaps ZMMWORD PTR [rsp+0x540],zmm0 0x0000000000005e27 <+151>: vmovaps zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000005e2f <+159>: vmovaps ZMMWORD PTR [rsp+0x580],zmm0 0x0000000000005e37 <+167>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005e3f <+175>: vmovaps ZMMWORD PTR [rsp+0x5c0],zmm0 0x0000000000005e47 <+183>: mov ecx,r14d 0x0000000000005e4a <+186>: and ecx,0x3f 0x0000000000005e4d <+189>: mov DWORD PTR [rsp+rcx*4+0x500],eax 0x0000000000005e54 <+196>: vmovaps zmm0,ZMMWORD PTR [rsp+0x500] 0x0000000000005e5c <+204>: vmovaps zmm1,ZMMWORD PTR [rsp+0x540] 0x0000000000005e64 <+212>: vmovaps zmm3,ZMMWORD PTR [rsp+0x580] 0x0000000000005e6c <+220>: vmovaps zmm2,ZMMWORD PTR [rsp+0x5c0] 0x0000000000005e74 <+228>: dec rbx 0x0000000000005e77 <+231>: inc r14 0x0000000000005e7a <+234>: cmp rbx,0x1 0x0000000000005e7e <+238>: ja 0x5dd0 <main+64> 0x0000000000005e84 <+244>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005e8c <+252>: vmovaps ZMMWORD PTR [rsp+0x140],zmm2 0x0000000000005e94 <+260>: vmovaps ZMMWORD PTR [rsp+0x180],zmm3 0x0000000000005e9c <+268>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000005ea4 <+276>: mov edi,0x40 0x0000000000005ea9 <+281>: vzeroupper 0x0000000000005eac <+284>: call 0x8e20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005eb1 <+289>: mov rbx,rax 0x0000000000005eb4 <+292>: test rax,rax 0x0000000000005eb7 <+295>: jle 0x5ece <main+318> 0x0000000000005eb9 <+297>: mov edi,0x1 0x0000000000005ebe <+302>: mov rsi,rbx 0x0000000000005ec1 <+305>: call 0x2e370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005ec6 <+310>: mov r14,rax 0x0000000000005ec9 <+313>: mov r15,rbx 0x0000000000005ecc <+316>: jmp 0x5ed4 <main+324> 0x0000000000005ece <+318>: xor r14d,r14d 0x0000000000005ed1 <+321>: xor r15d,r15d 0x0000000000005ed4 <+324>: lea rdx,[rip+0x58ca5] # 0x5eb80 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005edb <+331>: mov ecx,0x40 0x0000000000005ee0 <+336>: mov rdi,r14 0x0000000000005ee3 <+339>: mov rsi,rbx 0x0000000000005ee6 <+342>: xor eax,eax 0x0000000000005ee8 <+344>: call 0x57c0 <snprintf@plt> 0x0000000000005eed <+349>: cdqe 0x0000000000005eef <+351>: inc rax 0x0000000000005ef2 <+354>: mov QWORD PTR [rsp+0x70],r14 0x0000000000005ef7 <+359>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005efc <+364>: mov QWORD PTR [rsp+0x80],r15 0x0000000000005f04 <+372>: lea rdx,[rip+0x58c85] # 0x5eb90 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005f0b <+379>: lea rdi,[rsp+0x210] 0x0000000000005f13 <+387>: lea rsi,[rsp+0x70] 0x0000000000005f18 <+392>: mov ecx,0x7 0x0000000000005f1d <+397>: call 0xe470 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005f22 <+402>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000005f27 <+407>: test rdi,rdi 0x0000000000005f2a <+410>: je 0x5f31 <main+417> 0x0000000000005f2c <+412>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f31 <+417>: mov edi,0x1 0x0000000000005f36 <+422>: mov esi,0x3 0x0000000000005f3b <+427>: call 0x2e370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005f40 <+432>: xor ecx,ecx 0x0000000000005f42 <+434>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005f50 <+448>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005f54 <+452>: inc rcx 0x0000000000005f57 <+455>: cmp rcx,0x3 0x0000000000005f5b <+459>: jne 0x5f50 <main+448> 0x0000000000005f5d <+461>: mov WORD PTR [rax],0x203a 0x0000000000005f62 <+466>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005f66 <+470>: mov QWORD PTR [rsp+0x88],rax 0x0000000000005f6e <+478>: mov QWORD PTR [rsp+0x90],0x3 0x0000000000005f7a <+490>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000005f86 <+502>: lea rdi,[rsp+0x228] 0x0000000000005f8e <+510>: lea rsi,[rsp+0x210] 0x0000000000005f96 <+518>: lea rdx,[rsp+0x88] 0x0000000000005f9e <+526>: call 0xe030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005fa3 <+531>: mov rdi,QWORD PTR [rsp+0x88] 0x0000000000005fab <+539>: test rdi,rdi 0x0000000000005fae <+542>: je 0x5fb5 <main+549> 0x0000000000005fb0 <+544>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005fb5 <+549>: mov rdi,QWORD PTR [rsp+0x210] 0x0000000000005fbd <+557>: test rdi,rdi 0x0000000000005fc0 <+560>: je 0x5fc7 <main+567> 0x0000000000005fc2 <+562>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005fc7 <+567>: lea rbx,[rsp+0x2d0] 0x0000000000005fcf <+575>: mov rdi,rbx 0x0000000000005fd2 <+578>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000005fda <+586>: vmovaps zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000005fe2 <+594>: vmovaps zmm2,ZMMWORD PTR [rsp+0x180] 0x0000000000005fea <+602>: vmovaps zmm3,ZMMWORD PTR [rsp+0x140] 0x0000000000005ff2 <+610>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=64> 0x0000000000005ff7 <+615>: lea rdi,[rsp+0x240] 0x0000000000005fff <+623>: lea rsi,[rsp+0x228] 0x0000000000006007 <+631>: mov rdx,rbx 0x000000000000600a <+634>: vzeroupper 0x000000000000600d <+637>: call 0xe030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006012 <+642>: mov rdi,QWORD PTR [rsp+0x2d0] 0x000000000000601a <+650>: test rdi,rdi 0x000000000000601d <+653>: je 0x6024 <main+660> 0x000000000000601f <+655>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006024 <+660>: mov rdi,QWORD PTR [rsp+0x228] 0x000000000000602c <+668>: test rdi,rdi 0x000000000000602f <+671>: je 0x6036 <main+678> 0x0000000000006031 <+673>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006036 <+678>: lea rdi,[rsp+0x240] 0x000000000000603e <+686>: call 0x98d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006043 <+691>: mov rdi,QWORD PTR [rsp+0x240] 0x000000000000604b <+699>: test rdi,rdi 0x000000000000604e <+702>: je 0x6055 <main+709> 0x0000000000006050 <+704>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006055 <+709>: vxorps xmm0,xmm0,xmm0 0x0000000000006059 <+713>: vmovaps XMMWORD PTR [rsp+0x40],xmm0 0x000000000000605f <+719>: lea rsi,[rsp+0x40] 0x0000000000006064 <+724>: mov edi,0x1 0x0000000000006069 <+729>: call 0x5470 <clock_gettime@plt> 0x000000000000606e <+734>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x180] 0x0000000000006076 <+742>: vpshufd zmm0,zmm9,0x4e 0x000000000000607d <+749>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x140] 0x0000000000006085 <+757>: vpshufd zmm1,zmm10,0x4e 0x000000000000608c <+764>: vmovdqa64 zmm8,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006094 <+772>: vpshufd zmm2,zmm8,0x4e 0x000000000000609b <+779>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x100] 0x00000000000060a3 <+787>: vpshufd zmm3,zmm11,0x4e 0x00000000000060aa <+794>: vpminsd zmm4,zmm11,zmm3 0x00000000000060b0 <+800>: vpminsd zmm5,zmm8,zmm2 0x00000000000060b6 <+806>: vpminsd zmm6,zmm10,zmm1 0x00000000000060bc <+812>: vpminsd zmm7,zmm9,zmm0 0x00000000000060c2 <+818>: vpmaxsd zmm3,zmm11,zmm3 0x00000000000060c8 <+824>: vpmaxsd zmm2,zmm8,zmm2 0x00000000000060ce <+830>: vpmaxsd zmm1,zmm10,zmm1 0x00000000000060d4 <+836>: vpmaxsd zmm0,zmm9,zmm0 0x00000000000060da <+842>: vshufps zmm8,zmm7,zmm0,0xe4 0x00000000000060e1 <+849>: vshufps zmm9,zmm6,zmm1,0xe4 0x00000000000060e8 <+856>: vshufps zmm10,zmm5,zmm2,0xe4 0x00000000000060ef <+863>: vshufps zmm11,zmm4,zmm3,0xe4 0x00000000000060f6 <+870>: vshufps zmm7,zmm7,zmm0,0xb1 0x00000000000060fd <+877>: vshufps zmm1,zmm6,zmm1,0xb1 0x0000000000006104 <+884>: vshufps zmm2,zmm5,zmm2,0xb1 0x000000000000610b <+891>: vshufps zmm3,zmm4,zmm3,0xb1 0x0000000000006112 <+898>: vpminsd zmm4,zmm11,zmm3 0x0000000000006118 <+904>: vpminsd zmm0,zmm10,zmm2 0x000000000000611e <+910>: vpminsd zmm5,zmm9,zmm1 0x0000000000006124 <+916>: vpminsd zmm6,zmm8,zmm7 0x000000000000612a <+922>: mov ax,0xaaaa 0x000000000000612e <+926>: kmovd k1,eax 0x0000000000006132 <+930>: vpmaxsd zmm6{k1},zmm8,zmm7 0x0000000000006138 <+936>: vpmaxsd zmm5{k1},zmm9,zmm1 0x000000000000613e <+942>: vpmaxsd zmm0{k1},zmm10,zmm2 0x0000000000006144 <+948>: kmovw WORD PTR [rsp+0x3a],k1 0x000000000000614a <+954>: vpmaxsd zmm4{k1},zmm11,zmm3 0x0000000000006150 <+960>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57026] # 0x5d180 0x000000000000615a <+970>: vpermi2d zmm1,zmm0,zmm4 0x0000000000006160 <+976>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57056] # 0x5d1c0 0x000000000000616a <+986>: vpermi2d zmm7,zmm1,zmm5 0x0000000000006170 <+992>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57086] # 0x5d200 0x000000000000617a <+1002>: vpermi2d zmm8,zmm6,zmm5 0x0000000000006180 <+1008>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x570b6] # 0x5d240 0x000000000000618a <+1018>: vpermi2d zmm2,zmm4,zmm0 0x0000000000006190 <+1024>: vshufi64x2 zmm1,zmm0,zmm6,0xbe 0x0000000000006197 <+1031>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x570df] # 0x5d280 0x00000000000061a1 <+1041>: vpermi2d zmm3,zmm1,zmm5 0x00000000000061a7 <+1047>: vpmaxsd zmm9,zmm5,zmm3 0x00000000000061ad <+1053>: mov ax,0x2222 0x00000000000061b1 <+1057>: kmovd k1,eax 0x00000000000061b5 <+1061>: vmovdqa64 zmm1,zmm9 0x00000000000061bb <+1067>: vpminsd zmm1{k1},zmm5,zmm3 0x00000000000061c1 <+1073>: vpmaxsd zmm5,zmm4,zmm2 0x00000000000061c7 <+1079>: mov ax,0x2b22 0x00000000000061cb <+1083>: kmovd k1,eax 0x00000000000061cf <+1087>: vmovdqa64 zmm11,zmm5 0x00000000000061d5 <+1093>: vpminsd zmm11{k1},zmm4,zmm2 0x00000000000061db <+1099>: vpminsd zmm2,zmm6,zmm8 0x00000000000061e1 <+1105>: vpminsd zmm4,zmm0,zmm7 0x00000000000061e7 <+1111>: mov ax,0x4444 0x00000000000061eb <+1115>: kmovd k1,eax 0x00000000000061ef <+1119>: mov ax,0x44d4 0x00000000000061f3 <+1123>: kmovd k2,eax 0x00000000000061f7 <+1127>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x570bf] # 0x5d2c0 0x0000000000006201 <+1137>: vpermi2d zmm3,zmm11,zmm4 0x0000000000006207 <+1143>: mov ax,0x6690 0x000000000000620b <+1147>: kmovd k3,eax 0x000000000000620f <+1151>: vshufi32x4 zmm3{k3},zmm2,zmm1,0x48 0x0000000000006216 <+1158>: vpmaxsd zmm2{k2},zmm6,zmm8 0x000000000000621c <+1164>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x570da] # 0x5d300 0x0000000000006226 <+1174>: vpermi2d zmm8,zmm2,zmm4 0x000000000000622c <+1180>: vmovdqa64 zmm6,zmm4 0x0000000000006232 <+1186>: vpmaxsd zmm6{k1},zmm0,zmm7 0x0000000000006238 <+1192>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x570fe] # 0x5d340 0x0000000000006242 <+1202>: vpermi2d zmm7,zmm8,zmm1 0x0000000000006248 <+1208>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x5712e] # 0x5d380 0x0000000000006252 <+1218>: vpermi2d zmm8,zmm2,zmm9 0x0000000000006258 <+1224>: mov ax,0x966 0x000000000000625c <+1228>: kmovd k1,eax 0x0000000000006260 <+1232>: vshufi32x4 zmm8{k1},zmm6,zmm5,0xde 0x0000000000006267 <+1239>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5714f] # 0x5d3c0 0x0000000000006271 <+1249>: vpermi2d zmm0,zmm11,zmm6 0x0000000000006277 <+1255>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5717f] # 0x5d400 0x0000000000006281 <+1265>: vpermi2d zmm4,zmm0,zmm1 0x0000000000006287 <+1271>: vpminsd zmm10,zmm11,zmm4 0x000000000000628d <+1277>: vpmaxsd zmm9,zmm11,zmm4 0x0000000000006293 <+1283>: mov ax,0x699 0x0000000000006297 <+1287>: kmovd k1,eax 0x000000000000629b <+1291>: vpblendmd zmm0{k1},zmm9,zmm10 0x00000000000062a1 <+1297>: vpmaxsd zmm5,zmm1,zmm8 0x00000000000062a7 <+1303>: mov ax,0x90 0x00000000000062ab <+1307>: kmovd k1,eax 0x00000000000062af <+1311>: vpmaxsd zmm11,zmm2,zmm7 0x00000000000062b5 <+1317>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x57301] # 0x5d5c0 0x00000000000062bf <+1327>: vpermi2q zmm12,zmm0,zmm11 0x00000000000062c5 <+1333>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57331] # 0x5d600 0x00000000000062cf <+1343>: vpermi2d zmm4,zmm12,zmm5 0x00000000000062d5 <+1349>: vpminsd zmm5{k1},zmm1,zmm8 0x00000000000062db <+1355>: vpminsd zmm1,zmm2,zmm7 0x00000000000062e1 <+1361>: vpminsd zmm2,zmm6,zmm3 0x00000000000062e7 <+1367>: mov ax,0x900 0x00000000000062eb <+1371>: kmovd k1,eax 0x00000000000062ef <+1375>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57147] # 0x5d440 0x00000000000062f9 <+1385>: vpermi2d zmm8,zmm2,zmm10 0x00000000000062ff <+1391>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x571f7] # 0x5d500 0x0000000000006309 <+1401>: vpermi2q zmm10,zmm9,zmm2 0x000000000000630f <+1407>: vpmaxsd zmm2{k1},zmm6,zmm3 0x0000000000006315 <+1413>: mov ax,0x9960 0x0000000000006319 <+1417>: kmovd k1,eax 0x000000000000631d <+1421>: vpblendmd zmm7{k1},zmm1,zmm11 0x0000000000006323 <+1427>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57153] # 0x5d480 0x000000000000632d <+1437>: vpermi2d zmm6,zmm8,zmm7 0x0000000000006333 <+1443>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57183] # 0x5d4c0 0x000000000000633d <+1453>: vpermi2d zmm3,zmm5,zmm7 0x0000000000006343 <+1459>: mov ax,0x6606 0x0000000000006347 <+1463>: kmovd k1,eax 0x000000000000634b <+1467>: vmovdqa32 zmm3{k1},zmm10 0x0000000000006351 <+1473>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x571e5] # 0x5d540 0x000000000000635b <+1483>: vpermi2d zmm9,zmm2,zmm0 0x0000000000006361 <+1489>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57215] # 0x5d580 0x000000000000636b <+1499>: vpermi2q zmm8,zmm1,zmm5 0x0000000000006371 <+1505>: mov ax,0x6066 0x0000000000006375 <+1509>: kmovd k1,eax 0x0000000000006379 <+1513>: vmovdqa32 zmm9{k1},zmm8 0x000000000000637f <+1519>: vpmaxsd zmm10,zmm7,zmm9 0x0000000000006385 <+1525>: vpmaxsd zmm8,zmm5,zmm4 0x000000000000638b <+1531>: vpminsd zmm1,zmm0,zmm3 0x0000000000006391 <+1537>: vpminsd zmm11,zmm2,zmm6 0x0000000000006397 <+1543>: mov ax,0x6600 0x000000000000639b <+1547>: kmovd k1,eax 0x000000000000639f <+1551>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x57297] # 0x5d640 0x00000000000063a9 <+1561>: vpermi2q zmm12,zmm1,zmm11 0x00000000000063af <+1567>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x57307] # 0x5d6c0 0x00000000000063b9 <+1577>: vpermi2d zmm13,zmm11,zmm1 0x00000000000063bf <+1583>: vpmaxsd zmm1{k1},zmm0,zmm3 0x00000000000063c5 <+1589>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x573f1] # 0x5d7c0 0x00000000000063cf <+1599>: vpermi2d zmm0,zmm1,zmm10 0x00000000000063d5 <+1605>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57421] # 0x5d800 0x00000000000063df <+1615>: vpermi2d zmm3,zmm0,zmm8 0x00000000000063e5 <+1621>: mov ax,0x69 0x00000000000063e9 <+1625>: kmovd k1,eax 0x00000000000063ed <+1629>: vpminsd zmm8{k1},zmm5,zmm4 0x00000000000063f3 <+1635>: mov rbx,QWORD PTR [rsp+0x40] 0x00000000000063f8 <+1640>: mov rax,QWORD PTR [rsp+0x48] 0x00000000000063fd <+1645>: mov QWORD PTR [rsp+0x60],rax 0x0000000000006402 <+1650>: mov ax,0x66 0x0000000000006406 <+1654>: kmovd k2,eax 0x000000000000640a <+1658>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5736c] # 0x5d780 0x0000000000006414 <+1668>: vpermi2q zmm0,zmm10,zmm8 0x000000000000641a <+1674>: vmovdqa64 zmm4,zmm10 0x0000000000006420 <+1680>: vpminsd zmm4{k2},zmm7,zmm9 0x0000000000006426 <+1686>: mov ax,0x9600 0x000000000000642a <+1690>: kmovd k2,eax 0x000000000000642e <+1694>: vpmaxsd zmm11{k2},zmm2,zmm6 0x0000000000006434 <+1700>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57242] # 0x5d680 0x000000000000643e <+1710>: vpermi2d zmm2,zmm8,zmm4 0x0000000000006444 <+1716>: mov ax,0x999 0x0000000000006448 <+1720>: kmovd k2,eax 0x000000000000644c <+1724>: vmovdqa32 zmm2{k2},zmm12 0x0000000000006452 <+1730>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x572a4] # 0x5d700 0x000000000000645c <+1740>: vpermi2d zmm5,zmm13,zmm4 0x0000000000006462 <+1746>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x572d4] # 0x5d740 0x000000000000646c <+1756>: vpermi2d zmm6,zmm11,zmm1 0x0000000000006472 <+1762>: mov ax,0x9990 0x0000000000006476 <+1766>: kmovd k2,eax 0x000000000000647a <+1770>: vmovdqa32 zmm6{k2},zmm0 0x0000000000006480 <+1776>: vpmaxsd zmm7,zmm4,zmm6 0x0000000000006486 <+1782>: mov ax,0x9090 0x000000000000648a <+1786>: kmovd k2,eax 0x000000000000648e <+1790>: vpminsd zmm0,zmm11,zmm5 0x0000000000006494 <+1796>: vpminsd zmm9,zmm1,zmm2 0x000000000000649a <+1802>: vpmaxsd zmm5,zmm11,zmm5 0x00000000000064a0 <+1808>: mov ax,0x6090 0x00000000000064a4 <+1812>: kmovd k3,eax 0x00000000000064a8 <+1816>: vmovdqa32 zmm0{k3},zmm5 0x00000000000064ae <+1822>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x57488] # 0x5d940 0x00000000000064b8 <+1832>: vpermi2d zmm10,zmm0,zmm9 0x00000000000064be <+1838>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x574b8] # 0x5d980 0x00000000000064c8 <+1848>: vpermi2d zmm11,zmm10,zmm7 0x00000000000064ce <+1854>: vmovdqa ymm10,YMMWORD PTR [rip+0x56c0a] # 0x5d0e0 0x00000000000064d6 <+1862>: vpermi2d zmm10,zmm7,zmm9 0x00000000000064dc <+1868>: vpminsd zmm7{k2},zmm4,zmm6 0x00000000000064e2 <+1874>: vpminsd zmm4,zmm8,zmm3 0x00000000000064e8 <+1880>: vpmaxsd zmm3,zmm8,zmm3 0x00000000000064ee <+1886>: mov ax,0x906 0x00000000000064f2 <+1890>: kmovd k2,eax 0x00000000000064f6 <+1894>: vpblendmd zmm6{k2},zmm3,zmm4 0x00000000000064fc <+1900>: mov ax,0x909 0x0000000000006500 <+1904>: kmovd k2,eax 0x0000000000006504 <+1908>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57332] # 0x5d840 0x000000000000650e <+1918>: vpermi2d zmm8,zmm0,zmm9 0x0000000000006514 <+1924>: vpmaxsd zmm9{k2},zmm1,zmm2 0x000000000000651a <+1930>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5735c] # 0x5d880 0x0000000000006524 <+1940>: vpermi2d zmm1,zmm7,zmm4 0x000000000000652a <+1946>: mov ax,0xf909 0x000000000000652e <+1950>: kmovd k2,eax 0x0000000000006532 <+1954>: vmovdqa32 zmm8{k2},zmm1 0x0000000000006538 <+1960>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5737e] # 0x5d8c0 0x0000000000006542 <+1970>: vpermi2d zmm1,zmm7,zmm3 0x0000000000006548 <+1976>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x573ae] # 0x5d900 0x0000000000006552 <+1986>: vpermi2d zmm2,zmm9,zmm5 0x0000000000006558 <+1992>: mov ax,0x6f60 0x000000000000655c <+1996>: kmovd k2,eax 0x0000000000006560 <+2000>: vmovdqa32 zmm2{k2},zmm1 0x0000000000006566 <+2006>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57450] # 0x5d9c0 0x0000000000006570 <+2016>: vpermi2d zmm3,zmm6,zmm10 0x0000000000006576 <+2022>: vpmaxsd zmm1,zmm7,zmm2 0x000000000000657c <+2028>: mov ax,0x6960 0x0000000000006580 <+2032>: kmovd k2,eax 0x0000000000006584 <+2036>: vpminsd zmm1{k2},zmm7,zmm2 0x000000000000658a <+2042>: vpmaxsd zmm2,zmm6,zmm3 0x0000000000006590 <+2048>: mov ax,0x609 0x0000000000006594 <+2052>: kmovd k3,eax 0x0000000000006598 <+2056>: vpminsd zmm2{k3},zmm6,zmm3 0x000000000000659e <+2062>: vpminsd zmm3,zmm0,zmm11 0x00000000000065a4 <+2068>: vpminsd zmm4,zmm9,zmm8 0x00000000000065aa <+2074>: mov ax,0x696 0x00000000000065ae <+2078>: kmovd k3,eax 0x00000000000065b2 <+2082>: vpmaxsd zmm4{k3},zmm9,zmm8 0x00000000000065b8 <+2088>: mov ax,0x9069 0x00000000000065bc <+2092>: kmovd k3,eax 0x00000000000065c0 <+2096>: vpmaxsd zmm3{k3},zmm0,zmm11 0x00000000000065c6 <+2102>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57430] # 0x5da00 0x00000000000065d0 <+2112>: vpermi2d zmm0,zmm1,zmm3 0x00000000000065d6 <+2118>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57460] # 0x5da40 0x00000000000065e0 <+2128>: vpermi2d zmm5,zmm3,zmm4 0x00000000000065e6 <+2134>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57490] # 0x5da80 0x00000000000065f0 <+2144>: vpermi2d zmm6,zmm4,zmm2 0x00000000000065f6 <+2150>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x574c0] # 0x5dac0 0x0000000000006600 <+2160>: vpermi2d zmm7,zmm2,zmm1 0x0000000000006606 <+2166>: vpminsd zmm8,zmm2,zmm7 0x000000000000660c <+2172>: vpmaxsd zmm2,zmm2,zmm7 0x0000000000006612 <+2178>: mov ax,0x96 0x0000000000006616 <+2182>: kmovd k3,eax 0x000000000000661a <+2186>: vmovdqa32 zmm2{k3},zmm8 0x0000000000006620 <+2192>: vpmaxsd zmm7,zmm1,zmm6 0x0000000000006626 <+2198>: mov ax,0xf00 0x000000000000662a <+2202>: vpmaxsd zmm9,zmm3,zmm5 0x0000000000006630 <+2208>: mov cx,0x96f0 0x0000000000006634 <+2212>: kmovd k3,ecx 0x0000000000006638 <+2216>: vpminsd zmm9{k3},zmm3,zmm5 0x000000000000663e <+2222>: vpminsd zmm3,zmm4,zmm0 0x0000000000006644 <+2228>: vpmaxsd zmm0,zmm4,zmm0 0x000000000000664a <+2234>: mov cl,0xc 0x000000000000664c <+2236>: kmovd k3,ecx 0x0000000000006650 <+2240>: vpblendmq zmm4{k3},zmm3,zmm0 0x0000000000006656 <+2246>: kmovd k3,eax 0x000000000000665a <+2250>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x5749c] # 0x5db00 0x0000000000006664 <+2260>: vpermi2d zmm5,zmm4,zmm9 0x000000000000666a <+2266>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x574cc] # 0x5db40 0x0000000000006674 <+2276>: vpermi2d zmm10,zmm5,zmm7 0x000000000000667a <+2282>: vpminsd zmm7{k3},zmm1,zmm6 0x0000000000006680 <+2288>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x574f6] # 0x5db80 0x000000000000668a <+2298>: vpermi2d zmm1,zmm7,zmm3 0x0000000000006690 <+2304>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57526] # 0x5dbc0 0x000000000000669a <+2314>: vpermi2d zmm3,zmm1,zmm8 0x00000000000066a0 <+2320>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57556] # 0x5dc00 0x00000000000066aa <+2330>: vpermi2d zmm1,zmm2,zmm7 0x00000000000066b0 <+2336>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57586] # 0x5dc40 0x00000000000066ba <+2346>: vpermi2d zmm5,zmm9,zmm0 0x00000000000066c0 <+2352>: vpmaxsd zmm6,zmm9,zmm5 0x00000000000066c6 <+2358>: vpminsd zmm6{k2},zmm9,zmm5 0x00000000000066cc <+2364>: vpmaxsd zmm5,zmm2,zmm1 0x00000000000066d2 <+2370>: vpminsd zmm5{k1},zmm2,zmm1 0x00000000000066d8 <+2376>: vpmaxsd zmm1,zmm7,zmm3 0x00000000000066de <+2382>: mov ax,0xf09 0x00000000000066e2 <+2386>: kmovd k1,eax 0x00000000000066e6 <+2390>: vpminsd zmm1{k1},zmm7,zmm3 0x00000000000066ec <+2396>: vpminsd zmm2,zmm4,zmm10 0x00000000000066f2 <+2402>: mov ax,0x90f0 0x00000000000066f6 <+2406>: kmovd k1,eax 0x00000000000066fa <+2410>: vpmaxsd zmm2{k1},zmm4,zmm10 0x0000000000006700 <+2416>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57576] # 0x5dc80 0x000000000000670a <+2426>: vpxor xmm3,xmm3,xmm3 0x000000000000670e <+2430>: vpermd zmm3,zmm0,zmm2 0x0000000000006714 <+2436>: vpxor xmm4,xmm4,xmm4 0x0000000000006718 <+2440>: vpermd zmm4,zmm0,zmm1 0x000000000000671e <+2446>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57598] # 0x5dcc0 0x0000000000006728 <+2456>: vpxor xmm7,xmm7,xmm7 0x000000000000672c <+2460>: vpermd zmm7,zmm0,zmm5 0x0000000000006732 <+2466>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x575c4] # 0x5dd00 0x000000000000673c <+2476>: vpxor xmm8,xmm8,xmm8 0x0000000000006741 <+2481>: vpermd zmm8,zmm0,zmm6 0x0000000000006747 <+2487>: vpmaxsd zmm0,zmm6,zmm8 0x000000000000674d <+2493>: mov ax,0x600 0x0000000000006751 <+2497>: kmovd k1,eax 0x0000000000006755 <+2501>: vpminsd zmm0{k1},zmm6,zmm8 0x000000000000675b <+2507>: vpmaxsd zmm6,zmm5,zmm7 0x0000000000006761 <+2513>: mov ax,0x6 0x0000000000006765 <+2517>: kmovd k1,eax 0x0000000000006769 <+2521>: vpminsd zmm8,zmm1,zmm4 0x000000000000676f <+2527>: vpmaxsd zmm9,zmm2,zmm3 0x0000000000006775 <+2533>: mov ax,0xf960 0x0000000000006779 <+2537>: kmovd k2,eax 0x000000000000677d <+2541>: vmovdqa64 zmm10,zmm8 0x0000000000006783 <+2547>: vpmaxsd zmm10{k2},zmm1,zmm4 0x0000000000006789 <+2553>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x575ed] # 0x5dd80 0x0000000000006793 <+2563>: vmovdqa64 zmm4,zmm10 0x0000000000006799 <+2569>: vpermt2d zmm4,zmm1,zmm9 0x000000000000679f <+2575>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x57617] # 0x5ddc0 0x00000000000067a9 <+2585>: vpermt2d zmm4,zmm11,zmm6 0x00000000000067af <+2591>: vpminsd zmm6{k1},zmm5,zmm7 0x00000000000067b5 <+2597>: vpminsd zmm2,zmm2,zmm3 0x00000000000067bb <+2603>: vpblendmd zmm3{k2},zmm2,zmm9 0x00000000000067c1 <+2609>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57575] # 0x5dd40 0x00000000000067cb <+2619>: vpermi2d zmm5,zmm6,zmm10 0x00000000000067d1 <+2625>: vpermi2d zmm1,zmm3,zmm0 0x00000000000067d7 <+2631>: vpermt2d zmm1,zmm11,zmm8 0x00000000000067dd <+2637>: vpermi2d zmm11,zmm0,zmm2 0x00000000000067e3 <+2643>: vpmaxsd zmm2,zmm0,zmm11 0x00000000000067e9 <+2649>: mov ax,0x9000 0x00000000000067ed <+2653>: kmovd k1,eax 0x00000000000067f1 <+2657>: vpmaxsd zmm7,zmm3,zmm1 0x00000000000067f7 <+2663>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x576bf] # 0x5dec0 0x0000000000006801 <+2673>: vpermi2d zmm8,zmm2,zmm7 0x0000000000006807 <+2679>: vpminsd zmm2{k1},zmm0,zmm11 0x000000000000680d <+2685>: vpminsd zmm0,zmm3,zmm1 0x0000000000006813 <+2691>: vpminsd zmm1,zmm10,zmm4 0x0000000000006819 <+2697>: mov ax,0x6f09 0x000000000000681d <+2701>: kmovd k1,eax 0x0000000000006821 <+2705>: vmovdqa32 zmm0{k1},zmm7 0x0000000000006827 <+2711>: vpmaxsd zmm1{k1},zmm10,zmm4 0x000000000000682d <+2717>: vpmaxsd zmm3,zmm6,zmm5 0x0000000000006833 <+2723>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x575c3] # 0x5de00 0x000000000000683d <+2733>: vpermi2d zmm4,zmm1,zmm0 0x0000000000006843 <+2739>: mov ax,0x9999 0x0000000000006847 <+2743>: kmovd k1,eax 0x000000000000684b <+2747>: vmovdqa32 zmm4{k1},zmm3 0x0000000000006851 <+2753>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x575e5] # 0x5de40 0x000000000000685b <+2763>: vpermi2d zmm5,zmm2,zmm0 0x0000000000006861 <+2769>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57615] # 0x5de80 0x000000000000686b <+2779>: vpermi2d zmm6,zmm5,zmm1 0x0000000000006871 <+2785>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57685] # 0x5df00 0x000000000000687b <+2795>: vpermi2d zmm5,zmm1,zmm3 0x0000000000006881 <+2801>: mov ax,0x117 0x0000000000006885 <+2805>: kmovd k1,eax 0x0000000000006889 <+2809>: vmovdqa32 zmm5{k1},zmm8 0x000000000000688f <+2815>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x576a7] # 0x5df40 0x0000000000006899 <+2825>: vpermi2d zmm7,zmm0,zmm2 0x000000000000689f <+2831>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x576d7] # 0x5df80 0x00000000000068a9 <+2841>: vpermi2d zmm8,zmm3,zmm1 0x00000000000068af <+2847>: mov ax,0xe880 0x00000000000068b3 <+2851>: kmovd k1,eax 0x00000000000068b7 <+2855>: vmovdqa32 zmm7{k1},zmm8 0x00000000000068bd <+2861>: vpminsd zmm8,zmm0,zmm7 0x00000000000068c3 <+2867>: vpmaxsd zmm7,zmm0,zmm7 0x00000000000068c9 <+2873>: mov ax,0xe8e0 0x00000000000068cd <+2877>: kmovd k1,eax 0x00000000000068d1 <+2881>: vpblendmd zmm9{k1},zmm7,zmm8 0x00000000000068d7 <+2887>: vpmaxsd zmm0,zmm1,zmm5 0x00000000000068dd <+2893>: vpminsd zmm0{k1},zmm1,zmm5 0x00000000000068e3 <+2899>: vpmaxsd zmm1,zmm2,zmm6 0x00000000000068e9 <+2905>: mov ax,0x6666 0x00000000000068ed <+2909>: kmovd k1,eax 0x00000000000068f1 <+2913>: vpminsd zmm1{k1},zmm2,zmm6 0x00000000000068f7 <+2919>: vpmaxsd zmm2,zmm3,zmm4 0x00000000000068fd <+2925>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x576b9] # 0x5dfc0 0x0000000000006907 <+2935>: vpermi2d zmm3,zmm1,zmm7 0x000000000000690d <+2941>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x576e9] # 0x5e000 0x0000000000006917 <+2951>: vpermi2d zmm5,zmm3,zmm0 0x000000000000691d <+2957>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57719] # 0x5e040 0x0000000000006927 <+2967>: vpermi2d zmm3,zmm9,zmm1 0x000000000000692d <+2973>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57749] # 0x5e080 0x0000000000006937 <+2983>: vpermi2d zmm4,zmm2,zmm0 0x000000000000693d <+2989>: mov ax,0x4c6c 0x0000000000006941 <+2993>: kmovd k1,eax 0x0000000000006945 <+2997>: vmovdqa32 zmm3{k1},zmm4 0x000000000000694b <+3003>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5776b] # 0x5e0c0 0x0000000000006955 <+3013>: vpermi2d zmm4,zmm9,zmm0 0x000000000000695b <+3019>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x5779b] # 0x5e100 0x0000000000006965 <+3029>: vpermi2d zmm6,zmm2,zmm4 0x000000000000696b <+3035>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x577cb] # 0x5e140 0x0000000000006975 <+3045>: vpermi2d zmm4,zmm1,zmm8 0x000000000000697b <+3051>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x577fb] # 0x5e180 0x0000000000006985 <+3061>: vpermi2d zmm7,zmm0,zmm2 0x000000000000698b <+3067>: mov ax,0x3632 0x000000000000698f <+3071>: kmovd k2,eax 0x0000000000006993 <+3075>: vmovdqa32 zmm7{k2},zmm4 0x0000000000006999 <+3081>: vpmaxsd zmm8,zmm0,zmm7 0x000000000000699f <+3087>: mov ax,0x88 0x00000000000069a3 <+3091>: kmovd k2,eax 0x00000000000069a7 <+3095>: vpmaxsd zmm10,zmm9,zmm3 0x00000000000069ad <+3101>: vpminsd zmm10{k1},zmm9,zmm3 0x00000000000069b3 <+3107>: vpminsd zmm4,zmm1,zmm5 0x00000000000069b9 <+3113>: mov ax,0x1331 0x00000000000069bd <+3117>: kmovd k1,eax 0x00000000000069c1 <+3121>: vpmaxsd zmm4{k1},zmm1,zmm5 0x00000000000069c7 <+3127>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5786f] # 0x5e240 0x00000000000069d1 <+3137>: vpermi2d zmm1,zmm4,zmm10 0x00000000000069d7 <+3143>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x5789f] # 0x5e280 0x00000000000069e1 <+3153>: vpermi2d zmm9,zmm1,zmm8 0x00000000000069e7 <+3159>: vmovdqa64 zmm3,zmm8 0x00000000000069ed <+3165>: vpminsd zmm3{k2},zmm0,zmm7 0x00000000000069f3 <+3171>: vpmaxsd zmm1,zmm2,zmm6 0x00000000000069f9 <+3177>: mov ax,0x888 0x00000000000069fd <+3181>: kmovd k1,eax 0x0000000000006a01 <+3185>: vpminsd zmm1{k1},zmm2,zmm6 0x0000000000006a07 <+3191>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x577af] # 0x5e1c0 0x0000000000006a11 <+3201>: vpermi2d zmm6,zmm4,zmm10 0x0000000000006a17 <+3207>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x577df] # 0x5e200 0x0000000000006a21 <+3217>: vpermi2d zmm2,zmm1,zmm3 0x0000000000006a27 <+3223>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5788f] # 0x5e2c0 0x0000000000006a31 <+3233>: vpermi2d zmm0,zmm10,zmm3 0x0000000000006a37 <+3239>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x578bf] # 0x5e300 0x0000000000006a41 <+3249>: vpermi2d zmm5,zmm0,zmm1 0x0000000000006a47 <+3255>: vpmaxsd zmm7,zmm3,zmm5 0x0000000000006a4d <+3261>: mov ax,0xca4c 0x0000000000006a51 <+3265>: kmovd k1,eax 0x0000000000006a55 <+3269>: vpminsd zmm8,zmm10,zmm9 0x0000000000006a5b <+3275>: vpmaxsd zmm9,zmm10,zmm9 0x0000000000006a61 <+3281>: mov ax,0xc48c 0x0000000000006a65 <+3285>: kmovd k2,eax 0x0000000000006a69 <+3289>: vpblendmd zmm0{k2},zmm9,zmm8 0x0000000000006a6f <+3295>: vpminsd zmm10,zmm4,zmm6 0x0000000000006a75 <+3301>: mov ax,0x2653 0x0000000000006a79 <+3305>: kmovd k2,eax 0x0000000000006a7d <+3309>: vbroadcasti64x4 zmm11,YMMWORD PTR [rip+0x56699] # 0x5d120 0x0000000000006a87 <+3319>: vpermi2d zmm11,zmm9,zmm10 0x0000000000006a8d <+3325>: vpmaxsd zmm10{k2},zmm4,zmm6 0x0000000000006a93 <+3331>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x578a3] # 0x5e340 0x0000000000006a9d <+3341>: vpermi2d zmm4,zmm7,zmm8 0x0000000000006aa3 <+3347>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57953] # 0x5e400 0x0000000000006aad <+3357>: vpermi2d zmm6,zmm10,zmm0 0x0000000000006ab3 <+3363>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57983] # 0x5e440 0x0000000000006abd <+3373>: vpermi2d zmm8,zmm6,zmm7 0x0000000000006ac3 <+3379>: vpminsd zmm7{k1},zmm3,zmm5 0x0000000000006ac9 <+3385>: vpmaxsd zmm3,zmm1,zmm2 0x0000000000006acf <+3391>: mov ax,0xa00 0x0000000000006ad3 <+3395>: kmovd k1,eax 0x0000000000006ad7 <+3399>: vbroadcasti64x4 zmm5,YMMWORD PTR [rip+0x5661f] # 0x5d100 0x0000000000006ae1 <+3409>: vpermi2d zmm5,zmm7,zmm3 0x0000000000006ae7 <+3415>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x578cf] # 0x5e3c0 0x0000000000006af1 <+3425>: vpermi2d zmm6,zmm7,zmm3 0x0000000000006af7 <+3431>: vpminsd zmm3{k1},zmm1,zmm2 0x0000000000006afd <+3437>: mov ax,0x1111 0x0000000000006b01 <+3441>: kmovd k1,eax 0x0000000000006b05 <+3445>: vpblendmd zmm2{k1},zmm3,zmm4 0x0000000000006b0b <+3451>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5786b] # 0x5e380 0x0000000000006b15 <+3461>: vpermi2d zmm4,zmm0,zmm10 0x0000000000006b1b <+3467>: mov ax,0x8840 0x0000000000006b1f <+3471>: kmovd k1,eax 0x0000000000006b23 <+3475>: vmovdqa32 zmm4{k1},zmm5 0x0000000000006b29 <+3481>: mov ax,0x211 0x0000000000006b2d <+3485>: kmovd k1,eax 0x0000000000006b31 <+3489>: vmovdqa32 zmm6{k1},zmm11 0x0000000000006b37 <+3495>: vpminsd zmm5,zmm10,zmm8 0x0000000000006b3d <+3501>: vpmaxsd zmm8,zmm10,zmm8 0x0000000000006b43 <+3507>: mov ax,0x8888 0x0000000000006b47 <+3511>: kmovd k1,eax 0x0000000000006b4b <+3515>: vpblendmd zmm9{k1},zmm8,zmm5 0x0000000000006b51 <+3521>: vpmaxsd zmm1,zmm7,zmm6 0x0000000000006b57 <+3527>: mov ax,0x2466 0x0000000000006b5b <+3531>: kmovd k2,eax 0x0000000000006b5f <+3535>: vpminsd zmm1{k2},zmm7,zmm6 0x0000000000006b65 <+3541>: vpmaxsd zmm6,zmm0,zmm4 0x0000000000006b6b <+3547>: mov ax,0x88ca 0x0000000000006b6f <+3551>: kmovd k2,eax 0x0000000000006b73 <+3555>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57a43] # 0x5e5c0 0x0000000000006b7d <+3565>: vpermi2d zmm7,zmm8,zmm6 0x0000000000006b83 <+3571>: vpminsd zmm6{k2},zmm0,zmm4 0x0000000000006b89 <+3577>: vpmaxsd zmm0,zmm3,zmm2 0x0000000000006b8f <+3583>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x578e7] # 0x5e480 0x0000000000006b99 <+3593>: vpermi2d zmm2,zmm5,zmm6 0x0000000000006b9f <+3599>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57917] # 0x5e4c0 0x0000000000006ba9 <+3609>: vpermi2d zmm3,zmm2,zmm1 0x0000000000006baf <+3615>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57947] # 0x5e500 0x0000000000006bb9 <+3625>: vpermi2d zmm2,zmm6,zmm1 0x0000000000006bbf <+3631>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57977] # 0x5e540 0x0000000000006bc9 <+3641>: vpermi2d zmm4,zmm2,zmm0 0x0000000000006bcf <+3647>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x579a7] # 0x5e580 0x0000000000006bd9 <+3657>: vpermi2d zmm2,zmm0,zmm1 0x0000000000006bdf <+3663>: vpmaxsd zmm5,zmm1,zmm4 0x0000000000006be5 <+3669>: mov ax,0xac88 0x0000000000006be9 <+3673>: kmovd k2,eax 0x0000000000006bed <+3677>: vpmaxsd zmm8,zmm9,zmm7 0x0000000000006bf3 <+3683>: vpminsd zmm8{k1},zmm9,zmm7 0x0000000000006bf9 <+3689>: vpminsd zmm7,zmm6,zmm3 0x0000000000006bff <+3695>: mov ax,0x1135 0x0000000000006c03 <+3699>: kmovd k1,eax 0x0000000000006c07 <+3703>: vmovdqa64 zmm9,zmm7 0x0000000000006c0d <+3709>: vpmaxsd zmm9{k1},zmm6,zmm3 0x0000000000006c13 <+3715>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x579e3] # 0x5e600 0x0000000000006c1d <+3725>: vpermi2d zmm3,zmm9,zmm8 0x0000000000006c23 <+3731>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57a13] # 0x5e640 0x0000000000006c2d <+3741>: vpermi2d zmm6,zmm3,zmm5 0x0000000000006c33 <+3747>: vpminsd zmm5{k2},zmm1,zmm4 0x0000000000006c39 <+3753>: vpmaxsd zmm0,zmm0,zmm2 0x0000000000006c3f <+3759>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57a37] # 0x5e680 0x0000000000006c49 <+3769>: vpermi2d zmm1,zmm8,zmm9 0x0000000000006c4f <+3775>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57a67] # 0x5e6c0 0x0000000000006c59 <+3785>: vpermi2d zmm2,zmm0,zmm5 0x0000000000006c5f <+3791>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57a97] # 0x5e700 0x0000000000006c69 <+3801>: vpermi2d zmm3,zmm5,zmm7 0x0000000000006c6f <+3807>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57ac7] # 0x5e740 0x0000000000006c79 <+3817>: vpermi2d zmm4,zmm3,zmm0 0x0000000000006c7f <+3823>: vpminsd zmm3,zmm5,zmm4 0x0000000000006c85 <+3829>: vpmaxsd zmm4,zmm5,zmm4 0x0000000000006c8b <+3835>: mov ax,0xcaaa 0x0000000000006c8f <+3839>: kmovd k1,eax 0x0000000000006c93 <+3843>: vmovdqa32 zmm4{k1},zmm3 0x0000000000006c99 <+3849>: vpmaxsd zmm5,zmm0,zmm2 0x0000000000006c9f <+3855>: mov ax,0x44 0x0000000000006ca3 <+3859>: kmovd k1,eax 0x0000000000006ca7 <+3863>: vpmaxsd zmm7,zmm8,zmm1 0x0000000000006cad <+3869>: mov ax,0xcc88 0x0000000000006cb1 <+3873>: kmovd k2,eax 0x0000000000006cb5 <+3877>: vpminsd zmm7{k2},zmm8,zmm1 0x0000000000006cbb <+3883>: vpmaxsd zmm1,zmm9,zmm6 0x0000000000006cc1 <+3889>: mov ax,0xaaac 0x0000000000006cc5 <+3893>: kmovd k2,eax 0x0000000000006cc9 <+3897>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57b2d] # 0x5e800 0x0000000000006cd3 <+3907>: vpermi2d zmm8,zmm7,zmm1 0x0000000000006cd9 <+3913>: vpminsd zmm1{k2},zmm9,zmm6 0x0000000000006cdf <+3919>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57b57] # 0x5e840 0x0000000000006ce9 <+3929>: vpermi2d zmm6,zmm4,zmm1 0x0000000000006cef <+3935>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x57b87] # 0x5e880 0x0000000000006cf9 <+3945>: vpermi2d zmm9,zmm6,zmm5 0x0000000000006cff <+3951>: vpminsd zmm5{k1},zmm0,zmm2 0x0000000000006d05 <+3957>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57a71] # 0x5e780 0x0000000000006d0f <+3967>: vpermi2d zmm0,zmm1,zmm7 0x0000000000006d15 <+3973>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57aa1] # 0x5e7c0 0x0000000000006d1f <+3983>: vpermi2q zmm2,zmm0,zmm4 0x0000000000006d25 <+3989>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57b91] # 0x5e8c0 0x0000000000006d2f <+3999>: vpermi2d zmm6,zmm5,zmm3 0x0000000000006d35 <+4005>: vpmaxsd zmm3,zmm1,zmm2 0x0000000000006d3b <+4011>: mov ax,0xcaac 0x0000000000006d3f <+4015>: kmovd k1,eax 0x0000000000006d43 <+4019>: vpminsd zmm3{k1},zmm1,zmm2 0x0000000000006d49 <+4025>: vpmaxsd zmm0,zmm5,zmm6 0x0000000000006d4f <+4031>: mov ax,0xaa 0x0000000000006d53 <+4035>: kmovd k2,eax 0x0000000000006d57 <+4039>: vpminsd zmm0{k2},zmm5,zmm6 0x0000000000006d5d <+4045>: vpmaxsd zmm1,zmm4,zmm9 0x0000000000006d63 <+4051>: vpminsd zmm1{k1},zmm4,zmm9 0x0000000000006d69 <+4057>: vpmaxsd zmm2,zmm7,zmm8 0x0000000000006d6f <+4063>: mov ax,0xaa88 0x0000000000006d73 <+4067>: kmovd k1,eax 0x0000000000006d77 <+4071>: vpminsd zmm2{k1},zmm7,zmm8 0x0000000000006d7d <+4077>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57b79] # 0x5e900 0x0000000000006d87 <+4087>: vpermi2d zmm4,zmm2,zmm3 0x0000000000006d8d <+4093>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57ba9] # 0x5e940 0x0000000000006d97 <+4103>: vpermi2d zmm5,zmm1,zmm3 0x0000000000006d9d <+4109>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57bd9] # 0x5e980 0x0000000000006da7 <+4119>: vpermi2d zmm6,zmm5,zmm0 0x0000000000006dad <+4125>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57c09] # 0x5e9c0 0x0000000000006db7 <+4135>: vpermi2d zmm5,zmm0,zmm1 0x0000000000006dbd <+4141>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57c39] # 0x5ea00 0x0000000000006dc7 <+4151>: vpermi2d zmm7,zmm3,zmm2 0x0000000000006dcd <+4157>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57c69] # 0x5ea40 0x0000000000006dd7 <+4167>: vpermi2d zmm8,zmm7,zmm1 0x0000000000006ddd <+4173>: vpminsd zmm7,zmm3,zmm8 0x0000000000006de3 <+4179>: vpmaxsd zmm3,zmm3,zmm8 0x0000000000006de9 <+4185>: mov ax,0xacca 0x0000000000006ded <+4189>: kmovd k1,eax 0x0000000000006df1 <+4193>: vpblendmd zmm8{k1},zmm3,zmm7 0x0000000000006df7 <+4199>: vpmaxsd zmm9,zmm1,zmm6 0x0000000000006dfd <+4205>: vpmaxsd zmm10,zmm2,zmm4 0x0000000000006e03 <+4211>: mov ax,0xccc8 0x0000000000006e07 <+4215>: kmovd k2,eax 0x0000000000006e0b <+4219>: vpminsd zmm10{k2},zmm2,zmm4 0x0000000000006e11 <+4225>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57c65] # 0x5ea80 0x0000000000006e1b <+4235>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm8 0x0000000000006e23 <+4243>: vpermt2d zmm8,zmm4,zmm10 0x0000000000006e29 <+4249>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57c8d] # 0x5eac0 0x0000000000006e33 <+4259>: vpermt2d zmm8,zmm2,zmm9 0x0000000000006e39 <+4265>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm8 0x0000000000006e41 <+4273>: vpminsd zmm9{k1},zmm1,zmm6 0x0000000000006e47 <+4279>: vpmaxsd zmm1,zmm0,zmm5 0x0000000000006e4d <+4285>: mov ax,0x4cc 0x0000000000006e51 <+4289>: kmovd k1,eax 0x0000000000006e55 <+4293>: vpermi2d zmm4,zmm9,zmm7 0x0000000000006e5b <+4299>: vpermt2d zmm4,zmm2,zmm1 0x0000000000006e61 <+4305>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm4 0x0000000000006e69 <+4313>: vpminsd zmm1{k1},zmm0,zmm5 0x0000000000006e6f <+4319>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57c87] # 0x5eb00 0x0000000000006e79 <+4329>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm9 0x0000000000006e81 <+4337>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm1 0x0000000000006e89 <+4345>: vpermi2d zmm0,zmm1,zmm9 0x0000000000006e8f <+4351>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm0 0x0000000000006e97 <+4359>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57c9f] # 0x5eb40 0x0000000000006ea1 <+4369>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm10 0x0000000000006ea9 <+4377>: vpermi2d zmm0,zmm10,zmm3 0x0000000000006eaf <+4383>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm0 0x0000000000006eb7 <+4391>: vpxor xmm0,xmm0,xmm0 0x0000000000006ebb <+4395>: vmovdqa XMMWORD PTR [rsp+0x50],xmm0 0x0000000000006ec1 <+4401>: lea rsi,[rsp+0x50] 0x0000000000006ec6 <+4406>: mov edi,0x1 0x0000000000006ecb <+4411>: vzeroupper 0x0000000000006ece <+4414>: call 0x5470 <clock_gettime@plt> 0x0000000000006ed3 <+4419>: mov r12,QWORD PTR [rsp+0x50] 0x0000000000006ed8 <+4424>: sub r12,rbx 0x0000000000006edb <+4427>: mov rbx,QWORD PTR [rsp+0x58] 0x0000000000006ee0 <+4432>: mov edi,0x40 0x0000000000006ee5 <+4437>: call 0x8e20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006eea <+4442>: mov r14,rax 0x0000000000006eed <+4445>: test rax,rax 0x0000000000006ef0 <+4448>: jle 0x6f07 <main+4471> 0x0000000000006ef2 <+4450>: mov edi,0x1 0x0000000000006ef7 <+4455>: mov rsi,r14 0x0000000000006efa <+4458>: call 0x2e370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006eff <+4463>: mov r15,rax 0x0000000000006f02 <+4466>: mov r13,r14 0x0000000000006f05 <+4469>: jmp 0x6f0d <main+4477> 0x0000000000006f07 <+4471>: xor r15d,r15d 0x0000000000006f0a <+4474>: xor r13d,r13d 0x0000000000006f0d <+4477>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x300] 0x0000000000006f15 <+4485>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x440] 0x0000000000006f1d <+4493>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000006f25 <+4501>: mov ax,0xaaa8 0x0000000000006f29 <+4505>: kmovd k1,eax 0x0000000000006f2d <+4509>: kmovw WORD PTR [rsp+0x38],k1 0x0000000000006f33 <+4515>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x340] 0x0000000000006f3b <+4523>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x380] 0x0000000000006f43 <+4531>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x0000000000006f4b <+4539>: mov ax,0xaaa 0x0000000000006f4f <+4543>: kmovd k1,eax 0x0000000000006f53 <+4547>: kmovw WORD PTR [rsp+0x36],k1 0x0000000000006f59 <+4553>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x3c0] 0x0000000000006f61 <+4561>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x480] 0x0000000000006f69 <+4569>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000006f71 <+4577>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x400] 0x0000000000006f79 <+4585>: vpmaxsd zmm0,zmm0,ZMMWORD PTR [rsp+0x4c0] 0x0000000000006f81 <+4593>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000006f89 <+4601>: imul r12,r12,0x3b9aca00 0x0000000000006f90 <+4608>: sub rbx,QWORD PTR [rsp+0x60] 0x0000000000006f95 <+4613>: lea rdx,[rip+0x57be4] # 0x5eb80 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006f9c <+4620>: mov ecx,0x40 0x0000000000006fa1 <+4625>: mov rdi,r15 0x0000000000006fa4 <+4628>: mov rsi,r14 0x0000000000006fa7 <+4631>: xor eax,eax 0x0000000000006fa9 <+4633>: vzeroupper 0x0000000000006fac <+4636>: call 0x57c0 <snprintf@plt> 0x0000000000006fb1 <+4641>: cdqe 0x0000000000006fb3 <+4643>: inc rax 0x0000000000006fb6 <+4646>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000006fbe <+4654>: mov QWORD PTR [rsp+0xa8],rax 0x0000000000006fc6 <+4662>: mov QWORD PTR [rsp+0xb0],r13 0x0000000000006fce <+4670>: lea rdx,[rip+0x57bcb] # 0x5eba0 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x0000000000006fd5 <+4677>: lea rdi,[rsp+0x258] 0x0000000000006fdd <+4685>: lea rsi,[rsp+0xa0] 0x0000000000006fe5 <+4693>: mov ecx,0x6 0x0000000000006fea <+4698>: call 0xe470 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006fef <+4703>: mov rdi,QWORD PTR [rsp+0xa0] 0x0000000000006ff7 <+4711>: test rdi,rdi 0x0000000000006ffa <+4714>: je 0x7001 <main+4721> 0x0000000000006ffc <+4716>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007001 <+4721>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000007009 <+4729>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x300] 0x0000000000007011 <+4737>: kmovw k1,WORD PTR [rsp+0x38] 0x0000000000007017 <+4743>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x440] 0x000000000000701f <+4751>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000007027 <+4759>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x180] 0x000000000000702f <+4767>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x340] 0x0000000000007037 <+4775>: kmovw k1,WORD PTR [rsp+0x36] 0x000000000000703d <+4781>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x380] 0x0000000000007045 <+4789>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x000000000000704d <+4797>: kmovw k1,WORD PTR [rsp+0x3a] 0x0000000000007053 <+4803>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x000000000000705b <+4811>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x3c0] 0x0000000000007063 <+4819>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x480] 0x000000000000706b <+4827>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000007073 <+4835>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x000000000000707b <+4843>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x400] 0x0000000000007083 <+4851>: vpminsd zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x4c0] 0x000000000000708b <+4859>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000007093 <+4867>: add rbx,r12 0x0000000000007096 <+4870>: mov edi,0x1 0x000000000000709b <+4875>: mov esi,0x3 0x00000000000070a0 <+4880>: vzeroupper 0x00000000000070a3 <+4883>: call 0x2e370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000070a8 <+4888>: xor ecx,ecx 0x00000000000070aa <+4890>: nop WORD PTR [rax+rax*1+0x0] 0x00000000000070b0 <+4896>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000070b4 <+4900>: inc rcx 0x00000000000070b7 <+4903>: cmp rcx,0x3 0x00000000000070bb <+4907>: jne 0x70b0 <main+4896> 0x00000000000070bd <+4909>: mov WORD PTR [rax],0x203a 0x00000000000070c2 <+4914>: mov BYTE PTR [rax+0x2],0x0 0x00000000000070c6 <+4918>: mov QWORD PTR [rsp+0xb8],rax 0x00000000000070ce <+4926>: mov QWORD PTR [rsp+0xc0],0x3 0x00000000000070da <+4938>: mov QWORD PTR [rsp+0xc8],0x3 0x00000000000070e6 <+4950>: lea rdi,[rsp+0x270] 0x00000000000070ee <+4958>: lea rsi,[rsp+0x258] 0x00000000000070f6 <+4966>: lea rdx,[rsp+0xb8] 0x00000000000070fe <+4974>: call 0xe030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000007103 <+4979>: mov rdi,QWORD PTR [rsp+0xb8] 0x000000000000710b <+4987>: test rdi,rdi 0x000000000000710e <+4990>: je 0x7115 <main+4997> 0x0000000000007110 <+4992>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007115 <+4997>: mov rdi,QWORD PTR [rsp+0x258] 0x000000000000711d <+5005>: test rdi,rdi 0x0000000000007120 <+5008>: je 0x7127 <main+5015> 0x0000000000007122 <+5010>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007127 <+5015>: lea r14,[rsp+0x2e8] 0x000000000000712f <+5023>: mov rdi,r14 0x0000000000007132 <+5026>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1c0] 0x000000000000713a <+5034>: vmovaps zmm1,ZMMWORD PTR [rsp+0x140] 0x0000000000007142 <+5042>: vmovaps zmm2,ZMMWORD PTR [rsp+0x100] 0x000000000000714a <+5050>: vmovaps zmm3,ZMMWORD PTR [rsp+0x180] 0x0000000000007152 <+5058>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=64> 0x0000000000007157 <+5063>: lea rdi,[rsp+0x288] 0x000000000000715f <+5071>: lea rsi,[rsp+0x270] 0x0000000000007167 <+5079>: mov rdx,r14 0x000000000000716a <+5082>: vzeroupper 0x000000000000716d <+5085>: call 0xe030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000007172 <+5090>: mov rdi,QWORD PTR [rsp+0x2e8] 0x000000000000717a <+5098>: test rdi,rdi 0x000000000000717d <+5101>: je 0x7184 <main+5108> 0x000000000000717f <+5103>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007184 <+5108>: mov rdi,QWORD PTR [rsp+0x270] 0x000000000000718c <+5116>: test rdi,rdi 0x000000000000718f <+5119>: je 0x7196 <main+5126> 0x0000000000007191 <+5121>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007196 <+5126>: lea rdi,[rsp+0x288] 0x000000000000719e <+5134>: call 0x98d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000071a3 <+5139>: mov rdi,QWORD PTR [rsp+0x288] 0x00000000000071ab <+5147>: test rdi,rdi 0x00000000000071ae <+5150>: je 0x71b5 <main+5157> 0x00000000000071b0 <+5152>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000071b5 <+5157>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x00000000000071bd <+5165>: vpaddd zmm0,zmm0,ZMMWORD PTR [rsp+0x1c0] 0x00000000000071c5 <+5173>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x140] 0x00000000000071cd <+5181>: vpaddd zmm1,zmm1,ZMMWORD PTR [rsp+0x180] 0x00000000000071d5 <+5189>: vpaddd zmm0,zmm0,zmm1 0x00000000000071db <+5195>: vextracti64x4 ymm1,zmm0,0x1 0x00000000000071e2 <+5202>: vpaddd ymm0,ymm0,ymm1 0x00000000000071e6 <+5206>: vextracti128 xmm1,ymm0,0x1 0x00000000000071ec <+5212>: vpaddd xmm0,xmm0,xmm1 0x00000000000071f0 <+5216>: vpshufd xmm1,xmm0,0xee 0x00000000000071f5 <+5221>: vpaddd xmm0,xmm0,xmm1 0x00000000000071f9 <+5225>: vpshufd xmm1,xmm0,0x55 0x00000000000071fe <+5230>: vpaddd xmm0,xmm0,xmm1 0x0000000000007202 <+5234>: vmovd eax,xmm0 0x0000000000007206 <+5238>: vmovd DWORD PTR [rsp+0x3c],xmm0 0x000000000000720c <+5244>: lea rcx,[rsp+0x3c] 0x0000000000007211 <+5249>: mov QWORD PTR [rsp+0x68],rcx 0x0000000000007216 <+5254>: mov rdi,rbx 0x0000000000007219 <+5257>: vzeroupper 0x000000000000721c <+5260>: call 0x8e20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000007221 <+5265>: mov r14,rax 0x0000000000007224 <+5268>: test rax,rax 0x0000000000007227 <+5271>: jle 0x723e <main+5294> 0x0000000000007229 <+5273>: mov edi,0x1 0x000000000000722e <+5278>: mov rsi,r14 0x0000000000007231 <+5281>: call 0x2e370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000007236 <+5286>: mov r15,rax 0x0000000000007239 <+5289>: mov r12,r14 0x000000000000723c <+5292>: jmp 0x7244 <main+5300> 0x000000000000723e <+5294>: xor r15d,r15d 0x0000000000007241 <+5297>: xor r12d,r12d 0x0000000000007244 <+5300>: lea rdx,[rip+0x57935] # 0x5eb80 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000724b <+5307>: mov rdi,r15 0x000000000000724e <+5310>: mov rsi,r14 0x0000000000007251 <+5313>: mov rcx,rbx 0x0000000000007254 <+5316>: xor eax,eax 0x0000000000007256 <+5318>: call 0x57c0 <snprintf@plt> 0x000000000000725b <+5323>: cdqe 0x000000000000725d <+5325>: inc rax 0x0000000000007260 <+5328>: mov QWORD PTR [rsp+0xd0],r15 0x0000000000007268 <+5336>: mov QWORD PTR [rsp+0xd8],rax 0x0000000000007270 <+5344>: mov QWORD PTR [rsp+0xe0],r12 0x0000000000007278 <+5352>: lea rdx,[rip+0x57931] # 0x5ebb0 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x000000000000727f <+5359>: lea rdi,[rsp+0x2a0] 0x0000000000007287 <+5367>: lea rsi,[rsp+0xd0] 0x000000000000728f <+5375>: mov ecx,0xb 0x0000000000007294 <+5380>: call 0xe470 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000007299 <+5385>: mov rdi,QWORD PTR [rsp+0xd0] 0x00000000000072a1 <+5393>: test rdi,rdi 0x00000000000072a4 <+5396>: je 0x72ab <main+5403> 0x00000000000072a6 <+5398>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000072ab <+5403>: mov edi,0x1 0x00000000000072b0 <+5408>: mov esi,0x4 0x00000000000072b5 <+5413>: call 0x2e370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000072ba <+5418>: xor ecx,ecx 0x00000000000072bc <+5420>: nop DWORD PTR [rax+0x0] 0x00000000000072c0 <+5424>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000072c4 <+5428>: inc rcx 0x00000000000072c7 <+5431>: cmp rcx,0x4 0x00000000000072cb <+5435>: jne 0x72c0 <main+5424> 0x00000000000072cd <+5437>: mov DWORD PTR [rax],0x736e20 0x00000000000072d3 <+5443>: mov QWORD PTR [rsp+0xe8],rax 0x00000000000072db <+5451>: mov QWORD PTR [rsp+0xf0],0x4 0x00000000000072e7 <+5463>: mov QWORD PTR [rsp+0xf8],0x4 0x00000000000072f3 <+5475>: lea rdi,[rsp+0x2b8] 0x00000000000072fb <+5483>: lea rsi,[rsp+0x2a0] 0x0000000000007303 <+5491>: lea rdx,[rsp+0xe8] 0x000000000000730b <+5499>: call 0xe030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000007310 <+5504>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000007318 <+5512>: test rdi,rdi 0x000000000000731b <+5515>: je 0x7322 <main+5522> 0x000000000000731d <+5517>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007322 <+5522>: mov rdi,QWORD PTR [rsp+0x2a0] 0x000000000000732a <+5530>: test rdi,rdi 0x000000000000732d <+5533>: je 0x7334 <main+5540> 0x000000000000732f <+5535>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007334 <+5540>: lea rdi,[rsp+0x2b8] 0x000000000000733c <+5548>: call 0x98d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000007341 <+5553>: mov rdi,QWORD PTR [rsp+0x2b8] 0x0000000000007349 <+5561>: test rdi,rdi 0x000000000000734c <+5564>: je 0x7353 <main+5571> 0x000000000000734e <+5566>: call 0x2e390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007353 <+5571>: call 0x2a790 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000007358 <+5576>: xor eax,eax 0x000000000000735a <+5578>: lea rsp,[rbp-0x28] 0x000000000000735e <+5582>: pop rbx 0x000000000000735f <+5583>: pop r12 0x0000000000007361 <+5585>: pop r13 0x0000000000007363 <+5587>: pop r14 0x0000000000007365 <+5589>: pop r15 0x0000000000007367 <+5591>: pop rbp 0x0000000000007368 <+5592>: ret End of assembler dump. --- disassemble/int32_8.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d20 <+0>: push rbp 0x0000000000005d21 <+1>: push r15 0x0000000000005d23 <+3>: push r14 0x0000000000005d25 <+5>: push r13 0x0000000000005d27 <+7>: push r12 0x0000000000005d29 <+9>: push rbx 0x0000000000005d2a <+10>: sub rsp,0x208 0x0000000000005d31 <+17>: call 0x2ef40 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d36 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d3a <+26>: mov ebx,0x9 0x0000000000005d3f <+31>: xor r14d,r14d 0x0000000000005d42 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005d50 <+48>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x0000000000005d56 <+54>: vzeroupper 0x0000000000005d59 <+57>: call 0x2de90 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d5e <+62>: mov edx,0x64 0x0000000000005d63 <+67>: mov rdi,rax 0x0000000000005d66 <+70>: xor esi,esi 0x0000000000005d68 <+72>: call 0x2e2a0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005d6d <+77>: vpbroadcastd ymm0,r14d 0x0000000000005d73 <+83>: vpcmpeqd k1,ymm0,YMMWORD PTR [rip+0x56363] # 0x5c0e0 0x0000000000005d7d <+93>: vmovdqu ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000005d83 <+99>: vpbroadcastd ymm0{k1},eax 0x0000000000005d89 <+105>: dec rbx 0x0000000000005d8c <+108>: inc r14 0x0000000000005d8f <+111>: cmp rbx,0x1 0x0000000000005d93 <+115>: ja 0x5d50 <main+48> 0x0000000000005d95 <+117>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x0000000000005d9b <+123>: mov edi,0x8 0x0000000000005da0 <+128>: vzeroupper 0x0000000000005da3 <+131>: call 0x7e20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005da8 <+136>: mov rbx,rax 0x0000000000005dab <+139>: test rax,rax 0x0000000000005dae <+142>: jle 0x5dc5 <main+165> 0x0000000000005db0 <+144>: mov edi,0x1 0x0000000000005db5 <+149>: mov rsi,rbx 0x0000000000005db8 <+152>: call 0x2d370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005dbd <+157>: mov r14,rax 0x0000000000005dc0 <+160>: mov r15,rbx 0x0000000000005dc3 <+163>: jmp 0x5dcb <main+171> 0x0000000000005dc5 <+165>: xor r14d,r14d 0x0000000000005dc8 <+168>: xor r15d,r15d 0x0000000000005dcb <+171>: lea rdx,[rip+0x5637e] # 0x5c150 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005dd2 <+178>: mov ecx,0x8 0x0000000000005dd7 <+183>: mov rdi,r14 0x0000000000005dda <+186>: mov rsi,rbx 0x0000000000005ddd <+189>: xor eax,eax 0x0000000000005ddf <+191>: call 0x57c0 <snprintf@plt> 0x0000000000005de4 <+196>: cdqe 0x0000000000005de6 <+198>: inc rax 0x0000000000005de9 <+201>: mov QWORD PTR [rsp+0x60],r14 0x0000000000005dee <+206>: mov QWORD PTR [rsp+0x68],rax 0x0000000000005df3 <+211>: mov QWORD PTR [rsp+0x70],r15 0x0000000000005df8 <+216>: lea rdx,[rip+0x56361] # 0x5c160 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005dff <+223>: lea rdi,[rsp+0xf0] 0x0000000000005e07 <+231>: lea rsi,[rsp+0x60] 0x0000000000005e0c <+236>: mov ecx,0x7 0x0000000000005e11 <+241>: call 0xd470 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e16 <+246>: mov rdi,QWORD PTR [rsp+0x60] 0x0000000000005e1b <+251>: test rdi,rdi 0x0000000000005e1e <+254>: je 0x5e25 <main+261> 0x0000000000005e20 <+256>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e25 <+261>: mov edi,0x1 0x0000000000005e2a <+266>: mov esi,0x3 0x0000000000005e2f <+271>: call 0x2d370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e34 <+276>: xor ecx,ecx 0x0000000000005e36 <+278>: cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005e40 <+288>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005e44 <+292>: inc rcx 0x0000000000005e47 <+295>: cmp rcx,0x3 0x0000000000005e4b <+299>: jne 0x5e40 <main+288> 0x0000000000005e4d <+301>: mov WORD PTR [rax],0x203a 0x0000000000005e52 <+306>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005e56 <+310>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005e5b <+315>: mov QWORD PTR [rsp+0x80],0x3 0x0000000000005e67 <+327>: mov QWORD PTR [rsp+0x88],0x3 0x0000000000005e73 <+339>: lea rdi,[rsp+0x108] 0x0000000000005e7b <+347>: lea rsi,[rsp+0xf0] 0x0000000000005e83 <+355>: lea rdx,[rsp+0x78] 0x0000000000005e88 <+360>: call 0xd030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005e8d <+365>: mov rdi,QWORD PTR [rsp+0x78] 0x0000000000005e92 <+370>: test rdi,rdi 0x0000000000005e95 <+373>: je 0x5e9c <main+380> 0x0000000000005e97 <+375>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e9c <+380>: mov rdi,QWORD PTR [rsp+0xf0] 0x0000000000005ea4 <+388>: test rdi,rdi 0x0000000000005ea7 <+391>: je 0x5eae <main+398> 0x0000000000005ea9 <+393>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005eae <+398>: lea rbx,[rsp+0x1b0] 0x0000000000005eb6 <+406>: mov rdi,rbx 0x0000000000005eb9 <+409>: vmovups ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000005ebf <+415>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=8> 0x0000000000005ec4 <+420>: lea rdi,[rsp+0x120] 0x0000000000005ecc <+428>: lea rsi,[rsp+0x108] 0x0000000000005ed4 <+436>: mov rdx,rbx 0x0000000000005ed7 <+439>: vzeroupper 0x0000000000005eda <+442>: call 0xd030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005edf <+447>: mov rdi,QWORD PTR [rsp+0x1b0] 0x0000000000005ee7 <+455>: test rdi,rdi 0x0000000000005eea <+458>: je 0x5ef1 <main+465> 0x0000000000005eec <+460>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ef1 <+465>: mov rdi,QWORD PTR [rsp+0x108] 0x0000000000005ef9 <+473>: test rdi,rdi 0x0000000000005efc <+476>: je 0x5f03 <main+483> 0x0000000000005efe <+478>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f03 <+483>: lea rdi,[rsp+0x120] 0x0000000000005f0b <+491>: call 0x88d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f10 <+496>: mov rdi,QWORD PTR [rsp+0x120] 0x0000000000005f18 <+504>: test rdi,rdi 0x0000000000005f1b <+507>: je 0x5f22 <main+514> 0x0000000000005f1d <+509>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f22 <+514>: vxorps xmm0,xmm0,xmm0 0x0000000000005f26 <+518>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 0x0000000000005f2c <+524>: lea rsi,[rsp+0x30] 0x0000000000005f31 <+529>: mov edi,0x1 0x0000000000005f36 <+534>: call 0x5470 <clock_gettime@plt> 0x0000000000005f3b <+539>: mov rbx,QWORD PTR [rsp+0x30] 0x0000000000005f40 <+544>: mov r12,QWORD PTR [rsp+0x38] 0x0000000000005f45 <+549>: vmovdqu ymm2,YMMWORD PTR [rsp+0x10] 0x0000000000005f4b <+555>: vpshufd ymm0,ymm2,0x4e 0x0000000000005f50 <+560>: vpminsd ymm1,ymm2,ymm0 0x0000000000005f55 <+565>: vpmaxsd ymm0,ymm2,ymm0 0x0000000000005f5a <+570>: vpblendd ymm0,ymm1,ymm0,0xcc 0x0000000000005f60 <+576>: vxorps xmm1,xmm1,xmm1 0x0000000000005f64 <+580>: vpermq ymm1,ymm0,0x4e 0x0000000000005f6a <+586>: vpminsd ymm2,ymm0,ymm1 0x0000000000005f6f <+591>: vpmaxsd ymm0,ymm0,ymm1 0x0000000000005f74 <+596>: vpblendd ymm0,ymm2,ymm0,0xf0 0x0000000000005f7a <+602>: vpshufd ymm1,ymm0,0xb1 0x0000000000005f7f <+607>: vpminsd ymm2,ymm0,ymm1 0x0000000000005f84 <+612>: vpmaxsd ymm0,ymm0,ymm1 0x0000000000005f89 <+617>: vpblendd ymm0,ymm2,ymm0,0xaa 0x0000000000005f8f <+623>: vxorps xmm1,xmm1,xmm1 0x0000000000005f93 <+627>: vpermq ymm1,ymm0,0xd8 0x0000000000005f99 <+633>: vpminsd ymm2,ymm0,ymm1 0x0000000000005f9e <+638>: vpmaxsd ymm0,ymm0,ymm1 0x0000000000005fa3 <+643>: vpblendd ymm0,ymm0,ymm2,0xc 0x0000000000005fa9 <+649>: vmovdqa ymm1,YMMWORD PTR [rip+0x5614f] # 0x5c100 0x0000000000005fb1 <+657>: vpermd ymm1,ymm1,ymm0 0x0000000000005fb6 <+662>: vpminsd ymm2,ymm0,ymm1 0x0000000000005fbb <+667>: vpmaxsd ymm0,ymm0,ymm1 0x0000000000005fc0 <+672>: vpblendd ymm0,ymm0,ymm2,0xa 0x0000000000005fc6 <+678>: vmovdqa ymm1,YMMWORD PTR [rip+0x56152] # 0x5c120 0x0000000000005fce <+686>: vpermd ymm1,ymm1,ymm0 0x0000000000005fd3 <+691>: vpminsd ymm2,ymm0,ymm1 0x0000000000005fd8 <+696>: vmovdqu YMMWORD PTR [rsp+0x10],ymm2 0x0000000000005fde <+702>: vpmaxsd ymm0,ymm0,ymm1 0x0000000000005fe3 <+707>: vmovdqu YMMWORD PTR [rsp+0x1e0],ymm0 0x0000000000005fec <+716>: vpxor xmm0,xmm0,xmm0 0x0000000000005ff0 <+720>: vmovdqa XMMWORD PTR [rsp+0x40],xmm0 0x0000000000005ff6 <+726>: lea rsi,[rsp+0x40] 0x0000000000005ffb <+731>: mov edi,0x1 0x0000000000006000 <+736>: vzeroupper 0x0000000000006003 <+739>: call 0x5470 <clock_gettime@plt> 0x0000000000006008 <+744>: mov r13,QWORD PTR [rsp+0x40] 0x000000000000600d <+749>: sub r13,rbx 0x0000000000006010 <+752>: mov rbx,QWORD PTR [rsp+0x48] 0x0000000000006015 <+757>: mov edi,0x8 0x000000000000601a <+762>: call 0x7e20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000601f <+767>: mov r14,rax 0x0000000000006022 <+770>: test rax,rax 0x0000000000006025 <+773>: jle 0x603c <main+796> 0x0000000000006027 <+775>: mov edi,0x1 0x000000000000602c <+780>: mov rsi,r14 0x000000000000602f <+783>: call 0x2d370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006034 <+788>: mov r15,rax 0x0000000000006037 <+791>: mov rbp,r14 0x000000000000603a <+794>: jmp 0x6041 <main+801> 0x000000000000603c <+796>: xor r15d,r15d 0x000000000000603f <+799>: xor ebp,ebp 0x0000000000006041 <+801>: vmovups ymm0,YMMWORD PTR [rsp+0x1e0] 0x000000000000604a <+810>: vblendps ymm0,ymm0,YMMWORD PTR [rsp+0x10],0x2a 0x0000000000006052 <+818>: vmovups YMMWORD PTR [rsp+0x10],ymm0 0x0000000000006058 <+824>: imul r13,r13,0x3b9aca00 0x000000000000605f <+831>: sub rbx,r12 0x0000000000006062 <+834>: lea rdx,[rip+0x560e7] # 0x5c150 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006069 <+841>: mov ecx,0x8 0x000000000000606e <+846>: mov rdi,r15 0x0000000000006071 <+849>: mov rsi,r14 0x0000000000006074 <+852>: xor eax,eax 0x0000000000006076 <+854>: vzeroupper 0x0000000000006079 <+857>: call 0x57c0 <snprintf@plt> 0x000000000000607e <+862>: cdqe 0x0000000000006080 <+864>: inc rax 0x0000000000006083 <+867>: mov QWORD PTR [rsp+0x90],r15 0x000000000000608b <+875>: mov QWORD PTR [rsp+0x98],rax 0x0000000000006093 <+883>: mov QWORD PTR [rsp+0xa0],rbp 0x000000000000609b <+891>: lea rdx,[rip+0x560ce] # 0x5c170 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x00000000000060a2 <+898>: lea rdi,[rsp+0x138] 0x00000000000060aa <+906>: lea rsi,[rsp+0x90] 0x00000000000060b2 <+914>: mov ecx,0x6 0x00000000000060b7 <+919>: call 0xd470 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000060bc <+924>: mov rdi,QWORD PTR [rsp+0x90] 0x00000000000060c4 <+932>: test rdi,rdi 0x00000000000060c7 <+935>: je 0x60ce <main+942> 0x00000000000060c9 <+937>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000060ce <+942>: add rbx,r13 0x00000000000060d1 <+945>: mov edi,0x1 0x00000000000060d6 <+950>: mov esi,0x3 0x00000000000060db <+955>: call 0x2d370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000060e0 <+960>: xor ecx,ecx 0x00000000000060e2 <+962>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x00000000000060f0 <+976>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000060f4 <+980>: inc rcx 0x00000000000060f7 <+983>: cmp rcx,0x3 0x00000000000060fb <+987>: jne 0x60f0 <main+976> 0x00000000000060fd <+989>: mov WORD PTR [rax],0x203a 0x0000000000006102 <+994>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006106 <+998>: mov QWORD PTR [rsp+0xa8],rax 0x000000000000610e <+1006>: mov QWORD PTR [rsp+0xb0],0x3 0x000000000000611a <+1018>: mov QWORD PTR [rsp+0xb8],0x3 0x0000000000006126 <+1030>: lea rdi,[rsp+0x150] 0x000000000000612e <+1038>: lea rsi,[rsp+0x138] 0x0000000000006136 <+1046>: lea rdx,[rsp+0xa8] 0x000000000000613e <+1054>: call 0xd030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006143 <+1059>: mov rdi,QWORD PTR [rsp+0xa8] 0x000000000000614b <+1067>: test rdi,rdi 0x000000000000614e <+1070>: je 0x6155 <main+1077> 0x0000000000006150 <+1072>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006155 <+1077>: mov rdi,QWORD PTR [rsp+0x138] 0x000000000000615d <+1085>: test rdi,rdi 0x0000000000006160 <+1088>: je 0x6167 <main+1095> 0x0000000000006162 <+1090>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006167 <+1095>: lea r14,[rsp+0x1c8] 0x000000000000616f <+1103>: mov rdi,r14 0x0000000000006172 <+1106>: vmovups ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000006178 <+1112>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si32,_74x26_size=8> 0x000000000000617d <+1117>: lea rdi,[rsp+0x168] 0x0000000000006185 <+1125>: lea rsi,[rsp+0x150] 0x000000000000618d <+1133>: mov rdx,r14 0x0000000000006190 <+1136>: vzeroupper 0x0000000000006193 <+1139>: call 0xd030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006198 <+1144>: mov rdi,QWORD PTR [rsp+0x1c8] 0x00000000000061a0 <+1152>: test rdi,rdi 0x00000000000061a3 <+1155>: je 0x61aa <main+1162> 0x00000000000061a5 <+1157>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000061aa <+1162>: mov rdi,QWORD PTR [rsp+0x150] 0x00000000000061b2 <+1170>: test rdi,rdi 0x00000000000061b5 <+1173>: je 0x61bc <main+1180> 0x00000000000061b7 <+1175>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000061bc <+1180>: lea rdi,[rsp+0x168] 0x00000000000061c4 <+1188>: call 0x88d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000061c9 <+1193>: mov rdi,QWORD PTR [rsp+0x168] 0x00000000000061d1 <+1201>: test rdi,rdi 0x00000000000061d4 <+1204>: je 0x61db <main+1211> 0x00000000000061d6 <+1206>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000061db <+1211>: vmovdqu ymm1,YMMWORD PTR [rsp+0x10] 0x00000000000061e1 <+1217>: vextracti128 xmm0,ymm1,0x1 0x00000000000061e7 <+1223>: vpaddd xmm0,xmm1,xmm0 0x00000000000061eb <+1227>: vpshufd xmm1,xmm0,0xee 0x00000000000061f0 <+1232>: vpaddd xmm0,xmm0,xmm1 0x00000000000061f4 <+1236>: vpshufd xmm1,xmm0,0x55 0x00000000000061f9 <+1241>: vpaddd xmm0,xmm0,xmm1 0x00000000000061fd <+1245>: vmovd eax,xmm0 0x0000000000006201 <+1249>: vmovd DWORD PTR [rsp+0xc],xmm0 0x0000000000006207 <+1255>: lea rcx,[rsp+0xc] 0x000000000000620c <+1260>: mov QWORD PTR [rsp+0x58],rcx 0x0000000000006211 <+1265>: mov rdi,rbx 0x0000000000006214 <+1268>: vzeroupper 0x0000000000006217 <+1271>: call 0x7e20 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000621c <+1276>: mov r14,rax 0x000000000000621f <+1279>: test rax,rax 0x0000000000006222 <+1282>: jle 0x6239 <main+1305> 0x0000000000006224 <+1284>: mov edi,0x1 0x0000000000006229 <+1289>: mov rsi,r14 0x000000000000622c <+1292>: call 0x2d370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006231 <+1297>: mov r15,rax 0x0000000000006234 <+1300>: mov r12,r14 0x0000000000006237 <+1303>: jmp 0x623f <main+1311> 0x0000000000006239 <+1305>: xor r15d,r15d 0x000000000000623c <+1308>: xor r12d,r12d 0x000000000000623f <+1311>: lea rdx,[rip+0x55f0a] # 0x5c150 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006246 <+1318>: mov rdi,r15 0x0000000000006249 <+1321>: mov rsi,r14 0x000000000000624c <+1324>: mov rcx,rbx 0x000000000000624f <+1327>: xor eax,eax 0x0000000000006251 <+1329>: call 0x57c0 <snprintf@plt> 0x0000000000006256 <+1334>: cdqe 0x0000000000006258 <+1336>: inc rax 0x000000000000625b <+1339>: mov QWORD PTR [rsp+0xc0],r15 0x0000000000006263 <+1347>: mov QWORD PTR [rsp+0xc8],rax 0x000000000000626b <+1355>: mov QWORD PTR [rsp+0xd0],r12 0x0000000000006273 <+1363>: lea rdx,[rip+0x55f06] # 0x5c180 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x000000000000627a <+1370>: lea rdi,[rsp+0x180] 0x0000000000006282 <+1378>: lea rsi,[rsp+0xc0] 0x000000000000628a <+1386>: mov ecx,0xb 0x000000000000628f <+1391>: call 0xd470 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006294 <+1396>: mov rdi,QWORD PTR [rsp+0xc0] 0x000000000000629c <+1404>: test rdi,rdi 0x000000000000629f <+1407>: je 0x62a6 <main+1414> 0x00000000000062a1 <+1409>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000062a6 <+1414>: mov edi,0x1 0x00000000000062ab <+1419>: mov esi,0x4 0x00000000000062b0 <+1424>: call 0x2d370 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000062b5 <+1429>: xor ecx,ecx 0x00000000000062b7 <+1431>: nop WORD PTR [rax+rax*1+0x0] 0x00000000000062c0 <+1440>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000062c4 <+1444>: inc rcx 0x00000000000062c7 <+1447>: cmp rcx,0x4 0x00000000000062cb <+1451>: jne 0x62c0 <main+1440> 0x00000000000062cd <+1453>: mov DWORD PTR [rax],0x736e20 0x00000000000062d3 <+1459>: mov QWORD PTR [rsp+0xd8],rax 0x00000000000062db <+1467>: mov QWORD PTR [rsp+0xe0],0x4 0x00000000000062e7 <+1479>: mov QWORD PTR [rsp+0xe8],0x4 0x00000000000062f3 <+1491>: lea rdi,[rsp+0x198] 0x00000000000062fb <+1499>: lea rsi,[rsp+0x180] 0x0000000000006303 <+1507>: lea rdx,[rsp+0xd8] 0x000000000000630b <+1515>: call 0xd030 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006310 <+1520>: mov rdi,QWORD PTR [rsp+0xd8] 0x0000000000006318 <+1528>: test rdi,rdi 0x000000000000631b <+1531>: je 0x6322 <main+1538> 0x000000000000631d <+1533>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006322 <+1538>: mov rdi,QWORD PTR [rsp+0x180] 0x000000000000632a <+1546>: test rdi,rdi 0x000000000000632d <+1549>: je 0x6334 <main+1556> 0x000000000000632f <+1551>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006334 <+1556>: lea rdi,[rsp+0x198] 0x000000000000633c <+1564>: call 0x88d0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006341 <+1569>: mov rdi,QWORD PTR [rsp+0x198] 0x0000000000006349 <+1577>: test rdi,rdi 0x000000000000634c <+1580>: je 0x6353 <main+1587> 0x000000000000634e <+1582>: call 0x2d390 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006353 <+1587>: call 0x29790 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006358 <+1592>: xor eax,eax 0x000000000000635a <+1594>: add rsp,0x208 0x0000000000006361 <+1601>: pop rbx 0x0000000000006362 <+1602>: pop r12 0x0000000000006364 <+1604>: pop r13 0x0000000000006366 <+1606>: pop r14 0x0000000000006368 <+1608>: pop r15 0x000000000000636a <+1610>: pop rbp 0x000000000000636b <+1611>: ret End of assembler dump. --- disassemble/int64_128.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005fd0 <+0>: push rbp 0x0000000000005fd1 <+1>: mov rbp,rsp 0x0000000000005fd4 <+4>: push r15 0x0000000000005fd6 <+6>: push r14 0x0000000000005fd8 <+8>: push r13 0x0000000000005fda <+10>: push r12 0x0000000000005fdc <+12>: push rbx 0x0000000000005fdd <+13>: and rsp,0xffffffffffffffc0 0x0000000000005fe1 <+17>: sub rsp,0x14c0 0x0000000000005fe8 <+24>: call 0x33710 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005fed <+29>: vxorps xmm4,xmm4,xmm4 0x0000000000005ff1 <+33>: mov ebx,0x81 0x0000000000005ff6 <+38>: xor r14d,r14d 0x0000000000005ff9 <+41>: vxorps xmm13,xmm13,xmm13 0x0000000000005ffe <+46>: vxorps xmm14,xmm14,xmm14 0x0000000000006003 <+51>: vxorps xmm15,xmm15,xmm15 0x0000000000006008 <+56>: vxorps xmm12,xmm12,xmm12 0x000000000000600d <+61>: vxorps xmm11,xmm11,xmm11 0x0000000000006012 <+66>: vxorps xmm10,xmm10,xmm10 0x0000000000006017 <+71>: vxorps xmm9,xmm9,xmm9 0x000000000000601c <+76>: vxorps xmm8,xmm8,xmm8 0x0000000000006021 <+81>: vxorps xmm7,xmm7,xmm7 0x0000000000006025 <+85>: vxorps xmm6,xmm6,xmm6 0x0000000000006029 <+89>: vxorps xmm5,xmm5,xmm5 0x000000000000602d <+93>: vxorps xmm3,xmm3,xmm3 0x0000000000006031 <+97>: vxorps xmm2,xmm2,xmm2 0x0000000000006035 <+101>: vxorps xmm1,xmm1,xmm1 0x0000000000006039 <+105>: vxorps xmm0,xmm0,xmm0 0x000000000000603d <+109>: nop DWORD PTR [rax] 0x0000000000006040 <+112>: vmovaps ZMMWORD PTR [rsp+0x5c0],zmm13 0x0000000000006048 <+120>: vmovaps ZMMWORD PTR [rsp+0x840],zmm14 0x0000000000006050 <+128>: vmovaps ZMMWORD PTR [rsp+0x2c0],zmm15 0x0000000000006058 <+136>: vmovaps ZMMWORD PTR [rsp+0x3c0],zmm4 0x0000000000006060 <+144>: vmovaps ZMMWORD PTR [rsp+0x300],zmm12 0x0000000000006068 <+152>: vmovaps ZMMWORD PTR [rsp+0x540],zmm11 0x0000000000006070 <+160>: vmovaps ZMMWORD PTR [rsp+0x640],zmm10 0x0000000000006078 <+168>: vmovaps ZMMWORD PTR [rsp+0x480],zmm9 0x0000000000006080 <+176>: vmovaps ZMMWORD PTR [rsp+0x280],zmm8 0x0000000000006088 <+184>: vmovaps ZMMWORD PTR [rsp+0x4c0],zmm7 0x0000000000006090 <+192>: vmovaps ZMMWORD PTR [rsp+0x440],zmm6 0x0000000000006098 <+200>: vmovaps ZMMWORD PTR [rsp+0x400],zmm5 0x00000000000060a0 <+208>: vmovaps ZMMWORD PTR [rsp+0x340],zmm3 0x00000000000060a8 <+216>: vmovaps ZMMWORD PTR [rsp+0x380],zmm2 0x00000000000060b0 <+224>: vmovaps ZMMWORD PTR [rsp+0x500],zmm1 0x00000000000060b8 <+232>: vmovaps ZMMWORD PTR [rsp+0x240],zmm0 0x00000000000060c0 <+240>: vzeroupper 0x00000000000060c3 <+243>: call 0x32660 <KGEN_CompilerRT_GetRandomState()> 0x00000000000060c8 <+248>: mov edx,0x64 0x00000000000060cd <+253>: mov rdi,rax 0x00000000000060d0 <+256>: xor esi,esi 0x00000000000060d2 <+258>: call 0x32a70 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x00000000000060d7 <+263>: vmovaps zmm0,ZMMWORD PTR [rsp+0x3c0] 0x00000000000060df <+271>: vmovaps ZMMWORD PTR [rsp+0x1080],zmm0 0x00000000000060e7 <+279>: vmovaps zmm0,ZMMWORD PTR [rsp+0x5c0] 0x00000000000060ef <+287>: vmovaps ZMMWORD PTR [rsp+0x10c0],zmm0 0x00000000000060f7 <+295>: vmovaps zmm0,ZMMWORD PTR [rsp+0x840] 0x00000000000060ff <+303>: vmovaps ZMMWORD PTR [rsp+0x1100],zmm0 0x0000000000006107 <+311>: vmovaps zmm0,ZMMWORD PTR [rsp+0x2c0] 0x000000000000610f <+319>: vmovaps ZMMWORD PTR [rsp+0x1140],zmm0 0x0000000000006117 <+327>: vmovaps zmm0,ZMMWORD PTR [rsp+0x300] 0x000000000000611f <+335>: vmovaps ZMMWORD PTR [rsp+0x1180],zmm0 0x0000000000006127 <+343>: vmovaps zmm0,ZMMWORD PTR [rsp+0x540] 0x000000000000612f <+351>: vmovaps ZMMWORD PTR [rsp+0x11c0],zmm0 0x0000000000006137 <+359>: vmovaps zmm0,ZMMWORD PTR [rsp+0x640] 0x000000000000613f <+367>: vmovaps ZMMWORD PTR [rsp+0x1200],zmm0 0x0000000000006147 <+375>: vmovaps zmm0,ZMMWORD PTR [rsp+0x480] 0x000000000000614f <+383>: vmovaps ZMMWORD PTR [rsp+0x1240],zmm0 0x0000000000006157 <+391>: vmovaps zmm0,ZMMWORD PTR [rsp+0x280] 0x000000000000615f <+399>: vmovaps ZMMWORD PTR [rsp+0x1280],zmm0 0x0000000000006167 <+407>: vmovaps zmm0,ZMMWORD PTR [rsp+0x4c0] 0x000000000000616f <+415>: vmovaps ZMMWORD PTR [rsp+0x12c0],zmm0 0x0000000000006177 <+423>: vmovaps zmm0,ZMMWORD PTR [rsp+0x440] 0x000000000000617f <+431>: vmovaps ZMMWORD PTR [rsp+0x1300],zmm0 0x0000000000006187 <+439>: vmovaps zmm0,ZMMWORD PTR [rsp+0x400] 0x000000000000618f <+447>: vmovaps ZMMWORD PTR [rsp+0x1340],zmm0 0x0000000000006197 <+455>: vmovaps zmm0,ZMMWORD PTR [rsp+0x340] 0x000000000000619f <+463>: vmovaps ZMMWORD PTR [rsp+0x1380],zmm0 0x00000000000061a7 <+471>: vmovaps zmm0,ZMMWORD PTR [rsp+0x380] 0x00000000000061af <+479>: vmovaps ZMMWORD PTR [rsp+0x13c0],zmm0 0x00000000000061b7 <+487>: vmovaps zmm0,ZMMWORD PTR [rsp+0x500] 0x00000000000061bf <+495>: vmovaps ZMMWORD PTR [rsp+0x1400],zmm0 0x00000000000061c7 <+503>: vmovaps zmm0,ZMMWORD PTR [rsp+0x240] 0x00000000000061cf <+511>: vmovaps ZMMWORD PTR [rsp+0x1440],zmm0 0x00000000000061d7 <+519>: mov ecx,r14d 0x00000000000061da <+522>: and ecx,0x7f 0x00000000000061dd <+525>: mov QWORD PTR [rsp+rcx*8+0x1080],rax 0x00000000000061e5 <+533>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1440] 0x00000000000061ed <+541>: vmovaps zmm1,ZMMWORD PTR [rsp+0x1400] 0x00000000000061f5 <+549>: vmovaps zmm2,ZMMWORD PTR [rsp+0x13c0] 0x00000000000061fd <+557>: vmovaps zmm3,ZMMWORD PTR [rsp+0x1380] 0x0000000000006205 <+565>: vmovaps zmm5,ZMMWORD PTR [rsp+0x1340] 0x000000000000620d <+573>: vmovaps zmm6,ZMMWORD PTR [rsp+0x1300] 0x0000000000006215 <+581>: vmovaps zmm7,ZMMWORD PTR [rsp+0x12c0] 0x000000000000621d <+589>: vmovaps zmm8,ZMMWORD PTR [rsp+0x1280] 0x0000000000006225 <+597>: vmovaps zmm9,ZMMWORD PTR [rsp+0x1240] 0x000000000000622d <+605>: vmovaps zmm10,ZMMWORD PTR [rsp+0x1200] 0x0000000000006235 <+613>: vmovaps zmm11,ZMMWORD PTR [rsp+0x11c0] 0x000000000000623d <+621>: vmovaps zmm12,ZMMWORD PTR [rsp+0x1180] 0x0000000000006245 <+629>: vmovaps zmm4,ZMMWORD PTR [rsp+0x1080] 0x000000000000624d <+637>: vmovaps zmm13,ZMMWORD PTR [rsp+0x10c0] 0x0000000000006255 <+645>: vmovaps zmm14,ZMMWORD PTR [rsp+0x1100] 0x000000000000625d <+653>: vmovaps zmm15,ZMMWORD PTR [rsp+0x1140] 0x0000000000006265 <+661>: dec rbx 0x0000000000006268 <+664>: inc r14 0x000000000000626b <+667>: cmp rbx,0x1 0x000000000000626f <+671>: ja 0x6040 <main+112> 0x0000000000006275 <+677>: vmovaps ZMMWORD PTR [rsp+0x4c0],zmm7 0x000000000000627d <+685>: vmovaps ZMMWORD PTR [rsp+0x500],zmm1 0x0000000000006285 <+693>: vmovaps ZMMWORD PTR [rsp+0x640],zmm10 0x000000000000628d <+701>: vmovaps ZMMWORD PTR [rsp+0x5c0],zmm13 0x0000000000006295 <+709>: vmovaps ZMMWORD PTR [rsp+0x840],zmm14 0x000000000000629d <+717>: vmovaps ZMMWORD PTR [rsp+0x3c0],zmm4 0x00000000000062a5 <+725>: vmovaps ZMMWORD PTR [rsp+0x440],zmm6 0x00000000000062ad <+733>: vmovaps ZMMWORD PTR [rsp+0x280],zmm8 0x00000000000062b5 <+741>: vmovaps ZMMWORD PTR [rsp+0x2c0],zmm15 0x00000000000062bd <+749>: vmovaps ZMMWORD PTR [rsp+0x480],zmm9 0x00000000000062c5 <+757>: vmovaps ZMMWORD PTR [rsp+0x540],zmm11 0x00000000000062cd <+765>: vmovaps ZMMWORD PTR [rsp+0x240],zmm0 0x00000000000062d5 <+773>: vmovaps ZMMWORD PTR [rsp+0x380],zmm2 0x00000000000062dd <+781>: vmovaps ZMMWORD PTR [rsp+0x300],zmm12 0x00000000000062e5 <+789>: vmovaps ZMMWORD PTR [rsp+0x400],zmm5 0x00000000000062ed <+797>: vmovaps ZMMWORD PTR [rsp+0x340],zmm3 0x00000000000062f5 <+805>: mov edi,0x80 0x00000000000062fa <+810>: vzeroupper 0x00000000000062fd <+813>: call 0xc5f0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006302 <+818>: mov rbx,rax 0x0000000000006305 <+821>: test rax,rax 0x0000000000006308 <+824>: jle 0x631f <main+847> 0x000000000000630a <+826>: mov edi,0x1 0x000000000000630f <+831>: mov rsi,rbx 0x0000000000006312 <+834>: call 0x31b40 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006317 <+839>: mov r14,rax 0x000000000000631a <+842>: mov r15,rbx 0x000000000000631d <+845>: jmp 0x6325 <main+853> 0x000000000000631f <+847>: xor r14d,r14d 0x0000000000006322 <+850>: xor r15d,r15d 0x0000000000006325 <+853>: lea rdx,[rip+0x5d294] # 0x635c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000632c <+860>: mov ecx,0x80 0x0000000000006331 <+865>: mov rdi,r14 0x0000000000006334 <+868>: mov rsi,rbx 0x0000000000006337 <+871>: xor eax,eax 0x0000000000006339 <+873>: call 0x57c0 <snprintf@plt> 0x000000000000633e <+878>: cdqe 0x0000000000006340 <+880>: inc rax 0x0000000000006343 <+883>: mov QWORD PTR [rsp+0x6f0],r14 0x000000000000634b <+891>: mov QWORD PTR [rsp+0x6f8],rax 0x0000000000006353 <+899>: mov QWORD PTR [rsp+0x700],r15 0x000000000000635b <+907>: lea rdx,[rip+0x5d26e] # 0x635d0 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000006362 <+914>: lea rdi,[rsp+0xb80] 0x000000000000636a <+922>: lea rsi,[rsp+0x6f0] 0x0000000000006372 <+930>: mov ecx,0x7 0x0000000000006377 <+935>: call 0x11c40 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x000000000000637c <+940>: mov rdi,QWORD PTR [rsp+0x6f0] 0x0000000000006384 <+948>: test rdi,rdi 0x0000000000006387 <+951>: je 0x638e <main+958> 0x0000000000006389 <+953>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000638e <+958>: mov edi,0x1 0x0000000000006393 <+963>: mov esi,0x3 0x0000000000006398 <+968>: call 0x31b40 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000639d <+973>: xor ecx,ecx 0x000000000000639f <+975>: nop 0x00000000000063a0 <+976>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000063a4 <+980>: inc rcx 0x00000000000063a7 <+983>: cmp rcx,0x3 0x00000000000063ab <+987>: jne 0x63a0 <main+976> 0x00000000000063ad <+989>: mov WORD PTR [rax],0x203a 0x00000000000063b2 <+994>: mov BYTE PTR [rax+0x2],0x0 0x00000000000063b6 <+998>: mov QWORD PTR [rsp+0x708],rax 0x00000000000063be <+1006>: mov QWORD PTR [rsp+0x710],0x3 0x00000000000063ca <+1018>: mov QWORD PTR [rsp+0x718],0x3 0x00000000000063d6 <+1030>: lea rdi,[rsp+0xb98] 0x00000000000063de <+1038>: lea rsi,[rsp+0xb80] 0x00000000000063e6 <+1046>: lea rdx,[rsp+0x708] 0x00000000000063ee <+1054>: call 0x11800 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000063f3 <+1059>: mov rdi,QWORD PTR [rsp+0x708] 0x00000000000063fb <+1067>: test rdi,rdi 0x00000000000063fe <+1070>: je 0x6405 <main+1077> 0x0000000000006400 <+1072>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006405 <+1077>: mov rdi,QWORD PTR [rsp+0xb80] 0x000000000000640d <+1085>: test rdi,rdi 0x0000000000006410 <+1088>: je 0x6417 <main+1095> 0x0000000000006412 <+1090>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006417 <+1095>: vmovaps zmm0,ZMMWORD PTR [rsp+0x280] 0x000000000000641f <+1103>: vmovaps ZMMWORD PTR [rsp],zmm0 0x0000000000006426 <+1110>: vmovaps zmm0,ZMMWORD PTR [rsp+0x4c0] 0x000000000000642e <+1118>: vmovaps ZMMWORD PTR [rsp+0x40],zmm0 0x0000000000006436 <+1126>: vmovaps zmm0,ZMMWORD PTR [rsp+0x440] 0x000000000000643e <+1134>: vmovaps ZMMWORD PTR [rsp+0x80],zmm0 0x0000000000006446 <+1142>: vmovaps zmm0,ZMMWORD PTR [rsp+0x400] 0x000000000000644e <+1150>: vmovaps ZMMWORD PTR [rsp+0xc0],zmm0 0x0000000000006456 <+1158>: vmovaps zmm0,ZMMWORD PTR [rsp+0x340] 0x000000000000645e <+1166>: vmovaps ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000006466 <+1174>: vmovaps zmm0,ZMMWORD PTR [rsp+0x380] 0x000000000000646e <+1182>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000006476 <+1190>: vmovaps zmm0,ZMMWORD PTR [rsp+0x500] 0x000000000000647e <+1198>: vmovaps ZMMWORD PTR [rsp+0x180],zmm0 0x0000000000006486 <+1206>: vmovaps zmm0,ZMMWORD PTR [rsp+0x240] 0x000000000000648e <+1214>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000006496 <+1222>: lea rbx,[rsp+0xdd0] 0x000000000000649e <+1230>: mov rdi,rbx 0x00000000000064a1 <+1233>: vmovaps zmm0,ZMMWORD PTR [rsp+0x3c0] 0x00000000000064a9 <+1241>: vmovaps zmm1,ZMMWORD PTR [rsp+0x5c0] 0x00000000000064b1 <+1249>: vmovaps zmm2,ZMMWORD PTR [rsp+0x840] 0x00000000000064b9 <+1257>: vmovaps zmm3,ZMMWORD PTR [rsp+0x2c0] 0x00000000000064c1 <+1265>: vmovaps zmm4,ZMMWORD PTR [rsp+0x300] 0x00000000000064c9 <+1273>: vmovaps zmm5,ZMMWORD PTR [rsp+0x540] 0x00000000000064d1 <+1281>: vmovaps zmm6,ZMMWORD PTR [rsp+0x640] 0x00000000000064d9 <+1289>: vmovaps zmm7,ZMMWORD PTR [rsp+0x480] 0x00000000000064e1 <+1297>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=128> 0x00000000000064e6 <+1302>: lea rdi,[rsp+0xbb0] 0x00000000000064ee <+1310>: lea rsi,[rsp+0xb98] 0x00000000000064f6 <+1318>: mov rdx,rbx 0x00000000000064f9 <+1321>: vzeroupper 0x00000000000064fc <+1324>: call 0x11800 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006501 <+1329>: mov rdi,QWORD PTR [rsp+0xdd0] 0x0000000000006509 <+1337>: test rdi,rdi 0x000000000000650c <+1340>: je 0x6513 <main+1347> 0x000000000000650e <+1342>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006513 <+1347>: mov rdi,QWORD PTR [rsp+0xb98] 0x000000000000651b <+1355>: test rdi,rdi 0x000000000000651e <+1358>: je 0x6525 <main+1365> 0x0000000000006520 <+1360>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006525 <+1365>: lea rdi,[rsp+0xbb0] 0x000000000000652d <+1373>: call 0xd0a0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006532 <+1378>: mov rdi,QWORD PTR [rsp+0xbb0] 0x000000000000653a <+1386>: test rdi,rdi 0x000000000000653d <+1389>: je 0x6544 <main+1396> 0x000000000000653f <+1391>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006544 <+1396>: vxorps xmm0,xmm0,xmm0 0x0000000000006548 <+1400>: vmovaps XMMWORD PTR [rsp+0x6b0],xmm0 0x0000000000006551 <+1409>: lea rsi,[rsp+0x6b0] 0x0000000000006559 <+1417>: mov edi,0x1 0x000000000000655e <+1422>: call 0x5470 <clock_gettime@plt> 0x0000000000006563 <+1427>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x500] 0x000000000000656b <+1435>: vpxor xmm0,xmm0,xmm0 0x000000000000656f <+1439>: vpermq zmm0,zmm5,0x4e 0x0000000000006576 <+1446>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x4c0] 0x000000000000657e <+1454>: vpxor xmm1,xmm1,xmm1 0x0000000000006582 <+1458>: vpermq zmm1,zmm9,0x4e 0x0000000000006589 <+1465>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x640] 0x0000000000006591 <+1473>: vpxor xmm2,xmm2,xmm2 0x0000000000006595 <+1477>: vpermq zmm2,zmm11,0x4e 0x000000000000659c <+1484>: vmovdqa64 zmm14,ZMMWORD PTR [rsp+0x5c0] 0x00000000000065a4 <+1492>: vpxor xmm6,xmm6,xmm6 0x00000000000065a8 <+1496>: vpermq zmm6,zmm14,0x4e 0x00000000000065af <+1503>: vmovdqa64 zmm16,ZMMWORD PTR [rsp+0x840] 0x00000000000065b7 <+1511>: vpxor xmm7,xmm7,xmm7 0x00000000000065bb <+1515>: vpermq zmm7,zmm16,0x4e 0x00000000000065c2 <+1522>: vmovdqa64 zmm20,ZMMWORD PTR [rsp+0x3c0] 0x00000000000065ca <+1530>: vpermq zmm8,zmm20,0x4e 0x00000000000065d1 <+1537>: vmovdqa64 zmm21,ZMMWORD PTR [rsp+0x440] 0x00000000000065d9 <+1545>: vpermq zmm13,zmm21,0x4e 0x00000000000065e0 <+1552>: vmovdqa64 zmm12,ZMMWORD PTR [rsp+0x280] 0x00000000000065e8 <+1560>: vpermq zmm15,zmm12,0x4e 0x00000000000065ef <+1567>: vmovdqa64 zmm29,ZMMWORD PTR [rsp+0x240] 0x00000000000065f7 <+1575>: vpermq zmm17,zmm29,0x4e 0x00000000000065fe <+1582>: vmovdqa64 zmm28,ZMMWORD PTR [rsp+0x380] 0x0000000000006606 <+1590>: vpermq zmm18,zmm28,0x4e 0x000000000000660d <+1597>: vmovdqa64 zmm31,ZMMWORD PTR [rsp+0x480] 0x0000000000006615 <+1605>: vpermq zmm19,zmm31,0x4e 0x000000000000661c <+1612>: vmovdqa64 zmm30,ZMMWORD PTR [rsp+0x540] 0x0000000000006624 <+1620>: vpxor xmm3,xmm3,xmm3 0x0000000000006628 <+1624>: vpermq zmm3,zmm30,0x4e 0x000000000000662f <+1631>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm3 0x0000000000006637 <+1639>: vmovdqa64 zmm26,ZMMWORD PTR [rsp+0x400] 0x000000000000663f <+1647>: vpxor xmm3,xmm3,xmm3 0x0000000000006643 <+1651>: vpermq zmm3,zmm26,0x4e 0x000000000000664a <+1658>: vmovdqa64 ZMMWORD PTR [rsp+0xf80],zmm3 0x0000000000006652 <+1666>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x2c0] 0x000000000000665a <+1674>: vpxor xmm3,xmm3,xmm3 0x000000000000665e <+1678>: vpermq zmm3,zmm10,0x4e 0x0000000000006665 <+1685>: vpminsq zmm4,zmm5,zmm0 0x000000000000666b <+1691>: mov al,0xcc 0x000000000000666d <+1693>: kmovd k1,eax 0x0000000000006671 <+1697>: kmovw WORD PTR [rsp+0xf40],k1 0x000000000000667a <+1706>: vpmaxsq zmm4{k1},zmm5,zmm0 0x0000000000006680 <+1712>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm4 0x0000000000006688 <+1720>: vmovdqa64 zmm25,ZMMWORD PTR [rsp+0x340] 0x0000000000006690 <+1728>: vpermq zmm23,zmm25,0x4e 0x0000000000006697 <+1735>: vpminsq zmm22,zmm9,zmm1 0x000000000000669d <+1741>: vpmaxsq zmm22{k1},zmm9,zmm1 0x00000000000066a3 <+1747>: vmovdqa64 zmm27,ZMMWORD PTR [rsp+0x300] 0x00000000000066ab <+1755>: vpermq zmm24,zmm27,0x4e 0x00000000000066b2 <+1762>: vpminsq zmm9,zmm11,zmm2 0x00000000000066b8 <+1768>: vpmaxsq zmm9{k1},zmm11,zmm2 0x00000000000066be <+1774>: vpminsq zmm4,zmm27,zmm24 0x00000000000066c4 <+1780>: vpminsq zmm11,zmm14,zmm6 0x00000000000066ca <+1786>: vpmaxsq zmm11{k1},zmm14,zmm6 0x00000000000066d0 <+1792>: vpminsq zmm5,zmm25,zmm23 0x00000000000066d6 <+1798>: vpminsq zmm14,zmm16,zmm7 0x00000000000066dc <+1804>: vpmaxsq zmm14{k1},zmm16,zmm7 0x00000000000066e2 <+1810>: vpminsq zmm2,zmm10,zmm3 0x00000000000066e8 <+1816>: vpminsq zmm16,zmm20,zmm8 0x00000000000066ee <+1822>: vpmaxsq zmm16{k1},zmm20,zmm8 0x00000000000066f4 <+1828>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xf80] 0x00000000000066fc <+1836>: vpminsq zmm6,zmm26,zmm1 0x0000000000006702 <+1842>: vpminsq zmm20,zmm21,zmm13 0x0000000000006708 <+1848>: vpmaxsq zmm20{k1},zmm21,zmm13 0x000000000000670e <+1854>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x580] 0x0000000000006716 <+1862>: vpminsq zmm13,zmm30,zmm0 0x000000000000671c <+1868>: vpminsq zmm21,zmm12,zmm15 0x0000000000006722 <+1874>: vpmaxsq zmm21{k1},zmm12,zmm15 0x0000000000006728 <+1880>: vpminsq zmm8,zmm31,zmm19 0x000000000000672e <+1886>: vpminsq zmm12,zmm29,zmm17 0x0000000000006734 <+1892>: vpmaxsq zmm12{k1},zmm29,zmm17 0x000000000000673a <+1898>: vpminsq zmm7,zmm28,zmm18 0x0000000000006740 <+1904>: vpmaxsq zmm7{k1},zmm28,zmm18 0x0000000000006746 <+1910>: vpmaxsq zmm8{k1},zmm31,zmm19 0x000000000000674c <+1916>: vpmaxsq zmm13{k1},zmm30,zmm0 0x0000000000006752 <+1922>: vpmaxsq zmm6{k1},zmm26,zmm1 0x0000000000006758 <+1928>: vpmaxsq zmm2{k1},zmm10,zmm3 0x000000000000675e <+1934>: vpmaxsq zmm5{k1},zmm25,zmm23 0x0000000000006764 <+1940>: vpmaxsq zmm4{k1},zmm27,zmm24 0x000000000000676a <+1946>: vpshufd zmm10,zmm4,0x4e 0x0000000000006771 <+1953>: vpshufd zmm15,zmm5,0x4e 0x0000000000006778 <+1960>: vpshufd zmm17,zmm2,0x4e 0x000000000000677f <+1967>: vpshufd zmm18,zmm6,0x4e 0x0000000000006786 <+1974>: vpshufd zmm23,zmm13,0x4e 0x000000000000678d <+1981>: vpshufd zmm25,zmm8,0x4e 0x0000000000006794 <+1988>: vpshufd zmm26,zmm7,0x4e 0x000000000000679b <+1995>: vpshufd zmm27,zmm12,0x4e 0x00000000000067a2 <+2002>: vpshufd zmm28,zmm21,0x4e 0x00000000000067a9 <+2009>: vpshufd zmm29,zmm20,0x4e 0x00000000000067b0 <+2016>: vpshufd zmm30,zmm16,0x4e 0x00000000000067b7 <+2023>: vpshufd zmm31,zmm14,0x4e 0x00000000000067be <+2030>: vpshufd zmm24,zmm11,0x4e 0x00000000000067c5 <+2037>: vpshufd zmm0,zmm9,0x4e 0x00000000000067cc <+2044>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm0 0x00000000000067d4 <+2052>: vpminsq zmm3,zmm4,zmm10 0x00000000000067da <+2058>: mov al,0xaa 0x00000000000067dc <+2060>: kmovd k1,eax 0x00000000000067e0 <+2064>: kmovw WORD PTR [rsp+0xf80],k1 0x00000000000067e9 <+2073>: vpmaxsq zmm3{k1},zmm4,zmm10 0x00000000000067ef <+2079>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm3 0x00000000000067f7 <+2087>: vpshufd zmm3,zmm22,0x4e 0x00000000000067fe <+2094>: vpminsq zmm0,zmm5,zmm15 0x0000000000006804 <+2100>: vpmaxsq zmm0{k1},zmm5,zmm15 0x000000000000680a <+2106>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm0 0x0000000000006812 <+2114>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x500] 0x000000000000681a <+2122>: vpshufd zmm0,zmm4,0x4e 0x0000000000006821 <+2129>: vpminsq zmm1,zmm2,zmm17 0x0000000000006827 <+2135>: vpmaxsq zmm1{k1},zmm2,zmm17 0x000000000000682d <+2141>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm1 0x0000000000006835 <+2149>: vpminsq zmm19,zmm4,zmm0 0x000000000000683b <+2155>: vpminsq zmm1,zmm6,zmm18 0x0000000000006841 <+2161>: vpmaxsq zmm1{k1},zmm6,zmm18 0x0000000000006847 <+2167>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm1 0x000000000000684f <+2175>: vpminsq zmm6,zmm22,zmm3 0x0000000000006855 <+2181>: vpminsq zmm10,zmm13,zmm23 0x000000000000685b <+2187>: vpmaxsq zmm10{k1},zmm13,zmm23 0x0000000000006861 <+2193>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x340] 0x0000000000006869 <+2201>: vpminsq zmm13,zmm9,zmm1 0x000000000000686f <+2207>: vpminsq zmm18,zmm8,zmm25 0x0000000000006875 <+2213>: vpmaxsq zmm18{k1},zmm8,zmm25 0x000000000000687b <+2219>: vpminsq zmm23,zmm11,zmm24 0x0000000000006881 <+2225>: vpminsq zmm15,zmm7,zmm26 0x0000000000006887 <+2231>: vpmaxsq zmm15{k1},zmm7,zmm26 0x000000000000688d <+2237>: vpminsq zmm8,zmm14,zmm31 0x0000000000006893 <+2243>: vpminsq zmm7,zmm12,zmm27 0x0000000000006899 <+2249>: vpmaxsq zmm7{k1},zmm12,zmm27 0x000000000000689f <+2255>: vpminsq zmm12,zmm16,zmm30 0x00000000000068a5 <+2261>: vpminsq zmm17,zmm21,zmm28 0x00000000000068ab <+2267>: vpmaxsq zmm17{k1},zmm21,zmm28 0x00000000000068b1 <+2273>: vpminsq zmm21,zmm20,zmm29 0x00000000000068b7 <+2279>: vpmaxsq zmm21{k1},zmm20,zmm29 0x00000000000068bd <+2285>: vpmaxsq zmm12{k1},zmm16,zmm30 0x00000000000068c3 <+2291>: vpmaxsq zmm8{k1},zmm14,zmm31 0x00000000000068c9 <+2297>: vpmaxsq zmm23{k1},zmm11,zmm24 0x00000000000068cf <+2303>: vpmaxsq zmm13{k1},zmm9,zmm1 0x00000000000068d5 <+2309>: vpmaxsq zmm6{k1},zmm22,zmm3 0x00000000000068db <+2315>: vpmaxsq zmm19{k1},zmm4,zmm0 0x00000000000068e1 <+2321>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x5a715] # 0x61000 0x00000000000068eb <+2331>: vmovdqa64 zmm14,zmm6 0x00000000000068f1 <+2337>: vpermt2q zmm14,zmm9,zmm19 0x00000000000068f7 <+2343>: vpermi2q zmm9,zmm23,zmm13 0x00000000000068fd <+2349>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x5a739] # 0x61040 0x0000000000006907 <+2359>: vmovdqa64 zmm20,zmm12 0x000000000000690d <+2365>: vpermt2q zmm20,zmm25,zmm8 0x0000000000006913 <+2371>: vmovdqa64 zmm11,zmm17 0x0000000000006919 <+2377>: vpermt2q zmm11,zmm25,zmm21 0x000000000000691f <+2383>: vmovdqa64 zmm24,zmm15 0x0000000000006925 <+2389>: vpermt2q zmm24,zmm25,zmm7 0x000000000000692b <+2395>: vpermi2q zmm25,zmm10,zmm18 0x0000000000006931 <+2401>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x5a745] # 0x61080 0x000000000000693b <+2411>: vpminsq zmm0,zmm23,zmm9 0x0000000000006941 <+2417>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x0000000000006949 <+2425>: mov al,0x44 0x000000000000694b <+2427>: kmovd k2,eax 0x000000000000694f <+2431>: vpmaxsq zmm0{k2},zmm23,zmm9 0x0000000000006955 <+2437>: vmovdqa64 zmm28,zmm0 0x000000000000695b <+2443>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm0 0x0000000000006963 <+2451>: vmovdqa64 zmm26,zmm23 0x0000000000006969 <+2457>: vpermt2q zmm26,zmm22,zmm13 0x000000000000696f <+2463>: vpermi2q zmm22,zmm6,zmm19 0x0000000000006975 <+2469>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a741] # 0x610c0 0x000000000000697f <+2479>: vpminsq zmm16,zmm10,zmm25 0x0000000000006985 <+2485>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm16 0x000000000000698d <+2493>: vpmaxsq zmm16{k2},zmm10,zmm25 0x0000000000006993 <+2499>: vmovdqa64 zmm3,zmm10 0x0000000000006999 <+2505>: vpermt2q zmm3,zmm0,zmm18 0x000000000000699f <+2511>: vpminsq zmm1,zmm15,zmm24 0x00000000000069a5 <+2517>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm1 0x00000000000069ad <+2525>: vpmaxsq zmm1{k2},zmm15,zmm24 0x00000000000069b3 <+2531>: vmovdqa64 ZMMWORD PTR [rsp+0x9c0],zmm1 0x00000000000069bb <+2539>: vmovdqa64 zmm24,zmm15 0x00000000000069c1 <+2545>: vpermt2q zmm24,zmm0,zmm7 0x00000000000069c7 <+2551>: vpminsq zmm15,zmm17,zmm11 0x00000000000069cd <+2557>: vmovdqa64 ZMMWORD PTR [rsp+0x5c0],zmm15 0x00000000000069d5 <+2565>: vpmaxsq zmm15{k2},zmm17,zmm11 0x00000000000069db <+2571>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm15 0x00000000000069e3 <+2579>: vmovdqa64 zmm23,zmm17 0x00000000000069e9 <+2585>: vpermt2q zmm23,zmm0,zmm21 0x00000000000069ef <+2591>: vpermi2q zmm0,zmm12,zmm8 0x00000000000069f5 <+2597>: vpmaxsq zmm10,zmm8,zmm0 0x00000000000069fb <+2603>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm10 0x0000000000006a03 <+2611>: mov al,0x22 0x0000000000006a05 <+2613>: kmovd k1,eax 0x0000000000006a09 <+2617>: vpminsq zmm10{k1},zmm8,zmm0 0x0000000000006a0f <+2623>: vpmaxsq zmm27,zmm21,zmm23 0x0000000000006a15 <+2629>: vmovdqa64 zmm11,zmm27 0x0000000000006a1b <+2635>: vpminsq zmm11{k1},zmm21,zmm23 0x0000000000006a21 <+2641>: vpmaxsq zmm23,zmm7,zmm24 0x0000000000006a27 <+2647>: vmovdqa64 zmm0,zmm23 0x0000000000006a2d <+2653>: vpminsq zmm0{k1},zmm7,zmm24 0x0000000000006a33 <+2659>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x0000000000006a3b <+2667>: vpmaxsq zmm31,zmm18,zmm3 0x0000000000006a41 <+2673>: vmovdqa64 zmm17,zmm31 0x0000000000006a47 <+2679>: vpminsq zmm17{k1},zmm18,zmm3 0x0000000000006a4d <+2685>: vpmaxsq zmm0,zmm19,zmm22 0x0000000000006a53 <+2691>: vmovdqa64 zmm18,zmm0 0x0000000000006a59 <+2697>: vpminsq zmm18{k1},zmm19,zmm22 0x0000000000006a5f <+2703>: vpmaxsq zmm24,zmm13,zmm26 0x0000000000006a65 <+2709>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x5a791] # 0x61200 0x0000000000006a6f <+2719>: vmovdqa64 zmm21,zmm16 0x0000000000006a75 <+2725>: vpermt2q zmm21,zmm22,zmm24 0x0000000000006a7b <+2731>: vpminsq zmm24{k1},zmm13,zmm26 0x0000000000006a81 <+2737>: vpminsq zmm3,zmm6,zmm14 0x0000000000006a87 <+2743>: vshufi64x2 zmm13,zmm3,zmm27,0x4e 0x0000000000006a8e <+2750>: vpermi2q zmm22,zmm1,zmm0 0x0000000000006a94 <+2756>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a7a2] # 0x61240 0x0000000000006a9e <+2766>: vpermt2q zmm22,zmm0,zmm27 0x0000000000006aa4 <+2772>: vmovdqa64 zmm0,zmm3 0x0000000000006aaa <+2778>: kmovw WORD PTR [rsp+0x840],k2 0x0000000000006ab3 <+2787>: vpmaxsq zmm0{k2},zmm6,zmm14 0x0000000000006ab9 <+2793>: vmovdqa64 zmm19,zmm0 0x0000000000006abf <+2799>: vmovdqa64 ZMMWORD PTR [rsp+0x880],zmm0 0x0000000000006ac7 <+2807>: vpminsq zmm26,zmm12,zmm20 0x0000000000006acd <+2813>: vmovdqa64 zmm6,zmm26 0x0000000000006ad3 <+2819>: vpmaxsq zmm6{k2},zmm12,zmm20 0x0000000000006ad9 <+2825>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x5a79d] # 0x61280 0x0000000000006ae3 <+2835>: vmovdqa64 zmm0,zmm11 0x0000000000006ae9 <+2841>: vpermt2q zmm0,zmm12,zmm3 0x0000000000006aef <+2847>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm0 0x0000000000006af7 <+2855>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5a5ff] # 0x61100 0x0000000000006b01 <+2865>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x540] 0x0000000000006b09 <+2873>: vpermq zmm30,zmm3,zmm9 0x0000000000006b0f <+2879>: vpmaxsq zmm29,zmm9,zmm30 0x0000000000006b15 <+2885>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a661] # 0x61180 0x0000000000006b1f <+2895>: vmovdqa64 zmm20,zmm6 0x0000000000006b25 <+2901>: vpermt2q zmm20,zmm0,zmm29 0x0000000000006b2b <+2907>: vmovdqa64 zmm7,zmm0 0x0000000000006b31 <+2913>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a685] # 0x611c0 0x0000000000006b3b <+2923>: vpermt2q zmm20,zmm0,zmm31 0x0000000000006b41 <+2929>: mov al,0x99 0x0000000000006b43 <+2931>: kmovd k5,eax 0x0000000000006b47 <+2935>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x380] 0x0000000000006b4f <+2943>: vpermq zmm25,zmm3,zmm1 0x0000000000006b55 <+2949>: vpmaxsq zmm5,zmm1,zmm25 0x0000000000006b5b <+2955>: vshufi64x2 zmm28{k5},zmm5,zmm31,0xee 0x0000000000006b62 <+2962>: vmovdqa64 zmm8,ZMMWORD PTR [rsp+0x240] 0x0000000000006b6a <+2970>: vpermq zmm2,zmm3,zmm8 0x0000000000006b70 <+2976>: vpmaxsq zmm4,zmm8,zmm2 0x0000000000006b76 <+2982>: vmovdqa64 zmm27,zmm15 0x0000000000006b7c <+2988>: vpermt2q zmm27,zmm7,zmm4 0x0000000000006b82 <+2994>: vpermt2q zmm27,zmm0,zmm23 0x0000000000006b88 <+3000>: vmovdqa64 zmm7,ZMMWORD PTR [rsp+0x400] 0x0000000000006b90 <+3008>: vpxor xmm0,xmm0,xmm0 0x0000000000006b94 <+3012>: vpermq zmm0,zmm3,zmm7 0x0000000000006b9a <+3018>: vpmaxsq zmm15,zmm7,zmm0 0x0000000000006ba0 <+3024>: vmovdqa64 zmm14,zmm7 0x0000000000006ba6 <+3030>: vmovdqa64 zmm31,zmm19 0x0000000000006bac <+3036>: vshufi64x2 zmm31{k5},zmm15,zmm23,0xee 0x0000000000006bb3 <+3043>: vpminsq zmm3,zmm1,zmm25 0x0000000000006bb9 <+3049>: vshufi64x2 zmm23,zmm26,zmm3,0x4e 0x0000000000006bc0 <+3056>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x5a576] # 0x61140 0x0000000000006bca <+3066>: vpermt2q zmm23,zmm19,zmm17 0x0000000000006bd0 <+3072>: vpminsq zmm7,zmm16,zmm23 0x0000000000006bd6 <+3078>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm7 0x0000000000006bde <+3086>: vpmaxsq zmm23,zmm16,zmm23 0x0000000000006be4 <+3092>: vpminsq zmm0,zmm14,zmm0 0x0000000000006bea <+3098>: vpminsq zmm16,zmm9,zmm30 0x0000000000006bf0 <+3104>: vpminsq zmm1,zmm8,zmm2 0x0000000000006bf6 <+3110>: vinserti64x4 zmm30,zmm26,ymm16,0x1 0x0000000000006bfd <+3117>: mov al,0xd4 0x0000000000006bff <+3119>: kmovd k1,eax 0x0000000000006c03 <+3123>: vpblendmq zmm29{k1},zmm16,zmm29 0x0000000000006c09 <+3129>: vpblendmq zmm4{k1},zmm1,zmm4 0x0000000000006c0f <+3135>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x5c0] 0x0000000000006c17 <+3143>: vinserti64x4 zmm8,zmm2,ymm1,0x1 0x0000000000006c1e <+3150>: vshufi64x2 zmm14,zmm2,zmm0,0x4e 0x0000000000006c25 <+3157>: vpblendmq zmm2{k1},zmm0,zmm15 0x0000000000006c2b <+3163>: vmovdqa64 zmm3{k1},zmm5 0x0000000000006c31 <+3169>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a605] # 0x61240 0x0000000000006c3b <+3179>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x4c0] 0x0000000000006c43 <+3187>: vpermt2q zmm21,zmm0,zmm5 0x0000000000006c49 <+3193>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x2c0] 0x0000000000006c51 <+3201>: vshufi64x2 zmm0,zmm1,zmm5,0x4e 0x0000000000006c58 <+3208>: vpermi2q zmm12,zmm10,zmm1 0x0000000000006c5e <+3214>: vmovdqa64 zmm15,zmm3 0x0000000000006c64 <+3220>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5a512] # 0x61180 0x0000000000006c6e <+3230>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm1 0x0000000000006c76 <+3238>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x3c0] 0x0000000000006c7e <+3246>: vpermt2q zmm15,zmm1,zmm5 0x0000000000006c84 <+3252>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x5a532] # 0x611c0 0x0000000000006c8e <+3262>: vpermt2q zmm12,zmm9,zmm5 0x0000000000006c94 <+3268>: vpermt2q zmm13,zmm19,zmm4 0x0000000000006c9a <+3274>: vpminsq zmm5,zmm4,zmm13 0x0000000000006ca0 <+3280>: vmovdqa64 ZMMWORD PTR [rsp+0xa80],zmm5 0x0000000000006ca8 <+3288>: vpmaxsq zmm26,zmm4,zmm13 0x0000000000006cae <+3294>: mov al,0x66 0x0000000000006cb0 <+3296>: kmovd k6,eax 0x0000000000006cb4 <+3300>: vmovdqa64 zmm8{k6},zmm18 0x0000000000006cba <+3306>: vmovdqa64 ZMMWORD PTR [rsp+0xa00],zmm8 0x0000000000006cc2 <+3314>: vmovdqa64 zmm25,zmm2 0x0000000000006cc8 <+3320>: vmovdqa64 zmm13,zmm2 0x0000000000006cce <+3326>: vpermt2q zmm25,zmm1,ZMMWORD PTR [rsp+0x300] 0x0000000000006cd6 <+3334>: vpermt2q zmm25,zmm9,zmm18 0x0000000000006cdc <+3340>: vpminsq zmm1,zmm18,zmm31 0x0000000000006ce2 <+3346>: vmovdqa64 ZMMWORD PTR [rsp+0xa40],zmm1 0x0000000000006cea <+3354>: vpmaxsq zmm18,zmm18,zmm31 0x0000000000006cf0 <+3360>: vmovdqa64 zmm30{k6},zmm24 0x0000000000006cf6 <+3366>: vpermt2q zmm15,zmm9,zmm24 0x0000000000006cfc <+3372>: vmovdqa64 zmm31,zmm9 0x0000000000006d02 <+3378>: vpminsq zmm5,zmm24,zmm28 0x0000000000006d08 <+3384>: vpmaxsq zmm24,zmm24,zmm28 0x0000000000006d0e <+3390>: vpermt2q zmm0,zmm19,zmm29 0x0000000000006d14 <+3396>: vpminsq zmm28,zmm29,zmm0 0x0000000000006d1a <+3402>: vmovdqa64 ZMMWORD PTR [rsp+0xb00],zmm28 0x0000000000006d22 <+3410>: vpmaxsq zmm0,zmm29,zmm0 0x0000000000006d28 <+3416>: vpminsq zmm4,zmm6,zmm12 0x0000000000006d2e <+3422>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm4 0x0000000000006d36 <+3430>: vpminsq zmm12,zmm10,zmm20 0x0000000000006d3c <+3436>: vpmaxsq zmm1,zmm10,zmm20 0x0000000000006d42 <+3442>: vpminsq zmm20,zmm11,zmm27 0x0000000000006d48 <+3448>: vmovdqa64 ZMMWORD PTR [rsp+0x8c0],zmm20 0x0000000000006d50 <+3456>: vpmaxsq zmm16,zmm11,zmm27 0x0000000000006d56 <+3462>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x280] 0x0000000000006d5e <+3470>: vpermt2q zmm14,zmm19,zmm2 0x0000000000006d64 <+3476>: vpmaxsq zmm19,zmm2,zmm22 0x0000000000006d6a <+3482>: vpmaxsq zmm2,zmm17,zmm21 0x0000000000006d70 <+3488>: vpminsq zmm6,zmm3,zmm15 0x0000000000006d76 <+3494>: vpmaxsq zmm11,zmm3,zmm15 0x0000000000006d7c <+3500>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm11 0x0000000000006d84 <+3508>: vmovdqa64 zmm3,ZMMWORD PTR [rsp+0x580] 0x0000000000006d8c <+3516>: vpminsq zmm9,zmm3,zmm30 0x0000000000006d92 <+3522>: vmovdqa64 ZMMWORD PTR [rsp+0xb40],zmm9 0x0000000000006d9a <+3530>: vpmaxsq zmm3,zmm3,zmm30 0x0000000000006da0 <+3536>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm3 0x0000000000006da8 <+3544>: mov al,0x9 0x0000000000006daa <+3546>: kmovd k7,eax 0x0000000000006dae <+3550>: vshufi64x2 zmm3,zmm4,zmm3,0x4e 0x0000000000006db5 <+3557>: vmovdqa64 zmm3{k7},zmm0 0x0000000000006dbb <+3563>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5a4fb] # 0x612c0 0x0000000000006dc5 <+3573>: vmovdqa64 ZMMWORD PTR [rsp+0x800],zmm6 0x0000000000006dcd <+3581>: vpermt2q zmm3,zmm4,zmm6 0x0000000000006dd3 <+3587>: vmovdqa64 ZMMWORD PTR [rsp+0x940],zmm23 0x0000000000006ddb <+3595>: vpblendmq zmm4{k5},zmm7,zmm23 0x0000000000006de1 <+3601>: vpmaxsq zmm17,zmm4,zmm3 0x0000000000006de7 <+3607>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm17 0x0000000000006def <+3615>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5a507] # 0x61300 0x0000000000006df9 <+3625>: vshufi64x2 zmm3,zmm5,zmm6,0xee 0x0000000000006e00 <+3632>: vpermt2q zmm3,zmm4,zmm2 0x0000000000006e06 <+3638>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5a530] # 0x61340 0x0000000000006e10 <+3648>: vpermt2q zmm3,zmm4,zmm0 0x0000000000006e16 <+3654>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm12 0x0000000000006e1e <+3662>: vpblendmq zmm4{k6},zmm12,zmm1 0x0000000000006e24 <+3668>: vpminsq zmm8,zmm4,zmm3 0x0000000000006e2a <+3674>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm8 0x0000000000006e32 <+3682>: mov al,0x90 0x0000000000006e34 <+3684>: kmovd k2,eax 0x0000000000006e38 <+3688>: vmovdqa64 ZMMWORD PTR [rsp+0x980],zmm24 0x0000000000006e40 <+3696>: vpblendmq zmm3{k2},zmm24,zmm5 0x0000000000006e46 <+3702>: mov al,0x69 0x0000000000006e48 <+3704>: kmovd k1,eax 0x0000000000006e4c <+3708>: vshufi64x2 zmm4,zmm11,zmm12,0x4e 0x0000000000006e53 <+3715>: vmovdqa64 zmm4{k1},zmm2 0x0000000000006e59 <+3721>: kmovw WORD PTR [rsp+0x4c0],k1 0x0000000000006e62 <+3730>: vpminsq zmm22,zmm3,zmm4 0x0000000000006e68 <+3736>: vpmaxsq zmm10,zmm3,zmm4 0x0000000000006e6e <+3742>: vshufi64x2 zmm3,zmm1,zmm0,0xee 0x0000000000006e75 <+3749>: vmovdqa64 zmm3{k1},zmm24 0x0000000000006e7b <+3755>: vshufi64x2 zmm1,zmm9,zmm1,0x4e 0x0000000000006e82 <+3762>: vshufi64x2 zmm1{k5},zmm23,zmm2,0xe4 0x0000000000006e89 <+3769>: vpmaxsq zmm6,zmm2,zmm3 0x0000000000006e8f <+3775>: mov al,0x6 0x0000000000006e91 <+3777>: kmovd k4,eax 0x0000000000006e95 <+3781>: vpblendmq zmm0{k4},zmm0,zmm28 0x0000000000006e9b <+3787>: vpminsq zmm4,zmm0,zmm1 0x0000000000006ea1 <+3793>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm4 0x0000000000006ea9 <+3801>: vpmaxsq zmm2,zmm0,zmm1 0x0000000000006eaf <+3807>: vshufi64x2 zmm0,zmm16,zmm26,0xee 0x0000000000006eb6 <+3814>: vmovdqa64 ZMMWORD PTR [rsp+0xd40],zmm18 0x0000000000006ebe <+3822>: vmovdqa64 zmm0{k1},zmm18 0x0000000000006ec4 <+3828>: vpmaxsq zmm1,zmm13,zmm25 0x0000000000006eca <+3834>: vmovdqa64 ZMMWORD PTR [rsp+0x780],zmm1 0x0000000000006ed2 <+3842>: vshufi64x2 zmm9,zmm1,zmm20,0x4e 0x0000000000006ed9 <+3849>: vmovdqa64 zmm9{k1},zmm19 0x0000000000006edf <+3855>: vmovdqa64 zmm27,ZMMWORD PTR [rsp+0x880] 0x0000000000006ee7 <+3863>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0xa00] 0x0000000000006eef <+3871>: vpminsq zmm11,zmm27,zmm5 0x0000000000006ef5 <+3877>: vmovdqa64 ZMMWORD PTR [rsp+0x900],zmm11 0x0000000000006efd <+3885>: vmovdqa64 zmm7,ZMMWORD PTR [rsp+0x9c0] 0x0000000000006f05 <+3893>: vpmaxsq zmm1,zmm7,zmm14 0x0000000000006f0b <+3899>: vshufi64x2 zmm15,zmm11,zmm16,0x4e 0x0000000000006f12 <+3906>: vshufi64x2 zmm15{k5},zmm1,zmm19,0xe4 0x0000000000006f19 <+3913>: mov al,0x96 0x0000000000006f1b <+3915>: vpmaxsq zmm21,zmm19,zmm0 0x0000000000006f21 <+3921>: vshufi64x2 zmm28,zmm4,zmm8,0x4e 0x0000000000006f28 <+3928>: vmovdqa64 zmm28{k2},zmm17 0x0000000000006f2e <+3934>: vmovdqa64 zmm28{k4},zmm6 0x0000000000006f34 <+3940>: vmovdqa64 zmm24,ZMMWORD PTR [rsp+0xa80] 0x0000000000006f3c <+3948>: vpblendmq zmm23{k4},zmm26,zmm24 0x0000000000006f42 <+3954>: vmovdqa64 zmm3,ZMMWORD PTR [rsp+0xa40] 0x0000000000006f4a <+3962>: vpblendmq zmm12{k2},zmm18,zmm3 0x0000000000006f50 <+3968>: kmovq k1,k2 0x0000000000006f55 <+3973>: kmovw WORD PTR [rsp+0xe40],k2 0x0000000000006f5e <+3982>: vpmaxsq zmm0,zmm23,zmm15 0x0000000000006f64 <+3988>: vmovdqa64 ZMMWORD PTR [rsp+0xac0],zmm0 0x0000000000006f6c <+3996>: vpmaxsq zmm17,zmm12,zmm9 0x0000000000006f72 <+4002>: vshufi64x2 zmm4,zmm17,zmm0,0xe4 0x0000000000006f79 <+4009>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a47d] # 0x61400 0x0000000000006f83 <+4019>: vpermt2q zmm4,zmm0,zmm21 0x0000000000006f89 <+4025>: vmovdqa64 ZMMWORD PTR [rsp+0xc80],zmm4 0x0000000000006f91 <+4033>: vmovdqa64 zmm8,zmm10 0x0000000000006f97 <+4039>: vmovdqa64 ZMMWORD PTR [rsp+0xd00],zmm10 0x0000000000006f9f <+4047>: vshufi64x2 zmm11,zmm10,zmm2,0xe4 0x0000000000006fa6 <+4054>: vpermt2q zmm11,zmm0,zmm6 0x0000000000006fac <+4060>: vpminsq zmm18,zmm6,zmm11 0x0000000000006fb2 <+4066>: vmovdqa64 ZMMWORD PTR [rsp+0xe00],zmm18 0x0000000000006fba <+4074>: vpmaxsq zmm10,zmm6,zmm11 0x0000000000006fc0 <+4080>: kmovd k3,eax 0x0000000000006fc4 <+4084>: vmovdqa64 zmm11,zmm22 0x0000000000006fca <+4090>: vmovdqa64 ZMMWORD PTR [rsp+0xc40],zmm22 0x0000000000006fd2 <+4098>: vpblendmq zmm0{k3},zmm22,zmm8 0x0000000000006fd8 <+4104>: vmovdqa64 ZMMWORD PTR [rsp+0xd80],zmm0 0x0000000000006fe0 <+4112>: vpmaxsq zmm0,zmm0,zmm28 0x0000000000006fe6 <+4118>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x0000000000006fee <+4126>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x5a608] # 0x61600 0x0000000000006ff8 <+4136>: vpermi2q zmm22,zmm10,zmm0 0x0000000000006ffe <+4142>: vmovdqa64 ZMMWORD PTR [rsp+0xe80],zmm10 0x0000000000007006 <+4150>: mov al,0x80 0x0000000000007008 <+4152>: vpmaxsq zmm0,zmm21,zmm4 0x000000000000700e <+4158>: vmovdqa64 ZMMWORD PTR [rsp+0xcc0],zmm0 0x0000000000007016 <+4166>: kmovd k2,eax 0x000000000000701a <+4170>: kmovw WORD PTR [rsp+0x5c0],k2 0x0000000000007023 <+4179>: vmovdqa64 zmm22{k2},zmm0 0x0000000000007029 <+4185>: mov al,0x86 0x000000000000702b <+4187>: vpblendmq zmm0{k7},zmm10,zmm18 0x0000000000007031 <+4193>: vpmaxsq zmm4,zmm0,zmm22 0x0000000000007037 <+4199>: kmovd k2,eax 0x000000000000703b <+4203>: vpminsq zmm4{k2},zmm0,zmm22 0x0000000000007041 <+4209>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm4 0x0000000000007049 <+4217>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x440] 0x0000000000007051 <+4225>: vpermt2q zmm0,zmm31,ZMMWORD PTR [rsp+0x300] 0x0000000000007059 <+4233>: vpminsq zmm31,zmm0,ZMMWORD PTR [rsp+0x500] 0x0000000000007061 <+4241>: vpmaxsq zmm18,zmm27,zmm5 0x0000000000007067 <+4247>: vpminsq zmm8,zmm13,zmm25 0x000000000000706d <+4253>: vpminsq zmm20,zmm7,zmm14 0x0000000000007073 <+4259>: vshufi64x2 zmm7,zmm31,zmm18,0x4e 0x000000000000707a <+4266>: vmovdqa64 zmm7{k7},zmm26 0x0000000000007080 <+4272>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a236] # 0x612c0 0x000000000000708a <+4282>: vpermt2q zmm7,zmm0,zmm8 0x0000000000007090 <+4288>: vpblendmq zmm14{k5},zmm20,zmm1 0x0000000000007096 <+4294>: vpmaxsq zmm30,zmm14,zmm7 0x000000000000709c <+4300>: vshufi64x2 zmm7,zmm3,zmm8,0xee 0x00000000000070a3 <+4307>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a253] # 0x61300 0x00000000000070ad <+4317>: vpermt2q zmm7,zmm0,zmm19 0x00000000000070b3 <+4323>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a283] # 0x61340 0x00000000000070bd <+4333>: vpermt2q zmm7,zmm0,zmm26 0x00000000000070c3 <+4339>: vmovdqa64 zmm14,ZMMWORD PTR [rsp+0x8c0] 0x00000000000070cb <+4347>: vpblendmq zmm13{k6},zmm14,zmm16 0x00000000000070d1 <+4353>: vpminsq zmm13,zmm13,zmm7 0x00000000000070d7 <+4359>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x5a29f] # 0x61380 0x00000000000070e1 <+4369>: vmovdqa64 zmm3,ZMMWORD PTR [rsp+0x540] 0x00000000000070e9 <+4377>: vmovdqa64 zmm16,zmm3 0x00000000000070ef <+4383>: vpermt2q zmm16,zmm22,ZMMWORD PTR [rsp+0xb00] 0x00000000000070f7 <+4391>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5a13f] # 0x61240 0x0000000000007101 <+4401>: vpermt2q zmm16,zmm0,ZMMWORD PTR [rsp+0x940] 0x0000000000007109 <+4409>: vshufi64x2 zmm19,zmm3,ZMMWORD PTR [rsp+0x600],0xe4 0x0000000000007112 <+4418>: vmovdqa64 zmm3,ZMMWORD PTR [rsp+0x480] 0x000000000000711a <+4426>: vshufi64x2 zmm19{k6},zmm3,ZMMWORD PTR [rsp+0x980],0x4e 0x0000000000007123 <+4435>: vpermi2q zmm22,zmm31,zmm24 0x0000000000007129 <+4441>: vpermt2q zmm22,zmm0,zmm1 0x000000000000712f <+4447>: vmovdqa64 zmm24,zmm0 0x0000000000007135 <+4453>: vshufi64x2 zmm5,zmm31,zmm14,0xe4 0x000000000000713c <+4460>: vshufi64x2 zmm5{k6},zmm20,ZMMWORD PTR [rsp+0xd40],0x4e 0x0000000000007145 <+4469>: vpminsq zmm25,zmm12,zmm9 0x000000000000714b <+4475>: vpminsq zmm23,zmm23,zmm15 0x0000000000007151 <+4481>: mov al,0x60 0x0000000000007153 <+4483>: vmovdqa64 zmm15,ZMMWORD PTR [rsp+0x3c0] 0x000000000000715b <+4491>: vinserti64x4 zmm0,zmm15,ymm11,0x1 0x0000000000007162 <+4498>: kmovd k2,eax 0x0000000000007166 <+4502>: vmovdqa64 zmm0{k2},zmm6 0x000000000000716c <+4508>: vmovdqa64 zmm29,ZMMWORD PTR [rsp+0xb40] 0x0000000000007174 <+4516>: vpblendmq zmm1{k7},zmm29,ZMMWORD PTR [rsp+0x580] 0x000000000000717c <+4524>: vmovdqa64 ZMMWORD PTR [rsp+0xa80],zmm1 0x0000000000007184 <+4532>: vmovdqa64 zmm27,ZMMWORD PTR [rsp+0x800] 0x000000000000718c <+4540>: vpblendmq zmm3{k2},zmm27,ZMMWORD PTR [rsp+0x7c0] 0x0000000000007194 <+4548>: vmovdqa64 ZMMWORD PTR [rsp+0xa00],zmm3 0x000000000000719c <+4556>: vpmaxsq zmm1,zmm1,zmm16 0x00000000000071a2 <+4562>: vmovdqa64 ZMMWORD PTR [rsp+0x940],zmm1 0x00000000000071aa <+4570>: vpmaxsq zmm3,zmm3,zmm19 0x00000000000071b0 <+4576>: vmovdqa64 ZMMWORD PTR [rsp+0xa40],zmm3 0x00000000000071b8 <+4584>: vinserti64x4 zmm7,zmm2,ymm1,0x1 0x00000000000071bf <+4591>: vshufi64x2 zmm7{k5},zmm3,ZMMWORD PTR [rsp+0xd00],0xee 0x00000000000071c8 <+4600>: vmovdqa64 ZMMWORD PTR [rsp+0x8c0],zmm7 0x00000000000071d0 <+4608>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x900] 0x00000000000071d8 <+4616>: vpblendmq zmm26{k7},zmm9,zmm18 0x00000000000071de <+4622>: vpblendmq zmm10{k2},zmm8,ZMMWORD PTR [rsp+0x780] 0x00000000000071e6 <+4630>: vpmaxsq zmm18,zmm10,zmm5 0x00000000000071ec <+4636>: vpmaxsq zmm14,zmm26,zmm22 0x00000000000071f2 <+4642>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xac0] 0x00000000000071fa <+4650>: vinserti64x4 zmm4,zmm1,ymm14,0x1 0x0000000000007201 <+4657>: vshufi64x2 zmm4{k5},zmm18,zmm17,0xee 0x0000000000007208 <+4664>: vmovdqa64 ZMMWORD PTR [rsp+0x880],zmm4 0x0000000000007210 <+4672>: vpblendmq zmm11{k3},zmm25,zmm17 0x0000000000007216 <+4678>: vshufi64x2 zmm17,zmm23,zmm13,0x4e 0x000000000000721d <+4685>: vmovdqa64 zmm17{k1},zmm30 0x0000000000007223 <+4691>: vmovdqa64 zmm17{k4},zmm21 0x0000000000007229 <+4697>: vpminsq zmm3,zmm11,zmm17 0x000000000000722f <+4703>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm3 0x0000000000007237 <+4711>: vpmaxsq zmm6,zmm11,zmm17 0x000000000000723d <+4717>: vinserti64x4 zmm17,zmm30,ymm25,0x1 0x0000000000007244 <+4724>: vmovdqa64 zmm17{k2},zmm21 0x000000000000724a <+4730>: vpminsq zmm12,zmm21,ZMMWORD PTR [rsp+0xc80] 0x0000000000007252 <+4738>: vpblendmq zmm1{k6},zmm23,zmm1 0x0000000000007258 <+4744>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm1 0x0000000000007260 <+4752>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x240] 0x0000000000007268 <+4760>: vpblendmq zmm11{k6},zmm11,zmm2 0x000000000000726e <+4766>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm11 0x0000000000007276 <+4774>: vpermt2q zmm17,zmm24,zmm13 0x000000000000727c <+4780>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm17 0x0000000000007284 <+4788>: vpermt2q zmm0,zmm24,ZMMWORD PTR [rsp+0x2c0] 0x000000000000728c <+4796>: vmovdqa64 ZMMWORD PTR [rsp+0x980],zmm0 0x0000000000007294 <+4804>: vpminsq zmm11,zmm11,zmm0 0x000000000000729a <+4810>: vpmaxsq zmm24,zmm15,zmm7 0x00000000000072a0 <+4816>: vmovdqa64 ZMMWORD PTR [rsp+0xf00],zmm24 0x00000000000072a8 <+4824>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x5a2ce] # 0x61580 0x00000000000072b2 <+4834>: vpermt2q zmm24,zmm21,zmm11 0x00000000000072b8 <+4840>: vpmaxsq zmm2,zmm30,zmm4 0x00000000000072be <+4846>: vmovdqa64 ZMMWORD PTR [rsp+0xec0],zmm2 0x00000000000072c6 <+4854>: vpminsq zmm17,zmm1,zmm17 0x00000000000072cc <+4860>: vpermi2q zmm21,zmm2,zmm17 0x00000000000072d2 <+4866>: vmovdqa64 zmm21{k7},zmm12 0x00000000000072d8 <+4872>: vpblendmq zmm0{k4},zmm6,zmm3 0x00000000000072de <+4878>: vpmaxsq zmm1,zmm0,zmm21 0x00000000000072e4 <+4884>: vpminsq zmm1{k7},zmm0,zmm21 0x00000000000072ea <+4890>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm1 0x00000000000072f2 <+4898>: vpminsq zmm1,zmm28,ZMMWORD PTR [rsp+0xd80] 0x00000000000072fa <+4906>: vmovdqa64 ZMMWORD PTR [rsp+0x780],zmm1 0x0000000000007302 <+4914>: vmovdqa64 zmm24{k7},ZMMWORD PTR [rsp+0xe00] 0x000000000000730a <+4922>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x280] 0x0000000000007312 <+4930>: vpblendmq zmm0{k4},zmm0,zmm1 0x0000000000007318 <+4936>: vpmaxsq zmm1,zmm0,zmm24 0x000000000000731e <+4942>: vpminsq zmm1{k7},zmm0,zmm24 0x0000000000007324 <+4948>: vmovdqa64 ZMMWORD PTR [rsp+0xb00],zmm1 0x000000000000732c <+4956>: vpblendmq zmm0{k7},zmm9,zmm8 0x0000000000007332 <+4962>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59f84] # 0x612c0 0x000000000000733c <+4972>: vpermt2q zmm0,zmm3,zmm20 0x0000000000007342 <+4978>: vpminsq zmm1,zmm10,zmm5 0x0000000000007348 <+4984>: vpminsq zmm4,zmm31,zmm0 0x000000000000734e <+4990>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x5a128] # 0x61480 0x0000000000007358 <+5000>: vmovdqa64 zmm0,zmm4 0x000000000000735e <+5006>: vpermt2q zmm0,zmm8,zmm14 0x0000000000007364 <+5012>: vshufi64x2 zmm8,zmm0,zmm13,0xe4 0x000000000000736b <+5019>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59e4b] # 0x611c0 0x0000000000007375 <+5029>: vpermt2q zmm8,zmm0,zmm30 0x000000000000737b <+5035>: vpblendmq zmm28{k5},zmm1,zmm18 0x0000000000007381 <+5041>: kmovq k1,k5 0x0000000000007386 <+5046>: kmovw WORD PTR [rsp+0x640],k5 0x000000000000738f <+5055>: vpmaxsq zmm31,zmm28,zmm8 0x0000000000007395 <+5061>: vshufi64x2 zmm0,zmm31,zmm17,0xee 0x000000000000739c <+5068>: vmovdqa64 ZMMWORD PTR [rsp+0x9c0],zmm17 0x00000000000073a4 <+5076>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x5a292] # 0x61640 0x00000000000073ae <+5086>: vpermi2q zmm21,zmm0,zmm6 0x00000000000073b4 <+5092>: vshufi64x2 zmm0,zmm6,ZMMWORD PTR [rsp+0xe80],0xe4 0x00000000000073bd <+5101>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5a339] # 0x61700 0x00000000000073c7 <+5111>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0xcc0] 0x00000000000073cf <+5119>: vpermi2q zmm2,zmm5,zmm0 0x00000000000073d5 <+5125>: vpblendmq zmm0{k7},zmm5,zmm12 0x00000000000073db <+5131>: vpmaxsq zmm5,zmm0,zmm2 0x00000000000073e1 <+5137>: vpminsq zmm5{k4},zmm0,zmm2 0x00000000000073e7 <+5143>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm5 0x00000000000073ef <+5151>: vpblendmq zmm0{k7},zmm29,zmm27 0x00000000000073f5 <+5157>: vpermt2q zmm0,zmm3,ZMMWORD PTR [rsp+0x480] 0x00000000000073fd <+5165>: vmovdqa64 zmm20,zmm3 0x0000000000007403 <+5171>: vpminsq zmm2,zmm0,ZMMWORD PTR [rsp+0x540] 0x000000000000740b <+5179>: vpminsq zmm0,zmm26,zmm22 0x0000000000007411 <+5185>: vinserti64x4 zmm5,zmm0,ymm23,0x1 0x0000000000007418 <+5192>: vshufi64x2 zmm5{k6},zmm25,zmm1,0xee 0x000000000000741f <+5199>: kmovw WORD PTR [rsp+0x400],k6 0x0000000000007428 <+5208>: vmovdqa64 zmm9,zmm4 0x000000000000742e <+5214>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59f88] # 0x613c0 0x0000000000007438 <+5224>: vpermt2q zmm9,zmm3,zmm0 0x000000000000743e <+5230>: vmovdqa64 zmm15,zmm3 0x0000000000007444 <+5236>: vmovdqa64 zmm9{k4},zmm1 0x000000000000744a <+5242>: vpminsq zmm10,zmm19,ZMMWORD PTR [rsp+0xa00] 0x0000000000007452 <+5250>: vpminsq zmm12,zmm16,ZMMWORD PTR [rsp+0xa80] 0x000000000000745a <+5258>: vpblendmq zmm1{k3},zmm0,zmm14 0x0000000000007460 <+5264>: vpminsq zmm3,zmm4,zmm9 0x0000000000007466 <+5270>: vpmaxsq zmm0,zmm4,zmm9 0x000000000000746c <+5276>: vshufi64x2 zmm4,zmm13,zmm4,0xe4 0x0000000000007473 <+5283>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x59fc3] # 0x61440 0x000000000000747d <+5293>: vpermt2q zmm4,zmm6,zmm18 0x0000000000007483 <+5299>: vpminsq zmm18,zmm28,zmm8 0x0000000000007489 <+5305>: vmovdqa64 ZMMWORD PTR [rsp+0xa00],zmm18 0x0000000000007491 <+5313>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x59ea5] # 0x61340 0x000000000000749b <+5323>: vpermt2q zmm4,zmm8,zmm30 0x00000000000074a1 <+5329>: vpminsq zmm7,zmm1,zmm4 0x00000000000074a7 <+5335>: vpmaxsq zmm24,zmm1,zmm4 0x00000000000074ad <+5341>: vpminsq zmm4,zmm13,zmm5 0x00000000000074b3 <+5347>: vpmaxsq zmm16,zmm13,zmm5 0x00000000000074b9 <+5353>: vmovdqa64 ZMMWORD PTR [rsp+0xa80],zmm16 0x00000000000074c1 <+5361>: vmovdqa64 zmm5,zmm2 0x00000000000074c7 <+5367>: vpermt2q zmm5,zmm15,zmm12 0x00000000000074cd <+5373>: vmovdqa64 zmm5{k4},zmm10 0x00000000000074d3 <+5379>: vpminsq zmm13,zmm2,zmm5 0x00000000000074d9 <+5385>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x5a01d] # 0x61500 0x00000000000074e3 <+5395>: vpermi2q zmm14,zmm3,zmm13 0x00000000000074e9 <+5401>: kmovw k5,WORD PTR [rsp+0xe40] 0x00000000000074f2 <+5410>: vmovdqa64 zmm14{k5},zmm7 0x00000000000074f8 <+5416>: vmovdqa64 zmm1,zmm7 0x00000000000074fe <+5422>: vmovdqa64 zmm7{k2},zmm24 0x0000000000007504 <+5428>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x340] 0x000000000000750c <+5436>: vpermi2q zmm9,zmm4,zmm18 0x0000000000007512 <+5442>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm9 0x000000000000751a <+5450>: vpblendmq zmm9{k7},zmm4,zmm16 0x0000000000007520 <+5456>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x5a156] # 0x61680 0x000000000000752a <+5466>: vpermt2q zmm4,zmm15,zmm0 0x0000000000007530 <+5472>: vpermt2q zmm4,zmm20,zmm31 0x0000000000007536 <+5478>: vmovdqa64 zmm26,zmm20 0x000000000000753c <+5484>: vpminsq zmm25,zmm7,zmm4 0x0000000000007542 <+5490>: vmovdqa64 zmm22,zmm25 0x0000000000007548 <+5496>: vpmaxsq zmm22{k5},zmm7,zmm4 0x000000000000754e <+5502>: vinserti64x4 zmm4,zmm12,YMMWORD PTR [rsp+0x240],0x1 0x0000000000007557 <+5511>: vmovdqa64 zmm7,ZMMWORD PTR [rsp+0xc40] 0x000000000000755f <+5519>: vshufi64x2 zmm4{k6},zmm7,zmm10,0xee 0x0000000000007566 <+5526>: vmovdqa64 zmm19,ZMMWORD PTR [rsp+0x2c0] 0x000000000000756e <+5534>: vshufi64x2 zmm7,zmm19,zmm2,0xe4 0x0000000000007575 <+5541>: vmovdqa64 zmm16,ZMMWORD PTR [rsp+0xa40] 0x000000000000757d <+5549>: vpermt2q zmm7,zmm6,zmm16 0x0000000000007583 <+5555>: vpblendmq zmm29{k1},zmm10,zmm16 0x0000000000007589 <+5561>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x940] 0x0000000000007591 <+5569>: vpblendmq zmm6{k3},zmm12,zmm10 0x0000000000007597 <+5575>: vpmaxsq zmm12,zmm2,zmm5 0x000000000000759d <+5581>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59ed9] # 0x61480 0x00000000000075a7 <+5591>: vpermt2q zmm2,zmm5,zmm10 0x00000000000075ad <+5597>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x3c0] 0x00000000000075b5 <+5605>: vpermt2q zmm7,zmm8,zmm10 0x00000000000075bb <+5611>: vmovdqa64 zmm23,zmm8 0x00000000000075c1 <+5617>: vpminsq zmm18,zmm6,zmm7 0x00000000000075c7 <+5623>: vpmaxsq zmm5,zmm6,zmm7 0x00000000000075cd <+5629>: vshufi64x2 zmm2,zmm2,zmm19,0xe4 0x00000000000075d4 <+5636>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x59be2] # 0x611c0 0x00000000000075de <+5646>: vpermt2q zmm2,zmm6,zmm10 0x00000000000075e4 <+5652>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x59f52] # 0x61540 0x00000000000075ee <+5662>: vpermi2q zmm20,zmm13,zmm18 0x00000000000075f4 <+5668>: vmovdqa64 zmm28,ZMMWORD PTR [rip+0x59fc2] # 0x615c0 0x00000000000075fe <+5678>: vpermt2q zmm1,zmm28,zmm17 0x0000000000007604 <+5684>: vpermi2q zmm28,zmm18,zmm11 0x000000000000760a <+5690>: vmovdqa64 zmm18{k2},zmm5 0x0000000000007610 <+5696>: vpminsq zmm7,zmm19,zmm4 0x0000000000007616 <+5702>: vpermi2q zmm15,zmm7,zmm12 0x000000000000761c <+5708>: vpmaxsq zmm6,zmm29,zmm2 0x0000000000007622 <+5714>: vpermt2q zmm15,zmm26,zmm6 0x0000000000007628 <+5720>: vpminsq zmm8,zmm18,zmm15 0x000000000000762e <+5726>: vmovdqa64 ZMMWORD PTR [rsp+0x940],zmm8 0x0000000000007636 <+5734>: vpmaxsq zmm8{k5},zmm18,zmm15 0x000000000000763c <+5740>: mov al,0x1 0x000000000000763e <+5742>: kmovd k1,eax 0x0000000000007642 <+5746>: kmovw WORD PTR [rsp+0x540],k1 0x000000000000764b <+5755>: vmovdqa64 zmm20{k1},zmm3 0x0000000000007651 <+5761>: vmovdqa64 zmm3{k5},zmm0 0x0000000000007657 <+5767>: vpminsq zmm0,zmm3,zmm14 0x000000000000765d <+5773>: kmovw k6,WORD PTR [rsp+0x4c0] 0x0000000000007666 <+5782>: vpmaxsq zmm0{k6},zmm3,zmm14 0x000000000000766c <+5788>: vpmaxsq zmm19,zmm19,zmm4 0x0000000000007672 <+5794>: vmovdqa64 zmm28{k7},zmm6 0x0000000000007678 <+5800>: vpblendmq zmm3{k7},zmm7,zmm19 0x000000000000767e <+5806>: vpminsq zmm14,zmm3,zmm28 0x0000000000007684 <+5812>: vmovdqa64 ZMMWORD PTR [rsp+0xb40],zmm14 0x000000000000768c <+5820>: vpmaxsq zmm14{k3},zmm3,zmm28 0x0000000000007692 <+5826>: vmovdqa64 zmm13{k5},zmm12 0x0000000000007698 <+5832>: mov al,0x68 0x000000000000769a <+5834>: vpminsq zmm3,zmm13,zmm20 0x00000000000076a0 <+5840>: kmovd k1,eax 0x00000000000076a4 <+5844>: kmovw WORD PTR [rsp+0x240],k1 0x00000000000076ad <+5853>: vpmaxsq zmm3{k1},zmm13,zmm20 0x00000000000076b3 <+5859>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59e03] # 0x614c0 0x00000000000076bd <+5869>: vmovdqa64 zmm12,ZMMWORD PTR [rsp+0x280] 0x00000000000076c5 <+5877>: vpermi2q zmm4,zmm12,zmm6 0x00000000000076cb <+5883>: vpminsq zmm13,zmm30,ZMMWORD PTR [rsp+0x880] 0x00000000000076d3 <+5891>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm13 0x00000000000076db <+5899>: vpminsq zmm12,zmm10,ZMMWORD PTR [rsp+0x8c0] 0x00000000000076e3 <+5907>: vmovdqa64 zmm17,ZMMWORD PTR [rsp+0xec0] 0x00000000000076eb <+5915>: vpblendmq zmm13{k5},zmm17,zmm13 0x00000000000076f1 <+5921>: vpminsq zmm16,zmm13,zmm21 0x00000000000076f7 <+5927>: vmovdqa64 ZMMWORD PTR [rsp+0xd80],zmm16 0x00000000000076ff <+5935>: vpmaxsq zmm27,zmm13,zmm21 0x0000000000007705 <+5941>: vmovdqa64 zmm4{k5},zmm11 0x000000000000770b <+5947>: vmovdqa64 zmm20,ZMMWORD PTR [rsp+0xf00] 0x0000000000007713 <+5955>: vpblendmq zmm13{k5},zmm20,zmm12 0x0000000000007719 <+5961>: vpminsq zmm10,zmm13,zmm4 0x000000000000771f <+5967>: vmovdqa64 ZMMWORD PTR [rsp+0x800],zmm10 0x0000000000007727 <+5975>: vpmaxsq zmm15,zmm13,zmm4 0x000000000000772d <+5981>: vmovdqa64 ZMMWORD PTR [rsp+0xc40],zmm15 0x0000000000007735 <+5989>: vmovdqa64 zmm1{k7},zmm31 0x000000000000773b <+5995>: vpminsq zmm13,zmm9,zmm1 0x0000000000007741 <+6001>: vpmaxsq zmm1,zmm9,zmm1 0x0000000000007747 <+6007>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm1 0x000000000000774f <+6015>: vpblendmq zmm9{k3},zmm13,zmm1 0x0000000000007755 <+6021>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5a061] # 0x617c0 0x000000000000775f <+6031>: vmovdqa64 zmm1,zmm0 0x0000000000007765 <+6037>: vpermt2q zmm1,zmm4,zmm9 0x000000000000776b <+6043>: vmovdqa64 zmm26,zmm9 0x0000000000007771 <+6049>: vmovdqa64 ZMMWORD PTR [rsp+0xc80],zmm9 0x0000000000007779 <+6057>: vpermi2q zmm4,zmm3,zmm14 0x000000000000777f <+6063>: vpblendmq zmm10{k3},zmm10,zmm15 0x0000000000007785 <+6069>: vmovdqa64 ZMMWORD PTR [rsp+0xa40],zmm10 0x000000000000778d <+6077>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x5a169] # 0x61900 0x0000000000007797 <+6087>: vmovdqa64 zmm15,zmm10 0x000000000000779d <+6093>: vpermt2q zmm15,zmm9,ZMMWORD PTR [rsp+0x380] 0x00000000000077a5 <+6101>: vpblendmq zmm10{k3},zmm16,zmm27 0x00000000000077ab <+6107>: vmovdqa64 ZMMWORD PTR [rsp+0xd40],zmm10 0x00000000000077b3 <+6115>: vpermi2q zmm9,zmm10,ZMMWORD PTR [rsp+0x300] 0x00000000000077bb <+6123>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x440] 0x00000000000077c3 <+6131>: vpminsq zmm16,zmm10,zmm9 0x00000000000077c9 <+6137>: vmovdqa64 ZMMWORD PTR [rsp+0x880],zmm16 0x00000000000077d1 <+6145>: vpmaxsq zmm21,zmm10,zmm9 0x00000000000077d7 <+6151>: vmovdqa64 zmm21{k3},zmm16 0x00000000000077dd <+6157>: vmovdqa64 zmm30,ZMMWORD PTR [rsp+0xb00] 0x00000000000077e5 <+6165>: vpminsq zmm9,zmm30,zmm15 0x00000000000077eb <+6171>: vmovdqa64 ZMMWORD PTR [rsp+0xac0],zmm9 0x00000000000077f3 <+6179>: vpmaxsq zmm10,zmm30,zmm15 0x00000000000077f9 <+6185>: vmovdqa64 zmm10{k3},zmm9 0x00000000000077ff <+6191>: vpminsq zmm9,zmm8,zmm4 0x0000000000007805 <+6197>: vmovdqa64 ZMMWORD PTR [rsp+0xd00],zmm9 0x000000000000780d <+6205>: vpmaxsq zmm4,zmm8,zmm4 0x0000000000007813 <+6211>: vmovdqa64 ZMMWORD PTR [rsp+0x900],zmm4 0x000000000000781b <+6219>: vpminsq zmm15,zmm22,zmm1 0x0000000000007821 <+6225>: vmovdqa64 ZMMWORD PTR [rsp+0xcc0],zmm15 0x0000000000007829 <+6233>: vpmaxsq zmm1,zmm22,zmm1 0x000000000000782f <+6239>: vmovdqa64 ZMMWORD PTR [rsp+0x8c0],zmm1 0x0000000000007837 <+6247>: vpblendmq zmm4{k3},zmm4,zmm9 0x000000000000783d <+6253>: vpblendmq zmm1{k3},zmm1,zmm15 0x0000000000007843 <+6259>: vpminsq zmm18,zmm29,zmm2 0x0000000000007849 <+6265>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x980] 0x0000000000007851 <+6273>: vpmaxsq zmm9,zmm2,ZMMWORD PTR [rsp+0x600] 0x0000000000007859 <+6281>: vshufi64x2 zmm2,zmm18,zmm12,0xee 0x0000000000007860 <+6288>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x59a96] # 0x61300 0x000000000000786a <+6298>: vpermt2q zmm2,zmm12,ZMMWORD PTR [rsp+0x780] 0x0000000000007872 <+6306>: vpermt2q zmm2,zmm23,zmm7 0x0000000000007878 <+6312>: vmovdqa64 zmm11{k7},zmm9 0x000000000000787e <+6318>: vpminsq zmm23,zmm11,zmm2 0x0000000000007884 <+6324>: vpmaxsq zmm23{k4},zmm11,zmm2 0x000000000000788a <+6330>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x59e2c] # 0x616c0 0x0000000000007894 <+6340>: vpermt2q zmm5,zmm16,zmm19 0x000000000000789a <+6346>: vinserti64x4 zmm15,zmm5,ymm9,0x1 0x00000000000078a1 <+6353>: vmovdqa64 zmm28,ZMMWORD PTR [rip+0x59a15] # 0x612c0 0x00000000000078ab <+6363>: vpermt2q zmm15,zmm28,zmm20 0x00000000000078b1 <+6369>: vmovdqa64 zmm5,zmm0 0x00000000000078b7 <+6375>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x59ebf] # 0x61780 0x00000000000078c1 <+6385>: vpermt2q zmm5,zmm9,zmm25 0x00000000000078c7 <+6391>: vpminsq zmm7,zmm0,zmm5 0x00000000000078cd <+6397>: vpmaxsq zmm20,zmm0,zmm5 0x00000000000078d3 <+6403>: vpblendmq zmm2{k5},zmm31,ZMMWORD PTR [rsp+0xa00] 0x00000000000078db <+6411>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm2 0x00000000000078e3 <+6419>: vpblendmq zmm25{k5},zmm6,zmm18 0x00000000000078e9 <+6425>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x7c0] 0x00000000000078f1 <+6433>: vpmaxsq zmm11,zmm0,ZMMWORD PTR [rsp+0x580] 0x00000000000078f9 <+6441>: vpermt2q zmm24,zmm16,ZMMWORD PTR [rsp+0xa80] 0x0000000000007901 <+6449>: vinserti64x4 zmm6,zmm24,ymm11,0x1 0x0000000000007908 <+6456>: vpermt2q zmm6,zmm28,zmm17 0x000000000000790e <+6462>: vpmaxsq zmm12,zmm25,zmm15 0x0000000000007914 <+6468>: vmovdqa64 zmm24,ZMMWORD PTR [rip+0x59f22] # 0x61840 0x000000000000791e <+6478>: vpermt2q zmm8,zmm24,zmm12 0x0000000000007924 <+6484>: vpmaxsq zmm0,zmm2,zmm6 0x000000000000792a <+6490>: vpermi2q zmm24,zmm22,zmm0 0x0000000000007930 <+6496>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59906] # 0x61240 0x000000000000793a <+6506>: vpermt2q zmm24,zmm18,zmm27 0x0000000000007940 <+6512>: vshufi64x2 zmm7,zmm20,zmm7,0xe4 0x0000000000007947 <+6519>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x5a02f] # 0x61980 0x0000000000007951 <+6529>: vmovdqa64 zmm17,zmm1 0x0000000000007957 <+6535>: vpermt2q zmm17,zmm22,zmm7 0x000000000000795d <+6541>: vpmaxsq zmm2,zmm26,zmm24 0x0000000000007963 <+6547>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm2 0x000000000000796b <+6555>: vmovdqa64 zmm17{k2},zmm2 0x0000000000007971 <+6561>: vpmaxsq zmm31,zmm1,zmm17 0x0000000000007977 <+6567>: vpminsq zmm31{k6},zmm1,zmm17 0x000000000000797d <+6573>: vpermi2q zmm9,zmm3,ZMMWORD PTR [rsp+0x940] 0x0000000000007985 <+6581>: vpermt2q zmm8,zmm18,ZMMWORD PTR [rsp+0xc40] 0x000000000000798d <+6589>: vpminsq zmm1,zmm3,zmm9 0x0000000000007993 <+6595>: vpmaxsq zmm3,zmm3,zmm9 0x0000000000007999 <+6601>: vshufi64x2 zmm3,zmm3,zmm1,0xe4 0x00000000000079a0 <+6608>: vpermi2q zmm22,zmm4,zmm3 0x00000000000079a6 <+6614>: vpmaxsq zmm29,zmm14,zmm8 0x00000000000079ac <+6620>: vmovdqa64 zmm22{k2},zmm29 0x00000000000079b2 <+6626>: vpmaxsq zmm17,zmm4,zmm22 0x00000000000079b8 <+6632>: vpminsq zmm17{k6},zmm4,zmm22 0x00000000000079be <+6638>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x9c0] 0x00000000000079c6 <+6646>: vpblendmq zmm4{k7},zmm1,zmm11 0x00000000000079cc <+6652>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x340] 0x00000000000079d4 <+6660>: vshufi64x2 zmm9,zmm1,ZMMWORD PTR [rsp+0x280],0xe4 0x00000000000079dd <+6669>: vpermt2q zmm9,zmm28,ZMMWORD PTR [rsp+0x500] 0x00000000000079e5 <+6677>: vbroadcasti64x4 zmm1,YMMWORD PTR [rip+0x5bc51] # 0x63640 0x00000000000079ef <+6687>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0xb40] 0x00000000000079f7 <+6695>: vpermt2q zmm2,zmm1,zmm23 0x00000000000079fd <+6701>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x59df9] # 0x61800 0x0000000000007a07 <+6711>: vmovdqa64 zmm11,zmm30 0x0000000000007a0d <+6717>: vpermt2q zmm11,zmm22,zmm2 0x0000000000007a13 <+6723>: vpminsq zmm18,zmm4,zmm9 0x0000000000007a19 <+6729>: vpermt2q zmm13,zmm1,zmm18 0x0000000000007a1f <+6735>: vmovdqa64 zmm20,ZMMWORD PTR [rsp+0x440] 0x0000000000007a27 <+6743>: vpermi2q zmm22,zmm20,zmm13 0x0000000000007a2d <+6749>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x59e49] # 0x61880 0x0000000000007a37 <+6759>: vmovdqa64 zmm19,ZMMWORD PTR [rsp+0x380] 0x0000000000007a3f <+6767>: vpermt2q zmm30,zmm13,zmm19 0x0000000000007a45 <+6773>: vmovdqa64 zmm26,ZMMWORD PTR [rsp+0x300] 0x0000000000007a4d <+6781>: vpermi2q zmm13,zmm20,zmm26 0x0000000000007a53 <+6787>: vpmaxsq zmm26,zmm26,zmm13 0x0000000000007a59 <+6793>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm26 0x0000000000007a61 <+6801>: vpmaxsq zmm30,zmm19,zmm30 0x0000000000007a67 <+6807>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm30 0x0000000000007a6f <+6815>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0xd40] 0x0000000000007a77 <+6823>: vpminsq zmm20,zmm2,zmm22 0x0000000000007a7d <+6829>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x59f79] # 0x61a00 0x0000000000007a87 <+6839>: vmovdqa64 zmm27,zmm21 0x0000000000007a8d <+6845>: vpermt2q zmm27,zmm13,zmm20 0x0000000000007a93 <+6851>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0xa40] 0x0000000000007a9b <+6859>: vpminsq zmm19,zmm5,zmm11 0x0000000000007aa1 <+6865>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm10 0x0000000000007aa9 <+6873>: vpermi2q zmm13,zmm10,zmm19 0x0000000000007aaf <+6879>: vmovdqa64 zmm1,zmm28 0x0000000000007ab5 <+6885>: vpermt2q zmm13,zmm28,zmm30 0x0000000000007abb <+6891>: vpmaxsq zmm28,zmm10,zmm13 0x0000000000007ac1 <+6897>: vpminsq zmm28{k6},zmm10,zmm13 0x0000000000007ac7 <+6903>: vpermt2q zmm27,zmm1,zmm26 0x0000000000007acd <+6909>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm21 0x0000000000007ad5 <+6917>: vpmaxsq zmm13,zmm21,zmm27 0x0000000000007adb <+6923>: vpminsq zmm13{k6},zmm21,zmm27 0x0000000000007ae1 <+6929>: vpminsq zmm12{k2},zmm25,zmm15 0x0000000000007ae7 <+6935>: vmovdqa64 zmm10,zmm0 0x0000000000007aed <+6941>: vpminsq zmm10{k2},zmm6,ZMMWORD PTR [rsp+0x600] 0x0000000000007af5 <+6949>: vpmaxsq zmm18{k4},zmm4,zmm9 0x0000000000007afb <+6955>: vmovdqa64 zmm0,zmm3 0x0000000000007b01 <+6961>: vmovdqa64 zmm4,zmm1 0x0000000000007b07 <+6967>: vpermt2q zmm0,zmm1,ZMMWORD PTR [rsp+0xd00] 0x0000000000007b0f <+6975>: vpermi2q zmm4,zmm7,ZMMWORD PTR [rsp+0xcc0] 0x0000000000007b17 <+6983>: vpmaxsq zmm1,zmm7,zmm4 0x0000000000007b1d <+6989>: vpminsq zmm1{k2},zmm7,zmm4 0x0000000000007b23 <+6995>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm1 0x0000000000007b2b <+7003>: vpmaxsq zmm6,zmm3,zmm0 0x0000000000007b31 <+7009>: vpminsq zmm6{k2},zmm3,zmm0 0x0000000000007b37 <+7015>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59bff] # 0x61740 0x0000000000007b41 <+7025>: vmovdqa64 zmm25,zmm23 0x0000000000007b47 <+7031>: vpermt2q zmm25,zmm0,zmm14 0x0000000000007b4d <+7037>: vpermi2q zmm0,zmm18,ZMMWORD PTR [rsp+0x480] 0x0000000000007b55 <+7045>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x59d61] # 0x618c0 0x0000000000007b5f <+7055>: vmovdqa64 zmm3,zmm10 0x0000000000007b65 <+7061>: vpermt2q zmm3,zmm7,ZMMWORD PTR [rsp+0xd80] 0x0000000000007b6d <+7069>: vpminsq zmm4,zmm18,zmm3 0x0000000000007b73 <+7075>: vpmaxsq zmm0,zmm10,zmm0 0x0000000000007b79 <+7081>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59e3d] # 0x619c0 0x0000000000007b83 <+7091>: vmovdqa64 zmm10,zmm4 0x0000000000007b89 <+7097>: vpermt2q zmm10,zmm3,zmm0 0x0000000000007b8f <+7103>: vpminsq zmm9,zmm4,zmm10 0x0000000000007b95 <+7109>: vpmaxsq zmm9{k5},zmm4,zmm10 0x0000000000007b9b <+7115>: vmovdqa64 zmm15,zmm4 0x0000000000007ba1 <+7121>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59855] # 0x61400 0x0000000000007bab <+7131>: vpermt2q zmm15,zmm1,zmm0 0x0000000000007bb1 <+7137>: vpmaxsq zmm4,zmm0,zmm15 0x0000000000007bb7 <+7143>: vmovdqa64 zmm10,zmm4 0x0000000000007bbd <+7149>: vpminsq zmm10{k7},zmm0,zmm15 0x0000000000007bc3 <+7155>: vpermi2q zmm7,zmm12,ZMMWORD PTR [rsp+0x800] 0x0000000000007bcb <+7163>: vpminsq zmm7,zmm23,zmm7 0x0000000000007bd1 <+7169>: vpminsq zmm0,zmm24,ZMMWORD PTR [rsp+0xc80] 0x0000000000007bd9 <+7177>: vpmaxsq zmm18,zmm2,zmm22 0x0000000000007bdf <+7183>: vshufi64x2 zmm20,zmm20,zmm18,0xe4 0x0000000000007be6 <+7190>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x59d50] # 0x61940 0x0000000000007bf0 <+7200>: vmovdqa64 zmm22,zmm20 0x0000000000007bf6 <+7206>: vpermt2q zmm22,zmm15,zmm0 0x0000000000007bfc <+7212>: vmovdqa64 zmm22{k4},ZMMWORD PTR [rsp+0x880] 0x0000000000007c04 <+7220>: vpminsq zmm8,zmm14,zmm8 0x0000000000007c0a <+7226>: vpmaxsq zmm11,zmm5,zmm11 0x0000000000007c10 <+7232>: vshufi64x2 zmm21,zmm19,zmm11,0xe4 0x0000000000007c17 <+7239>: vpermi2q zmm15,zmm21,zmm8 0x0000000000007c1d <+7245>: vmovdqa64 zmm15{k4},ZMMWORD PTR [rsp+0xac0] 0x0000000000007c25 <+7253>: vpmaxsq zmm19,zmm12,zmm25 0x0000000000007c2b <+7259>: vshufi64x2 zmm23,zmm8,zmm29,0xe4 0x0000000000007c32 <+7266>: vshufi64x2 zmm8,zmm0,ZMMWORD PTR [rsp+0x580],0xe4 0x0000000000007c3b <+7275>: vpermi2q zmm1,zmm7,zmm19 0x0000000000007c41 <+7281>: vpmaxsq zmm0,zmm19,zmm1 0x0000000000007c47 <+7287>: vmovdqa64 zmm12,zmm0 0x0000000000007c4d <+7293>: vpminsq zmm12{k7},zmm19,zmm1 0x0000000000007c53 <+7299>: vpermi2q zmm3,zmm7,zmm19 0x0000000000007c59 <+7305>: vmovdqa64 zmm14,zmm8 0x0000000000007c5f <+7311>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59757] # 0x613c0 0x0000000000007c69 <+7321>: vpermt2q zmm14,zmm1,ZMMWORD PTR [rsp+0x8c0] 0x0000000000007c71 <+7329>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x596c5] # 0x61340 0x0000000000007c7b <+7339>: vpermt2q zmm14,zmm2,zmm18 0x0000000000007c81 <+7345>: vpermi2q zmm1,zmm23,ZMMWORD PTR [rsp+0x900] 0x0000000000007c89 <+7353>: vpermt2q zmm1,zmm2,zmm11 0x0000000000007c8f <+7359>: vpminsq zmm11,zmm20,zmm22 0x0000000000007c95 <+7365>: vpmaxsq zmm18,zmm20,zmm22 0x0000000000007c9b <+7371>: vshufi64x2 zmm19,zmm11,zmm18,0xe4 0x0000000000007ca2 <+7378>: vpminsq zmm11,zmm8,zmm14 0x0000000000007ca8 <+7384>: vpmaxsq zmm8,zmm8,zmm14 0x0000000000007cae <+7390>: vshufi64x2 zmm18,zmm11,zmm8,0xe4 0x0000000000007cb5 <+7397>: vpminsq zmm14,zmm7,zmm3 0x0000000000007cbb <+7403>: vpmaxsq zmm14{k5},zmm7,zmm3 0x0000000000007cc1 <+7409>: vmovdqa64 zmm7,zmm18 0x0000000000007cc7 <+7415>: vpermt2q zmm7,zmm16,zmm9 0x0000000000007ccd <+7421>: vpminsq zmm5,zmm18,zmm7 0x0000000000007cd3 <+7427>: vmovdqa64 zmm3,zmm5 0x0000000000007cd9 <+7433>: vpmaxsq zmm3{k2},zmm18,zmm7 0x0000000000007cdf <+7439>: vpermt2q zmm4,zmm16,zmm19 0x0000000000007ce5 <+7445>: vpminsq zmm7,zmm10,zmm4 0x0000000000007ceb <+7451>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x59d8b] # 0x61a80 0x0000000000007cf5 <+7461>: vmovdqa64 zmm24,zmm3 0x0000000000007cfb <+7467>: vpermt2q zmm24,zmm11,zmm7 0x0000000000007d01 <+7473>: vpmaxsq zmm7{k2},zmm10,zmm4 0x0000000000007d07 <+7479>: vpminsq zmm4,zmm21,zmm15 0x0000000000007d0d <+7485>: vpmaxsq zmm15,zmm21,zmm15 0x0000000000007d13 <+7491>: vshufi64x2 zmm25,zmm4,zmm15,0xe4 0x0000000000007d1a <+7498>: vpminsq zmm4,zmm23,zmm1 0x0000000000007d20 <+7504>: vpmaxsq zmm15,zmm23,zmm1 0x0000000000007d26 <+7510>: vshufi64x2 zmm20,zmm4,zmm15,0xe4 0x0000000000007d2d <+7517>: vpermt2q zmm0,zmm16,zmm25 0x0000000000007d33 <+7523>: vpminsq zmm26,zmm12,zmm0 0x0000000000007d39 <+7529>: vmovdqa64 zmm4,zmm26 0x0000000000007d3f <+7535>: vpmaxsq zmm4{k2},zmm12,zmm0 0x0000000000007d45 <+7541>: vpermi2q zmm16,zmm20,zmm14 0x0000000000007d4b <+7547>: vpminsq zmm8,zmm20,zmm16 0x0000000000007d51 <+7553>: vmovdqa64 zmm15,zmm8 0x0000000000007d57 <+7559>: vpmaxsq zmm15{k2},zmm20,zmm16 0x0000000000007d5d <+7565>: vmovdqa64 zmm2,zmm18 0x0000000000007d63 <+7571>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x593d3] # 0x61140 0x0000000000007d6d <+7581>: vpermt2q zmm2,zmm0,zmm9 0x0000000000007d73 <+7587>: vpmaxsq zmm18,zmm9,zmm2 0x0000000000007d79 <+7593>: vmovdqa64 zmm21,zmm18 0x0000000000007d7f <+7599>: vpminsq zmm21{k4},zmm9,zmm2 0x0000000000007d85 <+7605>: vmovdqa64 zmm2,zmm10 0x0000000000007d8b <+7611>: vpermt2q zmm2,zmm0,zmm19 0x0000000000007d91 <+7617>: vpmaxsq zmm10,zmm19,zmm2 0x0000000000007d97 <+7623>: vpminsq zmm10{k4},zmm19,zmm2 0x0000000000007d9d <+7629>: vpermt2q zmm12,zmm0,zmm25 0x0000000000007da3 <+7635>: vpermi2q zmm0,zmm20,zmm14 0x0000000000007da9 <+7641>: vpmaxsq zmm22,zmm14,zmm0 0x0000000000007daf <+7647>: vmovdqa64 zmm20,zmm22 0x0000000000007db5 <+7653>: vpminsq zmm20{k4},zmm14,zmm0 0x0000000000007dbb <+7659>: vpmaxsq zmm14,zmm25,zmm12 0x0000000000007dc1 <+7665>: vmovdqa64 zmm23,zmm14 0x0000000000007dc7 <+7671>: vpminsq zmm23{k4},zmm25,zmm12 0x0000000000007dcd <+7677>: vpminsq zmm0,zmm21,zmm24 0x0000000000007dd3 <+7683>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm0 0x0000000000007ddb <+7691>: vpmaxsq zmm0,zmm21,zmm24 0x0000000000007de1 <+7697>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm0 0x0000000000007de9 <+7705>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x59c4d] # 0x61a40 0x0000000000007df3 <+7715>: vpxor xmm2,xmm2,xmm2 0x0000000000007df7 <+7719>: vpermq zmm2,zmm19,zmm31 0x0000000000007dfd <+7725>: vpmaxsq zmm9,zmm31,zmm2 0x0000000000007e03 <+7731>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59673] # 0x61480 0x0000000000007e0d <+7741>: vpermt2q zmm21,zmm0,zmm9 0x0000000000007e13 <+7747>: vpminsq zmm9{k4},zmm31,zmm2 0x0000000000007e19 <+7753>: vmovdqa64 zmm2,zmm15 0x0000000000007e1f <+7759>: vpermt2q zmm2,zmm11,zmm26 0x0000000000007e25 <+7765>: vpminsq zmm1,zmm20,zmm2 0x0000000000007e2b <+7771>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm1 0x0000000000007e33 <+7779>: vpmaxsq zmm12,zmm20,zmm2 0x0000000000007e39 <+7785>: vpxord xmm16,xmm16,xmm16 0x0000000000007e3f <+7791>: vpermq zmm16,zmm19,zmm17 0x0000000000007e45 <+7797>: vpmaxsq zmm24,zmm17,zmm16 0x0000000000007e4b <+7803>: vpermt2q zmm20,zmm0,zmm24 0x0000000000007e51 <+7809>: vmovdqa64 zmm25,zmm0 0x0000000000007e57 <+7815>: vpminsq zmm24{k4},zmm17,zmm16 0x0000000000007e5d <+7821>: vpxord xmm16,xmm16,xmm16 0x0000000000007e63 <+7827>: vpermq zmm16,zmm19,zmm13 0x0000000000007e69 <+7833>: vpmaxsq zmm30,zmm13,zmm16 0x0000000000007e6f <+7839>: vmovdqa64 zmm17,zmm7 0x0000000000007e75 <+7845>: vpermt2q zmm17,zmm11,zmm30 0x0000000000007e7b <+7851>: vpminsq zmm30{k4},zmm13,zmm16 0x0000000000007e81 <+7857>: vpermq zmm13,zmm19,zmm28 0x0000000000007e87 <+7863>: vpmaxsq zmm31,zmm28,zmm13 0x0000000000007e8d <+7869>: vpermi2q zmm11,zmm4,zmm31 0x0000000000007e93 <+7875>: vpminsq zmm31{k4},zmm28,zmm13 0x0000000000007e99 <+7881>: vmovdqa64 zmm0,zmm31 0x0000000000007e9f <+7887>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59397] # 0x61240 0x0000000000007ea9 <+7897>: vpermt2q zmm0,zmm1,zmm14 0x0000000000007eaf <+7903>: vpminsq zmm28,zmm10,zmm17 0x0000000000007eb5 <+7909>: vpmaxsq zmm17,zmm10,zmm17 0x0000000000007ebb <+7915>: vpermi2q zmm1,zmm30,zmm10 0x0000000000007ec1 <+7921>: vpermt2q zmm10,zmm25,zmm18 0x0000000000007ec7 <+7927>: vpminsq zmm2,zmm23,zmm11 0x0000000000007ecd <+7933>: vpmaxsq zmm19,zmm23,zmm11 0x0000000000007ed3 <+7939>: vpermt2q zmm23,zmm25,zmm22 0x0000000000007ed9 <+7945>: vpminsq zmm14,zmm15,zmm20 0x0000000000007edf <+7951>: vpmaxsq zmm27,zmm15,zmm20 0x0000000000007ee5 <+7957>: vpminsq zmm11,zmm4,zmm23 0x0000000000007eeb <+7963>: vpmaxsq zmm4,zmm4,zmm23 0x0000000000007ef1 <+7969>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm4 0x0000000000007ef9 <+7977>: vpminsq zmm15,zmm7,zmm10 0x0000000000007eff <+7983>: vpmaxsq zmm7,zmm7,zmm10 0x0000000000007f05 <+7989>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm7 0x0000000000007f0d <+7997>: vpminsq zmm23,zmm3,zmm21 0x0000000000007f13 <+8003>: vpmaxsq zmm25,zmm3,zmm21 0x0000000000007f19 <+8009>: vpblendmq zmm10{k7},zmm14,zmm27 0x0000000000007f1f <+8015>: vpblendmq zmm16{k7},zmm11,zmm4 0x0000000000007f25 <+8021>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm16 0x0000000000007f2d <+8029>: vpblendmq zmm29{k7},zmm15,zmm7 0x0000000000007f33 <+8035>: vpblendmq zmm26{k7},zmm23,zmm25 0x0000000000007f39 <+8041>: vmovdqa64 zmm20,ZMMWORD PTR [rsp+0x300] 0x0000000000007f41 <+8049>: vmovdqa64 zmm3,zmm20 0x0000000000007f47 <+8055>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x593ef] # 0x61340 0x0000000000007f51 <+8065>: vpermt2q zmm3,zmm7,ZMMWORD PTR [rsp+0x2c0] 0x0000000000007f59 <+8073>: vmovdqa64 zmm13,ZMMWORD PTR [rsp+0x280] 0x0000000000007f61 <+8081>: vmovdqa64 zmm4,zmm13 0x0000000000007f67 <+8087>: vpermt2q zmm4,zmm7,ZMMWORD PTR [rsp+0x3c0] 0x0000000000007f6f <+8095>: vpmaxsq zmm22,zmm13,zmm4 0x0000000000007f75 <+8101>: vpmaxsq zmm3,zmm20,zmm3 0x0000000000007f7b <+8107>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm3 0x0000000000007f83 <+8115>: vpmaxsq zmm20,zmm30,zmm1 0x0000000000007f89 <+8121>: vpmaxsq zmm13,zmm31,zmm0 0x0000000000007f8f <+8127>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59d67] # 0x61d00 0x0000000000007f99 <+8137>: vmovdqa64 zmm21,zmm22 0x0000000000007f9f <+8143>: vpermt2q zmm21,zmm4,zmm20 0x0000000000007fa5 <+8149>: mov al,0x16 0x0000000000007fa7 <+8151>: kmovd k1,eax 0x0000000000007fab <+8155>: vshufi64x2 zmm21{k1},zmm15,zmm28,0xee 0x0000000000007fb2 <+8162>: vmovdqa64 zmm18,zmm28 0x0000000000007fb8 <+8168>: vpermi2q zmm4,zmm3,zmm13 0x0000000000007fbe <+8174>: vshufi64x2 zmm4{k1},zmm11,zmm2,0xee 0x0000000000007fc5 <+8181>: vmovdqa64 zmm0,zmm9 0x0000000000007fcb <+8187>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x591eb] # 0x611c0 0x0000000000007fd5 <+8197>: vpermt2q zmm0,zmm1,zmm5 0x0000000000007fdb <+8203>: vpermi2q zmm1,zmm24,zmm8 0x0000000000007fe1 <+8209>: vpmaxsq zmm28,zmm9,zmm0 0x0000000000007fe7 <+8215>: vextracti32x4 xmm3,ymm28,0x1 0x0000000000007fee <+8222>: kmovw k1,WORD PTR [rsp+0x540] 0x0000000000007ff7 <+8231>: vinserti64x2 zmm21{k1},zmm0,xmm3,0x0 0x0000000000007ffe <+8238>: vpmaxsq zmm31,zmm24,zmm1 0x0000000000008004 <+8244>: vextracti32x4 xmm3,ymm31,0x1 0x000000000000800b <+8251>: vinserti64x2 zmm4{k1},zmm0,xmm3,0x0 0x0000000000008012 <+8258>: vmovdqa64 zmm8,zmm28 0x0000000000008018 <+8264>: vpminsq zmm8{k5},zmm9,zmm0 0x000000000000801e <+8270>: vmovdqa64 zmm0,zmm31 0x0000000000008024 <+8276>: vpminsq zmm0{k5},zmm24,zmm1 0x000000000000802a <+8282>: vmovdqa64 zmm7,zmm23 0x0000000000008030 <+8288>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x59ac6] # 0x61b00 0x000000000000803a <+8298>: vpermt2q zmm23,zmm9,zmm28 0x0000000000008040 <+8304>: vbroadcasti32x4 zmm30,XMMWORD PTR [rip+0x5b616] # 0x63660 0x000000000000804a <+8314>: vpermt2q zmm7,zmm30,zmm15 0x0000000000008050 <+8320>: vpermi2q zmm30,zmm14,zmm11 0x0000000000008056 <+8326>: vpermt2q zmm14,zmm9,zmm31 0x000000000000805c <+8332>: vmovdqa64 zmm28,zmm8 0x0000000000008062 <+8338>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59294] # 0x61300 0x000000000000806c <+8348>: vpermt2q zmm28,zmm3,zmm26 0x0000000000008072 <+8354>: vmovdqa64 zmm24,zmm10 0x0000000000008078 <+8360>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm10 0x0000000000008080 <+8368>: vpermi2q zmm3,zmm0,zmm10 0x0000000000008086 <+8374>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x59ab0] # 0x61b40 0x0000000000008090 <+8384>: vpermt2q zmm3,zmm15,zmm12 0x0000000000008096 <+8390>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59ae0] # 0x61b80 0x00000000000080a0 <+8400>: vmovdqa64 zmm10,zmm19 0x00000000000080a6 <+8406>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm19 0x00000000000080ae <+8414>: vpermt2q zmm3,zmm1,zmm19 0x00000000000080b4 <+8420>: vpminsq zmm1,zmm0,zmm3 0x00000000000080ba <+8426>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm1 0x00000000000080c2 <+8434>: vpmaxsq zmm1,zmm0,zmm3 0x00000000000080c8 <+8440>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm1 0x00000000000080d0 <+8448>: vmovdqa64 zmm11,zmm0 0x00000000000080d6 <+8454>: vpermt2q zmm11,zmm9,zmm6 0x00000000000080dc <+8460>: kmovw k1,WORD PTR [rsp+0x240] 0x00000000000080e5 <+8469>: vshufi64x2 zmm11{k1},zmm27,zmm12,0x44 0x00000000000080ec <+8476>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x500] 0x00000000000080f4 <+8484>: vpermt2q zmm28,zmm15,zmm1 0x00000000000080fa <+8490>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59afc] # 0x61c00 0x0000000000008104 <+8500>: vmovdqa64 zmm19,ZMMWORD PTR [rsp+0x340] 0x000000000000810c <+8508>: vmovdqa64 zmm5,zmm19 0x0000000000008112 <+8514>: vpermt2q zmm5,zmm0,zmm26 0x0000000000008118 <+8520>: vpermi2q zmm0,zmm6,zmm24 0x000000000000811e <+8526>: vmovdqa64 zmm24,ZMMWORD PTR [rip+0x59b18] # 0x61c40 0x0000000000008128 <+8536>: vpermt2q zmm0,zmm24,zmm16 0x000000000000812e <+8542>: vpmaxsq zmm27,zmm6,zmm0 0x0000000000008134 <+8548>: vmovdqa64 zmm15,zmm27 0x000000000000813a <+8554>: kmovw k6,WORD PTR [rsp+0x400] 0x0000000000008143 <+8563>: vpminsq zmm15{k6},zmm6,zmm0 0x0000000000008149 <+8569>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59b6d] # 0x61cc0 0x0000000000008153 <+8579>: vmovdqa64 zmm3,zmm12 0x0000000000008159 <+8585>: vpermt2q zmm3,zmm0,zmm6 0x000000000000815f <+8591>: vpermt2q zmm5,zmm24,zmm29 0x0000000000008165 <+8597>: vpmaxsq zmm31,zmm19,zmm5 0x000000000000816b <+8603>: vmovdqa64 zmm6,zmm31 0x0000000000008171 <+8609>: vpminsq zmm6{k6},zmm19,zmm5 0x0000000000008177 <+8615>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm6 0x000000000000817f <+8623>: vpermi2q zmm0,zmm1,zmm19 0x0000000000008185 <+8629>: vpermi2q zmm9,zmm8,zmm19 0x000000000000818b <+8635>: vshufi64x2 zmm9{k1},zmm25,zmm1,0x44 0x0000000000008192 <+8642>: vmovdqa64 zmm6,zmm1 0x0000000000008198 <+8648>: mov al,0xe8 0x000000000000819a <+8650>: kmovd k1,eax 0x000000000000819e <+8654>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x4c0] 0x00000000000081a6 <+8662>: vshufi64x2 zmm5,zmm1,zmm17,0x44 0x00000000000081ad <+8669>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59ac9] # 0x61c80 0x00000000000081b7 <+8679>: vpermt2q zmm5,zmm1,zmm20 0x00000000000081bd <+8685>: vmovdqa64 zmm0{k1},zmm5 0x00000000000081c3 <+8691>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x440] 0x00000000000081cb <+8699>: vpblendmq zmm25{k5},zmm12,zmm1 0x00000000000081d1 <+8705>: vpblendmq zmm5{k5},zmm17,zmm18 0x00000000000081d7 <+8711>: vmovdqa64 zmm19,ZMMWORD PTR [rsp+0x380] 0x00000000000081df <+8719>: vpblendmq zmm12{k5},zmm6,zmm19 0x00000000000081e5 <+8725>: vpblendmq zmm18{k5},zmm10,zmm2 0x00000000000081eb <+8731>: mov al,0xe0 0x00000000000081ed <+8733>: kmovd k2,eax 0x00000000000081f1 <+8737>: vpmaxsq zmm16,zmm29,zmm0 0x00000000000081f7 <+8743>: vmovdqa64 zmm6,zmm16 0x00000000000081fd <+8749>: vpminsq zmm6{k2},zmm29,zmm0 0x0000000000008203 <+8755>: vmovdqa64 zmm0,zmm22 0x0000000000008209 <+8761>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x599ad] # 0x61bc0 0x0000000000008213 <+8771>: vpermt2q zmm0,zmm2,zmm29 0x0000000000008219 <+8777>: vshufi64x2 zmm23,zmm23,zmm19,0xe4 0x0000000000008220 <+8784>: vmovdqa64 zmm23{k1},zmm0 0x0000000000008226 <+8790>: vpmaxsq zmm29,zmm5,zmm21 0x000000000000822c <+8796>: vpminsq zmm29{k1},zmm5,zmm21 0x0000000000008232 <+8802>: vpminsq zmm19,zmm12,zmm23 0x0000000000008238 <+8808>: vpmaxsq zmm24,zmm12,zmm23 0x000000000000823e <+8814>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x59878] # 0x61ac0 0x0000000000008248 <+8824>: vpermt2q zmm12,zmm23,zmm5 0x000000000000824e <+8830>: kmovw k3,WORD PTR [rsp+0x640] 0x0000000000008257 <+8839>: vmovdqa64 zmm12{k3},zmm22 0x000000000000825d <+8845>: vpmaxsq zmm0,zmm22,zmm12 0x0000000000008263 <+8851>: vmovdqa64 ZMMWORD PTR [rsp+0x800],zmm0 0x000000000000826b <+8859>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5990b] # 0x61b80 0x0000000000008275 <+8869>: vpermt2q zmm28,zmm0,zmm17 0x000000000000827b <+8875>: vshufi64x2 zmm0,zmm17,zmm7,0xee 0x0000000000008282 <+8882>: vmovdqa64 zmm0{k3},zmm20 0x0000000000008288 <+8888>: vpmaxsq zmm10,zmm20,zmm0 0x000000000000828e <+8894>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59d68] # 0x62000 0x0000000000008298 <+8904>: vmovdqa64 zmm12,zmm10 0x000000000000829e <+8910>: vpermt2q zmm12,zmm5,zmm16 0x00000000000082a4 <+8916>: vpmaxsq zmm17,zmm18,zmm4 0x00000000000082aa <+8922>: vpminsq zmm17{k1},zmm18,zmm4 0x00000000000082b0 <+8928>: vpermi2q zmm23,zmm25,zmm18 0x00000000000082b6 <+8934>: vshufi64x2 zmm0,zmm14,zmm1,0xe4 0x00000000000082bd <+8941>: vmovdqa64 zmm7,ZMMWORD PTR [rsp+0x7c0] 0x00000000000082c5 <+8949>: vmovdqa64 zmm14,ZMMWORD PTR [rsp+0x2c0] 0x00000000000082cd <+8957>: vpermi2q zmm2,zmm14,zmm7 0x00000000000082d3 <+8963>: vmovdqa64 zmm0{k1},zmm2 0x00000000000082d9 <+8969>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x600] 0x00000000000082e1 <+8977>: vshufi64x2 zmm4,zmm1,zmm30,0xee 0x00000000000082e8 <+8984>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x480] 0x00000000000082f0 <+8992>: vshufi64x2 zmm1,zmm2,zmm1,0x44 0x00000000000082f7 <+8999>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5997f] # 0x61c80 0x0000000000008301 <+9009>: vpermt2q zmm1,zmm2,zmm13 0x0000000000008307 <+9015>: vmovdqa64 zmm3{k1},zmm1 0x000000000000830d <+9021>: vmovdqa64 zmm23{k3},zmm14 0x0000000000008313 <+9027>: vmovdqa64 zmm18,zmm14 0x0000000000008319 <+9033>: vmovdqa64 zmm4{k3},zmm13 0x000000000000831f <+9039>: kmovw k3,WORD PTR [rsp+0x5c0] 0x0000000000008328 <+9048>: vpermq zmm11{k3},zmm13,0x55 0x000000000000832f <+9055>: vpermq zmm9{k3},zmm20,0x55 0x0000000000008336 <+9062>: vpminsq zmm14,zmm25,zmm0 0x000000000000833c <+9068>: vpmaxsq zmm2,zmm25,zmm0 0x0000000000008342 <+9074>: vpminsq zmm25,zmm8,zmm28 0x0000000000008348 <+9080>: vpmaxsq zmm20,zmm8,zmm28 0x000000000000834e <+9086>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm20 0x0000000000008356 <+9094>: vpminsq zmm16,zmm26,zmm9 0x000000000000835c <+9100>: vpmaxsq zmm1,zmm26,zmm9 0x0000000000008362 <+9106>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x580] 0x000000000000836a <+9114>: vpminsq zmm22,zmm0,zmm11 0x0000000000008370 <+9120>: vpmaxsq zmm8,zmm0,zmm11 0x0000000000008376 <+9126>: vpblendmq zmm9{k6},zmm20,zmm25 0x000000000000837c <+9132>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm9 0x0000000000008384 <+9140>: kmovw WORD PTR [rsp+0x540],k2 0x000000000000838d <+9149>: vmovdqa64 zmm1{k2},zmm16 0x0000000000008393 <+9155>: vpmaxsq zmm26,zmm13,zmm4 0x0000000000008399 <+9161>: vpmaxsq zmm20,zmm7,zmm3 0x000000000000839f <+9167>: vpermi2q zmm5,zmm26,zmm20 0x00000000000083a5 <+9173>: vpminsq zmm20{k2},zmm7,zmm3 0x00000000000083ab <+9179>: vmovdqa64 zmm30,ZMMWORD PTR [rsp+0x3c0] 0x00000000000083b3 <+9187>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x280] 0x00000000000083bb <+9195>: vpblendmq zmm21{k6},zmm30,zmm11 0x00000000000083c1 <+9201>: vpmaxsq zmm4,zmm18,zmm23 0x00000000000083c7 <+9207>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x599af] # 0x61d80 0x00000000000083d1 <+9217>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59a65] # 0x61e40 0x00000000000083db <+9227>: vpermt2q zmm31,zmm3,zmm16 0x00000000000083e1 <+9233>: vmovdqa64 zmm13,zmm9 0x00000000000083e7 <+9239>: vpermt2q zmm13,zmm0,zmm19 0x00000000000083ed <+9245>: vpermi2q zmm0,zmm21,zmm14 0x00000000000083f3 <+9251>: vpblendmq zmm18{k1},zmm2,zmm14 0x00000000000083f9 <+9257>: vpblendmq zmm19{k1},zmm24,zmm19 0x00000000000083ff <+9263>: vmovdqa64 zmm8{k2},zmm22 0x0000000000008405 <+9269>: vpermt2q zmm27,zmm3,zmm22 0x000000000000840b <+9275>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x59a6b] # 0x61e80 0x0000000000008415 <+9285>: vmovdqa64 zmm23,zmm6 0x000000000000841b <+9291>: vpermt2q zmm23,zmm16,zmm10 0x0000000000008421 <+9297>: mov al,0x32 0x0000000000008423 <+9299>: kmovd k1,eax 0x0000000000008427 <+9303>: vmovdqa64 zmm23{k1},zmm31 0x000000000000842d <+9309>: vpermi2q zmm16,zmm20,zmm26 0x0000000000008433 <+9315>: vmovdqa64 zmm16{k1},zmm27 0x0000000000008439 <+9321>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x59a7d] # 0x61ec0 0x0000000000008443 <+9331>: vmovdqa64 zmm7,zmm18 0x0000000000008449 <+9337>: vpermt2q zmm7,zmm22,zmm26 0x000000000000844f <+9343>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59aa7] # 0x61f00 0x0000000000008459 <+9353>: vpermt2q zmm7,zmm3,zmm4 0x000000000000845f <+9359>: vpermi2q zmm22,zmm19,zmm10 0x0000000000008465 <+9365>: vmovdqa64 zmm31,zmm10 0x000000000000846b <+9371>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x800] 0x0000000000008473 <+9379>: vpermt2q zmm22,zmm3,zmm9 0x0000000000008479 <+9385>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x59abd] # 0x61f40 0x0000000000008483 <+9395>: vmovdqa64 zmm28,ZMMWORD PTR [rsp+0x300] 0x000000000000848b <+9403>: vmovdqa64 zmm10,zmm28 0x0000000000008491 <+9409>: vpermt2q zmm10,zmm14,zmm25 0x0000000000008497 <+9415>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59adf] # 0x61f80 0x00000000000084a1 <+9425>: vpermt2q zmm10,zmm3,zmm24 0x00000000000084a7 <+9431>: vpermi2q zmm14,zmm15,zmm11 0x00000000000084ad <+9437>: vpermt2q zmm14,zmm3,zmm2 0x00000000000084b3 <+9443>: vmovdqa64 zmm24,ZMMWORD PTR [rip+0x59bc3] # 0x62080 0x00000000000084bd <+9453>: vmovdqa64 zmm11,zmm15 0x00000000000084c3 <+9459>: vpermt2q zmm11,zmm24,zmm30 0x00000000000084c9 <+9465>: mov al,0x88 0x00000000000084cb <+9467>: kmovd k6,eax 0x00000000000084cf <+9471>: vpmaxsq zmm2,zmm20,zmm16 0x00000000000084d5 <+9477>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm2 0x00000000000084dd <+9485>: vpminsq zmm2{k6},zmm20,zmm16 0x00000000000084e3 <+9491>: mov al,0x6c 0x00000000000084e5 <+9493>: kmovd k1,eax 0x00000000000084e9 <+9497>: vpblendmq zmm3{k1},zmm8,zmm5 0x00000000000084ef <+9503>: vpminsq zmm16,zmm8,zmm3 0x00000000000084f5 <+9509>: vmovdqa64 ZMMWORD PTR [rsp+0x780],zmm16 0x00000000000084fd <+9517>: vpmaxsq zmm27,zmm8,zmm3 0x0000000000008503 <+9523>: vmovdqa64 zmm25,zmm8 0x0000000000008509 <+9529>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x5982d] # 0x61d40 0x0000000000008513 <+9539>: vpermt2q zmm25,zmm5,zmm20 0x0000000000008519 <+9545>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x59b1d] # 0x62040 0x0000000000008523 <+9555>: vpermt2q zmm11,zmm8,zmm20 0x0000000000008529 <+9561>: vpermi2q zmm5,zmm1,zmm6 0x000000000000852f <+9567>: vpblendmq zmm3{k1},zmm1,zmm12 0x0000000000008535 <+9573>: vpminsq zmm12,zmm1,zmm3 0x000000000000853b <+9579>: vmovdqa64 ZMMWORD PTR [rsp+0x900],zmm12 0x0000000000008543 <+9587>: vpmaxsq zmm30,zmm1,zmm3 0x0000000000008549 <+9593>: mov al,0x8 0x000000000000854b <+9595>: kmovd k2,eax 0x000000000000854f <+9599>: vpmaxsq zmm1,zmm9,zmm22 0x0000000000008555 <+9605>: vmovdqa64 ZMMWORD PTR [rsp+0xb00],zmm1 0x000000000000855d <+9613>: vpminsq zmm1{k2},zmm9,zmm22 0x0000000000008563 <+9619>: vmovdqa64 ZMMWORD PTR [rsp+0x5c0],zmm1 0x000000000000856b <+9627>: vpmaxsq zmm22,zmm4,zmm7 0x0000000000008571 <+9633>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm22 0x0000000000008579 <+9641>: vpminsq zmm22{k2},zmm4,zmm7 0x000000000000857f <+9647>: vpmaxsq zmm7,zmm6,zmm23 0x0000000000008585 <+9653>: vmovdqa64 ZMMWORD PTR [rsp+0x9c0],zmm7 0x000000000000858d <+9661>: vpminsq zmm7{k6},zmm6,zmm23 0x0000000000008593 <+9667>: mov al,0x40 0x0000000000008595 <+9669>: mov cl,0xc9 0x0000000000008597 <+9671>: kmovd k2,ecx 0x000000000000859b <+9675>: vmovdqa64 zmm13{k2},zmm29 0x00000000000085a1 <+9681>: vmovdqa64 zmm0{k2},zmm17 0x00000000000085a7 <+9687>: kmovd k5,eax 0x00000000000085ab <+9691>: vmovdqa64 zmm1,zmm26 0x00000000000085b1 <+9697>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm26 0x00000000000085b9 <+9705>: vmovdqa64 zmm25{k5},zmm26 0x00000000000085bf <+9711>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm31 0x00000000000085c7 <+9719>: vmovdqa64 zmm5{k5},zmm31 0x00000000000085cd <+9725>: vpermt2q zmm5,zmm8,zmm9 0x00000000000085d3 <+9731>: vpermt2q zmm25,zmm8,zmm4 0x00000000000085d9 <+9737>: vmovdqa64 zmm3,zmm8 0x00000000000085df <+9743>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x599d7] # 0x61fc0 0x00000000000085e9 <+9753>: vpermt2q zmm14,zmm8,zmm17 0x00000000000085ef <+9759>: vmovdqa64 zmm23,zmm8 0x00000000000085f5 <+9765>: vmovdqa64 zmm27{k1},zmm16 0x00000000000085fb <+9771>: mov al,0x13 0x00000000000085fd <+9773>: vpmaxsq zmm26,zmm17,zmm0 0x0000000000008603 <+9779>: vpmaxsq zmm20,zmm29,zmm13 0x0000000000008609 <+9785>: vmovdqa64 zmm30{k1},zmm12 0x000000000000860f <+9791>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59b67] # 0x62180 0x0000000000008619 <+9801>: vmovdqa64 zmm8,zmm7 0x000000000000861f <+9807>: vpermt2q zmm8,zmm0,zmm20 0x0000000000008625 <+9813>: mov cl,0x64 0x0000000000008627 <+9815>: kmovd k1,ecx 0x000000000000862b <+9819>: vpmaxsq zmm16,zmm31,zmm5 0x0000000000008631 <+9825>: vmovdqa64 zmm8{k1},zmm16 0x0000000000008637 <+9831>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm8 0x000000000000863f <+9839>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm16 0x0000000000008647 <+9847>: vpermi2q zmm0,zmm2,zmm26 0x000000000000864d <+9853>: vpmaxsq zmm1,zmm1,zmm25 0x0000000000008653 <+9859>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm1 0x000000000000865b <+9867>: vmovdqa64 zmm0{k1},zmm1 0x0000000000008661 <+9873>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm0 0x0000000000008669 <+9881>: kmovd k1,eax 0x000000000000866d <+9885>: vpminsq zmm8,zmm21,zmm14 0x0000000000008673 <+9891>: vmovdqa64 zmm1,zmm8 0x0000000000008679 <+9897>: vpmaxsq zmm1{k1},zmm21,zmm14 0x000000000000867f <+9903>: vpermt2q zmm10,zmm23,zmm29 0x0000000000008685 <+9909>: vmovdqa64 zmm14,ZMMWORD PTR [rsp+0x4c0] 0x000000000000868d <+9917>: vpmaxsq zmm31,zmm14,zmm10 0x0000000000008693 <+9923>: vpminsq zmm13,zmm14,zmm10 0x0000000000008699 <+9929>: vmovdqa64 zmm10,zmm14 0x000000000000869f <+9935>: mov al,0x31 0x00000000000086a1 <+9937>: vpblendmq zmm14{k1},zmm13,zmm31 0x00000000000086a7 <+9943>: kmovd k1,eax 0x00000000000086ab <+9947>: vpminsq zmm23,zmm15,zmm11 0x00000000000086b1 <+9953>: vmovdqa64 ZMMWORD PTR [rsp+0xac0],zmm23 0x00000000000086b9 <+9961>: vpmaxsq zmm23{k1},zmm15,zmm11 0x00000000000086bf <+9967>: kmovq k7,k1 0x00000000000086c4 <+9972>: kmovw WORD PTR [rsp+0xb40],k1 0x00000000000086cd <+9981>: vpermi2q zmm24,zmm28,ZMMWORD PTR [rsp+0x240] 0x00000000000086d5 <+9989>: vpermt2q zmm24,zmm3,zmm6 0x00000000000086db <+9995>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x599db] # 0x620c0 0x00000000000086e5 <+10005>: vpermi2q zmm3,zmm23,zmm27 0x00000000000086eb <+10011>: mov al,0x2 0x00000000000086ed <+10013>: vpminsq zmm0,zmm28,zmm24 0x00000000000086f3 <+10019>: kmovd k1,eax 0x00000000000086f7 <+10023>: kmovw WORD PTR [rsp+0x280],k1 0x0000000000008700 <+10032>: vmovdqa64 zmm3{k1},zmm0 0x0000000000008706 <+10038>: mov al,0x51 0x0000000000008708 <+10040>: vpminsq zmm28,zmm23,zmm3 0x000000000000870e <+10046>: vmovdqa64 ZMMWORD PTR [rsp+0x640],zmm28 0x0000000000008716 <+10054>: kmovd k1,eax 0x000000000000871a <+10058>: vpmaxsq zmm28{k1},zmm23,zmm3 0x0000000000008720 <+10064>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x596d6] # 0x61e00 0x000000000000872a <+10074>: vpermt2q zmm9,zmm6,zmm29 0x0000000000008730 <+10080>: vpermi2q zmm6,zmm4,zmm17 0x0000000000008736 <+10086>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x59680] # 0x61dc0 0x0000000000008740 <+10096>: vmovdqa64 zmm12,zmm19 0x0000000000008746 <+10102>: vpermt2q zmm12,zmm11,zmm10 0x000000000000874c <+10108>: vpermi2q zmm11,zmm18,zmm21 0x0000000000008752 <+10114>: mov al,0x4c 0x0000000000008754 <+10116>: kmovd k1,eax 0x0000000000008758 <+10120>: vmovdqa64 zmm11{k1},zmm6 0x000000000000875e <+10126>: vpmaxsq zmm4,zmm18,zmm11 0x0000000000008764 <+10132>: vmovdqa64 zmm6,zmm4 0x000000000000876a <+10138>: vpminsq zmm6{k1},zmm18,zmm11 0x0000000000008770 <+10144>: vmovdqa64 zmm12{k1},zmm9 0x0000000000008776 <+10150>: vpmaxsq zmm9,zmm19,zmm12 0x000000000000877c <+10156>: vmovdqa64 zmm3,zmm9 0x0000000000008782 <+10162>: vpminsq zmm3{k1},zmm19,zmm12 0x0000000000008788 <+10168>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x59c6e] # 0x62400 0x0000000000008792 <+10178>: vpermt2q zmm8,zmm11,zmm6 0x0000000000008798 <+10184>: vpermt2q zmm13,zmm11,zmm3 0x000000000000879e <+10190>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x59c98] # 0x62440 0x00000000000087a8 <+10200>: vpermt2q zmm8,zmm11,zmm26 0x00000000000087ae <+10206>: vpermt2q zmm13,zmm11,zmm20 0x00000000000087b4 <+10212>: vpminsq zmm11,zmm3,zmm13 0x00000000000087ba <+10218>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm11 0x00000000000087c2 <+10226>: vpmaxsq zmm13,zmm3,zmm13 0x00000000000087c8 <+10232>: vmovdqa64 ZMMWORD PTR [rsp+0x980],zmm13 0x00000000000087d0 <+10240>: mov al,0xc4 0x00000000000087d2 <+10242>: vpminsq zmm12,zmm6,zmm8 0x00000000000087d8 <+10248>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm12 0x00000000000087e0 <+10256>: vpmaxsq zmm17,zmm6,zmm8 0x00000000000087e6 <+10262>: kmovd k2,eax 0x00000000000087ea <+10266>: vpblendmq zmm8{k2},zmm13,zmm11 0x00000000000087f0 <+10272>: vmovdqa64 ZMMWORD PTR [rsp+0x800],zmm8 0x00000000000087f8 <+10280>: vpblendmq zmm19{k2},zmm17,zmm12 0x00000000000087fe <+10286>: vmovdqa64 ZMMWORD PTR [rsp+0x880],zmm19 0x0000000000008806 <+10294>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x59ab0] # 0x622c0 0x0000000000008810 <+10304>: vmovdqa64 zmm12,zmm30 0x0000000000008816 <+10310>: vpermt2q zmm12,zmm8,zmm7 0x000000000000881c <+10316>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x59ada] # 0x62300 0x0000000000008826 <+10326>: vpermt2q zmm12,zmm13,zmm16 0x000000000000882c <+10332>: vpmaxsq zmm11,zmm7,zmm12 0x0000000000008832 <+10338>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm11 0x000000000000883a <+10346>: vpminsq zmm11{k1},zmm7,zmm12 0x0000000000008840 <+10352>: vpermi2q zmm8,zmm27,zmm2 0x0000000000008846 <+10358>: vpermt2q zmm8,zmm13,ZMMWORD PTR [rsp+0x340] 0x000000000000884e <+10366>: vpmaxsq zmm7,zmm2,zmm8 0x0000000000008854 <+10372>: vmovdqa64 zmm10,zmm7 0x000000000000885a <+10378>: vmovdqa64 zmm15,zmm7 0x0000000000008860 <+10384>: vmovdqa64 ZMMWORD PTR [rsp+0x8c0],zmm7 0x0000000000008868 <+10392>: vpminsq zmm10{k1},zmm2,zmm8 0x000000000000886e <+10398>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x59948] # 0x621c0 0x0000000000008878 <+10408>: vpermi2q zmm2,zmm22,zmm26 0x000000000000887e <+10414>: vmovdqa64 zmm29,ZMMWORD PTR [rsp+0xb00] 0x0000000000008886 <+10422>: vmovdqa64 zmm2{k5},zmm29 0x000000000000888c <+10428>: mov al,0x4a 0x000000000000888e <+10430>: vpmaxsq zmm7,zmm22,zmm2 0x0000000000008894 <+10436>: vmovdqa64 zmm16,zmm7 0x000000000000889a <+10442>: vmovdqa64 zmm18,zmm7 0x00000000000088a0 <+10448>: kmovd k1,eax 0x00000000000088a4 <+10452>: vpminsq zmm16{k1},zmm22,zmm2 0x00000000000088aa <+10458>: mov al,0x11 0x00000000000088ac <+10460>: kmovd k3,eax 0x00000000000088b0 <+10464>: vpblendmq zmm2{k3},zmm14,zmm30 0x00000000000088b6 <+10470>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x59700] # 0x61fc0 0x00000000000088c0 <+10480>: vpermt2q zmm2,zmm8,zmm9 0x00000000000088c6 <+10486>: vpblendmq zmm7{k3},zmm1,zmm27 0x00000000000088cc <+10492>: vpermt2q zmm7,zmm8,zmm4 0x00000000000088d2 <+10498>: mov al,0x26 0x00000000000088d4 <+10500>: vpminsq zmm22,zmm14,zmm2 0x00000000000088da <+10506>: vmovdqa64 zmm4,zmm22 0x00000000000088e0 <+10512>: kmovd k2,eax 0x00000000000088e4 <+10516>: vpmaxsq zmm4{k2},zmm14,zmm2 0x00000000000088ea <+10522>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm4 0x00000000000088f2 <+10530>: vpminsq zmm12,zmm1,zmm7 0x00000000000088f8 <+10536>: vmovdqa64 zmm2,zmm12 0x00000000000088fe <+10542>: vpmaxsq zmm2{k2},zmm1,zmm7 0x0000000000008904 <+10548>: vmovdqa64 ZMMWORD PTR [rsp+0x940],zmm2 0x000000000000890c <+10556>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x597ea] # 0x62100 0x0000000000008916 <+10566>: vpermt2q zmm1,zmm2,zmm23 0x000000000000891c <+10572>: vpermi2q zmm2,zmm31,zmm0 0x0000000000008922 <+10578>: mov al,0x20 0x0000000000008924 <+10580>: kmovd k4,eax 0x0000000000008928 <+10584>: vmovdqa64 zmm2{k4},ZMMWORD PTR [rsp+0x900] 0x0000000000008930 <+10592>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59946] # 0x62280 0x000000000000893a <+10602>: vpermt2q zmm2,zmm4,ZMMWORD PTR [rsp+0x9c0] 0x0000000000008942 <+10610>: vmovdqa64 zmm1{k4},ZMMWORD PTR [rsp+0x780] 0x000000000000894a <+10618>: vpermt2q zmm1,zmm4,ZMMWORD PTR [rsp+0x3c0] 0x0000000000008952 <+10626>: vpmaxsq zmm0{k7},zmm24,ZMMWORD PTR [rsp+0x300] 0x000000000000895a <+10634>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5989c] # 0x62200 0x0000000000008964 <+10644>: vpermi2q zmm4,zmm0,ZMMWORD PTR [rsp+0xac0] 0x000000000000896c <+10652>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x598ca] # 0x62240 0x0000000000008976 <+10662>: vpermi2q zmm8,zmm4,zmm30 0x000000000000897c <+10668>: mov al,0x8c 0x000000000000897e <+10670>: vpmaxsq zmm14,zmm30,zmm2 0x0000000000008984 <+10676>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm14 0x000000000000898c <+10684>: kmovd k2,eax 0x0000000000008990 <+10688>: vpminsq zmm14{k2},zmm30,zmm2 0x0000000000008996 <+10694>: vpmaxsq zmm13,zmm27,zmm1 0x000000000000899c <+10700>: vmovdqa64 zmm30,zmm13 0x00000000000089a2 <+10706>: vpminsq zmm30{k2},zmm27,zmm1 0x00000000000089a8 <+10712>: vpminsq zmm4,zmm0,zmm8 0x00000000000089ae <+10718>: vpmaxsq zmm23,zmm0,zmm8 0x00000000000089b4 <+10724>: mov al,0xac 0x00000000000089b6 <+10726>: kmovd k7,eax 0x00000000000089ba <+10730>: vmovdqa64 zmm23{k7},zmm4 0x00000000000089c0 <+10736>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59bf6] # 0x625c0 0x00000000000089ca <+10746>: vmovdqa64 zmm31,zmm14 0x00000000000089d0 <+10752>: vpermt2q zmm31,zmm1,zmm23 0x00000000000089d6 <+10758>: vpermi2q zmm1,zmm30,zmm28 0x00000000000089dc <+10764>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59c1a] # 0x62600 0x00000000000089e6 <+10774>: vpermt2q zmm1,zmm0,zmm19 0x00000000000089ec <+10780>: vpbroadcastq zmm0,QWORD PTR [rip+0x5ac8a] # 0x63680 0x00000000000089f6 <+10790>: vpermq zmm1{k5},zmm0,zmm15 0x00000000000089fc <+10796>: vpminsq zmm9,zmm25,ZMMWORD PTR [rsp+0x500] 0x0000000000008a04 <+10804>: vmovdqa64 zmm0,zmm6 0x0000000000008a0a <+10810>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x5972c] # 0x62140 0x0000000000008a14 <+10820>: vpermt2q zmm0,zmm8,zmm26 0x0000000000008a1a <+10826>: vmovdqa64 zmm0{k6},zmm9 0x0000000000008a20 <+10832>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x59916] # 0x62340 0x0000000000008a2a <+10842>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x2c0] 0x0000000000008a32 <+10850>: vpermt2q zmm0,zmm6,zmm2 0x0000000000008a38 <+10856>: vpminsq zmm7,zmm26,zmm0 0x0000000000008a3e <+10862>: vmovdqa64 ZMMWORD PTR [rsp+0x780],zmm7 0x0000000000008a46 <+10870>: vpmaxsq zmm21,zmm26,zmm0 0x0000000000008a4c <+10876>: mov al,0xca 0x0000000000008a4e <+10878>: kmovd k5,eax 0x0000000000008a52 <+10882>: vpblendmq zmm26{k5},zmm21,zmm7 0x0000000000008a58 <+10888>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x59e5e] # 0x628c0 0x0000000000008a62 <+10898>: vpermi2q zmm25,zmm10,zmm26 0x0000000000008a68 <+10904>: vmovdqa64 zmm24,ZMMWORD PTR [rip+0x59e8e] # 0x62900 0x0000000000008a72 <+10914>: vmovdqa64 zmm7,zmm18 0x0000000000008a78 <+10920>: vpermi2q zmm24,zmm25,zmm18 0x0000000000008a7e <+10926>: vextracti32x4 xmm17,ymm17,0x1 0x0000000000008a85 <+10933>: kmovw k1,WORD PTR [rsp+0x280] 0x0000000000008a8e <+10942>: vinserti64x2 zmm24{k1},zmm0,xmm17,0x0 0x0000000000008a95 <+10949>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x599e1] # 0x62480 0x0000000000008a9f <+10959>: vpermi2q zmm25,zmm28,zmm30 0x0000000000008aa5 <+10965>: mov al,0x4 0x0000000000008aa7 <+10967>: kmovd k1,eax 0x0000000000008aab <+10971>: vmovdqa64 zmm25{k1},zmm4 0x0000000000008ab1 <+10977>: vpminsq zmm17,zmm28,zmm25 0x0000000000008ab7 <+10983>: vpmaxsq zmm25,zmm28,zmm25 0x0000000000008abd <+10989>: vmovdqa64 zmm25{k2},zmm17 0x0000000000008ac3 <+10995>: vpminsq zmm4,zmm5,ZMMWORD PTR [rsp+0x380] 0x0000000000008acb <+11003>: vpermi2q zmm8,zmm3,zmm20 0x0000000000008ad1 <+11009>: vmovdqa64 zmm8{k6},zmm4 0x0000000000008ad7 <+11015>: vpermt2q zmm8,zmm6,zmm29 0x0000000000008add <+11021>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59899] # 0x62380 0x0000000000008ae7 <+11031>: vpermi2q zmm3,zmm20,zmm2 0x0000000000008aed <+11037>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x598c9] # 0x623c0 0x0000000000008af7 <+11047>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x5c0] 0x0000000000008aff <+11055>: vpermi2q zmm6,zmm2,zmm3 0x0000000000008b05 <+11061>: vpminsq zmm5,zmm20,zmm8 0x0000000000008b0b <+11067>: vpmaxsq zmm20,zmm20,zmm8 0x0000000000008b11 <+11073>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59a25] # 0x62540 0x0000000000008b1b <+11083>: vpermi2q zmm3,zmm11,ZMMWORD PTR [rsp+0x980] 0x0000000000008b23 <+11091>: vpblendmq zmm27{k5},zmm20,zmm5 0x0000000000008b29 <+11097>: vmovdqa64 zmm3{k6},zmm27 0x0000000000008b2f <+11103>: vpmaxsq zmm29,zmm2,zmm6 0x0000000000008b35 <+11109>: vmovdqa64 zmm28,ZMMWORD PTR [rip+0x59d41] # 0x62880 0x0000000000008b3f <+11119>: vpermi2q zmm28,zmm3,zmm29 0x0000000000008b45 <+11125>: vpminsq zmm19,zmm26,zmm24 0x0000000000008b4b <+11131>: vpmaxsq zmm0,zmm26,zmm24 0x0000000000008b51 <+11137>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm0 0x0000000000008b59 <+11145>: mov al,0x24 0x0000000000008b5b <+11147>: vpminsq zmm24,zmm27,zmm28 0x0000000000008b61 <+11153>: vpmaxsq zmm3,zmm27,zmm28 0x0000000000008b67 <+11159>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm3 0x0000000000008b6f <+11167>: kmovd k2,eax 0x0000000000008b73 <+11171>: vpblendmq zmm28{k2},zmm0,zmm19 0x0000000000008b79 <+11177>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm28 0x0000000000008b81 <+11185>: vpblendmq zmm0{k2},zmm3,zmm24 0x0000000000008b87 <+11191>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x0000000000008b8f <+11199>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x599e7] # 0x62580 0x0000000000008b99 <+11209>: vpermt2q zmm22,zmm3,ZMMWORD PTR [rsp+0x3c0] 0x0000000000008ba1 <+11217>: vmovdqa64 zmm22{k6},zmm11 0x0000000000008ba7 <+11223>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59c4f] # 0x62800 0x0000000000008bb1 <+11233>: vpermi2q zmm0,zmm22,zmm27 0x0000000000008bb7 <+11239>: vpermt2q zmm12,zmm3,zmm13 0x0000000000008bbd <+11245>: vmovdqa64 zmm3,ZMMWORD PTR [rsp+0x600] 0x0000000000008bc5 <+11253>: vpblendmq zmm3{k6},zmm3,zmm4 0x0000000000008bcb <+11259>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x340] 0x0000000000008bd3 <+11267>: vpblendmq zmm4{k6},zmm4,zmm9 0x0000000000008bd9 <+11273>: vpmaxsq zmm18,zmm3,ZMMWORD PTR [rsp+0x480] 0x0000000000008be1 <+11281>: vpmaxsq zmm15,zmm4,ZMMWORD PTR [rsp+0x440] 0x0000000000008be9 <+11289>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59b8d] # 0x62780 0x0000000000008bf3 <+11299>: vpermi2q zmm4,zmm26,zmm10 0x0000000000008bf9 <+11305>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x59bbd] # 0x627c0 0x0000000000008c03 <+11315>: vpermi2q zmm13,zmm4,zmm15 0x0000000000008c09 <+11321>: vmovdqa64 zmm13{k3},zmm12 0x0000000000008c0f <+11327>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59c27] # 0x62840 0x0000000000008c19 <+11337>: vpermi2q zmm4,zmm0,zmm18 0x0000000000008c1f <+11343>: vpminsq zmm0,zmm11,zmm4 0x0000000000008c25 <+11349>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm0 0x0000000000008c2d <+11357>: vpmaxsq zmm22,zmm11,zmm4 0x0000000000008c33 <+11363>: vpminsq zmm3,zmm10,zmm13 0x0000000000008c39 <+11369>: vmovdqa64 ZMMWORD PTR [rsp+0x9c0],zmm3 0x0000000000008c41 <+11377>: vpmaxsq zmm27,zmm10,zmm13 0x0000000000008c47 <+11383>: kmovw k2,WORD PTR [rsp+0x400] 0x0000000000008c50 <+11392>: vpblendmq zmm0{k2},zmm22,zmm0 0x0000000000008c56 <+11398>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm0 0x0000000000008c5e <+11406>: vpblendmq zmm0{k2},zmm27,zmm3 0x0000000000008c64 <+11412>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm0 0x0000000000008c6c <+11420>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5984a] # 0x624c0 0x0000000000008c76 <+11430>: vpermi2q zmm0,zmm16,zmm21 0x0000000000008c7c <+11436>: vmovdqa64 zmm0{k4},zmm29 0x0000000000008c82 <+11442>: vpmaxsq zmm4,zmm16,zmm0 0x0000000000008c88 <+11448>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm4 0x0000000000008c90 <+11456>: vpminsq zmm4{k4},zmm16,zmm0 0x0000000000008c96 <+11462>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm4 0x0000000000008c9e <+11470>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59a98] # 0x62740 0x0000000000008ca8 <+11480>: vpermi2q zmm4,zmm20,zmm7 0x0000000000008cae <+11486>: mov al,0xa 0x0000000000008cb0 <+11488>: vmovdqa64 zmm13,zmm29 0x0000000000008cb6 <+11494>: kmovd k2,eax 0x0000000000008cba <+11498>: kmovw WORD PTR [rsp+0x480],k2 0x0000000000008cc3 <+11507>: vpminsq zmm13{k2},zmm2,zmm6 0x0000000000008cc9 <+11513>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm13 0x0000000000008cd1 <+11521>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x800] 0x0000000000008cd9 <+11529>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5991d] # 0x62600 0x0000000000008ce3 <+11539>: vpermt2q zmm31,zmm0,zmm9 0x0000000000008ce9 <+11545>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5994d] # 0x62640 0x0000000000008cf3 <+11555>: vmovdqa64 zmm3,ZMMWORD PTR [rsp+0x7c0] 0x0000000000008cfb <+11563>: vpermi2q zmm2,zmm31,zmm3 0x0000000000008d01 <+11569>: vpminsq zmm0,zmm30,zmm1 0x0000000000008d07 <+11575>: vmovdqa64 ZMMWORD PTR [rsp+0x900],zmm0 0x0000000000008d0f <+11583>: vpmaxsq zmm28,zmm30,zmm1 0x0000000000008d15 <+11589>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x597e1] # 0x62500 0x0000000000008d1f <+11599>: vmovdqa64 zmm6,ZMMWORD PTR [rsp+0x940] 0x0000000000008d27 <+11607>: vpermt2q zmm30,zmm0,zmm6 0x0000000000008d2d <+11613>: vmovdqa64 zmm21,ZMMWORD PTR [rsp+0x240] 0x0000000000008d35 <+11621>: vpermi2q zmm0,zmm14,zmm21 0x0000000000008d3b <+11627>: vmovdqa64 zmm0{k3},zmm9 0x0000000000008d41 <+11633>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59935] # 0x62680 0x0000000000008d4b <+11643>: vpermt2q zmm0,zmm1,zmm5 0x0000000000008d51 <+11649>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x599a5] # 0x62700 0x0000000000008d5b <+11659>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x780] 0x0000000000008d63 <+11667>: vpermi2q zmm1,zmm5,zmm15 0x0000000000008d69 <+11673>: vmovdqa64 zmm29,ZMMWORD PTR [rsp+0x880] 0x0000000000008d71 <+11681>: vmovdqa64 zmm30{k3},zmm29 0x0000000000008d77 <+11687>: vmovdqa64 zmm30{k6},zmm1 0x0000000000008d7d <+11693>: vpblendmq zmm1{k1},zmm23,ZMMWORD PTR [rsp+0x640] 0x0000000000008d85 <+11701>: kmovq k2,k1 0x0000000000008d8a <+11706>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59c2c] # 0x629c0 0x0000000000008d94 <+11716>: vpermi2q zmm5,zmm1,zmm14 0x0000000000008d9a <+11722>: vpminsq zmm11,zmm23,zmm5 0x0000000000008da0 <+11728>: vpmaxsq zmm31,zmm23,zmm5 0x0000000000008da6 <+11734>: vpminsq zmm12,zmm14,zmm2 0x0000000000008dac <+11740>: vmovdqa64 ZMMWORD PTR [rsp+0x780],zmm12 0x0000000000008db4 <+11748>: vpmaxsq zmm26,zmm14,zmm2 0x0000000000008dba <+11754>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x598fc] # 0x626c0 0x0000000000008dc4 <+11764>: vpermt2q zmm0,zmm1,zmm18 0x0000000000008dca <+11770>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x59b6c] # 0x62940 0x0000000000008dd4 <+11780>: vmovdqa64 zmm5,zmm6 0x0000000000008dda <+11786>: vmovdqa64 zmm8,ZMMWORD PTR [rsp+0x580] 0x0000000000008de2 <+11794>: vpermt2q zmm5,zmm10,zmm8 0x0000000000008de8 <+11800>: vmovdqa64 zmm7,ZMMWORD PTR [rsp+0x4c0] 0x0000000000008df0 <+11808>: vpermi2q zmm10,zmm21,zmm7 0x0000000000008df6 <+11814>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59b80] # 0x62980 0x0000000000008e00 <+11824>: vpermt2q zmm10,zmm1,zmm3 0x0000000000008e06 <+11830>: vmovdqa64 zmm14,zmm1 0x0000000000008e0c <+11836>: vpminsq zmm16,zmm21,zmm10 0x0000000000008e12 <+11842>: vpblendmq zmm1{k6},zmm31,zmm11 0x0000000000008e18 <+11848>: vmovdqa64 ZMMWORD PTR [rsp+0x980],zmm1 0x0000000000008e20 <+11856>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x59c16] # 0x62a40 0x0000000000008e2a <+11866>: vpermt2q zmm11,zmm21,zmm16 0x0000000000008e30 <+11872>: vpmaxsq zmm20,zmm9,zmm0 0x0000000000008e36 <+11878>: vpblendmq zmm12{k5},zmm26,zmm12 0x0000000000008e3c <+11884>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59c3a] # 0x62a80 0x0000000000008e46 <+11894>: vmovdqa64 zmm2,zmm12 0x0000000000008e4c <+11900>: vpermt2q zmm2,zmm1,zmm20 0x0000000000008e52 <+11906>: kmovw k1,WORD PTR [rsp+0xb40] 0x0000000000008e5b <+11915>: vmovdqa64 zmm2{k1},zmm11 0x0000000000008e61 <+11921>: vmovdqa64 zmm23,ZMMWORD PTR [rsp+0x8c0] 0x0000000000008e69 <+11929>: vpermt2q zmm5,zmm14,zmm23 0x0000000000008e6f <+11935>: vpminsq zmm14,zmm6,zmm5 0x0000000000008e75 <+11941>: vpermt2q zmm17,zmm21,zmm14 0x0000000000008e7b <+11947>: vpblendmq zmm4{k1},zmm13,zmm4 0x0000000000008e81 <+11953>: vmovdqa64 ZMMWORD PTR [rsp+0x5c0],zmm4 0x0000000000008e89 <+11961>: vpmaxsq zmm13,zmm29,zmm30 0x0000000000008e8f <+11967>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x900] 0x0000000000008e97 <+11975>: vpblendmq zmm4{k5},zmm28,zmm11 0x0000000000008e9d <+11981>: vpermi2q zmm1,zmm4,zmm13 0x0000000000008ea3 <+11987>: vmovdqa64 zmm1{k1},zmm17 0x0000000000008ea9 <+11993>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x59b4d] # 0x62a00 0x0000000000008eb3 <+12003>: vpermt2q zmm3,zmm17,zmm7 0x0000000000008eb9 <+12009>: vpermt2q zmm23,zmm17,zmm8 0x0000000000008ebf <+12015>: vmovdqa64 zmm17,zmm23 0x0000000000008ec5 <+12021>: vmovdqa64 zmm23,zmm13 0x0000000000008ecb <+12027>: vpminsq zmm23{k6},zmm29,zmm30 0x0000000000008ed1 <+12033>: vmovdqa64 zmm30,zmm20 0x0000000000008ed7 <+12039>: vpminsq zmm30{k6},zmm9,zmm0 0x0000000000008edd <+12045>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59dd9] # 0x62cc0 0x0000000000008ee7 <+12055>: vpermt2q zmm24,zmm0,zmm22 0x0000000000008eed <+12061>: vpermt2q zmm19,zmm0,zmm27 0x0000000000008ef3 <+12067>: vpmaxsq zmm9,zmm10,ZMMWORD PTR [rsp+0x240] 0x0000000000008efb <+12075>: vpblendmq zmm0{k3},zmm15,zmm17 0x0000000000008f01 <+12081>: vpmaxsq zmm17,zmm15,zmm0 0x0000000000008f07 <+12087>: vpblendmq zmm0{k3},zmm18,zmm3 0x0000000000008f0d <+12093>: vpmaxsq zmm29,zmm18,zmm0 0x0000000000008f13 <+12099>: vmovdqa64 zmm0,zmm14 0x0000000000008f19 <+12105>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x5965d] # 0x62580 0x0000000000008f23 <+12115>: vpermt2q zmm0,zmm8,zmm4 0x0000000000008f29 <+12121>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59bcd] # 0x62b00 0x0000000000008f33 <+12131>: vmovdqa64 zmm7,ZMMWORD PTR [rsp+0x400] 0x0000000000008f3b <+12139>: vpermt2q zmm7,zmm3,zmm0 0x0000000000008f41 <+12145>: vpblendmq zmm10{k6},zmm9,zmm16 0x0000000000008f47 <+12151>: vpermt2q zmm16,zmm8,zmm12 0x0000000000008f4d <+12157>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x340] 0x0000000000008f55 <+12165>: vpermi2q zmm3,zmm0,zmm16 0x0000000000008f5b <+12171>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59bdb] # 0x62b40 0x0000000000008f65 <+12181>: vpermt2q zmm7,zmm0,ZMMWORD PTR [rsp+0x380] 0x0000000000008f6d <+12189>: vpermt2q zmm3,zmm0,ZMMWORD PTR [rsp+0x300] 0x0000000000008f75 <+12197>: vpminsq zmm16,zmm23,zmm7 0x0000000000008f7b <+12203>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm16 0x0000000000008f83 <+12211>: vpmaxsq zmm16{k3},zmm23,zmm7 0x0000000000008f89 <+12217>: vpblendmq zmm0{k3},zmm29,zmm24 0x0000000000008f8f <+12223>: vmovdqa64 ZMMWORD PTR [rsp+0x640],zmm0 0x0000000000008f97 <+12231>: vpblendmq zmm0{k3},zmm17,zmm19 0x0000000000008f9d <+12237>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm0 0x0000000000008fa5 <+12245>: vpminsq zmm18,zmm30,zmm3 0x0000000000008fab <+12251>: vmovdqa64 zmm21,zmm18 0x0000000000008fb1 <+12257>: vpmaxsq zmm21{k3},zmm30,zmm3 0x0000000000008fb7 <+12263>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59aff] # 0x62ac0 0x0000000000008fc1 <+12273>: vpermt2q zmm2,zmm0,ZMMWORD PTR [rsp+0x600] 0x0000000000008fc9 <+12281>: vpermt2q zmm1,zmm0,ZMMWORD PTR [rsp+0x9c0] 0x0000000000008fd1 <+12289>: vmovdqa64 zmm3,zmm30 0x0000000000008fd7 <+12295>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x59c9f] # 0x62c80 0x0000000000008fe1 <+12305>: vpermt2q zmm3,zmm8,ZMMWORD PTR [rsp+0x780] 0x0000000000008fe9 <+12313>: vpermi2q zmm8,zmm23,zmm11 0x0000000000008fef <+12319>: vpmaxsq zmm22,zmm12,zmm2 0x0000000000008ff5 <+12325>: vpminsq zmm22{k5},zmm12,zmm2 0x0000000000008ffb <+12331>: vpmaxsq zmm24,zmm4,zmm1 0x0000000000009001 <+12337>: vpminsq zmm24{k5},zmm4,zmm1 0x0000000000009007 <+12343>: vpmaxsq zmm0,zmm6,zmm5 0x000000000000900d <+12349>: vpblendmq zmm2{k6},zmm0,zmm14 0x0000000000009013 <+12355>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59b63] # 0x62b80 0x000000000000901d <+12365>: vpermt2q zmm0,zmm4,zmm28 0x0000000000009023 <+12371>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59953] # 0x62980 0x000000000000902d <+12381>: vpermt2q zmm0,zmm5,zmm13 0x0000000000009033 <+12387>: vpmaxsq zmm7,zmm2,zmm0 0x0000000000009039 <+12393>: vmovdqa64 zmm1,zmm7 0x000000000000903f <+12399>: vpminsq zmm1{k6},zmm2,zmm0 0x0000000000009045 <+12405>: vpermt2q zmm9,zmm4,zmm26 0x000000000000904b <+12411>: vpermt2q zmm9,zmm5,zmm20 0x0000000000009051 <+12417>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59be5] # 0x62c40 0x000000000000905b <+12427>: vmovdqa64 zmm0,zmm25 0x0000000000009061 <+12433>: vpermt2q zmm0,zmm4,zmm28 0x0000000000009067 <+12439>: vpermt2q zmm31,zmm4,zmm26 0x000000000000906d <+12445>: vpminsq zmm2,zmm25,zmm0 0x0000000000009073 <+12451>: vpmaxsq zmm5,zmm25,zmm0 0x0000000000009079 <+12457>: vmovdqa64 zmm19,ZMMWORD PTR [rsp+0x980] 0x0000000000009081 <+12465>: vpminsq zmm11,zmm19,zmm31 0x0000000000009087 <+12471>: vpmaxsq zmm30,zmm10,zmm9 0x000000000000908d <+12477>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59ca9] # 0x62d40 0x0000000000009097 <+12487>: vmovdqa64 zmm12,zmm30 0x000000000000909d <+12493>: vpermt2q zmm12,zmm0,zmm11 0x00000000000090a3 <+12499>: vpermi2q zmm0,zmm7,zmm2 0x00000000000090a9 <+12505>: vpblendmq zmm6{k6},zmm5,zmm2 0x00000000000090af <+12511>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x58f87] # 0x62040 0x00000000000090b9 <+12521>: vpermt2q zmm5,zmm14,zmm7 0x00000000000090bf <+12527>: vpmaxsq zmm2,zmm19,zmm31 0x00000000000090c5 <+12533>: vpblendmq zmm7{k6},zmm2,zmm11 0x00000000000090cb <+12539>: vpermt2q zmm2,zmm14,zmm30 0x00000000000090d1 <+12545>: vpminsq zmm30{k6},zmm10,zmm9 0x00000000000090d7 <+12551>: vpminsq zmm10,zmm7,zmm2 0x00000000000090dd <+12557>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm10 0x00000000000090e5 <+12565>: vpmaxsq zmm11,zmm7,zmm2 0x00000000000090eb <+12571>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x59c8b] # 0x62d80 0x00000000000090f5 <+12581>: vpermt2q zmm12,zmm9,zmm22 0x00000000000090fb <+12587>: vpminsq zmm2,zmm30,zmm12 0x0000000000009101 <+12593>: vmovdqa64 ZMMWORD PTR [rsp+0x800],zmm2 0x0000000000009109 <+12601>: vpmaxsq zmm25,zmm30,zmm12 0x000000000000910f <+12607>: kmovw k3,WORD PTR [rsp+0xf40] 0x0000000000009118 <+12616>: vmovdqa64 zmm25{k3},zmm2 0x000000000000911e <+12622>: vpblendmq zmm12{k6},zmm11,zmm10 0x0000000000009124 <+12628>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x59f92] # 0x630c0 0x000000000000912e <+12638>: vpermt2q zmm11,zmm2,zmm25 0x0000000000009134 <+12644>: vpmaxsq zmm7,zmm12,zmm11 0x000000000000913a <+12650>: vpminsq zmm7{k6},zmm12,zmm11 0x0000000000009140 <+12656>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm7 0x0000000000009148 <+12664>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x380] 0x0000000000009150 <+12672>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x59526] # 0x62680 0x000000000000915a <+12682>: vpermt2q zmm8,zmm14,zmm10 0x0000000000009160 <+12688>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x59556] # 0x626c0 0x000000000000916a <+12698>: vpermt2q zmm8,zmm19,zmm17 0x0000000000009170 <+12704>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x400] 0x0000000000009178 <+12712>: vpmaxsq zmm7,zmm11,zmm8 0x000000000000917e <+12718>: vmovdqa64 zmm12,zmm7 0x0000000000009184 <+12724>: vpminsq zmm12{k6},zmm11,zmm8 0x000000000000918a <+12730>: vmovdqa64 zmm27,zmm11 0x0000000000009190 <+12736>: vmovdqa64 zmm31,ZMMWORD PTR [rsp+0x300] 0x0000000000009198 <+12744>: vpermt2q zmm3,zmm14,zmm31 0x000000000000919e <+12750>: vpermt2q zmm3,zmm19,zmm29 0x00000000000091a4 <+12756>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x340] 0x00000000000091ac <+12764>: vpmaxsq zmm8,zmm11,zmm3 0x00000000000091b2 <+12770>: vmovdqa64 zmm14,zmm8 0x00000000000091b8 <+12776>: vpminsq zmm14{k6},zmm11,zmm3 0x00000000000091be <+12782>: vpermt2q zmm0,zmm9,zmm24 0x00000000000091c4 <+12788>: vpminsq zmm3,zmm6,zmm5 0x00000000000091ca <+12794>: vpmaxsq zmm6,zmm6,zmm5 0x00000000000091d0 <+12800>: vpminsq zmm23,zmm1,zmm0 0x00000000000091d6 <+12806>: vpmaxsq zmm15,zmm1,zmm0 0x00000000000091dc <+12812>: vmovdqa64 zmm15{k3},zmm23 0x00000000000091e2 <+12818>: vpblendmq zmm0{k6},zmm6,zmm3 0x00000000000091e8 <+12824>: vpermt2q zmm6,zmm2,zmm15 0x00000000000091ee <+12830>: vpmaxsq zmm2,zmm0,zmm6 0x00000000000091f4 <+12836>: vpminsq zmm2{k6},zmm0,zmm6 0x00000000000091fa <+12842>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm2 0x0000000000009202 <+12850>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x599b4] # 0x62bc0 0x000000000000920c <+12860>: vpermt2q zmm20,zmm0,zmm11 0x0000000000009212 <+12866>: vpermi2q zmm0,zmm13,zmm27 0x0000000000009218 <+12872>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x599de] # 0x62c00 0x0000000000009222 <+12882>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x280] 0x000000000000922a <+12890>: vpermt2q zmm0,zmm2,zmm5 0x0000000000009230 <+12896>: vinserti32x4 zmm0,zmm0,xmm17,0x1 0x0000000000009237 <+12903>: vpermt2q zmm0,zmm4,ZMMWORD PTR [rsp+0x3c0] 0x000000000000923f <+12911>: vpmaxsq zmm26,zmm5,zmm0 0x0000000000009245 <+12917>: vpminsq zmm26{k7},zmm5,zmm0 0x000000000000924b <+12923>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x500] 0x0000000000009253 <+12931>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x5c0] 0x000000000000925b <+12939>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x2c0] 0x0000000000009263 <+12947>: vpermt2q zmm20,zmm2,zmm5 0x0000000000009269 <+12953>: vinserti32x4 zmm2,zmm20,xmm29,0x1 0x0000000000009270 <+12960>: vpermt2q zmm2,zmm4,zmm0 0x0000000000009276 <+12966>: vpmaxsq zmm4,zmm5,zmm2 0x000000000000927c <+12972>: vpminsq zmm4{k7},zmm5,zmm2 0x0000000000009282 <+12978>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x59b34] # 0x62dc0 0x000000000000928c <+12988>: vmovdqa64 zmm27,zmm22 0x0000000000009292 <+12994>: vpermt2q zmm27,zmm13,zmm8 0x0000000000009298 <+13000>: vpermi2q zmm13,zmm24,zmm7 0x000000000000929e <+13006>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x59a58] # 0x62d00 0x00000000000092a8 <+13016>: vmovdqa64 zmm6,zmm0 0x00000000000092ae <+13022>: vpermt2q zmm6,zmm2,zmm31 0x00000000000092b4 <+13028>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x440] 0x00000000000092bc <+13036>: vpermi2q zmm2,zmm5,zmm10 0x00000000000092c2 <+13042>: vpmaxsq zmm5,zmm5,zmm2 0x00000000000092c8 <+13048>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm5 0x00000000000092d0 <+13056>: vpmaxsq zmm9,zmm17,ZMMWORD PTR [rsp+0x4c0] 0x00000000000092d8 <+13064>: vpmaxsq zmm10,zmm0,zmm6 0x00000000000092de <+13070>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm10 0x00000000000092e6 <+13078>: vpmaxsq zmm31,zmm29,ZMMWORD PTR [rsp+0x640] 0x00000000000092ee <+13086>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59b08] # 0x62e00 0x00000000000092f8 <+13096>: vpermt2q zmm30,zmm0,zmm21 0x00000000000092fe <+13102>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x59b38] # 0x62e40 0x0000000000009308 <+13112>: vmovdqa64 zmm8,zmm18 0x000000000000930e <+13118>: vpermt2q zmm8,zmm6,zmm4 0x0000000000009314 <+13124>: vpermi2q zmm0,zmm1,zmm16 0x000000000000931a <+13130>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x240] 0x0000000000009322 <+13138>: vpermt2q zmm11,zmm6,zmm26 0x0000000000009328 <+13144>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59b4e] # 0x62e80 0x0000000000009332 <+13154>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x59b84] # 0x62ec0 0x000000000000933c <+13164>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x59cfa] # 0x63040 0x0000000000009346 <+13174>: vmovdqa64 zmm28,zmm25 0x000000000000934c <+13180>: vpermt2q zmm28,zmm6,ZMMWORD PTR [rsp+0x600] 0x0000000000009354 <+13188>: vpmaxsq zmm7,zmm24,zmm0 0x000000000000935a <+13194>: vpermi2q zmm6,zmm15,zmm3 0x0000000000009360 <+13200>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59d16] # 0x63080 0x000000000000936a <+13210>: vpermt2q zmm6,zmm3,zmm7 0x0000000000009370 <+13216>: vpminsq zmm7{k7},zmm24,zmm0 0x0000000000009376 <+13222>: vmovdqa64 zmm20,zmm14 0x000000000000937c <+13228>: vpermt2q zmm20,zmm18,zmm31 0x0000000000009382 <+13234>: vpminsq zmm17,zmm4,zmm20 0x0000000000009388 <+13240>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm17 0x0000000000009390 <+13248>: vpmaxsq zmm29,zmm4,zmm20 0x0000000000009396 <+13254>: vpermt2q zmm4,zmm1,zmm31 0x000000000000939c <+13260>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5889a] # 0x61c40 0x00000000000093a6 <+13270>: vpermt2q zmm4,zmm0,zmm10 0x00000000000093ac <+13276>: vmovdqa64 zmm20,zmm9 0x00000000000093b2 <+13282>: vpermi2q zmm1,zmm26,zmm9 0x00000000000093b8 <+13288>: vpermt2q zmm1,zmm0,zmm5 0x00000000000093be <+13294>: vpermi2q zmm18,zmm12,zmm9 0x00000000000093c4 <+13300>: vpminsq zmm0,zmm26,zmm18 0x00000000000093ca <+13306>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm0 0x00000000000093d2 <+13314>: vpmaxsq zmm18,zmm26,zmm18 0x00000000000093d8 <+13320>: vpmaxsq zmm24,zmm22,zmm30 0x00000000000093de <+13326>: vpermt2q zmm28,zmm3,zmm24 0x00000000000093e4 <+13332>: vpblendmq zmm9{k5},zmm18,zmm0 0x00000000000093ea <+13338>: vmovdqa64 zmm3,zmm24 0x00000000000093f0 <+13344>: vpminsq zmm3{k7},zmm22,zmm30 0x00000000000093f6 <+13350>: vpmaxsq zmm26,zmm21,zmm27 0x00000000000093fc <+13356>: vmovdqa64 zmm30,zmm26 0x0000000000009402 <+13362>: kmovw k6,WORD PTR [rsp+0xf80] 0x000000000000940b <+13371>: vpminsq zmm30{k6},zmm21,zmm27 0x0000000000009411 <+13377>: vpmaxsq zmm21,zmm16,zmm13 0x0000000000009417 <+13383>: vmovdqa64 zmm27,zmm21 0x000000000000941d <+13389>: vpminsq zmm27{k6},zmm16,zmm13 0x0000000000009423 <+13395>: vpminsq zmm13,zmm12,zmm11 0x0000000000009429 <+13401>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59b0d] # 0x62f40 0x0000000000009433 <+13411>: vmovdqa64 zmm0,zmm9 0x0000000000009439 <+13417>: vpermt2q zmm0,zmm5,zmm13 0x000000000000943f <+13423>: vpmaxsq zmm19,zmm20,zmm1 0x0000000000009445 <+13429>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x59cb1] # 0x63100 0x000000000000944f <+13439>: vpermt2q zmm0,zmm22,zmm19 0x0000000000009455 <+13445>: kmovw k1,WORD PTR [rsp+0x840] 0x000000000000945e <+13454>: vpminsq zmm19{k1},zmm20,zmm1 0x0000000000009464 <+13460>: vmovdqa64 zmm16,zmm8 0x000000000000946a <+13466>: vpminsq zmm1,zmm14,zmm8 0x0000000000009470 <+13472>: vpblendmq zmm8{k5},zmm29,zmm17 0x0000000000009476 <+13478>: vmovdqa64 zmm2,zmm8 0x000000000000947c <+13484>: vpermt2q zmm2,zmm5,zmm1 0x0000000000009482 <+13490>: vpmaxsq zmm17,zmm31,zmm4 0x0000000000009488 <+13496>: vpermt2q zmm2,zmm22,zmm17 0x000000000000948e <+13502>: vpminsq zmm17{k1},zmm31,zmm4 0x0000000000009494 <+13508>: vpmaxsq zmm14,zmm14,zmm16 0x000000000000949a <+13514>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x59adc] # 0x62f80 0x00000000000094a4 <+13524>: vmovdqa64 zmm24,zmm3 0x00000000000094aa <+13530>: vpermt2q zmm24,zmm16,ZMMWORD PTR [rsp+0x800] 0x00000000000094b2 <+13538>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59b04] # 0x62fc0 0x00000000000094bc <+13548>: vpermt2q zmm24,zmm4,zmm26 0x00000000000094c2 <+13554>: vpermi2q zmm16,zmm7,zmm23 0x00000000000094c8 <+13560>: vpermt2q zmm16,zmm4,zmm21 0x00000000000094ce <+13566>: vmovdqa64 zmm10,zmm4 0x00000000000094d4 <+13572>: vpmaxsq zmm23,zmm12,zmm11 0x00000000000094da <+13578>: vmovdqa64 zmm23{k6},zmm13 0x00000000000094e0 <+13584>: vmovdqa64 zmm14{k6},zmm1 0x00000000000094e6 <+13590>: vpmaxsq zmm13,zmm25,zmm28 0x00000000000094ec <+13596>: vpminsq zmm13{k6},zmm25,zmm28 0x00000000000094f2 <+13602>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59b04] # 0x63000 0x00000000000094fc <+13612>: vmovdqa64 zmm1,zmm14 0x0000000000009502 <+13618>: vpermt2q zmm1,zmm4,zmm30 0x0000000000009508 <+13624>: vpermt2q zmm1,zmm10,zmm29 0x000000000000950e <+13630>: vpmaxsq zmm26,zmm14,zmm1 0x0000000000009514 <+13636>: vpminsq zmm26{k7},zmm14,zmm1 0x000000000000951a <+13642>: vmovdqa64 zmm1,zmm30 0x0000000000009520 <+13648>: vpermt2q zmm1,zmm5,zmm3 0x0000000000009526 <+13654>: vinserti32x4 zmm1,zmm1,xmm14,0x3 0x000000000000952d <+13661>: vmovdqa64 zmm12,zmm27 0x0000000000009533 <+13667>: vpermt2q zmm12,zmm5,zmm7 0x0000000000009539 <+13673>: vinserti32x4 zmm12,zmm12,xmm23,0x3 0x0000000000009540 <+13680>: vpmaxsq zmm25,zmm27,zmm12 0x0000000000009546 <+13686>: vpminsq zmm25{k5},zmm27,zmm12 0x000000000000954c <+13692>: vmovdqa64 zmm14,zmm23 0x0000000000009552 <+13698>: vpermt2q zmm14,zmm4,zmm27 0x0000000000009558 <+13704>: vpermt2q zmm14,zmm10,zmm18 0x000000000000955e <+13710>: vpmaxsq zmm29,zmm3,zmm24 0x0000000000009564 <+13716>: vpminsq zmm29{k7},zmm3,zmm24 0x000000000000956a <+13722>: vpmaxsq zmm12,zmm30,zmm1 0x0000000000009570 <+13728>: vpminsq zmm12{k5},zmm30,zmm1 0x0000000000009576 <+13734>: vpmaxsq zmm10,zmm9,zmm0 0x000000000000957c <+13740>: vpminsq zmm10{k5},zmm9,zmm0 0x0000000000009582 <+13746>: vpmaxsq zmm28,zmm23,zmm14 0x0000000000009588 <+13752>: vpminsq zmm28{k7},zmm23,zmm14 0x000000000000958e <+13758>: vpmaxsq zmm3,zmm8,zmm2 0x0000000000009594 <+13764>: vpminsq zmm3{k5},zmm8,zmm2 0x000000000000959a <+13770>: vpmaxsq zmm22,zmm15,zmm6 0x00000000000095a0 <+13776>: vpminsq zmm22{k6},zmm15,zmm6 0x00000000000095a6 <+13782>: vpmaxsq zmm30,zmm7,zmm16 0x00000000000095ac <+13788>: vpminsq zmm30{k7},zmm7,zmm16 0x00000000000095b2 <+13794>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59c44] # 0x63200 0x00000000000095bc <+13804>: vmovdqa64 zmm1,zmm29 0x00000000000095c2 <+13810>: vpermt2q zmm1,zmm0,zmm13 0x00000000000095c8 <+13816>: vinserti32x4 zmm11,zmm1,xmm12,0x3 0x00000000000095cf <+13823>: vpermi2q zmm0,zmm30,zmm22 0x00000000000095d5 <+13829>: vinserti32x4 zmm9,zmm0,xmm25,0x3 0x00000000000095dc <+13836>: vmovdqa64 zmm0,zmm26 0x00000000000095e2 <+13842>: vpermt2q zmm0,zmm5,zmm12 0x00000000000095e8 <+13848>: vinserti32x4 zmm0,zmm0,xmm3,0x3 0x00000000000095ef <+13855>: vpermi2q zmm5,zmm28,zmm25 0x00000000000095f5 <+13861>: vinserti32x4 zmm1,zmm5,xmm10,0x3 0x00000000000095fc <+13868>: vpmaxsq zmm2,zmm26,zmm0 0x0000000000009602 <+13874>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm2 0x000000000000960a <+13882>: vpminsq zmm2{k5},zmm26,zmm0 0x0000000000009610 <+13888>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm2 0x0000000000009618 <+13896>: vpmaxsq zmm7,zmm30,zmm9 0x000000000000961e <+13902>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm7 0x0000000000009626 <+13910>: vpminsq zmm7{k5},zmm30,zmm9 0x000000000000962c <+13916>: vpmaxsq zmm27,zmm29,zmm11 0x0000000000009632 <+13922>: vmovdqa64 zmm9,zmm27 0x0000000000009638 <+13928>: vpminsq zmm9{k5},zmm29,zmm11 0x000000000000963e <+13934>: vpmaxsq zmm11,zmm28,zmm1 0x0000000000009644 <+13940>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm11 0x000000000000964c <+13948>: vpminsq zmm11{k5},zmm28,zmm1 0x0000000000009652 <+13954>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59c64] # 0x632c0 0x000000000000965c <+13964>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x580] 0x0000000000009664 <+13972>: vmovdqa64 zmm1,zmm2 0x000000000000966a <+13978>: vpermt2q zmm1,zmm0,zmm13 0x0000000000009670 <+13984>: mov al,0xc8 0x0000000000009672 <+13986>: kmovd k1,eax 0x0000000000009676 <+13990>: vpmaxsq zmm18,zmm2,zmm1 0x000000000000967c <+13996>: vpminsq zmm18{k1},zmm2,zmm1 0x0000000000009682 <+14002>: vmovdqa64 zmm6,zmm2 0x0000000000009688 <+14008>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x7c0] 0x0000000000009690 <+14016>: vpermi2q zmm0,zmm1,zmm22 0x0000000000009696 <+14022>: vpmaxsq zmm16,zmm1,zmm0 0x000000000000969c <+14028>: vpminsq zmm16{k1},zmm1,zmm0 0x00000000000096a2 <+14034>: vmovdqa64 zmm21,zmm1 0x00000000000096a8 <+14040>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5984e] # 0x62f00 0x00000000000096b2 <+14050>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x2c0] 0x00000000000096ba <+14058>: vmovdqa64 zmm1,zmm5 0x00000000000096c0 <+14064>: vpermt2q zmm1,zmm0,zmm31 0x00000000000096c6 <+14070>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x280] 0x00000000000096ce <+14078>: vpermi2q zmm0,zmm2,zmm20 0x00000000000096d4 <+14084>: vpmaxsq zmm0,zmm2,zmm0 0x00000000000096da <+14090>: vpmaxsq zmm1,zmm5,zmm1 0x00000000000096e0 <+14096>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x59a56] # 0x63140 0x00000000000096ea <+14106>: vmovdqa64 zmm5,zmm17 0x00000000000096f0 <+14112>: vpermt2q zmm5,zmm2,ZMMWORD PTR [rsp+0x240] 0x00000000000096f8 <+14120>: vpermi2q zmm2,zmm19,ZMMWORD PTR [rsp+0x400] 0x0000000000009700 <+14128>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x59a76] # 0x63180 0x000000000000970a <+14138>: vpermt2q zmm5,zmm8,zmm1 0x0000000000009710 <+14144>: vpermt2q zmm2,zmm8,zmm0 0x0000000000009716 <+14150>: vpmaxsq zmm8,zmm17,zmm5 0x000000000000971c <+14156>: vpminsq zmm8{k6},zmm17,zmm5 0x0000000000009722 <+14162>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59a94] # 0x631c0 0x000000000000972c <+14172>: vmovdqa64 zmm14,zmm1 0x0000000000009732 <+14178>: vpermt2q zmm14,zmm5,zmm17 0x0000000000009738 <+14184>: vpmaxsq zmm17,zmm19,zmm2 0x000000000000973e <+14190>: vpminsq zmm17{k6},zmm19,zmm2 0x0000000000009744 <+14196>: vpermi2q zmm5,zmm0,zmm19 0x000000000000974a <+14202>: vpmaxsq zmm0,zmm0,zmm5 0x0000000000009750 <+14208>: vpmaxsq zmm1,zmm1,zmm14 0x0000000000009756 <+14214>: vmovdqa64 zmm31,zmm12 0x000000000000975c <+14220>: vpermt2q zmm31,zmm4,zmm29 0x0000000000009762 <+14226>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x59854] # 0x62fc0 0x000000000000976c <+14236>: vpermt2q zmm31,zmm14,zmm26 0x0000000000009772 <+14242>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x59ac4] # 0x63240 0x000000000000977c <+14252>: vmovdqa64 zmm15,zmm13 0x0000000000009782 <+14258>: vpermt2q zmm15,zmm2,zmm6 0x0000000000009788 <+14264>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59aee] # 0x63280 0x0000000000009792 <+14274>: vpermt2q zmm15,zmm5,zmm29 0x0000000000009798 <+14280>: vmovdqa64 zmm24,zmm22 0x000000000000979e <+14286>: vpermt2q zmm24,zmm2,zmm21 0x00000000000097a4 <+14292>: vpermt2q zmm24,zmm5,zmm30 0x00000000000097aa <+14298>: vmovdqa64 zmm23,zmm3 0x00000000000097b0 <+14304>: vpermt2q zmm23,zmm4,zmm26 0x00000000000097b6 <+14310>: vmovdqa64 zmm21,zmm10 0x00000000000097bc <+14316>: vpermt2q zmm21,zmm4,zmm28 0x00000000000097c2 <+14322>: vpermi2q zmm4,zmm25,zmm30 0x00000000000097c8 <+14328>: vpermt2q zmm4,zmm14,zmm28 0x00000000000097ce <+14334>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59ba8] # 0x63380 0x00000000000097d8 <+14344>: vmovdqa64 zmm14,zmm1 0x00000000000097de <+14350>: vpermt2q zmm14,zmm5,zmm8 0x00000000000097e4 <+14356>: vpermi2q zmm5,zmm0,zmm17 0x00000000000097ea <+14362>: vpmaxsq zmm29,zmm0,zmm5 0x00000000000097f0 <+14368>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm29 0x00000000000097f8 <+14376>: vpminsq zmm29{k2},zmm0,zmm5 0x00000000000097fe <+14382>: vpmaxsq zmm30,zmm1,zmm14 0x0000000000009804 <+14388>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm30 0x000000000000980c <+14396>: vpminsq zmm30{k2},zmm1,zmm14 0x0000000000009812 <+14402>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59b24] # 0x63340 0x000000000000981c <+14412>: vmovdqa64 zmm20,zmm8 0x0000000000009822 <+14418>: vpermt2q zmm20,zmm5,zmm3 0x0000000000009828 <+14424>: vpermi2q zmm5,zmm17,zmm10 0x000000000000982e <+14430>: vinserti32x4 zmm0,zmm5,xmm0,0x3 0x0000000000009835 <+14437>: vpmaxsq zmm19,zmm17,zmm0 0x000000000000983b <+14443>: vmovdqa64 zmm14,zmm19 0x0000000000009841 <+14449>: vpminsq zmm14{k3},zmm17,zmm0 0x0000000000009847 <+14455>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59aaf] # 0x63300 0x0000000000009851 <+14465>: vpermt2q zmm21,zmm0,zmm17 0x0000000000009857 <+14471>: vpermt2q zmm23,zmm0,zmm8 0x000000000000985d <+14477>: vinserti32x4 zmm0,zmm20,xmm1,0x3 0x0000000000009864 <+14484>: vpmaxsq zmm26,zmm8,zmm0 0x000000000000986a <+14490>: vmovdqa64 zmm17,zmm26 0x0000000000009870 <+14496>: vpminsq zmm17{k3},zmm8,zmm0 0x0000000000009876 <+14502>: vpmaxsq zmm28,zmm10,zmm21 0x000000000000987c <+14508>: vmovdqa64 zmm20,zmm28 0x0000000000009882 <+14514>: vpminsq zmm20{k7},zmm10,zmm21 0x0000000000009888 <+14520>: vpmaxsq zmm5,zmm3,zmm23 0x000000000000988e <+14526>: vmovdqa64 zmm21,zmm5 0x0000000000009894 <+14532>: vpminsq zmm21{k7},zmm3,zmm23 0x000000000000989a <+14538>: vpminsq zmm23,zmm13,zmm15 0x00000000000098a0 <+14544>: vpmaxsq zmm1,zmm13,zmm15 0x00000000000098a6 <+14550>: vpblendmq zmm0{k3},zmm1,zmm23 0x00000000000098ac <+14556>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x59b0a] # 0x633c0 0x00000000000098b6 <+14566>: vmovdqa64 zmm8,zmm0 0x00000000000098bc <+14572>: vpermt2q zmm8,zmm6,zmm18 0x00000000000098c2 <+14578>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x59b34] # 0x63400 0x00000000000098cc <+14588>: vpermt2q zmm8,zmm3,zmm27 0x00000000000098d2 <+14594>: vpmaxsq zmm2,zmm0,zmm8 0x00000000000098d8 <+14600>: vpminsq zmm2{k6},zmm0,zmm8 0x00000000000098de <+14606>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm2 0x00000000000098e6 <+14614>: vpminsq zmm2,zmm25,zmm4 0x00000000000098ec <+14620>: vpmaxsq zmm15,zmm25,zmm4 0x00000000000098f2 <+14626>: vpblendmq zmm8{k7},zmm15,zmm2 0x00000000000098f8 <+14632>: vmovdqa64 zmm10,zmm8 0x00000000000098fe <+14638>: vpermt2q zmm10,zmm6,zmm7 0x0000000000009904 <+14644>: vpermt2q zmm10,zmm3,ZMMWORD PTR [rsp+0x440] 0x000000000000990c <+14652>: vpmaxsq zmm0,zmm8,zmm10 0x0000000000009912 <+14658>: vpminsq zmm0{k6},zmm8,zmm10 0x0000000000009918 <+14664>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x0000000000009920 <+14672>: vpminsq zmm27,zmm12,zmm31 0x0000000000009926 <+14678>: vpmaxsq zmm8,zmm12,zmm31 0x000000000000992c <+14684>: vpblendmq zmm10{k7},zmm8,zmm27 0x0000000000009932 <+14690>: vmovdqa64 zmm13,zmm10 0x0000000000009938 <+14696>: vpermt2q zmm13,zmm6,zmm9 0x000000000000993e <+14702>: vpermt2q zmm13,zmm3,ZMMWORD PTR [rsp+0x380] 0x0000000000009946 <+14710>: vpmaxsq zmm12,zmm10,zmm13 0x000000000000994c <+14716>: vpminsq zmm12{k6},zmm10,zmm13 0x0000000000009952 <+14722>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x59ae4] # 0x63440 0x000000000000995c <+14732>: vmovdqa64 zmm13,zmm18 0x0000000000009962 <+14738>: vpermt2q zmm13,zmm10,zmm1 0x0000000000009968 <+14744>: mov al,0xa8 0x000000000000996a <+14746>: kmovd k2,eax 0x000000000000996e <+14750>: vpmaxsq zmm31,zmm18,zmm13 0x0000000000009974 <+14756>: vpminsq zmm31{k2},zmm18,zmm13 0x000000000000997a <+14762>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x59afc] # 0x63480 0x0000000000009984 <+14772>: vmovdqa64 zmm13,zmm30 0x000000000000998a <+14778>: vpermt2q zmm13,zmm1,zmm17 0x0000000000009990 <+14784>: vpermi2q zmm1,zmm29,zmm14 0x0000000000009996 <+14790>: vpmaxsq zmm25,zmm29,zmm1 0x000000000000999c <+14796>: vmovdqa64 zmm18,zmm25 0x00000000000099a2 <+14802>: kmovw k1,WORD PTR [rsp+0x480] 0x00000000000099ab <+14811>: vpminsq zmm18{k1},zmm29,zmm1 0x00000000000099b1 <+14817>: vpmaxsq zmm29,zmm30,zmm13 0x00000000000099b7 <+14823>: vpminsq zmm29{k1},zmm30,zmm13 0x00000000000099bd <+14829>: vpmaxsq zmm1,zmm22,zmm24 0x00000000000099c3 <+14835>: vpermi2q zmm10,zmm16,zmm1 0x00000000000099c9 <+14841>: mov al,0x7 0x00000000000099cb <+14843>: kmovd k1,eax 0x00000000000099cf <+14847>: vpmaxsq zmm13,zmm16,zmm10 0x00000000000099d5 <+14853>: vpblendmq zmm30{k1},zmm31,zmm13 0x00000000000099db <+14859>: vpminsq zmm13{k2},zmm16,zmm10 0x00000000000099e1 <+14865>: vpminsq zmm24,zmm22,zmm24 0x00000000000099e7 <+14871>: vpblendmq zmm4{k3},zmm1,zmm24 0x00000000000099ed <+14877>: vmovdqa64 zmm10,zmm4 0x00000000000099f3 <+14883>: vpermt2q zmm10,zmm6,zmm16 0x00000000000099f9 <+14889>: vpermt2q zmm10,zmm3,ZMMWORD PTR [rsp+0x340] 0x0000000000009a01 <+14897>: vmovdqa64 zmm22,zmm21 0x0000000000009a07 <+14903>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x300] 0x0000000000009a0f <+14911>: vpermt2q zmm22,zmm6,zmm0 0x0000000000009a15 <+14917>: vpermt2q zmm22,zmm3,zmm26 0x0000000000009a1b <+14923>: vmovdqa64 zmm1,zmm11 0x0000000000009a21 <+14929>: vpermt2q zmm1,zmm6,zmm2 0x0000000000009a27 <+14935>: vpermt2q zmm1,zmm3,zmm28 0x0000000000009a2d <+14941>: vpmaxsq zmm28,zmm11,zmm1 0x0000000000009a33 <+14947>: vpminsq zmm28{k6},zmm11,zmm1 0x0000000000009a39 <+14953>: vmovdqa64 zmm2,zmm20 0x0000000000009a3f <+14959>: vpermt2q zmm2,zmm6,zmm11 0x0000000000009a45 <+14965>: vpermt2q zmm2,zmm3,zmm19 0x0000000000009a4b <+14971>: vmovdqa64 zmm19,zmm17 0x0000000000009a51 <+14977>: vpermt2q zmm19,zmm6,zmm21 0x0000000000009a57 <+14983>: vpermt2q zmm19,zmm3,ZMMWORD PTR [rsp+0x2c0] 0x0000000000009a5f <+14991>: vmovdqa64 zmm26,zmm14 0x0000000000009a65 <+14997>: vpermt2q zmm26,zmm6,zmm20 0x0000000000009a6b <+15003>: vpermt2q zmm26,zmm3,ZMMWORD PTR [rsp+0x240] 0x0000000000009a73 <+15011>: vmovdqa64 zmm16,zmm0 0x0000000000009a79 <+15017>: vpermt2q zmm16,zmm6,zmm27 0x0000000000009a7f <+15023>: vpermt2q zmm16,zmm3,zmm5 0x0000000000009a85 <+15029>: vmovdqa64 zmm5,zmm9 0x0000000000009a8b <+15035>: vpermt2q zmm5,zmm6,zmm23 0x0000000000009a91 <+15041>: vpermt2q zmm5,zmm3,zmm8 0x0000000000009a97 <+15047>: vmovdqa64 zmm27,zmm7 0x0000000000009a9d <+15053>: vpermt2q zmm27,zmm6,zmm24 0x0000000000009aa3 <+15059>: vpminsq zmm11,zmm13,zmm30 0x0000000000009aa9 <+15065>: vmovdqa64 zmm1,zmm11 0x0000000000009aaf <+15071>: vpmaxsq zmm1{k1},zmm13,zmm30 0x0000000000009ab5 <+15077>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm1 0x0000000000009abd <+15085>: vpblendmq zmm24{k1},zmm13,zmm31 0x0000000000009ac3 <+15091>: kmovw k1,WORD PTR [rsp+0x540] 0x0000000000009acc <+15100>: vpblendmq zmm25{k1},zmm29,zmm25 0x0000000000009ad2 <+15106>: vpermt2q zmm27,zmm3,zmm15 0x0000000000009ad8 <+15112>: vpmaxsq zmm13,zmm0,zmm16 0x0000000000009ade <+15118>: vpminsq zmm13{k6},zmm0,zmm16 0x0000000000009ae4 <+15124>: vpmaxsq zmm16,zmm14,zmm26 0x0000000000009aea <+15130>: vpminsq zmm16{k6},zmm14,zmm26 0x0000000000009af0 <+15136>: vpmaxsq zmm8,zmm17,zmm19 0x0000000000009af6 <+15142>: vpminsq zmm8{k6},zmm17,zmm19 0x0000000000009afc <+15148>: vpmaxsq zmm30,zmm20,zmm2 0x0000000000009b02 <+15154>: vpminsq zmm30{k6},zmm20,zmm2 0x0000000000009b08 <+15160>: vpmaxsq zmm23,zmm21,zmm22 0x0000000000009b0e <+15166>: vpminsq zmm23{k6},zmm21,zmm22 0x0000000000009b14 <+15172>: vpmaxsq zmm15,zmm7,zmm27 0x0000000000009b1a <+15178>: vpminsq zmm15{k6},zmm7,zmm27 0x0000000000009b20 <+15184>: vpmaxsq zmm17,zmm9,zmm5 0x0000000000009b26 <+15190>: vpminsq zmm17{k6},zmm9,zmm5 0x0000000000009b2c <+15196>: vpmaxsq zmm19,zmm4,zmm10 0x0000000000009b32 <+15202>: vpminsq zmm19{k6},zmm4,zmm10 0x0000000000009b38 <+15208>: vpblendmq zmm0{k1},zmm18,zmm29 0x0000000000009b3e <+15214>: vpminsq zmm20,zmm18,zmm25 0x0000000000009b44 <+15220>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x280] 0x0000000000009b4c <+15228>: vpmaxsq zmm22,zmm12,zmm1 0x0000000000009b52 <+15234>: vpmaxsq zmm2,zmm8,zmm16 0x0000000000009b58 <+15240>: vpmaxsq zmm14,zmm23,zmm30 0x0000000000009b5e <+15246>: vpmaxsq zmm9,zmm29,zmm0 0x0000000000009b64 <+15252>: vpmaxsq zmm20{k1},zmm18,zmm25 0x0000000000009b6a <+15258>: vpmaxsq zmm5,zmm22,zmm20 0x0000000000009b70 <+15264>: vpmaxsq zmm0,zmm14,zmm5 0x0000000000009b76 <+15270>: vpminsq zmm7,zmm0,zmm2 0x0000000000009b7c <+15276>: vpmaxsq zmm25,zmm2,zmm0 0x0000000000009b82 <+15282>: vshufi64x2 zmm0,zmm25,zmm9,0xee 0x0000000000009b89 <+15289>: vshufi64x2 zmm2,zmm7,zmm9,0x4e 0x0000000000009b90 <+15296>: vpminsq zmm10,zmm25,zmm2 0x0000000000009b96 <+15302>: vpmaxsq zmm2,zmm25,zmm2 0x0000000000009b9c <+15308>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm2 0x0000000000009ba4 <+15316>: vpmaxsq zmm26,zmm9,zmm0 0x0000000000009baa <+15322>: vshufi64x2 zmm27,zmm2,zmm10,0xe4 0x0000000000009bb1 <+15329>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59945] # 0x63500 0x0000000000009bbb <+15339>: vpermi2q zmm0,zmm26,zmm27 0x0000000000009bc1 <+15345>: vpmaxsq zmm3,zmm26,zmm0 0x0000000000009bc7 <+15351>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm3 0x0000000000009bcf <+15359>: mov al,0xc 0x0000000000009bd1 <+15361>: kmovd k1,eax 0x0000000000009bd5 <+15365>: vpminsq zmm3{k1},zmm26,zmm0 0x0000000000009bdb <+15371>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm3 0x0000000000009be3 <+15379>: vpminsq zmm10,zmm1,zmm12 0x0000000000009be9 <+15385>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x400] 0x0000000000009bf1 <+15393>: vpminsq zmm12,zmm19,zmm1 0x0000000000009bf7 <+15399>: vpminsq zmm18,zmm15,zmm17 0x0000000000009bfd <+15405>: vpminsq zmm21,zmm30,zmm23 0x0000000000009c03 <+15411>: vpminsq zmm8,zmm16,zmm8 0x0000000000009c09 <+15417>: vpminsq zmm16,zmm28,zmm13 0x0000000000009c0f <+15423>: vpmaxsq zmm13,zmm13,zmm28 0x0000000000009c15 <+15429>: vpmaxsq zmm23,zmm31,zmm24 0x0000000000009c1b <+15435>: vpminsq zmm24,zmm16,zmm23 0x0000000000009c21 <+15441>: vpminsq zmm28,zmm18,zmm24 0x0000000000009c27 <+15447>: vpmaxsq zmm0,zmm28,zmm12 0x0000000000009c2d <+15453>: vshufi64x2 zmm2,zmm11,zmm0,0x4e 0x0000000000009c34 <+15460>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm2 0x0000000000009c3c <+15468>: vpmaxsq zmm3,zmm1,zmm19 0x0000000000009c42 <+15474>: vpmaxsq zmm11,zmm17,zmm15 0x0000000000009c48 <+15480>: vpminsq zmm15,zmm8,zmm11 0x0000000000009c4e <+15486>: vpminsq zmm17,zmm20,zmm22 0x0000000000009c54 <+15492>: vpminsq zmm19,zmm21,zmm3 0x0000000000009c5a <+15498>: vpmaxsq zmm8,zmm11,zmm8 0x0000000000009c60 <+15504>: vpmaxsq zmm11,zmm23,zmm16 0x0000000000009c66 <+15510>: vpmaxsq zmm3,zmm3,zmm21 0x0000000000009c6c <+15516>: vpminsq zmm16,zmm10,zmm19 0x0000000000009c72 <+15522>: vpminsq zmm20,zmm17,zmm3 0x0000000000009c78 <+15528>: vpminsq zmm21,zmm15,zmm11 0x0000000000009c7e <+15534>: vpminsq zmm22,zmm8,zmm13 0x0000000000009c84 <+15540>: vpminsq zmm5,zmm5,zmm14 0x0000000000009c8a <+15546>: vpmaxsq zmm14,zmm3,zmm17 0x0000000000009c90 <+15552>: vpmaxsq zmm11,zmm11,zmm15 0x0000000000009c96 <+15558>: vpmaxsq zmm10,zmm19,zmm10 0x0000000000009c9c <+15564>: vpmaxsq zmm8,zmm13,zmm8 0x0000000000009ca2 <+15570>: vpmaxsq zmm13,zmm24,zmm18 0x0000000000009ca8 <+15576>: vpminsq zmm18,zmm10,zmm21 0x0000000000009cae <+15582>: vpminsq zmm19,zmm20,zmm11 0x0000000000009cb4 <+15588>: vpminsq zmm29,zmm16,zmm13 0x0000000000009cba <+15594>: vpminsq zmm15,zmm5,zmm8 0x0000000000009cc0 <+15600>: vpminsq zmm17,zmm14,zmm22 0x0000000000009cc6 <+15606>: vpminsq zmm3,zmm12,zmm28 0x0000000000009ccc <+15612>: vpmaxsq zmm30,zmm21,zmm10 0x0000000000009cd2 <+15618>: vpmaxsq zmm11,zmm11,zmm20 0x0000000000009cd8 <+15624>: vpmaxsq zmm20,zmm13,zmm16 0x0000000000009cde <+15630>: vpmaxsq zmm5,zmm8,zmm5 0x0000000000009ce4 <+15636>: vpmaxsq zmm8,zmm22,zmm14 0x0000000000009cea <+15642>: vshufi64x2 zmm14,zmm17,zmm15,0x4e 0x0000000000009cf1 <+15649>: vshufi64x2 zmm16,zmm8,zmm5,0x4e 0x0000000000009cf8 <+15656>: vshufi64x2 zmm13,zmm11,zmm8,0x4e 0x0000000000009cff <+15663>: vshufi64x2 zmm28,zmm19,zmm17,0x4e 0x0000000000009d06 <+15670>: vshufi64x2 zmm31,zmm5,zmm25,0x4e 0x0000000000009d0d <+15677>: vpminsq zmm1,zmm7,zmm31 0x0000000000009d13 <+15683>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm1 0x0000000000009d1b <+15691>: vmovdqa64 zmm12,zmm27 0x0000000000009d21 <+15697>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x59515] # 0x63240 0x0000000000009d2b <+15707>: vpermt2q zmm12,zmm4,zmm1 0x0000000000009d31 <+15713>: vinserti32x4 zmm21,zmm12,xmm26,0x3 0x0000000000009d38 <+15720>: vpmaxsq zmm12,zmm27,zmm21 0x0000000000009d3e <+15726>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm12 0x0000000000009d46 <+15734>: vpminsq zmm12{k3},zmm27,zmm21 0x0000000000009d4c <+15740>: vshufi64x2 zmm25,zmm15,zmm7,0x4e 0x0000000000009d53 <+15747>: vpminsq zmm23,zmm17,zmm13 0x0000000000009d59 <+15753>: vpmaxsq zmm24,zmm17,zmm13 0x0000000000009d5f <+15759>: vpminsq zmm13,zmm15,zmm16 0x0000000000009d65 <+15765>: vpmaxsq zmm15,zmm15,zmm16 0x0000000000009d6b <+15771>: vpminsq zmm21,zmm8,zmm14 0x0000000000009d71 <+15777>: vpmaxsq zmm22,zmm8,zmm14 0x0000000000009d77 <+15783>: vpminsq zmm14,zmm5,zmm25 0x0000000000009d7d <+15789>: vpmaxsq zmm16,zmm5,zmm25 0x0000000000009d83 <+15795>: vpminsq zmm25,zmm11,zmm28 0x0000000000009d89 <+15801>: vpmaxsq zmm26,zmm11,zmm28 0x0000000000009d8f <+15807>: vshufi64x2 zmm5,zmm30,zmm11,0x4e 0x0000000000009d96 <+15814>: vpmaxsq zmm17,zmm7,zmm31 0x0000000000009d9c <+15820>: vpminsq zmm27,zmm19,zmm5 0x0000000000009da2 <+15826>: vpmaxsq zmm28,zmm19,zmm5 0x0000000000009da8 <+15832>: vshufi64x2 zmm5,zmm18,zmm19,0x4e 0x0000000000009daf <+15839>: vpminsq zmm7,zmm30,zmm5 0x0000000000009db5 <+15845>: vpmaxsq zmm5,zmm30,zmm5 0x0000000000009dbb <+15851>: vshufi64x2 zmm8,zmm20,zmm30,0x4e 0x0000000000009dc2 <+15858>: vpminsq zmm11,zmm18,zmm8 0x0000000000009dc8 <+15864>: vpmaxsq zmm19,zmm18,zmm8 0x0000000000009dce <+15870>: vshufi64x2 zmm8,zmm29,zmm18,0x4e 0x0000000000009dd5 <+15877>: vpminsq zmm18,zmm20,zmm8 0x0000000000009ddb <+15883>: vpmaxsq zmm30,zmm20,zmm8 0x0000000000009de1 <+15889>: vshufi64x2 zmm8,zmm0,zmm20,0x4e 0x0000000000009de8 <+15896>: vpminsq zmm20,zmm29,zmm8 0x0000000000009dee <+15902>: vpmaxsq zmm1,zmm29,zmm8 0x0000000000009df4 <+15908>: vshufi64x2 zmm8,zmm3,zmm29,0x4e 0x0000000000009dfb <+15915>: vpminsq zmm29,zmm0,zmm8 0x0000000000009e01 <+15921>: vpmaxsq zmm10,zmm0,zmm8 0x0000000000009e07 <+15927>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm10 0x0000000000009e0f <+15935>: vshufi64x2 zmm11,zmm19,zmm11,0xe4 0x0000000000009e16 <+15942>: vshufi64x2 zmm18,zmm30,zmm18,0xe4 0x0000000000009e1d <+15949>: vmovdqa64 zmm0,zmm18 0x0000000000009e23 <+15955>: vmovdqa64 zmm31,zmm4 0x0000000000009e29 <+15961>: vpermt2q zmm0,zmm4,zmm20 0x0000000000009e2f <+15967>: vinserti32x4 zmm19,zmm0,xmm19,0x3 0x0000000000009e36 <+15974>: vpmaxsq zmm9,zmm18,zmm19 0x0000000000009e3c <+15980>: vmovdqa64 zmm8,zmm9 0x0000000000009e42 <+15986>: vpminsq zmm8{k3},zmm18,zmm19 0x0000000000009e48 <+15992>: vmovdqa64 zmm19,zmm11 0x0000000000009e4e <+15998>: vpermt2q zmm19,zmm4,zmm18 0x0000000000009e54 <+16004>: vshufi64x2 zmm7,zmm5,zmm7,0xe4 0x0000000000009e5b <+16011>: vinserti32x4 zmm0,zmm19,xmm5,0x3 0x0000000000009e62 <+16018>: vshufi64x2 zmm18,zmm1,zmm20,0xe4 0x0000000000009e69 <+16025>: vshufi64x2 zmm19,zmm10,zmm29,0xe4 0x0000000000009e70 <+16032>: vpminsq zmm5,zmm3,zmm2 0x0000000000009e76 <+16038>: vmovdqa64 zmm20,zmm19 0x0000000000009e7c <+16044>: vpermt2q zmm20,zmm4,zmm5 0x0000000000009e82 <+16050>: vinserti32x4 zmm20,zmm20,xmm1,0x3 0x0000000000009e89 <+16057>: vpmaxsq zmm29,zmm19,zmm20 0x0000000000009e8f <+16063>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm29 0x0000000000009e97 <+16071>: vpminsq zmm29{k3},zmm19,zmm20 0x0000000000009e9d <+16077>: vmovdqa64 zmm20,zmm18 0x0000000000009ea3 <+16083>: vpermt2q zmm20,zmm4,zmm19 0x0000000000009ea9 <+16089>: vinserti32x4 zmm19,zmm20,xmm30,0x3 0x0000000000009eb0 <+16096>: vpminsq zmm20,zmm18,zmm19 0x0000000000009eb6 <+16102>: vmovdqa64 zmm4,zmm8 0x0000000000009ebc <+16108>: vpermt2q zmm4,zmm6,zmm20 0x0000000000009ec2 <+16114>: vpmaxsq zmm10,zmm11,zmm0 0x0000000000009ec8 <+16120>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5952e] # 0x63400 0x0000000000009ed2 <+16130>: vpermt2q zmm4,zmm1,zmm10 0x0000000000009ed8 <+16136>: vmovdqa64 ZMMWORD PTR [rsp+0xb40],zmm4 0x0000000000009ee0 <+16144>: vpminsq zmm10{k3},zmm11,zmm0 0x0000000000009ee6 <+16150>: vmovdqa64 zmm0,zmm7 0x0000000000009eec <+16156>: vmovdqa64 zmm30,zmm31 0x0000000000009ef2 <+16162>: vpermt2q zmm0,zmm31,zmm11 0x0000000000009ef8 <+16168>: vinserti32x4 zmm0,zmm0,xmm28,0x3 0x0000000000009eff <+16175>: vmovdqa64 zmm31,zmm10 0x0000000000009f05 <+16181>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm8 0x0000000000009f0d <+16189>: vpermt2q zmm31,zmm6,zmm8 0x0000000000009f13 <+16195>: vmovdqa64 zmm4,zmm6 0x0000000000009f19 <+16201>: vpmaxsq zmm11,zmm7,zmm0 0x0000000000009f1f <+16207>: vpermt2q zmm31,zmm1,zmm11 0x0000000000009f25 <+16213>: vmovdqa64 ZMMWORD PTR [rsp+0x780],zmm31 0x0000000000009f2d <+16221>: vmovdqa64 zmm8,zmm11 0x0000000000009f33 <+16227>: vpminsq zmm8{k3},zmm7,zmm0 0x0000000000009f39 <+16233>: vshufi64x2 zmm0,zmm28,zmm27,0xe4 0x0000000000009f40 <+16240>: vmovdqa64 zmm11,zmm0 0x0000000000009f46 <+16246>: vpermt2q zmm11,zmm30,zmm7 0x0000000000009f4c <+16252>: vshufi64x2 zmm7,zmm26,zmm25,0xe4 0x0000000000009f53 <+16259>: vinserti32x4 zmm11,zmm11,xmm26,0x3 0x0000000000009f5a <+16266>: vmovdqa64 zmm25,zmm7 0x0000000000009f60 <+16272>: vpermt2q zmm25,zmm30,zmm27 0x0000000000009f66 <+16278>: vshufi64x2 zmm26,zmm24,zmm23,0xe4 0x0000000000009f6d <+16285>: vinserti32x4 zmm25,zmm25,xmm24,0x3 0x0000000000009f74 <+16292>: vpminsq zmm23,zmm0,zmm11 0x0000000000009f7a <+16298>: vpmaxsq zmm24,zmm0,zmm11 0x0000000000009f80 <+16304>: vpblendmq zmm0{k3},zmm24,zmm23 0x0000000000009f86 <+16310>: vmovdqa64 ZMMWORD PTR [rsp+0xb00],zmm0 0x0000000000009f8e <+16318>: vmovdqa64 zmm6,zmm0 0x0000000000009f94 <+16324>: vpermt2q zmm6,zmm4,zmm8 0x0000000000009f9a <+16330>: vpmaxsq zmm0,zmm7,zmm25 0x0000000000009fa0 <+16336>: vpermt2q zmm6,zmm1,zmm0 0x0000000000009fa6 <+16342>: vmovdqa64 ZMMWORD PTR [rsp+0x8c0],zmm6 0x0000000000009fae <+16350>: vmovdqa64 zmm28,zmm0 0x0000000000009fb4 <+16356>: vpminsq zmm28{k3},zmm7,zmm25 0x0000000000009fba <+16362>: vmovdqa64 zmm0,zmm26 0x0000000000009fc0 <+16368>: vpermt2q zmm0,zmm30,zmm7 0x0000000000009fc6 <+16374>: vshufi64x2 zmm7,zmm22,zmm21,0xe4 0x0000000000009fcd <+16381>: vinserti32x4 zmm0,zmm0,xmm22,0x3 0x0000000000009fd4 <+16388>: vmovdqa64 zmm11,zmm7 0x0000000000009fda <+16394>: vpermt2q zmm11,zmm30,zmm26 0x0000000000009fe0 <+16400>: vpminsq zmm21,zmm26,zmm0 0x0000000000009fe6 <+16406>: vpmaxsq zmm22,zmm26,zmm0 0x0000000000009fec <+16412>: vinserti32x4 zmm0,zmm11,xmm15,0x3 0x0000000000009ff3 <+16419>: vpblendmq zmm2{k3},zmm22,zmm21 0x0000000000009ff9 <+16425>: vmovdqa64 ZMMWORD PTR [rsp+0xac0],zmm2 0x000000000000a001 <+16433>: vpermt2q zmm2,zmm4,zmm28 0x000000000000a007 <+16439>: vpmaxsq zmm11,zmm7,zmm0 0x000000000000a00d <+16445>: vpermt2q zmm2,zmm1,zmm11 0x000000000000a013 <+16451>: vmovdqa64 ZMMWORD PTR [rsp+0x880],zmm2 0x000000000000a01b <+16459>: vmovdqa64 zmm26,zmm11 0x000000000000a021 <+16465>: vpminsq zmm26{k3},zmm7,zmm0 0x000000000000a027 <+16471>: vshufi64x2 zmm0,zmm15,zmm13,0xe4 0x000000000000a02e <+16478>: vmovdqa64 zmm11,zmm0 0x000000000000a034 <+16484>: vmovdqa64 zmm15,zmm30 0x000000000000a03a <+16490>: vpermt2q zmm11,zmm30,zmm7 0x000000000000a040 <+16496>: vshufi64x2 zmm7,zmm16,zmm14,0xe4 0x000000000000a047 <+16503>: vinserti32x4 zmm11,zmm11,xmm16,0x3 0x000000000000a04e <+16510>: vmovdqa64 zmm14,zmm7 0x000000000000a054 <+16516>: vpermt2q zmm14,zmm30,zmm13 0x000000000000a05a <+16522>: vshufi64x2 zmm13,zmm17,ZMMWORD PTR [rsp+0x480],0xe4 0x000000000000a063 <+16531>: vinserti32x4 zmm14,zmm14,xmm17,0x3 0x000000000000a06a <+16538>: vpminsq zmm6,zmm0,zmm11 0x000000000000a070 <+16544>: vpmaxsq zmm0,zmm0,zmm11 0x000000000000a076 <+16550>: vpblendmq zmm2{k3},zmm0,zmm6 0x000000000000a07c <+16556>: vmovdqa64 ZMMWORD PTR [rsp+0xa80],zmm2 0x000000000000a084 <+16564>: vpermt2q zmm2,zmm4,zmm26 0x000000000000a08a <+16570>: vpmaxsq zmm11,zmm7,zmm14 0x000000000000a090 <+16576>: vpermt2q zmm2,zmm1,zmm11 0x000000000000a096 <+16582>: vmovdqa64 ZMMWORD PTR [rsp+0xa00],zmm2 0x000000000000a09e <+16590>: vmovdqa64 zmm16,zmm11 0x000000000000a0a4 <+16596>: vpminsq zmm16{k3},zmm7,zmm14 0x000000000000a0aa <+16602>: vmovdqa64 zmm11,zmm13 0x000000000000a0b0 <+16608>: vpermt2q zmm11,zmm30,zmm7 0x000000000000a0b6 <+16614>: vinserti32x4 zmm2,zmm11,XMMWORD PTR [rsp+0x300],0x3 0x000000000000a0bf <+16623>: vpminsq zmm7,zmm13,zmm2 0x000000000000a0c5 <+16629>: vpmaxsq zmm2,zmm13,zmm2 0x000000000000a0cb <+16635>: vpblendmq zmm11{k3},zmm2,zmm7 0x000000000000a0d1 <+16641>: vmovdqa64 ZMMWORD PTR [rsp+0xa40],zmm11 0x000000000000a0d9 <+16649>: vmovdqa64 zmm13,zmm4 0x000000000000a0df <+16655>: vpermt2q zmm11,zmm4,zmm16 0x000000000000a0e5 <+16661>: vpermt2q zmm11,zmm1,ZMMWORD PTR [rsp+0x400] 0x000000000000a0ed <+16669>: vmovdqa64 ZMMWORD PTR [rsp+0xd40],zmm11 0x000000000000a0f5 <+16677>: vpmaxsq zmm11,zmm18,zmm19 0x000000000000a0fb <+16683>: vpblendmq zmm4{k3},zmm11,zmm20 0x000000000000a101 <+16689>: vmovdqa64 ZMMWORD PTR [rsp+0xcc0],zmm4 0x000000000000a109 <+16697>: vpermt2q zmm4,zmm13,zmm29 0x000000000000a10f <+16703>: vpermt2q zmm4,zmm1,zmm9 0x000000000000a115 <+16709>: vmovdqa64 ZMMWORD PTR [rsp+0xc80],zmm4 0x000000000000a11d <+16717>: vmovdqa64 zmm4,zmm12 0x000000000000a123 <+16723>: vpermt2q zmm4,zmm13,zmm7 0x000000000000a129 <+16729>: vpermt2q zmm4,zmm1,ZMMWORD PTR [rsp+0x380] 0x000000000000a131 <+16737>: vmovdqa64 ZMMWORD PTR [rsp+0xd00],zmm4 0x000000000000a139 <+16745>: vmovdqa64 zmm7,zmm1 0x000000000000a13f <+16751>: vpmaxsq zmm1,zmm3,ZMMWORD PTR [rsp+0x2c0] 0x000000000000a147 <+16759>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x340] 0x000000000000a14f <+16767>: vinserti64x4 zmm3,zmm9,ymm3,0x1 0x000000000000a156 <+16774>: vpminsq zmm4,zmm9,zmm3 0x000000000000a15c <+16780>: vpmaxsq zmm3,zmm9,zmm3 0x000000000000a162 <+16786>: vshufi64x2 zmm3,zmm3,zmm4,0xe4 0x000000000000a169 <+16793>: vshufi64x2 zmm4,zmm1,zmm5,0xe4 0x000000000000a170 <+16800>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x59346] # 0x634c0 0x000000000000a17a <+16810>: vpermi2q zmm5,zmm3,zmm1 0x000000000000a180 <+16816>: vpmaxsq zmm9,zmm3,zmm5 0x000000000000a186 <+16822>: vpminsq zmm9{k3},zmm3,zmm5 0x000000000000a18c <+16828>: vpermi2q zmm15,zmm4,zmm3 0x000000000000a192 <+16834>: vinserti32x4 zmm1,zmm15,XMMWORD PTR [rsp+0x540],0x3 0x000000000000a19b <+16843>: vpminsq zmm3,zmm4,zmm1 0x000000000000a1a1 <+16849>: vpmaxsq zmm1,zmm4,zmm1 0x000000000000a1a7 <+16855>: vmovdqa64 ZMMWORD PTR [rsp+0x9c0],zmm8 0x000000000000a1af <+16863>: vmovdqa64 ZMMWORD PTR [rsp+0x980],zmm10 0x000000000000a1b7 <+16871>: vmovdqa64 zmm5,zmm13 0x000000000000a1bd <+16877>: vpermt2q zmm8,zmm13,zmm10 0x000000000000a1c3 <+16883>: vpermt2q zmm8,zmm7,zmm24 0x000000000000a1c9 <+16889>: vmovdqa64 ZMMWORD PTR [rsp+0xe80],zmm8 0x000000000000a1d1 <+16897>: vmovdqa64 ZMMWORD PTR [rsp+0x940],zmm28 0x000000000000a1d9 <+16905>: vpermt2q zmm28,zmm13,zmm23 0x000000000000a1df <+16911>: vpermt2q zmm28,zmm7,zmm22 0x000000000000a1e5 <+16917>: vmovdqa64 ZMMWORD PTR [rsp+0xe00],zmm28 0x000000000000a1ed <+16925>: vmovdqa64 ZMMWORD PTR [rsp+0x900],zmm26 0x000000000000a1f5 <+16933>: vpermt2q zmm26,zmm13,zmm21 0x000000000000a1fb <+16939>: vpermt2q zmm26,zmm7,zmm0 0x000000000000a201 <+16945>: vmovdqa64 ZMMWORD PTR [rsp+0xec0],zmm26 0x000000000000a209 <+16953>: vmovdqa64 ZMMWORD PTR [rsp+0xd80],zmm16 0x000000000000a211 <+16961>: vpermt2q zmm16,zmm13,zmm6 0x000000000000a217 <+16967>: vpermt2q zmm16,zmm7,zmm2 0x000000000000a21d <+16973>: vmovdqa64 ZMMWORD PTR [rsp+0xe40],zmm16 0x000000000000a225 <+16981>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm29 0x000000000000a22d <+16989>: vpermt2q zmm29,zmm13,zmm3 0x000000000000a233 <+16995>: vpermt2q zmm29,zmm7,zmm11 0x000000000000a239 <+17001>: vmovdqa64 ZMMWORD PTR [rsp+0x1040],zmm29 0x000000000000a241 <+17009>: vpblendmq zmm0{k3},zmm1,zmm3 0x000000000000a247 <+17015>: vmovdqa64 ZMMWORD PTR [rsp+0xc40],zmm0 0x000000000000a24f <+17023>: vpermi2q zmm5,zmm0,zmm9 0x000000000000a255 <+17029>: vpermt2q zmm5,zmm7,ZMMWORD PTR [rsp+0x240] 0x000000000000a25d <+17037>: vmovdqa64 ZMMWORD PTR [rsp+0xf40],zmm5 0x000000000000a265 <+17045>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x59311] # 0x63580 0x000000000000a26f <+17055>: vmovdqa64 ZMMWORD PTR [rsp+0xf00],zmm9 0x000000000000a277 <+17063>: vpermi2q zmm0,zmm9,zmm1 0x000000000000a27d <+17069>: vmovdqa64 ZMMWORD PTR [rsp+0x1000],zmm0 0x000000000000a285 <+17077>: mov rbx,QWORD PTR [rsp+0x6b0] 0x000000000000a28d <+17085>: mov rax,QWORD PTR [rsp+0x6b8] 0x000000000000a295 <+17093>: mov QWORD PTR [rsp+0x6d8],rax 0x000000000000a29d <+17101>: vpxor xmm0,xmm0,xmm0 0x000000000000a2a1 <+17105>: vmovdqa XMMWORD PTR [rsp+0x6c0],xmm0 0x000000000000a2aa <+17114>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5928c] # 0x63540 0x000000000000a2b4 <+17124>: vmovdqa64 ZMMWORD PTR [rsp+0x800],zmm12 0x000000000000a2bc <+17132>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x580] 0x000000000000a2c4 <+17140>: vpermi2q zmm1,zmm0,zmm12 0x000000000000a2ca <+17146>: vmovdqa64 ZMMWORD PTR [rsp+0xfc0],zmm1 0x000000000000a2d2 <+17154>: lea rsi,[rsp+0x6c0] 0x000000000000a2da <+17162>: mov edi,0x1 0x000000000000a2df <+17167>: vzeroupper 0x000000000000a2e2 <+17170>: call 0x5470 <clock_gettime@plt> 0x000000000000a2e7 <+17175>: mov r12,QWORD PTR [rsp+0x6c0] 0x000000000000a2ef <+17183>: sub r12,rbx 0x000000000000a2f2 <+17186>: mov r13,QWORD PTR [rsp+0x6c8] 0x000000000000a2fa <+17194>: mov edi,0x80 0x000000000000a2ff <+17199>: call 0xc5f0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000a304 <+17204>: mov r14,rax 0x000000000000a307 <+17207>: test rax,rax 0x000000000000a30a <+17210>: jle 0xa321 <main+17233> 0x000000000000a30c <+17212>: mov edi,0x1 0x000000000000a311 <+17217>: mov rsi,r14 0x000000000000a314 <+17220>: call 0x31b40 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000a319 <+17225>: mov r15,rax 0x000000000000a31c <+17228>: mov rbx,r14 0x000000000000a31f <+17231>: jmp 0xa326 <main+17238> 0x000000000000a321 <+17233>: xor r15d,r15d 0x000000000000a324 <+17236>: xor ebx,ebx 0x000000000000a326 <+17238>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x8c0] 0x000000000000a32e <+17246>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0xb00] 0x000000000000a336 <+17254>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm0 0x000000000000a33e <+17262>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x780] 0x000000000000a346 <+17270>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x980] 0x000000000000a34e <+17278>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm0 0x000000000000a356 <+17286>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xb40] 0x000000000000a35e <+17294>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x7c0] 0x000000000000a366 <+17302>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm0 0x000000000000a36e <+17310>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xa00] 0x000000000000a376 <+17318>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0xa80] 0x000000000000a37e <+17326>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm0 0x000000000000a386 <+17334>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x880] 0x000000000000a38e <+17342>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0xac0] 0x000000000000a396 <+17350>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm0 0x000000000000a39e <+17358>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xe00] 0x000000000000a3a6 <+17366>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x940] 0x000000000000a3ae <+17374>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x000000000000a3b6 <+17382>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xe80] 0x000000000000a3be <+17390>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x9c0] 0x000000000000a3c6 <+17398>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm0 0x000000000000a3ce <+17406>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xc80] 0x000000000000a3d6 <+17414>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0xcc0] 0x000000000000a3de <+17422>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm0 0x000000000000a3e6 <+17430>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x1040] 0x000000000000a3ee <+17438>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x600] 0x000000000000a3f6 <+17446>: vmovdqa64 ZMMWORD PTR [rsp+0x5c0],zmm0 0x000000000000a3fe <+17454>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xd40] 0x000000000000a406 <+17462>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0xa40] 0x000000000000a40e <+17470>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm0 0x000000000000a416 <+17478>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xe40] 0x000000000000a41e <+17486>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0xd80] 0x000000000000a426 <+17494>: vmovdqa64 ZMMWORD PTR [rsp+0x840],zmm0 0x000000000000a42e <+17502>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xec0] 0x000000000000a436 <+17510>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x900] 0x000000000000a43e <+17518>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm0 0x000000000000a446 <+17526>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x1000] 0x000000000000a44e <+17534>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0xf00] 0x000000000000a456 <+17542>: vmovdqa64 ZMMWORD PTR [rsp+0x640],zmm0 0x000000000000a45e <+17550>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xfc0] 0x000000000000a466 <+17558>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x580] 0x000000000000a46e <+17566>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm0 0x000000000000a476 <+17574>: mov al,0x2a 0x000000000000a478 <+17576>: kmovd k1,eax 0x000000000000a47c <+17580>: kmovw WORD PTR [rsp+0x23e],k1 0x000000000000a485 <+17589>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xc40] 0x000000000000a48d <+17597>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0xf40] 0x000000000000a495 <+17605>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x000000000000a49d <+17613>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xd00] 0x000000000000a4a5 <+17621>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x800] 0x000000000000a4ad <+17629>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm0 0x000000000000a4b5 <+17637>: imul r12,r12,0x3b9aca00 0x000000000000a4bc <+17644>: sub r13,QWORD PTR [rsp+0x6d8] 0x000000000000a4c4 <+17652>: lea rdx,[rip+0x590f5] # 0x635c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000a4cb <+17659>: mov ecx,0x80 0x000000000000a4d0 <+17664>: mov rdi,r15 0x000000000000a4d3 <+17667>: mov rsi,r14 0x000000000000a4d6 <+17670>: xor eax,eax 0x000000000000a4d8 <+17672>: vzeroupper 0x000000000000a4db <+17675>: call 0x57c0 <snprintf@plt> 0x000000000000a4e0 <+17680>: cdqe 0x000000000000a4e2 <+17682>: inc rax 0x000000000000a4e5 <+17685>: mov QWORD PTR [rsp+0x720],r15 0x000000000000a4ed <+17693>: mov QWORD PTR [rsp+0x728],rax 0x000000000000a4f5 <+17701>: mov QWORD PTR [rsp+0x730],rbx 0x000000000000a4fd <+17709>: lea rdx,[rip+0x590dc] # 0x635e0 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x000000000000a504 <+17716>: lea rdi,[rsp+0xbc8] 0x000000000000a50c <+17724>: lea rsi,[rsp+0x720] 0x000000000000a514 <+17732>: mov ecx,0x6 0x000000000000a519 <+17737>: call 0x11c40 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x000000000000a51e <+17742>: mov rdi,QWORD PTR [rsp+0x720] 0x000000000000a526 <+17750>: test rdi,rdi 0x000000000000a529 <+17753>: je 0xa530 <main+17760> 0x000000000000a52b <+17755>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000a530 <+17760>: kmovw k1,WORD PTR [rsp+0xf80] 0x000000000000a539 <+17769>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x400] 0x000000000000a541 <+17777>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x8c0] 0x000000000000a549 <+17785>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0xb00] 0x000000000000a551 <+17793>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm0 0x000000000000a559 <+17801>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x780] 0x000000000000a561 <+17809>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x340] 0x000000000000a569 <+17817>: vpminsq zmm1{k1},zmm0,ZMMWORD PTR [rsp+0x980] 0x000000000000a571 <+17825>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm1 0x000000000000a579 <+17833>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0xb40] 0x000000000000a581 <+17841>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x240] 0x000000000000a589 <+17849>: vpminsq zmm1{k1},zmm0,ZMMWORD PTR [rsp+0x7c0] 0x000000000000a591 <+17857>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm1 0x000000000000a599 <+17865>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x380] 0x000000000000a5a1 <+17873>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xa00] 0x000000000000a5a9 <+17881>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0xa80] 0x000000000000a5b1 <+17889>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm0 0x000000000000a5b9 <+17897>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x300] 0x000000000000a5c1 <+17905>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x880] 0x000000000000a5c9 <+17913>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0xac0] 0x000000000000a5d1 <+17921>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm0 0x000000000000a5d9 <+17929>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x2c0] 0x000000000000a5e1 <+17937>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xe00] 0x000000000000a5e9 <+17945>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x940] 0x000000000000a5f1 <+17953>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x000000000000a5f9 <+17961>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x440] 0x000000000000a601 <+17969>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xe80] 0x000000000000a609 <+17977>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x9c0] 0x000000000000a611 <+17985>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm0 0x000000000000a619 <+17993>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x480] 0x000000000000a621 <+18001>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xc80] 0x000000000000a629 <+18009>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0xcc0] 0x000000000000a631 <+18017>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm0 0x000000000000a639 <+18025>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x5c0] 0x000000000000a641 <+18033>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x1040] 0x000000000000a649 <+18041>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x600] 0x000000000000a651 <+18049>: vmovdqa64 ZMMWORD PTR [rsp+0x5c0],zmm0 0x000000000000a659 <+18057>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x540] 0x000000000000a661 <+18065>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xd40] 0x000000000000a669 <+18073>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0xa40] 0x000000000000a671 <+18081>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm0 0x000000000000a679 <+18089>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x840] 0x000000000000a681 <+18097>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xe40] 0x000000000000a689 <+18105>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0xd80] 0x000000000000a691 <+18113>: vmovdqa64 ZMMWORD PTR [rsp+0x840],zmm0 0x000000000000a699 <+18121>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x500] 0x000000000000a6a1 <+18129>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xec0] 0x000000000000a6a9 <+18137>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x900] 0x000000000000a6b1 <+18145>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm0 0x000000000000a6b9 <+18153>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x640] 0x000000000000a6c1 <+18161>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x1000] 0x000000000000a6c9 <+18169>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0xf00] 0x000000000000a6d1 <+18177>: vmovdqa64 ZMMWORD PTR [rsp+0x640],zmm0 0x000000000000a6d9 <+18185>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x3c0] 0x000000000000a6e1 <+18193>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xfc0] 0x000000000000a6e9 <+18201>: kmovw k2,WORD PTR [rsp+0x23e] 0x000000000000a6f2 <+18210>: vpminsq zmm0{k2},zmm1,ZMMWORD PTR [rsp+0x580] 0x000000000000a6fa <+18218>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm0 0x000000000000a702 <+18226>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x280] 0x000000000000a70a <+18234>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xc40] 0x000000000000a712 <+18242>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0xf40] 0x000000000000a71a <+18250>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x000000000000a722 <+18258>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x4c0] 0x000000000000a72a <+18266>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xd00] 0x000000000000a732 <+18274>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x800] 0x000000000000a73a <+18282>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm0 0x000000000000a742 <+18290>: add r13,r12 0x000000000000a745 <+18293>: mov edi,0x1 0x000000000000a74a <+18298>: mov esi,0x3 0x000000000000a74f <+18303>: vzeroupper 0x000000000000a752 <+18306>: call 0x31b40 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000a757 <+18311>: xor ecx,ecx 0x000000000000a759 <+18313>: nop DWORD PTR [rax+0x0] 0x000000000000a760 <+18320>: mov BYTE PTR [rax+rcx*1],0x0 0x000000000000a764 <+18324>: inc rcx 0x000000000000a767 <+18327>: cmp rcx,0x3 0x000000000000a76b <+18331>: jne 0xa760 <main+18320> 0x000000000000a76d <+18333>: mov WORD PTR [rax],0x203a 0x000000000000a772 <+18338>: mov BYTE PTR [rax+0x2],0x0 0x000000000000a776 <+18342>: mov QWORD PTR [rsp+0x738],rax 0x000000000000a77e <+18350>: mov QWORD PTR [rsp+0x740],0x3 0x000000000000a78a <+18362>: mov QWORD PTR [rsp+0x748],0x3 0x000000000000a796 <+18374>: lea rdi,[rsp+0xbe0] 0x000000000000a79e <+18382>: lea rsi,[rsp+0xbc8] 0x000000000000a7a6 <+18390>: lea rdx,[rsp+0x738] 0x000000000000a7ae <+18398>: call 0x11800 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x000000000000a7b3 <+18403>: mov rdi,QWORD PTR [rsp+0x738] 0x000000000000a7bb <+18411>: test rdi,rdi 0x000000000000a7be <+18414>: je 0xa7c5 <main+18421> 0x000000000000a7c0 <+18416>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000a7c5 <+18421>: mov rdi,QWORD PTR [rsp+0xbc8] 0x000000000000a7cd <+18429>: test rdi,rdi 0x000000000000a7d0 <+18432>: je 0xa7d7 <main+18439> 0x000000000000a7d2 <+18434>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000a7d7 <+18439>: vmovaps zmm0,ZMMWORD PTR [rsp+0x2c0] 0x000000000000a7df <+18447>: vmovaps ZMMWORD PTR [rsp],zmm0 0x000000000000a7e6 <+18454>: vmovaps zmm0,ZMMWORD PTR [rsp+0x300] 0x000000000000a7ee <+18462>: vmovaps ZMMWORD PTR [rsp+0x40],zmm0 0x000000000000a7f6 <+18470>: vmovaps zmm0,ZMMWORD PTR [rsp+0x500] 0x000000000000a7fe <+18478>: vmovaps ZMMWORD PTR [rsp+0x80],zmm0 0x000000000000a806 <+18486>: vmovaps zmm0,ZMMWORD PTR [rsp+0x380] 0x000000000000a80e <+18494>: vmovaps ZMMWORD PTR [rsp+0xc0],zmm0 0x000000000000a816 <+18502>: vmovaps zmm0,ZMMWORD PTR [rsp+0x840] 0x000000000000a81e <+18510>: vmovaps ZMMWORD PTR [rsp+0x100],zmm0 0x000000000000a826 <+18518>: vmovaps zmm0,ZMMWORD PTR [rsp+0x540] 0x000000000000a82e <+18526>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x000000000000a836 <+18534>: vmovaps zmm0,ZMMWORD PTR [rsp+0x4c0] 0x000000000000a83e <+18542>: vmovaps ZMMWORD PTR [rsp+0x180],zmm0 0x000000000000a846 <+18550>: vmovaps zmm0,ZMMWORD PTR [rsp+0x3c0] 0x000000000000a84e <+18558>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm0 0x000000000000a856 <+18566>: lea r14,[rsp+0xde8] 0x000000000000a85e <+18574>: mov rdi,r14 0x000000000000a861 <+18577>: vmovaps zmm0,ZMMWORD PTR [rsp+0x640] 0x000000000000a869 <+18585>: vmovaps zmm1,ZMMWORD PTR [rsp+0x280] 0x000000000000a871 <+18593>: vmovaps zmm2,ZMMWORD PTR [rsp+0x5c0] 0x000000000000a879 <+18601>: vmovaps zmm3,ZMMWORD PTR [rsp+0x480] 0x000000000000a881 <+18609>: vmovaps zmm4,ZMMWORD PTR [rsp+0x240] 0x000000000000a889 <+18617>: vmovaps zmm5,ZMMWORD PTR [rsp+0x340] 0x000000000000a891 <+18625>: vmovaps zmm6,ZMMWORD PTR [rsp+0x440] 0x000000000000a899 <+18633>: vmovaps zmm7,ZMMWORD PTR [rsp+0x400] 0x000000000000a8a1 <+18641>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=128> 0x000000000000a8a6 <+18646>: lea rdi,[rsp+0xbf8] 0x000000000000a8ae <+18654>: lea rsi,[rsp+0xbe0] 0x000000000000a8b6 <+18662>: mov rdx,r14 0x000000000000a8b9 <+18665>: vzeroupper 0x000000000000a8bc <+18668>: call 0x11800 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x000000000000a8c1 <+18673>: mov rdi,QWORD PTR [rsp+0xde8] 0x000000000000a8c9 <+18681>: test rdi,rdi 0x000000000000a8cc <+18684>: je 0xa8d3 <main+18691> 0x000000000000a8ce <+18686>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000a8d3 <+18691>: mov rdi,QWORD PTR [rsp+0xbe0] 0x000000000000a8db <+18699>: test rdi,rdi 0x000000000000a8de <+18702>: je 0xa8e5 <main+18709> 0x000000000000a8e0 <+18704>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000a8e5 <+18709>: lea rdi,[rsp+0xbf8] 0x000000000000a8ed <+18717>: call 0xd0a0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x000000000000a8f2 <+18722>: mov rdi,QWORD PTR [rsp+0xbf8] 0x000000000000a8fa <+18730>: test rdi,rdi 0x000000000000a8fd <+18733>: je 0xa904 <main+18740> 0x000000000000a8ff <+18735>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000a904 <+18740>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x500] 0x000000000000a90c <+18748>: vpaddq zmm0,zmm0,ZMMWORD PTR [rsp+0x5c0] 0x000000000000a914 <+18756>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x4c0] 0x000000000000a91c <+18764>: vpaddq zmm1,zmm1,ZMMWORD PTR [rsp+0x440] 0x000000000000a924 <+18772>: vpaddq zmm0,zmm0,zmm1 0x000000000000a92a <+18778>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x640] 0x000000000000a932 <+18786>: vpaddq zmm1,zmm1,ZMMWORD PTR [rsp+0x2c0] 0x000000000000a93a <+18794>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x840] 0x000000000000a942 <+18802>: vpaddq zmm2,zmm2,ZMMWORD PTR [rsp+0x240] 0x000000000000a94a <+18810>: vpaddq zmm1,zmm1,zmm2 0x000000000000a950 <+18816>: vpaddq zmm0,zmm1,zmm0 0x000000000000a956 <+18822>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x480] 0x000000000000a95e <+18830>: vpaddq zmm1,zmm1,ZMMWORD PTR [rsp+0x380] 0x000000000000a966 <+18838>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x3c0] 0x000000000000a96e <+18846>: vpaddq zmm2,zmm2,ZMMWORD PTR [rsp+0x400] 0x000000000000a976 <+18854>: vpaddq zmm1,zmm1,zmm2 0x000000000000a97c <+18860>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x280] 0x000000000000a984 <+18868>: vpaddq zmm2,zmm2,ZMMWORD PTR [rsp+0x300] 0x000000000000a98c <+18876>: vmovdqa64 zmm3,ZMMWORD PTR [rsp+0x540] 0x000000000000a994 <+18884>: vpaddq zmm3,zmm3,ZMMWORD PTR [rsp+0x340] 0x000000000000a99c <+18892>: vpaddq zmm2,zmm2,zmm3 0x000000000000a9a2 <+18898>: vpaddq zmm1,zmm2,zmm1 0x000000000000a9a8 <+18904>: vpaddq zmm0,zmm0,zmm1 0x000000000000a9ae <+18910>: vextracti64x4 ymm1,zmm0,0x1 0x000000000000a9b5 <+18917>: vpaddq ymm0,ymm0,ymm1 0x000000000000a9b9 <+18921>: vextracti128 xmm1,ymm0,0x1 0x000000000000a9bf <+18927>: vpaddq xmm0,xmm0,xmm1 0x000000000000a9c3 <+18931>: vpshufd xmm1,xmm0,0xee 0x000000000000a9c8 <+18936>: vpaddq xmm0,xmm0,xmm1 0x000000000000a9cc <+18940>: vmovq rax,xmm0 0x000000000000a9d1 <+18945>: vmovq QWORD PTR [rsp+0x6e8],xmm0 0x000000000000a9da <+18954>: lea rcx,[rsp+0x6e8] 0x000000000000a9e2 <+18962>: mov QWORD PTR [rsp+0x6e0],rcx 0x000000000000a9ea <+18970>: mov rdi,r13 0x000000000000a9ed <+18973>: vzeroupper 0x000000000000a9f0 <+18976>: call 0xc5f0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000a9f5 <+18981>: mov r14,rax 0x000000000000a9f8 <+18984>: test rax,rax 0x000000000000a9fb <+18987>: jle 0xaa12 <main+19010> 0x000000000000a9fd <+18989>: mov edi,0x1 0x000000000000aa02 <+18994>: mov rsi,r14 0x000000000000aa05 <+18997>: call 0x31b40 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000aa0a <+19002>: mov r15,rax 0x000000000000aa0d <+19005>: mov rbx,r14 0x000000000000aa10 <+19008>: jmp 0xaa17 <main+19015> 0x000000000000aa12 <+19010>: xor r15d,r15d 0x000000000000aa15 <+19013>: xor ebx,ebx 0x000000000000aa17 <+19015>: lea rdx,[rip+0x58ba2] # 0x635c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000aa1e <+19022>: mov rdi,r15 0x000000000000aa21 <+19025>: mov rsi,r14 0x000000000000aa24 <+19028>: mov rcx,r13 0x000000000000aa27 <+19031>: xor eax,eax 0x000000000000aa29 <+19033>: call 0x57c0 <snprintf@plt> 0x000000000000aa2e <+19038>: cdqe 0x000000000000aa30 <+19040>: inc rax 0x000000000000aa33 <+19043>: mov QWORD PTR [rsp+0x750],r15 0x000000000000aa3b <+19051>: mov QWORD PTR [rsp+0x758],rax 0x000000000000aa43 <+19059>: mov QWORD PTR [rsp+0x760],rbx 0x000000000000aa4b <+19067>: lea rdx,[rip+0x58b9e] # 0x635f0 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x000000000000aa52 <+19074>: lea rdi,[rsp+0xc10] 0x000000000000aa5a <+19082>: lea rsi,[rsp+0x750] 0x000000000000aa62 <+19090>: mov ecx,0xb 0x000000000000aa67 <+19095>: call 0x11c40 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x000000000000aa6c <+19100>: mov rdi,QWORD PTR [rsp+0x750] 0x000000000000aa74 <+19108>: test rdi,rdi 0x000000000000aa77 <+19111>: je 0xaa7e <main+19118> 0x000000000000aa79 <+19113>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000aa7e <+19118>: mov edi,0x1 0x000000000000aa83 <+19123>: mov esi,0x4 0x000000000000aa88 <+19128>: call 0x31b40 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000aa8d <+19133>: xor ecx,ecx 0x000000000000aa8f <+19135>: nop 0x000000000000aa90 <+19136>: mov BYTE PTR [rax+rcx*1],0x0 0x000000000000aa94 <+19140>: inc rcx 0x000000000000aa97 <+19143>: cmp rcx,0x4 0x000000000000aa9b <+19147>: jne 0xaa90 <main+19136> 0x000000000000aa9d <+19149>: mov DWORD PTR [rax],0x736e20 0x000000000000aaa3 <+19155>: mov QWORD PTR [rsp+0x768],rax 0x000000000000aaab <+19163>: mov QWORD PTR [rsp+0x770],0x4 0x000000000000aab7 <+19175>: mov QWORD PTR [rsp+0x778],0x4 0x000000000000aac3 <+19187>: lea rdi,[rsp+0xc28] 0x000000000000aacb <+19195>: lea rsi,[rsp+0xc10] 0x000000000000aad3 <+19203>: lea rdx,[rsp+0x768] 0x000000000000aadb <+19211>: call 0x11800 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x000000000000aae0 <+19216>: mov rdi,QWORD PTR [rsp+0x768] 0x000000000000aae8 <+19224>: test rdi,rdi 0x000000000000aaeb <+19227>: je 0xaaf2 <main+19234> 0x000000000000aaed <+19229>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000aaf2 <+19234>: mov rdi,QWORD PTR [rsp+0xc10] 0x000000000000aafa <+19242>: test rdi,rdi 0x000000000000aafd <+19245>: je 0xab04 <main+19252> 0x000000000000aaff <+19247>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000ab04 <+19252>: lea rdi,[rsp+0xc28] 0x000000000000ab0c <+19260>: call 0xd0a0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x000000000000ab11 <+19265>: mov rdi,QWORD PTR [rsp+0xc28] 0x000000000000ab19 <+19273>: test rdi,rdi 0x000000000000ab1c <+19276>: je 0xab23 <main+19283> 0x000000000000ab1e <+19278>: call 0x31b60 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000ab23 <+19283>: call 0x2df60 <KGEN_CompilerRT_DestroyGlobals()> 0x000000000000ab28 <+19288>: xor eax,eax 0x000000000000ab2a <+19290>: lea rsp,[rbp-0x28] 0x000000000000ab2e <+19294>: pop rbx 0x000000000000ab2f <+19295>: pop r12 0x000000000000ab31 <+19297>: pop r13 0x000000000000ab33 <+19299>: pop r14 0x000000000000ab35 <+19301>: pop r15 0x000000000000ab37 <+19303>: pop rbp 0x000000000000ab38 <+19304>: ret End of assembler dump. --- disassemble/int64_16.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005db0 <+0>: push rbp 0x0000000000005db1 <+1>: mov rbp,rsp 0x0000000000005db4 <+4>: push r15 0x0000000000005db6 <+6>: push r14 0x0000000000005db8 <+8>: push r13 0x0000000000005dba <+10>: push r12 0x0000000000005dbc <+12>: push rbx 0x0000000000005dbd <+13>: and rsp,0xffffffffffffffc0 0x0000000000005dc1 <+17>: sub rsp,0x440 0x0000000000005dc8 <+24>: call 0x2f260 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005dcd <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005dd1 <+33>: mov ebx,0x11 0x0000000000005dd6 <+38>: xor r14d,r14d 0x0000000000005dd9 <+41>: vxorps xmm1,xmm1,xmm1 0x0000000000005ddd <+45>: nop DWORD PTR [rax] 0x0000000000005de0 <+48>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005de8 <+56>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005df0 <+64>: vzeroupper 0x0000000000005df3 <+67>: call 0x2e1b0 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005df8 <+72>: mov edx,0x64 0x0000000000005dfd <+77>: mov rdi,rax 0x0000000000005e00 <+80>: xor esi,esi 0x0000000000005e02 <+82>: call 0x2e5c0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005e07 <+87>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005e0f <+95>: vmovaps ZMMWORD PTR [rsp+0x380],zmm0 0x0000000000005e17 <+103>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005e1f <+111>: vmovaps ZMMWORD PTR [rsp+0x3c0],zmm0 0x0000000000005e27 <+119>: mov ecx,r14d 0x0000000000005e2a <+122>: and ecx,0xf 0x0000000000005e2d <+125>: mov QWORD PTR [rsp+rcx*8+0x380],rax 0x0000000000005e35 <+133>: vmovaps zmm0,ZMMWORD PTR [rsp+0x380] 0x0000000000005e3d <+141>: vmovaps zmm1,ZMMWORD PTR [rsp+0x3c0] 0x0000000000005e45 <+149>: dec rbx 0x0000000000005e48 <+152>: inc r14 0x0000000000005e4b <+155>: cmp rbx,0x1 0x0000000000005e4f <+159>: ja 0x5de0 <main+48> 0x0000000000005e51 <+161>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005e59 <+169>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005e61 <+177>: mov edi,0x10 0x0000000000005e66 <+182>: vzeroupper 0x0000000000005e69 <+185>: call 0x8140 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005e6e <+190>: mov rbx,rax 0x0000000000005e71 <+193>: test rax,rax 0x0000000000005e74 <+196>: jle 0x5e8b <main+219> 0x0000000000005e76 <+198>: mov edi,0x1 0x0000000000005e7b <+203>: mov rsi,rbx 0x0000000000005e7e <+206>: call 0x2d690 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e83 <+211>: mov r14,rax 0x0000000000005e86 <+214>: mov r15,rbx 0x0000000000005e89 <+217>: jmp 0x5e91 <main+225> 0x0000000000005e8b <+219>: xor r14d,r14d 0x0000000000005e8e <+222>: xor r15d,r15d 0x0000000000005e91 <+225>: lea rdx,[rip+0x57568] # 0x5d400 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005e98 <+232>: mov ecx,0x10 0x0000000000005e9d <+237>: mov rdi,r14 0x0000000000005ea0 <+240>: mov rsi,rbx 0x0000000000005ea3 <+243>: xor eax,eax 0x0000000000005ea5 <+245>: call 0x57c0 <snprintf@plt> 0x0000000000005eaa <+250>: cdqe 0x0000000000005eac <+252>: inc rax 0x0000000000005eaf <+255>: mov QWORD PTR [rsp+0x70],r14 0x0000000000005eb4 <+260>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005eb9 <+265>: mov QWORD PTR [rsp+0x80],r15 0x0000000000005ec1 <+273>: lea rdx,[rip+0x57548] # 0x5d410 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005ec8 <+280>: lea rdi,[rsp+0x190] 0x0000000000005ed0 <+288>: lea rsi,[rsp+0x70] 0x0000000000005ed5 <+293>: mov ecx,0x7 0x0000000000005eda <+298>: call 0xd790 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005edf <+303>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000005ee4 <+308>: test rdi,rdi 0x0000000000005ee7 <+311>: je 0x5eee <main+318> 0x0000000000005ee9 <+313>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005eee <+318>: mov edi,0x1 0x0000000000005ef3 <+323>: mov esi,0x3 0x0000000000005ef8 <+328>: call 0x2d690 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005efd <+333>: xor ecx,ecx 0x0000000000005eff <+335>: nop 0x0000000000005f00 <+336>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005f04 <+340>: inc rcx 0x0000000000005f07 <+343>: cmp rcx,0x3 0x0000000000005f0b <+347>: jne 0x5f00 <main+336> 0x0000000000005f0d <+349>: mov WORD PTR [rax],0x203a 0x0000000000005f12 <+354>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005f16 <+358>: mov QWORD PTR [rsp+0x88],rax 0x0000000000005f1e <+366>: mov QWORD PTR [rsp+0x90],0x3 0x0000000000005f2a <+378>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000005f36 <+390>: lea rdi,[rsp+0x1a8] 0x0000000000005f3e <+398>: lea rsi,[rsp+0x190] 0x0000000000005f46 <+406>: lea rdx,[rsp+0x88] 0x0000000000005f4e <+414>: call 0xd350 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005f53 <+419>: mov rdi,QWORD PTR [rsp+0x88] 0x0000000000005f5b <+427>: test rdi,rdi 0x0000000000005f5e <+430>: je 0x5f65 <main+437> 0x0000000000005f60 <+432>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f65 <+437>: mov rdi,QWORD PTR [rsp+0x190] 0x0000000000005f6d <+445>: test rdi,rdi 0x0000000000005f70 <+448>: je 0x5f77 <main+455> 0x0000000000005f72 <+450>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f77 <+455>: lea rbx,[rsp+0x250] 0x0000000000005f7f <+463>: mov rdi,rbx 0x0000000000005f82 <+466>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005f8a <+474>: vmovaps zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000005f92 <+482>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=16> 0x0000000000005f97 <+487>: lea rdi,[rsp+0x1c0] 0x0000000000005f9f <+495>: lea rsi,[rsp+0x1a8] 0x0000000000005fa7 <+503>: mov rdx,rbx 0x0000000000005faa <+506>: vzeroupper 0x0000000000005fad <+509>: call 0xd350 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005fb2 <+514>: mov rdi,QWORD PTR [rsp+0x250] 0x0000000000005fba <+522>: test rdi,rdi 0x0000000000005fbd <+525>: je 0x5fc4 <main+532> 0x0000000000005fbf <+527>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005fc4 <+532>: mov rdi,QWORD PTR [rsp+0x1a8] 0x0000000000005fcc <+540>: test rdi,rdi 0x0000000000005fcf <+543>: je 0x5fd6 <main+550> 0x0000000000005fd1 <+545>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005fd6 <+550>: lea rdi,[rsp+0x1c0] 0x0000000000005fde <+558>: call 0x8bf0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005fe3 <+563>: mov rdi,QWORD PTR [rsp+0x1c0] 0x0000000000005feb <+571>: test rdi,rdi 0x0000000000005fee <+574>: je 0x5ff5 <main+581> 0x0000000000005ff0 <+576>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ff5 <+581>: vxorps xmm0,xmm0,xmm0 0x0000000000005ff9 <+585>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 0x0000000000005fff <+591>: lea rsi,[rsp+0x30] 0x0000000000006004 <+596>: mov edi,0x1 0x0000000000006009 <+601>: call 0x5470 <clock_gettime@plt> 0x000000000000600e <+606>: mov rbx,QWORD PTR [rsp+0x30] 0x0000000000006013 <+611>: mov rax,QWORD PTR [rsp+0x38] 0x0000000000006018 <+616>: mov QWORD PTR [rsp+0x58],rax 0x000000000000601d <+621>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56fd9] # 0x5d000 0x0000000000006027 <+631>: vmovdqa64 zmm3,ZMMWORD PTR [rsp+0x140] 0x000000000000602f <+639>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x100] 0x0000000000006037 <+647>: vpermi2q zmm0,zmm3,zmm4 0x000000000000603d <+653>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56ff9] # 0x5d040 0x0000000000006047 <+663>: vpermi2q zmm1,zmm4,zmm3 0x000000000000604d <+669>: vpmaxsq zmm2,zmm4,zmm1 0x0000000000006053 <+675>: mov al,0xd 0x0000000000006055 <+677>: kmovd k1,eax 0x0000000000006059 <+681>: vpminsq zmm2{k1},zmm4,zmm1 0x000000000000605f <+687>: vpminsq zmm1,zmm3,zmm0 0x0000000000006065 <+693>: mov al,0xb0 0x0000000000006067 <+695>: kmovd k1,eax 0x000000000000606b <+699>: vpmaxsq zmm1{k1},zmm3,zmm0 0x0000000000006071 <+705>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57005] # 0x5d080 0x000000000000607b <+715>: vpermi2q zmm0,zmm1,zmm2 0x0000000000006081 <+721>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57035] # 0x5d0c0 0x000000000000608b <+731>: vpermi2q zmm3,zmm2,zmm1 0x0000000000006091 <+737>: vpmaxsq zmm4,zmm2,zmm3 0x0000000000006097 <+743>: mov al,0x23 0x0000000000006099 <+745>: kmovd k1,eax 0x000000000000609d <+749>: vpminsq zmm4{k1},zmm2,zmm3 0x00000000000060a3 <+755>: vpminsq zmm2,zmm1,zmm0 0x00000000000060a9 <+761>: mov al,0xc4 0x00000000000060ab <+763>: kmovd k1,eax 0x00000000000060af <+767>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57087] # 0x5d140 0x00000000000060b9 <+777>: vpermi2q zmm3,zmm4,zmm2 0x00000000000060bf <+783>: vpmaxsq zmm2{k1},zmm1,zmm0 0x00000000000060c5 <+789>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57031] # 0x5d100 0x00000000000060cf <+799>: vpermi2q zmm0,zmm2,zmm4 0x00000000000060d5 <+805>: vpmaxsq zmm1,zmm4,zmm0 0x00000000000060db <+811>: mov al,0x10 0x00000000000060dd <+813>: kmovd k1,eax 0x00000000000060e1 <+817>: vpminsq zmm1{k1},zmm4,zmm0 0x00000000000060e7 <+823>: vpminsq zmm0,zmm2,zmm3 0x00000000000060ed <+829>: mov al,0x8 0x00000000000060ef <+831>: kmovd k1,eax 0x00000000000060f3 <+835>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57083] # 0x5d180 0x00000000000060fd <+845>: vpermi2q zmm4,zmm0,zmm1 0x0000000000006103 <+851>: vpmaxsq zmm0{k1},zmm2,zmm3 0x0000000000006109 <+857>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x570ad] # 0x5d1c0 0x0000000000006113 <+867>: vpermi2q zmm2,zmm1,zmm0 0x0000000000006119 <+873>: vpmaxsq zmm3,zmm1,zmm2 0x000000000000611f <+879>: mov al,0x4a 0x0000000000006121 <+881>: kmovd k1,eax 0x0000000000006125 <+885>: vpminsq zmm3{k1},zmm1,zmm2 0x000000000000612b <+891>: vpminsq zmm1,zmm0,zmm4 0x0000000000006131 <+897>: mov al,0x52 0x0000000000006133 <+899>: kmovd k1,eax 0x0000000000006137 <+903>: vpmaxsq zmm1{k1},zmm0,zmm4 0x000000000000613d <+909>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570b9] # 0x5d200 0x0000000000006147 <+919>: vpermi2q zmm0,zmm1,zmm3 0x000000000000614d <+925>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x570e9] # 0x5d240 0x0000000000006157 <+935>: vpermi2q zmm2,zmm3,zmm1 0x000000000000615d <+941>: vpmaxsq zmm4,zmm3,zmm2 0x0000000000006163 <+947>: mov al,0x14 0x0000000000006165 <+949>: vpminsq zmm5,zmm1,zmm0 0x000000000000616b <+955>: mov cl,0x29 0x000000000000616d <+957>: kmovd k1,ecx 0x0000000000006171 <+961>: vpmaxsq zmm5{k1},zmm1,zmm0 0x0000000000006177 <+967>: kmovd k1,eax 0x000000000000617b <+971>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5713b] # 0x5d2c0 0x0000000000006185 <+981>: vpermi2q zmm0,zmm5,zmm4 0x000000000000618b <+987>: vpminsq zmm4{k1},zmm3,zmm2 0x0000000000006191 <+993>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570e5] # 0x5d280 0x000000000000619b <+1003>: vpermi2q zmm1,zmm4,zmm5 0x00000000000061a1 <+1009>: vpmaxsq zmm2,zmm4,zmm1 0x00000000000061a7 <+1015>: mov al,0x24 0x00000000000061a9 <+1017>: kmovd k1,eax 0x00000000000061ad <+1021>: vpminsq zmm2{k1},zmm4,zmm1 0x00000000000061b3 <+1027>: vpminsq zmm1,zmm5,zmm0 0x00000000000061b9 <+1033>: mov al,0x25 0x00000000000061bb <+1035>: kmovd k1,eax 0x00000000000061bf <+1039>: vpmaxsq zmm1{k1},zmm5,zmm0 0x00000000000061c5 <+1045>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57131] # 0x5d300 0x00000000000061cf <+1055>: vpermq zmm0,zmm0,zmm2 0x00000000000061d5 <+1061>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57161] # 0x5d340 0x00000000000061df <+1071>: vpermq zmm3,zmm3,zmm1 0x00000000000061e5 <+1077>: vpmaxsq zmm4,zmm2,zmm0 0x00000000000061eb <+1083>: mov al,0x15 0x00000000000061ed <+1085>: kmovd k1,eax 0x00000000000061f1 <+1089>: vpminsq zmm4{k1},zmm2,zmm0 0x00000000000061f7 <+1095>: vpmaxsq zmm0,zmm1,zmm3 0x00000000000061fd <+1101>: mov al,0x54 0x00000000000061ff <+1103>: kmovd k1,eax 0x0000000000006203 <+1107>: vpminsq zmm0{k1},zmm1,zmm3 0x0000000000006209 <+1113>: vshufi64x2 zmm1,zmm4,zmm4,0xe1 0x0000000000006210 <+1120>: vshufi64x2 zmm2,zmm0,zmm0,0xb4 0x0000000000006217 <+1127>: vpminsq zmm3,zmm4,zmm1 0x000000000000621d <+1133>: vpmaxsq zmm5,zmm0,zmm2 0x0000000000006223 <+1139>: mov al,0x30 0x0000000000006225 <+1141>: kmovd k1,eax 0x0000000000006229 <+1145>: vpminsq zmm5{k1},zmm0,zmm2 0x000000000000622f <+1151>: vpmaxsq zmm0,zmm4,zmm1 0x0000000000006235 <+1157>: vinserti32x4 zmm0,zmm0,xmm3,0x0 0x000000000000623c <+1164>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5713a] # 0x5d380 0x0000000000006246 <+1174>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm0 0x000000000000624e <+1182>: vpermi2q zmm1,zmm0,zmm5 0x0000000000006254 <+1188>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm1 0x000000000000625c <+1196>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5715a] # 0x5d3c0 0x0000000000006266 <+1206>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm5 0x000000000000626e <+1214>: vpermi2q zmm0,zmm5,zmm3 0x0000000000006274 <+1220>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x000000000000627c <+1228>: vpxor xmm0,xmm0,xmm0 0x0000000000006280 <+1232>: vmovdqa XMMWORD PTR [rsp+0x40],xmm0 0x0000000000006286 <+1238>: lea rsi,[rsp+0x40] 0x000000000000628b <+1243>: mov edi,0x1 0x0000000000006290 <+1248>: vzeroupper 0x0000000000006293 <+1251>: call 0x5470 <clock_gettime@plt> 0x0000000000006298 <+1256>: mov r12,QWORD PTR [rsp+0x40] 0x000000000000629d <+1261>: sub r12,rbx 0x00000000000062a0 <+1264>: mov rbx,QWORD PTR [rsp+0x48] 0x00000000000062a5 <+1269>: mov edi,0x10 0x00000000000062aa <+1274>: call 0x8140 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000062af <+1279>: mov r14,rax 0x00000000000062b2 <+1282>: test rax,rax 0x00000000000062b5 <+1285>: jle 0x62cc <main+1308> 0x00000000000062b7 <+1287>: mov edi,0x1 0x00000000000062bc <+1292>: mov rsi,r14 0x00000000000062bf <+1295>: call 0x2d690 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000062c4 <+1300>: mov r15,rax 0x00000000000062c7 <+1303>: mov r13,r14 0x00000000000062ca <+1306>: jmp 0x62d2 <main+1314> 0x00000000000062cc <+1308>: xor r15d,r15d 0x00000000000062cf <+1311>: xor r13d,r13d 0x00000000000062d2 <+1314>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x2c0] 0x00000000000062da <+1322>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x300] 0x00000000000062e2 <+1330>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x00000000000062ea <+1338>: mov al,0xa 0x00000000000062ec <+1340>: kmovd k1,eax 0x00000000000062f0 <+1344>: kmovw WORD PTR [rsp+0x2e],k1 0x00000000000062f6 <+1350>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x280] 0x00000000000062fe <+1358>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x340] 0x0000000000006306 <+1366>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x000000000000630e <+1374>: mov al,0xa8 0x0000000000006310 <+1376>: kmovd k1,eax 0x0000000000006314 <+1380>: kmovw WORD PTR [rsp+0x2c],k1 0x000000000000631a <+1386>: imul r12,r12,0x3b9aca00 0x0000000000006321 <+1393>: sub rbx,QWORD PTR [rsp+0x58] 0x0000000000006326 <+1398>: lea rdx,[rip+0x570d3] # 0x5d400 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000632d <+1405>: mov ecx,0x10 0x0000000000006332 <+1410>: mov rdi,r15 0x0000000000006335 <+1413>: mov rsi,r14 0x0000000000006338 <+1416>: xor eax,eax 0x000000000000633a <+1418>: vzeroupper 0x000000000000633d <+1421>: call 0x57c0 <snprintf@plt> 0x0000000000006342 <+1426>: cdqe 0x0000000000006344 <+1428>: inc rax 0x0000000000006347 <+1431>: mov QWORD PTR [rsp+0xa0],r15 0x000000000000634f <+1439>: mov QWORD PTR [rsp+0xa8],rax 0x0000000000006357 <+1447>: mov QWORD PTR [rsp+0xb0],r13 0x000000000000635f <+1455>: lea rdx,[rip+0x570ba] # 0x5d420 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x0000000000006366 <+1462>: lea rdi,[rsp+0x1d8] 0x000000000000636e <+1470>: lea rsi,[rsp+0xa0] 0x0000000000006376 <+1478>: mov ecx,0x6 0x000000000000637b <+1483>: call 0xd790 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006380 <+1488>: mov rdi,QWORD PTR [rsp+0xa0] 0x0000000000006388 <+1496>: test rdi,rdi 0x000000000000638b <+1499>: je 0x6392 <main+1506> 0x000000000000638d <+1501>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006392 <+1506>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x000000000000639a <+1514>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x2c0] 0x00000000000063a2 <+1522>: kmovw k1,WORD PTR [rsp+0x2e] 0x00000000000063a8 <+1528>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x300] 0x00000000000063b0 <+1536>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x00000000000063b8 <+1544>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x00000000000063c0 <+1552>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x280] 0x00000000000063c8 <+1560>: kmovw k1,WORD PTR [rsp+0x2c] 0x00000000000063ce <+1566>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x340] 0x00000000000063d6 <+1574>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x00000000000063de <+1582>: add rbx,r12 0x00000000000063e1 <+1585>: mov edi,0x1 0x00000000000063e6 <+1590>: mov esi,0x3 0x00000000000063eb <+1595>: vzeroupper 0x00000000000063ee <+1598>: call 0x2d690 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000063f3 <+1603>: xor ecx,ecx 0x00000000000063f5 <+1605>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006400 <+1616>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006404 <+1620>: inc rcx 0x0000000000006407 <+1623>: cmp rcx,0x3 0x000000000000640b <+1627>: jne 0x6400 <main+1616> 0x000000000000640d <+1629>: mov WORD PTR [rax],0x203a 0x0000000000006412 <+1634>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006416 <+1638>: mov QWORD PTR [rsp+0xb8],rax 0x000000000000641e <+1646>: mov QWORD PTR [rsp+0xc0],0x3 0x000000000000642a <+1658>: mov QWORD PTR [rsp+0xc8],0x3 0x0000000000006436 <+1670>: lea rdi,[rsp+0x1f0] 0x000000000000643e <+1678>: lea rsi,[rsp+0x1d8] 0x0000000000006446 <+1686>: lea rdx,[rsp+0xb8] 0x000000000000644e <+1694>: call 0xd350 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006453 <+1699>: mov rdi,QWORD PTR [rsp+0xb8] 0x000000000000645b <+1707>: test rdi,rdi 0x000000000000645e <+1710>: je 0x6465 <main+1717> 0x0000000000006460 <+1712>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006465 <+1717>: mov rdi,QWORD PTR [rsp+0x1d8] 0x000000000000646d <+1725>: test rdi,rdi 0x0000000000006470 <+1728>: je 0x6477 <main+1735> 0x0000000000006472 <+1730>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006477 <+1735>: lea r14,[rsp+0x268] 0x000000000000647f <+1743>: mov rdi,r14 0x0000000000006482 <+1746>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x000000000000648a <+1754>: vmovaps zmm1,ZMMWORD PTR [rsp+0x140] 0x0000000000006492 <+1762>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=16> 0x0000000000006497 <+1767>: lea rdi,[rsp+0x208] 0x000000000000649f <+1775>: lea rsi,[rsp+0x1f0] 0x00000000000064a7 <+1783>: mov rdx,r14 0x00000000000064aa <+1786>: vzeroupper 0x00000000000064ad <+1789>: call 0xd350 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000064b2 <+1794>: mov rdi,QWORD PTR [rsp+0x268] 0x00000000000064ba <+1802>: test rdi,rdi 0x00000000000064bd <+1805>: je 0x64c4 <main+1812> 0x00000000000064bf <+1807>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064c4 <+1812>: mov rdi,QWORD PTR [rsp+0x1f0] 0x00000000000064cc <+1820>: test rdi,rdi 0x00000000000064cf <+1823>: je 0x64d6 <main+1830> 0x00000000000064d1 <+1825>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064d6 <+1830>: lea rdi,[rsp+0x208] 0x00000000000064de <+1838>: call 0x8bf0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000064e3 <+1843>: mov rdi,QWORD PTR [rsp+0x208] 0x00000000000064eb <+1851>: test rdi,rdi 0x00000000000064ee <+1854>: je 0x64f5 <main+1861> 0x00000000000064f0 <+1856>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064f5 <+1861>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x00000000000064fd <+1869>: vpaddq zmm0,zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000006505 <+1877>: vextracti64x4 ymm1,zmm0,0x1 0x000000000000650c <+1884>: vpaddq ymm0,ymm0,ymm1 0x0000000000006510 <+1888>: vextracti128 xmm1,ymm0,0x1 0x0000000000006516 <+1894>: vpaddq xmm0,xmm0,xmm1 0x000000000000651a <+1898>: vpshufd xmm1,xmm0,0xee 0x000000000000651f <+1903>: vpaddq xmm0,xmm0,xmm1 0x0000000000006523 <+1907>: vmovq rax,xmm0 0x0000000000006528 <+1912>: vmovq QWORD PTR [rsp+0x68],xmm0 0x000000000000652e <+1918>: lea rcx,[rsp+0x68] 0x0000000000006533 <+1923>: mov QWORD PTR [rsp+0x60],rcx 0x0000000000006538 <+1928>: mov rdi,rbx 0x000000000000653b <+1931>: vzeroupper 0x000000000000653e <+1934>: call 0x8140 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006543 <+1939>: mov r14,rax 0x0000000000006546 <+1942>: test rax,rax 0x0000000000006549 <+1945>: jle 0x6560 <main+1968> 0x000000000000654b <+1947>: mov edi,0x1 0x0000000000006550 <+1952>: mov rsi,r14 0x0000000000006553 <+1955>: call 0x2d690 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006558 <+1960>: mov r15,rax 0x000000000000655b <+1963>: mov r12,r14 0x000000000000655e <+1966>: jmp 0x6566 <main+1974> 0x0000000000006560 <+1968>: xor r15d,r15d 0x0000000000006563 <+1971>: xor r12d,r12d 0x0000000000006566 <+1974>: lea rdx,[rip+0x56e93] # 0x5d400 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000656d <+1981>: mov rdi,r15 0x0000000000006570 <+1984>: mov rsi,r14 0x0000000000006573 <+1987>: mov rcx,rbx 0x0000000000006576 <+1990>: xor eax,eax 0x0000000000006578 <+1992>: call 0x57c0 <snprintf@plt> 0x000000000000657d <+1997>: cdqe 0x000000000000657f <+1999>: inc rax 0x0000000000006582 <+2002>: mov QWORD PTR [rsp+0xd0],r15 0x000000000000658a <+2010>: mov QWORD PTR [rsp+0xd8],rax 0x0000000000006592 <+2018>: mov QWORD PTR [rsp+0xe0],r12 0x000000000000659a <+2026>: lea rdx,[rip+0x56e8f] # 0x5d430 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x00000000000065a1 <+2033>: lea rdi,[rsp+0x220] 0x00000000000065a9 <+2041>: lea rsi,[rsp+0xd0] 0x00000000000065b1 <+2049>: mov ecx,0xb 0x00000000000065b6 <+2054>: call 0xd790 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000065bb <+2059>: mov rdi,QWORD PTR [rsp+0xd0] 0x00000000000065c3 <+2067>: test rdi,rdi 0x00000000000065c6 <+2070>: je 0x65cd <main+2077> 0x00000000000065c8 <+2072>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000065cd <+2077>: mov edi,0x1 0x00000000000065d2 <+2082>: mov esi,0x4 0x00000000000065d7 <+2087>: call 0x2d690 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000065dc <+2092>: xor ecx,ecx 0x00000000000065de <+2094>: xchg ax,ax 0x00000000000065e0 <+2096>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000065e4 <+2100>: inc rcx 0x00000000000065e7 <+2103>: cmp rcx,0x4 0x00000000000065eb <+2107>: jne 0x65e0 <main+2096> 0x00000000000065ed <+2109>: mov DWORD PTR [rax],0x736e20 0x00000000000065f3 <+2115>: mov QWORD PTR [rsp+0xe8],rax 0x00000000000065fb <+2123>: mov QWORD PTR [rsp+0xf0],0x4 0x0000000000006607 <+2135>: mov QWORD PTR [rsp+0xf8],0x4 0x0000000000006613 <+2147>: lea rdi,[rsp+0x238] 0x000000000000661b <+2155>: lea rsi,[rsp+0x220] 0x0000000000006623 <+2163>: lea rdx,[rsp+0xe8] 0x000000000000662b <+2171>: call 0xd350 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006630 <+2176>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000006638 <+2184>: test rdi,rdi 0x000000000000663b <+2187>: je 0x6642 <main+2194> 0x000000000000663d <+2189>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006642 <+2194>: mov rdi,QWORD PTR [rsp+0x220] 0x000000000000664a <+2202>: test rdi,rdi 0x000000000000664d <+2205>: je 0x6654 <main+2212> 0x000000000000664f <+2207>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006654 <+2212>: lea rdi,[rsp+0x238] 0x000000000000665c <+2220>: call 0x8bf0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006661 <+2225>: mov rdi,QWORD PTR [rsp+0x238] 0x0000000000006669 <+2233>: test rdi,rdi 0x000000000000666c <+2236>: je 0x6673 <main+2243> 0x000000000000666e <+2238>: call 0x2d6b0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006673 <+2243>: call 0x29ab0 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006678 <+2248>: xor eax,eax 0x000000000000667a <+2250>: lea rsp,[rbp-0x28] 0x000000000000667e <+2254>: pop rbx 0x000000000000667f <+2255>: pop r12 0x0000000000006681 <+2257>: pop r13 0x0000000000006683 <+2259>: pop r14 0x0000000000006685 <+2261>: pop r15 0x0000000000006687 <+2263>: pop rbp 0x0000000000006688 <+2264>: ret End of assembler dump. --- disassemble/int64_32.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005e10 <+0>: push rbp 0x0000000000005e11 <+1>: mov rbp,rsp 0x0000000000005e14 <+4>: push r15 0x0000000000005e16 <+6>: push r14 0x0000000000005e18 <+8>: push r13 0x0000000000005e1a <+10>: push r12 0x0000000000005e1c <+12>: push rbx 0x0000000000005e1d <+13>: and rsp,0xffffffffffffffc0 0x0000000000005e21 <+17>: sub rsp,0x640 0x0000000000005e28 <+24>: call 0x2f970 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005e2d <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005e31 <+33>: mov ebx,0x21 0x0000000000005e36 <+38>: xor r14d,r14d 0x0000000000005e39 <+41>: vxorps xmm1,xmm1,xmm1 0x0000000000005e3d <+45>: vxorps xmm2,xmm2,xmm2 0x0000000000005e41 <+49>: vxorps xmm3,xmm3,xmm3 0x0000000000005e45 <+53>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005e50 <+64>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005e58 <+72>: vmovaps ZMMWORD PTR [rsp+0x180],zmm1 0x0000000000005e60 <+80>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm2 0x0000000000005e68 <+88>: vmovaps ZMMWORD PTR [rsp+0x100],zmm3 0x0000000000005e70 <+96>: vzeroupper 0x0000000000005e73 <+99>: call 0x2e8c0 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005e78 <+104>: mov edx,0x64 0x0000000000005e7d <+109>: mov rdi,rax 0x0000000000005e80 <+112>: xor esi,esi 0x0000000000005e82 <+114>: call 0x2ecd0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005e87 <+119>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005e8f <+127>: vmovaps ZMMWORD PTR [rsp+0x500],zmm0 0x0000000000005e97 <+135>: vmovaps zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000005e9f <+143>: vmovaps ZMMWORD PTR [rsp+0x540],zmm0 0x0000000000005ea7 <+151>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000005eaf <+159>: vmovaps ZMMWORD PTR [rsp+0x580],zmm0 0x0000000000005eb7 <+167>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005ebf <+175>: vmovaps ZMMWORD PTR [rsp+0x5c0],zmm0 0x0000000000005ec7 <+183>: mov ecx,r14d 0x0000000000005eca <+186>: and ecx,0x1f 0x0000000000005ecd <+189>: mov QWORD PTR [rsp+rcx*8+0x500],rax 0x0000000000005ed5 <+197>: vmovaps zmm0,ZMMWORD PTR [rsp+0x500] 0x0000000000005edd <+205>: vmovaps zmm1,ZMMWORD PTR [rsp+0x540] 0x0000000000005ee5 <+213>: vmovaps zmm2,ZMMWORD PTR [rsp+0x580] 0x0000000000005eed <+221>: vmovaps zmm3,ZMMWORD PTR [rsp+0x5c0] 0x0000000000005ef5 <+229>: dec rbx 0x0000000000005ef8 <+232>: inc r14 0x0000000000005efb <+235>: cmp rbx,0x1 0x0000000000005eff <+239>: ja 0x5e50 <main+64> 0x0000000000005f05 <+245>: vmovaps ZMMWORD PTR [rsp+0x180],zmm1 0x0000000000005f0d <+253>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm2 0x0000000000005f15 <+261>: vmovaps ZMMWORD PTR [rsp+0x100],zmm3 0x0000000000005f1d <+269>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005f25 <+277>: mov edi,0x20 0x0000000000005f2a <+282>: vzeroupper 0x0000000000005f2d <+285>: call 0x8850 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005f32 <+290>: mov rbx,rax 0x0000000000005f35 <+293>: test rax,rax 0x0000000000005f38 <+296>: jle 0x5f4f <main+319> 0x0000000000005f3a <+298>: mov edi,0x1 0x0000000000005f3f <+303>: mov rsi,rbx 0x0000000000005f42 <+306>: call 0x2dda0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005f47 <+311>: mov r14,rax 0x0000000000005f4a <+314>: mov r15,rbx 0x0000000000005f4d <+317>: jmp 0x5f55 <main+325> 0x0000000000005f4f <+319>: xor r14d,r14d 0x0000000000005f52 <+322>: xor r15d,r15d 0x0000000000005f55 <+325>: lea rdx,[rip+0x57be4] # 0x5db40 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005f5c <+332>: mov ecx,0x20 0x0000000000005f61 <+337>: mov rdi,r14 0x0000000000005f64 <+340>: mov rsi,rbx 0x0000000000005f67 <+343>: xor eax,eax 0x0000000000005f69 <+345>: call 0x57c0 <snprintf@plt> 0x0000000000005f6e <+350>: cdqe 0x0000000000005f70 <+352>: inc rax 0x0000000000005f73 <+355>: mov QWORD PTR [rsp+0x70],r14 0x0000000000005f78 <+360>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005f7d <+365>: mov QWORD PTR [rsp+0x80],r15 0x0000000000005f85 <+373>: lea rdx,[rip+0x57bc4] # 0x5db50 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005f8c <+380>: lea rdi,[rsp+0x210] 0x0000000000005f94 <+388>: lea rsi,[rsp+0x70] 0x0000000000005f99 <+393>: mov ecx,0x7 0x0000000000005f9e <+398>: call 0xdea0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005fa3 <+403>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000005fa8 <+408>: test rdi,rdi 0x0000000000005fab <+411>: je 0x5fb2 <main+418> 0x0000000000005fad <+413>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005fb2 <+418>: mov edi,0x1 0x0000000000005fb7 <+423>: mov esi,0x3 0x0000000000005fbc <+428>: call 0x2dda0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005fc1 <+433>: xor ecx,ecx 0x0000000000005fc3 <+435>: data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005fd0 <+448>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005fd4 <+452>: inc rcx 0x0000000000005fd7 <+455>: cmp rcx,0x3 0x0000000000005fdb <+459>: jne 0x5fd0 <main+448> 0x0000000000005fdd <+461>: mov WORD PTR [rax],0x203a 0x0000000000005fe2 <+466>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005fe6 <+470>: mov QWORD PTR [rsp+0x88],rax 0x0000000000005fee <+478>: mov QWORD PTR [rsp+0x90],0x3 0x0000000000005ffa <+490>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000006006 <+502>: lea rdi,[rsp+0x228] 0x000000000000600e <+510>: lea rsi,[rsp+0x210] 0x0000000000006016 <+518>: lea rdx,[rsp+0x88] 0x000000000000601e <+526>: call 0xda60 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006023 <+531>: mov rdi,QWORD PTR [rsp+0x88] 0x000000000000602b <+539>: test rdi,rdi 0x000000000000602e <+542>: je 0x6035 <main+549> 0x0000000000006030 <+544>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006035 <+549>: mov rdi,QWORD PTR [rsp+0x210] 0x000000000000603d <+557>: test rdi,rdi 0x0000000000006040 <+560>: je 0x6047 <main+567> 0x0000000000006042 <+562>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006047 <+567>: lea rbx,[rsp+0x2d0] 0x000000000000604f <+575>: mov rdi,rbx 0x0000000000006052 <+578>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x000000000000605a <+586>: vmovaps zmm1,ZMMWORD PTR [rsp+0x180] 0x0000000000006062 <+594>: vmovaps zmm2,ZMMWORD PTR [rsp+0x1c0] 0x000000000000606a <+602>: vmovaps zmm3,ZMMWORD PTR [rsp+0x100] 0x0000000000006072 <+610>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=32> 0x0000000000006077 <+615>: lea rdi,[rsp+0x240] 0x000000000000607f <+623>: lea rsi,[rsp+0x228] 0x0000000000006087 <+631>: mov rdx,rbx 0x000000000000608a <+634>: vzeroupper 0x000000000000608d <+637>: call 0xda60 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006092 <+642>: mov rdi,QWORD PTR [rsp+0x2d0] 0x000000000000609a <+650>: test rdi,rdi 0x000000000000609d <+653>: je 0x60a4 <main+660> 0x000000000000609f <+655>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000060a4 <+660>: mov rdi,QWORD PTR [rsp+0x228] 0x00000000000060ac <+668>: test rdi,rdi 0x00000000000060af <+671>: je 0x60b6 <main+678> 0x00000000000060b1 <+673>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000060b6 <+678>: lea rdi,[rsp+0x240] 0x00000000000060be <+686>: call 0x9300 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000060c3 <+691>: mov rdi,QWORD PTR [rsp+0x240] 0x00000000000060cb <+699>: test rdi,rdi 0x00000000000060ce <+702>: je 0x60d5 <main+709> 0x00000000000060d0 <+704>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000060d5 <+709>: vxorps xmm0,xmm0,xmm0 0x00000000000060d9 <+713>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 0x00000000000060df <+719>: lea rsi,[rsp+0x30] 0x00000000000060e4 <+724>: mov edi,0x1 0x00000000000060e9 <+729>: call 0x5470 <clock_gettime@plt> 0x00000000000060ee <+734>: mov rbx,QWORD PTR [rsp+0x30] 0x00000000000060f3 <+739>: mov rax,QWORD PTR [rsp+0x38] 0x00000000000060f8 <+744>: mov QWORD PTR [rsp+0x58],rax 0x00000000000060fd <+749>: vmovdqa64 zmm8,ZMMWORD PTR [rsp+0x140] 0x0000000000006105 <+757>: vpshufd zmm0,zmm8,0x4e 0x000000000000610c <+764>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x180] 0x0000000000006114 <+772>: vpshufd zmm1,zmm11,0x4e 0x000000000000611b <+779>: vmovdqa64 zmm10,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006123 <+787>: vpshufd zmm2,zmm10,0x4e 0x000000000000612a <+794>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x100] 0x0000000000006132 <+802>: vpshufd zmm3,zmm9,0x4e 0x0000000000006139 <+809>: vpminsq zmm4,zmm9,zmm3 0x000000000000613f <+815>: vpminsq zmm5,zmm10,zmm2 0x0000000000006145 <+821>: vpminsq zmm6,zmm11,zmm1 0x000000000000614b <+827>: vpminsq zmm7,zmm8,zmm0 0x0000000000006151 <+833>: mov al,0xaa 0x0000000000006153 <+835>: kmovd k3,eax 0x0000000000006157 <+839>: vpmaxsq zmm7{k3},zmm8,zmm0 0x000000000000615d <+845>: vpmaxsq zmm6{k3},zmm11,zmm1 0x0000000000006163 <+851>: vpmaxsq zmm5{k3},zmm10,zmm2 0x0000000000006169 <+857>: vpmaxsq zmm4{k3},zmm9,zmm3 0x000000000000616f <+863>: vpxor xmm0,xmm0,xmm0 0x0000000000006173 <+867>: vpermq zmm0,zmm4,0x4e 0x000000000000617a <+874>: vpxor xmm1,xmm1,xmm1 0x000000000000617e <+878>: vpermq zmm1,zmm5,0x4e 0x0000000000006185 <+885>: vpxor xmm2,xmm2,xmm2 0x0000000000006189 <+889>: vpermq zmm2,zmm6,0x4e 0x0000000000006190 <+896>: vpxor xmm3,xmm3,xmm3 0x0000000000006194 <+900>: vpermq zmm3,zmm7,0x4e 0x000000000000619b <+907>: vpminsq zmm8,zmm7,zmm3 0x00000000000061a1 <+913>: vpminsq zmm9,zmm6,zmm2 0x00000000000061a7 <+919>: vpminsq zmm10,zmm5,zmm1 0x00000000000061ad <+925>: vpminsq zmm11,zmm4,zmm0 0x00000000000061b3 <+931>: mov al,0xcc 0x00000000000061b5 <+933>: kmovd k1,eax 0x00000000000061b9 <+937>: vpmaxsq zmm11{k1},zmm4,zmm0 0x00000000000061bf <+943>: vpmaxsq zmm10{k1},zmm5,zmm1 0x00000000000061c5 <+949>: vpmaxsq zmm9{k1},zmm6,zmm2 0x00000000000061cb <+955>: vpmaxsq zmm8{k1},zmm7,zmm3 0x00000000000061d1 <+961>: vshufi64x2 zmm0,zmm8,zmm8,0x4e 0x00000000000061d8 <+968>: vshufi64x2 zmm1,zmm9,zmm9,0x4e 0x00000000000061df <+975>: vshufi64x2 zmm2,zmm10,zmm10,0x4e 0x00000000000061e6 <+982>: vshufi64x2 zmm3,zmm11,zmm11,0x4e 0x00000000000061ed <+989>: vpminsq zmm4,zmm11,zmm3 0x00000000000061f3 <+995>: vpminsq zmm5,zmm10,zmm2 0x00000000000061f9 <+1001>: vpminsq zmm6,zmm9,zmm1 0x00000000000061ff <+1007>: vpminsq zmm7,zmm8,zmm0 0x0000000000006205 <+1013>: vpmaxsq zmm3,zmm11,zmm3 0x000000000000620b <+1019>: vshufi64x2 zmm3,zmm4,zmm3,0xe4 0x0000000000006212 <+1026>: vpmaxsq zmm2,zmm10,zmm2 0x0000000000006218 <+1032>: vshufi64x2 zmm2,zmm5,zmm2,0xe4 0x000000000000621f <+1039>: vpmaxsq zmm1,zmm9,zmm1 0x0000000000006225 <+1045>: vshufi64x2 zmm1,zmm6,zmm1,0xe4 0x000000000000622c <+1052>: vpmaxsq zmm0,zmm8,zmm0 0x0000000000006232 <+1058>: vshufi64x2 zmm4,zmm7,zmm0,0xe4 0x0000000000006239 <+1065>: vpminsq zmm5,zmm2,zmm3 0x000000000000623f <+1071>: vpminsq zmm0,zmm4,zmm1 0x0000000000006245 <+1077>: vpmaxsq zmm1,zmm1,zmm4 0x000000000000624b <+1083>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x56dab] # 0x5d000 0x0000000000006255 <+1093>: vpermi2q zmm4,zmm1,zmm0 0x000000000000625b <+1099>: mov al,0x1 0x000000000000625d <+1101>: kmovd k1,eax 0x0000000000006261 <+1105>: vmovdqa64 zmm4{k1},zmm5 0x0000000000006267 <+1111>: vpmaxsq zmm6,zmm3,zmm2 0x000000000000626d <+1117>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x56dc9] # 0x5d040 0x0000000000006277 <+1127>: vpermi2q zmm2,zmm0,zmm1 0x000000000000627d <+1133>: mov al,0x80 0x000000000000627f <+1135>: kmovd k1,eax 0x0000000000006283 <+1139>: kmovw WORD PTR [rsp+0x100],k1 0x000000000000628c <+1148>: vmovdqa64 zmm2{k1},zmm6 0x0000000000006292 <+1154>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x56de4] # 0x5d080 0x000000000000629c <+1164>: vpermi2q zmm3,zmm5,zmm1 0x00000000000062a2 <+1170>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x56e14] # 0x5d0c0 0x00000000000062ac <+1180>: vpermi2q zmm8,zmm3,zmm6 0x00000000000062b2 <+1186>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x56e44] # 0x5d100 0x00000000000062bc <+1196>: vpermi2q zmm3,zmm5,zmm0 0x00000000000062c2 <+1202>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x56e74] # 0x5d140 0x00000000000062cc <+1212>: vpermi2q zmm9,zmm6,zmm3 0x00000000000062d2 <+1218>: vpmaxsq zmm10,zmm1,zmm2 0x00000000000062d8 <+1224>: mov al,0x88 0x00000000000062da <+1226>: kmovd k2,eax 0x00000000000062de <+1230>: vmovdqa64 zmm7,zmm10 0x00000000000062e4 <+1236>: vpminsq zmm7{k2},zmm1,zmm2 0x00000000000062ea <+1242>: vpminsq zmm2,zmm5,zmm9 0x00000000000062f0 <+1248>: vpminsq zmm11,zmm0,zmm4 0x00000000000062f6 <+1254>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56e80] # 0x5d180 0x0000000000006300 <+1264>: vpermi2q zmm1,zmm11,zmm7 0x0000000000006306 <+1270>: mov al,0x40 0x0000000000006308 <+1272>: kmovd k6,eax 0x000000000000630c <+1276>: vmovdqa64 zmm1{k6},zmm2 0x0000000000006312 <+1282>: vpmaxsq zmm3,zmm6,zmm8 0x0000000000006318 <+1288>: mov al,0x8 0x000000000000631a <+1290>: kmovd k1,eax 0x000000000000631e <+1294>: mov al,0x10 0x0000000000006320 <+1296>: kmovd k2,eax 0x0000000000006324 <+1300>: mov al,0x11 0x0000000000006326 <+1302>: kmovd k4,eax 0x000000000000632a <+1306>: vpmaxsq zmm2{k4},zmm5,zmm9 0x0000000000006330 <+1312>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x56ec6] # 0x5d200 0x000000000000633a <+1322>: vpermi2q zmm5,zmm2,zmm11 0x0000000000006340 <+1328>: vpmaxsq zmm11{k2},zmm0,zmm4 0x0000000000006346 <+1334>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x56e70] # 0x5d1c0 0x0000000000006350 <+1344>: vpermi2q zmm4,zmm7,zmm11 0x0000000000006356 <+1350>: mov al,0x2 0x0000000000006358 <+1352>: kmovd k2,eax 0x000000000000635c <+1356>: kmovw WORD PTR [rsp+0x140],k2 0x0000000000006365 <+1365>: vmovdqa64 zmm4{k2},zmm3 0x000000000000636b <+1371>: vpminsq zmm3{k1},zmm6,zmm8 0x0000000000006371 <+1377>: kmovq k2,k1 0x0000000000006376 <+1382>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x56ec0] # 0x5d240 0x0000000000006380 <+1392>: vpermi2q zmm6,zmm5,zmm3 0x0000000000006386 <+1398>: vmovdqa ymm0,YMMWORD PTR [rip+0x57832] # 0x5dbc0 0x000000000000638e <+1406>: vpermi2q zmm0,zmm2,zmm10 0x0000000000006394 <+1412>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x56ee2] # 0x5d280 0x000000000000639e <+1422>: vpermi2q zmm5,zmm3,zmm0 0x00000000000063a4 <+1428>: vpmaxsq zmm8,zmm3,zmm5 0x00000000000063aa <+1434>: mov al,0x24 0x00000000000063ac <+1436>: kmovd k4,eax 0x00000000000063b0 <+1440>: vpmaxsq zmm0,zmm2,zmm6 0x00000000000063b6 <+1446>: vpminsq zmm9,zmm7,zmm4 0x00000000000063bc <+1452>: vpmaxsq zmm4,zmm7,zmm4 0x00000000000063c2 <+1458>: mov al,0x26 0x00000000000063c4 <+1460>: kmovd k5,eax 0x00000000000063c8 <+1464>: vmovdqa64 zmm4{k5},zmm9 0x00000000000063ce <+1470>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x56ee8] # 0x5d2c0 0x00000000000063d8 <+1480>: vpermi2q zmm7,zmm4,zmm0 0x00000000000063de <+1486>: mov al,0x82 0x00000000000063e0 <+1488>: kmovd k5,eax 0x00000000000063e4 <+1492>: vmovdqa64 zmm7{k5},zmm8 0x00000000000063ea <+1498>: vpminsq zmm8{k4},zmm3,zmm5 0x00000000000063f0 <+1504>: mov al,0x9a 0x00000000000063f2 <+1506>: kmovd k4,eax 0x00000000000063f6 <+1510>: vpminsq zmm5,zmm11,zmm1 0x00000000000063fc <+1516>: vpminsq zmm0{k4},zmm2,zmm6 0x0000000000006402 <+1522>: mov al,0x25 0x0000000000006404 <+1524>: kmovd k4,eax 0x0000000000006408 <+1528>: vpmaxsq zmm5{k4},zmm11,zmm1 0x000000000000640e <+1534>: mov al,0x41 0x0000000000006410 <+1536>: kmovd k5,eax 0x0000000000006414 <+1540>: vpblendmq zmm1{k5},zmm5,zmm0 0x000000000000641a <+1546>: vbroadcasti64x4 zmm2,YMMWORD PTR [rip+0x577bc] # 0x5dbe0 0x0000000000006424 <+1556>: vpermi2q zmm2,zmm4,zmm5 0x000000000000642a <+1562>: mov al,0x86 0x000000000000642c <+1564>: kmovd k7,eax 0x0000000000006430 <+1568>: vpblendmq zmm2{k7},zmm8,zmm2 0x0000000000006436 <+1574>: vbroadcasti64x4 zmm3,YMMWORD PTR [rip+0x577c0] # 0x5dc00 0x0000000000006440 <+1584>: vpermi2q zmm3,zmm5,zmm9 0x0000000000006446 <+1590>: mov al,0x61 0x0000000000006448 <+1592>: kmovd k4,eax 0x000000000000644c <+1596>: vpblendmq zmm6{k4},zmm0,zmm3 0x0000000000006452 <+1602>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x56ea4] # 0x5d300 0x000000000000645c <+1612>: vpermi2q zmm9,zmm1,zmm8 0x0000000000006462 <+1618>: vpmaxsq zmm10,zmm0,zmm9 0x0000000000006468 <+1624>: mov al,0x20 0x000000000000646a <+1626>: kmovd k4,eax 0x000000000000646e <+1630>: vpminsq zmm11,zmm5,zmm6 0x0000000000006474 <+1636>: vpminsq zmm12,zmm4,zmm2 0x000000000000647a <+1642>: vpmaxsq zmm4,zmm4,zmm2 0x0000000000006480 <+1648>: vpblendmq zmm1{k7},zmm12,zmm4 0x0000000000006486 <+1654>: vpmaxsq zmm2,zmm8,zmm7 0x000000000000648c <+1660>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x56eaa] # 0x5d340 0x0000000000006496 <+1670>: vpermi2q zmm3,zmm1,zmm10 0x000000000000649c <+1676>: vpmaxsq zmm11{k5},zmm5,zmm6 0x00000000000064a2 <+1682>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x56f54] # 0x5d400 0x00000000000064ac <+1692>: vpermi2q zmm5,zmm11,zmm12 0x00000000000064b2 <+1698>: mov al,0x48 0x00000000000064b4 <+1700>: kmovd k5,eax 0x00000000000064b8 <+1704>: vinserti64x2 zmm5{k5},zmm10,xmm2,0x3 0x00000000000064bf <+1711>: vpminsq zmm10{k4},zmm0,zmm9 0x00000000000064c5 <+1717>: mov al,0xe0 0x00000000000064c7 <+1719>: kmovd k7,eax 0x00000000000064cb <+1723>: vmovdqa64 zmm3{k7},zmm2 0x00000000000064d1 <+1729>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56ea5] # 0x5d380 0x00000000000064db <+1739>: vpermi2q zmm0,zmm2,zmm10 0x00000000000064e1 <+1745>: mov al,0x12 0x00000000000064e3 <+1747>: vinserti32x4 zmm4,zmm11,xmm4,0x3 0x00000000000064ea <+1754>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x56ecc] # 0x5d3c0 0x00000000000064f4 <+1764>: vpermi2q zmm6,zmm4,zmm10 0x00000000000064fa <+1770>: vpminsq zmm4,zmm11,zmm6 0x0000000000006500 <+1776>: mov cl,0x7 0x0000000000006502 <+1778>: kmovd k7,ecx 0x0000000000006506 <+1782>: vmovdqa64 zmm7,zmm4 0x000000000000650c <+1788>: vpmaxsq zmm7{k7},zmm11,zmm6 0x0000000000006512 <+1794>: kmovd k7,eax 0x0000000000006516 <+1798>: vshufi64x2 zmm0{k7},zmm11,zmm12,0xe7 0x000000000000651d <+1805>: vpmaxsq zmm6,zmm10,zmm5 0x0000000000006523 <+1811>: vpminsq zmm8,zmm1,zmm0 0x0000000000006529 <+1817>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x56f4d] # 0x5d480 0x0000000000006533 <+1827>: vpermi2q zmm9,zmm7,zmm8 0x0000000000006539 <+1833>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x56f7d] # 0x5d4c0 0x0000000000006543 <+1843>: vpermi2q zmm11,zmm9,zmm6 0x0000000000006549 <+1849>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x56fad] # 0x5d500 0x0000000000006553 <+1859>: vpermi2q zmm9,zmm8,zmm6 0x0000000000006559 <+1865>: vpminsq zmm6{k6},zmm10,zmm5 0x000000000000655f <+1871>: vbroadcasti32x4 zmm5,XMMWORD PTR [rip+0x576d7] # 0x5dc40 0x0000000000006569 <+1881>: vpermi2q zmm5,zmm7,zmm8 0x000000000000656f <+1887>: vpmaxsq zmm8{k7},zmm1,zmm0 0x0000000000006575 <+1893>: vpmaxsq zmm1,zmm2,zmm3 0x000000000000657b <+1899>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x56ebb] # 0x5d440 0x0000000000006585 <+1909>: vpermi2q zmm0,zmm6,zmm1 0x000000000000658b <+1915>: mov al,0x21 0x000000000000658d <+1917>: kmovd k7,eax 0x0000000000006591 <+1921>: vmovdqa64 zmm0{k7},zmm5 0x0000000000006597 <+1927>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x56f9f] # 0x5d540 0x00000000000065a1 <+1937>: vpermi2q zmm2,zmm1,zmm9 0x00000000000065a7 <+1943>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x56fcf] # 0x5d580 0x00000000000065b1 <+1953>: vpermi2q zmm3,zmm8,zmm4 0x00000000000065b7 <+1959>: vbroadcasti32x4 zmm4,XMMWORD PTR [rip+0x5768f] # 0x5dc50 0x00000000000065c1 <+1969>: vpermi2q zmm4,zmm6,zmm1 0x00000000000065c7 <+1975>: mov al,0x84 0x00000000000065c9 <+1977>: kmovd k6,eax 0x00000000000065cd <+1981>: vmovdqa64 zmm3{k6},zmm4 0x00000000000065d3 <+1987>: vpminsq zmm4,zmm6,zmm3 0x00000000000065d9 <+1993>: vpmaxsq zmm3,zmm6,zmm3 0x00000000000065df <+1999>: kmovw k1,WORD PTR [rsp+0x100] 0x00000000000065e8 <+2008>: vpblendmq zmm5{k1},zmm3,zmm4 0x00000000000065ee <+2014>: vpmaxsq zmm6,zmm1,zmm2 0x00000000000065f4 <+2020>: vpmaxsq zmm9,zmm7,zmm11 0x00000000000065fa <+2026>: kmovw WORD PTR [rsp+0x2e],k3 0x0000000000006600 <+2032>: vpminsq zmm9{k3},zmm7,zmm11 0x0000000000006606 <+2038>: vpminsq zmm7,zmm8,zmm0 0x000000000000660c <+2044>: vmovdqa ymm10,YMMWORD PTR [rip+0x5760c] # 0x5dc20 0x0000000000006614 <+2052>: vpermi2q zmm10,zmm9,zmm7 0x000000000000661a <+2058>: vpmaxsq zmm7{k7},zmm8,zmm0 0x0000000000006620 <+2064>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57016] # 0x5d640 0x000000000000662a <+2074>: vpermi2q zmm8,zmm7,zmm3 0x0000000000006630 <+2080>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57046] # 0x5d680 0x000000000000663a <+2090>: vpermt2q zmm8,zmm0,zmm6 0x0000000000006640 <+2096>: vpminsq zmm6{k2},zmm1,zmm2 0x0000000000006646 <+2102>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x56f70] # 0x5d5c0 0x0000000000006650 <+2112>: vpermi2q zmm1,zmm3,zmm10 0x0000000000006656 <+2118>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x56fa0] # 0x5d600 0x0000000000006660 <+2128>: vpermi2q zmm2,zmm9,zmm7 0x0000000000006666 <+2134>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57050] # 0x5d6c0 0x0000000000006670 <+2144>: vpermi2q zmm3,zmm6,zmm4 0x0000000000006676 <+2150>: vpmaxsq zmm4,zmm9,zmm2 0x000000000000667c <+2156>: vpminsq zmm4{k6},zmm9,zmm2 0x0000000000006682 <+2162>: vpmaxsq zmm2,zmm6,zmm3 0x0000000000006688 <+2168>: mov al,0x4 0x000000000000668a <+2170>: kmovd k7,eax 0x000000000000668e <+2174>: vpmaxsq zmm9,zmm5,zmm8 0x0000000000006694 <+2180>: vpminsq zmm10,zmm7,zmm1 0x000000000000669a <+2186>: mov al,0x5 0x000000000000669c <+2188>: kmovd k6,eax 0x00000000000066a0 <+2192>: vmovdqa64 zmm11,zmm10 0x00000000000066a6 <+2198>: vpmaxsq zmm11{k6},zmm7,zmm1 0x00000000000066ac <+2204>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5704a] # 0x5d700 0x00000000000066b6 <+2214>: vpermi2q zmm1,zmm11,zmm4 0x00000000000066bc <+2220>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5707a] # 0x5d740 0x00000000000066c6 <+2230>: vpermi2q zmm7,zmm1,zmm9 0x00000000000066cc <+2236>: vpminsq zmm9{k1},zmm5,zmm8 0x00000000000066d2 <+2242>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570a4] # 0x5d780 0x00000000000066dc <+2252>: vpermi2q zmm1,zmm10,zmm9 0x00000000000066e2 <+2258>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x570d4] # 0x5d7c0 0x00000000000066ec <+2268>: vpermi2q zmm5,zmm1,zmm2 0x00000000000066f2 <+2274>: vpminsq zmm2{k7},zmm6,zmm3 0x00000000000066f8 <+2280>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570fe] # 0x5d800 0x0000000000006702 <+2290>: vpermi2q zmm1,zmm4,zmm10 0x0000000000006708 <+2296>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x5712e] # 0x5d840 0x0000000000006712 <+2306>: vpermi2q zmm3,zmm2,zmm9 0x0000000000006718 <+2312>: vpmaxsq zmm6,zmm2,zmm3 0x000000000000671e <+2318>: vpminsq zmm6{k2},zmm2,zmm3 0x0000000000006724 <+2324>: vpmaxsq zmm2,zmm4,zmm1 0x000000000000672a <+2330>: mov al,0x44 0x000000000000672c <+2332>: kmovd k1,eax 0x0000000000006730 <+2336>: vpminsq zmm2{k1},zmm4,zmm1 0x0000000000006736 <+2342>: vpmaxsq zmm1,zmm9,zmm5 0x000000000000673c <+2348>: mov al,0x18 0x000000000000673e <+2350>: kmovd k1,eax 0x0000000000006742 <+2354>: vpminsq zmm3,zmm11,zmm7 0x0000000000006748 <+2360>: mov al,0x19 0x000000000000674a <+2362>: kmovd k3,eax 0x000000000000674e <+2366>: vmovdqa64 zmm4,zmm3 0x0000000000006754 <+2372>: vpmaxsq zmm4{k3},zmm11,zmm7 0x000000000000675a <+2378>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x5711c] # 0x5d880 0x0000000000006764 <+2388>: vpermi2q zmm7,zmm4,zmm1 0x000000000000676a <+2394>: vpminsq zmm1{k1},zmm9,zmm5 0x0000000000006770 <+2400>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57146] # 0x5d8c0 0x000000000000677a <+2410>: vpermi2q zmm5,zmm1,zmm3 0x0000000000006780 <+2416>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57176] # 0x5d900 0x000000000000678a <+2426>: vpermq zmm3,zmm3,zmm2 0x0000000000006790 <+2432>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x571a6] # 0x5d940 0x000000000000679a <+2442>: vpermq zmm8,zmm8,zmm6 0x00000000000067a0 <+2448>: vpmaxsq zmm9,zmm1,zmm5 0x00000000000067a6 <+2454>: mov al,0x2c 0x00000000000067a8 <+2456>: kmovd k1,eax 0x00000000000067ac <+2460>: vpminsq zmm9{k1},zmm1,zmm5 0x00000000000067b2 <+2466>: vpminsq zmm1,zmm4,zmm7 0x00000000000067b8 <+2472>: vpmaxsq zmm5,zmm6,zmm8 0x00000000000067be <+2478>: kmovw k1,WORD PTR [rsp+0x140] 0x00000000000067c7 <+2487>: vpminsq zmm5{k1},zmm6,zmm8 0x00000000000067cd <+2493>: vpmaxsq zmm6,zmm2,zmm3 0x00000000000067d3 <+2499>: vpminsq zmm6{k4},zmm2,zmm3 0x00000000000067d9 <+2505>: mov al,0x34 0x00000000000067db <+2507>: kmovd k1,eax 0x00000000000067df <+2511>: vpmaxsq zmm1{k1},zmm4,zmm7 0x00000000000067e5 <+2517>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57191] # 0x5d980 0x00000000000067ef <+2527>: vpermi2q zmm2,zmm1,zmm9 0x00000000000067f5 <+2533>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x571c1] # 0x5d9c0 0x00000000000067ff <+2543>: vpermi2q zmm3,zmm9,zmm1 0x0000000000006805 <+2549>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x571f1] # 0x5da00 0x000000000000680f <+2559>: vpermq zmm4,zmm4,zmm6 0x0000000000006815 <+2565>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57221] # 0x5da40 0x000000000000681f <+2575>: vpermq zmm7,zmm7,zmm5 0x0000000000006825 <+2581>: vpmaxsq zmm8,zmm9,zmm3 0x000000000000682b <+2587>: mov al,0x4a 0x000000000000682d <+2589>: kmovd k1,eax 0x0000000000006831 <+2593>: vpminsq zmm10,zmm1,zmm2 0x0000000000006837 <+2599>: vpmaxsq zmm11,zmm6,zmm4 0x000000000000683d <+2605>: vpminsq zmm11{k5},zmm6,zmm4 0x0000000000006843 <+2611>: mov al,0x52 0x0000000000006845 <+2613>: kmovd k2,eax 0x0000000000006849 <+2617>: vmovdqa64 zmm4,zmm10 0x000000000000684f <+2623>: vpmaxsq zmm4{k2},zmm1,zmm2 0x0000000000006855 <+2629>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57221] # 0x5da80 0x000000000000685f <+2639>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm4 0x0000000000006867 <+2647>: vpermt2q zmm4,zmm2,zmm11 0x000000000000686d <+2653>: vpermt2q zmm4,zmm0,zmm8 0x0000000000006873 <+2659>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm4 0x000000000000687b <+2667>: vpminsq zmm8{k1},zmm9,zmm3 0x0000000000006881 <+2673>: vpminsq zmm1,zmm5,zmm7 0x0000000000006887 <+2679>: vpmaxsq zmm3,zmm5,zmm7 0x000000000000688d <+2685>: vmovdqa64 zmm3{k6},zmm1 0x0000000000006893 <+2691>: vpermi2q zmm2,zmm8,zmm10 0x0000000000006899 <+2697>: vpermt2q zmm2,zmm0,zmm1 0x000000000000689f <+2703>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm2 0x00000000000068a7 <+2711>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5720f] # 0x5dac0 0x00000000000068b1 <+2721>: vmovdqa64 ZMMWORD PTR [rsp+0x3c0],zmm8 0x00000000000068b9 <+2729>: vmovdqa64 ZMMWORD PTR [rsp+0x380],zmm3 0x00000000000068c1 <+2737>: vpermi2q zmm0,zmm3,zmm8 0x00000000000068c7 <+2743>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm0 0x00000000000068cf <+2751>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57227] # 0x5db00 0x00000000000068d9 <+2761>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm11 0x00000000000068e1 <+2769>: vpermi2q zmm0,zmm11,zmm10 0x00000000000068e7 <+2775>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm0 0x00000000000068ef <+2783>: vpxor xmm0,xmm0,xmm0 0x00000000000068f3 <+2787>: vmovdqa XMMWORD PTR [rsp+0x40],xmm0 0x00000000000068f9 <+2793>: lea rsi,[rsp+0x40] 0x00000000000068fe <+2798>: mov edi,0x1 0x0000000000006903 <+2803>: vzeroupper 0x0000000000006906 <+2806>: call 0x5470 <clock_gettime@plt> 0x000000000000690b <+2811>: mov r13,QWORD PTR [rsp+0x40] 0x0000000000006910 <+2816>: sub r13,rbx 0x0000000000006913 <+2819>: mov rbx,QWORD PTR [rsp+0x48] 0x0000000000006918 <+2824>: mov edi,0x20 0x000000000000691d <+2829>: call 0x8850 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006922 <+2834>: mov r14,rax 0x0000000000006925 <+2837>: test rax,rax 0x0000000000006928 <+2840>: jle 0x693f <main+2863> 0x000000000000692a <+2842>: mov edi,0x1 0x000000000000692f <+2847>: mov rsi,r14 0x0000000000006932 <+2850>: call 0x2dda0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006937 <+2855>: mov r15,rax 0x000000000000693a <+2858>: mov r12,r14 0x000000000000693d <+2861>: jmp 0x6945 <main+2869> 0x000000000000693f <+2863>: xor r15d,r15d 0x0000000000006942 <+2866>: xor r12d,r12d 0x0000000000006945 <+2869>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x300] 0x000000000000694d <+2877>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x380] 0x0000000000006955 <+2885>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x000000000000695d <+2893>: mov al,0xa 0x000000000000695f <+2895>: kmovd k1,eax 0x0000000000006963 <+2899>: kmovw WORD PTR [rsp+0x2a],k1 0x0000000000006969 <+2905>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x3c0] 0x0000000000006971 <+2913>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x400] 0x0000000000006979 <+2921>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000006981 <+2929>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x440] 0x0000000000006989 <+2937>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x480] 0x0000000000006991 <+2945>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000006999 <+2953>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x340] 0x00000000000069a1 <+2961>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x4c0] 0x00000000000069a9 <+2969>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x00000000000069b1 <+2977>: mov al,0xa8 0x00000000000069b3 <+2979>: kmovd k1,eax 0x00000000000069b7 <+2983>: kmovw WORD PTR [rsp+0x2c],k1 0x00000000000069bd <+2989>: imul r13,r13,0x3b9aca00 0x00000000000069c4 <+2996>: sub rbx,QWORD PTR [rsp+0x58] 0x00000000000069c9 <+3001>: lea rdx,[rip+0x57170] # 0x5db40 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000069d0 <+3008>: mov ecx,0x20 0x00000000000069d5 <+3013>: mov rdi,r15 0x00000000000069d8 <+3016>: mov rsi,r14 0x00000000000069db <+3019>: xor eax,eax 0x00000000000069dd <+3021>: vzeroupper 0x00000000000069e0 <+3024>: call 0x57c0 <snprintf@plt> 0x00000000000069e5 <+3029>: cdqe 0x00000000000069e7 <+3031>: inc rax 0x00000000000069ea <+3034>: mov QWORD PTR [rsp+0xa0],r15 0x00000000000069f2 <+3042>: mov QWORD PTR [rsp+0xa8],rax 0x00000000000069fa <+3050>: mov QWORD PTR [rsp+0xb0],r12 0x0000000000006a02 <+3058>: lea rdx,[rip+0x57157] # 0x5db60 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x0000000000006a09 <+3065>: lea rdi,[rsp+0x258] 0x0000000000006a11 <+3073>: lea rsi,[rsp+0xa0] 0x0000000000006a19 <+3081>: mov ecx,0x6 0x0000000000006a1e <+3086>: call 0xdea0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006a23 <+3091>: mov rdi,QWORD PTR [rsp+0xa0] 0x0000000000006a2b <+3099>: test rdi,rdi 0x0000000000006a2e <+3102>: je 0x6a35 <main+3109> 0x0000000000006a30 <+3104>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006a35 <+3109>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000006a3d <+3117>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x300] 0x0000000000006a45 <+3125>: kmovw k1,WORD PTR [rsp+0x2a] 0x0000000000006a4b <+3131>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x380] 0x0000000000006a53 <+3139>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000006a5b <+3147>: kmovw k1,WORD PTR [rsp+0x2e] 0x0000000000006a61 <+3153>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006a69 <+3161>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x3c0] 0x0000000000006a71 <+3169>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x400] 0x0000000000006a79 <+3177>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000006a81 <+3185>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000006a89 <+3193>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x440] 0x0000000000006a91 <+3201>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x480] 0x0000000000006a99 <+3209>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000006aa1 <+3217>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000006aa9 <+3225>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x340] 0x0000000000006ab1 <+3233>: kmovw k1,WORD PTR [rsp+0x2c] 0x0000000000006ab7 <+3239>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x4c0] 0x0000000000006abf <+3247>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x0000000000006ac7 <+3255>: add rbx,r13 0x0000000000006aca <+3258>: mov edi,0x1 0x0000000000006acf <+3263>: mov esi,0x3 0x0000000000006ad4 <+3268>: vzeroupper 0x0000000000006ad7 <+3271>: call 0x2dda0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006adc <+3276>: xor ecx,ecx 0x0000000000006ade <+3278>: xchg ax,ax 0x0000000000006ae0 <+3280>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006ae4 <+3284>: inc rcx 0x0000000000006ae7 <+3287>: cmp rcx,0x3 0x0000000000006aeb <+3291>: jne 0x6ae0 <main+3280> 0x0000000000006aed <+3293>: mov WORD PTR [rax],0x203a 0x0000000000006af2 <+3298>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006af6 <+3302>: mov QWORD PTR [rsp+0xb8],rax 0x0000000000006afe <+3310>: mov QWORD PTR [rsp+0xc0],0x3 0x0000000000006b0a <+3322>: mov QWORD PTR [rsp+0xc8],0x3 0x0000000000006b16 <+3334>: lea rdi,[rsp+0x270] 0x0000000000006b1e <+3342>: lea rsi,[rsp+0x258] 0x0000000000006b26 <+3350>: lea rdx,[rsp+0xb8] 0x0000000000006b2e <+3358>: call 0xda60 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006b33 <+3363>: mov rdi,QWORD PTR [rsp+0xb8] 0x0000000000006b3b <+3371>: test rdi,rdi 0x0000000000006b3e <+3374>: je 0x6b45 <main+3381> 0x0000000000006b40 <+3376>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006b45 <+3381>: mov rdi,QWORD PTR [rsp+0x258] 0x0000000000006b4d <+3389>: test rdi,rdi 0x0000000000006b50 <+3392>: je 0x6b57 <main+3399> 0x0000000000006b52 <+3394>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006b57 <+3399>: lea r14,[rsp+0x2e8] 0x0000000000006b5f <+3407>: mov rdi,r14 0x0000000000006b62 <+3410>: vmovaps zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000006b6a <+3418>: vmovaps zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000006b72 <+3426>: vmovaps zmm2,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006b7a <+3434>: vmovaps zmm3,ZMMWORD PTR [rsp+0x140] 0x0000000000006b82 <+3442>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=32> 0x0000000000006b87 <+3447>: lea rdi,[rsp+0x288] 0x0000000000006b8f <+3455>: lea rsi,[rsp+0x270] 0x0000000000006b97 <+3463>: mov rdx,r14 0x0000000000006b9a <+3466>: vzeroupper 0x0000000000006b9d <+3469>: call 0xda60 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006ba2 <+3474>: mov rdi,QWORD PTR [rsp+0x2e8] 0x0000000000006baa <+3482>: test rdi,rdi 0x0000000000006bad <+3485>: je 0x6bb4 <main+3492> 0x0000000000006baf <+3487>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006bb4 <+3492>: mov rdi,QWORD PTR [rsp+0x270] 0x0000000000006bbc <+3500>: test rdi,rdi 0x0000000000006bbf <+3503>: je 0x6bc6 <main+3510> 0x0000000000006bc1 <+3505>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006bc6 <+3510>: lea rdi,[rsp+0x288] 0x0000000000006bce <+3518>: call 0x9300 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006bd3 <+3523>: mov rdi,QWORD PTR [rsp+0x288] 0x0000000000006bdb <+3531>: test rdi,rdi 0x0000000000006bde <+3534>: je 0x6be5 <main+3541> 0x0000000000006be0 <+3536>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006be5 <+3541>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000006bed <+3549>: vpaddq zmm0,zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006bf5 <+3557>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000006bfd <+3565>: vpaddq zmm1,zmm1,ZMMWORD PTR [rsp+0x140] 0x0000000000006c05 <+3573>: vpaddq zmm0,zmm0,zmm1 0x0000000000006c0b <+3579>: vextracti64x4 ymm1,zmm0,0x1 0x0000000000006c12 <+3586>: vpaddq ymm0,ymm0,ymm1 0x0000000000006c16 <+3590>: vextracti128 xmm1,ymm0,0x1 0x0000000000006c1c <+3596>: vpaddq xmm0,xmm0,xmm1 0x0000000000006c20 <+3600>: vpshufd xmm1,xmm0,0xee 0x0000000000006c25 <+3605>: vpaddq xmm0,xmm0,xmm1 0x0000000000006c29 <+3609>: vmovq rax,xmm0 0x0000000000006c2e <+3614>: vmovq QWORD PTR [rsp+0x68],xmm0 0x0000000000006c34 <+3620>: lea rcx,[rsp+0x68] 0x0000000000006c39 <+3625>: mov QWORD PTR [rsp+0x60],rcx 0x0000000000006c3e <+3630>: mov rdi,rbx 0x0000000000006c41 <+3633>: vzeroupper 0x0000000000006c44 <+3636>: call 0x8850 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006c49 <+3641>: mov r14,rax 0x0000000000006c4c <+3644>: test rax,rax 0x0000000000006c4f <+3647>: jle 0x6c66 <main+3670> 0x0000000000006c51 <+3649>: mov edi,0x1 0x0000000000006c56 <+3654>: mov rsi,r14 0x0000000000006c59 <+3657>: call 0x2dda0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006c5e <+3662>: mov r15,rax 0x0000000000006c61 <+3665>: mov r12,r14 0x0000000000006c64 <+3668>: jmp 0x6c6c <main+3676> 0x0000000000006c66 <+3670>: xor r15d,r15d 0x0000000000006c69 <+3673>: xor r12d,r12d 0x0000000000006c6c <+3676>: lea rdx,[rip+0x56ecd] # 0x5db40 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006c73 <+3683>: mov rdi,r15 0x0000000000006c76 <+3686>: mov rsi,r14 0x0000000000006c79 <+3689>: mov rcx,rbx 0x0000000000006c7c <+3692>: xor eax,eax 0x0000000000006c7e <+3694>: call 0x57c0 <snprintf@plt> 0x0000000000006c83 <+3699>: cdqe 0x0000000000006c85 <+3701>: inc rax 0x0000000000006c88 <+3704>: mov QWORD PTR [rsp+0xd0],r15 0x0000000000006c90 <+3712>: mov QWORD PTR [rsp+0xd8],rax 0x0000000000006c98 <+3720>: mov QWORD PTR [rsp+0xe0],r12 0x0000000000006ca0 <+3728>: lea rdx,[rip+0x56ec9] # 0x5db70 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x0000000000006ca7 <+3735>: lea rdi,[rsp+0x2a0] 0x0000000000006caf <+3743>: lea rsi,[rsp+0xd0] 0x0000000000006cb7 <+3751>: mov ecx,0xb 0x0000000000006cbc <+3756>: call 0xdea0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006cc1 <+3761>: mov rdi,QWORD PTR [rsp+0xd0] 0x0000000000006cc9 <+3769>: test rdi,rdi 0x0000000000006ccc <+3772>: je 0x6cd3 <main+3779> 0x0000000000006cce <+3774>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006cd3 <+3779>: mov edi,0x1 0x0000000000006cd8 <+3784>: mov esi,0x4 0x0000000000006cdd <+3789>: call 0x2dda0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006ce2 <+3794>: xor ecx,ecx 0x0000000000006ce4 <+3796>: data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006cf0 <+3808>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006cf4 <+3812>: inc rcx 0x0000000000006cf7 <+3815>: cmp rcx,0x4 0x0000000000006cfb <+3819>: jne 0x6cf0 <main+3808> 0x0000000000006cfd <+3821>: mov DWORD PTR [rax],0x736e20 0x0000000000006d03 <+3827>: mov QWORD PTR [rsp+0xe8],rax 0x0000000000006d0b <+3835>: mov QWORD PTR [rsp+0xf0],0x4 0x0000000000006d17 <+3847>: mov QWORD PTR [rsp+0xf8],0x4 0x0000000000006d23 <+3859>: lea rdi,[rsp+0x2b8] 0x0000000000006d2b <+3867>: lea rsi,[rsp+0x2a0] 0x0000000000006d33 <+3875>: lea rdx,[rsp+0xe8] 0x0000000000006d3b <+3883>: call 0xda60 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006d40 <+3888>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000006d48 <+3896>: test rdi,rdi 0x0000000000006d4b <+3899>: je 0x6d52 <main+3906> 0x0000000000006d4d <+3901>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006d52 <+3906>: mov rdi,QWORD PTR [rsp+0x2a0] 0x0000000000006d5a <+3914>: test rdi,rdi 0x0000000000006d5d <+3917>: je 0x6d64 <main+3924> 0x0000000000006d5f <+3919>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006d64 <+3924>: lea rdi,[rsp+0x2b8] 0x0000000000006d6c <+3932>: call 0x9300 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006d71 <+3937>: mov rdi,QWORD PTR [rsp+0x2b8] 0x0000000000006d79 <+3945>: test rdi,rdi 0x0000000000006d7c <+3948>: je 0x6d83 <main+3955> 0x0000000000006d7e <+3950>: call 0x2ddc0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006d83 <+3955>: call 0x2a1c0 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006d88 <+3960>: xor eax,eax 0x0000000000006d8a <+3962>: lea rsp,[rbp-0x28] 0x0000000000006d8e <+3966>: pop rbx 0x0000000000006d8f <+3967>: pop r12 0x0000000000006d91 <+3969>: pop r13 0x0000000000006d93 <+3971>: pop r14 0x0000000000006d95 <+3973>: pop r15 0x0000000000006d97 <+3975>: pop rbp 0x0000000000006d98 <+3976>: ret End of assembler dump. --- disassemble/int64_64.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005eb0 <+0>: push rbp 0x0000000000005eb1 <+1>: mov rbp,rsp 0x0000000000005eb4 <+4>: push r15 0x0000000000005eb6 <+6>: push r14 0x0000000000005eb8 <+8>: push r13 0x0000000000005eba <+10>: push r12 0x0000000000005ebc <+12>: push rbx 0x0000000000005ebd <+13>: and rsp,0xffffffffffffffc0 0x0000000000005ec1 <+17>: sub rsp,0xa40 0x0000000000005ec8 <+24>: call 0x30b60 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005ecd <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005ed1 <+33>: mov ebx,0x41 0x0000000000005ed6 <+38>: xor r14d,r14d 0x0000000000005ed9 <+41>: vxorps xmm5,xmm5,xmm5 0x0000000000005edd <+45>: vxorps xmm6,xmm6,xmm6 0x0000000000005ee1 <+49>: vxorps xmm7,xmm7,xmm7 0x0000000000005ee5 <+53>: vxorps xmm4,xmm4,xmm4 0x0000000000005ee9 <+57>: vxorps xmm3,xmm3,xmm3 0x0000000000005eed <+61>: vxorps xmm2,xmm2,xmm2 0x0000000000005ef1 <+65>: vxorps xmm1,xmm1,xmm1 0x0000000000005ef5 <+69>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005f00 <+80>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm5 0x0000000000005f08 <+88>: vmovaps ZMMWORD PTR [rsp+0x200],zmm6 0x0000000000005f10 <+96>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005f18 <+104>: vmovaps ZMMWORD PTR [rsp+0x280],zmm7 0x0000000000005f20 <+112>: vmovaps ZMMWORD PTR [rsp+0x180],zmm4 0x0000000000005f28 <+120>: vmovaps ZMMWORD PTR [rsp+0x100],zmm3 0x0000000000005f30 <+128>: vmovaps ZMMWORD PTR [rsp+0x240],zmm2 0x0000000000005f38 <+136>: vmovaps ZMMWORD PTR [rsp+0x2c0],zmm1 0x0000000000005f40 <+144>: vzeroupper 0x0000000000005f43 <+147>: call 0x2fab0 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005f48 <+152>: mov edx,0x64 0x0000000000005f4d <+157>: mov rdi,rax 0x0000000000005f50 <+160>: xor esi,esi 0x0000000000005f52 <+162>: call 0x2fec0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005f57 <+167>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005f5f <+175>: vmovaps ZMMWORD PTR [rsp+0x800],zmm0 0x0000000000005f67 <+183>: vmovaps zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000005f6f <+191>: vmovaps ZMMWORD PTR [rsp+0x840],zmm0 0x0000000000005f77 <+199>: vmovaps zmm0,ZMMWORD PTR [rsp+0x200] 0x0000000000005f7f <+207>: vmovaps ZMMWORD PTR [rsp+0x880],zmm0 0x0000000000005f87 <+215>: vmovaps zmm0,ZMMWORD PTR [rsp+0x280] 0x0000000000005f8f <+223>: vmovaps ZMMWORD PTR [rsp+0x8c0],zmm0 0x0000000000005f97 <+231>: vmovaps zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000005f9f <+239>: vmovaps ZMMWORD PTR [rsp+0x900],zmm0 0x0000000000005fa7 <+247>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005faf <+255>: vmovaps ZMMWORD PTR [rsp+0x940],zmm0 0x0000000000005fb7 <+263>: vmovaps zmm0,ZMMWORD PTR [rsp+0x240] 0x0000000000005fbf <+271>: vmovaps ZMMWORD PTR [rsp+0x980],zmm0 0x0000000000005fc7 <+279>: vmovaps zmm0,ZMMWORD PTR [rsp+0x2c0] 0x0000000000005fcf <+287>: vmovaps ZMMWORD PTR [rsp+0x9c0],zmm0 0x0000000000005fd7 <+295>: mov ecx,r14d 0x0000000000005fda <+298>: and ecx,0x3f 0x0000000000005fdd <+301>: mov QWORD PTR [rsp+rcx*8+0x800],rax 0x0000000000005fe5 <+309>: vmovaps zmm1,ZMMWORD PTR [rsp+0x9c0] 0x0000000000005fed <+317>: vmovaps zmm2,ZMMWORD PTR [rsp+0x980] 0x0000000000005ff5 <+325>: vmovaps zmm3,ZMMWORD PTR [rsp+0x940] 0x0000000000005ffd <+333>: vmovaps zmm4,ZMMWORD PTR [rsp+0x900] 0x0000000000006005 <+341>: vmovaps zmm0,ZMMWORD PTR [rsp+0x800] 0x000000000000600d <+349>: vmovaps zmm5,ZMMWORD PTR [rsp+0x840] 0x0000000000006015 <+357>: vmovaps zmm6,ZMMWORD PTR [rsp+0x880] 0x000000000000601d <+365>: vmovaps zmm7,ZMMWORD PTR [rsp+0x8c0] 0x0000000000006025 <+373>: dec rbx 0x0000000000006028 <+376>: inc r14 0x000000000000602b <+379>: cmp rbx,0x1 0x000000000000602f <+383>: ja 0x5f00 <main+80> 0x0000000000006035 <+389>: vmovaps ZMMWORD PTR [rsp+0x1c0],zmm5 0x000000000000603d <+397>: vmovaps ZMMWORD PTR [rsp+0x200],zmm6 0x0000000000006045 <+405>: vmovaps ZMMWORD PTR [rsp+0x240],zmm2 0x000000000000604d <+413>: vmovaps ZMMWORD PTR [rsp+0x280],zmm7 0x0000000000006055 <+421>: vmovaps ZMMWORD PTR [rsp+0x2c0],zmm1 0x000000000000605d <+429>: vmovaps ZMMWORD PTR [rsp+0x100],zmm3 0x0000000000006065 <+437>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x000000000000606d <+445>: vmovaps ZMMWORD PTR [rsp+0x180],zmm4 0x0000000000006075 <+453>: mov edi,0x40 0x000000000000607a <+458>: vzeroupper 0x000000000000607d <+461>: call 0x9a40 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006082 <+466>: mov rbx,rax 0x0000000000006085 <+469>: test rax,rax 0x0000000000006088 <+472>: jle 0x609f <main+495> 0x000000000000608a <+474>: mov edi,0x1 0x000000000000608f <+479>: mov rsi,rbx 0x0000000000006092 <+482>: call 0x2ef90 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006097 <+487>: mov r14,rax 0x000000000000609a <+490>: mov r15,rbx 0x000000000000609d <+493>: jmp 0x60a5 <main+501> 0x000000000000609f <+495>: xor r14d,r14d 0x00000000000060a2 <+498>: xor r15d,r15d 0x00000000000060a5 <+501>: lea rdx,[rip+0x5a094] # 0x60140 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000060ac <+508>: mov ecx,0x40 0x00000000000060b1 <+513>: mov rdi,r14 0x00000000000060b4 <+516>: mov rsi,rbx 0x00000000000060b7 <+519>: xor eax,eax 0x00000000000060b9 <+521>: call 0x57c0 <snprintf@plt> 0x00000000000060be <+526>: cdqe 0x00000000000060c0 <+528>: inc rax 0x00000000000060c3 <+531>: mov QWORD PTR [rsp+0x70],r14 0x00000000000060c8 <+536>: mov QWORD PTR [rsp+0x78],rax 0x00000000000060cd <+541>: mov QWORD PTR [rsp+0x80],r15 0x00000000000060d5 <+549>: lea rdx,[rip+0x5a074] # 0x60150 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x00000000000060dc <+556>: lea rdi,[rsp+0x310] 0x00000000000060e4 <+564>: lea rsi,[rsp+0x70] 0x00000000000060e9 <+569>: mov ecx,0x7 0x00000000000060ee <+574>: call 0xf090 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000060f3 <+579>: mov rdi,QWORD PTR [rsp+0x70] 0x00000000000060f8 <+584>: test rdi,rdi 0x00000000000060fb <+587>: je 0x6102 <main+594> 0x00000000000060fd <+589>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006102 <+594>: mov edi,0x1 0x0000000000006107 <+599>: mov esi,0x3 0x000000000000610c <+604>: call 0x2ef90 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006111 <+609>: xor ecx,ecx 0x0000000000006113 <+611>: data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006120 <+624>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006124 <+628>: inc rcx 0x0000000000006127 <+631>: cmp rcx,0x3 0x000000000000612b <+635>: jne 0x6120 <main+624> 0x000000000000612d <+637>: mov WORD PTR [rax],0x203a 0x0000000000006132 <+642>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006136 <+646>: mov QWORD PTR [rsp+0x88],rax 0x000000000000613e <+654>: mov QWORD PTR [rsp+0x90],0x3 0x000000000000614a <+666>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000006156 <+678>: lea rdi,[rsp+0x328] 0x000000000000615e <+686>: lea rsi,[rsp+0x310] 0x0000000000006166 <+694>: lea rdx,[rsp+0x88] 0x000000000000616e <+702>: call 0xec50 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006173 <+707>: mov rdi,QWORD PTR [rsp+0x88] 0x000000000000617b <+715>: test rdi,rdi 0x000000000000617e <+718>: je 0x6185 <main+725> 0x0000000000006180 <+720>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006185 <+725>: mov rdi,QWORD PTR [rsp+0x310] 0x000000000000618d <+733>: test rdi,rdi 0x0000000000006190 <+736>: je 0x6197 <main+743> 0x0000000000006192 <+738>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006197 <+743>: lea rbx,[rsp+0x3d0] 0x000000000000619f <+751>: mov rdi,rbx 0x00000000000061a2 <+754>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x00000000000061aa <+762>: vmovaps zmm1,ZMMWORD PTR [rsp+0x1c0] 0x00000000000061b2 <+770>: vmovaps zmm2,ZMMWORD PTR [rsp+0x200] 0x00000000000061ba <+778>: vmovaps zmm3,ZMMWORD PTR [rsp+0x280] 0x00000000000061c2 <+786>: vmovaps zmm4,ZMMWORD PTR [rsp+0x180] 0x00000000000061ca <+794>: vmovaps zmm5,ZMMWORD PTR [rsp+0x100] 0x00000000000061d2 <+802>: vmovaps zmm6,ZMMWORD PTR [rsp+0x240] 0x00000000000061da <+810>: vmovaps zmm7,ZMMWORD PTR [rsp+0x2c0] 0x00000000000061e2 <+818>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=64> 0x00000000000061e7 <+823>: lea rdi,[rsp+0x340] 0x00000000000061ef <+831>: lea rsi,[rsp+0x328] 0x00000000000061f7 <+839>: mov rdx,rbx 0x00000000000061fa <+842>: vzeroupper 0x00000000000061fd <+845>: call 0xec50 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006202 <+850>: mov rdi,QWORD PTR [rsp+0x3d0] 0x000000000000620a <+858>: test rdi,rdi 0x000000000000620d <+861>: je 0x6214 <main+868> 0x000000000000620f <+863>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006214 <+868>: mov rdi,QWORD PTR [rsp+0x328] 0x000000000000621c <+876>: test rdi,rdi 0x000000000000621f <+879>: je 0x6226 <main+886> 0x0000000000006221 <+881>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006226 <+886>: lea rdi,[rsp+0x340] 0x000000000000622e <+894>: call 0xa4f0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006233 <+899>: mov rdi,QWORD PTR [rsp+0x340] 0x000000000000623b <+907>: test rdi,rdi 0x000000000000623e <+910>: je 0x6245 <main+917> 0x0000000000006240 <+912>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006245 <+917>: vxorps xmm0,xmm0,xmm0 0x0000000000006249 <+921>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 0x000000000000624f <+927>: lea rsi,[rsp+0x30] 0x0000000000006254 <+932>: mov edi,0x1 0x0000000000006259 <+937>: call 0x5470 <clock_gettime@plt> 0x000000000000625e <+942>: vmovdqa64 zmm21,ZMMWORD PTR [rsp+0x240] 0x0000000000006266 <+950>: vpxor xmm0,xmm0,xmm0 0x000000000000626a <+954>: vpermq zmm0,zmm21,0x4e 0x0000000000006271 <+961>: vmovdqa64 zmm23,ZMMWORD PTR [rsp+0x1c0] 0x0000000000006279 <+969>: vpxor xmm1,xmm1,xmm1 0x000000000000627d <+973>: vpermq zmm1,zmm23,0x4e 0x0000000000006284 <+980>: vmovdqa64 zmm22,ZMMWORD PTR [rsp+0x200] 0x000000000000628c <+988>: vpxor xmm2,xmm2,xmm2 0x0000000000006290 <+992>: vpermq zmm2,zmm22,0x4e 0x0000000000006297 <+999>: vmovdqa64 zmm9,ZMMWORD PTR [rsp+0x140] 0x000000000000629f <+1007>: vpxor xmm3,xmm3,xmm3 0x00000000000062a3 <+1011>: vpermq zmm3,zmm9,0x4e 0x00000000000062aa <+1018>: vmovdqa64 zmm19,ZMMWORD PTR [rsp+0x2c0] 0x00000000000062b2 <+1026>: vpxor xmm4,xmm4,xmm4 0x00000000000062b6 <+1030>: vpermq zmm4,zmm19,0x4e 0x00000000000062bd <+1037>: vmovdqa64 zmm11,ZMMWORD PTR [rsp+0x100] 0x00000000000062c5 <+1045>: vpxor xmm5,xmm5,xmm5 0x00000000000062c9 <+1049>: vpermq zmm5,zmm11,0x4e 0x00000000000062d0 <+1056>: vmovdqa64 zmm20,ZMMWORD PTR [rsp+0x280] 0x00000000000062d8 <+1064>: vpxor xmm6,xmm6,xmm6 0x00000000000062dc <+1068>: vpermq zmm6,zmm20,0x4e 0x00000000000062e3 <+1075>: vmovdqa64 zmm8,ZMMWORD PTR [rsp+0x180] 0x00000000000062eb <+1083>: vpxor xmm7,xmm7,xmm7 0x00000000000062ef <+1087>: vpermq zmm7,zmm8,0x4e 0x00000000000062f6 <+1094>: vpminsq zmm10,zmm8,zmm7 0x00000000000062fc <+1100>: vpminsq zmm12,zmm20,zmm6 0x0000000000006302 <+1106>: vpminsq zmm13,zmm11,zmm5 0x0000000000006308 <+1112>: vpminsq zmm14,zmm19,zmm4 0x000000000000630e <+1118>: vpminsq zmm15,zmm9,zmm3 0x0000000000006314 <+1124>: vpminsq zmm16,zmm22,zmm2 0x000000000000631a <+1130>: vpminsq zmm17,zmm23,zmm1 0x0000000000006320 <+1136>: vpminsq zmm18,zmm21,zmm0 0x0000000000006326 <+1142>: mov al,0xcc 0x0000000000006328 <+1144>: kmovd k1,eax 0x000000000000632c <+1148>: kmovw WORD PTR [rsp+0x400],k1 0x0000000000006335 <+1157>: vpmaxsq zmm18{k1},zmm21,zmm0 0x000000000000633b <+1163>: vpmaxsq zmm17{k1},zmm23,zmm1 0x0000000000006341 <+1169>: vpmaxsq zmm16{k1},zmm22,zmm2 0x0000000000006347 <+1175>: vpmaxsq zmm15{k1},zmm9,zmm3 0x000000000000634d <+1181>: vpmaxsq zmm14{k1},zmm19,zmm4 0x0000000000006353 <+1187>: vpmaxsq zmm13{k1},zmm11,zmm5 0x0000000000006359 <+1193>: vpmaxsq zmm12{k1},zmm20,zmm6 0x000000000000635f <+1199>: vpmaxsq zmm10{k1},zmm8,zmm7 0x0000000000006365 <+1205>: vpshufd zmm0,zmm10,0x4e 0x000000000000636c <+1212>: vpshufd zmm4,zmm12,0x4e 0x0000000000006373 <+1219>: vpshufd zmm5,zmm13,0x4e 0x000000000000637a <+1226>: vpshufd zmm19,zmm14,0x4e 0x0000000000006381 <+1233>: vpshufd zmm20,zmm15,0x4e 0x0000000000006388 <+1240>: vpshufd zmm21,zmm16,0x4e 0x000000000000638f <+1247>: vpshufd zmm22,zmm17,0x4e 0x0000000000006396 <+1254>: vpshufd zmm23,zmm18,0x4e 0x000000000000639d <+1261>: vpminsq zmm9,zmm18,zmm23 0x00000000000063a3 <+1267>: vpminsq zmm7,zmm17,zmm22 0x00000000000063a9 <+1273>: vpminsq zmm11,zmm16,zmm21 0x00000000000063af <+1279>: vpminsq zmm3,zmm15,zmm20 0x00000000000063b5 <+1285>: vpminsq zmm2,zmm14,zmm19 0x00000000000063bb <+1291>: vpminsq zmm8,zmm13,zmm5 0x00000000000063c1 <+1297>: vpminsq zmm6,zmm12,zmm4 0x00000000000063c7 <+1303>: vpminsq zmm1,zmm10,zmm0 0x00000000000063cd <+1309>: mov al,0xaa 0x00000000000063cf <+1311>: kmovd k1,eax 0x00000000000063d3 <+1315>: kmovw WORD PTR [rsp+0x2a],k1 0x00000000000063d9 <+1321>: vpmaxsq zmm1{k1},zmm10,zmm0 0x00000000000063df <+1327>: vpmaxsq zmm6{k1},zmm12,zmm4 0x00000000000063e5 <+1333>: vpmaxsq zmm8{k1},zmm13,zmm5 0x00000000000063eb <+1339>: vpmaxsq zmm2{k1},zmm14,zmm19 0x00000000000063f1 <+1345>: vpmaxsq zmm3{k1},zmm15,zmm20 0x00000000000063f7 <+1351>: vpmaxsq zmm11{k1},zmm16,zmm21 0x00000000000063fd <+1357>: vpmaxsq zmm7{k1},zmm17,zmm22 0x0000000000006403 <+1363>: vpmaxsq zmm9{k1},zmm18,zmm23 0x0000000000006409 <+1369>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x57bed] # 0x5e000 0x0000000000006413 <+1379>: vpermi2q zmm12,zmm7,zmm9 0x0000000000006419 <+1385>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57c1d] # 0x5e040 0x0000000000006423 <+1395>: vmovdqa64 zmm13,zmm3 0x0000000000006429 <+1401>: vpermt2q zmm13,zmm0,zmm11 0x000000000000642f <+1407>: vpermi2q zmm0,zmm8,zmm2 0x0000000000006435 <+1413>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x57c41] # 0x5e080 0x000000000000643f <+1423>: vpermi2q zmm16,zmm7,zmm9 0x0000000000006445 <+1429>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x57c71] # 0x5e0c0 0x000000000000644f <+1439>: vpminsq zmm5,zmm8,zmm0 0x0000000000006455 <+1445>: mov al,0x44 0x0000000000006457 <+1447>: kmovd k1,eax 0x000000000000645b <+1451>: vmovdqa64 zmm4,zmm5 0x0000000000006461 <+1457>: vpmaxsq zmm4{k1},zmm8,zmm0 0x0000000000006467 <+1463>: kmovw WORD PTR [rsp+0x180],k1 0x0000000000006470 <+1472>: vpermt2q zmm8,zmm17,zmm2 0x0000000000006476 <+1478>: vpermi2q zmm17,zmm3,zmm11 0x000000000000647c <+1484>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57c7a] # 0x5e100 0x0000000000006486 <+1494>: vpxord xmm19,xmm19,xmm19 0x000000000000648c <+1500>: vpermq zmm19,zmm0,zmm6 0x0000000000006492 <+1506>: vpermq zmm0,zmm0,zmm1 0x0000000000006498 <+1512>: vpmaxsq zmm14,zmm11,zmm17 0x000000000000649e <+1518>: mov al,0x22 0x00000000000064a0 <+1520>: kmovd k5,eax 0x00000000000064a4 <+1524>: vpmaxsq zmm18,zmm9,zmm16 0x00000000000064aa <+1530>: vpminsq zmm20,zmm7,zmm12 0x00000000000064b0 <+1536>: vshufi64x2 zmm15,zmm20,zmm14,0x4e 0x00000000000064b7 <+1543>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x57d3f] # 0x5e200 0x00000000000064c1 <+1553>: vpermi2q zmm10,zmm4,zmm18 0x00000000000064c7 <+1559>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x57d6f] # 0x5e240 0x00000000000064d1 <+1569>: vpermt2q zmm10,zmm21,zmm14 0x00000000000064d7 <+1575>: vmovdqa64 zmm25,zmm21 0x00000000000064dd <+1581>: vpminsq zmm14{k5},zmm11,zmm17 0x00000000000064e3 <+1587>: vpmaxsq zmm17,zmm2,zmm8 0x00000000000064e9 <+1593>: vmovdqa64 zmm11,zmm18 0x00000000000064ef <+1599>: vpminsq zmm11{k5},zmm9,zmm16 0x00000000000064f5 <+1605>: vpminsq zmm9,zmm1,zmm0 0x00000000000064fb <+1611>: vpminsq zmm18,zmm6,zmm19 0x0000000000006501 <+1617>: vpminsq zmm21,zmm3,zmm13 0x0000000000006507 <+1623>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x57d6f] # 0x5e280 0x0000000000006511 <+1633>: vpermi2q zmm16,zmm14,zmm20 0x0000000000006517 <+1639>: vpmaxsq zmm20{k1},zmm7,zmm12 0x000000000000651d <+1645>: vinserti64x4 zmm22,zmm21,ymm18,0x1 0x0000000000006524 <+1652>: vshufi64x2 zmm7,zmm21,zmm9,0x4e 0x000000000000652b <+1659>: vmovdqa64 zmm12,zmm21 0x0000000000006531 <+1665>: vpmaxsq zmm12{k1},zmm3,zmm13 0x0000000000006537 <+1671>: vpmaxsq zmm3,zmm6,zmm19 0x000000000000653d <+1677>: mov al,0xd4 0x000000000000653f <+1679>: kmovd k2,eax 0x0000000000006543 <+1683>: vpmaxsq zmm0,zmm1,zmm0 0x0000000000006549 <+1689>: mov al,0x66 0x000000000000654b <+1691>: kmovd k4,eax 0x000000000000654f <+1695>: vmovdqa64 zmm22{k4},zmm11 0x0000000000006555 <+1701>: vmovdqa64 zmm9{k2},zmm0 0x000000000000655b <+1707>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x57c1b] # 0x5e180 0x0000000000006565 <+1717>: vmovdqa64 zmm6,zmm9 0x000000000000656b <+1723>: vpermt2q zmm6,zmm13,zmm5 0x0000000000006571 <+1729>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x57c45] # 0x5e1c0 0x000000000000657b <+1739>: vpermi2q zmm13,zmm12,zmm3 0x0000000000006581 <+1745>: vpermt2q zmm13,zmm21,zmm17 0x0000000000006587 <+1751>: mov al,0x99 0x0000000000006589 <+1753>: kmovd k1,eax 0x000000000000658d <+1757>: vpminsq zmm19,zmm20,zmm22 0x0000000000006593 <+1763>: vpmaxsq zmm1,zmm20,zmm22 0x0000000000006599 <+1769>: vshufi64x2 zmm20{k1},zmm0,zmm17,0xee 0x00000000000065a0 <+1776>: vpminsq zmm17{k5},zmm2,zmm8 0x00000000000065a6 <+1782>: vpblendmq zmm0{k2},zmm18,zmm3 0x00000000000065ac <+1788>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57b8a] # 0x5e140 0x00000000000065b6 <+1798>: vpermt2q zmm7,zmm2,zmm17 0x00000000000065bc <+1804>: vpermt2q zmm6,zmm21,zmm11 0x00000000000065c2 <+1810>: vpermt2q zmm15,zmm2,zmm0 0x00000000000065c8 <+1816>: vpermt2q zmm16,zmm21,zmm5 0x00000000000065ce <+1822>: vmovdqa64 zmm26,zmm21 0x00000000000065d4 <+1828>: vpminsq zmm2,zmm0,zmm15 0x00000000000065da <+1834>: vpmaxsq zmm8,zmm0,zmm15 0x00000000000065e0 <+1840>: mov al,0x6 0x00000000000065e2 <+1842>: kmovd k6,eax 0x00000000000065e6 <+1846>: vpblendmq zmm5{k6},zmm8,zmm2 0x00000000000065ec <+1852>: vpminsq zmm15,zmm11,zmm20 0x00000000000065f2 <+1858>: vpmaxsq zmm20,zmm11,zmm20 0x00000000000065f8 <+1864>: mov al,0x90 0x00000000000065fa <+1866>: kmovd k7,eax 0x00000000000065fe <+1870>: vpblendmq zmm11{k7},zmm20,zmm15 0x0000000000006604 <+1876>: vpminsq zmm21,zmm9,zmm6 0x000000000000660a <+1882>: mov al,0x9 0x000000000000660c <+1884>: kmovd k5,eax 0x0000000000006610 <+1888>: vpblendmq zmm22{k5},zmm19,zmm21 0x0000000000006616 <+1894>: vpminsq zmm12,zmm12,zmm16 0x000000000000661c <+1900>: vpminsq zmm16,zmm14,zmm13 0x0000000000006622 <+1906>: vpminsq zmm23,zmm4,zmm7 0x0000000000006628 <+1912>: vpmaxsq zmm13,zmm14,zmm13 0x000000000000662e <+1918>: vshufi64x2 zmm0,zmm13,zmm8,0xee 0x0000000000006635 <+1925>: mov al,0x69 0x0000000000006637 <+1927>: kmovd k2,eax 0x000000000000663b <+1931>: kmovw WORD PTR [rsp+0x100],k2 0x0000000000006644 <+1940>: vmovdqa64 zmm0{k2},zmm20 0x000000000000664a <+1946>: vpmaxsq zmm7,zmm4,zmm7 0x0000000000006650 <+1952>: vpblendmq zmm4{k1},zmm23,zmm7 0x0000000000006656 <+1958>: vpmaxsq zmm14,zmm17,zmm10 0x000000000000665c <+1964>: vpmaxsq zmm6,zmm9,zmm6 0x0000000000006662 <+1970>: vshufi64x2 zmm9,zmm6,zmm16,0x4e 0x0000000000006669 <+1977>: vmovdqa64 zmm9{k2},zmm14 0x000000000000666f <+1983>: vpblendmq zmm10{k4},zmm16,zmm13 0x0000000000006675 <+1989>: vpblendmq zmm17{k5},zmm19,zmm1 0x000000000000667b <+1995>: mov al,0x60 0x000000000000667d <+1997>: kmovd k3,eax 0x0000000000006681 <+2001>: vpblendmq zmm24{k3},zmm21,zmm6 0x0000000000006687 <+2007>: vshufi64x2 zmm1,zmm12,zmm1,0x4e 0x000000000000668e <+2014>: vmovdqa64 zmm1{k5},zmm8 0x0000000000006694 <+2020>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57c22] # 0x5e2c0 0x000000000000669e <+2030>: vpermt2q zmm1,zmm6,zmm21 0x00000000000066a4 <+2036>: vpmaxsq zmm18,zmm4,zmm1 0x00000000000066aa <+2042>: vshufi64x2 zmm1,zmm19,zmm13,0x4e 0x00000000000066b1 <+2049>: vshufi64x2 zmm1{k1},zmm7,zmm14,0xe4 0x00000000000066b8 <+2056>: vshufi64x2 zmm13,zmm15,zmm21,0xee 0x00000000000066bf <+2063>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57c37] # 0x5e300 0x00000000000066c9 <+2073>: vpermt2q zmm13,zmm3,zmm14 0x00000000000066cf <+2079>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57c67] # 0x5e340 0x00000000000066d9 <+2089>: vpermt2q zmm13,zmm3,zmm8 0x00000000000066df <+2095>: vmovdqa64 zmm4,zmm3 0x00000000000066e5 <+2101>: vpminsq zmm15,zmm10,zmm13 0x00000000000066eb <+2107>: vpermt2q zmm22,zmm6,zmm23 0x00000000000066f1 <+2113>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x57c85] # 0x5e380 0x00000000000066fb <+2123>: vpermi2q zmm8,zmm12,zmm2 0x0000000000006701 <+2129>: vmovdqa64 zmm3,zmm25 0x0000000000006707 <+2135>: vpermt2q zmm8,zmm25,zmm7 0x000000000000670d <+2141>: vshufi64x2 zmm2,zmm12,zmm16,0xe4 0x0000000000006714 <+2148>: vshufi64x2 zmm2{k4},zmm23,zmm20,0x4e 0x000000000000671b <+2155>: vpminsq zmm13,zmm24,zmm2 0x0000000000006721 <+2161>: vpminsq zmm16,zmm17,zmm8 0x0000000000006727 <+2167>: vpminsq zmm21,zmm12,zmm22 0x000000000000672d <+2173>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57c89] # 0x5e3c0 0x0000000000006737 <+2183>: vmovdqa64 zmm22,zmm21 0x000000000000673d <+2189>: vpermt2q zmm22,zmm7,zmm16 0x0000000000006743 <+2195>: vmovdqa64 zmm22{k6},zmm13 0x0000000000006749 <+2201>: vpminsq zmm12,zmm11,zmm9 0x000000000000674f <+2207>: vpminsq zmm20,zmm5,zmm1 0x0000000000006755 <+2213>: vpmaxsq zmm17,zmm17,zmm8 0x000000000000675b <+2219>: mov al,0x96 0x000000000000675d <+2221>: kmovd k2,eax 0x0000000000006761 <+2225>: vpblendmq zmm19{k2},zmm16,zmm17 0x0000000000006767 <+2231>: vpmaxsq zmm1,zmm5,zmm1 0x000000000000676d <+2237>: vpblendmq zmm8{k4},zmm20,zmm1 0x0000000000006773 <+2243>: kmovw WORD PTR [rsp+0x140],k4 0x000000000000677c <+2252>: vpmaxsq zmm2,zmm24,zmm2 0x0000000000006782 <+2258>: vpblendmq zmm10{k1},zmm13,zmm2 0x0000000000006788 <+2264>: vpmaxsq zmm5,zmm11,zmm9 0x000000000000678e <+2270>: vpblendmq zmm24{k2},zmm12,zmm5 0x0000000000006794 <+2276>: vshufi64x2 zmm25,zmm20,zmm15,0x4e 0x000000000000679b <+2283>: vmovdqa64 zmm25{k7},zmm18 0x00000000000067a1 <+2289>: vpmaxsq zmm0,zmm14,zmm0 0x00000000000067a7 <+2295>: vmovdqa64 zmm25{k6},zmm0 0x00000000000067ad <+2301>: vinserti64x4 zmm11,zmm18,ymm12,0x1 0x00000000000067b4 <+2308>: vmovdqa64 zmm11{k3},zmm0 0x00000000000067ba <+2314>: vinserti64x4 zmm20,zmm16,ymm20,0x1 0x00000000000067c1 <+2321>: vshufi64x2 zmm20{k4},zmm12,zmm13,0xee 0x00000000000067c8 <+2328>: vshufi64x2 zmm9,zmm15,zmm21,0xe4 0x00000000000067cf <+2335>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x57c27] # 0x5e400 0x00000000000067d9 <+2345>: vpermi2q zmm23,zmm9,zmm2 0x00000000000067df <+2351>: vpermt2q zmm23,zmm4,zmm18 0x00000000000067e5 <+2357>: vinserti64x4 zmm27,zmm1,ymm17,0x1 0x00000000000067ec <+2364>: vshufi64x2 zmm27{k1},zmm2,zmm5,0xee 0x00000000000067f3 <+2371>: kmovq k4,k1 0x00000000000067f8 <+2376>: vshufi64x2 zmm1,zmm5,zmm1,0xe4 0x00000000000067ff <+2383>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x57c37] # 0x5e440 0x0000000000006809 <+2393>: vpermt2q zmm1,zmm9,zmm0 0x000000000000680f <+2399>: vpermt2q zmm11,zmm3,zmm15 0x0000000000006815 <+2405>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57c61] # 0x5e480 0x000000000000681f <+2415>: vpermi2q zmm2,zmm21,zmm17 0x0000000000006825 <+2421>: vshufi64x2 zmm14,zmm2,zmm15,0xe4 0x000000000000682c <+2428>: vpermt2q zmm14,zmm26,zmm18 0x0000000000006832 <+2434>: vpminsq zmm13,zmm24,zmm25 0x0000000000006838 <+2440>: vpmaxsq zmm2,zmm24,zmm25 0x000000000000683e <+2446>: vpblendmq zmm24{k6},zmm2,zmm13 0x0000000000006844 <+2452>: vpmaxsq zmm16,zmm10,zmm14 0x000000000000684a <+2458>: vpminsq zmm12,zmm8,zmm11 0x0000000000006850 <+2464>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x57c66] # 0x5e4c0 0x000000000000685a <+2474>: vpermi2q zmm25,zmm2,zmm16 0x0000000000006860 <+2480>: vmovdqa64 zmm25{k7},zmm12 0x0000000000006866 <+2486>: vpminsq zmm26,zmm0,zmm1 0x000000000000686c <+2492>: vpmaxsq zmm0,zmm0,zmm1 0x0000000000006872 <+2498>: vpmaxsq zmm17,zmm18,zmm27 0x0000000000006878 <+2504>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57c7e] # 0x5e500 0x0000000000006882 <+2514>: vpermi2q zmm1,zmm17,zmm12 0x0000000000006888 <+2520>: vmovdqa64 zmm1{k5},zmm26 0x000000000000688e <+2526>: vpblendmq zmm26{k5},zmm0,zmm26 0x0000000000006894 <+2532>: vpminsq zmm18,zmm18,zmm27 0x000000000000689a <+2538>: vmovdqa64 zmm27,ZMMWORD PTR [rip+0x57d5c] # 0x5e600 0x00000000000068a4 <+2548>: vpermi2q zmm27,zmm0,zmm2 0x00000000000068aa <+2554>: vpminsq zmm0,zmm19,zmm23 0x00000000000068b0 <+2560>: vpminsq zmm2,zmm21,zmm22 0x00000000000068b6 <+2566>: vpmaxsq zmm21,zmm21,zmm22 0x00000000000068bc <+2572>: vpmaxsq zmm22,zmm24,zmm1 0x00000000000068c2 <+2578>: vpminsq zmm22{k5},zmm24,zmm1 0x00000000000068c8 <+2584>: vpblendmq zmm1{k7},zmm2,zmm21 0x00000000000068ce <+2590>: vmovdqa64 zmm28,ZMMWORD PTR [rip+0x57d68] # 0x5e640 0x00000000000068d8 <+2600>: vpermi2q zmm28,zmm2,zmm0 0x00000000000068de <+2606>: vpmaxsq zmm24,zmm1,zmm28 0x00000000000068e4 <+2612>: vpminsq zmm24{k2},zmm1,zmm28 0x00000000000068ea <+2618>: vpblendmq zmm1{k7},zmm17,zmm18 0x00000000000068f0 <+2624>: vpminsq zmm29,zmm15,zmm20 0x00000000000068f6 <+2630>: vpmaxsq zmm5,zmm19,zmm23 0x00000000000068fc <+2636>: vmovdqa64 zmm28,ZMMWORD PTR [rip+0x57c3a] # 0x5e540 0x0000000000006906 <+2646>: vpermi2q zmm28,zmm0,zmm12 0x000000000000690c <+2652>: vpblendmq zmm19{k3},zmm0,zmm5 0x0000000000006912 <+2658>: vmovdqa64 zmm28{k5},zmm16 0x0000000000006918 <+2664>: vpmaxsq zmm3,zmm15,zmm20 0x000000000000691e <+2670>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x57c58] # 0x5e580 0x0000000000006928 <+2680>: vpermi2q zmm15,zmm29,zmm21 0x000000000000692e <+2686>: vpermt2q zmm15,zmm6,zmm16 0x0000000000006934 <+2692>: vpmaxsq zmm23,zmm26,zmm27 0x000000000000693a <+2698>: vpminsq zmm23{k6},zmm26,zmm27 0x0000000000006940 <+2704>: vpminsq zmm2,zmm19,zmm15 0x0000000000006946 <+2710>: vmovdqa64 zmm30,zmm2 0x000000000000694c <+2716>: vpmaxsq zmm30{k7},zmm19,zmm15 0x0000000000006952 <+2722>: vpblendmq zmm15{k5},zmm29,zmm3 0x0000000000006958 <+2728>: vpminsq zmm19,zmm1,zmm25 0x000000000000695e <+2734>: vpmaxsq zmm31,zmm1,zmm25 0x0000000000006964 <+2740>: vpminsq zmm4,zmm15,zmm28 0x000000000000696a <+2746>: vpmaxsq zmm21,zmm15,zmm28 0x0000000000006970 <+2752>: kmovw k1,WORD PTR [rsp+0x100] 0x0000000000006979 <+2761>: vmovdqa64 zmm21{k1},zmm4 0x000000000000697f <+2767>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x57e77] # 0x5e800 0x0000000000006989 <+2777>: vpermi2q zmm20,zmm24,zmm21 0x000000000000698f <+2783>: vpblendmq zmm25{k1},zmm31,zmm19 0x0000000000006995 <+2789>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x57ea1] # 0x5e840 0x000000000000699f <+2799>: vpermi2q zmm15,zmm25,zmm23 0x00000000000069a5 <+2805>: vpminsq zmm26,zmm22,zmm15 0x00000000000069ab <+2811>: vpmaxsq zmm15,zmm22,zmm15 0x00000000000069b1 <+2817>: vmovdqa64 zmm15{k2},zmm26 0x00000000000069b7 <+2823>: vpminsq zmm27,zmm30,zmm20 0x00000000000069bd <+2829>: vpmaxsq zmm28,zmm30,zmm20 0x00000000000069c3 <+2835>: vpblendmq zmm0{k2},zmm28,zmm27 0x00000000000069c9 <+2841>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57bed] # 0x5e5c0 0x00000000000069d3 <+2851>: vmovdqa64 zmm20,zmm1 0x00000000000069d9 <+2857>: vpermi2q zmm20,zmm5,zmm3 0x00000000000069df <+2863>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57d97] # 0x5e780 0x00000000000069e9 <+2873>: vpermi2q zmm3,zmm24,zmm2 0x00000000000069ef <+2879>: vpminsq zmm2,zmm10,zmm14 0x00000000000069f5 <+2885>: vpmaxsq zmm5,zmm8,zmm11 0x00000000000069fb <+2891>: vpblendmq zmm8{k7},zmm16,zmm2 0x0000000000006a01 <+2897>: vshufi64x2 zmm2,zmm2,zmm18,0xee 0x0000000000006a08 <+2904>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x578ee] # 0x5e300 0x0000000000006a12 <+2914>: vpermt2q zmm2,zmm10,zmm13 0x0000000000006a18 <+2920>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x5791e] # 0x5e340 0x0000000000006a22 <+2930>: vpermt2q zmm2,zmm10,zmm29 0x0000000000006a28 <+2936>: vmovdqa64 zmm12{k5},zmm5 0x0000000000006a2e <+2942>: vinserti64x4 zmm5,zmm20,ymm5,0x1 0x0000000000006a35 <+2949>: vpermt2q zmm5,zmm6,zmm17 0x0000000000006a3b <+2955>: vpmaxsq zmm13,zmm8,zmm5 0x0000000000006a41 <+2961>: vpminsq zmm14,zmm12,zmm2 0x0000000000006a47 <+2967>: vpmaxsq zmm14{k6},zmm12,zmm2 0x0000000000006a4d <+2973>: vbroadcasti64x4 zmm2,YMMWORD PTR [rip+0x59769] # 0x601c0 0x0000000000006a57 <+2983>: vpermi2q zmm2,zmm4,zmm14 0x0000000000006a5d <+2989>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57c59] # 0x5e6c0 0x0000000000006a67 <+2999>: vpermi2q zmm4,zmm22,zmm2 0x0000000000006a6d <+3005>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57c89] # 0x5e700 0x0000000000006a77 <+3015>: vpermi2q zmm2,zmm30,zmm13 0x0000000000006a7d <+3021>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x577b9] # 0x5e240 0x0000000000006a87 <+3031>: vpermt2q zmm2,zmm20,zmm31 0x0000000000006a8d <+3037>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x57ca9] # 0x5e740 0x0000000000006a97 <+3047>: vpermi2q zmm10,zmm22,zmm23 0x0000000000006a9d <+3053>: vpminsq zmm16,zmm25,zmm4 0x0000000000006aa3 <+3059>: vpminsq zmm11,zmm24,zmm3 0x0000000000006aa9 <+3065>: vpmaxsq zmm17,zmm21,zmm2 0x0000000000006aaf <+3071>: vpmaxsq zmm3,zmm24,zmm3 0x0000000000006ab5 <+3077>: vshufi64x2 zmm3,zmm3,zmm11,0xe4 0x0000000000006abc <+3084>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x57dfa] # 0x5e8c0 0x0000000000006ac6 <+3094>: vpermi2q zmm11,zmm0,zmm3 0x0000000000006acc <+3100>: vmovdqa64 zmm11{k3},zmm17 0x0000000000006ad2 <+3106>: vpmaxsq zmm12,zmm23,zmm10 0x0000000000006ad8 <+3112>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x57e5e] # 0x5e940 0x0000000000006ae2 <+3122>: vpermi2q zmm18,zmm15,zmm16 0x0000000000006ae8 <+3128>: vpermt2q zmm18,zmm6,zmm12 0x0000000000006aee <+3134>: vpmaxsq zmm10,zmm0,zmm11 0x0000000000006af4 <+3140>: vpminsq zmm10{k1},zmm0,zmm11 0x0000000000006afa <+3146>: vpmaxsq zmm11,zmm15,zmm18 0x0000000000006b00 <+3152>: vpminsq zmm11{k1},zmm15,zmm18 0x0000000000006b06 <+3158>: vpminsq zmm13{k3},zmm8,zmm5 0x0000000000006b0c <+3164>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57b6a] # 0x5e680 0x0000000000006b16 <+3174>: vpermi2q zmm0,zmm14,zmm21 0x0000000000006b1c <+3180>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57c9a] # 0x5e7c0 0x0000000000006b26 <+3190>: vpermi2q zmm5,zmm13,zmm19 0x0000000000006b2c <+3196>: vpminsq zmm2,zmm21,zmm2 0x0000000000006b32 <+3202>: vpmaxsq zmm4,zmm25,zmm4 0x0000000000006b38 <+3208>: vshufi64x2 zmm16,zmm16,zmm4,0xe4 0x0000000000006b3f <+3215>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x57d37] # 0x5e880 0x0000000000006b49 <+3225>: vpermi2q zmm18,zmm16,zmm2 0x0000000000006b4f <+3231>: vmovdqa64 zmm18{k6},zmm26 0x0000000000006b55 <+3237>: vpminsq zmm5,zmm14,zmm5 0x0000000000006b5b <+3243>: vpmaxsq zmm0,zmm13,zmm0 0x0000000000006b61 <+3249>: vshufi64x2 zmm2,zmm2,zmm17,0xe4 0x0000000000006b68 <+3256>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x57d8e] # 0x5e900 0x0000000000006b72 <+3266>: vpermi2q zmm13,zmm5,zmm0 0x0000000000006b78 <+3272>: vpermi2q zmm7,zmm2,zmm28 0x0000000000006b7e <+3278>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x577b8] # 0x5e340 0x0000000000006b88 <+3288>: vpermt2q zmm7,zmm17,zmm4 0x0000000000006b8e <+3294>: vpermi2q zmm9,zmm5,zmm0 0x0000000000006b94 <+3300>: vpermi2q zmm6,zmm3,zmm27 0x0000000000006b9a <+3306>: vpmaxsq zmm8,zmm3,zmm6 0x0000000000006ba0 <+3312>: vpminsq zmm8{k3},zmm3,zmm6 0x0000000000006ba6 <+3318>: vpmaxsq zmm3,zmm0,zmm9 0x0000000000006bac <+3324>: vmovdqa64 zmm14,zmm3 0x0000000000006bb2 <+3330>: vpminsq zmm14{k5},zmm0,zmm9 0x0000000000006bb8 <+3336>: vpminsq zmm0,zmm16,zmm18 0x0000000000006bbe <+3342>: vpminsq zmm4,zmm2,zmm7 0x0000000000006bc4 <+3348>: vpminsq zmm6,zmm5,zmm13 0x0000000000006bca <+3354>: vpmaxsq zmm6{k7},zmm5,zmm13 0x0000000000006bd0 <+3360>: vpmaxsq zmm5,zmm16,zmm18 0x0000000000006bd6 <+3366>: vshufi64x2 zmm0,zmm0,zmm5,0xe4 0x0000000000006bdd <+3373>: vpmaxsq zmm2,zmm2,zmm7 0x0000000000006be3 <+3379>: vshufi64x2 zmm2,zmm4,zmm2,0xe4 0x0000000000006bea <+3386>: vpermt2q zmm3,zmm1,zmm0 0x0000000000006bf0 <+3392>: vpermi2q zmm1,zmm2,zmm6 0x0000000000006bf6 <+3398>: vpminsq zmm5,zmm2,zmm1 0x0000000000006bfc <+3404>: vpminsq zmm4,zmm14,zmm3 0x0000000000006c02 <+3410>: vmovdqa64 zmm19,zmm4 0x0000000000006c08 <+3416>: vpmaxsq zmm19{k3},zmm14,zmm3 0x0000000000006c0e <+3422>: vmovdqa64 zmm21,zmm5 0x0000000000006c14 <+3428>: vpmaxsq zmm21{k3},zmm2,zmm1 0x0000000000006c1a <+3434>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57d9c] # 0x5e9c0 0x0000000000006c24 <+3444>: vmovdqa64 zmm3,zmm21 0x0000000000006c2a <+3450>: vpermt2q zmm3,zmm1,zmm4 0x0000000000006c30 <+3456>: vmovdqa64 zmm4,zmm12 0x0000000000006c36 <+3462>: vpermt2q zmm4,zmm17,zmm15 0x0000000000006c3c <+3468>: vpmaxsq zmm4,zmm12,zmm4 0x0000000000006c42 <+3474>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x574f4] # 0x5e140 0x0000000000006c4c <+3484>: vpermt2q zmm14,zmm9,zmm0 0x0000000000006c52 <+3490>: vpermi2q zmm9,zmm2,zmm6 0x0000000000006c58 <+3496>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57d1e] # 0x5e980 0x0000000000006c62 <+3506>: vpxor xmm7,xmm7,xmm7 0x0000000000006c66 <+3510>: vpermq zmm7,zmm2,zmm11 0x0000000000006c6c <+3516>: vpmaxsq zmm12,zmm6,zmm9 0x0000000000006c72 <+3522>: vmovdqa64 zmm15,zmm9 0x0000000000006c78 <+3528>: vpmaxsq zmm9,zmm0,zmm14 0x0000000000006c7e <+3534>: vpmaxsq zmm22,zmm11,zmm7 0x0000000000006c84 <+3540>: vpermi2q zmm1,zmm19,zmm22 0x0000000000006c8a <+3546>: vpminsq zmm22{k6},zmm11,zmm7 0x0000000000006c90 <+3552>: vmovdqa64 zmm11,zmm20 0x0000000000006c96 <+3558>: vpermi2q zmm11,zmm22,zmm9 0x0000000000006c9c <+3564>: vmovdqa64 zmm23,zmm9 0x0000000000006ca2 <+3570>: vpminsq zmm23{k6},zmm0,zmm14 0x0000000000006ca8 <+3576>: vpminsq zmm9,zmm23,zmm1 0x0000000000006cae <+3582>: vpmaxsq zmm13,zmm23,zmm1 0x0000000000006cb4 <+3588>: vmovdqa64 zmm16,ZMMWORD PTR [rip+0x577c2] # 0x5e480 0x0000000000006cbe <+3598>: vpermt2q zmm23,zmm16,zmm12 0x0000000000006cc4 <+3604>: vpminsq zmm12{k6},zmm6,zmm15 0x0000000000006cca <+3610>: vpblendmq zmm6{k7},zmm13,zmm9 0x0000000000006cd0 <+3616>: vpminsq zmm17,zmm12,zmm3 0x0000000000006cd6 <+3622>: vpmaxsq zmm14,zmm12,zmm3 0x0000000000006cdc <+3628>: vpblendmq zmm7{k7},zmm14,zmm17 0x0000000000006ce2 <+3634>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57d14] # 0x5ea00 0x0000000000006cec <+3644>: vpermi2q zmm3,zmm7,zmm6 0x0000000000006cf2 <+3650>: vmovdqa64 zmm3{k4},zmm4 0x0000000000006cf8 <+3656>: vpxor xmm0,xmm0,xmm0 0x0000000000006cfc <+3660>: vpermq zmm0,zmm2,zmm10 0x0000000000006d02 <+3666>: vpmaxsq zmm1,zmm10,zmm0 0x0000000000006d08 <+3672>: vpermt2q zmm12,zmm16,zmm1 0x0000000000006d0e <+3678>: vpminsq zmm1{k6},zmm10,zmm0 0x0000000000006d14 <+3684>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x574a2] # 0x5e1c0 0x0000000000006d1e <+3694>: vpermi2q zmm0,zmm1,zmm5 0x0000000000006d24 <+3700>: vpmaxsq zmm15,zmm1,zmm0 0x0000000000006d2a <+3706>: vmovdqa64 zmm20,zmm15 0x0000000000006d30 <+3712>: vpminsq zmm20{k7},zmm1,zmm0 0x0000000000006d36 <+3718>: vpminsq zmm16,zmm19,zmm23 0x0000000000006d3c <+3724>: vpminsq zmm18,zmm21,zmm12 0x0000000000006d42 <+3730>: vpmaxsq zmm5,zmm22,zmm11 0x0000000000006d48 <+3736>: vbroadcasti32x4 zmm0,XMMWORD PTR [rip+0x5948e] # 0x601e0 0x0000000000006d52 <+3746>: vpermi2q zmm0,zmm18,zmm16 0x0000000000006d58 <+3752>: vshufi64x2 zmm10,zmm13,zmm0,0xee 0x0000000000006d5f <+3759>: vmovdqa64 zmm10{k4},zmm5 0x0000000000006d65 <+3765>: vpmaxsq zmm21,zmm21,zmm12 0x0000000000006d6b <+3771>: vpblendmq zmm11{k5},zmm18,zmm21 0x0000000000006d71 <+3777>: vpmaxsq zmm19,zmm19,zmm23 0x0000000000006d77 <+3783>: vpblendmq zmm1{k5},zmm16,zmm19 0x0000000000006d7d <+3789>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57cb9] # 0x5ea40 0x0000000000006d87 <+3799>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x5756f] # 0x5e300 0x0000000000006d91 <+3809>: vpermi2q zmm12,zmm20,zmm11 0x0000000000006d97 <+3815>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x57e1f] # 0x5ebc0 0x0000000000006da1 <+3825>: vpermi2q zmm2,zmm12,zmm14 0x0000000000006da7 <+3831>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x57e4f] # 0x5ec00 0x0000000000006db1 <+3841>: vpermi2q zmm22,zmm2,zmm13 0x0000000000006db7 <+3847>: vpminsq zmm12,zmm20,zmm22 0x0000000000006dbd <+3853>: vpmaxsq zmm2,zmm20,zmm22 0x0000000000006dc3 <+3859>: vpermt2q zmm20,zmm0,zmm8 0x0000000000006dc9 <+3865>: mov al,0x68 0x0000000000006dcb <+3867>: kmovd k1,eax 0x0000000000006dcf <+3871>: vshufi64x2 zmm20{k1},zmm21,zmm14,0x44 0x0000000000006dd6 <+3878>: mov al,0x80 0x0000000000006dd8 <+3880>: kmovd k1,eax 0x0000000000006ddc <+3884>: vpermq zmm20{k1},zmm5,0x55 0x0000000000006de3 <+3891>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x57c93] # 0x5ea80 0x0000000000006ded <+3901>: vpermi2q zmm21,zmm4,zmm1 0x0000000000006df3 <+3907>: vpermi2q zmm0,zmm18,zmm15 0x0000000000006df9 <+3913>: vshufi64x2 zmm18,zmm0,zmm17,0xe4 0x0000000000006e00 <+3920>: mov al,0xe8 0x0000000000006e02 <+3922>: kmovd k1,eax 0x0000000000006e06 <+3926>: vmovdqa64 zmm18{k1},zmm21 0x0000000000006e0c <+3932>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x57caa] # 0x5eac0 0x0000000000006e16 <+3942>: vpermi2q zmm21,zmm8,zmm11 0x0000000000006e1c <+3948>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57cda] # 0x5eb00 0x0000000000006e26 <+3958>: vpermt2q zmm21,zmm0,zmm1 0x0000000000006e2c <+3964>: vshufi64x2 zmm13,zmm19,zmm13,0x44 0x0000000000006e33 <+3971>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x57d03] # 0x5eb40 0x0000000000006e3d <+3981>: vpermi2q zmm17,zmm13,zmm5 0x0000000000006e43 <+3987>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x57d33] # 0x5eb80 0x0000000000006e4d <+3997>: vpermi2q zmm13,zmm14,zmm8 0x0000000000006e53 <+4003>: vmovdqa64 zmm13{k1},zmm17 0x0000000000006e59 <+4009>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x57ddd] # 0x5ec40 0x0000000000006e63 <+4019>: vpermi2q zmm19,zmm4,zmm5 0x0000000000006e69 <+4025>: mov al,0x16 0x0000000000006e6b <+4027>: kmovd k2,eax 0x0000000000006e6f <+4031>: vshufi64x2 zmm19{k2},zmm16,zmm9,0xee 0x0000000000006e76 <+4038>: vextracti128 xmm9,ymm15,0x1 0x0000000000006e7c <+4044>: mov al,0x1 0x0000000000006e7e <+4046>: kmovd k2,eax 0x0000000000006e82 <+4050>: vinserti64x2 zmm19{k2},zmm0,xmm9,0x0 0x0000000000006e89 <+4057>: vpmaxsq zmm9,zmm8,zmm21 0x0000000000006e8f <+4063>: vpminsq zmm16,zmm11,zmm20 0x0000000000006e95 <+4069>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x57ee1] # 0x5ed80 0x0000000000006e9f <+4079>: vpermi2q zmm17,zmm9,zmm16 0x0000000000006ea5 <+4085>: kmovw k7,WORD PTR [rsp+0x140] 0x0000000000006eae <+4094>: vpminsq zmm9{k7},zmm8,zmm21 0x0000000000006eb4 <+4100>: vpminsq zmm21,zmm7,zmm18 0x0000000000006eba <+4106>: vpmaxsq zmm15,zmm7,zmm18 0x0000000000006ec0 <+4112>: vpblendmq zmm14{k1},zmm15,zmm21 0x0000000000006ec6 <+4118>: vpmaxsq zmm11,zmm11,zmm20 0x0000000000006ecc <+4124>: mov al,0xe0 0x0000000000006ece <+4126>: kmovd k2,eax 0x0000000000006ed2 <+4130>: vmovdqa64 zmm11{k2},zmm16 0x0000000000006ed8 <+4136>: vpmaxsq zmm16,zmm6,zmm19 0x0000000000006ede <+4142>: vpminsq zmm16{k1},zmm6,zmm19 0x0000000000006ee4 <+4148>: vpblendmq zmm8{k7},zmm2,zmm12 0x0000000000006eea <+4154>: vpmaxsq zmm6,zmm1,zmm13 0x0000000000006ef0 <+4160>: vpmaxsq zmm5,zmm5,zmm10 0x0000000000006ef6 <+4166>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x580c0] # 0x5efc0 0x0000000000006f00 <+4176>: vpermi2q zmm20,zmm5,zmm6 0x0000000000006f06 <+4182>: vmovdqa64 zmm10,zmm6 0x0000000000006f0c <+4188>: vpminsq zmm10{k2},zmm1,zmm13 0x0000000000006f12 <+4194>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57d64] # 0x5ec80 0x0000000000006f1c <+4204>: vpermi2q zmm7,zmm11,zmm10 0x0000000000006f22 <+4210>: mov al,0x40 0x0000000000006f24 <+4212>: kmovd k1,eax 0x0000000000006f28 <+4216>: vmovdqa64 zmm7{k1},zmm5 0x0000000000006f2e <+4222>: vpmaxsq zmm19,zmm4,zmm3 0x0000000000006f34 <+4228>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x57d82] # 0x5ecc0 0x0000000000006f3e <+4238>: vpermi2q zmm6,zmm8,zmm21 0x0000000000006f44 <+4244>: mov al,0xc9 0x0000000000006f46 <+4246>: kmovd k2,eax 0x0000000000006f4a <+4250>: vmovdqa64 zmm6{k2},zmm16 0x0000000000006f50 <+4256>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57da6] # 0x5ed00 0x0000000000006f5a <+4266>: vpermi2q zmm1,zmm19,zmm16 0x0000000000006f60 <+4272>: vmovdqa64 zmm21,ZMMWORD PTR [rip+0x57dd6] # 0x5ed40 0x0000000000006f6a <+4282>: vpermi2q zmm21,zmm14,zmm8 0x0000000000006f70 <+4288>: mov al,0x4c 0x0000000000006f72 <+4290>: kmovd k2,eax 0x0000000000006f76 <+4294>: vmovdqa64 zmm21{k2},zmm1 0x0000000000006f7c <+4300>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x57e3a] # 0x5edc0 0x0000000000006f86 <+4310>: vpermi2q zmm13,zmm10,zmm5 0x0000000000006f8c <+4316>: mov al,0x32 0x0000000000006f8e <+4318>: kmovd k3,eax 0x0000000000006f92 <+4322>: vmovdqa64 zmm13{k3},zmm17 0x0000000000006f98 <+4328>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57e5e] # 0x5ee00 0x0000000000006fa2 <+4338>: vpermi2q zmm1,zmm14,zmm5 0x0000000000006fa8 <+4344>: vmovdqa64 zmm22,ZMMWORD PTR [rip+0x57e8e] # 0x5ee40 0x0000000000006fb2 <+4354>: vpermi2q zmm22,zmm1,zmm19 0x0000000000006fb8 <+4360>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57ebe] # 0x5ee80 0x0000000000006fc2 <+4370>: vpermi2q zmm1,zmm9,zmm12 0x0000000000006fc8 <+4376>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x57eee] # 0x5eec0 0x0000000000006fd2 <+4386>: vpermi2q zmm18,zmm1,zmm15 0x0000000000006fd8 <+4392>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57f1e] # 0x5ef00 0x0000000000006fe2 <+4402>: vpermt2q zmm18,zmm4,zmm16 0x0000000000006fe8 <+4408>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57f4e] # 0x5ef40 0x0000000000006ff2 <+4418>: vpermi2q zmm3,zmm9,zmm2 0x0000000000006ff8 <+4424>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x57f7e] # 0x5ef80 0x0000000000007002 <+4434>: vpermt2q zmm3,zmm1,zmm10 0x0000000000007008 <+4440>: mov al,0x6c 0x000000000000700a <+4442>: kmovd k3,eax 0x000000000000700e <+4446>: vpblendmq zmm2{k3},zmm11,zmm20 0x0000000000007014 <+4452>: vpermt2q zmm7,zmm1,zmm19 0x000000000000701a <+4458>: vpmaxsq zmm15,zmm14,zmm21 0x0000000000007020 <+4464>: vmovdqa64 zmm12,zmm15 0x0000000000007026 <+4470>: vpminsq zmm12{k2},zmm14,zmm21 0x000000000000702c <+4476>: vpmaxsq zmm14,zmm16,zmm6 0x0000000000007032 <+4482>: mov al,0x88 0x0000000000007034 <+4484>: vpminsq zmm6,zmm11,zmm2 0x000000000000703a <+4490>: vpminsq zmm20,zmm9,zmm3 0x0000000000007040 <+4496>: vpmaxsq zmm21,zmm8,zmm18 0x0000000000007046 <+4502>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x57ff0] # 0x5f040 0x0000000000007050 <+4512>: vpermi2q zmm23,zmm21,zmm20 0x0000000000007056 <+4518>: mov cl,0x20 0x0000000000007058 <+4520>: kmovd k4,ecx 0x000000000000705c <+4524>: vmovdqa64 zmm23{k4},zmm6 0x0000000000007062 <+4530>: kmovd k5,eax 0x0000000000007066 <+4534>: vpmaxsq zmm17,zmm11,zmm2 0x000000000000706c <+4540>: vmovdqa64 zmm17{k3},zmm6 0x0000000000007072 <+4546>: vpmaxsq zmm6,zmm5,zmm7 0x0000000000007078 <+4552>: vpmaxsq zmm16,zmm19,zmm22 0x000000000000707e <+4558>: mov al,0x8 0x0000000000007080 <+4560>: kmovd k3,eax 0x0000000000007084 <+4564>: vmovdqa64 zmm2,zmm16 0x000000000000708a <+4570>: vpminsq zmm2{k3},zmm19,zmm22 0x0000000000007090 <+4576>: vpmaxsq zmm22,zmm10,zmm13 0x0000000000007096 <+4582>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x58020] # 0x5f0c0 0x00000000000070a0 <+4592>: vpermi2q zmm25,zmm23,zmm22 0x00000000000070a6 <+4598>: vpminsq zmm22{k5},zmm10,zmm13 0x00000000000070ac <+4604>: vpminsq zmm8,zmm8,zmm18 0x00000000000070b2 <+4610>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x57fc4] # 0x5f080 0x00000000000070bc <+4620>: vpermi2q zmm11,zmm22,zmm14 0x00000000000070c2 <+4626>: mov al,0x64 0x00000000000070c4 <+4628>: kmovd k3,eax 0x00000000000070c8 <+4632>: vmovdqa64 zmm11{k3},zmm6 0x00000000000070ce <+4638>: mov al,0x31 0x00000000000070d0 <+4640>: mov cl,0x13 0x00000000000070d2 <+4642>: kmovd k3,ecx 0x00000000000070d6 <+4646>: vpblendmq zmm24{k3},zmm8,zmm21 0x00000000000070dc <+4652>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x5811a] # 0x5f200 0x00000000000070e6 <+4662>: vpermi2q zmm10,zmm8,zmm12 0x00000000000070ec <+4668>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x5814a] # 0x5f240 0x00000000000070f6 <+4678>: vpermi2q zmm13,zmm10,zmm14 0x00000000000070fc <+4684>: vpminsq zmm8,zmm12,zmm13 0x0000000000007102 <+4690>: vpmaxsq zmm21,zmm12,zmm13 0x0000000000007108 <+4696>: mov cl,0xc4 0x000000000000710a <+4698>: kmovd k3,ecx 0x000000000000710e <+4702>: vpblendmq zmm10{k3},zmm21,zmm8 0x0000000000007114 <+4708>: vpmaxsq zmm19,zmm17,zmm25 0x000000000000711a <+4714>: mov cl,0x8c 0x000000000000711c <+4716>: kmovd k3,ecx 0x0000000000007120 <+4720>: vmovdqa64 zmm18,zmm19 0x0000000000007126 <+4726>: vpminsq zmm18{k3},zmm17,zmm25 0x000000000000712c <+4732>: kmovd k3,eax 0x0000000000007130 <+4736>: vpmaxsq zmm20{k3},zmm9,zmm3 0x0000000000007136 <+4742>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x57fc0] # 0x5f100 0x0000000000007140 <+4752>: vpermi2q zmm9,zmm20,zmm17 0x0000000000007146 <+4758>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58030] # 0x5f180 0x0000000000007150 <+4768>: vpermi2q zmm3,zmm17,zmm22 0x0000000000007156 <+4774>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x58060] # 0x5f1c0 0x0000000000007160 <+4784>: vpermi2q zmm25,zmm3,zmm6 0x0000000000007166 <+4790>: vpmaxsq zmm13,zmm22,zmm25 0x000000000000716c <+4796>: vpmaxsq zmm3,zmm20,zmm9 0x0000000000007172 <+4802>: mov al,0xac 0x0000000000007174 <+4804>: kmovd k4,eax 0x0000000000007178 <+4808>: vpminsq zmm3{k4},zmm20,zmm9 0x000000000000717e <+4814>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58178] # 0x5f300 0x0000000000007188 <+4824>: vpermi2q zmm9,zmm18,zmm3 0x000000000000718e <+4830>: vmovdqa64 zmm23,ZMMWORD PTR [rip+0x581a8] # 0x5f340 0x0000000000007198 <+4840>: vpermi2q zmm23,zmm9,zmm10 0x000000000000719e <+4846>: vpbroadcastq zmm9,QWORD PTR [rip+0x59058] # 0x60200 0x00000000000071a8 <+4856>: vpermq zmm23{k1},zmm9,zmm13 0x00000000000071ae <+4862>: mov al,0x11 0x00000000000071b0 <+4864>: vmovdqa64 zmm20,zmm13 0x00000000000071b6 <+4870>: vpminsq zmm20{k2},zmm22,zmm25 0x00000000000071bc <+4876>: kmovd k1,eax 0x00000000000071c0 <+4880>: vpblendmq zmm9{k1},zmm24,zmm17 0x00000000000071c6 <+4886>: vpermt2q zmm9,zmm4,zmm15 0x00000000000071cc <+4892>: vpminsq zmm15,zmm24,zmm9 0x00000000000071d2 <+4898>: mov al,0x26 0x00000000000071d4 <+4900>: vmovdqa64 zmm4,zmm15 0x00000000000071da <+4906>: kmovd k2,eax 0x00000000000071de <+4910>: vpmaxsq zmm4{k2},zmm24,zmm9 0x00000000000071e4 <+4916>: vpminsq zmm17,zmm5,zmm7 0x00000000000071ea <+4922>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x57e0c] # 0x5f000 0x00000000000071f4 <+4932>: vpermi2q zmm5,zmm12,zmm14 0x00000000000071fa <+4938>: vmovdqa64 zmm5{k5},zmm17 0x0000000000007200 <+4944>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x57f36] # 0x5f140 0x000000000000720a <+4954>: vpermi2q zmm7,zmm5,zmm16 0x0000000000007210 <+4960>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x58066] # 0x5f280 0x000000000000721a <+4970>: vpermi2q zmm12,zmm2,zmm14 0x0000000000007220 <+4976>: vpminsq zmm22,zmm14,zmm7 0x0000000000007226 <+4982>: vpmaxsq zmm5,zmm14,zmm7 0x000000000000722c <+4988>: mov al,0xca 0x000000000000722e <+4990>: kmovd k6,eax 0x0000000000007232 <+4994>: vpblendmq zmm16{k6},zmm5,zmm22 0x0000000000007238 <+5000>: vpmaxsq zmm14,zmm2,zmm12 0x000000000000723e <+5006>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x58238] # 0x5f480 0x0000000000007248 <+5016>: vpermi2q zmm7,zmm20,zmm16 0x000000000000724e <+5022>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58268] # 0x5f4c0 0x0000000000007258 <+5032>: vpermi2q zmm9,zmm7,zmm14 0x000000000000725e <+5038>: vextracti32x4 xmm7,ymm21,0x1 0x0000000000007265 <+5045>: mov al,0x2 0x0000000000007267 <+5047>: kmovd k2,eax 0x000000000000726b <+5051>: vinserti64x2 zmm9{k2},zmm0,xmm7,0x0 0x0000000000007272 <+5058>: vpminsq zmm7,zmm16,zmm9 0x0000000000007278 <+5064>: vpmaxsq zmm9,zmm16,zmm9 0x000000000000727e <+5070>: mov al,0x24 0x0000000000007280 <+5072>: kmovd k2,eax 0x0000000000007284 <+5076>: vpblendmq zmm26{k2},zmm9,zmm7 0x000000000000728a <+5082>: vmovdqa64 zmm28,ZMMWORD PTR [rip+0x581ac] # 0x5f440 0x0000000000007294 <+5092>: vpermt2q zmm15,zmm28,zmm19 0x000000000000729a <+5098>: vpblendmq zmm6{k5},zmm6,zmm17 0x00000000000072a0 <+5104>: vpmaxsq zmm29,zmm6,zmm11 0x00000000000072a6 <+5110>: vmovdqa64 zmm6,ZMMWORD PTR [rip+0x58110] # 0x5f3c0 0x00000000000072b0 <+5120>: vpermi2q zmm6,zmm16,zmm20 0x00000000000072b6 <+5126>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x58140] # 0x5f400 0x00000000000072c0 <+5136>: vpermi2q zmm11,zmm6,zmm29 0x00000000000072c6 <+5142>: vmovdqa64 zmm11{k1},zmm15 0x00000000000072cc <+5148>: vpminsq zmm16,zmm20,zmm11 0x00000000000072d2 <+5154>: vpmaxsq zmm6,zmm20,zmm11 0x00000000000072d8 <+5160>: vpblendmq zmm11{k7},zmm6,zmm16 0x00000000000072de <+5166>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x58258] # 0x5f540 0x00000000000072e8 <+5176>: vpermi2q zmm19,zmm4,zmm8 0x00000000000072ee <+5182>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x58288] # 0x5f580 0x00000000000072f8 <+5192>: vpermt2q zmm19,zmm17,zmm13 0x00000000000072fe <+5198>: vmovdqa64 zmm30,ZMMWORD PTR [rip+0x57fb8] # 0x5f2c0 0x0000000000007308 <+5208>: vpermi2q zmm30,zmm18,zmm4 0x000000000000730e <+5214>: vmovdqa64 zmm30{k1},zmm10 0x0000000000007314 <+5220>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x58062] # 0x5f380 0x000000000000731e <+5230>: vpermi2q zmm15,zmm22,zmm29 0x0000000000007324 <+5236>: vmovdqa64 zmm30{k5},zmm15 0x000000000000732a <+5242>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x581cc] # 0x5f500 0x0000000000007334 <+5252>: vpermi2q zmm20,zmm3,zmm18 0x000000000000733a <+5258>: vpmaxsq zmm22,zmm10,zmm30 0x0000000000007340 <+5264>: vpminsq zmm21,zmm18,zmm23 0x0000000000007346 <+5270>: vpmaxsq zmm18,zmm18,zmm23 0x000000000000734c <+5276>: vpblendmq zmm15{k6},zmm18,zmm21 0x0000000000007352 <+5282>: vpminsq zmm24,zmm4,zmm19 0x0000000000007358 <+5288>: vpminsq zmm23,zmm3,zmm20 0x000000000000735e <+5294>: vmovdqa64 zmm25,ZMMWORD PTR [rip+0x58458] # 0x5f7c0 0x0000000000007368 <+5304>: vpermi2q zmm25,zmm15,zmm22 0x000000000000736e <+5310>: vmovdqa64 zmm27,ZMMWORD PTR [rip+0x58488] # 0x5f800 0x0000000000007378 <+5320>: vpermi2q zmm27,zmm23,zmm24 0x000000000000737e <+5326>: vmovdqa64 zmm25{k3},zmm27 0x0000000000007384 <+5332>: vmovdqa64 zmm31,ZMMWORD PTR [rip+0x58232] # 0x5f5c0 0x000000000000738e <+5342>: vpermi2q zmm31,zmm13,zmm8 0x0000000000007394 <+5348>: vmovdqa64 zmm27,zmm22 0x000000000000739a <+5354>: vpminsq zmm27{k5},zmm10,zmm30 0x00000000000073a0 <+5360>: vpblendmq zmm8{k1},zmm29,zmm31 0x00000000000073a6 <+5366>: vpmaxsq zmm13,zmm29,zmm8 0x00000000000073ac <+5372>: vpermi2q zmm28,zmm24,zmm15 0x00000000000073b2 <+5378>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58284] # 0x5f640 0x00000000000073bc <+5388>: vpermi2q zmm8,zmm11,zmm28 0x00000000000073c2 <+5394>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x582b4] # 0x5f680 0x00000000000073cc <+5404>: vpermi2q zmm10,zmm8,zmm9 0x00000000000073d2 <+5410>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58564] # 0x5f940 0x00000000000073dc <+5420>: vpermi2q zmm8,zmm7,zmm6 0x00000000000073e2 <+5426>: vpminsq zmm7,zmm27,zmm10 0x00000000000073e8 <+5432>: vmovdqa64 zmm6,zmm7 0x00000000000073ee <+5438>: vpmaxsq zmm6{k1},zmm27,zmm10 0x00000000000073f4 <+5444>: mov al,0xa 0x00000000000073f6 <+5446>: vpblendmq zmm10{k1},zmm13,zmm8 0x00000000000073fc <+5452>: kmovd k1,eax 0x0000000000007400 <+5456>: kmovw WORD PTR [rsp+0x2e],k1 0x0000000000007406 <+5462>: vpminsq zmm14{k1},zmm2,zmm12 0x000000000000740c <+5468>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x582ea] # 0x5f700 0x0000000000007416 <+5478>: vpermi2q zmm2,zmm22,zmm11 0x000000000000741c <+5484>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x581da] # 0x5f600 0x0000000000007426 <+5494>: vpermi2q zmm8,zmm14,zmm5 0x000000000000742c <+5500>: vpmaxsq zmm5,zmm14,zmm8 0x0000000000007432 <+5506>: vmovdqa64 zmm8,ZMMWORD PTR [rip+0x58304] # 0x5f740 0x000000000000743c <+5516>: vpermi2q zmm8,zmm2,zmm26 0x0000000000007442 <+5522>: vinserti32x4 zmm2,zmm8,xmm13,0x1 0x0000000000007449 <+5529>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x5832d] # 0x5f780 0x0000000000007453 <+5539>: vpermt2q zmm2,zmm12,zmm5 0x0000000000007459 <+5545>: vpmaxsq zmm8,zmm26,zmm2 0x000000000000745f <+5551>: vpminsq zmm8{k4},zmm26,zmm2 0x0000000000007465 <+5557>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x58511] # 0x5f980 0x000000000000746f <+5567>: vpermi2q zmm14,zmm5,zmm9 0x0000000000007475 <+5573>: vpmaxsq zmm2,zmm13,zmm10 0x000000000000747b <+5579>: vpmaxsq zmm5,zmm5,zmm14 0x0000000000007481 <+5585>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x58675] # 0x5fb00 0x000000000000748b <+5595>: vpermi2q zmm14,zmm8,zmm2 0x0000000000007491 <+5601>: vpermt2q zmm14,zmm0,zmm5 0x0000000000007497 <+5607>: vpmaxsq zmm10,zmm2,zmm14 0x000000000000749d <+5613>: vmovdqa64 zmm0,zmm10 0x00000000000074a3 <+5619>: kmovw k1,WORD PTR [rsp+0x180] 0x00000000000074ac <+5628>: vpminsq zmm0{k1},zmm2,zmm14 0x00000000000074b2 <+5634>: vpmaxsq zmm4,zmm4,zmm19 0x00000000000074b8 <+5640>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x581fe] # 0x5f6c0 0x00000000000074c2 <+5650>: vpermi2q zmm14,zmm4,zmm18 0x00000000000074c8 <+5656>: vpermt2q zmm14,zmm17,zmm22 0x00000000000074ce <+5662>: vmovdqa64 zmm17,ZMMWORD PTR [rip+0x58368] # 0x5f840 0x00000000000074d8 <+5672>: vpermi2q zmm17,zmm25,zmm16 0x00000000000074de <+5678>: vpblendmq zmm16{k5},zmm4,zmm24 0x00000000000074e4 <+5684>: vpmaxsq zmm3,zmm3,zmm20 0x00000000000074ea <+5690>: vpblendmq zmm4{k5},zmm3,zmm23 0x00000000000074f0 <+5696>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x58386] # 0x5f880 0x00000000000074fa <+5706>: vpermi2q zmm19,zmm27,zmm21 0x0000000000007500 <+5712>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x583b6] # 0x5f8c0 0x000000000000750a <+5722>: vpermi2q zmm20,zmm19,zmm9 0x0000000000007510 <+5728>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x583e6] # 0x5f900 0x000000000000751a <+5738>: vpermi2q zmm19,zmm20,zmm13 0x0000000000007520 <+5744>: vpermt2q zmm3,zmm12,zmm18 0x0000000000007526 <+5750>: vpminsq zmm12,zmm4,zmm3 0x000000000000752c <+5756>: vpmaxsq zmm13,zmm4,zmm3 0x0000000000007532 <+5762>: vpblendmq zmm18{k5},zmm13,zmm12 0x0000000000007538 <+5768>: vpmaxsq zmm4,zmm11,zmm19 0x000000000000753e <+5774>: vmovdqa64 zmm9,zmm4 0x0000000000007544 <+5780>: vpminsq zmm9{k5},zmm11,zmm19 0x000000000000754a <+5786>: vpmaxsq zmm3,zmm15,zmm17 0x0000000000007550 <+5792>: vpminsq zmm3{k6},zmm15,zmm17 0x0000000000007556 <+5798>: vpmaxsq zmm11,zmm16,zmm14 0x000000000000755c <+5804>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x584da] # 0x5fa40 0x0000000000007566 <+5814>: vpermi2q zmm15,zmm11,zmm12 0x000000000000756c <+5820>: vpermt2q zmm13,zmm1,zmm11 0x0000000000007572 <+5826>: vpminsq zmm11{k5},zmm16,zmm14 0x0000000000007578 <+5832>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x5843e] # 0x5f9c0 0x0000000000007582 <+5842>: vpermi2q zmm12,zmm11,zmm6 0x0000000000007588 <+5848>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x584ee] # 0x5fa80 0x0000000000007592 <+5858>: vpermi2q zmm1,zmm15,zmm3 0x0000000000007598 <+5864>: vpminsq zmm15,zmm18,zmm13 0x000000000000759e <+5870>: vpmaxsq zmm16,zmm18,zmm13 0x00000000000075a4 <+5876>: vpblendmq zmm17{k5},zmm16,zmm15 0x00000000000075aa <+5882>: vpminsq zmm13,zmm11,zmm1 0x00000000000075b0 <+5888>: vpmaxsq zmm18,zmm11,zmm1 0x00000000000075b6 <+5894>: kmovw k2,WORD PTR [rsp+0x400] 0x00000000000075bf <+5903>: vmovdqa64 zmm18{k2},zmm13 0x00000000000075c5 <+5909>: vpmaxsq zmm14,zmm3,zmm12 0x00000000000075cb <+5915>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x586ab] # 0x5fc80 0x00000000000075d5 <+5925>: vpermi2q zmm1,zmm18,zmm15 0x00000000000075db <+5931>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x586db] # 0x5fcc0 0x00000000000075e5 <+5941>: vpermi2q zmm15,zmm1,zmm14 0x00000000000075eb <+5947>: vmovdqa64 zmm11,ZMMWORD PTR [rip+0x5880b] # 0x5fe00 0x00000000000075f5 <+5957>: vpermi2q zmm11,zmm16,zmm18 0x00000000000075fb <+5963>: vpmaxsq zmm1,zmm17,zmm11 0x0000000000007601 <+5969>: vpminsq zmm1{k5},zmm17,zmm11 0x0000000000007607 <+5975>: vpmaxsq zmm11,zmm18,zmm15 0x000000000000760d <+5981>: kmovw k3,WORD PTR [rsp+0x2a] 0x0000000000007613 <+5987>: vpminsq zmm11{k3},zmm18,zmm15 0x0000000000007619 <+5993>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x5899d] # 0x5ffc0 0x0000000000007623 <+6003>: vpermi2q zmm15,zmm1,zmm11 0x0000000000007629 <+6009>: vpmaxsq zmm21,zmm1,zmm15 0x000000000000762f <+6015>: mov al,0xc8 0x0000000000007631 <+6017>: kmovd k1,eax 0x0000000000007635 <+6021>: vpminsq zmm21{k1},zmm1,zmm15 0x000000000000763b <+6027>: vmovdqa64 zmm15,ZMMWORD PTR [rip+0x583bb] # 0x5fa00 0x0000000000007645 <+6037>: vpermi2q zmm15,zmm7,zmm8 0x000000000000764b <+6043>: vmovdqa64 zmm7,ZMMWORD PTR [rip+0x584eb] # 0x5fb40 0x0000000000007655 <+6053>: vpermi2q zmm7,zmm9,zmm2 0x000000000000765b <+6059>: vpminsq zmm16,zmm8,zmm7 0x0000000000007661 <+6065>: vpmaxsq zmm7,zmm8,zmm7 0x0000000000007667 <+6071>: vpblendmq zmm8{k6},zmm7,zmm16 0x000000000000766d <+6077>: vpminsq zmm17,zmm9,zmm15 0x0000000000007673 <+6083>: vmovdqa64 zmm18,ZMMWORD PTR [rip+0x58543] # 0x5fbc0 0x000000000000767d <+6093>: vmovdqa64 zmm19,zmm8 0x0000000000007683 <+6099>: vpermt2q zmm19,zmm18,zmm17 0x0000000000007689 <+6105>: vmovdqa64 zmm20,ZMMWORD PTR [rip+0x586ed] # 0x5fd80 0x0000000000007693 <+6115>: vpermi2q zmm20,zmm19,zmm10 0x0000000000007699 <+6121>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x5841d] # 0x5fac0 0x00000000000076a3 <+6131>: vpermi2q zmm10,zmm3,zmm4 0x00000000000076a9 <+6137>: vpmaxsq zmm4,zmm9,zmm15 0x00000000000076af <+6143>: vmovdqa64 zmm4{k3},zmm17 0x00000000000076b5 <+6149>: vpminsq zmm14{k4},zmm3,zmm12 0x00000000000076bb <+6155>: vpmaxsq zmm3,zmm6,zmm10 0x00000000000076c1 <+6161>: vmovdqa64 zmm9,ZMMWORD PTR [rip+0x58535] # 0x5fc00 0x00000000000076cb <+6171>: vpermi2q zmm9,zmm14,zmm13 0x00000000000076d1 <+6177>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x58565] # 0x5fc40 0x00000000000076db <+6187>: vpermt2q zmm9,zmm12,zmm3 0x00000000000076e1 <+6193>: vpminsq zmm3{k3},zmm6,zmm10 0x00000000000076e7 <+6199>: vmovdqa64 zmm6,zmm3 0x00000000000076ed <+6205>: vpermt2q zmm6,zmm18,zmm14 0x00000000000076f3 <+6211>: vinserti32x4 zmm6,zmm6,xmm4,0x3 0x00000000000076fa <+6218>: vmovdqa64 zmm10,ZMMWORD PTR [rip+0x586bc] # 0x5fdc0 0x0000000000007704 <+6228>: vmovdqa64 zmm13,zmm4 0x000000000000770a <+6234>: vpermt2q zmm13,zmm10,zmm3 0x0000000000007710 <+6240>: vpermt2q zmm13,zmm12,zmm7 0x0000000000007716 <+6246>: vpmaxsq zmm7,zmm3,zmm6 0x000000000000771c <+6252>: vpminsq zmm7{k6},zmm3,zmm6 0x0000000000007722 <+6258>: vpmaxsq zmm6,zmm4,zmm13 0x0000000000007728 <+6264>: vpminsq zmm6{k4},zmm4,zmm13 0x000000000000772e <+6270>: vpmaxsq zmm4,zmm8,zmm20 0x0000000000007734 <+6276>: vpminsq zmm4{k6},zmm8,zmm20 0x000000000000773a <+6282>: vpmaxsq zmm8,zmm14,zmm9 0x0000000000007740 <+6288>: vpminsq zmm8{k4},zmm14,zmm9 0x0000000000007746 <+6294>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x58730] # 0x5fe80 0x0000000000007750 <+6304>: vpermi2q zmm3,zmm8,zmm11 0x0000000000007756 <+6310>: vinserti32x4 zmm9,zmm3,xmm7,0x3 0x000000000000775d <+6317>: vpermi2q zmm18,zmm6,zmm7 0x0000000000007763 <+6323>: vinserti32x4 zmm13,zmm18,xmm4,0x3 0x000000000000776a <+6330>: vpmaxsq zmm3,zmm8,zmm9 0x0000000000007770 <+6336>: vmovdqa64 zmm15,zmm3 0x0000000000007776 <+6342>: vpminsq zmm15{k6},zmm8,zmm9 0x000000000000777c <+6348>: vpmaxsq zmm9,zmm6,zmm13 0x0000000000007782 <+6354>: vmovdqa64 zmm17,zmm9 0x0000000000007788 <+6360>: vpminsq zmm17{k6},zmm6,zmm13 0x000000000000778e <+6366>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x583e8] # 0x5fb80 0x0000000000007798 <+6376>: vpermi2q zmm13,zmm5,zmm2 0x000000000000779e <+6382>: vpmaxsq zmm2,zmm5,zmm13 0x00000000000077a4 <+6388>: vmovdqa64 zmm5,ZMMWORD PTR [rip+0x58552] # 0x5fd00 0x00000000000077ae <+6398>: vpermi2q zmm5,zmm0,zmm16 0x00000000000077b4 <+6404>: vmovdqa64 zmm13,ZMMWORD PTR [rip+0x58582] # 0x5fd40 0x00000000000077be <+6414>: vpermi2q zmm13,zmm5,zmm2 0x00000000000077c4 <+6420>: vpmaxsq zmm5,zmm0,zmm13 0x00000000000077ca <+6426>: vpminsq zmm5{k3},zmm0,zmm13 0x00000000000077d0 <+6432>: vmovdqa64 zmm13,zmm4 0x00000000000077d6 <+6438>: vpermt2q zmm13,zmm10,zmm6 0x00000000000077dc <+6444>: vmovdqa64 zmm14,ZMMWORD PTR [rip+0x5871a] # 0x5ff00 0x00000000000077e6 <+6454>: vpermi2q zmm14,zmm13,zmm5 0x00000000000077ec <+6460>: vpermi2q zmm10,zmm7,zmm8 0x00000000000077f2 <+6466>: vpermt2q zmm10,zmm12,zmm6 0x00000000000077f8 <+6472>: vpminsq zmm6,zmm7,zmm10 0x00000000000077fe <+6478>: vpmaxsq zmm7,zmm7,zmm10 0x0000000000007804 <+6484>: vpblendmq zmm16{k4},zmm7,zmm6 0x000000000000780a <+6490>: vpmaxsq zmm10,zmm4,zmm14 0x0000000000007810 <+6496>: vmovdqa64 zmm13,zmm10 0x0000000000007816 <+6502>: vpminsq zmm13{k4},zmm4,zmm14 0x000000000000781c <+6508>: vmovdqa64 zmm12,ZMMWORD PTR [rip+0x5861a] # 0x5fe40 0x0000000000007826 <+6518>: vpermi2q zmm12,zmm2,zmm0 0x000000000000782c <+6524>: vpmaxsq zmm0,zmm2,zmm12 0x0000000000007832 <+6530>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x58684] # 0x5fec0 0x000000000000783c <+6540>: vpermi2q zmm2,zmm5,zmm4 0x0000000000007842 <+6546>: vinserti32x4 zmm2,zmm2,xmm0,0x3 0x0000000000007849 <+6553>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x586ed] # 0x5ff40 0x0000000000007853 <+6563>: vpermi2q zmm4,zmm11,zmm1 0x0000000000007859 <+6569>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5871d] # 0x5ff80 0x0000000000007863 <+6579>: vpermi2q zmm1,zmm4,zmm8 0x0000000000007869 <+6585>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x5878d] # 0x60000 0x0000000000007873 <+6595>: vpermi2q zmm4,zmm0,zmm5 0x0000000000007879 <+6601>: vpminsq zmm8,zmm11,zmm1 0x000000000000787f <+6607>: vpmaxsq zmm1,zmm11,zmm1 0x0000000000007885 <+6613>: vpblendmq zmm14{k2},zmm1,zmm8 0x000000000000788b <+6619>: vpmaxsq zmm11,zmm5,zmm2 0x0000000000007891 <+6625>: vmovdqa64 zmm12,zmm11 0x0000000000007897 <+6631>: vpminsq zmm12{k2},zmm5,zmm2 0x000000000000789d <+6637>: vpmaxsq zmm5,zmm0,zmm4 0x00000000000078a3 <+6643>: mov al,0x4 0x00000000000078a5 <+6645>: kmovd k1,eax 0x00000000000078a9 <+6649>: vmovdqa64 zmm19,ZMMWORD PTR [rip+0x5878d] # 0x60040 0x00000000000078b3 <+6659>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x587c3] # 0x60080 0x00000000000078bd <+6669>: vmovdqa64 zmm18,zmm12 0x00000000000078c3 <+6675>: vpermt2q zmm18,zmm19,zmm13 0x00000000000078c9 <+6681>: vpermt2q zmm18,zmm2,zmm5 0x00000000000078cf <+6687>: vmovdqa64 ZMMWORD PTR [rsp+0x600],zmm18 0x00000000000078d7 <+6695>: vpminsq zmm5{k1},zmm0,zmm4 0x00000000000078dd <+6701>: vmovdqa64 ZMMWORD PTR [rsp+0x700],zmm16 0x00000000000078e5 <+6709>: vpermt2q zmm16,zmm19,zmm15 0x00000000000078eb <+6715>: vpermt2q zmm16,zmm2,zmm9 0x00000000000078f1 <+6721>: vmovdqa64 ZMMWORD PTR [rsp+0x580],zmm16 0x00000000000078f9 <+6729>: vmovdqa64 zmm0,zmm17 0x00000000000078ff <+6735>: vpermt2q zmm0,zmm19,zmm6 0x0000000000007905 <+6741>: vpermt2q zmm0,zmm2,zmm10 0x000000000000790b <+6747>: vmovdqa64 ZMMWORD PTR [rsp+0x540],zmm0 0x0000000000007913 <+6755>: vmovdqa64 ZMMWORD PTR [rsp+0x740],zmm13 0x000000000000791b <+6763>: vmovdqa64 ZMMWORD PTR [rsp+0x780],zmm17 0x0000000000007923 <+6771>: vpermt2q zmm13,zmm19,zmm17 0x0000000000007929 <+6777>: vpermt2q zmm13,zmm2,zmm11 0x000000000000792f <+6783>: vmovdqa64 ZMMWORD PTR [rsp+0x4c0],zmm13 0x0000000000007937 <+6791>: vmovdqa64 ZMMWORD PTR [rsp+0x7c0],zmm15 0x000000000000793f <+6799>: vpermt2q zmm15,zmm19,zmm8 0x0000000000007945 <+6805>: vpermt2q zmm15,zmm2,zmm7 0x000000000000794b <+6811>: vmovdqa64 ZMMWORD PTR [rsp+0x500],zmm15 0x0000000000007953 <+6819>: vmovdqa64 ZMMWORD PTR [rsp+0x640],zmm14 0x000000000000795b <+6827>: vpermi2q zmm19,zmm14,zmm21 0x0000000000007961 <+6833>: vpermt2q zmm19,zmm2,zmm3 0x0000000000007967 <+6839>: vmovdqa64 ZMMWORD PTR [rsp+0x5c0],zmm19 0x000000000000796f <+6847>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x58787] # 0x60100 0x0000000000007979 <+6857>: vmovdqa64 ZMMWORD PTR [rsp+0x400],zmm21 0x0000000000007981 <+6865>: vpermi2q zmm0,zmm21,zmm1 0x0000000000007987 <+6871>: vmovdqa64 ZMMWORD PTR [rsp+0x480],zmm0 0x000000000000798f <+6879>: mov rbx,QWORD PTR [rsp+0x30] 0x0000000000007994 <+6884>: mov rax,QWORD PTR [rsp+0x38] 0x0000000000007999 <+6889>: mov QWORD PTR [rsp+0x58],rax 0x000000000000799e <+6894>: vpxor xmm0,xmm0,xmm0 0x00000000000079a2 <+6898>: vmovdqa XMMWORD PTR [rsp+0x40],xmm0 0x00000000000079a8 <+6904>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5870e] # 0x600c0 0x00000000000079b2 <+6914>: vmovdqa64 ZMMWORD PTR [rsp+0x6c0],zmm5 0x00000000000079ba <+6922>: vmovdqa64 ZMMWORD PTR [rsp+0x680],zmm12 0x00000000000079c2 <+6930>: vpermi2q zmm0,zmm5,zmm12 0x00000000000079c8 <+6936>: vmovdqa64 ZMMWORD PTR [rsp+0x440],zmm0 0x00000000000079d0 <+6944>: lea rsi,[rsp+0x40] 0x00000000000079d5 <+6949>: mov edi,0x1 0x00000000000079da <+6954>: vzeroupper 0x00000000000079dd <+6957>: call 0x5470 <clock_gettime@plt> 0x00000000000079e2 <+6962>: mov r12,QWORD PTR [rsp+0x40] 0x00000000000079e7 <+6967>: sub r12,rbx 0x00000000000079ea <+6970>: mov r13,QWORD PTR [rsp+0x48] 0x00000000000079ef <+6975>: mov edi,0x40 0x00000000000079f4 <+6980>: call 0x9a40 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000079f9 <+6985>: mov r14,rax 0x00000000000079fc <+6988>: test rax,rax 0x00000000000079ff <+6991>: jle 0x7a16 <main+7014> 0x0000000000007a01 <+6993>: mov edi,0x1 0x0000000000007a06 <+6998>: mov rsi,r14 0x0000000000007a09 <+7001>: call 0x2ef90 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000007a0e <+7006>: mov r15,rax 0x0000000000007a11 <+7009>: mov rbx,r14 0x0000000000007a14 <+7012>: jmp 0x7a1b <main+7019> 0x0000000000007a16 <+7014>: xor r15d,r15d 0x0000000000007a19 <+7017>: xor ebx,ebx 0x0000000000007a1b <+7019>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x580] 0x0000000000007a23 <+7027>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x700] 0x0000000000007a2b <+7035>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x0000000000007a33 <+7043>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x5c0] 0x0000000000007a3b <+7051>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x640] 0x0000000000007a43 <+7059>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x0000000000007a4b <+7067>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x4c0] 0x0000000000007a53 <+7075>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x740] 0x0000000000007a5b <+7083>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm0 0x0000000000007a63 <+7091>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x540] 0x0000000000007a6b <+7099>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x780] 0x0000000000007a73 <+7107>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000007a7b <+7115>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x500] 0x0000000000007a83 <+7123>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x7c0] 0x0000000000007a8b <+7131>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000007a93 <+7139>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x600] 0x0000000000007a9b <+7147>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x680] 0x0000000000007aa3 <+7155>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x0000000000007aab <+7163>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x480] 0x0000000000007ab3 <+7171>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x400] 0x0000000000007abb <+7179>: vmovdqa64 ZMMWORD PTR [rsp+0x200],zmm0 0x0000000000007ac3 <+7187>: mov al,0xa8 0x0000000000007ac5 <+7189>: kmovd k1,eax 0x0000000000007ac9 <+7193>: kmovw WORD PTR [rsp+0x2c],k1 0x0000000000007acf <+7199>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x440] 0x0000000000007ad7 <+7207>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x6c0] 0x0000000000007adf <+7215>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000007ae7 <+7223>: imul r12,r12,0x3b9aca00 0x0000000000007aee <+7230>: sub r13,QWORD PTR [rsp+0x58] 0x0000000000007af3 <+7235>: lea rdx,[rip+0x58646] # 0x60140 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000007afa <+7242>: mov ecx,0x40 0x0000000000007aff <+7247>: mov rdi,r15 0x0000000000007b02 <+7250>: mov rsi,r14 0x0000000000007b05 <+7253>: xor eax,eax 0x0000000000007b07 <+7255>: vzeroupper 0x0000000000007b0a <+7258>: call 0x57c0 <snprintf@plt> 0x0000000000007b0f <+7263>: cdqe 0x0000000000007b11 <+7265>: inc rax 0x0000000000007b14 <+7268>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000007b1c <+7276>: mov QWORD PTR [rsp+0xa8],rax 0x0000000000007b24 <+7284>: mov QWORD PTR [rsp+0xb0],rbx 0x0000000000007b2c <+7292>: lea rdx,[rip+0x5862d] # 0x60160 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x0000000000007b33 <+7299>: lea rdi,[rsp+0x358] 0x0000000000007b3b <+7307>: lea rsi,[rsp+0xa0] 0x0000000000007b43 <+7315>: mov ecx,0x6 0x0000000000007b48 <+7320>: call 0xf090 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000007b4d <+7325>: mov rdi,QWORD PTR [rsp+0xa0] 0x0000000000007b55 <+7333>: test rdi,rdi 0x0000000000007b58 <+7336>: je 0x7b5f <main+7343> 0x0000000000007b5a <+7338>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007b5f <+7343>: kmovw k1,WORD PTR [rsp+0x2a] 0x0000000000007b65 <+7349>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x180] 0x0000000000007b6d <+7357>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x580] 0x0000000000007b75 <+7365>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x700] 0x0000000000007b7d <+7373>: vmovdqa64 ZMMWORD PTR [rsp+0x180],zmm0 0x0000000000007b85 <+7381>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x2c0] 0x0000000000007b8d <+7389>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x5c0] 0x0000000000007b95 <+7397>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x640] 0x0000000000007b9d <+7405>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm0 0x0000000000007ba5 <+7413>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x240] 0x0000000000007bad <+7421>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x4c0] 0x0000000000007bb5 <+7429>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x740] 0x0000000000007bbd <+7437>: vmovdqa64 ZMMWORD PTR [rsp+0x240],zmm0 0x0000000000007bc5 <+7445>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000007bcd <+7453>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x540] 0x0000000000007bd5 <+7461>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x780] 0x0000000000007bdd <+7469>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000007be5 <+7477>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000007bed <+7485>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x500] 0x0000000000007bf5 <+7493>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x7c0] 0x0000000000007bfd <+7501>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000007c05 <+7509>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x280] 0x0000000000007c0d <+7517>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x600] 0x0000000000007c15 <+7525>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x680] 0x0000000000007c1d <+7533>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x0000000000007c25 <+7541>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x200] 0x0000000000007c2d <+7549>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x480] 0x0000000000007c35 <+7557>: kmovw k1,WORD PTR [rsp+0x2c] 0x0000000000007c3b <+7563>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x400] 0x0000000000007c43 <+7571>: vmovdqa64 ZMMWORD PTR [rsp+0x200],zmm0 0x0000000000007c4b <+7579>: kmovw k1,WORD PTR [rsp+0x2e] 0x0000000000007c51 <+7585>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x1c0] 0x0000000000007c59 <+7593>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x440] 0x0000000000007c61 <+7601>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x6c0] 0x0000000000007c69 <+7609>: vmovdqa64 ZMMWORD PTR [rsp+0x1c0],zmm0 0x0000000000007c71 <+7617>: add r13,r12 0x0000000000007c74 <+7620>: mov edi,0x1 0x0000000000007c79 <+7625>: mov esi,0x3 0x0000000000007c7e <+7630>: vzeroupper 0x0000000000007c81 <+7633>: call 0x2ef90 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000007c86 <+7638>: xor ecx,ecx 0x0000000000007c88 <+7640>: nop DWORD PTR [rax+rax*1+0x0] 0x0000000000007c90 <+7648>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000007c94 <+7652>: inc rcx 0x0000000000007c97 <+7655>: cmp rcx,0x3 0x0000000000007c9b <+7659>: jne 0x7c90 <main+7648> 0x0000000000007c9d <+7661>: mov WORD PTR [rax],0x203a 0x0000000000007ca2 <+7666>: mov BYTE PTR [rax+0x2],0x0 0x0000000000007ca6 <+7670>: mov QWORD PTR [rsp+0xb8],rax 0x0000000000007cae <+7678>: mov QWORD PTR [rsp+0xc0],0x3 0x0000000000007cba <+7690>: mov QWORD PTR [rsp+0xc8],0x3 0x0000000000007cc6 <+7702>: lea rdi,[rsp+0x370] 0x0000000000007cce <+7710>: lea rsi,[rsp+0x358] 0x0000000000007cd6 <+7718>: lea rdx,[rsp+0xb8] 0x0000000000007cde <+7726>: call 0xec50 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000007ce3 <+7731>: mov rdi,QWORD PTR [rsp+0xb8] 0x0000000000007ceb <+7739>: test rdi,rdi 0x0000000000007cee <+7742>: je 0x7cf5 <main+7749> 0x0000000000007cf0 <+7744>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007cf5 <+7749>: mov rdi,QWORD PTR [rsp+0x358] 0x0000000000007cfd <+7757>: test rdi,rdi 0x0000000000007d00 <+7760>: je 0x7d07 <main+7767> 0x0000000000007d02 <+7762>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007d07 <+7767>: lea r14,[rsp+0x3e8] 0x0000000000007d0f <+7775>: mov rdi,r14 0x0000000000007d12 <+7778>: vmovaps zmm0,ZMMWORD PTR [rsp+0x200] 0x0000000000007d1a <+7786>: vmovaps zmm1,ZMMWORD PTR [rsp+0x2c0] 0x0000000000007d22 <+7794>: vmovaps zmm2,ZMMWORD PTR [rsp+0x140] 0x0000000000007d2a <+7802>: vmovaps zmm3,ZMMWORD PTR [rsp+0x180] 0x0000000000007d32 <+7810>: vmovaps zmm4,ZMMWORD PTR [rsp+0x100] 0x0000000000007d3a <+7818>: vmovaps zmm5,ZMMWORD PTR [rsp+0x240] 0x0000000000007d42 <+7826>: vmovaps zmm6,ZMMWORD PTR [rsp+0x280] 0x0000000000007d4a <+7834>: vmovaps zmm7,ZMMWORD PTR [rsp+0x1c0] 0x0000000000007d52 <+7842>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=64> 0x0000000000007d57 <+7847>: lea rdi,[rsp+0x388] 0x0000000000007d5f <+7855>: lea rsi,[rsp+0x370] 0x0000000000007d67 <+7863>: mov rdx,r14 0x0000000000007d6a <+7866>: vzeroupper 0x0000000000007d6d <+7869>: call 0xec50 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000007d72 <+7874>: mov rdi,QWORD PTR [rsp+0x3e8] 0x0000000000007d7a <+7882>: test rdi,rdi 0x0000000000007d7d <+7885>: je 0x7d84 <main+7892> 0x0000000000007d7f <+7887>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007d84 <+7892>: mov rdi,QWORD PTR [rsp+0x370] 0x0000000000007d8c <+7900>: test rdi,rdi 0x0000000000007d8f <+7903>: je 0x7d96 <main+7910> 0x0000000000007d91 <+7905>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007d96 <+7910>: lea rdi,[rsp+0x388] 0x0000000000007d9e <+7918>: call 0xa4f0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000007da3 <+7923>: mov rdi,QWORD PTR [rsp+0x388] 0x0000000000007dab <+7931>: test rdi,rdi 0x0000000000007dae <+7934>: je 0x7db5 <main+7941> 0x0000000000007db0 <+7936>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007db5 <+7941>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x240] 0x0000000000007dbd <+7949>: vpaddq zmm0,zmm0,ZMMWORD PTR [rsp+0x2c0] 0x0000000000007dc5 <+7957>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x1c0] 0x0000000000007dcd <+7965>: vpaddq zmm1,zmm1,ZMMWORD PTR [rsp+0x180] 0x0000000000007dd5 <+7973>: vpaddq zmm0,zmm0,zmm1 0x0000000000007ddb <+7979>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x200] 0x0000000000007de3 <+7987>: vpaddq zmm1,zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000007deb <+7995>: vmovdqa64 zmm2,ZMMWORD PTR [rsp+0x280] 0x0000000000007df3 <+8003>: vpaddq zmm2,zmm2,ZMMWORD PTR [rsp+0x140] 0x0000000000007dfb <+8011>: vpaddq zmm1,zmm1,zmm2 0x0000000000007e01 <+8017>: vpaddq zmm0,zmm1,zmm0 0x0000000000007e07 <+8023>: vextracti64x4 ymm1,zmm0,0x1 0x0000000000007e0e <+8030>: vpaddq ymm0,ymm0,ymm1 0x0000000000007e12 <+8034>: vextracti128 xmm1,ymm0,0x1 0x0000000000007e18 <+8040>: vpaddq xmm0,xmm0,xmm1 0x0000000000007e1c <+8044>: vpshufd xmm1,xmm0,0xee 0x0000000000007e21 <+8049>: vpaddq xmm0,xmm0,xmm1 0x0000000000007e25 <+8053>: vmovq rax,xmm0 0x0000000000007e2a <+8058>: vmovq QWORD PTR [rsp+0x68],xmm0 0x0000000000007e30 <+8064>: lea rcx,[rsp+0x68] 0x0000000000007e35 <+8069>: mov QWORD PTR [rsp+0x60],rcx 0x0000000000007e3a <+8074>: mov rdi,r13 0x0000000000007e3d <+8077>: vzeroupper 0x0000000000007e40 <+8080>: call 0x9a40 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000007e45 <+8085>: mov r14,rax 0x0000000000007e48 <+8088>: test rax,rax 0x0000000000007e4b <+8091>: jle 0x7e62 <main+8114> 0x0000000000007e4d <+8093>: mov edi,0x1 0x0000000000007e52 <+8098>: mov rsi,r14 0x0000000000007e55 <+8101>: call 0x2ef90 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000007e5a <+8106>: mov r15,rax 0x0000000000007e5d <+8109>: mov rbx,r14 0x0000000000007e60 <+8112>: jmp 0x7e67 <main+8119> 0x0000000000007e62 <+8114>: xor r15d,r15d 0x0000000000007e65 <+8117>: xor ebx,ebx 0x0000000000007e67 <+8119>: lea rdx,[rip+0x582d2] # 0x60140 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000007e6e <+8126>: mov rdi,r15 0x0000000000007e71 <+8129>: mov rsi,r14 0x0000000000007e74 <+8132>: mov rcx,r13 0x0000000000007e77 <+8135>: xor eax,eax 0x0000000000007e79 <+8137>: call 0x57c0 <snprintf@plt> 0x0000000000007e7e <+8142>: cdqe 0x0000000000007e80 <+8144>: inc rax 0x0000000000007e83 <+8147>: mov QWORD PTR [rsp+0xd0],r15 0x0000000000007e8b <+8155>: mov QWORD PTR [rsp+0xd8],rax 0x0000000000007e93 <+8163>: mov QWORD PTR [rsp+0xe0],rbx 0x0000000000007e9b <+8171>: lea rdx,[rip+0x582ce] # 0x60170 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x0000000000007ea2 <+8178>: lea rdi,[rsp+0x3a0] 0x0000000000007eaa <+8186>: lea rsi,[rsp+0xd0] 0x0000000000007eb2 <+8194>: mov ecx,0xb 0x0000000000007eb7 <+8199>: call 0xf090 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000007ebc <+8204>: mov rdi,QWORD PTR [rsp+0xd0] 0x0000000000007ec4 <+8212>: test rdi,rdi 0x0000000000007ec7 <+8215>: je 0x7ece <main+8222> 0x0000000000007ec9 <+8217>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007ece <+8222>: mov edi,0x1 0x0000000000007ed3 <+8227>: mov esi,0x4 0x0000000000007ed8 <+8232>: call 0x2ef90 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000007edd <+8237>: xor ecx,ecx 0x0000000000007edf <+8239>: nop 0x0000000000007ee0 <+8240>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000007ee4 <+8244>: inc rcx 0x0000000000007ee7 <+8247>: cmp rcx,0x4 0x0000000000007eeb <+8251>: jne 0x7ee0 <main+8240> 0x0000000000007eed <+8253>: mov DWORD PTR [rax],0x736e20 0x0000000000007ef3 <+8259>: mov QWORD PTR [rsp+0xe8],rax 0x0000000000007efb <+8267>: mov QWORD PTR [rsp+0xf0],0x4 0x0000000000007f07 <+8279>: mov QWORD PTR [rsp+0xf8],0x4 0x0000000000007f13 <+8291>: lea rdi,[rsp+0x3b8] 0x0000000000007f1b <+8299>: lea rsi,[rsp+0x3a0] 0x0000000000007f23 <+8307>: lea rdx,[rsp+0xe8] 0x0000000000007f2b <+8315>: call 0xec50 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000007f30 <+8320>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000007f38 <+8328>: test rdi,rdi 0x0000000000007f3b <+8331>: je 0x7f42 <main+8338> 0x0000000000007f3d <+8333>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007f42 <+8338>: mov rdi,QWORD PTR [rsp+0x3a0] 0x0000000000007f4a <+8346>: test rdi,rdi 0x0000000000007f4d <+8349>: je 0x7f54 <main+8356> 0x0000000000007f4f <+8351>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007f54 <+8356>: lea rdi,[rsp+0x3b8] 0x0000000000007f5c <+8364>: call 0xa4f0 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000007f61 <+8369>: mov rdi,QWORD PTR [rsp+0x3b8] 0x0000000000007f69 <+8377>: test rdi,rdi 0x0000000000007f6c <+8380>: je 0x7f73 <main+8387> 0x0000000000007f6e <+8382>: call 0x2efb0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000007f73 <+8387>: call 0x2b3b0 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000007f78 <+8392>: xor eax,eax 0x0000000000007f7a <+8394>: lea rsp,[rbp-0x28] 0x0000000000007f7e <+8398>: pop rbx 0x0000000000007f7f <+8399>: pop r12 0x0000000000007f81 <+8401>: pop r13 0x0000000000007f83 <+8403>: pop r14 0x0000000000007f85 <+8405>: pop r15 0x0000000000007f87 <+8407>: pop rbp 0x0000000000007f88 <+8408>: ret End of assembler dump. --- disassemble/int64_8.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d80 <+0>: push rbp 0x0000000000005d81 <+1>: push r15 0x0000000000005d83 <+3>: push r14 0x0000000000005d85 <+5>: push r13 0x0000000000005d87 <+7>: push r12 0x0000000000005d89 <+9>: push rbx 0x0000000000005d8a <+10>: sub rsp,0x288 0x0000000000005d91 <+17>: call 0x2f000 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d96 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d9a <+26>: mov ebx,0x9 0x0000000000005d9f <+31>: xor r14d,r14d 0x0000000000005da2 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005db0 <+48>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x0000000000005dbb <+59>: vzeroupper 0x0000000000005dbe <+62>: call 0x2df50 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005dc3 <+67>: mov edx,0x64 0x0000000000005dc8 <+72>: mov rdi,rax 0x0000000000005dcb <+75>: xor esi,esi 0x0000000000005dcd <+77>: call 0x2e360 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005dd2 <+82>: vpbroadcastq zmm0,r14 0x0000000000005dd8 <+88>: vpcmpeqq k1,zmm0,ZMMWORD PTR [rip+0x5621e] # 0x5c000 0x0000000000005de2 <+98>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0xd0] 0x0000000000005ded <+109>: vpbroadcastq zmm0{k1},rax 0x0000000000005df3 <+115>: dec rbx 0x0000000000005df6 <+118>: inc r14 0x0000000000005df9 <+121>: cmp rbx,0x1 0x0000000000005dfd <+125>: ja 0x5db0 <main+48> 0x0000000000005dff <+127>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x0000000000005e0a <+138>: mov edi,0x8 0x0000000000005e0f <+143>: vzeroupper 0x0000000000005e12 <+146>: call 0x7ee0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005e17 <+151>: mov rbx,rax 0x0000000000005e1a <+154>: test rax,rax 0x0000000000005e1d <+157>: jle 0x5e34 <main+180> 0x0000000000005e1f <+159>: mov edi,0x1 0x0000000000005e24 <+164>: mov rsi,rbx 0x0000000000005e27 <+167>: call 0x2d430 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e2c <+172>: mov r14,rax 0x0000000000005e2f <+175>: mov r15,rbx 0x0000000000005e32 <+178>: jmp 0x5e3a <main+186> 0x0000000000005e34 <+180>: xor r14d,r14d 0x0000000000005e37 <+183>: xor r15d,r15d 0x0000000000005e3a <+186>: lea rdx,[rip+0x5627f] # 0x5c0c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005e41 <+193>: mov ecx,0x8 0x0000000000005e46 <+198>: mov rdi,r14 0x0000000000005e49 <+201>: mov rsi,rbx 0x0000000000005e4c <+204>: xor eax,eax 0x0000000000005e4e <+206>: call 0x57c0 <snprintf@plt> 0x0000000000005e53 <+211>: cdqe 0x0000000000005e55 <+213>: inc rax 0x0000000000005e58 <+216>: mov QWORD PTR [rsp+0x40],r14 0x0000000000005e5d <+221>: mov QWORD PTR [rsp+0x48],rax 0x0000000000005e62 <+226>: mov QWORD PTR [rsp+0x50],r15 0x0000000000005e67 <+231>: lea rdx,[rip+0x56262] # 0x5c0d0 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e6e <+238>: lea rdi,[rsp+0x110] 0x0000000000005e76 <+246>: lea rsi,[rsp+0x40] 0x0000000000005e7b <+251>: mov ecx,0x7 0x0000000000005e80 <+256>: call 0xd530 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e85 <+261>: mov rdi,QWORD PTR [rsp+0x40] 0x0000000000005e8a <+266>: test rdi,rdi 0x0000000000005e8d <+269>: je 0x5e94 <main+276> 0x0000000000005e8f <+271>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e94 <+276>: mov edi,0x1 0x0000000000005e99 <+281>: mov esi,0x3 0x0000000000005e9e <+286>: call 0x2d430 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005ea3 <+291>: xor ecx,ecx 0x0000000000005ea5 <+293>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005eb0 <+304>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005eb4 <+308>: inc rcx 0x0000000000005eb7 <+311>: cmp rcx,0x3 0x0000000000005ebb <+315>: jne 0x5eb0 <main+304> 0x0000000000005ebd <+317>: mov WORD PTR [rax],0x203a 0x0000000000005ec2 <+322>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005ec6 <+326>: mov QWORD PTR [rsp+0x58],rax 0x0000000000005ecb <+331>: mov QWORD PTR [rsp+0x60],0x3 0x0000000000005ed4 <+340>: mov QWORD PTR [rsp+0x68],0x3 0x0000000000005edd <+349>: lea rdi,[rsp+0x128] 0x0000000000005ee5 <+357>: lea rsi,[rsp+0x110] 0x0000000000005eed <+365>: lea rdx,[rsp+0x58] 0x0000000000005ef2 <+370>: call 0xd0f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005ef7 <+375>: mov rdi,QWORD PTR [rsp+0x58] 0x0000000000005efc <+380>: test rdi,rdi 0x0000000000005eff <+383>: je 0x5f06 <main+390> 0x0000000000005f01 <+385>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f06 <+390>: mov rdi,QWORD PTR [rsp+0x110] 0x0000000000005f0e <+398>: test rdi,rdi 0x0000000000005f11 <+401>: je 0x5f18 <main+408> 0x0000000000005f13 <+403>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f18 <+408>: lea rbx,[rsp+0x1d0] 0x0000000000005f20 <+416>: mov rdi,rbx 0x0000000000005f23 <+419>: vmovups zmm0,ZMMWORD PTR [rsp+0xd0] 0x0000000000005f2e <+430>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=8> 0x0000000000005f33 <+435>: lea rdi,[rsp+0x140] 0x0000000000005f3b <+443>: lea rsi,[rsp+0x128] 0x0000000000005f43 <+451>: mov rdx,rbx 0x0000000000005f46 <+454>: vzeroupper 0x0000000000005f49 <+457>: call 0xd0f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005f4e <+462>: mov rdi,QWORD PTR [rsp+0x1d0] 0x0000000000005f56 <+470>: test rdi,rdi 0x0000000000005f59 <+473>: je 0x5f60 <main+480> 0x0000000000005f5b <+475>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f60 <+480>: mov rdi,QWORD PTR [rsp+0x128] 0x0000000000005f68 <+488>: test rdi,rdi 0x0000000000005f6b <+491>: je 0x5f72 <main+498> 0x0000000000005f6d <+493>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f72 <+498>: lea rdi,[rsp+0x140] 0x0000000000005f7a <+506>: call 0x8990 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f7f <+511>: mov rdi,QWORD PTR [rsp+0x140] 0x0000000000005f87 <+519>: test rdi,rdi 0x0000000000005f8a <+522>: je 0x5f91 <main+529> 0x0000000000005f8c <+524>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f91 <+529>: vxorps xmm0,xmm0,xmm0 0x0000000000005f95 <+533>: vmovaps XMMWORD PTR [rsp+0x10],xmm0 0x0000000000005f9b <+539>: lea rsi,[rsp+0x10] 0x0000000000005fa0 <+544>: mov edi,0x1 0x0000000000005fa5 <+549>: call 0x5470 <clock_gettime@plt> 0x0000000000005faa <+554>: mov rbx,QWORD PTR [rsp+0x10] 0x0000000000005faf <+559>: mov r12,QWORD PTR [rsp+0x18] 0x0000000000005fb4 <+564>: vmovdqu64 zmm2,ZMMWORD PTR [rsp+0xd0] 0x0000000000005fbf <+575>: vpxor xmm0,xmm0,xmm0 0x0000000000005fc3 <+579>: vpermq zmm0,zmm2,0x4e 0x0000000000005fca <+586>: vpminsq zmm1,zmm2,zmm0 0x0000000000005fd0 <+592>: mov al,0xcc 0x0000000000005fd2 <+594>: kmovd k1,eax 0x0000000000005fd6 <+598>: vpmaxsq zmm1{k1},zmm2,zmm0 0x0000000000005fdc <+604>: vshufi64x2 zmm0,zmm1,zmm1,0x4e 0x0000000000005fe3 <+611>: vpminsq zmm2,zmm1,zmm0 0x0000000000005fe9 <+617>: vpmaxsq zmm0,zmm1,zmm0 0x0000000000005fef <+623>: vshufi64x2 zmm0,zmm2,zmm0,0xe4 0x0000000000005ff6 <+630>: vpshufd zmm1,zmm0,0x4e 0x0000000000005ffd <+637>: vpminsq zmm2,zmm0,zmm1 0x0000000000006003 <+643>: mov al,0xaa 0x0000000000006005 <+645>: kmovd k1,eax 0x0000000000006009 <+649>: vpmaxsq zmm2{k1},zmm0,zmm1 0x000000000000600f <+655>: vshufi64x2 zmm0,zmm2,zmm2,0xd8 0x0000000000006016 <+662>: vpmaxsq zmm1,zmm2,zmm0 0x000000000000601c <+668>: mov al,0xc 0x000000000000601e <+670>: kmovd k1,eax 0x0000000000006022 <+674>: vpminsq zmm1{k1},zmm2,zmm0 0x0000000000006028 <+680>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5600e] # 0x5c040 0x0000000000006032 <+690>: vpermq zmm0,zmm0,zmm1 0x0000000000006038 <+696>: vpmaxsq zmm2,zmm1,zmm0 0x000000000000603e <+702>: mov al,0xa 0x0000000000006040 <+704>: kmovd k1,eax 0x0000000000006044 <+708>: vpminsq zmm2{k1},zmm1,zmm0 0x000000000000604a <+714>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5602c] # 0x5c080 0x0000000000006054 <+724>: vmovdqu64 ZMMWORD PTR [rsp+0x240],zmm2 0x000000000000605c <+732>: vpermq zmm0,zmm0,zmm2 0x0000000000006062 <+738>: vmovdqu64 ZMMWORD PTR [rsp+0x200],zmm0 0x000000000000606a <+746>: vpxor xmm0,xmm0,xmm0 0x000000000000606e <+750>: vmovdqa XMMWORD PTR [rsp+0x20],xmm0 0x0000000000006074 <+756>: lea rsi,[rsp+0x20] 0x0000000000006079 <+761>: mov edi,0x1 0x000000000000607e <+766>: vzeroupper 0x0000000000006081 <+769>: call 0x5470 <clock_gettime@plt> 0x0000000000006086 <+774>: mov r13,QWORD PTR [rsp+0x20] 0x000000000000608b <+779>: sub r13,rbx 0x000000000000608e <+782>: mov rbx,QWORD PTR [rsp+0x28] 0x0000000000006093 <+787>: mov edi,0x8 0x0000000000006098 <+792>: call 0x7ee0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000609d <+797>: mov r14,rax 0x00000000000060a0 <+800>: test rax,rax 0x00000000000060a3 <+803>: jle 0x60ba <main+826> 0x00000000000060a5 <+805>: mov edi,0x1 0x00000000000060aa <+810>: mov rsi,r14 0x00000000000060ad <+813>: call 0x2d430 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000060b2 <+818>: mov r15,rax 0x00000000000060b5 <+821>: mov rbp,r14 0x00000000000060b8 <+824>: jmp 0x60bf <main+831> 0x00000000000060ba <+826>: xor r15d,r15d 0x00000000000060bd <+829>: xor ebp,ebp 0x00000000000060bf <+831>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0x200] 0x00000000000060c7 <+839>: vpmaxsq zmm0,zmm0,ZMMWORD PTR [rsp+0x240] 0x00000000000060cf <+847>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x00000000000060da <+858>: mov al,0x2a 0x00000000000060dc <+860>: kmovd k1,eax 0x00000000000060e0 <+864>: kmovw WORD PTR [rsp+0xe],k1 0x00000000000060e6 <+870>: imul r13,r13,0x3b9aca00 0x00000000000060ed <+877>: sub rbx,r12 0x00000000000060f0 <+880>: lea rdx,[rip+0x55fc9] # 0x5c0c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000060f7 <+887>: mov ecx,0x8 0x00000000000060fc <+892>: mov rdi,r15 0x00000000000060ff <+895>: mov rsi,r14 0x0000000000006102 <+898>: xor eax,eax 0x0000000000006104 <+900>: vzeroupper 0x0000000000006107 <+903>: call 0x57c0 <snprintf@plt> 0x000000000000610c <+908>: cdqe 0x000000000000610e <+910>: inc rax 0x0000000000006111 <+913>: mov QWORD PTR [rsp+0x70],r15 0x0000000000006116 <+918>: mov QWORD PTR [rsp+0x78],rax 0x000000000000611b <+923>: mov QWORD PTR [rsp+0x80],rbp 0x0000000000006123 <+931>: lea rdx,[rip+0x55fb6] # 0x5c0e0 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x000000000000612a <+938>: lea rdi,[rsp+0x158] 0x0000000000006132 <+946>: lea rsi,[rsp+0x70] 0x0000000000006137 <+951>: mov ecx,0x6 0x000000000000613c <+956>: call 0xd530 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006141 <+961>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000006146 <+966>: test rdi,rdi 0x0000000000006149 <+969>: je 0x6150 <main+976> 0x000000000000614b <+971>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006150 <+976>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0xd0] 0x000000000000615b <+987>: vmovdqu64 zmm1,ZMMWORD PTR [rsp+0x200] 0x0000000000006163 <+995>: kmovw k1,WORD PTR [rsp+0xe] 0x0000000000006169 <+1001>: vpminsq zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x240] 0x0000000000006171 <+1009>: vmovdqu64 ZMMWORD PTR [rsp+0xd0],zmm0 0x000000000000617c <+1020>: add rbx,r13 0x000000000000617f <+1023>: mov edi,0x1 0x0000000000006184 <+1028>: mov esi,0x3 0x0000000000006189 <+1033>: vzeroupper 0x000000000000618c <+1036>: call 0x2d430 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006191 <+1041>: xor ecx,ecx 0x0000000000006193 <+1043>: data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x00000000000061a0 <+1056>: mov BYTE PTR [rax+rcx*1],0x0 0x00000000000061a4 <+1060>: inc rcx 0x00000000000061a7 <+1063>: cmp rcx,0x3 0x00000000000061ab <+1067>: jne 0x61a0 <main+1056> 0x00000000000061ad <+1069>: mov WORD PTR [rax],0x203a 0x00000000000061b2 <+1074>: mov BYTE PTR [rax+0x2],0x0 0x00000000000061b6 <+1078>: mov QWORD PTR [rsp+0x88],rax 0x00000000000061be <+1086>: mov QWORD PTR [rsp+0x90],0x3 0x00000000000061ca <+1098>: mov QWORD PTR [rsp+0x98],0x3 0x00000000000061d6 <+1110>: lea rdi,[rsp+0x170] 0x00000000000061de <+1118>: lea rsi,[rsp+0x158] 0x00000000000061e6 <+1126>: lea rdx,[rsp+0x88] 0x00000000000061ee <+1134>: call 0xd0f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000061f3 <+1139>: mov rdi,QWORD PTR [rsp+0x88] 0x00000000000061fb <+1147>: test rdi,rdi 0x00000000000061fe <+1150>: je 0x6205 <main+1157> 0x0000000000006200 <+1152>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006205 <+1157>: mov rdi,QWORD PTR [rsp+0x158] 0x000000000000620d <+1165>: test rdi,rdi 0x0000000000006210 <+1168>: je 0x6217 <main+1175> 0x0000000000006212 <+1170>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006217 <+1175>: lea r14,[rsp+0x1e8] 0x000000000000621f <+1183>: mov rdi,r14 0x0000000000006222 <+1186>: vmovups zmm0,ZMMWORD PTR [rsp+0xd0] 0x000000000000622d <+1197>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si64,_74x26_size=8> 0x0000000000006232 <+1202>: lea rdi,[rsp+0x188] 0x000000000000623a <+1210>: lea rsi,[rsp+0x170] 0x0000000000006242 <+1218>: mov rdx,r14 0x0000000000006245 <+1221>: vzeroupper 0x0000000000006248 <+1224>: call 0xd0f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x000000000000624d <+1229>: mov rdi,QWORD PTR [rsp+0x1e8] 0x0000000000006255 <+1237>: test rdi,rdi 0x0000000000006258 <+1240>: je 0x625f <main+1247> 0x000000000000625a <+1242>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000625f <+1247>: mov rdi,QWORD PTR [rsp+0x170] 0x0000000000006267 <+1255>: test rdi,rdi 0x000000000000626a <+1258>: je 0x6271 <main+1265> 0x000000000000626c <+1260>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006271 <+1265>: lea rdi,[rsp+0x188] 0x0000000000006279 <+1273>: call 0x8990 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x000000000000627e <+1278>: mov rdi,QWORD PTR [rsp+0x188] 0x0000000000006286 <+1286>: test rdi,rdi 0x0000000000006289 <+1289>: je 0x6290 <main+1296> 0x000000000000628b <+1291>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006290 <+1296>: vmovdqu64 zmm1,ZMMWORD PTR [rsp+0xd0] 0x000000000000629b <+1307>: vextracti64x4 ymm0,zmm1,0x1 0x00000000000062a2 <+1314>: vpaddq ymm0,ymm1,ymm0 0x00000000000062a6 <+1318>: vextracti128 xmm1,ymm0,0x1 0x00000000000062ac <+1324>: vpaddq xmm0,xmm0,xmm1 0x00000000000062b0 <+1328>: vpshufd xmm1,xmm0,0xee 0x00000000000062b5 <+1333>: vpaddq xmm0,xmm0,xmm1 0x00000000000062b9 <+1337>: vmovq rax,xmm0 0x00000000000062be <+1342>: vmovq QWORD PTR [rsp+0x38],xmm0 0x00000000000062c4 <+1348>: lea rcx,[rsp+0x38] 0x00000000000062c9 <+1353>: mov QWORD PTR [rsp+0x30],rcx 0x00000000000062ce <+1358>: mov rdi,rbx 0x00000000000062d1 <+1361>: vzeroupper 0x00000000000062d4 <+1364>: call 0x7ee0 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000062d9 <+1369>: mov r14,rax 0x00000000000062dc <+1372>: test rax,rax 0x00000000000062df <+1375>: jle 0x62f6 <main+1398> 0x00000000000062e1 <+1377>: mov edi,0x1 0x00000000000062e6 <+1382>: mov rsi,r14 0x00000000000062e9 <+1385>: call 0x2d430 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000062ee <+1390>: mov r15,rax 0x00000000000062f1 <+1393>: mov r12,r14 0x00000000000062f4 <+1396>: jmp 0x62fc <main+1404> 0x00000000000062f6 <+1398>: xor r15d,r15d 0x00000000000062f9 <+1401>: xor r12d,r12d 0x00000000000062fc <+1404>: lea rdx,[rip+0x55dbd] # 0x5c0c0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006303 <+1411>: mov rdi,r15 0x0000000000006306 <+1414>: mov rsi,r14 0x0000000000006309 <+1417>: mov rcx,rbx 0x000000000000630c <+1420>: xor eax,eax 0x000000000000630e <+1422>: call 0x57c0 <snprintf@plt> 0x0000000000006313 <+1427>: cdqe 0x0000000000006315 <+1429>: inc rax 0x0000000000006318 <+1432>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000006320 <+1440>: mov QWORD PTR [rsp+0xa8],rax 0x0000000000006328 <+1448>: mov QWORD PTR [rsp+0xb0],r12 0x0000000000006330 <+1456>: lea rdx,[rip+0x55db9] # 0x5c0f0 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x0000000000006337 <+1463>: lea rdi,[rsp+0x1a0] 0x000000000000633f <+1471>: lea rsi,[rsp+0xa0] 0x0000000000006347 <+1479>: mov ecx,0xb 0x000000000000634c <+1484>: call 0xd530 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006351 <+1489>: mov rdi,QWORD PTR [rsp+0xa0] 0x0000000000006359 <+1497>: test rdi,rdi 0x000000000000635c <+1500>: je 0x6363 <main+1507> 0x000000000000635e <+1502>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006363 <+1507>: mov edi,0x1 0x0000000000006368 <+1512>: mov esi,0x4 0x000000000000636d <+1517>: call 0x2d430 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006372 <+1522>: xor ecx,ecx 0x0000000000006374 <+1524>: data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006380 <+1536>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006384 <+1540>: inc rcx 0x0000000000006387 <+1543>: cmp rcx,0x4 0x000000000000638b <+1547>: jne 0x6380 <main+1536> 0x000000000000638d <+1549>: mov DWORD PTR [rax],0x736e20 0x0000000000006393 <+1555>: mov QWORD PTR [rsp+0xb8],rax 0x000000000000639b <+1563>: mov QWORD PTR [rsp+0xc0],0x4 0x00000000000063a7 <+1575>: mov QWORD PTR [rsp+0xc8],0x4 0x00000000000063b3 <+1587>: lea rdi,[rsp+0x1b8] 0x00000000000063bb <+1595>: lea rsi,[rsp+0x1a0] 0x00000000000063c3 <+1603>: lea rdx,[rsp+0xb8] 0x00000000000063cb <+1611>: call 0xd0f0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000063d0 <+1616>: mov rdi,QWORD PTR [rsp+0xb8] 0x00000000000063d8 <+1624>: test rdi,rdi 0x00000000000063db <+1627>: je 0x63e2 <main+1634> 0x00000000000063dd <+1629>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000063e2 <+1634>: mov rdi,QWORD PTR [rsp+0x1a0] 0x00000000000063ea <+1642>: test rdi,rdi 0x00000000000063ed <+1645>: je 0x63f4 <main+1652> 0x00000000000063ef <+1647>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000063f4 <+1652>: lea rdi,[rsp+0x1b8] 0x00000000000063fc <+1660>: call 0x8990 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006401 <+1665>: mov rdi,QWORD PTR [rsp+0x1b8] 0x0000000000006409 <+1673>: test rdi,rdi 0x000000000000640c <+1676>: je 0x6413 <main+1683> 0x000000000000640e <+1678>: call 0x2d450 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006413 <+1683>: call 0x29850 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006418 <+1688>: xor eax,eax 0x000000000000641a <+1690>: add rsp,0x288 0x0000000000006421 <+1697>: pop rbx 0x0000000000006422 <+1698>: pop r12 0x0000000000006424 <+1700>: pop r13 0x0000000000006426 <+1702>: pop r14 0x0000000000006428 <+1704>: pop r15 0x000000000000642a <+1706>: pop rbp 0x000000000000642b <+1707>: ret End of assembler dump. --- disassemble/int8_128.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d60 <+0>: push rbp 0x0000000000005d61 <+1>: mov rbp,rsp 0x0000000000005d64 <+4>: push r15 0x0000000000005d66 <+6>: push r14 0x0000000000005d68 <+8>: push r13 0x0000000000005d6a <+10>: push r12 0x0000000000005d6c <+12>: push rbx 0x0000000000005d6d <+13>: and rsp,0xffffffffffffffc0 0x0000000000005d71 <+17>: sub rsp,0x440 0x0000000000005d78 <+24>: call 0x2f6b0 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d7d <+29>: vxorps xmm0,xmm0,xmm0 0x0000000000005d81 <+33>: mov ebx,0x81 0x0000000000005d86 <+38>: xor r14d,r14d 0x0000000000005d89 <+41>: vxorps xmm1,xmm1,xmm1 0x0000000000005d8d <+45>: nop DWORD PTR [rax] 0x0000000000005d90 <+48>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005d98 <+56>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005da0 <+64>: vzeroupper 0x0000000000005da3 <+67>: call 0x2e600 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005da8 <+72>: mov edx,0x64 0x0000000000005dad <+77>: mov rdi,rax 0x0000000000005db0 <+80>: xor esi,esi 0x0000000000005db2 <+82>: call 0x2ea10 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005db7 <+87>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005dbf <+95>: vmovaps ZMMWORD PTR [rsp+0x380],zmm0 0x0000000000005dc7 <+103>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000005dcf <+111>: vmovaps ZMMWORD PTR [rsp+0x3c0],zmm0 0x0000000000005dd7 <+119>: mov ecx,r14d 0x0000000000005dda <+122>: and ecx,0x7f 0x0000000000005ddd <+125>: mov BYTE PTR [rsp+rcx*1+0x380],al 0x0000000000005de4 <+132>: vmovaps zmm0,ZMMWORD PTR [rsp+0x380] 0x0000000000005dec <+140>: vmovaps zmm1,ZMMWORD PTR [rsp+0x3c0] 0x0000000000005df4 <+148>: dec rbx 0x0000000000005df7 <+151>: inc r14 0x0000000000005dfa <+154>: cmp rbx,0x1 0x0000000000005dfe <+158>: ja 0x5d90 <main+48> 0x0000000000005e00 <+160>: vmovaps ZMMWORD PTR [rsp+0x100],zmm1 0x0000000000005e08 <+168>: vmovaps ZMMWORD PTR [rsp+0x140],zmm0 0x0000000000005e10 <+176>: mov edi,0x80 0x0000000000005e15 <+181>: vzeroupper 0x0000000000005e18 <+184>: call 0x8590 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005e1d <+189>: mov rbx,rax 0x0000000000005e20 <+192>: test rax,rax 0x0000000000005e23 <+195>: jle 0x5e3a <main+218> 0x0000000000005e25 <+197>: mov edi,0x1 0x0000000000005e2a <+202>: mov rsi,rbx 0x0000000000005e2d <+205>: call 0x2dae0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e32 <+210>: mov r14,rax 0x0000000000005e35 <+213>: mov r15,rbx 0x0000000000005e38 <+216>: jmp 0x5e40 <main+224> 0x0000000000005e3a <+218>: xor r14d,r14d 0x0000000000005e3d <+221>: xor r15d,r15d 0x0000000000005e40 <+224>: lea rdx,[rip+0x579f9] # 0x5d840 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005e47 <+231>: mov ecx,0x80 0x0000000000005e4c <+236>: mov rdi,r14 0x0000000000005e4f <+239>: mov rsi,rbx 0x0000000000005e52 <+242>: xor eax,eax 0x0000000000005e54 <+244>: call 0x57c0 <snprintf@plt> 0x0000000000005e59 <+249>: cdqe 0x0000000000005e5b <+251>: inc rax 0x0000000000005e5e <+254>: mov QWORD PTR [rsp+0x70],r14 0x0000000000005e63 <+259>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005e68 <+264>: mov QWORD PTR [rsp+0x80],r15 0x0000000000005e70 <+272>: lea rdx,[rip+0x579d9] # 0x5d850 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e77 <+279>: lea rdi,[rsp+0x190] 0x0000000000005e7f <+287>: lea rsi,[rsp+0x70] 0x0000000000005e84 <+292>: mov ecx,0x7 0x0000000000005e89 <+297>: call 0xdbe0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e8e <+302>: mov rdi,QWORD PTR [rsp+0x70] 0x0000000000005e93 <+307>: test rdi,rdi 0x0000000000005e96 <+310>: je 0x5e9d <main+317> 0x0000000000005e98 <+312>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e9d <+317>: mov edi,0x1 0x0000000000005ea2 <+322>: mov esi,0x3 0x0000000000005ea7 <+327>: call 0x2dae0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005eac <+332>: xor ecx,ecx 0x0000000000005eae <+334>: xchg ax,ax 0x0000000000005eb0 <+336>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005eb4 <+340>: inc rcx 0x0000000000005eb7 <+343>: cmp rcx,0x3 0x0000000000005ebb <+347>: jne 0x5eb0 <main+336> 0x0000000000005ebd <+349>: mov WORD PTR [rax],0x203a 0x0000000000005ec2 <+354>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005ec6 <+358>: mov QWORD PTR [rsp+0x88],rax 0x0000000000005ece <+366>: mov QWORD PTR [rsp+0x90],0x3 0x0000000000005eda <+378>: mov QWORD PTR [rsp+0x98],0x3 0x0000000000005ee6 <+390>: lea rdi,[rsp+0x1a8] 0x0000000000005eee <+398>: lea rsi,[rsp+0x190] 0x0000000000005ef6 <+406>: lea rdx,[rsp+0x88] 0x0000000000005efe <+414>: call 0xd7a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005f03 <+419>: mov rdi,QWORD PTR [rsp+0x88] 0x0000000000005f0b <+427>: test rdi,rdi 0x0000000000005f0e <+430>: je 0x5f15 <main+437> 0x0000000000005f10 <+432>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f15 <+437>: mov rdi,QWORD PTR [rsp+0x190] 0x0000000000005f1d <+445>: test rdi,rdi 0x0000000000005f20 <+448>: je 0x5f27 <main+455> 0x0000000000005f22 <+450>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f27 <+455>: lea rbx,[rsp+0x250] 0x0000000000005f2f <+463>: mov rdi,rbx 0x0000000000005f32 <+466>: vmovaps zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000005f3a <+474>: vmovaps zmm1,ZMMWORD PTR [rsp+0x100] 0x0000000000005f42 <+482>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si8,_74x26_size=128> 0x0000000000005f47 <+487>: lea rdi,[rsp+0x1c0] 0x0000000000005f4f <+495>: lea rsi,[rsp+0x1a8] 0x0000000000005f57 <+503>: mov rdx,rbx 0x0000000000005f5a <+506>: vzeroupper 0x0000000000005f5d <+509>: call 0xd7a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005f62 <+514>: mov rdi,QWORD PTR [rsp+0x250] 0x0000000000005f6a <+522>: test rdi,rdi 0x0000000000005f6d <+525>: je 0x5f74 <main+532> 0x0000000000005f6f <+527>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f74 <+532>: mov rdi,QWORD PTR [rsp+0x1a8] 0x0000000000005f7c <+540>: test rdi,rdi 0x0000000000005f7f <+543>: je 0x5f86 <main+550> 0x0000000000005f81 <+545>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f86 <+550>: lea rdi,[rsp+0x1c0] 0x0000000000005f8e <+558>: call 0x9040 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f93 <+563>: mov rdi,QWORD PTR [rsp+0x1c0] 0x0000000000005f9b <+571>: test rdi,rdi 0x0000000000005f9e <+574>: je 0x5fa5 <main+581> 0x0000000000005fa0 <+576>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005fa5 <+581>: vxorps xmm0,xmm0,xmm0 0x0000000000005fa9 <+585>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 0x0000000000005faf <+591>: lea rsi,[rsp+0x30] 0x0000000000005fb4 <+596>: mov edi,0x1 0x0000000000005fb9 <+601>: call 0x5470 <clock_gettime@plt> 0x0000000000005fbe <+606>: vmovdqa64 zmm5,ZMMWORD PTR [rsp+0x100] 0x0000000000005fc6 <+614>: vprold zmm0,zmm5,0x10 0x0000000000005fcd <+621>: vmovdqa64 zmm4,ZMMWORD PTR [rsp+0x140] 0x0000000000005fd5 <+629>: vprold zmm1,zmm4,0x10 0x0000000000005fdc <+636>: vpminsb zmm2,zmm4,zmm1 0x0000000000005fe2 <+642>: vpminsb zmm3,zmm5,zmm0 0x0000000000005fe8 <+648>: movabs rax,0xcccccccccccccccc 0x0000000000005ff2 <+658>: kmovq k1,rax 0x0000000000005ff7 <+663>: vpmaxsb zmm3{k1},zmm5,zmm0 0x0000000000005ffd <+669>: vpmaxsb zmm2{k1},zmm4,zmm1 0x0000000000006003 <+675>: vbroadcasti32x4 zmm0,XMMWORD PTR [rip+0x578c3] # 0x5d8d0 0x000000000000600d <+685>: vpshufb zmm1,zmm2,zmm0 0x0000000000006013 <+691>: vpshufb zmm0,zmm3,zmm0 0x0000000000006019 <+697>: vpminsb zmm4,zmm3,zmm0 0x000000000000601f <+703>: vpminsb zmm5,zmm2,zmm1 0x0000000000006025 <+709>: movabs rax,0xaaaaaaaaaaaaaaaa 0x000000000000602f <+719>: kmovq k2,rax 0x0000000000006034 <+724>: vpmaxsb zmm5{k2},zmm2,zmm1 0x000000000000603a <+730>: kmovq QWORD PTR [rsp+0x60],k2 0x0000000000006041 <+737>: vpmaxsb zmm4{k2},zmm3,zmm0 0x0000000000006047 <+743>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570ef] # 0x5d140 0x0000000000006051 <+753>: vpermb zmm1,zmm0,zmm4 0x0000000000006057 <+759>: vpermb zmm0,zmm0,zmm5 0x000000000000605d <+765>: vpminsb zmm2,zmm5,zmm0 0x0000000000006063 <+771>: vpminsb zmm3,zmm4,zmm1 0x0000000000006069 <+777>: movabs rax,0xdddd44d4d4dd4444 0x0000000000006073 <+787>: kmovq k2,rax 0x0000000000006078 <+792>: vpmaxsb zmm3{k2},zmm4,zmm1 0x000000000000607e <+798>: vpmaxsb zmm2{k2},zmm5,zmm0 0x0000000000006084 <+804>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570f2] # 0x5d180 0x000000000000608e <+814>: vpermb zmm1,zmm0,zmm2 0x0000000000006094 <+820>: vpermb zmm0,zmm0,zmm3 0x000000000000609a <+826>: vpminsb zmm4,zmm3,zmm0 0x00000000000060a0 <+832>: vpminsb zmm5,zmm2,zmm1 0x00000000000060a6 <+838>: movabs rax,0xff6f9960f9660900 0x00000000000060b0 <+848>: kmovq k2,rax 0x00000000000060b5 <+853>: vpmaxsb zmm5{k2},zmm2,zmm1 0x00000000000060bb <+859>: vpmaxsb zmm4{k2},zmm3,zmm0 0x00000000000060c1 <+865>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570f5] # 0x5d1c0 0x00000000000060cb <+875>: vpermb zmm1,zmm0,zmm4 0x00000000000060d1 <+881>: vpermb zmm0,zmm0,zmm5 0x00000000000060d7 <+887>: vpminsb zmm2,zmm5,zmm0 0x00000000000060dd <+893>: vpminsb zmm3,zmm4,zmm1 0x00000000000060e3 <+899>: movabs rax,0xff96ff9966009600 0x00000000000060ed <+909>: kmovq k2,rax 0x00000000000060f2 <+914>: vpmaxsb zmm3{k2},zmm4,zmm1 0x00000000000060f8 <+920>: vpmaxsb zmm2{k2},zmm5,zmm0 0x00000000000060fe <+926>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570f8] # 0x5d200 0x0000000000006108 <+936>: vpermb zmm1,zmm0,zmm2 0x000000000000610e <+942>: vpermb zmm0,zmm0,zmm3 0x0000000000006114 <+948>: vpminsb zmm4,zmm3,zmm0 0x000000000000611a <+954>: vpminsb zmm5,zmm2,zmm1 0x0000000000006120 <+960>: movabs rax,0xf6f96f6f09096090 0x000000000000612a <+970>: kmovq k2,rax 0x000000000000612f <+975>: vpmaxsb zmm5{k2},zmm2,zmm1 0x0000000000006135 <+981>: vpmaxsb zmm4{k2},zmm3,zmm0 0x000000000000613b <+987>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570fb] # 0x5d240 0x0000000000006145 <+997>: vmovdqa64 zmm1,zmm5 0x000000000000614b <+1003>: vpermt2b zmm1,zmm0,zmm4 0x0000000000006151 <+1009>: vpermi2b zmm0,zmm4,zmm5 0x0000000000006157 <+1015>: vpmaxsb zmm2,zmm4,zmm0 0x000000000000615d <+1021>: movabs rax,0x6096960f9696f96 0x0000000000006167 <+1031>: kmovq k2,rax 0x000000000000616c <+1036>: vpminsb zmm2{k2},zmm4,zmm0 0x0000000000006172 <+1042>: vpminsb zmm0,zmm5,zmm1 0x0000000000006178 <+1048>: movabs rax,0x79f6969f06969068 0x0000000000006182 <+1058>: kmovq k2,rax 0x0000000000006187 <+1063>: vpmaxsb zmm0{k2},zmm5,zmm1 0x000000000000618d <+1069>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570e9] # 0x5d280 0x0000000000006197 <+1079>: vpermb zmm3,zmm1,zmm2 0x000000000000619d <+1085>: vpermb zmm1,zmm1,zmm0 0x00000000000061a3 <+1091>: vpmaxsb zmm4,zmm0,zmm1 0x00000000000061a9 <+1097>: movabs rax,0x960f00ff0f96f0 0x00000000000061b3 <+1107>: kmovq k2,rax 0x00000000000061b8 <+1112>: vpminsb zmm4{k2},zmm0,zmm1 0x00000000000061be <+1118>: vpmaxsb zmm0,zmm2,zmm3 0x00000000000061c4 <+1124>: vpminsb zmm0{k2},zmm2,zmm3 0x00000000000061ca <+1130>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570ec] # 0x5d2c0 0x00000000000061d4 <+1140>: vpermb zmm2,zmm1,zmm0 0x00000000000061da <+1146>: vpermb zmm1,zmm1,zmm4 0x00000000000061e0 <+1152>: vpmaxsb zmm3,zmm4,zmm1 0x00000000000061e6 <+1158>: movabs rax,0x690f096f0f6960 0x00000000000061f0 <+1168>: kmovq k2,rax 0x00000000000061f5 <+1173>: vpminsb zmm3{k2},zmm4,zmm1 0x00000000000061fb <+1179>: vpmaxsb zmm1,zmm0,zmm2 0x0000000000006201 <+1185>: vpminsb zmm1{k2},zmm0,zmm2 0x0000000000006207 <+1191>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570ef] # 0x5d300 0x0000000000006211 <+1201>: vpshufb zmm2,zmm1,zmm0 0x0000000000006217 <+1207>: vpshufb zmm0,zmm3,zmm0 0x000000000000621d <+1213>: vpmaxsb zmm4,zmm3,zmm0 0x0000000000006223 <+1219>: movabs rax,0x6069f069f0600 0x000000000000622d <+1229>: kmovq k2,rax 0x0000000000006232 <+1234>: vpminsb zmm4{k2},zmm3,zmm0 0x0000000000006238 <+1240>: vpmaxsb zmm0,zmm1,zmm2 0x000000000000623e <+1246>: vpminsb zmm0{k2},zmm1,zmm2 0x0000000000006244 <+1252>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570f2] # 0x5d340 0x000000000000624e <+1262>: vpermb zmm2,zmm1,zmm0 0x0000000000006254 <+1268>: vpermb zmm1,zmm1,zmm4 0x000000000000625a <+1274>: vpmaxsb zmm3,zmm4,zmm1 0x0000000000006260 <+1280>: movabs rax,0x90f690f69000 0x000000000000626a <+1290>: kmovq k2,rax 0x000000000000626f <+1295>: vpminsb zmm3{k2},zmm4,zmm1 0x0000000000006275 <+1301>: vpmaxsb zmm1,zmm0,zmm2 0x000000000000627b <+1307>: vpminsb zmm1{k2},zmm0,zmm2 0x0000000000006281 <+1313>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570f5] # 0x5d380 0x000000000000628b <+1323>: vpermb zmm2,zmm0,zmm1 0x0000000000006291 <+1329>: vpermb zmm0,zmm0,zmm3 0x0000000000006297 <+1335>: vpmaxsb zmm4,zmm3,zmm0 0x000000000000629d <+1341>: movabs rax,0xe8e0e8e06666 0x00000000000062a7 <+1351>: kmovq k2,rax 0x00000000000062ac <+1356>: vpminsb zmm4{k2},zmm3,zmm0 0x00000000000062b2 <+1362>: vpmaxsb zmm0,zmm1,zmm2 0x00000000000062b8 <+1368>: vpminsb zmm0{k2},zmm1,zmm2 0x00000000000062be <+1374>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570f8] # 0x5d3c0 0x00000000000062c8 <+1384>: vpermb zmm2,zmm1,zmm0 0x00000000000062ce <+1390>: vpermb zmm1,zmm1,zmm4 0x00000000000062d4 <+1396>: vpmaxsb zmm3,zmm4,zmm1 0x00000000000062da <+1402>: movabs rax,0x88800884c6cecce 0x00000000000062e4 <+1412>: kmovq k2,rax 0x00000000000062e9 <+1417>: vpminsb zmm3{k2},zmm4,zmm1 0x00000000000062ef <+1423>: vpmaxsb zmm1,zmm0,zmm2 0x00000000000062f5 <+1429>: vpminsb zmm1{k2},zmm0,zmm2 0x00000000000062fb <+1435>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570fb] # 0x5d400 0x0000000000006305 <+1445>: vmovdqa64 zmm2,zmm1 0x000000000000630b <+1451>: vpermt2b zmm2,zmm0,zmm3 0x0000000000006311 <+1457>: vpermi2b zmm0,zmm3,zmm1 0x0000000000006317 <+1463>: vpmaxsb zmm4,zmm3,zmm0 0x000000000000631d <+1469>: movabs rax,0x4a00ca4cc48cd9ae 0x0000000000006327 <+1479>: kmovq k2,rax 0x000000000000632c <+1484>: vpminsb zmm4{k2},zmm3,zmm0 0x0000000000006332 <+1490>: vpmaxsb zmm0,zmm1,zmm2 0x0000000000006338 <+1496>: movabs rax,0xa00ca4cc48cd9ac 0x0000000000006342 <+1506>: kmovq k2,rax 0x0000000000006347 <+1511>: vpminsb zmm0{k2},zmm1,zmm2 0x000000000000634d <+1517>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570e9] # 0x5d440 0x0000000000006357 <+1527>: vmovdqa64 zmm2,zmm0 0x000000000000635d <+1533>: vpermt2b zmm2,zmm1,zmm4 0x0000000000006363 <+1539>: vpermi2b zmm1,zmm4,zmm0 0x0000000000006369 <+1545>: vpmaxsb zmm3,zmm4,zmm1 0x000000000000636f <+1551>: movabs rax,0x2000246688ca888c 0x0000000000006379 <+1561>: kmovq k2,rax 0x000000000000637e <+1566>: vpminsb zmm3{k2},zmm4,zmm1 0x0000000000006384 <+1572>: vpmaxsb zmm1,zmm0,zmm2 0x000000000000638a <+1578>: movabs rax,0x246688ca8888 0x0000000000006394 <+1588>: kmovq k2,rax 0x0000000000006399 <+1593>: vpminsb zmm1{k2},zmm0,zmm2 0x000000000000639f <+1599>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570d7] # 0x5d480 0x00000000000063a9 <+1609>: vpermb zmm2,zmm0,zmm1 0x00000000000063af <+1615>: vpermb zmm0,zmm0,zmm3 0x00000000000063b5 <+1621>: vpmaxsb zmm4,zmm3,zmm0 0x00000000000063bb <+1627>: movabs rax,0xac88eeca8888 0x00000000000063c5 <+1637>: kmovq k2,rax 0x00000000000063ca <+1642>: vpminsb zmm4{k2},zmm3,zmm0 0x00000000000063d0 <+1648>: vpmaxsb zmm0,zmm1,zmm2 0x00000000000063d6 <+1654>: vpminsb zmm0{k2},zmm1,zmm2 0x00000000000063dc <+1660>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570da] # 0x5d4c0 0x00000000000063e6 <+1670>: vpermb zmm2,zmm1,zmm0 0x00000000000063ec <+1676>: vpermb zmm1,zmm1,zmm4 0x00000000000063f2 <+1682>: vpmaxsb zmm3,zmm4,zmm1 0x00000000000063f8 <+1688>: movabs rax,0x44caaaaaaccc88 0x0000000000006402 <+1698>: kmovq k2,rax 0x0000000000006407 <+1703>: vpminsb zmm3{k2},zmm4,zmm1 0x000000000000640d <+1709>: vpmaxsb zmm1,zmm0,zmm2 0x0000000000006413 <+1715>: vpminsb zmm1{k2},zmm0,zmm2 0x0000000000006419 <+1721>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570dd] # 0x5d500 0x0000000000006423 <+1731>: vpermb zmm2,zmm0,zmm1 0x0000000000006429 <+1737>: vpermb zmm0,zmm0,zmm3 0x000000000000642f <+1743>: vpmaxsb zmm4,zmm3,zmm0 0x0000000000006435 <+1749>: movabs rax,0xaacaaccaacaa88 0x000000000000643f <+1759>: kmovq k2,rax 0x0000000000006444 <+1764>: vpminsb zmm4{k2},zmm3,zmm0 0x000000000000644a <+1770>: vpmaxsb zmm0,zmm1,zmm2 0x0000000000006450 <+1776>: vpminsb zmm0{k2},zmm1,zmm2 0x0000000000006456 <+1782>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x570e0] # 0x5d540 0x0000000000006460 <+1792>: vpermb zmm2,zmm1,zmm0 0x0000000000006466 <+1798>: vpermb zmm1,zmm1,zmm4 0x000000000000646c <+1804>: vpmaxsb zmm3,zmm4,zmm1 0x0000000000006472 <+1810>: movabs rax,0x4ccaccaaccaccc8 0x000000000000647c <+1820>: kmovq k2,rax 0x0000000000006481 <+1825>: vpminsb zmm3{k2},zmm4,zmm1 0x0000000000006487 <+1831>: vpmaxsb zmm1,zmm0,zmm2 0x000000000000648d <+1837>: vpminsb zmm1{k2},zmm0,zmm2 0x0000000000006493 <+1843>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570e3] # 0x5d580 0x000000000000649d <+1853>: vpermb zmm2,zmm0,zmm1 0x00000000000064a3 <+1859>: vpermb zmm0,zmm0,zmm3 0x00000000000064a9 <+1865>: vpmaxsb zmm4,zmm3,zmm0 0x00000000000064af <+1871>: movabs rax,0xaaaaaaaaaaaaaa8 0x00000000000064b9 <+1881>: kmovq k2,rax 0x00000000000064be <+1886>: vpmaxsb zmm5,zmm1,zmm2 0x00000000000064c4 <+1892>: vpminsb zmm5{k2},zmm1,zmm2 0x00000000000064ca <+1898>: movabs rax,0xe000000000000007 0x00000000000064d4 <+1908>: kmovq k3,rax 0x00000000000064d9 <+1913>: vpblendmb zmm1{k3},zmm5,zmm4 0x00000000000064df <+1919>: vpminsb zmm4{k2},zmm3,zmm0 0x00000000000064e5 <+1925>: vpblendmb zmm0{k3},zmm4,zmm5 0x00000000000064eb <+1931>: vpminsb zmm2,zmm4,zmm1 0x00000000000064f1 <+1937>: vpmaxsb zmm2{k3},zmm4,zmm1 0x00000000000064f7 <+1943>: vpmaxsb zmm0,zmm5,zmm0 0x00000000000064fd <+1949>: vshufi64x2 zmm1,zmm2,zmm0,0xee 0x0000000000006504 <+1956>: vinserti64x4 zmm3,zmm2,ymm0,0x1 0x000000000000650b <+1963>: vpmaxsb zmm4,zmm2,zmm3 0x0000000000006511 <+1969>: movabs rax,0xffffffff00000000 0x000000000000651b <+1979>: kmovq k2,rax 0x0000000000006520 <+1984>: vpminsb zmm4{k2},zmm2,zmm3 0x0000000000006526 <+1990>: vpmaxsb zmm0,zmm0,zmm1 0x000000000000652c <+1996>: vmovdqa64 zmm1,ZMMWORD PTR [rip+0x5708a] # 0x5d5c0 0x0000000000006536 <+2006>: vpermi2q zmm1,zmm0,zmm4 0x000000000000653c <+2012>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x570ba] # 0x5d600 0x0000000000006546 <+2022>: vpermi2q zmm2,zmm4,zmm0 0x000000000000654c <+2028>: vpmaxsb zmm3,zmm4,zmm2 0x0000000000006552 <+2034>: movabs rax,0xffff0000ffff0000 0x000000000000655c <+2044>: kmovq k2,rax 0x0000000000006561 <+2049>: vpminsb zmm3{k2},zmm4,zmm2 0x0000000000006567 <+2055>: vpmaxsb zmm2,zmm0,zmm1 0x000000000000656d <+2061>: mov eax,0xffff0000 0x0000000000006572 <+2066>: kmovq k2,rax 0x0000000000006577 <+2071>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x570ff] # 0x5d680 0x0000000000006581 <+2081>: vpermi2q zmm4,zmm3,zmm2 0x0000000000006587 <+2087>: vpminsb zmm2{k2},zmm0,zmm1 0x000000000000658d <+2093>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570a9] # 0x5d640 0x0000000000006597 <+2103>: vpermi2q zmm0,zmm2,zmm3 0x000000000000659d <+2109>: vpmaxsb zmm1,zmm2,zmm0 0x00000000000065a3 <+2115>: movabs rax,0xff00ff00ff00 0x00000000000065ad <+2125>: vpmaxsb zmm5,zmm3,zmm4 0x00000000000065b3 <+2131>: movabs rcx,0xff00ff00ff00ff00 0x00000000000065bd <+2141>: kmovq k2,rcx 0x00000000000065c2 <+2146>: vpminsb zmm5{k2},zmm3,zmm4 0x00000000000065c8 <+2152>: kmovq k2,rax 0x00000000000065cd <+2157>: vmovdqa64 zmm3,ZMMWORD PTR [rip+0x57129] # 0x5d700 0x00000000000065d7 <+2167>: vpermi2d zmm3,zmm5,zmm1 0x00000000000065dd <+2173>: vpminsb zmm1{k2},zmm2,zmm0 0x00000000000065e3 <+2179>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570d3] # 0x5d6c0 0x00000000000065ed <+2189>: vpermi2d zmm0,zmm1,zmm5 0x00000000000065f3 <+2195>: vpmaxsb zmm2,zmm5,zmm3 0x00000000000065f9 <+2201>: movabs rax,0xf0f0f0f0f0f0f0f0 0x0000000000006603 <+2211>: kmovq k2,rax 0x0000000000006608 <+2216>: vpminsb zmm2{k2},zmm5,zmm3 0x000000000000660e <+2222>: vpmaxsb zmm3,zmm1,zmm0 0x0000000000006614 <+2228>: vmovdqa64 zmm4,ZMMWORD PTR [rip+0x57162] # 0x5d780 0x000000000000661e <+2238>: vpermi2w zmm4,zmm2,zmm3 0x0000000000006624 <+2244>: movabs rax,0xf0f0f0f0f0f0f0 0x000000000000662e <+2254>: kmovq k2,rax 0x0000000000006633 <+2259>: vpminsb zmm3{k2},zmm1,zmm0 0x0000000000006639 <+2265>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x570fd] # 0x5d740 0x0000000000006643 <+2275>: vpermi2w zmm0,zmm3,zmm2 0x0000000000006649 <+2281>: mov rbx,QWORD PTR [rsp+0x30] 0x000000000000664e <+2286>: mov rax,QWORD PTR [rsp+0x38] 0x0000000000006653 <+2291>: mov QWORD PTR [rsp+0x58],rax 0x0000000000006658 <+2296>: vpmaxsb zmm5,zmm2,zmm4 0x000000000000665e <+2302>: vpminsb zmm5{k1},zmm2,zmm4 0x0000000000006664 <+2308>: vpmaxsb zmm1,zmm3,zmm0 0x000000000000666a <+2314>: movabs rax,0xccccccccccccccc 0x0000000000006674 <+2324>: kmovq k1,rax 0x0000000000006679 <+2329>: vmovdqa64 zmm2,ZMMWORD PTR [rip+0x5717d] # 0x5d800 0x0000000000006683 <+2339>: vpermi2b zmm2,zmm5,zmm1 0x0000000000006689 <+2345>: vmovdqa64 ZMMWORD PTR [rsp+0x300],zmm2 0x0000000000006691 <+2353>: vpminsb zmm1{k1},zmm3,zmm0 0x0000000000006697 <+2359>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5711f] # 0x5d7c0 0x00000000000066a1 <+2369>: vmovdqa64 ZMMWORD PTR [rsp+0x340],zmm5 0x00000000000066a9 <+2377>: vmovdqa64 ZMMWORD PTR [rsp+0x2c0],zmm1 0x00000000000066b1 <+2385>: vpermi2b zmm0,zmm1,zmm5 0x00000000000066b7 <+2391>: vmovdqa64 ZMMWORD PTR [rsp+0x280],zmm0 0x00000000000066bf <+2399>: vpxor xmm0,xmm0,xmm0 0x00000000000066c3 <+2403>: vmovdqa XMMWORD PTR [rsp+0x40],xmm0 0x00000000000066c9 <+2409>: lea rsi,[rsp+0x40] 0x00000000000066ce <+2414>: mov edi,0x1 0x00000000000066d3 <+2419>: vzeroupper 0x00000000000066d6 <+2422>: call 0x5470 <clock_gettime@plt> 0x00000000000066db <+2427>: mov r13,QWORD PTR [rsp+0x40] 0x00000000000066e0 <+2432>: sub r13,rbx 0x00000000000066e3 <+2435>: mov rbx,QWORD PTR [rsp+0x48] 0x00000000000066e8 <+2440>: mov edi,0x80 0x00000000000066ed <+2445>: call 0x8590 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x00000000000066f2 <+2450>: mov r14,rax 0x00000000000066f5 <+2453>: test rax,rax 0x00000000000066f8 <+2456>: jle 0x670f <main+2479> 0x00000000000066fa <+2458>: mov edi,0x1 0x00000000000066ff <+2463>: mov rsi,r14 0x0000000000006702 <+2466>: call 0x2dae0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006707 <+2471>: mov r15,rax 0x000000000000670a <+2474>: mov r12,r14 0x000000000000670d <+2477>: jmp 0x6715 <main+2485> 0x000000000000670f <+2479>: xor r15d,r15d 0x0000000000006712 <+2482>: xor r12d,r12d 0x0000000000006715 <+2485>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x280] 0x000000000000671d <+2493>: vpmaxsb zmm0,zmm0,ZMMWORD PTR [rsp+0x2c0] 0x0000000000006725 <+2501>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x000000000000672d <+2509>: movabs rax,0x2aaaaaaaaaaaaaaa 0x0000000000006737 <+2519>: kmovq k1,rax 0x000000000000673c <+2524>: kmovq QWORD PTR [rsp+0x50],k1 0x0000000000006743 <+2531>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x300] 0x000000000000674b <+2539>: vpmaxsb zmm0,zmm0,ZMMWORD PTR [rsp+0x340] 0x0000000000006753 <+2547>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x000000000000675b <+2555>: imul r13,r13,0x3b9aca00 0x0000000000006762 <+2562>: sub rbx,QWORD PTR [rsp+0x58] 0x0000000000006767 <+2567>: lea rdx,[rip+0x570d2] # 0x5d840 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x000000000000676e <+2574>: mov ecx,0x80 0x0000000000006773 <+2579>: mov rdi,r15 0x0000000000006776 <+2582>: mov rsi,r14 0x0000000000006779 <+2585>: xor eax,eax 0x000000000000677b <+2587>: vzeroupper 0x000000000000677e <+2590>: call 0x57c0 <snprintf@plt> 0x0000000000006783 <+2595>: cdqe 0x0000000000006785 <+2597>: inc rax 0x0000000000006788 <+2600>: mov QWORD PTR [rsp+0xa0],r15 0x0000000000006790 <+2608>: mov QWORD PTR [rsp+0xa8],rax 0x0000000000006798 <+2616>: mov QWORD PTR [rsp+0xb0],r12 0x00000000000067a0 <+2624>: lea rdx,[rip+0x570b9] # 0x5d860 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x00000000000067a7 <+2631>: lea rdi,[rsp+0x1d8] 0x00000000000067af <+2639>: lea rsi,[rsp+0xa0] 0x00000000000067b7 <+2647>: mov ecx,0x6 0x00000000000067bc <+2652>: call 0xdbe0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000067c1 <+2657>: mov rdi,QWORD PTR [rsp+0xa0] 0x00000000000067c9 <+2665>: test rdi,rdi 0x00000000000067cc <+2668>: je 0x67d3 <main+2675> 0x00000000000067ce <+2670>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000067d3 <+2675>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x140] 0x00000000000067db <+2683>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x280] 0x00000000000067e3 <+2691>: kmovq k1,QWORD PTR [rsp+0x50] 0x00000000000067ea <+2698>: vpminsb zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x2c0] 0x00000000000067f2 <+2706>: vmovdqa64 ZMMWORD PTR [rsp+0x140],zmm0 0x00000000000067fa <+2714>: kmovq k1,QWORD PTR [rsp+0x60] 0x0000000000006801 <+2721>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x0000000000006809 <+2729>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0x300] 0x0000000000006811 <+2737>: vpminsb zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x340] 0x0000000000006819 <+2745>: vmovdqa64 ZMMWORD PTR [rsp+0x100],zmm0 0x0000000000006821 <+2753>: add rbx,r13 0x0000000000006824 <+2756>: mov edi,0x1 0x0000000000006829 <+2761>: mov esi,0x3 0x000000000000682e <+2766>: vzeroupper 0x0000000000006831 <+2769>: call 0x2dae0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006836 <+2774>: xor ecx,ecx 0x0000000000006838 <+2776>: nop DWORD PTR [rax+rax*1+0x0] 0x0000000000006840 <+2784>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006844 <+2788>: inc rcx 0x0000000000006847 <+2791>: cmp rcx,0x3 0x000000000000684b <+2795>: jne 0x6840 <main+2784> 0x000000000000684d <+2797>: mov WORD PTR [rax],0x203a 0x0000000000006852 <+2802>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006856 <+2806>: mov QWORD PTR [rsp+0xb8],rax 0x000000000000685e <+2814>: mov QWORD PTR [rsp+0xc0],0x3 0x000000000000686a <+2826>: mov QWORD PTR [rsp+0xc8],0x3 0x0000000000006876 <+2838>: lea rdi,[rsp+0x1f0] 0x000000000000687e <+2846>: lea rsi,[rsp+0x1d8] 0x0000000000006886 <+2854>: lea rdx,[rsp+0xb8] 0x000000000000688e <+2862>: call 0xd7a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006893 <+2867>: mov rdi,QWORD PTR [rsp+0xb8] 0x000000000000689b <+2875>: test rdi,rdi 0x000000000000689e <+2878>: je 0x68a5 <main+2885> 0x00000000000068a0 <+2880>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000068a5 <+2885>: mov rdi,QWORD PTR [rsp+0x1d8] 0x00000000000068ad <+2893>: test rdi,rdi 0x00000000000068b0 <+2896>: je 0x68b7 <main+2903> 0x00000000000068b2 <+2898>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000068b7 <+2903>: lea r14,[rsp+0x268] 0x00000000000068bf <+2911>: mov rdi,r14 0x00000000000068c2 <+2914>: vmovaps zmm0,ZMMWORD PTR [rsp+0x100] 0x00000000000068ca <+2922>: vmovaps zmm1,ZMMWORD PTR [rsp+0x140] 0x00000000000068d2 <+2930>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si8,_74x26_size=128> 0x00000000000068d7 <+2935>: lea rdi,[rsp+0x208] 0x00000000000068df <+2943>: lea rsi,[rsp+0x1f0] 0x00000000000068e7 <+2951>: mov rdx,r14 0x00000000000068ea <+2954>: vzeroupper 0x00000000000068ed <+2957>: call 0xd7a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000068f2 <+2962>: mov rdi,QWORD PTR [rsp+0x268] 0x00000000000068fa <+2970>: test rdi,rdi 0x00000000000068fd <+2973>: je 0x6904 <main+2980> 0x00000000000068ff <+2975>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006904 <+2980>: mov rdi,QWORD PTR [rsp+0x1f0] 0x000000000000690c <+2988>: test rdi,rdi 0x000000000000690f <+2991>: je 0x6916 <main+2998> 0x0000000000006911 <+2993>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006916 <+2998>: lea rdi,[rsp+0x208] 0x000000000000691e <+3006>: call 0x9040 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006923 <+3011>: mov rdi,QWORD PTR [rsp+0x208] 0x000000000000692b <+3019>: test rdi,rdi 0x000000000000692e <+3022>: je 0x6935 <main+3029> 0x0000000000006930 <+3024>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006935 <+3029>: vmovdqa64 zmm0,ZMMWORD PTR [rsp+0x100] 0x000000000000693d <+3037>: vpaddb zmm0,zmm0,ZMMWORD PTR [rsp+0x140] 0x0000000000006945 <+3045>: vextracti64x4 ymm1,zmm0,0x1 0x000000000000694c <+3052>: vpaddb ymm0,ymm0,ymm1 0x0000000000006950 <+3056>: vextracti128 xmm1,ymm0,0x1 0x0000000000006956 <+3062>: vpaddb xmm0,xmm0,xmm1 0x000000000000695a <+3066>: vpshufd xmm1,xmm0,0xee 0x000000000000695f <+3071>: vpaddb xmm0,xmm0,xmm1 0x0000000000006963 <+3075>: vpxor xmm1,xmm1,xmm1 0x0000000000006967 <+3079>: vpsadbw xmm0,xmm0,xmm1 0x000000000000696b <+3083>: vmovd eax,xmm0 0x000000000000696f <+3087>: mov BYTE PTR [rsp+0x2f],al 0x0000000000006973 <+3091>: lea rcx,[rsp+0x2f] 0x0000000000006978 <+3096>: mov QWORD PTR [rsp+0x68],rcx 0x000000000000697d <+3101>: mov rdi,rbx 0x0000000000006980 <+3104>: vzeroupper 0x0000000000006983 <+3107>: call 0x8590 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006988 <+3112>: mov r14,rax 0x000000000000698b <+3115>: test rax,rax 0x000000000000698e <+3118>: jle 0x69a5 <main+3141> 0x0000000000006990 <+3120>: mov edi,0x1 0x0000000000006995 <+3125>: mov rsi,r14 0x0000000000006998 <+3128>: call 0x2dae0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000699d <+3133>: mov r15,rax 0x00000000000069a0 <+3136>: mov r12,r14 0x00000000000069a3 <+3139>: jmp 0x69ab <main+3147> 0x00000000000069a5 <+3141>: xor r15d,r15d 0x00000000000069a8 <+3144>: xor r12d,r12d 0x00000000000069ab <+3147>: lea rdx,[rip+0x56e8e] # 0x5d840 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000069b2 <+3154>: mov rdi,r15 0x00000000000069b5 <+3157>: mov rsi,r14 0x00000000000069b8 <+3160>: mov rcx,rbx 0x00000000000069bb <+3163>: xor eax,eax 0x00000000000069bd <+3165>: call 0x57c0 <snprintf@plt> 0x00000000000069c2 <+3170>: cdqe 0x00000000000069c4 <+3172>: inc rax 0x00000000000069c7 <+3175>: mov QWORD PTR [rsp+0xd0],r15 0x00000000000069cf <+3183>: mov QWORD PTR [rsp+0xd8],rax 0x00000000000069d7 <+3191>: mov QWORD PTR [rsp+0xe0],r12 0x00000000000069df <+3199>: lea rdx,[rip+0x56e8a] # 0x5d870 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x00000000000069e6 <+3206>: lea rdi,[rsp+0x220] 0x00000000000069ee <+3214>: lea rsi,[rsp+0xd0] 0x00000000000069f6 <+3222>: mov ecx,0xb 0x00000000000069fb <+3227>: call 0xdbe0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006a00 <+3232>: mov rdi,QWORD PTR [rsp+0xd0] 0x0000000000006a08 <+3240>: test rdi,rdi 0x0000000000006a0b <+3243>: je 0x6a12 <main+3250> 0x0000000000006a0d <+3245>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006a12 <+3250>: mov edi,0x1 0x0000000000006a17 <+3255>: mov esi,0x4 0x0000000000006a1c <+3260>: call 0x2dae0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006a21 <+3265>: xor ecx,ecx 0x0000000000006a23 <+3267>: data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006a30 <+3280>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006a34 <+3284>: inc rcx 0x0000000000006a37 <+3287>: cmp rcx,0x4 0x0000000000006a3b <+3291>: jne 0x6a30 <main+3280> 0x0000000000006a3d <+3293>: mov DWORD PTR [rax],0x736e20 0x0000000000006a43 <+3299>: mov QWORD PTR [rsp+0xe8],rax 0x0000000000006a4b <+3307>: mov QWORD PTR [rsp+0xf0],0x4 0x0000000000006a57 <+3319>: mov QWORD PTR [rsp+0xf8],0x4 0x0000000000006a63 <+3331>: lea rdi,[rsp+0x238] 0x0000000000006a6b <+3339>: lea rsi,[rsp+0x220] 0x0000000000006a73 <+3347>: lea rdx,[rsp+0xe8] 0x0000000000006a7b <+3355>: call 0xd7a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006a80 <+3360>: mov rdi,QWORD PTR [rsp+0xe8] 0x0000000000006a88 <+3368>: test rdi,rdi 0x0000000000006a8b <+3371>: je 0x6a92 <main+3378> 0x0000000000006a8d <+3373>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006a92 <+3378>: mov rdi,QWORD PTR [rsp+0x220] 0x0000000000006a9a <+3386>: test rdi,rdi 0x0000000000006a9d <+3389>: je 0x6aa4 <main+3396> 0x0000000000006a9f <+3391>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006aa4 <+3396>: lea rdi,[rsp+0x238] 0x0000000000006aac <+3404>: call 0x9040 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006ab1 <+3409>: mov rdi,QWORD PTR [rsp+0x238] 0x0000000000006ab9 <+3417>: test rdi,rdi 0x0000000000006abc <+3420>: je 0x6ac3 <main+3427> 0x0000000000006abe <+3422>: call 0x2db00 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006ac3 <+3427>: call 0x29f00 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006ac8 <+3432>: xor eax,eax 0x0000000000006aca <+3434>: lea rsp,[rbp-0x28] 0x0000000000006ace <+3438>: pop rbx 0x0000000000006acf <+3439>: pop r12 0x0000000000006ad1 <+3441>: pop r13 0x0000000000006ad3 <+3443>: pop r14 0x0000000000006ad5 <+3445>: pop r15 0x0000000000006ad7 <+3447>: pop rbp 0x0000000000006ad8 <+3448>: ret End of assembler dump. --- disassemble/int8_16.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d30 <+0>: push rbp 0x0000000000005d31 <+1>: push r15 0x0000000000005d33 <+3>: push r14 0x0000000000005d35 <+5>: push r13 0x0000000000005d37 <+7>: push r12 0x0000000000005d39 <+9>: push rbx 0x0000000000005d3a <+10>: sub rsp,0x1f8 0x0000000000005d41 <+17>: call 0x2efa0 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d46 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d4a <+26>: mov ebx,0x11 0x0000000000005d4f <+31>: xor r14d,r14d 0x0000000000005d52 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005d60 <+48>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x0000000000005d66 <+54>: call 0x2def0 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d6b <+59>: mov edx,0x64 0x0000000000005d70 <+64>: mov rdi,rax 0x0000000000005d73 <+67>: xor esi,esi 0x0000000000005d75 <+69>: call 0x2e300 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005d7a <+74>: vpbroadcastb xmm0,r14d 0x0000000000005d80 <+80>: vpcmpeqb k1,xmm0,XMMWORD PTR [rip+0x56366] # 0x5c0f0 0x0000000000005d8a <+90>: vmovdqa xmm0,XMMWORD PTR [rsp+0x10] 0x0000000000005d90 <+96>: vpbroadcastb xmm0{k1},eax 0x0000000000005d96 <+102>: dec rbx 0x0000000000005d99 <+105>: inc r14 0x0000000000005d9c <+108>: cmp rbx,0x1 0x0000000000005da0 <+112>: ja 0x5d60 <main+48> 0x0000000000005da2 <+114>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x0000000000005da8 <+120>: mov edi,0x10 0x0000000000005dad <+125>: call 0x7e80 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005db2 <+130>: mov rbx,rax 0x0000000000005db5 <+133>: test rax,rax 0x0000000000005db8 <+136>: jle 0x5dcf <main+159> 0x0000000000005dba <+138>: mov edi,0x1 0x0000000000005dbf <+143>: mov rsi,rbx 0x0000000000005dc2 <+146>: call 0x2d3d0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005dc7 <+151>: mov r14,rax 0x0000000000005dca <+154>: mov r15,rbx 0x0000000000005dcd <+157>: jmp 0x5dd5 <main+165> 0x0000000000005dcf <+159>: xor r14d,r14d 0x0000000000005dd2 <+162>: xor r15d,r15d 0x0000000000005dd5 <+165>: lea rdx,[rip+0x563c4] # 0x5c1a0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005ddc <+172>: mov ecx,0x10 0x0000000000005de1 <+177>: mov rdi,r14 0x0000000000005de4 <+180>: mov rsi,rbx 0x0000000000005de7 <+183>: xor eax,eax 0x0000000000005de9 <+185>: call 0x57c0 <snprintf@plt> 0x0000000000005dee <+190>: cdqe 0x0000000000005df0 <+192>: inc rax 0x0000000000005df3 <+195>: mov QWORD PTR [rsp+0x50],r14 0x0000000000005df8 <+200>: mov QWORD PTR [rsp+0x58],rax 0x0000000000005dfd <+205>: mov QWORD PTR [rsp+0x60],r15 0x0000000000005e02 <+210>: lea rdx,[rip+0x563a7] # 0x5c1b0 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e09 <+217>: lea rdi,[rsp+0x108] 0x0000000000005e11 <+225>: lea rsi,[rsp+0x50] 0x0000000000005e16 <+230>: mov ecx,0x7 0x0000000000005e1b <+235>: call 0xd4d0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e20 <+240>: mov rdi,QWORD PTR [rsp+0x50] 0x0000000000005e25 <+245>: test rdi,rdi 0x0000000000005e28 <+248>: je 0x5e2f <main+255> 0x0000000000005e2a <+250>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e2f <+255>: mov edi,0x1 0x0000000000005e34 <+260>: mov esi,0x3 0x0000000000005e39 <+265>: call 0x2d3d0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e3e <+270>: xor ecx,ecx 0x0000000000005e40 <+272>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005e44 <+276>: inc rcx 0x0000000000005e47 <+279>: cmp rcx,0x3 0x0000000000005e4b <+283>: jne 0x5e40 <main+272> 0x0000000000005e4d <+285>: mov WORD PTR [rax],0x203a 0x0000000000005e52 <+290>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005e56 <+294>: mov QWORD PTR [rsp+0x68],rax 0x0000000000005e5b <+299>: mov QWORD PTR [rsp+0x70],0x3 0x0000000000005e64 <+308>: mov QWORD PTR [rsp+0x78],0x3 0x0000000000005e6d <+317>: lea rdi,[rsp+0x120] 0x0000000000005e75 <+325>: lea rsi,[rsp+0x108] 0x0000000000005e7d <+333>: lea rdx,[rsp+0x68] 0x0000000000005e82 <+338>: call 0xd090 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005e87 <+343>: mov rdi,QWORD PTR [rsp+0x68] 0x0000000000005e8c <+348>: test rdi,rdi 0x0000000000005e8f <+351>: je 0x5e96 <main+358> 0x0000000000005e91 <+353>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e96 <+358>: mov rdi,QWORD PTR [rsp+0x108] 0x0000000000005e9e <+366>: test rdi,rdi 0x0000000000005ea1 <+369>: je 0x5ea8 <main+376> 0x0000000000005ea3 <+371>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ea8 <+376>: lea rbx,[rsp+0x1c8] 0x0000000000005eb0 <+384>: mov rdi,rbx 0x0000000000005eb3 <+387>: vmovaps xmm0,XMMWORD PTR [rsp+0x10] 0x0000000000005eb9 <+393>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si8,_74x26_size=16> 0x0000000000005ebe <+398>: lea rdi,[rsp+0x138] 0x0000000000005ec6 <+406>: lea rsi,[rsp+0x120] 0x0000000000005ece <+414>: mov rdx,rbx 0x0000000000005ed1 <+417>: call 0xd090 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005ed6 <+422>: mov rdi,QWORD PTR [rsp+0x1c8] 0x0000000000005ede <+430>: test rdi,rdi 0x0000000000005ee1 <+433>: je 0x5ee8 <main+440> 0x0000000000005ee3 <+435>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ee8 <+440>: mov rdi,QWORD PTR [rsp+0x120] 0x0000000000005ef0 <+448>: test rdi,rdi 0x0000000000005ef3 <+451>: je 0x5efa <main+458> 0x0000000000005ef5 <+453>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005efa <+458>: lea rdi,[rsp+0x138] 0x0000000000005f02 <+466>: call 0x8930 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f07 <+471>: mov rdi,QWORD PTR [rsp+0x138] 0x0000000000005f0f <+479>: test rdi,rdi 0x0000000000005f12 <+482>: je 0x5f19 <main+489> 0x0000000000005f14 <+484>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f19 <+489>: vxorps xmm0,xmm0,xmm0 0x0000000000005f1d <+493>: vmovaps XMMWORD PTR [rsp+0x20],xmm0 0x0000000000005f23 <+499>: lea rsi,[rsp+0x20] 0x0000000000005f28 <+504>: mov edi,0x1 0x0000000000005f2d <+509>: call 0x5470 <clock_gettime@plt> 0x0000000000005f32 <+514>: vmovdqa xmm2,XMMWORD PTR [rsp+0x10] 0x0000000000005f38 <+520>: vpshufb xmm0,xmm2,XMMWORD PTR [rip+0x561bf] # 0x5c100 0x0000000000005f41 <+529>: vpminsb xmm1,xmm2,xmm0 0x0000000000005f46 <+534>: mov ax,0xf2b0 0x0000000000005f4a <+538>: kmovd k1,eax 0x0000000000005f4e <+542>: vpmaxsb xmm1{k1},xmm2,xmm0 0x0000000000005f54 <+548>: vpshufb xmm0,xmm1,XMMWORD PTR [rip+0x561b3] # 0x5c110 0x0000000000005f5d <+557>: vpminsb xmm2,xmm1,xmm0 0x0000000000005f62 <+562>: mov ax,0xdcc4 0x0000000000005f66 <+566>: kmovd k1,eax 0x0000000000005f6a <+570>: vpmaxsb xmm2{k1},xmm1,xmm0 0x0000000000005f70 <+576>: vpshufb xmm0,xmm2,XMMWORD PTR [rip+0x561a7] # 0x5c120 0x0000000000005f79 <+585>: vpminsb xmm1,xmm2,xmm0 0x0000000000005f7e <+590>: mov ax,0xef08 0x0000000000005f82 <+594>: kmovd k1,eax 0x0000000000005f86 <+598>: vpmaxsb xmm1{k1},xmm2,xmm0 0x0000000000005f8c <+604>: vpshufb xmm0,xmm1,XMMWORD PTR [rip+0x5619b] # 0x5c130 0x0000000000005f95 <+613>: mov rbx,QWORD PTR [rsp+0x20] 0x0000000000005f9a <+618>: vpminsb xmm2,xmm1,xmm0 0x0000000000005f9f <+623>: mov ax,0xb552 0x0000000000005fa3 <+627>: kmovd k1,eax 0x0000000000005fa7 <+631>: vpmaxsb xmm2{k1},xmm1,xmm0 0x0000000000005fad <+637>: vpshufb xmm0,xmm2,XMMWORD PTR [rip+0x5618a] # 0x5c140 0x0000000000005fb6 <+646>: mov r12,QWORD PTR [rsp+0x28] 0x0000000000005fbb <+651>: vpmaxsb xmm1,xmm2,xmm0 0x0000000000005fc0 <+656>: mov ax,0x14d6 0x0000000000005fc4 <+660>: kmovd k1,eax 0x0000000000005fc8 <+664>: vpminsb xmm1{k1},xmm2,xmm0 0x0000000000005fce <+670>: vpshufb xmm0,xmm1,XMMWORD PTR [rip+0x56179] # 0x5c150 0x0000000000005fd7 <+679>: vpmaxsb xmm2,xmm1,xmm0 0x0000000000005fdc <+684>: mov ax,0x24da 0x0000000000005fe0 <+688>: kmovd k1,eax 0x0000000000005fe4 <+692>: vpminsb xmm2{k1},xmm1,xmm0 0x0000000000005fea <+698>: vpshufb xmm0,xmm2,XMMWORD PTR [rip+0x5616d] # 0x5c160 0x0000000000005ff3 <+707>: vpmaxsb xmm1,xmm2,xmm0 0x0000000000005ff8 <+712>: mov ax,0x1554 0x0000000000005ffc <+716>: kmovd k1,eax 0x0000000000006000 <+720>: vpminsb xmm1{k1},xmm2,xmm0 0x0000000000006006 <+726>: vpshufb xmm0,xmm1,XMMWORD PTR [rip+0x56161] # 0x5c170 0x000000000000600f <+735>: vpminsb xmm2,xmm1,xmm0 0x0000000000006014 <+740>: vpmaxsb xmm0,xmm1,xmm0 0x0000000000006019 <+745>: vpblendw xmm0,xmm0,xmm2,0x14 0x000000000000601f <+751>: vmovdqa XMMWORD PTR [rsp+0xf0],xmm0 0x0000000000006028 <+760>: vpshufb xmm0,xmm0,XMMWORD PTR [rip+0x5614f] # 0x5c180 0x0000000000006031 <+769>: vmovdqa XMMWORD PTR [rsp+0xe0],xmm0 0x000000000000603a <+778>: vpxor xmm0,xmm0,xmm0 0x000000000000603e <+782>: vmovdqa XMMWORD PTR [rsp+0x30],xmm0 0x0000000000006044 <+788>: lea rsi,[rsp+0x30] 0x0000000000006049 <+793>: mov edi,0x1 0x000000000000604e <+798>: call 0x5470 <clock_gettime@plt> 0x0000000000006053 <+803>: mov r13,QWORD PTR [rsp+0x30] 0x0000000000006058 <+808>: sub r13,rbx 0x000000000000605b <+811>: mov rbx,QWORD PTR [rsp+0x38] 0x0000000000006060 <+816>: mov edi,0x10 0x0000000000006065 <+821>: call 0x7e80 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000606a <+826>: mov r14,rax 0x000000000000606d <+829>: test rax,rax 0x0000000000006070 <+832>: jle 0x6087 <main+855> 0x0000000000006072 <+834>: mov edi,0x1 0x0000000000006077 <+839>: mov rsi,r14 0x000000000000607a <+842>: call 0x2d3d0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000607f <+847>: mov r15,rax 0x0000000000006082 <+850>: mov rbp,r14 0x0000000000006085 <+853>: jmp 0x608c <main+860> 0x0000000000006087 <+855>: xor r15d,r15d 0x000000000000608a <+858>: xor ebp,ebp 0x000000000000608c <+860>: vmovdqa xmm0,XMMWORD PTR [rsp+0xe0] 0x0000000000006095 <+869>: vpmaxsb xmm0,xmm0,XMMWORD PTR [rsp+0xf0] 0x000000000000609f <+879>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x00000000000060a5 <+885>: mov ax,0xaa8 0x00000000000060a9 <+889>: kmovd k1,eax 0x00000000000060ad <+893>: kmovw WORD PTR [rsp+0xe],k1 0x00000000000060b3 <+899>: imul r13,r13,0x3b9aca00 0x00000000000060ba <+906>: sub rbx,r12 0x00000000000060bd <+909>: lea rdx,[rip+0x560dc] # 0x5c1a0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000060c4 <+916>: mov ecx,0x10 0x00000000000060c9 <+921>: mov rdi,r15 0x00000000000060cc <+924>: mov rsi,r14 0x00000000000060cf <+927>: xor eax,eax 0x00000000000060d1 <+929>: call 0x57c0 <snprintf@plt> 0x00000000000060d6 <+934>: cdqe 0x00000000000060d8 <+936>: inc rax 0x00000000000060db <+939>: mov QWORD PTR [rsp+0x80],r15 0x00000000000060e3 <+947>: mov QWORD PTR [rsp+0x88],rax 0x00000000000060eb <+955>: mov QWORD PTR [rsp+0x90],rbp 0x00000000000060f3 <+963>: lea rdx,[rip+0x560c6] # 0x5c1c0 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x00000000000060fa <+970>: lea rdi,[rsp+0x150] 0x0000000000006102 <+978>: lea rsi,[rsp+0x80] 0x000000000000610a <+986>: mov ecx,0x6 0x000000000000610f <+991>: call 0xd4d0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006114 <+996>: mov rdi,QWORD PTR [rsp+0x80] 0x000000000000611c <+1004>: test rdi,rdi 0x000000000000611f <+1007>: je 0x6126 <main+1014> 0x0000000000006121 <+1009>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006126 <+1014>: vmovdqa xmm0,XMMWORD PTR [rsp+0x10] 0x000000000000612c <+1020>: vmovdqa xmm1,XMMWORD PTR [rsp+0xe0] 0x0000000000006135 <+1029>: kmovw k1,WORD PTR [rsp+0xe] 0x000000000000613b <+1035>: vpminsb xmm0{k1},xmm1,XMMWORD PTR [rsp+0xf0] 0x0000000000006143 <+1043>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x0000000000006149 <+1049>: add rbx,r13 0x000000000000614c <+1052>: mov edi,0x1 0x0000000000006151 <+1057>: mov esi,0x3 0x0000000000006156 <+1062>: call 0x2d3d0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000615b <+1067>: xor ecx,ecx 0x000000000000615d <+1069>: nop DWORD PTR [rax] 0x0000000000006160 <+1072>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006164 <+1076>: inc rcx 0x0000000000006167 <+1079>: cmp rcx,0x3 0x000000000000616b <+1083>: jne 0x6160 <main+1072> 0x000000000000616d <+1085>: mov WORD PTR [rax],0x203a 0x0000000000006172 <+1090>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006176 <+1094>: mov QWORD PTR [rsp+0x98],rax 0x000000000000617e <+1102>: mov QWORD PTR [rsp+0xa0],0x3 0x000000000000618a <+1114>: mov QWORD PTR [rsp+0xa8],0x3 0x0000000000006196 <+1126>: lea rdi,[rsp+0x168] 0x000000000000619e <+1134>: lea rsi,[rsp+0x150] 0x00000000000061a6 <+1142>: lea rdx,[rsp+0x98] 0x00000000000061ae <+1150>: call 0xd090 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000061b3 <+1155>: mov rdi,QWORD PTR [rsp+0x98] 0x00000000000061bb <+1163>: test rdi,rdi 0x00000000000061be <+1166>: je 0x61c5 <main+1173> 0x00000000000061c0 <+1168>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000061c5 <+1173>: mov rdi,QWORD PTR [rsp+0x150] 0x00000000000061cd <+1181>: test rdi,rdi 0x00000000000061d0 <+1184>: je 0x61d7 <main+1191> 0x00000000000061d2 <+1186>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000061d7 <+1191>: lea r14,[rsp+0x1e0] 0x00000000000061df <+1199>: mov rdi,r14 0x00000000000061e2 <+1202>: vmovaps xmm0,XMMWORD PTR [rsp+0x10] 0x00000000000061e8 <+1208>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si8,_74x26_size=16> 0x00000000000061ed <+1213>: lea rdi,[rsp+0x180] 0x00000000000061f5 <+1221>: lea rsi,[rsp+0x168] 0x00000000000061fd <+1229>: mov rdx,r14 0x0000000000006200 <+1232>: call 0xd090 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006205 <+1237>: mov rdi,QWORD PTR [rsp+0x1e0] 0x000000000000620d <+1245>: test rdi,rdi 0x0000000000006210 <+1248>: je 0x6217 <main+1255> 0x0000000000006212 <+1250>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006217 <+1255>: mov rdi,QWORD PTR [rsp+0x168] 0x000000000000621f <+1263>: test rdi,rdi 0x0000000000006222 <+1266>: je 0x6229 <main+1273> 0x0000000000006224 <+1268>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006229 <+1273>: lea rdi,[rsp+0x180] 0x0000000000006231 <+1281>: call 0x8930 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006236 <+1286>: mov rdi,QWORD PTR [rsp+0x180] 0x000000000000623e <+1294>: test rdi,rdi 0x0000000000006241 <+1297>: je 0x6248 <main+1304> 0x0000000000006243 <+1299>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006248 <+1304>: vmovdqa xmm1,XMMWORD PTR [rsp+0x10] 0x000000000000624e <+1310>: vpshufd xmm0,xmm1,0xee 0x0000000000006253 <+1315>: vpaddb xmm0,xmm1,xmm0 0x0000000000006257 <+1319>: vpxor xmm1,xmm1,xmm1 0x000000000000625b <+1323>: vpsadbw xmm0,xmm0,xmm1 0x000000000000625f <+1327>: vmovd eax,xmm0 0x0000000000006263 <+1331>: mov BYTE PTR [rsp+0xd],al 0x0000000000006267 <+1335>: lea rcx,[rsp+0xd] 0x000000000000626c <+1340>: mov QWORD PTR [rsp+0x48],rcx 0x0000000000006271 <+1345>: mov rdi,rbx 0x0000000000006274 <+1348>: call 0x7e80 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006279 <+1353>: mov r14,rax 0x000000000000627c <+1356>: test rax,rax 0x000000000000627f <+1359>: jle 0x6296 <main+1382> 0x0000000000006281 <+1361>: mov edi,0x1 0x0000000000006286 <+1366>: mov rsi,r14 0x0000000000006289 <+1369>: call 0x2d3d0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000628e <+1374>: mov r15,rax 0x0000000000006291 <+1377>: mov r12,r14 0x0000000000006294 <+1380>: jmp 0x629c <main+1388> 0x0000000000006296 <+1382>: xor r15d,r15d 0x0000000000006299 <+1385>: xor r12d,r12d 0x000000000000629c <+1388>: lea rdx,[rip+0x55efd] # 0x5c1a0 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000062a3 <+1395>: mov rdi,r15 0x00000000000062a6 <+1398>: mov rsi,r14 0x00000000000062a9 <+1401>: mov rcx,rbx 0x00000000000062ac <+1404>: xor eax,eax 0x00000000000062ae <+1406>: call 0x57c0 <snprintf@plt> 0x00000000000062b3 <+1411>: cdqe 0x00000000000062b5 <+1413>: inc rax 0x00000000000062b8 <+1416>: mov QWORD PTR [rsp+0xb0],r15 0x00000000000062c0 <+1424>: mov QWORD PTR [rsp+0xb8],rax 0x00000000000062c8 <+1432>: mov QWORD PTR [rsp+0xc0],r12 0x00000000000062d0 <+1440>: lea rdx,[rip+0x55ef9] # 0x5c1d0 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x00000000000062d7 <+1447>: lea rdi,[rsp+0x198] 0x00000000000062df <+1455>: lea rsi,[rsp+0xb0] 0x00000000000062e7 <+1463>: mov ecx,0xb 0x00000000000062ec <+1468>: call 0xd4d0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000062f1 <+1473>: mov rdi,QWORD PTR [rsp+0xb0] 0x00000000000062f9 <+1481>: test rdi,rdi 0x00000000000062fc <+1484>: je 0x6303 <main+1491> 0x00000000000062fe <+1486>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006303 <+1491>: mov edi,0x1 0x0000000000006308 <+1496>: mov esi,0x4 0x000000000000630d <+1501>: call 0x2d3d0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006312 <+1506>: xor ecx,ecx 0x0000000000006314 <+1508>: data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006320 <+1520>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006324 <+1524>: inc rcx 0x0000000000006327 <+1527>: cmp rcx,0x4 0x000000000000632b <+1531>: jne 0x6320 <main+1520> 0x000000000000632d <+1533>: mov DWORD PTR [rax],0x736e20 0x0000000000006333 <+1539>: mov QWORD PTR [rsp+0xc8],rax 0x000000000000633b <+1547>: mov QWORD PTR [rsp+0xd0],0x4 0x0000000000006347 <+1559>: mov QWORD PTR [rsp+0xd8],0x4 0x0000000000006353 <+1571>: lea rdi,[rsp+0x1b0] 0x000000000000635b <+1579>: lea rsi,[rsp+0x198] 0x0000000000006363 <+1587>: lea rdx,[rsp+0xc8] 0x000000000000636b <+1595>: call 0xd090 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006370 <+1600>: mov rdi,QWORD PTR [rsp+0xc8] 0x0000000000006378 <+1608>: test rdi,rdi 0x000000000000637b <+1611>: je 0x6382 <main+1618> 0x000000000000637d <+1613>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006382 <+1618>: mov rdi,QWORD PTR [rsp+0x198] 0x000000000000638a <+1626>: test rdi,rdi 0x000000000000638d <+1629>: je 0x6394 <main+1636> 0x000000000000638f <+1631>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006394 <+1636>: lea rdi,[rsp+0x1b0] 0x000000000000639c <+1644>: call 0x8930 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000063a1 <+1649>: mov rdi,QWORD PTR [rsp+0x1b0] 0x00000000000063a9 <+1657>: test rdi,rdi 0x00000000000063ac <+1660>: je 0x63b3 <main+1667> 0x00000000000063ae <+1662>: call 0x2d3f0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000063b3 <+1667>: call 0x297f0 <KGEN_CompilerRT_DestroyGlobals()> 0x00000000000063b8 <+1672>: xor eax,eax 0x00000000000063ba <+1674>: add rsp,0x1f8 0x00000000000063c1 <+1681>: pop rbx 0x00000000000063c2 <+1682>: pop r12 0x00000000000063c4 <+1684>: pop r13 0x00000000000063c6 <+1686>: pop r14 0x00000000000063c8 <+1688>: pop r15 0x00000000000063ca <+1690>: pop rbp 0x00000000000063cb <+1691>: ret End of assembler dump. --- disassemble/int8_32.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d40 <+0>: push rbp 0x0000000000005d41 <+1>: push r15 0x0000000000005d43 <+3>: push r14 0x0000000000005d45 <+5>: push r13 0x0000000000005d47 <+7>: push r12 0x0000000000005d49 <+9>: push rbx 0x0000000000005d4a <+10>: sub rsp,0x228 0x0000000000005d51 <+17>: call 0x2f0b0 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d56 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d5a <+26>: mov ebx,0x21 0x0000000000005d5f <+31>: xor r14d,r14d 0x0000000000005d62 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005d70 <+48>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x0000000000005d76 <+54>: vzeroupper 0x0000000000005d79 <+57>: call 0x2e000 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d7e <+62>: mov edx,0x64 0x0000000000005d83 <+67>: mov rdi,rax 0x0000000000005d86 <+70>: xor esi,esi 0x0000000000005d88 <+72>: call 0x2e410 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005d8d <+77>: vpbroadcastb ymm0,r14d 0x0000000000005d93 <+83>: vpcmpeqb k1,ymm0,YMMWORD PTR [rip+0x56343] # 0x5c0e0 0x0000000000005d9d <+93>: vmovdqu ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000005da3 <+99>: vpbroadcastb ymm0{k1},eax 0x0000000000005da9 <+105>: dec rbx 0x0000000000005dac <+108>: inc r14 0x0000000000005daf <+111>: cmp rbx,0x1 0x0000000000005db3 <+115>: ja 0x5d70 <main+48> 0x0000000000005db5 <+117>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x0000000000005dbb <+123>: mov edi,0x20 0x0000000000005dc0 <+128>: vzeroupper 0x0000000000005dc3 <+131>: call 0x7f90 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005dc8 <+136>: mov rbx,rax 0x0000000000005dcb <+139>: test rax,rax 0x0000000000005dce <+142>: jle 0x5de5 <main+165> 0x0000000000005dd0 <+144>: mov edi,0x1 0x0000000000005dd5 <+149>: mov rsi,rbx 0x0000000000005dd8 <+152>: call 0x2d4e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005ddd <+157>: mov r14,rax 0x0000000000005de0 <+160>: mov r15,rbx 0x0000000000005de3 <+163>: jmp 0x5deb <main+171> 0x0000000000005de5 <+165>: xor r14d,r14d 0x0000000000005de8 <+168>: xor r15d,r15d 0x0000000000005deb <+171>: lea rdx,[rip+0x5647e] # 0x5c270 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005df2 <+178>: mov ecx,0x20 0x0000000000005df7 <+183>: mov rdi,r14 0x0000000000005dfa <+186>: mov rsi,rbx 0x0000000000005dfd <+189>: xor eax,eax 0x0000000000005dff <+191>: call 0x57c0 <snprintf@plt> 0x0000000000005e04 <+196>: cdqe 0x0000000000005e06 <+198>: inc rax 0x0000000000005e09 <+201>: mov QWORD PTR [rsp+0x60],r14 0x0000000000005e0e <+206>: mov QWORD PTR [rsp+0x68],rax 0x0000000000005e13 <+211>: mov QWORD PTR [rsp+0x70],r15 0x0000000000005e18 <+216>: lea rdx,[rip+0x56461] # 0x5c280 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e1f <+223>: lea rdi,[rsp+0xf0] 0x0000000000005e27 <+231>: lea rsi,[rsp+0x60] 0x0000000000005e2c <+236>: mov ecx,0x7 0x0000000000005e31 <+241>: call 0xd5e0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e36 <+246>: mov rdi,QWORD PTR [rsp+0x60] 0x0000000000005e3b <+251>: test rdi,rdi 0x0000000000005e3e <+254>: je 0x5e45 <main+261> 0x0000000000005e40 <+256>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e45 <+261>: mov edi,0x1 0x0000000000005e4a <+266>: mov esi,0x3 0x0000000000005e4f <+271>: call 0x2d4e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e54 <+276>: xor ecx,ecx 0x0000000000005e56 <+278>: cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005e60 <+288>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005e64 <+292>: inc rcx 0x0000000000005e67 <+295>: cmp rcx,0x3 0x0000000000005e6b <+299>: jne 0x5e60 <main+288> 0x0000000000005e6d <+301>: mov WORD PTR [rax],0x203a 0x0000000000005e72 <+306>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005e76 <+310>: mov QWORD PTR [rsp+0x78],rax 0x0000000000005e7b <+315>: mov QWORD PTR [rsp+0x80],0x3 0x0000000000005e87 <+327>: mov QWORD PTR [rsp+0x88],0x3 0x0000000000005e93 <+339>: lea rdi,[rsp+0x108] 0x0000000000005e9b <+347>: lea rsi,[rsp+0xf0] 0x0000000000005ea3 <+355>: lea rdx,[rsp+0x78] 0x0000000000005ea8 <+360>: call 0xd1a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005ead <+365>: mov rdi,QWORD PTR [rsp+0x78] 0x0000000000005eb2 <+370>: test rdi,rdi 0x0000000000005eb5 <+373>: je 0x5ebc <main+380> 0x0000000000005eb7 <+375>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ebc <+380>: mov rdi,QWORD PTR [rsp+0xf0] 0x0000000000005ec4 <+388>: test rdi,rdi 0x0000000000005ec7 <+391>: je 0x5ece <main+398> 0x0000000000005ec9 <+393>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ece <+398>: lea rbx,[rsp+0x1f8] 0x0000000000005ed6 <+406>: mov rdi,rbx 0x0000000000005ed9 <+409>: vmovups ymm0,YMMWORD PTR [rsp+0x10] 0x0000000000005edf <+415>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si8,_74x26_size=32> 0x0000000000005ee4 <+420>: lea rdi,[rsp+0x120] 0x0000000000005eec <+428>: lea rsi,[rsp+0x108] 0x0000000000005ef4 <+436>: mov rdx,rbx 0x0000000000005ef7 <+439>: vzeroupper 0x0000000000005efa <+442>: call 0xd1a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005eff <+447>: mov rdi,QWORD PTR [rsp+0x1f8] 0x0000000000005f07 <+455>: test rdi,rdi 0x0000000000005f0a <+458>: je 0x5f11 <main+465> 0x0000000000005f0c <+460>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f11 <+465>: mov rdi,QWORD PTR [rsp+0x108] 0x0000000000005f19 <+473>: test rdi,rdi 0x0000000000005f1c <+476>: je 0x5f23 <main+483> 0x0000000000005f1e <+478>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f23 <+483>: lea rdi,[rsp+0x120] 0x0000000000005f2b <+491>: call 0x8a40 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f30 <+496>: mov rdi,QWORD PTR [rsp+0x120] 0x0000000000005f38 <+504>: test rdi,rdi 0x0000000000005f3b <+507>: je 0x5f42 <main+514> 0x0000000000005f3d <+509>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f42 <+514>: vxorps xmm0,xmm0,xmm0 0x0000000000005f46 <+518>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 0x0000000000005f4c <+524>: lea rsi,[rsp+0x30] 0x0000000000005f51 <+529>: mov edi,0x1 0x0000000000005f56 <+534>: call 0x5470 <clock_gettime@plt> 0x0000000000005f5b <+539>: mov rbx,QWORD PTR [rsp+0x30] 0x0000000000005f60 <+544>: vmovdqu ymm2,YMMWORD PTR [rsp+0x10] 0x0000000000005f66 <+550>: vpshufb ymm0,ymm2,YMMWORD PTR [rip+0x56191] # 0x5c100 0x0000000000005f6f <+559>: mov rax,QWORD PTR [rsp+0x38] 0x0000000000005f74 <+564>: mov QWORD PTR [rsp+0x50],rax 0x0000000000005f79 <+569>: vpminsb ymm1,ymm2,ymm0 0x0000000000005f7e <+574>: mov eax,0xaaaaaaaa 0x0000000000005f83 <+579>: kmovd k1,eax 0x0000000000005f87 <+583>: vpmaxsb ymm1{k1},ymm2,ymm0 0x0000000000005f8d <+589>: vprold ymm0,ymm1,0x10 0x0000000000005f94 <+596>: vpminsb ymm2,ymm1,ymm0 0x0000000000005f99 <+601>: vpmaxsb ymm0,ymm1,ymm0 0x0000000000005f9e <+606>: vpblendw ymm0,ymm2,ymm0,0xaa 0x0000000000005fa4 <+612>: vpshufd ymm1,ymm0,0xb1 0x0000000000005fa9 <+617>: vpminsb ymm2,ymm0,ymm1 0x0000000000005fae <+622>: vpmaxsb ymm0,ymm0,ymm1 0x0000000000005fb3 <+627>: vpblendd ymm0,ymm2,ymm0,0xaa 0x0000000000005fb9 <+633>: vpshufd ymm1,ymm0,0x4e 0x0000000000005fbe <+638>: vpminsb ymm2,ymm0,ymm1 0x0000000000005fc3 <+643>: vpmaxsb ymm0,ymm0,ymm1 0x0000000000005fc8 <+648>: vpblendd ymm0,ymm2,ymm0,0xcc 0x0000000000005fce <+654>: vmovdqa ymm1,YMMWORD PTR [rip+0x5614a] # 0x5c120 0x0000000000005fd6 <+662>: vpermb ymm1,ymm1,ymm0 0x0000000000005fdc <+668>: vpminsb ymm2,ymm0,ymm1 0x0000000000005fe1 <+673>: mov eax,0xf7117710 0x0000000000005fe6 <+678>: kmovd k1,eax 0x0000000000005fea <+682>: vpmaxsb ymm2{k1},ymm0,ymm1 0x0000000000005ff0 <+688>: vmovdqa ymm0,YMMWORD PTR [rip+0x56148] # 0x5c140 0x0000000000005ff8 <+696>: vpermb ymm0,ymm0,ymm2 0x0000000000005ffe <+702>: vpmaxsb ymm1,ymm2,ymm0 0x0000000000006003 <+707>: mov eax,0x249a26da 0x0000000000006008 <+712>: kmovd k1,eax 0x000000000000600c <+716>: vpminsb ymm1{k1},ymm2,ymm0 0x0000000000006012 <+722>: vmovdqa ymm0,YMMWORD PTR [rip+0x56146] # 0x5c160 0x000000000000601a <+730>: vpermb ymm0,ymm0,ymm1 0x0000000000006020 <+736>: vpmaxsb ymm2,ymm1,ymm0 0x0000000000006025 <+741>: mov eax,0x2079be 0x000000000000602a <+746>: kmovd k1,eax 0x000000000000602e <+750>: vpminsb ymm2{k1},ymm1,ymm0 0x0000000000006034 <+756>: vmovdqa ymm0,YMMWORD PTR [rip+0x56144] # 0x5c180 0x000000000000603c <+764>: vpermb ymm0,ymm0,ymm2 0x0000000000006042 <+770>: vpmaxsb ymm1,ymm2,ymm0 0x0000000000006047 <+775>: mov eax,0x40edf8 0x000000000000604c <+780>: kmovd k1,eax 0x0000000000006050 <+784>: vpminsb ymm1{k1},ymm2,ymm0 0x0000000000006056 <+790>: vmovdqa ymm0,YMMWORD PTR [rip+0x56142] # 0x5c1a0 0x000000000000605e <+798>: vpermb ymm0,ymm0,ymm1 0x0000000000006064 <+804>: vpmaxsb ymm2,ymm1,ymm0 0x0000000000006069 <+809>: mov eax,0x880deaa 0x000000000000606e <+814>: kmovd k1,eax 0x0000000000006072 <+818>: vpminsb ymm2{k1},ymm1,ymm0 0x0000000000006078 <+824>: vmovdqa ymm0,YMMWORD PTR [rip+0x56140] # 0x5c1c0 0x0000000000006080 <+832>: vpermb ymm0,ymm0,ymm2 0x0000000000006086 <+838>: vpmaxsb ymm1,ymm2,ymm0 0x000000000000608b <+843>: mov eax,0x480fa84 0x0000000000006090 <+848>: kmovd k1,eax 0x0000000000006094 <+852>: vpminsb ymm1{k1},ymm2,ymm0 0x000000000000609a <+858>: vmovdqa ymm0,YMMWORD PTR [rip+0x5613e] # 0x5c1e0 0x00000000000060a2 <+866>: vpermb ymm0,ymm0,ymm1 0x00000000000060a8 <+872>: vpmaxsb ymm2,ymm1,ymm0 0x00000000000060ad <+877>: mov eax,0x818e644 0x00000000000060b2 <+882>: kmovd k1,eax 0x00000000000060b6 <+886>: vpminsb ymm2{k1},ymm1,ymm0 0x00000000000060bc <+892>: vmovdqa ymm0,YMMWORD PTR [rip+0x5613c] # 0x5c200 0x00000000000060c4 <+900>: vpermb ymm0,ymm0,ymm2 0x00000000000060ca <+906>: vpmaxsb ymm1,ymm2,ymm0 0x00000000000060cf <+911>: mov eax,0x22ccb20 0x00000000000060d4 <+916>: kmovd k1,eax 0x00000000000060d8 <+920>: vpminsb ymm1{k1},ymm2,ymm0 0x00000000000060de <+926>: vmovdqa ymm0,YMMWORD PTR [rip+0x5613a] # 0x5c220 0x00000000000060e6 <+934>: vpermb ymm0,ymm0,ymm1 0x00000000000060ec <+940>: vpmaxsb ymm2,ymm1,ymm0 0x00000000000060f1 <+945>: mov eax,0x54aad48 0x00000000000060f6 <+950>: kmovd k1,eax 0x00000000000060fa <+954>: vpminsb ymm2{k1},ymm1,ymm0 0x0000000000006100 <+960>: vmovdqa ymm0,YMMWORD PTR [rip+0x56138] # 0x5c240 0x0000000000006108 <+968>: vmovdqu YMMWORD PTR [rsp+0x1d0],ymm2 0x0000000000006111 <+977>: vpermb ymm0,ymm0,ymm2 0x0000000000006117 <+983>: vmovdqu YMMWORD PTR [rsp+0x1b0],ymm0 0x0000000000006120 <+992>: mov ebp,0xaaaaaa8 0x0000000000006125 <+997>: vpxor xmm0,xmm0,xmm0 0x0000000000006129 <+1001>: vmovdqa XMMWORD PTR [rsp+0x40],xmm0 0x000000000000612f <+1007>: lea rsi,[rsp+0x40] 0x0000000000006134 <+1012>: mov edi,0x1 0x0000000000006139 <+1017>: vzeroupper 0x000000000000613c <+1020>: call 0x5470 <clock_gettime@plt> 0x0000000000006141 <+1025>: mov r13,QWORD PTR [rsp+0x40] 0x0000000000006146 <+1030>: sub r13,rbx 0x0000000000006149 <+1033>: mov rbx,QWORD PTR [rsp+0x48] 0x000000000000614e <+1038>: mov edi,0x20 0x0000000000006153 <+1043>: call 0x7f90 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006158 <+1048>: mov r14,rax 0x000000000000615b <+1051>: test rax,rax 0x000000000000615e <+1054>: jle 0x6175 <main+1077> 0x0000000000006160 <+1056>: mov edi,0x1 0x0000000000006165 <+1061>: mov rsi,r14 0x0000000000006168 <+1064>: call 0x2d4e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000616d <+1069>: mov r15,rax 0x0000000000006170 <+1072>: mov r12,r14 0x0000000000006173 <+1075>: jmp 0x617b <main+1083> 0x0000000000006175 <+1077>: xor r15d,r15d 0x0000000000006178 <+1080>: xor r12d,r12d 0x000000000000617b <+1083>: vmovdqu ymm0,YMMWORD PTR [rsp+0x1b0] 0x0000000000006184 <+1092>: vpmaxsb ymm0,ymm0,YMMWORD PTR [rsp+0x1d0] 0x000000000000618e <+1102>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x0000000000006194 <+1108>: kmovd k1,ebp 0x0000000000006198 <+1112>: kmovd DWORD PTR [rsp+0xc],k1 0x000000000000619f <+1119>: imul r13,r13,0x3b9aca00 0x00000000000061a6 <+1126>: sub rbx,QWORD PTR [rsp+0x50] 0x00000000000061ab <+1131>: lea rdx,[rip+0x560be] # 0x5c270 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000061b2 <+1138>: mov ecx,0x20 0x00000000000061b7 <+1143>: mov rdi,r15 0x00000000000061ba <+1146>: mov rsi,r14 0x00000000000061bd <+1149>: xor eax,eax 0x00000000000061bf <+1151>: vzeroupper 0x00000000000061c2 <+1154>: call 0x57c0 <snprintf@plt> 0x00000000000061c7 <+1159>: cdqe 0x00000000000061c9 <+1161>: inc rax 0x00000000000061cc <+1164>: mov QWORD PTR [rsp+0x90],r15 0x00000000000061d4 <+1172>: mov QWORD PTR [rsp+0x98],rax 0x00000000000061dc <+1180>: mov QWORD PTR [rsp+0xa0],r12 0x00000000000061e4 <+1188>: lea rdx,[rip+0x560a5] # 0x5c290 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x00000000000061eb <+1195>: lea rdi,[rsp+0x138] 0x00000000000061f3 <+1203>: lea rsi,[rsp+0x90] 0x00000000000061fb <+1211>: mov ecx,0x6 0x0000000000006200 <+1216>: call 0xd5e0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006205 <+1221>: mov rdi,QWORD PTR [rsp+0x90] 0x000000000000620d <+1229>: test rdi,rdi 0x0000000000006210 <+1232>: je 0x6217 <main+1239> 0x0000000000006212 <+1234>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006217 <+1239>: vmovdqu ymm0,YMMWORD PTR [rsp+0x10] 0x000000000000621d <+1245>: vmovdqu ymm1,YMMWORD PTR [rsp+0x1b0] 0x0000000000006226 <+1254>: kmovd k1,DWORD PTR [rsp+0xc] 0x000000000000622d <+1261>: vpminsb ymm0{k1},ymm1,YMMWORD PTR [rsp+0x1d0] 0x0000000000006238 <+1272>: vmovdqu YMMWORD PTR [rsp+0x10],ymm0 0x000000000000623e <+1278>: add rbx,r13 0x0000000000006241 <+1281>: mov edi,0x1 0x0000000000006246 <+1286>: mov esi,0x3 0x000000000000624b <+1291>: vzeroupper 0x000000000000624e <+1294>: call 0x2d4e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006253 <+1299>: xor ecx,ecx 0x0000000000006255 <+1301>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006260 <+1312>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006264 <+1316>: inc rcx 0x0000000000006267 <+1319>: cmp rcx,0x3 0x000000000000626b <+1323>: jne 0x6260 <main+1312> 0x000000000000626d <+1325>: mov WORD PTR [rax],0x203a 0x0000000000006272 <+1330>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006276 <+1334>: mov QWORD PTR [rsp+0xa8],rax 0x000000000000627e <+1342>: mov QWORD PTR [rsp+0xb0],0x3 0x000000000000628a <+1354>: mov QWORD PTR [rsp+0xb8],0x3 0x0000000000006296 <+1366>: lea rdi,[rsp+0x150] 0x000000000000629e <+1374>: lea rsi,[rsp+0x138] 0x00000000000062a6 <+1382>: lea rdx,[rsp+0xa8] 0x00000000000062ae <+1390>: call 0xd1a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000062b3 <+1395>: mov rdi,QWORD PTR [rsp+0xa8] 0x00000000000062bb <+1403>: test rdi,rdi 0x00000000000062be <+1406>: je 0x62c5 <main+1413> 0x00000000000062c0 <+1408>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000062c5 <+1413>: mov rdi,QWORD PTR [rsp+0x138] 0x00000000000062cd <+1421>: test rdi,rdi 0x00000000000062d0 <+1424>: je 0x62d7 <main+1431> 0x00000000000062d2 <+1426>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000062d7 <+1431>: lea r14,[rsp+0x210] 0x00000000000062df <+1439>: mov rdi,r14 0x00000000000062e2 <+1442>: vmovups ymm0,YMMWORD PTR [rsp+0x10] 0x00000000000062e8 <+1448>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si8,_74x26_size=32> 0x00000000000062ed <+1453>: lea rdi,[rsp+0x168] 0x00000000000062f5 <+1461>: lea rsi,[rsp+0x150] 0x00000000000062fd <+1469>: mov rdx,r14 0x0000000000006300 <+1472>: vzeroupper 0x0000000000006303 <+1475>: call 0xd1a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006308 <+1480>: mov rdi,QWORD PTR [rsp+0x210] 0x0000000000006310 <+1488>: test rdi,rdi 0x0000000000006313 <+1491>: je 0x631a <main+1498> 0x0000000000006315 <+1493>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000631a <+1498>: mov rdi,QWORD PTR [rsp+0x150] 0x0000000000006322 <+1506>: test rdi,rdi 0x0000000000006325 <+1509>: je 0x632c <main+1516> 0x0000000000006327 <+1511>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000632c <+1516>: lea rdi,[rsp+0x168] 0x0000000000006334 <+1524>: call 0x8a40 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006339 <+1529>: mov rdi,QWORD PTR [rsp+0x168] 0x0000000000006341 <+1537>: test rdi,rdi 0x0000000000006344 <+1540>: je 0x634b <main+1547> 0x0000000000006346 <+1542>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x000000000000634b <+1547>: vmovdqu ymm1,YMMWORD PTR [rsp+0x10] 0x0000000000006351 <+1553>: vextracti128 xmm0,ymm1,0x1 0x0000000000006357 <+1559>: vpaddb xmm0,xmm1,xmm0 0x000000000000635b <+1563>: vpshufd xmm1,xmm0,0xee 0x0000000000006360 <+1568>: vpaddb xmm0,xmm0,xmm1 0x0000000000006364 <+1572>: vpxor xmm1,xmm1,xmm1 0x0000000000006368 <+1576>: vpsadbw xmm0,xmm0,xmm1 0x000000000000636c <+1580>: vmovd eax,xmm0 0x0000000000006370 <+1584>: mov BYTE PTR [rsp+0xb],al 0x0000000000006374 <+1588>: lea rcx,[rsp+0xb] 0x0000000000006379 <+1593>: mov QWORD PTR [rsp+0x58],rcx 0x000000000000637e <+1598>: mov rdi,rbx 0x0000000000006381 <+1601>: vzeroupper 0x0000000000006384 <+1604>: call 0x7f90 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006389 <+1609>: mov r14,rax 0x000000000000638c <+1612>: test rax,rax 0x000000000000638f <+1615>: jle 0x63a6 <main+1638> 0x0000000000006391 <+1617>: mov edi,0x1 0x0000000000006396 <+1622>: mov rsi,r14 0x0000000000006399 <+1625>: call 0x2d4e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x000000000000639e <+1630>: mov r15,rax 0x00000000000063a1 <+1633>: mov r12,r14 0x00000000000063a4 <+1636>: jmp 0x63ac <main+1644> 0x00000000000063a6 <+1638>: xor r15d,r15d 0x00000000000063a9 <+1641>: xor r12d,r12d 0x00000000000063ac <+1644>: lea rdx,[rip+0x55ebd] # 0x5c270 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x00000000000063b3 <+1651>: mov rdi,r15 0x00000000000063b6 <+1654>: mov rsi,r14 0x00000000000063b9 <+1657>: mov rcx,rbx 0x00000000000063bc <+1660>: xor eax,eax 0x00000000000063be <+1662>: call 0x57c0 <snprintf@plt> 0x00000000000063c3 <+1667>: cdqe 0x00000000000063c5 <+1669>: inc rax 0x00000000000063c8 <+1672>: mov QWORD PTR [rsp+0xc0],r15 0x00000000000063d0 <+1680>: mov QWORD PTR [rsp+0xc8],rax 0x00000000000063d8 <+1688>: mov QWORD PTR [rsp+0xd0],r12 0x00000000000063e0 <+1696>: lea rdx,[rip+0x55eb9] # 0x5c2a0 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x00000000000063e7 <+1703>: lea rdi,[rsp+0x180] 0x00000000000063ef <+1711>: lea rsi,[rsp+0xc0] 0x00000000000063f7 <+1719>: mov ecx,0xb 0x00000000000063fc <+1724>: call 0xd5e0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000006401 <+1729>: mov rdi,QWORD PTR [rsp+0xc0] 0x0000000000006409 <+1737>: test rdi,rdi 0x000000000000640c <+1740>: je 0x6413 <main+1747> 0x000000000000640e <+1742>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006413 <+1747>: mov edi,0x1 0x0000000000006418 <+1752>: mov esi,0x4 0x000000000000641d <+1757>: call 0x2d4e0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006422 <+1762>: xor ecx,ecx 0x0000000000006424 <+1764>: data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006430 <+1776>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006434 <+1780>: inc rcx 0x0000000000006437 <+1783>: cmp rcx,0x4 0x000000000000643b <+1787>: jne 0x6430 <main+1776> 0x000000000000643d <+1789>: mov DWORD PTR [rax],0x736e20 0x0000000000006443 <+1795>: mov QWORD PTR [rsp+0xd8],rax 0x000000000000644b <+1803>: mov QWORD PTR [rsp+0xe0],0x4 0x0000000000006457 <+1815>: mov QWORD PTR [rsp+0xe8],0x4 0x0000000000006463 <+1827>: lea rdi,[rsp+0x198] 0x000000000000646b <+1835>: lea rsi,[rsp+0x180] 0x0000000000006473 <+1843>: lea rdx,[rsp+0xd8] 0x000000000000647b <+1851>: call 0xd1a0 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006480 <+1856>: mov rdi,QWORD PTR [rsp+0xd8] 0x0000000000006488 <+1864>: test rdi,rdi 0x000000000000648b <+1867>: je 0x6492 <main+1874> 0x000000000000648d <+1869>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006492 <+1874>: mov rdi,QWORD PTR [rsp+0x180] 0x000000000000649a <+1882>: test rdi,rdi 0x000000000000649d <+1885>: je 0x64a4 <main+1892> 0x000000000000649f <+1887>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064a4 <+1892>: lea rdi,[rsp+0x198] 0x00000000000064ac <+1900>: call 0x8a40 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000064b1 <+1905>: mov rdi,QWORD PTR [rsp+0x198] 0x00000000000064b9 <+1913>: test rdi,rdi 0x00000000000064bc <+1916>: je 0x64c3 <main+1923> 0x00000000000064be <+1918>: call 0x2d500 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064c3 <+1923>: call 0x29900 <KGEN_CompilerRT_DestroyGlobals()> 0x00000000000064c8 <+1928>: xor eax,eax 0x00000000000064ca <+1930>: add rsp,0x228 0x00000000000064d1 <+1937>: pop rbx 0x00000000000064d2 <+1938>: pop r12 0x00000000000064d4 <+1940>: pop r13 0x00000000000064d6 <+1942>: pop r14 0x00000000000064d8 <+1944>: pop r15 0x00000000000064da <+1946>: pop rbp 0x00000000000064db <+1947>: ret End of assembler dump. --- disassemble/int8_64.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x0000000000005d40 <+0>: push rbp 0x0000000000005d41 <+1>: push r15 0x0000000000005d43 <+3>: push r14 0x0000000000005d45 <+5>: push r13 0x0000000000005d47 <+7>: push r12 0x0000000000005d49 <+9>: push rbx 0x0000000000005d4a <+10>: sub rsp,0x298 0x0000000000005d51 <+17>: call 0x2f280 <KGEN_CompilerRT_SetArgV(int, char**)> 0x0000000000005d56 <+22>: vpxor xmm0,xmm0,xmm0 0x0000000000005d5a <+26>: mov ebx,0x41 0x0000000000005d5f <+31>: xor r14d,r14d 0x0000000000005d62 <+34>: data16 data16 data16 data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005d70 <+48>: vmovdqu64 ZMMWORD PTR [rsp+0xe0],zmm0 0x0000000000005d7b <+59>: vzeroupper 0x0000000000005d7e <+62>: call 0x2e1d0 <KGEN_CompilerRT_GetRandomState()> 0x0000000000005d83 <+67>: mov edx,0x64 0x0000000000005d88 <+72>: mov rdi,rax 0x0000000000005d8b <+75>: xor esi,esi 0x0000000000005d8d <+77>: call 0x2e5e0 <KGEN_CompilerRT_RandomUInt64(std::default_random_engine*, uint64_t, uint64_t)> 0x0000000000005d92 <+82>: vpbroadcastb zmm0,r14d 0x0000000000005d98 <+88>: vpcmpeqb k1,zmm0,ZMMWORD PTR [rip+0x5735e] # 0x5d100 0x0000000000005da2 <+98>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0xe0] 0x0000000000005dad <+109>: vpbroadcastb zmm0{k1},eax 0x0000000000005db3 <+115>: dec rbx 0x0000000000005db6 <+118>: inc r14 0x0000000000005db9 <+121>: cmp rbx,0x1 0x0000000000005dbd <+125>: ja 0x5d70 <main+48> 0x0000000000005dbf <+127>: vmovdqu64 ZMMWORD PTR [rsp+0xe0],zmm0 0x0000000000005dca <+138>: mov edi,0x40 0x0000000000005dcf <+143>: vzeroupper 0x0000000000005dd2 <+146>: call 0x8160 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000005dd7 <+151>: mov rbx,rax 0x0000000000005dda <+154>: test rax,rax 0x0000000000005ddd <+157>: jle 0x5df4 <main+180> 0x0000000000005ddf <+159>: mov edi,0x1 0x0000000000005de4 <+164>: mov rsi,rbx 0x0000000000005de7 <+167>: call 0x2d6b0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005dec <+172>: mov r14,rax 0x0000000000005def <+175>: mov r15,rbx 0x0000000000005df2 <+178>: jmp 0x5dfa <main+186> 0x0000000000005df4 <+180>: xor r14d,r14d 0x0000000000005df7 <+183>: xor r15d,r15d 0x0000000000005dfa <+186>: lea rdx,[rip+0x577ff] # 0x5d600 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000005e01 <+193>: mov ecx,0x40 0x0000000000005e06 <+198>: mov rdi,r14 0x0000000000005e09 <+201>: mov rsi,rbx 0x0000000000005e0c <+204>: xor eax,eax 0x0000000000005e0e <+206>: call 0x57c0 <snprintf@plt> 0x0000000000005e13 <+211>: cdqe 0x0000000000005e15 <+213>: inc rax 0x0000000000005e18 <+216>: mov QWORD PTR [rsp+0x50],r14 0x0000000000005e1d <+221>: mov QWORD PTR [rsp+0x58],rax 0x0000000000005e22 <+226>: mov QWORD PTR [rsp+0x60],r15 0x0000000000005e27 <+231>: lea rdx,[rip+0x577e2] # 0x5d610 <static_string_c71d13d8b468fdd8211f7298b526a0bbfbff801f9ca2d77aee18dd1ab02c675b> 0x0000000000005e2e <+238>: lea rdi,[rsp+0x120] 0x0000000000005e36 <+246>: lea rsi,[rsp+0x50] 0x0000000000005e3b <+251>: mov ecx,0x7 0x0000000000005e40 <+256>: call 0xd7b0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x0000000000005e45 <+261>: mov rdi,QWORD PTR [rsp+0x50] 0x0000000000005e4a <+266>: test rdi,rdi 0x0000000000005e4d <+269>: je 0x5e54 <main+276> 0x0000000000005e4f <+271>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005e54 <+276>: mov edi,0x1 0x0000000000005e59 <+281>: mov esi,0x3 0x0000000000005e5e <+286>: call 0x2d6b0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000005e63 <+291>: xor ecx,ecx 0x0000000000005e65 <+293>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000005e70 <+304>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000005e74 <+308>: inc rcx 0x0000000000005e77 <+311>: cmp rcx,0x3 0x0000000000005e7b <+315>: jne 0x5e70 <main+304> 0x0000000000005e7d <+317>: mov WORD PTR [rax],0x203a 0x0000000000005e82 <+322>: mov BYTE PTR [rax+0x2],0x0 0x0000000000005e86 <+326>: mov QWORD PTR [rsp+0x68],rax 0x0000000000005e8b <+331>: mov QWORD PTR [rsp+0x70],0x3 0x0000000000005e94 <+340>: mov QWORD PTR [rsp+0x78],0x3 0x0000000000005e9d <+349>: lea rdi,[rsp+0x138] 0x0000000000005ea5 <+357>: lea rsi,[rsp+0x120] 0x0000000000005ead <+365>: lea rdx,[rsp+0x68] 0x0000000000005eb2 <+370>: call 0xd370 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005eb7 <+375>: mov rdi,QWORD PTR [rsp+0x68] 0x0000000000005ebc <+380>: test rdi,rdi 0x0000000000005ebf <+383>: je 0x5ec6 <main+390> 0x0000000000005ec1 <+385>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ec6 <+390>: mov rdi,QWORD PTR [rsp+0x120] 0x0000000000005ece <+398>: test rdi,rdi 0x0000000000005ed1 <+401>: je 0x5ed8 <main+408> 0x0000000000005ed3 <+403>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005ed8 <+408>: lea rbx,[rsp+0x1e0] 0x0000000000005ee0 <+416>: mov rdi,rbx 0x0000000000005ee3 <+419>: vmovups zmm0,ZMMWORD PTR [rsp+0xe0] 0x0000000000005eee <+430>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si8,_74x26_size=64> 0x0000000000005ef3 <+435>: lea rdi,[rsp+0x150] 0x0000000000005efb <+443>: lea rsi,[rsp+0x138] 0x0000000000005f03 <+451>: mov rdx,rbx 0x0000000000005f06 <+454>: vzeroupper 0x0000000000005f09 <+457>: call 0xd370 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000005f0e <+462>: mov rdi,QWORD PTR [rsp+0x1e0] 0x0000000000005f16 <+470>: test rdi,rdi 0x0000000000005f19 <+473>: je 0x5f20 <main+480> 0x0000000000005f1b <+475>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f20 <+480>: mov rdi,QWORD PTR [rsp+0x138] 0x0000000000005f28 <+488>: test rdi,rdi 0x0000000000005f2b <+491>: je 0x5f32 <main+498> 0x0000000000005f2d <+493>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f32 <+498>: lea rdi,[rsp+0x150] 0x0000000000005f3a <+506>: call 0x8c10 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000005f3f <+511>: mov rdi,QWORD PTR [rsp+0x150] 0x0000000000005f47 <+519>: test rdi,rdi 0x0000000000005f4a <+522>: je 0x5f51 <main+529> 0x0000000000005f4c <+524>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000005f51 <+529>: vxorps xmm0,xmm0,xmm0 0x0000000000005f55 <+533>: vmovaps XMMWORD PTR [rsp+0x10],xmm0 0x0000000000005f5b <+539>: lea rsi,[rsp+0x10] 0x0000000000005f60 <+544>: mov edi,0x1 0x0000000000005f65 <+549>: call 0x5470 <clock_gettime@plt> 0x0000000000005f6a <+554>: mov rbx,QWORD PTR [rsp+0x10] 0x0000000000005f6f <+559>: vmovdqu64 zmm2,ZMMWORD PTR [rsp+0xe0] 0x0000000000005f7a <+570>: vprold zmm0,zmm2,0x10 0x0000000000005f81 <+577>: vpminsb zmm1,zmm2,zmm0 0x0000000000005f87 <+583>: movabs rax,0xcccccccccccccccc 0x0000000000005f91 <+593>: kmovq k1,rax 0x0000000000005f96 <+598>: vpmaxsb zmm1{k1},zmm2,zmm0 0x0000000000005f9c <+604>: vpshufb zmm0,zmm1,ZMMWORD PTR [rip+0x5719a] # 0x5d140 0x0000000000005fa6 <+614>: vpminsb zmm2,zmm1,zmm0 0x0000000000005fac <+620>: movabs rax,0xaaaaaaaaaaaaaaaa 0x0000000000005fb6 <+630>: kmovq k1,rax 0x0000000000005fbb <+635>: vpmaxsb zmm2{k1},zmm1,zmm0 0x0000000000005fc1 <+641>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x571b5] # 0x5d180 0x0000000000005fcb <+651>: vpermb zmm0,zmm0,zmm2 0x0000000000005fd1 <+657>: vpminsb zmm1,zmm2,zmm0 0x0000000000005fd7 <+663>: movabs rax,0xdddd44d4d4dd4444 0x0000000000005fe1 <+673>: kmovq k1,rax 0x0000000000005fe6 <+678>: vpmaxsb zmm1{k1},zmm2,zmm0 0x0000000000005fec <+684>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x571ca] # 0x5d1c0 0x0000000000005ff6 <+694>: vpermb zmm0,zmm0,zmm1 0x0000000000005ffc <+700>: vpminsb zmm2,zmm1,zmm0 0x0000000000006002 <+706>: movabs rax,0xff6f9960f9660900 0x000000000000600c <+716>: kmovq k1,rax 0x0000000000006011 <+721>: vpmaxsb zmm2{k1},zmm1,zmm0 0x0000000000006017 <+727>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x571df] # 0x5d200 0x0000000000006021 <+737>: vpermb zmm0,zmm0,zmm2 0x0000000000006027 <+743>: vpminsb zmm1,zmm2,zmm0 0x000000000000602d <+749>: movabs rax,0xff96ff9966009600 0x0000000000006037 <+759>: kmovq k1,rax 0x000000000000603c <+764>: vpmaxsb zmm1{k1},zmm2,zmm0 0x0000000000006042 <+770>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x571f4] # 0x5d240 0x000000000000604c <+780>: vpermb zmm0,zmm0,zmm1 0x0000000000006052 <+786>: vpminsb zmm2,zmm1,zmm0 0x0000000000006058 <+792>: movabs rax,0xf6f96f6f09096090 0x0000000000006062 <+802>: kmovq k1,rax 0x0000000000006067 <+807>: vpmaxsb zmm2{k1},zmm1,zmm0 0x000000000000606d <+813>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57209] # 0x5d280 0x0000000000006077 <+823>: vpermb zmm0,zmm0,zmm2 0x000000000000607d <+829>: vpmaxsb zmm1,zmm2,zmm0 0x0000000000006083 <+835>: movabs rax,0x6096960f9696f96 0x000000000000608d <+845>: kmovq k1,rax 0x0000000000006092 <+850>: vpminsb zmm1{k1},zmm2,zmm0 0x0000000000006098 <+856>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5721e] # 0x5d2c0 0x00000000000060a2 <+866>: vpermb zmm0,zmm0,zmm1 0x00000000000060a8 <+872>: vpmaxsb zmm2,zmm1,zmm0 0x00000000000060ae <+878>: movabs rax,0x960f00ff0f96f0 0x00000000000060b8 <+888>: kmovq k1,rax 0x00000000000060bd <+893>: vpminsb zmm2{k1},zmm1,zmm0 0x00000000000060c3 <+899>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57233] # 0x5d300 0x00000000000060cd <+909>: vpermb zmm0,zmm0,zmm2 0x00000000000060d3 <+915>: vpmaxsb zmm1,zmm2,zmm0 0x00000000000060d9 <+921>: movabs rax,0x690f096f0f6960 0x00000000000060e3 <+931>: kmovq k1,rax 0x00000000000060e8 <+936>: vpminsb zmm1{k1},zmm2,zmm0 0x00000000000060ee <+942>: vpshufb zmm0,zmm1,ZMMWORD PTR [rip+0x57248] # 0x5d340 0x00000000000060f8 <+952>: mov rax,QWORD PTR [rsp+0x18] 0x00000000000060fd <+957>: mov QWORD PTR [rsp+0x40],rax 0x0000000000006102 <+962>: vpmaxsb zmm2,zmm1,zmm0 0x0000000000006108 <+968>: movabs rax,0x6069f069f0600 0x0000000000006112 <+978>: kmovq k1,rax 0x0000000000006117 <+983>: vpminsb zmm2{k1},zmm1,zmm0 0x000000000000611d <+989>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57259] # 0x5d380 0x0000000000006127 <+999>: vpermb zmm0,zmm0,zmm2 0x000000000000612d <+1005>: vpmaxsb zmm1,zmm2,zmm0 0x0000000000006133 <+1011>: movabs rax,0x90f690f69000 0x000000000000613d <+1021>: kmovq k1,rax 0x0000000000006142 <+1026>: vpminsb zmm1{k1},zmm2,zmm0 0x0000000000006148 <+1032>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x5726e] # 0x5d3c0 0x0000000000006152 <+1042>: vpermb zmm0,zmm0,zmm1 0x0000000000006158 <+1048>: vpmaxsb zmm2,zmm1,zmm0 0x000000000000615e <+1054>: movabs rax,0xe8e0e8e06666 0x0000000000006168 <+1064>: kmovq k1,rax 0x000000000000616d <+1069>: vpminsb zmm2{k1},zmm1,zmm0 0x0000000000006173 <+1075>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57283] # 0x5d400 0x000000000000617d <+1085>: vpermb zmm0,zmm0,zmm2 0x0000000000006183 <+1091>: vpmaxsb zmm1,zmm2,zmm0 0x0000000000006189 <+1097>: movabs rax,0x88800884c6cecce 0x0000000000006193 <+1107>: kmovq k1,rax 0x0000000000006198 <+1112>: vpminsb zmm1{k1},zmm2,zmm0 0x000000000000619e <+1118>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57298] # 0x5d440 0x00000000000061a8 <+1128>: vpermb zmm0,zmm0,zmm1 0x00000000000061ae <+1134>: vpmaxsb zmm2,zmm1,zmm0 0x00000000000061b4 <+1140>: movabs rax,0xa00ca4cc48cd9ac 0x00000000000061be <+1150>: kmovq k1,rax 0x00000000000061c3 <+1155>: vpminsb zmm2{k1},zmm1,zmm0 0x00000000000061c9 <+1161>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x572ad] # 0x5d480 0x00000000000061d3 <+1171>: vpermb zmm0,zmm0,zmm2 0x00000000000061d9 <+1177>: vpmaxsb zmm1,zmm2,zmm0 0x00000000000061df <+1183>: movabs rax,0x246688ca8888 0x00000000000061e9 <+1193>: kmovq k1,rax 0x00000000000061ee <+1198>: vpminsb zmm1{k1},zmm2,zmm0 0x00000000000061f4 <+1204>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x572c2] # 0x5d4c0 0x00000000000061fe <+1214>: vpermb zmm0,zmm0,zmm1 0x0000000000006204 <+1220>: vpmaxsb zmm2,zmm1,zmm0 0x000000000000620a <+1226>: movabs rax,0xac88eeca8888 0x0000000000006214 <+1236>: kmovq k1,rax 0x0000000000006219 <+1241>: vpminsb zmm2{k1},zmm1,zmm0 0x000000000000621f <+1247>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x572d7] # 0x5d500 0x0000000000006229 <+1257>: vpermb zmm0,zmm0,zmm2 0x000000000000622f <+1263>: vpmaxsb zmm1,zmm2,zmm0 0x0000000000006235 <+1269>: movabs rax,0x44caaaaaaccc88 0x000000000000623f <+1279>: kmovq k1,rax 0x0000000000006244 <+1284>: vpminsb zmm1{k1},zmm2,zmm0 0x000000000000624a <+1290>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x572ec] # 0x5d540 0x0000000000006254 <+1300>: vpermb zmm0,zmm0,zmm1 0x000000000000625a <+1306>: vpmaxsb zmm2,zmm1,zmm0 0x0000000000006260 <+1312>: movabs rax,0xaacaaccaacaa88 0x000000000000626a <+1322>: kmovq k1,rax 0x000000000000626f <+1327>: vpminsb zmm2{k1},zmm1,zmm0 0x0000000000006275 <+1333>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57301] # 0x5d580 0x000000000000627f <+1343>: vpermb zmm0,zmm0,zmm2 0x0000000000006285 <+1349>: vpmaxsb zmm1,zmm2,zmm0 0x000000000000628b <+1355>: movabs rax,0x4ccaccaaccaccc8 0x0000000000006295 <+1365>: kmovq k1,rax 0x000000000000629a <+1370>: vpminsb zmm1{k1},zmm2,zmm0 0x00000000000062a0 <+1376>: vmovdqa64 zmm0,ZMMWORD PTR [rip+0x57316] # 0x5d5c0 0x00000000000062aa <+1386>: vmovdqu64 ZMMWORD PTR [rsp+0x250],zmm1 0x00000000000062b5 <+1397>: vpermb zmm0,zmm0,zmm1 0x00000000000062bb <+1403>: vmovdqu64 ZMMWORD PTR [rsp+0x210],zmm0 0x00000000000062c6 <+1414>: movabs r13,0xaaaaaaaaaaaaaa8 0x00000000000062d0 <+1424>: vpxor xmm0,xmm0,xmm0 0x00000000000062d4 <+1428>: vmovdqa XMMWORD PTR [rsp+0x20],xmm0 0x00000000000062da <+1434>: lea rsi,[rsp+0x20] 0x00000000000062df <+1439>: mov edi,0x1 0x00000000000062e4 <+1444>: vzeroupper 0x00000000000062e7 <+1447>: call 0x5470 <clock_gettime@plt> 0x00000000000062ec <+1452>: mov rbp,QWORD PTR [rsp+0x20] 0x00000000000062f1 <+1457>: sub rbp,rbx 0x00000000000062f4 <+1460>: mov rbx,QWORD PTR [rsp+0x28] 0x00000000000062f9 <+1465>: mov edi,0x40 0x00000000000062fe <+1470>: call 0x8160 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x0000000000006303 <+1475>: mov r14,rax 0x0000000000006306 <+1478>: test rax,rax 0x0000000000006309 <+1481>: jle 0x6320 <main+1504> 0x000000000000630b <+1483>: mov edi,0x1 0x0000000000006310 <+1488>: mov rsi,r14 0x0000000000006313 <+1491>: call 0x2d6b0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006318 <+1496>: mov r15,rax 0x000000000000631b <+1499>: mov r12,r14 0x000000000000631e <+1502>: jmp 0x6326 <main+1510> 0x0000000000006320 <+1504>: xor r15d,r15d 0x0000000000006323 <+1507>: xor r12d,r12d 0x0000000000006326 <+1510>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0x210] 0x0000000000006331 <+1521>: vpmaxsb zmm0,zmm0,ZMMWORD PTR [rsp+0x250] 0x000000000000633c <+1532>: vmovdqu64 ZMMWORD PTR [rsp+0xe0],zmm0 0x0000000000006347 <+1543>: kmovq k1,r13 0x000000000000634c <+1548>: kmovq QWORD PTR [rsp+0x38],k1 0x0000000000006353 <+1555>: imul r13,rbp,0x3b9aca00 0x000000000000635a <+1562>: sub rbx,QWORD PTR [rsp+0x40] 0x000000000000635f <+1567>: lea rdx,[rip+0x5729a] # 0x5d600 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006366 <+1574>: mov ecx,0x40 0x000000000000636b <+1579>: mov rdi,r15 0x000000000000636e <+1582>: mov rsi,r14 0x0000000000006371 <+1585>: xor eax,eax 0x0000000000006373 <+1587>: vzeroupper 0x0000000000006376 <+1590>: call 0x57c0 <snprintf@plt> 0x000000000000637b <+1595>: cdqe 0x000000000000637d <+1597>: inc rax 0x0000000000006380 <+1600>: mov QWORD PTR [rsp+0x80],r15 0x0000000000006388 <+1608>: mov QWORD PTR [rsp+0x88],rax 0x0000000000006390 <+1616>: mov QWORD PTR [rsp+0x90],r12 0x0000000000006398 <+1624>: lea rdx,[rip+0x57281] # 0x5d620 <static_string_211b45d8e5a6387d7988d9ce03085044d9eebd3a3bcec37f7baaf61bb1880ea8> 0x000000000000639f <+1631>: lea rdi,[rsp+0x168] 0x00000000000063a7 <+1639>: lea rsi,[rsp+0x80] 0x00000000000063af <+1647>: mov ecx,0x6 0x00000000000063b4 <+1652>: call 0xd7b0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000063b9 <+1657>: mov rdi,QWORD PTR [rsp+0x80] 0x00000000000063c1 <+1665>: test rdi,rdi 0x00000000000063c4 <+1668>: je 0x63cb <main+1675> 0x00000000000063c6 <+1670>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000063cb <+1675>: vmovdqu64 zmm0,ZMMWORD PTR [rsp+0xe0] 0x00000000000063d6 <+1686>: vmovdqu64 zmm1,ZMMWORD PTR [rsp+0x210] 0x00000000000063e1 <+1697>: kmovq k1,QWORD PTR [rsp+0x38] 0x00000000000063e8 <+1704>: vpminsb zmm0{k1},zmm1,ZMMWORD PTR [rsp+0x250] 0x00000000000063f3 <+1715>: vmovdqu64 ZMMWORD PTR [rsp+0xe0],zmm0 0x00000000000063fe <+1726>: add rbx,r13 0x0000000000006401 <+1729>: mov edi,0x1 0x0000000000006406 <+1734>: mov esi,0x3 0x000000000000640b <+1739>: vzeroupper 0x000000000000640e <+1742>: call 0x2d6b0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006413 <+1747>: xor ecx,ecx 0x0000000000006415 <+1749>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x0000000000006420 <+1760>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006424 <+1764>: inc rcx 0x0000000000006427 <+1767>: cmp rcx,0x3 0x000000000000642b <+1771>: jne 0x6420 <main+1760> 0x000000000000642d <+1773>: mov WORD PTR [rax],0x203a 0x0000000000006432 <+1778>: mov BYTE PTR [rax+0x2],0x0 0x0000000000006436 <+1782>: mov QWORD PTR [rsp+0x98],rax 0x000000000000643e <+1790>: mov QWORD PTR [rsp+0xa0],0x3 0x000000000000644a <+1802>: mov QWORD PTR [rsp+0xa8],0x3 0x0000000000006456 <+1814>: lea rdi,[rsp+0x180] 0x000000000000645e <+1822>: lea rsi,[rsp+0x168] 0x0000000000006466 <+1830>: lea rdx,[rsp+0x98] 0x000000000000646e <+1838>: call 0xd370 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006473 <+1843>: mov rdi,QWORD PTR [rsp+0x98] 0x000000000000647b <+1851>: test rdi,rdi 0x000000000000647e <+1854>: je 0x6485 <main+1861> 0x0000000000006480 <+1856>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006485 <+1861>: mov rdi,QWORD PTR [rsp+0x168] 0x000000000000648d <+1869>: test rdi,rdi 0x0000000000006490 <+1872>: je 0x6497 <main+1879> 0x0000000000006492 <+1874>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006497 <+1879>: lea r14,[rsp+0x1f8] 0x000000000000649f <+1887>: mov rdi,r14 0x00000000000064a2 <+1890>: vmovups zmm0,ZMMWORD PTR [rsp+0xe0] 0x00000000000064ad <+1901>: call 0x5ae0 <$stdlib::$builtin::$simd::SIMD::__str__(,$stdlib::$builtin::$simd::SIMD[type, size]),_74x13_type=si8,_74x26_size=64> 0x00000000000064b2 <+1906>: lea rdi,[rsp+0x198] 0x00000000000064ba <+1914>: lea rsi,[rsp+0x180] 0x00000000000064c2 <+1922>: mov rdx,r14 0x00000000000064c5 <+1925>: vzeroupper 0x00000000000064c8 <+1928>: call 0xd370 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x00000000000064cd <+1933>: mov rdi,QWORD PTR [rsp+0x1f8] 0x00000000000064d5 <+1941>: test rdi,rdi 0x00000000000064d8 <+1944>: je 0x64df <main+1951> 0x00000000000064da <+1946>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064df <+1951>: mov rdi,QWORD PTR [rsp+0x180] 0x00000000000064e7 <+1959>: test rdi,rdi 0x00000000000064ea <+1962>: je 0x64f1 <main+1969> 0x00000000000064ec <+1964>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000064f1 <+1969>: lea rdi,[rsp+0x198] 0x00000000000064f9 <+1977>: call 0x8c10 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x00000000000064fe <+1982>: mov rdi,QWORD PTR [rsp+0x198] 0x0000000000006506 <+1990>: test rdi,rdi 0x0000000000006509 <+1993>: je 0x6510 <main+2000> 0x000000000000650b <+1995>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006510 <+2000>: vmovdqu64 zmm1,ZMMWORD PTR [rsp+0xe0] 0x000000000000651b <+2011>: vextracti64x4 ymm0,zmm1,0x1 0x0000000000006522 <+2018>: vpaddb ymm0,ymm1,ymm0 0x0000000000006526 <+2022>: vextracti128 xmm1,ymm0,0x1 0x000000000000652c <+2028>: vpaddb xmm0,xmm0,xmm1 0x0000000000006530 <+2032>: vpshufd xmm1,xmm0,0xee 0x0000000000006535 <+2037>: vpaddb xmm0,xmm0,xmm1 0x0000000000006539 <+2041>: vpxor xmm1,xmm1,xmm1 0x000000000000653d <+2045>: vpsadbw xmm0,xmm0,xmm1 0x0000000000006541 <+2049>: vmovd eax,xmm0 0x0000000000006545 <+2053>: mov BYTE PTR [rsp+0xf],al 0x0000000000006549 <+2057>: lea rcx,[rsp+0xf] 0x000000000000654e <+2062>: mov QWORD PTR [rsp+0x48],rcx 0x0000000000006553 <+2067>: mov rdi,rbx 0x0000000000006556 <+2070>: vzeroupper 0x0000000000006559 <+2073>: call 0x8160 <$stdlib::$builtin::$string::_calc_initial_buffer_size($stdlib::$builtin::$int::Int)> 0x000000000000655e <+2078>: mov r14,rax 0x0000000000006561 <+2081>: test rax,rax 0x0000000000006564 <+2084>: jle 0x657b <main+2107> 0x0000000000006566 <+2086>: mov edi,0x1 0x000000000000656b <+2091>: mov rsi,r14 0x000000000000656e <+2094>: call 0x2d6b0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x0000000000006573 <+2099>: mov r15,rax 0x0000000000006576 <+2102>: mov r12,r14 0x0000000000006579 <+2105>: jmp 0x6581 <main+2113> 0x000000000000657b <+2107>: xor r15d,r15d 0x000000000000657e <+2110>: xor r12d,r12d 0x0000000000006581 <+2113>: lea rdx,[rip+0x57078] # 0x5d600 <static_string_63e7c3ad4a2827d421c6ae9d3e628e588ec72aba1afb8880e54e495f7a0731f3> 0x0000000000006588 <+2120>: mov rdi,r15 0x000000000000658b <+2123>: mov rsi,r14 0x000000000000658e <+2126>: mov rcx,rbx 0x0000000000006591 <+2129>: xor eax,eax 0x0000000000006593 <+2131>: call 0x57c0 <snprintf@plt> 0x0000000000006598 <+2136>: cdqe 0x000000000000659a <+2138>: inc rax 0x000000000000659d <+2141>: mov QWORD PTR [rsp+0xb0],r15 0x00000000000065a5 <+2149>: mov QWORD PTR [rsp+0xb8],rax 0x00000000000065ad <+2157>: mov QWORD PTR [rsp+0xc0],r12 0x00000000000065b5 <+2165>: lea rdx,[rip+0x57074] # 0x5d630 <static_string_b0c2c3413d8ee385fe13baf1690ea94d038570204fc9ce52d1ff8b92a4f0c42a> 0x00000000000065bc <+2172>: lea rdi,[rsp+0x1b0] 0x00000000000065c4 <+2180>: lea rsi,[rsp+0xb0] 0x00000000000065cc <+2188>: mov ecx,0xb 0x00000000000065d1 <+2193>: call 0xd7b0 <$stdlib::$builtin::$string::String::__radd__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string_literal::StringLiteral)> 0x00000000000065d6 <+2198>: mov rdi,QWORD PTR [rsp+0xb0] 0x00000000000065de <+2206>: test rdi,rdi 0x00000000000065e1 <+2209>: je 0x65e8 <main+2216> 0x00000000000065e3 <+2211>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x00000000000065e8 <+2216>: mov edi,0x1 0x00000000000065ed <+2221>: mov esi,0x4 0x00000000000065f2 <+2226>: call 0x2d6b0 <KGEN_CompilerRT_AlignedAlloc(ssize_t, ssize_t)> 0x00000000000065f7 <+2231>: xor ecx,ecx 0x00000000000065f9 <+2233>: nop DWORD PTR [rax+0x0] 0x0000000000006600 <+2240>: mov BYTE PTR [rax+rcx*1],0x0 0x0000000000006604 <+2244>: inc rcx 0x0000000000006607 <+2247>: cmp rcx,0x4 0x000000000000660b <+2251>: jne 0x6600 <main+2240> 0x000000000000660d <+2253>: mov DWORD PTR [rax],0x736e20 0x0000000000006613 <+2259>: mov QWORD PTR [rsp+0xc8],rax 0x000000000000661b <+2267>: mov QWORD PTR [rsp+0xd0],0x4 0x0000000000006627 <+2279>: mov QWORD PTR [rsp+0xd8],0x4 0x0000000000006633 <+2291>: lea rdi,[rsp+0x1c8] 0x000000000000663b <+2299>: lea rsi,[rsp+0x1b0] 0x0000000000006643 <+2307>: lea rdx,[rsp+0xc8] 0x000000000000664b <+2315>: call 0xd370 <$stdlib::$builtin::$string::String::__add__(,$stdlib::$builtin::$string::String,$stdlib::$builtin::$string::String)> 0x0000000000006650 <+2320>: mov rdi,QWORD PTR [rsp+0xc8] 0x0000000000006658 <+2328>: test rdi,rdi 0x000000000000665b <+2331>: je 0x6662 <main+2338> 0x000000000000665d <+2333>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006662 <+2338>: mov rdi,QWORD PTR [rsp+0x1b0] 0x000000000000666a <+2346>: test rdi,rdi 0x000000000000666d <+2349>: je 0x6674 <main+2356> 0x000000000000666f <+2351>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006674 <+2356>: lea rdi,[rsp+0x1c8] 0x000000000000667c <+2364>: call 0x8c10 <$stdlib::$builtin::$io::print($stdlib::$builtin::$string::String)> 0x0000000000006681 <+2369>: mov rdi,QWORD PTR [rsp+0x1c8] 0x0000000000006689 <+2377>: test rdi,rdi 0x000000000000668c <+2380>: je 0x6693 <main+2387> 0x000000000000668e <+2382>: call 0x2d6d0 <KGEN_CompilerRT_AlignedFree(void*)> 0x0000000000006693 <+2387>: call 0x29ad0 <KGEN_CompilerRT_DestroyGlobals()> 0x0000000000006698 <+2392>: xor eax,eax 0x000000000000669a <+2394>: add rsp,0x298 0x00000000000066a1 <+2401>: pop rbx 0x00000000000066a2 <+2402>: pop r12 0x00000000000066a4 <+2404>: pop r13 0x00000000000066a6 <+2406>: pop r14 0x00000000000066a8 <+2408>: pop r15 0x00000000000066aa <+2410>: pop rbp 0x00000000000066ab <+2411>: ret End of assembler dump. --- disassemble/int8_8.asm --- GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main... Dump of assembler code for function main: 0x000000000005b890 <+0>: push rbp 0x000000000005b891 <+1>: push r15 0x000000000005b893 <+3>: push r14 0x000000000005b895 <+5>: push r13 0x000000000005b897 <+7>: push r12 0x000000000005b899 <+9>: push rbx 0x000000000005b89a <+10>: sub rsp,0x218 0x000000000005b8a1 <+17>: lea rax,[rip+0xfffffffffffffff9] # 0x5b8a1 <main+17> 0x000000000005b8a8 <+24>: movabs r13,0x2c197 0x000000000005b8b2 <+34>: add r13,rax 0x000000000005b8b5 <+37>: movabs rax,0x568 0x000000000005b8bf <+47>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005b8c4 <+52>: vpxor xmm0,xmm0,xmm0 0x000000000005b8c8 <+56>: mov ebx,0x9 0x000000000005b8cd <+61>: xor r14d,r14d 0x000000000005b8d0 <+64>: movabs rax,0x538 0x000000000005b8da <+74>: mov r15,QWORD PTR [r13+rax*1+0x0] 0x000000000005b8df <+79>: movabs rax,0x560 0x000000000005b8e9 <+89>: mov r12,QWORD PTR [r13+rax*1+0x0] 0x000000000005b8ee <+94>: movabs rax,0xfffffffffffd56b8 0x000000000005b8f8 <+104>: vmovaps xmm1,XMMWORD PTR [r13+rax*1+0x0] 0x000000000005b8ff <+111>: vmovaps XMMWORD PTR [rsp+0x20],xmm1 0x000000000005b905 <+117>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x000000000005b910 <+128>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x000000000005b916 <+134>: call r15 0x000000000005b919 <+137>: mov edx,0x64 0x000000000005b91e <+142>: mov rdi,rax 0x000000000005b921 <+145>: xor esi,esi 0x000000000005b923 <+147>: call r12 0x000000000005b926 <+150>: vpbroadcastb xmm0,r14d 0x000000000005b92c <+156>: vpcmpeqb k1,xmm0,XMMWORD PTR [rsp+0x20] 0x000000000005b934 <+164>: vmovdqa xmm0,XMMWORD PTR [rsp+0x10] 0x000000000005b93a <+170>: vpbroadcastb xmm0{k1},eax 0x000000000005b940 <+176>: dec rbx 0x000000000005b943 <+179>: inc r14 0x000000000005b946 <+182>: cmp rbx,0x1 0x000000000005b94a <+186>: ja 0x5b910 <main+128> 0x000000000005b94c <+188>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x000000000005b952 <+194>: movabs rax,0x548 0x000000000005b95c <+204>: mov edi,0x8 0x000000000005b961 <+209>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005b966 <+214>: mov r14,rax 0x000000000005b969 <+217>: movabs r12,0x518 0x000000000005b973 <+227>: test rax,rax 0x000000000005b976 <+230>: jle 0x5b98d <main+253> 0x000000000005b978 <+232>: mov edi,0x1 0x000000000005b97d <+237>: mov rsi,r14 0x000000000005b980 <+240>: call QWORD PTR [r13+r12*1+0x0] 0x000000000005b985 <+245>: mov r15,rax 0x000000000005b988 <+248>: mov rbx,r14 0x000000000005b98b <+251>: jmp 0x5b992 <main+258> 0x000000000005b98d <+253>: xor r15d,r15d 0x000000000005b990 <+256>: xor ebx,ebx 0x000000000005b992 <+258>: movabs rdx,0x2588 0x000000000005b99c <+268>: add rdx,r13 0x000000000005b99f <+271>: movabs r8,0x580 0x000000000005b9a9 <+281>: mov ecx,0x8 0x000000000005b9ae <+286>: mov rdi,r15 0x000000000005b9b1 <+289>: mov rsi,r14 0x000000000005b9b4 <+292>: mov QWORD PTR [rsp+0x20],rdx 0x000000000005b9b9 <+297>: xor eax,eax 0x000000000005b9bb <+299>: call QWORD PTR [r13+r8*1+0x0] 0x000000000005b9c0 <+304>: cdqe 0x000000000005b9c2 <+306>: inc rax 0x000000000005b9c5 <+309>: mov QWORD PTR [rsp+0x70],r15 0x000000000005b9ca <+314>: mov QWORD PTR [rsp+0x78],rax 0x000000000005b9cf <+319>: mov QWORD PTR [rsp+0x80],rbx 0x000000000005b9d7 <+327>: movabs rdx,0x2598 0x000000000005b9e1 <+337>: add rdx,r13 0x000000000005b9e4 <+340>: movabs rax,0x500 0x000000000005b9ee <+350>: lea rdi,[rsp+0x128] 0x000000000005b9f6 <+358>: lea rsi,[rsp+0x70] 0x000000000005b9fb <+363>: mov ecx,0x7 0x000000000005ba00 <+368>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005ba05 <+373>: mov rdi,QWORD PTR [rsp+0x70] 0x000000000005ba0a <+378>: movabs rbx,0x4f8 0x000000000005ba14 <+388>: test rdi,rdi 0x000000000005ba17 <+391>: je 0x5ba1e <main+398> 0x000000000005ba19 <+393>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005ba1e <+398>: mov edi,0x1 0x000000000005ba23 <+403>: mov esi,0x3 0x000000000005ba28 <+408>: call QWORD PTR [r13+r12*1+0x0] 0x000000000005ba2d <+413>: xor ecx,ecx 0x000000000005ba2f <+415>: nop 0x000000000005ba30 <+416>: mov BYTE PTR [rax+rcx*1],0x0 0x000000000005ba34 <+420>: inc rcx 0x000000000005ba37 <+423>: cmp rcx,0x3 0x000000000005ba3b <+427>: jne 0x5ba30 <main+416> 0x000000000005ba3d <+429>: mov WORD PTR [rax],0x203a 0x000000000005ba42 <+434>: mov BYTE PTR [rax+0x2],0x0 0x000000000005ba46 <+438>: mov QWORD PTR [rsp+0x88],rax 0x000000000005ba4e <+446>: mov QWORD PTR [rsp+0x90],0x3 0x000000000005ba5a <+458>: mov QWORD PTR [rsp+0x98],0x3 0x000000000005ba66 <+470>: movabs r15,0x578 0x000000000005ba70 <+480>: lea rdi,[rsp+0x140] 0x000000000005ba78 <+488>: lea rsi,[rsp+0x128] 0x000000000005ba80 <+496>: lea rdx,[rsp+0x88] 0x000000000005ba88 <+504>: call QWORD PTR [r13+r15*1+0x0] 0x000000000005ba8d <+509>: mov rdi,QWORD PTR [rsp+0x88] 0x000000000005ba95 <+517>: test rdi,rdi 0x000000000005ba98 <+520>: je 0x5ba9f <main+527> 0x000000000005ba9a <+522>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005ba9f <+527>: mov rdi,QWORD PTR [rsp+0x128] 0x000000000005baa7 <+535>: test rdi,rdi 0x000000000005baaa <+538>: je 0x5bab1 <main+545> 0x000000000005baac <+540>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bab1 <+545>: movabs rax,0xfffffffffffd3b58 0x000000000005babb <+555>: add rax,r13 0x000000000005babe <+558>: lea r14,[rsp+0x1e8] 0x000000000005bac6 <+566>: mov rdi,r14 0x000000000005bac9 <+569>: vmovaps xmm0,XMMWORD PTR [rsp+0x10] 0x000000000005bacf <+575>: mov QWORD PTR [rsp+0x60],rax 0x000000000005bad4 <+580>: call rax 0x000000000005bad6 <+582>: lea rdi,[rsp+0x158] 0x000000000005bade <+590>: lea rsi,[rsp+0x140] 0x000000000005bae6 <+598>: mov rdx,r14 0x000000000005bae9 <+601>: call QWORD PTR [r13+r15*1+0x0] 0x000000000005baee <+606>: mov rdi,QWORD PTR [rsp+0x1e8] 0x000000000005baf6 <+614>: test rdi,rdi 0x000000000005baf9 <+617>: je 0x5bb00 <main+624> 0x000000000005bafb <+619>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bb00 <+624>: mov rdi,QWORD PTR [rsp+0x140] 0x000000000005bb08 <+632>: test rdi,rdi 0x000000000005bb0b <+635>: je 0x5bb12 <main+642> 0x000000000005bb0d <+637>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bb12 <+642>: movabs rax,0x4e8 0x000000000005bb1c <+652>: lea rdi,[rsp+0x158] 0x000000000005bb24 <+660>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005bb29 <+665>: mov rdi,QWORD PTR [rsp+0x158] 0x000000000005bb31 <+673>: test rdi,rdi 0x000000000005bb34 <+676>: je 0x5bb3b <main+683> 0x000000000005bb36 <+678>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bb3b <+683>: vxorps xmm0,xmm0,xmm0 0x000000000005bb3f <+687>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 0x000000000005bb45 <+693>: movabs rax,0x540 0x000000000005bb4f <+703>: mov r14,QWORD PTR [r13+rax*1+0x0] 0x000000000005bb54 <+708>: lea rsi,[rsp+0x30] 0x000000000005bb59 <+713>: mov edi,0x1 0x000000000005bb5e <+718>: call r14 0x000000000005bb61 <+721>: mov r15,QWORD PTR [rsp+0x30] 0x000000000005bb66 <+726>: mov rax,QWORD PTR [rsp+0x38] 0x000000000005bb6b <+731>: mov QWORD PTR [rsp+0x58],rax 0x000000000005bb70 <+736>: vmovdqa xmm2,XMMWORD PTR [rsp+0x10] 0x000000000005bb76 <+742>: vprold xmm0,xmm2,0x10 0x000000000005bb7d <+749>: vpminsb xmm1,xmm2,xmm0 0x000000000005bb82 <+754>: vpmaxsb xmm0,xmm2,xmm0 0x000000000005bb87 <+759>: vpblendw xmm0,xmm1,xmm0,0xa 0x000000000005bb8d <+765>: vpshufd xmm1,xmm0,0xe1 0x000000000005bb92 <+770>: vpminsb xmm2,xmm0,xmm1 0x000000000005bb97 <+775>: vpmaxsb xmm0,xmm0,xmm1 0x000000000005bb9c <+780>: vpblendd xmm0,xmm2,xmm0,0x2 0x000000000005bba2 <+786>: movabs rax,0xfffffffffffd56c8 0x000000000005bbac <+796>: vpshufb xmm1,xmm0,XMMWORD PTR [r13+rax*1+0x0] 0x000000000005bbb3 <+803>: vpminsb xmm2,xmm0,xmm1 0x000000000005bbb8 <+808>: mov ax,0xaa 0x000000000005bbbc <+812>: kmovd k1,eax 0x000000000005bbc0 <+816>: vpmaxsb xmm2{k1},xmm0,xmm1 0x000000000005bbc6 <+822>: vpshuflw xmm0,xmm2,0xd8 0x000000000005bbcb <+827>: vpminsb xmm1,xmm2,xmm0 0x000000000005bbd0 <+832>: vpmaxsb xmm0,xmm2,xmm0 0x000000000005bbd5 <+837>: vpblendw xmm0,xmm0,xmm1,0x2 0x000000000005bbdb <+843>: movabs rax,0xfffffffffffd56d8 0x000000000005bbe5 <+853>: vpshufb xmm1,xmm0,XMMWORD PTR [r13+rax*1+0x0] 0x000000000005bbec <+860>: vpmaxsb xmm2,xmm0,xmm1 0x000000000005bbf1 <+865>: mov ax,0xa 0x000000000005bbf5 <+869>: kmovd k1,eax 0x000000000005bbf9 <+873>: vpminsb xmm2{k1},xmm0,xmm1 0x000000000005bbff <+879>: movabs rax,0xfffffffffffd56e8 0x000000000005bc09 <+889>: vmovdqa XMMWORD PTR [rsp+0x110],xmm2 0x000000000005bc12 <+898>: vpshufb xmm0,xmm2,XMMWORD PTR [r13+rax*1+0x0] 0x000000000005bc19 <+905>: vmovdqa XMMWORD PTR [rsp+0x100],xmm0 0x000000000005bc22 <+914>: vpxor xmm0,xmm0,xmm0 0x000000000005bc26 <+918>: vmovdqa XMMWORD PTR [rsp+0x40],xmm0 0x000000000005bc2c <+924>: lea rsi,[rsp+0x40] 0x000000000005bc31 <+929>: mov edi,0x1 0x000000000005bc36 <+934>: call r14 0x000000000005bc39 <+937>: mov rbp,QWORD PTR [rsp+0x40] 0x000000000005bc3e <+942>: sub rbp,r15 0x000000000005bc41 <+945>: mov r14,QWORD PTR [rsp+0x48] 0x000000000005bc46 <+950>: mov edi,0x8 0x000000000005bc4b <+955>: movabs rax,0x548 0x000000000005bc55 <+965>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005bc5a <+970>: mov r15,rax 0x000000000005bc5d <+973>: test rax,rax 0x000000000005bc60 <+976>: jle 0x5bc81 <main+1009> 0x000000000005bc62 <+978>: mov edi,0x1 0x000000000005bc67 <+983>: mov rsi,r15 0x000000000005bc6a <+986>: movabs rax,0x518 0x000000000005bc74 <+996>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005bc79 <+1001>: mov r12,rax 0x000000000005bc7c <+1004>: mov rbx,r15 0x000000000005bc7f <+1007>: jmp 0x5bc86 <main+1014> 0x000000000005bc81 <+1009>: xor r12d,r12d 0x000000000005bc84 <+1012>: xor ebx,ebx 0x000000000005bc86 <+1014>: vmovdqa xmm0,XMMWORD PTR [rsp+0x100] 0x000000000005bc8f <+1023>: vpmaxsb xmm0,xmm0,XMMWORD PTR [rsp+0x110] 0x000000000005bc99 <+1033>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x000000000005bc9f <+1039>: mov ax,0x2a 0x000000000005bca3 <+1043>: kmovd k1,eax 0x000000000005bca7 <+1047>: kmovw WORD PTR [rsp+0xe],k1 0x000000000005bcad <+1053>: imul rbp,rbp,0x3b9aca00 0x000000000005bcb4 <+1060>: sub r14,QWORD PTR [rsp+0x58] 0x000000000005bcb9 <+1065>: mov ecx,0x8 0x000000000005bcbe <+1070>: mov rdi,r12 0x000000000005bcc1 <+1073>: mov rsi,r15 0x000000000005bcc4 <+1076>: mov rdx,QWORD PTR [rsp+0x20] 0x000000000005bcc9 <+1081>: xor eax,eax 0x000000000005bccb <+1083>: movabs r8,0x580 0x000000000005bcd5 <+1093>: call QWORD PTR [r13+r8*1+0x0] 0x000000000005bcda <+1098>: cdqe 0x000000000005bcdc <+1100>: inc rax 0x000000000005bcdf <+1103>: mov QWORD PTR [rsp+0xa0],r12 0x000000000005bce7 <+1111>: mov QWORD PTR [rsp+0xa8],rax 0x000000000005bcef <+1119>: mov QWORD PTR [rsp+0xb0],rbx 0x000000000005bcf7 <+1127>: movabs rdx,0x25a8 0x000000000005bd01 <+1137>: add rdx,r13 0x000000000005bd04 <+1140>: lea rdi,[rsp+0x170] 0x000000000005bd0c <+1148>: lea rsi,[rsp+0xa0] 0x000000000005bd14 <+1156>: mov ecx,0x6 0x000000000005bd19 <+1161>: movabs rax,0x500 0x000000000005bd23 <+1171>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005bd28 <+1176>: mov rdi,QWORD PTR [rsp+0xa0] 0x000000000005bd30 <+1184>: test rdi,rdi 0x000000000005bd33 <+1187>: movabs rbx,0x4f8 0x000000000005bd3d <+1197>: je 0x5bd44 <main+1204> 0x000000000005bd3f <+1199>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bd44 <+1204>: vmovdqa xmm0,XMMWORD PTR [rsp+0x10] 0x000000000005bd4a <+1210>: vmovdqa xmm1,XMMWORD PTR [rsp+0x100] 0x000000000005bd53 <+1219>: kmovw k1,WORD PTR [rsp+0xe] 0x000000000005bd59 <+1225>: vpminsb xmm0{k1},xmm1,XMMWORD PTR [rsp+0x110] 0x000000000005bd61 <+1233>: vmovdqa XMMWORD PTR [rsp+0x10],xmm0 0x000000000005bd67 <+1239>: add r14,rbp 0x000000000005bd6a <+1242>: mov edi,0x1 0x000000000005bd6f <+1247>: mov esi,0x3 0x000000000005bd74 <+1252>: movabs rbp,0x518 0x000000000005bd7e <+1262>: call QWORD PTR [r13+rbp*1+0x0] 0x000000000005bd83 <+1267>: xor ecx,ecx 0x000000000005bd85 <+1269>: movabs r12,0x578 0x000000000005bd8f <+1279>: nop 0x000000000005bd90 <+1280>: mov BYTE PTR [rax+rcx*1],0x0 0x000000000005bd94 <+1284>: inc rcx 0x000000000005bd97 <+1287>: cmp rcx,0x3 0x000000000005bd9b <+1291>: jne 0x5bd90 <main+1280> 0x000000000005bd9d <+1293>: mov WORD PTR [rax],0x203a 0x000000000005bda2 <+1298>: mov BYTE PTR [rax+0x2],0x0 0x000000000005bda6 <+1302>: mov QWORD PTR [rsp+0xb8],rax 0x000000000005bdae <+1310>: mov QWORD PTR [rsp+0xc0],0x3 0x000000000005bdba <+1322>: mov QWORD PTR [rsp+0xc8],0x3 0x000000000005bdc6 <+1334>: lea rdi,[rsp+0x188] 0x000000000005bdce <+1342>: lea rsi,[rsp+0x170] 0x000000000005bdd6 <+1350>: lea rdx,[rsp+0xb8] 0x000000000005bdde <+1358>: call QWORD PTR [r13+r12*1+0x0] 0x000000000005bde3 <+1363>: mov rdi,QWORD PTR [rsp+0xb8] 0x000000000005bdeb <+1371>: test rdi,rdi 0x000000000005bdee <+1374>: je 0x5bdf5 <main+1381> 0x000000000005bdf0 <+1376>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bdf5 <+1381>: mov rdi,QWORD PTR [rsp+0x170] 0x000000000005bdfd <+1389>: test rdi,rdi 0x000000000005be00 <+1392>: je 0x5be07 <main+1399> 0x000000000005be02 <+1394>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005be07 <+1399>: lea r15,[rsp+0x200] 0x000000000005be0f <+1407>: mov rdi,r15 0x000000000005be12 <+1410>: vmovdqa xmm0,XMMWORD PTR [rsp+0x10] 0x000000000005be18 <+1416>: call QWORD PTR [rsp+0x60] 0x000000000005be1c <+1420>: lea rdi,[rsp+0x1a0] 0x000000000005be24 <+1428>: lea rsi,[rsp+0x188] 0x000000000005be2c <+1436>: mov rdx,r15 0x000000000005be2f <+1439>: call QWORD PTR [r13+r12*1+0x0] 0x000000000005be34 <+1444>: mov rdi,QWORD PTR [rsp+0x200] 0x000000000005be3c <+1452>: test rdi,rdi 0x000000000005be3f <+1455>: je 0x5be46 <main+1462> 0x000000000005be41 <+1457>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005be46 <+1462>: mov rdi,QWORD PTR [rsp+0x188] 0x000000000005be4e <+1470>: test rdi,rdi 0x000000000005be51 <+1473>: je 0x5be58 <main+1480> 0x000000000005be53 <+1475>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005be58 <+1480>: lea rdi,[rsp+0x1a0] 0x000000000005be60 <+1488>: movabs rax,0x4e8 0x000000000005be6a <+1498>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005be6f <+1503>: mov rdi,QWORD PTR [rsp+0x1a0] 0x000000000005be77 <+1511>: test rdi,rdi 0x000000000005be7a <+1514>: je 0x5be81 <main+1521> 0x000000000005be7c <+1516>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005be81 <+1521>: vpxor xmm0,xmm0,xmm0 0x000000000005be85 <+1525>: vpsadbw xmm0,xmm0,XMMWORD PTR [rsp+0x10] 0x000000000005be8b <+1531>: vmovd eax,xmm0 0x000000000005be8f <+1535>: mov BYTE PTR [rsp+0xd],al 0x000000000005be93 <+1539>: lea rcx,[rsp+0xd] 0x000000000005be98 <+1544>: mov QWORD PTR [rsp+0x68],rcx 0x000000000005be9d <+1549>: mov rdi,r14 0x000000000005bea0 <+1552>: movabs rax,0x548 0x000000000005beaa <+1562>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005beaf <+1567>: mov r15,rax 0x000000000005beb2 <+1570>: test rax,rax 0x000000000005beb5 <+1573>: jle 0x5becc <main+1596> 0x000000000005beb7 <+1575>: mov edi,0x1 0x000000000005bebc <+1580>: mov rsi,r15 0x000000000005bebf <+1583>: call QWORD PTR [r13+rbp*1+0x0] 0x000000000005bec4 <+1588>: mov r12,rax 0x000000000005bec7 <+1591>: mov rbx,r15 0x000000000005beca <+1594>: jmp 0x5bed1 <main+1601> 0x000000000005becc <+1596>: xor r12d,r12d 0x000000000005becf <+1599>: xor ebx,ebx 0x000000000005bed1 <+1601>: mov rdi,r12 0x000000000005bed4 <+1604>: mov rsi,r15 0x000000000005bed7 <+1607>: mov rdx,QWORD PTR [rsp+0x20] 0x000000000005bedc <+1612>: mov rcx,r14 0x000000000005bedf <+1615>: xor eax,eax 0x000000000005bee1 <+1617>: movabs r8,0x580 0x000000000005beeb <+1627>: call QWORD PTR [r13+r8*1+0x0] 0x000000000005bef0 <+1632>: cdqe 0x000000000005bef2 <+1634>: inc rax 0x000000000005bef5 <+1637>: mov QWORD PTR [rsp+0xd0],r12 0x000000000005befd <+1645>: mov QWORD PTR [rsp+0xd8],rax 0x000000000005bf05 <+1653>: mov QWORD PTR [rsp+0xe0],rbx 0x000000000005bf0d <+1661>: movabs rdx,0x25b8 0x000000000005bf17 <+1671>: add rdx,r13 0x000000000005bf1a <+1674>: lea rdi,[rsp+0x1b8] 0x000000000005bf22 <+1682>: lea rsi,[rsp+0xd0] 0x000000000005bf2a <+1690>: mov ecx,0xb 0x000000000005bf2f <+1695>: movabs rax,0x500 0x000000000005bf39 <+1705>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005bf3e <+1710>: mov rdi,QWORD PTR [rsp+0xd0] 0x000000000005bf46 <+1718>: test rdi,rdi 0x000000000005bf49 <+1721>: movabs rbx,0x4f8 0x000000000005bf53 <+1731>: je 0x5bf5a <main+1738> 0x000000000005bf55 <+1733>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bf5a <+1738>: mov edi,0x1 0x000000000005bf5f <+1743>: mov esi,0x4 0x000000000005bf64 <+1748>: call QWORD PTR [r13+rbp*1+0x0] 0x000000000005bf69 <+1753>: xor ecx,ecx 0x000000000005bf6b <+1755>: movabs r8,0x578 0x000000000005bf75 <+1765>: data16 cs nop WORD PTR [rax+rax*1+0x0] 0x000000000005bf80 <+1776>: mov BYTE PTR [rax+rcx*1],0x0 0x000000000005bf84 <+1780>: inc rcx 0x000000000005bf87 <+1783>: cmp rcx,0x4 0x000000000005bf8b <+1787>: jne 0x5bf80 <main+1776> 0x000000000005bf8d <+1789>: mov DWORD PTR [rax],0x736e20 0x000000000005bf93 <+1795>: mov QWORD PTR [rsp+0xe8],rax 0x000000000005bf9b <+1803>: mov QWORD PTR [rsp+0xf0],0x4 0x000000000005bfa7 <+1815>: mov QWORD PTR [rsp+0xf8],0x4 0x000000000005bfb3 <+1827>: lea rdi,[rsp+0x1d0] 0x000000000005bfbb <+1835>: lea rsi,[rsp+0x1b8] 0x000000000005bfc3 <+1843>: lea rdx,[rsp+0xe8] 0x000000000005bfcb <+1851>: call QWORD PTR [r13+r8*1+0x0] 0x000000000005bfd0 <+1856>: mov rdi,QWORD PTR [rsp+0xe8] 0x000000000005bfd8 <+1864>: test rdi,rdi 0x000000000005bfdb <+1867>: je 0x5bfe2 <main+1874> 0x000000000005bfdd <+1869>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bfe2 <+1874>: mov rdi,QWORD PTR [rsp+0x1b8] 0x000000000005bfea <+1882>: test rdi,rdi 0x000000000005bfed <+1885>: je 0x5bff4 <main+1892> 0x000000000005bfef <+1887>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005bff4 <+1892>: lea rdi,[rsp+0x1d0] 0x000000000005bffc <+1900>: movabs rax,0x4e8 0x000000000005c006 <+1910>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005c00b <+1915>: mov rdi,QWORD PTR [rsp+0x1d0] 0x000000000005c013 <+1923>: test rdi,rdi 0x000000000005c016 <+1926>: je 0x5c01d <main+1933> 0x000000000005c018 <+1928>: call QWORD PTR [r13+rbx*1+0x0] 0x000000000005c01d <+1933>: movabs rax,0x570 0x000000000005c027 <+1943>: call QWORD PTR [r13+rax*1+0x0] 0x000000000005c02c <+1948>: xor eax,eax 0x000000000005c02e <+1950>: add rsp,0x218 0x000000000005c035 <+1957>: pop rbx 0x000000000005c036 <+1958>: pop r12 0x000000000005c038 <+1960>: pop r13 0x000000000005c03a <+1962>: pop r14 0x000000000005c03c <+1964>: pop r15 0x000000000005c03e <+1966>: pop rbp 0x000000000005c03f <+1967>: ret End of assembler dump. --- disassemble/main_int16_128.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int16, 128, True]() --- disassemble/main_int16_16.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int16, 16, True]() --- disassemble/main_int16_32.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int16, 32, True]() --- disassemble/main_int16_64.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int16, 64, True]() --- disassemble/main_int16_8.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int16, 8, True]() --- disassemble/main_int32_128.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int32, 128, True]() --- disassemble/main_int32_16.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int32, 16, True]() --- disassemble/main_int32_32.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int32, 32, True]() --- disassemble/main_int32_64.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int32, 64, True]() --- disassemble/main_int32_8.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int32, 8, True]() --- disassemble/main_int64_128.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int64, 128, True]() --- disassemble/main_int64_16.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int64, 16, True]() --- disassemble/main_int64_32.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int64, 32, True]() --- disassemble/main_int64_64.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int64, 64, True]() --- disassemble/main_int64_8.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int64, 8, True]() --- disassemble/main_int8_128.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int8, 128, True]() --- disassemble/main_int8_16.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int8, 16, True]() --- disassemble/main_int8_32.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int8, 32, True]() --- disassemble/main_int8_64.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int8, 64, True]() --- disassemble/main_int8_8.mojo --- import sort_network as sn fn main(): sn.test_netw_SIMD_sort[DType.int8, 8, True]() --- disassemble/run_all.sh --- echo "making sort_network package" mojo package ../sort_network -o sort_network.mojopkg ID="int8_8" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int8_16" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int8_32" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int8_64" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int8_128" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int16_8" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int16_16" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int16_32" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int16_64" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int16_128" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int32_8" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int32_16" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int32_32" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int32_64" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int32_128" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int64_8" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int64_16" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int64_32" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int64_64" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm ID="int64_128" echo "disassembling $ID" mojo build main_$ID.mojo -o main gdb main -ex 'set disassembly-flavor intel' -ex 'disassemble main' -ex q > $ID.asm --- main.mojo --- from collections.vector import DynamicVector, InlinedFixedVector from algorithm.sort import sort from time import now from benchmark import keep import sort_network as sn fn main(): let start_time_ns = now() # sn.test_perm_code() # sn.test_sort() # sn.test_sort_X(0xFFFF) # sn.test_netw_SIMD_sort_multi_layer[DType.uint8, True]() sn.test_netw_SIMD_sort[DType.uint64, 8, True]() # sn.test_netw_SIMD_sort[DType.uint64, 16, True]() # sn.test_netw_SIMD_sort[DType.uint64, 32, True]() # sn.test_netw_SIMD_sort[DType.uint64, 64, True]() # sn.test_netw_SIMD_sort[DType.uint64, 128, True]() # sn.test_netw_SIMD_sort[DType.int64, 8, True]() # sn.test_netw_SIMD_sort[DType.int64, 16, True]() # sn.test_netw_SIMD_sort[DType.int64, 32, True]() # sn.test_netw_SIMD_sort[DType.int64, 64, True]() # sn.test_netw_SIMD_sort[DType.int64, 128, True]() # sn.test_netw_SIMD_sort[DType.float32, 8, True]() # sn.test_netw_SIMD_sort[DType.float32, 16, True]() # sn.test_netw_SIMD_sort[DType.float32, 32, True]() # sn.test_netw_SIMD_sort[DType.float32, 64, True]() # sn.test_netw_SIMD_sort[DType.float32, 128, True]() # sn.test_netw_SIMD_sort[DType.float16, 16, True]() # sn.test_netw_SIMD_sort[DType.bfloat16, 8, True]() # Error: 0.7.0 "JIT session error: Symbols not found: [ __truncsfbf2 ]" # sn.test_netw_SIMD_sort[DType.bfloat16, 16, True]() # Error: 0.7.0 "JIT session error: Symbols not found: [ __truncsfbf2 ]" # sn.test_netw_SIMD_sort[DType.bfloat16, 32, True]() # Error: 0.7.0 "JIT session error: Symbols not found: [ __truncsfbf2 ]" # sn.test_netw_SIMD_sort[DType.bfloat16, 64, True]() # Error: 0.7.0 "JIT session error: Symbols not found: [ __truncsfbf2 ]" # sn.test_netw_SIMD_sort[DType.bfloat16, 128, True]() # sn.test_netw_SIMD_sort[DType.int32, 8, True]() # sn.test_netw_SIMD_sort[DType.int32, 16, True]() # sn.test_netw_SIMD_sort[DType.int32, 32, True]() # sn.test_netw_SIMD_sort[DType.int32, 64, True]() # sn.test_netw_SIMD_sort[DType.int32, 128, True]() # sn.test_netw_SIMD_sort[DType.int16, 8, True]() # sn.test_netw_SIMD_sort[DType.int16, 16, True]() # sn.test_netw_SIMD_sort[DType.int16, 32, True]() # sn.test_netw_SIMD_sort[DType.int16, 64, True]() # sn.test_netw_SIMD_sort[DType.int16, 128, True]() # sn.test_netw_SIMD_sort[DType.int8, 8, True]() #6.5ns # sn.test_netw_SIMD_sort[DType.int8, 16, True]() #11 ns # sn.test_netw_SIMD_sort[DType.int8, 32, True]() #32 ns XX # sn.test_netw_SIMD_sort[DType.int8, 64, True]() #32 ns # sn.test_netw_SIMD_sort[DType.int8, 128, True]() #53 ns # sn.test_netw_SIMD_sort_2x_B[DType.int32, DType.uint32, True, True]() # sn.test_netw_SIMD_sort_idx[DType.int32, DType.uint32, 32, False]() # sn.test_netw_SIMD_sort_2x_A[DType.int8, DType.int8, 16]() # sn.test_netw_SIMD_sort_2x_B[DType.uint8, DType.uint8]() # sn.test_performance1(10000, 100) # sn.test_performance2(10000, 100) # print(measure_time_netw_sort_generic[DType.int8](10000, 100, 15)) # sn.test_netw_SIMD_sort[DType.uint32, 16, True]() # sn.test_netw_SIMD_sort_2x_C[DType.uint16, 16, True]() # sn.test_netw_SIMD_sort[DType.uint16, 16, True]() @parameter if False: alias sd1 = sn.swap_data[8]() print(str(sd1)) alias sd2 = sn.join_swap_data[sd1, sd1]() print(str(sd2)) @parameter if False: let sd = sn.swap_data[64]() print(str(sd)) let sd_2x = sn.join_swap_data(sd, sd) print(sd_2x.to_code()) @parameter if False: # print a network as a sequence of CE's let sd = sn.swap_data[128]() for i in range(sd.n_layers): for j in range(len(sd[i])): print_no_newline("(") print_no_newline(sd[i].get_min(j)) print_no_newline(",") print_no_newline(sd[i].get_max(j)) print_no_newline("),") @parameter if False: # print code for i in range(26): # fmt: off print(" let v"+str(i+1)+"a = swap_n[T1, channels, sd["+str(i+1)+"], ascending1](v"+str(i)+"a)") print(" let v"+str(i+1)+"b = swap_n[T2, channels, sd["+str(i+1)+"], ascending2](v"+str(i)+"b)") print(" @parameter") print(" if n_layers == " + str(i + 2) + ":") print(" return (v" + str(i + 1) + "a, v" + str(i + 1) + "b)") # fmt: on @parameter if False: # print code for i in range(26): # fmt: off print(" let t"+str(i+1)+" = swap_idx[T1, T2, channels, sd["+str(i+1)+"], ascending](t"+str(i)+")") print(" @parameter") print(" if n_layers == " + str(i + 2) + ":") print(" return t" + str(i + 1)) # fmt: on @parameter if False: # print code for i in range(26): # fmt: off print(" let v"+str(i+1)+" = swap_n[T, 2*channels, sd["+str(i+1)+"], ascending](v"+str(i)+")") print(" @parameter") print(" if n_layers == " + str(i + 2) + ":") print(" return v"+str(i+1)+".slice[channels](0), v"+str(i+1)+".slice[channels](channels)") # fmt: on let elapsed_time_ns = now() - start_time_ns print_no_newline("Elapsed time " + str(elapsed_time_ns) + " ns") print_no_newline(" = " + str(Float32(elapsed_time_ns) / 1_000) + " μs") print_no_newline(" = " + str(Float32(elapsed_time_ns) / 1_000_000) + " ms") print_no_newline(" = " + str(Float32(elapsed_time_ns) / 1_000_000_000) + " s") print_no_newline(" = " + str(Float32(elapsed_time_ns) / 60_000_000_000) + " min\n") --- sort_network/Layer.mojo --- struct Layer(CollectionElement, Sized, Stringable): alias LayerData = SIMD[DType.uint16, 2] var data: DynamicVector[Self.LayerData] @staticmethod @always_inline("nodebug") fn merge(layer1: Self, layer2: Self, width1: Int) -> Self: var result = Self() for i in range(len(layer1.data)): result.data.push_back(layer1.data[i]) for i in range(len(layer2.data)): let min: SIMD[DType.uint16, 1] = layer2.get_min(i) + width1 let max: SIMD[DType.uint16, 1] = layer2.get_max(i) + width1 result.data.push_back(SIMD[DType.uint16, 2](min, max)) return result ^ @always_inline("nodebug") fn __init__(inout self, v: VariadicList[Tuple[Int, Int]]): self.data = DynamicVector[Self.LayerData]() for i in range(v.__len__()): let v1 = v[i].get[0, Int]() let v2 = v[i].get[1, Int]() if v1 < v2: self.data.push_back(SIMD[DType.uint16, 2](v1, v2)) else: self.data.push_back(SIMD[DType.uint16, 2](v2, v1)) @always_inline("nodebug") fn __init__(inout self): self.data = DynamicVector[Self.LayerData]() # trait CollectionElement @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.data = existing.data # trait CollectionElement @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): self.data = existing.data # trait CollectionElement @always_inline("nodebug") fn __del__(owned self: Self): pass # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: var result: String = "" let s = len(self.data) if s > 0: for i in range(s - 1): let min = self.get_min(i) let max = self.get_max(i) result += "(" + str(min) + "," + str(max) + ")," let min = self.get_min(s - 1) let max = self.get_max(s - 1) result += "(" + str(min) + "," + str(max) + ")" return result # trait Sized @always_inline("nodebug") fn __len__(self) -> Int: return len(self.data) @always_inline("nodebug") fn get_min(self, idx: Int) -> Int: return self.data[idx][0].to_int() @always_inline("nodebug") fn get_max(self, idx: Int) -> Int: return self.data[idx][1].to_int() --- sort_network/SwapData.mojo --- from collections.vector import DynamicVector from sort_network.Layer import Layer # A sorting network consists of a collection of compare/exchange elements (tuples) ordered in layers struct SwapData(Stringable): var data: DynamicVector[Layer] var channels: Int var n_layers: Int @always_inline("nodebug") fn __init__(inout self, channels: Int, n_layers: Int): self.data = DynamicVector[Layer]() self.channels = channels self.n_layers = n_layers @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.data = existing.data self.channels = existing.channels self.n_layers = existing.n_layers # get the i-th layer @always_inline("nodebug") fn __getitem__(self, idx: Int) -> Layer: return self.data[idx] @always_inline("nodebug") fn get[idx: Int](self) -> Layer: return self.data[idx] # add a layer of swaps @always_inline("nodebug") fn add_layer( inout self, layer_id: Int, layer_content: VariadicList[Tuple[Int, Int]] ): let x = Layer(layer_content) self.data.push_back(x ^) @always_inline("nodebug") fn add_layer_l(inout self, layer: Layer): self.data.push_back(layer) # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: let n_layer = str(self.count_layers()) let n_ce = str(self.count_ce()) var result: String = "Sorting network for ? inputs, " + n_ce + " CEs, " + n_layer + " layers:\n" for i in range(len(self.data)): result += str(self.data[i]) + "\n" return result fn to_code(self) -> String: let n_layers = self.count_layers() # fmt: off var result: String = "var result = SwapData(" + str(self.channels) + ", " + str(n_layers) + ")\n" for i in range(n_layers): result += "result.add_layer(" + str(i) + ", VariadicList(" + str(self.data[i]) + "))\n" return result # fmt: on # count number of compare/exchange elements @always_inline("nodebug") fn count_ce(self) -> Int: var result = 0 for i in range(len(self.data)): result += len(self.data[i]) return result # count number of layers @always_inline("nodebug") fn count_layers(self) -> Int: return len(self.data) --- sort_network/__init__.mojo --- from .sort_network import sn, sn_merge, swap_data from .sort_network_data import join_swap_data from .performance import test_performance1, test_performance2 from .test_individual import test_netw_SIMD_sort --- sort_network/crash3.mojo --- # A sorting network consists of a collection of compare/exchange elements (tuples) ordered in layers struct SwapData(Stringable): var data: DynamicVector[Layer] @always_inline("nodebug") fn __init__(inout self): self.data = DynamicVector[Layer]() @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.data.__copyinit__(existing.data) # get the i-th layer @always_inline("nodebug") fn __getitem__(self, idx: Int) -> Layer: return self.data[idx] @always_inline("nodebug") fn get[idx: Int](self) -> Layer: return self.data[idx] # add a layer of swaps @always_inline("nodebug") fn add(inout self, layer: VariadicList[Tuple[Int, Int]]): self.data.push_back(Layer(layer)) @always_inline("nodebug") fn add(inout self, layer: Layer): self.data.push_back(layer) # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: let n_layer = str(self.count_layers()) let n_ce = str(self.count_ce()) var result: String = "Sorting network for ? inputs, " + n_ce + " CEs, " + n_layer + " layers:\n" for i in range(len(self.data)): result += str(self.data[i]) + "\n" return result # count number of compare/exchange elements @always_inline("nodebug") fn count_ce(self) -> Int: var result = 0 for i in range(len(self.data)): result += len(self.data[i]) return result # count number of layers @always_inline("nodebug") fn count_layers(self) -> Int: return len(self.data) @always_inline("nodebug") fn get_width(self) -> Int: var result: Int = -1 for i in range(len(self.data)): for j in range(len(self.data[i])): let m = self.data[i].get_max(j) if m > result: result = m return result + 1 # plus one because we start counting at zero struct Layer(CollectionElement, Sized, Stringable): var data: DynamicVector[Int] @staticmethod @always_inline("nodebug") fn pack(t: Tuple[Int, Int]) -> Int: let v1 = t.get[0, Int]() let v2 = t.get[1, Int]() if v1 < v2: return (v1 << 16) | v2 else: return (v2 << 16) | v1 # unpack Tuple[Minimum, Maximum] @staticmethod @always_inline("nodebug") fn unpack(v: Int) -> Tuple[Int, Int]: return (v >> 16, v & 0xFFFF) @always_inline("nodebug") fn __init__(inout self): self.data = DynamicVector[Int]() @always_inline("nodebug") fn __init__(inout self, v: VariadicList[Tuple[Int, Int]]): self.data = DynamicVector[Int](v.__len__()) for i in range(v.__len__()): self.data.push_back(Layer.pack(v[i])) fn __init__(inout self, v: DynamicVector[Tuple[Int, Int]]): self.data = DynamicVector[Int](v.__len__()) for i in range(v.__len__()): self.data.push_back(Layer.pack(v[i])) # trait CollectionElement @always_inline("nodebug") fn __copyinit__(inout self, existing: Self): self.data.__copyinit__(existing.data) # trait CollectionElement @always_inline("nodebug") fn __moveinit__(inout self, owned existing: Self): self.data = existing.data ^ # trait CollectionElement @always_inline("nodebug") fn __del__(owned self: Self): pass # trait Stringable @always_inline("nodebug") fn __str__(self) -> String: var result: String = "[" let size = len(self.data) if size > 0: for i in range(size - 1): result += "(" + str(self.get_min(i)) + "," + str(self.get_max(i)) + ")," result += ( "(" + str(self.get_min(size - 1)) + "," + str(self.get_max(size - 1)) + ")" ) return result + "]" # trait Sized @always_inline("nodebug") fn __len__(self) -> Int: return len(self.data) @always_inline("nodebug") fn get_min(self, idx: Int) -> Int: return Layer.unpack(self.data[idx]).get[0, Int]() @always_inline("nodebug") fn get_max(self, idx: Int) -> Int: return Layer.unpack(self.data[idx]).get[1, Int]() fn join_swap_data2[sd1: SwapData, sd2: SwapData]() -> SwapData: var result = SwapData() alias width1 = sd1.get_width() alias width2 = sd2.get_width() if width1 != width2: print("ERROR join_swap_data: currently only equal widths are supported") return result for i in range(sd1.count_layers()): var x = DynamicVector[Tuple[Int, Int]](len(sd1[i].data) + len(sd2[i].data)) for j in range(len(sd1[i].data)): x.push_back(Tuple[Int, Int](sd1[i].get_min(j), sd1[i].get_max(j))) for j in range(len(sd2[i].data)): x.push_back( Tuple[Int, Int](sd2[i].get_min(j) + width1, sd2[i].get_max(j) + width1) ) result.add(x) return result fn swap_data() -> SwapData: var result = SwapData() result.add(VariadicList((0, 2), (1, 3), (4, 6), (5, 7))) result.add(VariadicList((0, 4), (1, 5), (2, 6), (3, 7))) result.add(VariadicList((0, 1), (2, 3), (4, 5), (6, 7))) result.add(VariadicList((2, 4), (3, 5))) result.add(VariadicList((1, 4), (3, 6))) result.add(VariadicList((1, 2), (3, 4), (5, 6))) return result fn main(): alias sd1 = swap_data() print(str(sd1)) alias sd2 = join_swap_data2[sd1, sd1]() print(str(sd2)) --- sort_network/crash4.mojo --- fn main(): let data = SIMD[DType.uint16, 16](0) alias SD1 = swap_data() let d2 = xyzzy[SD1[0]](data) print(d2) fn swap_data() -> DynamicVector[Layer]: var result = DynamicVector[Layer]() result.push_back(VariadicList((0, 2), (1, 3), (4, 6), (5, 7))) return result fn xyzzy[swaps: Layer](v: SIMD[DType.uint16, 16]) -> SIMD[DType.uint16, 16]: fn gen_perm[swaps: Layer]() -> StaticIntTuple[16]: let result = StaticIntTuple[16]() for i in range(len(swaps.data)): let from_ = swaps.data[i] # removing this line removes the crash return result alias permutations = gen_perm[swaps]() # changing alias to let removes the crash return v # just do nothing, removing gen_perm removes the crash struct Layer(CollectionElement): var data: DynamicVector[Int] fn __init__(inout self, v: VariadicList[Tuple[Int, Int]]): self.data = DynamicVector[Int]() for i in range(v.__len__()): self.data.push_back(v[i].get[0, Int]()) fn __copyinit__(inout self, existing: Self): self.data = existing.data fn __moveinit__(inout self, owned existing: Self): self.data = existing.data ^ fn __del__(owned self: Self): pass --- sort_network/mllr_examples.mojo --- from benchmark import keep fn main(): # does nothing... let tmp1: NoneType = rebind[NoneType](__mlir_op.`llvm.debugtrap`) @parameter if False: # --------------- let x0 = __mlir_op.`llvm.mlir.constant`[value = __mlir_attr.`42: i32`, _type = __mlir_type.i32]() let y0 = rebind[Scalar[DType.int32]](x0) print("y0="+str(y0)) let x1 = __mlir_op.`llvm.mlir.constant`[value = __mlir_attr.`42.: f32`, _type = __mlir_type.f32]() let y1 = rebind[Scalar[DType.float32]](x1) print("y1="+str(y1)) @parameter if False: # https://mlir.llvm.org/docs/Dialects/LLVM/#llvmadd-llvmaddop let d2a: Scalar[DType.int32] = 10 let d2b: Scalar[DType.int32] = 20 let z2a = rebind[__mlir_type.i32](d2a) let z2b = rebind[__mlir_type.i32](d2b) var x2 = __mlir_op.`llvm.add`[_type = __mlir_type.i32](z2a, z2b) let y2 = rebind[Scalar[DType.int32]](x2) print("y2="+str(y2)) @parameter if False: # https://mlir.llvm.org/docs/Dialects/LLVM/#llvmfadd-llvmfaddop let d3a: Scalar[DType.float32] = 10. let d3b: Scalar[DType.float32] = 20. let z3a = rebind[__mlir_type.f32](d3a) let z3b = rebind[__mlir_type.f32](d3b) var x3 = __mlir_op.`llvm.fadd`[_type = __mlir_type.f32](z3a, z3b) let y3 = rebind[Scalar[DType.float32]](x3) print("y3="+str(y3)) @parameter if False: # https://mlir.llvm.org/docs/Dialects/LLVM/#llvmadd-llvmaddop let d4a: SIMD[DType.int32, 16] = 10 let d4b: SIMD[DType.int32, 16] = 20 let z4a = rebind[__mlir_type.`vector<16xi32>`](d4a) let z4b = rebind[__mlir_type.`vector<16xi32>`](d4b) var x4 = __mlir_op.`llvm.add`[_type = __mlir_type.`vector<16xi32>`](z4a, z4b) let y4 = rebind[SIMD[DType.int32, 16]](x4) print("y4="+str(y4)) @parameter if False: # https://mlir.llvm.org/docs/Dialects/LLVM/#llvmfadd-llvmfaddop let d5a: SIMD[DType.float32, 16] = 10. let d5b: SIMD[DType.float32, 16] = 20. let z5a = rebind[__mlir_type.`vector<16xf32>`](d5a) let z5b = rebind[__mlir_type.`vector<16xf32>`](d5b) # https://llvm.org/docs/LangRef.html#fastmath var x5 = __mlir_op.`llvm.fadd`[_type = __mlir_type.`vector<16xf32>`, _flag = 'fast'](z5a, z5b) let y5 = rebind[SIMD[DType.float32, 16]](x5) print("y5="+str(y5)) @parameter if True: # https://mlir.llvm.org/docs/Dialects/LLVM/#llvmintrmaximum-llvmmaximumop # https://mlir.llvm.org/docs/Dialects/LLVM/#llvmintrmaxnum-llvmmaxnumop let d6a: SIMD[DType.float32, 16] = 10. let d6b: SIMD[DType.float32, 16] = 20. let z6a = rebind[__mlir_type.`vector<16xf32>`](d6a) let z6b = rebind[__mlir_type.`vector<16xf32>`](d6b) #var x6 = __mlir_op.`llvm.intr.maxnum`[_type = __mlir_type.`vector<16xf32>`, _flag = 'fast'](z6a, z6b) var x6 = __mlir_op.`llvm.intr.maximum`[_type = __mlir_type.`vector<16xf32>`, _flag = 'fast'](z6a, z6b) let y6 = rebind[SIMD[DType.float32, 16]](x6) print("y6="+str(y6)) # https://llvm.org/docs/LangRef.html#llvm-maxnum-intrinsic # let data2: T2 = rebind[SIMD[T, channels]](llvm_intrinsic["llvm.maxnum", T2, T2, T2](data0, data1)) #var x2 = __mlir_op.`llvm.maxnum`[_type = __mlir_type.`!pop.scalar<f32>`](d0, d1) #let y2 = rebind[SIMD[DType.uint32, 1]](x1.cast[DType.uint32]) #print("y="+str(y2)) --- sort_network/nan_check.mojo --- from random import random_ui64 from time import now from sys.intrinsics import llvm_intrinsic fn gen_random_SIMD[T: DType, width: Int]() -> SIMD[T, width]: var result = SIMD[T, width]() for i in range(width): result[i] = random_ui64(0, 100).cast[T]() return result fn test_float32_16(): alias T = DType.float32 alias channels = 16 alias T2 = SIMD[T, channels] let data0: T2 = gen_random_SIMD[T, channels]() let data1: T2 = gen_random_SIMD[T, channels]() let start_time_ns = now() let data2: T2 = data0.max(data1) #0x000000000005b6fe <+366>: call rbx #0x000000000005b700 <+368>: mov r14,QWORD PTR [rsp+0x20] #0x000000000005b705 <+373>: mov rax,QWORD PTR [rsp+0x28] #0x000000000005b70a <+378>: mov QWORD PTR [rsp+0x58],rax #0x000000000005b70f <+383>: vmovaps zmm1,ZMMWORD PTR [rsp+0xc0] #0x000000000005b717 <+391>: vmovaps zmm2,ZMMWORD PTR [rsp+0x100] #0x000000000005b71f <+399>: vmaxps zmm0,zmm2,zmm1 #0x000000000005b725 <+405>: vcmpunordps k1,zmm1,zmm1 #0x000000000005b72c <+412>: vmovaps zmm0{k1},zmm2 #0x000000000005b732 <+418>: vmovaps ZMMWORD PTR [rsp+0xc0],zmm0 #0x000000000005b73a <+426>: vxorps xmm0,xmm0,xmm0 #0x000000000005b73e <+430>: vmovaps XMMWORD PTR [rsp+0x30],xmm0 #0x000000000005b744 <+436>: lea rsi,[rsp+0x30] #0x000000000005b749 <+441>: mov edi,0x1 #0x000000000005b74e <+446>: vzeroupper #0x000000000005b751 <+449>: call rbx let elapsed_time_ns = now() - start_time_ns print(data2) print("Elapsed time " + str(elapsed_time_ns) + " ns") fn test_float64_8(): alias T = DType.float64 alias channels = 8 alias T2 = SIMD[T, channels] let data0: T2 = gen_random_SIMD[T, channels]() let data1: T2 = gen_random_SIMD[T, channels]() let start_time_ns = now() let data2: T2 = data0.max(data1) # it turn out that max is equal to "llvm.maxnum.f64" #0x0000000000005bf6 <+278>: call 0x5470 <clock_gettime@plt> #0x0000000000005bfb <+283>: mov rbx,QWORD PTR [rsp+0x40] #0x0000000000005c00 <+288>: mov rax,QWORD PTR [rsp+0x48] #0x0000000000005c05 <+293>: mov QWORD PTR [rsp+0x70],rax #0x0000000000005c0a <+298>: vmovapd zmm0,ZMMWORD PTR [rsp+0xc0] #0x0000000000005c12 <+306>: vmovapd zmm2,ZMMWORD PTR [rsp+0x100] #0x0000000000005c1a <+314>: vmaxpd zmm1,zmm2,zmm0 #0x0000000000005c20 <+320>: vcmpunordpd k1,zmm0,zmm0 #0x0000000000005c27 <+327>: vmovapd zmm1{k1},zmm2 #0x0000000000005c2d <+333>: vmovapd ZMMWORD PTR [rsp+0xc0],zmm1 #0x0000000000005c35 <+341>: vxorpd xmm0,xmm0,xmm0 #0x0000000000005c39 <+345>: vmovapd XMMWORD PTR [rsp+0x50],xmm0 #0x0000000000005c3f <+351>: lea rsi,[rsp+0x50] #0x0000000000005c44 <+356>: mov edi,0x1 #0x0000000000005c49 <+361>: vzeroupper #0x0000000000005c4c <+364>: call 0x5470 <clock_gettime@plt> let elapsed_time_ns = now() - start_time_ns #print(data2) print("Elapsed time " + str(elapsed_time_ns) + " ns") ## llvm.maxnum.f64: # This intrinsic computes the maximum value between two floating-point numbers (f64), but # if one of the inputs is NaN, it returns the other input value. In other words, if one # of the operands is NaN, the result will be the non-NaN operand. # # This behavior is often referred to as "maximum number" semantics. ## llvm.maximum.f64: # This intrinsic computes the maximum value between two floating-point numbers (f64) # according to IEEE 754 floating-point arithmetic rules. If one of the inputs is NaN, the # result will be NaN, regardless of the other operand. # # This behavior adheres strictly to IEEE 754 floating-point arithmetic rules, where any # comparison involving NaN results in NaN. fn test_intrinsic_1(): alias T = DType.float64 alias channels = 8 alias T2 = SIMD[T, channels] let data0: T2 = gen_random_SIMD[T, channels]() let data1: T2 = gen_random_SIMD[T, channels]() let start_time_ns = now() #let data2: T2 = data0.max(data1) # https://llvm.org/docs/LangRef.html#llvm-maximum-intrinsic let data2: T2 = rebind[SIMD[T, channels]](llvm_intrinsic["llvm.maximum", T2, T2, T2](data0, data1)) #0x000000000005b6fe <+366>: call rbx #0x000000000005b700 <+368>: mov r14,QWORD PTR [rsp+0x20] #0x000000000005b705 <+373>: mov rax,QWORD PTR [rsp+0x28] #0x000000000005b70a <+378>: mov QWORD PTR [rsp+0x58],rax #0x000000000005b70f <+383>: vmovdqa64 zmm1,ZMMWORD PTR [rsp+0xc0] #0x000000000005b717 <+391>: vpmovq2m k1,zmm1 #0x000000000005b71d <+397>: vmovapd zmm2,ZMMWORD PTR [rsp+0x100] #0x000000000005b725 <+405>: vblendmpd zmm0{k1},zmm1,zmm2 #0x000000000005b72b <+411>: vmovapd zmm2{k1},zmm1 #0x000000000005b731 <+417>: vmaxpd zmm0,zmm2,zmm0 #0x000000000005b737 <+423>: vcmpunordpd k1,zmm2,zmm2 #0x000000000005b73e <+430>: vmovapd zmm0{k1},zmm2 #0x000000000005b744 <+436>: vmovapd ZMMWORD PTR [rsp+0xc0],zmm0 #0x000000000005b74c <+444>: vxorpd xmm0,xmm0,xmm0 #0x000000000005b750 <+448>: vmovapd XMMWORD PTR [rsp+0x30],xmm0 #0x000000000005b756 <+454>: lea rsi,[rsp+0x30] #0x000000000005b75b <+459>: mov edi,0x1 #0x000000000005b760 <+464>: vzeroupper #0x000000000005b763 <+467>: call rbx let elapsed_time_ns = now() - start_time_ns print(data2) print("Elapsed time " + str(elapsed_time_ns) + " ns") fn test_intrinsic_2(): alias T = DType.float64 alias channels = 8 alias T2 = SIMD[T, channels] let data0: T2 = gen_random_SIMD[T, channels]() let data1: T2 = gen_random_SIMD[T, channels]() let start_time_ns = now() #let data2: T2 = data0.max(data1) # https://llvm.org/docs/LangRef.html#llvm-maxnum-intrinsic let data2: T2 = rebind[SIMD[T, channels]](llvm_intrinsic["llvm.maxnum", T2, T2, T2](data0, data1)) #0x000000000005b6fb <+363>: vzeroupper #0x000000000005b6fe <+366>: call rbx #0x000000000005b700 <+368>: mov r14,QWORD PTR [rsp+0x20] #0x000000000005b705 <+373>: mov rax,QWORD PTR [rsp+0x28] #0x000000000005b70a <+378>: mov QWORD PTR [rsp+0x58],rax #0x000000000005b70f <+383>: vmovapd zmm1,ZMMWORD PTR [rsp+0xc0] #0x000000000005b717 <+391>: vmovapd zmm2,ZMMWORD PTR [rsp+0x100] #0x000000000005b71f <+399>: vmaxpd zmm0,zmm2,zmm1 #0x000000000005b725 <+405>: vcmpunordpd k1,zmm1,zmm1 #0x000000000005b72c <+412>: vmovapd zmm0{k1},zmm2 #0x000000000005b732 <+418>: vmovapd ZMMWORD PTR [rsp+0xc0],zmm0 #0x000000000005b73a <+426>: vxorpd xmm0,xmm0,xmm0 #0x000000000005b73e <+430>: vmovapd XMMWORD PTR [rsp+0x30],xmm0 #0x000000000005b744 <+436>: lea rsi,[rsp+0x30] #0x000000000005b749 <+441>: mov edi,0x1 #0x000000000005b74e <+446>: vzeroupper #0x000000000005b751 <+449>: call rbx let elapsed_time_ns = now() - start_time_ns print(data2) print("Elapsed time " + str(elapsed_time_ns) + " ns") fn test_llvm_1(): let data0: SIMD[DType.float32, 16] = gen_random_SIMD[DType.float32, 16]() let data1: SIMD[DType.float32, 16] = gen_random_SIMD[DType.float32, 16]() #let data0: SIMD[DType.float32, 16] = 10. #let data1: SIMD[DType.float32, 16] = 20. let data0x = rebind[__mlir_type.`vector<16xf32>`](data0) let data1x = rebind[__mlir_type.`vector<16xf32>`](data1) let start_time_ns = now() #var tmp = __mlir_op.`llvm.fadd`[_type = __mlir_type.`vector<16xf32>`, _flag = 'fast'](data0x, data1x) #var tmp = __mlir_op.`llvm.intr.maxnum`[_type = __mlir_type.`vector<16xf32>`, _flag = 'fast'](data0x, data1x) #var tmp = __mlir_op.`llvm.intr.maximum`[_type = __mlir_type.`vector<16xf32>`, _flag = 'fast'](data0x, data1x) var tmp = __mlir_op.`llvm.intr.maxnum`[_type = __mlir_type.`vector<16xf32>`](data0x, data1x) let elapsed_time_ns = now() - start_time_ns # %vec5 = "llvm.maxnum.v16f32"(%vec3, %vec4) : # (vector<16xf32>, vector<16xf32>) -> vector<16xf32> # "llvm.fastmath" = { flags = ["fast"] } let data2 = rebind[SIMD[DType.float32, 16]](tmp) print(data2) print("Elapsed time " + str(elapsed_time_ns) + " ns") fn main(): test_llvm_1() --- sort_network/performance.mojo --- from benchmark import keep from algorithm.sort import sort from time import time_function, now from random import random_ui64 from sort_network.sort_network import ( sn, sn_2x_interleave, sn_2x_parallel, ) from sort_network.test_tools import ( gen_random_SIMD, gen_random_vec, gen_random_pointer, gen_random_DTypePointer, ) from sort_network.sort_network_ml import sn_ml_4n, sn_ml_8n fn load_file(filename: StringLiteral) -> String: try: with open(filename, "r") as f: return f.read() except e: print("Error " + str(e)) return "" fn test_performance1(n_samples: Int, n_iterations: Int): alias sep = "\t" fn experiment1[ T: DType, channels: Int ](n_samples: Int, n_iterations: Int, name: String, sep: String) -> String: fn measure_time_mojo_sort[ T: DType ](n_samples: Int, n_iterations: Int, channels: Int) -> Float32: var best_time_ms: Int = 1 << 62 let buff: Pointer[SIMD[T, 1], 0] = Pointer[SIMD[T, 1]].aligned_alloc( 16, channels * n_iterations ) for iteration in range(channels * n_iterations): buff[iteration] = random_ui64(0, 100).cast[T]() for sample in range(n_samples): var ptr = buff let start_time_ms = now() for iteration in range(n_iterations): # sort[type: DType](inout buff: Pointer[SIMD[type, 1], 0], len: Int) sort[T](ptr, channels) ptr += channels let elapsed_time_ms = now() - start_time_ms if elapsed_time_ms < best_time_ms: best_time_ms = elapsed_time_ms keep(buff) buff.free() return Float32(best_time_ms) / n_iterations fn measure_time_netw_sort_SIMD[ T: DType, channels: Int ](n_samples: Int, n_iterations: Int) -> Float32: @parameter if channels == 256 or channels == 512: return -1 else: var data2 = gen_random_SIMD[T, channels]() var best_time_ms: Int = 1 << 62 for sample in range(n_samples): let start_time_ms = now() for i in range(n_iterations): data2 = sn[T, channels](data2) let elapsed_time_ms = now() - start_time_ms keep(data2) if elapsed_time_ms < best_time_ms: best_time_ms = elapsed_time_ms return Float32(best_time_ms) / n_iterations fn measure_time_netw_sort_SIMD_ml4[ T: DType, channels: Int ](n_samples: Int, n_iterations: Int) -> Float32: @parameter if channels == 8 or channels == 512: return -1 else: var data2 = gen_random_SIMD[T, channels]() var best_time_ms: Int = 1 << 62 for sample in range(n_samples): let start_time_ms = now() for i in range(n_iterations): data2 = sn_ml_4n[T, channels, True](data2) let elapsed_time_ms = now() - start_time_ms keep(data2) if elapsed_time_ms < best_time_ms: best_time_ms = elapsed_time_ms return Float32(best_time_ms) / n_iterations fn measure_time_netw_sort_SIMD_ml8[ T: DType, channels: Int ](n_samples: Int, n_iterations: Int) -> Float32: @parameter if channels == 8 or channels == 16: return -1 else: var data2 = gen_random_SIMD[T, channels]() var best_time_ms: Int = 1 << 62 for sample in range(n_samples): let start_time_ms = now() for i in range(n_iterations): data2 = sn_ml_8n[T, channels, True](data2) let elapsed_time_ms = now() - start_time_ms keep(data2) if elapsed_time_ms < best_time_ms: best_time_ms = elapsed_time_ms return Float32(best_time_ms) / n_iterations fn measure_time_netw_sort_generic[ T: DType ](n_samples: Int, n_iterations: Int, channels: Int) -> Float32: if channels == 256 or channels == 512: return -1 var best_time_ms: Int = 1 << 62 let buff = DTypePointer[T].aligned_alloc(16, channels * n_iterations) for sample in range(n_samples): for iteration in range(channels * n_iterations): buff[iteration] = random_ui64(0, 100).cast[T]() var ptr = buff let start_time_ms = now() for iteration in range(n_iterations): # sort[type: DType](inout buff: Pointer[SIMD[type, 1], 0], len: Int) sn[T](ptr, channels) ptr += channels let elapsed_time_ms = now() - start_time_ms if elapsed_time_ms < best_time_ms: best_time_ms = elapsed_time_ms keep(buff) buff.free() return Float32(best_time_ms) / n_iterations var result = name result += sep result += str(channels) result += sep result += str(measure_time_mojo_sort[T](n_samples, n_iterations, channels)) result += sep result += str(measure_time_netw_sort_SIMD[T, channels](n_samples, n_iterations)) result += sep result += str(measure_time_netw_sort_generic[T](n_samples, n_iterations, channels)) result += sep result += str(measure_time_netw_sort_SIMD_ml4[T, channels](n_samples, n_iterations)) result += sep result += str(measure_time_netw_sort_SIMD_ml8[T, channels](n_samples, n_iterations)) return result fn test_perf[T: DType](n_samples: Int, n_iterations: Int, name: String): print(experiment1[T, 8](n_samples, n_iterations, name, sep)) print(experiment1[T, 16](n_samples, n_iterations, name, sep)) print(experiment1[T, 32](n_samples, n_iterations, name, sep)) print(experiment1[T, 64](n_samples, n_iterations, name, sep)) print(experiment1[T, 128](n_samples, n_iterations, name, sep)) print(experiment1[T, 256](n_samples, n_iterations, name, sep)) print(experiment1[T, 512](n_samples, n_iterations, name, sep)) print("") print(sep + "channels" + sep + "mojo" + sep + "netw_SIMD" + sep + "netw_vec") test_perf[DType.uint8](n_samples, n_iterations, "uint8") test_perf[DType.int8](n_samples, n_iterations, "int8") test_perf[DType.uint16](n_samples, n_iterations, "uint16") test_perf[DType.int16](n_samples, n_iterations, "int16") test_perf[DType.float16](n_samples, n_iterations, "float16") # test_perf[DType.bfloat16](n_samples, n_iterations, "bfloat16") test_perf[DType.uint32](n_samples, n_iterations, "uint32") test_perf[DType.int32](n_samples, n_iterations, "int32") test_perf[DType.float32](n_samples, n_iterations, "float32") test_perf[DType.uint64](n_samples, n_iterations, "uint64") test_perf[DType.int64](n_samples, n_iterations, "int64") test_perf[DType.float64](n_samples, n_iterations, "float64") fn test_performance2(n_samples: Int, n_iterations: Int): alias sep = "\t" fn experiment2[ T: DType, channels: Int ](n_samples: Int, n_iterations: Int, name: String, sep: String) -> String: fn measure_time_2x_sequential[ T: DType, channels: Int ](samples: Int, n_iterations: Int) -> Float32: var data3 = gen_random_SIMD[T, channels]() var best_time_ms: Int = 1 << 62 for sample in range(samples): var data4 = data3 let start_time_ms = now() for i in range(n_iterations): data3 = sn[T, channels, True](data3) data4 = sn[T, channels, True](data4) let elapsed_time_ms = now() - start_time_ms keep(data3) keep(data4) if elapsed_time_ms < best_time_ms: best_time_ms = elapsed_time_ms return Float32(best_time_ms) / n_iterations fn measure_time_2x_interleaved[ T: DType, channels: Int ](samples: Int, n_iterations: Int) -> Float32: var data3 = gen_random_SIMD[T, channels]() var best_time_ms: Int = 1 << 62 for sample in range(samples): var data4 = data3 let start_time_ms = now() for i in range(n_iterations): data3, data4 = sn_2x_interleave[T, T, channels, True, True]( data3, data4 ) let elapsed_time_ms = now() - start_time_ms keep(data3) keep(data4) if elapsed_time_ms < best_time_ms: best_time_ms = elapsed_time_ms return Float32(best_time_ms) / n_iterations fn measure_time_2x_parallel[ T: DType, channels: Int ](samples: Int, n_iterations: Int) -> Float32: var data3 = gen_random_SIMD[T, channels]() var best_time_ms: Int = 1 << 62 for sample in range(samples): var data4 = data3 let start_time_ms = now() for i in range(n_iterations): data3, data4 = sn_2x_parallel[T, channels, True](data3, data4) let elapsed_time_ms = now() - start_time_ms keep(data3) keep(data4) if elapsed_time_ms < best_time_ms: best_time_ms = elapsed_time_ms return Float32(best_time_ms) / n_iterations var result = name result += sep result += str(channels) result += sep result += str(measure_time_2x_sequential[T, channels](n_samples, n_iterations)) result += sep result += str(measure_time_2x_interleaved[T, channels](n_samples, n_iterations)) result += sep result += str(measure_time_2x_parallel[T, channels](n_samples, n_iterations)) return result fn test_perf[T: DType](n_samples: Int, n_iterations: Int, name: String): print(experiment2[T, 8](n_samples, n_iterations, name, sep)) print(experiment2[T, 16](n_samples, n_iterations, name, sep)) print(experiment2[T, 32](n_samples, n_iterations, name, sep)) print(experiment2[T, 64](n_samples, n_iterations, name, sep)) # print(experiment2[T, 128](n_samples, n_iterations, name, sep)) # print(experiment2[T, 256](n_samples, n_iterations, name, sep)) print("") print( sep + "channels" + sep + "2x seq" + sep + "2x interleaved" + sep + "2x parallel" ) test_perf[DType.uint8](n_samples, n_iterations, "uint8") test_perf[DType.int8](n_samples, n_iterations, "int8") test_perf[DType.uint16](n_samples, n_iterations, "uint16") test_perf[DType.int16](n_samples, n_iterations, "int16") test_perf[DType.float16](n_samples, n_iterations, "float16") # test_perf[DType.bfloat16](n_samples, n_iterations, "bfloat16") test_perf[DType.uint32](n_samples, n_iterations, "uint32") test_perf[DType.int32](n_samples, n_iterations, "int32") test_perf[DType.float32](n_samples, n_iterations, "float32") test_perf[DType.uint64](n_samples, n_iterations, "uint64") test_perf[DType.int64](n_samples, n_iterations, "int64") test_perf[DType.float64](n_samples, n_iterations, "float64") --- sort_network/shuffle_test.mojo --- from random import random_ui64 from time import now from sort_network.sort_tools import my_shuffle, gen_perm from sort_network.sort_network_data import swap_data from sort_network.SwapData import Layer, SwapData fn gen_random_SIMD[T: DType, width: Int]() -> SIMD[T, width]: var result = SIMD[T, width]() for i in range(width): result[i] = random_ui64(0, 100).cast[T]() return result @always_inline fn my_shuffle2[T: DType, width: Int, p: StaticIntTuple[width]](v: SIMD[T, width]) -> SIMD[T, width]: @parameter if width == 8: alias x = VariadicList[Int](p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]) return v._shuffle_list[x, width](v) else: constrained[False]() return v fn main(): alias T = DType.int16 alias channels = 32 alias sd: SwapData = swap_data[channels]() alias perm = gen_perm[sd[2], channels]() let x: SIMD[T, channels] = gen_random_SIMD[T, channels]() let start_time_ns = now() let y = my_shuffle[T, channels, perm](x) #let y = my_shuffle2[T, 8, perm](x) let elapsed_time_ns = now() - start_time_ns print(y) print("Elapsed time " + str(elapsed_time_ns) + " ns") --- sort_network/sort_network.mojo --- from algorithm.sort import sort from collections.vector import InlinedFixedVector from sort_network.sort_tools import swap_n, swap_idx, gen_perm from sort_network.SwapData import SwapData from sort_network.sort_network_data import ( swap_data, swap_data_2x, swap_data_already_sorted_32_32, swap_data_already_sorted_16_16, swap_data_already_sorted_8_8, swap_data_already_sorted_4_4, ) fn sn[ T: DType, channels: Int, ascending: Bool = True ](v: SIMD[T, channels]) -> SIMD[T, channels]: alias sd: SwapData = swap_data[channels]() alias n_layers: Int = sd.n_layers let v0 = swap_n[T, channels, sd[0], ascending](v) @parameter if n_layers == 1: return v0 let v1 = swap_n[T, channels, sd[1], ascending](v0) @parameter if n_layers == 2: return v1 let v2 = swap_n[T, channels, sd[2], ascending](v1) @parameter if n_layers == 3: return v2 let v3 = swap_n[T, channels, sd[3], ascending](v2) @parameter if n_layers == 4: return v3 let v4 = swap_n[T, channels, sd[4], ascending](v3) @parameter if n_layers == 5: return v4 let v5 = swap_n[T, channels, sd[5], ascending](v4) @parameter if n_layers == 6: return v5 let v6 = swap_n[T, channels, sd[6], ascending](v5) @parameter if n_layers == 7: return v6 let v7 = swap_n[T, channels, sd[7], ascending](v6) @parameter if n_layers == 8: return v7 let v8 = swap_n[T, channels, sd[8], ascending](v7) @parameter if n_layers == 9: return v8 let v9 = swap_n[T, channels, sd[9], ascending](v8) @parameter if n_layers == 10: return v9 let v10 = swap_n[T, channels, sd[10], ascending](v9) @parameter if n_layers == 11: return v10 let v11 = swap_n[T, channels, sd[11], ascending](v10) @parameter if n_layers == 12: return v11 let v12 = swap_n[T, channels, sd[12], ascending](v11) @parameter if n_layers == 13: return v12 let v13 = swap_n[T, channels, sd[13], ascending](v12) @parameter if n_layers == 14: return v13 let v14 = swap_n[T, channels, sd[14], ascending](v13) @parameter if n_layers == 15: return v14 let v15 = swap_n[T, channels, sd[15], ascending](v14) @parameter if n_layers == 16: return v15 let v16 = swap_n[T, channels, sd[16], ascending](v15) @parameter if n_layers == 17: return v16 let v17 = swap_n[T, channels, sd[17], ascending](v16) @parameter if n_layers == 18: return v17 let v18 = swap_n[T, channels, sd[18], ascending](v17) @parameter if n_layers == 19: return v18 let v19 = swap_n[T, channels, sd[19], ascending](v18) @parameter if n_layers == 20: return v19 let v20 = swap_n[T, channels, sd[20], ascending](v19) @parameter if n_layers == 21: return v20 let v21 = swap_n[T, channels, sd[21], ascending](v20) @parameter if n_layers == 22: return v21 let v22 = swap_n[T, channels, sd[22], ascending](v21) @parameter if n_layers == 23: return v22 let v23 = swap_n[T, channels, sd[23], ascending](v22) @parameter if n_layers == 24: return v23 let v24 = swap_n[T, channels, sd[24], ascending](v23) @parameter if n_layers == 25: return v24 let v25 = swap_n[T, channels, sd[25], ascending](v24) @parameter if n_layers == 26: return v25 let v26 = swap_n[T, channels, sd[26], ascending](v25) @parameter if n_layers == 27: return v26 print( "ERROR: channels " + str(channels) + " gives n_layers " + str(n_layers) + " not implemented yet" ) return v # drop-in replacement for `sort[type: DType](inout buff: Pointer[SIMD[type, 1], 0], len: Int)` @always_inline fn sn[type: DType, ascending: Bool = True](inout v: DTypePointer[type], size: Int): @always_inline fn load_sort_store[ type: DType, ascending: Bool, size: Int ](inout v: DTypePointer[type]): let v1: SIMD[type, size] = v.simd_load[size](0) let v2: SIMD[type, size] = sn[type, size, ascending](v1) v.simd_store[size](v2) if size <= 8: load_sort_store[type, ascending, 8](v) elif size <= 16: load_sort_store[type, ascending, 16](v) elif size <= 32: load_sort_store[type, ascending, 32](v) elif size <= 64: load_sort_store[type, ascending, 64](v) elif size <= 128: load_sort_store[type, ascending, 128](v) else: pass # TODO # sort[type](v, size) # use stdlib sort @always_inline fn sn_new[ T: DType, channels: Int, ascending: Bool = True ](v: SIMD[T, channels]) -> SIMD[T, channels]: alias sd: SwapData = swap_data[channels]() return sn_internal_CRASHES[T, channels, sd, ascending](v) @always_inline fn sn_internal_CRASHES[ T: DType, channels: Int, sd: SwapData, ascending: Bool ](v: SIMD[T, channels]) -> SIMD[T, channels]: alias n_layers: Int = sd.n_layers let v0 = swap_n[T, channels, sd[0], ascending](v) let v1 = swap_n[T, channels, sd[1], ascending](v0) let v2 = swap_n[T, channels, sd[2], ascending](v1) let v3 = swap_n[T, channels, sd[3], ascending](v2) let v4 = swap_n[T, channels, sd[4], ascending](v3) let v5 = swap_n[T, channels, sd[5], ascending](v4) let v6 = swap_n[T, channels, sd[6], ascending](v5) let v7 = swap_n[T, channels, sd[7], ascending](v6) @parameter if n_layers == 8: return v7 let v8 = swap_n[T, channels, sd[8], ascending](v7) @parameter if n_layers == 9: return v8 let v9 = swap_n[T, channels, sd[9], ascending](v8) @parameter if n_layers == 10: return v9 return v # sort SIMD v, and apply the same reodering of v to idx @always_inline fn sn_idx[ T1: DType, T2: DType, channels: Int, ascending: Bool ](v: SIMD[T1, channels], idx: SIMD[T2, channels]) -> ( SIMD[T1, channels], SIMD[T2, channels], ): alias sd = swap_data[channels]() alias n_layers = sd.n_layers let t0 = swap_idx[T1, T2, channels, sd[1], ascending]((v, idx)) @parameter if n_layers == 1: return t0 let t1 = swap_idx[T1, T2, channels, sd[1], ascending](t0) @parameter if n_layers == 2: return t1 let t2 = swap_idx[T1, T2, channels, sd[2], ascending](t1) @parameter if n_layers == 3: return t2 let t3 = swap_idx[T1, T2, channels, sd[3], ascending](t2) @parameter if n_layers == 4: return t3 let t4 = swap_idx[T1, T2, channels, sd[4], ascending](t3) @parameter if n_layers == 5: return t4 let t5 = swap_idx[T1, T2, channels, sd[5], ascending](t4) @parameter if n_layers == 6: return t5 let t6 = swap_idx[T1, T2, channels, sd[6], ascending](t5) @parameter if n_layers == 7: return t6 let t7 = swap_idx[T1, T2, channels, sd[7], ascending](t6) @parameter if n_layers == 8: return t7 let t8 = swap_idx[T1, T2, channels, sd[8], ascending](t7) @parameter if n_layers == 9: return t8 let t9 = swap_idx[T1, T2, channels, sd[9], ascending](t8) @parameter if n_layers == 10: return t9 let t10 = swap_idx[T1, T2, channels, sd[10], ascending](t9) @parameter if n_layers == 11: return t10 let t11 = swap_idx[T1, T2, channels, sd[11], ascending](t10) @parameter if n_layers == 12: return t11 let t12 = swap_idx[T1, T2, channels, sd[12], ascending](t11) @parameter if n_layers == 13: return t12 let t13 = swap_idx[T1, T2, channels, sd[13], ascending](t12) @parameter if n_layers == 14: return t13 let t14 = swap_idx[T1, T2, channels, sd[14], ascending](t13) @parameter if n_layers == 15: return t14 let t15 = swap_idx[T1, T2, channels, sd[15], ascending](t14) @parameter if n_layers == 16: return t15 let t16 = swap_idx[T1, T2, channels, sd[16], ascending](t15) @parameter if n_layers == 17: return t16 let t17 = swap_idx[T1, T2, channels, sd[17], ascending](t16) @parameter if n_layers == 18: return t17 let t18 = swap_idx[T1, T2, channels, sd[18], ascending](t17) @parameter if n_layers == 19: return t18 let t19 = swap_idx[T1, T2, channels, sd[19], ascending](t18) @parameter if n_layers == 20: return t19 let t20 = swap_idx[T1, T2, channels, sd[20], ascending](t19) @parameter if n_layers == 21: return t20 let t21 = swap_idx[T1, T2, channels, sd[21], ascending](t20) @parameter if n_layers == 22: return t21 let t22 = swap_idx[T1, T2, channels, sd[22], ascending](t21) @parameter if n_layers == 23: return t22 let t23 = swap_idx[T1, T2, channels, sd[23], ascending](t22) @parameter if n_layers == 24: return t23 let t24 = swap_idx[T1, T2, channels, sd[24], ascending](t23) @parameter if n_layers == 25: return t24 let t25 = swap_idx[T1, T2, channels, sd[25], ascending](t24) @parameter if n_layers == 26: return t25 let t26 = swap_idx[T1, T2, channels, sd[26], ascending](t25) @parameter if n_layers == 27: return t26 # fmt: off print("channels " + str(channels) + " gives n_layers " + str(n_layers) + " not implemented yet") # fmt: on return (v, idx) # sort SIMD arrays va and vb (for the price of one) @always_inline fn sn_2x_interleave[ T1: DType, T2: DType, channels: Int, ascending1: Bool = True, ascending2: Bool = True, ](va: SIMD[T1, channels], vb: SIMD[T2, channels]) -> ( SIMD[T1, channels], SIMD[T2, channels], ): alias sd: SwapData = swap_data[channels]() alias n_layers: Int = sd.n_layers let v0a = swap_n[T1, channels, sd[0], ascending1](va) let v0b = swap_n[T2, channels, sd[0], ascending2](vb) @parameter if n_layers == 1: return (v0a, v0b) let v1a = swap_n[T1, channels, sd[1], ascending1](v0a) let v1b = swap_n[T2, channels, sd[1], ascending2](v0b) @parameter if n_layers == 2: return (v1a, v1b) let v2a = swap_n[T1, channels, sd[2], ascending1](v1a) let v2b = swap_n[T2, channels, sd[2], ascending2](v1b) @parameter if n_layers == 3: return (v2a, v2b) let v3a = swap_n[T1, channels, sd[3], ascending1](v2a) let v3b = swap_n[T2, channels, sd[3], ascending2](v2b) @parameter if n_layers == 4: return (v3a, v3b) let v4a = swap_n[T1, channels, sd[4], ascending1](v3a) let v4b = swap_n[T2, channels, sd[4], ascending2](v3b) @parameter if n_layers == 5: return (v4a, v4b) let v5a = swap_n[T1, channels, sd[5], ascending1](v4a) let v5b = swap_n[T2, channels, sd[5], ascending2](v4b) @parameter if n_layers == 6: return (v5a, v5b) let v6a = swap_n[T1, channels, sd[6], ascending1](v5a) let v6b = swap_n[T2, channels, sd[6], ascending2](v5b) @parameter if n_layers == 7: return (v6a, v6b) let v7a = swap_n[T1, channels, sd[7], ascending1](v6a) let v7b = swap_n[T2, channels, sd[7], ascending2](v6b) @parameter if n_layers == 8: return (v7a, v7b) let v8a = swap_n[T1, channels, sd[8], ascending1](v7a) let v8b = swap_n[T2, channels, sd[8], ascending2](v7b) @parameter if n_layers == 9: return (v8a, v8b) let v9a = swap_n[T1, channels, sd[9], ascending1](v8a) let v9b = swap_n[T2, channels, sd[9], ascending2](v8b) @parameter if n_layers == 10: return (v9a, v9b) let v10a = swap_n[T1, channels, sd[10], ascending1](v9a) let v10b = swap_n[T2, channels, sd[10], ascending2](v9b) @parameter if n_layers == 11: return (v10a, v10b) let v11a = swap_n[T1, channels, sd[11], ascending1](v10a) let v11b = swap_n[T2, channels, sd[11], ascending2](v10b) @parameter if n_layers == 12: return (v11a, v11b) let v12a = swap_n[T1, channels, sd[12], ascending1](v11a) let v12b = swap_n[T2, channels, sd[12], ascending2](v11b) @parameter if n_layers == 13: return (v12a, v12b) let v13a = swap_n[T1, channels, sd[13], ascending1](v12a) let v13b = swap_n[T2, channels, sd[13], ascending2](v12b) @parameter if n_layers == 14: return (v13a, v13b) let v14a = swap_n[T1, channels, sd[14], ascending1](v13a) let v14b = swap_n[T2, channels, sd[14], ascending2](v13b) @parameter if n_layers == 15: return (v14a, v14b) let v15a = swap_n[T1, channels, sd[15], ascending1](v14a) let v15b = swap_n[T2, channels, sd[15], ascending2](v14b) @parameter if n_layers == 16: return (v15a, v15b) let v16a = swap_n[T1, channels, sd[16], ascending1](v15a) let v16b = swap_n[T2, channels, sd[16], ascending2](v15b) @parameter if n_layers == 17: return (v16a, v16b) let v17a = swap_n[T1, channels, sd[17], ascending1](v16a) let v17b = swap_n[T2, channels, sd[17], ascending2](v16b) @parameter if n_layers == 18: return (v17a, v17b) let v18a = swap_n[T1, channels, sd[18], ascending1](v17a) let v18b = swap_n[T2, channels, sd[18], ascending2](v17b) @parameter if n_layers == 19: return (v18a, v18b) let v19a = swap_n[T1, channels, sd[19], ascending1](v18a) let v19b = swap_n[T2, channels, sd[19], ascending2](v18b) @parameter if n_layers == 20: return (v19a, v19b) let v20a = swap_n[T1, channels, sd[20], ascending1](v19a) let v20b = swap_n[T2, channels, sd[20], ascending2](v19b) @parameter if n_layers == 21: return (v20a, v20b) let v21a = swap_n[T1, channels, sd[21], ascending1](v20a) let v21b = swap_n[T2, channels, sd[21], ascending2](v20b) @parameter if n_layers == 22: return (v21a, v21b) let v22a = swap_n[T1, channels, sd[22], ascending1](v21a) let v22b = swap_n[T2, channels, sd[22], ascending2](v21b) @parameter if n_layers == 23: return (v22a, v22b) let v23a = swap_n[T1, channels, sd[23], ascending1](v22a) let v23b = swap_n[T2, channels, sd[23], ascending2](v22b) @parameter if n_layers == 24: return (v23a, v23b) let v24a = swap_n[T1, channels, sd[24], ascending1](v23a) let v24b = swap_n[T2, channels, sd[24], ascending2](v23b) @parameter if n_layers == 25: return (v24a, v24b) let v25a = swap_n[T1, channels, sd[25], ascending1](v24a) let v25b = swap_n[T2, channels, sd[25], ascending2](v24b) @parameter if n_layers == 26: return (v25a, v25b) let v26a = swap_n[T1, channels, sd[26], ascending1](v25a) let v26b = swap_n[T2, channels, sd[26], ascending2](v25b) @parameter if n_layers == 27: return (v26a, v26b) print( "ERROR: channels " + str(channels) + " gives n_layers " + str(n_layers) + " not implemented yet" ) return va, vb @always_inline fn sn_2x_parallel[ T: DType, channels: Int, ascending: Bool = True ](va: SIMD[T, channels], vb: SIMD[T, channels]) -> ( SIMD[T, channels], SIMD[T, channels], ): alias sd: SwapData = swap_data_2x[channels]() alias n_layers: Int = sd.n_layers let v0 = swap_n[T, 2 * channels, sd[0], ascending](va.join(vb)) @parameter if n_layers == 1: return v0.slice[channels](0), v0.slice[channels](channels) let v1 = swap_n[T, 2 * channels, sd[1], ascending](v0) @parameter if n_layers == 2: return v1.slice[channels](0), v1.slice[channels](channels) let v2 = swap_n[T, 2 * channels, sd[2], ascending](v1) @parameter if n_layers == 3: return v2.slice[channels](0), v2.slice[channels](channels) let v3 = swap_n[T, 2 * channels, sd[3], ascending](v2) @parameter if n_layers == 4: return v3.slice[channels](0), v3.slice[channels](channels) let v4 = swap_n[T, 2 * channels, sd[4], ascending](v3) @parameter if n_layers == 5: return v4.slice[channels](0), v4.slice[channels](channels) let v5 = swap_n[T, 2 * channels, sd[5], ascending](v4) @parameter if n_layers == 6: return v5.slice[channels](0), v5.slice[channels](channels) let v6 = swap_n[T, 2 * channels, sd[6], ascending](v5) @parameter if n_layers == 7: return v6.slice[channels](0), v6.slice[channels](channels) let v7 = swap_n[T, 2 * channels, sd[7], ascending](v6) @parameter if n_layers == 8: return v7.slice[channels](0), v7.slice[channels](channels) let v8 = swap_n[T, 2 * channels, sd[8], ascending](v7) @parameter if n_layers == 9: return v8.slice[channels](0), v8.slice[channels](channels) let v9 = swap_n[T, 2 * channels, sd[9], ascending](v8) @parameter if n_layers == 10: return v9.slice[channels](0), v9.slice[channels](channels) let v10 = swap_n[T, 2 * channels, sd[10], ascending](v9) @parameter if n_layers == 11: return v10.slice[channels](0), v10.slice[channels](channels) let v11 = swap_n[T, 2 * channels, sd[11], ascending](v10) @parameter if n_layers == 12: return v11.slice[channels](0), v11.slice[channels](channels) let v12 = swap_n[T, 2 * channels, sd[12], ascending](v11) @parameter if n_layers == 13: return v12.slice[channels](0), v12.slice[channels](channels) let v13 = swap_n[T, 2 * channels, sd[13], ascending](v12) @parameter if n_layers == 14: return v13.slice[channels](0), v13.slice[channels](channels) let v14 = swap_n[T, 2 * channels, sd[14], ascending](v13) @parameter if n_layers == 15: return v14.slice[channels](0), v14.slice[channels](channels) let v15 = swap_n[T, 2 * channels, sd[15], ascending](v14) @parameter if n_layers == 16: return v15.slice[channels](0), v15.slice[channels](channels) let v16 = swap_n[T, 2 * channels, sd[16], ascending](v15) @parameter if n_layers == 17: return v16.slice[channels](0), v16.slice[channels](channels) let v17 = swap_n[T, 2 * channels, sd[17], ascending](v16) @parameter if n_layers == 18: return v17.slice[channels](0), v17.slice[channels](channels) let v18 = swap_n[T, 2 * channels, sd[18], ascending](v17) @parameter if n_layers == 19: return v18.slice[channels](0), v18.slice[channels](channels) let v19 = swap_n[T, 2 * channels, sd[19], ascending](v18) @parameter if n_layers == 20: return v19.slice[channels](0), v19.slice[channels](channels) let v20 = swap_n[T, 2 * channels, sd[20], ascending](v19) @parameter if n_layers == 21: return v20.slice[channels](0), v20.slice[channels](channels) let v21 = swap_n[T, 2 * channels, sd[21], ascending](v20) @parameter if n_layers == 22: return v21.slice[channels](0), v21.slice[channels](channels) let v22 = swap_n[T, 2 * channels, sd[22], ascending](v21) @parameter if n_layers == 23: return v22.slice[channels](0), v22.slice[channels](channels) let v23 = swap_n[T, 2 * channels, sd[23], ascending](v22) @parameter if n_layers == 24: return v23.slice[channels](0), v23.slice[channels](channels) let v24 = swap_n[T, 2 * channels, sd[24], ascending](v23) @parameter if n_layers == 25: return v24.slice[channels](0), v24.slice[channels](channels) let v25 = swap_n[T, 2 * channels, sd[25], ascending](v24) @parameter if n_layers == 26: return v25.slice[channels](0), v25.slice[channels](channels) let v26 = swap_n[T, 2 * channels, sd[26], ascending](v25) @parameter if n_layers == 27: return v26.slice[channels](0), v26.slice[channels](channels) print( "ERROR: channels " + str(channels) + " gives n_layers " + str(n_layers) + " not implemented yet" ) return va, vb # sorting network for merging: upper and lower half of channels are already sorted @always_inline fn sn_merge[ T: DType, channels: Int, ascending: Bool ](v: SIMD[T, channels]) -> SIMD[T, channels]: @parameter if channels == 8: alias sd: SwapData = swap_data_already_sorted_4_4() constrained[3 == sd.n_layers]() let v0 = swap_n[T, channels, sd[0], ascending](v) let v1 = swap_n[T, channels, sd[1], ascending](v0) let v2 = swap_n[T, channels, sd[2], ascending](v1) return v2 elif channels == 16: alias sd: SwapData = swap_data_already_sorted_8_8() constrained[4 == sd.n_layers]() let v0 = swap_n[T, channels, sd[0], ascending](v) let v1 = swap_n[T, channels, sd[1], ascending](v0) let v2 = swap_n[T, channels, sd[2], ascending](v1) let v3 = swap_n[T, channels, sd[3], ascending](v2) return v3 elif channels == 32: alias sd: SwapData = swap_data_already_sorted_16_16() constrained[5 == sd.n_layers]() let v0 = swap_n[T, channels, sd[0], ascending](v) let v1 = swap_n[T, channels, sd[1], ascending](v0) let v2 = swap_n[T, channels, sd[2], ascending](v1) let v3 = swap_n[T, channels, sd[3], ascending](v2) let v4 = swap_n[T, channels, sd[4], ascending](v3) return v4 elif channels == 64: alias sd: SwapData = swap_data_already_sorted_32_32() constrained[7 == sd.n_layers]() let v0 = swap_n[T, channels, sd[0], ascending](v) let v1 = swap_n[T, channels, sd[1], ascending](v0) let v2 = swap_n[T, channels, sd[2], ascending](v1) let v3 = swap_n[T, channels, sd[3], ascending](v2) let v4 = swap_n[T, channels, sd[4], ascending](v3) let v5 = swap_n[T, channels, sd[5], ascending](v4) let v6 = swap_n[T, channels, sd[6], ascending](v5) return v6 else: debug_assert(True, "Not implemented yet") return v --- sort_network/sort_network_data.mojo --- from sort_network.SwapData import Layer, SwapData # join_swap_data joins two swap data's into one sorting network. # The number of layers doe not increase, only the number of swaps increases fn join_swap_data[sd1: SwapData, sd2: SwapData]() -> SwapData: alias channels1 = sd1.channels alias channels2 = sd2.channels var result = SwapData(channels1 + channels2, sd1.n_layers) for i in range(sd1.count_layers()): result.add_layer_l(Layer.merge(sd1[i], sd2[i], channels1)) return result fn join_swap_data(sd1: SwapData, sd2: SwapData) -> SwapData: let channels1 = sd1.channels let channels2 = sd2.channels var result = SwapData(channels1 + channels2, sd1.n_layers) for i in range(sd1.count_layers()): result.add_layer_l(Layer.merge(sd1[i], sd2[i], channels1)) return result fn swap_data_2x[channels: Int]() -> SwapData: # fmt: off @parameter if channels == 8: var result = SwapData(16, 6) #constrained[swap_data[channels].n_layers == 6]() result.add_layer(0, VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15))) result.add_layer(1, VariadicList((0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15))) result.add_layer(2, VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15))) result.add_layer(3, VariadicList((2,4),(3,5),(10,12),(11,13))) result.add_layer(4, VariadicList((1,4),(3,6),(9,12),(11,14))) result.add_layer(5, VariadicList((1,2),(3,4),(5,6),(9,10),(11,12),(13,14))) return result @parameter if channels == 16: var result = SwapData(32, 9) result.add_layer(0, VariadicList((0,5),(1,4),(2,12),(3,13),(6,7),(8,9),(10,15),(11,14),(16,21),(17,20),(18,28),(19,29),(22,23),(24,25),(26,31),(27,30))) result.add_layer(1, VariadicList((0,2),(1,10),(3,6),(4,7),(5,14),(8,11),(9,12),(13,15),(16,18),(17,26),(19,22),(20,23),(21,30),(24,27),(25,28),(29,31))) result.add_layer(2, VariadicList((0,8),(1,3),(2,11),(4,13),(5,9),(6,10),(7,15),(12,14),(16,24),(17,19),(18,27),(20,29),(21,25),(22,26),(23,31),(28,30))) result.add_layer(3, VariadicList((0,1),(2,4),(3,8),(5,6),(7,12),(9,10),(11,13),(14,15),(16,17),(18,20),(19,24),(21,22),(23,28),(25,26),(27,29),(30,31))) result.add_layer(4, VariadicList((1,3),(2,5),(4,8),(6,9),(7,11),(10,13),(12,14),(17,19),(18,21),(20,24),(22,25),(23,27),(26,29),(28,30))) result.add_layer(5, VariadicList((1,2),(3,5),(4,11),(6,8),(7,9),(10,12),(13,14),(17,18),(19,21),(20,27),(22,24),(23,25),(26,28),(29,30))) result.add_layer(6, VariadicList((2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29))) result.add_layer(7, VariadicList((4,6),(5,7),(8,10),(9,11),(20,22),(21,23),(24,26),(25,27))) result.add_layer(8, VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(19,20),(21,22),(23,24),(25,26),(27,28))) return result @parameter if channels == 32: var result = SwapData(64, 14) result.add_layer(0, VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47),(48,49),(50,51),(52,53),(54,55),(56,57),(58,59),(60,61),(62,63))) result.add_layer(1, VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47),(48,50),(49,51),(52,54),(53,55),(56,58),(57,59),(60,62),(61,63))) result.add_layer(2, VariadicList((0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15),(16,20),(17,21),(18,22),(19,23),(24,28),(25,29),(26,30),(27,31),(32,36),(33,37),(34,38),(35,39),(40,44),(41,45),(42,46),(43,47),(48,52),(49,53),(50,54),(51,55),(56,60),(57,61),(58,62),(59,63))) result.add_layer(3, VariadicList((0,8),(1,9),(2,10),(3,11),(4,12),(5,13),(6,14),(7,15),(16,24),(17,25),(18,26),(19,27),(20,28),(21,29),(22,30),(23,31),(32,40),(33,41),(34,42),(35,43),(36,44),(37,45),(38,46),(39,47),(48,56),(49,57),(50,58),(51,59),(52,60),(53,61),(54,62),(55,63))) result.add_layer(4, VariadicList((0,16),(1,8),(2,4),(3,12),(5,10),(6,9),(7,14),(11,13),(15,31),(17,24),(18,20),(19,28),(21,26),(22,25),(23,30),(27,29),(32,48),(33,40),(34,36),(35,44),(37,42),(38,41),(39,46),(43,45),(47,63),(49,56),(50,52),(51,60),(53,58),(54,57),(55,62),(59,61))) result.add_layer(5, VariadicList((1,2),(3,5),(4,8),(6,22),(7,11),(9,25),(10,12),(13,14),(17,18),(19,21),(20,24),(23,27),(26,28),(29,30),(33,34),(35,37),(36,40),(38,54),(39,43),(41,57),(42,44),(45,46),(49,50),(51,53),(52,56),(55,59),(58,60),(61,62))) result.add_layer(6, VariadicList((1,17),(2,18),(3,19),(4,20),(5,10),(7,23),(8,24),(11,27),(12,28),(13,29),(14,30),(21,26),(33,49),(34,50),(35,51),(36,52),(37,42),(39,55),(40,56),(43,59),(44,60),(45,61),(46,62),(53,58))) result.add_layer(7, VariadicList((3,17),(4,16),(5,21),(6,18),(7,9),(8,20),(10,26),(11,23),(13,25),(14,28),(15,27),(22,24),(35,49),(36,48),(37,53),(38,50),(39,41),(40,52),(42,58),(43,55),(45,57),(46,60),(47,59),(54,56))) result.add_layer(8, VariadicList((1,4),(3,8),(5,16),(7,17),(9,21),(10,22),(11,19),(12,20),(14,24),(15,26),(23,28),(27,30),(33,36),(35,40),(37,48),(39,49),(41,53),(42,54),(43,51),(44,52),(46,56),(47,58),(55,60),(59,62))) result.add_layer(9, VariadicList((2,5),(7,8),(9,18),(11,17),(12,16),(13,22),(14,20),(15,19),(23,24),(26,29),(34,37),(39,40),(41,50),(43,49),(44,48),(45,54),(46,52),(47,51),(55,56),(58,61))) result.add_layer(10, VariadicList((2,4),(6,12),(9,16),(10,11),(13,17),(14,18),(15,22),(19,25),(20,21),(27,29),(34,36),(38,44),(41,48),(42,43),(45,49),(46,50),(47,54),(51,57),(52,53),(59,61))) result.add_layer(11, VariadicList((5,6),(8,12),(9,10),(11,13),(14,16),(15,17),(18,20),(19,23),(21,22),(25,26),(37,38),(40,44),(41,42),(43,45),(46,48),(47,49),(50,52),(51,55),(53,54),(57,58))) result.add_layer(12, VariadicList((3,5),(6,7),(8,9),(10,12),(11,14),(13,16),(15,18),(17,20),(19,21),(22,23),(24,25),(26,28),(35,37),(38,39),(40,41),(42,44),(43,46),(45,48),(47,50),(49,52),(51,53),(54,55),(56,57),(58,60))) result.add_layer(13, VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58),(59,60))) return result @parameter if channels == 64: var result = SwapData(128, 20) result.add_layer(0, VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47),(48,50),(49,51),(52,54),(53,55),(56,58),(57,59),(60,62),(61,63),(64,66),(65,67),(68,70),(69,71),(72,74),(73,75),(76,78),(77,79),(80,82),(81,83),(84,86),(85,87),(88,90),(89,91),(92,94),(93,95),(96,98),(97,99),(100,102),(101,103),(104,106),(105,107),(108,110),(109,111),(112,114),(113,115),(116,118),(117,119),(120,122),(121,123),(124,126),(125,127))) result.add_layer(1, VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47),(48,49),(50,51),(52,53),(54,55),(56,57),(58,59),(60,61),(62,63),(64,65),(66,67),(68,69),(70,71),(72,73),(74,75),(76,77),(78,79),(80,81),(82,83),(84,85),(86,87),(88,89),(90,91),(92,93),(94,95),(96,97),(98,99),(100,101),(102,103),(104,105),(106,107),(108,109),(110,111),(112,113),(114,115),(116,117),(118,119),(120,121),(122,123),(124,125),(126,127))) result.add_layer(2, VariadicList((0,20),(1,2),(3,23),(4,16),(5,6),(7,19),(8,48),(9,10),(11,51),(12,52),(13,14),(15,55),(17,18),(21,22),(24,28),(25,26),(27,31),(29,30),(32,36),(33,34),(35,39),(37,38),(40,60),(41,42),(43,63),(44,56),(45,46),(47,59),(49,50),(53,54),(57,58),(61,62),(64,84),(65,66),(67,87),(68,80),(69,70),(71,83),(72,112),(73,74),(75,115),(76,116),(77,78),(79,119),(81,82),(85,86),(88,92),(89,90),(91,95),(93,94),(96,100),(97,98),(99,103),(101,102),(104,124),(105,106),(107,127),(108,120),(109,110),(111,123),(113,114),(117,118),(121,122),(125,126))) result.add_layer(3, VariadicList((0,8),(1,21),(2,22),(3,11),(4,40),(5,17),(6,18),(7,43),(9,49),(10,50),(12,24),(13,53),(14,54),(15,27),(16,28),(19,31),(20,56),(23,59),(25,29),(26,30),(32,44),(33,37),(34,38),(35,47),(36,48),(39,51),(41,61),(42,62),(45,57),(46,58),(52,60),(55,63),(64,72),(65,85),(66,86),(67,75),(68,104),(69,81),(70,82),(71,107),(73,113),(74,114),(76,88),(77,117),(78,118),(79,91),(80,92),(83,95),(84,120),(87,123),(89,93),(90,94),(96,108),(97,101),(98,102),(99,111),(100,112),(103,115),(105,125),(106,126),(109,121),(110,122),(116,124),(119,127))) result.add_layer(4, VariadicList((0,32),(1,9),(2,10),(3,35),(4,12),(5,41),(6,42),(7,15),(8,44),(11,47),(13,25),(14,26),(16,52),(17,29),(18,30),(19,55),(20,36),(21,57),(22,58),(23,39),(24,40),(27,43),(28,60),(31,63),(33,45),(34,46),(37,49),(38,50),(48,56),(51,59),(53,61),(54,62),(64,96),(65,73),(66,74),(67,99),(68,76),(69,105),(70,106),(71,79),(72,108),(75,111),(77,89),(78,90),(80,116),(81,93),(82,94),(83,119),(84,100),(85,121),(86,122),(87,103),(88,104),(91,107),(92,124),(95,127),(97,109),(98,110),(101,113),(102,114),(112,120),(115,123),(117,125),(118,126))) result.add_layer(5, VariadicList((0,4),(1,33),(2,34),(3,7),(5,13),(6,14),(8,16),(9,45),(10,46),(11,19),(12,32),(15,35),(17,53),(18,54),(20,24),(21,37),(22,38),(23,27),(25,41),(26,42),(28,48),(29,61),(30,62),(31,51),(36,40),(39,43),(44,52),(47,55),(49,57),(50,58),(56,60),(59,63),(64,68),(65,97),(66,98),(67,71),(69,77),(70,78),(72,80),(73,109),(74,110),(75,83),(76,96),(79,99),(81,117),(82,118),(84,88),(85,101),(86,102),(87,91),(89,105),(90,106),(92,112),(93,125),(94,126),(95,115),(100,104),(103,107),(108,116),(111,119),(113,121),(114,122),(120,124),(123,127))) result.add_layer(6, VariadicList((1,5),(2,6),(4,12),(7,15),(8,20),(9,17),(10,18),(11,23),(13,33),(14,34),(16,32),(19,35),(21,25),(22,26),(24,36),(27,39),(28,44),(29,49),(30,50),(31,47),(37,41),(38,42),(40,52),(43,55),(45,53),(46,54),(48,56),(51,59),(57,61),(58,62),(65,69),(66,70),(68,76),(71,79),(72,84),(73,81),(74,82),(75,87),(77,97),(78,98),(80,96),(83,99),(85,89),(86,90),(88,100),(91,103),(92,108),(93,113),(94,114),(95,111),(101,105),(102,106),(104,116),(107,119),(109,117),(110,118),(112,120),(115,123),(121,125),(122,126))) result.add_layer(7, VariadicList((4,8),(5,13),(6,14),(7,11),(9,21),(10,22),(12,20),(15,23),(16,44),(17,33),(18,34),(19,47),(24,32),(25,37),(26,38),(27,35),(28,36),(29,45),(30,46),(31,39),(40,48),(41,53),(42,54),(43,51),(49,57),(50,58),(52,56),(55,59),(68,72),(69,77),(70,78),(71,75),(73,85),(74,86),(76,84),(79,87),(80,108),(81,97),(82,98),(83,111),(88,96),(89,101),(90,102),(91,99),(92,100),(93,109),(94,110),(95,103),(104,112),(105,117),(106,118),(107,115),(113,121),(114,122),(116,120),(119,123))) result.add_layer(8, VariadicList((5,9),(6,10),(8,12),(11,15),(13,21),(14,22),(16,20),(17,45),(18,46),(19,23),(24,28),(25,33),(26,34),(27,31),(29,37),(30,38),(32,36),(35,39),(40,44),(41,49),(42,50),(43,47),(48,52),(51,55),(53,57),(54,58),(69,73),(70,74),(72,76),(75,79),(77,85),(78,86),(80,84),(81,109),(82,110),(83,87),(88,92),(89,97),(90,98),(91,95),(93,101),(94,102),(96,100),(99,103),(104,108),(105,113),(106,114),(107,111),(112,116),(115,119),(117,121),(118,122))) result.add_layer(9, VariadicList((9,13),(10,14),(16,24),(17,21),(18,22),(19,27),(20,28),(23,31),(25,29),(26,30),(32,40),(33,37),(34,38),(35,43),(36,44),(39,47),(41,45),(42,46),(49,53),(50,54),(73,77),(74,78),(80,88),(81,85),(82,86),(83,91),(84,92),(87,95),(89,93),(90,94),(96,104),(97,101),(98,102),(99,107),(100,108),(103,111),(105,109),(106,110),(113,117),(114,118))) result.add_layer(10, VariadicList((12,16),(15,19),(17,25),(18,26),(20,24),(21,29),(22,30),(23,27),(28,32),(31,35),(33,41),(34,42),(36,40),(37,45),(38,46),(39,43),(44,48),(47,51),(76,80),(79,83),(81,89),(82,90),(84,88),(85,93),(86,94),(87,91),(92,96),(95,99),(97,105),(98,106),(100,104),(101,109),(102,110),(103,107),(108,112),(111,115))) result.add_layer(11, VariadicList((1,16),(2,32),(5,20),(6,36),(9,24),(10,40),(13,17),(14,18),(21,25),(22,26),(23,53),(27,57),(29,33),(30,34),(31,61),(37,41),(38,42),(39,54),(43,58),(45,49),(46,50),(47,62),(65,80),(66,96),(69,84),(70,100),(73,88),(74,104),(77,81),(78,82),(85,89),(86,90),(87,117),(91,121),(93,97),(94,98),(95,125),(101,105),(102,106),(103,118),(107,122),(109,113),(110,114),(111,126))) result.add_layer(12, VariadicList((1,4),(2,8),(3,33),(6,12),(7,37),(10,24),(11,41),(13,28),(14,44),(15,45),(18,48),(19,49),(21,36),(22,52),(26,56),(27,42),(30,60),(35,50),(39,53),(51,57),(55,61),(59,62),(65,68),(66,72),(67,97),(70,76),(71,101),(74,88),(75,105),(77,92),(78,108),(79,109),(82,112),(83,113),(85,100),(86,116),(90,120),(91,106),(94,124),(99,114),(103,117),(115,121),(119,125),(123,126))) result.add_layer(13, VariadicList((2,4),(3,17),(5,6),(7,22),(8,16),(11,25),(12,20),(14,28),(15,29),(18,32),(19,33),(23,37),(26,40),(30,44),(31,45),(34,48),(35,49),(38,52),(41,56),(43,51),(46,60),(47,55),(57,58),(59,61),(66,68),(67,81),(69,70),(71,86),(72,80),(75,89),(76,84),(78,92),(79,93),(82,96),(83,97),(87,101),(90,104),(94,108),(95,109),(98,112),(99,113),(102,116),(105,120),(107,115),(110,124),(111,119),(121,122),(123,125))) result.add_layer(14, VariadicList((3,18),(7,21),(11,32),(15,30),(17,26),(19,25),(22,36),(23,29),(27,41),(31,52),(33,48),(34,40),(37,46),(38,44),(42,56),(45,60),(67,82),(71,85),(75,96),(79,94),(81,90),(83,89),(86,100),(87,93),(91,105),(95,116),(97,112),(98,104),(101,110),(102,108),(106,120),(109,124))) result.add_layer(15, VariadicList((3,16),(7,20),(11,24),(15,21),(17,18),(19,34),(22,28),(23,38),(25,40),(26,32),(27,33),(29,44),(30,36),(31,37),(35,41),(39,52),(42,48),(43,56),(45,46),(47,60),(67,80),(71,84),(75,88),(79,85),(81,82),(83,98),(86,92),(87,102),(89,104),(90,96),(91,97),(93,108),(94,100),(95,101),(99,105),(103,116),(106,112),(107,120),(109,110),(111,124))) result.add_layer(16, VariadicList((3,9),(7,13),(10,16),(11,17),(14,20),(15,22),(18,24),(19,26),(21,28),(23,30),(25,32),(27,34),(29,36),(31,38),(33,40),(35,42),(37,44),(39,45),(41,48),(43,49),(46,52),(47,53),(50,56),(54,60),(67,73),(71,77),(74,80),(75,81),(78,84),(79,86),(82,88),(83,90),(85,92),(87,94),(89,96),(91,98),(93,100),(95,102),(97,104),(99,106),(101,108),(103,109),(105,112),(107,113),(110,116),(111,117),(114,120),(118,124))) result.add_layer(17, VariadicList((3,8),(7,10),(9,12),(11,16),(13,14),(15,17),(18,20),(19,22),(21,24),(23,26),(25,28),(27,29),(30,32),(31,33),(34,36),(35,38),(37,40),(39,42),(41,44),(43,45),(46,48),(47,52),(49,50),(51,54),(53,56),(55,60),(67,72),(71,74),(73,76),(75,80),(77,78),(79,81),(82,84),(83,86),(85,88),(87,90),(89,92),(91,93),(94,96),(95,97),(98,100),(99,102),(101,104),(103,106),(105,108),(107,109),(110,112),(111,116),(113,114),(115,118),(117,120),(119,124))) result.add_layer(18, VariadicList((3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,18),(17,20),(19,21),(22,24),(23,25),(26,28),(27,30),(29,32),(31,34),(33,36),(35,37),(38,40),(39,41),(42,44),(43,46),(45,48),(47,49),(50,52),(51,53),(54,56),(55,57),(58,60),(67,69),(70,72),(71,73),(74,76),(75,77),(78,80),(79,82),(81,84),(83,85),(86,88),(87,89),(90,92),(91,94),(93,96),(95,98),(97,100),(99,101),(102,104),(103,105),(106,108),(107,110),(109,112),(111,113),(114,116),(115,117),(118,120),(119,121),(122,124))) result.add_layer(19, VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58),(59,60),(67,68),(69,70),(71,72),(73,74),(75,76),(77,78),(79,80),(81,82),(83,84),(85,86),(87,88),(89,90),(91,92),(93,94),(95,96),(97,98),(99,100),(101,102),(103,104),(105,106),(107,108),(109,110),(111,112),(113,114),(115,116),(117,118),(119,120),(121,122),(123,124))) # fmt: on return result print( "ERROR: swap_data_2x: channels " + str(channels) + " not implemented yet" ) return SwapData(0, 0) fn swap_data_8x8() -> SwapData: var result = SwapData(64, 6) # fmt: off result.add_layer(0, VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47),(48,50),(49,51),(52,54),(53,55),(56,58),(57,59),(60,62),(61,63))) result.add_layer(1, VariadicList((0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15),(16,20),(17,21),(18,22),(19,23),(24,28),(25,29),(26,30),(27,31),(32,36),(33,37),(34,38),(35,39),(40,44),(41,45),(42,46),(43,47),(48,52),(49,53),(50,54),(51,55),(56,60),(57,61),(58,62),(59,63))) result.add_layer(2, VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47),(48,49),(50,51),(52,53),(54,55),(56,57),(58,59),(60,61),(62,63))) result.add_layer(3, VariadicList((2,4),(3,5),(10,12),(11,13),(18,20),(19,21),(26,28),(27,29),(34,36),(35,37),(42,44),(43,45),(50,52),(51,53),(58,60),(59,61))) result.add_layer(4, VariadicList((1,4),(3,6),(9,12),(11,14),(17,20),(19,22),(25,28),(27,30),(33,36),(35,38),(41,44),(43,46),(49,52),(51,54),(57,60),(59,62))) result.add_layer(5, VariadicList((1,2),(3,4),(5,6),(9,10),(11,12),(13,14),(17,18),(19,20),(21,22),(25,26),(27,28),(29,30),(33,34),(35,36),(37,38),(41,42),(43,44),(45,46),(49,50),(51,52),(53,54),(57,58),(59,60),(61,62))) # fmt: on return result # chanels 0..7 are already sorted, and 8..15 are also already sorted fn swap_data_already_sorted_4_4() -> SwapData: var result = SwapData(8, 3) # fmt: off result.add_layer(0, VariadicList((0,4),(1,5),(2,6),(3,7))) result.add_layer(1, VariadicList((2,4),(3,5))) result.add_layer(2, VariadicList((1,2),(3,4),(5,6))) # fmt: on return result # chanels 0..7 are already sorted, and 8..15 are also already sorted fn swap_data_already_sorted_8_8() -> SwapData: var result = SwapData(16, 4) # fmt: off result.add_layer(0, VariadicList((0,8),(1,9),(2,10),(3,11),(4,12),(5,13),(6,14),(7,15))) result.add_layer(1, VariadicList((4,8),(5,9),(6,10),(7,11))) result.add_layer(2, VariadicList((2,4),(3,5),(6,8),(7,9),(10,12),(11,13))) result.add_layer(3, VariadicList((1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14))) # fmt: on return result fn swap_data_already_sorted_16_16() -> SwapData: var result = SwapData(32, 5) # fmt: off result.add_layer(0, VariadicList((0,16),(1,17),(2,18),(3,19),(4,20),(5,21),(6,22),(7,23),(8,24),(9,25),(10,26),(11,27),(12,28),(13,29),(14,30),(15,31))) result.add_layer(1, VariadicList((8,16),(9,17),(10,18),(11,19),(12,20),(13,21),(14,22),(15,23))) result.add_layer(2, VariadicList((4,8),(5,9),(6,10),(7,11),(12,16),(13,17),(14,18),(15,19),(20,24),(21,25),(22,26),(23,27))) result.add_layer(3, VariadicList((2,4),(3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25),(26,28),(27,29))) result.add_layer(4, VariadicList((1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30))) # fmt: on return result fn swap_data_already_sorted_32_32() -> SwapData: var result = SwapData(64, 7) # fmt: off result.add_layer(0, VariadicList((0,32),(1,33),(2,34),(3,35),(4,36),(5,37),(6,38),(7,39),(8,40),(9,41),(10,42),(11,43),(12,44),(13,45),(14,46),(15,47),(16,48),(17,49),(18,50),(19,51),(20,52),(21,53),(22,54),(23,55),(24,56),(25,57),(26,58),(27,59),(28,60),(29,61),(30,62),(31,63))) result.add_layer(1, VariadicList((9,33),(10,34),(11,35),(12,36),(13,37),(16,32),(22,38),(23,39),(24,40),(25,41),(26,50),(27,51),(28,52),(29,53),(30,54),(31,47))) result.add_layer(2, VariadicList((2,16),(5,9),(6,10),(7,11),(14,22),(15,23),(17,33),(18,34),(19,35),(20,36),(21,37),(24,32),(26,42),(27,43),(28,44),(29,45),(30,46),(31,39),(40,48),(41,49),(47,61),(52,56),(53,57),(54,58))) result.add_layer(3, VariadicList((1,2),(3,5),(7,9),(8,16),(13,17),(14,18),(15,19),(20,24),(25,33),(26,34),(27,35),(28,36),(29,37),(30,38),(39,43),(44,48),(45,49),(46,50),(47,55),(54,56),(58,60),(61,62))) result.add_layer(4, VariadicList((4,8),(11,13),(12,16),(15,17),(18,20),(21,25),(22,26),(23,27),(28,32),(29,33),(30,34),(31,35),(36,40),(37,41),(38,42),(43,45),(46,48),(47,51),(50,52),(55,59))) result.add_layer(5, VariadicList((3,4),(6,8),(10,12),(14,16),(17,18),(19,21),(22,24),(23,25),(26,28),(27,29),(30,32),(31,33),(34,36),(35,37),(38,40),(39,41),(42,44),(45,46),(47,49),(51,53),(55,57),(59,60))) result.add_layer(6, VariadicList((5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58))) # fmt: on return result fn swap_data[n_elements: Int]() -> SwapData: # fmt: off @parameter if n_elements == 2: var result = SwapData(n_elements, 1) # Sorting network for 2 inputs, 1 CE, 1 layer: # [(0,1)] result.add_layer(1, VariadicList((0,1))) return result elif n_elements == 4: var result = SwapData(n_elements, 3) # Sorting network for 4 inputs, 5 CEs, 3 layers: # [(0,2),(1,3)] # [(0,1),(2,3)] # [(1,2)] result.add_layer(0, VariadicList((0,2),(1,3))) result.add_layer(1, VariadicList((0,1),(2,3))) result.add_layer(2, VariadicList((1,2))) return result elif n_elements == 8: var result = SwapData(n_elements, 6) # Sorting network for 8 inputs, 19 CEs, 6 layers: # [(0,2),(1,3),(4,6),(5,7)] # [(0,4),(1,5),(2,6),(3,7)] # [(0,1),(2,3),(4,5),(6,7)] # [(2,4),(3,5)] # [(1,4),(3,6)] # [(1,2),(3,4),(5,6)] result.add_layer(0, VariadicList((0,2),(1,3),(4,6),(5,7))) result.add_layer(1, VariadicList((0,4),(1,5),(2,6),(3,7))) result.add_layer(2, VariadicList((0,1),(2,3),(4,5),(6,7))) result.add_layer(3, VariadicList((2,4),(3,5))) result.add_layer(4, VariadicList((1,4),(3,6))) result.add_layer(5, VariadicList((1,2),(3,4),(5,6))) return result elif n_elements == 16: var result = SwapData(n_elements, 9) # Sorting network for 16 inputs, 61 CEs, 9 layers: # [(0,5),(1,4),(2,12),(3,13),(6,7),(8,9),(10,15),(11,14)] # [(0,2),(1,10),(3,6),(4,7),(5,14),(8,11),(9,12),(13,15)] # [(0,8),(1,3),(2,11),(4,13),(5,9),(6,10),(7,15),(12,14)] # [(0,1),(2,4),(3,8),(5,6),(7,12),(9,10),(11,13),(14,15)] # [(1,3),(2,5),(4,8),(6,9),(7,11),(10,13),(12,14)] # [(1,2),(3,5),(4,11),(6,8),(7,9),(10,12),(13,14)] # [(2,3),(4,5),(6,7),(8,9),(10,11),(12,13)] # [(4,6),(5,7),(8,10),(9,11)] # [(3,4),(5,6),(7,8),(9,10),(11,12)] result.add_layer(0, VariadicList((0,5),(1,4),(2,12),(3,13),(6,7),(8,9),(10,15),(11,14))) result.add_layer(1, VariadicList((0,2),(1,10),(3,6),(4,7),(5,14),(8,11),(9,12),(13,15))) result.add_layer(2, VariadicList((0,8),(1,3),(2,11),(4,13),(5,9),(6,10),(7,15),(12,14))) result.add_layer(3, VariadicList((0,1),(2,4),(3,8),(5,6),(7,12),(9,10),(11,13),(14,15))) result.add_layer(4, VariadicList((1,3),(2,5),(4,8),(6,9),(7,11),(10,13),(12,14))) result.add_layer(5, VariadicList((1,2),(3,5),(4,11),(6,8),(7,9),(10,12),(13,14))) result.add_layer(6, VariadicList((2,3),(4,5),(6,7),(8,9),(10,11),(12,13))) result.add_layer(7, VariadicList((4,6),(5,7),(8,10),(9,11))) result.add_layer(8, VariadicList((3,4),(5,6),(7,8),(9,10),(11,12))) return result elif n_elements == 32: var result = SwapData(n_elements, 14) # Sorting network for 32 inputs, 185 CEs, 14 layers: # [(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31)] # [(0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31)] # [(0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15),(16,20),(17,21),(18,22),(19,23),(24,28),(25,29),(26,30),(27,31)] # [(0,8),(1,9),(2,10),(3,11),(4,12),(5,13),(6,14),(7,15),(16,24),(17,25),(18,26),(19,27),(20,28),(21,29),(22,30),(23,31)] # [(0,16),(1,8),(2,4),(3,12),(5,10),(6,9),(7,14),(11,13),(15,31),(17,24),(18,20),(19,28),(21,26),(22,25),(23,30),(27,29)] # [(1,2),(3,5),(4,8),(6,22),(7,11),(9,25),(10,12),(13,14),(17,18),(19,21),(20,24),(23,27),(26,28),(29,30)] # [(1,17),(2,18),(3,19),(4,20),(5,10),(7,23),(8,24),(11,27),(12,28),(13,29),(14,30),(21,26)] # [(3,17),(4,16),(5,21),(6,18),(7,9),(8,20),(10,26),(11,23),(13,25),(14,28),(15,27),(22,24)] # [(1,4),(3,8),(5,16),(7,17),(9,21),(10,22),(11,19),(12,20),(14,24),(15,26),(23,28),(27,30)] # [(2,5),(7,8),(9,18),(11,17),(12,16),(13,22),(14,20),(15,19),(23,24),(26,29)] # [(2,4),(6,12),(9,16),(10,11),(13,17),(14,18),(15,22),(19,25),(20,21),(27,29)] # [(5,6),(8,12),(9,10),(11,13),(14,16),(15,17),(18,20),(19,23),(21,22),(25,26)] # [(3,5),(6,7),(8,9),(10,12),(11,14),(13,16),(15,18),(17,20),(19,21),(22,23),(24,25),(26,28)] # [(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28)] result.add_layer(0, VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31))) result.add_layer(1, VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31))) result.add_layer(2, VariadicList((0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15),(16,20),(17,21),(18,22),(19,23),(24,28),(25,29),(26,30),(27,31))) result.add_layer(3, VariadicList((0,8),(1,9),(2,10),(3,11),(4,12),(5,13),(6,14),(7,15),(16,24),(17,25),(18,26),(19,27),(20,28),(21,29),(22,30),(23,31))) result.add_layer(4, VariadicList((0,16),(1,8),(2,4),(3,12),(5,10),(6,9),(7,14),(11,13),(15,31),(17,24),(18,20),(19,28),(21,26),(22,25),(23,30),(27,29))) result.add_layer(5, VariadicList((1,2),(3,5),(4,8),(6,22),(7,11),(9,25),(10,12),(13,14),(17,18),(19,21),(20,24),(23,27),(26,28),(29,30))) result.add_layer(6, VariadicList((1,17),(2,18),(3,19),(4,20),(5,10),(7,23),(8,24),(11,27),(12,28),(13,29),(14,30),(21,26))) result.add_layer(7, VariadicList((3,17),(4,16),(5,21),(6,18),(7,9),(8,20),(10,26),(11,23),(13,25),(14,28),(15,27),(22,24))) result.add_layer(8, VariadicList((1,4),(3,8),(5,16),(7,17),(9,21),(10,22),(11,19),(12,20),(14,24),(15,26),(23,28),(27,30))) result.add_layer(9, VariadicList((2,5),(7,8),(9,18),(11,17),(12,16),(13,22),(14,20),(15,19),(23,24),(26,29))) result.add_layer(10, VariadicList((2,4),(6,12),(9,16),(10,11),(13,17),(14,18),(15,22),(19,25),(20,21),(27,29))) result.add_layer(11, VariadicList((5,6),(8,12),(9,10),(11,13),(14,16),(15,17),(18,20),(19,23),(21,22),(25,26))) result.add_layer(12, VariadicList((3,5),(6,7),(8,9),(10,12),(11,14),(13,16),(15,18),(17,20),(19,21),(22,23),(24,25),(26,28))) result.add_layer(13, VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28))) return result elif n_elements == 64: var result = SwapData(n_elements, 20) # Sorting network for 64 inputs, 525 CEs, 20 layers: # [(0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47),(48,50),(49,51),(52,54),(53,55),(56,58),(57,59),(60,62),(61,63)] # [(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47),(48,49),(50,51),(52,53),(54,55),(56,57),(58,59),(60,61),(62,63)] # [(0,20),(1,2),(3,23),(4,16),(5,6),(7,19),(8,48),(9,10),(11,51),(12,52),(13,14),(15,55),(17,18),(21,22),(24,28),(25,26),(27,31),(29,30),(32,36),(33,34),(35,39),(37,38),(40,60),(41,42),(43,63),(44,56),(45,46),(47,59),(49,50),(53,54),(57,58),(61,62)] # [(0,8),(1,21),(2,22),(3,11),(4,40),(5,17),(6,18),(7,43),(9,49),(10,50),(12,24),(13,53),(14,54),(15,27),(16,28),(19,31),(20,56),(23,59),(25,29),(26,30),(32,44),(33,37),(34,38),(35,47),(36,48),(39,51),(41,61),(42,62),(45,57),(46,58),(52,60),(55,63)] # [(0,32),(1,9),(2,10),(3,35),(4,12),(5,41),(6,42),(7,15),(8,44),(11,47),(13,25),(14,26),(16,52),(17,29),(18,30),(19,55),(20,36),(21,57),(22,58),(23,39),(24,40),(27,43),(28,60),(31,63),(33,45),(34,46),(37,49),(38,50),(48,56),(51,59),(53,61),(54,62)] # [(0,4),(1,33),(2,34),(3,7),(5,13),(6,14),(8,16),(9,45),(10,46),(11,19),(12,32),(15,35),(17,53),(18,54),(20,24),(21,37),(22,38),(23,27),(25,41),(26,42),(28,48),(29,61),(30,62),(31,51),(36,40),(39,43),(44,52),(47,55),(49,57),(50,58),(56,60),(59,63)] # [(1,5),(2,6),(4,12),(7,15),(8,20),(9,17),(10,18),(11,23),(13,33),(14,34),(16,32),(19,35),(21,25),(22,26),(24,36),(27,39),(28,44),(29,49),(30,50),(31,47),(37,41),(38,42),(40,52),(43,55),(45,53),(46,54),(48,56),(51,59),(57,61),(58,62)] # [(4,8),(5,13),(6,14),(7,11),(9,21),(10,22),(12,20),(15,23),(16,44),(17,33),(18,34),(19,47),(24,32),(25,37),(26,38),(27,35),(28,36),(29,45),(30,46),(31,39),(40,48),(41,53),(42,54),(43,51),(49,57),(50,58),(52,56),(55,59)] # [(5,9),(6,10),(8,12),(11,15),(13,21),(14,22),(16,20),(17,45),(18,46),(19,23),(24,28),(25,33),(26,34),(27,31),(29,37),(30,38),(32,36),(35,39),(40,44),(41,49),(42,50),(43,47),(48,52),(51,55),(53,57),(54,58)] # [(9,13),(10,14),(16,24),(17,21),(18,22),(19,27),(20,28),(23,31),(25,29),(26,30),(32,40),(33,37),(34,38),(35,43),(36,44),(39,47),(41,45),(42,46),(49,53),(50,54)] # [(12,16),(15,19),(17,25),(18,26),(20,24),(21,29),(22,30),(23,27),(28,32),(31,35),(33,41),(34,42),(36,40),(37,45),(38,46),(39,43),(44,48),(47,51)] # [(1,16),(2,32),(5,20),(6,36),(9,24),(10,40),(13,17),(14,18),(21,25),(22,26),(23,53),(27,57),(29,33),(30,34),(31,61),(37,41),(38,42),(39,54),(43,58),(45,49),(46,50),(47,62)] # [(1,4),(2,8),(3,33),(6,12),(7,37),(10,24),(11,41),(13,28),(14,44),(15,45),(18,48),(19,49),(21,36),(22,52),(26,56),(27,42),(30,60),(35,50),(39,53),(51,57),(55,61),(59,62)] # [(2,4),(3,17),(5,6),(7,22),(8,16),(11,25),(12,20),(14,28),(15,29),(18,32),(19,33),(23,37),(26,40),(30,44),(31,45),(34,48),(35,49),(38,52),(41,56),(43,51),(46,60),(47,55),(57,58),(59,61)] # [(3,18),(7,21),(11,32),(15,30),(17,26),(19,25),(22,36),(23,29),(27,41),(31,52),(33,48),(34,40),(37,46),(38,44),(42,56),(45,60)] # [(3,16),(7,20),(11,24),(15,21),(17,18),(19,34),(22,28),(23,38),(25,40),(26,32),(27,33),(29,44),(30,36),(31,37),(35,41),(39,52),(42,48),(43,56),(45,46),(47,60)] # [(3,9),(7,13),(10,16),(11,17),(14,20),(15,22),(18,24),(19,26),(21,28),(23,30),(25,32),(27,34),(29,36),(31,38),(33,40),(35,42),(37,44),(39,45),(41,48),(43,49),(46,52),(47,53),(50,56),(54,60)] # [(3,8),(7,10),(9,12),(11,16),(13,14),(15,17),(18,20),(19,22),(21,24),(23,26),(25,28),(27,29),(30,32),(31,33),(34,36),(35,38),(37,40),(39,42),(41,44),(43,45),(46,48),(47,52),(49,50),(51,54),(53,56),(55,60)] # [(3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,18),(17,20),(19,21),(22,24),(23,25),(26,28),(27,30),(29,32),(31,34),(33,36),(35,37),(38,40),(39,41),(42,44),(43,46),(45,48),(47,49),(50,52),(51,53),(54,56),(55,57),(58,60)] # [(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58),(59,60)] result.add_layer(0, VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47),(48,50),(49,51),(52,54),(53,55),(56,58),(57,59),(60,62),(61,63))) result.add_layer(1, VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47),(48,49),(50,51),(52,53),(54,55),(56,57),(58,59),(60,61),(62,63))) result.add_layer(2, VariadicList((0,20),(1,2),(3,23),(4,16),(5,6),(7,19),(8,48),(9,10),(11,51),(12,52),(13,14),(15,55),(17,18),(21,22),(24,28),(25,26),(27,31),(29,30),(32,36),(33,34),(35,39),(37,38),(40,60),(41,42),(43,63),(44,56),(45,46),(47,59),(49,50),(53,54),(57,58),(61,62))) result.add_layer(3, VariadicList((0,8),(1,21),(2,22),(3,11),(4,40),(5,17),(6,18),(7,43),(9,49),(10,50),(12,24),(13,53),(14,54),(15,27),(16,28),(19,31),(20,56),(23,59),(25,29),(26,30),(32,44),(33,37),(34,38),(35,47),(36,48),(39,51),(41,61),(42,62),(45,57),(46,58),(52,60),(55,63))) result.add_layer(4, VariadicList((0,32),(1,9),(2,10),(3,35),(4,12),(5,41),(6,42),(7,15),(8,44),(11,47),(13,25),(14,26),(16,52),(17,29),(18,30),(19,55),(20,36),(21,57),(22,58),(23,39),(24,40),(27,43),(28,60),(31,63),(33,45),(34,46),(37,49),(38,50),(48,56),(51,59),(53,61),(54,62))) result.add_layer(5, VariadicList((0,4),(1,33),(2,34),(3,7),(5,13),(6,14),(8,16),(9,45),(10,46),(11,19),(12,32),(15,35),(17,53),(18,54),(20,24),(21,37),(22,38),(23,27),(25,41),(26,42),(28,48),(29,61),(30,62),(31,51),(36,40),(39,43),(44,52),(47,55),(49,57),(50,58),(56,60),(59,63))) result.add_layer(6, VariadicList((1,5),(2,6),(4,12),(7,15),(8,20),(9,17),(10,18),(11,23),(13,33),(14,34),(16,32),(19,35),(21,25),(22,26),(24,36),(27,39),(28,44),(29,49),(30,50),(31,47),(37,41),(38,42),(40,52),(43,55),(45,53),(46,54),(48,56),(51,59),(57,61),(58,62))) result.add_layer(7, VariadicList((4,8),(5,13),(6,14),(7,11),(9,21),(10,22),(12,20),(15,23),(16,44),(17,33),(18,34),(19,47),(24,32),(25,37),(26,38),(27,35),(28,36),(29,45),(30,46),(31,39),(40,48),(41,53),(42,54),(43,51),(49,57),(50,58),(52,56),(55,59))) result.add_layer(8, VariadicList((5,9),(6,10),(8,12),(11,15),(13,21),(14,22),(16,20),(17,45),(18,46),(19,23),(24,28),(25,33),(26,34),(27,31),(29,37),(30,38),(32,36),(35,39),(40,44),(41,49),(42,50),(43,47),(48,52),(51,55),(53,57),(54,58))) result.add_layer(9, VariadicList((9,13),(10,14),(16,24),(17,21),(18,22),(19,27),(20,28),(23,31),(25,29),(26,30),(32,40),(33,37),(34,38),(35,43),(36,44),(39,47),(41,45),(42,46),(49,53),(50,54))) result.add_layer(10, VariadicList((12,16),(15,19),(17,25),(18,26),(20,24),(21,29),(22,30),(23,27),(28,32),(31,35),(33,41),(34,42),(36,40),(37,45),(38,46),(39,43),(44,48),(47,51))) result.add_layer(11, VariadicList((1,16),(2,32),(5,20),(6,36),(9,24),(10,40),(13,17),(14,18),(21,25),(22,26),(23,53),(27,57),(29,33),(30,34),(31,61),(37,41),(38,42),(39,54),(43,58),(45,49),(46,50),(47,62))) result.add_layer(12, VariadicList((1,4),(2,8),(3,33),(6,12),(7,37),(10,24),(11,41),(13,28),(14,44),(15,45),(18,48),(19,49),(21,36),(22,52),(26,56),(27,42),(30,60),(35,50),(39,53),(51,57),(55,61),(59,62))) result.add_layer(13, VariadicList((2,4),(3,17),(5,6),(7,22),(8,16),(11,25),(12,20),(14,28),(15,29),(18,32),(19,33),(23,37),(26,40),(30,44),(31,45),(34,48),(35,49),(38,52),(41,56),(43,51),(46,60),(47,55),(57,58),(59,61))) result.add_layer(14, VariadicList((3,18),(7,21),(11,32),(15,30),(17,26),(19,25),(22,36),(23,29),(27,41),(31,52),(33,48),(34,40),(37,46),(38,44),(42,56),(45,60))) result.add_layer(15, VariadicList((3,16),(7,20),(11,24),(15,21),(17,18),(19,34),(22,28),(23,38),(25,40),(26,32),(27,33),(29,44),(30,36),(31,37),(35,41),(39,52),(42,48),(43,56),(45,46),(47,60))) result.add_layer(16, VariadicList((3,9),(7,13),(10,16),(11,17),(14,20),(15,22),(18,24),(19,26),(21,28),(23,30),(25,32),(27,34),(29,36),(31,38),(33,40),(35,42),(37,44),(39,45),(41,48),(43,49),(46,52),(47,53),(50,56),(54,60))) result.add_layer(17, VariadicList((3,8),(7,10),(9,12),(11,16),(13,14),(15,17),(18,20),(19,22),(21,24),(23,26),(25,28),(27,29),(30,32),(31,33),(34,36),(35,38),(37,40),(39,42),(41,44),(43,45),(46,48),(47,52),(49,50),(51,54),(53,56),(55,60))) result.add_layer(18, VariadicList((3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,18),(17,20),(19,21),(22,24),(23,25),(26,28),(27,30),(29,32),(31,34),(33,36),(35,37),(38,40),(39,41),(42,44),(43,46),(45,48),(47,49),(50,52),(51,53),(54,56),(55,57),(58,60))) result.add_layer(19, VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58),(59,60))) return result elif n_elements == 128: var result = SwapData(n_elements, 27) # Sorting network for 128 inputs, 1435 CEs, 27 layers: # It is based on a (525 elements, 20 layers) 64-sorter, instantiated twice and then performing a Batcher Odd-Even merge (credit Bert Dobbelaere) # [[(0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47),(48,50),(49,51),(52,54),(53,55),(56,58),(57,59),(60,62),(61,63),(64,66),(65,67),(68,70),(69,71),(72,74),(73,75),(76,78),(77,79),(80,82),(81,83),(84,86),(85,87),(88,90),(89,91),(92,94),(93,95),(96,98),(97,99),(100,102),(101,103),(104,106),(105,107),(108,110),(109,111),(112,114),(113,115),(116,118),(117,119),(120,122),(121,123),(124,126),(125,127)], # [(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47),(48,49),(50,51),(52,53),(54,55),(56,57),(58,59),(60,61),(62,63),(64,65),(66,67),(68,69),(70,71),(72,73),(74,75),(76,77),(78,79),(80,81),(82,83),(84,85),(86,87),(88,89),(90,91),(92,93),(94,95),(96,97),(98,99),(100,101),(102,103),(104,105),(106,107),(108,109),(110,111),(112,113),(114,115),(116,117),(118,119),(120,121),(122,123),(124,125),(126,127)], # [(0,20),(1,2),(3,23),(4,16),(5,6),(7,19),(8,48),(9,10),(11,51),(12,52),(13,14),(15,55),(17,18),(21,22),(24,28),(25,26),(27,31),(29,30),(32,36),(33,34),(35,39),(37,38),(40,60),(41,42),(43,63),(44,56),(45,46),(47,59),(49,50),(53,54),(57,58),(61,62),(64,84),(65,66),(67,87),(68,80),(69,70),(71,83),(72,112),(73,74),(75,115),(76,116),(77,78),(79,119),(81,82),(85,86),(88,92),(89,90),(91,95),(93,94),(96,100),(97,98),(99,103),(101,102),(104,124),(105,106),(107,127),(108,120),(109,110),(111,123),(113,114),(117,118),(121,122),(125,126)], # [(0,8),(1,21),(2,22),(3,11),(4,40),(5,17),(6,18),(7,43),(9,49),(10,50),(12,24),(13,53),(14,54),(15,27),(16,28),(19,31),(20,56),(23,59),(25,29),(26,30),(32,44),(33,37),(34,38),(35,47),(36,48),(39,51),(41,61),(42,62),(45,57),(46,58),(52,60),(55,63),(64,72),(65,85),(66,86),(67,75),(68,104),(69,81),(70,82),(71,107),(73,113),(74,114),(76,88),(77,117),(78,118),(79,91),(80,92),(83,95),(84,120),(87,123),(89,93),(90,94),(96,108),(97,101),(98,102),(99,111),(100,112),(103,115),(105,125),(106,126),(109,121),(110,122),(116,124),(119,127)], # [(0,32),(1,9),(2,10),(3,35),(4,12),(5,41),(6,42),(7,15),(8,44),(11,47),(13,25),(14,26),(16,52),(17,29),(18,30),(19,55),(20,36),(21,57),(22,58),(23,39),(24,40),(27,43),(28,60),(31,63),(33,45),(34,46),(37,49),(38,50),(48,56),(51,59),(53,61),(54,62),(64,96),(65,73),(66,74),(67,99),(68,76),(69,105),(70,106),(71,79),(72,108),(75,111),(77,89),(78,90),(80,116),(81,93),(82,94),(83,119),(84,100),(85,121),(86,122),(87,103),(88,104),(91,107),(92,124),(95,127),(97,109),(98,110),(101,113),(102,114),(112,120),(115,123),(117,125),(118,126)], # [(0,4),(1,33),(2,34),(3,7),(5,13),(6,14),(8,16),(9,45),(10,46),(11,19),(12,32),(15,35),(17,53),(18,54),(20,24),(21,37),(22,38),(23,27),(25,41),(26,42),(28,48),(29,61),(30,62),(31,51),(36,40),(39,43),(44,52),(47,55),(49,57),(50,58),(56,60),(59,63),(64,68),(65,97),(66,98),(67,71),(69,77),(70,78),(72,80),(73,109),(74,110),(75,83),(76,96),(79,99),(81,117),(82,118),(84,88),(85,101),(86,102),(87,91),(89,105),(90,106),(92,112),(93,125),(94,126),(95,115),(100,104),(103,107),(108,116),(111,119),(113,121),(114,122),(120,124),(123,127)], # [(0,64),(1,5),(2,6),(4,12),(7,15),(8,20),(9,17),(10,18),(11,23),(13,33),(14,34),(16,32),(19,35),(21,25),(22,26),(24,36),(27,39),(28,44),(29,49),(30,50),(31,47),(37,41),(38,42),(40,52),(43,55),(45,53),(46,54),(48,56),(51,59),(57,61),(58,62),(63,127),(65,69),(66,70),(68,76),(71,79),(72,84),(73,81),(74,82),(75,87),(77,97),(78,98),(80,96),(83,99),(85,89),(86,90),(88,100),(91,103),(92,108),(93,113),(94,114),(95,111),(101,105),(102,106),(104,116),(107,119),(109,117),(110,118),(112,120),(115,123),(121,125),(122,126)], # [(4,8),(5,13),(6,14),(7,11),(9,21),(10,22),(12,20),(15,23),(16,44),(17,33),(18,34),(19,47),(24,32),(25,37),(26,38),(27,35),(28,36),(29,45),(30,46),(31,39),(40,48),(41,53),(42,54),(43,51),(49,57),(50,58),(52,56),(55,59),(68,72),(69,77),(70,78),(71,75),(73,85),(74,86),(76,84),(79,87),(80,108),(81,97),(82,98),(83,111),(88,96),(89,101),(90,102),(91,99),(92,100),(93,109),(94,110),(95,103),(104,112),(105,117),(106,118),(107,115),(113,121),(114,122),(116,120),(119,123)], # [(5,9),(6,10),(8,12),(11,15),(13,21),(14,22),(16,20),(17,45),(18,46),(19,23),(24,28),(25,33),(26,34),(27,31),(29,37),(30,38),(32,36),(35,39),(40,44),(41,49),(42,50),(43,47),(48,52),(51,55),(53,57),(54,58),(69,73),(70,74),(72,76),(75,79),(77,85),(78,86),(80,84),(81,109),(82,110),(83,87),(88,92),(89,97),(90,98),(91,95),(93,101),(94,102),(96,100),(99,103),(104,108),(105,113),(106,114),(107,111),(112,116),(115,119),(117,121),(118,122)], # [(9,13),(10,14),(16,24),(17,21),(18,22),(19,27),(20,28),(23,31),(25,29),(26,30),(32,40),(33,37),(34,38),(35,43),(36,44),(39,47),(41,45),(42,46),(49,53),(50,54),(73,77),(74,78),(80,88),(81,85),(82,86),(83,91),(84,92),(87,95),(89,93),(90,94),(96,104),(97,101),(98,102),(99,107),(100,108),(103,111),(105,109),(106,110),(113,117),(114,118)], # [(12,16),(15,19),(17,25),(18,26),(20,24),(21,29),(22,30),(23,27),(28,32),(31,35),(33,41),(34,42),(36,40),(37,45),(38,46),(39,43),(44,48),(47,51),(76,80),(79,83),(81,89),(82,90),(84,88),(85,93),(86,94),(87,91),(92,96),(95,99),(97,105),(98,106),(100,104),(101,109),(102,110),(103,107),(108,112),(111,115)], # [(1,16),(2,32),(5,20),(6,36),(9,24),(10,40),(13,17),(14,18),(21,25),(22,26),(23,53),(27,57),(29,33),(30,34),(31,61),(37,41),(38,42),(39,54),(43,58),(45,49),(46,50),(47,62),(65,80),(66,96),(69,84),(70,100),(73,88),(74,104),(77,81),(78,82),(85,89),(86,90),(87,117),(91,121),(93,97),(94,98),(95,125),(101,105),(102,106),(103,118),(107,122),(109,113),(110,114),(111,126)], # [(1,4),(2,8),(3,33),(6,12),(7,37),(10,24),(11,41),(13,28),(14,44),(15,45),(18,48),(19,49),(21,36),(22,52),(26,56),(27,42),(30,60),(35,50),(39,53),(51,57),(55,61),(59,62),(65,68),(66,72),(67,97),(70,76),(71,101),(74,88),(75,105),(77,92),(78,108),(79,109),(82,112),(83,113),(85,100),(86,116),(90,120),(91,106),(94,124),(99,114),(103,117),(115,121),(119,125),(123,126)], # [(1,65),(2,4),(3,17),(5,6),(7,22),(8,16),(11,25),(12,20),(14,28),(15,29),(18,32),(19,33),(23,37),(26,40),(30,44),(31,45),(34,48),(35,49),(38,52),(41,56),(43,51),(46,60),(47,55),(57,58),(59,61),(62,126),(66,68),(67,81),(69,70),(71,86),(72,80),(75,89),(76,84),(78,92),(79,93),(82,96),(83,97),(87,101),(90,104),(94,108),(95,109),(98,112),(99,113),(102,116),(105,120),(107,115),(110,124),(111,119),(121,122),(123,125)], # [(2,66),(3,18),(7,21),(11,32),(15,30),(17,26),(19,25),(22,36),(23,29),(27,41),(31,52),(33,48),(34,40),(37,46),(38,44),(42,56),(45,60),(61,125),(67,82),(71,85),(75,96),(79,94),(81,90),(83,89),(86,100),(87,93),(91,105),(95,116),(97,112),(98,104),(101,110),(102,108),(106,120),(109,124)], # [(3,16),(7,20),(11,24),(15,21),(17,18),(19,34),(22,28),(23,38),(25,40),(26,32),(27,33),(29,44),(30,36),(31,37),(35,41),(39,52),(42,48),(43,56),(45,46),(47,60),(67,80),(71,84),(75,88),(79,85),(81,82),(83,98),(86,92),(87,102),(89,104),(90,96),(91,97),(93,108),(94,100),(95,101),(99,105),(103,116),(106,112),(107,120),(109,110),(111,124)], # [(3,9),(7,13),(10,16),(11,17),(14,20),(15,22),(18,24),(19,26),(21,28),(23,30),(25,32),(27,34),(29,36),(31,38),(33,40),(35,42),(37,44),(39,45),(41,48),(43,49),(46,52),(47,53),(50,56),(54,60),(67,73),(71,77),(74,80),(75,81),(78,84),(79,86),(82,88),(83,90),(85,92),(87,94),(89,96),(91,98),(93,100),(95,102),(97,104),(99,106),(101,108),(103,109),(105,112),(107,113),(110,116),(111,117),(114,120),(118,124)], # [(3,8),(7,10),(9,12),(11,16),(13,14),(15,17),(18,20),(19,22),(21,24),(23,26),(25,28),(27,29),(30,32),(31,33),(34,36),(35,38),(37,40),(39,42),(41,44),(43,45),(46,48),(47,52),(49,50),(51,54),(53,56),(55,60),(67,72),(71,74),(73,76),(75,80),(77,78),(79,81),(82,84),(83,86),(85,88),(87,90),(89,92),(91,93),(94,96),(95,97),(98,100),(99,102),(101,104),(103,106),(105,108),(107,109),(110,112),(111,116),(113,114),(115,118),(117,120),(119,124)], # [(3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,18),(17,20),(19,21),(22,24),(23,25),(26,28),(27,30),(29,32),(31,34),(33,36),(35,37),(38,40),(39,41),(42,44),(43,46),(45,48),(47,49),(50,52),(51,53),(54,56),(55,57),(58,60),(67,69),(70,72),(71,73),(74,76),(75,77),(78,80),(79,82),(81,84),(83,85),(86,88),(87,89),(90,92),(91,94),(93,96),(95,98),(97,100),(99,101),(102,104),(103,105),(106,108),(107,110),(109,112),(111,113),(114,116),(115,117),(118,120),(119,121),(122,124)], # [(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58),(59,60),(67,68),(69,70),(71,72),(73,74),(75,76),(77,78),(79,80),(81,82),(83,84),(85,86),(87,88),(89,90),(91,92),(93,94),(95,96),(97,98),(99,100),(101,102),(103,104),(105,106),(107,108),(109,110),(111,112),(113,114),(115,116),(117,118),(119,120),(121,122),(123,124)], # [(3,67),(4,68),(5,69),(6,70),(7,71),(8,72),(9,73),(10,74),(11,75),(12,76),(13,77),(14,78),(15,79),(16,80),(17,81),(18,82),(19,83),(20,84),(21,85),(22,86),(23,87),(24,88),(25,89),(26,90),(27,91),(28,92),(29,93),(30,94),(31,95),(32,96),(33,97),(34,98),(35,99),(36,100),(37,101),(38,102),(39,103),(40,104),(41,105),(42,106),(43,107),(44,108),(45,109),(46,110),(47,111),(48,112),(49,113),(50,114),(51,115),(52,116),(53,117),(54,118),(55,119),(56,120),(57,121),(58,122),(59,123),(60,124)], # [(32,64),(33,65),(34,66),(35,67),(36,68),(37,69),(38,70),(39,71),(40,72),(41,73),(42,74),(43,75),(44,76),(45,77),(46,78),(47,79),(48,80),(49,81),(50,82),(51,83),(52,84),(53,85),(54,86),(55,87),(56,88),(57,89),(58,90),(59,91),(60,92),(61,93),(62,94),(63,95)], # [(16,32),(17,33),(18,34),(19,35),(20,36),(21,37),(22,38),(23,39),(24,40),(25,41),(26,42),(27,43),(28,44),(29,45),(30,46),(31,47),(48,64),(49,65),(50,66),(51,67),(52,68),(53,69),(54,70),(55,71),(56,72),(57,73),(58,74),(59,75),(60,76),(61,77),(62,78),(63,79),(80,96),(81,97),(82,98),(83,99),(84,100),(85,101),(86,102),(87,103),(88,104),(89,105),(90,106),(91,107),(92,108),(93,109),(94,110),(95,111)], # [(8,16),(9,17),(10,18),(11,19),(12,20),(13,21),(14,22),(15,23),(24,32),(25,33),(26,34),(27,35),(28,36),(29,37),(30,38),(31,39),(40,48),(41,49),(42,50),(43,51),(44,52),(45,53),(46,54),(47,55),(56,64),(57,65),(58,66),(59,67),(60,68),(61,69),(62,70),(63,71),(72,80),(73,81),(74,82),(75,83),(76,84),(77,85),(78,86),(79,87),(88,96),(89,97),(90,98),(91,99),(92,100),(93,101),(94,102),(95,103),(104,112),(105,113),(106,114),(107,115),(108,116),(109,117),(110,118),(111,119)], # [(4,8),(5,9),(6,10),(7,11),(12,16),(13,17),(14,18),(15,19),(20,24),(21,25),(22,26),(23,27),(28,32),(29,33),(30,34),(31,35),(36,40),(37,41),(38,42),(39,43),(44,48),(45,49),(46,50),(47,51),(52,56),(53,57),(54,58),(55,59),(60,64),(61,65),(62,66),(63,67),(68,72),(69,73),(70,74),(71,75),(76,80),(77,81),(78,82),(79,83),(84,88),(85,89),(86,90),(87,91),(92,96),(93,97),(94,98),(95,99),(100,104),(101,105),(102,106),(103,107),(108,112),(109,113),(110,114),(111,115),(116,120),(117,121),(118,122),(119,123)], # [(2,4),(3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25),(26,28),(27,29),(30,32),(31,33),(34,36),(35,37),(38,40),(39,41),(42,44),(43,45),(46,48),(47,49),(50,52),(51,53),(54,56),(55,57),(58,60),(59,61),(62,64),(63,65),(66,68),(67,69),(70,72),(71,73),(74,76),(75,77),(78,80),(79,81),(82,84),(83,85),(86,88),(87,89),(90,92),(91,93),(94,96),(95,97),(98,100),(99,101),(102,104),(103,105),(106,108),(107,109),(110,112),(111,113),(114,116),(115,117),(118,120),(119,121),(122,124),(123,125)], # [(1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58),(59,60),(61,62),(63,64),(65,66),(67,68),(69,70),(71,72),(73,74),(75,76),(77,78),(79,80),(81,82),(83,84),(85,86),(87,88),(89,90),(91,92),(93,94),(95,96),(97,98),(99,100),(101,102),(103,104),(105,106),(107,108),(109,110),(111,112),(113,114),(115,116),(117,118),(119,120),(121,122),(123,124),(125,126)]] result.add_layer(0, VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47),(48,50),(49,51),(52,54),(53,55),(56,58),(57,59),(60,62),(61,63),(64,66),(65,67),(68,70),(69,71),(72,74),(73,75),(76,78),(77,79),(80,82),(81,83),(84,86),(85,87),(88,90),(89,91),(92,94),(93,95),(96,98),(97,99),(100,102),(101,103),(104,106),(105,107),(108,110),(109,111),(112,114),(113,115),(116,118),(117,119),(120,122),(121,123),(124,126),(125,127))) result.add_layer(1, VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47),(48,49),(50,51),(52,53),(54,55),(56,57),(58,59),(60,61),(62,63),(64,65),(66,67),(68,69),(70,71),(72,73),(74,75),(76,77),(78,79),(80,81),(82,83),(84,85),(86,87),(88,89),(90,91),(92,93),(94,95),(96,97),(98,99),(100,101),(102,103),(104,105),(106,107),(108,109),(110,111),(112,113),(114,115),(116,117),(118,119),(120,121),(122,123),(124,125),(126,127))) result.add_layer(2, VariadicList((0,20),(1,2),(3,23),(4,16),(5,6),(7,19),(8,48),(9,10),(11,51),(12,52),(13,14),(15,55),(17,18),(21,22),(24,28),(25,26),(27,31),(29,30),(32,36),(33,34),(35,39),(37,38),(40,60),(41,42),(43,63),(44,56),(45,46),(47,59),(49,50),(53,54),(57,58),(61,62),(64,84),(65,66),(67,87),(68,80),(69,70),(71,83),(72,112),(73,74),(75,115),(76,116),(77,78),(79,119),(81,82),(85,86),(88,92),(89,90),(91,95),(93,94),(96,100),(97,98),(99,103),(101,102),(104,124),(105,106),(107,127),(108,120),(109,110),(111,123),(113,114),(117,118),(121,122),(125,126))) result.add_layer(3, VariadicList((0,8),(1,21),(2,22),(3,11),(4,40),(5,17),(6,18),(7,43),(9,49),(10,50),(12,24),(13,53),(14,54),(15,27),(16,28),(19,31),(20,56),(23,59),(25,29),(26,30),(32,44),(33,37),(34,38),(35,47),(36,48),(39,51),(41,61),(42,62),(45,57),(46,58),(52,60),(55,63),(64,72),(65,85),(66,86),(67,75),(68,104),(69,81),(70,82),(71,107),(73,113),(74,114),(76,88),(77,117),(78,118),(79,91),(80,92),(83,95),(84,120),(87,123),(89,93),(90,94),(96,108),(97,101),(98,102),(99,111),(100,112),(103,115),(105,125),(106,126),(109,121),(110,122),(116,124),(119,127))) result.add_layer(4, VariadicList((0,32),(1,9),(2,10),(3,35),(4,12),(5,41),(6,42),(7,15),(8,44),(11,47),(13,25),(14,26),(16,52),(17,29),(18,30),(19,55),(20,36),(21,57),(22,58),(23,39),(24,40),(27,43),(28,60),(31,63),(33,45),(34,46),(37,49),(38,50),(48,56),(51,59),(53,61),(54,62),(64,96),(65,73),(66,74),(67,99),(68,76),(69,105),(70,106),(71,79),(72,108),(75,111),(77,89),(78,90),(80,116),(81,93),(82,94),(83,119),(84,100),(85,121),(86,122),(87,103),(88,104),(91,107),(92,124),(95,127),(97,109),(98,110),(101,113),(102,114),(112,120),(115,123),(117,125),(118,126))) result.add_layer(5, VariadicList((0,4),(1,33),(2,34),(3,7),(5,13),(6,14),(8,16),(9,45),(10,46),(11,19),(12,32),(15,35),(17,53),(18,54),(20,24),(21,37),(22,38),(23,27),(25,41),(26,42),(28,48),(29,61),(30,62),(31,51),(36,40),(39,43),(44,52),(47,55),(49,57),(50,58),(56,60),(59,63),(64,68),(65,97),(66,98),(67,71),(69,77),(70,78),(72,80),(73,109),(74,110),(75,83),(76,96),(79,99),(81,117),(82,118),(84,88),(85,101),(86,102),(87,91),(89,105),(90,106),(92,112),(93,125),(94,126),(95,115),(100,104),(103,107),(108,116),(111,119),(113,121),(114,122),(120,124),(123,127))) result.add_layer(6, VariadicList((0,64),(1,5),(2,6),(4,12),(7,15),(8,20),(9,17),(10,18),(11,23),(13,33),(14,34),(16,32),(19,35),(21,25),(22,26),(24,36),(27,39),(28,44),(29,49),(30,50),(31,47),(37,41),(38,42),(40,52),(43,55),(45,53),(46,54),(48,56),(51,59),(57,61),(58,62),(63,127),(65,69),(66,70),(68,76),(71,79),(72,84),(73,81),(74,82),(75,87),(77,97),(78,98),(80,96),(83,99),(85,89),(86,90),(88,100),(91,103),(92,108),(93,113),(94,114),(95,111),(101,105),(102,106),(104,116),(107,119),(109,117),(110,118),(112,120),(115,123),(121,125),(122,126))) result.add_layer(7, VariadicList((4,8),(5,13),(6,14),(7,11),(9,21),(10,22),(12,20),(15,23),(16,44),(17,33),(18,34),(19,47),(24,32),(25,37),(26,38),(27,35),(28,36),(29,45),(30,46),(31,39),(40,48),(41,53),(42,54),(43,51),(49,57),(50,58),(52,56),(55,59),(68,72),(69,77),(70,78),(71,75),(73,85),(74,86),(76,84),(79,87),(80,108),(81,97),(82,98),(83,111),(88,96),(89,101),(90,102),(91,99),(92,100),(93,109),(94,110),(95,103),(104,112),(105,117),(106,118),(107,115),(113,121),(114,122),(116,120),(119,123))) result.add_layer(8, VariadicList((5,9),(6,10),(8,12),(11,15),(13,21),(14,22),(16,20),(17,45),(18,46),(19,23),(24,28),(25,33),(26,34),(27,31),(29,37),(30,38),(32,36),(35,39),(40,44),(41,49),(42,50),(43,47),(48,52),(51,55),(53,57),(54,58),(69,73),(70,74),(72,76),(75,79),(77,85),(78,86),(80,84),(81,109),(82,110),(83,87),(88,92),(89,97),(90,98),(91,95),(93,101),(94,102),(96,100),(99,103),(104,108),(105,113),(106,114),(107,111),(112,116),(115,119),(117,121),(118,122))) result.add_layer(9, VariadicList((9,13),(10,14),(16,24),(17,21),(18,22),(19,27),(20,28),(23,31),(25,29),(26,30),(32,40),(33,37),(34,38),(35,43),(36,44),(39,47),(41,45),(42,46),(49,53),(50,54),(73,77),(74,78),(80,88),(81,85),(82,86),(83,91),(84,92),(87,95),(89,93),(90,94),(96,104),(97,101),(98,102),(99,107),(100,108),(103,111),(105,109),(106,110),(113,117),(114,118))) result.add_layer(10, VariadicList((12,16),(15,19),(17,25),(18,26),(20,24),(21,29),(22,30),(23,27),(28,32),(31,35),(33,41),(34,42),(36,40),(37,45),(38,46),(39,43),(44,48),(47,51),(76,80),(79,83),(81,89),(82,90),(84,88),(85,93),(86,94),(87,91),(92,96),(95,99),(97,105),(98,106),(100,104),(101,109),(102,110),(103,107),(108,112),(111,115))) result.add_layer(11, VariadicList((1,16),(2,32),(5,20),(6,36),(9,24),(10,40),(13,17),(14,18),(21,25),(22,26),(23,53),(27,57),(29,33),(30,34),(31,61),(37,41),(38,42),(39,54),(43,58),(45,49),(46,50),(47,62),(65,80),(66,96),(69,84),(70,100),(73,88),(74,104),(77,81),(78,82),(85,89),(86,90),(87,117),(91,121),(93,97),(94,98),(95,125),(101,105),(102,106),(103,118),(107,122),(109,113),(110,114),(111,126))) result.add_layer(12, VariadicList((1,4),(2,8),(3,33),(6,12),(7,37),(10,24),(11,41),(13,28),(14,44),(15,45),(18,48),(19,49),(21,36),(22,52),(26,56),(27,42),(30,60),(35,50),(39,53),(51,57),(55,61),(59,62),(65,68),(66,72),(67,97),(70,76),(71,101),(74,88),(75,105),(77,92),(78,108),(79,109),(82,112),(83,113),(85,100),(86,116),(90,120),(91,106),(94,124),(99,114),(103,117),(115,121),(119,125),(123,126))) result.add_layer(13, VariadicList((1,65),(2,4),(3,17),(5,6),(7,22),(8,16),(11,25),(12,20),(14,28),(15,29),(18,32),(19,33),(23,37),(26,40),(30,44),(31,45),(34,48),(35,49),(38,52),(41,56),(43,51),(46,60),(47,55),(57,58),(59,61),(62,126),(66,68),(67,81),(69,70),(71,86),(72,80),(75,89),(76,84),(78,92),(79,93),(82,96),(83,97),(87,101),(90,104),(94,108),(95,109),(98,112),(99,113),(102,116),(105,120),(107,115),(110,124),(111,119),(121,122),(123,125))) result.add_layer(14, VariadicList((2,66),(3,18),(7,21),(11,32),(15,30),(17,26),(19,25),(22,36),(23,29),(27,41),(31,52),(33,48),(34,40),(37,46),(38,44),(42,56),(45,60),(61,125),(67,82),(71,85),(75,96),(79,94),(81,90),(83,89),(86,100),(87,93),(91,105),(95,116),(97,112),(98,104),(101,110),(102,108),(106,120),(109,124))) result.add_layer(15, VariadicList((3,16),(7,20),(11,24),(15,21),(17,18),(19,34),(22,28),(23,38),(25,40),(26,32),(27,33),(29,44),(30,36),(31,37),(35,41),(39,52),(42,48),(43,56),(45,46),(47,60),(67,80),(71,84),(75,88),(79,85),(81,82),(83,98),(86,92),(87,102),(89,104),(90,96),(91,97),(93,108),(94,100),(95,101),(99,105),(103,116),(106,112),(107,120),(109,110),(111,124))) result.add_layer(16, VariadicList((3,9),(7,13),(10,16),(11,17),(14,20),(15,22),(18,24),(19,26),(21,28),(23,30),(25,32),(27,34),(29,36),(31,38),(33,40),(35,42),(37,44),(39,45),(41,48),(43,49),(46,52),(47,53),(50,56),(54,60),(67,73),(71,77),(74,80),(75,81),(78,84),(79,86),(82,88),(83,90),(85,92),(87,94),(89,96),(91,98),(93,100),(95,102),(97,104),(99,106),(101,108),(103,109),(105,112),(107,113),(110,116),(111,117),(114,120),(118,124))) result.add_layer(17, VariadicList((3,8),(7,10),(9,12),(11,16),(13,14),(15,17),(18,20),(19,22),(21,24),(23,26),(25,28),(27,29),(30,32),(31,33),(34,36),(35,38),(37,40),(39,42),(41,44),(43,45),(46,48),(47,52),(49,50),(51,54),(53,56),(55,60),(67,72),(71,74),(73,76),(75,80),(77,78),(79,81),(82,84),(83,86),(85,88),(87,90),(89,92),(91,93),(94,96),(95,97),(98,100),(99,102),(101,104),(103,106),(105,108),(107,109),(110,112),(111,116),(113,114),(115,118),(117,120),(119,124))) result.add_layer(18, VariadicList((3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,18),(17,20),(19,21),(22,24),(23,25),(26,28),(27,30),(29,32),(31,34),(33,36),(35,37),(38,40),(39,41),(42,44),(43,46),(45,48),(47,49),(50,52),(51,53),(54,56),(55,57),(58,60),(67,69),(70,72),(71,73),(74,76),(75,77),(78,80),(79,82),(81,84),(83,85),(86,88),(87,89),(90,92),(91,94),(93,96),(95,98),(97,100),(99,101),(102,104),(103,105),(106,108),(107,110),(109,112),(111,113),(114,116),(115,117),(118,120),(119,121),(122,124))) result.add_layer(19, VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58),(59,60),(67,68),(69,70),(71,72),(73,74),(75,76),(77,78),(79,80),(81,82),(83,84),(85,86),(87,88),(89,90),(91,92),(93,94),(95,96),(97,98),(99,100),(101,102),(103,104),(105,106),(107,108),(109,110),(111,112),(113,114),(115,116),(117,118),(119,120),(121,122),(123,124))) result.add_layer(20, VariadicList((3,67),(4,68),(5,69),(6,70),(7,71),(8,72),(9,73),(10,74),(11,75),(12,76),(13,77),(14,78),(15,79),(16,80),(17,81),(18,82),(19,83),(20,84),(21,85),(22,86),(23,87),(24,88),(25,89),(26,90),(27,91),(28,92),(29,93),(30,94),(31,95),(32,96),(33,97),(34,98),(35,99),(36,100),(37,101),(38,102),(39,103),(40,104),(41,105),(42,106),(43,107),(44,108),(45,109),(46,110),(47,111),(48,112),(49,113),(50,114),(51,115),(52,116),(53,117),(54,118),(55,119),(56,120),(57,121),(58,122),(59,123),(60,124))) result.add_layer(21, VariadicList((32,64),(33,65),(34,66),(35,67),(36,68),(37,69),(38,70),(39,71),(40,72),(41,73),(42,74),(43,75),(44,76),(45,77),(46,78),(47,79),(48,80),(49,81),(50,82),(51,83),(52,84),(53,85),(54,86),(55,87),(56,88),(57,89),(58,90),(59,91),(60,92),(61,93),(62,94),(63,95))) result.add_layer(22, VariadicList((16,32),(17,33),(18,34),(19,35),(20,36),(21,37),(22,38),(23,39),(24,40),(25,41),(26,42),(27,43),(28,44),(29,45),(30,46),(31,47),(48,64),(49,65),(50,66),(51,67),(52,68),(53,69),(54,70),(55,71),(56,72),(57,73),(58,74),(59,75),(60,76),(61,77),(62,78),(63,79),(80,96),(81,97),(82,98),(83,99),(84,100),(85,101),(86,102),(87,103),(88,104),(89,105),(90,106),(91,107),(92,108),(93,109),(94,110),(95,111))) result.add_layer(23, VariadicList((8,16),(9,17),(10,18),(11,19),(12,20),(13,21),(14,22),(15,23),(24,32),(25,33),(26,34),(27,35),(28,36),(29,37),(30,38),(31,39),(40,48),(41,49),(42,50),(43,51),(44,52),(45,53),(46,54),(47,55),(56,64),(57,65),(58,66),(59,67),(60,68),(61,69),(62,70),(63,71),(72,80),(73,81),(74,82),(75,83),(76,84),(77,85),(78,86),(79,87),(88,96),(89,97),(90,98),(91,99),(92,100),(93,101),(94,102),(95,103),(104,112),(105,113),(106,114),(107,115),(108,116),(109,117),(110,118),(111,119))) result.add_layer(24, VariadicList((4,8),(5,9),(6,10),(7,11),(12,16),(13,17),(14,18),(15,19),(20,24),(21,25),(22,26),(23,27),(28,32),(29,33),(30,34),(31,35),(36,40),(37,41),(38,42),(39,43),(44,48),(45,49),(46,50),(47,51),(52,56),(53,57),(54,58),(55,59),(60,64),(61,65),(62,66),(63,67),(68,72),(69,73),(70,74),(71,75),(76,80),(77,81),(78,82),(79,83),(84,88),(85,89),(86,90),(87,91),(92,96),(93,97),(94,98),(95,99),(100,104),(101,105),(102,106),(103,107),(108,112),(109,113),(110,114),(111,115),(116,120),(117,121),(118,122),(119,123))) result.add_layer(25, VariadicList((2,4),(3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25),(26,28),(27,29),(30,32),(31,33),(34,36),(35,37),(38,40),(39,41),(42,44),(43,45),(46,48),(47,49),(50,52),(51,53),(54,56),(55,57),(58,60),(59,61),(62,64),(63,65),(66,68),(67,69),(70,72),(71,73),(74,76),(75,77),(78,80),(79,81),(82,84),(83,85),(86,88),(87,89),(90,92),(91,93),(94,96),(95,97),(98,100),(99,101),(102,104),(103,105),(106,108),(107,109),(110,112),(111,113),(114,116),(115,117),(118,120),(119,121),(122,124),(123,125))) result.add_layer(26, VariadicList((1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50),(51,52),(53,54),(55,56),(57,58),(59,60),(61,62),(63,64),(65,66),(67,68),(69,70),(71,72),(73,74),(75,76),(77,78),(79,80),(81,82),(83,84),(85,86),(87,88),(89,90),(91,92),(93,94),(95,96),(97,98),(99,100),(101,102),(103,104),(105,106),(107,108),(109,110),(111,112),(113,114),(115,116),(117,118),(119,120),(121,122),(123,124),(125,126))) return result # fmt: on else: pass return SwapData(0, 0) # fmt: off # Sorting network for 6 inputs, 12 CEs, 5 layers: # [(0,5),(1,3),(2,4)] # [(1,2),(3,4)] # [(0,3),(2,5)] # [(0,1),(2,3),(4,5)] # [(1,2),(3,4)] alias swap_data_6 = VariadicList( VariadicList((0,5),(1,3),(2,4)), VariadicList((1,2),(3,4)), VariadicList((0,3),(2,5)), VariadicList((0,1),(2,3),(4,5)), VariadicList((1,2),(3,4)) ) # Sorting network for 10 inputs, 31 CEs, 7 layers: # [(0,1),(2,5),(3,6),(4,7),(8,9)] # [(0,6),(1,8),(2,4),(3,9),(5,7)] # [(0,2),(1,3),(4,5),(6,8),(7,9)] # [(0,1),(2,7),(3,5),(4,6),(8,9)] # [(1,2),(3,4),(5,6),(7,8)] # [(1,3),(2,4),(5,7),(6,8)] # [(2,3),(4,5),(6,7)] alias swap_data_10 = VariadicList( VariadicList((0,1),(2,5),(3,6),(4,7),(8,9)), VariadicList((0,6),(1,8),(2,4),(3,9),(5,7)), VariadicList((0,2),(1,3),(4,5),(6,8),(7,9)), VariadicList((0,1),(2,7),(3,5),(4,6),(8,9)), VariadicList((1,2),(3,4),(5,6),(7,8)), VariadicList((1,3),(2,4),(5,7),(6,8)), VariadicList((2,3),(4,5),(6,7)) ) # Sorting network for 12 inputs, 40 CEs, 8 layers: # [(0,8),(1,7),(2,6),(3,11),(4,10),(5,9)] # [(0,2),(1,4),(3,5),(6,8),(7,10),(9,11)] # [(0,1),(2,9),(4,7),(5,6),(10,11)] # [(1,3),(2,7),(4,9),(8,10)] # [(0,1),(2,3),(4,5),(6,7),(8,9),(10,11)] # [(1,2),(3,5),(6,8),(9,10)] # [(2,4),(3,6),(5,8),(7,9)] # [(1,2),(3,4),(5,6),(7,8),(9,10)] alias swap_data_12 = VariadicList( VariadicList((0,8),(1,7),(2,6),(3,11),(4,10),(5,9)), VariadicList((0,2),(1,4),(3,5),(6,8),(7,10),(9,11)), VariadicList((0,1),(2,9),(4,7),(5,6),(10,11)), VariadicList((1,3),(2,7),(4,9),(8,10)), VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11)), VariadicList((1,2),(3,5),(6,8),(9,10)), VariadicList((2,4),(3,6),(5,8),(7,9)), VariadicList((1,2),(3,4),(5,6),(7,8),(9,10)) ) # Sorting network for 17 inputs, 74 CEs, 10 layers: # [(1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16)] # [(1,3),(2,4),(5,7),(6,8),(9,11),(10,12),(13,15),(14,16)] # [(1,5),(2,6),(3,7),(4,8),(9,13),(10,14),(11,15),(12,16)] # [(0,3),(1,13),(2,10),(4,7),(5,11),(6,12),(8,9),(14,15)] # [(0,13),(1,8),(2,5),(3,6),(4,14),(7,15),(9,16),(10,11)] # [(0,1),(2,8),(3,4),(5,10),(6,13),(7,11),(12,14)] # [(1,5),(3,8),(4,10),(6,7),(9,12),(11,13)] # [(1,2),(4,6),(5,8),(7,10),(9,11),(12,14),(13,15)] # [(2,3),(4,5),(6,8),(7,9),(10,11),(12,13),(14,15)] # [(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16)] alias swap_data_17 = VariadicList( VariadicList((1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16)), VariadicList((1,3),(2,4),(5,7),(6,8),(9,11),(10,12),(13,15),(14,16)), VariadicList((1,5),(2,6),(3,7),(4,8),(9,13),(10,14),(11,15),(12,16)), VariadicList((0,3),(1,13),(2,10),(4,7),(5,11),(6,12),(8,9),(14,15)), VariadicList((0,13),(1,8),(2,5),(3,6),(4,14),(7,15),(9,16),(10,11)), VariadicList((0,1),(2,8),(3,4),(5,10),(6,13),(7,11),(12,14)), VariadicList((1,5),(3,8),(4,10),(6,7),(9,12),(11,13)), VariadicList((1,2),(4,6),(5,8),(7,10),(9,11),(12,14),(13,15)), VariadicList((2,3),(4,5),(6,8),(7,9),(10,11),(12,13),(14,15)), VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16)) ) # Sorting network for 20 inputs, 93 CEs, 11 layers: # [(0,12),(1,13),(2,14),(3,15),(4,16),(5,17),(6,18),(7,19),(8,10),(9,11)] # [(0,2),(1,3),(4,6),(5,7),(8,9),(10,11),(12,14),(13,15),(16,18),(17,19)] # [(0,1),(2,3),(4,5),(6,7),(12,13),(14,15),(16,17),(18,19)] # [(0,4),(1,12),(2,16),(3,17),(5,8),(6,9),(7,18),(10,13),(11,14),(15,19)] # [(1,6),(3,10),(4,5),(7,11),(8,12),(9,16),(13,18),(14,15)] # [(0,4),(2,8),(3,9),(6,7),(10,16),(11,17),(12,13),(15,19)] # [(1,4),(3,6),(5,8),(7,10),(9,12),(11,14),(13,16),(15,18)] # [(2,3),(4,5),(6,8),(7,9),(10,12),(11,13),(14,15),(16,17)] # [(2,4),(3,6),(5,7),(8,10),(9,11),(12,14),(13,16),(15,17)] # [(1,2),(3,5),(6,7),(8,9),(10,11),(12,13),(14,16),(17,18)] # [(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16)] alias swap_data_20 = VariadicList( VariadicList((0,12),(1,13),(2,14),(3,15),(4,16),(5,17),(6,18),(7,19),(8,10),(9,11)), VariadicList((0,2),(1,3),(4,6),(5,7),(8,9),(10,11),(12,14),(13,15),(16,18),(17,19)), VariadicList((0,1),(2,3),(4,5),(6,7),(12,13),(14,15),(16,17),(18,19)), VariadicList((0,4),(1,12),(2,16),(3,17),(5,8),(6,9),(7,18),(10,13),(11,14),(15,19)), VariadicList((1,6),(3,10),(4,5),(7,11),(8,12),(9,16),(13,18),(14,15)), VariadicList((0,4),(2,8),(3,9),(6,7),(10,16),(11,17),(12,13),(15,19)), VariadicList((1,4),(3,6),(5,8),(7,10),(9,12),(11,14),(13,16),(15,18)), VariadicList((2,3),(4,5),(6,8),(7,9),(10,12),(11,13),(14,15),(16,17)), VariadicList((2,4),(3,6),(5,7),(8,10),(9,11),(12,14),(13,16),(15,17)), VariadicList((1,2),(3,5),(6,7),(8,9),(10,11),(12,13),(14,16),(17,18)), VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16)) ) # Sorting network for 24 inputs, 122 CEs, 12 layers: # [(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)] # [(0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23)] # [(0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15),(16,20),(17,21),(18,22),(19,23)] # [(0,16),(1,18),(2,17),(3,19),(4,20),(5,22),(6,21),(7,23),(9,10),(13,14)] # [(2,10),(3,11),(5,18),(6,14),(7,15),(8,16),(9,17),(12,20),(13,21)] # [(0,8),(1,9),(2,12),(3,20),(4,16),(5,13),(6,17),(7,19),(10,18),(11,21),(14,22),(15,23)] # [(1,8),(3,16),(4,12),(5,10),(6,9),(7,20),(11,19),(13,18),(14,17),(15,22)] # [(2,4),(3,5),(7,13),(9,12),(10,16),(11,14),(18,20),(19,21)] # [(1,2),(4,8),(5,9),(6,10),(7,11),(12,16),(13,17),(14,18),(15,19),(21,22)] # [(2,4),(3,8),(5,6),(7,9),(10,12),(11,13),(14,16),(15,20),(17,18),(19,21)] # [(3,5),(6,8),(7,10),(9,12),(11,14),(13,16),(15,17),(18,20)] # [(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20)] alias swap_data_24 = VariadicList( VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)), VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23)), VariadicList((0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15),(16,20),(17,21),(18,22),(19,23)), VariadicList((0,16),(1,18),(2,17),(3,19),(4,20),(5,22),(6,21),(7,23),(9,10),(13,14)), VariadicList((2,10),(3,11),(5,18),(6,14),(7,15),(8,16),(9,17),(12,20),(13,21)), VariadicList((0,8),(1,9),(2,12),(3,20),(4,16),(5,13),(6,17),(7,19),(10,18),(11,21),(14,22),(15,23)), VariadicList((1,8),(3,16),(4,12),(5,10),(6,9),(7,20),(11,19),(13,18),(14,17),(15,22)), VariadicList((2,4),(3,5),(7,13),(9,12),(10,16),(11,14),(18,20),(19,21)), VariadicList((1,2),(4,8),(5,9),(6,10),(7,11),(12,16),(13,17),(14,18),(15,19),(21,22)), VariadicList((2,4),(3,8),(5,6),(7,9),(10,12),(11,13),(14,16),(15,20),(17,18),(19,21)), VariadicList((3,5),(6,8),(7,10),(9,12),(11,14),(13,16),(15,17),(18,20)), VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20)) ) # Sorting network for 26 inputs, 141 CEs, 13 layers: # [(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25)] # [(0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25)] # [(0,4),(1,5),(2,6),(3,7),(8,14),(9,16),(10,13),(11,17),(12,15),(18,22),(19,23),(20,24),(21,25)] # [(0,18),(1,19),(2,20),(3,21),(4,22),(5,23),(6,24),(7,25),(8,12),(10,14),(11,15),(13,17)] # [(1,18),(2,10),(3,20),(4,8),(5,22),(6,14),(7,24),(9,12),(11,19),(13,16),(15,23),(17,21)] # [(0,4),(1,9),(3,13),(5,15),(6,18),(7,19),(8,11),(10,20),(12,22),(14,17),(16,24),(21,25)] # [(2,4),(3,11),(5,9),(10,12),(13,15),(14,22),(16,20),(21,23)] # [(1,4),(3,8),(6,10),(7,13),(9,11),(12,18),(14,16),(15,19),(17,22),(21,24)] # [(1,2),(3,6),(4,5),(7,12),(8,10),(9,14),(11,16),(13,18),(15,17),(19,22),(20,21),(23,24)] # [(2,3),(4,6),(5,10),(7,9),(11,13),(12,14),(15,20),(16,18),(19,21),(22,23)] # [(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22)] # [(5,7),(6,8),(9,11),(10,12),(13,15),(14,16),(17,19),(18,20)] # [(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21)] alias swap_data_26 = VariadicList( VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25)), VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25)), VariadicList((0,4),(1,5),(2,6),(3,7),(8,14),(9,16),(10,13),(11,17),(12,15),(18,22),(19,23),(20,24),(21,25)), VariadicList((0,18),(1,19),(2,20),(3,21),(4,22),(5,23),(6,24),(7,25),(8,12),(10,14),(11,15),(13,17)), VariadicList((1,18),(2,10),(3,20),(4,8),(5,22),(6,14),(7,24),(9,12),(11,19),(13,16),(15,23),(17,21)), VariadicList((0,4),(1,9),(3,13),(5,15),(6,18),(7,19),(8,11),(10,20),(12,22),(14,17),(16,24),(21,25)), VariadicList((2,4),(3,11),(5,9),(10,12),(13,15),(14,22),(16,20),(21,23)), VariadicList((1,4),(3,8),(6,10),(7,13),(9,11),(12,18),(14,16),(15,19),(17,22),(21,24)), VariadicList((1,2),(3,6),(4,5),(7,12),(8,10),(9,14),(11,16),(13,18),(15,17),(19,22),(20,21),(23,24)), VariadicList((2,3),(4,6),(5,10),(7,9),(11,13),(12,14),(15,20),(16,18),(19,21),(22,23)), VariadicList((3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22)), VariadicList((5,7),(6,8),(9,11),(10,12),(13,15),(14,16),(17,19),(18,20)), VariadicList((4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21)) ) # Sorting network for 48 inputs, 347 CEs, 18 layers: # [(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47)] # [(0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47)] # [(0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15),(16,20),(17,21),(18,22),(19,23),(24,28),(25,29),(26,30),(27,31),(32,36),(33,37),(34,38),(35,39),(40,44),(41,45),(42,46),(43,47)] # [(0,8),(1,9),(2,10),(3,11),(4,12),(5,13),(6,14),(7,15),(16,24),(17,25),(18,26),(19,27),(20,28),(21,29),(22,30),(23,31),(32,40),(33,41),(34,42),(35,43),(36,44),(37,45),(38,46),(39,47)] # [(0,32),(1,33),(2,34),(3,35),(4,36),(5,37),(6,38),(7,39),(8,40),(9,41),(10,42),(11,43),(12,44),(13,45),(14,46),(15,47),(17,18),(19,28),(20,24),(21,26),(22,25),(23,27),(29,30)] # [(0,16),(1,4),(2,8),(3,12),(5,10),(6,9),(7,13),(11,14),(17,20),(18,24),(19,21),(23,29),(26,28),(27,30),(31,47),(33,36),(34,40),(35,44),(37,42),(38,41),(39,45),(43,46)] # [(1,2),(3,22),(4,8),(5,6),(7,11),(9,10),(13,14),(15,31),(16,32),(25,44),(33,34),(36,40),(37,38),(39,43),(41,42),(45,46)] # [(1,17),(3,32),(6,21),(7,23),(10,28),(11,29),(12,25),(13,27),(15,44),(18,36),(19,37),(20,34),(22,35),(24,40),(26,41),(30,46)] # [(1,16),(2,18),(4,20),(5,19),(6,32),(7,22),(8,24),(9,26),(10,12),(11,13),(14,30),(15,41),(17,33),(21,38),(23,39),(25,40),(27,43),(28,42),(29,45),(31,46),(34,36),(35,37)] # [(2,4),(3,16),(7,19),(8,17),(9,33),(10,34),(11,35),(12,36),(13,37),(14,38),(28,40),(30,39),(31,44),(43,45)] # [(2,3),(4,8),(5,16),(6,17),(7,9),(10,18),(11,32),(13,25),(14,26),(15,36),(19,28),(21,33),(22,34),(29,37),(30,41),(31,42),(38,40),(39,43),(44,45)] # [(3,5),(6,7),(11,20),(12,19),(13,21),(14,22),(15,23),(16,17),(24,32),(25,33),(26,34),(27,36),(28,35),(30,31),(40,41),(42,44)] # [(3,4),(5,8),(7,16),(9,17),(10,11),(12,14),(13,24),(15,25),(18,20),(19,26),(21,28),(22,32),(23,34),(27,29),(30,38),(31,40),(33,35),(36,37),(39,42),(43,44)] # [(4,5),(6,8),(7,10),(9,18),(11,16),(12,13),(14,24),(15,22),(17,20),(19,21),(23,33),(25,32),(26,28),(27,30),(29,38),(31,36),(34,35),(37,40),(39,41),(42,43)] # [(6,7),(9,12),(10,11),(13,17),(14,18),(15,19),(20,24),(21,25),(22,26),(23,27),(28,32),(29,33),(30,34),(35,38),(36,37),(40,41)] # [(5,6),(8,10),(9,11),(12,16),(13,14),(15,18),(17,20),(19,24),(21,22),(23,28),(25,26),(27,30),(29,32),(31,35),(33,34),(36,38),(37,39),(41,42)] # [(7,8),(9,10),(12,13),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25),(26,28),(27,29),(30,32),(31,33),(34,35),(37,38),(39,40)] # [(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36)] alias swap_data_48 = VariadicList( VariadicList((0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23),(24,25),(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47)), VariadicList((0,2),(1,3),(4,6),(5,7),(8,10),(9,11),(12,14),(13,15),(16,18),(17,19),(20,22),(21,23),(24,26),(25,27),(28,30),(29,31),(32,34),(33,35),(36,38),(37,39),(40,42),(41,43),(44,46),(45,47)), VariadicList((0,4),(1,5),(2,6),(3,7),(8,12),(9,13),(10,14),(11,15),(16,20),(17,21),(18,22),(19,23),(24,28),(25,29),(26,30),(27,31),(32,36),(33,37),(34,38),(35,39),(40,44),(41,45),(42,46),(43,47)), VariadicList((0,8),(1,9),(2,10),(3,11),(4,12),(5,13),(6,14),(7,15),(16,24),(17,25),(18,26),(19,27),(20,28),(21,29),(22,30),(23,31),(32,40),(33,41),(34,42),(35,43),(36,44),(37,45),(38,46),(39,47)), VariadicList((0,32),(1,33),(2,34),(3,35),(4,36),(5,37),(6,38),(7,39),(8,40),(9,41),(10,42),(11,43),(12,44),(13,45),(14,46),(15,47),(17,18),(19,28),(20,24),(21,26),(22,25),(23,27),(29,30)), VariadicList((0,16),(1,4),(2,8),(3,12),(5,10),(6,9),(7,13),(11,14),(17,20),(18,24),(19,21),(23,29),(26,28),(27,30),(31,47),(33,36),(34,40),(35,44),(37,42),(38,41),(39,45),(43,46)), VariadicList((1,2),(3,22),(4,8),(5,6),(7,11),(9,10),(13,14),(15,31),(16,32),(25,44),(33,34),(36,40),(37,38),(39,43),(41,42),(45,46)), VariadicList((1,17),(3,32),(6,21),(7,23),(10,28),(11,29),(12,25),(13,27),(15,44),(18,36),(19,37),(20,34),(22,35),(24,40),(26,41),(30,46)), VariadicList((1,16),(2,18),(4,20),(5,19),(6,32),(7,22),(8,24),(9,26),(10,12),(11,13),(14,30),(15,41),(17,33),(21,38),(23,39),(25,40),(27,43),(28,42),(29,45),(31,46),(34,36),(35,37)), VariadicList((2,4),(3,16),(7,19),(8,17),(9,33),(10,34),(11,35),(12,36),(13,37),(14,38),(28,40),(30,39),(31,44),(43,45)), VariadicList((2,3),(4,8),(5,16),(6,17),(7,9),(10,18),(11,32),(13,25),(14,26),(15,36),(19,28),(21,33),(22,34),(29,37),(30,41),(31,42),(38,40),(39,43),(44,45)), VariadicList((3,5),(6,7),(11,20),(12,19),(13,21),(14,22),(15,23),(16,17),(24,32),(25,33),(26,34),(27,36),(28,35),(30,31),(40,41),(42,44)), VariadicList((3,4),(5,8),(7,16),(9,17),(10,11),(12,14),(13,24),(15,25),(18,20),(19,26),(21,28),(22,32),(23,34),(27,29),(30,38),(31,40),(33,35),(36,37),(39,42),(43,44)), VariadicList((4,5),(6,8),(7,10),(9,18),(11,16),(12,13),(14,24),(15,22),(17,20),(19,21),(23,33),(25,32),(26,28),(27,30),(29,38),(31,36),(34,35),(37,40),(39,41),(42,43)), VariadicList((6,7),(9,12),(10,11),(13,17),(14,18),(15,19),(20,24),(21,25),(22,26),(23,27),(28,32),(29,33),(30,34),(35,38),(36,37),(40,41)), VariadicList((5,6),(8,10),(9,11),(12,16),(13,14),(15,18),(17,20),(19,24),(21,22),(23,28),(25,26),(27,30),(29,32),(31,35),(33,34),(36,38),(37,39),(41,42)), VariadicList((7,8),(9,10),(12,13),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25),(26,28),(27,29),(30,32),(31,33),(34,35),(37,38),(39,40)), VariadicList((11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36)) ) # Sorting network for 52 inputs, 409 CEs, 19 layers: # [(0,25),(1,24),(2,23),(3,19),(4,21),(5,20),(6,22),(7,18),(8,16),(9,17),(10,15),(11,14),(12,13),(26,51),(27,50),(28,49),(29,45),(30,47),(31,46),(32,48),(33,44),(34,42),(35,43),(36,41),(37,40),(38,39)] # [(0,1),(2,5),(3,6),(4,8),(7,10),(9,16),(11,12),(13,14),(15,18),(17,21),(19,22),(20,23),(24,25),(26,27),(28,31),(29,32),(30,34),(33,36),(35,42),(37,38),(39,40),(41,44),(43,47),(45,48),(46,49),(50,51)] # [(0,17),(1,24),(2,11),(3,7),(4,9),(5,13),(6,15),(8,25),(10,19),(12,20),(14,23),(16,21),(18,22),(26,43),(27,50),(28,37),(29,33),(30,35),(31,39),(32,41),(34,51),(36,45),(38,46),(40,49),(42,47),(44,48)] # [(0,4),(1,9),(2,3),(5,6),(7,12),(8,17),(10,11),(13,18),(14,15),(16,24),(19,20),(21,25),(22,23),(26,30),(27,35),(28,29),(31,32),(33,38),(34,43),(36,37),(39,44),(40,41),(42,50),(45,46),(47,51),(48,49)] # [(0,7),(1,5),(3,4),(6,9),(8,10),(11,12),(13,14),(15,17),(16,19),(18,25),(20,24),(21,22),(26,33),(27,31),(29,30),(32,35),(34,36),(37,38),(39,40),(41,43),(42,45),(44,51),(46,50),(47,48)] # [(0,2),(4,12),(5,20),(7,8),(10,14),(11,15),(13,21),(17,18),(23,25),(26,28),(30,38),(31,46),(33,34),(36,40),(37,41),(39,47),(43,44),(49,51)] # [(0,26),(1,7),(2,3),(4,13),(5,10),(6,8),(9,14),(11,16),(12,21),(15,20),(17,19),(18,24),(22,23),(25,51),(27,33),(28,29),(30,39),(31,36),(32,34),(35,40),(37,42),(38,47),(41,46),(43,45),(44,50),(48,49)] # [(1,2),(3,7),(4,11),(5,6),(8,9),(10,13),(12,15),(14,21),(16,17),(18,22),(19,20),(23,24),(27,28),(29,33),(30,37),(31,32),(34,35),(36,39),(38,41),(40,47),(42,43),(44,48),(45,46),(49,50)] # [(1,27),(3,4),(6,11),(8,16),(9,17),(10,12),(13,15),(14,19),(21,22),(24,50),(29,30),(32,37),(34,42),(35,43),(36,38),(39,41),(40,45),(47,48)] # [(2,3),(4,5),(7,11),(8,10),(9,12),(13,16),(14,18),(15,17),(20,21),(22,23),(28,29),(30,31),(33,37),(34,36),(35,38),(39,42),(40,44),(41,43),(46,47),(48,49)] # [(2,28),(3,4),(5,8),(6,7),(9,10),(11,13),(12,14),(15,16),(17,20),(18,19),(21,22),(23,49),(29,30),(31,34),(32,33),(35,36),(37,39),(38,40),(41,42),(43,46),(44,45),(47,48)] # [(3,29),(5,6),(7,8),(9,11),(10,13),(12,15),(14,16),(17,18),(19,20),(22,48),(31,32),(33,34),(35,37),(36,39),(38,41),(40,42),(43,44),(45,46)] # [(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47)] # [(4,30),(5,31),(6,32),(7,33),(8,34),(9,35),(10,36),(11,37),(12,38),(13,39),(14,40),(15,41),(16,42),(17,43),(18,44),(19,45),(20,46),(21,47)] # [(16,26),(17,27),(18,28),(19,29),(20,30),(21,31),(22,32),(23,33),(24,34),(25,35)] # [(8,16),(9,17),(10,18),(11,19),(12,20),(13,21),(14,22),(15,23),(24,26),(25,27),(28,36),(29,37),(30,38),(31,39),(32,40),(33,41),(34,42),(35,43)] # [(4,8),(5,9),(6,10),(7,11),(12,16),(13,17),(14,18),(15,19),(20,24),(21,25),(22,28),(23,29),(26,30),(27,31),(32,36),(33,37),(34,38),(35,39),(40,44),(41,45),(42,46),(43,47)] # [(2,4),(3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25),(26,28),(27,29),(30,32),(31,33),(34,36),(35,37),(38,40),(39,41),(42,44),(43,45),(46,48),(47,49)] # [(1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50)] alias swap_data_52 = VariadicList( VariadicList((0,25),(1,24),(2,23),(3,19),(4,21),(5,20),(6,22),(7,18),(8,16),(9,17),(10,15),(11,14),(12,13),(26,51),(27,50),(28,49),(29,45),(30,47),(31,46),(32,48),(33,44),(34,42),(35,43),(36,41),(37,40),(38,39)), VariadicList((0,1),(2,5),(3,6),(4,8),(7,10),(9,16),(11,12),(13,14),(15,18),(17,21),(19,22),(20,23),(24,25),(26,27),(28,31),(29,32),(30,34),(33,36),(35,42),(37,38),(39,40),(41,44),(43,47),(45,48),(46,49),(50,51)), VariadicList((0,17),(1,24),(2,11),(3,7),(4,9),(5,13),(6,15),(8,25),(10,19),(12,20),(14,23),(16,21),(18,22),(26,43),(27,50),(28,37),(29,33),(30,35),(31,39),(32,41),(34,51),(36,45),(38,46),(40,49),(42,47),(44,48)), VariadicList((0,4),(1,9),(2,3),(5,6),(7,12),(8,17),(10,11),(13,18),(14,15),(16,24),(19,20),(21,25),(22,23),(26,30),(27,35),(28,29),(31,32),(33,38),(34,43),(36,37),(39,44),(40,41),(42,50),(45,46),(47,51),(48,49)), VariadicList((0,7),(1,5),(3,4),(6,9),(8,10),(11,12),(13,14),(15,17),(16,19),(18,25),(20,24),(21,22),(26,33),(27,31),(29,30),(32,35),(34,36),(37,38),(39,40),(41,43),(42,45),(44,51),(46,50),(47,48)), VariadicList((0,2),(4,12),(5,20),(7,8),(10,14),(11,15),(13,21),(17,18),(23,25),(26,28),(30,38),(31,46),(33,34),(36,40),(37,41),(39,47),(43,44),(49,51)), VariadicList((0,26),(1,7),(2,3),(4,13),(5,10),(6,8),(9,14),(11,16),(12,21),(15,20),(17,19),(18,24),(22,23),(25,51),(27,33),(28,29),(30,39),(31,36),(32,34),(35,40),(37,42),(38,47),(41,46),(43,45),(44,50),(48,49)), VariadicList((1,2),(3,7),(4,11),(5,6),(8,9),(10,13),(12,15),(14,21),(16,17),(18,22),(19,20),(23,24),(27,28),(29,33),(30,37),(31,32),(34,35),(36,39),(38,41),(40,47),(42,43),(44,48),(45,46),(49,50)), VariadicList((1,27),(3,4),(6,11),(8,16),(9,17),(10,12),(13,15),(14,19),(21,22),(24,50),(29,30),(32,37),(34,42),(35,43),(36,38),(39,41),(40,45),(47,48)), VariadicList((2,3),(4,5),(7,11),(8,10),(9,12),(13,16),(14,18),(15,17),(20,21),(22,23),(28,29),(30,31),(33,37),(34,36),(35,38),(39,42),(40,44),(41,43),(46,47),(48,49)), VariadicList((2,28),(3,4),(5,8),(6,7),(9,10),(11,13),(12,14),(15,16),(17,20),(18,19),(21,22),(23,49),(29,30),(31,34),(32,33),(35,36),(37,39),(38,40),(41,42),(43,46),(44,45),(47,48)), VariadicList((3,29),(5,6),(7,8),(9,11),(10,13),(12,15),(14,16),(17,18),(19,20),(22,48),(31,32),(33,34),(35,37),(36,39),(38,41),(40,42),(43,44),(45,46)), VariadicList((4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),(46,47)), VariadicList((4,30),(5,31),(6,32),(7,33),(8,34),(9,35),(10,36),(11,37),(12,38),(13,39),(14,40),(15,41),(16,42),(17,43),(18,44),(19,45),(20,46),(21,47)), VariadicList((16,26),(17,27),(18,28),(19,29),(20,30),(21,31),(22,32),(23,33),(24,34),(25,35)), VariadicList((8,16),(9,17),(10,18),(11,19),(12,20),(13,21),(14,22),(15,23),(24,26),(25,27),(28,36),(29,37),(30,38),(31,39),(32,40),(33,41),(34,42),(35,43)), VariadicList((4,8),(5,9),(6,10),(7,11),(12,16),(13,17),(14,18),(15,19),(20,24),(21,25),(22,28),(23,29),(26,30),(27,31),(32,36),(33,37),(34,38),(35,39),(40,44),(41,45),(42,46),(43,47)), VariadicList((2,4),(3,5),(6,8),(7,9),(10,12),(11,13),(14,16),(15,17),(18,20),(19,21),(22,24),(23,25),(26,28),(27,29),(30,32),(31,33),(34,36),(35,37),(38,40),(39,41),(42,44),(43,45),(46,48),(47,49)), VariadicList((1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16),(17,18),(19,20),(21,22),(23,24),(25,26),(27,28),(29,30),(31,32),(33,34),(35,36),(37,38),(39,40),(41,42),(43,44),(45,46),(47,48),(49,50)) ) # fmt: on --- sort_network/sort_network_ml.mojo --- from sort_network.sort_network import ( sn, sn_merge, sn_2x_interleave, sn_2x_parallel, ) from sort_network.SwapData import SwapData fn sort_2x[T: DType, sub_chan: Int, sequential: Bool, ascending: Bool]( d0: SIMD[T, sub_chan], d1: SIMD[T, sub_chan], ) -> (SIMD[T, sub_chan], SIMD[T, sub_chan]): @parameter if sequential: return (sn[T, sub_chan, ascending](d0), sn[T, sub_chan, ascending](d1)) else: return sn_2x_interleave[T, T, sub_chan, ascending](d0, d1) #return sn_2x_parallel[T, sub_size, ascending](d0, d1) # sorting network multi-layer 4N: divide width in two; and use sorting network 4 fn sn_ml_4n[ T: DType, channels: Int, ascending: Bool ](data: SIMD[T, channels]) -> SIMD[T, channels]: alias sub_size: Int = channels >> 2 alias sequential: Bool = False # Sorting network for 4 inputs, 5 CEs, 3 layers: # [(0,2),(1,3)] # [(0,1),(2,3)] # [(1,2)] var d0: SIMD[T, sub_size] = data.slice[sub_size](0 * sub_size) var d1: SIMD[T, sub_size] = data.slice[sub_size](1 * sub_size) var d2: SIMD[T, sub_size] = data.slice[sub_size](2 * sub_size) var d3: SIMD[T, sub_size] = data.slice[sub_size](3 * sub_size) let d02: SIMD[T, 2 * sub_size] let d13: SIMD[T, 2 * sub_size] d02, d13 = sort_2x[T, 2*sub_size, sequential, ascending](d0.join(d2), d1.join(d3)) d0 = d02.slice[sub_size](0) d1 = d13.slice[sub_size](0) d2 = d02.slice[sub_size](sub_size) d3 = d13.slice[sub_size](sub_size) let d01: SIMD[T, 2 * sub_size] = sn_merge[T, 2 * sub_size, ascending](d0.join(d1)) let d23: SIMD[T, 2 * sub_size] = sn_merge[T, 2 * sub_size, ascending](d2.join(d3)) d0 = d01.slice[sub_size](0) d1 = d01.slice[sub_size](sub_size) d2 = d23.slice[sub_size](0) d3 = d23.slice[sub_size](sub_size) let d12: SIMD[T, 2 * sub_size] = sn_merge[T, 2 * sub_size, ascending](d1.join(d2)) d1 = d12.slice[sub_size](0) d2 = d12.slice[sub_size](sub_size) let d0123 = d0.join(d1).join(d2.join(d3)) return rebind[SIMD[T, channels]](d0123) fn sn_ml_8n[ T: DType, channels: Int, ascending: Bool ](data: SIMD[T, channels]) -> SIMD[T, channels]: alias sub_size: Int = channels >> 3 # Sorting network for 8 inputs, 19 CEs, 6 layers: # [(0,2),(1,3),(4,6),(5,7)] # [(0,4),(1,5),(2,6),(3,7)] # [(0,1),(2,3),(4,5),(6,7)] # [(2,4),(3,5)] # [(1,4),(3,6)] # [(1,2),(3,4),(5,6)] var d0: SIMD[T, sub_size] = data.slice[sub_size](0 * sub_size) var d1: SIMD[T, sub_size] = data.slice[sub_size](1 * sub_size) var d2: SIMD[T, sub_size] = data.slice[sub_size](2 * sub_size) var d3: SIMD[T, sub_size] = data.slice[sub_size](3 * sub_size) var d4: SIMD[T, sub_size] = data.slice[sub_size](4 * sub_size) var d5: SIMD[T, sub_size] = data.slice[sub_size](5 * sub_size) var d6: SIMD[T, sub_size] = data.slice[sub_size](6 * sub_size) var d7: SIMD[T, sub_size] = data.slice[sub_size](7 * sub_size) # [(0,2),(1,3),(4,6),(5,7)] @parameter # just a hack to create a local scope if True: let d02 = sn[T, 2 * sub_size, ascending](d0.join(d2)) let d13 = sn[T, 2 * sub_size, ascending](d1.join(d3)) let d46 = sn[T, 2 * sub_size, ascending](d4.join(d6)) let d57 = sn[T, 2 * sub_size, ascending](d5.join(d7)) d0 = d02.slice[sub_size](0) d1 = d13.slice[sub_size](0) d2 = d02.slice[sub_size](sub_size) d3 = d13.slice[sub_size](sub_size) d4 = d46.slice[sub_size](0) d5 = d57.slice[sub_size](0) d6 = d46.slice[sub_size](sub_size) d7 = d57.slice[sub_size](sub_size) # [(0,4),(1,5),(2,6),(3,7)] @parameter # just a hack to create a local scope if True: let d04 = sn_merge[T, 2 * sub_size, ascending](d0.join(d4)) let d15 = sn_merge[T, 2 * sub_size, ascending](d1.join(d5)) let d26 = sn_merge[T, 2 * sub_size, ascending](d2.join(d6)) let d37 = sn_merge[T, 2 * sub_size, ascending](d3.join(d7)) d0 = d04.slice[sub_size](0) d1 = d15.slice[sub_size](0) d2 = d26.slice[sub_size](0) d3 = d37.slice[sub_size](0) d4 = d04.slice[sub_size](sub_size) d5 = d15.slice[sub_size](sub_size) d6 = d26.slice[sub_size](sub_size) d7 = d37.slice[sub_size](sub_size) # [(0,1),(2,3),(4,5),(6,7)] @parameter # just a hack to create a local scope if True: let d01 = sn_merge[T, 2 * sub_size, ascending](d0.join(d1)) let d23 = sn_merge[T, 2 * sub_size, ascending](d2.join(d3)) let d45 = sn_merge[T, 2 * sub_size, ascending](d4.join(d5)) let d67 = sn_merge[T, 2 * sub_size, ascending](d6.join(d7)) d0 = d01.slice[sub_size](0) d1 = d01.slice[sub_size](sub_size) d2 = d23.slice[sub_size](0) d3 = d23.slice[sub_size](sub_size) d4 = d45.slice[sub_size](0) d5 = d45.slice[sub_size](sub_size) d6 = d67.slice[sub_size](0) d7 = d67.slice[sub_size](sub_size) # [(2,4),(3,5)] @parameter # just a hack to create a local scope if True: let d24 = sn_merge[T, 2 * sub_size, ascending](d2.join(d4)) let d35 = sn_merge[T, 2 * sub_size, ascending](d3.join(d5)) d2 = d24.slice[sub_size](0) d3 = d35.slice[sub_size](0) d4 = d24.slice[sub_size](sub_size) d5 = d35.slice[sub_size](sub_size) # [(1,4),(3,6)] @parameter # just a hack to create a local scope if True: let d14 = sn_merge[T, 2 * sub_size, ascending](d1.join(d4)) let d36 = sn_merge[T, 2 * sub_size, ascending](d3.join(d6)) d1 = d14.slice[sub_size](0) d3 = d36.slice[sub_size](0) d4 = d14.slice[sub_size](sub_size) d6 = d36.slice[sub_size](sub_size) # [(1,2),(3,4),(5,6)] @parameter # just a hack to create a local scope if True: let d12 = sn_merge[T, 2 * sub_size, ascending](d1.join(d2)) let d34 = sn_merge[T, 2 * sub_size, ascending](d3.join(d4)) let d56 = sn_merge[T, 2 * sub_size, ascending](d5.join(d6)) d1 = d12.slice[sub_size](0) d2 = d12.slice[sub_size](sub_size) d3 = d34.slice[sub_size](0) d4 = d34.slice[sub_size](sub_size) d5 = d56.slice[sub_size](0) d6 = d56.slice[sub_size](sub_size) let d0123 = d0.join(d1).join(d2.join(d3)) let d4567 = d4.join(d5).join(d6.join(d7)) return rebind[SIMD[T, channels]](d0123.join(d4567)) --- sort_network/sort_tools.mojo --- from testing import assert_true from sort_network.sort_network_data import swap_data from sort_network.SwapData import Layer, SwapData fn gen_merge_mask[ swaps: Layer, width: Int, ascending: Bool ]() -> SIMD[DType.bool, width]: var result = SIMD[DType.bool, width]() for i in range(len(swaps)): if ascending: # set the minium of the comparison to true to get ascending result[swaps.get_min(i)] = True else: # set the maximum of the comparison to true to get descending result[swaps.get_max(i)] = True return result # generate a index permutation (of size width) from the provided swaps in Layer fn gen_perm[swaps: Layer, width: Int]() -> StaticIntTuple[width]: var result = StaticIntTuple[width]() for i in range(width): result[i] = i for i in range(len(swaps)): let from_ = swaps.get_min(i) let to_ = swaps.get_max(i) let tmp = result[to_] result[to_] = result[from_] result[from_] = tmp return result @always_inline fn swap_n[ T: DType, width: Int, swaps: Layer, ascending: Bool ](v: SIMD[T, width]) -> SIMD[T, width]: alias permutations = gen_perm[swaps, width]() constrained[len(permutations) == width, "invalid number of permutations"]() alias merge_mask = gen_merge_mask[swaps, width, ascending]() let v2 = my_shuffle[T, width, permutations](v) return merge_mask.select(v.min(v2), v.max(v2)) @always_inline fn swap_idx[ T1: DType, T2: DType, width: Int, swaps: Layer, ascending: Bool ](t: Tuple[SIMD[T1, width], SIMD[T2, width]]) -> (SIMD[T1, width], SIMD[T2, width]): alias permutations = gen_perm[swaps, width]() let data = t.get[0, SIMD[T1, width]]() let idx = t.get[1, SIMD[T2, width]]() let data_sorted = swap_n[T1, width, swaps, ascending](data) let change_mask = data_sorted != data let idx_shuffled = my_shuffle[T2, width, permutations](idx) return (data_sorted, change_mask.select(idx_shuffled, idx)) fn test_perm_code(): alias swap16 = swap_data[16]() alias l1_obs = gen_perm[swap16[0], 16]() alias l1_exp = StaticIntTuple[16]( 5, 4, 12, 13, 1, 0, 7, 6, 9, 8, 15, 14, 2, 3, 11, 10 ) constrained[l1_obs == l1_exp, "l1"]() alias l2_obs = gen_perm[swap16[1], 16]() alias l2_exp = StaticIntTuple[16]( 2, 10, 0, 6, 7, 14, 3, 4, 11, 12, 1, 8, 9, 15, 5, 13 ) constrained[l2_obs == l2_exp, "l2"]() alias l3_obs = gen_perm[swap16[2], 16]() alias l3_exp = StaticIntTuple[16]( 8, 3, 11, 1, 13, 9, 10, 15, 0, 5, 6, 2, 14, 4, 12, 7 ) constrained[l3_obs == l3_exp, "l3"]() alias l4_obs = gen_perm[swap16[3], 16]() alias l4_exp = StaticIntTuple[16]( 1, 0, 4, 8, 2, 6, 5, 12, 3, 10, 9, 13, 7, 11, 15, 14 ) constrained[l4_obs == l4_exp, "l4"]() alias l5_obs = gen_perm[swap16[4], 16]() alias l5_exp = StaticIntTuple[16]( 0, 3, 5, 1, 8, 2, 9, 11, 4, 6, 13, 7, 14, 10, 12, 15 ) constrained[l5_obs == l5_exp, "l5"]() alias l6_obs = gen_perm[swap16[5], 16]() alias l6_exp = StaticIntTuple[16]( 0, 2, 1, 5, 11, 3, 8, 9, 6, 7, 12, 4, 10, 14, 13, 15 ) constrained[l6_obs == l6_exp, "l6"]() alias l7_obs = gen_perm[swap16[6], 16]() alias l7_exp = StaticIntTuple[16]( 0, 1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 14, 15 ) constrained[l7_obs == l7_exp, "l7"]() alias l8_obs = gen_perm[swap16[7], 16]() alias l8_exp = StaticIntTuple[16]( 0, 1, 2, 3, 6, 7, 4, 5, 10, 11, 8, 9, 12, 13, 14, 15 ) constrained[l8_obs == l8_exp, "l8"]() alias l9_obs = gen_perm[swap16[8], 16]() alias l9_exp = StaticIntTuple[16]( 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 13, 14, 15 ) constrained[l9_obs == l9_exp, "l9"]() print("test_perm_code: DONE") @always_inline fn my_shuffle[ T: DType, width: Int, p: StaticIntTuple[width] ](v: SIMD[T, width]) -> SIMD[T, width]: @parameter if width == 8: return v.shuffle[ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], ]() elif width == 16: return v.shuffle[ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], ]() elif width == 32: return v.shuffle[ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31], ]() elif width == 64: return v.shuffle[ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31], p[32], p[33], p[34], p[35], p[36], p[37], p[38], p[39], p[40], p[41], p[42], p[43], p[44], p[45], p[46], p[47], p[48], p[49], p[50], p[51], p[52], p[53], p[54], p[55], p[56], p[57], p[58], p[59], p[60], p[61], p[62], p[63], ]() elif width == 128: return v.shuffle[ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31], p[32], p[33], p[34], p[35], p[36], p[37], p[38], p[39], p[40], p[41], p[42], p[43], p[44], p[45], p[46], p[47], p[48], p[49], p[50], p[51], p[52], p[53], p[54], p[55], p[56], p[57], p[58], p[59], p[60], p[61], p[62], p[63], p[64], p[65], p[66], p[67], p[68], p[69], p[70], p[71], p[72], p[73], p[74], p[75], p[76], p[77], p[78], p[79], p[80], p[81], p[82], p[83], p[84], p[85], p[86], p[87], p[88], p[89], p[90], p[91], p[92], p[93], p[94], p[95], p[96], p[97], p[98], p[99], p[100], p[101], p[102], p[103], p[104], p[105], p[106], p[107], p[108], p[109], p[110], p[111], p[112], p[113], p[114], p[115], p[116], p[117], p[118], p[119], p[120], p[121], p[122], p[123], p[124], p[125], p[126], p[127], ]() elif width == 256: return v.shuffle[ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31], p[32], p[33], p[34], p[35], p[36], p[37], p[38], p[39], p[40], p[41], p[42], p[43], p[44], p[45], p[46], p[47], p[48], p[49], p[50], p[51], p[52], p[53], p[54], p[55], p[56], p[57], p[58], p[59], p[60], p[61], p[62], p[63], p[64], p[65], p[66], p[67], p[68], p[69], p[70], p[71], p[72], p[73], p[74], p[75], p[76], p[77], p[78], p[79], p[80], p[81], p[82], p[83], p[84], p[85], p[86], p[87], p[88], p[89], p[90], p[91], p[92], p[93], p[94], p[95], p[96], p[97], p[98], p[99], p[100], p[101], p[102], p[103], p[104], p[105], p[106], p[107], p[108], p[109], p[110], p[111], p[112], p[113], p[114], p[115], p[116], p[117], p[118], p[119], p[120], p[121], p[122], p[123], p[124], p[125], p[126], p[127], p[128], p[129], p[130], p[131], p[132], p[133], p[134], p[135], p[136], p[137], p[138], p[139], p[140], p[141], p[142], p[143], p[144], p[145], p[146], p[147], p[148], p[149], p[150], p[151], p[152], p[153], p[154], p[155], p[156], p[157], p[158], p[159], p[160], p[161], p[162], p[163], p[164], p[165], p[166], p[167], p[168], p[169], p[170], p[171], p[172], p[173], p[174], p[175], p[176], p[177], p[178], p[179], p[180], p[181], p[182], p[183], p[184], p[185], p[186], p[187], p[188], p[189], p[190], p[191], p[192], p[193], p[194], p[195], p[196], p[197], p[198], p[199], p[200], p[201], p[202], p[203], p[204], p[205], p[206], p[207], p[208], p[209], p[210], p[211], p[212], p[213], p[214], p[215], p[216], p[217], p[218], p[219], p[220], p[221], p[222], p[223], p[224], p[225], p[226], p[227], p[228], p[229], p[230], p[231], p[232], p[233], p[234], p[235], p[236], p[237], p[238], p[239], p[240], p[241], p[242], p[243], p[244], p[245], p[246], p[247], p[248], p[249], p[250], p[251], p[252], p[253], p[254], p[255], ]() else: constrained[False]() return v --- sort_network/test_individual.mojo --- from algorithm.sort import sort from time import now from benchmark import keep from sort_network.sort_network import ( sn, sn_idx, sn_2x_interleave, sn_2x_parallel, ) from sort_network.sort_network_ml import sn_ml_4n from sort_network.performance import ( gen_random_SIMD, gen_random_vec, gen_random_pointer, gen_random_DTypePointer, ) fn test_mojo_sort[T: DType](size: Int): let buff = gen_random_pointer[T](size) for i in range(size): print_no_newline(str(buff[i]) + " ") print("") var ptr = buff let start_time_ms = now() sort[T](ptr, size) let elapsed_time_ms = now() - start_time_ms for i in range(size): print_no_newline(str(ptr[i]) + " ") print("\ntime spend " + str(elapsed_time_ms) + " ns") buff.free() fn test_netw_vec_sort[T: DType](size: Int): let buff = gen_random_DTypePointer[T](size) for i in range(size): print_no_newline(str(buff[i]) + " ") print("") var ptr = buff let start_time_ms = now() sn[T](ptr, size) let elapsed_time_ms = now() - start_time_ms for i in range(size): print_no_newline(str(ptr[i]) + " ") print("\ntime spend " + str(elapsed_time_ms) + " ns") buff.free() fn test_netw_SIMD_sort[T: DType, channels: Int, ascending: Bool](): let data1 = gen_random_SIMD[T, channels]() print("before " + str(channels) + ": " + str(data1)) let start_time_ms = now() let data2 = sn[T, channels, ascending](data1) # let data2 = sort_by_counting[T, channels, ascending](data1) let elapsed_time_ms = now() - start_time_ms print("after " + str(channels) + ": " + str(data2)) keep(data2.reduce_add()) print("time spend " + str(elapsed_time_ms) + " ns") fn test_netw_SIMD_sort_multi_layer[T: DType, ascending: Bool](): alias channels: Int = 128 let data1 = gen_random_SIMD[T, channels]() print("before " + str(channels) + ": " + str(data1)) let start_time_ms = now() let data2 = sn_ml_4n[T, channels, ascending](data1) let elapsed_time_ms = now() - start_time_ms print("after " + str(channels) + ": " + str(data2)) keep(data2.reduce_add()) print("time spend " + str(elapsed_time_ms) + " ns") fn test_netw_SIMD_sort_idx[T1: DType, T2: DType, channels: Int, ascending: Bool](): let data = gen_random_SIMD[T1, channels]() var idx = SIMD[T2, channels]() for i in range(channels): idx[i] = i print("before: " + String(data)) print("before: " + String(idx)) let t = sn_idx[T1, T2, channels, ascending](data, idx) let data2 = t.get[0, SIMD[T1, channels]]() let idx2 = t.get[1, SIMD[T2, channels]]() print("after: " + String(data2)) print("after: " + String(idx2)) # conclusion comparing test_netw_SIMD_sort_2x_A with test_netw_SIMD_sort_2x_B: # sort_16element_2x is slightly more efficient, but not much fn test_netw_SIMD_sort_2x_A[ T1: DType, T2: DType, channels: Int, ascending1: Bool = True, ascending2: Bool = True, ](): let data1a = gen_random_SIMD[T1, channels]() let data1b = gen_random_SIMD[T2, channels]() print("before: " + String(data1a)) print("before: " + String(data1b)) let data2a = sn[T1, channels, ascending1](data1a) let data2b = sn[T2, channels, ascending2](data1b) print("after: " + String(data2a)) print("after: " + String(data2b)) fn test_netw_SIMD_sort_2x_B[ T1: DType, T2: DType, ascending1: Bool = True, ascending2: Bool = True ](): alias channels: Int = 16 let data1a = gen_random_SIMD[T1, channels]() let data1b = gen_random_SIMD[T2, channels]() print("before: " + String(data1a)) print("before: " + String(data1b)) let data2 = sn_2x_interleave[T1, T2, channels, ascending1, ascending2]( data1a, data1b ) let data2a = data2.get[0, SIMD[T1, channels]]() let data2b = data2.get[1, SIMD[T2, channels]]() print("after: " + String(data2a)) print("after: " + String(data2b)) # let data3 = sn_2x_parallel[T1, channels, ascending1](data1a, data1b) # let data3a = data2.get[0, SIMD[T1, channels]]() # let data3b = data2.get[1, SIMD[T2, channels]]() # print("after: " + String(data3a)) # print("after: " + String(data3b)) --- sort_network/test_tools.mojo --- from random import random_ui64 fn gen_random_SIMD[T: DType, width: Int]() -> SIMD[T, width]: var result = SIMD[T, width]() # TODO: use faster methods for i in range(width): result[i] = random_ui64(0, 100).cast[T]() return result fn gen_random_vec[T: DType](size: Int) -> DynamicVector[SIMD[T, 1]]: var result = DynamicVector[SIMD[T, 1]](size) # TODO: use faster methods for i in range(size): result.push_back(random_ui64(0, 100).cast[T]()) return result fn gen_random_pointer[T: DType](size: Int) -> Pointer[SIMD[T, 1]]: let result = Pointer[SIMD[T, 1]].aligned_alloc(16, size) # TODO: use faster methods for i in range(size): result[i] = random_ui64(0, 100).cast[T]() return result fn gen_random_DTypePointer[T: DType](size: Int) -> DTypePointer[T, 0]: let result = DTypePointer[T].alloc(size) # TODO: use faster methods for i in range(size): result[i] = random_ui64(0, 100).cast[T]() return result --- sort_network/tests.mojo --- from algorithm.sort import sort from sort_network.sort_network import sn_idx, sn from sort_network.test_tools import gen_random_SIMD fn test_sort(): fn eq[T: DType, s: Int](v1: SIMD[T, s], v2: SIMD[T, s]) -> Bool: for i in range(s): if v1[i] != v2[i]: return False return True alias data_1 = SIMD[DType.int32, 16]( 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ) alias idx_1 = SIMD[DType.int32, 16]( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ) alias t1a = sn_idx[channels=16, ascending=True](data_1, idx_1) alias data_1a_obs = t1a.get[0, SIMD[DType.int32, 16]]() alias data_1a_exp = SIMD[DType.int32, 16]( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ) @parameter if not eq(data_1a_obs, data_1a_exp): print("data_1 org " + str(data_1)) print("data_1a exp " + str(data_1a_exp)) print("data_1a obs " + str(data_1a_obs)) alias idx_1a_obs = t1a.get[1, SIMD[DType.int32, 16]]() alias idx_1a_exp = SIMD[DType.int32, 16]( 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2, 0 ) @parameter if not eq(idx_1a_obs, idx_1a_exp): print("idx_1 org " + str(idx_1)) print("idx_1a exp " + str(idx_1a_exp)) print("idx_1a obs " + str(idx_1a_obs)) alias t1b = sn_idx[channels=16, ascending=False](data_1, idx_1) alias data_1b_obs = t1b.get[0, SIMD[DType.int32, 16]]() alias data_1b_exp = SIMD[DType.int32, 16]( 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ) @parameter if not eq(data_1b_obs, data_1b_exp): print("data_1 org " + str(data_1)) print("data_1b exp " + str(data_1b_exp)) print("data_1b obs " + str(data_1b_obs)) alias idx_1b_obs = t1b.get[1, SIMD[DType.int32, 16]]() alias idx_1b_exp = SIMD[DType.int32, 16]( 0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ) @parameter if not eq(idx_1b_obs, idx_1b_exp): print("idx_1 org " + str(idx_1)) print("idx_1b exp " + str(idx_1b_exp)) print("idx_1b obs " + str(idx_1b_obs)) print("test_sort: DONE") fn test_sort_N[T: DType, size: Int](n_experiments: Int): var buff: Pointer[SIMD[T, 1], 0] = Pointer[SIMD[T, 1]].alloc(size) for i in range(n_experiments): if i == 0: print_no_newline("test_sort_N " + str(size) + ": ") elif (i & 0xFFFF) == 0: print_no_newline("x") let data = gen_random_SIMD[T, size]() for i in range(size): buff[i] = data[i] # sort with Mojo as reference impl sort[T](buff, size) # sort with SortingNetwork let sorted_data = sn[T](data) # check if reference and SortingNetwork yield equal results for i in range(size): if sorted_data[i] != buff[i]: print("NOT equal!") return print(" " + str(n_experiments) + " tests successes") fn test_sort_X(n_experiments: Int): test_sort_N[DType.uint8, 8](n_experiments) test_sort_N[DType.uint8, 16](n_experiments) test_sort_N[DType.uint8, 32](n_experiments) test_sort_N[DType.uint8, 64](n_experiments) test_sort_N[DType.uint8, 128](n_experiments) --- sort_network/timing_test.mojo --- from benchmark import keep from time import time_function, now from random import random_ui64 fn gen_random_SIMD[T: DType, width: Int]() -> SIMD[T, width]: var result = SIMD[T, width]() # TODO: use faster methods for i in range(width): result[i] = random_ui64(0, 100).cast[T]() return result fn main(): let a = gen_random_SIMD[DType.uint32, 16]() var b: UInt32 = 0 let start_time_ms = now() b = a.reduce_add() let elapsed_time_ms = now() - start_time_ms keep(b) # @parameter # fn runner(): # b = a.reduce_add() # keep(b) # let elapsed_time_ms = time_function[runner]() print(elapsed_time_ms) # print(b) --- LICENSE --- MIT License Copyright (c) 2023 rd4com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # 📖 Learning mojo language ### ⚠️ not affiliated with Modular or Mojo &nbsp; ### [🔍 Why](/why.md) ### [🔦 Introduction](/introduction.md) ### [🫵 corrections and contributions](contribute.md) &nbsp; # [🟢 Let's ```mojo build -D your="own" -D version=1 app.🔥``` with ``` 🛡️Constrained```](./tutorials/use-parameters-to-create-or-integrate-workflow.md) Integrate apps with existing build scripts, for example # [`SIMD` is a type, with `methods` and `operators` !](./tutorials/simd-is-a-type-with-methods-and-operators.md) `SIMD` vectors are first-class citizens. # [🔁 Python land and mojo land, PythonObject](tutorials/python-world-mojo-world.md) note: need revision for better accessibility # [🛣️ 🚌 multi-core (parallelize) with simd](tutorials/multi-core-parallelize-with-simd%20.md) simd and parallelize. # [🪄 calling mojo functions from python ](tutorials/calling-mojo-functions-in-python.md) using pointers an ctype # [🐍 using python in mojo: a to z](tutorials/using-python-in-mojo.md) first steps and dancing # [🏚️🏗️🏠 Moving owned values](tutorials/moving-owned-values.md) ```__moveinit__``` ```__del__``` and many more ! # [📋 Traits: accept any types that comply to requirements](tutorials/traits.md) accept types based on some requirements # [SIMD: 🔢✖️2️⃣🟰❪2️⃣,4️⃣,6️⃣,8️⃣❫](tutorials/simd.md) perform an operation on multiple numbers # [👜 Variant, a type that can hold values of different types](./tutorials/variant.md) The current type it holds can change and be checked # [🐍🔍 type-checking a PythonObject](./tutorials/type-check-class-of-pythonobject.md) For example, to iterate python arrays that might contains objects of various classes # [🧬 Parameters, Alias, Struct parameter deduction, more](tutorials/parameters-alias-struct-parameter-deduction.md) Parameterize! (compile time meta-programming) # [🪄🔮 Autotuned parametrized tests](tutorials/autotuned-parametrized-tests.md) Testing for multiple ```SIMD``` sizes # [🔥 With blocks: with my_struct(1) as v](tutorials/with-blocks-for-struct-parametric-minimal-raise.md) with blocks from struct (parametric/minimal/raise) # [🏃 (SPEED) Parametric struct through CPU registers](tutorials/parametric-struct-trough-cpu-registers.md) the @register_passable decorator # [🏞️ getattr: dynamic and static struct members](tutorials/getattr-dynamic-and-static-struct-members.md) the_instance.method_not_defined() handled # [🤹 making lists of structs with magic operators](tutorials/lists-of-structs-magic-operators-pre-lifetimes.md) unsafe references abilities until lifetimes # 🫙 [struct as a namespace (@staticmethod)](tutorials/struct-as-namespace.md) example: wrap python functions # [🏳️ make test builds using a custom flag](tutorials/make-test-builds-using-a-custom-flag.md) mojo build program.mojo -D... # [🕯️ reader.read\[Int32,"swap"\](3) in 45 lines](tutorials/reader-in-few-lines-with-endian-ness.md) v0.4.0: powerfull magic # [🔮 Autotune: optimization made easy](tutorials/autotune-optimize-by-search-and-benchmark.md) Easy to use # [🔥 making compile time functions](tutorials/compile-time-functions.md) Pointer[Int] of squared numbers # [🧹 ASAP: will call ```__del__``` when last used](tutorials/memory-asap-and-destructor-behaviours.md) when do del get called on instance # [🏗️ moveinit 💿💿 copyinit 🐿️ non-destructing move](tutorials/moveinit-copyinit-takeinit.md) implement in struct: copy of instance, move, taking move # 🤙 [callbacks trough parameters](tutorials/callbacks-trough-parameters.md) toy markdown generator as an example # [🌊 256Hz: simd cosine and plot it](tutorials/vectorise-simd-cosine.md) one cycle by vectorizing simd instructions, plot with python # [🦜 env, argv and param_env (for alias)](tutorials/env-argv-param_env-for-parameters.md) arguments: command-line, env, alias # [⌨️ introduction to types](tutorials/introduction-to-types.md) syntax and concepts: not complicated # [Try & Except: ✋->⚠️->⛑️->🩹->👍 ](tutorials/try-and-except-errors-handling.md) raise custom errors and recover (with example) # [📫 find out changes and improvements when there is a new update](tutorials/what-have-change-when-there-is-a-new-update.md) changelogs for new comers --- contribute.md --- # 🫵 Contribute #### using github (2 ways) - send a pull request - create a thread in the discussions with the markdown - ```[correction]``` - ```[tutorial]``` #### without github - work in progress --- introduction.md --- # 🔦 Introduction ### Modules: code reuse and organisation ***mylib.mojo*** ```ruby struct something: var x:Int var y:Int fn __init__(inout self a:Int,b:Int): self.x = a self.y = b fn myfunc(inout s:something): s.y = s.x*2 ``` ***app.mojo*** ```python import mylib #or from mylib import something fn myfunc(): print("hello world") fn main(): var x:mylib.something = mylib.something(0,0) mylib.myfunc(x) #keep the scope clean myfunc() ``` **It has great potential for web applications.** Trough the package modularity, it is possible to share data structures and logic between two apps, example: - Front end - Back end Mojo could become the standard in making AI web services. As of today, mojo cannot produce web-assembly, but, probably will, in the future. *note: [Packaging]() is related to modules.* ### import and use any python module or file ***mylib.py*** ```python def print_from_mylib(arg): print(arg) ``` ***app.mojo*** ```python from python import Python fn main() raises: let time = Python.import_module("time") let mylib = Python.import_module("mylib") print(time.monotonic_ns()) mylib.print_from_mylib(time.monotonic_ns()) ``` ### object with small footprint Object comparable to thoses of Python, Javascript, Ruby, Lua, out of the box. ```python #Around 38kb fn take_object(o: object): print(o) fn main() raises: var obj = object("hello world") obj = object([]) #change to a list obj.append(object(123)) obj.append(object("hello world")) take_object(obj) ``` Fits into tiny space, potentially WASM and microcontrollers. Huge demand (stats from today, the 29th September of 2023): - [tinygo](https://github.com/tinygo-org/tinygo) (13.5k stars) - [microptython](https://github.com/micropython/micropython) (17.3k stars) Note: Objects do have types and can be type-checked. ### encapsulation with static methods ```python struct helpers: @staticmethod fn is_even(value: Int) -> Bool: return ((value&1)==0) fn main(): var x:Int = 2 print(helpers.is_even(x)) #keep the scope clean ``` ### From prototype to production using the same language It can of great help to peoples that need to react to changes in their industry quickly. It is usefull to be able to explore new ideas without using a lot of time. Before: ```python from python import PythonObject def create_list()->PythonObject: return PythonObject([]) def push_list(l:PythonObject ,o:PythonObject): l.append(o) def main(): mylist = create_list() push_list(mylist,123) push_list(mylist,"hello world") print(mylist) ``` After: ```python struct myList[T:AnyType]: var data: Pointer[T] fn push(inout self, o: T): ... ``` ### use the hardware efficiently in a few lines of codes The amount of knowledge, and the lines of codes required to do this in other languages can be different: - SIMD operations - Use all cores in a safe manner - Optimisations ```python var python_result = numpy.linspace(0, 255,256) var simd_mojo_array = SIMD[DType.float64,256]() for x in range(256): simd_mojo_array[x]=python_result[x].to_float64() simd_mojo_array = math.cos(simd_mojo_array*(3.14*2.0/256.0)) print(simd_mojo_array) #could vectorize and run in parallel with more data, see mojo documentation and examples ``` see [Using the Mojo 🔥 Visual Studio Extension 🚀](https://www.youtube.com/watch?v=KYEAiTBbNT8) where Jack Clayton also shows the vectorize features provided by mojo ### named arguments with default values ```python fn print_times(t:Int= 1,text:String = "default"): for i in range(t): print(text) fn main(): print_times(text="hello world") print_times() ``` ### compile time logic ```python alias debug_build = 0 def main(): var x:Int = 0 @parameter if debug_build == 1: print(x) #debug_build is 0, print(x) is not in the build! ``` ### variadic arguments ```python fn my_func(*args_w: String): var args = VariadicList(args_w) for i in range(len(args)): print(__get_address_as_lvalue(args[i])) #it will get better fn main(): my_func("hello","world") ``` see [roadmap & sharp edges: no-safe-value-references](https://docs.modular.com/mojo/roadmap.html#no-safe-value-references) ### multiples functions with same name and different signatures ```python fn my_func(o:String): print("it is a string") fn my_func(o:Int): print("it is an integer") fn main(): my_func(1) my_func("hello world") ``` ### different constructors with automatic resolve ```python struct my_struct: var x: Int fn __init__(inout self, other: Int): self.x = other fn __init__(inout self, other: Float64): self.x = other.to_int() def main(): var i:Int = 123 var f:Float64 = 123.0 var a:my_struct = i var b:my_struct = f ``` ### memory under control with the [ASAP](https://docs.modular.com/mojo/programming-manual.html#behavior-of-destructors)(as soon as possible) policy ```python fn main(): var a:String = "hello" print(a) var x = 123 _ = a #arg's memory reclaimed(freed) after the last use (here) print(x) ``` ### ownership system ```python fn take_ownership(owned arg: Int): print(arg) fn change_value(inout arg: Int): arg = 1 fn main(): var data:Int = 0 take_ownership(data^) change_value(data) # error: use of uninitialized value 'data' ``` arg in take_ownership is owned, so the function is ready to take ownership of what is passed. the ownership of data is given/transfered using the ^ suffix ### meta-programming, increased expressive power ```python struct my_struct: var x: Int def __init__(inout self, value:Int): self.x = value def __call__(inout self): print("my value is",String(self.x)) def __getitem__(inout self, key:String): for i in range(self.x): print(key) def __getitem__(inout self, key:Int): for i in range(key): print("hello world") def main(): var x = my_struct(2) x() #print: my value is 2 x["hello"] #print 2 times: "hello" x[2] #print 2 times: "hello world" ``` ### generic types ```python struct my_struct[T:AnyType]: var data: T fn __init__(inout self, value: T): self.data = value fn replace(inout self, new_value: T): self.data = new_value fn main(): var x = my_struct[Int](1) x.replace(2) ``` ### protection, safety my_func_protected: *arg is borrowed(a copy), changes made won't affect "the original".* my_func: *arg is inout and changes will be reflected on "the original".* ```python fn my_func_protected(borrowed arg: Int): print(arg) fn my_func(inout arg: Int): #inout arg=2 #reflected on the original def main(): var x:Int = 1 my_func_protected(x) my_func(x) print(x) #my_func changed x to 2 ``` *Note: If not defined as inout or owned, values are borrowed by default in mojo 0.3.0, so borrowed can be omitted.* ### performance: loop unrolling and inlining ```python @always_inline fn print_and_increment(inout x: Int): print(x) x+=1 fn main(): var i = 0 @unroll while i<3: print_and_increment(i) ``` *becomes* ```python fn main(): var i = 0 print(i) i+=1 print(i) i+=1 print(i) i+=1 ``` The program is faster by not doing ```if i<3``` on each iteration and by not having to jump into print_and_increment. It also become bigger but the point is that this is a choice. ### can be used with Jupyter notebook People use notebooks to do research, presentations, exploration and more. see [Mojo playground](https://playground.modular.com/) It is possible to use the notebook from vscode. --- tutorials/README.md --- # 📖 Learning mojo language ### ⚠️ not affiliated with Modular or Mojo &nbsp; ### [🔍 Why](/why.md) ### [🔦 Introduction](/introduction.md) ### [🫵 corrections and contributions](/contribute.md) &nbsp; # [🟢 Let's ```mojo build -D your="own" -D version=1 app.🔥``` with ``` 🛡️Constrained```](./use-parameters-to-create-or-integrate-workflow.md) Integrate apps with existing build scripts, for example # [`SIMD` is a type, with `methods` and `operators` !](./simd-is-a-type-with-methods-and-operators.md) `SIMD` vectors are first-class citizens. # [🔁 Python land and mojo land, PythonObject](python-world-mojo-world.md) note: need revision for better accessibility # [🛣️ 🚌 multi-core (parallelize) with simd](multi-core-parallelize-with-simd%20.md) simd and parallelize. # [🪄 calling mojo functions from python ](calling-mojo-functions-in-python.md) using pointers an ctype # [🐍 using python in mojo: a to z](using-python-in-mojo.md) first steps and dancing # [🏚️🏗️🏠 Moving owned values](moving-owned-values.md) ```__moveinit__``` ```__del__``` and many more ! # [📋 Traits: accept any types that comply to requirements](traits.md) accept types based on some requirements # [SIMD: 🔢✖️2️⃣🟰❪2️⃣,4️⃣,6️⃣,8️⃣❫](simd.md) perform an operation on multiple numbers # [👜 Variant, a type that can hold values of different types](./variant.md) The current type it holds can change and be checked # [🐍🔍 type-checking a PythonObject](./type-check-class-of-pythonobject.md) For example, to iterate python arrays that might contains objects of various classes # [🧬 Parameters, Alias, Struct parameter deduction, more](parameters-alias-struct-parameter-deduction.md) Parameterize! (compile time meta-programming) # [🪄🔮 Autotuned parametrized tests](autotuned-parametrized-tests.md) Testing for multiple ```SIMD``` sizes # [🔥 With blocks: with my_struct(1) as v ](with-blocks-for-struct-parametric-minimal-raise.md) with blocks from struct (parametric/minimal/raise) # [🏃 (SPEED) Parametric struct through CPU registers](parametric-struct-trough-cpu-registers.md) the @register_passable decorator # [🏞️ getattr: dynamic and static struct members](getattr-dynamic-and-static-struct-members.md) the_instance.method_not_defined() handled # [🤹 making lists of structs with magic operators](lists-of-structs-magic-operators-pre-lifetimes.md) unsafe references abilities until lifetimes # 🫙 [struct as a namespace (@staticmethod)](struct-as-namespace.md) example: wrap python functions # [🏳️ make test builds using a custom flag](make-test-builds-using-a-custom-flag.md) mojo build program.mojo -D... # [🕯️ reader.read\[Int32,"swap"\](3) in 45 lines](reader-in-few-lines-with-endian-ness.md) v0.4.0: powerfull magic # [🔮 Autotune: optimization made easy](autotune-optimize-by-search-and-benchmark.md) Easy to use # [🔥 making compile time functions](compile-time-functions.md) Pointer[Int] of squared numbers # [🧹 ASAP: will call ```__del__``` when last used](memory-asap-and-destructor-behaviours.md) when do del get called on instance # [🏗️ moveinit 💿💿 copyinit 🐿️ non-destructing move](moveinit-copyinit-takeinit.md) implement in struct: copy of instance, move, taking move # 🤙 [callbacks trough parameters](callbacks-trough-parameters.md) toy markdown generator as an example # [🌊 256Hz: simd cosine and plot it](vectorise-simd-cosine.md) one cycle by vectorizing simd instructions, plot with python # [🦜 env, argv and param_env (for alias)](env-argv-param_env-for-parameters.md) arguments: command-line, env, alias # [⌨️ introduction to types](introduction-to-types.md) syntax and concepts: not complicated # [Try & Except: ✋->⚠️->⛑️->🩹->👍 ](try-and-except-errors-handling.md) raise custom errors and recover (with example) # [📫 find out changes and improvements when there is a new update](what-have-change-when-there-is-a-new-update.md) changelogs for new comers --- tutorials/autotune-optimize-by-search-and-benchmark.md --- # 🔮 Autotune: optimization made easy > with 0.4.0 #### ⚠️ untested code, there might be bugs ### how it determine the optimal choice By passing an evaluator function. That function will determine if a choice is better or not. It is needed because someone might want to optimise for ram usage instead of speed for example, or for another array size. In that example, we are optimizing for speed, and will measure it using ```now()``` from time package. ```python from autotune import autotune, search #let's grab it to demonstate the autotune from algorithm import vectorize #to determine the maximum value of an integer from math.limit import max_finite #to perform benchmarks (mojo also does provide a benchmark function if needed) from time import now #the signature of the function to optimize #(the_function_implementation) alias how_function_look_like = fn()->Int #use another type by making one modification here alias type_to_use = DType.int8 alias simd_width_of_type = simdwidthof[type_to_use]() #optimize for 256 elements alias total_elements = 2**8 #marked with adaptive @adaptive fn the_function_implementation()->Int: # use autotune: all potential values of width to test alias width_to_use = autotune(1, 2, 4, 8, 16, 32, 64 , 128) #allocate total_elements of type_to_use var elements = DTypePointer[type_to_use].alloc(total_elements) @parameter fn vectorization[group_size:Int](base_index:Int): var numbers = elements.simd_load[group_size](base_index) #simd squaring of group_size elements * group_size elements numbers = numbers * numbers elements.simd_store[group_size](base_index,numbers) #note the usage of width_to_use #autotune help to determine the optimal value of it vectorize[width_to_use,vectorization](total_elements) #deallocate elements.free() #just for printing later return width_to_use #the function that gonna help determine what is the optimal choice fn the_performance_evaluator(funcs: Pointer[how_function_look_like], total_candidates: Int) -> Int: #set the best performance(time spent) to the highest value var best_performance:Int = max_finite[DType.int64]().__int__() var best_candidate = 0 print("start searching for best candidate") #loop over all candidate functions for candidate_number in range(total_candidates): #get the candidate function let candidate_function = funcs.load(candidate_number) var width_used = 0 let start = now() #run the function 100000 times for i in range(100000): width_used = candidate_function() let time_it_took = now()-start #if it is better, store the index of the candidate if time_it_took<best_performance: #here check if the width is not too big #because we check for unusable values too in autotune() above #the reason is to be able to test different types if width_used <= simd_width_of_type: best_candidate = candidate_number best_performance = time_it_took #this is the width_to_use used in that benchmark: print("\t width used:",width_used) #how much time to run 100000 times the function print("\t\t benchmark: ",time_it_took) print("search is done") #return the index of the optimal candidate function return best_candidate fn main(): #will store the optimal function based on the benchmark alias most_performant_implementation: how_function_look_like #run the performance evaluator to determine most_performant_implementation search[ how_function_look_like, VariadicList(the_function_implementation.__adaptive_set), the_performance_evaluator -> most_performant_implementation ]() print("") print("let's use the optimal function:") # call the best implementation let width_used = most_performant_implementation() print("\tbest implementation simdwidth is",width_used) #what is the actual maximal width of that type print("") print("max simdwidth of type_to_use is",simd_width_of_type) ``` ## output: ``` start searching for best candidate width used: 1 benchmark: 12326435 width used: 2 benchmark: 15592902 width used: 4 benchmark: 6721930 width used: 8 benchmark: 3742553 width used: 16 benchmark: 3113805 width used: 32 benchmark: 2480954 width used: 64 benchmark: 2342148 width used: 128 benchmark: 2249421 search is done let's use the optimal function: best implementation simdwidth is 32 max simdwidth of type_to_use is 32 ``` ##### *this page is a community effort and may contains errors. please contribute any corrections if needed.* For better examples, the official mojo website is the place to go: - see how [Matmul](https://docs.modular.com/mojo/notebooks/Matmul.html) determine the perfect tile size. --- tutorials/autotuned-parametrized-tests.md --- # 🪄🔮 Autotuned parametrized tests ```Autotune``` is a feature related to ```alias```, aliases are used in parameters ```struct MyType[ParamSimdSize:Int]: ...```, they are used by mojo to provide more expressivity, versatility, safety and performance! Mojo have to process them before the program runs, so they cannot use dynamic values. It seem like a limiting thing, but it is quite the opposite! For example, by specifying a Movable parameter, any movable types can be passed as an argument. &nbsp; ```SIMD``` is a type that can be parametrized over it's ```DTYPE``` and ```SIZE```, A type could be ```uint8```, ```float64```, and many more! The ```SIZE``` could be ```1,2,4,8,16,32,..```. So there are many combination of thoses parameters. This is just an example, aliases can be assigned many things, even pointers, types, floats.. Additionally, it is possible to write usual mojo functions that returns a value, to both aliases and var. &nbsp; # ❤️‍🔥 Autotuning In order to select the values of aliases, auto-tuning can be used to do so by programming in mojo. The idea is to provide a set of valid options, and write some logic. That logic is then followed by mojo, and it will determine wich value should be assigned! And multiple parameters can be autotuned in the same ```@adaptive``` decorated function. Autotune allows to search in that big space and pick the values that are the most desired. &nbsp; # 🌌 The process of evaluation It is a function that receives all the versions of the ```@adaptive``` decorated one, this is where the logic can be written in order to "benchmark" each version. A common way is to measure time 🔥, it is up to the imagination too! For example, each version can be called: ```var f = functions[2](1,MyStruct(1.5))``` The return value can be used, to "score" the performance for example. If the result of that version is "good", the index (```2```) can be saved in a variable. Once "what is best" is determined, either by measuring time or another logic, the index of the final version is retured as an integer: ```return 2```, for example. On the receiving hand, the chosen function is available in an alias for use ! &nbsp; Autotune allow the programmer iterate that "big space" of potential alias values. Here is an example of using autotuning in order to perform tests on a parametrized type ⬇️ &nbsp; # 🧶 Example: Testing with all the possible parameters The algorithmic part of the code is not quite user-friendly, theses operations can be replaced by a simple ones in an easy to understand way. The algorithm itself is simple, only the implementation looks difficult. This is a situation where testing is very usefull, especially testing for all the possible parameters. By having thoses kind of tests, it can be easier to progressively re-implement the algorithm, while having the tests there to check, if it still works like before or not! ```python from autotune import autotune, search @adaptive fn Tests(): alias width_to_use = autotune(1,2,4) alias DT = autotune(DType.uint8,DType.uint16) @parameter if width_to_use > simdwidthof[DT](): ...#print("skip") else: var instance = Small[DT,SIZE=width_to_use]() print("Simd DType:"+ str(DT) + "\twidth:"+ str(width_to_use)) instance.TestsBitSet() print("") fn evaluator(funcs: Pointer[fn()->None], total: Int) -> Int: print("🪄🔮 Autotuned parametrized tests: "+str(total)) for t in range(total): let current = funcs.load(t) current() return 0 fn run_tests(): alias res: fn()->None search[ fn()->None, VariadicList(Tests.__adaptive_set), evaluator -> res ]() def main(): #var x = Small() #x.ArrayBitSet[31](1) #var res:Int = x.ArrayBit[31]() run_tests() @register_passable struct Small[DT:DType=DType.uint8,SIZE:Int=SIMD[DT].size](Stringable): alias StorageType = SIMD[Self.DT,Self.SIZE] alias SizeOfArrayBits = Self.StorageType.size*sizeof[Self.DT]()*8 alias MostSignificantBitPosition = Self.SizeOfArrayBits -1 alias DT_SIZE = sizeof[DT]()*8 var data: Self.StorageType fn __init__()-> Self: return Self{ data: Self.StorageType(0), } fn __str__(self)->String: return "todo" fn ArrayBit[index:Int](self)->Int: alias constrained_ArrayBit_ArrayBit = index < Self.SizeOfArrayBits constrained[constrained_ArrayBit_ArrayBit,"index too big"]() constrained[index>=0,"index < 0"]() alias tmp_index = index//Self.DT_SIZE alias tmp_rem = index%Self.DT_SIZE var tmp = self.data[self.data.size-1-tmp_index] tmp = (tmp&(1<<tmp_rem)) return (tmp>0).cast[DType.bool]().to_int() fn ArrayBitSet[index:Int](inout self,value:Int): alias constrained_ArrayBit_ArrayBit = index < Self.SizeOfArrayBits constrained[constrained_ArrayBit_ArrayBit,"index too big"]() constrained[index>=0,"index < 0"]() alias tmp_index = index//Self.DT_SIZE alias tmp_rem = index%Self.DT_SIZE var b = self.data[self.data.size-1-tmp_index] alias maxval = math.limit.max_finite[Self.DT]() b&= (maxval^((SIMD[Self.DT,1](1)<<(tmp_rem)))) b|=(SIMD[Self.DT,1](value).cast[DType.bool]().cast[Self.DT]()<<tmp_rem) self.data[self.data.size-1-tmp_index] = b fn TestsBitSet(self): alias size_dt = math.bitwidthof[Self.DT]() var tmp_result = SIMD[DType.bool,size_dt*SIZE].splat(False) var instance = Self() @parameter fn more_tests[B:Int](): @parameter fn fn_b[b:Int](): var tmp_ = instance.data instance.ArrayBitSet[B*size_dt+b](1) var result = instance.ArrayBit[B*size_dt+b]() var tmp2_ = instance.data var tmp3 = (math.bit.ctpop(tmp2_)-math.bit.ctpop(tmp_)).reduce_add() tmp_result[B*size_dt+b] = (result) and (tmp3 == 1) unroll[size_dt,fn_b]() unroll[SIZE,more_tests]() print_no_newline("\tSet, unrolled tests(" + str(size_dt*SIZE) + "):") if tmp_result.reduce_and(): print_no_newline("\t✅🔥") else: print_no_newline("\t❌") print_no_newline(instance.data) @parameter fn more_tests_2[B:Int](): @parameter fn fn_c[b:Int](): var tmp_ = instance.data var previous = instance.ArrayBit[B*size_dt+b]() == 1 instance.ArrayBitSet[B*size_dt+b](0) var result = instance.ArrayBit[B*size_dt+b]() var tmp2_ = instance.data var tmp3 = (math.bit.ctpop(tmp_)-math.bit.ctpop(tmp2_)).reduce_add() tmp_result[B*size_dt+b] = previous and (not result) and (tmp3 == 1) unroll[size_dt,fn_c]() unroll[SIZE,more_tests_2]() print("") print_no_newline("\tUnset, unrolled tests(" + str(size_dt*SIZE) + "):") if tmp_result.reduce_and(): print_no_newline("\t✅🔥") else: print_no_newline("\t❌") print_no_newline(instance.data) print("") ``` #### output: ```python 🪄🔮 Autotuned parametrized tests: 6 Simd DType:uint8 width:1 Set, unrolled tests(8): ✅🔥255 Unset, unrolled tests(8): ✅🔥0 Simd DType:uint8 width:2 Set, unrolled tests(16): ✅🔥[255, 255] Unset, unrolled tests(16): ✅🔥[0, 0] Simd DType:uint8 width:4 Set, unrolled tests(32): ✅🔥[255, 255, 255, 255] Unset, unrolled tests(32): ✅🔥[0, 0, 0, 0] Simd DType:uint16 width:2 Set, unrolled tests(32): ✅🔥[65535, 65535] Unset, unrolled tests(32): ✅🔥[0, 0] Simd DType:uint16 width:4 Set, unrolled tests(64): ✅🔥[65535, 65535, 65535, 65535] Unset, unrolled tests(64): ✅🔥[0, 0, 0, 0] Simd DType:uint16 width:1 Set, unrolled tests(16): ✅🔥65535 Unset, unrolled tests(16): ✅🔥0 ``` Theses tests are parametrized by: ```python alias width_to_use = autotune(1,2,4) alias DT = autotune(DType.uint8,DType.uint16) ``` &nbsp; # 🪇 Explanation of the algorithm A ```SIMD``` vector of 16 ```uint8``` is created, for example. There are ```8*16=128``` bits available in total. Let's say that we want to set the bit number ```65``` to ```1```, and use ```65``` as an index. Each time a multiple of ```8``` is passed, the index of the ```uint8``` vector is increased by one! **Until 64 is reached, then the remainder is ```1```.** So the bit to set is the first one of the vector number 8. ```65 modulus 8```, the algorithmic part is that simple, but the implementation looked complicated. Example for position 17: - index 2: ```floor(17.0 / 8.0)``` ➡️ ```17>>3``` - remains 1: ```17%8``` ➡️ ```17&7``` &nbsp; ## 🩳 The ```Constrained``` function > Compile time checks that the condition is true. > see [Documentation: Constrained](https://docs.modular.com/mojo/stdlib/builtin/constrained.html) The index of the position is entered as a parameter, that way it is possible to raise compile time errors! Because the size of the ```SIMD``` was used as a parameter, aswell as the ```type```, thoses safeguards can be implemented! &nbsp; ## 🌗 ```@parameter if``` > see [Documentation: Parametric if statement](https://docs.modular.com/mojo/manual/decorators/parameter.html#parametric-if-statement) It is like an if statement, but the assertion of the outcome is done during the compilation. ```python @parameter if Self.StorageType.size > 2: ... ``` ```Self.StorageType``` is a parameter, if it's size is above ```2```, additional tests can be made! For example, a ```SIMD``` of size```2``` contains only index 0️⃣ and 1️⃣ to be tested, but not above. &nbsp; ## 🌀 ```unroll``` Similar to a while loop, but with parameters. That way, incrementing ```i``` is not required, because mojo just unroll every iteration. The iteration is faster that way! ```python @parameter fn more_tests[B:Int](): @parameter fn fn_b[b:Int](): instance.ArrayBitSet[B*size_dt+b](1) var result = instance.ArrayBit[B*size_dt+b]() tmp_result[B*size_dt+b]=result unroll[size_dt,fn_b]() unroll[SIZE,more_tests]() ``` The equivalent for loop: ```python for B in range(SIZE): for b in range(size_dt): instance.ArrayBitSet[B*size_dt+b](1) var result = instance.ArrayBit[B*size_dt+b]() tmp_result[B*size_dt+b]=result ``` &nbsp; ## ```alias``` They can be passed to parameters, note the reference to ```Self.DT```: ```python struct Small[SIZE:Int=SIMD[DType.uint8].size](Stringable): alias DT = DType.uint8 alias StorageType = SIMD[Self.DT,Self.SIZE] ``` Aliases are compile time constants, they can even receive the result of function! ```python alias size_dt = math.bitwidthof[Self.DT]() ``` The parameters are really powerful, they make it possible to do all thoses expressive things. &nbsp; ## ```@parameter``` functions > see [Documentation: Parametric closure](https://docs.modular.com/mojo/manual/decorators/parameter.html#parametric-closure) ```python fn main(): var x=1 @parameter fn increment[B:Int](): x+=B increment[1]() print(x) ``` Output: ```2``` This is a parametric capturing closure, variables used inside of it can be modified, even if they were declared outside of it. &nbsp; ### 🔥 They can be passed as parameter to other functions ```python fn Incrementor[f:fn()capturing->None](): f() fn main(): var x=1 @parameter fn increment(): x+=1 Incrementor[increment]() print(x) ``` &nbsp; &nbsp; # 🪄 Hope it was usefull ! ✨ ### Thanks to contributors and to people from the chat community for the support 👍 This small tutorial can contains errors, feel free contribute corrections. Make sure to go to the official documentation website of mojo, this is where true magic is learned! --- tutorials/callbacks-trough-parameters.md --- # 🤙 callbacks trough parameters ```python @value struct markdown: var content: String fn __init__(inout self): self.content = "" def render_page[f: def()->object](self,file="none"): self.content = "" f() fn __ior__(inout self,t:String): self.content+=t var md = markdown() def readme(): md |= ''' # hello mojo this is markdown ```python fn main(): print("ok") ``` ''' footer() def footer(): md |= ''' > Page generated ''' def main(): md = markdown() md.render_page[readme](file="README.md") print(md.content) ``` output: # hello mojo this is markdown ```python fn main(): print("ok") ``` > Page generated --- tutorials/calling-mojo-functions-in-python.md --- # 🔥🐍 calling mojo functions from python > with 0.4.0 > ⚠️ not ready for use as it is, not tested and have unfreed pointers Building a wrapper with all thoses features: - [VariadicList](https://docs.modular.com/mojo/stdlib/utils/list.html#variadiclist) for the arguments types - [@noncapturing](https://docs.modular.com/mojo/changelog.html#week-of-2023-04-10) to keep the global scope clean - [import_module](https://docs.modular.com/mojo/stdlib/python/python.html#import_module) - [PythonObject.\_\_getattr\_\_()](https://docs.modular.com/mojo/stdlib/python/object.html#getattr__) - [Parametrized function](https://docs.modular.com/mojo/programming-manual.html#defining-parameterized-types-and-functions) - struct parameter deduction The function is passed to python using a pointer, as an integer. *note: it is memory unsafe, not a feature* #### main.mojo ```python from python import Python fn get_wrapper[fsig:AnyType](ret_type:StringLiteral,f:fsig,*args_types:StringLiteral) raises -> PythonObject: let ctypes = Python.import_module("ctypes") let tmp_ = Pointer[fsig].alloc(1) tmp_.store(0,f) let tmp = (ctypes.CFUNCTYPE(ctypes.c_void_p)).from_address(tmp_.__as_index()) let py_obj_argtypes = PythonObject([]) for i in range(args_types.__len__()): py_obj_argtypes.append(ctypes.__getattr__(args_types[i])) tmp.argtypes = py_obj_argtypes tmp.restype = ctypes.__getattr__(ret_type) #note: tmp_ is never freed return tmp def main(): Python.add_to_path("./") let py_mymodule = Python.import_module("python_custom_package") @noncapturing fn mojo_print(p:Int)->Int: print(p) return p+1 w = get_wrapper("c_int",mojo_print,"c_int") py_mymodule.call_mojo_print(w) @noncapturing fn m_sum(arg:Pointer[Float64],size:Int)->Float64: var total:Float64 = 0.0 for i in range(size): total+=arg.load(i) return total w2 = get_wrapper("c_double",m_sum,"c_void_p","c_int") py_mymodule.call_sum(w2) ``` #### python_custom_package.py ```python import numpy as np def call_mojo_print(mojo_print): res = mojo_print(123) for i in range(10): res = mojo_print(res) def call_sum(sum): elements = 100 array = np.random.random(elements) res = sum(array.ctypes.data,elements) _ = array print(res) #notes: #print(array.dtype) #float64 #print(array.strides) #8 ``` #### Overview: - Create a pointer to the mojo function - Create a PythonObject with ctype imported_module - load the address as a CFUNCTYPE - assign the return type and argument types from variadic list - Pass the PythonObject into python land - Call the PythonObject from there - Pointer is left not freed, *need to be freed* --- tutorials/compile-time-functions.md --- # 🪄 making compile time functions: same as the runtime ones > with v0.4.0 Execute a function at comptime ```python #can be used both during comptime and runtime fn squared(n:Int)->Pointer[Int]: var tmp = Pointer[Int].alloc(n) for i in range(n): tmp.store(i,i*i) return tmp def main(): #alias: during comptime alias n_numbers = 5 alias precaculated = squared(n_numbers) for i in range(n_numbers): print(precaculated.load(i)) precaculated.free() ``` #### what is the code doing Returns a pointer with pre-calculated values during compilation and using it at runtime. #### how to call squared() during runtime By not using alias. ```python # using var instead of alias var precaculated = squared(n_numbers) ``` --- tutorials/env-argv-param_env-for-parameters.md --- # 🦜 env, argv and param_env (for alias) > with v0.5.0 ## Overview ```env```: defined in the os ENV ```argv```: get command-line arguments ```param_env```: for alias, available at compile time ## param_env They are retreived when mojo build the program. So they can be used to do compile-time logic. ```mojo build -D build_message="now faster with simd!" -D simd_width=8 app.mojo``` ```python from sys.param_env import is_defined,env_get_int,env_get_string fn get_width() -> Int: @parameter if is_defined["simd_width"](): if env_get_int["simd_width"]() > simdwidthof[DType.uint8](): # simd_width too big, default to max return simdwidthof[DType.uint8]() else: return env_get_int["simd_width"]() else: return 1 alias simd_width:Int = get_width() #shorter way for default value: alias build_message:StringLiteral = env_get_string["build_message","none"]() fn main(): @parameter if build_message != "none": print("build message:",build_message) var v = SIMD[DType.uint8,simd_width]() print(v) ``` Start the program: ```./app``` Output: build message: now faster with simd! [0, 0, 0, 0, 0, 0, 0, 0] ## env It is not "only a mojo thing", it is widely used by operating systems and apps. ##### Example: ```python from os import getenv fn main(): var k = getenv(name= "ENV_VARIABLE_NAME", default= "none") if k == "none": print("it is default value") return ``` ## args > ⚠️ the example do not include error checking, so don't use it as it is Build the app: ```mojo build app.mojo``` ./app "The number is" 3 ./app "The number is" 4 They are retrieved each time we run the program. ```python from sys import argv fn main() raises: var arguments = argv() let size = len(arguments) var message = arguments[1] #convert to an integer var the_number:Int = atol(arguments[2]) print(message,the_number) ``` --- tutorials/getattr-dynamic-and-static-struct-members.md --- # 🏞️ getattr: dynamic and static struct members > with v0.5.0 ```__getattr__()``` is a feature that makes it possible to design flexible and versatile structs in mojo (like other features too). It feels like merging the static and the dynamic world. Theses features are just there when needed, no obligation to use them all the time! Here is an example, note that ```try:``` and ```except:``` blocks are available in mojo and python! ### my_package.py ```python def method_from_package(): return "Called on package" def package_double_the_value(arg): return arg*2 package_value = 123 ``` ### The struct (in a .mojo or .🔥 file) Let implement one that can refer to both static and dynamic struct members. That way, we can do both "mojo things" and "python things" in a seamless manner. ```python from python import Python @value struct PackageHelper: var my_package: PythonObject var struct_value: Int def __init__(inout self): Python.add_to_path(".") self.my_package = Python.import_module("my_package") self.struct_value = 456 def method_from_struct(self) -> String: return "called on struct" def __getattr__(inout self,name:StringLiteral) ->PythonObject: return self.my_package.__getattr__(name) ``` The ```__getattr__()``` implementation is quite small, but is powerfull: If a struct do not define a requested attribute, it will call that function and pass the name of it. In this implementation, if the attribute is not in the struct, get it from the PythonObject. That way, it is possible to do ```the_struct_ìnstance.anything``` in a dynamic manner. Consider this example for more clarity: - ```struct_instance.method_defined_in_the_struct()``` - It works as usual. - ```struct_instance.method_not_defined_in_the_struct()``` - Let the```__getattr__(self, the_name)``` handle that! ### The main function *(To place just below the mojo struct)* ```python def main(): #create an instance w = PackageHelper() #that attribute is defined in the struct print(w.method_from_struct()) #that attribute comes from the PythonObject print(w.method_from_package()) #that attribute is defined in the struct print(w.struct_value) #that attribute is defined in the PythonObject print(w.package_value) temp_value = PythonObject(1.0) print(w.package_double_the_value(temp_value)) temp_value = 1.5 print(w.package_double_the_value(temp_value)) ``` ### Notes - inside ```def()``` function, ```let``` and ```var``` are optional. - struct can store PythonObject type instances. - implicit type - temp_value = PythonObject(1.0) - temp_value is of PythonObject type - temp_value = 1.5 - instanciated by PythonObject again ```try:``` and ```except:``` blocks can be placed in both ```def()``` and ```fn()``` functions ```__getattr__()``` and ```__setattr()__``` were introduced in [Changelog: Week of 2023-04-03](https://docs.modular.com/mojo/changelog.html#week-of-2023-04-03) --- tutorials/introduction-to-types.md --- # ⌨️ introduction to types > with v0.5.0 ## Declaration of variables ```let```: immutable, constant, cannot be changed ```var```: variable, can re-assign it another value ## Types defined after the semi column```:``` ```python def main(): let x:Int = 1 var y:Int = 1 y = 2 ``` ##### common types: - Int - Float - String - Bool ##### important: - once defined, the type of the variable cannot be changed for another one ## functions ##### passing an argument ```python def PrintNumber(Number:Int): print(Number) ``` ```python def main(): let TheNumber:Int = 1 PrintNumber(TheNumber) ``` ##### returning a value the return type is written after the arrow ```->``` ```python def add(a,b): return a+b def add(a:Int ,b: Int)->Int: return a+b def add(a:Float64 ,b: Float64)->Float64: return a+b ``` ##### default arguments value and named arguments ```python def greet(name:String="learner" ,message: String = "Hello "): print(message+name) ``` ```python def main(): greet() #Hello learner greet(name="") #Hello greet(message="Greetings ") #Greetings learner ``` ##### modify an argument from within a function add ```inout``` before the argument name ```python def increase(inout Number: Int): Number+=1 ``` ```python def main(): var TheNumber:Int = 0 increase(TheNumber) print(TheNumber) # 1 ``` ## Structures The ```@value``` for a short example, it simply adds a few methods for us. They can also be added manually as needed. ```python @value struct Computer: var cores: Int var is_running: Bool var ram_size: Int fn __init__(inout self,cores:Int = 4,state:Bool = False): self.cores = cores self.is_running = state self.ram_size = 1024 fn start(inout self): self.is_running = True print("ram size:", self.ram_size) def ImproveComputer(inout existing:Computer, improved: Computer): existing.cores = improved.cores existing.ram_size = improved.ram_size def main(): var MyComputer = Computer() var NextComputer = Computer(cores=8) NextComputer.ram_size *= 4 ImproveComputer(MyComputer,NextComputer) MyComputer.start() #ram size: 4096 ``` --- tutorials/lists-of-structs-magic-operators-pre-lifetimes.md --- # 🤹 making lists of structs with magic operators (pre-lifetimes) > with v0.5 *note: ⚠️ there could be bugs in the code or errors, please [contribute corrections](/contribute.md)* &nbsp; In mojo for now, there is something called *magic operators* . Theses are used for unsafe references until the day we gonna use lifetimes. There are a lot of conversation on the github repo of mojo about the lifetimes, proposals and a refinement process. More about it can be read on the website of mojo aswell. &nbsp; #### [Roadmap: ownership and lifetimes](https://docs.modular.com/mojo/roadmap.html#ownership-and-lifetimes) for more on lifetimes #### [Documentation: Pointer](https://docs.modular.com/mojo/stdlib/memory/unsafe.html#pointer) the tutorial uses pointers &nbsp; ### ```__get_lvalue_as_address()``` - see [Roadmap: shap edges](https://docs.modular.com/mojo/roadmap.html#sharp-edges) - returns the address of a instance - ``` var x = 1 var pointer = __get_lvalue_as_address(x) __get_address_as_lvalue(pointer)=2 var with_copyinit = __get_address_as_lvalue(pointer) _ = x #extend lifetime ``` ### ```__get_address_as_lvalue()``` - documentation in [Roadmap: shap edges](https://docs.modular.com/mojo/roadmap.html#sharp-edges) - ```__get_address_as_lvalue(address) = other_instance ``` - will call ``` __del__()``` on existing value at the address (cannot contains nothing) - get an copy instance trough ```__copyinit__```: - ```var x = __get_address_as_lvalue(address)``` ### ```__get_address_as_owned_value()``` - introduced in [Week of 2023-04-17](https://docs.modular.com/mojo/changelog.html#week-of-2023-04-17) - return the "original" instance as owned - ```__del()__``` will be called on the "original" instance when last used - require extra attention for proper use! (unsafe) ### ```__get_address_as_uninit_lvalue()``` - introduced in [Week of 2023-04-17](https://docs.modular.com/mojo/changelog.html#week-of-2023-04-17) - act like a placement new - ```__get_address_as_uninit_lvalue(address) = instance``` - address should be allocated - address should not already contain a value - will **not** call ``` __del__()``` on value at the address &nbsp; #### Example: list of struct > ⚠️ this code have not been tested, require more work ```python @value struct a_struct: var x:Int var y:Int struct storage: var data: Pointer[a_struct] fn __init__(inout self,capacity:Int): self.data = self.data.alloc(capacity) fn __moveinit__(inout self,owned other:Self): #see tutorial on moveinit #__del__() will not be called on "other" #with takeinit, __del__() is called on it self.data=other.data fn store(inout self, i:Int,value:a_struct): #placement new on the offset #will not call __del()__ if something was there __get_address_as_uninit_lvalue(self.data.offset(i).address) = value fn get(inout self, i:Int)->a_struct: #returns a __copyinit__() instance, not the original return __get_address_as_lvalue(self.data.offset(i).address) fn replace(inout self, i:Int,value:a_struct): #will call __del__() on the previous value __get_address_as_lvalue(self.data.offset(i).address) = value fn __del__(owned self): # not implemented in the example: placement delete on elements # please contribute solutions, working on it # see __get_address_as_owned_value() # just free() is not enough to have no bugs. self.data.free() def main(): var collection = storage(capacity=2) for i in range(10): collection.store(0,a_struct(0,1)) collection.store(1,a_struct(2,3)) for i in range(2): let res = collection.get(i) print(res.x,res.y) collection.replace(0,a_struct(1,1)) for i in range(2): let res = collection.get(i) print(res.x,res.y) ``` Lifetimes can be manually extended if needed: ``` var x = 1 #unsafe reference code _ = x #extended lifetime ``` see the [ASAP](https://docs.modular.com/mojo/programming-manual.html#behavior-of-destructors). (call del on last use of the instance) > one revision on Nov 6 2023 [contribute corrections](/contribute.md) --- tutorials/make-test-builds-using-a-custom-flag.md --- # 🏳️ make test builds using a custom flag In mojo, it is possible to do it trough programming! For serious testing, the assert functions provided mojo standard library should be used instead. *Note: testing is very important, and that code have not been tested. not ready for use* ```python from sys.param_env import is_defined alias testing = is_defined["testing"]() #let's do colors for fun! @always_inline fn expect[message:StringLiteral ](cond:Bool): if cond: #print in green print(chr(27),end='') print("[42m",end='') else: #print in red print(chr(27),end='') print("[41m",end='') print(message,end='') #reset to default colors print(chr(27),end='') print("[0m") fn main(): @parameter if testing: print("this is a test build, don't use in production") @parameter if testing: expect["math check"](3==(1+2)) #should print "math check in green" ``` ### pass testing "flag": ```mojo build myfile.mojo -D testing``` ```-D customised=1234``` is also possible, see [param_env](https://docs.modular.com/mojo/stdlib/sys/param_env.html) --- tutorials/memory-asap-and-destructor-behaviours.md --- # 🧹 ASAP: will call ```__del__``` when last used > with v0.4.0 ##### *this page is a community effort and may contains errors. please contribute any corrections if needed.* It's wonderfull because mojo free memory as soon as possible. Lifetimes is on the roadmap: [Ownership and Lifetimes](https://docs.modular.com/mojo/roadmap.html#ownership-and-lifetimes). source: [Behavior of destructors](https://docs.modular.com/mojo/programming-manual.html#behavior-of-destructors) ### using that struct as an example: ```python @value struct ValuePointer: var pointer: Pointer[Int] #instantiate def __init__(inout self): #allocate memory self.pointer = Pointer[Int].alloc(1) #store 123 self.pointer.store(0,123) #delete def __del__(owned self): #free memory self.pointer.free() ``` ### the challenge: ```python def main(): var original = ValuePointer() #original is deleted here after last use/access: var copy_of_pointer = original.pointer #copy now point to freed memory print(copy_of_pointer.load(0)) ``` 1. original will get deleted after it's last use, the pointer inside will be freed by our ```__del__``` function. 2. copy_of_pointer now point to freed memory and unknown data is printed ### the solution: ```python def main(): var original = ValuePointer() var copy_of_pointer = original.pointer print(copy_of_pointer.load(0)) #original is deleted here after last use/access: _ = original ``` by assigning original to ```_``` , it's last use will be there. copy_of_pointer no will longer point to freed memory. 123 got printed. --- tutorials/moveinit-copyinit-takeinit.md --- # 🏗️ moveinit 💿💿 copyinit 🐿️ non-destructing move > using v24.0.1 Let's have a look at theses features trough an example, they looks like this : - ```fn __copyinit__(inout self, borrowed original: Self)``` - original is borrowed and cannot be modified - original live separately and can get deleted later in the program - it provides a way to create a copy of an instance - ```fn __moveinit__(inout self, owned original: Self)``` - original is owned, ```__del__``` will never be called on it - original can't be used in the program anymore - **^ transfer suffix** is used to call moveinit - usefull for making sure an instance don't have copies thus is unique ### The illustration: ```python struct my_type: var id:Int fn __init__(inout self,id:Int): self.id=id print("init "+String(self.id)) fn __moveinit__(inout self, owned existing: Self): self.id = existing.id print("moveinit "+ String(self.id)) fn __copyinit__(inout self, existing: Self): self.id = existing.id+1 print('copyinit '+String(+self.id)) fn __del__(owned self): print("del "+String(+self.id)) fn separator(): print("-------------") fn main(): var original = my_type(id=0) #init 0 separator() var copy = original #copyinit 1 separator() var still_original = original^ #moveinit 0 #cannot use original anymore, because moved #var other = original #would produce an error ``` ### Complete output: init 0 ------------- copyinit 1 del 1 ------------- moveinit 0 del 0 *Note: del 0 comes from still_original and not original* &nbsp; ### ```var original = my_type(id=0)``` An instance of my_type is created, it calls ```fn __init__(inout self,id:Int)``` init 0 ### ```var copy = original``` It will call ```fn __copyinit__(inout self, existing: Self)``` We get a copy of it: copyinit 1 del 1 The copy get deleted when it is last used in the code. We dont use it so it later so it gets deleted here. ### ```var still_original = original^``` the **^ transfer suffix** will call ```__moveinit__(inout self, owned existing: Self)``` we moved original to still_original and took original as ```owned```: - ```__del__()``` have never been called on original - del 0 is showed only once - it is showed whend still_original gets deleted &nbsp; ## why moveinit is important and usefull We can make sure that an instance have no copies in the program, when we to pass it to a function, the function could return it: ```python fn from_owned(owned source:my_type)->my_type: #do things return source ``` Or could assign it to an inout argument: ```python fn move_to(owned source:my_type,inout to: my_type): to = source^ #re transfer it #var tmp = source would produce an error #source can't be used anymore here ``` It could also be store inside another struct type passed as inout. ```python fn change_owner(owned some_item:item_type,inout new_owner: owner_type): new_owner.owned_item = some_item^ ``` &nbsp; ### Owned argument does get deleted if not used: ```python fn from_owned(owned arg:my_type): print("not used") ``` ```in that case, we don't re-transfer arg, so arg will be deleted.``` ```__del__()``` is called at the moment of the last use of the instance. &nbsp; # 🐿️ takeinit (non-destructing move) Takeinit has been depreciated with [Changelog: v0.7.0 (2024-01-25)](https://docs.modular.com/mojo/changelog#v070-2024-01-25). **Explanation**: traits got introduced into [Changelog v0.6.0 (2023-12-04)](https://docs.modular.com/mojo/changelog#v060-2023-12-04), It now makes it possible to give the user complete choice on whether a type should implement a "non-destructive move" or not. In consequence, the transfer suffix (```^```) is no longer shared between moveinit and takeinit. This reduce the the probability of a user being confused on wich one will be called. The transfer suffix is now used only with moveinit. Here is an example that illustrate how traits provides a better way to implement the "non-destructing move" ability. ```python trait ValueMovable: fn take_value_of(inout self:Self, inout other: Self): ... struct MyStruct(ValueMovable): var value: String fn take_value_of(inout self:Self, inout other: Self): self.value = other.value other.value = "none" fn __init__(inout self,val:String): self.value=val def main(): var a = MyStruct("the value to take") var b = MyStruct("empty value") b.take_value_of(a) print(a.value) #none print(b.value) #the value to take ``` **B took the value of A**, and A still exist. The value of A had been moved, without destructing A. That operation can be refered to as a "non-destructing move". That is all there is to it! &nbsp; --- tutorials/moving-owned-values.md --- # 🏚️🏗️🏠 Moving ```owned``` values > Updated up to [Changelog v0.6.1 (2023-12-18)](https://docs.modular.com/mojo/changelog.html#v0.6.1-2023-12-18) ⚠️ The small tutorial could contains errors, see documentation on the website and repo of mojo! &nbsp; ### 🟢 Introduction, then an example with many comments and colors 🎨! ```owned``` and ```inout``` are different: If the value passed is **not** owned, it is **not** possible to delete it🗑️, ```MyType.__del__(owned self)``` require the argument passed as owned. If a value is passed as ```inout```, it is possible to assign it a new value ✍: ```MyType.__init__(inout self)```. This is great because the function can modify it, so it is named a mutable reference. Additionally, the function could not free it, wich makes it safer🛡️. Like ```🗑️del```, owned arguments are require to ```🏗️move values```: - ```__del__(owned self)``` - ```__moveinit__(inout self,owned other:Self)``` Once the value got passed```^``` as owned to a function, we can't use it anymore ! Unless the function returns it back or store it somewhere. ```python struct MyType: var value:Int fn __init__(inout self, v:Int): self.value = v fn __moveinit__(inout self, owned other: Self): #🏗️ self.value = other.value var BackupValue:MyType = 0 fn MoveIn(owned v:MyType): print(v.value) v.value = 123456 BackupValue = v^ fn main(): BackupValue = 0 var a:MyType = 123 MoveIn(a^) #print(a.value) # use of uninitialized value 'a' print(BackupValue.value) #✅ 123456 ``` *(Note that global variables need to be initialized)* >⚠️ If the type also implement ```copyinit``` , owned instances of a copy could be passed! &nbsp; ### Here is a small example ```python @value #⚠️ Synthesise also __copyinit__ struct StackOfBricks: var amount:Int fn __moveinit__(inout self,owned other:Self): self.amount = other.amount ``` ```python struct Home(Movable): var bricks:Int #🧱 #🏚️👷🧱 fn __init__(inout self, initialamount:Int=0): self.bricks = initialamount #🏠🏗️🏚️ Move bricks in fn __moveinit__(inout self,owned other:Self): #A_self=B_other^ self.bricks = other.bricks #🏚️🏗️🏠 Move bricks out fn MoveTo(owned self,inout other:Self): other = self^ #Home.__moveinit__(other,self^) #🏠🏗️📈🏗️❔ fn AddOneBrick(owned self)->Self: self.bricks+=1 #ex: var A = Home.increment(A^) #ex: var B = A^.increment() return self^ #🏠🏗️📈🏗️❔ fn AddOneBrickFromStackOfBricks(owned self,inout s:StackOfBricks)->Self: if s.amount > 0: s.amount-=1 #ex: var x:Int = 10 self.bricks+=1 #ex: var A = Home.increment(A^,x) return self^ fn AddAllBricksFromStackOfBricks(inout self,owned other:StackOfBricks): self.bricks += other.amount # other is not used after, automatically __del__() here. #_ = other^ # manually #similar to: StackOfBricks.__del__(other^) manually fn AddBricksFrom(inout self,inout other:Self,amount: Int): if amount<= other.bricks: self.bricks+=amount other.bricks -= amount #🏠🏗️🗑️ fn __del__(owned self): #Home.__del__(A^) #ex: self.somepointer.free() ... ``` ```python #🏠🏗️📈🏗️❔ fn AddBrick(owned arg:Home)->Home: arg.bricks+=1 return arg^ #➡️🏗️ fn main(): var location_a = Home(initialamount=10) #🟦 var location_b = Home(initialamount=0) #🟨 print(location_a.bricks) #🟦1️⃣0️⃣ print(location_b.bricks) #🟨0️⃣ location_b = location_a^ #🟦➡️🏗️🟨 print(location_b.bricks) #🟨1️⃣0️⃣ #print(location_a.bricks) #🟦❌✋ use of uninitialized value 'location_a' #🟨🏠 #1️⃣0️⃣ #🟦🏚️ #__del__() been called on it location_b = AddBrick(location_b^) #🟨🏗️📈🏗️🟨 print(location_b.bricks) #🟨1️⃣1️⃣ location_a = Home(0) #🟦0️⃣ var BrickStack = StackOfBricks(4) #🧱4️⃣ #Bricks stack argument is inout: location_a = location_a^.AddOneBrickFromStackOfBricks(BrickStack) print(location_a.bricks) #🟦1️⃣ print(BrickStack.amount) #🧱3️⃣ #Bricks stack argument is owned: location_a.AddAllBricksFromStackOfBricks(BrickStack^) print(location_a.bricks) #🟦4️⃣ #print(BrickStack.amount) #🧱❌✋ use of uninitialized value 'BrickStack' location_a^.MoveTo(location_b) #🟦➡️🏗️🟨 print(location_b.bricks) #🟨4️⃣ #print(location_a.bricks) #🟦❌✋ location_a = Home(0) #🟦0️⃣ location_b = Home(10) #🟨1️⃣0️⃣ #location a and b are inout argument: location_a.AddBricksFrom(location_b,5) location_a.AddBricksFrom(location_b,1) #inout arguments are not moved, only owned ones print(location_a.bricks) #🟦6️⃣ print(location_b.bricks) #🟨4️⃣ location_b.AddBricksFrom(location_a,6) print(location_a.bricks) #🟦0️⃣ print(location_b.bricks) #🟨1️⃣0️⃣ var BrickStackOne = StackOfBricks(30)#🧱🔵3️⃣0️⃣ var BrickStackTwo = StackOfBricks(20)#🧱🟡2️⃣0️⃣ var BigStackOfBrick = JoinBrickStacks(BrickStackOne^,BrickStackTwo^) print(BigStackOfBrick.amount) #🧱🟢5️⃣0️⃣ #print(BrickStackOne.amount) #🧱🔵❌✋ #print(BrickStackTwo.amount) #🧱🟡❌✋ _ = BigStackOfBrick # ⚠️ will not delete it # @value generate __copyinit()__ # so it will delete a copy # Successful with the ^ suffix BigStackOfBrick^.__del__() #similar to: # _ = BigStackOfBrick^ # StackOfBricks.__del__(BigStackOfBrick^) #print(BigStackOfBrick.amount) #🧱🟢❌✋ #The ^suffix allow to treat the value as owned! # 🏗️ Movable trait (see 🔸function below): var Val_C = StackOfBricks(10) var Val_D = StackOfBricks(0) MoveTo(Val_C^,Val_D) #StackOfBricks also implement __moveinit__() (@value also make it!) Val_C = StackOfBricks(10) #T is passed explicitely, but mojo can deduce it(see above) MoveTo[StackOfBricks](Val_C^,Val_D) #🔸 fn MoveTo[T:Movable](owned a:T,inout b:T): #The Movable trait means the type passed implement __moveinit__() #similar to: T.__moveinit__(b,a^) b=a^ fn JoinBrickStacks(owned a:StackOfBricks, owned b:StackOfBricks) -> StackOfBricks: var total = a.amount + b.amount return StackOfBricks(total) ``` ### 🎉 That is how to move```^``` owned values! &nbsp; > ⚠️ *Could contains errors, make sure to see mojo repo or documentation website for better materials* ### Thanks to contributors, hope it is helpfull ❤️‍🔥 --- tutorials/multi-core-parallelize-with-simd .md --- # 🛣️ 🚌 multi-core (parallelize) with simd ### 🪮 parallel without simd ```python from algorithm import parallelize fn main(): @parameter fn compute_number(x:Int): print(x*x) var stop_at = 16 var cores = 4 #start at 0, end at stop_at (non inclusive) parallelize[compute_number](stop_at,cores) ``` # 🚍 simd To use an analogy, thanks to @PriNova for the inspiration, simd can be thought of as autobuses filled with numbers, with only one instruction, we can calculate the entire autobus. (in the same amount of time it would have taken to calculate a single number in a non-simd way) how much numbers can fit in one autobus depend on the type. (can fit more small types) ```python import math fn main(): var numbers = SIMD[DType.uint8,8]() # simd instructions: # a. fill them whith numbers from 0 to 7 numbers = math.iota[DType.uint8,8](0) # b. x*x for each numbers numbers*=numbers print(numbers) #[0, 1, 4, 9, 16, 25, 36, 49] ``` # 🚍 🚍 🛣️ simd in parallel it is like 4 autobus advancing on 4 seperate highway lanes toward a destination. they reach destination more or less at the same time and in the same amount of time it would have taken with only one autobus in a single highway lane. (single core, non multi-core) ```python from algorithm import parallelize from memory.unsafe import DTypePointer from sys.info import simdwidthof import math fn main(): # how much highway lanes var computer_cores = 4 alias element_type = DType.int32 #how much numbers in the autobus: alias group_size = simdwidthof[element_type]() #how much autobus needs to travel: alias groups = 16 #initialized array of numbers with random values var array = DTypePointer[element_type]().alloc(groups*group_size) @parameter fn compute_number(x:Int): # one autobus: var numbers: SIMD[element_type,group_size] # 3 simd instructions: numbers = math.iota[element_type,group_size](x*group_size) numbers *= numbers array.simd_store[group_size](x*group_size,numbers) # open the highway parallelize[compute_number](groups,computer_cores) # parallelize will call compute_number with argument # x= 0,1,2...groups (non-inclusive) for i in range(groups*group_size): var result = array.load(i) print("Index:" , i, " = ",result) array.free() ``` ### [math.iota](https://docs.modular.com/mojo/stdlib/math/math.html#iota) fills an array with incrementing numbers. ### DTypePointer: *simd_store* With an array of 256 elements: set the first 8 elements: - ```array.simd_store[DType.float32,8](0,simd_array_of_8_values)``` set the second 8 elements: - ```array.simd_store[DType.float32,8](8,simd_array_of_8_values)``` set the third 8 elements: - ```array.simd_store[DType.float32,8](16,simd_array_of_8_values)``` > note: the offset argument is a **multiple of 8** when storing by groups of 8. --- tutorials/numpy-simd.md --- # simd cosine with np.linspace The simd part need revision, it is not good practice. update soon! ```python from python import Python from python import PythonObject from math import math struct np_loader: #Python.import_module("numpy") returns a PythonObject var lib:PythonObject var loaded: Bool fn __init__(inout self): try: #let see if an error is produced self.lib = Python.import_module("numpy") self.loaded = True except e: #if there was an error,don't crash, do this self.loaded = False #np["linspace"], "linspace" is the key, a StringLiteral fn __getitem__(inout self, key:StringLiteral)raises->PythonObject: #get the attribute "linspace" from the python object, and return it return self.lib.__getattr__(key) fn main() raises: #get numpy from python var np = np_loader() #make sure there was no errors if np.loaded: #get the linspace function from python and call it var python_result = np["linspace"](0, 255,256) #prepare a simd array of 256 elements var simd_mojo_array = SIMD[DType.float64,256]() # python returns PythonObject therefore they sometimes require # conversion to mojo types in order to use some functions var pi = np["pi"].to_float64() #convert array size to mojo int var size:Int=python_result.size.to_float64().to_int() #mojo provide range just like python, that one is a mojo one for x in range(size): #from python float object to mojo float simd_mojo_array[x]=python_result[x].to_float64() #perform the simd cos operation simd_mojo_array = math.cos(simd_mojo_array*(pi*2.0/256.0)) print(simd_mojo_array) ``` --- tutorials/parameters-alias-struct-parameter-deduction.md --- # 🧬 Parameters, Alias, Struct parameter deduction, more > with v0.5.0 ⚠️ Some examples are "minimal and simple", no safe checks are done. It is to better illustrate concepts and not clutter the mind, make sure follow good practices and safe coding in your implementations. Let's learn how to parametrize! # Start of the tutorial > Parameters are compile-time values. That example also covers "Struct parameters deduction". It is very usefull, try to practice playing with it in order to remember and understand it. Notice how the deduction "works its way" up the struct and fill the blanks. It feels like the arguments types defines the parameters of the struct, and not the other way around. Increased productivity, less screen space used, less repetitive coding: ```python @value struct Point3D[XT:AnyType,YT:AnyType,ZT:AnyType]: var x:XT var y:YT var z:ZT fn __init__(inout self, x:XT ,y:YT,z:ZT): self.x = x self.y = y self.z = z # 4️⃣. use parameters of an argument inside the function signature: fn to_list_literal(arg:Point3D)-> ListLiteral[arg.XT,arg.YT,arg.ZT]: return ListLiteral(arg.x,arg.y,arg.z) fn main(): #1️⃣ Explicit struct parameters: var my_point_d = Point3D[Int64,Int64,Int64](1,2,3) var my_point_e = Point3D[Int64,Float64,Int64](1,2.5,3) #2️⃣ Struct parameters deduction #XT, YT, ZT deduced from argument passed: var my_point_a = Point3D(1, 2, 3) #Int64, Int64, Int64 var my_point_b = Point3D(1.0, 2.0, 3.0) #Float64, Float64, Float64 var my_point_c = Point3D(1, 2.5, 3) #Int64, Float64, Int64 #3️⃣ Re-use the parameters of an instance of Point3D var some:my_point_c.YT = 1.0 #my_point_c.YT is a type (Float64) print(to_list_literal(my_point_a)) # [1, 2, 3] print(to_list_literal(my_point_c)) # [1, 2.5, 3] ``` #### see [Changelog: v0.5.0-2023-11-2](https://docs.modular.com/mojo/changelog.html#v0.5.0-2023-11-2) - Function argument input parameters can now be referenced within the signature of the function - Mojo now supports struct parameter deduction --- ### Automatic parameterization of functions see [Documentation](https://docs.modular.com/mojo/programming-manual.html?q=parameter#automatic-parameterization-of-functions) Our ```take_dynamic_vector()``` don't take parameters for arg, but DynamicVector is parametric. The long form version could look like this: ```python fn take_dynamic_vector[T:AnyType](arg:DynamicVector[T]) -> T: ``` Mojo will create theses for us in order to be more productive. It is important to be aware of it in order to understand the language. ```python fn take_dynamic_vector(arg:DynamicVector) -> arg.type: let tmp: arg.type = arg[0] #first element of vector return tmp fn main(): var tmp_a = DynamicVector[Int64]() var tmp_b = DynamicVector[Float64]() var tmp_c = DynamicVector[Bool]() tmp_a.push_back(1) tmp_b.push_back(1.5) tmp_c.push_back(True) let a:Int64 = take_dynamic_vector(tmp_a) let b = take_dynamic_vector(tmp_b) print(a,b) #parameters are known at compile time #type is a parameter of DynamicVector let d:tmp_c.type = False #tmp_c.type == Bool let e = take_dynamic_vector(tmp_c) print(d==e) ``` --- ### "Pulling" parameters when needed: Note that we refer to the parameter of arg, inside the function signature itself. ```python fn simd_to_dtype_pointer(arg:SIMD)->DTypePointer[arg.type]: var tmp = DTypePointer[arg.type].alloc(arg.size) # just to demonstrate unroll, # simd_store is probably way faster: @unroll for i in range(arg.size): tmp.store(i,arg[i]) return tmp fn simd_to_static_tuple(arg:SIMD)->StaticTuple[arg.size,SIMD[arg.type,1]]: var tmp = StaticTuple[arg.size,SIMD[arg.type,1]]() #Can be unrolled, because arg.size is known at compile time. #Parameters of simd: SIMD[TYPE,SIZE] @unroll for i in range(arg.size): tmp[i]=arg[i] return tmp ``` see [Changelog: july-2023](https://docs.modular.com/mojo/changelog.html#july-2023) for more on ```@unroll``` Compiler time constant value (alias or parameters for example) is required to unroll a loop. --- ### Capture dynamic value in function and pass it as a parameter It is unsafe for now (v0.5), until model the lifetime of captured value by reference. see [Documentation: parameter decorator](https://docs.modular.com/mojo/programming-manual.html#parameter-decorator) Here is an introduction in order to get familiar with it: ```python fn take_parameter[f: fn() capturing -> Int](): let val = f() print(val) fn main(): #will be captured as a reference var val = 0 @parameter fn closure()->Int: return val #captured here for i in range(5): val = i take_parameter[closure]() _ = val #extend lifetime manually #if not extended, would be cleaned at last use. ``` --- ### Compile time if statement It is an if statement that runs at compile time. The benefit is that only the live branch is included into the final program. see [Documentation: parameter if](https://docs.modular.com/mojo/programming-manual.html#parameterization-compile-time-metaprogramming) ```python alias use_simd:Bool = SIMD[DType.uint8].size > 1 fn main(): @parameter if use_simd == True: print("This build uses simd") else: print("This build do not uses simd") ``` A traditional if statement that run at runtime is executed each time. That one is executed only one time during the compilation. What is inside the block of the if statement is included in the program if condition is met. It introduce a form of conditional compilation. Note that any "compile-time ready" function can be used in the if statement. --- ### alias For compile time constants, they can be passed as parameters because they are compile-time known. ```python fn main(): alias size = 4 alias DT = DType.uint8 var value = SIMD[DT,size](0) print(value.size==size) #create an alias to the print_no_newline function alias say = print_no_newline say("hello world") ``` They can also be used "like define in C" ```python alias TYPE_OF_INT = Int64 fn get_vector()->DynamicVector[TYPE_OF_INT]: return DynamicVector[TYPE_OF_INT]() fn my_add(a:TYPE_OF_INT,b:TYPE_OF_INT)->TYPE_OF_INT: return a+b ``` Because an alias is "compile-time", it can store the result of a compile time computation: ```python fn squared(a:Int) -> Int: return a*a fn main(): alias pre_calculated_during_compilation = squared(3) var calculated_during_runtime = squared(3) print(pre_calculated_during_compilation) #9 alias squared_again_during_compilation = squared(pre_calculated_during_compilation) print(squared_again_during_compilation) #81 ``` At compile time, it is possible to allocate heap memory and materialize it for runtime use. See [Changelog: august-2023](https://docs.modular.com/mojo/changelog.html#august-2023) ```python fn get_squared[stop_at:Int=10]() -> DynamicVector[Int]: var tmp = DynamicVector[Int]() for i in range(stop_at): tmp.push_back(i*i) return tmp fn main(): alias the_compile_time_vector = get_vector[stop_at=100]() var materialized_for_runtime_use = the_compile_time_vector ``` --- #### Parameter default value and keyword Parameters can have default values and be refered by keyword. The ones that have default values need to be defined after the ones that don't (order). - ```example[no_default:Int, got_default:Int=1]``` ```python fn get_vector[VT:AnyType = Int64]()->DynamicVector[VT]: return DynamicVector[VT]() fn main(): var vec = get_vector() vec.push_back(1) var vec2 = get_vector[VT=Int32]() vec2.push_back(1) ``` --- ### Overloading: same name, different types. Overloading can be done on parameters and functions/methods. ```python fn take_arg[arg:Float64](): print("float64", arg) fn take_arg[arg:Int64](): print("Int64", arg) fn main(): alias a:Float64 = 1.0 alias b:Int64 = 1 take_arg[a]() take_arg[b]() ``` See: - [Documentation: overloading on parameters](https://docs.modular.com/mojo/programming-manual.html#overloading-on-parameters) - [Documentation: overloading methods and functions](https://docs.modular.com/mojo/programming-manual.html#overloaded-functions-and-methods) --- &nbsp; This is a work in progress and will get improved and expanded, [Corrections and contribution](/contribute.md)! --- tutorials/parametric-struct-trough-cpu-registers.md --- # 🏃 (SPEED) Parametric struct through CPU registers. > with v24.1.0 Some types are store in the ram. each time we access the ram it takes time. The reason for accessing the ram is to retrieve a value, or change it, even makes a copy of it (example: pointers). Ram is slow compared to cpu registers. (just like storage hard-drive is slower than ram). The speed to access a CPU register vs RAM is significantly higher, let's make a struct that is passed trough cpu-register for higher speed! An example of such type is an Integer, but mojo pave the way for designing way more sophisticated types! Let's implement a naive parametric Tuple type that can be passed trough registers. Note: mojo comes with builtin register passables Tuple types already. # Naive tuple passed trough registers ```python @register_passable("trivial") struct naive_register_tuple[T_FIRST:AnyRegType,T_SECOND:AnyRegType]: var first:T_FIRST var second:T_SECOND fn __init__(inout self, arg_one:T_FIRST,arg_two:T_SECOND): self.first = arg_one self.second= arg_two fn mutate_first(inout self,val:T_FIRST): self.first = val fn mutate_second(inout self,val:T_SECOND): self.second = val fn main(): #explicitely specify the types: var tmp = naive_register_tuple[Bool,Bool](True,True) #with struct parameter deduction: var val = naive_register_tuple(True,1) #mutate first value: val.mutate_first(False) #get the type from the parameters: var my_vec = DynamicVector[val.T_FIRST]() my_vec.push_back(val.first) #get a copy: var val2 = val #get fields individually let val_first = val2.first let val_second:val2.T_SECOND = val2.second ``` Many methods could be implemented on top of a register_passable struct. This is great for meta-programming and productive/creative implementations. Examples: - ```__getitem__``` to create a ```value[index]``` type of access - ```__add__``` to perform ```new_value = value_a+value_b``` - many more ### AnyRegType > It represent any register-passable mojo data type. When making a register-passable struct, the types of the members must be register-passable aswel. This is why the struct made in the above example are parametrized: ```python struct naive_register_tuple[T_FIRST:AnyRegType,T_SECOND:AnyRegType]: var first:T_FIRST var second:T_SECOND ``` ### trivial It means that we can get a copy of a value and that we can move it. There is no need to implement thoses methods. (```copyinit```, ```moveinit```, ```takeinit```, ```del```) Think about it, theses are just "sequences of bytes" that can be copied as they are from one register to another. A way to think about thoses is in term of "bags of bits" (see mojo documentation). > Note: that decorator is subject to reconsiderations see [Documentation: trivial types](https://docs.modular.com/mojo/programming-manual.html#trivial-types) # A new tool in the 🧰 ! One clear benefit is the speed. Another significant benefit is that it creates the opportunity to design/implement new/different types. Theses will becomes more popular as mojo evolve and people start to create hardware specific types. It also **reconcile performance and user-friendlyness** in a significant manner . --- &nbsp; See [Contributions](/contribute.md) for ideas, drafts, tutorials, corrections. --- tutorials/python-world-mojo-world.md --- # 🔁 Python land and mojo land, PythonObject [PythonObject](https://docs.modular.com/mojo/stdlib/python/object.html) is a mojo type that can store python objects of any python class (int, list,ndarray..) - can "travel" trough **mojo functions**, as a PythonObject, but can also be passed to **python functions**, as a PythonObject. - can go back and forth between thoses two worlds. - is understood both by python and mojo ### mojo->python ```python var the_number:Int = 1 var the_py_object = PythonObject(the_number) ``` the_number is a mojo [Int](https://docs.modular.com/mojo/stdlib/builtin/int.html), it is automatically converted to Python object by the method ```__init__(inout self: Self, integer: Int)``` of PythonObject. ### python->mojo ```python the_number = the_py_object.__index__() ``` ```__index__()``` is a method of [PythonObject](https://docs.modular.com/mojo/stdlib/python/object.html) ```to_float64()``` is another one. ### calling python functions ```python var the_python_list = PythonObject([]) ``` The PythonObject is initialized from an empty mojo [ListLiteral]( https://docs.modular.com/mojo/stdlib/builtin/builtin_list.html) by ```__init__[*Ts: AnyType](inout self: Self, value: ListLiteral[Ts])``` the_python_list is now a PythonObject of class list. ```python the_python_list.append(123) ``` **append is not a method of PythonObject** - append is a python method of the list class. - the_python_list is a PythonObject of the list class - append is in python land and mojo can find it inside the python object and call it! ### the ability to import and use any created python file or "pip" package: ```python from python import Python var my_python_file = Python.import_module("my_python_file_name") #no .py needed my_python_file.my_function([1,2,3]) #mojo will find my_function ``` [import_module](https://docs.modular.com/mojo/stdlib/python/python.html#import_module) return a PythonObject # Example with many comments: ```python from python import Python from python import PythonObject fn plot_from_mojo(values: PythonObject) raises: #require matplotlib package to be installed let plt = Python.import_module("matplotlib.pyplot") plt.plot(values) #theses values comes from numpy #that python object class is ndarray: #print(values.__class__.__name__) plt.show() fn numpy_array_from_mojo() raises -> PythonObject: let np = Python.import_module("numpy") #np is a PythonObject #let np:PythonObject... #import_module returns a PythonObject var x = PythonObject([]) #x: PythonObject, class: list #initialized from an empty list literal https://docs.modular.com/mojo/stdlib/builtin/builtin_list.html #note that [] is a mojo type! (ListLiteral) var range_size:Int = 256 #Mojo Int! https://docs.modular.com/mojo/stdlib/builtin/int.html #mojo have ranges too, that one is a mojo one https://docs.modular.com/mojo/stdlib/builtin/range.html for i in range(range_size): #i is a mojo Int #append is a python function, mojo find it inside the PythonObject x.append(i) #i get converted to a python object trough the __init__ function of PythonObject return np.cos(np.array(x)*np.pi*2.0/256.0) #np.cos return a python object of class ndarray def main(): #numpy_array_from_mojo is a mojo function that return a PythonObject. var results = numpy_array_from_mojo() #plot_from_mojo is a mojo function that takes a PythonObject. plot_from_mojo(results) ``` --- tutorials/reader-in-few-lines-with-endian-ness.md --- # 🕯️ [reader.read\[Int32,"swap"\](3) in 45 lines]() > with mojo v0.4.0 Theses mojo features are used: - [alias](https://docs.modular.com/mojo/programming-manual.html#alias-named-parameter-expressions) - [bitcasted](https://docs.modular.com/mojo/stdlib/memory/unsafe.html#bitcast) pointer to generic T - [generic struct](https://docs.modular.com/mojo/programming-manual.html#defining-parameterized-types-and-functions) ([T] is a parameter) - [@parameter if](https://docs.modular.com/mojo/programming-manual.html#powerful-compile-time-programming) - [parameter with a default value](https://docs.modular.com/mojo/programming-manual.html#using-default-parameter-values) - [extend lifetime](https://docs.modular.com/mojo/programming-manual.html#field-lifetimes-of-owned-arguments-in-__moveinit__-and-__del__) with _ = pointer - [Raising errors: dynamic messages](https://docs.modular.com/mojo/changelog.html#v0.4.0-2023-10-05) - [sizeof\[T\]()](https://docs.modular.com/mojo/stdlib/sys/info.html#sizeof) - [raising errors](https://docs.modular.com/mojo/stdlib/builtin/error.html) It is nice to see how they work together. *note: how productive and user friendly 🔥 is* > ⚠️ the code has not been tested, not ready for use ```python def main(): var reader = file_reader("data_from_ruby") #return a Pointer to four Uint32 let LE_ui32 = reader.read[UInt32](4) for i in range(4): print(LE_ui32.load(i)) #two Float32, converted from another endian-ness let BE_f32 = reader.read[Float32,"swap"](2) print(BE_f32.load(0)) print(BE_f32.load(1)) #free the pointers LE_ui32.free() BE_f32.free() #move the reader cursor back four bytes reader.offset -=4 #Float32 (not pointer), converted from another endian-ness print(reader.read_one[Float32,"swap"]()) ``` ```python from sys.info import sizeof struct file_reader: var data:DTypePointer[DType.uint8] var size: Int var offset:Int fn __init__(inout self,filename:String) raises: #open the file var handler = open(filename,"r") #pointer with no allocation done: self.data = DTypePointer[DType.uint8]() self.size = 0 self.offset = 0 #read the file into tmp let tmp = handler.read() self.size = tmp._buffer.size self.data = self.data.alloc(self.size) #interpret the bytes as uint8 when .load(index) let tmp_ptr = tmp._as_ptr().bitcast[DType.uint8]() #copy the content of tmp into self.data for i in range(self.size): self.data.store(i,tmp_ptr.load(i)) _=tmp #extending the lifetime to more than tmp_ptr #if dont do, tmp will be freed when last used #and tmp_ptr will point to freed memory #close the file handler.close() fn read_one[T:AnyType,endian:StringLiteral= "not_swap"](inout self) raises->T: let tmp = self.read[T,endian](1) let tmp2:T = tmp.load(0) tmp.free() return tmp2 #"be" is default if no value is passed fn read[T:AnyType,endian:StringLiteral= "not_swap"](inout self,e: Int = 1) raises->Pointer[T]: #size of T in bytes multiplied by elements let fsize = e*sizeof[T]() if (self.offset+fsize)>self.size: raise Error("file is not that big") let tmp = Pointer[UInt8]().alloc(fsize) for i in range(fsize): tmp.store(i,self.data.load(i+self.offset)) self.offset+=fsize #swapping the bytes if specified: @parameter #"not_swap" is the default parameter value! if endian == "swap": alias sizeoft=sizeof[T]() let tmp_for_swap = Pointer[UInt8]().alloc(sizeoft) for i in range(0,fsize,sizeoft): for i2 in range(0,sizeoft): tmp_for_swap.store(i2,tmp.load(i+i2)) for i2 in range(0,sizeoft): tmp.store(i+i2,tmp_for_swap.load(sizeoft-1-i2)) tmp_for_swap.free() #Pointer[UInt8] to Pointer[T] #does not modify the data, just provide "a viewer" return tmp.bitcast[T]() #when instance of file_reader is deleted fn __del__(owned self): #free memory self.data.free() ``` ```ruby # ruby code to generate data File.write("name.extension",[1,2,3,4,1.1,2.5].pack("l<4g2")) ``` --- tutorials/simd-is-a-type-with-methods-and-operators.md --- # `SIMD` is a type, with `methods` and `operators` ! In mojo, `SIMD` vectors are first-class citizens. For example, `Int64` is a `SIMD` vector of size 1. (`SIMD[DType.int64, 1]`) &nbsp; The `SIMD` type has `Methods` aswel as `operators`. &nbsp; #### Examples: ```mojo print( 4 * SIMD[DType.int8,4](1,2,3,4) ) ``` > [4, 8, 12, 16] &nbsp; ```mojo print( SIMD[DType.int32,4](1,1,2,2).reduce_add() ) ``` > 6 &nbsp; ```mojo print( SIMD[DType.bool,4](True,False,True,False).reduce_and() ) ``` > false &nbsp; The multiply `operator` (`*`) works in an unifying manner, with both `SIMD` vectors of size `1` and size `32`. &nbsp; So learning `SIMD` is just like learning an arbitraty `class` / `type`. It has the `__add__` dunder, `__init__` and many more `methods`. &nbsp; &nbsp; &nbsp; &nbsp; # `SIMD` on the `Stack` ```mojo var x = SIMD[DType.float64,2](1.5, 2.5) var y = x.reduce_add() print(y) ``` `y` is a `Float64`. (`SIMD[DType.float64, 1]`) &nbsp; There is already a small tutorial for it: - [SIMD: 🔢✖️2️⃣🟰❪2️⃣,4️⃣,6️⃣,8️⃣❫](./simd.md) &nbsp; # `SIMD` on the `Heap` Let's take for example a pointer to `10` * `Int64`. Instead of iterating each elements to add them together, It is also possible to do a fast addition with `SIMD` ! &nbsp; ### Preparing a `DTypePointer` It is like a pointer, but is more specialized for `SIMD`. We'll use `alloc`, we'll have to `free`. ```mojo def main(): alias amount_of_bytes = 256 var mem = DTypePointer[DType.uint8].alloc(amount_of_bytes) for i in range(amount_of_bytes): mem[i] = i #slower but good first step ! ``` &nbsp; #### Second step: `SIMD` vector Let's load the first 8 elements ```mojo var bunch_of_bytes = SIMD[type=DType.uint8, size=8].load(mem) print(bunch_of_bytes) ``` > [0, 1, 2, 3, 4, 5, 6, 7] The data is now in a `SIMD` vector. Let's not `free` yet, and learn more. &nbsp; ### Stride and width width is the size of the `SIMD` vector. `stride` can be used with `offset`. 0◄─────┐ 1 │ 2◄─────┤ 3 │ Stride: 2 4◄─────┤ Width: 4 5 │ 6◄─────┤ 7 │ │ ▼ [0,2,4,6] SIMD[Width:4] &nbsp; #### A. The concept ```mojo var stride_like = 2 for i in range(0,8,stride_like): print(i) ``` > 0, 2, 4, 6 #### B. The SIMD stride ```mojo var separated_by_2 = mem.simd_strided_load[width = 8]( stride = 2 ) print(separated_by_2) ``` > [0, 2, 4, 6, 8, 10, 12, 14] &nbsp; Let's not `free` yet, and learn more! &nbsp; ### `gather` It gathers the values stored at various positions into a `SIMD` vector. ```mojo for i in range(16): mem[i] = i*i print( mem.gather( SIMD[DType.int64,4](1, 2, 5, 6) ) ) ``` > [1, 4, 25, 36] &nbsp; Here is the `gather` `method` of `DTypePointer` in a visual form: Memory: 0 10 20 30 40 50 │ │ │ │ └─────┬─┴──┴──┘ Gather 0 │ 3 4 5 ▼ [0,30,40,50] &nbsp; &nbsp; ### `scatter` It assign new values to various positions. The values are provided in a `SIMD` vector. The positions aswel, but theses are `int64`. ```mojo mem.scatter( offset = SIMD[DType.int64, 2](1,10), val = SIMD[DType.uint8, 2](0, 0) ) print(mem[1]) print(mem[10]) ``` > 0 > 0 &nbsp; Here is the `scatter` `method` of `DTypePointer` in a visual form: Memory: 0 10 20 30 40 50 ▲ ▲ │ │ │ │ ┌──┴─────┘ │ 0 2 Indexes │ 100 200 Values scatter > Memory: 100, 10, 200, 30, 40, 50 &nbsp; &nbsp; # ♻️ `free` It is a `method` of `DTypePointer`. `alloc` gave us some `RAM` for the program, `free` gives it back: ```mojo mem.free() ``` Very easy to use: ┌──────────────────────┐ │ RAM │ ├──┐ │ └┼─┴───────────────────┘ │ │ ▼ alloc ┌──┐ └──┘ our program has to give the small amount of ram back because another program might need it ! &nbsp; `free` and `alloc` `alloc` and `free` It is a recycling thing! &nbsp; Note that mojo have `Reference` to help ! &nbsp; # math There is a `math` module with functions that works with `SIMD`. Theses are functions like `cos`, `floor`, `iota`, and many more. Here is a link to the documentation: - [Documentation: math](https://docs.modular.com/mojo/stdlib/math/math) &nbsp; # 🎉 End of small tutorial Hope you enjoyed it, `SIMD` is easy and it has many more `methods`. Many people do `AI` with because it is really fast, but it is good for making music too ! &nbsp; You don't have to use `SIMD` all the time, but it is there if one day the program become too slow, for example. Because `Int64` is a vector of size `1`, only a few changes can turn the program into `SIMD` fast! &nbsp; Note: on most computers, a vector can be as much as `32` bytes. It works well as a small buffer without alloc! --- tutorials/simd.md --- # ```SIMD```: 🔢✖️2️⃣🟰❪2️⃣,4️⃣,6️⃣,8️⃣❫ It is to perform the same operation on multiple numbers. &nbsp; ### ```S.I.M.D``` is like a small array But it has a maximum size, depending on the computer and the type. It stands for single instruction, multiple data: ```SIMD``` can perform ```math.cos``` on multiple numbers for example. It is a lot faster and smaller than an array, so the iteration is usually done by taking ```32``` elements at a time, for example. Here is a ```SIMD``` that has 8 elements of type ```DType.float32```: ```python var x = SIMD[DType.float32,8]() for i in range(8): x[i]=i print(x) #[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ``` The size chosen is 8, but it can be much larger. By default, the SIMD will use the ```maximum size``` (```width```) that permit the computer: ```python print(simdwidthof[DType.float32]()) #8, depend on the computer print(simdwidthof[DType.uint8]()) #32, depend on the computer ``` ℹ️ Note: sizes and types are parameters &nbsp; ### 🔢🔨 Single instruction: multiple data This is why ```SIMD``` is fast, it can perform an operation on many numbers "at the same time". ```python #previously defined: var x = SIMD[DType.float32,8]() #previously assigned: for i in range(8): x[i]=i #value of x: #[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] print(x>3) #[False, False, False, False, True, True, True, True] print(x==1.0) #[False, True, False, False, False, False, False, False] print(x*2) #[0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0] ``` In contrast, an operation performed on a single number: ```python var j = 1.0 j = j + 1.0 print(j>1.5) #True ``` It is important to note that most "single" numbers are ```SIMD``` with a ```width``` of ```1``` and a ```DType```. This is great, because it just make the whole system easy to do ```SIMD``` on demand. For example, ```math.cos``` can be performed both on a single number and multiple numbers, only the ```width``` vary. ```python var x = Int64(1) #SIMD[DType.int64,1] ``` &nbsp; ### math ```S.I.M.D``` has the ability to perform math in a fast way, because operations can be performed on multiple numbers at the same time. Here are a few ```math``` operations and reductions, there are many more: ```python y = math.iota[DType.float32,8](0) #[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] print(y.reduce_add()) #28.0 print(y*y.reduce_add()) #[0.0, 28.0, 56.0, 84.0, 112.0, 140.0, 168.0, 196.0] print(y.reduce_max()) #7.0 print(y*y) #[0.0, 1.0, 4.0, 9.0, 16.0, 25.0, 36.0, 49.0] print(math.cos(y)) print(math.sqrt(y)) #links to the documentation of mojo that contains many more math ``` (see [Documentation: math](https://docs.modular.com/mojo/stdlib/math/math.html)) &nbsp; ### utilities It includes ```slice```, ```join```, ```rotate```, ```iota```,.. ```iota``` is to create a incrementing sequence of numbers, by giving the first value: ```python y = math.iota[DType.float32,8](0) #[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] A = y.slice[4](offset=0) #[0.0, 1.0, 2.0, 3.0] B = y.slice[4](offset=4) #[4.0, 5.0, 6.0, 7.0] C = SIMD.join(B,A) #[4.0, 5.0, 6.0, 7.0, 0.0, 1.0, 2.0, 3.0] print(C.rotate_left[4]()) #[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ``` &nbsp; ### pointers Usually, numbers are loaded from the disk and stored in the ```RAM```, The pointer is then used to ```simd_load``` some numbers into a ```SIMD``` value, in order to perform operations. ```python p = DTypePointer[DType.uint8].alloc(8) for i in range(8): p[i] = i for i in range(8): print(p[i]) #prints 0,1,2,3,4,5,6,7 "like with arrays" r = p.simd_load[8](0) print(r) #[0, 1, 2, 3, 4, 5, 6, 7] r = r+10 p.simd_store(r) print(p.simd_load[8](0)) #[10, 11, 12, 13, 14, 15, 16, 17] print(p.simd_load[4](0)) #[10, 11, 12, 13] print(p.simd_load[4](4)) #[14, 15, 16, 17] p.free() ``` > ℹ️ Note that mojo have [Tensors](https://docs.modular.com/mojo/stdlib/tensor/tensor.html), they can load data and are just great ! 🔥 &nbsp; ### Casting/converting ```python var i:Int32 = 1 #SIMD[DType.int32,1](1), one number print(SIMD.interleave(i,0)) #[1, 0] print(SIMD.interleave(i,0).cast[DType.bool]()) #[True,False] var K:Int64 = 2 #SIMD[DType.int64,1], one number var o = K.cast[DType.float32]() print(o) #2.0 ``` &nbsp; ### booleans ```python values_b = SIMD[DType.bool,4](True,False,False,True) print(math.any_true(values_b)) #True print(math.all_true(values_b)) #False print(values_b.reduce_or()) #True print(values_b.reduce_and()) #False print(~values_b) #[False, True, True, False] ``` &nbsp; ### selection Based on ```True``` or ```False```, select corresponding values to build a ```SIMD```. ```python yes = SIMD[DType.int32,4](10,20,30,40) no = SIMD[DType.int32,4](-10,-20,-30,-40) guide = SIMD[DType.bool,4](True,True,False,False) res= guide.select(yes,no) print(res) #[10, 20, -30, -40] ``` &nbsp; ### shuffle To change the order of the values: ```python numbers = SIMD[DType.int32,4](10,20,30,40) print(numbers.shuffle[3,2,0,1]()) #[40, 30, 10, 20] ``` &nbsp; ### limit The highest value supported by a ```DType```, for example. There is also ```inf```, ```neginf``` for floats and more: see [Documentation: limit](https://docs.modular.com/mojo/stdlib/math/limit.html) ```python #limits print(math.limit.max_finite[DType.uint8]()) #255 print(math.limit.min_finite[DType.uint8]()) #0 print(math.limit.max_finite[DType.uint64]()) #18446744073709551615 print(math.limit.max_finite[DType.float32]())#3.4028234663852886e+38 ``` &nbsp; ### 🧰👍 Many many more features, see the documentation on the website or the repo of mojo. ### 📎📖 links: [```math```](https://docs.modular.com/mojo/stdlib/math/math.html), [```SIMD```](https://docs.modular.com/mojo/stdlib/builtin/simd.html) and [```DType```](https://docs.modular.com/mojo/stdlib/builtin/dtype.html). ### There is also an [intuitive walk-trough](https://docs.modular.com/mojo/manual/) on the website of mojo. &nbsp; > Made by the community! 🩳 --- tutorials/struct-as-namespace.md --- # 🫙 struct as a namespace (@staticmethod) Using python functions from mojo with a wrapper: ```python fn main(): print(strings.contains("hello world","hello")) print(strings.endswith("hello world","world")) print(strings.count("hello world","l")) print(strings.find("hello world","l")) print(strings.replace("hello world world","world","planet")) ``` > *the global scope is clean, not cluttered* A function marked by the decorator ```@staticmethod``` is called on the struct. > *the struct act as a namespace !* No need to instantiate an object. ```python struct strings: @staticmethod #without try: except def center(a:String,b:Int) -> String: return PythonObject(a).center(PythonObject(b)).to_string() @staticmethod fn replace(a:String,b:String,c:String)->String: try: return PythonObject(a).replace(PythonObject(b),PythonObject(c)).to_string() except e: print(e) return "" @staticmethod fn contains(a:String,b:String)->Bool: try: if PythonObject(a).find(PythonObject(b)) == -1: return False else: return True except e: print(e) return False @staticmethod fn endswith(a:String,b:String)->Bool: try: return PythonObject(a).endswith(PythonObject(b)).__bool__() except e: print(e) return False @staticmethod fn count(a:String,b:String)->Int: try: return PythonObject(a).count(PythonObject(b)).to_float64().__int__() except e: print(e) return -1 @staticmethod fn find(a:String,b:String)->Int: try: return PythonObject(a).find(PythonObject(b)).to_float64().__int__() except e: print(e) return -1 ``` ```try: except:``` could be left unused, but it is a good habit for later! # 🗃️ organised - packages - modules - struct - @staticmethod --- tutorials/traits.md --- # 📋 Traits: accept any types that comply to requirements > Tutorial updated to reflect [Changelog: v0.6.0 (2023-12-04)](https://docs.modular.com/mojo/changelog.html#v0.6.0-2023-12-04) >Traits introduced in [Changelog: v0.6.0 (2023-12-04)](https://docs.modular.com/mojo/changelog.html#v0.6.0-2023-12-04) &nbsp; We already know that a type(struct) can implement some methods, and have some fields. What if multiples types implement the same method signature but differently ? Can we sort of group them? Yes, it is partially why traits are usefull. A trait is like a checklist, it allows mojo to verify if a type comply with a list of things. For now, only methods can be "added" to that check list. That checklist can then be used to accept different types as argument for example. *(It is not exacly a checklist, but it helps to think about it that way, in order to start understanding)* &nbsp; # 🟢 Introduction (Let's start from the beginning) A value/variable has to comply some requirements in order to be passed as an argument(```()```). Usually, they have to be of a pre-determined type (example: ```Int64```). Here is an example(```Int64```): ```python fn MyFunction(argument: Int64): pass fn main(): var MyValue: Int64 = 1 MyFunction(MyValue) ``` ```MyValue``` is passed as an argument to ```MyFunction```, there are no errors because the type of ```MyValue``` comply to the requirements. The requirement is simple: the value passed as an argument has to be an ```Int64```! &nbsp; What if we want to be able to pass a value of either ```Int64``` or ```Int32``` type ? We can specify thoses requirements in a new trait! But let's choose an existing trait for now! (```Intable```) &nbsp; The trait ```Intable``` requires the types who want to comply with it: - An ```__int__(self)->Int``` method implemented in their struct Both ```Int64``` and ```Int32``` comply with that trait. &nbsp; Traits have to be specified in the parameter zone (```[]```) ```python fn MyFunction[Requirements: Intable](argument: Requirements): print(int(argument)) fn main(): var MyValue: Int64 = 2 MyFunction(MyValue) var MyValue2: Int32 = 1 MyFunction(MyValue2) ``` We can now call the ```__int__()``` method on the argument ! It is what ```int(argument)``` does, and the ```Intable``` trait was made for ```__int__()```. &nbsp; Make sure to understand that we can now call the ```__int__()``` method on the argument. The type of the value passed to the function as an argument have to comply to ```Intable```. In order to comply, the type have to implement ```__int__(self)->Int``` Sorry for the repetition, it is important. &nbsp; ## two arguments: ```Python fn MyFunction[R_1: Intable,R_2: Intable](first: R_1, second: R_2) -> Int: return (int(first)+int(second)) fn main(): var result = MyFunction(Int64(2),Int32(1)) print(result) ``` It is necessary to have two sets of the same requirements, because the arguments could be of differents ```Intable``` compliant types. One could be ```Int64``` and the other ```Int32```. Each argument is related to its corresponding parameter ```[]```. &nbsp; #### with different requirements: ```python fn Repeat[R_1: Intable, R_2: Stringable](amount: R_1, message: R_2): for i in range(int(amount)): print(str(message)) fn main(): Repeat(2,"Two times") ``` In order to comply with the ```Stringable``` trait, A struct have to implement one method: - ```fn __str__(self) -> String``` &nbsp; # Creating a new type ```Int64``` is a type, and types are designed in a ```struct``` block. Let's first create a non interesting type, and slowly get to traits! &nbsp; ### 1️⃣ ```python struct MyType: var val: Int fn main(): var MyValue = MyType(1) ``` ```error: 'MyType' does not implement any '__init__' methods in 'var' initializer``` ### 2️⃣✅ ```python struct MyType: var val: Int fn __init__(inout self, argument: Int): self.val = argument fn main(): var MyValue = MyType(1) ``` ### 3️⃣ ```python struct MyType: var val: Int fn __init__(inout self, argument: Int): self.val = argument fn main(): var MyValue = MyType(1) var TryCopy = MyValue ``` ```error: value of type 'MyType' cannot be copied into its destination``` ### 4️⃣✅ ```python struct MyType: var val: Int fn __init__(inout self, argument: Int): self.val = argument fn __copyinit__(inout self, other: Self): self.val = other.val fn main(): var MyValue = MyType(1) var TryCopy = MyValue ``` ### 5️⃣ Let's implement the ```Intable``` requirements ```python struct MyType: var val: Int fn __init__(inout self, argument: Int): self.val = argument fn __copyinit__(inout self, other: Self): self.val = other.val fn __int__(self)->Int : return self.val fn MyFunction[Requirements: Intable](argument: Requirements): print(int(argument)) fn main(): var MyValue = MyType(1) MyFunction(MyValue) ``` ```error: invalid call to 'MyFunction': callee expects 1 input parameter, but 0 were specified``` ### 6️⃣✅ Let's specify that the ```struct``` implement ```Intable``` inside the parenthesis ```()``` ! ```python struct MyType(Intable): #() var val: Int fn __init__(inout self, argument: Int): self.val = argument fn __copyinit__(inout self, other: Self): self.val = other.val fn __int__(self)->Int : return self.val fn MyFunction[Requirements: Intable](argument: Requirements): print(int(argument)) fn main(): var MyValue = MyType(1) MyFunction(MyValue) ``` ### 7️⃣✅ Let's implement ```Stringable``` trait's requirements Also specify that the ```struct``` implement ```Stringable```. *Because a type can implement multiple traits.* ```python struct MyType(Intable,Stringable): #() var val: Int fn __init__(inout self, argument: Int): self.val = argument fn __copyinit__(inout self, other: Self): self.val = other.val fn __int__(self)->Int : return self.val fn __str__(self)->String: return String(self.val) fn MyFunction[Requirements: Stringable](argument: Requirements): print(str(argument)) fn main(): var MyValue = MyType(1) MyFunction(MyValue) ``` ### 8️⃣✅ Let's regroup the traits under a new trait A trait can inherit multiples traits, they are specified inside the parenthesis ```()``` ```python trait MyTrait(Intable,Stringable): #() ... struct MyType(MyTrait): var val: Int fn __init__(inout self, argument: Int): self.val = argument fn __copyinit__(inout self, other: Self): self.val = other.val fn __int__(self)->Int : return self.val fn __str__(self)->String: return String(self.val) fn MyFunction[Requirements: MyTrait](argument: Requirements): print(str(argument)) fn MyFunctionTwo[Requirements: Stringable](argument: Requirements): print(str(argument)) fn main(): var MyValue = MyType(1) MyFunction(MyValue) #👍 MyFunctionTwo(MyValue) #👍 ``` ```trait MyTrait(Intable,Stringable)``` is inheriting from ```Intable``` and ```Stringable```. the three dots ```...``` are required for now to keep the block not empty. ### 9️⃣✅ Make it smaller ```python trait MyTrait(Intable,Stringable): ... @value struct MyType(MyTrait): #() var val: Int fn __int__(self)->Int : return self.val fn __str__(self)->String: return String(self.val) fn MyFunction[Requirements: MyTrait](argument: Requirements): print(str(argument)) print(int(argument)) fn main(): var MyValue = MyType(1) MyFunction(MyValue) ``` the ```@value``` struct decorator synthesize 3 methods: - ```__copyinit__()``` - ```__moveinit__()``` - ```__init__()``` Two of theses comply to traits requirements: - ```Movable``` - ```Copyable``` *see [Documentation: @value](https://docs.modular.com/mojo/manual/decorators/value.html)* &nbsp; ### 1️⃣0️⃣✅ Specify compliance to ```Movable``` and ```Copyable``` ```python trait MyTrait(Intable,Stringable,Movable,Copyable): ... @value struct MyType(MyTrait): var val: Int fn __int__(self)->Int : return self.val fn __str__(self)->String: return String(self.val) fn MyFunction[Requirements: Movable](argument: Requirements): let some = argument^ fn main(): var MyValue = MyType(1) MyFunction(MyValue) ``` ### 1️⃣1️⃣✅ Adding new requirements ```python trait Incrementer(Movable,Copyable): fn Increment(inout self) -> Int: ... @value struct IntCounter(Incrementer): var val: Int fn Increment(inout self) -> Int: self.val += 1 return self.val fn main(): var C1 = IntCounter(0) for i in range(2): print(C1.Increment()) ``` The three dots ```...``` are required for now to keep the method block not empty. In the future, we might be able to provides a default implementation there. (see [Documentation: using traits](https://docs.modular.com/mojo/manual/traits.html#using-traits)) ### 1️⃣2️⃣✅ The power of traits In the begining, the only requirement available was type equality. (```Ìnt64```) It was only possible pass a value of that type to that function argument: ```fn double(argument: Int64)``` &nbsp; After that, the ```Intable``` trait made it possible to pass values of multiple types. we passed both ```Ìnt64``` and ```Ìnt32``` values to: ```python fn MyFunction[Requirements: Intable](argument: Requirements): print(int(argument)) ``` &nbsp; We now have a new trait named ```Ìncrementer```, Let's create another type that comply with it and pass both to a function! ```python trait Incrementer(Movable,Copyable): fn Increment(inout self) -> Int: ... @value struct IntCounter(Incrementer): var val: Int fn Increment(inout self) -> Int: self.val += 1 return self.val @value struct PythonCounter(Incrementer): var val: PythonObject fn Increment(inout self) -> Int: try: self.val += 1 return int(self.val) except e: return 0 fn IncrementAnyCounter[R:Incrementer](inout AnyCounter:R): print(AnyCounter.Increment()) fn main(): var C1 = IntCounter(0) var C2 = PythonCounter(0) for i in range(2): IncrementAnyCounter(C1) IncrementAnyCounter(C2) ``` ### 1️⃣3️⃣✅ Beyond function argument Let's make a trait parametrized type. (```[]```) The new type will be able to have a field that comply to ```Incrementer```. ```python trait Incrementer(Movable,Copyable): fn Increment(inout self) -> Int: ... @value struct IntCounter(Incrementer): #() var val: Int fn Increment(inout self) -> Int: self.val += 1 return self.val @value struct PythonCounter(Incrementer): #() var val: PythonObject fn Increment(inout self) -> Int: try: self.val += 1 return int(self.val) except e: return 0 @value struct AnyCounter[T:Incrementer]: var val: T fn main(): var C1 = AnyCounter(IntCounter(0)) var C2 = AnyCounter(PythonCounter(0)) for i in range(2): print(C1.val.Increment(), C2.val.Increment()) ``` &nbsp; # Making a struct that implement an existing trait ### The [DynamicVector](https://docs.modular.com/mojo/stdlib/utils/vector.html#dynamicvector) type > 🔥 will now call del on its elements when del is called on it! 🔥 parametrized on a trait: ```[T:CollectionElement]```. ### The [CollectionElement](https://docs.modular.com/mojo/stdlib/utils/vector.html#collectionelement) ```trait``` requirements: - ```__copyinit__()``` (Copyable) - ```__moveinit__()``` (Movable) - ```__del__()``` (Destructable) &nbsp; ### Designing a struct that comply with the ```CollectionElement``` trait It is fantastic, the ```@value``` struct decorator can synthesize the required methods of that specific trait. That decorator synthesize exacly 3 functions and 2 of them are thoses. - ```__copyinit__()``` - ```__moveinit__()``` It will also sythesize an initializer: - ```__init__()``` *see [Documentation: @value](https://docs.modular.com/mojo/manual/decorators/value.html)* ```python @value struct my_struct(CollectionElement): var x:Int var y:String fn main(): var vector = DynamicVector[my_struct]() vector.push_back(my_struct(1,"hello")) vector.push_back(my_struct(2,"world")) print(vector[0].x,vector[0].y) ``` You might have noticed that ```@value``` do no synthesize ```__del()__```, and that the ```CollectionElement``` trait requires an implementation of it. (```Destructable```) it is because **every traits inherit from the ```Destructable``` trait**. and mojo automatically adds a no-op ```__del__()``` to types that don't implement one. see [Documentation: Destructable](https://docs.modular.com/mojo/manual/traits.html#the-destructable-trait) &nbsp; # 💄 Traits: another example! ```ruby trait CanWalk: fn walk(self): ... trait CanSwim: fn swim(self): ... trait CanDoBoth(CanWalk,CanSwim): #Inherit from both ... @value struct turtle(CanDoBoth): var name:String fn walk(self): print(self.name, " is walking") fn swim(self): print(self.name, " is swimming") @value struct dolphin(CanSwim): var name:String fn swim(self): print(self.name, " is swimming") fn call_walk[T:CanWalk](w:T): w.walk() fn call_swim[T:CanSwim](s:T): s.swim() fn call_both[T:CanDoBoth](b: T): b.walk() b.swim() fn main(): let d = dolphin("🐬") let t = turtle("🐢") #🐢 can do both call_both(t) #👍 call_swim(t) #👍 call_walk(t) #👍 #🐬 dolphin can swim call_swim(d) ``` 🐢 implemented the requirements of the inherited traits of ```CanDoBoth``` 🐢 comply to ```CanWalk``` and ```CanSwim``` aswell ! &nbsp; # Multiple features together! ```rust @value struct Concept(CollectionElement): var name:String trait Learner: fn learn(inout self, c: Concept): ... trait Teacher: fn teach[L:Learner](self, inout other: L): ... @value struct Human(Learner,Teacher): var Brain: DynamicVector[Concept] fn learn(inout self,c: Concept): self.Brain.push_back(c) fn teach[L:Learner](self, inout other: L): for something in range(len(self.Brain)): other.learn(self.Brain[something]) fn __init__(inout self): self.Brain = DynamicVector[Concept]() @value struct AI(Learner,Teacher): var DigitalBrain: DynamicVector[Concept] fn learn(inout self,c: Concept): self.DigitalBrain.push_back(c) fn teach[L:Learner](self, inout other: L): for something in range(len(self.DigitalBrain)): other.learn(self.DigitalBrain[something]) fn __init__(inout self): self.DigitalBrain = DynamicVector[Concept]() fn TransferKnowledge[T:Teacher,L:Learner](from_:T , inout to_:L): from_.teach(to_) fn main(): var h = Human() h.learn(Concept("First concept")) h.learn(Concept("Second concept")) h.learn(Concept("Third concept")) var a = AI() TransferKnowledge(h,a) var h2 = Human() TransferKnowledge(a,h2) for i in range(3): print(h2.Brain[i].name) ``` &nbsp; *In the future, we might be able to provide fields and default methods implementations to traits!* *But don't worry, it is already very powerfull and liberative!* *(see [Documentation: Traits](https://docs.modular.com/mojo/manual/traits.html#using-traits))* &nbsp; # Traits and ```@staticmethod``` see [Documentation: traits can require static methods](https://docs.modular.com/mojo/manual/traits.html#traits-can-require-static-methods) This is a very expressive feature, here is an example: ```python trait MathImplementation: @staticmethod fn double_int(a:Int)->Int: ... struct First(MathImplementation): @staticmethod fn double_int(a:Int)->Int: return a*2 struct Second(MathImplementation): @staticmethod fn double_int(a:Int)->Int: return a<<1 fn double_with[T:MathImplementation=First](arg:Int)->Int: return T.double_int(arg) fn main(): let result = double_with[First](1) let result2 = double_with[Second](1) print(result) #Default implementation print(double_with(1)) # 🔥 ``` There are more ways to select a default implementation: - [alias](https://docs.modular.com/mojo/manual/parameters/#alias-named-parameter-expressions) - [param_env](https://docs.modular.com/mojo/stdlib/sys/param_env.html) - [@parameter if](https://docs.modular.com/mojo/manual/decorators/parameter.html#parametric-if-statement) ```@staticmethod``` is usefull to make namespace types that dont need an instance for example. # Traits that comes with mojo A list with clear explanations are available in: [Documentation: built-in traits]() - ```len(my_struct_instance)``` Sized - ```int(my_struct_instance)``` Intable - ```str(my_struct_instance)``` Stringable Along with: - ```CollectionElement``` DynamicVector - ```Copyable``` *\_\_copyinit\_\_()* - ```Destructable``` *\_\_del\_\_()* - ```Movable``` *\_\_moveinit\_\_()* The list will probably grow as mojo evolve! &nbsp; # 📬 This tutorial is a community effort ❤️ , it can contains error and will be updated. &nbsp; Make sure to navigate the official site of mojo, wich contains the best ressources for learning! Mojo also have it's documentation available on it's github [repository](https://github.com/modularml/mojo/tree/main/docs) ! --- tutorials/try-and-except-errors-handling.md --- # [Try & Except: ✋->⚠️->⛑️->🩹->👍 ]() > with v0.4.0 There are explainations further down the page, This example accompany thoses: ```python from random import random_float64,seed alias flip_a_coin = random_float64 alias tail = 0.5 def say_three(): raise Error("⚠️ no time to say three") fn count_to_5() raises: print("count_to_5: one") print("count_to_5: two") try: say_three() except e: print("\t count_to_5: error",e) if flip_a_coin()>tail: raise Error("⚠️ we stopped at three") else: print("count_to_5: three ⛑️") print("count_to_5: four") print("count_to_5: five") fn main() raises: seed() try: count_to_5() except e: print("error inside main(): ",e) #main: errror e if e.__repr__() == "⚠️ we stopped at three": print("main: three ⛑️") print("main: four ⛑️") print("main: five ⛑️") print("✅ main function: all good") ``` In order to illustrate Except and Try, The code will randomely produce one of those two scenarios: #### Fix the error from count_to_5: count_to_5: one count_to_5: two count_to_5: error ⚠️ no time to say three count_to_5: three ⛑️ count_to_5: four count_to_5: five ✅ main function: all good #### Fix the error from main: count_to_5: one count_to_5: two count_to_5: error ⚠️ no time to say three error inside main(): ⚠️ we stopped at three main: three ⛑️ main: four ⛑️ main: five ⛑️ ✅ main function: all good # More #### Raising - ```def()``` functions can call raising functions and can raise by default - ```fn() raises``` is necessary in order to raise - ```fn()``` cannot call functions that might raise, for example: a def function that raises by default #### Try: Inside the try block, we can call functions that could raise and error. It is also possible to Raise an error. If and error is thrown, the execution continue at the beginning of the Except: block just below #### Except e: Here it is possible to inspect the error e, based on that, we can fix it. If fixed, the the execution continue on the first line after the except block. If it is not possible to fix it, it is possible to Raise an error: either the same or another. The error will be transfered to the next Except: block. (see example) --- tutorials/type-check-class-of-pythonobject.md --- # 🐍🔍 type-checking a PythonObject > This repo is a community effort, it could contains errors that requires [contributing](/contribute.md) a correction! &nbsp; [```Python.type```](https://docs.modular.com/mojo/stdlib/python/python#type) is a function to get the type/class of a PythonObject. It makes it possible to check if a PythonObject is of the int python class, before getting it's value as a mojo Int, for example. &nbsp; ```python from python import Python def main(): #get the class objects var int_type = Python.evaluate("int") #<class 'int'> var bool_type = Python.evaluate("bool") #<class 'bool'> var str_type = Python.evaluate("str") #<class 'str'> var float_type= Python.evaluate("float") #<class 'float'> var none_type = Python.evaluate("type(None)") #<class 'NoneType'> #create a python object var x = PythonObject("test") print(Python.type(x) is str_type) #True #change to a bool x = True print(Python.type(x) is bool_type) #True #change to none x = None print(Python.type(x) is none_type) #True ``` ## 👍 Practical use: *(the below code is a continuation of the main function above)* ```python x = 123 #1. perform a type-check if Python.type(x) is int_type: #2. Create a mojo Int with it var y: Int = int(x) print(y) else: print("It is not an Int.") #Another example x = None if Python.type(x) is none_type: x = 1234 if Python.type(x) is int_type: print(x) #1234, great! ``` #### output ``` 123 1234 ``` &nbsp; #### with ```is not``` : *(also a continuation of the main function above)* ```python x = None if Python.type(x) is not int_type: x = 123 print(x) #123, Great! ``` &nbsp; #### simple method summarized: ```python from python import Python def main(): #1. get the class to check for float_class = Python.evaluate("float") #2. possibility to check/validate if needed # below is just a simple check to avoid small typos if str(float_class)!= "<class 'float'>": raise("It is not the float class") #3. start type-checking using that class x = PythonObject(0.1) if Python.type(x) is float_class: print("ok") ``` In *step #1*, the class is obtained using ```Python.evaluate```. The reason the tutorial uses that way is that we can see a class name right from the start. &nbsp; It is possible to get it from an existing PythonObject of that class, just like in python. but could be less clear about what is being checked, if the reader is not familiar with python. ```python from python import Python def main(): float_class = Python.type(3.14) x = PythonObject(0.1) if Python.type(x) is float_class: print("ok") ``` *see [Mojo documentation: Python types](https://docs.modular.com/mojo/manual/python/types#python-types-in-mojo)* &nbsp; ## **👍🐍 This is consistent with how python works**: ```python # 🐍 python_code_example.py # meant to be runned by a python interpreter float_class = float if str(float_class)!= "<class 'float'>": raise("It is not the float class") x = 0.1 if type(x) is float_class: print("ok") float_class = type(3.14) x = 0.1 if type(x) is float_class: print("ok") ``` *see [Python 3 documentation](https://docs.python.org/3/library/stdtypes.html)* &nbsp; ### Type checking and imported modules Lets type check a custom user-created python class: ```python # 🐍 mycustomclass.py class MyClass: x = 123 ``` ```python # 🔥 mymojofile.mojo from python import Python def main(): # import the module from the current path Python.add_to_path(".") MyModule = Python.import_module("mycustomclass") MyInstance = MyModule.MyClass() print(MyInstance.x) #123 if Python.type(MyInstance) is MyModule.MyClass: print("ok") y = 1.1 if Python.type(y) is MyModule.MyClass: print("Should not print") ``` ```Python.import_module``` will raise and error if it fails to import, ```try:``` and ```except e:``` can also handle errors raised from python, right within mojo! see [Mojo documentation: Python integration](https://docs.modular.com/mojo/manual/python) &nbsp; # ```is```, the identity operator in Python Once this concept is understood, there are less confusion in understanding that code: ```python from python import Python def main(): float_class = Python.type(3.14) x = PythonObject(0.1) if Python.type(x) is float_class: print("ok") ``` In python, objects have a unique identifier, it is a number. If two objects have the same identity, they share the same value. For example, in python: ```python a = [1,2] b = [a,[4,5,6]] #Changes in a, are reflected in b a.append(3) print(b) #[[1, 2, 3], [4, 5, 6]] #It is because a and b[0] have the same identity print(id(a),id(b[0])) #print two same numbers print(a is b[0]) #True, a is b! ``` &nbsp; #### Conclusion to solidify understanding: in python: ```python a = 1.5 float_type = float a_type = type(a) print(a_type is float_type) #True print(id(a_type) == id(float_type)) #True print(type(5.5) is type(0.1)) #True ``` In mojo now: ```python from python import Python def main(): a = PythonObject(1.5) float_type = Python.evaluate("float") a_type = Python.type(a) print(a_type is float_type) #True id_function = Python.evaluate("id") print(id_function(a_type) == id_function(float_type)) #True print(Python.type(5.5) is Python.type(0.1)) #True ``` Hopefully, you are now able to understand and do type checking with and without ```Python.evaluate``` ! Thanks for reading, feel free to express feedbacks in order to ameliorate the tutorial and gauge it's helpfulness. &nbsp; > 🗓️🔃 Tutorial updated during the mojo [v24.1.0](https://docs.modular.com/mojo/changelog#v241-2024-02-29) era 🔥 To learn more and better, make sure to read Mojo's [documentation and manual](https://docs.modular.com/mojo/manual/) # ❤️‍🔥 &nbsp; &nbsp; ### Going the extra mile with a concrete use case ```python from python import Python def main(): p_arr = Python.evaluate("[1.1,True,5,'hello']") if Python.type(p_arr) is Python.evaluate("list"): p_arr.append("world") else: p_arr = [] var x = Int(0) var y = Float64(0.0) var z = False for e in p_arr: if Python.type(e) is Python.type(99): x = int(e) if Python.type(e) is Python.type(False): z = e.__bool__() if Python.type(e) is Python.type(1.1): y = e.to_float64() if Python.type(e) is Python.type(""): print(str(e)) #output: hello #output: world print(x,y,z) #5 1.1000000000000001 True ``` --- tutorials/use-parameters-to-create-or-integrate-workflow.md --- # 🟢 Let's ```mojo build -D your="own" -D version=1 app.🔥``` with ``` 🛡️Constrained``` You gonna learn how to parametrize your app, starting from the ```🔨 mojo build``` command ⬅️🟤🟣🔵. We then will pass thoses input parameters to the 🟤🟣🔵➡️```🛡️constrained``` function. This will allow us to validate our inputs during the building process. If our inputs are validated (thus not tell mojo to stop building), we will parametrize an if statement with one of the inputs 🔵🔀, it will tell mojo-build if it should use main_1 or main_2! Once the program has been ✅ built, we can start it ▶️! Let's start parametrizing! &nbsp; # 🌴🧋 ```my_app.mojo``` 🧉🌴 ```mojo from sys.param_env import env_get_int, env_get_string from sys.param_env import is_defined fn main(): alias app_version = env_get_int["app_version"]() # ⬅️🟤 constrained[ # 🛡️ app_version > 0, "app_version cannot be 0 or below" ]() constrained[ # 🛡️ app_version < 100, "Version 99 is the maximum !" ]() alias app_name = env_get_string["app_name"]() # ⬅️🟣 constrained[ # 🛡️ len(app_name)<32, "The app name cannot be > 31 ! " ]() constrained[ # 🛡️ len(app_name)>0, "The app name is too small" ]() alias app_use_simd:Bool = is_defined["app_use_simd"]() # ⬅️🔵 print("Welcome to", str(app_name)) print("the version is", str(app_version)) print("simd:", str(app_use_simd)) @parameter if app_use_simd: # 🔵🔀 what should mojo build? app_start_simd() # 🔨❓ else: app_start_not_simd() # 🔨❓ fn app_start_simd(): var values = SIMD[DType.uint8]() print("app started") fn app_start_not_simd(): var values = List[UInt8]() print("app started") ``` 🔨```mojo build my_app.mojo -D app_name="Todo list" -D app_version=100 -D app_use_simd```⬅️🟤🟣🔵 > 🛡️ constraint failed: Version 99 is the maximum ! 🔨```mojo build my_app.mojo -D app_name="Todo list" -D app_version=1 -D app_use_simd```⬅️🟤🟣🔵 > ✅ Built! 👍 my_app has been built from my_app.mojo ▶️```./my_app``` ``` Welcome to Todo list the version is 1 simd: True app started ``` &nbsp; #### 💘 Excellent! You can now make your app and use ```🛡️constrained```! > Make sure to read the mojo language [Documentation: manual](https://docs.modular.com/mojo/manual/) &nbsp; ### 🎉 end of the small tutorial --- tutorials/using-python-in-mojo.md --- # 🐍 using python in mojo: a to z > with v0.4.0 👷 under active development, see [contributions](/contribute.md) ### Import python in mojo ```python from python import Python ``` ### create mutable variable res ```python def main(): var res:PythonObject ``` ### list comprehension ```python res = Python.evaluate("[x*x for x in range(1,4)]") for i in res: # i is a PythonObject let element:Float64 = i.to_float64() print(element) #1.0 4.0 9.0 ``` ### call methods ```python res = " and " #res is a PythonObject #call join method res = res.join(["mojo","python"]) print(res) #print: mojo and python ``` ### list ```python res =[] res.append(Float64(1)) res.append("hello world") res.append(True) res.pop() res.append(False) print(res) #[1.0, 'hello world', False] ``` ### tuples ```python res = (True,0) print(res[0]) print(res[1]) ``` ### get and call python functions ```python res = Python.evaluate("bin") print(res(15)) #0b1111 ``` ### types ```python res = 1.0 print(res.__class__.__name__) #float ``` ### instance ```python res = True let is_instance = Python.evaluate("isinstance") let float_type = Python.evaluate("bool") print(is_instance(res,float_type)) ``` ### convert to mojo types ```python res = "hello world" let res_b:String = res.upper().to_string() print(res_b) #HELLO WORLD res = 1.0 let res_c:Float64 = res.to_float64() res = 123 let res_d:Int = res.__index__() res = True let res_e:Bool = res.__bool__() ``` # with pip modules ### numpy linspace ```python res = Python.import_module("numpy").linspace(0, 1.0, 5) print(res) #[0. 0.25 0.5 0.75 1. ] ``` ### matplotlib plotting ```python res = Python.import_module("matplotlib.pyplot") res.plot([1.1,2.2,4.4]) res.show() ``` # importing a custom python file #### main.mojo: ```python from python import Python def main(): #path to the file (current directory) Python.add_to_path("./") #name of the file without .py let my_module = Python.import_module("python_file") my_module.my_func(2, 3) ``` #### python_file.py: ```python def my_func(a,b): print(a+b) ``` --- tutorials/variant.md --- # 👜 Variant, a type that can hold values of different types [Variant](https://docs.modular.com/mojo/stdlib/utils/variant) is a type, just like Bool, Int32 and DynamicVector, .. But the type of the value it holds can vary, thus the name, Variant. &nbsp; A ```Variant[Int,Bool]``` can hold a value of either ```Int``` or ```Bool```, for example. The type of the **current value** it holds can be **checked**, and it's value retrieved. &nbsp; We can also **reassign** it a **value**, either of the **current type**, or **another types** it supports. &nbsp; It is **kind of** like an object in python, but for struct. (a way to think about it, in order to understand) &nbsp; At the end of the small tutorial, we will create a list that can contain a mixture of any types. just like a list in python, with only two lines of mojo code: ```python alias MyObject = Variant[Bool,Int,String,Float64] var list = DynamicVector[MyObject]() ``` (It is exciting, reading the page in a top to bottom order is recommended) &nbsp; ### ✈️ overview of usage ```python var BuddyInLivingRoom: Variant[Dog,Cat,Bool] #Dog and Cat types in example section #Assign a value of type Bool BuddyInLivingRoom = False #Check if the current value type is Bool (and not Cat or Dog) if BuddyInLivingRoom.isa[Bool](): print("Nobody there") #(Note that we check if it is a Bool, NOT the value it contains) #Assign a value of another type BuddyInLivingRoom.set(Dog("Sweetheart")) #Check if the value type is Dog if BuddyInLivingRoom.isa[Dog](): print("It must be sweetheart") #Dereference the value as Dog type and interact with it if BuddyInLivingRoom.get[Dog]()[].name == "Sweetheart": print("knew it !") ``` &nbsp; # ⚠️ important and easy Before retrieving a value of type cat, It is important to check if the variant is currently holding a value of cat type: 1. ### 🛂 check type ```if BuddyInLivingRoom.isa[Cat]() == True``` 2. ### 🛄 get the reference: ```v = BuddyInLivingRoom.get[Cat]()``` 3. ### 🛃 dereference and get a copy: ```the_cat = v[]``` 4. ### 🛜 (a) interact with the copy: ```print(the_cat.name)``` 5. ### 🛜 (b) interact with the original: ```v[].name = "new name"``` &nbsp; # The methods of the variant type - ```.set(Dog("name"))``` It is important to use that function when **re-assigning** a value, because the **destructor** of the previous value need to be called. (ensure cleanup logic in ```__del__```) - ```.isa[Cat]()``` Necessary to check the type of the current value of the variant. That way, ```.get[Cat]()``` can saferly returns a reference to a ```Cat``` value. - ```.get[Dog]()``` Returns a reference (of type ```Dog```) to the value stored in the variant. Can be dereferenced with square brackets(```[]```) Example: ```name = v.get[Dog]()[].name``` - ```.take[Cat]()``` move the value out of the variant. that way, the destructor is **not** called and we can move it elsewhere again (into a function for example). Type checking is necessary in order to avoid dereferencing as the wrong type. (```.isa[Dog]()```) ⚠️ *Be mindfull that ```.set``` assume that a previous value exist and call the destructor on it.* *If the value was taken out, there is no valid value to call a destructor on.* *It is possible to re-assign another value to the variant with ```=``` instead of ```set```.* *That way, the destructor won't be called.* ⚠️ &nbsp; # Happy relationship between ```.Get[T]()``` and ```Reference``` ```.get[T]()``` returns a reference to a value of type ```T```. it is possible to mutate the original value in an easy manner, by dereferencing on the left side of the ```=``` sign. (see 🔵) ```python from utils.variant import Variant def main(): var V:Variant[Int,String] V = String("hello world") #Mutate the original, trough the reference V.get[String]()[]="new" #🔵 print(V.get[String]()[]) #"new" #Dereference and create a copy V_copy = V.get[String]()[] V_copy = "won't mutate original" print(V.get[String]()[]) #"new" ``` ⚠️ Note that 🔵 operate on a String reference, so assigning an Int would implicitely convert it to a String. The type of the current value of the variant would still be of String type and it's value would be String("123") It makes more sense to use ```V.set[Int](123)``` in that case. &nbsp; # 👨‍🏭 Example ```python from utils.variant import Variant @value struct Cat(CollectionElement): var name: String @value struct Dog(CollectionElement): var name: String def buddy_name(buddy: Variant[Dog,Cat])->String: if buddy.isa[Dog](): ref_to_buddy = buddy.get[Dog]() the_buddy = ref_to_buddy[] #dereference it return the_buddy.name if buddy.isa[Cat](): ref_to_buddy = buddy.get[Cat]() the_buddy = ref_to_buddy[] return the_buddy.name return "some return that could be replaced by an optional or variant" def main(): #Declare a variable of type Variant, #can hold a value of either Dog or Cat type. var MyBuddy:Variant[Dog,Cat] MyBuddy = Dog("sweetheart") print(buddy_name(MyBuddy)) MyBuddy.set(Cat("mona")) print(buddy_name(MyBuddy)) #Getting the type it currently holds: if MyBuddy.isa[Cat](): print("Cat!") if MyBuddy.isa[Dog](): print("Dog!") #It can be changed any time ! for i in range(3): MyBuddy.set(Dog("minisweetheart "+String(i))) print(buddy_name(MyBuddy)) for i in range(3): MyBuddy.set(Cat("minimona "+String(i))) print(buddy_name(MyBuddy)) #In addition to Dog and Cat, #It is possible to add another type to the variant #Bool could be added as an hint that it is an empty value(neither cat or dog) var BuddyInLivingRoom: Variant[Dog,Cat,Bool] BuddyInLivingRoom = False if BuddyInLivingRoom.isa[Bool](): print("Nobody there") BuddyInLivingRoom.set(Dog("Sweetheart")) if BuddyInLivingRoom.isa[Dog](): print("It must be Sweetheart") if BuddyInLivingRoom.get[Dog]()[].name == "Sweetheart": print("knew it !") ``` &nbsp; ### ```Variant``` is user-friendly and usefull, make sure to put it in your toolbox where you can see it. ### Both ```Variant``` and ```traits``` allows for passing values of multiples type to functions, for example. &nbsp; &nbsp; # Starting point exercice to make friend with Variant Feel free to meet ```Variant``` in a brand new ```def main():``` function, it wants to play "guess what's in the box" with it's new friend. ```python from utils.variant import Variant def main(): seed() var V:Variant[Int,Float32,Bool] = get_box() if V.isa[Bool](): print(V.get[Bool]()[]) ref = V.get[Bool]() ref[] = not ref[] print(V.get[Bool]()[]) #Improve the game, Variant is always playful #It takes very little time to complete it. #Once done, Variant will always be there for you! from random import seed, random_si64 def get_box()->Variant[Int,Float32,Bool]: var tmp = Variant[Int,Float32,Bool](True) v = random_si64(0,2) if v == 0: tmp.set[Int](0) if v == 1: tmp.set[Float32](1.0) if v == 2: tmp.set[Bool](random_si64(0,1)==1) return tmp ``` &nbsp; # 💝 ```Variant[Bool,Int,String,Float64]``` With variant, it is possible create a type, that appears to be an object. Just decide a big variant of all the types you want it to be able to be. In combination with ```alias```, the big and powerful variant, can be given sort of a short name. Let's create a list of it, so that we can store different types in the same list. ```python from utils.variant import Variant alias MyObject = Variant[Bool,Int,String,Float64] def main(): var list = DynamicVector[MyObject]() #🔥 list.push_back(MyObject(True)) list.push_back(MyObject(Float64(1.1))) list.push_back(MyObject(9)) list.push_back(MyObject(String("hello world"))) for i in range(len(list)): v = list[i] if v.isa[Bool](): print("Bool: ",v.get[Bool]()[]) if v.isa[Int](): print("Int: " , v.get[Int]()[]) if v.isa[String](): print("String: ", v.get[String]()[]) if v.isa[Float64](): print("Float64: ", v.get[Float64]()[]) ``` ### output ``` Bool: True Float64: 1.1000000000000001 Int: 9 String: hello world ``` &nbsp; # 👏🌴 If you never did low-level code before, congratulation. What you now can do would be called a "vector of typesafe union" in C++. Let's just call it pizza. At the end of the day, it is just a type that can sort-of vary, and we can give it a short name. Two concepts: ```alias``` and ```Variant``` &nbsp; ### Interesting interaction with a function ```python from utils.variant import Variant alias MyObject = Variant[Bool,Int,String,Float64] def main(): v = MyObject(True) #Bool mutate(v) #Change to Float64 if v.isa[Float64](): print(v.get[Float64]()[]) #prints 1.0 def mutate(inout arg: MyObject): arg.set[Float64](1.0) ``` &nbsp; --- ### Hope that small tutorial was helpful and enjoyable. ### Happy coding with ```Variant```! &nbsp; #### *👍 Please consider contributing ideas, corrections, discussions, suggestions ❤️‍🔥* --- tutorials/vectorise-simd-cosine.md --- ```python import math from sys.info import simdwidthof from algorithm import vectorize from python import Python fn main(): alias size = 256 alias value_type = DType.float64 #allocate array of size elements of type value_type var array = DTypePointer[value_type]().alloc(size) @parameter fn cosine[group_size:Int](X: Int): #create a simd array of size group_size. values: X->(X+group_size-1) var tmp = math.iota[value_type, group_size](X) tmp = tmp * 3.14 * 2 / 256.0 tmp = math.cos[value_type,group_size](tmp) array.simd_store[group_size](X,tmp) #how much values at a time alias by_group_of = simdwidthof[value_type]() vectorize[by_group_of,cosine](size) for i in range(size): print(array.load(i)) try: var plt = Python.import_module("matplotlib.pyplot") var python_y_array = PythonObject([]) for i in range(size): python_y_array.append(array.load(i)) var python_x_array = Python.evaluate("[x for x in range(256)]") plt.plot(python_x_array,python_y_array) plt.show() except: print("no plot") #release memory array.free() ``` --- tutorials/what-have-change-when-there-is-a-new-update.md --- # 📫 find out changes and improvements when there is a new update When there is a new update, a new changelog is available. The changelogs are availables for us [here](https://docs.modular.com/mojo/changelog.html) ## What is a changelog It is an entry that describe the changes made, new features and bug fixed of an update. ## How are they usefull Provides a clear listing of new features that are now availables. They also helps to maintain existing code by adapting to changes. ## Practical example Lets understand how usefull it is by partially analysing a real changelog. ### [v0.5.0 (2023-11-2)](https://docs.modular.com/mojo/changelog.html#v0.5.0-2023-11-2) From a glance, we can see that SIMD got a new function: - ```join()``` : allows concatenating two SIMD values More features: - Tensor has new ```fromfile()``` and ```tofile()``` methods to save and load as bytes from a file. - Mojo now supports compile-time keyword parameters - ```fn foo[a: Int, b: Int = 42]()``` - Keyword parameters are also supported in structs - The parameters for InlinedFixedVector have been switched. - It now looks more like SIMD, let's make changes to existing codes to reflect the improvement, another benetits of changelogs. - The [benchmark](https://docs.modular.com/mojo/stdlib/benchmark/benchmark.html) module has been simplified and improved - ...more exciting features A section is dedicated to list features that have been removed if any. ### ✅ Fixed section That sections show all the bug reports made on the [github repository of mojo](https://github.com/modularml/mojo/issues) that have been fixed in that update. Users can also create new bug reports if needed on that link. The repository is also a place to create a feature request. --- > People also usually discuss the changes on the [Discord channel](https://www.discord.gg/modular) > There are also live Q/A, demonstrations and blog posts by mojo/modular team --- tutorials/with-blocks-for-struct-parametric-minimal-raise.md --- # 🔥 With blocks: with my_struct(1) as v (parametric/minimal/raise) > with v0.5.0 The with blocks are similar to the ones in python in many aspects. In mojo, it is possible to parametrize the struct. This is just one distinction, there are probably more and more to come! ### A. Minimal example That example cover a new supported feature introduced in [Changelog: 2023-10-05](https://docs.modular.com/mojo/changelog.html#v0.4.0-2023-10-05) - support an ```__enter__``` method without implementing support for an ```__exit__``` method ```python @value struct my_struct[T:AnyType]: var value: T fn __init(inout self,arg:T): self.value = arg fn __enter__(owned self) -> T: return self.value #__del__() called on self here fn main(): #struct parameter deduction: with my_struct(1.5) as value: print(value) #explicitely specify type: with my_struct[Bool](True) as value: print(value) ``` Note the absence of an ```__exit__()``` method in that example. self is "consumed" in the ```__enter__(owned self)->T``` ```__del()__``` is called on self after the last use of it. see [Mojo documentation:ASAP](https://docs.modular.com/mojo/programming-manual.html#behavior-of-destructors) for more on why it is called after it's last use. There is also a small tutorial on ASAP inside this repository. &nbsp; ### B. Error handling and Exit That example cover some features introduced in [Changelog: week-of-2023-04-24](https://docs.modular.com/mojo/changelog.html#week-of-2023-04-24). ##### enter the with block, and provide value of type T ```fn __enter__(self) -> T:``` ##### exit the with block without error ```fn __exit__(self):``` ##### error got raised inside the with block: ```fn __exit__(self, err: Error) -> Bool:``` ```python @value struct my_struct[T:AnyType]: var value: T fn __init(inout self,arg:T): self.value = arg #Return a value to be used by the with block fn __enter__(self) -> T: return self.value fn __exit__(self): print("🏖️ exit with success") #For error handling fn __exit__(self, err: Error) -> Bool: print("❌ Error 'received' by __exit__ : ",err) if err._message() == "Error in with block": #Let's consider it handled by returning True. print("✅ Handled in exit") return True #If return False, it means the error was not handled here #the error will be re-propagated/re-thrown return False fn main() raises: try: with my_struct(1.5) as value: print(value) #raise Error("Error in with block") raise Error("Another error") except err: #The error got re-thrown here print("❌ Error 'received' by main : ",err) #Lets consider it handled. print("✅ Handled in main") #Program will continue, below in the main function print("Main: all good") ``` Depending on wich error is thrown (see the commented one), the program produce one of theses two outputs: #### A: ``` 1.5 ❌ Error 'received' by __exit__ : Error in with block ✅ Handled in exit Main: all good ``` #### B: ``` 1.5 ❌ Error 'received' by __exit__ : Another error ❌ Error 'received' by main : Another error ✅ Handled in main Main: all good ``` --- why.md --- # 📖 Learning mojo language ### ⚠️ not affiliated with Modular or Mojo ### [return to main page](README.md) ## Why learning Mojo? **Unifying** the **high level** world and the **low level** world into a **single language** provides many great things: - **choose how time is used on any part of the app** by switching from high level to low level (usefull when prototyping or exploring ideas). - **explore new lands/platforms** that were not steppable before (freedom, versatiliy and opportunities) - **a progressive path to learn and grow** (by choosing the current level of abstraction). There are three worlds at disposal: - statically typed (Int64..) (*builtin* and custom structs) - mojo's object *([Builtin.object](https://docs.modular.com/mojo/stdlib/builtin/object.html),used in the example:[Matrix multiplication](https://docs.modular.com/mojo/notebooks/Matmul.html#importing-the-python-implementation-to-mojo))* - python object *(require: from Python import [PythonObject](https://docs.modular.com/mojo/stdlib/python/object.html#pythonobject))* Another is on it's way: [Roadmap: C/C++ Interop](https://docs.modular.com/mojo/roadmap.html#cc-interop) - would increase productivity by an significant factor (spending less time writing bindings) Why learn it now? - the language is still small so it is easy to learn as it grows - by the time it is considered mature, being ready for action and already an experienced mojician. *Note: Python have many packages and an active community of general purpose programmers and experts.* ## 🌅 A bright future ahead full of opportunities It is easy to imagine that one person knowing mojo could one day be able to do: - 🌐 Web applications: - front end - potential for wasm: mojo apps have a small footprint - back end - part of it being an ai running on a graphic card? - filtering audio signals as a web service? - provide to the front-end chart images? - 💻 Desktop softwares - 📱 Mobile apps - ⏧ Robotics and IOT using micro-controllers - 🤖 Performant A.I - 🎮 video games &nbsp; ### Let's take the time to say thank you to the modular/mojo team. ### This repository is just a community effort, the ressources ### available on the official website of modular/mojo ### are the best if you want to learn! ### Here are some links to theses: &nbsp; --- > ## 🔗 Links to official Mojo content #### [📗 The programming manual](https://docs.modular.com/mojo/programming-manual.html) #### [📑 The documentation](https://docs.modular.com/mojo/) #### 🗣 [Modular official discord chat channel](https://www.discord.gg/modular) Join it, really! - have 21.8K members (as of the 29th of september 2023) - The mojo/modular staff is active. Getting started: - #### [Getting started with the Mojo SDK🔥](https://www.youtube.com/watch?v=knGTSXe7ytI) - #### [Using Mojo🔥 with Docker containers](https://www.youtube.com/watch?v=cHyYmF-RhUk) - #### [Using the Mojo 🔥 Visual Studio Extension 🚀](https://www.youtube.com/watch?v=KYEAiTBbNT8) --- --- .gitignore --- **/temp.** **/temp/ --- LICENSE --- MIT License Copyright (c) 2023 Helehex Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Infrared 🔆 Geometric Algebra for Mojo 🔥 Mojo nightly version: `mojo 2024.8.2916 (1e9c68e6)` ## package layout: - algebra - signature: general algebra generation - multivector: implements signature with arbitrary basis masking - mask: implements helper functions for basis masking - basis: implements representations for basis elements - hard - g2 (hard-coded cl(2)) - g3 (hard-coded cl(3)) - math - combinatorics - constants - io - ansi colors --- TODO.md --- # TODO - Improve performance of algebra generation - Use bit wise operations for basis reduction - Improve model for multivector subspace initialization - Multivector eval() from string - Maybe add a SignatureMask struct for helping with masking - Make some examples --- src/__init__.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # """## Infrared 🔆 Geometric Algebra for Mojo. 🔥 """ from .io import * from .math import * from .algebra import * --- src/algebra/__init__.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # """Defines a generalized geometric algebra multivector.""" from .basis import * from .signature import * from .multivector import * # +----------------------------------------------------------------------------------------------+ # # | Grade Aliases # +----------------------------------------------------------------------------------------------+ # # alias Complex = Signature(1) """Complex Numbers.""" alias Split = Signature(0, 1) """Split Numbers.""" alias Dual = Signature(0, 0, 1) """Dual Numbers.""" alias G2 = Signature(2) """2D Vector Algebra.""" alias G3 = Signature(3) """3D Vector Algebra.""" alias PG2 = Signature(2, 0, 1) """2D Projective Algebra.""" alias PG3 = Signature(3, 0, 1) """3D Projective Algebra.""" alias CG2 = Signature(3, 1) """2D Conformal Algebra.""" alias CG3 = Signature(4, 1) """3D Conformal Algebra.""" alias SG2 = Signature(1, 2) """2D Spacetime Algebra.""" alias SG3 = Signature(1, 3) """3D Spacetime Algebra.""" # +----------------------------------------------------------------------------------------------+ # # | Subspace Constructors # +----------------------------------------------------------------------------------------------+ # # @always_inline fn scalar[ sig: Signature, type: DType = DType.float64 ](owned coef: Scalar[type]) -> Multivector[sig, sig.scalar_mask(), type]: return Multivector[sig, sig.scalar_mask(), type](coef) @always_inline fn vector[ sig: Signature, type: DType = DType.float64 ](owned *coefs: Scalar[type]) -> Multivector[sig, sig.vector_mask(), type]: return Multivector[sig, sig.vector_mask(), type](coefs^) @always_inline fn bivector[ sig: Signature, type: DType = DType.float64 ](owned *coefs: Scalar[type]) -> Multivector[sig, sig.bivector_mask(), type]: return Multivector[sig, sig.bivector_mask(), type](coefs^) --- src/algebra/basis.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # from ..io.ansi import Color # +----------------------------------------------------------------------------------------------+ # # | Signed Basis # +----------------------------------------------------------------------------------------------+ # # @value @register_passable("trivial") struct SignedBasis: # +------< Data >------+ # # var sign: Int var basis: Int @always_inline fn expand(self, sig: Signature) -> List[Int]: var result = List[Int](capacity=sig.grade_of[self.basis]) var k = sig.grade_of[self.basis] var r = sig.index_in_grade[self.basis] + 1 var j = 0 for s in range(1, k + 1): var cs = j + 1 while r - pascal(sig.vecs - cs, k - s) > 0: r -= pascal(sig.vecs - cs, k - s) cs += 1 result += cs j = cs return result^ @no_inline fn __str__(self, sig: Signature) -> String: var result = String() var writer = Formatter(result) self.format_to(writer, sig) return result @no_inline fn format_to(self, inout writer: Formatter, sig: Signature): var align = len(str(sig.dims)) + 1 var str_sign: StringLiteral if self.sign < 0: str_sign = "-" elif self.sign > 0: str_sign = "+" else: str_sign = " " writer.write(Color.colors[sig.grade_of[self.basis] % 8] if self.sign else Color.grey) writer.write((str(self.basis) if self.sign != 0 else "").rjust(align, str_sign)) writer.write(Color.clear) fn signed_sort(inout basis: List[Int]) -> Int: var count = 0 for i in range(1, len(basis)): var j = i while j > 0 and basis[j] < basis[j - 1]: count += 1 var temp = basis[j - 1] basis[j - 1] = basis[j] basis[j] = temp j -= 1 return count fn count_odd(array: List[Int]) -> Int: var count = 0 var i = 1 var m = 0 while i < array.size: if array[i - 1] != array[i]: if i % 2 != m: count += 1 m = i % 2 i += 1 if array.size % 2 != m: count += 1 return count --- src/algebra/mask.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # @always_inline fn generate_basis2entry(mask: List[Bool]) -> List[Int]: # TODO: I tried making this return a List[Optional[Bool]], # but something breaks when using it at ctime. var result = List[Int](capacity=len(mask)) var count = 0 for basis in range(len(mask)): if mask[basis]: result += count count += 1 else: result += -1 return result^ @always_inline fn generate_entry2basis(mask: List[Bool]) -> List[Int]: var result = List[Int](capacity=count_true(mask)) for basis in range(len(mask)): if mask[basis]: result += basis return result^ @always_inline fn count_true(mask: List[Bool]) -> Int: var count = 0 for basis in range(len(mask)): count += int(mask[basis]) return count @always_inline fn or_mask(a: List[Bool], b: List[Bool]) -> List[Bool]: var result = List[Bool](capacity=len(a)) for idx in range(len(a)): result += a[idx] | b[idx] return result^ @always_inline fn mul_mask[sig: Signature](a: List[Bool], b: List[Bool]) -> List[Bool]: # TODO: There's probably a better way todo this var result = sig.empty_mask() @parameter for x in range(sig.dims): if a[x]: @parameter for y in range(sig.dims): if b[y]: result[sig.mult[x][y].basis] |= sig.mult[x][y].sign != 0 return result --- src/algebra/multivector.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # from os import abort from collections import Optional from ..utils import SmallArray from .mask import * # +----------------------------------------------------------------------------------------------+ # # | Multivector # +----------------------------------------------------------------------------------------------+ # # @value struct Multivector[sig: Signature, mask: List[Bool], type: DType = DType.float64]( Formattable, Stringable ): """Multivector.""" # +------[ Alias ]------+ # # alias basis2entry = generate_basis2entry(mask) alias entry2basis = generate_entry2basis(mask) alias entry_count = count_true(mask) alias DataType = SmallArray[Scalar[type], Self.entry_count] # +------< Data >------+ # # var _data: Self.DataType # +------( Initialize )------+ # # @always_inline fn __init__[init_data: Bool = True](inout self): self._data.__init__[False]() @parameter if init_data: @parameter for entry in range(Self.entry_count): self._data[entry] = 0 @always_inline fn __init__(inout self: Multivector[sig, sig.scalar_mask(), type], s: Scalar[type]): self.__init__[False]() self._data[0] = s @parameter for entry in range(1, Self.entry_count): self._data[entry] = 0 @always_inline fn __init__(inout self, owned *coefs: Scalar[type]): self = Self(coefs^) @always_inline fn __init__(inout self, owned coefs: VariadicListMem[Scalar[type]]): self.__init__[False]() if len(coefs) != Self.entry_count: abort("incorrect number of coefficient passed to masked multivector") self._data.__init__(storage=coefs^) @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): @parameter if self.entry_count == 0: writer.write("0") return alias len = self.entry_count - 1 writer.write("-" if self._data[0] < 0 else "+") @parameter for entry in range(len): writer.write(abs(self._data[entry]), " [", self.entry2basis[entry]) if self._data[entry + 1] < 0: writer.write("] - ") else: writer.write("] + ") writer.write(abs(self._data[len]), " [", self.entry2basis[len], "]") # +------( Comparison )------+ # # @always_inline fn __eq__(self, other: Multivector[sig, _, type]) -> Bool: @parameter for basis in range(sig.dims): alias self_entry = self.basis2entry[basis] alias other_entry = other.basis2entry[basis] @parameter if (self_entry != -1) and (other_entry != -1): if self._data[self_entry] != other._data[other_entry]: return False elif self_entry != -1: if self._data[self_entry] != 0: return False elif other_entry != -1: if other._data[other_entry] != 0: return False return True @always_inline fn __ne__(self, other: Multivector[sig, _, type]) -> Bool: @parameter for basis in range(sig.dims): alias self_entry = self.basis2entry[basis] alias other_entry = other.basis2entry[basis] @parameter if (self_entry != -1) and (other_entry != -1): if self._data[self_entry] != other._data[other_entry]: return True elif self_entry != -1: if self._data[self_entry] != 0: return True elif other_entry != -1: if other._data[other_entry] != 0: return True return False # +------( Unary )------+ # # @always_inline fn __neg__(self) -> Self: var result: Multivector[sig, mask, type] result.__init__[False]() @parameter for entry in range(result.entry_count): result._data[entry] = -self._data[entry] return result @always_inline fn __inverse__(self) -> Self: return self.__rev__() @always_inline fn __rev__(self) -> Self: """Reversion operator, reverses the subscript of each basis element.""" var result: Multivector[sig, mask, type] result.__init__[False]() @parameter for entry in range(result.entry_count): alias sign = (1 - (((sig.grade_of[self.entry2basis[entry]] // 2) % 2) * 2)) result._data[entry] = self._data[entry] * sign return result @always_inline fn __invo__(self) -> Self: """Involution operator, reverses the subscript of each basis element.""" var result: Multivector[sig, mask, type] result.__init__[False]() @parameter for entry in range(result.entry_count): alias sign = (((sig.grade_of[self.entry2basis[entry]] % 2) * 2) - 1) result._data[entry] = self._data[entry] * sign return result @always_inline fn __conj__(self) -> Self: """Reversion operator, reverses the subscript of each basis element.""" var result: Multivector[sig, mask, type] result.__init__[False]() @parameter for entry in range(result.entry_count): alias sign = (((((sig.grade_of[self.entry2basis[entry]] + 3) // 2) % 2) * 2) - 1) result._data[entry] = self._data[entry] * sign return result @always_inline fn __dual__(self) -> Self: """Dualization operator, currently just reverses coefficients.""" var result: Multivector[sig, mask, type] result.__init__[False]() @parameter for entry in range(result.entry_count): result._data[entry] = self._data[(result.entry_count - 1) - entry] return result # +------( Arithmetic )------+ # # @always_inline fn __add__( self, other: Multivector[sig, _, type] ) -> Multivector[sig, or_mask(mask, other.mask), type]: var result: Multivector[sig, or_mask(mask, other.mask), type] result.__init__[False]() @parameter for entry in range(result.entry_count): alias result_basis = result.entry2basis[entry] alias self_entry = self.basis2entry[result_basis] alias other_entry = other.basis2entry[result_basis] @parameter if (self_entry != -1) and (other_entry != -1): result._data[entry] = self._data[self_entry] + other._data[other_entry] elif self_entry != -1: result._data[entry] = self._data[self_entry] elif other_entry != -1: result._data[entry] = other._data[other_entry] return result @always_inline fn __sub__( self, other: Multivector[sig, _, type] ) -> Multivector[sig, or_mask(mask, other.mask), type]: var result: Multivector[sig, or_mask(mask, other.mask), type] result.__init__[False]() @parameter for entry in range(result.entry_count): alias result_basis = result.entry2basis[entry] alias self_entry = self.basis2entry[result_basis] alias other_entry = other.basis2entry[result_basis] @parameter if (self_entry != -1) and (other_entry != -1): result._data[entry] = self._data[self_entry] - other._data[other_entry] elif self_entry != -1: result._data[entry] = self._data[self_entry] elif other_entry != -1: result._data[entry] = -other._data[other_entry] return result @always_inline fn __mul__( lhs, rhs: Multivector[sig, _, type] ) -> Multivector[sig, mul_mask[sig](mask, rhs.mask), type]: var result: Multivector[sig, mul_mask[sig](mask, rhs.mask), type] result.__init__[True]() @parameter for lhs_entry in range(lhs.entry_count): @parameter for rhs_entry in range(rhs.entry_count): alias lhs_basis = lhs.entry2basis[lhs_entry] alias rhs_basis = rhs.entry2basis[rhs_entry] # These have to be var's, otherwise it crashes var signed_basis = sig.mult[lhs_basis][rhs_basis] var entry = result.basis2entry[signed_basis.basis] var sign = signed_basis.sign if sign != 0: result._data[entry] += sign * lhs._data[lhs_entry] * rhs._data[rhs_entry] return result --- src/algebra/signature.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # # +----------------------------------------------------------------------------------------------+ # # | Signature # +----------------------------------------------------------------------------------------------+ # # struct Signature: """Signature.""" # +------< Data >------+ # # var po: Int var ne: Int var ze: Int # +------< Cache >------+ # # var vecs: Int var dims: Int var grds: Int var vec_sqrs: List[Int] var grade_dims: List[Int] var grade_of: List[Int] var index_in_grade: List[Int] var combs: List[List[Int]] var mult: List[List[SignedBasis]] # +------( Initialize )------+ # # fn __init__(inout self, po: Int, ne: Int = 0, ze: Int = 0, *, flip_ze: Bool = True): self.po = po self.ne = ne self.ze = ze self.vecs = self.po + self.ne + self.ze self.dims = 2 ** (self.vecs) self.grds = self.vecs + 1 self.vec_sqrs = List[Int](capacity=self.vecs) self.grade_dims = List[Int](capacity=self.grds) self.grade_of = List[Int](capacity=self.dims) self.index_in_grade = List[Int](capacity=self.dims) self.combs = powerset_ord(self.vecs) self.mult = List[List[SignedBasis]](capacity=self.dims) if flip_ze: for _ in range(ze): self.vec_sqrs += 0 for _ in range(po): self.vec_sqrs += 1 for _ in range(ne): self.vec_sqrs += -1 if not flip_ze: for _ in range(ze): self.vec_sqrs += 0 for grade in range(self.grds): self.grade_dims += pascal(self.vecs, grade) for grade in range(self.grds): for basis in range(self.grade_dims[grade]): self.grade_of += grade self.index_in_grade += basis self.generate_product_table() # +------( Masks )------+ # # fn empty_mask(self) -> List[Bool]: var result = List[Bool](capacity=self.dims) for _ in range(self.dims): result += False return result fn full_mask(self) -> List[Bool]: var result = List[Bool](capacity=self.dims) for _ in range(self.dims): result += True return result fn grade_mask(self, grade: Int) -> List[Bool]: var result = List[Bool](capacity=self.dims) for basis in range(self.dims): result += self.grade_of[basis] == grade return result @always_inline fn scalar_mask(self) -> List[Bool]: return self.grade_mask(0) @always_inline fn vector_mask(self) -> List[Bool]: return self.grade_mask(1) @always_inline fn bivector_mask(self) -> List[Bool]: return self.grade_mask(2) @always_inline fn trivector_mask(self) -> List[Bool]: return self.grade_mask(3) @always_inline fn quadvector_mask(self) -> List[Bool]: return self.grade_mask(4) @always_inline fn antiscalar_mask(self) -> List[Bool]: return self.grade_mask(self.grds - 1) # +------( Basis )------+ # # @always_inline fn squash_basis(self, inout basis: List[Int], inout sign: Int): var result = List[Int](capacity=len(basis)) var i = 1 var j = 0 while i < len(basis): if basis[i] != basis[i - 1]: result += basis[i - 1] i += 1 j += 1 else: sign *= self.vec_sqrs[basis[i] - 1] i += 2 if i == len(basis): result += basis[len(basis) - 1] basis = result^ @always_inline fn reduce_basis(self, owned basis: List[Int]) -> SignedBasis: if len(basis) == 0: return SignedBasis(1, 0) elif len(basis) == 1: return SignedBasis(1, basis[0]) else: var sign: Int = 1 - ((signed_sort(basis) % 2) * 2) self.squash_basis(basis, sign) return SignedBasis(sign, self.order_basis(basis)) @always_inline fn squash_vec(self, inout basis: List[Int], vec: Int, inout sign: Int): for idx in reversed(range(len(basis))): if basis[idx] == vec: sign *= self.vec_sqrs[vec - 1] _ = basis.pop(idx) return elif basis[idx] < vec: basis.insert(idx + 1, vec) return else: sign = -sign basis.insert(0, vec) @always_inline fn reduce_basis(self, owned basis1: List[Int], basis2: List[Int]) -> SignedBasis: var sign: Int = 1 for vec in basis2: self.squash_vec(basis1, vec[], sign) return SignedBasis(sign, self.order_basis(basis1)) @always_inline fn order_basis(self, basis: List[Int]) -> Int: var result = self.grade_dims[len(basis)] for i in range(len(basis)): result += self.grade_dims[i] var n = self.vecs - basis[i] var k = len(basis) - i if n >= k: result -= pascal(n, k) return result - 1 # +------( Generate )------+ # # fn generate_product_table(inout self): for x in range(self.dims): var result_x = List[SignedBasis](capacity=self.dims) for y in range(self.dims): result_x += self.reduce_basis(self.combs[x], self.combs[y]) self.mult += result_x^ # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): for x in range(len(self.mult)): for y in range(len(self.mult[x])): writer.write(self.mult[x][y].__str__(self) + " ") writer.write("\n") --- src/hard/__init__.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # """Contains hard-coded types.""" import .g2 import .g3 --- src/hard/g2.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # """Defines a G2 Multivector, and it's subspaces. Cl(2,0,0) ⇔ Mat2x2 `x*x = y*y = 1` `x*y = i` `y*x = -i` `i*i = -1` """ from math import cos, sin, atan2 # +----------------------------------------------------------------------------------------------+ # # | G2 Multivector # +----------------------------------------------------------------------------------------------+ # # @register_passable("trivial") struct Multivector[type: DType = DType.float64, size: Int = 1]( StringableCollectionElement, Formattable, EqualityComparable ): """A G2 Multivector.""" # +------[ Alias ]------+ # # alias Coef = SIMD[type, size] alias Vect = Vector[type, size] alias Roto = Rotor[type, size] alias Lane = Multivector[type, 1] # +------< Data >------+ # # var s: Self.Coef """The scalar component.""" var v: Self.Vect """The vector component.""" var i: Self.Coef """The bivector component.""" # +------( Initialize )------+ # # @always_inline fn __init__(inout self, none: None = None): self.s = 0 self.v = None self.i = 0 @always_inline fn __init__(inout self, s: Self.Coef, x: Self.Coef, y: Self.Coef, i: Self.Coef): self.s = s self.v = Self.Vect(x, y) self.i = i @always_inline fn __init__(inout self, s: Self.Coef, v: Self.Vect = None, i: Self.Coef = 0): self.s = s self.v = v self.i = i @always_inline fn __init__(inout self, v: Self.Vect, r: Self.Roto = None): self.s = r.s self.v = v self.i = r.i @always_inline fn __init__(inout self, r: Self.Roto): self.s = r.s self.v = None self.i = r.i @always_inline fn __init__(inout self, m: Self.Lane): self.s = m.s self.v = m.v self.i = m.i # +------( Subscript )------+ # # @always_inline fn get_lane(self, index: Int) -> Self.Lane: return Self.Lane(self.s[index], self.v.x[index], self.v.y[index], self.i[index]) @always_inline fn set_lane(inout self, index: Int, value: Self.Lane): self.s[index] = value.s self.v.x[index] = value.v.x self.v.y[index] = value.v.y self.i[index] = value.i @always_inline fn vector(self) -> Self.Vect: return Self.Vect(self.v.x, self.v.y) @always_inline fn rotor(self) -> Self.Roto: return Self.Roto(self.s, self.i) # +------( Cast )------+ # # @always_inline fn __all__(self) -> Bool: return self.__simd_bool__().reduce_and() @always_inline fn __any__(self) -> Bool: return self.__simd_bool__().reduce_or() @always_inline fn __bool__(self) -> Bool: return self.__simd_bool__().__bool__() @always_inline fn __simd_bool__(self) -> SIMD[DType.bool, size]: return self.is_null() @always_inline fn is_null(self) -> SIMD[DType.bool, size]: return self.nom() == 0 @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: return (self.s == 0) & self.v.is_zero() & (self.i == 0) # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): self.format_to["\n"](writer) @no_inline fn format_to[sep: StringLiteral](self, inout writer: Formatter): @parameter if size == 1: writer.write(self.s, " + ", self.v.x, "x + ", self.v.y, "y + ", self.i, "i") else: @parameter for lane in range(size - 1): self.get_lane(lane).format_to(writer) writer.write(sep) self.get_lane(size - 1).format_to(writer) # +------( Comparison )------+ # # @always_inline fn __eq__(self, other: Self) -> SIMD[DType.bool, size]: return (self.s == other.s) & (self.v == other.v) & (self.i == other.i) @always_inline fn __eq__(self, other: Self.Roto) -> SIMD[DType.bool, size]: return (self.s == other.s) & (self.v == Self.Vect()) & (self.i == other.i) @always_inline fn __eq__(self, other: Self.Coef) -> SIMD[DType.bool, size]: return (self.s == other) & (self.v == Self.Vect()) & (self.i == 0) @always_inline fn __eq__(self, other: Self.Vect) -> SIMD[DType.bool, size]: return (self.s == 0) & (self.v == other) & (self.i == 0) @always_inline fn __eq__[__: None = None](self, other: Self) -> Bool: return self.__eq__(other).reduce_and() @always_inline fn __eq__[__: None = None](self, other: Self.Roto) -> Bool: return self.__eq__(other).reduce_and() @always_inline fn __eq__[__: None = None](self, other: Self.Coef) -> Bool: return self.__eq__(other).reduce_and() @always_inline fn __eq__[__: None = None](self, other: Self.Vect) -> Bool: return self.__eq__(other).reduce_and() @always_inline fn __ne__(self, other: Self) -> SIMD[DType.bool, size]: return (self.s != other.s) | (self.v != other.v) | (self.i != other.i) @always_inline fn __ne__(self, other: Self.Roto) -> SIMD[DType.bool, size]: return (self.s != other.s) | (self.v != Self.Vect()) | (self.i != other.i) @always_inline fn __ne__(self, other: Self.Coef) -> SIMD[DType.bool, size]: return (self.s != other) | (self.v != Self.Vect()) | (self.i != 0) @always_inline fn __ne__(self, other: Self.Vect) -> SIMD[DType.bool, size]: return (self.s != 0) | (self.v != other) | (self.i != 0) @always_inline fn __ne__[__: None = None](self, other: Self) -> Bool: return self.__ne__(other).reduce_or() @always_inline fn __ne__[__: None = None](self, other: Self.Roto) -> Bool: return self.__ne__(other).reduce_or() @always_inline fn __ne__[__: None = None](self, other: Self.Coef) -> Bool: return self.__ne__(other).reduce_or() @always_inline fn __ne__[__: None = None](self, other: Self.Vect) -> Bool: return self.__ne__(other).reduce_or() # +------( Unary )------+ # # @always_inline fn __neg__(self) -> Self: return Self(-self.s, -self.v, -self.i) @always_inline fn __invert__(self) -> Self: return self.coj() / self.den() @always_inline fn rev(self) -> Self: return Self(self.s, self.v.x, self.v.y, -self.i) @always_inline fn inv(self) -> Self: return Self(self.s, -self.v.x, -self.v.y, self.i) @always_inline fn coj(self) -> Self: return Self(self.s, -self.v.x, -self.v.y, -self.i) @always_inline fn det(self) -> Self.Coef: return (self.s * self.i) - (self.v.x * self.v.y) @always_inline fn den(self) -> Self.Coef: return (self.s * self.s) - (self.v.x * self.v.x) - (self.v.y * self.v.y) + (self.i * self.i) @always_inline fn inn(self) -> Self.Coef: return (self.s * self.s) + (self.v.x * self.v.x) + (self.v.y * self.v.y) + (self.i * self.i) @always_inline fn nom(self) -> Self.Coef: return sqrt(self.inn()) @always_inline fn normalized[degen: Optional[Self] = None](self) -> Self: @parameter if degen: if self.is_zero(): return degen.unsafe_value() return self / self.nom() @always_inline fn trans(self, other: Self) -> Self: return (self.v + other.v) + (self.rotor() * other.rotor()) # +------( Arithmetic )------+ # # @always_inline fn __add__(self, other: Self.Coef) -> Self: return Self(self.s + other, self.v, self.i) @always_inline fn __add__(self, other: Self.Vect) -> Self: return Self(self.s, self.v + other, self.i) @always_inline fn __add__(self, other: Self.Roto) -> Self: return Self(self.s + other.s, self.v, self.i + other.i) @always_inline fn __add__(self, other: Self) -> Self: return Self(self.s + other.s, self.v + other.v, self.i + other.i) @always_inline fn __sub__(self, other: Self.Coef) -> Self: return Self(self.s - other, self.v, self.i) @always_inline fn __sub__(self, other: Self.Vect) -> Self: return Self(self.s, self.v - other, self.i) @always_inline fn __sub__(self, other: Self.Roto) -> Self: return Self(self.s - other.s, self.v, self.i - other.i) @always_inline fn __sub__(self, other: Self) -> Self: return Self(self.s - other.s, self.v - other.v, self.i - other.i) @always_inline fn __mul__(self, other: Self.Coef) -> Self: return Self(self.s * other, self.v * other, self.i * other) @always_inline fn __mul__(self, other: Self.Vect) -> Self: return Self( self.v.x * other.x + self.v.y * other.y, self.s * other.x + self.i * other.y, self.s * other.y - self.i * other.x, self.v.x * other.y - self.v.y * other.x, ) @always_inline fn __mul__(self, other: Self.Roto) -> Self: return Self( self.s * other.s - self.i * other.i, self.v.x * other.s - self.v.y * other.i, self.v.y * other.s + self.v.x * other.i, self.s * other.i + self.i * other.s, ) @always_inline fn __mul__(self, other: Self) -> Self: return Self( self.s * other.s + self.v.x * other.v.x + self.v.y * other.v.y - self.i * other.i, self.s * other.v.x + self.v.x * other.s + self.i * other.v.y - self.v.y * other.i, self.s * other.v.y + self.v.y * other.s - self.i * other.v.x + self.v.x * other.i, self.s * other.i + self.i * other.s + self.v.x * other.v.y - self.v.y * other.v.x, ) @always_inline fn __truediv__(self, other: Self.Coef) -> Self: return Self(self.s / other, self.v.x / other, self.v.y / other, self.i / other) @always_inline fn __truediv__(self, other: Self.Vect) -> Self: return self * ~other @always_inline fn __truediv__(self, other: Self.Roto) -> Self: return self * ~other @always_inline fn __truediv__(self, other: Self) -> Self: return self * ~other # +------( Reverse Arithmetic )------+ # # @always_inline fn __radd__(rhs, lhs: Self.Coef) -> Self: return Self(lhs + rhs.s, rhs.v, rhs.i) @always_inline fn __rsub__(rhs, lhs: Self.Coef) -> Self: return Self(lhs - rhs.s, -rhs.v, -rhs.i) @always_inline fn __rmul__(rhs, lhs: Self.Coef) -> Self: return Self(lhs * rhs.s, lhs * rhs.v, lhs * rhs.i) @always_inline fn __rtruediv__(rhs, lhs: Self.Coef) -> Self: return (lhs * rhs.coj()) / rhs.den() # +------( In-place Arithmetic )------+ # # @always_inline fn __iadd__(inout self, other: Self.Coef): self = self + other @always_inline fn __iadd__(inout self, other: Self.Vect): self = self + other @always_inline fn __iadd__(inout self, other: Self.Roto): self = self + other @always_inline fn __iadd__(inout self, other: Self): self = self + other @always_inline fn __isub__(inout self, other: Self.Coef): self = self - other @always_inline fn __isub__(inout self, other: Self.Vect): self = self - other @always_inline fn __isub__(inout self, other: Self.Roto): self = self - other @always_inline fn __isub__(inout self, other: Self): self = self - other @always_inline fn __imul__(inout self, other: Self.Coef): self = self * other @always_inline fn __imul__(inout self, other: Self.Vect): self = self * other @always_inline fn __imul__(inout self, other: Self.Roto): self = self * other @always_inline fn __imul__(inout self, other: Self): self = self * other @always_inline fn __itruediv__(inout self, other: Self.Coef): self = self / other @always_inline fn __itruediv__(inout self, other: Self.Vect): self = self / other @always_inline fn __itruediv__(inout self, other: Self.Roto): self = self / other @always_inline fn __itruediv__(inout self, other: Self): self = self / other # +------( Min / Max )------+ # # @always_inline fn __max__(self, other: Self) -> Self: return Self( max(self.s, other.s), max(self.v.x, other.v.x), max(self.v.y, other.v.y), max(self.i, other.i), ) @always_inline fn __min__(self, other: Self) -> Self: return Self( min(self.s, other.s), min(self.v.x, other.v.x), min(self.v.y, other.v.y), min(self.i, other.i), ) @always_inline fn max_coef(self) -> SIMD[type, size]: return max(max(max(self.s, self.v.x), self.v.y), self.i) @always_inline fn min_coef(self) -> SIMD[type, size]: return min(min(min(self.s, self.v.x), self.v.y), self.i) @always_inline fn reduce_max_coef(self) -> Scalar[type]: """Reduces across every coefficient present within this structure.""" return max( max(self.s.reduce_max(), self.v.x.reduce_max()), max(self.v.y.reduce_max(), self.i.reduce_max()), ) @always_inline fn reduce_min_coef(self) -> Scalar[type]: """Reduces across every coefficient present within this structure.""" return min( min(self.s.reduce_min(), self.v.x.reduce_min()), min(self.v.y.reduce_min(), self.i.reduce_min()), ) @always_inline fn reduce_max_compose(self) -> Self.Lane: """Treats each basis channel independently, then uses those to constuct a new multivector. """ return Self.Lane( self.s.reduce_max(), self.v.x.reduce_max(), self.v.y.reduce_max(), self.i.reduce_max(), ) @always_inline fn reduce_min_compose(self) -> Self.Lane: """Treats each basis channel independently, then uses those to constuct a new multivector. """ return Self.Lane( self.s.reduce_min(), self.v.x.reduce_min(), self.v.y.reduce_min(), self.i.reduce_min(), ) # +--------------------------------------------------------------------------+ # # | G2 Rotor # +--------------------------------------------------------------------------+ # # @register_passable("trivial") struct Rotor[type: DType = DType.float64, size: Int = 1]( StringableCollectionElement, Formattable, EqualityComparable ): """The real and anti parts of a Multivector G2. Useful for rotating vectors.""" # +------[ Alias ]------+ # # alias Coef = SIMD[type, size] alias Vect = Vector[type, size] alias Multi = Multivector[type, size] alias Lane = Rotor[type, 1] # +------< Data >------+ # # var s: Self.Coef """The scalar part.""" var i: Self.Coef """The antiox part.""" # +------( Initialization )------+ # # @always_inline fn __init__(inout self, none: None = None): self.s = 0 self.i = 0 @always_inline fn __init__(inout self, s: Self.Coef, i: Self.Coef = 0): self.s = s self.i = i @always_inline fn __init__(inout self, v: Self.Lane): self.s = v.s self.i = v.i @always_inline fn __init__(inout self, *, angle: Self.Coef): self.s = cos(angle) self.i = sin(angle) # +------( Subscript )------+ # # @always_inline fn get_lane(self, i: Int) -> Self.Lane: return Self.Lane(self.s[i], self.i[i]) @always_inline fn set_lane(inout self, i: Int, item: Self.Lane): self.s[i] = item.s self.i[i] = item.i # +------( Cast )------+ # # @always_inline fn __all__(self) -> Bool: return self.__simd_bool__().reduce_and() @always_inline fn __any__(self) -> Bool: return self.__simd_bool__().reduce_or() @always_inline fn __bool__(self) -> Bool: return self.__simd_bool__().__bool__() @always_inline fn __simd_bool__(self) -> SIMD[DType.bool, size]: return self.is_null() @always_inline fn is_null(self) -> SIMD[DType.bool, size]: return self.nom() == 0 @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: return (self.s == 0) & (self.i == 0) # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): self.format_to["\n"](writer) @no_inline fn format_to[sep: StringLiteral](self, inout writer: Formatter): @parameter if size == 1: writer.write(self.s, " + ", self.i, "i") else: @parameter for lane in range(size - 1): self.get_lane(lane).format_to(writer) writer.write(sep) self.get_lane(size - 1).format_to(writer) # +------( Comparison )------+ # # @always_inline fn __eq__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other == self @always_inline fn __eq__(self, other: Self) -> SIMD[DType.bool, size]: return (self.s == other.s) & (self.i == other.i) @always_inline fn __eq__(self, other: Self.Coef) -> SIMD[DType.bool, size]: return (self.s == other) & (self.i == 0) @always_inline fn __eq__[__: None = None](self, other: Self.Multi) -> Bool: return all(self.__eq__(other)) @always_inline fn __eq__[__: None = None](self, other: Self) -> Bool: return all(self.__eq__(other)) @always_inline fn __eq__[__: None = None](self, other: Self.Coef) -> Bool: return all(self.__eq__(other)) @always_inline fn __ne__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other != self @always_inline fn __ne__(self, other: Self) -> SIMD[DType.bool, size]: return (self.s != other.s) | (self.i != other.i) @always_inline fn __ne__(self, other: Self.Coef) -> SIMD[DType.bool, size]: return (self.s != other) | (self.i != 0) @always_inline fn __ne__[__: None = None](self, other: Self.Multi) -> Bool: return any(self.__ne__(other)) @always_inline fn __ne__[__: None = None](self, other: Self) -> Bool: return any(self.__ne__(other)) @always_inline fn __ne__[__: None = None](self, other: Self.Coef) -> Bool: return any(self.__ne__(other)) # +------( Unary )------+ # # @always_inline fn __neg__(self) -> Self: return Self(-self.s, -self.i) @always_inline fn __invert__(self) -> Self: return self.coj() / self.den() @always_inline fn rev(self) -> Self: return Self(self.s, -self.i) @always_inline fn inv(self) -> Self: return Self(self.s, self.i) @always_inline fn coj(self) -> Self: return Self(self.s, -self.i) @always_inline fn det(self) -> Self.Coef: return self.s * self.i @always_inline fn den(self) -> Self.Coef: return (self.s * self.s) + (self.i * self.i) @always_inline fn inn(self) -> Self.Coef: return (self.s * self.s) + (self.i * self.i) @always_inline fn nom(self) -> Self.Coef: return sqrt(self.inn()) @always_inline fn arg(self) -> Self.Coef: return atan2(self.i, self.s) @always_inline fn normalized[degen: Optional[Self] = None](self) -> Self: @parameter if degen: if self.is_zero(): return degen.unsafe_value() return self / self.nom() # +------( Operations )------+ # # @always_inline fn __add__(self, other: Self.Coef) -> Self: return Self(self.s + other, self.i) @always_inline fn __add__(self, other: Self.Vect) -> Self.Multi: return Self.Multi(self.s, other.x, other.y, self.i) @always_inline fn __add__(self, other: Self) -> Self: return Self(self.s + other.s, self.i + other.i) @always_inline fn __add__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(self.s + other.s, other.v.x, other.v.y, self.i + other.i) @always_inline fn __sub__(self, other: Self.Coef) -> Self: return Self(self.s - other, self.i) @always_inline fn __sub__(self, other: Self.Vect) -> Self.Multi: return Self.Multi(self.s, -other.x, -other.y, self.i) @always_inline fn __sub__(self, other: Self) -> Self: return Self(self.s - other.s, self.i - other.i) @always_inline fn __sub__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(self.s - other.s, -other.v.x, -other.v.y, self.i - other.i) @always_inline fn __mul__(self, other: Self.Coef) -> Self: return Self(self.s * other, self.i * other) @always_inline fn __mul__(self, other: Self.Vect) -> Self.Vect: return Self.Vect( self.s * other.x + self.i * other.y, self.s * other.y - self.i * other.x, ) @always_inline fn __mul__(self, other: Self) -> Self: return Self( self.s * other.s - self.i * other.i, self.s * other.i + self.i * other.s, ) @always_inline fn __mul__(self, other: Self.Multi) -> Self.Multi: return Self.Multi( self.s * other.s - self.i * other.i, self.s * other.v.x + self.i * other.v.y, self.s * other.v.y - self.i * other.v.x, self.s * other.i + self.i * other.s, ) @always_inline fn __truediv__(self, other: Self.Coef) -> Self: return Self(self.s / other, self.i / other) @always_inline fn __truediv__(self, other: Self.Vect) -> Self.Vect: return self * ~other @always_inline fn __truediv__(self, other: Self) -> Self: return self * ~other @always_inline fn __truediv__(self, other: Self.Multi) -> Self.Multi: return self * ~other # +------( Reverse Arithmetic )------+ # # @always_inline fn __radd__(rhs, lhs: Self.Coef) -> Self: return Self(lhs + rhs.s, rhs.i) @always_inline fn __rsub__(rhs, lhs: Self.Coef) -> Self: return Self(lhs - rhs.s, -rhs.i) @always_inline fn __rmul__(rhs, lhs: Self.Coef) -> Self: return Self(lhs * rhs.s, lhs * rhs.i) @always_inline fn __rtruediv__(rhs, lhs: Self.Coef) -> Self: return (lhs * rhs.coj()) / rhs.den() # +------( In-place Arithmetic )------+ # # @always_inline fn __iadd__(inout self, other: Self.Coef): self = self + other @always_inline fn __iadd__(inout self, other: Self): self = self + other @always_inline fn __isub__(inout self, other: Self.Coef): self = self - other @always_inline fn __isub__(inout self, other: Self): self = self - other @always_inline fn __imul__(inout self, other: Self.Coef): self = self * other @always_inline fn __imul__(inout self, other: Self): self = self * other @always_inline fn __itruediv__(inout self, other: Self.Coef): self = self / other @always_inline fn __itruediv__(inout self, other: Self): self = self / other # +--------------------------------------------------------------------------+ # # | G2 Vector # +--------------------------------------------------------------------------+ # # @register_passable("trivial") struct Vector[type: DType = DType.float64, size: Int = 1]( StringableCollectionElement, Formattable, EqualityComparable ): # +------[ Alias ]------+ # # alias Coef = SIMD[type, size] alias Roto = Rotor[type, size] alias Multi = Multivector[type, size] alias Lane = Vector[type, 1] # +------< Data >------+ # # var x: Self.Coef """The x component.""" var y: Self.Coef """The y component.""" # +------( initialize )------+ # # @always_inline fn __init__(inout self, none: None = None): self.x = 0 self.y = 0 @always_inline fn __init__(inout self, x: Self.Coef, y: Self.Coef): self.x = x self.y = y @always_inline fn __init__(inout self, v: Self.Lane): self.x = v.x self.y = v.y # +------( Subscript )------+ # # @always_inline fn get_lane(self, i: Int) -> Self.Lane: return Self.Lane(self.x[i], self.y[i]) @always_inline fn set_lane(inout self, i: Int, item: Self.Lane): self.x[i] = item.x self.y[i] = item.y # +------( Cast )------+ # # @always_inline fn __all__(self) -> Bool: return self.__simd_bool__().reduce_and() @always_inline fn __any__(self) -> Bool: return self.__simd_bool__().reduce_or() @always_inline fn __bool__(self) -> Bool: return self.__simd_bool__().__bool__() @always_inline fn __simd_bool__(self) -> SIMD[DType.bool, size]: return self.is_null() @always_inline fn is_null(self) -> SIMD[DType.bool, size]: return self.nom() == 0 @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: return (self.x == 0) & (self.y == 0) # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): self.format_to["\n"](writer) @no_inline fn format_to[sep: StringLiteral](self, inout writer: Formatter): @parameter if size == 1: writer.write(self.x, "x + ", self.y, "y") else: @parameter for lane in range(size - 1): self.get_lane(lane).format_to(writer) writer.write(sep) self.get_lane(size - 1).format_to(writer) # +------( Comparison )------+ # # @always_inline fn __eq__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other == self @always_inline fn __eq__(self, other: Self) -> SIMD[DType.bool, size]: return (self.x == other.x) & (self.y == other.y) @always_inline fn __eq__[__: None = None](self, other: Self.Multi) -> Bool: return all(self.__eq__(other)) @always_inline fn __eq__[__: None = None](self, other: Self) -> Bool: return all(self.__eq__(other)) @always_inline fn __ne__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other != self @always_inline fn __ne__(self, other: Self) -> SIMD[DType.bool, size]: return (self.x != other.x) | (self.y != other.y) @always_inline fn __ne__[__: None = None](self, other: Self.Multi) -> Bool: return any(self.__ne__(other)) @always_inline fn __ne__[__: None = None](self, other: Self) -> Bool: return any(self.__ne__(other)) # +------( Unary )------+ # # @always_inline fn __neg__(self) -> Self: return Self(-self.x, -self.y) @always_inline fn __invert__(self) -> Self: return self.coj() / self.det() @always_inline fn rev(self) -> Self: return Self(self.x, self.y) @always_inline fn inv(self) -> Self: return Self(-self.x, -self.y) @always_inline fn coj(self) -> Self: return Self(-self.x, -self.y) @always_inline fn det(self) -> Self.Coef: return -(self.x * self.y) @always_inline fn den(self) -> Self.Coef: return -(self.x * self.x) - (self.y * self.y) @always_inline fn inn(self) -> Self.Coef: return (self.x * self.x) + (self.y * self.y) @always_inline fn nom(self) -> Self.Coef: return sqrt(self.inn()) @always_inline fn arg(self) -> Self.Coef: return atan2(self.y, self.x) @always_inline fn nrm(self) -> Self: return Self(self.y, -self.x) @always_inline fn normalized[degen: Optional[Self] = None](self) -> Self: @parameter if degen: if self.is_zero(): return degen.unsafe_value() return self / self.nom() # +------( Products )------+ # # @always_inline fn inner(self, other: Self) -> Self.Coef: return self.x * other.x + self.y * other.y @always_inline fn outer(self, other: Self) -> Self.Coef: # TODO: should return a bivector return self.x * other.y - self.y * other.x @always_inline fn reger(self, other: Self) -> Self.Coef: return self.y * other.x - self.x * other.y # +------( Arithmetic )------+ # # @always_inline fn __add__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(other, self.x, self.y, 0) @always_inline fn __add__(self, other: Self) -> Self: return Self(self.x + other.x, self.y + other.y) @always_inline fn __add__(self, other: Self.Roto) -> Self.Multi: return Self.Multi(other.s, self.x, self.y, other.i) @always_inline fn __add__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(other.s, self.x + other.v.x, self.y + other.v.y, other.i) @always_inline fn __sub__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(-other, self.x, self.y, 0) @always_inline fn __sub__(self, other: Self) -> Self: return Self(self.x - other.x, self.y - other.y) @always_inline fn __sub__(self, other: Self.Roto) -> Self.Multi: return Self.Multi(-other.s, self.x, self.y, -other.i) @always_inline fn __sub__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(-other.s, self.x - other.v.x, self.y - other.v.y, -other.i) @always_inline fn __mul__(self, other: Self.Coef) -> Self: return Self(self.x * other, self.y * other) @always_inline fn __mul__(self, other: Self) -> Self.Roto: return Self.Roto( self.x * other.x + self.y * other.y, self.x * other.y - self.y * other.x, ) @always_inline fn __mul__(self, other: Self.Roto) -> Self: return Self( self.x * other.s - self.y * other.i, self.y * other.s + self.x * other.i, ) @always_inline fn __mul__(self, other: Self.Multi) -> Self.Multi: return Self.Multi( self.x * other.v.x + self.y * other.v.y, self.x * other.s - self.y * other.i, self.y * other.s + self.x * other.i, self.x * other.v.y - self.y * other.v.x, ) @always_inline fn __truediv__(self, other: Self.Coef) -> Self: return Self(self.x / other, self.y / other) @always_inline fn __truediv__(self, other: Self.Roto) -> Self: return self * ~other @always_inline fn __truediv__(self, other: Self) -> Self.Roto: return self * ~other @always_inline fn __truediv__(self, other: Self.Multi) -> Self.Multi: return self * ~other # +------( Reverse Arithmetic )------+ # # @always_inline fn __radd__(rhs, lhs: Self.Coef) -> Self.Multi: return Self.Multi(lhs, rhs, 0) @always_inline fn __rsub__(rhs, lhs: Self.Coef) -> Self.Multi: return Self.Multi(lhs, -rhs, 0) @always_inline fn __rmul__(rhs, lhs: Self.Coef) -> Self: return Self(lhs * rhs.x, lhs * rhs.y) @always_inline fn __rtruediv__(rhs, lhs: Self.Coef) -> Self: return (lhs * rhs.coj()) / rhs.den() # +------( In-place Arithmetic )------+ # # @always_inline fn __iadd__(inout self, other: Self): self = self + other @always_inline fn __isub__(inout self, other: Self): self = self - other @always_inline fn __imul__(inout self, other: Self.Coef): self = self * other @always_inline fn __imul__(inout self, other: Self.Roto): self = self * other @always_inline fn __itruediv__(inout self, other: Self.Coef): self = self / other @always_inline fn __itruediv__(inout self, other: Self.Roto): self = self / other --- src/hard/g3.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # """Defines a G3 Multivector, and it's subspaces. Cl(3,0,0) ⇔ Mat2x2(C) `x*x = y*y = z*z = 1` `x*y = i` `x*z = j` `y*z = k` `i*i = j*j = k*k = a*a = -1` """ # +----------------------------------------------------------------------------------------------+ # # | G3 Multivector # +----------------------------------------------------------------------------------------------+ # # @register_passable("trivial") struct Multivector[type: DType = DType.float64, size: Int = 1]( StringableCollectionElement, Formattable, EqualityComparable ): """A G3 Multivector.""" # +------[ Alias ]------+ # # alias Lane = Multivector[type, 1] alias Rotor = Rotor[type, size] alias Coef = SIMD[type, size] alias Vect = Vector[type, size] alias Bive = Bivector[type, size] alias Anti = Antiox[type, size] # +------< Data >------+ # # var s: Self.Coef var v: Self.Vect var b: Self.Bive var a: Self.Anti # +------( Initialize )------+ # # fn __init__(inout self, none: None = None): self.s = 0 self.v = None self.b = None self.a = None fn __init__( inout self, s: Self.Coef, x: Self.Coef, y: Self.Coef, z: Self.Coef, i: Self.Coef, j: Self.Coef, k: Self.Coef, a: Self.Coef, ): self.s = s self.v = Self.Vect(x, y, z) self.b = Self.Bive(i, j, k) self.a = a fn __init__( inout self, s: Self.Coef, v: Self.Vect = None, b: Self.Bive = None, a: Self.Anti = None ): self.s = s self.v = v self.b = b self.a = a # +------( Subscript )------+ # # @always_inline fn get_lane(self, idx: Int) -> Self.Lane: return Self.Lane( self.s[idx], self.v.x[idx], self.v.y[idx], self.v.z[idx], self.b.i[idx], self.b.j[idx], self.b.k[idx], self.a.a[idx], ) @always_inline fn set_lane(inout self, idx: Int, value: Self.Lane): self.s[idx] = value.s self.v.x[idx] = value.v.x self.v.y[idx] = value.v.y self.v.z[idx] = value.v.z self.b.i[idx] = value.b.i self.b.j[idx] = value.b.j self.b.k[idx] = value.b.k self.a.a[idx] = value.a.a # +------( Cast )------+ # # @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: return (self.s == 0) & self.v.is_zero() & self.b.is_zero() & self.a.is_zero() # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): self.format_to["\n"](writer) @no_inline fn format_to[sep: StringLiteral](self, inout writer: Formatter): @parameter if size == 1: writer.write( self.s, " + ", self.v.x, "x + ", self.v.y, "y + ", self.v.z, "z + ", self.b.i, "i + ", self.b.j, "j + ", self.b.k, "k + ", self.a.a, "a", ) else: @parameter for lane in range(size - 1): self.get_lane(lane).format_to(writer) writer.write(sep) self.get_lane(size - 1).format_to(writer) # +------( Comparison )------+ # # fn __eq__(self, other: Self) -> SIMD[DType.bool, size]: return (self.s == other.s) & (self.v == other.v) & (self.b == other.b) & (self.a == other.a) fn __eq__(self, other: Self.Rotor) -> SIMD[DType.bool, size]: return ( (self.s == other.s) & (self.v == Self.Vect()) & (self.b == other.b) & (self.a == Self.Anti()) ) fn __eq__(self, other: Self.Coef) -> SIMD[DType.bool, size]: return ( (self.s == other) & (self.v == Self.Vect()) & (self.b == Self.Bive()) & (self.a == Self.Anti()) ) fn __eq__(self, other: Self.Vect) -> SIMD[DType.bool, size]: return (self.s == 0) & (self.v == other) & (self.b == Self.Bive()) & (self.a == Self.Anti()) fn __eq__(self, other: Self.Bive) -> SIMD[DType.bool, size]: return (self.s == 0) & (self.v == Self.Vect()) & (self.b == other) & (self.a == Self.Anti()) fn __eq__(self, other: Self.Anti) -> SIMD[DType.bool, size]: return (self.s == 0) & (self.v == Self.Vect()) & (self.b == Self.Bive()) & (self.a == other) fn __eq__[__: None = None](self, other: Self) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self.Rotor) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self.Coef) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self.Vect) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self.Bive) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self.Anti) -> Bool: return self.__eq__(other).reduce_and() fn __ne__(self, other: Self) -> SIMD[DType.bool, size]: return (self.s != other.s) | (self.v != other.v) | (self.b != other.b) | (self.a != other.a) fn __ne__(self, other: Self.Rotor) -> SIMD[DType.bool, size]: return ( (self.s != other.s) | (self.v != Self.Vect()) | (self.b != other.b) | (self.a != Self.Anti()) ) fn __ne__(self, other: Self.Coef) -> SIMD[DType.bool, size]: return ( (self.s != other) | (self.v != Self.Vect()) | (self.b != Self.Bive()) | (self.a != Self.Anti()) ) fn __ne__(self, other: Self.Vect) -> SIMD[DType.bool, size]: return (self.s != 0) | (self.v != other) | (self.b != Self.Bive()) | (self.a != Self.Anti()) fn __ne__(self, other: Self.Bive) -> SIMD[DType.bool, size]: return (self.s != 0) | (self.v != Self.Vect()) | (self.b != other) | (self.a != Self.Anti()) fn __ne__(self, other: Self.Anti) -> SIMD[DType.bool, size]: return (self.s != 0) | (self.v != Self.Vect()) | (self.b != Self.Bive()) | (self.a != other) fn __ne__[__: None = None](self, other: Self) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self.Rotor) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self.Coef) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self.Vect) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self.Bive) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self.Anti) -> Bool: return self.__ne__(other).reduce_or() # +------( Operations )------+ # # fn __neg__(self) -> Self: return Self(-self.s, -self.v, -self.b, -self.a) # +------( Arithmetic )------+ # # fn __add__(self, other: Self) -> Self: return Self(self.s + other.s, self.v + other.v, self.b + other.b, self.a + other.a) fn __add__(self, other: Self.Rotor) -> Self: return Self(self.s + other.s, self.v, self.b + other.b, self.a) fn __add__(self, other: Self.Coef) -> Self: return Self(self.s + other, self.v, self.b, self.a) fn __add__(self, other: Self.Vect) -> Self: return Self(self.s, self.v + other, self.b, self.a) fn __add__(self, other: Self.Bive) -> Self: return Self(self.s, self.v, self.b + other, self.a) fn __add__(self, other: Self.Anti) -> Self: return Self(self.s, self.v, self.b, self.a + other) fn __sub__(self, other: Self) -> Self: return Self(self.s - other.s, self.v - other.v, self.b - other.b, self.a - other.a) fn __sub__(self, other: Self.Rotor) -> Self: return Self(self.s - other.s, self.v, self.b - other.b, self.a) fn __sub__(self, other: Self.Coef) -> Self: return Self(self.s - other, self.v, self.b, self.a) fn __sub__(self, other: Self.Vect) -> Self: return Self(self.s, self.v - other, self.b, self.a) fn __sub__(self, other: Self.Bive) -> Self: return Self(self.s, self.v, self.b - other, self.a) fn __sub__(self, other: Self.Anti) -> Self: return Self(self.s, self.v, self.b, self.a - other) fn __mul__(self, other: Self) -> Self: return ( +self.s * other.s + self.s * other.v + self.s * other.b + self.s * other.a + self.v * other.s + self.v * other.v + self.v * other.b + self.v * other.a + self.b * other.s + self.b * other.v + self.b * other.b + self.b * other.a + self.a * other.s + self.a * other.v + self.a * other.b + self.a * other.a ) fn __mul__(self, other: Self.Rotor) -> Self: return ( +self.s * other.s + self.s * other.b + self.v * other.s + self.v * other.b + self.b * other.s + self.b * other.b + self.a * other.s + self.a * other.b ) fn __mul__(self, other: Self.Coef) -> Self: return Self(self.s * other, self.v * other, self.b * other, self.a * other) fn __mul__(self, other: Self.Vect) -> Self: return +self.s * other + self.v * other + self.b * other + self.a * other fn __mul__(self, other: Self.Bive) -> Self: return +self.s * other + self.v * other + self.b * other + self.a * other fn __mul__(self, other: Self.Anti) -> Self: return Self(self.a * other, self.b * other, self.v * other, self.s * other) # +------( Reverse Arithmetic )------+ # # fn __radd__(self, other: Self.Coef) -> Self: return Self(other + self.s, self.v, self.b, self.a) fn __rsub__(self, other: Self.Coef) -> Self: return Self(other - self.s, self.v, self.b, self.a) fn __rmul__(self, other: Self.Coef) -> Self: return Self(other * self.s, other * self.v, other * self.b, other * self.a) # +----------------------------------------------------------------------------------------------+ # # | G3 Rotor # +----------------------------------------------------------------------------------------------+ # # @register_passable("trivial") struct Rotor[type: DType = DType.float64, size: Int = 1]( StringableCollectionElement, Formattable, EqualityComparable ): """A G3 Rotor. The even sub-algebra of G3. Isomorphic with Quaternions.""" # +------[ Alias ]------+ # # alias Lane = Rotor[type, 1] alias Multi = Multivector[type, size] alias Coef = SIMD[type, size] alias Vect = Vector[type, size] alias Bive = Bivector[type, size] alias Anti = Antiox[type, size] # +------< Data >------+ # # var s: Self.Coef var b: Self.Bive # +------( Initialize )------+ # # fn __init__(inout self, none: None = None): self.s = 0 self.b = None fn __init__(inout self, s: Self.Coef, i: Self.Coef, j: Self.Coef, k: Self.Coef): self.s = s self.b = Self.Bive(i, j, k) fn __init__(inout self, s: Self.Coef, b: Self.Bive = None): self.s = s self.b = b # +------( Subscript )------+ # # @always_inline fn get_lane(self, idx: Int) -> Self.Lane: return Self.Lane(self.s[idx], self.b.i[idx], self.b.j[idx], self.b.k[idx]) @always_inline fn set_lane(inout self, idx: Int, value: Self.Lane): self.s[idx] = value.s self.b.i[idx] = value.b.i self.b.j[idx] = value.b.j self.b.k[idx] = value.b.k # +------( Cast )------+ # # @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: return (self.s == 0) & self.b.is_zero() # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): self.format_to["\n"](writer) @no_inline fn format_to[sep: StringLiteral](self, inout writer: Formatter): @parameter if size == 1: writer.write(self.s, " + ", self.b.i, "i + ", self.b.j, "j + ", self.b.k, "k") else: @parameter for lane in range(size - 1): self.get_lane(lane).format_to(writer) writer.write(sep) self.get_lane(size - 1).format_to(writer) # +------( Comparison )------+ # # fn __eq__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other == self fn __eq__(self, other: Self) -> SIMD[DType.bool, size]: return (self.s == other.s) & (self.b == other.b) fn __eq__(self, other: Self.Coef) -> SIMD[DType.bool, size]: return (self.s == other) & (self.b == Self.Bive()) fn __eq__(self, other: Self.Bive) -> SIMD[DType.bool, size]: return (self.s == 0) & (self.b == other) fn __eq__[__: None = None](self, other: Self.Multi) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self.Coef) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self.Bive) -> Bool: return self.__eq__(other).reduce_and() fn __ne__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other != self fn __ne__(self, other: Self) -> SIMD[DType.bool, size]: return (self.s != other.s) | (self.b != other.b) fn __ne__(self, other: Self.Coef) -> SIMD[DType.bool, size]: return (self.s != other) | (self.b != Self.Bive()) fn __ne__(self, other: Self.Bive) -> SIMD[DType.bool, size]: return (self.s != 0) | (self.b != other) fn __ne__[__: None = None](self, other: Self.Multi) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self.Coef) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self.Bive) -> Bool: return self.__ne__(other).reduce_or() # +------( Operations )------+ # # fn __neg__(self) -> Self: return Self(-self.s, -self.b) # +------( Arithmetic )------+ # # fn __add__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(self.s + other.s, other.v, self.b + other.b, other.a) fn __add__(self, other: Self) -> Self: return Self(self.s + other.s, self.b + other.b) fn __add__(self, other: Self.Coef) -> Self: return Self(self.s + other, self.b) fn __add__(self, other: Self.Vect) -> Self.Multi: return Self.Multi(self.s, other, self.b, None) fn __add__(self, other: Self.Bive) -> Self: return Self(self.s, self.b + other) fn __add__(self, other: Self.Anti) -> Self.Multi: return Self.Multi(self.s, None, self.b, other) fn __sub__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(self.s - other.s, -other.v, self.b - other.b, -other.a) fn __sub__(self, other: Self) -> Self: return Self(self.s - other.s, self.b - other.b) fn __sub__(self, other: Self.Coef) -> Self: return Self(self.s - other, self.b) fn __sub__(self, other: Self.Vect) -> Self.Multi: return Self.Multi(self.s, -other, self.b, None) fn __sub__(self, other: Self.Bive) -> Self: return Self(self.s, self.b - other) fn __sub__(self, other: Self.Anti) -> Self.Multi: return Self.Multi(self.s, None, self.b, -other) fn __mul__(self, other: Self.Multi) -> Self.Multi: return self.s * other + self.b * other fn __mul__(self, other: Self) -> Self: return self.s * other + self.b * other fn __mul__(self, other: Self.Vect) -> Self.Multi: return self.s * other + self.b * other fn __mul__(self, other: Self.Bive) -> Self: return self.s * other + self.b * other fn __mul__(self, other: Self.Anti) -> Self.Multi: return self.s * other + self.b * other fn __mul__(self, other: Self.Coef) -> Self: return Self(self.s * other, self.b * other) # +------( Reverse Arithmetic )------+ # # fn __radd__(self, other: Self.Coef) -> Self: return Self(other + self.s, self.b) fn __rsub__(self, other: Self.Coef) -> Self: return Self(other - self.s, self.b) fn __rmul__(self, other: Self.Coef) -> Self: return Self(other * self.s, other * self.b) # +----------------------------------------------------------------------------------------------+ # # | G3 Vector # +----------------------------------------------------------------------------------------------+ # # @register_passable("trivial") struct Vector[type: DType = DType.float64, size: Int = 1]( StringableCollectionElement, Formattable, EqualityComparable ): """A G3 Vector.""" # +------[ Alias ]------+ # # alias Lane = Vector[type, 1] alias Multi = Multivector[type, size] alias Rotor = Rotor[type, size] alias Coef = SIMD[type, size] alias Bive = Bivector[type, size] alias Anti = Antiox[type, size] # +------< Data >------+ # # var x: Self.Coef var y: Self.Coef var z: Self.Coef # +------( Initialize )------+ # # fn __init__(inout self, none: None = None): self.x = 0 self.y = 0 self.z = 0 fn __init__(inout self, x: Self.Coef, y: Self.Coef, z: Self.Coef): self.x = x self.y = y self.z = z # +------( Subscript )------+ # # @always_inline fn get_lane(self, idx: Int) -> Self.Lane: return Self.Lane(self.x[idx], self.y[idx], self.z[idx]) @always_inline fn set_lane(inout self, idx: Int, value: Self.Lane): self.x[idx] = value.x self.y[idx] = value.y self.z[idx] = value.z # +------( Cast )------+ # # @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: return (self.x == 0) & (self.y == 0) & (self.z == 0) # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): self.format_to["\n"](writer) @no_inline fn format_to[sep: StringLiteral](self, inout writer: Formatter): @parameter if size == 1: writer.write(self.x, "x + ", self.y, "y + ", self.z, "z") else: @parameter for lane in range(size - 1): self.get_lane(lane).format_to(writer) writer.write(sep) self.get_lane(size - 1).format_to(writer) # +------( Comparison )------+ # # fn __eq__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other == self fn __eq__(self, other: Self) -> SIMD[DType.bool, size]: return (self.x == other.x) & (self.y == other.y) & (self.z == other.z) fn __eq__[__: None = None](self, other: Self.Multi) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self) -> Bool: return self.__eq__(other).reduce_and() fn __ne__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other != self fn __ne__(self, other: Self) -> SIMD[DType.bool, size]: return (self.x != other.x) | (self.y != other.y) | (self.z != other.z) fn __ne__[__: None = None](self, other: Self.Multi) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self) -> Bool: return self.__ne__(other).reduce_or() # +------( Operations )------+ # # fn __neg__(self) -> Self: return Self(-self.x, -self.y, -self.z) # +------( Arithmetic )------+ # # fn __add__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(other.s, self + other.v, other.b, other.a) fn __add__(self, other: Self.Rotor) -> Self.Multi: return Self.Multi(other.s, self, other.b, None) fn __add__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(other, self, None, None) fn __add__(self, other: Self) -> Self: return Self(self.x + other.x, self.y + other.y, self.z + other.z) fn __add__(self, other: Self.Bive) -> Self.Multi: return Self.Multi(0, self, other, None) fn __add__(self, other: Self.Anti) -> Self.Multi: return Self.Multi(0, self, None, other) fn __sub__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(-other.s, self - other.v, -other.b, -other.a) fn __sub__(self, other: Self.Rotor) -> Self.Multi: return Self.Multi(-other.s, self, -other.b, None) fn __sub__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(-other, self, None, None) fn __sub__(self, other: Self) -> Self: return Self(self.x - other.x, self.y - other.y, self.z - other.z) fn __sub__(self, other: Self.Bive) -> Self.Multi: return Self.Multi(0, self, -other, None) fn __sub__(self, other: Self.Anti) -> Self.Multi: return Self.Multi(0, self, None, -other) fn __mul__(self, other: Self.Multi) -> Self.Multi: return self * other.s + self * other.v + self * other.b + self * other.a fn __mul__(self, other: Self.Rotor) -> Self.Multi: return self * other.s + self * other.b fn __mul__(self, other: Self.Coef) -> Self: return Self(self.x * other, self.y * other, self.z * other) fn __mul__(self, other: Self) -> Self.Rotor: return Self.Rotor( self.x * other.x + self.y * other.y + self.z * other.z, self.x * other.y - self.y * other.x, self.x * other.z - self.z * other.x, self.y * other.z - self.z * other.y, ) fn __mul__(self, other: Self.Bive) -> Self.Multi: return Self.Multi( 0, Self( -self.y * other.i - self.z * other.j, +self.x * other.i - self.z * other.k, +self.x * other.j + self.y * other.k, ), None, self.x * other.k - self.y * other.j + self.z * other.i, ) fn __mul__(self, other: Self.Anti) -> Self.Bive: return Self.Bive(self.z, -self.y, self.x) # +------( Reverse Arithmetic )------+ # # fn __radd__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(other, self, None, None) fn __rsub__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(other, -self, None, None) fn __rmul__(self, other: Self.Coef) -> Self: return Self(other * self.x, other * self.y, other * self.z) # +----------------------------------------------------------------------------------------------+ # # | G3 Bivector # +----------------------------------------------------------------------------------------------+ # # @register_passable("trivial") struct Bivector[type: DType = DType.float64, size: Int = 1]( StringableCollectionElement, Formattable, EqualityComparable ): """A G3 Bivector.""" # +------[ Alias ]------+ # # alias Lane = Bivector[type, 1] alias Multi = Multivector[type, size] alias Rotor = Rotor[type, size] alias Coef = SIMD[type, size] alias Vect = Vector[type, size] alias Anti = Antiox[type, size] # +------< Data >------+ # # var i: Self.Coef var j: Self.Coef var k: Self.Coef # +------( Initialize )------+ # # fn __init__(inout self, none: None = None): self.i = 0 self.j = 0 self.k = 0 fn __init__(inout self, i: Self.Coef, j: Self.Coef, k: Self.Coef): self.i = i self.j = j self.k = k # +------( Subscript )------+ # # @always_inline fn get_lane(self, idx: Int) -> Self.Lane: return Self.Lane(self.i[idx], self.j[idx], self.k[idx]) @always_inline fn set_lane(inout self, idx: Int, value: Self.Lane): self.i[idx] = value.i self.j[idx] = value.j self.k[idx] = value.k # +------( Cast )------+ # # @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: return (self.i == 0) & (self.j == 0) & (self.k == 0) # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): self.format_to["\n"](writer) @no_inline fn format_to[sep: StringLiteral](self, inout writer: Formatter): @parameter if size == 1: writer.write(self.i, "i + ", self.j, "j + ", self.k, "k + ") else: @parameter for lane in range(size - 1): self.get_lane(lane).format_to(writer) writer.write(sep) self.get_lane(size - 1).format_to(writer) # +------( Comparison )------+ # # fn __eq__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other == self fn __eq__(self, other: Self.Rotor) -> SIMD[DType.bool, size]: return other == self fn __eq__(self, other: Self) -> SIMD[DType.bool, size]: return (self.i == other.i) & (self.j == other.j) & (self.k == other.k) fn __eq__[__: None = None](self, other: Self.Multi) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self.Rotor) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self) -> Bool: return self.__eq__(other).reduce_and() fn __ne__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other != self fn __ne__(self, other: Self.Rotor) -> SIMD[DType.bool, size]: return other != self fn __ne__(self, other: Self) -> SIMD[DType.bool, size]: return (self.i != other.i) | (self.j != other.j) | (self.k != other.k) fn __ne__[__: None = None](self, other: Self.Multi) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self.Rotor) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self) -> Bool: return self.__ne__(other).reduce_or() # +------( Operations )------+ # # fn __neg__(self) -> Self: return Self(-self.i, -self.j, -self.k) # +------( Arithmetic )------+ # # fn __add__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(other.s, other.v, self + other.b, other.a) fn __add__(self, other: Self.Rotor) -> Self.Rotor: return Self.Rotor(other.s, self + other.b) fn __add__(self, other: Self.Coef) -> Self.Rotor: return Self.Rotor(other, self) fn __add__(self, other: Self.Vect) -> Self.Multi: return Self.Multi(0, other, self, None) fn __add__(self, other: Self) -> Self: return Self(self.i + other.i, self.j + other.j, self.k + other.k) fn __add__(self, other: Self.Anti) -> Self.Multi: return Self.Multi(0, None, self, other) fn __sub__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(-other.s, -other.v, self - other.b, -other.a) fn __sub__(self, other: Self.Rotor) -> Self.Rotor: return Self.Rotor(-other.s, self - other.b) fn __sub__(self, other: Self.Coef) -> Self.Rotor: return Self.Rotor(-other, self) fn __sub__(self, other: Self.Vect) -> Self.Multi: return Self.Multi(0, -other, self, None) fn __sub__(self, other: Self) -> Self: return Self(self.i - other.i, self.j - other.j, self.k - other.k) fn __sub__(self, other: Self.Anti) -> Self.Multi: return Self.Multi(0, None, self, -other) fn __mul__(self, other: Self.Multi) -> Self.Multi: return self * other.s + self * other.v + self * other.b + self * other.a fn __mul__(self, other: Self.Rotor) -> Self.Rotor: return self * other.s + self * other.b fn __mul__(self, other: Self.Coef) -> Self: return Self(self.i * other, self.j * other, self.k * other) fn __mul__(self, other: Self.Vect) -> Self.Multi: return Self.Multi( 0, Self.Vect( self.i * other.y + self.j * other.z, -self.i * other.x + self.k * other.z, -self.j * other.x - self.k * other.y, ), None, self.i * other.z - self.j * other.y + self.k * other.x, ) fn __mul__(self, other: Self) -> Self.Rotor: return Self.Rotor( -self.i * other.i - self.j * other.j - self.k * other.k, +self.k * other.j - self.j * other.k, +self.i * other.k - self.k * other.i, +self.j * other.i - self.i * other.j, ) fn __mul__(self, other: Self.Anti) -> Self.Vect: return Self.Vect(-self.k, self.j, -self.i) # +------( Reverse Arithmetic )------+ # # fn __radd__(self, other: Self.Coef) -> Self.Rotor: return Self.Rotor(other, self) fn __rsub__(self, other: Self.Coef) -> Self.Rotor: return Self.Rotor(other, -self) fn __rmul__(self, other: Self.Coef) -> Self: return Self(other * self.i, other * self.j, other * self.k) # +----------------------------------------------------------------------------------------------+ # # | G3 Antiox # +----------------------------------------------------------------------------------------------+ # # @register_passable("trivial") struct Antiox[type: DType = DType.float64, size: Int = 1]( StringableCollectionElement, Formattable, EqualityComparable ): """A G3 Antiox.""" # +------[ Alias ]------+ # # alias Lane = Antiox[type, 1] alias Multi = Multivector[type, size] alias Rotor = Rotor[type, size] alias Coef = SIMD[type, size] alias Vect = Vector[type, size] alias Bive = Bivector[type, size] # +------< Data >------+ # # var a: Self.Coef # +------( Initialize )------+ # # fn __init__(inout self, none: None = None): self.a = 0 fn __init__(inout self, a: Self.Coef): self.a = a # fn __init__(inout self, a: Tuple[Self.Coef]): # self.a = a.get[0, Self.Coef]() # +------( Subscript )------+ # # @always_inline fn get_lane(self, idx: Int) -> Self.Lane: return Self.Lane(self.a[idx]) @always_inline fn set_lane(inout self, idx: Int, value: Self.Lane): self.a[idx] = value.a # +------( Cast )------+ # # @always_inline fn is_zero(self) -> SIMD[DType.bool, size]: return self.a == 0 # +------( Format )------+ # # @no_inline fn __str__(self) -> String: return String.format_sequence(self) @no_inline fn format_to(self, inout writer: Formatter): self.format_to["\n"](writer) @no_inline fn format_to[sep: StringLiteral](self, inout writer: Formatter): @parameter if size == 1: writer.write(self.a, "a") else: @parameter for lane in range(size - 1): self.get_lane(lane).format_to(writer) writer.write(sep) self.get_lane(size - 1).format_to(writer) # +------( Comparison )------+ # # fn __eq__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other == self fn __eq__(self, other: Self) -> SIMD[DType.bool, size]: return self.a == other.a fn __eq__[__: None = None](self, other: Self.Multi) -> Bool: return self.__eq__(other).reduce_and() fn __eq__[__: None = None](self, other: Self) -> Bool: return self.__eq__(other).reduce_and() fn __ne__(self, other: Self.Multi) -> SIMD[DType.bool, size]: return other != self fn __ne__(self, other: Self) -> SIMD[DType.bool, size]: return self.a != other.a fn __ne__[__: None = None](self, other: Self.Multi) -> Bool: return self.__ne__(other).reduce_or() fn __ne__[__: None = None](self, other: Self) -> Bool: return self.__ne__(other).reduce_or() # +------( Operations )------+ # # fn __neg__(self) -> Self: return Self(-self.a) # +------( Arithmetic )------+ # # fn __add__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(other.s, other.v, other.b, self + other.a) fn __add__(self, other: Self.Rotor) -> Self.Multi: return Self.Multi(other.s, None, other.b, self) fn __add__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(other, None, None, self) fn __add__(self, other: Self.Vect) -> Self.Multi: return Self.Multi(0, other, None, self) fn __add__(self, other: Self.Bive) -> Self.Multi: return Self.Multi(0, None, other, self) fn __add__(self, other: Self) -> Self: return Self(self.a + other.a) fn __sub__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(-other.s, -other.v, -other.b, self - other.a) fn __sub__(self, other: Self.Rotor) -> Self.Multi: return Self.Multi(-other.s, None, -other.b, self) fn __sub__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(-other, None, None, self) fn __sub__(self, other: Self.Vect) -> Self.Multi: return Self.Multi(0, -other, None, self) fn __sub__(self, other: Self.Bive) -> Self.Multi: return Self.Multi(0, None, -other, self) fn __sub__(self, other: Self) -> Self: return Self(self.a - other.a) fn __mul__(self, other: Self.Multi) -> Self.Multi: return Self.Multi(self * other.a, self * other.b, self * other.v, self * other.s) fn __mul__(self, other: Self.Rotor) -> Self.Multi: return Self.Multi(0, self * other.b, None, self * other.s) fn __mul__(self, other: Self.Coef) -> Self: return Self(self.a * other) fn __mul__(self, other: Self.Vect) -> Self.Bive: return Self.Bive(other.z, -other.y, other.x) fn __mul__(self, other: Self.Bive) -> Self.Vect: return Self.Vect(-other.k, other.j, -other.i) fn __mul__(self, other: Self) -> Self.Coef: return -self.a * other.a # +------( Reverse Arithmetic )------+ # # fn __radd__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(other, None, None, self) fn __rsub__(self, other: Self.Coef) -> Self.Multi: return Self.Multi(other, None, None, -self) fn __rmul__(self, other: Self.Coef) -> Self: return Self(other * self.a) --- src/io/__init__.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # --- src/io/ansi.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # struct Color: """Ansi Color Characters.""" alias none = "" alias clear = "\033[0m" alias grey = "\033[0;30m" alias red = "\033[0;31m" alias green = "\033[0;32m" alias yellow = "\033[0;33m" alias blue = "\033[0;34m" alias pink = "\033[0;35m" alias cyan = "\033[0;36m" alias white = "\033[0;37m" alias bg_grey = "\033[0;40m" alias bg_red = "\033[0;41m" alias bg_green = "\033[0;42m" alias bg_yellow = "\033[0;43m" alias bg_blue = "\033[0;44m" alias bg_pink = "\033[0;45m" alias bg_cyan = "\033[0;46m" alias bg_white = "\033[0;47m" alias colors = SmallArray[StringLiteral, 8]( Self.grey, Self.red, Self.yellow, Self.green, Self.cyan, Self.blue, Self.pink, Self.white ) --- src/math/__init__.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # from .constants import * from .combinatorics import * --- src/math/combinatorics.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # """Combinatorics functions.""" from math import sqrt, log, exp, gamma, lgamma from bit import pop_count # +----------------------------------------------------------------------------------------------+ # # | gamma # +----------------------------------------------------------------------------------------------+ # # # Computes the gamma function of x. # A domain error or pole error may occur if x is a negative integer or zero. # A range error occurs if the magnitude of x is too large and may occur if the magnitude of x is too small. # +----------------------------------------------------------------------------------------------+ # # | lgamma # +----------------------------------------------------------------------------------------------+ # # # The lgamma function computes the natural logarithm of the absolute value of gamma of x. # A range error occurs if x is too large. # A pole error may occur if x is a negative integer or zero. # +----------------------------------------------------------------------------------------------+ # # | Powerset # +----------------------------------------------------------------------------------------------+ # # fn powerset[T: CollectionElement, //](list: List[T]) -> List[List[T]]: # maybe faster to use powerset_bin to generate this as well if len(list) == 0: return List[List[T]](List[T]()) var cs = List[List[T]]() for c in powerset(list[1:]): cs += c[] cs += List(list[0]) + c[] return cs @always_inline fn powerset_bin(n: Int) -> List[List[Int]]: var result = List[List[Int]](capacity=2**n) for i in range(2**n): var j = 0 var l = List[Int](capacity=pop_count(i)) while j < i: if (i >> j) & 1: l += j + 1 j += 1 result += l return result @always_inline fn powerset_ord(n: Int) -> List[List[Int]]: var result = List[List[Int]](capacity=2**n) for k in range(n + 1): result += combinations_ord(n, k) return result^ # fn powerset_dan13(n: Int) -> List[List[Int]]: # var result = List[List[Int]](capacity=2**n) # var head = 0 # queue.append(List()) # tail += 1 # while(head < queue.size()): # var current = queue[head] # if current.size() == n: # break # head += 1 # for i in range(n): # if i in current: # continue # var next_set = current + i # queue.append(next_set) # return result # +----------------------------------------------------------------------------------------------+ # # | Combination # +----------------------------------------------------------------------------------------------+ # # @always_inline fn increment_combination[offset: Int = 1](n: Int, inout l: List[Int]) -> Bool: var first_gap: Int = -1 var first_val: Int = -1 for i in range(1, len(l) + 1): if (l[len(l) - i]) < ((n + offset) - i): first_gap = len(l) - i first_val = l[first_gap] break if first_gap == -1: return False for i in range(first_gap, len(l)): l[i] = first_val + (i - first_gap) + 1 return True @always_inline fn combinations_ord[offset: Int = 1](n: Int, k: Int) -> List[List[Int]]: var result = List[List[Int]](capacity=2**n) var idxs = List[Int](capacity=k) for i in range(k): idxs += i + offset result += idxs while increment_combination(n, idxs): result += idxs return result^ @always_inline fn combinations_bin(n: Int, k: Int) -> List[List[Int]]: var result = List[List[Int]](capacity=2**n) for i in range(2**n): var bits = pop_count(i) if bits != k: continue var j = 0 var l = List[Int](capacity=bits) while j < i: if (i >> j) & 1: l += j + 1 j += 1 result += l return result @always_inline fn order_of_comb(n: Int, comb: List[Int]) -> Int: var result = pascal(n, len(comb)) for i in range(len(comb)): var _n = n - comb[i] var _k = len(comb) - i if _n >= _k: result -= pascal(_n, _k) return result - 1 @always_inline fn order_of_scomb(n: Int, comb: List[Int]) -> Int: var result = pascal(n, len(comb)) for i in range(len(comb)): result += pascal(n, i) var _n = n - comb[i] var _k = len(comb) - i if _n >= _k: result -= pascal(_n, _k) return result - 1 # +----------------------------------------------------------------------------------------------+ # # | Factorial # +----------------------------------------------------------------------------------------------+ # # @always_inline fn factorial_slow(n: Int) -> Float64: var result: Float64 = 0 for i in range(2, n + 1): result += log(Float64(i)) return exp(result) @always_inline fn factorial_stirling(n: Float64) -> Float64: return sqrt(tau * n) * ((n / e) ** n) @always_inline fn factorial_gamma(n: Float64) -> Float64: return gamma(n + 1.0) @always_inline fn factorial(n: IntLiteral) -> IntLiteral: return multifactorial[1](n) @always_inline fn factorial(n: Int) -> Int: return multifactorial[1](n) # +----------------------------------------------------------------------------------------------+ # # | Multifactorial # +----------------------------------------------------------------------------------------------+ # # @always_inline fn double_factorial(n: IntLiteral) -> IntLiteral: return multifactorial[2](n) @always_inline fn double_factorial(n: Int) -> Int: return multifactorial[2](n) @always_inline fn multifactorial[step: IntLiteral](n: IntLiteral) -> IntLiteral: constrained[step > 0, "factorial step must be greater than 0"]() var result: IntLiteral = 1 var i: IntLiteral = n while i > 1: result *= i i -= step return result @always_inline fn multifactorial[step: Int](n: Int) -> Int: constrained[step > 0, "factorial step must be greater than 0"]() var result: Int = 1 var i: Int = n while i > 1: result *= i i -= step return result # +----------------------------------------------------------------------------------------------+ # # | Permutial # +----------------------------------------------------------------------------------------------+ # # # n! / (n-r)! # alias nPr: fn (Int, Int) -> Int = permutial @always_inline fn permutial(n: IntLiteral, r: IntLiteral) -> IntLiteral: var i: IntLiteral = n - r + 1 var end: IntLiteral = n + 1 var result: IntLiteral = 1 while i < end: result *= i i += 1 return result @always_inline fn permutial[r: Int](n: Int) -> Int: alias start: Int = 1 - r alias end: Int = 1 var result: Int = 1 @parameter for i in range(start, end): result *= n + i return result @always_inline fn permutial(n: Int, r: Int) -> Int: var start: Int = n - r + 1 var end: Int = n + 1 var result: Int = 1 for i in range(start, end): result *= i return result # +----------------------------------------------------------------------------------------------+ # # | Supertial # +----------------------------------------------------------------------------------------------+ # # # (d+n)! / n! # @always_inline fn supertial(d: IntLiteral, n: IntLiteral) -> IntLiteral: var i: IntLiteral = n + 1 var end: IntLiteral = n + d + 1 var result: IntLiteral = 1 while i < end: result *= i i += 1 return result @always_inline fn supertial[d: Int](n: Int) -> Int: alias start: Int = 1 alias end: Int = d + 1 var result: Int = 1 @parameter for i in range(start, end): result *= n + i return result @always_inline fn supertial(d: Int, n: Int) -> Int: var start: Int = n + 1 var end: Int = n + d + 1 var result: Int = 1 for i in range(start, end): result *= i return result # +----------------------------------------------------------------------------------------------+ # # | Pascal # +----------------------------------------------------------------------------------------------+ # # # n! / (n-r)!r! # alias nCr: fn (Int, Int) -> Int = pascal @always_inline fn pascal(n: IntLiteral, r: IntLiteral) -> IntLiteral: return permutial(n, r) // factorial(r) @always_inline fn pascal[n: Int](r: Int) -> Int: return permutial[n](r) // factorial(r) @always_inline fn pascal(n: Int, r: Int) -> Int: return permutial(n, r) // factorial(r) # +----------------------------------------------------------------------------------------------+ # # | Simplicial # +----------------------------------------------------------------------------------------------+ # # # justified pascal # (d+n)! / d!n! # alias ntri = simplicial[Int(2)] # alias ntet = simplicial[3] @always_inline fn simplicial(d: IntLiteral, n: IntLiteral) -> IntLiteral: return supertial(d, n) // factorial(d) @always_inline fn simplicial[d: Int](n: Int) -> Int: return supertial[d](n) // factorial(d) @always_inline fn simplicial(d: Int, n: Int) -> Int: return supertial(d, n) // factorial(d) --- src/math/constants.mojo --- # x----------------------------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x----------------------------------------------------------------------------------------------x # """Mathematical Constants. Accurate to 100 decimal digits.""" alias e = 2.7182818284_5904523536_0287471352_6624977572_4709369995_9574966967_6277240766_3035354759_4571382178_5251664274 # exp(1) alias pi = 3.1415926535_8979323846_2643383279_5028841971_6939937510_5820974944_5923078164_0628620899_8628034825_3421170679 # acos(-1) alias tau = 6.2831853071_7958647692_5286766559_0057683943_3879875021_1641949889_1846156328_1257241799_7256069650_6842341359 # pi*2 alias phi = 1.6180339887_4989484820_4586834365_6381177203_0917980576_2862135448_6227052604_6281890244_9707207204_1893911374 # sqrt(5)+1 / 2 alias rt2 = 1.4142135623_7309504880_1688724209_6980785696_7187537694_8073176679_7379907324_7846210703_8850387534_3276415727 # sqrt(2) alias trh = 0.8660254037_8443864676_3723170752_9361834714_0262690519_0314027903_4897259665_0845440001_8540573093_3786242878 # sqrt(3)/2 alias twt = 1.0594630943_5929526456_1825294946_3417007792_0431749418_5628559208_4314587616_4606325572_2383768376_8639455690 # pow(2, 1/12) alias ln2 = 0.6931471805_5994530941_7232121458_1765680755_0013436025_5254120680_0094933936_2196969471_5605863326_9964186875 # ln(2) alias omg = 0.5671432904_0978387299_9968662210_3555497538_1578718651_2508135131_0792230457_9308668456_6693219446_9617522945 # lw(1) alias egm = 0.5772156649_0153286060_6512090082_4024310421_5933593992_3598805767_2348848677_2677766467_0936947063_2917467495 # -diff[lgamma](1) --- src/utils/__init__.mojo --- from .small_array import SmallArray --- src/utils/small_array.mojo --- from sys.intrinsics import _type_is_eq from collections._index_normalization import normalize_index # +----------------------------------------------------------------------------------------------+ # # | Helper # +----------------------------------------------------------------------------------------------+ # # trait DefaultableCollectionElement(Defaultable, CollectionElement): pass fn _small_array_construction_checks[size: Int](): constrained[size >= 0, "number of elements in `SmallArray` must be >= 0"]() # +----------------------------------------------------------------------------------------------+ # # | Small Array # +----------------------------------------------------------------------------------------------+ # # @value struct SmallArray[T: CollectionElement, size: Int](Sized, CollectionElement): """SmallArray.""" # +------< Data >------+ # # alias type = __mlir_type[`!pop.array<`, size.value, `, `, T, `>`] var _data: Self.type # +------( Lifecycle )------+ # # @always_inline fn __init__[init_data: Bool = True](inout self): _small_array_construction_checks[size]() self._data = __mlir_op.`kgen.undef`[_type = Self.type]() @parameter if init_data: constrained[ False, "Initialize by explicitly setting the parameter `init_data` to `False`." ]() @always_inline fn __init__[_T: DefaultableCollectionElement](inout self: SmallArray[_T, size]): self.__init__(_T()) @always_inline fn __init__(inout self, fill: T): self.__init__[False]() @parameter for i in range(size): var ptr = UnsafePointer.address_of(self.unsafe_get(i)) ptr.init_pointee_copy(fill) @always_inline fn __init__(inout self, owned *elems: T): self = Self(storage=elems^) @always_inline fn __init__( inout self, *, owned storage: VariadicListMem[T, _], ): debug_assert(len(storage) == size, "Elements must be of length size") self.__init__[False]() @parameter for i in range(size): var eltref: Reference[T, __lifetime_of(self)] = self.unsafe_get(i) UnsafePointer.address_of(storage[i]).move_pointee_into( UnsafePointer[T].address_of(eltref[]) ) storage._is_owned = False # @deprecated("could cause large overhead") # fn __copyinit__(inout self, other: Self): # self.__init__[False]() # for idx in range(size): # var ptr = self.unsafe_ptr() + idx # ptr.init_pointee_copy(other[idx]) fn __del__(owned self): @parameter for idx in range(size): var ptr = self.unsafe_ptr() + idx ptr.destroy_pointee() # +------( Subscript )------+ # # @always_inline fn __getitem__(ref [_]self, idx: Int) -> ref [__lifetime_of(self)] T: var normalized_index = normalize_index["SmallArray"](idx, self) return self.unsafe_get(normalized_index) @always_inline fn __getitem__[idx: Int](ref [_]self) -> ref [__lifetime_of(self)] T: constrained[-size <= idx < size, "Index out of bounds."]() var normalized_idx = idx @parameter if idx < 0: normalized_idx += size return self.unsafe_get(normalized_idx) @always_inline fn unsafe_get(ref [_]self, idx: Int) -> ref [__lifetime_of(self)] T: var idx_as_int = index(idx) debug_assert( 0 <= idx_as_int < size, "Index out of bounds.", ) var ptr = __mlir_op.`pop.array.gep`( UnsafePointer.address_of(self._data).address, idx_as_int.value, ) return UnsafePointer(ptr)[] # +------( Unary )------+ # # @always_inline fn __len__(self) -> Int: return size # +------( Operations )------+ # # @always_inline fn unsafe_ptr(self) -> UnsafePointer[T]: return UnsafePointer.address_of(self._data).bitcast[T]() @always_inline fn __contains__[_T: EqualityComparableCollectionElement, //](self, value: _T) -> Bool: constrained[_type_is_eq[_T, T](), "T must be equal to Self.ElementType"]() @parameter for i in range(size): if rebind[Reference[_T, __lifetime_of(self)]](Reference(self[i]))[] == value: return True return False --- test/_testing.mojo --- from collections import Optional from testing.testing import ( Testable, isclose, _SourceLocation, _assert_error, __call_location, _assert_cmp_error, ) trait TestableCollectionElement(Testable, RepresentableCollectionElement, EqualityComparableCollectionElement): pass @always_inline fn str_[T: TestableCollectionElement](l: List[List[T]]) -> String: var result: String = "[" for idx in range(len(l) - 1): result += l[idx].__str__[T]() + ", " if len(l) > 0: result += l[len(l) - 1].__str__() return result + "]" @always_inline fn assert_equal_[T: TestableCollectionElement]( lhs: List[List[T]], rhs: __type_of(lhs), msg: String = "", *, location: Optional[_SourceLocation] = None, ) raises: var eq = len(lhs) == len(rhs) if eq: for idx in range(len(lhs)): if lhs[idx] != rhs[idx]: eq = False break if not eq: raise _assert_cmp_error["`left == right` comparison"]( str_(lhs), str_(rhs), msg=msg, loc=location.or_else(__call_location()) ) @always_inline fn assert_not_equal_[T: TestableCollectionElement]( lhs: List[List[T]], rhs: __type_of(lhs), msg: String = "", *, location: Optional[_SourceLocation] = None, ) raises: var ne = len(lhs) != len(rhs) if not ne: for idx in range(len(lhs)): if lhs[idx] != rhs[idx]: ne = True break if not ne: raise _assert_cmp_error["`left != right` comparison"]( str_(lhs), str_(rhs), msg=msg, loc=location.or_else(__call_location()) ) --- test/build.sh --- #!/usr/bin/env bash # x--------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x--------------------------------------------------------------------------x # set -euo pipefail REPO_NAME="infrared" BUILD_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) REPO_ROOT=$(realpath "${BUILD_DIR}/..") SRC_PATH="${REPO_ROOT}/src" PACKAGE_NAME=${REPO_NAME}".mojopkg" PACKAGE_PATH=${BUILD_DIR}"/"${PACKAGE_NAME} echo "╓─── Packaging the Infrared library" mojo package "${SRC_PATH}" -o "${PACKAGE_PATH}" echo Successfully created "${PACKAGE_PATH}" --- test/run.sh --- #!/usr/bin/env bash # x--------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x--------------------------------------------------------------------------x # set -euo pipefail RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' TEST_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) FAILED_COUNT=0 source ${TEST_DIR}/build.sh for test in ${TEST_DIR}/test_*.mojo; do echo -e "\n╓─── Testing: $(basename $test)" if mojo $test; then echo -e ${GREEN}╙─── Test Successful!${NC} else ((FAILED_COUNT+=1)) echo -e ${RED}╙─── Test Failed!${NC} fi done echo if [ "$FAILED_COUNT" -eq 0 ]; then echo -e "${GREEN}───╖\n ║ All Successful!\n───╜${NC}" else echo -e "${RED}───╖\n ║ ${FAILED_COUNT} Failed!\n───╜${NC}" return 1 fi --- test/test_combinatorics.mojo --- # x--------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x--------------------------------------------------------------------------x # from testing import assert_true, assert_false, assert_equal, assert_not_equal from _testing import assert_equal_, assert_not_equal_ from infrared.math.combinatorics import * def main(): test_pascal() test_factorial() test_combinations_bin() test_powerset() test_powerset_bin() test_powerset_ord() def test_pascal(): assert_equal(pascal(0, 0), 1) assert_equal(pascal(1, 0), 1) assert_equal(pascal(1, 1), 1) assert_equal(pascal(2, 0), 1) assert_equal(pascal(2, 1), 2) assert_equal(pascal(2, 2), 1) assert_equal(pascal(3, 0), 1) assert_equal(pascal(3, 1), 3) assert_equal(pascal(3, 2), 3) assert_equal(pascal(3, 3), 1) assert_equal(pascal(4, 0), 1) assert_equal(pascal(4, 1), 4) assert_equal(pascal(4, 2), 6) assert_equal(pascal(4, 3), 4) assert_equal(pascal(4, 4), 1) def test_factorial(): assert_equal(factorial(0), 1) assert_equal(factorial(1), 1) assert_equal(factorial(2), 2) assert_equal(factorial(3), 6) assert_equal(factorial(4), 24) assert_equal(factorial(5), 120) assert_equal(factorial(6), 720) def test_combinations_bin(): assert_equal_(combinations_bin(0, 0), List(List[Int]())) assert_equal_(combinations_bin(1, 0), List(List[Int]())) assert_equal_(combinations_bin(1, 1), List(List[Int](1))) assert_equal_(combinations_bin(2, 0), List(List[Int]())) assert_equal_(combinations_bin(2, 1), List(List[Int](1), List[Int](2))) assert_equal_(combinations_bin(2, 2), List(List[Int](1, 2))) assert_equal_(combinations_bin(3, 2), List(List[Int](1, 2), List[Int](1, 3), List[Int](2, 3))) def test_powerset(): assert_equal_(powerset(List[String]()), List(List[String]())) assert_equal_(powerset(List[String]('a')), List(List[String](), List[String]('a'))) assert_equal_(powerset(List[String]('a', 'b')), List(List[String](), List[String]('a'), List[String]('b'), List[String]('a', 'b'))) assert_equal_(powerset(List[String]('a', 'b', 'c')), List(List[String](), List[String]('a'), List[String]('b'), List[String]('a', 'b'), List[String]('c'), List[String]('a', 'c'), List[String]('b', 'c'), List[String]('a', 'b', 'c'))) def test_powerset_bin(): assert_equal_(powerset_bin(0), List(List[Int]())) assert_equal_(powerset_bin(1), List(List[Int](), List[Int](1))) assert_equal_(powerset_bin(2), List(List[Int](), List[Int](1), List[Int](2), List[Int](1, 2))) assert_equal_(powerset_bin(3), List(List[Int](), List[Int](1), List[Int](2), List[Int](1, 2), List[Int](3), List[Int](1, 3), List[Int](2, 3), List[Int](1, 2, 3))) def test_powerset_ord(): assert_equal_(powerset_ord(0), List[List[Int]](List[Int]())) assert_equal_(powerset_ord(1), List[List[Int]](List[Int](), List[Int](1))) assert_equal_(powerset_ord(2), List[List[Int]](List[Int](), List[Int](1), List[Int](2), List[Int](1, 2))) assert_equal_(powerset_ord(3), List[List[Int]](List[Int](), List[Int](1), List[Int](2), List[Int](3), List[Int](1, 2), List[Int](1, 3), List[Int](2, 3), List[Int](1, 2, 3))) --- test/test_g2.mojo --- # x--------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x--------------------------------------------------------------------------x # from testing import assert_true, assert_false, assert_equal from infrared.hard.g2 import * def main(): simd_run[DType.float64, 1]() simd_run[DType.float64, 2]() simd_run[DType.float64, 4]() simd_run[DType.float32, 1]() simd_run[DType.float32, 2]() simd_run[DType.float32, 4]() simd_run[DType.index, 1]() simd_run[DType.index, 2]() simd_run[DType.index, 4]() def simd_run[type: DType, size: Int](): test_eq[type, size]() test_ne[type, size]() test_add[type, size]() test_sub[type, size]() test_mul[type, size]() @parameter if type.is_floating_point(): test_truediv[type, size]() def test_eq[type: DType, size: Int](): # +--- Multivector assert_true(Multivector[type, size](1, 2, 3, 4).__eq__[None](Multivector[type, size](1, 2, 3, 4))) assert_false(Multivector[type, size](1, 2, 3, 4).__eq__[None](Multivector[type, size](4, 3, 2, 1))) assert_true(Multivector[type, size](0, 2, 3, 0).__eq__[None](Vector[type, size](2, 3))) assert_false(Multivector[type, size](1, 2, 3, 4).__eq__[None](Vector[type, size](2, 3))) assert_true(Multivector[type, size](1, 0, 0, 0).__eq__[None](SIMD[type, size](1))) assert_false(Multivector[type, size](1, 2, 3, 4).__eq__[None](SIMD[type, size](1))) assert_true(Multivector[type, size](1, 0, 0, 4).__eq__[None](Rotor[type, size](1, 4))) assert_false(Multivector[type, size](1, 2, 3, 4).__eq__[None](Rotor[type, size](1, 4))) # +--- Rotor assert_true(Rotor[type, size](1, 4).__eq__[None](Multivector[type, size](1, 0, 0, 4))) assert_false(Rotor[type, size](1, 4).__eq__[None](Multivector[type, size](1, 2, 3, 4))) assert_true(Rotor[type, size](1, 4).__eq__[None](Rotor[type, size](1, 4))) assert_false(Rotor[type, size](1, 4).__eq__[None](Rotor[type, size](4, 1))) assert_true(Rotor[type, size](1, 0).__eq__[None](SIMD[type, size](1))) assert_false(Rotor[type, size](1, 4).__eq__[None](SIMD[type, size](1))) # False # +--- Vector assert_true(Vector[type, size](2, 3).__eq__[None](Multivector[type, size](0, 2, 3, 0))) assert_false(Vector[type, size](2, 3).__eq__[None](Multivector[type, size](1, 2, 3, 4))) # False assert_true(Vector[type, size](2, 3).__eq__[None](Vector[type, size](2, 3))) assert_false(Vector[type, size](2, 3).__eq__[None](Vector[type, size](3, 2))) def test_ne[type: DType, size: Int](): # +--- Multivector assert_false(Multivector[type, size](1, 2, 3, 4).__ne__[None](Multivector[type, size](1, 2, 3, 4))) assert_true(Multivector[type, size](1, 2, 3, 4).__ne__[None](Multivector[type, size](4, 3, 2, 1))) assert_false(Multivector[type, size](0, 2, 3, 0).__ne__[None](Vector[type, size](2, 3))) assert_true(Multivector[type, size](1, 2, 3, 4).__ne__[None](Vector[type, size](2, 3))) assert_false(Multivector[type, size](1, 0, 0, 0).__ne__[None](SIMD[type, size](1))) assert_true(Multivector[type, size](1, 2, 3, 4).__ne__[None](SIMD[type, size](1))) assert_false(Multivector[type, size](1, 0, 0, 4).__ne__[None](Rotor[type, size](1, 4))) assert_true(Multivector[type, size](1, 2, 3, 4).__ne__[None](Rotor[type, size](1, 4))) # +--- Rotor assert_false(Rotor[type, size](1, 4).__ne__[None](Multivector[type, size](1, 0, 0, 4))) assert_true(Rotor[type, size](1, 4).__ne__[None](Multivector[type, size](1, 2, 3, 4))) assert_false(Rotor[type, size](1, 4).__ne__[None](Rotor[type, size](1, 4))) assert_true(Rotor[type, size](1, 4).__ne__[None](Rotor[type, size](4, 1))) assert_false(Rotor[type, size](1, 0).__ne__[None](SIMD[type, size](1))) assert_true(Rotor[type, size](1, 4).__ne__[None](SIMD[type, size](1))) # False # +--- Vector assert_false(Vector[type, size](2, 3).__ne__[None](Multivector[type, size](0, 2, 3, 0))) assert_true(Vector[type, size](2, 3).__ne__[None](Multivector[type, size](1, 2, 3, 4))) # False assert_false(Vector[type, size](2, 3).__ne__[None](Vector[type, size](2, 3))) assert_true(Vector[type, size](2, 3).__ne__[None](Vector[type, size](3, 2))) def test_add[type: DType, size: Int](): assert_equal(Multivector[type, size](1, 2, 3, 4).__add__(Multivector[type, size](5, 4, 3, 2)), Multivector[type, size](6, 6, 6, 6)) assert_equal(Multivector[type, size](0, 0, 0, 0).__add__(Rotor[type, size](1, 4)), Multivector[type, size](1, 0, 0, 4)) assert_equal(Multivector[type, size](0, 0, 0, 0).__add__(Vector[type, size](2, 3)), Multivector[type, size](0, 2, 3, 0)) assert_equal(Multivector[type, size](0, 0, 0, 0).__add__(SIMD[type, size](1)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Rotor[type, size](1, 4).__add__(Multivector[type, size](0, 2, 3, 0)), Multivector[type, size](1, 2, 3, 4)) assert_equal(Rotor[type, size](1, 4).__add__(Rotor[type, size](5, 2)), Rotor[type, size](6, 6)) assert_equal(Rotor[type, size](1, 4).__add__(Vector[type, size](2, 3)), Multivector[type, size](1, 2, 3, 4)) assert_equal(Rotor[type, size](0, 4).__add__(SIMD[type, size](1)), Rotor[type, size](1, 4)) assert_equal(Vector[type, size](2, 3).__add__(Multivector[type, size](1, 0, 0, 4)), Multivector[type, size](1, 2, 3, 4)) assert_equal(Vector[type, size](2, 3).__add__(Rotor[type, size](1, 4)), Multivector[type, size](1, 2, 3, 4)) assert_equal(Vector[type, size](2, 3).__add__(Vector[type, size](4, 3)), Vector[type, size](6, 6)) assert_equal(Vector[type, size](2, 3).__add__(SIMD[type, size](1)), Multivector[type, size](1, 2, 3, 0)) assert_equal(Multivector[type, size](0, 2, 3, 4).__radd__(SIMD[type, size](1)), Multivector[type, size](1, 2, 3, 4)) assert_equal(Rotor[type, size](0, 4).__radd__(SIMD[type, size](1)), Rotor[type, size](1, 4)) assert_equal(Vector[type, size](2, 3).__radd__(SIMD[type, size](1)), Multivector[type, size](1, 2, 3, 0)) def test_sub[type: DType, size: Int](): assert_equal(Multivector[type, size](6, 6, 6, 6).__sub__(Multivector[type, size](5, 4, 3, 2)), Multivector[type, size](1, 2, 3, 4)) assert_equal(Multivector[type, size](1, 0, 0, 4).__sub__(Rotor[type, size](1, 4)), Multivector[type, size](0, 0, 0, 0)) assert_equal(Multivector[type, size](0, 2, 3, 0).__sub__(Vector[type, size](2, 3)), Multivector[type, size](0, 0, 0, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__sub__(SIMD[type, size](1)), Multivector[type, size](0, 0, 0, 0)) assert_equal(Rotor[type, size](1, 4).__sub__(Multivector[type, size](0, 2, 3, 0)), Multivector[type, size](1, -2, -3, 4)) assert_equal(Rotor[type, size](6, 6).__sub__(Rotor[type, size](5, 2)), Rotor[type, size](1, 4)) assert_equal(Rotor[type, size](1, 4).__sub__(Vector[type, size](2, 3)), Multivector[type, size](1, -2, -3, 4)) assert_equal(Rotor[type, size](1, 4).__sub__(SIMD[type, size](1)), Rotor[type, size](0, 4)) assert_equal(Vector[type, size](2, 3).__sub__(Multivector[type, size](1, 0, 0, 4)), Multivector[type, size](-1, 2, 3, -4)) assert_equal(Vector[type, size](2, 3).__sub__(Rotor[type, size](1, 4)), Multivector[type, size](-1, 2, 3, -4)) assert_equal(Vector[type, size](6, 6).__sub__(Vector[type, size](4, 3)), Vector[type, size](2, 3)) assert_equal(Vector[type, size](2, 3).__sub__(SIMD[type, size](1)), Multivector[type, size](-1, 2, 3, 0)) assert_equal(Multivector[type, size](1, 2, 3, 4).__rsub__(SIMD[type, size](1)), Multivector[type, size](0, -2, -3, -4)) assert_equal(Rotor[type, size](1, 4).__rsub__(SIMD[type, size](1)), Rotor[type, size](0, -4)) assert_equal(Vector[type, size](2, 3).__rsub__(SIMD[type, size](1)), Multivector[type, size](1, -2, -3, 0)) def test_mul[type: DType, size: Int](): # +--- multivector * multivector assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 0, 0, -1)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, -1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 0, -1, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](-1, 0, 0, 0)) # +--- multivector * vector assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(Vector[type, size](1, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(Vector[type, size](0, 1)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(Vector[type, size](1, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(Vector[type, size](0, 1)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(Vector[type, size](1, 0)), Multivector[type, size](0, 0, 0, -1)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(Vector[type, size](0, 1)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(Vector[type, size](1, 0)), Multivector[type, size](0, 0, -1, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(Vector[type, size](0, 1)), Multivector[type, size](0, 1, 0, 0)) # +--- multivector * rotor assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(Rotor[type, size](1, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(Rotor[type, size](0, 1)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(Rotor[type, size](1, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(Rotor[type, size](0, 1)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(Rotor[type, size](1, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(Rotor[type, size](0, 1)), Multivector[type, size](0, -1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(Rotor[type, size](1, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(Rotor[type, size](0, 1)), Multivector[type, size](-1, 0, 0, 0)) # +--- multivector * scalar assert_equal(Multivector[type, size](1, 0, 0, 0).__mul__(2), Multivector[type, size](2, 0, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__mul__(2), Multivector[type, size](0, 2, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__mul__(2), Multivector[type, size](0, 0, 2, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__mul__(2), Multivector[type, size](0, 0, 0, 2)) assert_equal(Multivector[type, size](1, 2, 3, 4).__mul__(2), Multivector[type, size](2, 4, 6, 8)) # +--- vector * multivector assert_equal(Vector[type, size](1, 0).__mul__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Vector[type, size](1, 0).__mul__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Vector[type, size](1, 0).__mul__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Vector[type, size](1, 0).__mul__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Vector[type, size](0, 1).__mul__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Vector[type, size](0, 1).__mul__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 0, 0, -1)) assert_equal(Vector[type, size](0, 1).__mul__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Vector[type, size](0, 1).__mul__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, -1, 0, 0)) # +--- vector * vector assert_equal(Vector[type, size](1, 0).__mul__(Vector[type, size](1, 0)), Rotor[type, size](1, 0)) assert_equal(Vector[type, size](1, 0).__mul__(Vector[type, size](0, 1)), Rotor[type, size](0, 1)) assert_equal(Vector[type, size](0, 1).__mul__(Vector[type, size](1, 0)), Rotor[type, size](0, -1)) assert_equal(Vector[type, size](0, 1).__mul__(Vector[type, size](0, 1)), Rotor[type, size](1, 0)) # +--- vector * rotor assert_equal(Vector[type, size](1, 0).__mul__(Rotor[type, size](1, 0)), Vector[type, size](1, 0)) assert_equal(Vector[type, size](1, 0).__mul__(Rotor[type, size](0, 1)), Vector[type, size](0, 1)) assert_equal(Vector[type, size](0, 1).__mul__(Rotor[type, size](1, 0)), Vector[type, size](0, 1)) assert_equal(Vector[type, size](0, 1).__mul__(Rotor[type, size](0, 1)), Vector[type, size](-1, 0)) # +--- vector * scalar assert_equal(Vector[type, size](1, 0).__mul__(2), Vector[type, size](2, 0)) assert_equal(Vector[type, size](0, 1).__mul__(2), Vector[type, size](0, 2)) assert_equal(Vector[type, size](2, 3).__mul__(2), Vector[type, size](4, 6)) # +--- rotor * multivector assert_equal(Rotor[type, size](1, 0).__mul__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Rotor[type, size](1, 0).__mul__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Rotor[type, size](1, 0).__mul__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Rotor[type, size](1, 0).__mul__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Rotor[type, size](0, 1).__mul__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Rotor[type, size](0, 1).__mul__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 0, -1, 0)) assert_equal(Rotor[type, size](0, 1).__mul__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Rotor[type, size](0, 1).__mul__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](-1, 0, 0, 0)) # +--- rotor * vector assert_equal(Rotor[type, size](1, 0).__mul__(Vector[type, size](1, 0)), Vector[type, size](1, 0)) assert_equal(Rotor[type, size](1, 0).__mul__(Vector[type, size](0, 1)), Vector[type, size](0, 1)) assert_equal(Rotor[type, size](0, 1).__mul__(Vector[type, size](1, 0)), Vector[type, size](0, -1)) assert_equal(Rotor[type, size](0, 1).__mul__(Vector[type, size](0, 1)), Vector[type, size](1, 0)) # +--- rotor * rotor assert_equal(Rotor[type, size](1, 0).__mul__(Rotor[type, size](1, 0)), Rotor[type, size](1, 0)) assert_equal(Rotor[type, size](1, 0).__mul__(Rotor[type, size](0, 1)), Rotor[type, size](0, 1)) assert_equal(Rotor[type, size](0, 1).__mul__(Rotor[type, size](1, 0)), Rotor[type, size](0, 1)) assert_equal(Rotor[type, size](0, 1).__mul__(Rotor[type, size](0, 1)), Rotor[type, size](-1, 0)) # +--- rotor * scalar assert_equal(Rotor[type, size](1, 0).__mul__(2), Rotor[type, size](2, 0)) assert_equal(Rotor[type, size](0, 1).__mul__(2), Rotor[type, size](0, 2)) assert_equal(Rotor[type, size](1, 4).__mul__(2), Rotor[type, size](2, 8)) # +--- scalar * multivector assert_equal(Multivector[type, size](1, 0, 0, 0).__rmul__(2), Multivector[type, size](2, 0, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__rmul__(2), Multivector[type, size](0, 2, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__rmul__(2), Multivector[type, size](0, 0, 2, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__rmul__(2), Multivector[type, size](0, 0, 0, 2)) # +--- scalar * vector assert_equal(Vector[type, size](1, 0).__rmul__(2), Vector[type, size](2, 0)) assert_equal(Vector[type, size](0, 1).__rmul__(2), Vector[type, size](0, 2)) # +--- scalar * rotor assert_equal(Rotor[type, size](1, 0).__rmul__(2), Rotor[type, size](2, 0)) assert_equal(Rotor[type, size](0, 1).__rmul__(2), Rotor[type, size](0, 2)) def test_truediv[type: DType, size: Int](): # +--- multivector / multivector assert_equal(Multivector[type, size](1, 0, 0, 0).__truediv__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__truediv__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__truediv__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__truediv__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__truediv__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__truediv__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__truediv__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__truediv__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__truediv__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, 0, -1).__truediv__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__truediv__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, -1, 0, 0).__truediv__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__truediv__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 0, -1, 0).__truediv__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 1, 0, 0).__truediv__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](-1, 0, 0, 0).__truediv__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 0, 0, 1)) # +--- multivector / vector assert_equal(Multivector[type, size](0, 1, 0, 0).__truediv__(Vector[type, size](1, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__truediv__(Vector[type, size](0, 1)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__truediv__(Vector[type, size](1, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__truediv__(Vector[type, size](0, 1)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, -1).__truediv__(Vector[type, size](1, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](1, 0, 0, 0).__truediv__(Vector[type, size](0, 1)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, -1, 0).__truediv__(Vector[type, size](1, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](0, 1, 0, 0).__truediv__(Vector[type, size](0, 1)), Multivector[type, size](0, 0, 0, 1)) # +--- multivector / rotor assert_equal(Multivector[type, size](1, 0, 0, 0).__truediv__(Rotor[type, size](1, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__truediv__(Rotor[type, size](0, 1)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 1, 0, 0).__truediv__(Rotor[type, size](1, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__truediv__(Rotor[type, size](0, 1)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 1, 0).__truediv__(Rotor[type, size](1, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, -1, 0, 0).__truediv__(Rotor[type, size](0, 1)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, 0, 1).__truediv__(Rotor[type, size](1, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](-1, 0, 0, 0).__truediv__(Rotor[type, size](0, 1)), Multivector[type, size](0, 0, 0, 1)) # +--- multivector / scalar assert_equal(Multivector[type, size](2, 0, 0, 0).__truediv__(2), Multivector[type, size](1, 0, 0, 0)) assert_equal(Multivector[type, size](0, 2, 0, 0).__truediv__(2), Multivector[type, size](0, 1, 0, 0)) assert_equal(Multivector[type, size](0, 0, 2, 0).__truediv__(2), Multivector[type, size](0, 0, 1, 0)) assert_equal(Multivector[type, size](0, 0, 0, 2).__truediv__(2), Multivector[type, size](0, 0, 0, 1)) assert_equal(Multivector[type, size](2, 4, 6, 8).__truediv__(2), Multivector[type, size](1, 2, 3, 4)) # +--- vector / multivector assert_equal(Vector[type, size](1, 0).__truediv__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Vector[type, size](0, 1).__truediv__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Vector[type, size](1, 0).__truediv__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Vector[type, size](0, 1).__truediv__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Vector[type, size](0, 1).__truediv__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Vector[type, size](-1, 0).__truediv__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Vector[type, size](0, -1).__truediv__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Vector[type, size](1, 0).__truediv__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 0, 0, 1)) # +--- vector / vector assert_equal(Vector[type, size](1, 0).__truediv__(Vector[type, size](1, 0)), Rotor[type, size](1, 0)) assert_equal(Vector[type, size](0, 1).__truediv__(Vector[type, size](0, 1)), Rotor[type, size](1, 0)) assert_equal(Vector[type, size](0, -1).__truediv__(Vector[type, size](1, 0)), Rotor[type, size](0, 1)) assert_equal(Vector[type, size](1, 0).__truediv__(Vector[type, size](0, 1)), Rotor[type, size](0, 1)) # +--- vector / rotor assert_equal(Vector[type, size](1, 0).__truediv__(Rotor[type, size](1, 0)), Vector[type, size](1, 0)) assert_equal(Vector[type, size](0, 1).__truediv__(Rotor[type, size](0, 1)), Vector[type, size](1, 0)) assert_equal(Vector[type, size](0, 1).__truediv__(Rotor[type, size](1, 0)), Vector[type, size](0, 1)) assert_equal(Vector[type, size](-1, 0).__truediv__(Rotor[type, size](0, 1)), Vector[type, size](0, 1)) # +--- vector / scalar assert_equal(Vector[type, size](2, 0).__truediv__(2), Vector[type, size](1, 0)) assert_equal(Vector[type, size](0, 2).__truediv__(2), Vector[type, size](0, 1)) assert_equal(Vector[type, size](2, 4).__truediv__(2), Vector[type, size](1, 2)) # +--- rotor / multivector assert_equal(Rotor[type, size](1, 0).__truediv__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Rotor[type, size](0, 1).__truediv__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](1, 0, 0, 0)) assert_equal(Rotor[type, size](1, 0).__truediv__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Rotor[type, size](0, 1).__truediv__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 1, 0, 0)) assert_equal(Rotor[type, size](0, -1).__truediv__(Multivector[type, size](0, 1, 0, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Rotor[type, size](1, 0).__truediv__(Multivector[type, size](0, 0, 1, 0)), Multivector[type, size](0, 0, 1, 0)) assert_equal(Rotor[type, size](0, 1).__truediv__(Multivector[type, size](1, 0, 0, 0)), Multivector[type, size](0, 0, 0, 1)) assert_equal(Rotor[type, size](-1, 0).__truediv__(Multivector[type, size](0, 0, 0, 1)), Multivector[type, size](0, 0, 0, 1)) # +--- rotor / vector assert_equal(Rotor[type, size](1, 0).__truediv__(Vector[type, size](1, 0)), Vector[type, size](1, 0)) assert_equal(Rotor[type, size](0, 1).__truediv__(Vector[type, size](0, 1)), Vector[type, size](1, 0)) assert_equal(Rotor[type, size](0, -1).__truediv__(Vector[type, size](1, 0)), Vector[type, size](0, 1)) assert_equal(Rotor[type, size](1, 0).__truediv__(Vector[type, size](0, 1)), Vector[type, size](0, 1)) # +--- rotor / rotor assert_equal(Rotor[type, size](1, 0).__truediv__(Rotor[type, size](1, 0)), Rotor[type, size](1, 0)) assert_equal(Rotor[type, size](0, 1).__truediv__(Rotor[type, size](0, 1)), Rotor[type, size](1, 0)) assert_equal(Rotor[type, size](1, 0).__truediv__(Rotor[type, size](0, 0)), Rotor[type, size](0, 0)) assert_equal(Rotor[type, size](0, 1).__truediv__(Rotor[type, size](0, 0)), Rotor[type, size](0, 0)) assert_equal(Rotor[type, size](0, -1).__truediv__(Rotor[type, size](0, 0)), Rotor[type, size](0, 0)) assert_equal(Rotor[type, size](1, 0).__truediv__(Rotor[type, size](0, 0)), Rotor[type, size](0, 0)) assert_equal(Rotor[type, size](0, 1).__truediv__(Rotor[type, size](1, 0)), Rotor[type, size](0, 1)) assert_equal(Rotor[type, size](-1, 0).__truediv__(Rotor[type, size](0, 1)), Rotor[type, size](0, 1)) # +--- rotor / scalar assert_equal(Rotor[type, size](2, 0).__truediv__(2), Rotor[type, size](1, 0)) assert_equal(Rotor[type, size](0, 2).__truediv__(2), Rotor[type, size](0, 1)) assert_equal(Rotor[type, size](2, 8).__truediv__(2), Rotor[type, size](1, 4)) # +--- scalar / multivector assert_equal(Multivector[type, size](1, 2, 3, 4).__rtruediv__(SIMD[type, size](2)), Multivector[type, size](0.5, -1, -1.5, -2)) # +--- scalar / vector assert_equal(Vector[type, size](1, 1).__rtruediv__(SIMD[type, size](1)), Vector[type, size](0.5, 0.5)) # +--- rotor / scalar assert_equal(Rotor[type, size](1, 1).__rtruediv__(SIMD[type, size](1)), Rotor[type, size](0.5, -0.5)) --- test/test_g3.mojo --- # x--------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x--------------------------------------------------------------------------x # from testing import assert_true, assert_false, assert_equal from infrared.hard.g3 import * def main(): simd_run[DType.float64, 1]() simd_run[DType.float64, 2]() simd_run[DType.float64, 4]() simd_run[DType.float32, 1]() simd_run[DType.float32, 2]() simd_run[DType.float32, 4]() simd_run[DType.index, 1]() simd_run[DType.index, 2]() simd_run[DType.index, 4]() def simd_run[type: DType, size: Int](): test_eq[type, size]() test_ne[type, size]() test_add[type, size]() test_sub[type, size]() test_mul[type, size]() def test_eq[type: DType, size: Int](): # +--- Multivector assert_true(Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8).__eq__[None](Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8))) assert_false(Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8).__eq__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) assert_true(Multivector[type, size](1, 0, 0, 0, 5, 6, 7, 0).__eq__[None](Rotor[type, size](1, 5, 6, 7))) assert_false(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__eq__[None](Rotor[type, size](8, 4, 3, 2))) assert_true(Multivector[type, size](1, 0, 0, 0, 0, 0, 0, 0).__eq__[None](1)) assert_false(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__eq__[None](8)) assert_true(Multivector[type, size](0, 2, 3, 4, 0, 0, 0, 0).__eq__[None](Vector[type, size](2, 3, 4))) assert_false(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__eq__[None](Vector[type, size](7, 6, 5))) assert_true(Multivector[type, size](0, 0, 0, 0, 5, 6, 7, 0).__eq__[None](Bivector[type, size](5, 6, 7))) assert_false(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__eq__[None](Bivector[type, size](4, 3, 2))) assert_true(Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 8).__eq__[None](Antiox[type, size](8))) assert_false(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__eq__[None](Multivector[type, size](1))) # +--- Rotor assert_true(Rotor[type, size](1, 5, 6, 7).__eq__[None](Multivector[type, size](1, 0, 0, 0, 5, 6, 7, 0))) assert_false(Rotor[type, size](1, 5, 6, 7).__eq__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) assert_true(Rotor[type, size](1, 5, 6, 7).__eq__[None](Rotor[type, size](1, 5, 6, 7))) assert_false(Rotor[type, size](1, 5, 6, 7).__eq__[None](Rotor[type, size](8, 4, 3, 2))) assert_true(Rotor[type, size](1, 0, 0, 0).__eq__[None](1)) assert_false(Rotor[type, size](8, 4, 3, 2).__eq__[None](8)) # (False) assert_true(Rotor[type, size](0, 5, 6, 7).__eq__[None](Bivector[type, size](5, 6, 7))) assert_false(Rotor[type, size](8, 4, 3, 2).__eq__[None](Bivector[type, size](4, 3, 2))) # (False) # +--- Vector assert_true(Vector[type, size](2, 3, 4).__eq__[None](Multivector[type, size](0, 2, 3, 4, 0, 0, 0, 0))) assert_false(Vector[type, size](2, 3, 4).__eq__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) # (False) # (False) assert_true(Vector[type, size](2, 3, 4).__eq__[None](Vector[type, size](2, 3, 4))) assert_false(Vector[type, size](2, 3, 4).__eq__[None](Vector[type, size](7, 6, 5))) # (False) # (False) # +--- Bivector assert_true(Bivector[type, size](5, 6, 7).__eq__[None](Multivector[type, size](0, 0, 0, 0, 5, 6, 7, 0))) assert_false(Bivector[type, size](5, 6, 7).__eq__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) assert_true(Bivector[type, size](5, 6, 7).__eq__[None](Rotor[type, size](0, 5, 6, 7))) assert_false(Bivector[type, size](5, 6, 7).__eq__[None](Rotor[type, size](8, 4, 3, 2))) # (False) # (False) assert_true(Bivector[type, size](5, 6, 7).__eq__[None](Bivector[type, size](5, 6, 7))) assert_false(Bivector[type, size](5, 6, 7).__eq__[None](Bivector[type, size](4, 3, 2))) # (False) # +--- Antiox assert_true(Antiox[type, size](8).__eq__[None](Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 8))) assert_false(Antiox[type, size](8).__eq__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) # (False) # (False) # (False) # (False) assert_true(Antiox[type, size](8).__eq__[None](Antiox[type, size](8))) assert_false(Antiox[type, size](8).__eq__[None](Antiox[type, size](1))) def test_ne[type: DType, size: Int](): # +--- Multivector assert_false(Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8).__ne__[None](Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8))) assert_true(Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8).__ne__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) assert_false(Multivector[type, size](1, 0, 0, 0, 5, 6, 7, 0).__ne__[None](Rotor[type, size](1, 5, 6, 7))) assert_true(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__ne__[None](Rotor[type, size](8, 4, 3, 2))) assert_false(Multivector[type, size](1, 0, 0, 0, 0, 0, 0, 0).__ne__[None](1)) assert_true(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__ne__[None](8)) assert_false(Multivector[type, size](0, 2, 3, 4, 0, 0, 0, 0).__ne__[None](Vector[type, size](2, 3, 4))) assert_true(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__ne__[None](Vector[type, size](7, 6, 5))) assert_false(Multivector[type, size](0, 0, 0, 0, 5, 6, 7, 0).__ne__[None](Bivector[type, size](5, 6, 7))) assert_true(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__ne__[None](Bivector[type, size](4, 3, 2))) assert_false(Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 8).__ne__[None](Antiox[type, size](8))) assert_true(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1).__ne__[None](Multivector[type, size](1))) # +--- Rotor assert_false(Rotor[type, size](1, 5, 6, 7).__ne__[None](Multivector[type, size](1, 0, 0, 0, 5, 6, 7, 0))) assert_true(Rotor[type, size](1, 5, 6, 7).__ne__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) assert_false(Rotor[type, size](1, 5, 6, 7).__ne__[None](Rotor[type, size](1, 5, 6, 7))) assert_true(Rotor[type, size](1, 5, 6, 7).__ne__[None](Rotor[type, size](8, 4, 3, 2))) assert_false(Rotor[type, size](1, 0, 0, 0).__ne__[None](1)) assert_true(Rotor[type, size](8, 4, 3, 2).__ne__[None](8)) # (False) assert_false(Rotor[type, size](0, 5, 6, 7).__ne__[None](Bivector[type, size](5, 6, 7))) assert_true(Rotor[type, size](8, 4, 3, 2).__ne__[None](Bivector[type, size](4, 3, 2))) # (False) # +--- Vector assert_false(Vector[type, size](2, 3, 4).__ne__[None](Multivector[type, size](0, 2, 3, 4, 0, 0, 0, 0))) assert_true(Vector[type, size](2, 3, 4).__ne__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) # (False) # (False) assert_false(Vector[type, size](2, 3, 4).__ne__[None](Vector[type, size](2, 3, 4))) assert_true(Vector[type, size](2, 3, 4).__ne__[None](Vector[type, size](7, 6, 5))) # (False) # (False) # +--- Bivector assert_false(Bivector[type, size](5, 6, 7).__ne__[None](Multivector[type, size](0, 0, 0, 0, 5, 6, 7, 0))) assert_true(Bivector[type, size](5, 6, 7).__ne__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) assert_false(Bivector[type, size](5, 6, 7).__ne__[None](Rotor[type, size](0, 5, 6, 7))) assert_true(Bivector[type, size](5, 6, 7).__ne__[None](Rotor[type, size](8, 4, 3, 2))) # (False) # (False) assert_false(Bivector[type, size](5, 6, 7).__ne__[None](Bivector[type, size](5, 6, 7))) assert_true(Bivector[type, size](5, 6, 7).__ne__[None](Bivector[type, size](4, 3, 2))) # (False) # +--- Antiox assert_false(Antiox[type, size](8).__ne__[None](Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 8))) assert_true(Antiox[type, size](8).__ne__[None](Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1))) # (False) # (False) # (False) # (False) assert_false(Antiox[type, size](8).__ne__[None](Antiox[type, size](8))) assert_true(Antiox[type, size](8).__ne__[None](Antiox[type, size](1))) def test_add[type: DType, size: Int](): assert_equal(Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8).__add__(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1)), Multivector[type, size](9, 9, 9, 9, 9, 9, 9, 9)) assert_equal(Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 0).__add__(Rotor[type, size](1, 1, 1, 1)), Multivector[type, size](1, 0, 0, 0, 1, 1, 1, 0)) assert_equal(Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 0).__add__(SIMD[type, size](1)), Multivector[type, size](1, 0, 0, 0, 0, 0, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 0).__add__(Vector[type, size](1, 1, 1)), Multivector[type, size](0, 1, 1, 1, 0, 0, 0, 0)) assert_equal(Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 0).__add__(Bivector[type, size](1, 1, 1)), Multivector[type, size](0, 0, 0, 0, 1, 1, 1, 0)) assert_equal(Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 0).__add__(Antiox[type, size](1)), Multivector[type, size](0, 0, 0, 0, 0, 0, 0, 1)) assert_equal(Rotor[type, size](1, 1, 1, 1).__add__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](2, 1, 1, 1, 2, 2, 2, 1)) assert_equal(Rotor[type, size](1, 5, 6, 7).__add__(Rotor[type, size](8, 4, 3, 2)), Rotor[type, size](9, 9, 9, 9)) assert_equal(Rotor[type, size](0, 0, 0, 0).__add__(SIMD[type, size](1)), Rotor[type, size](1, 0, 0, 0)) assert_equal(Rotor[type, size](1, 1, 1, 1).__add__(Vector[type, size](1, 1, 1)), Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 0)) assert_equal(Rotor[type, size](1, 1, 1, 1).__add__(Bivector[type, size](1, 1, 1)), Rotor[type, size](1, 2, 2, 2)) assert_equal(Rotor[type, size](1, 1, 1, 1).__add__(Antiox[type, size](1)), Multivector[type, size](1, 0, 0, 0, 1, 1, 1, 1)) assert_equal(Vector[type, size](1, 1, 1).__add__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](1, 2, 2, 2, 1, 1, 1, 1)) assert_equal(Vector[type, size](1, 1, 1).__add__(Rotor[type, size](1, 1, 1, 1)), Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 0)) assert_equal(Vector[type, size](1, 1, 1).__add__(SIMD[type, size](1)), Multivector[type, size](1, 1, 1, 1, 0, 0, 0, 0)) assert_equal(Vector[type, size](2, 3, 4).__add__(Vector[type, size](7, 6, 5)), Vector[type, size](9, 9, 9)) assert_equal(Vector[type, size](1, 1, 1).__add__(Bivector[type, size](1, 1, 1)), Multivector[type, size](0, 1, 1, 1, 1, 1, 1, 0)) assert_equal(Vector[type, size](1, 1, 1).__add__(Antiox[type, size](1)), Multivector[type, size](0, 1, 1, 1, 0, 0, 0, 1)) assert_equal(Bivector[type, size](1, 1, 1).__add__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](1, 1, 1, 1, 2, 2, 2, 1)) assert_equal(Bivector[type, size](1, 1, 1).__add__(Rotor[type, size](1, 1, 1, 1)), Rotor[type, size](1, 2, 2, 2)) assert_equal(Bivector[type, size](1, 1, 1).__add__(SIMD[type, size](1)), Rotor[type, size](1, 1, 1, 1)) assert_equal(Bivector[type, size](1, 1, 1).__add__(Vector[type, size](1, 1, 1)), Multivector[type, size](0, 1, 1, 1, 1, 1, 1, 0)) assert_equal(Bivector[type, size](5, 6, 7).__add__(Bivector[type, size](4, 3, 2)), Bivector[type, size](9, 9, 9)) assert_equal(Bivector[type, size](1, 1, 1).__add__(Antiox[type, size](1)), Multivector[type, size](0, 0, 0, 0, 1, 1, 1, 1)) assert_equal(Antiox[type, size](1).__add__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 2)) assert_equal(Antiox[type, size](1).__add__(Rotor[type, size](1, 1, 1, 1)), Multivector[type, size](1, 0, 0, 0, 1, 1, 1, 1)) assert_equal(Antiox[type, size](1).__add__(SIMD[type, size](1)), Multivector[type, size](1, 0, 0, 0, 0, 0, 0, 1)) assert_equal(Antiox[type, size](1).__add__(Vector[type, size](1, 1, 1)), Multivector[type, size](0, 1, 1, 1, 0, 0, 0, 1)) assert_equal(Antiox[type, size](1).__add__(Bivector[type, size](1, 1, 1)), Multivector[type, size](0, 0, 0, 0, 1, 1, 1, 1)) assert_equal(Antiox[type, size](8).__add__(Antiox[type, size](1)), Antiox[type, size](9)) def test_sub[type: DType, size: Int](): assert_equal(Multivector[type, size](9, 9, 9, 9, 9, 9, 9, 9).__sub__(Multivector[type, size](8, 7, 6, 5, 4, 3, 2, 1)), Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__sub__(Rotor[type, size](1, 1, 1, 1)), Multivector[type, size](0, 1, 1, 1, 0, 0, 0, 1)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__sub__(SIMD[type, size](1)), Multivector[type, size](0, 1, 1, 1, 1, 1, 1, 1)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__sub__(Vector[type, size](1, 1, 1)), Multivector[type, size](1, 0, 0, 0, 1, 1, 1, 1)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__sub__(Bivector[type, size](1, 1, 1)), Multivector[type, size](1, 1, 1, 1, 0, 0, 0, 1)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__sub__(Antiox[type, size](1)), Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 0)) assert_equal(Rotor[type, size](1, 1, 1, 1).__sub__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](0, -1, -1, -1, 0, 0, 0, -1)) assert_equal(Rotor[type, size](9, 9, 9, 9).__sub__(Rotor[type, size](8, 4, 3, 2)), Rotor[type, size](1, 5, 6, 7)) assert_equal(Rotor[type, size](1, 1, 1, 1).__sub__(SIMD[type, size](1)), Rotor[type, size](0, 1, 1, 1)) assert_equal(Rotor[type, size](1, 1, 1, 1).__sub__(Vector[type, size](1, 1, 1)), Multivector[type, size](1, -1, -1, -1, 1, 1, 1, 0)) assert_equal(Rotor[type, size](1, 1, 1, 1).__sub__(Bivector[type, size](1, 1, 1)), Rotor[type, size](1, 0, 0, 0)) assert_equal(Rotor[type, size](1, 1, 1, 1).__sub__(Antiox[type, size](1)), Multivector[type, size](1, 0, 0, 0, 1, 1, 1, -1)) assert_equal(Vector[type, size](1, 1, 1).__sub__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](-1, 0, 0, 0, -1, -1, -1, -1)) assert_equal(Vector[type, size](1, 1, 1).__sub__(Rotor[type, size](1, 1, 1, 1)), Multivector[type, size](-1, 1, 1, 1, -1, -1, -1, 0)) assert_equal(Vector[type, size](1, 1, 1).__sub__(SIMD[type, size](1)), Multivector[type, size](-1, 1, 1, 1, 0, 0, 0, 0)) assert_equal(Vector[type, size](9, 9, 9).__sub__(Vector[type, size](7, 6, 5)), Vector[type, size](2, 3, 4)) assert_equal(Vector[type, size](1, 1, 1).__sub__(Bivector[type, size](1, 1, 1)), Multivector[type, size](0, 1, 1, 1, -1, -1, -1, 0)) assert_equal(Vector[type, size](1, 1, 1).__sub__(Antiox[type, size](1)), Multivector[type, size](0, 1, 1, 1, 0, 0, 0, -1)) assert_equal(Bivector[type, size](1, 1, 1).__sub__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](-1, -1, -1, -1, 0, 0, 0, -1)) assert_equal(Bivector[type, size](1, 1, 1).__sub__(Rotor[type, size](1, 1, 1, 1)), Rotor[type, size](-1, 0, 0, 0)) assert_equal(Bivector[type, size](1, 1, 1).__sub__(SIMD[type, size](1)), Rotor[type, size](-1, 1, 1, 1)) assert_equal(Bivector[type, size](1, 1, 1).__sub__(Vector[type, size](1, 1, 1)), Multivector[type, size](0, -1, -1, -1, 1, 1, 1, 0)) assert_equal(Bivector[type, size](9, 9, 9).__sub__(Bivector[type, size](4, 3, 2)), Bivector[type, size](5, 6, 7)) assert_equal(Bivector[type, size](1, 1, 1).__sub__(Antiox[type, size](1)), Multivector[type, size](0, 0, 0, 0, 1, 1, 1, -1)) assert_equal(Antiox[type, size](1).__sub__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](-1, -1, -1, -1, -1, -1, -1, 0)) assert_equal(Antiox[type, size](1).__sub__(Rotor[type, size](1, 1, 1, 1)), Multivector[type, size](-1, 0, 0, 0, -1, -1, -1, 1)) assert_equal(Antiox[type, size](1).__sub__(SIMD[type, size](1)), Multivector[type, size](-1, 0, 0, 0, 0, 0, 0, 1)) assert_equal(Antiox[type, size](1).__sub__(Vector[type, size](1, 1, 1)), Multivector[type, size](0, -1, -1, -1, 0, 0, 0, 1)) assert_equal(Antiox[type, size](1).__sub__(Bivector[type, size](1, 1, 1)), Multivector[type, size](0, 0, 0, 0, -1, -1, -1, 1)) assert_equal(Antiox[type, size](9).__sub__(Antiox[type, size](1)), Antiox[type, size](8)) def test_mul[type: DType, size: Int](): assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__mul__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](0, 0, 4, 0, 4, 0, 4, 4)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__mul__(Rotor[type, size](1, 1, 1, 1)), Multivector[type, size](-2, -2, 2, 2, 2, 2, 2, 2)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__mul__(SIMD[type, size](2)), Multivector[type, size](2, 2, 2, 2, 2, 2, 2, 2)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__mul__(Vector[type, size](1, 1, 1)), Multivector[type, size](3, 3, 1, -1, 1, -1, 1, 1)) assert_equal(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1).__mul__(Bivector[type, size](1, 1, 1)), Multivector[type, size](-3, -3, 1, 1, 1, 1, 1, 1)) assert_equal(Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8).__mul__(Antiox[type, size](1)), Multivector[type, size](-8, -7, 6, -5, 4, -3, 2, 1)) assert_equal(Rotor[type, size](1, 1, 1, 1).__mul__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](-2, 2, 2, -2, 2, 2, 2, 2)) assert_equal(Rotor[type, size](1, 1, 1, 1).__mul__(Rotor[type, size](1, 1, 1, 1)), Rotor[type, size](-2, 2, 2, 2)) assert_equal(Rotor[type, size](1, 1, 1, 1).__mul__(SIMD[type, size](2)), Rotor[type, size](2, 2, 2, 2)) assert_equal(Rotor[type, size](1, 1, 1, 1).__mul__(Vector[type, size](1, 1, 1)), Multivector[type, size](0, 3, 1, -1, 0, 0, 0, 1)) assert_equal(Rotor[type, size](1, 1, 1, 1).__mul__(Bivector[type, size](1, 1, 1)), Rotor[type, size](-3, 1, 1, 1)) assert_equal(Rotor[type, size](1, 5, 6, 7).__mul__(Antiox[type, size](1)), Multivector[type, size](0, -7, 6, -5, 0, 0, 0, 1)) assert_equal(Vector[type, size](1, 1, 1).__mul__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](3, -1, 1, 3, 1, -1, 1, 1)) assert_equal(Vector[type, size](1, 1, 1).__mul__(Rotor[type, size](1, 1, 1, 1)), Multivector[type, size](0, -1, 1, 3, 0, 0, 0, 1)) assert_equal(Vector[type, size](1, 1, 1).__mul__(Vector[type, size](1, 1, 1)), SIMD[type,size](3)) assert_equal(Vector[type, size](1, 1, 1).__mul__(Bivector[type, size](1, 1, 1)), Multivector[type, size](0, -2, 0, 2, 0, 0, 0, 1)) assert_equal(Vector[type, size](2, 3, 4).__mul__(Antiox[type, size](1)), Bivector[type, size](4, -3, 2)) assert_equal(Bivector[type, size](1, 1, 1).__mul__(Multivector[type, size](1, 1, 1, 1, 1, 1, 1, 1)), Multivector[type, size](-3, 1, 1, -3, 1, 1, 1, 1)) assert_equal(Bivector[type, size](1, 1, 1).__mul__(Rotor[type, size](1, 1, 1, 1)), Rotor[type, size](-3, 1, 1, 1)) assert_equal(Bivector[type, size](1, 1, 1).__mul__(Vector[type, size](1, 1, 1)), Multivector[type, size](0, 2, 0, -2, 0, 0, 0, 1)) assert_equal(Bivector[type, size](1, 1, 1).__mul__(Bivector[type, size](1, 1, 1)), SIMD[type,size](-3)) assert_equal(Bivector[type, size](5, 6, 7).__mul__(Antiox[type, size](1)), Vector[type, size](-7, 6, -5)) assert_equal(Antiox[type, size](1).__mul__(Multivector[type, size](1, 2, 3, 4, 5, 6, 7, 8)), Multivector[type, size](-8, -7, 6, -5, 4, -3, 2, 1)) assert_equal(Antiox[type, size](1).__mul__(Rotor[type, size](1, 5, 6, 7)), Multivector[type, size](0, -7, 6, -5, 0, 0, 0, 1)) assert_equal(Antiox[type, size](1).__mul__(SIMD[type, size](2)), Antiox[type, size](2)) assert_equal(Antiox[type, size](1).__mul__(Vector[type, size](2, 3, 4)), Bivector[type, size](4, -3, 2)) assert_equal(Antiox[type, size](1).__mul__(Bivector[type, size](5, 6, 7)), Vector[type, size](-7, 6, -5)) assert_equal(Antiox[type, size](1).__mul__(Antiox[type, size](1)), SIMD[type,size](-1)) --- test/test_mask.mojo --- # x--------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x--------------------------------------------------------------------------x # from testing import assert_true, assert_false, assert_equal, assert_not_equal from infrared.algebra.mask import * def main(): test_count_true() test_basis2entry() test_entry2basis() def test_count_true(): assert_equal(count_true(List[Bool]()), 0) assert_equal(count_true(List(False)), 0) assert_equal(count_true(List(True)), 1) assert_equal(count_true(List(False, False)), 0) assert_equal(count_true(List(True, False)), 1) assert_equal(count_true(List(False, True)), 1) assert_equal(count_true(List(True, True)), 2) assert_equal(count_true(List(False, True, False, False, False, False, False, False)), 1) assert_equal(count_true(List(False, False, True, False, False, False, False, False)), 1) assert_equal(count_true(List(False, False, False, True, False, False, False, False)), 1) def test_basis2entry(): assert_true(generate_basis2entry(List(False, False, False, False)) == List(-1, -1, -1, -1)) assert_true(generate_basis2entry(List(False, True, False, False)) == List(-1, 0, -1, -1)) assert_true(generate_basis2entry(List(False, True, False, True)) == List(-1, 0, -1, 1)) def test_entry2basis(): assert_true(generate_entry2basis(List(False, False, False, False)) == List[Int]()) assert_true(generate_entry2basis(List(False, True, False, False)) == List(1)) assert_true(generate_entry2basis(List(False, True, False, True)) == List(1, 3)) --- test/test_multivector.mojo --- # x--------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x--------------------------------------------------------------------------x # from testing import assert_true, assert_false, assert_equal, assert_not_equal from _testing import assert_equal_, assert_not_equal_ from infrared.algebra import * def main(): test_eq() test_ne() test_subspace_constructor() test_add() test_sub() test_mul() def test_eq(): alias g3 = Signature(3, 0, 0) assert_true(Multivector[g3, g3.empty_mask()]().__eq__(Float64(0))) assert_true(Multivector[g3, g3.vector_mask()](1, 2, 3).__eq__(Multivector[g3, g3.vector_mask()](1, 2, 3))) assert_false(Multivector[g3, g3.vector_mask()](1, 2, 3).__eq__(Multivector[g3, g3.vector_mask()](1, 4, 3))) assert_false(Multivector[g3, g3.vector_mask()](1, 2, 3).__eq__(Float64(1))) def test_ne(): alias g3 = Signature(3, 0, 0) assert_false(Multivector[g3, g3.empty_mask()]().__ne__(Float64(0))) assert_false(Multivector[g3, g3.vector_mask()](1, 2, 3).__ne__(Multivector[g3, g3.vector_mask()](1, 2, 3))) assert_true(Multivector[g3, g3.vector_mask()](1, 2, 3).__ne__(Multivector[g3, g3.vector_mask()](1, 4, 3))) assert_true(Multivector[g3, g3.vector_mask()](1, 2, 3).__ne__(Float64(1))) def test_subspace_constructor(): assert_true(scalar[G3](6) == Multivector[G3](6)) assert_true(scalar[G3](0) != Multivector[G3](6)) assert_true(vector[G3](1, 2, 3) == Multivector[G3, G3.vector_mask()](1, 2, 3)) assert_true(vector[G3](1, 0, 3) != Multivector[G3, G3.vector_mask()](1, 2, 3)) assert_true(bivector[G3](4, 5, 6) == Multivector[G3, G3.bivector_mask()](4, 5, 6)) assert_true(bivector[G3](4, 0, 6) != Multivector[G3, G3.bivector_mask()](4, 5, 6)) def test_add(): alias g3 = Signature(3, 0, 0) alias scalar_vector_mask = List(True, True, True, True, False, False, False, False) assert_true(Multivector[g3, g3.vector_mask()](1, 2, 3).__add__(Multivector[g3, g3.vector_mask()](1, 2, 3)) == Multivector[g3, g3.vector_mask()](2, 4, 6)) assert_true(Multivector[g3, g3.vector_mask()](1, 2, 3).__add__(Float64(1)) == Multivector[g3, scalar_vector_mask](1, 1, 2, 3)) def test_sub(): alias g3 = Signature(3, 0, 0) alias scalar_vector_mask = List(True, True, True, True, False, False, False, False) assert_true(Multivector[g3, g3.vector_mask()](2, 4, 6).__sub__(Multivector[g3, g3.vector_mask()](1, 2, 3)) == Multivector[g3, g3.vector_mask()](1, 2, 3)) assert_true(Multivector[g3, g3.vector_mask()](1, 2, 3).__sub__(Float64(1)) == Multivector[g3, scalar_vector_mask](-1, 1, 2, 3)) def test_mul(): alias g3 = Signature(3, 0, 0) assert_true(Multivector[g3, g3.vector_mask()](1, 2, 3).__mul__(Float64(2)) == Multivector[g3, g3.vector_mask()](2, 4, 6)) assert_true(Multivector[g3, g3.vector_mask()](1, 2, 3).__mul__(Multivector[g3, g3.antiscalar_mask()](1)) == Multivector[g3, g3.bivector_mask()](3, -2, 1)) alias ug3 = Signature(1, 1, 1, flip_ze = False) alias v1_mask = List(False, True, False, False, False, False, False, False) assert_true(Multivector[ug3, v1_mask](2).__mul__(Multivector[ug3, v1_mask](2)) == Float64(4)) alias v2_mask = List(False, False, True, False, False, False, False, False) assert_true(Multivector[ug3, v2_mask](2).__mul__(Multivector[ug3, v2_mask](2)) == Float64(-4)) alias v3_mask = List(False, False, False, True, False, False, False, False) assert_true(Multivector[ug3, v3_mask](2).__mul__(Multivector[ug3, v3_mask](2)) == Float64(0)) alias pg3 = Signature(3, 0, 1, flip_ze = True) alias niltrivector_mask = List(False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False) assert_true(Multivector[pg3, pg3.vector_mask()](1, 2, 3, 4).__mul__(Float64(2)) == Multivector[pg3, pg3.vector_mask()](2, 4, 6, 8)) assert_true(Multivector[pg3, pg3.vector_mask()](1, 2, 3, 4).__mul__(Multivector[pg3, pg3.antiscalar_mask()](1)) == Multivector[pg3, niltrivector_mask](-4, 3, -2)) --- test/test_signature.mojo --- # x--------------------------------------------------------------------------x # # | MIT License # | Copyright (c) 2024 Helehex # x--------------------------------------------------------------------------x # from testing import assert_true, assert_false, assert_equal, assert_not_equal from _testing import assert_equal_, assert_not_equal_ from infrared.algebra import * def main(): test_signed_sort() test_squash_basis() test_count_odd() def test_signed_sort(): var l = List(1) assert_equal(signed_sort(l), 0) assert_equal_(l, List(1)) l = List(1, 1) assert_equal(signed_sort(l), 0) assert_equal_(l, List(1, 1)) l = List(2, 1, 3, 1) assert_equal(signed_sort(l), 3) assert_equal_(l, List(1, 1, 2, 3)) l = List(5, 5, 4, 5, 1, 1) assert_equal(signed_sort(l), 10) assert_equal_(l, List(1, 1, 4, 5, 5, 5)) def test_squash_basis(): var sig = Signature(1) var basis = List(1, 1) var sign = 1 sig.squash_basis(basis, sign) assert_equal(sign, 1) assert_equal_(basis, List[Int]()) basis = List(1, 1, 2) sign = 1 sig.squash_basis(basis, sign) assert_equal(sign, 1) assert_equal_(basis, List[Int](2)) sig = Signature(0, 1) basis = List(1, 1) sign = 1 sig.squash_basis(basis, sign) assert_equal(sign, -1) assert_equal_(basis, List[Int]()) basis = List(1, 1, 2) sign = 1 sig.squash_basis(basis, sign) assert_equal(sign, -1) assert_equal_(basis, List[Int](2)) sig = Signature(0, 0, 1) basis = List(1, 1) sign = 1 sig.squash_basis(basis, sign) assert_equal(sign, 0) assert_equal_(basis, List[Int]()) basis = List(1, 1, 2) sign = 1 sig.squash_basis(basis, sign) assert_equal(sign, 0) assert_equal_(basis, List[Int](2)) def test_count_odd(): assert_equal(count_odd(List(1)), 1) assert_equal(count_odd(List(2)), 1) assert_equal(count_odd(List(3)), 1) assert_equal(count_odd(List(1, 1)), 0) assert_equal(count_odd(List(1, 2)), 2) assert_equal(count_odd(List(2, 2)), 0) assert_equal(count_odd(List(1, 1, 1)), 1) assert_equal(count_odd(List(1, 1, 2)), 1) assert_equal(count_odd(List(1, 2, 2)), 1) assert_equal(count_odd(List(1, 2, 3)), 3) assert_equal(count_odd(List(1, 1, 1, 1)), 0) assert_equal(count_odd(List(1, 1, 1, 2)), 2) assert_equal(count_odd(List(1, 1, 2, 2)), 0) assert_equal(count_odd(List(1, 2, 2, 2)), 2) assert_equal(count_odd(List(1, 1, 1, 1, 1)), 1) assert_equal(count_odd(List(1, 1, 2, 2, 3)), 1) assert_equal(count_odd(List(1, 2, 2, 2, 3)), 3) --- .gitignore --- bin __pycache__ firedis dump.rdb --- Makefile --- MOJO = mojo .PHONY: firedis firedis: @echo "[release mode]" mojo build firedis.🔥 @mkdir -p bin mv firedis bin/firedis .PHONY: firedis.debug firedis.debug: @echo "[debug mode]" mojo build --debug-level "full" firedis.🔥 @mkdir -p bin mv firedis bin/firedis .PHONY: run run: @mojo run firedis.🔥 .PHONY: clean clean: rm bin/firedis .PHONY: test test: @$(MOJO) run test.mojo --- README.md --- # firedis 🔥 An implementation of the **Redis** protocol, server, and client in the **Mojo** programming language. _For more info read `Makefile`_. --- client.mojo --- from libc import c_void, c_uint, c_char from libc import AF_INET, SOCK_STREAM, SHUT_RDWR from libc import ( connect, htons, inet_pton, send, shutdown, sockaddr, sockaddr_in, socket, strlen, to_char_ptr, ) struct FiredisClient: """ A client for redis. """ var host: String var port: Int var db: Int var sockfd: Int32 fn __init__(inout self): self.host = "0.0.0.0" self.port = 6379 self.db = 0 self.sockfd = 0 fn __init__(inout self, host: String, port: Int, db: Int): self.host = host self.port = port self.db = db self.sockfd = 0 fn connect(inout self) -> Bool: let address_family = AF_INET let ip_buf = Pointer[c_void].alloc(4) let conv_status = inet_pton(address_family, to_char_ptr(self.host), ip_buf) let raw_ip = ip_buf.bitcast[c_uint]().load() print("> inet_pton:", raw_ip, ":: status:", conv_status) let bin_port = htons(UInt16(self.port)) print("> htons:", bin_port) var ai = sockaddr_in(address_family, bin_port, raw_ip, StaticTuple[8, c_char]()) let ai_ptr = Pointer[sockaddr_in].address_of(ai).bitcast[sockaddr]() let sockfd = socket(address_family, SOCK_STREAM, 0) if sockfd == -1: print("> socket creation error") return False print("> sockfd:", sockfd) self.sockfd = sockfd if connect(sockfd, ai_ptr, sizeof[sockaddr_in]()) == -1: _ = shutdown(sockfd, SHUT_RDWR) return False return True fn send(inout self, data: String) -> Bool: let data_ptr = to_char_ptr(data) let data_len = strlen(data_ptr) let sent = send(self.sockfd, data_ptr, data_len, 0) if sent == -1: return False return True fn main(): var client = FiredisClient() if client.connect(): print("> connected") if client.send("*1\r\n$4\r\nPING\r\n"): print("> sent") # TODO: receive response else: print("> connection failed") --- config.mojo --- from libc import exit from algorithm import num_cores from os import getenv # firedis config defaults alias FIREDIS_MAX_CLIENTS = 128 alias FIREDIS_CORE_MULTIPLIER = 1000 alias FIREDIS_PORT = 6379 alias FIREDIS_HOST = "0.0.0.0" struct FiredisConfig: """ Firedis configuration struct. """ var max_clients: Int var core_multiplier: Int var workers: Int var port: UInt16 var host: StringRef fn __init__( inout self: Self, max_clients: Int, core_multiplier: Int, workers: Int, port: UInt16, host: StringRef, ): self.max_clients = max_clients self.core_multiplier = core_multiplier self.workers = workers self.port = port self.host = host fn load_config() -> FiredisConfig: try: var max_clients = atol(getenv("MAX_CLIENTS", "-1")) var core_multiplier = atol(getenv("CORE_MULTIPLIER", "-1")) var port = atol(getenv("PORT", "-1")) let host = getenv("HOST", FIREDIS_HOST) if port == -1: port = FIREDIS_PORT if core_multiplier == -1: core_multiplier = FIREDIS_CORE_MULTIPLIER if max_clients == -1: max_clients = FIREDIS_MAX_CLIENTS var workers = (num_cores() * core_multiplier) if workers > max_clients: workers = max_clients return FiredisConfig(max_clients, core_multiplier, workers, port, host) except e: print("> failed to start firedis:", e.value) print("> error loading configuration, exiting...") exit(-1) return FiredisConfig(-1, -1, -1, 0, "") --- dodgy.mojo --- from list_iterator import ListIterator from memory import memcpy @value @register_passable("trivial") struct DodgyString: """ A string that is dodgy because it is not null-terminated. """ var data: Pointer[Int8] var size: Int fn __init__(value: StringLiteral) -> DodgyString: let l = len(value) let s = String(value) let p = Pointer[Int8].alloc(l) for i in range(l): p.store(i, s._buffer[i]) return DodgyString(p, l) fn __init__(value: String) -> DodgyString: let l = len(value) let p = Pointer[Int8].alloc(l) for i in range(l): p.store(i, value._buffer[i]) return DodgyString(p, l) fn __init__(value: StringRef) -> DodgyString: let l = len(value) let s = String(value) let p = Pointer[Int8].alloc(l) for i in range(l): p.store(i, s._buffer[i]) return DodgyString(p, l) fn __eq__(self, other: DodgyString) -> Bool: if self.size != other.size: return False for i in range(self.size): if self.data.load(i) != other.data.load(i): return False return True fn __ne__(self, other: DodgyString) -> Bool: return not self.__eq__(other) fn __iter__(self) -> ListIterator[Int8]: return ListIterator[Int8](self.data, self.size) fn to_string(self) -> String: let ptr = Pointer[Int8]().alloc(self.size) memcpy(ptr, self.data, self.size) return String(ptr, self.size) fn to_string_ref(self) -> StringRef: let ptr = Pointer[Int8]().alloc(self.size) memcpy(ptr, self.data, self.size) return StringRef( ptr.bitcast[__mlir_type.`!pop.scalar<si8>`]().address, self.size ) --- firedis.🔥 --- from sys.info import sizeof from runtime.llcl import Runtime from algorithm import parallelize, num_cores from string_utils import to_repr from protocol import FiredisParser from table import Table from libc import AF_INET, AF_INET6, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR, SHUT_RDWR from libc import c_char, c_int, c_uint, c_void from libc import ( accept, bind, c_charptr_to_string, exit, htons, # inet_ntoa, # inet_ntop, inet_pton, listen, recv, send, setsockopt, shutdown, sockaddr, sockaddr_in, socket, socklen_t, to_char_ptr, ) from config import load_config fn reply_to_message(inout db: Table, msg: String) -> String: var parser = FiredisParser(db, msg) try: parser.parse() except e: print("> failed to parse message:", e.value) return parser.result fn respond_to_client(inout db: Table, new_sockfd: c_int, workers: Int): with Runtime() as rt: @always_inline @parameter fn handle_messages(n: Int): while True: let buf_size = 1024 let buf = Pointer[c_char]().alloc(buf_size) let bytes_recv = recv(new_sockfd, buf, buf_size, 0) print("> bytes received:", bytes_recv) if bytes_recv <= 0: print("> failed to receive message, client disconnected?") break let msg = c_charptr_to_string(buf, bytes_recv) print("> received message:", to_repr(msg)) let reply = reply_to_message(db, msg) if send(new_sockfd, to_char_ptr(reply), len(reply), 0) == -1: print("> failed to send reply:", to_repr(reply)) break print("> message sent successfully:", to_repr(reply)) parallelize[handle_messages](rt, workers) fn wait_for_clients(inout db: Table, sockfd: c_int, workers: Int): print("> waiting for connections...") while True: with Runtime() as rt: @always_inline @parameter fn handle_client(n: Int): let addr_ptr = Pointer[sockaddr].alloc(1) var sin_size = socklen_t(sizeof[socklen_t]()) let new_sockfd = accept( sockfd, addr_ptr, Pointer[socklen_t].address_of(sin_size) ) if new_sockfd == -1: print("> accept failed") return else: print("> new connection accepted with fd:", new_sockfd) respond_to_client(db, new_sockfd, workers) parallelize[handle_client](rt, workers) fn main(): let config = load_config() var db = Table.create() print("> starting firedis at ip addr:", config.host, "port:", config.port, "🔥") let address_family = AF_INET var ip_buf_size = 4 if address_family == AF_INET6: ip_buf_size = 16 let ip_buf = Pointer[c_void].alloc(ip_buf_size) let conv_status = inet_pton(address_family, to_char_ptr(config.host), ip_buf) let raw_ip = ip_buf.bitcast[c_uint]().load() print("> inet_pton:", raw_ip, "status:", conv_status) let bin_port = htons(config.port) print("> htons:", bin_port) var ai = sockaddr_in(address_family, bin_port, raw_ip, StaticTuple[8, c_char]()) let ai_ptr = Pointer[sockaddr_in].address_of(ai).bitcast[sockaddr]() let sockfd = socket(address_family, SOCK_STREAM, 0) if sockfd == -1: print("> socket creation error") print("> sockfd:", sockfd) var yes: Int = 1 if ( setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, Pointer[Int].address_of(yes).bitcast[c_void](), sizeof[Int](), ) == -1 ): print("> set socket options failed") if bind(sockfd, ai_ptr, sizeof[sockaddr_in]()) == -1: _ = shutdown(sockfd, SHUT_RDWR) print("> binding socket failed") if listen(sockfd, c_int(128)) == -1: print("> listen", sockfd, "failed") print("> started at:", config.host, "port:", config.port, "with fd:", sockfd) print( "> using", config.workers, "workers", "out of", config.max_clients, "max clients", ) wait_for_clients(db, sockfd, config.workers) _ = shutdown(sockfd, SHUT_RDWR) --- hashtable.mojo --- from math import abs from time import now from list_iterator import ListIterator alias NOT_FOUND_ERROR = "Key not found" @always_inline fn hash_fn(key: String) -> Int: var hash = 2166136261 for i in range(len(key)): hash ^= ord(key[i]) hash *= 16777619 return abs(hash) @value @register_passable("trivial") struct Item[T: AnyType]: var key: StringRef var value: T var expire: Int # expire in ms fn __init__(key: StringRef, value: T) -> Self: return Self {key: key, value: value, expire: -1} fn __eq__(self, other: None) -> Bool: return False fn __eq__(self, other: Item[Bool]) -> Bool: return self.key == other.key and rebind[Bool](self.value) == other.value fn __eq__(self, other: Item[Int]) -> Bool: return self.key == other.key and rebind[Int](self.value) == other.value fn __eq__(self, other: Item[Float32]) -> Bool: return self.key == other.key and rebind[Float32](self.value) == other.value fn __eq__(self, other: Item[Float64]) -> Bool: return self.key == other.key and rebind[Float64](self.value) == other.value fn __eq__(self, other: Item[StringRef]) -> Bool: return self.key == other.key and rebind[StringRef](self.value) == other.value fn __ne__(self, other: None) -> Bool: return True fn __ne__(self, other: Item[Bool]) -> Bool: return self.__eq__(other) == False fn __ne__(self, other: Item[Int]) -> Bool: return self.__eq__(other) == False fn __ne__(self, other: Item[Float32]) -> Bool: return self.__eq__(other) == False fn __ne__(self, other: Item[Float64]) -> Bool: return self.__eq__(other) == False fn __ne__(self, other: Item[StringRef]) -> Bool: return self.__eq__(other) == False fn set_value(inout self: Self, value: T): self.value = value fn set_expire(inout self: Self, key: StringRef, expire: Int): self.expire = expire fn is_expired(self: Self) -> Bool: return self.expire != -1 and self.expire < (now() // 1_000_000) fn value_to_string(self: Self) raises -> String: if T == Bool: return String(rebind[Bool](self.value)) elif T == Float32: return String(rebind[Float32](self.value)) elif T == Float64: return String(rebind[Float64](self.value)) elif T == Int: return String(rebind[Int](self.value)) elif T == StringRef: return '"' + String(rebind[StringRef](self.value)) + '"' else: return "???" @value @register_passable("trivial") struct Array[T: AnyType]: var data: Pointer[T] var size: Int var cap: Int fn __init__(size: Int) -> Self: let cap = size * 2 let data = Pointer[T].alloc(cap) return Self {data: data, size: size, cap: cap} fn __init__[ *Ts: AnyType ](inout self, owned other_list: ListLiteral[Ts]) raises -> Self: let other_list_len = len(other_list) let size = 0 let cap = other_list_len * 2 let data = Pointer[T].alloc(self.cap) let src = Pointer.address_of(other_list).bitcast[T]() for i in range(other_list_len): self.push_back(src.load(i)) return Self {data: data, size: size, cap: cap} fn __getitem__(borrowed self: Self, i: Int) raises -> T: if i > self.size: raise Error("Index out of bounds") return self.data.load(i) fn __setitem__(borrowed self: Self, i: Int, item: T) raises: if i > self.size: raise Error("Index out of bounds") self.data.store(i, item) fn __ne__(self: Self, other: None) -> Bool: return False fn __ne__(self: Self, other: Array[Bool]) -> Bool: return not rebind[Bool](self.data.load()) == other.data.load() fn __ne__(self: Self, other: Array[Int]) -> Bool: return not rebind[Int](self.data.load()) == other.data.load() fn __ne__(self: Self, other: Array[StringRef]) -> Bool: return not rebind[StringRef](self.data.load()) == other.data.load() fn __ne__(self: Self, other: Array[Float32]) -> Bool: return not rebind[Float32](self.data.load()) == other.data.load() fn __ne__(self: Self, other: Array[Float64]) -> Bool: return not rebind[Float64](self.data.load()) == other.data.load() fn __iter__(self) -> ListIterator[T]: return ListIterator[T](self.data, self.size) fn __len__(borrowed self) -> Int: return self.size fn push_back(inout self: Self, item: T) raises: if self.size >= self.cap: self.resize(self.size + 1) self.__setitem__(self.size, item) self.size += 1 fn append(inout self: Self, item: T) raises: self.push_back(item) fn resize(inout self: Self, new_size: Int): let new_cap = new_size * 2 let new_data = Pointer[T].alloc(new_cap) for i in range(new_size): new_data.store(i, self.data.load(i)) self.data.free() self.data = new_data self.size = new_size self.cap = new_cap fn remove_at(inout self, index: Int) raises: if index >= self.size: raise Error("Index out of bounds") for i in range(index, self.size - 1): self[i] = self[i + 1] self.size -= 1 @value @register_passable("trivial") struct HashTable[T: AnyType]: var size: Int var data: Array[Array[Item[T]]] var count: Int fn __init__(size: Int) raises -> Self: let table = Array[Array[Item[T]]](size) for i in range(size): table[i] = Array[Item[T]](0) return Self {size: size, data: table, count: 0} fn hash_function(self, key: StringRef) -> Int: return hash_fn(key) % self.size fn set(inout self: Self, key: StringRef, value: T) raises: let hash_index = self.hash_function(key) for i in range(self.data[hash_index].size): if self.data[hash_index][i].key == key: self.data[hash_index][i].set_value(value) self.count += 1 if self.count > self.size: self.resize() return let item = Item[T](key, value) self.data[hash_index].data.store(self.data[hash_index].size, item) self.data[hash_index].resize(self.data[hash_index].size + 1) self.count += 1 if self.count > self.size: self.resize() fn contains(self: Self, key: StringRef) -> Bool: # XXX: This doesn't work for some reason... # but count should be 1 and it's 0 # if self.count == 0: # return False let hash_index = self.hash_function(key) try: for i in range(self.data[hash_index].size): if self.data[hash_index][i].key == key: return True except: pass return False @always_inline fn get_item(inout self: Self, key: StringRef) raises -> Item[T]: let hash_index = self.hash_function(key) for i in range(self.data[hash_index].size): if self.data[hash_index][i].key == key: return self.data[hash_index][i] raise Error(NOT_FOUND_ERROR) fn get(self: Self, key: StringRef) raises -> T: let hash_index = self.hash_function(key) for i in range(self.data[hash_index].size): if self.data[hash_index][i].key == key: return rebind[T](self.data[hash_index][i].value) raise Error(NOT_FOUND_ERROR) fn __getitem__(self: Self, key: StringRef) raises -> T: return self.get(key) fn __setitem__(inout self: Self, key: StringRef, value: T) raises: self.set(key, value) fn delete(inout self: Self, key: StringRef) raises -> Bool: let hash_index = self.hash_function(key) for i in range(self.data[hash_index].size): let item = self.data[hash_index][i] if item.key == key: self.data[hash_index].remove_at(i) self.count -= 1 return True return False fn resize(inout self: Self) raises: let old_table = self.data.data self.size *= 2 self.data = Array[Array[Item[T]]](self.size) for i in range(self.size): let bucket = old_table[i] if bucket != None: for j in range(bucket.size): let item = bucket[j] self.set(item.key, item.value) fn set_expire(inout self: Self, key: StringRef, expires: Int) raises: let hash_index = self.hash_function(key) for i in range(self.data[hash_index].size): if self.data[hash_index][i].key == key: self.data[hash_index][i].set_expire(key, expires) return raise Error(NOT_FOUND_ERROR) fn to_string(inout self: Self) raises -> String: var res: String = "" # use later for multiple levels (a hash table inside of a hash table) let indent = " " res += "\n{\n" res += self._to_string_attrs() res += "}" return res fn _to_string_attrs(self: Self) raises -> String: var res: String = "" let indent = " " for i in range(self.size): let bucket = self.data[i] for j in range(bucket.size): let item = bucket[j] res += indent res += '"' res += item.key res += '"' res += ": " res += item.value_to_string() res += "," if j < bucket.size - 1: res += "\n" return res --- libc.mojo --- from sys.info import sizeof from sys.intrinsics import external_call, _mlirtype_is_eq from memory import memset, memset_zero from utils.static_tuple import StaticTuple # Types aliases alias c_void = UInt8 alias c_char = UInt8 alias c_schar = Int8 alias c_uchar = UInt8 alias c_short = Int16 alias c_ushort = UInt16 alias c_int = Int32 alias c_uint = UInt32 alias c_long = Int64 alias c_ulong = UInt64 alias c_float = Float32 alias c_double = Float64 # Note: `Int` is known to be machine's width alias c_size_t = Int alias c_ssize_t = Int alias ptrdiff_t = Int64 alias intptr_t = Int64 alias uintptr_t = UInt64 # --- ( error.h Constants )----------------------------------------------------- alias EPERM = 1 alias ENOENT = 2 alias ESRCH = 3 alias EINTR = 4 alias EIO = 5 alias ENXIO = 6 alias E2BIG = 7 alias ENOEXEC = 8 alias EBADF = 9 alias ECHILD = 10 alias EAGAIN = 11 alias ENOMEM = 12 alias EACCES = 13 alias EFAULT = 14 alias ENOTBLK = 15 alias EBUSY = 16 alias EEXIST = 17 alias EXDEV = 18 alias ENODEV = 19 alias ENOTDIR = 20 alias EISDIR = 21 alias EINVAL = 22 alias ENFILE = 23 alias EMFILE = 24 alias ENOTTY = 25 alias ETXTBSY = 26 alias EFBIG = 27 alias ENOSPC = 28 alias ESPIPE = 29 alias EROFS = 30 alias EMLINK = 31 alias EPIPE = 32 alias EDOM = 33 alias ERANGE = 34 alias EWOULDBLOCK = EAGAIN fn to_char_ptr(s: String) -> Pointer[c_char]: """Only ASCII-based strings.""" let ptr = Pointer[c_char]().alloc(len(s)) for i in range(len(s)): ptr.store(i, ord(s[i])) return ptr fn c_charptr_to_string(s: Pointer[c_char]) -> String: return String(s.bitcast[Int8](), strlen(s)) fn c_charptr_to_string(s: Pointer[c_char], n: c_size_t) -> String: return String(s.bitcast[Int8](), n) # fn cftob(val: c_int) -> Bool: # """Convert C-like failure (-1) to Bool""" # return rebind[Bool](val > 0) @always_inline("nodebug") fn external_call6[ callee: StringLiteral, type: AnyType, T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType, T5: AnyType, ](arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) -> type: """Call an external function. Parameters: callee: The name of the external function. type: The return type. T0: The first argument type. T1: The second argument type. T2: The third argument type. T3: The fourth argument type. T4: The fifth argument type. T5: The fifth argument type. Args: arg0: The first argument. arg1: The second argument. arg2: The third argument. arg3: The fourth argument. arg4: The fifth argument. arg5: The fifth argument. Returns: The external call result. """ @parameter if _mlirtype_is_eq[type, NoneType](): __mlir_op.`pop.external_call`[func : callee.value, _type:None]( arg0, arg1, arg2, arg3, arg4, arg5 ) return rebind[type](None) else: return __mlir_op.`pop.external_call`[func : callee.value, _type:type]( arg0, arg1, arg2, arg3, arg4, arg5 ) @always_inline("nodebug") fn external_call7[ callee: StringLiteral, type: AnyType, T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType, T5: AnyType, T6: AnyType, ](arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) -> type: """Call an external function. Parameters: callee: The name of the external function. type: The return type. T0: The first argument type. T1: The second argument type. T2: The third argument type. T3: The fourth argument type. T4: The fifth argument type. T5: The sixth argument type. T6: The seventh argument type. Args: arg0: The first argument. arg1: The second argument. arg2: The third argument. arg3: The fourth argument. arg4: The fifth argument. arg5: The sixth argument. arg6: The seventh argument. Returns: The external call result. """ @parameter if _mlirtype_is_eq[type, NoneType](): __mlir_op.`pop.external_call`[func : callee.value, _type:None]( arg0, arg1, arg2, arg3, arg4, arg5, arg6 ) return rebind[type](None) else: return __mlir_op.`pop.external_call`[func : callee.value, _type:type]( arg0, arg1, arg2, arg3, arg4, arg5, arg6 ) # --- ( Network Related Constants )--------------------------------------------- alias sa_family_t = c_ushort alias socklen_t = c_uint alias in_addr_t = c_uint alias in_port_t = c_ushort # Address Family Constants alias AF_UNSPEC = 0 alias AF_UNIX = 1 alias AF_LOCAL = AF_UNIX alias AF_INET = 2 alias AF_AX25 = 3 alias AF_IPX = 4 alias AF_APPLETALK = 5 alias AF_NETROM = 6 alias AF_BRIDGE = 7 alias AF_ATMPVC = 8 alias AF_X25 = 9 alias AF_INET6 = 10 alias AF_ROSE = 11 alias AF_DECnet = 12 alias AF_NETBEUI = 13 alias AF_SECURITY = 14 alias AF_KEY = 15 alias AF_NETLINK = 16 alias AF_ROUTE = AF_NETLINK alias AF_PACKET = 17 alias AF_ASH = 18 alias AF_ECONET = 19 alias AF_ATMSVC = 20 alias AF_RDS = 21 alias AF_SNA = 22 alias AF_IRDA = 23 alias AF_PPPOX = 24 alias AF_WANPIPE = 25 alias AF_LLC = 26 alias AF_CAN = 29 alias AF_TIPC = 30 alias AF_BLUETOOTH = 31 alias AF_IUCV = 32 alias AF_RXRPC = 33 alias AF_ISDN = 34 alias AF_PHONET = 35 alias AF_IEEE802154 = 36 alias AF_CAIF = 37 alias AF_ALG = 38 alias AF_NFC = 39 alias AF_VSOCK = 40 alias AF_KCM = 41 alias AF_QIPCRTR = 42 alias AF_MAX = 43 alias PF_UNSPEC = AF_UNSPEC alias PF_UNIX = AF_UNIX alias PF_LOCAL = AF_LOCAL alias PF_INET = AF_INET alias PF_AX25 = AF_AX25 alias PF_IPX = AF_IPX alias PF_APPLETALK = AF_APPLETALK alias PF_NETROM = AF_NETROM alias PF_BRIDGE = AF_BRIDGE alias PF_ATMPVC = AF_ATMPVC alias PF_X25 = AF_X25 alias PF_INET6 = AF_INET6 alias PF_ROSE = AF_ROSE alias PF_DECnet = AF_DECnet alias PF_NETBEUI = AF_NETBEUI alias PF_SECURITY = AF_SECURITY alias PF_KEY = AF_KEY alias PF_NETLINK = AF_NETLINK alias PF_ROUTE = AF_ROUTE alias PF_PACKET = AF_PACKET alias PF_ASH = AF_ASH alias PF_ECONET = AF_ECONET alias PF_ATMSVC = AF_ATMSVC alias PF_RDS = AF_RDS alias PF_SNA = AF_SNA alias PF_IRDA = AF_IRDA alias PF_PPPOX = AF_PPPOX alias PF_WANPIPE = AF_WANPIPE alias PF_LLC = AF_LLC alias PF_CAN = AF_CAN alias PF_TIPC = AF_TIPC alias PF_BLUETOOTH = AF_BLUETOOTH alias PF_IUCV = AF_IUCV alias PF_RXRPC = AF_RXRPC alias PF_ISDN = AF_ISDN alias PF_PHONET = AF_PHONET alias PF_IEEE802154 = AF_IEEE802154 alias PF_CAIF = AF_CAIF alias PF_ALG = AF_ALG alias PF_NFC = AF_NFC alias PF_VSOCK = AF_VSOCK alias PF_KCM = AF_KCM alias PF_QIPCRTR = AF_QIPCRTR alias PF_MAX = AF_MAX # Socket Type constants alias SOCK_STREAM = 1 alias SOCK_DGRAM = 2 alias SOCK_RAW = 3 alias SOCK_RDM = 4 alias SOCK_SEQPACKET = 5 alias SOCK_DCCP = 6 alias SOCK_PACKET = 10 # alias SOCK_CLOEXEC = O_CLOEXEC # alias SOCK_NONBLOCK = O_NONBLOCK # Address Information alias AI_PASSIVE = 1 alias AI_CANONNAME = 2 alias AI_NUMERICHOST = 4 alias AI_V4MAPPED = 8 alias AI_ALL = 16 alias AI_ADDRCONFIG = 32 alias AI_IDN = 64 alias INET_ADDRSTRLEN = 16 alias INET6_ADDRSTRLEN = 46 alias SHUT_RD = 0 alias SHUT_WR = 1 alias SHUT_RDWR = 2 alias SOL_SOCKET = 1 alias SO_DEBUG = 1 alias SO_REUSEADDR = 2 alias SO_TYPE = 3 alias SO_ERROR = 4 alias SO_DONTROUTE = 5 alias SO_BROADCAST = 6 alias SO_SNDBUF = 7 alias SO_RCVBUF = 8 alias SO_KEEPALIVE = 9 alias SO_OOBINLINE = 10 alias SO_NO_CHECK = 11 alias SO_PRIORITY = 12 alias SO_LINGER = 13 alias SO_BSDCOMPAT = 14 alias SO_REUSEPORT = 15 alias SO_PASSCRED = 16 alias SO_PEERCRED = 17 alias SO_RCVLOWAT = 18 alias SO_SNDLOWAT = 19 alias SO_RCVTIMEO = 20 alias SO_SNDTIMEO = 21 # alias SO_RCVTIMEO_OLD = 20 # alias SO_SNDTIMEO_OLD = 21 alias SO_SECURITY_AUTHENTICATION = 22 alias SO_SECURITY_ENCRYPTION_TRANSPORT = 23 alias SO_SECURITY_ENCRYPTION_NETWORK = 24 alias SO_BINDTODEVICE = 25 alias SO_ATTACH_FILTER = 26 alias SO_DETACH_FILTER = 27 alias SO_GET_FILTER = SO_ATTACH_FILTER alias SO_PEERNAME = 28 alias SO_TIMESTAMP = 29 # alias SO_TIMESTAMP_OLD = 29 alias SO_ACCEPTCONN = 30 alias SO_PEERSEC = 31 alias SO_SNDBUFFORCE = 32 alias SO_RCVBUFFORCE = 33 alias SO_PASSSEC = 34 alias SO_TIMESTAMPNS = 35 # alias SO_TIMESTAMPNS_OLD = 35 alias SO_MARK = 36 alias SO_TIMESTAMPING = 37 # alias SO_TIMESTAMPING_OLD = 37 alias SO_PROTOCOL = 38 alias SO_DOMAIN = 39 alias SO_RXQ_OVFL = 40 alias SO_WIFI_STATUS = 41 alias SCM_WIFI_STATUS = SO_WIFI_STATUS alias SO_PEEK_OFF = 42 alias SO_NOFCS = 43 alias SO_LOCK_FILTER = 44 alias SO_SELECT_ERR_QUEUE = 45 alias SO_BUSY_POLL = 46 alias SO_MAX_PACING_RATE = 47 alias SO_BPF_EXTENSIONS = 48 alias SO_INCOMING_CPU = 49 alias SO_ATTACH_BPF = 50 alias SO_DETACH_BPF = SO_DETACH_FILTER alias SO_ATTACH_REUSEPORT_CBPF = 51 alias SO_ATTACH_REUSEPORT_EBPF = 52 alias SO_CNX_ADVICE = 53 alias SCM_TIMESTAMPING_OPT_STATS = 54 alias SO_MEMINFO = 55 alias SO_INCOMING_NAPI_ID = 56 alias SO_COOKIE = 57 alias SCM_TIMESTAMPING_PKTINFO = 58 alias SO_PEERGROUPS = 59 alias SO_ZEROCOPY = 60 alias SO_TXTIME = 61 alias SCM_TXTIME = SO_TXTIME alias SO_BINDTOIFINDEX = 62 alias SO_TIMESTAMP_NEW = 63 alias SO_TIMESTAMPNS_NEW = 64 alias SO_TIMESTAMPING_NEW = 65 alias SO_RCVTIMEO_NEW = 66 alias SO_SNDTIMEO_NEW = 67 alias SO_DETACH_REUSEPORT_BPF = 68 # --- ( Network Related Structs )----------------------------------------------- @value @register_passable("trivial") struct in_addr: var s_addr: in_addr_t @value @register_passable("trivial") struct in6_addr: var s6_addr: StaticTuple[16, c_char] @value @register_passable("trivial") struct sockaddr: var sa_family: sa_family_t var sa_data: StaticTuple[14, c_char] @value @register_passable("trivial") struct sockaddr_in: var sin_family: sa_family_t var sin_port: in_port_t var sin_addr: in_addr var sin_zero: StaticTuple[8, c_char] @value @register_passable("trivial") struct sockaddr_in6: var sin6_family: sa_family_t var sin6_port: in_port_t var sin6_flowinfo: c_uint var sin6_addr: in6_addr var sin6_scope_id: c_uint @value @register_passable("trivial") struct addrinfo: var ai_flags: c_int var ai_family: c_int var ai_socktype: c_int var ai_protocol: c_int var ai_addrlen: socklen_t var ai_addr: Pointer[sockaddr] var ai_canonname: Pointer[c_char] # FIXME(cristian): This should be Pointer[addrinfo] var ai_next: Pointer[c_void] fn __init__() -> Self: return Self( 0, 0, 0, 0, 0, Pointer[sockaddr](), Pointer[c_char](), Pointer[c_void]() ) fn strlen(s: Pointer[c_char]) -> c_size_t: """Libc POSIX `strlen` function. Reference: https://man7.org/linux/man-pages/man3/strlen.3p.html Fn signature: size_t strlen(const char *s) Args: s: A pointer to a C string. Returns: The length of the string.""" return external_call["strlen", c_size_t, Pointer[c_char]](s) # --- ( Network Related Syscalls & Structs )------------------------------------ fn htonl(hostlong: c_uint) -> c_uint: """Libc POSIX `htonl` function. Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint32_t htonl(uint32_t hostlong) Args: hostlong: A 32-bit unsigned integer in host byte order. Returns: A 32-bit unsigned integer in network byte order.""" return external_call["htonl", c_uint, c_uint](hostlong) fn htons(hostshort: c_ushort) -> c_ushort: """Libc POSIX `htons` function. Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint16_t htons(uint16_t hostshort) Args: hostshort: A 16-bit unsigned integer in host byte order. Returns: A 16-bit unsigned integer in network byte order. """ return external_call["htons", c_ushort, c_ushort](hostshort) fn ntohl(netlong: c_uint) -> c_uint: """Libc POSIX `ntohl` function. Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint32_t ntohl(uint32_t netlong) Args: netlong: A 32-bit unsigned integer in network byte order. Returns: A 32-bit unsigned integer in host byte order. """ return external_call["ntohl", c_uint, c_uint](netlong) fn ntohs(netshort: c_ushort) -> c_ushort: """Libc POSIX `ntohs` function. Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint16_t ntohs(uint16_t netshort) Args: netshort: A 16-bit unsigned integer in network byte order. Returns: A 16-bit unsigned integer in host byte order. """ return external_call["ntohs", c_ushort, c_ushort](netshort) # FIXME: this doesn't work # # NOTE: here's what we want to do: # print( # "> got connection from:", # c_charptr_to_string( # inet_ntoa(addr_ptr.bitcast[sockaddr_in]().load().sin_addr.s_addr) # ), # ) # # let _sockaddr = addr_ptr.bitcast[sockaddr_in]().load() # var sin_addr = _sockaddr.sin_addr.s_addr # let sin_addr_ptr = Pointer[UInt32].address_of(sin_addr) # # let client_addr = inet_ntop( # address_family, # sin_addr_ptr, # ip_buf, # ip_buf_size, # ) # let src = to_char_ptr("0.0.0.0.0") # var dst = Pointer[c_char].alloc(14) # let res = inet_ntop(address_family, src, dst, strlen(dst)) # print("> server: got connection from", c_charptr_to_string(client_addr)) fn inet_ntop( af: c_int, src: Pointer[c_uint], dst: Pointer[c_char], size: socklen_t ) -> Pointer[c_char]: """Libc POSIX `inet_ntop` function. Reference: https://man7.org/linux/man-pages/man3/inet_ntop.3p.html. Fn signature: const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size) Args: af: Address Family see AF_ alises. src: A pointer to a binary address. dst: A pointer to a buffer to store the string representation of the address. size: The size of the buffer pointed by dst. Returns: A pointer. """ return external_call[ "inet_ntop", Pointer[c_char], # FnName, RetType c_int, Pointer[c_uint], Pointer[c_char], socklen_t, # Args ](af, src, dst, size) fn inet_pton(af: c_int, src: Pointer[c_char], dst: Pointer[c_void]) -> c_int: """Libc POSIX `inet_pton` function. Reference: https://man7.org/linux/man-pages/man3/inet_ntop.3p.html Fn signature: int inet_pton(int af, const char *restrict src, void *restrict dst) Args: af: Address Family see AF_ alises. src: A pointer to a string representation of an address. dst: A pointer to a buffer to store the binary address. Returns: A pointer. """ return external_call[ "inet_pton", c_int, # FnName, RetType c_int, Pointer[c_char], Pointer[c_void], # Args ](af, src, dst) fn inet_addr(cp: Pointer[c_char]) -> in_addr_t: """Libc POSIX `inet_addr` function. Reference: https://man7.org/linux/man-pages/man3/inet_addr.3p.html Fn signature: in_addr_t inet_addr(const char *cp) Args: cp: A pointer to a string representation of an address. Returns: A pointer. """ return external_call["inet_addr", in_addr_t, Pointer[c_char]](cp) fn inet_ntoa(addr: in_addr) -> Pointer[c_char]: """Libc POSIX `inet_ntoa` function. Reference: https://man7.org/linux/man-pages/man3/inet_addr.3p.html Fn signature: char *inet_ntoa(struct in_addr in) Args: in: A pointer to a binary address. Returns: A pointer. """ return external_call["inet_ntoa", Pointer[c_char], in_addr](addr) fn socket(domain: c_int, type: c_int, protocol: c_int) -> c_int: """Libc POSIX `socket` function. Reference: https://man7.org/linux/man-pages/man3/socket.3p.html Fn signature: int socket(int domain, int type, int protocol) Args: domain: Address Family see AF_ alises. type: Socket Type see SOCK_ alises. protocol: Protocol see IPPROTO_ alises. Returns: A pointer to a socket. """ return external_call[ "socket", c_int, c_int, c_int, c_int # FnName, RetType # Args ](domain, type, protocol) fn setsockopt( socket: c_int, level: c_int, option_name: c_int, option_value: Pointer[c_void], option_len: socklen_t, ) -> c_int: """Libc POSIX `setsockopt` function. Reference: https://man7.org/linux/man-pages/man3/setsockopt.3p.html Fn signature: int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len) Args: socket: A pointer to a socket. level: Protocol Level see SOL_ alises. option_name: Option name see SO_ alises. option_value: A pointer to a buffer containing the option value. option_len: The size of the buffer pointed by option_value. Returns: A pointer to a socket opt. """ return external_call[ "setsockopt", c_int, # FnName, RetType c_int, c_int, c_int, Pointer[c_void], socklen_t, # Args ](socket, level, option_name, option_value, option_len) fn bind(socket: c_int, address: Pointer[sockaddr], address_len: socklen_t) -> c_int: """Libc POSIX `bind` function. Reference: https://man7.org/linux/man-pages/man3/bind.3p.html Fn signature: int bind(int socket, const struct sockaddr *address, socklen_t address_len) """ return external_call[ "bind", c_int, c_int, Pointer[sockaddr], socklen_t # FnName, RetType # Args ](socket, address, address_len) fn listen(socket: c_int, backlog: c_int) -> c_int: """Libc POSIX `listen` function. Reference: https://man7.org/linux/man-pages/man3/listen.3p.html Fn signature: int listen(int socket, int backlog) Args: socket: A pointer to a socket. backlog: The maximum length to which the queue of pending connections for socket may grow. Returns: A pointer to a socket. """ return external_call["listen", c_int, c_int, c_int](socket, backlog) fn accept( socket: c_int, address: Pointer[sockaddr], address_len: Pointer[socklen_t] ) -> c_int: """Libc POSIX `accept` function. Reference: https://man7.org/linux/man-pages/man3/accept.3p.html Fn signature: int accept(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len); Args: socket: A pointer to a socket. address: A pointer to a buffer to store the address of the accepted socket. address_len: A pointer to a buffer to store the length of the address of the accepted socket. Returns: A pointer to a socket. """ return external_call[ "accept", c_int, # FnName, RetType c_int, Pointer[sockaddr], Pointer[socklen_t], # Args ](socket, address, address_len) fn connect(socket: c_int, address: Pointer[sockaddr], address_len: socklen_t) -> c_int: """Libc POSIX `connect` function. Reference: https://man7.org/linux/man-pages/man3/connect.3p.html Fn signature: int connect(int socket, const struct sockaddr *address, socklen_t address_len) Args: socket: A pointer to a socket. address: A pointer to a buffer to store the address of the accepted socket. address_len: A pointer to a buffer to store the length of the address of the accepted socket. Returns: A pointer to a socket. """ return external_call[ "connect", c_int, c_int, Pointer[sockaddr], socklen_t # FnName, RetType # Args ](socket, address, address_len) fn recv( socket: c_int, buffer: Pointer[c_void], length: c_size_t, flags: c_int ) -> c_ssize_t: """Libc POSIX `recv` function. Reference: https://man7.org/linux/man-pages/man3/recv.3p.html Fn signature: ssize_t recv(int socket, void *buffer, size_t length, int flags) """ return external_call[ "recv", c_ssize_t, # FnName, RetType c_int, Pointer[c_void], c_size_t, c_int, # Args ](socket, buffer, length, flags) fn recvfrom( socket: c_int, buffer: Pointer[c_void], length: c_size_t, flags: c_int, address: Pointer[sockaddr], address_len: Pointer[socklen_t], ) -> c_ssize_t: """Libc POSIX `recvfrom` function. Reference: https://man7.org/linux/man-pages/man3/recvfrom.3p.html Fn signature: ssize_t recvfrom(int socket, void *restrict buffer, size_t length, int flags, struct sockaddr *restrict address, socklen_t *restrict address_len) """ return external_call6[ "recvfrom", c_ssize_t, # FnName, RetType c_int, Pointer[c_void], c_size_t, c_int, Pointer[sockaddr], # Args Pointer[socklen_t], # Args ](socket, buffer, length, flags, address, address_len) fn send( socket: c_int, buffer: Pointer[c_void], length: c_size_t, flags: c_int ) -> c_ssize_t: """Libc POSIX `send` function. Reference: https://man7.org/linux/man-pages/man3/send.3p.html Fn signature: ssize_t send(int socket, const void *buffer, size_t length, int flags) Args: socket: A pointer to a socket. buffer: A pointer to a buffer to store the address of the accepted socket. length: A pointer to a buffer to store the length of the address of the accepted socket. flags: A pointer to a buffer to store the length of the address of the accepted socket. Returns: A pointer to a socket. """ return external_call[ "send", c_ssize_t, # FnName, RetType c_int, Pointer[c_void], c_size_t, c_int, # Args ](socket, buffer, length, flags) fn sendto( socket: c_int, message: Pointer[c_void], length: c_size_t, flags: c_int, dest_addr: Pointer[sockaddr], dest_len: socklen_t, ) -> c_ssize_t: """Libc POSIX `sendto` function. Reference: https://man7.org/linux/man-pages/man3/sendto.3p.html Fn signature: ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len) Args: socket: A pointer to a socket. message: A pointer to a buffer to store the address of the accepted socket. length: A pointer to a buffer to store the length of the address of the accepted socket. flags: A pointer to a buffer to store the length of the address of the accepted socket. dest_addr: A pointer to a buffer to store the length of the address of the accepted socket. dest_len: A pointer to a buffer to store the length of the address of the accepted socket. Returns: A pointer to a socket. """ return external_call6[ "sendto", c_ssize_t, # FnName, RetType c_int, Pointer[c_void], c_size_t, c_int, Pointer[sockaddr], socklen_t, # Args ](socket, message, length, flags, dest_addr, dest_len) fn shutdown(socket: c_int, how: c_int) -> c_int: """Libc POSIX `shutdown` function. Reference: https://man7.org/linux/man-pages/man3/shutdown.3p.html Fn signature: int shutdown(int socket, int how) Args: socket: A pointer to a socket. how: A pointer to a buffer to store the length of the address of the accepted socket. Returns: A pointer to a socket. """ return external_call["shutdown", c_int, c_int, c_int]( # FnName, RetType # Args socket, how ) fn getaddrinfo( nodename: Pointer[c_char], servname: Pointer[c_char], hints: Pointer[addrinfo], res: Pointer[Pointer[addrinfo]], ) -> c_int: """Libc POSIX `getaddrinfo` function. Reference: https://man7.org/linux/man-pages/man3/getaddrinfo.3p.html Fn signature: int getaddrinfo(const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, struct addrinfo **restrict res) """ return external_call[ "getaddrinfo", c_int, # FnName, RetType Pointer[c_char], Pointer[c_char], Pointer[addrinfo], # Args Pointer[Pointer[addrinfo]], # Args ](nodename, servname, hints, res) fn gai_strerror(ecode: c_int) -> Pointer[c_char]: """Libc POSIX `gai_strerror` function. Reference: https://man7.org/linux/man-pages/man3/gai_strerror.3p.html Fn signature: const char *gai_strerror(int ecode) Args: ecode: A pointer to a socket. Returns: A pointer to a socket. """ return external_call[ "gai_strerror", Pointer[c_char], c_int # FnName, RetType # Args ](ecode) # fn get_addr(ptr: Pointer[sockaddr]) -> sockaddr: # if ptr.load().sa_family == AF_INET: # ptr.bitcast[sockaddr_in]().load().sin_addr # return ptr.bitcast[sockaddr_in6]().load().sin6_addr fn inet_pton(address_family: Int, address: String) -> Int: var ip_buf_size = 4 if address_family == AF_INET6: ip_buf_size = 16 let ip_buf = Pointer[c_void].alloc(ip_buf_size) let conv_status = inet_pton( rebind[c_int](address_family), to_char_ptr(address), ip_buf ) return ip_buf.bitcast[c_uint]().load().to_int() # --- ( File Related Syscalls & Structs )--------------------------------------- alias off_t = Int64 alias mode_t = UInt32 alias FM_READ = "r" alias FM_WRITE = "w" alias FM_APPEND = "a" alias FM_BINARY = "b" alias FM_PLUS = "+" alias SEEK_SET = 0 alias SEEK_CUR = 1 alias SEEK_END = 2 alias O_RDONLY = 0 alias O_WRONLY = 1 alias O_RDWR = 2 alias O_APPEND = 8 alias O_CREAT = 512 alias O_TRUNC = 1024 alias O_EXCL = 2048 alias O_SYNC = 8192 alias O_NONBLOCK = 16384 alias O_ACCMODE = 3 alias O_CLOEXEC = 524288 # from fcntl.h alias O_EXEC = -1 alias O_SEARCH = -1 alias O_DIRECTORY = -1 alias O_DSYNC = -1 alias O_NOCTTY = -1 alias O_NOFOLLOW = -1 alias O_RSYNC = -1 alias O_TTY_INIT = -1 alias STDIN_FILENO = 0 alias STDOUT_FILENO = 1 alias STDERR_FILENO = 2 alias F_DUPFD = 0 alias F_GETFD = 1 alias F_SETFD = 2 alias F_GETFL = 3 alias F_SETFL = 4 alias F_GETOWN = 5 alias F_SETOWN = 6 alias F_GETLK = 7 alias F_SETLK = 8 alias F_SETLKW = 9 alias F_RGETLK = 10 alias F_RSETLK = 11 alias F_CNVT = 12 alias F_RSETLKW = 13 alias F_DUPFD_CLOEXEC = 14 # TODO(cristian) alias FD_CLOEXEC = -1 alias F_RDLCK = -1 alias F_UNLCK = -1 alias F_WRLCK = -1 alias AT_EACCESS = 512 alias AT_FDCWD = -100 alias AT_SYMLINK_NOFOLLOW = 256 alias AT_REMOVEDIR = 512 alias AT_SYMLINK_FOLLOW = 1024 alias AT_NO_AUTOMOUNT = 2048 alias AT_EMPTY_PATH = 4096 alias AT_RECURSIVE = 32768 @register_passable("trivial") struct FILE: pass fn fcntl[*T: AnyType](fildes: c_int, cmd: c_int, *args: *T) -> c_int: """Libc POSIX `fcntl` function. Reference: https://man7.org/linux/man-pages/man3/close.3p.html Fn signature: int fcntl(int fildes, int cmd, ...) Args: fildes: A File Descriptor to close. cmd: A command to execute. args: Arguments for the command, args: Arguments for the command. Returns: Upon successful completion,0 shall be returned; otherwise, -1 shall be returned and errno set to indicate the error. """ return external_call["fcntl", c_int, c_int, c_int]( # FnName, RetType # Args fildes, cmd, args ) fn close(fildes: c_int) -> c_int: """Libc POSIX `close` function. Reference: https://man7.org/linux/man-pages/man3/close.3p.html Fn signature: int close(int fildes) Args: fildes: A File Descriptor to close. Returns: Upon successful completion, 0 shall be returned; otherwise, -1 shall be returned and errno set to indicate the error. """ return external_call["close", c_int, c_int](fildes) fn open[*T: AnyType](path: Pointer[c_char], oflag: c_int, *args: *T) -> c_int: """Libc POSIX `open` function. Reference: https://man7.org/linux/man-pages/man3/open.3p.html Fn signature: int open(const char *path, int oflag, ...) Args: path: A path to a file. oflag: A flag to open the file with. args: Arguments. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "open", c_int, Pointer[c_char], c_int # FnName, RetType # Args ](path, oflag, args) fn openat[ *T: AnyType ](fd: c_int, path: Pointer[c_char], oflag: c_int, *args: *T) -> c_int: """Libc POSIX `open` function. Reference: https://man7.org/linux/man-pages/man3/open.3p.html Fn signature: int openat(int fd, const char *path, int oflag, ...) Args: fd: A File Descriptor to open the file with. path: A path to a file. oflag: A flag to open the file with. args: Arguments. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "openat", c_int, c_int, Pointer[c_char], c_int # FnName, RetType # Args ](fd, path, oflag, args) fn fopen(pathname: Pointer[c_char], mode: Pointer[c_char]) -> Pointer[FILE]: """Libc POSIX `fopen` function. Reference: https://man7.org/linux/man-pages/man3/fopen.3p.html Fn signature: FILE *fopen(const char *restrict pathname, const char *restrict mode) Args: pathname: A path to a file. mode: A mode to open the file with. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fopen", Pointer[FILE], # FnName, RetType Pointer[c_char], Pointer[c_char], # Args ](pathname, mode) fn fdopen(fildes: c_int, mode: Pointer[c_char]) -> Pointer[FILE]: """Libc POSIX `fdopen` function. Reference: https://man7.org/linux/man-pages/man3/fdopen.3p.html Fn signature: FILE *fdopen(int fildes, const char *mode) Args: fildes: A File Descriptor to open the file with. mode: A mode to open the file with. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fdopen", Pointer[FILE], c_int, Pointer[c_char] # FnName, RetType # Args ](fildes, mode) fn freopen( pathname: Pointer[c_char], mode: Pointer[c_char], stream: Pointer[FILE] ) -> Pointer[FILE]: """Libc POSIX `freopen` function. Reference: https://man7.org/linux/man-pages/man3/freopen.3p.html Fn signature: FILE *freopen(const char *restrict pathname, const char *restrict mode, FILE *restrict stream) Args: pathname: A path to a file. mode: A mode to open the file with. stream: A pointer to a stream. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "freopen", Pointer[FILE], # FnName, RetType Pointer[c_char], Pointer[c_char], Pointer[FILE], # Args ](pathname, mode, stream) fn fmemopen( buf: Pointer[c_void], size: c_size_t, mode: Pointer[c_char] ) -> Pointer[FILE]: """Libc POSIX `fmemopen` function. Reference: https://man7.org/linux/man-pages/man3/fmemopen.3p.html Fn signature: FILE *fmemopen(void *restrict buf, size_t size, const char *restrict mode) Args: buf: A pointer to a buffer. size: The size of the buffer. mode: A mode to open the file with. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fmemopen", Pointer[FILE], # FnName, RetType Pointer[c_void], c_size_t, Pointer[c_char], # Args ](buf, size, mode) fn creat(path: Pointer[c_char], mode: mode_t) -> c_int: """Libc POSIX `creat` function. Reference: https://man7.org/linux/man-pages/man3/creat.3p.html Fn signature: int creat(const char *path, mode_t mode) Args: path: A path to a file. mode: A mode to open the file with. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "creat", c_int, Pointer[c_char], mode_t # FnName, RetType # Args ](path, mode) fn fseek(stream: Pointer[FILE], offset: c_long, whence: c_int) -> c_int: """Libc POSIX `fseek` function. Reference: https://man7.org/linux/man-pages/man3/fseek.3p.html Fn signature: int fseek(FILE *stream, long offset, int whence) Args: stream: A pointer to a stream. offset: An offset to seek to. whence: A pointer to a buffer to store the length of the address of the accepted socket. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fseek", c_int, Pointer[FILE], c_long, c_int # FnName, RetType # Args ](stream, offset, whence) fn fseeko(stream: Pointer[FILE], offset: off_t, whence: c_int) -> c_int: """Libc POSIX `fseeko` function. Reference: https://man7.org/linux/man-pages/man3/fseek.3p.html Fn signature: int fseeko(FILE *stream, off_t offset, int whence) Args: stream: A pointer to a stream. offset: An offset to seek to. whence: A pointer to a buffer to store the length of the address of the accepted socket. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fseeko", c_int, Pointer[FILE], off_t, c_int # FnName, RetType # Args ](stream, offset, whence) fn lseek(fildes: c_int, offset: off_t, whence: c_int) -> off_t: """Libc POSIX `lseek` function. Reference: https://man7.org/linux/man-pages/man3/lseek.3p.html Fn signature: off_t lseek(int fildes, off_t offset, int whence) Args: fildes: A File Descriptor to open the file with. offset: An offset to seek to. whence: A pointer to a buffer to store the length of the address of the accepted socket. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "lseek", off_t, c_int, off_t, c_int # FnName, RetType # Args ](fildes, offset, whence) fn fputc(c: c_int, stream: Pointer[FILE]) -> c_int: """Libc POSIX `fputc` function. Reference: https://man7.org/linux/man-pages/man3/fputc.3p.html Fn signature: int fputc(int c, FILE *stream) Args: c: A character to write. stream: A pointer to a stream. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fputc", c_int, c_int, Pointer[FILE] # FnName, RetType # Args ](c, stream) fn fputs(s: Pointer[c_char], stream: Pointer[FILE]) -> c_int: """Libc POSIX `fputs` function. Reference: https://man7.org/linux/man-pages/man3/fputs.3p.html Fn signature: int fputs(const char *restrict s, FILE *restrict stream) Args: s: A string to write. stream: A pointer to a stream. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fputs", c_int, Pointer[c_char], Pointer[FILE] # FnName, RetType # Args ](s, stream) fn fgetc(stream: Pointer[FILE]) -> c_int: """Libc POSIX `fgetc` function. Reference: https://man7.org/linux/man-pages/man3/fgetc.3p.html Fn signature: int fgetc(FILE *stream) Args: stream: A pointer to a stream. Returns: A File Descriptor or -1 in case of failure """ return external_call["fgets", c_int, Pointer[FILE]]( # FnName, RetType # Args stream ) fn fgets(s: Pointer[c_char], n: c_int, stream: Pointer[FILE]) -> Pointer[c_char]: """Libc POSIX `fgets` function. Reference: https://man7.org/linux/man-pages/man3/fgets.3p.html Fn signature: char *fgets(char *restrict s, int n, FILE *restrict stream) Args: s: A pointer to a buffer to store the read string. n: The maximum number of characters to read. stream: A pointer to a stream. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fgets", Pointer[c_char], # FnName, RetType Pointer[c_char], c_int, Pointer[FILE], # Args ](s, n, stream) fn dprintf[*T: AnyType](fildes: c_int, format: Pointer[c_char], *args: *T) -> c_int: """Libc POSIX `dprintf` function. Reference: https://man7.org/linux/man-pages/man3/fprintf.3p.html Fn signature: int dprintf(int fildes, const char *restrict format, ...) Args: fildes: A File Descriptor to open the file with. format: A format string. args: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "dprintf", c_int, c_int, Pointer[c_char] # FnName, RetType # Args ](fildes, format, args) fn fprintf[ *T: AnyType ](stream: Pointer[FILE], format: Pointer[c_char], *args: *T) -> c_int: """Libc POSIX `fprintf` function. Reference: https://man7.org/linux/man-pages/man3/fprintf.3p.html Fn signature: int fprintf(FILE *restrict stream, const char *restrict format, ...) Args: stream: A pointer to a stream. format: A format string. args: Arguments for the format string. Returns: """ return external_call[ "fprintf", c_int, Pointer[FILE], Pointer[c_char] # FnName, RetType # Args ](stream, format, args) # printf's family function(s) this is used to implement the rest of the printf's family fn _printf[callee: StringLiteral](format: Pointer[c_char]) -> c_int: return external_call[callee, c_int, Pointer[c_char]](format) fn _printf[ callee: StringLiteral, T0: AnyType ](format: Pointer[c_char], arg0: T0) -> c_int: return external_call[callee, c_int, Pointer[c_char], T0](format, arg0) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType ](format: Pointer[c_char], arg0: T0, arg1: T1) -> c_int: return external_call[callee, c_int, Pointer[c_char], T0, T1](format, arg0, arg1) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType, T2: AnyType ](format: Pointer[c_char], arg0: T0, arg1: T1, arg2: T2) -> c_int: return external_call[callee, c_int, Pointer[c_char], T0, T1, T2]( format, arg0, arg1, arg2 ) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType ](format: Pointer[c_char], arg0: T0, arg1: T1, arg2: T2, arg3: T3) -> c_int: return external_call[callee, c_int, Pointer[c_char], T0, T1, T2, T3]( format, arg0, arg1, arg2, arg3 ) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType, ](format: Pointer[c_char], arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4) -> c_int: return external_call6[callee, c_int, Pointer[c_char], T0, T1, T2, T3, T4]( format, arg0, arg1, arg2, arg3, arg4 ) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType, T5: AnyType, ]( format: Pointer[c_char], arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5 ) -> c_int: return external_call7[callee, c_int, Pointer[c_char], T0, T1, T2, T3, T4, T5]( format, arg0, arg1, arg2, arg3, arg4, arg5 ) fn _printf[callee: StringLiteral](format: String) -> c_int: return _printf[callee](to_char_ptr(format)) fn _printf[callee: StringLiteral, T0: AnyType](format: String, arg0: T0) -> c_int: return _printf[callee, T0](to_char_ptr(format), arg0) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType ](format: String, arg0: T0, arg1: T1) -> c_int: return _printf[callee, T0, T1](to_char_ptr(format), arg0, arg1) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType, T2: AnyType ](format: String, arg0: T0, arg1: T1, arg2: T2) -> c_int: return _printf[callee, T0, T1, T2](to_char_ptr(format), arg0, arg1, arg2) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType ](format: String, arg0: T0, arg1: T1, arg2: T2, arg3: T3) -> c_int: return _printf[callee, T0, T1, T2, T3](to_char_ptr(format), arg0, arg1, arg2, arg3) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType, ](format: String, arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4) -> c_int: return _printf[callee, T0, T1, T2, T3, T4]( to_char_ptr(format), arg0, arg1, arg2, arg3, arg4 ) fn _printf[ callee: StringLiteral, T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType, T5: AnyType, ](format: String, arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) -> c_int: return _printf[callee, T0, T1, T2, T3, T4, T5]( to_char_ptr(format), arg0, arg1, arg2, arg3, arg4, arg5 ) fn printf(format: Pointer[c_char]) -> c_int: return _printf["printf"](format) fn printf[T0: AnyType](format: Pointer[c_char], arg0: T0) -> c_int: return _printf["printf", T0](format, arg0) fn printf[ T0: AnyType, T1: AnyType ](format: Pointer[c_char], arg0: T0, arg1: T1) -> c_int: return _printf["printf", T0, T1](format, arg0, arg1) fn printf[ T0: AnyType, T1: AnyType, T2: AnyType ](format: Pointer[c_char], arg0: T0, arg1: T1, arg2: T2) -> c_int: return _printf["printf", T0, T1, T2](format, arg0, arg1, arg2) fn printf[ T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType ](format: Pointer[c_char], arg0: T0, arg1: T1, arg2: T2, arg3: T3) -> c_int: return _printf["printf", T0, T1, T2, T3](format, arg0, arg1, arg2, arg3) fn printf[ T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType ](format: Pointer[c_char], arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4) -> c_int: return _printf["printf", T0, T1, T2, T3, T4](format, arg0, arg1, arg2, arg3, arg4) fn printf[ T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType, T5: AnyType ]( format: Pointer[c_char], arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5 ) -> c_int: return _printf["printf", T0, T1, T2, T3, T4, T5]( format, arg0, arg1, arg2, arg3, arg4, arg5 ) fn printf(format: String) -> c_int: return _printf["printf"](format) fn printf[T0: AnyType](format: String, arg0: T0) -> c_int: return _printf["printf", T0](format, arg0) fn printf[T0: AnyType, T1: AnyType](format: String, arg0: T0, arg1: T1) -> c_int: return _printf["printf", T0, T1](format, arg0, arg1) fn printf[ T0: AnyType, T1: AnyType, T2: AnyType ](format: String, arg0: T0, arg1: T1, arg2: T2) -> c_int: return _printf["printf", T0, T1, T2](format, arg0, arg1, arg2) fn printf[ T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType ](format: String, arg0: T0, arg1: T1, arg2: T2, arg3: T3) -> c_int: return _printf["printf", T0, T1, T2, T3](format, arg0, arg1, arg2, arg3) fn printf[ T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType ](format: String, arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4) -> c_int: return _printf["printf", T0, T1, T2, T3, T4](format, arg0, arg1, arg2, arg3, arg4) fn printf[ T0: AnyType, T1: AnyType, T2: AnyType, T3: AnyType, T4: AnyType, T5: AnyType ](format: String, arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) -> c_int: return _printf["printf", T0, T1, T2, T3, T4, T5]( format, arg0, arg1, arg2, arg3, arg4, arg5 ) fn snprintf[ *T: AnyType ](s: Pointer[c_char], n: c_size_t, format: Pointer[c_char], *args: *T) -> c_int: """Libc POSIX `snprintf` function. Reference: https://man7.org/linux/man-pages/man3/fprintf.3p.html Fn signature: int snprintf(char *restrict s, size_t n, const char *restrict format, ...) Args: s: A pointer to a buffer to store the read string. n: The maximum number of characters to read. format: A format string. args: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "snprintf", c_int, # FnName, RetType Pointer[c_char], c_size_t, Pointer[c_char], # Args ](s, n, format, args) fn sprintf[ *T: AnyType ](s: Pointer[c_char], format: Pointer[c_char], *args: *T) -> c_int: """Libc POSIX `sprintf` function. Reference: https://man7.org/linux/man-pages/man3/fprintf.3p.html Fn signature: int sprintf(char *restrict s, const char *restrict format, ...) Args: s: A pointer to a buffer to store the read string. format: A format string. args: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "sprintf", c_int, Pointer[c_char], Pointer[c_char] # FnName, RetType # Args ](s, format, args) fn fscanf[ *T: AnyType ](stream: Pointer[FILE], format: Pointer[c_char], *args: *T) -> c_int: """Libc POSIX `fscanf` function. Reference: https://man7.org/linux/man-pages/man3/fscanf.3p.html Fn signature: int fscanf(FILE *restrict stream, const char *restrict format, ...) Args: stream: A pointer to a stream. format: A format string. args: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fscanf", c_int, Pointer[FILE], Pointer[c_char] # FnName, RetType # Args ](stream, format, args) fn scanf[*T: AnyType](format: Pointer[c_char], *args: *T) -> c_int: """Libc POSIX `scanf` function. Reference: https://man7.org/linux/man-pages/man3/fscanf.3p.html Fn signature: int scanf(const char *restrict format, ...) Args: format: A format string. args: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call["scanf", c_int, Pointer[c_char]]( # FnName, RetType # Args format, args ) fn sscanf[*T: AnyType](s: Pointer[c_char], format: Pointer[c_char], *args: *T) -> c_int: """Libc POSIX `sscanf` function. Reference: https://man7.org/linux/man-pages/man3/fscanf.3p.html Fn signature: int sscanf(const char *restrict s, const char *restrict format, ...) Args: s: A pointer to a buffer to store the read string. format: A format string. args: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "sscanf", c_int, Pointer[c_char], Pointer[c_char] # FnName, RetType # Args ](s, format, args) fn fread( ptr: Pointer[c_void], size: c_size_t, nitems: c_size_t, stream: Pointer[FILE] ) -> c_int: """Libc POSIX `fread` function. Reference: https://man7.org/linux/man-pages/man3/fread.3p.html Fn signature: size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream) Args: ptr: A pointer to a buffer to store the read string. size: The size of the buffer. nitems: The number of items to read. stream: A pointer to a stream. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "fread", c_size_t, # FnName, RetType Pointer[c_void], c_size_t, c_size_t, Pointer[FILE], # Args ](ptr, size, nitems, stream) fn rewind(stream: Pointer[FILE]) -> c_void: """Libc POSIX `rewind` function. Reference: https://man7.org/linux/man-pages/man3/rewind.3p.html Fn signature: void rewind(FILE *stream) Args: stream: A pointer to a stream. Returns: void """ return external_call["rewind", c_void, Pointer[FILE]](stream) fn getline( lineptr: Pointer[Pointer[FILE]], n: Pointer[c_size_t], stream: Pointer[FILE] ) -> c_ssize_t: """Libc POSIX `getline` function. Reference: https://man7.org/linux/man-pages/man3/getline.3p.html Fn signature: ssize_t getline(char **restrict lineptr, size_t *restrict n, FILE *restrict stream); Args: lineptr: A pointer to a pointer to a buffer to store the read string. n: A pointer to a buffer to store the length of the address of the accepted socket. stream: A pointer to a stream. Returns: Size of the lines read. """ return external_call[ "getline", c_ssize_t, # FnName, RetType Pointer[Pointer[FILE]], Pointer[c_size_t], Pointer[FILE], # Args ](lineptr, n, stream) fn pread(fildes: c_int, buf: Pointer[c_void], nbyte: c_size_t, offset: off_t) -> c_int: """Libc POSIX `pread` function. Reference: https://man7.org/linux/man-pages/man3/read.3p.html Fn signature: ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset) Args: fildes: A File Descriptor to open the file with. buf: A pointer to a buffer to store the read string. nbyte: The maximum number of characters to read. offset: An offset to seek to. Returns: A File Descriptor or -1 in case of failure """ return external_call["pread", c_ssize_t, c_int, Pointer[c_void], c_size_t, off_t]( fildes, buf, nbyte, offset ) fn read(fildes: c_int, buf: Pointer[c_void], nbyte: c_size_t) -> c_int: """Libc POSIX `read` function. Reference: https://man7.org/linux/man-pages/man3/read.3p.html Fn signature: sssize_t read(int fildes, void *buf, size_t nbyte) Args: fildes: A File Descriptor to open the file with. buf: A pointer to a buffer to store the read string. nbyte: The maximum number of characters to read. Returns: Amount of bytes read. """ return external_call["read", c_ssize_t, c_int, Pointer[c_void], c_size_t]( fildes, buf, nbyte ) fn pwrite(fildes: c_int, buf: Pointer[c_void], nbyte: c_size_t, offset: off_t) -> c_int: """Libc POSIX `pwrite` function. Reference: https://man7.org/linux/man-pages/man3/write.3p.html Fn signature: ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset) Args: fildes: A File Descriptor to open the file with. buf: A pointer to a buffer to store the read string. nbyte: The maximum number of characters to read. offset: An offset to seek to. Returns: Amount of bytes written. """ return external_call["pwrite", c_ssize_t, c_int, Pointer[c_void], c_size_t, off_t]( fildes, buf, nbyte, offset ) fn write(fildes: c_int, buf: Pointer[c_void], nbyte: c_size_t) -> c_int: """Libc POSIX `write` function. Reference: https://man7.org/linux/man-pages/man3/write.3p.html Fn signature: ssize_t write(int fildes, const void *buf, size_t nbyte); Args: fildes: A File Descriptor to open the file with. buf: A pointer to a buffer to store the read string. nbyte: The maximum number of characters to read. Returns: Amount of bytes written. """ return external_call["write", c_ssize_t, c_int, Pointer[c_void], c_size_t]( fildes, buf, nbyte ) fn fclose(stream: Pointer[FILE]) -> c_int: """Libc POSIX `fclose` function. Reference: https://man7.org/linux/man-pages/man3/fclose.3p.html Fn signature: int fclose(FILE *stream) Args: stream: A pointer to a stream. Returns: A File Descriptor or -1 in case of failure """ return external_call["fclose", c_int, Pointer[FILE]](stream) fn ftell(stream: Pointer[FILE]) -> c_long: """Libc POSIX `ftell` function. Reference: https://man7.org/linux/man-pages/man3/ftell.3p.html Fn signature: long ftell(FILE *stream) Args: stream: A pointer to a stream. Returns: The current file position of the given stream. """ return external_call["ftell", c_long, Pointer[FILE]](stream) fn ftello(stream: Pointer[FILE]) -> off_t: """Libc POSIX `ftello` function. Reference: https://man7.org/linux/man-pages/man3/ftell.3p.html Fn signature: off_t ftello(FILE *stream) Args: stream: A pointer to a stream. Returns: The current file position of the given stream. """ return external_call["ftello", off_t, Pointer[FILE]](stream) # fn fflush(stream: Pointer[FILE]) -> c_int: # """Libc POSIX `fflush` function. # Reference: https://man7.org/linux/man-pages/man3/fflush.3p.html # Fn signature: int fflush(FILE *stream) # # Args: # stream # # Returns: # """ # return external_call["fflush", c_int, Pointer[FILE]](stream) # fn clearerr(stream: Pointer[FILE]) -> c_void: """Libc POSIX `feof` function. Reference: https://man7.org/linux/man-pages/man3/clearerr.3p.html Fn signature: void clearerr(FILE *stream) Args: stream: A pointer to a stream. Returns: void """ return external_call["clearerr", c_void, Pointer[FILE]](stream) fn feof(stream: Pointer[FILE]) -> c_int: """Libc POSIX `feof` function. Reference: https://man7.org/linux/man-pages/man3/feof.3p.html Fn signature: int feof(FILE *stream) Args: stream: A pointer to a stream. Returns: 1 if the end-of-file indicator associated with the stream is set, else 0. """ return external_call["feof", c_int, Pointer[FILE]](stream) fn ferror(stream: Pointer[FILE]) -> c_int: """Libc POSIX `ferror` function. Reference: https://man7.org/linux/man-pages/man3/ferror.3p.html Fn signature: int ferror(FILE *stream) Args: stream: A pointer to a stream. Returns: 1 if the error indicator associated with the stream is set, else 0. """ return external_call["ferror", c_int, Pointer[FILE]](stream) fn ioctl[*T: AnyType](fildes: c_int, request: c_int, *args: *T) -> c_int: """Libc POSIX `ioctl` function. Reference: https://man7.org/linux/man-pages/man3/ioctl.3p.html Fn signature: int ioctl(int fildes, int request, ... /* arg */) TODO(cristian): add ioctl Options Args: fildes: A File Descriptor to open the file with. request: An offset to seek to. args: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call["ioctl", c_int, c_int, c_int]( # FnName, RetType # Args fildes, request, args ) # --- ( Logging Syscalls ) ----------------------------------------------------- alias LOG_PID = -1 alias LOG_CONS = -1 alias LOG_NDELAY = -1 alias LOG_ODELAY = -1 alias LOG_NOWAIT = -1 alias LOG_KERN = -1 alias LOG_USER = -1 alias LOG_MAIL = -1 alias LOG_NEWS = -1 alias LOG_UUCP = -1 alias LOG_DAEMON = -1 alias LOG_AUTH = -1 alias LOG_CRON = -1 alias LOG_LPR = -1 alias LOG_LOCAL0 = -1 alias LOG_LOCAL1 = -1 alias LOG_LOCAL2 = -1 alias LOG_LOCAL3 = -1 alias LOG_LOCAL4 = -1 alias LOG_LOCAL5 = -1 alias LOG_LOCAL6 = -1 alias LOG_LOCAL7 = -1 alias LOG_MASK = -1 # (pri) alias LOG_EMERG = -1 alias LOG_ALERT = -1 alias LOG_CRIT = -1 alias LOG_ERR = -1 alias LOG_WARNING = -1 alias LOG_NOTICE = -1 alias LOG_INFO = -1 alias LOG_DEBUG = -1 fn openlog(ident: Pointer[c_char], logopt: c_int, facility: c_int) -> c_void: """Libc POSIX `openlog` function. Reference: https://man7.org/linux/man-pages/man3/closelog.3p.html Fn signature: void openlog(const char *ident, int logopt, int facility) Args: ident: A File Descriptor to open the file with. logopt: An offset to seek to. facility: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "openlog", c_void, Pointer[c_char], c_int, c_int # FnName, RetType # Args ](ident, logopt, facility) fn syslog[*T: AnyType](priority: c_int, message: Pointer[c_char], *args: *T) -> c_void: """Libc POSIX `syslog` function. Reference: https://man7.org/linux/man-pages/man3/closelog.3p.html Fn signature: void syslog(int priority, const char *message, ... /* arguments */) Args: priority: A File Descriptor to open the file with. message: An offset to seek to. args: Arguments for the format string. Returns: A File Descriptor or -1 in case of failure """ return external_call[ "syslog", c_void, c_int, Pointer[c_char] # FnName, RetType # Args ](priority, message, args) fn setlogmask(maskpri: c_int) -> c_int: """Libc POSIX `setlogmask` function. Reference: https://man7.org/linux/man-pages/man3/closelog.3p.html Fn signature: int setlogmask(int maskpri) Args: maskpri: A File Descriptor to open the file with. Returns: A File Descriptor or -1 in case of failure """ return external_call["setlogmask", c_int, c_int](maskpri) # FnName, RetType # Args fn closelog(): """Libc POSIX `closelog` function. Reference: https://man7.org/linux/man-pages/man3/closelog.3p.html Fn signature: void closelog(void) """ _ = external_call["closelog", c_void]() # --- ( Other libc functions ) ---------------------------------------------------- fn exit(status: c_int): """Libc POSIX `exit` function. Reference: https://man7.org/linux/man-pages/man3/exit.3.html Fn signature: void exit(int status) Args: status: The exit status. Returns: void. """ _ = external_call["exit", c_void, c_int](status) # --- ( Testing Functions ) ---------------------------------------------------- fn __test_getaddrinfo__(): let ip_addr = "127.0.0.1" let port = 8083 var servinfo = Pointer[addrinfo]().alloc(1) servinfo.store(addrinfo()) var hints = addrinfo() hints.ai_family = AF_INET hints.ai_socktype = SOCK_STREAM hints.ai_flags = AI_PASSIVE # let hints_ptr = let status = getaddrinfo( to_char_ptr(ip_addr), Pointer[UInt8](), Pointer.address_of(hints), Pointer.address_of(servinfo), ) let msg_ptr = gai_strerror(c_int(status)) _ = external_call["printf", c_int, Pointer[c_char], Pointer[c_char]]( to_char_ptr("gai_strerror: %s"), msg_ptr ) # let msg = c_charptr_to_string(msg_ptr) _ = printf("getaddrinfo satus: %d", msg_ptr) # getaddrinfo() fn __test_socket_client__(): let ip_addr = "127.0.0.1" # The server's hostname or IP address let port = 8083 # The port used by the server let address_family = AF_INET let ip_buf = Pointer[c_void].alloc(4) let conv_status = inet_pton(address_family, to_char_ptr(ip_addr), ip_buf) let raw_ip = ip_buf.bitcast[c_uint]().load() _ = printf("inet_pton: %d :: status: %d\n", raw_ip, conv_status) let bin_port = htons(UInt16(port)) _ = printf("htons: %d\n", bin_port) var ai = sockaddr_in(address_family, bin_port, raw_ip, StaticTuple[8, c_char]()) let ai_ptr = Pointer[sockaddr_in].address_of(ai).bitcast[sockaddr]() let sockfd = socket(address_family, SOCK_STREAM, 0) if sockfd == -1: print("Socket creation error") _ = printf("sockfd: %d\n", sockfd) if connect(sockfd, ai_ptr, sizeof[sockaddr_in]()) == -1: _ = shutdown(sockfd, SHUT_RDWR) let msg = to_char_ptr("Hello, world Server") let bytes_sent = send(sockfd, msg, strlen(msg), 0) if bytes_sent == -1: _ = shutdown(sockfd, SHUT_RDWR) _ = printf("failed to send message\n") let buf_size = 1024 var buf = Pointer[UInt8]().alloc(buf_size) let bytes_recv = recv(sockfd, buf, buf_size, 0) if bytes_recv == -1: _ = shutdown(sockfd, SHUT_RDWR) _ = printf("failed to receive message\n") print("Recived Message: ") print(String(buf.bitcast[Int8](), bytes_recv)) fn __test_socket_server__() raises: let ip_addr = "127.0.0.1" let port = 8083 let address_family = AF_INET var ip_buf_size = 4 if address_family == AF_INET6: ip_buf_size = 16 let ip_buf = Pointer[c_void].alloc(ip_buf_size) let conv_status = inet_pton(address_family, to_char_ptr(ip_addr), ip_buf) let raw_ip = ip_buf.bitcast[c_uint]().load() _ = printf("inet_pton: %d :: status: %d\n", raw_ip, conv_status) let bin_port = htons(UInt16(port)) _ = printf("htons: %d\n", bin_port) var ai = sockaddr_in(address_family, bin_port, raw_ip, StaticTuple[8, c_char]()) let ai_ptr = Pointer[sockaddr_in].address_of(ai).bitcast[sockaddr]() let sockfd = socket(address_family, SOCK_STREAM, 0) if sockfd == -1: print("Socket creation error") _ = printf("sockfd: %d\n", sockfd) var yes: Int = 1 if ( setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, Pointer[Int].address_of(yes).bitcast[c_void](), sizeof[Int](), ) == -1 ): print("set socket options failed") if bind(sockfd, ai_ptr, sizeof[sockaddr_in]()) == -1: # close(sockfd) _ = shutdown(sockfd, SHUT_RDWR) print("Binding socket failed") if listen(sockfd, c_int(128)) == -1: _ = printf("Listen %d failed.\n", sockfd) _ = printf( "server: started at %s : %d with fd %d – waiting for connections...\n", ip_addr, port, sockfd, ) let their_addr_ptr = Pointer[sockaddr].alloc(1) var sin_size = socklen_t(sizeof[socklen_t]()) let new_sockfd = accept( sockfd, their_addr_ptr, Pointer[socklen_t].address_of(sin_size) ) if new_sockfd == -1: print("Accept failed") # close(sockfd) _ = shutdown(sockfd, SHUT_RDWR) # inet_ntop(their_addr.ss_family, get_in_addr((struct sockaddr *)&their_addr), s, sizeof s); # printf("server: got connection from %s\n", s); let msg = "Hello, Mojo!" if send(new_sockfd, to_char_ptr(msg).bitcast[c_void](), len(msg), 0) == -1: print("Failed to send response") print("Message sent succesfully") # close(new_fd) _ = shutdown(sockfd, SHUT_RDWR) # close(new_fd) fn __test_file__(): let fp = fopen(to_char_ptr("test.mojo"), to_char_ptr("r")) let buf_size = 1024 var buf = Pointer[UInt8]().alloc(buf_size) let status = fread(buf.bitcast[c_void](), buf_size, 1, fp) print(String(buf.bitcast[Int8](), buf_size)) _ = fclose(fp) fn main(): __test_getaddrinfo__() # XXX: fails. __test_socket_client__() # XXX: fails. try: __test_socket_server__() # NOTE: passes. except e: print(e.value) __test_file__() # NOTE: ??? --- list_iterator.mojo --- struct ListIterator[T: AnyType]: """ To use in a for loop, you need to implement `__iter__`. """ var storage: Pointer[T] var offset: Int var max: Int fn __init__(inout self, storage: Pointer[T], max: Int): self.offset = 0 self.max = max self.storage = storage fn __len__(self) -> Int: return self.max - self.offset fn __next__(inout self) -> T: let ret = self.storage.load(self.offset) self.offset += 1 return ret --- protocol.mojo --- from math import isnan from math.limit import isinf from time import now from string_utils import to_upper, to_repr, to_string_ref from hashtable import Item from table import Table from dodgy import DodgyString # redis tokens alias REDIS_CRLF: String = "\r\n" alias REDIS_STRING = "+" alias REDIS_ERROR = "-" alias REDIS_INTEGER = ":" alias REDIS_BULK_STRING = "$" alias REDIS_ARRAY = "*" alias REDIS_NULL = "_" alias REDIS_BOOL = "#" alias REDIS_DOUBLE = "," alias REDIS_BIG_NUMBER = "(" alias REDIS_BULK_ERRORS = "!" alias REDIS_VERBATIM_STRING = "=" alias REDIS_MAP = "%" alias REDIS_SET = "~" alias REDIS_PUSHES = "|" struct FiredisParser: """ FiredisParser parses a redis message. """ var msg: String var size: Int var result: String var db: Table fn __init__(inout self: Self, inout db: Table, msg: String): self.msg = msg self.db = db self.size = len(msg) self.result = "" fn __repr__(inout self: Self) -> String: return to_repr(self.msg) fn parse(inout self: Self) raises: var i = 1 # skip REDIS_ARRAY char var len_str: String = "" while i < self.size: if self.msg[i] == REDIS_CRLF[0] and self.msg[i + 1] == REDIS_CRLF[1]: len_str = self.msg[1:i] i += 1 break i += 1 let size: Int = atol(len_str) i += 1 # move after size var strings = DynamicVector[DodgyString]() for n in range(size): i += 1 # skip REDIS_BULK_STRING char var j = i while self.msg[j] != REDIS_CRLF[0] and self.msg[j + 1] != REDIS_CRLF[1]: j += 1 let msg_len_str = self.msg[i:j] let msg_len = atol(msg_len_str) i += len(msg_len_str) # skip len chars i += 2 # skip REDIS_CRLF chars let msg = self.msg[i : i + msg_len] strings.push_back(DodgyString(msg)) i = i + msg_len + 2 # skip msg and REDIS_CRLF chars if i != self.size: let err = "could not parse message, did not parse: " + to_repr(self.msg[i:]) raise Error(to_string_ref(err)) let raw_command = strings[0].to_string() var args = DynamicVector[DodgyString]() for i in range(1, len(strings)): args.push_back(strings[i]) self.build_result(raw_command, args) fn build_result( inout self: Self, raw_command: String, args: DynamicVector[DodgyString] ): let command = to_upper(raw_command) if command == "PING": if len(args) == 0: self.result = make_string("PONG") return if len(args) > 1: self.result = make_error("wrong number of arguments for 'ping' command") self.result = make_msg(REDIS_STRING, args[0].to_string()) elif command == "ECHO": if len(args) > 1: self.result = make_error("wrong number of arguments for 'echo' command") return self.result = make_bulk_string(args[0].to_string()) elif command == "GET": if len(args) > 1: self.result = make_error("wrong number of arguments for 'get' command") return let key = args[0].to_string_ref() var value: StringRef = "" if not self.db.get(key, value): self.result = make_null() return try: var item: Item[StringRef] = Item[StringRef]("null", "null") if not self.db.get_item(key, item): self.result = make_null() return let now_ms = now() // 1_000_000 if item.expire == -1: self.result = make_bulk_string(value) return elif item.is_expired(): self.result = make_null() return else: self.result = make_bulk_string(value) return except: self.result = make_error("could not get item") return elif command == "SET": var key: StringRef = "" var value: StringRef = "" if len(args) < 2: self.result = make_error("wrong number of arguments for 'set' command") return key = args[0].to_string_ref() value = args[1].to_string_ref() if self.db.set(key, value): self.result = make_string("OK") else: self.result = make_error("could not set value") if len(args) == 2: return for i in range(2, len(args), 2): let option_key = to_string_ref(to_upper(args[i].to_string())) let option_value = args[i + 1].to_string_ref() if option_key == "EX": try: let ex = atol(option_value) if self.db.set_ex(key, ex): self.result = make_string("OK") else: self.result = make_error("could not set ex value") return except e: print("> error: ", e.value) self.result = make_error("invalid ex value") return if option_key == "PX": try: let ex = atol(option_value) if self.db.set_px(key, ex): self.result = make_string("OK") else: self.result = make_error("could not set px value") return except: self.result = make_error("invalid px value") return elif command == "DEL": if len(args) == 0: self.result = make_error("wrong number of arguments for 'del' command") return var count = 0 for i in range(len(args)): let key = args[i].to_string_ref() if self.db.delete(key): count += 1 self.result = make_integer(count) else: self.result = make_msg(REDIS_ERROR, "unknown command: " + command) fn make_msg(header: String, msg: String) -> String: var res: String = "" res += header res += msg res += REDIS_CRLF return res # NOTE: how to do it with pointers # fn make_msg(header: String, msg: String) -> String: # let res_len = len(header) + len(msg) + 2 # let ptr = Pointer[Int8]().alloc(res_len) # # memcpy(ptr, header._buffer.data, len(header)) # memcpy(ptr.offset(len(header)), msg._buffer.data, len(msg)) # memcpy(ptr.offset(len(header) + len(msg)), REDIS_CRLF._buffer.data, 2) # # return String(ptr, res_len) fn make_string(msg: String) -> String: return make_msg(REDIS_STRING, msg) fn make_error(msg: String) -> String: return make_msg(REDIS_ERROR, msg) fn make_integer(msg: Int) -> String: return make_msg(REDIS_INTEGER, String(msg)) fn make_bulk_string() -> String: return make_msg(REDIS_BULK_STRING + "-1", "") fn make_bulk_string(msg: String) -> String: var header: String = "" let msg_len = len(msg) if msg_len == 0: return make_msg(REDIS_BULK_STRING + "0" + REDIS_CRLF, "") header += REDIS_BULK_STRING + String(msg_len) + REDIS_CRLF return make_msg(header, msg) fn make_array(msgs: VariadicList[String]) -> String: let msgs_len = len(msgs) let header = REDIS_ARRAY + String(msgs_len) + REDIS_CRLF var result: String = "" for msg in range(msgs_len): result += msg return make_msg(header, result) fn make_array(msgs: None) -> String: let header = REDIS_ARRAY + "-1" return make_msg(header, "") fn make_null() -> String: return make_msg(REDIS_NULL, "") fn make_bool(msg: Bool) -> String: if msg: return make_msg(REDIS_BOOL, "t") else: return make_msg(REDIS_BOOL, "f") fn make_double(msg: None) -> String: return make_msg(REDIS_DOUBLE, "nan") fn make_double(msg: Float32) -> String: if isnan(msg): return make_msg(REDIS_DOUBLE, "nan") elif isinf(msg): if msg > 0: return make_msg(REDIS_DOUBLE, "inf") else: return make_msg(REDIS_DOUBLE, "-inf") else: return make_msg(REDIS_DOUBLE, String(msg)) fn make_big_integer(msg: Int64) -> String: return make_msg(REDIS_BIG_NUMBER, String(msg)) --- string_utils.mojo --- from memory import memcpy fn to_repr(s: String) -> String: var res: String = '"' for i in range(len(s)): if s[i] == "\r": res += "\\r" elif s[i] == "\n": res += "\\n" else: res += s[i] res += '"' return res fn to_string_ref(s: String) -> StringRef: let slen = len(s) let ptr = Pointer[Int8]().alloc(slen) memcpy(ptr, s._buffer.data.bitcast[Int8](), slen) return StringRef(ptr.bitcast[__mlir_type.`!pop.scalar<si8>`]().address, slen) fn to_lower(s: String, slen: Int) -> String: let ptr = Pointer[Int8]().alloc(slen) memcpy(ptr, s._buffer.data.bitcast[Int8](), slen) for i in range(slen): if ptr.load(i) >= ord("A") and ptr.load(i) <= ord("Z"): ptr.store(i, ptr.load(i) + 32) return String(ptr, slen) fn to_lower(s: String) -> String: return to_lower(s, len(s)) fn to_upper(s: String, slen: Int) -> String: let ptr = Pointer[Int8]().alloc(slen) memcpy(ptr, s._buffer.data.bitcast[Int8](), slen) for i in range(slen): if ptr.load(i) >= ord("a") and ptr.load(i) <= ord("z"): ptr.store(i, ptr.load(i) - 32) return String(ptr, slen) fn to_upper(s: String) -> String: return to_upper(s, len(s)) --- table.mojo --- from time import now from hashtable import HashTable, Item from hashtable import NOT_FOUND_ERROR from libc import exit alias INIT_SIZE: Int = 100 @value @register_passable("trivial") struct Table: var bools: HashTable[Bool] var ints: HashTable[Int] var floats: HashTable[Float32] var strs: HashTable[StringRef] @staticmethod fn create() -> Table: let table: Table try: table = Table() except e: print("> fatal error: could not init table") exit(-1) pass return table fn __init__() raises -> Self: return Self { bools: HashTable[Bool](INIT_SIZE), ints: HashTable[Int](INIT_SIZE), floats: HashTable[Float32](INIT_SIZE), strs: HashTable[StringRef](INIT_SIZE), } fn __init__(size: Int) raises -> Self: return Self { bools: HashTable[Bool](size), ints: HashTable[Int](size), floats: HashTable[Float32](size), strs: HashTable[StringRef](size), } fn set(inout self: Self, key: StringRef, value: Bool) -> Bool: try: if self.ints.contains(key): return False if self.floats.contains(key): return False if self.strs.contains(key): return False self.bools[key] = value return True except e: return False fn set(inout self: Self, key: StringRef, value: Int) -> Bool: try: if self.bools.contains(key): return False if self.floats.contains(key): return False if self.strs.contains(key): return False self.ints[key] = value return True except e: return False fn set(inout self: Self, key: StringRef, value: Float32) -> Bool: try: if self.bools.contains(key): return False if self.ints.contains(key): return False if self.strs.contains(key): return False self.floats[key] = value return True except e: return False fn set(inout self: Self, key: StringRef, value: StringRef) -> Bool: try: if self.bools.contains(key): return False if self.ints.contains(key): return False if self.floats.contains(key): return False self.strs[key] = value return True except e: return False fn get_item( inout self: Self, key: StringRef, inout value: Item[Int] ) raises -> Bool: if self.ints.contains(key): value = self.ints.get_item(key) return True return False fn get_item( inout self: Self, key: StringRef, inout value: Item[Bool] ) raises -> Bool: if self.bools.contains(key): value = self.bools.get_item(key) return True return False fn get_item( inout self: Self, key: StringRef, inout value: Item[StringRef] ) raises -> Bool: if self.strs.contains(key): value = self.strs.get_item(key) return True return False fn get_item( inout self: Self, key: StringRef, inout value: Item[Float32] ) raises -> Bool: if self.floats.contains(key): value = self.floats.get_item(key) return True return False fn get(inout self: Self, key: StringRef, inout value: Bool) -> Bool: try: value = self.bools[key] return True except e: return False fn get(inout self: Self, key: StringRef, inout value: Int) -> Bool: try: value = self.ints[key] return True except e: return False fn get(inout self: Self, key: StringRef, inout value: Float32) -> Bool: try: value = self.floats[key] return True except e: return False fn get(inout self: Self, key: StringRef, inout value: StringRef) -> Bool: try: value = self.strs[key] # NOTE: This is due a bug in the compiler, # an exception is returned as a value of the function. return value != NOT_FOUND_ERROR except e: return False fn delete(inout self: Self, key: StringRef) -> Bool: try: return ( self.bools.delete(key) or self.ints.delete(key) or self.floats.delete(key) or self.strs.delete(key) ) except: return False fn count(self: Self) -> Int: return self.bools.count + self.ints.count + self.floats.count + self.strs.count fn set_px(inout self: Self, key: StringRef, value: Int) -> Bool: """Set expire in milliseconds.""" let expire = (now() // 1_000_000) + value try: if self.bools.contains(key): self.bools.set_expire(key, expire) elif self.ints.contains(key): self.ints.set_expire(key, expire) elif self.floats.contains(key): self.floats.set_expire(key, expire) elif self.strs.contains(key): self.strs.set_expire(key, expire) else: return False return True except e: print("> error setting expire:", e.value) return False fn set_ex(inout self: Self, key: StringRef, value: Int) -> Bool: """Set expire in seconds.""" return self.set_px(key, value * 1_000) fn to_string(inout self: Self) raises -> String: var res: String = "\n{\n" res += self.bools._to_string_attrs() res += "\n" res += self.ints._to_string_attrs() res += "\n" res += self.floats._to_string_attrs() res += "\n" res += self.strs._to_string_attrs() res += "\n" res += "}" return res fn print(inout self: Self) raises: print(self.to_string()) --- test.mojo --- from libc import exit from test_hashtable import test_hash_fn, test_array, test_item, test_hashtable from test_table import test_table_with_many_types, test_table_delete_items from test_protocol import test_parse_ping, test_parse_echo, test_parse_long_message from test_string_utils import ( test_to_upper, test_to_lower, test_to_repr, test_to_string_ref, ) fn main() raises: var passed = 0 var tests = DynamicVector[fn () raises -> Bool]() # string utils tests.push_back(test_to_upper) tests.push_back(test_to_lower) tests.push_back(test_to_repr) tests.push_back(test_to_string_ref) # hashtable tests.push_back(test_hash_fn) tests.push_back(test_array) tests.push_back(test_item) tests.push_back(test_item) # table tests.push_back(test_table_with_many_types) tests.push_back(test_table_delete_items) # protocol tests.push_back(test_parse_ping) tests.push_back(test_parse_echo) tests.push_back(test_parse_long_message) let total_tests = len(tests) for i in range(total_tests): if tests[i](): passed += 1 put_new_line() # TODO: figure out how to show the test name if passed == total_tests: print("\033[0;32mAll (" + String(total_tests) + ") tests passed!\033[0;0m 🔥") exit(0) else: print( "\033[0;31mSome tests failed (" + String(passed) + "/" + String(total_tests) + ")!\033[0;0m 🌊" ) exit(-1) --- test_hashtable.mojo --- from hashtable import hash_fn, Item, Array, HashTable from testing import assert_equal, assert_not_equal, assert_true, assert_false fn test_hash_fn() raises -> Bool: if assert_equal(hash_fn("test"), 2724192577743982107): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(hash_fn("test"), 2724192577743982107): print_no_newline(".") else: print_no_newline("E") return False if assert_not_equal(hash_fn("test2"), 2724192577743982107): print_no_newline(".") else: print_no_newline("E") return False return True fn test_item() raises -> Bool: let item = Item("foo", 1) if assert_equal(item.key, "foo"): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(item.value, 1): print_no_newline(".") else: print_no_newline("E") return False let item2 = Item("foo", 1) if assert_true(item.value == item2.value, "Items should be equal"): print_no_newline(".") else: print_no_newline("E") return False if assert_false(item == None, "Items should be equal"): print_no_newline(".") else: print_no_newline("E") return False return True fn test_array() raises -> Bool: let arr = Array[Int](10) if assert_equal(arr.size, 10): print_no_newline(".") else: print_no_newline("E") return False arr[0] = 10 if assert_equal(arr[0], 10): print_no_newline(".") else: print_no_newline("E") return False let arr2 = Array[Int](10) if assert_equal(arr2.size, 10): print_no_newline(".") else: print_no_newline("E") return False arr2[0] = 11 if assert_equal(arr2[0], 11): print_no_newline(".") else: print_no_newline("E") return False let arr3 = Array[Int](10) arr3[0] = 1 arr3[1] = 2 arr3[2] = 3 arr3[3] = 4 arr3[4] = 5 arr3[5] = 6 arr3[6] = 7 arr3[7] = 8 arr3[8] = 9 arr3[9] = 10 if assert_equal(arr3.size, 10): print_no_newline(".") else: print_no_newline("E") return False var i = 1 for item in arr3: if assert_equal(item, i): print_no_newline(".") else: print_no_newline("E") return False i += 1 return True fn test_hashtable() raises -> Bool: let hash_table_int: HashTable[Int] hash_table_int = HashTable[Int](10) hash_table_int.set("time", 123) hash_table_int.set("time2", 456) if assert_equal(hash_table_int.data[8][0].value, 123): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(hash_table_int.data[8].size, 1): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(hash_table_int.data[8].cap, 2): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(hash_table_int.data[6][0].value, 456): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(hash_table_int.get("time"), 123): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(hash_table_int["time"], 123): print_no_newline(".") else: print_no_newline("E") return False hash_table_int["time"] = 321 if assert_equal(hash_table_int["time"], 321): print_no_newline(".") else: print_no_newline("E") return False let hash_table_str: HashTable[StringRef] hash_table_str["a"] = "a" hash_table_str["b"] = "b" hash_table_str["c"] = "c" if assert_equal(hash_table_str["a"], "a"): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(hash_table_str["b"], "b"): print_no_newline(".") else: print_no_newline("E") return False return True --- test_protocol.mojo --- from protocol import FiredisParser from testing import assert_equal from table import Table fn test_parse_ping() raises -> Bool: var db = Table.create() let msg = "*1\r\n$4\r\nPING\r\n" let resp = "+PONG\r\n" var parser = FiredisParser(db, msg) parser.parse() if assert_equal(parser.result, resp): print_no_newline(".") else: print_no_newline("E") return False return True fn test_parse_echo() raises -> Bool: var db = Table.create() let msg = "*2\r\n$4\r\necho\r\n$5\r\nfirst\r\n" let resp = "$5\r\nfirst\r\n" var parser = FiredisParser(db, msg) parser.parse() if assert_equal(parser.result, resp): print_no_newline(".") else: print_no_newline("E") return False return True fn test_parse_long_message() raises -> Bool: var db = Table.create() let msg = "*3\r\n$3\r\nset\r\n$5\r\nnames\r\n$11\r\nverylong...\r\n" let resp = "+OK\r\n" var parser = FiredisParser(db, msg) parser.parse() if assert_equal(parser.result, resp): print_no_newline(".") else: print_no_newline("E") return False var val: StringRef = "" _ = db.get("names", val) if assert_equal(val, "verylong..."): print_no_newline(".") else: print_no_newline("E") return False return True --- test_string_utils.mojo --- from string_utils import to_lower, to_upper, to_repr, to_string_ref from testing import assert_equal fn test_to_upper() raises -> Bool: if assert_equal(to_upper("hello"), "HELLO"): print_no_newline(".") else: print_no_newline("E") return False return True fn test_to_lower() raises -> Bool: if assert_equal(to_lower("HELLO"), "hello"): print_no_newline(".") else: print_no_newline("E") return False return True fn test_to_repr() raises -> Bool: let s = "hello\n\r" if assert_equal(to_repr(s), '"hello\\n\\r"'): print_no_newline(".") else: print_no_newline("E") return False return True fn test_to_string_ref() raises -> Bool: let s: String = "hello" let expected: StringRef = "hello" if assert_equal(to_string_ref(s), expected): print_no_newline(".") else: print_no_newline("E") return False return True --- test_table.mojo --- from table import Table from hashtable import NOT_FOUND_ERROR from testing import assert_equal, assert_not_equal, assert_true, assert_false fn test_table_with_many_types() raises -> Bool: var table = Table() if not table.set("a", True): print_no_newline("E") return False else: print_no_newline(".") if not table.set("b", 2): print_no_newline("E") return False else: print_no_newline(".") if not table.set("c", 3.3): print_no_newline("E") return False else: print_no_newline(".") if not table.set("d", "4"): print_no_newline("E") return False else: print_no_newline(".") var a: Bool = False _ = table.get("a", a) if assert_equal(a, True): print_no_newline(".") else: print_no_newline("E") return False var b: Int = -1 _ = table.get("b", b) if assert_equal(b, 2): print_no_newline(".") else: print_no_newline("E") return False var c: Float32 = -1.0 _ = table.get("c", c) if assert_equal(c, 3.3): print_no_newline(".") else: print_no_newline("E") return False var d: StringRef = "" _ = table.get("d", d) if assert_equal(d, "4"): print_no_newline(".") else: print_no_newline("E") return False var e: StringRef = "" if not table.get("e", e) and assert_equal(e, NOT_FOUND_ERROR): print_no_newline(".") else: print_no_newline("E") return False var e2: Float32 = -1.0 if not table.get("e", e2) and assert_equal(e2, -1.0): print_no_newline(".") else: print_no_newline("E") return False return True fn test_table_delete_items() raises -> Bool: var table = Table() _ = table.set("a", True) _ = table.set("b", True) _ = table.set("c", True) _ = table.set("d", True) if assert_equal(table.count(), 4): print_no_newline(".") else: print_no_newline("E") return False _ = table.delete("a") if assert_equal(table.bools.count, 3): print_no_newline(".") else: print_no_newline("E") return False if assert_equal(table.count(), 3): print_no_newline(".") else: print_no_newline("E") return False var value = False if table.get("a", value): print_no_newline("E") return False else: print_no_newline(".") return True --- .github/ISSUE_TEMPLATE/bug_report.md --- --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. --- .github/ISSUE_TEMPLATE/feature_request.md --- --- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. --- .gitignore --- *.mojopkg clip_tokenizer/ tokenizer_clip.bin --- CODE_OF_CONDUCT.md --- # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at LinkedIn: https://www.linkedin.com/in/lucas-mantovani-a446a61a9/. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. --- LICENSE --- MIT License Copyright (c) 2024 Lucas Mantovani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Tiny_Stable_Diffusion.mojo Some images I generated with Stable Diffusion and Stable Diffusion XL... what if we could generate them with Mojo? <div style="display: flex; justify-content: space-around;"> <img src="sample_images/2.png" alt="Robot" style="width:200px; height: 200px; margin-right: 20px;"/> <img src="sample_images/1.png" alt="Cyberdog" style="width:200px; height: 200px; margin-right: 20px;"/> <img src="sample_images/3.png" alt="Candy" style="width:200px; height: 200px; margin-right: 20px;"/> </div> ## Overview 💡 This is a 100% Mojo implementation of a forward pass of the Tiny Stable Diffusion model available [here](https://huggingface.co/segmind/tiny-sd/tree/main). Every component of the model was implemented from scratch, from basic integers and floats all the way to matrix multiplications, convolutions, image arrays, and operations that exist in PyTorch, such as linear layers, upsampling, and broadcasting. To view these operations in Mojo and use them in your project, check our helpers/utils.mojo. This will save you time, as you will not need to implement them from scratch. In this project, however, the primary use of these basic building blocks was to construct cross-attention modules, encoders, decoders, a diffusion module, CLIP, and other components of the Stable Diffusion pipeline. The goal of this project is to provide a basic implementation of the Tiny Stable Diffusion model. My hope is that this implementation can be used by anyone who wants to modify the given code to load their own Stable Diffusion weights into this model. The code is divided as follows: * vae.mojo: A Variational Autoencoder (VAE), including both an encoder and decoder. The encoder is used to encode pre-existing images so that they can be used by the Stable Diffusion model. The decoder is used by all image generation forward passes, regardless of whether an initial image is provided or not * sampler.mojo: An implementation of a DDPM sampler * pipeline.mojo: Creates a Mojo pipeline that takes in a text prompt (and, optionally, an image) and computes a forward pass through the model * diffusion.mojo: Code for the diffusion part of the Tiny Stable Diffusion model (comprised of a UNet, Time Embedding, and output layer) * clip.mojo: Comprised of clip embeddings and a CLIP player, it implements the structs necessary to generate a CLIP text encoder used by the inference pipeline * helpers folder: Contains important low-level functions used everywhere in the code (such as convolution, image resizing, matrix multiplications, etc.) in the utils.mojo file. Also Contains the attention modules (self-attention, cross-attention) in the attention.mojo file. * demo.mojo: A simple example of how to run a forward pass * tokenizer_creation.py: A Python file that retrieves the CLIP tokenizer from Hugging Face and stores it as tokenizer_clip.bin. This .bin file will be read during image generation to load the CLIP tokenizer values. For this reason, this Python file should be executed before any forward passes are run, since this will allow you to recreate a CLIP tokenizer with real values in your machine. ## Usage 🔨 * First, retrive the CLIP tokenizer file ```` python tokenizer_creation.py ```` * Next, compile the "helpers" package ```` mojo package helpers -o "helpers.mojopkg" ```` * Next, load the Tiny Stable Diffusion weights available [here](https://huggingface.co/segmind/tiny-sd/tree/main) into the model. To do so, check out the "Tokenizer" struct in helpers/utils.mojo. The __init__ function in this struct shows how to load weights from a .bin file into a struct, so the same process can be applied to any other structs (CLIP, Encoder, Diffusion, etc) for which you would like to load weights. Just copy and paste that code and modify as needed. This file input / output logic was retrieved from the amazing Llama2.mojo project, linked in the "thanks" section. * Lastly, modify demo.mojo file to set the parameters you would like to use for the model and run a forward pass ```` mojo demo.mojo ```` Furthermore, change the "image_size" alias in the pipeline.mojo file to fit the image width / length that you desire to use! ## Next Steps for this project (please fork and open a pull request if you would like to implement this!) * Load the [Tiny Stable Diffusion weights](https://huggingface.co/segmind/tiny-sd/tree/main) into the model. To do so, check out the __init__ function of the Tokenizer struct in utils.mojo. An identical method can be used to initialize the weights for every other struct in the model from a .bin file * Benchmark the speed of this Mojo implementation against the original Python-based one. ## Thanks 🙏 * Thanks to the extraordinary [Pytorch Stable Diffusion](https://github.com/hkproj/pytorch-stable-diffusion) implementation available here. This was the primary source of inspiration for this project. * Thanks to Segmind for developing the [Tiny SD model](https://huggingface.co/segmind/tiny-sd)! * Thanks to the awesome [Llama2 Mojo implementation](https://github.com/tairov/llama2.mojo) that helped me set up the tokenizer and taught me how to load bianry values into Mojo. * Thanks to [this amazing Karpathy tutorial](https://github.com/karpathy/llama2.c/blob/master/tokenizer.py) for creating a Llama2 tokenizer * Thanks to Modular for providing the #mojo-help Discord channel, which clarified many of my questions about the Mojo programming language. --- clip.mojo --- from helpers.utils import * from helpers.attention import * struct ClipEmbedding: var token_embedding: Embedding ## LEARNABLE PARAMETER var position_embedding: Matrix[float_dtype] fn __init__(inout self, n_vocab: Int, n_embed: Int, n_token: Int): self.token_embedding = Embedding(n_vocab, n_embed) var pos_embed_matrix = Matrix[float_dtype](1, n_token, n_embed) pos_embed_matrix *= 0 self.position_embedding = pos_embed_matrix fn forward(self, tokens: Matrix[float_dtype]) -> Matrix[float_dtype]: var out = self.token_embedding.forward(tokens) out = out + self.position_embedding return out struct ClipPlayer: var layer1: LayerNorm var layer2: Self_Attention var layer3: LayerNorm var layer4: Linear var layer5: Linear fn __init__(inout self, n_head: Int, n_embed: Int): self.layer1 = LayerNorm(n_embed) self.layer2 = Self_Attention(n_head, n_embed) self.layer3 = LayerNorm(n_embed) self.layer4 = Linear(n_embed, 4 * n_embed) self.layer5 = Linear(4 * n_embed, n_embed) fn forward(inout self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: var residue = x var first_input = residue.transpose(0, 2) var out = self.layer1.forward(first_input) out = out.transpose(0, 2) out = self.layer2.forward(out, causal_mask=True) out = out + residue residue = out out = out.transpose(0, 2) out = self.layer3.forward(out) out = out.transpose(0, 2) out = self.layer4.forward(out) var out_multiplied = out * 1.702 out = out.multiply(sigmoid(out_multiplied)) out = self.layer5.forward(out) out = out + residue return out struct CLIP: var embedding: ClipEmbedding var player1: ClipPlayer var player2: ClipPlayer var player3: ClipPlayer var player4: ClipPlayer var player5: ClipPlayer var player6: ClipPlayer var player7: ClipPlayer var player8: ClipPlayer var player9: ClipPlayer var player10: ClipPlayer var player11: ClipPlayer var player12: ClipPlayer var layer_norm: LayerNorm fn __init__(inout self): self.embedding = ClipEmbedding(49408, 768, 77) self.player1 = ClipPlayer(12, 768) self.player2 = ClipPlayer(12, 768) self.player3 = ClipPlayer(12, 768) self.player4 = ClipPlayer(12, 768) self.player5 = ClipPlayer(12, 768) self.player6 = ClipPlayer(12, 768) self.player7 = ClipPlayer(12, 768) self.player8 = ClipPlayer(12, 768) self.player9 = ClipPlayer(12, 768) self.player10 = ClipPlayer(12, 768) self.player11 = ClipPlayer(12, 768) self.player12 = ClipPlayer(12, 768) self.layer_norm = LayerNorm(768) fn forward(inout self, inout tokens: Matrix[float_dtype]) -> Matrix[float_dtype]: # Here, we do not convert "state" to the long type (float64)for simplicity in Mojo type handling, but in production it would be useful to implement these functions with type float64 instead of float32 for greater precision var reshaped_tokens = Matrix[float_dtype](1, 1, 77) reshaped_tokens *= 0 reshaped_tokens.set_items(0, 0, Slice(0, tokens.dim2), tokens) var state = self.embedding.forward(reshaped_tokens) state = self.player1.forward(state) state = self.player2.forward(state) state = self.player3.forward(state) state = self.player4.forward(state) state = self.player5.forward(state) state = self.player6.forward(state) state = self.player7.forward(state) state = self.player8.forward(state) state = self.player9.forward(state) state = self.player10.forward(state) state = self.player11.forward(state) state = self.player12.forward(state) state = state.transpose(0, 2) var output = self.layer_norm.forward(state) output = output.transpose(0, 2) return output --- demo.mojo --- import pipeline from helpers.utils import * fn main() raises -> None: var prompt = "a cat flying a spaceship" var backup_prompt = '' var input_image = Matrix[float_dtype](1, 8, 8) var do_cfg = False var cfg_scale = 0.8 var strength = 0.9 var num_inference_steps = 1 var seed = 40 var output_image = pipeline.generate( prompt=prompt, backup_prompt=backup_prompt, strength=strength, cfg=do_cfg, cfg_scale=cfg_scale, inference_steps=num_inference_steps, seed_val=seed, input_image = input_image ) --- diffusion.mojo --- from helpers.utils import * from helpers.attention import * struct Time_Embedding: var layer1: Linear var layer2: Linear fn __init__(inout self, n_embed: Int): self.layer1 = Linear(n_embed, 4 * n_embed) self.layer2 = Linear(4 * n_embed, 4 * n_embed) fn __copyinit__(inout self, other: Self): self.layer1 = other.layer1 self.layer2 = other.layer2 fn forward(inout self, inout x: Matrix[float_dtype]) -> Matrix[float_dtype]: var out = self.layer1.forward(x) out = SiLU().forward(out) out = self.layer2.forward(out) return out struct Unet_Residual_Block: var layer1: GroupNorm var layer2: Conv2D var layer3: Linear var layer4: GroupNorm var layer5: Conv2D var layer6: Conv2D var in_channels: Int var out_channels: Int fn __init__(inout self, in_channels: Int, out_channels: Int, n_time: Int = 1280): self.in_channels = in_channels self.out_channels = out_channels self.layer1 = GroupNorm(32, in_channels) self.layer2 = Conv2D(in_channels, out_channels, kernel_size=3, padding=(1, 1)) self.layer3 = Linear(n_time, out_channels) self.layer4 = GroupNorm(32, out_channels) self.layer5 = Conv2D(out_channels, out_channels, 3, (1, 1)) self.layer6 = Conv2D(in_channels, out_channels, 1, (0, 0)) fn __copyinit__(inout self, other: Self): self.layer1 = other.layer1 self.layer2 = other.layer2 self.layer3 = other.layer3 self.layer4 = other.layer4 self.layer5 = other.layer5 self.layer6 = other.layer6 self.in_channels = other.in_channels self.out_channels = other.out_channels fn forward( inout self, x: Matrix[float_dtype], time: Matrix[float_dtype] ) -> Matrix[float_dtype]: var residue = x var out = self.layer1.forward(x) out = SiLU().forward(out) out = self.layer2.forward(out) var time_new = SiLU().forward(time) time_new = self.layer3.forward(time_new) time_new = time_new.reshape(self.out_channels, 1, 1) time_new = time_new.broadcast_channel(out.dim1, out.dim2) var merged = out + time_new merged = self.layer4.forward(merged) merged = SiLU().forward(merged) merged = self.layer5.forward(merged) if self.in_channels != self.out_channels: return merged + self.layer6.forward(residue) return merged + residue struct Unet_Attention_Block: var layer1: GroupNorm var layer2: Conv2D var layer3: LayerNorm var layer4: Self_Attention var layer5: LayerNorm var layer6: Cross_Attention var layer7: LayerNorm var layer8: Linear var layer9: Linear var layer10: Conv2D fn __init__(inout self, n_head: Int, n_embed: Int, d_context: Int = 768): var channels = n_head * n_embed self.layer1 = GroupNorm(32, channels, epsilon=1e-6) self.layer2 = Conv2D(channels, channels, 1, (0, 0)) self.layer3 = LayerNorm(channels) self.layer4 = Self_Attention(n_head, channels, in_bias=False) self.layer5 = LayerNorm(channels) self.layer6 = Cross_Attention(n_head, channels, d_context, in_bias=False) self.layer7 = LayerNorm(channels) self.layer8 = Linear(channels, 8 * channels) self.layer9 = Linear(4 * channels, channels) self.layer10 = Conv2D(channels, channels, 1, (0, 0)) fn __copyinit__(inout self, other: Self): self.layer1 = other.layer1 self.layer2 = other.layer2 self.layer3 = other.layer3 self.layer4 = other.layer4 self.layer5 = other.layer5 self.layer6 = other.layer6 self.layer7 = other.layer7 self.layer8 = other.layer8 self.layer9 = other.layer9 self.layer10 = other.layer10 fn forward( inout self, x: Matrix[float_dtype], inout context: Matrix[float_dtype] ) -> Matrix[float_dtype]: var residue_long = x var out = self.layer1.forward(x) out = self.layer2.forward(out) out = out.reshape(1, out.dim0, out.dim1 * out.dim2) out = out.transpose(1, 2) out = out.transpose(0, 2) var residue_short = out out = self.layer3.forward(out) out = out.transpose(0, 2) out = self.layer4.forward(out) residue_short = residue_short.transpose(0, 2) out = out + residue_short residue_short = out out = out.transpose(0, 2) out = self.layer5.forward(out) out = out.transpose(0, 2) out = self.layer6.forward(out, context) out = out + residue_short residue_short = out out = out.transpose(0, 2) out = self.layer7.forward(out) out = out.transpose(0, 2) var chunked_linear = self.layer8.forward(out).chunk(2, 2) out = chunked_linear[0] var gate = chunked_linear[1] out = out.multiply(Gelu().forward(gate)) out = self.layer9.forward(out) out = out + residue_short out = out.transpose(1, 2) out = out.reshape(x.dim0, x.dim1, x.dim2) out = self.layer10.forward(out) + residue_long return out struct UNet: var layer1: Conv2D var layer2: Unet_Residual_Block var layer3: Unet_Attention_Block var layer4: Conv2D var layer5: Unet_Residual_Block var layer6: Unet_Attention_Block var layer7: Conv2D var layer8: Unet_Residual_Block var layer9: Unet_Attention_Block var layer10: Unet_Residual_Block var layer11: Unet_Attention_Block var layer12: Unet_Residual_Block var layer13: Unet_Attention_Block var layer14: Upsample var layer15: Unet_Residual_Block var layer16: Unet_Attention_Block var layer17: Unet_Residual_Block var layer18: Unet_Attention_Block var layer19: Upsample var layer20: Unet_Residual_Block var layer21: Unet_Attention_Block var layer22: Unet_Residual_Block var layer23: Unet_Attention_Block fn __init__(inout self): # Encoders self.layer1 = Conv2D(4, 320, 3, (1, 1)) self.layer2 = Unet_Residual_Block(320, 320) self.layer3 = Unet_Attention_Block(8, 40) self.layer4 = Conv2D(320, 320, 3, (1, 1), (2, 2)) self.layer5 = Unet_Residual_Block(320, 640) self.layer6 = Unet_Attention_Block(8, 80) self.layer7 = Conv2D(640, 640, 3, (1, 1), (2, 2)) self.layer8 = Unet_Residual_Block(640, 1280) self.layer9 = Unet_Attention_Block(8, 160) # Decoders self.layer10 = Unet_Residual_Block(2560, 1280) self.layer11 = Unet_Attention_Block(8, 160) self.layer12 = Unet_Residual_Block(1920, 1280) self.layer13 = Unet_Attention_Block(8, 160) self.layer14 = Upsample(1280) self.layer15 = Unet_Residual_Block(1280, 640) self.layer16 = Unet_Attention_Block(8, 80) self.layer17 = Unet_Residual_Block(960, 640) self.layer18 = Unet_Attention_Block(8, 80) self.layer19 = Upsample(640) self.layer20 = Unet_Residual_Block(640, 320) self.layer21 = Unet_Attention_Block(8, 40) self.layer22 = Unet_Residual_Block(640, 320) self.layer23 = Unet_Attention_Block(8, 40) fn __copyinit__(inout self, other: Self): self.layer1 = other.layer1 self.layer2 = other.layer2 self.layer3 = other.layer3 self.layer4 = other.layer4 self.layer5 = other.layer5 self.layer6 = other.layer6 self.layer7 = other.layer7 self.layer8 = other.layer8 self.layer9 = other.layer9 self.layer10 = other.layer10 self.layer11 = other.layer11 self.layer12 = other.layer12 self.layer13 = other.layer13 self.layer14 = other.layer14 self.layer15 = other.layer15 self.layer16 = other.layer16 self.layer17 = other.layer17 self.layer18 = other.layer18 self.layer19 = other.layer19 self.layer20 = other.layer20 self.layer21 = other.layer21 self.layer22 = other.layer22 self.layer23 = other.layer23 fn forward( inout self, x: Matrix[float_dtype], inout context: Matrix[float_dtype], inout time: Matrix[float_dtype], ) -> Matrix[float_dtype]: # Encoders var out = self.layer1.forward(x) var skip1 = out out = self.layer2.forward(out, time) out = self.layer3.forward(out, context) var skip2 = out out = self.layer4.forward(out) var skip3 = out out = self.layer5.forward(out, time) out = self.layer6.forward(out, context) var skip4 = out out = self.layer7.forward(out) var skip5 = out out = self.layer8.forward(out, time) out = self.layer9.forward(out, context) var skip6 = out # Decoders out = out.concat(skip6, 0) out = self.layer10.forward(out, time) out = self.layer11.forward(out, context) out = out.concat(skip5, 0) out = self.layer12.forward(out, time) out = self.layer13.forward(out, context) out = self.layer14.forward(out) out = out.concat(skip4, 0) out = self.layer15.forward(out, time) out = self.layer16.forward(out, context) out = out.concat(skip3, 0) out = self.layer17.forward(out, time) out = self.layer18.forward(out, context) out = self.layer19.forward(out) out = out.concat(skip2, 0) out = self.layer20.forward(out, time) out = self.layer21.forward(out, context) out = out.concat(skip1, 0) out = self.layer22.forward(out, time) out = self.layer23.forward(out, context) return out struct UNet_Output_Layer: var layer1: GroupNorm var layer2: Conv2D fn __init__(inout self, in_channels: Int, out_channels: Int): self.layer1 = GroupNorm(320, in_channels) self.layer2 = Conv2D(in_channels, out_channels, 3, (1, 1)) fn __copyinit__(inout self, other: Self): self.layer1 = other.layer1 self.layer2 = other.layer2 fn forward(inout self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: var out = self.layer1.forward(x) out = SiLU().forward(out) out = self.layer2.forward(out) return out struct Diffusion: var time_embed: Time_Embedding var unet: UNet var final: UNet_Output_Layer fn __init__(inout self): self.time_embed = Time_Embedding(320) self.unet = UNet() self.final = UNet_Output_Layer(320, 4) fn __copyinit__(inout self, other: Self): self.time_embed = other.time_embed self.unet = other.unet self.final = other.final fn forward( inout self, x: Matrix[float_dtype], inout context: Matrix[float_dtype], inout time: Matrix[float_dtype], ) -> Matrix[float_dtype]: var time_embedded = self.time_embed.forward(time) var out = self.unet.forward(x, context, time_embedded) out = self.final.forward(out) return out --- helpers/__init__.mojo --- --- helpers/attention.mojo --- from .utils import * import math struct Self_Attention: var n_heads: Int var in_proj: Linear var out_proj: Linear fn __init__( inout self, n_heads: Int, d_embedding: Int, in_bias: Bool = True, out_bias: Bool = True, ): self.in_proj = Linear(d_embedding, 3 * d_embedding, in_bias) self.out_proj = Linear(d_embedding, d_embedding, out_bias) self.n_heads = n_heads fn __copyinit__(inout self, other: Self_Attention): self.in_proj = other.in_proj self.out_proj = other.out_proj self.n_heads = other.n_heads fn forward( inout self, inout x: Matrix[float_dtype], causal_mask: Bool = False ) -> Matrix[float_dtype]: var chunked_input = self.in_proj.forward(x).chunk(2, 3) var q = chunked_input[0].reshape( chunked_input[0].dim0 * self.n_heads, chunked_input[0].dim1, chunked_input[0].dim2 // self.n_heads, ) var k = chunked_input[1].reshape( chunked_input[1].dim0 * self.n_heads, chunked_input[1].dim1, chunked_input[1].dim2 // self.n_heads, ) var v = chunked_input[2].reshape( chunked_input[2].dim0 * self.n_heads, chunked_input[2].dim1, chunked_input[2].dim2 // self.n_heads, ) var weight = q.matmul(k.transpose(1, 2)) if causal_mask: var mask = Matrix[float_dtype](weight.dim0, weight.dim1, weight.dim2) mask.set_items( Slice(0, mask.dim0), Slice(0, mask.dim1), Slice(0, mask.dim2), 1 ) mask = mask.triu(1) var neg_inf = math.limit.neginf[float_dtype]() weight = weight.masked_fill(mask, neg_inf) var head_float: Float32 = x.dim2 // self.n_heads weight = weight / math.sqrt(head_float) weight = Softmax(weight, dim=2) var output = weight.matmul(v) output = output.transpose(0, 1) output = output.reshape(x.dim0, x.dim1, x.dim2) output = self.out_proj.forward(output) return output struct Cross_Attention: var n_heads: Int var q_proj: Linear var k_proj: Linear var v_proj: Linear var out_proj: Linear fn __init__( inout self, n_heads: Int, d_embedding: Int, d_crossing: Int, in_bias: Bool = True, out_bias: Bool = True, ): self.n_heads = n_heads self.q_proj = Linear(d_embedding, d_embedding, use_bias=in_bias) self.k_proj = Linear(d_crossing, d_embedding, use_bias=in_bias) self.v_proj = Linear(d_crossing, d_embedding, use_bias=in_bias) self.out_proj = Linear(d_embedding, d_embedding, use_bias=out_bias) fn __copyinit__(inout self, other: Cross_Attention): self.q_proj = other.q_proj self.k_proj = other.k_proj self.v_proj = other.v_proj self.out_proj = other.out_proj self.n_heads = other.n_heads fn forward( inout self, inout x: Matrix[float_dtype], inout context: Matrix[float_dtype], ) -> Matrix[float_dtype]: var q = self.q_proj.forward(x) var k = self.k_proj.forward(context) var v = self.v_proj.forward(context) q = q.reshape(q.dim0 * self.n_heads, q.dim1, q.dim2 // self.n_heads) k = k.reshape(k.dim0 * self.n_heads, k.dim1, k.dim2 // self.n_heads) v = v.reshape(v.dim0 * self.n_heads, v.dim1, v.dim2 // self.n_heads) var weight = q.matmul(k.transpose(1, 2)) var head_float: Float32 = x.dim2 // self.n_heads weight = weight / math.sqrt(head_float) weight = Softmax(weight, dim=2) var output = weight.matmul(v) output = output.transpose(0, 1) output = output.reshape(x.dim0, x.dim1, x.dim2) output = self.out_proj.forward(output) return output --- helpers/utils.mojo --- from tensor import Tensor, TensorShape from algorithm import parallelize, vectorize from algorithm import Static2DTileUnitFunc as Tile2DFunc from random import rand, random_float64, randn_float64 from sys.info import simdwidthof from memory import memset_zero, memcpy from sys.intrinsics import strided_load from math import trunc, mod, cos, sin, round from random import random_ui64, seed import buffer alias float_base = Float32 alias float_dtype = DType.float32 alias tensor_type = Tensor[float_dtype] alias simd_width: Int = simdwidthof[float_dtype]() alias pi = 3.141592653589793238462643383279 fn linspace(start: Float32, end: Float32, steps: Int) -> Tensor[float_dtype]: var step = (end - start) / (steps - 1) var out = Tensor[float_dtype](steps) for i in range(steps): out[i] = start + step * i return out fn arange(start: Float32, end: Float32, reverse:Bool = False) -> Tensor[float_dtype]: var out: Tensor[float_dtype] if not reverse: out = Tensor[float_dtype](int(end - start)) for i in range(end - start): out[i] = start + i else: out = Tensor[float_dtype](int(end - start)) for i in range(end - start): out[i] = end - 1 - i return out # Cumprod for a 1d tensor fn cumprod(tensor: Tensor[float_dtype]) -> Tensor[float_dtype]: var out = Tensor[float_dtype](tensor.num_elements()) var acc:Float32 = 1 for i in range(tensor.num_elements()): acc *= tensor[i] out[i] = acc return out fn round_tensor(tensor: Tensor[float_dtype]) -> Tensor[float_dtype]: var out = Tensor[float_dtype](tensor.shape()) @parameter fn round_fn[width: Int](index: Int): var val = tensor.load[width=width](index) var val_round = round[float_dtype, width](val) out.store[width](index, val_round) vectorize[round_fn, simd_width](tensor.num_elements()) return out fn get_tensor_values(tensor: Tensor[float_dtype], start_index: Int, end_index: Int) -> Tensor[float_dtype]: var out = Tensor[float_dtype](end_index - start_index) for i in range(start_index, end_index): out[i - start_index] = tensor[i] return out # This tokenizer-related section of the code was copied and then modified from the wonderful Mojo Llama2 project available here - https://github.com/tairov/llama2.mojo/blob/master/ struct FileBuf: var data: DTypePointer[DType.uint8] var offset: Int var size: Int fn __init__(inout self): self.data = DTypePointer[DType.uint8]() self.offset = 0 self.size = 0 fn __del__(owned self): self.data.free() fn move_offset(inout self, size: Int) raises: var new_offset = self.offset + size if new_offset > self.size: raise Error("Resulting offset will be past the end of the FileBuf") if new_offset < 0: raise Error("Resulting offset will be before the beginning of the FileBuf") self.offset = new_offset fn bitcast_offset_f32(inout self, size: Int) -> DTypePointer[DType.float32]: try: var ret = self.data.offset(self.offset).bitcast[DType.float32]() self.move_offset(size * sizeof[DType.float32]()) return ret except: print("Error offsetting float32 while reading float from tokenizer file") return DTypePointer[DType.float32]() fn get_offset(self) raises -> Int: if self.offset > self.size: raise Error("Offset is past the end of the FileBuf") if self.offset < 0: raise Error("Offset is before the beginning of the FileBuf") return self.offset fn read_file(file_name: String, inout buf: FileBuf): try: var fd = open(file_name, "r") var data = fd.read() fd.close() buf.size = data._buffer.size buf.data = data._steal_ptr().bitcast[DType.uint8]() buf.offset = 0 except: print("Error reading file") return fn read_val_int(inout buf: FileBuf) -> Int: try: var data = buf.data.offset(buf.get_offset()).bitcast[DType.int32]() var result = data.load(0) buf.move_offset(4) return result.to_int() except: print("Error reading int from tokenizer file") return 0 fn read_val_float32(inout buf: FileBuf) -> Float32: try: var val = buf.data.offset(buf.get_offset()).bitcast[DType.float32]().load(0) buf.move_offset(4) return val except: print("Error reading float32 from tokenizer file") return 0 fn read_val_str(inout buf: FileBuf, slen: Int) -> Pointer[UInt8]: try: var str = Pointer[UInt8].alloc(slen + 1) for i in range(slen): str.store(i, buf.data.load(buf.get_offset())) buf.move_offset(1) str.store(slen, 0) return str except: print("Error reading string from tokenizer file") return Pointer[UInt8].alloc(slen + 1) fn string_compare(a: Pointer[UInt8], b: Pointer[UInt8]) -> Int: var index = 0 while a[index] != 0 and b[index] != 0: if a[index] < b[index]: return -1 if a[index] > b[index]: return 1 index += 1 if a[index] != 0 and b[index] == 0: return 1 if a[index] == 0 and b[index] != 0: return -1 return 0 fn partition( inout array: Pointer[Pointer[UInt8]], inout indices: List[Int], low: Int, high: Int ) -> Int: var pivot = array[high] var ii = low - 1 for jj in range(low, high): if string_compare(pivot, array[jj]) == 1: ii = ii + 1 var tmp = array[ii] var tmp_idx = indices[ii] array.store(ii, array[jj]) indices[ii] = indices[jj] array.store(jj, tmp) indices[jj] = tmp_idx var tmp = array[ii + 1] var tmp_idx = indices[ii + 1] array.store(ii + 1, array[high]) indices[ii + 1] = indices[high] array.store(high, tmp) indices[high] = tmp_idx return ii + 1 fn quicksort( inout array: Pointer[Pointer[UInt8]], inout indices: List[Int], low: Int, high: Int ): if low < high: var pi = partition(array, indices, low, high) quicksort(array, indices, low, pi - 1) quicksort(array, indices, pi + 1, high) fn str_to_ptr(s: String) -> Pointer[UInt8]: var ret = Pointer[UInt8].alloc(len(s) + 1) for i in range(len(s)): ret.store(i, ord(s[i])) ret.store(len(s), 0) return ret fn wrap(token: Pointer[UInt8]) -> Pointer[UInt8]: if string_compare(token, str_to_ptr("\\n")) == 0: return str_to_ptr("<0x0A>") if string_compare(token, str_to_ptr("\\t")) == 0: return str_to_ptr("<0x09>") if string_compare(token, str_to_ptr("'")) == 0: return str_to_ptr("<0x27>") elif string_compare(token, str_to_ptr('"')) == 0: return str_to_ptr("<0x22>") return token fn str_len(s: Pointer[UInt8]) -> Int: var len = 0 while s[len] != 0: len += 1 return len fn str_concat(s1: Pointer[UInt8], s2: Pointer[UInt8]) -> Pointer[UInt8]: var l1 = str_len(s1) var l2 = str_len(s2) var string = Pointer[UInt8].alloc(l1 + l2 + 1) for i in range(l1): memcpy[count=1](string.offset(i), s1) for i in range(l2): memcpy[count=1](string.offset(l1 + i), s2) string.store(l1 + l2, 0) return string struct Tokenizer: var vocab: Pointer[Pointer[UInt8]] var vocab_scores: DTypePointer[DType.float32] var max_token_length: Int var vocab_size: Int var sorted_vocab: Pointer[Pointer[UInt8]] var sorted_indices: List[Int] fn __init__(inout self, vocab_size: Int, inout buf: FileBuf) -> None: self.vocab_size = vocab_size self.max_token_length = read_val_int(buf) self.vocab_scores = DTypePointer[DType.float32].alloc(self.vocab_size) self.vocab = Pointer[Pointer[UInt8]].alloc(self.vocab_size) self.sorted_vocab = Pointer[Pointer[UInt8]].alloc(0) self.sorted_indices = List[Int](capacity=0) for i in range(0, self.vocab_size): var score = read_val_float32(buf) var slen = read_val_int(buf) var token = read_val_str(buf, slen) self.store_token(i, token, score) return None fn __del__(owned self): for i in range(0, self.vocab_size): self.vocab[i].free() self.vocab.free() self.vocab_scores.free() self.sorted_vocab.free() fn store_token( inout self, index: Int, owned token: Pointer[UInt8], score: Float32 ) -> None: self.vocab_scores.store(index, score) self.vocab.store(index, token) fn sort(inout self) -> None: if len(self.sorted_indices) < self.vocab_size: self.sorted_indices = List[Int](capacity=self.vocab_size) self.sorted_vocab = Pointer[Pointer[UInt8]].alloc(self.vocab_size) for ii in range(self.vocab_size): self.sorted_vocab.store(ii, self.vocab[ii]) self.sorted_indices.append(ii) var n = self.vocab_size quicksort(self.sorted_vocab, self.sorted_indices, 0, n - 1) return None fn find(inout self, token_o: Pointer[UInt8]) -> Int: var token = wrap(token_o) var n = self.vocab_size if len(self.sorted_indices) < n: self.sort() var left = 0 var right = n - 1 while left <= right: var mid = left + (right - left) // 2 var comparison = string_compare(self.sorted_vocab[mid], token) if comparison == 0: return self.sorted_indices[mid] if comparison < 0: left = mid + 1 else: right = mid - 1 return -1 fn bpe_encode(text: String, inout tok: Tokenizer) -> List[Int]: var tokens = List[Int]() for pos in range(len(text)): var char = str_to_ptr(text[pos]) var tok_id = tok.find(char) if tok_id == -1: print("Not a good prompt token at pos ", pos) return tokens tokens.append(tok_id) while True: var best_score = Float32(-1e10) var best_id = -1 var best_idx = -1 for i in range(len(tokens) - 1): var str = str_concat(tok.vocab[tokens[i]], tok.vocab[tokens[i + 1]]) var id = tok.find(str) var loaded_score = tok.vocab_scores.load(id) if id != -1 and loaded_score > best_score: best_score = loaded_score best_id = id best_idx = i if best_idx == -1: break tokens[best_idx] = best_id var _tokens = List[Int]() for i in range(0, best_idx + 1): _tokens.append(tokens[i]) for i in range(best_idx + 2, len(tokens)): _tokens.append(tokens[i]) tokens = _tokens return tokens fn vector_to_matrix(vector: List[Int]) -> Matrix[float_dtype]: var total_size = len(vector) var out_matrix = Matrix[float_dtype](1, 1, total_size) @parameter fn vector_to_matrix_fn[width: Int](index: Int): var val = vector[index] var val_simd = SIMD[float_dtype, width].splat(int(val)) out_matrix.store[width](0, 0, index, val_simd) vectorize[vector_to_matrix_fn, 1](total_size) return out_matrix fn tensor_to_matrix(tensor: Tensor[float_dtype]) -> Matrix[float_dtype]: var out_matrix = Matrix[float_dtype](1,1, tensor.num_elements()) @parameter fn tensor_to_matrix_fn[width: Int](index: Int): var val = tensor.load[width](index) out_matrix._data.store[width=width](index, val) vectorize[tensor_to_matrix_fn, simd_width](tensor.num_elements()) return out_matrix fn get_time_embedding( timestep:SIMD[float_dtype, 1] ) -> Matrix[float_dtype]: var freqs = Matrix[float_dtype](1, 1, 160) @parameter fn time_range_fn[width: Int](index: Int): var float_index: Float32 = index var val:Float32 = (-float_index / 160) ** 10000 var val_simd = SIMD[float_dtype, width].splat(val) freqs.store[width](0, 0, index, val_simd) vectorize[time_range_fn, 1](160) var x = freqs * timestep var cos_x = x.cosine() var sin_x = x.sine() return cos_x.concat(sin_x, 2) fn resize_image( image: Matrix[float_dtype], new_height: Int, new_width: Int ) -> Matrix[float_dtype]: var old_channels = image.dim0 var old_width = image.dim1 var old_height = image.dim2 if old_height == new_height and old_width == new_width: return image var new_image = Matrix[float_dtype](old_channels, new_height, new_width) var scale_y = old_height / new_height var scale_x = old_width / new_width @parameter fn resize_channels(channel: Int): @parameter fn resize_row(row: Int): @parameter fn resize_image_fn[width: Int](col: Int): var new_y = int(row * scale_y) var new_x = int(col * scale_x) var val = image.load[1](channel, new_y, new_x) new_image.store[1](channel, row, col, val) vectorize[resize_image_fn, 1, unroll_factor=1](new_width) parallelize[resize_row](new_height, new_height) parallelize[resize_channels](old_channels, old_channels) return new_image # Perform 2D tiling on the iteration space defined by end_x and end_y. fn tile_2d[tiled_fn: Tile2DFunc, stride_x: Int, stride_y: Int](end_x: Int, end_y: Int): # Note: this assumes that ends are multiples of the tiles. for y in range(0, end_y, stride_y): for x in range(0, end_x, stride_x): tiled_fn[stride_x, stride_y](x, y) fn Softmax(inout matrix: Matrix[float_dtype], dim:Int = 0) -> Matrix[float_dtype]: var exp_matrix = matrix.exp() if dim == 0: @parameter fn channel_softmax(channel: Int): var channel_sum = exp_matrix[channel, :, :].sum() var channel_div = exp_matrix[channel, :, :] / channel_sum exp_matrix.set_items(channel, Slice(0, matrix.dim1), Slice(0, matrix.dim2), channel_div) parallelize[channel_softmax](matrix.dim0, matrix.dim0) return exp_matrix elif dim == 1: @parameter fn row_softmax_channel(channel: Int): @parameter fn row_softmax[width: Int](row: Int): var row_sum = exp_matrix[channel, row, :].sum() var row_div = exp_matrix[channel, row, :] / row_sum exp_matrix.set_items(channel, row, Slice(0, matrix.dim2), row_div) vectorize[row_softmax, 1, unroll_factor=1](matrix.dim1) parallelize[row_softmax_channel](matrix.dim0, matrix.dim0) return exp_matrix elif dim == 2: @parameter fn column_softmax_channel(channel: Int): @parameter fn column_softmax[width: Int](column: Int): var col_sum = exp_matrix[channel, :, column].sum() var col_div = exp_matrix[channel, :, column] / col_sum exp_matrix.set_items(channel, Slice(0, matrix.dim1), column, col_div) vectorize[column_softmax, 1, unroll_factor=1](matrix.dim2) parallelize[column_softmax_channel](matrix.dim0, matrix.dim0) return exp_matrix else: print("Invalid dimension for softmax. Returning null matrix") return Matrix[float_dtype](0, 0, 0) fn sigmoid(inout matrix: Matrix[float_dtype]) -> Matrix[float_dtype]: var new_matrix = matrix * -1 new_matrix = new_matrix.exp() new_matrix += 1 new_matrix = (new_matrix ** (-1)) return new_matrix struct Matrix_Array[dtype: DType]: var _data: DTypePointer[dtype] var matrix_shape: Tuple[Int, Int, Int] var matrix_size: Int var num_elements: Int fn __init__(inout self, num_elements: Int, matrix_shape: Tuple[Int, Int, Int]): self.matrix_shape = matrix_shape self.matrix_size = Tuple.get[0, Int](matrix_shape) * Tuple.get[1, Int](matrix_shape) * Tuple.get[2, Int](matrix_shape) self.num_elements = num_elements self._data = DTypePointer[dtype].alloc(self.matrix_size * num_elements) fn __copyinit__(inout self, other: Self): self._data = other._data self.matrix_shape = other.matrix_shape self.matrix_size = other.matrix_size self.num_elements = other.num_elements fn __setitem__(inout self, owned index: Int, new_el: Matrix[dtype]): var memory_index = index * self.matrix_size @parameter fn set_matrix(i : Int): self._data[memory_index + i] = new_el._data[i] parallelize[set_matrix](self.matrix_size, self.matrix_size) fn __setitem__(inout self, owned c_index: Int, owned z_index: Int, owned y_index: Int, owned x_index: Int, new_val: float_base): var memory_index = c_index * self.matrix_size + z_index * Tuple.get[1, Int](self.matrix_shape) * Tuple.get[2, Int](self.matrix_shape) + y_index * Tuple.get[2, Int](self.matrix_shape) + x_index var new_val_SIMD = SIMD[dtype, 1].splat(new_val.cast[dtype]()) self._data[memory_index] = new_val_SIMD fn __getitem__(self, owned index: Int) -> Matrix[dtype]: var memory_index = index * self.matrix_size var dim0 = Tuple.get[0, Int](self.matrix_shape) var dim1 = Tuple.get[1, Int](self.matrix_shape) var dim2 = Tuple.get[2, Int](self.matrix_shape) var new_matrix = Matrix[dtype](dim0, dim1, dim2) @parameter fn get_matrix(i : Int): new_matrix._data[i] = self._data[memory_index + i] parallelize[get_matrix](self.matrix_size, self.matrix_size) return new_matrix fn __add__(self, other: Matrix[dtype]) -> Matrix_Array[dtype]: var out = Matrix_Array[dtype](self.num_elements, self.matrix_shape) @parameter fn add_fn(i: Int): out[i] = (self[i] + other) parallelize[add_fn](self.num_elements, self.num_elements) return out fn print(self): for i in range(self.num_elements): print("Matrix", i) self[i].print() # Check out https://github.com/modularml/mojo/blob/main/examples/blogs-videos/mojo-matrix-Slice.ipynb struct Matrix[dtype: DType]: var dim0: Int var dim1: Int var dim2: Int var _data: DTypePointer[dtype] fn __init__(inout self, *dims: Int): if dims[0] < 0 or dims[1] < 0 or dims[2] < 0: self.dim0 = 0 self.dim1 = 0 self.dim2 = 0 self.dim0 = dims[0] self.dim1 = dims[1] self.dim2 = dims[2] self._data = DTypePointer[dtype].alloc(dims[0] * dims[1] * dims[2]) rand(self._data, dims[0] * dims[1] * dims[2]) fn init_weights(inout self, lower_bound: float_base, upper_bound:float_base): var low_bound = lower_bound.cast[DType.float64]() var up_bound = upper_bound.cast[DType.float64]() @parameter fn init_weights_fn[width: Int](index: Int) -> None: var weight_val = random_float64(low_bound, up_bound) var weight_simd = SIMD[DType.float64, width].splat(weight_val) var weight_simd_dtype = weight_simd.cast[dtype]() self._data.store[width=width](index, weight_simd_dtype) vectorize[init_weights_fn, 1](self.size().to_int()) fn init_weights_normal(inout self, mean: float_base, std: float_base): var mean_val = mean.cast[DType.float64]() var std_val = std.cast[DType.float64]() @parameter fn init_weights_normal_fn[width: Int](index: Int) -> None: var weight_val = randn_float64(mean_val, std_val) var weight_simd = SIMD[DType.float64, width].splat(weight_val) var weight_simd_dtype = weight_simd.cast[dtype]() self._data.store[width=width](index, weight_simd_dtype) vectorize[init_weights_normal_fn, 1](self.size().to_int()) fn init_weights_seed(inout self, seed_val: Int = 0): if seed_val == 0: seed() else: seed(seed_val) @parameter fn init_weights_random_fn[width: Int](index: Int) -> None: var weight_val = random_float64(1, 10000000) var weight_simd = SIMD[DType.float64, width].splat(weight_val) var weight_simd_dtype = weight_simd.cast[dtype]() self._data.store[width=width](index, weight_simd_dtype) vectorize[init_weights_random_fn, 1](self.size().to_int()) fn rescale(inout self, old_scale: Tuple, new_scale: Tuple, clamp: Bool = False) -> Matrix[dtype]: var old_min = Tuple.get[0, Int](old_scale) var old_max = Tuple.get[1, Int](old_scale) var new_min = Tuple.get[0, Int](new_scale) var new_max = Tuple.get[1, Int](new_scale) var new_matrix = Matrix[dtype](self.dim0, self.dim1, self.dim2) @parameter fn rescale_fn[simd_width: Int](index: Int) -> None: var old_val = self._data.load[width=simd_width](index) var new_val_float = (old_val - old_min) * (new_max - new_min) / (old_max - old_min) + new_min var new_val = new_val_float.cast[dtype]() new_matrix._data.store[width=simd_width](index, new_val) vectorize[rescale_fn, simd_width](self.size().to_int()) if clamp: new_matrix = new_matrix.clamp(new_min, new_max) return new_matrix fn __copyinit__(inout self, other: Self): self._data = other._data self.dim0 = other.dim0 self.dim1 = other.dim1 self.dim2 = other.dim2 fn concat(inout self, other: Self, dim: Int) -> Self: if dim < 0 or dim > 2: print("Invalid dimension for concatenation. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0 + other.dim0, self.dim1, self.dim2) if dim == 0: if self.dim1 != other.dim1 or self.dim2 != other.dim2: print("Non-matching dimensions for concatenation along the first axis. Returning null matrix") return Self(0, 0, 0) @parameter fn concat_fn0_self(c: Int): @parameter fn row_fn0_self(y: Int): @parameter fn col_fn0_self[simd_width: Int](x: Int): var val = self.load[simd_width](c, y, x) new_matrix.store[simd_width](c, y, x, val) vectorize[col_fn0_self, simd_width, unroll_factor=simd_width](self.dim2) parallelize[row_fn0_self](self.dim1, self.dim1) parallelize[concat_fn0_self](self.dim0, self.dim0) @parameter fn concat_fn0_other(c: Int): @parameter fn row_fn0_other(y: Int): @parameter fn col_fn0_other[simd_width: Int](x: Int): var val = other.load[simd_width](c, y, x) new_matrix.store[simd_width](c + self.dim0, y, x, val) vectorize[col_fn0_other, simd_width, unroll_factor=simd_width](other.dim2) parallelize[row_fn0_other](other.dim1, other.dim1) parallelize[concat_fn0_other](other.dim0, other.dim0) return new_matrix elif dim == 1: if self.dim0 != other.dim0 or self.dim2 != other.dim2: print("Non-matching dimensions for concatenation along the second axis. Returning null matrix") return Self(0, 0, 0) new_matrix = Self(self.dim0, self.dim1 + other.dim1, self.dim2) @parameter fn concat_fn1_self(c: Int): @parameter fn row_fn1_self(y: Int): @parameter fn col_fn1_self[simd_width: Int](x: Int): var val = self.load[simd_width](c, y, x) new_matrix.store[simd_width](c, y, x, val) vectorize[col_fn1_self, simd_width, unroll_factor=simd_width](self.dim2) parallelize[row_fn1_self](self.dim1, self.dim1) parallelize[concat_fn1_self](self.dim0, self.dim0) @parameter fn concat_fn1_other(c: Int): @parameter fn row_fn1_other(y: Int): @parameter fn col_fn1_other[simd_width: Int](x: Int): var val = other.load[simd_width](c, y, x) new_matrix.store[simd_width](c, y + self.dim1, x, val) vectorize[col_fn1_other, simd_width, unroll_factor=simd_width](other.dim2) parallelize[row_fn1_other](other.dim1, other.dim1) parallelize[concat_fn1_other](other.dim0, other.dim0) else: if self.dim0 != other.dim0 or self.dim1 != other.dim1: print("Non-matching dimensions for concatenation along the third axis. Returning null matrix") return Self(0, 0, 0) new_matrix = Self(self.dim0, self.dim1, self.dim2 + other.dim2) @parameter fn concat_fn2_self(c: Int): @parameter fn row_fn2_self(y: Int): @parameter fn col_fn2_self[simd_width: Int](x: Int): var val = self.load[simd_width](c, y, x) new_matrix.store[simd_width](c, y, x, val) vectorize[col_fn2_self, simd_width, unroll_factor=simd_width](self.dim2) parallelize[row_fn2_self](self.dim1, self.dim1) parallelize[concat_fn2_self](self.dim0, self.dim0) @parameter fn concat_fn2_other(c: Int): @parameter fn row_fn2_other(y: Int): @parameter fn col_fn2_other[simd_width: Int](x: Int): var val = other.load[simd_width](c, y, x) new_matrix.store[simd_width](c, y, x + self.dim2, val) vectorize[col_fn2_other, simd_width, unroll_factor=simd_width](other.dim2) parallelize[row_fn2_other](other.dim1, other.dim1) parallelize[concat_fn2_other](other.dim0, other.dim0) return new_matrix fn to_long(inout self) -> Matrix[DType.float64]: var new_matrix = Matrix[DType.float64](self.dim0, self.dim1, self.dim2) @parameter fn to_long_fn[width: Int](index: Int) -> None: var val = self._data.load[width=width](index) var val_long = val.cast[DType.float64]() new_matrix._data.store[width=width](index, val_long) vectorize[to_long_fn, simd_width](self.size().to_int()) return new_matrix fn to_float32(inout self) -> Matrix[DType.float32]: var new_matrix = Matrix[DType.float32](self.dim0, self.dim1, self.dim2) @parameter fn to_float_fn[width: Int](index: Int) -> None: var val = self._data.load[width=width](index) var val_float32 = val.cast[DType.float32]() new_matrix._data.store[width=width](index, val_float32) vectorize[to_float_fn, simd_width](self.size().to_int()) return new_matrix fn __adjust_Slice__(self, inout span: Slice, dim: Int) -> Slice: if span.start >= dim: span.start = dim - 1 elif span.start < 0: span.start += dim if span.start < 0: span.start = 0 if not span._has_end(): span.end = dim elif span.end < 0: span.end += dim + 1 if span.end < 0: span.end = 0 elif span.end > dim: span.end = dim if span.end < span.start: span.start = 0 span.end = 0 return span fn __adjust_index(self, inout index: Int, dim: Int) -> Int: if index < 0: index += dim if index < 0: index = 0 if index >= dim: index = dim - 1 return index fn cosine(inout self) -> Matrix[float_dtype]: var new_matrix = Matrix[float_dtype](self.dim0, self.dim1, self.dim2) @parameter fn cosine_fn[width: Int](index: Int) -> None: var val = self._data.load[width=1](index) var val_simd = SIMD[DType.float32, 1].splat(val.cast[DType.float32]()) var val_cosine = cos[float_dtype, 1](val_simd) new_matrix._data.store[width=1](index, val_cosine) vectorize[cosine_fn, 1](self.size().to_int()) return new_matrix fn sine(inout self) -> Matrix[float_dtype]: var new_matrix = Matrix[float_dtype](self.dim0, self.dim1, self.dim2) @parameter fn sine_fn[width: Int](index: Int) -> None: var val = self._data.load[width=1](index) var val_simd = SIMD[DType.float32, 1].splat(val.cast[DType.float32]()) var val_sine = sin[float_dtype, 1](val_simd) new_matrix._data.store[width=width](index, val_sine) vectorize[sine_fn, 1](self.size().to_int()) return new_matrix fn load[simd_width: Int](self, z: Int, y: Int, x: Int) -> SIMD[dtype, simd_width]: var index = z * self.dim2 * self.dim1 + y * self.dim2 + x return self._data.load[width=simd_width](index) fn store[simd_width: Int](self, z:Int, y: Int, x: Int, val: SIMD[dtype, simd_width]): var index = z * self.dim2 * self.dim1 + y * self.dim2 + x return self._data.store[width=simd_width](index, val) fn __setitem__(self, owned z: Int, owned x: Int, owned y: Int, val: SIMD[dtype, 1]): z = self.__adjust_index(z, self.dim0) x = self.__adjust_index(x, self.dim1) y = self.__adjust_index(y, self.dim2) var val_simd = SIMD[dtype, 1].splat(val.cast[dtype]()) self.store[1](z, x, y, val_simd) fn set_items( inout self, owned channel: Int, owned row: Int, col: Int, val: float_base ): self.set_items( Slice(channel, channel + 1), Slice(row, row + 1), Slice(col, col + 1), val ) fn set_items( inout self, owned channel_Slice: Slice, owned row_Slice: Slice, col: Int, val: float_base, ): self.set_items(channel_Slice, row_Slice, Slice(col, col + 1), val) fn set_items( inout self, owned channel_Slice: Slice, row: Int, owned col_Slice: Slice, val: float_base, ): self.set_items(channel_Slice, Slice(row, row + 1), col_Slice, val) fn set_items( inout self, owned channel_Slice: Slice, row: Int, col: Int, val: float_base ): self.set_items(channel_Slice, Slice(row, row + 1), Slice(col, col + 1), val) fn set_items( inout self, channel: Int, owned row_Slice: Slice, owned col_Slice: Slice, val: float_base, ): self.set_items(Slice(channel, channel + 1), row_Slice, col_Slice, val) fn set_items( inout self, channel: Int, owned row_Slice: Slice, col: Int, val: float_base ): self.set_items(Slice(channel, channel + 1), row_Slice, Slice(col, col + 1), val) fn set_items( inout self, channel: Int, row: Int, owned col_Slice: Slice, val: float_base ): self.set_items(Slice(channel, channel + 1), Slice(row, row + 1), col_Slice, val) # Example usage: b.set_items(1,1,Slice(0,3), 7) fn set_items( inout self, owned channel_Slice: Slice, owned row_Slice: Slice, owned col_Slice: Slice, val: float_base, ): channel_Slice = self.__adjust_Slice__(channel_Slice, self.dim0) row_Slice = self.__adjust_Slice__(row_Slice, self.dim1) col_Slice = self.__adjust_Slice__(col_Slice, self.dim2) var val_simd = SIMD[dtype, 1].splat(val.cast[dtype]()) @parameter fn Slice_channels_fn(channel_idx: Int): @parameter fn Slice_row_fn(row_idx: Int): @parameter fn Slice_col_fn[simd_width: Int](col_idx: Int) -> None: self.store[simd_width]( channel_Slice[channel_idx], row_Slice[row_idx], col_Slice[0] + (col_idx), val_simd, ) vectorize[Slice_col_fn, simd_width, unroll_factor=simd_width]( col_Slice.__len__() ) parallelize[Slice_row_fn](row_Slice.__len__(), row_Slice.__len__()) parallelize[Slice_channels_fn](channel_Slice.__len__(), channel_Slice.__len__()) fn set_items( inout self, owned channel: Int, owned row: Int, col: Int, inout vals: Self, ) : self.set_items( Slice(channel, channel + 1), Slice(row, row + 1), Slice(col, col + 1), vals ) fn set_items( inout self, owned channel_Slice: Slice, owned row_Slice: Slice, col: Int, inout vals: Self, ) : self.set_items(channel_Slice, row_Slice, Slice(col, col + 1), vals) fn set_items( inout self, owned channel_Slice: Slice, row: Int, owned col_Slice: Slice, inout vals: Self, ) : self.set_items(channel_Slice, Slice(row, row + 1), col_Slice, vals) fn set_items( inout self, owned channel_Slice: Slice, row: Int, col: Int, inout vals: Self, ) : self.set_items(channel_Slice, Slice(row, row + 1), Slice(col, col + 1), vals) fn set_items( inout self, channel: Int, owned row_Slice: Slice, owned col_Slice: Slice, inout vals: Self, ) : self.set_items(Slice(channel, channel + 1), row_Slice, col_Slice, vals) fn set_items( inout self, channel: Int, owned row_Slice: Slice, col: Int, inout vals: Self, ) : self.set_items( Slice(channel, channel + 1), row_Slice, Slice(col, col + 1), vals ) fn set_items( inout self, channel: Int, row: Int, owned col_Slice: Slice, inout vals: Self, ) : self.set_items( Slice(channel, channel + 1), Slice(row, row + 1), col_Slice, vals ) # Usage: b.set_items(Slice(0, 3), Slice(0, 3), Slice(0, 3), c) fn set_items( inout self, owned channel_Slice: Slice, owned row_Slice: Slice, owned col_Slice: Slice, inout vals: Self, ): channel_Slice = self.__adjust_Slice__(channel_Slice, self.dim0) row_Slice = self.__adjust_Slice__(row_Slice, self.dim1) col_Slice = self.__adjust_Slice__(col_Slice, self.dim2) if ( channel_Slice.__len__() * row_Slice.__len__() * col_Slice.__len__() != vals.dim0 * vals.dim1 * vals.dim2 ): return vals = vals.reshape( channel_Slice.__len__(), row_Slice.__len__(), col_Slice.__len__() ) @parameter fn Slice_channels_fn(channel_idx: Int): @parameter fn Slice_rows_fn(row_idx: Int): @parameter fn Slice_cols_fn[simd_width: Int](idx: Int) -> None: var vals_idx = vals._data.offset( channel_idx * row_Slice.__len__() * col_Slice.__len__() + row_idx * col_Slice.__len__() + idx ) var loaded_val = strided_load[dtype, simd_width]( vals_idx, col_Slice.step ) self.store[simd_width](channel_Slice[channel_idx], row_Slice[row_idx], col_Slice[0] + (idx * col_Slice.step), loaded_val) vectorize[Slice_cols_fn, simd_width, unroll_factor=simd_width]( col_Slice.__len__() ) parallelize[Slice_rows_fn](row_Slice.__len__(), row_Slice.__len__()) parallelize[Slice_channels_fn](channel_Slice.__len__(), channel_Slice.__len__()) # Usage: b.set_items(1,1,1), c) fn Slice_items(inout self, inout vals: Self) : self.set_items( Slice(0, self.dim0), Slice(0, self.dim1), Slice(0, self.dim2), vals ) fn __getitem__(self, owned z: Int, owned x: Int, owned y: Int) -> SIMD[dtype, 1]: z = self.__adjust_index(z, self.dim0) x = self.__adjust_index(x, self.dim1) y = self.__adjust_index(y, self.dim2) var channel_adjustment = z * (self.dim1 * self.dim2) var row_adjustment = x * self.dim2 return self._data.load[width=1](channel_adjustment + row_adjustment + y) fn __getitem__( self, owned channel_Slice: Slice, owned row_Slice: Slice, col: Int ) -> Self: return self.__getitem__(channel_Slice, row_Slice, Slice(col, col + 1)) fn __getitem__( self, owned channel_Slice: Slice, row: Int, owned col_Slice: Slice ) -> Self: return self.__getitem__(channel_Slice, Slice(row, row + 1), col_Slice) fn __getitem__(self, owned channel_Slice: Slice, row: Int, col: Int) -> Self: return self.__getitem__(channel_Slice, Slice(row, row + 1), Slice(col, col + 1)) fn __getitem__( self, channel: Int, owned row_Slice: Slice, owned col_Slice: Slice ) -> Self: return self.__getitem__(Slice(channel, channel + 1), row_Slice, col_Slice) fn __getitem__(self, channel: Int, owned row_Slice: Slice, col: Int) -> Self: return self.__getitem__( Slice(channel, channel + 1), row_Slice, Slice(col, col + 1) ) fn __getitem__(self, channel: Int, row: Int, owned col_Slice: Slice) -> Self: return self.__getitem__( Slice(channel, channel + 1), Slice(row, row + 1), col_Slice ) # Usage: a[:, 2:4, 7:] fn __getitem__( self, owned channel_Slice: Slice, owned row_Slice: Slice, owned col_Slice: Slice ) -> Self: channel_Slice = self.__adjust_Slice__(channel_Slice, self.dim0) row_Slice = self.__adjust_Slice__(row_Slice, self.dim1) col_Slice = self.__adjust_Slice__(col_Slice, self.dim2) var Sliced_mat = Self( channel_Slice.__len__(), row_Slice.__len__(), col_Slice.__len__() ) @parameter fn Slice_channels_fn(channel_idx: Int): var channel_ptr = self._data.offset( channel_Slice[channel_idx] * self.dim1 * self.dim2 ) @parameter fn Slice_rows_fn(row_idx: Int): var row_ptr = channel_ptr.offset( row_Slice[row_idx] * self.dim2 + col_Slice[0] ) @parameter fn Slice_cols_fn[simd_width: Int](idx: Int): var mat_idx = channel_idx * row_Slice.__len__() * col_Slice.__len__() + row_idx * col_Slice.__len__() + idx var idx_pointer = row_ptr.offset(idx * col_Slice.step * simd_width) var loaded_val = strided_load[dtype, simd_width]( idx_pointer, col_Slice.step ) Sliced_mat._data.store[width=simd_width](mat_idx, loaded_val) vectorize[Slice_cols_fn, simd_width, unroll_factor=simd_width]( col_Slice.__len__() ) parallelize[Slice_rows_fn](row_Slice.__len__(), row_Slice.__len__()) parallelize[Slice_channels_fn](channel_Slice.__len__(), channel_Slice.__len__()) return Sliced_mat fn size(self) -> float_base: return self.dim0 * self.dim1 * self.dim2 fn print_dims(self) -> None: print( "Matrix:", self.dim0, "x", self.dim1, "x", self.dim2, ",", "DType:", dtype.__str__(), ) fn reshape(inout self, dim0: Int, dim1: Int, dim2: Int) -> Self: if dim0 * dim1 * dim2 != self.dim0 * self.dim1 * self.dim2: print("Invalid reshape dimensions that do not match the input size. Returning null matrix") return Self(0, 0, 0) if dim0 == self.dim0 and dim1 == self.dim1 and dim2 == self.dim2: return self if dim0 < 0 or dim1 < 0 or dim2 < 0: print("Invalid negative reshape dimensions. Returning null matrix") return Self(0, 0, 0) self.dim0 = dim0 self.dim1 = dim1 self.dim2 = dim2 return self fn exp(self) -> Self: var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix.__copyinit__(self) var new_matrix_size = new_matrix.size().to_int() @parameter fn exp_fn[simd_width: Int](index: Int) -> None: new_matrix._data.store[width=simd_width]( index, math.exp(self._data.load[width=simd_width](index)) ) vectorize[exp_fn, simd_width](new_matrix_size) return new_matrix fn sqrt(self) -> Self: var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix.__copyinit__(self) var new_matrix_size = new_matrix.size().to_int() @parameter fn sqrt_fn[simd_width: Int](index: Int) -> None: new_matrix._data.store[width=simd_width]( index, math.sqrt(self._data.load[width=simd_width](index)) ) vectorize[sqrt_fn, simd_width](new_matrix_size) return new_matrix fn __mul__(self, y: float_base) -> Self: var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix.__copyinit__(self) var new_matrix_size = new_matrix.size().to_int() @parameter fn mul_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__mul__(y_simd) new_matrix._data.store[width=simd_width](index, computed_val) vectorize[mul_fn, simd_width](new_matrix_size) return new_matrix fn __imul__(self, y: float_base) -> None: @parameter fn mul_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__mul__(y_simd) self._data.store[width=simd_width](index, computed_val) vectorize[mul_fn, simd_width](self.size().to_int()) fn __pow__(self, y: float_base) -> Self: var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix.__copyinit__(self) var new_matrix_size = new_matrix.size().to_int() @parameter fn pow_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__pow__(y_simd) new_matrix._data.store[width=simd_width](index, computed_val) vectorize[pow_fn, simd_width](new_matrix_size) return new_matrix fn __ipow__(self, y: float_base) -> None: @parameter fn pow_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__pow__(y_simd) self._data.store[width=simd_width](index, computed_val) vectorize[pow_fn, simd_width](self.size().to_int()) fn __sub__(self, other: Self) -> Self: if self.dim0 != other.dim0 or self.dim1 != other.dim1 or self.dim2 != other.dim2: print("Non-matching dimensions for subtraction. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix *= 0 @parameter fn channel_fn(c: Int): @parameter fn row_fn(y: Int): @parameter fn col_fn[simd_width: Int](x: Int): var simd_val = self.load[simd_width](c, y, x) var simd_val2 = other.load[simd_width](c, y, x) var computed_val = simd_val.__sub__(simd_val2) new_matrix.store[simd_width](c, y, x, computed_val) vectorize[col_fn, simd_width, unroll_factor=simd_width](self.dim2) parallelize[row_fn](self.dim1, self.dim1) parallelize[channel_fn](self.dim0, self.dim0) return new_matrix fn __add__(self, y: float_base) -> Self: var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix.__copyinit__(self) var new_matrix_size = new_matrix.size().to_int() @parameter fn add_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__add__(y_simd) new_matrix._data.store[width=simd_width](index, computed_val) vectorize[add_fn, simd_width](new_matrix_size) return new_matrix fn __add__(self, other: Self) -> Self: if self.dim0 != other.dim0 or self.dim1 != other.dim1 or self.dim2 != other.dim2: print("Non-matching dimensions for addition. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix *= 0 @parameter fn channel_fn(c: Int): @parameter fn row_fn(y: Int): @parameter fn col_fn[simd_width: Int](x: Int): var simd_val = self.load[simd_width](c, y, x) var simd_val2 = other.load[simd_width](c, y, x) var computed_val = simd_val.__add__(simd_val2) new_matrix.store[simd_width](c, y, x, computed_val) vectorize[col_fn, simd_width, unroll_factor=simd_width](self.dim2) parallelize[row_fn](self.dim1, self.dim1) parallelize[channel_fn](self.dim0, self.dim0) return new_matrix fn __iadd__(self, y: float_base) -> None: @parameter fn add_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__add__(y_simd) self._data.store[width=simd_width](index, computed_val) vectorize[add_fn, simd_width](self.size().to_int()) fn __isub__(self, y: float_base) -> None: @parameter fn sub_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__add__(-y_simd) self._data.store[width=simd_width](index, computed_val) vectorize[sub_fn, simd_width](self.size().to_int()) fn __truediv__(self, other: Self) -> Self: if self.dim0 != other.dim0 or self.dim1 != other.dim1 or self.dim2 != other.dim2: print("Non-matching dimensions for division. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix *= 0 @parameter fn channel_fn(c: Int): @parameter fn row_fn(y: Int): @parameter fn col_fn[simd_width: Int](x: Int): var simd_val = self.load[simd_width](c, y, x) var simd_val2 = other.load[simd_width](c, y, x) var computed_val = simd_val.__truediv__(simd_val2) new_matrix.store[simd_width](c, y, x, computed_val) vectorize[col_fn, simd_width, unroll_factor=simd_width](self.dim2) parallelize[row_fn](self.dim1, self.dim1) parallelize[channel_fn](self.dim0, self.dim0) return new_matrix fn __truediv__(self, y: float_base) -> Self: var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix.__copyinit__(self) var new_matrix_size = new_matrix.size().to_int() @parameter fn div_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__truediv__( y_simd ) new_matrix._data.store[width=simd_width](index, computed_val) vectorize[div_fn, simd_width](new_matrix_size) return new_matrix fn __itruediv__(self, y: float_base) -> None: @parameter fn div_fn[simd_width: Int](index: Int) -> None: var y_simd = SIMD[dtype, simd_width].splat(y.cast[dtype]()) var computed_val = self._data.load[width=simd_width](index).__truediv__( y_simd ) self._data.store[width=simd_width](index, computed_val) vectorize[div_fn, simd_width](self.size().to_int()) fn sum(self) -> SIMD[dtype, 1]: var sum_simd = SIMD[dtype, 1].splat(0.0) for index in range(self.size().to_int()): sum_simd += self._data.load[width=1](index) return sum_simd fn mean(self) -> SIMD[dtype, 1]: return self.sum().__truediv__(self.size().cast[dtype]()) # we use an unbiased estimator of the standard deviation fn std(self) -> SIMD[dtype, 1]: var mean = self.mean() var sum = self.sum() var sq_sum = SIMD[dtype, 1].splat(0.0) for i in range(self.size().to_int()): sq_sum += (self._data.load[width=1](i) - mean) ** 2 return math.sqrt(sq_sum / self.size().cast[dtype]()) # Order of padding is (top, bottom), (left, right) fn pad(self, padding_height: Tuple, padding_width: Tuple) -> Self: var matrix_height = self.dim1 var matrix_width = self.dim2 var padding_height_top = Tuple.get[0, Int](padding_height) var padding_height_bottom = Tuple.get[1, Int](padding_height) var padding_width_left = Tuple.get[0, Int](padding_width) var padding_width_right = Tuple.get[1, Int](padding_width) var padded_width = (matrix_width + padding_width_left + padding_width_right) var padded_height = (matrix_height + padding_height_top + padding_height_bottom) var padded = Self(self.dim0, padded_height, padded_width) padded *= 0 @parameter fn channel_fn(c: Int): @parameter fn row_fn(y: Int): @parameter fn col_fn[simd_width: Int](x: Int): var c_simd = SIMD[dtype, simd_width].splat(c) var x_simd = SIMD[dtype, simd_width].splat(x + padding_width_left) var y_simd = SIMD[dtype, simd_width].splat(y + padding_height_top) padded[c, y + padding_height_top, x + padding_width_left] = self[ c, y, x ] vectorize[col_fn, 1, unroll_factor=1](matrix_width) parallelize[row_fn](matrix_height, matrix_height) parallelize[channel_fn](self.dim0, self.dim0) return padded # Elementwise multiplication. Usage: # var c = a.multiply(b) fn multiply(self, matrix: Self) -> Self: if self.dim0 != matrix.dim0 or self.dim1 != matrix.dim1 or self.dim2 != matrix.dim2: print("Non-matching dimensions for elementwise multiplication. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0, self.dim1, matrix.dim2) new_matrix *= 0 @parameter fn channel_fn(c: Int): @parameter fn row_fn(y: Int): @parameter fn col_fn[simd_width: Int](x: Int): var simd_val = self.load[simd_width](c, y, x) var simd_val2 = matrix.load[simd_width](c, y, x) var computed_val = simd_val.__mul__(simd_val2) new_matrix.store[simd_width](c, y, x, computed_val) vectorize[col_fn, simd_width, unroll_factor=simd_width](self.dim2) parallelize[row_fn](self.dim1, self.dim1) parallelize[channel_fn](self.dim0, self.dim0) return new_matrix fn clamp(self, min_val: float_base, max_val: float_base) -> Self: var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix *= 0 @parameter fn clamp_fn[simd_width: Int](index: Int): var min_simd = SIMD[dtype, simd_width].splat(min_val.cast[dtype]()) var max_simd = SIMD[dtype, simd_width].splat(max_val.cast[dtype]()) var val = self._data.load[width=simd_width](index) var computed_val = val.max(min_simd).min(max_simd) new_matrix._data.store[width=simd_width](index, computed_val) vectorize[clamp_fn, simd_width, unroll_factor=simd_width](self.size().to_int()) return new_matrix # Usage: var c = b.chunk(2, 2) fn chunk(self, chunk_dim: Int, num_chunks: Int) -> Matrix_Array[dtype]: if chunk_dim < 0 or chunk_dim >= 3: print("Out of bounds chunk dimension. Returning null array") return Matrix_Array[dtype](0, (0,0,0)) var chunk_axis = self.dim0 if chunk_dim == 1: chunk_axis = self.dim1 elif chunk_dim == 2: chunk_axis = self.dim2 if num_chunks > chunk_axis: print("Number of chunks exceeds the size of the chunk axis. Returning null array") return Matrix_Array[dtype](0, (0,0,0)) # For now, we only support chunking evenly for simplicity if chunk_axis % num_chunks != 0: print("Number of chunks does not evenly divide the size of the chunk axis. Returning null array") return Matrix_Array[dtype](0, (0,0,0)) var chunk_size = chunk_axis // num_chunks var out_size = (chunk_size, self.dim1, self.dim2) if chunk_dim == 1: out_size = (self.dim0, chunk_size, self.dim2) elif chunk_dim == 2: out_size = (self.dim0, self.dim1, chunk_size) var out_array = Matrix_Array[dtype](num_chunks, out_size) @parameter fn chunk_fn(index: Int): var chunk_start = index * chunk_size var chunk_end = (index + 1) * chunk_size var chunk_Slice = Slice(chunk_start, chunk_end) if chunk_dim == 0: out_array[index] = self[chunk_Slice, Slice(0, self.dim1), Slice(0, self.dim2)] elif chunk_dim == 1: out_array[index] = self[Slice(0, self.dim0), chunk_Slice, Slice(0, self.dim2)] elif chunk_dim == 2: out_array[index] = self[Slice(0, self.dim0), Slice(0, self.dim1), chunk_Slice] parallelize[chunk_fn](num_chunks, num_chunks) return out_array # Usage: var d = b.transpose(0, 1) --> flips the coordinates for the 0 and 1 axes fn transpose(inout self, dim0: Int = 1, dim1: Int = 2) -> Self: if dim0 < 0 or dim0 >= 3 or dim1 < 0 or dim1 >= 3: print("Dimensions for transpose exceed matrix dimensions. Returning null matrix") return Self(0, 0, 0) if dim0 == dim1: return self # This covers the 0 and 1 case var new_matrix = Self(self.dim1, self.dim0, self.dim2) if (dim0 == 0 and dim1 == 2) or (dim0 == 2 and dim1 == 0): new_matrix = Self(self.dim2, self.dim1, self.dim0) elif (dim0 == 1 and dim1 == 2) or (dim0 == 2 and dim1 == 1): new_matrix = Self(self.dim0, self.dim2, self.dim1) new_matrix *= 0 @parameter fn transpose_fn[block_width: Int](index: Int): var x = index % self.dim2 var y = (index // self.dim2) % self.dim1 var z = index // (self.dim1 * self.dim2) var new_x = x var new_y = y var new_z = z if (dim0 == 0 and dim1 == 1) or (dim0 == 1 and dim1 == 0): new_z = y new_y = z if (dim0 == 0 and dim1 == 2) or (dim0 == 2 and dim1 == 0): new_x = z new_z = x if (dim0 == 1 and dim1 == 2) or (dim0 == 2 and dim1 == 1): new_y = x new_x = y new_matrix[new_z, new_y, new_x] = self[z, y, x] vectorize[transpose_fn, 1, unroll_factor=1](self.size().to_int()) return new_matrix # This can be further optimized with tilingas you can check on the Mojo website. However, since I want to dynamically adjust the tile boundaries instead of assuming that the tile size will be a divisor of the tile function's boundaries, I didn't use it here. fn matmul(inout self, matrix: Self) -> Self: if self.dim2 != matrix.dim1: print("Non-matching dimensions for matrix multiplication. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0, self.dim1, matrix.dim2) new_matrix *= 0 @parameter fn calc_channel(c: Int): @parameter fn calc_row(m: Int): for k in range(self.dim2): @parameter fn dot[simd_width : Int](n : Int): new_matrix[c, m, n] += self[c, m, k] * matrix[c, k, n] vectorize[dot, 1, unroll_factor=1](new_matrix.dim2) parallelize[calc_row](self.dim1, new_matrix.dim1) parallelize[calc_channel](self.dim0, new_matrix.dim0) return new_matrix fn triu(self, diagonal: Int = 0) -> Self: if diagonal != 0 and diagonal != 1: print("Invalid diagonal value. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix.__copyinit__(self) @parameter fn triu_channel(channel_idx: Int): @parameter fn triu_row(row_idx: Int): @parameter fn triu_col[width: Int](col_idx: Int): if diagonal == 0: if row_idx > col_idx: new_matrix[channel_idx, row_idx, col_idx] = 0.0 else: var adjusted_row_idx = new_matrix.dim1 - row_idx - 1 if row_idx < col_idx: new_matrix[channel_idx, adjusted_row_idx, col_idx] = 0.0 vectorize[triu_col, 1, unroll_factor=1](self.dim2) parallelize[triu_row](self.dim1, self.dim1) parallelize[triu_channel](self.dim0, self.dim0) return new_matrix fn masked_fill(self, mask: Self, value: float_base) -> Self: if self.dim0 != mask.dim0 or self.dim1 != mask.dim1 or self.dim2 != mask.dim2: print("Non-matching dimensions for masked fill. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0, self.dim1, self.dim2) new_matrix.__copyinit__(self) var simd_value = SIMD[dtype, 1].splat(value.cast[dtype]()) @parameter fn masked_fill_channel(channel_idx: Int): @parameter fn masked_fill_row(row_idx: Int): @parameter fn masked_fill_col[width: Int](col_idx: Int): if mask[channel_idx, row_idx, col_idx] != 0: new_matrix[channel_idx, row_idx, col_idx] = simd_value vectorize[masked_fill_col, 1, unroll_factor=1](self.dim2) parallelize[masked_fill_row](self.dim1, self.dim1) parallelize[masked_fill_channel](self.dim0, self.dim0) return new_matrix fn broadcast_channel(self, dim1: Int, dim2: Int) -> Self: if self.dim1 != 1 and self.dim2 != 1: print("Non-scalar matrix cannot be broadcasted. Returning null matrix") return Self(0, 0, 0) var new_matrix = Self(self.dim0, dim1, dim2) new_matrix *= 0 @parameter fn broadcast_channel(channel_idx: Int): @parameter fn broadcast_row(row_idx: Int): @parameter fn broadcast_col[width: Int](col_idx: Int): new_matrix[channel_idx, row_idx, col_idx] = self[channel_idx, 0, 0] vectorize[broadcast_col, 1, unroll_factor=1](dim2) parallelize[broadcast_row](dim1, dim1) parallelize[broadcast_channel](self.dim0, self.dim0) return new_matrix fn print(self, prec: Int = 4) -> None: var dim0: Int = self.dim0 var dim1: Int = self.dim1 var dim2: Int = self.dim2 var val: SIMD[dtype, 1] = 0.0 if dim0 == 1 and dim1 == 1 and dim2 == 1: print(self[0, 0, 0]) return if dim0 > 0 and dim1 > 0 and dim2 > 0: for i in range(dim0): for j in range(dim1): if j == 0: print("\n[\n", end="") else: print("\n", end="") print(" [", end="") for k in range(dim2): val = self[i, j, k] var int_str: String if val > 0 or val == 0: int_str = String(trunc(val).cast[DType.int32]()) else: int_str = "-" + String(trunc(val).cast[DType.int32]()) val = -val var float_str: String float_str = String(mod(val, 1)) var s = int_str + "." + float_str[2 : prec + 2] if k == 0: print(s, end="") else: print(" ", s,end="") print("]", end="") print("\n]\n", end="") print() print( " Matrix:", self.dim0, "x", self.dim1, "x", self.dim2, ",", "DType:", dtype.__str__(), ) print() struct Conv2D: var out_channels: Int var in_channels: Int var kernel_size: Int var padding: Tuple[Int, Int] var stride: Tuple[Int, Int] var bias:Tensor[float_dtype] var kernel: Matrix_Array[float_dtype] fn __init__( inout self, in_channels: Int, out_channels: Int, kernel_size: Int, padding: Tuple[Int, Int] = (0, 0), stride: Tuple[Int, Int] = (1, 1), ) -> None: self.out_channels = out_channels self.in_channels = in_channels self.kernel_size = kernel_size self.padding = padding self.stride = stride #### LEARNABLE PARAMETERS self.bias = Tensor[float_dtype](out_channels) self.kernel = Matrix_Array[float_dtype](out_channels, (in_channels, kernel_size, kernel_size)) @parameter fn init_kernel_fn(out_channel_idx: Int): var curr_matrix = Matrix[float_dtype](self.in_channels, self.kernel_size, self.kernel_size) var k = (self.in_channels * self.kernel_size * self.kernel_size) var inv_k = math.rsqrt[float_dtype, 1](k) curr_matrix.init_weights(-inv_k, inv_k) self.kernel[out_channel_idx] = curr_matrix parallelize[init_kernel_fn](self.out_channels, self.out_channels) #### fn __copyinit__(inout self, other: Self) -> None: self.out_channels = other.out_channels self.in_channels = other.in_channels self.kernel_size = other.kernel_size self.padding = other.padding self.stride = other.stride self.bias = other.bias self.kernel = other.kernel fn forward( self, matrix: Matrix[float_dtype], ) -> Matrix[float_dtype]: var conv_matrix = matrix var padding_height = Tuple.get[0, Int](self.padding) var padding_width = Tuple.get[1, Int](self.padding) if Tuple.get[0, Int](self.padding) != 0 or Tuple.get[1, Int](self.padding) != 0: conv_matrix = conv_matrix.pad((padding_height, padding_height), (padding_width, padding_width)) var height = conv_matrix.dim1 var width = conv_matrix.dim2 var stride_y = Tuple.get[0, Int](self.stride) var stride_x = Tuple.get[1, Int](self.stride) var final_height = math.floor( (height - self.kernel_size) / stride_y + 1 ).to_int() var final_width = math.floor( (width - self.kernel_size) / stride_x + 1 ).to_int() var output = Matrix[float_dtype](self.out_channels, final_height, final_width) @parameter fn channel_fn(out_channel_idx: Int): var kernel_channel = self.kernel[out_channel_idx] @parameter fn convolution_fn[stride_x: Int, stride_y: Int](x: Int, y: Int): var x_out = x // stride_x var y_out = y // stride_y var convolution_sum = SIMD[float_dtype, 1].splat(0.0) for in_channel_idx in range(self.in_channels): var convolution_region = conv_matrix[ in_channel_idx, y : y + self.kernel_size, x : x + self.kernel_size, ] var kernel_region = kernel_channel[in_channel_idx,:,:] var elementwise_mult = convolution_region.multiply(kernel_channel[in_channel_idx,:,:]).sum() convolution_sum += elementwise_mult output[out_channel_idx, y_out, x_out] = convolution_sum + self.bias[out_channel_idx] var end_x = width - self.kernel_size + 1 var end_y = height - self.kernel_size + 1 # Here, we use these annoying if statements because the tiling function does not support dynamic values. Nonetheless, tiling gives a huge performance boost. if stride_x == 1 and stride_y == 1: tile_2d[convolution_fn, 1, 1](end_x, end_y) elif stride_x == 1 and stride_y == 0: tile_2d[convolution_fn, 1, 0](end_x, end_y) elif stride_x == 0 and stride_y == 1: tile_2d[convolution_fn, 0, 1](end_x, end_y) elif stride_x == 0 and stride_y == 0: tile_2d[convolution_fn, 0, 0](end_x, end_y) elif stride_x == 1 and stride_y == 2: tile_2d[convolution_fn, 1, 2](end_x, end_y) elif stride_x == 2 and stride_y == 1: tile_2d[convolution_fn, 2, 1](end_x, end_y) elif stride_x == 2 and stride_y == 2: tile_2d[convolution_fn, 2, 2](end_x, end_y) elif stride_x == 2 and stride_y == 0: tile_2d[convolution_fn, 2, 0](end_x, end_y) elif stride_x == 0 and stride_y == 2: tile_2d[convolution_fn, 0, 2](end_x, end_y) elif stride_x == 0 and stride_y == 0: tile_2d[convolution_fn, 0, 0](end_x, end_y) parallelize[channel_fn](self.out_channels, self.out_channels) return output struct GroupNorm: var num_groups: Int var num_channels: Int var channels_per_group: Int var epsilon: float_base var gamma: float_base var beta: float_base fn __init__( inout self, num_groups: Int, num_channels: Int, epsilon: float_base = 1e-5, ) -> None: self.num_groups = num_groups self.num_channels = num_channels self.channels_per_group = math.floor(num_channels / num_groups).to_int() self.epsilon = epsilon ### LEARNABLE PARAMETERS self.gamma = 1.0 self.beta = 0.0 ### fn __copyinit__(inout self, other: Self) -> None: self.num_groups = other.num_groups self.num_channels = other.num_channels self.channels_per_group = other.channels_per_group self.epsilon = other.epsilon self.gamma = other.gamma self.beta = other.beta fn forward(self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: var output = Matrix[float_dtype](x.dim0, x.dim1, x.dim2) if self.num_channels > x.dim0: print("Number of channels exceeds the number of channels in the input matrix. Returning null matrix") return Matrix[float_dtype](0, 0, 0) if self.num_channels % self.num_groups != 0: print("Number of channels does not evenly divide the number of groups. Returning null matrix") return Matrix[float_dtype](0, 0, 0) @parameter fn channel_fn(i: Int): var channels_group = x[ i * self.channels_per_group : (i + 1) * self.channels_per_group, :,: ] var mean = channels_group.mean() var std = channels_group.std() @parameter fn channels_per_group_fn(m: Int): @parameter fn compute_element[simd_width: Int](index: Int): var channels_index = m * x.dim1 * x.dim2 + index var curr_el = channels_group._data.load[width=simd_width](channels_index) var el_normalized = (curr_el - mean) / ( std + self.epsilon ) * self.gamma var out_index = i * self.channels_per_group * x.dim1 * x.dim2 + m * x.dim1 * x.dim2 + index output._data.store[width=simd_width](out_index, el_normalized) vectorize[compute_element, simd_width, unroll_factor=simd_width](x.dim1 * x.dim2) parallelize[channels_per_group_fn](self.channels_per_group, self.channels_per_group) parallelize[channel_fn](self.num_groups, self.num_groups) return output struct SiLU: fn __init__(inout self) -> None: pass fn forward(self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: var matrix = x @parameter fn vec_sigmoid[simd_width: Int](idx: Int) -> None: var x_idx = x._data.load[width=simd_width](idx) matrix._data.store[width=simd_width](idx, x_idx / (1 + math.exp(-x_idx))) vectorize[vec_sigmoid, simd_width, unroll_factor=simd_width](matrix.size().to_int()) return matrix struct Gelu: fn __init__(inout self) -> None: pass fn forward(self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: var matrix = x @parameter fn vec_gelu[simd_width: Int](idx: Int) -> None: var x_idx = x._data.load[width=simd_width](idx) var cdf = 0.5 * (1 + math.tanh((math.sqrt[float_dtype, 1](2 / pi) * (x_idx + 0.044715 * x_idx ** 3)))) matrix._data.store[width=simd_width](idx, x_idx * cdf) vectorize[vec_gelu, simd_width, unroll_factor=simd_width](matrix.size().to_int()) return matrix struct Linear: var in_features: Int var out_features: Int var bias: Matrix[float_dtype] var weight: Matrix[float_dtype] var use_bias: Bool fn __init__( inout self, in_features: Int, out_features: Int, use_bias : Bool = True, ) -> None: self.in_features = in_features self.out_features = out_features self.use_bias = use_bias ### LEARNABLE PARAMETERS: bias and weight self.bias = Matrix[float_dtype](1, 1, out_features) var k = math.sqrt(self.in_features) var inv_k = math.rsqrt[float_dtype, 1](k) self.bias.init_weights(-inv_k, inv_k) self.weight = Matrix[float_dtype](1, out_features, in_features) self.weight.init_weights(-inv_k, inv_k) ### fn __copyinit__(inout self, other: Self) -> None: self.in_features = other.in_features self.out_features = other.out_features self.bias = other.bias self.weight = other.weight self.use_bias = other.use_bias fn forward(inout self, inout x: Matrix[float_dtype]) -> Matrix[float_dtype]: if x.dim2 != self.in_features: print("Invalid input dimensions for Linear layer. Returning null matrix") return Matrix[float_dtype](0, 0, 0) var output = x.matmul(self.weight.transpose(1,2)) if self.use_bias: var bias_matrix = Matrix[float_dtype](output.dim0, output.dim1, output.dim2) # Setting bias vectors in the same column to the same value @parameter fn channel_fn(i: Int): @parameter fn col_fn[width: Int](j: Int): bias_matrix.set_items(i, Slice(0, bias_matrix.dim1), j, self.bias[0, 0, j]) vectorize[col_fn, 1, unroll_factor=1]( bias_matrix.dim1) parallelize[channel_fn](output.dim0, output.dim0) output = output + bias_matrix return output struct Upsample: var scale_factor: Int fn __init__(inout self, scale_factor:Int=1) -> None: if scale_factor < 1: print("Invalid scale factor for upsampling!") self.scale_factor = scale_factor fn __copyinit__(inout self, other: Self) -> None: self.scale_factor = other.scale_factor fn forward(self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: if self.scale_factor < 1: print("Invalid scale factor for upsampling. Returning null matrix") return Matrix[float_dtype](0, 0, 0) var new_channels = x.dim0 * self.scale_factor var output = Matrix[float_dtype](new_channels, x.dim1, x.dim2) @parameter fn channel_fn(i: Int): @parameter fn row_fn(j: Int): @parameter fn col_fn[simd_width: Int](k: Int): var val = x.load[1](i // self.scale_factor, j, k) output.store[1](i, j, k, val) vectorize[col_fn, 1, unroll_factor=1](x.dim2) parallelize[row_fn](x.dim1, x.dim1) return output struct Embedding: var n_vocab: Int var n_embed: Int var weight: Matrix[float_dtype] fn __init__(inout self, n_vocab: Int, n_embed: Int) -> None: self.n_vocab = n_vocab self.n_embed = n_embed ## LEARNABLE PARAMETER: Weight self.weight = Matrix[float_dtype](1, n_vocab, n_embed) self.weight.init_weights_normal(0, 1) fn __copyinit__(inout self, other: Self) -> None: self.n_vocab = other.n_vocab self.n_embed = other.n_embed self.weight = other.weight fn forward(self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: var out = Matrix[float_dtype](1, x.dim2, self.n_embed) @parameter fn channel_fn(channel_idx: Int): @parameter fn row_fn(row_idx: Int): @parameter fn col_fn[width: Int](col_idx: Int): var idx = int(x[channel_idx, row_idx, col_idx]) var weight_value = self.weight[0, idx, Slice(0, self.n_embed)] out.set_items(channel_idx, row_idx, Slice(col_idx * self.n_embed, (col_idx + 1) * self.n_embed), weight_value) vectorize[col_fn, 1, unroll_factor=1](self.n_embed) parallelize[row_fn](x.dim2, x.dim2) parallelize[channel_fn](1, 1) return out fn print(self) -> None: self.weight.print() struct LayerNorm: var group_norm: GroupNorm fn __init__(inout self, n_embed: Int) -> None: self.group_norm = GroupNorm(1, n_embed) fn __copyinit__(inout self, other: Self) -> None: self.group_norm = other.group_norm fn forward(self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: return self.group_norm.forward(x) --- pipeline.mojo --- from helpers.utils import * from clip import CLIP from vae import Encoder, Decoder from diffusion import Diffusion from sampler import DDPMSampler # Image width / height. Make sure it is a multiple of 8! Here, we assume a square image alias image_size = 8 # We set the number of inference steps to 1, as we only want to do a single forward pass. Typical values would be around 50 # Also, this runs on a batch size of 1 (like in stochastic gradient descent. To use the same code but with a higher batch size, create a Matrix_Array struct (available in utils.mojo) and parallelize the generate() code for all its elements. fn generate( prompt: String, backup_prompt: String = "", strength: Float32 = 0.8, cfg: Bool = True, cfg_scale: Float32 = 7.5, inference_steps: Int = 1, seed_val: Int = 0, input_image: Matrix[float_dtype] = Matrix[float_dtype](0, 0, 0), ) -> Matrix[float_dtype]: if ( not SIMD[DType.float32, 1].splat(0.0) <= strength <= SIMD[DType.float32, 1].splat(1.0) ): print("Strength must be between 0 and 1. Returning empty matrix") return Matrix[float_dtype](0, 0, 0) var clip = CLIP() var tokenizer_ref = StringRef("tokenizer_clip.bin") var tokenizer_buffer = FileBuf() read_file(tokenizer_ref, tokenizer_buffer) # Using a vocab size of 49408, since we rely on the CLIP Tokenizer var tokenizer = Tokenizer(49408, tokenizer_buffer) var context: Matrix[float_dtype] var processed_prompt = prompt.replace(" ", "</w>") var processed_backup = backup_prompt.replace(" ", "</w>") if cfg: var prompt_tokens = List[Int]() var cond_tokens_vector = bpe_encode(processed_prompt, tokenizer) var cond_tokens = vector_to_matrix(cond_tokens_vector) var cond_context = clip.forward(cond_tokens) var backup_tokens_vector = bpe_encode(processed_backup, tokenizer) var backup_tokens = vector_to_matrix(backup_tokens_vector) var backup_context = clip.forward(backup_tokens) context = cond_context.concat(backup_context, dim=0) else: var tokens_vector = bpe_encode(processed_prompt, tokenizer) var tokens = vector_to_matrix(tokens_vector) context = clip.forward(tokens) print("CLIP forward pass concluded") var sampler = DDPMSampler(seed_val) sampler.set_inference_timesteps(inference_steps) var latents_shape = (4, image_size // 8, image_size // 8) var latents = Matrix[float_dtype]( Tuple.get[0, Int](latents_shape), Tuple.get[1, Int](latents_shape), Tuple.get[2, Int](latents_shape), ) if input_image.size() > 0: var encoder = Encoder() print("Encoder instance created") var resized_input = resize_image(input_image, image_size, image_size) var rescaled_input = resized_input.rescale((0, 255), (-1, 1)) var encoder_noise = Matrix[float_dtype]( Tuple.get[0, Int](latents_shape), Tuple.get[1, Int](latents_shape), Tuple.get[2, Int](latents_shape), ) encoder_noise.init_weights_seed(seed_val) latents = encoder.forward(rescaled_input, encoder_noise) sampler.set_strength(strength) latents = sampler.add_noise(latents, sampler.timesteps[0]) else: latents.init_weights_seed(seed_val) var diffusion = Diffusion() print("Diffusion instance created") var num_timesteps = sampler.timesteps.num_elements() for i in range(num_timesteps): var timestep = sampler.timesteps[i] var time_embedding = get_time_embedding(timestep) var model_input = latents var model_output: Matrix[float_dtype] if not cfg: model_output = diffusion.forward(model_input, context, time_embedding) else: # Due to a current mojo limitation, I am currently unable to run this parallelized code, so I am using the sequential approach below. # Hopefully Mojo will support non-embarassingly-parallel tasks soon. # @parameter # fn parallel_diffusion(idx: Int): # if idx == 0: # model_output1 = diffusion.forward(model_input, context, time_embedding) # else: # model_output2 = diffusion.forward(model_input, context, time_embedding) # parallelize[parallel_diffusion](2, 2) var model_output1 = diffusion.forward(model_input, context, time_embedding) var model_output2 = diffusion.forward(model_input, context, time_embedding) model_output = model_output1.concat(model_output2, dim=0) var chunked_output = model_output.chunk(0, 2) var conditional_output = chunked_output[0] var backup_output = chunked_output[1] var cfg_scale_f32 = SIMD[DType.float32, 1].splat( cfg_scale.cast[DType.float32]() ) model_output = ( conditional_output - backup_output ) * cfg_scale_f32 + backup_output latents = sampler.step(int(timestep), latents, model_output) print("Timestep", i, "concluded") var decoder = Decoder() var images = decoder.forward(latents) print("Decoder forward pass concluded") images = images.rescale((-1, 1), (0, 255), clamp=True) return images --- sampler.mojo --- from helpers.utils import * from math import round struct DDPMSampler: var seed_val: Int var num_training_steps: Int var betas: Tensor[float_dtype] var alphas: Tensor[float_dtype] var alphas_cumprod: Tensor[float_dtype] var timesteps: Tensor[float_dtype] var num_inference_steps: Int var start_step: Int fn __init__( inout self, seed_val: Int = 0, # Setting this to 10 for illustrative purposes, since we are not interested in training. Typical values would be around 1000 num_training_steps: Int = 10, beta_start: Float32 = 0.00085, beta_end: Float32 = 0.0120, ): # Setting this to 1 since I am intersted in demonstrating a single forward pass self.num_inference_steps = 1 self.start_step = 0 self.seed_val = seed_val self.num_training_steps = num_training_steps self.betas = ( linspace(beta_start**0.5, beta_end**0.5, num_training_steps) ** 2 ) self.alphas = 1.0 - self.betas self.alphas_cumprod = cumprod(self.alphas) self.timesteps = arange(0, num_training_steps, True) fn set_inference_timesteps( inout self, num_inference_steps: Int = 1, ): self.num_inference_steps = num_inference_steps var step_ratio: Float32 = self.num_training_steps // self.num_inference_steps var timesteps = round_tensor( arange(0, self.num_inference_steps, True) * step_ratio ) self.timesteps = timesteps fn get_previous_timestep( inout self, timestep: Int, ) -> Int: var prev_t = timestep - self.num_training_steps // self.num_inference_steps return prev_t fn get_variance( inout self, timestep: Int, ) -> Float32: var prev_t = self.get_previous_timestep(timestep) var alpha_prod_t = self.alphas_cumprod[timestep] var alpha_prod_t_prev = self.alphas_cumprod[prev_t] if prev_t >= 0 else 1 var current_beta_t = 1 - alpha_prod_t / alpha_prod_t_prev var variance = (1 - alpha_prod_t_prev) / (1 - alpha_prod_t) * current_beta_t # Preventing zero values variance = variance.max(1e-20) return variance[0] fn set_strength(inout self, strength: Float32): var start_step = self.num_inference_steps - int( self.num_inference_steps * strength ) var timesteps_length = self.timesteps.num_elements() self.timesteps = get_tensor_values(self.timesteps, start_step, start_step + timesteps_length) self.start_step = start_step fn step( inout self, timestep: Int, latents: Matrix[float_dtype], model_output: Matrix[float_dtype], ) -> Matrix[float_dtype]: var prev_t = self.get_previous_timestep(timestep) var alpha_prod = self.alphas_cumprod[timestep] var alpha_prod_prev = self.alphas_cumprod[prev_t] if prev_t >= 0 else 1 var beta_prod = 1 - alpha_prod var beta_prod_prev = 1 - alpha_prod_prev var current_alpha = alpha_prod / alpha_prod_prev var current_beta = 1 - current_alpha var alpha_prod_final = alpha_prod[0] var beta_prod_final = beta_prod[0] var pred_original_sample = ( latents - (model_output) * (beta_prod_final ** (0.5)) ) / (alpha_prod_final ** (0.5)) var pred_original_sample_coefficient: Float32 = ( alpha_prod_prev ** (0.5) * current_beta ) / beta_prod var current_sample_coefficient = current_alpha ** ( 0.5 ) * beta_prod_prev / beta_prod var pred_previous_sample = pred_original_sample * pred_original_sample_coefficient + latents * current_sample_coefficient if timestep > 0: var noise = Matrix[float_dtype]( model_output.dim0, model_output.dim1, model_output.dim2 ) noise.init_weights_seed(self.seed_val) var multiplier = (self.get_variance(timestep) ** 0.5) var variance = noise * multiplier pred_previous_sample = pred_previous_sample + variance return pred_previous_sample fn add_noise( inout self, original_samples: Matrix[float_dtype], timestep: Float32 ) -> Matrix[float_dtype]: var int_timestep = int(timestep) var sqrt_alpha_prod = self.alphas_cumprod[int_timestep] ** 0.5 var sqrt_alpha_prod_scalar = sqrt_alpha_prod[0] var sqrt_one_minus_alpha_prod = (1 - self.alphas_cumprod[int_timestep]) ** 0.5 var sqrt_one_minus_alpha_prod_scalar = sqrt_one_minus_alpha_prod[0] var noise = Matrix[float_dtype]( original_samples.dim0, original_samples.dim1, original_samples.dim2 ) noise.init_weights_seed(self.seed_val) var noisy_samples = original_samples * sqrt_alpha_prod_scalar + noise * sqrt_one_minus_alpha_prod_scalar return noisy_samples --- tokenizer_creation.py --- from transformers import CLIPTokenizerFast from collections import Counter import json, struct, os # Initialize the CLIP tokenizer if not os.path.exists("clip_tokenizer"): clip_tokenizer = CLIPTokenizerFast.from_pretrained("openai/clip-vit-base-patch32") clip_tokenizer.save_pretrained("clip_tokenizer") print("Tokenizer saved to clip_tokenizer") else: clip_tokenizer = CLIPTokenizerFast.from_pretrained("clip_tokenizer") print("Tokenizer loaded from clip_tokenizer") # Compute scores, convert to .bin in_file = "clip_tokenizer/tokenizer.json" out_file = "tokenizer_clip.bin" start_id = "<|startoftext|>" end_id = "<|endoftext|>" if __name__ == "__main__": with open(in_file, "r") as json_file: data = json.load(json_file) merges = data["model"]["merges"] data = data["model"]["vocab"] tokens = [] scores = [] for key in data.keys(): processed_k = key if processed_k == start_id: processed_k = "\n<s>\n" elif processed_k == end_id: processed_k = "\n</s>\n" processed_k = processed_k.encode("utf-8") tokens.append(processed_k) # The token score is the frequency of the token in the "merges" dataset key_score = 0.0 for merge in merges: key_score += merge.count(key) scores.append(key_score) # This section was taken from Karpathy's implementation of Llama2 in C: https://github.com/karpathy/llama2.c/blob/master/tokenizer.py max_token_length = max(len(k) for k in tokens) with open(out_file, "wb") as f: f.write(struct.pack("I", max_token_length)) for bytes, score in zip(tokens, scores): f.write(struct.pack("fI", score, len(bytes))) f.write(bytes) print(f"Mappings saved to {out_file}") --- vae.mojo --- from helpers.utils import * from helpers.attention import * struct Attention_Block: var group_norm: GroupNorm var attention: Self_Attention fn __init__(inout self, channels: Int): self.group_norm = GroupNorm(32, channels) self.attention = Self_Attention(1, channels) fn __copyinit__(inout self, other: Self): self.group_norm = other.group_norm self.attention = other.attention fn forward(inout self, inout x: Matrix[float_dtype]) -> Matrix[float_dtype]: var residue = x var out = self.group_norm.forward(x) out = out.reshape(x.dim0, x.dim1 * x.dim2, 1) out = out.transpose(0, 2) out = self.attention.forward(out) out = out.transpose(1, 2) out = out.reshape(x.dim0, x.dim1, x.dim2) out = out + residue return out struct Res_Block: var in_channels: Int var out_channels: Int var group_norm1: GroupNorm var group_norm2: GroupNorm var conv1: Conv2D var conv2: Conv2D var res_conv_layer: Conv2D fn __init__(inout self, in_channels: Int, out_channels: Int): self.in_channels = in_channels self.out_channels = out_channels self.group_norm1 = GroupNorm(16, in_channels) self.group_norm2 = GroupNorm(16, out_channels) self.conv1 = Conv2D(in_channels, out_channels, kernel_size=3, padding=(1, 1)) self.conv2 = Conv2D(out_channels, out_channels, kernel_size=3, padding=(1, 1)) self.res_conv_layer = Conv2D(in_channels, out_channels, kernel_size=1) fn __copyinit__(inout self, other: Self): self.in_channels = other.in_channels self.out_channels = other.out_channels self.group_norm1 = other.group_norm1 self.group_norm2 = other.group_norm2 self.conv1 = other.conv1 self.conv2 = other.conv2 self.res_conv_layer = other.res_conv_layer fn forward(self, inout x: Matrix[float_dtype]) -> Matrix[float_dtype]: var residue = x var out = self.group_norm1.forward(x) out = SiLU().forward(out) out = self.conv1.forward(out) out = self.group_norm2.forward(out) out = SiLU().forward(out) out = self.conv2.forward(out) if self.in_channels != self.out_channels: residue = self.res_conv_layer.forward(residue) return out + residue struct Encoder: var l1: Conv2D var l2: Res_Block var l3: Res_Block var l4: Conv2D var l5: Res_Block var l6: Res_Block var l7: Conv2D var l8: Res_Block var l9: Res_Block var l10: Conv2D var l11: Res_Block var l12: Res_Block var l13: Res_Block var l14: Attention_Block var l15: Res_Block var l16: GroupNorm var l17: SiLU var l18: Conv2D var l19: Conv2D fn __init__( inout self, ): self.l1 = Conv2D(3, 128, kernel_size=3, padding=(1, 1)) self.l2 = Res_Block(128, 128) self.l3 = Res_Block(128, 128) self.l4 = Conv2D(128, 128, kernel_size=3, stride=(2, 2), padding=(0, 0)) self.l5 = Res_Block(128, 256) self.l6 = Res_Block(256, 256) self.l7 = Conv2D(256, 256, kernel_size=3, stride=(2, 2), padding=(0, 0)) self.l8 = Res_Block(256, 512) self.l9 = Res_Block(512, 512) self.l10 = Conv2D(512, 512, kernel_size=3, stride=(2, 2), padding=(0, 0)) self.l11 = Res_Block(512, 512) self.l12 = Res_Block(512, 512) self.l13 = Res_Block(512, 512) self.l14 = Attention_Block(512) self.l15 = Res_Block(512, 512) self.l16 = GroupNorm(32, 512) self.l17 = SiLU() self.l18 = Conv2D(512, 8, kernel_size=3, padding=(1,1)) self.l19 = Conv2D(8, 8, kernel_size=1, padding=(0,0)) fn two_stride_pad(self, matrix: Matrix[float_dtype]) -> Matrix[float_dtype]: return matrix.pad((0, 1), (0, 1)) fn metrics_evals( self, matrix: Matrix[float_dtype], noise: Matrix[float_dtype] ) -> Matrix[float_dtype]: var chunks = matrix.chunk(0, 2) var mean = chunks[0] var log_variance = chunks[1] log_variance = log_variance.clamp(-30, 20) var variance = log_variance.exp() var std = variance.sqrt() var out = mean + (noise.multiply(std)) out *= 0.18215 return out fn forward( inout self, x: Matrix[float_dtype], noise: Matrix[float_dtype] ) -> Matrix[float_dtype]: var out = x out = self.l1.forward(x) out = self.l2.forward(out) out = self.l3.forward(out) out = self.two_stride_pad(out) out = self.l4.forward(out) out = self.l5.forward(out) out = self.l6.forward(out) out = self.two_stride_pad(out) out = self.l7.forward(out) out = self.l8.forward(out) out = self.l9.forward(out) out = self.two_stride_pad(out) out = self.l10.forward(out) out = self.l11.forward(out) out = self.l12.forward(out) out = self.l13.forward(out) out = self.l14.forward(out) out = self.l15.forward(out) out = self.l16.forward(out) out = self.l17.forward(out) out = self.l18.forward(out) out = self.l19.forward(out) out = self.metrics_evals(out, noise) return out struct Decoder: var l1: Conv2D var l2: Conv2D var l3: Res_Block var l4: Attention_Block var l5: Res_Block var l6: Res_Block var l7: Res_Block var l8: Res_Block var l9: Upsample var l10: Conv2D var l11: Res_Block var l12: Res_Block var l13: Res_Block var l14: Upsample var l15: Conv2D var l16: Res_Block var l17: Res_Block var l18: Res_Block var l19: Upsample var l20: Conv2D var l21: Res_Block var l22: Res_Block var l23: Res_Block var l24: GroupNorm var l25: SiLU var l26: Conv2D fn __init__( inout self, ): self.l1 = Conv2D(4, 4, kernel_size=1, padding=(0, 0)) self.l2 = Conv2D(4, 512, kernel_size=3, padding=(1, 1)) self.l3 = Res_Block(512, 512) self.l4 = Attention_Block(512) self.l5 = Res_Block(512, 512) self.l6 = Res_Block(512, 512) self.l7 = Res_Block(512, 512) self.l8 = Res_Block(512, 512) self.l9 = Upsample(2) self.l10 = Conv2D(512, 512, kernel_size=3, padding=(1, 1)) self.l11 = Res_Block(512, 512) self.l12 = Res_Block(512, 512) self.l13 = Res_Block(512, 512) self.l14 = Upsample(2) self.l15 = Conv2D(512, 512, kernel_size=3, padding=(1, 1)) self.l16 = Res_Block(512, 256) self.l17 = Res_Block(256, 256) self.l18 = Res_Block(256, 256) self.l19 = Upsample(2) self.l20 = Conv2D(256, 256, kernel_size=3, padding=(1, 1)) self.l21 = Res_Block(256, 128) self.l22 = Res_Block(128, 128) self.l23 = Res_Block(128, 128) self.l24 = GroupNorm(32, 128) self.l25 = SiLU() self.l26 = Conv2D(128, 3, kernel_size=3, padding=(1, 1)) fn forward(inout self, x: Matrix[float_dtype]) -> Matrix[float_dtype]: var out = x / 0.18215 out = self.l1.forward(out) out = self.l2.forward(out) out = self.l3.forward(out) out = self.l4.forward(out) out = self.l5.forward(out) out = self.l6.forward(out) out = self.l7.forward(out) out = self.l8.forward(out) out = self.l9.forward(out) out = self.l10.forward(out) out = self.l11.forward(out) out = self.l12.forward(out) out = self.l13.forward(out) out = self.l14.forward(out) out = self.l15.forward(out) out = self.l16.forward(out) out = self.l17.forward(out) out = self.l18.forward(out) out = self.l19.forward(out) out = self.l20.forward(out) out = self.l21.forward(out) out = self.l22.forward(out) out = self.l23.forward(out) out = self.l24.forward(out) out = self.l25.forward(out) out = self.l26.forward(out) return out URL: https://ruhati.net/mojo/ # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - Dedication - Introduction - Getting started - Functions - Constants and variables - Types - Documenting your code - Struct - Trait - Control flow - Error handling - Operators and special methods - Lifecycle and ownership - Parameters and compile-time programming - Advanced usage of functions - Python interoperability - MLIR interoperability - About the author - Revision History Dedication Introduction Getting started Functions Constants and variables Types Documenting your code Struct Trait Control flow Error handling Operators and special methods Lifecycle and ownership Parameters and compile-time programming Advanced usage of functions Python interoperability MLIR interoperability About the author Revision History Next: Dedication → ================================================================================ URL: https://ruhati.net/mojo/index.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - Dedication - Introduction - Getting started - Functions - Constants and variables - Types - Documenting your code - Struct - Trait - Control flow - Error handling - Operators and special methods - Lifecycle and ownership - Parameters and compile-time programming - Advanced usage of functions - Python interoperability - MLIR interoperability - About the author - Revision History Dedication Introduction Getting started Functions Constants and variables Types Documenting your code Struct Trait Control flow Error handling Operators and special methods Lifecycle and ownership Parameters and compile-time programming Advanced usage of functions Python interoperability MLIR interoperability About the author Revision History Next: Dedication → ================================================================================ URL: https://ruhati.net/mojo/_dedication.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History ## Dedication To my family, for their constant and unfailing love and support. ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Introduction → ================================================================================ URL: https://ruhati.net/mojo/_introduction.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History ## 1. Introduction The Mojo programming language was announced by the company Modular on May 2023. It was positioned as a language to build AI programs. However, the language they built was a much more powerful general purpose language. Mojo was designed from the start to be a super set of Python which was already entrenched deep in the domain of machine learning and AI. Python has over the many years built up a reputation of being one of the most easiest language for beginners to learn programming. Mojo having built up on the shoulders of this giant, offers an easy to use language with capabilities that challenge even the most powerful system languages such as C, C++ and Rust. Mojo is built on top of MLIR, a reusable and extensible compiler infrastructure. This allowed team to benefit from multi-years of efforts already spent on MLIR. Mojo exposes ability to embed MLIR within its own programs, enabling much deeper optimizations. The design choices such as these allow Mojo to be used to build operating systems and device drivers where close interaction with hardware and high performance is necessary. The high level Python syntax, static and dynamic typing support, and the extensive Mojo standard library allows also developers to build enterprise software as easy as building a Python application. In effect, Mojo is able to support a very wide range of programming domains, ranging from operating systems up to enterprise Web applications. Mojo programming language is still under heavy development. Some of the chapters may get obsolete whenever there are changes to Mojo itself. Additionally, some chapters may seem incomplete, but that is because I am waiting for the implementation of that particular feature to be completed before I document it (e.g. Dictionary Literals). I try to keep track of the developments as close as possible and I try to update the book accordingly. However, I do have other commitments, and therefore may not get updated as fast I wish. Thanks for your patience. ← Previous: Dedication | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Getting started → ================================================================================ URL: https://ruhati.net/mojo/_getting_started.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started 2.1. Getting Mojo 2.2. Hello World 2.3. Dissecting the program 2.4. Compiler - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler ## 2. Getting started ### 2.1. Getting Mojo ### 2.2. Hello World It is a time honored tradition to start learning a programming language with a program printing "Hello, World!". Let’s start with that. Please open a text editor of your choice and type the following and save the file as hello_world.mojo. The name of the file does not matter as long as you pass the same file to the compiler. ```mojo def main(): print("Hello, World!") ``` Now open a command line program and enter the following in its terminal. mojo hello_world.mojo You should see the following in the terminal. ```mojo Hello, World! ``` Congrats! You have executed your first Mojo program! Mojo also supports file extension other than ".mojo". Instead of saving the file as hello_world.mojo, you can save it as hello_world.🔥 and run mojo hello_world.🔥. ### 2.3. Dissecting the program Unlike many other system languages, Mojo has very minimal ceremony to define a simple program like Hello World. The following line (known as a statement) calls a function named print which is provided by Mojo. The text Hello, World! is placed inside double quotes. Any text placed inside double quotes (or single quotes for that matter) is considered by Mojo as a String Literal. Literals are constant values that do not change during the execution of the program and are provided directly to the program source code. In this case, we pass the value "Hello, World!" to the function print. The print function knows how to take that passed value and to bring it into the screen. In the file, there is def main():, which you can ignore for the moment. It will come up later on. In a future release of Mojo, the need for def main(): will be gone. * ### 2.4. Compiler The command mojo hello_world.mojo you executed in the terminal took the Mojo source code and compiled it into a form that can be executed in the computer. The mojo command then directly executes the compiled form. If you do not want to execute immediately the program, and just want to create an executable file, you can use the command mojo build hello_world.mojo. It then creates an executable file in the same directory as the source file. ← Previous: Introduction | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Functions → ================================================================================ URL: https://ruhati.net/mojo/_functions.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_constants_and_variables.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables 4.1. Constants 4.2. Variables 4.3. Alias 4.4. Undeclared variables 4.5. Variable scoping 4.6. Non-standard identifiers - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers ## 4. Constants and variables Sometimes you need to store a value before it can be used in a function. Mojo offers two ways to store a value for later use. One is the concept called a constant and the other one is variable. ### 4.1. Constants Suppose you have two functions, one that calculates circumference of a circle and the other that calculates the area of a circle. ```mojo def circumference(r): return 2 * 3.14 * r def area(r): return 3.14 * r * r def main(): print(circumference(25)) print(area(25)) ``` In the above example, the PI has been limited to 2 decimal places. What if we want to increase our precision and increase the PI to 4 decimal places? Then we need to change both the functions circumference and area. An alternative is to define PI as a constant using the keyword alias. ```mojo alias PI = 3.14 def circumference(r): return 2 * PI * r def area(r): return PI * r * r def main(): print(circumference(25)) print(area(25)) ``` The result of both the programs are the same. However, we have now defined PI in one single place and we can change its value in just one place and the updated value is reflected wherever the constant PI is referred. The main benefit of a constant is that the compiler prevents any attempt to change the initially assigned value during the program execution. ```mojo fn main(): alias counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` For example, executing the above program results in: ```mojo error: expression must be mutable in assignment counter = counter + 3 ^~~~~~~ mojo: error: failed to parse the provided Mojo ``` ### 4.2. Variables In contrast to the constants, values stored within variables are expected to change during the program execution. An example could be a counter which gets updated each time a user clicks a button. ```mojo fn main(): var counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` If you execute the above program, you would see the result: ```mojo 1 4 ``` The statement var counter: Int = 1 assigned the value 1 to the variable called counter. The keyword var declares that counter is a variable. The statement counter = counter + 3 adds value 3 to counter, resulting in value 4. You do not always need to initialize a variable with value. You can also just write var counter: Int and initialize its value later when needed. However, ensure that you initialize a variable before first use of that variable, otherwise you will encounter a compilation error. ```mojo fn main(): var counter: Int print(counter) counter = counter + 3 print(counter) ``` Results in: ```mojo error: use of uninitialized value 'counter' print(counter) ^ ``` The solution to above is to assign a value to counter before printing it. ### 4.3. Alias The alias feature provided by Mojo is much more powerful than just declaring constants. In fact, it enforces compile time execution of statements that come on the right hand side of the = symbol. ```mojo alias MY_VALUE = add(2, 3) fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(MY_VALUE) ``` In the code sample shown above, you see that Mojo allows compile time execution of a normal function. Executing the program results in the printing of the value 5 on screen. There are some restrictions on what type of functions can be called during compile time. For example, def style functions cannot be called during compile time. Another restriction is that function that are called during compile must not have any side effects. That is, the functions must use only the arguments passed to it and must not change any variables or state outside of the function body. These kind of functions are called pure functions. You can also assign types to alias as shown in the next example. ```mojo alias MyInt = Int fn add(a: MyInt, b: MyInt) -> MyInt: return a + b fn main(): print(add(1, 2)) ``` In the previous example, the MyInt is exactly the same as Int, just with a different name. ### 4.4. Undeclared variables Mojo allows variables to be defined without the var keyword. However, that works only within def functions. fn functions are strict regarding declaration of variables and require var keyword. ```mojo def main(): counter = 1 print(counter) counter = counter + 3 print(counter) ``` ### 4.5. Variable scoping Scoping of a variable means which part of the program sees what value of the variable, and whether or not the variable is even valid at that location. In Mojo functions, a variable can have either a lexical scope or the function scope. ```mojo def main(): x = 1 y = 1 if True: x = 4 print("inner x:", x) var y = 4 print("inner y:", y) print("outer x:", x) print("outer y:", y) ``` When you execute the code shown above (please ignore the warnings for the moment), you see: ```mojo inner x: 4 inner y: 4 outer x: 4 outer y: 1 ``` If you look carefully, the y declared inside the if block had two different values when printed. The inner block had value 4 and the outer block preserved its original value of 1. The x variable on the other hand got overwritten by newer value 4. What happened is that the inner scope from the if block declared a new variable using var keyword. This shadowed the outer variable declaration, resulting in inner scoped variable being different from the outer one, even though the name of the variable was the same. In case of x, no such re-declaration happened, so the scope of x was for the whole function. The var declaration caused y to be lexically scoped within the if block. ### 4.6. Non-standard identifiers As mentioned in the beginning of the book, Mojo is a superset of Python. However, there are Mojo keywords that are valid Python identifiers. Since Mojo aims to be compatible with Python, Mojo allows for such variables to be defined within backticks ``. In fact, any kind of text could be used as a variable or function name in Mojo if it is within backticks. ```mojo fn main(): var `var` : Int = 1 var `with space`: Int = 2 fn `with#symbol`() -> Int: return 3 print(`var`) print(`with space`) print(`with#symbol`()) ``` ← Previous: Functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Types → ================================================================================ URL: https://ruhati.net/mojo/_types.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_documenting_your_code.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code 6.1. Comments 6.2. Docstrings - 6.1. Comments - 6.2. Docstrings - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 6.1. Comments - 6.2. Docstrings ## 6. Documenting your code Many software that are built today have source code that are often made up of millions of lines of code. More often than not the software is also worked upon by a large number of programmers. Such large scale development makes it difficult to understand the program without some kind of documentation the describes what it does and why it does what it does. Mojo supports two ways of documenting code. ### 6.1. Comments You can define comments within Mojo source code using the symbol #. Mojo ignores any text that comes after the # until it encounters the end of line. Comments are meant for human consumption and typically explain the context of the code. Comments are discarded by the compiler and do therefore not have any run time presence. ```mojo # This is a comment my_function("Hello World!") # This is an inline comment ``` ### 6.2. Docstrings One of the important type of documentation is describing what a given function does. You can use Mojo comments for this purpose, but Mojo does not distinguish such comments from the ones that are given in other parts of the source code. Mojo does provide a facility to document functions (and other type of declarations). It is called Docstring. In a previous chapter it was mentioned that we can define multi line string literals in Mojo using three double or three single quotes. This type of string literals are used to define Docstring. One requirement for a multi line string literal to be a docstring of a function is that it should be scoped within the function. If it is outside the function, then it is considered to be documentation of the outer scope element. The other requirement is that it should be the first statement in the function body. The text of the multi line string must have at least one full stop. This is because the first sentence of the Docstring is considered as summary of the document and will show up in tooling as such. ```mojo fn my_function(text: StringLiteral): """ This is a doc string summary. And the second line represents more details. """ print(text) ``` You can pass the above program to Mojo’s documentation tooling to generate the documentation. ```mojo mojo doc <filename> ``` You can define file level docstring by writing docstring as the first statement of the file. Such docstring is used to document the module itself. ```mojo """ File level docstring. """ alias x = 42 fn main(): print(x) ``` ← Previous: Types | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Struct → ================================================================================ URL: https://ruhati.net/mojo/_struct.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct 7.1. Instance methods 7.2. Static methods 7.3. Implicit conversion - 7.1. Instance methods - 7.2. Static methods - 7.3. Implicit conversion - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 7.1. Instance methods - 7.2. Static methods - 7.3. Implicit conversion ## 7. Struct In the previous chapter we saw the different data types supported by Mojo out of the box. But what if you wanted to implement your own data type? Mojo provides struct keyword for that purpose. The term "struct" was popularized by the ALGOL family of languages and is a short form for the term structure. In Mojo, struct allows one to group related values together as a single unit. Members variables of a struct must have type annotation. ```mojo struct Person: var first_name: String var last_name: String fn __init__(inout self): self.first_name = "Mickey" self.last_name = "Mouse" fn get_full_name(self) -> String: return self.first_name + " " + self.last_name ``` The code shown before shows how a struct is defined within Mojo. You start with keyword struct and then give a name for the struct. Then you can define the member variables of the struct. Here we defined first_name and last_name strings. You can also define functions within a struct. Functions defined inside the body of a struct are known as "method". The body of the struct is indented with whitespace. You may have noticed that we have defined a method init. This is the initializer or in other languages known as the constructor. In order for a struct to be used in a program, we need to define a method that initializes the struct. The main responsibility of the initializer is to setup the struct in a valid state and to ensure that all the member variables also have a valid state. If we omit the initializer, the compiler would complain that init is missing. In the init method, the first argument is mandatory and it is named self by convention. It does not really matter whether you call the first argument self or some other name as Mojo would accept any other name. However, Mojo adopts the same convention as Python and calls the first argument self. It is highly recommended to follow that convention as it makes the code easier to read and understand by other programmers. The first argument also has a keyword inout. For init methods, it is mandatory to have inout keyword in front of the first self argument. It indicates to Mojo that the self is mutable reference. We will cover this later on in this book. To refer to the member variables of a strut, we need to prefix the variable with self.. Mojo allows new variables to be defined with the same names if the scope of the variable is different. The prefix self. makes it possible for the Mojo compiler to determine that the struct’s member variable is being referred to and not to another variable of the same name in the function scope. The anatomy of a struct is shown in the following diagram. Syntax to instantiate a struct is quite similar to a function call. In the following code listing an instance of Person is stored in the variable client. ```mojo var client: Person = Person() print(client.get_full_name()) ``` You can define initializers with additional arguments. You can also define more than one initializers. The initializers can be given arguments similar to how arguments are passed to a function. ```mojo struct Person: var first_name: String var last_name: String fn __init__(inout self): self.first_name = "Mickey" self.last_name = "Mouse" fn __init__(inout self, fname: String, lname: String): # Second initializer self.first_name = fname self.last_name = lname fn get_full_name(self) -> String: # Instance method return self.first_name + " " + self.last_name fn main(): var client: Person = Person("Donald", "Duck") # Instantiating Person print(client.get_full_name()) # Calling an instance method ``` ### 7.1. Instance methods As mentioned earlier, a struct can define methods within it. There are two types of methods. One is instance method and the other is static method. Instance methods are called on an instance of the struct. In the previous code listing, get_full_name is an instance method because it the first argument self which is the instance of the struct. It uses self to refer to the instance variables of the struct, for example self.first_name. To call the instance method, we used the syntax client.get_full_name(). Note that even though get_full_name had an argument self passed to it, we do not pass that argument to get_full_name when we call it. What is happening here? One way to look at it is that when we call client.get_full_name(), behind the scene the compiler passes client as the first argument to get_full_name. This syntax is quite popular in many object oriented languages, and since Python has this syntax, Mojo also took it over. ### 7.2. Static methods What if we do not have to refer to instance variables or even other instance methods in our method, but still want to have the method scoped within the struct? In this case Mojo offers static methods. Static methods are very similar to functions and they are within the scope of the struct, but not bound to a particular instance of the struct. Mojo compiler can perform some optimizations to make static method invocations much faster than instance methods. ```mojo struct Vehicle: var model_name: String fn __init__(inout self, model_name: String): self.model_name = model_name fn get_model(self) -> String: return self.model_name @staticmethod fn get_default_model() -> String: return "VW" fn main(): var v: Vehicle = Vehicle("Mercedes") print(v.get_model()) # Call instance method print(Vehicle.get_default_model()) # Call static method print(v.get_default_model()) # Possible, but not a good style to call static method. print(Vehicle.get_model(v)) # Also possible, but not a good style to call an instance method. ``` In the previous code listing, get_default_model was defined using @staticmethod decorator. We will cover decorators in detail in a later chapter. The @staticmethod on a method indicates to the Mojo compiler that this method should be a static method. Static methods are called using the name of the struct itself, instead of the name of the variable that contains the struct’s instance. For example, in the code listing the static method was called by referring to the Vehicle struct directly as in Vehicle.get_default_model(). It is possible to call static methods through an instance of the struct, but that style is discouraged because for a person reading the code, it is confusing. ### 7.3. Implicit conversion You may have noticed that assignment var x: String = "A string literal" ` works, even though we saw earlier that anything within the double quotes `"" is of type StringLiteral. The above assignment works because Mojo has support for implicit conversions. Mojo has a very simple approach for implicit conversions. Suppose that struct A has an initializer that takes an argument with type of StringLiteral. Then when we assign a StringLiteral to a variable of type A, it implicitly calls that initializer, resulting in initialization of the variable with an instance of A with that given string literal passed as an argument. The following examples makes it more clear. ```mojo struct Vehicle: var model_name: String fn __init__(inout self, model_name: StringLiteral): self.model_name = model_name fn get_model(self) -> String: return self.model_name fn main(): var v: Vehicle = "Ford" print(v.get_model()) ``` ← Previous: Documenting your code | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Trait → ================================================================================ URL: https://ruhati.net/mojo/_trait.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History ## 8. Trait A struct is a concrete and instantiable type whereas a trait is an abstract type that cannot be instantiated. When we define a trait, we define a set of requirements that do not have a concrete implementation, but is intended to be implemented by a concrete type. Traits are useful abstractions especially in large a codebase. Users of traits do not need to know what concrete struct implements a particular method, as long as the implementation conforms to the requirements given in the trait. In the following code listing, Flyable trait requires that whatever struct implements Flyable must implement fly method. The function fly_it does not know the concrete implementations Bird or Plane. It takes in its arguments a type that confirms to Flyable, and calls method in the Flyable. The actual concrete types are passed to it at the call site. A struct implicitly conforms to a trait if it implements all the requirements for the trait. This means that we do not need to explicitly specify a confirming trait in the struct declaration; but it is a recommended practice to do so. ```mojo trait Flyable: fn fly(self): ... struct Bird(Flyable): fn __init__(inout self): ... fn fly(self): print("Soar into the sky") struct Plane(Flyable): fn __init__(inout self): ... fn fly(self): print("Jet set go") fn fly_it[T: Flyable](f: T): f.fly() fn main(): fly_it(Bird()) fly_it(Plane()) ``` You may have noticed in the fly_it definition a square bracket with a parameter being passed within it, i.e. [T: Flyable]. Mojo allows values to be passed during compile time to a function or method. Only requirement is that the values must be passed within square brackets. Those are called parameters. In other languages, parameters and arguments to functions are interchangeable terms. However, in Mojo those are distinct terms. Parameters are passed during compile time to a function, while arguments are passed at runtime. In the above example, we have passed a compile time parameter T of the type Flyable to fly_it. We then used that type T as the type of the argument f, indirectly assigning Flyable as the type of f. The anatomy of a trait and its usage in a struct is shown in the following diagram. A single trait can be implemented by many different types, with the condition that the type ensures that all the requirements defined in the trait is implemented by the type. A type can also inherit more than one trait, with the condition that they implement all the combined requirements from of all of those traits within the type itself. ```mojo trait Flyable: fn fly(self): ... trait Walkable: fn walk(self): ... struct Bird(Flyable, Walkable): fn __init__(inout self): ... fn fly(self): print("Fly to the sky") fn walk(self): print("Walk on the ground") struct Cat(Walkable): fn __init__(inout self): ... fn walk(self): print("Walk carefully") fn main(): Bird().fly() Bird().walk() Cat().walk() ``` Traits can inherit from other traits. They can also inherit multiple traits at the same time. ```mojo trait Flyable: fn fly(self): ... trait Walkable: fn walk(self): ... trait WalkableFlyable(Flyable, Walkable): ... struct Bird(WalkableFlyable): fn __init__(inout self): ... fn fly(self): print("Fly to the sky") fn walk(self): print("Walk on the ground") fn main(): Bird().fly() Bird().walk() ``` Unlike many other programming languages, Mojo allows traits to require static methods on the structs it defines. ```mojo trait Message: @staticmethod fn default_message(): ... struct Hello(Message): fn __init__(inout self): ... @staticmethod fn default_message(): print("Hello World") struct Bye(Message): fn __init__(inout self): ... @staticmethod fn default_message(): print("Goodbye") fn main(): Hello.default_message() Bye.default_message() ``` ← Previous: Struct | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Control flow → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_error_handling.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling 10.1. Error propagation 10.2. Finally 10.3. Else - 10.1. Error propagation - 10.2. Finally - 10.3. Else - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 10.1. Error propagation - 10.2. Finally - 10.3. Else ## 10. Error handling Like many other languages, Mojo has built-in support for error handling. In Mojo, an error is raised using the keyword raise and handled using except. Any function call that can potentially raise an error must be wrapped within a try and except block. The following diagram illustrates the structure of error handling in Mojo. The following example shows how a function declares that it raises an error and how the caller of a function handles it. ```mojo fn raise_error(cond: Bool) raises: if cond: raise Error("Provided condition is True") else: print("No error") ``` Usage: ```mojo try: raise_error(True) except e: print("Error raised:", e) ``` In the example, an error is raised inside the function raise_error based on a given condition. Since an error is raised, the function must declare that in its signature. This means that any one calling the function must either handle the error raised by the function, or must re-raise it further down. In the usage example, we see that the error raised by the function is handled. It is possible to raise a String as error as shown below, though in reality it automatically gets wrapped within an Error. ```mojo fn raise_str_error(cond: Bool) raises: if cond: raise "String error is allowed" else: print("No error") ``` Usage: ```mojo try: raise_str_error(True) except e: print("Error raised:", e) ``` ### 10.1. Error propagation In the following example, we see that any function that calls another function that potentially raises an error, needs to either fully handle the error within the function itself, or declare in its own signature that it too raises an error. Unhandled errors in a called function will get propagated down. ```mojo fn raise_call() raises: # Need to either have 'raises' in the signature, or wrap with try-except raise_error(True) ``` ### 10.2. Finally The finally code blocks always gets executed regardless whether an error is getting propagated, or it was fully handled. The finally block is typically used for clean-up activities, for example, if a file is opened within a try block, then we must close the file within a finally block to ensure that even if an error is raised within the try block the file is always closed before the function returns. If a value is returned in finally and try or except, the returned value will be from finally. The finally block is optional. ```mojo try: raise_error(True) except e: print("Error raised:", e) finally: print("Always executed") try: raise_error(False) except e: print("Error raised:", e) finally: print("Always executed") ``` ### 10.3. Else In order to execute statements when no error has been raised, you can use else block. The else block is optional. The else block appears after except, but before finally. The else block is useful for those cases where we want to isolate error raising functions that we want to handle from other code that we want to execute, but may raise their own errors. ```mojo try: raise_error(False) except e: print("Error raised:", e) else: print("No exception raised.") ``` ← Previous: Control flow | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Operators and special methods → ================================================================================ URL: https://ruhati.net/mojo/_operators_and_special_methods.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods 11.1. Arithmetic operators 11.2. Bitwise operators 11.3. Relational operators 11.4. Index operators 11.5. Context management methods 11.6. Other special methods - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods ## 11. Operators and special methods In Mojo some functions have special naming convention, starting and ending with double underscores: "_". Since they start and end with __double underscores_, they are called dunder methods. These methods are treated specially by Mojo compiler. Mojo supports implementation of arithmetic and relational operators, along with special methods that support lifecycle of values. In previous chapters, we saw many times the arithmetic and relational operators. Most of these operators can be implemented by user defined structs. Mojo provides quite a bit of flexibility in defining your own low level structs and the ability to implement these operators is part of that flexibility. Implementing an operator is as simple as implementing a function. Many of Mojo’s built in functionality is implemented as libraries. This means that we are able to implement powerful constructs just using basic language features offered by Mojo. ### 11.1. Arithmetic operators The following sections describe the various arithmetic operators in Mojo. #### 11.1.1. Addition The following are the addition operators. ##### __add__ The __add__ stands for arithmetic addition "+" between the struct defining the method and self type or another type. ##### __radd__ The __radd__ method is known as reverse addition, and is used when we try to add two values, where the first value does not have __add__ implemented. In this case, the Mojo compiler checks if the second value has __radd__ implemented, and it calls that one. ##### __iadd__ The __iadd__ method is called in-place addition and represents arithmetic addition "=". Even if you implement just `\\__add__` and do not implement `\\__iadd__`, the "=" operation would still work as Mojo will just use __add__ as the fallback. However, typically __add__ returns a new instance of the result. In case of large structs (structs with many fields), it could entail a lot of copy operations. The in-place addition can directly change the struct’s internal data, resulting in an efficient execution of the addition method. The __iadd__ therefore does not have a return value as it updates the struct itself. Since the struct' internal value is mutated, we need to use one of the inout or owned references of self in the method. The following code listing shows the different operations. Please note that these examples are not meant for production use, as it is intentionally kept incomplete for simplicity’s sake. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __add__(self, other: Self) -> Self: print("add invoked") return Self(self.val + other.val) fn __radd__(self, other: MyFloat) -> Self: print("radd invoked") return Self(self.val + int(other.val)) fn __iadd__(inout self, other: Self): print("iadd invoked") self.val = self.val + other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var add_res = MyInt(1) + MyInt(2) print(add_res.val) var radd_res = MyFloat(3.5) + MyInt(2) # Even though MyFloat does not implement __add__ method, we are able to do addition through MyInt's __radd__ print(radd_res.val) var iadd_res = MyInt(10) iadd_res += MyInt(20) print(iadd_res.val) ``` #### 11.1.2. Subtraction The following are the subtraction operators. ##### __sub__ The __sub__ stands for arithmetic subtraction "-" between the struct defining the method and self type or another type. ##### __rsub__ The __rsub__ method is known as reverse subtraction, and is used when we try to subtract two values, where the first value does not have __sub__ implemented. In this case, the Mojo compiler checks if the second value has __rsub__ implemented, and it calls that one. As the name implies, the reverse subtraction swaps the operands. Since subtraction is non-commutative, care must be taken to have correct values as the first operand and second operands. For example, x - y in normal subtraction would be y - x in reverse subtraction. ##### __isub__ The __isub__ method is called in-place subtraction and represents arithmetic subtraction "-=". The concept of __isub__ is the same as what we saw in __iadd__. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __sub__(self, other: Self) -> Self: print("sub invoked") return Self(self.val - other.val) fn __rsub__(self, other: MyFloat) -> Self: print("rsub invoked") return Self(int(other.val) - self.val) # Order matters for subtraction; it is not commutative. fn __isub__(inout self, other: Self): print("isub invoked") self.val = self.val - other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var sub_res = MyInt(1) - MyInt(2) print(sub_res.val) var rsub_res = MyFloat(3.5) - MyInt(2) # Even though MyFloat does not implement __sub__ method, we are able to do addition through MyInt's __rsub__ print(rsub_res.val) var isub_res = MyInt(10) isub_res -= MyInt(20) print(isub_res.val) ``` #### 11.1.3. Multiplication The following are multiplication operators. ##### __mul__ The __mul__ stands for multiplication "*" between the struct defining the method and self type or another type. ##### __rmul__ The __rmul__ method is known as reverse multiplication, and is used when we try to multiply two values, where the first value does not have __mul__ implemented. In this case, the Mojo compiler checks if the second value has __rmul__ implemented, and it calls that one. ##### __imul__ The __imul__ method is called in-place multiplication and represents multiplication "*=". The concept of __imul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is multiplication. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mul__(self, other: Self) -> Self: print("mul invoked") return Self(self.val * other.val) fn __rmul__(self, other: MyFloat) -> Self: print("rmul invoked") return Self(int(other.val) * self.val) # Will truncate fn __imul__(inout self, other: Self): print("imul invoked") self.val = self.val * other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mul_res = MyInt(3) * MyInt(2) print(mul_res.val) var rmul_res = MyFloat(3.5) * MyInt(2) print(rmul_res.val) var imul_res = MyInt(10) imul_res *= MyInt(20) print(imul_res.val) ``` #### 11.1.4. Matrix multiplication The following are operators for matrix multiplication. ##### __matmul__ The __matmul__ stands for matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. ##### __rmatmul__ The __rmatmul__ stands for the reverse matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imatmul__ The __imatmul__ stands for in-place matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. The concept of __imatmul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is matrix multiplication. ```mojo struct MyFloatMatrix: var val: List[List[Float16]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Float16]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyFloatMatrix(List[List[Float16]](), 0, 0) struct MyIntMatrix: var val: List[List[Int]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Int]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyIntMatrix(List[List[Int]](), 0, 0) fn print(self): print("....") print("Rows:", self.rows, "Cols:", self.cols) for row in self.val: print() for col in row[]: print(col[], end=" ") print() print("----") @staticmethod fn _matmul_internal(first: Self, second: Self) -> Self: if first.cols != first.rows: print("Rows and columns do not match. ") return MyIntMatrix.empty() var res: List[List[Int]] = List[List[Int]](capacity=first.rows) for i in range(first.rows): res.append(List[Int](capacity=second.cols)) for j in range(second.cols): var s = 0 for k in range(first.cols): s += first.val[i][k] * second.val[k][j] res[i].append(s) return Self(res, first.rows, second.cols) fn __matmul__(self, other: Self) -> Self: # Naive implementation - not for production use print("matmul invoked") return Self._matmul_internal(self, other) fn __rmatmul__(self, other: MyFloatMatrix) -> Self: # Naive implementation - not for production use print("rmatmul invoked") var res: List[List[Int]] = List[List[Int]](capacity=self.rows) for i in range(other.rows): res.append(List[Int](capacity=self.cols)) for j in range(self.cols): var s = 0 for k in range(other.cols): s += int(other.val[i][k]) * self.val[k][j] # Will truncate res[i].append(s) return Self(res, other.rows, self.cols) fn __imatmul__(inout self, other: Self): # Naive implementation - not for production use print("imatmul invoked") var res = Self._matmul_internal(self, other) self.val = res.val self.rows = res.rows self.cols = res.cols ``` Usage: ```mojo var m : List[List[Int]] = List( List(1, 2, 1), List(5, 1, 1), List(2, 3, 1)) var n: List[List[Int]] = List( List(2, 5), List(6, 7), List(1, 1)) var flm : List[List[Float16]] = List( List[Float16](1.2, 2.3, 1.4), List[Float16](5.2, 1.2, 1.3), List[Float16](2.3, 3.4, 1.4)) var matmul_res = MyIntMatrix(m, 3, 3) @ MyIntMatrix(n, 3, 2) matmul_res.print() var rmatmul_res = MyFloatMatrix(flm, 3, 3) @ MyIntMatrix(n, 3, 2) rmatmul_res.print() var imatmul_res = MyIntMatrix(m, 3, 3) imatmul_res @= MyIntMatrix(n, 3, 2) imatmul_res.print() ``` #### 11.1.5. Division The division operators. ##### __truediv__ The __truediv__ stands for division represented by the symbol "/" between the struct defining the method and self type or another type. The result of \\__truediv is a floating point type with 64 bits. ##### __rtruediv__ The __rtruediv__ stands for the reverse division represented by the symbol "/" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __itruediv__ The __itruediv__ stands for in-place division represented by the symbol "/" between the struct defining the method and self type or another type. The concept of __itruediv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __truediv__(self, other: Self) -> MyFloat: print("truediv invoked") return MyFloat(self.val / other.val) fn __rtruediv__(self, other: MyFloat) -> MyFloat: print("rtruediv invoked") return MyFloat(int(other.val) / self.val) fn __itruediv__(inout self, other: Self): print("itruediv invoked") self.val = int(self.val / other.val) # Will truncate ``` Usage: ```mojo var num: MyInt = MyInt(42) var div_res = MyInt(3) / MyInt(2) print(div_res.val) var rdiv_res = MyFloat(3.5) / MyInt(2) print(rdiv_res.val) var idiv_res = MyInt(10) idiv_res /= MyInt(20) print(idiv_res.val) ``` Note that __itruediv__ implementation had to convert the result from a Float to Int because MyInt can only store Int as value within it. Mojo has the ability to have a variable with multiple possible types through Variant struct. We will cover that in a later chapter. ##### __floordiv__ The __floordiv__ stands for floor division (also known as integer division) represented by the symbol "//" between the struct defining the method and self type or another type. As the name suggest, the result of the __floordiv__ is an integer instead of float. Typically implementations truncate towards zero in case of positive values and away from zero for negative values. For example, 7//3 results in 2, while -7//3 results in -3 and not -2. ##### __rfloordiv__ The __rfloordiv__ stands for the reverse division represented by the symbol "//" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ifloordiv__ The __ifloordiv__ stands for in-place division represented by the symbol "//" between the struct defining the method and self type or another type. The concept of __ifloordiv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is floor division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __floordiv__(self, other: Self) -> Self: print("floordiv invoked") return Self(self.val // other.val) fn __rfloordiv__(self, other: MyFloat) -> Self: print("rfloordiv invoked") return Self(int(other.val) // self.val) fn __ifloordiv__(inout self, other: Self): print("ifloordiv invoked") self.val = self.val // other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var floordiv_res = MyInt(3) // MyInt(2) print(floordiv_res.val) var rfloordiv_res = MyFloat(3.5) // MyInt(2) print(rfloordiv_res.val) var ifloordiv_res = MyInt(10) ifloordiv_res //= MyInt(20) print(ifloordiv_res.val) ``` #### 11.1.6. Modulo The following are the modulo operators. ##### __mod__ The __mod__ stands for modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The approach to implement __mod__ is the same as what we saw in __truediv__, except instead of division, the applied operation is modulo operation. The __mod__ derives its name from the mathematical modulo operation. Modulo operation divides two numbers and returns the remainder of the division. ##### __rmod__ The __rmod__ stands for the reverse modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imod__ The __imod__ stands for in-place modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The concept of __imod__ is the same as what we saw in __itruediv__, except instead of division, the applied operation is modulo. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mod__(self, other: Self) -> Self: print("mod invoked") return Self(self.val % other.val) fn __rmod__(self, other: MyFloat) -> Self: print("rmod invoked") return Self(int(other.val) % self.val) fn __imod__(inout self, other: Self): print("imod invoked") self.val = self.val % other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mod_res = MyInt(7) % MyInt(2) print(mod_res.val) var rmod_res = MyFloat(8) % MyInt(2) print(rmod_res.val) var imod_res = MyInt(37) imod_res %= MyInt(20) print(imod_res.val) ``` #### 11.1.7. Exponentiation The following lists the exponentiation operators. ##### __pow__ The __pow__ stands for exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The approach to implement __pow__ is the same as what we saw in __mul__, except instead of multiplication, we apply exponential operation. ##### __ipow__ The __ipow__ stands for in-place exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The concept of __ipow__ is the same as what we saw in __imul__, except instead of multiplication, we apply exponential operation. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pow__(self, other: Self) -> Self: print("pow invoked") return Self(self.val ** other.val) fn __ipow__(inout self, other: Self): print("ipow invoked") self.val **= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var pow_res = MyInt(7) ** MyInt(2) print(pow_res.val) var ipow_res = MyInt(7) ipow_res **= MyInt(2) print(ipow_res.val) ``` #### 11.1.8. Unary operators The following are the unary operators. ##### __neg__ The __neg__ stands for the unary operation represented by the symbol "-" for the struct defining the method. The negative sign appears as prefix to the value and typically results in negation of the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __neg__(self) -> Self: print("neg invoked") return Self(-self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var neg_res = -MyInt(7) print(neg_res.val) ``` ##### __pos__ The __pos__ stands for the unary operation represented by the symbol "+" for the struct defining the method. The positive sign appears as prefix to the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pos__(self) -> Self: print("pos invoked") return Self(+self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var pos_res = +MyInt(7) print(pos_res.val) ``` ##### __invert__ The __invert__ stands for the unary operation represented by the symbol "~" for the struct defining the method. The invert sign appears as prefix to the value. Typical implementations return bitwise compliment of the value, switching 1 for 0 and vice versa. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __invert__(self) -> Self: print("invert invoked") return Self(~self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var invert_res = ~MyInt(2) print(invert_res.val) ``` ### 11.2. Bitwise operators The following are the bitwise operators. #### 11.2.1. Operators ##### __lshift__ The __lshift__ stands for left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. ##### __rlshift__ The __rlshift__ stands for the reverse left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ilshift__ The __ilshift__ stands for in-place left shift operation represented by the symbol "<⇐" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __lshift__, the __ilshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lshift__(self, other: Self) -> Self: print("lshift invoked") return Self(self.val << other.val) fn __rlshift__(self, other: MyFloat) -> Self: print("rlshift invoked") return Self(int(other.val) << self.val) fn __ilshift__(inout self, other: Self): print("ilshift invoked") self.val <<= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var lshift_res = MyInt(2) << MyInt(3) print(lshift_res.val) var rlshift_res = MyFloat(2) << MyInt(3) print(rlshift_res.val) var ilshift_res = MyInt(3) ilshift_res <<= MyInt(2) print(ilshift_res.val) ``` ##### __rshift__ The __rshift__ stands for right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the right. The second operand indicates how many bits are to be shifted to the right. ##### __rrshift__ The __rrshift__ stands for the reverse right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Similar to __rlshift__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __irshift__ The __irshift__ stands for in-place right shift operation represented by the symbol ">>=" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __rshift__, the __irshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __rshift__(self, other: Self) -> Self: print("rshift invoked") return Self(self.val >> other.val) fn __rrshift__(self, other: MyFloat) -> Self: print("rrshift invoked") return Self(int(other.val) >> self.val) fn __irshift__(inout self, other: Self): print("irshift invoked") self.val >>= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var rshift_res = MyInt(20) >> MyInt(3) print(rshift_res.val) var rrshift_res = MyFloat(24) >> MyInt(3) print(rrshift_res.val) var irshift_res = MyInt(30) irshift_res >>= MyInt(2) print(irshift_res.val) ``` ##### __and__ The __and__ stands for bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. ##### __rand__ The __rand__ stands for reverse bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. This is invoked when the first value does not have __and__ implemented. In this case, the Mojo compiler checks if the second value has __rand__ implemented, and calls that one. ##### __iand__ The __iand__ stands for in-place bitwise AND operator represented by the symbol "&=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __and__, the __iand__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __and__(self, other: Self) -> Self: print("and invoked") return Self(self.val & other.val) fn __rand__(self, other: MyFloat) -> Self: print("rand invoked") return Self(int(other.val) & self.val) fn __iand__(inout self, other: Self): print("iand invoked") self.val &= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var and_res = MyInt(23) & MyInt(6) print(and_res.val) var rand_res = MyFloat(20) & MyInt(4) print(rand_res.val) var iand_res = MyInt(10) iand_res &= MyInt(2) print(iand_res.val) ``` ##### __or__ The __or__ stands for bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. ##### __ror__ The __ror__ stands for reverse bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. This is invoked when the first value does not have __or__ implemented. In this case, the Mojo compiler checks if the second value has __ror__ implemented, and calls that one. ##### __ior__ The __ior__ stands for in-place bitwise OR operator represented by the symbol "|=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __or__, the __ior__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __or__(self, other: Self) -> Self: print("or invoked") return Self(self.val | other.val) fn __ror__(self, other: MyFloat) -> Self: print("ror invoked") return Self(int(other.val) | self.val) fn __ior__(inout self, other: Self): print("ior invoked") self.val |= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var or_res = MyInt(5) | MyInt(3) print(or_res.val) var ror_res = MyFloat(15) | MyInt(17) print(ror_res.val) var ior_res = MyInt(5) ior_res |= MyInt(1) print(ior_res.val) ``` ##### __xor__ The __xor__ stands for bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. ##### __rxor__ The __rxor__ stands for reverse bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. This is invoked when the first value does not have __xor__ implemented. In this case, the Mojo compiler checks if the second value has __rxor__ implemented, and calls that one. ##### __ixor__ The __ixor__ stands for in-place bitwise OR operator represented by the symbol "^=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __xor__, the __ixor__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __xor__(self, other: Self) -> Self: print("xor invoked") return Self(self.val ^ other.val) fn __rxor__(self, other: MyFloat) -> Self: print("rxor invoked") return Self(int(other.val) ^ self.val) fn __ixor__(inout self, other: Self): print("ixor invoked") self.val ^= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var xor_res = MyInt(5) ^ MyInt(3) print(xor_res.val) var rxor_res = MyFloat(15) ^ MyInt(17) print(rxor_res.val) var ixor_res = MyInt(5) ixor_res ^= MyInt(3) print(ixor_res.val) ``` ### 11.3. Relational operators #### 11.3.1. Operators ##### __eq__ The __eq__ stands for equality operator represented by the symbol "==" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __eq__(self, other: Self) -> Bool: print("eq invoked") return self.val == other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) == MyInt(5)) print(MyInt(5) == MyInt(3)) ``` ##### __ne__ The __ne__ stands for inequality operator represented by the symbol "!=" between the struct defining the method and self type or another type. The operation returns a Bool value. Note that __ne__ is not invoked when you call not x==y though. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ne__(self, other: Self) -> Bool: print("ne invoked") return self.val != other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) != MyInt(5)) print(MyInt(5) != MyInt(3)) print(not MyInt(5) == MyInt(3)) ``` ##### __lt__ The __lt__ stands for less-than operator represented by the symbol "<" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lt__(self, other: Self) -> Bool: print("lt invoked") return self.val < other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) < MyInt(5)) print(MyInt(3) < MyInt(5)) ``` ##### __gt__ The __gt__ stands for greater-than operator represented by the symbol ">" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __gt__(self, other: Self) -> Bool: print("gt invoked") return self.val > other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) > MyInt(5)) print(MyInt(5) > MyInt(3)) ``` ##### __le__ The __le__ stands for less-than-or-equal-to operator represented by the symbol "⇐" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __le__(self, other: Self) -> Bool: print("le invoked") return self.val <= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) <= MyInt(5)) print(MyInt(5) <= MyInt(3)) ``` ##### __ge__ The __ge__ stands for greater-than-or-equal-to operator represented by the symbol ">=" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ge__(self, other: Self) -> Bool: print("ge invoked") return self.val >= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) >= MyInt(5)) print(MyInt(3) >= MyInt(5)) ``` ### 11.4. Index operators Any large scale program would use collection data types such as lists, arrays, dictionaries extensively. Some programming languages have built-in syntax to make usage of such types convenient. Mojo has built-in syntactical support for collection types. Mojo allows accessing collection like data types using the syntax []. For example, list[2]. It also allows setting of values at a given index (e.g. list[2]=5). In line with Mojo’s philosophy of moving as much functionality as possible to libraries, instead of having specially treated data types that have exclusive privilege of syntax, Mojo opened up the index operator capability to any type that defines __getitem__ and __setitem__ methods. This means that your custom List struct will have the same syntactical support like the List bundled with Mojo. #### 11.4.1. Operators ##### __getitem__ The __getitem__ is the method invoked when you try to access values stored within the collection using the my_list[index] syntax (where my_list is the collection and index is the position of the element desired from the list). ##### __setitem__ The __setitem__ is the method invoked when you try to assign values to a collection using the my_list[index]=value syntax (where my_list is the collection and index is the position at which the value will be assigned). ```mojo struct MyCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, x: Int) -> String: return self.list[x] fn __setitem__(inout self, x: Int, val: String): self.list[x] = val ``` Usage: ```mojo var x = MyCollection(List(String("A"), String("B"))) print("Before:", x[1]) # Gets x[1] = String("C") # Sets print("After:", x[1]) ``` It is also possible to get and set using multiple indices, especially useful for Matrix like data structures. This means that we can use in our code my_list[row, col, and so on…​]. The following code listing shows such an example for a matrix. Note that this example is not a production quality implementation. ```mojo struct MyMatrix: var val: List[List[String]] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.rows = rows self.cols = cols self.val = List[List[String]](capacity=rows) for row in range(rows): self.val.append(List[String](capacity=cols)) for col in range(cols): self.val[row].append(String("None")) fn __getitem__(self, row: Int, col: Int) -> String: return self.val[row][col] fn __setitem__(inout self, row: Int, col: Int, s: String): self.val[row][col] = s ``` Usage: ```mojo var y = MyMatrix(5, 3) print("Before:", y[1, 2]) # Gets y[1, 2] = String("D") # Sets print("After:", y[1, 2]) ``` ##### __getitem__ with Slice Mojo supports getting a slice of a collection or a container using the slicing operator. The following diagram shows the structure of the slicing operator. In order to be able to get a slice from a collection or a container, the collection or the container must implement method __getitem__ that takes a Slice object. This Slice object is instantiated by the Mojo compiler when you use the slice operator. In a way you can think of the [start:stop:step] as a literal form instantiating a Slice. The start argument of Slice is the start index of the collection from where the slice will be taken. The end argument is the last index until which the slice will be taken (the element referred by this index will be excluded, only its previous element will be taken as last for the slice). The step gives the number of increments to be taken to get the next element. Any of the arguments of the Slice can be negative. A negative value means reversal of the indexing or stepping. Care must be taken to provide valid combinations though, otherwise it results in error. ```mojo struct MySliceableCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, slc: Slice) -> List[String]: return self.list[slc.start:slc.end:slc.step] ``` Usage: ```mojo var z = MySliceableCollection( List(String("H"), String("E"), String("L"), String("L"), String("O"), String("W"), String("O"), )) for i in z[0:3:1]: print(i[], end=" ") print() for i in z[1:6:2]: print(i[], end=" ") print() for i in z[1:]: print(i[], end=" ") print() for i in z[:1]: print(i[], end=" ") print() for i in z[-3:]: print(i[], end=" ") print() for i in z[:-3]: print(i[], end=" ") print() for i in z[::-1]: print(i[], end=" ") print() ``` ### 11.5. Context management methods In large programs, we often need to resources like files and database connections. When we open access to those resources, we typically have a handle, which we use to perform actions. However, once we have done with our actions, we must remember to cleanup or close the resources, otherwise we end up with dangling resources, memory leaks, locked files, etc. Mojo provides with keyword for managing such context or resources. The following diagram illustrates the syntax of the with statement. #### 11.5.1. Methods ##### __enter__ The method that handles the allocation of the resource and returns a resource. The resource has scope only within the body of the with. It is not mandatory to assign the return value to a variable, especially if it is not being used. ##### __exit__ The method that handles the cleanup of the resource. There are two implementations of the __exit__ method, one without any arguments __exit__(self, Error) and one with Error as an argument __exit__(self, Error). The __exit__(self, Error) is invoked when the with body has an exception and exits the with block abnormally. The method __exit__(self, Error) returns a Bool to indicate whether or not to propagate the error further. Any resources allocated in the __enter__ must be cleaned up at both the __exit__ methods, otherwise we would end up with dangling resources. For example, if __exit__(self, Error) is not properly implemented, resource leaks will occur only when there are exceptions raised within the with body. This will lead to rare but difficult to find defects. The following code listing shows an example for the context manager. ```mojo struct Resource: var name: String fn __init__(inout self, name: String): self.name = name fn open(self): print("Opened") fn close(self): print("Close") fn __copyinit__(inout self, other:Resource): self.name = other.name struct MyResourceManager: var resource: Resource fn __init__(inout self): self.resource = Resource("a_resource") fn __enter__(self) -> Resource: print("Entered context") self.resource.open() return self.resource fn __exit__(self): self.resource.close() print("Exited context") fn __exit__(self, err: Error) -> Bool: self.resource.close() print("Exited context") return False ``` Usage: ```mojo with MyResourceManager() as res: print("Inside context, resource is:", res.name) raise Error("An error while processing") ``` ### 11.6. Other special methods #### 11.6.1. Methods ##### __len__ The __len__ is defined within Sized trait and is used by the built-in len function. The __len__ method returns the length or size of the struct implementing it. ##### __int__ The __int__ is defined within Intable trait and is used by the built-in int function. The __int__ method returns an integer representation of the struct implementing it. ##### __bool__ The __bool__ is defined within Boolable trait and is used by conditional statements such as if to convert the given value to a boolean value for evaluation. The __bool__ method returns a boolean representation of the struct implementing it. ##### __str__ The __str__ is defined within Stringable trait and is used by the built-in str function. The __str__ method returns an string representation of the struct implementing it. The built-in function print uses __str__ before it prints the given value. The following code listing provides examples of special methods. ```mojo struct MyStruct(Sized, Intable, Boolable, Stringable): var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __len__(self) -> Int: print("len called") return len(self.ints) fn __int__(self) -> Int: print("int called") var sum: Int = 0 for i in range(len(self.ints)): sum += self.ints[i] return sum fn __bool__(self) -> Bool: print("bool called") return len(self.ints)>0 fn __str__(self) -> String: print("str called") return "MyStruct" ``` Usage: ```mojo var st = MyStruct(List(1, 2, 3)) print(len(st)) print(int(st)) if st: # Uses __bool__ print("MyStruct is true") print(str(st)) print(st) # Can directly print st because the __str__ method is implemented ``` ##### __is__ The __is__ method is used by the is clause to compare the identity between two values, and returns True if the identities are the same. Note that it is different from the eq method. The eq compares if two values are the same content-wise, while is checks if the two values are having the same identities. This means that two objects may have exactly same content, but different identities. Typical implementations check if the memory location of the two values are the same, in which case it would be considered as being identical. ##### __isnot__ The __isnot__ method is used by the is not clause to compare the identity between two values, and returns True if the identities are not the same. It is the opposite of the is clause, and in most cases it is sufficient for the implementation to return a negation of the is method. The following code listing provides examples of is and isnot methods. ```mojo struct MyStruct: var ptr: UnsafePointer[Int] fn __init__(inout self, ptr: UnsafePointer[Int]): self.ptr = ptr fn __is__(self, other: MyStruct) -> Bool: print("__is__ called") return self.ptr == other.ptr fn __isnot__(self, other: MyStruct) -> Bool: print("__isnot__ called") return not(self is other) ``` Usage: ```mojo var x: Int = 10 var y: Int = 10 print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(y))) # Results in False print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(x))) # Results in True print(MyStruct(UnsafePointer.address_of(x)) is not MyStruct(UnsafePointer.address_of(y))) # Results in True ``` ##### __getattr__ Many dynamic languages allow us to dynamically define attributes that do not exist in the original struct definition (or class definition in most languages). This ability allows programmers to define an ergonomic API, especially for object relational mapping. Even though Mojo is a statically compiled language, it allows for such a dynamic definition of attributes through a combination of methods, __getattr__ and __setattr__. The __getattr__ method takes in the attribute name as an argument. When you call an attribute my_attr within a struct (my_struct.my_attr), it is this attribute name my_attr that gets passed as the argument to the method __getattr__. Within the __getattr__, you can as an example return a result based on a database query involving the attribute name. Mojo does not restrict what you do with the attribute name, as long as you return a value conforming to the return type of the function. ##### __setattr__ The __setattr__ method takes in the attribute name and its value as arguments. When you set an attribute my_attr within a struct with a value (my_struct.my_attr = 'a value'), the __setattr__ is called with the given attribute name my_attr and the value 'a value' passed as arguments. The following code listing provides examples of getattr and setattr methods. ```mojo struct MyStruct: var fields: Dict[String, String] fn __init__(inout self, fields: Dict[String, String]): self.fields = fields fn __getattr__(self, attr: String) raises -> String: return self.fields[attr] fn __setattr__(inout self, attr: String, value: String) raises: self.fields[attr] = value ``` Usage: ```mojo var d: Dict[String, String] = Dict[String, String]() d["name"] = "IK" var st = MyStruct(d) print(st.name) # __getattr__ is called here st.name = "PK" # __setattr__ is called here print(st.name) ``` ##### __contains__ In Mojo you can check if a value is contained within a struct using the in operator. For example, "IK" in my_string, where my_string is a string and the expression results in value True if the literal IK is found within my_string. The __contains__ method is used by the in operator to check if a given value is within the struct defining that method. The following code listing provides an example of contains method. ```mojo struct MyStruct: var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __contains__(self, value: Int) -> Bool: for i in self.ints: if i[] == value: return True return False ``` Usage: ```mojo var my_struct = MyStruct(List(1, 2, 3)) print(1 in my_struct) # Returns True print(5 in my_struct) # Returns False ``` The __contains__ method also works with custom types as shown in the example below. ```mojo struct MyStruct2: var first_name: String var last_name: String fn __init__(inout self, first_name: String, last_name: String): self.first_name = first_name self.last_name = last_name fn __contains__(self, other: MyStruct2) -> Bool: return (self.first_name == other.first_name) or self.last_name == other.last_name ``` Usage: ```mojo var my_struct2 = MyStruct2("Ram", "C") print(MyStruct2("Ram", "T") in my_struct2) # Returns True print(MyStruct2("Kri", "C") in my_struct2) # Returns True print(MyStruct2("C", "Ram") in my_struct2) # Returns False ``` ← Previous: Error handling | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Lifecycle and ownership → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_advanced_usage_of_functions.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions 14.1. Higher-order functions 14.2. Closure 14.3. Variadic function 14.4. Overloading - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading ## 14. Advanced usage of functions In previous chapters you saw how we declare types of variables and how we use them. In Mojo you can assign also a function to a variable. The type of the variable is determined by the function’s signature, i.e., it is a combination of the argument types and return type of the function. In the following code listing, you can see the variable my_fn_var is of type fn(Int, Int) → Int and is assigned a function with the same signature as the type of my_fn_var. Another thing to note is that the assigned function does not have the trailing () which is usual in a function call. This is because we are not calling the function adder, instead we are binding the function to the variable my_fn_var. In fact, we do not want to call adder at that point of time. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b ``` Usage: ```mojo var my_fn_var: fn(Int, Int) -> Int = adder print(my_fn_var(4, 3)) ``` In the example, we see that we defined a function adder and then assigned that function to a variable. We later execute that variable as if it is a function. ### 14.1. Higher-order functions The ability to assign a function to a variable allows us to implement some interesting use cases. We can pass a function as an argument to another function. We can also return a function as the result from another function. A function that can take a function as an argument, or can return a function as the result is called a higher-order function. There are some interesting uses of higher-order functions, such as the ability to define generic functions that takes any function as an argument and executes the given function based on some condition, or inside a loop, and so on. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b fn suber(a: Int, b: Int) -> Int: return a - b fn exec(x: Int, y: Int, bin_op: fn(Int, Int) -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec(10, 5, adder)) print(exec(10, 5, suber)) ``` In this code listing we see that the function exec is a higher-order function that takes another function as argument. The exec function executes the passed-in function within a loop to calculate a result. We can pass two different functions to the same exec function, and the exec will treat both the passed functions the same way. In this way we have built a generic function that does not need to know what the passed-in does, instead it just executes them and calculates results. Functions can also passed as parameters to another function. The main difference is that the functions are then passed at compile-time instead of at runtime. ```mojo fn diver(a: Int, b: Int) -> Float16: return a / b fn exec_param[bin_op: fn(Int, Int) -> Int](x: Int, y: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec_param[adder](10, 5)) print(exec_param[suber](10, 5)) ``` ### 14.2. Closure So far we have seen that we can pass arguments to functions and they would use those arguments within their body. There is another technique for functions to get values from outside of the function body, which is commonly known as closure. In a closure, we define a function that captures values outside of its function body. The values that are captured must be defined before the definition of the function itself. Another constraint is that the data type of the captured values must implement __copyinit__, as the value of the variable is copied over to the function. ```mojo fn exec_rt_closure(x: Int, bin_op_cl: fn(Int) escaping -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var rt_y: Int = 5 fn ander(x: Int) -> Int: return x & rt_y print(exec_rt_closure(12, ander)) ``` The closure shown above is known as a runtime closure. The type of the closure is fn() escaping → T. Note that the captured values are owned by the closure. Runtime closure can be passed as argument to other functions. However, the runtime closure cannot be passed as a parameter to other functions. In order to pass a closure as a parameter to other functions, we need to use a compile-time closure. Such closures are decorated by @parameter. The type of the closure is fn() capturing → T. The following example demonstrates such a compile-time closure. ```mojo fn exec_ct_closure[bin_op_cl: fn(Int) capturing -> Int](x: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var ct_y: Int = 10 @parameter fn multer(x: Int) -> Int: return x * ct_y print(exec_ct_closure[multer](10)) ``` ### 14.3. Variadic function You have already seen how the built-in print function is able to take any number of arguments. This is possible because of Mojo’s support for variadic functions. The variadic argument is prefixed by * for positional arguments and ** for keyword arguments. Data type of positional variadic argument is VariadicList[T] and of keyword variadic argument is Dict[K, V]. The following is an example of positional variadic arguments: ```mojo fn add_all(*a: Int) -> Int: var result: Int = 0 for i in a: result+= i return result ``` Usage of positional variadic arguments: ```mojo print(add_all(1, 2, 3, 4, 5)) ``` The following is an example of keyword variadic arguments: ```mojo fn names_dob(**namedobs: String) raises: for name in namedobs.keys(): print(name[], namedobs[name[]]) ``` Usage of keyword variadic arguments: ```mojo names_dob(ik="14/4/72", pk="15/5/81", ani="16/3/23", ad="22/6/17") ``` In the examples shown, the add_all has exactly one argument prefixed by *. The argument a is then iterated over and its elements extracted to calculate the sum. In case of the function names_dob, the argument namedobs is iterated over to print both the key name and the value associated with the key. Note that the key of the Dict is a Reference and therefore needs to be dereferenced. Variadic arguments makes it possible to provide easy-to-use APIs by allowing any number of arguments to be passed directly to the function instead of having to wrap them up in a list or dictionary. ### 14.4. Overloading There is a saying among programmers that naming is hard. For example, a function to add two numbers would be best called add. However, we may need to add two integers, one integer and a float, and so on. In some programming languages, that would have resulted in convoluted names such as add_ints, add_int_float and so on. Thankfully, Mojo provides a feature called function overloading. This feature allows us to define the same name to multiple functions as long as their argument types, parameter types or number of arguments are different. If two functions have the same argument types but have different result types, Mojo would complain as overloading is supported only for arguments and parameter types. The following is an example of overloading by different argument types: ```mojo fn add(a: Int, b:Int) -> Int: return a + b fn add(a: Int, b:Float16) -> Int: return int(a + b) ``` Usage of the overloaded functions: ```mojo print(add(1, 2)) print(add(3, 2.4)) ``` The following is an example of overloading by different parameter types: ```mojo fn add[a: Int, b:Int]() -> Int: return a + b fn add[a: Bool, b: Bool]() -> Int: var ai: Int = 1 if a else 0 var bi: Int = 1 if b else 0 return ai + bi ``` Usage of the overloaded functions: ```mojo print(add[Int(1), Int(2)]()) print(add[True, False]()) ``` The following is an example of overloading by different number of arguments, even with the same type of arguments: ```mojo fn sub(a: Int, b:Int) -> Int: return a - b fn sub(a: Int, b:Int, c:Int) -> Int: return a - b - c ``` Usage of the overloaded functions: ```mojo print(sub(1, 2)) print(sub(1, 2, 3)) ``` ← Previous: Parameters and compile-time programming | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Python interoperability → ================================================================================ URL: https://ruhati.net/mojo/_python_interoperability.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability 15.1. Importing a Python module 15.2. Evaluating Python expressions 15.3. Other useful Python functions - 15.1. Importing a Python module - 15.2. Evaluating Python expressions - 15.3. Other useful Python functions - 16. MLIR interoperability - About the author - Revision History - 15.1. Importing a Python module - 15.2. Evaluating Python expressions - 15.3. Other useful Python functions ## 15. Python interoperability As mentioned in the beginning of this book, Mojo is a superset of Python. However, Mojo and Python are semantically two completely different languages, though they share the same syntax. Python has a huge ecosystem behind it, built over many decades. Mojo allows the developer to leverage this huge ecosystem, with its Python integration capability. The integration of Mojo with Python is built on a key insight that from a practical point of view, all Python objects can be represented with a single type. In Mojo it is represented by the PythonObject struct. Mojo uses the actual CPython interpreter for interoperability. The usage of CPython in Mojo enables high fidelity integration with Python, and ensures that the Python objects behave as expected. ### 15.1. Importing a Python module Mojo has module named python that encapsulates all of the Python integration. Within the python module, there is the facade object that provides the entry point for many of the Python integration capabilities. Importing a Python module is as simple as using the Python.import_module method call, passing it the module name. In case a module does not exist, ensure that the module is installed using the pip or equivalent command. Mojo also supports Python virtual environments. The following code listing provides an example on how to import Python modules and how to use objects from Python. ```mojo from python import Python var difflib = Python.import_module("difflib") var list1 = ["One", "Two", "Three", "Four"] var list2 = ["One", "Two", "Three"] var differ = difflib.HtmlDiff() # Get instance of HtmlDiff class. var diff = differ.make_file(list1, list2) print(diff) ``` ### 15.2. Evaluating Python expressions You can evaluate Python expressions using Python.evaluate method. ```mojo print(Python.evaluate("1+2")) ``` Since Python treats functions as first class, you can even use Python.evaluate to access Python’s built-in functions. ```mojo var str_fn = Python.evaluate("str") print(str_fn("ABC") <= str_fn("XYZ")) ``` Note in the above code listing, how transparently we can transfer Mojo string literals to the Python function, and how seamlessly Mojo operators work over Python objects, invoking the right Python dunder methods. One important constraint is that only PythonObject struct can be passed to and from Python. In the case of Mojo string literals, PythonObject has a constructor that takes StringLiteral, resulting in implicit conversion from StringLiteral to a PythonObject instance. PythonObject has many such constructors for the various Mojo built-in types. PythonObject also implements many traits that enable it to be used within functions such as len, int, str and so on. ### 15.3. Other useful Python functions You can use native Python objects like list and dict using corresponding static methods exposed by Python. Python also exposes type function from Python and can be used to determine the underlying type of the PythonObject struct. ```mojo var a_list = Python.list() a_list.append("First element") a_list.append("Second element") print(a_list) print(Python.type(a_list)) ``` ← Previous: Advanced usage of functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: MLIR interoperability → ================================================================================ URL: https://ruhati.net/mojo/_mlir_interoperability.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability 16.1. __mlir_attr 16.2. __mlir_type 16.3. __mlir_op - 16.1. __mlir_attr - 16.2. __mlir_type - 16.3. __mlir_op - About the author - Revision History - 16.1. __mlir_attr - 16.2. __mlir_type - 16.3. __mlir_op ## 16. MLIR interoperability Mojo supports ahead-of-time compilation. This means that we can run Mojo compiler over our source code to generate the machine code that gets executed on the computer. For a developer it may look as if Mojo reads the source code and directly generates the machine code. However, like many modern compilers, Mojo creates an intermediate representation of our source code before it generates the machine code. This intermediate representation (IR) is a simplified form of the program, which is easier to optimize and reason about. Many compilers use IRs that are custom built for the language supported by the compiler. Mojo does not have its own IR infrastructure, instead it uses Multi-Level Intermediate Representation (MLIR). Unlike other language IRs, MLIR is designed to be extensible and is capable of supporting many programming languages and different types of processors. The extensibility of MLIR revolves around the ability to define custom dialects and operations within it. Dialects can be thought of as a namespace for a set of operations representing a particular aspect of a program. Operations represent a computation or a level of abstraction. Operations take operands (think of them as arguments) and produces results. Operations also take attributes, which are compile-time values such as constants. Attributes, operands and results have types associated with them. There is much more to MLIR than described here, but it is out of scope of this book. Though MLIR comes with its own textual representation that is used by the MLIR compiler infrastructure, Mojo exposes MLIR elements through its own syntax. The following code listing shows an example where MLIR types, attributes and operations are being used. ```mojo alias _0 = __mlir_attr.`0:i1` alias _1 = __mlir_attr.`1:i1` struct BitList(Stringable): var value: List[__mlir_type.i1] fn __init__(inout self, *values: __mlir_type.i1): self.value = List[__mlir_type.i1]() for i in values: self.value.append(i) fn __str__(self) -> String: var s = String("0b") for i in self.value: s += String(Int(__mlir_op.`index.castu`[_type=__mlir_type.index](i[]))) return s fn main(): print(BitList(_0, _1, _0, _1)) ``` At first, the code listing may look a bit strange. Mojo’s MLIR elements start with __mlir. There are three different elements: __mlir_attr, __mlir_type and __mlir_op. ### 16.1. __mlir_attr As the name suggests, __mlir_attr provides ability to define a MLIR attribute (similar to a compile-time constant) along with its data type. ```mojo alias _0 = __mlir_attr.`0:i1` ``` Here we are declaring an alias with an MLIR constant value 0 of MLIR type i1. If we do not provide i1, it will be assumed to be i64. ### 16.2. __mlir_type The __mlir_type provides ability to refer to a given MLIR type. ```mojo var value: List[__mlir_type.i1] ``` Here we are declaring a list with contents of type i1. ### 16.3. __mlir_op The __mlir_op provides ability to refer to a MLIR operation. ```mojo s += String(Int(__mlir_op.`index.castu`[_type=__mlir_type.index](i[]))) ``` Here we are executing a casting operation from i1 to index type. Since Mojo’s Int type has a constructor that takes in MLIR index type, we are able to instantiate an Int value. Note that MLIR operation has the form <dialect>.<op>. Since MOJO does not allow its identifiers to have . in the name, we have to use backticks `` to be able to use a non-standard identifier. The following diagram shows roughly how MLIR textual format maps to the Mojo source code representation. ← Previous: Python interoperability | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: About the author → ================================================================================ URL: https://ruhati.net/mojo/_about_the_author.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History ## About the author Indukumar has more than 25 years of experience in software development, architecture and management. During his career he has designed and developed many applications in different domains, ranging from travel portals to financial product management systems. Indukumar Vellapillil Hari resides in Zurich, Switzerland with his family. ← Previous: MLIR interoperability | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Revision History → ================================================================================ URL: https://ruhati.net/mojo/_revision_history.html # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History ## Revision History Draft Release: Slices, Python interop, MLIR 31 May, 2024 Draft Release 15 May, 2024 Copyright © 2024 Indukumar Vellapillil Hari ← Previous: About the author | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language ================================================================================ URL: https://ruhati.net/mojo/_getting_started.html#_getting_mojo # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started 2.1. Getting Mojo 2.2. Hello World 2.3. Dissecting the program 2.4. Compiler - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler ## 2. Getting started ### 2.1. Getting Mojo ### 2.2. Hello World It is a time honored tradition to start learning a programming language with a program printing "Hello, World!". Let’s start with that. Please open a text editor of your choice and type the following and save the file as hello_world.mojo. The name of the file does not matter as long as you pass the same file to the compiler. ```mojo def main(): print("Hello, World!") ``` Now open a command line program and enter the following in its terminal. mojo hello_world.mojo You should see the following in the terminal. ```mojo Hello, World! ``` Congrats! You have executed your first Mojo program! Mojo also supports file extension other than ".mojo". Instead of saving the file as hello_world.mojo, you can save it as hello_world.🔥 and run mojo hello_world.🔥. ### 2.3. Dissecting the program Unlike many other system languages, Mojo has very minimal ceremony to define a simple program like Hello World. The following line (known as a statement) calls a function named print which is provided by Mojo. The text Hello, World! is placed inside double quotes. Any text placed inside double quotes (or single quotes for that matter) is considered by Mojo as a String Literal. Literals are constant values that do not change during the execution of the program and are provided directly to the program source code. In this case, we pass the value "Hello, World!" to the function print. The print function knows how to take that passed value and to bring it into the screen. In the file, there is def main():, which you can ignore for the moment. It will come up later on. In a future release of Mojo, the need for def main(): will be gone. * ### 2.4. Compiler The command mojo hello_world.mojo you executed in the terminal took the Mojo source code and compiled it into a form that can be executed in the computer. The mojo command then directly executes the compiled form. If you do not want to execute immediately the program, and just want to create an executable file, you can use the command mojo build hello_world.mojo. It then creates an executable file in the same directory as the source file. ← Previous: Introduction | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Functions → ================================================================================ URL: https://ruhati.net/mojo/_getting_started.html#_hello_world # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started 2.1. Getting Mojo 2.2. Hello World 2.3. Dissecting the program 2.4. Compiler - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler ## 2. Getting started ### 2.1. Getting Mojo ### 2.2. Hello World It is a time honored tradition to start learning a programming language with a program printing "Hello, World!". Let’s start with that. Please open a text editor of your choice and type the following and save the file as hello_world.mojo. The name of the file does not matter as long as you pass the same file to the compiler. ```mojo def main(): print("Hello, World!") ``` Now open a command line program and enter the following in its terminal. mojo hello_world.mojo You should see the following in the terminal. ```mojo Hello, World! ``` Congrats! You have executed your first Mojo program! Mojo also supports file extension other than ".mojo". Instead of saving the file as hello_world.mojo, you can save it as hello_world.🔥 and run mojo hello_world.🔥. ### 2.3. Dissecting the program Unlike many other system languages, Mojo has very minimal ceremony to define a simple program like Hello World. The following line (known as a statement) calls a function named print which is provided by Mojo. The text Hello, World! is placed inside double quotes. Any text placed inside double quotes (or single quotes for that matter) is considered by Mojo as a String Literal. Literals are constant values that do not change during the execution of the program and are provided directly to the program source code. In this case, we pass the value "Hello, World!" to the function print. The print function knows how to take that passed value and to bring it into the screen. In the file, there is def main():, which you can ignore for the moment. It will come up later on. In a future release of Mojo, the need for def main(): will be gone. * ### 2.4. Compiler The command mojo hello_world.mojo you executed in the terminal took the Mojo source code and compiled it into a form that can be executed in the computer. The mojo command then directly executes the compiled form. If you do not want to execute immediately the program, and just want to create an executable file, you can use the command mojo build hello_world.mojo. It then creates an executable file in the same directory as the source file. ← Previous: Introduction | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Functions → ================================================================================ URL: https://ruhati.net/mojo/_getting_started.html#_dissecting_the_program # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started 2.1. Getting Mojo 2.2. Hello World 2.3. Dissecting the program 2.4. Compiler - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler ## 2. Getting started ### 2.1. Getting Mojo ### 2.2. Hello World It is a time honored tradition to start learning a programming language with a program printing "Hello, World!". Let’s start with that. Please open a text editor of your choice and type the following and save the file as hello_world.mojo. The name of the file does not matter as long as you pass the same file to the compiler. ```mojo def main(): print("Hello, World!") ``` Now open a command line program and enter the following in its terminal. mojo hello_world.mojo You should see the following in the terminal. ```mojo Hello, World! ``` Congrats! You have executed your first Mojo program! Mojo also supports file extension other than ".mojo". Instead of saving the file as hello_world.mojo, you can save it as hello_world.🔥 and run mojo hello_world.🔥. ### 2.3. Dissecting the program Unlike many other system languages, Mojo has very minimal ceremony to define a simple program like Hello World. The following line (known as a statement) calls a function named print which is provided by Mojo. The text Hello, World! is placed inside double quotes. Any text placed inside double quotes (or single quotes for that matter) is considered by Mojo as a String Literal. Literals are constant values that do not change during the execution of the program and are provided directly to the program source code. In this case, we pass the value "Hello, World!" to the function print. The print function knows how to take that passed value and to bring it into the screen. In the file, there is def main():, which you can ignore for the moment. It will come up later on. In a future release of Mojo, the need for def main(): will be gone. * ### 2.4. Compiler The command mojo hello_world.mojo you executed in the terminal took the Mojo source code and compiled it into a form that can be executed in the computer. The mojo command then directly executes the compiled form. If you do not want to execute immediately the program, and just want to create an executable file, you can use the command mojo build hello_world.mojo. It then creates an executable file in the same directory as the source file. ← Previous: Introduction | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Functions → ================================================================================ URL: https://ruhati.net/mojo/_getting_started.html#_compiler # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started 2.1. Getting Mojo 2.2. Hello World 2.3. Dissecting the program 2.4. Compiler - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 2.1. Getting Mojo - 2.2. Hello World - 2.3. Dissecting the program - 2.4. Compiler ## 2. Getting started ### 2.1. Getting Mojo ### 2.2. Hello World It is a time honored tradition to start learning a programming language with a program printing "Hello, World!". Let’s start with that. Please open a text editor of your choice and type the following and save the file as hello_world.mojo. The name of the file does not matter as long as you pass the same file to the compiler. ```mojo def main(): print("Hello, World!") ``` Now open a command line program and enter the following in its terminal. mojo hello_world.mojo You should see the following in the terminal. ```mojo Hello, World! ``` Congrats! You have executed your first Mojo program! Mojo also supports file extension other than ".mojo". Instead of saving the file as hello_world.mojo, you can save it as hello_world.🔥 and run mojo hello_world.🔥. ### 2.3. Dissecting the program Unlike many other system languages, Mojo has very minimal ceremony to define a simple program like Hello World. The following line (known as a statement) calls a function named print which is provided by Mojo. The text Hello, World! is placed inside double quotes. Any text placed inside double quotes (or single quotes for that matter) is considered by Mojo as a String Literal. Literals are constant values that do not change during the execution of the program and are provided directly to the program source code. In this case, we pass the value "Hello, World!" to the function print. The print function knows how to take that passed value and to bring it into the screen. In the file, there is def main():, which you can ignore for the moment. It will come up later on. In a future release of Mojo, the need for def main(): will be gone. * ### 2.4. Compiler The command mojo hello_world.mojo you executed in the terminal took the Mojo source code and compiled it into a form that can be executed in the computer. The mojo command then directly executes the compiled form. If you do not want to execute immediately the program, and just want to create an executable file, you can use the command mojo build hello_world.mojo. It then creates an executable file in the same directory as the source file. ← Previous: Introduction | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Functions → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_def # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_fn # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_benefits_of_fn_over_def # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_benefits_of_def_over_fn # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_mixing_and_matching # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_default_return_types # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_main_function # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_different_styles_of_writing_functions # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_arguments_passed_to_functions # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_nested_functions # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_keyword_arguments # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_functions.html#_default_value # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions 3.1. def 3.2. fn 3.3. Benefits of fn over def 3.4. Benefits of def over fn 3.5. Mixing and matching 3.6. Default return types 3.7. main function 3.8. Different styles of writing functions 3.9. Arguments passed to functions 3.10. Nested functions 3.11. Keyword arguments 3.12. Default value - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 3.1. def - 3.2. fn - 3.3. Benefits of fn over def - 3.4. Benefits of def over fn - 3.5. Mixing and matching - 3.6. Default return types - 3.7. main function - 3.8. Different styles of writing functions - 3.9. Arguments passed to functions - 3.10. Nested functions - 3.11. Keyword arguments - 3.12. Default value ## 3. Functions In the previous chapter you saw how a function print is being called in a program. In order to call a function, the function must be defined somewhere. In Mojo, there are two ways to define a function. The first way would be very familiar to Python developers. The second one is more closer to another language, Rust. ### 3.1. def One way to define a function is by using the keyword def. ```mojo def my_function(text): print(text) def main(): my_function("Hello World!") ``` def function definitions have the least ceremony. For beginners it is the easiest way to define functions and closely resembles how Python functions are defined. In the above code, def my_function(text): defined a function named my_function and declared that it takes an argument text. The following statement my_function("Hello World!") calls that function my_function and passes "Hello World!" as the argument where text was declared. You may have noticed that after def my_function(text):, there is a new line and 4 spaces before the statement print(text). This is because Mojo, like Python, uses whitespace indentation to demarcate the function’s body. Many mainstream programming languages use braces "{}" for function body. However, Mojo uses indented whitespace and is particular about the whitespace being aligned. You will find this syntax not only for function bodies, but also for other statements that expect a block. We will come to those cases in later chapters. Please notice that the statement my_function("Hello World!") appears differently aligned than print(text). This is because my_function("Hello World!") is not part of the `my_function’s body itself. The following illustration shows the simplified structure of a Mojo function. ### 3.2. fn The other way to define is function is by using the keyword fn. ```mojo fn my_function(text: StringLiteral): print(text) fn main(): my_function("Hello World!") ``` While the def based function definitions demands only the most essential elements, the fn based function definitions are more strict in nature. The reason for this is simple. The fn functions are intended to be high performance and for it to be high performant, it needs to provide the Mojo compiler with much more details. The details help the Mojo compiler to create an optimized version of the executable file. What are those details that help Mojo compiler? The main element that helps Mojo compiler is something called the "type" of a variable. In the above example, you see the definition text: StringLiteral. In comparison to the def version of the function, we have a new declaration : StringLiteral. This is called a type annotation. This declaration says that the function argument text will contain only String literals. More importantly, it will never contain any other content than String literals. This gives the Mojo compiler a very important hint. Without such a hint, the Mojo compiler has to accommodate many different scenarios. For example, if we do not declare that the text is of type StringLiteral, it will have to assume that the text may contain numbers or other types of objects. Then it has to generate a very generic executable code that is able to handle many other types of values. However, when we tell Mojo compiler that the text will take only StringLiterals, it can generate a very specific and highly optimized code that handles only StringLiterals. The body of the fn functions are also demarcated by whitespace similar to def functions. The following illustration shows the simplified structure of a fn function. You may have noticed one additional concept that we did not yet touch upon. The return type. Both fn and def functions support returning values from the function. So far we have not used it. However, in many cases we want to call functions to perform calculations and after the calculations are completed, we expect a result as output from the function. The following example shows such a use case. ```mojo def add(a, b): return a + b def main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. The function add took two arguments and performed an addition. Then it returned that result with keyword return, which was then shown on the terminal using the print function. The statement print(add(1, 2)) actually made two function calls. The inner function call add got executed first and then the outer function call print. This is called the nesting of function calls. The result from the inner function call was passed to the outer function call. ```mojo mojo addition_return_def.mojo 3 ``` Now, the same using fn function definition. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2)) ``` If you run the above program, you get the output as 3. Here you may have noticed that the type of the values are being explicitly declared. The arguments passed to the function are both Int types and the return value of the function is also of type Int. The Int type represents all integer values, including both positive and negative values. The actual value is passed during the function call statement (call site). ```mojo mojo addition_return_fn.mojo 3 ``` In case of fn function, we indicated in the function definition that the function will return a value of type Int. ### 3.3. Benefits of fn over def As mentioned earlier, one of the benefits of using fn is to provide information to the compiler that would be used by the compiler to produce a highly performance code. The second benefit is to enforce program correctness. Let’s look into the following program. ```mojo def add(a, b): return a + b def main(): print(add(1, 1.5)) ``` When you execute the above program, you would see the result as 2.5. Behind the scenes, the expression add(1, 1.5) added two different types. The first argument was of type Int and the second argument was of type Float. The addition’s result is of type Float. I am glossing over when I say that 1.5 is a Float. Since it is provided in the source code directly, its actual type is FloatLiteral. The above program worked fine for us. But what if we wanted to restrict addition to only integers? How can we prevent someone from passing Float values to add function? The answer is by using fn. ```mojo fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(add(1, 2.5)) ``` If you now execute the above program, you would get a compiler error (you may have slightly different error message depending upon the version of the Mojo compiler used). ```mojo addition_return_fn_2.mojo:4:21: error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` The Mojo compiler complains because we have strictly restricted the argument type of b to Int and Mojo compiler cannot convert the passed value to Int. You have a guarantee from the Mojo compiler that only those values that can be converted safely into Int will be allowed to be passed. We say that the Mojo compiler ensures type safety when we use fn. ### 3.4. Benefits of def over fn If fn is safer than def, then why should we use def at all? def has its uses. For example, if you want to prototype something and you are not sure what types to use, you can leave that decision for a later time and focus on the algorithm itself. Sometimes you really need the flexibility and dynamism of Python. In this case, def is the most appropriate way to go. Mojo treats both def and fn styles as first class and both of them are useful in different contexts. ### 3.5. Mixing and matching Although def does not require you to provide types, it does not prevent you from declaring types. For example, the following will have the same effect as the above mentioned fn version. You may wonder what is the type of a in the def function. Its type is object. All values that do not have an explicit type is by default assigned as object type in Mojo. We will come back to it in detail later on in subsequent chapters. ```mojo def add(a, b: Int): return a + b def main(): print(add(1, 1.5)) ``` ```mojo error: invalid call to 'add': argument #1 cannot be converted from 'FloatLiteral' to 'Int' ``` ### 3.6. Default return types In the def function, when you omit the return type annotations then Mojo assumes that the return type is object. However, in fn functions, when you omit the return type, then Mojo defaults to None, which indicates that there is no value being returned. ### 3.7. main function There is a special function called main in Mojo, which is the function that is used by the compiler to determine the main entrance of a program. When you call a program executable created by Mojo, the very first function that is executed is the main function. ```mojo def main(): print("Hello World!") ``` If you execute the above program, the main function will be called automatically and the text Hello World! will be printed. ### 3.8. Different styles of writing functions A function can be defined in different styles. ```mojo def func1(r): ... def func2(): pass def func3(): print("Hello World!"); print("Good bye!") def func4(): pass def main(): ... ``` Note that all the above style is also valid for fn functions. fn functions are the same as def functions, except for the difference that it demands type annotations. You can define the function body in the same line as the function definition only if the whole body is just a single line. #### 3.8.1. Semicolon In the source code shown above, you may have noticed a semicolon in the body of function func3. Semicolon can be used to separate statements, which allow the statements to be written in a single line. Mojo follows the philosophy of Python, so use semicolon sparingly and only when it improves reading and understanding of code. #### 3.8.2. Ellipses in functions In Mojo you would often see …​ defined in the function body. Ellipsis is just a built-in constant in Mojo, and is a placeholder. Within a function, it just means that the body is not yet implemented and the Mojo compiler will not complain about the missing body. Ellipses have other uses and we will cover them in subsequent chapters. #### 3.8.3. pass in functions The pass keyword has a similar role as …​ in functions. It particularly tells the compiler that the implementation has been omitted. One good rule of thumb is to use pass where you know that there is no need for an implementation and use …​ when you are expecting some implementation in the future (or in inherited entities - we will come to that later). ### 3.9. Arguments passed to functions Arguments passed to a function cannot be modified within the function. Such arguments are said to be immutable as the function body cannot modify their value. This kind of restriction is helpful in large programs as the code that calls the function does not get surprised that the value it passed to a function has suddenly changed unexpectedly. ```mojo fn add(a: Int, b: Int) -> Int: a = a + 1 return a + b fn main(): print(add(1, 2)) ``` Executing the above listed code results in compilation error. ```mojo error: expression must be mutable in assignment a = a + 1 ^ mojo: error: failed to parse the provided Mojo ``` ### 3.10. Nested functions Mojo supports nesting of function within other functions. This applies to both fn and def style functions. Nesting of functions limit the scope of the nested function to just the outer function. For example in the following code listing, it is not possible to call nested within main. ```mojo fn outer(): fn nested(): print("I am nested") nested() fn main(): outer() ``` ### 3.11. Keyword arguments Sometimes when functions take lots of arguments, it is much more clear if the name of the argument is specified when calling the function. Mojo supports keyword arguments, which is basically the ability to specify the argument name when we assign a value to that argument during a function call. ```mojo fn my_function(first: Int, second: Int) -> Int: return first + second fn main(): print(my_function(first = 1, second = 2)) print(my_function(second = 2, first = 3)) print(my_function(4, second = 5)) ``` In the previous listing, we can see there are three different ways to call the function with keyword arguments. The first one specifies the name of the both arguments when passing the value. The second call demonstrates that when using the keyword arguments, the order of the arguments does not matter, as Mojo knows with the name itself which argument gets which value. In the third call, we see that we can mix and match positional argument with the keyword argument; however, here the order is important as the positional values must appear in the order in which they were declared in the function definition. Keyword arguments follow positional arguments. What if you as an API designer want some arguments to be always specified positionally? In this case, you can enforce positional arguments by using a special argument, /. ```mojo fn my_function2(first: Int, second: Int, /) -> Int: return first + second fn main(): print(my_function2(first=1, second=2)) # compiler error ``` Executing the above listed code results in compilation error. ```mojo error: invalid call to 'my_function2': positional-only arguments passed as keyword operands: 'first', 'second' ``` You can also mix and match position-only arguments with keyword arguments. The / can be the last argument, in which case all the function arguments would be position-only. It cannot be the first argument though. ```mojo fn my_function(first: Int, second: Int, /, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, 2, third=3)) print(my_function(1, 2, 3)) ``` Here the first two arguments are strictly position-only, while the third can be passed as keyword or positional as desired. What if you wanted some arguments to be always keyword only? In this case, you can enforce keyword arguments by using the special argument, *. ```mojo fn my_function(first: Int, *, second: Int, third: Int) -> Int: return first + second + third fn main(): print(my_function(1, second=2, third=3)) #print(my_function(1, 2, 3)) # Uncommenting would result in compiler error. ``` Similar to /, you can also mix and match keyword-only arguments with positional arguments. The * can be the first argument, in which case all the function arguments would be keyword-only. It cannot be the last argument though. Keyword arguments make APIs ergonomic, as the programmer does not have to remember in which position what value need to be passed. It improves code readability and maintainability. It also reduces accidental mistakes when programmer wrongly assumes the order of the arguments. Keyword arguments are applicable for both def and fn forms. ### 3.12. Default value Mojo allows assigning default values to function arguments, which means when the caller does not pass a value to the argument, the function will take the given default value. That function argument therefore becomes optional for the caller. The default value must be of the same data type as the declared data type of the argument. This feature is quite useful when defining ergonomic APIs, providing sensible default values for the caller, making the function easier to use. ```mojo fn deft_function(first: Int, second: Int = 10) -> Int: return first + second fn main(): print(deft_function(1)) # 'second' defaults to '10' print(deft_function(1, 2)) ``` Default values are applicable for both def and fn forms. ← Previous: Getting started | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Constants and variables → ================================================================================ URL: https://ruhati.net/mojo/_constants_and_variables.html#_constants # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables 4.1. Constants 4.2. Variables 4.3. Alias 4.4. Undeclared variables 4.5. Variable scoping 4.6. Non-standard identifiers - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers ## 4. Constants and variables Sometimes you need to store a value before it can be used in a function. Mojo offers two ways to store a value for later use. One is the concept called a constant and the other one is variable. ### 4.1. Constants Suppose you have two functions, one that calculates circumference of a circle and the other that calculates the area of a circle. ```mojo def circumference(r): return 2 * 3.14 * r def area(r): return 3.14 * r * r def main(): print(circumference(25)) print(area(25)) ``` In the above example, the PI has been limited to 2 decimal places. What if we want to increase our precision and increase the PI to 4 decimal places? Then we need to change both the functions circumference and area. An alternative is to define PI as a constant using the keyword alias. ```mojo alias PI = 3.14 def circumference(r): return 2 * PI * r def area(r): return PI * r * r def main(): print(circumference(25)) print(area(25)) ``` The result of both the programs are the same. However, we have now defined PI in one single place and we can change its value in just one place and the updated value is reflected wherever the constant PI is referred. The main benefit of a constant is that the compiler prevents any attempt to change the initially assigned value during the program execution. ```mojo fn main(): alias counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` For example, executing the above program results in: ```mojo error: expression must be mutable in assignment counter = counter + 3 ^~~~~~~ mojo: error: failed to parse the provided Mojo ``` ### 4.2. Variables In contrast to the constants, values stored within variables are expected to change during the program execution. An example could be a counter which gets updated each time a user clicks a button. ```mojo fn main(): var counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` If you execute the above program, you would see the result: ```mojo 1 4 ``` The statement var counter: Int = 1 assigned the value 1 to the variable called counter. The keyword var declares that counter is a variable. The statement counter = counter + 3 adds value 3 to counter, resulting in value 4. You do not always need to initialize a variable with value. You can also just write var counter: Int and initialize its value later when needed. However, ensure that you initialize a variable before first use of that variable, otherwise you will encounter a compilation error. ```mojo fn main(): var counter: Int print(counter) counter = counter + 3 print(counter) ``` Results in: ```mojo error: use of uninitialized value 'counter' print(counter) ^ ``` The solution to above is to assign a value to counter before printing it. ### 4.3. Alias The alias feature provided by Mojo is much more powerful than just declaring constants. In fact, it enforces compile time execution of statements that come on the right hand side of the = symbol. ```mojo alias MY_VALUE = add(2, 3) fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(MY_VALUE) ``` In the code sample shown above, you see that Mojo allows compile time execution of a normal function. Executing the program results in the printing of the value 5 on screen. There are some restrictions on what type of functions can be called during compile time. For example, def style functions cannot be called during compile time. Another restriction is that function that are called during compile must not have any side effects. That is, the functions must use only the arguments passed to it and must not change any variables or state outside of the function body. These kind of functions are called pure functions. You can also assign types to alias as shown in the next example. ```mojo alias MyInt = Int fn add(a: MyInt, b: MyInt) -> MyInt: return a + b fn main(): print(add(1, 2)) ``` In the previous example, the MyInt is exactly the same as Int, just with a different name. ### 4.4. Undeclared variables Mojo allows variables to be defined without the var keyword. However, that works only within def functions. fn functions are strict regarding declaration of variables and require var keyword. ```mojo def main(): counter = 1 print(counter) counter = counter + 3 print(counter) ``` ### 4.5. Variable scoping Scoping of a variable means which part of the program sees what value of the variable, and whether or not the variable is even valid at that location. In Mojo functions, a variable can have either a lexical scope or the function scope. ```mojo def main(): x = 1 y = 1 if True: x = 4 print("inner x:", x) var y = 4 print("inner y:", y) print("outer x:", x) print("outer y:", y) ``` When you execute the code shown above (please ignore the warnings for the moment), you see: ```mojo inner x: 4 inner y: 4 outer x: 4 outer y: 1 ``` If you look carefully, the y declared inside the if block had two different values when printed. The inner block had value 4 and the outer block preserved its original value of 1. The x variable on the other hand got overwritten by newer value 4. What happened is that the inner scope from the if block declared a new variable using var keyword. This shadowed the outer variable declaration, resulting in inner scoped variable being different from the outer one, even though the name of the variable was the same. In case of x, no such re-declaration happened, so the scope of x was for the whole function. The var declaration caused y to be lexically scoped within the if block. ### 4.6. Non-standard identifiers As mentioned in the beginning of the book, Mojo is a superset of Python. However, there are Mojo keywords that are valid Python identifiers. Since Mojo aims to be compatible with Python, Mojo allows for such variables to be defined within backticks ``. In fact, any kind of text could be used as a variable or function name in Mojo if it is within backticks. ```mojo fn main(): var `var` : Int = 1 var `with space`: Int = 2 fn `with#symbol`() -> Int: return 3 print(`var`) print(`with space`) print(`with#symbol`()) ``` ← Previous: Functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Types → ================================================================================ URL: https://ruhati.net/mojo/_constants_and_variables.html#_variables # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables 4.1. Constants 4.2. Variables 4.3. Alias 4.4. Undeclared variables 4.5. Variable scoping 4.6. Non-standard identifiers - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers ## 4. Constants and variables Sometimes you need to store a value before it can be used in a function. Mojo offers two ways to store a value for later use. One is the concept called a constant and the other one is variable. ### 4.1. Constants Suppose you have two functions, one that calculates circumference of a circle and the other that calculates the area of a circle. ```mojo def circumference(r): return 2 * 3.14 * r def area(r): return 3.14 * r * r def main(): print(circumference(25)) print(area(25)) ``` In the above example, the PI has been limited to 2 decimal places. What if we want to increase our precision and increase the PI to 4 decimal places? Then we need to change both the functions circumference and area. An alternative is to define PI as a constant using the keyword alias. ```mojo alias PI = 3.14 def circumference(r): return 2 * PI * r def area(r): return PI * r * r def main(): print(circumference(25)) print(area(25)) ``` The result of both the programs are the same. However, we have now defined PI in one single place and we can change its value in just one place and the updated value is reflected wherever the constant PI is referred. The main benefit of a constant is that the compiler prevents any attempt to change the initially assigned value during the program execution. ```mojo fn main(): alias counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` For example, executing the above program results in: ```mojo error: expression must be mutable in assignment counter = counter + 3 ^~~~~~~ mojo: error: failed to parse the provided Mojo ``` ### 4.2. Variables In contrast to the constants, values stored within variables are expected to change during the program execution. An example could be a counter which gets updated each time a user clicks a button. ```mojo fn main(): var counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` If you execute the above program, you would see the result: ```mojo 1 4 ``` The statement var counter: Int = 1 assigned the value 1 to the variable called counter. The keyword var declares that counter is a variable. The statement counter = counter + 3 adds value 3 to counter, resulting in value 4. You do not always need to initialize a variable with value. You can also just write var counter: Int and initialize its value later when needed. However, ensure that you initialize a variable before first use of that variable, otherwise you will encounter a compilation error. ```mojo fn main(): var counter: Int print(counter) counter = counter + 3 print(counter) ``` Results in: ```mojo error: use of uninitialized value 'counter' print(counter) ^ ``` The solution to above is to assign a value to counter before printing it. ### 4.3. Alias The alias feature provided by Mojo is much more powerful than just declaring constants. In fact, it enforces compile time execution of statements that come on the right hand side of the = symbol. ```mojo alias MY_VALUE = add(2, 3) fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(MY_VALUE) ``` In the code sample shown above, you see that Mojo allows compile time execution of a normal function. Executing the program results in the printing of the value 5 on screen. There are some restrictions on what type of functions can be called during compile time. For example, def style functions cannot be called during compile time. Another restriction is that function that are called during compile must not have any side effects. That is, the functions must use only the arguments passed to it and must not change any variables or state outside of the function body. These kind of functions are called pure functions. You can also assign types to alias as shown in the next example. ```mojo alias MyInt = Int fn add(a: MyInt, b: MyInt) -> MyInt: return a + b fn main(): print(add(1, 2)) ``` In the previous example, the MyInt is exactly the same as Int, just with a different name. ### 4.4. Undeclared variables Mojo allows variables to be defined without the var keyword. However, that works only within def functions. fn functions are strict regarding declaration of variables and require var keyword. ```mojo def main(): counter = 1 print(counter) counter = counter + 3 print(counter) ``` ### 4.5. Variable scoping Scoping of a variable means which part of the program sees what value of the variable, and whether or not the variable is even valid at that location. In Mojo functions, a variable can have either a lexical scope or the function scope. ```mojo def main(): x = 1 y = 1 if True: x = 4 print("inner x:", x) var y = 4 print("inner y:", y) print("outer x:", x) print("outer y:", y) ``` When you execute the code shown above (please ignore the warnings for the moment), you see: ```mojo inner x: 4 inner y: 4 outer x: 4 outer y: 1 ``` If you look carefully, the y declared inside the if block had two different values when printed. The inner block had value 4 and the outer block preserved its original value of 1. The x variable on the other hand got overwritten by newer value 4. What happened is that the inner scope from the if block declared a new variable using var keyword. This shadowed the outer variable declaration, resulting in inner scoped variable being different from the outer one, even though the name of the variable was the same. In case of x, no such re-declaration happened, so the scope of x was for the whole function. The var declaration caused y to be lexically scoped within the if block. ### 4.6. Non-standard identifiers As mentioned in the beginning of the book, Mojo is a superset of Python. However, there are Mojo keywords that are valid Python identifiers. Since Mojo aims to be compatible with Python, Mojo allows for such variables to be defined within backticks ``. In fact, any kind of text could be used as a variable or function name in Mojo if it is within backticks. ```mojo fn main(): var `var` : Int = 1 var `with space`: Int = 2 fn `with#symbol`() -> Int: return 3 print(`var`) print(`with space`) print(`with#symbol`()) ``` ← Previous: Functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Types → ================================================================================ URL: https://ruhati.net/mojo/_constants_and_variables.html#_alias # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables 4.1. Constants 4.2. Variables 4.3. Alias 4.4. Undeclared variables 4.5. Variable scoping 4.6. Non-standard identifiers - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers ## 4. Constants and variables Sometimes you need to store a value before it can be used in a function. Mojo offers two ways to store a value for later use. One is the concept called a constant and the other one is variable. ### 4.1. Constants Suppose you have two functions, one that calculates circumference of a circle and the other that calculates the area of a circle. ```mojo def circumference(r): return 2 * 3.14 * r def area(r): return 3.14 * r * r def main(): print(circumference(25)) print(area(25)) ``` In the above example, the PI has been limited to 2 decimal places. What if we want to increase our precision and increase the PI to 4 decimal places? Then we need to change both the functions circumference and area. An alternative is to define PI as a constant using the keyword alias. ```mojo alias PI = 3.14 def circumference(r): return 2 * PI * r def area(r): return PI * r * r def main(): print(circumference(25)) print(area(25)) ``` The result of both the programs are the same. However, we have now defined PI in one single place and we can change its value in just one place and the updated value is reflected wherever the constant PI is referred. The main benefit of a constant is that the compiler prevents any attempt to change the initially assigned value during the program execution. ```mojo fn main(): alias counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` For example, executing the above program results in: ```mojo error: expression must be mutable in assignment counter = counter + 3 ^~~~~~~ mojo: error: failed to parse the provided Mojo ``` ### 4.2. Variables In contrast to the constants, values stored within variables are expected to change during the program execution. An example could be a counter which gets updated each time a user clicks a button. ```mojo fn main(): var counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` If you execute the above program, you would see the result: ```mojo 1 4 ``` The statement var counter: Int = 1 assigned the value 1 to the variable called counter. The keyword var declares that counter is a variable. The statement counter = counter + 3 adds value 3 to counter, resulting in value 4. You do not always need to initialize a variable with value. You can also just write var counter: Int and initialize its value later when needed. However, ensure that you initialize a variable before first use of that variable, otherwise you will encounter a compilation error. ```mojo fn main(): var counter: Int print(counter) counter = counter + 3 print(counter) ``` Results in: ```mojo error: use of uninitialized value 'counter' print(counter) ^ ``` The solution to above is to assign a value to counter before printing it. ### 4.3. Alias The alias feature provided by Mojo is much more powerful than just declaring constants. In fact, it enforces compile time execution of statements that come on the right hand side of the = symbol. ```mojo alias MY_VALUE = add(2, 3) fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(MY_VALUE) ``` In the code sample shown above, you see that Mojo allows compile time execution of a normal function. Executing the program results in the printing of the value 5 on screen. There are some restrictions on what type of functions can be called during compile time. For example, def style functions cannot be called during compile time. Another restriction is that function that are called during compile must not have any side effects. That is, the functions must use only the arguments passed to it and must not change any variables or state outside of the function body. These kind of functions are called pure functions. You can also assign types to alias as shown in the next example. ```mojo alias MyInt = Int fn add(a: MyInt, b: MyInt) -> MyInt: return a + b fn main(): print(add(1, 2)) ``` In the previous example, the MyInt is exactly the same as Int, just with a different name. ### 4.4. Undeclared variables Mojo allows variables to be defined without the var keyword. However, that works only within def functions. fn functions are strict regarding declaration of variables and require var keyword. ```mojo def main(): counter = 1 print(counter) counter = counter + 3 print(counter) ``` ### 4.5. Variable scoping Scoping of a variable means which part of the program sees what value of the variable, and whether or not the variable is even valid at that location. In Mojo functions, a variable can have either a lexical scope or the function scope. ```mojo def main(): x = 1 y = 1 if True: x = 4 print("inner x:", x) var y = 4 print("inner y:", y) print("outer x:", x) print("outer y:", y) ``` When you execute the code shown above (please ignore the warnings for the moment), you see: ```mojo inner x: 4 inner y: 4 outer x: 4 outer y: 1 ``` If you look carefully, the y declared inside the if block had two different values when printed. The inner block had value 4 and the outer block preserved its original value of 1. The x variable on the other hand got overwritten by newer value 4. What happened is that the inner scope from the if block declared a new variable using var keyword. This shadowed the outer variable declaration, resulting in inner scoped variable being different from the outer one, even though the name of the variable was the same. In case of x, no such re-declaration happened, so the scope of x was for the whole function. The var declaration caused y to be lexically scoped within the if block. ### 4.6. Non-standard identifiers As mentioned in the beginning of the book, Mojo is a superset of Python. However, there are Mojo keywords that are valid Python identifiers. Since Mojo aims to be compatible with Python, Mojo allows for such variables to be defined within backticks ``. In fact, any kind of text could be used as a variable or function name in Mojo if it is within backticks. ```mojo fn main(): var `var` : Int = 1 var `with space`: Int = 2 fn `with#symbol`() -> Int: return 3 print(`var`) print(`with space`) print(`with#symbol`()) ``` ← Previous: Functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Types → ================================================================================ URL: https://ruhati.net/mojo/_constants_and_variables.html#_undeclared_variables # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables 4.1. Constants 4.2. Variables 4.3. Alias 4.4. Undeclared variables 4.5. Variable scoping 4.6. Non-standard identifiers - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers ## 4. Constants and variables Sometimes you need to store a value before it can be used in a function. Mojo offers two ways to store a value for later use. One is the concept called a constant and the other one is variable. ### 4.1. Constants Suppose you have two functions, one that calculates circumference of a circle and the other that calculates the area of a circle. ```mojo def circumference(r): return 2 * 3.14 * r def area(r): return 3.14 * r * r def main(): print(circumference(25)) print(area(25)) ``` In the above example, the PI has been limited to 2 decimal places. What if we want to increase our precision and increase the PI to 4 decimal places? Then we need to change both the functions circumference and area. An alternative is to define PI as a constant using the keyword alias. ```mojo alias PI = 3.14 def circumference(r): return 2 * PI * r def area(r): return PI * r * r def main(): print(circumference(25)) print(area(25)) ``` The result of both the programs are the same. However, we have now defined PI in one single place and we can change its value in just one place and the updated value is reflected wherever the constant PI is referred. The main benefit of a constant is that the compiler prevents any attempt to change the initially assigned value during the program execution. ```mojo fn main(): alias counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` For example, executing the above program results in: ```mojo error: expression must be mutable in assignment counter = counter + 3 ^~~~~~~ mojo: error: failed to parse the provided Mojo ``` ### 4.2. Variables In contrast to the constants, values stored within variables are expected to change during the program execution. An example could be a counter which gets updated each time a user clicks a button. ```mojo fn main(): var counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` If you execute the above program, you would see the result: ```mojo 1 4 ``` The statement var counter: Int = 1 assigned the value 1 to the variable called counter. The keyword var declares that counter is a variable. The statement counter = counter + 3 adds value 3 to counter, resulting in value 4. You do not always need to initialize a variable with value. You can also just write var counter: Int and initialize its value later when needed. However, ensure that you initialize a variable before first use of that variable, otherwise you will encounter a compilation error. ```mojo fn main(): var counter: Int print(counter) counter = counter + 3 print(counter) ``` Results in: ```mojo error: use of uninitialized value 'counter' print(counter) ^ ``` The solution to above is to assign a value to counter before printing it. ### 4.3. Alias The alias feature provided by Mojo is much more powerful than just declaring constants. In fact, it enforces compile time execution of statements that come on the right hand side of the = symbol. ```mojo alias MY_VALUE = add(2, 3) fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(MY_VALUE) ``` In the code sample shown above, you see that Mojo allows compile time execution of a normal function. Executing the program results in the printing of the value 5 on screen. There are some restrictions on what type of functions can be called during compile time. For example, def style functions cannot be called during compile time. Another restriction is that function that are called during compile must not have any side effects. That is, the functions must use only the arguments passed to it and must not change any variables or state outside of the function body. These kind of functions are called pure functions. You can also assign types to alias as shown in the next example. ```mojo alias MyInt = Int fn add(a: MyInt, b: MyInt) -> MyInt: return a + b fn main(): print(add(1, 2)) ``` In the previous example, the MyInt is exactly the same as Int, just with a different name. ### 4.4. Undeclared variables Mojo allows variables to be defined without the var keyword. However, that works only within def functions. fn functions are strict regarding declaration of variables and require var keyword. ```mojo def main(): counter = 1 print(counter) counter = counter + 3 print(counter) ``` ### 4.5. Variable scoping Scoping of a variable means which part of the program sees what value of the variable, and whether or not the variable is even valid at that location. In Mojo functions, a variable can have either a lexical scope or the function scope. ```mojo def main(): x = 1 y = 1 if True: x = 4 print("inner x:", x) var y = 4 print("inner y:", y) print("outer x:", x) print("outer y:", y) ``` When you execute the code shown above (please ignore the warnings for the moment), you see: ```mojo inner x: 4 inner y: 4 outer x: 4 outer y: 1 ``` If you look carefully, the y declared inside the if block had two different values when printed. The inner block had value 4 and the outer block preserved its original value of 1. The x variable on the other hand got overwritten by newer value 4. What happened is that the inner scope from the if block declared a new variable using var keyword. This shadowed the outer variable declaration, resulting in inner scoped variable being different from the outer one, even though the name of the variable was the same. In case of x, no such re-declaration happened, so the scope of x was for the whole function. The var declaration caused y to be lexically scoped within the if block. ### 4.6. Non-standard identifiers As mentioned in the beginning of the book, Mojo is a superset of Python. However, there are Mojo keywords that are valid Python identifiers. Since Mojo aims to be compatible with Python, Mojo allows for such variables to be defined within backticks ``. In fact, any kind of text could be used as a variable or function name in Mojo if it is within backticks. ```mojo fn main(): var `var` : Int = 1 var `with space`: Int = 2 fn `with#symbol`() -> Int: return 3 print(`var`) print(`with space`) print(`with#symbol`()) ``` ← Previous: Functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Types → ================================================================================ URL: https://ruhati.net/mojo/_constants_and_variables.html#_variable_scoping # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables 4.1. Constants 4.2. Variables 4.3. Alias 4.4. Undeclared variables 4.5. Variable scoping 4.6. Non-standard identifiers - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers ## 4. Constants and variables Sometimes you need to store a value before it can be used in a function. Mojo offers two ways to store a value for later use. One is the concept called a constant and the other one is variable. ### 4.1. Constants Suppose you have two functions, one that calculates circumference of a circle and the other that calculates the area of a circle. ```mojo def circumference(r): return 2 * 3.14 * r def area(r): return 3.14 * r * r def main(): print(circumference(25)) print(area(25)) ``` In the above example, the PI has been limited to 2 decimal places. What if we want to increase our precision and increase the PI to 4 decimal places? Then we need to change both the functions circumference and area. An alternative is to define PI as a constant using the keyword alias. ```mojo alias PI = 3.14 def circumference(r): return 2 * PI * r def area(r): return PI * r * r def main(): print(circumference(25)) print(area(25)) ``` The result of both the programs are the same. However, we have now defined PI in one single place and we can change its value in just one place and the updated value is reflected wherever the constant PI is referred. The main benefit of a constant is that the compiler prevents any attempt to change the initially assigned value during the program execution. ```mojo fn main(): alias counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` For example, executing the above program results in: ```mojo error: expression must be mutable in assignment counter = counter + 3 ^~~~~~~ mojo: error: failed to parse the provided Mojo ``` ### 4.2. Variables In contrast to the constants, values stored within variables are expected to change during the program execution. An example could be a counter which gets updated each time a user clicks a button. ```mojo fn main(): var counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` If you execute the above program, you would see the result: ```mojo 1 4 ``` The statement var counter: Int = 1 assigned the value 1 to the variable called counter. The keyword var declares that counter is a variable. The statement counter = counter + 3 adds value 3 to counter, resulting in value 4. You do not always need to initialize a variable with value. You can also just write var counter: Int and initialize its value later when needed. However, ensure that you initialize a variable before first use of that variable, otherwise you will encounter a compilation error. ```mojo fn main(): var counter: Int print(counter) counter = counter + 3 print(counter) ``` Results in: ```mojo error: use of uninitialized value 'counter' print(counter) ^ ``` The solution to above is to assign a value to counter before printing it. ### 4.3. Alias The alias feature provided by Mojo is much more powerful than just declaring constants. In fact, it enforces compile time execution of statements that come on the right hand side of the = symbol. ```mojo alias MY_VALUE = add(2, 3) fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(MY_VALUE) ``` In the code sample shown above, you see that Mojo allows compile time execution of a normal function. Executing the program results in the printing of the value 5 on screen. There are some restrictions on what type of functions can be called during compile time. For example, def style functions cannot be called during compile time. Another restriction is that function that are called during compile must not have any side effects. That is, the functions must use only the arguments passed to it and must not change any variables or state outside of the function body. These kind of functions are called pure functions. You can also assign types to alias as shown in the next example. ```mojo alias MyInt = Int fn add(a: MyInt, b: MyInt) -> MyInt: return a + b fn main(): print(add(1, 2)) ``` In the previous example, the MyInt is exactly the same as Int, just with a different name. ### 4.4. Undeclared variables Mojo allows variables to be defined without the var keyword. However, that works only within def functions. fn functions are strict regarding declaration of variables and require var keyword. ```mojo def main(): counter = 1 print(counter) counter = counter + 3 print(counter) ``` ### 4.5. Variable scoping Scoping of a variable means which part of the program sees what value of the variable, and whether or not the variable is even valid at that location. In Mojo functions, a variable can have either a lexical scope or the function scope. ```mojo def main(): x = 1 y = 1 if True: x = 4 print("inner x:", x) var y = 4 print("inner y:", y) print("outer x:", x) print("outer y:", y) ``` When you execute the code shown above (please ignore the warnings for the moment), you see: ```mojo inner x: 4 inner y: 4 outer x: 4 outer y: 1 ``` If you look carefully, the y declared inside the if block had two different values when printed. The inner block had value 4 and the outer block preserved its original value of 1. The x variable on the other hand got overwritten by newer value 4. What happened is that the inner scope from the if block declared a new variable using var keyword. This shadowed the outer variable declaration, resulting in inner scoped variable being different from the outer one, even though the name of the variable was the same. In case of x, no such re-declaration happened, so the scope of x was for the whole function. The var declaration caused y to be lexically scoped within the if block. ### 4.6. Non-standard identifiers As mentioned in the beginning of the book, Mojo is a superset of Python. However, there are Mojo keywords that are valid Python identifiers. Since Mojo aims to be compatible with Python, Mojo allows for such variables to be defined within backticks ``. In fact, any kind of text could be used as a variable or function name in Mojo if it is within backticks. ```mojo fn main(): var `var` : Int = 1 var `with space`: Int = 2 fn `with#symbol`() -> Int: return 3 print(`var`) print(`with space`) print(`with#symbol`()) ``` ← Previous: Functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Types → ================================================================================ URL: https://ruhati.net/mojo/_constants_and_variables.html#_non_standard_identifiers # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables 4.1. Constants 4.2. Variables 4.3. Alias 4.4. Undeclared variables 4.5. Variable scoping 4.6. Non-standard identifiers - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 4.1. Constants - 4.2. Variables - 4.3. Alias - 4.4. Undeclared variables - 4.5. Variable scoping - 4.6. Non-standard identifiers ## 4. Constants and variables Sometimes you need to store a value before it can be used in a function. Mojo offers two ways to store a value for later use. One is the concept called a constant and the other one is variable. ### 4.1. Constants Suppose you have two functions, one that calculates circumference of a circle and the other that calculates the area of a circle. ```mojo def circumference(r): return 2 * 3.14 * r def area(r): return 3.14 * r * r def main(): print(circumference(25)) print(area(25)) ``` In the above example, the PI has been limited to 2 decimal places. What if we want to increase our precision and increase the PI to 4 decimal places? Then we need to change both the functions circumference and area. An alternative is to define PI as a constant using the keyword alias. ```mojo alias PI = 3.14 def circumference(r): return 2 * PI * r def area(r): return PI * r * r def main(): print(circumference(25)) print(area(25)) ``` The result of both the programs are the same. However, we have now defined PI in one single place and we can change its value in just one place and the updated value is reflected wherever the constant PI is referred. The main benefit of a constant is that the compiler prevents any attempt to change the initially assigned value during the program execution. ```mojo fn main(): alias counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` For example, executing the above program results in: ```mojo error: expression must be mutable in assignment counter = counter + 3 ^~~~~~~ mojo: error: failed to parse the provided Mojo ``` ### 4.2. Variables In contrast to the constants, values stored within variables are expected to change during the program execution. An example could be a counter which gets updated each time a user clicks a button. ```mojo fn main(): var counter: Int = 1 print(counter) counter = counter + 3 print(counter) ``` If you execute the above program, you would see the result: ```mojo 1 4 ``` The statement var counter: Int = 1 assigned the value 1 to the variable called counter. The keyword var declares that counter is a variable. The statement counter = counter + 3 adds value 3 to counter, resulting in value 4. You do not always need to initialize a variable with value. You can also just write var counter: Int and initialize its value later when needed. However, ensure that you initialize a variable before first use of that variable, otherwise you will encounter a compilation error. ```mojo fn main(): var counter: Int print(counter) counter = counter + 3 print(counter) ``` Results in: ```mojo error: use of uninitialized value 'counter' print(counter) ^ ``` The solution to above is to assign a value to counter before printing it. ### 4.3. Alias The alias feature provided by Mojo is much more powerful than just declaring constants. In fact, it enforces compile time execution of statements that come on the right hand side of the = symbol. ```mojo alias MY_VALUE = add(2, 3) fn add(a: Int, b: Int) -> Int: return a + b fn main(): print(MY_VALUE) ``` In the code sample shown above, you see that Mojo allows compile time execution of a normal function. Executing the program results in the printing of the value 5 on screen. There are some restrictions on what type of functions can be called during compile time. For example, def style functions cannot be called during compile time. Another restriction is that function that are called during compile must not have any side effects. That is, the functions must use only the arguments passed to it and must not change any variables or state outside of the function body. These kind of functions are called pure functions. You can also assign types to alias as shown in the next example. ```mojo alias MyInt = Int fn add(a: MyInt, b: MyInt) -> MyInt: return a + b fn main(): print(add(1, 2)) ``` In the previous example, the MyInt is exactly the same as Int, just with a different name. ### 4.4. Undeclared variables Mojo allows variables to be defined without the var keyword. However, that works only within def functions. fn functions are strict regarding declaration of variables and require var keyword. ```mojo def main(): counter = 1 print(counter) counter = counter + 3 print(counter) ``` ### 4.5. Variable scoping Scoping of a variable means which part of the program sees what value of the variable, and whether or not the variable is even valid at that location. In Mojo functions, a variable can have either a lexical scope or the function scope. ```mojo def main(): x = 1 y = 1 if True: x = 4 print("inner x:", x) var y = 4 print("inner y:", y) print("outer x:", x) print("outer y:", y) ``` When you execute the code shown above (please ignore the warnings for the moment), you see: ```mojo inner x: 4 inner y: 4 outer x: 4 outer y: 1 ``` If you look carefully, the y declared inside the if block had two different values when printed. The inner block had value 4 and the outer block preserved its original value of 1. The x variable on the other hand got overwritten by newer value 4. What happened is that the inner scope from the if block declared a new variable using var keyword. This shadowed the outer variable declaration, resulting in inner scoped variable being different from the outer one, even though the name of the variable was the same. In case of x, no such re-declaration happened, so the scope of x was for the whole function. The var declaration caused y to be lexically scoped within the if block. ### 4.6. Non-standard identifiers As mentioned in the beginning of the book, Mojo is a superset of Python. However, there are Mojo keywords that are valid Python identifiers. Since Mojo aims to be compatible with Python, Mojo allows for such variables to be defined within backticks ``. In fact, any kind of text could be used as a variable or function name in Mojo if it is within backticks. ```mojo fn main(): var `var` : Int = 1 var `with space`: Int = 2 fn `with#symbol`() -> Int: return 3 print(`var`) print(`with space`) print(`with#symbol`()) ``` ← Previous: Functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Types → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_bool # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_int # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_intliteral # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_string # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_stringliteral # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_floatliteral # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_float16 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_float32 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_float64 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_int8 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_uint8 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_int16 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_uint16 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_int32 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_uint32 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_int64 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_uint64 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_bfloat16 # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_simd # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_dtype # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_type_safety # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_object # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_tuple # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_listliteral # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_dictliteral # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_types.html#_type_inference # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types 5.1. Bool 5.2. Int 5.3. IntLiteral 5.4. String 5.5. StringLiteral 5.6. FloatLiteral 5.7. Float16 5.8. Float32 5.9. Float64 5.10. Int8 5.11. UInt8 5.12. Int16 5.13. UInt16 5.14. Int32 5.15. UInt32 5.16. Int64 5.17. UInt64 5.18. BFloat16 5.19. SIMD 5.20. DType 5.21. Type safety 5.22. object 5.23. Tuple 5.24. ListLiteral 5.25. DictLiteral 5.26. Type inference - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 5.1. Bool - 5.2. Int - 5.3. IntLiteral - 5.4. String - 5.5. StringLiteral - 5.6. FloatLiteral - 5.7. Float16 - 5.8. Float32 - 5.9. Float64 - 5.10. Int8 - 5.11. UInt8 - 5.12. Int16 - 5.13. UInt16 - 5.14. Int32 - 5.15. UInt32 - 5.16. Int64 - 5.17. UInt64 - 5.18. BFloat16 - 5.19. SIMD - 5.20. DType - 5.21. Type safety - 5.22. object - 5.23. Tuple - 5.24. ListLiteral - 5.25. DictLiteral - 5.26. Type inference ## 5. Types Mojo provides quite a number of data types out of the box for our use. Some of those types are described below. ### 5.1. Bool The simplest of all types, a Bool represents values True or False. Bool value stores exactly one bit, either 1 representing the value True or 0 representing the value False. True and False are builtin constants in Mojo, and are treated as keywords. ```mojo var bool_value: Bool = True ``` ### 5.2. Int Int is one of the most used data types in programming. It represents a mathematical integer, however, there are limitations on how big a value it can store. The Int type in Mojo is a builtin type and its size depends on the CPU architecture your program is running on. For a 64 bit architecture, the Int type in Mojo has size 64 bits; whereas for a 32 bit architecture, it would be 32 bit. How big a number can fit in integer types depends on whether that integer is a "signed" or "unsigned". A signed integer means that contains both negative and positive values. An unsigned integer does not allow any negative values. Int is a signed integer and therefore in a 64 bit CPU architecture, it allows values of range from -9,223,372,036,854,775,808 until 9,223,372,036,854,775,807, both inclusive. An unsigned 64 bit integer on the other hand would have the range 0 through 18,446,744,073,709,551,615. ```mojo var int_value: Int = 42 ``` ### 5.3. IntLiteral IntLiteral is the type when you provide an integer value directly in source code. It has infinite precision, but cannot currently be represented at runtime when the value is higher than the one supported by Int. Mojo allows underscore character "_" to as a separator for int literals to make it easy to read large numbers. ```mojo var int_lit: IntLiteral = 10_000 ``` In the code below, you can see that a very large value is being operated upon using a floor division (we will cover floor division later when we cover operators). This is one of the benefits of using IntLiterals as the compile time calculations can be done on a very large precision. When you execute the code, it will print 10000. ```mojo print(9999999999999999999999999999999999999999999//999999999999999999999999999999999999999) ``` IntLiterals can be assigned to Int types. Vice versa is not possible, as the value for IntLiterals come from the Mojo source code. Value for the Int may come from other sources such as files, network or source code. This holds true for all other literal types in Mojo. ### 5.4. String String is also one of the most used data types in programming. It is a sequence of Unicode characters representing a given text. Unicode is a text encoding standard maintained by the Unicode Consortium and consists of more than hundred thousand codes representing characters in almost all of the world’s writing systems. Since String abstracts over a sequence of Unicode characters, when you determine the length of a String, it will return the count of characters (grapheme clusters to be precise). However, to store or transport such a String we need to represent that String as a sequence of bytes. A popular character representation format is UTF-8, which uses one or more bytes per character depending on the Unicode code point (an integer value designated to represent the character). When receiving or sending strings over files or network, always ensure that you know what encoding is being used. Quite often subtle defects occur because the programmer expected a different encoding than the one they received. Strings in Mojo are immutable. Any modification of the String actually returns a new String. ```mojo var strg: String = "Hello World!" ``` ### 5.5. StringLiteral When you directly provide strings in source code within double quotes or single quotes the value gets assigned the type StringLiteral. Mojo allows embedding of one type of quote within a string of the other type of quote. For example, you can embed '' within "", and vice versa. However, make sure to use the same type of quotes for beginning and end of the string. ```mojo var strg_lit: StringLiteral = "Hello World!" var strg_lit2: StringLiteral = 'Hello World!' var strg_lit3: StringLiteral = 'Hello "World"!' var strg_lit4: StringLiteral = "Hello 'World'!" ``` You can define multi line strings using three double quotes like """ or three single quotes like '''. Multi line strings will preserve the new line characters and white spaces. ```mojo var strg_lit_multi: StringLiteral = """ Hello World! """ var strg_lit_multi2: StringLiteral = ''' Hello World! ''' var strg_lit_multi3: StringLiteral = ''' Hello """World"""! ''' var strg_lit_multi4: StringLiteral = """ Hello '''World'''! """ ``` StringLiterals can be assigned to String; this is why when you declare a String variable, you are able to pass a string literal in source code to it. ### 5.6. FloatLiteral FloatLiteral is the type that Mojo compiler assigns to a value when you provide a decimal separated numeric value in the source code. The FloatLiteral is "double precision", which is represented with 64 bits. The mantissa part of the value is represented by 52 bits and the exponent part of the value is represented by 11 bits. The last remaining bit is used for sign. ```mojo var float_lit: FloatLiteral = 2.005 ``` ### 5.7. Float16 Float16 is a 16 bit floating point type, also know as "half precision". On some machines lower precision types can be much faster than higher precision types and so are quite useful if high precision is not important in your domain. ```mojo var float_16: Float16 = 1.011 ``` ### 5.8. Float32 Float32 is a 32 bit floating point type, also known as "single precision". This type has 23 bit mantissa, 8 bit exponent and the last bit used for sign. ```mojo var float_32: Float32 = 3.25 ``` ### 5.9. Float64 Float64 is a 64 bit floating point type, also known as "double precision". The 64 bits are distributed as 52 bits for mantissa, 11 bits for exponent and the last bit for sign. This is the same precision that FloatLiteral also has. ```mojo var float_64: Float64 = 5.6 ``` ### 5.10. Int8 Int8 is a signed integer represented with 8 bits. It has the range of values from -128 to 127. Integers represented with low number of bits save space in memory and also can be used to enforce supported range of values. Similar to floats, Int8 reserves one bit to represent a positive or negative sign. ```mojo var int_8: Int8 = -20 ``` ### 5.11. UInt8 Similar to Int8, UInt8 is represented by 8 bits. However, UInt8 is unsigned, meaning it represents only positive integers, including 0. Since it represents only positive integers, the one bit that is usually reserved for sign is free to be used to represent values. Therefore, the range of UInt8 is from 0 to 255. ```mojo var uint_8: UInt8 = 20 ``` ### 5.12. Int16 Int16 is represented with 16 bits. It has a range of values from -32,768 to 32,767. ```mojo var int_16: Int16 = -29 ``` ### 5.13. UInt16 UInt16 is also represented with 16 bits. It has a range of values from 0 to 65,535. ```mojo var uint_16: UInt16 = 34 ``` ### 5.14. Int32 Int32 is represented with 32 bits. It has a range of values from -2,147,483,648 to 2,147,483,647. ```mojo var int_32: Int32 = -78 ``` ### 5.15. UInt32 UInt32 is represented with 32 bits. It has a range of values from 0 to 4,294,967,295. ```mojo var uint_32: UInt32 = 87 ``` ### 5.16. Int64 Int64 is represented with 64 bits. It has a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. ```mojo var int_64: Int64 = -65 ``` ### 5.17. UInt64 UInt64 is represented with 64 bits. It has a range of values from 0 to 18,446,744,073,709,551,615. ```mojo var uint_64: UInt64 = 77 ``` ### 5.18. BFloat16 BFloat16 is represented with 16 bits. It is known as brain floating point. Its main use is in machine learning to increase the performance of ML algorithms. ```mojo //TODO: Uncomment before release: include::{sourcedir}/base_types.mojo[tag=bfloat16] # ``` ### 5.19. SIMD SIMD standards for Single Instruction, Multiple Data. Processors that support SIMD allow for parallel processing of multiple data points using exactly the same instruction. SIMD was initially implemented for super computers but over a period of time, came to be used in desktop computers as multi media consumption on the desktops increased. The main benefit of SIMD is to perform vector and matrix operations, as many times the same operations need to be applied to many elements of those data structures. Mojo provides out of the box support for SIMD. Most of the base types mentioned above are built on top of Mojo’s SIMD type. ```mojo var simd1: SIMD[DType.int8, 4] = SIMD[DType.int8, 4](10) var sc: Int8 = 3 print(simd1 * sc) ``` In the above code, a SIMD vector of 4 elements containing data of type Int8 is instantiated with value 10 assigned to all the elements. Then when we multiply it with a value 3, each of the element is multiplied with that scalar, resulting in [30, 30, 30, 30]. On a supported hardware, just one single instruction will be applied over 4 different elements at the same time to yield the array of resulting values. ### 5.20. DType In the previous example you saw the initiation of a SIMD instance by passing a data type DType.int8. DType in Mojo provides a list of data types that are supported within Mojo. One of the uses of DType data types is to use data types as arguments to functions. DType also provides some operations that help in introspecting at runtime different attributes about the data type. DType is particularly useful in providing compile time optimization by creating specialized code for a particular type. ```mojo fn introspect(type: DType): print("Bit width:", type.bitwidth()) print("Is signed:", type.is_signed()) introspect(DType.float16) ``` In the above example, we can write a generic function that takes any DType and prints its bit width and whether or not it is a signed type. ### 5.21. Type safety Let’s try something. Execute the following code in Mojo. ```mojo def main(): var int_value: Int = "42" ``` Executing the code listed above results in: ```mojo error: cannot implicitly convert 'StringLiteral' value to 'Int' in 'var' initializer var int_value: Int = "42" ``` The reason is simple. Mojo is strongly typed. When you specify that a variable has type Int, then it expects either Int values or values that can be converted to Int. In this particular case, we tried to pass a String literal as Integer, and Mojo compiler did not allow us to do that. If Mojo was not that strict we could end up with defects where we assume a variable of a particular type which in reality it is not. This is of particular concern in large code bases worked on by many people. Now let’s look into the following. ```mojo def main(): var string_val: String = 42 print(string_val) ``` The code shown above compiles and runs successfully and prints 42. The reason is a bit less obvious. The String provides an initializer that takes integer values as input argument. When Mojo compiler encounters incompatible types, but finds such an initializer, it automatically initialize with the passed in value. We will cover initializers later on. ### 5.22. object As you have seen earlier, Mojo is quite strict about types. How about the situation when you do not yet know or do not care about the type of the variable, but still want to perform some computation? Mojo provides object type for such cases. ```mojo fn add(a: object, b: object) raises -> object: return a + b print(add(1, 2.5)) ``` If you execute the above code, you would see the result 3.5 printed on screen. The reason why Mojo did not complain about the type incompatibility of arguments is that the object type has initializers for many builtin data types. Similar to the example mentioned above for String, Mojo calls the appropriate initializer in object corresponding to the type of the given value. If object does not have an initializer for a given type, then a value of that particular type cannot be assigned to variables of object type. In the above case, object has initializers for both Int and FloatLiteral. Mojo then instantiates an object with Int and the other object with FloatLiteral as its underlying value. In case of def functions, when you omit type annotations on variable, argument, return declarations, Mojo automatically assigns it the type object. ### 5.23. Tuple Tuple in Mojo is an ordered sequence of values. A Tuple can have many elements of different types. Mojo uses () to represent Tuple literals in source code. ```mojo var t: Tuple[Int, Bool, Float64] = (1, False, 3.5) ``` The code listed above defines a tuple with elements 1, False and 3.5. You may have noticed that the code above defined some parameters within square brackets. We will come to it in a later chapter. You can also get length of the tuple by using Mojo’s built in function len as seen below. ```mojo print(len(t)) ``` An empty tuple can be defined using just (). ```mojo var e: Tuple = () print(len(e)) ``` Earlier we saw a tuple being declared with Tuple[Int, Bool, Float64]. We can also declare a tuple as (Int, Bool, Float64). Both the declarations are effectively the same. ```mojo var altr: (Int, Bool, Float64) = (1, False, 3.5) print(len(altr)) ``` To get an element of a tuple, you can use subscript operator [] and pass within the square brackets the index. Note that like most other languages, Mojo has a zero based index. The ability to use subscripts also applies to lists. ```mojo var access: (Int, Bool, Float64) = (1, False, 3.5) print("First value", access[0]) ``` In def style functions, you can unpack the values of a tuple into different individual variables. The individual variables will have the right data types according to the values that are assigned. The first variable on the left-hand side gets the first value of the tuple on the right-hand side, the second variable on the left-hand side gets the second value of the tuple on the right-hand side, and so on. ```mojo def multi_vars(): a, b = (1, False) print("Variables a & b:", a, b) multi_vars() ``` ### 5.24. ListLiteral Similar to Tuple, Mojo also provides support for ListLiteral. A ListLiteral can have many elements of different types. Mojo uses [] to represent list literals in source code. ```mojo var l: ListLiteral[Int, Float64] = [1, 3.5] print(len(l)) ``` The code shown before defines a list with elements 1 and 3.5. Same as with Tuple some parameters are defined within square brackets, which we will cover later on. An empty list can be defined using just []. ### 5.25. DictLiteral To get an element of a dictionary, you can use subscript operator []. Within the [] you can pass the key with which the dictionary is indexed. ### 5.26. Type inference In cases where Mojo can infer types for variables, we can omit the type declaration of variables. For example, if a variable is initialized at the time of its declaration, then the Mojo compiler is able to infer the type of the variable. In the following example, even though we do not declare the types of bool_value2 and int_value2, Mojo is able to infer the types as Bool and Int respectively. ```mojo var bool_value2 = True var int_value2 = 1 ``` ← Previous: Constants and variables | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Documenting your code → ================================================================================ URL: https://ruhati.net/mojo/_documenting_your_code.html#_comments # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code 6.1. Comments 6.2. Docstrings - 6.1. Comments - 6.2. Docstrings - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 6.1. Comments - 6.2. Docstrings ## 6. Documenting your code Many software that are built today have source code that are often made up of millions of lines of code. More often than not the software is also worked upon by a large number of programmers. Such large scale development makes it difficult to understand the program without some kind of documentation the describes what it does and why it does what it does. Mojo supports two ways of documenting code. ### 6.1. Comments You can define comments within Mojo source code using the symbol #. Mojo ignores any text that comes after the # until it encounters the end of line. Comments are meant for human consumption and typically explain the context of the code. Comments are discarded by the compiler and do therefore not have any run time presence. ```mojo # This is a comment my_function("Hello World!") # This is an inline comment ``` ### 6.2. Docstrings One of the important type of documentation is describing what a given function does. You can use Mojo comments for this purpose, but Mojo does not distinguish such comments from the ones that are given in other parts of the source code. Mojo does provide a facility to document functions (and other type of declarations). It is called Docstring. In a previous chapter it was mentioned that we can define multi line string literals in Mojo using three double or three single quotes. This type of string literals are used to define Docstring. One requirement for a multi line string literal to be a docstring of a function is that it should be scoped within the function. If it is outside the function, then it is considered to be documentation of the outer scope element. The other requirement is that it should be the first statement in the function body. The text of the multi line string must have at least one full stop. This is because the first sentence of the Docstring is considered as summary of the document and will show up in tooling as such. ```mojo fn my_function(text: StringLiteral): """ This is a doc string summary. And the second line represents more details. """ print(text) ``` You can pass the above program to Mojo’s documentation tooling to generate the documentation. ```mojo mojo doc <filename> ``` You can define file level docstring by writing docstring as the first statement of the file. Such docstring is used to document the module itself. ```mojo """ File level docstring. """ alias x = 42 fn main(): print(x) ``` ← Previous: Types | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Struct → ================================================================================ URL: https://ruhati.net/mojo/_documenting_your_code.html#_docstrings # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code 6.1. Comments 6.2. Docstrings - 6.1. Comments - 6.2. Docstrings - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 6.1. Comments - 6.2. Docstrings ## 6. Documenting your code Many software that are built today have source code that are often made up of millions of lines of code. More often than not the software is also worked upon by a large number of programmers. Such large scale development makes it difficult to understand the program without some kind of documentation the describes what it does and why it does what it does. Mojo supports two ways of documenting code. ### 6.1. Comments You can define comments within Mojo source code using the symbol #. Mojo ignores any text that comes after the # until it encounters the end of line. Comments are meant for human consumption and typically explain the context of the code. Comments are discarded by the compiler and do therefore not have any run time presence. ```mojo # This is a comment my_function("Hello World!") # This is an inline comment ``` ### 6.2. Docstrings One of the important type of documentation is describing what a given function does. You can use Mojo comments for this purpose, but Mojo does not distinguish such comments from the ones that are given in other parts of the source code. Mojo does provide a facility to document functions (and other type of declarations). It is called Docstring. In a previous chapter it was mentioned that we can define multi line string literals in Mojo using three double or three single quotes. This type of string literals are used to define Docstring. One requirement for a multi line string literal to be a docstring of a function is that it should be scoped within the function. If it is outside the function, then it is considered to be documentation of the outer scope element. The other requirement is that it should be the first statement in the function body. The text of the multi line string must have at least one full stop. This is because the first sentence of the Docstring is considered as summary of the document and will show up in tooling as such. ```mojo fn my_function(text: StringLiteral): """ This is a doc string summary. And the second line represents more details. """ print(text) ``` You can pass the above program to Mojo’s documentation tooling to generate the documentation. ```mojo mojo doc <filename> ``` You can define file level docstring by writing docstring as the first statement of the file. Such docstring is used to document the module itself. ```mojo """ File level docstring. """ alias x = 42 fn main(): print(x) ``` ← Previous: Types | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Struct → ================================================================================ URL: https://ruhati.net/mojo/_struct.html#_instance_methods # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct 7.1. Instance methods 7.2. Static methods 7.3. Implicit conversion - 7.1. Instance methods - 7.2. Static methods - 7.3. Implicit conversion - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 7.1. Instance methods - 7.2. Static methods - 7.3. Implicit conversion ## 7. Struct In the previous chapter we saw the different data types supported by Mojo out of the box. But what if you wanted to implement your own data type? Mojo provides struct keyword for that purpose. The term "struct" was popularized by the ALGOL family of languages and is a short form for the term structure. In Mojo, struct allows one to group related values together as a single unit. Members variables of a struct must have type annotation. ```mojo struct Person: var first_name: String var last_name: String fn __init__(inout self): self.first_name = "Mickey" self.last_name = "Mouse" fn get_full_name(self) -> String: return self.first_name + " " + self.last_name ``` The code shown before shows how a struct is defined within Mojo. You start with keyword struct and then give a name for the struct. Then you can define the member variables of the struct. Here we defined first_name and last_name strings. You can also define functions within a struct. Functions defined inside the body of a struct are known as "method". The body of the struct is indented with whitespace. You may have noticed that we have defined a method init. This is the initializer or in other languages known as the constructor. In order for a struct to be used in a program, we need to define a method that initializes the struct. The main responsibility of the initializer is to setup the struct in a valid state and to ensure that all the member variables also have a valid state. If we omit the initializer, the compiler would complain that init is missing. In the init method, the first argument is mandatory and it is named self by convention. It does not really matter whether you call the first argument self or some other name as Mojo would accept any other name. However, Mojo adopts the same convention as Python and calls the first argument self. It is highly recommended to follow that convention as it makes the code easier to read and understand by other programmers. The first argument also has a keyword inout. For init methods, it is mandatory to have inout keyword in front of the first self argument. It indicates to Mojo that the self is mutable reference. We will cover this later on in this book. To refer to the member variables of a strut, we need to prefix the variable with self.. Mojo allows new variables to be defined with the same names if the scope of the variable is different. The prefix self. makes it possible for the Mojo compiler to determine that the struct’s member variable is being referred to and not to another variable of the same name in the function scope. The anatomy of a struct is shown in the following diagram. Syntax to instantiate a struct is quite similar to a function call. In the following code listing an instance of Person is stored in the variable client. ```mojo var client: Person = Person() print(client.get_full_name()) ``` You can define initializers with additional arguments. You can also define more than one initializers. The initializers can be given arguments similar to how arguments are passed to a function. ```mojo struct Person: var first_name: String var last_name: String fn __init__(inout self): self.first_name = "Mickey" self.last_name = "Mouse" fn __init__(inout self, fname: String, lname: String): # Second initializer self.first_name = fname self.last_name = lname fn get_full_name(self) -> String: # Instance method return self.first_name + " " + self.last_name fn main(): var client: Person = Person("Donald", "Duck") # Instantiating Person print(client.get_full_name()) # Calling an instance method ``` ### 7.1. Instance methods As mentioned earlier, a struct can define methods within it. There are two types of methods. One is instance method and the other is static method. Instance methods are called on an instance of the struct. In the previous code listing, get_full_name is an instance method because it the first argument self which is the instance of the struct. It uses self to refer to the instance variables of the struct, for example self.first_name. To call the instance method, we used the syntax client.get_full_name(). Note that even though get_full_name had an argument self passed to it, we do not pass that argument to get_full_name when we call it. What is happening here? One way to look at it is that when we call client.get_full_name(), behind the scene the compiler passes client as the first argument to get_full_name. This syntax is quite popular in many object oriented languages, and since Python has this syntax, Mojo also took it over. ### 7.2. Static methods What if we do not have to refer to instance variables or even other instance methods in our method, but still want to have the method scoped within the struct? In this case Mojo offers static methods. Static methods are very similar to functions and they are within the scope of the struct, but not bound to a particular instance of the struct. Mojo compiler can perform some optimizations to make static method invocations much faster than instance methods. ```mojo struct Vehicle: var model_name: String fn __init__(inout self, model_name: String): self.model_name = model_name fn get_model(self) -> String: return self.model_name @staticmethod fn get_default_model() -> String: return "VW" fn main(): var v: Vehicle = Vehicle("Mercedes") print(v.get_model()) # Call instance method print(Vehicle.get_default_model()) # Call static method print(v.get_default_model()) # Possible, but not a good style to call static method. print(Vehicle.get_model(v)) # Also possible, but not a good style to call an instance method. ``` In the previous code listing, get_default_model was defined using @staticmethod decorator. We will cover decorators in detail in a later chapter. The @staticmethod on a method indicates to the Mojo compiler that this method should be a static method. Static methods are called using the name of the struct itself, instead of the name of the variable that contains the struct’s instance. For example, in the code listing the static method was called by referring to the Vehicle struct directly as in Vehicle.get_default_model(). It is possible to call static methods through an instance of the struct, but that style is discouraged because for a person reading the code, it is confusing. ### 7.3. Implicit conversion You may have noticed that assignment var x: String = "A string literal" ` works, even though we saw earlier that anything within the double quotes `"" is of type StringLiteral. The above assignment works because Mojo has support for implicit conversions. Mojo has a very simple approach for implicit conversions. Suppose that struct A has an initializer that takes an argument with type of StringLiteral. Then when we assign a StringLiteral to a variable of type A, it implicitly calls that initializer, resulting in initialization of the variable with an instance of A with that given string literal passed as an argument. The following examples makes it more clear. ```mojo struct Vehicle: var model_name: String fn __init__(inout self, model_name: StringLiteral): self.model_name = model_name fn get_model(self) -> String: return self.model_name fn main(): var v: Vehicle = "Ford" print(v.get_model()) ``` ← Previous: Documenting your code | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Trait → ================================================================================ URL: https://ruhati.net/mojo/_struct.html#_static_methods # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct 7.1. Instance methods 7.2. Static methods 7.3. Implicit conversion - 7.1. Instance methods - 7.2. Static methods - 7.3. Implicit conversion - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 7.1. Instance methods - 7.2. Static methods - 7.3. Implicit conversion ## 7. Struct In the previous chapter we saw the different data types supported by Mojo out of the box. But what if you wanted to implement your own data type? Mojo provides struct keyword for that purpose. The term "struct" was popularized by the ALGOL family of languages and is a short form for the term structure. In Mojo, struct allows one to group related values together as a single unit. Members variables of a struct must have type annotation. ```mojo struct Person: var first_name: String var last_name: String fn __init__(inout self): self.first_name = "Mickey" self.last_name = "Mouse" fn get_full_name(self) -> String: return self.first_name + " " + self.last_name ``` The code shown before shows how a struct is defined within Mojo. You start with keyword struct and then give a name for the struct. Then you can define the member variables of the struct. Here we defined first_name and last_name strings. You can also define functions within a struct. Functions defined inside the body of a struct are known as "method". The body of the struct is indented with whitespace. You may have noticed that we have defined a method init. This is the initializer or in other languages known as the constructor. In order for a struct to be used in a program, we need to define a method that initializes the struct. The main responsibility of the initializer is to setup the struct in a valid state and to ensure that all the member variables also have a valid state. If we omit the initializer, the compiler would complain that init is missing. In the init method, the first argument is mandatory and it is named self by convention. It does not really matter whether you call the first argument self or some other name as Mojo would accept any other name. However, Mojo adopts the same convention as Python and calls the first argument self. It is highly recommended to follow that convention as it makes the code easier to read and understand by other programmers. The first argument also has a keyword inout. For init methods, it is mandatory to have inout keyword in front of the first self argument. It indicates to Mojo that the self is mutable reference. We will cover this later on in this book. To refer to the member variables of a strut, we need to prefix the variable with self.. Mojo allows new variables to be defined with the same names if the scope of the variable is different. The prefix self. makes it possible for the Mojo compiler to determine that the struct’s member variable is being referred to and not to another variable of the same name in the function scope. The anatomy of a struct is shown in the following diagram. Syntax to instantiate a struct is quite similar to a function call. In the following code listing an instance of Person is stored in the variable client. ```mojo var client: Person = Person() print(client.get_full_name()) ``` You can define initializers with additional arguments. You can also define more than one initializers. The initializers can be given arguments similar to how arguments are passed to a function. ```mojo struct Person: var first_name: String var last_name: String fn __init__(inout self): self.first_name = "Mickey" self.last_name = "Mouse" fn __init__(inout self, fname: String, lname: String): # Second initializer self.first_name = fname self.last_name = lname fn get_full_name(self) -> String: # Instance method return self.first_name + " " + self.last_name fn main(): var client: Person = Person("Donald", "Duck") # Instantiating Person print(client.get_full_name()) # Calling an instance method ``` ### 7.1. Instance methods As mentioned earlier, a struct can define methods within it. There are two types of methods. One is instance method and the other is static method. Instance methods are called on an instance of the struct. In the previous code listing, get_full_name is an instance method because it the first argument self which is the instance of the struct. It uses self to refer to the instance variables of the struct, for example self.first_name. To call the instance method, we used the syntax client.get_full_name(). Note that even though get_full_name had an argument self passed to it, we do not pass that argument to get_full_name when we call it. What is happening here? One way to look at it is that when we call client.get_full_name(), behind the scene the compiler passes client as the first argument to get_full_name. This syntax is quite popular in many object oriented languages, and since Python has this syntax, Mojo also took it over. ### 7.2. Static methods What if we do not have to refer to instance variables or even other instance methods in our method, but still want to have the method scoped within the struct? In this case Mojo offers static methods. Static methods are very similar to functions and they are within the scope of the struct, but not bound to a particular instance of the struct. Mojo compiler can perform some optimizations to make static method invocations much faster than instance methods. ```mojo struct Vehicle: var model_name: String fn __init__(inout self, model_name: String): self.model_name = model_name fn get_model(self) -> String: return self.model_name @staticmethod fn get_default_model() -> String: return "VW" fn main(): var v: Vehicle = Vehicle("Mercedes") print(v.get_model()) # Call instance method print(Vehicle.get_default_model()) # Call static method print(v.get_default_model()) # Possible, but not a good style to call static method. print(Vehicle.get_model(v)) # Also possible, but not a good style to call an instance method. ``` In the previous code listing, get_default_model was defined using @staticmethod decorator. We will cover decorators in detail in a later chapter. The @staticmethod on a method indicates to the Mojo compiler that this method should be a static method. Static methods are called using the name of the struct itself, instead of the name of the variable that contains the struct’s instance. For example, in the code listing the static method was called by referring to the Vehicle struct directly as in Vehicle.get_default_model(). It is possible to call static methods through an instance of the struct, but that style is discouraged because for a person reading the code, it is confusing. ### 7.3. Implicit conversion You may have noticed that assignment var x: String = "A string literal" ` works, even though we saw earlier that anything within the double quotes `"" is of type StringLiteral. The above assignment works because Mojo has support for implicit conversions. Mojo has a very simple approach for implicit conversions. Suppose that struct A has an initializer that takes an argument with type of StringLiteral. Then when we assign a StringLiteral to a variable of type A, it implicitly calls that initializer, resulting in initialization of the variable with an instance of A with that given string literal passed as an argument. The following examples makes it more clear. ```mojo struct Vehicle: var model_name: String fn __init__(inout self, model_name: StringLiteral): self.model_name = model_name fn get_model(self) -> String: return self.model_name fn main(): var v: Vehicle = "Ford" print(v.get_model()) ``` ← Previous: Documenting your code | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Trait → ================================================================================ URL: https://ruhati.net/mojo/_struct.html#_implicit_conversion # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct 7.1. Instance methods 7.2. Static methods 7.3. Implicit conversion - 7.1. Instance methods - 7.2. Static methods - 7.3. Implicit conversion - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 7.1. Instance methods - 7.2. Static methods - 7.3. Implicit conversion ## 7. Struct In the previous chapter we saw the different data types supported by Mojo out of the box. But what if you wanted to implement your own data type? Mojo provides struct keyword for that purpose. The term "struct" was popularized by the ALGOL family of languages and is a short form for the term structure. In Mojo, struct allows one to group related values together as a single unit. Members variables of a struct must have type annotation. ```mojo struct Person: var first_name: String var last_name: String fn __init__(inout self): self.first_name = "Mickey" self.last_name = "Mouse" fn get_full_name(self) -> String: return self.first_name + " " + self.last_name ``` The code shown before shows how a struct is defined within Mojo. You start with keyword struct and then give a name for the struct. Then you can define the member variables of the struct. Here we defined first_name and last_name strings. You can also define functions within a struct. Functions defined inside the body of a struct are known as "method". The body of the struct is indented with whitespace. You may have noticed that we have defined a method init. This is the initializer or in other languages known as the constructor. In order for a struct to be used in a program, we need to define a method that initializes the struct. The main responsibility of the initializer is to setup the struct in a valid state and to ensure that all the member variables also have a valid state. If we omit the initializer, the compiler would complain that init is missing. In the init method, the first argument is mandatory and it is named self by convention. It does not really matter whether you call the first argument self or some other name as Mojo would accept any other name. However, Mojo adopts the same convention as Python and calls the first argument self. It is highly recommended to follow that convention as it makes the code easier to read and understand by other programmers. The first argument also has a keyword inout. For init methods, it is mandatory to have inout keyword in front of the first self argument. It indicates to Mojo that the self is mutable reference. We will cover this later on in this book. To refer to the member variables of a strut, we need to prefix the variable with self.. Mojo allows new variables to be defined with the same names if the scope of the variable is different. The prefix self. makes it possible for the Mojo compiler to determine that the struct’s member variable is being referred to and not to another variable of the same name in the function scope. The anatomy of a struct is shown in the following diagram. Syntax to instantiate a struct is quite similar to a function call. In the following code listing an instance of Person is stored in the variable client. ```mojo var client: Person = Person() print(client.get_full_name()) ``` You can define initializers with additional arguments. You can also define more than one initializers. The initializers can be given arguments similar to how arguments are passed to a function. ```mojo struct Person: var first_name: String var last_name: String fn __init__(inout self): self.first_name = "Mickey" self.last_name = "Mouse" fn __init__(inout self, fname: String, lname: String): # Second initializer self.first_name = fname self.last_name = lname fn get_full_name(self) -> String: # Instance method return self.first_name + " " + self.last_name fn main(): var client: Person = Person("Donald", "Duck") # Instantiating Person print(client.get_full_name()) # Calling an instance method ``` ### 7.1. Instance methods As mentioned earlier, a struct can define methods within it. There are two types of methods. One is instance method and the other is static method. Instance methods are called on an instance of the struct. In the previous code listing, get_full_name is an instance method because it the first argument self which is the instance of the struct. It uses self to refer to the instance variables of the struct, for example self.first_name. To call the instance method, we used the syntax client.get_full_name(). Note that even though get_full_name had an argument self passed to it, we do not pass that argument to get_full_name when we call it. What is happening here? One way to look at it is that when we call client.get_full_name(), behind the scene the compiler passes client as the first argument to get_full_name. This syntax is quite popular in many object oriented languages, and since Python has this syntax, Mojo also took it over. ### 7.2. Static methods What if we do not have to refer to instance variables or even other instance methods in our method, but still want to have the method scoped within the struct? In this case Mojo offers static methods. Static methods are very similar to functions and they are within the scope of the struct, but not bound to a particular instance of the struct. Mojo compiler can perform some optimizations to make static method invocations much faster than instance methods. ```mojo struct Vehicle: var model_name: String fn __init__(inout self, model_name: String): self.model_name = model_name fn get_model(self) -> String: return self.model_name @staticmethod fn get_default_model() -> String: return "VW" fn main(): var v: Vehicle = Vehicle("Mercedes") print(v.get_model()) # Call instance method print(Vehicle.get_default_model()) # Call static method print(v.get_default_model()) # Possible, but not a good style to call static method. print(Vehicle.get_model(v)) # Also possible, but not a good style to call an instance method. ``` In the previous code listing, get_default_model was defined using @staticmethod decorator. We will cover decorators in detail in a later chapter. The @staticmethod on a method indicates to the Mojo compiler that this method should be a static method. Static methods are called using the name of the struct itself, instead of the name of the variable that contains the struct’s instance. For example, in the code listing the static method was called by referring to the Vehicle struct directly as in Vehicle.get_default_model(). It is possible to call static methods through an instance of the struct, but that style is discouraged because for a person reading the code, it is confusing. ### 7.3. Implicit conversion You may have noticed that assignment var x: String = "A string literal" ` works, even though we saw earlier that anything within the double quotes `"" is of type StringLiteral. The above assignment works because Mojo has support for implicit conversions. Mojo has a very simple approach for implicit conversions. Suppose that struct A has an initializer that takes an argument with type of StringLiteral. Then when we assign a StringLiteral to a variable of type A, it implicitly calls that initializer, resulting in initialization of the variable with an instance of A with that given string literal passed as an argument. The following examples makes it more clear. ```mojo struct Vehicle: var model_name: String fn __init__(inout self, model_name: StringLiteral): self.model_name = model_name fn get_model(self) -> String: return self.model_name fn main(): var v: Vehicle = "Ford" print(v.get_model()) ``` ← Previous: Documenting your code | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Trait → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html#_if_else # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html#_elif # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html#_nesting_of_if # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html#_if_as_expression # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html#_case # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html#_while # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html#_for # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_control_flow.html#_skipping_and_exiting_early_from_loops # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow 9.1. if-else 9.2. elif 9.3. Nesting of if 9.4. if as expression 9.5. case 9.6. while 9.7. for 9.8. Skipping and exiting early from loops - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 9.1. if-else - 9.2. elif - 9.3. Nesting of if - 9.4. if as expression - 9.5. case - 9.6. while - 9.7. for - 9.8. Skipping and exiting early from loops ## 9. Control flow Like most other programming languages, Mojo provides control structures such as conditions and loops. ### 9.1. if-else The most basic control flow is if statement. It takes an expression that must evaluate to a boolean result. The body of the if will be executed if the boolean result is True. It is not allowed to have else without a corresponding if. ```mojo if x == 0: print("X is zero") ``` In this example, we have an if statement with a condition. The == operator checks for equality, here it checks if the variable x has the value 0. If you want to execute another body of code when the if expression results in False, you can use else. ```mojo if x == 0: print("X is zero") else: print("X is non-zero") ``` ### 9.2. elif What if you need to check multiple conditions instead of just one? Mojo provides if-elif-else construct for those cases. ```mojo if x == 0: print("X is zero") elif x < 0: print("X is negative") else: print("X is positive") ``` The first if works same as before. The elif is a short form of "else if". It works similar to if and expects the expression to evaluate to True to execute its own body. One thing to note is that if and elif are mutually exclusive and the first one in the sequence of the statements to have expression value as True will execute its body. Therefore care must be taken to correctly order the conditions so that you don’t miss out some edge cases. It is not allowed to have elif without a corresponding if. ```mojo if x == 0: print("X is zero") elif x == 0: print("X is zero - but this won't show up") elif x < 0: print("X is negative") else: print("X is positive") ``` In the previous code listing, since the if condition already evaluated to True, the second elif will not get executed even if the expression is True. ### 9.3. Nesting of if You can nest if inside another if or else or elif. This allows for implementation of a more complex control flow logic. ```mojo if x < 0: print("X is negative") if x < -5: print("X is too low") else: if x == 0: print("X is zero") print("X is positive") ``` Too many nested conditions could impact readability of the code. In this case consider whether extracting them into separate functions improve readability. ### 9.4. if as expression The standard if statement spans over a minimum of 4 lines, sometimes when we just want to assign a value conditionally to a variable, it is a bit verbose. Mojo provides a shorter one line version that could be used in such cases. ```mojo var message = "X is positive" if x >=0 else "X is negative" print(message) ``` One thing to note here is that the order of the if expression is different from the usual order of if statements. The anatomy of if-elif-else is shown in the following diagram. ### 9.5. case ### 9.6. while The while loops allow a body of code to be executed repeatedly as long as the condition of the while evaluates to True. The moment the condition evaluates to False, it stops executing the code body within it. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 ``` The previous code listing will print values 0 to 5. It is possible to add else clause after the while body. The else body will be executed exactly once when the condition of while evaluates to False. ```mojo x = 0 while x <= 5: print("X is: ", x) x = x + 1 else: print("X is now greater than 5") ``` The previous code listing will print "X is now greater than 5" after printing values 0 to 5. The anatomy of a while loop is shown in the following diagram. ### 9.7. for Similar to while, for also provides facility to repeat a code block many times. The main difference is that while is based on an expression evaluating to True whereas for is based on something called an iterator. In the most simple term, an iterator is something that returns an element when its next method is called. The expression that comes after in within the for loop statement must resolve to an iterable. An iterable is anything that returns an iterator when its iter method is called. In effect, when the for loop is executed, it calls the iterable’s iter method which returns the iterator the for loop works with. For each repetition of the loop, the iterator’s next is called and its result assigned to the variable coming before the in keyword. The iterator must keep track of the state so that the for loop advances to the next element when next is called. ```mojo for i in range(0, 5): print(i) ``` It is possible to add else clause after the for body. The else body will be executed exactly once when the iteration is finished. ```mojo for i in range(0, 5): print(i) else: print("i is now greater than 4") ``` The anatomy of a for loop is shown in the following diagram. ### 9.8. Skipping and exiting early from loops #### 9.8.1. break If you want to exit the while or for loop early (usually on some condition), then you can use break. This allows early exit from the loop. ```mojo x = 0 while x <= 5: if x > 3: break print("X is: ", x) x = x + 1 for i in range(0, 6): if i > 3: break print("i is: ", i) ``` The previous code listing will print values 0 to 3, and will exit the loop as soon as x is greater than 3. #### 9.8.2. continue What if you wanted to skip an iteration of the loop? For this case Mojo provides you with continue. The continue keyword would skip all the statements coming after it in the while or for body for exactly one iteration of the loop. ```mojo x = 0 while x <= 5: x = x + 1 if x < 3: continue # Skip following statements of the while block print("X is: ", x) for i in range(0, 6): if i < 3: continue # Skip following statements of the while block print("i is: ", i) ``` The previous code listing will skip the print statement coming after it until value of x is greater than or equal to 3. ← Previous: Trait | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Error handling → ================================================================================ URL: https://ruhati.net/mojo/_error_handling.html#_error_propagation # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling 10.1. Error propagation 10.2. Finally 10.3. Else - 10.1. Error propagation - 10.2. Finally - 10.3. Else - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 10.1. Error propagation - 10.2. Finally - 10.3. Else ## 10. Error handling Like many other languages, Mojo has built-in support for error handling. In Mojo, an error is raised using the keyword raise and handled using except. Any function call that can potentially raise an error must be wrapped within a try and except block. The following diagram illustrates the structure of error handling in Mojo. The following example shows how a function declares that it raises an error and how the caller of a function handles it. ```mojo fn raise_error(cond: Bool) raises: if cond: raise Error("Provided condition is True") else: print("No error") ``` Usage: ```mojo try: raise_error(True) except e: print("Error raised:", e) ``` In the example, an error is raised inside the function raise_error based on a given condition. Since an error is raised, the function must declare that in its signature. This means that any one calling the function must either handle the error raised by the function, or must re-raise it further down. In the usage example, we see that the error raised by the function is handled. It is possible to raise a String as error as shown below, though in reality it automatically gets wrapped within an Error. ```mojo fn raise_str_error(cond: Bool) raises: if cond: raise "String error is allowed" else: print("No error") ``` Usage: ```mojo try: raise_str_error(True) except e: print("Error raised:", e) ``` ### 10.1. Error propagation In the following example, we see that any function that calls another function that potentially raises an error, needs to either fully handle the error within the function itself, or declare in its own signature that it too raises an error. Unhandled errors in a called function will get propagated down. ```mojo fn raise_call() raises: # Need to either have 'raises' in the signature, or wrap with try-except raise_error(True) ``` ### 10.2. Finally The finally code blocks always gets executed regardless whether an error is getting propagated, or it was fully handled. The finally block is typically used for clean-up activities, for example, if a file is opened within a try block, then we must close the file within a finally block to ensure that even if an error is raised within the try block the file is always closed before the function returns. If a value is returned in finally and try or except, the returned value will be from finally. The finally block is optional. ```mojo try: raise_error(True) except e: print("Error raised:", e) finally: print("Always executed") try: raise_error(False) except e: print("Error raised:", e) finally: print("Always executed") ``` ### 10.3. Else In order to execute statements when no error has been raised, you can use else block. The else block is optional. The else block appears after except, but before finally. The else block is useful for those cases where we want to isolate error raising functions that we want to handle from other code that we want to execute, but may raise their own errors. ```mojo try: raise_error(False) except e: print("Error raised:", e) else: print("No exception raised.") ``` ← Previous: Control flow | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Operators and special methods → ================================================================================ URL: https://ruhati.net/mojo/_error_handling.html#_finally # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling 10.1. Error propagation 10.2. Finally 10.3. Else - 10.1. Error propagation - 10.2. Finally - 10.3. Else - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 10.1. Error propagation - 10.2. Finally - 10.3. Else ## 10. Error handling Like many other languages, Mojo has built-in support for error handling. In Mojo, an error is raised using the keyword raise and handled using except. Any function call that can potentially raise an error must be wrapped within a try and except block. The following diagram illustrates the structure of error handling in Mojo. The following example shows how a function declares that it raises an error and how the caller of a function handles it. ```mojo fn raise_error(cond: Bool) raises: if cond: raise Error("Provided condition is True") else: print("No error") ``` Usage: ```mojo try: raise_error(True) except e: print("Error raised:", e) ``` In the example, an error is raised inside the function raise_error based on a given condition. Since an error is raised, the function must declare that in its signature. This means that any one calling the function must either handle the error raised by the function, or must re-raise it further down. In the usage example, we see that the error raised by the function is handled. It is possible to raise a String as error as shown below, though in reality it automatically gets wrapped within an Error. ```mojo fn raise_str_error(cond: Bool) raises: if cond: raise "String error is allowed" else: print("No error") ``` Usage: ```mojo try: raise_str_error(True) except e: print("Error raised:", e) ``` ### 10.1. Error propagation In the following example, we see that any function that calls another function that potentially raises an error, needs to either fully handle the error within the function itself, or declare in its own signature that it too raises an error. Unhandled errors in a called function will get propagated down. ```mojo fn raise_call() raises: # Need to either have 'raises' in the signature, or wrap with try-except raise_error(True) ``` ### 10.2. Finally The finally code blocks always gets executed regardless whether an error is getting propagated, or it was fully handled. The finally block is typically used for clean-up activities, for example, if a file is opened within a try block, then we must close the file within a finally block to ensure that even if an error is raised within the try block the file is always closed before the function returns. If a value is returned in finally and try or except, the returned value will be from finally. The finally block is optional. ```mojo try: raise_error(True) except e: print("Error raised:", e) finally: print("Always executed") try: raise_error(False) except e: print("Error raised:", e) finally: print("Always executed") ``` ### 10.3. Else In order to execute statements when no error has been raised, you can use else block. The else block is optional. The else block appears after except, but before finally. The else block is useful for those cases where we want to isolate error raising functions that we want to handle from other code that we want to execute, but may raise their own errors. ```mojo try: raise_error(False) except e: print("Error raised:", e) else: print("No exception raised.") ``` ← Previous: Control flow | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Operators and special methods → ================================================================================ URL: https://ruhati.net/mojo/_error_handling.html#_else # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling 10.1. Error propagation 10.2. Finally 10.3. Else - 10.1. Error propagation - 10.2. Finally - 10.3. Else - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 10.1. Error propagation - 10.2. Finally - 10.3. Else ## 10. Error handling Like many other languages, Mojo has built-in support for error handling. In Mojo, an error is raised using the keyword raise and handled using except. Any function call that can potentially raise an error must be wrapped within a try and except block. The following diagram illustrates the structure of error handling in Mojo. The following example shows how a function declares that it raises an error and how the caller of a function handles it. ```mojo fn raise_error(cond: Bool) raises: if cond: raise Error("Provided condition is True") else: print("No error") ``` Usage: ```mojo try: raise_error(True) except e: print("Error raised:", e) ``` In the example, an error is raised inside the function raise_error based on a given condition. Since an error is raised, the function must declare that in its signature. This means that any one calling the function must either handle the error raised by the function, or must re-raise it further down. In the usage example, we see that the error raised by the function is handled. It is possible to raise a String as error as shown below, though in reality it automatically gets wrapped within an Error. ```mojo fn raise_str_error(cond: Bool) raises: if cond: raise "String error is allowed" else: print("No error") ``` Usage: ```mojo try: raise_str_error(True) except e: print("Error raised:", e) ``` ### 10.1. Error propagation In the following example, we see that any function that calls another function that potentially raises an error, needs to either fully handle the error within the function itself, or declare in its own signature that it too raises an error. Unhandled errors in a called function will get propagated down. ```mojo fn raise_call() raises: # Need to either have 'raises' in the signature, or wrap with try-except raise_error(True) ``` ### 10.2. Finally The finally code blocks always gets executed regardless whether an error is getting propagated, or it was fully handled. The finally block is typically used for clean-up activities, for example, if a file is opened within a try block, then we must close the file within a finally block to ensure that even if an error is raised within the try block the file is always closed before the function returns. If a value is returned in finally and try or except, the returned value will be from finally. The finally block is optional. ```mojo try: raise_error(True) except e: print("Error raised:", e) finally: print("Always executed") try: raise_error(False) except e: print("Error raised:", e) finally: print("Always executed") ``` ### 10.3. Else In order to execute statements when no error has been raised, you can use else block. The else block is optional. The else block appears after except, but before finally. The else block is useful for those cases where we want to isolate error raising functions that we want to handle from other code that we want to execute, but may raise their own errors. ```mojo try: raise_error(False) except e: print("Error raised:", e) else: print("No exception raised.") ``` ← Previous: Control flow | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Operators and special methods → ================================================================================ URL: https://ruhati.net/mojo/_operators_and_special_methods.html#_arithmetic_operators # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods 11.1. Arithmetic operators 11.2. Bitwise operators 11.3. Relational operators 11.4. Index operators 11.5. Context management methods 11.6. Other special methods - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods ## 11. Operators and special methods In Mojo some functions have special naming convention, starting and ending with double underscores: "_". Since they start and end with __double underscores_, they are called dunder methods. These methods are treated specially by Mojo compiler. Mojo supports implementation of arithmetic and relational operators, along with special methods that support lifecycle of values. In previous chapters, we saw many times the arithmetic and relational operators. Most of these operators can be implemented by user defined structs. Mojo provides quite a bit of flexibility in defining your own low level structs and the ability to implement these operators is part of that flexibility. Implementing an operator is as simple as implementing a function. Many of Mojo’s built in functionality is implemented as libraries. This means that we are able to implement powerful constructs just using basic language features offered by Mojo. ### 11.1. Arithmetic operators The following sections describe the various arithmetic operators in Mojo. #### 11.1.1. Addition The following are the addition operators. ##### __add__ The __add__ stands for arithmetic addition "+" between the struct defining the method and self type or another type. ##### __radd__ The __radd__ method is known as reverse addition, and is used when we try to add two values, where the first value does not have __add__ implemented. In this case, the Mojo compiler checks if the second value has __radd__ implemented, and it calls that one. ##### __iadd__ The __iadd__ method is called in-place addition and represents arithmetic addition "=". Even if you implement just `\\__add__` and do not implement `\\__iadd__`, the "=" operation would still work as Mojo will just use __add__ as the fallback. However, typically __add__ returns a new instance of the result. In case of large structs (structs with many fields), it could entail a lot of copy operations. The in-place addition can directly change the struct’s internal data, resulting in an efficient execution of the addition method. The __iadd__ therefore does not have a return value as it updates the struct itself. Since the struct' internal value is mutated, we need to use one of the inout or owned references of self in the method. The following code listing shows the different operations. Please note that these examples are not meant for production use, as it is intentionally kept incomplete for simplicity’s sake. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __add__(self, other: Self) -> Self: print("add invoked") return Self(self.val + other.val) fn __radd__(self, other: MyFloat) -> Self: print("radd invoked") return Self(self.val + int(other.val)) fn __iadd__(inout self, other: Self): print("iadd invoked") self.val = self.val + other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var add_res = MyInt(1) + MyInt(2) print(add_res.val) var radd_res = MyFloat(3.5) + MyInt(2) # Even though MyFloat does not implement __add__ method, we are able to do addition through MyInt's __radd__ print(radd_res.val) var iadd_res = MyInt(10) iadd_res += MyInt(20) print(iadd_res.val) ``` #### 11.1.2. Subtraction The following are the subtraction operators. ##### __sub__ The __sub__ stands for arithmetic subtraction "-" between the struct defining the method and self type or another type. ##### __rsub__ The __rsub__ method is known as reverse subtraction, and is used when we try to subtract two values, where the first value does not have __sub__ implemented. In this case, the Mojo compiler checks if the second value has __rsub__ implemented, and it calls that one. As the name implies, the reverse subtraction swaps the operands. Since subtraction is non-commutative, care must be taken to have correct values as the first operand and second operands. For example, x - y in normal subtraction would be y - x in reverse subtraction. ##### __isub__ The __isub__ method is called in-place subtraction and represents arithmetic subtraction "-=". The concept of __isub__ is the same as what we saw in __iadd__. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __sub__(self, other: Self) -> Self: print("sub invoked") return Self(self.val - other.val) fn __rsub__(self, other: MyFloat) -> Self: print("rsub invoked") return Self(int(other.val) - self.val) # Order matters for subtraction; it is not commutative. fn __isub__(inout self, other: Self): print("isub invoked") self.val = self.val - other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var sub_res = MyInt(1) - MyInt(2) print(sub_res.val) var rsub_res = MyFloat(3.5) - MyInt(2) # Even though MyFloat does not implement __sub__ method, we are able to do addition through MyInt's __rsub__ print(rsub_res.val) var isub_res = MyInt(10) isub_res -= MyInt(20) print(isub_res.val) ``` #### 11.1.3. Multiplication The following are multiplication operators. ##### __mul__ The __mul__ stands for multiplication "*" between the struct defining the method and self type or another type. ##### __rmul__ The __rmul__ method is known as reverse multiplication, and is used when we try to multiply two values, where the first value does not have __mul__ implemented. In this case, the Mojo compiler checks if the second value has __rmul__ implemented, and it calls that one. ##### __imul__ The __imul__ method is called in-place multiplication and represents multiplication "*=". The concept of __imul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is multiplication. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mul__(self, other: Self) -> Self: print("mul invoked") return Self(self.val * other.val) fn __rmul__(self, other: MyFloat) -> Self: print("rmul invoked") return Self(int(other.val) * self.val) # Will truncate fn __imul__(inout self, other: Self): print("imul invoked") self.val = self.val * other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mul_res = MyInt(3) * MyInt(2) print(mul_res.val) var rmul_res = MyFloat(3.5) * MyInt(2) print(rmul_res.val) var imul_res = MyInt(10) imul_res *= MyInt(20) print(imul_res.val) ``` #### 11.1.4. Matrix multiplication The following are operators for matrix multiplication. ##### __matmul__ The __matmul__ stands for matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. ##### __rmatmul__ The __rmatmul__ stands for the reverse matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imatmul__ The __imatmul__ stands for in-place matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. The concept of __imatmul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is matrix multiplication. ```mojo struct MyFloatMatrix: var val: List[List[Float16]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Float16]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyFloatMatrix(List[List[Float16]](), 0, 0) struct MyIntMatrix: var val: List[List[Int]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Int]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyIntMatrix(List[List[Int]](), 0, 0) fn print(self): print("....") print("Rows:", self.rows, "Cols:", self.cols) for row in self.val: print() for col in row[]: print(col[], end=" ") print() print("----") @staticmethod fn _matmul_internal(first: Self, second: Self) -> Self: if first.cols != first.rows: print("Rows and columns do not match. ") return MyIntMatrix.empty() var res: List[List[Int]] = List[List[Int]](capacity=first.rows) for i in range(first.rows): res.append(List[Int](capacity=second.cols)) for j in range(second.cols): var s = 0 for k in range(first.cols): s += first.val[i][k] * second.val[k][j] res[i].append(s) return Self(res, first.rows, second.cols) fn __matmul__(self, other: Self) -> Self: # Naive implementation - not for production use print("matmul invoked") return Self._matmul_internal(self, other) fn __rmatmul__(self, other: MyFloatMatrix) -> Self: # Naive implementation - not for production use print("rmatmul invoked") var res: List[List[Int]] = List[List[Int]](capacity=self.rows) for i in range(other.rows): res.append(List[Int](capacity=self.cols)) for j in range(self.cols): var s = 0 for k in range(other.cols): s += int(other.val[i][k]) * self.val[k][j] # Will truncate res[i].append(s) return Self(res, other.rows, self.cols) fn __imatmul__(inout self, other: Self): # Naive implementation - not for production use print("imatmul invoked") var res = Self._matmul_internal(self, other) self.val = res.val self.rows = res.rows self.cols = res.cols ``` Usage: ```mojo var m : List[List[Int]] = List( List(1, 2, 1), List(5, 1, 1), List(2, 3, 1)) var n: List[List[Int]] = List( List(2, 5), List(6, 7), List(1, 1)) var flm : List[List[Float16]] = List( List[Float16](1.2, 2.3, 1.4), List[Float16](5.2, 1.2, 1.3), List[Float16](2.3, 3.4, 1.4)) var matmul_res = MyIntMatrix(m, 3, 3) @ MyIntMatrix(n, 3, 2) matmul_res.print() var rmatmul_res = MyFloatMatrix(flm, 3, 3) @ MyIntMatrix(n, 3, 2) rmatmul_res.print() var imatmul_res = MyIntMatrix(m, 3, 3) imatmul_res @= MyIntMatrix(n, 3, 2) imatmul_res.print() ``` #### 11.1.5. Division The division operators. ##### __truediv__ The __truediv__ stands for division represented by the symbol "/" between the struct defining the method and self type or another type. The result of \\__truediv is a floating point type with 64 bits. ##### __rtruediv__ The __rtruediv__ stands for the reverse division represented by the symbol "/" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __itruediv__ The __itruediv__ stands for in-place division represented by the symbol "/" between the struct defining the method and self type or another type. The concept of __itruediv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __truediv__(self, other: Self) -> MyFloat: print("truediv invoked") return MyFloat(self.val / other.val) fn __rtruediv__(self, other: MyFloat) -> MyFloat: print("rtruediv invoked") return MyFloat(int(other.val) / self.val) fn __itruediv__(inout self, other: Self): print("itruediv invoked") self.val = int(self.val / other.val) # Will truncate ``` Usage: ```mojo var num: MyInt = MyInt(42) var div_res = MyInt(3) / MyInt(2) print(div_res.val) var rdiv_res = MyFloat(3.5) / MyInt(2) print(rdiv_res.val) var idiv_res = MyInt(10) idiv_res /= MyInt(20) print(idiv_res.val) ``` Note that __itruediv__ implementation had to convert the result from a Float to Int because MyInt can only store Int as value within it. Mojo has the ability to have a variable with multiple possible types through Variant struct. We will cover that in a later chapter. ##### __floordiv__ The __floordiv__ stands for floor division (also known as integer division) represented by the symbol "//" between the struct defining the method and self type or another type. As the name suggest, the result of the __floordiv__ is an integer instead of float. Typically implementations truncate towards zero in case of positive values and away from zero for negative values. For example, 7//3 results in 2, while -7//3 results in -3 and not -2. ##### __rfloordiv__ The __rfloordiv__ stands for the reverse division represented by the symbol "//" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ifloordiv__ The __ifloordiv__ stands for in-place division represented by the symbol "//" between the struct defining the method and self type or another type. The concept of __ifloordiv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is floor division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __floordiv__(self, other: Self) -> Self: print("floordiv invoked") return Self(self.val // other.val) fn __rfloordiv__(self, other: MyFloat) -> Self: print("rfloordiv invoked") return Self(int(other.val) // self.val) fn __ifloordiv__(inout self, other: Self): print("ifloordiv invoked") self.val = self.val // other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var floordiv_res = MyInt(3) // MyInt(2) print(floordiv_res.val) var rfloordiv_res = MyFloat(3.5) // MyInt(2) print(rfloordiv_res.val) var ifloordiv_res = MyInt(10) ifloordiv_res //= MyInt(20) print(ifloordiv_res.val) ``` #### 11.1.6. Modulo The following are the modulo operators. ##### __mod__ The __mod__ stands for modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The approach to implement __mod__ is the same as what we saw in __truediv__, except instead of division, the applied operation is modulo operation. The __mod__ derives its name from the mathematical modulo operation. Modulo operation divides two numbers and returns the remainder of the division. ##### __rmod__ The __rmod__ stands for the reverse modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imod__ The __imod__ stands for in-place modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The concept of __imod__ is the same as what we saw in __itruediv__, except instead of division, the applied operation is modulo. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mod__(self, other: Self) -> Self: print("mod invoked") return Self(self.val % other.val) fn __rmod__(self, other: MyFloat) -> Self: print("rmod invoked") return Self(int(other.val) % self.val) fn __imod__(inout self, other: Self): print("imod invoked") self.val = self.val % other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mod_res = MyInt(7) % MyInt(2) print(mod_res.val) var rmod_res = MyFloat(8) % MyInt(2) print(rmod_res.val) var imod_res = MyInt(37) imod_res %= MyInt(20) print(imod_res.val) ``` #### 11.1.7. Exponentiation The following lists the exponentiation operators. ##### __pow__ The __pow__ stands for exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The approach to implement __pow__ is the same as what we saw in __mul__, except instead of multiplication, we apply exponential operation. ##### __ipow__ The __ipow__ stands for in-place exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The concept of __ipow__ is the same as what we saw in __imul__, except instead of multiplication, we apply exponential operation. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pow__(self, other: Self) -> Self: print("pow invoked") return Self(self.val ** other.val) fn __ipow__(inout self, other: Self): print("ipow invoked") self.val **= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var pow_res = MyInt(7) ** MyInt(2) print(pow_res.val) var ipow_res = MyInt(7) ipow_res **= MyInt(2) print(ipow_res.val) ``` #### 11.1.8. Unary operators The following are the unary operators. ##### __neg__ The __neg__ stands for the unary operation represented by the symbol "-" for the struct defining the method. The negative sign appears as prefix to the value and typically results in negation of the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __neg__(self) -> Self: print("neg invoked") return Self(-self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var neg_res = -MyInt(7) print(neg_res.val) ``` ##### __pos__ The __pos__ stands for the unary operation represented by the symbol "+" for the struct defining the method. The positive sign appears as prefix to the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pos__(self) -> Self: print("pos invoked") return Self(+self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var pos_res = +MyInt(7) print(pos_res.val) ``` ##### __invert__ The __invert__ stands for the unary operation represented by the symbol "~" for the struct defining the method. The invert sign appears as prefix to the value. Typical implementations return bitwise compliment of the value, switching 1 for 0 and vice versa. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __invert__(self) -> Self: print("invert invoked") return Self(~self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var invert_res = ~MyInt(2) print(invert_res.val) ``` ### 11.2. Bitwise operators The following are the bitwise operators. #### 11.2.1. Operators ##### __lshift__ The __lshift__ stands for left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. ##### __rlshift__ The __rlshift__ stands for the reverse left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ilshift__ The __ilshift__ stands for in-place left shift operation represented by the symbol "<⇐" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __lshift__, the __ilshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lshift__(self, other: Self) -> Self: print("lshift invoked") return Self(self.val << other.val) fn __rlshift__(self, other: MyFloat) -> Self: print("rlshift invoked") return Self(int(other.val) << self.val) fn __ilshift__(inout self, other: Self): print("ilshift invoked") self.val <<= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var lshift_res = MyInt(2) << MyInt(3) print(lshift_res.val) var rlshift_res = MyFloat(2) << MyInt(3) print(rlshift_res.val) var ilshift_res = MyInt(3) ilshift_res <<= MyInt(2) print(ilshift_res.val) ``` ##### __rshift__ The __rshift__ stands for right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the right. The second operand indicates how many bits are to be shifted to the right. ##### __rrshift__ The __rrshift__ stands for the reverse right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Similar to __rlshift__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __irshift__ The __irshift__ stands for in-place right shift operation represented by the symbol ">>=" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __rshift__, the __irshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __rshift__(self, other: Self) -> Self: print("rshift invoked") return Self(self.val >> other.val) fn __rrshift__(self, other: MyFloat) -> Self: print("rrshift invoked") return Self(int(other.val) >> self.val) fn __irshift__(inout self, other: Self): print("irshift invoked") self.val >>= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var rshift_res = MyInt(20) >> MyInt(3) print(rshift_res.val) var rrshift_res = MyFloat(24) >> MyInt(3) print(rrshift_res.val) var irshift_res = MyInt(30) irshift_res >>= MyInt(2) print(irshift_res.val) ``` ##### __and__ The __and__ stands for bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. ##### __rand__ The __rand__ stands for reverse bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. This is invoked when the first value does not have __and__ implemented. In this case, the Mojo compiler checks if the second value has __rand__ implemented, and calls that one. ##### __iand__ The __iand__ stands for in-place bitwise AND operator represented by the symbol "&=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __and__, the __iand__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __and__(self, other: Self) -> Self: print("and invoked") return Self(self.val & other.val) fn __rand__(self, other: MyFloat) -> Self: print("rand invoked") return Self(int(other.val) & self.val) fn __iand__(inout self, other: Self): print("iand invoked") self.val &= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var and_res = MyInt(23) & MyInt(6) print(and_res.val) var rand_res = MyFloat(20) & MyInt(4) print(rand_res.val) var iand_res = MyInt(10) iand_res &= MyInt(2) print(iand_res.val) ``` ##### __or__ The __or__ stands for bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. ##### __ror__ The __ror__ stands for reverse bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. This is invoked when the first value does not have __or__ implemented. In this case, the Mojo compiler checks if the second value has __ror__ implemented, and calls that one. ##### __ior__ The __ior__ stands for in-place bitwise OR operator represented by the symbol "|=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __or__, the __ior__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __or__(self, other: Self) -> Self: print("or invoked") return Self(self.val | other.val) fn __ror__(self, other: MyFloat) -> Self: print("ror invoked") return Self(int(other.val) | self.val) fn __ior__(inout self, other: Self): print("ior invoked") self.val |= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var or_res = MyInt(5) | MyInt(3) print(or_res.val) var ror_res = MyFloat(15) | MyInt(17) print(ror_res.val) var ior_res = MyInt(5) ior_res |= MyInt(1) print(ior_res.val) ``` ##### __xor__ The __xor__ stands for bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. ##### __rxor__ The __rxor__ stands for reverse bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. This is invoked when the first value does not have __xor__ implemented. In this case, the Mojo compiler checks if the second value has __rxor__ implemented, and calls that one. ##### __ixor__ The __ixor__ stands for in-place bitwise OR operator represented by the symbol "^=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __xor__, the __ixor__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __xor__(self, other: Self) -> Self: print("xor invoked") return Self(self.val ^ other.val) fn __rxor__(self, other: MyFloat) -> Self: print("rxor invoked") return Self(int(other.val) ^ self.val) fn __ixor__(inout self, other: Self): print("ixor invoked") self.val ^= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var xor_res = MyInt(5) ^ MyInt(3) print(xor_res.val) var rxor_res = MyFloat(15) ^ MyInt(17) print(rxor_res.val) var ixor_res = MyInt(5) ixor_res ^= MyInt(3) print(ixor_res.val) ``` ### 11.3. Relational operators #### 11.3.1. Operators ##### __eq__ The __eq__ stands for equality operator represented by the symbol "==" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __eq__(self, other: Self) -> Bool: print("eq invoked") return self.val == other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) == MyInt(5)) print(MyInt(5) == MyInt(3)) ``` ##### __ne__ The __ne__ stands for inequality operator represented by the symbol "!=" between the struct defining the method and self type or another type. The operation returns a Bool value. Note that __ne__ is not invoked when you call not x==y though. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ne__(self, other: Self) -> Bool: print("ne invoked") return self.val != other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) != MyInt(5)) print(MyInt(5) != MyInt(3)) print(not MyInt(5) == MyInt(3)) ``` ##### __lt__ The __lt__ stands for less-than operator represented by the symbol "<" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lt__(self, other: Self) -> Bool: print("lt invoked") return self.val < other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) < MyInt(5)) print(MyInt(3) < MyInt(5)) ``` ##### __gt__ The __gt__ stands for greater-than operator represented by the symbol ">" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __gt__(self, other: Self) -> Bool: print("gt invoked") return self.val > other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) > MyInt(5)) print(MyInt(5) > MyInt(3)) ``` ##### __le__ The __le__ stands for less-than-or-equal-to operator represented by the symbol "⇐" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __le__(self, other: Self) -> Bool: print("le invoked") return self.val <= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) <= MyInt(5)) print(MyInt(5) <= MyInt(3)) ``` ##### __ge__ The __ge__ stands for greater-than-or-equal-to operator represented by the symbol ">=" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ge__(self, other: Self) -> Bool: print("ge invoked") return self.val >= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) >= MyInt(5)) print(MyInt(3) >= MyInt(5)) ``` ### 11.4. Index operators Any large scale program would use collection data types such as lists, arrays, dictionaries extensively. Some programming languages have built-in syntax to make usage of such types convenient. Mojo has built-in syntactical support for collection types. Mojo allows accessing collection like data types using the syntax []. For example, list[2]. It also allows setting of values at a given index (e.g. list[2]=5). In line with Mojo’s philosophy of moving as much functionality as possible to libraries, instead of having specially treated data types that have exclusive privilege of syntax, Mojo opened up the index operator capability to any type that defines __getitem__ and __setitem__ methods. This means that your custom List struct will have the same syntactical support like the List bundled with Mojo. #### 11.4.1. Operators ##### __getitem__ The __getitem__ is the method invoked when you try to access values stored within the collection using the my_list[index] syntax (where my_list is the collection and index is the position of the element desired from the list). ##### __setitem__ The __setitem__ is the method invoked when you try to assign values to a collection using the my_list[index]=value syntax (where my_list is the collection and index is the position at which the value will be assigned). ```mojo struct MyCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, x: Int) -> String: return self.list[x] fn __setitem__(inout self, x: Int, val: String): self.list[x] = val ``` Usage: ```mojo var x = MyCollection(List(String("A"), String("B"))) print("Before:", x[1]) # Gets x[1] = String("C") # Sets print("After:", x[1]) ``` It is also possible to get and set using multiple indices, especially useful for Matrix like data structures. This means that we can use in our code my_list[row, col, and so on…​]. The following code listing shows such an example for a matrix. Note that this example is not a production quality implementation. ```mojo struct MyMatrix: var val: List[List[String]] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.rows = rows self.cols = cols self.val = List[List[String]](capacity=rows) for row in range(rows): self.val.append(List[String](capacity=cols)) for col in range(cols): self.val[row].append(String("None")) fn __getitem__(self, row: Int, col: Int) -> String: return self.val[row][col] fn __setitem__(inout self, row: Int, col: Int, s: String): self.val[row][col] = s ``` Usage: ```mojo var y = MyMatrix(5, 3) print("Before:", y[1, 2]) # Gets y[1, 2] = String("D") # Sets print("After:", y[1, 2]) ``` ##### __getitem__ with Slice Mojo supports getting a slice of a collection or a container using the slicing operator. The following diagram shows the structure of the slicing operator. In order to be able to get a slice from a collection or a container, the collection or the container must implement method __getitem__ that takes a Slice object. This Slice object is instantiated by the Mojo compiler when you use the slice operator. In a way you can think of the [start:stop:step] as a literal form instantiating a Slice. The start argument of Slice is the start index of the collection from where the slice will be taken. The end argument is the last index until which the slice will be taken (the element referred by this index will be excluded, only its previous element will be taken as last for the slice). The step gives the number of increments to be taken to get the next element. Any of the arguments of the Slice can be negative. A negative value means reversal of the indexing or stepping. Care must be taken to provide valid combinations though, otherwise it results in error. ```mojo struct MySliceableCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, slc: Slice) -> List[String]: return self.list[slc.start:slc.end:slc.step] ``` Usage: ```mojo var z = MySliceableCollection( List(String("H"), String("E"), String("L"), String("L"), String("O"), String("W"), String("O"), )) for i in z[0:3:1]: print(i[], end=" ") print() for i in z[1:6:2]: print(i[], end=" ") print() for i in z[1:]: print(i[], end=" ") print() for i in z[:1]: print(i[], end=" ") print() for i in z[-3:]: print(i[], end=" ") print() for i in z[:-3]: print(i[], end=" ") print() for i in z[::-1]: print(i[], end=" ") print() ``` ### 11.5. Context management methods In large programs, we often need to resources like files and database connections. When we open access to those resources, we typically have a handle, which we use to perform actions. However, once we have done with our actions, we must remember to cleanup or close the resources, otherwise we end up with dangling resources, memory leaks, locked files, etc. Mojo provides with keyword for managing such context or resources. The following diagram illustrates the syntax of the with statement. #### 11.5.1. Methods ##### __enter__ The method that handles the allocation of the resource and returns a resource. The resource has scope only within the body of the with. It is not mandatory to assign the return value to a variable, especially if it is not being used. ##### __exit__ The method that handles the cleanup of the resource. There are two implementations of the __exit__ method, one without any arguments __exit__(self, Error) and one with Error as an argument __exit__(self, Error). The __exit__(self, Error) is invoked when the with body has an exception and exits the with block abnormally. The method __exit__(self, Error) returns a Bool to indicate whether or not to propagate the error further. Any resources allocated in the __enter__ must be cleaned up at both the __exit__ methods, otherwise we would end up with dangling resources. For example, if __exit__(self, Error) is not properly implemented, resource leaks will occur only when there are exceptions raised within the with body. This will lead to rare but difficult to find defects. The following code listing shows an example for the context manager. ```mojo struct Resource: var name: String fn __init__(inout self, name: String): self.name = name fn open(self): print("Opened") fn close(self): print("Close") fn __copyinit__(inout self, other:Resource): self.name = other.name struct MyResourceManager: var resource: Resource fn __init__(inout self): self.resource = Resource("a_resource") fn __enter__(self) -> Resource: print("Entered context") self.resource.open() return self.resource fn __exit__(self): self.resource.close() print("Exited context") fn __exit__(self, err: Error) -> Bool: self.resource.close() print("Exited context") return False ``` Usage: ```mojo with MyResourceManager() as res: print("Inside context, resource is:", res.name) raise Error("An error while processing") ``` ### 11.6. Other special methods #### 11.6.1. Methods ##### __len__ The __len__ is defined within Sized trait and is used by the built-in len function. The __len__ method returns the length or size of the struct implementing it. ##### __int__ The __int__ is defined within Intable trait and is used by the built-in int function. The __int__ method returns an integer representation of the struct implementing it. ##### __bool__ The __bool__ is defined within Boolable trait and is used by conditional statements such as if to convert the given value to a boolean value for evaluation. The __bool__ method returns a boolean representation of the struct implementing it. ##### __str__ The __str__ is defined within Stringable trait and is used by the built-in str function. The __str__ method returns an string representation of the struct implementing it. The built-in function print uses __str__ before it prints the given value. The following code listing provides examples of special methods. ```mojo struct MyStruct(Sized, Intable, Boolable, Stringable): var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __len__(self) -> Int: print("len called") return len(self.ints) fn __int__(self) -> Int: print("int called") var sum: Int = 0 for i in range(len(self.ints)): sum += self.ints[i] return sum fn __bool__(self) -> Bool: print("bool called") return len(self.ints)>0 fn __str__(self) -> String: print("str called") return "MyStruct" ``` Usage: ```mojo var st = MyStruct(List(1, 2, 3)) print(len(st)) print(int(st)) if st: # Uses __bool__ print("MyStruct is true") print(str(st)) print(st) # Can directly print st because the __str__ method is implemented ``` ##### __is__ The __is__ method is used by the is clause to compare the identity between two values, and returns True if the identities are the same. Note that it is different from the eq method. The eq compares if two values are the same content-wise, while is checks if the two values are having the same identities. This means that two objects may have exactly same content, but different identities. Typical implementations check if the memory location of the two values are the same, in which case it would be considered as being identical. ##### __isnot__ The __isnot__ method is used by the is not clause to compare the identity between two values, and returns True if the identities are not the same. It is the opposite of the is clause, and in most cases it is sufficient for the implementation to return a negation of the is method. The following code listing provides examples of is and isnot methods. ```mojo struct MyStruct: var ptr: UnsafePointer[Int] fn __init__(inout self, ptr: UnsafePointer[Int]): self.ptr = ptr fn __is__(self, other: MyStruct) -> Bool: print("__is__ called") return self.ptr == other.ptr fn __isnot__(self, other: MyStruct) -> Bool: print("__isnot__ called") return not(self is other) ``` Usage: ```mojo var x: Int = 10 var y: Int = 10 print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(y))) # Results in False print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(x))) # Results in True print(MyStruct(UnsafePointer.address_of(x)) is not MyStruct(UnsafePointer.address_of(y))) # Results in True ``` ##### __getattr__ Many dynamic languages allow us to dynamically define attributes that do not exist in the original struct definition (or class definition in most languages). This ability allows programmers to define an ergonomic API, especially for object relational mapping. Even though Mojo is a statically compiled language, it allows for such a dynamic definition of attributes through a combination of methods, __getattr__ and __setattr__. The __getattr__ method takes in the attribute name as an argument. When you call an attribute my_attr within a struct (my_struct.my_attr), it is this attribute name my_attr that gets passed as the argument to the method __getattr__. Within the __getattr__, you can as an example return a result based on a database query involving the attribute name. Mojo does not restrict what you do with the attribute name, as long as you return a value conforming to the return type of the function. ##### __setattr__ The __setattr__ method takes in the attribute name and its value as arguments. When you set an attribute my_attr within a struct with a value (my_struct.my_attr = 'a value'), the __setattr__ is called with the given attribute name my_attr and the value 'a value' passed as arguments. The following code listing provides examples of getattr and setattr methods. ```mojo struct MyStruct: var fields: Dict[String, String] fn __init__(inout self, fields: Dict[String, String]): self.fields = fields fn __getattr__(self, attr: String) raises -> String: return self.fields[attr] fn __setattr__(inout self, attr: String, value: String) raises: self.fields[attr] = value ``` Usage: ```mojo var d: Dict[String, String] = Dict[String, String]() d["name"] = "IK" var st = MyStruct(d) print(st.name) # __getattr__ is called here st.name = "PK" # __setattr__ is called here print(st.name) ``` ##### __contains__ In Mojo you can check if a value is contained within a struct using the in operator. For example, "IK" in my_string, where my_string is a string and the expression results in value True if the literal IK is found within my_string. The __contains__ method is used by the in operator to check if a given value is within the struct defining that method. The following code listing provides an example of contains method. ```mojo struct MyStruct: var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __contains__(self, value: Int) -> Bool: for i in self.ints: if i[] == value: return True return False ``` Usage: ```mojo var my_struct = MyStruct(List(1, 2, 3)) print(1 in my_struct) # Returns True print(5 in my_struct) # Returns False ``` The __contains__ method also works with custom types as shown in the example below. ```mojo struct MyStruct2: var first_name: String var last_name: String fn __init__(inout self, first_name: String, last_name: String): self.first_name = first_name self.last_name = last_name fn __contains__(self, other: MyStruct2) -> Bool: return (self.first_name == other.first_name) or self.last_name == other.last_name ``` Usage: ```mojo var my_struct2 = MyStruct2("Ram", "C") print(MyStruct2("Ram", "T") in my_struct2) # Returns True print(MyStruct2("Kri", "C") in my_struct2) # Returns True print(MyStruct2("C", "Ram") in my_struct2) # Returns False ``` ← Previous: Error handling | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Lifecycle and ownership → ================================================================================ URL: https://ruhati.net/mojo/_operators_and_special_methods.html#_bitwise_operators # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods 11.1. Arithmetic operators 11.2. Bitwise operators 11.3. Relational operators 11.4. Index operators 11.5. Context management methods 11.6. Other special methods - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods ## 11. Operators and special methods In Mojo some functions have special naming convention, starting and ending with double underscores: "_". Since they start and end with __double underscores_, they are called dunder methods. These methods are treated specially by Mojo compiler. Mojo supports implementation of arithmetic and relational operators, along with special methods that support lifecycle of values. In previous chapters, we saw many times the arithmetic and relational operators. Most of these operators can be implemented by user defined structs. Mojo provides quite a bit of flexibility in defining your own low level structs and the ability to implement these operators is part of that flexibility. Implementing an operator is as simple as implementing a function. Many of Mojo’s built in functionality is implemented as libraries. This means that we are able to implement powerful constructs just using basic language features offered by Mojo. ### 11.1. Arithmetic operators The following sections describe the various arithmetic operators in Mojo. #### 11.1.1. Addition The following are the addition operators. ##### __add__ The __add__ stands for arithmetic addition "+" between the struct defining the method and self type or another type. ##### __radd__ The __radd__ method is known as reverse addition, and is used when we try to add two values, where the first value does not have __add__ implemented. In this case, the Mojo compiler checks if the second value has __radd__ implemented, and it calls that one. ##### __iadd__ The __iadd__ method is called in-place addition and represents arithmetic addition "=". Even if you implement just `\\__add__` and do not implement `\\__iadd__`, the "=" operation would still work as Mojo will just use __add__ as the fallback. However, typically __add__ returns a new instance of the result. In case of large structs (structs with many fields), it could entail a lot of copy operations. The in-place addition can directly change the struct’s internal data, resulting in an efficient execution of the addition method. The __iadd__ therefore does not have a return value as it updates the struct itself. Since the struct' internal value is mutated, we need to use one of the inout or owned references of self in the method. The following code listing shows the different operations. Please note that these examples are not meant for production use, as it is intentionally kept incomplete for simplicity’s sake. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __add__(self, other: Self) -> Self: print("add invoked") return Self(self.val + other.val) fn __radd__(self, other: MyFloat) -> Self: print("radd invoked") return Self(self.val + int(other.val)) fn __iadd__(inout self, other: Self): print("iadd invoked") self.val = self.val + other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var add_res = MyInt(1) + MyInt(2) print(add_res.val) var radd_res = MyFloat(3.5) + MyInt(2) # Even though MyFloat does not implement __add__ method, we are able to do addition through MyInt's __radd__ print(radd_res.val) var iadd_res = MyInt(10) iadd_res += MyInt(20) print(iadd_res.val) ``` #### 11.1.2. Subtraction The following are the subtraction operators. ##### __sub__ The __sub__ stands for arithmetic subtraction "-" between the struct defining the method and self type or another type. ##### __rsub__ The __rsub__ method is known as reverse subtraction, and is used when we try to subtract two values, where the first value does not have __sub__ implemented. In this case, the Mojo compiler checks if the second value has __rsub__ implemented, and it calls that one. As the name implies, the reverse subtraction swaps the operands. Since subtraction is non-commutative, care must be taken to have correct values as the first operand and second operands. For example, x - y in normal subtraction would be y - x in reverse subtraction. ##### __isub__ The __isub__ method is called in-place subtraction and represents arithmetic subtraction "-=". The concept of __isub__ is the same as what we saw in __iadd__. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __sub__(self, other: Self) -> Self: print("sub invoked") return Self(self.val - other.val) fn __rsub__(self, other: MyFloat) -> Self: print("rsub invoked") return Self(int(other.val) - self.val) # Order matters for subtraction; it is not commutative. fn __isub__(inout self, other: Self): print("isub invoked") self.val = self.val - other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var sub_res = MyInt(1) - MyInt(2) print(sub_res.val) var rsub_res = MyFloat(3.5) - MyInt(2) # Even though MyFloat does not implement __sub__ method, we are able to do addition through MyInt's __rsub__ print(rsub_res.val) var isub_res = MyInt(10) isub_res -= MyInt(20) print(isub_res.val) ``` #### 11.1.3. Multiplication The following are multiplication operators. ##### __mul__ The __mul__ stands for multiplication "*" between the struct defining the method and self type or another type. ##### __rmul__ The __rmul__ method is known as reverse multiplication, and is used when we try to multiply two values, where the first value does not have __mul__ implemented. In this case, the Mojo compiler checks if the second value has __rmul__ implemented, and it calls that one. ##### __imul__ The __imul__ method is called in-place multiplication and represents multiplication "*=". The concept of __imul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is multiplication. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mul__(self, other: Self) -> Self: print("mul invoked") return Self(self.val * other.val) fn __rmul__(self, other: MyFloat) -> Self: print("rmul invoked") return Self(int(other.val) * self.val) # Will truncate fn __imul__(inout self, other: Self): print("imul invoked") self.val = self.val * other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mul_res = MyInt(3) * MyInt(2) print(mul_res.val) var rmul_res = MyFloat(3.5) * MyInt(2) print(rmul_res.val) var imul_res = MyInt(10) imul_res *= MyInt(20) print(imul_res.val) ``` #### 11.1.4. Matrix multiplication The following are operators for matrix multiplication. ##### __matmul__ The __matmul__ stands for matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. ##### __rmatmul__ The __rmatmul__ stands for the reverse matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imatmul__ The __imatmul__ stands for in-place matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. The concept of __imatmul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is matrix multiplication. ```mojo struct MyFloatMatrix: var val: List[List[Float16]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Float16]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyFloatMatrix(List[List[Float16]](), 0, 0) struct MyIntMatrix: var val: List[List[Int]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Int]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyIntMatrix(List[List[Int]](), 0, 0) fn print(self): print("....") print("Rows:", self.rows, "Cols:", self.cols) for row in self.val: print() for col in row[]: print(col[], end=" ") print() print("----") @staticmethod fn _matmul_internal(first: Self, second: Self) -> Self: if first.cols != first.rows: print("Rows and columns do not match. ") return MyIntMatrix.empty() var res: List[List[Int]] = List[List[Int]](capacity=first.rows) for i in range(first.rows): res.append(List[Int](capacity=second.cols)) for j in range(second.cols): var s = 0 for k in range(first.cols): s += first.val[i][k] * second.val[k][j] res[i].append(s) return Self(res, first.rows, second.cols) fn __matmul__(self, other: Self) -> Self: # Naive implementation - not for production use print("matmul invoked") return Self._matmul_internal(self, other) fn __rmatmul__(self, other: MyFloatMatrix) -> Self: # Naive implementation - not for production use print("rmatmul invoked") var res: List[List[Int]] = List[List[Int]](capacity=self.rows) for i in range(other.rows): res.append(List[Int](capacity=self.cols)) for j in range(self.cols): var s = 0 for k in range(other.cols): s += int(other.val[i][k]) * self.val[k][j] # Will truncate res[i].append(s) return Self(res, other.rows, self.cols) fn __imatmul__(inout self, other: Self): # Naive implementation - not for production use print("imatmul invoked") var res = Self._matmul_internal(self, other) self.val = res.val self.rows = res.rows self.cols = res.cols ``` Usage: ```mojo var m : List[List[Int]] = List( List(1, 2, 1), List(5, 1, 1), List(2, 3, 1)) var n: List[List[Int]] = List( List(2, 5), List(6, 7), List(1, 1)) var flm : List[List[Float16]] = List( List[Float16](1.2, 2.3, 1.4), List[Float16](5.2, 1.2, 1.3), List[Float16](2.3, 3.4, 1.4)) var matmul_res = MyIntMatrix(m, 3, 3) @ MyIntMatrix(n, 3, 2) matmul_res.print() var rmatmul_res = MyFloatMatrix(flm, 3, 3) @ MyIntMatrix(n, 3, 2) rmatmul_res.print() var imatmul_res = MyIntMatrix(m, 3, 3) imatmul_res @= MyIntMatrix(n, 3, 2) imatmul_res.print() ``` #### 11.1.5. Division The division operators. ##### __truediv__ The __truediv__ stands for division represented by the symbol "/" between the struct defining the method and self type or another type. The result of \\__truediv is a floating point type with 64 bits. ##### __rtruediv__ The __rtruediv__ stands for the reverse division represented by the symbol "/" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __itruediv__ The __itruediv__ stands for in-place division represented by the symbol "/" between the struct defining the method and self type or another type. The concept of __itruediv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __truediv__(self, other: Self) -> MyFloat: print("truediv invoked") return MyFloat(self.val / other.val) fn __rtruediv__(self, other: MyFloat) -> MyFloat: print("rtruediv invoked") return MyFloat(int(other.val) / self.val) fn __itruediv__(inout self, other: Self): print("itruediv invoked") self.val = int(self.val / other.val) # Will truncate ``` Usage: ```mojo var num: MyInt = MyInt(42) var div_res = MyInt(3) / MyInt(2) print(div_res.val) var rdiv_res = MyFloat(3.5) / MyInt(2) print(rdiv_res.val) var idiv_res = MyInt(10) idiv_res /= MyInt(20) print(idiv_res.val) ``` Note that __itruediv__ implementation had to convert the result from a Float to Int because MyInt can only store Int as value within it. Mojo has the ability to have a variable with multiple possible types through Variant struct. We will cover that in a later chapter. ##### __floordiv__ The __floordiv__ stands for floor division (also known as integer division) represented by the symbol "//" between the struct defining the method and self type or another type. As the name suggest, the result of the __floordiv__ is an integer instead of float. Typically implementations truncate towards zero in case of positive values and away from zero for negative values. For example, 7//3 results in 2, while -7//3 results in -3 and not -2. ##### __rfloordiv__ The __rfloordiv__ stands for the reverse division represented by the symbol "//" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ifloordiv__ The __ifloordiv__ stands for in-place division represented by the symbol "//" between the struct defining the method and self type or another type. The concept of __ifloordiv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is floor division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __floordiv__(self, other: Self) -> Self: print("floordiv invoked") return Self(self.val // other.val) fn __rfloordiv__(self, other: MyFloat) -> Self: print("rfloordiv invoked") return Self(int(other.val) // self.val) fn __ifloordiv__(inout self, other: Self): print("ifloordiv invoked") self.val = self.val // other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var floordiv_res = MyInt(3) // MyInt(2) print(floordiv_res.val) var rfloordiv_res = MyFloat(3.5) // MyInt(2) print(rfloordiv_res.val) var ifloordiv_res = MyInt(10) ifloordiv_res //= MyInt(20) print(ifloordiv_res.val) ``` #### 11.1.6. Modulo The following are the modulo operators. ##### __mod__ The __mod__ stands for modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The approach to implement __mod__ is the same as what we saw in __truediv__, except instead of division, the applied operation is modulo operation. The __mod__ derives its name from the mathematical modulo operation. Modulo operation divides two numbers and returns the remainder of the division. ##### __rmod__ The __rmod__ stands for the reverse modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imod__ The __imod__ stands for in-place modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The concept of __imod__ is the same as what we saw in __itruediv__, except instead of division, the applied operation is modulo. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mod__(self, other: Self) -> Self: print("mod invoked") return Self(self.val % other.val) fn __rmod__(self, other: MyFloat) -> Self: print("rmod invoked") return Self(int(other.val) % self.val) fn __imod__(inout self, other: Self): print("imod invoked") self.val = self.val % other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mod_res = MyInt(7) % MyInt(2) print(mod_res.val) var rmod_res = MyFloat(8) % MyInt(2) print(rmod_res.val) var imod_res = MyInt(37) imod_res %= MyInt(20) print(imod_res.val) ``` #### 11.1.7. Exponentiation The following lists the exponentiation operators. ##### __pow__ The __pow__ stands for exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The approach to implement __pow__ is the same as what we saw in __mul__, except instead of multiplication, we apply exponential operation. ##### __ipow__ The __ipow__ stands for in-place exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The concept of __ipow__ is the same as what we saw in __imul__, except instead of multiplication, we apply exponential operation. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pow__(self, other: Self) -> Self: print("pow invoked") return Self(self.val ** other.val) fn __ipow__(inout self, other: Self): print("ipow invoked") self.val **= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var pow_res = MyInt(7) ** MyInt(2) print(pow_res.val) var ipow_res = MyInt(7) ipow_res **= MyInt(2) print(ipow_res.val) ``` #### 11.1.8. Unary operators The following are the unary operators. ##### __neg__ The __neg__ stands for the unary operation represented by the symbol "-" for the struct defining the method. The negative sign appears as prefix to the value and typically results in negation of the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __neg__(self) -> Self: print("neg invoked") return Self(-self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var neg_res = -MyInt(7) print(neg_res.val) ``` ##### __pos__ The __pos__ stands for the unary operation represented by the symbol "+" for the struct defining the method. The positive sign appears as prefix to the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pos__(self) -> Self: print("pos invoked") return Self(+self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var pos_res = +MyInt(7) print(pos_res.val) ``` ##### __invert__ The __invert__ stands for the unary operation represented by the symbol "~" for the struct defining the method. The invert sign appears as prefix to the value. Typical implementations return bitwise compliment of the value, switching 1 for 0 and vice versa. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __invert__(self) -> Self: print("invert invoked") return Self(~self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var invert_res = ~MyInt(2) print(invert_res.val) ``` ### 11.2. Bitwise operators The following are the bitwise operators. #### 11.2.1. Operators ##### __lshift__ The __lshift__ stands for left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. ##### __rlshift__ The __rlshift__ stands for the reverse left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ilshift__ The __ilshift__ stands for in-place left shift operation represented by the symbol "<⇐" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __lshift__, the __ilshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lshift__(self, other: Self) -> Self: print("lshift invoked") return Self(self.val << other.val) fn __rlshift__(self, other: MyFloat) -> Self: print("rlshift invoked") return Self(int(other.val) << self.val) fn __ilshift__(inout self, other: Self): print("ilshift invoked") self.val <<= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var lshift_res = MyInt(2) << MyInt(3) print(lshift_res.val) var rlshift_res = MyFloat(2) << MyInt(3) print(rlshift_res.val) var ilshift_res = MyInt(3) ilshift_res <<= MyInt(2) print(ilshift_res.val) ``` ##### __rshift__ The __rshift__ stands for right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the right. The second operand indicates how many bits are to be shifted to the right. ##### __rrshift__ The __rrshift__ stands for the reverse right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Similar to __rlshift__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __irshift__ The __irshift__ stands for in-place right shift operation represented by the symbol ">>=" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __rshift__, the __irshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __rshift__(self, other: Self) -> Self: print("rshift invoked") return Self(self.val >> other.val) fn __rrshift__(self, other: MyFloat) -> Self: print("rrshift invoked") return Self(int(other.val) >> self.val) fn __irshift__(inout self, other: Self): print("irshift invoked") self.val >>= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var rshift_res = MyInt(20) >> MyInt(3) print(rshift_res.val) var rrshift_res = MyFloat(24) >> MyInt(3) print(rrshift_res.val) var irshift_res = MyInt(30) irshift_res >>= MyInt(2) print(irshift_res.val) ``` ##### __and__ The __and__ stands for bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. ##### __rand__ The __rand__ stands for reverse bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. This is invoked when the first value does not have __and__ implemented. In this case, the Mojo compiler checks if the second value has __rand__ implemented, and calls that one. ##### __iand__ The __iand__ stands for in-place bitwise AND operator represented by the symbol "&=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __and__, the __iand__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __and__(self, other: Self) -> Self: print("and invoked") return Self(self.val & other.val) fn __rand__(self, other: MyFloat) -> Self: print("rand invoked") return Self(int(other.val) & self.val) fn __iand__(inout self, other: Self): print("iand invoked") self.val &= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var and_res = MyInt(23) & MyInt(6) print(and_res.val) var rand_res = MyFloat(20) & MyInt(4) print(rand_res.val) var iand_res = MyInt(10) iand_res &= MyInt(2) print(iand_res.val) ``` ##### __or__ The __or__ stands for bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. ##### __ror__ The __ror__ stands for reverse bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. This is invoked when the first value does not have __or__ implemented. In this case, the Mojo compiler checks if the second value has __ror__ implemented, and calls that one. ##### __ior__ The __ior__ stands for in-place bitwise OR operator represented by the symbol "|=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __or__, the __ior__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __or__(self, other: Self) -> Self: print("or invoked") return Self(self.val | other.val) fn __ror__(self, other: MyFloat) -> Self: print("ror invoked") return Self(int(other.val) | self.val) fn __ior__(inout self, other: Self): print("ior invoked") self.val |= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var or_res = MyInt(5) | MyInt(3) print(or_res.val) var ror_res = MyFloat(15) | MyInt(17) print(ror_res.val) var ior_res = MyInt(5) ior_res |= MyInt(1) print(ior_res.val) ``` ##### __xor__ The __xor__ stands for bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. ##### __rxor__ The __rxor__ stands for reverse bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. This is invoked when the first value does not have __xor__ implemented. In this case, the Mojo compiler checks if the second value has __rxor__ implemented, and calls that one. ##### __ixor__ The __ixor__ stands for in-place bitwise OR operator represented by the symbol "^=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __xor__, the __ixor__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __xor__(self, other: Self) -> Self: print("xor invoked") return Self(self.val ^ other.val) fn __rxor__(self, other: MyFloat) -> Self: print("rxor invoked") return Self(int(other.val) ^ self.val) fn __ixor__(inout self, other: Self): print("ixor invoked") self.val ^= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var xor_res = MyInt(5) ^ MyInt(3) print(xor_res.val) var rxor_res = MyFloat(15) ^ MyInt(17) print(rxor_res.val) var ixor_res = MyInt(5) ixor_res ^= MyInt(3) print(ixor_res.val) ``` ### 11.3. Relational operators #### 11.3.1. Operators ##### __eq__ The __eq__ stands for equality operator represented by the symbol "==" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __eq__(self, other: Self) -> Bool: print("eq invoked") return self.val == other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) == MyInt(5)) print(MyInt(5) == MyInt(3)) ``` ##### __ne__ The __ne__ stands for inequality operator represented by the symbol "!=" between the struct defining the method and self type or another type. The operation returns a Bool value. Note that __ne__ is not invoked when you call not x==y though. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ne__(self, other: Self) -> Bool: print("ne invoked") return self.val != other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) != MyInt(5)) print(MyInt(5) != MyInt(3)) print(not MyInt(5) == MyInt(3)) ``` ##### __lt__ The __lt__ stands for less-than operator represented by the symbol "<" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lt__(self, other: Self) -> Bool: print("lt invoked") return self.val < other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) < MyInt(5)) print(MyInt(3) < MyInt(5)) ``` ##### __gt__ The __gt__ stands for greater-than operator represented by the symbol ">" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __gt__(self, other: Self) -> Bool: print("gt invoked") return self.val > other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) > MyInt(5)) print(MyInt(5) > MyInt(3)) ``` ##### __le__ The __le__ stands for less-than-or-equal-to operator represented by the symbol "⇐" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __le__(self, other: Self) -> Bool: print("le invoked") return self.val <= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) <= MyInt(5)) print(MyInt(5) <= MyInt(3)) ``` ##### __ge__ The __ge__ stands for greater-than-or-equal-to operator represented by the symbol ">=" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ge__(self, other: Self) -> Bool: print("ge invoked") return self.val >= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) >= MyInt(5)) print(MyInt(3) >= MyInt(5)) ``` ### 11.4. Index operators Any large scale program would use collection data types such as lists, arrays, dictionaries extensively. Some programming languages have built-in syntax to make usage of such types convenient. Mojo has built-in syntactical support for collection types. Mojo allows accessing collection like data types using the syntax []. For example, list[2]. It also allows setting of values at a given index (e.g. list[2]=5). In line with Mojo’s philosophy of moving as much functionality as possible to libraries, instead of having specially treated data types that have exclusive privilege of syntax, Mojo opened up the index operator capability to any type that defines __getitem__ and __setitem__ methods. This means that your custom List struct will have the same syntactical support like the List bundled with Mojo. #### 11.4.1. Operators ##### __getitem__ The __getitem__ is the method invoked when you try to access values stored within the collection using the my_list[index] syntax (where my_list is the collection and index is the position of the element desired from the list). ##### __setitem__ The __setitem__ is the method invoked when you try to assign values to a collection using the my_list[index]=value syntax (where my_list is the collection and index is the position at which the value will be assigned). ```mojo struct MyCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, x: Int) -> String: return self.list[x] fn __setitem__(inout self, x: Int, val: String): self.list[x] = val ``` Usage: ```mojo var x = MyCollection(List(String("A"), String("B"))) print("Before:", x[1]) # Gets x[1] = String("C") # Sets print("After:", x[1]) ``` It is also possible to get and set using multiple indices, especially useful for Matrix like data structures. This means that we can use in our code my_list[row, col, and so on…​]. The following code listing shows such an example for a matrix. Note that this example is not a production quality implementation. ```mojo struct MyMatrix: var val: List[List[String]] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.rows = rows self.cols = cols self.val = List[List[String]](capacity=rows) for row in range(rows): self.val.append(List[String](capacity=cols)) for col in range(cols): self.val[row].append(String("None")) fn __getitem__(self, row: Int, col: Int) -> String: return self.val[row][col] fn __setitem__(inout self, row: Int, col: Int, s: String): self.val[row][col] = s ``` Usage: ```mojo var y = MyMatrix(5, 3) print("Before:", y[1, 2]) # Gets y[1, 2] = String("D") # Sets print("After:", y[1, 2]) ``` ##### __getitem__ with Slice Mojo supports getting a slice of a collection or a container using the slicing operator. The following diagram shows the structure of the slicing operator. In order to be able to get a slice from a collection or a container, the collection or the container must implement method __getitem__ that takes a Slice object. This Slice object is instantiated by the Mojo compiler when you use the slice operator. In a way you can think of the [start:stop:step] as a literal form instantiating a Slice. The start argument of Slice is the start index of the collection from where the slice will be taken. The end argument is the last index until which the slice will be taken (the element referred by this index will be excluded, only its previous element will be taken as last for the slice). The step gives the number of increments to be taken to get the next element. Any of the arguments of the Slice can be negative. A negative value means reversal of the indexing or stepping. Care must be taken to provide valid combinations though, otherwise it results in error. ```mojo struct MySliceableCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, slc: Slice) -> List[String]: return self.list[slc.start:slc.end:slc.step] ``` Usage: ```mojo var z = MySliceableCollection( List(String("H"), String("E"), String("L"), String("L"), String("O"), String("W"), String("O"), )) for i in z[0:3:1]: print(i[], end=" ") print() for i in z[1:6:2]: print(i[], end=" ") print() for i in z[1:]: print(i[], end=" ") print() for i in z[:1]: print(i[], end=" ") print() for i in z[-3:]: print(i[], end=" ") print() for i in z[:-3]: print(i[], end=" ") print() for i in z[::-1]: print(i[], end=" ") print() ``` ### 11.5. Context management methods In large programs, we often need to resources like files and database connections. When we open access to those resources, we typically have a handle, which we use to perform actions. However, once we have done with our actions, we must remember to cleanup or close the resources, otherwise we end up with dangling resources, memory leaks, locked files, etc. Mojo provides with keyword for managing such context or resources. The following diagram illustrates the syntax of the with statement. #### 11.5.1. Methods ##### __enter__ The method that handles the allocation of the resource and returns a resource. The resource has scope only within the body of the with. It is not mandatory to assign the return value to a variable, especially if it is not being used. ##### __exit__ The method that handles the cleanup of the resource. There are two implementations of the __exit__ method, one without any arguments __exit__(self, Error) and one with Error as an argument __exit__(self, Error). The __exit__(self, Error) is invoked when the with body has an exception and exits the with block abnormally. The method __exit__(self, Error) returns a Bool to indicate whether or not to propagate the error further. Any resources allocated in the __enter__ must be cleaned up at both the __exit__ methods, otherwise we would end up with dangling resources. For example, if __exit__(self, Error) is not properly implemented, resource leaks will occur only when there are exceptions raised within the with body. This will lead to rare but difficult to find defects. The following code listing shows an example for the context manager. ```mojo struct Resource: var name: String fn __init__(inout self, name: String): self.name = name fn open(self): print("Opened") fn close(self): print("Close") fn __copyinit__(inout self, other:Resource): self.name = other.name struct MyResourceManager: var resource: Resource fn __init__(inout self): self.resource = Resource("a_resource") fn __enter__(self) -> Resource: print("Entered context") self.resource.open() return self.resource fn __exit__(self): self.resource.close() print("Exited context") fn __exit__(self, err: Error) -> Bool: self.resource.close() print("Exited context") return False ``` Usage: ```mojo with MyResourceManager() as res: print("Inside context, resource is:", res.name) raise Error("An error while processing") ``` ### 11.6. Other special methods #### 11.6.1. Methods ##### __len__ The __len__ is defined within Sized trait and is used by the built-in len function. The __len__ method returns the length or size of the struct implementing it. ##### __int__ The __int__ is defined within Intable trait and is used by the built-in int function. The __int__ method returns an integer representation of the struct implementing it. ##### __bool__ The __bool__ is defined within Boolable trait and is used by conditional statements such as if to convert the given value to a boolean value for evaluation. The __bool__ method returns a boolean representation of the struct implementing it. ##### __str__ The __str__ is defined within Stringable trait and is used by the built-in str function. The __str__ method returns an string representation of the struct implementing it. The built-in function print uses __str__ before it prints the given value. The following code listing provides examples of special methods. ```mojo struct MyStruct(Sized, Intable, Boolable, Stringable): var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __len__(self) -> Int: print("len called") return len(self.ints) fn __int__(self) -> Int: print("int called") var sum: Int = 0 for i in range(len(self.ints)): sum += self.ints[i] return sum fn __bool__(self) -> Bool: print("bool called") return len(self.ints)>0 fn __str__(self) -> String: print("str called") return "MyStruct" ``` Usage: ```mojo var st = MyStruct(List(1, 2, 3)) print(len(st)) print(int(st)) if st: # Uses __bool__ print("MyStruct is true") print(str(st)) print(st) # Can directly print st because the __str__ method is implemented ``` ##### __is__ The __is__ method is used by the is clause to compare the identity between two values, and returns True if the identities are the same. Note that it is different from the eq method. The eq compares if two values are the same content-wise, while is checks if the two values are having the same identities. This means that two objects may have exactly same content, but different identities. Typical implementations check if the memory location of the two values are the same, in which case it would be considered as being identical. ##### __isnot__ The __isnot__ method is used by the is not clause to compare the identity between two values, and returns True if the identities are not the same. It is the opposite of the is clause, and in most cases it is sufficient for the implementation to return a negation of the is method. The following code listing provides examples of is and isnot methods. ```mojo struct MyStruct: var ptr: UnsafePointer[Int] fn __init__(inout self, ptr: UnsafePointer[Int]): self.ptr = ptr fn __is__(self, other: MyStruct) -> Bool: print("__is__ called") return self.ptr == other.ptr fn __isnot__(self, other: MyStruct) -> Bool: print("__isnot__ called") return not(self is other) ``` Usage: ```mojo var x: Int = 10 var y: Int = 10 print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(y))) # Results in False print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(x))) # Results in True print(MyStruct(UnsafePointer.address_of(x)) is not MyStruct(UnsafePointer.address_of(y))) # Results in True ``` ##### __getattr__ Many dynamic languages allow us to dynamically define attributes that do not exist in the original struct definition (or class definition in most languages). This ability allows programmers to define an ergonomic API, especially for object relational mapping. Even though Mojo is a statically compiled language, it allows for such a dynamic definition of attributes through a combination of methods, __getattr__ and __setattr__. The __getattr__ method takes in the attribute name as an argument. When you call an attribute my_attr within a struct (my_struct.my_attr), it is this attribute name my_attr that gets passed as the argument to the method __getattr__. Within the __getattr__, you can as an example return a result based on a database query involving the attribute name. Mojo does not restrict what you do with the attribute name, as long as you return a value conforming to the return type of the function. ##### __setattr__ The __setattr__ method takes in the attribute name and its value as arguments. When you set an attribute my_attr within a struct with a value (my_struct.my_attr = 'a value'), the __setattr__ is called with the given attribute name my_attr and the value 'a value' passed as arguments. The following code listing provides examples of getattr and setattr methods. ```mojo struct MyStruct: var fields: Dict[String, String] fn __init__(inout self, fields: Dict[String, String]): self.fields = fields fn __getattr__(self, attr: String) raises -> String: return self.fields[attr] fn __setattr__(inout self, attr: String, value: String) raises: self.fields[attr] = value ``` Usage: ```mojo var d: Dict[String, String] = Dict[String, String]() d["name"] = "IK" var st = MyStruct(d) print(st.name) # __getattr__ is called here st.name = "PK" # __setattr__ is called here print(st.name) ``` ##### __contains__ In Mojo you can check if a value is contained within a struct using the in operator. For example, "IK" in my_string, where my_string is a string and the expression results in value True if the literal IK is found within my_string. The __contains__ method is used by the in operator to check if a given value is within the struct defining that method. The following code listing provides an example of contains method. ```mojo struct MyStruct: var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __contains__(self, value: Int) -> Bool: for i in self.ints: if i[] == value: return True return False ``` Usage: ```mojo var my_struct = MyStruct(List(1, 2, 3)) print(1 in my_struct) # Returns True print(5 in my_struct) # Returns False ``` The __contains__ method also works with custom types as shown in the example below. ```mojo struct MyStruct2: var first_name: String var last_name: String fn __init__(inout self, first_name: String, last_name: String): self.first_name = first_name self.last_name = last_name fn __contains__(self, other: MyStruct2) -> Bool: return (self.first_name == other.first_name) or self.last_name == other.last_name ``` Usage: ```mojo var my_struct2 = MyStruct2("Ram", "C") print(MyStruct2("Ram", "T") in my_struct2) # Returns True print(MyStruct2("Kri", "C") in my_struct2) # Returns True print(MyStruct2("C", "Ram") in my_struct2) # Returns False ``` ← Previous: Error handling | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Lifecycle and ownership → ================================================================================ URL: https://ruhati.net/mojo/_operators_and_special_methods.html#_relational_operators # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods 11.1. Arithmetic operators 11.2. Bitwise operators 11.3. Relational operators 11.4. Index operators 11.5. Context management methods 11.6. Other special methods - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods ## 11. Operators and special methods In Mojo some functions have special naming convention, starting and ending with double underscores: "_". Since they start and end with __double underscores_, they are called dunder methods. These methods are treated specially by Mojo compiler. Mojo supports implementation of arithmetic and relational operators, along with special methods that support lifecycle of values. In previous chapters, we saw many times the arithmetic and relational operators. Most of these operators can be implemented by user defined structs. Mojo provides quite a bit of flexibility in defining your own low level structs and the ability to implement these operators is part of that flexibility. Implementing an operator is as simple as implementing a function. Many of Mojo’s built in functionality is implemented as libraries. This means that we are able to implement powerful constructs just using basic language features offered by Mojo. ### 11.1. Arithmetic operators The following sections describe the various arithmetic operators in Mojo. #### 11.1.1. Addition The following are the addition operators. ##### __add__ The __add__ stands for arithmetic addition "+" between the struct defining the method and self type or another type. ##### __radd__ The __radd__ method is known as reverse addition, and is used when we try to add two values, where the first value does not have __add__ implemented. In this case, the Mojo compiler checks if the second value has __radd__ implemented, and it calls that one. ##### __iadd__ The __iadd__ method is called in-place addition and represents arithmetic addition "=". Even if you implement just `\\__add__` and do not implement `\\__iadd__`, the "=" operation would still work as Mojo will just use __add__ as the fallback. However, typically __add__ returns a new instance of the result. In case of large structs (structs with many fields), it could entail a lot of copy operations. The in-place addition can directly change the struct’s internal data, resulting in an efficient execution of the addition method. The __iadd__ therefore does not have a return value as it updates the struct itself. Since the struct' internal value is mutated, we need to use one of the inout or owned references of self in the method. The following code listing shows the different operations. Please note that these examples are not meant for production use, as it is intentionally kept incomplete for simplicity’s sake. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __add__(self, other: Self) -> Self: print("add invoked") return Self(self.val + other.val) fn __radd__(self, other: MyFloat) -> Self: print("radd invoked") return Self(self.val + int(other.val)) fn __iadd__(inout self, other: Self): print("iadd invoked") self.val = self.val + other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var add_res = MyInt(1) + MyInt(2) print(add_res.val) var radd_res = MyFloat(3.5) + MyInt(2) # Even though MyFloat does not implement __add__ method, we are able to do addition through MyInt's __radd__ print(radd_res.val) var iadd_res = MyInt(10) iadd_res += MyInt(20) print(iadd_res.val) ``` #### 11.1.2. Subtraction The following are the subtraction operators. ##### __sub__ The __sub__ stands for arithmetic subtraction "-" between the struct defining the method and self type or another type. ##### __rsub__ The __rsub__ method is known as reverse subtraction, and is used when we try to subtract two values, where the first value does not have __sub__ implemented. In this case, the Mojo compiler checks if the second value has __rsub__ implemented, and it calls that one. As the name implies, the reverse subtraction swaps the operands. Since subtraction is non-commutative, care must be taken to have correct values as the first operand and second operands. For example, x - y in normal subtraction would be y - x in reverse subtraction. ##### __isub__ The __isub__ method is called in-place subtraction and represents arithmetic subtraction "-=". The concept of __isub__ is the same as what we saw in __iadd__. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __sub__(self, other: Self) -> Self: print("sub invoked") return Self(self.val - other.val) fn __rsub__(self, other: MyFloat) -> Self: print("rsub invoked") return Self(int(other.val) - self.val) # Order matters for subtraction; it is not commutative. fn __isub__(inout self, other: Self): print("isub invoked") self.val = self.val - other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var sub_res = MyInt(1) - MyInt(2) print(sub_res.val) var rsub_res = MyFloat(3.5) - MyInt(2) # Even though MyFloat does not implement __sub__ method, we are able to do addition through MyInt's __rsub__ print(rsub_res.val) var isub_res = MyInt(10) isub_res -= MyInt(20) print(isub_res.val) ``` #### 11.1.3. Multiplication The following are multiplication operators. ##### __mul__ The __mul__ stands for multiplication "*" between the struct defining the method and self type or another type. ##### __rmul__ The __rmul__ method is known as reverse multiplication, and is used when we try to multiply two values, where the first value does not have __mul__ implemented. In this case, the Mojo compiler checks if the second value has __rmul__ implemented, and it calls that one. ##### __imul__ The __imul__ method is called in-place multiplication and represents multiplication "*=". The concept of __imul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is multiplication. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mul__(self, other: Self) -> Self: print("mul invoked") return Self(self.val * other.val) fn __rmul__(self, other: MyFloat) -> Self: print("rmul invoked") return Self(int(other.val) * self.val) # Will truncate fn __imul__(inout self, other: Self): print("imul invoked") self.val = self.val * other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mul_res = MyInt(3) * MyInt(2) print(mul_res.val) var rmul_res = MyFloat(3.5) * MyInt(2) print(rmul_res.val) var imul_res = MyInt(10) imul_res *= MyInt(20) print(imul_res.val) ``` #### 11.1.4. Matrix multiplication The following are operators for matrix multiplication. ##### __matmul__ The __matmul__ stands for matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. ##### __rmatmul__ The __rmatmul__ stands for the reverse matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imatmul__ The __imatmul__ stands for in-place matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. The concept of __imatmul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is matrix multiplication. ```mojo struct MyFloatMatrix: var val: List[List[Float16]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Float16]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyFloatMatrix(List[List[Float16]](), 0, 0) struct MyIntMatrix: var val: List[List[Int]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Int]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyIntMatrix(List[List[Int]](), 0, 0) fn print(self): print("....") print("Rows:", self.rows, "Cols:", self.cols) for row in self.val: print() for col in row[]: print(col[], end=" ") print() print("----") @staticmethod fn _matmul_internal(first: Self, second: Self) -> Self: if first.cols != first.rows: print("Rows and columns do not match. ") return MyIntMatrix.empty() var res: List[List[Int]] = List[List[Int]](capacity=first.rows) for i in range(first.rows): res.append(List[Int](capacity=second.cols)) for j in range(second.cols): var s = 0 for k in range(first.cols): s += first.val[i][k] * second.val[k][j] res[i].append(s) return Self(res, first.rows, second.cols) fn __matmul__(self, other: Self) -> Self: # Naive implementation - not for production use print("matmul invoked") return Self._matmul_internal(self, other) fn __rmatmul__(self, other: MyFloatMatrix) -> Self: # Naive implementation - not for production use print("rmatmul invoked") var res: List[List[Int]] = List[List[Int]](capacity=self.rows) for i in range(other.rows): res.append(List[Int](capacity=self.cols)) for j in range(self.cols): var s = 0 for k in range(other.cols): s += int(other.val[i][k]) * self.val[k][j] # Will truncate res[i].append(s) return Self(res, other.rows, self.cols) fn __imatmul__(inout self, other: Self): # Naive implementation - not for production use print("imatmul invoked") var res = Self._matmul_internal(self, other) self.val = res.val self.rows = res.rows self.cols = res.cols ``` Usage: ```mojo var m : List[List[Int]] = List( List(1, 2, 1), List(5, 1, 1), List(2, 3, 1)) var n: List[List[Int]] = List( List(2, 5), List(6, 7), List(1, 1)) var flm : List[List[Float16]] = List( List[Float16](1.2, 2.3, 1.4), List[Float16](5.2, 1.2, 1.3), List[Float16](2.3, 3.4, 1.4)) var matmul_res = MyIntMatrix(m, 3, 3) @ MyIntMatrix(n, 3, 2) matmul_res.print() var rmatmul_res = MyFloatMatrix(flm, 3, 3) @ MyIntMatrix(n, 3, 2) rmatmul_res.print() var imatmul_res = MyIntMatrix(m, 3, 3) imatmul_res @= MyIntMatrix(n, 3, 2) imatmul_res.print() ``` #### 11.1.5. Division The division operators. ##### __truediv__ The __truediv__ stands for division represented by the symbol "/" between the struct defining the method and self type or another type. The result of \\__truediv is a floating point type with 64 bits. ##### __rtruediv__ The __rtruediv__ stands for the reverse division represented by the symbol "/" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __itruediv__ The __itruediv__ stands for in-place division represented by the symbol "/" between the struct defining the method and self type or another type. The concept of __itruediv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __truediv__(self, other: Self) -> MyFloat: print("truediv invoked") return MyFloat(self.val / other.val) fn __rtruediv__(self, other: MyFloat) -> MyFloat: print("rtruediv invoked") return MyFloat(int(other.val) / self.val) fn __itruediv__(inout self, other: Self): print("itruediv invoked") self.val = int(self.val / other.val) # Will truncate ``` Usage: ```mojo var num: MyInt = MyInt(42) var div_res = MyInt(3) / MyInt(2) print(div_res.val) var rdiv_res = MyFloat(3.5) / MyInt(2) print(rdiv_res.val) var idiv_res = MyInt(10) idiv_res /= MyInt(20) print(idiv_res.val) ``` Note that __itruediv__ implementation had to convert the result from a Float to Int because MyInt can only store Int as value within it. Mojo has the ability to have a variable with multiple possible types through Variant struct. We will cover that in a later chapter. ##### __floordiv__ The __floordiv__ stands for floor division (also known as integer division) represented by the symbol "//" between the struct defining the method and self type or another type. As the name suggest, the result of the __floordiv__ is an integer instead of float. Typically implementations truncate towards zero in case of positive values and away from zero for negative values. For example, 7//3 results in 2, while -7//3 results in -3 and not -2. ##### __rfloordiv__ The __rfloordiv__ stands for the reverse division represented by the symbol "//" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ifloordiv__ The __ifloordiv__ stands for in-place division represented by the symbol "//" between the struct defining the method and self type or another type. The concept of __ifloordiv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is floor division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __floordiv__(self, other: Self) -> Self: print("floordiv invoked") return Self(self.val // other.val) fn __rfloordiv__(self, other: MyFloat) -> Self: print("rfloordiv invoked") return Self(int(other.val) // self.val) fn __ifloordiv__(inout self, other: Self): print("ifloordiv invoked") self.val = self.val // other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var floordiv_res = MyInt(3) // MyInt(2) print(floordiv_res.val) var rfloordiv_res = MyFloat(3.5) // MyInt(2) print(rfloordiv_res.val) var ifloordiv_res = MyInt(10) ifloordiv_res //= MyInt(20) print(ifloordiv_res.val) ``` #### 11.1.6. Modulo The following are the modulo operators. ##### __mod__ The __mod__ stands for modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The approach to implement __mod__ is the same as what we saw in __truediv__, except instead of division, the applied operation is modulo operation. The __mod__ derives its name from the mathematical modulo operation. Modulo operation divides two numbers and returns the remainder of the division. ##### __rmod__ The __rmod__ stands for the reverse modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imod__ The __imod__ stands for in-place modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The concept of __imod__ is the same as what we saw in __itruediv__, except instead of division, the applied operation is modulo. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mod__(self, other: Self) -> Self: print("mod invoked") return Self(self.val % other.val) fn __rmod__(self, other: MyFloat) -> Self: print("rmod invoked") return Self(int(other.val) % self.val) fn __imod__(inout self, other: Self): print("imod invoked") self.val = self.val % other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mod_res = MyInt(7) % MyInt(2) print(mod_res.val) var rmod_res = MyFloat(8) % MyInt(2) print(rmod_res.val) var imod_res = MyInt(37) imod_res %= MyInt(20) print(imod_res.val) ``` #### 11.1.7. Exponentiation The following lists the exponentiation operators. ##### __pow__ The __pow__ stands for exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The approach to implement __pow__ is the same as what we saw in __mul__, except instead of multiplication, we apply exponential operation. ##### __ipow__ The __ipow__ stands for in-place exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The concept of __ipow__ is the same as what we saw in __imul__, except instead of multiplication, we apply exponential operation. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pow__(self, other: Self) -> Self: print("pow invoked") return Self(self.val ** other.val) fn __ipow__(inout self, other: Self): print("ipow invoked") self.val **= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var pow_res = MyInt(7) ** MyInt(2) print(pow_res.val) var ipow_res = MyInt(7) ipow_res **= MyInt(2) print(ipow_res.val) ``` #### 11.1.8. Unary operators The following are the unary operators. ##### __neg__ The __neg__ stands for the unary operation represented by the symbol "-" for the struct defining the method. The negative sign appears as prefix to the value and typically results in negation of the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __neg__(self) -> Self: print("neg invoked") return Self(-self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var neg_res = -MyInt(7) print(neg_res.val) ``` ##### __pos__ The __pos__ stands for the unary operation represented by the symbol "+" for the struct defining the method. The positive sign appears as prefix to the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pos__(self) -> Self: print("pos invoked") return Self(+self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var pos_res = +MyInt(7) print(pos_res.val) ``` ##### __invert__ The __invert__ stands for the unary operation represented by the symbol "~" for the struct defining the method. The invert sign appears as prefix to the value. Typical implementations return bitwise compliment of the value, switching 1 for 0 and vice versa. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __invert__(self) -> Self: print("invert invoked") return Self(~self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var invert_res = ~MyInt(2) print(invert_res.val) ``` ### 11.2. Bitwise operators The following are the bitwise operators. #### 11.2.1. Operators ##### __lshift__ The __lshift__ stands for left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. ##### __rlshift__ The __rlshift__ stands for the reverse left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ilshift__ The __ilshift__ stands for in-place left shift operation represented by the symbol "<⇐" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __lshift__, the __ilshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lshift__(self, other: Self) -> Self: print("lshift invoked") return Self(self.val << other.val) fn __rlshift__(self, other: MyFloat) -> Self: print("rlshift invoked") return Self(int(other.val) << self.val) fn __ilshift__(inout self, other: Self): print("ilshift invoked") self.val <<= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var lshift_res = MyInt(2) << MyInt(3) print(lshift_res.val) var rlshift_res = MyFloat(2) << MyInt(3) print(rlshift_res.val) var ilshift_res = MyInt(3) ilshift_res <<= MyInt(2) print(ilshift_res.val) ``` ##### __rshift__ The __rshift__ stands for right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the right. The second operand indicates how many bits are to be shifted to the right. ##### __rrshift__ The __rrshift__ stands for the reverse right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Similar to __rlshift__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __irshift__ The __irshift__ stands for in-place right shift operation represented by the symbol ">>=" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __rshift__, the __irshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __rshift__(self, other: Self) -> Self: print("rshift invoked") return Self(self.val >> other.val) fn __rrshift__(self, other: MyFloat) -> Self: print("rrshift invoked") return Self(int(other.val) >> self.val) fn __irshift__(inout self, other: Self): print("irshift invoked") self.val >>= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var rshift_res = MyInt(20) >> MyInt(3) print(rshift_res.val) var rrshift_res = MyFloat(24) >> MyInt(3) print(rrshift_res.val) var irshift_res = MyInt(30) irshift_res >>= MyInt(2) print(irshift_res.val) ``` ##### __and__ The __and__ stands for bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. ##### __rand__ The __rand__ stands for reverse bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. This is invoked when the first value does not have __and__ implemented. In this case, the Mojo compiler checks if the second value has __rand__ implemented, and calls that one. ##### __iand__ The __iand__ stands for in-place bitwise AND operator represented by the symbol "&=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __and__, the __iand__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __and__(self, other: Self) -> Self: print("and invoked") return Self(self.val & other.val) fn __rand__(self, other: MyFloat) -> Self: print("rand invoked") return Self(int(other.val) & self.val) fn __iand__(inout self, other: Self): print("iand invoked") self.val &= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var and_res = MyInt(23) & MyInt(6) print(and_res.val) var rand_res = MyFloat(20) & MyInt(4) print(rand_res.val) var iand_res = MyInt(10) iand_res &= MyInt(2) print(iand_res.val) ``` ##### __or__ The __or__ stands for bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. ##### __ror__ The __ror__ stands for reverse bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. This is invoked when the first value does not have __or__ implemented. In this case, the Mojo compiler checks if the second value has __ror__ implemented, and calls that one. ##### __ior__ The __ior__ stands for in-place bitwise OR operator represented by the symbol "|=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __or__, the __ior__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __or__(self, other: Self) -> Self: print("or invoked") return Self(self.val | other.val) fn __ror__(self, other: MyFloat) -> Self: print("ror invoked") return Self(int(other.val) | self.val) fn __ior__(inout self, other: Self): print("ior invoked") self.val |= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var or_res = MyInt(5) | MyInt(3) print(or_res.val) var ror_res = MyFloat(15) | MyInt(17) print(ror_res.val) var ior_res = MyInt(5) ior_res |= MyInt(1) print(ior_res.val) ``` ##### __xor__ The __xor__ stands for bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. ##### __rxor__ The __rxor__ stands for reverse bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. This is invoked when the first value does not have __xor__ implemented. In this case, the Mojo compiler checks if the second value has __rxor__ implemented, and calls that one. ##### __ixor__ The __ixor__ stands for in-place bitwise OR operator represented by the symbol "^=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __xor__, the __ixor__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __xor__(self, other: Self) -> Self: print("xor invoked") return Self(self.val ^ other.val) fn __rxor__(self, other: MyFloat) -> Self: print("rxor invoked") return Self(int(other.val) ^ self.val) fn __ixor__(inout self, other: Self): print("ixor invoked") self.val ^= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var xor_res = MyInt(5) ^ MyInt(3) print(xor_res.val) var rxor_res = MyFloat(15) ^ MyInt(17) print(rxor_res.val) var ixor_res = MyInt(5) ixor_res ^= MyInt(3) print(ixor_res.val) ``` ### 11.3. Relational operators #### 11.3.1. Operators ##### __eq__ The __eq__ stands for equality operator represented by the symbol "==" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __eq__(self, other: Self) -> Bool: print("eq invoked") return self.val == other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) == MyInt(5)) print(MyInt(5) == MyInt(3)) ``` ##### __ne__ The __ne__ stands for inequality operator represented by the symbol "!=" between the struct defining the method and self type or another type. The operation returns a Bool value. Note that __ne__ is not invoked when you call not x==y though. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ne__(self, other: Self) -> Bool: print("ne invoked") return self.val != other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) != MyInt(5)) print(MyInt(5) != MyInt(3)) print(not MyInt(5) == MyInt(3)) ``` ##### __lt__ The __lt__ stands for less-than operator represented by the symbol "<" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lt__(self, other: Self) -> Bool: print("lt invoked") return self.val < other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) < MyInt(5)) print(MyInt(3) < MyInt(5)) ``` ##### __gt__ The __gt__ stands for greater-than operator represented by the symbol ">" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __gt__(self, other: Self) -> Bool: print("gt invoked") return self.val > other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) > MyInt(5)) print(MyInt(5) > MyInt(3)) ``` ##### __le__ The __le__ stands for less-than-or-equal-to operator represented by the symbol "⇐" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __le__(self, other: Self) -> Bool: print("le invoked") return self.val <= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) <= MyInt(5)) print(MyInt(5) <= MyInt(3)) ``` ##### __ge__ The __ge__ stands for greater-than-or-equal-to operator represented by the symbol ">=" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ge__(self, other: Self) -> Bool: print("ge invoked") return self.val >= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) >= MyInt(5)) print(MyInt(3) >= MyInt(5)) ``` ### 11.4. Index operators Any large scale program would use collection data types such as lists, arrays, dictionaries extensively. Some programming languages have built-in syntax to make usage of such types convenient. Mojo has built-in syntactical support for collection types. Mojo allows accessing collection like data types using the syntax []. For example, list[2]. It also allows setting of values at a given index (e.g. list[2]=5). In line with Mojo’s philosophy of moving as much functionality as possible to libraries, instead of having specially treated data types that have exclusive privilege of syntax, Mojo opened up the index operator capability to any type that defines __getitem__ and __setitem__ methods. This means that your custom List struct will have the same syntactical support like the List bundled with Mojo. #### 11.4.1. Operators ##### __getitem__ The __getitem__ is the method invoked when you try to access values stored within the collection using the my_list[index] syntax (where my_list is the collection and index is the position of the element desired from the list). ##### __setitem__ The __setitem__ is the method invoked when you try to assign values to a collection using the my_list[index]=value syntax (where my_list is the collection and index is the position at which the value will be assigned). ```mojo struct MyCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, x: Int) -> String: return self.list[x] fn __setitem__(inout self, x: Int, val: String): self.list[x] = val ``` Usage: ```mojo var x = MyCollection(List(String("A"), String("B"))) print("Before:", x[1]) # Gets x[1] = String("C") # Sets print("After:", x[1]) ``` It is also possible to get and set using multiple indices, especially useful for Matrix like data structures. This means that we can use in our code my_list[row, col, and so on…​]. The following code listing shows such an example for a matrix. Note that this example is not a production quality implementation. ```mojo struct MyMatrix: var val: List[List[String]] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.rows = rows self.cols = cols self.val = List[List[String]](capacity=rows) for row in range(rows): self.val.append(List[String](capacity=cols)) for col in range(cols): self.val[row].append(String("None")) fn __getitem__(self, row: Int, col: Int) -> String: return self.val[row][col] fn __setitem__(inout self, row: Int, col: Int, s: String): self.val[row][col] = s ``` Usage: ```mojo var y = MyMatrix(5, 3) print("Before:", y[1, 2]) # Gets y[1, 2] = String("D") # Sets print("After:", y[1, 2]) ``` ##### __getitem__ with Slice Mojo supports getting a slice of a collection or a container using the slicing operator. The following diagram shows the structure of the slicing operator. In order to be able to get a slice from a collection or a container, the collection or the container must implement method __getitem__ that takes a Slice object. This Slice object is instantiated by the Mojo compiler when you use the slice operator. In a way you can think of the [start:stop:step] as a literal form instantiating a Slice. The start argument of Slice is the start index of the collection from where the slice will be taken. The end argument is the last index until which the slice will be taken (the element referred by this index will be excluded, only its previous element will be taken as last for the slice). The step gives the number of increments to be taken to get the next element. Any of the arguments of the Slice can be negative. A negative value means reversal of the indexing or stepping. Care must be taken to provide valid combinations though, otherwise it results in error. ```mojo struct MySliceableCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, slc: Slice) -> List[String]: return self.list[slc.start:slc.end:slc.step] ``` Usage: ```mojo var z = MySliceableCollection( List(String("H"), String("E"), String("L"), String("L"), String("O"), String("W"), String("O"), )) for i in z[0:3:1]: print(i[], end=" ") print() for i in z[1:6:2]: print(i[], end=" ") print() for i in z[1:]: print(i[], end=" ") print() for i in z[:1]: print(i[], end=" ") print() for i in z[-3:]: print(i[], end=" ") print() for i in z[:-3]: print(i[], end=" ") print() for i in z[::-1]: print(i[], end=" ") print() ``` ### 11.5. Context management methods In large programs, we often need to resources like files and database connections. When we open access to those resources, we typically have a handle, which we use to perform actions. However, once we have done with our actions, we must remember to cleanup or close the resources, otherwise we end up with dangling resources, memory leaks, locked files, etc. Mojo provides with keyword for managing such context or resources. The following diagram illustrates the syntax of the with statement. #### 11.5.1. Methods ##### __enter__ The method that handles the allocation of the resource and returns a resource. The resource has scope only within the body of the with. It is not mandatory to assign the return value to a variable, especially if it is not being used. ##### __exit__ The method that handles the cleanup of the resource. There are two implementations of the __exit__ method, one without any arguments __exit__(self, Error) and one with Error as an argument __exit__(self, Error). The __exit__(self, Error) is invoked when the with body has an exception and exits the with block abnormally. The method __exit__(self, Error) returns a Bool to indicate whether or not to propagate the error further. Any resources allocated in the __enter__ must be cleaned up at both the __exit__ methods, otherwise we would end up with dangling resources. For example, if __exit__(self, Error) is not properly implemented, resource leaks will occur only when there are exceptions raised within the with body. This will lead to rare but difficult to find defects. The following code listing shows an example for the context manager. ```mojo struct Resource: var name: String fn __init__(inout self, name: String): self.name = name fn open(self): print("Opened") fn close(self): print("Close") fn __copyinit__(inout self, other:Resource): self.name = other.name struct MyResourceManager: var resource: Resource fn __init__(inout self): self.resource = Resource("a_resource") fn __enter__(self) -> Resource: print("Entered context") self.resource.open() return self.resource fn __exit__(self): self.resource.close() print("Exited context") fn __exit__(self, err: Error) -> Bool: self.resource.close() print("Exited context") return False ``` Usage: ```mojo with MyResourceManager() as res: print("Inside context, resource is:", res.name) raise Error("An error while processing") ``` ### 11.6. Other special methods #### 11.6.1. Methods ##### __len__ The __len__ is defined within Sized trait and is used by the built-in len function. The __len__ method returns the length or size of the struct implementing it. ##### __int__ The __int__ is defined within Intable trait and is used by the built-in int function. The __int__ method returns an integer representation of the struct implementing it. ##### __bool__ The __bool__ is defined within Boolable trait and is used by conditional statements such as if to convert the given value to a boolean value for evaluation. The __bool__ method returns a boolean representation of the struct implementing it. ##### __str__ The __str__ is defined within Stringable trait and is used by the built-in str function. The __str__ method returns an string representation of the struct implementing it. The built-in function print uses __str__ before it prints the given value. The following code listing provides examples of special methods. ```mojo struct MyStruct(Sized, Intable, Boolable, Stringable): var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __len__(self) -> Int: print("len called") return len(self.ints) fn __int__(self) -> Int: print("int called") var sum: Int = 0 for i in range(len(self.ints)): sum += self.ints[i] return sum fn __bool__(self) -> Bool: print("bool called") return len(self.ints)>0 fn __str__(self) -> String: print("str called") return "MyStruct" ``` Usage: ```mojo var st = MyStruct(List(1, 2, 3)) print(len(st)) print(int(st)) if st: # Uses __bool__ print("MyStruct is true") print(str(st)) print(st) # Can directly print st because the __str__ method is implemented ``` ##### __is__ The __is__ method is used by the is clause to compare the identity between two values, and returns True if the identities are the same. Note that it is different from the eq method. The eq compares if two values are the same content-wise, while is checks if the two values are having the same identities. This means that two objects may have exactly same content, but different identities. Typical implementations check if the memory location of the two values are the same, in which case it would be considered as being identical. ##### __isnot__ The __isnot__ method is used by the is not clause to compare the identity between two values, and returns True if the identities are not the same. It is the opposite of the is clause, and in most cases it is sufficient for the implementation to return a negation of the is method. The following code listing provides examples of is and isnot methods. ```mojo struct MyStruct: var ptr: UnsafePointer[Int] fn __init__(inout self, ptr: UnsafePointer[Int]): self.ptr = ptr fn __is__(self, other: MyStruct) -> Bool: print("__is__ called") return self.ptr == other.ptr fn __isnot__(self, other: MyStruct) -> Bool: print("__isnot__ called") return not(self is other) ``` Usage: ```mojo var x: Int = 10 var y: Int = 10 print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(y))) # Results in False print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(x))) # Results in True print(MyStruct(UnsafePointer.address_of(x)) is not MyStruct(UnsafePointer.address_of(y))) # Results in True ``` ##### __getattr__ Many dynamic languages allow us to dynamically define attributes that do not exist in the original struct definition (or class definition in most languages). This ability allows programmers to define an ergonomic API, especially for object relational mapping. Even though Mojo is a statically compiled language, it allows for such a dynamic definition of attributes through a combination of methods, __getattr__ and __setattr__. The __getattr__ method takes in the attribute name as an argument. When you call an attribute my_attr within a struct (my_struct.my_attr), it is this attribute name my_attr that gets passed as the argument to the method __getattr__. Within the __getattr__, you can as an example return a result based on a database query involving the attribute name. Mojo does not restrict what you do with the attribute name, as long as you return a value conforming to the return type of the function. ##### __setattr__ The __setattr__ method takes in the attribute name and its value as arguments. When you set an attribute my_attr within a struct with a value (my_struct.my_attr = 'a value'), the __setattr__ is called with the given attribute name my_attr and the value 'a value' passed as arguments. The following code listing provides examples of getattr and setattr methods. ```mojo struct MyStruct: var fields: Dict[String, String] fn __init__(inout self, fields: Dict[String, String]): self.fields = fields fn __getattr__(self, attr: String) raises -> String: return self.fields[attr] fn __setattr__(inout self, attr: String, value: String) raises: self.fields[attr] = value ``` Usage: ```mojo var d: Dict[String, String] = Dict[String, String]() d["name"] = "IK" var st = MyStruct(d) print(st.name) # __getattr__ is called here st.name = "PK" # __setattr__ is called here print(st.name) ``` ##### __contains__ In Mojo you can check if a value is contained within a struct using the in operator. For example, "IK" in my_string, where my_string is a string and the expression results in value True if the literal IK is found within my_string. The __contains__ method is used by the in operator to check if a given value is within the struct defining that method. The following code listing provides an example of contains method. ```mojo struct MyStruct: var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __contains__(self, value: Int) -> Bool: for i in self.ints: if i[] == value: return True return False ``` Usage: ```mojo var my_struct = MyStruct(List(1, 2, 3)) print(1 in my_struct) # Returns True print(5 in my_struct) # Returns False ``` The __contains__ method also works with custom types as shown in the example below. ```mojo struct MyStruct2: var first_name: String var last_name: String fn __init__(inout self, first_name: String, last_name: String): self.first_name = first_name self.last_name = last_name fn __contains__(self, other: MyStruct2) -> Bool: return (self.first_name == other.first_name) or self.last_name == other.last_name ``` Usage: ```mojo var my_struct2 = MyStruct2("Ram", "C") print(MyStruct2("Ram", "T") in my_struct2) # Returns True print(MyStruct2("Kri", "C") in my_struct2) # Returns True print(MyStruct2("C", "Ram") in my_struct2) # Returns False ``` ← Previous: Error handling | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Lifecycle and ownership → ================================================================================ URL: https://ruhati.net/mojo/_operators_and_special_methods.html#_index_operators # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods 11.1. Arithmetic operators 11.2. Bitwise operators 11.3. Relational operators 11.4. Index operators 11.5. Context management methods 11.6. Other special methods - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods ## 11. Operators and special methods In Mojo some functions have special naming convention, starting and ending with double underscores: "_". Since they start and end with __double underscores_, they are called dunder methods. These methods are treated specially by Mojo compiler. Mojo supports implementation of arithmetic and relational operators, along with special methods that support lifecycle of values. In previous chapters, we saw many times the arithmetic and relational operators. Most of these operators can be implemented by user defined structs. Mojo provides quite a bit of flexibility in defining your own low level structs and the ability to implement these operators is part of that flexibility. Implementing an operator is as simple as implementing a function. Many of Mojo’s built in functionality is implemented as libraries. This means that we are able to implement powerful constructs just using basic language features offered by Mojo. ### 11.1. Arithmetic operators The following sections describe the various arithmetic operators in Mojo. #### 11.1.1. Addition The following are the addition operators. ##### __add__ The __add__ stands for arithmetic addition "+" between the struct defining the method and self type or another type. ##### __radd__ The __radd__ method is known as reverse addition, and is used when we try to add two values, where the first value does not have __add__ implemented. In this case, the Mojo compiler checks if the second value has __radd__ implemented, and it calls that one. ##### __iadd__ The __iadd__ method is called in-place addition and represents arithmetic addition "=". Even if you implement just `\\__add__` and do not implement `\\__iadd__`, the "=" operation would still work as Mojo will just use __add__ as the fallback. However, typically __add__ returns a new instance of the result. In case of large structs (structs with many fields), it could entail a lot of copy operations. The in-place addition can directly change the struct’s internal data, resulting in an efficient execution of the addition method. The __iadd__ therefore does not have a return value as it updates the struct itself. Since the struct' internal value is mutated, we need to use one of the inout or owned references of self in the method. The following code listing shows the different operations. Please note that these examples are not meant for production use, as it is intentionally kept incomplete for simplicity’s sake. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __add__(self, other: Self) -> Self: print("add invoked") return Self(self.val + other.val) fn __radd__(self, other: MyFloat) -> Self: print("radd invoked") return Self(self.val + int(other.val)) fn __iadd__(inout self, other: Self): print("iadd invoked") self.val = self.val + other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var add_res = MyInt(1) + MyInt(2) print(add_res.val) var radd_res = MyFloat(3.5) + MyInt(2) # Even though MyFloat does not implement __add__ method, we are able to do addition through MyInt's __radd__ print(radd_res.val) var iadd_res = MyInt(10) iadd_res += MyInt(20) print(iadd_res.val) ``` #### 11.1.2. Subtraction The following are the subtraction operators. ##### __sub__ The __sub__ stands for arithmetic subtraction "-" between the struct defining the method and self type or another type. ##### __rsub__ The __rsub__ method is known as reverse subtraction, and is used when we try to subtract two values, where the first value does not have __sub__ implemented. In this case, the Mojo compiler checks if the second value has __rsub__ implemented, and it calls that one. As the name implies, the reverse subtraction swaps the operands. Since subtraction is non-commutative, care must be taken to have correct values as the first operand and second operands. For example, x - y in normal subtraction would be y - x in reverse subtraction. ##### __isub__ The __isub__ method is called in-place subtraction and represents arithmetic subtraction "-=". The concept of __isub__ is the same as what we saw in __iadd__. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __sub__(self, other: Self) -> Self: print("sub invoked") return Self(self.val - other.val) fn __rsub__(self, other: MyFloat) -> Self: print("rsub invoked") return Self(int(other.val) - self.val) # Order matters for subtraction; it is not commutative. fn __isub__(inout self, other: Self): print("isub invoked") self.val = self.val - other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var sub_res = MyInt(1) - MyInt(2) print(sub_res.val) var rsub_res = MyFloat(3.5) - MyInt(2) # Even though MyFloat does not implement __sub__ method, we are able to do addition through MyInt's __rsub__ print(rsub_res.val) var isub_res = MyInt(10) isub_res -= MyInt(20) print(isub_res.val) ``` #### 11.1.3. Multiplication The following are multiplication operators. ##### __mul__ The __mul__ stands for multiplication "*" between the struct defining the method and self type or another type. ##### __rmul__ The __rmul__ method is known as reverse multiplication, and is used when we try to multiply two values, where the first value does not have __mul__ implemented. In this case, the Mojo compiler checks if the second value has __rmul__ implemented, and it calls that one. ##### __imul__ The __imul__ method is called in-place multiplication and represents multiplication "*=". The concept of __imul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is multiplication. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mul__(self, other: Self) -> Self: print("mul invoked") return Self(self.val * other.val) fn __rmul__(self, other: MyFloat) -> Self: print("rmul invoked") return Self(int(other.val) * self.val) # Will truncate fn __imul__(inout self, other: Self): print("imul invoked") self.val = self.val * other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mul_res = MyInt(3) * MyInt(2) print(mul_res.val) var rmul_res = MyFloat(3.5) * MyInt(2) print(rmul_res.val) var imul_res = MyInt(10) imul_res *= MyInt(20) print(imul_res.val) ``` #### 11.1.4. Matrix multiplication The following are operators for matrix multiplication. ##### __matmul__ The __matmul__ stands for matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. ##### __rmatmul__ The __rmatmul__ stands for the reverse matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imatmul__ The __imatmul__ stands for in-place matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. The concept of __imatmul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is matrix multiplication. ```mojo struct MyFloatMatrix: var val: List[List[Float16]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Float16]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyFloatMatrix(List[List[Float16]](), 0, 0) struct MyIntMatrix: var val: List[List[Int]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Int]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyIntMatrix(List[List[Int]](), 0, 0) fn print(self): print("....") print("Rows:", self.rows, "Cols:", self.cols) for row in self.val: print() for col in row[]: print(col[], end=" ") print() print("----") @staticmethod fn _matmul_internal(first: Self, second: Self) -> Self: if first.cols != first.rows: print("Rows and columns do not match. ") return MyIntMatrix.empty() var res: List[List[Int]] = List[List[Int]](capacity=first.rows) for i in range(first.rows): res.append(List[Int](capacity=second.cols)) for j in range(second.cols): var s = 0 for k in range(first.cols): s += first.val[i][k] * second.val[k][j] res[i].append(s) return Self(res, first.rows, second.cols) fn __matmul__(self, other: Self) -> Self: # Naive implementation - not for production use print("matmul invoked") return Self._matmul_internal(self, other) fn __rmatmul__(self, other: MyFloatMatrix) -> Self: # Naive implementation - not for production use print("rmatmul invoked") var res: List[List[Int]] = List[List[Int]](capacity=self.rows) for i in range(other.rows): res.append(List[Int](capacity=self.cols)) for j in range(self.cols): var s = 0 for k in range(other.cols): s += int(other.val[i][k]) * self.val[k][j] # Will truncate res[i].append(s) return Self(res, other.rows, self.cols) fn __imatmul__(inout self, other: Self): # Naive implementation - not for production use print("imatmul invoked") var res = Self._matmul_internal(self, other) self.val = res.val self.rows = res.rows self.cols = res.cols ``` Usage: ```mojo var m : List[List[Int]] = List( List(1, 2, 1), List(5, 1, 1), List(2, 3, 1)) var n: List[List[Int]] = List( List(2, 5), List(6, 7), List(1, 1)) var flm : List[List[Float16]] = List( List[Float16](1.2, 2.3, 1.4), List[Float16](5.2, 1.2, 1.3), List[Float16](2.3, 3.4, 1.4)) var matmul_res = MyIntMatrix(m, 3, 3) @ MyIntMatrix(n, 3, 2) matmul_res.print() var rmatmul_res = MyFloatMatrix(flm, 3, 3) @ MyIntMatrix(n, 3, 2) rmatmul_res.print() var imatmul_res = MyIntMatrix(m, 3, 3) imatmul_res @= MyIntMatrix(n, 3, 2) imatmul_res.print() ``` #### 11.1.5. Division The division operators. ##### __truediv__ The __truediv__ stands for division represented by the symbol "/" between the struct defining the method and self type or another type. The result of \\__truediv is a floating point type with 64 bits. ##### __rtruediv__ The __rtruediv__ stands for the reverse division represented by the symbol "/" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __itruediv__ The __itruediv__ stands for in-place division represented by the symbol "/" between the struct defining the method and self type or another type. The concept of __itruediv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __truediv__(self, other: Self) -> MyFloat: print("truediv invoked") return MyFloat(self.val / other.val) fn __rtruediv__(self, other: MyFloat) -> MyFloat: print("rtruediv invoked") return MyFloat(int(other.val) / self.val) fn __itruediv__(inout self, other: Self): print("itruediv invoked") self.val = int(self.val / other.val) # Will truncate ``` Usage: ```mojo var num: MyInt = MyInt(42) var div_res = MyInt(3) / MyInt(2) print(div_res.val) var rdiv_res = MyFloat(3.5) / MyInt(2) print(rdiv_res.val) var idiv_res = MyInt(10) idiv_res /= MyInt(20) print(idiv_res.val) ``` Note that __itruediv__ implementation had to convert the result from a Float to Int because MyInt can only store Int as value within it. Mojo has the ability to have a variable with multiple possible types through Variant struct. We will cover that in a later chapter. ##### __floordiv__ The __floordiv__ stands for floor division (also known as integer division) represented by the symbol "//" between the struct defining the method and self type or another type. As the name suggest, the result of the __floordiv__ is an integer instead of float. Typically implementations truncate towards zero in case of positive values and away from zero for negative values. For example, 7//3 results in 2, while -7//3 results in -3 and not -2. ##### __rfloordiv__ The __rfloordiv__ stands for the reverse division represented by the symbol "//" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ifloordiv__ The __ifloordiv__ stands for in-place division represented by the symbol "//" between the struct defining the method and self type or another type. The concept of __ifloordiv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is floor division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __floordiv__(self, other: Self) -> Self: print("floordiv invoked") return Self(self.val // other.val) fn __rfloordiv__(self, other: MyFloat) -> Self: print("rfloordiv invoked") return Self(int(other.val) // self.val) fn __ifloordiv__(inout self, other: Self): print("ifloordiv invoked") self.val = self.val // other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var floordiv_res = MyInt(3) // MyInt(2) print(floordiv_res.val) var rfloordiv_res = MyFloat(3.5) // MyInt(2) print(rfloordiv_res.val) var ifloordiv_res = MyInt(10) ifloordiv_res //= MyInt(20) print(ifloordiv_res.val) ``` #### 11.1.6. Modulo The following are the modulo operators. ##### __mod__ The __mod__ stands for modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The approach to implement __mod__ is the same as what we saw in __truediv__, except instead of division, the applied operation is modulo operation. The __mod__ derives its name from the mathematical modulo operation. Modulo operation divides two numbers and returns the remainder of the division. ##### __rmod__ The __rmod__ stands for the reverse modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imod__ The __imod__ stands for in-place modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The concept of __imod__ is the same as what we saw in __itruediv__, except instead of division, the applied operation is modulo. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mod__(self, other: Self) -> Self: print("mod invoked") return Self(self.val % other.val) fn __rmod__(self, other: MyFloat) -> Self: print("rmod invoked") return Self(int(other.val) % self.val) fn __imod__(inout self, other: Self): print("imod invoked") self.val = self.val % other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mod_res = MyInt(7) % MyInt(2) print(mod_res.val) var rmod_res = MyFloat(8) % MyInt(2) print(rmod_res.val) var imod_res = MyInt(37) imod_res %= MyInt(20) print(imod_res.val) ``` #### 11.1.7. Exponentiation The following lists the exponentiation operators. ##### __pow__ The __pow__ stands for exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The approach to implement __pow__ is the same as what we saw in __mul__, except instead of multiplication, we apply exponential operation. ##### __ipow__ The __ipow__ stands for in-place exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The concept of __ipow__ is the same as what we saw in __imul__, except instead of multiplication, we apply exponential operation. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pow__(self, other: Self) -> Self: print("pow invoked") return Self(self.val ** other.val) fn __ipow__(inout self, other: Self): print("ipow invoked") self.val **= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var pow_res = MyInt(7) ** MyInt(2) print(pow_res.val) var ipow_res = MyInt(7) ipow_res **= MyInt(2) print(ipow_res.val) ``` #### 11.1.8. Unary operators The following are the unary operators. ##### __neg__ The __neg__ stands for the unary operation represented by the symbol "-" for the struct defining the method. The negative sign appears as prefix to the value and typically results in negation of the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __neg__(self) -> Self: print("neg invoked") return Self(-self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var neg_res = -MyInt(7) print(neg_res.val) ``` ##### __pos__ The __pos__ stands for the unary operation represented by the symbol "+" for the struct defining the method. The positive sign appears as prefix to the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pos__(self) -> Self: print("pos invoked") return Self(+self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var pos_res = +MyInt(7) print(pos_res.val) ``` ##### __invert__ The __invert__ stands for the unary operation represented by the symbol "~" for the struct defining the method. The invert sign appears as prefix to the value. Typical implementations return bitwise compliment of the value, switching 1 for 0 and vice versa. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __invert__(self) -> Self: print("invert invoked") return Self(~self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var invert_res = ~MyInt(2) print(invert_res.val) ``` ### 11.2. Bitwise operators The following are the bitwise operators. #### 11.2.1. Operators ##### __lshift__ The __lshift__ stands for left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. ##### __rlshift__ The __rlshift__ stands for the reverse left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ilshift__ The __ilshift__ stands for in-place left shift operation represented by the symbol "<⇐" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __lshift__, the __ilshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lshift__(self, other: Self) -> Self: print("lshift invoked") return Self(self.val << other.val) fn __rlshift__(self, other: MyFloat) -> Self: print("rlshift invoked") return Self(int(other.val) << self.val) fn __ilshift__(inout self, other: Self): print("ilshift invoked") self.val <<= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var lshift_res = MyInt(2) << MyInt(3) print(lshift_res.val) var rlshift_res = MyFloat(2) << MyInt(3) print(rlshift_res.val) var ilshift_res = MyInt(3) ilshift_res <<= MyInt(2) print(ilshift_res.val) ``` ##### __rshift__ The __rshift__ stands for right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the right. The second operand indicates how many bits are to be shifted to the right. ##### __rrshift__ The __rrshift__ stands for the reverse right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Similar to __rlshift__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __irshift__ The __irshift__ stands for in-place right shift operation represented by the symbol ">>=" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __rshift__, the __irshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __rshift__(self, other: Self) -> Self: print("rshift invoked") return Self(self.val >> other.val) fn __rrshift__(self, other: MyFloat) -> Self: print("rrshift invoked") return Self(int(other.val) >> self.val) fn __irshift__(inout self, other: Self): print("irshift invoked") self.val >>= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var rshift_res = MyInt(20) >> MyInt(3) print(rshift_res.val) var rrshift_res = MyFloat(24) >> MyInt(3) print(rrshift_res.val) var irshift_res = MyInt(30) irshift_res >>= MyInt(2) print(irshift_res.val) ``` ##### __and__ The __and__ stands for bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. ##### __rand__ The __rand__ stands for reverse bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. This is invoked when the first value does not have __and__ implemented. In this case, the Mojo compiler checks if the second value has __rand__ implemented, and calls that one. ##### __iand__ The __iand__ stands for in-place bitwise AND operator represented by the symbol "&=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __and__, the __iand__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __and__(self, other: Self) -> Self: print("and invoked") return Self(self.val & other.val) fn __rand__(self, other: MyFloat) -> Self: print("rand invoked") return Self(int(other.val) & self.val) fn __iand__(inout self, other: Self): print("iand invoked") self.val &= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var and_res = MyInt(23) & MyInt(6) print(and_res.val) var rand_res = MyFloat(20) & MyInt(4) print(rand_res.val) var iand_res = MyInt(10) iand_res &= MyInt(2) print(iand_res.val) ``` ##### __or__ The __or__ stands for bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. ##### __ror__ The __ror__ stands for reverse bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. This is invoked when the first value does not have __or__ implemented. In this case, the Mojo compiler checks if the second value has __ror__ implemented, and calls that one. ##### __ior__ The __ior__ stands for in-place bitwise OR operator represented by the symbol "|=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __or__, the __ior__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __or__(self, other: Self) -> Self: print("or invoked") return Self(self.val | other.val) fn __ror__(self, other: MyFloat) -> Self: print("ror invoked") return Self(int(other.val) | self.val) fn __ior__(inout self, other: Self): print("ior invoked") self.val |= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var or_res = MyInt(5) | MyInt(3) print(or_res.val) var ror_res = MyFloat(15) | MyInt(17) print(ror_res.val) var ior_res = MyInt(5) ior_res |= MyInt(1) print(ior_res.val) ``` ##### __xor__ The __xor__ stands for bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. ##### __rxor__ The __rxor__ stands for reverse bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. This is invoked when the first value does not have __xor__ implemented. In this case, the Mojo compiler checks if the second value has __rxor__ implemented, and calls that one. ##### __ixor__ The __ixor__ stands for in-place bitwise OR operator represented by the symbol "^=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __xor__, the __ixor__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __xor__(self, other: Self) -> Self: print("xor invoked") return Self(self.val ^ other.val) fn __rxor__(self, other: MyFloat) -> Self: print("rxor invoked") return Self(int(other.val) ^ self.val) fn __ixor__(inout self, other: Self): print("ixor invoked") self.val ^= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var xor_res = MyInt(5) ^ MyInt(3) print(xor_res.val) var rxor_res = MyFloat(15) ^ MyInt(17) print(rxor_res.val) var ixor_res = MyInt(5) ixor_res ^= MyInt(3) print(ixor_res.val) ``` ### 11.3. Relational operators #### 11.3.1. Operators ##### __eq__ The __eq__ stands for equality operator represented by the symbol "==" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __eq__(self, other: Self) -> Bool: print("eq invoked") return self.val == other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) == MyInt(5)) print(MyInt(5) == MyInt(3)) ``` ##### __ne__ The __ne__ stands for inequality operator represented by the symbol "!=" between the struct defining the method and self type or another type. The operation returns a Bool value. Note that __ne__ is not invoked when you call not x==y though. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ne__(self, other: Self) -> Bool: print("ne invoked") return self.val != other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) != MyInt(5)) print(MyInt(5) != MyInt(3)) print(not MyInt(5) == MyInt(3)) ``` ##### __lt__ The __lt__ stands for less-than operator represented by the symbol "<" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lt__(self, other: Self) -> Bool: print("lt invoked") return self.val < other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) < MyInt(5)) print(MyInt(3) < MyInt(5)) ``` ##### __gt__ The __gt__ stands for greater-than operator represented by the symbol ">" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __gt__(self, other: Self) -> Bool: print("gt invoked") return self.val > other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) > MyInt(5)) print(MyInt(5) > MyInt(3)) ``` ##### __le__ The __le__ stands for less-than-or-equal-to operator represented by the symbol "⇐" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __le__(self, other: Self) -> Bool: print("le invoked") return self.val <= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) <= MyInt(5)) print(MyInt(5) <= MyInt(3)) ``` ##### __ge__ The __ge__ stands for greater-than-or-equal-to operator represented by the symbol ">=" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ge__(self, other: Self) -> Bool: print("ge invoked") return self.val >= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) >= MyInt(5)) print(MyInt(3) >= MyInt(5)) ``` ### 11.4. Index operators Any large scale program would use collection data types such as lists, arrays, dictionaries extensively. Some programming languages have built-in syntax to make usage of such types convenient. Mojo has built-in syntactical support for collection types. Mojo allows accessing collection like data types using the syntax []. For example, list[2]. It also allows setting of values at a given index (e.g. list[2]=5). In line with Mojo’s philosophy of moving as much functionality as possible to libraries, instead of having specially treated data types that have exclusive privilege of syntax, Mojo opened up the index operator capability to any type that defines __getitem__ and __setitem__ methods. This means that your custom List struct will have the same syntactical support like the List bundled with Mojo. #### 11.4.1. Operators ##### __getitem__ The __getitem__ is the method invoked when you try to access values stored within the collection using the my_list[index] syntax (where my_list is the collection and index is the position of the element desired from the list). ##### __setitem__ The __setitem__ is the method invoked when you try to assign values to a collection using the my_list[index]=value syntax (where my_list is the collection and index is the position at which the value will be assigned). ```mojo struct MyCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, x: Int) -> String: return self.list[x] fn __setitem__(inout self, x: Int, val: String): self.list[x] = val ``` Usage: ```mojo var x = MyCollection(List(String("A"), String("B"))) print("Before:", x[1]) # Gets x[1] = String("C") # Sets print("After:", x[1]) ``` It is also possible to get and set using multiple indices, especially useful for Matrix like data structures. This means that we can use in our code my_list[row, col, and so on…​]. The following code listing shows such an example for a matrix. Note that this example is not a production quality implementation. ```mojo struct MyMatrix: var val: List[List[String]] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.rows = rows self.cols = cols self.val = List[List[String]](capacity=rows) for row in range(rows): self.val.append(List[String](capacity=cols)) for col in range(cols): self.val[row].append(String("None")) fn __getitem__(self, row: Int, col: Int) -> String: return self.val[row][col] fn __setitem__(inout self, row: Int, col: Int, s: String): self.val[row][col] = s ``` Usage: ```mojo var y = MyMatrix(5, 3) print("Before:", y[1, 2]) # Gets y[1, 2] = String("D") # Sets print("After:", y[1, 2]) ``` ##### __getitem__ with Slice Mojo supports getting a slice of a collection or a container using the slicing operator. The following diagram shows the structure of the slicing operator. In order to be able to get a slice from a collection or a container, the collection or the container must implement method __getitem__ that takes a Slice object. This Slice object is instantiated by the Mojo compiler when you use the slice operator. In a way you can think of the [start:stop:step] as a literal form instantiating a Slice. The start argument of Slice is the start index of the collection from where the slice will be taken. The end argument is the last index until which the slice will be taken (the element referred by this index will be excluded, only its previous element will be taken as last for the slice). The step gives the number of increments to be taken to get the next element. Any of the arguments of the Slice can be negative. A negative value means reversal of the indexing or stepping. Care must be taken to provide valid combinations though, otherwise it results in error. ```mojo struct MySliceableCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, slc: Slice) -> List[String]: return self.list[slc.start:slc.end:slc.step] ``` Usage: ```mojo var z = MySliceableCollection( List(String("H"), String("E"), String("L"), String("L"), String("O"), String("W"), String("O"), )) for i in z[0:3:1]: print(i[], end=" ") print() for i in z[1:6:2]: print(i[], end=" ") print() for i in z[1:]: print(i[], end=" ") print() for i in z[:1]: print(i[], end=" ") print() for i in z[-3:]: print(i[], end=" ") print() for i in z[:-3]: print(i[], end=" ") print() for i in z[::-1]: print(i[], end=" ") print() ``` ### 11.5. Context management methods In large programs, we often need to resources like files and database connections. When we open access to those resources, we typically have a handle, which we use to perform actions. However, once we have done with our actions, we must remember to cleanup or close the resources, otherwise we end up with dangling resources, memory leaks, locked files, etc. Mojo provides with keyword for managing such context or resources. The following diagram illustrates the syntax of the with statement. #### 11.5.1. Methods ##### __enter__ The method that handles the allocation of the resource and returns a resource. The resource has scope only within the body of the with. It is not mandatory to assign the return value to a variable, especially if it is not being used. ##### __exit__ The method that handles the cleanup of the resource. There are two implementations of the __exit__ method, one without any arguments __exit__(self, Error) and one with Error as an argument __exit__(self, Error). The __exit__(self, Error) is invoked when the with body has an exception and exits the with block abnormally. The method __exit__(self, Error) returns a Bool to indicate whether or not to propagate the error further. Any resources allocated in the __enter__ must be cleaned up at both the __exit__ methods, otherwise we would end up with dangling resources. For example, if __exit__(self, Error) is not properly implemented, resource leaks will occur only when there are exceptions raised within the with body. This will lead to rare but difficult to find defects. The following code listing shows an example for the context manager. ```mojo struct Resource: var name: String fn __init__(inout self, name: String): self.name = name fn open(self): print("Opened") fn close(self): print("Close") fn __copyinit__(inout self, other:Resource): self.name = other.name struct MyResourceManager: var resource: Resource fn __init__(inout self): self.resource = Resource("a_resource") fn __enter__(self) -> Resource: print("Entered context") self.resource.open() return self.resource fn __exit__(self): self.resource.close() print("Exited context") fn __exit__(self, err: Error) -> Bool: self.resource.close() print("Exited context") return False ``` Usage: ```mojo with MyResourceManager() as res: print("Inside context, resource is:", res.name) raise Error("An error while processing") ``` ### 11.6. Other special methods #### 11.6.1. Methods ##### __len__ The __len__ is defined within Sized trait and is used by the built-in len function. The __len__ method returns the length or size of the struct implementing it. ##### __int__ The __int__ is defined within Intable trait and is used by the built-in int function. The __int__ method returns an integer representation of the struct implementing it. ##### __bool__ The __bool__ is defined within Boolable trait and is used by conditional statements such as if to convert the given value to a boolean value for evaluation. The __bool__ method returns a boolean representation of the struct implementing it. ##### __str__ The __str__ is defined within Stringable trait and is used by the built-in str function. The __str__ method returns an string representation of the struct implementing it. The built-in function print uses __str__ before it prints the given value. The following code listing provides examples of special methods. ```mojo struct MyStruct(Sized, Intable, Boolable, Stringable): var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __len__(self) -> Int: print("len called") return len(self.ints) fn __int__(self) -> Int: print("int called") var sum: Int = 0 for i in range(len(self.ints)): sum += self.ints[i] return sum fn __bool__(self) -> Bool: print("bool called") return len(self.ints)>0 fn __str__(self) -> String: print("str called") return "MyStruct" ``` Usage: ```mojo var st = MyStruct(List(1, 2, 3)) print(len(st)) print(int(st)) if st: # Uses __bool__ print("MyStruct is true") print(str(st)) print(st) # Can directly print st because the __str__ method is implemented ``` ##### __is__ The __is__ method is used by the is clause to compare the identity between two values, and returns True if the identities are the same. Note that it is different from the eq method. The eq compares if two values are the same content-wise, while is checks if the two values are having the same identities. This means that two objects may have exactly same content, but different identities. Typical implementations check if the memory location of the two values are the same, in which case it would be considered as being identical. ##### __isnot__ The __isnot__ method is used by the is not clause to compare the identity between two values, and returns True if the identities are not the same. It is the opposite of the is clause, and in most cases it is sufficient for the implementation to return a negation of the is method. The following code listing provides examples of is and isnot methods. ```mojo struct MyStruct: var ptr: UnsafePointer[Int] fn __init__(inout self, ptr: UnsafePointer[Int]): self.ptr = ptr fn __is__(self, other: MyStruct) -> Bool: print("__is__ called") return self.ptr == other.ptr fn __isnot__(self, other: MyStruct) -> Bool: print("__isnot__ called") return not(self is other) ``` Usage: ```mojo var x: Int = 10 var y: Int = 10 print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(y))) # Results in False print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(x))) # Results in True print(MyStruct(UnsafePointer.address_of(x)) is not MyStruct(UnsafePointer.address_of(y))) # Results in True ``` ##### __getattr__ Many dynamic languages allow us to dynamically define attributes that do not exist in the original struct definition (or class definition in most languages). This ability allows programmers to define an ergonomic API, especially for object relational mapping. Even though Mojo is a statically compiled language, it allows for such a dynamic definition of attributes through a combination of methods, __getattr__ and __setattr__. The __getattr__ method takes in the attribute name as an argument. When you call an attribute my_attr within a struct (my_struct.my_attr), it is this attribute name my_attr that gets passed as the argument to the method __getattr__. Within the __getattr__, you can as an example return a result based on a database query involving the attribute name. Mojo does not restrict what you do with the attribute name, as long as you return a value conforming to the return type of the function. ##### __setattr__ The __setattr__ method takes in the attribute name and its value as arguments. When you set an attribute my_attr within a struct with a value (my_struct.my_attr = 'a value'), the __setattr__ is called with the given attribute name my_attr and the value 'a value' passed as arguments. The following code listing provides examples of getattr and setattr methods. ```mojo struct MyStruct: var fields: Dict[String, String] fn __init__(inout self, fields: Dict[String, String]): self.fields = fields fn __getattr__(self, attr: String) raises -> String: return self.fields[attr] fn __setattr__(inout self, attr: String, value: String) raises: self.fields[attr] = value ``` Usage: ```mojo var d: Dict[String, String] = Dict[String, String]() d["name"] = "IK" var st = MyStruct(d) print(st.name) # __getattr__ is called here st.name = "PK" # __setattr__ is called here print(st.name) ``` ##### __contains__ In Mojo you can check if a value is contained within a struct using the in operator. For example, "IK" in my_string, where my_string is a string and the expression results in value True if the literal IK is found within my_string. The __contains__ method is used by the in operator to check if a given value is within the struct defining that method. The following code listing provides an example of contains method. ```mojo struct MyStruct: var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __contains__(self, value: Int) -> Bool: for i in self.ints: if i[] == value: return True return False ``` Usage: ```mojo var my_struct = MyStruct(List(1, 2, 3)) print(1 in my_struct) # Returns True print(5 in my_struct) # Returns False ``` The __contains__ method also works with custom types as shown in the example below. ```mojo struct MyStruct2: var first_name: String var last_name: String fn __init__(inout self, first_name: String, last_name: String): self.first_name = first_name self.last_name = last_name fn __contains__(self, other: MyStruct2) -> Bool: return (self.first_name == other.first_name) or self.last_name == other.last_name ``` Usage: ```mojo var my_struct2 = MyStruct2("Ram", "C") print(MyStruct2("Ram", "T") in my_struct2) # Returns True print(MyStruct2("Kri", "C") in my_struct2) # Returns True print(MyStruct2("C", "Ram") in my_struct2) # Returns False ``` ← Previous: Error handling | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Lifecycle and ownership → ================================================================================ URL: https://ruhati.net/mojo/_operators_and_special_methods.html#_context_management_methods # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods 11.1. Arithmetic operators 11.2. Bitwise operators 11.3. Relational operators 11.4. Index operators 11.5. Context management methods 11.6. Other special methods - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods ## 11. Operators and special methods In Mojo some functions have special naming convention, starting and ending with double underscores: "_". Since they start and end with __double underscores_, they are called dunder methods. These methods are treated specially by Mojo compiler. Mojo supports implementation of arithmetic and relational operators, along with special methods that support lifecycle of values. In previous chapters, we saw many times the arithmetic and relational operators. Most of these operators can be implemented by user defined structs. Mojo provides quite a bit of flexibility in defining your own low level structs and the ability to implement these operators is part of that flexibility. Implementing an operator is as simple as implementing a function. Many of Mojo’s built in functionality is implemented as libraries. This means that we are able to implement powerful constructs just using basic language features offered by Mojo. ### 11.1. Arithmetic operators The following sections describe the various arithmetic operators in Mojo. #### 11.1.1. Addition The following are the addition operators. ##### __add__ The __add__ stands for arithmetic addition "+" between the struct defining the method and self type or another type. ##### __radd__ The __radd__ method is known as reverse addition, and is used when we try to add two values, where the first value does not have __add__ implemented. In this case, the Mojo compiler checks if the second value has __radd__ implemented, and it calls that one. ##### __iadd__ The __iadd__ method is called in-place addition and represents arithmetic addition "=". Even if you implement just `\\__add__` and do not implement `\\__iadd__`, the "=" operation would still work as Mojo will just use __add__ as the fallback. However, typically __add__ returns a new instance of the result. In case of large structs (structs with many fields), it could entail a lot of copy operations. The in-place addition can directly change the struct’s internal data, resulting in an efficient execution of the addition method. The __iadd__ therefore does not have a return value as it updates the struct itself. Since the struct' internal value is mutated, we need to use one of the inout or owned references of self in the method. The following code listing shows the different operations. Please note that these examples are not meant for production use, as it is intentionally kept incomplete for simplicity’s sake. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __add__(self, other: Self) -> Self: print("add invoked") return Self(self.val + other.val) fn __radd__(self, other: MyFloat) -> Self: print("radd invoked") return Self(self.val + int(other.val)) fn __iadd__(inout self, other: Self): print("iadd invoked") self.val = self.val + other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var add_res = MyInt(1) + MyInt(2) print(add_res.val) var radd_res = MyFloat(3.5) + MyInt(2) # Even though MyFloat does not implement __add__ method, we are able to do addition through MyInt's __radd__ print(radd_res.val) var iadd_res = MyInt(10) iadd_res += MyInt(20) print(iadd_res.val) ``` #### 11.1.2. Subtraction The following are the subtraction operators. ##### __sub__ The __sub__ stands for arithmetic subtraction "-" between the struct defining the method and self type or another type. ##### __rsub__ The __rsub__ method is known as reverse subtraction, and is used when we try to subtract two values, where the first value does not have __sub__ implemented. In this case, the Mojo compiler checks if the second value has __rsub__ implemented, and it calls that one. As the name implies, the reverse subtraction swaps the operands. Since subtraction is non-commutative, care must be taken to have correct values as the first operand and second operands. For example, x - y in normal subtraction would be y - x in reverse subtraction. ##### __isub__ The __isub__ method is called in-place subtraction and represents arithmetic subtraction "-=". The concept of __isub__ is the same as what we saw in __iadd__. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __sub__(self, other: Self) -> Self: print("sub invoked") return Self(self.val - other.val) fn __rsub__(self, other: MyFloat) -> Self: print("rsub invoked") return Self(int(other.val) - self.val) # Order matters for subtraction; it is not commutative. fn __isub__(inout self, other: Self): print("isub invoked") self.val = self.val - other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var sub_res = MyInt(1) - MyInt(2) print(sub_res.val) var rsub_res = MyFloat(3.5) - MyInt(2) # Even though MyFloat does not implement __sub__ method, we are able to do addition through MyInt's __rsub__ print(rsub_res.val) var isub_res = MyInt(10) isub_res -= MyInt(20) print(isub_res.val) ``` #### 11.1.3. Multiplication The following are multiplication operators. ##### __mul__ The __mul__ stands for multiplication "*" between the struct defining the method and self type or another type. ##### __rmul__ The __rmul__ method is known as reverse multiplication, and is used when we try to multiply two values, where the first value does not have __mul__ implemented. In this case, the Mojo compiler checks if the second value has __rmul__ implemented, and it calls that one. ##### __imul__ The __imul__ method is called in-place multiplication and represents multiplication "*=". The concept of __imul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is multiplication. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mul__(self, other: Self) -> Self: print("mul invoked") return Self(self.val * other.val) fn __rmul__(self, other: MyFloat) -> Self: print("rmul invoked") return Self(int(other.val) * self.val) # Will truncate fn __imul__(inout self, other: Self): print("imul invoked") self.val = self.val * other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mul_res = MyInt(3) * MyInt(2) print(mul_res.val) var rmul_res = MyFloat(3.5) * MyInt(2) print(rmul_res.val) var imul_res = MyInt(10) imul_res *= MyInt(20) print(imul_res.val) ``` #### 11.1.4. Matrix multiplication The following are operators for matrix multiplication. ##### __matmul__ The __matmul__ stands for matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. ##### __rmatmul__ The __rmatmul__ stands for the reverse matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imatmul__ The __imatmul__ stands for in-place matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. The concept of __imatmul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is matrix multiplication. ```mojo struct MyFloatMatrix: var val: List[List[Float16]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Float16]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyFloatMatrix(List[List[Float16]](), 0, 0) struct MyIntMatrix: var val: List[List[Int]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Int]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyIntMatrix(List[List[Int]](), 0, 0) fn print(self): print("....") print("Rows:", self.rows, "Cols:", self.cols) for row in self.val: print() for col in row[]: print(col[], end=" ") print() print("----") @staticmethod fn _matmul_internal(first: Self, second: Self) -> Self: if first.cols != first.rows: print("Rows and columns do not match. ") return MyIntMatrix.empty() var res: List[List[Int]] = List[List[Int]](capacity=first.rows) for i in range(first.rows): res.append(List[Int](capacity=second.cols)) for j in range(second.cols): var s = 0 for k in range(first.cols): s += first.val[i][k] * second.val[k][j] res[i].append(s) return Self(res, first.rows, second.cols) fn __matmul__(self, other: Self) -> Self: # Naive implementation - not for production use print("matmul invoked") return Self._matmul_internal(self, other) fn __rmatmul__(self, other: MyFloatMatrix) -> Self: # Naive implementation - not for production use print("rmatmul invoked") var res: List[List[Int]] = List[List[Int]](capacity=self.rows) for i in range(other.rows): res.append(List[Int](capacity=self.cols)) for j in range(self.cols): var s = 0 for k in range(other.cols): s += int(other.val[i][k]) * self.val[k][j] # Will truncate res[i].append(s) return Self(res, other.rows, self.cols) fn __imatmul__(inout self, other: Self): # Naive implementation - not for production use print("imatmul invoked") var res = Self._matmul_internal(self, other) self.val = res.val self.rows = res.rows self.cols = res.cols ``` Usage: ```mojo var m : List[List[Int]] = List( List(1, 2, 1), List(5, 1, 1), List(2, 3, 1)) var n: List[List[Int]] = List( List(2, 5), List(6, 7), List(1, 1)) var flm : List[List[Float16]] = List( List[Float16](1.2, 2.3, 1.4), List[Float16](5.2, 1.2, 1.3), List[Float16](2.3, 3.4, 1.4)) var matmul_res = MyIntMatrix(m, 3, 3) @ MyIntMatrix(n, 3, 2) matmul_res.print() var rmatmul_res = MyFloatMatrix(flm, 3, 3) @ MyIntMatrix(n, 3, 2) rmatmul_res.print() var imatmul_res = MyIntMatrix(m, 3, 3) imatmul_res @= MyIntMatrix(n, 3, 2) imatmul_res.print() ``` #### 11.1.5. Division The division operators. ##### __truediv__ The __truediv__ stands for division represented by the symbol "/" between the struct defining the method and self type or another type. The result of \\__truediv is a floating point type with 64 bits. ##### __rtruediv__ The __rtruediv__ stands for the reverse division represented by the symbol "/" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __itruediv__ The __itruediv__ stands for in-place division represented by the symbol "/" between the struct defining the method and self type or another type. The concept of __itruediv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __truediv__(self, other: Self) -> MyFloat: print("truediv invoked") return MyFloat(self.val / other.val) fn __rtruediv__(self, other: MyFloat) -> MyFloat: print("rtruediv invoked") return MyFloat(int(other.val) / self.val) fn __itruediv__(inout self, other: Self): print("itruediv invoked") self.val = int(self.val / other.val) # Will truncate ``` Usage: ```mojo var num: MyInt = MyInt(42) var div_res = MyInt(3) / MyInt(2) print(div_res.val) var rdiv_res = MyFloat(3.5) / MyInt(2) print(rdiv_res.val) var idiv_res = MyInt(10) idiv_res /= MyInt(20) print(idiv_res.val) ``` Note that __itruediv__ implementation had to convert the result from a Float to Int because MyInt can only store Int as value within it. Mojo has the ability to have a variable with multiple possible types through Variant struct. We will cover that in a later chapter. ##### __floordiv__ The __floordiv__ stands for floor division (also known as integer division) represented by the symbol "//" between the struct defining the method and self type or another type. As the name suggest, the result of the __floordiv__ is an integer instead of float. Typically implementations truncate towards zero in case of positive values and away from zero for negative values. For example, 7//3 results in 2, while -7//3 results in -3 and not -2. ##### __rfloordiv__ The __rfloordiv__ stands for the reverse division represented by the symbol "//" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ifloordiv__ The __ifloordiv__ stands for in-place division represented by the symbol "//" between the struct defining the method and self type or another type. The concept of __ifloordiv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is floor division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __floordiv__(self, other: Self) -> Self: print("floordiv invoked") return Self(self.val // other.val) fn __rfloordiv__(self, other: MyFloat) -> Self: print("rfloordiv invoked") return Self(int(other.val) // self.val) fn __ifloordiv__(inout self, other: Self): print("ifloordiv invoked") self.val = self.val // other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var floordiv_res = MyInt(3) // MyInt(2) print(floordiv_res.val) var rfloordiv_res = MyFloat(3.5) // MyInt(2) print(rfloordiv_res.val) var ifloordiv_res = MyInt(10) ifloordiv_res //= MyInt(20) print(ifloordiv_res.val) ``` #### 11.1.6. Modulo The following are the modulo operators. ##### __mod__ The __mod__ stands for modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The approach to implement __mod__ is the same as what we saw in __truediv__, except instead of division, the applied operation is modulo operation. The __mod__ derives its name from the mathematical modulo operation. Modulo operation divides two numbers and returns the remainder of the division. ##### __rmod__ The __rmod__ stands for the reverse modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imod__ The __imod__ stands for in-place modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The concept of __imod__ is the same as what we saw in __itruediv__, except instead of division, the applied operation is modulo. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mod__(self, other: Self) -> Self: print("mod invoked") return Self(self.val % other.val) fn __rmod__(self, other: MyFloat) -> Self: print("rmod invoked") return Self(int(other.val) % self.val) fn __imod__(inout self, other: Self): print("imod invoked") self.val = self.val % other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mod_res = MyInt(7) % MyInt(2) print(mod_res.val) var rmod_res = MyFloat(8) % MyInt(2) print(rmod_res.val) var imod_res = MyInt(37) imod_res %= MyInt(20) print(imod_res.val) ``` #### 11.1.7. Exponentiation The following lists the exponentiation operators. ##### __pow__ The __pow__ stands for exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The approach to implement __pow__ is the same as what we saw in __mul__, except instead of multiplication, we apply exponential operation. ##### __ipow__ The __ipow__ stands for in-place exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The concept of __ipow__ is the same as what we saw in __imul__, except instead of multiplication, we apply exponential operation. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pow__(self, other: Self) -> Self: print("pow invoked") return Self(self.val ** other.val) fn __ipow__(inout self, other: Self): print("ipow invoked") self.val **= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var pow_res = MyInt(7) ** MyInt(2) print(pow_res.val) var ipow_res = MyInt(7) ipow_res **= MyInt(2) print(ipow_res.val) ``` #### 11.1.8. Unary operators The following are the unary operators. ##### __neg__ The __neg__ stands for the unary operation represented by the symbol "-" for the struct defining the method. The negative sign appears as prefix to the value and typically results in negation of the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __neg__(self) -> Self: print("neg invoked") return Self(-self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var neg_res = -MyInt(7) print(neg_res.val) ``` ##### __pos__ The __pos__ stands for the unary operation represented by the symbol "+" for the struct defining the method. The positive sign appears as prefix to the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pos__(self) -> Self: print("pos invoked") return Self(+self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var pos_res = +MyInt(7) print(pos_res.val) ``` ##### __invert__ The __invert__ stands for the unary operation represented by the symbol "~" for the struct defining the method. The invert sign appears as prefix to the value. Typical implementations return bitwise compliment of the value, switching 1 for 0 and vice versa. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __invert__(self) -> Self: print("invert invoked") return Self(~self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var invert_res = ~MyInt(2) print(invert_res.val) ``` ### 11.2. Bitwise operators The following are the bitwise operators. #### 11.2.1. Operators ##### __lshift__ The __lshift__ stands for left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. ##### __rlshift__ The __rlshift__ stands for the reverse left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ilshift__ The __ilshift__ stands for in-place left shift operation represented by the symbol "<⇐" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __lshift__, the __ilshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lshift__(self, other: Self) -> Self: print("lshift invoked") return Self(self.val << other.val) fn __rlshift__(self, other: MyFloat) -> Self: print("rlshift invoked") return Self(int(other.val) << self.val) fn __ilshift__(inout self, other: Self): print("ilshift invoked") self.val <<= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var lshift_res = MyInt(2) << MyInt(3) print(lshift_res.val) var rlshift_res = MyFloat(2) << MyInt(3) print(rlshift_res.val) var ilshift_res = MyInt(3) ilshift_res <<= MyInt(2) print(ilshift_res.val) ``` ##### __rshift__ The __rshift__ stands for right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the right. The second operand indicates how many bits are to be shifted to the right. ##### __rrshift__ The __rrshift__ stands for the reverse right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Similar to __rlshift__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __irshift__ The __irshift__ stands for in-place right shift operation represented by the symbol ">>=" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __rshift__, the __irshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __rshift__(self, other: Self) -> Self: print("rshift invoked") return Self(self.val >> other.val) fn __rrshift__(self, other: MyFloat) -> Self: print("rrshift invoked") return Self(int(other.val) >> self.val) fn __irshift__(inout self, other: Self): print("irshift invoked") self.val >>= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var rshift_res = MyInt(20) >> MyInt(3) print(rshift_res.val) var rrshift_res = MyFloat(24) >> MyInt(3) print(rrshift_res.val) var irshift_res = MyInt(30) irshift_res >>= MyInt(2) print(irshift_res.val) ``` ##### __and__ The __and__ stands for bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. ##### __rand__ The __rand__ stands for reverse bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. This is invoked when the first value does not have __and__ implemented. In this case, the Mojo compiler checks if the second value has __rand__ implemented, and calls that one. ##### __iand__ The __iand__ stands for in-place bitwise AND operator represented by the symbol "&=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __and__, the __iand__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __and__(self, other: Self) -> Self: print("and invoked") return Self(self.val & other.val) fn __rand__(self, other: MyFloat) -> Self: print("rand invoked") return Self(int(other.val) & self.val) fn __iand__(inout self, other: Self): print("iand invoked") self.val &= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var and_res = MyInt(23) & MyInt(6) print(and_res.val) var rand_res = MyFloat(20) & MyInt(4) print(rand_res.val) var iand_res = MyInt(10) iand_res &= MyInt(2) print(iand_res.val) ``` ##### __or__ The __or__ stands for bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. ##### __ror__ The __ror__ stands for reverse bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. This is invoked when the first value does not have __or__ implemented. In this case, the Mojo compiler checks if the second value has __ror__ implemented, and calls that one. ##### __ior__ The __ior__ stands for in-place bitwise OR operator represented by the symbol "|=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __or__, the __ior__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __or__(self, other: Self) -> Self: print("or invoked") return Self(self.val | other.val) fn __ror__(self, other: MyFloat) -> Self: print("ror invoked") return Self(int(other.val) | self.val) fn __ior__(inout self, other: Self): print("ior invoked") self.val |= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var or_res = MyInt(5) | MyInt(3) print(or_res.val) var ror_res = MyFloat(15) | MyInt(17) print(ror_res.val) var ior_res = MyInt(5) ior_res |= MyInt(1) print(ior_res.val) ``` ##### __xor__ The __xor__ stands for bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. ##### __rxor__ The __rxor__ stands for reverse bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. This is invoked when the first value does not have __xor__ implemented. In this case, the Mojo compiler checks if the second value has __rxor__ implemented, and calls that one. ##### __ixor__ The __ixor__ stands for in-place bitwise OR operator represented by the symbol "^=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __xor__, the __ixor__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __xor__(self, other: Self) -> Self: print("xor invoked") return Self(self.val ^ other.val) fn __rxor__(self, other: MyFloat) -> Self: print("rxor invoked") return Self(int(other.val) ^ self.val) fn __ixor__(inout self, other: Self): print("ixor invoked") self.val ^= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var xor_res = MyInt(5) ^ MyInt(3) print(xor_res.val) var rxor_res = MyFloat(15) ^ MyInt(17) print(rxor_res.val) var ixor_res = MyInt(5) ixor_res ^= MyInt(3) print(ixor_res.val) ``` ### 11.3. Relational operators #### 11.3.1. Operators ##### __eq__ The __eq__ stands for equality operator represented by the symbol "==" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __eq__(self, other: Self) -> Bool: print("eq invoked") return self.val == other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) == MyInt(5)) print(MyInt(5) == MyInt(3)) ``` ##### __ne__ The __ne__ stands for inequality operator represented by the symbol "!=" between the struct defining the method and self type or another type. The operation returns a Bool value. Note that __ne__ is not invoked when you call not x==y though. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ne__(self, other: Self) -> Bool: print("ne invoked") return self.val != other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) != MyInt(5)) print(MyInt(5) != MyInt(3)) print(not MyInt(5) == MyInt(3)) ``` ##### __lt__ The __lt__ stands for less-than operator represented by the symbol "<" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lt__(self, other: Self) -> Bool: print("lt invoked") return self.val < other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) < MyInt(5)) print(MyInt(3) < MyInt(5)) ``` ##### __gt__ The __gt__ stands for greater-than operator represented by the symbol ">" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __gt__(self, other: Self) -> Bool: print("gt invoked") return self.val > other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) > MyInt(5)) print(MyInt(5) > MyInt(3)) ``` ##### __le__ The __le__ stands for less-than-or-equal-to operator represented by the symbol "⇐" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __le__(self, other: Self) -> Bool: print("le invoked") return self.val <= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) <= MyInt(5)) print(MyInt(5) <= MyInt(3)) ``` ##### __ge__ The __ge__ stands for greater-than-or-equal-to operator represented by the symbol ">=" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ge__(self, other: Self) -> Bool: print("ge invoked") return self.val >= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) >= MyInt(5)) print(MyInt(3) >= MyInt(5)) ``` ### 11.4. Index operators Any large scale program would use collection data types such as lists, arrays, dictionaries extensively. Some programming languages have built-in syntax to make usage of such types convenient. Mojo has built-in syntactical support for collection types. Mojo allows accessing collection like data types using the syntax []. For example, list[2]. It also allows setting of values at a given index (e.g. list[2]=5). In line with Mojo’s philosophy of moving as much functionality as possible to libraries, instead of having specially treated data types that have exclusive privilege of syntax, Mojo opened up the index operator capability to any type that defines __getitem__ and __setitem__ methods. This means that your custom List struct will have the same syntactical support like the List bundled with Mojo. #### 11.4.1. Operators ##### __getitem__ The __getitem__ is the method invoked when you try to access values stored within the collection using the my_list[index] syntax (where my_list is the collection and index is the position of the element desired from the list). ##### __setitem__ The __setitem__ is the method invoked when you try to assign values to a collection using the my_list[index]=value syntax (where my_list is the collection and index is the position at which the value will be assigned). ```mojo struct MyCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, x: Int) -> String: return self.list[x] fn __setitem__(inout self, x: Int, val: String): self.list[x] = val ``` Usage: ```mojo var x = MyCollection(List(String("A"), String("B"))) print("Before:", x[1]) # Gets x[1] = String("C") # Sets print("After:", x[1]) ``` It is also possible to get and set using multiple indices, especially useful for Matrix like data structures. This means that we can use in our code my_list[row, col, and so on…​]. The following code listing shows such an example for a matrix. Note that this example is not a production quality implementation. ```mojo struct MyMatrix: var val: List[List[String]] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.rows = rows self.cols = cols self.val = List[List[String]](capacity=rows) for row in range(rows): self.val.append(List[String](capacity=cols)) for col in range(cols): self.val[row].append(String("None")) fn __getitem__(self, row: Int, col: Int) -> String: return self.val[row][col] fn __setitem__(inout self, row: Int, col: Int, s: String): self.val[row][col] = s ``` Usage: ```mojo var y = MyMatrix(5, 3) print("Before:", y[1, 2]) # Gets y[1, 2] = String("D") # Sets print("After:", y[1, 2]) ``` ##### __getitem__ with Slice Mojo supports getting a slice of a collection or a container using the slicing operator. The following diagram shows the structure of the slicing operator. In order to be able to get a slice from a collection or a container, the collection or the container must implement method __getitem__ that takes a Slice object. This Slice object is instantiated by the Mojo compiler when you use the slice operator. In a way you can think of the [start:stop:step] as a literal form instantiating a Slice. The start argument of Slice is the start index of the collection from where the slice will be taken. The end argument is the last index until which the slice will be taken (the element referred by this index will be excluded, only its previous element will be taken as last for the slice). The step gives the number of increments to be taken to get the next element. Any of the arguments of the Slice can be negative. A negative value means reversal of the indexing or stepping. Care must be taken to provide valid combinations though, otherwise it results in error. ```mojo struct MySliceableCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, slc: Slice) -> List[String]: return self.list[slc.start:slc.end:slc.step] ``` Usage: ```mojo var z = MySliceableCollection( List(String("H"), String("E"), String("L"), String("L"), String("O"), String("W"), String("O"), )) for i in z[0:3:1]: print(i[], end=" ") print() for i in z[1:6:2]: print(i[], end=" ") print() for i in z[1:]: print(i[], end=" ") print() for i in z[:1]: print(i[], end=" ") print() for i in z[-3:]: print(i[], end=" ") print() for i in z[:-3]: print(i[], end=" ") print() for i in z[::-1]: print(i[], end=" ") print() ``` ### 11.5. Context management methods In large programs, we often need to resources like files and database connections. When we open access to those resources, we typically have a handle, which we use to perform actions. However, once we have done with our actions, we must remember to cleanup or close the resources, otherwise we end up with dangling resources, memory leaks, locked files, etc. Mojo provides with keyword for managing such context or resources. The following diagram illustrates the syntax of the with statement. #### 11.5.1. Methods ##### __enter__ The method that handles the allocation of the resource and returns a resource. The resource has scope only within the body of the with. It is not mandatory to assign the return value to a variable, especially if it is not being used. ##### __exit__ The method that handles the cleanup of the resource. There are two implementations of the __exit__ method, one without any arguments __exit__(self, Error) and one with Error as an argument __exit__(self, Error). The __exit__(self, Error) is invoked when the with body has an exception and exits the with block abnormally. The method __exit__(self, Error) returns a Bool to indicate whether or not to propagate the error further. Any resources allocated in the __enter__ must be cleaned up at both the __exit__ methods, otherwise we would end up with dangling resources. For example, if __exit__(self, Error) is not properly implemented, resource leaks will occur only when there are exceptions raised within the with body. This will lead to rare but difficult to find defects. The following code listing shows an example for the context manager. ```mojo struct Resource: var name: String fn __init__(inout self, name: String): self.name = name fn open(self): print("Opened") fn close(self): print("Close") fn __copyinit__(inout self, other:Resource): self.name = other.name struct MyResourceManager: var resource: Resource fn __init__(inout self): self.resource = Resource("a_resource") fn __enter__(self) -> Resource: print("Entered context") self.resource.open() return self.resource fn __exit__(self): self.resource.close() print("Exited context") fn __exit__(self, err: Error) -> Bool: self.resource.close() print("Exited context") return False ``` Usage: ```mojo with MyResourceManager() as res: print("Inside context, resource is:", res.name) raise Error("An error while processing") ``` ### 11.6. Other special methods #### 11.6.1. Methods ##### __len__ The __len__ is defined within Sized trait and is used by the built-in len function. The __len__ method returns the length or size of the struct implementing it. ##### __int__ The __int__ is defined within Intable trait and is used by the built-in int function. The __int__ method returns an integer representation of the struct implementing it. ##### __bool__ The __bool__ is defined within Boolable trait and is used by conditional statements such as if to convert the given value to a boolean value for evaluation. The __bool__ method returns a boolean representation of the struct implementing it. ##### __str__ The __str__ is defined within Stringable trait and is used by the built-in str function. The __str__ method returns an string representation of the struct implementing it. The built-in function print uses __str__ before it prints the given value. The following code listing provides examples of special methods. ```mojo struct MyStruct(Sized, Intable, Boolable, Stringable): var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __len__(self) -> Int: print("len called") return len(self.ints) fn __int__(self) -> Int: print("int called") var sum: Int = 0 for i in range(len(self.ints)): sum += self.ints[i] return sum fn __bool__(self) -> Bool: print("bool called") return len(self.ints)>0 fn __str__(self) -> String: print("str called") return "MyStruct" ``` Usage: ```mojo var st = MyStruct(List(1, 2, 3)) print(len(st)) print(int(st)) if st: # Uses __bool__ print("MyStruct is true") print(str(st)) print(st) # Can directly print st because the __str__ method is implemented ``` ##### __is__ The __is__ method is used by the is clause to compare the identity between two values, and returns True if the identities are the same. Note that it is different from the eq method. The eq compares if two values are the same content-wise, while is checks if the two values are having the same identities. This means that two objects may have exactly same content, but different identities. Typical implementations check if the memory location of the two values are the same, in which case it would be considered as being identical. ##### __isnot__ The __isnot__ method is used by the is not clause to compare the identity between two values, and returns True if the identities are not the same. It is the opposite of the is clause, and in most cases it is sufficient for the implementation to return a negation of the is method. The following code listing provides examples of is and isnot methods. ```mojo struct MyStruct: var ptr: UnsafePointer[Int] fn __init__(inout self, ptr: UnsafePointer[Int]): self.ptr = ptr fn __is__(self, other: MyStruct) -> Bool: print("__is__ called") return self.ptr == other.ptr fn __isnot__(self, other: MyStruct) -> Bool: print("__isnot__ called") return not(self is other) ``` Usage: ```mojo var x: Int = 10 var y: Int = 10 print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(y))) # Results in False print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(x))) # Results in True print(MyStruct(UnsafePointer.address_of(x)) is not MyStruct(UnsafePointer.address_of(y))) # Results in True ``` ##### __getattr__ Many dynamic languages allow us to dynamically define attributes that do not exist in the original struct definition (or class definition in most languages). This ability allows programmers to define an ergonomic API, especially for object relational mapping. Even though Mojo is a statically compiled language, it allows for such a dynamic definition of attributes through a combination of methods, __getattr__ and __setattr__. The __getattr__ method takes in the attribute name as an argument. When you call an attribute my_attr within a struct (my_struct.my_attr), it is this attribute name my_attr that gets passed as the argument to the method __getattr__. Within the __getattr__, you can as an example return a result based on a database query involving the attribute name. Mojo does not restrict what you do with the attribute name, as long as you return a value conforming to the return type of the function. ##### __setattr__ The __setattr__ method takes in the attribute name and its value as arguments. When you set an attribute my_attr within a struct with a value (my_struct.my_attr = 'a value'), the __setattr__ is called with the given attribute name my_attr and the value 'a value' passed as arguments. The following code listing provides examples of getattr and setattr methods. ```mojo struct MyStruct: var fields: Dict[String, String] fn __init__(inout self, fields: Dict[String, String]): self.fields = fields fn __getattr__(self, attr: String) raises -> String: return self.fields[attr] fn __setattr__(inout self, attr: String, value: String) raises: self.fields[attr] = value ``` Usage: ```mojo var d: Dict[String, String] = Dict[String, String]() d["name"] = "IK" var st = MyStruct(d) print(st.name) # __getattr__ is called here st.name = "PK" # __setattr__ is called here print(st.name) ``` ##### __contains__ In Mojo you can check if a value is contained within a struct using the in operator. For example, "IK" in my_string, where my_string is a string and the expression results in value True if the literal IK is found within my_string. The __contains__ method is used by the in operator to check if a given value is within the struct defining that method. The following code listing provides an example of contains method. ```mojo struct MyStruct: var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __contains__(self, value: Int) -> Bool: for i in self.ints: if i[] == value: return True return False ``` Usage: ```mojo var my_struct = MyStruct(List(1, 2, 3)) print(1 in my_struct) # Returns True print(5 in my_struct) # Returns False ``` The __contains__ method also works with custom types as shown in the example below. ```mojo struct MyStruct2: var first_name: String var last_name: String fn __init__(inout self, first_name: String, last_name: String): self.first_name = first_name self.last_name = last_name fn __contains__(self, other: MyStruct2) -> Bool: return (self.first_name == other.first_name) or self.last_name == other.last_name ``` Usage: ```mojo var my_struct2 = MyStruct2("Ram", "C") print(MyStruct2("Ram", "T") in my_struct2) # Returns True print(MyStruct2("Kri", "C") in my_struct2) # Returns True print(MyStruct2("C", "Ram") in my_struct2) # Returns False ``` ← Previous: Error handling | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Lifecycle and ownership → ================================================================================ URL: https://ruhati.net/mojo/_operators_and_special_methods.html#_other_special_methods # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods 11.1. Arithmetic operators 11.2. Bitwise operators 11.3. Relational operators 11.4. Index operators 11.5. Context management methods 11.6. Other special methods - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 11.1. Arithmetic operators - 11.2. Bitwise operators - 11.3. Relational operators - 11.4. Index operators - 11.5. Context management methods - 11.6. Other special methods ## 11. Operators and special methods In Mojo some functions have special naming convention, starting and ending with double underscores: "_". Since they start and end with __double underscores_, they are called dunder methods. These methods are treated specially by Mojo compiler. Mojo supports implementation of arithmetic and relational operators, along with special methods that support lifecycle of values. In previous chapters, we saw many times the arithmetic and relational operators. Most of these operators can be implemented by user defined structs. Mojo provides quite a bit of flexibility in defining your own low level structs and the ability to implement these operators is part of that flexibility. Implementing an operator is as simple as implementing a function. Many of Mojo’s built in functionality is implemented as libraries. This means that we are able to implement powerful constructs just using basic language features offered by Mojo. ### 11.1. Arithmetic operators The following sections describe the various arithmetic operators in Mojo. #### 11.1.1. Addition The following are the addition operators. ##### __add__ The __add__ stands for arithmetic addition "+" between the struct defining the method and self type or another type. ##### __radd__ The __radd__ method is known as reverse addition, and is used when we try to add two values, where the first value does not have __add__ implemented. In this case, the Mojo compiler checks if the second value has __radd__ implemented, and it calls that one. ##### __iadd__ The __iadd__ method is called in-place addition and represents arithmetic addition "=". Even if you implement just `\\__add__` and do not implement `\\__iadd__`, the "=" operation would still work as Mojo will just use __add__ as the fallback. However, typically __add__ returns a new instance of the result. In case of large structs (structs with many fields), it could entail a lot of copy operations. The in-place addition can directly change the struct’s internal data, resulting in an efficient execution of the addition method. The __iadd__ therefore does not have a return value as it updates the struct itself. Since the struct' internal value is mutated, we need to use one of the inout or owned references of self in the method. The following code listing shows the different operations. Please note that these examples are not meant for production use, as it is intentionally kept incomplete for simplicity’s sake. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __add__(self, other: Self) -> Self: print("add invoked") return Self(self.val + other.val) fn __radd__(self, other: MyFloat) -> Self: print("radd invoked") return Self(self.val + int(other.val)) fn __iadd__(inout self, other: Self): print("iadd invoked") self.val = self.val + other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var add_res = MyInt(1) + MyInt(2) print(add_res.val) var radd_res = MyFloat(3.5) + MyInt(2) # Even though MyFloat does not implement __add__ method, we are able to do addition through MyInt's __radd__ print(radd_res.val) var iadd_res = MyInt(10) iadd_res += MyInt(20) print(iadd_res.val) ``` #### 11.1.2. Subtraction The following are the subtraction operators. ##### __sub__ The __sub__ stands for arithmetic subtraction "-" between the struct defining the method and self type or another type. ##### __rsub__ The __rsub__ method is known as reverse subtraction, and is used when we try to subtract two values, where the first value does not have __sub__ implemented. In this case, the Mojo compiler checks if the second value has __rsub__ implemented, and it calls that one. As the name implies, the reverse subtraction swaps the operands. Since subtraction is non-commutative, care must be taken to have correct values as the first operand and second operands. For example, x - y in normal subtraction would be y - x in reverse subtraction. ##### __isub__ The __isub__ method is called in-place subtraction and represents arithmetic subtraction "-=". The concept of __isub__ is the same as what we saw in __iadd__. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __sub__(self, other: Self) -> Self: print("sub invoked") return Self(self.val - other.val) fn __rsub__(self, other: MyFloat) -> Self: print("rsub invoked") return Self(int(other.val) - self.val) # Order matters for subtraction; it is not commutative. fn __isub__(inout self, other: Self): print("isub invoked") self.val = self.val - other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var sub_res = MyInt(1) - MyInt(2) print(sub_res.val) var rsub_res = MyFloat(3.5) - MyInt(2) # Even though MyFloat does not implement __sub__ method, we are able to do addition through MyInt's __rsub__ print(rsub_res.val) var isub_res = MyInt(10) isub_res -= MyInt(20) print(isub_res.val) ``` #### 11.1.3. Multiplication The following are multiplication operators. ##### __mul__ The __mul__ stands for multiplication "*" between the struct defining the method and self type or another type. ##### __rmul__ The __rmul__ method is known as reverse multiplication, and is used when we try to multiply two values, where the first value does not have __mul__ implemented. In this case, the Mojo compiler checks if the second value has __rmul__ implemented, and it calls that one. ##### __imul__ The __imul__ method is called in-place multiplication and represents multiplication "*=". The concept of __imul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is multiplication. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mul__(self, other: Self) -> Self: print("mul invoked") return Self(self.val * other.val) fn __rmul__(self, other: MyFloat) -> Self: print("rmul invoked") return Self(int(other.val) * self.val) # Will truncate fn __imul__(inout self, other: Self): print("imul invoked") self.val = self.val * other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mul_res = MyInt(3) * MyInt(2) print(mul_res.val) var rmul_res = MyFloat(3.5) * MyInt(2) print(rmul_res.val) var imul_res = MyInt(10) imul_res *= MyInt(20) print(imul_res.val) ``` #### 11.1.4. Matrix multiplication The following are operators for matrix multiplication. ##### __matmul__ The __matmul__ stands for matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. ##### __rmatmul__ The __rmatmul__ stands for the reverse matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imatmul__ The __imatmul__ stands for in-place matrix multiplication represented by the symbol "@" between the struct defining the method and self type or another type. The concept of __imatmul__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is matrix multiplication. ```mojo struct MyFloatMatrix: var val: List[List[Float16]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Float16]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyFloatMatrix(List[List[Float16]](), 0, 0) struct MyIntMatrix: var val: List[List[Int]] var rows: Int var cols: Int fn __init__(inout self, value: List[List[Int]], rows: Int, cols: Int): self.val = value self.rows = rows self.cols = cols @staticmethod fn empty() -> Self: return MyIntMatrix(List[List[Int]](), 0, 0) fn print(self): print("....") print("Rows:", self.rows, "Cols:", self.cols) for row in self.val: print() for col in row[]: print(col[], end=" ") print() print("----") @staticmethod fn _matmul_internal(first: Self, second: Self) -> Self: if first.cols != first.rows: print("Rows and columns do not match. ") return MyIntMatrix.empty() var res: List[List[Int]] = List[List[Int]](capacity=first.rows) for i in range(first.rows): res.append(List[Int](capacity=second.cols)) for j in range(second.cols): var s = 0 for k in range(first.cols): s += first.val[i][k] * second.val[k][j] res[i].append(s) return Self(res, first.rows, second.cols) fn __matmul__(self, other: Self) -> Self: # Naive implementation - not for production use print("matmul invoked") return Self._matmul_internal(self, other) fn __rmatmul__(self, other: MyFloatMatrix) -> Self: # Naive implementation - not for production use print("rmatmul invoked") var res: List[List[Int]] = List[List[Int]](capacity=self.rows) for i in range(other.rows): res.append(List[Int](capacity=self.cols)) for j in range(self.cols): var s = 0 for k in range(other.cols): s += int(other.val[i][k]) * self.val[k][j] # Will truncate res[i].append(s) return Self(res, other.rows, self.cols) fn __imatmul__(inout self, other: Self): # Naive implementation - not for production use print("imatmul invoked") var res = Self._matmul_internal(self, other) self.val = res.val self.rows = res.rows self.cols = res.cols ``` Usage: ```mojo var m : List[List[Int]] = List( List(1, 2, 1), List(5, 1, 1), List(2, 3, 1)) var n: List[List[Int]] = List( List(2, 5), List(6, 7), List(1, 1)) var flm : List[List[Float16]] = List( List[Float16](1.2, 2.3, 1.4), List[Float16](5.2, 1.2, 1.3), List[Float16](2.3, 3.4, 1.4)) var matmul_res = MyIntMatrix(m, 3, 3) @ MyIntMatrix(n, 3, 2) matmul_res.print() var rmatmul_res = MyFloatMatrix(flm, 3, 3) @ MyIntMatrix(n, 3, 2) rmatmul_res.print() var imatmul_res = MyIntMatrix(m, 3, 3) imatmul_res @= MyIntMatrix(n, 3, 2) imatmul_res.print() ``` #### 11.1.5. Division The division operators. ##### __truediv__ The __truediv__ stands for division represented by the symbol "/" between the struct defining the method and self type or another type. The result of \\__truediv is a floating point type with 64 bits. ##### __rtruediv__ The __rtruediv__ stands for the reverse division represented by the symbol "/" between the struct defining the method and self type or another type. Similar to __rsub__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __itruediv__ The __itruediv__ stands for in-place division represented by the symbol "/" between the struct defining the method and self type or another type. The concept of __itruediv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __truediv__(self, other: Self) -> MyFloat: print("truediv invoked") return MyFloat(self.val / other.val) fn __rtruediv__(self, other: MyFloat) -> MyFloat: print("rtruediv invoked") return MyFloat(int(other.val) / self.val) fn __itruediv__(inout self, other: Self): print("itruediv invoked") self.val = int(self.val / other.val) # Will truncate ``` Usage: ```mojo var num: MyInt = MyInt(42) var div_res = MyInt(3) / MyInt(2) print(div_res.val) var rdiv_res = MyFloat(3.5) / MyInt(2) print(rdiv_res.val) var idiv_res = MyInt(10) idiv_res /= MyInt(20) print(idiv_res.val) ``` Note that __itruediv__ implementation had to convert the result from a Float to Int because MyInt can only store Int as value within it. Mojo has the ability to have a variable with multiple possible types through Variant struct. We will cover that in a later chapter. ##### __floordiv__ The __floordiv__ stands for floor division (also known as integer division) represented by the symbol "//" between the struct defining the method and self type or another type. As the name suggest, the result of the __floordiv__ is an integer instead of float. Typically implementations truncate towards zero in case of positive values and away from zero for negative values. For example, 7//3 results in 2, while -7//3 results in -3 and not -2. ##### __rfloordiv__ The __rfloordiv__ stands for the reverse division represented by the symbol "//" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ifloordiv__ The __ifloordiv__ stands for in-place division represented by the symbol "//" between the struct defining the method and self type or another type. The concept of __ifloordiv__ is the same as what we saw in __iadd__, except instead of addition, the applied operation is floor division. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __floordiv__(self, other: Self) -> Self: print("floordiv invoked") return Self(self.val // other.val) fn __rfloordiv__(self, other: MyFloat) -> Self: print("rfloordiv invoked") return Self(int(other.val) // self.val) fn __ifloordiv__(inout self, other: Self): print("ifloordiv invoked") self.val = self.val // other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var floordiv_res = MyInt(3) // MyInt(2) print(floordiv_res.val) var rfloordiv_res = MyFloat(3.5) // MyInt(2) print(rfloordiv_res.val) var ifloordiv_res = MyInt(10) ifloordiv_res //= MyInt(20) print(ifloordiv_res.val) ``` #### 11.1.6. Modulo The following are the modulo operators. ##### __mod__ The __mod__ stands for modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The approach to implement __mod__ is the same as what we saw in __truediv__, except instead of division, the applied operation is modulo operation. The __mod__ derives its name from the mathematical modulo operation. Modulo operation divides two numbers and returns the remainder of the division. ##### __rmod__ The __rmod__ stands for the reverse modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __imod__ The __imod__ stands for in-place modulo operation represented by the symbol "%" between the struct defining the method and self type or another type. The concept of __imod__ is the same as what we saw in __itruediv__, except instead of division, the applied operation is modulo. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __mod__(self, other: Self) -> Self: print("mod invoked") return Self(self.val % other.val) fn __rmod__(self, other: MyFloat) -> Self: print("rmod invoked") return Self(int(other.val) % self.val) fn __imod__(inout self, other: Self): print("imod invoked") self.val = self.val % other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var mod_res = MyInt(7) % MyInt(2) print(mod_res.val) var rmod_res = MyFloat(8) % MyInt(2) print(rmod_res.val) var imod_res = MyInt(37) imod_res %= MyInt(20) print(imod_res.val) ``` #### 11.1.7. Exponentiation The following lists the exponentiation operators. ##### __pow__ The __pow__ stands for exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The approach to implement __pow__ is the same as what we saw in __mul__, except instead of multiplication, we apply exponential operation. ##### __ipow__ The __ipow__ stands for in-place exponential operation represented by the symbol "**" between the struct defining the method and self type or another type. The concept of __ipow__ is the same as what we saw in __imul__, except instead of multiplication, we apply exponential operation. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pow__(self, other: Self) -> Self: print("pow invoked") return Self(self.val ** other.val) fn __ipow__(inout self, other: Self): print("ipow invoked") self.val **= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var pow_res = MyInt(7) ** MyInt(2) print(pow_res.val) var ipow_res = MyInt(7) ipow_res **= MyInt(2) print(ipow_res.val) ``` #### 11.1.8. Unary operators The following are the unary operators. ##### __neg__ The __neg__ stands for the unary operation represented by the symbol "-" for the struct defining the method. The negative sign appears as prefix to the value and typically results in negation of the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __neg__(self) -> Self: print("neg invoked") return Self(-self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var neg_res = -MyInt(7) print(neg_res.val) ``` ##### __pos__ The __pos__ stands for the unary operation represented by the symbol "+" for the struct defining the method. The positive sign appears as prefix to the value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __pos__(self) -> Self: print("pos invoked") return Self(+self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var pos_res = +MyInt(7) print(pos_res.val) ``` ##### __invert__ The __invert__ stands for the unary operation represented by the symbol "~" for the struct defining the method. The invert sign appears as prefix to the value. Typical implementations return bitwise compliment of the value, switching 1 for 0 and vice versa. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __invert__(self) -> Self: print("invert invoked") return Self(~self.val) ``` Usage: ```mojo var num: MyInt = MyInt(42) var invert_res = ~MyInt(2) print(invert_res.val) ``` ### 11.2. Bitwise operators The following are the bitwise operators. #### 11.2.1. Operators ##### __lshift__ The __lshift__ stands for left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. ##### __rlshift__ The __rlshift__ stands for the reverse left shift operation represented by the symbol "<<" between the struct defining the method and self type or another type. Similar to __rtruediv__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __ilshift__ The __ilshift__ stands for in-place left shift operation represented by the symbol "<⇐" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __lshift__, the __ilshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lshift__(self, other: Self) -> Self: print("lshift invoked") return Self(self.val << other.val) fn __rlshift__(self, other: MyFloat) -> Self: print("rlshift invoked") return Self(int(other.val) << self.val) fn __ilshift__(inout self, other: Self): print("ilshift invoked") self.val <<= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var lshift_res = MyInt(2) << MyInt(3) print(lshift_res.val) var rlshift_res = MyFloat(2) << MyInt(3) print(rlshift_res.val) var ilshift_res = MyInt(3) ilshift_res <<= MyInt(2) print(ilshift_res.val) ``` ##### __rshift__ The __rshift__ stands for right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the right. The second operand indicates how many bits are to be shifted to the right. ##### __rrshift__ The __rrshift__ stands for the reverse right shift operation represented by the symbol ">>" between the struct defining the method and self type or another type. Similar to __rlshift__, take care to use the appropriate order of the operands when doing the implementation, as the operands are swapped. ##### __irshift__ The __irshift__ stands for in-place right shift operation represented by the symbol ">>=" between the struct defining the method and self type or another type. Typical implementation shifts the bits of the first operand to the left. The second operand indicates how many bits are to be shifted to the left. Instead of returning a new instance like in __rshift__, the __irshift__ updates its own instance with the result. The concept is similar to __iadd__ mentioned earlier. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __rshift__(self, other: Self) -> Self: print("rshift invoked") return Self(self.val >> other.val) fn __rrshift__(self, other: MyFloat) -> Self: print("rrshift invoked") return Self(int(other.val) >> self.val) fn __irshift__(inout self, other: Self): print("irshift invoked") self.val >>= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var rshift_res = MyInt(20) >> MyInt(3) print(rshift_res.val) var rrshift_res = MyFloat(24) >> MyInt(3) print(rrshift_res.val) var irshift_res = MyInt(30) irshift_res >>= MyInt(2) print(irshift_res.val) ``` ##### __and__ The __and__ stands for bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. ##### __rand__ The __rand__ stands for reverse bitwise AND operator represented by the symbol "&" between the struct defining the method and self type or another type. This is invoked when the first value does not have __and__ implemented. In this case, the Mojo compiler checks if the second value has __rand__ implemented, and calls that one. ##### __iand__ The __iand__ stands for in-place bitwise AND operator represented by the symbol "&=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __and__, the __iand__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __and__(self, other: Self) -> Self: print("and invoked") return Self(self.val & other.val) fn __rand__(self, other: MyFloat) -> Self: print("rand invoked") return Self(int(other.val) & self.val) fn __iand__(inout self, other: Self): print("iand invoked") self.val &= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var and_res = MyInt(23) & MyInt(6) print(and_res.val) var rand_res = MyFloat(20) & MyInt(4) print(rand_res.val) var iand_res = MyInt(10) iand_res &= MyInt(2) print(iand_res.val) ``` ##### __or__ The __or__ stands for bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. ##### __ror__ The __ror__ stands for reverse bitwise OR operator represented by the symbol "|" between the struct defining the method and self type or another type. This is invoked when the first value does not have __or__ implemented. In this case, the Mojo compiler checks if the second value has __ror__ implemented, and calls that one. ##### __ior__ The __ior__ stands for in-place bitwise OR operator represented by the symbol "|=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __or__, the __ior__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __or__(self, other: Self) -> Self: print("or invoked") return Self(self.val | other.val) fn __ror__(self, other: MyFloat) -> Self: print("ror invoked") return Self(int(other.val) | self.val) fn __ior__(inout self, other: Self): print("ior invoked") self.val |= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var or_res = MyInt(5) | MyInt(3) print(or_res.val) var ror_res = MyFloat(15) | MyInt(17) print(ror_res.val) var ior_res = MyInt(5) ior_res |= MyInt(1) print(ior_res.val) ``` ##### __xor__ The __xor__ stands for bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. ##### __rxor__ The __rxor__ stands for reverse bitwise XOR operator represented by the symbol "^" between the struct defining the method and self type or another type. This is invoked when the first value does not have __xor__ implemented. In this case, the Mojo compiler checks if the second value has __rxor__ implemented, and calls that one. ##### __ixor__ The __ixor__ stands for in-place bitwise OR operator represented by the symbol "^=" between the struct defining the method and self type or another type. Instead of returning a new instance like in __xor__, the __ixor__ updates its own instance with the result. ```mojo struct MyFloat: var val: Float16 fn __init__(inout self, value: Float16): self.val = value struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __xor__(self, other: Self) -> Self: print("xor invoked") return Self(self.val ^ other.val) fn __rxor__(self, other: MyFloat) -> Self: print("rxor invoked") return Self(int(other.val) ^ self.val) fn __ixor__(inout self, other: Self): print("ixor invoked") self.val ^= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) var xor_res = MyInt(5) ^ MyInt(3) print(xor_res.val) var rxor_res = MyFloat(15) ^ MyInt(17) print(rxor_res.val) var ixor_res = MyInt(5) ixor_res ^= MyInt(3) print(ixor_res.val) ``` ### 11.3. Relational operators #### 11.3.1. Operators ##### __eq__ The __eq__ stands for equality operator represented by the symbol "==" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __eq__(self, other: Self) -> Bool: print("eq invoked") return self.val == other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) == MyInt(5)) print(MyInt(5) == MyInt(3)) ``` ##### __ne__ The __ne__ stands for inequality operator represented by the symbol "!=" between the struct defining the method and self type or another type. The operation returns a Bool value. Note that __ne__ is not invoked when you call not x==y though. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ne__(self, other: Self) -> Bool: print("ne invoked") return self.val != other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) != MyInt(5)) print(MyInt(5) != MyInt(3)) print(not MyInt(5) == MyInt(3)) ``` ##### __lt__ The __lt__ stands for less-than operator represented by the symbol "<" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __lt__(self, other: Self) -> Bool: print("lt invoked") return self.val < other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) < MyInt(5)) print(MyInt(3) < MyInt(5)) ``` ##### __gt__ The __gt__ stands for greater-than operator represented by the symbol ">" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __gt__(self, other: Self) -> Bool: print("gt invoked") return self.val > other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) > MyInt(5)) print(MyInt(5) > MyInt(3)) ``` ##### __le__ The __le__ stands for less-than-or-equal-to operator represented by the symbol "⇐" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __le__(self, other: Self) -> Bool: print("le invoked") return self.val <= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) <= MyInt(5)) print(MyInt(5) <= MyInt(3)) ``` ##### __ge__ The __ge__ stands for greater-than-or-equal-to operator represented by the symbol ">=" between the struct defining the method and self type or another type. The operation returns a Bool value. ```mojo struct MyInt: var val: Int fn __init__(inout self, value: Int): self.val = value fn __ge__(self, other: Self) -> Bool: print("ge invoked") return self.val >= other.val ``` Usage: ```mojo var num: MyInt = MyInt(42) print(MyInt(5) >= MyInt(5)) print(MyInt(3) >= MyInt(5)) ``` ### 11.4. Index operators Any large scale program would use collection data types such as lists, arrays, dictionaries extensively. Some programming languages have built-in syntax to make usage of such types convenient. Mojo has built-in syntactical support for collection types. Mojo allows accessing collection like data types using the syntax []. For example, list[2]. It also allows setting of values at a given index (e.g. list[2]=5). In line with Mojo’s philosophy of moving as much functionality as possible to libraries, instead of having specially treated data types that have exclusive privilege of syntax, Mojo opened up the index operator capability to any type that defines __getitem__ and __setitem__ methods. This means that your custom List struct will have the same syntactical support like the List bundled with Mojo. #### 11.4.1. Operators ##### __getitem__ The __getitem__ is the method invoked when you try to access values stored within the collection using the my_list[index] syntax (where my_list is the collection and index is the position of the element desired from the list). ##### __setitem__ The __setitem__ is the method invoked when you try to assign values to a collection using the my_list[index]=value syntax (where my_list is the collection and index is the position at which the value will be assigned). ```mojo struct MyCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, x: Int) -> String: return self.list[x] fn __setitem__(inout self, x: Int, val: String): self.list[x] = val ``` Usage: ```mojo var x = MyCollection(List(String("A"), String("B"))) print("Before:", x[1]) # Gets x[1] = String("C") # Sets print("After:", x[1]) ``` It is also possible to get and set using multiple indices, especially useful for Matrix like data structures. This means that we can use in our code my_list[row, col, and so on…​]. The following code listing shows such an example for a matrix. Note that this example is not a production quality implementation. ```mojo struct MyMatrix: var val: List[List[String]] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.rows = rows self.cols = cols self.val = List[List[String]](capacity=rows) for row in range(rows): self.val.append(List[String](capacity=cols)) for col in range(cols): self.val[row].append(String("None")) fn __getitem__(self, row: Int, col: Int) -> String: return self.val[row][col] fn __setitem__(inout self, row: Int, col: Int, s: String): self.val[row][col] = s ``` Usage: ```mojo var y = MyMatrix(5, 3) print("Before:", y[1, 2]) # Gets y[1, 2] = String("D") # Sets print("After:", y[1, 2]) ``` ##### __getitem__ with Slice Mojo supports getting a slice of a collection or a container using the slicing operator. The following diagram shows the structure of the slicing operator. In order to be able to get a slice from a collection or a container, the collection or the container must implement method __getitem__ that takes a Slice object. This Slice object is instantiated by the Mojo compiler when you use the slice operator. In a way you can think of the [start:stop:step] as a literal form instantiating a Slice. The start argument of Slice is the start index of the collection from where the slice will be taken. The end argument is the last index until which the slice will be taken (the element referred by this index will be excluded, only its previous element will be taken as last for the slice). The step gives the number of increments to be taken to get the next element. Any of the arguments of the Slice can be negative. A negative value means reversal of the indexing or stepping. Care must be taken to provide valid combinations though, otherwise it results in error. ```mojo struct MySliceableCollection: var list: List[String] fn __init__(inout self, list: List[String]): self.list = list fn __getitem__(self, slc: Slice) -> List[String]: return self.list[slc.start:slc.end:slc.step] ``` Usage: ```mojo var z = MySliceableCollection( List(String("H"), String("E"), String("L"), String("L"), String("O"), String("W"), String("O"), )) for i in z[0:3:1]: print(i[], end=" ") print() for i in z[1:6:2]: print(i[], end=" ") print() for i in z[1:]: print(i[], end=" ") print() for i in z[:1]: print(i[], end=" ") print() for i in z[-3:]: print(i[], end=" ") print() for i in z[:-3]: print(i[], end=" ") print() for i in z[::-1]: print(i[], end=" ") print() ``` ### 11.5. Context management methods In large programs, we often need to resources like files and database connections. When we open access to those resources, we typically have a handle, which we use to perform actions. However, once we have done with our actions, we must remember to cleanup or close the resources, otherwise we end up with dangling resources, memory leaks, locked files, etc. Mojo provides with keyword for managing such context or resources. The following diagram illustrates the syntax of the with statement. #### 11.5.1. Methods ##### __enter__ The method that handles the allocation of the resource and returns a resource. The resource has scope only within the body of the with. It is not mandatory to assign the return value to a variable, especially if it is not being used. ##### __exit__ The method that handles the cleanup of the resource. There are two implementations of the __exit__ method, one without any arguments __exit__(self, Error) and one with Error as an argument __exit__(self, Error). The __exit__(self, Error) is invoked when the with body has an exception and exits the with block abnormally. The method __exit__(self, Error) returns a Bool to indicate whether or not to propagate the error further. Any resources allocated in the __enter__ must be cleaned up at both the __exit__ methods, otherwise we would end up with dangling resources. For example, if __exit__(self, Error) is not properly implemented, resource leaks will occur only when there are exceptions raised within the with body. This will lead to rare but difficult to find defects. The following code listing shows an example for the context manager. ```mojo struct Resource: var name: String fn __init__(inout self, name: String): self.name = name fn open(self): print("Opened") fn close(self): print("Close") fn __copyinit__(inout self, other:Resource): self.name = other.name struct MyResourceManager: var resource: Resource fn __init__(inout self): self.resource = Resource("a_resource") fn __enter__(self) -> Resource: print("Entered context") self.resource.open() return self.resource fn __exit__(self): self.resource.close() print("Exited context") fn __exit__(self, err: Error) -> Bool: self.resource.close() print("Exited context") return False ``` Usage: ```mojo with MyResourceManager() as res: print("Inside context, resource is:", res.name) raise Error("An error while processing") ``` ### 11.6. Other special methods #### 11.6.1. Methods ##### __len__ The __len__ is defined within Sized trait and is used by the built-in len function. The __len__ method returns the length or size of the struct implementing it. ##### __int__ The __int__ is defined within Intable trait and is used by the built-in int function. The __int__ method returns an integer representation of the struct implementing it. ##### __bool__ The __bool__ is defined within Boolable trait and is used by conditional statements such as if to convert the given value to a boolean value for evaluation. The __bool__ method returns a boolean representation of the struct implementing it. ##### __str__ The __str__ is defined within Stringable trait and is used by the built-in str function. The __str__ method returns an string representation of the struct implementing it. The built-in function print uses __str__ before it prints the given value. The following code listing provides examples of special methods. ```mojo struct MyStruct(Sized, Intable, Boolable, Stringable): var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __len__(self) -> Int: print("len called") return len(self.ints) fn __int__(self) -> Int: print("int called") var sum: Int = 0 for i in range(len(self.ints)): sum += self.ints[i] return sum fn __bool__(self) -> Bool: print("bool called") return len(self.ints)>0 fn __str__(self) -> String: print("str called") return "MyStruct" ``` Usage: ```mojo var st = MyStruct(List(1, 2, 3)) print(len(st)) print(int(st)) if st: # Uses __bool__ print("MyStruct is true") print(str(st)) print(st) # Can directly print st because the __str__ method is implemented ``` ##### __is__ The __is__ method is used by the is clause to compare the identity between two values, and returns True if the identities are the same. Note that it is different from the eq method. The eq compares if two values are the same content-wise, while is checks if the two values are having the same identities. This means that two objects may have exactly same content, but different identities. Typical implementations check if the memory location of the two values are the same, in which case it would be considered as being identical. ##### __isnot__ The __isnot__ method is used by the is not clause to compare the identity between two values, and returns True if the identities are not the same. It is the opposite of the is clause, and in most cases it is sufficient for the implementation to return a negation of the is method. The following code listing provides examples of is and isnot methods. ```mojo struct MyStruct: var ptr: UnsafePointer[Int] fn __init__(inout self, ptr: UnsafePointer[Int]): self.ptr = ptr fn __is__(self, other: MyStruct) -> Bool: print("__is__ called") return self.ptr == other.ptr fn __isnot__(self, other: MyStruct) -> Bool: print("__isnot__ called") return not(self is other) ``` Usage: ```mojo var x: Int = 10 var y: Int = 10 print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(y))) # Results in False print(MyStruct(UnsafePointer.address_of(x)) is MyStruct(UnsafePointer.address_of(x))) # Results in True print(MyStruct(UnsafePointer.address_of(x)) is not MyStruct(UnsafePointer.address_of(y))) # Results in True ``` ##### __getattr__ Many dynamic languages allow us to dynamically define attributes that do not exist in the original struct definition (or class definition in most languages). This ability allows programmers to define an ergonomic API, especially for object relational mapping. Even though Mojo is a statically compiled language, it allows for such a dynamic definition of attributes through a combination of methods, __getattr__ and __setattr__. The __getattr__ method takes in the attribute name as an argument. When you call an attribute my_attr within a struct (my_struct.my_attr), it is this attribute name my_attr that gets passed as the argument to the method __getattr__. Within the __getattr__, you can as an example return a result based on a database query involving the attribute name. Mojo does not restrict what you do with the attribute name, as long as you return a value conforming to the return type of the function. ##### __setattr__ The __setattr__ method takes in the attribute name and its value as arguments. When you set an attribute my_attr within a struct with a value (my_struct.my_attr = 'a value'), the __setattr__ is called with the given attribute name my_attr and the value 'a value' passed as arguments. The following code listing provides examples of getattr and setattr methods. ```mojo struct MyStruct: var fields: Dict[String, String] fn __init__(inout self, fields: Dict[String, String]): self.fields = fields fn __getattr__(self, attr: String) raises -> String: return self.fields[attr] fn __setattr__(inout self, attr: String, value: String) raises: self.fields[attr] = value ``` Usage: ```mojo var d: Dict[String, String] = Dict[String, String]() d["name"] = "IK" var st = MyStruct(d) print(st.name) # __getattr__ is called here st.name = "PK" # __setattr__ is called here print(st.name) ``` ##### __contains__ In Mojo you can check if a value is contained within a struct using the in operator. For example, "IK" in my_string, where my_string is a string and the expression results in value True if the literal IK is found within my_string. The __contains__ method is used by the in operator to check if a given value is within the struct defining that method. The following code listing provides an example of contains method. ```mojo struct MyStruct: var ints: List[Int] fn __init__(inout self, ints: List[Int]): self.ints = ints fn __contains__(self, value: Int) -> Bool: for i in self.ints: if i[] == value: return True return False ``` Usage: ```mojo var my_struct = MyStruct(List(1, 2, 3)) print(1 in my_struct) # Returns True print(5 in my_struct) # Returns False ``` The __contains__ method also works with custom types as shown in the example below. ```mojo struct MyStruct2: var first_name: String var last_name: String fn __init__(inout self, first_name: String, last_name: String): self.first_name = first_name self.last_name = last_name fn __contains__(self, other: MyStruct2) -> Bool: return (self.first_name == other.first_name) or self.last_name == other.last_name ``` Usage: ```mojo var my_struct2 = MyStruct2("Ram", "C") print(MyStruct2("Ram", "T") in my_struct2) # Returns True print(MyStruct2("Kri", "C") in my_struct2) # Returns True print(MyStruct2("C", "Ram") in my_struct2) # Returns False ``` ← Previous: Error handling | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Lifecycle and ownership → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html#_pass_by_value_and_pass_by_reference # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html#_borrowed # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html#_owned # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html#_inout # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html#_init # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html#_del # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html#_copyinit # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_lifecycle_and_ownership.html#_moveinit # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership 12.1. Pass by value and pass by reference 12.2. borrowed 12.3. owned 12.4. inout 12.5. __init__ 12.6. __del__ 12.7. __copyinit__ 12.8. __moveinit__ - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 12.1. Pass by value and pass by reference - 12.2. borrowed - 12.3. owned - 12.4. inout - 12.5. __init__ - 12.6. __del__ - 12.7. __copyinit__ - 12.8. __moveinit__ ## 12. Lifecycle and ownership Before we jump into the lifecycle operations, let’s understand the concept of ownership of references. ### 12.1. Pass by value and pass by reference We have two ways to pass something to a function or method. One is pass by value and the other is pass by reference. We call something as passed by value when the actual value of a variable is passed to the function, which results in the value being copied to the callee function’s argument. In this case the callee has its own copy and the caller has another copy. If the callee function changes the value, it is not reflected in the caller. In Mojo the data types that fit within the registers of the CPU are passed by default as values and so the callee gets a copy of the value. Also, when we perform an assignment of a variable to another variable, the value of the variable is copied to the assignee. The second way is to pass the location where the value is stored. In this case, both the caller and the callee refers to the exact same location of the value. We can say that the caller is passing a reference to the value to the callee. So if the callee changes the value, that change will be reflected immediately in the caller. When we pass a value by reference to a function, that function can potentially change the value. However, if the caller is not expecting its value to be changed while the callee changes the value, we end up with defects. In many programming languages that support pass by reference, it is a common source of defects. So how can we indicate to the caller of a function that the function intends to only read the value or it intends to change it? Mojo provides a solution by annotating the function arguments with a set of keywords that shows the intend. ### 12.2. borrowed The borrowed keyword indicates that the argument is used only to read the value and the argument’s value will not be changed. This is the default behavior of all Mojo function’s arguments, so the borrowed keyword is not necessary to be given. When an argument is borrowed, the Mojo compiler prevents any mutation of the argument’s value. It also does not allow the binding of the argument to be changed as it would have led to discarding (and destruction) of the original value contained in the argument. Since we are borrowing the value, the caller would not expect the value to be destroyed. In def functions, you may find that Mojo seemingly allows mutation of the arguments. However, behind the scenes, it is performing a copy-on-write. This means that the argument is copied transparently to the developer, and the original argument is left intact. This is done so that for the developer the def function feels similar to how it works in Python. ```mojo fn value_borrowed(borrowed val: Int): ... fn value(val: Int): # This is also borrowed ... ``` ### 12.3. owned The owned keyword indicates that the function assumes the ownership of the given reference argument. This means that we are free to mutate or destruct the passed value within that function. When an argument is owned, the function can be sure that it can mutate the argument. It is possible that Mojo passes a copy of the value to the function in such cases. When the value is copied, then the caller has own copy and the callee function has its own copy. ```mojo fn value_owned(owned val: Int): ... ``` ### 12.4. inout The inout keyword indicates that the function will potentially mutate the value within the passed reference. The difference from owned references is that the inout arguments are implicitly returned by the function. That is, the function cannot return an uninitialized inout argument. If the value within the inout reference is destructed, then another value must be assigned to the argument before the function returns. To move a reference, the caret ^ operator is used. ```mojo fn value_inout(inout val: Int): ... fn value_inout_return(inout val: String): _ = val^ # Effectively destruct the value. Now the reference is uninitialized val = 10 # We have to assign a value otherwise Mojo compiler would complain ``` Let’s now look into the lifecycle methods. We start with one that we are already familiar with: the init method. ### 12.5. __init__ The init method is part of the lifecycle of a struct. The main purpose of init is to initialize all its member variables (a.k.a fields). ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` In this example, we defined a struct and the init method within it. The first argument of the init method is always self with a modifier inout. The self is a reference to the struct’s own instance. The inout tells the compiler that the self is mutable (i.e., we can change the field values held within self). In Mojo, the function arguments are by default read-only, and we cannot change the values of the function argument. The inout is needed for self so that we are able to initialize the fields within the struct. Since one of the main responsibility of init is to initialize the fields of the struct, we naturally need to mark it as inout. In the example, we are allocating memory from the heap to store an integer value using the static method call UnsafePointer[Int].alloc. We store a value into the pointer location using the function initialize_pointee_move. We retrieve the stored value from the pointer using the deference operator []. ### 12.6. __del__ The delete method del is also part of the lifecycle of a struct. If the init method is used to initialize variables or to allocate resources for that struct, the delete method is used to release the resources held for that struct. For example, if init method allocates memory from the heap, the delete method is used to free that memory. The del method is called just before the value is going to be destroyed by the compiler. If we allocate resources in the init method and do not release or free those resources in the delete method, we end up with resource leaks such as memory leaks. So great care must be taken to symmetrically allocate and free resources using the init and delete methods. Unlike many other languages, Mojo has an eager destruction approach. This means that a value or object is destroyed as soon as its last use, unless its lifetime is explicitly extended. This is in contrast with many system languages where the values or objects are destroyed at the end of the scope of a given block. This approach allowed Mojo to have a much simpler lifecycle management, improving overall ergonomics of the language. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __del__(owned self): self.value_ptr.free() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ### 12.7. __copyinit__ Mojo invokes the copyinit for all the cases where a value needs to be copied. For example, when a variable is assigned to another one, the copyinit may be called for the assignee. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to init, copyinit gets an additional argument of the same type as the struct in which the method is declared (the type of itself is named as Self in Mojo). In the copyinit it is expected that you initialize your member fields with values copied from the "other" struct. copyinit is also known as copy constructor in other languages. Mojo compiler tries to optimize away copies as much as possible, especially where the reference is not being used later on. ```mojo struct MyNumber: var value_ptr: UnsafePointer[Int] fn __init__(inout self, value: Int): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_move(self.value_ptr, value) fn value(self) -> Int: return self.value_ptr[] fn change_value(self, value: Int): initialize_pointee_move(self.value_ptr, value) ``` ```mojo fn __copyinit__(inout self, other: Self): self.value_ptr = UnsafePointer[Int].alloc(1) initialize_pointee_copy(self.value_ptr, other.value()) ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num: MyNumber = num # Calling __copyinit__ on other_num print("other_num after copy:", other_num.value()) other_num.change_value(84) print("other_num after change:", other_num.value()) print("num after copy:", num.value()) ``` In the previous code listing, within the copyinit, we are allocating new memory for holding the copy of the value from other. The other has type Self, which means the same type as the struct defining the copyinit - in this case MyNumber. ### 12.8. __moveinit__ Mojo invokes the moveinit for all the cases where a value needs to be moved. This method is quite similar to the init method in the sense that it initializes the struct. In contrast to copyinit, moveinit has the second argument annotated with owned. The owned is required because the second argument’s value will be destroyed once the move operation completes. In moveinit, we reassign the values from the other struct to the struct which defines the moveinit. moveinit is particularly useful where copy operations are expensive. For example, in Mojo move semantics are used for String. This ensures that string operations are as much as possible efficient, while still maintaining immutability. ```mojo fn __moveinit__(inout self, owned other: Self): self.value_ptr = other.value_ptr other.value_ptr = UnsafePointer[Int]() ``` ```mojo var num: MyNumber = MyNumber(42) print("num:", num.value()) ``` ```mojo var other_num2: MyNumber = num^ # Moving print("other_num2 after move:", other_num2.value()) other_num2.change_value(84) print("other_num2 after change:", other_num2.value()) # Uncommenting below line results in compiler error as `num` is no longer initialized #print("num after copy:", num.value()) ``` The different lifecycle operations are illustrated in the following diagram. ← Previous: Operators and special methods | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Parameters and compile-time programming → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_compile_time_execution_of_code # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_conditional_execution_at_compile_time # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_parameters_in_functions # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_keyword_parameters # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_inferred_only_parameters # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_variadic_parameters # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_default_values_in_parameters # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_parameters_in_structs_traits # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_parameters_and_compile_time_programming.html#_custom_compile_time_checks # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming 13.1. Compile-time execution of code 13.2. Conditional execution at compile-time 13.3. Parameters in functions 13.4. Keyword parameters 13.5. Inferred-only parameters 13.6. Variadic parameters 13.7. Default values in parameters 13.8. Parameters in structs, traits 13.9. Custom compile-time checks - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 13.1. Compile-time execution of code - 13.2. Conditional execution at compile-time - 13.3. Parameters in functions - 13.4. Keyword parameters - 13.5. Inferred-only parameters - 13.6. Variadic parameters - 13.7. Default values in parameters - 13.8. Parameters in structs, traits - 13.9. Custom compile-time checks ## 13. Parameters and compile-time programming ### 13.1. Compile-time execution of code The programs we write are compiled by the compiler and then an executable file is created out of it. This executable file is later run on an operating system. So the code we write is executed when we run the program. So if we write a loop, then that loop gets executed when the program is run. Let’s imagine that we need to execute a function for which the inputs are well known already at the time of writing the code. Such a function can be executed at compile-time, and the results kept in the executable file. This means that when the program is run, it just takes the pre-calculated value, saving valuable CPU time during the execution. Unlike many mainstream languages, Mojo allows execution of code at compile-time. Mojo even has very few restrictions on what kind of code can be executed at compile-time. We already saw the use of alias to store a constant. When we assign a function’s value to an alias constant, Mojo executes that function at compile-time and assigns the result as a constant value to the alias. For example see the following code listing. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo alias added = add(1, 2) ``` Usage: ```mojo print(added) ``` ### 13.2. Conditional execution at compile-time We can conditionally call a function, or define a constant. That is, the if statement also can be used at compile time. Mojo allows us to pass an environment variable at compile time, which we can access and conditionally compile our code. To pass an environment variable to the compiler, you can use the option -D <var>=<val>. For example, mojo -D add_it=True filename.mojo. ```mojo fn add(a: Int, b: Int) -> Int: return a + b ``` ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value alias added_conditionally = add(1, 2) if is_defined["add_it"]() else 0 ``` Usage: ```mojo print(added_conditionally) ``` ### 13.3. Parameters in functions We saw that we can use alias to execute functions at compile time. What if we do not want to execute the function at compile-time, but just "parameterize" the function at compile-time, so that when it is finally run during the program execution, it uses that passed-in parameters? Mojo provides a solution to that by providing capability for compile-time parameterization. To achieve this, we pass parameters within square brackets. For example: add[my_param: Int](). So in short, when we want to pass to a function values at runtime, we pass it within parenthesis, and if we want to pass to a function values at compile-time, we pass it within square brackets. Note that we are distinguishing between parameters and arguments. In Mojo parameters are compile-time values and arguments are runtime values. ```mojo fn add[cond: Bool](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo # Execute with "mojo -D add_it=True <filename>" for a non-zero value print(add[is_defined["add_it"]()](3, 4)) ``` In the previous example, we are passing a boolean value as a parameter to the add function. The value of the boolean is taken from a compile-time command line argument add_it using the Mojo option -D. The compiler will hardcode True in the parameter cond of the function add if the add_it was set (the value of the add_it is irrelevant here). Irrespective of where and how the compiled file is executed, the cond will have a constant value set at the compile-time. In addition to values being passed as parameters to functions, we can also pass types themselves. If a concrete struct is expected in the parameter, then Mojo expects a value to be passed at the function call site. However, if a trait is expected in the parameter, then Mojo expects a type to be passed at the function call site. In the previous example we saw that add expected a value of type Bool. In the next example, the add_ints expects a trait Intable as a parameter. That trait is then later used to declare the types of the function arguments. At the function call site, you can see that Int is being passed as parameter. ```mojo fn add_ints[IntType: Intable](a: IntType, b: IntType) -> Int: return int(a) + int(b) ``` Usage: ```mojo print(add_ints[Int](3, 4)) ``` ### 13.4. Keyword parameters So far we have seen how we can pass parameters by position. Similar to the keyword arguments that we pass to functions, we can pass parameter values using the name of the parameter. The rules of the keyword parameters are the same as the keyword arguments for functions. ```mojo fn div_compile_time[a: Int, b: Int]() -> Float64: return a / b ``` Usage: ```mojo print(div_compile_time[b=3, a=4]()) ``` The previous example shows that we can pass parameter values with the param names, in which case the order of the parameters is not relevant. ### 13.5. Inferred-only parameters Mojo allows parameter types to depend on other parameter types. For example, suppose we have two structs, Scheme and Location. We could define Location as a struct that takes a Scheme value as its input parameter, as in Location[scheme: Scheme]. This means that Location depends on Scheme. ```mojo struct Scheme: alias HTTP = Scheme("http") alias FTP = Scheme("ftp") var scheme: String fn __init__(inout self, scheme: String): self.scheme = scheme fn __str__(self) -> String: return self.scheme struct Location[scheme: Scheme]: var location: String fn __init__(inout self, location: String): self.location = location fn __str__(self) -> String: return str(scheme) + "://" + self.location ``` Suppose that we now define a function that uses Location. We now need to also declare Scheme parameter as otherwise the compiler does not know what the Location input parameter scheme means. ```mojo fn print_location[scheme: Scheme, location: Location[scheme]](): print(str(location)) ``` This has an unfortunate impact on the ergonomics of the usage of the function, as now the caller has to specify both the Scheme and Location with again the same Scheme value. This is an unnecessary duplication. ```mojo print_location[Scheme.FTP, Location[Scheme.FTP]("r.net")]() ``` Mojo provides a solution for this. Similar to declaration of positional-only and keyword-only function arguments, Mojo provides a syntax for "inferred-only" parameters using // as the delimiter. All the parameters that are expected to be inferred will appear before the // delimiter. Those parameters are not to be passed by the caller, instead they would be automatically inferred by the compiler based on their usage in the following parameters. ```mojo fn print_location2[scheme: Scheme, //, location: Location[scheme]](): print(str(location)) ``` Usage: ```mojo print_location2[Location[Scheme.FTP]("r.net")]() ``` Here we have to provide Scheme.FTP only once as the parameter scheme: Scheme will get automatically inferred. It is also possible to have just inferred-only parameters, while the inference is happening within the function arguments. ```mojo fn print_location3[scheme: Scheme, //](location: Location[scheme]): print(str(location)) ``` Usage: ```mojo print_location3(Location[Scheme.FTP]("r.net")) ``` ### 13.6. Variadic parameters Sometimes we want to be able to pass any number of parameters, without being restricted to a particular number of parameters. When we prefix a parameter with *, Mojo allows us to pass any number of values to it. The following is an example of positional variadic parameters: ```mojo fn add_all[*a: Int]() -> Int: var result: Int = 0 for i in VariadicList(a): result+= i return result ``` Usage: ```mojo print(add_all[1, 2, 3]()) ``` In the above example, we can see that at the function call site, we can pass any number of parameters since the function definition prefixes its parameter a with a *. The function definition then iterates over the a after wrapping it in a VariadicList and calculates the sum. ### 13.7. Default values in parameters Mojo allows default values to be used for parameters. ```mojo fn sub[cond: Bool = False](a: Int, b: Int) -> Int: return a + b if cond else 0 ``` Usage: ```mojo print(sub(3, 4)) # Default value is taken print(sub[True](3, 4)) # Override the default value ``` In the example, we have assigned a default value for parameter cond, which allow us to make the call to sub without passing any value to the parameter cond, effectively making the parameter cond an optional parameter. This makes for ergonomic APIs using sensible defaults wherever it is possible. ### 13.8. Parameters in structs, traits Similar to functions, we can also pass compile-time parameters to structs, traits. ```mojo struct MyStruct[T: Intable, cond: Bool]: var value: Int fn __init__(inout self, value: T): self.value = int(value) fn get_value(self) -> Int: return self.value if cond else 0 ``` Usage: ```mojo print(MyStruct[Int, True](10).get_value()) print(MyStruct[Float16, False](11.5).get_value()) ``` We can also have keyword parameters for structs, and traits. ```mojo print(MyStruct[cond=True, T=Float32](2.5).get_value()) ``` In the previous example, the parameters were passed and processed similar to how we did in functions. Basically, what we can do with parameters for functions, we can do the same for structs, and traits. ### 13.9. Custom compile-time checks When we develop a program, we often make assumptions about the arguments we receive or the context in which we execute a function and so on. We can use if statements to validate those assumptions, but it is possible that there is a performance cost to such validations. Many programming languages provide a facility known as assertion, to validate those assumptions with minimal impact to the runtime performance of the code. Mojo goes one step further by providing compile-time assertions with the function constrained. ```mojo fn print_times[times: Int](): constrained[times > 0, "times must be greater than zero"]() for i in range(times): print(i) fn main(): print_times[2]() print_times[0]() ``` If you try to compile the code listed above, you would get a compile time error, with the message: times must be greater than zero. This happens because in our function print_times we have an assertion using constrained function that checks that our compile-time parameter times is greater than zero. If we call the function with a value for times that is greater than zero, then the code compiles without any errors. However, if we pass a value that is less than or equal to zero, it will produce the same compile time error message as the one that is passed as the second parameter of the constrained function call. The constrained function is quite useful to validate our assumptions about given parameters at compile-time. If during the compile-time the constrained function executes successfully, then that piece of validation code does not even have to appear in the final binary, resulting in zero performance impact at runtime. ← Previous: Lifecycle and ownership | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Advanced usage of functions → ================================================================================ URL: https://ruhati.net/mojo/_advanced_usage_of_functions.html#_higher_order_functions # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions 14.1. Higher-order functions 14.2. Closure 14.3. Variadic function 14.4. Overloading - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading ## 14. Advanced usage of functions In previous chapters you saw how we declare types of variables and how we use them. In Mojo you can assign also a function to a variable. The type of the variable is determined by the function’s signature, i.e., it is a combination of the argument types and return type of the function. In the following code listing, you can see the variable my_fn_var is of type fn(Int, Int) → Int and is assigned a function with the same signature as the type of my_fn_var. Another thing to note is that the assigned function does not have the trailing () which is usual in a function call. This is because we are not calling the function adder, instead we are binding the function to the variable my_fn_var. In fact, we do not want to call adder at that point of time. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b ``` Usage: ```mojo var my_fn_var: fn(Int, Int) -> Int = adder print(my_fn_var(4, 3)) ``` In the example, we see that we defined a function adder and then assigned that function to a variable. We later execute that variable as if it is a function. ### 14.1. Higher-order functions The ability to assign a function to a variable allows us to implement some interesting use cases. We can pass a function as an argument to another function. We can also return a function as the result from another function. A function that can take a function as an argument, or can return a function as the result is called a higher-order function. There are some interesting uses of higher-order functions, such as the ability to define generic functions that takes any function as an argument and executes the given function based on some condition, or inside a loop, and so on. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b fn suber(a: Int, b: Int) -> Int: return a - b fn exec(x: Int, y: Int, bin_op: fn(Int, Int) -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec(10, 5, adder)) print(exec(10, 5, suber)) ``` In this code listing we see that the function exec is a higher-order function that takes another function as argument. The exec function executes the passed-in function within a loop to calculate a result. We can pass two different functions to the same exec function, and the exec will treat both the passed functions the same way. In this way we have built a generic function that does not need to know what the passed-in does, instead it just executes them and calculates results. Functions can also passed as parameters to another function. The main difference is that the functions are then passed at compile-time instead of at runtime. ```mojo fn diver(a: Int, b: Int) -> Float16: return a / b fn exec_param[bin_op: fn(Int, Int) -> Int](x: Int, y: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec_param[adder](10, 5)) print(exec_param[suber](10, 5)) ``` ### 14.2. Closure So far we have seen that we can pass arguments to functions and they would use those arguments within their body. There is another technique for functions to get values from outside of the function body, which is commonly known as closure. In a closure, we define a function that captures values outside of its function body. The values that are captured must be defined before the definition of the function itself. Another constraint is that the data type of the captured values must implement __copyinit__, as the value of the variable is copied over to the function. ```mojo fn exec_rt_closure(x: Int, bin_op_cl: fn(Int) escaping -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var rt_y: Int = 5 fn ander(x: Int) -> Int: return x & rt_y print(exec_rt_closure(12, ander)) ``` The closure shown above is known as a runtime closure. The type of the closure is fn() escaping → T. Note that the captured values are owned by the closure. Runtime closure can be passed as argument to other functions. However, the runtime closure cannot be passed as a parameter to other functions. In order to pass a closure as a parameter to other functions, we need to use a compile-time closure. Such closures are decorated by @parameter. The type of the closure is fn() capturing → T. The following example demonstrates such a compile-time closure. ```mojo fn exec_ct_closure[bin_op_cl: fn(Int) capturing -> Int](x: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var ct_y: Int = 10 @parameter fn multer(x: Int) -> Int: return x * ct_y print(exec_ct_closure[multer](10)) ``` ### 14.3. Variadic function You have already seen how the built-in print function is able to take any number of arguments. This is possible because of Mojo’s support for variadic functions. The variadic argument is prefixed by * for positional arguments and ** for keyword arguments. Data type of positional variadic argument is VariadicList[T] and of keyword variadic argument is Dict[K, V]. The following is an example of positional variadic arguments: ```mojo fn add_all(*a: Int) -> Int: var result: Int = 0 for i in a: result+= i return result ``` Usage of positional variadic arguments: ```mojo print(add_all(1, 2, 3, 4, 5)) ``` The following is an example of keyword variadic arguments: ```mojo fn names_dob(**namedobs: String) raises: for name in namedobs.keys(): print(name[], namedobs[name[]]) ``` Usage of keyword variadic arguments: ```mojo names_dob(ik="14/4/72", pk="15/5/81", ani="16/3/23", ad="22/6/17") ``` In the examples shown, the add_all has exactly one argument prefixed by *. The argument a is then iterated over and its elements extracted to calculate the sum. In case of the function names_dob, the argument namedobs is iterated over to print both the key name and the value associated with the key. Note that the key of the Dict is a Reference and therefore needs to be dereferenced. Variadic arguments makes it possible to provide easy-to-use APIs by allowing any number of arguments to be passed directly to the function instead of having to wrap them up in a list or dictionary. ### 14.4. Overloading There is a saying among programmers that naming is hard. For example, a function to add two numbers would be best called add. However, we may need to add two integers, one integer and a float, and so on. In some programming languages, that would have resulted in convoluted names such as add_ints, add_int_float and so on. Thankfully, Mojo provides a feature called function overloading. This feature allows us to define the same name to multiple functions as long as their argument types, parameter types or number of arguments are different. If two functions have the same argument types but have different result types, Mojo would complain as overloading is supported only for arguments and parameter types. The following is an example of overloading by different argument types: ```mojo fn add(a: Int, b:Int) -> Int: return a + b fn add(a: Int, b:Float16) -> Int: return int(a + b) ``` Usage of the overloaded functions: ```mojo print(add(1, 2)) print(add(3, 2.4)) ``` The following is an example of overloading by different parameter types: ```mojo fn add[a: Int, b:Int]() -> Int: return a + b fn add[a: Bool, b: Bool]() -> Int: var ai: Int = 1 if a else 0 var bi: Int = 1 if b else 0 return ai + bi ``` Usage of the overloaded functions: ```mojo print(add[Int(1), Int(2)]()) print(add[True, False]()) ``` The following is an example of overloading by different number of arguments, even with the same type of arguments: ```mojo fn sub(a: Int, b:Int) -> Int: return a - b fn sub(a: Int, b:Int, c:Int) -> Int: return a - b - c ``` Usage of the overloaded functions: ```mojo print(sub(1, 2)) print(sub(1, 2, 3)) ``` ← Previous: Parameters and compile-time programming | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Python interoperability → ================================================================================ URL: https://ruhati.net/mojo/_advanced_usage_of_functions.html#_closure # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions 14.1. Higher-order functions 14.2. Closure 14.3. Variadic function 14.4. Overloading - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading ## 14. Advanced usage of functions In previous chapters you saw how we declare types of variables and how we use them. In Mojo you can assign also a function to a variable. The type of the variable is determined by the function’s signature, i.e., it is a combination of the argument types and return type of the function. In the following code listing, you can see the variable my_fn_var is of type fn(Int, Int) → Int and is assigned a function with the same signature as the type of my_fn_var. Another thing to note is that the assigned function does not have the trailing () which is usual in a function call. This is because we are not calling the function adder, instead we are binding the function to the variable my_fn_var. In fact, we do not want to call adder at that point of time. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b ``` Usage: ```mojo var my_fn_var: fn(Int, Int) -> Int = adder print(my_fn_var(4, 3)) ``` In the example, we see that we defined a function adder and then assigned that function to a variable. We later execute that variable as if it is a function. ### 14.1. Higher-order functions The ability to assign a function to a variable allows us to implement some interesting use cases. We can pass a function as an argument to another function. We can also return a function as the result from another function. A function that can take a function as an argument, or can return a function as the result is called a higher-order function. There are some interesting uses of higher-order functions, such as the ability to define generic functions that takes any function as an argument and executes the given function based on some condition, or inside a loop, and so on. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b fn suber(a: Int, b: Int) -> Int: return a - b fn exec(x: Int, y: Int, bin_op: fn(Int, Int) -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec(10, 5, adder)) print(exec(10, 5, suber)) ``` In this code listing we see that the function exec is a higher-order function that takes another function as argument. The exec function executes the passed-in function within a loop to calculate a result. We can pass two different functions to the same exec function, and the exec will treat both the passed functions the same way. In this way we have built a generic function that does not need to know what the passed-in does, instead it just executes them and calculates results. Functions can also passed as parameters to another function. The main difference is that the functions are then passed at compile-time instead of at runtime. ```mojo fn diver(a: Int, b: Int) -> Float16: return a / b fn exec_param[bin_op: fn(Int, Int) -> Int](x: Int, y: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec_param[adder](10, 5)) print(exec_param[suber](10, 5)) ``` ### 14.2. Closure So far we have seen that we can pass arguments to functions and they would use those arguments within their body. There is another technique for functions to get values from outside of the function body, which is commonly known as closure. In a closure, we define a function that captures values outside of its function body. The values that are captured must be defined before the definition of the function itself. Another constraint is that the data type of the captured values must implement __copyinit__, as the value of the variable is copied over to the function. ```mojo fn exec_rt_closure(x: Int, bin_op_cl: fn(Int) escaping -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var rt_y: Int = 5 fn ander(x: Int) -> Int: return x & rt_y print(exec_rt_closure(12, ander)) ``` The closure shown above is known as a runtime closure. The type of the closure is fn() escaping → T. Note that the captured values are owned by the closure. Runtime closure can be passed as argument to other functions. However, the runtime closure cannot be passed as a parameter to other functions. In order to pass a closure as a parameter to other functions, we need to use a compile-time closure. Such closures are decorated by @parameter. The type of the closure is fn() capturing → T. The following example demonstrates such a compile-time closure. ```mojo fn exec_ct_closure[bin_op_cl: fn(Int) capturing -> Int](x: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var ct_y: Int = 10 @parameter fn multer(x: Int) -> Int: return x * ct_y print(exec_ct_closure[multer](10)) ``` ### 14.3. Variadic function You have already seen how the built-in print function is able to take any number of arguments. This is possible because of Mojo’s support for variadic functions. The variadic argument is prefixed by * for positional arguments and ** for keyword arguments. Data type of positional variadic argument is VariadicList[T] and of keyword variadic argument is Dict[K, V]. The following is an example of positional variadic arguments: ```mojo fn add_all(*a: Int) -> Int: var result: Int = 0 for i in a: result+= i return result ``` Usage of positional variadic arguments: ```mojo print(add_all(1, 2, 3, 4, 5)) ``` The following is an example of keyword variadic arguments: ```mojo fn names_dob(**namedobs: String) raises: for name in namedobs.keys(): print(name[], namedobs[name[]]) ``` Usage of keyword variadic arguments: ```mojo names_dob(ik="14/4/72", pk="15/5/81", ani="16/3/23", ad="22/6/17") ``` In the examples shown, the add_all has exactly one argument prefixed by *. The argument a is then iterated over and its elements extracted to calculate the sum. In case of the function names_dob, the argument namedobs is iterated over to print both the key name and the value associated with the key. Note that the key of the Dict is a Reference and therefore needs to be dereferenced. Variadic arguments makes it possible to provide easy-to-use APIs by allowing any number of arguments to be passed directly to the function instead of having to wrap them up in a list or dictionary. ### 14.4. Overloading There is a saying among programmers that naming is hard. For example, a function to add two numbers would be best called add. However, we may need to add two integers, one integer and a float, and so on. In some programming languages, that would have resulted in convoluted names such as add_ints, add_int_float and so on. Thankfully, Mojo provides a feature called function overloading. This feature allows us to define the same name to multiple functions as long as their argument types, parameter types or number of arguments are different. If two functions have the same argument types but have different result types, Mojo would complain as overloading is supported only for arguments and parameter types. The following is an example of overloading by different argument types: ```mojo fn add(a: Int, b:Int) -> Int: return a + b fn add(a: Int, b:Float16) -> Int: return int(a + b) ``` Usage of the overloaded functions: ```mojo print(add(1, 2)) print(add(3, 2.4)) ``` The following is an example of overloading by different parameter types: ```mojo fn add[a: Int, b:Int]() -> Int: return a + b fn add[a: Bool, b: Bool]() -> Int: var ai: Int = 1 if a else 0 var bi: Int = 1 if b else 0 return ai + bi ``` Usage of the overloaded functions: ```mojo print(add[Int(1), Int(2)]()) print(add[True, False]()) ``` The following is an example of overloading by different number of arguments, even with the same type of arguments: ```mojo fn sub(a: Int, b:Int) -> Int: return a - b fn sub(a: Int, b:Int, c:Int) -> Int: return a - b - c ``` Usage of the overloaded functions: ```mojo print(sub(1, 2)) print(sub(1, 2, 3)) ``` ← Previous: Parameters and compile-time programming | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Python interoperability → ================================================================================ URL: https://ruhati.net/mojo/_advanced_usage_of_functions.html#_variadic_function # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions 14.1. Higher-order functions 14.2. Closure 14.3. Variadic function 14.4. Overloading - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading ## 14. Advanced usage of functions In previous chapters you saw how we declare types of variables and how we use them. In Mojo you can assign also a function to a variable. The type of the variable is determined by the function’s signature, i.e., it is a combination of the argument types and return type of the function. In the following code listing, you can see the variable my_fn_var is of type fn(Int, Int) → Int and is assigned a function with the same signature as the type of my_fn_var. Another thing to note is that the assigned function does not have the trailing () which is usual in a function call. This is because we are not calling the function adder, instead we are binding the function to the variable my_fn_var. In fact, we do not want to call adder at that point of time. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b ``` Usage: ```mojo var my_fn_var: fn(Int, Int) -> Int = adder print(my_fn_var(4, 3)) ``` In the example, we see that we defined a function adder and then assigned that function to a variable. We later execute that variable as if it is a function. ### 14.1. Higher-order functions The ability to assign a function to a variable allows us to implement some interesting use cases. We can pass a function as an argument to another function. We can also return a function as the result from another function. A function that can take a function as an argument, or can return a function as the result is called a higher-order function. There are some interesting uses of higher-order functions, such as the ability to define generic functions that takes any function as an argument and executes the given function based on some condition, or inside a loop, and so on. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b fn suber(a: Int, b: Int) -> Int: return a - b fn exec(x: Int, y: Int, bin_op: fn(Int, Int) -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec(10, 5, adder)) print(exec(10, 5, suber)) ``` In this code listing we see that the function exec is a higher-order function that takes another function as argument. The exec function executes the passed-in function within a loop to calculate a result. We can pass two different functions to the same exec function, and the exec will treat both the passed functions the same way. In this way we have built a generic function that does not need to know what the passed-in does, instead it just executes them and calculates results. Functions can also passed as parameters to another function. The main difference is that the functions are then passed at compile-time instead of at runtime. ```mojo fn diver(a: Int, b: Int) -> Float16: return a / b fn exec_param[bin_op: fn(Int, Int) -> Int](x: Int, y: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec_param[adder](10, 5)) print(exec_param[suber](10, 5)) ``` ### 14.2. Closure So far we have seen that we can pass arguments to functions and they would use those arguments within their body. There is another technique for functions to get values from outside of the function body, which is commonly known as closure. In a closure, we define a function that captures values outside of its function body. The values that are captured must be defined before the definition of the function itself. Another constraint is that the data type of the captured values must implement __copyinit__, as the value of the variable is copied over to the function. ```mojo fn exec_rt_closure(x: Int, bin_op_cl: fn(Int) escaping -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var rt_y: Int = 5 fn ander(x: Int) -> Int: return x & rt_y print(exec_rt_closure(12, ander)) ``` The closure shown above is known as a runtime closure. The type of the closure is fn() escaping → T. Note that the captured values are owned by the closure. Runtime closure can be passed as argument to other functions. However, the runtime closure cannot be passed as a parameter to other functions. In order to pass a closure as a parameter to other functions, we need to use a compile-time closure. Such closures are decorated by @parameter. The type of the closure is fn() capturing → T. The following example demonstrates such a compile-time closure. ```mojo fn exec_ct_closure[bin_op_cl: fn(Int) capturing -> Int](x: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var ct_y: Int = 10 @parameter fn multer(x: Int) -> Int: return x * ct_y print(exec_ct_closure[multer](10)) ``` ### 14.3. Variadic function You have already seen how the built-in print function is able to take any number of arguments. This is possible because of Mojo’s support for variadic functions. The variadic argument is prefixed by * for positional arguments and ** for keyword arguments. Data type of positional variadic argument is VariadicList[T] and of keyword variadic argument is Dict[K, V]. The following is an example of positional variadic arguments: ```mojo fn add_all(*a: Int) -> Int: var result: Int = 0 for i in a: result+= i return result ``` Usage of positional variadic arguments: ```mojo print(add_all(1, 2, 3, 4, 5)) ``` The following is an example of keyword variadic arguments: ```mojo fn names_dob(**namedobs: String) raises: for name in namedobs.keys(): print(name[], namedobs[name[]]) ``` Usage of keyword variadic arguments: ```mojo names_dob(ik="14/4/72", pk="15/5/81", ani="16/3/23", ad="22/6/17") ``` In the examples shown, the add_all has exactly one argument prefixed by *. The argument a is then iterated over and its elements extracted to calculate the sum. In case of the function names_dob, the argument namedobs is iterated over to print both the key name and the value associated with the key. Note that the key of the Dict is a Reference and therefore needs to be dereferenced. Variadic arguments makes it possible to provide easy-to-use APIs by allowing any number of arguments to be passed directly to the function instead of having to wrap them up in a list or dictionary. ### 14.4. Overloading There is a saying among programmers that naming is hard. For example, a function to add two numbers would be best called add. However, we may need to add two integers, one integer and a float, and so on. In some programming languages, that would have resulted in convoluted names such as add_ints, add_int_float and so on. Thankfully, Mojo provides a feature called function overloading. This feature allows us to define the same name to multiple functions as long as their argument types, parameter types or number of arguments are different. If two functions have the same argument types but have different result types, Mojo would complain as overloading is supported only for arguments and parameter types. The following is an example of overloading by different argument types: ```mojo fn add(a: Int, b:Int) -> Int: return a + b fn add(a: Int, b:Float16) -> Int: return int(a + b) ``` Usage of the overloaded functions: ```mojo print(add(1, 2)) print(add(3, 2.4)) ``` The following is an example of overloading by different parameter types: ```mojo fn add[a: Int, b:Int]() -> Int: return a + b fn add[a: Bool, b: Bool]() -> Int: var ai: Int = 1 if a else 0 var bi: Int = 1 if b else 0 return ai + bi ``` Usage of the overloaded functions: ```mojo print(add[Int(1), Int(2)]()) print(add[True, False]()) ``` The following is an example of overloading by different number of arguments, even with the same type of arguments: ```mojo fn sub(a: Int, b:Int) -> Int: return a - b fn sub(a: Int, b:Int, c:Int) -> Int: return a - b - c ``` Usage of the overloaded functions: ```mojo print(sub(1, 2)) print(sub(1, 2, 3)) ``` ← Previous: Parameters and compile-time programming | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Python interoperability → ================================================================================ URL: https://ruhati.net/mojo/_advanced_usage_of_functions.html#_overloading # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions 14.1. Higher-order functions 14.2. Closure 14.3. Variadic function 14.4. Overloading - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading - 15. Python interoperability - 16. MLIR interoperability - About the author - Revision History - 14.1. Higher-order functions - 14.2. Closure - 14.3. Variadic function - 14.4. Overloading ## 14. Advanced usage of functions In previous chapters you saw how we declare types of variables and how we use them. In Mojo you can assign also a function to a variable. The type of the variable is determined by the function’s signature, i.e., it is a combination of the argument types and return type of the function. In the following code listing, you can see the variable my_fn_var is of type fn(Int, Int) → Int and is assigned a function with the same signature as the type of my_fn_var. Another thing to note is that the assigned function does not have the trailing () which is usual in a function call. This is because we are not calling the function adder, instead we are binding the function to the variable my_fn_var. In fact, we do not want to call adder at that point of time. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b ``` Usage: ```mojo var my_fn_var: fn(Int, Int) -> Int = adder print(my_fn_var(4, 3)) ``` In the example, we see that we defined a function adder and then assigned that function to a variable. We later execute that variable as if it is a function. ### 14.1. Higher-order functions The ability to assign a function to a variable allows us to implement some interesting use cases. We can pass a function as an argument to another function. We can also return a function as the result from another function. A function that can take a function as an argument, or can return a function as the result is called a higher-order function. There are some interesting uses of higher-order functions, such as the ability to define generic functions that takes any function as an argument and executes the given function based on some condition, or inside a loop, and so on. ```mojo fn adder(a: Int, b: Int) -> Int: return a + b fn suber(a: Int, b: Int) -> Int: return a - b fn exec(x: Int, y: Int, bin_op: fn(Int, Int) -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec(10, 5, adder)) print(exec(10, 5, suber)) ``` In this code listing we see that the function exec is a higher-order function that takes another function as argument. The exec function executes the passed-in function within a loop to calculate a result. We can pass two different functions to the same exec function, and the exec will treat both the passed functions the same way. In this way we have built a generic function that does not need to know what the passed-in does, instead it just executes them and calculates results. Functions can also passed as parameters to another function. The main difference is that the functions are then passed at compile-time instead of at runtime. ```mojo fn diver(a: Int, b: Int) -> Float16: return a / b fn exec_param[bin_op: fn(Int, Int) -> Int](x: Int, y: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op(x, y) return result ``` Usage: ```mojo print(exec_param[adder](10, 5)) print(exec_param[suber](10, 5)) ``` ### 14.2. Closure So far we have seen that we can pass arguments to functions and they would use those arguments within their body. There is another technique for functions to get values from outside of the function body, which is commonly known as closure. In a closure, we define a function that captures values outside of its function body. The values that are captured must be defined before the definition of the function itself. Another constraint is that the data type of the captured values must implement __copyinit__, as the value of the variable is copied over to the function. ```mojo fn exec_rt_closure(x: Int, bin_op_cl: fn(Int) escaping -> Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var rt_y: Int = 5 fn ander(x: Int) -> Int: return x & rt_y print(exec_rt_closure(12, ander)) ``` The closure shown above is known as a runtime closure. The type of the closure is fn() escaping → T. Note that the captured values are owned by the closure. Runtime closure can be passed as argument to other functions. However, the runtime closure cannot be passed as a parameter to other functions. In order to pass a closure as a parameter to other functions, we need to use a compile-time closure. Such closures are decorated by @parameter. The type of the closure is fn() capturing → T. The following example demonstrates such a compile-time closure. ```mojo fn exec_ct_closure[bin_op_cl: fn(Int) capturing -> Int](x: Int) -> Int: var result: Int = 0 for i in range(10): result += bin_op_cl(x) return result ``` Usage: ```mojo var ct_y: Int = 10 @parameter fn multer(x: Int) -> Int: return x * ct_y print(exec_ct_closure[multer](10)) ``` ### 14.3. Variadic function You have already seen how the built-in print function is able to take any number of arguments. This is possible because of Mojo’s support for variadic functions. The variadic argument is prefixed by * for positional arguments and ** for keyword arguments. Data type of positional variadic argument is VariadicList[T] and of keyword variadic argument is Dict[K, V]. The following is an example of positional variadic arguments: ```mojo fn add_all(*a: Int) -> Int: var result: Int = 0 for i in a: result+= i return result ``` Usage of positional variadic arguments: ```mojo print(add_all(1, 2, 3, 4, 5)) ``` The following is an example of keyword variadic arguments: ```mojo fn names_dob(**namedobs: String) raises: for name in namedobs.keys(): print(name[], namedobs[name[]]) ``` Usage of keyword variadic arguments: ```mojo names_dob(ik="14/4/72", pk="15/5/81", ani="16/3/23", ad="22/6/17") ``` In the examples shown, the add_all has exactly one argument prefixed by *. The argument a is then iterated over and its elements extracted to calculate the sum. In case of the function names_dob, the argument namedobs is iterated over to print both the key name and the value associated with the key. Note that the key of the Dict is a Reference and therefore needs to be dereferenced. Variadic arguments makes it possible to provide easy-to-use APIs by allowing any number of arguments to be passed directly to the function instead of having to wrap them up in a list or dictionary. ### 14.4. Overloading There is a saying among programmers that naming is hard. For example, a function to add two numbers would be best called add. However, we may need to add two integers, one integer and a float, and so on. In some programming languages, that would have resulted in convoluted names such as add_ints, add_int_float and so on. Thankfully, Mojo provides a feature called function overloading. This feature allows us to define the same name to multiple functions as long as their argument types, parameter types or number of arguments are different. If two functions have the same argument types but have different result types, Mojo would complain as overloading is supported only for arguments and parameter types. The following is an example of overloading by different argument types: ```mojo fn add(a: Int, b:Int) -> Int: return a + b fn add(a: Int, b:Float16) -> Int: return int(a + b) ``` Usage of the overloaded functions: ```mojo print(add(1, 2)) print(add(3, 2.4)) ``` The following is an example of overloading by different parameter types: ```mojo fn add[a: Int, b:Int]() -> Int: return a + b fn add[a: Bool, b: Bool]() -> Int: var ai: Int = 1 if a else 0 var bi: Int = 1 if b else 0 return ai + bi ``` Usage of the overloaded functions: ```mojo print(add[Int(1), Int(2)]()) print(add[True, False]()) ``` The following is an example of overloading by different number of arguments, even with the same type of arguments: ```mojo fn sub(a: Int, b:Int) -> Int: return a - b fn sub(a: Int, b:Int, c:Int) -> Int: return a - b - c ``` Usage of the overloaded functions: ```mojo print(sub(1, 2)) print(sub(1, 2, 3)) ``` ← Previous: Parameters and compile-time programming | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: Python interoperability → ================================================================================ URL: https://ruhati.net/mojo/_python_interoperability.html#_importing_a_python_module # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability 15.1. Importing a Python module 15.2. Evaluating Python expressions 15.3. Other useful Python functions - 15.1. Importing a Python module - 15.2. Evaluating Python expressions - 15.3. Other useful Python functions - 16. MLIR interoperability - About the author - Revision History - 15.1. Importing a Python module - 15.2. Evaluating Python expressions - 15.3. Other useful Python functions ## 15. Python interoperability As mentioned in the beginning of this book, Mojo is a superset of Python. However, Mojo and Python are semantically two completely different languages, though they share the same syntax. Python has a huge ecosystem behind it, built over many decades. Mojo allows the developer to leverage this huge ecosystem, with its Python integration capability. The integration of Mojo with Python is built on a key insight that from a practical point of view, all Python objects can be represented with a single type. In Mojo it is represented by the PythonObject struct. Mojo uses the actual CPython interpreter for interoperability. The usage of CPython in Mojo enables high fidelity integration with Python, and ensures that the Python objects behave as expected. ### 15.1. Importing a Python module Mojo has module named python that encapsulates all of the Python integration. Within the python module, there is the facade object that provides the entry point for many of the Python integration capabilities. Importing a Python module is as simple as using the Python.import_module method call, passing it the module name. In case a module does not exist, ensure that the module is installed using the pip or equivalent command. Mojo also supports Python virtual environments. The following code listing provides an example on how to import Python modules and how to use objects from Python. ```mojo from python import Python var difflib = Python.import_module("difflib") var list1 = ["One", "Two", "Three", "Four"] var list2 = ["One", "Two", "Three"] var differ = difflib.HtmlDiff() # Get instance of HtmlDiff class. var diff = differ.make_file(list1, list2) print(diff) ``` ### 15.2. Evaluating Python expressions You can evaluate Python expressions using Python.evaluate method. ```mojo print(Python.evaluate("1+2")) ``` Since Python treats functions as first class, you can even use Python.evaluate to access Python’s built-in functions. ```mojo var str_fn = Python.evaluate("str") print(str_fn("ABC") <= str_fn("XYZ")) ``` Note in the above code listing, how transparently we can transfer Mojo string literals to the Python function, and how seamlessly Mojo operators work over Python objects, invoking the right Python dunder methods. One important constraint is that only PythonObject struct can be passed to and from Python. In the case of Mojo string literals, PythonObject has a constructor that takes StringLiteral, resulting in implicit conversion from StringLiteral to a PythonObject instance. PythonObject has many such constructors for the various Mojo built-in types. PythonObject also implements many traits that enable it to be used within functions such as len, int, str and so on. ### 15.3. Other useful Python functions You can use native Python objects like list and dict using corresponding static methods exposed by Python. Python also exposes type function from Python and can be used to determine the underlying type of the PythonObject struct. ```mojo var a_list = Python.list() a_list.append("First element") a_list.append("Second element") print(a_list) print(Python.type(a_list)) ``` ← Previous: Advanced usage of functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: MLIR interoperability → ================================================================================ URL: https://ruhati.net/mojo/_python_interoperability.html#_evaluating_python_expressions # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability 15.1. Importing a Python module 15.2. Evaluating Python expressions 15.3. Other useful Python functions - 15.1. Importing a Python module - 15.2. Evaluating Python expressions - 15.3. Other useful Python functions - 16. MLIR interoperability - About the author - Revision History - 15.1. Importing a Python module - 15.2. Evaluating Python expressions - 15.3. Other useful Python functions ## 15. Python interoperability As mentioned in the beginning of this book, Mojo is a superset of Python. However, Mojo and Python are semantically two completely different languages, though they share the same syntax. Python has a huge ecosystem behind it, built over many decades. Mojo allows the developer to leverage this huge ecosystem, with its Python integration capability. The integration of Mojo with Python is built on a key insight that from a practical point of view, all Python objects can be represented with a single type. In Mojo it is represented by the PythonObject struct. Mojo uses the actual CPython interpreter for interoperability. The usage of CPython in Mojo enables high fidelity integration with Python, and ensures that the Python objects behave as expected. ### 15.1. Importing a Python module Mojo has module named python that encapsulates all of the Python integration. Within the python module, there is the facade object that provides the entry point for many of the Python integration capabilities. Importing a Python module is as simple as using the Python.import_module method call, passing it the module name. In case a module does not exist, ensure that the module is installed using the pip or equivalent command. Mojo also supports Python virtual environments. The following code listing provides an example on how to import Python modules and how to use objects from Python. ```mojo from python import Python var difflib = Python.import_module("difflib") var list1 = ["One", "Two", "Three", "Four"] var list2 = ["One", "Two", "Three"] var differ = difflib.HtmlDiff() # Get instance of HtmlDiff class. var diff = differ.make_file(list1, list2) print(diff) ``` ### 15.2. Evaluating Python expressions You can evaluate Python expressions using Python.evaluate method. ```mojo print(Python.evaluate("1+2")) ``` Since Python treats functions as first class, you can even use Python.evaluate to access Python’s built-in functions. ```mojo var str_fn = Python.evaluate("str") print(str_fn("ABC") <= str_fn("XYZ")) ``` Note in the above code listing, how transparently we can transfer Mojo string literals to the Python function, and how seamlessly Mojo operators work over Python objects, invoking the right Python dunder methods. One important constraint is that only PythonObject struct can be passed to and from Python. In the case of Mojo string literals, PythonObject has a constructor that takes StringLiteral, resulting in implicit conversion from StringLiteral to a PythonObject instance. PythonObject has many such constructors for the various Mojo built-in types. PythonObject also implements many traits that enable it to be used within functions such as len, int, str and so on. ### 15.3. Other useful Python functions You can use native Python objects like list and dict using corresponding static methods exposed by Python. Python also exposes type function from Python and can be used to determine the underlying type of the PythonObject struct. ```mojo var a_list = Python.list() a_list.append("First element") a_list.append("Second element") print(a_list) print(Python.type(a_list)) ``` ← Previous: Advanced usage of functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: MLIR interoperability → ================================================================================ URL: https://ruhati.net/mojo/_python_interoperability.html#_other_useful_python_functions # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability 15.1. Importing a Python module 15.2. Evaluating Python expressions 15.3. Other useful Python functions - 15.1. Importing a Python module - 15.2. Evaluating Python expressions - 15.3. Other useful Python functions - 16. MLIR interoperability - About the author - Revision History - 15.1. Importing a Python module - 15.2. Evaluating Python expressions - 15.3. Other useful Python functions ## 15. Python interoperability As mentioned in the beginning of this book, Mojo is a superset of Python. However, Mojo and Python are semantically two completely different languages, though they share the same syntax. Python has a huge ecosystem behind it, built over many decades. Mojo allows the developer to leverage this huge ecosystem, with its Python integration capability. The integration of Mojo with Python is built on a key insight that from a practical point of view, all Python objects can be represented with a single type. In Mojo it is represented by the PythonObject struct. Mojo uses the actual CPython interpreter for interoperability. The usage of CPython in Mojo enables high fidelity integration with Python, and ensures that the Python objects behave as expected. ### 15.1. Importing a Python module Mojo has module named python that encapsulates all of the Python integration. Within the python module, there is the facade object that provides the entry point for many of the Python integration capabilities. Importing a Python module is as simple as using the Python.import_module method call, passing it the module name. In case a module does not exist, ensure that the module is installed using the pip or equivalent command. Mojo also supports Python virtual environments. The following code listing provides an example on how to import Python modules and how to use objects from Python. ```mojo from python import Python var difflib = Python.import_module("difflib") var list1 = ["One", "Two", "Three", "Four"] var list2 = ["One", "Two", "Three"] var differ = difflib.HtmlDiff() # Get instance of HtmlDiff class. var diff = differ.make_file(list1, list2) print(diff) ``` ### 15.2. Evaluating Python expressions You can evaluate Python expressions using Python.evaluate method. ```mojo print(Python.evaluate("1+2")) ``` Since Python treats functions as first class, you can even use Python.evaluate to access Python’s built-in functions. ```mojo var str_fn = Python.evaluate("str") print(str_fn("ABC") <= str_fn("XYZ")) ``` Note in the above code listing, how transparently we can transfer Mojo string literals to the Python function, and how seamlessly Mojo operators work over Python objects, invoking the right Python dunder methods. One important constraint is that only PythonObject struct can be passed to and from Python. In the case of Mojo string literals, PythonObject has a constructor that takes StringLiteral, resulting in implicit conversion from StringLiteral to a PythonObject instance. PythonObject has many such constructors for the various Mojo built-in types. PythonObject also implements many traits that enable it to be used within functions such as len, int, str and so on. ### 15.3. Other useful Python functions You can use native Python objects like list and dict using corresponding static methods exposed by Python. Python also exposes type function from Python and can be used to determine the underlying type of the PythonObject struct. ```mojo var a_list = Python.list() a_list.append("First element") a_list.append("Second element") print(a_list) print(Python.type(a_list)) ``` ← Previous: Advanced usage of functions | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: MLIR interoperability → ================================================================================ URL: https://ruhati.net/mojo/_mlir_interoperability.html#_mlir_attr # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability 16.1. __mlir_attr 16.2. __mlir_type 16.3. __mlir_op - 16.1. __mlir_attr - 16.2. __mlir_type - 16.3. __mlir_op - About the author - Revision History - 16.1. __mlir_attr - 16.2. __mlir_type - 16.3. __mlir_op ## 16. MLIR interoperability Mojo supports ahead-of-time compilation. This means that we can run Mojo compiler over our source code to generate the machine code that gets executed on the computer. For a developer it may look as if Mojo reads the source code and directly generates the machine code. However, like many modern compilers, Mojo creates an intermediate representation of our source code before it generates the machine code. This intermediate representation (IR) is a simplified form of the program, which is easier to optimize and reason about. Many compilers use IRs that are custom built for the language supported by the compiler. Mojo does not have its own IR infrastructure, instead it uses Multi-Level Intermediate Representation (MLIR). Unlike other language IRs, MLIR is designed to be extensible and is capable of supporting many programming languages and different types of processors. The extensibility of MLIR revolves around the ability to define custom dialects and operations within it. Dialects can be thought of as a namespace for a set of operations representing a particular aspect of a program. Operations represent a computation or a level of abstraction. Operations take operands (think of them as arguments) and produces results. Operations also take attributes, which are compile-time values such as constants. Attributes, operands and results have types associated with them. There is much more to MLIR than described here, but it is out of scope of this book. Though MLIR comes with its own textual representation that is used by the MLIR compiler infrastructure, Mojo exposes MLIR elements through its own syntax. The following code listing shows an example where MLIR types, attributes and operations are being used. ```mojo alias _0 = __mlir_attr.`0:i1` alias _1 = __mlir_attr.`1:i1` struct BitList(Stringable): var value: List[__mlir_type.i1] fn __init__(inout self, *values: __mlir_type.i1): self.value = List[__mlir_type.i1]() for i in values: self.value.append(i) fn __str__(self) -> String: var s = String("0b") for i in self.value: s += String(Int(__mlir_op.`index.castu`[_type=__mlir_type.index](i[]))) return s fn main(): print(BitList(_0, _1, _0, _1)) ``` At first, the code listing may look a bit strange. Mojo’s MLIR elements start with __mlir. There are three different elements: __mlir_attr, __mlir_type and __mlir_op. ### 16.1. __mlir_attr As the name suggests, __mlir_attr provides ability to define a MLIR attribute (similar to a compile-time constant) along with its data type. ```mojo alias _0 = __mlir_attr.`0:i1` ``` Here we are declaring an alias with an MLIR constant value 0 of MLIR type i1. If we do not provide i1, it will be assumed to be i64. ### 16.2. __mlir_type The __mlir_type provides ability to refer to a given MLIR type. ```mojo var value: List[__mlir_type.i1] ``` Here we are declaring a list with contents of type i1. ### 16.3. __mlir_op The __mlir_op provides ability to refer to a MLIR operation. ```mojo s += String(Int(__mlir_op.`index.castu`[_type=__mlir_type.index](i[]))) ``` Here we are executing a casting operation from i1 to index type. Since Mojo’s Int type has a constructor that takes in MLIR index type, we are able to instantiate an Int value. Note that MLIR operation has the form <dialect>.<op>. Since MOJO does not allow its identifiers to have . in the name, we have to use backticks `` to be able to use a non-standard identifier. The following diagram shows roughly how MLIR textual format maps to the Mojo source code representation. ← Previous: Python interoperability | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: About the author → ================================================================================ URL: https://ruhati.net/mojo/_mlir_interoperability.html#_mlir_type # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability 16.1. __mlir_attr 16.2. __mlir_type 16.3. __mlir_op - 16.1. __mlir_attr - 16.2. __mlir_type - 16.3. __mlir_op - About the author - Revision History - 16.1. __mlir_attr - 16.2. __mlir_type - 16.3. __mlir_op ## 16. MLIR interoperability Mojo supports ahead-of-time compilation. This means that we can run Mojo compiler over our source code to generate the machine code that gets executed on the computer. For a developer it may look as if Mojo reads the source code and directly generates the machine code. However, like many modern compilers, Mojo creates an intermediate representation of our source code before it generates the machine code. This intermediate representation (IR) is a simplified form of the program, which is easier to optimize and reason about. Many compilers use IRs that are custom built for the language supported by the compiler. Mojo does not have its own IR infrastructure, instead it uses Multi-Level Intermediate Representation (MLIR). Unlike other language IRs, MLIR is designed to be extensible and is capable of supporting many programming languages and different types of processors. The extensibility of MLIR revolves around the ability to define custom dialects and operations within it. Dialects can be thought of as a namespace for a set of operations representing a particular aspect of a program. Operations represent a computation or a level of abstraction. Operations take operands (think of them as arguments) and produces results. Operations also take attributes, which are compile-time values such as constants. Attributes, operands and results have types associated with them. There is much more to MLIR than described here, but it is out of scope of this book. Though MLIR comes with its own textual representation that is used by the MLIR compiler infrastructure, Mojo exposes MLIR elements through its own syntax. The following code listing shows an example where MLIR types, attributes and operations are being used. ```mojo alias _0 = __mlir_attr.`0:i1` alias _1 = __mlir_attr.`1:i1` struct BitList(Stringable): var value: List[__mlir_type.i1] fn __init__(inout self, *values: __mlir_type.i1): self.value = List[__mlir_type.i1]() for i in values: self.value.append(i) fn __str__(self) -> String: var s = String("0b") for i in self.value: s += String(Int(__mlir_op.`index.castu`[_type=__mlir_type.index](i[]))) return s fn main(): print(BitList(_0, _1, _0, _1)) ``` At first, the code listing may look a bit strange. Mojo’s MLIR elements start with __mlir. There are three different elements: __mlir_attr, __mlir_type and __mlir_op. ### 16.1. __mlir_attr As the name suggests, __mlir_attr provides ability to define a MLIR attribute (similar to a compile-time constant) along with its data type. ```mojo alias _0 = __mlir_attr.`0:i1` ``` Here we are declaring an alias with an MLIR constant value 0 of MLIR type i1. If we do not provide i1, it will be assumed to be i64. ### 16.2. __mlir_type The __mlir_type provides ability to refer to a given MLIR type. ```mojo var value: List[__mlir_type.i1] ``` Here we are declaring a list with contents of type i1. ### 16.3. __mlir_op The __mlir_op provides ability to refer to a MLIR operation. ```mojo s += String(Int(__mlir_op.`index.castu`[_type=__mlir_type.index](i[]))) ``` Here we are executing a casting operation from i1 to index type. Since Mojo’s Int type has a constructor that takes in MLIR index type, we are able to instantiate an Int value. Note that MLIR operation has the form <dialect>.<op>. Since MOJO does not allow its identifiers to have . in the name, we have to use backticks `` to be able to use a non-standard identifier. The following diagram shows roughly how MLIR textual format maps to the Mojo source code representation. ← Previous: Python interoperability | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: About the author → ================================================================================ URL: https://ruhati.net/mojo/_mlir_interoperability.html#_mlir_op # Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language - Dedication - 1. Introduction - 2. Getting started - 3. Functions - 4. Constants and variables - 5. Types - 6. Documenting your code - 7. Struct - 8. Trait - 9. Control flow - 10. Error handling - 11. Operators and special methods - 12. Lifecycle and ownership - 13. Parameters and compile-time programming - 14. Advanced usage of functions - 15. Python interoperability - 16. MLIR interoperability 16.1. __mlir_attr 16.2. __mlir_type 16.3. __mlir_op - 16.1. __mlir_attr - 16.2. __mlir_type - 16.3. __mlir_op - About the author - Revision History - 16.1. __mlir_attr - 16.2. __mlir_type - 16.3. __mlir_op ## 16. MLIR interoperability Mojo supports ahead-of-time compilation. This means that we can run Mojo compiler over our source code to generate the machine code that gets executed on the computer. For a developer it may look as if Mojo reads the source code and directly generates the machine code. However, like many modern compilers, Mojo creates an intermediate representation of our source code before it generates the machine code. This intermediate representation (IR) is a simplified form of the program, which is easier to optimize and reason about. Many compilers use IRs that are custom built for the language supported by the compiler. Mojo does not have its own IR infrastructure, instead it uses Multi-Level Intermediate Representation (MLIR). Unlike other language IRs, MLIR is designed to be extensible and is capable of supporting many programming languages and different types of processors. The extensibility of MLIR revolves around the ability to define custom dialects and operations within it. Dialects can be thought of as a namespace for a set of operations representing a particular aspect of a program. Operations represent a computation or a level of abstraction. Operations take operands (think of them as arguments) and produces results. Operations also take attributes, which are compile-time values such as constants. Attributes, operands and results have types associated with them. There is much more to MLIR than described here, but it is out of scope of this book. Though MLIR comes with its own textual representation that is used by the MLIR compiler infrastructure, Mojo exposes MLIR elements through its own syntax. The following code listing shows an example where MLIR types, attributes and operations are being used. ```mojo alias _0 = __mlir_attr.`0:i1` alias _1 = __mlir_attr.`1:i1` struct BitList(Stringable): var value: List[__mlir_type.i1] fn __init__(inout self, *values: __mlir_type.i1): self.value = List[__mlir_type.i1]() for i in values: self.value.append(i) fn __str__(self) -> String: var s = String("0b") for i in self.value: s += String(Int(__mlir_op.`index.castu`[_type=__mlir_type.index](i[]))) return s fn main(): print(BitList(_0, _1, _0, _1)) ``` At first, the code listing may look a bit strange. Mojo’s MLIR elements start with __mlir. There are three different elements: __mlir_attr, __mlir_type and __mlir_op. ### 16.1. __mlir_attr As the name suggests, __mlir_attr provides ability to define a MLIR attribute (similar to a compile-time constant) along with its data type. ```mojo alias _0 = __mlir_attr.`0:i1` ``` Here we are declaring an alias with an MLIR constant value 0 of MLIR type i1. If we do not provide i1, it will be assumed to be i64. ### 16.2. __mlir_type The __mlir_type provides ability to refer to a given MLIR type. ```mojo var value: List[__mlir_type.i1] ``` Here we are declaring a list with contents of type i1. ### 16.3. __mlir_op The __mlir_op provides ability to refer to a MLIR operation. ```mojo s += String(Int(__mlir_op.`index.castu`[_type=__mlir_type.index](i[]))) ``` Here we are executing a casting operation from i1 to index type. Since Mojo’s Int type has a constructor that takes in MLIR index type, we are able to instantiate an Int value. Note that MLIR operation has the form <dialect>.<op>. Since MOJO does not allow its identifiers to have . in the name, we have to use backticks `` to be able to use a non-standard identifier. The following diagram shows roughly how MLIR textual format maps to the Mojo source code representation. ← Previous: Python interoperability | ↑ Up: Mojo By Example: A Comprehensive Introduction to the Mojo Programming Language | Next: About the author → ================================================================================ --- beta_bug_report.yaml.txt --- name: Beta Bug report description: Create a bug report for the beta program to help us improve Mojo title: "[BETA]: " labels: - bug body: - type: markdown attributes: value: | Thanks for taking the time to fill out a bug report! Please provide a descriptive title above and fill in the following fields. - type: textarea id: Description attributes: label: Bug description description: Describe the bug you encountered and what you expected to happen. validations: required: true - type: textarea id: Steps attributes: label: Steps to reproduce description: Provide the specific steps to reproduce the issue. value: | - Include relevant code snippet that did not work as expected. - If applicable, add screenshots to help explain the problem. - Include anything else that might help us debug the issue. validations: required: true - type: textarea id: Context attributes: label: System information description: Create a new notebook in Mojo Playground, execute the following code, and paste the output back into this text box. value: | - What OS did you do install modular CLI/mojo on ? - Provide version information for Mojo by pasting the output of `mojo -v` - Provide Modular CLI version by pasting the output of `modular -v` render: shell --- bug_report.yaml.txt --- name: Bug report description: Create a bug report to help us improve Mojo title: "[BUG]: " labels: - bug body: - type: markdown attributes: value: | Thanks for taking the time to fill out a bug report! Please provide a descriptive title above and fill in the following fields. - type: textarea id: Description attributes: label: Bug description description: Describe the bug you encountered and what you expected to happen. validations: required: true - type: textarea id: Steps attributes: label: Steps to reproduce description: Provide the specific steps to reproduce the issue. value: | - Name the pre-existing notebook that failed and the steps that led to failure. - Include relevant code snippet that did not work as expected. - If applicable, add screenshots to help explain the problem. - Include anything else that might help us debug the issue. validations: required: true - type: textarea id: Context attributes: label: System information description: Create a new notebook in Mojo Playground, execute the following code, and paste the output back into this text box. value: | %%python import subprocess subprocess.Popen(["cat", "/proc/self/cgroup"]) render: shell --- doc_issue.yaml.txt --- name: Documentation issue description: Report a problem with the Mojo docs title: "[Docs]" labels: - documentation body: - type: markdown attributes: value: | Thank you for helping us improve the Mojo docs! Please add a title above and fill in the following fields so we can understand the problem. - type: input attributes: label: Where is the problem? description: Provide a link to the problematic page (with a heading anchor). validations: required: true - type: textarea attributes: label: What can we do better? description: Describe the documentation problem and how you suggest we fix it. validations: required: true - type: textarea attributes: label: Anything else? validations: required: false - type: markdown attributes: value: | Thank you! --- feature_request.yaml.txt --- name: Feature request description: Suggest an enhancement for Mojo title: "[Feature Request]" labels: - enhancement body: - type: markdown attributes: value: | Thanks for taking the time to suggest a Mojo enhancement! Please enter a concise title above and fill out the following fields. - type: checkboxes id: Roadmap attributes: label: Review Mojo's priorities description: Please take a look at our roadmap before you file a new feature request. options: - label: I have read the [roadmap and priorities](https://docs.modular.com/mojo/roadmap.html#overall-priorities) and I believe this request falls within the priorities. required: true - type: textarea id: Request attributes: label: What is your request? description: Describe how you'd like us to improve Mojo. validations: required: true - type: textarea id: Motivation attributes: label: What is your motivation for this change? description: Describe the problem that your feature seeks to address (what is the value to the product/user?). validations: required: true - type: textarea id: Description attributes: label: Any other details? description: Perhaps some minimum functional attributes the implementation should include, or other context about your feature. validations: required: false --- README.md.txt --- # Welcome to Mojo 🔥 Mojo is a new programming language that bridges the gap between research and production by combining Python syntax and ecosystem with systems programming and metaprogramming features. Mojo is still young, but it is designed to become a superset of Python over time. We plan to open-source Mojo progressively over time, but it's changing very quickly now. We believe that a small, tight-knit group of engineers with a shared vision can move faster than a community effort, so we will continue to incubate it within Modular until it's more complete. Please see the [Mojo FAQ](https://docs.modular.com/mojo/faq.html) for more information about this and other common questions. We've opened this repo now because we want to gather issues and engage in feedback from users who have access to the Mojo Playground (our hosted JupyterHub where you can try coding with an early version of Mojo). To get access to the Mojo Playground, [see here to sign up](https://docs.modular.com/mojo/get-started.html). Then, when you want to report issues or request features, [please create a GitHub issue here](https://github.com/modularml/mojo/issues). For more general questions or to chat with other Mojo developers, check out our [Discord](https://discord.gg/modular). Otherwise, you can: - Read the [inspiration behind Mojo](https://docs.modular.com/mojo/why-mojo.html). - Check out the [Mojo programming manual](https://docs.modular.com/mojo/programming-manual.html). - Read our other docs on [docs.modular.com/mojo](https://docs.modular.com/mojo). --- LICENSE.txt --- ============================================================================================== The Mojo examples repository is licensed under the Apache License v2.0 with LLVM Exceptions: ============================================================================================== Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---- LLVM Exceptions to the Apache 2.0 License ---- As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into an Object form of such source code, you may redistribute such embedded portions in such Object form without complying with the conditions of Sections 4(a), 4(b) and 4(d) of the License. In addition, if you combine or link compiled forms of this Software with software that is licensed under the GPLv2 ("Combined Software") and if a court of competent jurisdiction determines that the patent provision (Section 3), the indemnity provision (Section 9) or other Section of the License conflicts with the conditions of the GPLv2, you may retroactively and prospectively choose to deem waived or otherwise exclude such Section(s) of the License, but only in their entirety and only with respect to the Combined Software. ============================================================================== Software from third parties included in the LLVM Project: ============================================================================== The LLVM Project contains third party software which is under different license terms. All such code will be identified clearly using at least one of two mechanisms: 1) It will be in a separate directory tree with its own `LICENSE.txt` or `LICENSE` file at the top containing the specific license and restrictions which apply to that software, or 2) It will contain specific license and restriction terms at the top of every file. ============================================================================== Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): ============================================================================== University of Illinois/NCSA Open Source License Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign. All rights reserved. Developed by: LLVM Team University of Illinois at Urbana-Champaign http://llvm.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution. * Neither the names of the LLVM Team, University of Illinois at Urbana-Champaign, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. --- README.md.txt --- # Mojo code examples A collection of sample programs and Mojo notebooks written in the [Mojo](https://docs.modular.com/mojo/programming-manual.html) programming language. ## Getting Started Access a Mojo programming environment available from the Mojo product [page](https://www.modular.com/mojo). Git clone the repository of Mojo samples using the command below: ```bash git clone https://github.com/modularml/mojo.git ``` ## Running Use the following sample command-line to run the programs: ```bash mojo matmul.mojo ``` You can run the Mojo notebooks using [JupyterLab or Visual Studio Code](notebooks/README.md) with the Mojo extension available on the Marketplace. ### Mojo SDK Container The repo also contains a Dockerfile that can be used to create a Mojo SDK container for developing and running Mojo programs. Use the container in conjunction with the Visual Studio Code devcontainers extension to develop directly inside the container. The Dockerfile also sets up a `conda` environment and by default, starts a `jupyter` server (which you can access via the browser). ## License The Mojo examples and notebooks in this repository are licensed under the Apache License v2.0 with LLVM Exceptions (see the LLVM [License](https://llvm.org/LICENSE.txt)). ## Contributing Thanks for your interest in contributing to this repository! We are not accepting pull requests at this time, but are actively working on a process to accept contributions. Please stay tuned. --- deviceinfo.mojo.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # This sample prints the current host system information using APIs from the # sys module. from runtime.llcl import num_cores from sys.info import ( os_is_linux, os_is_windows, os_is_macos, has_sse4, has_avx, has_avx2, has_avx512f, has_avx512_vnni, has_neon, is_apple_m1, has_intel_amx, _current_target, _current_cpu, _triple_attr, ) def main(): var os = "" if os_is_linux(): os = "linux" elif os_is_macos(): os = "macOS" else: os = "windows" let cpu = String(_current_cpu()) let arch = String(_triple_attr()) var cpu_features = String(" ") if has_sse4(): cpu_features = cpu_features.join(" sse4") if has_avx(): cpu_features = cpu_features.join(" avx") if has_avx2(): cpu_features = cpu_features.join(" avx2") if has_avx512f(): cpu_features = cpu_features.join(" avx512f") if has_avx512_vnni(): cpu_features = cpu_features.join(" avx512_vnni") if has_intel_amx(): cpu_features = cpu_features.join(" intel_amx") if has_neon(): cpu_features = cpu_features.join(" neon") if is_apple_m1(): cpu_features = cpu_features.join(" Apple M1") print("System information: ") print(" OS : ", os) print(" CPU : ", cpu) print(" Arch : ", arch) print(" Num Cores : ", num_cores()) print(" CPU Features:", cpu_features) --- Dockerfile.mojosdk.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # Example command line: # Use no-cache to force docker to rebuild layers of the image by downloading the SDK from the repos # docker build --no-cache \ # --build-arg AUTH_KEY=<your-modular-auth-key> # --pull -t modular/mojo-v0.2-`date '+%Y%d%m-%H%M'` \ # --file Dockerfile.mojosdk . FROM ubuntu:20.04 ARG DEFAUL_TZ=America/Los_Angeles ENV DEFAULT_TZ=$DEFAULT_TZ RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive $DEFAULT_TZ apt-get install -y \ tzdata \ vim \ sudo \ curl \ python3 \ pip \ && python3 -m pip install \ jupyterlab \ ipykernel \ matplotlib \ ipywidgets RUN curl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-py38_23.5.2-0-Linux-x86_64.sh > /tmp/miniconda.sh \ && chmod +x /tmp/miniconda.sh \ && /tmp/miniconda.sh -b -p /opt/conda ARG AUTH_KEY=DEFAULT_KEY ENV AUTH_KEY=$AUTH_KEY RUN curl https://get.modular.com | MODULAR_AUTH=$AUTH_KEY sh - \ && modular install mojo ARG MODULAR_HOME="/root/.modular" ENV MODULAR_HOME=$MODULAR_HOME ENV PATH="$PATH:/opt/conda/bin:$MODULAR_HOME/pkg/packages.modular.com_mojo/bin" RUN conda init RUN jupyter labextension disable "@jupyterlab/apputils-extension:announcements" CMD ["jupyter", "lab", "--ip='*'", "--NotebookApp.token=''", "--NotebookApp.password=''","--allow-root"] --- hello.mojo.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # This sample demonstrates some basic Mojo # Range and print functions available as builtins def main(): print("Hello Mojo 🔥!") for x in range(9, 0, -3): print(x) --- hello_interop.mojo.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # This sample demonstrates some basic Mojo # Range and print functions available in the standard library # It also demonstrates importing a simple Python program into Mojo from python.python import ( Python, _destroy_python, _init_python, ) def main(): print("Hello Mojo 🔥!") for x in range(9, 0, -3): print(x) try: Python.add_to_path(".") Python.add_to_path("./examples") let test_module = Python.import_module("simple_interop") test_module.test_interop_func() except e: print(e.value) print("could not find module simple_interop") --- matmul.mojo.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # This sample demonstrates how various systems optimizations can be # applied to a naive matmul implementation in Mojo to gain significant # performance speedups from benchmark import Benchmark from sys.intrinsics import strided_load from utils.list import VariadicList from math import div_ceil, min from memory import memset_zero from random import rand, random_float64 from sys.info import simdwidthof from time import now from algorithm import vectorize, parallelize, vectorize_unroll from algorithm import Static2DTileUnitFunc as Tile2DFunc from python.object import PythonObject from python.python import Python, _destroy_python, _init_python struct Matrix: var data: DTypePointer[DType.float32] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.data = DTypePointer[DType.float32].alloc(rows * cols) rand(self.data, rows * cols) self.rows = rows self.cols = cols fn __del__(owned self): self.data.free() fn zero(inout self): memset_zero(self.data, self.rows * self.cols) @always_inline fn __getitem__(self, y: Int, x: Int) -> Float32: return self.load[1](y, x) @always_inline fn __setitem__(self, y: Int, x: Int, val: Float32): return self.store[1](y, x, val) @always_inline fn load[nelts: Int](self, y: Int, x: Int) -> SIMD[DType.float32, nelts]: return self.data.simd_load[nelts](y * self.cols + x) @always_inline fn store[nelts: Int](self, y: Int, x: Int, val: SIMD[DType.float32, nelts]): return self.data.simd_store[nelts](y * self.cols + x, val) fn run_matmul_python(M: Int, N: Int, K: Int) -> Float64: var gflops: Float64 = 0.0 let python = Python() try: Python.add_to_path(".") Python.add_to_path("./examples") let pymatmul_module: PythonObject = Python.import_module("pymatmul") if pymatmul_module: gflops = pymatmul_module.benchmark_matmul_python( M, N, K ).to_float64() else: print("pymatmul module not found") except e: print(e.value) pass return gflops fn matmul_naive(C: Matrix, A: Matrix, B: Matrix): for m in range(C.rows): for k in range(A.cols): for n in range(C.cols): C[m, n] += A[m, k] * B[k, n] # Mojo has SIMD vector types, we can vectorize the Matmul code as follows. alias nelts = simdwidthof[DType.float32]() # The SIMD vector width. fn matmul_vectorized_0(C: Matrix, A: Matrix, B: Matrix): for m in range(C.rows): for k in range(A.cols): for nv in range(0, C.cols, nelts): C.store[nelts]( m, nv, C.load[nelts](m, nv) + A[m, k] * B.load[nelts](k, nv) ) # Handle remaining elements with scalars. for n in range(nelts * (C.cols // nelts), C.cols): C[m, n] += A[m, k] * B[k, n] # Simplify the code by using the builtin vectorize function # from Functional import vectorize fn matmul_vectorized_1(C: Matrix, A: Matrix, B: Matrix): for m in range(C.rows): for k in range(A.cols): @parameter fn dot[nelts: Int](n: Int): C.store[nelts]( m, n, C.load[nelts](m, n) + A[m, k] * B.load[nelts](k, n) ) vectorize[nelts, dot](C.cols) # Parallelize the code by using the builtin parallelize function # from Functional import parallelize fn matmul_parallelized(C: Matrix, A: Matrix, B: Matrix): @parameter fn calc_row(m: Int): for k in range(A.cols): @parameter fn dot[nelts: Int](n: Int): C.store[nelts]( m, n, C.load[nelts](m, n) + A[m, k] * B.load[nelts](k, n) ) vectorize[nelts, dot](C.cols) parallelize[calc_row](C.rows) # Perform 2D tiling on the iteration space defined by end_x and end_y. fn tile[tiled_fn: Tile2DFunc, tile_x: Int, tile_y: Int](end_x: Int, end_y: Int): # Note: this assumes that ends are multiples of the tiles. for y in range(0, end_y, tile_y): for x in range(0, end_x, tile_x): tiled_fn[tile_x, tile_y](x, y) # Use the above tile function to perform tiled matmul. fn matmul_tiled_parallelized(C: Matrix, A: Matrix, B: Matrix): @parameter fn calc_row(m: Int): @parameter fn calc_tile[tile_x: Int, tile_y: Int](x: Int, y: Int): for k in range(y, y + tile_y): @parameter fn dot[ nelts: Int, ](n: Int): C.store[nelts]( m, n + x, C.load[nelts](m, n + x) + A[m, k] * B.load[nelts](k, n + x), ) vectorize[nelts, dot](tile_x) # We hardcode the tile factor to be 4. alias tile_size = 4 tile[calc_tile, nelts * tile_size, tile_size](A.cols, C.cols) parallelize[calc_row](C.rows) # Unroll the vectorized loop by a constant factor. # from Functional import vectorize_unroll fn matmul_tiled_unrolled_parallelized(C: Matrix, A: Matrix, B: Matrix): @parameter fn calc_row(m: Int): @parameter fn calc_tile[tile_x: Int, tile_y: Int](x: Int, y: Int): for k in range(y, y + tile_y): @parameter fn dot[ nelts: Int, ](n: Int): C.store[nelts]( m, n + x, C.load[nelts](m, n + x) + A[m, k] * B.load[nelts](k, n + x), ) # Vectorize by nelts and unroll by tile_x/nelts # Here unroll factor is 4 vectorize_unroll[nelts, tile_x // nelts, dot](tile_x) alias tile_size = 4 tile[calc_tile, nelts * tile_size, tile_size](A.cols, C.cols) parallelize[calc_row](C.rows) @always_inline fn benchmark[ func: fn (Matrix, Matrix, Matrix) -> None ](M: Int, N: Int, K: Int, base_gflops: Float64, str: String): var C = Matrix(M, N) C.zero() var A = Matrix(M, K) var B = Matrix(K, N) @always_inline @parameter fn test_fn(): _ = func(C, A, B) let secs = Float64(Benchmark().run[test_fn]()) / 1_000_000_000 # Prevent the matrices from being freed before the benchmark run _ = (A, B, C) let gflops = ((2 * M * N * K) / secs) / 1e9 let speedup: Float64 = gflops / base_gflops # print(gflops, "GFLOP/s", speedup, " speedup") print(str) print(gflops, "GFLOP/s <>", speedup.to_int(), "x speedup over Python") fn main(): # Python print("Throughput of a 128x128 matrix multiplication in Python: ") let python_gflops = run_matmul_python(128, 128, 128) alias M = 512 # Mojo variants benchmark[matmul_naive]( M, M, M, python_gflops, ( "Throughput of a 512x512 matrix multiplication in Mojo using a" " naive algorithm: " ), ) benchmark[matmul_vectorized_0]( M, M, M, python_gflops, ( "Throughput of a 512x512 matrix multiplication in Mojo using" " vectorization: " ), ) benchmark[matmul_vectorized_1]( M, M, M, python_gflops, ( "Throughput of a 512x512 matrix multiplication in Mojo using the" " stdlib `vectorize`: " ), ) benchmark[matmul_parallelized]( M, M, M, python_gflops, ( "Throughput of a 512x512 {vectorized + parallelized} matrix" " multiplication in Mojo: " ), ) benchmark[matmul_tiled_parallelized]( M, M, M, python_gflops, ( "Throughput of a 512x512 {tiled + vectorized + parallelized} matrix" " multiplication in Mojo: " ), ) benchmark[matmul_tiled_unrolled_parallelized]( M, M, M, python_gflops, ( "Throughput of a 512x512 {tiled + unrolled + vectorized +" " parallelized} matrix multiplication in Mojo: " ), ) --- memset.mojo.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # This sample implements various memset algorithms and optimizations from autotune import autotune_fork from utils.list import VariadicList from math import min, max from time import now from memory import memset as stdlib_memset alias ValueType = UInt8 alias BufferPtrType = DTypePointer[DType.uint8] alias memset_fn_type = fn (BufferPtrType, ValueType, Int) -> None fn measure_time( func: memset_fn_type, size: Int, ITERS: Int, SAMPLES: Int ) -> Int: alias alloc_size = 1024 * 1024 let ptr = BufferPtrType.alloc(alloc_size) var best = -1 for sample in range(SAMPLES): let tic = now() for iter in range(ITERS): # Offset pointer to shake up cache a bit let offset_ptr = ptr.offset((iter * 128) & 1024) # Just in case compiler will try to outsmart us and avoid repeating # memset, change the value we're filling with let v = ValueType(iter&255) # Actually call the memset function func(offset_ptr, v.value, size) let toc = now() if best < 0 or toc - tic < best: best = toc - tic ptr.free() return best alias MULT = 2_000 fn visualize_result(size: Int, result: Int): print_no_newline("Size: ") if size < 10: print_no_newline(" ") print_no_newline(size, " |") for _ in range(result // MULT): print_no_newline("*") print() fn benchmark(func: memset_fn_type, title: StringRef): print("\n=====================") print(title) print("---------------------\n") alias benchmark_iterations = 30 * MULT alias warmup_samples = 10 alias benchmark_samples = 1000 # Warmup for size in range(35): _ = measure_time(func, size, benchmark_iterations, warmup_samples) # Actual run for size in range(35): let result = measure_time( func, size, benchmark_iterations, benchmark_samples ) visualize_result(size, result) @always_inline fn overlapped_store[ width: Int ](ptr: BufferPtrType, value: ValueType, count: Int): let v = SIMD.splat[DType.uint8, width](value) ptr.simd_store[width](v) ptr.simd_store[width](count - width, v) fn memset_manual(ptr: BufferPtrType, value: ValueType, count: Int): if count < 32: if count < 5: if count == 0: return # 0 < count <= 4 ptr.store(0, value) ptr.store(count - 1, value) if count <= 2: return ptr.store(1, value) ptr.store(count - 2, value) return if count <= 16: if count >= 8: # 8 <= count < 16 overlapped_store[8](ptr, value, count) return # 4 < count < 8 overlapped_store[4](ptr, value, count) return # 16 <= count < 32 overlapped_store[16](ptr, value, count) else: # 32 < count memset_system(ptr, value, count) fn memset_system(ptr: BufferPtrType, value: ValueType, count: Int): stdlib_memset(ptr, value.value, count) fn memset_manual_2(ptr: BufferPtrType, value: ValueType, count: Int): if count < 32: if count >= 16: # 16 <= count < 32 overlapped_store[16](ptr, value, count) return if count < 5: if count == 0: return # 0 < count <= 4 ptr.store(0, value) ptr.store(count - 1, value) if count <= 2: return ptr.store(1, value) ptr.store(count - 2, value) return if count >= 8: # 8 <= count < 16 overlapped_store[8](ptr, value, count) return # 4 < count < 8 overlapped_store[4](ptr, value, count) else: # 32 < count memset_system(ptr, value, count) @adaptive @always_inline fn memset_impl_layer[ lower: Int, upper: Int ](ptr: BufferPtrType, value: ValueType, count: Int): @parameter if lower == -100 and upper == 0: pass elif lower == 0 and upper == 4: ptr.store(0, value) ptr.store(count - 1, value) if count <= 2: return ptr.store(1, value) ptr.store(count - 2, value) elif lower == 4 and upper == 8: overlapped_store[4](ptr, value, count) elif lower == 8 and upper == 16: overlapped_store[8](ptr, value, count) elif lower == 16 and upper == 32: overlapped_store[16](ptr, value, count) elif lower == 32 and upper == 100: memset_system(ptr, value, count) else: constrained[False]() @adaptive @always_inline fn memset_impl_layer[ lower: Int, upper: Int ](ptr: BufferPtrType, value: ValueType, count: Int): alias cur: Int autotune_fork[Int, 0, 4, 8, 16, 32 -> cur]() constrained[cur > lower]() constrained[cur < upper]() if count > cur: memset_impl_layer[max(cur, lower), upper](ptr, value, count) else: memset_impl_layer[lower, min(cur, upper)](ptr, value, count) @adaptive @always_inline fn memset_impl_layer[ lower: Int, upper: Int ](ptr: BufferPtrType, value: ValueType, count: Int): alias cur: Int autotune_fork[Int, 0, 4, 8, 16, 32 -> cur]() constrained[cur > lower]() constrained[cur < upper]() if count <= cur: memset_impl_layer[lower, min(cur, upper)](ptr, value, count) else: memset_impl_layer[max(cur, lower), upper](ptr, value, count) fn memset_evaluator(funcs: Pointer[memset_fn_type], size: Int) -> Int: # This size is picked at random, in real code we could use a real size # distribution here. let size_to_optimize_for = 17 print("Optimizing for size: ", size_to_optimize_for) var best_idx: Int = -1 var best_time: Int = -1 alias eval_iterations = MULT alias eval_samples = 500 # Find the function that's the fastest on the size we're optimizing for for f_idx in range(size): let func = funcs.load(f_idx) let cur_time = measure_time( func, size_to_optimize_for, eval_iterations, eval_samples ) if best_idx < 0: best_idx = f_idx best_time = cur_time if best_time > cur_time: best_idx = f_idx best_time = cur_time return best_idx fn main(): # CHECK: Manual memset # CHECK: System memset benchmark(memset_manual, "Manual memset") benchmark(memset_system, "System memset") # CHECK: Manual memset v2 benchmark(memset_manual_2, "Manual memset v2") benchmark(memset_system, "Mojo system memset") # CHECK: Mojo autotune memset benchmark(memset_manual, "Mojo manual memset") benchmark(memset_manual_2, "Mojo manual memset v2") benchmark(memset_system, "Mojo system memset") --- nbody.mojo.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # This sample implements the nbody benchmarking in # https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/nbody.html from utils.index import StaticTuple from algorithm import unroll from math import sqrt from benchmark import Benchmark alias PI = 3.141592653589793 alias SOLAR_MASS = 4 * PI * PI alias DAYS_PER_YEAR = 365.24 @register_passable("trivial") struct Planet: var pos: SIMD[DType.float64, 4] var velocity: SIMD[DType.float64, 4] var mass: Float64 fn __init__( pos: SIMD[DType.float64, 4], velocity: SIMD[DType.float64, 4], mass: Float64, ) -> Self: return Self { pos: pos, velocity: velocity, mass: mass, } alias NUM_BODIES = 5 fn offset_momentum(inout bodies: StaticTuple[NUM_BODIES, Planet]): var p = SIMD[DType.float64, 4]() @parameter fn _iter[i: Int](): p += bodies[i].velocity * bodies[i].mass var body = bodies[0] body.velocity = -p / SOLAR_MASS bodies[0] = body fn advance(inout bodies: StaticTuple[NUM_BODIES, Planet], dt: Float64): @parameter fn _outer[i: Int](): @parameter fn _inner[j: Int](): var body_i = bodies[i] var body_j = bodies[j + i + 1] let diff = body_i.pos - body_j.pos let diff_sqr = (diff * diff).reduce_add() let mag = dt / (diff_sqr * sqrt(diff_sqr)) body_i.velocity -= diff * body_j.mass * mag body_j.velocity += diff * body_i.mass * mag bodies[i] = body_i bodies[j + i + 1] = body_j unroll[NUM_BODIES - i - 1, _inner]() unroll[NUM_BODIES, _outer]() @parameter fn _update[i: Int](): var body = bodies[i] body.pos += dt * body.velocity bodies[i] = body unroll[NUM_BODIES, _update]() fn energy(bodies: StaticTuple[NUM_BODIES, Planet]) -> Float64: var e: Float64 = 0 @parameter fn _outer[i: Int](): let body_i = bodies[i] e += ( 0.5 * body_i.mass * ((body_i.velocity * body_i.velocity).reduce_add()) ) @parameter fn _inner[j: Int](): let body_j = bodies[j + i + 1] let diff = body_i.pos - body_j.pos let distance = sqrt((diff * diff).reduce_add()) e -= (body_i.mass * body_j.mass) / distance unroll[NUM_BODIES - i - 1, _inner]() unroll[NUM_BODIES, _outer]() return e fn run(): let Sun = Planet( 0, 0, SOLAR_MASS, ) let Jupiter = Planet( SIMD[DType.float64, 4]( 4.84143144246472090e00, -1.16032004402742839e00, -1.03622044471123109e-01, 0, ), SIMD[DType.float64, 4]( 1.66007664274403694e-03 * DAYS_PER_YEAR, 7.69901118419740425e-03 * DAYS_PER_YEAR, -6.90460016972063023e-05 * DAYS_PER_YEAR, 0, ), 9.54791938424326609e-04 * SOLAR_MASS, ) let Saturn = Planet( SIMD[DType.float64, 4]( 8.34336671824457987e00, 4.12479856412430479e00, -4.03523417114321381e-01, 0, ), SIMD[DType.float64, 4]( -2.76742510726862411e-03 * DAYS_PER_YEAR, 4.99852801234917238e-03 * DAYS_PER_YEAR, 2.30417297573763929e-05 * DAYS_PER_YEAR, 0, ), 2.85885980666130812e-04 * SOLAR_MASS, ) let Uranus = Planet( SIMD[DType.float64, 4]( 1.28943695621391310e01, -1.51111514016986312e01, -2.23307578892655734e-01, 0, ), SIMD[DType.float64, 4]( 2.96460137564761618e-03 * DAYS_PER_YEAR, 2.37847173959480950e-03 * DAYS_PER_YEAR, -2.96589568540237556e-05 * DAYS_PER_YEAR, 0, ), 4.36624404335156298e-05 * SOLAR_MASS, ) let Neptune = Planet( SIMD[DType.float64, 4]( 1.53796971148509165e01, -2.59193146099879641e01, 1.79258772950371181e-01, 0, ), SIMD[DType.float64, 4]( 2.68067772490389322e-03 * DAYS_PER_YEAR, 1.62824170038242295e-03 * DAYS_PER_YEAR, -9.51592254519715870e-05 * DAYS_PER_YEAR, 0, ), 5.15138902046611451e-05 * SOLAR_MASS, ) var system = StaticTuple[NUM_BODIES, Planet]( Sun, Jupiter, Saturn, Uranus, Neptune ) offset_momentum(system) let derived_energy: String = "Energy of System: " print(derived_energy) print(energy(system)) for i in range(50_000_000): advance(system, 0.01) print(derived_energy) print(energy(system)) fn benchmark(): fn _bench(): run() print(Benchmark().run[_bench]() / 1.0e9) fn main(): print("Starting nbody...") run() --- README.md.txt --- # Mojo Jupyter notebooks Mojo supports programming in [Jupyter notebooks](https://jupyter.org/), just like Python. This page explains how to get started with Mojo notebooks, and this repo directory contains notebooks that demonstrate some of Mojo's features (most of which we originally published on the [Mojo Playground](https://playground.modular.com/)). If you're not familiar with Jupyter notebooks, they're files that allow you to create documents with live code, equations, visualizations, and explanatory text. They're basically documents with executable code blocks, making them great for sharing code experiments and programming tutorials. We actually wrote the [Mojo programming manual](https://docs.modular.com/mojo/programming-manual.html) as a Jupyter notebook, so we can easily test all the code samples. And because Mojo allows you to import Python modules, you can use visualization libraries in your notebooks to draw graphs and charts, or display images. For an example, check out the `Mandelbrot.ipynb` notebook, which uses `matplotlib` to draw the Mandelbrot set calculated in Mojo, and the `RayTracing.ipynb` notebook, which draws images using `numpy`. ## Get started in VS Code Visual Studio Code is a great environment for programming with Jupyter notebooks. Especially if you're developing with Mojo on a remote system, using VS Code is ideal because it allows you to edit and interact with notebooks on the remote machine where you've installed Mojo. All you need is the Mojo SDK and the Jupyter VS Code extension: 1. Install the [Mojo SDK](https://developer.modular.com/download). 2. Install [Visual Studio Code](https://code.visualstudio.com/) and the [Jupyter extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter). 3. Then open any `.ipynb` file with Mojo code, click **Select Kernel** in the top-right corner of the document, and then select **Jupyter Kernel > Mojo**. The Mojo kernel should have been installed automatically when you installed the Mojo SDK. If the Mojo kernel is not listed, make sure that your `$MODULAR_HOME` environment variable is set on the system where you installed the Mojo SDK (specified in the `~/.profile` or `~/.bashrc` file). Now run some Mojo code! ## Get started with JupyterLab You can also select the Mojo kernel when running notebooks in a local instance of JupyterLab. The following is just a quick setup guide for Linux users with the Mojo SDK installed locally, and it might not work with your system (these instructions don't support remote access to the JupyterLab). For more details about using JupyterLab, see the complete [JupyterLab installation guide](https://jupyterlab.readthedocs.io/en/latest/getting_started/installation.html). **Note:** You must run this setup on the same machine where you've installed the [Mojo SDK](https://developer.modular.com/download). However, syntax highlighting for Mojo code is not currently enabled in JupyterLab (coming soon). 1. Install JupyterLab: ```sh python3 -m pip install jupyterlab ``` 2. Make sure the user-level `bin` is in your `$PATH`: ```sh export PATH="$HOME/.local/bin:$PATH" ``` 3. Launch JupyterLab: ```sh jupyter lab ``` 4. When you open any of the `.ipynb` notebooks from this repository, JupyterLab should automatically select the Mojo kernel (which was installed with the Mojo SDK). Now run some Mojo code! ## Notes and tips - Code in a Jupyter notebook cell behaves like code in a Mojo REPL environment: The `main()` function is not required, but there are some caveats: - Top-level variables (variables declared outside a function) are not visible inside functions. - Redefining undeclared variables is not supported (variables without a `let` or `var` in front). If you’d like to redefine a variable across notebook cells, you must declare the variable with either `let` or `var`. - You can use `%%python` at the top of a code cell and write normal Python code. Variables, functions, and imports defined in a Python cell are available from subsequent Mojo code cells. --- .gitattributes.txt --- *.png filter=lfs diff=lfs merge=lfs -text --- background.png.txt --- version https://git-lfs.github.com/spec/v1 oid sha256:9169fda1748b39e6c06d7114432954fa7520301b9f95c1196e78a0399ceef890 size 607043 --- pymatmul.py.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # Simple program demonstrating a naive matrix multiplication in Python import importlib import sys import subprocess if not importlib.find_loader("numpy"): print("Numpy not found, installing...") subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy"]) import numpy as np from timeit import timeit class PyMatrix: def __init__(self, value, rows, cols): self.value = value self.rows = rows self.cols = cols def __getitem__(self, idxs): return self.value[idxs[0]][idxs[1]] def __setitem__(self, idxs, value): self.value[idxs[0]][idxs[1]] = value def matmul_python(C, A, B): for m in range(C.rows): for k in range(A.cols): for n in range(C.cols): C[m, n] += A[m, k] * B[k, n] def benchmark_matmul_python(M, N, K): A = PyMatrix(list(np.random.rand(M, K)), M, K) B = PyMatrix(list(np.random.rand(K, N)), K, N) C = PyMatrix(list(np.zeros((M, N))), M, N) secs = timeit(lambda: matmul_python(C, A, B), number=2) / 2 gflops = ((2 * M * N * K) / secs) / 1e9 print(gflops, "GFLOP/s") return gflops if __name__ == "__main__": print("Throughput of a 128x128 matrix multiplication in Python:") benchmark_matmul_python(128, 128, 128) --- reduce.mojo.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # This sample implements a simple reduction operation on a # large array of values to produce a single result. # Reductions and scans are common algorithm patterns in parallel computing. from benchmark import Benchmark from time import now from algorithm import sum from random import rand from memory.buffer import Buffer # Simple array struct struct ArrayInput: var data: DTypePointer[DType.float32] fn __init__(inout self, size: Int): self.data = DTypePointer[DType.float32].alloc(size) rand(self.data, size) fn __del__(owned self): self.data.free() @always_inline fn __getitem__(self, x: Int) -> Float32: return self.data.load(x) # Use the https://en.wikipedia.org/wiki/Kahan_summation_algorithm # Simple summation of the array elements fn reduce_sum_naive(data: ArrayInput, size: Int) -> Float32: var sum = data[0] var c: Float32 = 0.0 for i in range(size): let y = data[i] - c let t = sum + y c = (t - sum) - y sum = t return sum fn benchmark_naive_reduce_sum(size: Int) -> Float32: print("Computing reduction sum for array num elements: ", size) var A = ArrayInput(size) # Prevent DCE var mySum: Float32 = 0.0 @always_inline @parameter fn test_fn(): _ = reduce_sum_naive(A, size) let bench_time = Float64(Benchmark().run[test_fn]()) return mySum fn benchmark_stdlib_reduce_sum(size: Int) -> Float32: # Allocate a Buffer and then use the Mojo stdlib Reduction class # TODO: Use globals # alias numElem = size alias numElem = 1 << 30 # Can use either stack allocation or heap # see stackalloc # var A = Buffer[numElem, DType.float32].stack_allocation() # see heapalloc var B = DTypePointer[DType.float32].alloc(numElem) var A = Buffer[numElem, DType.float32](B) # initialize buffer for i in range(numElem): A[i] = Float32(i) # Prevent DCE var mySum: Float32 = 0.0 print("Computing reduction sum for array num elements: ", size) @always_inline @parameter fn test_fn(): mySum = sum[numElem, DType.float32](A) let bench_time = Float64(Benchmark().run[test_fn]()) return mySum fn main(): # Number of array elements let size = 1 << 21 print("# Reduction sum across a large array. The naive algorithm's ") print("# computation time scales with the size of the array; while Mojo ") print("# exhibits significantly better scaling...") var eval_begin: Float64 = now() var sum = benchmark_naive_reduce_sum(size) var eval_end: Float64 = now() var execution_time = Float64((eval_end - eval_begin)) / 1e6 print("Completed naive reduction sum: ", sum, " in ", execution_time, "ms") eval_begin = now() sum = benchmark_stdlib_reduce_sum(size) eval_end = now() execution_time = Float64((eval_end - eval_begin)) / 1e6 print("Completed stdlib reduction sum: ", sum, " in ", execution_time, "ms") --- simple_interop.py.txt --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # Simple python program to test interop import importlib import sys import subprocess if not importlib.find_loader("numpy"): print("Numpy not found, installing...") subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy"]) import numpy as np from timeit import timeit def test_interop_func(): print("Hello from Python!") a = np.array([1, 2, 3]) print("I can even print a numpy array: ", a) if __name__ == "__main__": print(timeit(lambda: test_interop_func(), number=1)) --- README.md.txt --- # Mojo🔥 engineering design proposals This directory contains ad-hoc design proposals put together by the Mojo engineering team. These are meant for to help shape discussion and refine the design of various subsystems, but typically get obsoleted and incorporated into more canonical documentation when the implementation work concludes. There is no attempt to keep these up-to-date as the language evolves, so they are more for historical reference than as a user-guide for the language. --- lifetimes-and-provenance.md.txt --- # Provenance Tracking and Lifetimes in Mojo As of mid-May 2023, Mojo has full support for ownership (including move semantics, borrows and transfers, mutability, ASAP destruction of values, and member synthesis). This provides more expressivity than many languages, but does not meet the expectations of Rust and C++ programmers because it is impossible to **return references** and **put references in structs**. This makes Mojo unable to express common patterns like `StringRef` in the LLVM APIs because it is a struct containing a reference, and this makes our `Pointer` type a massively unsafe API. ## Goals of this document This document explores the first step in adding lifetimes to Mojo: what changes we’ll have to introduce, some thinking on syntax we may want to use, and how this may want us to reconsider existing design decisions. This is written in the style of the "[Value ownership design for Mojo](value-ownership.md)" document from January. This document is really just the “first step” of lifetimes. Rust includes a few more exotic features, including [subtyping constraints between lifetimes](https://discourse.llvm.org/t/rfc-lifetime-annotations-for-c/61377#no-subtyping-constraints-between-lifetimes-15), [equality constraints between lifetime parameters](https://discourse.llvm.org/t/rfc-lifetime-annotations-for-c/61377#no-equality-constraints-between-lifetime-parameters-16), [unbounded lifetimes](https://doc.rust-lang.org/nomicon/unbounded-lifetimes.html) and perhaps other features. We don't have all the mechanics of a generic system and trait system yet to tie into - and it makes sense to lazily add complexity based on need - so these are not included in this initial design. ## Context Mojo already has much of the required infrastructure in place to support lifetimes: we now have references, we just need to be able to return them. Similarly, the Mojo parameter system provides a powerful way to model and propagate lifetime information around in our type system. We have a CheckLifetime compiler pass which infers lifetimes, diagnosing use of uninitialized values and inserting destructor calls. Similarly, we can learn a lot from Rust’s design for lifetimes. That said, the ownership system in Mojo is quite different than the one in Rust. In Rust, scopes define the implicit lifetimes of values and references, and lifetimes are used to verify that uses of the value happen when the value is still alive. Mojo flips this on its head: values start their life when defined, but end their life after their last use. This means that in Mojo, a lifetime reference **extends the liveness of a value** for as long as derived references is used, which is a bit different than Rust. For example, we expect this to behave like the comments indicate: ```mojo var some_str = String("hello") # The StringRef contains a reference to the some_str value var some_str_ref = StringRef(some_str) # Last use of some_str, but don't destroy it because there is a use of # the reference below! use(some_str) # References must be propagatable through methods. some_str_ref = some_str_ref.drop_front().drop_back() print(some_str_ref) # Prints "ell" # some_str destroyed here after last reference to it ``` The major thing that Mojo (and Rust) need from lifetimes is what is called “local reasoning”: We need to be able to reason about the memory behavior of a call just by looking at its signature. We cannot have to look into the body of a function to understand its effects, and a function cannot know about its callers to reason about the behavior of its arguments. Similarly, when accessing a member `a.ref` that is a reference, we need to know what lifetime is being used in the context of `a`. Because of this, the lifetimes in a function signature are something of a "transfer function" that expresses mappings from input lifetimes to returned lifetimes, and that allow reasoning about the lifetimes of field references. Mojo already has a powerful parameter system that allows it to express these sorts of relationships, so this all plugs together. ### What to name / how to explain this set of functionality? Rust has a few things going on that are tightly bound and somewhat confusing: it has scoping, lifetimes, and lifetime holes. It has a borrow checker that enforces the rules, all together this is its ownership system. When it comes to the “lifetimes” part of the puzzle, it seems better to clarify two very different concepts: on the one hand, stored **values** in memory each have a conceptual “lifetime” that starts when the value is defined and ends at the last use - this is where the destructor call is inserted. Because each declared variable has an independently tracked lifetime, each also needs an implicitly declared “lifetime parameter” that is tracked in the Mojo type system. On the other hand, when reasoning about parametric functions, the type signature defines a transfer function that expresses the “provenance” of the result values from the function and how they relate to input values. This relationship is a transfer function from the input lifetime parameters to output lifetime parameters, and can be somewhat more complicated. The framing of “provenance tracking” may be more general conceptually than “lifetime tracking” which seems specific to the lifetime parameters. ## Mojo Syntax Extensions + Changes Lifetimes are an additive feature on top of what we already have, but they are also a massive conceptual step forward that will cause us to rethink some previous decisions. The very end of this document explores a repaint of the keywords we already have (e.g. `inout`, `borrowed`, etc), but there is a bigger issue. The introduction of lifetimes enables us to generalize `borrowed`/`inout` references in argument conventions to being first class types that can occur in nested positions: You can now have a reference to a reference, you can have an array of references, etc. This change invalidates a basic syntax decision we made earlier: we need to move the position of the `inout`/`borrowed` keywords to the type position: ``` // Mojo today fn example(inout a: Int, borrowed b: F32): … struct S: fn method(inout self): … // Mojo with lifetimes fn example(a: inout Int, b: borrowed F32): … struct S: fn method(self: inout): … ``` As a transitional aid, we can continue parsing the old syntax and interpret it according to the new approach, but putting these words in the type position is important for them to compose correctly. This change will also require introducing these things into the expression grammar because the type grammar is the expression grammar. ### Writing a lifetime bound reference Rust uses the `'a` syntax which is pretty unconventional and (weirdly but) distinctly Rust. For example, here are some simple Rust functions: ```rust // This is Rust fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {..} fn longest2<'a>(x: &'a mut str, y: &'a mut str) -> &'a mut str {..} ``` I think we can clean this up in Mojo. We already have a general set of values in our generic signature list: we just need to “parameterize” the `inout` and `borrowed` keywords with a parametric lifetime. Assuming such a `Lifetime` is defined with a builtin type like `AnyType` we can use: ```mojo # Proposed Mojo syntax, without sugar. fn longest[a: Lifetime](x: borrowed[a] String, y: borrowed[a] String) -> borrowed[a] String: return x if len(x) >= len(y) else y fn longest2[a: Lifetime](x: inout[a] String, y: inout[a] String) -> inout[a] String: ``` This syntax raises several topics right off the bat, including concrete names we want for these keywords (this discussion is split out to another document to avoid confusing this discussion). Another question is what syntax to use for the explicitly named lifetime, we can make any of these work: ```mojo x: borrowed[a] String x: borrowed(a) String x: borrowed a String x: borrowed 'a String # It would be nice to support eliding 'borrowed' with a lifetime: x: [a] String x: (a) String x: a String x: 'a String # Pay homage to Rust! ``` For now, I’d prefer to keep any use of lifetimes fully explicit as we bring up the system; it avoids introducing complexity around ambiguity rules. The argument for square brackets vs parens is if we like the explanation that we’re “parameterizing the reference with a lifetime”. However, remember types can also be parametric, and those are spelled with square brackets **after** the type name, so parens may be better to make these more syntactically distinct. The spelling in structs should flow naturally from this: ```mojo struct StringRef[life: Lifetime]: var data : Pointer[UInt8, life] var len : Int ``` We will also want local references: ```mojo fn example(cond: Bool): var str1 = String("hello") var str2 = String("goodbye") # Defines an immutable reference with inferred lifetime. borrowed str_ref = str1 if cond else str2 print(str_ref) # Defines a mutable reference. inout mut_ref = str1 if cond else str2 mut_ref = "a new look" # One of these will have changed. print(str1) print(str2) ``` We also want local references to allow late initialization and explicitly declared lifetimes as well: ```mojo fn example[life: Lifetime](cond: Bool, x: borrowed[life] String, y: borrowed[life] String): # Late initialized local borrow with explicit lifetime borrowed[life] str_ref : String if cond: str_ref = x else: str_ref = y print(str_ref) ``` ### Keyword (?) for static lifetime I think we can have a useful feature set without requiring the ability to specify a static lifetime - the uses in Rust appear to be more about constraining input lifetimes than it is about the core propagation of lifetimes, that said, we can definitely dream up a spelling when it is needed. Similarly, unsafe pointer tricks (e.g. when working with C) may want to use the static lifetime marker to disable all tracking. We can start with a stub like `__static_lifetime` and then re-syntax it later. ### Syntatic Sugar(?): Implicitly declared lifetime parameter names One common use of named lifetime parameters is to tie the lifetime of the result of a function back to the lifetime of one of the function arguments. One refinement over Rust we could permit is for arguments to implicitly declare lifetimes on their first use. For example, we don’t need to require a declaration of `life` in this example: ```mojo fn longest(x: borrowed[life] String, y: borrowed[life] String) -> borrowed[life] String: # Alternatively follow Rust's lead. fn longest(x: 'life String, y: 'life String) -> 'life String: ``` This is **_really_** not a priority to design though, we can evaluate syntax compression after we get the basics up and running. ### Lifetime of `Self` The `Self` keyword (upper case) produces an elaborated type name for the current struct, but that does not include the lifetime of `self` (lower case) which is generally a reference. In a method you can name the lifetime of `self` by doing things like this: ```mojo struct MyExample: fn method[self_life: Lifetime](self: inout[self_life] Self) -> Pointer[Int, self_life]: ... fn callMethod(x: inout[life1] MyExample): use(x.method()) var y = MyExample() use(y.method()) ``` `self_life` will bind to the lifetime of whatever lvalue the method is called on, which is the `life1 `lifetime in the first example, and the implicit lifetime of y in the second example. This all composes nicely. One problem though - this won’t work for var definitions inside the struct, because they don’t have a self available to them, and may need to reason about it. We’ll have to create some syntax for this: ```mojo struct IntArray: var ptr : Pointer[Int, Self_lifetime] ``` It isn’t clear to me how the compiler will remap this though. We’d have to pass in the pointer/reference instead of the struct type. An alternative is to not allow expressing this and require casts. We can start with that model and explore adding this as the basic design comes up. ### Extended `getitem`/`getattr` Model Once we have references, we’ll want to add support for them in the property reference and subscripting logic. For example, many types store their enclosed values in memory: instead of having `Pointer` and `Array` types implement both `__getitem__` and `__setitem__` (therefore being a “computed LValue”) we'd much rather them to expose a reference to the value already in memory (therefore being more efficient). We can do this by allowing: ```mojo struct Pointer[type: AnyType, life: Lifetime]: # This getitem returns a reference, so no setitem needed. fn __getitem__(self, offset: Int) -> inout[life] type: return __get_address_as_lvalue[life](...) ``` We will also need to extend the magic `__get_address_as_lvalue` style functions to take a lifetime. ## Examples using Lifetimes This section attempts to build a few example data structures that are important to express with lifetimes. They obviously haven’t been tested. ### Pointer / UnsafePointer / Reference This is the bottom of the stack and needs to interface with other unsafe features. Suggested model is to make Pointer be parameterized on the lifetime that it needs to work with as well as element type: ```mojo @value @register_passable("trivial") struct MutablePointer[type: AnyType, life: Lifetime]: alias pointer_type = __mlir_type[...] var address: pointer_type fn __init__() -> Self: ... fn __init__(address: pointer_type) -> Self: ... # Should this be an __init__ to allow implicit conversions? @static_method fn address_of(inout[life] arg: type) -> Self: ... fn __getitem__(self, offset: Int) -> inout[life] type: ... @staticmethod fn alloc(count: Int) -> Self: ... fn free(self): ... fn exercise_pointer(): # Allocated untracked data with static/immortal lifetime. let ptr = MutablePointer[Int, __static_lifetime].alloc(42) # Use extended getitem through reference to support setter. ptr[4] = 7 var localInt = 19 let ptr2 = MutablePointer.address_of(localInt) ptr2[0] += 1 # increment localInt # ERROR: Cannot mutate localInt while ptr2 lifetime is live localInt += 1 use(ptr2) ``` It’s not clear to me if we need to have a split between `Pointer` and `MutablePointer` like Swift does. It will depend on details of how the CheckLifetimes pass works - I’m hoping/expecting that the borrow checker will allow mutable references to overlap with other references iff that reference is only loaded and not mutated. If we decide to eliminate `let` (described later), we may be able to eliminate this concept as well, which would be a nice simplification. Another aspect of the model we should consider is whether we should have an `UnsafePointer` that allows unchecked address arithmetic, but have a safe `Reference` type that just allows dereferencing. This `Reference` type would be completely safe when constructed from language references, which is pretty cool. We may also want to wire up the prefix star operator into a dunder method. ### ArraySlice `ArraySlice` (aka `ArrayRef` in LLVM) should compose on top of this: ``` @value @register_passable("trivial") struct MutableArraySlice[type: AnyType, life: Lifetime]: var ptr: MutablePointer[type, life] var size: Int fn __init__() -> Self: fn __init__(ptr: MutablePointer[type, life], size: Int) -> Self: # All the normal slicing operations etc, with bounds checks. fn __getitem__(self, offset: Int) -> inout[life] type: assert(offset < size) return ptr[offset] ``` As with `UnsafePointer`, this has to be parameterized based on the underlying element type. `ArraySlice` is just a bound checked pointer, but because of lifetimes, it is safe once constructed: the references it produces are bound to the lifetime specified so can’t dangle. ### Array / ValueSemanticArray Given these low level types, we can start to build higher level abstractions. One example of that is an `Array` type. I’d suggest that our default array type be value semantic with lazy copy-on-write 🐄, but a simpler example can be implemented with `std::vector` style eager copying: ```mojo # Doesn't require a lifetime param because it owns its data. struct Array[type: AnyType]: var ptr: MutablePointer[type, Self_lifetime] var size: Int var capacity: Int fn __getitem__[life: Lifetime](self: inout[life], start: Int, stop: Int) -> MutableArraySlice[type, life]: return MutableArraySlice(ptr, size) ``` By tying the lifetime of the produced slice to the lifetime of the Array `self`, the borrow checker will prevent use/mutation of the `Array` itself while a mutable slice is produced. --- lifetimes-keyword-renaming.md.txt --- # Keyword naming and other topics to discuss This document is split off the [Provenance Tracking and Lifetimes in Mojo](lifetimes-and-provenance.md) document to separate general syntactic bikesheding issues from the core semantic issues in that proposal. Assuming that proposal goes through, I think we should consider a few changes to the current Mojo keyword paint: ## `borrowed` Keyword => `borrow` or `ref` `borrowed` as a keyword doesn’t really make sense in our new world. This is currently used to indicate an argument that is a borrowed version of an existing value. Given the introduction of lifetimes, these things can now appear in arbitrary places (e.g. you can have an array of references) so it makes sense to use a noun. Instead of reading an argument as “this function takes foo which is a borrowed string”, we would read it as “foo is a borrow/ref of a string”. This makes it consistent with local borrows on the stack: ```mojo fn do_stuff[a: Lifetime](x: ref[a] String): ... fn usage(): var str = String("hello") ref r = str # Defines a local borrow of str. do_stuff(str) # Bind a reference to 'str' do_stuff(r) # Pass on existing reference 'str' ``` ## `inout` Keyword => `ref` or `mutref` (??) The primary argument for the ‘`inout`’ keyword being named this was that Chris wanted to get off the former ampersand syntax we used, and that (in an argument position) there is copy-in and copy-out action that happens with computed LValues. I think there is a principled argument to switch to something shorter like `ref` which is used in other languages (e.g. C#), since they can exist in other places that are not arguments, and those don’t get copy-in/copy-out behavior. One challenge with the name `ref` is that it doesn't obviously convey mutability, so we might need something weird like `mutref`. Note that copy-in/copy-out syntax is useful in more than function call arguments, so the `inout` keyword may return in the future. For example, we may actually want to bind computed values to mutable references: ```mojo for inout x in some_array_with_getitem_and_setitem: x += 1 ``` This requires opening the reference with getitem, and writing it back with setitem. We may also want to abstract over computed properties, e.g. form something like `Array[inout Int]` where the elements of the array hold closers over the get/set pairs. If we had this, this could decay to a classic mutable reference at call sites providing the existing behavior we have. Given this possible direction and layering, I think we should go with something like this: 1. `ref`: immutable reference, this is spelled “`borrowed`” today 2. `mutref`: mutable reference, this is spelled “`inout`” today. I’d love a better keyword suggestion than `mutref`, perhaps just `mut`? 3. `inout`: abstracted computed mutable reference with getter/setter. `inout` can decay to `mutref` and `ref` in an argument position with writeback, and `mutref` is a subtype of `ref` generally. ## `owned` Keyword => `var` People on the forums have pointed out that the “`owned`” keyword in argument lists is very analogous to the `var` keyword. It defines a new, whole, value and it is mutable just like `var`. Switching to `var` eliminates a concept and reduces the number of keywords we are introducing. ## Allow `let` in argument lists ... or remove them entirely (!) If we replace the `owned` keyword with `var`, then we need to decide what to do with `let`. There are two different paths with different tradeoffs that I see. The easiest to explain and most contiguous would be to allow arguments to be defined as `let` arguments, just like we define `var` arguments. This would keep these two declarations symmetrical, and appease people that like to control mutation tightly. The more extreme direction would be to remove `let` entirely. Some arguments in favor of this approach: 1. It has been observed on the forum that it adds very little - it doesn't provide additional performance benefits over `var`, it only prevents "accidental mutation" of a value. 2. Languages like C++ default to mutability everywhere (very few people bother marking local variables constant, e.g. with `const int x = foo()`. 3. The more important (and completely necessary) thing that Mojo needs to model are immutable borrows. Removing `let` would reduce confusion about these two immutable things. 4. Mojo also has `alias`, which most programmers see as a “different type of constant” further increasing our chance of confusing people. 5. `let` declarations require additional compiler complexity to check them, Mojo doesn’t currently support struct fields market `let` for example because the initialization rules are annoying to check for. Once you have them, it messes with default values in structs. In my opinion, I think we are likely to want to remove `let`’s, but we should only do so after the whole lifetime system is up and working. This will give us more information about how things feel in practice and whether they are worth the complexity. ## More alternatives to consider: [@sa- suggests](https://github.com/modularml/mojo/discussions/338#discussioncomment-6104926) the keyword `fix` instead of `let`. [@mojodojodev suggests](https://github.com/modularml/mojo/discussions/338#discussioncomment-6105688): `ref[a]` - immutable reference `mut[a]` - mutable reference `let[a]` - immutable owned `var[a]` - mutable owned Having three letters for all of the keywords will allow the user to understand "this is related to ownership and mutability". The problem with the proposed removing let is that code ported from Python to Mojo won't behave the same, keeping let and var is advantageous in that it says this is a Mojo variable so you can add all the weird Python dynamic behavior when the keyword is elided. [@mzaks suggests](https://github.com/modularml/mojo/discussions/338#discussioncomment-6134220) using numbers to identify lifetimes, e.g.: ``` fn example['1_life](cond: Bool, x: borrowed'1 String, y: borrowed'1 String): # Late initialized local borrow with explicit lifetime borrowed'1 str_ref : String if cond: str_ref = x else: str_ref = y print(str_ref) ``` --- value-ownership.md.txt --- # Value ownership design for Mojo **Written**: Jan 2, 2023 **Status**: Implemented but the design has been refined, kept for historical interest. This document explores a design for ownership support in Mojo. This learns from other contemporary languages including C++, Rust, Swift and Val, providing a novel blend that should integrate well with our base Python syntax, and be powerful enough to express a wide range of kernel and systems programming applications. Rust is the language that most people will naturally think of in this space, and when compared to it, I expect that we will provide support for a wider range of types than Rust, yet provide a more familiar programming model and friendly API than it. While I assume that we will extend this to support lifetime types for better generality and safety with reference semantic types, that design is not included in this proposal. # Motivation and Background Modern systems languages aspire to provide memory safety, good low-level performance, and allow advanced library developers to build expressive high-level APIs that are easy to use by less experienced API users. In the case of Mojo, we have two specific “now” problems to solve: 1. We need to provide a way to allocate memory for a Tensor-like type, and given our existing support for raising exceptions, we need for them to be cleaned up. Thus we need destructors. We also need to disable copying of this sort of type. 2. We also need to implement transparent interop with CPython with an “object” struct. This requires us to have copy constructors and destructors so we can maintain the CPython reference count with an ergonomic Python-like model. Over time, we want Mojo to be a full replacement for the C/C++ system programming use cases in Python, unifying the “two world problem” that Python has with C. This is important because we want to have a unifying technology, and because CPUs will always be an important accelerator (and are fully general), and because our bet is that accelerators will get more and more programmable over time. ## Related Work I am not going to summarize the related work fully here, but I recommend folks interested in this topic to read up on relevant work in the industry, including: 1. C++’11 r-value references, move semantics, and its general modern programming model. It is yucky and has lots of problems, but is table-stakes knowledge and powers a tremendous amount of the industry. 2. Have a programmer-level understanding of [Rust’s Memory Ownership model](https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html), and read [the Rustonomicon](https://doc.rust-lang.org/nomicon/) end-to-end for bonus points. 3. Swift has a quite different approach which made some mistakes (Swift suffers from pervasive implicit copying) but has nice things in its [initialization design](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/initialization), [ARC design](https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html), [exclusivity enforcement](https://www.swift.org/blog/swift-5-exclusivity/) [[more details](https://github.com/apple/swift-evolution/blob/main/proposals/0176-enforce-exclusive-access-to-memory.md)], etc. 4. The [Val programming language](https://www.val-lang.dev/) is an early phase research system that is learning from Swift and trying to provide a much simpler programming model than Rust does with other advantages. It isn’t at all clear if it will be expressive enough to be useful at this point though. C++ and Rust are the most widely known in this space and they make different tradeoffs in defaults and what it means for a type author (ignoring lifetimes, which C++ lacks and is therefore generally unsafe). A few random observations that are related to the commentary below: * Rust in particular defaults to move’ing values but allows types to opt out of that by implementing the Copy trait. * Rust’s type system doesn’t appear to support values like `std::atomic` which require a pinned address in memory (Rust assumes it can transport things around at will), nor does it support things like `llvm::SmallVector` which is movable, but has an interior pointer so needs custom move constructors. * Because Rust defaults to moving everything around, it puts a huge amount of pressure on memcpy and LLVM memcpy optimization (e.g. see Patrick Walton’s recent work to improve this). In my opinion, this is a self imposed mistake that we can correct structurally. * Rust could support C++-like moves from values that leave them inert-and-to-be-destroyed, but does not do that. For lack of this, there is a lot of complexity and unsafe APIs required (e.g. [Drain](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.drain) and other things) when you want to construct an array progressively or take elements out of an array. ## Relevant Existing Mojo Type System Features The Mojo design currently has a few basic features that are precursors to proper ownership. The design below makes significant extensions and some changes to it. ### L-Values and R-Values Lvalues and Rvalues follow a conventional design found in many programming languages: an Rvalue is an immutable value that can be passed around by copying its bits by-value in an SSA register. An Lvalue is mutable, represented by its address, and can be promoted to an Rvalue with a “load”. ### Argument Conventions Functions can be declared to take any of their arguments by-reference, with an & sigil in the function definition: ```mojo fn globalFn(a: Int, b&: Int): b = a # ok a = 4 # error struct Vec: ... fn push_back(self&, item: Int): ... # mutable self fn size(self): ... # immutable self fn workWithVecs(a: Vec, b&: Vec): use(a.size()) # ok use(b.size()) # ok a.push_back(4) # Error, a isn't mutable b.push_back(4) # ok ``` As shown, by-ref arguments are Lvalues and thus may be mutated, otherwise arguments are passed by-value as immutable Rvalues. There is another similar-but-different thing going on with “def” functions. By-value arguments are passed by copy but are allowed to be mutable for better compatibility with Python semantics: ```mojo def exampleDef(a: Int, b&: Int): b = 4 # mutable as before. # passed by value into mutable copy. # This change isn't visible in the caller. a = 4 ``` The ‘def’ semantics are implemented by taking a value in by copy and introducing a local ‘var’ that shadows the argument. It is therefore a purely local transformation that we’ll ignore in the rest of this document. ### Type initializers Mojo supports Python type initializers and currently allows them to participate in implicit conversions: ```mojo struct Int: var value : __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Int { value: value } ``` # Proposed Mojo Additions / Changes This proposal introduces a number of new concepts to cover the space of value ownership and parameter passing conventions that Rust, Swift and C++ provide, but in a different way. We layer on the features in individual groups. Let’s explore them one piece at a time. ## Extended parameter conventions We should extend the existing type system to support owning (aka moving, aka consuming) parameter convention, immutable borrow semantics (“`&T"` in Rust, “`const T&"` in C++) and mutable borrow semantics (“`&mut T`” in Rust, and “`T&`” in C++). ### Change & to mean mutable borrow or “inout” Right now, & is a C++-like reference semantic sigil, we should keep it, but change it to mean a “mutable borrow” in Rust terminology or “inout” using Swift terminology. This won’t require Mojo source changes, but will be a terminology change inside of the compiler. The definitive initialization pass (below) will need to enforce its correct semantics. Tangential to this proposal, we could require the use of `&` on the caller side of arguments passing a mutable borrow to make it more clear in the caller code. If we do this, I propose that it be a postfix operator, and use it for methods for consistency: ```mojo swap(x.first&, y.first&) # Obvious what is being mutated b&.push_back(42) # Obvious that b is mutated. ``` This proposal will not use this syntax below, and this is probably way too onerous for methods, this is probably a bad idea. ### Introduce “owned” argument conventions We need a way to specify that ownership of a value is being passed into the function: ```mojo # This takes ownership of a unique vector, including its resources. fn someFunction(owned v: Vec): print(v) v.push_back(42) # Ok: v is mutable because we own it ``` In the code above, we show “owned v” takes and owns a value from the caller. Just like normal arguments, we would need a copy to get them as mutable: ```mojo fn anotherFunction(a: Int, owned v: Vec): a += 1 # Error: a is immutable var a2 = a # Copy the argument to make it mutable a2 += 1 # Ok, a2 is mutable. v.push_back(a) # Ok, owned values are mutable var v2 = v^ # Transfer v argument into a new var binding. v2.push_back(a) # Also ok ``` This should be an owned _reference_ and thus lower to LLVM pointers, just like a mutable reference does, unless the value is `@register_passable` (see below). Not doing this would significantly impact our ability to model things like `std::atomic` and `SmallVector` whose address is significant. See the “extensions” at the bottom for why this will be efficient for trivial types like integers. ### Introduce “borrowed” argument conventions and change default Similarly we need the ability to specify that we are passing and returning an immutable borrow, which is like a `'const &`’ in C++. The spelling of this isn’t particularly important because it will frequently be defaulted, but we need something concrete to explain the examples. ```mojo # This takes a borrow and return it. # Returned references need lifetimes for safety of course. fn printSizeAndReturn(borrowed v: Vec) -> borrowed Vec print(v.size()) return v ``` At the LLVM level, immutable references are passed by pointer, just like mutable references. Note that C++ and Rust entered into a strange battle with programmers about how to pass values by default. Templates generally use “`const&`” to avoid copies, but this is an inefficient way to pass trivial types like “`int`”. We propose a type level annotation to directly address, which allows us to use borrow far more pervasively for arguments in the language. See the ‘extensions’ section below. ### Change the default argument and result conventions Now we have the ability to express ownership clearly, but we don’t want all code everywhere to have words like `borrowed` on it: we want more progressive disclosure of complexity and better defaults. The first piece of this is the default return value convention. The right default convention for return values is to be owned: ```mojo # Result defaults to being an owned reference. fn getVec() -> Vec: # Equivalent to "...) -> Vec^" ... ``` because we otherwise have no way to return newly created values. Code can override the return convention by using another sigil, e.g. `inout Vec` if a mutable reference is required. We also need to decide what to do with arguments. We don’t want to copy arguments by default (a mistake Swift made), because this requires types to be copyable, and depends on unpredictable copy elision that makes performance and COW optimization sad. I don’t think we want to depend on pass-by-move like Rust did because Rust forces tons of things to be marked “&” pervasively, this introduces a ton of `memcpy` operations, and Python programmers won’t think that passing a value to a function makes it unavailable for use by other things by default. In my opinion, the C++ got this almost right: `const&` is the right default argument convention (and is optimized to register value passing in an opt-in way, described below). This is good for both self and value arguments and is what Swift semantically did with its +0 ownership convention in a bunch of places. Consider this example: ```mojo struct Dictionary: fn size(self) -> Int: ... ``` You don’t want to **copy the dictionary**, when calling size! This worked for Swift because of ARC optimizations and that its Dictionary type was a small thing implemented with COW optimizations, but this is very unpredictable. Passing arguments-by-borrow by default is also great because it eliminates the pervasive need to do a load operation when converting Lvalues to Rvalues. This is a huge improvement in the model, because “loading” a value is extremely expensive when the value is large or cannot be loaded (e.g. variable sized types, e.g. some languages representation for existential types and Rust’s DSTs, which we may or may not want to support anyway). It also means that we can support types like `std::atomic` which need a guaranteed ‘self’ address - natively and with no trouble - since we’re never trying to implicitly load the value as a whole. ## Adding support for value destruction Now that we have a notion of ownership, we can complete it by destroying values when their lifetime has ended. This requires introducing the ability to declare a destructor, and the machinery to determine when to invoke the destructor. ### User defined destructors We should embrace the existing Python convention of implementing the `__del__` method on a type. This takes ownership of the self value, so it should be defined as taking `owned self`. Here’s a reasonable implementation of Vec’s ctors and dtor, but without the push_back and associated methods (which are obvious): ``` struct Vec: var data: Pointer<Int> # I just made this type up. var capacity: Int var size: Int fn __init__(inout self, capacity: Int): self.data = Pointer<Int>.malloc(capacity) self.capacity = capacity self.size = 0 # default args will be nice some day fn __new__(inout self): return Vec(1) fn __del__(owned self): # owning reference to self. # Any int values don't need to be destroyed. self.data.free() ``` There is some nuance here and a special case that we need to handle in the `__del__` method. Ideally, we should track the field sensitive liveness of the ‘self’ member that comes into del. This will allow us to handle sub-elements that are individually consumed, safely handle exceptions that early-exit from the destructor etc. This is something that Swift gets right that Rust apparently doesn’t. With respect to the simple definition of Vec above, it is enough to define a safe vector of integers which is creatable, destroyable, can be passed by borrowed and mutable reference, but isn’t enough to support movability or copyability. We’ll add those later. ### When do we invoke destructors for value bindings? Now that we have a way to define a destructor for a value, we need to invoke it automatically. Where do we invoke the destructor for a local value binding? Two major choices exist: 1. End of scope, ala C++ (and I think Rust). 2. After last use, ala Swift and Val (but Val has a better model). The difference can be seen in cases like this: ```mojo fn bindingLifetimeExample(): var vec = Vec() vec.push_back(12) use(vec) # Val/Swift destroys 'vec' here. do_lots_of_other_stuff_unrelated_to_vec() # C++/Rust destroy vec here. ``` I would advocate for following the Swift model. It reduces memory use, and I haven’t seen it cause problems in practice - it seems like the right default. Furthermore, this dovetails well with ownership, because you want (e.g.) immutable borrows to die early so you can form mutable borrows in other statements. It also makes the “form references within a statement” special case in C++ go away. The tradeoff on this is that this could be surprising to C++ programmers, something that Swift faced as well. The balance to that is that GC languages with finalizers are not used for RAII patterns, and Python has first-class language support for RAII things (the `with` statement). There are specific cases like RAII that want predictable end-of-scope destruction, so you end up needing a `@preciseLifetime` decorator on the struct or use closures - [both work fine](https://developer.apple.com/documentation/swift/withextendedlifetime(_:_:)-31nv4). NOTE: This was pushed forward during implementation to the "ASAP" model that Mojo uses. ### Taking a value from a binding The other thing you may want to do is to intentionally end a binding early, transferring ownership of the bound value out as an owned rvalue. Swift and Rust both support mutable value lifetimes with holes in them, and ending immutable bindings early (Rust with the `drop(x)` operator or by moving out of the binding, Swift with the recently proposed [consume/take/move](https://github.com/apple/swift-evolution/blob/main/proposals/0366-move-function.md) operation). I propose supporting this with the `^` postfix operator, e.g.: ```mojo fn takeVec(owned v: Vec): ... fn showEarlyBindingEnd(): var vec = Vec() vec.push_back(12) takeVec(vec^) # Ownership of vec is transferred to takeVec. do_lots_of_other_stuff_unrelated_to_vec() var vec2 = Vec() vec2.push_back(12) ... _ = vec2^ # force drop vec2. ``` This is postfix so it composes better in expressions, e.g. “`someValue^.someConsumingMethod()`”. ### Supporting “taking” a value, with a convention (+ eventually a Trait) I believe it is important for common types to support a “destructive take” to support use-cases where you want to std::move an element out of the middle of a `std::vector`. C++ has `std::move` and move constructors for this, and Rust has a ton of complexity to work around the lack of this. Swift doesn’t appear to have a story for this yet. I think we just use a method convention (eventually formalized as a trait) where types who want it define a `take()` method: ``` struct Vec: ... fn __moveinit__(inout self, inout existing): # Steal the contents of 'existing' self.data = existing.data self.capacity = existing.capacity self.size = existing.size # Make sure 'existing's dtor doesn't do bad things. existing.data = None existing.size = 0 existing.capacity = 0 ``` This is analogous to defining a move constructor in C++. Note that you only need to define this if you want to support this operation, and we eventually should be able to synthesize this as a default implementation of the “Takable” trait when we build out traits and metaprogramming features. ## Value Lifetime Enforcement Now that we have all the mechanics in place, we actually have to check and enforce lifetime in the compiler. This entails a few bits and pieces. ### Implement a “Definitive Initialization” Like Pass: CheckLifetimes The first thing we need is a dataflow pass that tracks the initialization status of local bindings. The basic mechanics needed here are implemented in the Swift Definitive Initialization pass, and a lot of the mechanics are well described in the [Drop Flags section of the Rustonomicon](https://doc.rust-lang.org/nomicon/drop-flags.html) and [slide 135+ in this talk](https://www.llvm.org/devmtg/2015-10/slides/GroffLattner-SILHighLevelIR.pdf). This is a combination of static analysis and dynamically generated booleans. When building this, we have the choice to implement this in a field sensitive way. I believe that this is a good thing to do in the medium term, because that will allow making `__new__` and `__del__` methods much easier to work with in common cases, and will compose better when we get to classes. That said, we should start with simple non-field-sensitive cases and extend it over time. This is what we did when bringing up Swift and it worked fine. ### Implement support for variable exclusivity checking While it isn’t a high priority in the immediate future, we should also add support for variable exclusivity checking to detect dynamic situations where aliases are formed. See the [Swift proposal](https://github.com/apple/swift-evolution/blob/main/proposals/0176-enforce-exclusive-access-to-memory.md) for details on the issues involved here. Mojo will be working primarily with local variables in the immediate future, so we can get by with something very simple for the immediate future. ### Synthesize destructors for structs The other thing necessary in the basic model is for the destructors of field members to be run as part of `__del__` methods on structs. We don’t want people to have to write this manually, we should synthesize a `__del__` when needed. For example in: ```mojo struct X: var a: T1 var b: T2 fn __del__(owned self): # This should be synthesized. _ = self.a^ _ = self.b^ ``` ## Extensions to make the programming model nicer With the above support, we should have a system that is workable to cover the C++/Rust use-cases (incl `std::atomic` and `SmallVector`), handle the motivating Tensor type and Python interop, as well as provide a safe programming model (modulo dangling reference types which need lifetimes to support). That said, we still won’t have a super nice programming model, this includes some “table stakes” things we should include even though they are not strictly necessary. In particular, the support above completely eliminated the need to copy and move values, which is super pure, but it would be impractically painful to work with simple types that have trivial copy constructors. For example: ```mojo fn useIntegers(a: Int): var b = a+4 # ok, b gets owned value returned by plus operator. let c = b # error, cannot take ownership from an lvalue. let c2 = b.copy() # Ok, but laughable for Int. ``` It is worth saying that the “c = b” case is something that we explicitly want to prohibit for non-trivial types like vectors and dictionaries: Swift implicitly copies the values and relies on COW optimization and compiler heroics (which are not amazingly great in practice) to make it “work”. Rust handles it by moving the value away, which breaks value semantics and a programmer model that people expect from Python. It is better for vectors and Dictionary’s (IMO) to make this a compile time error, and say “this non-copyable type cannot be copied”. We can then standardize a `b.copy()` method to make the expense explicit in source code. ### Copy constructors for implicitly copyable types The solution to both of these problems is to allow types to opt-in to copyability (as in the Rust `Copy` trait). The obvious signature for this in Mojo seems to be a `__copyinit__` implementation (eventually formalized as a trait): ```mojo struct Int: var value: __mlir_type.index fn __copyinit__(inout self, borrowed existing: Int): self.value = existing.value ``` Given this new initializer, a type that implements this is opt-ing into being implicitly copied by the compiler. This (re)enables lvalue-to-rvalue conversion with a “load” operation, but makes it explicit in user source code. It allows integers to work like trivial values, and allows the library designer to take control of what types support implicit copies like this. This is also required for the Python interop “object” type, since we obviously want `x = y` to work for Python objects! One nice-to-have thing that we should get to eventually (as we build out support for traits and metaprogramming) is `Copyable` trait with a default implementation. This would allow us to manually provide a copy constructor if we want above, or get a default synthesized one just by saying that our struct is `Copyable`. See the appendix at the end of the document for more explanation of how this composes together. All together, I believe this will provide a simple and clean programming model that is much more predictable than the C++ style, and is more powerful than the Swift or Rust designs, which don’t allow custom logic. ### Opting into pass-by-register parameter convention The final problem we face is the inefficiency of passing small values by-reference everywhere. This is a problem that is internalized by C++ programmers through common wisdom (“pass complex values like `std::vector` as `const& or rvalue-ref` but trivial values like `int` by value!”), but ends up being a problem for some generic templated code - e.g. `std::vector` needs to declare many things as being passed by `const&` or rvalue reference, which becomes inefficient when instantiated for trivial types. There are ways to deal with this in C++, but it causes tons of boilerplate and complexity. The key insight I see here is that the decision is specific to an individual type, and should therefore be the decision of the type author. I think the simple way to handle this is to add a struct decorator that opts the struct into being passed by owning copy, equivalent to the Rust Copy convention: ```mojo @register_passable struct Int: ... ``` This decorator would require that the type have a copy constructor declared, and it uses that copy constructor in the callee side of an API to pass arguments by-register and return by-register. This would lead to an efficient ABIs for small values. This decorator should only be used on small values that makes sense to pass in registers or on the stack (e.g. 1-3 machine registers), and cannot be used on types like `llvm::SmallVector` that have interior pointers (such a type doesn’t make sense to pass by-register anyway!). # Conclusion This proposal attempts to synthesize ideas from a number of well known systems into something that will fit well with Mojo, be easy to use, and easy to teach - building on the Python ideology of “reducing magic”. It provides equivalent expressive power to C++, while being a building block to provide the full power for Rust-style lifetimes. ## Parameter Conventions Summary This is the TL;DR: summary of what I think we end up with: ```mojo fn borrow_it(a: X) # takes X as borrow (sugar). fn borrow_it(borrowed a: X) # takes X as borrow. fn take_it(owned a: X) # takes owned X fn ref_it(inout a: X) # takes mutable reference to X fn register_it(a: Int) # by copy when Int is register-passable. fn ret_owned(self) -> X: # Return an owned X (sugar). fn ret_owned(self) -> owned X: # Return an owned X. fn ret_borrow(self) -> borrowed X: # Return an X as a borrow fn ret_ref(self) -> inout X: # Return an X as a mutable ref fn ret_register(self) -> Int: # Return by copy when Int is register-passable ``` ## Extension for Lifetime types Lifetimes are necessary to support memory safety with non-trivial correlated lifetimes, and have been pretty well proven in the Rust world. They will require their own significant design process (particularly to get the defaulting rules) and will benefit from getting all of the above implemented. That said, when we get to them, I believe they will fit naturally into the Mojo and MLIR design. For example, you could imagine things like this: ```mojo # Take a non-copyable SomeTy as a borrow and return owned copy fn life_ex1['a: lifetime](value: 'a SomeTy) -> SomeTy: return value.copy() # Take a non-copyable SomeTy and return the reference fn life_ex2['a: lifetime](value: 'a SomeTy) -> borrowed 'a SomeTy: return value ``` This is not a concrete syntax proposal, just a sketch. A full design is outside the scope of this proposal though, it should be a subsequent one. # Appendix: Decorators and Type Traits Above we talk loosely about decorators and type traits. A decorator in Python is a modifier for a type or function definition. A Trait in Rust (aka protocol in Swift, aka typeclass in Haskell) is a set of common behavior that unifies types - sort of like an extended Java interface. Let’s see how these two concepts can come together in the future assuming we get Swift/Rust-style traits and extend Python’s decorator concept with metaprogramming features enabled by Mojo. Traits include “requirements”: signatures that conforming types are required to have, and may also include default implementations for those. The type can implement it manually if they want, but can also just inherit the default implementation if not. Let’s consider copy-ability. This isn’t a standard library proposal, but we could implement some copy traits like this: ```mojo trait Copyable: # Just a signature, no body. fn copy(self) -> Self: ... trait ImplicitlyCopyable(Copyable): # Could use a better name :) # A __copyinit__ is required, and this is the default implementation. fn __copyinit__(inout self, borrowed existing: Self): self = existing.copy() ``` Type may conform to the `Copyable` trait, which allows generic algorithms to know it has a `copy()` method. Similarly, they may conform to `ImplicitlyCopyable` to know it is implicitly copable (supports “`let a = b`”). `ImplicitlyCopyable` requires the type to have a `copy()` method (because `ImplicitlyCopyable` refines `Copyable`) and a `__copyinit__` method with the specified signatures, and also provides a default implementation of the `__copyinit__` method. This allows types to use it like this: ```mojo struct Int(ImplicitlyCopyable): var value: __mlir_type.index fn copy(self: Self) -> Self: return Int{value: self.value} # Don't have to write this, we get a default impl from ImplicitlyCopyable # fn __copyinit__(inout self, borrowed existing: Self): # self = existing.copy() ``` This allows clients to implement a simple `copy()` method, but get the internal machinery for free. The decorator is a different thing that layers on top of it. Decorators in Python are functions that use metaprogramming to change the declaration they are attached to. Python does this with dynamic metaprogramming, but we’ll use the interpreter + builtins operations to also enable static metaprogramming in Mojo. I'm imagining that this will allow someone to write just: ```mojo @implicitlyCopyable struct Int: var value : __mlir_type.index ``` And the `implicitlyCopyable` function (which implements the decorator) would be implemented to do two things: 1. When it understands all the stored properties of a copy, because they are builtin MLIR types like index, or because they themselves conform to at least `Copyable`, it synthesizes an implementation of a `copy()` method that builds a new instance of the type by invoking the `copy()` member for each element. 2. It adds conformance to the `ImplicitlyCopyable` trait, which provides the `__copyinit__` method above. This is all precedented in languages like Swift and Rust, but they both lack the metaprogramming support to make the decorator synthesis logic implementable in the standard library. Swift does this for things like the Hashable and `Equatable` protocols. I believe that Mojo will be able to support much nicer and more extensible designs. NOTE: The `@value` decorator provides some of this now. --- .gitignore --- .vscode/ main.mojo setup_headers.py test.py --- CITATION.cff --- cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Fehrenbach" given-names: "Tillmann" orcid: "https://orcid.org/0009-0001-4831-9729" title: "Endia" version: 24.4.1 doi: "10.5281/zenodo.12810766" date-released: 2024-08-01 url: "https://github.com/endia-org/Endia" license: Apache-2.0 with LLVM-exception keywords: - "scientific computing" - "Mojo" - "compiler" - "machine learning" repository-code: "https://github.com/endia-org/Endia" abstract: "Endia is an open-source project for scientific computing in Mojo, aiming to provide high-performance numerical methods and tools for researchers and developers." --- CONTRIBUTING.md --- # Contributing Guide Thank you for your interest in contributing to our project! We use a nightly branch for ongoing development and merge into the main branch for major releases. Here are our guidelines: ## Branch Structure - `main`: Stable branch for releases - `nightly`: Active development branch ## Development Workflow 1. Fork the repository and clone it locally. 2. Create a new branch from `nightly` for your feature or bugfix: ``` git checkout nightly git pull origin nightly git checkout -b feature/your-feature-name ``` 3. Make your changes and commit them with clear, concise commit messages. 4. Push your changes to your fork: ``` git push origin feature/your-feature-name ``` 5. Open a pull request against the `nightly` branch. ## Nightly Branch Best Practices - Always base your work on the latest `nightly` branch. - Regularly sync your fork with the upstream `nightly` branch: ``` git checkout nightly git fetch upstream git merge upstream/nightly git push origin nightly ``` - Keep your feature branches short-lived and focused. - Rebase your feature branch onto `nightly` before submitting a pull request: ``` git checkout feature/your-feature-name git rebase nightly ``` ## Reporting Issues - Use the issue tracker for bugs or feature requests. - Check if the same issue already exists before creating a new one. - Include as much information as possible in your issue report. ## Submitting Pull Requests - Ensure your code adheres to our coding standards. - Include unit tests for new features or bug fixes. - Make sure all tests pass before submitting a pull request. - Include a clear and detailed description of the changes. - Link relevant issues in your pull request description. ## Code Review Process - At least one core maintainer will review your pull request. - Address any comments or requested changes promptly. - Once approved, a maintainer will merge your pull request into the `nightly` branch. ## Release Process - Periodically, we will merge the `nightly` branch into `main` for a new release. - Contributors should not directly merge or push to the `main` branch. We appreciate your contributions and look forward to seeing your pull requests! --- LICENSE --- ============================================================================================== The Endia repository is licensed under the Apache License v2.0 with LLVM Exceptions: ============================================================================================== Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---- LLVM Exceptions to the Apache 2.0 License ---- As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into an Object form of such source code, you may redistribute such embedded portions in such Object form without complying with the conditions of Sections 4(a), 4(b) and 4(d) of the License. In addition, if you combine or link compiled forms of this Software with software that is licensed under the GPLv2 ("Combined Software") and if a court of competent jurisdiction determines that the patent provision (Section 3), the indemnity provision (Section 9) or other Section of the License conflicts with the conditions of the GPLv2, you may retroactively and prospectively choose to deem waived or otherwise exclude such Section(s) of the License, but only in their entirety and only with respect to the Combined Software. ============================================================================== Software from third parties included in the LLVM Project: ============================================================================== The LLVM Project contains third party software which is under different license terms. All such code will be identified clearly using at least one of two mechanisms: 1) It will be in a separate directory tree with its own `LICENSE.txt` or `LICENSE` file at the top containing the specific license and restrictions which apply to that software, or 2) It will contain specific license and restriction terms at the top of every file. --- README.md --- <div align="center"> <img src="./assets/title_image.png" alt="Endia Title Image" /> </div> ### **Endia** is a dynamic Array library for Scientific Computing, similar to PyTorch, Numpy and JAX. It offers: - **Automatic differentiation**: Compute derivatives of arbitrary order. - **Complex number support:** Use Endia for advanced scientific applications. - **Dual API:** Choose between a PyTorch-like imperative or a JAX-like functional interface. - **JIT Compilation:** Leverage MAX to speed up training and inference. <div align="center"> [Website] | [Docs] | [Getting Started] [Website]: https://endia.vercel.app/ [Docs]: https://endia.vercel.app/docs/array [Getting Started]: https://endia.vercel.app/docs/get_started </div> ## Installation 1. **Install [Mojo and MAX](https://docs.modular.com/max/install)** 🔥 (v24.4) Optional but recommended: Install the [nightly version of Mojo](https://docs.modular.com/max/install#install-nightly-builds) to access Endia's most up-to-date features, such as the FFT module. > Note: To use these cutting-edge features, you'll need to switch to Endia's nightly branch (see step 2). 2. **Clone the repository**: Choose one of the following options to clone the repository: ```bash git clone https://github.com/endia-org/Endia.git cd Endia ``` If you aim to use the nightly (development) version, switch to the `nightly` branch: ```bash git checkout nightly ``` 3. **Set Up Environment**: ```bash chmod +x setup.sh ./setup.sh ``` Required dependencies: `torch`, `numpy`, `graphviz`. These will be installed automatically by the setup script. ## Endia's truly minimalistic Stack <div align="center"> <img src="./assets/endia_stack_concept.png" alt="Endia Stack concept Image" style="max-width: 800px;"/> </div> #### ## A tiny example In this guide, we'll demonstrate how to compute the **value**, **gradient**, and the **Hessian** (i.e. the second-order derivative) of a simple function. First by using Endia's Pytorch-like API and then by using a more Jax-like functional API. In both examples, we initially define a function **foo** that takes an array and returns the sum of the squares of its elements. ### The **Pytorch** way <!-- markdownlint-disable MD033 --> <p align="center"> <a href="https://pytorch.org/docs/stable/index.html"> <img src="assets/pytorch_logo.png" alt="Endia Logo" width="40"> </a> </p> When using Endia's imperative (PyTorch-like) interface, we compute the gradient of a function by calling the **backward** method on the function's output. This imperative style requires explicit management of the computational graph, including setting `requires_grad=True` for the input arrays (i.e. leaf nodes) and using `create_graph=True` in the backward method when computing higher-order derivatives. ```python from endia import Tensor, sum, arange import endia.autograd.functional as F # Define the function def foo(x: Tensor) -> Tensor: return sum(x ** 2) def main(): # Initialize variable - requires_grad=True needed! x = arange(1.0, 4.0, requires_grad=True) # [1.0, 2.0, 3.0] # Compute result, first and second order derivatives y = foo(x) y.backward(create_graph=True) dy_dx = x.grad() d2y_dx2 = F.grad(outs=sum(dy_dx), inputs=x)[0] # Print results print(y) # 14.0 print(dy_dx) # [2.0, 4.0, 6.0] print(d2y_dx2) # [2.0, 2.0, 2.0] ``` ### The **JAX** way <!-- markdownlint-disable MD033 --> <p align="center"> <a href="https://jax.readthedocs.io/en/latest/quickstart.html"> <img src="assets/jax_logo.png" alt="Endia Logo" width="65"> </a> </p> When using Endia's functional (JAX-like) interface, the computational graph is handled implicitly. By calling the `grad` or `jacobian` function on foo, we create a `Callable` which computes the full Jacobian matrix. This `Callable` can be passed to the `grad` or `jacobian` function again to compute higher-order derivatives. ```python from endia import grad, jacobian from endia.numpy import sum, arange, ndarray def foo(x: ndarray) -> ndarray: return sum(x**2) def main(): # create Callables for the first and second order derivatives foo_jac = grad(foo) foo_hes = jacobian(foo_jac) x = arange(1.0, 4.0) # [1.0, 2.0, 3.0] print(foo(x)) # 14.0 print(foo_jac(x)[ndarray]) # [2.0, 4.0, 6.0] print(foo_hes(x)[ndarray]) # [[2.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 2.0]] ``` *And there is so much more! Endia can handle complex valued functions, can perform both forward and reverse-mode automatic differentiation, it even has a builtin JIT compiler to make things go brrr. Explore the full **list of features** in the [documentation](https://endia.org).* ## Why another ML framework? - 🧠 **Advance AI & Scientific Computing:** Push boundaries with clear and understandable algorithms - 🚀 **Mojo-Powered Clarity:** High-performance open-source code that remains readable and pythonic through and through - 📐 **Explainability:** Prioritize clarity and educational value over exhaustive features *"Nothing in life is to be feared, it is only to be understood. Now is the time to understand more, so that we may fear less."* - Marie Curie ## Contributing Contributions to Endia are welcome! If you'd like to contribute, please follow the contribution guidelines in the [CONTRIBUTING.md](https://github.com/endia-org/Endia/blob/main/CONTRIBUTING.md) file in the repository. ## Citation If you use Endia in your research or project, please cite it as follows: ```bibtex @software{Fehrenbach_Endia_2024, author = {Fehrenbach, Tillmann}, license = {Apache-2.0 with LLVM Exceptions}, doi = {10.5281/zenodo.12810766}, month = jul, title = {{Endia}}, url = {https://github.com/endia-org/Endia}, version = {24.4.2}, year = {2024} } ``` ## License Endia is licensed under the [Apache-2.0 license with LLVM Exeptions](https://github.com/endia-org/Endia/blob/main/LICENSE). --- benchmarks/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .random_benchmarks import * from .mlp_benchmarks import * --- benchmarks/mlp_benchmarks/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .mlp_imp import * from .mlp_func import * from .mlp_jit import * from .mlp_jit_MAX import * --- benchmarks/mlp_benchmarks/mlp_func.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd import endia.nn as nn import endia.optim as optim from endia.utils import dtype import math from time import now def fill_sin_(inout curr: nd.Array, arg: nd.Array): """ Inplace fill the current array with normalized sin values. """ for i in range(arg.size()): curr.store(i, math.sin(50 * (arg.load(i) + 1) / 2)) def setup_params( x: nd.Array, y: nd.Array, hidden_dims: List[Int] ) -> List[nd.Array]: """ Setup the parameters for the MLP model as a list of arrays. """ params = List[nd.Array]() params.append(x) params.append(y) num_layers = len(hidden_dims) - 1 for i in range(num_layers): weight = nd.rand_he_normal( List(hidden_dims[i], hidden_dims[i + 1]), fan_in=hidden_dims[i], ) bias = nd.rand_he_normal( List(hidden_dims[i + 1]), fan_in=hidden_dims[i], ) params.append(weight) params.append(bias) return params def benchmark_mlp_func(): print("\nRunning MLP benchmark in a functional eager mode with grad:") # define the forward function def fwd(args: List[nd.Array]) -> nd.Array: target = args[1] pred = nn.mlp(args) loss = nd.mse(pred, target) return loss # define the training loop batch_size = 128 lr = 0.001 beta1 = 0.9 beta2 = 0.999 eps = 1e-8 num_iters = 2000 every = 500 avg_loss = SIMD[dtype, 1](0) # setup input, target, params and velocity x = nd.Array(List(batch_size, 1)) y = nd.Array(List(batch_size, 1)) hidden_dims = List(1, 32, 64, 128, 128, 128, 64, 32, 1) args = setup_params(x, y, hidden_dims) m = List[nd.Array]() v = List[nd.Array]() for i in range(len(args)): m.append(nd.zeros_like(args[i])) v.append(nd.zeros_like(args[i])) # setup fwd and grad function as one call value_and_grad_fwd = nd.value_and_grad(fwd) # setup time variables start = Float64(0) end = Float64(0) time_all = Float64(0) fwd_start = Float64(0) fwd_end = Float64(0) time_fwd = Float64(0) grad_start = Float64(0) grad_end = Float64(0) time_grad = Float64(0) optim_start = Float64(0) optim_end = Float64(0) time_optim = Float64(0) # training loop for t in range(1, num_iters + 1): start = now() # fill input and target inplace nd.randu_(args[0]) fill_sin_(args[1], args[0]) # compute loss fwd_start = now() value_and_grad = value_and_grad_fwd(args)[List[List[nd.Array]]] fwd_end = now() loss = value_and_grad[0][0] avg_loss += loss.load(0) args_grads = value_and_grad[1] # update weights and biases inplace optim_start = now() for i in range(2, len(args_grads)): # implement adam with above variables as in the step function above m[i] = beta1 * m[i] + (1 - beta1) * args_grads[i] v[i] = beta2 * v[i] + (1 - beta2) * args_grads[i] * args_grads[i] m_hat = m[i] / (1 - beta1**t) v_hat = v[i] / (1 - beta2**t) args[i] -= lr * m_hat / (nd.sqrt(v_hat) + eps) optim_end = now() end = now() time_fwd += (fwd_end - fwd_start) / 1000000000 time_optim += (optim_end - optim_start) / 1000000000 time_all += (end - start) / 1000000000 # print loss if t % every == 0: print("- Iter: ", t, " Loss: ", avg_loss / every) avg_loss = 0 print( " Total: ", time_all / every, " Value_and_Grad: ", time_fwd / every, " Optim: ", time_optim / every, ) time_all = 0 time_fwd = 0 time_optim = 0 --- benchmarks/mlp_benchmarks/mlp_imp.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd import endia.nn as nn import endia.optim as optim from time import now def fill_sin_(inout curr: nd.Array, arg: nd.Array): for i in range(arg.size()): curr.store(i, math.sin(50 * (arg.load(i) + 1) / 2)) def benchmark_mlp_imp(): print("\nRunning MLP benchmark in eager mode.") batch_size = 128 num_iters = 2000 every = 500 avg_loss = SIMD[dtype, 1](0) x = nd.Array(List(batch_size, 1)) y = nd.Array(List(batch_size, 1)) mlp = nn.MLP( List(1, 32, 64, 128, 128, 128, 64, 32, 1), compute_backward=True ) optimizer = optim.Adam( mlp.params(), lr=0.001, beta1=0.9, beta2=0.999, eps=1e-8 ) fwd_time = Float64(0) bwd_time = Float64(0) opt_time = Float64(0) end_time = Float64(0) for i in range(1, num_iters + 1): start = now() start_init = now() nd.randu_(x, min=0, max=1) fill_sin_(y, x) end_init = now() start_fwd = now() pred = mlp.forward(x) loss = nd.mse(pred, y) end_fwd = now() if i == 1: nd.utils.visualize_graph(loss, "./assets/mlp_imp_graph") avg_loss += loss.load(0) start_bwd = now() loss.backward() end_bwd = now() start_opt = now() optimizer.step() end_opt = now() zero_grad_time_start = now() loss.zero_grad() zero_grad_time_end = now() end = now() fwd_time += (end_fwd - start_fwd) / 1000000000 bwd_time += (end_bwd - start_bwd) / 1000000000 opt_time += (end_opt - start_opt) / 1000000000 end_time += (end - start) / 1000000000 if i % every == 0: print("- Iter: ", i, " Loss: ", avg_loss / every) avg_loss = 0 fwd_time /= every bwd_time /= every opt_time /= every end_time /= every print( " Total:", end_time, "Fwd: ", fwd_time, " Bwd: ", bwd_time, " Optim: ", opt_time, ) init_time = 0 fwd_time = 0 bwd_time = 0 opt_time = 0 zero_grad_time = 0 end_time = 0 --- benchmarks/mlp_benchmarks/mlp_jit.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd import endia.nn as nn import endia.optim as optim from endia.utils import dtype import math from time import now def fill_sin_(inout curr: nd.Array, arg: nd.Array): """ Inplace fill the current array with normalized sin values. """ for i in range(arg.size()): curr.store(i, math.sin(50 * (arg.load(i) + 1) / 2)) def setup_params( x: nd.Array, y: nd.Array, hidden_dims: List[Int] ) -> List[nd.Array]: """ Setup the parameters for the MLP model as a list of arrays. """ params = List[nd.Array]() params.append(x) params.append(y) num_layers = len(hidden_dims) - 1 for i in range(num_layers): weight = nd.rand_he_normal( List(hidden_dims[i], hidden_dims[i + 1]), fan_in=hidden_dims[i], ) bias = nd.rand_he_normal( List(hidden_dims[i + 1]), fan_in=hidden_dims[i], ) params.append(weight) params.append(bias) return params def benchmark_mlp_jit(): print("\nRunning MLP benchmark with MAX JIT compilation:") # define the forward function def fwd(args: List[nd.Array]) -> nd.Array: target = args[1] pred = nn.mlp(args) loss = nd.mse(pred, target) return loss # define the training loop batch_size = 128 lr = 0.001 beta1 = 0.9 beta2 = 0.999 eps = 1e-8 num_iters = 2000 every = 500 avg_loss = SIMD[dtype, 1](0) # setup input, target, params and velocity x = nd.Array(List(batch_size, 1)) y = nd.Array(List(batch_size, 1)) hidden_dims = List(1, 32, 64, 128, 128, 128, 64, 32, 1) args = setup_params(x, y, hidden_dims) m = List[nd.Array]() v = List[nd.Array]() for i in range(len(args)): m.append(nd.zeros_like(args[i])) v.append(nd.zeros_like(args[i])) # setup fwd and grad function as one call value_and_grad_fwd = nd.jit(nd.value_and_grad(fwd), compile_with_MAX=True) # setup time variables start = Float64(0) end = Float64(0) time_all = Float64(0) fwd_start = Float64(0) fwd_end = Float64(0) time_fwd = Float64(0) grad_start = Float64(0) grad_end = Float64(0) time_grad = Float64(0) optim_start = Float64(0) optim_end = Float64(0) time_optim = Float64(0) # training loop for t in range(1, num_iters + 1): start = now() # fill input and target inplace nd.randu_(args[0]) fill_sin_(args[1], args[0]) # compute loss fwd_start = now() value_and_grad = value_and_grad_fwd(args)[List[List[nd.Array]]] fwd_end = now() loss = value_and_grad[0][0] avg_loss += loss.load(0) args_grads = value_and_grad[1] # update weights and biases inplace optim_start = now() for i in range(2, len(args_grads)): # implement adam with above variables as in the step function above m[i] = beta1 * m[i] + (1 - beta1) * args_grads[i] v[i] = beta2 * v[i] + (1 - beta2) * args_grads[i] * args_grads[i] m_hat = m[i] / (1 - beta1**t) v_hat = v[i] / (1 - beta2**t) args[i] -= lr * m_hat / (nd.sqrt(v_hat) + eps) optim_end = now() end = now() time_fwd += (fwd_end - fwd_start) / 1000000000 time_optim += (optim_end - optim_start) / 1000000000 time_all += (end - start) / 1000000000 # print loss if t % every == 0: print("- Iter: ", t, " Loss: ", avg_loss / every) avg_loss = 0 print( " Total: ", time_all / every, " Value_and_Grad: ", time_fwd / every, " Optim: ", time_optim / every, ) time_all = 0 time_fwd = 0 time_optim = 0 --- benchmarks/mlp_benchmarks/mlp_jit_MAX.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd import endia.nn as nn import endia.optim as optim from endia.utils import dtype import math from time import now def fill_sin_(inout curr: nd.Array, arg: nd.Array): """ Inplace fill the current array with normalized sin values. """ for i in range(arg.size()): curr.store(i, math.sin(50 * (arg.load(i) + 1) / 2)) def setup_params( x: nd.Array, y: nd.Array, hidden_dims: List[Int] ) -> List[nd.Array]: """ Setup the parameters for the MLP model as a list of arrays. """ params = List[nd.Array]() params.append(x) params.append(y) num_layers = len(hidden_dims) - 1 for i in range(num_layers): weight = nd.rand_he_normal( List(hidden_dims[i], hidden_dims[i + 1]), fan_in=hidden_dims[i], ) bias = nd.rand_he_normal( List(hidden_dims[i + 1]), fan_in=hidden_dims[i], ) params.append(weight) params.append(bias) return params def benchmark_mlp_jit_with_MAX(): print("\nRunning MLP benchmark with MAX JIT compilation:") # define the forward function def fwd(args: List[nd.Array]) -> nd.Array: target = args[1] pred = nn.mlp(args) loss = nd.mse(pred, target) return loss # define the training loop batch_size = 128 lr = 0.001 beta1 = 0.9 beta2 = 0.999 eps = 1e-8 num_iters = 2000 every = 500 avg_loss = SIMD[dtype, 1](0) # setup input, target, params and velocity x = nd.Array(List(batch_size, 1)) y = nd.Array(List(batch_size, 1)) hidden_dims = List(1, 32, 64, 128, 128, 128, 64, 32, 1) args = setup_params(x, y, hidden_dims) m = List[nd.Array]() v = List[nd.Array]() for i in range(len(args)): m.append(nd.zeros_like(args[i])) v.append(nd.zeros_like(args[i])) # setup fwd and grad function as one call value_and_grad_fwd = nd.jit(nd.value_and_grad(fwd), compile_with_MAX=False) # setup time variables start = Float64(0) end = Float64(0) time_all = Float64(0) fwd_start = Float64(0) fwd_end = Float64(0) time_fwd = Float64(0) grad_start = Float64(0) grad_end = Float64(0) time_grad = Float64(0) optim_start = Float64(0) optim_end = Float64(0) time_optim = Float64(0) # training loop for t in range(1, num_iters + 1): start = now() # fill input and target inplace nd.randu_(args[0]) fill_sin_(args[1], args[0]) # compute loss fwd_start = now() value_and_grad = value_and_grad_fwd(args)[List[List[nd.Array]]] fwd_end = now() loss = value_and_grad[0][0] avg_loss += loss.load(0) args_grads = value_and_grad[1] # update weights and biases inplace optim_start = now() for i in range(2, len(args_grads)): # implement adam with above variables as in the step function above m[i] = beta1 * m[i] + (1 - beta1) * args_grads[i] v[i] = beta2 * v[i] + (1 - beta2) * args_grads[i] * args_grads[i] m_hat = m[i] / (1 - beta1**t) v_hat = v[i] / (1 - beta2**t) args[i] -= lr * m_hat / (nd.sqrt(v_hat) + eps) optim_end = now() end = now() time_fwd += (fwd_end - fwd_start) / 1000000000 time_optim += (optim_end - optim_start) / 1000000000 time_all += (end - start) / 1000000000 # print loss if t % every == 0: print("- Iter: ", t, " Loss: ", avg_loss / every) avg_loss = 0 print( " Total: ", time_all / every, " Value_and_Grad: ", time_fwd / every, " Optim: ", time_optim / every, ) time_all = 0 time_fwd = 0 time_optim = 0 --- benchmarks/random_benchmarks/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .foo_benchmark1 import * --- benchmarks/random_benchmarks/foo_benchmark1.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python from time import now def foo(args: List[nd.Array]) -> nd.Array: a = args[0] b = args[1] c = args[2] return nd.sum( nd.mul( nd.cos(nd.sin(nd.cos(nd.cos(nd.add(nd.matmul(a, b), c))))), nd.matmul(a, b), ) ) def benchmark_foo_grad( msg: String = "foo", warmup_runs: Int = 5, num_runs: Int = 10 ): # args initialization requires_grad = True a = nd.arange(0, 300 * 400, requires_grad).reshape(List(300, 400)) b = nd.arange(0, 2 * 400 * 500, requires_grad).reshape(List(2, 400, 500)) c = nd.arange(0, 2 * 300 * 500, requires_grad).reshape(List(2, 300, 500)) args = List(a, b, c) # warm up for _ in range(warmup_runs): res = foo(args) res.backward() res.zero_grad() # functional calls total_time_forward = 0 total_time_backward = 0 for _ in range(num_runs): start = now() res = foo(args) end = now() # backward pass start2 = now() res.backward() end2 = now() # zero the gradients in the computation graph res.zero_grad() total_time_forward += end - start total_time_backward += end2 - start2 print( "\033[36mBenchmark:\033[0m", msg, "forward:", (total_time_forward / num_runs) / 1000000000, ) print( " ", msg, "backward:", (total_time_backward / num_runs) / 1000000000, ) --- benchmarks/readme.md --- --- benchmarks/run_benchmarks.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from benchmarks import * def run_benchmarks(): # benchmark_foo_grad() benchmark_mlp_imp() benchmark_mlp_func() benchmark_mlp_jit() benchmark_mlp_jit_with_MAX() --- changelog.md --- # Endia - Changelog ## Branch: Nightly, Version: 24.4.1. ### **New** - Adding more primitive operations to the MAX graph utils. - Added a JIT mlp benchmark without MAX in mlp_jit.mojo. Renamed the file with the JIT with MAX mlp benchmark to mlp_jit_with_MAX.mojo. - Adding spacial operations: conv1d, conv2d, conv3d, max_pool1d, max_pool2d, max_pool3d, avg_pool1d, avg_pool2d, avg_pool3d. No MAX conversion yet. (TODO!) - Adding the corresponding tests for the spacial operations. No edge case testing yet. (TODO!) ### **Changed** - Changed atol ro rtol in close_to function in utils module. This function is used to compare an Endia Array with a PyTorch Tensor. Using atol resulted in a lot of test failures, using rtol makes a bit more sense here, since small numerical errors are expected. - Changed the vjp and jvp function of the relu acitvation function to use the greater_equal method instead of the ge_zeo method. - In benchmarks, changed the loss and timing output to not average over the first til the last iteration, but show these values for every 500th interation. It seemed that the JIT version with MAX was consistently showing smaller loss, but with this new, more fine-grained output, it is clear that this is not the case, which is a releave. - Changed the dim sizes in most tests from values smaller than the minimum simd width value (possibly 8 or 16) to values larger than the minimum simd width value. All adapted test pass as well. ### **Fixed** --- endia/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from ._array import * from .functional import * from .compile import * from .autograd import * --- endia/_array/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from ._array import * --- endia/_array/_array.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia.utils.aliases import dtype, nelts from endia.utils import ( ArrayShape, ShapeNode, float_to_string, extract_array, zero_grad_rec, reset_node_id_recursive, InplaceInfo, build_out_string, compute_shape, ) from endia.compile import FxGraph from endia.functional import * from endia.functional._utils import execute_copy_raw from memory.arc import Arc from algorithm import vectorize, parallelize from time import now from random import seed, random_ui64 import math from python import Python fn default_fwd(inout curr: Array, args: List[Array]) raises -> None: print("Attention: Default fwd is being used!") pass fn default_vjp( primals: List[Array], grad: Array, out: Array ) raises -> List[Array]: print("Attention: Default vjp is being used!") return grad fn default_jvp(primals: List[Array], tangents: List[Array]) raises -> Array: print("Attention: Default jvp is being used!") return tangents[0] @value struct Node(CollectionElement): """ Node is the central data structure representing an array in the autograd engine. It is responsible for encapsulating all the necessary information and metadata related to an array, including its shape, data, operations, gradients, and dependencies. """ var id: Int var name: String var shape: Arc[ShapeNode] var data: DTypePointer[dtype] var is_view: Bool var base: List[Arc[Self]] var args: List[Arc[Self]] var kwargs: List[Arc[Self]] var grads: List[Arc[Self]] var fwd: fn (inout Array, List[Array]) raises -> None var uew: List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ] var bew: List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ] var simd_op_list: List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ] var inplace_infos: List[InplaceInfo] var jvp: fn (List[Array], List[Array]) raises -> Array var vjp: fn (List[Array], Array, Array) raises -> List[Array] var requires_grad: Bool var compute_jvp: Bool var graph: Optional[Arc[FxGraph]] var id_in_graph: Optional[Int] var has_real: Bool var has_imag: Bool fn __init__( inout self, array_shape: ArrayShape, requires_grad: Bool = False, is_complex: Bool = False, ): self.id = -1 self.name = "arg" self.shape = array_shape.shape_node var true_size = array_shape.size() if not is_complex else 2 * array_shape.size() self.data = DTypePointer[dtype].alloc(true_size) memset_zero(self.data, true_size) self.is_view = False self.base = List[Arc[Node]]() self.args = List[Arc[Self]]() self.kwargs = List[Arc[Self]]() self.grads = List[Arc[Self]]() self.fwd = default_fwd self.uew = List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ]() self.bew = List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ]() self.inplace_infos = List[InplaceInfo]() self.jvp = default_jvp self.vjp = default_vjp self.simd_op_list = List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ]() self.requires_grad = requires_grad self.compute_jvp = False self.graph = None self.id_in_graph = None self.has_real = True self.has_imag = is_complex fn __del__(owned self): # print("Node __del__") self.data.free() ############################################################################################################### # Array ############################################################################################################### @value struct Array(CollectionElement, Stringable): """ Array is the primary data structure in the autograd engine, providing a user-friendly interface for working with arrays. It serves as a wrapper around the Node struct, which encapsulates the array's data, shape, gradients, and other metadata. """ var node: Arc[Node] fn __init__( inout self, shape: List[Int], requires_grad: Bool = False, is_complex: Bool = False, ): self.node = Arc(Node(shape, requires_grad, is_complex)) fn __init__(inout self, array_shape: ArrayShape): self.node = Arc[Node](Node(array_shape.shape_node)) fn __copyinit__(inout self, other: Self): self.node = other.node fn __moveinit__(inout self, owned other: Self): self.node = other.node^ fn __init__(inout self, node: Arc[Node]): self.node = node fn __init__( inout self, input_string: String, requires_grad: Bool = False ) raises: self = extract_array(input_string) self.requires_grad_(requires_grad) fn id(self) -> Int: return self.node[].id fn id_(inout self, id: Int): self.node[].id = id fn array_shape(self) raises -> ArrayShape: return ArrayShape(self.node[].shape) fn array_shape_(inout self, shape: ArrayShape): self.node[].shape[].shape = shape.shape_node[].shape self.node[].shape[].stride = shape.shape_node[].stride self.node[].shape[].storage_offset = shape.shape_node[].storage_offset self.node[].shape[].ndim = shape.shape_node[].ndim self.node[].shape[].size = shape.shape_node[].size self.node[].shape[].is_computed = shape.shape_node[].is_computed fn is_computed(self) -> Bool: return self.node[].shape[].is_computed fn is_computed_(inout self, is_computed: Bool): self.node[].shape[].is_computed = is_computed fn is_graph_node_computed(self) raises -> Bool: if self.has_fxgraph(): var graph = self.graph() var id_in_graph = self.id_in_graph() return graph[].trace[id_in_graph].is_computed return False fn is_graph_node_computed_(inout self, is_computed: Bool) raises: if self.has_fxgraph(): var graph = self.graph() var id_in_graph = self.id_in_graph() graph[].trace[id_in_graph].is_computed = is_computed fn postpone_as_grpah_output(inout self) raises: if self.has_fxgraph(): var graph = self.graph() var id_in_graph = self.id_in_graph() var posponed_outputs = graph[].postponed_outputs if not id_in_graph in posponed_outputs: graph[].postponed_outputs.append(id_in_graph) fn args(self) -> List[Array]: var res = List[Array]() for arg in self.node[].args: res.append(Array(arg[])) return res fn args_(inout self, args: List[Array]): self.node[].args.clear() for arg in args: self.node[].args.append(arg[].node) fn clear_args(inout self): self.node[].args.clear() self.node[].shape[].args.clear() fn remove_grad(inout self): self.node[].grads.clear() fn kwargs(self) -> List[Array]: var res = List[Array]() for arg in self.node[].kwargs: res.append(Array(arg[])) return res fn kwargs_(inout self, kwargs: List[Array]): for arg in kwargs: self.node[].kwargs.append(arg[].node) fn id_in_graph_(inout self, id_in_graph: Int): self.node[].id_in_graph = id_in_graph fn id_in_graph(self) -> Int: if self.node[].id_in_graph: var id = self.node[].id_in_graph return id.unsafe_take() return -1 fn graph(self) raises -> Arc[FxGraph]: if not self.has_fxgraph(): raise "Error: No graph set for this node" var graph_opt = self.node[].graph return graph_opt.unsafe_take() fn data_(inout self, owned data_ptr: DTypePointer[dtype]): self.node[].data.free() self.node[].data = data_ptr fn graph_(inout self, graph: Arc[FxGraph]): self.node[].graph = graph fn has_fxgraph(self) -> Bool: return self.node[].graph and self.node[].id_in_graph fn is_breakpoint(self) raises -> Bool: if self.has_fxgraph(): var graph = self.graph() var id_in_graph = self.id_in_graph() return graph[].trace[id_in_graph].is_breakpoint return False fn is_breakpoint_(inout self, is_breakpoint: Bool) raises: if self.has_fxgraph(): var graph = self.graph() var id_in_graph = self.id_in_graph() graph[].trace[id_in_graph].is_breakpoint = is_breakpoint fn item(self, idx: Int) raises -> Array: var res = Array(1) if self.has_fxgraph(): # if the curretn node points to a valid graph we are able to compute the current node with a compiled subgraph var graph = self.graph() var id_in_graph = self.id_in_graph() var graph_node = graph[].trace[id_in_graph] var array_in_graph = graph_node.array_in_graph array_in_graph.postpone_as_grpah_output() # graph[].postponed_outputs.append(id_in_graph) if not graph_node.is_computed: var array_in_graph = self.graph_dual() var subgraph: Arc[FxSubgraph] if not graph_node.sub_graph: var compile_with_MAX = graph[].compile_with_MAX subgraph = graph[].subgraph(compile_with_MAX) graph[].trace[id_in_graph].sub_graph = subgraph else: subgraph = graph_node.subgraph() subgraph[].execute() # print("\nFxSubgraph:") # subgraph.print() res.store(0, array_in_graph.load(idx)) graph[].trace[id_in_graph].is_computed = True graph[].trace[id_in_graph].is_breakpoint = True return res else: res.store(0, 0) return res res.store(0, self.load(idx)) return res fn setup_array_shape(inout self, array_shape: ArrayShape) raises: self.node[].shape = array_shape.shape_node fn uew( self, ) -> List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ]: return self.node[].uew fn bew( self, ) -> List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ]: return self.node[].bew fn inplace_infos(self) -> List[InplaceInfo]: return self.node[].inplace_infos fn append_arg(inout self, arg: Array): self.node[].args.append(arg.node) fn append_inplace_info(inout self, inplace_info: InplaceInfo): self.node[].inplace_infos.append(inplace_info) fn append_uew( inout self, uew: fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ], ): self.node[].uew.append(uew) fn append_bew( inout self, bew: fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ], ): self.node[].bew.append(bew) fn shape(self) raises -> List[Int]: var array_shape = self.array_shape() compute_shape(array_shape, self.requires_grad() or self.has_fxgraph()) return array_shape.shape() fn stride(self) raises -> List[Int]: var array_shape = self.array_shape() compute_shape(array_shape, self.requires_grad() or self.has_fxgraph()) return array_shape.stride() fn storage_offset(self) raises -> Int: var array_shape = self.array_shape() compute_shape(array_shape, self.requires_grad() or self.has_fxgraph()) return array_shape.storage_offset() fn ndim(self) raises -> Int: var array_shape = self.array_shape() compute_shape(array_shape, self.requires_grad() or self.has_fxgraph()) return array_shape.ndim() fn size(self) raises -> Int: var array_shape = self.array_shape() compute_shape(array_shape, self.requires_grad() or self.has_fxgraph()) return array_shape.size() fn is_view(self) -> Bool: return self.node[].is_view fn is_view_(inout self, is_view: Bool): self.node[].is_view = is_view fn base_(inout self, base: Array): self.node[].base.clear() self.node[].base.append(base.node) fn base(self) -> Array: if self.is_view(): return Array(self.node[].base[0]).base() return self fn requires_grad(self) -> Bool: return self.node[].requires_grad fn requires_grad_(inout self, requires_grad: Bool): self.node[].requires_grad = requires_grad fn has_real(self) -> Bool: return self.node[].has_real fn has_real_(inout self, has_real: Bool): self.node[].has_real = has_real fn has_imag(self) -> Bool: return self.node[].has_imag fn has_imag_(inout self, has_imag: Bool): self.node[].has_imag = has_imag fn is_complex(self) -> Bool: return self.has_real() and self.has_imag() fn is_complex_(inout self, is_complex: Bool): self.has_real_(True) self.has_imag_(is_complex) fn data(self) -> DTypePointer[dtype]: if self.is_view(): return self.base().node[].data return self.node[].data fn real_idx(self, idx: Int) -> Int: if self.is_complex(): return idx * 2 return idx fn imag_idx(self, idx: Int) -> Int: if self.is_complex(): return idx * 2 + 1 return idx fn load[width: Int = 1](self, idx: Int) -> SIMD[dtype, width]: if self.is_view(): var nd_idx = compute_nd_index(idx, self.node[].shape[].shape) var base_idx = compute_storage_offset( nd_idx, self.node[].shape[].stride, self.node[].shape[].storage_offset, ) var base = self.node[].base[0] return base[].data.load[width=width](self.real_idx(base_idx)) else: return self.data().load[width=width](self.real_idx(idx)) fn store[ width: Int = 1 ](inout self, idx: Int, data: SIMD[dtype, width]) -> None: if self.is_view(): var nd_idx = compute_nd_index(idx, self.node[].shape[].shape) var base_idx = compute_storage_offset( nd_idx, self.node[].shape[].stride, self.node[].shape[].storage_offset, ) var base = self.node[].base[0] base[].data.store[width=width](self.real_idx(base_idx), data) else: return self.data().store[width=width](self.real_idx(idx), data) fn load_imag[width: Int = 1](self, idx: Int) -> SIMD[dtype, width]: if self.is_view(): var nd_idx = compute_nd_index(idx, self.node[].shape[].shape) var base_idx = compute_storage_offset( nd_idx, self.node[].shape[].stride, self.node[].shape[].storage_offset, ) var base = self.node[].base[0] return base[].data.load[width=width](self.imag_idx(base_idx)) else: return self.data().load[width=width](self.imag_idx(idx)) fn store_imag[ width: Int = 1 ](inout self, idx: Int, data: SIMD[dtype, width]) -> None: if self.is_view(): var nd_idx = compute_nd_index(idx, self.node[].shape[].shape) var base_idx = compute_storage_offset( nd_idx, self.node[].shape[].stride, self.node[].shape[].storage_offset, ) var base = self.node[].base[0] base[].data.store[width=width](self.imag_idx(base_idx), data) else: return self.data().store[width=width](self.imag_idx(idx), data) fn load_complex[ width: Int = 1 ](self, idx: Int) -> Tuple[ SIMD[dtype, 2 * width // 2], SIMD[dtype, 2 * width // 2] ]: if self.is_view(): var nd_idx = compute_nd_index(idx, self.node[].shape[].shape) var base_idx = compute_storage_offset( nd_idx, self.node[].shape[].stride, self.node[].shape[].storage_offset, ) var base = self.node[].base[0] var res_deinterleaved = base[].data.load[width = 2 * width]( self.real_idx(base_idx) ).deinterleave() return (res_deinterleaved[0], res_deinterleaved[1]) else: var res_deinterleaved = self.data().load[width = 2 * width]( self.real_idx(idx) ).deinterleave() return (res_deinterleaved[0], res_deinterleaved[1]) fn store_complex[ width: Int = 1 ]( inout self, idx: Int, real: SIMD[dtype, width], imag: SIMD[dtype, width] ) raises -> None: if self.is_view(): var nd_idx = compute_nd_index(idx, self.shape()) var base_idx = compute_storage_offset( nd_idx, self.stride(), self.storage_offset() ) var base = self.node[].base[0] base[].data.store[width = 2 * width]( self.real_idx(base_idx), real.interleave(imag) ) else: return self.data().store[width = 2 * width]( self.real_idx(idx), real.interleave(imag) ) fn compute_jvp(self) -> Bool: return self.node[].compute_jvp fn set_compute_jvp(inout self, compute_jvp: Bool): self.node[].compute_jvp = compute_jvp fn set_fwd( inout self, fwd: fn (inout Array, List[Array]) raises -> None, ): self.node[].fwd = fwd fn fwd( self, ) raises -> fn (inout Array, List[Array]) raises -> None: # var fwd_opt = self.node[].fwd # if fwd_opt: # var fwd = fwd_opt.unsafe_take() # return fwd # raise "Error: No FWD set for this node" return self.node[].fwd fn jvp_( inout self, jvp: fn (List[Array], List[Array]) raises -> Array, ): self.node[].jvp = jvp fn jvp( self, ) raises -> fn (List[Array], List[Array]) raises -> Array: # if not self.node[].jvp: # raise "Error: No JVP set for this node" # var jvp = self.node[].jvp # return jvp.unsafe_take() return self.node[].jvp fn vjp_( inout self, vjp: fn (List[Array], Array, Array) raises -> List[Array], ): self.node[].vjp = vjp fn vjp( self, ) raises -> fn (List[Array], Array, Array) raises -> List[Array]: # if not self.node[].vjp: # raise "Error: No VJP set for this node" # var vjp = self.node[].vjp # return vjp.unsafe_take() return self.node[].vjp fn has_grad(self) -> Bool: return len(self.node[].grads) > 0 fn grad_(inout self, grad: Array): self.node[].grads.clear() self.node[].grads.append(grad.node) fn grad(self) raises -> Array: if not self.has_grad(): return Array(self.shape()) return Array(self.node[].grads[0]) fn set_name(inout self, name: String): self.node[].name = name fn name(self) -> String: return self.node[].name fn execute_fwd(inout self) raises: var array_shape = self.array_shape() array_shape.execute_fwd(array_shape.args()) # if self.node[].fwd: var args = self.args() # var kwargs = self.kwargs() var array_copy = Array(self.node) self.fwd()(array_copy, args) if self.compute_jvp(): var jvp = self.jvp() var primals = self.args() var tangents = List[Array]() for arg in primals: tangents.append(arg[].grad()) self.grad_(jvp(primals, tangents)) fn __str__(self) -> String: var storage_offset = "" var out: String = "" # out += storage_offset + "Array(" var idx = 0 var dim = 0 var indent = " " var ndim = self.node[].shape[].ndim if ndim == 1 and self.node[].shape[].shape[0] == 1: out = self.load(0) else: build_out_string(self, out, idx, dim, indent) # out += ", shape=(" # var ndim = self.node[].shape[].ndim # var shape = self.node[].shape[].shape # var stride = self.node[].shape[].stride # for i in range(ndim): # out += str(shape[i]) # out += ", " if i < ndim - 1 else "" # out += "), stride: (" # for i in range(ndim): # out += str(stride[i]) # out += "x" if i < ndim - 1 else "" # out += "), storage_offset: " + str(self.node[].shape[].storage_offset) # out += ", dtype=" + str(dtype) + ")" return out fn execute_fwds( inout self, ) raises: if not self.node[].simd_op_list: return var ops = self.node[].simd_op_list var size = self.size() var simd_end = size - nelts[dtype]() var normal_start = (size // (nelts[dtype]())) * nelts[dtype]() for n in range(0, simd_end, nelts[dtype]()): var simd_args = self.load[nelts[dtype]() * 2 // 2](n) for op in ops: simd_args = op[]( simd_args, SIMD[dtype, nelts[dtype]() * 2 // 2]() )[0] self.store[nelts[dtype]() * 2 // 2](n, simd_args) var rest = SIMD[dtype, nelts[dtype]() * 2 // 2]() for n in range(normal_start, size): rest[n - normal_start] = self.load(n) for op in ops: rest = op[](rest, SIMD[dtype, nelts[dtype]() * 2 // 2]())[0] for n in range(normal_start, size): self.store(n, rest[n - normal_start]) fn graph_dual(self) raises -> Self: if not self.has_fxgraph(): raise "Error: No graph set for this node" var graph = self.graph() var graph_id = self.id_in_graph() return graph[].trace[graph_id].array_in_graph fn backward(self, create_graph: Bool = False) raises: backward(self, create_graph) fn zero_grad(inout self): zero_grad_rec(self) fn T(self) raises -> Array: if self.ndim() == 1: return self return permute(self, List(-1, -2)) fn reshape(self, shape: List[Int]) raises -> Array: return reshape(self, shape) fn __getitem__(self, *slices: Slice) raises -> Array: var slices_list = List[Slice]() for i in range(len(slices)): slices_list.append(slices[i]) return array_slice(self, slices_list) fn __add__(self, other: Array) raises -> Array: return add(self, other) fn __add__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return add(self, other_array) fn __radd__(self, other: Array) raises -> Array: return add(other, self) fn __radd__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return add(other_array, self) fn __iadd__(inout self, other: Array) raises: var res = add(self, other) execute_copy_raw( res.data(), self.data(), self.array_shape(), res.is_complex(), ) _ = res fn __iadd__(inout self, other: SIMD[dtype, 1]) raises: self = self.__add__(other) fn __sub__(self, other: Array) raises -> Array: return sub(self, other) fn __sub__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return sub(self, other_array) fn __rsub__(self, other: Array) raises -> Array: return sub(other, self) fn __rsub__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return sub(other_array, self) fn __isub__(inout self, other: Array) raises: var res = sub(self, other) execute_copy_raw( res.data(), self.data(), self.array_shape(), res.is_complex(), ) _ = res fn __isub__(inout self, other: SIMD[dtype, 1]) raises: self = self.__sub__(other) fn __mul__(self, other: Array) raises -> Array: return mul(self, other) fn __mul__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return mul(self, other_array) fn __rmul__(self, other: Array) raises -> Array: return mul(other, self) fn __rmul__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return mul(other_array, self) fn __imul__(inout self, other: Array) raises: var res = mul(self, other) execute_copy_raw( res.data(), self.data(), self.array_shape(), res.is_complex(), ) _ = res fn __imul__(inout self, other: SIMD[dtype, 1]) raises: self = self.__mul__(other) fn __truediv__(self, other: Array) raises -> Array: return div(self, other) fn __truediv__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return div(self, other_array) fn __rtruediv__(self, other: Array) raises -> Array: return div(other, self) fn __rtruediv__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return div(other_array, self) fn __itruediv__(inout self, other: Array) raises: var res = div(self, other) execute_copy_raw( res.data(), self.data(), self.array_shape(), res.is_complex(), ) _ = res fn __itruediv__(inout self, other: SIMD[dtype, 1]) raises: self = self.__truediv__(other) fn __matmul__(self, other: Array) raises -> Array: return matmul(self, other) fn __rmatmul__(self, other: Array) raises -> Array: return matmul(other, self) fn __neg__(self) raises -> Array: return neg(self) fn __pow__(self, other: Array) raises -> Array: return pow_to(self, other) fn __pow__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return pow_to(self, other_array) fn __rpow__(self, other: Array) raises -> Array: return pow_to(other, self) fn __rpow__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return pow_to(other_array, self) fn __ipow__(inout self, other: Array) raises: var res = pow_to(self, other) execute_copy_raw( res.data(), self.data(), self.array_shape(), res.is_complex(), ) _ = res fn __ipow__(inout self, other: SIMD[dtype, 1]) raises: self = self.__pow__(other) fn __ge__(self, other: Array) raises -> Array: return greater_equal(self, other) fn __ge__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return greater_equal(self, other_array) fn __gt__(self, other: Array) raises -> Array: return greater(self, other) fn __gt__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return greater(self, other_array) fn __le__(self, other: Array) raises -> Array: return less_equal(self, other) fn __le__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return less_equal(self, other_array) fn __lt__(self, other: Array) raises -> Array: return less(self, other) fn __lt__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return less(self, other_array) fn __eq__(self, other: Array) raises -> Array: return equal(self, other) fn __eq__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return equal(self, other_array) fn __ne__(self, other: Array) raises -> Array: return not_equal(self, other) fn __ne__(self, other: SIMD[dtype, 1]) raises -> Array: var other_array = full(self.shape()[self.ndim() - 1], other) return not_equal(self, other_array) alias Tensor = Array alias ndarray = Array --- endia/_array/readme.md --- # Array --- endia/autograd/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .functional import * --- endia/autograd/functional.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.compile import Callable from endia.utils import top_order_rec from utils import Variant fn backward(arg: Array, create_graph: Bool) raises: """Performs backward propagation on the given Array.""" jacrev(arg, create_graph) fn jacrev(arg: Array, create_graph: Bool) raises: """Computes the reverse-mode Jacobian for the given Array.""" var out = arg reset_node_id_recursive(out) var trace = List[Array]() top_order_rec(out, trace) var dims = arg.shape()[arg.ndim() - 1] var last_grad = reshape(eye(out.size()), out.shape() + out.shape()) if ( out.ndim() != 1 or dims != 1 ) else ones(dims) out.grad_(last_grad) for i in range(len(trace) - 1, -1, -1): var curr = trace[i] var primals = curr.args() if primals.size == 0: continue var vjp = curr.vjp() var grad = curr.grad() var primals_grads = vjp(primals, grad, curr) for j in range(len(primals)): var primal = primals[j] if primal.requires_grad(): var primal_grad = primals_grads[j] if primal.has_grad(): primal_grad = add(primal_grad, primal.grad()) primal.grad_(primal_grad) if primal.has_fxgraph(): if primal.is_breakpoint(): primal_grad.postpone_as_grpah_output() if not create_graph: var primal_grad = primal.grad() primal_grad.clear_args() reset_node_id_recursive(out) fn grad( outs: List[Array], inputs: List[Array], retain_grads: Bool = True, create_graph: Bool = False, ) raises -> List[Array]: """Computes gradients of outputs with respect to inputs.""" for i in range(len(outs)): var out = outs[i] remove_grad_rec(out) for i in range(len(inputs)): var input = inputs[i] remove_grad_rec(input) for i in range(len(outs)): var out = outs[i] out.backward(create_graph=create_graph) var final_outs = List[Array]() for i in range(len(inputs)): var input = inputs[i] var gradient = input.grad() if not create_graph: gradient.clear_args() gradient.remove_grad() if not retain_grads: input.remove_grad() final_outs.append(gradient) return final_outs fn grad(f: Callable, argnums: List[Int] = List(-1)) raises -> Callable: """Computes the gradient of a Callable function with respect to specified arguments. """ var existing_argnums = f.argnums existing_argnums.append(argnums) return Callable( f.func, existing_argnums, f.order_of_differentiation + 1, False, False, ) fn grad( f: fn (List[Array]) raises -> Array, argnums: List[Int] = List(-1) ) raises -> Callable: """Computes the gradient of a function that takes a list of Arrays and returns an Array. """ return Callable(f, argnums, 1, False, False) fn grad( f: fn (Array) raises -> Array, argnums: List[Int] = List(-1) ) raises -> Callable: """Computes the gradient of a function that takes a single Array and returns an Array. """ return Callable(f, argnums, 1, False, False) fn jacobian(f: Callable, argnums: List[Int] = List(-1)) raises -> Callable: """Computes the Jacobian of a Callable function with respect to specified arguments. """ return grad(f, argnums) fn jacobian( f: fn (List[Array]) raises -> Array, argnums: List[Int] = List(-1) ) raises -> Callable: """Computes the Jacobian of a function that takes a list of Arrays and returns an Array. """ return grad(f, argnums) fn jacobian( f: fn (Array) raises -> Array, argnums: List[Int] = List(-1) ) raises -> Callable: """Computes the Jacobian of a function that takes a single Array and returns an Array. """ return grad(f, argnums) fn hessian(f: Callable, argnums: List[Int] = List(-1)) raises -> Callable: """Computes the Hessian of a Callable function with respect to specified arguments. """ var f_grad = grad(f, argnums) return grad(f_grad, argnums) fn hessian( f: fn (List[Array]) raises -> Array, argnums: List[Int] = List(-1) ) raises -> Callable: """Computes the Hessian of a function that takes a list of Arrays and returns an Array. """ var f_grad = grad(f, argnums) return grad(f_grad, argnums) fn hessian( f: fn (Array) raises -> Array, argnums: List[Int] = List(-1) ) raises -> Callable: """Computes the Hessian of a function that takes a single Array and returns an Array. """ var f_grad = grad(f, argnums) return grad(f_grad, argnums) fn value_and_grad( arg: Variant[Callable, fn (List[Array]) raises -> Array], argnums: List[Int] = List(-1), ) raises -> Callable: """Computes both the value and gradient of a function or Callable with respect to specified arguments. """ var a = arg if arg.isa[Callable](): var _a = a.unsafe_take[Callable]() var existing_argnums = _a.argnums existing_argnums.append(argnums) return Callable( _a.func, existing_argnums, _a.order_of_differentiation + 1, False, True, ) else: var _f = a.unsafe_take[fn (List[Array]) raises -> Array]() return Callable(_f, argnums, 1, False, True) fn jacobian(f: Callable, args: List[Array]) raises -> List[Array]: """Computes the Jacobian of a Callable function with respect to given arguments. """ var f_jac = grad(f, List(-1)) return f_jac(args)[List[Array]] fn jacobian( f: fn (List[Array]) raises -> Array, args: List[Array] ) raises -> List[Array]: """Computes the Jacobian of a function that takes a list of Arrays with respect to given arguments. """ var f_jac = grad(f, List(-1)) return f_jac(args)[List[Array]] fn jacobian(f: fn (Array) raises -> Array, arg: Array) raises -> Array: """Computes the Jacobian of a function that takes a single Array with respect to the given argument. """ var f_jac = grad(f, List(-1)) return f_jac(arg)[Array] fn hessian(f: Callable, args: List[Array]) raises -> List[Array]: """Computes the Hessian of a Callable function with respect to given arguments. """ var f_jes = hessian(f, List(-1)) return f_jes(args)[List[Array]] fn hessian( f: fn (List[Array]) raises -> Array, args: List[Array] ) raises -> List[Array]: """Computes the Hessian of a function that takes a list of Arrays with respect to given arguments. """ var f_jes = hessian(f, List(-1)) return f_jes(args)[List[Array]] fn hessian(f: fn (Array) raises -> Array, arg: Array) raises -> Array: """Computes the Hessian of a function that takes a single Array with respect to the given argument. """ var f_jes = hessian(f, List(-1)) return f_jes(arg)[Array] --- endia/autograd/readme.md --- # Autograd --- endia/compile/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .fx import * from .functional import * from .callable import * from .max_utils import * --- endia/compile/callable.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import list_contains from endia.functional._utils import copy, execute_copy_raw from endia.utils import dtype, remove_grad_rec from utils import Variant @value struct Callable(CollectionElement): """ Callable is the main data structure for Just-In-Time (JIT) compiling a function and computing gradients in a functional manner. It encapsulates the function, its arguments, and the captured computation graph, enabling dynamic optimization and execution. """ var args: Arc[List[Array]] var argnums: List[List[Int]] var func: Variant[ fn (List[Array]) raises -> Array, fn (Array) raises -> Array ] var captured_graph: Arc[FxGraph] var order_of_differentiation: Int var optimize_jit: Bool var args_initialized: Bool var keep_intermediate_outs: Bool fn __init__( inout self, func: Variant[ fn (List[Array]) raises -> Array, fn (Array) raises -> Array ], argnums: List[List[Int]], order_of_differentiation: Int = 0, optimize_jit: Bool = True, keep_intermediate_outs: Bool = False, compile_with_MAX: Bool = False, ) raises: self.args = List[Array]() self.argnums = argnums self.func = func self.captured_graph = Arc[FxGraph](FxGraph(compile_with_MAX)) self.order_of_differentiation = order_of_differentiation self.optimize_jit = optimize_jit self.args_initialized = False self.keep_intermediate_outs = keep_intermediate_outs fn __call__( self, args: List[Array] ) raises -> Variant[Array, List[Array], List[List[Array]]]: var captured_graph = self.captured_graph if len(self.args[]) == 0: if self.optimize_jit: for _ in range(len(args)): var arg = Array(List[Int](0)) arg.requires_grad_(True) captured_graph[].op_arrayeration(arg) captured_graph[].trace[-1].is_breakpoint = True arg.graph_(captured_graph) var cached_args = self.args cached_args[].append(arg) else: if self.optimize_jit: if len(args) != len(self.args[]): raise "Number of arguments inconcistent in jit." var adapted_args = List[Array]() if self.optimize_jit: captured_graph[].curr_idx = len(args) for i in range(len(args)): var arg_in = args[i] var arg = self.args[][i] var size = arg_in.base().size() if size != arg.size(): arg.data_(DTypePointer[dtype].alloc(size)) execute_copy_raw( arg_in.data(), arg.data(), arg_in.array_shape(), arg_in.is_complex(), ) arg.array_shape_(arg_in.array_shape()) captured_graph[].trace[arg.id_in_graph()].is_computed = True adapted_args = self.args[] else: var tmp_requires_grad_info = List[Bool]() for arg in args: tmp_requires_grad_info.append(arg[].requires_grad()) for i in range(len(args)): var arg = args[i] if len(args[i].args()) == 0 else copy(args[i]) for order in range(self.order_of_differentiation): if ( list_contains(self.argnums[order], i) or self.argnums[order][0] == -1 ): arg.requires_grad_(True) adapted_args.append(arg) # compute forward var res: Array if self.func.isa[fn (List[Array]) raises -> Array](): var _func = self.func[fn (List[Array]) raises -> Array] res = _func(adapted_args) elif self.func.isa[fn (Array) raises -> Array](): var _func = self.func[fn (Array) raises -> Array] res = _func(adapted_args[0]) else: raise "Function type not supported." # set breakpoint for the result # _ = res.item(0) res.postpone_as_grpah_output() var outs = List[Array]() outs.append(res) var next_outs = outs var number_outs_per_order = List(1) # compute backward from all current outs for order in range(self.order_of_differentiation): var tmp_outs = next_outs next_outs.clear() for arr in tmp_outs: (arr[]).backward( create_graph=True if ( order < self.order_of_differentiation - 1 or self.optimize_jit ) else False ) for i in range(len(adapted_args)): if ( list_contains(self.argnums[order], i) or self.argnums[order][0] == -1 ): next_outs.append(adapted_args[i].grad()) remove_grad_rec(arr[]) if self.keep_intermediate_outs: outs.extend(next_outs) number_outs_per_order.append(len(next_outs)) else: outs = next_outs _ = res.item( 0 ) # call this on curr to compute all postponed outeputs of the potentially corresponding fx graph, this will cimpute all outputs at once # make out independent of the computation graph i.e. copy the data into fresh arrays var final_outs = List[Array]() for out in outs: var copy_out = Array(out[].shape()) var out_dual = out[].graph_dual() if out[].has_fxgraph() else out[] execute_copy_raw( out_dual.data(), copy_out.data(), out_dual.array_shape(), out_dual.is_complex(), ) final_outs.append(copy_out) # clean up if self.optimize_jit: captured_graph[].zero_data() captured_graph[].reset_data_and_shapes_to_uncomputed() # build out based on the order of differentiation and if we want to keep intermediate outs if len(final_outs) == 1: return final_outs[0] elif self.keep_intermediate_outs: var out = List[List[Array]]() var idx = 0 for order in range(self.order_of_differentiation + 1): var tmp = List[Array]() for _ in range(number_outs_per_order[order]): tmp.append(final_outs[idx]) idx += 1 out.append(tmp) return out else: return final_outs --- endia/compile/functional.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from compile import * ############################################################################################################### # JIT Compilation # # Any Function can be traced, even those that branch via conditional statements on the data of the arrays. # It works as follows: # 1) Any Operation has a name (e.g. add, sub, incr, etc.). When a function is traced/captured, the # names of the ops are compared to the operation at the curr_idx of the execution, which points to # the operation that is expected, based on what has happened in an earlier capture of the function. # If both names match, we return immediately and postpone our execution, if not equal, we brach and # mark this potential different path at the curr_idx. The operations of the unexpected/new trace is # are added at the end of the trace of the graph. That way, over time, the Graph will know about all # possible branches, while still storing/caching previous traces. # 2) So far we have a graph with different branches. However the purpose of the graph capturing is to # optimize subgraphs of the computation, i.e. cache optimized subgraphs and call then when they are # needed/the values of their out nodes are used in the outer function. # General Idea: The Graph consists of GraphNodes, which is a small datastructure which is kind of a # dual node to the actual node in the outer function, except it does not follow the deletion of its # primal and lives as long as the grpah lives. If a node in the outer function is marked as a breakpoint # via a getter or setter, this breakpoint marks an end to a subgraph in the Graph. Everytime we come # across a breakpoint node, we look at the current subgraph which emerged thorugh the last # couple of operations and try to fuse elemtwise ops together and perform general optimizations on this # now static and cached computation graph. If we come across this breakpoint node again in another # execution of the outer function, we simply call this optimized subgraph and we are done. ############################################################################################################### fn jit(arg: Callable, compile_with_MAX: Bool = False) raises -> Callable: """ Jit and cache the given function or Callable. """ return Callable( arg.func, arg.argnums, arg.order_of_differentiation, True, arg.keep_intermediate_outs, compile_with_MAX, ) fn jit( arg: fn (List[Array]) raises -> Array, compile_with_MAX: Bool = False ) raises -> Callable: """ Jit and cache the given function or Callable. """ return Callable( arg, List[Int](-1), 0, True, False, compile_with_MAX, ) fn jit( arg: fn (Array) raises -> Array, compile_with_MAX: Bool = False ) raises -> Callable: """ Jit and cache the given function or Callable. """ return Callable( arg, List[Int](-1), 0, True, False, compile_with_MAX, ) --- endia/compile/fx.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array, Node, ArrayShape, ShapeNode from compile import * from endia.functional._utils import ( contiguous, op_array, setup_array_shape, setup_shape_and_data, execute_copy_raw, ) from max.engine import Model from .max_utils import build_model, execute_model # @value struct FxSubgraph(CollectionElement): """ FxSubgraph represents a functionally pure subgraph within a larger computation graph. It facilitates optimization and efficient execution of subgraphs by caching and reusing optimized computations. """ var traversing_arrays: List[Array] var inputs: List[Array] var outputs: List[Array] var max_model: List[Arc[Model]] var compile_with_MAX: Bool fn __init__( inout self, compile_with_MAX: Bool, traversing_arrays: List[Array] = List[Array](), ): self.traversing_arrays = traversing_arrays self.inputs = List[Array]() self.outputs = List[Array]() self.max_model = List[Arc[Model]]() self.compile_with_MAX = compile_with_MAX fn __copyinit__(inout self, other: FxSubgraph): self.traversing_arrays = other.traversing_arrays self.inputs = other.inputs self.outputs = other.outputs self.max_model = other.max_model self.compile_with_MAX = other.compile_with_MAX fn __moveinit__(inout self, owned other: FxSubgraph): self.traversing_arrays = other.traversing_arrays^ self.inputs = other.inputs^ self.outputs = other.outputs^ self.max_model = other.max_model^ self.compile_with_MAX = other.compile_with_MAX fn append(inout self, arr: Array): self.traversing_arrays.append(arr) fn setup_inputs_and_outputs(inout self) raises: var is_input = Dict[Int, Bool]() var is_output = Dict[Int, Bool]() for graph_node in self.traversing_arrays: var id_in_graph = graph_node[].id_in_graph() is_input[ id_in_graph ] = False # if a node has either no args at all or no args in the subgraph, then it is an input is_output[ id_in_graph ] = True # if a node has no users in the subgraph, then it is an output for graph_node in self.traversing_arrays: var node_id = graph_node[].id_in_graph() var args = graph_node[].args() var has_no_args_in_subgraph = True for arg in args: var arg_id = arg[].id_in_graph() is_output[arg_id] = False for arg in args: var arg_id = arg[].id_in_graph() if arg_id in is_input: has_no_args_in_subgraph = False break if has_no_args_in_subgraph: is_input[node_id] = True else: is_input[node_id] = False for graph_node in self.traversing_arrays: var node_id = graph_node[].id_in_graph() if is_input[node_id]: self.inputs.append(graph_node[]) if is_output[node_id]: self.outputs.append(graph_node[]) fn execute(inout self) raises: if self.compile_with_MAX: # Use a compiled subgraph with the MAX engine and execute it # needed for the max graph building: nodes and their ids need to be unique and in order for i in range(len(self.traversing_arrays)): self.traversing_arrays[i].id_(i) # Do once: setup the data and shape of the output nodes, then build the max model if len(self.max_model) == 0: self.setup_inputs_and_outputs() for output in self.outputs: var array_shape = output[].array_shape() compute_shape(array_shape, True) var base = output[].base() setup_shape_and_data(base) self.max_model.append( Arc( build_model( self.inputs, self.outputs, self.traversing_arrays ) ) ) # execute the max model with the current inputs and copy the outpus back into the callable trace var max_model = self.max_model[0] var new_outputs = execute_model( self.inputs, self.outputs, max_model[] ) for i in range(len(new_outputs)): var dst = self.outputs[i] var src = new_outputs[i] for j in range(dst.size()): dst.store(j, src.load(j)) else: # use Endia's default execution var graph = self.traversing_arrays[0].graph() for graph_node in self.traversing_arrays: var curr = graph_node[] if len(curr.args()) == 0: continue var id_in_graph = curr.id_in_graph() var fwd = curr.fwd() var args = curr.args() fwd(curr, args) # graph[].trace[id_in_graph].is_computed = True # reset the node ids and set the is_computed flag to True for curr in self.traversing_arrays: curr[].id_(-1) curr[].is_graph_node_computed_(True) fn print(self) raises: """ Print the subgraph in a human readable table like format. It will show the flow of the computation from the top to the bottom, and also will show the direct dependencies (args) and other metadata such as the shape, stride, storage_offset and the requires_grad flag. """ # print an IR like tabular representation of the subgraph var opcode_reference = "opcode " var name_reference = "name " var target_reference = "target " var args_reference = "args " var kwargs_reference = "kwargs " var shape_reference = "[shape, stride, storage_offset]" var header: String = opcode_reference + " | " + name_reference + " | " + target_reference + " | " + args_reference + " | " + kwargs_reference + " | " + shape_reference + " | " var header_sub = String("_") * len(opcode_reference) + " | " + String( "_" ) * len(name_reference) + " | " + String("_") * len( target_reference ) + " | " + String( "_" ) * len( args_reference ) + " | " + String( "_" ) * len( kwargs_reference ) + " | " + String( "_" ) * len( shape_reference ) print(header) print(header_sub) for i in range(len(self.traversing_arrays)): var curr = self.traversing_arrays[i] var opcode: String = "placeholder" if len(curr.args()) > 0: opcode = "call_function" if i == len(self.traversing_arrays) - 1: opcode = "out" opcode += String(" ") * (len(opcode_reference) - len(opcode)) var name: String = str(curr.id_in_graph()) name += "_" name += str(curr.name()) name += String(" ") * (len(name_reference) - len(name)) var target = curr.name() target += String(" ") * (len(target_reference) - len(target)) var args: String = "" for arg in curr.args(): if arg[].has_fxgraph(): args += str(arg[].id_in_graph()) else: args += str(-1) args += "_" args += arg[].name() args += ", " if len(curr.args()) == 0: args = "{}" args += String(" ") * (len(args_reference) - len(args)) var kwargs: String = "" for kwarg in curr.kwargs(): if kwarg[].has_fxgraph(): kwargs += str(kwarg[].id_in_graph()) else: kwargs += str(-1) kwargs += "_" kwargs += kwarg[].name() kwargs += ", " if len(curr.kwargs()) == 0: kwargs = "{}" kwargs += String(" ") * (len(kwargs_reference) - len(kwargs)) var shape = curr.shape() var stride = curr.stride() var storage_offset = curr.storage_offset() var shape_str: String = "[" for i in range(len(shape)): shape_str += str(shape[i]) if i < len(shape) - 1: shape_str += "x" shape_str += ", " for i in range(len(stride)): shape_str += str(stride[i]) if i < len(stride) - 1: shape_str += "x" shape_str += ", " shape_str += str(storage_offset) shape_str += "]" shape_str += String(" ") * (len(shape_reference) - len(shape_str)) print( opcode, "|", name, "|", target, "|", args, "|", kwargs, "|", shape_str, ) fn IR(self) raises -> String: """ Get an IR like code representation of the subgraph. As of right now this has now real functionality, but eventually this IR string should become a valid MLIR code representation of the subgraph, which can be compiled and optimized by the MLIR. """ # create an IR like code representation of the subgraph var IR: String = "\n" var IR_header: String = "func @fx_subgraph(" var IR_body: String = "" var out_name: String = "" var out_shape: String = "" for i in range(len(self.traversing_arrays)): var curr = self.traversing_arrays[i] var opcode: String = "placeholder" if len(curr.args()) > 0: opcode = "call_function" if i == len(self.traversing_arrays) - 1: opcode = "out" var name: String = str(curr.id_in_graph()) name += "_" name += str(curr.name()) var target = curr.name() var args: String = "" for j in range(len(curr.args())): var arg = curr.args()[j] args += "%" if arg.has_fxgraph(): args += str(arg.id_in_graph()) else: args += str(-1) args += "_" args += arg.name() if j < len(curr.args()) - 1: args += ", " if len(curr.args()) == 0: args = "{}" var kwargs: String = "" for j in range(len(curr.kwargs())): var kwarg = curr.kwargs()[j] if kwarg.has_fxgraph(): kwargs += str(kwarg.id_in_graph()) else: kwargs += str(-1) kwargs += "_" kwargs += kwarg.name() if j < len(curr.kwargs()) - 1: kwargs += ", " if len(curr.kwargs()) == 0: kwargs = "{}" var shape = curr.shape() # var stride = curr.stride() # var storage_offset = curr.storage_offset() var shape_str: String = "" for i in range(len(shape)): shape_str += str(shape[i]) if i < len(shape) - 1: shape_str += "x" shape_str += "xf32" if opcode == "placeholder": IR_header += "%" IR_header += name IR_header += ": tensor<" IR_header += shape_str IR_header += ">, " elif opcode == "call_function" or opcode == "out": IR_body += " %" IR_body += name IR_body += " = @" IR_body += target IR_body += " " IR_body += args IR_body += " -> " IR_body += " tensor<" IR_body += shape_str IR_body += ">\n" if opcode == "out": out_name = name out_shape = shape_str else: pass IR_header += ") -> tensor<" IR_header += out_shape + "> {\n" IR += IR_header IR += IR_body IR += " return %" IR += out_name + " : " + "tensor<" + out_shape + ">\n" IR += "}\n" return IR @value struct FxGraphNode(CollectionElement): """ FxGraphNode is a lightweight dual representation of an Array (or Node) within a traced function. It serves as a bookkeeping structure to facilitate tracing, caching, and optimization of computation graphs. """ var array_in_graph: Array var name: String var branch_to_idx: Int var is_breakpoint: Bool var dependencies: Int var sub_graph: List[Arc[FxSubgraph]] var tmp_id_in_subgraph: Int var jvp_derivatives: List[Array] var is_computed: Bool var id: Int fn __init__( inout self, name: String, branch_to_idx: Int, array_in_graph: Array ): self.array_in_graph = array_in_graph self.name = name self.branch_to_idx = branch_to_idx self.is_breakpoint = False self.dependencies = 0 self.sub_graph = List[Arc[FxSubgraph]]() self.tmp_id_in_subgraph = -1 self.jvp_derivatives = List[Array]() self.is_computed = False self.id = -1 fn print(self, storage_offset: String = "") raises: print( storage_offset, self.name + ( " -> potentially jump to " + str(self.branch_to_idx) if self.branch_to_idx != -1 else "" ), ) print(str(self.array_in_graph)) fn subgraph(self) raises -> FxSubgraph: if not self.sub_graph: raise "Subgraph not yet computed" return self.sub_graph[0][] @value struct FxGraph: """ FxGraph is a data structure that holds the traced operations and computation graph of a function. It facilitates Just-In-Time (JIT) compilation, optimization, and caching of subgraphs within the computation graph. """ var trace: List[FxGraphNode] var curr_idx: Int var postponed_outputs: List[Int] var compile_with_MAX: Bool fn __init__(inout self, compile_with_MAX: Bool): self.trace = List[FxGraphNode]() self.curr_idx = 0 self.postponed_outputs = List[Int]() self.compile_with_MAX = compile_with_MAX fn op_arrayeration(inout self, inout arr: Array) raises: if arr.id() == -2: raise "Error: This is a test error." var name = arr.name() # print(name, self.curr_idx) if self.curr_idx >= len(self.trace): # print(" registering new entry", arr.name()) # array is not initalized in fxgraph, but the array shape subgraph is being setup already, still dynamically computed when data is specified though! var id_in_graph = len(self.trace) arr.id_in_graph_(id_in_graph) self.trace.append(FxGraphNode(name, -1, arr)) self.curr_idx = len(self.trace) else: var registered_op = self.trace[self.curr_idx] if registered_op.name == name: # print(" same operation", arr.name()) arr.id_in_graph_(self.curr_idx) self.curr_idx += 1 return else: if registered_op.branch_to_idx == -1: # print(" setup new jump at the end of the trace", arr.name()) self.trace[self.curr_idx] = FxGraphNode( registered_op.name, len(self.trace), registered_op.array_in_graph, ) self.curr_idx = len(self.trace) self.op_arrayeration(arr) else: # print(" jumping to registered alternative operation", arr.name()) self.curr_idx = registered_op.branch_to_idx self.op_arrayeration(arr) # print("->",name, arr.id_in_graph(), arr.has_fxgraph(), self.curr_idx, len(self.trace)) fn reset_data_and_shapes_to_uncomputed(inout self) raises: for graph_node in self.trace: var arr = graph_node[].array_in_graph if len(arr.args()) == 0: continue # var array_shape = arr.array_shape() # array_shape.shape_node[].is_computed = False arr.is_computed_(False) arr.is_graph_node_computed_(False) fn setup_grads(inout self) raises: for graph_node in self.trace: var arr = graph_node[].array_in_graph var requires_grad = arr.requires_grad() if requires_grad: arr.grad_(Array(arr.shape(), requires_grad=True)) fn zero_data(inout self) raises: for graph_node in self.trace: var array_in_graph = graph_node[].array_in_graph # self.trace[array_in_graph.id_in_graph()].is_computed = False array_in_graph.is_graph_node_computed_(False) if not array_in_graph.is_view() and len(array_in_graph.args()) == 0: var data = array_in_graph.data() var size = graph_node[].array_in_graph.size() memset_zero(data, size) fn subgraph(inout self, compile_with_MAX: Bool) raises -> Arc[FxSubgraph]: var subgraph_list = List[Array]() # var curr = self.trace[breakpoint_id].array_in_graph # reset_node_id_recursive(curr) for graph_id in self.postponed_outputs: var graph_node = self.trace[graph_id[]] var postponed_output = graph_node.array_in_graph reset_node_id_recursive(postponed_output) # print(len(self.postponed_outputs)) for graph_id in self.postponed_outputs: var graph_node = self.trace[graph_id[]] var postponed_output = graph_node.array_in_graph top_order_subgraph_rec(postponed_output, subgraph_list) # self.trace[graph_id[]].is_breakpoint = True for graph_id in self.postponed_outputs: var graph_node = self.trace[graph_id[]] var postponed_output = graph_node.array_in_graph reset_node_id_recursive(postponed_output) self.postponed_outputs.clear() # adapt the trace of the subgraph such that all args/inputs are at the beginning: var subgraph_list_inputs = List[Array]() var subgraph_list_rest = List[Array]() for arr in subgraph_list: if arr[].name() == "arg": subgraph_list_inputs.append(arr[]) else: subgraph_list_rest.append(arr[]) var subgraph_final_trace = List[Array]() for arr in subgraph_list_inputs: subgraph_final_trace.append(arr[]) for arr in subgraph_list_rest: subgraph_final_trace.append(arr[]) # # print # for i in range(len(subgraph_final_trace)): # print(subgraph_final_trace[i].name()) # for arr in subgraph_final_trace: # print(arr[].id(), arr[].name(), " -> [", end="") # for arg in arr[].args(): # print(arg[].id(), arg[].name(), ", ", end="") # print("]") return Arc(FxSubgraph(compile_with_MAX, subgraph_final_trace)) fn top_order_subgraph_rec(inout curr: Array, inout trace: List[Array]) raises: # if curr.id() != -1 or curr.is_breakpoint() or curr.is_graph_node_computed(): # return for arg in curr.args(): if ( arg[].node[].id == -1 and not curr.is_breakpoint() and not curr.is_graph_node_computed() ): top_order_rec(arg[], trace) curr.id_(len(trace)) trace.append(curr) --- endia/compile/max_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array, Node, ArrayShape, ShapeNode from endia.functional._utils import contiguous, array_shape_to_list from compile import * from max.engine import InferenceSession, Model, TensorMap, EngineNumpyView from max.graph import Graph, TensorType, ops, Symbol, Dim, Type from max.tensor import Tensor, TensorShape, TensorSpec from python import Python from .python_utils import array_to_numpy, tensor_to_array fn top_order(inout curr: Array) -> List[Array]: var trace = List[Array]() reset_node_id_recursive(curr) top_order_rec(curr, trace) return trace fn to_tensor(arg: Array) raises -> Tensor[DType.float32]: var shape = TensorShape(List(arg.shape())) var tensor = Tensor[DType.float32](shape) for i in range(arg.size()): tensor.store(i, arg.load(i)) return tensor fn make_equal_rank( arg: Symbol, arg_shape: List[Int], comp_shape: List[Int] ) raises -> Symbol: var diff = len(comp_shape) - len(arg_shape) if diff > 0: var res = arg for _ in range(diff): res = ops.unsqueeze(res, 0) return res return arg def build_graph( args: List[Array], outputs: List[Array], trace: List[Array] ) -> Graph: var arg_specs = List[Type]() for arg in args: arg_specs.append(TensorType(TensorSpec(DType.float32, arg[].shape()))) var out_specs = List[Type]() for out in outputs: out_specs.append(TensorType(TensorSpec(DType.float32, out[].shape()))) graph = Graph(name="subgraph", in_types=arg_specs, out_types=out_specs) var symbol_trace = List[Symbol]() var args_idx = Dict[String, Int]() for i in range(len(args)): args_idx[str(args[i].id())] = i var output_symbols = List[Symbol]() for array in trace: var tmp_args = List[Array]() for arg in array[].args(): tmp_args.append( arg[] # if (not arg[].name() == "brdcst" or len(arg[].args()) == 0) else arg[].args()[0] ) if len(tmp_args) == 0: var idx_in_args = args_idx[str(array[].id())] symbol_trace.append(graph[idx_in_args]) continue elif array[].is_view(): var arg0 = symbol_trace[ tmp_args[0].id() ] # if tmp_args[0].has_fxgraph() else graph.constant(to_tensor(tmp_args[0])) if array[].name() == "brdcst": # symbol_trace.append(symbol_trace[tmp_args[0].id()]) var zero_const = graph.constant( Tensor[DType.float32](array[].shape(), 0) ) symbol_trace.append(ops.add(arg0, zero_const)) elif array[].name() == "permute": symbol_trace.append(ops.transpose(arg0, -1, -2)) elif array[].name() == "squeeze": var all_axis = array_shape_to_list( array[].array_shape().args()[1] ) for i in range(len(all_axis)): arg0 = ops.squeeze(arg0, all_axis[i] - i) symbol_trace.append(arg0) elif array[].name() == "unsqueeze": var all_axis = array_shape_to_list( array[].array_shape().args()[1] ) for axis in all_axis: arg0 = ops.unsqueeze(arg0, axis[]) symbol_trace.append(arg0) elif array[].name() == "permute": symbol_trace.append(ops.transpose(arg0, -1, -2)) else: print("Unknown view op:", array[].name()) continue elif array[].name() == "reduce_add": var arg0 = symbol_trace[tmp_args[0].id()] var in_shape = tmp_args[0].shape() var all_axis = array_shape_to_list(array[].array_shape().args()[1]) for i in range(len(all_axis)): var axis = all_axis[i] # MAX currently only has a mean op and no general reduce_add op, hence we need to multiply by the divisor to emulate reduce_add var divisor = in_shape[axis] var divisor_constant_value = Tensor[DType.float32]( TensorShape(1), divisor ) var divisor_constant = graph.constant(divisor_constant_value) arg0 = ops.mean(arg0, axis) * divisor_constant symbol_trace.append(arg0) continue elif len(tmp_args) == 1: # unary op arg0 = symbol_trace[tmp_args[0].id()] if array[].name() == "abs": symbol_trace.append(ops.abs(arg0)) # elif array[].name() == "acos": # symbol_trace.append(ops.acos(arg0)) # elif array[].name() == "asin": # symbol_trace.append(ops.asin(arg0)) # elif array[].name() == "atan": # symbol_trace.append(ops.atan(arg0)) elif array[].name() == "cos": symbol_trace.append(ops.cos(arg0)) # elif array[].name() == "cosh": # symbol_trace.append(ops.cosh(arg0)) elif array[].name() == "exp": symbol_trace.append(ops.exp(arg0)) elif array[].name() == "log": symbol_trace.append(ops.log(arg0)) elif array[].name() == "neg": symbol_trace.append(-arg0) elif array[].name() == "reciprocal": symbol_trace.append(1 / arg0) elif array[].name() == "relu": symbol_trace.append(ops.relu(arg0)) elif array[].name() == "sigmoid": symbol_trace.append(ops.sigmoid(arg0)) # elif array[].name() == "sign": # symbol_trace.append(ops.sign(arg0)) elif array[].name() == "sin": symbol_trace.append(ops.sin(arg0)) # elif array[].name() == "sinh": # symbol_trace.append(ops.sinh(arg0)) elif array[].name() == "sqrt": symbol_trace.append(ops.sqrt(arg0)) # elif array[].name() == "tan": # symbol_trace.append(ops.tan(arg0)) elif array[].name() == "tanh": symbol_trace.append(ops.tanh(arg0)) else: print("Unknown unary op:", array[].name()) elif len(tmp_args) == 2: var arg1 = symbol_trace[tmp_args[0].id()] var arg2 = symbol_trace[tmp_args[1].id()] # binary ops if array[].name() == "add": symbol_trace.append(ops.add(arg1, arg2)) elif array[].name() == "sub": symbol_trace.append(ops.sub(arg1, arg2)) elif array[].name() == "mul": symbol_trace.append(ops.mul(arg1, arg2)) elif array[].name() == "div": symbol_trace.append(ops.div(arg1, arg2)) elif array[].name() == "pow_to": symbol_trace.append(ops.pow(arg1, arg2)) elif array[].name() == "matmul": symbol_trace.append(ops.matmul(arg1, arg2)) # comparison ops elif array[].name() == "greater_equal": symbol_trace.append(ops.greater_equal(arg1, arg2)) elif array[].name() == "greater": symbol_trace.append(ops.greater(arg1, arg2)) elif array[].name() == "equal": symbol_trace.append(ops.equal(arg1, arg2)) elif array[].name() == "not_equal": symbol_trace.append(ops.not_equal(arg1, arg2)) elif array[].name() == "less": symbol_trace.append(ops.greater(arg2, arg1)) elif array[].name() == "less_equal": symbol_trace.append(ops.greater_equal(arg2, arg1)) # spatial ops # conv ops elif array[].name() == "conv1d": var params = array_shape_to_list( array[].array_shape().args()[2] ) var stride = params[0] var padding = params[1] var dilation = params[2] var groups = params[3] symbol_trace.append( ops.squeeze( ops.conv2d( ops.unsqueeze(arg1, -2), ops.unsqueeze(arg2, -2), stride=(1, stride), dilation=(1, dilation), padding=( padding, padding, 0, 0, ), # (left, right, top, bottom) groups=groups, ), -2, ) ) elif array[].name() == "conv2d": var params = array_shape_to_list( array[].array_shape().args()[2] ) var stride_height = params[0] var stride_width = params[1] var padding_height = params[2] var padding_width = params[3] var dilation_height = params[4] var dilation_width = params[5] var groups = params[6] symbol_trace.append( ops.conv2d( arg1, arg2, stride=(stride_height, stride_width), dilation=(dilation_height, dilation_width), padding=( padding_width, padding_width, padding_height, padding_height, ), # (left, right, top, bottom) groups=groups, ) ) elif array[].name() == "conv3d": var params = array_shape_to_list( array[].array_shape().args()[2] ) var stride_depth = params[0] var stride_height = params[1] var stride_width = params[2] var padding_depth = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_depth = params[6] var dilation_height = params[7] var dilation_width = params[8] var groups = params[9] symbol_trace.append( ops.conv3d( arg1, arg2, stride=(stride_depth, stride_height, stride_width), dilation=( dilation_depth, dilation_height, dilation_width, ), padding=( padding_width, padding_width, padding_height, padding_height, padding_depth, padding_depth, ), # (left, right, top, bottom, front, back) groups=groups, ) ) # pooling ops elif array[].name() == "maxpool1d": var params = array_shape_to_list( array[].array_shape().args()[1] ) var kernel_size = params[0] var stride = params[1] var padding = params[2] var dilation = params[3] symbol_trace.append( ops.squeeze( ops.max_pool( ops.unsqueeze(arg1, -2), filter_shape=(1, kernel_size), stride=(1, stride), dilation=(1, dilation), padding=( padding, padding, 0, 0, ), # (left, right, top, bottom) ), -2, ) ) elif array[].name() == "maxpool2d": var params = array_shape_to_list( array[].array_shape().args()[1] ) var kernel_height = params[0] var kernel_width = params[1] var stride_height = params[2] var stride_width = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_height = params[6] var dilation_width = params[7] symbol_trace.append( ops.max_pool( arg1, filter_shape=(kernel_height, kernel_width), stride=(stride_height, stride_width), dilation=(dilation_height, dilation_width), padding=( padding_width, padding_width, padding_height, padding_height, ), # (left, right, top, bottom) ) ) elif array[].name() == "maxpool3d": raise "maxpool3d not implemented in MAX" # avgpool ops elif array[].name() == "avgpool1d": var params = array_shape_to_list( array[].array_shape().args()[1] ) var kernel_size = params[0] var stride = params[1] var padding = params[2] var dilation = params[3] var count_boundary = True # not an option in Endia yet! symbol_trace.append( ops.squeeze( ops.avg_pool( ops.unsqueeze(arg1, -2), filter_shape=(1, kernel_size), stride=(1, stride), dilation=(1, dilation), padding=( padding, padding, 0, 0, ), # (left, right, top, bottom) count_boundary=count_boundary, ), -2, ) ) elif array[].name() == "avgpool2d": var params = array_shape_to_list( array[].array_shape().args()[1] ) var kernel_height = params[0] var kernel_width = params[1] var stride_height = params[2] var stride_width = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_height = params[6] var dilation_width = params[7] var count_boundary = True # not an option in Endia yet! symbol_trace.append( ops.avg_pool( arg1, filter_shape=(kernel_height, kernel_width), stride=(stride_height, stride_width), dilation=(dilation_height, dilation_width), padding=( padding_width, padding_width, padding_height, padding_height, ), # (left, right, top, bottom) count_boundary=count_boundary, ) ) elif array[].name() == "avgpool3d": raise "avgpool3d not implemented in MAX" # binary ops error handling else: print("Unknown binary op:", array[].name()) else: raise "Unknown op:" + array[].name() for output in outputs: output_symbols.append(symbol_trace[output[].id()]) graph.output(output_symbols) return graph fn build_model( args: List[Array], outputs: List[Array], trace: List[Array] ) raises -> Model: print("JIT compiling a new subgraph...") var graph = build_graph(args, outputs, trace) var session = InferenceSession() var model = session.load(graph) return model def execute_model( args: List[Array], outputs: List[Array], model: Model ) -> List[Array]: # Convert args to numpy arrays and store in numpy dict with key "input0", "input1", ... var np = Python.import_module("numpy") var numpy_dict = Python.dict() for id in range(len(args)): var arg = args[id] var np_array = array_to_numpy(arg, np) numpy_dict["input" + str(id)] = np_array # Execute_max_graph the model var results = model.execute(numpy_dict^) # Put all intermediate nodes into the output list var array_outputs = List[Array]() for i in range(len(outputs)): var output = results.get[DType.float32]("output" + str(i)) array_outputs.append(tensor_to_array(output)) return array_outputs --- endia/compile/python_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # # from extensibility import Tensor, empty_tensor from max.tensor import Tensor import python from endia import Array @always_inline fn memcpy_to_numpy(array: PythonObject, tensor: Array) raises: var dst = DTypePointer[dtype]( address=int(array.__array_interface__["data"][0]) ) var src = tensor.data() var length = tensor.size() memcpy(dst, src, length) @always_inline fn shape_to_python_list(shape: List[Int]) raises -> PythonObject: var python_list = python.Python.evaluate("list()") for i in range(len(shape)): _ = python_list.append(shape[i]) return python_list^ @always_inline fn get_np_dtype[dtype: DType](np: PythonObject) raises -> PythonObject: @parameter if dtype.is_float32(): return np.float32 elif dtype.is_int32(): return np.int32 elif dtype.is_int64(): return np.int64 elif dtype.is_uint8(): return np.uint8 raise "Unknown datatype" @always_inline fn array_to_numpy(tensor: Array, np: PythonObject) raises -> PythonObject: var shape = shape_to_python_list(tensor.shape()) var tensor_as_numpy = np.zeros(shape, np.float32) _ = shape^ memcpy_to_numpy(tensor_as_numpy, tensor) return tensor_as_numpy^ fn tensor_to_array(src: Tensor[dtype]) raises -> Array: var shape = List[Int]() for i in range(src.rank()): shape.append(src.shape()[i]) var dst = Array(shape) var dst_data = dst.data() var src_data = src._ptr memcpy(dst_data, src_data, dst.size()) return dst --- endia/compile/readme.md --- # JIT Compilation in Endia (experimental) Endia provides Just-In-Time (JIT) compilation capabilities to optimize and cache function execution for improved performance. The JIT compiler traces function calls, optimizes subgraphs, and caches the results for future use. By default the JIT compiler uses a set of home made optimizations to improve performance. However, you can also leverage Modular's **MAX Engine** 🔥. In certain scenarios, using **MAX** can provide additional performance benefits. ## JIT Compilation Process 1. **Tracing**: The function is traced, capturing all operations performed on the input arrays. 2. **Branch Handling**: The JIT compiler can handle functions with conditional statements. It compares operations during execution with previously captured traces, branching when necessary and storing new paths. 3. **Graph Building**: The traced operations form a computation graph, with each node representing an operation or an array. 4. **Subgraph Optimization**: The graph is divided into subgraphs marked by breakpoints. These subgraphs are optimized by fusing elementwise operations and applying other optimizations. 5. **Caching**: Optimized subgraphs are cached for future use. When the same breakpoint is encountered in subsequent executions, the cached, optimized subgraph is used instead of recomputing. ## Performance Considerations - JIT compilation can significantly improve performance for functions that are called multiple times with similar input shapes. - The first call to a JIT-compiled function may be slower due to the tracing and optimization process. - For functions with highly dynamic control flow that changes frequently based on input data, JIT compilation may not provide significant benefits. --- endia/fft/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # --- endia/fft/readme.md --- # Fast Fourrier Transforms --- endia/functional/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .binary_ops import * from .comparison_ops import * from .unary_ops import * from .reduce_ops import * from .view_ops import * from .index_ops import * from .init_ops import * from .loss_ops import * from .spacial_ops import * --- endia/functional/_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import * from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math ############################################################################################################### # Array utils and setup ############################################################################################################### @always_inline fn compute_stride(shape: List[Int]) -> List[Int]: var stride = List[Int]() for _ in range(len(shape)): stride.append(1) for i in range(len(shape) - 2, -1, -1): stride[i] = stride[i + 1] * shape[i + 1] return stride @always_inline fn compute_storage_offset( indices: List[Int], stride: List[Int], storage_offset: Int ) -> Int: # if len(indices) != len(stride): # raise "Indices and stride must have the same length" var result = storage_offset for i in range(len(indices)): result += indices[i] * stride[i] return result @always_inline fn compute_nd_index(index: Int, shape: List[Int]) -> List[Int]: # if len(shape) == 0: # raise "Shape must have at least one dimension" var indices = List[Int]() var flat_idx = index for i in range(len(shape) - 1, -1, -1): indices.append(flat_idx % shape[i]) flat_idx //= shape[i] indices.reverse() return indices fn compute_indeces_for_matmul( i: Int, res: Array, lhs_b: Array, rhs_b: Array ) raises -> List[Int]: var nd_idx_res = compute_nd_index(i, res.shape()) var nd_idx_lhs = List[Int]() var nd_idx_rhs = List[Int]() for j in range(len(nd_idx_res) - 2): nd_idx_lhs.append(nd_idx_res[j] if lhs_b.stride()[j] != 0 else 0) nd_idx_rhs.append(nd_idx_res[j] if rhs_b.stride()[j] != 0 else 0) nd_idx_lhs.append(nd_idx_res[len(nd_idx_res) - 2]) nd_idx_lhs.append(0) nd_idx_rhs.append(0) nd_idx_rhs.append(nd_idx_res[len(nd_idx_res) - 1]) var lhs_idx_tmp = compute_storage_offset(nd_idx_lhs, lhs_b.stride(), 0) var rhs_idx_tmp = compute_storage_offset(nd_idx_rhs, rhs_b.stride(), 0) return List(lhs_idx_tmp, rhs_idx_tmp) fn execute_copy_raw( source_data: DTypePointer[DType.float32], dest_data: DTypePointer[DType.float32], val_shape: ArrayShape, is_complex: Bool, ) raises: var rank = val_shape.ndim() var shape = List[Int]() var stride = List[Int]() if rank == 1: shape.append(1) stride.append(0) shape.append(val_shape.shape()[0]) stride.append(val_shape.stride()[0]) else: shape = val_shape.shape() stride = val_shape.stride() rank = len(shape) var rows = shape[rank - 2] var cols = shape[rank - 1] var size = 1 for i in range(rank): size *= shape[i] var flat_idx = 0 for k in range(0, size, rows * cols): var nd_idx = compute_nd_index(k, shape) var base_idx = compute_storage_offset( nd_idx, stride, val_shape.storage_offset() ) for i in range(rows): var i_idx = base_idx + i * stride[rank - 2] if is_complex: if stride[rank - 1] == 1: @parameter fn copy_v[simd_width: Int](j: Int): var j_idx = i_idx + j * stride[rank - 1] dest_data.store[width = 2 * simd_width]( flat_idx * 2, source_data.load[width = 2 * simd_width](j_idx * 2), ) flat_idx += simd_width vectorize[copy_v, nelts[dtype]()](cols) else: for j in range(cols): var j_idx = i_idx + j * stride[rank - 1] dest_data.store( 2 * flat_idx, source_data.load(2 * j_idx) ) dest_data.store( 2 * flat_idx + 1, source_data.load(2 * j_idx + 1) ) flat_idx += 1 else: if stride[rank - 1] == 1: @parameter fn copy_v_complex[simd_width: Int](j: Int): var j_idx = i_idx + j * stride[rank - 1] dest_data.store[width=simd_width]( flat_idx, source_data.load[width=simd_width](j_idx) ) flat_idx += simd_width vectorize[copy_v_complex, nelts[dtype]()](cols) else: for j in range(cols): var j_idx = i_idx + j * stride[rank - 1] dest_data.store(flat_idx, source_data.load(j_idx)) flat_idx += 1 fn copy(arg: Array) raises -> Array: var res = Array(arg.shape(), False, arg.is_complex()) execute_copy_raw( arg.data(), res.data(), arg.array_shape(), arg.is_complex() ) return res fn contiguous(arg: Array) raises -> Array: var arg_stride = arg.stride() var expected_stride = compute_stride(arg.shape()) if arg.is_complex(): for i in range(len(expected_stride)): expected_stride[i] *= 2 var is_contiguous = True for i in range(len(arg_stride)): if arg_stride[i] != expected_stride[i]: is_contiguous = False break var res = arg if is_contiguous else copy(arg) return res fn op_array( array_shape: ArrayShape, args: List[Array], kwargs: List[Array] = NA, name: String = "nan_op", callable: fn (inout Array, List[Array]) raises -> None = default_fwd, jvp: fn (List[Array], List[Array]) raises -> Array = default_jvp, vjp: fn (List[Array], Array, Array) raises -> List[Array] = default_vjp, is_view: Bool = False, uew_op: Optional[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ] = None, bew_op: Optional[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ] = None, ) raises -> Array: """ This operation will setup an array i.e. a node in the background with all its necessary data and the functions (forward/jvp/vjp etc.) that act on its direct parent nodes. If any of the parent nodes/args point to JIT graph on which caches all the operations, we also always use this graph for the current newly created array. The JIT FxGraph is always passed as a reference to the node, so that we can always access the graph. """ var res_arr = Array(array_shape) res_arr.set_fwd(callable) res_arr.kwargs_(kwargs) res_arr.set_name(name) res_arr.is_view_(is_view) var requires_grad = False var is_complex = False for arg in args: requires_grad = requires_grad or arg[].requires_grad() is_complex = is_complex or arg[].is_complex() res_arr.is_complex_(is_complex) if requires_grad: res_arr.requires_grad_(True) res_arr.args_(args) res_arr.jvp_(jvp) res_arr.vjp_(vjp) if uew_op: var op = uew_op res_arr.append_uew(op.unsafe_take()) if bew_op: var op = bew_op res_arr.append_bew(op.unsafe_take()) # print("Try: registering operation", res_arr.name()) # go through all args and if any of them points to a graph we take this graph and also let the current node point to this graph, then we register the opertaitaon with the node in the graph for arg in args: # res_arr.args(): if arg[].has_fxgraph(): # print("Do: registering operation", res_arr.name()) var graph = arg[].graph() graph[].op_arrayeration(res_arr) res_arr.graph_(graph) # var arr_shape = res_arr.graph_dual().array_shape() # compute_shape(arr_shape, True) var res_arr_dual = res_arr.graph_dual() # adapt args of dual_arr to catch external args as well var adapted_args = res_arr_dual.args() for i in range(len(adapted_args)): var static_outter_arg = args[i] if not static_outter_arg.has_fxgraph(): # adapted_args[i] = contiguous(static_outter_arg) # adapted_args[i].graph_(graph) # adapted_args[i].set_name("arg") adapted_args[i] = copy(static_outter_arg) res_arr_dual.args_(adapted_args) # if node has been visited before and is marked as breakpoint, we need to compute it var arr_node = graph[].trace[res_arr.id_in_graph()] if arr_node.is_breakpoint: _ = res_arr.item(0) return res_arr callable(res_arr, args) return res_arr fn setup_shape_and_data(inout curr: Array) raises: var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) var true_size = array_shape.size() if not curr.is_complex() else 2 * array_shape.size() curr.data_(DTypePointer[dtype].alloc(true_size)) memset_zero(curr.data(), true_size) if not curr.requires_grad(): array_shape.shape_node[].args.clear() # print("Setup shape and data", curr.name()) @always_inline fn execute_inplace_ops_inline( inout curr: Array, uew: List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ], bew: List[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ], inplace_infos: List[InplaceInfo], args: List[Array], idx: Int, ) raises: var simd_data = curr.load[nelts[dtype]() * 2 // 2](idx) for i in range(len(inplace_infos)): var info = inplace_infos[i] if info.type == 0: var op = uew[info.idx] simd_data = op(simd_data, SIMD[dtype, nelts[dtype]() * 2 // 2]())[0] else: var op = bew[info.idx] var arg2 = args[info.arg_id] var arg2_data = arg2.load[nelts[dtype]() * 2 // 2](idx) simd_data = op( simd_data, arg2_data, SIMD[dtype, nelts[dtype]() * 2 // 2](), SIMD[dtype, nelts[dtype]() * 2 // 2](), )[0] curr.store[nelts[dtype]() * 2 // 2](idx, simd_data) fn execute_inplace_ops(inout curr: Array) raises: var uew = curr.uew() var bew = curr.bew() var inplace_infos = curr.inplace_infos() var args = curr.args() for data_idx in range(0, curr.size(), nelts[dtype]()): execute_inplace_ops_inline( curr, uew, bew, inplace_infos, args, data_idx ) --- endia/functional/binary_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .add_op import add from .sub_op import sub from .mul_op import mul from .div_op import div from .matmul_op import matmul from .pow_op import pow_to --- endia/functional/binary_ops/_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.functional._utils import ( contiguous, op_array, setup_array_shape, ) from endia.utils import NA, broadcast_shapes trait DifferentiableBinaryOp: """ Trait for binary operations that are differentiable. That mean they define methods for both forward and reverse mode automatic differentiation. """ @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: ... @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: ... @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: ... @staticmethod fn binary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: ... @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: ... fn binary_op_array( arg0: Array, arg1: Array, name: String, fwd: fn (inout Array, List[Array]) raises -> None, jvp: fn (List[Array], List[Array]) raises -> Array, vjp: fn (List[Array], Array, Array) raises -> List[Array], inplace_op: Optional[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ] = None, ) raises -> Array: var arr_shape = setup_array_shape( List(arg0.array_shape(), arg1.array_shape()), "broadcast shapes", broadcast_shapes, ) if not arg0.has_fxgraph() and not arg1.has_fxgraph(): compute_shape(arr_shape, arg0.requires_grad() or arg1.requires_grad()) var args = List( expand(arg0, arr_shape), expand(arg1, arr_shape), ) return op_array( arr_shape, args, NA, name, fwd, jvp, vjp, False, None, inplace_op ) fn execute_binary_op(inout curr: Array, args: List[Array]) raises: var simd_op = curr.bew()[0] var arg0 = contiguous(args[0]) var arg1 = contiguous(args[1]) if arg0.ndim() == 1 and arg0.shape()[0] == 1: arg0 = full(arg1.shape()[-1], arg0.load(0)) if arg1.ndim() == 1 and arg1.shape()[0] == 1: arg1 = full(arg0.shape()[-1], arg1.load(0)) var arg0_data = arg0.data() var arg1_data = arg1.data() var curr_data = curr.data() var rest_size = curr.size() % nelts[dtype]() var end = curr.size() - rest_size if curr.is_complex(): for i in range(0, end, nelts[dtype]()): var idx_real = i * 2 # var idx_imag = idx_real + 1 var data0 = arg0_data.load[width = nelts[dtype]() * 2]( idx_real ).deinterleave() var data1 = arg1_data.load[width = nelts[dtype]() * 2]( idx_real ).deinterleave() var res_deinterleaved = simd_op( data0[0], data1[0], data0[1], data1[1] ) var res = res_deinterleaved[0].interleave(res_deinterleaved[1]) curr_data.store[width = 2 * ((nelts[dtype]() * 2) // 2)]( idx_real, res ) if rest_size != 0: var rest_simd0_real = SIMD[dtype, nelts[dtype]() * 2 // 2]() var rest_simd0_imag = SIMD[dtype, nelts[dtype]() * 2 // 2]() var rest_simd1_real = SIMD[dtype, nelts[dtype]() * 2 // 2]() var rest_simd1_imag = SIMD[dtype, nelts[dtype]() * 2 // 2]() for i in range(rest_size): var idx_real = (end + i) * 2 var idx_imag = idx_real + 1 rest_simd0_real[i] = arg0_data.load(idx_real) rest_simd0_imag[i] = arg0_data.load(idx_imag) rest_simd1_real[i] = arg1_data.load(idx_real) rest_simd1_imag[i] = arg1_data.load(idx_imag) var res = simd_op( rest_simd0_real, rest_simd1_real, rest_simd0_imag, rest_simd1_imag, ) for i in range(rest_size): var idx_real = (end + i) * 2 var idx_imag = idx_real + 1 curr_data.store(idx_real, res[0][i]) curr_data.store(idx_imag, res[1][i]) else: for i in range(0, end, nelts[dtype]()): var res = simd_op( arg0_data.load[width = nelts[dtype]() * 2 // 2](i), arg1_data.load[width = nelts[dtype]() * 2 // 2](i), SIMD[dtype, nelts[dtype]() * 2 // 2](0), SIMD[dtype, nelts[dtype]() * 2 // 2](0), )[0] curr_data.store[width = nelts[dtype]() * 2 // 2](i, res) # now we vectorize along teh last dimesion if rest_size != 0: var rest_simd0 = SIMD[dtype, nelts[dtype]() * 2 // 2]() var rest_simd1 = SIMD[dtype, nelts[dtype]() * 2 // 2]() for i in range(rest_size): rest_simd0[i] = arg0_data.load(i + end) rest_simd1[i] = arg1_data.load(i + end) var res = simd_op( rest_simd0, rest_simd1, SIMD[dtype, nelts[dtype]() * 2 // 2](0), SIMD[dtype, nelts[dtype]() * 2 // 2](0), )[0] for i in range(end, curr.size()): curr_data.store(i, res[i - end]) _ = arg0 _ = arg1 _ = curr _ = args --- endia/functional/binary_ops/add_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableBinaryOp, execute_binary_op, binary_op_array ####--------------------------------------------------------------------------------------------------------------------#### #### Addition ####--------------------------------------------------------------------------------------------------------------------#### struct Add(DifferentiableBinaryOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: """Adds two arrays element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise sum of arg0 and arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = add(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return binary_op_array( arg0, arg1, "add", Add.__call__, Add.jvp, Add.vjp, Add.binary_simd_op, ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """ Compute Jacobian-vector product for array addition. Args: primals: Primal input arrays. tangents: Tangent vectors. Returns: Array: Jacobian-vector product. #### Note: Implements forward-mode automatic differentiation for addition. The result represents how the output changes with respect to infinitesimal changes in the inputs along the directions specified by the tangents. #### See Also: add_vjp: Reverse-mode autodiff for addition. """ return tangents[0] + tangents[1] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Compute vector-Jacobian product for array addition. Args: primals: Primal input arrays. grad: Gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: List[Array]: Gradients with respect to each input. #### Note: Implements reverse-mode automatic differentiation for addition. Returns arrays with shape zero for inputs that do not require gradients. #### See Also: add_jvp: Forward-mode autodiff for addition. """ return List( grad if primals[0].requires_grad() else Array(0), grad if primals[1].requires_grad() else Array(0), ) @staticmethod fn binary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to add two complex numbers represented as SIMD vectors. Args: arg0_real: The real part of the first complex number. arg1_real: The real part of the second complex number. arg0_imag: The imaginary part of the first complex number. arg1_imag: The imaginary part of the second complex number. Returns: The real and imaginary parts of the sum of the two complex numbers as a tuple. """ return arg0_real + arg1_real, arg0_imag + arg1_imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Adds two arrays element-wise and stores the result in the current array (curr). The function assumes that the shape and data of the args are already set up. If the shape and data of the current array (curr) is not set up, the function will compute the shape based on the shapes of the args and set up the data accordingly. Args: curr: The current array, must be mutable. args: The two arrays to add. Constraints: The two arrays must have broadcastable shapes. """ setup_shape_and_data(curr) execute_binary_op(curr, args) fn add(arg0: Array, arg1: Array) raises -> Array: """Adds two arrays element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise sum of arg0 and arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = add(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Add.fwd(arg0, arg1) --- endia/functional/binary_ops/div_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableBinaryOp, execute_binary_op, binary_op_array ####--------------------------------------------------------------------------------------------------------------------#### #### Division ####--------------------------------------------------------------------------------------------------------------------#### struct Div(DifferentiableBinaryOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: """Divides two arrays element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise division of arg0 and arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = div(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return binary_op_array( arg0, arg1, "div", Div.__call__, Div.jvp, Div.vjp, Div.binary_simd_op, ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """ Compute Jacobian-vector product for array division. Args: primals: Primal input arrays. tangents: Tangent vectors. Returns: Array: Jacobian-vector product. #### Note: Implements forward-mode automatic differentiation for division. The result represents how the output changes with respect to infinitesimal changes in the inputs along the directions specified by the tangents. #### See Also: div_vjp: Reverse-mode autodiff for division. """ return (tangents[0] - tangents[1] * primals[0]) / primals[1] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Compute vector-Jacobian product for array division. Args: primals: Primal input arrays. grad: Gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: List[Array]: Gradients with respect to each input. #### Note: Implements reverse-mode automatic differentiation for division. Returns arrays with shape zero for inputs that do not require gradients. #### See Also: div_jvp: Forward-mode autodiff for division. """ var lhs_grad = grad / primals[1] if primals[ 0 ].requires_grad() else Array(0) var rhs_grad = -grad * primals[0] / ( primals[1] * primals[1] ) if primals[1].requires_grad() else Array(0) return List(lhs_grad, rhs_grad) @staticmethod fn binary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to divide two complex numbers represented as SIMD vectors. Args: arg0_real: The real part of the first complex number. arg1_real: The real part of the second complex number. arg0_imag: The imaginary part of the first complex number. arg1_imag: The imaginary part of the second complex number. Returns: The real and imaginary parts of the division of the two complex numbers as a tuple. """ var denom = arg1_real * arg1_real + arg1_imag * arg1_imag return ( (arg0_real * arg1_real + arg0_imag * arg1_imag) / denom, (arg0_imag * arg1_real - arg0_real * arg1_imag) / denom, ) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Divides two arrays element-wise and stores the result in the current array (curr). The function assumes that the shape and data of the args are already set up. If the shape and data of the current array (curr) is not set up, the function will compute the shape based on the shapes of the args and set up the data accordingly. Args: curr: The current array, must be mutable. args: The two arrays to divide. Constraints: The two arrays must have broadcastable shapes. """ setup_shape_and_data(curr) execute_binary_op(curr, args) fn div(arg0: Array, arg1: Array) raises -> Array: """ Divides two arrays element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise division of the two input arrays. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = div([a, b]) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Div.fwd(arg0, arg1) --- endia/functional/binary_ops/matmul_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( op_array, setup_shape_and_data, contiguous, compute_stride, compute_indeces_for_matmul, execute_copy_raw, setup_array_shape, compute_shape, ) from endia.functional import permute, squeeze, expand ####--------------------------------------------------------------------------------------------------------------------#### #### Matrix Multiplication ####--------------------------------------------------------------------------------------------------------------------#### fn matmul_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of the result of a batched matrix multiplication operation. Given a lhs Array Shape (_,M,K) and a rhs Array Shape (_,K,N), the result will be (_,M,N). It also performs broadcasting on the two input shapes to make them compatible for matrix multiplication. Args: curr: The ArrayShape to store the result of the computation. args: Lhs ArrayShape, rhs ArrayShape. #### Constraints: - The number of dimensions of the lhs ArrayShape and rhs ArrayShape must be greater than or equal to 2. - The last dimension of the lhs ArrayShape must be equal to the second-to-last dimension of the rhs ArrayShape. """ var arg0 = args[0] var arg1 = args[1] var shape0 = arg0.shape_node[].shape var shape1 = arg1.shape_node[].shape var ndim0 = arg0.shape_node[].ndim var ndim1 = arg1.shape_node[].ndim if ndim0 < 2 or ndim1 < 2: raise "Invalid shapes for matmul, i.e. ndim < 2" if shape0[ndim0 - 1] != shape1[ndim1 - 2]: raise "Invalid shapes for matmul, i.e. shapes are not compatible for matmul" var shape = List[Int]() var diff = len(shape0) - len(shape1) if diff > 0: # shape0 has more dimensions for i in range(diff): shape.append(shape0[i]) for i in range(len(shape1) - 2): if shape0[i + diff] == shape1[i]: shape.append(shape0[i + diff]) elif shape0[i + diff] == 1: shape.append(shape1[i]) elif shape1[i] == 1: shape.append(shape0[i + diff]) else: raise "Error: matmul Incompatible shapes for broadcasting" else: # shape1 has more dimensions for i in range(-diff): shape.append(shape1[i]) for i in range(len(shape0) - 2): if shape1[i - diff] == shape0[i]: shape.append(shape1[i - diff]) elif shape1[i - diff] == 1: shape.append(shape0[i]) elif shape0[i] == 1: shape.append(shape1[i - diff]) else: raise "Error: matmul Incompatible shapes for broadcasting" shape.append(shape0[ndim0 - 2]) shape.append(shape1[ndim1 - 1]) curr.setup(shape) fn matmul_fwd(inout curr: Array, args: List[Array]) raises: """ Perfomr batched matrix multiplication between two arrays and stores the result in the current array (curr). The function assumes that the shape and data of the args are already set up. Args: curr: The current array, must be mutable. args: The two arrays to multiply. Constraints: The shapes of the two arrays must be compatible for matrix multiplication, i.e. the last dimension of the first array must be equal to the second last dimension of the second array. """ setup_shape_and_data(curr) # make sure that the first argument is contiguous var arg0 = contiguous(args[0]) # the follwing code is to make arg1 to be a contiguous transposed version of args[1] # we do so much here since we can't call teh high level .T() inside a fwd fucntion var second_shape = args[1].shape() var second_stride = args[1].stride() var secod_storage_offset = args[1].storage_offset() second_shape[-2] = args[1].shape()[-1] second_shape[-1] = args[1].shape()[-2] second_stride[-2] = args[1].stride()[-1] second_stride[-1] = args[1].stride()[-2] var second_transposed_array_shape = ArrayShape( second_shape, second_stride, secod_storage_offset ) var second_expected_stride = compute_stride(args[1].shape()) var is_same = True for i in range(second_shape.size): if second_stride[i] != second_expected_stride[i]: is_same = False break var arg1 = args[1] if is_same else Array( second_shape, is_complex=args[1].is_complex() ) if not is_same: execute_copy_raw( args[1].data(), arg1.data(), second_transposed_array_shape, args[1].is_complex(), ) # define some helper variables var res_rows = curr.shape()[curr.ndim() - 2] var res_cols = curr.shape()[curr.ndim() - 1] var lhs_cols = arg0.shape()[arg0.ndim() - 1] var lhs_stride = arg0.stride() var rhs_stride = arg1.stride() var res_stride = curr.stride() var lhs_rank = arg0.ndim() var rhs_rank = arg1.ndim() var res_rank = curr.ndim() var lhs_data = arg0.data() var rhs_data = arg1.data() var res_data = curr.data() # cache some of teh often used shape values var k_end = lhs_cols - (lhs_cols % nelts[dtype]()) var lhs_stride_min_1 = lhs_stride[lhs_rank - 1] var res_stride_min_1 = res_stride[res_rank - 1] var rhs_stride_min_1 = rhs_stride[rhs_rank - 1] var lhs_stride_min_2 = lhs_stride[lhs_rank - 2] var res_stride_min_2 = res_stride[res_rank - 2] var rhs_stride_min_2 = rhs_stride[rhs_rank - 2] # go through all matrix mbatches and compute the matmul respectively for i in range(0, curr.size(), res_rows * res_cols): var indeces = compute_indeces_for_matmul(i, curr, arg0, arg1) var lhs_idx_start = indeces[0] var rhs_idx_start = indeces[1] # perform the matmul @parameter fn matmul_par(m: Int): var res_idx_0 = i + m * res_stride_min_2 var lhs_idx_0 = lhs_idx_start + m * lhs_stride_min_2 for n in range(res_cols): var rhs_idx_0 = rhs_idx_start + n * rhs_stride_min_2 var res_idx = res_idx_0 + n * res_stride_min_1 if not curr.is_complex(): # we loop over the last dimension of the lhs and rhs matrices # since we transposed the rhs, we can vectorize along both arrays var sum = SIMD[dtype, nelts[dtype]()](0) for k in range(0, k_end, nelts[dtype]()): var lhs_idx = lhs_idx_0 + k * lhs_stride_min_1 var rhs_idx = rhs_idx_0 + k * rhs_stride_min_1 sum += lhs_data.load[width = nelts[dtype]()]( lhs_idx ) * rhs_data.load[width = nelts[dtype]()](rhs_idx) var sum_reduced = sum.reduce_add[1]() # add the rest of the elements for k in range(k_end, lhs_cols): var lhs_idx = lhs_idx_0 + k * lhs_stride_min_1 var rhs_idx = rhs_idx_0 + k * rhs_stride_min_1 sum_reduced += lhs_data.load(lhs_idx) * rhs_data.load( rhs_idx ) res_data.store(res_idx, sum_reduced) else: var sum_real = SIMD[dtype, 2 * nelts[dtype]() // 2](0) var sum_imag = SIMD[dtype, 2 * nelts[dtype]() // 2](0) for k in range(0, k_end, nelts[dtype]()): var lhs_idx = lhs_idx_0 + k * lhs_stride_min_1 var rhs_idx = rhs_idx_0 + k * rhs_stride_min_1 var lhs = lhs_data.load[width = 2 * nelts[dtype]()]( 2 * lhs_idx ).deinterleave() var rhs = rhs_data.load[width = 2 * nelts[dtype]()]( 2 * rhs_idx ).deinterleave() var lhs_real = lhs[0] var lhs_imag = lhs[1] var rhs_real = rhs[0] var rhs_imag = rhs[1] sum_real += lhs_real * rhs_real - lhs_imag * rhs_imag sum_imag += lhs_real * rhs_imag + lhs_imag * rhs_real var sum_real_reduced = sum_real.reduce_add[1]() var sum_imag_reduced = sum_imag.reduce_add[1]() # add the rest of the elements for k in range(k_end, lhs_cols): var lhs_idx = lhs_idx_0 + k * lhs_stride_min_1 var rhs_idx = rhs_idx_0 + k * rhs_stride_min_1 var lhs_real = lhs_data.load(2 * lhs_idx) var lhs_imag = lhs_data.load(2 * lhs_idx + 1) var rhs_real = rhs_data.load(2 * rhs_idx) var rhs_imag = rhs_data.load(2 * rhs_idx + 1) sum_real_reduced += ( lhs_real * rhs_real - lhs_imag * rhs_imag ) sum_imag_reduced += ( lhs_real * rhs_imag + lhs_imag * rhs_real ) res_data.store(2 * res_idx, sum_real_reduced) res_data.store(2 * res_idx + 1, sum_imag_reduced) parallelize[matmul_par](res_rows, res_rows) _ = res_stride _ = lhs_stride _ = rhs_stride _ = lhs_rank _ = rhs_rank _ = rhs_stride_min_1 _ = res_stride_min_1 _ = lhs_stride_min_1 _ = res_stride_min_2 _ = lhs_stride_min_2 _ = rhs_stride_min_2 _ = arg0 _ = arg1 fn matmul_vjp( primals: List[Array], grad: Array, out: Array ) raises -> List[Array]: """ Compute vector-Jacobian product for batched matrix multiplication. Args: primals: Primal input arrays. grad: Gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: List[Array]: Gradients with respect to each input. #### Note: Implements reverse-mode automatic differentiation for batched matrix multiplication. Returns arrays with shape zero for inputs that do not require gradients. #### See Also: fwd: Forward-mode autodiff for batched matrix multiplication. """ var lhs_grad = grad @ primals[1].T() if primals[ 0 ].requires_grad() else Array(0) var rhs_grad = primals[0].T() @ grad if primals[ 1 ].requires_grad() else Array(0) return List(lhs_grad, rhs_grad) fn matmul_jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """ Compute Jacobian-vector product for batched matrix multiplication. Args: primals: Primal input arrays. tangents: Tangent vectors. Returns: Array: Jacobian-vector product. #### Note: Implements forward-mode automatic differentiation for batched matrix multiplication. The result represents how the output changes with respect to infinitesimal changes in the inputs along the directions specified by the tangents. #### See Also: vjp: Reverse-mode autodiff for batched matrix multiplication. """ return tangents[0] @ primals[1].T() + primals[0].T() @ tangents[1] fn matmul(arg0: Array, arg1: Array) raises -> Array: """ Perform batched matrix multiplication between two arrays. Args: arg0: The first input array. arg1: The second input array. Returns: The result of the batched matrix multiplication. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = matmul(a, b) print(result) ``` #### Note: The shapes of the two arrays must be compatible for matrix multiplication, i.e. the last dimension of the first array must be equal to the second last dimension of the second array. """ var arr_shape = setup_array_shape( List(arg0.array_shape(), arg1.array_shape()), "matmul_shape", matmul_shape, ) if not arg0.has_fxgraph() and not arg1.has_fxgraph(): compute_shape(arr_shape, arg0.requires_grad() or arg1.requires_grad()) var args = List( expand(arg0, arr_shape, List(-2, -1)), expand(arg1, arr_shape, List(-2, -1)), ) return op_array( arr_shape, args, NA, "matmul", matmul_fwd, matmul_jvp, matmul_vjp ) --- endia/functional/binary_ops/mul_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableBinaryOp, execute_binary_op, binary_op_array ####--------------------------------------------------------------------------------------------------------------------#### #### Multiplication ####--------------------------------------------------------------------------------------------------------------------#### struct Mul(DifferentiableBinaryOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: """Multiplies two arrays element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise product of arg0 and arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = mul(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return binary_op_array( arg0, arg1, "mul", Mul.__call__, Mul.jvp, Mul.vjp, Mul.binary_simd_op, ) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Multiplies two arrays element-wise and stores the result in the current array (curr). The function assumes that the shape and data of the args are already set up. If the shape and data of the current array (curr) is not set up, the function will compute the shape based on the shapes of the args and set up the data accordingly. Args: curr: The current array, must be mutable. args: The two arrays to multiply. Constraints: The two arrays must have broadcastable shapes. """ setup_shape_and_data(curr) execute_binary_op(curr, args) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """ Compute Jacobian-vector product for array multiplication. Args: primals: Primal input arrays. tangents: Tangent vectors. Returns: Array: Jacobian-vector product. #### Note: Implements forward-mode automatic differentiation for multiplication. The result represents how the output changes with respect to infinitesimal changes in the inputs along the directions specified by the tangents. #### See Also: mul_vjp: Reverse-mode autodiff for multiplication. """ return tangents[0] * primals[1] + tangents[1] * primals[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Compute vector-Jacobian product for array multiplication. Args: primals: Primal input arrays. grad: Gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: List[Array]: Gradients with respect to each input. #### Note: Implements reverse-mode automatic differentiation for multiplication. Returns arrays with shape zero for inputs that do not require gradients. #### See Also: mul_jvp: Forward-mode autodiff for multiplication. """ return List( primals[1] * grad if primals[0].requires_grad() else Array(0), primals[0] * grad if primals[1].requires_grad() else Array(0), ) @staticmethod fn binary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to multiply two complex numbers represented as SIMD vectors. Args: arg0_real: The real part of the first complex number. arg1_real: The real part of the second complex number. arg0_imag: The imaginary part of the first complex number. arg1_imag: The imaginary part of the second complex number. Returns: The real and imaginary parts of the product of the two complex numbers as a tuple. """ return ( arg0_real * arg1_real - arg0_imag * arg1_imag, arg0_real * arg1_imag + arg0_imag * arg1_real, ) fn mul(arg0: Array, arg1: Array) raises -> Array: """Multiplies two arrays element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise product of arg0 and arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = mul(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Mul.fwd(arg0, arg1) --- endia/functional/binary_ops/pow_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional import log from ._utils import DifferentiableBinaryOp, execute_binary_op, binary_op_array ####--------------------------------------------------------------------------------------------------------------------#### #### Power Function ####--------------------------------------------------------------------------------------------------------------------#### struct Pow(DifferentiableBinaryOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: """Raises the first array to the power of the second array element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise result of raising arg0 to the power of arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = pow_to(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return binary_op_array( arg0, arg1, "pow_to", Pow.__call__, Pow.jvp, Pow.vjp, Pow.binary_simd_op, ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """ Compute Jacobian-vector product for array exponentiation. Args: primals: Primal input arrays. tangents: Tangent vectors. Returns: Array: Jacobian-vector product. #### Note: Implements forward-mode automatic differentiation for exponentiation. The result represents how the output changes with respect to infinitesimal changes in the inputs along the directions specified by the tangents. #### See Also: pow_vjp: Reverse-mode autodiff for exponentiation. """ return primals[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Compute vector-Jacobian product for array exponentiation. Args: primals: Primal input arrays. grad: Gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: List[Array]: Gradients with respect to each input. #### Note: Implements reverse-mode automatic differentiation for exponentiation. Returns arrays with shape zero for inputs that do not require gradients. #### See Also: pow_jvp: Forward-mode autodiff for exponentiation. """ var lhs_grad = grad * primals[1] * div(out, primals[0]) if primals[ 0 ].requires_grad() else Array(0) var rhs_grad = grad * out * log(primals[0]) if primals[ 1 ].requires_grad() else Array(0) return List(lhs_grad, rhs_grad) @staticmethod fn binary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to raise a complex number to a complex power represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg1_real: The real part of the power. arg0_imag: The imaginary part of the complex number. arg1_imag: The imaginary part of the power. Returns: The real and imaginary parts of the complex number raised to the complex power as a tuple. """ var log_mag = math.log( math.sqrt(arg0_real * arg0_real + arg0_imag * arg0_imag) ) var arg = math.atan2(arg0_imag, arg0_real) var u = math.exp(log_mag * arg1_real - arg * arg1_imag) var v = log_mag * arg1_imag + arg * arg1_real var real_part = u * math.cos(v) var imag_part = u * math.sin(v) return (real_part, imag_part) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Raises the first array to the power of the second array element-wise and stores the result in the current array (curr). The function assumes that the shape and data of the args are already set up. If the shape and data of the current array (curr) is not set up, the function will compute the shape based on the shapes of the args and set up the data accordingly. Args: curr: The current array, must be mutable. args: The two arrays to raise to the power. Constraints: The two arrays must have broadcastable shapes. """ setup_shape_and_data(curr) execute_binary_op(curr, args) fn pow_to(arg0: Array, arg1: Array) raises -> Array: """Raises the first array to the power of the second array element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise result of raising arg0 to the power of arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = pow(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Pow.fwd(arg0, arg1) --- endia/functional/binary_ops/readme.md --- # Binary Operations Binary operations are operations that take two Arrays as input and return a single Array as output. These operations are used to perform element-wise operations on two Arrays. The two Arrays must have the same shape, or be broadcastable to the same shape. --- endia/functional/binary_ops/sub_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableBinaryOp, execute_binary_op, binary_op_array ####--------------------------------------------------------------------------------------------------------------------#### #### Subtraction ####--------------------------------------------------------------------------------------------------------------------#### struct Sub(DifferentiableBinaryOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: """Subtracts two arrays element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise difference of arg0 and arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = sub(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return binary_op_array( arg0, arg1, "sub", Sub.__call__, Sub.jvp, Sub.vjp, Sub.binary_simd_op, ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """ Compute Jacobian-vector product for array subtraction. Args: primals: Primal input arrays. tangents: Tangent vectors. Returns: Array: Jacobian-vector product. #### Note: Implements forward-mode automatic differentiation for subtraction. The result represents how the output changes with respect to infinitesimal changes in the inputs along the directions specified by the tangents. #### See Also: sub_vjp: Reverse-mode autodiff for subtraction. """ return tangents[0] - tangents[1] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Compute vector-Jacobian product for array subtraction. Args: primals: Primal input arrays. grad: Gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: List[Array]: Gradients with respect to each input. #### Note: Implements reverse-mode automatic differentiation for subtraction. Returns arrays with shape zero for inputs that do not require gradients. #### See Also: sub_jvp: Forward-mode autodiff for subtraction. """ return List( grad if primals[0].requires_grad() else Array(0), -grad if primals[1].requires_grad() else Array(0), ) @staticmethod fn binary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to subtract two complex numbers represented as SIMD vectors. Args: arg0_real: The real part of the first complex number. arg1_real: The real part of the second complex number. arg0_imag: The imaginary part of the first complex number. arg1_imag: The imaginary part of the second complex number. Returns: The real and imaginary parts of the difference of the two complex numbers as a tuple. """ return arg0_real - arg1_real, arg0_imag - arg1_imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Subtracts two arrays element-wise and stores the result in the current array (curr). The function assumes that the shape and data of the args are already set up. If the shape and data of the current array (curr) is not set up, the function will compute the shape based on the shapes of the args and set up the data accordingly. Args: curr: The current array, must be mutable. args: The two arrays to subtract. Constraints: The two arrays must have broadcastable shapes. """ setup_shape_and_data(curr) execute_binary_op(curr, args) fn sub(arg0: Array, arg1: Array) raises -> Array: """ Subtracts two arrays element-wise. Args: arg0: The first input array. arg1: The second input array. Returns: The element-wise difference of arg0 and arg1. #### Examples: ```python a = Array([[1, 2], [3, 4]]) b = Array([[5, 6], [7, 8]]) result = sub(a, b) print(result) ``` #### This function supports - Broadcasting. - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Sub.fwd(arg0, arg1) --- endia/functional/comparison_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .ge_zero_op import ge_zero from .greater_equal_op import greater_equal from .greater_op import greater from .less_equal_op import less_equal from .less_op import less from .not_equal_op import not_equal from .equal_op import equal --- endia/functional/comparison_ops/_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.functional._utils import ( contiguous, op_array, setup_array_shape, ) from endia.utils import NA, broadcast_shapes trait ComparisonOp: """ Trait for comparison operations which are non-differentiable. """ @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: ... @staticmethod fn comparing_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: ... @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: ... fn comparison_op_array( arg0: Array, arg1: Array, name: String, fwd: fn (inout Array, List[Array]) raises -> None, inplace_op: Optional[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ] = None, ) raises -> Array: var arr_shape = setup_array_shape( List(arg0.array_shape(), arg1.array_shape()), "broadcast shapes", broadcast_shapes, ) if not arg0.has_fxgraph() and not arg1.has_fxgraph(): compute_shape(arr_shape, arg0.requires_grad() or arg1.requires_grad()) var args = List( expand(arg0, arr_shape), expand(arg1, arr_shape), ) return op_array( arr_shape, args, NA, name, fwd, default_jvp, default_vjp, False, None, inplace_op, ) --- endia/functional/comparison_ops/equal_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import ComparisonOp, comparison_op_array from endia.functional.binary_ops._utils import execute_binary_op ####--------------------------------------------------------------------------------------------------------------------#### #### Equal Operation ####--------------------------------------------------------------------------------------------------------------------#### struct Equal(ComparisonOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: return comparison_op_array( arg0, arg1, "equal", Equal.__call__, Equal.comparing_simd_op, ) @staticmethod fn comparing_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: var real = SIMD[dtype, nelts[dtype]() * 2 // 2](0) var imag = SIMD[dtype, nelts[dtype]() * 2 // 2](0) for i in range(nelts[dtype]() * 2 // 2): real[i] = arg0_real[i] == arg1_real[i] imag[i] = arg0_imag[i] == arg1_imag[i] return (real, imag) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: setup_shape_and_data(curr) execute_binary_op(curr, args) fn equal(arg0: Array, arg1: Array) raises -> Array: return Equal.fwd(arg0, arg1) --- endia/functional/comparison_ops/ge_zero_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional.unary_ops._utils import ( DifferentiableUnaryOp, unary_op_array, execute_unary_op, ) from endia.functional.binary_ops._utils import ( DifferentiableBinaryOp, binary_op_array, execute_binary_op, ) ####-----------------------------------------------------------------------------------------------------------------#### #### Greater Equal than Zero Operation ####-----------------------------------------------------------------------------------------------------------------#### struct GeZero(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the ge_zero of the input array element-wise. Args: arg0: The input array. Returns: An array containing the ge_zero of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = ge_zero(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "ge_zero", GeZero.__call__, GeZero.jvp, GeZero.vjp, GeZero.unary_simd_op, ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the ge_zero function. Implements forward-mode automatic differentiation for the ge_zero function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the ge_zero function. #### Note: The Jacobian-vector product for ge_zero is computed as cos(x) * dx, where x is the primal input and dx is the tangent vector. """ return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the ge_zero function. Implements reverse-mode automatic differentiation for the ge_zero function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for ge_zero is computed as cos(x) * grad, where x is the primal input and grad is the incoming gradient. """ return default_vjp(primals, grad, out) @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the ge_zero of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the ge_zero of the complex number as a tuple. """ var real = 0.5 * (arg0_real / abs(arg0_real)) + 0.5 return real, SIMD[dtype, nelts[dtype]() * 2 // 2](0) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise ge_zero computation of an array. Computes the ge_zero of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn ge_zero(arg0: Array) raises -> Array: """Computes the ge_zero of the input array element-wise. Args: arg0: The input array. Returns: An array containing the ge_zero of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = ge_zero(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return GeZero.fwd(arg0) --- endia/functional/comparison_ops/greater_equal_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import ComparisonOp, comparison_op_array from endia.functional.binary_ops._utils import execute_binary_op ####--------------------------------------------------------------------------------------------------------------------#### #### GreaterEqual Operation ####--------------------------------------------------------------------------------------------------------------------#### struct GreaterEqual(ComparisonOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: return comparison_op_array( arg0, arg1, "greater_equal", GreaterEqual.__call__, GreaterEqual.comparing_simd_op, ) @staticmethod fn comparing_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: var real = SIMD[dtype, nelts[dtype]() * 2 // 2](0) for i in range(nelts[dtype]() * 2 // 2): real[i] = arg0_real[i] >= arg1_real[i] return (real, SIMD[dtype, nelts[dtype]() * 2 // 2](0)) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: setup_shape_and_data(curr) execute_binary_op(curr, args) fn greater_equal(arg0: Array, arg1: Array) raises -> Array: return GreaterEqual.fwd(arg0, arg1) --- endia/functional/comparison_ops/greater_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import ComparisonOp, comparison_op_array from endia.functional.binary_ops._utils import execute_binary_op ####--------------------------------------------------------------------------------------------------------------------#### #### Greater Operation ####--------------------------------------------------------------------------------------------------------------------#### struct Greater(ComparisonOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: return comparison_op_array( arg0, arg1, "greater", Greater.__call__, Greater.comparing_simd_op, ) @staticmethod fn comparing_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: var real = SIMD[dtype, nelts[dtype]() * 2 // 2](0) for i in range(nelts[dtype]() * 2 // 2): real[i] = arg0_real[i] > arg1_real[i] return (real, SIMD[dtype, nelts[dtype]() * 2 // 2](0)) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: setup_shape_and_data(curr) execute_binary_op(curr, args) fn greater(arg0: Array, arg1: Array) raises -> Array: return Greater.fwd(arg0, arg1) --- endia/functional/comparison_ops/less_equal_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import ComparisonOp, comparison_op_array from endia.functional.binary_ops._utils import execute_binary_op ####--------------------------------------------------------------------------------------------------------------------#### #### LessEqualition ####--------------------------------------------------------------------------------------------------------------------#### struct LessEqual(ComparisonOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: return comparison_op_array( arg0, arg1, "less_equal", LessEqual.__call__, LessEqual.comparing_simd_op, ) @staticmethod fn comparing_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: var real = SIMD[dtype, nelts[dtype]() * 2 // 2](0) for i in range(nelts[dtype]() * 2 // 2): real[i] = arg0_real[i] <= arg1_real[i] return (real, SIMD[dtype, nelts[dtype]() * 2 // 2](0)) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: setup_shape_and_data(curr) execute_binary_op(curr, args) fn less_equal(arg0: Array, arg1: Array) raises -> Array: return LessEqual.fwd(arg0, arg1) --- endia/functional/comparison_ops/less_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import ComparisonOp, comparison_op_array from endia.functional.binary_ops._utils import execute_binary_op ####--------------------------------------------------------------------------------------------------------------------#### #### Less Operation ####--------------------------------------------------------------------------------------------------------------------#### struct Less(ComparisonOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: return comparison_op_array( arg0, arg1, "less", Less.__call__, Less.comparing_simd_op, ) @staticmethod fn comparing_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: var real = SIMD[dtype, nelts[dtype]() * 2 // 2](0) for i in range(nelts[dtype]() * 2 // 2): real[i] = arg0_real[i] < arg1_real[i] return (real, SIMD[dtype, nelts[dtype]() * 2 // 2](0)) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: setup_shape_and_data(curr) execute_binary_op(curr, args) fn less(arg0: Array, arg1: Array) raises -> Array: return Less.fwd(arg0, arg1) --- endia/functional/comparison_ops/not_equal_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import ComparisonOp, comparison_op_array from endia.functional.binary_ops._utils import execute_binary_op ####--------------------------------------------------------------------------------------------------------------------#### #### Not Equal Operation ####--------------------------------------------------------------------------------------------------------------------#### struct NotEqual(ComparisonOp): @staticmethod fn fwd(arg0: Array, arg1: Array) raises -> Array: return comparison_op_array( arg0, arg1, "not_equal", NotEqual.__call__, NotEqual.comparing_simd_op, ) @staticmethod fn comparing_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], arg1_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: var real = SIMD[dtype, nelts[dtype]() * 2 // 2](0) var imag = SIMD[dtype, nelts[dtype]() * 2 // 2](0) for i in range(nelts[dtype]() * 2 // 2): real[i] = arg0_real[i] != arg1_real[i] imag[i] = arg0_imag[i] != arg1_imag[i] return (real, imag) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: setup_shape_and_data(curr) execute_binary_op(curr, args) fn not_equal(arg0: Array, arg1: Array) raises -> Array: return NotEqual.fwd(arg0, arg1) --- endia/functional/comparison_ops/readme.md --- # Comparison Operations Comparison operations are operations that take an Array as input and return a boolean Array (with ones or zeros) as output. These operations are used to compare the elements of two Arrays. The two Arrays must have the same shape, or be broadcastable to the same shape. --- endia/functional/index_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .concat_op import concat --- endia/functional/index_ops/concat_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( list_to_array_shape, array_shape_to_list, setup_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( op_array, setup_shape_and_data, ) ####--------------------------------------------------------------------------------------------------------------------#### # Concatenate ####--------------------------------------------------------------------------------------------------------------------#### fn concat_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after concatenation. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShapes to concatenate, and the axis to concatenate along encoded in an ArrayShape. """ var num_args = len(args) - 1 var axis = array_shape_to_list(args[num_args]) var arg0 = args[0] if axis[0] < 0: axis[0] = arg0.ndim() + axis[0] if axis[0] >= arg0.ndim(): raise "Error: Axis out of bounds" if axis.size != 1: raise "Error: Only one axis is allowed for concatenation" for i in range(1, num_args): var arg = args[i] if arg0.ndim() != arg.ndim(): raise "Error: Incompatible shapes for concatenation" for j in range(arg0.ndim()): if arg0.shape()[j] != arg.shape()[j]: raise "Error: Incompatible shapes for concatenation" var shape = arg0.shape() shape[axis[0]] *= num_args curr.setup(shape) fn concat_fwd(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the concat operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The arrays to concatenate. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var arg_shapes = curr.array_shape().args() var axis = array_shape_to_list(arg_shapes[len(arg_shapes) - 1])[0] setup_shape_and_data(curr) if axis < 0: axis = curr.ndim() + axis # print(axis) # let's slice into curr and populate with the correct values in the corresponding arg fn concat_vjp( primals: List[Array], grad: Array, out: Array ) raises -> List[Array]: """ Computes the vector-Jacobian product for the concat operation. Args: primals: A list containing the primal input arrays. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: A list containing the gradients with respect to the input arrays. #### Note: The vector-Jacobian product for concat is computed by returning an empty list. """ var primals_grads = List[Array]() return primals_grads fn concat(args: List[Array], axis: Int) raises -> Array: """ Concatenates the input arrays along the given axis. Args: args: The arrays to concatenate. axis: The axis along which to concatenate. Returns: The concatenated array. """ var arg_shapes = List[ArrayShape]() for arg in args: arg_shapes.append(arg[].array_shape()) arg_shapes.append(list_to_array_shape(axis)) var arr_shape = setup_array_shape(arg_shapes, "concat", concat_shape) return op_array( arr_shape, args, NA, "concat", concat_fwd, default_jvp, concat_vjp, True ) --- endia/functional/index_ops/readme.md --- # Indexing Operations --- endia/functional/init_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .init_ops import * --- endia/functional/init_ops/init_ops.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import dtype import random from endia.functional._utils import compute_nd_index, compute_storage_offset ######################################################################## # Initialization Ops ######################################################################## fn array(*dims: Int, requires_grad: Bool = False) raises -> Array: var shape = List[Int]() for dim in dims: shape.append(dim) return Array(shape, requires_grad) fn array(arr_str: StringLiteral, requires_grad: Bool = False) raises -> Array: return Array(String(arr_str), requires_grad) fn tensor(*dims: Int, requires_grad: Bool = False) raises -> Array: var shape = List[Int]() for dim in dims: shape.append(dim) return Array(shape, requires_grad) fn tensor(arr_str: StringLiteral, requires_grad: Bool = False) raises -> Array: return Array(String(arr_str), requires_grad) fn ndarray(*dims: Int, requires_grad: Bool = False) raises -> Array: var shape = List[Int]() for dim in dims: shape.append(dim) return Array(shape, requires_grad) fn ndarray(arr_str: StringLiteral, requires_grad: Bool = False) raises -> Array: return Array(String(arr_str), requires_grad) fn Tensor(*dims: Int, requires_grad: Bool = False) raises -> Array: var shape = List[Int]() for dim in dims: shape.append(dim) return Array(shape, requires_grad) fn Tensor(arr_str: StringLiteral, requires_grad: Bool = False) raises -> Array: return Array(String(arr_str), requires_grad) fn arange_(inout arg: Array) raises: if arg.is_complex(): for i in range(arg.size()): arg.store_complex(i, i, 0) else: for i in range(arg.size()): arg.store(i, i) fn arange( start: SIMD[dtype, 1] = 0, end: SIMD[dtype, 1] = 1, step: SIMD[dtype, 1] = 1, requires_grad: Bool = False, ) raises -> Array: var size = int((end - start) / step) var res = Array(List(size), requires_grad) var data = res.data() var value = start for i in range(size): data[i] = value value += step return res fn zeros_(inout arg: Array) raises: if arg.is_complex(): memset_zero(arg.data(), arg.base().size() * 2) else: memset_zero(arg.data(), arg.base().size()) fn zeros(shape: List[Int], requires_grad: Bool = False) raises -> Array: var res = Array(shape, requires_grad) zeros_(res) return res fn zeros_like(arg: Array) raises -> Array: return zeros(arg.shape(), arg.requires_grad()) fn ones_(inout arg: Array) raises: if arg.is_complex(): for i in range(arg.size()): arg.store_complex(i, 1, 0) else: for i in range(arg.size()): arg.store(i, 1) fn ones(shape: List[Int], requires_grad: Bool = False) raises -> Array: var res = Array(shape, requires_grad) ones_(res) return res fn ones_like(arg: Array) raises -> Array: return ones(arg.shape(), arg.requires_grad()) fn eye_(inout arg: Array) raises: if arg.shape()[0] != arg.shape()[1] or not arg.ndim() == 2: raise "Error: eye_ requires a square matriarg" if arg.is_complex(): for i in range(arg.size()): arg.store_complex(i, 1, 0) else: for i in range(arg.shape()[1]): arg.store(i + i * arg.shape()[1], 1) fn eye(n: Int, requires_grad: Bool = False) raises -> Array: var res = Array(List(n, n), requires_grad) eye_(res) return res fn eye_like(arg: Array) raises -> Array: if arg.shape()[0] != arg.shape()[1] or not arg.ndim() == 2: raise "Error: eye_ requires a square matriarg" return eye(arg.shape()[0], arg.requires_grad()) fn fill_(inout arg: Array, value: SIMD[dtype, 1]) raises: for i in range(arg.size()): arg.store(i, value) # if arg.is_complex(): # for i in range(arg.size()): # arg.store_complex(i, value, 0) # else: # for i in range(arg.size()): # arg.store(i, value) fn full( shape: List[Int], value: SIMD[dtype, 1], requires_grad: Bool = False ) raises -> Array: var res = Array(shape, requires_grad) fill_(res, value) return res fn fill_like(arg: Array, value: SIMD[dtype, 1]) raises -> Array: return full(arg.shape(), value, arg.requires_grad()) fn indeces( shape: List[Int], stride: List[Int], storage_offset: Int, requires_grad: Bool = False, ) raises -> Array: var res = Array(shape, requires_grad) var total_elements = 1 for i in range(shape.size): total_elements *= shape[i] for index in range(total_elements): var nd_index = compute_nd_index(index, shape) var storage_offset = compute_storage_offset( nd_index, stride, storage_offset ) res.store[1](index, storage_offset) return res fn randu_(inout arg: Array, min: Float64 = 0, max: Float64 = 1) raises: random.seed() var data = arg.data() var size = arg.base().size() random.rand(data, size) for i in range(size): data[i] = min + data[i] * (max - min) fn randu( shape: List[Int], min: Float64 = 0, max: Float64 = 1, requires_grad: Bool = False, ) raises -> Array: var res = Array(shape, requires_grad) randu_(res, min, max) return res fn randu_like( inout arg: Array, min: Float64 = 0, max: Float64 = 1 ) raises -> Array: return randu(arg.shape(), min, max, arg.requires_grad()) fn randn_(inout arg: Array, mean: Float64 = 0, std: Float64 = 1) raises: random.seed() var data = arg.data() var size = arg.base().size() random.randn(data, size, mean, std) fn randn( shape: List[Int], mean: Float64 = 0, std: Float64 = 1, requires_grad: Bool = False, ) raises -> Array: var res = Array(shape, requires_grad) randn_(res, mean, std) return res fn randn_like( inout arg: Array, mean: Float64 = 0, std: Float64 = 1 ) raises -> Array: return randn(arg.shape(), mean, std, arg.requires_grad()) fn rand_he_normal_(inout arg: Array, fan_in: Float64 = 1) raises: var std = math.sqrt(2 / fan_in) randn_(arg, 0, std) fn rand_he_normal( shape: List[Int], fan_in: Float64 = 1, requires_grad: Bool = False ) raises -> Array: var res = Array(shape, requires_grad) rand_he_normal_(res, fan_in) return res fn rand_he_normal_like(arg: Array, fan_in: Float64 = 1) raises -> Array: return rand_he_normal(arg.shape(), fan_in, arg.requires_grad()) fn rand_he_uniform_(inout arg: Array, fan_in: Float64 = 1) raises: var limit = math.sqrt(6.0 / fan_in) randu_(arg, -limit, limit) fn rand_he_uniform( shape: List[Int], fan_in: Float64 = 1, requires_grad: Bool = False ) raises -> Array: var res = Array(shape, requires_grad) rand_he_uniform_(res, fan_in) return res fn rand_he_uniform_like(arg: Array, fan_in: Float64 = 1) raises -> Array: return rand_he_uniform(arg.shape(), fan_in, arg.requires_grad()) fn rand_xavier_normal_( inout arg: Array, fan_in: Float64 = 1, fan_out: Float64 = 1 ) raises: var std = math.sqrt(2.0 / (fan_in + fan_out)) randn_(arg, 0, std) fn rand_xavier_normal( shape: List[Int], fan_in: Float64 = 1, fan_out: Float64 = 1, requires_grad: Bool = False, ) raises -> Array: var res = Array(shape, requires_grad) rand_xavier_normal_(res, fan_in, fan_out) return res fn rand_xavier_normal_like( inout arg: Array, fan_in: Float64 = 1, fan_out: Float64 = 1 ) raises -> Array: return rand_xavier_normal(arg.shape(), fan_in, fan_out, arg.requires_grad()) fn rand_xavier_uniform_( inout arg: Array, fan_in: Float64 = 1, fan_out: Float64 = 1 ) raises: var limit = math.sqrt(6.0 / (fan_in + fan_out)) randu_(arg, -limit, limit) fn rand_xavier_uniform( shape: List[Int], fan_in: Float64 = 1, fan_out: Float64 = 1, requires_grad: Bool = False, ) raises -> Array: var res = Array(shape, requires_grad) rand_xavier_uniform_(res, fan_in, fan_out) return res fn rand_xavier_uniform_like( inout arg: Array, fan_in: Float64 = 1, fan_out: Float64 = 1 ) raises -> Array: return rand_xavier_uniform( arg.shape(), fan_in, fan_out, arg.requires_grad() ) fn rand_lecun_normal_(inout arg: Array, fan_in: Float64 = 1) raises: var std = math.sqrt(1.0 / fan_in) randn_(arg, 0, std) fn rand_lecun_normal( shape: List[Int], fan_in: Float64 = 1, requires_grad: Bool = False ) raises -> Array: var res = Array(shape, requires_grad) rand_lecun_normal_(res, fan_in) return res fn rand_lecun_normal_like( inout arg: Array, fan_in: Float64 = 1 ) raises -> Array: return rand_lecun_normal(arg.shape(), fan_in, arg.requires_grad()) fn rand_lecun_uniform_(inout arg: Array, fan_in: Float64 = 1) raises: var limit = math.sqrt(3.0 / fan_in) randu_(arg, -limit, limit) fn rand_lecun_uniform( shape: List[Int], fan_in: Float64 = 1, requires_grad: Bool = False ) raises -> Array: var res = Array(shape, requires_grad) rand_lecun_uniform_(res, fan_in) return res fn rand_lecun_uniform_like( inout arg: Array, fan_in: Float64 = 1 ) raises -> Array: return rand_lecun_uniform(arg.shape(), fan_in, arg.requires_grad()) fn complex( real: Array, imag: Array, requires_grad: Bool = False ) raises -> Array: # compare shapes, they must be equal if real.ndim() != imag.ndim(): raise "Error: real and imag parts must have the same shape" for i in range(real.ndim()): if real.shape()[i] != imag.shape()[i]: raise "Error: real and imag parts must have the same shape" var res = Array(real.shape(), requires_grad, True) for i in range(res.size()): res.store_complex(i, real.load(i), imag.load(i)) return res fn randn_complex( shape: List[Int], mean: Float64 = 0, std: Float64 = 1, requires_grad: Bool = False, ) raises -> Array: var real = randn(shape, mean, std, requires_grad) var imag = randn(shape, mean, std, requires_grad) return complex(real, imag, requires_grad) fn randu_complex( shape: List[Int], min: Float64 = 0, max: Float64 = 1, requires_grad: Bool = False, ) raises -> Array: var real = randu(shape, min, max, requires_grad) var imag = randu(shape, min, max, requires_grad) return complex(real, imag, requires_grad) fn fill_complex( shape: List[Int], value_real: Float64, value_imag: Float64, requires_grad: Bool = False, ) raises -> Array: var real = full(shape, value_real, requires_grad) var imag = full(shape, value_imag, requires_grad) return complex(real, imag, requires_grad) --- endia/functional/init_ops/readme.md --- # Array Initialization Operations Initialization operations are operations that allow you to create new Arrays. These operations are used to create Arrays with specific shapes and data types. Teh Array can be initialized with zeros, ones, specific scalar values, or random values. --- endia/functional/loss_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .mse_op import mse --- endia/functional/loss_ops/_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # --- endia/functional/loss_ops/mse_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd @always_inline fn mse(pred: nd.Array, target: nd.Array) raises -> nd.Array: var diff = nd.sub(pred, target) return nd.sum((diff * diff)) / pred.size() --- endia/functional/loss_ops/readme.md --- # Loss Operations Loss operations are operations that take two Arrays as input and return a single Array as output. These operations are used to mathematically measure the difference between two Arrays. The two Arrays must have the same shape, or be broadcastable to the same shape. --- endia/functional/readme.md --- # Array Operations Array operations are operations that take one or more Arrays as input and return one or more Arrays as output. Among others, Array operations can be categorized into the following types: unary operations, binary operations and view operations. # Build your own Custom Ops Endia allows you to create **custom differentiable operations** 🔥, enabling you to: 1. Implement new operations not available in the endia core library 2. Optimize existing operations for better performance 3. Develop domain-specific operations for your unique needs ## Creating a Custom Operation - A Step-by-Step Guide Let's walk through creating a custom elementwise multiplication operation, breaking it down into three key steps: 1. Implement the forward pass as a **low-level** function 2. Define the backward pass as a high-level **vector-Jacobian** product (vjp) function 3. **Register** the operation with Endia ### Step 1: Implementing the Forward Pass First, we define the function that performs the actual computation. For the sake of simplicity we leave out vectorization, parallelization and broadcasting: ```python # Import necessary modules from endia.utils import op_array, setup_shape_and_data, clone_shape from endia import Array # Define the forward pass as a low-level function def custom_mul_callable(inout curr: Array, args: List[Array]) -> None: setup_shape_and_data(curr) for i in range(curr.size()): curr.store(i, args[0].load(i) * args[1].load(i)) ``` **This function:** - Initializes the output array using `setup_shape_and_data` - Performs elementwise multiplication of the input arrays - Stores the result in the output array ### Step 2: Defining the Backward Pass We implement a vector-Jacobian product (vjp) function for efficient reverse-mode automatic differentiation: ```python def custom_mul_vjp(primals: List[Array], grad: Array, out: Array) -> List[Array]: return List(custom_mul(grad, primals[1]), custom_mul(grad, primals[0])) ``` ***Mathematical Explanation:*** In the following, we denote: `f` as the custom_mul_vjp, `x` as primals[0], `y` as primals[1], `v` as the incoming gradient `grad` adn `L` as the scalar output of the entire differentiable program. - *Objective:* Propagate the incoming (given) gradient `v = ∂L/∂f` backwards through our custom function. - *Derivative Computation:* To determine how small input changes affect the output of our custom function, we calculate its **Partial Derivatives**. For our multiplication function `f(x,y) = x * y`, we differentiate with respect to each input variable `x` and `y`: `∂f/∂x = y` and `∂f/∂y = x`. - *Jacobian Formation:* We construct the **Jacobian Matrix** by arranging these partial derivatives: `J = [∂f/∂x, ∂f/∂y] = [y, x]` - *Gradient Propagation:* Applying the chain rule from calculus, we compute the **Vector-Jacobian Product** to obtain the derivatives `∂L/∂x` and `∂L/∂y`: `[∂L/∂x, ∂L/y] = v * J = ∂L/∂f * [y, x] = [∂L/∂f * y, ∂L/∂f * x]` ***Note 1: The Mojo compiler***: The Mojo compiler is smart enough to have us first define the `vjp` function using the custom_mul, and then define the custom_mul itself. ***Note 2: On Differentiation in Endia:*** A key advantage of Endia's design is that we can define the backward pass using existing differentiable operations. This means we don't need to implement the low-level details of gradient computation ourselves. Instead, we can express the gradient calculation in terms of operations that are already differentiable. This approach is crucial for enabling **higher-order differentiation** in Endia. When a function is purely defined in terms of differentiable smaller functions, we can differentiate the corresponding function as many times as we want. This is a powerful feature for various scientific computing applications, including optimization algorithms, differential equations solvers, and advanced machine learning models. ### Step 3: Registering the Operation Finally, we register our custom operation with Endia: ```python # Register the operation with Endia def custom_mul(arg0: Array, arg1: Array) -> Array: return op_array( array_shape=clone_shape(arg0.array_shape()), args=List(arg0, arg1), name="mul", callable=custom_mul_callable, vjp=custom_mul_vjp ) ``` **This function:** - Uses the Endia utility function `op_array` to register the operation - Specifies the output shape, input arrays, operation name, and callable functions ## Using the Custom Operation Here's how to use our new custom operation: ```python def main(): a = Array('[1, 2, 3]', requires_grad=True) b = Array('[4, 5, 6]', requires_grad=True) c = endia.sum(custom_mul(a, b)) print(c) # Expected: [32] c.backward() print(a.grad()) # Expected: [4, 5, 6] print(b.grad()) # Expected: [1, 2, 3] ``` ## That's it! Congratulations! You've created a custom differentiable operation in Endia. This capability opens up a world of possibilities for extending Endia's functionality to meet your specific needs. Whether you're optimizing existing operations or developing entirely new ones, custom operations are a powerful tool for enhancing your scientific computing workflows. 🎉 ## But there is more... You can read through the [actual imeplementations the built-in mul operation](https://github.com/endia-org/Endia/blob/main/endia/functional/binary_ops/mul_op.mojo) and you will see that they are implemented in a similar way, but with proper broadcasting capabilities, and a lot of optimizations for performance. In the above guide we mainly focused on doing reverse-mode automatic differentiation. However, Endia will soon also support forward-mode automatic differentiation, where the notion of the vector-Jacobian product is replaced by the Jacobian-vector product. **_Stay tuned!_** --- endia/functional/reduce_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .reduce_add_op import reduce_add from .reduce_max_op import reduce_max from .reduce_argmax_op import reduce_argmax from .reduce_min_op import reduce_min from .reduce_argmin_op import reduce_argmin from .sum_op import sum from .mean_op import mean from .std_op import std from .variance_op import variance --- endia/functional/reduce_ops/_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array trait DifferentiableReduceOp: @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: ... @staticmethod fn fwd(arg0: Array, axis: List[Int]) raises -> Array: ... @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: ... @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: ... @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: ... --- endia/functional/reduce_ops/mean_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze def mean(arg0: Array, axes: List[Int], keepdims: Bool = False) -> Array: """ Computes the mean of the input array along the specified axes. Args: arg0: The input array. axes: The axes along which to compute the mean. keepdims: If True, the reduced axes are retained in the output array. Returns: An array containing the mean of the input array along the specified axes. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = mean(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ var num_elements_arg0 = arg0.size() var res = reduce_add(arg0, axes) var num_elements_res = res.size() var divisor = num_elements_arg0 / num_elements_res if keepdims: return res / divisor return squeeze(res / divisor) --- endia/functional/reduce_ops/readme.md --- # Reduction Operations Reduction operations are operations that take an Array and certain parameters as input and return a single Array as output. These operations are used to reduce the dimensions of an Array along one or more axes. Common reduction operations include sum, mean, min, max, and argmin. --- endia/functional/reduce_ops/reduce_add_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze ####-----------------------------------------------------------------------------------------------------------------#### #### Reduce Ops ####-----------------------------------------------------------------------------------------------------------------#### struct ReduceAdd(DifferentiableReduceOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after reducing along a specific axis. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to reduce, and the axis to reduce along encoded in an ArrayShape. #### Constraints: - The axis must be a valid axis of the ArrayShape (args[0]). - The number of axis must not exceed the number of dimensions of the ArrayShape (args[0]). """ var arg = args[0] var axis = array_shape_to_list(args[1]) var shape = arg.shape_node[].shape var new_shape = List[Int]() for i in range(len(shape)): if not list_contains(axis, i): new_shape.append(shape[i]) else: new_shape.append(1) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for element-wise addition of two arrays. Computes the sum of the input arrays and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input arrays. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and the axis and sets up the data accordingly. """ setup_shape_and_data(curr) var arg = contiguous(args[0]) var arg_shape = arg.shape() var arg_stride = arg.stride() var target_shape = curr.shape() var rank = curr.ndim() var target_stride = compute_stride(target_shape) for i in range(rank): if target_shape[i] == 1 and arg_shape[i] != 1: target_stride[i] = 0 var target_storage_offset = curr.storage_offset() var curr_data = curr.data() var arg_data = arg.data() if rank != 1: # check if both shapes are actually equal and we simply have to perdorm a fast copy var rows = arg_shape[rank - 2] var cols = arg_shape[rank - 1] for i in range(0, arg.size(), rows * cols): var nd_idx = compute_nd_index(i, arg_shape) var target_idx_0 = compute_storage_offset( nd_idx, target_stride, target_storage_offset ) for j in range(rows): var base_idx_1 = i + j * arg_stride[rank - 2] var target_idx_1 = target_idx_0 + j * target_stride[ rank - 2 ] if ( arg_stride[rank - 1] == 1 and target_stride[rank - 1] == 1 ): @parameter fn reduce_v[width: Int](k: Int): var base_idx = base_idx_1 + k * arg_stride[rank - 1] var target_idx = target_idx_1 + k * target_stride[ rank - 1 ] curr_data.store[width=width]( target_idx, curr_data.load[width=width](target_idx) + arg_data.load[width=width](base_idx), ) vectorize[reduce_v, nelts[dtype]()](cols) else: for k in range(cols): var base_idx = base_idx_1 + k * arg_stride[rank - 1] var target_idx = target_idx_1 + k * target_stride[ rank - 1 ] curr_data.store( target_idx, curr_data.load(target_idx) + arg_data.load(base_idx), ) else: # if the rank is one and we still want to reduce along the single axis if target_stride[0] == 0: var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, end, nelts[dtype]()): curr_data.store( 0, curr_data.load(0) + arg_data.load[width = nelts[dtype]()](i).reduce_add(), ) for i in range(end, arg.size()): curr_data.store(0, curr_data.load(0) + arg_data.load(i)) # other wise, if we we have rank one but not´reduction, we simply copy the values else: var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, end, nelts[dtype]()): curr_data.store[width = nelts[dtype]()]( i, arg_data.load[width = nelts[dtype]()](i).reduce_add(), ) for i in range(end, arg.size()): curr_data.store(i, arg_data.load(i)) _ = arg @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Computes the vector-Jacobian product for the addition function. Implements reverse-mode automatic differentiation for the addition function. Args: primals: A list containing the primal input arrays. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the addition is computed as the gradient itself. """ return List(expand(grad, primals[0].array_shape())) @staticmethod fn fwd(arg0: Array, axis: List[Int]) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_add(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ var arr_shape = setup_array_shape( List(arg0.array_shape(), list_to_array_shape(axis)), "reduce_add", ReduceAdd.compute_shape, ) return op_array( arr_shape, List(arg0), NA, "reduce_add", ReduceAdd.__call__, ReduceAdd.jvp, ReduceAdd.vjp, ) fn reduce_add(arg0: Array, axis: List[Int]) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_add(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return ReduceAdd.fwd(arg0, axis) --- endia/functional/reduce_ops/reduce_argmax_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze from utils.numerics import min_or_neg_inf ####-----------------------------------------------------------------------------------------------------------------#### #### Reduce Ops ####-----------------------------------------------------------------------------------------------------------------#### struct ReduceArgMax(DifferentiableReduceOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after reducing along a specific axis. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to reduce, and the axis to reduce along encoded in an ArrayShape. #### Constraints: - The axis must be a valid axis of the ArrayShape (args[0]). - The number of axis must not exceed the number of dimensions of the ArrayShape (args[0]). """ var arg = args[0] var axis = array_shape_to_list(args[1]) var shape = arg.shape_node[].shape var new_shape = List[Int]() for i in range(len(shape)): if not list_contains(axis, i): new_shape.append(shape[i]) else: new_shape.append(1) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for element-wise arg_maxition of two arrays. Computes the sum of the input arrays and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input arrays. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and the axis and sets up the data accordingly. """ setup_shape_and_data(curr) var arg = contiguous(args[0]) var arg_shape = arg.shape() var arg_stride = arg.stride() var target_shape = curr.shape() var rank = curr.ndim() var target_stride = compute_stride(target_shape) var arg_max_stride = target_stride var denom = 1 for i in range(rank): if target_shape[i] == 1 and arg_shape[i] != 1: target_stride[i] = 0 denom *= arg_stride[i] else: arg_max_stride[i] = 0 fill_(curr, -1) var tmp_max = full(target_shape, min_or_neg_inf[dtype]()) var target_storage_offset = curr.storage_offset() var tmp_max_data = tmp_max.data() var arg_data = arg.data() var curr_data = curr.data() if rank != 1: # check if both shapes are actually equal and we simply have to perdorm a fast copy var rows = arg_shape[rank - 2] var cols = arg_shape[rank - 1] for i in range(0, arg.size(), rows * cols): var nd_idx = compute_nd_index(i, arg_shape) var target_idx_0 = compute_storage_offset( nd_idx, target_stride, target_storage_offset ) var arg_max_idx_0 = compute_storage_offset( nd_idx, arg_max_stride, target_storage_offset ) for j in range(rows): var base_idx_1 = i + j * arg_stride[rank - 2] var target_idx_1 = target_idx_0 + j * target_stride[ rank - 2 ] var arg_max_idx_1 = arg_max_idx_0 + j * arg_max_stride[ rank - 2 ] for k in range(cols): var base_idx = base_idx_1 + k * arg_stride[rank - 1] var target_idx = target_idx_1 + k * target_stride[ rank - 1 ] var arg_max_idx = arg_max_idx_1 + k * arg_max_stride[ rank - 1 ] var new_curr = max( tmp_max_data.load(target_idx), arg_data.load(base_idx), ) if new_curr > tmp_max_data.load(target_idx): curr_data.store(target_idx, arg_max_idx // denom) tmp_max_data.store(target_idx, new_curr) else: # if the rank is one and we still want to reduce along the single axis if target_stride[0] == 0: # var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, arg.size()): var new_curr = max(tmp_max_data.load(0), arg_data.load(i)) if new_curr != tmp_max_data.load(0): curr_data.store(0, i) tmp_max_data.store(0, new_curr) # otherwise, if we we have rank one but not´reduction, we simply copy the values else: var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, end, nelts[dtype]()): tmp_max_data.store[width = nelts[dtype]()]( i, arg_data.load[width = nelts[dtype]()](i).reduce_max(), ) for i in range(end, arg.size()): tmp_max_data.store(i, arg_data.load(i)) _ = arg _ = tmp_max @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn fwd(arg0: Array, axis: List[Int]) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_argmax(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "Warning in reduce_argmax: The reduce_argmax operation does not support complex numbers." var arr_shape = setup_array_shape( List(arg0.array_shape(), list_to_array_shape(axis)), "reduce_arg_max", ReduceArgMax.compute_shape, ) return op_array( arr_shape, List(arg0), NA, "reduce_arg_max", ReduceArgMax.__call__, ReduceArgMax.jvp, ReduceArgMax.vjp, ) fn reduce_argmax( arg0: Array, axis: List[Int], keepdims: Bool = False ) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. keepdims: If True, retains the reduced dimensions with length 1. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_argmax(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if keepdims: return ReduceArgMax.fwd(arg0, axis) return squeeze(ReduceArgMax.fwd(arg0, axis)) --- endia/functional/reduce_ops/reduce_argmin_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze from utils.numerics import max_or_inf ####-----------------------------------------------------------------------------------------------------------------#### #### Reduce Ops ####-----------------------------------------------------------------------------------------------------------------#### struct ReduceArgMin(DifferentiableReduceOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after reducing along a specific axis. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to reduce, and the axis to reduce along encoded in an ArrayShape. #### Constraints: - The axis must be a valid axis of the ArrayShape (args[0]). - The number of axis must not exceed the number of dimensions of the ArrayShape (args[0]). """ var arg = args[0] var axis = array_shape_to_list(args[1]) var shape = arg.shape_node[].shape var new_shape = List[Int]() for i in range(len(shape)): if not list_contains(axis, i): new_shape.append(shape[i]) else: new_shape.append(1) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for element-wise arg_minition of two arrays. Computes the sum of the input arrays and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input arrays. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and the axis and sets up the data accordingly. """ setup_shape_and_data(curr) var arg = contiguous(args[0]) var arg_shape = arg.shape() var arg_stride = arg.stride() var target_shape = curr.shape() var rank = curr.ndim() var target_stride = compute_stride(target_shape) var arg_min_stride = target_stride var denom = 1 for i in range(rank): if target_shape[i] == 1 and arg_shape[i] != 1: target_stride[i] = 0 denom *= arg_stride[i] else: arg_min_stride[i] = 0 fill_(curr, -1) var tmp_min = full(target_shape, max_or_inf[dtype]()) var target_storage_offset = curr.storage_offset() var tmp_min_data = tmp_min.data() var arg_data = arg.data() var curr_data = curr.data() if rank != 1: # check if both shapes are actually equal and we simply have to perdorm a fast copy var rows = arg_shape[rank - 2] var cols = arg_shape[rank - 1] for i in range(0, arg.size(), rows * cols): var nd_idx = compute_nd_index(i, arg_shape) var target_idx_0 = compute_storage_offset( nd_idx, target_stride, target_storage_offset ) var arg_min_idx_0 = compute_storage_offset( nd_idx, arg_min_stride, target_storage_offset ) for j in range(rows): var base_idx_1 = i + j * arg_stride[rank - 2] var target_idx_1 = target_idx_0 + j * target_stride[ rank - 2 ] var arg_min_idx_1 = arg_min_idx_0 + j * arg_min_stride[ rank - 2 ] for k in range(cols): var base_idx = base_idx_1 + k * arg_stride[rank - 1] var target_idx = target_idx_1 + k * target_stride[ rank - 1 ] var arg_min_idx = arg_min_idx_1 + k * arg_min_stride[ rank - 1 ] var new_curr = min( tmp_min_data.load(target_idx), arg_data.load(base_idx), ) if new_curr < tmp_min_data.load(target_idx): curr_data.store(target_idx, arg_min_idx // denom) tmp_min_data.store(target_idx, new_curr) else: # if the rank is one and we still want to reduce along the single axis if target_stride[0] == 0: # var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, arg.size()): var new_curr = min(tmp_min_data.load(0), arg_data.load(i)) if new_curr != tmp_min_data.load(0): curr_data.store(0, i) tmp_min_data.store(0, new_curr) # otherwise, if we we have rank one but not´reduction, we simply copy the values else: var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, end, nelts[dtype]()): tmp_min_data.store[width = nelts[dtype]()]( i, arg_data.load[width = nelts[dtype]()](i).reduce_min(), ) for i in range(end, arg.size()): tmp_min_data.store(i, arg_data.load(i)) _ = arg _ = tmp_min @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn fwd(arg0: Array, axis: List[Int]) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_argmin(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "Warning in reduce_argmin: The reduce_argmin operation does not support complex numbers." var arr_shape = setup_array_shape( List(arg0.array_shape(), list_to_array_shape(axis)), "reduce_arg_min", ReduceArgMin.compute_shape, ) return op_array( arr_shape, List(arg0), NA, "reduce_arg_min", ReduceArgMin.__call__, ReduceArgMin.jvp, ReduceArgMin.vjp, ) fn reduce_argmin( arg0: Array, axis: List[Int], keepdims: Bool = False ) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. keepdims: If True, retains the reduced dimensions with length 1. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_argmin(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if keepdims: return ReduceArgMin.fwd(arg0, axis) return squeeze(ReduceArgMin.fwd(arg0, axis)) --- endia/functional/reduce_ops/reduce_max_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze from utils.numerics import min_or_neg_inf ####-----------------------------------------------------------------------------------------------------------------#### #### Reduce Ops ####-----------------------------------------------------------------------------------------------------------------#### struct ReduceMax(DifferentiableReduceOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after reducing along a specific axis. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to reduce, and the axis to reduce along encoded in an ArrayShape. #### Constraints: - The axis must be a valid axis of the ArrayShape (args[0]). - The number of axis must not exceed the number of dimensions of the ArrayShape (args[0]). """ var arg = args[0] var axis = array_shape_to_list(args[1]) var shape = arg.shape_node[].shape var new_shape = List[Int]() for i in range(len(shape)): if not list_contains(axis, i): new_shape.append(shape[i]) else: new_shape.append(1) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for element-wise maxition of two arrays. Computes the sum of the input arrays and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input arrays. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and the axis and sets up the data accordingly. """ setup_shape_and_data(curr) var arg = contiguous(args[0]) fill_(curr, min_or_neg_inf[dtype]()) var arg_shape = arg.shape() var arg_stride = arg.stride() var target_shape = curr.shape() var rank = curr.ndim() var target_stride = compute_stride(target_shape) for i in range(rank): if target_shape[i] == 1 and arg_shape[i] != 1: target_stride[i] = 0 var target_storage_offset = curr.storage_offset() var curr_data = curr.data() var arg_data = arg.data() if rank != 1: # check if both shapes are actually equal and we simply have to perdorm a fast copy var rows = arg_shape[rank - 2] var cols = arg_shape[rank - 1] for i in range(0, arg.size(), rows * cols): var nd_idx = compute_nd_index(i, arg_shape) var target_idx_0 = compute_storage_offset( nd_idx, target_stride, target_storage_offset ) for j in range(rows): var base_idx_1 = i + j * arg_stride[rank - 2] var target_idx_1 = target_idx_0 + j * target_stride[ rank - 2 ] if ( arg_stride[rank - 1] == 1 and target_stride[rank - 1] == 1 ): @parameter fn reduce_v[width: Int](k: Int): var base_idx = base_idx_1 + k * arg_stride[rank - 1] var target_idx = target_idx_1 + k * target_stride[ rank - 1 ] curr_data.store[width=width]( target_idx, max( curr_data.load[width=width](target_idx), arg_data.load[width=width](base_idx), ), ) vectorize[reduce_v, nelts[dtype]()](cols) else: for k in range(cols): var base_idx = base_idx_1 + k * arg_stride[rank - 1] var target_idx = target_idx_1 + k * target_stride[ rank - 1 ] curr_data.store( target_idx, max( curr_data.load(target_idx), arg_data.load(base_idx), ), ) else: # if the rank is one and we still want to reduce along the single axis if target_stride[0] == 0: var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, end, nelts[dtype]()): curr_data.store( 0, max( curr_data.load(0), arg_data.load[width = nelts[dtype]()]( i ).reduce_max(), ), ) for i in range(end, arg.size()): curr_data.store(0, max(curr_data.load(0), arg_data.load(i))) # other wise, if we we have rank one but not´reduction, we simply copy the values else: var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, end, nelts[dtype]()): curr_data.store[width = nelts[dtype]()]( i, arg_data.load[width = nelts[dtype]()](i).reduce_max(), ) for i in range(end, arg.size()): curr_data.store(i, arg_data.load(i)) _ = arg @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn fwd(arg0: Array, axis: List[Int]) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_max(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "Warning in reduce_max: The reduce_max operation does not support complex numbers." var arr_shape = setup_array_shape( List(arg0.array_shape(), list_to_array_shape(axis)), "reduce_max", ReduceMax.compute_shape, ) return op_array( arr_shape, List(arg0), NA, "reduce_max", ReduceMax.__call__, ReduceMax.jvp, ReduceMax.vjp, ) fn reduce_max( arg0: Array, axis: List[Int], keepdims: Bool = False ) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. keepdims: If True, retains the reduced dimensions with length 1. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_max(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if keepdims: return ReduceMax.fwd(arg0, axis) return squeeze(ReduceMax.fwd(arg0, axis)) --- endia/functional/reduce_ops/reduce_min_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze from utils.numerics import min_or_neg_inf ####-----------------------------------------------------------------------------------------------------------------#### #### Reduce Ops ####-----------------------------------------------------------------------------------------------------------------#### struct ReduceMin(DifferentiableReduceOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after reducing along a specific axis. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to reduce, and the axis to reduce along encoded in an ArrayShape. #### Constraints: - The axis must be a valid axis of the ArrayShape (args[0]). - The number of axis must not exceed the number of dimensions of the ArrayShape (args[0]). """ var arg = args[0] var axis = array_shape_to_list(args[1]) var shape = arg.shape_node[].shape var new_shape = List[Int]() for i in range(len(shape)): if not list_contains(axis, i): new_shape.append(shape[i]) else: new_shape.append(1) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for element-wise minition of two arrays. Computes the sum of the input arrays and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input arrays. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and the axis and sets up the data accordingly. """ setup_shape_and_data(curr) var arg = contiguous(args[0]) fill_(curr, min_or_neg_inf[dtype]()) var arg_shape = arg.shape() var arg_stride = arg.stride() var target_shape = curr.shape() var rank = curr.ndim() var target_stride = compute_stride(target_shape) for i in range(rank): if target_shape[i] == 1 and arg_shape[i] != 1: target_stride[i] = 0 var target_storage_offset = curr.storage_offset() var curr_data = curr.data() var arg_data = arg.data() if rank != 1: # check if both shapes are actually equal and we simply have to perdorm a fast copy var rows = arg_shape[rank - 2] var cols = arg_shape[rank - 1] for i in range(0, arg.size(), rows * cols): var nd_idx = compute_nd_index(i, arg_shape) var target_idx_0 = compute_storage_offset( nd_idx, target_stride, target_storage_offset ) for j in range(rows): var base_idx_1 = i + j * arg_stride[rank - 2] var target_idx_1 = target_idx_0 + j * target_stride[ rank - 2 ] if ( arg_stride[rank - 1] == 1 and target_stride[rank - 1] == 1 ): @parameter fn reduce_v[width: Int](k: Int): var base_idx = base_idx_1 + k * arg_stride[rank - 1] var target_idx = target_idx_1 + k * target_stride[ rank - 1 ] curr_data.store[width=width]( target_idx, min( curr_data.load[width=width](target_idx), arg_data.load[width=width](base_idx), ), ) vectorize[reduce_v, nelts[dtype]()](cols) else: for k in range(cols): var base_idx = base_idx_1 + k * arg_stride[rank - 1] var target_idx = target_idx_1 + k * target_stride[ rank - 1 ] curr_data.store( target_idx, min( curr_data.load(target_idx), arg_data.load(base_idx), ), ) else: # if the rank is one and we still want to reduce along the single axis if target_stride[0] == 0: var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, end, nelts[dtype]()): curr_data.store( 0, min( curr_data.load(0), arg_data.load[width = nelts[dtype]()]( i ).reduce_min(), ), ) for i in range(end, arg.size()): curr_data.store(0, min(curr_data.load(0), arg_data.load(i))) # other wise, if we we have rank one but not´reduction, we simply copy the values else: var end = arg.size() - arg.size() % nelts[dtype]() for i in range(0, end, nelts[dtype]()): curr_data.store[width = nelts[dtype]()]( i, arg_data.load[width = nelts[dtype]()](i).reduce_min(), ) for i in range(end, arg.size()): curr_data.store(i, arg_data.load(i)) _ = arg @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn fwd(arg0: Array, axis: List[Int]) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_min(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "Warning in reduce_min: The reduce_min operation does not support complex numbers." var arr_shape = setup_array_shape( List(arg0.array_shape(), list_to_array_shape(axis)), "reduce_min", ReduceMin.compute_shape, ) return op_array( arr_shape, List(arg0), NA, "reduce_min", ReduceMin.__call__, ReduceMin.jvp, ReduceMin.vjp, ) fn reduce_min( arg0: Array, axis: List[Int], keepdims: Bool = False ) raises -> Array: """ Reduces the input array along the specified axis by summing the elements. Args: arg0: The input array. axis: The axis along which to reduce the array. keepdims: If True, retains the reduced dimensions with length 1. Returns: An array containing the sum of the input array along the specified axis. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reduce_min(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if keepdims: return ReduceMin.fwd(arg0, axis) return squeeze(ReduceMin.fwd(arg0, axis)) --- endia/functional/reduce_ops/std_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze def std( arg0: Array, axes: List[Int] = List(0), unbiased: Bool = True, keepdims: Bool = False, ) -> Array: """ Computes the standard deviation of the input array along the specified axes. Args: arg0: The input array. axes: The axes along which to compute the standard deviation. unbiased: If True, the standard deviation is computed using the unbiased estimator. keepdims: If True, the reduced axes are kept in the result. Returns: An array containing the standard deviation of the input array along the specified axes. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = std(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return sqrt(variance(arg0, axes, unbiased, keepdims)) --- endia/functional/reduce_ops/sum_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze fn sum(arg0: Array) raises -> Array: """ Computes the sum of the input array along all axes. Args: arg0: The input array. Returns: An array containing the sum of the input array along all axes. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sum(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ var array_shape = arg0.array_shape() compute_shape(array_shape, arg0.requires_grad()) var axis = List[Int]() for i in range(arg0.ndim()): axis.append(i) return squeeze(reduce_add(arg0, axis)) --- endia/functional/reduce_ops/variance_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_list, compute_stride, setup_array_shape, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableReduceOp from endia.functional import expand from endia.functional import squeeze def variance( arg0: Array, axes: List[Int] = List(0), unbiased: Bool = True, keepdims: Bool = False, ) -> Array: """ Computes the variance of the input array along the specified axes. Args: arg0: The input array. axes: The axes along which to compute the variance. unbiased: If True, the variance is computed using the unbiased estimator. keepdims: If True, the reduced axes are kept in the result. Returns: An array containing the variance of the input array along the specified axes. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = variance(a, List(0)) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ var num_elements_arg0 = arg0.size() var res = reduce_add(arg0, axes) var num_elements_res = res.size() var divisor = (num_elements_arg0 / num_elements_res) - 1 if unbiased else ( num_elements_arg0 / num_elements_res ) var mean_res = res / (num_elements_arg0 / num_elements_res) var diff = arg0 - mean_res var diff_squared = diff * diff var variance = reduce_add(diff_squared, axes) / divisor if keepdims: return variance return squeeze(variance) --- endia/functional/spacial_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .conv1d_op import conv1d from .conv2d_op import conv2d from .conv3d_op import conv3d from .max_pool1d_op import max_pool1d from .max_pool2d_op import max_pool2d from .max_pool3d_op import max_pool3d from .avg_pool1d_op import avg_pool1d from .avg_pool2d_op import avg_pool2d from .avg_pool3d_op import avg_pool3d --- endia/functional/spacial_ops/_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # --- endia/functional/spacial_ops/avg_pool1d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array struct AvgPool1d: """ Namespace for 1D average pooling operations. """ @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 1-dimensional average pooling operation with dilation. """ var arg = args[0] # Input tensor var params = array_shape_to_list(args[1]) # Pooling parameters var input_shape = arg.shape_node[].shape var ndim = len(input_shape) if ndim != 3: raise "Input must be 3-dimensional (batch_size, channels, length) for 1D pooling!" var batch_size = input_shape[0] var channels = input_shape[1] var kernel_size = params[0] var stride = params[1] var padding = params[2] var dilation = params[3] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(channels) new_shape.append( (input_shape[2] + 2 * padding - dilation * (kernel_size - 1) - 1) // stride + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: var params = array_shape_to_list(curr.array_shape().args()[1]) setup_shape_and_data(curr) var kernel_size = params[0] var stride = params[1] var padding = params[2] var dilation = params[3] var input = contiguous(args[0]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var out_stride = out.stride() var input_stride = input.stride() var input_shape = input.shape() for batch in range(out_shape[0]): for channel in range(out_shape[1]): for out_index in range(out_shape[2]): var start = out_index * stride - padding var sum_val = SIMD[dtype, 1](0) var count = 0 for k in range(kernel_size): var i = start + k * dilation if i >= 0 and i < input_shape[2]: var idx = batch * input_stride[ 0 ] + channel * input_stride[1] + i * input_stride[2] sum_val += input_data.load(idx) count += 1 var out_idx = batch * out_stride[0] + channel * out_stride[ 1 ] + out_index * out_stride[2] out_data.store( out_idx, sum_val / count if count > 0 else SIMD[dtype, 1](0), ) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel_size: Int, stride: Int = 1, padding: Int = 0, dilation: Int = 1, ) raises -> Array: if arg0.is_complex(): raise "Complex numbers are not supported for avg_pool1d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), list_to_array_shape( List( kernel_size, stride, padding, dilation, ) ), ), "avg_pool1d_shape", AvgPool1d.compute_shape, ) var args = List(arg0) # return op_array(arr_shape, args, NA, "avg_pool1d", fwd, default_jvp, vjp, False) return op_array( arr_shape, args, NA, "avg_pool1d", AvgPool1d.__call__, AvgPool1d.jvp, AvgPool1d.vjp, False, ) fn avg_pool1d( arg0: Array, kernel_size: Int, stride: Int = 1, padding: Int = 0, dilation: Int = 1, ) raises -> Array: """ Applies a 1D average pooling operation over an input array. Args: arg0: The input array. kernel_size: The size of the kernel. stride: The stride of the pooling operation. Defaults to 1. padding: The padding to apply to the input. Defaults to 0. dilation: The dilation to apply to the input. Defaults to 1. Returns: Array: The output array. """ return AvgPool1d.fwd(arg0, kernel_size, stride, padding, dilation) --- endia/functional/spacial_ops/avg_pool2d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array struct AvgPool2d: """ Namespace for 2D average pooling operations. """ @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 2-dimensional average pooling operation with dilation. """ var arg = args[0] # Input tensor var params = array_shape_to_list(args[1]) # Pooling parameters var input_shape = arg.shape_node[].shape var ndim = len(input_shape) if ndim != 4: raise "Input must be 4-dimensional (batch_size, channels, height, width) for 2D pooling!" var batch_size = input_shape[0] var channels = input_shape[1] var kernel_height = params[0] var kernel_width = params[1] var stride_height = params[2] var stride_width = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_height = params[6] var dilation_width = params[7] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(channels) new_shape.append( ( input_shape[2] + 2 * padding_height - dilation_height * (kernel_height - 1) - 1 ) // stride_height + 1 ) new_shape.append( ( input_shape[3] + 2 * padding_width - dilation_width * (kernel_width - 1) - 1 ) // stride_width + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: var params = array_shape_to_list(curr.array_shape().args()[1]) setup_shape_and_data(curr) var kernel_height = params[0] var kernel_width = params[1] var stride_height = params[2] var stride_width = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_height = params[6] var dilation_width = params[7] var input = contiguous(args[0]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var out_stride = out.stride() var input_stride = input.stride() var input_shape = input.shape() for batch in range(out_shape[0]): for channel in range(out_shape[1]): for out_y in range(out_shape[2]): for out_x in range(out_shape[3]): var start_y = out_y * stride_height - padding_height var start_x = out_x * stride_width - padding_width var sum_val = SIMD[dtype, 1](0) var count = 0 for ky in range(kernel_height): var y = start_y + ky * dilation_height if y >= 0 and y < input_shape[2]: for kx in range(kernel_width): var x = start_x + kx * dilation_width if x >= 0 and x < input_shape[3]: var idx = batch * input_stride[ 0 ] + channel * input_stride[ 1 ] + y * input_stride[ 2 ] + x * input_stride[ 3 ] sum_val += input_data.load(idx) count += 1 var out_idx = batch * out_stride[ 0 ] + channel * out_stride[1] + out_y * out_stride[ 2 ] + out_x * out_stride[ 3 ] out_data.store( out_idx, sum_val / count if count > 0 else SIMD[dtype, 1](0), ) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel_size: Tuple[Int, Int], stride: Tuple[Int, Int] = (1, 1), padding: Tuple[Int, Int] = (0, 0), dilation: Tuple[Int, Int] = (1, 1), ) raises -> Array: if arg0.is_complex(): raise "Complex numbers are not supported for avg_pool2d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), list_to_array_shape( concat_lists( kernel_size[0], kernel_size[1], stride[0], stride[1], padding[0], padding[1], dilation[0], dilation[1], ) ), ), "avg_pool2d_shape", AvgPool2d.compute_shape, ) var args = List(arg0) return op_array( arr_shape, args, NA, "avg_pool2d", AvgPool2d.__call__, AvgPool2d.jvp, AvgPool2d.vjp, False, ) fn avg_pool2d( arg0: Array, kernel_size: Tuple[Int, Int], stride: Tuple[Int, Int] = (1, 1), padding: Tuple[Int, Int] = (0, 0), dilation: Tuple[Int, Int] = (1, 1), ) raises -> Array: """ Applies a 2D average pooling operation over an input array. Args: arg0: The input array. kernel_size: The size of the kernel (height, width). stride: The stride of the pooling operation. Defaults to (1, 1). padding: The padding to apply to the input. Defaults to (0, 0). dilation: The dilation to apply to the input. Defaults to (1, 1). Returns: Array: The output array. """ return AvgPool2d.fwd(arg0, kernel_size, stride, padding, dilation) --- endia/functional/spacial_ops/avg_pool3d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array struct AvgPool3d: """ Namespace for 3D average pooling operations. """ @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 3-dimensional average pooling operation with dilation. """ var arg = args[0] # Input tensor var params = array_shape_to_list(args[1]) # Pooling parameters var input_shape = arg.shape_node[].shape var ndim = len(input_shape) if ndim != 5: raise "Input must be 5-dimensional (batch_size, channels, depth, height, width) for 3D pooling!" var batch_size = input_shape[0] var channels = input_shape[1] var kernel_depth = params[0] var kernel_height = params[1] var kernel_width = params[2] var stride_depth = params[3] var stride_height = params[4] var stride_width = params[5] var padding_depth = params[6] var padding_height = params[7] var padding_width = params[8] var dilation_depth = params[9] var dilation_height = params[10] var dilation_width = params[11] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(channels) new_shape.append( ( input_shape[2] + 2 * padding_depth - dilation_depth * (kernel_depth - 1) - 1 ) // stride_depth + 1 ) new_shape.append( ( input_shape[3] + 2 * padding_height - dilation_height * (kernel_height - 1) - 1 ) // stride_height + 1 ) new_shape.append( ( input_shape[4] + 2 * padding_width - dilation_width * (kernel_width - 1) - 1 ) // stride_width + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: var params = array_shape_to_list(curr.array_shape().args()[1]) setup_shape_and_data(curr) var kernel_depth = params[0] var kernel_height = params[1] var kernel_width = params[2] var stride_depth = params[3] var stride_height = params[4] var stride_width = params[5] var padding_depth = params[6] var padding_height = params[7] var padding_width = params[8] var dilation_depth = params[9] var dilation_height = params[10] var dilation_width = params[11] var input = contiguous(args[0]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var out_stride = out.stride() var input_stride = input.stride() var input_shape = input.shape() for batch in range(out_shape[0]): for channel in range(out_shape[1]): for out_z in range(out_shape[2]): for out_y in range(out_shape[3]): for out_x in range(out_shape[4]): var start_z = out_z * stride_depth - padding_depth var start_y = out_y * stride_height - padding_height var start_x = out_x * stride_width - padding_width var sum_val = SIMD[dtype, 1](0) var count = 0 for kz in range(kernel_depth): var z = start_z + kz * dilation_depth if z >= 0 and z < input_shape[2]: for ky in range(kernel_height): var y = start_y + ky * dilation_height if y >= 0 and y < input_shape[3]: for kx in range(kernel_width): var x = start_x + kx * dilation_width if ( x >= 0 and x < input_shape[4] ): var idx = batch * input_stride[ 0 ] + channel * input_stride[ 1 ] + z * input_stride[ 2 ] + y * input_stride[ 3 ] + x * input_stride[ 4 ] sum_val += input_data.load( idx ) count += 1 var out_idx = batch * out_stride[ 0 ] + channel * out_stride[1] + out_z * out_stride[ 2 ] + out_y * out_stride[ 3 ] + out_x * out_stride[ 4 ] out_data.store( out_idx, sum_val / count if count > 0 else SIMD[dtype, 1](0), ) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel_size: Tuple[Int, Int, Int], stride: Tuple[Int, Int, Int] = (1, 1, 1), padding: Tuple[Int, Int, Int] = (0, 0, 0), dilation: Tuple[Int, Int, Int] = (1, 1, 1), ) raises -> Array: if arg0.is_complex(): raise "Complex numbers are not supported for avg_pool3d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), list_to_array_shape( concat_lists( kernel_size[0], kernel_size[1], kernel_size[2], stride[0], stride[1], stride[2], padding[0], padding[1], padding[2], dilation[0], dilation[1], dilation[2], ) ), ), "avg_pool3d_shape", AvgPool3d.compute_shape, ) var args = List(arg0) return op_array( arr_shape, args, NA, "avg_pool3d", AvgPool3d.__call__, AvgPool3d.jvp, AvgPool3d.vjp, False, ) fn avg_pool3d( arg0: Array, kernel_size: Tuple[Int, Int, Int], stride: Tuple[Int, Int, Int] = (1, 1, 1), padding: Tuple[Int, Int, Int] = (0, 0, 0), dilation: Tuple[Int, Int, Int] = (1, 1, 1), ) raises -> Array: """ Applies a 3D average pooling operation over an input array. Args: arg0: The input array. kernel_size: The size of the kernel (depth, height, width). stride: The stride of the pooling operation. Defaults to (1, 1, 1). padding: The padding to apply to the input. Defaults to (0, 0, 0). dilation: The dilation to apply to the input. Defaults to (1, 1, 1). Returns: Array: The output array. """ return AvgPool3d.fwd(arg0, kernel_size, stride, padding, dilation) --- endia/functional/spacial_ops/conv1d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array struct Conv1d: """ Namespace for 1D convolution operations. """ @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 1-dimensional convolution operation. """ var input_shape = args[0].shape_node[].shape var kernel_shape = args[1].shape_node[].shape var params = array_shape_to_list(args[2]) # Convolution parameters if len(input_shape) != 3: raise "Input must be 3-dimensional (batch_size, in_channels, length) for 1D convolution!" var batch_size = input_shape[0] var in_channels = input_shape[1] if in_channels != kernel_shape[1]: raise "Input channels must match kernel channels for 1D convolution!" var num_elements = input_shape[2] var out_channels = kernel_shape[0] var kernel_size = kernel_shape[2] var stride = params[0] var padding = params[1] var dilation = params[2] var groups = params[3] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(out_channels) new_shape.append( (num_elements + 2 * padding - dilation * (kernel_size - 1) - 1) // stride + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: var params = array_shape_to_list(curr.array_shape().args()[2]) setup_shape_and_data(curr) var arg_shape = args[0].shape() var kernel_shape = args[1].shape() var in_channels = arg_shape[1] var out_channels = kernel_shape[0] var kernel_size = kernel_shape[2] var batch_size = arg_shape[0] var num_elements = arg_shape[2] var stride = params[0] var padding = params[1] var dilation = params[2] var groups = params[3] var in_channels_per_group = in_channels // groups var out_channels_per_group = out_channels // groups var input = contiguous(args[0]) var kernel = contiguous(args[1]) var bias = contiguous(args[2]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var kernel_data = kernel.data() var bias_data = bias.data() var out_stride = out.stride() var input_stride = input.stride() var kernel_stride = kernel.stride() var input_shape = input.shape() for batch in range(out_shape[0]): var base_input_idx_batch = batch * input_stride[0] for out_channel in range(out_channels): var base_kernel_idx_out_channel = out_channel * kernel_stride[0] for out_index in range(out_shape[2]): var value = bias_data.load(out_channel) var output_index = out_index * stride - padding for group in range(groups): var group_input_offset = group * in_channels_per_group var group_kernel_offset = group * in_channels_per_group for in_channel in range(in_channels_per_group): var base_input_idx_channel = base_input_idx_batch + ( group_input_offset + in_channel ) * input_stride[ 1 ] var base_kernel_idx_channel = base_kernel_idx_out_channel + ( group_kernel_offset + in_channel ) * kernel_stride[ 1 ] for k in range(kernel_size): var input_index = output_index + k * dilation if ( input_index >= 0 and input_index < input_shape[2] ): var final_input_idx = base_input_idx_channel + input_index * input_stride[ 2 ] var final_kernel_idx = base_kernel_idx_channel + k * kernel_stride[ 2 ] value += input_data.load( final_input_idx ) * kernel_data.load(final_kernel_idx) var out_idx = batch * out_stride[ 0 ] + out_channel * out_stride[1] + out_index * out_stride[2] out_data.store(out_idx, value) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel: Array, bias: Array, stride: Int, padding: Int, dilation: Int, groups: Int, ) raises -> Array: if arg0.is_complex() or kernel.is_complex() or bias.is_complex(): raise "Complex numbers are not supported for conv1d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), kernel.array_shape(), list_to_array_shape( List( stride, padding, dilation, groups, ) ), ), "conv1d_shape", Conv1d.compute_shape, ) var args = List(arg0, kernel, bias) return op_array( arr_shape, args, NA, "conv1d", Conv1d.__call__, Conv1d.jvp, Conv1d.vjp, False, ) fn conv1d( arg0: Array, kernel: Array, bias: Array, stride: Int, padding: Int, dilation: Int, groups: Int, ) raises -> Array: """ Applies a 1D convolution over an input signal composed of several input planes. Args: arg0: Input tensor of shape (batch_size, in_channels, length). kernel: Convolution kernel of shape (out_channels, in_channels // groups, kernel_size). bias: Bias tensor of shape (out_channels). stride: Stride of the convolution. padding: Zero-padding added to both sides of the input. dilation: Spacing between kernel elements. groups: Number of blocked connections from input channels to output channels. Returns: Output tensor of shape (batch_size, out_channels, output_length). """ return Conv1d.fwd( arg0, kernel, bias, stride, padding, dilation, groups, ) --- endia/functional/spacial_ops/conv2d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array struct Conv2d: """ Namespace for 2D convolution operations. """ @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 2-dimensional convolution operation. """ var input_shape = args[0].shape_node[].shape var kernel_shape = args[1].shape_node[].shape var params = array_shape_to_list(args[2]) # Convolution parameters var ndim = len(input_shape) if ndim != 4: raise "Input must be 4-dimensional (batch_size, in_channels, height, width) for 2D convolution!" var batch_size = input_shape[0] var in_channels = input_shape[1] if in_channels != kernel_shape[1]: raise "Input channels must match kernel channels for 2D convolution!" var out_channels = kernel_shape[0] var kernel_height = kernel_shape[2] var kernel_width = kernel_shape[3] var stride_height = params[0] var stride_width = params[1] var padding_height = params[2] var padding_width = params[3] var dilation_height = params[4] var dilation_width = params[5] var groups = params[6] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(out_channels) new_shape.append( ( input_shape[2] + 2 * padding_height - dilation_height * (kernel_height - 1) - 1 ) // stride_height + 1 ) new_shape.append( ( input_shape[3] + 2 * padding_width - dilation_width * (kernel_width - 1) - 1 ) // stride_width + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: var params = array_shape_to_list(curr.array_shape().args()[2]) setup_shape_and_data(curr) var arg_shape = args[0].shape() var kernel_shape = args[1].shape() var batch_size = arg_shape[0] var in_channels = arg_shape[1] var out_channels = kernel_shape[0] var kernel_height = kernel_shape[2] var kernel_width = kernel_shape[3] var stride_height = params[0] var stride_width = params[1] var padding_height = params[2] var padding_width = params[3] var dilation_height = params[4] var dilation_width = params[5] var groups = params[6] var in_channels_per_group = in_channels // groups var out_channels_per_group = out_channels // groups var input = contiguous(args[0]) var kernel = contiguous(args[1]) var bias = contiguous(args[2]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var kernel_data = kernel.data() var bias_data = bias.data() var out_stride = out.stride() var input_stride = input.stride() var kernel_stride = kernel.stride() var input_shape = input.shape() for batch in range(batch_size): var base_input_idx_batch = batch * input_stride[0] for out_channel in range(out_channels): var base_kernel_idx_out_channel = out_channel * kernel_stride[0] for out_y in range(out_shape[2]): var output_y_index = out_y * stride_height - padding_height for out_x in range(out_shape[3]): var value = SIMD[dtype, 1](0) var output_x_index = out_x * stride_width - padding_width for group in range(groups): var group_input_offset = group * in_channels_per_group var group_kernel_offset = group * in_channels_per_group for in_channel in range(in_channels_per_group): var base_input_idx_channel = base_input_idx_batch + ( group_input_offset + in_channel ) * input_stride[ 1 ] var base_kernel_idx_channel = base_kernel_idx_out_channel + ( group_kernel_offset + in_channel ) * kernel_stride[ 1 ] for ky in range(kernel_height): var input_y_index = output_y_index + ky * dilation_height if ( input_y_index >= 0 and input_y_index < input_shape[2] ): for kx in range(kernel_width): var input_x_index = output_x_index + kx * dilation_width if ( input_x_index >= 0 and input_x_index < input_shape[3] ): var final_input_idx = base_input_idx_channel + input_y_index * input_stride[ 2 ] + input_x_index * input_stride[ 3 ] var final_kernel_idx = base_kernel_idx_channel + ky * kernel_stride[ 2 ] + kx * kernel_stride[ 3 ] value += input_data.load( final_input_idx ) * kernel_data.load( final_kernel_idx ) var out_idx = batch * out_stride[ 0 ] + out_channel * out_stride[1] + out_y * out_stride[ 2 ] + out_x * out_stride[ 3 ] out_data.store( out_idx, value + bias_data.load(out_channel) ) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel: Array, bias: Array, stride: Tuple[Int, Int] = (1, 1), padding: Tuple[Int, Int] = (0, 0), dilation: Tuple[Int, Int] = (1, 1), groups: Int = 1, ) raises -> Array: if arg0.is_complex() or kernel.is_complex() or bias.is_complex(): raise "Complex numbers are not supported for conv2d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), kernel.array_shape(), list_to_array_shape( concat_lists( stride[0], stride[1], padding[0], padding[1], dilation[0], dilation[1], groups, ) ), ), "conv2d_shape", Conv2d.compute_shape, ) var args = List(arg0, kernel, bias) return op_array( arr_shape, args, NA, "conv2d", Conv2d.__call__, Conv2d.jvp, Conv2d.vjp, False, ) fn conv2d( arg0: Array, kernel: Array, bias: Array, stride: Tuple[Int, Int] = (1, 1), padding: Tuple[Int, Int] = (0, 0), dilation: Tuple[Int, Int] = (1, 1), groups: Int = 1, ) raises -> Array: """ Applies a 2D convolution over an input image composed of several input planes. Args: arg0: Input tensor of shape (batch_size, in_channels, height, width). kernel: Convolution kernel of shape (out_channels, in_channels // groups, kernel_height, kernel_width). bias: Bias tensor of shape (out_channels). stride: Stride of the convolution. padding: Zero-padding added to both sides of the input. dilation: Spacing between kernel elements. groups: Number of blocked connections from input channels to output channels. Returns: Output tensor of shape (batch_size, out_channels, output_height, output_width). """ return Conv2d.fwd( arg0, kernel, bias, stride, padding, dilation, groups, ) --- endia/functional/spacial_ops/conv3d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array struct Conv3d: """ Namespace for 3D convolution operations. """ @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 3-dimensional convolution operation. Args: curr: The ArrayShape to store the result of the computation. args: The input ArrayShape, and the convolution parameters encoded in an ArrayShape. """ var input_shape = args[0].shape_node[].shape var kernel_shape = args[1].shape_node[].shape var params = array_shape_to_list(args[2]) # Convolution parameters var ndim = len(input_shape) if ndim != 5: raise "Input must be 5-dimensional (batch_size, in_channels, depth, height, width) for 3D convolution!" var batch_size = input_shape[0] var in_channels = input_shape[1] if in_channels != kernel_shape[1]: raise "Input channels must match kernel channels for 3D convolution!" var out_channels = kernel_shape[0] var kernel_depth = kernel_shape[2] var kernel_height = kernel_shape[3] var kernel_width = kernel_shape[4] var stride_depth = params[0] var stride_height = params[1] var stride_width = params[2] var padding_depth = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_depth = params[6] var dilation_height = params[7] var dilation_width = params[8] var groups = params[9] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(out_channels) new_shape.append( ( input_shape[2] + 2 * padding_depth - dilation_depth * (kernel_depth - 1) - 1 ) // stride_depth + 1 ) new_shape.append( ( input_shape[3] + 2 * padding_height - dilation_height * (kernel_height - 1) - 1 ) // stride_height + 1 ) new_shape.append( ( input_shape[4] + 2 * padding_width - dilation_width * (kernel_width - 1) - 1 ) // stride_width + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: # Extract shape parameters var params = array_shape_to_list(curr.array_shape().args()[2]) # Setup shape and data setup_shape_and_data(curr) var arg_shape = args[0].shape() var kernel_shape = args[1].shape() var in_channels = arg_shape[1] var out_channels = kernel_shape[0] var kernel_depth = kernel_shape[2] var kernel_height = kernel_shape[3] var kernel_width = kernel_shape[4] var stride_depth = params[0] var stride_height = params[1] var stride_width = params[2] var padding_depth = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_depth = params[6] var dilation_height = params[7] var dilation_width = params[8] var groups = params[9] var in_channels_per_group = in_channels // groups var out_channels_per_group = out_channels // groups # Make input, kernel, and bias contiguous var input = contiguous(args[0]) var kernel = contiguous(args[1]) var bias = contiguous(args[2]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var kernel_data = kernel.data() var bias_data = bias.data() var out_stride = out.stride() var input_stride = input.stride() var kernel_stride = kernel.stride() var input_shape = input.shape() for batch in range(out_shape[0]): var base_input_idx_batch = batch * input_stride[0] for out_channel in range(out_channels): var base_kernel_idx_out_channel = out_channel * kernel_stride[0] for out_z in range(out_shape[2]): var output_z_index = out_z * stride_depth - padding_depth for out_y in range(out_shape[3]): var output_y_index = out_y * stride_height - padding_height for out_x in range(out_shape[4]): var value = SIMD[dtype, 1](0) var output_x_index = out_x * stride_width - padding_width for group in range(groups): var group_input_offset = group * in_channels_per_group var group_kernel_offset = group * in_channels_per_group for in_channel in range(in_channels_per_group): var base_input_idx_channel = base_input_idx_batch + ( group_input_offset + in_channel ) * input_stride[ 1 ] var base_kernel_idx_channel = base_kernel_idx_out_channel + ( group_kernel_offset + in_channel ) * kernel_stride[ 1 ] for kz in range(kernel_depth): var input_z_index = output_z_index + kz * dilation_depth if ( input_z_index >= 0 and input_z_index < input_shape[2] ): for ky in range(kernel_height): var input_y_index = output_y_index + ky * dilation_height if ( input_y_index >= 0 and input_y_index < input_shape[3] ): for kx in range( kernel_width ): var input_x_index = output_x_index + kx * dilation_width if ( input_x_index >= 0 and input_x_index < input_shape[4] ): var final_input_idx = base_input_idx_channel + input_z_index * input_stride[ 2 ] + input_y_index * input_stride[ 3 ] + input_x_index * input_stride[ 4 ] var final_kernel_idx = base_kernel_idx_channel + kz * kernel_stride[ 2 ] + ky * kernel_stride[ 3 ] + kx * kernel_stride[ 4 ] value += input_data.load( final_input_idx ) * kernel_data.load( final_kernel_idx ) var out_idx = batch * out_stride[ 0 ] + out_channel * out_stride[ 1 ] + out_z * out_stride[ 2 ] + out_y * out_stride[ 3 ] + out_x * out_stride[ 4 ] out_data.store( out_idx, value + bias_data.load(out_channel) ) _ = curr _ = kernel _ = bias _ = in_channels _ = out_channels _ = kernel_depth _ = kernel_height _ = kernel_width _ = stride_depth _ = stride_height _ = stride_width _ = padding_depth _ = padding_height _ = padding_width _ = dilation_depth _ = dilation_height _ = dilation_width _ = groups @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel: Array, bias: Array, stride: Tuple[Int, Int, Int] = (1, 1, 1), padding: Tuple[Int, Int, Int] = (0, 0, 0), dilation: Tuple[Int, Int, Int] = (1, 1, 1), groups: Int = 1, ) raises -> Array: if arg0.is_complex() or kernel.is_complex() or bias.is_complex(): raise "Complex numbers are not supported for conv3d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), kernel.array_shape(), list_to_array_shape( concat_lists( stride[0], stride[1], stride[2], padding[0], padding[1], padding[2], dilation[0], dilation[1], dilation[2], groups, ) ), ), "conv3d_shape", # conv3d_shape, Conv3d.compute_shape, ) var args = List(arg0, kernel, bias) # return op_array(arr_shape, args, NA, "conv3d", fwd, default_jvp, vjp, False) return op_array( arr_shape, args, NA, "conv3d", Conv3d.__call__, Conv3d.jvp, Conv3d.vjp, False, ) fn conv3d( arg0: Array, kernel: Array, bias: Array, stride: Tuple[Int, Int, Int] = (1, 1, 1), padding: Tuple[Int, Int, Int] = (0, 0, 0), dilation: Tuple[Int, Int, Int] = (1, 1, 1), groups: Int = 1, ) raises -> Array: """ Applies a 3D convolution operation over an input array. Args: arg0: The input array. kernel: The convolution kernel. bias: The bias tensor. stride: The stride of the convolution operation. Defaults to (1, 1, 1). padding: The padding to apply to the input. Defaults to (0, 0, 0). dilation: The dilation to apply to the input. Defaults to (1, 1, 1). groups: The number of groups to split the input and output channels into. Defaults to 1. Returns: Array: The output array. """ return Conv3d.fwd( arg0, kernel, bias, stride, padding, dilation, groups, ) --- endia/functional/spacial_ops/max_pool1d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array from utils.numerics import min_or_neg_inf, max_or_inf struct MaxPool1d: @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 1-dimensional max pooling operation with dilation. Args: curr: The ArrayShape to store the result of the computation. args: The input ArrayShape, and the pooling parameters encoded in an ArrayShape. """ var arg = args[0] # Input tensor var params = array_shape_to_list(args[1]) # Pooling parameters var input_shape = arg.shape_node[].shape var ndim = len(input_shape) if ndim != 3: raise "Input must be 3-dimensional (batch_size, channels, length) for 1D pooling!" var batch_size = input_shape[0] var channels = input_shape[1] var kernel_size = params[0] var stride = params[1] var padding = params[2] var dilation = params[3] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(channels) new_shape.append( (input_shape[2] + 2 * padding - dilation * (kernel_size - 1) - 1) // stride + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: var params = array_shape_to_list(curr.array_shape().args()[1]) setup_shape_and_data(curr) var kernel_size = params[0] var stride = params[1] var padding = params[2] var dilation = params[3] var input = contiguous(args[0]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var out_stride = out.stride() var input_stride = input.stride() var input_shape = input.shape() for batch in range(out_shape[0]): for channel in range(out_shape[1]): for out_index in range(out_shape[2]): var start = out_index * stride - padding var max_val = SIMD[dtype, 1](min_or_neg_inf[dtype]()) for k in range(kernel_size): var i = start + k * dilation if i >= 0 and i < input_shape[2]: var idx = batch * input_stride[ 0 ] + channel * input_stride[1] + i * input_stride[2] var val = input_data.load(idx) max_val = max(max_val, val) var out_idx = batch * out_stride[0] + channel * out_stride[ 1 ] + out_index * out_stride[2] out_data.store(out_idx, max_val) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel_size: Int, stride: Int = 1, padding: Int = 0, dilation: Int = 1, ) raises -> Array: if arg0.is_complex(): raise "Complex numbers are not supported for max_pool1d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), list_to_array_shape( List( kernel_size, stride, padding, dilation, ) ), ), "max_pool1d_shape", MaxPool1d.compute_shape, ) var args = List(arg0) return op_array( arr_shape, args, NA, "max_pool1d", MaxPool1d.__call__, MaxPool1d.jvp, MaxPool1d.vjp, False, ) fn max_pool1d( arg0: Array, kernel_size: Int, stride: Int = 1, padding: Int = 0, dilation: Int = 1, ) raises -> Array: """ Computes the 1-dimensional max pooling operation with dilation. Args: arg0: The input tensor. kernel_size: The size of the pooling kernel. stride: The stride of the pooling operation. padding: The padding to apply to the input tensor. dilation: The dilation to apply to the input tensor. Returns: The result of the 1-dimensional max pooling operation. """ return MaxPool1d.fwd(arg0, kernel_size, stride, padding, dilation) --- endia/functional/spacial_ops/max_pool2d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array from utils.numerics import min_or_neg_inf, max_or_inf struct MaxPool2d: """ Namespace for 2D max pooling operations. """ @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 2-dimensional max pooling operation with dilation. Args: curr: The ArrayShape to store the result of the computation. args: The input ArrayShape, and the pooling parameters encoded in an ArrayShape. """ var arg = args[0] # Input tensor var params = array_shape_to_list(args[1]) # Pooling parameters var input_shape = arg.shape_node[].shape var ndim = len(input_shape) if ndim != 4: raise "Input must be 4-dimensional (batch_size, channels, height, width) for 2D pooling!" var batch_size = input_shape[0] var channels = input_shape[1] var kernel_height = params[0] var kernel_width = params[1] var stride_height = params[2] var stride_width = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_height = params[6] var dilation_width = params[7] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(channels) new_shape.append( ( input_shape[2] + 2 * padding_height - dilation_height * (kernel_height - 1) - 1 ) // stride_height + 1 ) new_shape.append( ( input_shape[3] + 2 * padding_width - dilation_width * (kernel_width - 1) - 1 ) // stride_width + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: var params = array_shape_to_list(curr.array_shape().args()[1]) setup_shape_and_data(curr) var kernel_height = params[0] var kernel_width = params[1] var stride_height = params[2] var stride_width = params[3] var padding_height = params[4] var padding_width = params[5] var dilation_height = params[6] var dilation_width = params[7] var input = contiguous(args[0]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var out_stride = out.stride() var input_stride = input.stride() var input_shape = input.shape() for batch in range(out_shape[0]): for channel in range(out_shape[1]): for out_y in range(out_shape[2]): for out_x in range(out_shape[3]): var start_y = out_y * stride_height - padding_height var start_x = out_x * stride_width - padding_width var max_val = SIMD[dtype, 1](min_or_neg_inf[dtype]()) for ky in range(kernel_height): var y = start_y + ky * dilation_height if y >= 0 and y < input_shape[2]: for kx in range(kernel_width): var x = start_x + kx * dilation_width if x >= 0 and x < input_shape[3]: var idx = batch * input_stride[ 0 ] + channel * input_stride[ 1 ] + y * input_stride[ 2 ] + x * input_stride[ 3 ] var val = input_data.load(idx) max_val = max(max_val, val) var out_idx = batch * out_stride[ 0 ] + channel * out_stride[1] + out_y * out_stride[ 2 ] + out_x * out_stride[ 3 ] out_data.store(out_idx, max_val) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel_size: Tuple[Int, Int], stride: Tuple[Int, Int] = (1, 1), padding: Tuple[Int, Int] = (0, 0), dilation: Tuple[Int, Int] = (1, 1), ) raises -> Array: if arg0.is_complex(): raise "Complex numbers are not supported for max_pool2d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), list_to_array_shape( concat_lists( kernel_size[0], kernel_size[1], stride[0], stride[1], padding[0], padding[1], dilation[0], dilation[1], ) ), ), "max_pool2d_shape", MaxPool2d.compute_shape, ) var args = List(arg0) return op_array( arr_shape, args, NA, "max_pool2d", MaxPool2d.__call__, MaxPool2d.jvp, MaxPool2d.vjp, False, ) fn max_pool2d( arg0: Array, kernel_size: Tuple[Int, Int], stride: Tuple[Int, Int] = (1, 1), padding: Tuple[Int, Int] = (0, 0), dilation: Tuple[Int, Int] = (1, 1), ) raises -> Array: """ Applies a 2D max pooling operation over an input tensor. Args: arg0: The input tensor. kernel_size: The size of the window to take a max over. stride: The stride of the window. Default is (1, 1). padding: The padding to apply to the input tensor. Default is (0, 0). dilation: The dilation to apply to the input tensor. Default is (1, 1). Returns: The output tensor. """ return MaxPool2d.fwd(arg0, kernel_size, stride, padding, dilation) --- endia/functional/spacial_ops/max_pool3d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import array_shape_to_list, list_to_array_shape, concat_lists from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( setup_shape_and_data, ) from endia.functional._utils import setup_array_shape, contiguous, op_array from utils.numerics import min_or_neg_inf, max_or_inf struct MaxPool3d: """ Namespace for 3D max pooling operations. """ @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after a 3-dimensional max pooling operation with dilation. Args: curr: The ArrayShape to store the result of the computation. args: The input ArrayShape, and the pooling parameters encoded in an ArrayShape. """ var arg = args[0] # Input tensor var params = array_shape_to_list(args[1]) # Pooling parameters var input_shape = arg.shape_node[].shape var ndim = len(input_shape) if ndim != 5: raise "Input must be 5-dimensional (batch_size, channels, depth, height, width) for 3D pooling!" var batch_size = input_shape[0] var channels = input_shape[1] var kernel_depth = params[0] var kernel_height = params[1] var kernel_width = params[2] var stride_depth = params[3] var stride_height = params[4] var stride_width = params[5] var padding_depth = params[6] var padding_height = params[7] var padding_width = params[8] var dilation_depth = params[9] var dilation_height = params[10] var dilation_width = params[11] var new_shape = List[Int]() new_shape.append(batch_size) new_shape.append(channels) new_shape.append( ( input_shape[2] + 2 * padding_depth - dilation_depth * (kernel_depth - 1) - 1 ) // stride_depth + 1 ) new_shape.append( ( input_shape[3] + 2 * padding_height - dilation_height * (kernel_height - 1) - 1 ) // stride_height + 1 ) new_shape.append( ( input_shape[4] + 2 * padding_width - dilation_width * (kernel_width - 1) - 1 ) // stride_width + 1 ) curr.setup(new_shape) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: var params = array_shape_to_list(curr.array_shape().args()[1]) setup_shape_and_data(curr) var kernel_depth = params[0] var kernel_height = params[1] var kernel_width = params[2] var stride_depth = params[3] var stride_height = params[4] var stride_width = params[5] var padding_depth = params[6] var padding_height = params[7] var padding_width = params[8] var dilation_depth = params[9] var dilation_height = params[10] var dilation_width = params[11] var input = contiguous(args[0]) var out = curr var out_shape = out.shape() var out_data = out.data() var input_data = input.data() var out_stride = out.stride() var input_stride = input.stride() var input_shape = input.shape() for batch in range(out_shape[0]): for channel in range(out_shape[1]): for out_z in range(out_shape[2]): for out_y in range(out_shape[3]): for out_x in range(out_shape[4]): var start_z = out_z * stride_depth - padding_depth var start_y = out_y * stride_height - padding_height var start_x = out_x * stride_width - padding_width var max_val = SIMD[dtype, 1]( min_or_neg_inf[dtype]() ) for kz in range(kernel_depth): var z = start_z + kz * dilation_depth if z >= 0 and z < input_shape[2]: for ky in range(kernel_height): var y = start_y + ky * dilation_height if y >= 0 and y < input_shape[3]: for kx in range(kernel_width): var x = start_x + kx * dilation_width if ( x >= 0 and x < input_shape[4] ): var idx = batch * input_stride[ 0 ] + channel * input_stride[ 1 ] + z * input_stride[ 2 ] + y * input_stride[ 3 ] + x * input_stride[ 4 ] var val = input_data.load( idx ) max_val = max(max_val, val) var out_idx = batch * out_stride[ 0 ] + channel * out_stride[1] + out_z * out_stride[ 2 ] + out_y * out_stride[ 3 ] + out_x * out_stride[ 4 ] out_data.store(out_idx, max_val) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn fwd( arg0: Array, kernel_size: Tuple[Int, Int, Int], stride: Tuple[Int, Int, Int] = (1, 1, 1), padding: Tuple[Int, Int, Int] = (0, 0, 0), dilation: Tuple[Int, Int, Int] = (1, 1, 1), ) raises -> Array: if arg0.is_complex(): raise "Complex numbers are not supported for max_pool3d!" var arr_shape = setup_array_shape( List( arg0.array_shape(), list_to_array_shape( concat_lists( kernel_size[0], kernel_size[1], kernel_size[2], stride[0], stride[1], stride[2], padding[0], padding[1], padding[2], dilation[0], dilation[1], dilation[2], ) ), ), "max_pool3d_shape", MaxPool3d.compute_shape, ) var args = List(arg0) return op_array( arr_shape, args, NA, "max_pool3d", MaxPool3d.__call__, MaxPool3d.jvp, MaxPool3d.vjp, False, ) fn max_pool3d( arg0: Array, kernel_size: Tuple[Int, Int, Int], stride: Tuple[Int, Int, Int] = (1, 1, 1), padding: Tuple[Int, Int, Int] = (0, 0, 0), dilation: Tuple[Int, Int, Int] = (1, 1, 1), ) raises -> Array: """ Applies a 3D max pooling operation over an input tensor. Args: arg0: The input tensor. kernel_size: The size of the pooling kernel. stride: The stride of the pooling operation. padding: The padding to apply to the input tensor. dilation: The dilation to apply to the input tensor. Returns: The result of the 3D max pooling operation. """ return MaxPool3d.fwd(arg0, kernel_size, stride, padding, dilation) --- endia/functional/spacial_ops/readme.md --- # Spacial Operations Spacial operations are operations that are used to process data that has a spatial structure, such as images or time series data. These operations are used to extract features from the data, and are commonly used in machine learning and computer vision applications. Common spacial operations include convolution operations and pooling operations. --- endia/functional/test_.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # --- endia/functional/unary_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .abs_op import to_abs from .acos_op import acos from .asin_op import asin from .atan_op import atan from .cos_op import cos from .cosh_op import cosh from .exp_op import exp from .log_op import log from .neg_op import neg from .reciprocal_op import reciprocal from .relu_op import relu from .sigmoid_op import sigmoid from .square_op import square from .sign_op import sign from .sin_op import sin from .sinh_op import sinh from .sqrt_op import sqrt from .tan_op import tan from .tanh_op import tanh --- endia/functional/unary_ops/_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.functional._utils import ( contiguous, op_array, setup_array_shape, copy_shape, ) from endia.utils import NA trait DifferentiableUnaryOp: @staticmethod fn fwd(arg0: Array) raises -> Array: ... @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: ... @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: ... @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: ... @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: ... fn unary_op_array( arg0: Array, name: String, fwd: fn (inout Array, List[Array]) raises -> None, jvp: fn (List[Array], List[Array]) raises -> Array, vjp: fn (List[Array], Array, Array) raises -> List[Array], inplace_op: Optional[ fn ( SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ] ] = None, ) raises -> Array: var arr_shape = setup_array_shape( arg0.array_shape(), "copy_shape", copy_shape, ) return op_array(arr_shape, arg0, NA, name, fwd, jvp, vjp, False, inplace_op) fn execute_unary_op(inout curr: Array, args: List[Array]) raises: var simd_op = curr.uew()[0] var arg0 = contiguous(args[0]) var arg0_data = arg0.data() var curr_data = curr.data() var rest_size = curr.size() % nelts[dtype]() var end = curr.size() - rest_size if curr.is_complex(): for i in range(0, end, nelts[dtype]()): var idx_real = i * 2 # var idx_imag = idx_real + 1 var data0 = arg0_data.load[width = nelts[dtype]() * 2]( idx_real ).deinterleave() var res_deinterleaved = simd_op(data0[0], data0[1]) var res = res_deinterleaved[0].interleave(res_deinterleaved[1]) curr_data.store[width = 2 * ((nelts[dtype]() * 2) // 2)]( idx_real, res ) if rest_size != 0: var rest_simd0_real = SIMD[dtype, nelts[dtype]() * 2 // 2]() var rest_simd0_imag = SIMD[dtype, nelts[dtype]() * 2 // 2]() for i in range(rest_size): var idx_real = (end + i) * 2 var idx_imag = idx_real + 1 rest_simd0_real[i] = arg0_data.load(idx_real) rest_simd0_imag[i] = arg0_data.load(idx_imag) var res = simd_op( rest_simd0_real, rest_simd0_imag, ) for i in range(rest_size): var idx_real = (end + i) * 2 var idx_imag = idx_real + 1 curr_data.store(idx_real, res[0][i]) curr_data.store(idx_imag, res[1][i]) else: for i in range(0, end, nelts[dtype]()): var res = simd_op( arg0_data.load[width = nelts[dtype]() * 2 // 2](i), SIMD[dtype, nelts[dtype]() * 2 // 2](0), )[0] curr_data.store[width = nelts[dtype]() * 2 // 2](i, res) # now we vectorize along the last dimesion if rest_size != 0: var rest_simd0 = SIMD[dtype, nelts[dtype]() * 2 // 2]() for i in range(rest_size): rest_simd0[i] = arg0_data.load(i + end) var res = simd_op( rest_simd0, SIMD[dtype, nelts[dtype]() * 2 // 2]() )[0] for i in range(end, curr.size()): curr_data.store(i, res[i - end]) _ = arg0 --- endia/functional/unary_ops/abs_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op from endia.functional import sign ####-----------------------------------------------------------------------------------------------------------------#### #### Absolute Value ####-----------------------------------------------------------------------------------------------------------------#### struct Abs(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the absolute value of the input array element-wise. Args: arg0: The input array. Returns: An array containing the absolute value of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = to_abs(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "to_abs", Abs.__call__, Abs.jvp, Abs.vjp, Abs.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the absolute value function. Implements forward-mode automatic differentiation for the absolute value function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the absolute value function. #### Note: The Jacobian-vector product for the absolute value is computed as sign(x) * dx, where x is the primal input and dx is the tangent vector. """ return sign(primals[0]) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the absolute value function. Implements reverse-mode automatic differentiation for the absolute value function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the absolute value is computed as sign(x) * grad, where x is the primal input and grad is the incoming gradient. """ return sign(primals[0]) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the absolute value of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the absolute value of the complex number as a tuple. """ # var real var real = math.sqrt(arg0_real**2 + arg0_imag**2) return real, SIMD[dtype, nelts[dtype]() * 2 // 2](0) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise absolute value computation of an array. Computes the absolute value of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn to_abs(arg0: Array) raises -> Array: """Computes the absolute value of the input array element-wise. Args: arg0: The input array. Returns: An array containing the absolute value of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = to_abs(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return real(Abs.fwd(arg0)) --- endia/functional/unary_ops/acos_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.functional._utils import ( setup_shape_and_data, ) from endia.utils.aliases import dtype, nelts, NA import math from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op from endia.functional import sin struct ACos(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the arccosine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the arccosine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = acos(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "FIX: Complex numbers are not supported for the arccosine function yet." return unary_op_array( arg0, "acos", ACos.__call__, ACos.jvp, ACos.vjp, ACos.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the arccosine function. Implements forward-mode automatic differentiation for the arccosine function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the arccosine function. #### Note: The Jacobian-vector product for arccosine is computed as -1 / sqrt(1 - x^2) * dx, where x is the primal input and dx is the tangent vector. """ return -1 / sqrt(1 - primals[0] ** 2) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the arccosine function. Implements reverse-mode automatic differentiation for the arccosine function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for arccosine is computed as -1 / sqrt(1 - x^2) * grad, where x is the primal input and grad is the incoming gradient. """ return -1 / sqrt(1 - primals[0] ** 2) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the arccosine of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the arccosine of the complex number as a tuple. """ var real = math.acos(arg0_real) var imag = SIMD[dtype, nelts[dtype]() * 2 // 2](0) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise arccosine computation of an array. Computes the arccosine of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn acos(arg0: Array) raises -> Array: """Computes the arccosine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the arccosine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = acos(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return ACos.fwd(arg0) --- endia/functional/unary_ops/asin_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op from endia.functional import cos struct ASin(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the arcsine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the arcsine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = asin(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "FIX: Complex numbers are not supported for the arcsine function yet." return unary_op_array( arg0, "asin", ASin.__call__, ASin.jvp, ASin.vjp, ASin.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the arcsine function. Implements forward-mode automatic differentiation for the arcsine function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the arcsine function. """ return 1 / cos(primals[0]) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the arcsine function. Implements reverse-mode automatic differentiation for the arcsine function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. """ return grad / sqrt(1 - primals[0] ** 2) @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the arcsine of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the arcsine of the complex number as a tuple. """ var real = math.asin(arg0_real) * math.cosh(arg0_imag) var imag = -math.acos(arg0_real) * math.sinh(arg0_imag) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise arcsine computation of an array. Computes the arcsine of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn asin(arg0: Array) raises -> Array: """Computes the arcsine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the arcsine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = asin(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return ASin.fwd(arg0) --- endia/functional/unary_ops/atan_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op struct ATan(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the arctangent of the input array element-wise. Args: arg0: The input array. Returns: An array containing the arctangent of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = atan(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "FIX: Complex numbers are not supported for the arctan function yet." return unary_op_array( arg0, "atan", ATan.__call__, ATan.jvp, ATan.vjp, ATan.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the arctangent function. Implements forward-mode automatic differentiation for the arctangent function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the arctangent function. #### Note: The Jacobian-vector product for the arctangent is computed as 1 / (1 + x^2) * dx, where x is the primal input and dx is the tangent vector. """ return 1 / (1 + square(primals[0])) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the arctangent function. Implements reverse-mode automatic differentiation for the arctangent function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. """ return grad / (1 + square(primals[0])) @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the arctangent of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the arctangent of the complex number as a tuple. """ var real = math.atan(arg0_real) var imag = SIMD[dtype, nelts[dtype]() * 2 // 2](0) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise arctangent computation of an array. Computes the arctangent of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn atan(arg0: Array) raises -> Array: """Computes the arctangent of the input array element-wise. Args: arg0: The input array. Returns: An array containing the arctangent of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = atan(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return ATan.fwd(arg0) --- endia/functional/unary_ops/cos_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.functional._utils import ( setup_shape_and_data, ) from endia.utils.aliases import dtype, nelts, NA import math from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op from endia.functional import sin ####-----------------------------------------------------------------------------------------------------------------#### #### Cos ####-----------------------------------------------------------------------------------------------------------------#### struct Cos(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the cosine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the cosine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = cos(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "cos", Cos.__call__, Cos.jvp, Cos.vjp, Cos.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the cosine function. Implements forward-mode automatic differentiation for the cosine function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the cosine function. #### Note: The Jacobian-vector product for cosine is computed as -sin(x) * dx, where x is the primal input and dx is the tangent vector. """ return -sin(primals[0]) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the cosine function. Implements reverse-mode automatic differentiation for the cosine function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for cosine is computed as -sin(x) * grad, where x is the primal input and grad is the incoming gradient. """ return -sin(primals[0]) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the cosine of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the cosine of the complex number as a tuple. """ var real = math.cos(arg0_real) * math.cosh(arg0_imag) var imag = -math.sin(arg0_real) * math.sinh(arg0_imag) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise cosine computation of an array. Computes the cosine of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn cos(arg0: Array) raises -> Array: """Computes the cosine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the cosine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = cos(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Cos.fwd(arg0) --- endia/functional/unary_ops/cosh_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.functional._utils import ( setup_shape_and_data, ) from endia.utils.aliases import dtype, nelts, NA import math from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op from endia.functional import sin, sinh struct CosH(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the hyperbolic cosine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the hyperbolic cosine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = cosh(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "cosh", CosH.__call__, CosH.jvp, CosH.vjp, CosH.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the hyperbolic cosine function. Implements forward-mode automatic differentiation for the hyperbolic cosine function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the hyperbolic cosine function. #### Note: The Jacobian-vector product for hyperbolic cosine is computed as sinh(x) * dx, where x is the primal input and dx is the tangent vector. """ return sinh(primals[0]) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the hyperbolic cosine function. Implements reverse-mode automatic differentiation for the hyperbolic cosine function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for hyperbolic cosine is computed as sinh(x) * grad, where x is the primal input and grad is the incoming gradient. """ return sinh(primals[0]) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the hyperbolic cosine of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the hyperbolic cosine of the complex number as a tuple. """ var real = math.cosh(arg0_real) * math.cos(arg0_imag) var imag = math.sinh(arg0_real) * math.sin(arg0_imag) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise hyperbolic cosine computation of an array. Computes the hyperbolic cosine of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn cosh(arg0: Array) raises -> Array: """Computes the hyperbolic cosine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the hyperbolic cosine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = cosh(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return CosH.fwd(arg0) --- endia/functional/unary_ops/exp_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Exponential ####-----------------------------------------------------------------------------------------------------------------#### struct Exp(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the exponential of the input array element-wise. Args: arg0: The input array. Returns: An array containing the exponential of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = exp(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "exp", Exp.__call__, Exp.jvp, Exp.vjp, Exp.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the exponential function. Implements forward-mode automatic differentiation for the exponential function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the exponential function. #### Note: The Jacobian-vector product for the exponential is computed as exp(x) * dx, where x is the primal input and dx is the tangent vector. """ return exp(primals[0]) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the exponential function. Implements reverse-mode automatic differentiation for the exponential function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the exponential is computed as exp(x) * grad, where x is the primal input and grad is the incoming gradient. """ return exp(primals[0]) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the exponential of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the exponential of the complex number as a tuple. """ # return math.exp(arg0_real), SIMD[dtype, nelts[dtype]() * 2 // 2](0) var real = math.exp(arg0_real) * math.cos(arg0_imag) var imag = math.exp(arg0_real) * math.sin(arg0_imag) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise exponential computation of an array. Computes the exponential of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn exp(arg0: Array) raises -> Array: """Computes the exponential of the input array element-wise. Args: arg0: The input array. Returns: An array containing the exponential of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = exp(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Exp.fwd(arg0) --- endia/functional/unary_ops/log_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Logarithm ####-----------------------------------------------------------------------------------------------------------------#### struct Log(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the natural logarithm of the input array element-wise. Args: arg0: The input array. Returns: An array containing the natural logarithm of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = log(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "log", Log.__call__, Log.jvp, Log.vjp, Log.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the natural logarithm function. Implements forward-mode automatic differentiation for the natural logarithm function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the natural logarithm function. #### Note: The Jacobian-vector product for the natural logarithm is computed as dx / x, where x is the primal input and dx is the tangent vector. """ return tangents[0] / primals[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the natural logarithm function. Implements reverse-mode automatic differentiation for the natural logarithm function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the natural logarithm is computed as grad / x, where x is the primal input and grad is the incoming gradient. """ return grad / primals[0] @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the natural logarithm of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the natural logarithm of the complex number as a tuple. """ var real = math.log( math.sqrt(arg0_real * arg0_real + arg0_imag * arg0_imag) ) var imag = math.atan2(arg0_imag, arg0_real) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise natural logarithm computation of an array. Computes the natural logarithm of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn log(arg0: Array) raises -> Array: """Computes the natural logarithm of the input array element-wise. Args: arg0: The input array. Returns: An array containing the natural logarithm of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = log(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Log.fwd(arg0) --- endia/functional/unary_ops/neg_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Negation ####-----------------------------------------------------------------------------------------------------------------#### struct Neg(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the negation of the input array element-wise. Args: arg0: The input array. Returns: An array containing the negation of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = neg(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "neg", Neg.__call__, Neg.jvp, Neg.vjp, Neg.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the negation function. Implements forward-mode automatic differentiation for the negation function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the negation function. #### Note: The Jacobian-vector product for negation is computed as -dx, where dx is the tangent vector. """ return -tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the negation function. Implements reverse-mode automatic differentiation for the negation function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for negation is computed as -grad. """ return -grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the negation of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the negation of the complex number as a tuple. """ var real = -arg0_real var imag = -arg0_imag return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise negation computation of an array. Computes the negation of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn neg(arg0: Array) raises -> Array: """Computes the negation of the input array element-wise. Args: arg0: The input array. Returns: An array containing the negation of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = neg(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Neg.fwd(arg0) --- endia/functional/unary_ops/readme.md --- # Unary Operations Unary operations are operations that take a single Array as input and return a single Array as output. These operations are used to perform element-wise operations. Common unary operations include negation, absolute value, square, square root, exponential, and logarithm. --- endia/functional/unary_ops/reciprocal_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Reciprocal ####-----------------------------------------------------------------------------------------------------------------##### struct Reciprocal(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the reciprocal of the input array element-wise. Args: arg0: The input array. Returns: An array containing the reciprocal of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reciprocal(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "reciprocal", Reciprocal.__call__, Reciprocal.jvp, Reciprocal.vjp, Reciprocal.unary_simd_op, ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the reciprocal function. Implements forward-mode automatic differentiation for the reciprocal function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the reciprocal function. #### Note: The Jacobian-vector product for the reciprocal is computed as -x^2 * dx / x^2, where x is the primal input and dx is the tangent vector. """ return -primals[0] ** -2 @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the reciprocal function. Implements reverse-mode automatic differentiation for the reciprocal function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the reciprocal is computed as -grad / x^2, where x is the primal input and grad is the incoming gradient. """ return -grad / square(primals[0]) @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the reciprocal of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the reciprocal of the complex number as a tuple. """ var denom = arg0_real * arg0_real + arg0_imag * arg0_imag var real = arg0_real / denom var imag = -arg0_imag / denom return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise reciprocal computation of an array. Computes the reciprocal of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn reciprocal(arg0: Array) raises -> Array: """Computes the reciprocal of the input array element-wise. Args: arg0: The input array. Returns: An array containing the reciprocal of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = reciprocal(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Reciprocal.fwd(arg0) --- endia/functional/unary_ops/relu_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op from endia.functional import ge_zero ####-----------------------------------------------------------------------------------------------------------------#### #### ReLU ####-----------------------------------------------------------------------------------------------------------------#### struct Relu(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the rectified linear unit (ReLU) of the input array element-wise. Args: arg0: The input array. Returns: An array containing the ReLU of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = relu(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "ReLU function does not support complex arguments." return unary_op_array( arg0, "relu", Relu.__call__, Relu.jvp, Relu.vjp, Relu.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the ReLU function. Implements forward-mode automatic differentiation for the ReLU function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the ReLU function. #### Note: The Jacobian-vector product for ReLU is computed as ge_zero(x) * dx, where x is the primal input and dx is the tangent vector. """ return (primals[0] > 0) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the ReLU function. Implements reverse-mode automatic differentiation for the ReLU function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for ReLU is computed as ge_zero(x) * grad, where x is the primal input and grad is the incoming gradient. """ return (primals[0] > 0) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the rectified linear unit (ReLU) of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the ReLU of the complex number as a tuple. """ var real = max(arg0_real, 0) var imag = SIMD[dtype, nelts[dtype]() * 2 // 2](0) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise ReLU computation of an array. Computes the ReLU of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn relu(arg0: Array) raises -> Array: """Computes the rectified linear unit (ReLU) of the input array element-wise. Args: arg0: The input array. Returns: An array containing the ReLU of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = relu(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Relu.fwd(arg0) --- endia/functional/unary_ops/sigmoid_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Sigmoid Function ####-----------------------------------------------------------------------------------------------------------------#### struct Sigmoid(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the sigmoid function of the input array element-wise. Args: arg0: The input array. Returns: An array containing the sigmoid function of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sigmoid(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "Sigmoid function does not support complex arguments." return unary_op_array( arg0, "sigmoid", Sigmoid.__call__, Sigmoid.jvp, Sigmoid.vjp, Sigmoid.unary_simd_op, ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the sigmoid function. Implements forward-mode automatic differentiation for the sigmoid function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the sigmoid function. #### Note: The Jacobian-vector product for the sigmoid is computed as x * (1 - x) * dx, where x is the primal input and dx is the tangent vector. """ return primals[0] * (1 - primals[0]) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the sigmoid function. Implements reverse-mode automatic differentiation for the sigmoid function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the sigmoid is computed as x * (1 - x) * grad, where x is the primal input and grad is the incoming gradient. """ return out * (1 - out) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the sigmoid function of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the sigmoid function of the complex number as a tuple. """ var res = SIMD[dtype, nelts[dtype]() * 2 // 2]() for i in range(nelts[dtype]()): res[i] = 1 / (1 + math.exp(-arg0_real[i])) return res, SIMD[dtype, nelts[dtype]() * 2 // 2](0) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise sigmoid function computation of an array. Computes the sigmoid function of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn sigmoid(arg0: Array) raises -> Array: """Computes the sigmoid function of the input array element-wise. Args: arg0: The input array. Returns: An array containing the sigmoid function of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sigmoid(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Sigmoid.fwd(arg0) --- endia/functional/unary_ops/sign_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Sign Function ####-----------------------------------------------------------------------------------------------------------------#### struct Sign(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the sign function of the input array element-wise. Args: arg0: The input array. Returns: An array containing the sign function of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sign(a) print(result) ``` #### Note: This function supports: - Complex valued arguments. """ return unary_op_array( arg0, "sign", Sign.__call__, Sign.jvp, Sign.vjp, Sign.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the sign function of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the sign function of the complex number as a tuple. """ var norm = math.sqrt(arg0_real * arg0_real + arg0_imag * arg0_imag) var real = arg0_real / norm var imag = arg0_imag / norm return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise sign function computation of an array. Computes the sign function of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn sign(arg0: Array) raises -> Array: """Computes the sign function of the input array element-wise. Args: arg0: The input array. Returns: An array containing the sign function of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sign(a) print(result) ``` #### Note: This function supports: - Complex valued arguments. """ return Sign.fwd(arg0) --- endia/functional/unary_ops/sin_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op from endia.functional import cos ####-----------------------------------------------------------------------------------------------------------------#### #### Sin ####-----------------------------------------------------------------------------------------------------------------#### struct Sin(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the sine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the sine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sin(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "sin", Sin.__call__, Sin.jvp, Sin.vjp, Sin.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the sine function. Implements forward-mode automatic differentiation for the sine function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the sine function. #### Note: The Jacobian-vector product for sine is computed as cos(x) * dx, where x is the primal input and dx is the tangent vector. """ return cos(primals[0]) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the sine function. Implements reverse-mode automatic differentiation for the sine function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for sine is computed as cos(x) * grad, where x is the primal input and grad is the incoming gradient. """ return cos(primals[0]) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the sine of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the sine of the complex number as a tuple. """ var real = math.sin(arg0_real) * math.cosh(arg0_imag) var imag = math.cos(arg0_real) * math.sinh(arg0_imag) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise sine computation of an array. Computes the sine of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn sin(arg0: Array) raises -> Array: """Computes the sine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the sine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sin(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Sin.fwd(arg0) --- endia/functional/unary_ops/sinh_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op from endia.functional import cos, cosh struct SinH(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the hyperbolic sine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the hyperbolic sine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sinh(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "sinh", SinH.__call__, SinH.jvp, SinH.vjp, SinH.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the hyperbolic sine function. Implements forward-mode automatic differentiation for the hyperbolic sine function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the hyperbolic sine function. #### Note: The Jacobian-vector product for hyperbolic sine is computed as cosh(x) * dx, where x is the primal input and dx is the tangent vector. """ return cosh(primals[0]) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the hyperbolic sine function. Implements reverse-mode automatic differentiation for the hyperbolic sine function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for hyperbolic sine is computed as cosh(x) * grad, where x is the primal input and grad is the incoming gradient. """ return cosh(primals[0]) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the hyperbolic sine of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the hyperbolic sine of the complex number as a tuple. """ var real = math.sinh(arg0_real) * math.cos(arg0_imag) var imag = math.cosh(arg0_real) * math.sin(arg0_imag) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise hyperbolic sine computation of an array. Computes the hyperbolic sine of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn sinh(arg0: Array) raises -> Array: """Computes the hyperbolic sine of the input array element-wise. Args: arg0: The input array. Returns: An array containing the hyperbolic sine of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sinh(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return SinH.fwd(arg0) --- endia/functional/unary_ops/sqrt_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Square Root ####-----------------------------------------------------------------------------------------------------------------#### struct Sqrt(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the square root of the input array element-wise. Args: arg0: The input array. Returns: An array containing the square root of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sqrt(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "sqrt", Sqrt.__call__, Sqrt.jvp, Sqrt.vjp, Sqrt.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the square root function. Implements forward-mode automatic differentiation for the square root function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the square root function. #### Note: The Jacobian-vector product for the square root is computed as dx / (2 * sqrt(x)), where x is the primal input and dx is the tangent vector. """ return tangents[0] / (2 * sqrt(primals[0])) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the square root function. Implements reverse-mode automatic differentiation for the square root function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the square root is computed as grad / (2 * sqrt(x)), where x is the primal input and grad is the incoming gradient. """ return grad / (2 * sqrt(primals[0])) @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the square root of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the square root of the complex number as a tuple. """ var r = math.sqrt(arg0_real * arg0_real + arg0_imag * arg0_imag) var real = math.sqrt((r + arg0_real) / 2) var imag = math.copysign(math.sqrt((r - arg0_real) / 2), arg0_imag) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise square root computation of an array. Computes the square root of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn sqrt(arg0: Array) raises -> Array: """Computes the square root of the input array element-wise. Args: arg0: The input array. Returns: An array containing the square root of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = sqrt(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Sqrt.fwd(arg0) --- endia/functional/unary_ops/square_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Square ####-----------------------------------------------------------------------------------------------------------------#### struct Square(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the square of the input array element-wise. Args: arg0: The input array. Returns: An array containing the square of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = square(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "square", Square.__call__, Square.jvp, Square.vjp, Square.unary_simd_op, ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the square function. Implements forward-mode automatic differentiation for the square function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the square function. #### Note: The Jacobian-vector product for the square is computed as x * dx, where x is the primal input and dx is the tangent vector. """ return 2 * primals[0] * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the square function. Implements reverse-mode automatic differentiation for the square function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the square is computed as x * grad, where x is the primal input and grad is the incoming gradient. """ return 2 * primals[0] * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the square of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the square of the complex number as a tuple. """ # return arg0_real * arg0_real, SIMD[dtype, nelts[dtype]() * 2 // 2](0) var real = arg0_real * arg0_real - arg0_imag * arg0_imag var imag = 2 * arg0_real * arg0_imag return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise square computation of an array. Computes the square of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn square(arg0: Array) raises -> Array: """Computes the square of the input array element-wise. Args: arg0: The input array. Returns: An array containing the square of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = square(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Square.fwd(arg0) --- endia/functional/unary_ops/tan_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op struct Tan(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the tangent of the input array element-wise. Args: arg0: The input array. Returns: An array containing the tangent of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = tan(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ if arg0.is_complex(): raise "FIX: Complex numbers are not supported for the tan function yet." return unary_op_array( arg0, "tan", Tan.__call__, Tan.jvp, Tan.vjp, Tan.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the tangent function. Implements forward-mode automatic differentiation for the tangent function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the tangent function. """ return 1 + square(tan(primals[0])) * tangents[0] @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the tangent function. Implements reverse-mode automatic differentiation for the tangent function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. """ return grad * (1 + square(out)) @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the tangent of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the tangent of the complex number as a tuple. """ var real = math.tan(arg0_real) var imag = SIMD[dtype, nelts[dtype]() * 2 // 2](0) return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise tangent computation of an array. Computes the tangent of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn tan(arg0: Array) raises -> Array: """Computes the tangent of the input array element-wise. Args: arg0: The input array. Returns: An array containing the tangent of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = tan(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Tan.fwd(arg0) --- endia/functional/unary_ops/tanh_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( setup_shape_and_data, ) from ._utils import DifferentiableUnaryOp, unary_op_array, execute_unary_op ####-----------------------------------------------------------------------------------------------------------------#### #### Tan ####-----------------------------------------------------------------------------------------------------------------#### struct Tanh(DifferentiableUnaryOp): @staticmethod fn fwd(arg0: Array) raises -> Array: """Computes the hyperbolic tangent of the input array element-wise. Args: arg0: The input array. Returns: An array containing the hyperbolic tangent of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = tanh(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return unary_op_array( arg0, "tanh", Tanh.__call__, Tanh.jvp, Tanh.vjp, Tanh.unary_simd_op ) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: """Computes the Jacobian-vector product for the hyperbolic tangent function. Implements forward-mode automatic differentiation for the hyperbolic tangent function. Args: primals: A list containing the primal input array. tangents: A list containing the tangent vector. Returns: The Jacobian-vector product for the hyperbolic tangent function. #### Note: The Jacobian-vector product for the hyperbolic tangent is computed as (1 - tanh(x)^2) * dx, where x is the primal input and dx is the tangent vector. """ return 1 - square(tanh(primals[0])) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the hyperbolic tangent function. Implements reverse-mode automatic differentiation for the hyperbolic tangent function. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for the hyperbolic tangent is computed as (1 - tanh(x)^2) * grad, where x is the primal input and grad is the incoming gradient. """ return (1 - square(tanh(primals[0]))) * grad @staticmethod fn unary_simd_op( arg0_real: SIMD[dtype, nelts[dtype]() * 2 // 2], arg0_imag: SIMD[dtype, nelts[dtype]() * 2 // 2], ) -> Tuple[ SIMD[dtype, nelts[dtype]() * 2 // 2], SIMD[dtype, nelts[dtype]() * 2 // 2], ]: """ Low-level function to compute the hyperbolic tangent of a complex number represented as SIMD vectors. Args: arg0_real: The real part of the complex number. arg0_imag: The imaginary part of the complex number. Returns: The real and imaginary parts of the hyperbolic tangent of the complex number as a tuple. """ var denom = math.cosh(2 * arg0_real) + math.cos(2 * arg0_imag) var real = math.sinh(2 * arg0_real) / denom var imag = math.sin(2 * arg0_imag) / denom return real, imag @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for element-wise hyperbolic tangent computation of an array. Computes the hyperbolic tangent of each element in the input array and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly. """ setup_shape_and_data(curr) execute_unary_op(curr, args) fn tanh(arg0: Array) raises -> Array: """Computes the hyperbolic tangent of the input array element-wise. Args: arg0: The input array. Returns: An array containing the hyperbolic tangent of each element in the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = tanh(a) print(result) ``` #### Note: This function supports: - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Tanh.fwd(arg0) --- endia/functional/view_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .array_slice_op import array_slice from .as_strided_op import as_strided from .detach_op import detach from .expand_op import expand, expand_as, broadcast_to from .imag_op import imag from .pad_op import pad from .permute_op import permute, swapaxes, swapdims, transpose from .real_op import real from .squeeze_op import squeeze from .unsqueeze_op import unsqueeze from .view_as_imag_op import view_as_imag from .view_as_real_op import view_as_real from .view_op import reshape, view, flatten --- endia/functional/view_ops/_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array trait DifferentiableViewOp: """ Trait for binary operations that are differentiable. That mean they define methods for both forward and reverse mode automatic differentiation. """ @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: ... @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: ... @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: ... @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: ... --- endia/functional/view_ops/array_slice_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_slices, slices_to_array_shape, compute_shape, setup_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( op_array, setup_shape_and_data, ) from endia.functional import pad from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # Slice ####--------------------------------------------------------------------------------------------------------------------#### struct ArraySlice(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after slicing. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to slice, and the list of slices encoded in an ArrayShape via the array_shape_to_slices function. """ # we have the slices as the second argument in the form of an arrayshape var arg = args[0] var slices = array_shape_to_slices(args[1]) var sliced_shape = List[Int]() var sliced_stride = List[Int]() var storage_offset = 0 for i in range(arg.shape_node[].ndim): var slice = slices[i] if i < len(slices) else Slice( 0, arg.shape_node[].shape[i], 1 ) slice.start = ( max(0, slice.start) % (arg.shape_node[].shape[i] + 1) if slice.step > 0 else min( arg.shape_node[].shape[i], slice.end % (arg.shape_node[].shape[i] + 1), ) - 1 ) slice.end = ( min(arg.shape_node[].shape[i], slice.end) % (arg.shape_node[].shape[i] + 1) if slice.step > 0 else max(0, slice.start) - 1 ) sliced_shape.append( (slice.end - slice.start + slice.step - 1) // slice.step ) sliced_stride.append(arg.shape_node[].stride[i] * slice.step) storage_offset += slice.start * arg.shape_node[].stride[i] curr.setup(sliced_shape, sliced_stride, storage_offset) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the slice operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the slice view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ curr.base_(args[0].base()) var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Computes the vector-Jacobian product for the slice operation. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for slice is computed by padding the gradient with zeros along the axes that were sliced. """ var slices = array_shape_to_slices(out.array_shape().args()[1]) return List(pad(grad, primals[0].array_shape(), slices)) @staticmethod fn fwd(arg0: Array, slices: List[Slice]) raises -> Array: """ Slices the input array based on the given slices. Args: arg0: The input array. slices: The slices to apply. Returns: The sliced array. """ var arr_shape = setup_array_shape( List(arg0.array_shape(), slices_to_array_shape(slices)), "slice_shape", # sliced_shape, ArraySlice.compute_shape, ) return op_array( arr_shape, List(arg0), NA, "slice", ArraySlice.__call__, ArraySlice.jvp, ArraySlice.vjp, True, ) fn array_slice(arg0: Array, slices: List[Slice]) raises -> Array: """ Slices the input array based on the given slices. Args: arg0: The input array. slices: The slices to apply. Returns: The sliced array. """ return ArraySlice.fwd(arg0, slices) --- endia/functional/view_ops/as_strided_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # As AsStrided ####--------------------------------------------------------------------------------------------------------------------#### struct AsStrided(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after striding. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to stride, the shape, stride and storage offset of the target ArrayShape encoded in a single ArrayShape. """ # like the slice method however we only take the real part of the array var arg = args[1] curr.setup(arg.shape(), arg.stride(), arg.storage_offset()) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the as_strided operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the as_strided view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ curr.base_(args[0].base()) var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Computes the vector-Jacobian product for the as_strided operation. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for as_strided is computed by calling the inverse operation as_strided_inv. """ var out_shape = out.array_shape() return as_strided_inv( grad, primals[0].shape(), out_shape.shape(), out_shape.stride(), out_shape.storage_offset(), ) @staticmethod fn fwd( arg0: Array, shape: List[Int], stride: List[Int], storage_offset: Int, ) raises -> Array: """ Creates a view of the input array with the given shape and stride. Args: arg0: The input array. shape: The shape of the view. stride: The stride of the view. storage_offset: The storage offset of the view. Returns: A view of the input array with the given shape and stride. """ var arr_shape = setup_array_shape( List( arg0.array_shape(), ArrayShape(shape, stride, storage_offset), ), "as_strided_shape", AsStrided.compute_shape, ) return op_array( arr_shape, List(arg0), NA, "as_strided", AsStrided.__call__, AsStrided.jvp, AsStrided.vjp, True, ) fn as_strided( arg0: Array, shape: List[Int], stride: List[Int], storage_offset: Int ) raises -> Array: """ Creates a view of the input array with the given shape and stride. Args: arg0: The input array. shape: The shape of the view. stride: The stride of the view. storage_offset: The storage offset of the view. Returns: A view of the input array with the given shape and stride. """ return AsStrided.fwd(arg0, shape, stride, storage_offset) ####--------------------------------------------------------------------------------------------------------------------#### # As AsStrided Inverse ####--------------------------------------------------------------------------------------------------------------------#### struct AsStridedInv(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after striding, in an inverse manner to the as_strided_shape function. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to stride, the shape, stride and storage offset of the target ArrayShape encoded in a single ArrayShape. """ # liek the slice method however we only take the real part of the array var arg = args[0] curr.setup(arg.shape(), arg.stride(), arg.storage_offset()) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the as_strided_inv operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the as_strided_inv view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var arg = contiguous(args[0]) var target_array_shape = curr.array_shape().args()[1] setup_shape_and_data(curr) var curr_strided = as_strided( curr, shape=target_array_shape.shape(), stride=target_array_shape.stride(), storage_offset=target_array_shape.storage_offset(), ) for i in range(arg.size()): curr_strided.store(i, curr_strided.load(i) + arg.load(i)) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Computes the vector-Jacobian product for the as_strided_inv operation. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for as_strided_inv is computed by calling the as_strided operation. """ var target_array_shape = grad.array_shape().args()[1] return List( as_strided( grad, shape=target_array_shape.shape(), stride=target_array_shape.stride(), storage_offset=target_array_shape.storage_offset(), ) ) @staticmethod fn fwd( arg0: Array, target_shape: ArrayShape, shape: List[Int], stride: List[Int], storage_offset: Int, ) raises -> Array: """ Creates a view of the input array with the given shape and stride. Args: arg0: The input array. target_shape: The target shape of the view. shape: The shape of the view. stride: The stride of the view. storage_offset: The storage offset of the view. Returns: A view of the input array with the given shape and stride. """ var arr_shape = setup_array_shape( List(target_shape, ArrayShape(shape, stride, storage_offset)), "as_strided_inv_shape", AsStridedInv.compute_shape, ) var curr = op_array( arr_shape, List(arg0), NA, "as_strided_inv", AsStridedInv.__call__, AsStridedInv.jvp, AsStridedInv.vjp, False, ) return curr fn as_strided_inv( arg0: Array, target_shape: ArrayShape, shape: List[Int], stride: List[Int], storage_offset: Int, ) raises -> Array: """ Creates a view of the input array with the given shape and stride. Args: arg0: The input array. target_shape: The target shape of the view. shape: The shape of the view. stride: The stride of the view. storage_offset: The storage offset of the view. Returns: A view of the input array with the given shape and stride. """ return AsStridedInv.fwd(arg0, target_shape, shape, stride, storage_offset) --- endia/functional/view_ops/detach_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # Detach ####--------------------------------------------------------------------------------------------------------------------#### struct Detach(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after detaching. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to detach. """ # Computes the shape of an array after detaching. # liek the slice method however we only take the real part of the array var arg = args[0] curr.setup(arg.shape(), arg.stride(), arg.storage_offset()) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the detach operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array to detach. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ curr.base_(args[0].base()) var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn fwd(arg0: Array) raises -> Array: """ Detaches the input array from the computation graph. Args: arg0: The input array. Returns: The detached array. #### Note: This function is non-differentiable. """ var arr_shape = setup_array_shape( List(arg0.array_shape()), "detach_shape", Detach.compute_shape ) var res = op_array( arr_shape, List(arg0), NA, "detach", Detach.__call__, Detach.jvp, Detach.vjp, True, ) res.requires_grad_(False) return res fn detach(arg0: Array) raises -> Array: """ Detaches the input array from the computation graph. Args: arg0: The input array. Returns: The detached array. #### Note: This function is non-differentiable. """ return Detach.fwd(arg0) --- endia/functional/view_ops/expand_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( setup_array_shape, array_shape_to_list, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp from endia.functional import reduce_add ####--------------------------------------------------------------------------------------------------------------------#### # Expand/Broadcast ####--------------------------------------------------------------------------------------------------------------------#### struct Expand(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape resulting from broadcasting one array to another. Args: curr: The ArrayShape to store the result of the computation. args: Source ArrayShape, target ArrayShape, and axes to ignore during broadcasting. #### Constraints: - The number of dimensions of the source ArrayShape must be less than or equal to the number of dimensions of the target ArrayShape. """ var scr = args[0] var target = args[1] var ignore_axes_ = array_shape_to_list(args[2]) if len( args ) == 3 else List[Int]() # adapt axis values var ignore_axes = List[Int]() for i in range(len(ignore_axes_)): if ignore_axes_[i] < 0: ignore_axes.append(scr.shape_node[].ndim + ignore_axes_[i]) else: ignore_axes.append(ignore_axes_[i]) var shape = List[Int]() var stride = List[Int]() var storage_offset = 0 var diff = len(target.shape_node[].shape) - len(scr.shape_node[].shape) for i in range(diff): shape.append(target.shape_node[].shape[i]) stride.append(0) for i in range(len(scr.shape_node[].shape)): if list_contains(ignore_axes, i): shape.append(scr.shape_node[].shape[i]) stride.append(scr.shape_node[].stride[i]) continue if scr.shape_node[].shape[i] == target.shape_node[].shape[i + diff]: shape.append(scr.shape_node[].shape[i]) stride.append(scr.shape_node[].stride[i]) elif scr.shape_node[].shape[i] == 1: shape.append(target.shape_node[].shape[i + diff]) stride.append(0) else: raise "Error in broadcast_shape_to: Incompatible shapes for broadcasting" curr.setup(shape, stride, storage_offset) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the expand operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the expanded view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Computes the vector-Jacobian product for the expand operation. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for expand is computed by reducing the gradient along the axes that were expanded. """ var stride = out.stride() var axis = List[Int]() for i in range(grad.ndim()): if stride[i] == 0: axis.append(i) return List(reduce_add(grad, axis)) @staticmethod fn fwd( arg0: Array, array_shape: ArrayShape, ignore_axes: List[Int] = List[Int](), ) raises -> Array: """ Expands the input array to the given shape. Args: arg0: The input array. array_shape: The target shape. ignore_axes: The axes to ignore during expansion. Returns: The expanded array. #### Constraints: - The number of dimensions of the source ArrayShape must be less than or equal to the number of dimensions of the target ArrayShape. - The number of axis to ignore must be less than or equal to the number of dimensions of the source ArrayShape. #### Note: When performing an expand operation in eager mode, the function checks if the shape of the input array is equal to the target shape. If they are equal, the function returns the input array as is. This is done to avoid unnecessary computation. """ # The folliwng code checks if arg0 shape and target_shape are equal, if so and also the arg0 does not have an associated fxgraph, return arg0 # note: when fxgraph is used, we want to cache the graph but still want to be reactive on the shape changes # if not arg0.has_fxgraph(): var adapted_ignore_axis = List[Int]() for i in range(len(ignore_axes)): if ignore_axes[i] < 0: adapted_ignore_axis.append(arg0.ndim() + ignore_axes[i]) else: adapted_ignore_axis.append(ignore_axes[i]) if arg0.ndim() == array_shape.ndim(): var equal = True var arg0_shape = arg0.shape() var target_shape = array_shape.shape() for i in range(arg0.ndim()): if list_contains(adapted_ignore_axis, i): continue if arg0_shape[i] != target_shape[i]: equal = False break if equal: return arg0 var arr_shape = setup_array_shape( List( arg0.array_shape(), array_shape, list_to_array_shape(ignore_axes), ), "brdcst_shape", Expand.compute_shape, ) if len(ignore_axes) > 0 else setup_array_shape( List(arg0.array_shape(), array_shape), "brdcst_shape", Expand.compute_shape, ) var curr = op_array( arr_shape, List(arg0), NA, "brdcst", Expand.__call__, Expand.jvp, Expand.vjp, True, ) curr.base_(arg0.base()) return curr fn expand( arg0: Array, shape: ArrayShape, ignore_axes: List[Int] = List[Int]() ) raises -> Array: """ Expands the input array to the given shape. Args: arg0: The input array. shape: The target shape. ignore_axes: The axes to ignore during expansion. Returns: The expanded array. #### Note: This function is a wrapper around the expand function with the target shape being the shape of the target array. """ return Expand.fwd(arg0, shape, ignore_axes) fn expand_as(arg0: Array, arg1: Array) raises -> Array: """ Expands the input array to the shape of the target array. Args: arg0: The input array. arg1: The target array. Returns: A view on the input array with the shape of the target array. #### Note: This function is a wrapper around the expand function with the target shape being the shape of the target array. """ return expand(arg0, arg1.array_shape()) fn broadcast_to(arg0: Array, shape: List[Int]) raises -> Array: """ Broadcasts the input array to the given shape. Args: arg0: The input array. shape: The target shape. Returns: A view on the input array with the target shape. #### Note: This function is a wrapper around the expand function with the target shape being the shape of the target array. """ return expand(arg0, ArrayShape(shape)) --- endia/functional/view_ops/imag_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # Imaginary ####--------------------------------------------------------------------------------------------------------------------#### struct Imag(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of the imaginary part of a complex array. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to compute the imaginary part of. """ # liek the slice method however we only take the real part of the array var arg = args[0] var shape = arg.shape_node[].shape var stride = arg.shape_node[].stride var storage_offset = arg.shape_node[].storage_offset + stride[ len(stride) - 1 ] var new_shape = List[Int]() var new_stride = List[Int]() for i in range(len(shape)): new_shape.append(shape[i]) new_stride.append(stride[i] * 2) curr.setup(new_shape, new_stride, storage_offset) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the imag operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the imag view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn fwd(arg0: Array) raises -> Array: """ Creates a view of the input array as an imaginary array. Args: arg0: The input array. Returns: A view of the input array as an imaginary array. #### Note: This function is non-differentiable. """ var arr_shape = setup_array_shape( List(arg0.array_shape()), "imag_shape", Imag.compute_shape, ) var res = op_array( arr_shape, List(arg0), NA, "imag", Imag.__call__, Imag.jvp, Imag.vjp, True, ) res.is_complex_(False) res.base_(arg0.base()) return res fn imag(arg0: Array) raises -> Array: """ Computes the imaginary part of the input array. Args: arg0: The input array. Returns: An array containing the imaginary part of the input array. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = imag(a) print(result) ``` #### Note: This function supports: - Complex input arrays. - Non-differentiable operation. """ return Imag.fwd(arg0) --- endia/functional/view_ops/pad_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( array_shape_to_slices, slices_to_array_shape, setup_array_shape, ) from endia.utils.aliases import dtype, nelts, NA import math from endia.functional._utils import ( op_array, setup_shape_and_data, ) from endia.functional import array_slice ####-----------------------------------------------------------------------------------------------------------------#### #### Padding ####-----------------------------------------------------------------------------------------------------------------#### struct Pad: @staticmethod fn fwd( arg0: Array, target_shape: ArrayShape, slices_in_target: List[Slice] ) raises -> Array: """Pads an array to a target shape. Pads the input array to the target shape by copying the input array to the target shape. The target shape must be larger than the input array shape. The slices in the target shape specify the region where the input array is copied. Args: arg0: The input array to be padded. target_shape: The target shape to pad the input array to. slices_in_target: A list of slices specifying the region in the target shape where the input array is copied. Returns: An array containing the input array padded to the target shape. #### Examples: ```python a = Array([[1, 2], [3, 4]]) target_shape = ArrayShape([2, 3]) slices_in_target = [Slice(0, 2), Slice(0, 2)] result = pad(a, target_shape, slices_in_target) print(result) ``` #### Note: This function supports: - Automatic differentiation (reverse mode only). - Complex valued arguments. """ var arr_shape = setup_array_shape( List( arg0.array_shape(), target_shape, slices_to_array_shape(slices_in_target), ), "pad_shape", Pad.padded_shape, ) return op_array( arr_shape, List(arg0), NA, "pad", Pad.__call__, default_jvp, Pad.vjp ) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """Computes the vector-Jacobian product for the padding operation. Implements reverse-mode automatic differentiation for the padding operation. Args: primals: A list containing the primal input array and the target shape. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for padding is computed as the gradient of the output array sliced to the target shape. """ var slices = array_shape_to_slices(out.array_shape().args()[2]) return List(array_slice(grad, slices)) @staticmethod fn padded_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after padding. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to pad, the target ArrayShape. """ var target_shape = args[1] curr.setup(target_shape.shape()) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """Performs the forward pass for padding an array to a target shape. Pads the input array to the target shape and stores the result in the current array. Initializes the current array if not already set up. Args: curr: The current array to store the result (modified in-place). args: A list containing the input array and the target shape. #### Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the target shape and sets up the data accordingly. """ setup_shape_and_data(curr) var arg = args[0] var array_shape = curr.array_shape() var target_shape = array_shape.args()[1] curr.setup_array_shape(target_shape) var slices_in_target = array_shape_to_slices(array_shape.args()[2]) var sliced_curr = array_slice(curr, slices_in_target) for i in range(len(target_shape.shape())): if arg.shape()[i] != sliced_curr.array_shape().shape()[i]: raise "Error in pad: target_shape and sliced_curr shape do not match" for i in range(arg.size()): sliced_curr.store(i, arg.load(i)) fn pad( arg0: Array, target_shape: ArrayShape, slices_in_target: List[Slice] ) raises -> Array: """Pads an array to a target shape. Pads the input array to the target shape by copying the input array to the target shape. The target shape must be larger than the input array shape. The slices in the target shape specify the region where the input array is copied. Args: arg0: The input array to be padded. target_shape: The target shape to pad the input array to. slices_in_target: A list of slices specifying the region in the target shape where the input array is copied. Returns: An array containing the input array padded to the target shape. #### Examples: ```python a = Array([[1, 2], [3, 4]]) target_shape = ArrayShape([2, 3]) slices_in_target = [Slice(0, 2), Slice(0, 2)] result = pad(a, target_shape, slices_in_target) print(result) ``` #### Note: This function supports: - Automatic differentiation (reverse mode only). - Complex valued arguments. """ return Pad.fwd(arg0, target_shape, slices_in_target) --- endia/functional/view_ops/permute_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import ( setup_array_shape, array_shape_to_list, list_to_array_shape, ) from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # Permute/Transpose/Swapaxes/Swapdims ####--------------------------------------------------------------------------------------------------------------------#### struct Permute(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Permutes the dimensions of an array shape given a list of axes. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to permute, and the list of axes to permute. #### Constraints: - The number of axes in the list must not exceed the number of dimensions of the ArrayShape. """ var arg = args[0] var axis = array_shape_to_list(args[1]) var perm_axis = List[Int]() var ndim = arg.shape_node[].ndim if len(axis) > ndim: raise "Error: Number of axes in the list exceeds the number of dimensions of the ArrayShape" for i in range(ndim): perm_axis.append(i) for i in range(len(axis)): var a = axis[i] if a < 0: a = ndim + a perm_axis[(ndim - len(axis)) + i] = a var shape = arg.shape_node[].shape var stride = arg.shape_node[].stride var storage_offset = arg.shape_node[].storage_offset var new_shape = List[Int]() var new_stride = List[Int]() for i in range(len(perm_axis)): new_shape.append(shape[perm_axis[i]]) new_stride.append(stride[perm_axis[i]]) curr.setup(new_shape, new_stride, storage_offset) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Permutes the input array based on the given axis and stores the result in the current array (curr). The first agument is set as the base of the current array. Args: curr: The current array, must be mutable. args: The input array and the axis to permute. Constraints: The axis must be a valid permutation of the input array's dimensions. """ var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Compute vector-Jacobian product for array permutation. Args: primals: Primal input arrays. grad: Gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: List[Array]: Gradients with respect to each input. #### Note: Implements reverse-mode automatic differentiation for permutation. Returns arrays with shape zero for inputs that do not require gradients. #### See Also: permute_jvp: Forward-mode autodiff for permutation. """ var axis = out.array_shape().args()[1] return List(permute_inv(grad, axis)) @staticmethod fn fwd(arg0: Array, axis: ArrayShape) raises -> Array: """ Creates a view of the input array with its dimensions permuted based on the given axis. Args: arg0: The input array. axis: The axis to permute. Returns: A view of the input array with its dimensions permuted. """ var arr_shape = setup_array_shape( List(arg0.array_shape(), axis), "permute", Permute.compute_shape, ) var curr = op_array( arr_shape, List(arg0), NA, "permute", Permute.__call__, Permute.jvp, Permute.vjp, True, ) curr.base_(arg0.base()) return curr fn permute(arg0: Array, axis: ArrayShape) raises -> Array: """ Creates a view of the input array with its dimensions permuted based on the given axis. Args: arg0: The input array. axis: The axis to permute. Returns: A view of the input array with its dimensions permuted. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = permute(a, axis=List(-1,-2)) print(result) ``` #### This function supports - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return Permute.fwd(arg0, axis) fn transpose(arg0: Array, axis1: Int, axis2: Int) raises -> Array: """ Transposes the input array based on the given axes. Args: arg0: The input array. axis1: The first axis to transpose. axis2: The second axis to transpose. Returns: The transposed array. #### Note: This function is a wrapper around the permute function with the given axes. """ var ndim = arg0.ndim() var axis = List[Int]() for i in range(ndim): if i == axis1: axis.append(axis2) elif i == axis2: axis.append(axis1) else: axis.append(i) return permute(arg0, axis) fn swapaxes(arg0: Array, axis1: Int, axis2: Int) raises -> Array: """ Swaps the input array's axes based on the given axes. Args: arg0: The input array. axis1: The first axis to swap. axis2: The second axis to swap. Returns: The array with the axes swapped. #### Note: This function is a wrapper around the transpose function with the given axes. """ return transpose(arg0, axis1, axis2) fn swapdims(arg0: Array, axis1: Int, axis2: Int) raises -> Array: """ Swaps the input array's dimensions based on the given axes. Args: arg0: The input array. axis1: The first axis to swap. axis2: The second axis to swap. Returns: The array with the dimensions swapped. #### Note: This function is a wrapper around the transpose function with the given axes. """ return swapaxes(arg0, axis1, axis2) ####--------------------------------------------------------------------------------------------------------------------#### # Inverse Permute ####--------------------------------------------------------------------------------------------------------------------#### struct InvPermute(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Permutes the dimensions of an array shape given a list of axes, in an inverse manner to the permute_shape function. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to permute, and the list of axes to permute. #### Constraints: - The number of axes in the list must not exceed the number of dimensions of the ArrayShape. """ var arg = args[0] var axis = array_shape_to_list(args[1]) var perm_axis = List[Int]() var ndim = arg.shape_node[].ndim if len(axis) > ndim: raise "Error: Number of axes in the list exceeds the number of dimensions of the ArrayShape" for i in range(ndim): perm_axis.append(i) for i in range(len(axis)): var a = axis[i] if a < 0: a = ndim + a perm_axis[a] = (ndim - len(axis)) + i var shape = arg.shape_node[].shape var stride = arg.shape_node[].stride var storage_offset = arg.shape_node[].storage_offset var new_shape = List[Int]() var new_stride = List[Int]() for i in range(len(perm_axis)): new_shape.append(shape[perm_axis[i]]) new_stride.append(stride[perm_axis[i]]) curr.setup(new_shape, new_stride, storage_offset) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Permutes the input array based on the given axis and stores the result in the current array (curr). The first agument is set as the base of the current array. Args: curr: The current array, must be mutable. args: The input array and the axis to permute. Constraints: The axis must be a valid permutation of the input array's dimensions. """ curr.base_(args[0].base()) var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Compute vector-Jacobian product for array permutation. Args: primals: Primal input arrays. grad: Gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: List[Array]: Gradients with respect to each input. #### Note: Implements reverse-mode automatic differentiation for permutation. Returns arrays with shape zero for inputs that do not require gradients. #### See Also: permute_inv_jvp: Forward-mode autodiff for permutation. """ var axis = out.array_shape().args()[1] return List(permute(grad, axis)) @staticmethod fn fwd(arg0: Array, axis: ArrayShape) raises -> Array: """ Creates a view of the input array with its dimensions permuted based on the given axis. Args: arg0: The input array. axis: The axis to permute. Returns: A view of the input array with its dimensions permuted. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = permute_inv(a, axis=List(-1,-2)) print(result) ``` #### This function supports - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ var arr_shape = setup_array_shape( List(arg0.array_shape(), axis), "permute_inv", InvPermute.compute_shape, ) return op_array( arr_shape, List(arg0), NA, "permute_inv", InvPermute.__call__, InvPermute.jvp, InvPermute.vjp, True, ) fn permute_inv(arg0: Array, axis: ArrayShape) raises -> Array: """ Creates a view of the input array with its dimensions permuted based on the given axis. Args: arg0: The input array. axis: The axis to permute. Returns: A view of the input array with its dimensions permuted. #### Examples: ```python a = Array([[1, 2], [3, 4]]) result = permute_inv(a, axis=List(-1,-2)) print(result) ``` #### This function supports - Automatic differentiation (forward and reverse modes). - Complex valued arguments. """ return InvPermute.fwd(arg0, axis) --- endia/functional/view_ops/readme.md --- # View Operations View operations are operations that allow you to view the contents of a tensor. They do not change the underlying memory of the Array, but instead provide a different view on it. This can be useful for reshaping a tensor, or for extracting a subset of the tensor. --- endia/functional/view_ops/real_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # Real ####--------------------------------------------------------------------------------------------------------------------#### struct Real(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of the real part of a complex array. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to compute the real part of. """ # liek the slice method however we only take the real part of the array var arg = args[0] var shape = arg.shape_node[].shape var stride = arg.shape_node[].stride var storage_offset = arg.shape_node[].storage_offset var new_shape = List[Int]() var new_stride = List[Int]() for i in range(len(shape)): new_shape.append(shape[i]) new_stride.append(stride[i] * 2) curr.setup(new_shape, new_stride, storage_offset) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the real operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the real view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: if primals[0].is_complex(): return complex(grad, Array(grad.shape())) return grad @staticmethod fn fwd(arg0: Array) raises -> Array: """ Creates a view of the input array as a real array. Args: arg0: The input array. Returns: A view of the input array as a real array. #### Note: This function is non-differentiable. """ var arr_shape = setup_array_shape( List(arg0.array_shape()), "real_shape", # real_shape, Real.compute_shape, ) var res = op_array( arr_shape, List(arg0), NA, "real", Real.__call__, Real.jvp, Real.vjp, True, ) res.is_complex_(False) res.base_(arg0.base()) return res fn real(arg0: Array) raises -> Array: """ Computes the real part of the input array element-wise. Args: arg0: The input array. Returns: The real part of the input array. """ if not arg0.is_complex(): return arg0 return Real.fwd(arg0) --- endia/functional/view_ops/squeeze_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape, array_shape_to_list from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp from endia.functional import unsqueeze ####--------------------------------------------------------------------------------------------------------------------#### # Squeeze ####--------------------------------------------------------------------------------------------------------------------#### struct Squeeze(DifferentiableViewOp): @staticmethod fn squeezable_axis(inout curr: ArrayShape, args: List[ArrayShape]) raises: var arg = args[0] var shape = arg.shape_node[].shape var new_shape = List[Int]() for i in range(len(shape)): if shape[i] == 1: new_shape.append(i) if len(shape) == len(new_shape): _ = new_shape.pop() curr.setup(new_shape) @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after squeezing. This removes all dimensions of size 1. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to squeeze. """ var arg = args[0] var _axis = ArrayShape(0) Squeeze.squeezable_axis(_axis, List(arg)) var axis = array_shape_to_list(_axis) var shape = arg.shape_node[].shape var stride = arg.shape_node[].stride var new_shape = List[Int]() var new_stride = List[Int]() for i in range(len(shape)): if not list_contains(axis, i): new_shape.append(shape[i]) new_stride.append(stride[i]) curr.setup(new_shape, new_stride, arg.storage_offset()) curr.args_(List(arg, _axis)) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the squeeze operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the squeeze view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Computes the vector-Jacobian product for the squeeze operation. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for squeeze is computed by unsqueezing the gradient along the axes that were squeezed. """ var squeezable_axis = out.array_shape().args()[1] return unsqueeze(grad, squeezable_axis) @staticmethod fn fwd(arg0: Array) raises -> Array: """ Squeezes the input array by removing axes of length 1. Args: arg0: The input array. Returns: The squeezed array. """ var arr_shape = setup_array_shape( List(arg0.array_shape()), "squeeze", Squeeze.compute_shape, ) var curr = op_array( arr_shape, List(arg0), NA, "squeeze", Squeeze.__call__, Squeeze.jvp, Squeeze.vjp, True, ) curr.base_(arg0.base()) return curr fn squeeze(arg0: Array) raises -> Array: """ Squeezes the input array by removing axes of length 1. Args: arg0: The input array. Returns: The squeezed array. """ return Squeeze.fwd(arg0) --- endia/functional/view_ops/unsqueeze_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape, array_shape_to_list from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp from endia.functional import squeeze ####--------------------------------------------------------------------------------------------------------------------#### # Unsqueeze ####--------------------------------------------------------------------------------------------------------------------#### struct Unsqueeze(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after unsqueezing. This adds dimensions of size 1 along the specified axes. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to unsqueeze, and the axes to unsqueeze along encoded in an ArrayShape. """ var arg = args[0] var axis = array_shape_to_list(args[1]) var shape = arg.shape_node[].shape var stride = arg.shape_node[].stride var new_stride = List[Int]() var new_shape = List[Int]() if len(axis) == 0: for i in range(len(shape)): new_shape.append(shape[i]) new_stride.append(stride[i]) else: for _ in range(axis[len(axis) - 1] + 1): new_shape.append(-1) new_stride.append(-1) for x in axis: new_shape[x[]] = 1 new_stride[x[]] = -1 var shape_idx = 0 for i in range(len(new_shape)): if new_shape[i] == -1: new_shape[i] = shape[shape_idx] new_stride[i] = stride[shape_idx] shape_idx += 1 for i in range(shape_idx, len(shape)): new_shape.append(shape[i]) new_stride.append(stride[i]) for i in range(len(new_stride) - 2, -1, -1): if new_stride[i] == -1: new_stride[i] = new_stride[i + 1] curr.setup(new_shape, new_stride, arg.storage_offset()) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the unsqueeze operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the unsqueeze view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Computes the vector-Jacobian product for the unsqueeze operation. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass (unused in this function). Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for unsqueeze is computed by squeezing the gradient. """ return List(squeeze(grad)) @staticmethod fn fwd(arg0: Array, axis: ArrayShape) raises -> Array: """ Unsqueezes the input array by adding axes of length 1. Args: arg0: The input array. axis: The axis to unsqueeze. Returns: The unsqueezed array. """ var arr_shape = setup_array_shape( List(arg0.array_shape(), axis), "unsqueeze", Unsqueeze.compute_shape, ) var curr = op_array( arr_shape, List(arg0), NA, "unsqueeze", Unsqueeze.__call__, Unsqueeze.jvp, Unsqueeze.vjp, True, ) curr.base_(arg0.base()) return curr fn unsqueeze(arg0: Array, axis: ArrayShape) raises -> Array: """ Unsqueezes the input array by adding axes of length 1. Args: arg0: The input array. axis: The axis to unsqueeze. Returns: The unsqueezed array. """ return Unsqueeze.fwd(arg0, axis) --- endia/functional/view_ops/view_as_imag_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # View as Imaginary ####--------------------------------------------------------------------------------------------------------------------#### struct ViewAsImag(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after viewing it as the imaginary part of a complex array. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to view as the imaginary part. """ # this simpyl creates a slice shape which merely has a ge_zero size of 2 in the last dimension var arg = args[0] var shape = arg.shape_node[].shape var stride = arg.shape_node[].stride var storage_offset = arg.shape_node[].storage_offset + stride[ len(stride) - 1 ] var new_shape = List[Int]() var new_stride = List[Int]() for i in range(len(shape) - 1): new_shape.append(shape[i]) new_stride.append(stride[i]) new_shape.append(shape[len(shape) - 1] // 2) new_stride.append(stride[len(stride) - 1] * 2) curr.setup(new_shape, new_stride, storage_offset) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the view_as_imag operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the view_as_imag view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn fwd(arg0: Array) raises -> Array: """ Creates a view of the input array as an imaginary array. Args: arg0: The input array. Returns: A view of the input array as an imaginary array. #### Note: This function is non-differentiable. """ var arr_shape = setup_array_shape( List(arg0.array_shape()), "view_as_imag_shape", ViewAsImag.compute_shape, ) var curr = op_array( arr_shape, List(arg0), NA, "view_as_imag", ViewAsImag.__call__, ViewAsImag.jvp, ViewAsImag.vjp, True, ) curr.base_(arg0.base()) return curr @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) fn view_as_imag(arg0: Array) raises -> Array: """ Creates a view of the input array as an imaginary array. Args: arg0: The input array. Returns: A view of the input array as an imaginary array. #### Note: This function is non-differentiable. """ return ViewAsImag.fwd(arg0) --- endia/functional/view_ops/view_as_real_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # View as Real ####--------------------------------------------------------------------------------------------------------------------#### struct ViewAsReal(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after viewing it as the real part of a complex array. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to view as the real part. """ # this simpyl creates a slice shape which merely has a ge_zero size of 2 in the last dimension var arg = args[0] var shape = arg.shape_node[].shape var stride = arg.shape_node[].stride var storage_offset = arg.shape_node[].storage_offset var new_shape = List[Int]() var new_stride = List[Int]() for i in range(len(shape) - 1): new_shape.append(shape[i]) new_stride.append(stride[i]) new_shape.append(shape[len(shape) - 1] // 2) new_stride.append(stride[len(stride) - 1] * 2) curr.setup(new_shape, new_stride, storage_offset) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the view_as_real operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the view_as_real view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. """ var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: return default_vjp(primals, grad, out) @staticmethod fn fwd(arg0: Array) raises -> Array: """ Creates a view of the input array as a real array. Args: arg0: The input array. Returns: A view of the input array as a real array. """ var arr_shape = setup_array_shape( List(arg0.array_shape()), "view_as_real_shape", # view_as_real_shape, ViewAsReal.compute_shape, ) var curr = op_array( arr_shape, List(arg0), NA, "view_as_real", ViewAsReal.__call__, ViewAsReal.jvp, ViewAsReal.vjp, True, ) curr.base_(arg0.base()) return curr fn view_as_real(arg0: Array) raises -> Array: """ Creates a view of the input array as the real part of a complex array. Args: arg0: The input array. Returns: A view of the input array as the real part of a complex array. """ return ViewAsReal.fwd(arg0) --- endia/functional/view_ops/view_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.utils import setup_array_shape from endia.utils.aliases import dtype, nelts, NA from algorithm import vectorize, parallelize import math from endia.functional._utils import contiguous from endia.functional._utils import ( op_array, setup_shape_and_data, ) from ._utils import DifferentiableViewOp ####--------------------------------------------------------------------------------------------------------------------#### # Reshape ####--------------------------------------------------------------------------------------------------------------------#### struct Reshape(DifferentiableViewOp): @staticmethod fn compute_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape of an array after reshaping. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to reshape, and the shape, stride and storage offset of the target ArrayShape encoded in a single ArrayShape. """ # liek the slice method however we only take the real part of the array var arg = args[1] if arg.ndim() == 1 and arg.shape()[0] == -1: curr.setup(args[0].size()) else: curr.setup(arg.shape(), arg.stride(), arg.storage_offset()) @staticmethod fn __call__(inout curr: Array, args: List[Array]) raises: """ Performs the forward pass for the reshape operation. It sets the base of the argument to be the base of the current array and computes the shape of the current array via its dedicated ArraySahpe fwd fucntion. Args: curr: The current array to store the result (modified in-place). args: The array on which the reshape view is created. #### Note: The information of the shape computation is stored in the ArrayShape object of the curr array. #### Constraints: - The number of elements in the input array must be equal to the number of elements in the target shape. """ # var contiguous_arg = contiguous(args[0]) # curr.base_(contiguous_arg.base()) var array_shape = curr.array_shape() compute_shape(array_shape, curr.requires_grad() or curr.has_fxgraph()) if curr.size() != args[0].size(): raise "The number of elements in the input array must be equal to the number of elements in the target shape." @staticmethod fn jvp(primals: List[Array], tangents: List[Array]) raises -> Array: return default_jvp(primals, tangents) @staticmethod fn vjp(primals: List[Array], grad: Array, out: Array) raises -> List[Array]: """ Computes the vector-Jacobian product for the reshape operation. Args: primals: A list containing the primal input array. grad: The gradient of the output with respect to some scalar function. out: The output of the forward pass. Returns: A list containing the gradient with respect to the input. #### Note: The vector-Jacobian product for reshape is computed by calling the reshape operation. """ var primal_shape = primals[0].shape() return reshape(grad, primal_shape) @staticmethod fn fwd(arg0: Array, shape: List[Int]) raises -> Array: """ Creates a view of the input array with the given shape. Args: arg0: The input array. shape: The target shape. Returns: The reshaped array. #### Constraints: - The number of elements in the input array must be equal to the number of elements in the target shape. """ var arr_shape = setup_array_shape( List(arg0.array_shape(), ArrayShape(shape)), "reshape_shape", Reshape.compute_shape, ) var curr = op_array( arr_shape, List(arg0), NA, "reshape", Reshape.__call__, Reshape.jvp, Reshape.vjp, True, ) curr.base_(arg0.base()) return curr fn reshape(arg0: Array, shape: List[Int]) raises -> Array: """ Creates a view of the input array with the given shape. Args: arg0: The input array. shape: The target shape. Returns: The reshaped array. #### Constraints: - The number of elements in the input array must be equal to the number of elements in the target shape. """ return Reshape.fwd(arg0, shape) fn view(arg0: Array, shape: List[Int]) raises -> Array: """ Creates a view of the input array with the given shape. Args: arg0: The input array. shape: The target shape. Returns: The reshaped array. #### Constraints: - The number of elements in the input array must be equal to the number of elements in the target shape. #### Note: This function is a wrapper around the reshape function. """ return reshape(arg0, shape) fn flatten(arg0: Array) raises -> Array: """ Flattens the input array. Args: arg0: The input array. Returns: The flattened array. #### Note: This function is a wrapper around the reshape function. """ return reshape(arg0, List(-1)) --- endia/linalg/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # --- endia/linalg/readme.md --- # Linear Algebra --- endia/nn/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .models import * from .modules import * --- endia/nn/models/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # --- endia/nn/modules/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from ._mlp import * --- endia/nn/modules/_mlp.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd struct MLP(StringableRaising): var weights: List[nd.Array] var biases: List[nd.Array] var hidden_dims: List[Int] var num_layers: Int var compute_backward: Bool fn __init__( inout self, hidden_dims: List[Int], compute_backward: Bool = False ) raises: self.weights = List[nd.Array]() self.biases = List[nd.Array]() self.hidden_dims = hidden_dims self.num_layers = len(hidden_dims) - 1 self.compute_backward = compute_backward for i in range(self.num_layers): var weight = nd.rand_he_normal( List(hidden_dims[i], hidden_dims[i + 1]), fan_in=hidden_dims[i], requires_grad=compute_backward, ) var bias = nd.rand_he_normal( List(hidden_dims[i + 1]), fan_in=hidden_dims[i], requires_grad=compute_backward, ) self.weights.append(weight) self.biases.append(bias) fn forward(self, x: nd.Array) raises -> nd.Array: var pred = x for i in range(self.num_layers): pred = pred @ self.weights[i] + self.biases[i] if i < self.num_layers - 1: pred = nd.relu(pred) return pred fn params(self) raises -> List[nd.Array]: var params = List[nd.Array]() for i in range(self.num_layers): params.append(self.weights[i]) params.append(self.biases[i]) return params fn __str__(self) raises -> String: var out = String("") for i in range(self.num_layers): out += "Layer " + String(i) + "\n" out += self.weights[i].__str__() + "\n" out += self.biases[i].__str__() + "\n" return out fn mlp(args: List[nd.Array]) raises -> nd.Array: var pred = args[0] var num_layers = (len(args) - 2) // 2 for i in range(num_layers): var weight = args[i * 2 + 2] var bias = args[i * 2 + 3] pred = pred @ weight + bias if i < num_layers - 1: pred = nd.relu(pred) # print("\n\nLayer ", i,":") # print(str(pred)) return pred --- endia/nn/readme.md --- # Neural Network Modules and Models --- endia/numpy/__init__.mojo --- from endia.functional import * from endia import Array as ndarray --- endia/optim/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .sgd import * from .adam import * from .adagrad import * from .rmsprop import * --- endia/optim/adagrad.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd struct Adagrad: var params: List[nd.Array] var lr: SIMD[dtype, 1] var eps: SIMD[dtype, 1] var cache: List[nd.Array] fn __init__( inout self, params: List[nd.Array], lr: SIMD[dtype, 1] = 0.01, eps: SIMD[dtype, 1] = 1e-8, ) raises: self.params = params self.lr = lr self.eps = eps self.cache = List[nd.Array]() for i in range(len(params)): self.cache.append(nd.Array(params[i].shape())) fn step(inout self) raises: for i in range(len(self.params)): self.cache[i] += self.params[i].grad() * self.params[i].grad() self.cache[i].clear_args() self.params[i] -= ( self.lr * self.params[i].grad() / (nd.sqrt(self.cache[i]) + self.eps) ) self.params[i].clear_args() --- endia/optim/adam.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd struct Adam: var params: List[nd.Array] var lr: SIMD[dtype, 1] var beta1: SIMD[dtype, 1] var beta2: SIMD[dtype, 1] var eps: SIMD[dtype, 1] var t: SIMD[dtype, 1] var m: List[nd.Array] var v: List[nd.Array] fn __init__( inout self, params: List[nd.Array], lr: SIMD[dtype, 1] = 0.001, beta1: SIMD[dtype, 1] = 0.9, beta2: SIMD[dtype, 1] = 0.999, eps: SIMD[dtype, 1] = 1e-8, ) raises: self.params = params self.lr = lr self.beta1 = beta1 self.beta2 = beta2 self.eps = eps self.t = SIMD[dtype, 1](1) self.m = List[nd.Array]() self.v = List[nd.Array]() for i in range(len(params)): self.m.append(nd.Array(params[i].shape())) self.v.append(nd.Array(params[i].shape())) fn step(inout self) raises: for i in range(len(self.params)): self.m[i] = ( self.beta1 * self.m[i] + (1 - self.beta1) * self.params[i].grad() ) self.m[i].clear_args() self.v[i] = ( self.beta2 * self.v[i] + (1 - self.beta2) * self.params[i].grad() * self.params[i].grad() ) self.v[i].clear_args() var m_hat = self.m[i] / (1 - self.beta1**self.t) var v_hat = self.v[i] / (1 - self.beta2**self.t) self.params[i] -= self.lr * m_hat / (nd.sqrt(v_hat) + self.eps) self.params[i].clear_args() self.t += 1 --- endia/optim/readme.md --- # Optimizers --- endia/optim/rmsprop.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd struct RMSprop: var params: List[nd.Array] var lr: SIMD[dtype, 1] var alpha: SIMD[dtype, 1] var eps: SIMD[dtype, 1] var cache: List[nd.Array] fn __init__( inout self, params: List[nd.Array], lr: SIMD[dtype, 1] = 0.01, alpha: SIMD[dtype, 1] = 0.99, eps: SIMD[dtype, 1] = 1e-8, ) raises: self.params = params self.lr = lr self.alpha = alpha self.eps = eps self.cache = List[nd.Array]() for i in range(len(params)): self.cache.append(nd.Array(params[i].shape())) fn step(inout self) raises: for i in range(len(self.params)): self.cache[i] = ( self.alpha * self.cache[i] + (1 - self.alpha) * self.params[i].grad() * self.params[i].grad() ) self.cache[i].clear_args() self.params[i] -= ( self.lr * self.params[i].grad() / (nd.sqrt(self.cache[i]) + self.eps) ) self.params[i].clear_args() --- endia/optim/sgd.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd struct SGD: var params: List[nd.Array] var lr: SIMD[dtype, 1] var momentum: SIMD[dtype, 1] var weight_decay: SIMD[dtype, 1] var velocity: List[nd.Array] fn __init__( inout self, params: List[nd.Array], lr: SIMD[dtype, 1] = 0.01, momentum: SIMD[dtype, 1] = 0, weight_decay: SIMD[dtype, 1] = 0, ) raises: self.params = params self.lr = lr self.momentum = momentum self.weight_decay = weight_decay self.velocity = List[nd.Array]() if momentum > 0: for i in range(len(params)): self.velocity.append(nd.Array(params[i].shape())) fn step(inout self) raises: for i in range(len(self.params)): if self.momentum > 0 and self.weight_decay > 0: self.velocity[i] = self.momentum * self.velocity[ i ] - self.lr * ( self.params[i].grad() + self.weight_decay * self.params[i] ) self.velocity[i].clear_args() self.params[i] += self.velocity[i] elif self.momentum == 0 and self.weight_decay > 0: self.params[i] -= self.lr * ( self.params[i].grad() + self.weight_decay * self.params[i] ) elif self.momentum > 0 and self.weight_decay == 0: self.velocity[i] = ( self.momentum * self.velocity[i] - self.lr * self.params[i].grad() ) self.velocity[i].clear_args() self.params[i] += self.velocity[i] else: self.params[i] -= self.lr * self.params[i].grad() self.params[i].clear_args() --- endia/readme.md --- # The Endia Core Library The Endia Core Library is a collection of functions that are used to perform mathematical operations on Arrays. The functions defined here are small building blocks that can be combined to create more complex operations. Almost all them are differentiable (forward and reverse mode autodiff) and also work on complex valued arrays. --- endia/utils/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from ._array_shape import * from ._string_utils import * from .aliases import dtype, nelts, NA from .general import * from .array_conversions import * from ._viz import * --- endia/utils/_array_shape.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from memory.arc import Arc from algorithm import vectorize, parallelize # from utils import Variant from time import now from random import seed, random_ui64 import math from python import Python fn compute_stride(shape: List[Int]) -> List[Int]: var stride = List[Int]() for _ in range(len(shape)): stride.append(1) for i in range(len(shape) - 2, -1, -1): stride[i] = stride[i + 1] * shape[i + 1] return stride ############################################################################################################### # Array Shape ############################################################################################################### fn default_shape_op_fwd( inout curr: ArrayShape, args: List[ArrayShape] ) raises -> None: # print("default_shape_op_fwd") pass @value struct ShapeNode(CollectionElement): """ ShapeNode is a reference-counted object designed to encapsulate the shape information of an array. It stores crucial details such as the list of dimensions (shape), ge_zero sizes along each dimension (stride), the starting index (storage_offset), and other shape-related metadata. ShapeNode plays a crucial role in facilitating efficient shape computations, particularly for view operations where the shape needs to be computed without accessing the actual data. """ var shape: List[Int] var stride: List[Int] var storage_offset: Int var ndim: Int var size: Int var args: List[Arc[Self]] var shape_op_fwd: fn (inout ArrayShape, List[ArrayShape]) raises -> None var is_computed: Bool var name: String fn __init__( inout self, shape: List[Int], stride: List[Int], storage_offset: Int ): self.shape = shape self.stride = stride self.storage_offset = storage_offset self.ndim = len(shape) self.size = 1 for i in range(len(shape)): self.size *= shape[i] self.args = List[Arc[Self]]() self.shape_op_fwd = default_shape_op_fwd self.is_computed = False self.name = "" # print("creating ShapeNode") # fn __del__(owned self): # print("deleting ShapeNode") @value struct ArrayShape(CollectionElement, Stringable, EqualityComparable): """ ArrayShape is a lightweight handle that provides an efficient way to work with and manage array shapes. It serves as a convenient wrapper around a ShapeNode instance, allowing for inexpensive copying of shapes without duplicating the underlying shape data. ArrayShape offers initialization methods to create instances from shape lists and stride. """ var shape_node: Arc[ShapeNode] fn __init__( inout self, shape: List[Int], stride: List[Int] = List[Int](), storage_offset: Int = 0, ): var _stride = stride if len(stride) != len(shape): _stride = List[Int]() for _ in range(len(shape)): _stride.append(1) for i in range(len(shape) - 2, -1, -1): _stride[i] = shape[i + 1] * _stride[i + 1] self.shape_node = Arc[ShapeNode]( ShapeNode( shape, _stride, storage_offset, ) ) fn __init__(inout self, shape_node: Arc[ShapeNode]): self.shape_node = shape_node fn __copyinit__(inout self, other: ArrayShape): self.shape_node = other.shape_node fn __moveinit__(inout self, owned other: ArrayShape): self.shape_node = other.shape_node^ fn __str__(self) -> String: var storage_offset: String = "" fn list_to_string(list: List[Int]) -> String: var out: String = "" out += "[" for i in range(len(list)): out += str(list[i]) if i < len(list) - 1: out += ", " out += "]" return out var out: String = "" out += ( storage_offset + "shape: " + list_to_string(self.shape_node[].shape) + "\n" ) out += ( storage_offset + "stride: " + list_to_string(self.shape_node[].stride) + "\n" ) out += ( storage_offset + "storage_offset: " + str(self.shape_node[].storage_offset) + "\n" ) return out fn fwd( self, ) -> fn (inout ArrayShape, List[ArrayShape]) raises -> None: return self.shape_node[].shape_op_fwd fn set_fwd( inout self, fwd: fn (inout ArrayShape, List[ArrayShape]) raises -> None, ): self.shape_node[].shape_op_fwd = fwd fn execute_fwd(inout self, args: List[ArrayShape]) raises: self.shape_node[].shape_op_fwd(self, args) fn args_(inout self, args: List[ArrayShape]): self.shape_node[].args.clear() for arg in args: self.shape_node[].args.append(arg[].shape_node) fn args(self) -> List[ArrayShape]: var res = List[ArrayShape]() for arg in self.shape_node[].args: res.append(ArrayShape(arg[])) return res fn set_shape(inout self, shape: List[Int]): self.shape_node[].shape = shape fn shape(self) -> List[Int]: return self.shape_node[].shape fn set_stride(inout self, stride: List[Int]): self.shape_node[].stride = stride fn stride(self) -> List[Int]: return self.shape_node[].stride fn set_storage_offset(inout self, storage_offset: Int): self.shape_node[].storage_offset = storage_offset fn storage_offset(self) -> Int: return self.shape_node[].storage_offset fn set_ndim(inout self, ndim: Int): self.shape_node[].ndim = ndim fn ndim(self) -> Int: return self.shape_node[].ndim fn set_size(inout self, size: Int): self.shape_node[].size = size fn size(self) -> Int: return self.shape_node[].size # fn kwargs_(inout self, kwargs: List[Int]): # self.shape_node[].kwargs = kwargs # fn kwargs(self) -> List[Int]: # return self.shape_node[].kwargs fn is_computed(self) -> Bool: return self.shape_node[].is_computed fn is_computed_(inout self, is_computed: Bool): self.shape_node[].is_computed = is_computed fn setup( inout self, shape: List[Int], stride: List[Int] = List[Int](), storage_offset: Int = 0, ) raises: var _stride = compute_stride(shape) if len(stride) == 0 else stride var size = 1 for i in range(len(shape)): size *= shape[i] self.set_shape(shape) self.set_stride(_stride) self.set_storage_offset(storage_offset) self.set_ndim(len(shape)) self.set_size(size) fn __eq__(self, other: ArrayShape) -> Bool: var equal = True for i in range(len(self.shape())): if self.shape()[i] != other.shape()[i]: equal = False break return equal fn __ne__(self, other: ArrayShape) -> Bool: return not self.__eq__(other) # recursive shape computation until all parents are computed fn compute_shape(inout curr: ArrayShape, store_args: Bool = False) raises: """ Recursively computes the shape of an ArrayShape. Args: curr: The ArrayShape to compute the shape of. store_args: Whether to store the arguments of the ArrayShape after computation, i.e. retaining the computation graph. Constraints: - The ArrayShape must have a forward function set. """ if curr.ndim() == -1: raise "Error: Placeholder Error in compute_shape." if curr.is_computed() or len(curr.args()) == 0: return # print("compute shape") for arg in curr.args(): compute_shape(arg[], store_args) var fwd = curr.fwd() fwd(curr, curr.args()) curr.is_computed_(True) if not store_args: curr.shape_node[].args.clear() fn setup_array_shape( args: List[ArrayShape], name: String, fwd: fn (inout ArrayShape, List[ArrayShape]) raises -> None, ) raises -> ArrayShape: """ Sets up an ArrayShape with the given arguments, name, and forward function. Does not compute the actual shape. Args: args: The arguments of the ArrayShape. name: The name of the ArrayShape. fwd: The forward function of the ArrayShape. Returns: The ArrayShape, with its actualy shape not computed yet. """ var res_arr = ArrayShape(0) res_arr.args_(args) res_arr.set_fwd(fwd) res_arr.shape_node[].name = name return res_arr fn array_shape_to_list(arg: ArrayShape) -> List[Int]: """ Converts an ArrayShape to a list of Ints. Does not retain the stride and storage offset information. """ return arg.shape() fn list_to_array_shape(arg: List[Int]) -> ArrayShape: """ Converts a list of Ints to an ArrayShape object. """ return ArrayShape(arg) fn array_shape_to_slices(arg: ArrayShape) raises -> List[Slice]: """ Converts an ArrayShape to a list of slices. Args: arg: The ArrayShape to convert. Returns: A list of slices. """ var data = arg.shape() var slices = List[Slice]() if len(data) % 3 != 0: raise "Invalid data for slices" for i in range(0, len(data), 3): slices.append(Slice(data[i], data[i + 1], data[i + 2])) return slices fn slices_to_array_shape(arg: List[Slice]) -> ArrayShape: """ Converts a list of slices to an ArrayShape. Args: arg: The list of slices to convert. Returns: The ArrayShape. """ var data = List[Int]() for i in range(len(arg)): data.append(arg[i].start) data.append(arg[i].end) data.append(arg[i].step) return ArrayShape(data) fn copy_shape(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Setups the shape of an array to be the same as another ArrayShape. Args: curr: The ArrayShape to store the result of the computation. args: The ArrayShape to copy. """ curr.setup(args[0].shape()) fn broadcast_shapes(inout curr: ArrayShape, args: List[ArrayShape]) raises: """ Computes the shape resulting from broadcasting two arrays together. Args: curr: The ArrayShape to store the result of the computation. args: Lhs ArrayShape, rhs ArrayShape, axes to ignore during broadcasting. #### Constraints: - The shape of each dimension of args[0] and args[1] must be equal or one of them must be 1 (seen from right to left). """ var arg0 = args[0] var arg1 = args[1] var shape0 = arg0.shape_node[].shape var shape1 = arg1.shape_node[].shape var shape = List[Int]() var diff = len(shape0) - len(shape1) if diff > 0: # shape0 has more dimensions for i in range(diff): shape.append(shape0[i]) for i in range(len(shape1)): if shape0[i + diff] == shape1[i]: shape.append(shape0[i + diff]) elif shape0[i + diff] == 1: shape.append(shape1[i]) elif shape1[i] == 1: shape.append(shape0[i + diff]) else: raise "Error: Incompatible shapes for broadcasting" else: # shape1 has more dimensions for i in range(-diff): shape.append(shape1[i]) for i in range(len(shape0)): if shape1[i - diff] == shape0[i]: shape.append(shape1[i - diff]) elif shape1[i - diff] == 1: shape.append(shape0[i]) elif shape0[i] == 1: shape.append(shape1[i - diff]) else: raise "Error: Incompatible shapes for broadcasting" curr.setup(shape) fn clone_shape_during_runtime( inout curr: ArrayShape, args: List[ArrayShape] ) raises: """ This functions sets upt the curr array_shape to be the same as the arg array_shape. """ var arg = args[0] curr.setup(arg.shape(), arg.stride(), arg.storage_offset()) fn clone_shape(arg0: ArrayShape) raises -> ArrayShape: """ Clones the shape of an ArrayShape during runtime. Args: arg0: The ArrayShape to clone. Returns: The cloned ArrayShape. """ return setup_array_shape( List(arg0), "clone_shape", clone_shape_during_runtime ) --- endia/utils/_string_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from memory.arc import Arc from algorithm import vectorize, parallelize # from utils import Variant from time import now from random import seed, random_ui64 import math from python import Python from math import isnan, isinf fn float_to_string[dtype: DType](in_num: SIMD[dtype, 1]) -> String: if isinf(in_num): return "inf" if isnan(in_num): return "nan" if ( dtype == DType.uint32 or dtype == DType.uint64 or dtype == DType.int32 or dtype == DType.int64 ): return String(int(in_num)) # Determine the sign of the number var sign: String = "" var num = in_num if num < 0: sign = "-" num = -num var str_num = String(num) if num >= 100 and num < 999: if num % int(num) == 0: return sign + str_num[:4] return sign + str_num[: min(len(str_num), 8)] elif num >= 10 and num < 100: if num % int(num) == 0: return sign + str_num[:3] return sign + str_num[: min(len(str_num), 7)] elif num >= 1 and num < 10: if num % int(num) == 0: return sign + str_num[:2] return sign + str_num[: min(len(str_num), 6)] elif num >= 0.1 and num < 1: return sign + str_num[: min(len(str_num), 6)] elif num >= 0.01 and num < 0.1: return sign + str_num[: min(len(str_num), 6)] elif num >= 0.001 and num < 0.01: return sign + str_num[: min(len(str_num), 6)] else: return format_scientific(in_num) fn format_scientific[dtype: DType](in_num: SIMD[dtype, 1]) -> String: if in_num == 0: return "0." # Determine the sign of the number var sign: String = "" var num = in_num if num < 0: sign = "-" num = -num else: sign = "" # Find the exponent var exponent: Int = 0 while num >= 10 or (num != 0 and num < 1): if num >= 10: num /= 10 exponent += 1 else: num *= 10 exponent -= 1 var num_int = int(num * 10000) var result: String = "" result += sign result += String(num_int // 10000) result += "." # Append the decimal digits to the result string var decimal_digits = String(num_int % 10000) if len(decimal_digits) < 4: var padding = String("0") * (4 - len(decimal_digits)) decimal_digits = padding + decimal_digits result += decimal_digits[:3] result += "e" result += String(exponent) return result fn extract_array(s: String) raises -> Array: """ Extracts an array from a string. If is_complex is True, expression such as 1+2i or 1+2j are allowed.\n If is_complex is False, only the real parts are read in. """ var shape = List[Int]() var data = List[SIMD[dtype, 1]]() var iterator = -1 fn is_digit(char: String) -> Bool: var res = False if ( char == "0" or char == "1" or char == "2" or char == "3" or char == "4" or char == "5" or char == "6" or char == "7" or char == "8" or char == "9" ): res = True return res # infer shape of array by counting opening and closing brackets for i in range(len(s)): var char = s[i] if char == "[": iterator += 1 if shape.size <= iterator: shape.append(0) elif char == "]": if shape[iterator - 1] == 0 and iterator > 0: shape[iterator] += 1 iterator -= 1 # read in dim of last axis var i = 0 for i in range(len(s)): var char = s[i] if is_digit(char): var counter = 1 for j in range(i, len(s)): var digit = s[j] if digit == "]": break elif digit == ",": counter += 1 shape.append(counter) break # var is_complex = False # read in actual data as dtype i = 0 while i < len(s): var char = s[i] if is_digit(char): # var counter = 1 var digit: String = "" var start = i for j in range(start, len(s)): var c = s[j] if c == "]" or c == "[" or c == ",": break else: digit += c if c != " " else "" i += 1 # compute number in front of comma: var real: String = "" var imag: String = "" var is_imag = False for j in range(len(digit)): if digit[j] == "+" or digit[j] == "i" or digit[j] == "j": is_imag = True continue if is_imag: imag += digit[j] else: real += digit[j] var order = 0 for j in range(len(real)): if real[j] == ".": break order += 1 var number: SIMD[dtype, 1] = 0 for j in range(len(real)): if real[j] == ".": continue number += SIMD[dtype, 1](atol(real[j])) * SIMD[dtype, 1]( 10 ) ** (order - 1) order -= 1 data.append(number) i += 1 var new_shape = List[Int]() for i in range(1, shape.size): new_shape.append(shape[i]) var res = Array(new_shape) for i in range(res.size()): res.store(i, data[i]) return res fn build_out_string( arg: Array, inout out: String, inout idx: Int, dim: Int, indent: String ): """ Internal recursive function to build the out string for the __call__ function. """ var skip_threshold = 10 out += "[" var row_size = arg.node[].shape[].shape[dim] for i in range(row_size): if ( row_size > skip_threshold and i >= skip_threshold // 2 and i < row_size - skip_threshold // 2 ): if i == skip_threshold // 2: out += ( "...\n" + indent if dim < arg.node[].shape[].ndim - 1 else "..., " ) idx += ( arg.node[].shape[].shape[dim + 1] if dim < arg.node[].shape[].ndim - 1 else 1 ) continue if dim < arg.node[].shape[].ndim - 1: build_out_string(arg, out, idx, dim + 1, indent + " ") if i < row_size - 1: out += ",\n" + indent else: out += float_to_string(arg.load(idx)) if arg.is_complex(): out += " + " + float_to_string(arg.load_imag(idx)) + "j" idx += 1 if i < row_size - 1: out += ", " out += "]" --- endia/utils/_viz.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array import os from python import Python fn graph_to_json(args: List[Array]) raises -> String: for arg in args: var out = arg[] reset_node_id_recursive(out) var trace = List[Array]() for arg in args: var out = arg[] top_order_rec(out, trace) var json_str: String = "{" json_str += "\n" json_str += ' "nodes": [\n' for i in range(len(trace)): var curr = trace[i] json_str += " {\n" json_str += ' "type": ' + '"' + curr.name() + '",\n' json_str += ' "id": ' + str(curr.id()) + ",\n" json_str += ' "is_view": ' # str(curr.is_view()) + ",\n" if curr.is_view(): json_str += "1,\n" else: json_str += "0,\n" json_str += ' "shape": [' for j in range(len(curr.shape())): json_str += str(curr.shape()[j]) if j != len(curr.shape()) - 1: json_str += ", " json_str += "],\n" json_str += " " + '"args": [' for j in range(len(curr.args())): var arg = curr.args()[j] json_str += str(arg.id()) if j != len(curr.args()) - 1: json_str += ", " json_str += "],\n" json_str += ' "grad": ' if curr.has_grad(): json_str += str(curr.grad().id()) else: json_str += "null" json_str += "\n" json_str += " }" if i != len(trace) - 1: json_str += ", " json_str += "\n" json_str += " ]\n" json_str += "}" json_str += "\n" return json_str fn write_graph_to_json( arg: Array, filename: String = "computation_graph.json" ) raises: """ Write the computation graph of the given list of arrays to a json file. """ var file = open(filename, "w") file.write(graph_to_json(arg)) file.close() fn visualize_graph(arg: Array, filename: String = "computation_graph") raises: """ Visualize the computation graph of the given list of arrays using graphviz. """ var graphviz = Python.import_module("graphviz") var json = Python.import_module("json") var Digraph = graphviz.Digraph var graph_data = json.loads(graph_to_json(arg)) var dot = Digraph(comment=filename) dot.attr(rankdir="TB") # Set graph background to black dot.attr(bgcolor="white") # Change node attributes for better visibility on black background dot.attr( "node", shape="box", style="rounded,filled", roundedcorners="0.03", fontcolor="black", ) for node in graph_data["nodes"]: var node_color = "white" # Dark gray for standard nodes if len(node["args"]) == 0: node_color = "#b1d8fa" # Steel blue for input nodes elif node["is_view"] == 1: node_color = "#ffc2a3" # Dim gray for view nodes var attrs = " " + str(node["id"]) + ', "' + node["type"] + '", ' var shape = node["shape"] attrs += "(" for j in range(len(shape)): attrs += str(shape[j]) if j != len(shape) - 1: attrs += "," attrs += ") " dot.node(str(node["id"]), attrs, fillcolor=node_color) for arg in node["args"]: dot.edge(str(arg), str(node["id"]), color="black") # Add grad edge if exists if node["grad"] is not None: dot.edge( str(node["id"]), str(node["grad"]), color="#FF6347", # Tomato red for gradient edges style="dashed", constraint="false", ) # Use render method with cleanup=True to avoid intermediate files dot.render(filename, format="png", cleanup=True) --- endia/utils/aliases.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array alias dtype = DType.float32 fn nelts[dtype: DType]() -> Int: return simdwidthof[dtype]() * 2 alias NA = List[Array]() --- endia/utils/array_conversions.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from math import isnan, isinf from endia import Array from endia.functional import * @always_inline fn to_torch(arg: Array) raises -> PythonObject: """ Converts an endia Array to a torch tensor. """ if arg.is_complex(): # print("\narg:") # print(arg) var real = real(arg) var imag = imag(arg) # print("\nreal:") # print(real) # print("\nimag:") # print(imag) var torch = Python.import_module("torch") var torch_real = to_torch_tensor(real).requires_grad_( arg.requires_grad() ) var torch_imag = to_torch_tensor(imag).requires_grad_( arg.requires_grad() ) var res = torch.complex(torch_real, torch_imag) return res return to_torch_tensor(arg) @always_inline fn to_torch_tensor(arg: Array) raises -> PythonObject: var torch = Python.import_module("torch") var shape = arg.shape() var size = 1 for i in range(shape.size): size *= shape[i] var torch_shape = PythonObject([]) for i in range(arg.ndim()): torch_shape.append(shape[i]) var res = torch.zeros(size=torch_shape).to(torch.float64) var flattened = res.flatten() for i in range(size): flattened[i] = arg.load(i) if arg.requires_grad(): res.requires_grad = True return res @always_inline fn is_close_to_tensor( arr: Array, arr_torch: PythonObject, rtol: Float32 ) raises -> Bool: """ Asserts that the values in the endia Array and the torch tensor are equal. """ var shape = arr.shape() var size = 1 for i in range(shape.size): size *= shape[i] var flattened = arr_torch.flatten() var wrong_occurences: Int = 0 for i in range(size): var arr_val = arr.load(i) var torch_val = flattened[i].to_float64().cast[dtype]() if not isnan(arr_val) and not isinf(arr_val): var rel_diff = arr_val / torch_val if rel_diff < 1 - rtol or rel_diff > 1 + rtol: wrong_occurences += 1 # print( # "Incorrect value at index", # i, # " - endia_val =", # arr.load(i), # " - torch_val =", # flattened[i].to_float64().cast[dtype](), # ) if wrong_occurences > 0: # print("Warning: Number of wrong occurences: ", wrong_occurences, "out of", size, "total elements at relative tolerance", rtol, "!") print( "\n\033[33mWarning:\033[0m #wrong_elements / #total_elements =", wrong_occurences / size, "at relative tolerance", rtol, "!", ) print( "\033[33mDont't panic:\033[0m If the above relative number of wrong" " elements is very small (e.g. 1e-4), then you can ignore the test" " failure." ) return False return True @always_inline fn is_close( arr: Array, arr_torch: PythonObject, rtol: Float32 = 10e-4 ) raises -> Bool: """ Asserts that the values in the endia Array and the torch tensor are equal. """ if arr.is_complex(): var real = real(arr) var imag = imag(arr) var torch_real = arr_torch.real var torch_imag = arr_torch.imag return is_close_to_tensor( real, torch_real, rtol ) and is_close_to_tensor(imag, torch_imag, rtol) return is_close_to_tensor(arr, arr_torch, rtol) --- endia/utils/general.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import Array from endia.functional import * fn reset_node_id_recursive(inout curr: Array): for arg in curr.args(): if arg[].node[].id != -1: reset_node_id_recursive(arg[]) curr.id_(-1) fn top_order_rec(inout curr: Array, inout trace: List[Array]): for arg in curr.args(): if arg[].node[].id == -1: top_order_rec(arg[], trace) curr.id_(len(trace)) trace.append(curr) fn zero_grad_recursive(inout curr: Array): for arg in curr.args(): if arg[].id() == -1: zero_grad_recursive(arg[]) curr.id_(1) curr.remove_grad() fn zero_grad_rec(inout curr: Array): reset_node_id_recursive(curr) zero_grad_recursive(curr) reset_node_id_recursive(curr) fn remove_grad_recursive(inout curr: Array): for arg in curr.args(): if arg[].id() == -1: remove_grad_recursive(arg[]) curr.id_(1) curr.remove_grad() fn remove_grad_rec(inout curr: Array): reset_node_id_recursive(curr) remove_grad_recursive(curr) reset_node_id_recursive(curr) @value struct InplaceInfo: var type: Int var idx: Int var arg_id: Int fn __init__(inout self, type: Int, idx: Int, arg_id: Int = -1): self.type = type self.idx = idx self.arg_id = arg_id fn concat_lists(*lists: List[Int]) -> List[Int]: var res = List[Int]() for l in lists: for i in l[]: res.append(i[]) return res fn list_contains(list: List[Int], val: Int) -> Bool: """ Checks if a list fo Ints contains a specific value. Args: list: The list of Ints to check. val: The value to check for. Returns: True if the value is in the list, False otherwise. """ for i in range(len(list)): if list[i] == val: return True return False --- endia/utils/readme.md --- # Utility Functions --- examples/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .simple_examples import * from .viz_examples import * from .custom_ops_examples import * from .endia_vs_torch_vs_jax import * --- examples/custom_ops_examples/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .custom_mul import custom_mul --- examples/custom_ops_examples/custom_mul.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia.utils import op_array, setup_shape_and_data, clone_shape from endia import Array def custom_mul_callable(inout curr: Array, args: List[Array]) -> None: """This operation defines what should happen when the operation is called. Since shapes are computed jsut as laziliy as the data, we need to make sure that the shape of the resulting array is set before we can set the data. """ setup_shape_and_data(curr) for i in range(curr.size()): curr.store(i, args[0].load(i) * args[1].load(i)) def custom_mul_vjp( primals: List[Array], grad: Array, out: Array ) -> List[Array]: """The vector-Jacobian product of the custom multiplication operation. We use the vector-Jacobian to define what happens when the gradient is backpropagated. Reminder: d/dx (a*b) = a * d/dx(b) + b * d/dx(a). """ return List(custom_mul(grad, primals[1]), custom_mul(grad, primals[0])) def custom_mul(arg0: Array, arg1: Array) -> Array: """The forward pass of the custom multiplication operation. Here we register the the resulting array, its shape, its operation name and its parents i.e. arg0 and arg1. For simplicity this function does not support automatic broadcasting, therefore we add the constraint that the two input arrays must have the same shape. """ if arg0.array_shape() != arg1.array_shape(): raise "Warning in custom_mul: The two input arrays must have the same shape." # register the resulting array, its shape, its operation name, and its parents return op_array( array_shape=clone_shape(arg0.array_shape()), args=List(arg0, arg1), name="mul", callable=custom_mul_callable, vjp=custom_mul_vjp, ) def main(): """Simple test of the custom operation. We create two arrays, multiply them and sum the result. Then we compute the derivative of the output with respect to the two input arrays. """ a = Array("[1, 2, 3]", requires_grad=True) b = Array("[4, 5, 6]", requires_grad=True) c = endia.sum(custom_mul(a, b)) print(c) # expected output: [32] c.backward() print(a.grad()) # expected output: [4, 5, 6] print(b.grad()) # expected output: [1, 2, 3] --- examples/endia_vs_torch_vs_jax/__init__.mojo --- from .jax_nd import example_jax_like from .torch_nd import example_torch_like --- examples/endia_vs_torch_vs_jax/jax_nd.mojo --- from endia import grad, jacobian from endia import sum, arange, ndarray def foo(x: ndarray) -> ndarray: return sum(x**2) def example_jax_like(): # create Callables foo_jac = grad(foo) foo_hes = jacobian(foo_jac) x = arange(1.0, 4.0) print(foo(x)) print(foo_jac(x)[ndarray]) print(foo_hes(x)[ndarray]) --- examples/endia_vs_torch_vs_jax/jax_nd.py --- from jax import grad, jacobian from jax.numpy import sum, arange, ndarray def foo(x: ndarray) -> ndarray: return sum(x**2) def main(): # create Callables foo_jac = grad(foo) foo_hes = jacobian(foo_jac) x = arange(1.0, 4.0) print(foo(x)) print(foo_jac(x)) print(foo_hes(x)) main() --- examples/endia_vs_torch_vs_jax/torch_nd.mojo --- from endia import Tensor, sum, arange from endia.autograd import grad import endia.autograd.functional as F def foo(x: Tensor) -> Tensor: return sum(x**2) def example_torch_like(): x = arange(1.0, 4.0, requires_grad=True) y = foo(x) dy_dx = grad(outs=y, inputs=x)[0] d2y_dx2 = F.hessian(foo, x) print(y) print(dy_dx) print(d2y_dx2) --- examples/endia_vs_torch_vs_jax/torch_nd.py --- from torch import Tensor, sum, arange from torch.autograd import grad import torch.autograd.functional as F def foo(x: Tensor) -> Tensor: return sum(x**2) def main(): x = arange(1.0, 4.0, requires_grad=True) y = foo(x) dy_dx = grad(outputs=y, inputs=x)[0] dy2_dx2 = F.hessian(foo, x) print(y) print(dy_dx) print(dy2_dx2) main() --- examples/readme.md --- # Endia Examples --- examples/run_examples.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from examples import * def run_examples(): example1() example2() viz_example1() --- examples/simple_examples/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from ._example1 import * from ._example2 import * --- examples/simple_examples/_example1.mojo --- # ===----------------------------------------------------------------------=== # # Eendiaia 2024 # # Licensed uendiaer the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed uendiaer the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR COendiaITIONS OF ANY KIendia, either express or implied. # See the License for the specific language governing permissions aendia # limitations uendiaer the License. # ===----------------------------------------------------------------------=== # import endia # Define the function def foo(x: endia.Array) -> endia.Array: return endia.sum(x**2) def example1(): print("Example 1 ###########################################") print("\nImperative grad computation:") # Initialize variable - requires_grad=True needed! # x = 1 + endia.arange(shape=List(2, 3, 4), requires_grad=True) x = endia.array("[1.0, 2.0, 3.0]", requires_grad=True) # Compute result, first aendia secoendia order derivatives y = foo(x) y.backward(create_graph=True) dy_dx = x.grad() d2y_dx2 = endia.autograd.functional.grad(outs=dy_dx, inputs=x)[0] # Print results print(y) # 14.0 print(dy_dx) # [2.0, 4.0, 6.0] print(d2y_dx2) # [[2.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 2.0]] print("\nFunctional grad computation:") # Create callables for the jacobian aendia hessian foo_jac = endia.grad(foo) foo_hes = endia.grad(foo_jac) # Initialize variable - no requires_grad=True needed x = endia.array("[1.0, 2.0, 3.0]") # Compute result aendia derivatives (with type hints) y = foo(x) dy_dx = foo_jac(x)[endia.Array] d2y_dx2 = foo_hes(x)[endia.Array] # Print results print(y) # 14.0 print(dy_dx) # [2.0, 4.0, 6.0] print(d2y_dx2) # [[2.0, 0.0, 0.0], # [0.0, 2.0, 0.0], # [0.0, 0.0, 2.0]] --- examples/simple_examples/_example2.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd fn foo(x: List[nd.Array]) raises -> nd.Array: return nd.sum((x[0] * x[0] + x[1] * x[1])) def example2(): print("\n\nExample 2 ###########################################") print("\nImperative grad computation:") x = nd.Array("[[1.0,2.0,3.0],[1.0,2.0,3.0]]", requires_grad=True) y = nd.Array("[[1.0,2.0,3.0],[1.0,2.0,3.0]]", requires_grad=True) grads = nd.grad( outs=nd.sum(foo(List(x, y))), inputs=List(x, y), create_graph=True ) x_grad = grads[0] y_grad = grads[1] print("grads:") print(str(x_grad)) print(str(y_grad)) x_hessians = nd.grad(outs=nd.sum(x_grad), inputs=List(x, y)) y_hessians = nd.grad(outs=nd.sum(y_grad), inputs=List(x, y)) print("hessians:") print(str(x_hessians[0])) print(str(x_hessians[1])) print(str(y_hessians[0])) print(str(y_hessians[1])) print("\nFunctional grad computation:") x = nd.Array("[[1.0,2.0,3.0],[1.0,2.0,3.0]]") y = nd.Array("[[1.0,2.0,3.0],[1.0,2.0,3.0]]") foo_grads = nd.grad(foo, argnums=List(0, 1)) grads = foo_grads(List(x, y))[List[nd.Array]] x_grad = grads[0] y_grad = grads[1] print("grads:") print(str(x_grad)) print(str(y_grad)) foo_hessians = nd.grad(foo_grads, argnums=List(0, 1)) hessians = foo_hessians(List(x, y))[List[nd.Array]] print("hessians:") print(str(hessians[0])) print(str(hessians[1])) print(str(hessians[2])) print(str(hessians[3])) --- examples/viz_examples/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .simple_viz import * from .single_layer_nn import * --- examples/viz_examples/simple_viz.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd def viz_example1(): a = nd.arange(0, 2 * 3, requires_grad=True).reshape(List(2, 3)) b = nd.arange(0, 3 * 4, requires_grad=True).reshape(List(3, 4)) c = nd.arange(0, 2 * 2 * 4, requires_grad=True).reshape(List(2, 2, 4)) res = nd.sum(a @ b + c) nd.utils.visualize_graph(res, "./assets/example1_graph") --- examples/viz_examples/single_layer_nn.mojo --- import endia as nd def single_layer_viz_example(): # initialization weight1 = nd.randu(List(3, 4), requires_grad=True) bias1 = nd.randu(List(4), requires_grad=True) weight2 = nd.randu(List(4, 5), requires_grad=True) bias2 = nd.randu(List(5), requires_grad=True) # forward input = nd.ones(List(2, 3)) hidden = nd.relu(input @ weight1 + bias1) pred = hidden @ weight2 + bias2 # visualize nd.utils.visualize_graph(pred, "./single_layer_nn") --- requirements.txt --- torch>=2.3.1 numpy>=2.0.0 graphviz>=0.20.3 --- setup.sh --- #!/bin/bash # Function to compare versions version_compare() { local v1=$1 local v2=$2 if [[ $(printf "%s\n" "$v1" "$v2" | sort -V | head -n 1) != "$v2" ]]; then return 1 # v1 < v2 else return 0 # v1 >= v2 fi } # Check if Mojo is available and its version is at least 24.4.0 mojo_version=$(mojo -v | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+') if [[ ! $mojo_version || $(version_compare "$mojo_version" "24.4.0") -ne 0 ]]; then echo "Mojo version 24.4.0 or higher is required but not found." echo "Please install Mojo by following the instructions at: https://docs.modular.com/max/install" exit 1 fi # Check if MAX is available and its version is at least 24.4.0 max_version=$(max -v | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+') if [[ ! $max_version || $(version_compare "$max_version" "24.4.0") -ne 0 ]]; then echo "MAX version 24.4.0 or higher is required but not found." echo "Please install MAX by following the instructions at: https://docs.modular.com/max/install" exit 1 fi # Check Modular version modular_version=$(modular -v | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+') echo "Modular version $modular_version" # Install Python libraries if not already installed pip install -r requirements.txt # Create a temporary main file to run tests echo "from tests.run_tests import run_tests def main(): run_tests()" > temp_main.mojo # Run the temporary main file mojo temp_main.mojo # Remove the temporary main file rm temp_main.mojo --- tests/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .integration_tests import * from .test_endia import * --- tests/integration_tests/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .random_function_tests import * --- tests/integration_tests/random_function_tests.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def foo(args: List[nd.Array]) -> nd.Array: a = args[0] b = args[1] c = args[2] return nd.sum( nd.mul( nd.cos(nd.sin(nd.cos(nd.cos(nd.add(nd.matmul(a, b), c))))), nd.matmul(a, b), ) ) def foo_torch(args: List[PythonObject]) -> PythonObject: torch = Python.import_module("torch") a = args[0] b = args[1] c = args[2] return torch.sum( torch.mul( torch.cos( torch.sin( torch.cos(torch.cos(torch.add(torch.matmul(a, b), c))) ) ), torch.matmul(a, b), ) ) def run_test_foo(msg: String = "foo"): # endia args initialization arg0 = nd.randn(List(2, 3, 4)) arg1 = nd.randn(List(4, 5)) arg2 = nd.randn(List(2, 3, 5)) args = List(arg0, arg1, arg2) # torch args initialization arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) arg2_torch = nd.utils.to_torch(arg2) args_torch = List(arg0_torch, arg1_torch, arg2_torch) # fucntional calls res = foo(args) res_torch = foo_torch(args_torch) # check if the results are close if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_foo_grad(msg: String = "foo_backward"): # endia args initialization a = nd.randn(List(3, 4), requires_grad=True) b = nd.randn(List(2, 4, 5), requires_grad=True) c = nd.randn(List(2, 3, 5), requires_grad=True) args = List(a, b, c) # torch args initialization a_torch = nd.utils.to_torch(a) b_torch = nd.utils.to_torch(b) c_torch = nd.utils.to_torch(c) args_torch = List(a_torch, b_torch, c_torch) # function calls res = foo(args) res_torch = foo_torch(args_torch) # backward pass res.backward() res_torch.backward() # get the gradients for nd and torch grad_a = a.grad() grad_b = b.grad() grad_c = c.grad() grad_a_torch = a_torch.grad grad_b_torch = b_torch.grad grad_c_torch = c_torch.grad # check if the results are close test_success = True if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) test_success = False if not nd.utils.is_close(grad_a, grad_a_torch): print("\033[31mTest failed\033[0m", msg, "grad_a") test_success = False if not nd.utils.is_close(grad_b, grad_b_torch): print("\033[31mTest failed\033[0m", msg, "grad_b") test_success = False if not nd.utils.is_close(grad_c, grad_c_torch): print("\033[31mTest failed\033[0m", msg, "grad_c") test_success = False if test_success: print("\033[32mTest passed\033[0m", msg) --- tests/integration_tests/test_foo_jit.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia def foo(args: List[endia.Array]) -> endia.Array: a = args[0] b = args[1] c = args[2] return endia.sum(endia.relu(a @ b + c)) def test_foo_jit(): foo_jit = endia.jit(endia.value_and_grad(foo)) a = endia.arange(0, 3 * 4).reshape(List(3, 4)) b = endia.arange(0, 4 * 5).reshape(List(4, 5)) c = endia.arange(0, 3 * 5).reshape(List(3, 5)) var res = foo_jit(List(a, b, c))[List[List[endia.Array]]] # print(res[0][0]) fwd_res = res[0][0] a_grad = res[1][0] b_grad = res[1][1] c_grad = res[1][2] # var fwd_res = foo(List(a,b,c)) # fwd_res.backward() # var a_grad = a.grad() # var b_grad = b.grad() # var c_grad = c.grad() print(fwd_res) print(a_grad) print(b_grad) print(c_grad) --- tests/integration_tests/test_max_integration.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from endia import * def test_max_graph(): # Define the computation graph var a = randu(List(2, 3, 4), requires_grad=True) var b = randu(List(4, 5), requires_grad=True) var c = randu(List(3, 5), requires_grad=True) # var res = squeeze(unsqueeze(sin(a @ b + c), List(0,2))) res = ge_zero(a) # res = ( # squeeze(a) * 2 # ) # squeeze(reduce_add(relu((a @ b) + c), List(0,1,2))) * 2 print(res) # a.T()#reduce_add(a,0)#sin(a @ b) + cos(c), List(0)) # Define trace, args and outputs of the graph var trace = top_order(res) var args = List(a, b, c) var outputs = List[Array]() outputs.append(res) # create a callable model with MAX var callable = build_model(args, outputs, trace) # execute_max_graph the model for i in range(1): var output = execute_model(args, outputs, callable) if i % 100 == 0: print("JIT Iteration:", i) print(output[0]) # def main(): # test_max_graph() def foo(args: List[Array]) -> Array: a = args[0] b = args[1] c = args[2] return relu(ge_zero(a)) # return ( # a @ b # ) + c # sum(relu(a)) / a.ndim()# squeeze(reduce_add(relu((a @ b) + c), List(0,1,2)) ) * ones(List(1)) def test_max_integration(): foo_jit = jit(foo) a = randn(List(2, 3, 4)) b = randu(List(4, 5)) c = randu(List(3, 5)) for i in range(1): res = foo_jit(List(a, b, c))[Array] print(res) # a = arange(List(2, 3, 4)) * 10 # res = foo_jit(List(a))[Array] # print(res) # a = arange(List(2, 3, 4)) * 0.1 # res = foo_jit(List(a))[Array] # print(res) --- tests/readme.md --- # Tests --- tests/run_tests.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from tests import * from benchmarks import * def run_unit_tests(): # Unit Test: Test unary ops run_test_to_abs() run_test_to_abs_grad() run_test_to_abs_complex() run_test_acos() run_test_acos_grad() # run_test_acos_complex() run_test_asin() run_test_asin_grad() # run_test_asin_complex() run_test_atan() run_test_atan_grad() # run_test_atan_complex() run_test_cos() run_test_cos_grad() run_test_cos_complex() run_test_cosh() run_test_cosh_grad() run_test_cosh_complex() run_test_exp() run_test_exp_grad() run_test_exp_complex() run_test_log() run_test_log_grad() run_test_log_complex() run_test_neg() run_test_neg_grad() run_test_neg_complex() run_test_reciprocal() run_test_reciprocal_grad() run_test_reciprocal_complex() run_test_relu() run_test_relu_grad() # note: relu only for real numbers run_test_sigmoid() run_test_sigmoid_grad() # note: sigmoid only for real numbers run_test_sign() # note: sign not differentiable run_test_sign_complex() run_test_sin() run_test_sin_grad() run_test_sin_complex() run_test_sqrt() run_test_sqrt_grad() run_test_sqrt_complex() run_test_square() run_test_square_grad() run_test_square_complex() run_test_tan() run_test_tan_grad() # run_test_tan_complex() run_test_tanh() run_test_tanh_grad() run_test_tanh_complex() # Unit Test: Test binary ops run_test_add() run_test_add_grad() run_test_add_complex() run_test_sub() run_test_sub_grad() run_test_sub_complex() run_test_mul() run_test_mul_grad() run_test_mul_complex() run_test_div() run_test_div_grad() run_test_div_complex() run_test_pow() run_test_pow_grad() run_test_pow_complex() run_test_matmul() run_test_matmul_grad() run_test_matmul_complex() # Unit Test: Test reduce ops run_test_reduce_add() run_test_reduce_add_grad() run_test_mean() run_test_mean_grad() # Needs FIX: Mojo breaks when using the name 'var' from pytorch # run_test_variance() # run_test_variance_grad() run_test_std() run_test_std_grad() run_test_reduce_max() run_test_reduce_argmax() run_test_reduce_min() run_test_reduce_argmin() # Unit Test: Test view ops run_test_expand() run_test_expand_grad() run_test_permute() run_test_permute_grad() run_test_squeeze() run_test_squeeze_grad() run_test_as_strided() run_test_as_strided_grad() run_test_reshape() run_test_reshape_grad() # Unit Tests: Test comparison ops run_test_ge_zero() run_test_greater_equal() run_test_greater() run_test_less_equal() run_test_less() # Unit Test: Test spacial ops run_test_conv1d() run_test_conv2d() run_test_conv3d() run_test_max_pool1d() run_test_max_pool2d() run_test_max_pool3d() run_test_avg_pool1d() run_test_avg_pool2d() run_test_avg_pool3d() def run_integration_tests(): # integration Tests: Test random functions run_test_foo() run_test_foo_grad() def run_tests(): """ This is the main function that runs all the tests and benchmarks. """ run_unit_tests() # run_integration_tests() --- tests/test_endia/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_functional import * --- tests/test_endia/readme.md --- # Unit Tests of Endia's Functional Module --- tests/test_endia/test_functional/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_binary_ops import * from .test_comparison_ops import * from .test_index_ops import * from .test_init_ops import * from .test_reduce_ops import * from .test_spacial_ops import * from .test_unary_ops import * from .test_view_ops import * from .test_utils import * --- tests/test_endia/test_functional/test_binary_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_add_op import * from .test_div_op import * from .test_matmul_op import * from .test_mul_op import * from .test_pow_op import * from .test_sub_op import * --- tests/test_endia/test_functional/test_binary_ops/test_add_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_add(msg: String = "add"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40)) arg1 = nd.randn(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.add(arg0, arg1) res_torch = torch.add(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_add_grad(msg: String = "add_grad"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40), requires_grad=True) arg1 = nd.randn(List(30, 40), requires_grad=True) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.sum(nd.add(arg0, arg1)) res_torch = torch.sum(torch.add(arg0_torch, arg1_torch)) res.backward(create_graph=True) res_torch.backward() grad0 = arg0.grad() grad1 = arg1.grad() grad0_torch = arg0_torch.grad grad1_torch = arg1_torch.grad if not nd.utils.is_close(grad0, grad0_torch): print("\033[31mTest failed\033[0m", msg, "grad0") if not nd.utils.is_close(grad1, grad1_torch): print("\033[31mTest failed\033[0m", msg, "grad1") if nd.utils.is_close(grad0, grad0_torch) and nd.utils.is_close( grad1, grad1_torch ): print("\033[32mTest passed\033[0m", msg) def run_test_add_complex(msg: String = "add_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg1 = nd.randn_complex(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.add(arg0, arg1) res_torch = torch.add(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_binary_ops/test_div_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_div(msg: String = "div"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40)) arg1 = nd.randn(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.div(arg0, arg1) res_torch = torch.div(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_div_grad(msg: String = "div_grad"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40), requires_grad=True) arg1 = nd.randn(List(30, 40), requires_grad=True) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.sum(nd.div(arg0, arg1)) res_torch = torch.sum(torch.div(arg0_torch, arg1_torch)) res.backward(create_graph=True) res_torch.backward() grad0 = arg0.grad() grad1 = arg1.grad() grad0_torch = arg0_torch.grad grad1_torch = arg1_torch.grad if not nd.utils.is_close(grad0, grad0_torch): print("\033[31mTest failed\033[0m", msg, "grad0") if not nd.utils.is_close(grad1, grad1_torch): print("\033[31mTest failed\033[0m", msg, "grad1") if nd.utils.is_close(grad0, grad0_torch) and nd.utils.is_close( grad1, grad1_torch ): print("\033[32mTest passed\033[0m", msg) def run_test_div_complex(msg: String = "div_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg1 = nd.randn_complex(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.div(arg0, arg1) res_torch = torch.div(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_binary_ops/test_matmul_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_matmul(msg: String = "matmul"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40)) arg1 = nd.randn(List(40, 50)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.matmul(arg0, arg1) res_torch = torch.matmul(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_matmul_grad(msg: String = "matmul_grad"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40), requires_grad=True) arg1 = nd.randn(List(40, 50), requires_grad=True) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.sum(nd.matmul(arg0, arg1)) res_torch = torch.sum(torch.matmul(arg0_torch, arg1_torch)) res.backward() res_torch.backward() grad0 = arg0.grad() grad1 = arg1.grad() grad0_torch = arg0_torch.grad grad1_torch = arg1_torch.grad if not nd.utils.is_close(grad0, grad0_torch): print("\033[31mTest failed\033[0m", msg, "grad0") if not nd.utils.is_close(grad1, grad1_torch): print("\033[31mTest failed\033[0m", msg, "grad1") if nd.utils.is_close(grad0, grad0_torch) and nd.utils.is_close( grad1, grad1_torch ): print("\033[32mTest passed\033[0m", msg) def run_test_matmul_complex(msg: String = "matmul_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg1 = nd.randn_complex(List(40, 50)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.matmul(arg0, arg1) res_torch = torch.matmul(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_binary_ops/test_mul_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_mul(msg: String = "mul"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40)) arg1 = nd.randn(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.mul(arg0, arg1) res_torch = torch.mul(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_mul_grad(msg: String = "mul_grad"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40), requires_grad=True) arg1 = nd.randn(List(30, 40), requires_grad=True) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.sum(nd.mul(arg0, arg1)) res_torch = torch.sum(torch.mul(arg0_torch, arg1_torch)) res.backward(create_graph=True) res_torch.backward() grad0 = arg0.grad() grad1 = arg1.grad() grad0_torch = arg0_torch.grad grad1_torch = arg1_torch.grad if not nd.utils.is_close(grad0, grad0_torch): print("\033[31mTest failed\033[0m", msg, "grad0") if not nd.utils.is_close(grad1, grad1_torch): print("\033[31mTest failed\033[0m", msg, "grad1") if nd.utils.is_close(grad0, grad0_torch) and nd.utils.is_close( grad1, grad1_torch ): print("\033[32mTest passed\033[0m", msg) def run_test_mul_complex(msg: String = "mul_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg1 = nd.randn_complex(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.mul(arg0, arg1) res_torch = torch.mul(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_binary_ops/test_pow_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_pow(msg: String = "pow"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40)) arg1 = nd.randn(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.pow_to(arg0, arg1) res_torch = torch.pow(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_pow_grad(msg: String = "pow_grad"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40), requires_grad=True) arg1 = nd.randn(List(30, 40), requires_grad=True) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.sum(arg0**arg1) res_torch = torch.sum(arg0_torch**arg1_torch) res.backward(create_graph=True) res_torch.backward() grad0 = arg0.grad() grad1 = arg1.grad() grad0_torch = arg0_torch.grad grad1_torch = arg1_torch.grad if not nd.utils.is_close(grad0, grad0_torch): print("\033[31mTest failed\033[0m", msg, "grad0") if not nd.utils.is_close(grad1, grad1_torch): print("\033[31mTest failed\033[0m", msg, "grad1") if nd.utils.is_close(grad0, grad0_torch) and nd.utils.is_close( grad1, grad1_torch ): print("\033[32mTest passed\033[0m", msg) def run_test_pow_complex(msg: String = "pow_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg1 = nd.randn_complex(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.pow_to(arg0, arg1) res_torch = torch.pow(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_binary_ops/test_sub_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_sub(msg: String = "sub"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40)) arg1 = nd.randn(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.sub(arg0, arg1) res_torch = torch.sub(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sub_grad(msg: String = "sub_grad"): torch = Python.import_module("torch") arg0 = nd.randn(List(2, 30, 40), requires_grad=True) arg1 = nd.randn(List(30, 40), requires_grad=True) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.sum(nd.sub(arg0, arg1)) res_torch = torch.sum(torch.sub(arg0_torch, arg1_torch)) res.backward(create_graph=True) res_torch.backward() grad0 = arg0.grad() grad1 = arg1.grad() grad0_torch = arg0_torch.grad grad1_torch = arg1_torch.grad if not nd.utils.is_close(grad0, grad0_torch): print("\033[31mTest failed\033[0m", msg, "grad0") if not nd.utils.is_close(grad1, grad1_torch): print("\033[31mTest failed\033[0m", msg, "grad1") if nd.utils.is_close(grad0, grad0_torch) and nd.utils.is_close( grad1, grad1_torch ): print("\033[32mTest passed\033[0m", msg) def run_test_sub_complex(msg: String = "sub_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg1 = nd.randn_complex(List(30, 40)) arg0_torch = nd.utils.to_torch(arg0) arg1_torch = nd.utils.to_torch(arg1) res = nd.sub(arg0, arg1) res_torch = torch.sub(arg0_torch, arg1_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_comparison_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_ge_zero_op import * from .test_greater_equal_op import * from .test_greater_op import * from .test_less_equal_op import * from .test_less_op import * --- tests/test_endia/test_functional/test_comparison_ops/test_ge_zero_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_ge_zero(msg: String = "ge_zero"): arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.ge_zero(arr) res_torch = (arr_torch > 0).float() if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_comparison_ops/test_greater_equal_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_greater_equal(msg: String = "greater_equal"): arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = arr >= 0 res_torch = (arr_torch >= 0).float() if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_comparison_ops/test_greater_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_greater(msg: String = "greater"): arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = arr > 0 res_torch = (arr_torch > 0).float() if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_comparison_ops/test_less_equal_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_less_equal(msg: String = "less_equal"): arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = arr <= 0 res_torch = (arr_torch <= 0).float() if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_comparison_ops/test_less_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_less(msg: String = "less"): arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = arr < 0 res_torch = (arr_torch < 0).float() if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_index_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_concat_op import * --- tests/test_endia/test_functional/test_index_ops/test_concat_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_init_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_init_ops import * --- tests/test_endia/test_functional/test_init_ops/test_init_ops.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_loss_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_mse_op import * --- tests/test_endia/test_functional/test_loss_ops/test_mse_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_reduce_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_reduce_add_op import * from .test_reduce_max_op import * from .test_reduce_argmax_op import * from .test_reduce_min_op import * from .test_reduce_argmin_op import * from .test_mean_op import * from .test_std_op import * from .test_variance_op import * --- tests/test_endia/test_functional/test_reduce_ops/test_mean_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_mean(msg: String = "mean"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) axis = List(1) axis_torch = [1] res = nd.mean(arr, axis) res_torch = torch.mean(arr_torch, axis_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_mean_grad(msg: String = "mean_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) axis = List(1) axis_torch = [1] res = nd.sum(nd.squeeze(nd.mean(arr, axis))) res_torch = torch.sum(torch.mean(arr_torch, axis_torch).squeeze()) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_reduce_ops/test_reduce_add_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_reduce_add(msg: String = "reduce_add"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) axis = List(1) axis_torch = [1] res = nd.reduce_add(arr, axis) res_torch = torch.sum(arr_torch, axis_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_reduce_add_grad(msg: String = "reduce_add_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) axis = List(1) axis_torch = [1] res = nd.sum(nd.reduce_add(arr, axis)) res_torch = torch.sum(torch.sum(arr_torch, axis_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_reduce_ops/test_reduce_argmax_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_reduce_argmax(msg: String = "reduce_argmax"): torch = Python.import_module("torch") arr = nd.randu(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) axis = 1 # Note: In PyTorch we can only call max and argmax along a single dimension at a time! res = nd.reduce_argmax(arr, axis) res_torch = torch.argmax(arr_torch, dim=axis) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_reduce_ops/test_reduce_argmin_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_reduce_argmin(msg: String = "reduce_argmin"): torch = Python.import_module("torch") arr = nd.randu(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) axis = 1 # Note: In PyTorch we can only call min and argmin along a single dimension at a time! res = nd.reduce_argmin(arr, axis) res_torch = torch.argmin(arr_torch, dim=axis) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_reduce_ops/test_reduce_max_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_reduce_max(msg: String = "reduce_arg_max"): torch = Python.import_module("torch") arr = nd.randu(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) axis = 1 # in PyTorch we can only call max and argmax along a single dimension at a time! res = nd.reduce_max(arr, axis) res_torch = torch.max(arr_torch, dim=axis)[ 0 ] # PyTorch always returns both the max and argmax as a Tuple if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_reduce_ops/test_reduce_min_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_reduce_min(msg: String = "reduce_arg_min"): torch = Python.import_module("torch") arr = nd.randu(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) axis = 1 # in PyTorch we can only call min and argmin along a single dimension at a time! res = nd.reduce_min(arr, axis) res_torch = torch.min(arr_torch, dim=axis)[ 0 ] # PyTorch always returns both the min and argmin as a Tuple if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_reduce_ops/test_std_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_std(msg: String = "std"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) axis = List(1) axis_torch = [1] res = nd.std(arr, axis) res_torch = torch.std(arr_torch, axis_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_std_grad(msg: String = "std_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) axis = List(1) axis_torch = [1] res = nd.sum(nd.std(arr, axis)) res_torch = torch.sum(torch.std(arr_torch, axis_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_reduce_ops/test_variance_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_variance(msg: String = "variance"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) variance_torch = Python.import_module("torch.var").variance axis = List(1) axis_torch = [1] res = nd.variance(arr, axis) res_torch = torch.variance_torch(arr_torch, axis_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_variance_grad(msg: String = "variance_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) variance_torch = Python.import_module("torch.var").variance axis = List(1) axis_torch = [1] res = nd.sum(nd.variance(arr, axis)) res_torch = torch.sum(torch.variance_torch(arr_torch, axis_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_avg_pool1d_op import * from .test_avg_pool2d_op import * from .test_avg_pool3d_op import * from .test_conv1d_op import * from .test_conv2d_op import * from .test_conv3d_op import * from .test_max_pool1d_op import * from .test_max_pool2d_op import * from .test_max_pool3d_op import * --- tests/test_endia/test_functional/test_spacial_ops/test_avg_pool1d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_avg_pool1d(msg: String = "avg_pool1d"): torch = Python.import_module("torch") kernel_size = 3 stride = 2 padding = 1 dilation = 1 input_tensor = nd.randu(List(2, 2, 10)) output = nd.avg_pool1d( input_tensor, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ) input_tensor_torch = nd.utils.to_torch(input_tensor) output_torch = torch.nn.functional.avg_pool1d( input_tensor_torch, kernel_size=kernel_size, stride=stride, padding=padding, count_include_pad=False, ) if not nd.utils.is_close(output, output_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/test_avg_pool2d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_avg_pool2d(msg: String = "avg_pool2d"): torch = Python.import_module("torch") kernel_size = (3, 3) stride = (2, 2) padding = (1, 1) dilation = (1, 1) input_tensor = nd.randu(List(2, 2, 10, 10)) output = nd.avg_pool2d( input_tensor, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ) input_tensor_torch = nd.utils.to_torch(input_tensor) output_torch = torch.nn.functional.avg_pool2d( input_tensor_torch, kernel_size=PythonObject(kernel_size), stride=PythonObject(stride), padding=PythonObject(padding), count_include_pad=False, ) if not nd.utils.is_close(output, output_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/test_avg_pool3d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_avg_pool3d(msg: String = "avg_pool3d"): torch = Python.import_module("torch") kernel_size = (3, 3, 3) stride = (2, 2, 2) padding = (1, 1, 1) dilation = (1, 1, 1) input_tensor = nd.randu(List(2, 2, 10, 10, 10)) output = nd.avg_pool3d( input_tensor, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ) input_tensor_torch = nd.utils.to_torch(input_tensor) output_torch = torch.nn.functional.avg_pool3d( input_tensor_torch, kernel_size=PythonObject(kernel_size), stride=PythonObject(stride), padding=PythonObject(padding), count_include_pad=False, ) if not nd.utils.is_close(output, output_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/test_conv1d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_conv1d(msg: String = "conv1d"): torch = Python.import_module("torch") batch_size = 2 in_channels = 2 out_channels = 3 kernel_size = 3 elements = 6 stride = 2 padding = 1 dilation = 1 groups = 1 a = nd.randu(shape=List(batch_size, in_channels, elements)) kernel = nd.randu(shape=List(out_channels, in_channels, kernel_size)) bias = nd.randu(shape=List(out_channels)) a_torch = nd.utils.to_torch(a) kernel_torch = nd.utils.to_torch(kernel) bias_torch = nd.utils.to_torch(bias) res = nd.conv1d( a, kernel, bias, # in_channels, # out_channels, # kernel_size, stride, padding, dilation, groups, ) res_torch = torch.nn.functional.conv1d( a_torch, kernel_torch, bias_torch, stride=stride, padding=padding, dilation=dilation, groups=groups, ) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/test_conv2d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_conv2d(msg: String = "conv2d"): torch = Python.import_module("torch") batch_size = 2 in_channels = 2 out_channels = 3 kernel_width = 3 kernel_height = 3 elements = 6 stride_width = 2 stride_height = 2 padding_width = 1 padding_height = 1 dilation_width = 1 dilation_height = 1 groups = 1 a = nd.randu(shape=List(batch_size, in_channels, elements, elements)) kernel = nd.randu( shape=List(out_channels, in_channels, kernel_width, kernel_height) ) bias = nd.randu(shape=List(out_channels)) a_torch = nd.utils.to_torch(a) kernel_torch = nd.utils.to_torch(kernel) bias_torch = nd.utils.to_torch(bias) res = nd.conv2d( a, kernel, bias, stride=(stride_width, stride_height), padding=(padding_width, padding_height), dilation=(dilation_width, dilation_height), groups=groups, ) res_torch = torch.nn.functional.conv2d( a_torch, kernel_torch, bias_torch, stride=(stride_height, stride_width), padding=(padding_height, padding_width), dilation=(dilation_height, dilation_width), groups=groups, ) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/test_conv3d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_conv3d(msg: String = "conv3d"): torch = Python.import_module("torch") batch_size = 2 in_channels = 2 out_channels = 3 kernel_depth = 3 kernel_height = 3 kernel_width = 3 depth = 6 height = 6 width = 6 stride_depth = 2 stride_height = 2 stride_width = 2 padding_depth = 1 padding_height = 1 padding_width = 1 dilation_depth = 1 dilation_height = 1 dilation_width = 1 groups = 1 a = nd.randu(shape=List(batch_size, in_channels, depth, height, width)) kernel = nd.randu( shape=List( out_channels, in_channels, kernel_depth, kernel_height, kernel_width ) ) bias = nd.randu(shape=List(out_channels)) a_torch = nd.utils.to_torch(a) kernel_torch = nd.utils.to_torch(kernel) bias_torch = nd.utils.to_torch(bias) res = nd.conv3d( a, kernel, bias, (stride_depth, stride_height, stride_width), (padding_depth, padding_height, padding_width), (dilation_depth, dilation_height, dilation_width), groups, ) res_torch = torch.nn.functional.conv3d( a_torch, kernel_torch, bias_torch, stride=(stride_depth, stride_height, stride_width), padding=(padding_depth, padding_height, padding_width), dilation=(dilation_depth, dilation_height, dilation_width), groups=groups, ) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/test_max_pool1d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_max_pool1d(msg: String = "max_pool1d"): torch = Python.import_module("torch") kernel_size = 3 stride = 2 padding = 1 dilation = 1 input_tensor = nd.randu(List(2, 2, 10)) output = nd.max_pool1d( input_tensor, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ) input_tensor_torch = nd.utils.to_torch(input_tensor) output_torch = torch.nn.functional.max_pool1d( input_tensor_torch, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ) if not nd.utils.is_close(output, output_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/test_max_pool2d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_max_pool2d(msg: String = "max_pool2d"): torch = Python.import_module("torch") kernel_size = (3, 3) stride = (2, 2) padding = (1, 1) dilation = (1, 1) input_tensor = nd.randu(List(2, 2, 10, 10)) output = nd.max_pool2d( input_tensor, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ) input_tensor_torch = nd.utils.to_torch(input_tensor) output_torch = torch.nn.functional.max_pool2d( input_tensor_torch, kernel_size=PythonObject(kernel_size), stride=PythonObject(stride), padding=PythonObject(padding), dilation=PythonObject(dilation), ) if not nd.utils.is_close(output, output_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_spacial_ops/test_max_pool3d_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_max_pool3d(msg: String = "max_pool3d"): torch = Python.import_module("torch") kernel_size = (3, 3, 3) stride = (2, 2, 2) padding = (1, 1, 1) dilation = (1, 1, 1) input_tensor = nd.randu(List(2, 2, 10, 10, 10)) output = nd.max_pool3d( input_tensor, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ) input_tensor_torch = nd.utils.to_torch(input_tensor) output_torch = torch.nn.functional.max_pool3d( input_tensor_torch, kernel_size=PythonObject(kernel_size), stride=PythonObject(stride), padding=PythonObject(padding), dilation=PythonObject(dilation), ) if not nd.utils.is_close(output, output_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_abs_op import * from .test_acos_op import * from .test_asin_op import * from .test_atan_op import * from .test_cos_op import * from .test_cosh_op import * from .test_exp_op import * from .test_log_op import * from .test_neg_op import * from .test_reciprocal_op import * from .test_relu_op import * from .test_sigmoid_op import * from .test_sign_op import * from .test_sin_op import * from .test_sinh_op import * from .test_sqrt_op import * from .test_sqrt_op import * from .test_square_op import * from .test_tan_op import * from .test_tanh_op import * --- tests/test_endia/test_functional/test_unary_ops/test_abs_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_to_abs(msg: String = "abs"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.to_abs(arr) res_torch = torch.abs(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_to_abs_grad(msg: String = "abs_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.to_abs(arr)) res_torch = torch.sum(torch.abs(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_to_abs_complex(msg: String = "abs_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.to_abs(arg0) res_torch = torch.abs(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_acos_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_acos(msg: String = "acos"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.acos(arr) res_torch = torch.acos(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_acos_grad(msg: String = "acos_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.acos(arr)) res_torch = torch.sum(torch.acos(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_acos_complex(msg: String = "acos_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.acos(arg0) res_torch = torch.acos(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_asin_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_asin(msg: String = "asin"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.asin(arr) res_torch = torch.asin(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_asin_grad(msg: String = "asin_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.asin(arr)) res_torch = torch.sum(torch.asin(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_asin_complex(msg: String = "asin_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.asin(arg0) res_torch = torch.asin(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_atan_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_atan(msg: String = "atan"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.atan(arr) res_torch = torch.atan(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_atan_grad(msg: String = "atan_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.atan(arr)) res_torch = torch.sum(torch.atan(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_atan_complex(msg: String = "atan_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.atan(arg0) res_torch = torch.atan(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_cos_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_cos(msg: String = "cos"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.cos(arr) res_torch = torch.cos(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_cos_grad(msg: String = "cos_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.cos(arr)) res_torch = torch.sum(torch.cos(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_cos_complex(msg: String = "cos_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.cos(arg0) res_torch = torch.cos(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_cosh_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_cosh(msg: String = "cosh"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.cosh(arr) res_torch = torch.cosh(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_cosh_grad(msg: String = "cosh_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.cosh(arr)) res_torch = torch.sum(torch.cosh(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_cosh_complex(msg: String = "cosh_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.cosh(arg0) res_torch = torch.cosh(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_exp_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_exp(msg: String = "exp"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.exp(arr) res_torch = torch.exp(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_exp_grad(msg: String = "exp_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.exp(arr)) res_torch = torch.sum(torch.exp(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_exp_complex(msg: String = "exp_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.exp(arg0) res_torch = torch.exp(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_log_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_log(msg: String = "log"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.log(arr) res_torch = torch.log(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_log_grad(msg: String = "log_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.log(arr)) res_torch = torch.sum(torch.log(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_log_complex(msg: String = "log_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.log(arg0) res_torch = torch.log(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_neg_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_neg(msg: String = "neg"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.neg(arr) res_torch = torch.neg(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_neg_grad(msg: String = "neg_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.neg(arr)) res_torch = torch.sum(torch.neg(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_neg_complex(msg: String = "neg_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.neg(arg0) res_torch = torch.neg(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_reciprocal_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_reciprocal(msg: String = "reciprocal"): torch = Python.import_module("torch") arr = nd.arange(0, 2 * 30 * 40).reshape(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.reciprocal(arr) res_torch = torch.reciprocal(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_reciprocal_grad(msg: String = "reciprocal_grad"): torch = Python.import_module("torch") arr = nd.arange(0, 2 * 30 * 40, requires_grad=True).reshape(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.reciprocal(arr)) res_torch = torch.sum(torch.reciprocal(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_reciprocal_complex(msg: String = "reciprocal_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.reciprocal(arg0) res_torch = torch.reciprocal(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_relu_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_relu(msg: String = "relu"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.relu(arr) res_torch = torch.relu(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_relu_grad(msg: String = "relu_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.relu(arr)) res_torch = torch.sum(torch.relu(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_relu_complex(msg: String = "relu_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.relu(arg0) res_torch = torch.relu(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_sigmoid_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_sigmoid(msg: String = "sigmoid"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.sigmoid(arr) res_torch = torch.sigmoid(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sigmoid_grad(msg: String = "sigmoid_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.sigmoid(arr)) res_torch = torch.sum(torch.sigmoid(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_sign_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_sign(msg: String = "sign"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.sign(arr) res_torch = torch.sgn(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sign_complex(msg: String = "sign_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.sign(arg0) res_torch = torch.sgn(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_sin_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_sin(msg: String = "sin"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.sin(arr) res_torch = torch.sin(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sin_grad(msg: String = "sin_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.sin(arr)) res_torch = torch.sum(torch.sin(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sin_complex(msg: String = "sign_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.sin(arg0) res_torch = torch.sin(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_sinh_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_sinh(msg: String = "sinh"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.sinh(arr) res_torch = torch.sinh(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sinh_grad(msg: String = "sinh_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.sinh(arr)) res_torch = torch.sum(torch.sinh(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sinh_complex(msg: String = "sinh_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.sinh(arg0) res_torch = torch.sinh(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_sqrt_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_sqrt(msg: String = "sqrt"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.sqrt(arr) res_torch = torch.sqrt(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sqrt_grad(msg: String = "sqrt_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.sqrt(arr)) res_torch = torch.sum(torch.sqrt(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_sqrt_complex(msg: String = "sqrt_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.sqrt(arg0) res_torch = torch.sqrt(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_square_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_square(msg: String = "square"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.square(arr) res_torch = torch.square(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_square_grad(msg: String = "square_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.square(arr)) res_torch = torch.sum(torch.square(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_square_complex(msg: String = "square_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.square(arg0) res_torch = torch.square(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_tan_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_tan(msg: String = "tan"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.tan(arr) res_torch = torch.tan(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_tan_grad(msg: String = "tan_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.tan(arr)) res_torch = torch.sum(torch.tan(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_tan_complex(msg: String = "tan_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.tan(arg0) res_torch = torch.tan(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_unary_ops/test_tanh_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_tanh(msg: String = "tanh"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.tanh(arr) res_torch = torch.tanh(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_tanh_grad(msg: String = "tanh_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.tanh(arr)) res_torch = torch.sum(torch.tanh(arr_torch)) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_tanh_complex(msg: String = "tanh_complex"): torch = Python.import_module("torch") arg0 = nd.randn_complex(List(2, 30, 40)) arg0_torch = nd.utils.to_torch(arg0) res = nd.tanh(arg0) res_torch = torch.tanh(arg0_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_utils.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/__init__.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # from .test_array_slice_op import * from .test_as_strided_op import * from .test_detach_op import * from .test_expand_op import * from .test_imag_op import * from .test_pad_op import * from .test_permute_op import * from .test_real_op import * from .test_squeeze_op import * from .test_unsqueeze_op import * from .test_view_as_imag_op import * from .test_view_as_real_op import * from .test_view_op import * --- tests/test_endia/test_functional/test_view_ops/test_array_slice_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/test_as_strided_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_as_strided(msg: String = "as_strided"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) # 12,4,1 arr_torch = nd.utils.to_torch(arr) res = nd.as_strided( arr, shape=List(1, 2, 40, 2, 2), stride=List(16, 8, 2, 2, 1), storage_offset=0, ) res_torch = torch.as_strided( arr_torch, size=(1, 2, 40, 2, 2), stride=(16, 8, 2, 2, 1), storage_offset=0, ) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_as_strided_grad(msg: String = "as_strided_grad"): torch = Python.import_module("torch") arr = nd.arange(0, 30 * 30 * 2, requires_grad=True).reshape(List(30, 30, 2)) arr_torch = nd.utils.to_torch(arr) res = nd.sum( nd.sin( nd.as_strided( arr, shape=List(30, 30, 2), stride=List(9, 30, 2), storage_offset=0, ) ) ) res_torch = torch.sum( torch.sin( torch.as_strided( arr_torch, size=(30, 30, 2), stride=(9, 30, 2), storage_offset=0, ) ) ) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_view_ops/test_detach_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/test_expand_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_expand(msg: String = "expand"): torch = Python.import_module("torch") arr = nd.randn(List(2, 1, 40)) arr_torch = nd.utils.to_torch(arr) shape = List(2, 2, 30, 40) shape_torch = [2, 2, 30, 40] res = nd.expand(arr, shape) res_torch = torch.broadcast_to(arr_torch, shape_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_expand_grad(msg: String = "expand_grad"): torch = Python.import_module("torch") arr = nd.arange(0, 2 * 30 * 1, requires_grad=True).reshape(List(2, 30, 1)) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.sin(nd.expand(arr, List(2, 30, 40)))) res_torch = torch.sum(torch.sin(arr_torch.broadcast_to((2, 30, 40)))) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_view_ops/test_imag_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/test_pad_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/test_permute_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_permute(msg: String = "permute"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.permute(arr, List(2, 0, 1)) res_torch = torch.permute(arr_torch, dims=(2, 0, 1)) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_permute_grad(msg: String = "permute_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 30, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum((nd.permute(arr, List(2, 0, 1)))) res_torch = torch.sum((arr_torch.permute(2, 0, 1))) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_view_ops/test_real_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/test_squeeze_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_squeeze(msg: String = "squeeze"): torch = Python.import_module("torch") arr = nd.randn(List(2, 1, 40)) arr_torch = nd.utils.to_torch(arr) res = nd.squeeze(arr) res_torch = torch.squeeze(arr_torch) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_squeeze_grad(msg: String = "squeeze_grad"): torch = Python.import_module("torch") arr = nd.randn(List(2, 1, 40), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.sin(nd.squeeze(arr))) res_torch = torch.sum(torch.sin(torch.squeeze(arr_torch))) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- tests/test_endia/test_functional/test_view_ops/test_unsqueeze_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/test_view_as_imag_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/test_view_as_real_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python --- tests/test_endia/test_functional/test_view_ops/test_view_op.mojo --- # ===----------------------------------------------------------------------=== # # Endia 2024 # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===----------------------------------------------------------------------=== # import endia as nd from python import Python def run_test_reshape(msg: String = "reshape"): torch = Python.import_module("torch") arr = nd.randn(List(30, 4, 5)) arr_torch = nd.utils.to_torch(arr) res = nd.sin(nd.reshape(arr, List(30, 2, 2, 5))) res_torch = torch.sin(arr_torch.view(30, 2, 2, 5)) if not nd.utils.is_close(res, res_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) def run_test_reshape_grad(msg: String = "reshape_grad"): torch = Python.import_module("torch") arr = nd.randn(List(30, 4, 5), requires_grad=True) arr_torch = nd.utils.to_torch(arr) res = nd.sum(nd.sin(nd.reshape(arr, List(30, 2, 2, 5)))) res_torch = torch.sum(torch.sin(arr_torch.view(30, 2, 2, 5))) res.backward() res_torch.backward() grad = arr.grad() grad_torch = arr_torch.grad if not nd.utils.is_close(grad, grad_torch): print("\033[31mTest failed\033[0m", msg) else: print("\033[32mTest passed\033[0m", msg) --- .devcontainer/Dockerfile --- # ===----------------------------------------------------------------------=== # # Copyright (c) 2023, Modular Inc. All rights reserved. # # Licensed under the Apache License v2.0 with LLVM Exceptions: # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # The Dockerfile is provided as reference. Please review the redistribution # terms of the Mojo license in Section 1 (https://www.modular.com/legal/mojo) # prior to distributing pre-built container images. # ===----------------------------------------------------------------------=== # # Example command line: # Use no-cache to force docker to rebuild layers of the image by downloading the SDK from the repos # ./build-image.sh --auth-key <your-modular-auth-key> # FROM ubuntu:22.04 ARG DEFAULT_TZ=America/Los_Angeles ENV DEFAULT_TZ=$DEFAULT_TZ RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive TZ=$DEFAULT_TZ apt-get install -y \ tzdata \ vim \ nano \ sudo \ curl \ wget \ python3-pip \ git && \ rm -rf /var/lib/apt/lists/* # Download the latest version of minicoda py3.8 for linux x86/x64. # RUN curl -fsSL https://repo.anaconda.com/miniconda/$( wget -O - https://repo.anaconda.com/miniconda/ 2>/dev/null | grep -o 'Miniconda3-py38_[^"]*-Linux-x86_64.sh' | head -n 1) > /tmp/miniconda.sh \ # && chmod +x /tmp/miniconda.sh \ # && /tmp/miniconda.sh -b -p /opt/conda # RUN mkdir -p ~/miniconda3 \ # && wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh \ # && bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 \ # && rm -rf ~/miniconda3/miniconda.sh # ENV PATH=~/miniconda3/bin/conda:$PATH # RUN conda init RUN pip install \ pytest \ git+https://github.com/guidorice/mojo-pytest.git # RUN pip install \ # jupyterlab \ # ipykernel \ # matplotlib \ # ipywidgets RUN curl https://get.modular.com | sh - # RUN modular auth examples && modular install nightly/mojo RUN modular auth examples && modular install mojo ARG MODULAR_HOME="/root/.modular" ENV MODULAR_HOME=$MODULAR_HOME # ENV PATH="$PATH:$MODULAR_HOME/pkg/packages.modular.com_nightly_mojo/bin" ENV PATH="$PATH:$MODULAR_HOME/pkg/packages.modular.com_mojo/bin" # Change permissions to allow for Apptainer/Singularity containers RUN chmod -R a+rwX /root # CMD ["jupyter", "lab", "--ip='*'", "--NotebookApp.token=''", "--NotebookApp.password=''","--allow-root"] --- .devcontainer/devcontainer.json --- { "name": "Mojo", "build": { "dockerfile": "Dockerfile" }, "customizations": { // Configure properties specific to VS Code. "vscode": { // Set *default* container specific settings.json values on container create. "settings": {}, "extensions": [ "modular-mojotools.vscode-mojo", // "ms-toolsai.jupyter" // "modular-mojotools.vscode-mojo-nightly" ] } } } --- .github/workflows/test.yml --- name: Run Tests on: pull_request: jobs: test: runs-on: ubuntu-latest environment: basic steps: - name: Check out repository code uses: actions/checkout@v2 - name: Install dependencies run: | curl https://get.modular.com | MODULAR_AUTH=${{ secrets.MODULAR_AUTH }} sh - modular auth ${{ secrets.MODULAR_AUTH }} modular install mojo pip install pytest pip install git+https://github.com/guidorice/mojo-pytest.git - name: Unit Tests run: | export MODULAR_HOME="/home/runner/.modular" export PATH="/home/runner/.modular/pkg/packages.modular.com_mojo/bin:$PATH" pytest tests/unit pytest tests/integration bash run_examples.sh --- .gitignore --- # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ --- .pre-commit-config.yaml --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: local hooks: - id: mojo-format name: mojo-format entry: mojo format -l 120 language: system files: '\.(mojo|🔥)$' stages: [commit] --- LICENSE --- MIT License Copyright (c) 2024 Mikhail Tavarez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Mog ![Mojo 24.4](https://img.shields.io/badge/Mojo%F0%9F%94%A5-24.4-purple) Style definitions for nice terminal layouts. Built with TUIs in mind. Ported from/Inspired by: <https://github.com/charmbracelet/lipgloss/tree/master> If you're a Go developer, please check out their CLI tooling and libraries. They're unmatched! For bugs and todos, see the bottom of the readme. At the moment, characters with a printable length greater than 1 ARE NOT supported. You should be able to build the package by running `mojo package mog -I external`. For the easiest usage method, I recommend just copying the entire external folder into your repository, then copy the `mog` folder into the external folder as well. > NOTE: It seems like `.mojopkg` files don't like being part of another package, eg. sticking all of your external deps in an `external` or `vendor` package. The only way I've gotten mojopkg files to work is to be in the same directory as the file being executed, and that directory cannot be a mojo package. ![Mog example](https://github.com/thatstoasty/mog/blob/main/demos/tapes/layout.gif) Mog takes an expressive, declarative approach to terminal rendering. Users familiar with CSS will feel at home with Mog. ```mojo import mog var style = mog.Style() \ .bold(True) \ .foreground(mog.Color(0xFAFAFA)) \ .background(mog.Color(0x7D56F4)) \ .padding_top(2) \ .padding_left(4) \ .width(22) print(style.render("Hello, kitty")) ``` ## Colors Mog supports the following color profiles: ### ANSI 16 colors (4-bit) ```mojo mog.Color(5) # magenta mog.Color(9) # red mog.Color(12) # light blue ``` ### ANSI 256 Colors (8-bit) ```mojo mog.Color(86) # aqua mog.Color(201) # hot pink mog.Color(202) # orange ``` ### True Color (16,777,216 colors; 24-bit) ```mojo mog.Color(0x0000FF) # good ol' 100% blue mog.Color(0x04B575) # a green mog.Color(0x3C3C3C) # a dark gray ``` ...as well as a 1-bit ASCII profile, which is black and white only. The terminal's color profile will soon be automatically detected, and colors outside the gamut of the current palette will be automatically coerced to their closest available value. For now, the library assumes a dark background. You can set this to light by modifying the style's profile field. ### Adaptive Colors You can also specify color options for light and dark backgrounds: ```mojo mog.AdaptiveColor(light=236, dark=248) ``` The terminal's background color will automatically be detected and the appropriate color will be chosen at runtime. ### Complete Colors CompleteColor specifies exact values for truecolor, ANSI256, and ANSI color profiles. ```mojo mog.CompleteColor(true_color=0x0000FF, ansi256=86, ansi=5) ``` Automatic color degradation will not be performed in this case and it will be based on the color specified. ### Complete Adaptive Colors You can use CompleteColor with AdaptiveColor to specify the exact values for light and dark backgrounds without automatic color degradation. ```mojo mog.CompleteAdaptiveColor( light = mog.CompleteColor(true_color=0xd7ffae, ansi256=193, ansi=11), dark = mog.CompleteColor(true_color=0xd75fee, ansi256=163, ansi=5), ) ``` ## Inline Formatting Mog supports the usual ANSI text formatting options: ```mojo var style = mog.Style() \ .bold(True) \ .italic(True) \ .faint(True) \ .blink(True) \ .crossout(True) \ .underline(True) \ .reverse(True) ``` ## Block-Level Formatting Mog also supports rules for block-level formatting: ```mojo # Padding var style = mog.Style() \ .padding_top(2) \ .padding_right(4) \ .padding_bottom(2) \ .padding_left(4) # Margins var style = mog.Style() \ .margin_top(2) \ .margin_right(4) \ .margin_bottom(2) \ .margin_left(4) ``` There is also shorthand syntax for margins and padding, which follows the same format as CSS: ```mojo # 2 cells on all sides mog.Style().padding(2) # 2 cells on the top and bottom, 4 cells on the left and right mog.Style().margin(2, 4) # 1 cell on the top, 4 cells on the sides, 2 cells on the bottom mog.Style().padding(1, 4, 2) # Clockwise, starting from the top: 2 cells on the top, 4 on the right, 3 on # the bottom, and 1 on the left mog.Style().margin(2, 4, 3, 1) ``` ## Aligning Text You can align paragraphs of text to the left, right, or center. ```mojo var style = mog.Style() \ .width(24) \ .align(position.left) \ # align it left .align(position.right) \ # no wait, align it right .align(position.center) # just kidding, align it in the center ``` ## Width and Height Setting a minimum width and height is simple and straightforward. ```mojo var style = mog.Style() \ .set_string("What’s for lunch?") \ .width(24) \ .height(32) \ .foreground(mog.Color(63)) ``` ## Borders Adding borders is easy: ```mojo # Add a purple, rectangular border var style = mog.Style() \ .border(NORMAL_BORDER) \ .border_foreground(mog.Color(63)) # Set a rounded, yellow-on-purple border to the top and left var another_style = mog.Style() \ .border(ROUNDED_BORDER) \ .border_foreground(mog.Color(228)) \ .border_background(mog.Color(63)) \ .border_top(True) \ .border_left(True) # Make your own border var my_cute_border = Border( top = "._.:*:", bottom = "._.:*:", left = "|*", right = "|*", top_left = "*", top_right = "*", bottom_left = "*", bottom_right = "*", ) ``` There are also shorthand functions for defining borders, which follow a similar pattern to the margin and padding shorthand functions. ```mojo # Add a thick border to the top and bottom mog.Style().border(THICK_BORDER, True, False) # Add a double border to the top and left sides. Rules are set clockwise # from top. mog.Style().border(DOUBLE_BORDER, True, False, False, True) ``` ## Unsetting Rules All rules can be unset: ```mojo var style = mog.Style() \ .bold(True) \ # make it bold .unset_bold() \ # jk don't make it bold .background(mog.Color(227)) \ # yellow background .unset_background() # never mind ``` When a rule is unset, it won't be inherited or copied. ## Enforcing Rules Sometimes, such as when developing a component, you want to make sure style definitions respect their intended purpose in the UI. This is where `inline` and `max_width`, and `max_height` come in: ```mojo # Force rendering onto a single line, ignoring margins, padding, and borders. some_style.inline(True).render("yadda yadda") # Also limit rendering to five cells some_style.inline(True).max_width(5).render("yadda yadda") # Limit rendering to a 5x5 cell block some_style.max_width(5).max_height(5).render("yadda yadda") ``` ## Tabs The tab character (`\t`) is rendered differently in different terminals (often as 8 spaces, sometimes 4). Because of this inconsistency, Mog converts tabs to 4 spaces at render time. This behavior can be changed on a per-style basis, however: ```mojo style = mog.Style() # tabs will render as 4 spaces, the default style = style.tab_width(2) # render tabs as 2 spaces style = style.tab_width(0) # remove tabs entirely style = style.tab_width(mog.NO_TAB_CONVERSION) # leave tabs intact ``` ## Rendering Generally, you just call the `render(string)` method on a `mog.Style`: ```mojo var style = mog.Style().bold(True).set_string("Hello,") print(style.render("kitty.")) # Hello, kitty. print(style.render("puppy.")) # Hello, puppy. print(style.render("my", "puppy.")) # Hello, my puppy. ``` But you could also use the Stringer interface: ```mojo var style = mog.Style().set_string("你好,猫咪。").bold(True) print(style) # 你好,猫咪。 ``` ### Custom Renderers Custom renderers allow you to render to a specific outputs. This is particularly important when you want to render to different outputs and correctly detect the color profile and dark background status for each, such as in a server-client situation. ```mojo fn my_little_handler(): # Create a renderer for the client. renderer = mog.new_renderer() # Create a new style on the renderer. style = renderer.new_style().background(mog.AdaptiveColor(light=63, dark=228)) # render. The color profile and dark background state will be correctly detected. style.render("Heyyyyyyy") ``` ## Utilities In addition to pure styling, Mog also ships with some utilities to help assemble your layouts. ### Joining Paragraphs Horizontally and vertically joining paragraphs is a cinch. ```mojo # Horizontally join three paragraphs along their bottom edges join_horizontal(bottom, paragraph_a, paragraph_b, paragraph_c) # Vertically join two paragraphs along their center axes join_vertical(center, paragraph_a, paragraph_b) # Horizontally join three paragraphs, with the shorter ones aligning 20% # from the top of the tallest join_horizontal(0.2, paragraph_a, paragraph_b, paragraph_c) ``` ### Measuring Width and Height Sometimes you’ll want to know the width and height of text blocks when building your layouts. ```mojo # render a block of text. var style = mog.Style() \ .width(40) \ .padding(2) var block string = style.render(some_long_string) # Get the actual, physical dimensions of the text block. width = mog.get_width(block) height = mog.get_height(block) # Here's a shorthand function. var width = 0 var height = 0 width, height = mog.get_size(block) ``` ### Placing Text in Whitespace Sometimes you’ll simply want to place a block of text in whitespace. ```mojo # Center a paragraph horizontally in a space 80 cells wide. The height of # the block returned will be as tall as the input paragraph. block = place_horizontal(80, mog.center, fancy_styled_paragraph) # Place a paragraph at the bottom of a space 30 cells tall. The width of # the text block returned will be as wide as the input paragraph. block = place_vertical(30, mog.bottom, fancy_styled_paragraph) # Place a paragraph in the bottom right corner of a 30x80 cell space. block = place(30, 80, mog.right, mog.bottom, fancy_styled_paragraph) ``` ### Rendering Tables Mog ships with a table rendering sub-package. ```mojo import mog.table ``` Define some rows of data. ```mojo rows = List[List[String]]( List[String]("Chinese", "您好", "你好"), List[String]("Japanese", "こんにちは", "やあ"), List[String]("Arabic", "أهلين", "أهلا"), List[String]("Russian", "Здравствуйте", "Привет"), List[String]("Spanish", "Hola", "¿Qué tal?"), ) ``` Use the table package to style and render the table. ```mojo t = table.new_table(). .border(NORMAL_BORDER) \ .border_style(mog.Style().foreground(mog.Color(99))) \ .headers("LANGUAGE", "FORMAL", "INFORMAL") \ .rows(rows) # You can also add tables row-by-row t.row("English", "You look absolutely fabulous.", "How's it going?") ``` Print the table. ```mojo print(t) ``` Here's an example table rendering! ![Mog example](https://github.com/thatstoasty/mog/blob/main/demos/tapes/pokemon.gif) --- ## TODO - Decompose style render mega function and mega class into smaller ones. - It seems like renderer.place_vertical renders whitespace with a width that's too long in the Ubuntu test container. Will need to investigate why this happened. It might be because the execution environment is not necessarily a terminal. ## Notes - ANSI256's support of setting both foreground and background colors is limited. It's possible to set both, but often the foreground color will be ignored. --- benchmarks/__init__.mojo --- --- benchmarks/basic_styling.mojo --- import mog from benchmark.compiler import keep fn basic_styling(): var style = ( mog.Style() .bold(True) .foreground(mog.Color(0xFAFAFA)) .background(mog.Color(0x7D56F4)) .padding_top(2) .padding_left(4) .width(22) ) var output = style.render("Hello, kitty") keep(output) var file_style = ( mog.Style() .bold(True) .foreground(mog.Color(0xFAFAFA)) .background(mog.Color(0x7D56F4)) .padding_top(2) .padding_left(4) .width(22) ) fn basic_comptime_styling(): var output = file_style.render("Hello, kitty") keep(output) fn basic_styling_big_file(): var content: String = "" try: with open("./benchmarks/data/big.txt", "r") as file: content = file.read() var style = mog.Style().bold(True).foreground(mog.Color(0xFAFAFA)).background(mog.Color(0x7D56F4)).width( 100 ) var output = style.render(content) keep(output) except e: print(e) --- benchmarks/data/big.txt --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet risus. Ornare arcu odio ut sem nulla pharetra diam sit. Ut pharetra sit amet aliquam. Tortor at auctor urna nunc id cursus metus aliquam. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Sit amet venenatis urna cursus eget. Nisi quis eleifend quam adipiscing vitae proin sagittis. Proin sed libero enim sed faucibus turpis. Condimentum vitae sapien pellentesque habitant morbi tristique senectus. Ut faucibus pulvinar elementum integer. Justo nec ultrices dui sapien eget. Faucibus interdum posuere lorem ipsum dolor sit amet. Ornare aenean euismod elementum nisi quis. Nibh tellus molestie nunc non. In iaculis nunc sed augue lacus viverra vitae congue eu. Quam adipiscing vitae proin sagittis nisl. Massa massa ultricies mi quis. Non enim praesent elementum facilisis leo. Nam aliquam sem et tortor consequat id porta nibh venenatis. Sagittis purus sit amet volutpat consequat mauris nunc congue. Non arcu risus quis varius quam quisque id diam. Amet risus nullam eget felis. Metus vulputate eu scelerisque felis imperdiet proin fermentum. Massa tempor nec feugiat nisl. Laoreet non curabitur gravida arcu ac tortor. Iaculis nunc sed augue lacus viverra. Nisl condimentum id venenatis a condimentum vitae. Libero id faucibus nisl tincidunt. Vitae purus faucibus ornare suspendisse sed nisi. Tempor nec feugiat nisl pretium fusce id. Habitant morbi tristique senectus et netus et malesuada fames ac. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero. Lorem ipsum dolor sit amet. Suspendisse in est ante in nibh mauris cursus mattis molestie. Sagittis eu volutpat odio facilisis. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Arcu ac tortor dignissim convallis aenean et. Sed vulputate mi sit amet mauris commodo quis imperdiet. Felis bibendum ut tristique et egestas quis ipsum suspendisse. At quis risus sed vulputate odio ut. Nullam eget felis eget nunc lobortis mattis aliquam. A pellentesque sit amet porttitor eget dolor morbi non. Congue quisque egestas diam in. Ipsum consequat nisl vel pretium lectus quam id leo in. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Sagittis id consectetur purus ut faucibus pulvinar elementum. Fusce id velit ut tortor pretium viverra suspendisse. Tellus orci ac auctor augue mauris augue neque gravida. Vestibulum mattis ullamcorper velit sed. Aliquet eget sit amet tellus cras adipiscing enim. Donec massa sapien faucibus et molestie ac feugiat sed. Sed risus pretium quam vulputate dignissim suspendisse. Non pulvinar neque laoreet suspendisse interdum. Ac feugiat sed lectus vestibulum mattis ullamcorper. Aliquam vestibulum morbi blandit cursus risus at. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Neque egestas congue quisque egestas diam. At consectetur lorem donec massa sapien faucibus et molestie ac. Tristique nulla aliquet enim tortor at auctor. Donec et odio pellentesque diam volutpat commodo. Tincidunt dui ut ornare lectus. Enim blandit volutpat maecenas volutpat blandit aliquam etiam. Egestas sed tempus urna et pharetra. Et malesuada fames ac turpis egestas sed tempus urna. Dictum varius duis at consectetur lorem donec massa sapien. Netus et malesuada fames ac turpis. Lacinia quis vel eros donec. Cras adipiscing enim eu turpis egestas pretium aenean pharetra magna. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi. Iaculis eu non diam phasellus vestibulum lorem sed risus ultricies. At tellus at urna condimentum. Aliquam faucibus purus in massa tempor nec feugiat. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Blandit libero volutpat sed cras. Duis at tellus at urna condimentum mattis pellentesque id nibh. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. At auctor urna nunc id cursus metus. Mattis enim ut tellus elementum sagittis. Lectus arcu bibendum at varius vel pharetra vel turpis. Ut sem nulla pharetra diam sit amet. Quis risus sed vulputate odio ut enim blandit. Neque laoreet suspendisse interdum consectetur. Eget est lorem ipsum dolor sit amet consectetur adipiscing. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Pharetra convallis posuere morbi leo urna molestie. Pellentesque massa placerat duis ultricies. Ultrices neque ornare aenean euismod elementum nisi quis. Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sed viverra tellus in hac habitasse platea dictumst. Pharetra vel turpis nunc eget lorem dolor sed. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit. Blandit cursus risus at ultrices mi tempus imperdiet. Rhoncus dolor purus non enim praesent elementum facilisis. Phasellus egestas tellus rutrum tellus pellentesque. Venenatis urna cursus eget nunc scelerisque. Ultricies leo integer malesuada nunc. Praesent elementum facilisis leo vel. Neque vitae tempus quam pellentesque nec nam aliquam sem et. Eget sit amet tellus cras. Leo vel fringilla est ullamcorper eget nulla facilisi etiam. Eget nullam non nisi est sit amet facilisis magna. Nunc scelerisque viverra mauris in aliquam sem fringilla ut. Mauris vitae ultricies leo integer malesuada nunc vel. Vel risus commodo viverra maecenas. Facilisis gravida neque convallis a. Urna id volutpat lacus laoreet non curabitur gravida arcu. Facilisis gravida neque convallis a cras semper. Orci ac auctor augue mauris augue neque gravida in. Tristique magna sit amet purus gravida quis blandit turpis. Duis ut diam quam nulla porttitor. Congue eu consequat ac felis donec et. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Egestas quis ipsum suspendisse ultrices gravida dictum fusce. Congue nisi vitae suscipit tellus mauris. Praesent tristique magna sit amet. Vitae proin sagittis nisl rhoncus. Tincidunt augue interdum velit euismod. Urna molestie at elementum eu. Arcu vitae elementum curabitur vitae nunc sed. Tempor commodo ullamcorper a lacus vestibulum sed arcu. Interdum velit laoreet id donec ultrices tincidunt. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Eu non diam phasellus vestibulum lorem sed risus. Sagittis vitae et leo duis ut diam quam nulla porttitor. Posuere lorem ipsum dolor sit amet. Molestie nunc non blandit massa. Nisl pretium fusce id velit. Porttitor leo a diam sollicitudin tempor id eu. At lectus urna duis convallis convallis tellus id interdum. Diam in arcu cursus euismod quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Dui vivamus arcu felis bibendum ut tristique et egestas quis. At varius vel pharetra vel turpis nunc. Laoreet non curabitur gravida arcu ac. Consectetur a erat nam at lectus urna duis convallis convallis. Non sodales neque sodales ut etiam sit. Facilisis gravida neque convallis a cras. Amet nisl suscipit adipiscing bibendum. Leo a diam sollicitudin tempor id eu. Malesuada fames ac turpis egestas sed tempus. Tellus cras adipiscing enim eu turpis. Arcu non sodales neque sodales ut etiam sit. Faucibus turpis in eu mi bibendum neque egestas congue quisque. Placerat orci nulla pellentesque dignissim enim sit amet. Feugiat nisl pretium fusce id velit ut tortor pretium. Et ultrices neque ornare aenean euismod. Convallis a cras semper auctor neque. Ultricies tristique nulla aliquet enim tortor at auctor urna. Nisi est sit amet facilisis magna etiam tempor orci eu. Aliquam ultrices sagittis orci a scelerisque purus semper. Bibendum at varius vel pharetra vel turpis nunc eget. Pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Mi ipsum faucibus vitae aliquet. Lorem mollis aliquam ut porttitor. Hendrerit dolor magna eget est. Ipsum nunc aliquet bibendum enim facilisis. Rhoncus est pellentesque elit ullamcorper dignissim. Amet dictum sit amet justo donec enim diam vulputate ut. Justo laoreet sit amet cursus sit amet dictum sit amet. Adipiscing enim eu turpis egestas. Leo duis ut diam quam nulla porttitor massa id neque. Quis auctor elit sed vulputate mi sit amet. Potenti nullam ac tortor vitae purus. In nibh mauris cursus mattis molestie a iaculis. Dui sapien eget mi proin sed libero enim sed. Eget mi proin sed libero enim sed faucibus. Amet purus gravida quis blandit turpis. Porttitor lacus luctus accumsan tortor posuere. Habitasse platea dictumst quisque sagittis purus sit amet volutpat. Sit amet consectetur adipiscing elit ut aliquam. Id interdum velit laoreet id donec ultrices. In fermentum et sollicitudin ac orci phasellus egestas. Scelerisque felis imperdiet proin fermentum. Non tellus orci ac auctor augue mauris augue. Sed vulputate odio ut enim blandit volutpat. Ut placerat orci nulla pellentesque dignissim enim sit amet. Etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Venenatis lectus magna fringilla urna porttitor rhoncus. Neque gravida in fermentum et sollicitudin ac orci phasellus egestas. Cursus vitae congue mauris rhoncus aenean vel elit. Maecenas ultricies mi eget mauris pharetra et ultrices neque. Leo vel fringilla est ullamcorper. Massa placerat duis ultricies lacus sed turpis tincidunt. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Lobortis elementum nibh tellus molestie nunc. Justo nec ultrices dui sapien eget. Odio aenean sed adipiscing diam donec adipiscing tristique. Risus commodo viverra maecenas accumsan lacus vel. Et pharetra pharetra massa massa ultricies. Sit amet tellus cras adipiscing enim. Lacus vel facilisis volutpat est. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Sit amet luctus venenatis lectus magna fringilla. Ut sem viverra aliquet eget sit amet. Vulputate dignissim suspendisse in est ante in. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor eu. Ac ut consequat semper viverra nam libero justo laoreet sit. Imperdiet sed euismod nisi porta lorem. Nibh sit amet commodo nulla facilisi. In vitae turpis massa sed. Tempor id eu nisl nunc mi ipsum. Tincidunt augue interdum velit euismod in. Augue neque gravida in fermentum. Ut tortor pretium viverra suspendisse potenti nullam ac. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Sed arcu non odio euismod. Sit amet cursus sit amet dictum sit amet. Morbi enim nunc faucibus a pellentesque sit. Sapien eget mi proin sed libero. Ridiculus mus mauris vitae ultricies. Mi bibendum neque egestas congue quisque egestas diam. Tellus at urna condimentum mattis pellentesque. Pharetra vel turpis nunc eget lorem dolor sed viverra ipsum. Sed turpis tincidunt id aliquet. Tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Volutpat commodo sed egestas egestas. Tristique sollicitudin nibh sit amet commodo nulla facilisi. Volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Neque viverra justo nec ultrices. Laoreet suspendisse interdum consectetur libero. A cras semper auctor neque. Mi tempus imperdiet nulla malesuada pellentesque elit eget. Dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu. Amet risus nullam eget felis eget nunc lobortis. Sit amet facilisis magna etiam. Ut pharetra sit amet aliquam id diam maecenas. Ipsum dolor sit amet consectetur adipiscing elit ut. Ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Enim ut sem viverra aliquet eget sit amet tellus cras. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Interdum posuere lorem ipsum dolor sit. Lorem mollis aliquam ut porttitor leo a. Ac placerat vestibulum lectus mauris. Ipsum dolor sit amet consectetur adipiscing elit. Rhoncus aenean vel elit scelerisque. At augue eget arcu dictum varius duis at consectetur. Nisl rhoncus mattis rhoncus urna neque viverra. Urna id volutpat lacus laoreet non curabitur gravida arcu. Semper eget duis at tellus. Sed risus pretium quam vulputate dignissim. Cursus eget nunc scelerisque viverra mauris in aliquam. Libero enim sed faucibus turpis. Quis imperdiet massa tincidunt nunc pulvinar. Eget lorem dolor sed viverra ipsum nunc. Et egestas quis ipsum suspendisse. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Ante metus dictum at tempor commodo ullamcorper a lacus vestibulum. Tellus integer feugiat scelerisque varius. Duis ultricies lacus sed turpis tincidunt. Sagittis eu volutpat odio facilisis mauris. Ipsum dolor sit amet consectetur adipiscing elit. Fringilla phasellus faucibus scelerisque eleifend. Consequat id porta nibh venenatis cras. Dis parturient montes nascetur ridiculus mus mauris vitae. Rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi. Vivamus at augue eget arcu dictum varius duis at. Pharetra magna ac placerat vestibulum. Euismod quis viverra nibh cras pulvinar mattis. Neque gravida in fermentum et sollicitudin ac orci phasellus. Egestas congue quisque egestas diam in arcu. Et magnis dis parturient montes nascetur. Dolor sit amet consectetur adipiscing. Ut tristique et egestas quis ipsum. Turpis egestas sed tempus urna. Euismod elementum nisi quis eleifend quam adipiscing vitae. Nisl vel pretium lectus quam id leo. Proin sed libero enim sed faucibus turpis. Mi quis hendrerit dolor magna eget. Suspendisse ultrices gravida dictum fusce ut placerat. Habitasse platea dictumst quisque sagittis purus. Curabitur gravida arcu ac tortor. Commodo nulla facilisi nullam vehicula ipsum a. Sagittis vitae et leo duis ut diam quam. Pretium nibh ipsum consequat nisl vel pretium lectus. Arcu cursus euismod quis viverra. Risus nullam eget felis eget nunc lobortis. Aliquet eget sit amet tellus cras adipiscing enim eu. In mollis nunc sed id semper risus in. Sed egestas egestas fringilla phasellus faucibus scelerisque. A diam sollicitudin tempor id. Lacus laoreet non curabitur gravida. A diam maecenas sed enim ut. Id nibh tortor id aliquet lectus proin. Eget mi proin sed libero. Maecenas pharetra convallis posuere morbi leo urna. Id donec ultrices tincidunt arcu. Urna et pharetra pharetra massa massa ultricies. Pulvinar sapien et ligula ullamcorper malesuada proin libero. Nec nam aliquam sem et tortor consequat id porta. In vitae turpis massa sed. Praesent semper feugiat nibh sed pulvinar. Nascetur ridiculus mus mauris vitae ultricies. Ut aliquam purus sit amet luctus venenatis lectus magna fringilla. Sit amet mattis vulputate enim. Orci a scelerisque purus semper eget duis at tellus at. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Gravida arcu ac tortor dignissim convallis aenean et tortor. Ornare suspendisse sed nisi lacus sed viverra tellus in. Turpis egestas maecenas pharetra convallis posuere morbi. Elementum nisi quis eleifend quam adipiscing vitae. Maecenas sed enim ut sem. Feugiat in fermentum posuere urna nec tincidunt praesent. Suspendisse sed nisi lacus sed. Scelerisque in dictum non consectetur. Mauris commodo quis imperdiet massa. --- benchmarks/layout.mojo --- from benchmark.compiler import keep from external.gojo.strings import StringBuilder from external.weave.ansi import printable_rune_width import mog from mog.join import join_vertical, join_horizontal from mog.border import HIDDEN_BORDER, NORMAL_BORDER, ROUNDED_BORDER, Border from mog.style import Style from mog.size import get_width from mog import position from mog.whitespace import ( place, with_whitespace_chars, with_whitespace_foreground, ) import mog alias width = 96 alias column_width = 30 alias subtle = mog.AdaptiveColor(light=0xD9DCCF, dark=0x383838) alias highlight = mog.AdaptiveColor(light=0x874BFD, dark=0x7D56F4) alias special = mog.AdaptiveColor(light=0x43BF6D, dark=0x73F59F) fn build_tabs() -> String: alias active_tab_border = Border( top="─", bottom=" ", left="│", right="│", top_left="╭", top_right="╮", bottom_left="┘", bottom_right="└", ) alias tab_border = Border( top="─", bottom="─", left="│", right="│", top_left="╭", top_right="╮", bottom_left="┴", bottom_right="┴", ) var tab_style = mog.Style().border(tab_border).border_foreground(highlight).padding(0, 1) var active_tab = tab_style.border(active_tab_border, True) var tab_gap = tab_style.border_top(False).border_left(False).border_right(False) var row = join_horizontal( position.top, active_tab.render("Mog"), tab_style.render("Gojo"), tab_style.render("Lightbug"), tab_style.render("Basalt"), tab_style.render("Prism"), ) var gap = tab_gap.render(String(" ") * max(0, width - get_width(row) - 2)) return join_horizontal(position.bottom, row, gap) fn build_description() -> String: var divider = mog.Style().padding(0, 1).foreground(subtle).render("•") var url = mog.Style().foreground(special) var desc_style = mog.Style().margin_top(1) var info_style = mog.Style().border(NORMAL_BORDER, True, False, False, False).border_foreground(subtle) return join_vertical( position.left, desc_style.render("Style Definitions for Nice Terminal Layouts.\nInspired by charmbracelet/lipgloss"), info_style.render("From Mikhail" + divider + url.render("https://github.com/thatstoasty/mog")), ) fn build_dialog_box() -> String: var dialog_box_style = mog.Style().alignment(position.center).border(ROUNDED_BORDER).border_foreground( mog.Color(0x874BFD) ).padding(1, 0) var button_style = mog.Style().foreground(mog.Color(0xFFF7DB)).background(mog.Color(0x888B7E)).padding( 0, 3 ).margin_top(1) var active_button_style = button_style.foreground(mog.Color(0xFFF7DB)).background(mog.Color(0xF25D94)).margin_right( 2 ).underline() var ok_button = active_button_style.render("Yes") var cancel_button = button_style.render("Maybe") var question = mog.Style().width(50).alignment(position.center).render("Are you sure you want to eat marmalade?") var buttons = join_horizontal(position.top, ok_button, cancel_button) var ui = join_vertical(position.center, question, buttons) # TODO: Cannot handle unicode characters with a length greater than 1. For example: east asian characters like Kanji. return place( width, 9, position.center, position.center, dialog_box_style.render(ui), with_whitespace_chars["⣾⣽⣻⢿⡿⣟⣯⣷"](), with_whitespace_foreground[subtle](), ) fn build_lists() -> String: var list_style = mog.Style().border(NORMAL_BORDER, False, True, False, False).border_foreground( subtle ).margin_right(2).height(8).width(column_width + 1) var list_header = mog.Style().border(NORMAL_BORDER, False, False, True, False).border_foreground( subtle ).margin_right(2) var list_item = mog.Style().padding_left(2) var check_mark = mog.Style().foreground(special).padding_right(1).render("✔") var list_done = mog.Style().crossout().foreground(mog.AdaptiveColor(light=0x969B86, dark=0x696969)) var lists = join_horizontal( position.top, list_style.render( join_vertical( position.left, list_header.render("Citrus Fruits to Try"), check_mark + list_done.render("Grapefruit"), check_mark + list_done.render("Yuzu"), list_item.render("Citron"), list_item.render("Kumquat"), list_item.render("Pomelo"), ), ), list_style.width(column_width).render( join_vertical( position.left, list_header.render("Actual Lip Gloss Vendors"), list_item.render("Glossier"), list_item.render("Claire's Boutique"), check_mark + list_done.render("Nyx"), list_item.render("Mac"), check_mark + list_done.render("Milk"), ), ), list_style.width(column_width - 1).render( join_vertical( position.left, list_header.render("Programming Languages"), list_item.render("Mojo"), list_item.render("Rust"), check_mark + list_done.render("Python"), list_item.render("Gleam"), check_mark + list_done.render("Go"), ), ), ) return join_horizontal(position.top, lists) fn build_history() -> String: var history_style = mog.Style().height(20).width(column_width).padding(1, 2).margin(1, 3, 0, 0).alignment( position.left ).foreground(mog.Color(0xFFFDF5)).background(highlight) alias history_a = "The Romans learned from the Greeks that quinces slowly cooked with honey would “set” when cool. The Apicius gives a recipe for preserving whole quinces, stems and leaves attached, in a bath of honey diluted with defrutum: Roman marmalade. Preserves of quince and lemon appear (along with rose, apple, plum and pear) in the Book of ceremonies of the Byzantine Emperor Constantine VII Porphyrogennetos." alias history_b = "Medieval quince preserves, which went by the French name cotignac, produced in a clear version and a fruit pulp version, began to lose their medieval seasoning of spices in the 16th century. In the 17th century, La Varenne provided recipes for both thick and clear cotignac." alias history_c = "In 1524, Henry VIII, King of England, received a “box of marmalade” from Mr. Hull of Exeter. This was probably marmelada, a solid quince paste from Portugal, still made and sold in southern Europe today. It became a favourite treat of Anne Boleyn and her ladies in waiting." return join_horizontal( position.top, history_style.alignment(position.right).render(history_a), history_style.alignment(position.center).render(history_b), history_style.margin_right(0).render(history_c), ) fn build_status_bar() -> String: var status_nugget_style = mog.Style().foreground(mog.Color(0xFFFDF5)).padding(0, 1) var status_bar_style = mog.Style().foreground(mog.Color(0xC1C6B2)).background(mog.Color(0x353533)) var status_style = mog.Style().foreground(mog.Color(0xFFFDF5)).background(mog.Color(0xFF5F87)).padding(0, 1) # .margin_right(1) var encoding_style = status_nugget_style.background(mog.Color(0xA550DF)).horizontal_alignment(position.right) var status_text_style = status_bar_style.padding_left(1) var fish_cake_style = status_nugget_style.background(mog.Color(0x6124DF)) var status_key = status_style.render("STATUS") var encoding = encoding_style.render("UTF-8") var fish_cake = fish_cake_style.render("Fish Cake") var status_val = status_text_style.width( width - get_width(status_key) - get_width(encoding) - get_width(fish_cake) ).render("Ravishing") var bar = join_horizontal( position.top, status_key, status_val, encoding, fish_cake, ) return status_bar_style.width(width).render(bar) fn render_layout(): # The page style var builder = StringBuilder() var doc_style = mog.Style().padding(1, 2, 1, 2).border(ROUNDED_BORDER).border_foreground(subtle) # Tabs. _ = builder.write_string(build_tabs()) _ = builder.write_string("\n\n") # Title _ = builder.write_string(build_description()) _ = builder.write_string("\n\n") # Dialog box _ = builder.write_string(build_dialog_box()) _ = builder.write_string("\n\n") # List _ = builder.write_string(build_lists()) _ = builder.write_string("\n") # History _ = builder.write_string(build_history()) _ = builder.write_string("\n\n") # Status bar _ = builder.write_string(build_status_bar()) var output = doc_style.render(builder.render()) keep(output) --- benchmarks/run.mojo --- import benchmark from benchmarks.layout import render_layout from benchmarks.basic_styling import ( basic_styling, basic_styling_big_file, basic_comptime_styling, ) import mog var style = mog.Style().alignment(mog.center, mog.center).padding(0, 1) var header_style = style.foreground(mog.Color(0x39E506)) fn table_styling(row: Int, col: Int) -> mog.Style: if row == 0: return header_style else: return style fn main(): var results = mog.new_table() results.style_function = table_styling results = results.set_headers( "Name", "Mean (ms)", "Total (ms)", "Iterations", "Warmup Total", "Warmup Iterations", ) var report = benchmark.run[render_layout](max_iters=10) results = results.row( "Render layout", str(report.mean(benchmark.Unit.ms)), str(report.duration(benchmark.Unit.ms)), str(report.iters()), str(report.warmup_duration / 1e6), str(report.warmup_iters), ) var bs_report = benchmark.run[basic_styling](max_iters=50) results = results.row( "Basic styling", str(bs_report.mean(benchmark.Unit.ms)), str(bs_report.duration(benchmark.Unit.ms)), str(bs_report.iters()), str(bs_report.warmup_duration / 1e6), str(bs_report.warmup_iters), ) var bcs_report = benchmark.run[basic_comptime_styling](max_iters=50) results = results.row( "Basic comptime styling", str(bcs_report.mean(benchmark.Unit.ms)), str(bcs_report.duration(benchmark.Unit.ms)), str(bcs_report.iters()), str(bcs_report.warmup_duration / 1e6), str(bcs_report.warmup_iters), ) # var bs_big_report = benchmark.run[basic_styling_big_file](max_iters=10) # results.row( # "Large file test", # str(bs_big_report.mean(benchmark.Unit.ms)), # str(bs_big_report.duration(benchmark.Unit.ms)), # str(bs_big_report.iters()), # str(bs_big_report.warmup_duration / 1e6), # str(bs_big_report.warmup_iters), # ) print(results.render()) --- demos/tapes/layout.tape --- Output demos/tapes/layout.gif Set Shell "zsh" Set FontSize 20 Set Width 1600 Set Height 1600 Set WindowBar Colorful Set Framerate 30 Type "mojo run examples/readme/layout.mojo" Sleep 500ms Enter Sleep 15s --- demos/tapes/pokemon.tape --- Output demos/tapes/pokemon.gif Set Shell "zsh" Set FontSize 20 Set Width 1600 Set Height 1000 Set WindowBar Colorful Set Framerate 30 Type "mojo run examples/table/pokemon.mojo" Sleep 500ms Enter Sleep 10s --- examples/__init__.mojo --- --- examples/readme/__init__.mojo --- --- examples/readme/basic.mojo --- import mog fn main(): var style = ( mog.Style() .bold(True) .foreground(mog.Color(0xFAFAFA)) .background(mog.Color(0x7D56F4)) .padding_top(2) .padding_left(4) .width(22) ) print(style.render("Hello, kitty")) --- examples/readme/layout.mojo --- from external.gojo.strings import StringBuilder from external.weave.ansi import printable_rune_width from mog.join import join_vertical, join_horizontal from mog.border import HIDDEN_BORDER, NORMAL_BORDER, ROUNDED_BORDER, Border from mog.style import Style from mog.size import get_width from mog import position from mog.whitespace import ( place, with_whitespace_chars, with_whitespace_foreground, ) import mog alias width = 96 alias column_width = 30 alias subtle = mog.AdaptiveColor(light=0xD9DCCF, dark=0x383838) alias highlight = mog.AdaptiveColor(light=0x874BFD, dark=0x7D56F4) alias special = mog.AdaptiveColor(light=0x43BF6D, dark=0x73F59F) fn build_tabs() -> String: alias active_tab_border = Border( top="─", bottom=" ", left="│", right="│", top_left="╭", top_right="╮", bottom_left="┘", bottom_right="└", ) alias tab_border = Border( top="─", bottom="─", left="│", right="│", top_left="╭", top_right="╮", bottom_left="┴", bottom_right="┴", ) var tab_style = mog.Style().border(tab_border).border_foreground(highlight).padding(0, 1) var active_tab = tab_style.border(active_tab_border, True) var tab_gap = tab_style.border_top(False).border_left(False).border_right(False).border_bottom(True) var row = join_horizontal( position.top, active_tab.render("Mog"), tab_style.render("Gojo"), tab_style.render("Lightbug"), tab_style.render("Basalt"), tab_style.render("Prism"), ) var gap = tab_gap.render(String(" ") * max(0, width - get_width(row) - 2)) return join_horizontal(position.bottom, row, gap) fn build_description() -> String: var divider = mog.Style().padding(0, 1).foreground(subtle).render("•") var url = mog.Style().foreground(special) var desc_style = mog.Style().margin_top(1) var info_style = mog.Style().border(NORMAL_BORDER, True, False, False, False).border_foreground(subtle) return join_vertical( position.left, desc_style.render("Style Definitions for Nice Terminal Layouts.\nInspired by charmbracelet/lipgloss"), info_style.render("From Mikhail" + divider + url.render("https://github.com/thatstoasty/mog")), ) fn build_dialog_box() -> String: var dialog_box_style = mog.Style().alignment(position.center).border(ROUNDED_BORDER).border_foreground( mog.Color(0x874BFD) ).padding(1, 0) var button_style = mog.Style().foreground(mog.Color(0xFFF7DB)).background(mog.Color(0x888B7E)).padding( 0, 3 ).margin_top(1) var active_button_style = button_style.foreground(mog.Color(0xFFF7DB)).background(mog.Color(0xF25D94)).margin_right( 2 ).underline() var ok_button = active_button_style.render("Yes") var cancel_button = button_style.render("Maybe") var question = mog.Style().width(50).alignment(position.center).render("Are you sure you want to eat marmalade?") var buttons = join_horizontal(position.top, ok_button, cancel_button) var ui = join_vertical(position.center, question, buttons) # TODO: Cannot handle unicode characters with a length greater than 1. For example: east asian characters like Kanji. return place( width, 9, position.center, position.center, dialog_box_style.render(ui), with_whitespace_chars["⣾⣽⣻⢿⡿⣟⣯⣷"](), with_whitespace_foreground[subtle](), ) fn build_lists() -> String: var list_style = mog.Style().border(NORMAL_BORDER, False, True, False, False).border_foreground( subtle ).margin_right(2).height(8).width(column_width + 1) var list_header = mog.Style().border(NORMAL_BORDER, False, False, True, False).border_foreground( subtle ).margin_right(2) var list_item = mog.Style().padding_left(2) var check_mark = mog.Style().foreground(special).padding_right(1).render("✔") var list_done = mog.Style().crossout().foreground(mog.AdaptiveColor(light=0x969B86, dark=0x696969)) var lists = join_horizontal( position.top, list_style.render( join_vertical( position.left, list_header.render("Citrus Fruits to Try"), check_mark + list_done.render("Grapefruit"), check_mark + list_done.render("Yuzu"), list_item.render("Citron"), list_item.render("Kumquat"), list_item.render("Pomelo"), ), ), list_style.width(column_width).render( join_vertical( position.left, list_header.render("Actual Lip Gloss Vendors"), list_item.render("Glossier"), list_item.render("Claire's Boutique"), check_mark + list_done.render("Nyx"), list_item.render("Mac"), check_mark + list_done.render("Milk"), ), ), list_style.width(column_width - 1).render( join_vertical( position.left, list_header.render("Programming Languages"), list_item.render("Mojo"), list_item.render("Rust"), check_mark + list_done.render("Python"), list_item.render("Gleam"), check_mark + list_done.render("Go"), ), ), ) return join_horizontal(position.top, lists) fn build_history() -> String: var history_style = mog.Style().height(20).width(column_width).padding(1, 2).margin(1, 3, 0, 0).alignment( position.left ).foreground(mog.Color(0xFFFDF5)).background(highlight) alias history_a = "The Romans learned from the Greeks that quinces slowly cooked with honey would “set” when cool. The Apicius gives a recipe for preserving whole quinces, stems and leaves attached, in a bath of honey diluted with defrutum: Roman marmalade. Preserves of quince and lemon appear (along with rose, apple, plum and pear) in the Book of ceremonies of the Byzantine Emperor Constantine VII Porphyrogennetos." alias history_b = "Medieval quince preserves, which went by the French name cotignac, produced in a clear version and a fruit pulp version, began to lose their medieval seasoning of spices in the 16th century. In the 17th century, La Varenne provided recipes for both thick and clear cotignac." alias history_c = "In 1524, Henry VIII, King of England, received a “box of marmalade” from Mr. Hull of Exeter. This was probably marmelada, a solid quince paste from Portugal, still made and sold in southern Europe today. It became a favourite treat of Anne Boleyn and her ladies in waiting." return join_horizontal( position.top, history_style.alignment(position.right).render(history_a), history_style.alignment(position.center).render(history_b), history_style.margin_right(0).render(history_c), ) fn build_status_bar() -> String: var status_nugget_style = mog.Style().foreground(mog.Color(0xFFFDF5)).padding(0, 1) var status_bar_style = mog.Style().foreground(mog.Color(0xC1C6B2)).background(mog.Color(0x353533)) var status_style = mog.Style().foreground(mog.Color(0xFFFDF5)).background(mog.Color(0xFF5F87)).padding(0, 1) # .margin_right(1) var encoding_style = status_nugget_style.background(mog.Color(0xA550DF)).horizontal_alignment(position.right) var status_text_style = status_bar_style.padding_left(1) var fish_cake_style = status_nugget_style.background(mog.Color(0x6124DF)) var status_key = status_style.render("STATUS") var encoding = encoding_style.render("UTF-8") var fish_cake = fish_cake_style.render("Fish Cake") var status_val = status_text_style.width( width - get_width(status_key) - get_width(encoding) - get_width(fish_cake) ).render("Ravishing") var bar = join_horizontal( position.top, status_key, status_val, encoding, fish_cake, ) return status_bar_style.width(width).render(bar) fn main(): # The page style var builder = StringBuilder() var doc_style = mog.Style().padding(1, 2, 1, 2).border(ROUNDED_BORDER).border_foreground(subtle) # Tabs. _ = builder.write_string(build_tabs()) _ = builder.write_string("\n\n") # Title _ = builder.write_string(build_description()) _ = builder.write_string("\n\n") # Dialog box _ = builder.write_string(build_dialog_box()) _ = builder.write_string("\n\n") # List _ = builder.write_string(build_lists()) _ = builder.write_string("\n") # History _ = builder.write_string(build_history()) _ = builder.write_string("\n\n") # Status bar _ = builder.write_string(build_status_bar()) # Render the final document with doc_style print(doc_style.render(builder.render())) --- examples/table/__init__.mojo --- --- examples/table/ansi.mojo --- import mog fn main(): var s = mog.Style().foreground(mog.Color(240)) var table = mog.new_table() table.width = 50 table = ( table.row("Bubble Tea", s.render("Milky")) .row("Milk Tea", s.render("Also milky")) .row("Actual milk", s.render("Milky as well")) ) print(table.render()) --- examples/table/pokemon.mojo --- import mog # TODO: There's an issue with rows being taller than 1 line. Adding vertical padding will break the table. var style = mog.Style().padding(0, 1) var header_style = style.bold().foreground(mog.Color(252)) var selected_style = style.foreground(mog.Color(0x01BE85)).background(mog.Color(0x00432F)) var headers = List[String]("#", "Name", "Type 1", "Type 2", "Japanese", "Official Rom.") var data = List[List[String]]( List[String]("1", "Bulbasaur", "Grass", "Poison", "フシギダネ", "Bulbasaur"), List[String]("2", "Ivysaur", "Grass", "Poison", "フシギソウ", "Ivysaur"), List[String]("3", "Venusaur", "Grass", "Poison", "フシギバナ", "Venusaur"), List[String]("4", "Charmander", "Fire", "", "ヒトカゲ", "Hitokage"), List[String]("5", "Charmeleon", "Fire", "", "リザード", "Lizardo"), List[String]("5", "Charmeleon", "Fire", "Flying", "リザードン", "Lizardon"), List[String]("7", "Squirtle", "Water", "", "ゼニガメ", "Zenigame"), List[String]("8", "Wartortle", "Water", "", "カメール", "Kameil"), List[String]("9", "Blastoise", "Water", "", "カメックス", "Kamex"), List[String]("10", "Caterpie", "Bug", "", "キャタピー", "Caterpie"), List[String]("11", "Metapod", "Bug", "", "トランセル", "Trancell"), List[String]("12", "Butterfree", "Bug", "Flying", "バタフリー", "Butterfree"), List[String]("13", "Weedle", "Bug", "Poison", "ビードル", "Beedle"), List[String]("14", "Kakuna", "Bug", "Poison", "コクーン", "Cocoon"), List[String]("15", "Beedrill", "Bug", "Poison", "スピアー", "Spear"), List[String]("16", "Pidgey", "Normal", "Flying", "ポッポ", "Poppo"), List[String]("17", "Pidgeotto", "Normal", "Flying", "ピジョン", "Pigeon"), List[String]("18", "Pidgeot", "Normal", "Flying", "ピジョット", "Pigeot"), List[String]("19", "Rattata", "Normal", "", "コラッタ", "Koratta"), List[String]("20", "Raticate", "Normal", "", "ラッタ", "Ratta"), List[String]("21", "Spearow", "Normal", "Flying", "オニスズメ", "Onisuzume"), List[String]("22", "Fearow", "Normal", "Flying", "オニドリル", "Onidrill"), List[String]("23", "Ekans", "Poison", "", "アーボ", "Arbo"), List[String]("24", "Arbok", "Poison", "", "アーボック", "Arbok"), List[String]("25", "Pikachu", "Electric", "", "ピカチュウ", "Pikachu"), List[String]("26", "Raichu", "Electric", "", "ライチュウ", "Raichu"), List[String]("27", "Sandshrew", "Ground", "", "サンド", "Sand"), List[String]("28", "Sandslash", "Ground", "", "サンドパン", "Sandpan"), ) fn get_type_colors() -> Dict[String, mog.Color]: var type_colors = Dict[String, mog.Color]() type_colors["Bug"] = mog.Color(0xD7FF87) type_colors["Electric"] = mog.Color(0xFDFF90) type_colors["Fire"] = mog.Color(0xFF7698) type_colors["Flying"] = mog.Color(0xFF87D7) type_colors["Grass"] = mog.Color(0x75FBAB) type_colors["Ground"] = mog.Color(0xFF875F) type_colors["Normal"] = mog.Color(0x929292) type_colors["Poison"] = mog.Color(0x7D5AFC) type_colors["Water"] = mog.Color(0x00E2C7) return type_colors var type_colors = get_type_colors() fn get_dim_type_colors() -> Dict[String, mog.Color]: var dim_type_colors = Dict[String, mog.Color]() dim_type_colors["Bug"] = mog.Color(0x97AD64) dim_type_colors["Electric"] = mog.Color(0xFCFF5F) dim_type_colors["Fire"] = mog.Color(0xBA5F75) dim_type_colors["Flying"] = mog.Color(0xC97AB2) dim_type_colors["Grass"] = mog.Color(0x59B980) dim_type_colors["Ground"] = mog.Color(0xC77252) dim_type_colors["Normal"] = mog.Color(0x727272) dim_type_colors["Poison"] = mog.Color(0x634BD0) dim_type_colors["Water"] = mog.Color(0x439F8E) return dim_type_colors var dim_type_colors = get_dim_type_colors() fn style_func(row: Int, col: Int) -> mog.Style: if row == 0: return header_style if data[row - 1][1] == "Pikachu": return selected_style var is_even = (row % 2 == 0) if col == 2 or col == 3: var colors = type_colors if is_even: colors = dim_type_colors var color = colors.get(data[row - 1][col], mog.Color(0xFFFFFF)) return style.foreground(color) if is_even: return style.foreground(mog.Color(245)) return style.foreground(mog.Color(252)) fn main(): fn capitalize_headers(data: List[String]) -> List[String]: var upper = List[String]() for element in data: upper.append(element[].upper()) return upper var table = mog.Table( width=100, border_style=mog.Style().foreground(mog.Color(238)), headers=capitalize_headers(headers), style_function=style_func, ).rows(data) print(table.render()) --- external/__init__.mojo --- --- external/gojo/__init__.mojo --- --- external/gojo/builtins/__init__.mojo --- from .bytes import Byte, index_byte, has_suffix, has_prefix, to_string from .attributes import cap, copy from .errors import exit, panic alias Rune = Int32 --- external/gojo/builtins/attributes.mojo --- from collections import InlineList fn copy[T: CollectionElement](inout target: List[T], source: List[T], start: Int = 0) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: target: The buffer to copy into. source: The buffer to copy from. start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(len(source)): if i + start > len(target): target[i + start] = source[i] else: target.append(source[i]) count += 1 return count fn copy[T: CollectionElement](inout target_span: Span[T, True], source_span: Span[T], start: Int = 0) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: target_span: The buffer to copy into. source_span: The buffer to copy from. start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(len(source_span)): target_span[i + start] = source_span[i] count += 1 target_span._len += count return count fn copy[T: CollectionElement](inout target_span: Span[T, True], source: InlineList[T], start: Int = 0) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: target_span: The buffer to copy into. source: The buffer to copy from. start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(len(source)): target_span[i + start] = source[i] count += 1 target_span._len += count return count fn test(inout dest: List[UInt8]): var source = List[UInt8](1, 2, 3) var target = Span[UInt8](dest) _ = copy(target, Span(source), start=0) fn copy[T: CollectionElement](inout list: InlineList[T], source: Span[T], start: Int = 0) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: list: The buffer to copy into. source: The buffer to copy from. start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(len(source)): if i + start > len(list): list[i + start] = source[i] else: list.append(source[i]) count += 1 return count fn copy( inout target: List[UInt8], source: DTypePointer[DType.uint8], source_start: Int, source_end: Int, target_start: Int = 0, ) -> Int: """Copies the contents of source into target at the same index. Returns the number of bytes copied. Added a start parameter to specify the index to start copying into. Args: target: The buffer to copy into. source: The buffer to copy from. source_start: The index to start copying from. source_end: The index to stop copying at. target_start: The index to start copying into. Returns: The number of bytes copied. """ var count = 0 for i in range(source_start, source_end): if i + target_start > len(target): target[i + target_start] = source[i] else: target.append(source[i]) count += 1 return count fn cap[T: CollectionElement](iterable: List[T]) -> Int: """Returns the capacity of the List. Args: iterable: The List to get the capacity of. """ return iterable.capacity --- external/gojo/builtins/bytes.mojo --- alias Byte = UInt8 fn equals(left: List[UInt8], right: List[UInt8]) -> Bool: if len(left) != len(right): return False for i in range(len(left)): if left[i] != right[i]: return False return True fn has_prefix(bytes: List[Byte], prefix: List[Byte]) -> Bool: """Reports whether the List[Byte] struct begins with prefix. Args: bytes: The List[Byte] struct to search. prefix: The prefix to search for. Returns: True if the List[Byte] struct begins with prefix; otherwise, False. """ var len_comparison = len(bytes) >= len(prefix) var prefix_comparison = equals(bytes[0 : len(prefix)], prefix) return len_comparison and prefix_comparison fn has_suffix(bytes: List[Byte], suffix: List[Byte]) -> Bool: """Reports whether the List[Byte] struct ends with suffix. Args: bytes: The List[Byte] struct to search. suffix: The prefix to search for. Returns: True if the List[Byte] struct ends with suffix; otherwise, False. """ var len_comparison = len(bytes) >= len(suffix) var suffix_comparison = equals(bytes[len(bytes) - len(suffix) : len(bytes)], suffix) return len_comparison and suffix_comparison fn index_byte(bytes: List[Byte], delim: Byte) -> Int: """Return the index of the first occurrence of the byte delim. Args: bytes: The List[Byte] struct to search. delim: The byte to search for. Returns: The index of the first occurrence of the byte delim. """ for i in range(len(bytes)): if bytes[i] == delim: return i return -1 fn index_byte(bytes: DTypePointer[DType.uint8], size: Int, delim: Byte) -> Int: """Return the index of the first occurrence of the byte delim. Args: bytes: The DTypePointer[DType.int8] struct to search. size: The size of the bytes pointer. delim: The byte to search for. Returns: The index of the first occurrence of the byte delim. """ for i in range(size): if UInt8(bytes[i]) == delim: return i return -1 fn index_byte(bytes: Span[UInt8], delim: Byte) -> Int: """Return the index of the first occurrence of the byte delim. Args: bytes: The Span to search. delim: The byte to search for. Returns: The index of the first occurrence of the byte delim. """ for i in range(len(bytes)): if bytes[i] == delim: return i return -1 fn to_string(bytes: List[Byte]) -> String: """Makes a deepcopy of the List[Byte] supplied and converts it to a string. If it's not null terminated, it will append a null byte. Args: bytes: The List[Byte] struct to convert. Returns: The string representation of the List[Byte] struct. """ var copy = List[Byte](bytes) if copy[-1] != 0: copy.append(0) return String(copy) --- external/gojo/builtins/errors.mojo --- from sys import exit fn panic[T: Stringable](message: T, code: Int = 1): """Panics the program with the given message and exit code. Args: message: The message to panic with. code: The exit code to panic with. """ print("panic:", message) exit(code) --- external/gojo/bytes/__init__.mojo --- from .buffer import Buffer, new_buffer from .reader import Reader, new_reader --- external/gojo/bytes/buffer.mojo --- import ..io from ..builtins import copy, Byte, panic, index_byte from algorithm.memory import parallel_memcpy alias Rune = Int32 # SMALL_BUFFER_SIZE is an initial allocation minimal capacity. alias SMALL_BUFFER_SIZE: Int = 64 # The ReadOp constants describe the last action performed on # the buffer, so that unread_rune and unread_byte can check for # invalid usage. op_read_runeX constants are chosen such that # converted to Int they correspond to the rune size that was read. alias ReadOp = Int8 # Don't use iota for these, as the values need to correspond with the # names and comments, which is easier to see when being explicit. alias OP_READ: ReadOp = -1 # Any other read operation. alias OP_INVALID: ReadOp = 0 # Non-read operation. alias OP_READ_RUNE1: ReadOp = 1 # read rune of size 1. alias OP_READ_RUNE2: ReadOp = 2 # read rune of size 2. alias OP_READ_RUNE3: ReadOp = 3 # read rune of size 3. alias OP_READ_RUNE4: ReadOp = 4 # read rune of size 4. alias MAX_INT: Int = 2147483647 # MIN_READ is the minimum slice size passed to a read call by # [Buffer.read_from]. As long as the [Buffer] has at least MIN_READ bytes beyond # what is required to hold the contents of r, read_from will not grow the # underlying buffer. alias MIN_READ: Int = 512 # ERR_TOO_LARGE is passed to panic if memory cannot be allocated to store data in a buffer. alias ERR_TOO_LARGE = "buffer.Buffer: too large" alias ERR_NEGATIVE_READ = "buffer.Buffer: reader returned negative count from read" alias ERR_SHORT_WRITE = "short write" struct Buffer( Stringable, Sized, io.Reader, io.Writer, io.StringWriter, io.ByteWriter, io.ByteReader, ): var _data: UnsafePointer[UInt8] # contents are the bytes buf[off : len(buf)] var _size: Int var _capacity: Int var offset: Int # read at &buf[off], write at &buf[len(buf)] var last_read: ReadOp # last read operation, so that unread* can work correctly. @always_inline fn __init__(inout self, capacity: Int = io.BUFFER_SIZE): self._capacity = capacity self._size = 0 self._data = UnsafePointer[UInt8]().alloc(capacity) self.offset = 0 self.last_read = OP_INVALID @always_inline fn __init__(inout self, owned buf: List[Byte]): self._capacity = buf.capacity self._size = buf.size self._data = buf.steal_data() self.offset = 0 self.last_read = OP_INVALID @always_inline fn __init__(inout self, owned data: UnsafePointer[UInt8], capacity: Int, size: Int): self._capacity = capacity self._size = size self._data = data self.offset = 0 self.last_read = OP_INVALID @always_inline fn __moveinit__(inout self, owned other: Self): self._data = other._data self._size = other._size self._capacity = other._capacity self.offset = other.offset self.last_read = other.last_read other._data = UnsafePointer[UInt8]() other._size = 0 other._capacity = 0 other.offset = 0 other.last_read = OP_INVALID @always_inline fn __del__(owned self): if self._data: self._data.free() @always_inline fn __len__(self) -> Int: """Returns the number of bytes of the unread portion of the buffer. self._size - self.offset.""" return self._size - self.offset @always_inline fn bytes_ptr(self) -> UnsafePointer[UInt8]: """Returns a pointer holding the unread portion of the buffer.""" return self._data.offset(self.offset) @always_inline fn bytes(self) -> List[UInt8]: """Returns a list of bytes holding a copy of the unread portion of the buffer.""" var copy = UnsafePointer[UInt8]().alloc(self._size) memcpy(copy, self._data.offset(self.offset), self._size) return List[UInt8](unsafe_pointer=copy, size=self._size - self.offset, capacity=self._size - self.offset) @always_inline fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the internal data as a Span[UInt8].""" return Span[UInt8, self.is_mutable, self.lifetime](unsafe_ptr=self[]._data, len=self[]._size) @always_inline fn _resize(inout self, capacity: Int) -> None: """ Resizes the string builder buffer. Args: capacity: The new capacity of the string builder buffer. """ var new_data = UnsafePointer[UInt8]().alloc(capacity) memcpy(new_data, self._data, self._size) self._data.free() self._data = new_data self._capacity = capacity return None @always_inline fn _resize_if_needed(inout self, bytes_to_add: Int): # TODO: Handle the case where new_capacity is greater than MAX_INT. It should panic. if bytes_to_add > self._capacity - self._size: var new_capacity = int(self._capacity * 2) if new_capacity < self._capacity + bytes_to_add: new_capacity = self._capacity + bytes_to_add self._resize(new_capacity) @always_inline fn __str__(self) -> String: """ Converts the string builder to a string. Returns: The string representation of the string builder. Returns an empty string if the string builder is empty. """ var copy = UnsafePointer[UInt8]().alloc(self._size) memcpy(copy, self._data, self._size) return StringRef(copy, self._size) @always_inline fn render(self: Reference[Self]) -> StringSlice[self.is_mutable, self.lifetime]: """ Return a StringSlice view of the data owned by the builder. Slightly faster than __str__, 10-20% faster in limited testing. Returns: The string representation of the string builder. Returns an empty string if the string builder is empty. """ return StringSlice[self.is_mutable, self.lifetime]( unsafe_from_utf8_strref=StringRef(self[]._data, self[]._size) ) @always_inline fn _write(inout self, src: Span[Byte]) -> (Int, Error): """ Appends a byte Span to the builder buffer. Args: src: The byte array to append. """ self._resize_if_needed(len(src)) memcpy(self._data.offset(self._size), src._data, len(src)) self._size += len(src) return len(src), Error() @always_inline fn write(inout self, src: List[Byte]) -> (Int, Error): """ Appends a byte List to the builder buffer. Args: src: The byte array to append. """ var span = Span(src) var bytes_read: Int var err: Error bytes_read, err = self._write(span) return bytes_read, err @always_inline fn write_string(inout self, src: String) -> (Int, Error): """ Appends a string to the builder buffer. Args: src: The string to append. """ return self.write(src.as_bytes_slice()) @always_inline fn write_byte(inout self, byte: Byte) -> (Int, Error): """Appends the byte c to the buffer, growing the buffer as needed. The returned error is always nil, but is included to match [bufio.Writer]'s write_byte. If the buffer becomes too large, write_byte will panic with [ERR_TOO_LARGE]. Args: byte: The byte to write to the buffer. Returns: The number of bytes written to the buffer. """ self.last_read = OP_INVALID self._resize_if_needed(1) self._data[self._size] = byte self._size += 1 return 1, Error() @always_inline fn empty(self) -> Bool: """Reports whether the unread portion of the buffer is empty.""" return self._size <= self.offset @always_inline fn reset(inout self): """Resets the buffer to be empty, but it retains the underlying storage for use by future writes. reset is the same as [buffer.truncate](0).""" if self._data: self._data.free() self._data = UnsafePointer[UInt8]().alloc(self._capacity) self._size = 0 self.offset = 0 self.last_read = OP_INVALID @always_inline fn _read(inout self, inout dest: Span[Byte, True], capacity: Int) -> (Int, Error): """Reads the next len(dest) bytes from the buffer or until the buffer is drained. The return value n is the number of bytes read. If the buffer has no data to return, err is io.EOF (unless len(dest) is zero); otherwise it is nil. Args: dest: The buffer to read into. capacity: The capacity of the destination buffer. Returns: The number of bytes read from the buffer. """ self.last_read = OP_INVALID if self.empty(): # Buffer is empty, reset to recover space. self.reset() # TODO: How to check if the span's pointer has 0 capacity? We want to return early if the span can't receive any data. if capacity == 0: return 0, Error() return 0, io.EOF # Copy the data of the internal buffer from offset to len(buf) into the destination buffer at the given index. var bytes_read = copy(dest, self.as_bytes_slice()[self.offset :]) dest._len += bytes_read self.offset += bytes_read if bytes_read > 0: self.last_read = OP_READ return bytes_read, Error() @always_inline fn read(inout self, inout dest: List[Byte]) -> (Int, Error): """Reads the next len(dest) bytes from the buffer or until the buffer is drained. The return value n is the number of bytes read. If the buffer has no data to return, err is io.EOF (unless len(dest) is zero); otherwise it is nil. Args: dest: The buffer to read into. Returns: The number of bytes read from the buffer. """ var span = Span(dest) var bytes_read: Int var err: Error bytes_read, err = self._read(span, dest.capacity) dest.size += bytes_read return bytes_read, err @always_inline fn read_byte(inout self) -> (Byte, Error): """Reads and returns the next byte from the buffer. If no byte is available, it returns error io.EOF. """ if self.empty(): # Buffer is empty, reset to recover space. self.reset() return Byte(0), io.EOF var byte = self._data[self.offset] self.offset += 1 self.last_read = OP_READ return byte, Error() @always_inline fn unread_byte(inout self) -> Error: """Unreads the last byte returned by the most recent successful read operation that read at least one byte. If a write has happened since the last read, if the last read returned an error, or if the read read zero bytes, unread_byte returns an error. """ if self.last_read == OP_INVALID: return Error("buffer.Buffer: unread_byte: previous operation was not a successful read") self.last_read = OP_INVALID if self.offset > 0: self.offset -= 1 return Error() @always_inline fn read_bytes(inout self, delim: Byte) -> (List[Byte], Error): """Reads until the first occurrence of delim in the input, returning a slice containing the data up to and including the delimiter. If read_bytes encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). read_bytes returns err != nil if and only if the returned data does not end in delim. Args: delim: The delimiter to read until. Returns: A List[Byte] struct containing the data up to and including the delimiter. """ var slice: Span[UInt8, True, __lifetime_of(self)] var err: Error slice, err = self.read_slice(delim) var bytes = List[Byte](capacity=len(slice) + 1) for byte in slice: bytes.append(byte[]) return bytes, err @always_inline fn read_slice(self: Reference[Self, True], delim: Byte) -> (Span[UInt8, self.is_mutable, self.lifetime], Error): """Like read_bytes but returns a reference to internal buffer data. Args: delim: The delimiter to read until. Returns: A List[Byte] struct containing the data up to and including the delimiter. """ var i = index_byte(bytes=self[].as_bytes_slice(), delim=delim) var end = self[].offset + i + 1 var err = Error() if i < 0: end = self[]._size err = Error(str(io.EOF)) var line = self[].as_bytes_slice()[self[].offset : end] self[].offset = end self[].last_read = OP_READ return line, err @always_inline fn read_string(inout self, delim: Byte) -> (String, Error): """Reads until the first occurrence of delim in the input, returning a string containing the data up to and including the delimiter. If read_string encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). read_string returns err != nil if and only if the returned data does not end in delim. Args: delim: The delimiter to read until. Returns: A string containing the data up to and including the delimiter. """ var bytes: List[UInt8] var err: Error bytes, err = self.read_bytes(delim) bytes.append(0) return String(bytes), err @always_inline fn next(self: Reference[Self, True], number_of_bytes: Int) raises -> Span[Byte, self.is_mutable, self.lifetime]: """Returns a slice containing the next n bytes from the buffer, advancing the buffer as if the bytes had been returned by [Buffer.read]. If there are fewer than n bytes in the buffer, next returns the entire buffer. The slice is only valid until the next call to a read or write method. Args: number_of_bytes: The number of bytes to read from the buffer. Returns: A slice containing the next n bytes from the buffer. """ self[].last_read = OP_INVALID var bytes_remaining = len(self[]) var bytes_to_read = number_of_bytes if bytes_to_read > bytes_remaining: bytes_to_read = bytes_remaining var data = self[].as_bytes_slice()[self[].offset : self[].offset + bytes_to_read] self[].offset += bytes_to_read if bytes_to_read > 0: self[].last_read = OP_READ return data fn write_to[W: io.Writer](inout self, inout writer: W) -> (Int, Error): """Writes data to w until the buffer is drained or an error occurs. The return value n is the number of bytes written; Any error encountered during the write is also returned. Args: writer: The writer to write to. Returns: The number of bytes written to the writer. """ self.last_read = OP_INVALID var bytes_to_write = len(self) var total_bytes_written: Int = 0 if bytes_to_write > 0: var bytes_written: Int var err: Error bytes_written, err = writer.write(self.as_bytes_slice()[self.offset :]) if bytes_written > bytes_to_write: panic("bytes.Buffer.write_to: invalid write count") self.offset += bytes_written total_bytes_written = bytes_written if err: return total_bytes_written, err # all bytes should have been written, by definition of write method in io.Writer if bytes_written != bytes_to_write: return total_bytes_written, Error(ERR_SHORT_WRITE) # Buffer is now empty; reset. self.reset() return total_bytes_written, Error() fn new_buffer(capacity: Int = io.BUFFER_SIZE) -> Buffer: """Creates and initializes a new [Buffer] using buf as its` initial contents. The new [Buffer] takes ownership of buf, and the caller should not use buf after this call. new_buffer is intended to prepare a [Buffer] to read existing data. It can also be used to set the initial size of the internal buffer for writing. To do that, buf should have the desired capacity but a length of zero. In most cases, new([Buffer]) (or just declaring a [Buffer] variable) is sufficient to initialize a [Buffer]. """ var b = List[Byte](capacity=capacity) return Buffer(b^) fn new_buffer(owned buf: List[Byte]) -> Buffer: """Creates and initializes a new [Buffer] using buf as its` initial contents. The new [Buffer] takes ownership of buf, and the caller should not use buf after this call. new_buffer is intended to prepare a [Buffer] to read existing data. It can also be used to set the initial size of the internal buffer for writing. To do that, buf should have the desired capacity but a length of zero. In most cases, new([Buffer]) (or just declaring a [Buffer] variable) is sufficient to initialize a [Buffer]. Args: buf: The bytes to use as the initial contents of the buffer. Returns: A new [Buffer] initialized with the provided bytes. """ return Buffer(buf^) fn new_buffer(owned s: String) -> Buffer: """Creates and initializes a new [Buffer] using string s as its initial contents. It is intended to prepare a buffer to read an existing string. In most cases, new([Buffer]) (or just declaring a [Buffer] variable) is sufficient to initialize a [Buffer]. Args: s: The string to use as the initial contents of the buffer. Returns: A new [Buffer] initialized with the provided string. """ return Buffer(s.as_bytes()) --- external/gojo/bytes/reader.mojo --- from ..builtins import copy, panic import ..io # TODO: Maybe try a non owning reader, but I'm concerned about the lifetime of the buffer. # Is making it unsafe a good idea? The source data would need to be ensured to outlive the reader by the user. struct Reader( Sized, io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, io.ByteReader, io.ByteScanner, ): """A Reader implements the io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, io.ByteScanner, and io.RuneScanner Interfaces by reading from a byte slice. Unlike a [Buffer], a Reader is read-only and supports seeking. The zero value for Reader operates like a Reader of an empty slice. """ var data: UnsafePointer[UInt8] # contents are the bytes buf[index : size] var size: Int var capacity: Int var index: Int # current reading index var prev_rune: Int # index of previous rune; or < 0 @always_inline fn __init__(inout self, owned buffer: List[UInt8]): """Initializes a new [Reader.Reader] struct.""" self.capacity = buffer.capacity self.size = buffer.size self.data = buffer.steal_data() self.index = 0 self.prev_rune = -1 @always_inline fn __moveinit__(inout self, owned other: Reader): """Initializes a new [Reader.Reader] struct by moving the data from another [Reader.Reader] struct.""" self.capacity = other.capacity self.size = other.size self.data = other.data self.index = other.index self.prev_rune = other.prev_rune other.data = UnsafePointer[UInt8]() other.size = 0 other.capacity = 0 other.index = 0 other.prev_rune = -1 @always_inline fn __len__(self) -> Int: """len returns the number of bytes of the unread portion of the slice.""" return self.size - int(self.index) @always_inline fn __del__(owned self): if self.data: self.data.free() @always_inline fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the internal data as a Span[UInt8].""" return Span[UInt8, self.is_mutable, self.lifetime](unsafe_ptr=self[].data, len=self[].size) @always_inline fn _read(inout self, inout dest: Span[UInt8, True], capacity: Int) -> (Int, Error): """Reads from the internal buffer into the dest List[UInt8] struct. Implements the [io.Reader] Interface. Args: dest: The destination Span[UInt8] struct to read into. capacity: The capacity of the destination buffer. Returns: Int: The number of bytes read into dest.""" if self.index >= self.size: return 0, io.EOF # Copy the data of the internal buffer from offset to len(buf) into the destination buffer at the given index. self.prev_rune = -1 var bytes_written = copy(dest, self.as_bytes_slice()[self.index : self.size], len(dest)) dest._len += bytes_written self.index += bytes_written return bytes_written, Error() @always_inline fn read(inout self, inout dest: List[UInt8]) -> (Int, Error): """Reads from the internal buffer into the dest List[UInt8] struct. Implements the [io.Reader] Interface. Args: dest: The destination List[UInt8] struct to read into. Returns: Int: The number of bytes read into dest.""" var span = Span(dest) var bytes_read: Int var err: Error bytes_read, err = self._read(span, dest.capacity) dest.size += bytes_read return bytes_read, err @always_inline fn _read_at(self, inout dest: Span[UInt8, True], off: Int, capacity: Int) -> (Int, Error): """Reads len(dest) bytes into dest beginning at byte offset off. Implements the [io.ReaderAt] Interface. Args: dest: The destination List[UInt8] struct to read into. off: The offset to start reading from. Returns: Int: The number of bytes read into dest. """ # cannot modify state - see io.ReaderAt if off < 0: return 0, Error("bytes.Reader.read_at: negative offset") if off >= Int(self.size): return 0, io.EOF var unread_bytes = self.as_bytes_slice()[off : self.size] var bytes_written = copy(dest, unread_bytes) if bytes_written < len(dest): return 0, io.EOF return bytes_written, Error() @always_inline fn read_at(self, inout dest: List[UInt8], off: Int) -> (Int, Error): """Reads len(dest) bytes into dest beginning at byte offset off. Implements the [io.ReaderAt] Interface. Args: dest: The destination List[UInt8] struct to read into. off: The offset to start reading from. Returns: Int: The number of bytes read into dest. """ var span = Span(dest) var bytes_read: Int var err: Error bytes_read, err = self._read_at(span, off, dest.capacity) dest.size += bytes_read return bytes_read, err @always_inline fn read_byte(inout self) -> (UInt8, Error): """Reads and returns a single byte from the internal buffer. Implements the [io.ByteReader] Interface.""" self.prev_rune = -1 if self.index >= self.size: return UInt8(0), io.EOF var byte = self.data[self.index] self.index += 1 return byte, Error() @always_inline fn unread_byte(inout self) -> Error: """Unreads the last byte read by moving the read position back by one. Complements [Reader.read_byte] in implementing the [io.ByteScanner] Interface. """ if self.index <= 0: return Error("bytes.Reader.unread_byte: at beginning of slice") self.prev_rune = -1 self.index -= 1 return Error() # # read_rune implements the [io.RuneReader] Interface. # fn read_rune(self) (ch rune, size Int, err error): # if self.index >= Int(self.size): # self.prev_rune = -1 # return 0, 0, io.EOF # self.prev_rune = Int(self.index) # if c := self.buffer[self.index]; c < utf8.RuneSelf: # self.index+= 1 # return rune(c), 1, nil # ch, size = utf8.DecodeRune(self.buffer[self.index:]) # self.index += Int(size) # return # # unread_rune complements [Reader.read_rune] in implementing the [io.RuneScanner] Interface. # fn unread_rune(self) error: # if self.index <= 0: # return errors.New("bytes.Reader.unread_rune: at beginning of slice") # if self.prev_rune < 0: # return errors.New("bytes.Reader.unread_rune: previous operation was not read_rune") # self.index = Int(self.prev_rune) # self.prev_rune = -1 # return nil @always_inline fn seek(inout self, offset: Int, whence: Int) -> (Int, Error): """Moves the read position to the specified offset from the specified whence. Args: offset: The offset to move to. whence: The reference point for offset. Returns: The new position in which the next read will start from. """ self.prev_rune = -1 var position: Int = 0 if whence == io.SEEK_START: position = offset elif whence == io.SEEK_CURRENT: position = self.index + offset elif whence == io.SEEK_END: position = self.size + offset else: return Int(0), Error("bytes.Reader.seek: invalid whence") if position < 0: return Int(0), Error("bytes.Reader.seek: negative position") self.index = position return position, Error() @always_inline fn write_to[W: io.Writer](inout self, inout writer: W) -> (Int, Error): """Writes data to w until the buffer is drained or an error occurs. implements the [io.WriterTo] Interface. Args: writer: The writer to write to. """ self.prev_rune = -1 if self.index >= self.size: return 0, Error() var bytes = self.as_bytes_slice()[self.index : self.size] var write_count: Int var err: Error write_count, err = writer.write(bytes) if write_count > len(bytes): panic("bytes.Reader.write_to: invalid Write count") self.index += write_count if write_count != len(bytes): return write_count, io.ERR_SHORT_WRITE return write_count, Error() @always_inline fn reset(inout self, owned buffer: List[UInt8]): """Resets the [Reader.Reader] to be reading from buffer. Args: buffer: The new buffer to read from. """ self.capacity = buffer.capacity self.size = buffer.size self.data = buffer.steal_data() self.index = 0 self.prev_rune = -1 fn new_reader(owned buffer: List[UInt8]) -> Reader: """Returns a new [Reader.Reader] reading from b. Args: buffer: The new buffer to read from. """ return Reader(buffer) fn new_reader(owned buffer: String) -> Reader: """Returns a new [Reader.Reader] reading from b. Args: buffer: The new buffer to read from. """ return Reader(buffer.as_bytes()) --- external/gojo/fmt/__init__.mojo --- from .fmt import sprintf, printf, sprintf_str --- external/gojo/fmt/fmt.mojo --- """Formatting options General %v the value in a default format when printing structs, the plus flag (%+v) adds field names Boolean %t the word true or false Integer %d base 10 %q a single-quoted character literal. %x base 16, with lower-case letters for a-f %X base 16, with upper-case letters for A-F Floating-point and complex constituents: %f decimal point but no exponent, e.g. 123.456 String and slice of bytes (treated equivalently with these verbs): %s the uninterpreted bytes of the string or slice %q a double-quoted string TODO: - Add support for more formatting options - Switch to buffered writing to avoid multiple string concatenations - Add support for width and precision formatting options - Handle escaping for String's %q """ from utils.variant import Variant from math import floor from ..builtins import Byte alias Args = Variant[String, Int, Float64, Bool, List[Byte]] fn replace_first(s: String, old: String, new: String) -> String: """Replace the first occurrence of a substring in a string. Args: s: The original string. old: The substring to be replaced. new: The new substring. Returns: The string with the first occurrence of the old substring replaced by the new one. """ # Find the first occurrence of the old substring var index = s.find(old) # If the old substring is found, replace it if index != -1: return s[:index] + new + s[index + len(old) :] # If the old substring is not found, return the original string return s fn find_first_verb(s: String, verbs: List[String]) -> String: """Find the first occurrence of a verb in a string. Args: s: The original string. verbs: The list of verbs to search for. Returns: The verb to replace. """ var index = -1 var verb: String = "" for v in verbs: var i = s.find(v[]) if i != -1 and (index == -1 or i < index): index = i verb = v[] return verb alias BASE10_TO_BASE16 = List[String]( "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", ) fn convert_base10_to_base16(value: Int) -> String: """Converts a base 10 number to base 16. Args: value: Base 10 number. Returns: Base 16 number as a String. """ var val: Float64 = 0.0 var result: Float64 = value var base16: String = "" while result > 1: var temp = result / 16 var floor_result = floor(temp) var remainder = temp - floor_result result = floor_result val = 16 * remainder base16 = BASE10_TO_BASE16[int(val)] + base16 return base16 fn format_string(format: String, arg: String) -> String: var verb = find_first_verb(format, List[String]("%s", "%q")) var arg_to_place = arg if verb == "%q": arg_to_place = '"' + arg + '"' return replace_first(format, String("%s"), arg) fn format_bytes(format: String, arg: List[Byte]) -> String: var argument = arg if argument[-1] != 0: argument.append(0) return format_string(format, argument) fn format_integer(format: String, arg: Int) -> String: var verb = find_first_verb(format, List[String]("%x", "%X", "%d", "%q")) var arg_to_place = str(arg) if verb == "%x": arg_to_place = str(convert_base10_to_base16(arg)).lower() elif verb == "%X": arg_to_place = str(convert_base10_to_base16(arg)).upper() elif verb == "%q": arg_to_place = "'" + str(arg) + "'" return replace_first(format, verb, arg_to_place) fn format_float(format: String, arg: Float64) -> String: return replace_first(format, str("%f"), str(arg)) fn format_boolean(format: String, arg: Bool) -> String: var value: String = "False" if arg: value = "True" return replace_first(format, String("%t"), value) # If the number of arguments does not match the number of format specifiers alias BadArgCount = "(BAD ARG COUNT)" fn sprintf(formatting: String, *args: Args) -> String: var text = formatting var raw_percent_count = formatting.count("%%") * 2 var formatter_count = formatting.count("%") - raw_percent_count if formatter_count != len(args): return BadArgCount for i in range(len(args)): var argument = args[i] if argument.isa[String](): text = format_string(text, argument[String]) elif argument.isa[List[Byte]](): text = format_bytes(text, argument[List[Byte]]) elif argument.isa[Int](): text = format_integer(text, argument[Int]) elif argument.isa[Float64](): text = format_float(text, argument[Float64]) elif argument.isa[Bool](): text = format_boolean(text, argument[Bool]) return text # TODO: temporary until we have arg packing. fn sprintf_str(formatting: String, args: List[String]) raises -> String: var text = formatting var formatter_count = formatting.count("%") if formatter_count > len(args): raise Error("Not enough arguments for format string") elif formatter_count < len(args): raise Error("Too many arguments for format string") for i in range(len(args)): text = format_string(text, args[i]) return text fn printf(formatting: String, *args: Args) raises: var text = formatting var raw_percent_count = formatting.count("%%") * 2 var formatter_count = formatting.count("%") - raw_percent_count if formatter_count > len(args): raise Error("Not enough arguments for format string") elif formatter_count < len(args): raise Error("Too many arguments for format string") for i in range(len(args)): var argument = args[i] if argument.isa[String](): text = format_string(text, argument[String]) elif argument.isa[List[Byte]](): text = format_bytes(text, argument[List[Byte]]) elif argument.isa[Int](): text = format_integer(text, argument[Int]) elif argument.isa[Float64](): text = format_float(text, argument[Float64]) elif argument.isa[Bool](): text = format_boolean(text, argument[Bool]) else: raise Error("Unknown for argument #" + str(i)) print(text) --- external/gojo/io/__init__.mojo --- from .io import write_string, read_at_least, read_full, read_all, BUFFER_SIZE from .file import FileWrapper from .std import STDWriter alias Rune = Int32 # Package io provides basic interfaces to I/O primitives. # Its primary job is to wrap existing implementations of such primitives, # such as those in package os, into shared public interfaces that # abstract the fntionality, plus some other related primitives. # # Because these interfaces and primitives wrap lower-level operations with # various implementations, unless otherwise informed clients should not # assume they are safe for parallel execution. # Seek whence values. alias SEEK_START = 0 # seek relative to the origin of the file alias SEEK_CURRENT = 1 # seek relative to the current offset alias SEEK_END = 2 # seek relative to the end # ERR_SHORT_WRITE means that a write accepted fewer bytes than requested # but failed to return an explicit error. alias ERR_SHORT_WRITE = Error("short write") # ERR_INVALID_WRITE means that a write returned an impossible count. alias ERR_INVALID_WRITE = Error("invalid write result") # ERR_SHORT_BUFFER means that a read required a longer buffer than was provided. alias ERR_SHORT_BUFFER = Error("short buffer") # EOF is the error returned by Read when no more input is available. # (Read must return EOF itself, not an error wrapping EOF, # because callers will test for EOF using ==.) # fntions should return EOF only to signal a graceful end of input. # If the EOF occurs unexpectedly in a structured data stream, # the appropriate error is either [ERR_UNEXPECTED_EOF] or some other error # giving more detail. alias EOF = Error("EOF") # ERR_UNEXPECTED_EOF means that EOF was encountered in the # middle of reading a fixed-size block or data structure. alias ERR_UNEXPECTED_EOF = Error("unexpected EOF") # ERR_NO_PROGRESS is returned by some clients of a [Reader] when # many calls to Read have failed to return any data or error, # usually the sign of a broken [Reader] implementation. alias ERR_NO_PROGRESS = Error("multiple Read calls return no data or error") trait Reader(Movable): """Reader is the trait that wraps the basic Read method. Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting for more. When Read encounters an error or end-of-file condition after successfully reading n > 0 bytes, it returns the number of bytes read. It may return the (non-nil) error from the same call or return the error (and n == 0) from a subsequent call. An instance of this general case is that a Reader returning a non-zero number of bytes at the end of the input stream may return either err == EOF or err == nil. The next Read should return 0, EOF. Callers should always process the n > 0 bytes returned before considering the error err. Doing so correctly handles I/O errors that happen after reading some bytes and also both of the allowed EOF behaviors. If len(p) == 0, Read should always return n == 0. It may return a non-nil error if some error condition is known, such as EOF. Implementations of Read are discouraged from returning a zero byte count with a nil error, except when len(p) == 0. Callers should treat a return of 0 and nil as indicating that nothing happened; in particular it does not indicate EOF. Implementations must not retain p.""" fn read(inout self, inout dest: List[UInt8]) -> (Int, Error): ... fn _read(inout self, inout dest: Span[UInt8, True], capacity: Int) -> (Int, Error): ... trait Writer(Movable): """Writer is the trait that wraps the basic Write method. Write writes len(p) bytes from p to the underlying data stream. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. Write must return a non-nil error if it returns n < len(p). Write must not modify the slice data, even temporarily. Implementations must not retain p. """ # fn _write(inout self, src: Span[UInt8]) -> (Int, Error): # ... fn write(inout self, src: List[UInt8]) -> (Int, Error): ... trait Closer(Movable): """ Closer is the trait that wraps the basic Close method. The behavior of Close after the first call is undefined. Specific implementations may document their own behavior. """ fn close(inout self) -> Error: ... trait Seeker(Movable): """ Seeker is the trait that wraps the basic Seek method. Seek sets the offset for the next Read or Write to offset, interpreted according to whence: [SEEK_START] means relative to the start of the file, [SEEK_CURRENT] means relative to the current offset, and [SEEK_END] means relative to the end (for example, offset = -2 specifies the penultimate byte of the file). Seek returns the new offset relative to the start of the file or an error, if any. Seeking to an offset before the start of the file is an error. Seeking to any positive offset may be allowed, but if the new offset exceeds the size of the underlying object the behavior of subsequent I/O operations is implementation-dependent. """ fn seek(inout self, offset: Int, whence: Int) -> (Int, Error): ... trait ReadWriter(Reader, Writer): ... trait ReadCloser(Reader, Closer): ... trait WriteCloser(Writer, Closer): ... trait ReadWriteCloser(Reader, Writer, Closer): ... trait ReadSeeker(Reader, Seeker): ... trait ReadSeekCloser(Reader, Seeker, Closer): ... trait WriteSeeker(Writer, Seeker): ... trait ReadWriteSeeker(Reader, Writer, Seeker): ... trait ReaderFrom: """ReaderFrom is the trait that wraps the ReadFrom method. ReadFrom reads data from r until EOF or error. The return value n is the number of bytes read. Any error except EOF encountered during the read is also returned. The [copy] function uses [ReaderFrom] if available.""" fn read_from[R: Reader](inout self, inout reader: R) -> (Int, Error): ... trait WriterReadFrom(Writer, ReaderFrom): ... trait WriterTo: """WriterTo is the trait that wraps the WriteTo method. WriteTo writes data to w until there's no more data to write or when an error occurs. The return value n is the number of bytes written. Any error encountered during the write is also returned. The copy function uses WriterTo if available.""" fn write_to[W: Writer](inout self, inout writer: W) -> (Int, Error): ... trait ReaderWriteTo(Reader, WriterTo): ... trait ReaderAt: """ReaderAt is the trait that wraps the basic ReadAt method. ReadAt reads len(p) bytes into p starting at offset off in the underlying input source. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. When ReadAt returns n < len(p), it returns a non-nil error explaining why more bytes were not returned. In this respect, ReadAt is stricter than Read. Even if ReadAt returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, ReadAt blocks until either all the data is available or an error occurs. In this respect ReadAt is different from Read. If the n = len(p) bytes returned by ReadAt are at the end of the input source, ReadAt may return either err == EOF or err == nil. If ReadAt is reading from an input source with a seek offset, ReadAt should not affect nor be affected by the underlying seek offset. Clients of ReadAt can execute parallel ReadAt calls on the same input source. Implementations must not retain p.""" fn read_at(self, inout dest: List[UInt8], off: Int) -> (Int, Error): ... fn _read_at(self, inout dest: Span[UInt8, True], off: Int, capacity: Int) -> (Int, Error): ... trait WriterAt: """WriterAt is the trait that wraps the basic WriteAt method. WriteAt writes len(p) bytes from p to the underlying data stream at offset off. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. WriteAt must return a non-nil error if it returns n < len(p). If WriteAt is writing to a destination with a seek offset, WriteAt should not affect nor be affected by the underlying seek offset. Clients of WriteAt can execute parallel WriteAt calls on the same destination if the ranges do not overlap. Implementations must not retain p.""" fn _write_at(self, src: Span[UInt8], off: Int) -> (Int, Error): ... fn write_at(self, src: List[UInt8], off: Int) -> (Int, Error): ... trait ByteReader: """ByteReader is the trait that wraps the read_byte method. read_byte reads and returns the next byte from the input or any error encountered. If read_byte returns an error, no input byte was consumed, and the returned byte value is undefined. read_byte provides an efficient trait for byte-at-time processing. A [Reader] that does not implement ByteReader can be wrapped using bufio.NewReader to add this method.""" fn read_byte(inout self) -> (UInt8, Error): ... trait ByteScanner(ByteReader): """ByteScanner is the trait that adds the unread_byte method to the basic read_byte method. unread_byte causes the next call to read_byte to return the last byte read. If the last operation was not a successful call to read_byte, unread_byte may return an error, unread the last byte read (or the byte prior to the last-unread byte), or (in implementations that support the [Seeker] trait) seek to one byte before the current offset.""" fn unread_byte(inout self) -> Error: ... trait ByteWriter: """ByteWriter is the trait that wraps the write_byte method.""" fn write_byte(inout self, byte: UInt8) -> (Int, Error): ... trait RuneReader: """RuneReader is the trait that wraps the read_rune method. read_rune reads a single encoded Unicode character and returns the rune and its size in bytes. If no character is available, err will be set.""" fn read_rune(inout self) -> (Rune, Int): ... trait RuneScanner(RuneReader): """RuneScanner is the trait that adds the unread_rune method to the basic read_rune method. unread_rune causes the next call to read_rune to return the last rune read. If the last operation was not a successful call to read_rune, unread_rune may return an error, unread the last rune read (or the rune prior to the last-unread rune), or (in implementations that support the [Seeker] trait) seek to the start of the rune before the current offset.""" fn unread_rune(inout self) -> Rune: ... trait StringWriter: """StringWriter is the trait that wraps the WriteString method.""" fn write_string(inout self, src: String) -> (Int, Error): ... --- external/gojo/io/file.mojo --- import ..io from ..builtins import copy from ..syscall import FileDescriptorBase struct FileWrapper(FileDescriptorBase, io.ByteReader): var handle: FileHandle @always_inline fn __init__(inout self, path: String, mode: String) raises: self.handle = open(path, mode) @always_inline fn __moveinit__(inout self, owned existing: Self): self.handle = existing.handle^ @always_inline fn __del__(owned self): var err = self.close() if err: # TODO: __del__ can't raise, but there should be some fallback. print(str(err)) @always_inline fn close(inout self) -> Error: try: self.handle.close() except e: return e return Error() @always_inline fn _read(inout self, inout dest: Span[UInt8, True], capacity: Int) -> (Int, Error): """Read from the file handle into dest's pointer. Pretty hacky way to force the filehandle read into the defined trait, and it's unsafe since we're reading directly into the pointer. """ # var bytes_to_read = dest.capacity - len(dest) var bytes_read: Int var result: List[UInt8] try: result = self.handle.read_bytes() bytes_read = len(result) # TODO: Need to raise an Issue for this. Reading with pointer does not return an accurate count of bytes_read :( # bytes_read = int(self.handle.read(DTypePointer[DType.uint8](dest.unsafe_ptr()) + dest.size)) except e: return 0, e _ = copy(dest, Span(result), len(dest)) if bytes_read == 0: return bytes_read, io.EOF return bytes_read, Error() @always_inline fn read(inout self, inout dest: List[UInt8]) -> (Int, Error): """Read from the file handle into dest's pointer. Pretty hacky way to force the filehandle read into the defined trait, and it's unsafe since we're reading directly into the pointer. """ # var bytes_to_read = dest.capacity - len(dest) var bytes_read: Int var result: List[UInt8] try: result = self.handle.read_bytes() bytes_read = len(result) # TODO: Need to raise an Issue for this. Reading with pointer does not return an accurate count of bytes_read :( # bytes_read = int(self.handle.read(DTypePointer[DType.uint8](dest.unsafe_ptr()) + dest.size)) except e: return 0, e _ = copy(dest, result, len(dest)) if bytes_read == 0: return bytes_read, io.EOF return bytes_read, Error() @always_inline fn read_all(inout self) -> (List[UInt8], Error): var bytes = List[UInt8](capacity=io.BUFFER_SIZE) while True: var temp = List[UInt8](capacity=io.BUFFER_SIZE) _ = self.read(temp) # If new bytes will overflow the result, resize it. if len(bytes) + len(temp) > bytes.capacity: bytes.reserve(bytes.capacity * 2) bytes.extend(temp) if len(temp) < io.BUFFER_SIZE: return bytes, io.EOF @always_inline fn read_byte(inout self) -> (UInt8, Error): try: var bytes: List[UInt8] var err: Error bytes, err = self.read_bytes(1) return bytes[0], Error() except e: return UInt8(0), e @always_inline fn read_bytes(inout self, size: Int = -1) raises -> (List[UInt8], Error): try: return self.handle.read_bytes(size), Error() except e: return List[UInt8](), e @always_inline fn stream_until_delimiter(inout self, inout dest: List[UInt8], delimiter: UInt8, max_size: Int) -> Error: var byte: UInt8 var err = Error() for _ in range(max_size): byte, err = self.read_byte() if err: return err if byte == delimiter: return err dest.append(byte) return Error("Stream too long") @always_inline fn seek(inout self, offset: Int, whence: Int = 0) -> (Int, Error): try: var position = self.handle.seek(UInt64(offset), whence) return int(position), Error() except e: return 0, e @always_inline fn _write(inout self, src: Span[UInt8]) -> (Int, Error): if len(src) == 0: return 0, Error("No data to write") try: self.handle.write(src.unsafe_ptr()) return len(src), io.EOF except e: return 0, Error(str(e)) @always_inline fn write(inout self, src: List[UInt8]) -> (Int, Error): return self._write(Span(src)) --- external/gojo/io/io.mojo --- from ..builtins import copy, Byte, panic alias BUFFER_SIZE = 4096 fn write_string[W: Writer](inout writer: W, string: String) -> (Int, Error): """Writes the contents of the string s to w, which accepts a slice of bytes. If w implements [StringWriter], [StringWriter.write_string] is invoked directly. Otherwise, [Writer.write] is called exactly once. Args: writer: The writer to write to. string: The string to write. Returns: The number of bytes written and an error, if any. """ return writer.write(string.as_bytes()) fn write_string[W: StringWriter](inout writer: W, string: String) -> (Int, Error): """Writes the contents of the string s to w, which accepts a slice of bytes. If w implements [StringWriter], [StringWriter.write_string] is invoked directly. Otherwise, [Writer.write] is called exactly once. Args: writer: The writer to write to. string: The string to write. Returns: The number of bytes written and an error, if any.""" return writer.write_string(string) fn read_at_least[R: Reader](inout reader: R, inout dest: List[Byte], min: Int) -> (Int, Error): """Reads from r into buf until it has read at least min bytes. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading fewer than min bytes, read_at_least returns [ERR_UNEXPECTED_EOF]. If min is greater than the length of buf, read_at_least returns [ERR_SHORT_BUFFER]. On return, n >= min if and only if err == nil. If r returns an error having read at least min bytes, the error is dropped. Args: reader: The reader to read from. dest: The buffer to read into. min: The minimum number of bytes to read. Returns: The number of bytes read.""" var error = Error() if len(dest) < min: return 0, io.ERR_SHORT_BUFFER var total_bytes_read: Int = 0 while total_bytes_read < min and not error: var bytes_read: Int bytes_read, error = reader.read(dest) total_bytes_read += bytes_read if total_bytes_read >= min: error = Error() elif total_bytes_read > 0 and str(error): error = ERR_UNEXPECTED_EOF return total_bytes_read, error fn read_full[R: Reader](inout reader: R, inout dest: List[Byte]) -> (Int, Error): """Reads exactly len(buf) bytes from r into buf. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading some but not all the bytes, read_full returns [ERR_UNEXPECTED_EOF]. On return, n == len(buf) if and only if err == nil. If r returns an error having read at least len(buf) bytes, the error is dropped. """ return read_at_least(reader, dest, len(dest)) # fn copy_n[W: Writer, R: Reader](dst: W, src: R, n: Int) raises -> Int: # """Copies n bytes (or until an error) from src to dst. # It returns the number of bytes copied and the earliest # error encountered while copying. # On return, written == n if and only if err == nil. # If dst implements [ReaderFrom], the copy is implemented using it. # """ # var written = copy(dst, LimitReader(src, n)) # if written == n: # return n # if written < n: # # src stopped early; must have been EOF. # raise Error(ERR_UNEXPECTED_EOF) # return written # fn copy[W: Writer, R: Reader](dst: W, src: R, n: Int) -> Int: # """copy copies from src to dst until either EOF is reached # on src or an error occurs. It returns the number of bytes # copied and the first error encountered while copying, if any. # A successful copy returns err == nil, not err == EOF. # Because copy is defined to read from src until EOF, it does # not treat an EOF from Read as an error to be reported. # If src implements [WriterTo], # the copy is implemented by calling src.WriteTo(dst). # Otherwise, if dst implements [ReaderFrom], # the copy is implemented by calling dst.ReadFrom(src). # """ # return copy_buffer(dst, src, nil) # # CopyBuffer is identical to copy except that it stages through the # # provided buffer (if one is required) rather than allocating a # # temporary one. If buf is nil, one is allocated; otherwise if it has # # zero length, CopyBuffer panics. # # # # If either src implements [WriterTo] or dst implements [ReaderFrom], # # buf will not be used to perform the copy. # fn CopyBuffer(dst Writer, src Reader, buf bytes) (written Int, err error) { # if buf != nil and len(buf) == 0 { # panic("empty buffer in CopyBuffer") # } # return copy_buffer(dst, src, buf) # } # fn copy_buffer[W: Writer, R: Reader](dst: W, src: R, buf: Span[Byte]) raises -> Int: # """Actual implementation of copy and CopyBuffer. # if buf is nil, one is allocated. # """ # var nr: Int # nr = src.read(buf) # while True: # if nr > 0: # var nw: Int # nw = dst.write(get_slice(buf, 0, nr)) # if nw < 0 or nr < nw: # nw = 0 # var written = Int(nw) # if nr != nw: # raise Error(ERR_SHORT_WRITE) # return written # fn copy_buffer[W: Writer, R: ReaderWriteTo](dst: W, src: R, buf: Span[Byte]) -> Int: # return src.write_to(dst) # fn copy_buffer[W: WriterReadFrom, R: Reader](dst: W, src: R, buf: Span[Byte]) -> Int: # return dst.read_from(src) # # LimitReader returns a Reader that reads from r # # but stops with EOF after n bytes. # # The underlying implementation is a *LimitedReader. # fn LimitReader(r Reader, n Int) Reader { return &LimitedReader{r, n} } # # A LimitedReader reads from R but limits the amount of # # data returned to just N bytes. Each call to Read # # updates N to reflect the new amount remaining. # # Read returns EOF when N <= 0 or when the underlying R returns EOF. # struct LimitedReader(): # var R: Reader # underlying reader # N Int # max bytes remaining # fn (l *LimitedReader) Read(p bytes) (n Int, err error) { # if l.N <= 0 { # return 0, EOF # } # if Int(len(p)) > l.N { # p = p[0:l.N] # } # n, err = l.R.Read(p) # l.N -= Int(n) # return # } # # NewSectionReader returns a [SectionReader] that reads from r # # starting at offset off and stops with EOF after n bytes. # fn NewSectionReader(r ReaderAt, off Int, n Int) *SectionReader { # var remaining Int # const maxInt = 1<<63 - 1 # if off <= maxInt-n { # remaining = n + off # } else { # # Overflow, with no way to return error. # # Assume we can read up to an offset of 1<<63 - 1. # remaining = maxInt # } # return &SectionReader{r, off, off, remaining, n} # } # # SectionReader implements Read, Seek, and ReadAt on a section # # of an underlying [ReaderAt]. # type SectionReader struct { # r ReaderAt # constant after creation # base Int # constant after creation # off Int # limit Int # constant after creation # n Int # constant after creation # } # fn (s *SectionReader) Read(p bytes) (n Int, err error) { # if s.off >= s.limit { # return 0, EOF # } # if max := s.limit - s.off; Int(len(p)) > max { # p = p[0:max] # } # n, err = s.r.ReadAt(p, s.off) # s.off += Int(n) # return # } # alias errWhence = "Seek: invalid whence" # alias errOffset = "Seek: invalid offset" # fn (s *SectionReader) Seek(offset Int, whence Int) (Int, error) { # switch whence { # default: # return 0, errWhence # case SEEK_START: # offset += s.base # case SEEK_CURRENT: # offset += s.off # case SEEK_END: # offset += s.limit # } # if offset < s.base { # return 0, errOffset # } # s.off = offset # return offset - s.base, nil # } # fn (s *SectionReader) ReadAt(p bytes, off Int) (n Int, err error) { # if off < 0 or off >= s.capacity { # return 0, EOF # } # off += s.base # if max := s.limit - off; Int(len(p)) > max { # p = p[0:max] # n, err = s.r.ReadAt(p, off) # if err == nil { # err = EOF # } # return n, err # } # return s.r.ReadAt(p, off) # } # # Size returns the size of the section in bytes. # fn (s *SectionReader) Size() Int { return s.limit - s.base } # # Outer returns the underlying [ReaderAt] and offsets for the section. # # # # The returned values are the same that were passed to [NewSectionReader] # # when the [SectionReader] was created. # fn (s *SectionReader) Outer() (r ReaderAt, off Int, n Int) { # return s.r, s.base, s.n # } # # An OffsetWriter maps writes at offset base to offset base+off in the underlying writer. # type OffsetWriter struct { # w WriterAt # base Int # the original offset # off Int # the current offset # } # # NewOffsetWriter returns an [OffsetWriter] that writes to w # # starting at offset off. # fn NewOffsetWriter(w WriterAt, off Int) *OffsetWriter { # return &OffsetWriter{w, off, off} # } # fn (o *OffsetWriter) Write(p bytes) (n Int, err error) { # n, err = o.w.WriteAt(p, o.off) # o.off += Int(n) # return # } # fn (o *OffsetWriter) WriteAt(p bytes, off Int) (n Int, err error) { # if off < 0 { # return 0, errOffset # } # off += o.base # return o.w.WriteAt(p, off) # } # fn (o *OffsetWriter) Seek(offset Int, whence Int) (Int, error) { # switch whence { # default: # return 0, errWhence # case SEEK_START: # offset += o.base # case SEEK_CURRENT: # offset += o.off # } # if offset < o.base { # return 0, errOffset # } # o.off = offset # return offset - o.base, nil # } # # TeeReader returns a [Reader] that writes to w what it reads from r. # # All reads from r performed through it are matched with # # corresponding writes to w. There is no internal buffering - # # the write must complete before the read completes. # # Any error encountered while writing is reported as a read error. # fn TeeReader(r Reader, w Writer) Reader { # return &teeReader{r, w} # } # type teeReader struct { # r Reader # w Writer # } # fn (t *teeReader) Read(p bytes) (n Int, err error) { # n, err = t.r.Read(p) # if n > 0 { # if n, err := t.w.Write(p[:n]); err != nil { # return n, err # } # } # return # } # # Discard is a [Writer] on which all Write calls succeed # # without doing anything. # var Discard Writer = discard{} # type discard struct{} # # discard implements ReaderFrom as an optimization so copy to # # io.Discard can avoid doing unnecessary work. # var _ ReaderFrom = discard{} # fn (discard) Write(p bytes) (Int, error) { # return len(p), nil # } # fn (discard) write_string(s string) (Int, error) { # return len(s), nil # } # var blackHolePool = sync.Pool{ # New: fn() any { # b := make(bytes, 8192) # return &b # }, # } # fn (discard) ReadFrom(r Reader) (n Int, err error) { # bufp := blackHolePool.Get().(*bytes) # readSize := 0 # for { # readSize, err = r.Read(*bufp) # n += Int(readSize) # if err != nil { # blackHolePool.Put(bufp) # if err == EOF { # return n, nil # } # return # } # } # } # # NopCloser returns a [ReadCloser] with a no-op Close method wrapping # # the provided [Reader] r. # # If r implements [WriterTo], the returned [ReadCloser] will implement [WriterTo] # # by forwarding calls to r. # fn NopCloser(r Reader) ReadCloser { # if _, ok := r.(WriterTo); ok { # return nopCloserWriterTo{r} # } # return nopCloser{r} # } # type nopCloser struct { # Reader # } # fn (nopCloser) Close() error { return nil } # type nopCloserWriterTo struct { # Reader # } # fn (nopCloserWriterTo) Close() error { return nil } # fn (c nopCloserWriterTo) WriteTo(w Writer) (n Int, err error) { # return c.Reader.(WriterTo).WriteTo(w) # } # TODO: read directly into dest fn read_all[R: Reader](inout reader: R) -> (List[Byte], Error): """Reads from r until an error or EOF and returns the data it read. A successful call returns err == nil, not err == EOF. Because ReadAll is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported. Args: reader: The reader to read from. Returns: The data read.""" var dest = List[Byte](capacity=BUFFER_SIZE) var at_eof: Bool = False while True: var temp = List[Byte](capacity=BUFFER_SIZE) var bytes_read: Int var err: Error bytes_read, err = reader.read(temp) if str(err) != "": if str(err) != str(EOF): return dest, err at_eof = True # If new bytes will overflow the result, resize it. # if some bytes were written, how do I append before returning result on the last one? if len(dest) + len(temp) > dest.capacity: dest.reserve(dest.capacity * 2) dest.extend(temp) if at_eof: return dest, err --- external/gojo/io/std.mojo --- import ..io from ..syscall import FD @value struct STDWriter[file_descriptor: Int](Copyable, io.Writer, io.StringWriter): """A writer for POSIX file descriptors.""" @always_inline fn __init__(inout self): constrained[ file_descriptor == FD.STDOUT or file_descriptor == FD.STDERR, "The STDWriter Struct is meant to write to STDOUT and STDERR. file_descriptor must be 1 or 2.", ]() @always_inline fn _write(inout self, src: Span[UInt8]) -> (Int, Error): """Writes the given bytes to the file descriptor. Args: src: The bytes to write to the file descriptor. Returns: The number of bytes written to the file descriptor. """ var write_count: Int = external_call["write", Int, Int32, UnsafePointer[UInt8], Int]( file_descriptor, src.unsafe_ptr(), len(src) ) if write_count == -1: return 0, Error("Failed to write to file descriptor " + str(file_descriptor)) return write_count, Error() @always_inline fn write(inout self, src: List[UInt8]) -> (Int, Error): """Writes the given bytes to the file descriptor. Args: src: The bytes to write to the file descriptor. Returns: The number of bytes written to the file descriptor. """ return self._write(Span(src)) @always_inline fn write_string(inout self, src: String) -> (Int, Error): """Writes the given string to the file descriptor. Args: src: The string to write to the file descriptor. Returns: The number of bytes written to the file descriptor. """ return self._write(src.as_bytes_slice()) @always_inline fn read_from[R: io.Reader](inout self, inout reader: R) -> (Int, Error): """Reads from the given reader to a temporary buffer and writes to the file descriptor. Args: reader: The reader to read from. Returns: The number of bytes written to the file descriptor. """ var buffer = List[UInt8](capacity=io.BUFFER_SIZE) _ = reader.read(buffer) return self._write(Span(buffer)) --- external/gojo/strings/__init__.mojo --- from .builder import StringBuilder from .reader import Reader, new_reader --- external/gojo/strings/builder.mojo --- import ..io struct StringBuilder[growth_factor: Float32 = 2]( Stringable, Sized, io.Writer, io.StringWriter, io.ByteWriter, ): """ A string builder class that allows for efficient string management and concatenation. This class is useful when you need to build a string by appending multiple strings together. The performance increase is not linear. Compared to string concatenation, I've observed around 20-30x faster for writing and rending ~4KB and up to 2100x-2300x for ~4MB. This is because it avoids the overhead of creating and destroying many intermediate strings and performs memcopy operations. The result is a more efficient when building larger string concatenations. It is generally not recommended to use this class for small concatenations such as a few strings like `a + b + c + d` because the overhead of creating the string builder and appending the strings is not worth the performance gain. Example: ``` from strings.builder import StringBuilder var sb = StringBuilder() sb.write_string("Hello ") sb.write_string("World!") print(sb) # Hello World! ``` """ var _data: UnsafePointer[UInt8] var _size: Int var _capacity: Int @always_inline fn __init__(inout self, *, capacity: Int = 4096): constrained[growth_factor >= 1.25]() self._data = UnsafePointer[UInt8]().alloc(capacity) self._size = 0 self._capacity = capacity @always_inline fn __moveinit__(inout self, owned other: Self): self._data = other._data self._size = other._size self._capacity = other._capacity other._data = UnsafePointer[UInt8]() other._size = 0 other._capacity = 0 @always_inline fn __del__(owned self): if self._data: self._data.free() @always_inline fn __len__(self) -> Int: """Returns the length of the string builder.""" return self._size @always_inline fn __str__(self) -> String: """ Converts the string builder to a string. Returns: The string representation of the string builder. Returns an empty string if the string builder is empty. """ var copy = UnsafePointer[UInt8]().alloc(self._size) memcpy(copy, self._data, self._size) return StringRef(copy, self._size) @always_inline fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the internal _data as a Span[UInt8].""" return Span[UInt8, self.is_mutable, self.lifetime](unsafe_ptr=self[]._data, len=self[]._size) @always_inline fn render( self: Reference[Self], ) -> StringSlice[self.is_mutable, self.lifetime]: """ Return a StringSlice view of the _data owned by the builder. Slightly faster than __str__, 10-20% faster in limited testing. Returns: The string representation of the string builder. Returns an empty string if the string builder is empty. """ return StringSlice[self.is_mutable, self.lifetime](unsafe_from_utf8_ptr=self[]._data, len=self[]._size) @always_inline fn _resize(inout self, _capacity: Int) -> None: """ Resizes the string builder buffer. Args: _capacity: The new _capacity of the string builder buffer. """ var new__data = UnsafePointer[UInt8]().alloc(_capacity) memcpy(new__data, self._data, self._size) self._data.free() self._data = new__data self._capacity = _capacity return None @always_inline fn _resize_if_needed(inout self, bytes_to_add: Int): """Resizes the buffer if the bytes to add exceeds the current capacity.""" # TODO: Handle the case where new_capacity is greater than MAX_INT. It should panic. if bytes_to_add > self._capacity - self._size: var new_capacity = int(self._capacity * 2) if new_capacity < self._capacity + bytes_to_add: new_capacity = self._capacity + bytes_to_add self._resize(new_capacity) @always_inline fn _write(inout self, src: Span[UInt8]) -> (Int, Error): """ Appends a byte Span to the builder buffer. Args: src: The byte array to append. """ self._resize_if_needed(len(src)) memcpy(self._data.offset(self._size), src._data, len(src)) self._size += len(src) return len(src), Error() @always_inline fn write(inout self, src: List[UInt8]) -> (Int, Error): """ Appends a byte List to the builder buffer. Args: src: The byte array to append. """ var span = Span(src) var bytes_read: Int var err: Error bytes_read, err = self._write(span) return bytes_read, err @always_inline fn write_string(inout self, src: String) -> (Int, Error): """ Appends a string to the builder buffer. Args: src: The string to append. """ return self._write(src.as_bytes_slice()) @always_inline fn write_byte(inout self, byte: UInt8) -> (Int, Error): self._resize_if_needed(1) self._data[self._size] = byte self._size += 1 return 1, Error() --- external/gojo/strings/reader.mojo --- import ..io from ..builtins import copy, panic @value # TODO: Uncomment write_to and write_buf once the bug with the trait's Span argument is fixed. struct Reader( Sized, io.Reader, io.ReaderAt, io.ByteReader, io.ByteScanner, io.Seeker, # io.WriterTo, ): """A Reader that implements the [io.Reader], [io.ReaderAt], [io.ByteReader], [io.ByteScanner], [io.Seeker], and [io.WriterTo] traits by reading from a string. The zero value for Reader operates like a Reader of an empty string. """ var string: String var read_pos: Int # current reading index var prev_rune: Int # index of previous rune; or < 0 @always_inline fn __init__(inout self, string: String = ""): self.string = string self.read_pos = 0 self.prev_rune = -1 @always_inline fn __len__(self) -> Int: """Returns the number of bytes of the unread portion of the string. Returns: int: the number of bytes of the unread portion of the string. """ if self.read_pos >= len(self.string): return 0 return len(self.string) - self.read_pos @always_inline fn size(self) -> Int: """Returns the original length of the underlying string. size is the number of bytes available for reading via [Reader.read_at]. The returned value is always the same and is not affected by calls to any other method. Returns: The original length of the underlying string. """ return len(self.string) @always_inline fn _read(inout self, inout dest: Span[UInt8, True], capacity: Int) -> (Int, Error): """Reads from the underlying string into the provided List[UInt8] object. Implements the [io.Reader] trait. Args: dest: The destination List[UInt8] object to read into. capacity: The capacity of the destination List[UInt8] object. Returns: The number of bytes read into dest. """ if self.read_pos >= len(self.string): return 0, io.EOF self.prev_rune = -1 var bytes_written = copy(dest, self.string.as_bytes_slice()[self.read_pos :]) self.read_pos += bytes_written return bytes_written, Error() @always_inline fn read(inout self, inout dest: List[UInt8]) -> (Int, Error): """Reads from the underlying string into the provided List[UInt8] object. Implements the [io.Reader] trait. Args: dest: The destination List[UInt8] object to read into. Returns: The number of bytes read into dest. """ var span = Span(dest) var bytes_read: Int var err: Error bytes_read, err = self._read(span, dest.capacity) dest.size += bytes_read return bytes_read, err @always_inline fn _read_at(self, inout dest: Span[UInt8, True], off: Int, capacity: Int) -> (Int, Error): """Reads from the Reader into the dest List[UInt8] starting at the offset off. It returns the number of bytes read into dest and an error if any. Args: dest: The destination List[UInt8] object to read into. off: The byte offset to start reading from. capacity: The capacity of the destination List[UInt8] object. Returns: The number of bytes read into dest. """ # cannot modify state - see io.ReaderAt if off < 0: return 0, Error("strings.Reader.read_at: negative offset") if off >= len(self.string): return 0, io.EOF var error = Error() var copied_elements_count = copy(dest, self.string.as_bytes_slice()[off:]) if copied_elements_count < len(dest): error = Error(str(io.EOF)) return copied_elements_count, error @always_inline fn read_at(self, inout dest: List[UInt8], off: Int) -> (Int, Error): """Reads from the Reader into the dest List[UInt8] starting at the offset off. It returns the number of bytes read into dest and an error if any. Args: dest: The destination List[UInt8] object to read into. off: The byte offset to start reading from. Returns: The number of bytes read into dest. """ var span = Span(dest) var bytes_read: Int var err: Error bytes_read, err = self._read_at(span, off, dest.capacity) dest.size += bytes_read return bytes_read, err @always_inline fn read_byte(inout self) -> (UInt8, Error): """Reads the next byte from the underlying string.""" self.prev_rune = -1 if self.read_pos >= len(self.string): return UInt8(0), io.EOF var b = self.string.as_bytes_slice()[self.read_pos] self.read_pos += 1 return UInt8(b), Error() @always_inline fn unread_byte(inout self) -> Error: """Unreads the last byte read. Only the most recent byte read can be unread.""" if self.read_pos <= 0: return Error("strings.Reader.unread_byte: at beginning of string") self.prev_rune = -1 self.read_pos -= 1 return Error() # # read_rune implements the [io.RuneReader] trait. # fn read_rune() (ch rune, size int, err error): # if self.read_pos >= Int(len(self.string)): # self.prev_rune = -1 # return 0, 0, io.EOF # self.prev_rune = int(self.read_pos) # if c = self.string[self.read_pos]; c < utf8.RuneSelf: # self.read_pos += 1 # return rune(c), 1, nil # ch, size = utf8.DecodeRuneInString(self.string[self.read_pos:]) # self.read_pos += Int(size) # return # # unread_rune implements the [io.RuneScanner] trait. # fn unread_rune() error: # if self.read_pos <= 0: # return errors.New("strings.Reader.unread_rune: at beginning of string") # if self.prev_rune < 0: # return errors.New("strings.Reader.unread_rune: previous operation was not read_rune") # self.read_pos = Int(self.prev_rune) # self.prev_rune = -1 # return nil fn seek(inout self, offset: Int, whence: Int) -> (Int, Error): """Seeks to a new position in the underlying string. The next read will start from that position. Args: offset: The offset to seek to. whence: The seek mode. It can be one of [io.SEEK_START], [io.SEEK_CURRENT], or [io.SEEK_END]. Returns: The new position in the string. """ self.prev_rune = -1 var position: Int = 0 if whence == io.SEEK_START: position = offset elif whence == io.SEEK_CURRENT: position = self.read_pos + offset elif whence == io.SEEK_END: position = Int(len(self.string)) + offset else: return Int(0), Error("strings.Reader.seek: invalid whence") if position < 0: return Int(0), Error("strings.Reader.seek: negative position") self.read_pos = position return position, Error() # fn write_to[W: io.Writer](inout self, inout writer: W) -> (Int, Error): # """Writes the remaining portion of the underlying string to the provided writer. # Implements the [io.WriterTo] trait. # Args: # writer: The writer to write the remaining portion of the string to. # Returns: # The number of bytes written to the writer. # """ # self.prev_rune = -1 # var err = Error() # if self.read_pos >= len(self.string): # return Int(0), err # var chunk_to_write = self.string.as_bytes_slice()[self.read_pos :] # var bytes_written: Int # bytes_written, err = writer.write(chunk_to_write) # if bytes_written > len(chunk_to_write): # panic("strings.Reader.write_to: invalid write_string count") # self.read_pos += bytes_written # if bytes_written != len(chunk_to_write) and not err: # err = Error(io.ERR_SHORT_WRITE) # return bytes_written, err # # TODO: How can I differentiate between the two write_to methods when the writer implements both traits? # fn write_to[W: io.StringWriter](inout self, inout writer: W) raises -> Int: # """Writes the remaining portion of the underlying string to the provided writer. # Implements the [io.WriterTo] trait. # Args: # writer: The writer to write the remaining portion of the string to. # Returns: # The number of bytes written to the writer. # """ # self.prev_rune = -1 # if self.read_pos >= Int(len(self.string)): # return 0 # var chunk_to_write = self.string[self.read_pos:] # var bytes_written = io.write_string(writer, chunk_to_write) # if bytes_written > len(chunk_to_write): # raise Error("strings.Reader.write_to: invalid write_string count") # self.read_pos += Int(bytes_written) # if bytes_written != len(chunk_to_write): # raise Error(io.ERR_SHORT_WRITE) # return Int(bytes_written) @always_inline fn reset(inout self, string: String): """Resets the [Reader] to be reading from the beginning of the provided string. Args: string: The string to read from. """ self.string = string self.read_pos = 0 self.prev_rune = -1 fn new_reader(string: String = "") -> Reader: """Returns a new [Reader] reading from the provided string. It is similar to [bytes.new_buffer] but more efficient and non-writable. Args: string: The string to read from. """ return Reader(string) --- external/gojo/syscall/__init__.mojo --- from .net import ( FD, SocketType, AddressFamily, ProtocolFamily, SocketOptions, AddressInformation, send, sendto, recv, recvfrom, open, addrinfo, addrinfo_unix, sockaddr, sockaddr_in, socklen_t, socket, connect, htons, ntohs, inet_pton, inet_ntop, getaddrinfo, getaddrinfo_unix, gai_strerror, shutdown, inet_ntoa, bind, listen, accept, setsockopt, getsockopt, getsockname, getpeername, SHUT_RDWR, SOL_SOCKET, ) from .file import close, FileDescriptorBase # Adapted from https://github.com/crisadamo/mojo-Libc . Huge thanks to Cristian! # C types alias c_void = UInt8 alias c_char = UInt8 alias c_schar = Int8 alias c_uchar = UInt8 alias c_short = Int16 alias c_ushort = UInt16 alias c_int = Int32 alias c_uint = UInt32 alias c_long = Int64 alias c_ulong = UInt64 alias c_float = Float32 alias c_double = Float64 # `Int` is known to be machine's width alias c_size_t = Int alias c_ssize_t = Int alias ptrdiff_t = Int64 alias intptr_t = Int64 alias uintptr_t = UInt64 --- external/gojo/syscall/file.mojo --- trait FileDescriptorBase(io.Reader, io.Writer, io.Closer): ... # --- ( File Related Syscalls & Structs )--------------------------------------- alias O_NONBLOCK = 16384 alias O_ACCMODE = 3 alias O_CLOEXEC = 524288 fn close(fildes: c_int) -> c_int: """Libc POSIX `close` function Reference: https://man7.org/linux/man-pages/man3/close.3p.html Fn signature: int close(int fildes). Args: fildes: A File Descriptor to close. Returns: Upon successful completion, 0 shall be returned; otherwise, -1 shall be returned and errno set to indicate the error. """ return external_call["close", c_int, c_int](fildes) fn open[*T: AnyType](path: UnsafePointer[c_char], oflag: c_int) -> c_int: """Libc POSIX `open` function Reference: https://man7.org/linux/man-pages/man3/open.3p.html Fn signature: int open(const char *path, int oflag, ...). Args: path: A pointer to a C string containing the path to open. oflag: The flags to open the file with. Returns: A File Descriptor or -1 in case of failure """ return external_call["open", c_int, UnsafePointer[c_char], c_int](path, oflag) # FnName, RetType # Args fn read(fildes: c_int, buf: UnsafePointer[c_void], nbyte: c_size_t) -> c_int: """Libc POSIX `read` function Reference: https://man7.org/linux/man-pages/man3/read.3p.html Fn signature: sssize_t read(int fildes, void *buf, size_t nbyte). Args: fildes: A File Descriptor. buf: A pointer to a buffer to store the read data. nbyte: The number of bytes to read. Returns: The number of bytes read or -1 in case of failure. """ return external_call["read", c_ssize_t, c_int, UnsafePointer[c_void], c_size_t](fildes, buf, nbyte) fn write(fildes: c_int, buf: UnsafePointer[c_void], nbyte: c_size_t) -> c_int: """Libc POSIX `write` function Reference: https://man7.org/linux/man-pages/man3/write.3p.html Fn signature: ssize_t write(int fildes, const void *buf, size_t nbyte). Args: fildes: A File Descriptor. buf: A pointer to a buffer to write. nbyte: The number of bytes to write. Returns: The number of bytes written or -1 in case of failure. """ return external_call["write", c_ssize_t, c_int, UnsafePointer[c_void], c_size_t](fildes, buf, nbyte) --- external/gojo/syscall/net.mojo --- from . import c_char, c_int, c_ushort, c_uint, c_size_t, c_ssize_t from .file import O_CLOEXEC, O_NONBLOCK from utils.static_tuple import StaticTuple alias IPPROTO_IPV6 = 41 alias IPV6_V6ONLY = 26 alias EPROTONOSUPPORT = 93 # Adapted from https://github.com/gabrieldemarmiesse/mojo-stdlib-extensions/ . Huge thanks to Gabriel! struct FD: alias STDIN = 0 alias STDOUT = 1 alias STDERR = 2 alias SUCCESS = 0 alias GRND_NONBLOCK: UInt8 = 1 alias char_pointer = UnsafePointer[UInt8] # --- ( error.h Constants )----------------------------------------------------- struct ErrnoConstants: alias EPERM = 1 alias ENOENT = 2 alias ESRCH = 3 alias EINTR = 4 alias EIO = 5 alias ENXIO = 6 alias E2BIG = 7 alias ENOEXEC = 8 alias EBADF = 9 alias ECHILD = 10 alias EAGAIN = 11 alias ENOMEM = 12 alias EACCES = 13 alias EFAULT = 14 alias ENOTBLK = 15 alias EBUSY = 16 alias EEXIST = 17 alias EXDEV = 18 alias ENODEV = 19 alias ENOTDIR = 20 alias EISDIR = 21 alias EINVAL = 22 alias ENFILE = 23 alias EMFILE = 24 alias ENOTTY = 25 alias ETXTBSY = 26 alias EFBIG = 27 alias ENOSPC = 28 alias ESPIPE = 29 alias EROFS = 30 alias EMLINK = 31 alias EPIPE = 32 alias EDOM = 33 alias ERANGE = 34 alias EWOULDBLOCK = 11 # fn to_char_ptr(s: String) -> UnsafePointer[UInt8]: # """Only ASCII-based strings.""" # var ptr = UnsafePointer[UInt8]().alloc(len(s)) # for i in range(len(s)): # ptr.store(i, ord(s[i])) # return ptr fn cftob(val: c_int) -> Bool: """Convert C-like failure (-1) to Bool.""" return rebind[Bool](val > 0) # --- ( Network Related Constants )--------------------------------------------- alias sa_family_t = c_ushort alias socklen_t = c_uint alias in_addr_t = c_uint alias in_port_t = c_ushort # Address Family Constants struct AddressFamily: alias AF_UNSPEC = 0 alias AF_UNIX = 1 alias AF_LOCAL = 1 alias AF_INET = 2 alias AF_AX25 = 3 alias AF_IPX = 4 alias AF_APPLETALK = 5 alias AF_NETROM = 6 alias AF_BRIDGE = 7 alias AF_ATMPVC = 8 alias AF_X25 = 9 alias AF_INET6 = 10 alias AF_ROSE = 11 alias AF_DECnet = 12 alias AF_NETBEUI = 13 alias AF_SECURITY = 14 alias AF_KEY = 15 alias AF_NETLINK = 16 alias AF_ROUTE = 16 alias AF_PACKET = 17 alias AF_ASH = 18 alias AF_ECONET = 19 alias AF_ATMSVC = 20 alias AF_RDS = 21 alias AF_SNA = 22 alias AF_IRDA = 23 alias AF_PPPOX = 24 alias AF_WANPIPE = 25 alias AF_LLC = 26 alias AF_CAN = 29 alias AF_TIPC = 30 alias AF_BLUETOOTH = 31 alias AF_IUCV = 32 alias AF_RXRPC = 33 alias AF_ISDN = 34 alias AF_PHONET = 35 alias AF_IEEE802154 = 36 alias AF_CAIF = 37 alias AF_ALG = 38 alias AF_NFC = 39 alias AF_VSOCK = 40 alias AF_KCM = 41 alias AF_QIPCRTR = 42 alias AF_MAX = 43 # Protocol family constants struct ProtocolFamily: alias PF_UNSPEC = AddressFamily.AF_UNSPEC alias PF_UNIX = AddressFamily.AF_UNIX alias PF_LOCAL = AddressFamily.AF_LOCAL alias PF_INET = AddressFamily.AF_INET alias PF_AX25 = AddressFamily.AF_AX25 alias PF_IPX = AddressFamily.AF_IPX alias PF_APPLETALK = AddressFamily.AF_APPLETALK alias PF_NETROM = AddressFamily.AF_NETROM alias PF_BRIDGE = AddressFamily.AF_BRIDGE alias PF_ATMPVC = AddressFamily.AF_ATMPVC alias PF_X25 = AddressFamily.AF_X25 alias PF_INET6 = AddressFamily.AF_INET6 alias PF_ROSE = AddressFamily.AF_ROSE alias PF_DECnet = AddressFamily.AF_DECnet alias PF_NETBEUI = AddressFamily.AF_NETBEUI alias PF_SECURITY = AddressFamily.AF_SECURITY alias PF_KEY = AddressFamily.AF_KEY alias PF_NETLINK = AddressFamily.AF_NETLINK alias PF_ROUTE = AddressFamily.AF_ROUTE alias PF_PACKET = AddressFamily.AF_PACKET alias PF_ASH = AddressFamily.AF_ASH alias PF_ECONET = AddressFamily.AF_ECONET alias PF_ATMSVC = AddressFamily.AF_ATMSVC alias PF_RDS = AddressFamily.AF_RDS alias PF_SNA = AddressFamily.AF_SNA alias PF_IRDA = AddressFamily.AF_IRDA alias PF_PPPOX = AddressFamily.AF_PPPOX alias PF_WANPIPE = AddressFamily.AF_WANPIPE alias PF_LLC = AddressFamily.AF_LLC alias PF_CAN = AddressFamily.AF_CAN alias PF_TIPC = AddressFamily.AF_TIPC alias PF_BLUETOOTH = AddressFamily.AF_BLUETOOTH alias PF_IUCV = AddressFamily.AF_IUCV alias PF_RXRPC = AddressFamily.AF_RXRPC alias PF_ISDN = AddressFamily.AF_ISDN alias PF_PHONET = AddressFamily.AF_PHONET alias PF_IEEE802154 = AddressFamily.AF_IEEE802154 alias PF_CAIF = AddressFamily.AF_CAIF alias PF_ALG = AddressFamily.AF_ALG alias PF_NFC = AddressFamily.AF_NFC alias PF_VSOCK = AddressFamily.AF_VSOCK alias PF_KCM = AddressFamily.AF_KCM alias PF_QIPCRTR = AddressFamily.AF_QIPCRTR alias PF_MAX = AddressFamily.AF_MAX # Socket Type constants struct SocketType: alias SOCK_STREAM = 1 alias SOCK_DGRAM = 2 alias SOCK_RAW = 3 alias SOCK_RDM = 4 alias SOCK_SEQPACKET = 5 alias SOCK_DCCP = 6 alias SOCK_PACKET = 10 alias SOCK_CLOEXEC = O_CLOEXEC alias SOCK_NONBLOCK = O_NONBLOCK # Address Information struct AddressInformation: alias AI_PASSIVE = 1 alias AI_CANONNAME = 2 alias AI_NUMERICHOST = 4 alias AI_V4MAPPED = 2048 alias AI_ALL = 256 alias AI_ADDRCONFIG = 1024 alias AI_IDN = 64 alias INET_ADDRSTRLEN = 16 alias INET6_ADDRSTRLEN = 46 alias SHUT_RD = 0 alias SHUT_WR = 1 alias SHUT_RDWR = 2 alias SOL_SOCKET = 65535 # Socket Options struct SocketOptions: alias SO_DEBUG = 1 alias SO_REUSEADDR = 4 alias SO_TYPE = 4104 alias SO_ERROR = 4103 alias SO_DONTROUTE = 16 alias SO_BROADCAST = 32 alias SO_SNDBUF = 4097 alias SO_RCVBUF = 4098 alias SO_KEEPALIVE = 8 alias SO_OOBINLINE = 256 alias SO_LINGER = 128 alias SO_REUSEPORT = 512 alias SO_RCVLOWAT = 4100 alias SO_SNDLOWAT = 4099 alias SO_RCVTIMEO = 4102 alias SO_SNDTIMEO = 4101 alias SO_RCVTIMEO_OLD = 4102 alias SO_SNDTIMEO_OLD = 4101 alias SO_ACCEPTCONN = 2 # unsure of these socket options, they weren't available via python alias SO_NO_CHECK = 11 alias SO_PRIORITY = 12 alias SO_BSDCOMPAT = 14 alias SO_PASSCRED = 16 alias SO_PEERCRED = 17 alias SO_SECURITY_AUTHENTICATION = 22 alias SO_SECURITY_ENCRYPTION_TRANSPORT = 23 alias SO_SECURITY_ENCRYPTION_NETWORK = 24 alias SO_BINDTODEVICE = 25 alias SO_ATTACH_FILTER = 26 alias SO_DETACH_FILTER = 27 alias SO_GET_FILTER = 26 alias SO_PEERNAME = 28 alias SO_TIMESTAMP = 29 alias SO_TIMESTAMP_OLD = 29 alias SO_PEERSEC = 31 alias SO_SNDBUFFORCE = 32 alias SO_RCVBUFFORCE = 33 alias SO_PASSSEC = 34 alias SO_TIMESTAMPNS = 35 alias SO_TIMESTAMPNS_OLD = 35 alias SO_MARK = 36 alias SO_TIMESTAMPING = 37 alias SO_TIMESTAMPING_OLD = 37 alias SO_PROTOCOL = 38 alias SO_DOMAIN = 39 alias SO_RXQ_OVFL = 40 alias SO_WIFI_STATUS = 41 alias SCM_WIFI_STATUS = 41 alias SO_PEEK_OFF = 42 alias SO_NOFCS = 43 alias SO_LOCK_FILTER = 44 alias SO_SELECT_ERR_QUEUE = 45 alias SO_BUSY_POLL = 46 alias SO_MAX_PACING_RATE = 47 alias SO_BPF_EXTENSIONS = 48 alias SO_INCOMING_CPU = 49 alias SO_ATTACH_BPF = 50 alias SO_DETACH_BPF = 27 alias SO_ATTACH_REUSEPORT_CBPF = 51 alias SO_ATTACH_REUSEPORT_EBPF = 52 alias SO_CNX_ADVICE = 53 alias SCM_TIMESTAMPING_OPT_STATS = 54 alias SO_MEMINFO = 55 alias SO_INCOMING_NAPI_ID = 56 alias SO_COOKIE = 57 alias SCM_TIMESTAMPING_PKTINFO = 58 alias SO_PEERGROUPS = 59 alias SO_ZEROCOPY = 60 alias SO_TXTIME = 61 alias SCM_TXTIME = 61 alias SO_BINDTOIFINDEX = 62 alias SO_TIMESTAMP_NEW = 63 alias SO_TIMESTAMPNS_NEW = 64 alias SO_TIMESTAMPING_NEW = 65 alias SO_RCVTIMEO_NEW = 66 alias SO_SNDTIMEO_NEW = 67 alias SO_DETACH_REUSEPORT_BPF = 68 # --- ( Network Related Structs )----------------------------------------------- @value @register_passable("trivial") struct in_addr: var s_addr: in_addr_t @value @register_passable("trivial") struct in6_addr: var s6_addr: StaticTuple[c_char, 16] @value @register_passable("trivial") struct sockaddr: var sa_family: sa_family_t var sa_data: StaticTuple[c_char, 14] @value @register_passable("trivial") struct sockaddr_in: var sin_family: sa_family_t var sin_port: in_port_t var sin_addr: in_addr var sin_zero: StaticTuple[c_char, 8] @value @register_passable("trivial") struct sockaddr_in6: var sin6_family: sa_family_t var sin6_port: in_port_t var sin6_flowinfo: c_uint var sin6_addr: in6_addr var sin6_scope_id: c_uint @value @register_passable("trivial") struct addrinfo: """Struct field ordering can vary based on platform. For MacOS, I had to swap the order of ai_canonname and ai_addr. https://stackoverflow.com/questions/53575101/calling-getaddrinfo-directly-from-python-ai-addr-is-null-pointer. """ var ai_flags: c_int var ai_family: c_int var ai_socktype: c_int var ai_protocol: c_int var ai_addrlen: socklen_t var ai_canonname: UnsafePointer[UInt8] var ai_addr: UnsafePointer[sockaddr] var ai_next: UnsafePointer[addrinfo] fn __init__( inout self, ai_flags: c_int = 0, ai_family: c_int = 0, ai_socktype: c_int = 0, ai_protocol: c_int = 0, ai_addrlen: socklen_t = 0, ai_canonname: UnsafePointer[UInt8] = UnsafePointer[UInt8](), ai_addr: UnsafePointer[sockaddr] = UnsafePointer[sockaddr](), ai_next: UnsafePointer[addrinfo] = UnsafePointer[addrinfo](), ): self.ai_flags = ai_flags self.ai_family = ai_family self.ai_socktype = ai_socktype self.ai_protocol = ai_protocol self.ai_addrlen = ai_addrlen self.ai_canonname = ai_canonname self.ai_addr = ai_addr self.ai_next = ai_next # fn __init__() -> Self: # return Self(0, 0, 0, 0, 0, UnsafePointer[UInt8](), UnsafePointer[sockaddr](), UnsafePointer[addrinfo]()) @value @register_passable("trivial") struct addrinfo_unix: """Struct field ordering can vary based on platform. For MacOS, I had to swap the order of ai_canonname and ai_addr. https://stackoverflow.com/questions/53575101/calling-getaddrinfo-directly-from-python-ai-addr-is-null-pointer. """ var ai_flags: c_int var ai_family: c_int var ai_socktype: c_int var ai_protocol: c_int var ai_addrlen: socklen_t var ai_addr: UnsafePointer[sockaddr] var ai_canonname: UnsafePointer[UInt8] var ai_next: UnsafePointer[addrinfo] fn __init__( inout self, ai_flags: c_int = 0, ai_family: c_int = 0, ai_socktype: c_int = 0, ai_protocol: c_int = 0, ai_addrlen: socklen_t = 0, ai_canonname: UnsafePointer[UInt8] = UnsafePointer[UInt8](), ai_addr: UnsafePointer[sockaddr] = UnsafePointer[sockaddr](), ai_next: UnsafePointer[addrinfo] = UnsafePointer[addrinfo](), ): self.ai_flags = ai_flags self.ai_family = ai_family self.ai_socktype = ai_socktype self.ai_protocol = ai_protocol self.ai_addrlen = ai_addrlen self.ai_canonname = ai_canonname self.ai_addr = ai_addr self.ai_next = ai_next # --- ( Network Related Syscalls & Structs )------------------------------------ fn htonl(hostlong: c_uint) -> c_uint: """Libc POSIX `htonl` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint32_t htonl(uint32_t hostlong). Args: hostlong: A 32-bit integer in host byte order. Returns: The value provided in network byte order. """ return external_call["htonl", c_uint, c_uint](hostlong) fn htons(hostshort: c_ushort) -> c_ushort: """Libc POSIX `htons` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint16_t htons(uint16_t hostshort). Args: hostshort: A 16-bit integer in host byte order. Returns: The value provided in network byte order. """ return external_call["htons", c_ushort, c_ushort](hostshort) fn ntohl(netlong: c_uint) -> c_uint: """Libc POSIX `ntohl` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint32_t ntohl(uint32_t netlong). Args: netlong: A 32-bit integer in network byte order. Returns: The value provided in host byte order. """ return external_call["ntohl", c_uint, c_uint](netlong) fn ntohs(netshort: c_ushort) -> c_ushort: """Libc POSIX `ntohs` function Reference: https://man7.org/linux/man-pages/man3/htonl.3p.html Fn signature: uint16_t ntohs(uint16_t netshort). Args: netshort: A 16-bit integer in network byte order. Returns: The value provided in host byte order. """ return external_call["ntohs", c_ushort, c_ushort](netshort) fn inet_ntop( af: c_int, src: UnsafePointer[UInt8], dst: UnsafePointer[UInt8], size: socklen_t, ) -> UnsafePointer[UInt8]: """Libc POSIX `inet_ntop` function Reference: https://man7.org/linux/man-pages/man3/inet_ntop.3p.html. Fn signature: const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size). Args: af: Address Family see AF_ aliases. src: A pointer to a binary address. dst: A pointer to a buffer to store the result. size: The size of the buffer. Returns: A pointer to the buffer containing the result. """ return external_call[ "inet_ntop", UnsafePointer[UInt8], # FnName, RetType c_int, UnsafePointer[UInt8], UnsafePointer[UInt8], socklen_t, # Args ](af, src, dst, size) fn inet_pton(af: c_int, src: UnsafePointer[UInt8], dst: UnsafePointer[UInt8]) -> c_int: """Libc POSIX `inet_pton` function Reference: https://man7.org/linux/man-pages/man3/inet_ntop.3p.html Fn signature: int inet_pton(int af, const char *restrict src, void *restrict dst). Args: af: Address Family see AF_ aliases. src: A pointer to a string containing the address. dst: A pointer to a buffer to store the result. Returns: 1 on success, 0 if the input is not a valid address, -1 on error. """ return external_call[ "inet_pton", c_int, # FnName, RetType c_int, UnsafePointer[UInt8], UnsafePointer[UInt8], # Args ](af, src, dst) fn inet_addr(cp: UnsafePointer[UInt8]) -> in_addr_t: """Libc POSIX `inet_addr` function Reference: https://man7.org/linux/man-pages/man3/inet_addr.3p.html Fn signature: in_addr_t inet_addr(const char *cp). Args: cp: A pointer to a string containing the address. Returns: The address in network byte order. """ return external_call["inet_addr", in_addr_t, UnsafePointer[UInt8]](cp) fn inet_ntoa(addr: in_addr) -> UnsafePointer[UInt8]: """Libc POSIX `inet_ntoa` function Reference: https://man7.org/linux/man-pages/man3/inet_addr.3p.html Fn signature: char *inet_ntoa(struct in_addr in). Args: in: A pointer to a string containing the address. Returns: The address in network byte order. """ return external_call["inet_ntoa", UnsafePointer[UInt8], in_addr](addr) fn socket(domain: c_int, type: c_int, protocol: c_int) -> c_int: """Libc POSIX `socket` function Reference: https://man7.org/linux/man-pages/man3/socket.3p.html Fn signature: int socket(int domain, int type, int protocol). Args: domain: Address Family see AF_ aliases. type: Socket Type see SOCK_ aliases. protocol: The protocol to use. Returns: A File Descriptor or -1 in case of failure. """ return external_call["socket", c_int, c_int, c_int, c_int](domain, type, protocol) # FnName, RetType # Args fn setsockopt( socket: c_int, level: c_int, option_name: c_int, option_value: UnsafePointer[UInt8], option_len: socklen_t, ) -> c_int: """Libc POSIX `setsockopt` function Reference: https://man7.org/linux/man-pages/man3/setsockopt.3p.html Fn signature: int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len). Args: socket: A File Descriptor. level: The protocol level. option_name: The option to set. option_value: A pointer to the value to set. option_len: The size of the value. Returns: 0 on success, -1 on error. """ return external_call[ "setsockopt", c_int, # FnName, RetType c_int, c_int, c_int, UnsafePointer[UInt8], socklen_t, # Args ](socket, level, option_name, option_value, option_len) fn getsockopt( socket: c_int, level: c_int, option_name: c_int, option_value: UnsafePointer[UInt8], option_len: UnsafePointer[socklen_t], ) -> c_int: """Libc POSIX `getsockopt` function Reference: https://man7.org/linux/man-pages/man3/getsockopt.3p.html Fn signature: int getsockopt(int socket, int level, int option_name, void *restrict option_value, socklen_t *restrict option_len). Args: socket: A File Descriptor. level: The protocol level. option_name: The option to get. option_value: A pointer to the value to get. option_len: DTypePointer to the size of the value. Returns: 0 on success, -1 on error. """ return external_call[ "getsockopt", c_int, # FnName, RetType c_int, c_int, c_int, UnsafePointer[UInt8], UnsafePointer[socklen_t], # Args ](socket, level, option_name, option_value, option_len) fn getsockname( socket: c_int, address: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t], ) -> c_int: """Libc POSIX `getsockname` function Reference: https://man7.org/linux/man-pages/man3/getsockname.3p.html Fn signature: int getsockname(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len). Args: socket: A File Descriptor. address: A pointer to a buffer to store the address of the peer. address_len: A pointer to the size of the buffer. Returns: 0 on success, -1 on error. """ return external_call[ "getsockname", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](socket, address, address_len) fn getpeername( sockfd: c_int, addr: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t], ) -> c_int: """Libc POSIX `getpeername` function Reference: https://man7.org/linux/man-pages/man2/getpeername.2.html Fn signature: int getpeername(int socket, struct sockaddr *restrict addr, socklen_t *restrict address_len). Args: sockfd: A File Descriptor. addr: A pointer to a buffer to store the address of the peer. address_len: A pointer to the size of the buffer. Returns: 0 on success, -1 on error. """ return external_call[ "getpeername", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](sockfd, addr, address_len) fn bind(socket: c_int, address: UnsafePointer[sockaddr], address_len: socklen_t) -> c_int: """Libc POSIX `bind` function Reference: https://man7.org/linux/man-pages/man3/bind.3p.html Fn signature: int bind(int socket, const struct sockaddr *address, socklen_t address_len). """ return external_call["bind", c_int, c_int, UnsafePointer[sockaddr], socklen_t]( # FnName, RetType # Args socket, address, address_len ) fn listen(socket: c_int, backlog: c_int) -> c_int: """Libc POSIX `listen` function Reference: https://man7.org/linux/man-pages/man3/listen.3p.html Fn signature: int listen(int socket, int backlog). Args: socket: A File Descriptor. backlog: The maximum length of the queue of pending connections. Returns: 0 on success, -1 on error. """ return external_call["listen", c_int, c_int, c_int](socket, backlog) fn accept( socket: c_int, address: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t], ) -> c_int: """Libc POSIX `accept` function Reference: https://man7.org/linux/man-pages/man3/accept.3p.html Fn signature: int accept(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len). Args: socket: A File Descriptor. address: A pointer to a buffer to store the address of the peer. address_len: A pointer to the size of the buffer. Returns: A File Descriptor or -1 in case of failure. """ return external_call[ "accept", c_int, # FnName, RetType c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], # Args ](socket, address, address_len) fn connect(socket: c_int, address: UnsafePointer[sockaddr], address_len: socklen_t) -> c_int: """Libc POSIX `connect` function Reference: https://man7.org/linux/man-pages/man3/connect.3p.html Fn signature: int connect(int socket, const struct sockaddr *address, socklen_t address_len). Args: socket: A File Descriptor. address: A pointer to the address to connect to. address_len: The size of the address. Returns: 0 on success, -1 on error. """ return external_call["connect", c_int, c_int, UnsafePointer[sockaddr], socklen_t]( # FnName, RetType # Args socket, address, address_len ) fn recv( socket: c_int, buffer: UnsafePointer[UInt8], length: c_size_t, flags: c_int, ) -> c_ssize_t: """Libc POSIX `recv` function Reference: https://man7.org/linux/man-pages/man3/recv.3p.html Fn signature: ssize_t recv(int socket, void *buffer, size_t length, int flags). Args: socket: Specifies the socket file descriptor. buffer: Points to the buffer where the message should be stored. length: Specifies the length in bytes of the buffer pointed to by the buffer argument. flags: Specifies the type of message reception. Returns: The number of bytes received or -1 in case of failure. Valid Flags: MSG_PEEK: Peeks at an incoming message. The data is treated as unread and the next recvfrom() or similar function shall still return this data. MSG_OOB: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific. MSG_WAITALL: On SOCK_STREAM sockets this requests that the function block until the full amount of data can be returned. The function may return the smaller amount of data if the socket is a message-based socket, if a signal is caught, if the connection is terminated, if MSG_PEEK was specified, or if an error is pending for the socket. """ return external_call[ "recv", c_ssize_t, c_int, UnsafePointer[UInt8], c_size_t, c_int, ](socket, buffer, length, flags) fn recvfrom( socket: c_int, buffer: UnsafePointer[UInt8], length: c_size_t, flags: c_int, address: UnsafePointer[sockaddr], address_len: UnsafePointer[socklen_t], ) -> c_ssize_t: """Libc POSIX `recvfrom` function Reference: https://man7.org/linux/man-pages/man3/recvfrom.3p.html Fn signature: ssize_t recvfrom(int socket, void *restrict buffer, size_t length, int flags, struct sockaddr *restrict address, socklen_t *restrict address_len). Args: socket: Specifies the socket file descriptor. buffer: Points to the buffer where the message should be stored. length: Specifies the length in bytes of the buffer pointed to by the buffer argument. flags: Specifies the type of message reception. address: A null pointer, or points to a sockaddr structure in which the sending address is to be stored. address_len: Either a null pointer, if address is a null pointer, or a pointer to a socklen_t object which on input specifies the length of the supplied sockaddr structure, and on output specifies the length of the stored address. Returns: The number of bytes received or -1 in case of failure. Valid Flags: MSG_PEEK: Peeks at an incoming message. The data is treated as unread and the next recvfrom() or similar function shall still return this data. MSG_OOB: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific. MSG_WAITALL: On SOCK_STREAM sockets this requests that the function block until the full amount of data can be returned. The function may return the smaller amount of data if the socket is a message-based socket, if a signal is caught, if the connection is terminated, if MSG_PEEK was specified, or if an error is pending for the socket. """ return external_call[ "recvfrom", c_ssize_t, c_int, UnsafePointer[UInt8], c_size_t, c_int, UnsafePointer[sockaddr], UnsafePointer[socklen_t], ](socket, buffer, length, flags, address, address_len) fn send( socket: c_int, buffer: UnsafePointer[UInt8], length: c_size_t, flags: c_int, ) -> c_ssize_t: """Libc POSIX `send` function Reference: https://man7.org/linux/man-pages/man3/send.3p.html Fn signature: ssize_t send(int socket, const void *buffer, size_t length, int flags). Args: socket: A File Descriptor. buffer: A pointer to the buffer to send. length: The size of the buffer. flags: Flags to control the behaviour of the function. Returns: The number of bytes sent or -1 in case of failure. """ return external_call[ "send", c_ssize_t, # FnName, RetType c_int, UnsafePointer[UInt8], c_size_t, c_int, # Args ](socket, buffer, length, flags) fn sendto( socket: c_int, message: UnsafePointer[UInt8], length: c_size_t, flags: c_int, dest_addr: UnsafePointer[sockaddr], dest_len: socklen_t, ) -> c_ssize_t: """Libc POSIX `sendto` function Reference: https://man7.org/linux/man-pages/man3/sendto.3p.html Fn signature: ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len). Args: socket: Specifies the socket file descriptor. message: Points to a buffer containing the message to be sent. length: Specifies the size of the message in bytes. flags: Specifies the type of message transmission. dest_addr: Points to a sockaddr structure containing the destination address. dest_len: Specifies the length of the sockaddr. Returns: The number of bytes sent or -1 in case of failure. Valid Flags: MSG_EOR: Terminates a record (if supported by the protocol). MSG_OOB: Sends out-of-band data on sockets that support out-of-band data. The significance and semantics of out-of-band data are protocol-specific. MSG_NOSIGNAL: Requests not to send the SIGPIPE signal if an attempt to send is made on a stream-oriented socket that is no longer connected. The [EPIPE] error shall still be returned. """ return external_call[ "sendto", c_ssize_t, c_int, UnsafePointer[UInt8], c_size_t, c_int, UnsafePointer[sockaddr], socklen_t ](socket, message, length, flags, dest_addr, dest_len) fn shutdown(socket: c_int, how: c_int) -> c_int: """Libc POSIX `shutdown` function Reference: https://man7.org/linux/man-pages/man3/shutdown.3p.html Fn signature: int shutdown(int socket, int how). Args: socket: A File Descriptor. how: How to shutdown the socket. Returns: 0 on success, -1 on error. """ return external_call["shutdown", c_int, c_int, c_int](socket, how) # FnName, RetType # Args fn getaddrinfo( nodename: UnsafePointer[UInt8], servname: UnsafePointer[UInt8], hints: UnsafePointer[addrinfo], res: UnsafePointer[UnsafePointer[addrinfo]], ) -> c_int: """Libc POSIX `getaddrinfo` function Reference: https://man7.org/linux/man-pages/man3/getaddrinfo.3p.html Fn signature: int getaddrinfo(const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, struct addrinfo **restrict res). """ return external_call[ "getaddrinfo", c_int, # FnName, RetType UnsafePointer[UInt8], UnsafePointer[UInt8], UnsafePointer[addrinfo], # Args UnsafePointer[UnsafePointer[addrinfo]], # Args ](nodename, servname, hints, res) fn getaddrinfo_unix( nodename: UnsafePointer[UInt8], servname: UnsafePointer[UInt8], hints: UnsafePointer[addrinfo_unix], res: UnsafePointer[UnsafePointer[addrinfo_unix]], ) -> c_int: """Libc POSIX `getaddrinfo` function Reference: https://man7.org/linux/man-pages/man3/getaddrinfo.3p.html Fn signature: int getaddrinfo(const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, struct addrinfo **restrict res). """ return external_call[ "getaddrinfo", c_int, # FnName, RetType UnsafePointer[UInt8], UnsafePointer[UInt8], UnsafePointer[addrinfo_unix], # Args UnsafePointer[UnsafePointer[addrinfo_unix]], # Args ](nodename, servname, hints, res) fn gai_strerror(ecode: c_int) -> UnsafePointer[UInt8]: """Libc POSIX `gai_strerror` function Reference: https://man7.org/linux/man-pages/man3/gai_strerror.3p.html Fn signature: const char *gai_strerror(int ecode). Args: ecode: The error code. Returns: A pointer to a string describing the error. """ return external_call["gai_strerror", UnsafePointer[UInt8], c_int](ecode) # FnName, RetType # Args # fn inet_pton(address_family: Int, address: String) -> Int: # var ip_buf_size = 4 # if address_family == AF_INET6: # ip_buf_size = 16 # var ip_buf = UnsafePointer[UInt8].alloc(ip_buf_size) # var conv_status = inet_pton(rebind[c_int](address_family), to_char_ptr(address), ip_buf) # return int(ip_buf.bitcast[c_uint]().load()) --- external/gojo/unicode/__init__.mojo --- from .utf8 import rune_count_in_string, UnicodeString, rune_width, string_width, Condition, DEFAULT_CONDITION --- external/gojo/unicode/utf8/__init__.mojo --- """Almost all of the actual implementation in this module was written by @mzaks (https://github.com/mzaks)! This would not be possible without his help. """ from .runes import rune_count_in_string from .string import UnicodeString from .width import string_width, rune_width, Condition, DEFAULT_CONDITION --- external/gojo/unicode/utf8/runes.mojo --- """Almost all of the actual implementation in this module was written by @mzaks (https://github.com/mzaks)! This would not be possible without his help. """ from ...builtins import Rune from algorithm.functional import vectorize from sys.info import simdwidthof from bit import countl_zero # alias simd_width_u8 = simdwidthof[DType.uint8]() alias simd_width_u8 = 1 fn rune_count_in_string(s: String) -> Int: """Count the number of runes in a string. Args: s: The string to count runes in. Returns: The number of runes in the string. """ var p = DTypePointer[DType.uint8](s.unsafe_uint8_ptr()) var string_byte_length = len(s) var result = 0 @parameter fn count[simd_width: Int](offset: Int): result += int(((p.load[width=simd_width](offset) >> 6) != 0b10).reduce_add()) vectorize[count, simd_width_u8](string_byte_length) return result --- external/gojo/unicode/utf8/string.mojo --- from bit import countl_zero from algorithm.functional import vectorize from sys.info import simdwidthof alias simd_width_u8 = simdwidthof[DType.uint8]() @value struct UnicodeString(Stringable, Sized): """A string that supports Unicode characters. The algorithms to handle UTF-8 are from @maxim on the Mojo Discord. Thanks! """ var inner: String @always_inline fn __init__(inout self, owned s: String): self.inner = s^ @always_inline fn __init__(inout self, owned bytes: List[UInt8]): if bytes[-1] != 0: bytes.append(0) self.inner = String(bytes^) @always_inline fn __len__(self) -> Int: """Count the number of runes in a string. Returns: The number of runes in the string. """ var data = DTypePointer[DType.uint8](self.inner.unsafe_uint8_ptr()) var byte_count = len(self.inner) var result = 0 @parameter fn count[simd_width: Int](offset: Int): result += int(((data.load[width=simd_width](offset) >> 6) != 0b10).cast[DType.uint8]().reduce_add()) vectorize[count, simd_width_u8](byte_count) return result @always_inline fn __str__(self) -> String: return self.inner @always_inline fn __getitem__(self: Reference[Self], slice: Slice) -> StringSlice[self.is_mutable, self.lifetime]: """TODO: Doesn't handle negative indices.""" var bytes_left = len(self[].inner) var total_char_length: Int = 0 for _ in range(slice.start, slice.end): # Number of bytes of the current character var char_length = int( (DTypePointer[DType.uint8](self[].inner.unsafe_uint8_ptr() + total_char_length).load() >> 7 == 0).cast[ DType.uint8 ]() * 1 + countl_zero(~DTypePointer[DType.uint8](self[].inner.unsafe_uint8_ptr() + total_char_length).load()) ) # Move iterator forward bytes_left -= char_length total_char_length += char_length return StringSlice[self.is_mutable, self.lifetime]( unsafe_from_utf8_ptr=self[].inner.unsafe_uint8_ptr(), len=total_char_length ) @always_inline fn bytecount(self) -> Int: return len(self.inner) @always_inline fn __iter__( self: Reference[Self], ) -> _StringIter[self.is_mutable, self.lifetime]: return _StringIter(self[].inner) @value struct _StringIter[mutability: Bool, lifetime: AnyLifetime[mutability].type](): var bytes_left: Int var ptr: UnsafePointer[UInt8] @always_inline fn __init__(inout self, src: Reference[String, mutability, lifetime]): self.bytes_left = len(src[]) self.ptr = src[].unsafe_uint8_ptr() fn __next__(inout self) -> StringSlice[mutability, lifetime]: # Number of bytes of the current character var char_length = int( (DTypePointer[DType.uint8](self.ptr).load() >> 7 == 0).cast[DType.uint8]() * 1 + countl_zero(~DTypePointer[DType.uint8](self.ptr).load()) ) # Move iterator forward self.bytes_left -= char_length self.ptr += char_length return StringSlice[mutability, lifetime](unsafe_from_utf8_ptr=self.ptr - char_length, len=char_length) @always_inline fn __len__(self) -> Int: return self.bytes_left --- external/gojo/unicode/utf8/table.mojo --- @register_passable("trivial") struct Interval: var first: UInt32 var last: UInt32 fn __init__(inout self, first: UInt32, last: UInt32): self.first = first self.last = last alias combining = List[Interval]( Interval(0x0300, 0x036F), Interval(0x0483, 0x0489), Interval(0x07EB, 0x07F3), Interval(0x0C00, 0x0C00), Interval(0x0C04, 0x0C04), Interval(0x0D00, 0x0D01), Interval(0x135D, 0x135F), Interval(0x1A7F, 0x1A7F), Interval(0x1AB0, 0x1AC0), Interval(0x1B6B, 0x1B73), Interval(0x1DC0, 0x1DF9), Interval(0x1DFB, 0x1DFF), Interval(0x20D0, 0x20F0), Interval(0x2CEF, 0x2CF1), Interval(0x2DE0, 0x2DFF), Interval(0x3099, 0x309A), Interval(0xA66F, 0xA672), Interval(0xA674, 0xA67D), Interval(0xA69E, 0xA69F), Interval(0xA6F0, 0xA6F1), Interval(0xA8E0, 0xA8F1), Interval(0xFE20, 0xFE2F), Interval(0x101FD, 0x101FD), Interval(0x10376, 0x1037A), Interval(0x10EAB, 0x10EAC), Interval(0x10F46, 0x10F50), Interval(0x11300, 0x11301), Interval(0x1133B, 0x1133C), Interval(0x11366, 0x1136C), Interval(0x11370, 0x11374), Interval(0x16AF0, 0x16AF4), Interval(0x1D165, 0x1D169), Interval(0x1D16D, 0x1D172), Interval(0x1D17B, 0x1D182), Interval(0x1D185, 0x1D18B), Interval(0x1D1AA, 0x1D1AD), Interval(0x1D242, 0x1D244), Interval(0x1E000, 0x1E006), Interval(0x1E008, 0x1E018), Interval(0x1E01B, 0x1E021), Interval(0x1E023, 0x1E024), Interval(0x1E026, 0x1E02A), Interval(0x1E8D0, 0x1E8D6), ) alias doublewidth = List[Interval]( Interval(0x1100, 0x115F), Interval(0x231A, 0x231B), Interval(0x2329, 0x232A), Interval(0x23E9, 0x23EC), Interval(0x23F0, 0x23F0), Interval(0x23F3, 0x23F3), Interval(0x25FD, 0x25FE), Interval(0x2614, 0x2615), Interval(0x2648, 0x2653), Interval(0x267F, 0x267F), Interval(0x2693, 0x2693), Interval(0x26A1, 0x26A1), Interval(0x26AA, 0x26AB), Interval(0x26BD, 0x26BE), Interval(0x26C4, 0x26C5), Interval(0x26CE, 0x26CE), Interval(0x26D4, 0x26D4), Interval(0x26EA, 0x26EA), Interval(0x26F2, 0x26F3), Interval(0x26F5, 0x26F5), Interval(0x26FA, 0x26FA), Interval(0x26FD, 0x26FD), Interval(0x2705, 0x2705), Interval(0x270A, 0x270B), Interval(0x2728, 0x2728), Interval(0x274C, 0x274C), Interval(0x274E, 0x274E), Interval(0x2753, 0x2755), Interval(0x2757, 0x2757), Interval(0x2795, 0x2797), Interval(0x27B0, 0x27B0), Interval(0x27BF, 0x27BF), Interval(0x2B1B, 0x2B1C), Interval(0x2B50, 0x2B50), Interval(0x2B55, 0x2B55), Interval(0x2E80, 0x2E99), Interval(0x2E9B, 0x2EF3), Interval(0x2F00, 0x2FD5), Interval(0x2FF0, 0x2FFB), Interval(0x3000, 0x303E), Interval(0x3041, 0x3096), Interval(0x3099, 0x30FF), Interval(0x3105, 0x312F), Interval(0x3131, 0x318E), Interval(0x3190, 0x31E3), Interval(0x31F0, 0x321E), Interval(0x3220, 0x3247), Interval(0x3250, 0x4DBF), Interval(0x4E00, 0xA48C), Interval(0xA490, 0xA4C6), Interval(0xA960, 0xA97C), Interval(0xAC00, 0xD7A3), Interval(0xF900, 0xFAFF), Interval(0xFE10, 0xFE19), Interval(0xFE30, 0xFE52), Interval(0xFE54, 0xFE66), Interval(0xFE68, 0xFE6B), Interval(0xFF01, 0xFF60), Interval(0xFFE0, 0xFFE6), Interval(0x16FE0, 0x16FE4), Interval(0x16FF0, 0x16FF1), Interval(0x17000, 0x187F7), Interval(0x18800, 0x18CD5), Interval(0x18D00, 0x18D08), Interval(0x1B000, 0x1B11E), Interval(0x1B150, 0x1B152), Interval(0x1B164, 0x1B167), Interval(0x1B170, 0x1B2FB), Interval(0x1F004, 0x1F004), Interval(0x1F0CF, 0x1F0CF), Interval(0x1F18E, 0x1F18E), Interval(0x1F191, 0x1F19A), Interval(0x1F200, 0x1F202), Interval(0x1F210, 0x1F23B), Interval(0x1F240, 0x1F248), Interval(0x1F250, 0x1F251), Interval(0x1F260, 0x1F265), Interval(0x1F300, 0x1F320), Interval(0x1F32D, 0x1F335), Interval(0x1F337, 0x1F37C), Interval(0x1F37E, 0x1F393), Interval(0x1F3A0, 0x1F3CA), Interval(0x1F3CF, 0x1F3D3), Interval(0x1F3E0, 0x1F3F0), Interval(0x1F3F4, 0x1F3F4), Interval(0x1F3F8, 0x1F43E), Interval(0x1F440, 0x1F440), Interval(0x1F442, 0x1F4FC), Interval(0x1F4FF, 0x1F53D), Interval(0x1F54B, 0x1F54E), Interval(0x1F550, 0x1F567), Interval(0x1F57A, 0x1F57A), Interval(0x1F595, 0x1F596), Interval(0x1F5A4, 0x1F5A4), Interval(0x1F5FB, 0x1F64F), Interval(0x1F680, 0x1F6C5), Interval(0x1F6CC, 0x1F6CC), Interval(0x1F6D0, 0x1F6D2), Interval(0x1F6D5, 0x1F6D7), Interval(0x1F6EB, 0x1F6EC), Interval(0x1F6F4, 0x1F6FC), Interval(0x1F7E0, 0x1F7EB), Interval(0x1F90C, 0x1F93A), Interval(0x1F93C, 0x1F945), Interval(0x1F947, 0x1F978), Interval(0x1F97A, 0x1F9CB), Interval(0x1F9CD, 0x1F9FF), Interval(0x1FA70, 0x1FA74), Interval(0x1FA78, 0x1FA7A), Interval(0x1FA80, 0x1FA86), Interval(0x1FA90, 0x1FAA8), Interval(0x1FAB0, 0x1FAB6), Interval(0x1FAC0, 0x1FAC2), Interval(0x1FAD0, 0x1FAD6), Interval(0x20000, 0x2FFFD), Interval(0x30000, 0x3FFFD), ) alias ambiguous = List[Interval]( Interval(0x00A1, 0x00A1), Interval(0x00A4, 0x00A4), Interval(0x00A7, 0x00A8), Interval(0x00AA, 0x00AA), Interval(0x00AD, 0x00AE), Interval(0x00B0, 0x00B4), Interval(0x00B6, 0x00BA), Interval(0x00BC, 0x00BF), Interval(0x00C6, 0x00C6), Interval(0x00D0, 0x00D0), Interval(0x00D7, 0x00D8), Interval(0x00DE, 0x00E1), Interval(0x00E6, 0x00E6), Interval(0x00E8, 0x00EA), Interval(0x00EC, 0x00ED), Interval(0x00F0, 0x00F0), Interval(0x00F2, 0x00F3), Interval(0x00F7, 0x00FA), Interval(0x00FC, 0x00FC), Interval(0x00FE, 0x00FE), Interval(0x0101, 0x0101), Interval(0x0111, 0x0111), Interval(0x0113, 0x0113), Interval(0x011B, 0x011B), Interval(0x0126, 0x0127), Interval(0x012B, 0x012B), Interval(0x0131, 0x0133), Interval(0x0138, 0x0138), Interval(0x013F, 0x0142), Interval(0x0144, 0x0144), Interval(0x0148, 0x014B), Interval(0x014D, 0x014D), Interval(0x0152, 0x0153), Interval(0x0166, 0x0167), Interval(0x016B, 0x016B), Interval(0x01CE, 0x01CE), Interval(0x01D0, 0x01D0), Interval(0x01D2, 0x01D2), Interval(0x01D4, 0x01D4), Interval(0x01D6, 0x01D6), Interval(0x01D8, 0x01D8), Interval(0x01DA, 0x01DA), Interval(0x01DC, 0x01DC), Interval(0x0251, 0x0251), Interval(0x0261, 0x0261), Interval(0x02C4, 0x02C4), Interval(0x02C7, 0x02C7), Interval(0x02C9, 0x02CB), Interval(0x02CD, 0x02CD), Interval(0x02D0, 0x02D0), Interval(0x02D8, 0x02DB), Interval(0x02DD, 0x02DD), Interval(0x02DF, 0x02DF), Interval(0x0300, 0x036F), Interval(0x0391, 0x03A1), Interval(0x03A3, 0x03A9), Interval(0x03B1, 0x03C1), Interval(0x03C3, 0x03C9), Interval(0x0401, 0x0401), Interval(0x0410, 0x044F), Interval(0x0451, 0x0451), Interval(0x2010, 0x2010), Interval(0x2013, 0x2016), Interval(0x2018, 0x2019), Interval(0x201C, 0x201D), Interval(0x2020, 0x2022), Interval(0x2024, 0x2027), Interval(0x2030, 0x2030), Interval(0x2032, 0x2033), Interval(0x2035, 0x2035), Interval(0x203B, 0x203B), Interval(0x203E, 0x203E), Interval(0x2074, 0x2074), Interval(0x207F, 0x207F), Interval(0x2081, 0x2084), Interval(0x20AC, 0x20AC), Interval(0x2103, 0x2103), Interval(0x2105, 0x2105), Interval(0x2109, 0x2109), Interval(0x2113, 0x2113), Interval(0x2116, 0x2116), Interval(0x2121, 0x2122), Interval(0x2126, 0x2126), Interval(0x212B, 0x212B), Interval(0x2153, 0x2154), Interval(0x215B, 0x215E), Interval(0x2160, 0x216B), Interval(0x2170, 0x2179), Interval(0x2189, 0x2189), Interval(0x2190, 0x2199), Interval(0x21B8, 0x21B9), Interval(0x21D2, 0x21D2), Interval(0x21D4, 0x21D4), Interval(0x21E7, 0x21E7), Interval(0x2200, 0x2200), Interval(0x2202, 0x2203), Interval(0x2207, 0x2208), Interval(0x220B, 0x220B), Interval(0x220F, 0x220F), Interval(0x2211, 0x2211), Interval(0x2215, 0x2215), Interval(0x221A, 0x221A), Interval(0x221D, 0x2220), Interval(0x2223, 0x2223), Interval(0x2225, 0x2225), Interval(0x2227, 0x222C), Interval(0x222E, 0x222E), Interval(0x2234, 0x2237), Interval(0x223C, 0x223D), Interval(0x2248, 0x2248), Interval(0x224C, 0x224C), Interval(0x2252, 0x2252), Interval(0x2260, 0x2261), Interval(0x2264, 0x2267), Interval(0x226A, 0x226B), Interval(0x226E, 0x226F), Interval(0x2282, 0x2283), Interval(0x2286, 0x2287), Interval(0x2295, 0x2295), Interval(0x2299, 0x2299), Interval(0x22A5, 0x22A5), Interval(0x22BF, 0x22BF), Interval(0x2312, 0x2312), Interval(0x2460, 0x24E9), Interval(0x24EB, 0x254B), Interval(0x2550, 0x2573), Interval(0x2580, 0x258F), Interval(0x2592, 0x2595), Interval(0x25A0, 0x25A1), Interval(0x25A3, 0x25A9), Interval(0x25B2, 0x25B3), Interval(0x25B6, 0x25B7), Interval(0x25BC, 0x25BD), Interval(0x25C0, 0x25C1), Interval(0x25C6, 0x25C8), Interval(0x25CB, 0x25CB), Interval(0x25CE, 0x25D1), Interval(0x25E2, 0x25E5), Interval(0x25EF, 0x25EF), Interval(0x2605, 0x2606), Interval(0x2609, 0x2609), Interval(0x260E, 0x260F), Interval(0x261C, 0x261C), Interval(0x261E, 0x261E), Interval(0x2640, 0x2640), Interval(0x2642, 0x2642), Interval(0x2660, 0x2661), Interval(0x2663, 0x2665), Interval(0x2667, 0x266A), Interval(0x266C, 0x266D), Interval(0x266F, 0x266F), Interval(0x269E, 0x269F), Interval(0x26BF, 0x26BF), Interval(0x26C6, 0x26CD), Interval(0x26CF, 0x26D3), Interval(0x26D5, 0x26E1), Interval(0x26E3, 0x26E3), Interval(0x26E8, 0x26E9), Interval(0x26EB, 0x26F1), Interval(0x26F4, 0x26F4), Interval(0x26F6, 0x26F9), Interval(0x26FB, 0x26FC), Interval(0x26FE, 0x26FF), Interval(0x273D, 0x273D), Interval(0x2776, 0x277F), Interval(0x2B56, 0x2B59), Interval(0x3248, 0x324F), Interval(0xE000, 0xF8FF), Interval(0xFE00, 0xFE0F), Interval(0xFFFD, 0xFFFD), Interval(0x1F100, 0x1F10A), Interval(0x1F110, 0x1F12D), Interval(0x1F130, 0x1F169), Interval(0x1F170, 0x1F18D), Interval(0x1F18F, 0x1F190), Interval(0x1F19B, 0x1F1AC), Interval(0xE0100, 0xE01EF), Interval(0xF0000, 0xFFFFD), Interval(0x100000, 0x10FFFD), ) alias narrow = List[Interval]( Interval(0x0020, 0x007E), Interval(0x00A2, 0x00A3), Interval(0x00A5, 0x00A6), Interval(0x00AC, 0x00AC), Interval(0x00AF, 0x00AF), Interval(0x27E6, 0x27ED), Interval(0x2985, 0x2986), ) alias neutral = List[Interval]( Interval(0x0000, 0x001F), Interval(0x007F, 0x00A0), Interval(0x00A9, 0x00A9), Interval(0x00AB, 0x00AB), Interval(0x00B5, 0x00B5), Interval(0x00BB, 0x00BB), Interval(0x00C0, 0x00C5), Interval(0x00C7, 0x00CF), Interval(0x00D1, 0x00D6), Interval(0x00D9, 0x00DD), Interval(0x00E2, 0x00E5), Interval(0x00E7, 0x00E7), Interval(0x00EB, 0x00EB), Interval(0x00EE, 0x00EF), Interval(0x00F1, 0x00F1), Interval(0x00F4, 0x00F6), Interval(0x00FB, 0x00FB), Interval(0x00FD, 0x00FD), Interval(0x00FF, 0x0100), Interval(0x0102, 0x0110), Interval(0x0112, 0x0112), Interval(0x0114, 0x011A), Interval(0x011C, 0x0125), Interval(0x0128, 0x012A), Interval(0x012C, 0x0130), Interval(0x0134, 0x0137), Interval(0x0139, 0x013E), Interval(0x0143, 0x0143), Interval(0x0145, 0x0147), Interval(0x014C, 0x014C), Interval(0x014E, 0x0151), Interval(0x0154, 0x0165), Interval(0x0168, 0x016A), Interval(0x016C, 0x01CD), Interval(0x01CF, 0x01CF), Interval(0x01D1, 0x01D1), Interval(0x01D3, 0x01D3), Interval(0x01D5, 0x01D5), Interval(0x01D7, 0x01D7), Interval(0x01D9, 0x01D9), Interval(0x01DB, 0x01DB), Interval(0x01DD, 0x0250), Interval(0x0252, 0x0260), Interval(0x0262, 0x02C3), Interval(0x02C5, 0x02C6), Interval(0x02C8, 0x02C8), Interval(0x02CC, 0x02CC), Interval(0x02CE, 0x02CF), Interval(0x02D1, 0x02D7), Interval(0x02DC, 0x02DC), Interval(0x02DE, 0x02DE), Interval(0x02E0, 0x02FF), Interval(0x0370, 0x0377), Interval(0x037A, 0x037F), Interval(0x0384, 0x038A), Interval(0x038C, 0x038C), Interval(0x038E, 0x0390), Interval(0x03AA, 0x03B0), Interval(0x03C2, 0x03C2), Interval(0x03CA, 0x0400), Interval(0x0402, 0x040F), Interval(0x0450, 0x0450), Interval(0x0452, 0x052F), Interval(0x0531, 0x0556), Interval(0x0559, 0x058A), Interval(0x058D, 0x058F), Interval(0x0591, 0x05C7), Interval(0x05D0, 0x05EA), Interval(0x05EF, 0x05F4), Interval(0x0600, 0x061C), Interval(0x061E, 0x070D), Interval(0x070F, 0x074A), Interval(0x074D, 0x07B1), Interval(0x07C0, 0x07FA), Interval(0x07FD, 0x082D), Interval(0x0830, 0x083E), Interval(0x0840, 0x085B), Interval(0x085E, 0x085E), Interval(0x0860, 0x086A), Interval(0x08A0, 0x08B4), Interval(0x08B6, 0x08C7), Interval(0x08D3, 0x0983), Interval(0x0985, 0x098C), Interval(0x098F, 0x0990), Interval(0x0993, 0x09A8), Interval(0x09AA, 0x09B0), Interval(0x09B2, 0x09B2), Interval(0x09B6, 0x09B9), Interval(0x09BC, 0x09C4), Interval(0x09C7, 0x09C8), Interval(0x09CB, 0x09CE), Interval(0x09D7, 0x09D7), Interval(0x09DC, 0x09DD), Interval(0x09DF, 0x09E3), Interval(0x09E6, 0x09FE), Interval(0x0A01, 0x0A03), Interval(0x0A05, 0x0A0A), Interval(0x0A0F, 0x0A10), Interval(0x0A13, 0x0A28), Interval(0x0A2A, 0x0A30), Interval(0x0A32, 0x0A33), Interval(0x0A35, 0x0A36), Interval(0x0A38, 0x0A39), Interval(0x0A3C, 0x0A3C), Interval(0x0A3E, 0x0A42), Interval(0x0A47, 0x0A48), Interval(0x0A4B, 0x0A4D), Interval(0x0A51, 0x0A51), Interval(0x0A59, 0x0A5C), Interval(0x0A5E, 0x0A5E), Interval(0x0A66, 0x0A76), Interval(0x0A81, 0x0A83), Interval(0x0A85, 0x0A8D), Interval(0x0A8F, 0x0A91), Interval(0x0A93, 0x0AA8), Interval(0x0AAA, 0x0AB0), Interval(0x0AB2, 0x0AB3), Interval(0x0AB5, 0x0AB9), Interval(0x0ABC, 0x0AC5), Interval(0x0AC7, 0x0AC9), Interval(0x0ACB, 0x0ACD), Interval(0x0AD0, 0x0AD0), Interval(0x0AE0, 0x0AE3), Interval(0x0AE6, 0x0AF1), Interval(0x0AF9, 0x0AFF), Interval(0x0B01, 0x0B03), Interval(0x0B05, 0x0B0C), Interval(0x0B0F, 0x0B10), Interval(0x0B13, 0x0B28), Interval(0x0B2A, 0x0B30), Interval(0x0B32, 0x0B33), Interval(0x0B35, 0x0B39), Interval(0x0B3C, 0x0B44), Interval(0x0B47, 0x0B48), Interval(0x0B4B, 0x0B4D), Interval(0x0B55, 0x0B57), Interval(0x0B5C, 0x0B5D), Interval(0x0B5F, 0x0B63), Interval(0x0B66, 0x0B77), Interval(0x0B82, 0x0B83), Interval(0x0B85, 0x0B8A), Interval(0x0B8E, 0x0B90), Interval(0x0B92, 0x0B95), Interval(0x0B99, 0x0B9A), Interval(0x0B9C, 0x0B9C), Interval(0x0B9E, 0x0B9F), Interval(0x0BA3, 0x0BA4), Interval(0x0BA8, 0x0BAA), Interval(0x0BAE, 0x0BB9), Interval(0x0BBE, 0x0BC2), Interval(0x0BC6, 0x0BC8), Interval(0x0BCA, 0x0BCD), Interval(0x0BD0, 0x0BD0), Interval(0x0BD7, 0x0BD7), Interval(0x0BE6, 0x0BFA), Interval(0x0C00, 0x0C0C), Interval(0x0C0E, 0x0C10), Interval(0x0C12, 0x0C28), Interval(0x0C2A, 0x0C39), Interval(0x0C3D, 0x0C44), Interval(0x0C46, 0x0C48), Interval(0x0C4A, 0x0C4D), Interval(0x0C55, 0x0C56), Interval(0x0C58, 0x0C5A), Interval(0x0C60, 0x0C63), Interval(0x0C66, 0x0C6F), Interval(0x0C77, 0x0C8C), Interval(0x0C8E, 0x0C90), Interval(0x0C92, 0x0CA8), Interval(0x0CAA, 0x0CB3), Interval(0x0CB5, 0x0CB9), Interval(0x0CBC, 0x0CC4), Interval(0x0CC6, 0x0CC8), Interval(0x0CCA, 0x0CCD), Interval(0x0CD5, 0x0CD6), Interval(0x0CDE, 0x0CDE), Interval(0x0CE0, 0x0CE3), Interval(0x0CE6, 0x0CEF), Interval(0x0CF1, 0x0CF2), Interval(0x0D00, 0x0D0C), Interval(0x0D0E, 0x0D10), Interval(0x0D12, 0x0D44), Interval(0x0D46, 0x0D48), Interval(0x0D4A, 0x0D4F), Interval(0x0D54, 0x0D63), Interval(0x0D66, 0x0D7F), Interval(0x0D81, 0x0D83), Interval(0x0D85, 0x0D96), Interval(0x0D9A, 0x0DB1), Interval(0x0DB3, 0x0DBB), Interval(0x0DBD, 0x0DBD), Interval(0x0DC0, 0x0DC6), Interval(0x0DCA, 0x0DCA), Interval(0x0DCF, 0x0DD4), Interval(0x0DD6, 0x0DD6), Interval(0x0DD8, 0x0DDF), Interval(0x0DE6, 0x0DEF), Interval(0x0DF2, 0x0DF4), Interval(0x0E01, 0x0E3A), Interval(0x0E3F, 0x0E5B), Interval(0x0E81, 0x0E82), Interval(0x0E84, 0x0E84), Interval(0x0E86, 0x0E8A), Interval(0x0E8C, 0x0EA3), Interval(0x0EA5, 0x0EA5), Interval(0x0EA7, 0x0EBD), Interval(0x0EC0, 0x0EC4), Interval(0x0EC6, 0x0EC6), Interval(0x0EC8, 0x0ECD), Interval(0x0ED0, 0x0ED9), Interval(0x0EDC, 0x0EDF), Interval(0x0F00, 0x0F47), Interval(0x0F49, 0x0F6C), Interval(0x0F71, 0x0F97), Interval(0x0F99, 0x0FBC), Interval(0x0FBE, 0x0FCC), Interval(0x0FCE, 0x0FDA), Interval(0x1000, 0x10C5), Interval(0x10C7, 0x10C7), Interval(0x10CD, 0x10CD), Interval(0x10D0, 0x10FF), Interval(0x1160, 0x1248), Interval(0x124A, 0x124D), Interval(0x1250, 0x1256), Interval(0x1258, 0x1258), Interval(0x125A, 0x125D), Interval(0x1260, 0x1288), Interval(0x128A, 0x128D), Interval(0x1290, 0x12B0), Interval(0x12B2, 0x12B5), Interval(0x12B8, 0x12BE), Interval(0x12C0, 0x12C0), Interval(0x12C2, 0x12C5), Interval(0x12C8, 0x12D6), Interval(0x12D8, 0x1310), Interval(0x1312, 0x1315), Interval(0x1318, 0x135A), Interval(0x135D, 0x137C), Interval(0x1380, 0x1399), Interval(0x13A0, 0x13F5), Interval(0x13F8, 0x13FD), Interval(0x1400, 0x169C), Interval(0x16A0, 0x16F8), Interval(0x1700, 0x170C), Interval(0x170E, 0x1714), Interval(0x1720, 0x1736), Interval(0x1740, 0x1753), Interval(0x1760, 0x176C), Interval(0x176E, 0x1770), Interval(0x1772, 0x1773), Interval(0x1780, 0x17DD), Interval(0x17E0, 0x17E9), Interval(0x17F0, 0x17F9), Interval(0x1800, 0x180E), Interval(0x1810, 0x1819), Interval(0x1820, 0x1878), Interval(0x1880, 0x18AA), Interval(0x18B0, 0x18F5), Interval(0x1900, 0x191E), Interval(0x1920, 0x192B), Interval(0x1930, 0x193B), Interval(0x1940, 0x1940), Interval(0x1944, 0x196D), Interval(0x1970, 0x1974), Interval(0x1980, 0x19AB), Interval(0x19B0, 0x19C9), Interval(0x19D0, 0x19DA), Interval(0x19DE, 0x1A1B), Interval(0x1A1E, 0x1A5E), Interval(0x1A60, 0x1A7C), Interval(0x1A7F, 0x1A89), Interval(0x1A90, 0x1A99), Interval(0x1AA0, 0x1AAD), Interval(0x1AB0, 0x1AC0), Interval(0x1B00, 0x1B4B), Interval(0x1B50, 0x1B7C), Interval(0x1B80, 0x1BF3), Interval(0x1BFC, 0x1C37), Interval(0x1C3B, 0x1C49), Interval(0x1C4D, 0x1C88), Interval(0x1C90, 0x1CBA), Interval(0x1CBD, 0x1CC7), Interval(0x1CD0, 0x1CFA), Interval(0x1D00, 0x1DF9), Interval(0x1DFB, 0x1F15), Interval(0x1F18, 0x1F1D), Interval(0x1F20, 0x1F45), Interval(0x1F48, 0x1F4D), Interval(0x1F50, 0x1F57), Interval(0x1F59, 0x1F59), Interval(0x1F5B, 0x1F5B), Interval(0x1F5D, 0x1F5D), Interval(0x1F5F, 0x1F7D), Interval(0x1F80, 0x1FB4), Interval(0x1FB6, 0x1FC4), Interval(0x1FC6, 0x1FD3), Interval(0x1FD6, 0x1FDB), Interval(0x1FDD, 0x1FEF), Interval(0x1FF2, 0x1FF4), Interval(0x1FF6, 0x1FFE), Interval(0x2000, 0x200F), Interval(0x2011, 0x2012), Interval(0x2017, 0x2017), Interval(0x201A, 0x201B), Interval(0x201E, 0x201F), Interval(0x2023, 0x2023), Interval(0x2028, 0x202F), Interval(0x2031, 0x2031), Interval(0x2034, 0x2034), Interval(0x2036, 0x203A), Interval(0x203C, 0x203D), Interval(0x203F, 0x2064), Interval(0x2066, 0x2071), Interval(0x2075, 0x207E), Interval(0x2080, 0x2080), Interval(0x2085, 0x208E), Interval(0x2090, 0x209C), Interval(0x20A0, 0x20A8), Interval(0x20AA, 0x20AB), Interval(0x20AD, 0x20BF), Interval(0x20D0, 0x20F0), Interval(0x2100, 0x2102), Interval(0x2104, 0x2104), Interval(0x2106, 0x2108), Interval(0x210A, 0x2112), Interval(0x2114, 0x2115), Interval(0x2117, 0x2120), Interval(0x2123, 0x2125), Interval(0x2127, 0x212A), Interval(0x212C, 0x2152), Interval(0x2155, 0x215A), Interval(0x215F, 0x215F), Interval(0x216C, 0x216F), Interval(0x217A, 0x2188), Interval(0x218A, 0x218B), Interval(0x219A, 0x21B7), Interval(0x21BA, 0x21D1), Interval(0x21D3, 0x21D3), Interval(0x21D5, 0x21E6), Interval(0x21E8, 0x21FF), Interval(0x2201, 0x2201), Interval(0x2204, 0x2206), Interval(0x2209, 0x220A), Interval(0x220C, 0x220E), Interval(0x2210, 0x2210), Interval(0x2212, 0x2214), Interval(0x2216, 0x2219), Interval(0x221B, 0x221C), Interval(0x2221, 0x2222), Interval(0x2224, 0x2224), Interval(0x2226, 0x2226), Interval(0x222D, 0x222D), Interval(0x222F, 0x2233), Interval(0x2238, 0x223B), Interval(0x223E, 0x2247), Interval(0x2249, 0x224B), Interval(0x224D, 0x2251), Interval(0x2253, 0x225F), Interval(0x2262, 0x2263), Interval(0x2268, 0x2269), Interval(0x226C, 0x226D), Interval(0x2270, 0x2281), Interval(0x2284, 0x2285), Interval(0x2288, 0x2294), Interval(0x2296, 0x2298), Interval(0x229A, 0x22A4), Interval(0x22A6, 0x22BE), Interval(0x22C0, 0x2311), Interval(0x2313, 0x2319), Interval(0x231C, 0x2328), Interval(0x232B, 0x23E8), Interval(0x23ED, 0x23EF), Interval(0x23F1, 0x23F2), Interval(0x23F4, 0x2426), Interval(0x2440, 0x244A), Interval(0x24EA, 0x24EA), Interval(0x254C, 0x254F), Interval(0x2574, 0x257F), Interval(0x2590, 0x2591), Interval(0x2596, 0x259F), Interval(0x25A2, 0x25A2), Interval(0x25AA, 0x25B1), Interval(0x25B4, 0x25B5), Interval(0x25B8, 0x25BB), Interval(0x25BE, 0x25BF), Interval(0x25C2, 0x25C5), Interval(0x25C9, 0x25CA), Interval(0x25CC, 0x25CD), Interval(0x25D2, 0x25E1), Interval(0x25E6, 0x25EE), Interval(0x25F0, 0x25FC), Interval(0x25FF, 0x2604), Interval(0x2607, 0x2608), Interval(0x260A, 0x260D), Interval(0x2610, 0x2613), Interval(0x2616, 0x261B), Interval(0x261D, 0x261D), Interval(0x261F, 0x263F), Interval(0x2641, 0x2641), Interval(0x2643, 0x2647), Interval(0x2654, 0x265F), Interval(0x2662, 0x2662), Interval(0x2666, 0x2666), Interval(0x266B, 0x266B), Interval(0x266E, 0x266E), Interval(0x2670, 0x267E), Interval(0x2680, 0x2692), Interval(0x2694, 0x269D), Interval(0x26A0, 0x26A0), Interval(0x26A2, 0x26A9), Interval(0x26AC, 0x26BC), Interval(0x26C0, 0x26C3), Interval(0x26E2, 0x26E2), Interval(0x26E4, 0x26E7), Interval(0x2700, 0x2704), Interval(0x2706, 0x2709), Interval(0x270C, 0x2727), Interval(0x2729, 0x273C), Interval(0x273E, 0x274B), Interval(0x274D, 0x274D), Interval(0x274F, 0x2752), Interval(0x2756, 0x2756), Interval(0x2758, 0x2775), Interval(0x2780, 0x2794), Interval(0x2798, 0x27AF), Interval(0x27B1, 0x27BE), Interval(0x27C0, 0x27E5), Interval(0x27EE, 0x2984), Interval(0x2987, 0x2B1A), Interval(0x2B1D, 0x2B4F), Interval(0x2B51, 0x2B54), Interval(0x2B5A, 0x2B73), Interval(0x2B76, 0x2B95), Interval(0x2B97, 0x2C2E), Interval(0x2C30, 0x2C5E), Interval(0x2C60, 0x2CF3), Interval(0x2CF9, 0x2D25), Interval(0x2D27, 0x2D27), Interval(0x2D2D, 0x2D2D), Interval(0x2D30, 0x2D67), Interval(0x2D6F, 0x2D70), Interval(0x2D7F, 0x2D96), Interval(0x2DA0, 0x2DA6), Interval(0x2DA8, 0x2DAE), Interval(0x2DB0, 0x2DB6), Interval(0x2DB8, 0x2DBE), Interval(0x2DC0, 0x2DC6), Interval(0x2DC8, 0x2DCE), Interval(0x2DD0, 0x2DD6), Interval(0x2DD8, 0x2DDE), Interval(0x2DE0, 0x2E52), Interval(0x303F, 0x303F), Interval(0x4DC0, 0x4DFF), Interval(0xA4D0, 0xA62B), Interval(0xA640, 0xA6F7), Interval(0xA700, 0xA7BF), Interval(0xA7C2, 0xA7CA), Interval(0xA7F5, 0xA82C), Interval(0xA830, 0xA839), Interval(0xA840, 0xA877), Interval(0xA880, 0xA8C5), Interval(0xA8CE, 0xA8D9), Interval(0xA8E0, 0xA953), Interval(0xA95F, 0xA95F), Interval(0xA980, 0xA9CD), Interval(0xA9CF, 0xA9D9), Interval(0xA9DE, 0xA9FE), Interval(0xAA00, 0xAA36), Interval(0xAA40, 0xAA4D), Interval(0xAA50, 0xAA59), Interval(0xAA5C, 0xAAC2), Interval(0xAADB, 0xAAF6), Interval(0xAB01, 0xAB06), Interval(0xAB09, 0xAB0E), Interval(0xAB11, 0xAB16), Interval(0xAB20, 0xAB26), Interval(0xAB28, 0xAB2E), Interval(0xAB30, 0xAB6B), Interval(0xAB70, 0xABED), Interval(0xABF0, 0xABF9), Interval(0xD7B0, 0xD7C6), Interval(0xD7CB, 0xD7FB), Interval(0xD800, 0xDFFF), Interval(0xFB00, 0xFB06), Interval(0xFB13, 0xFB17), Interval(0xFB1D, 0xFB36), Interval(0xFB38, 0xFB3C), Interval(0xFB3E, 0xFB3E), Interval(0xFB40, 0xFB41), Interval(0xFB43, 0xFB44), Interval(0xFB46, 0xFBC1), Interval(0xFBD3, 0xFD3F), Interval(0xFD50, 0xFD8F), Interval(0xFD92, 0xFDC7), Interval(0xFDF0, 0xFDFD), Interval(0xFE20, 0xFE2F), Interval(0xFE70, 0xFE74), Interval(0xFE76, 0xFEFC), Interval(0xFEFF, 0xFEFF), Interval(0xFFF9, 0xFFFC), Interval(0x10000, 0x1000B), Interval(0x1000D, 0x10026), Interval(0x10028, 0x1003A), Interval(0x1003C, 0x1003D), Interval(0x1003F, 0x1004D), Interval(0x10050, 0x1005D), Interval(0x10080, 0x100FA), Interval(0x10100, 0x10102), Interval(0x10107, 0x10133), Interval(0x10137, 0x1018E), Interval(0x10190, 0x1019C), Interval(0x101A0, 0x101A0), Interval(0x101D0, 0x101FD), Interval(0x10280, 0x1029C), Interval(0x102A0, 0x102D0), Interval(0x102E0, 0x102FB), Interval(0x10300, 0x10323), Interval(0x1032D, 0x1034A), Interval(0x10350, 0x1037A), Interval(0x10380, 0x1039D), Interval(0x1039F, 0x103C3), Interval(0x103C8, 0x103D5), Interval(0x10400, 0x1049D), Interval(0x104A0, 0x104A9), Interval(0x104B0, 0x104D3), Interval(0x104D8, 0x104FB), Interval(0x10500, 0x10527), Interval(0x10530, 0x10563), Interval(0x1056F, 0x1056F), Interval(0x10600, 0x10736), Interval(0x10740, 0x10755), Interval(0x10760, 0x10767), Interval(0x10800, 0x10805), Interval(0x10808, 0x10808), Interval(0x1080A, 0x10835), Interval(0x10837, 0x10838), Interval(0x1083C, 0x1083C), Interval(0x1083F, 0x10855), Interval(0x10857, 0x1089E), Interval(0x108A7, 0x108AF), Interval(0x108E0, 0x108F2), Interval(0x108F4, 0x108F5), Interval(0x108FB, 0x1091B), Interval(0x1091F, 0x10939), Interval(0x1093F, 0x1093F), Interval(0x10980, 0x109B7), Interval(0x109BC, 0x109CF), Interval(0x109D2, 0x10A03), Interval(0x10A05, 0x10A06), Interval(0x10A0C, 0x10A13), Interval(0x10A15, 0x10A17), Interval(0x10A19, 0x10A35), Interval(0x10A38, 0x10A3A), Interval(0x10A3F, 0x10A48), Interval(0x10A50, 0x10A58), Interval(0x10A60, 0x10A9F), Interval(0x10AC0, 0x10AE6), Interval(0x10AEB, 0x10AF6), Interval(0x10B00, 0x10B35), Interval(0x10B39, 0x10B55), Interval(0x10B58, 0x10B72), Interval(0x10B78, 0x10B91), Interval(0x10B99, 0x10B9C), Interval(0x10BA9, 0x10BAF), Interval(0x10C00, 0x10C48), Interval(0x10C80, 0x10CB2), Interval(0x10CC0, 0x10CF2), Interval(0x10CFA, 0x10D27), Interval(0x10D30, 0x10D39), Interval(0x10E60, 0x10E7E), Interval(0x10E80, 0x10EA9), Interval(0x10EAB, 0x10EAD), Interval(0x10EB0, 0x10EB1), Interval(0x10F00, 0x10F27), Interval(0x10F30, 0x10F59), Interval(0x10FB0, 0x10FCB), Interval(0x10FE0, 0x10FF6), Interval(0x11000, 0x1104D), Interval(0x11052, 0x1106F), Interval(0x1107F, 0x110C1), Interval(0x110CD, 0x110CD), Interval(0x110D0, 0x110E8), Interval(0x110F0, 0x110F9), Interval(0x11100, 0x11134), Interval(0x11136, 0x11147), Interval(0x11150, 0x11176), Interval(0x11180, 0x111DF), Interval(0x111E1, 0x111F4), Interval(0x11200, 0x11211), Interval(0x11213, 0x1123E), Interval(0x11280, 0x11286), Interval(0x11288, 0x11288), Interval(0x1128A, 0x1128D), Interval(0x1128F, 0x1129D), Interval(0x1129F, 0x112A9), Interval(0x112B0, 0x112EA), Interval(0x112F0, 0x112F9), Interval(0x11300, 0x11303), Interval(0x11305, 0x1130C), Interval(0x1130F, 0x11310), Interval(0x11313, 0x11328), Interval(0x1132A, 0x11330), Interval(0x11332, 0x11333), Interval(0x11335, 0x11339), Interval(0x1133B, 0x11344), Interval(0x11347, 0x11348), Interval(0x1134B, 0x1134D), Interval(0x11350, 0x11350), Interval(0x11357, 0x11357), Interval(0x1135D, 0x11363), Interval(0x11366, 0x1136C), Interval(0x11370, 0x11374), Interval(0x11400, 0x1145B), Interval(0x1145D, 0x11461), Interval(0x11480, 0x114C7), Interval(0x114D0, 0x114D9), Interval(0x11580, 0x115B5), Interval(0x115B8, 0x115DD), Interval(0x11600, 0x11644), Interval(0x11650, 0x11659), Interval(0x11660, 0x1166C), Interval(0x11680, 0x116B8), Interval(0x116C0, 0x116C9), Interval(0x11700, 0x1171A), Interval(0x1171D, 0x1172B), Interval(0x11730, 0x1173F), Interval(0x11800, 0x1183B), Interval(0x118A0, 0x118F2), Interval(0x118FF, 0x11906), Interval(0x11909, 0x11909), Interval(0x1190C, 0x11913), Interval(0x11915, 0x11916), Interval(0x11918, 0x11935), Interval(0x11937, 0x11938), Interval(0x1193B, 0x11946), Interval(0x11950, 0x11959), Interval(0x119A0, 0x119A7), Interval(0x119AA, 0x119D7), Interval(0x119DA, 0x119E4), Interval(0x11A00, 0x11A47), Interval(0x11A50, 0x11AA2), Interval(0x11AC0, 0x11AF8), Interval(0x11C00, 0x11C08), Interval(0x11C0A, 0x11C36), Interval(0x11C38, 0x11C45), Interval(0x11C50, 0x11C6C), Interval(0x11C70, 0x11C8F), Interval(0x11C92, 0x11CA7), Interval(0x11CA9, 0x11CB6), Interval(0x11D00, 0x11D06), Interval(0x11D08, 0x11D09), Interval(0x11D0B, 0x11D36), Interval(0x11D3A, 0x11D3A), Interval(0x11D3C, 0x11D3D), Interval(0x11D3F, 0x11D47), Interval(0x11D50, 0x11D59), Interval(0x11D60, 0x11D65), Interval(0x11D67, 0x11D68), Interval(0x11D6A, 0x11D8E), Interval(0x11D90, 0x11D91), Interval(0x11D93, 0x11D98), Interval(0x11DA0, 0x11DA9), Interval(0x11EE0, 0x11EF8), Interval(0x11FB0, 0x11FB0), Interval(0x11FC0, 0x11FF1), Interval(0x11FFF, 0x12399), Interval(0x12400, 0x1246E), Interval(0x12470, 0x12474), Interval(0x12480, 0x12543), Interval(0x13000, 0x1342E), Interval(0x13430, 0x13438), Interval(0x14400, 0x14646), Interval(0x16800, 0x16A38), Interval(0x16A40, 0x16A5E), Interval(0x16A60, 0x16A69), Interval(0x16A6E, 0x16A6F), Interval(0x16AD0, 0x16AED), Interval(0x16AF0, 0x16AF5), Interval(0x16B00, 0x16B45), Interval(0x16B50, 0x16B59), Interval(0x16B5B, 0x16B61), Interval(0x16B63, 0x16B77), Interval(0x16B7D, 0x16B8F), Interval(0x16E40, 0x16E9A), Interval(0x16F00, 0x16F4A), Interval(0x16F4F, 0x16F87), Interval(0x16F8F, 0x16F9F), Interval(0x1BC00, 0x1BC6A), Interval(0x1BC70, 0x1BC7C), Interval(0x1BC80, 0x1BC88), Interval(0x1BC90, 0x1BC99), Interval(0x1BC9C, 0x1BCA3), Interval(0x1D000, 0x1D0F5), Interval(0x1D100, 0x1D126), Interval(0x1D129, 0x1D1E8), Interval(0x1D200, 0x1D245), Interval(0x1D2E0, 0x1D2F3), Interval(0x1D300, 0x1D356), Interval(0x1D360, 0x1D378), Interval(0x1D400, 0x1D454), Interval(0x1D456, 0x1D49C), Interval(0x1D49E, 0x1D49F), Interval(0x1D4A2, 0x1D4A2), Interval(0x1D4A5, 0x1D4A6), Interval(0x1D4A9, 0x1D4AC), Interval(0x1D4AE, 0x1D4B9), Interval(0x1D4BB, 0x1D4BB), Interval(0x1D4BD, 0x1D4C3), Interval(0x1D4C5, 0x1D505), Interval(0x1D507, 0x1D50A), Interval(0x1D50D, 0x1D514), Interval(0x1D516, 0x1D51C), Interval(0x1D51E, 0x1D539), Interval(0x1D53B, 0x1D53E), Interval(0x1D540, 0x1D544), Interval(0x1D546, 0x1D546), Interval(0x1D54A, 0x1D550), Interval(0x1D552, 0x1D6A5), Interval(0x1D6A8, 0x1D7CB), Interval(0x1D7CE, 0x1DA8B), Interval(0x1DA9B, 0x1DA9F), Interval(0x1DAA1, 0x1DAAF), Interval(0x1E000, 0x1E006), Interval(0x1E008, 0x1E018), Interval(0x1E01B, 0x1E021), Interval(0x1E023, 0x1E024), Interval(0x1E026, 0x1E02A), Interval(0x1E100, 0x1E12C), Interval(0x1E130, 0x1E13D), Interval(0x1E140, 0x1E149), Interval(0x1E14E, 0x1E14F), Interval(0x1E2C0, 0x1E2F9), Interval(0x1E2FF, 0x1E2FF), Interval(0x1E800, 0x1E8C4), Interval(0x1E8C7, 0x1E8D6), Interval(0x1E900, 0x1E94B), Interval(0x1E950, 0x1E959), Interval(0x1E95E, 0x1E95F), Interval(0x1EC71, 0x1ECB4), Interval(0x1ED01, 0x1ED3D), Interval(0x1EE00, 0x1EE03), Interval(0x1EE05, 0x1EE1F), Interval(0x1EE21, 0x1EE22), Interval(0x1EE24, 0x1EE24), Interval(0x1EE27, 0x1EE27), Interval(0x1EE29, 0x1EE32), Interval(0x1EE34, 0x1EE37), Interval(0x1EE39, 0x1EE39), Interval(0x1EE3B, 0x1EE3B), Interval(0x1EE42, 0x1EE42), Interval(0x1EE47, 0x1EE47), Interval(0x1EE49, 0x1EE49), Interval(0x1EE4B, 0x1EE4B), Interval(0x1EE4D, 0x1EE4F), Interval(0x1EE51, 0x1EE52), Interval(0x1EE54, 0x1EE54), Interval(0x1EE57, 0x1EE57), Interval(0x1EE59, 0x1EE59), Interval(0x1EE5B, 0x1EE5B), Interval(0x1EE5D, 0x1EE5D), Interval(0x1EE5F, 0x1EE5F), Interval(0x1EE61, 0x1EE62), Interval(0x1EE64, 0x1EE64), Interval(0x1EE67, 0x1EE6A), Interval(0x1EE6C, 0x1EE72), Interval(0x1EE74, 0x1EE77), Interval(0x1EE79, 0x1EE7C), Interval(0x1EE7E, 0x1EE7E), Interval(0x1EE80, 0x1EE89), Interval(0x1EE8B, 0x1EE9B), Interval(0x1EEA1, 0x1EEA3), Interval(0x1EEA5, 0x1EEA9), Interval(0x1EEAB, 0x1EEBB), Interval(0x1EEF0, 0x1EEF1), Interval(0x1F000, 0x1F003), Interval(0x1F005, 0x1F02B), Interval(0x1F030, 0x1F093), Interval(0x1F0A0, 0x1F0AE), Interval(0x1F0B1, 0x1F0BF), Interval(0x1F0C1, 0x1F0CE), Interval(0x1F0D1, 0x1F0F5), Interval(0x1F10B, 0x1F10F), Interval(0x1F12E, 0x1F12F), Interval(0x1F16A, 0x1F16F), Interval(0x1F1AD, 0x1F1AD), Interval(0x1F1E6, 0x1F1FF), Interval(0x1F321, 0x1F32C), Interval(0x1F336, 0x1F336), Interval(0x1F37D, 0x1F37D), Interval(0x1F394, 0x1F39F), Interval(0x1F3CB, 0x1F3CE), Interval(0x1F3D4, 0x1F3DF), Interval(0x1F3F1, 0x1F3F3), Interval(0x1F3F5, 0x1F3F7), Interval(0x1F43F, 0x1F43F), Interval(0x1F441, 0x1F441), Interval(0x1F4FD, 0x1F4FE), Interval(0x1F53E, 0x1F54A), Interval(0x1F54F, 0x1F54F), Interval(0x1F568, 0x1F579), Interval(0x1F57B, 0x1F594), Interval(0x1F597, 0x1F5A3), Interval(0x1F5A5, 0x1F5FA), Interval(0x1F650, 0x1F67F), Interval(0x1F6C6, 0x1F6CB), Interval(0x1F6CD, 0x1F6CF), Interval(0x1F6D3, 0x1F6D4), Interval(0x1F6E0, 0x1F6EA), Interval(0x1F6F0, 0x1F6F3), Interval(0x1F700, 0x1F773), Interval(0x1F780, 0x1F7D8), Interval(0x1F800, 0x1F80B), Interval(0x1F810, 0x1F847), Interval(0x1F850, 0x1F859), Interval(0x1F860, 0x1F887), Interval(0x1F890, 0x1F8AD), Interval(0x1F8B0, 0x1F8B1), Interval(0x1F900, 0x1F90B), Interval(0x1F93B, 0x1F93B), Interval(0x1F946, 0x1F946), Interval(0x1FA00, 0x1FA53), Interval(0x1FA60, 0x1FA6D), Interval(0x1FB00, 0x1FB92), Interval(0x1FB94, 0x1FBCA), Interval(0x1FBF0, 0x1FBF9), Interval(0xE0001, 0xE0001), Interval(0xE0020, 0xE007F), ) alias emoji = List[Interval]( Interval(0x203C, 0x203C), Interval(0x2049, 0x2049), Interval(0x2122, 0x2122), Interval(0x2139, 0x2139), Interval(0x2194, 0x2199), Interval(0x21A9, 0x21AA), Interval(0x231A, 0x231B), Interval(0x2328, 0x2328), Interval(0x2388, 0x2388), Interval(0x23CF, 0x23CF), Interval(0x23E9, 0x23F3), Interval(0x23F8, 0x23FA), Interval(0x24C2, 0x24C2), Interval(0x25AA, 0x25AB), Interval(0x25B6, 0x25B6), Interval(0x25C0, 0x25C0), Interval(0x25FB, 0x25FE), Interval(0x2600, 0x2605), Interval(0x2607, 0x2612), Interval(0x2614, 0x2685), Interval(0x2690, 0x2705), Interval(0x2708, 0x2712), Interval(0x2714, 0x2714), Interval(0x2716, 0x2716), Interval(0x271D, 0x271D), Interval(0x2721, 0x2721), Interval(0x2728, 0x2728), Interval(0x2733, 0x2734), Interval(0x2744, 0x2744), Interval(0x2747, 0x2747), Interval(0x274C, 0x274C), Interval(0x274E, 0x274E), Interval(0x2753, 0x2755), Interval(0x2757, 0x2757), Interval(0x2763, 0x2767), Interval(0x2795, 0x2797), Interval(0x27A1, 0x27A1), Interval(0x27B0, 0x27B0), Interval(0x27BF, 0x27BF), Interval(0x2934, 0x2935), Interval(0x2B05, 0x2B07), Interval(0x2B1B, 0x2B1C), Interval(0x2B50, 0x2B50), Interval(0x2B55, 0x2B55), Interval(0x3030, 0x3030), Interval(0x303D, 0x303D), Interval(0x3297, 0x3297), Interval(0x3299, 0x3299), Interval(0x1F000, 0x1F0FF), Interval(0x1F10D, 0x1F10F), Interval(0x1F12F, 0x1F12F), Interval(0x1F16C, 0x1F171), Interval(0x1F17E, 0x1F17F), Interval(0x1F18E, 0x1F18E), Interval(0x1F191, 0x1F19A), Interval(0x1F1AD, 0x1F1E5), Interval(0x1F201, 0x1F20F), Interval(0x1F21A, 0x1F21A), Interval(0x1F22F, 0x1F22F), Interval(0x1F232, 0x1F23A), Interval(0x1F23C, 0x1F23F), Interval(0x1F249, 0x1F3FA), Interval(0x1F400, 0x1F53D), Interval(0x1F546, 0x1F64F), Interval(0x1F680, 0x1F6FF), Interval(0x1F774, 0x1F77F), Interval(0x1F7D5, 0x1F7FF), Interval(0x1F80C, 0x1F80F), Interval(0x1F848, 0x1F84F), Interval(0x1F85A, 0x1F85F), Interval(0x1F888, 0x1F88F), Interval(0x1F8AE, 0x1F8FF), Interval(0x1F90C, 0x1F93A), Interval(0x1F93C, 0x1F945), Interval(0x1F947, 0x1FAFF), Interval(0x1FC00, 0x1FFFD), ) alias private = List[Interval]( Interval(0x00E000, 0x00F8FF), Interval(0x0F0000, 0x0FFFFD), Interval(0x100000, 0x10FFFD), ) alias nonprint = List[Interval]( Interval(0x0000, 0x001F), Interval(0x007F, 0x009F), Interval(0x00AD, 0x00AD), Interval(0x070F, 0x070F), Interval(0x180B, 0x180E), Interval(0x200B, 0x200F), Interval(0x2028, 0x202E), Interval(0x206A, 0x206F), Interval(0xD800, 0xDFFF), Interval(0xFEFF, 0xFEFF), Interval(0xFFF9, 0xFFFB), Interval(0xFFFE, 0xFFFF), ) --- external/gojo/unicode/utf8/width.mojo --- from .table import Interval, narrow, combining, doublewidth, ambiguous, emoji, nonprint from .string import UnicodeString @value struct Condition: """Condition have flag EastAsianWidth whether the current locale is CJK or not.""" var east_asian_width: Bool var strict_emoji_neutral: Bool fn rune_width(self, r: UInt32) -> Int: """Returns the number of cells in r. See http://www.unicode.org/reports/tr11/.""" if r < 0 or r > 0x10FFFF: return 0 if not self.east_asian_width: if r < 0x20: return 0 # nonprint elif (r >= 0x7F and r <= 0x9F) or r == 0xAD: return 0 elif r < 0x300: return 1 elif in_table(r, narrow): return 1 elif in_tables(r, nonprint, combining): return 0 elif in_table(r, doublewidth): return 2 else: return 1 else: if in_tables(r, nonprint, combining): return 0 elif in_table(r, narrow): return 1 elif in_tables(r, ambiguous, doublewidth): return 2 elif in_table(r, ambiguous) or in_table(r, emoji): return 2 elif not self.strict_emoji_neutral and in_tables(r, ambiguous, emoji, narrow): return 2 else: return 1 fn string_width(self, s: String) -> Int: """Return width as you can see.""" var width = 0 for r in UnicodeString(s): width += self.rune_width(ord(String(r))) return width fn in_tables(r: UInt32, *ts: List[Interval]) -> Bool: for t in ts: if in_table(r, t[]): return True return False fn in_table(r: UInt32, t: List[Interval]) -> Bool: if r < t[0].first: return False var bot = 0 var top = len(t) - 1 while top >= bot: var mid = (bot + top) >> 1 if t[mid].last < r: bot = mid + 1 elif t[mid].first > r: top = mid - 1 else: return True return False alias DEFAULT_CONDITION = Condition(east_asian_width=False, strict_emoji_neutral=True) fn string_width(s: String) -> Int: """Return width as you can see. Args: s: The string to calculate the width of. Returns: The printable width of the string. """ return DEFAULT_CONDITION.string_width(s) fn rune_width(rune: UInt32) -> Int: """Return width as you can see. Args: rune: The rune to calculate the width of. Returns: The printable width of the rune. """ return DEFAULT_CONDITION.rune_width(rune) --- external/hue/__init__.mojo --- from .color import Color --- external/hue/color.mojo --- import math from .math import cube, clamp01, sq, pi, max_float64 from .hsluv import hSLuvD65, LuvLCh_to_HPLuv, LuvLch_to_HSLuv # This is the tolerance used when comparing colors using AlmostEqualColor. alias Delta = 1.0 / 255.0 # This is the default reference white point. alias D65 = List[Float64](0.95047, 1.00000, 1.08883) # And another one. alias D50 = List[Float64](0.96422, 1.00000, 0.82521) @value struct Color(Stringable): var R: Float64 var G: Float64 var B: Float64 fn __str__(self) -> String: return "Color(" + str(self.R) + ", " + str(self.G) + ", " + str(self.B) + ")" fn linear_rgb(self) -> (Float64, Float64, Float64): """Converts the color into the linear Color space (see http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/). """ var r = linearize(self.R) var g = linearize(self.G) var b = linearize(self.B) return r, g, b fn xyz(self) -> (Float64, Float64, Float64): var r: Float64 var g: Float64 var b: Float64 r, g, b = self.linear_rgb() var x: Float64 var y: Float64 var z: Float64 x, y, z = linear_rgb_to_xyz(r, g, b) return x, y, z fn Luv_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to CIE L*u*v* space, taking into account a given reference white. (i.e. the monitor's white) L* is in [0..1] and both u* and v* are in about [-1..1].""" var x: Float64 var y: Float64 var z: Float64 x, y, z = self.xyz() var l: Float64 var u: Float64 var v: Float64 l, u, v = xyz_to_Luv_white_ref(x, y, z, wref) return l, u, v fn LuvLCh_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): var l: Float64 var u: Float64 var v: Float64 l, u, v = self.Luv_white_ref(wref) return Luv_To_LuvLCh(l, u, v) fn HSLuv(self) -> (Float64, Float64, Float64): """Order: sColor -> Linear Color -> CIEXYZ -> CIELUV -> LuvLCh -> HSLuv. HSLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. """ var wref: List[Float64] = hSLuvD65 var l: Float64 var c: Float64 var h: Float64 l, c, h = self.LuvLCh_white_ref(wref) return LuvLch_to_HSLuv(l, c, h) fn distance_HSLuv(self, c2: Self) -> Float64: var h1: Float64 var s1: Float64 var l1: Float64 var h2: Float64 var s2: Float64 var l2: Float64 h1, s1, l1 = self.HSLuv() h2, s2, l2 = c2.HSLuv() return math.sqrt(sq((h1 - h2) / 100.0) + sq(s1 - s2) + sq(l1 - l2)) fn is_valid(self) -> Bool: """Checks whether the color exists in RGB space, i.e. all values are in [0..1].""" return 0.0 <= self.R and self.R <= 1.0 and 0.0 <= self.G and self.G <= 1.0 and 0.0 <= self.B and self.B <= 1.0 fn clamped(self) -> Self: """Clamps the color to the [0..1] range. If the color is valid already, this is a no-op.""" return Color(clamp01(self.R), clamp01(self.G), clamp01(self.B)) fn distance_rgb(self, c2: Self) -> Float64: """Computes the distance between two colors in RGB space. This is not a good measure! Rather do it in Lab space.""" return math.sqrt(sq(self.R - c2.R) + sq(self.G - c2.G) + sq(self.B - c2.B)) fn distance_linear_rgb(self, c2: Self) -> Float64: """Computes the distance between two colors in linear RGB space. This is not useful for measuring how humans perceive color, but might be useful for other things, like dithering.""" var r1: Float64 var g1: Float64 var b1: Float64 r1, g1, b1 = self.linear_rgb() var r2: Float64 var g2: Float64 var b2: Float64 r2, g2, b2 = c2.linear_rgb() return math.sqrt(sq(r1 - r2) + sq(g1 - g2) + sq(b1 - b2)) fn distance_riemersma(self, c2: Self) -> Float64: """Color distance algorithm developed by Thiadmer Riemersma. It uses RGB coordinates, but he claims it has similar results to CIELUV. This makes it both fast and accurate. Sources: https:#www.compuphase.com/cmetric.htm https:#github.com/lucasb-eyer/go-colorful/issues/52.""" var rAvg = (self.R + c2.R) / 2.0 # Deltas var dR = self.R - c2.R var dG = self.G - c2.G var dB = self.B - c2.B return math.sqrt(((2 + rAvg) * dR * dR) + (4 * dG * dG) + (2 + (1 - rAvg)) * dB * dB) fn almost_equal_rgb(self, c2: Self) -> Bool: """Check for equality between colors within the tolerance Delta (1/255).""" return abs(self.R - c2.R) + abs(self.G - c2.G) + abs(self.B - c2.B) < 3.0 * Delta fn hsv(self) -> (Float64, Float64, Float64): """Hsv returns the Hue [0..360], Saturation and Value [0..1] of the color.""" var min = min(min(self.R, self.G), self.B) var v = max(max(self.R, self.G), self.B) var C = v - min var s = 0.0 if v != 0.0: s = C / v var h = 0.0 # We use 0 instead of undefined as in wp. if min != v: if v == self.R: h = (self.G - self.B) / C % 6.0 if v == self.G: h = (self.B - self.R) / C + 2.0 if v == self.B: h = (self.R - self.G) / C + 4.0 h *= 60.0 if h < 0.0: h += 360.0 return h, s, v fn hsl(self) -> (Float64, Float64, Float64): """Hsl returns the Hue [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color.""" var min = min(min(self.R, self.G), self.B) var max = max(max(self.R, self.G), self.B) var l = (max + min) / 2.0 if min == max: return 0.0, 0.0, l var s = 0.0 if l < 0.5: s = (max - min) / (max + min) else: s = (max - min) / (2.0 - max - min) var h = 0.0 if max == self.R: h = (self.G - self.B) / (max - min) elif max == self.G: h = 2.0 + (self.B - self.R) / (max - min) else: h = 4.0 + (self.R - self.G) / (max - min) h *= 60.0 if h < 0.0: h += 360.0 return h, s, l # fn hex(self) -> String: # """Hex returns the hex "html" representation of the color, as in #ff0080.""" # # Add 0.5 for rounding # return "#" + {UInt8(self.R * 255.0 + 0.5):02x} + {UInt8(self.G * 255.0 + 0.5):02x} + {UInt8(self.B * 255.0 + 0.5):02x} # # return fmt.Sprintf("#%02x%02x%02x", uint8(col.R*255.0+0.5), uint8(col.G*255.0+0.5), uint8(col.B*255.0+0.5)) fn fast_linear_rgb(self) -> (Float64, Float64, Float64): """Is much faster than and almost as accurate as LinearRgb. BUT it is important to NOTE that they only produce good results for valid colors r,g,b in [0,1]. """ return ( delinearize_fast(self.R), delinearize_fast(self.G), delinearize_fast(self.B), ) fn blend_linear_rgb(self, c2: Self, t: Float64) -> Self: """Blends two colors in the Linear RGB color-space. Unlike BlendRgb, this will not produce dark color around the center. t == 0 results in c1, t == 1 results in c2.""" var r1: Float64 var g1: Float64 var b1: Float64 r1, g1, b1 = self.linear_rgb() var r2: Float64 var g2: Float64 var b2: Float64 r2, g2, b2 = c2.linear_rgb() return fast_linear_rgb( r1 + t * (r2 - r1), g1 + t * (g2 - g1), b1 + t * (b2 - b1), ) fn xyy(self) -> (Float64, Float64, Float64): """Converts the given color to CIE xyY space using D65 as reference white. (Note that the reference white is only used for black input.) x, y and Y are in [0..1].""" var X: Float64 var Y: Float64 var Z: Float64 X, Y, Z = self.xyz() return xyz_to_xyY(X, Y, Z) fn xyy_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to CIE xyY space, taking into account a given reference white. (i.e. the monitor's white) (Note that the reference white is only used for black input.) x, y and Y are in [0..1].""" var X: Float64 var Y2: Float64 var Z: Float64 X, Y2, Z = self.xyz() return xyz_to_xyY_white_ref(X, Y2, Z, wref) fn lab(self) -> (Float64, Float64, Float64): """Converts the given color to CIE L*a*b* space using D65 as reference white.""" var x: Float64 var y: Float64 var z: Float64 x, y, z = self.xyz() return xyz_to_lab(x, y, z) fn lab_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to CIE L*a*b* space, taking into account a given reference white. (i.e. the monitor's white).""" var x: Float64 var y: Float64 var z: Float64 x, y, z = self.xyz() return xyz_to_lab_white_ref(x, y, z, wref) fn distance_lab(self, other: Self) -> Float64: """DistanceLab is a good measure of visual similarity between two colors! A result of 0 would mean identical colors, while a result of 1 or higher means the colors differ a lot.""" var l1: Float64 var a1: Float64 var b1: Float64 l1, a1, b1 = self.lab() var l2: Float64 var a2: Float64 var b2: Float64 l2, a2, b2 = other.lab() return math.sqrt(sq(l1 - l2) + sq(a1 - a2) + sq(b1 - b2)) fn distance_cie76(self, other: Self) -> Float64: """DistanceCIE76 is the same as DistanceLab.""" return self.distance_lab(other) fn distance_cie94(self, other: Self) -> Float64: """Uses the CIE94 formula to calculate color distance. More accurate than DistanceLab, but also more work.""" var l1: Float64 var a1: Float64 var b1: Float64 l1, a1, b1 = self.lab() var l2: Float64 var a2: Float64 var b2: Float64 l2, a2, b2 = other.lab() # NOTE: Since all those formulas expect L,a,b values 100x larger than we # have them in this library, we either need to adjust all constants # in the formula, or convert the ranges of L,a,b before, and then # scale the distances down again. The latter is less error-prone. l1 *= 100.0 a1 *= 100.0 b1 *= 100.0 l2 *= 100.0 a2 *= 100.0 b2 *= 100.0 var kl = 1.0 # 2.0 for textiles var kc = 1.0 var kh = 1.0 var k1 = 0.045 # 0.048 for textiles var k2 = 0.015 # 0.014 for textiles. var deltaL = l1 - l2 var c1 = math.sqrt(sq(a1) + sq(b1)) var c2 = math.sqrt(sq(a2) + sq(b2)) var deltaCab = c1 - c2 # Not taking Sqrt here for stability, and it's unnecessary. var deltaHab2 = sq(a1 - a2) + sq(b1 - b2) - sq(deltaCab) var sl = 1.0 var sc = 1.0 + k1 * c1 var sh = 1.0 + k2 * c1 var vL2 = sq(deltaL / (kl * sl)) var vC2 = sq(deltaCab / (kc * sc)) var vH2 = deltaHab2 / sq(kh * sh) return math.sqrt(vL2 + vC2 + vH2) * 0.01 # See above. fn distance_ciede2000(self, other: Self) -> Float64: """DistanceCIEDE2000 uses the Delta E 2000 formula to calculate color distance. It is more expensive but more accurate than both DistanceLab and DistanceCIE94.""" return self.distance_ciede2000klch(other, 1.0, 1.0, 1.0) fn distance_ciede2000klch(self, other: Self, kl: Float64, kc: Float64, kh: Float64) -> Float64: """DistanceCIEDE2000klch uses the Delta E 2000 formula with custom values for the weighting factors kL, kC, and kH.""" var l1: Float64 var a1: Float64 var b1: Float64 l1, a1, b1 = self.lab() var l2: Float64 var a2: Float64 var b2: Float64 l2, a2, b2 = other.lab() # As with CIE94, we scale up the ranges of L,a,b beforehand and scale # them down again afterwards. l1 *= 100.0 a1 *= 100.0 b1 *= 100.0 l2 *= 100.0 a2 *= 100.0 b2 *= 100.0 var cab1 = math.sqrt(sq(a1) + sq(b1)) var cab2 = math.sqrt(sq(a2) + sq(b2)) var cabmean = (cab1 + cab2) / 2 var p: Float64 = 25.0 var g = 0.5 * (1 - math.sqrt((cabmean**7) / ((cabmean**7) + (p**7)))) var ap1 = (1 + g) * a1 var ap2 = (1 + g) * a2 var cp1 = math.sqrt(sq(ap1) + sq(b1)) var cp2 = math.sqrt(sq(ap2) + sq(b2)) var hp1 = 0.0 if b1 != ap1 or ap1 != 0: hp1 = math.atan2(b1, ap1) if hp1 < 0: hp1 += pi * 2 hp1 *= 180 / pi var hp2 = 0.0 if b2 != ap2 or ap2 != 0: hp2 = math.atan2(b2, ap2) if hp2 < 0: hp2 += pi * 2 hp2 *= 180 / pi var deltaLp = l2 - l1 var deltaCp = cp2 - cp1 var dhp = 0.0 var cpProduct = cp1 * cp2 if cpProduct != 0: dhp = hp2 - hp1 if dhp > 180: dhp -= 360 elif dhp < -180: dhp += 360 var deltaHp = 2 * math.sqrt(cpProduct) * math.sin(dhp / 2 * pi / 180) var lpmean = (l1 + l2) / 2 var cpmean = (cp1 + cp2) / 2 var hpmean = hp1 + hp2 if cpProduct != 0: hpmean /= 2 if abs(hp1 - hp2) > 180: if hp1 + hp2 < 360: hpmean += 180 else: hpmean -= 180 var t = 1 - 0.17 * math.cos((hpmean - 30) * pi / 180) + 0.24 * math.cos( 2 * hpmean * pi / 180 ) + 0.32 * math.cos((3 * hpmean + 6) * pi / 180) - 0.2 * math.cos((4 * hpmean - 63) * pi / 180) var deltaTheta = 30 * math.exp(-sq((hpmean - 275) / 25)) var rc = 2 * math.sqrt((cpmean**7) / ((cpmean**7) + (p**7))) var sl = 1 + (0.015 * sq(lpmean - 50)) / math.sqrt(20 + sq(lpmean - 50)) var sc = 1 + 0.045 * cpmean var sh = 1 + 0.015 * cpmean * t var rt = -math.sin(2 * deltaTheta * pi / 180) * rc return ( math.sqrt( sq(deltaLp / (kl * sl)) + sq(deltaCp / (kc * sc)) + sq(deltaHp / (kh * sh)) + rt * (deltaCp / (kc * sc)) * (deltaHp / (kh * sh)) ) * 0.01 ) fn blend_lab(self, c2: Self, t: Float64) -> Self: """BlendLab blends two colors in the L*a*b* color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2.""" var l1: Float64 var a1: Float64 var b1: Float64 l1, a1, b1 = self.lab() var l2: Float64 var a2: Float64 var b2: Float64 l2, a2, b2 = c2.lab() return lab(l1 + t * (l2 - l1), a1 + t * (a2 - a1), b1 + t * (b2 - b1)) fn luv(self) -> (Float64, Float64, Float64): """Converts the given color to CIE L*u*v* space using D65 as reference white. L* is in [0..1] and both u* and v* are in about [-1..1].""" var x: Float64 var y: Float64 var z: Float64 x, y, z = self.xyz() return xyz_to_Luv(x, y, z) fn distance_luv(self, c2: Self) -> Float64: """DistanceLuv is a good measure of visual similarity between two colors! A result of 0 would mean identical colors, while a result of 1 or higher means the colors differ a lot.""" var l1: Float64 var u1: Float64 var v1: Float64 l1, u1, v1 = self.luv() var l2: Float64 var u2: Float64 var v2: Float64 l2, u2, v2 = c2.luv() return math.sqrt(sq(l1 - l2) + sq(u1 - u2) + sq(v1 - v2)) fn blend_luv(self, c2: Self, t: Float64) -> Self: """BlendLuv blends two colors in the CIE-L*u*v* color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2.""" var l1: Float64 var u1: Float64 var v1: Float64 l1, u1, v1 = self.luv() var l2: Float64 var u2: Float64 var v2: Float64 l2, u2, v2 = c2.luv() return Luv(l1 + t * (l2 - l1), u1 + t * (u2 - u1), v1 + t * (v2 - v1)) fn hcl(self) -> (Float64, Float64, Float64): """Converts the given color to HCL space using D65 as reference white. H values are in [0..360], C and L values are in [0..1] although C can overshoot 1.0. """ return self.hcl_white_ref(D65) fn hcl_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to HCL space, taking into account a given reference white. (i.e. the monitor's white) H values are in [0..360], C and L values are in [0..1].""" var L: Float64 var a: Float64 var b: Float64 L, a, b = self.lab_white_ref(wref) return lab_to_hcl(L, a, b) fn blend_hcl(self, other: Self, t: Float64) -> Self: """BlendHcl blends two colors in the CIE-L*C*h° color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2.""" var h1: Float64 var c1: Float64 var l1: Float64 h1, c1, l1 = self.hcl() var h2: Float64 var c2: Float64 var l2: Float64 h2, c2, l2 = other.hcl() # https:#github.com/lucasb-eyer/go-colorful/pull/60 if c1 <= 0.00015 and c2 >= 0.00015: h1 = h2 elif c2 <= 0.00015 and c1 >= 0.00015: h2 = h1 # We know that h are both in [0..360] return hcl(interp_angle(h1, h2, t), c1 + t * (c2 - c1), l1 + t * (l2 - l1)).clamped() fn LuvLCh(self) -> (Float64, Float64, Float64): """Converts the given color to LuvLCh space using D65 as reference white. h values are in [0..360], C and L values are in [0..1] although C can overshoot 1.0. """ return self.Luv_LCh_white_ref(D65) fn Luv_LCh_white_ref(self, wref: List[Float64]) -> (Float64, Float64, Float64): """Converts the given color to LuvLCh space, taking into account a given reference white. (i.e. the monitor's white) h values are in [0..360], c and l values are in [0..1].""" var l: Float64 var u: Float64 var v: Float64 l, u, v = self.Luv_white_ref(wref) return Luv_To_LuvLCh(l, u, v) fn blend_Luv_LCh(self, other: Self, t: Float64) -> Self: """BlendLuvLCh blends two colors in the cylindrical CIELUV color space. t == 0 results in c1, t == 1 results in c2.""" var l1: Float64 var c1: Float64 var h1: Float64 l1, c1, h1 = self.LuvLCh() var l2: Float64 var c2: Float64 var h2: Float64 l2, c2, h2 = other.LuvLCh() # We know that h are both in [0..360] return LuvLCh(l1 + t * (l2 - l1), c1 + t * (c2 - c1), interp_angle(h1, h2, t)) fn HPLuv(self) -> (Float64, Float64, Float64): """HPLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. Note that HPLuv can only represent pastel colors, and so the Saturation value could be much larger than 1 for colors it can't represent.""" var l: Float64 var c: Float64 var h: Float64 l, c, h = self.LuvLCh_white_ref(hSLuvD65) return LuvLCh_to_HPLuv(l, c, h) fn interp_angle(a0: Float64, a1: Float64, t: Float64) -> Float64: """Utility used by Hxx color-spaces for interpolating between two angles in [0,360].""" # Based on the answer here: http://stackoverflow.com/a/14498790/2366315 # With potential proof that it works here: http://math.stackexchange.com/a/2144499 var delta = ((((a1 - a0) % 360.0) + 540.0)) % 360.0 - 180.0 return (a0 + t * delta + 360.0) % 360.0 ### HSV ### ########### # From http://en.wikipedia.org/wiki/HSL_and_HSV # Note that h is in [0..360] and s,v in [0..1] fn hsv(h: Float64, s: Float64, v: Float64) -> Color: """Hsv creates a new Color given a Hue in [0..360], a Saturation and a Value in [0..1].""" var hp = h / 60.0 var C = v * s var X = C * (1.0 - abs((hp % 2.0) - 1.0)) var m = v - C var r = 0.0 var g = 0.0 var b = 0.0 if 0.0 <= hp and hp < 1.0: r = C g = X elif 1.0 <= hp and hp < 2.0: r = X g = C elif 2.0 <= hp and hp < 3.0: g = C b = X elif 3.0 <= hp and hp < 4.0: g = X b = C elif 4.0 <= hp and hp < 5.0: r = X b = C elif 5.0 <= hp and hp < 6.0: r = C b = X return Color(m + r, m + g, m + b) ## HSL ## ######### fn hsl(h: Float64, s: Float64, l: Float64) -> Color: """Hsl creates a new Color given a Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1].""" if s == 0: return Color(l, l, l) var r: Float64 var g: Float64 var b: Float64 var t1: Float64 var t2: Float64 var tr: Float64 var tg: Float64 var tb: Float64 if l < 0.5: t1 = l * (1.0 + s) else: t1 = l + s - l * s t2 = 2 * l - t1 var h_copy = h h_copy /= 360 tr = h_copy + 1.0 / 3.0 tg = h_copy tb = h_copy - 1.0 / 3.0 if tr < 0: tr += 1 if tr > 1: tr -= 1 if tg < 0: tg += 1 if tg > 1: tg -= 1 if tb < 0: tb += 1 if tb > 1: tb -= 1 # Red if 6 * tr < 1: r = t2 + (t1 - t2) * 6 * tr elif 2 * tr < 1: r = t1 elif 3 * tr < 2: r = t2 + (t1 - t2) * (2.0 / 3.0 - tr) * 6 else: r = t2 # Green if 6 * tg < 1: g = t2 + (t1 - t2) * 6 * tg elif 2 * tg < 1: g = t1 elif 3 * tg < 2: g = t2 + (t1 - t2) * (2.0 / 3.0 - tg) * 6 else: g = t2 # Blue if 6 * tb < 1: b = t2 + (t1 - t2) * 6 * tb elif 2 * tb < 1: b = t1 elif 3 * tb < 2: b = t2 + (t1 - t2) * (2.0 / 3.0 - tb) * 6 else: b = t2 return Color(r, g, b) ## Hex ## ######### # # Hex parses a "html" hex color-string, either in the 3 "#f0c" or 6 "#ff1034" digits form. # func Hex(scol string) (Color, error) { # format := "#%02x%02x%02x" # factor := 1.0 / 255.0 # if len(scol) == 4 { # format = "#%1x%1x%1x" # factor = 1.0 / 15.0 # } # var r, g, b UInt8 # n, err := fmt.Sscanf(scol, format, &r, &g, &b) # if err != nil { # return Color{}, err # } # if n != 3 { # return Color{}, fmt.Errorf("color: %v is not a hex-color", scol) # } # return Color{float64(r) * factor, float64(g) * factor, float64(b) * factor}, nil # } ## Linear ## ####### # A much faster and still quite precise linearization using a 6th-order Taylor approximation. # See the accompanying Jupyter notebook for derivation of the constants. fn linearize_fast(v: Float64) -> Float64: var v1 = v - 0.5 var v2 = v1 * v1 var v3 = v2 * v1 var v4 = v2 * v2 return ( -0.248750514614486 + 0.925583310193438 * v + 1.16740237321695 * v2 + 0.280457026598666 * v3 - 0.0757991963780179 * v4 ) fn delinearize_fast(v: Float64) -> Float64: if v > 0.2: var v1 = v - 0.6 var v2 = v1 * v1 var v3 = v2 * v1 var v4 = v2 * v2 var v5 = v3 * v2 return ( 0.442430344268235 + 0.592178981271708 * v - 0.287864782562636 * v2 + 0.253214392068985 * v3 - 0.272557158129811 * v4 + 0.325554383321718 * v5 ) elif v > 0.03: var v1 = v - 0.115 var v2 = v1 * v1 var v3 = v2 * v1 var v4 = v2 * v2 var v5 = v3 * v2 return ( 0.194915592891669 + 1.55227076330229 * v - 3.93691860257828 * v2 + 18.0679839248761 * v3 - 101.468750302746 * v4 + 632.341487393927 * v5 ) else: var v1 = v - 0.015 var v2 = v1 * v1 var v3 = v2 * v1 var v4 = v2 * v2 var v5 = v3 * v2 return ( 0.0519565234928877 + 5.09316778537561 * v - 99.0338180489702 * v2 + 3484.52322764895 * v3 - 150028.083412663 * v4 + 7168008.42971613 * v5 ) # FastLinearRgb is much faster than and almost as accurate as LinearRgb. # BUT it is important to NOTE that they only produce good results for valid inputs r,g,b in [0,1]. fn fast_linear_rgb(r: Float64, g: Float64, b: Float64) -> Color: return Color(delinearize_fast(r), delinearize_fast(g), delinearize_fast(b)) fn xyz_to_xyY(X: Float64, Y: Float64, Z: Float64) -> (Float64, Float64, Float64): return xyz_to_xyY_white_ref(X, Y, Z, D65) fn xyz_to_xyY_white_ref(X: Float64, Y: Float64, Z: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var Yout = Y var N = X + Y + Z var x = X var y = Y if abs(N) < 1e-14: x = wref[0] / (wref[0] + wref[1] + wref[2]) y = wref[1] / (wref[0] + wref[1] + wref[2]) else: x = x / N y = y / N return x, y, Yout fn xyy_to_xyz(x: Float64, y: Float64, Y: Float64) -> (Float64, Float64, Float64): var Yout = y var X = x var Z = 0.0 if -1e-14 < y and y < 1e-14: X = 0.0 Z = 0.0 else: X = Y / y * x Z = Y / y * (1.0 - x - y) return x, y, Yout fn xyy(x: Float64, y: Float64, Y: Float64) -> Color: var X: Float64 var new_Y: Float64 var Z: Float64 X, new_Y, Z = xyy_to_xyz(x, y, Y) return xyz(X, new_Y, Z) # / L*a*b* #/ ####### # http://en.wikipedia.org/wiki/Lab_color_space#CIELAB-CIEXYZ_conversions # For L*a*b*, we need to L*a*b*<->XYZ->RGB and the first one is device dependent. fn lab_f(t: Float64) -> Float64: if t > 6.0 / 29.0 * 6.0 / 29.0 * 6.0 / 29.0: return math.cbrt(t) return t / 3.0 * 29.0 / 6.0 * 29.0 / 6.0 + 4.0 / 29.0 fn xyz_to_lab(x: Float64, y: Float64, z: Float64) -> (Float64, Float64, Float64): """Use D65 white as reference point by default. http://www.fredmiranda.com/forum/topic/1035332 http://en.wikipedia.org/wiki/Standard_illuminant.""" return xyz_to_lab_white_ref(x, y, z, D65) fn xyz_to_lab_white_ref(x: Float64, y: Float64, z: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var fy = lab_f(y / wref[1]) var l = 1.16 * fy - 0.16 var a = 5.0 * (lab_f(x / wref[0]) - fy) var b = 2.0 * (fy - lab_f(z / wref[2])) return l, a, b fn lab_finv(t: Float64) -> Float64: if t > 6.0 / 29.0: return t * t * t return 3.0 * 6.0 / 29.0 * 6.0 / 29.0 * (t - 4.0 / 29.0) fn lab_to_xyz(l: Float64, a: Float64, b: Float64) -> (Float64, Float64, Float64): """D65 white (see above).""" return lab_to_xyz_white_ref(l, a, b, D65) fn lab_to_xyz_white_ref(l: Float64, a: Float64, b: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var l2 = (l + 0.16) / 1.16 var x = wref[0] * lab_finv(l2 + a / 5.0) var y = wref[1] * lab_finv(l2) var z = wref[2] * lab_finv(l2 - b / 2.0) return x, y, z fn lab(l: Float64, a: Float64, b: Float64) -> Color: """Generates a color by using data given in CIE L*a*b* space using D65 as reference white. WARNING: many combinations of `l`, `a`, and `b` values do not have corresponding valid RGB values, check the FAQ in the README if you're unsure.""" var x: Float64 var y: Float64 var z: Float64 x, y, z = lab_to_xyz(l, a, b) return xyz(x, y, z) fn lab_white_ref(l: Float64, a: Float64, b: Float64, wref: List[Float64]) -> Color: """Generates a color by using data given in CIE L*a*b* space, taking into account a given reference white. (i.e. the monitor's white).""" var x: Float64 var y: Float64 var z: Float64 x, y, z = lab_to_xyz_white_ref(l, a, b, wref) return xyz(x, y, z) # / L*u*v* #/ ####### # http://en.wikipedia.org/wiki/CIELUV#XYZ_.E2.86.92_CIELUV_and_CIELUV_.E2.86.92_XYZ_conversions # For L*u*v*, we need to L*u*v*<->XYZ<->RGB and the first one is device dependent. fn xyz_to_Luv(x: Float64, y: Float64, z: Float64) -> (Float64, Float64, Float64): """Use D65 white as reference point by default.""" return xyz_to_Luv_white_ref(x, y, z, D65) fn luv_to_xyz(l: Float64, u: Float64, v: Float64) -> (Float64, Float64, Float64): """Use D65 white as reference point by default.""" return luv_to_xyz_white_ref(l, u, v, D65) fn Luv(l: Float64, u: Float64, v: Float64) -> Color: """Generates a color by using data given in CIE L*u*v* space using D65 as reference white. L* is in [0..1] and both u* and v* are in about [-1..1] WARNING: many combinations of `l`, `u`, and `v` values do not have corresponding valid RGB values, check the FAQ in the README if you're unsure.""" var x: Float64 var y: Float64 var z: Float64 x, y, z = luv_to_xyz(l, u, v) return xyz(x, y, z) fn Luv_white_ref(l: Float64, u: Float64, v: Float64, wref: List[Float64]) -> Color: """Generates a color by using data given in CIE L*u*v* space, taking into account a given reference white. (i.e. the monitor's white) L* is in [0..1] and both u* and v* are in about [-1..1].""" var x: Float64 var y: Float64 var z: Float64 x, y, z = luv_to_xyz_white_ref(l, u, v, wref) return xyz(x, y, z) ## HCL ## ######### # HCL is nothing else than L*a*b* in cylindrical coordinates! # (this was wrong on English wikipedia, I fixed it, let's hope the fix stays.) # But it is widely popular since it is a "correct HSV" # http://www.hunterlab.com/appnotes/an09_96a.pdf fn lab_to_hcl(L: Float64, a: Float64, b: Float64) -> (Float64, Float64, Float64): var h = 0.0 if abs(b - a) > 1e-4 and abs(a) > 1e-4: h = (57.29577951308232087721 * math.atan2(b, a) + 360.0) % 360.0 # Rad2Deg var c = math.sqrt(sq(a) + sq(b)) var l = L return h, c, l fn hcl(h: Float64, c: Float64, l: Float64) -> Color: """Generates a color by using data given in HCL space using D65 as reference white. H values are in [0..360], C and L values are in [0..1] WARNING: many combinations of `h`, `c`, and `l` values do not have corresponding valid RGB values, check the FAQ in the README if you're unsure.""" return hcl_white_ref(h, c, l, D65) fn hcl_to_Lab(h: Float64, c: Float64, l: Float64) -> (Float64, Float64, Float64): var H = 0.01745329251994329576 * h # Deg2Rad var a = c * math.cos(H) var b = c * math.sin(H) var L = l return L, a, b fn hcl_white_ref(h: Float64, c: Float64, l: Float64, wref: List[Float64]) -> Color: """Generates a color by using data given in HCL space, taking into account a given reference white. (i.e. the monitor's white) H values are in [0..360], C and L values are in [0..1].""" var L: Float64 var a: Float64 var b: Float64 L, a, b = hcl_to_Lab(h, c, l) return lab_white_ref(L, a, b, wref) fn LuvLCh(l: Float64, c: Float64, h: Float64) -> Color: """Generates a color by using data given in LuvLCh space using D65 as reference white. h values are in [0..360], C and L values are in [0..1] WARNING: many combinations of `l`, `c`, and `h` values do not have corresponding valid RGB values, check the FAQ in the README if you're unsure.""" return LuvLCh_white_ref(l, c, h, D65) fn LuvLChToLuv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): var H = 0.01745329251994329576 * h # Deg2Rad var u = c * math.cos(H) var v = c * math.sin(H) var L = l return L, u, v fn LuvLCh_white_ref(l: Float64, c: Float64, h: Float64, wref: List[Float64]) -> Color: """Generates a color by using data given in LuvLCh space, taking into account a given reference white. (i.e. the monitor's white) h values are in [0..360], C and L values are in [0..1].""" var L: Float64 var u: Float64 var v: Float64 L, u, v = LuvLChToLuv(l, c, h) return Luv_white_ref(L, u, v, wref) fn clamped(color: Color) -> Color: return Color(clamp01(color.R), clamp01(color.G), clamp01(color.B)) fn linearize(v: Float64) -> Float64: if v <= 0.04045: return v / 12.92 var lhs: Float64 = (v + 0.055) / 1.055 var rhs: Float64 = 2.4 return lhs**rhs fn linear_rgb_to_xyz(r: Float64, g: Float64, b: Float64) -> (Float64, Float64, Float64): var x: Float64 = 0.41239079926595948 * r + 0.35758433938387796 * g + 0.18048078840183429 * b var y: Float64 = 0.21263900587151036 * r + 0.71516867876775593 * g + 0.072192315360733715 * b var z: Float64 = 0.019330818715591851 * r + 0.11919477979462599 * g + 0.95053215224966058 * b return x, y, z fn luv_to_xyz_white_ref(l: Float64, u: Float64, v: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var y: Float64 if l <= 0.08: y = wref[1] * l * 100.0 * 3.0 / 29.0 * 3.0 / 29.0 * 3.0 / 29.0 else: y = wref[1] * cube((l + 0.16) / 1.16) var un: Float64 = 0 var vn: Float64 = 0 un, vn = xyz_to_uv(wref[0], wref[1], wref[2]) var x: Float64 = 0 var z: Float64 = 0 if l != 0.0: var ubis = (u / (13.0 * l)) + un var vbis = (v / (13.0 * l)) + vn x = y * 9.0 * ubis / (4.0 * vbis) z = y * (12.0 - (3.0 * ubis) - (20.0 * vbis)) / (4.0 * vbis) else: x = 0.0 y = 0.0 return x, y, z fn xyz_to_uv(x: Float64, y: Float64, z: Float64) -> (Float64, Float64): """For this part, we do as R's graphics.hcl does, not as wikipedia does. Or is it the same.""" var denom = x + (15.0 * y) + (3.0 * z) var u: Float64 var v: Float64 if denom == 0.0: u = 0.0 v = 0.0 return u, v u = 4.0 * x / denom v = 9.0 * y / denom return u, v fn xyz_to_Luv_white_ref(x: Float64, y: Float64, z: Float64, wref: List[Float64]) -> (Float64, Float64, Float64): var l: Float64 if y / wref[1] <= 6.0 / 29.0 * 6.0 / 29.0 * 6.0 / 29.0: l = y / wref[1] * (29.0 / 3.0 * 29.0 / 3.0 * 29.0 / 3.0) / 100.0 else: l = 1.16 * math.cbrt(y / wref[1]) - 0.16 var ubis: Float64 var vbis: Float64 ubis, vbis = xyz_to_uv(x, y, z) var un: Float64 var vn: Float64 un, vn = xyz_to_uv(wref[0], wref[1], wref[2]) var u: Float64 var v: Float64 u = 13.0 * l * (ubis - un) v = 13.0 * l * (vbis - vn) return l, u, v fn Luv_To_LuvLCh(L: Float64, u: Float64, v: Float64) -> (Float64, Float64, Float64): # Oops, floating point workaround necessary if u ~= v and both are very small (i.e. almost zero). var h: Float64 if abs(v - u) > 1e-4 and abs(u) > 1e-4: h = (57.29577951308232087721 * math.atan2(v, u) + 360.0) % 360.0 # Rad2Deg else: h = 0.0 var l = L var c = math.sqrt(sq(u) + sq(v)) return l, c, h fn xyz_to_linear_rgb(x: Float64, y: Float64, z: Float64) -> (Float64, Float64, Float64): """Converts from CIE XYZ-space to Linear Color space.""" var r = (3.2409699419045214 * x) - (1.5373831775700935 * y) - (0.49861076029300328 * z) var g = (-0.96924363628087983 * x) + (1.8759675015077207 * y) + (0.041555057407175613 * z) var b = (0.055630079696993609 * x) - (0.20397695888897657 * y) + (1.0569715142428786 * z) return r, g, b fn delinearize(v: Float64) -> Float64: if v <= 0.0031308: return 12.92 * v return 1.055 * (v ** (1.0 / 2.4)) - 0.055 fn linear_rgb(r: Float64, g: Float64, b: Float64) -> Color: return Color(delinearize(r), delinearize(g), delinearize(b)) fn xyz(x: Float64, y: Float64, z: Float64) -> Color: var r: Float64 var g: Float64 var b: Float64 r, g, b = xyz_to_linear_rgb(x, y, z) return linear_rgb(r, g, b) --- external/hue/color_gens.mojo --- from random import randn_float64 from .color import Color, hsv, hcl # Various ways to generate single random colors fn fast_warm_color() -> Color: """Creates a random dark, "warm" color through a restricted HSV space.""" return hsv( randn_float64() * 360.0, 0.5 + randn_float64() * 0.3, 0.3 + randn_float64() * 0.3, ) fn warm_color() -> Color: """Creates a random dark, "warm" color through restricted HCL space. This is slower than FastWarmColor but will likely give you colors which have the same "warmness" if you run it many times.""" var c = random_warm() while not c.is_valid(): c = random_warm() return c fn random_warm() -> Color: return hcl( randn_float64() * 360.0, 0.1 + randn_float64() * 0.3, 0.2 + randn_float64() * 0.3, ) fn fast_happy_color() -> Color: """Creates a random bright, "pimpy" color through a restricted HSV space.""" return hsv( randn_float64() * 360.0, 0.7 + randn_float64() * 0.3, 0.6 + randn_float64() * 0.3, ) fn happy_color() -> Color: """Creates a random bright, "pimpy" color through restricted HCL space. This is slower than FastHappyColor but will likely give you colors which have the same "brightness" if you run it many times.""" var c = random_pimp() while not c.is_valid(): c = random_pimp() return c fn random_pimp() -> Color: return hcl( randn_float64() * 360.0, 0.5 + randn_float64() * 0.3, 0.5 + randn_float64() * 0.3, ) --- external/hue/happy_palettegen.mojo --- from random import randn_float64 from .color import Color, hsv, lab_to_hcl from .soft_palettegen import soft_palette_ex, SoftPaletteSettings fn fast_happy_palette(colors_count: Int) -> List[Color]: """Uses the HSV color space to generate colors with similar S,V but distributed evenly along their Hue. This is fast but not always pretty. If you've got time to spare, use Lab (the non-fast below).""" var colors = List[Color](capacity=colors_count) for _ in range(colors_count): colors.append(Color(0, 0, 0)) var i = 0 while i < colors_count: colors[i] = hsv( Float64(i) * (360.0 / Float64(colors_count)), 0.8 + randn_float64() * 0.2, 0.65 + randn_float64() * 0.2, ) i += 1 return colors fn happy_palette(colors_count: Int) raises -> List[Color]: fn pimpy(l: Float64, a: Float64, b: Float64) -> Bool: var h: Float64 var c: Float64 var l_new: Float64 l_new, c, h = lab_to_hcl(l, a, b) return 0.3 <= c and 0.4 <= l and l <= 0.8 return soft_palette_ex(colors_count, SoftPaletteSettings(pimpy, 50, True)) --- external/hue/hsluv.mojo --- from .math import cube, clamp01, sq, pi, max_float64 from .color import Color, linear_rgb, xyz_to_linear_rgb, luv_to_xyz_white_ref import math alias hSLuvD65 = List[Float64](0.95045592705167, 1.0, 1.089057750759878) fn LuvLCh_to_HSLuv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): """[-1..1] but the code expects it to be [-100..100].""" var c_new = c * 100.0 var l_new = l * 100.0 var s: Float64 var max_val: Float64 if l_new > 99.9999999 or l_new < 0.00000001: s = 0.0 else: max_val = max_chroma_for_lh(l_new, h) s = c_new / max_val * 100.0 return h, clamp01(s / 100.0), clamp01(l_new / 100.0) fn HSLuvToLuvLCh(h: Float64, s: Float64, l: Float64) -> (Float64, Float64, Float64): var tmp_l = l * 100.0 var tmp_s = s * 100.0 var c: Float64 var max: Float64 if tmp_l > 99.9999999 or tmp_l < 0.00000001: c = 0.0 else: max = max_chroma_for_lh(l, h) c = max / 100.0 * tmp_s # c is [-100..100], but for LCh it's supposed to be almost [-1..1] return clamp01(l / 100.0), c / 100.0, h fn LuvLCh_to_Luv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): var H: Float64 = 0.01745329251994329576 * h # Deg2Rad var u = c * math.cos(H) var v = c * math.sin(H) return l, u, v fn LuvLCh_to_HPLuv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): """[-1..1] but the code expects it to be [-100..100].""" var c_new = c * 100.0 var l_new = l * 100.0 var s: Float64 var max_val: Float64 if l_new > 99.9999999 or l_new < 0.00000001: s = 0.0 else: max_val = max_safe_chroma_for_l(l_new) s = c_new / max_val * 100.0 return h, s / 100.0, l_new / 100.0 fn HPLuv_to_LuvLCh(h: Float64, s: Float64, l: Float64) -> (Float64, Float64, Float64): var l_new = l * 100.0 var s_new = s * 100.0 var c: Float64 var max_val: Float64 if l_new > 99.9999999 or l_new < 0.00000001: c = 0.0 else: max_val = max_safe_chroma_for_l(l_new) c = max_val / 100.0 * s_new return l_new / 100.0, c / 100.0, h fn HSLuv(h: Float64, s: Float64, l: Float64) -> Color: """Creates a new Color from values in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. The returned color values are clamped (using .Clamped), so this will never output an invalid color.""" # HSLuv -> LuvLCh -> CIELUV -> CIEXYZ -> Linear RGB -> sRGB var l_new: Float64 var c: Float64 var h_new: Float64 l_new, c, h_new = HSLuvToLuvLCh(h, s, l) var L: Float64 var u: Float64 var v: Float64 L, u, v = LuvLCh_to_Luv(l_new, c, h_new) var x: Float64 var y: Float64 var z: Float64 x, y, z = luv_to_xyz_white_ref(l, u, v, hSLuvD65) var R: Float64 var G: Float64 var B: Float64 R, G, B = xyz_to_linear_rgb(x, y, z) return linear_rgb(R, G, B).clamped() fn LuvLch_to_HSLuv(l: Float64, c: Float64, h: Float64) -> (Float64, Float64, Float64): # [-1..1] but the code expects it to be [-100..100] var tmp_l: Float64 = l * 100.0 var tmp_c: Float64 = c * 100.0 var s: Float64 var max_val: Float64 if tmp_l > 99.9999999 or tmp_l < 0.00000001: s = 0.0 else: max_val = max_chroma_for_lh(tmp_l, h) s = tmp_c / max_val * 100.0 return h, clamp01(s / 100.0), clamp01(tmp_l / 100.0) fn HPLuv(h: Float64, s: Float64, l: Float64) -> Color: """HPLuv creates a new Color from values in the HPLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. The returned color values are clamped (using .Clamped), so this will never output an invalid color.""" # HPLuv -> LuvLCh -> CIELUV -> CIEXYZ -> Linear RGB -> sRGB var l_new: Float64 var c: Float64 var h_new: Float64 l_new, c, h_new = HPLuv_to_LuvLCh(h, s, l) var L: Float64 var u: Float64 var v: Float64 L, u, v = LuvLCh_to_Luv(l_new, c, h_new) var x: Float64 var y: Float64 var z: Float64 x, y, z = luv_to_xyz_white_ref(l, u, v, hSLuvD65) var R: Float64 var G: Float64 var B: Float64 R, G, B = xyz_to_linear_rgb(x, y, z) return linear_rgb(R, G, B).clamped() fn HSLuv(self: Color) -> (Float64, Float64, Float64): """HSLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1].""" # sRGB -> Linear RGB -> CIEXYZ -> CIELUV -> LuvLCh -> HSLuv var l: Float64 var c: Float64 var h: Float64 l, c, h = self.LuvLCh_white_ref(hSLuvD65) return LuvLCh_to_HSLuv(l, c, h) fn HPLuv(self: Color) -> (Float64, Float64, Float64): """HPLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. Note that HPLuv can only represent pastel colors, and so the Saturation value could be much larger than 1 for colors it can't represent.""" # sRGB -> Linear RGB -> CIEXYZ -> CIELUV -> LuvLCh -> HSLuv var l: Float64 var c: Float64 var h: Float64 l, c, h = self.LuvLCh_white_ref(hSLuvD65) return LuvLCh_to_HPLuv(l, c, h) fn DistanceHPLuv(self: Color, other: Color) -> Float64: """DistanceHPLuv calculates Euclidean distance in the HPLuv colorspace. No idea how useful this is. The Hue value is divided by 100 before the calculation, so that H, S, and L have the same relative ranges.""" var h1: Float64 var s1: Float64 var l1: Float64 h1, s1, l1 = self.HPLuv() var h2: Float64 var s2: Float64 var l2: Float64 h2, s2, l2 = other.HPLuv() return math.sqrt(sq((h1 - h2) / 100.0) + sq(s1 - s2) + sq(l1 - l2)) alias m = List[List[Float64]]( List[Float64](3.2409699419045214, -1.5373831775700935, -0.49861076029300328), List[Float64](-0.96924363628087983, 1.8759675015077207, 0.041555057407175613), List[Float64](0.055630079696993609, -0.20397695888897657, 1.0569715142428786), ) alias kappa = 903.2962962962963 alias epsilon = 0.0088564516790356308 fn get_bounds(l: Float64) -> List[List[Float64]]: var sub2: Float64 var sub1 = (l + 16.0**3.0) / 1560896.0 var ret = List[List[Float64]]( List[Float64](0, 0), List[Float64](0, 0), List[Float64](0, 0), List[Float64](0, 0), List[Float64](0, 0), List[Float64](0, 0), ) if sub1 > epsilon: sub2 = sub1 else: sub2 = l / kappa for i in range(len(m)): var k = 0 while k < 2: var top1 = (284517.0 * m[i][0] - 94839.0 * m[i][2]) * sub2 var top2 = (838422.0 * m[i][2] + 769860.0 * m[i][1] + 731718.0 * m[i][0]) * l * sub2 - 769860.0 * Float64( k ) * l var bottom = (632260.0 * m[i][2] - 126452.0 * m[i][1]) * sub2 + 126452.0 * Float64(k) ret[i * 2 + k][0] = top1 / bottom ret[i * 2 + k][1] = top2 / bottom k += 1 return ret fn length_of_ray_until_intersect(theta: Float64, x: Float64, y: Float64) -> Float64: return y / (math.sin(theta) - x * math.cos(theta)) fn max_chroma_for_lh(l: Float64, h: Float64) -> Float64: var hRad = h / 360.0 * pi * 2.0 var minLength = max_float64 var bounds = get_bounds(l) for i in range(len(bounds)): var line = bounds[i] var length = length_of_ray_until_intersect(hRad, line[0], line[1]) if length > 0.0 and length < minLength: minLength = length return minLength fn max_safe_chroma_for_l(l: Float64) -> Float64: var min_length = max_float64 for line in get_bounds(l): var m1 = line[][0] var b1 = line[][1] var x = intersect_line_line(m1, b1, -1.0 / m1, 0.0) var dist = distance_from_pole(x, b1 + x * m1) if dist < min_length: min_length = dist return min_length fn intersect_line_line(x1: Float64, y1: Float64, x2: Float64, y2: Float64) -> Float64: return (y1 - y2) / (x2 - x1) fn distance_from_pole(x: Float64, y: Float64) -> Float64: return math.sqrt(sq(x) + sq(y)) --- external/hue/math.mojo --- from utils.numerics import max_finite fn cube(v: Float64) -> Float64: return v * v * v fn sq(v: Float64) -> Float64: return v * v fn clamp01(v: Float64) -> Float64: """Clamps from 0 to 1.""" return max(0.0, min(v, 1.0)) alias pi: Float64 = 3.141592653589793238462643383279502884197169399375105820974944592307816406286 alias max_float64: Float64 = max_finite[DType.float64]() --- external/hue/soft_palettegen.mojo --- from collections.optional import Optional from random import random_si64 from utils.numerics import inf import math from .math import sq from .color import lab # The algorithm works in L*a*b* color space and converts to RGB in the end. # L* in [0..1], a* and b* in [-1..1] @register_passable("trivial") struct lab_t(EqualityComparable): var L: Float64 var A: Float64 var B: Float64 fn __init__(inout self, L: Float64, A: Float64, B: Float64): self.L = L self.A = A self.B = B fn __eq__(self, other: lab_t) -> Bool: return self.L == other.L and self.A == other.A and self.B == other.B fn __ne__(self, other: lab_t) -> Bool: return self.L != other.L or self.A != other.A or self.B != other.B fn in_stack(haystack: List[lab_t], upto: Int, needle: lab_t) -> Bool: var i = 0 while i < upto and i < len(haystack): if haystack[i] == needle: return True i += 1 return False fn labs_2_cols(labs: List[lab_t]) -> List[Color]: var lab_count = len(labs) var cols = List[Color](capacity=lab_count) for _ in range(lab_count): cols.append(Color(0.0, 0.0, 0.0)) for i in range(lab_count): cols[i] = lab(labs[i].L, labs[i].A, labs[i].B) return cols alias CheckColorFn = fn (l: Float64, a: Float64, b: Float64) -> Bool @value struct SoftPaletteSettings: # A fntion which can be used to restrict the allowed color-space. var check_color: Optional[CheckColorFn] # The higher, the better quality but the slower. Usually two figures. var iterations: Int # Use up to 160000 or 8000 samples of the L*a*b* space (and thus calls to CheckColor). # Set this to true only if your CheckColor shapes the Lab space weirdly. var many_samples: Bool # That's faster than using colorful's DistanceLab since we would have to # convert back and forth for that. Here is no conversion. fn lab_dist(lab1: lab_t, lab2: lab_t) -> Float64: return math.sqrt(sq(lab1.L - lab2.L) + sq(lab1.A - lab2.A) + sq(lab1.B - lab2.B)) # A wrapper which uses common parameters. fn soft_palette(colors_count: Int) raises -> List[Color]: return soft_palette_ex(colors_count, SoftPaletteSettings(None, 50, False)) alias LAB_DELTA = 1e-6 fn lab_eq(lab1: lab_t, lab2: lab_t) -> Bool: return abs(lab1.L - lab2.L) < LAB_DELTA and abs(lab1.A - lab2.A) < LAB_DELTA and abs(lab1.B - lab2.B) < LAB_DELTA fn soft_palette_ex(colors_count: Int, settings: SoftPaletteSettings) raises -> List[Color]: """Yeah, windows-stype Foo, FooEx, screw you golang... Uses K-means to cluster the color-space and return the means of the clusters as a new palette of distinctive colors. Falls back to K-medoid if the mean happens to fall outside of the color-space, which can only happen if you specify a CheckColor fntion.""" # Checks whether it's a valid RGB and also fulfills the potentially provided constraint. @always_inline fn check(col: lab_t) -> Bool: var c = lab(col.L, col.A, col.B) return c.is_valid() and settings.check_color.value()[](col.L, col.A, col.B) # Sample the color space. These will be the points k-means is run on. var dl = 0.05 var dab = 0.1 if settings.many_samples: dl = 0.01 dab = 0.05 var samples = List[lab_t](capacity=int(1.0 / dl * 2.0 / dab * 2.0 / dab)) var l = 0.0 while l <= 1.0: var a = -1.0 while a <= 1.0: var b = -1.0 while b <= 1.0: var labt = lab_t(l, a, b) if check(labt): samples.append(labt) b += dab a += dab l += dl # That would cause some infinite loops down there... if len(samples) < colors_count: raise Error( String("palettegen: more colors requested ") + str(colors_count) + " than samples available " + str(len(samples)) + " Your requested color count may be wrong, you might want to use" " many samples or your constraint fntion makes the valid color" " space too small" ) elif len(samples) == colors_count: return labs_2_cols(samples) # Oops? # We take the initial means out of the samples, so they are in fact medoids. # This helps us avoid infinite loops or arbitrary cutoffs with too restrictive constraints. var means = List[lab_t](capacity=colors_count) for _ in range(colors_count): means.append(lab_t(0.0, 0.0, 0.0)) var i = 0 while i < colors_count: i += 1 means[i] = samples[int(random_si64(0, len(samples)))] while in_stack(means, i, means[i]): means[i] = samples[int(random_si64(0, len(samples)))] var clusters = List[Int](capacity=len(samples)) for _ in range(len(samples)): clusters.append(0) var samples_used = List[Bool](capacity=len(samples)) for _ in range(len(samples)): samples_used.append(False) # The actual k-means/medoid iterations i = 0 while i < settings.iterations: # Reassing the samples to clusters, i.e. to their closest mean. # By the way, also check if any sample is used as a medoid and if so, mark that. for j in range(len(samples)): samples_used[j] = False var mindist = inf[DType.float64]() for k in range(len(means)): var dist = lab_dist(samples[j], means[k]) if dist < mindist: mindist = dist clusters[j] = k # Mark samples which are used as a medoid. if lab_eq(samples[j], means[k]): samples_used[i] = True # Compute new means according to the samples. for k in range(len(means)): # The new mean is the average of all samples belonging to it.. var nsamples = 0 var newmean = lab_t(0.0, 0.0, 0.0) for j in range(len(samples)): if clusters[j] == k: nsamples += 1 newmean.L += samples[j].L newmean.A += samples[j].A newmean.B += samples[j].B if nsamples > 0: newmean.L /= Float64(nsamples) newmean.A /= Float64(nsamples) newmean.B /= Float64(nsamples) else: # That mean doesn't have any samples? Get a new mean from the sample list! var inewmean = int(random_si64(0, len(samples_used))) while samples_used[inewmean]: inewmean = int(random_si64(0, len(samples_used))) newmean = samples[inewmean] samples_used[inewmean] = True # But now we still need to check whether the new mean is an allowed color. if nsamples > 0 and check(newmean): # It does, life's good (TM) means[k] = newmean else: # New mean isn't an allowed color or doesn't have any samples! # Switch to medoid mode and pick the closest (unused) sample. # This should always find something thanks to len(samples) >= colors_count var mindist = inf[DType.float64]() for l in range(len(samples)): if not samples_used[l]: var dist = lab_dist(samples[l], newmean) if dist < mindist: mindist = dist newmean = samples[l] i += 1 return labs_2_cols(means) --- external/hue/sort.mojo --- # # An element represents a single element of a set. It is used to # # implement a disjoint-set forest. # type element struct: # parent *element # Parent element # rank int # Rank (approximate depth) of the subtree with this element as root # # newElement creates a singleton set and returns its sole element. # fn newElement() *element: # s = &element{ # s.parent = s # return s # # find returns an arbitrary element of a set when invoked on any element of # # the set, The important feature is that it returns the same value when # # invoked on any element of the set. Consequently, it can be used to test if # # two elements belong to the same set. # fn (e *element) find() *element: # for e.parent != e: # e.parent = e.parent.parent # e = e.parent # return e # # union establishes the union of two sets when given an element from each set. # # Afterwards, the original sets no longer exist as separate entities. # fn union(e1, e2 *element): # # Ensure the two elements aren't already part of the same union. # e1Root = e1.find() # e2Root = e2.find() # if e1Root == e2Root: # return # # Create a union by making the shorter tree point to the root of the # # larger tree. # switch: # case e1Root.rank < e2Root.rank: # e1Root.parent = e2Root # case e1Root.rank > e2Root.rank: # e2Root.parent = e1Root # default: # e2Root.parent = e1Root # e1Root.rank++ # # An edgeIdxs describes an edge in a graph or tree. The vertices in the edge # # are indexes into a list of Color values. # type edgeIdxs [2]int # # An edgeDistance is a map from an edge (pair of indices) to a distance # # between the two vertices. # type edgeDistance map[edgeIdxs]float64 # # allToAllDistancesCIEDE2000 computes the CIEDE2000 distance between each pair of # # colors. It returns a map from a pair of indices (u, v) with u < v to a # # distance. # fn allToAllDistancesCIEDE2000(cs []Color) edgeDistance: # nc = len(cs) # m = make(edgeDistance, nc*nc) # for u = 0; u < nc-1; u++: # for v = u + 1; v < nc; v++: # m[edgeIdxs{u, v] = cs[u].DistanceCIEDE2000(cs[v]) # return m # # sortEdges sorts all edges in a distance map by increasing vertex distance. # fn sortEdges(m edgeDistance) []edgeIdxs: # es = make([]edgeIdxs, 0, len(m)) # for uv = range m: # es = append(es, uv) # sort.Slice(es, fn(i, j int) bool: # return m[es[i]] < m[es[j]] # ) # return es # # minSpanTree computes a minimum spanning tree from a vertex count and a # # distance-sorted edge list. It returns the subset of edges that belong to # # the tree, including both (u, v) and (v, u) for each edge. # fn minSpanTree(nc int, es []edgeIdxs) map[edgeIdxs]struct{: # # Start with each vertex in its own set. # elts = make([]*element, nc) # for i = range elts: # elts[i] = newElement() # # Run Kruskal's algorithm to construct a minimal spanning tree. # mst = make(map[edgeIdxs]struct{, nc) # for _, uv = range es: # u, v = uv[0], uv[1] # if elts[u].find() == elts[v].find(): # continue # Same set: edge would introduce a cycle. # mst[uv] = struct{{ # mst[edgeIdxs{v, u] = struct{{ # union(elts[u], elts[v]) # return mst # # traverseMST walks a minimum spanning tree in prefix order. # fn traverseMST(mst map[edgeIdxs]struct{, root int) []int: # # Compute a list of neighbors for each vertex. # neighs = make(map[int][]int, len(mst)) # for uv = range mst: # u, v = uv[0], uv[1] # neighs[u] = append(neighs[u], v) # for u, vs = range neighs: # sort.Ints(vs) # copy(neighs[u], vs) # # Walk the tree from a given vertex. # order = make([]int, 0, len(neighs)) # visited = make(map[int]bool, len(neighs)) # var walkFrom fn(int) # walkFrom = fn(r int): # # Visit the starting vertex. # order = append(order, r) # visited[r] = true # # Recursively visit each child in turn. # for _, c = range neighs[r]: # if !visited[c]: # walkFrom(c) # walkFrom(root) # return order # # Sorted sorts a list of Color values. Sorting is not a well-defined operation # # for colors so the intention here primarily is to order colors so that the # # transition from one to the next is fairly smooth. # fn Sorted(cs []Color) []Color: # # Do nothing in trivial cases. # newCs = make([]Color, len(cs)) # if len(cs) < 2: # copy(newCs, cs) # return newCs # # Compute the distance from each color to every other color. # dists = allToAllDistancesCIEDE2000(cs) # # Produce a list of edges in increasing order of the distance between # # their vertices. # edges = sortEdges(dists) # # Construct a minimum spanning tree from the list of edges. # mst = minSpanTree(len(cs), edges) # # Find the darkest color in the list. # var black Color # var dIdx int # Index of darkest color # light = math.MaxFloat64 # Lightness of darkest color (distance from black) # for i, c = range cs: # d = black.DistanceCIEDE2000(c) # if d < light: # dIdx = i # light = d # # Traverse the tree starting from the darkest color. # idxs = traverseMST(mst, dIdx) # # Convert the index list to a list of colors, overwriting the input. # for i, idx = range idxs: # newCs[i] = cs[idx] # return newCs --- external/hue/warm_palettegen.mojo --- from random import randn_float64 from .color import hsv, lab_to_hcl from .soft_palettegen import soft_palette_ex, SoftPaletteSettings fn fast_warm_palette(colors_count: Int) -> List[Color]: """Uses the hsv color space to generate colors with similar S,V but distributed evenly along their Hue. This is fast but not always pretty. If you've got time to spare, use Lab (the non-fast below). Args: colors_count: The number of colors to generate. Returns: A list of colors. """ var colors = List[Color](capacity=colors_count) for _ in range(colors_count): colors.append(Color(0, 0, 0)) var i = 0 while i < colors_count: colors[i] = hsv( Float64(i) * (360.0 / Float64(colors_count)), 0.55 + randn_float64() * 0.2, 0.35 + randn_float64() * 0.2, ) i += 1 return colors fn warm_palette(colors_count: Int) raises -> List[Color]: fn warmy(l: Float64, a: Float64, b: Float64) -> Bool: var h: Float64 var c: Float64 var l_new: Float64 h, c, l_new = lab_to_hcl(l, a, b) return 0.1 <= c and c <= 0.4 and 0.2 <= l and l <= 0.5 return soft_palette_ex(colors_count, SoftPaletteSettings(warmy, 50, True)) --- external/mist/__init__.mojo --- from .color import Color from .style import Style, new_style from .profile import ( Profile, ASCII, ANSI, ANSI256, TRUE_COLOR, ASCII_PROFILE, ANSI_PROFILE, ANSI256_PROFILE, TRUE_COLOR_PROFILE, AnyColor, NoColor, ) from .renderers import ( render_as_color, render_with_background_color, red, green, blue, yellow, cyan, gray, magenta, red_background, green_background, blue_background, yellow_background, cyan_background, gray_background, magenta_background, bold, italic, underline, faint, crossout, overline, ) --- external/mist/ansi_colors.mojo --- alias ANSI_HEX_CODES = List[UInt32]( 0x000000, 0x800000, 0x008000, 0x808000, 0x000080, 0x800080, 0x008080, 0xC0C0C0, 0x808080, 0xFF0000, 0x00FF00, 0xFFFF00, 0x0000FF, 0xFF00FF, 0x00FFFF, 0xFFFFFF, 0x000000, 0x00005F, 0x000087, 0x0000AF, 0x0000D7, 0x0000FF, 0x005F00, 0x005F5F, 0x005F87, 0x005FAF, 0x005FD7, 0x005FFF, 0x008700, 0x00875F, 0x008787, 0x0087AF, 0x0087D7, 0x0087FF, 0x00AF00, 0x00AF5F, 0x00AF87, 0x00AFAF, 0x00AFD7, 0x00AFFF, 0x00D700, 0x00D75F, 0x00D787, 0x00D7AF, 0x00D7D7, 0x00D7FF, 0x00FF00, 0x00FF5F, 0x00FF87, 0x00FFAF, 0x00FFD7, 0x00FFFF, 0x5F0000, 0x5F005F, 0x5F0087, 0x5F00AF, 0x5F00D7, 0x5F00FF, 0x5F5F00, 0x5F5F5F, 0x5F5F87, 0x5F5FAF, 0x5F5FD7, 0x5F5FFF, 0x5F8700, 0x5F875F, 0x5F8787, 0x5F87AF, 0x5F87D7, 0x5F87FF, 0x5FAF00, 0x5FAF5F, 0x5FAF87, 0x5FAFAF, 0x5FAFD7, 0x5FAFFF, 0x5FD700, 0x5FD75F, 0x5FD787, 0x5FD7AF, 0x5FD7D7, 0x5FD7FF, 0x5FFF00, 0x5FFF5F, 0x5FFF87, 0x5FFFAF, 0x5FFFD7, 0x5FFFFF, 0x870000, 0x87005F, 0x870087, 0x8700AF, 0x8700D7, 0x8700FF, 0x875F00, 0x875F5F, 0x875F87, 0x875FAF, 0x875FD7, 0x875FFF, 0x878700, 0x87875F, 0x878787, 0x8787AF, 0x8787D7, 0x8787FF, 0x87AF00, 0x87AF5F, 0x87AF87, 0x87AFAF, 0x87AFD7, 0x87AFFF, 0x87D700, 0x87D75F, 0x87D787, 0x87D7AF, 0x87D7D7, 0x87D7FF, 0x87FF00, 0x87FF5F, 0x87FF87, 0x87FFAF, 0x87FFD7, 0x87FFFF, 0xAF0000, 0xAF005F, 0xAF0087, 0xAF00AF, 0xAF00D7, 0xAF00FF, 0xAF5F00, 0xAF5F5F, 0xAF5F87, 0xAF5FAF, 0xAF5FD7, 0xAF5FFF, 0xAF8700, 0xAF875F, 0xAF8787, 0xAF87AF, 0xAF87D7, 0xAF87FF, 0xAFAF00, 0xAFAF5F, 0xAFAF87, 0xAFAFAF, 0xAFAFD7, 0xAFAFFF, 0xAFD700, 0xAFD75F, 0xAFD787, 0xAFD7AF, 0xAFD7D7, 0xAFD7FF, 0xAFFF00, 0xAFFF5F, 0xAFFF87, 0xAFFFAF, 0xAFFFD7, 0xAFFFFF, 0xD70000, 0xD7005F, 0xD70087, 0xD700AF, 0xD700D7, 0xD700FF, 0xD75F00, 0xD75F5F, 0xD75F87, 0xD75FAF, 0xD75FD7, 0xD75FFF, 0xD78700, 0xD7875F, 0xD78787, 0xD787AF, 0xD787D7, 0xD787FF, 0xD7AF00, 0xD7AF5F, 0xD7AF87, 0xD7AFAF, 0xD7AFD7, 0xD7AFFF, 0xD7D700, 0xD7D75F, 0xD7D787, 0xD7D7AF, 0xD7D7D7, 0xD7D7FF, 0xD7FF00, 0xD7FF5F, 0xD7FF87, 0xD7FFAF, 0xD7FFD7, 0xD7FFFF, 0xFF0000, 0xFF005F, 0xFF0087, 0xFF00AF, 0xFF00D7, 0xFF00FF, 0xFF5F00, 0xFF5F5F, 0xFF5F87, 0xFF5FAF, 0xFF5FD7, 0xFF5FFF, 0xFF8700, 0xFF875F, 0xFF8787, 0xFF87AF, 0xFF87D7, 0xFF87FF, 0xFFAF00, 0xFFAF5F, 0xFFAF87, 0xFFAFAF, 0xFFAFD7, 0xFFAFFF, 0xFFD700, 0xFFD75F, 0xFFD787, 0xFFD7AF, 0xFFD7D7, 0xFFD7FF, 0xFFFF00, 0xFFFF5F, 0xFFFF87, 0xFFFFAF, 0xFFFFD7, 0xFFFFFF, 0x080808, 0x121212, 0x1C1C1C, 0x262626, 0x303030, 0x3A3A3A, 0x444444, 0x4E4E4E, 0x585858, 0x626262, 0x6C6C6C, 0x767676, 0x808080, 0x8A8A8A, 0x949494, 0x9E9E9E, 0xA8A8A8, 0xB2B2B2, 0xBCBCBC, 0xC6C6C6, 0xD0D0D0, 0xDADADA, 0xE4E4E4, 0xEEEEEE, ) """RGB values of ANSI colors (0-255).""" --- external/mist/color.mojo --- import external.hue from .ansi_colors import ANSI_HEX_CODES # Workaround for str() not working at compile time due to using an external_call to c. fn int_to_str(owned value: Int, base: Int = 10) -> String: """Converts an integer to a string. Args: value: The integer to convert to a string. base: The base to convert the integer to. Returns: The string representation of the integer. """ # Catch edge case of 0 if value == 0: return "0" var temp = List[UInt8]() var i = 0 while value > 0: temp.append(ord(String("0123456789abcdef")[value % base])) i += 1 value /= 10 var buffer = List[UInt8]() for i in range(len(temp) - 1, -1, -1): buffer.append(temp[i]) buffer.append(0) var result = String(buffer^) return result alias FOREGROUND = "38" alias BACKGROUND = "48" alias AnyColor = Variant[NoColor, ANSIColor, ANSI256Color, RGBColor] trait Color(EqualityComparable, CollectionElement): fn sequence(self, is_background: Bool) -> String: """Sequence returns the ANSI Sequence for the color.""" ... @register_passable("trivial") struct NoColor(Color, Stringable): fn __init__(inout self): pass fn __eq__(self, other: NoColor) -> Bool: return True fn __ne__(self, other: NoColor) -> Bool: return False fn sequence(self, is_background: Bool) -> String: return "" fn __str__(self) -> String: """String returns the ANSI Sequence for the color and the text.""" return "" @register_passable("trivial") struct ANSIColor(Color, Stringable): """ANSIColor is a color (0-15) as defined by the ANSI Standard.""" var value: UInt32 fn __init__(inout self, value: UInt32): self.value = value fn __eq__(self, other: ANSIColor) -> Bool: return self.value == other.value fn __ne__(self, other: ANSIColor) -> Bool: return self.value != other.value fn sequence(self, is_background: Bool) -> String: """Returns the ANSI Sequence for the color and the text. Args: is_background: Whether the color is a background color. """ var modifier: Int = 0 if is_background: modifier += 10 if self.value < 8: return int_to_str(modifier + int(self.value) + 30) return int_to_str(modifier + int(self.value) - 8 + 90) fn __str__(self) -> String: """String returns the ANSI Sequence for the color and the text.""" return ANSI_HEX_CODES[int(self.value)] @register_passable("trivial") struct ANSI256Color(Color, Stringable): """ANSI256Color is a color (16-255) as defined by the ANSI Standard.""" var value: UInt32 fn __init__(inout self, value: UInt32): self.value = value fn __eq__(self, other: ANSI256Color) -> Bool: return self.value == other.value fn __ne__(self, other: ANSI256Color) -> Bool: return self.value != other.value fn sequence(self, is_background: Bool) -> String: """Returns the ANSI Sequence for the color and the text. Args: is_background: Whether the color is a background color. """ var prefix: String = FOREGROUND if is_background: prefix = BACKGROUND return prefix + ";5;" + int_to_str(int(self.value)) fn __str__(self) -> String: """String returns the ANSI Sequence for the color and the text.""" return ANSI_HEX_CODES[int(self.value)] # // ansiToRGB converts an ANSI color to a 24-bit RGB color. # // # // r, g, b := ansiToRGB(57) # func ansiToRGB(ansi uint32) (uint32, uint32, uint32) { # // For out-of-range values return black. # if ansi > 255 { # return 0, 0, 0 # } # // Low ANSI. # if ansi < 16 { # h, ok := lowANSI[ansi] # if !ok { # return 0, 0, 0 # } # r, g, b := hexToRGB(h) # return r, g, b # } # // Grays. # if ansi > 231 { # s := (ansi-232)*10 + 8 # return s, s, s # } # // ANSI256. # n := ansi - 16 # b := n % 6 # g := (n - b) / 6 % 6 # r := (n - b - g*6) / 36 % 6 # for _, v := range []*uint32{&r, &g, &b} { # if *v > 0 { # c := *v*40 + 55 # *v = c # } # } # return r, g, b # } fn ansi_to_rgb(ansi: UInt32) -> (UInt32, UInt32, UInt32): """Converts an ANSI color to a 24-bit RGB color.""" # For out-of-range values return black. if ansi > 255: return UInt32(0), UInt32(0), UInt32(0) # Low ANSI. if ansi < 16: var h = ANSI_HEX_CODES[int(ansi)] return hex_to_rgb(h) # Grays. if ansi > 231: var s = (ansi - 232) * 10 + 8 return s, s, s # ANSI256. var n = ansi - 16 var b = n % 6 var g = (n - b) / 6 % 6 var r = (n - b - g * 6) / 36 % 6 var rgb = List[UInt32](r, g, b) var v = rgb[0] var i = 0 while i < 3: if v > 0: var c = v * 40 + 55 v = c i += 1 return r, g, b fn hex_to_rgb(hex: UInt32) -> (UInt32, UInt32, UInt32): """Converts a number in hexadecimal format to red, green, and blue values. `r, g, b = hex_to_rgb(0x0000FF)`. """ return hex >> 16, hex >> 8 & 0xFF, hex & 0xFF @register_passable("trivial") struct RGBColor(Color): """RGBColor is a hex-encoded color, e.g. '#abcdef'.""" var value: UInt32 fn __init__(inout self, value: UInt32): self.value = value fn __eq__(self, other: RGBColor) -> Bool: return self.value == other.value fn __ne__(self, other: RGBColor) -> Bool: return self.value != other.value fn sequence(self, is_background: Bool) -> String: """Returns the ANSI Sequence for the color and the text. Args: is_background: Whether the color is a background color. """ var rgb = hex_to_rgb(self.value) var prefix = FOREGROUND if is_background: prefix = BACKGROUND return ( prefix + String(";2;") + int_to_str(int(rgb[0])) + ";" + int_to_str(int(rgb[1])) + ";" + int_to_str(int(rgb[2])) ) fn ansi256_to_ansi(value: UInt32) -> ANSIColor: """Converts an ANSI256 color to an ANSI color. Args: value: ANSI256 color value. """ var r: Int = 0 var md = hue.math.max_float64 var h = hex_to_rgb(ANSI_HEX_CODES[int(value)]) var i: Int = 0 while i <= 15: var hb = hex_to_rgb(ANSI_HEX_CODES[int(i)]) var d = hue.Color( h[0].cast[DType.float64](), h[1].cast[DType.float64](), h[2].cast[DType.float64]() ).distance_HSLuv( hue.Color(hb[0].cast[DType.float64](), hb[1].cast[DType.float64](), hb[2].cast[DType.float64]()) ) if d < md: md = d r = i i += 1 return ANSIColor(r) fn v2ci(value: Float64) -> Int: if value < 48: return 0 elif value < 115: return 1 return int((value - 35) / 40) fn hex_to_ansi256(color: hue.Color) -> ANSI256Color: """Converts a hex code to a ANSI256 color. Args: color: Hex code color from hue.Color. """ # Calculate the nearest 0-based color index at 16..231 # Originally had * 255 in each of these var r: Float64 = v2ci(color.R) # 0..5 each var g: Float64 = v2ci(color.G) var b: Float64 = v2ci(color.B) var ci: Int = int((36 * r) + (6 * g) + b) # 0..215 # Calculate the represented colors back from the index alias i2cv = InlineArray[Int, 6](0, 0x5F, 0x87, 0xAF, 0xD7, 0xFF) var cr = i2cv[int(r)] # r/g/b, 0..255 each var cg = i2cv[int(g)] var cb = i2cv[int(b)] # Calculate the nearest 0-based gray index at 232..255 var gray_index: Int var average = (r + g + b) / 3 if average > 238: gray_index = 23 else: gray_index = int((average - 3) / 10) # 0..23 var gv = 8 + 10 * gray_index # same value for r/g/b, 0..255 # Return the one which is nearer to the original input rgb value # Originall had / 255.0 for r, g, and b in each of these var c2 = hue.Color(cr, cg, cb) var g2 = hue.Color(gv, gv, gv) var color_dist = color.distance_HSLuv(c2) var gray_dist = color.distance_HSLuv(g2) if color_dist <= gray_dist: return ANSI256Color(16 + ci) return ANSI256Color(232 + gray_index) --- external/mist/hyperlink.mojo --- from .style import osc, st fn hyperlink(link: String, name: String) -> String: """Creates a hyperlink using OSC8. Args: link: The URL to link to. name: The text to display. Returns: The hyperlink text. """ return osc + "8;;" + link + st + name + osc + "8;;" + st --- external/mist/notification.mojo --- from .style import osc, st fn notify(title: String, body: String): """Sends a notification to the terminal. Args: title: The title of the notification. body: The body of the notification. """ print(osc + "777;notify;" + title + ";" + body + st, end="") --- external/mist/profile.mojo --- import os import external.hue from .color import ( NoColor, ANSIColor, ANSI256Color, RGBColor, AnyColor, hex_to_ansi256, ansi256_to_ansi, hex_to_rgb, ansi_to_rgb, int_to_str, ) alias TRUE_COLOR: Int = 0 alias ANSI256: Int = 1 alias ANSI: Int = 2 alias ASCII: Int = 3 alias TRUE_COLOR_PROFILE = Profile(TRUE_COLOR) alias ANSI256_PROFILE = Profile(ANSI256) alias ANSI_PROFILE = Profile(ANSI) alias ASCII_PROFILE = Profile(ASCII) # TODO: UNIX systems only for now. Need to add Windows, POSIX, and SOLARIS support. fn get_color_profile() -> Int: """Queries the terminal to determine the color profile it supports. ASCII, ANSI, ANSI256, or TRUE_COLOR. """ # if not o.isTTY(): # return Ascii if os.getenv("GOOGLE_CLOUD_SHELL", "false") == "true": return TRUE_COLOR var term = os.getenv("TERM").lower() var color_term = os.getenv("COLORTERM").lower() # COLORTERM is used by some terminals to indicate TRUE_COLOR support. if color_term == "24bit": pass elif color_term == "truecolor": if term.startswith("screen"): # tmux supports TRUE_COLOR, screen only ANSI256 if os.getenv("TERM_PROGRAM") != "tmux": return ANSI256 return TRUE_COLOR elif color_term == "yes": pass elif color_term == "true": return ANSI256 # TERM is used by most terminals to indicate color support. if term == "xterm-kitty" or term == "wezterm" or term == "xterm-ghostty": return TRUE_COLOR elif term == "linux": return ANSI if "256color" in term: return ANSI256 if "color" in term: return ANSI if "ansi" in term: return ANSI return ASCII @register_passable struct Profile: alias valid = InlineArray[Int, 4](TRUE_COLOR, ANSI256, ANSI, ASCII) var value: Int fn __init__(inout self, value: Int): """ Initialize a new profile with the given profile type. Args: value: The setting to use for this profile. Valid values: [TRUE_COLOR, ANSI256, ANSI, ASCII]. """ if value not in Self.valid: self.value = TRUE_COLOR return self.value = value fn __init__(inout self): """ Initialize a new profile with the given profile type. """ self.value = get_color_profile() fn __copyinit__(inout self, other: Profile): self.value = other.value fn convert(self, color: AnyColor) -> AnyColor: """Degrades a color based on the terminal profile. Args: color: The color to convert to the current profile. """ if self.value == ASCII: return NoColor() if color.isa[NoColor](): return color[NoColor] elif color.isa[ANSIColor](): return color[ANSIColor] elif color.isa[ANSI256Color](): if self.value == ANSI: return ansi256_to_ansi(color[ANSI256Color].value) return color[ANSI256Color] elif color.isa[RGBColor](): var h = hex_to_rgb(color[RGBColor].value) if self.value != TRUE_COLOR: var ansi256 = hex_to_ansi256( hue.Color(h[0].cast[DType.float64](), h[1].cast[DType.float64](), h[2].cast[DType.float64]()) ) if self.value == ANSI: return ansi256_to_ansi(ansi256.value) return ansi256 return color[RGBColor] # If it somehow gets here, just return No Color until I can figure out how to just return whatever color was passed in. return color[NoColor] fn color(self, value: UInt32) -> AnyColor: """Color creates a Color from a string. Valid inputs are hex colors, as well as ANSI color codes (0-15, 16-255). If an invalid input is passed in, NoColor() is returned which will not apply any coloring. Args: value: The string to convert to a color. """ if self.value == ASCII: return NoColor() if value < 16: return self.convert(ANSIColor(value)) elif value < 256: return self.convert(ANSI256Color(value)) return self.convert(RGBColor(value)) --- external/mist/renderers.mojo --- from .style import Style, new_style from .profile import Profile alias RED = 0xE88388 alias GREEN = 0xA8CC8C alias YELLOW = 0xDBAB79 alias BLUE = 0x71BEF2 alias MAGENTA = 0xD290E4 alias CYAN = 0x66C2CD alias GRAY = 0xB9BFCA # Convenience functions for quick style application fn render_as_color(text: String, color: UInt32) -> String: var profile = Profile() return new_style(profile.value).foreground(color=profile.color(color)).render(text) fn red(text: String) -> String: """Apply red color to the text.""" return render_as_color(text, RED) fn green(text: String) -> String: """Apply green color to the text.""" return render_as_color(text, GREEN) fn yellow(text: String) -> String: """Apply yellow color to the text.""" return render_as_color(text, YELLOW) fn blue(text: String) -> String: """Apply blue color to the text.""" return render_as_color(text, BLUE) fn magenta(text: String) -> String: """Apply magenta color to the text.""" return render_as_color(text, MAGENTA) fn cyan(text: String) -> String: """Apply cyan color to the text.""" return render_as_color(text, CYAN) fn gray(text: String) -> String: """Apply gray color to the text.""" return render_as_color(text, GRAY) fn render_with_background_color(text: String, color: UInt32) -> String: var profile = Profile() return new_style().background(color=profile.color(color)).render(text) fn red_background(text: String) -> String: """Apply red background color to the text.""" return render_with_background_color(text, RED) fn green_background(text: String) -> String: """Apply green background color to the text.""" return render_with_background_color(text, GREEN) fn yellow_background(text: String) -> String: """Apply yellow background color to the text.""" return render_with_background_color(text, YELLOW) fn blue_background(text: String) -> String: """Apply blue background color to the text.""" return render_with_background_color(text, BLUE) fn magenta_background(text: String) -> String: """Apply magenta background color to the text.""" return render_with_background_color(text, MAGENTA) fn cyan_background(text: String) -> String: """Apply cyan background color to the text.""" return render_with_background_color(text, CYAN) fn gray_background(text: String) -> String: """Apply gray background color to the text.""" return render_with_background_color(text, GRAY) fn bold(text: String) -> String: return new_style().bold().render(text) fn faint(text: String) -> String: return new_style().faint().render(text) fn italic(text: String) -> String: return new_style().italic().render(text) fn underline(text: String) -> String: return new_style().underline().render(text) fn overline(text: String) -> String: return new_style().overline().render(text) fn crossout(text: String) -> String: return new_style().crossout().render(text) --- external/mist/screen.mojo --- from external.gojo.fmt import sprintf from .style import bel, csi, reset, osc from .color import AnyColor, NoColor, ANSIColor, ANSI256Color, RGBColor # Sequence definitions. ## Cursor positioning. alias cursor_up_seq = "%dA" alias cursor_down_seq = "%dB" alias cursor_forward_seq = "%dC" alias cursor_back_seq = "%dD" alias cursor_next_line_seq = "%dE" alias cursor_previous_line_seq = "%dF" alias cursor_horizontal_seq = "%dG" alias cursor_position_seq = "%d;%dH" alias erase_display_seq = "%dJ" alias erase_line_seq = "%dK" alias scroll_up_seq = "%dS" alias scroll_down_seq = "%dT" alias save_cursor_position_seq = "s" alias restore_cursor_position_seq = "u" alias change_scrolling_region_seq = "%d;%dr" alias insert_line_seq = "%dL" alias delete_line_seq = "%dM" ## Explicit values for EraseLineSeq. alias erase_line_right_seq = "0K" alias erase_line_left_seq = "1K" alias erase_entire_line_seq = "2K" ## Mouse alias enable_mouse_press_seq = "?9h" # press only (X10) alias disable_mouse_press_seq = "?9l" alias enable_mouse_seq = "?1000h" # press, release, wheel alias disable_mouse_seq = "?1000l" alias enable_mouse_hilite_seq = "?1001h" # highlight alias disable_mouse_hilite_seq = "?1001l" alias enable_mouse_cell_motion_seq = "?1002h" # press, release, move on pressed, wheel alias disable_mouse_cell_motion_seq = "?1002l" alias enable_mouse_all_motion_seq = "?1003h" # press, release, move, wheel alias disable_mouse_all_motion_seq = "?1003l" alias enable_mouse_extended_mode_seq = "?1006h" # press, release, move, wheel, extended coordinates alias disable_mouse_extended_mode_seq = "?1006l" alias enable_mouse_pixels_mode_seq = "?1016h" # press, release, move, wheel, extended pixel coordinates alias disable_mouse_pixels_mode_seq = "?1016l" ## Screen alias restore_screen_seq = "?47l" alias save_screen_seq = "?47h" alias alt_screen_seq = "?1049h" alias exit_alt_screen_seq = "?1049l" ## Bracketed paste. ## https:#en.wikipedia.org/wiki/Bracketed-paste alias enable_bracketed_paste_seq = "?2004h" alias disable_bracketed_paste_seq = "?2004l" alias start_bracketed_paste_seq = "200~" alias end_bracketed_paste_seq = "201~" ## Session alias set_window_title_seq = "2;%s" + bel alias set_foreground_color_seq = "10;%s" + bel alias set_background_color_seq = "11;%s" + bel alias set_cursor_color_seq = "12;%s" + bel alias show_cursor_seq = "?25h" alias hide_cursor_seq = "?25l" fn reset_terminal(): """Reset the terminal to its default style, removing any active styles.""" print(csi + reset + "m", end="") fn set_foreground_color(color: AnyColor): """Sets the default foreground color. Args: color: The color to set. """ var c: String = "" if color.isa[ANSIColor](): c = color[ANSIColor].sequence(False) elif color.isa[ANSI256Color](): c = color[ANSI256Color].sequence(False) elif color.isa[RGBColor](): c = color[RGBColor].sequence(False) print(osc + set_foreground_color_seq, c, end="") fn set_background_color(color: AnyColor): """Sets the default background color. Args: color: The color to set. """ var c: String = "" if color.isa[NoColor](): pass elif color.isa[ANSIColor](): c = color[ANSIColor].sequence(True) elif color.isa[ANSI256Color](): c = color[ANSI256Color].sequence(True) elif color.isa[RGBColor](): c = color[RGBColor].sequence(True) print(osc + set_background_color_seq, c, end="") fn set_cursor_color(color: AnyColor): """Sets the cursor color. Args: color: The color to set. """ var c: String = "" if color.isa[NoColor](): pass elif color.isa[ANSIColor](): c = color[ANSIColor].sequence(True) elif color.isa[ANSI256Color](): c = color[ANSI256Color].sequence(True) elif color.isa[RGBColor](): c = color[RGBColor].sequence(True) print(osc + set_cursor_color_seq, c, end="") fn restore_screen(): """Restores a previously saved screen state.""" print(csi + restore_screen_seq, end="") fn save_screen(): """Saves the screen state.""" print(csi + save_screen_seq, end="") fn alt_screen(): """Switches to the alternate screen buffer. The former view can be restored with ExitAltScreen().""" print(csi + alt_screen_seq, end="") fn exit_alt_screen(): """Exits the alternate screen buffer and returns to the former terminal view.""" print(csi + exit_alt_screen_seq, end="") fn clear_screen(): """Clears the visible portion of the terminal.""" print(sprintf(csi + erase_display_seq, UInt16(2)), end="") move_cursor(1, 1) fn move_cursor(row: UInt16, column: Int): """Moves the cursor to a given position. Args: row: The row to move to. column: The column to move to. """ print(sprintf(csi + cursor_position_seq, row, column), end="") fn hide_cursor(): """TODO: Show and Hide cursor don't seem to work ATM. HideCursor hides the cursor.""" print(csi + hide_cursor_seq, end="") fn show_cursor(): """Shows the cursor.""" print(csi + show_cursor_seq, end="") fn save_cursor_position(): """Saves the cursor position.""" print(csi + save_cursor_position_seq, end="") fn restore_cursor_position(): """Restores a saved cursor position.""" print(csi + restore_cursor_position_seq, end="") fn cursor_up(n: Int): """Moves the cursor up a given number of lines. Args: n: The number of lines to move up. """ print(sprintf(csi + cursor_up_seq, n), end="") fn cursor_down(n: Int): """Moves the cursor down a given number of lines. Args: n: The number of lines to move down. """ print(sprintf(csi + cursor_down_seq, n), end="") fn cursor_forward(n: Int): """Moves the cursor up a given number of lines. Args: n: The number of lines to move forward. """ print(sprintf(csi + cursor_forward_seq, n), end="") fn cursor_back(n: Int): """Moves the cursor backwards a given number of cells. Args: n: The number of cells to move back. """ print(sprintf(csi + cursor_back_seq, n), end="") fn cursor_next_line(n: Int): """Moves the cursor down a given number of lines and places it at the beginning of the line. Args: n: The number of lines to move down. """ print(sprintf(csi + cursor_next_line_seq, n), end="") fn cursor_prev_line(n: Int): """Moves the cursor up a given number of lines and places it at the beginning of the line. Args: n: The number of lines to move back. """ print(sprintf(csi + cursor_previous_line_seq, n), end="") fn clear_line(): """Clears the current line.""" print(csi + erase_entire_line_seq, end="") fn clear_line_left(): """Clears the line to the left of the cursor.""" print(csi + erase_line_left_seq, end="") fn clear_line_right(): """Clears the line to the right of the cursor.""" print(csi + erase_line_right_seq, end="") fn clear_lines(n: Int): """Clears a given number of lines. Args: n: The number of lines to clear. """ var clear_line = sprintf(csi + erase_line_seq, UInt16(2)) var cursor_up = sprintf(csi + cursor_up_seq, UInt16(1)) var movement = (cursor_up + clear_line) * n print(clear_line + movement, end="") fn change_scrolling_region(top: UInt16, bottom: UInt16): """Sets the scrolling region of the terminal. Args: top: The top of the scrolling region. bottom: The bottom of the scrolling region. """ print(sprintf(csi + change_scrolling_region_seq, top, bottom), end="") fn insert_lines(n: Int): """Inserts the given number of lines at the top of the scrollable region, pushing lines below down. Args: n: The number of lines to insert. """ print(sprintf(csi + insert_line_seq, n), end="") fn delete_lines(n: Int): """Deletes the given number of lines, pulling any lines in the scrollable region below up. Args: n: The number of lines to delete. """ print(sprintf(csi + delete_line_seq, n), end="") fn enable_mouse_press(): """Enables X10 mouse mode. Button press events are sent only.""" print(csi + enable_mouse_press_seq, end="") fn disable_mouse_press(): """Disables X10 mouse mode.""" print(csi + disable_mouse_press_seq, end="") fn enable_mouse(): """Enables Mouse Tracking mode.""" print(csi + enable_mouse_seq, end="") fn disable_mouse(): """Disables Mouse Tracking mode.""" print(csi + disable_mouse_seq, end="") fn enable_mouse_hilite(): """Enables Hilite Mouse Tracking mode.""" print(csi + enable_mouse_hilite_seq, end="") fn disable_mouse_hilite(): """Disables Hilite Mouse Tracking mode.""" print(csi + disable_mouse_hilite_seq, end="") fn enable_mouse_cell_motion(): """Enables Cell Motion Mouse Tracking mode.""" print(csi + enable_mouse_cell_motion_seq, end="") fn disable_mouse_cell_motion(): """Disables Cell Motion Mouse Tracking mode.""" print(csi + disable_mouse_cell_motion_seq, end="") fn enable_mouse_all_motion(): """Enables All Motion Mouse mode.""" print(csi + enable_mouse_all_motion_seq, end="") fn disable_mouse_all_motion(): """Disables All Motion Mouse mode.""" print(csi + disable_mouse_all_motion_seq, end="") fn enable_mouse_extended_mode(): """Enables Extended Mouse mode (SGR). This should be enabled in conjunction with EnableMouseCellMotion, and EnableMouseAllMotion.""" print(csi + enable_mouse_extended_mode_seq, end="") fn disable_mouse_extended_mode(): """Disables Extended Mouse mode (SGR).""" print(csi + disable_mouse_extended_mode_seq, end="") fn enable_mouse_pixels_mode(): """Enables Pixel Motion Mouse mode (SGR-Pixels). This should be enabled in conjunction with EnableMouseCellMotion, and EnableMouseAllMotion.""" print(csi + enable_mouse_pixels_mode_seq, end="") fn disable_mouse_pixels_mode(): """Disables Pixel Motion Mouse mode (SGR-Pixels).""" print(csi + disable_mouse_pixels_mode_seq, end="") fn set_window_title(title: String): """Sets the terminal window title. Args: title: The title to set. """ print(osc + set_window_title_seq, title, end="") fn enable_bracketed_paste(): """Enables bracketed paste.""" print(csi + enable_bracketed_paste_seq, end="") fn disable_bracketed_paste(): """Disables bracketed paste.""" print(csi + disable_bracketed_paste_seq, end="") --- external/mist/style.mojo --- from external.gojo.strings import StringBuilder from .color import ( Color, NoColor, ANSIColor, ANSI256Color, RGBColor, AnyColor, hex_to_rgb, hex_to_ansi256, ansi256_to_ansi, ) from .profile import get_color_profile, ASCII # Text formatting sequences alias reset = "0" alias bold = "1" alias faint = "2" alias italic = "3" alias underline = "4" alias blink = "5" alias reverse = "7" alias crossout = "9" alias overline = "53" # ANSI Operations alias escape = chr(27) # Escape character alias bel = "\a" # Bell alias csi = escape + "[" # Control Sequence Introducer alias osc = escape + "]" # Operating System Command alias st = escape + chr(92) # String Terminator - Might not work, haven't tried. 92 should be a raw backslash # clear terminal and return cursor to top left alias clear = escape + "[2J" + escape + "[H" @value struct Style: """Style stores a list of styles to format text with. These styles are ANSI sequences which modify text (and control the terminal). In reality, these styles are turning visual terminal features on and off around the text it's styling. This struct should be considered immutable and each style added returns a new instance of itself rather than modifying the struct in place. It's recommended to use `new_style()` function to create a new instance of Style so that you can chain style methods together. Example: ```mojo import mist var style = mist.new_style().foreground(0xE88388) print(style.render("Hello World")) ``` """ var styles: List[String] var profile: Profile fn __init__(inout self, profile: Profile, *, styles: List[String] = List[String]()): """Constructs a Style. Use new_style() instead of __init__ to chain function calls. Args: profile: The color profile to use for color conversion. styles: A list of ANSI styles to apply to the text. """ self.styles = styles self.profile = profile fn __init__(inout self, *, styles: List[String] = List[String]()): """Constructs a Style. Use new_style() instead of __init__ to chain function calls. Args: styles: A list of ANSI styles to apply to the text. """ self.styles = styles self.profile = Profile() fn _add_style(self, style: String) -> Self: """Creates a deepcopy of Self, adds a style to it's list of styles, and returns that. Immutability instead of mutating the object. Args: style: The ANSI style to add to the list of styles. """ var new = self new.styles.append(style) return new fn get_styles(self) -> List[String]: """Return a deepcopy of the styles list.""" return List[String](self.styles) fn bold(self) -> Self: """Makes the text bold when rendered.""" return self._add_style(bold) fn faint(self) -> Self: """Makes the text faint when rendered.""" return self._add_style(faint) fn italic(self) -> Self: """Makes the text italic when rendered.""" return self._add_style(italic) fn underline(self) -> Self: """Makes the text underlined when rendered.""" return self._add_style(underline) fn blink(self) -> Self: """Makes the text blink when rendered.""" return self._add_style(blink) fn reverse(self) -> Self: """Makes the text have reversed background and foreground colors when rendered.""" return self._add_style(reverse) fn crossout(self) -> Self: """Makes the text crossed out when rendered.""" return self._add_style(crossout) fn overline(self) -> Self: """Makes the text overlined when rendered.""" return self._add_style(overline) fn background(self, *, color: AnyColor) -> Self: """Set the background color of the text when it's rendered. Args: color: The color value to set the background to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new Style with the background color set. """ if color.isa[NoColor](): return Self(self.profile, styles=self.styles) var sequence: String = "" if color.isa[ANSIColor](): var c = color[ANSIColor] sequence = c.sequence(True) elif color.isa[ANSI256Color](): var c = color[ANSI256Color] sequence = c.sequence(True) elif color.isa[RGBColor](): var c = color[RGBColor] sequence = c.sequence(True) return self._add_style(sequence) fn background(self, color_value: UInt32) -> Self: """Shorthand for using the style profile to set the background color of the text. Args: color_value: The color value to set the background to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new Style with the background color set. """ return self.background(color=self.profile.color(color_value)) fn foreground(self, *, color: AnyColor) -> Self: """Set the foreground color of the text. Args: color: The color value to set the foreground to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new Style with the foreground color set. """ if color.isa[NoColor](): return Self(self.profile, styles=self.styles) var sequence: String = "" if color.isa[ANSIColor](): sequence = color[ANSIColor].sequence(False) elif color.isa[ANSI256Color](): sequence = color[ANSI256Color].sequence(False) elif color.isa[RGBColor](): sequence = color[RGBColor].sequence(False) return self._add_style(sequence) fn foreground(self, color_value: UInt32) -> Self: """Shorthand for using the style profile to set the foreground color of the text. Args: color_value: The color value to set the foreground to. This can be a hex value, an ANSI color, or an RGB color. Returns: A new Style with the foreground color set. """ return self.foreground(color=self.profile.color(color_value)) fn render(self, text: String) -> String: """Renders text with the styles applied to it. Args: text: The text to render with the styles applied. Returns: The text with the styles applied. """ if self.profile.value == ASCII: return text if len(self.styles) == 0: return text var builder = StringBuilder() _ = builder.write_string(csi) for i in range(len(self.styles)): _ = builder.write_string(";") _ = builder.write_string(self.styles[i]) _ = builder.write_string("m") _ = builder.write_string(text) _ = builder.write_string(csi) _ = builder.write_string(reset) _ = builder.write_string("m") return builder.render() fn new_style(profile: Optional[Int] = None) -> Style: """Creates a new Style with no styles applied. Args: profile: The color profile to use for color conversion. Returns: A new Style with the given color profile. """ if profile: return Style(profile.value()[]) return Style() --- external/weave/__init__.mojo --- from ._dedent import dedent from ._indent import indent from ._margin import margin from ._padding import padding from ._truncate import truncate, truncate_with_tail from ._wrap import wrap from ._wordwrap import wordwrap alias SPACE = String(" ") alias TAB_BYTE = ord("\t") alias SPACE_BYTE = ord(" ") alias NEWLINE_BYTE = ord("\n") --- external/weave/_dedent.mojo --- from external.gojo.bytes import buffer fn dedent(text: String) -> String: """Automatically detects the maximum indentation shared by all lines and trims them accordingly. Args: text: The string to dedent. Returns: The dedented string. Example Usage: ```mojo from weave import dedent fn main() -> None: var text = dedent(" Hello, World!\\n This is a test.\\n \\n") print(text) ``` . """ var indent = min_indent(text.as_bytes_slice()) if indent == 0: return text return apply_dedent(text.as_bytes_slice(), indent) fn min_indent(bytes: Span[UInt8]) -> Int: """Detects the indentation level shared by all lines. Args: bytes: The text to dedent as as bytes slice. Returns: The minimum indentation level. """ var cur_indent = 0 var min_indent = 0 var should_append = True var i = 0 while i < len(bytes): if bytes[i] == TAB_BYTE or bytes[i] == SPACE_BYTE: if should_append: cur_indent += 1 elif bytes[i] == NEWLINE_BYTE: cur_indent = 0 should_append = True else: if cur_indent > 0 and (min_indent == 0 or cur_indent < min_indent): min_indent = cur_indent cur_indent = 0 should_append = False i += 1 return min_indent fn apply_dedent(bytes: Span[UInt8], indent: Int) -> String: """Dedents a string by removing the shared indentation level. Args: bytes: The text to dedent as as bytes slice. indent: The number of spaces to remove from the beginning of each line. Returns: A new dedented string. """ var omitted: Int = 0 var buf = buffer.new_buffer() var i: Int = 0 while i < len(bytes): if bytes[i] == TAB_BYTE or bytes[i] == SPACE_BYTE: if omitted < indent: omitted += 1 else: _ = buf.write_byte(bytes[i]) elif bytes[i] == NEWLINE_BYTE: omitted = 0 _ = buf.write_byte(bytes[i]) else: _ = buf.write_byte(bytes[i]) i += 1 return str(buf) --- external/weave/_indent.mojo --- from external.gojo.bytes import buffer from external.gojo.unicode import UnicodeString import .ansi struct Writer(Stringable, Movable): """A writer that indents content by a given number of spaces. Example Usage: ```mojo from weave import _indent as indent fn main(): var writer = indent.Writer(4) _ = writer.write("Hello, World!".as_bytes_slice()) print(String(writer.as_string_slice())) ``` """ var indent: UInt8 """The number of spaces to indent each line.""" var ansi_writer: ansi.Writer """The ANSI aware writer that stores the text content.""" var skip_indent: Bool """Whether to skip the indentation for the next line.""" var in_ansi: Bool """Whether the current character is part of an ANSI escape sequence.""" fn __init__(inout self, indent: UInt8): """Initializes a new indent-writer instance. Args: indent: The number of spaces to indent each line. """ self.indent = indent self.ansi_writer = ansi.Writer() self.skip_indent = False self.in_ansi = False fn __moveinit__(inout self, owned other: Self): self.indent = other.indent self.ansi_writer = other.ansi_writer^ self.skip_indent = other.skip_indent self.in_ansi = other.in_ansi fn __str__(self) -> String: return str(self.ansi_writer.forward) fn as_bytes(self) -> List[UInt8]: """Returns the indented result as a byte list.""" return self.ansi_writer.forward.bytes() fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the indented result as a byte slice.""" return self[].ansi_writer.forward.as_bytes_slice() fn as_string_slice(self: Reference[Self]) -> StringSlice[self.is_mutable, self.lifetime]: """Returns the indented result as a string slice.""" return StringSlice(unsafe_from_utf8=self[].ansi_writer.forward.as_bytes_slice()) fn write(inout self, src: Span[UInt8]) -> (Int, Error): """Writes the given byte slice to the writer. Args: src: The byte slice to write. Returns: The number of bytes written and optional error. """ var err = Error() for rune in UnicodeString(src): var char = String(rune) if char == ansi.Marker: # ANSI escape sequence self.in_ansi = True elif self.in_ansi: if ansi.is_terminator(ord(char)): # ANSI sequence terminated self.in_ansi = False else: if not self.skip_indent: self.ansi_writer.reset_ansi() var bytes_written = 0 bytes_written, err = self.ansi_writer.write((SPACE * int(self.indent)).as_bytes_slice()) if err: return bytes_written, err self.skip_indent = True self.ansi_writer.restore_ansi() if char == "\n": # end of current line self.skip_indent = False var bytes_written = 0 bytes_written, err = self.ansi_writer.write(char.as_bytes_slice()) if err: return bytes_written, err return len(src), err fn apply_indent_to_bytes(span: Span[UInt8], indent: UInt8) -> List[UInt8]: """Shorthand for declaring a new default indent-writer instance, used to immediately indent a byte slice. Returns a NEW list of bytes. Args: span: The byte slice to indent. indent: The number of spaces to indent. Returns: A new indented list of bytes. """ var writer = Writer(indent) _ = writer.write(span) return writer.as_bytes() fn indent(text: String, indent: UInt8) -> String: """Shorthand for declaring a new default indent-writer instance, used to immediately indent a string. Args: text: The string to indent. indent: The number of spaces to indent. Returns: A new indented string. Example Usage: ```mojo from weave import indent fn main(): var indented = indent("Hello, World!", 4) print(indented) ``` . """ var writer = Writer(indent) _ = writer.write(text.as_bytes_slice()) return String(writer.as_string_slice()) --- external/weave/_margin.mojo --- from external.gojo.bytes import buffer import . _padding as padding import . _indent as indent struct Writer(Stringable, Movable): """A margin writer that applies a margin to the content. Example Usage: ```mojo from weave import _margin as margin fn main(): var writer = margin.Writer(5, 2) _ = writer.write("Hello, World!".as_bytes_slice()) _ = writer.close() print(String(writer.as_string_slice())) ``` . """ var buf: buffer.Buffer var pw: padding.Writer var iw: indent.Writer fn __init__(inout self, owned pw: padding.Writer, owned iw: indent.Writer): """Initializes a new margin-writer instance. Args: pw: The padding-writer instance. iw: The indent-writer instance. """ self.buf = buffer.new_buffer() self.pw = pw^ self.iw = iw^ fn __init__(inout self, pad: Int, indentation: Int): """Initializes a new margin-writer instance. Args: pad: Width of the padding of the padding-writer instance. indentation: Width of the indentation of the padding-writer instance. """ self.buf = buffer.new_buffer() self.pw = padding.Writer(pad) self.iw = indent.Writer(indentation) fn __moveinit__(inout self, owned other: Self): self.buf = other.buf^ self.pw = other.pw^ self.iw = other.iw^ fn __str__(self) -> String: return str(self.buf) fn as_bytes(self) -> List[UInt8]: """Returns the wrapped result as a byte list.""" return self.buf.bytes() fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the wrapped result as a byte slice.""" return self[].buf.as_bytes_slice() fn as_string_slice(self: Reference[Self]) -> StringSlice[self.is_mutable, self.lifetime]: """Returns the wrapped result as a string slice.""" return StringSlice(unsafe_from_utf8=self[].buf.as_bytes_slice()) fn write(inout self, src: Span[UInt8]) -> (Int, Error): """Writes the given byte slice to the writer. Args: src: The byte slice to write. Returns: The number of bytes written and optional error. """ var bytes_written = 0 var err = Error() bytes_written, err = self.iw.write(src) if err: return bytes_written, err return self.pw.write(self.iw.as_bytes_slice()) fn close(inout self): """Will finish the margin operation. Always call it before trying to retrieve the final result.""" _ = self.pw.close() _ = self.buf.write(self.pw.as_bytes_slice()) fn apply_margin_to_bytes(span: Span[UInt8], width: UInt8, margin: UInt8) -> List[UInt8]: """Shorthand for declaring a new default margin-writer instance, used to immediately apply a margin to a byte slice. Args: span: The byte slice to apply the margin to. width: The width of the margin. margin: The margin to apply. Returns: A new margin applied list of bytes. """ var writer = Writer(width, margin) _ = writer.write(span) _ = writer.close() return writer.as_bytes() fn margin(text: String, width: UInt8, margin: UInt8) -> String: """Shorthand for declaring a new default margin-writer instance, used to immediately apply a margin to a String. Args: text: The byte slice to apply the margin to. width: The width of the margin. margin: The margin to apply. Returns: A new margin applied string. """ var writer = Writer(width, margin) _ = writer.write(text.as_bytes_slice()) _ = writer.close() return String(writer.as_string_slice()) --- external/weave/_padding.mojo --- from external.gojo.bytes import buffer from external.gojo.unicode import UnicodeString, string_width import .ansi struct Writer(Stringable, Movable): """A padding writer that pads content to the given printable cell width. Example Usage: ```mojo from weave import _padding as padding fn main(): var writer = padding.Writer(4) _ = writer.write("Hello, World!".as_bytes_slice()) writer.flush() print(String(writer.as_string_slice())) ``` """ var padding: UInt8 """Padding width to apply to each line.""" var ansi_writer: ansi.Writer """The ANSI aware writer that stores intermediary text content.""" var cache: buffer.Buffer """The buffer that stores the padded content after it's been flushed.""" var line_len: Int """The current line length.""" var in_ansi: Bool """Whether the current character is part of an ANSI escape sequence.""" fn __init__( inout self, padding: UInt8, line_len: Int = 0, in_ansi: Bool = False, ): """Initializes a new padding-writer instance. Args: padding: The padding width. line_len: The current line length. in_ansi: Whether the current character is part of an ANSI escape sequence. """ self.padding = padding self.line_len = line_len self.in_ansi = in_ansi self.cache = buffer.new_buffer() self.ansi_writer = ansi.Writer() fn __moveinit__(inout self, owned other: Self): self.padding = other.padding self.ansi_writer = other.ansi_writer^ self.cache = other.cache^ self.line_len = other.line_len self.in_ansi = other.in_ansi fn __str__(self) -> String: return str(self.cache) fn as_bytes(self) -> List[UInt8]: """Returns the padded result as a byte list.""" return self.cache.bytes() fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the padded result as a byte slice.""" return self[].cache.as_bytes_slice() fn as_string_slice(self: Reference[Self]) -> StringSlice[self.is_mutable, self.lifetime]: """Returns the padded result as a string slice.""" return StringSlice(unsafe_from_utf8=self[].cache.as_bytes_slice()) fn write(inout self, src: Span[UInt8]) -> (Int, Error): """Pads content to the given printable cell width. Args: src: The content to write. Returns: The number of bytes written and optional error. """ var err = Error() for rune in UnicodeString(src): var char = String(rune) if char == ansi.Marker: self.in_ansi = True elif self.in_ansi: if ansi.is_terminator(ord(char)): self.in_ansi = False else: if char == "\n": # end of current line, if pad right then add padding before newline self.pad() self.ansi_writer.reset_ansi() self.line_len = 0 else: self.line_len += string_width(char) var bytes_written = 0 bytes_written, err = self.ansi_writer.write(char.as_bytes_slice()) if err: return bytes_written, err return len(src), err fn pad(inout self): """Pads the current line with spaces to the given width.""" if self.padding > 0 and UInt8(self.line_len) < self.padding: var padding = SPACE * (int(self.padding) - self.line_len) _ = self.ansi_writer.write(padding.as_bytes_slice()) fn close(inout self): """Finishes the padding operation.""" return self.flush() fn flush(inout self): """Finishes the padding operation. Always call it before trying to retrieve the final result.""" if self.line_len != 0: self.pad() self.cache.reset() _ = self.ansi_writer.forward.write_to(self.cache) self.line_len = 0 self.in_ansi = False fn apply_padding_to_bytes(bytes: Span[UInt8], width: UInt8) -> List[UInt8]: """Pads a byte slice to the given printable cell width. Args: bytes: The byte slice to pad. width: The padding width. Returns: A new padded list of bytes. """ var writer = Writer(width) _ = writer.write(bytes) _ = writer.flush() return writer.as_bytes() fn padding(text: String, width: UInt8) -> String: """Shorthand for declaring a new default padding-writer instance, used to immediately pad a string. Args: text: The string to pad. width: The padding width. Returns: A new padded string. Example Usage: ```mojo from weave import padding fn main(): var padded = padding("Hello, World!", 5) print(padded) ``` . """ var writer = Writer(width) _ = writer.write(text.as_bytes_slice()) _ = writer.flush() return String(writer.as_string_slice()) --- external/weave/_truncate.mojo --- from external.gojo.bytes import buffer from external.gojo.unicode import UnicodeString, rune_width import .ansi struct Writer(Stringable, Movable): """A truncating writer that truncates content at the given printable cell width. Example Usage: ```mojo from weave import _truncate as truncate fn main(): var writer = truncate.Writer(4, tail=".") _ = writer.write("Hello, World!".as_bytes_slice()) print(String(writer.as_string_slice())) ``` . """ var width: UInt8 """The maximum printable cell width.""" var tail: String """The tail to append to the truncated content.""" var ansi_writer: ansi.Writer """The ANSI aware writer that stores the text content.""" var in_ansi: Bool """Whether the current character is part of an ANSI escape sequence.""" fn __init__(inout self, width: UInt8, tail: String, in_ansi: Bool = False): """Initializes a new truncate-writer instance. Args: width: The maximum printable cell width. tail: The tail to append to the truncated content. in_ansi: Whether the current character is part of an ANSI escape sequence. """ self.width = width self.tail = tail self.in_ansi = in_ansi self.ansi_writer = ansi.Writer() fn __moveinit__(inout self, owned other: Self): self.width = other.width self.tail = other.tail self.ansi_writer = other.ansi_writer^ self.in_ansi = other.in_ansi fn __str__(self) -> String: return str(self.ansi_writer.forward) fn as_bytes(self) -> List[UInt8]: """Returns the truncated result as a byte list.""" return self.ansi_writer.forward.bytes() fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the truncated result as a byte slice.""" return self[].ansi_writer.forward.as_bytes_slice() fn as_string_slice(self: Reference[Self]) -> StringSlice[self.is_mutable, self.lifetime]: """Returns the truncated result as a string slice.""" return StringSlice(unsafe_from_utf8=self[].ansi_writer.forward.as_bytes_slice()) fn write(inout self, src: Span[UInt8]) -> (Int, Error): """Truncates content at the given printable cell width, leaving any ANSI sequences intact. Args: src: The content to write. Returns: The number of bytes written and optional error. """ var tw = ansi.printable_rune_width(self.tail) if self.width < UInt8(tw): return self.ansi_writer.forward._write(self.tail.as_bytes_slice()) self.width -= UInt8(tw) var cur_width: UInt8 = 0 for rune in UnicodeString(src): var char = String(rune) if char == ansi.Marker: # ANSI escape sequence self.in_ansi = True elif self.in_ansi: if ansi.is_terminator(ord(char)): # ANSI sequence terminated self.in_ansi = False else: cur_width += UInt8(rune_width(ord(char))) if cur_width > self.width: var n = self.ansi_writer.forward.write_string(self.tail) if self.ansi_writer.last_sequence() != "": self.ansi_writer.reset_ansi() return n^ _ = self.ansi_writer.write(char.as_bytes_slice()) return len(src), Error() fn apply_truncate_to_bytes(span: Span[UInt8], width: UInt8) -> List[UInt8]: """Truncates a byte slice at the given printable cell width. Args: span: The byte slice to truncate. width: The maximum printable cell width. Returns: A new truncated byte slice. """ return apply_truncate_to_bytes_with_tail(span, width, "") fn apply_truncate_to_bytes_with_tail(span: Span[UInt8], width: UInt8, tail: String) -> List[UInt8]: """Shorthand for declaring a new default truncate-writer instance, used to immediately truncate a byte slice. A tail is then added to the end of the byte slice. Args: span: The byte slice to truncate. width: The maximum printable cell width. tail: The tail to append to the truncated content. Returns: A new truncated byte slice. """ var writer = Writer(width, str(tail)) _ = writer.write(span) return writer.as_bytes() fn truncate(text: String, width: UInt8) -> String: """Shorthand for declaring a new default truncate-writer instance, used to immediately truncate a String. Args: text: The string to truncate. width: The maximum printable cell width. Returns: A new truncated string. ```mojo from weave import truncate fn main(): var truncated = truncate("Hello, World!", 5) print(truncated) ``` . """ return truncate_with_tail(text, width, "") fn truncate_with_tail(text: String, width: UInt8, tail: String) -> String: """Shorthand for declaring a new default truncate-writer instance, used to immediately truncate a String. A tail is then added to the end of the string. Args: text: The string to truncate. width: The maximum printable cell width. tail: The tail to append to the truncated content. Returns: A new truncated string. ```mojo from weave import truncate_with_tail fn main(): var truncated = truncate_with_tail("Hello, World!", 5, ".") print(truncated) ``` . """ var writer = Writer(width, str(tail)) _ = writer.write(text.as_bytes_slice()) return String(writer.as_string_slice()) --- external/weave/_wordwrap.mojo --- from external.gojo.bytes import buffer from external.gojo.unicode import UnicodeString import .ansi alias DEFAULT_NEWLINE = "\n" alias DEFAULT_TAB_WIDTH = 4 alias DEFAULT_BREAKPOINT = "-" struct Writer(Stringable, Movable): """A word-wrapping writer that wraps content based on words at the given limit. Example Usage: ```mojo from weave import _wordwrap as wordwrap fn main(): var writer = wordwrap.Writer(5) _ = writer.write("Hello, World!".as_bytes_slice()) _ = writer.close() print(String(writer.as_string_slice())) ``` . """ var limit: Int """The maximum number of characters per line.""" var breakpoint: String """The character to use as a breakpoint.""" var newline: String """The character to use as a newline.""" var keep_newlines: Bool """Whether to keep newlines in the content.""" var buf: buffer.Buffer """The buffer that stores the word-wrapped content.""" var space: buffer.Buffer """The buffer that stores the space between words.""" var word: buffer.Buffer """The buffer that stores the current word.""" var line_len: Int """The current line length.""" var ansi: Bool """Whether the current character is part of an ANSI escape sequence.""" fn __init__( inout self, limit: Int, breakpoint: String = DEFAULT_BREAKPOINT, newline: String = DEFAULT_NEWLINE, keep_newlines: Bool = True, line_len: Int = 0, ansi: Bool = False, ): """Initializes a new word-wrap writer instance. Args: limit: The maximum number of characters per line. breakpoint: The character to use as a breakpoint. newline: The character to use as a newline. keep_newlines: Whether to keep newlines in the content. line_len: The current line length. ansi: Whether the current character is part of an ANSI escape sequence. """ self.limit = limit self.breakpoint = breakpoint self.newline = newline self.keep_newlines = keep_newlines self.buf = buffer.new_buffer() self.space = buffer.new_buffer() self.word = buffer.new_buffer() self.line_len = line_len self.ansi = ansi fn __moveinit__(inout self, owned other: Self): self.limit = other.limit self.breakpoint = other.breakpoint self.newline = other.newline self.keep_newlines = other.keep_newlines self.buf = other.buf^ self.space = other.space^ self.word = other.word^ self.line_len = other.line_len self.ansi = other.ansi fn __str__(self) -> String: return str(self.buf) fn as_bytes(self) -> List[UInt8]: """Returns the word wrapped result as a byte list.""" return self.buf.bytes() fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the word wrapped result as a byte slice.""" return self[].buf.as_bytes_slice() fn as_string_slice(self: Reference[Self]) -> StringSlice[self.is_mutable, self.lifetime]: """Returns the word wrapped result as a string slice.""" return StringSlice(unsafe_from_utf8=self[].buf.as_bytes_slice()) fn add_space(inout self): """Write the content of the space buffer to the word-wrap buffer.""" self.line_len += len(self.space) _ = self.buf.write(self.space.bytes()) self.space.reset() fn add_word(inout self): """Write the content of the word buffer to the word-wrap buffer.""" if len(self.word) > 0: self.add_space() self.line_len += ansi.printable_rune_width(str(self.word)) _ = self.buf.write(self.word.bytes()) self.word.reset() fn add_newline(inout self): """Write a newline to the word-wrap buffer and reset the line length & space buffer.""" _ = self.buf.write_byte(NEWLINE_BYTE) self.line_len = 0 self.space.reset() fn write(inout self, src: Span[UInt8]) -> (Int, Error): """Write more content to the word-wrap buffer. Args: src: The content to write. Returns: The number of bytes written. and optional error. """ if self.limit == 0: return self.buf._write(src) var buf = List[UInt8](src) buf.append(0) var s = String(buf^) if not self.keep_newlines: s = s.strip() s = s.replace("\n", " ") for rune in UnicodeString(s): var char = String(rune) if char == ansi.Marker: # ANSI escape sequence _ = self.word._write(char.as_bytes_slice()) self.ansi = True elif self.ansi: _ = self.word._write(char.as_bytes_slice()) if ansi.is_terminator(ord(char)): # ANSI sequence terminated self.ansi = False elif char == self.newline: # end of current line # see if we can add the content of the space buffer to the current line if len(self.word) == 0: if self.line_len + len(self.space) > self.limit: self.line_len = 0 else: # preserve whitespace _ = self.buf._write(self.space.as_bytes_slice()) self.space.reset() self.add_word() self.add_newline() elif char == " ": # end of current word self.add_word() _ = self.space._write(char.as_bytes_slice()) elif char == self.breakpoint: # valid breakpoint self.add_space() self.add_word() _ = self.buf._write(char.as_bytes_slice()) else: # any other character _ = self.word._write(char.as_bytes_slice()) # add a line break if the current word would exceed the line's # character limit if ( self.line_len + len(self.space) + ansi.printable_rune_width(str(self.word)) > self.limit and ansi.printable_rune_width(str(self.word)) < self.limit ): self.add_newline() return len(src), Error() fn close(inout self): """Finishes the word-wrap operation. Always call it before trying to retrieve the final result.""" self.add_word() fn apply_wordwrap_to_bytes(span: Span[UInt8], limit: Int) -> List[UInt8]: """Shorthand for declaring a new default WordWrap instance, used to immediately word-wrap a byte slice. Args: span: The byte slice to word-wrap. limit: The maximum number of characters per line. Returns: A new word-wrapped byte slice. """ var writer = Writer(limit) _ = writer.write(span) _ = writer.close() return writer.as_bytes() fn wordwrap(text: String, limit: Int) -> String: """Shorthand for declaring a new default WordWrap instance, used to immediately wrap a string. Args: text: The string to wrap. limit: The maximum number of characters per line. Returns: A new word-wrapped string. ```mojo from weave import wordwrap fn main(): var wrapped = wordwrap("Hello, World!", 5) print(wrapped) ``` . """ var writer = Writer(limit) _ = writer.write(text.as_bytes_slice()) _ = writer.close() return String(writer.as_string_slice()) --- external/weave/_wrap.mojo --- from external.gojo.bytes import buffer from external.gojo.unicode import UnicodeString, rune_width import .ansi alias DEFAULT_NEWLINE = "\n" alias DEFAULT_TAB_WIDTH = 4 struct Writer(Stringable, Movable): """A line-wrapping writer that wraps content based on the given limit. Example Usage: ```mojo from weave import _wrap as wrap fn main(): var writer = wrap.Writer(5) _ = writer.write("Hello, World!".as_bytes_slice()) print(String(writer.as_string_slice())) ``` """ var limit: Int """The maximum number of characters per line.""" var newline: String """The character to use as a newline.""" var keep_newlines: Bool """Whether to keep newlines in the content.""" var preserve_space: Bool """Whether to preserve space characters.""" var tab_width: Int """The width of a tab character.""" var buf: buffer.Buffer """The buffer that stores the wrapped content.""" var line_len: Int """The current line length.""" var ansi: Bool """Whether the current character is part of an ANSI escape sequence.""" var forceful_newline: Bool """Whether to force a newline at the end of the line.""" fn __init__( inout self, limit: Int, newline: String = DEFAULT_NEWLINE, keep_newlines: Bool = True, preserve_space: Bool = False, tab_width: Int = DEFAULT_TAB_WIDTH, line_len: Int = 0, ansi: Bool = False, forceful_newline: Bool = False, ): """Initializes a new line-wrap writer instance. Args: limit: The maximum number of characters per line. newline: The character to use as a newline. keep_newlines: Whether to keep newlines in the content. preserve_space: Whether to preserve space characters. tab_width: The width of a tab character. line_len: The current line length. ansi: Whether the current character is part of an ANSI escape sequence. forceful_newline: Whether to force a newline at the end of the line. """ self.limit = limit self.newline = newline self.keep_newlines = keep_newlines self.preserve_space = preserve_space self.tab_width = tab_width self.buf = buffer.new_buffer() self.line_len = line_len self.ansi = ansi self.forceful_newline = forceful_newline fn __moveinit__(inout self, owned other: Self): self.limit = other.limit self.newline = other.newline self.keep_newlines = other.keep_newlines self.preserve_space = other.preserve_space self.tab_width = other.tab_width self.buf = other.buf^ self.line_len = other.line_len self.ansi = other.ansi self.forceful_newline = other.forceful_newline fn __str__(self) -> String: return str(self.buf) fn as_bytes(self) -> List[UInt8]: """Returns the wrapped result as a byte list.""" return self.buf.bytes() fn as_bytes_slice(self: Reference[Self]) -> Span[UInt8, self.is_mutable, self.lifetime]: """Returns the wrapped result as a byte slice.""" return self[].buf.as_bytes_slice() fn as_string_slice(self: Reference[Self]) -> StringSlice[self.is_mutable, self.lifetime]: """Returns the wrapped result as a string slice.""" return StringSlice(unsafe_from_utf8=self[].buf.as_bytes_slice()) fn add_newline(inout self): """Adds a newline to the buffer and resets the line length.""" _ = self.buf.write_byte(ord(self.newline)) self.line_len = 0 fn write(inout self, src: Span[UInt8]) -> (Int, Error): """Writes the given byte slice to the buffer, wrapping lines as needed. Args: src: The byte slice to write to the buffer. Returns: The number of bytes written to the buffer and optional error. """ var tab_space = SPACE * self.tab_width var s = String(src) s = s.replace("\t", tab_space) if not self.keep_newlines: s = s.replace("\n", "") var width = ansi.printable_rune_width(s) if self.limit <= 0 or self.line_len + width <= self.limit: self.line_len += width return self.buf._write(src) for rune in UnicodeString(src): var char = String(rune) if char == ansi.Marker: self.ansi = True elif self.ansi: if ansi.is_terminator(ord(char)): self.ansi = False elif char == "\n": self.add_newline() self.forceful_newline = False continue else: var width = rune_width(ord(char)) if self.line_len + width > self.limit: self.add_newline() self.forceful_newline = True if self.line_len == 0: if self.forceful_newline and not self.preserve_space and char == " ": continue else: self.forceful_newline = False self.line_len += width _ = self.buf._write(char.as_bytes_slice()) return len(src), Error() fn apply_wrap_to_bytes(span: Span[UInt8], limit: Int) -> List[UInt8]: """Shorthand for declaring a new default Wrap instance, used to immediately wrap a byte slice. Args: span: The byte slice to wrap. limit: The maximum line length before wrapping. Returns: A new wrapped byte slice. """ var writer = Writer(limit) _ = writer.write(span) return writer.as_bytes() fn wrap(text: String, limit: Int) -> String: """Shorthand for declaring a new default Wrap instance, used to immediately wrap a string. Args: text: The string to wrap. limit: The maximum line length before wrapping. Returns: A new wrapped string. ```mojo from weave import wrap fn main(): var wrapped = wrap("Hello, World!", 5) print(wrapped) ``` . """ var writer = Writer(limit) _ = writer.write(text.as_bytes_slice()) return String(writer.as_string_slice()) --- external/weave/ansi/__init__.mojo --- from .ansi import printable_rune_width, is_terminator from .writer import Writer, Marker --- external/weave/ansi/ansi.mojo --- from external.gojo.unicode import UnicodeString, rune_width alias Marker = "\x1B" fn is_terminator(c: Int) -> Bool: return (c >= 0x40 and c <= 0x5A) or (c >= 0x61 and c <= 0x7A) fn printable_rune_width(text: String) -> Int: """Returns the cell width of the given string. Args: text: String to calculate the width of. Returns: The printable cell width of the string. """ var length: Int = 0 var ansi: Bool = False for rune in UnicodeString(text): var char = ord(rune) if char == ord(Marker): # ANSI escape sequence ansi = True elif ansi: if is_terminator(char): # ANSI sequence terminated ansi = False else: length += rune_width(char) return length --- external/weave/ansi/writer.mojo --- from external.gojo.bytes import buffer from external.gojo.builtins.bytes import has_suffix from external.gojo.unicode import UnicodeString from .ansi import Marker, is_terminator alias ANSI_ESCAPE = String("[0m").as_bytes() alias ANSI_RESET = String("\x1b[0m").as_bytes() struct Writer: """A writer that handles ANSI escape sequences in the content. Example Usage: ```mojo from weave import ansi fn main(): var writer = ansi.Writer() _ = writer.write("Hello, World!".as_bytes_slice()) print(str(writer.forward)) ``` . """ var forward: buffer.Buffer """The buffer that stores the text content.""" var ansi: Bool """Whether the current character is part of an ANSI escape sequence.""" var ansi_seq: buffer.Buffer """The buffer that stores the ANSI escape sequence.""" var last_seq: buffer.Buffer """The buffer that stores the last ANSI escape sequence.""" var seq_changed: Bool """Whether the ANSI escape sequence has changed.""" fn __init__(inout self, owned forward: buffer.Buffer = buffer.new_buffer()): """Initializes a new ANSI-writer instance. Args: forward: The buffer that stores the text content. """ self.forward = forward^ self.ansi = False self.ansi_seq = buffer.new_buffer(128) self.last_seq = buffer.new_buffer(128) self.seq_changed = False fn __moveinit__(inout self, owned other: Writer): self.forward = other.forward^ self.ansi = other.ansi self.ansi_seq = other.ansi_seq^ self.last_seq = other.last_seq^ self.seq_changed = other.seq_changed fn write(inout self, src: Span[UInt8]) -> (Int, Error): """Write content to the ANSI buffer. Args: src: The content to write. Returns: The number of bytes written and optional error. """ for rune in UnicodeString(src): var char = String(rune) if char == Marker: # ANSI escape sequence self.ansi = True self.seq_changed = True _ = self.ansi_seq._write(char.as_bytes_slice()) elif self.ansi: _ = self.ansi_seq._write(char.as_bytes_slice()) if is_terminator(ord(char)): self.ansi = False if has_suffix(self.ansi_seq.bytes(), ANSI_ESCAPE): # reset sequence self.last_seq.reset() self.seq_changed = False elif char == "m": # color code _ = self.last_seq._write(self.ansi_seq.as_bytes_slice()) _ = self.ansi_seq.write_to(self.forward) else: _ = self.forward._write(char.as_bytes_slice()) return len(src), Error() fn write_byte(inout self, byte: UInt8) -> Int: """Write a byte to the ANSI buffer. Args: byte: The byte to write. Returns: The number of bytes written. """ _ = self.forward.write_byte(byte) return 1 fn last_sequence(self) -> String: """Returns the last ANSI escape sequence.""" return str(self.last_seq) fn reset_ansi(inout self): """Resets the ANSI escape sequence.""" if not self.seq_changed: return var b = List[UInt8](capacity=512) for i in range(len(ANSI_RESET)): b[i] = ANSI_RESET[i] _ = self.forward.write(b) fn restore_ansi(inout self): """Restores the last ANSI escape sequence.""" _ = self.forward._write(self.last_seq.as_bytes_slice()) --- mog/__init__.mojo --- from .style import Style, NO_TAB_CONVERSION, get_lines from .border import ( Border, ROUNDED_BORDER, DOUBLE_BORDER, ASCII_BORDER, STAR_BORDER, PLUS_BORDER, BLOCK_BORDER, OUTER_HALF_BLOCK_BORDER, INNER_HALF_BLOCK_BORDER, THICK_BORDER, HIDDEN_BORDER, NO_BORDER, ) from .table import Table, default_styles, StringData, new_table, Data, Filter from .position import top, bottom, center, left, right from .size import get_height, get_width, get_size from .color import ( NoColor, Color, ANSIColor, AdaptiveColor, CompleteColor, CompleteAdaptiveColor, AnyTerminalColor, ) alias WHITESPACE = String(" ") alias NEWLINE = String("\n") --- mog/align.mojo --- from external.weave.ansi.ansi import printable_rune_width import external.mist from external.gojo.strings import StringBuilder import .position from .extensions import split fn align_text_horizontal( text: String, pos: position.Position, width: Int, style: Optional[mist.Style] = None ) -> String: """Perform text alignment. If the string is multi-lined, we also make all lines the same width by padding them with spaces. If a termenv style is passed, use that to style the spaces added. Args: text: The text to align. pos: The position to align the text to. width: The width to align the text to. style: The style to use for the spaces added. Defaults to None. Returns: The aligned text. """ var lines: List[String] var widest_line: Int lines, widest_line = get_lines(text) var aligned_text = StringBuilder(capacity=len(text)) for i in range(len(lines)): var line = lines[i] var line_width = printable_rune_width(line) var short_amount = widest_line - line_width # difference from the widest line short_amount += max(0, width - (short_amount + line_width)) # difference from the total width, if set if short_amount > 0: if pos == position.right: var spaces = WHITESPACE * short_amount # Removed the nil check before rendering the spaces in whatever style for now. if style: spaces = style.value()[].render(spaces) line = spaces + line elif pos == position.center: # Note: remainder goes on the right. var left = short_amount / 2 var right = left + short_amount % 2 var left_spaces = WHITESPACE * int(left) var right_spaces = WHITESPACE * int(right) if style: left_spaces = style.value()[].render(left_spaces) right_spaces = style.value()[].render(right_spaces) line = left_spaces + line + right_spaces elif pos == position.left: var spaces = WHITESPACE * int(short_amount) if style: spaces = style.value()[].render(spaces) line += spaces _ = aligned_text.write_string(line) if i < len(lines) - 1: _ = aligned_text.write_string("\n") return str(aligned_text) fn align_text_vertical(text: String, pos: position.Position, height: Int) -> String: var text_height = text.count("\n") + 1 if height < text_height: return text if pos == position.top: return text + (NEWLINE * (height - text_height)) if pos == position.center: var top_padding = (height - text_height) / 2 var bottom_padding = (height - text_height) / 2 if text_height + top_padding + bottom_padding > height: top_padding -= 1 elif text_height + top_padding + bottom_padding < height: bottom_padding += 1 return (NEWLINE * int(top_padding)) + text + (NEWLINE * int(bottom_padding)) if pos == position.bottom: return (NEWLINE * (height - text_height)) + text return text --- mog/border.mojo --- from external.weave.ansi.ansi import printable_rune_width @value struct Border: var top: String var bottom: String var left: String var right: String var top_left: String var top_right: String var bottom_left: String var bottom_right: String var middle_left: String var middle_right: String var middle: String var middle_top: String var middle_bottom: String fn __init__( inout self, top: String = "", bottom: String = "", left: String = "", right: String = "", top_left: String = "", top_right: String = "", bottom_left: String = "", bottom_right: String = "", middle_left: String = "", middle_right: String = "", middle: String = "", middle_top: String = "", middle_bottom: String = "", ): self.top = top self.bottom = bottom self.left = left self.right = right self.top_left = top_left self.top_right = top_right self.bottom_left = bottom_left self.bottom_right = bottom_right self.middle_left = middle_left self.middle_right = middle_right self.middle = middle self.middle_top = middle_top self.middle_bottom = middle_bottom fn __eq__(self, other: Border) -> Bool: return ( self.top == other.top and self.bottom == other.bottom and self.left == other.left and self.right == other.right and self.top_left == other.top_left and self.top_right == other.top_right and self.bottom_left == other.bottom_left and self.bottom_right == other.bottom_right and self.middle_left == other.middle_left and self.middle_right == other.middle_right and self.middle == other.middle and self.middle_top == other.middle_top and self.middle_bottom == other.middle_bottom ) fn __ne__(self, other: Border) -> Bool: return ( self.top != other.top or self.bottom != other.bottom or self.left != other.left or self.right != other.right or self.top_left != other.top_left or self.top_right != other.top_right or self.bottom_left != other.bottom_left or self.bottom_right != other.bottom_right or self.middle_left != other.middle_left or self.middle_right != other.middle_right or self.middle != other.middle or self.middle_top != other.middle_top or self.middle_bottom != other.middle_bottom ) alias ASCII_BORDER = Border( top="-", bottom="_", left="|", right="|", top_left="*", top_right="*", bottom_left="*", bottom_right="*", middle_left="*", middle_right="*", middle="*", middle_top="*", middle_bottom="*", ) alias STAR_BORDER = Border( top="*", bottom="*", left="*", right="*", top_left="*", top_right="*", bottom_left="*", bottom_right="*", middle_left="*", middle_right="*", middle="*", middle_top="*", middle_bottom="*", ) alias PLUS_BORDER = Border( top="+", bottom="+", left="+", right="+", top_left="+", top_right="+", bottom_left="+", bottom_right="+", middle_left="+", middle_right="+", middle="+", middle_top="+", middle_bottom="+", ) alias NORMAL_BORDER = Border( top="─", bottom="─", left="│", right="│", top_left="┌", top_right="┐", bottom_left="└", bottom_right="┘", middle_left="├", middle_right="┤", middle="┼", middle_top="┬", middle_bottom="┴", ) alias ROUNDED_BORDER = Border( top="─", bottom="─", left="│", right="│", top_left="╭", top_right="╮", bottom_left="╰", bottom_right="╯", middle_left="├", middle_right="┤", middle="┼", middle_top="┬", middle_bottom="┴", ) alias BLOCK_BORDER = Border( top="█", bottom="█", left="█", right="█", top_left="█", top_right="█", bottom_left="█", bottom_right="█", middle_left="█", middle_right="█", middle="█", middle_top="█", ) alias OUTER_HALF_BLOCK_BORDER = Border( top="▀", bottom="▄", left="▌", right="▐", top_left="▛", top_right="▜", bottom_left="▙", bottom_right="▟", ) alias INNER_HALF_BLOCK_BORDER = Border( top="▄", bottom="▀", left="▐", right="▌", top_left="▗", top_right="▖", bottom_left="▝", bottom_right="▘", ) alias THICK_BORDER = Border( top="━", bottom="━", left="┃", right="┃", top_left="┏", top_right="┓", bottom_left="┗", bottom_right="┛", middle_left="┣", middle_right="┫", middle="╋", middle_top="┳", middle_bottom="┻", ) alias DOUBLE_BORDER = Border( top="═", bottom="═", left="║", right="║", top_left="╔", top_right="╗", bottom_left="╚", bottom_right="╝", middle_left="╠", middle_right="╣", middle="╬", middle_top="╦", middle_bottom="╩", ) alias HIDDEN_BORDER = Border( top=" ", bottom=" ", left=" ", right=" ", top_left=" ", top_right=" ", bottom_left=" ", bottom_right=" ", middle_left=" ", middle_right=" ", middle=" ", middle_top=" ", middle_bottom=" ", ) alias NO_BORDER = Border() fn render_horizontal_edge(left: String, middle: String, right: String, width: Int) -> String: """Render the horizontal (top or bottom) portion of a border. Args: left: The left edge of the border. middle: The middle of the border. right: The right edge of the border. width: The width of the border. Returns: The rendered horizontal edge. """ var middle_copy = middle if width < 1: return "" if middle == "": middle_copy = " " var left_width = printable_rune_width(left) var right_width = printable_rune_width(right) var runes = List[String](middle_copy) var output: String = left var i = left_width + right_width var j = 0 while i < width + right_width: output += runes[j] j += 1 if j >= len(runes): j = 0 i += printable_rune_width(runes[j]) output += right return output --- mog/color.mojo --- from utils.variant import Variant from .renderer import Renderer import external.mist trait TerminalColor(CollectionElement): """TerminalColor is a color intended to be rendered in the terminal.""" fn color(self, renderer: Renderer) -> mist.AnyColor: ... alias AnyTerminalColor = Variant[ NoColor, Color, ANSIColor, AdaptiveColor, CompleteColor, CompleteAdaptiveColor, ] @value struct NoColor(TerminalColor): """Used to specify the absence of color styling. When this is active foreground colors will be rendered with the terminal's default text color, and background colors will not be drawn at all. Example usage: ```mojo var style = mog.Style().background(mog.NoColor()) ``` . """ fn color(self, renderer: Renderer) -> mist.AnyColor: return mist.NoColor() @value struct Color(TerminalColor): """Specifies a color by hex or ANSI value. For example. Args: value: The color value to use. This can be an ANSI color value or a hex color value. Example usage: ```mojo var ansi_color = mog.Color(21) var hex_color = mog.Color(0x0000ff) ``` . """ var value: UInt32 fn color(self, renderer: Renderer) -> mist.AnyColor: return renderer.color_profile.color(self.value) @value struct ANSIColor(TerminalColor): """ANSIColor is a color specified by an ANSI color value. It's merely syntactic sugar for the more general Color function. Invalid colors will render as black. Args: value: The color value to use. This is an ANSI color value. Example usage: ```mojo # These two statements are equivalent. var color_a = mog.ANSIColor(21) var color_b = mog.Color(21) ``` """ var value: UInt32 fn color(self, renderer: Renderer) -> mist.AnyColor: return Color(self.value).color(renderer) @value struct AdaptiveColor(TerminalColor): """AdaptiveColor provides color options for light and dark backgrounds. The appropriate color will be returned at runtime based on the darkness of the terminal background color. Args: light: The color to use when the terminal background is light. dark: The color to use when the terminal background is dark. Example usage: ```mojo var color = mog.AdaptiveColor(light=0x0000ff, dark=0x000099) ``` """ var light: UInt32 var dark: UInt32 fn color(self, renderer: Renderer) -> mist.AnyColor: if renderer.has_dark_background(): return Color(self.dark).color(renderer) return Color(self.light).color(renderer) @value struct CompleteColor(TerminalColor): """Specifies exact values for truecolor, ANSI256, and ANSI color profiles. Automatic color degradation will not be performed. Args: true_color: The color to use when the terminal supports true color. ansi256: The color to use when the terminal supports 256 colors. ansi: The color to use when the terminal supports 16 colors. Example usage: ```mojo var color = mog.CompleteColor(true_color=0x0000ff, ansi256=21, ansi=4) ``` . """ var true_color: UInt32 var ansi256: UInt32 var ansi: UInt32 fn color(self, renderer: Renderer) -> mist.AnyColor: var p = renderer.color_profile if p.value == mist.TRUE_COLOR: return Color(self.true_color).color(renderer) elif p.value == mist.ANSI256: return Color(self.ansi256).color(renderer) elif p.value == mist.ANSI: return Color(self.ansi).color(renderer) else: return mist.NoColor() @value struct CompleteAdaptiveColor(TerminalColor): """Specifies exact values for truecolor, ANSI256, and ANSI color profiles, with separate options for light and dark backgrounds. Automatic color degradation will not be performed. Args: light: The CompleteColor to use when the terminal background is light. dark: The CompleteColor to use when the terminal background is dark. Example usage: ```mojo var color = mog.CompleteAdaptiveColor( light=mog.CompleteColor(true_color=0x0000ff, ansi256=21, ansi=4), dark=mog.CompleteColor(true_color=0x000099, ansi256=22, ansi=5), ) ``` . """ var light: CompleteColor var dark: CompleteColor fn color(self, renderer: Renderer) -> mist.AnyColor: if renderer.has_dark_background(): return self.dark.color(renderer) return self.light.color(renderer) --- mog/extensions.mojo --- # Strings @always_inline fn split(text: String, sep: String, max_split: Int = -1) -> List[String]: try: return text.split(sep, max_split) except: return List[String](text) @always_inline fn join(separator: String, iterable: List[String]) -> String: var result: String = "" for i in range(len(iterable)): result += iterable[i] if i != len(iterable) - 1: result += separator return result --- mog/join.mojo --- import math from external.weave.ansi.ansi import printable_rune_width from external.gojo.strings import StringBuilder from .position import Position, top, bottom, left, right, center from .extensions import split fn join_horizontal(pos: Position, *strs: String) -> String: """Utility function for horizontally joining two potentially multi-lined strings along a vertical axis. The first argument is the position, with 0 being all the way at the top and 1 being all the way at the bottom. If you just want to align to the left, right or center you may as well just use the helper constants Top, Center, and Bottom. Example: blockB := "...\n...\n..." blockA := "...\n...\n...\n...\n..." # Join 20% from the top str := mog.join_horizontal(0.2, blockA, blockB) # Join on the top edge str := mog.join_horizontal(mog.Top, blockA, blockB) """ if len(strs) == 0: return "" if len(strs) == 1: return strs[0] # Groups of strings broken into multiple lines var blocks = List[List[String]](capacity=len(strs)) # Max line widths for the above text blocks var max_widths = List[Int](capacity=len(strs)) var max_height: Int = 0 # Break text blocks into lines and get max widths for each text block for i in range(len(strs)): var s = strs[i] var lines = split(s, "\n") var widest: Int = 0 for i in range(len(lines)): var rune_count = printable_rune_width(lines[i]) if rune_count > widest: widest = rune_count blocks.append(lines) max_widths.append(widest) if len(lines) > max_height: max_height = len(lines) # Add extra lines to make each side the same height for i in range(len(blocks)): if len(blocks[i]) >= max_height: continue var extra_lines = List[String]() extra_lines.resize(max_height - len(blocks[i]), "") if pos == top: blocks[i].extend(extra_lines) elif pos == bottom: extra_lines.extend(blocks[i]) blocks[i] = extra_lines else: var n = len(extra_lines) var split = int(n * pos) var top_point = n - split var bottom_point = n - top_point var top_lines = extra_lines[int(top_point) : len(extra_lines)] var bottom_lines = extra_lines[int(bottom_point) : len(extra_lines)] top_lines.extend(blocks[i]) blocks[i] = top_lines blocks[i].extend(bottom_lines) # Merge lines var builder = StringBuilder() # remember, all blocks have the same number of members now for i in range(len(blocks[0])): for j in range(len(blocks)): var block = blocks[j] _ = builder.write_string(block[i]) # Also make lines the same length var spaces = WHITESPACE * (max_widths[j] - printable_rune_width(block[i])) _ = builder.write_string(spaces) if i < len(blocks[0]) - 1: _ = builder.write_string("\n") return str(builder) fn join_horizontal(pos: Position, strs: List[String]) -> String: """Utility function for horizontally joining two potentially multi-lined strings along a vertical axis. The first argument is the position, with 0 being all the way at the top and 1 being all the way at the bottom. If you just want to align to the left, right or center you may as well just use the helper constants Top, Center, and Bottom. Example: blockB := "...\n...\n..." blockA := "...\n...\n...\n...\n..." # Join 20% from the top str := mog.join_horizontal(0.2, blockA, blockB) # Join on the top edge str := mog.join_horizontal(mog.Top, blockA, blockB) """ if len(strs) == 0: return "" if len(strs) == 1: return strs[0] # Groups of strings broken into multiple lines var blocks = List[List[String]](capacity=len(strs)) # Max line widths for the above text blocks var max_widths = List[Int](capacity=len(strs)) var max_height: Int = 0 # Break text blocks into lines and get max widths for each text block for i in range(len(strs)): var s = strs[i] var lines = split(s, "\n") var widest: Int = 0 for i in range(len(lines)): var rune_count = printable_rune_width(lines[i]) if rune_count > widest: widest = rune_count blocks.append(lines) max_widths.append(widest) if len(lines) > max_height: max_height = len(lines) # Add extra lines to make each side the same height for i in range(len(blocks)): if len(blocks[i]) >= max_height: continue var extra_lines = List[String]() extra_lines.resize(max_height - len(blocks[i]), "") if pos == top: blocks[i].extend(extra_lines) elif pos == bottom: extra_lines.extend(blocks[i]) blocks[i] = extra_lines else: var n = len(extra_lines) var split = int(n * pos) var top_point = n - split var bottom_point = n - top_point var top_lines = extra_lines[int(top_point) : len(extra_lines)] var bottom_lines = extra_lines[int(bottom_point) : len(extra_lines)] top_lines.extend(blocks[i]) blocks[i] = top_lines blocks[i].extend(bottom_lines) # Merge lines var builder = StringBuilder() # remember, all blocks have the same number of members now for i in range(len(blocks[0])): for j in range(len(blocks)): var block = blocks[j] _ = builder.write_string(block[i]) # Also make lines the same length # TODO: Is this doing nothing?? var spaces = String("") * (max_widths[j] - printable_rune_width(block[i])) _ = builder.write_string(spaces) if i < len(blocks[0]) - 1: _ = builder.write_string("\n") return str(builder) fn join_vertical(pos: Position, *strs: String) -> String: """Utility function for vertically joining two potentially multi-lined strings along a horizontal axis. The first argument is the position, with 0 being all the way to the left and 1 being all the way to the right. If you just want to align to the left, right or center you may as well just use the helper constants Left, Center, and Right. Example: blockB := "...\n...\n..." blockA := "...\n...\n...\n...\n..." # Join 20% from the top str := mog.join_vertical(0.2, blockA, blockB) # Join on the right edge str := mog.join_vertical(mog.Right, blockA, blockB) """ if len(strs) == 0: return "" if len(strs) == 1: return strs[0] # Groups of strings broken into multiple lines var blocks = List[List[String]](capacity=len(strs)) # Max line widths for the above text blocks var max_width: Int = 0 for i in range(len(strs)): var s = strs[i] var lines = split(s, "\n") var widest: Int = 0 for i in range(len(lines)): var rune_count = printable_rune_width(lines[i]) if rune_count > widest: widest = rune_count blocks.append(lines) if widest > max_width: max_width = widest var builder = StringBuilder() var w: Int = 0 for i in range(len(blocks)): var block = blocks[i] for j in range(len(block)): var line = block[j] w = max_width - printable_rune_width(line) if pos == left: _ = builder.write_string(line) _ = builder.write_string(WHITESPACE * w) elif pos == right: _ = builder.write_string(WHITESPACE * w) _ = builder.write_string(line) else: if w < 1: _ = builder.write_string(line) else: var split = int(w * pos) var right = w - split var left = w - right _ = builder.write_string(WHITESPACE * left) _ = builder.write_string(line) _ = builder.write_string(WHITESPACE * right) if not (i == len(blocks) - 1 and j == len(block) - 1): _ = builder.write_string("\n") return str(builder) fn join_vertical(pos: Position, strs: List[String]) -> String: """Utility function for vertically joining two potentially multi-lined strings along a horizontal axis. The first argument is the position, with 0 being all the way to the left and 1 being all the way to the right. If you just want to align to the left, right or center you may as well just use the helper constants Left, Center, and Right. Example: blockB := "...\n...\n..." blockA := "...\n...\n...\n...\n..." # Join 20% from the top str := mog.join_vertical(0.2, blockA, blockB) # Join on the right edge str := mog.join_vertical(mog.Right, blockA, blockB) """ if len(strs) == 0: return "" if len(strs) == 1: return strs[0] # Groups of strings broken into multiple lines var blocks = List[List[String]](capacity=len(strs)) # Max line widths for the above text blocks var max_width: Int = 0 for i in range(len(strs)): var s = strs[i] var lines = split(s, "\n") var widest: Int = 0 for i in range(len(lines)): var rune_count = printable_rune_width(lines[i]) if rune_count > widest: widest = rune_count blocks.append(lines) if widest > max_width: max_width = widest var builder = StringBuilder() var w: Int = 0 for i in range(len(blocks)): var block = blocks[i] for j in range(len(block)): var line = block[j] w = max_width - printable_rune_width(line) if pos == left: _ = builder.write_string(line) _ = builder.write_string(WHITESPACE * w) elif pos == right: _ = builder.write_string(WHITESPACE * w) _ = builder.write_string(line) else: if w < 1: _ = builder.write_string(line) else: var split = int(w * pos) var right = w - split var left = w - right _ = builder.write_string(WHITESPACE * left) _ = builder.write_string(line) _ = builder.write_string(WHITESPACE * right) if not (i == len(blocks) - 1 and j == len(block) - 1): _ = builder.write_string("\n") return str(builder) --- mog/position.mojo --- from .renderer import Renderer # Position represents a position along a horizontal or vertical axis. It's in # situations where an axis is involved, like alignment, joining, placement and # so on. # # A value of 0 represents the start (the left or top) and 1 represents the end # (the right or bottom). 0.5 represents the center. # # There are constants Top, Bottom, Center, Left and Right in this package that # can be used to aid readability. alias Position = Float64 alias right: Position = 1.0 alias top: Position = 0.0 alias bottom: Position = 1.0 alias center: Position = 0.5 alias left: Position = 0.0 --- mog/renderer.mojo --- import external.mist from external.gojo.strings import StringBuilder import external.weave.ansi from .whitespace import WhitespaceOption, new_whitespace import .position from .extensions import split # TODO: Cannot handle characters with a printable width of 2 or more. Like east asian characters (Kanji, etc.). # Working on terminal background querying, for now it defaults to dark background terminal. # If you need to set it to light, you can do so manually via the `set_dark_background` method. @value struct Renderer: var color_profile: mist.Profile var dark_background: Bool var explicit_color_profile: Bool var explicit_background_color: Bool fn __init__( inout self, color_profile: Optional[Int] = None, dark_background: Bool = True, explicit_color_profile: Bool = False, explicit_background_color: Bool = False, ): if color_profile: self.color_profile = mist.Profile(color_profile.value()[]) else: self.color_profile = mist.Profile() self.dark_background = dark_background self.explicit_color_profile = explicit_color_profile self.explicit_background_color = explicit_background_color fn set_color_profile(inout self, value: Int): """Sets the color profile on the renderer. This function exists mostly for testing purposes so that you can assure you're testing against a specific profile. Outside of testing you likely won't want to use this function as the color profile will detect and cache the terminal's color capabilities and choose the best available profile. Available color profiles are: mist.ASCII no color, 1-bit mist.ANSI 16 colors, 4-bit mist.ANSI256 256 colors, 8-bit mist.TRUE_COLOR 16,777,216 colors, 24-bit """ self.color_profile.value = value self.explicit_color_profile = True fn has_dark_background(self) -> Bool: """Returns whether or not the renderer will render to a dark background. A dark background can either be auto-detected, or set explicitly on the renderer. """ return self.dark_background fn set_dark_background(inout self, value: Bool): """Sets the background color detection value for the default renderer. This function exists mostly for testing purposes so that you can assure you're testing against a specific background color setting. Outside of testing you likely won't want to use this function as the backgrounds value will be automatically detected and cached against the terminal's current background color setting. """ self.dark_background = value self.explicit_background_color = True fn place( self, width: Int, height: Int, hPos: Float64, vPos: Float64, text: String, /, *opts: WhitespaceOption, ) -> String: """Places a string or text block vertically in an unstyled box of a given width or height. Args: width: The width of the block to place the text in. height: The height of the block to place the text in. hPos: The position to place the text horizontally in the block. This should be a float between 0 and 1. 0 is the left side, 1 is the right side, and 0.5 is the center. vPos: The position to place the text vertically in the block. This should be a float between 0 and 1. 0 is the top, 1 is the bottom, and 0.5 is the center. text: The string to place in the block. opts: Options to configure the whitespace. Returns: The string with the text placed in the block. """ var options = List[WhitespaceOption]() for opt in opts: options.append(opt) return self.place_vertical( height, vPos, self.place_horizontal(width, hPos, text, options), options, ) # TODO: temp until arg unpacking fn place( self, width: Int, height: Int, hPos: Float64, vPos: Float64, text: String, opts: List[WhitespaceOption], ) -> String: """Places a string or text block vertically in an unstyled box of a given width or height. Args: width: The width of the block to place the text in. height: The height of the block to place the text in. hPos: The position to place the text horizontally in the block. This should be a float between 0 and 1. 0 is the left side, 1 is the right side, and 0.5 is the center. vPos: The position to place the text vertically in the block. This should be a float between 0 and 1. 0 is the top, 1 is the bottom, and 0.5 is the center. text: The string to place in the block. opts: Options to configure the whitespace. Returns: The string with the text placed in the block. """ return self.place_vertical(height, vPos, self.place_horizontal(width, hPos, text, opts), opts) fn place_horizontal(self, width: Int, pos: Float64, text: String, /, *opts: WhitespaceOption) raises -> String: """Places a string or text block horizontally in an unstyled block of a given width. If the given width is shorter than the max width of the string (measured by its longest line) this will be a noöp. Args: width: The width of the block to place the text in. pos: The position to place the text in the block. This should be a float between 0 and 1. 0 is the left side, 1 is the right side, and 0.5 is the center. text: The string to place in the block. opts: Options to configure the whitespace. Returns: The string with the text placed in the block. """ var lines = text.split("\n") var content_width: Int = 0 for i in range(len(lines)): if ansi.printable_rune_width(lines[i]) > content_width: content_width = ansi.printable_rune_width(lines[i]) var gap = width - content_width if gap <= 0: return text var options = List[WhitespaceOption]() for opt in opts: options.append(opt) var white_space = new_whitespace(self, options) var builder = StringBuilder() for i in range(len(lines)): # Is this line shorter than the longest line? var short = max(0, content_width - ansi.printable_rune_width(lines[i])) if pos == position.left: _ = builder.write_string(lines[i]) _ = builder.write_string(white_space.render(gap + short)) elif pos == position.right: _ = builder.write_string(white_space.render(gap + short)) _ = builder.write_string(lines[i]) else: # somewhere in the middle var total_gap = gap + short var split = int(round(Float64(total_gap) * pos)) var left = total_gap - split var right = total_gap - left _ = builder.write_string(white_space.render(left)) _ = builder.write_string(lines[i]) _ = builder.write_string(white_space.render(right)) if i < len(lines) - 1: _ = builder.write_byte(ord("\n")) return str(builder) # TODO: Temporary until arg unpacking is supported. fn place_horizontal( self, width: Int, pos: Float64, text: String, opts: List[WhitespaceOption], ) -> String: """Places a string or text block horizontally in an unstyled block of a given width. If the given width is shorter than the max width of the string (measured by its longest line) this will be a noöp. Args: width: The width of the block to place the text in. pos: The position to place the text in the block. This should be a float between 0 and 1. 0 is the left side, 1 is the right side, and 0.5 is the center. text: The string to place in the block. opts: Options to configure the whitespace. Returns: The string with the text placed in the block. """ var lines = split(text, "\n") var content_width: Int = 0 for i in range(len(lines)): if ansi.printable_rune_width(lines[i]) > content_width: content_width = ansi.printable_rune_width(lines[i]) var gap = width - content_width if gap <= 0: return text var white_space = new_whitespace(self, opts) var builder = StringBuilder() for i in range(len(lines)): # Is this line shorter than the longest line? var short = max(0, content_width - ansi.printable_rune_width(lines[i])) if pos == position.left: _ = builder.write_string(lines[i]) _ = builder.write_string(white_space.render(gap + short)) elif pos == position.right: _ = builder.write_string(white_space.render(gap + short)) _ = builder.write_string(lines[i]) else: # somewhere in the middle var total_gap = gap + short var split = int(round(Float64(total_gap) * pos)) var left = total_gap - split var right = total_gap - left _ = builder.write_string(white_space.render(left)) _ = builder.write_string(lines[i]) _ = builder.write_string(white_space.render(right)) if i < len(lines) - 1: _ = builder.write_byte(ord("\n")) return str(builder) fn place_vertical( self, height: Int, pos: Float64, text: String, /, *opts: WhitespaceOption, ) -> String: """Places a string or text block vertically in an unstyled block of a given height. If the given height is shorter than the height of the string (measured by its newlines) then this will be a noöp. Args: height: The height of the block to place the text in. pos: The position to place the text in the block. This should be a float between 0 and 1. 0 is the top, 1 is the bottom, and 0.5 is the center. text: The string to place in the block. opts: Options to configure the whitespace. Returns: The string with the text placed in the block. """ var content_height = text.count("\n") + 1 var gap = height - content_height if gap <= 0: return text var options = List[WhitespaceOption]() for opt in opts: options.append(opt) var white_space = new_whitespace(self, options) var lines = split(text, "\n") var width: Int = 0 for i in range(len(lines)): if ansi.printable_rune_width(lines[i]) > width: width = ansi.printable_rune_width(lines[i]) var empty_line = white_space.render(width) var builder = StringBuilder() if pos == position.top: _ = builder.write_string(text) _ = builder.write_byte(ord("\n")) var i = 0 while i < gap: _ = builder.write_string(empty_line) if i < gap - 1: _ = builder.write_byte(ord("\n")) i += 1 elif pos == position.bottom: _ = builder.write_string((empty_line + "\n") * gap) _ = builder.write_string(text) else: # somewhere in the middle var split = int(round(Float64(gap) * pos)) var top = gap - split var bottom = gap - top _ = builder.write_string((empty_line + "\n") * top) _ = builder.write_string(text) var i = 0 while i < bottom: _ = builder.write_byte(ord("\n")) _ = builder.write_string(empty_line) i += 1 return str(builder) fn place_vertical( self, height: Int, pos: Float64, text: String, opts: List[WhitespaceOption], ) -> String: """Places a string or text block vertically in an unstyled block of a given height. If the given height is shorter than the height of the string (measured by its newlines) then this will be a noöp. Args: height: The height of the block to place the text in. pos: The position to place the text in the block. This should be a float between 0 and 1. 0 is the top, 1 is the bottom, and 0.5 is the center. text: The string to place in the block. opts: Options to configure the whitespace. Returns: The string with the text placed in the block. """ var content_height = text.count("\n") + 1 var gap = height - content_height if gap <= 0: return text var white_space = new_whitespace(self, opts) var lines = split(text, "\n") var width: Int = 0 for i in range(len(lines)): if ansi.printable_rune_width(lines[i]) > width: width = ansi.printable_rune_width(lines[i]) var empty_line = white_space.render(width) var builder = StringBuilder() if pos == position.top: _ = builder.write_string(text) _ = builder.write_byte(ord("\n")) var i = 0 while i < gap: _ = builder.write_string(empty_line) if i < gap - 1: _ = builder.write_byte(ord("\n")) i += 1 elif pos == position.bottom: _ = builder.write_string((empty_line + "\n") * gap) _ = builder.write_string(text) else: # somewhere in the middle var split = int(round(Float64(gap) * pos)) var top = gap - split var bottom = gap - top _ = builder.write_string((empty_line + "\n") * top) _ = builder.write_string(text) var i = 0 while i < bottom: _ = builder.write_byte(ord("\n")) _ = builder.write_string(empty_line) i += 1 return str(builder) --- mog/size.mojo --- from external.weave.ansi import ansi from .extensions import split fn get_width(text: String) -> Int: """Returns the cell width of characters in the string. ANSI sequences are ignored and characters wider than one cell (such as Chinese characters and emojis) are appropriately measured. You should use this instead of len(string) as it will give you accurate results. Args: text: The string to measure. Returns: The width of the string in cells. """ var strings = split(text, "\n") var width: Int = 0 for i in range(len(strings)): var l = strings[i] var w = ansi.printable_rune_width(l) if w > width: width = w return width fn get_height(text: String) -> Int: """Returns height of a string in cells. This is done simply by counting \\n characters. If your strings use \\r\\n for newlines you should convert them to \\n first, or simply write a separate fntion for measuring height. Args: text: The string to measure. Returns: The height of the string in cells. """ var height = 1 for i in range(len(text)): if text[i] == "\n": height += 1 return height fn get_size(text: String) raises -> (Int, Int): """Returns the width and height of the string in cells. ANSI sequences are ignored and characters wider than one cell (such as Chinese characters and emojis) are appropriately measured. Args: text: The string to measure. Returns: A tuple containing the width and height of the string in cells. """ return get_width(text), get_height(text) --- mog/style.mojo --- from .renderer import Renderer from .position import Position from .border import ( Border, render_horizontal_edge, NO_BORDER, HIDDEN_BORDER, DOUBLE_BORDER, ROUNDED_BORDER, NORMAL_BORDER, BLOCK_BORDER, INNER_HALF_BLOCK_BORDER, OUTER_HALF_BLOCK_BORDER, THICK_BORDER, ASCII_BORDER, STAR_BORDER, PLUS_BORDER, ) from .extensions import join, split from .align import align_text_horizontal, align_text_vertical from .color import ( AnyTerminalColor, TerminalColor, NoColor, Color, ANSIColor, AdaptiveColor, CompleteColor, CompleteAdaptiveColor, ) from external.weave import wrap, wordwrap, truncate from external.weave.ansi.ansi import printable_rune_width import external.mist from external.gojo.strings import StringBuilder, Reader alias TAB_WIDTH: Int = 4 alias NO_TAB_CONVERSION = -1 """NoTabConversion can be passed to [Style.tab_width] to disable the replacement of tabs with spaces at render time.""" alias PropertyKey = Int alias BOLD_KEY: PropertyKey = 1 alias ITALIC_KEY: PropertyKey = 2 alias UNDERLINE_KEY: PropertyKey = 3 alias CROSSOUT_KEY: PropertyKey = 4 alias REVERSE_KEY: PropertyKey = 5 alias BLINK_KEY: PropertyKey = 6 alias FAINT_KEY: PropertyKey = 7 alias FOREGROUND_KEY: PropertyKey = 8 alias BACKGROUND_KEY: PropertyKey = 9 alias WIDTH_KEY: PropertyKey = 10 alias HEIGHT_KEY: PropertyKey = 11 alias HORIZONTAL_ALIGNMENT_KEY: PropertyKey = 12 alias VERTICAL_ALIGNMENT_KEY: PropertyKey = 13 # Padding. alias PADDING_TOP_KEY: PropertyKey = 14 alias PADDING_RIGHT_KEY: PropertyKey = 15 alias PADDING_BOTTOM_KEY: PropertyKey = 16 alias PADDING_LEFT_KEY: PropertyKey = 17 alias COLOR_WHITESPACE_KEY: PropertyKey = 18 # Margins. alias MARGIN_TOP_KEY: PropertyKey = 19 alias MARGIN_RIGHT_KEY: PropertyKey = 20 alias MARGIN_BOTTOM_KEY: PropertyKey = 21 alias MARGIN_LEFT_KEY: PropertyKey = 22 alias MARGIN_BACKGROUND_KEY: PropertyKey = 23 # Border runes. alias BORDER_STYLE_KEY: PropertyKey = 24 # Border edges. alias BORDER_TOP_KEY: PropertyKey = 25 alias BORDER_RIGHT_KEY: PropertyKey = 26 alias BORDER_BOTTOM_KEY: PropertyKey = 27 alias BORDER_LEFT_KEY: PropertyKey = 28 # Border foreground colors. alias BORDER_TOP_FOREGROUND_KEY: PropertyKey = 29 alias BORDER_RIGHT_FOREGROUND_KEY: PropertyKey = 30 alias BORDER_BOTTOM_FOREGROUND_KEY: PropertyKey = 31 alias BORDER_LEFT_FOREGROUND_KEY: PropertyKey = 32 # Border background colors. alias BORDER_TOP_BACKGROUND_KEY: PropertyKey = 33 alias BORDER_RIGHT_BACKGROUND_KEY: PropertyKey = 34 alias BORDER_BOTTOM_BACKGROUND_KEY: PropertyKey = 35 alias BORDER_LEFT_BACKGROUND_KEY: PropertyKey = 36 alias INLINE_KEY: PropertyKey = 37 alias MAX_WIDTH_KEY: PropertyKey = 38 alias MAX_HEIGHT_KEY: PropertyKey = 39 alias TAB_WIDTH_KEY: PropertyKey = 40 alias UNDERLINE_SPACES_KEY: PropertyKey = 41 alias CROSSOUT_SPACES_KEY: PropertyKey = 42 fn get_lines(text: String) -> Tuple[List[String], Int]: """Split a string into lines. Args: text: The string to split. Returns: A tuple containing the lines and the width of the widest line. """ var lines = split(text, "\n") var widest_line: Int = 0 for i in range(len(lines)): if printable_rune_width(lines[i]) > widest_line: widest_line = printable_rune_width(lines[i]) return lines, widest_line # Apply left padding. fn pad(text: String, n: Int, style: mist.Style) -> String: if n == 0: return text var sp = style.render(WHITESPACE * abs(n)) var builder = StringBuilder(capacity=int(len(text) * 1.5)) var lines = split(text, "\n") for i in range(len(lines)): if n > 0: _ = builder.write_string(lines[i]) _ = builder.write_string(sp) else: _ = builder.write_string(sp) _ = builder.write_string(lines[i]) if i != len(lines) - 1: _ = builder.write_string("\n") return str(builder) fn pad_left(text: String, n: Int, style: mist.Style) -> String: return pad(text, -n, style) fn pad_right(text: String, n: Int, style: mist.Style) -> String: return pad(text, n, style) @register_passable("trivial") struct Properties: """Properties for a style.""" var value: SIMD[DType.uint8, 64] fn __init__(inout self, value: SIMD[DType.uint8, 64] = SIMD[DType.uint8, 64]()): """Initialize a new Properties object.""" self.value = value fn set(self, key: PropertyKey) -> Properties: """Set a property. Args: key: The key to set. Returns: A new Properties object with the property set. """ var new = self new.value[key] = 1 return new fn unset(self, key: PropertyKey) -> Properties: """Unset a property. Args: key: The key to unset. Returns: A new Properties object with the property unset. """ var new = self new.value[key] = 0 return new fn has(self, key: PropertyKey) -> Bool: """Check if a property is set. Args: key: The key to check. Returns: True if the property is set, False otherwise. """ return self.value[key] == 1 @value struct Style: """Terminal styler. Usage: ```mojo import mog fn main(): var style = ( mog.Style() .bold(True) .foreground(mog.Color(0xFAFAFA)) .background(mog.Color(0x7D56F4)) .padding_top(2) .padding_left(4) .width(22) ) print(style.render("Hello, world")) ``` More documentation to come.""" var renderer: Renderer var properties: Properties """List of attributes with 1 or 0 values to determine if a property is set. properties = is it set? attrs = is it set to true or false? (for bool properties). """ var value: String var attrs: Properties """Stores the value of set bool properties here. Eg. Setting bool to to true on a style makes attrs.has(BOOL_KEY) return true. """ # props that have values var _fg: AnyTerminalColor var _bg: AnyTerminalColor var _width: Int var _height: Int var _horizontal_alignment: Position var _vertical_alignment: Position var _padding_top: Int var _padding_right: Int var _padding_bottom: Int var _padding_left: Int var _margin_top: Int var _margin_right: Int var _margin_bottom: Int var _margin_left: Int var _margin_bg: AnyTerminalColor var _border: Border var _border_top_fg: AnyTerminalColor var _border_right_fg: AnyTerminalColor var _border_bottom_fg: AnyTerminalColor var _border_left_fg: AnyTerminalColor var _border_top_bg: AnyTerminalColor var _border_right_bg: AnyTerminalColor var _border_bottom_bg: AnyTerminalColor var _border_left_bg: AnyTerminalColor var _max_width: Int var _max_height: Int var _tab_width: Int fn __init__(inout self, value: String = "", color_profile: Optional[Int] = None): """Initialize a new Style object. Args: value: Internal string value to apply the style to. Not required, but useful for reusing some string you want to format multiple times. color_profile: The color profile to use. Defaults to None, which means it'll be queried at run time instead. """ if color_profile: self.renderer = Renderer(color_profile) else: self.renderer = Renderer() self.properties = Properties() self.value = value self.attrs = Properties() self._fg = NoColor() self._bg = NoColor() self._width = 0 self._height = 0 self._horizontal_alignment = 0 self._vertical_alignment = 0 self._padding_top = 0 self._padding_right = 0 self._padding_bottom = 0 self._padding_left = 0 self._margin_top = 0 self._margin_right = 0 self._margin_bottom = 0 self._margin_left = 0 self._margin_bg = NoColor() self._border = NO_BORDER self._border_top_fg = NoColor() self._border_right_fg = NoColor() self._border_bottom_fg = NoColor() self._border_left_fg = NoColor() self._border_top_bg = NoColor() self._border_right_bg = NoColor() self._border_bottom_bg = NoColor() self._border_left_bg = NoColor() self._max_width = 0 self._max_height = 0 self._tab_width = 0 fn get_as_bool(self, key: PropertyKey, default: Bool = False) -> Bool: """Get a rule as a boolean value. Args: key: The key to get. default: The default value to return if the rule is not set. Returns: The boolean value. """ if not self.is_set(key): return default return self.attrs.has(key) fn get_as_color(self, key: PropertyKey) -> AnyTerminalColor: """Get a rule as an AnyTerminalColor value. Args: key: The key to get. Returns: The color value. """ if not self.is_set(key): return NoColor() if key == FOREGROUND_KEY: return self._fg elif key == BACKGROUND_KEY: return self._bg elif key == BORDER_TOP_FOREGROUND_KEY: return self._border_top_fg elif key == BORDER_RIGHT_FOREGROUND_KEY: return self._border_right_fg elif key == BORDER_BOTTOM_FOREGROUND_KEY: return self._border_bottom_fg elif key == BORDER_LEFT_FOREGROUND_KEY: return self._border_left_fg elif key == BORDER_TOP_BACKGROUND_KEY: return self._border_top_bg elif key == BORDER_RIGHT_BACKGROUND_KEY: return self._border_right_bg elif key == BORDER_BOTTOM_BACKGROUND_KEY: return self._border_bottom_bg elif key == BORDER_LEFT_BACKGROUND_KEY: return self._border_left_bg elif key == MARGIN_BACKGROUND_KEY: return self._margin_bg else: return NoColor() fn get_as_int(self, key: PropertyKey) -> Int: """Get a rule as an integer value. Args: key: The key to get. Returns: The integer value. """ if not self.is_set(key): return 0 if key == WIDTH_KEY: return self._width elif key == HEIGHT_KEY: return self._height elif key == PADDING_TOP_KEY: return self._padding_top elif key == PADDING_RIGHT_KEY: return self._padding_right elif key == PADDING_BOTTOM_KEY: return self._padding_bottom elif key == PADDING_LEFT_KEY: return self._padding_left elif key == MARGIN_TOP_KEY: return self._margin_top elif key == MARGIN_RIGHT_KEY: return self._margin_right elif key == MARGIN_BOTTOM_KEY: return self._margin_bottom elif key == MARGIN_LEFT_KEY: return self._margin_left elif key == MAX_WIDTH_KEY: return self._max_width elif key == MAX_HEIGHT_KEY: return self._max_height elif key == TAB_WIDTH_KEY: return self._tab_width else: return 0 fn get_as_position(self, key: PropertyKey) -> Position: """Get a rule as a Position value. Args: key: The key to get. Returns: The Position value. """ if not self.is_set(key): return 0 if key == HORIZONTAL_ALIGNMENT_KEY: return self._horizontal_alignment elif key == VERTICAL_ALIGNMENT_KEY: return self._vertical_alignment else: return 0 fn get_border_style(self) -> Border: """Get the Border style rule. Returns: The Border style. """ if not self.is_set(BORDER_STYLE_KEY): return Border() return self._border fn is_set(self, key: PropertyKey) -> Bool: """Check if a rule is set on the style. Args: key: The key to check. Returns: True if the rule is set, False otherwise. """ return self.properties.has(key) fn set_attribute(inout self, key: PropertyKey, value: Border): """Set a border attribute on the style. Args: key: The key to set. value: The value to set. """ self._border = value self.properties = self.properties.set(key) fn set_attribute(inout self, key: PropertyKey, value: Bool): """Set a boolean attribute on the style. Args: key: The key to set. value: The value to set. """ if value: self.attrs = self.attrs.set(key) else: self.attrs = self.attrs.unset(key) # Set the prop self.properties = self.properties.set(key) fn set_attribute(inout self, key: PropertyKey, value: Int): """Set a int attribute on the style. Args: key: The key to set. value: The value to set. """ if key == WIDTH_KEY: self._width = max(0, value) elif key == HEIGHT_KEY: self._height = max(0, value) elif key == PADDING_TOP_KEY: self._padding_top = max(0, value) elif key == PADDING_RIGHT_KEY: self._padding_right = max(0, value) elif key == PADDING_BOTTOM_KEY: self._padding_bottom = max(0, value) elif key == PADDING_LEFT_KEY: self._padding_left = max(0, value) elif key == MARGIN_TOP_KEY: self._margin_top = max(0, value) elif key == MARGIN_RIGHT_KEY: self._margin_right = max(0, value) elif key == MARGIN_BOTTOM_KEY: self._margin_bottom = max(0, value) elif key == MARGIN_LEFT_KEY: self._margin_left = max(0, value) elif key == MAX_WIDTH_KEY: self._max_width = max(0, value) elif key == MAX_HEIGHT_KEY: self._max_height = max(0, value) elif key == TAB_WIDTH_KEY: self._tab_width = value # Set the prop self.properties = self.properties.set(key) fn set_attribute(inout self, key: PropertyKey, value: Position): """Set a Position attribute on the style. Args: key: The key to set. value: The value to set. """ if key == HORIZONTAL_ALIGNMENT_KEY: self._horizontal_alignment = value elif key == VERTICAL_ALIGNMENT_KEY: self._vertical_alignment = value # Set the prop self.properties = self.properties.set(key) fn set_attribute(inout self, key: PropertyKey, value: AnyTerminalColor): """Set a int attribute on the style. Args: key: The key to set. value: The value to set. """ if key == FOREGROUND_KEY: self._fg = value elif key == BACKGROUND_KEY: self._bg = value elif key == MARGIN_BACKGROUND_KEY: self._margin_bg = value elif key == BORDER_TOP_FOREGROUND_KEY: self._border_top_fg = value elif key == BORDER_RIGHT_FOREGROUND_KEY: self._border_right_fg = value elif key == BORDER_BOTTOM_FOREGROUND_KEY: self._border_bottom_fg = value elif key == BORDER_LEFT_FOREGROUND_KEY: self._border_left_fg = value elif key == BORDER_TOP_BACKGROUND_KEY: self._border_top_bg = value elif key == BORDER_RIGHT_BACKGROUND_KEY: self._border_right_bg = value elif key == BORDER_BOTTOM_BACKGROUND_KEY: self._border_bottom_bg = value elif key == BORDER_LEFT_BACKGROUND_KEY: self._border_left_bg = value # Set the prop self.properties = self.properties.set(key) fn unset_attribute(inout self, key: PropertyKey): """Set a boolean attribute on the style. Args: key: The key to set. """ self.properties = self.properties.unset(key) fn set_renderer(self, renderer: Renderer) -> Style: """Set the renderer for the style. Args: renderer: The renderer to set. Returns: A new Style object with the renderer set. """ var new_style = self new_style.renderer = renderer return new_style fn set_string(self, value: String) -> Style: """Set the string value for the style. Args: value: The string value to set. Returns: A new Style object with the string value set. """ var new_style = self new_style.value = value return new_style fn tab_width(self, width: Int) -> Style: """Sets the number of spaces that a tab (/t) should be rendered as. When set to 0, tabs will be removed. To disable the replacement of tabs with spaces entirely, set this to [NO_TAB_CONVERSION]. By default, tabs will be replaced with 4 spaces. Args: width: The tab width to apply. Returns: A new Style object with the tab width rule set. """ var n = -1 if width <= -1 else width var new = self new.set_attribute(TAB_WIDTH_KEY, n) return new fn unset_tab_width(self) -> Style: """Unset the tab width of the text. Returns: A new Style object with the tab width rule unset. """ var new = self new.unset_attribute(TAB_WIDTH_KEY) return new fn underline_spaces(self, value: Bool = True) -> Style: """Determines whether to underline spaces between words. Spaces can also be underlined without underlining the text itself. Args: value: Value to set the rule to. Returns: A new Style object with the crossout rule set. """ var new = self new.set_attribute(UNDERLINE_SPACES_KEY, value) return new fn unset_underline_spaces(self) -> Style: """Unset the underline spaces rule. Returns: A new Style object with the underline spaces rule unset. """ var new = self new.unset_attribute(UNDERLINE_SPACES_KEY) return new fn crossout_spaces(self, value: Bool = True) -> Style: """Determines whether to crossout spaces between words. Spaces can also be crossed out without crossout on the text itself. Args: value: Value to set the rule to. Returns: A new Style object with the crossout rule set. """ var new = self new.set_attribute(CROSSOUT_SPACES_KEY, value) return new fn unset_crossout_spaces(self) -> Style: """Unset the crossout spaces rule. Returns: A new Style object with the crossout spaces rule unset. """ var new = self new.unset_attribute(CROSSOUT_SPACES_KEY) return new fn color_whitespace(self, value: Bool = True) -> Style: """Determines whether to color whitespace. Args: value: Value to set the rule to. Returns: A new Style object with the color whitespace rule set. """ var new = self new.set_attribute(COLOR_WHITESPACE_KEY, value) return new fn unset_color_whitespace(self) -> Style: """Unset the color whitespace rule. Returns: A new Style object with the color whitespace rule unset. """ var new = self new.unset_attribute(COLOR_WHITESPACE_KEY) return new fn inline(self, value: Bool = True) -> Style: """Makes rendering output one line and disables the rendering of margins, padding and borders. This is useful when you need a style to apply only to font rendering and don't want it to change any physical dimensions. It works well with Style.max_width. Because this in intended to be used at the time of render, this method will not mutate the style and instead return a copy. Example: var: String = "..." var user_style = mog.Style().inline(True) print(user_style.render(user_input)) Args: value: Value to set the rule to. Returns: A new Style object with the bold rule set. """ var new = self new.set_attribute(INLINE_KEY, value) return new fn get_inline(self) -> Bool: return self.get_as_bool(INLINE_KEY, False) fn unset_inline(self) -> Style: """Unset the inline rule. Returns: A new Style object with the inline rule unset. """ var new = self new.unset_attribute(INLINE_KEY) return new fn bold(self, value: Bool = True) -> Style: """Set the text to be bold. Args: value: Value to set the rule to. Returns: A new Style object with the bold rule set. """ var new = self new.set_attribute(BOLD_KEY, value) return new fn get_bold(self) -> Bool: return self.get_as_bool(BOLD_KEY, False) fn italic(self, value: Bool = True) -> Style: """Set the text to be italic. Args: value: Value to set the rule to. Returns: A new Style object with the italic rule set. """ var new = self new.set_attribute(ITALIC_KEY, value) return new fn get_italic(self) -> Bool: return self.get_as_bool(ITALIC_KEY, False) fn underline(self, value: Bool = True) -> Style: """Set the text to be underline. Args: value: Value to set the rule to. Returns: A new Style object with the underline rule set. """ var new = self new.set_attribute(UNDERLINE_KEY, value) return new fn crossout(self, value: Bool = True) -> Style: """Set the text to be crossed out. Args: value: Value to set the rule to. Returns: A new Style object with the crossout rule set. """ var new = self new.set_attribute(CROSSOUT_KEY, value) return new fn reverse(self, value: Bool = True) -> Style: """Set the text have the foreground and background colors reversed. Args: value: Value to set the rule to. Returns: A new Style object with the reverse rule set. """ var new = self new.set_attribute(REVERSE_KEY, value) return new fn blink(self, value: Bool = True) -> Style: """Set the text to blink. Args: value: Value to set the rule to. Returns: A new Style object with the blink rule set. """ var new = self new.set_attribute(BLINK_KEY, value) return new fn faint(self, value: Bool = True) -> Style: """Set the text to be faint. Args: value: Value to set the rule to. Returns: A new Style object with the faint rule set. """ var new = self new.set_attribute(FAINT_KEY, value) return new fn unset_bold(self) -> Style: """Unset the bold rule. Returns: A new Style object with the bold rule unset. """ var new = self new.unset_attribute(BOLD_KEY) return new fn unset_italic(self) -> Style: """Unset the italic rule. Returns: A new Style object with the italic rule unset. """ var new = self new.unset_attribute(ITALIC_KEY) return new fn unset_underline(self) -> Style: """Unset the text to be underline. Returns: A new Style object with the underline rule set. """ var new = self new.unset_attribute(UNDERLINE_KEY) return new fn unset_crossout(self) -> Style: """Unset the crossout rule. Returns: A new Style object with the crossout rule unset. """ var new = self new.unset_attribute(CROSSOUT_KEY) return new fn unset_reverse(self) -> Style: """Unset the reverse rule. Returns: A new Style object with the reverse rule unset. """ var new = self new.unset_attribute(REVERSE_KEY) return new fn unset_blink(self) -> Style: """Unset the blink rule. Returns: A new Style object with the blink rule unset. """ var new = self new.unset_attribute(BLINK_KEY) return new fn unset_faint(self) -> Style: """Unset the text to be faint. Returns: A new Style object with the faint rule unset. """ var new = self new.unset_attribute(FAINT_KEY) return new fn width(self, width: Int) -> Style: """Set the width of the text. Args: width: The width to apply. Returns: A new Style object with the width rule set. """ var new = self new.set_attribute(WIDTH_KEY, width) return new fn unset_width(self) -> Style: """Unset the width of the text. Returns: A new Style object with the width rule unset. """ var new = self new.unset_attribute(WIDTH_KEY) return new fn height(self, height: Int) -> Style: """Set the height of the text. Args: height: The height to apply. Returns: A new Style object with the height rule set. """ var new = self new.set_attribute(HEIGHT_KEY, height) return new fn unset_height(self) -> Style: """Unset the height of the text. Returns: A new Style object with the height rule unset. """ var new = self new.unset_attribute(HEIGHT_KEY) return new fn max_width(self, width: Int) -> Style: """Applies a max width to a given style. This is useful in enforcing a certain width at render time, particularly with arbitrary strings and styles. Because this in intended to be used at the time of render, this method will not mutate the style and instead return a copy. Example: var: String = "..." var user_style = mog.Style().max_width(16) print(user_style.render(user_input)) Args: width: The maximum height to apply. Returns: A new Style object with the maximum width rule set. """ var new = self new.set_attribute(MAX_WIDTH_KEY, width) return new fn unset_max_width(self) -> Style: """Unset the max width of the text. Returns: A new Style object with the max width rule unset. """ var new = self new.unset_attribute(MAX_WIDTH_KEY) return new fn max_height(self, height: Int) -> Style: """Set the maximum height of the text. Args: height: The maximum height to apply. Returns: A new Style object with the maximum height rule set. """ var new = self new.set_attribute(MAX_HEIGHT_KEY, height) return new fn unset_max_height(self) -> Style: """Unset the max height of the text. Returns: A new Style object with the max height rule unset. """ var new = self new.unset_attribute(MAX_HEIGHT_KEY) return new fn horizontal_alignment(self, align: Position) -> Style: """Set the horizontal alignment of the text. Args: align: The alignment value to apply. Returns: A new Style object with the alignment rule set. """ var new = self new.set_attribute(HORIZONTAL_ALIGNMENT_KEY, align) return new fn unset_horizontal_alignment(self) -> Style: """Unset the horizontal alignment of the text. Returns: A new Style object with the horizontal alignment rule unset. """ var new = self new.unset_attribute(HORIZONTAL_ALIGNMENT_KEY) return new fn vertical_alignment(self, align: Position) -> Style: """Set the vertical alignment of the text. Args: align: The alignment value to apply. Returns: A new Style object with the alignment rule set. """ var new = self new.set_attribute(VERTICAL_ALIGNMENT_KEY, align) return new fn unset_vertical_alignment(self) -> Style: """Unset the vertical alignment of the text. Returns: A new Style object with the vertical alignment rule unset. """ var new = self new.unset_attribute(VERTICAL_ALIGNMENT_KEY) return new fn alignment(self, *align: Position) -> Style: """Align is a shorthand method for setting horizontal and vertical alignment. With one argument, the position value is applied to the horizontal alignment. With two arguments, the value is applied to the horizontal and vertical alignments, in that order. Args: align: The alignment value to apply. Returns: A new Style object with the alignment rules set. """ var new = self if len(align) > 0: new.set_attribute(HORIZONTAL_ALIGNMENT_KEY, align[0]) if len(align) > 1: new.set_attribute(VERTICAL_ALIGNMENT_KEY, align[1]) return new fn foreground(self, color: AnyTerminalColor) -> Style: """Set the foreground color of the text. Args: color: The color to apply. Returns: A new Style object with the foreground color rule set. """ var new = self new.set_attribute(FOREGROUND_KEY, color) return new fn unset_foreground(self) -> Style: """Unset the foreground color of the text. Returns: A new Style object with the foreground color rule unset. """ var new = self new.unset_attribute(FOREGROUND_KEY) return new fn background(self, color: AnyTerminalColor) -> Style: """Set the background color of the text. Args: color: The color to apply. Returns: A new Style object with the background color rule set. """ var new = self new.set_attribute(BACKGROUND_KEY, color) return new fn unset_background(self) -> Style: """Unset the background color of the text. Returns: A new Style object with the background color rule unset. """ var new = self new.unset_attribute(BACKGROUND_KEY) return new fn border(self, border: Border, *sides: Bool) -> Style: """Set the border style of the text. Args: border: The border style to apply. sides: The sides to apply the border to. Returns: A new Style object with the border rule set. """ var new = self new.set_attribute(BORDER_STYLE_KEY, border) var top = True var right = True var bottom = True var left = True var sides_specified = len(sides) if sides_specified == 1: top = sides[0] bottom = sides[0] left = sides[0] right = sides[0] elif sides_specified == 2: top = sides[0] bottom = sides[0] left = sides[1] right = sides[1] elif sides_specified == 3: top = sides[0] left = sides[1] right = sides[1] bottom = sides[2] elif sides_specified == 4: top = sides[0] right = sides[1] bottom = sides[2] left = sides[3] new.set_attribute(BORDER_TOP_KEY, top) new.set_attribute(BORDER_RIGHT_KEY, right) new.set_attribute(BORDER_BOTTOM_KEY, bottom) new.set_attribute(BORDER_LEFT_KEY, left) return new fn border_top(self, top: Bool) -> Style: """Sets the top border to be rendered or not. Args: top: Whether to apply the border to the top side. Returns: A new Style object with the border rule set. """ var new = self new.set_attribute(BORDER_TOP_KEY, top) return new fn unset_border_top(self) -> Style: """Unsets the top border rule. Returns: A new Style object with the border rule unset. """ var new = self new.unset_attribute(BORDER_TOP_KEY) return new fn border_bottom(self, bottom: Bool) -> Style: """Sets the bottom border to be rendered or not. Args: bottom: Whether to apply the border to the bottom side. Returns: A new Style object with the border rule set. """ var new = self new.set_attribute(BORDER_BOTTOM_KEY, bottom) return new fn unset_border_bottom(self) -> Style: """Unsets the bottom border rule. Returns: A new Style object with the border rule unset. """ var new = self new.unset_attribute(BORDER_BOTTOM_KEY) return new fn border_left(self, left: Bool) -> Style: """Sets the left border to be rendered or not. Args: left: Whether to apply the border to the left side. Returns: A new Style object with the border rule set. """ var new = self new.set_attribute(BORDER_LEFT_KEY, left) return new fn unset_border_left(self) -> Style: """Unsets the left border rule. Returns: A new Style object with the border rule unset. """ var new = self new.unset_attribute(BORDER_LEFT_KEY) return new fn border_right(self, right: Bool) -> Style: """Sets the right border to be rendered or not. Args: right: Whether to apply the border to the right side. Returns: A new Style object with the border rule set. """ var new = self new.set_attribute(BORDER_RIGHT_KEY, right) return new fn unset_border_right(self) -> Style: """Unsets the right border rule. Returns: A new Style object with the border rule unset. """ var new = self new.unset_attribute(TAB_WIDTH_KEY) return new fn border_foreground(self, *colors: AnyTerminalColor) -> Style: """Set the border foreground color. Args: colors: The color to apply. Returns: A new Style object with the border foreground color rule set. """ var top: AnyTerminalColor = NoColor() var bottom: AnyTerminalColor = NoColor() var left: AnyTerminalColor = NoColor() var right: AnyTerminalColor = NoColor() var new = self var widths_specified = len(colors) if widths_specified == 1: top = colors[0] bottom = colors[0] left = colors[0] right = colors[0] elif widths_specified == 2: top = colors[0] bottom = colors[0] left = colors[1] right = colors[1] elif widths_specified == 3: top = colors[0] left = colors[1] right = colors[1] bottom = colors[2] elif widths_specified == 4: top = colors[0] right = colors[1] bottom = colors[2] left = colors[3] else: return new new.set_attribute(BORDER_TOP_FOREGROUND_KEY, top) new.set_attribute(BORDER_RIGHT_FOREGROUND_KEY, right) new.set_attribute(BORDER_BOTTOM_FOREGROUND_KEY, bottom) new.set_attribute(BORDER_LEFT_FOREGROUND_KEY, left) return new fn border_top_foreground(self, color: AnyTerminalColor) -> Style: """Set the top border foreground color. Args: color: The color to apply. Returns: A new Style object with the border foreground color rule set. """ var new = self new.properties = new.properties.set(BORDER_TOP_FOREGROUND_KEY) new._border_top_fg = color return new fn unset_border_top_foreground(self) -> Style: """Unsets the top border foreground rule. Returns: A new Style object with the border foreground rule unset. """ var new = self new.unset_attribute(BORDER_TOP_FOREGROUND_KEY) return new fn border_right_foreground(self, color: AnyTerminalColor) -> Style: """Set the right border foreground color. Args: color: The color to apply. Returns: A new Style object with the border foreground color rule set. """ var new = self new.properties = new.properties.set(BORDER_RIGHT_FOREGROUND_KEY) new._border_right_fg = color return new fn unset_border_right_foreground(self) -> Style: """Unsets the right border foreground rule. Returns: A new Style object with the border foreground rule unset. """ var new = self new.unset_attribute(BORDER_RIGHT_FOREGROUND_KEY) return new fn border_left_foreground(self, color: AnyTerminalColor) -> Style: """Set the left border foreground color. Args: color: The color to apply. Returns: A new Style object with the border foreground color rule set. """ var new = self new.properties = new.properties.set(BORDER_LEFT_FOREGROUND_KEY) new._border_left_fg = color return new fn unset_border_left_foreground(self) -> Style: """Unsets the left border foreground rule. Returns: A new Style object with the border foreground rule unset. """ var new = self new.unset_attribute(BORDER_LEFT_FOREGROUND_KEY) return new fn border_bottom_foreground(self, color: AnyTerminalColor) -> Style: """Set the bottom border foreground color. Args: color: The color to apply. Returns: A new Style object with the border foreground color rule set. """ var new = self new.properties = new.properties.set(BORDER_BOTTOM_FOREGROUND_KEY) new._border_bottom_fg = color return new fn unset_border_bottom_foreground(self) -> Style: """Unsets the bottom border foreground rule. Returns: A new Style object with the border foreground rule unset. """ var new = self new.unset_attribute(BORDER_BOTTOM_FOREGROUND_KEY) return new fn border_background(self, *colors: AnyTerminalColor) -> Style: """Set the border background color. Args: colors: The colors to apply. Returns: A new Style object with the border background color rule set. """ var top: AnyTerminalColor = NoColor() var bottom: AnyTerminalColor = NoColor() var left: AnyTerminalColor = NoColor() var right: AnyTerminalColor = NoColor() var new = self var widths_specified = len(colors) if widths_specified == 1: top = colors[0] bottom = colors[0] left = colors[0] right = colors[0] elif widths_specified == 2: top = colors[0] bottom = colors[0] left = colors[1] right = colors[1] elif widths_specified == 3: top = colors[0] left = colors[1] right = colors[1] bottom = colors[2] elif widths_specified == 4: top = colors[0] right = colors[1] bottom = colors[2] left = colors[3] else: return new new.set_attribute(BORDER_TOP_BACKGROUND_KEY, top) new.set_attribute(BORDER_RIGHT_BACKGROUND_KEY, right) new.set_attribute(BORDER_BOTTOM_BACKGROUND_KEY, bottom) new.set_attribute(BORDER_LEFT_BACKGROUND_KEY, left) return new fn border_top_background(self, color: AnyTerminalColor) -> Style: """Set the top border background color. Args: color: The color to apply. Returns: A new Style object with the border background color rule set. """ var new = self new.properties = new.properties.set(BORDER_TOP_BACKGROUND_KEY) new._border_top_bg = color return new fn unset_border_top_background(self) -> Style: """Unsets the top border background rule. Returns: A new Style object with the border background rule unset. """ var new = self new.unset_attribute(BORDER_TOP_BACKGROUND_KEY) return new fn border_right_background(self, color: AnyTerminalColor) -> Style: """Set the right border background color. Args: color: The color to apply. Returns: A new Style object with the border background color rule set. """ var new = self new.properties = new.properties.set(BORDER_RIGHT_BACKGROUND_KEY) new._border_right_bg = color return new fn unset_border_right_background(self) -> Style: """Unsets the right border background rule. Returns: A new Style object with the border background rule unset. """ var new = self new.unset_attribute(BORDER_RIGHT_BACKGROUND_KEY) return new fn border_left_background(self, color: AnyTerminalColor) -> Style: """Set the left border background color. Args: color: The color to apply. Returns: A new Style object with the border background color rule set. """ var new = self new.properties = new.properties.set(BORDER_LEFT_BACKGROUND_KEY) new._border_left_bg = color return new fn unset_border_left_background(self) -> Style: """Unsets the left border background rule. Returns: A new Style object with the border background rule unset. """ var new = self new.unset_attribute(BORDER_LEFT_BACKGROUND_KEY) return new fn border_bottom_background(self, color: AnyTerminalColor) -> Style: """Set the bottom border background color. Args: color: The color to apply. Returns: A new Style object with the border background color rule set. """ var new = self new.properties = new.properties.set(BORDER_BOTTOM_BACKGROUND_KEY) new._border_bottom_bg = color return new fn unset_border_bottom_background(self) -> Style: """Unsets the bottom border background rule. Returns: A new Style object with the border background rule unset. """ var new = self new.unset_attribute(BORDER_BOTTOM_BACKGROUND_KEY) return new fn padding(self, *widths: Int) -> Style: """Shorthand method for setting padding on all sides at once. With one argument, the value is applied to all sides. With two arguments, the value is applied to the vertical and horizontal sides, in that order. With three arguments, the value is applied to the top side, the horizontal sides, and the bottom side, in that order. With four arguments, the value is applied clockwise starting from the top side, followed by the right side, then the bottom, and finally the left. With more than four arguments no padding will be added. Args: widths: The padding widths to apply. """ var top = 0 var bottom = 0 var left = 0 var right = 0 var new = self var widths_specified = len(widths) if widths_specified == 1: top = widths[0] bottom = widths[0] left = widths[0] right = widths[0] elif widths_specified == 2: top = widths[0] bottom = widths[0] left = widths[1] right = widths[1] elif widths_specified == 3: top = widths[0] left = widths[1] right = widths[1] bottom = widths[2] elif widths_specified == 4: top = widths[0] right = widths[1] bottom = widths[2] left = widths[3] else: return new new.set_attribute(PADDING_TOP_KEY, top) new.set_attribute(PADDING_RIGHT_KEY, right) new.set_attribute(PADDING_BOTTOM_KEY, bottom) new.set_attribute(PADDING_LEFT_KEY, left) return new fn padding_top(self, width: Int) -> Style: """Set the padding on the top side. Args: width: The padding width to apply. Returns: A new Style object with the padding top rule set. """ var new = self new.set_attribute(PADDING_TOP_KEY, width) return new fn unset_padding_top(self) -> Style: """Unset the padding top rule. Returns: A new Style object with the padding top rule unset. """ var new = self new.unset_attribute(PADDING_TOP_KEY) return new fn padding_right(self, width: Int) -> Style: """Set the padding on the right side. Args: width: The padding width to apply. Returns: A new Style object with the padding right rule set. """ var new = self new.set_attribute(PADDING_RIGHT_KEY, width) return new fn unset_padding_right(self) -> Style: """Unset the padding right rule. Returns: A new Style object with the padding right rule unset. """ var new = self new.unset_attribute(PADDING_RIGHT_KEY) return new fn padding_bottom(self, width: Int) -> Style: """Set the padding on the bottom side. Args: width: The padding width to apply. Returns: A new Style object with the padding bottom rule set. """ var new = self new.set_attribute(PADDING_BOTTOM_KEY, width) return new fn unset_padding_bottom(self) -> Style: """Unset the padding bottom rule. Returns: A new Style object with the padding bottom rule unset. """ var new = self new.unset_attribute(PADDING_BOTTOM_KEY) return new fn padding_left(self, width: Int) -> Style: """Set the padding on the left side. Args: width: The padding width to apply. Returns: A new Style object with the padding left rule set. """ var new = self new.set_attribute(PADDING_LEFT_KEY, width) return new fn unset_padding_left(self) -> Style: """Unset the padding left rule. Returns: A new Style object with the padding left rule unset. """ var new = self new.unset_attribute(PADDING_LEFT_KEY) return new fn margin(self, *widths: Int) -> Style: """Shorthand method for setting padding on all sides at once. With one argument, the value is applied to all sides. With two arguments, the value is applied to the vertical and horizontal sides, in that order. With three arguments, the value is applied to the top side, the horizontal sides, and the bottom side, in that order. With four arguments, the value is applied clockwise starting from the top side, followed by the right side, then the bottom, and finally the left. With more than four arguments no padding will be added. Args: widths: The padding widths to apply. Returns: A new Style object with the margin rule set. """ var top = 0 var bottom = 0 var left = 0 var right = 0 var new = self var widths_specified = len(widths) if widths_specified == 1: top = widths[0] bottom = widths[0] left = widths[0] right = widths[0] elif widths_specified == 2: top = widths[0] bottom = widths[0] left = widths[1] right = widths[1] elif widths_specified == 3: top = widths[0] left = widths[1] right = widths[1] bottom = widths[2] elif widths_specified == 4: top = widths[0] right = widths[1] bottom = widths[2] left = widths[3] else: return new new.set_attribute(MARGIN_TOP_KEY, top) new.set_attribute(MARGIN_RIGHT_KEY, right) new.set_attribute(MARGIN_BOTTOM_KEY, bottom) new.set_attribute(MARGIN_LEFT_KEY, left) return new fn margin_top(self, width: Int) -> Style: """Set the margin on the top side. Args: width: The margin width to apply. Returns: A new Style object with the margin top rule set. """ var new = self new.set_attribute(MARGIN_TOP_KEY, width) return new fn unset_margin_top(self) -> Style: """Unset the margin top rule. Returns: A new Style object with the margin top rule unset. """ var new = self new.unset_attribute(MARGIN_TOP_KEY) return new fn margin_right(self, width: Int) -> Style: """Set the margin on the right side. Args: width: The margin width to apply. Returns: A new Style object with the margin right rule set. """ var new = self new.set_attribute(MARGIN_RIGHT_KEY, width) return new fn unset_margin_right(self) -> Style: """Unset the margin right rule. Returns: A new Style object with the margin right rule unset. """ var new = self new.unset_attribute(MARGIN_RIGHT_KEY) return new fn margin_bottom(self, width: Int) -> Style: """Set the margin on the bottom side. Args: width: The margin width to apply. Returns: A new Style object with the margin bottom rule set. """ var new = self new.set_attribute(MARGIN_BOTTOM_KEY, width) return new fn unset_margin_bottom(self) -> Style: """Unset the margin bottom rule. Returns: A new Style object with the margin bottom rule unset. """ var new = self new.unset_attribute(MARGIN_BOTTOM_KEY) return new fn margin_left(self, width: Int) -> Style: """Set the margin on the left side. Args: width: The margin width to apply. Returns: A new Style object with the margin left rule set. """ var new = self new.set_attribute(MARGIN_LEFT_KEY, width) return new fn unset_margin_left(self) -> Style: """Unset the margin left rule. Returns: A new Style object with the margin left rule unset. """ var new = self new.unset_attribute(MARGIN_LEFT_KEY) return new fn margin_background(self, color: AnyTerminalColor) -> Style: """Set the margin on the background color. Args: color: The margin width to apply. Returns: A new Style object with the margin background rule set. """ var new = self new.set_attribute(MARGIN_BACKGROUND_KEY, color) return new fn unset_margin_background(self) -> Style: """Unset the margin background rule. Returns: A new Style object with the margin background rule unset. """ var new = self new.unset_attribute(MARGIN_BACKGROUND_KEY) return new fn maybe_convert_tabs(self, text: String) -> String: """Convert tabs to spaces if the tab width is set. Args: text: The text to convert tabs in. Returns: The text with tabs converted to spaces. """ var DEFAULT_TAB_WIDTH = TAB_WIDTH if self.is_set(TAB_WIDTH_KEY): DEFAULT_TAB_WIDTH = self.get_as_int(TAB_WIDTH_KEY) if DEFAULT_TAB_WIDTH == -1: return text if DEFAULT_TAB_WIDTH == 0: return text.replace("\t", "") else: return text.replace("\t", (WHITESPACE * DEFAULT_TAB_WIDTH)) fn style_border(self, border: String, fg: AnyTerminalColor, bg: AnyTerminalColor) -> String: """Style a border with foreground and background colors. Args: border: The border to style. fg: The foreground color. bg: The background color. Returns: The styled border. """ if fg.isa[NoColor]() and bg.isa[NoColor](): return border var styler = mist.new_style() # Sooooo verbose compared to just passing the string value. But this is closer to the lipgloss API. # It's more verbose because we can't pass around args with trait as the arg type. if fg.isa[Color](): styler = styler.foreground(color=fg[Color].color(self.renderer)) elif fg.isa[ANSIColor](): styler = styler.foreground(color=fg[ANSIColor].color(self.renderer)) elif fg.isa[AdaptiveColor](): styler = styler.foreground(color=fg[AdaptiveColor].color(self.renderer)) elif fg.isa[CompleteColor](): styler = styler.foreground(color=fg[CompleteColor].color(self.renderer)) elif fg.isa[CompleteAdaptiveColor](): styler = styler.foreground(color=fg[CompleteAdaptiveColor].color(self.renderer)) if bg.isa[Color](): styler = styler.background(color=bg[Color].color(self.renderer)) elif bg.isa[ANSIColor](): styler = styler.background(color=bg[ANSIColor].color(self.renderer)) elif bg.isa[AdaptiveColor](): styler = styler.background(color=bg[AdaptiveColor].color(self.renderer)) elif bg.isa[CompleteColor](): styler = styler.background(color=bg[CompleteColor].color(self.renderer)) elif bg.isa[CompleteAdaptiveColor](): styler = styler.background(color=bg[CompleteAdaptiveColor].color(self.renderer)) return styler.render(border) fn apply_border(self, text: String) -> String: """Apply a border to the text. Args: text: The text to apply the border to. Returns: The text with the border applied. """ var top_set = self.is_set(BORDER_TOP_KEY) var right_set = self.is_set(BORDER_RIGHT_KEY) var bottom_set = self.is_set(BORDER_BOTTOM_KEY) var left_set = self.is_set(BORDER_LEFT_KEY) var border = self.get_border_style() var has_top = self.get_as_bool(BORDER_TOP_KEY) var has_right = self.get_as_bool(BORDER_RIGHT_KEY) var has_bottom = self.get_as_bool(BORDER_BOTTOM_KEY) var has_left = self.get_as_bool(BORDER_LEFT_KEY) # FG Colors var top_fg = self.get_as_color(BORDER_TOP_FOREGROUND_KEY) var right_fg = self.get_as_color(BORDER_RIGHT_FOREGROUND_KEY) var bottom_fg = self.get_as_color(BORDER_BOTTOM_FOREGROUND_KEY) var left_fg = self.get_as_color(BORDER_LEFT_FOREGROUND_KEY) # BG Colors var top_bg = self.get_as_color(BORDER_TOP_BACKGROUND_KEY) var right_bg = self.get_as_color(BORDER_RIGHT_BACKGROUND_KEY) var bottom_bg = self.get_as_color(BORDER_BOTTOM_BACKGROUND_KEY) var left_bg = self.get_as_color(BORDER_LEFT_BACKGROUND_KEY) # If a border is set and no sides have been specifically turned on or off # render borders on all sides. var borderless = NO_BORDER if border != borderless and not (top_set or right_set or bottom_set or left_set): has_top = True has_right = True has_bottom = True has_left = True # If no border is set or all borders are been disabled, abort. if border == borderless or (not has_top and not has_right and not has_bottom and not has_left): return text var lines: List[String] var width: Int lines, width = get_lines(text) if has_left: if border.left == "": border.left = " " width += printable_rune_width(border.left) if has_right and border.right == "": border.right = " " # If corners should be rendered but are set with the empty string, fill them # with a single space. if has_top and has_left and border.top_left == "": border.top_left = " " if has_top and has_right and border.top_right == "": border.top_right = " " if has_bottom and has_left and border.bottom_left == "": border.bottom_left = " " if has_bottom and has_right and border.bottom_right == "": border.bottom_right = " " # Figure out which corners we should actually be using based on which # sides are set to show. if has_top: if not has_left and not has_right: border.top_left = "" border.top_right = "" elif not has_left: border.top_left = "" elif not has_right: border.top_right = "" if has_bottom: if not has_left and not has_right: border.bottom_left = "" border.bottom_right = "" elif not has_left: border.bottom_left = "" elif not has_right: border.bottom_right = "" # TODO: Commenting out for now, later when unicode is supported, this should be limiting corner to 1 rune length # border.top_left = border.top_left[:1] # border.top_right = border.top_right[:1] # border.bottom_right = border.bottom_right[:1] # border.bottom_left = border.bottom_left[:1] var builder = StringBuilder(capacity=int(len(text) * 1.5)) # Render top if has_top: var top = render_horizontal_edge(border.top_left, border.top, border.top_right, width) top = self.style_border(top, top_fg, top_bg) _ = builder.write_string(top) _ = builder.write_string("\n") # Render sides var left_runes = List[String]() left_runes.append(border.left) var left_index = 0 var right_runes = List[String]() right_runes.append(border.right) var right_index = 0 for i in range(len(lines)): var line = lines[i] if has_left: var r = left_runes[left_index] left_index += 1 if left_index >= len(left_runes): left_index = 0 _ = builder.write_string(self.style_border(r, left_fg, left_bg)) _ = builder.write_string(line) if has_right: var r = right_runes[right_index] right_index += 1 if right_index >= len(right_runes): right_index = 0 _ = builder.write_string(self.style_border(r, right_fg, right_bg)) if i < len(lines) - 1: _ = builder.write_string("\n") # Render bottom if has_bottom: var bottom = render_horizontal_edge(border.bottom_left, border.bottom, border.bottom_right, width) bottom = self.style_border(bottom, bottom_fg, bottom_bg) _ = builder.write_string("\n") _ = builder.write_string(bottom) return str(builder) fn apply_margins(self, text: String, inline: Bool) -> String: var padded_text: String = text var top_margin = self.get_as_int(MARGIN_TOP_KEY) var right_margin = self.get_as_int(MARGIN_RIGHT_KEY) var bottom_margin = self.get_as_int(MARGIN_BOTTOM_KEY) var left_margin = self.get_as_int(MARGIN_LEFT_KEY) var styler = mist.new_style(self.renderer.color_profile.value) var bgc = self.get_as_color(MARGIN_BACKGROUND_KEY) # TODO: Dealing with variants is verbose :( if bgc.isa[Color](): styler = styler.background(color=bgc[Color].color(self.renderer)) elif bgc.isa[ANSIColor](): styler = styler.background(color=bgc[ANSIColor].color(self.renderer)) elif bgc.isa[AdaptiveColor](): styler = styler.background(color=bgc[AdaptiveColor].color(self.renderer)) elif bgc.isa[CompleteColor](): styler = styler.background(color=bgc[CompleteColor].color(self.renderer)) elif bgc.isa[CompleteAdaptiveColor](): styler = styler.background(color=bgc[CompleteAdaptiveColor].color(self.renderer)) # Add left and right margin padded_text = pad_left(padded_text, left_margin, styler) padded_text = pad_right(padded_text, right_margin, styler) # Top/bottom margin if not inline: var lines: List[String] var width: Int lines, width = get_lines(text) var spaces = WHITESPACE * width if top_margin > 0: padded_text = ((spaces + NEWLINE) * top_margin) + padded_text if bottom_margin > 0: padded_text += (NEWLINE + spaces) * bottom_margin return padded_text fn render(self, *texts: String) -> String: """Render the text with the style. Args: texts: The strings to render. Returns: The rendered text. """ # If style has internal string, add it first. Join arbitrary list of texts into a single string. var input_text: String = "" if self.value != "": input_text += self.value for i in range(len(texts)): input_text += texts[i] if i != len(texts) - 1: input_text += " " var term_style = mist.new_style(self.renderer.color_profile.value) var term_style_space = term_style var term_style_whitespace = term_style var bold = self.get_as_bool(BOLD_KEY, False) var italic = self.get_as_bool(ITALIC_KEY, False) var underline = self.get_as_bool(UNDERLINE_KEY, False) var crossout = self.get_as_bool(CROSSOUT_KEY, False) var reverse = self.get_as_bool(REVERSE_KEY, False) var blink = self.get_as_bool(BLINK_KEY, False) var faint = self.get_as_bool(FAINT_KEY, False) var fg = self.get_as_color(FOREGROUND_KEY) var bg = self.get_as_color(BACKGROUND_KEY) var width = self.get_as_int(WIDTH_KEY) var height = self.get_as_int(HEIGHT_KEY) var top_padding = self.get_as_int(PADDING_TOP_KEY) var right_padding = self.get_as_int(PADDING_RIGHT_KEY) var bottom_padding = self.get_as_int(PADDING_BOTTOM_KEY) var left_padding = self.get_as_int(PADDING_LEFT_KEY) var horizontal_align = self.get_as_position(HORIZONTAL_ALIGNMENT_KEY) var vertical_align = self.get_as_position(VERTICAL_ALIGNMENT_KEY) var color_whitespace = self.get_as_bool(COLOR_WHITESPACE_KEY, True) var inline = self.get_as_bool(INLINE_KEY, False) var max_width = self.get_as_int(MAX_WIDTH_KEY) var max_height = self.get_as_int(MAX_HEIGHT_KEY) var underline_spaces = underline and self.get_as_bool(UNDERLINE_SPACES_KEY, True) var crossout_spaces = crossout and self.get_as_bool(CROSSOUT_SPACES_KEY, True) # Do we need to style whitespace (padding and space outside paragraphs) separately? var use_whitespace_styler = reverse # Do we need to style spaces separately? var use_space_styler = underline_spaces or crossout_spaces # transform = self.get_as_transform("transform") # If no style properties are set, return the input text as is with tabs maybe converted. if not any(self.properties.value): return self.maybe_convert_tabs(input_text) if bold: term_style = term_style.bold() if italic: term_style = term_style.italic() if underline: term_style = term_style.underline() if reverse: term_style = term_style.reverse() term_style_whitespace = term_style_whitespace.reverse() if blink: term_style = term_style.blink() if faint: term_style = term_style.faint() if crossout: term_style = term_style.crossout() # TODO: Again super verbose and repetitive bc of Variant if fg.isa[Color](): var terminal_color = fg[Color].color(self.renderer) term_style = term_style.foreground(color=terminal_color) if use_space_styler: term_style_space = term_style_space.foreground(color=terminal_color) if use_whitespace_styler: term_style_whitespace = term_style_whitespace.foreground(color=terminal_color) elif fg.isa[ANSIColor](): var terminal_color = fg[ANSIColor].color(self.renderer) term_style = term_style.foreground(color=terminal_color) if use_space_styler: term_style_space = term_style_space.foreground(color=terminal_color) if use_whitespace_styler: term_style_whitespace = term_style_whitespace.foreground(color=terminal_color) elif fg.isa[AdaptiveColor](): var terminal_color = fg[AdaptiveColor].color(self.renderer) term_style = term_style.foreground(color=terminal_color) if use_space_styler: term_style_space = term_style_space.foreground(color=terminal_color) if use_whitespace_styler: term_style_whitespace = term_style_whitespace.foreground(color=terminal_color) elif fg.isa[CompleteColor](): var terminal_color = fg[CompleteColor].color(self.renderer) term_style = term_style.foreground(color=terminal_color) if use_space_styler: term_style_space = term_style_space.foreground(color=terminal_color) if use_whitespace_styler: term_style_whitespace = term_style_whitespace.foreground(color=terminal_color) elif fg.isa[CompleteAdaptiveColor](): var terminal_color = fg[CompleteAdaptiveColor].color(self.renderer) term_style = term_style.foreground(color=terminal_color) if use_space_styler: term_style_space = term_style_space.foreground(color=terminal_color) if use_whitespace_styler: term_style_whitespace = term_style_whitespace.foreground(color=terminal_color) if bg.isa[Color](): var terminal_color = bg[Color].color(self.renderer) term_style = term_style.background(color=terminal_color) if use_space_styler: term_style_space = term_style_space.background(color=terminal_color) if color_whitespace: term_style_whitespace = term_style_whitespace.background(color=terminal_color) elif bg.isa[ANSIColor](): var terminal_color = bg[ANSIColor].color(self.renderer) term_style = term_style.background(color=terminal_color) if use_space_styler: term_style_space = term_style_space.background(color=terminal_color) if color_whitespace: term_style_whitespace = term_style_whitespace.background(color=terminal_color) elif bg.isa[AdaptiveColor](): var terminal_color = bg[AdaptiveColor].color(self.renderer) term_style = term_style.background(color=terminal_color) if use_space_styler: term_style_space = term_style_space.background(color=terminal_color) if color_whitespace: term_style_whitespace = term_style_whitespace.background(color=terminal_color) elif bg.isa[CompleteColor](): var terminal_color = bg[CompleteColor].color(self.renderer) term_style = term_style.background(color=terminal_color) if use_space_styler: term_style_space = term_style_space.background(color=terminal_color) if color_whitespace: term_style_whitespace = term_style_whitespace.background(color=terminal_color) elif bg.isa[CompleteAdaptiveColor](): var terminal_color = bg[CompleteAdaptiveColor].color(self.renderer) term_style = term_style.background(color=terminal_color) if use_space_styler: term_style_space = term_style_space.background(color=terminal_color) if color_whitespace: term_style_whitespace = term_style_whitespace.background(color=terminal_color) if underline_spaces: term_style = term_style_space.underline() if crossout_spaces: term_style = term_style_space.crossout() if inline: input_text = input_text.replace("\n", "") # Word wrap if (not inline) and (width > 0): var wrap_at = width - left_padding - right_padding input_text = wordwrap(input_text, wrap_at) input_text = wrap(input_text, wrap_at) # force-wrap long strings input_text = self.maybe_convert_tabs(input_text) var builder = StringBuilder(capacity=int(len(input_text) * 1.5)) var lines = split(input_text, "\n") for i in range(len(lines)): if use_space_styler: # Look for spaces and apply a different styler for j in range(printable_rune_width(lines[i])): if lines[i][j] == " ": _ = builder.write_string(term_style_space.render(lines[i][j])) else: _ = builder.write_string(term_style.render(lines[i][j])) else: _ = builder.write_string(term_style.render(lines[i])) # Readd the newlines if i != len(lines) - 1: _ = builder.write_string("\n") var styled_text = str(builder) # Padding if not inline: if left_padding > 0: var style = mist.new_style(self.renderer.color_profile.value) if color_whitespace or use_whitespace_styler: style = term_style_whitespace styled_text = pad_left(styled_text, left_padding, style) if right_padding > 0: var style = mist.new_style(self.renderer.color_profile.value) if color_whitespace or use_whitespace_styler: style = term_style_whitespace styled_text = pad_right(styled_text, right_padding, style) if top_padding > 0: styled_text = (NEWLINE * top_padding) + styled_text if bottom_padding > 0: styled_text += NEWLINE * bottom_padding # Alignment if height > 0: styled_text = align_text_vertical(styled_text, vertical_align, height) # Truncate according to max_width if max_width > 0: var lines = split(styled_text, "\n") for i in range(len(lines)): lines[i] = truncate(lines[i], max_width) styled_text = join("\n", lines) # Truncate according to max_height if max_height > 0: var lines = split(styled_text, "\n") var truncated_lines = lines[0 : min(max_height, len(lines))] styled_text = join("\n", truncated_lines) # if transform: # return transform(styled_text) # Apply border at the end try: lines = styled_text.split("\n") except: lines = List[String](styled_text) var number_of_lines = len(lines) if not (number_of_lines == 0 and width == 0): var style = mist.new_style(self.renderer.color_profile.value) if color_whitespace or use_whitespace_styler: style = term_style_whitespace styled_text = align_text_horizontal(styled_text, horizontal_align, width, style) if not inline: styled_text = self.apply_border(styled_text) styled_text = self.apply_margins(styled_text, inline) return styled_text --- mog/table/__init__.mojo --- from .table import Table, default_styles, StyleFunction, new_table from .rows import StringData, Data, Filter --- mog/table/rows.mojo --- trait Data(CollectionElement): """Trait that wraps the basic methods of a table model.""" fn at(self, row: Int, cell: Int) -> String: """Returns the contents of the cell at the given index. Args: row: The row index. cell: The cell index. Returns: The contents of the cell at the given index. """ ... fn rows(self) -> Int: """Returns the number of rows in the table.""" ... fn columns(self) -> Int: """Returns the number of columns in the table.""" ... @value struct StringData(Data): """String-based implementation of the Data Trait. Example Usage: ```mojo import mog fn main(): var data = mog.StringData() data.append(List[String]("Name", "Age")) data.append(List[String]("My Name", "30")) data.append(List[String]("Your Name", "25")) data.append(List[String]("Their Name", "35")) print(data.at(1, 0), data.at(1, 1)) ``` """ var _rows: List[List[String]] var _columns: Int fn __init__(inout self, _rows: List[List[String]] = List[List[String]](), _columns: Int = 0): self._rows = _rows self._columns = _columns fn at(self, row: Int, cell: Int) -> String: """Returns the contents of the cell at the given index. Args: row: The row index. cell: The cell index. Returns: The contents of the cell at the given index. """ if row >= len(self._rows) or cell >= len(self._rows[row]): return "" return self._rows[row][cell] fn rows(self) -> Int: """Returns the number of rows in the table.""" return len(self._rows) fn columns(self) -> Int: """Returns the number of columns in the table.""" return self._columns fn append(inout self, row: List[String]): """Appends the given row to the table. Args: row: The row to append. """ self._columns = max(self._columns, len(row)) self._rows.append(row) fn item(inout self, rows: List[String]) -> Self: """Appends the given row to the table. Args: rows: The row to append. """ self._columns = max(self._columns, len(rows)) self._rows.append(rows) return self alias FilterFunction = fn (row: Int) -> Bool """FilterFunction is a function type that filters rows based on a condition.""" @value struct Filter[DataType: Data](Data): """Applies a filter function on some data.""" var data: DataType var filter_function: FilterFunction fn filter(self, data: Int) -> Bool: """Applies the given filter function to the data.""" return self.filter_function(data) fn at(self, row: Int, cell: Int) -> String: """Returns the contents of the cell at the given index. Args: row: The row index. cell: The cell index. Returns: The contents of the cell at the given index. """ var j: Int = 0 var i: Int = 0 while i < self.data.rows(): if self.filter(i): if j == row: return self.data.at(i, cell) j += 1 i += 1 return "" fn columns(self) -> Int: """Returns the number of columns in the table.""" return self.data.columns() fn rows(self) -> Int: """Returns the number of rows in the table.""" var j: Int = 0 var i: Int = 0 while i < self.data.rows(): if self.filter(i): j += 1 i += 1 return j --- mog/table/table.mojo --- from external.weave import truncate_with_tail from external.gojo.strings import StringBuilder from ..style import Style from ..border import ROUNDED_BORDER, Border from ..position import top, bottom, left, right, center from ..join import join_horizontal from ..size import get_height, get_width from .rows import StringData from .util import btoi, median, largest, sum fn trim_right(s: String, cutset: String) -> String: """Returns a slice of the string s, with all trailing Unicode code points contained in cutset removed. To remove a suffix, use [TrimSuffix] instead.""" var index = s.find(cutset) if index == -1: return s return s[:index] alias StyleFunction = fn (row: Int, col: Int) escaping -> Style """ StyleFunction is the style fntion that determines the style of a Cell. It takes the row and column of the cell as an input and determines the lipgloss Style to use for that cell position. Example Usage: ``` import mog fn main(): var header_style = mog.Style().bold() var even_row_style = mog.Style().italic() var odd_row_style = mog.Style().faint() fn styler(row: Int, col: Int) -> mog.Style: if row == 0: return header_style elif row%2 == 0: return even_row_style else: return odd_row_style var t = mog.new_table(). set_headers("Name", "Age"). row("Kini", "4"). row("Eli", "1"). row("Iris", "102"). style_function(styler) print(t) ``` . """ fn default_styles(row: Int, col: Int) -> Style: """Returns a new Style with no attributes. Args: row: The row of the cell. col: The column of the cell. Returns: A new Style with no attributes. """ return mog.Style() # TODO: Parametrize on data field, so other structs that implement `Data` can be used. For now it only support `StringData`. @value struct Table: """Used to model and render tabular data as a table. Example Usage: ``` import mog fn main(): var header_style = mog.Style().bold() var even_row_style = mog.Style().italic() var odd_row_style = mog.Style().faint() fn styler(row: Int, col: Int) -> mog.Style: if row == 0: return header_style elif row%2 == 0: return even_row_style else: return odd_row_style var t = mog.new_table(). set_headers("Name", "Age"). row("Kini", "4"). row("Eli", "1"). row("Iris", "102"). style_function(styler) print(t) ``` . """ var style_function: StyleFunction """The style function that determines the style of a cell. It returns a `mog.Style` for a given row and column position.""" var border: Border """The border style to use for the table.""" var border_top: Bool """Whether to render the top border of the table.""" var border_bottom: Bool """Whether to render the bottom border of the table.""" var border_left: Bool """Whether to render the left border of the table.""" var border_right: Bool """Whether to render the right border of the table.""" var border_header: Bool """Whether to render the header border of the table.""" var border_column: Bool """Whether to render the column border of the table.""" var border_row: Bool """Whether to render the row divider borders for each row of the table.""" var border_style: Style """The style to use for the border.""" var headers: List[String] """The headers of the table.""" var data: StringData """The data of the table.""" var width: Int """The width of the table.""" var height: Int """The height of the table.""" var offset: Int """The offset of the table.""" var widths: List[Int] """Tracks the width of each column.""" var heights: List[Int] """Tracks the height of each row.""" fn __init__( inout self, style_function: StyleFunction, border_style: Style, border: Border = ROUNDED_BORDER, border_top: Bool = True, border_bottom: Bool = True, border_left: Bool = True, border_right: Bool = True, border_header: Bool = True, border_column: Bool = True, border_row: Bool = False, headers: List[String] = List[String](), data: StringData = StringData(), width: Int = 0, height: Int = 0, ): """Initializes a new Table. Args: style_function: The style function that determines the style of a cell. border_style: The style to use for the border. border: The border style to use for the table. border_top: Whether to render the top border of the table. border_bottom: Whether to render the bottom border of the table. border_left: Whether to render the left border of the table. border_right: Whether to render the right border of the table. border_header: Whether to render the header border of the table. border_column: Whether to render the column border of the table. border_row: Whether to render the row divider borders for each row of the table. headers: The headers of the table. data: The data of the table. width: The width of the table. height: The height of the table. """ self.style_function = style_function self.border = border self.border_style = border_style self.border_top = border_top self.border_bottom = border_bottom self.border_left = border_left self.border_right = border_right self.border_header = border_header self.border_column = border_column self.border_row = border_row self.headers = headers self.data = data self.width = width self.height = height self.offset = 0 self.widths = List[Int]() self.heights = List[Int]() fn clear_rows(self) -> Table: """Clears the table rows.""" var new = self new.data = StringData() return new fn style(self, row: Int, col: Int) -> Style: """Returns the style for a cell based on it's position (row, column). Args: row: The row of the cell. col: The column of the cell. Returns: The style for the cell. """ return self.style_function(row, col) fn rows(self, *rows: List[String]) -> Table: """Returns the style for a cell based on it's position (row, column). Args: rows: The rows to add to the table. """ var new = self for i in range(len(rows)): new.data.append(rows[i]) return new fn rows(self, rows: List[List[String]]) -> Table: """Returns the style for a cell based on it's position (row, column). Args: rows: The rows to add to the table. """ var new = self for i in range(len(rows)): new.data.append(rows[i]) return new fn row(self, *row: String) -> Table: """Appends a row to the table data. Args: row: The row to append to the table. """ var new = self var temp = List[String](capacity=len(row)) for element in row: temp.append(element[]) new.data.append(temp) return new fn row(self, row: List[String]) -> Table: """Appends a row to the table data. Args: row: The row to append to the table. """ var new = self new.data.append(row) return new fn set_headers(self, *headers: String) -> Table: """Sets the table headers. Args: headers: The headers to set. """ var new = self var temp = List[String]() for element in headers: temp.append(element[]) new.headers = temp return new fn set_headers(self, headers: List[String]) -> Table: """Sets the table headers. Args: headers: The headers to set. """ var new = self new.headers = headers return new fn __str__(inout self) -> String: """Returns the table as a String.""" var has_headers = len(self.headers) > 0 var has_rows = self.data.rows() > 0 if not has_headers and not has_rows: return "" var builder = StringBuilder() # Add empty cells to the headers, until it's the same length as the longest # row (only if there are at headers in the first place). if has_headers: var i = len(self.headers) while i < self.data.columns(): self.headers.append("") i += 1 # Initialize the widths. var widths_len = max(len(self.headers), self.data.columns()) self.widths = List[Int](capacity=widths_len) for _ in range(widths_len): self.widths.append(0) var heights_len = btoi(has_headers) + self.data.rows() self.heights = List[Int](capacity=heights_len) for _ in range(heights_len): self.heights.append(0) # The style function may affect width of the table. It's possible to set # the StyleFunction after the headers and rows. Update the widths for a final # time. for i in range(len(self.headers)): self.widths[i] = get_width(self.style(0, i).render(self.headers[i])) self.heights[0] = get_height(self.style(0, i).render(self.headers[i])) var row_number: Int = 0 while row_number < self.data.rows(): var column_number: Int = 0 while column_number < self.data.columns(): var cell = self.data.at(row_number, column_number) var row_number_with_header_offset = row_number + btoi(has_headers) var rendered = self.style(row_number + 1, column_number).render(cell) self.heights[row_number_with_header_offset] = max( self.heights[row_number_with_header_offset], get_height(rendered), ) self.widths[column_number] = max(self.widths[column_number], get_width(rendered)) column_number += 1 row_number += 1 # Table Resizing Logic. # # Given a user defined table width, we must ensure the table is exactly that # width. This must account for all borders, column, separators, and column # data. # # In the case where the table is narrower than the specified table width, # we simply expand the columns evenly to fit the width. # For example, a table with 3 columns takes up 50 characters total, and the # width specified is 80, we expand each column by 10 characters, adding 30 # to the total width. # # In the case where the table is wider than the specified table width, we # _could_ simply shrink the columns evenly but this would result in data # being truncated (perhaps unnecessarily). The naive approach could result # in very poor cropping of the table data. So, instead of shrinking columns # evenly, we calculate the median non-whitespace length of each column, and # shrink the columns based on the largest median. # # For example, # ┌──────┬───────────────┬──────────┐ # │ Name │ Age of Person │ Location │ # ├──────┼───────────────┼──────────┤ # │ Kini │ 40 │ New York │ # │ Eli │ 30 │ London │ # │ Iris │ 20 │ Paris │ # └──────┴───────────────┴──────────┘ # # Median non-whitespace length vs column width of each column: # # Name: 4 / 5 # Age of Person: 2 / 15 # Location: 6 / 10 # # The biggest difference is 15 - 2, so we can shrink the 2nd column by 13. var width = self.compute_width() if width < self.width and self.width > 0: # Table is too narrow, expand the columns evenly until it reaches the # desired width. var i: Int = 0 while width < self.width: self.widths[i] += 1 width += 1 i = (i + 1) % len(self.widths) elif width > self.width and self.width > 0: # Table is too wide, calculate the median non-whitespace length of each # column, and shrink the columns based on the largest difference. var column_medians = List[Int](capacity=len(self.widths)) for i in range(len(self.widths)): var trimmed_width = List[Int](capacity=self.data.rows()) for r in range(self.data.rows()): var rendered_cell = self.style(r + btoi(has_headers), i).render(self.data.at(r, i)) var non_whitespace_chars = get_width(trim_right(rendered_cell, " ")) trimmed_width[r] = non_whitespace_chars + 1 column_medians[i] = median(trimmed_width) # Find the biggest differences between the median and the column width. # Shrink the columns based on the largest difference. var differences = List[Int](capacity=len(self.widths)) for i in range(len(self.widths)): differences[i] = self.widths[i] - column_medians[i] while width > self.width: var index: Int = 0 var val: Int = 0 index, val = largest(differences) if differences[index] < 1: break var shrink = min(differences[index], width - self.width) self.widths[index] -= shrink width -= shrink differences[index] = 0 # Table is still too wide, begin shrinking the columns based on the # largest column. while width > self.width: var index: Int = 0 var val: Int = 0 index, val = largest(self.widths) if self.widths[index] < 1: break self.widths[index] -= 1 width -= 1 if self.border_top: _ = builder.write_string(self.construct_top_border()) _ = builder.write_string("\n") if has_headers: _ = builder.write_string(self.construct_headers()) _ = builder.write_string("\n") var r = self.offset while r < self.data.rows(): _ = builder.write_string(self.construct_row(r)) r += 1 if self.border_bottom: _ = builder.write_string(self.construct_bottom_border()) return mog.Style().max_height(self.compute_height()).max_width(self.width).render(str(builder)) fn compute_width(self) -> Int: """Computes the width of the table in it's current configuration. Returns: The width of the table. """ var width = sum(self.widths) + btoi(self.border_left) + btoi(self.border_right) if self.border_column: width += len(self.widths) - 1 return width fn compute_height(self) -> Int: """Computes the height of the table in it's current configuration. Returns: The height of the table. """ var has_headers = len(self.headers) > 0 return ( sum(self.heights) - 1 + btoi(has_headers) + btoi(self.border_top) + btoi(self.border_bottom) + btoi(self.border_header) + self.data.rows() * btoi(self.border_row) ) # render fn render(inout self) -> String: """Returns the table as a String. Returns: The table as a string. """ return self.__str__() fn construct_top_border(self) -> String: """Constructs the top border for the table given it's current border configuration and data. Returns: The constructed top border as a string. """ var builder = StringBuilder() if self.border_left: _ = builder.write_string(self.border_style.render(self.border.top_left)) var i: Int = 0 while i < len(self.widths): _ = builder.write_string(self.border_style.render(self.border.top * self.widths[i])) if i < len(self.widths) - 1 and self.border_column: _ = builder.write_string(self.border_style.render(self.border.middle_top)) i += 1 if self.border_right: _ = builder.write_string(self.border_style.render(self.border.top_right)) return str(builder) fn construct_bottom_border(self) -> String: """Constructs the bottom border for the table given it's current border configuration and data. Returns: The constructed bottom border as a string. """ var builder = StringBuilder() if self.border_left: _ = builder.write_string(self.border_style.render(self.border.bottom_left)) var i: Int = 0 while i < len(self.widths): _ = builder.write_string(self.border_style.render(self.border.bottom * self.widths[i])) if i < len(self.widths) - 1 and self.border_column: _ = builder.write_string(self.border_style.render(self.border.middle_bottom)) i += 1 if self.border_right: _ = builder.write_string(self.border_style.render(self.border.bottom_right)) return str(builder) fn construct_headers(self) -> String: """Constructs the headers for the table given it's current header configuration and data. Returns: The constructed headers as a string. """ var builder = StringBuilder() if self.border_left: _ = builder.write_string(self.border_style.render(self.border.left)) for i in range(len(self.headers)): var header = self.headers[i] var style = self.style(0, i).max_height(1).width(self.widths[i]).max_width(self.widths[i]) _ = builder.write_string(style.render(truncate_with_tail(header, self.widths[i], "…"))) if (i < len(self.headers) - 1) and (self.border_column): _ = builder.write_string(self.border_style.render(self.border.left)) if self.border_header: if self.border_right: _ = builder.write_string(self.border_style.render(self.border.right)) _ = builder.write_string("\n") if self.border_left: _ = builder.write_string(self.border_style.render(self.border.middle_left)) var i: Int = 0 while i < len(self.headers): _ = builder.write_string(self.border_style.render(self.border.bottom * self.widths[i])) if i < len(self.headers) - 1 and self.border_column: _ = builder.write_string(self.border_style.render(self.border.middle)) i += 1 if self.border_right: _ = builder.write_string(self.border_style.render(self.border.middle_right)) if self.border_right and not self.border_header: _ = builder.write_string(self.border_style.render(self.border.right)) return str(builder) fn construct_row(self, index: Int) -> String: """Constructs the row for the table given an index and row data based on the current configuration. Args: index: The index of the row to construct. Returns: The constructed row as a string. """ var builder = StringBuilder() var has_headers = len(self.headers) > 0 var height = self.heights[index + btoi(has_headers)] var cells = List[String]() var left = (self.border_style.render(self.border.left) + "\n") * height if self.border_left: cells.append(left) var c: Int = 0 while c < self.data.columns(): var cell = self.data.at(index, c) var style = self.style(index + 1, c).height(height).max_height(height).width(self.widths[c]).max_width( self.widths[c] ) cells.append(style.render(truncate_with_tail(cell, UInt8(self.widths[c] * height), "…"))) if c < self.data.columns() - 1 and self.border_column: cells.append(left) c += 1 if self.border_right: var right = (self.border_style.render(self.border.right) + "\n") * height cells.append(right) for i in range(len(cells)): var cell = cells[i] cells[i] = trim_right(cell, "\n") _ = builder.write_string(join_horizontal(position.top, cells) + "\n") if self.border_row and index < self.data.rows() - 1: _ = builder.write_string(self.border_style.render(self.border.middle_left)) var i: Int = 0 while i < len(self.widths): _ = builder.write_string(self.border_style.render(self.border.middle * self.widths[i])) if i < len(self.widths) - 1 and self.border_column: _ = builder.write_string(self.border_style.render(self.border.middle)) i += 1 _ = builder.write_string(self.border_style.render(self.border.middle_right) + "\n") return str(builder) fn new_table() -> Table: """Returns a new Table, this is to bypass the compiler limitation on these args having default values. It seems like argument default values are handled at compile time, and mog Styles are not compile time constants, UNLESS a profile is specified ahead of time. """ return Table(style_function=default_styles, border_style=mog.Style()) --- mog/table/util.mojo --- fn btoi(b: Bool) -> Int: """Converts a boolean to an integer, 1 if true, 0 if false.""" if b: return 1 return 0 fn sum(numbers: List[Int]) -> Int: """Returns the sum of all integers in a slice.""" var sum: Int = 0 for i in range(len(numbers)): sum += numbers[i] return sum fn median(n: List[Int]) -> Int: """Returns the median of a slice of integers.""" var sorted = n sort(sorted) if len(sorted) <= 0: return 0 if len(sorted) % 2 == 0: var middle = len(sorted) / 2 var median = (sorted[int(middle) - 1] + sorted[int(middle)]) / 2 return int(round(median)) return sorted[int(len(sorted) / 2)] fn largest(numbers: List[Int]) -> (Int, Int): """Returns the largest element and it's index from a slice of integers.""" var largest: Int = 0 var index: Int = 0 for i in range(len(numbers)): var element = numbers[i] if numbers[i] > numbers[index]: largest = element index = i return index, largest --- mog/whitespace.mojo --- from bit import countl_zero import external.mist import external.weave.ansi from external.gojo.strings import StringBuilder from external.gojo.unicode import UnicodeString from .renderer import Renderer from .color import ( TerminalColor, NoColor, Color, AdaptiveColor, ANSIColor, CompleteColor, CompleteAdaptiveColor, ) from .position import Position @value struct WhiteSpace: """Whitespace renderer. Args: renderer: The renderer to use. style: The style to use. chars: The characters to render. """ var renderer: Renderer var style: mist.Style var chars: String fn __init__( inout self, renderer: Renderer, style: mist.Style, chars: String = "", ): """Initializes a new whitespace renderer. Args: renderer: The renderer to use. style: The style to use. chars: The characters to render. """ self.renderer = renderer self.style = style self.chars = chars fn render(inout self, width: Int) -> String: """Render whitespaces. Args: width: The width of the whitespace. Returns: The rendered whitespace. """ if self.chars == "": self.chars = " " var j = 0 var b = StringBuilder() # Cycle through runes and print them into the whitespace. var i = 0 while i < width: var uni_str = UnicodeString(self.chars) for char in uni_str: _ = b.write_string(char) var printable_width = ansi.printable_rune_width(char) if j >= printable_width: j = 0 # If we hit the width of the block, break the loop back up to the top while, which will end. i += printable_width if i >= width: break # Fill any extra gaps white spaces. This might be necessary if any runes # are more than one cell wide, which could leave a one-rune gap. var short = width - ansi.printable_rune_width(str(b)) if short > 0: _ = b.write_string(WHITESPACE * short) return self.style.render(str(b)) # WhitespaceOption sets a styling rule for rendering whitespace. alias WhitespaceOption = fn (inout w: WhiteSpace) -> None fn new_whitespace(renderer: Renderer, *opts: WhitespaceOption) -> WhiteSpace: """Creates a new whitespace renderer. The order of the options matters, if you're using WithWhitespaceRenderer, make sure it comes first as other options might depend on it.""" var w = WhiteSpace(renderer=renderer, style=mist.new_style(renderer.color_profile.value)) for opt in opts: opt(w) return w # TODO: Temporary until until args unpacking is supported. fn new_whitespace(renderer: Renderer, opts: List[WhitespaceOption]) -> WhiteSpace: """Creates a new whitespace renderer. The order of the options matters, if you're using WithWhitespaceRenderer, make sure it comes first as other options might depend on it.""" var w = WhiteSpace(renderer=renderer, style=mist.new_style(renderer.color_profile.value)) for opt in opts: opt[](w) return w # Limited to using param for now due to Mojo crashing when using capturing functions. fn with_whitespace_foreground[terminal_color: AnyTerminalColor]() -> WhitespaceOption: """Sets the color of the characters in the whitespace.""" fn style_foreground(inout w: WhiteSpace) -> None: var color: mist.AnyColor = mist.NoColor() if terminal_color.isa[NoColor](): return None if terminal_color.isa[Color](): color = terminal_color[Color].color(w.renderer) elif terminal_color.isa[ANSIColor](): color = terminal_color[ANSIColor].color(w.renderer) elif terminal_color.isa[AdaptiveColor](): color = terminal_color[AdaptiveColor].color(w.renderer) elif terminal_color.isa[CompleteColor](): color = terminal_color[CompleteColor].color(w.renderer) elif terminal_color.isa[CompleteAdaptiveColor](): color = terminal_color[CompleteAdaptiveColor].color(w.renderer) w.style = w.style.foreground(color=color) return style_foreground fn with_whitespace_background[terminal_color: AnyTerminalColor]() -> WhitespaceOption: """Sets the background color of the whitespace.""" fn style_background(inout w: WhiteSpace) -> None: var color: mist.AnyColor = mist.NoColor() if terminal_color.isa[NoColor](): return None if terminal_color.isa[Color](): color = terminal_color[Color].color(w.renderer) elif terminal_color.isa[ANSIColor](): color = terminal_color[ANSIColor].color(w.renderer) elif terminal_color.isa[AdaptiveColor](): color = terminal_color[AdaptiveColor].color(w.renderer) elif terminal_color.isa[CompleteColor](): color = terminal_color[CompleteColor].color(w.renderer) elif terminal_color.isa[CompleteAdaptiveColor](): color = terminal_color[CompleteAdaptiveColor].color(w.renderer) w.style = w.style.background(color=color) return style_background fn with_whitespace_chars[s: String]() -> WhitespaceOption: """Sets the characters to be rendered in the whitespace.""" fn whitespace_with_chars(inout w: WhiteSpace) -> None: w.chars = s return whitespace_with_chars # Causes a compiler error at os.getenv() # alias DEFAULT_RENDERER = Renderer() fn place( width: Int, height: Int, hPos: Position, vPos: Position, text: String, /, *opts: WhitespaceOption, ) -> String: """Places a string or text block vertically in an unstyled box of a given width or height. Args: width: The width of the box. height: The height of the box. hPos: The horizontal position of the text. vPos: The vertical position of the text. text: The text to place. opts: The options to style the whitespace. Returns: The text placed in the box. """ var options = List[WhitespaceOption]() for opt in opts: options.append(opt) return Renderer().place(width, height, hPos, vPos, text, options) # TODO: Temp until arg unpacking fn place( width: Int, height: Int, hPos: Position, vPos: Position, text: String, opts: List[WhitespaceOption], ) raises -> String: """Places a string or text block vertically in an unstyled box of a given width or height. Args: width: The width of the box. height: The height of the box. hPos: The horizontal position of the text. vPos: The vertical position of the text. text: The text to place. opts: The options to style the whitespace. Returns: The text placed in the box. """ return Renderer().place(width, height, hPos, vPos, text, opts) fn place_horizontal(width: Int, pos: Position, text: String, *opts: WhitespaceOption) raises -> String: """Places a string or text block horizontally in an unstyled block of a given width. If the given width is shorter than the max width of the string (measured by its longest line) this will be a noop. Args: width: The width of the box. pos: The position of the text. text: The text to place. opts: The options to style the whitespace. Returns: The text placed in the box. """ var options = List[WhitespaceOption]() for opt in opts: options.append(opt) return Renderer().place_horizontal(width, pos, text, options) # TODO: Temp until arg unpacking fn place_horizontal(width: Int, pos: Position, text: String, opts: List[WhitespaceOption]) raises -> String: """Places a string or text block horizontally in an unstyled block of a given width. If the given width is shorter than the max width of the string (measured by its longest line) this will be a noop. Args: width: The width of the box. pos: The position of the text. text: The text to place. opts: The options to style the whitespace. Returns: The text placed in the box. """ return Renderer().place_horizontal(width, pos, text, opts) fn place_vertical(height: Int, pos: Position, text: String, *opts: WhitespaceOption) raises -> String: """Places a string or text block vertically in an unstyled block of a given height. If the given height is shorter than the height of the string (measured by its newlines) then this will be a noop. Args: height: The height of the box. pos: The position of the text. text: The text to place. opts: The options to style the whitespace. Returns: The text placed in the box. """ var options = List[WhitespaceOption]() for opt in opts: options.append(opt) return Renderer().place_vertical(height, pos, text, options) # TODO: Temp until arg unpacking fn place_vertical(height: Int, pos: Position, text: String, opts: List[WhitespaceOption]) raises -> String: """Places a string or text block vertically in an unstyled block of a given height. If the given height is shorter than the height of the string (measured by its newlines) then this will be a noop. Args: height: The height of the box. pos: The position of the text. text: The text to place. opts: The options to style the whitespace. Returns: The text placed in the box. """ return Renderer().place_vertical(height, pos, text, opts) --- run_examples.sh --- #!/bin/bash mkdir ./temp mojo package mog -I ./external -o ./temp/mog.mojopkg echo -e "Building binaries for all examples...\n" mojo build examples/readme/basic.mojo -o temp/basic mojo build examples/readme/layout.mojo -o temp/layout mojo build examples/table/ansi.mojo -o temp/ansi echo -e "Executing examples...\n" cd temp ./basic ./layout ./ansi cd .. rm -R ./temp --- tests/__init__.mojo --- --- tests/integration/__init__.mojo --- --- tests/integration/test_mog.mojo --- from tests.wrapper import MojoTest from mog.join import join_vertical, join_horizontal from mog.table import new_table, Table, StringData from mog.table.table import default_styles from mog.border import ( STAR_BORDER, ASCII_BORDER, Border, ROUNDED_BORDER, HIDDEN_BORDER, ) from mog.style import Style from mog import position import mog from time import now fn dummy_style_func(row: Int, col: Int) -> Style: var style = mog.Style().horizontal_alignment(position.center).vertical_alignment(position.center).padding(0, 1) if row == 0: style = style.foreground(mog.Color(0xC9A0DC)) return style elif row % 2 == 0: style = style.foreground(mog.Color(0xE58006)) return style else: return style fn test_table() raises: var test = MojoTest("Testing table creation with and without headers") var border_style = mog.Style().foreground(mog.Color(0x39E506)) var table = Table( style_function=default_styles, border=ROUNDED_BORDER, border_style=border_style, border_bottom=True, border_column=True, border_header=True, border_left=True, border_right=True, border_top=True, data=StringData(), width=50, ) table.style_function = dummy_style_func table = table.row("French", "Bonjour", "Salut").row("Russian", "Zdravstvuyte", "Privet") var headerless_start_time = now() print(table.render()) var headerless_execution_time = now() - headerless_start_time table = table.set_headers("LANGUAGE", "FORMAL", "INFORMAL") var headered_start_time = now() print(table.render()) var headered_execution_time = now() - headerless_start_time print( "Headerless Execution Time: ", headerless_execution_time, headerless_execution_time / 1e9, ) print( "Headered Execution Time: ", headered_execution_time, headered_execution_time / 1e9, ) fn test_horizontal_joined_paragraphs() raises: var test = MojoTest("Testing Style rendering") var style_build_start = now() var style = mog.Style().bold().width(50).padding(1, 1, 1, 1).horizontal_alignment(position.center).border( ROUNDED_BORDER ).foreground(mog.Color(0xC9A0DC)).border_foreground(mog.Color(0x39E506)) var style_build_duration = now() - style_build_start print("Style build duration: ", style_build_duration, style_build_duration / 1e9) var start_time = now() print(style.render("You should be able to join blocks of different heights")) print( join_horizontal( position.top, style.render("You should be able to join blocks of different heights"), style.render( "Hello World!\nThis is a test of the mog style system. Which" " can wrap lines that are longer than the limit.\n\nYep." ), style.render( "This is to validate that more than three blocks can be" " joined.\nI hope this works!\n Lines that are longer than the" " limit can be a pain.\n\nSome more text." ), ) ) print( join_horizontal( position.bottom, style.render("You should be able to join blocks of different heights"), style.render( "Hello World!\nThis is a test of the mog style system. Which" " can wrap lines that are longer than the limit.\n\nYep." ), style.render( "This is to validate that more than three blocks can be" " joined.\nI hope this works!\n Lines that are longer than the" " limit can be a pain.\n\nSome more text." ), ) ) print( join_horizontal( position.center, style.render("You should be able to join blocks of different heights"), style.render( "Hello World!\nThis is a test of the mog style system. Which" " can wrap lines that are longer than the limit.\n\nYep." ), style.render( "This is to validate that more than three blocks can be" " joined.\nI hope this works!\n Lines that are longer than the" " limit can be a pain.\n\nSome more text." ), ) ) var execution_time = now() - start_time print("Block execution time: ", execution_time, execution_time / 1e9) fn test_borderless_paragraph() raises: var borderless_style = mog.Style().width(50).padding(1, 2).horizontal_alignment(position.center).border( HIDDEN_BORDER ).background(mog.Color(0xC9A0DC)) print( join_horizontal( position.center, borderless_style.render("You should be able to join blocks of different heights"), borderless_style.render( "Hello World!\nThis is a test of the mog style system. Which" " can wrap lines that are longer than the limit.\n\nYep." ), borderless_style.render( "This is to validate that more than three blocks can be" " joined.\nI hope this works!\n Lines that are longer than the" " limit can be a pain.\n\nSome more text." ), ) ) fn main() raises: var start_test = now() test_horizontal_joined_paragraphs() var test_duration = now() - start_test print("Test duration: ", test_duration, test_duration / 1e9) test_borderless_paragraph() test_table() --- tests/unit/__init__.mojo --- --- tests/unit/test_align.mojo --- from tests.wrapper import MojoTest from mog.align import align_text_horizontal, align_text_vertical import external.mist import mog.position fn test_align_text_horizontal() raises: var test = MojoTest("Testing align.align_text_horizontal") var style = mist.new_style() # Test center alignment var centered = align_text_horizontal("hello", position.center, 10) # print(centered) test.assert_equal(centered, " hello ") # Test left alignment var left = align_text_horizontal("hello", position.left, 10, style) # print(left) test.assert_equal(left, "hello ") # Test right alignment var right = align_text_horizontal("hello", position.right, 10) # print(right) test.assert_equal(right, " hello") fn test_align_text_vertical() raises: var test = MojoTest("Testing align.align_text_vertical") # Test center alignment var centered = align_text_vertical("hello", position.center, 3) # print(centered) test.assert_equal(centered, "\nhello\n") # Test top alignment var top = align_text_vertical("hello", position.top, 3) # print(top) test.assert_equal(top, "hello\n\n") # Test bottom alignment var bottom = align_text_vertical("hello", position.bottom, 5) # print(bottom) test.assert_equal(bottom, "\n\n\n\nhello") fn main() raises: test_align_text_horizontal() test_align_text_vertical() --- tests/unit/test_join.mojo --- from tests.wrapper import MojoTest from mog.join import join_horizontal, join_vertical import mog.position fn test_horizontal_join() raises: var test = MojoTest("Testing join.horizontal_join") var a = "Hello World!\nThis is an example." var b = "I could be more creative.\nBut, I'm out of ideas." # Test horizontally joining three paragraphs along their bottom edges var bottom_aligned = join_horizontal(position.bottom, a, b) # print(bottom_aligned) test.assert_equal( bottom_aligned, "Hello World! I could be more creative.\nThis is an example.But, I'm out of ideas. ", ) var top_aligned = join_horizontal(position.top, a, b) # print(top_aligned) test.assert_equal( top_aligned, "Hello World! I could be more creative.\nThis is an example.But, I'm out of ideas. ", ) var center_aligned = join_horizontal(position.center, a, b) # print(center_aligned) test.assert_equal( center_aligned, "Hello World! I could be more creative.\nThis is an example.But, I'm out of ideas. ", ) fn test_vertical_join() raises: var test = MojoTest("Testing join.vertical_join") var a = "Hello World!\nThis is an example." var b = "I could be more creative.\nBut, I'm out of ideas." # Test vertically joining two paragraphs along their right border var right_aligned = join_vertical(position.right, a, b) # print(right_aligned) test.assert_equal( right_aligned, " Hello World!\n This is an example.\nI could be more creative.\n But, I'm out of ideas.", ) # Test vertically joining two paragraphs along their left border var left_aligned = join_vertical(position.left, a, b) # print(left_aligned) test.assert_equal( left_aligned, "Hello World! \nThis is an example. \nI could be more creative.\nBut, I'm out of ideas. ", ) # Test vertically joining two paragraphs along their center axis var center_aligned = join_vertical(position.center, a, b) # print(center_aligned) test.assert_equal( center_aligned, " Hello World! \n This is an example. \nI could be more creative.\n But, I'm out of ideas. ", ) fn main() raises: test_horizontal_join() test_vertical_join() --- tests/unit/test_size.mojo --- from tests.wrapper import MojoTest from mog.size import get_height, get_width, get_size fn test_get_height() raises: var test = MojoTest("Testing size.get_height") var text = "This\nis\na\ntest\nstring" test.assert_equal(get_height(text), 5) fn test_get_width() raises: var test = MojoTest("Testing size.get_width") var text = "This\nis\na\ntest\nstring" test.assert_equal(get_width(text), 6) fn test_get_size() raises: var test = MojoTest("Testing size.get_size") var text = "This\nis\na\ntest\nstring" var height: Int var width: Int width, height = get_size(text) test.assert_equal(width, 6) test.assert_equal(height, 5) fn main() raises: test_get_height() test_get_width() test_get_size() --- tests/wrapper.mojo --- from testing import testing @value struct MojoTest: """ A utility struct for testing. """ var test_name: String fn __init__(inout self, test_name: String): self.test_name = test_name print("# " + test_name) fn assert_true(self, cond: Bool, message: String = ""): try: if message == "": testing.assert_true(cond) else: testing.assert_true(cond, message) except e: print(e) fn assert_false(self, cond: Bool, message: String = ""): try: if message == "": testing.assert_false(cond) else: testing.assert_false(cond, message) except e: print(e) fn assert_equal[T: testing.Testable](self, left: T, right: T): try: testing.assert_equal(left, right) except e: print(e) --- .gitignore.txt --- # Temporary and binary files *~ *.py[cod] *.so *.cfg !.isort.cfg !setup.cfg *.orig *.log *.pot __pycache__/* .cache/* .*.swp */.ipynb_checkpoints/* .DS_Store # Project files .ropeproject .project .pydevproject .settings .idea .vscode tags # Package files *.egg *.eggs/ .installed.cfg *.egg-info # Unittest and coverage htmlcov/* .coverage .coverage.* .tox junit*.xml coverage.xml .pytest_cache/ # Build and docs folder/files build/* dist/* sdist/* docs/api/* docs/_rst/* docs/_build/* cover/* MANIFEST # Per-project virtualenvs .venv*/ .conda*/ .python-version *.iml !algorithm/__pycache__/fib.cpython-311.pyc --- CNAME.txt --- awesome.mojo-lang.dev --- README.md.txt --- # Awesome Mojo🔥 ![Mojo](img/mojo.png) Mojo 🔥 — a new programming language for all developers, AI/ML scientists and software engineers. A curated list of awesome Mojo🔥 code, problem-solving, solution, and in future libraries, frameworks, software and resources. Let's accumulate here very new technology knowledge and best practices. * [Awesome Mojo🔥](https://github.com/ego/awesome-mojo) * [Mojo 🔥Driven Community](https://mojo-lang.dev) * [Official Mojo docs](https://docs.modular.com/mojo/) Mojo is a programming language that combines the user-friendliness of Python with the performance capabilities of C++ and Rust. Additionally, Mojo enables users to harness the vast ecosystem of Python libraries. In a brief * Mojo allows you to leverage the entire Python ecosystem. * Mojo is designed to become a superset of Python. * Make Mojo compatible with existing Python programs. * Mojo as a member of the Python family. * Applied for AI systems and AI field. * Scalable programming for heterogeneous systems. * Building unify the world’s ML/AI infrastructure. * Innovations in compiler internals. * Support for current and emerging hardware accelerators. * Systems programming features. * Leverage the existing MLIR compiler ecosystem. # Hello Mojo🔥 Mojo is a new programming language that bridges the gap between research and production by combining the best of Python syntax with systems programming and metaprogramming. `hello.mojo` or `hello.🔥` the file extension can be an emoji! * [Hello Mojo 🔥](algorithm/HelloMojo.🔥) You can read more about why Modular doing this [Why Mojo🔥](https://docs.modular.com/mojo/why-mojo.html) > What we wanted was an innovative and scalable programming model that could target accelerators and other heterogeneous > systems that are pervasive in the AI field. > ... > Applied AI systems need to address all these issues, and we decided there was no reason it couldn’t be done with just > one language. Thus, Mojo was born. But Python has done its job very well =) > We didn’t see any need to innovate in language syntax or community. > So we chose to embrace the Python ecosystem because it is so widely used, it is loved by the AI ecosystem, and because > we believe it is a really nice language. ## Why is it called Mojo? > Mojo🔥 means “a magical charm” or “magical powers.” > We thought this was a fitting name for a language that brings magical powers to Python :python:, > including unlocking an innovative programming model for accelerators and other heterogeneous systems pervasive in AI today. **Guido van Rossum** [benevolent dictator for life](https://en.wikipedia.org/wiki/Guido_van_Rossum) and **Christopher Arthur Lattner** [distinguished inventor, creator and well-known leader](https://en.wikipedia.org/wiki/Chris_Lattner) about Mojo🔥pronunciation =) <img src="img/guido-chris.png" width="300" /> <img src="img/gvanrossum.png" height="200" /> According to the description * [Mojo word definition](https://duckduckgo.com/?q=mojo&ia=definition&iax=definition) * [Mojo sound](mojo_American_English_pronunciation.mp3) # Background and influenced by Who knows that these programming languages will be very happy, because Mojo benefits from tremendous lessons learned from other [languages](https://en.wikipedia.org/wiki/History_of_programming_languages) Rust, Swift, Julia, Zig, Nim, etc. * Rust starts the C revolution and now [Rust in the Linux kernel](https://docs.kernel.org/rust/index.html). * [Swift](https://www.swift.org) makes [Apple beautiful](https://developer.apple.com/swift/) from a technical perspective. * [Julia](https://julialang.org) high performance. * [Nim](https://nim-lang.org) systems programming language. * [Zig](https://ziglang.org) general-purpose programming language. We are like and following it =) ![Mojo](img/speed.png) # News [new] * Github now auto-detects Mojo code 🔥! <img src="img/mojo_lang_github.png" width="300" /> * [Simple and fast HTTP framework for Mojo! 🔥 Perfect for building web services and simple APIs. For Mojicians](https://github.com/saviorand/lightbug_http) * [LLama implementations benchmarking framework](https://github.com/tairov/lamatune) * [Automated Python to Mojo code translation](https://github.com/msaelices/py2mojo) * [Programming Language DataBase Research](lang/pldb.pub.md) * October 19, 2023 [Mojo🔥 is now available on Mac!](https://www.modular.com/blog/mojo-is-now-available-on-mac) [Use developer console](https://developer.modular.com/download) * [Chris Lattner: Future of Programming and AI | Lex Fridman Podcast #381](https://www.youtube.com/watch?v=pdJQ8iVTwj8) * [Mojo and Python type system explained | Chris Lattner and Lex Fridman](https://www.youtube.com/watch?v=0VCq8jJjAPc) * [Can Mojo run Python code? | Chris Lattner and Lex Fridman](https://www.youtube.com/watch?v=99hRAvk3wIk) * [Switching from Python to Mojo programming language | Chris Lattner and Lex Fridman](https://www.youtube.com/watch?v=7wo4vyB7l3s) * New [GitHub Topic mojo-lang](https://github.com/topics/mojo-lang). So you can follow it. <img src="img/GitHub-Topic-Mojo-Lang.png" height="200" /> * [Guido van Rossum about Mojo = Python with C++/GPU performance?](https://discuss.python.org/t/mojo-python-with-c-gpu-performance/26993/6) <img src="img/guido-cpython-mojo.png" height="200" /> * [Tensor struct with some basic ops #251](https://github.com/modularml/mojo/discussions/251) * [Matrix fn with numpy #267](https://github.com/modularml/mojo/discussions/267) * Updates about `lambda` and `parameter` [Closures and higer order functions in mojo #244](https://github.com/modularml/mojo/discussions/244#discussioncomment-6008071) * May-25-2023, Guido van Rossum (gvanrossum#8415), creator and emeritus BDFL of Python, visit the Mojo🔥 public [Discord Chat](https://www.discord.gg/modular) * [Waiting for a Mojo🔥 syntax highlighting at GitHub](https://github.com/github-linguist/linguist/pull/6400) * [New Mojo🔥release 2023-05-24](https://docs.modular.com/mojo/changelog.html#section) [old] Mojo🔥 * [Changelog](https://docs.modular.com/mojo/changelog.html) * [Discussions](https://github.com/modularml/mojo/discussions?discussions_q=is%3Aopen) * [Issues](https://github.com/modularml/mojo/issues) # Benchmarks ## Tools * [hyperfine](https://github.com/sharkdp/hyperfine) a command-line benchmarking tool ```shell brew install hyperfine ``` * [macchina](https://github.com/Macchina-CLI/macchina) a system information frontend with an emphasis on performance. ```shell brew install macchina ``` * Python3 libs for plots ```shell pip3 install numpy matplotlib scipy ``` * Code to image PNG ```shell brew install silicon ``` ## Benchmarking environment <img src="benchmarks/macchina-sys-info.png" width="800" /> Python / Mojo / Codon / Rust versions ```shell > python3 --version Python 3.11.6 > mojo --version mojo 0.4.0 (9e33b013) > codon --version 0.16.3 > rustc --version rustc 1.65.0-nightly (9243168fa 2022-08-31) ``` ## [Fibonacci Sequence](https://en.wikipedia.org/wiki/Fibonacci_sequence) Lets find Fibonacci Sequence where **N = 100** ### [Python Fibonacci Sequence Recursion](benchmarks/fibonacci_sequence/python_recursion.py) ```python def fibonacci_recursion(n): return n if n < 2 else fibonacci_recursion(n - 1) + fibonacci_recursion(n - 2) fibonacci_recursion(100) ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json python_recursion.json 'python3 benchmarks/fibonacci_sequence/python_recursion.py' ``` **RESULT: TIMEOUT, I canceled computation after 1m** ### [Python Fibonacci Sequence Iteration](benchmarks/fibonacci_sequence/python_iteration.py) ```python def fibonacci_iteration(n): a, b = 0, 1 for _ in range(n): a, b = b, a+b return a fibonacci_iteration(100) ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/python_iteration.json 'python3 benchmarks/fibonacci_sequence/python_iteration.py' ``` **RESULT**:\ Benchmark 1: python3 benchmarks/fibonacci_sequence/python_iteration.py\ Time (mean ± σ): 16374.7 µs ± 904.0 µs [User: 11483.5 µs, System: 3680.0 µs]\ Range (min … max): 15361.0 µs … 22863.3 µs 100 runs ### Compile Python byte code ```shell python3 -m compileall benchmarks/fibonacci_sequence/python_recursion.py python3 -m compileall benchmarks/fibonacci_sequence/python_iteration.py ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/python_recursion.cpython-311.json 'python3 benchmarks/fibonacci_sequence/__pycache__/python_recursion.cpython-311.pyc' # TIMEOUT! hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/python_iteration.cpython-311.json 'python3 benchmarks/fibonacci_sequence/__pycache__/python_iteration.cpython-311.pyc' ``` **RESULT**:\ Benchmark 1: python3 benchmarks/fibonacci_sequence/__pycache__/python_iteration.cpython-311.pyc\ Time (mean ± σ): 16584.6 µs ± 761.5 µs [User: 11451.8 µs, System: 3813.3 µs]\ Range (min … max): 15592.0 µs … 20953.2 µs 100 runs ### [Mojo Fibonacci Sequence Recursion](benchmarks/fibonacci_sequence/mojo_recursion.mojo) ```mojo fn fibonacci_recursion(n: Int) -> Int: return n if n < 2 else fibonacci_recursion(n - 1) + fibonacci_recursion(n - 2) fn main(): _ = fibonacci_recursion(100) ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/mojo_recursion.json 'mojo run benchmarks/fibonacci_sequence/mojo_recursion.mojo' ``` **RESULT: TIMEOUT, I canceled computation after 1m** ### [Mojo Fibonacci Sequence Iteration](benchmarks/fibonacci_sequence/mojo_iteration.mojo) ```mojo fn fibonacci_iteration(n: Int) -> Int: var a: Int = 0 var b: Int = 1 for _ in range(n): a = b b = a+b return a fn main(): _ = fibonacci_iteration(100) ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/mojo_iteration.json 'mojo run benchmarks/fibonacci_sequence/mojo_iteration.mojo' ``` **RESULT**:\ Benchmark 1: mojo run benchmarks/fibonacci_sequence/mojo_iteration.mojo\ Time (mean ± σ): 43852.7 µs ± 1353.5 µs [User: 38156.0 µs, System: 10407.3 µs]\ Range (min … max): 42033.6 µs … 49357.3 µs 100 runs ### Compile Mojo code ```shell mojo build benchmarks/fibonacci_sequence/mojo_recursion.mojo mojo build benchmarks/fibonacci_sequence/mojo_iteration.mojo ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/mojo_recursion.exe.json './benchmarks/fibonacci_sequence/mojo_recursion' # TIMEOUT! hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/mojo_iteration.exe.json './benchmarks/fibonacci_sequence/mojo_iteration' ``` **RESULT**:\ Benchmark 1: ./benchmarks/fibonacci_sequence/mojo_iteration\ Time (mean ± σ): 934.6 µs ± 468.9 µs [User: 409.8 µs, System: 247.8 µs]\ Range (min … max): 552.7 µs … 4522.9 µs 100 runs ### [Codon Fibonacci Sequence Recursion](benchmarks/fibonacci_sequence/codon_recursion.codon) ```codon def fibonacci_recursion(n): return n if n < 2 else fibonacci_recursion(n - 1) + fibonacci_recursion(n - 2) fibonacci_recursion(100) ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/codon_recursion.json 'codon run --release benchmarks/fibonacci_sequence/codon_recursion.codon' ``` **RESULT: TIMEOUT, I canceled computation after 1m** ### [Codon Fibonacci Sequence Iteration](benchmarks/fibonacci_sequence/codon_iteration.codon) ```codon def fibonacci_iteration(n): a, b = 0, 1 for _ in range(n): a, b = b, a+b return a fibonacci_iteration(100) ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/codon_iteration.json 'codon run --release benchmarks/fibonacci_sequence/codon_iteration.codon' ``` **RESULT**:\ Benchmark 1: codon run --release benchmarks/fibonacci_sequence/codon_iteration.codon\ Time (mean ± σ): 628060.1 µs ± 10430.5 µs [User: 584524.3 µs, System: 39358.5 µs]\ Range (min … max): 612742.5 µs … 662716.9 µs 100 runs ### Compile Codon code ```shell codon build --release -exe benchmarks/fibonacci_sequence/codon_recursion.codon codon build --release -exe benchmarks/fibonacci_sequence/codon_iteration.codon ``` ```shell hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json codon_recursion.exe.json './benchmarks/fibonacci_sequence/codon_recursion' # TIMEOUT! hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/codon_iteration.exe.json './benchmarks/fibonacci_sequence/codon_iteration' ``` **RESULT**:\ Benchmark 1: ./benchmarks/fibonacci_sequence/codon_iteration\ Time (mean ± σ): 2732.7 µs ± 1145.5 µs [User: 1466.0 µs, System: 1061.5 µs]\ Range (min … max): 2036.6 µs … 13236.3 µs 100 runs ### [Rust Fibonacci Sequence Recursion](benchmarks/fibonacci_sequence/rust/main.rs) ```rust fn fibonacci_recursive(n: i64) -> i64 { if n < 2 { return n; } return fibonacci_recursive(n - 1) + fibonacci_recursive( n - 2); } fn main() { let _ = fibonacci_recursive(100); } ``` ```shell rustc -C opt-level=3 benchmarks/fibonacci_sequence/rust_recursion.rs -o benchmarks/fibonacci_sequence/rust_recursion hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/rust_recursion.json './benchmarks/fibonacci_sequence/rust_recursion' ``` **RESULT: TIMEOUT, I canceled computation after 1m** ### [Rust Fibonacci Sequence Iteration](benchmarks/fibonacci_sequence/rust_iteration.rs) ```rust fn fibonacci_iteration(n: usize) -> usize { let mut a = 1; let mut b = 1; for _ in 1..n { let old = a; a = b; b += old; } b } fn main() { let _ = fibonacci_iteration(100); } ``` ```shell rustc -C opt-level=3 benchmarks/fibonacci_sequence/rust_iteration.rs -o benchmarks/fibonacci_sequence/rust_iteration hyperfine --warmup 10 -r 100 --time-unit=microsecond --export-json benchmarks/fibonacci_sequence/rust_iteration.json './benchmarks/fibonacci_sequence/rust_iteration' ``` **RESULT**:\ Benchmark 1: ./benchmarks/fibonacci_sequence/rust_iteration\ Time (mean ± σ): 848.9 µs ± 283.2 µs [User: 371.8 µs, System: 261.4 µs]\ Range (min … max): 525.9 µs … 2607.3 µs 100 runs ## Summary Fibonacci Sequence ```shell # Merge all JSON files into benchmarks.json python3 benchmarks/hyperfine-scripts/merge_jsons.py benchmarks/fibonacci_sequence/ benchmarks/fibonacci_sequence/benchmarks.json python3 benchmarks/hyperfine-scripts/plot2.py benchmarks/fibonacci_sequence/benchmarks.json python3 benchmarks/hyperfine-scripts/plot3.py benchmarks/fibonacci_sequence/benchmarks.json python3 benchmarks/hyperfine-scripts/advanced_statistics.py benchmarks/fibonacci_sequence/benchmarks.json > benchmarks/fibonacci_sequence/benchmarks.json.md silicon benchmarks/fibonacci_sequence/benchmarks.json.md -l python -o benchmarks/fibonacci_sequence/benchmarks.json.md.png ``` Advanced statistics <img src="benchmarks/fibonacci_sequence/benchmarks.json.md.png" width="800" /> All together <img src="benchmarks/fibonacci_sequence/benchmarks.json.all.png" width="800" /> Zoomed <img src="benchmarks/fibonacci_sequence/benchmarks.json.all2.png" width="800" /> Detailed one by one <img src="benchmarks/fibonacci_sequence/benchmarks.json.combined.png" width="800" /> Places 1. Rust 1. Mojo 2. Codon 3. Python But here a lot of questions: * How to optimize code/build/run? * Why `mojo run` so slow? * Why `codon run --release` so slow? * Why compiled Python byte code +/- equals Python interpreter? * Why Python interpreter faster than Mojo/Codon `run`? So, we can say that Mojo🔥 is as fast as Rust on Mac! ## [Mandelbrot Set](https://en.wikipedia.org/wiki/Mandelbrot_set) Lets find Mandelbrot Set where WIDTH = 960\ HEIGHT = 960\ MAX_ITERS = 200 MIN_X = -2.0\ MAX_X = 0.6\ MIN_Y = -1.5\ MAX_Y = 1.5 ### [Python Mandelbrot Set](benchmarks/multibrot_set/multibrot.py) ```python def mandelbrot_kernel(c): z = c for i in range(MAX_ITERS): z = z * z + c # Change this for different Multibrot sets (e.g., 2 for Mandelbrot) if z.real * z.real + z.imag * z.imag > 4: return i return MAX_ITERS def compute_mandelbrot(): t = [[0 for _ in range(WIDTH)] for _ in range(HEIGHT)] # Pixel matrix dx = (MAX_X - MIN_X) / WIDTH dy = (MAX_Y - MIN_Y) / HEIGHT for row in range(HEIGHT): for col in range(WIDTH): t[row][col] = mandelbrot_kernel(complex(MIN_X + col * dx, MIN_Y + row * dy)) return t compute_mandelbrot() ``` ```shell python3 -m compileall benchmarks/multibrot_set/multibrot.py hyperfine --warmup 10 -r 10 --time-unit=microsecond --export-json benchmarks/multibrot_set/multibrot.cpython-311.json 'python3 benchmarks/multibrot_set/__pycache__/multibrot.cpython-311.pyc' ``` **RESULT**:\ Benchmark 1: python3 benchmarks/multibrot_set/__pycache__/multibrot.cpython-311.pyc\ Time (mean ± σ): 5444155.4 µs ± 23059.7 µs [User: 5419790.1 µs, System: 18131.3 µs]\ Range (min … max): 5408155.3 µs … 5490548.4 µs 10 runs\ ### [Mojo Mandelbrot Set](benchmarks/multibrot_set/multibrot.mojo) Mojo version with no optimization. ```mojo # Compute the number of steps to escape. def multibrot_kernel(c: ComplexFloat64) -> Int: z = c for i in range(MAX_ITERS): z = z * z + c # Change this for different Multibrot sets (e.g., 2 for Mandelbrot) if z.squared_norm() > 4: return i return MAX_ITERS def compute_multibrot() -> Tensor[FloatType]: # create a matrix. Each element of the matrix corresponds to a pixel t = Tensor[FloatType](HEIGHT, WIDTH) dx = (MAX_X - MIN_X) / WIDTH dy = (MAX_Y - MIN_Y) / HEIGHT y = MIN_Y for row in range(HEIGHT): x = MIN_X for col in range(WIDTH): t[Index(row, col)] = multibrot_kernel(ComplexFloat64(x, y)) x += dx y += dy return t _ = compute_multibrot() ``` ```shell mojo build benchmarks/multibrot_set/multibrot.mojo hyperfine --warmup 10 -r 10 --time-unit=microsecond --export-json benchmarks/multibrot_set/multibrot.exe.json './benchmarks/multibrot_set/multibrot' ``` **RESULT**:\ Benchmark 1: ./benchmarks/multibrot_set/multibrot\ Time (mean ± σ): 135880.5 µs ± 1175.4 µs [User: 133309.3 µs, System: 1700.1 µs]\ Range (min … max): 134639.9 µs … 137621.4 µs 10 runs ### [Mojo Parallelized Mandelbrot Set](benchmarks/multibrot_set/multibrot_mojo_parallelize.mojo) ```mojo fn mandelbrot_kernel_SIMD[ simd_width: Int ](c: ComplexSIMD[float_type, simd_width]) -> SIMD[float_type, simd_width]: """A vectorized implementation of the inner mandelbrot computation.""" let cx = c.re let cy = c.im var x = SIMD[float_type, simd_width](0) var y = SIMD[float_type, simd_width](0) var y2 = SIMD[float_type, simd_width](0) var iters = SIMD[float_type, simd_width](0) var t: SIMD[DType.bool, simd_width] = True for i in range(MAX_ITERS): if not t.reduce_or(): break y2 = y * y y = x.fma(y + y, cy) t = x.fma(x, y2) <= 4 x = x.fma(x, cx - y2) iters = t.select(iters + 1, iters) return iters fn compute_multibrot_parallelized() -> Tensor[float_type]: let t = Tensor[float_type](height, width) @parameter fn worker(row: Int): let scale_x = (max_x - min_x) / width let scale_y = (max_y - min_y) / height @parameter fn compute_vector[simd_width: Int](col: Int): """Each time we operate on a `simd_width` vector of pixels.""" let cx = min_x + (col + iota[float_type, simd_width]()) * scale_x let cy = min_y + row * scale_y let c = ComplexSIMD[float_type, simd_width](cx, cy) t.data().simd_store[simd_width]( row * width + col, mandelbrot_kernel_SIMD[simd_width](c) ) # Vectorize the call to compute_vector where call gets a chunk of pixels. vectorize[simd_width, compute_vector](width) # Parallelized parallelize[worker](height, height) return t def main(): _ = compute_multibrot_parallelized() ``` ```shell mojo build benchmarks/multibrot_set/multibrot_mojo_parallelize.mojo hyperfine --warmup 10 -r 10 --time-unit=microsecond --export-json benchmarks/multibrot_set/multibrot_mojo_parallelize.exe.json './benchmarks/multibrot_set/multibrot_mojo_parallelize' ``` **RESULT**:\ Benchmark 1: ./benchmarks/multibrot_set/multibrot_mojo_parallelize\ Time (mean ± σ): 7139.4 µs ± 596.4 µs [User: 36535.2 µs, System: 6670.1 µs]\ Range (min … max): 6222.6 µs … 8269.7 µs 10 runs ### [Codon Mandelbrot Set](benchmarks/multibrot_set/multibrot.codon) ```codon def mandelbrot_kernel(c): z = c for i in range(MAX_ITERS): z = z * z + c # Change this for different Multibrot sets (e.g., 2 for Mandelbrot) if z.real * z.real + z.imag * z.imag > 4: return i return MAX_ITERS def compute_mandelbrot(): t = [[0 for _ in range(WIDTH)] for _ in range(HEIGHT)] # Pixel matrix dx = (MAX_X - MIN_X) / WIDTH dy = (MAX_Y - MIN_Y) / HEIGHT @par(collapse=2) for row in range(HEIGHT): for col in range(WIDTH): t[row][col] = mandelbrot_kernel(complex(MIN_X + col * dx, MIN_Y + row * dy)) return t compute_mandelbrot() ``` For test run or plot (uncomment code in the file) ```shell CODON_PYTHON=/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib codon run --release benchmarks/multibrot_set/multibrot.codon ``` Build and run ```shell codon build --release -exe benchmarks/multibrot_set/multibrot.codon -o benchmarks/multibrot_set/multibrot_codon hyperfine --warmup 10 -r 10 --time-unit=microsecond --export-json benchmarks/multibrot_set/multibrot_codon.json './benchmarks/multibrot_set/multibrot_codon' ``` **RESULT**:\ Benchmark 1: ./benchmarks/multibrot_set/multibrot_codon\ Time (mean ± σ): 44184.7 µs ± 1142.0 µs [User: 248773.9 µs, System: 72935.3 µs]\ Range (min … max): 42963.8 µs … 46456.2 µs 10 runs ```shell codon build --release -exe benchmarks/multibrot_set/multibrot_codon_par.codon -o benchmarks/multibrot_set/multibrot_codon_par hyperfine --warmup 10 -r 10 --time-unit=microsecond --export-json benchmarks/multibrot_set/multibrot_codon_par.json './benchmarks/multibrot_set/multibrot_codon_par' ``` ## Summary Mandelbrot Set ```shell # Merge all JSON files into benchmarks.json python3 benchmarks/hyperfine-scripts/merge_jsons.py benchmarks/multibrot_set/ benchmarks/multibrot_set/benchmarks.json python3 benchmarks/hyperfine-scripts/plot2.py benchmarks/multibrot_set/benchmarks.json python3 benchmarks/hyperfine-scripts/plot3.py benchmarks/multibrot_set/benchmarks.json python3 benchmarks/hyperfine-scripts/advanced_statistics.py benchmarks/multibrot_set/benchmarks.json > benchmarks/multibrot_set/benchmarks.json.md silicon benchmarks/multibrot_set/benchmarks.json.md -l python -o benchmarks/multibrot_set/benchmarks.json.md.png ``` Advanced statistics <img src="benchmarks/multibrot_set/benchmarks.json.md.png" width="800" /> All together <img src="benchmarks/multibrot_set/benchmarks.json.all.png" width="800" /> Zoomed <img src="benchmarks/multibrot_set/benchmarks.json.all2.png" width="800" /> Detailed one by one <img src="benchmarks/multibrot_set/benchmarks.json.combined.png" width="800" /> Places 1. Mojo (parallelize) 2. Codon 3. Mojo 4. Python Links: * [Multibrot Set](https://en.wikipedia.org/wiki/Multibrot_set) Mandelbrot = Multibrot with `power = 2` ```python z = z**power + c # You can change this for different set ``` * [Pillow built-in ImagingEffectMandelbrot](https://github.com/python-pillow/Pillow/blob/10.1.0/src/libImaging/Effects.c#L23) * [Exaloop Codon version of Mandelbrot](https://github.com/exaloop/codon/blob/develop/bench/mandelbrot/mandelbrot.codon) * [Modular Mojo version of Mandelbrot](https://github.com/modularml/mojo/blob/main/examples/mandelbrot.mojo) * [Mojo Complex squared_norm](https://docs.modular.com/mojo/stdlib/complex/complex.html#squared_norm) * [Matplotlib Mandelbrot](https://matplotlib.org/stable/gallery/showcase/mandelbrot.html) # Awesome Mojo🔥 code # Binary Search Algorithm In computer science, [binary search algorithm](https://en.wikipedia.org/wiki/Binary_search_algorithm), also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Let's do some code with Python, Mojo🔥, Swift, V, Julia, Nim, Zig. Note: For **Python** and **Mojo** versions, I leave some optimization and make the code similar for measurement and comparison. ## [Python Binary Search](algorithm/binary_search_Python.py) ```python from typing import List import timeit SIZE = 1000000 MAX_ITERS = 100 COLLECTION = tuple(i for i in range(SIZE)) # Make it aka at compile-time. def python_binary_search(element: int, array: List[int]) -> int: start = 0 stop = len(array) - 1 while start <= stop: index = (start + stop) // 2 pivot = array[index] if pivot == element: return index elif pivot > element: stop = index - 1 elif pivot < element: start = index + 1 return -1 def test_python_binary_search(): _ = python_binary_search(SIZE - 1, COLLECTION) print( "Average execution time of func in sec", timeit.timeit(lambda: test_python_binary_search(), number=MAX_ITERS), ) ``` ## [Mojo🔥 Binary Search](algorithm/BinarySearch_Mojo.mojo) ```python """Implements basic binary search.""" from Benchmark import Benchmark from Vector import DynamicVector alias SIZE = 1000000 alias NUM_WARMUP = 0 alias MAX_ITERS = 100 fn mojo_binary_search(element: Int, array: DynamicVector[Int]) -> Int: var start = 0 var stop = len(array) - 1 while start <= stop: let index = (start + stop) // 2 let pivot = array[index] if pivot == element: return index elif pivot > element: stop = index - 1 elif pivot < element: start = index + 1 return -1 @parameter # statement runs at compile-time. fn get_collection() -> DynamicVector[Int]: var v = DynamicVector[Int](SIZE) for i in range(SIZE): v.push_back(i) return v fn test_mojo_binary_search() -> F64: fn test_closure(): _ = mojo_binary_search(SIZE - 1, get_collection()) return F64(Benchmark(NUM_WARMUP, MAX_ITERS).run[test_closure]()) / 1e9 print( "Average execution time of func in sec ", test_mojo_binary_search(), ) ``` **It is the first binary search written in Mojo🔥by community (@ego) and posted in mojo-chat.** <img src="img/python_binary_search_05.15.2023.png" height="300" /> <img src="img/mojo_binary_search_05.15.2023.png" height="300" /> ## [Swift Binary Search](algorithm/binarySearch_Swift.swift) ```swift func binarySearch(items: [Int], elem: Int) -> Int { var low = 0 var high = items.count - 1 var mid = 0 while low <= high { mid = Int((high + low) / 2) if items[mid] < elem { low = mid + 1 } else if items[mid] > elem { high = mid - 1 } else { return mid } } return -1 } let items = [1, 2, 3, 4, 0].sorted() let res = binarySearch(items: items, elem: 4) print(res) ``` ## [Julia Binary Search](algorithm/binarysearch_Julia.jl) ```julia function binarysearch(lst::Vector{T}, val::T) where T low = 1 high = length(lst) while low ≤ high mid = (low + high) ÷ 2 if lst[mid] > val high = mid - 1 elseif lst[mid] < val low = mid + 1 else return mid end end return 0 end ``` ## [Nim Binary Search](algorithm/binarySearch_Nim.nim) ```nim proc binarySearch[T](a: openArray[T], key: T): int = var b = len(a) while result < b: var mid = (result + b) div 2 if a[mid] < key: result = mid + 1 else: b = mid if result >= len(a) or a[result] != key: result = -1 let res = @[2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,25,27,30] echo binarySearch(res, 10) ``` ## [Zig Binary Search](algorithm/BinarySearch_Zig.zig) ```zig const std = @import("std"); fn binarySearch(comptime T: type, arr: []const T, target: T) ?usize { var lo: usize = 0; var hi: usize = arr.len - 1; while (lo <= hi) { var mid: usize = (lo + hi) / 2; if (arr[mid] == target) { return mid; } else if (arr[mid] < target) { lo = mid + 1; } else { hi = mid - 1; } } return null; } ``` ## [V Binary Search](algorithm/binary_search_V.v) ```v fn binary_search(a []int, value int) int { mut low := 0 mut high := a.len - 1 for low <= high { mid := (low + high) / 2 if a[mid] > value { high = mid - 1 } else if a[mid] < value { low = mid + 1 } else { return mid } } return -1 } fn main() { search_list := [1, 2, 3, 5, 6, 7, 8, 9, 10] println(binary_search(search_list, 9)) } ``` ## [Bonus V Breadth First Search Path](algorithm/bfs_V.v) * [BFS at vlang examples](https://github.com/vlang/v/blob/master/examples/graphs/bfs.v) * [BFS original PR](https://github.com/ego/v/blob/e13474757bee0afa00e8c4dd013b14e2f4fbc428/examples/bfs.v) ```v fn breadth_first_search_path(graph map[string][]string, vertex string, target string) []string { mut path := []string{} mut visited := []string{init: vertex} mut queue := [][][]string{} queue << [[vertex], path] for queue.len > 0 { mut idx := queue.len - 1 node := queue[idx][0][0] path = queue[idx][1] queue.delete(idx) if node == target { path << node return path } for child in graph[node] { mut tmp := path.clone() if child !in visited { visited << child tmp << node queue << [[child], tmp] } } } return path } fn main() { graph := map{ 'A': ['B', 'C'] 'B': ['A', 'D', 'E'] 'C': ['A', 'F'] 'D': ['B'] 'E': ['B', 'F'] 'F': ['C', 'E'] } println('Graph: $graph') path := breadth_first_search_path(graph, 'A', 'F') println('The shortest path from node A to node F is: $path') assert path == ['A', 'C', 'F'] } ``` # Fizz buzz * [Leetcode Fizz buzz problem](https://leetcode.com/problems/fizz-buzz/) * [Wikipedia Fizz buzz](https://en.wikipedia.org/wiki/Fizz_buzz) * Add some optimisation, according to a Wikipedia problem statement. ## [Python Fizz buzz](algorithm/fizz_buzz_Python.py) ```python import timeit SIZE = 100 MAX_ITERS = 100 def _fizz_buzz(): # Make it aka at compile-time. res = [] for n in range(1, SIZE+1): if (n % 3 == 0) and (n % 5 == 0): s = "FizzBuzz" elif n % 3 == 0: s = "Fizz" elif n % 5 == 0: s = "Buzz" else: s = str(n) res.append(s) return res DATA = _fizz_buzz() def fizz_buzz(): print("\n".join(DATA)) print( "Average execution time of Python func in sec", timeit.timeit(lambda: fizz_buzz(), number=MAX_ITERS), ) # Average execution time of Python func in sec 0.005334990004485007 ``` ## [Clojure Fizz buzz](algorithm/fizz_buzz_Clojure.clj) ```clojure (import '[java.io OutputStream]) (require '[clojure.java.io :as io]) (def devnull (io/writer (OutputStream/nullOutputStream))) (defmacro timeit [n expr] `(with-out-str (time (dotimes [_# ~(Math/pow 1 n)] (binding [*out* devnull] ~expr))))) (defmacro macro-fizz-buzz [n] `(fn [] (print ~(apply str (for [i (range 1 (inc n))] (cond (zero? (mod i 15)) "FizzBuzz\n" (zero? (mod i 5)) "Buzz\n" (zero? (mod i 3)) "Fizz\n" :else (str i "\n"))))))) (print (timeit 100 (macro-fizz-buzz 100))) ;; "Elapsed time: 0.175486 msecs" ;; Average execution time of Clojure func in sec 0.000175486 seconds ``` ## [Mojo🔥Fizz buzz](algorithm/fizz_buzz_Mojo.mojo) ```python from String import String from Benchmark import Benchmark alias SIZE = 100 alias NUM_WARMUP = 0 alias MAX_ITERS = 100 @parameter # statement runs at compile-time. fn _fizz_buzz() -> String: var res: String = "" for n in range(1, SIZE+1): if (n % 3 == 0) and (n % 5 == 0): res += "FizzBuzz" elif n % 3 == 0: res += "Fizz" elif n % 5 == 0: res += "Buzz" else: res += String(n) res += "\n" return res fn fizz_buzz(): print(_fizz_buzz()) fn run_benchmark() -> F64: fn _closure(): _ = fizz_buzz() return F64(Benchmark(NUM_WARMUP, MAX_ITERS).run[_closure]()) / 1e9 print( "Average execution time of func in sec ", run_benchmark(), ) # Average execution time of func in sec 0.000104 🔥 ``` **It is the first Fizz buzz written in Mojo🔥 ever by community (@Ego).** # [Merge sort](https://en.wikipedia.org/wiki/Merge_sort) We will use algorithm from vell-known [reference](https://en.wikipedia.org/wiki/Introduction_to_Algorithms) for algorithms book [Introduction to Algorithms A3](https://mitpress.mit.edu/9780262046305/introduction-to-algorithms/) Its fame has led to the common use of the abbreviation "**CLRS**" (Cormen, Leiserson, Rivest, Stein), or, in the first edition, "**CLR**" (Cormen, Leiserson, Rivest). **Chapter 2** "2.3.1 The divide-and-conquer approach". ## [Python Merge sort](algorithm/merge_sort_Python.py) ```python %%python import timeit MAX_ITERS = 100 def merge(A, p, q, r): n1 = q - p + 1 n2 = r - q L = [None] * n1 R = [None] * n2 for i in range(n1): L[i] = A[p + i] for j in range(n2): R[j] = A[q + 1 + j] i = 0 j = 0 k = p while i < n1 and j < n2: if L[i] <= R[j]: A[k] = L[i] i += 1 else: A[k] = R[j] j += 1 k += 1 while i < n1: A[k] = L[i] i += 1 k += 1 while j < n2: A[k] = R[j] j += 1 k += 1 def merge_sort(A, p, r): if p < r: q = (p + r) // 2 merge_sort(A, p, q) merge_sort(A, q + 1, r) merge(A, p, q, r) def run_benchmark_merge_sort(): A = [14, 72, 50, 83, 18, 20, 13, 30, 17, 87, 94, 65, 24, 99, 70, 44, 5, 12, 74, 6, 32, 63, 91, 88, 43, 54, 27, 39, 64, 78, 29, 62, 58, 59, 61, 89, 2, 15, 41, 9, 93, 90, 23, 96, 73, 14, 8, 28, 11, 42, 77, 34, 52, 80, 57, 84, 21, 60, 66, 40, 7, 85, 47, 98, 97, 35, 82, 36, 49, 3, 68, 22, 67, 81, 56, 71, 4, 38, 69, 95, 16, 48, 1, 31, 75, 19, 10, 25, 79, 45, 76, 33, 53, 55, 46, 37, 26, 51, 92, 86] merge_sort(A, 0, len(A)-1) print( "Average execution time of Python `merge_sort` in sec", timeit.timeit(lambda: run_benchmark_merge_sort(), number=MAX_ITERS), ) # Average execution time of Python `merge_sort` in sec 0.019136679999064654 def run_benchmark_sort(): A = [14, 72, 50, 83, 18, 20, 13, 30, 17, 87, 94, 65, 24, 99, 70, 44, 5, 12, 74, 6, 32, 63, 91, 88, 43, 54, 27, 39, 64, 78, 29, 62, 58, 59, 61, 89, 2, 15, 41, 9, 93, 90, 23, 96, 73, 14, 8, 28, 11, 42, 77, 34, 52, 80, 57, 84, 21, 60, 66, 40, 7, 85, 47, 98, 97, 35, 82, 36, 49, 3, 68, 22, 67, 81, 56, 71, 4, 38, 69, 95, 16, 48, 1, 31, 75, 19, 10, 25, 79, 45, 76, 33, 53, 55, 46, 37, 26, 51, 92, 86] A.sort() print( "Average execution time of Python builtin `sort` in sec", timeit.timeit(lambda: run_benchmark_sort(), number=MAX_ITERS), ) # Average execution time of Python builtin `sort` in sec 0.00019922800129279494 ``` ## [Mojo🔥 Merge sort](algorithm/MergeSort_Mojo.mojo) ```python from Benchmark import Benchmark from Vector import DynamicVector from StaticTuple import StaticTuple from Sort import sort alias NUM_WARMUP = 0 alias MAX_ITERS = 100 fn merge(inout A: DynamicVector[Int], p: Int, q: Int, r: Int): let n1 = q - p + 1 let n2 = r - q var L = DynamicVector[Int](n1) var R = DynamicVector[Int](n2) for i in range(n1): L[i] = A[p + i] for j in range(n2): R[j] = A[q + 1 + j] var i = 0 var j = 0 var k = p while i < n1 and j < n2: if L[i] <= R[j]: A[k] = L[i] i += 1 else: A[k] = R[j] j += 1 k += 1 while i < n1: A[k] = L[i] i += 1 k += 1 while j < n2: A[k] = R[j] j += 1 k += 1 fn merge_sort(inout A: DynamicVector[Int], p: Int, r: Int): if p < r: let q = (p + r) // 2 merge_sort(A, p, q) merge_sort(A, q + 1, r) merge(A, p, q, r) @parameter fn create_vertor() -> DynamicVector[Int]: let st = StaticTuple[MAX_ITERS, Int](14, 72, 50, 83, 18, 20, 13, 30, 17, 87, 94, 65, 24, 99, 70, 44, 5, 12, 74, 6, 32, 63, 91, 88, 43, 54, 27, 39, 64, 78, 29, 62, 58, 59, 61, 89, 2, 15, 41, 9, 93, 90, 23, 96, 73, 14, 8, 28, 11, 42, 77, 34, 52, 80, 57, 84, 21, 60, 66, 40, 7, 85, 47, 98, 97, 35, 82, 36, 49, 3, 68, 22, 67, 81, 56, 71, 4, 38, 69, 95, 16, 48, 1, 31, 75, 19, 10, 25, 79, 45, 76, 33, 53, 55, 46, 37, 26, 51, 92, 86) var v = DynamicVector[Int](st.__len__()) for i in range(st.__len__()): v.push_back(st[i]) return v fn run_benchmark_merge_sort() -> F64: fn _closure(): var A = create_vertor() merge_sort(A, 0, len(A)-1) return F64(Benchmark(NUM_WARMUP, MAX_ITERS).run[_closure]()) / 1e9 print( "Average execution time of Mojo🔥 `merge_sort` in sec ", run_benchmark_merge_sort(), ) # Average execution time of Mojo🔥 `merge_sort` in sec 1.1345999999999999e-05 fn run_benchmark_sort() -> F64: fn _closure(): var A = create_vertor() sort(A) return F64(Benchmark(NUM_WARMUP, MAX_ITERS).run[_closure]()) / 1e9 print( "Average execution time of Mojo🔥 builtin `sort` in sec ", run_benchmark_sort(), ) # Average execution time of Mojo🔥 builtin `sort` in sec 2.988e-06 ``` You can use it like: ```python # Usage: merge_sort var A = create_vertor() merge_sort(A, 0, len(A)-1) print(len(A)) print(A[0], A[99]) ``` Builtin `from Sort import sort` [quicksort](https://en.wikipedia.org/wiki/Quicksort) a little bit [faster](https://en.wikipedia.org/wiki/Sorting_algorithm#Comparison_of_algorithms) than our implementation, but we can optimize it during deep in language and as usual with algorithms =) and programming paradigms. - Multithreaded Algorithms, Multithreaded merge sort at pages 797, 803 of the book **CLRS** above - Three Hungarians' Algorithm - Use insertion sort for small subarrays, hybrid merge sort - Merge in a different direction - Use an adaptive approach - Implement in-place merging - Optimize memory access - [Mojo Stdlib Functional](https://docs.modular.com/mojo/MojoStdlib/Functional.html) - **Tiled merge sort** like in [Tiling Matmul](https://docs.modular.com/mojo/notebooks/Matmul.html#tiling-matmul) - Parallel multiway merge sort ## Summary for sorting algorithms merge sort and quicksort | Lang | sec | |---------------------|-----------------| | Python merge_sort | **0.019136679** | | Python builtin sort | **0.000199228** | | Mojo merge_sort | **0.000011346** | | Mojo builtin sort | **0.000002988** | Let's build a plot for this table. ```python #%%python import matplotlib.pyplot as plt import numpy as np languages = ['Python merge_sort', 'Python builtin sort', 'Mojo merge_sort', 'Mojo builtin sort'] seconds = [0.019136679, 0.000199228, 0.000011346, 0.000002988] # Apply a custom transformation to the values transformed_seconds = [np.sqrt(1 / x) for x in seconds] plt.barh(languages, transformed_seconds) plt.xlabel('Custom Transformation') plt.ylabel('Language and Sort Type') plt.title('Comparison of Sorting Algorithms (Custom Transformation)') plt.show() ``` Plot notes, more is better and faster. <img src="img/comparison_sorting.png" /> # Programming manual ## Parameterization[]: compile time meta-programming I strongly recommended start from here [HelloMojo](https://docs.modular.com/mojo/notebooks/HelloMojo.html) and understand **[parameter]** and **[parameter expressions]** [parameterization here](https://docs.modular.com/mojo/notebooks/HelloMojo.html#parameterization-compile-time-meta-programming). Like in this example: ```python fn concat[len1: Int, len2: Int](lhs: MySIMD[len1], rhs: MySIMD[len2]) -> MySIMD[len1+len2]: let result = MySIMD[len1 + len2]() for i in range(len1): result[i] = lhs[i] for j in range(len2): result[len1 + j] = rhs[j] return result let a = MySIMD[2](1, 2) let x = concat[2,2](a, a) x.dump() ``` Compile time **[Parameters]:** `fn concat[len1: Int, len2: Int]`. Run time **(Args)**: `fn concat(lhs: MySIMD, rhs: MySIMD)`. Parameters [PEP695](https://peps.python.org/pep-0695/) syntax in square `[]` brackets. Now in Python: ```python def func(a: _T, b: _T) -> _T: ... ``` Now in Mojo🔥: ```python def func[T](a: T, b: T) -> T: ... ``` **[Parameters]** are named and have types **like normal values** in a Mojo program, but `parameters[]` are evaluated at **compile time**. The runtime program may use the value of **[parameters]** - because the parameters are resolved at compile time before they are needed by the runtime program - but the compile time parameter expressions may not use runtime values. `Self` type from [PEP673](https://peps.python.org/pep-0673/) ```python fn __sub__(self, rhs: Self) -> Self: let result = MySIMD[size]() for i in range(size): result[i] = self[i] - rhs[i] return result ``` In the docs you can find word **Fields** it is aka class **Attributes** in the Python. So, you call them with `dot`. ```python from DType import DType let bool_type = DType.bool ``` ## Data Type Model and alias * The base construct block is [DType](https://docs.modular.com/mojo/MojoStdlib/DType.html). Some analogies: - [NumPy dtype](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy-dtype) - [Jax dtype](https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.dtype.html#jax-numpy-dtype) - [TensorFlow DType](https://www.tensorflow.org/api_docs/python/tf/dtypes/DType) ```python from DType import DType DType.si8 ``` * Then you can wrap it with **SIMD struct** aka container. * SIMD [Single Instruction, Multiple Data](https://docs.modular.com/mojo/MojoStdlib/SIMD.html) and [SIMD at wikipedia](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data) ```python from DType import DType from SIMD import SIMD, SI8 alias MY_SIMD_DType_si8 = SIMD[DType.si8, 1] alias MY_SI8 = SI8 print(MY_SIMD_DType_si8 == MY_SI8) # true ``` * Then a sequence of these types you can wrap with a container [DynamicVector](https://docs.modular.com/mojo/MojoStdlib/Vector.html) or similar. ```python from DType import DType from SIMD import SIMD, SI8 from Vector import DynamicVector from String import String alias a = DynamicVector[SIMD[DType.si8, 1]] alias b = DynamicVector[SI8] print(a == b) print(a == String) print(b == String) # all true ``` So the `String` is only alias for a something like `DynamicVector[SIMD[DType.si8, 1]]`. ## `VariadicList` for destructuring/unpacking/accessing arguments ```python from List import VariadicList fn destructuring_arguments(*args: Int): let my_var_list = VariadicList(args) for i in range(len(my_var_list)): print("argument", i, ":", my_var_list[i]) destructuring_arguments(1, 2, 3, 4) ``` It is very useful for creating initial collections. We can write like this: ```python from Vector import DynamicVector from StaticTuple import StaticTuple fn create_vertor() -> DynamicVector[Int]: let st = StaticTuple[4, Int](1, 2, 3, 4) var v = DynamicVector[Int](st.__len__()) for i in range(st.__len__()): v.push_back(st[i]) return v v = create_vertor() print(v[0], v[3]) # or from List import VariadicList fn create_vertor() -> DynamicVector[Int]: let var_list = VariadicList(1, 2, 3, 4) var v = DynamicVector[Int](len(var_list)) for i in range(len(var_list)): v.push_back(var_list[i]) return v v = create_vertor() print(v[0], v[3]) ``` Read more about function [def](https://docs.modular.com/mojo/notebooks/HelloMojo.html#fn-definitions) and [fn](https://docs.modular.com/mojo/programming-manual.html#fn-definitions) ## String ```python from String import String # String concatenation print(String("'") + String(1) + "'\n") # Python's join print(String("|").join("a", "b", "c")) # String format from IO import _printf as print let x: Int = 1 print("'%i'\n", x.value) ``` ### String and builtin slice For a string you can use [Builtin Slice](https://docs.modular.com/mojo/MojoBuiltin/BuiltinSlice.html) with format string slice[start:end:step]. ```python from String import String let hello_mojo = String("Hello Mojo!") print("Till the end:", hello_mojo[0::]) print("Before last 2 chars:", hello_mojo[0:-2]) print("From start to the end with step 2:", hello_mojo[0::2]) print("From start to the before last with step 3:", hello_mojo[0:-1:3]) ``` <img src="img/string_slice.png" height="200" /> There is some problem with unicode, when slicing 🔥: ```python let hello_mojo_unicode = String("Hello Mojo🔥!") print("Unicode efore last 2 chars:", hello_mojo_unicode[0:-2]) # no result, silents ``` Here is an [explanation](https://mzaks.medium.com/counting-chars-with-simd-in-mojo-140ee730bd4d) and some [discussion](https://github.com/modularml/mojo/discussions/270). [mbstowcs - convert a multibyte string to a wide-character string](https://man7.org/linux/man-pages/man3/mbstowcs.3.html) ## Mojo🔥decorators ### @value `struct` decorator aka Python `@dataclass`. It will generate methods `__init__`, `__copyinit__`, `__moveinit__` for you automatically. ```python @value struct dataclass: var name: String var age: Int ``` Note that the `@value` decorator only works on types whose members are `copyable` and/or `movable`. ### @value("trivial") ### @register_passable("trivial") Trivial types. This decorator tells Mojo that the type should be copyable `__copyinit__` and movable `__moveinit__`. It also tells Mojo to prefer to pass the value in CPU registers. Allows `structs` to opt-in to being passed in a `register` instead of passing through `memory`. ```python @register_passable("trivial") struct Int: var value: __mlir_type.`!pop.scalar<index>` ``` ### @always_inline Decorators that provide full **control** over **compiler optimizations**. Instructs compiler to always **inline** this function when it’s called. ```python @always_inline fn foo(x: Int, y: Int) -> Int: return x + y fn bar(z: Int): let r = foo(z, z) # This call will be inlined ``` ### @parameter It can be placed on nested functions that capture runtime values to create “parametric” capturing closures. It allows closures that capture runtime values to be passed as parameter values. ### Decorators combination ```python @always_inline @parameter fn test(): return ``` ## Casting Some casting examples ```python s: StringLiteral let p = DTypePointer[DType.si8](s.data()).bitcast[DType.ui8]() var result = 0 result += ((p.simd_load[64](offset) >> 6) != 0b10).cast[DType.ui8]().reduce_add().to_int() let rest_p: DTypePointer[DType.ui8] = stack_allocation[simd_width, UI8, 1]() from Bit import ctlz s: String i: Int let code = s.buffer.data.load(i) let byte_length_code = ctlz(~code).to_int() ``` ## Stack, Mem, Pointer, Allocation, Free ## DTypePointer, Heap and Stack **DTypePointer** - store an address with a given DType, allowing you to allocate, load and modify data with convenient access to SIMD operations. ```python from Pointer import DTypePointer from DType import DType from Random import rand from Memory import memset_zero # `heap` var my_pointer_on_heap = DTypePointer[DType.ui8].alloc(8) memset_zero(my_pointer_on_heap, 8) # `stack or register` var data = my_pointer_on_heap.simd_load[8](0) print(data) rand(my_pointer_on_heap, 4) # `data` does not contain a reference to the `heap`, so load the data again data = my_pointer_on_heap.simd_load[8](0) print(data) # simd_load and simd_store var half = my_pointer_on_heap.simd_load[4](0) half = half + 1 my_pointer_on_heap.simd_store[4](4, half) print(my_pointer_on_heap.simd_load[8](0)) # Pointer move back my_pointer_on_heap -= 1 print(my_pointer_on_heap.simd_load[8](0)) # Mast free memory my_pointer_on_heap.free() ``` Struct can minimaze potential dangerous of pointers by limiting scoup. Excellent article on Mojo Dojo blog about [DTypePointer here](https://mojodojo.dev/guides/modules/Pointer/DTypePointer.html#storing-and-loading-simd-data) Plus his example [Matrix Struct and DTypePointer](algorithm/MatrixStruct.mojo) ## Pointer [Pointer](https://docs.modular.com/mojo/MojoStdlib/Pointer.html) store an address to any `register_passable type`, and allocate `n` amount of them to the `heap`. ```python from Pointer import Pointer from Memory import memset_zero from String import String @register_passable # for syntaxt like `let coord = p1[0]` and let it be passed through registers. struct Coord: # memory-only type var x: UI8 var y: UI8 var p1 = Pointer[Coord].alloc(2) memset_zero(p1, 2) var coord = p1[0] # is an identifier to memory on the stack or in a register print(coord.x) # Store the value coord.x = 5 coord.y = 5 print(coord.x) # We need to store the data. p1.store(0, coord) print(p1[0].x) # Mast free memory p1.free() ``` Full article about [Pointer](https://mojodojo.dev/guides/modules/Pointer/Pointer.html) Plus exemple [Pointer and Struct](algorithm/Pointer.mojo) ## Advanced Mojo🔥features and Intrinsics module Modular [Intrinsics](https://docs.modular.com/mojo/MojoStdlib/Intrinsics.html) it is some kind of **execution backends**: - Mojo🔥**compiler** features - **LLVM intrinsic** maybe [this one](https://libc.llvm.org/stdio.html) - **External call** like [libc](https://www.gnu.org/software/libc/manual/html_node/Function-Index.html) - [MLIR Multi-Level Intermediate Representation](https://docs.modular.com/mojo/notebooks/BoolMLIR.html) Mojo🔥-> [MLIR Dialects](https://mlir.llvm.org/docs/Dialects/) -> execution backends with optimization code and architectures. [MLIR](https://mlir.llvm.org/docs) is a compiler infrastructure witch implementing various transformation and optimization passes for different **programming languages** and **architectures**. ### Syscalls MLIR itself does not directly provide functionality for interacting with operating system [syscalls](https://en.wikipedia.org/wiki/System_call). Which are low-level interfaces to operating system services, are typically handled at the level of the target programming language or the operating system itself. MLIR is designed to be language-and-target-agnostic, and its primary focus is on providing an intermediate representation for performing optimizations. To perform operating system syscalls in MLIR, we need to use a target-specific **backend**. But with these `execution backends`, basically, we have access to OS syscalls. And we have the whole world of C/LLVM/Python stuff under the hood. Lets have same quick look on it in practice: ```python from OS import getenv print(getenv("PATH")) print(getenv(StringRef("PATH"))) # or like this from SIMD import SI8 from Intrinsics import external_call var path1 = external_call["getenv", StringRef](StringRef("PATH")) print(path1.data) var path2 = external_call["getenv", StringRef]("PATH") print(path2.data) let abs_10 = external_call["abs", SI8, Int](-10) print(abs_10) ``` In this simple example we used `external_call` to get OS environment variable with a casting type between Mojo and libc functions. Pretty cool, yeah! I have a lot of ideas from this topic and I am eagerly awaiting the opportunity to implement them soon. Taking action can lead to amazing outcomes =) ## MLIR libc gethostname Let's do something interesting - call `libc function` [gethostname](https://www.gnu.org/software/libc/manual/html_node/Host-Identification.html#index-gethostname). Function has this interface `int gethostname (char *name, size_t size)`. For that we can use helper function [external_call](https://docs.modular.com/mojo/MojoStdlib/Intrinsics.html#external_call) from **Intrinsics** module or write own [MLIR](https://docs.modular.com/mojo/notebooks/HelloMojo.html#direct-access-to-mlir). Let's go code: ```python from Intrinsics import external_call from SIMD import SIMD, SI8 from DType import DType from Vector import DynamicVector from DType import DType from Pointer import DTypePointer, Pointer # We can use `from String import String` but for clarification we will use a full form. # DynamicVector[SIMD[DType.si8, 1]] == DynamicVector[SI8] == String # Compile time stuff. alias cArrayOfStrings = DynamicVector[SIMD[DType.si8, 1]] alias capacity = 1024 var c_pointer_to_array_of_strings = DTypePointer[DType.si8](cArrayOfStrings(capacity).data) var c_int_result = external_call["gethostname", Int, DTypePointer[DType.si8], Int](c_pointer_to_array_of_strings, capacity) let mojo_string_result = String(c_pointer_to_array_of_strings.address) print("C function gethostname result code:", c_int_result) print("C function gethostname result value:", star_hostname(mojo_string_result)) @always_inline fn star_hostname(hostname: String) -> String: # [Builtin Slice](https://docs.modular.com/mojo/MojoBuiltin/BuiltinSlice.html) # string slice[start:end:step] return hostname[0:-1:2] ``` <img src="img/gethostname.png" height="200" /> ## Mojo🔥TCP Socket Server with PythonInterface Let's do some things for a WEB with Mojo🔥. We do not have Internet access at playground.modular.com But we can steal do some interesting stuff like TCP on one machine. Let's write the first TCP client-server code in Mojo🔥 with [PythonInterface](https://docs.modular.com/mojo/MojoPython/PythonInterface.html) <img src="img/TCPSocketServer.png" width="600" /> <img src="img/TCPSocketClient.png" width="600" /> * [Mojo TCP Socket Server](algorithm/TCPSocketServer.mojo) * [Mojo TCP Client Server](algorithm/TCPSocketClient.mojo) You should create two separate notebooks, and run **TCPSocketServer** first then **TCPSocketClient**. **Python version** of this code almost the same, except: - `with` syntax - `let` assigning - and destructuring like `a, b = (1, 2)` * [Pytohn socket low-level networking interface](https://docs.python.org/3/library/socket.html) * [Pytohn socketserver framework for network servers](https://docs.python.org/3/library/socketserver.html#module-socketserver) ## Mojo🔥FastAPI with PythonInterface After TCP Server in Mojo🔥 we are going forward =) It's crazy, but let's try to run modern Python web server [FastAPI](https://fastapi.tiangolo.com) with Mojo🔥! ### Preparation We need to upload FastAPI code to playground. So, on your local machine do ```shell pip install --target=web fastapi uvicorn tar -czPf web.tar.gz web ``` and upload `web.tar.gz` to playground via web interface. Then we need to `install` it, just put into proper folder: ```python %%python import os import site site_packages_path = site.getsitepackages()[0] # install fastapi os.system(f"tar xzf web.tar.gz -C {site_packages_path}") os.system(f"cp -r {site_packages_path}/web/* {site_packages_path}/") os.system(f"ls {site_packages_path} | grep fastapi") # clean packages os.system(f"rm -rf {site_packages_path}/web") os.system(f"rm web.tar.gz") ``` ### Mojo🔥FastAPI Server ```python from PythonInterface import Python # Python fastapi let fastapi = Python.import_module("fastapi") let uvicorn = Python.import_module("uvicorn") var app = fastapi.FastAPI() var router = fastapi.APIRouter() # tricky part let py = Python() let py_code = """lambda: 'Hello Mojo🔥!'""" let py_obj = py.evaluate(py_code) print(py_obj) router.add_api_route("/mojo", py_obj) app.include_router(router) print("Start FastAPI WEB Server") uvicorn.run(app) print("Done") ``` ### Mojo🔥FastAPI Client ```python from PythonInterface import Python let http_client = Python.import_module("http.client") let conn = http_client.HTTPConnection("localhost", 8000) conn.request("GET", "/mojo") let response = conn.getresponse() print(response.status, response.reason, response.read()) ``` As usual, you should create two separate notebooks, and run **FastAPI** first then **FastAPIClient**. * [Mojo🔥FastAPI Server](algorithm/MojoFastAPI.mojo) * [Mojo🔥FastAPI Server Jupyter Notebook](notebooks/MojoFastAPI.ipynb) * [Mojo🔥FastAPI Client](algorithm/MojoFastAPIClient.mojo) * [Mojo🔥FastAPI Client Jupyter Notebook](notebooks/MojoFastAPIClient.ipynb) There are a lot of open questions, but basically we achieve the goal. <img src="img/MojoFastAPI.png" width="600" /> <img src="img/MojoFastAPIClient.png" width="600" /> Mojo🔥 well done! Some open questions: - Lack of Python syntax sugar - Lack of Mojo types implicitly converted into Python objects - How to pass Mojo function into Python space/function ```python from PythonInterface import Python let pyfn = Python.evaluate("lambda x, y: x+y") let functools = Python.import_module("functools") print(functools.reduce(pyfn, [1, 2, 3, 4])) # How to, without Mojo pyfn.so? def pyfn(x, y): retyrn x+y ``` The future looks very optimistic! Links: * [Mojo types in Python](https://docs.modular.com/mojo/programming-manual.html#mojo-types-in-python) * [Mandelbrot in Mojo with Python plots](https://docs.modular.com/mojo/notebooks/Mandelbrot.html) # Code implementation ## Radiative transfer [Benchmark Mojo vs Numba by Nick Wogan](https://gist.github.com/Nicholaswogan/ca156adb065cb598bd3903b3eaab2381) ## Instant and DateTimeLocal [Time utils by Samay Kapadia @Zalando](https://github.com/modularml/mojo/issues/156) ## IDEA [Connecting to your mojo playground from VSCode or DataSpell](https://github.com/modularml/mojo/discussions/277) ## Python Interface and reading files by Maxim Zaks ```python from String import String from PythonInterface import Python let pathlib = Python.import_module('pathlib') let txt = pathlib.Path('nfl.csv').read_text() let s: String = txt.to_string() ``` [libc implementation](https://github.com/crisadamo/mojo-libc/blob/main/Libc.mojo) ## Pointer data ```python from DType import DType from Buffer import Buffer from Pointer import Pointer from String import String, chr let hello = "hello" let pointer = Pointer(hello.data()) print("variant 1") var result = String() for i in range(len(hello)): result += chr(pointer.bitcast[Int8]().offset(i).load().to_int()) print(result) print("variant 2") print(StringRef(hello.data())) print("variant 3") print(StringRef(pointer.address)) print("variant 4") let pm: Pointer[__mlir_type.`!pop.scalar<si8>`] = Pointer(hello.data()) print(StringRef(pm.address)) print("variant 5") print(String(pointer.address)) print("variant 6") let x = Buffer[8, DType.int8](pointer) let array = x.simd_load[10](0) var result = String() for i in range(len(array)): result += chr(array[i].to_int()) print(result) ``` ## Code share from Mojo Playground 1. From the Mojo Playground, `right click` the file in the explorer and press `Open With > Editor` 2. Right click in the editor, `select all` and `copy` 3. Create a new [GitHub gist](https://gist.github.com) or put Jupyter notebook file into yor GitHub repository 4. Paste in the contents and name the file with the Jupyter extension like test`.ipynb` 5. Paste the link to the gist in the Discord chat Github renders it properly, and then if someone wants to try out the code in their playground they can copy paste the raw code. # The Zen of Mojo🔥 * [Style Guide for Mojo Code. Zen of Mojo #141](https://github.com/modularml/mojo/discussions/141) # Space for improvements It is my personal view, so don't judge me too harshly. I can't say that Mojo🔥 is an easy programming language for learning, like a Python as an example. It requires a lot of understanding, patience and experience in any other programming languages. If you want to build something not trivial, it will be hard but funny! It has been **2 weeks** since I embarked on this **journey**, and I am thrilled to share that I have now become **well-acquainted** with the Mojo🔥. The intricacies of its **structure and syntax** have started to **unravel before my eyes**, and I am filled with a newfound **understanding**. I am proud to say that I can now confidently **craft code** in this language, allowing me to bring to life a **diverse** range of **ideas**. ## Major things to improve: 1. Weak and unclear **documentation**. 2. Lack of **code examples**. A good example is [clojuredocs](https://clojuredocs.org) website. 3. More **explanation** to the language **paradigms** 4. Lack **comparison** to Python base things datatypes/functions/classes/expressions. 5. Even though Mojo is superset of Python, the **threshold** of language entry is **not so simple**. 6. A little bit raw, need some time for **stabilizing** language. Production release 1.0. 7. **Bugs**, like in any one. 8. Small **standard library**. 9. Project Jupyter and **notebooks environment**. I understand that Jupyter plugin and custom kernel are a good solution, but it is makes development so slow. 10. Not **open-sourced** yet. The community is waiting for open source compiler and REPL to start developing and producing libraries and applications. I think the community will easily rewrite the (bootstrapping) compiler from C++ to itself Mojo🔥. ## Good and nice for win 1. **Modular team** easily responds to requests/questions/letters/ideas 2. **Friendly** and very smart **community** 3. **Problem-solving** programming language with an idea to not create new syntax but deal with real word challenges. 4. I don't know about you, but I was waiting and researching a long time for a Mojo🔥. I have been tried a hundred of programming languages. The World is ready for the revolution and the future of computation and AI. I'm really into Mojo🔥, it excites, fascinates me, and I hope it does the same for you. 5. I believe that a well-known distinguished leader Ph.D. Computer Science Chris Lattner can build things, systems, teams and change the future. ## Modular and Mojo🔥 history and etymology Mojo🔥 is a [Modular Inc](https://www.modular.com) programming language. Why **Mojo** we [discussed here](https://github.com/ego/awesome-mojo#why-is-it-called-mojo). About [Company](https://www.modular.com/about) we know less, but it has a very cool name `Modular`, which can be referred to: * [Modular arithmetic](https://en.wikipedia.org/wiki/Modular_arithmetic) * [Modulo](https://en.wikipedia.org/wiki/Modulo) * [Modular programming](https://en.wikipedia.org/wiki/Modular_programming) * [Modularity](https://en.wikipedia.org/wiki/Modularity) > ["In other words: Mojo isn’t magic, it’s modular."](https://docs.modular.com/mojo/notebooks/BoolMLIR.html) All about computing, programming, AI/ML. A very good domain name that accurately describes the meaning of the Company. There are some additional materials about [Modular's Brand Story](https://www.modular.com/blog/modulars-brand-story) and [Helping Modular Humanize AI Through Brand](https://www.metalab.com/blog/helping-modular-humanize-ai-through-brand) # Additional materials * [Chris Lattner](https://nondot.org/sabre/) * [LLVM](https://llvm.org) * [MLIR](https://mlir.llvm.org) * [Circuit IR Compilers and Tools](https://circt.llvm.org) * [Cross Compile Compiler-rt](https://releases.llvm.org/8.0.1/docs/HowToCrossCompileBuiltinsOnArm.html) * [The future of AI depends on Modularity](https://www.modular.com/blog/the-future-of-ai-depends-on-modularity) * [The Architecture of Open Source Applications LLVM](https://aosabook.org/en/v1/llvm.html) * [The Golden Age of Compiler Design in an Era of HW/SW Co-design by Dr. Chris Lattner](https://youtu.be/4HgShra-KnY) * [LLVM in 100 Seconds](https://youtu.be/BT2Cv-Tjq7Q) * [Mojo Dojo](https://mojodojo.dev/mojo_team_answers.html) * [Mojo Cheatsheet](https://github.com/czheo/mojo-cheatsheet/tree/main) * [Counting chars with SIMD in Mojo](https://mzaks.medium.com/counting-chars-with-simd-in-mojo-140ee730bd4d) * [History of programming languages](https://en.wikipedia.org/wiki/History_of_programming_languages) ## MLIR and low-level implementation * [Doxygen mlir](https://mlir.llvm.org/doxygen/index.html) * [IndexOps](https://mlir.llvm.org/docs/Dialects/IndexOps/) * [LLVM libc](https://libc.llvm.org/) * [GNU libc](https://www.gnu.org/software/libc/manual/html_mono/libc.html) * [GNU libc Index](https://www.gnu.org/software/libc/manual/html_node/Function-Index.html) ## Python / C++ * [Numpy](https://numpy.org/doc/stable/user/whatisnumpy.html) * [Numba](https://numba.pydata.org/numba-doc/latest/user/5minguide.html) based on (LLVM) * [PyPy](https://www.pypy.org/) * [Google JAX](https://github.com/google/jax) based on (XLA) * [Autograd](https://github.com/hips/autograd) * [XLA](https://www.tensorflow.org/xla) * [Ray](https://github.com/ray-project/ray) * [Taichi Lang](https://github.com/taichi-dev/taichi) * [Taichi compared to cub cupy numba](https://docs.taichi-lang.org/blog/taichi-compared-to-cub-cupy-numba) * [Codon](https://github.com/exaloop/codon) * [Codon benchmarks](https://exaloop.io/benchmarks) * [CuPy](https://github.com/cupy/cupy) * [Cython](https://github.com/cython/cython) * [Pythran](https://github.com/serge-sans-paille/pythran) * [Mypyc](https://mypyc.readthedocs.io/en/latest/introduction.html) * [Nuitka](https://github.com/Nuitka/Nuitka) * [DeepSpeed](https://github.com/microsoft/DeepSpeed) * [Benchmarks for CPU and GPU performance high-performance Python libs](https://github.com/dionhaefner/pyhpc-benchmarks) * [Metaflow](https://metaflow.org) * [Accelerating experimentation with mlops](https://www.rea-group.com/about-us/news-and-insights/blog/accelerating-experimentation-with-mlops/) * [nebuly-ai](https://github.com/nebuly-ai/nebuly/tree/v0.9.0) * [Numba compiler for Python bytecode, Numba IR into LLVM IR, Compile LLVM IR to machine code](https://numba.readthedocs.io/en/stable/developer/architecture.html) ## AI * [Accelerated Computing](https://blogs.nvidia.com/blog/2021/09/01/what-is-accelerated-computing/) * [ONNX open standard for machine learning](https://github.com/onnx/onnx) * [ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator](https://github.com/microsoft/onnxruntime) * [CUDA](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html) * [OpenCL](https://www.khronos.org/opencl/) * [SYCL](https://www.khronos.org/api/index_2017/sycl) * [Google Brain TensorFlow](https://github.com/tensorflow/tensorflow) * [PyTorch](https://github.com/pytorch/pytorch) * [TensorRT](https://github.com/NVIDIA/TensorRT) * [OpenaAI Triton language and compiler](https://github.com/openai/triton) * [Made With ML](https://madewithml.com) * [Vertex AI](https://cloud.google.com/vertex-ai) * [Google TPU](https://cloud.google.com/tpu) * [Sagemaker](https://aws.amazon.com/sagemaker/) * [MLIR: accelerating AI with open-source infrastructure](https://www.blog.google/technology/ai/mlir-accelerating-ai-open-source-infrastructure/) * [Apache TVM](https://tvm.apache.org) ## Python hints Todat I would like to tell story about Python Enum problem. As a software engineers we often meet it in a WEB. Assume we have this DataBase Schema (PostgreSQL) with status `enum`: ```SQL CREATE TYPE public.status_type AS ENUM ( 'FIRST', 'SECOND' ); ``` In a Python code we need names and values as strings (assume we use GraphQL with some ENUM type for our frontend side), and we need to maintain their order and have ability to compare these enums: `order2.status > order1.status > 'FIRST'` So it's a problem for most of common languages =) but we can use a `little-known` Python feature and override enum class method: `__new__`. - But Why? - Hm.. To assosiate each enum value with its INDEX! `MALE -> 1`, `FEMALE -> 2`, like PostgreSQL do. - and How? - Just COUNT its members with the `len` function! ```Python import enum from functools import total_ordering @total_ordering @enum.unique class BaseUniqueSortedEnum(enum.Enum): """Base unique enum class with ordering.""" def __new__(cls, *args, **kwargs): obj = object.__new__(cls) obj.index = len(cls.__members__) + 1 # This code line is a piece of advice, an insight and a tip! return obj # and then boring Python's magic methods as usual... def __hash__(self) -> int: return hash( f"{self.__module__}_{self.__class__.__name__}_{self.name}_{self.value}" ) def __eq__(self, other) -> bool: self._check_type(other) return super().__eq__(other) def __lt__(self, other) -> bool: self._check_type(other) return self.index < other.index def _check_type(self, other) -> None: if type(self) != type(other): raise TypeError(f"Different types of Enum: {self} != {other}") class Dog(BaseUniqueSortedEnum): # THIS ORDER MATTERS! BLOODHOUND = "BLOODHOUND" WEIMARANER = "WEIMARANER" SAME = "SAME" class Cat(BaseUniqueSortedEnum) # THIS ORDER MATTERS! BRITISH = "BRITISH" SCOTTISH = "SCOTTISH" SAME = "SAME" # and some tests assert Dog.BLOODHOUND < Dog.WEIMARANER assert Dog.BLOODHOUND <= Dog.WEIMARANER assert Dog.BLOODHOUND != Dog.WEIMARANER assert Dog.BLOODHOUND == Dog.BLOODHOUND assert Dog.WEIMARANER == Dog.WEIMARANER assert Dog.WEIMARANER > Dog.BLOODHOUND assert Dog.WEIMARANER >= Dog.BLOODHOUND assert Cat.BRITISH < Cat.SCOTTISH assert Cat.BRITISH <= Cat.SCOTTISH assert Cat.BRITISH != Cat.SCOTTISH assert Cat.BRITISH == Cat.BRITISH assert Cat.SCOTTISH == Cat.SCOTTISH assert Cat.SCOTTISH > Cat.BRITISH assert Cat.SCOTTISH >= Cat.BRITISH assert hash(Dog.BLOODHOUND) == hash(Dog.BLOODHOUND) assert hash(Dog.WEIMARANER) == hash(Dog.WEIMARANER) assert hash(Dog.BLOODHOUND) != hash(Dog.WEIMARANER) assert hash(Dog.SAME) != hash(Cat.SAME) # raise TypeError Dog.SAME <= Cat.SAME Dog.SAME < Cat.SAME Dog.SAME > Cat.SAME Dog.SAME >= Cat.SAME Dog.SAME != Cat.SAME ``` The end of the story. and use this `Python ENUM` **insight** for your well-codding! # Contributing * Your contributions are always welcome! * If you have any **question**, do not hesitate to contact me. * If you would like to participate in the initiative [Mojo🔥Driven Community](https://mojo-lang.dev), please contact me. * [Your help supporting this repository](https://github.com/ego/awesome-mojo/issues/1) --- BinarySearch_Mojo.mojo.txt --- """Implements basic binary search.""" from Benchmark import Benchmark from Vector import DynamicVector alias SIZE = 1000000 alias NUM_WARMUP = 0 alias MAX_ITERS = 100 fn mojo_binary_search(element: Int, array: DynamicVector[Int]) -> Int: var start = 0 var stop = len(array) - 1 while start <= stop: let index = (start + stop) // 2 let pivot = array[index] if pivot == element: return index elif pivot > element: stop = index - 1 elif pivot < element: start = index + 1 return -1 @parameter # statement runs at compile-time. fn get_collection() -> DynamicVector[Int]: var v = DynamicVector[Int](SIZE) for i in range(SIZE): v.push_back(i) return v fn test_mojo_binary_search() -> F64: fn test_closure(): _ = mojo_binary_search(SIZE - 1, get_collection()) return F64(Benchmark(NUM_WARMUP, MAX_ITERS).run[test_closure]()) / 1e9 print( "Average execution time of func in sec ", test_mojo_binary_search(), ) --- BinarySearch_Zig.zig.txt --- // Binary Search // zig build-exe binary_search.zig && ./binary_search const std = @import("std"); fn binarySearch(comptime T: type, arr: []const T, target: T) ?usize { var lo: usize = 0; var hi: usize = arr.len - 1; while (lo <= hi) { var mid: usize = (lo + hi) / 2; if (arr[mid] == target) { return mid; } else if (arr[mid] < target) { lo = mid + 1; } else { hi = mid - 1; } } return null; } pub fn main() !void { const nums = [_]u8{1, 3, 5, 7, 9, 11, 13, 15}; const target: u8 = 7; const found = binarySearch(u8, &nums, target); std.log.info("Target found at index {}.\n", .{found.?}); } --- FibFn_Mojo.mojo.txt --- from Time import now fn fibf(n: Int) -> Int: return n if n < 2 else fibf(n - 1) + fibf(n - 2) def run_mojo_fn_benchmark(): let t0 = now() let ans = fibf(40) let t1 = now() print("Computed fibf(40)", ans, F64(t1 - t0) / 1e9, "seconds") run_mojo_fn_benchmark() # Computed fibf(40) 102334155 0.41657813999999999 seconds fn fibf_range(n: Int) -> Int: var a: Int = 0 var b: Int = 1 for _ in range(n): a = b b = a+b return a def run_mojo_fibf_range_benchmark(): let t0 = now() let ans = fibf_range(40) let t1 = now() print("Computed fibf_range(40)", ans, F64(t1 - t0) / 1e9, "seconds") run_mojo_fibf_range_benchmark() # Computed fibf_range(40) 549755813 3.7e-08 seconds --- Fib_Python.py.txt --- #%%python import os from time import time, perf_counter def fib(n): return n if n < 2 else fib(n - 1) + fib(n - 2) def run_python_benchmark(): t0 = time() ans = fib(40) t1 = time() print(f'Computed fib(40) = {ans} in {t1 - t0} seconds.') run_python_benchmark() # Computed fib(40) = 102334155 in 21.669286727905273 seconds. def fib_range(n): a, b = 0, 1 for _ in range(n): a, b = b, a+b return a def run_python_fib_range_benchmark(): start_time = perf_counter() t0 = time() ans = fib_range(40) t1 = time() end_time = perf_counter() if t1 - t0 <= 0: res = end_time - start_time print(f'Computed fib_range(40) = {ans} in {res} seconds.') else: res = t1 - t0 print(f'Computed fib_range(40) = {ans} in {res:f} seconds.') run_python_fib_range_benchmark() # Python: Computed fib_range(40) = 102334155 in 4.5299530029296875e-06 seconds. # Codon: Computed fib_range(40) = 102334155 in 2.07685e-07 seconds. --- HelloMojo.🔥.txt --- print("Hello Mojo!") --- MLIR_libc.mojo.txt --- from Intrinsics import external_call from SIMD import SIMD, SI8 from DType import DType from Vector import DynamicVector from DType import DType from Pointer import DTypePointer, Pointer # Let's do something interesting - call libc function [gethostname](https://www.gnu.org/software/libc/manual/html_node/Host-Identification.html#index-gethostname) # function has this interface `int gethostname (char *name, size_t size)`. # For that we can use helper function [external_call](https://docs.modular.com/mojo/MojoStdlib/Intrinsics.html#external_call) from Intrinsics module or write own MLIR. # We can use `from String import String` but for clarification we will use a full form. # DynamicVector[SIMD[DType.si8, 1]] == DynamicVector[SI8] == String # Compile time stuff. alias cArrayOfStrings = DynamicVector[SIMD[DType.si8, 1]] alias capacity = 1024 var c_pointer_to_array_of_strings = DTypePointer[DType.si8](cArrayOfStrings(capacity).data) var c_int_result = external_call["gethostname", Int, DTypePointer[DType.si8], Int](c_pointer_to_array_of_strings, capacity) let mojo_string_result = String(c_pointer_to_array_of_strings.address) print("C function gethostname result code:", c_int_result) print("C function gethostname result value:", star_hostname(mojo_string_result)) # <img src="img/gethostname.png" height="200" /> @always_inline fn star_hostname(hostname: String) -> String: # [Builtin Slice](https://docs.modular.com/mojo/MojoBuiltin/BuiltinSlice.html) # string slice[start:end:step] return hostname[0:-1:2] --- MatrixStruct.mojo.txt --- from Pointer import DTypePointer from DType import DType from Memory import memset_zero from SIMD import SIMD struct Matrix: var data: DTypePointer[DType.ui8] fn __init__(inout self): "Initialize the struct and set everything to zero" self.data = DTypePointer[DType.ui8].alloc(64) memset_zero(self.data, 64) # This is what will run when the object goes out of scope fn __del__(owned self): return self.data.free() # This allows you to use let x = obj[1] fn __getitem__(self, row: Int) -> SIMD[DType.ui8, 8]: return self.data.simd_load[8](row * 8) # This allows you to use obj[1] = SIMD[DType.ui8]() fn __setitem__(self, row: Int, data: SIMD[DType.ui8, 8]): return self.data.simd_store[8](row * 8, data) fn print_all(self): print("--------matrix--------") for i in range(8): print(self[i]) let matrix = Matrix() matrix.print_all() for i in range(8): matrix[i][0] = 9 matrix[i][7] = 9 matrix.print_all() var fourth_row = matrix[3] print("\nforth row:", fourth_row) fourth_row *= 2 print("modified:", fourth_row, "\n") matrix[0] = fourth_row matrix.print_all() --- MergeSort_Mojo.mojo.txt --- from Benchmark import Benchmark from Vector import DynamicVector from StaticTuple import StaticTuple from Sort import sort alias NUM_WARMUP = 0 alias MAX_ITERS = 100 fn merge(inout A: DynamicVector[Int], p: Int, q: Int, r: Int): let n1 = q - p + 1 let n2 = r - q var L = DynamicVector[Int](n1) var R = DynamicVector[Int](n2) for i in range(n1): L[i] = A[p + i] for j in range(n2): R[j] = A[q + 1 + j] var i = 0 var j = 0 var k = p while i < n1 and j < n2: if L[i] <= R[j]: A[k] = L[i] i += 1 else: A[k] = R[j] j += 1 k += 1 while i < n1: A[k] = L[i] i += 1 k += 1 while j < n2: A[k] = R[j] j += 1 k += 1 fn merge_sort(inout A: DynamicVector[Int], p: Int, r: Int): if p < r: let q = (p + r) // 2 merge_sort(A, p, q) merge_sort(A, q + 1, r) merge(A, p, q, r) @parameter fn create_vertor() -> DynamicVector[Int]: let st = StaticTuple[MAX_ITERS, Int](14, 72, 50, 83, 18, 20, 13, 30, 17, 87, 94, 65, 24, 99, 70, 44, 5, 12, 74, 6, 32, 63, 91, 88, 43, 54, 27, 39, 64, 78, 29, 62, 58, 59, 61, 89, 2, 15, 41, 9, 93, 90, 23, 96, 73, 14, 8, 28, 11, 42, 77, 34, 52, 80, 57, 84, 21, 60, 66, 40, 7, 85, 47, 98, 97, 35, 82, 36, 49, 3, 68, 22, 67, 81, 56, 71, 4, 38, 69, 95, 16, 48, 1, 31, 75, 19, 10, 25, 79, 45, 76, 33, 53, 55, 46, 37, 26, 51, 92, 86) var v = DynamicVector[Int](st.__len__()) for i in range(st.__len__()): v.push_back(st[i]) return v fn run_benchmark_merge_sort() -> F64: fn _closure(): var A = create_vertor() merge_sort(A, 0, len(A)-1) return F64(Benchmark(NUM_WARMUP, MAX_ITERS).run[_closure]()) / 1e9 print( "Average execution time of Mojo🔥 `merge_sort` in sec", run_benchmark_merge_sort(), ) # Average execution time of Mojo🔥 `merge_sort` in sec 1.1345999999999999e-05 fn run_benchmark_sort() -> F64: fn _closure(): var A = create_vertor() sort(A) return F64(Benchmark(NUM_WARMUP, MAX_ITERS).run[_closure]()) / 1e9 print( "Average execution time of Mojo🔥 builtin `sort` in sec", run_benchmark_sort(), ) # Average execution time of Mojo🔥 builtin `sort` in sec 2.988e-06 # Usage: merge_sort # var A = create_vertor() # merge_sort(A, 0, len(A)-1) # print(len(A)) # print(A[0], A[99]) --- MojoFastAPI.mojo.txt --- from PythonInterface import Python from PythonObject import PythonObject # Python fastapi let fastapi = Python.import_module("fastapi") let uvicorn = Python.import_module("uvicorn") var app = fastapi.FastAPI() var router = fastapi.APIRouter() # tricky part let py = Python() let py_code = """lambda: 'Hello Mojo🔥!'""" let py_obj = py.evaluate(py_code) print(py_obj) router.add_api_route("/mojo", py_obj) app.include_router(router) print("Start FastAPI WEB Server") uvicorn.run(app) print("Done") --- MojoFastAPIClient.mojo.txt --- from PythonInterface import Python let http_client = Python.import_module("http.client") let conn = http_client.HTTPConnection("localhost", 8000) conn.request("GET", "/mojo") let response = conn.getresponse() print(response.status, response.reason, response.read()) --- Pointer.mojo.txt --- from Pointer import Pointer from Memory import memset_zero from SIMD import SIMD @register_passable struct Coord: var x: UI8 var y: UI8 struct Coords: var data: Pointer[Coord] var length: Int fn __init__(inout self, length: Int) raises: # keyword raises https://docs.modular.com/mojo/programming-manual.html#fn-definitions self.data = Pointer[Coord].alloc(length) memset_zero(self.data, length) self.length = length fn __getitem__(self, index: Int) raises -> Coord: if index > self.length - 1: raise Error("Trying to access index out of bounds") return self.data.load(index) fn __del__(owned self): self.data.free() fn store_coord(inout self, offset: Int, value: Coord): return self.data.store(offset, value) var coords = Coords(5) var second = coords[2] print("second.x:", second.x) second.x = 1 print("second.x = 1:", second.x) print("pointer.data[2].x:", coords.data[2].x) coords.store_coord(2, second) # or coords.data.store(2, second) print("second.x = 1:", second.x) print("pointer.data[2].x:", coords.data[2].x) """ second.x: 0 second.x = 1: 1 pointer.data[2].x: 0 second.x = 1: 1 pointer.data[2].x: 1 """ --- TCPSocketClient.mojo.txt --- """Mojo TCP Socket Client with PythonInterface""" from PythonInterface import Python from PythonObject import PythonObject let time = Python.import_module('time') let os = Python.import_module('os') let socket = Python.import_module('socket') let server = "10.8.95.167" let port = 55555 print("Start TCP Client.") let client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print("Connect to server", server, port) client.connect((server, port)) let msg = PythonObject("Hello, Mojo🔥 TCP Client") print("Sending data", msg) client.send(msg.encode()) # wait a little bit time.sleep(4) print("Waiting ..") while True: let data = client.recv(1024) if data: print("Message from Server", data) break client.shutdown(1) client.close() print("Disconnect and close connection.") --- TCPSocketServer.mojo.txt --- """Mojo TCP Socket Server with PythonInterface""" from PythonInterface import Python # Python Socket let socket = Python.import_module('socket') let host = socket.gethostbyname(socket.gethostname()).to_string() print(host) py_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) py_socket.bind(("10.8.95.167", 55555)) print("Socket bind to", "10.8.95.167", 55555) py_socket.listen() print("Listen for client connection ..") var conn_addr = py_socket.accept() var conn = conn_addr[0] let addr = conn_addr[1] print("Connected by client", addr) while True: let data = conn.recv(1024) if data: print("Message from client", data) else: break # ping-pong conn.sendall(data) conn.close() print("Connection close.") py_socket.close() print("Socket close.") --- bfs_V.v.txt --- // Breadth-First Search (BFS) allows you to find the shortest distance between two nodes in the graph. fn breadth_first_search_path(graph map[string][]string, vertex string, target string) []string { mut path := []string{} mut visited := []string{init: vertex} mut queue := [][][]string{} queue << [[vertex], path] for queue.len > 0 { mut idx := queue.len - 1 node := queue[idx][0][0] path = queue[idx][1] queue.delete(idx) if node == target { path << node return path } for child in graph[node] { mut tmp := path.clone() if child !in visited { visited << child tmp << node queue << [[child], tmp] } } } return path } fn main() { graph := map{ 'A': ['B', 'C'] 'B': ['A', 'D', 'E'] 'C': ['A', 'F'] 'D': ['B'] 'E': ['B', 'F'] 'F': ['C', 'E'] } println('Graph: $graph') path := breadth_first_search_path(graph, 'A', 'F') println('The shortest path from node A to node F is: $path') assert path == ['A', 'C', 'F'] } --- binarySearch_Nim.nim.txt --- # Binary search. # nim c -r --verbosity:0 binarySearch.nim proc binarySearch[T](a: openArray[T], key: T): int = var b = len(a) while result < b: var mid = (result + b) div 2 if a[mid] < key: result = mid + 1 else: b = mid if result >= len(a) or a[result] != key: result = -1 let res = @[2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,25,27,30] echo binarySearch(res, 10) --- binarySearch_Swift.swift.txt --- // Binary search, find index of `elem` in items. func binarySearch(items: [Int], elem: Int) -> Int { var low = 0 var high = items.count - 1 var mid = 0 while low <= high { mid = Int((high + low) / 2) if items[mid] < elem { low = mid + 1 } else if items[mid] > elem { high = mid - 1 } else { return mid } } return -1 } let items = [1, 2, 3, 4, 0].sorted() let res = binarySearch(items: items, elem: 4) print(res) --- binary_search_Python.py.txt --- """Implements basic binary search.""" from typing import List, Union import timeit SIZE = 1000000 MAX_ITERS = 100 COLLECTION = tuple(i for i in range(SIZE)) # Make it aka at compile-time. def python_binary_search(element: int, array: List[int]) -> int: start = 0 stop = len(array) - 1 while start <= stop: index = (start + stop) // 2 pivot = array[index] if pivot == element: return index elif pivot > element: stop = index - 1 elif pivot < element: start = index + 1 return -1 def test_python_binary_search(): _ = python_binary_search(SIZE - 1, COLLECTION) print( "Average execution time of func in sec", timeit.timeit(lambda: test_python_binary_search(), number=MAX_ITERS), ) --- binary_search_V.v.txt --- // Binary search. // v fmt -w binary_search.v // v -prod binary_search.v && ./binary_search fn binary_search(a []int, value int) int { mut low := 0 mut high := a.len - 1 for low <= high { mid := (low + high) / 2 if a[mid] > value { high = mid - 1 } else if a[mid] < value { low = mid + 1 } else { return mid } } return -1 } fn main() { search_list := [1, 2, 3, 5, 6, 7, 8, 9, 10] println(binary_search(search_list, 9)) } --- binarysearch_Julia.jl.txt --- # Julia version 0.6 # Binary search. function binarysearch(lst::Vector{T}, val::T) where T low = 1 high = length(lst) while low ≤ high mid = (low + high) ÷ 2 if lst[mid] > val high = mid - 1 elseif lst[mid] < val low = mid + 1 else return mid end end return 0 end --- fizz_buzz_Clojure.clj.txt --- ;; https://onecompiler.com/clojure/3z9d9dfz6 (import '[java.io OutputStream]) (require '[clojure.java.io :as io]) (def devnull (io/writer (OutputStream/nullOutputStream))) (defmacro timeit [n expr] `(with-out-str (time (dotimes [_# ~(Math/pow 1 n)] (binding [*out* devnull] ~expr))))) (defmacro macro-fizz-buzz [n] `(fn [] (print ~(apply str (for [i (range 1 (inc n))] (cond (zero? (mod i 15)) "FizzBuzz\n" (zero? (mod i 5)) "Buzz\n" (zero? (mod i 3)) "Fizz\n" :else (str i "\n"))))))) (print (timeit 100 (macro-fizz-buzz 100))) ;; "Elapsed time: 0.175486 msecs" ;; 0.000175486 seconds --- fizz_buzz_Mojo.mojo.txt --- from String import String from Benchmark import Benchmark alias SIZE = 100 alias NUM_WARMUP = 0 alias MAX_ITERS = 100 @parameter # statement runs at compile-time. fn _fizz_buzz() -> String: var res: String = "" for n in range(1, SIZE+1): if (n % 3 == 0) and (n % 5 == 0): res += "FizzBuzz" elif n % 3 == 0: res += "Fizz" elif n % 5 == 0: res += "Buzz" else: res += String(n) res += "\n" return res fn fizz_buzz(): print(_fizz_buzz()) fn run_benchmark() -> F64: fn _closure(): _ = fizz_buzz() return F64(Benchmark(NUM_WARMUP, MAX_ITERS).run[_closure]()) / 1e9 print( "Average execution time of func in sec ", run_benchmark(), ) --- fizz_buzz_Python.py.txt --- import timeit SIZE = 100 MAX_ITERS = 100 def _fizz_buzz(): # Make it aka at compile-time. res = [] for n in range(1, SIZE+1): if (n % 3 == 0) and (n % 5 == 0): s = "FizzBuzz" elif n % 3 == 0: s = "Fizz" elif n % 5 == 0: s = "Buzz" else: s = str(n) res.append(s) return res DATA = _fizz_buzz() def fizz_buzz(): print("\n".join(DATA)) print( "Average execution time of Python func in sec", timeit.timeit(lambda: fizz_buzz(), number=MAX_ITERS), ) --- merge_sort_Python.py.txt --- #%%python import timeit MAX_ITERS = 100 def merge(A, p, q, r): n1 = q - p + 1 n2 = r - q L = [None] * n1 R = [None] * n2 for i in range(n1): L[i] = A[p + i] for j in range(n2): R[j] = A[q + 1 + j] i = 0 j = 0 k = p while i < n1 and j < n2: if L[i] <= R[j]: A[k] = L[i] i += 1 else: A[k] = R[j] j += 1 k += 1 while i < n1: A[k] = L[i] i += 1 k += 1 while j < n2: A[k] = R[j] j += 1 k += 1 def merge_sort(A, p, r): if p < r: q = (p + r) // 2 merge_sort(A, p, q) merge_sort(A, q + 1, r) merge(A, p, q, r) def run_benchmark_merge_sort(): A = [14, 72, 50, 83, 18, 20, 13, 30, 17, 87, 94, 65, 24, 99, 70, 44, 5, 12, 74, 6, 32, 63, 91, 88, 43, 54, 27, 39, 64, 78, 29, 62, 58, 59, 61, 89, 2, 15, 41, 9, 93, 90, 23, 96, 73, 14, 8, 28, 11, 42, 77, 34, 52, 80, 57, 84, 21, 60, 66, 40, 7, 85, 47, 98, 97, 35, 82, 36, 49, 3, 68, 22, 67, 81, 56, 71, 4, 38, 69, 95, 16, 48, 1, 31, 75, 19, 10, 25, 79, 45, 76, 33, 53, 55, 46, 37, 26, 51, 92, 86] merge_sort(A, 0, len(A)-1) print( "Average execution time of Python `merge_sort` in sec", timeit.timeit(lambda: run_benchmark_merge_sort(), number=MAX_ITERS), ) # Average execution time of Python `merge_sort` in sec 0.019136679999064654 def run_benchmark_sort(): A = [14, 72, 50, 83, 18, 20, 13, 30, 17, 87, 94, 65, 24, 99, 70, 44, 5, 12, 74, 6, 32, 63, 91, 88, 43, 54, 27, 39, 64, 78, 29, 62, 58, 59, 61, 89, 2, 15, 41, 9, 93, 90, 23, 96, 73, 14, 8, 28, 11, 42, 77, 34, 52, 80, 57, 84, 21, 60, 66, 40, 7, 85, 47, 98, 97, 35, 82, 36, 49, 3, 68, 22, 67, 81, 56, 71, 4, 38, 69, 95, 16, 48, 1, 31, 75, 19, 10, 25, 79, 45, 76, 33, 53, 55, 46, 37, 26, 51, 92, 86] A.sort() print( "Average execution time of Python builtin `sort` in sec", timeit.timeit(lambda: run_benchmark_sort(), number=MAX_ITERS), ) # Average execution time of Python builtin `sort` in sec 0.00019922800129279494 --- benchmarks.json.md.txt --- 1 Command './benchmarks/fibonacci_sequence/rust_iteration' runs: 100 mean: 0.001 s stddev: 0.000 s median: 0.001 s min: 0.001 s max: 0.003 s percentiles: P_05 .. P_95: 0.001 s .. 0.001 s P_25 .. P_75: 0.001 s .. 0.001 s (IQR = 0.000 s) 2 Command './benchmarks/fibonacci_sequence/mojo_iteration' runs: 100 mean: 0.001 s stddev: 0.000 s median: 0.001 s min: 0.001 s max: 0.005 s percentiles: P_05 .. P_95: 0.001 s .. 0.002 s P_25 .. P_75: 0.001 s .. 0.001 s (IQR = 0.000 s) 3 Command './benchmarks/fibonacci_sequence/codon_iteration' runs: 100 mean: 0.003 s stddev: 0.001 s median: 0.003 s min: 0.002 s max: 0.013 s percentiles: P_05 .. P_95: 0.002 s .. 0.004 s P_25 .. P_75: 0.002 s .. 0.003 s (IQR = 0.000 s) 4 Command 'python3 benchmarks/fibonacci_sequence/python_iteration.py' runs: 100 mean: 0.016 s stddev: 0.001 s median: 0.016 s min: 0.015 s max: 0.023 s percentiles: P_05 .. P_95: 0.016 s .. 0.017 s P_25 .. P_75: 0.016 s .. 0.017 s (IQR = 0.001 s) 5 Command 'python3 benchmarks/fibonacci_sequence/__pycache__/python_iteration.cpython-311.pyc' runs: 100 mean: 0.017 s stddev: 0.001 s median: 0.016 s min: 0.016 s max: 0.021 s percentiles: P_05 .. P_95: 0.016 s .. 0.018 s P_25 .. P_75: 0.016 s .. 0.017 s (IQR = 0.001 s) 6 Command 'mojo run benchmarks/fibonacci_sequence/mojo_iteration.mojo' runs: 100 mean: 0.044 s stddev: 0.001 s median: 0.044 s min: 0.042 s max: 0.049 s percentiles: P_05 .. P_95: 0.042 s .. 0.047 s P_25 .. P_75: 0.043 s .. 0.044 s (IQR = 0.001 s) 7 Command 'codon run --release benchmarks/fibonacci_sequence/codon_iteration.codon' runs: 100 mean: 0.631 s stddev: 0.015 s median: 0.627 s min: 0.612 s max: 0.677 s percentiles: P_05 .. P_95: 0.615 s .. 0.662 s P_25 .. P_75: 0.619 s .. 0.640 s (IQR = 0.020 s) --- codon_iteration.codon.txt --- def fibonacci_iteration(n): a, b = 0, 1 for _ in range(n): a, b = b, a+b return a fibonacci_iteration(100) --- codon_recursion.codon.txt --- def fibonacci_recursion(n): return n if n < 2 else fibonacci_recursion(n - 1) + fibonacci_recursion(n - 2) fibonacci_recursion(100) --- mojo_iteration.mojo.txt --- fn fibonacci_iteration(n: Int) -> Int: var a: Int = 0 var b: Int = 1 for _ in range(n): a = b b = a+b return a fn main(): _ = fibonacci_iteration(100) --- mojo_recursion.mojo.txt --- fn fibonacci_recursion(n: Int) -> Int: return n if n < 2 else fibonacci_recursion(n - 1) + fibonacci_recursion(n - 2) fn main(): _ = fibonacci_recursion(100) --- python_iteration.py.txt --- def fibonacci_iteration(n): a, b = 0, 1 for _ in range(n): a, b = b, a+b return a fibonacci_iteration(100) --- python_recursion.py.txt --- def fibonacci_recursion(n): return n if n < 2 else fibonacci_recursion(n - 1) + fibonacci_recursion(n - 2) fibonacci_recursion(100) --- rust_iteration.rs.txt --- fn fibonacci_iteration(n: usize) -> usize { let mut a = 0; let mut b = 1; for _ in 1..n { let old = a; a = b; b += old; } b } fn main() { let _ = fibonacci_iteration(100); } --- rust_recursion.rs.txt --- fn fibonacci_recursive(n: i64) -> i64 { if n < 2 { return n; } return fibonacci_recursive(n - 1) + fibonacci_recursive( n - 2); } fn main() { let _ = fibonacci_recursive(100); } --- README.md.txt --- This folder contains scripts that can be used in combination with hyperfines `--export-json` option. ### Example: ```bash hyperfine 'sleep 0.020' 'sleep 0.021' 'sleep 0.022' --export-json sleep.json python plot_whisker.py sleep.json ``` ### Pre-requisites To make these scripts work, you will need to install `numpy`, `matplotlib` and `scipy`. Install them via your package manager or `pip`: ```bash pip install numpy matplotlib scipy # pip3, if you are using python3 ``` --- advanced_statistics.py.txt --- #!/usr/bin/env python import argparse import json import numpy as np parser = argparse.ArgumentParser() parser.add_argument("file", help="JSON file with benchmark results") args = parser.parse_args() with open(args.file) as f: results = json.load(f)["results"] commands = [b["command"] for b in results] times = [b["times"] for b in results] for command, ts in zip(commands, times): p05 = np.percentile(ts, 5) p25 = np.percentile(ts, 25) p75 = np.percentile(ts, 75) p95 = np.percentile(ts, 95) iqr = p75 - p25 print("Command '{}'".format(command)) print(" runs: {:8d}".format(len(ts))) print(" mean: {:8.3f} s".format(np.mean(ts))) print(" stddev: {:8.3f} s".format(np.std(ts, ddof=1))) print(" median: {:8.3f} s".format(np.median(ts))) print(" min: {:8.3f} s".format(np.min(ts))) print(" max: {:8.3f} s".format(np.max(ts))) print() print(" percentiles:") print(" P_05 .. P_95: {:.3f} s .. {:.3f} s".format(p05, p95)) print( " P_25 .. P_75: {:.3f} s .. {:.3f} s " "(IQR = {:.3f} s)".format(p25, p75, iqr) ) print() --- merge_jsons.py.txt --- #!/usr/bin/env python """This script merge all *.json files in the derectory into one for plots.""" import os import json import argparse import glob def combine_json_files(input_directory, output_file): # Create an empty list to store JSON data from each file combined_data = [] # Use glob to find all JSON files in the specified directory json_files = glob.glob(os.path.join(input_directory, "*.json")) # Loop through the JSON files for json_file in json_files: with open(json_file, "r") as file: try: data = json.load(file) combined_data += data["results"] except json.JSONDecodeError: print(f"Error reading {json_file}. Skipping...") # Combine the JSON data from all files combined_json = json.dumps({"results": combined_data}, indent=4) # Write the combined JSON data to the output file with open(output_file, "w") as outfile: outfile.write(combined_json) print(f"Combined JSON data saved to {output_file}") if __name__ == "__main__": parser = argparse.ArgumentParser(description="Combine JSON files in a directory into one JSON file.") parser.add_argument("directory", help="Directory containing JSON files") parser.add_argument("output_file", help="Output file for combined JSON data") args = parser.parse_args() combine_json_files(args.directory, args.output_file) --- plot.py.txt --- #!/usr/bin/env python import os import argparse import glob import json import matplotlib.pyplot as plt def plot(file_path): # Load the JSON data from the file with open(file_path, 'r') as file: data = json.load(file) # Get the list of items under "results" result_items = data['results'] # Loop through each item and create a plot for "times" data for idx, item in enumerate(result_items, 1): times = item['times'] # Create a list of indices for the x-axis indices = list(range(1, len(times) + 1)) # Create a line plot of the "times" data plt.figure(figsize=(10, 6)) plt.plot(indices, times, marker='o', linestyle='-', color='b') plt.title(f'{item["command"]}') plt.xlabel('Runs') plt.ylabel('Time sec') plt.grid(True) plt.tight_layout() # Save the plot as an image plot_filename = f'{file_path}.{idx}.png' plt.savefig(plot_filename) # Display the plot plt.show() if __name__ == "__main__": parser = argparse.ArgumentParser(description="Plot") parser.add_argument("file", help="JSON file") args = parser.parse_args() plot(args.file) --- plot2.py.txt --- #!/usr/bin/env python import os import argparse import json import matplotlib.pyplot as plt def plot(file_path): # Load the JSON data from the file with open(file_path, 'r') as file: data = json.load(file) # Get the list of items under "results" result_items = data['results'] # Create a single figure with multiple subplots num_items = len(result_items) fig, axes = plt.subplots(num_items, 1, figsize=(10, 6 * num_items), sharex=True) # Loop through each item and create a subplot for "times" data for idx, item in enumerate(result_items): times = item['times'] # Create a list of indices for the x-axis indices = list(range(1, len(times) + 1)) # Create a line plot of the "times" data on the corresponding subplot ax = axes[idx] ax.plot(indices, times, marker='o', linestyle='-', color='b') ax.set_title(f'{item["command"]}') ax.set_ylabel('Time sec') ax.grid(True) # Set a common x-axis label axes[-1].set_xlabel('Runs') # Adjust subplot layout plt.tight_layout() # Save the combined plot as an image plt.savefig(f'{file_path}.combined.png') # Display the combined plot plt.show() if __name__ == "__main__": parser = argparse.ArgumentParser(description="Plot") parser.add_argument("file", help="JSON file") args = parser.parse_args() plot(args.file) --- plot3.py.txt --- #!/usr/bin/env python import os import argparse import json import matplotlib.pyplot as plt def plot(file_path): # Load the JSON data from the file with open(file_path, 'r') as file: data = json.load(file) # Get the list of items under "results" result_items = data['results'] # Create a single figure for the combined plot fig, ax = plt.subplots(figsize=(10, 6)) # Initialize lists to store combined data combined_times = [] # Define a list of colors for each line colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k'] # Loop through each item and combine "times" data for i, item in enumerate(result_items): times = item['times'] combined_times.extend(times) label = f'{item["command"]}' # Label for legend color = colors[i % len(colors)] # Cycle through colors ax.plot(times, marker='o', linestyle='-', color=color, label=label) # Create a list of indices for the x-axis indices = list(range(1, len(combined_times) + 1)) # Add a legend to the plot ax.legend() # Set labels and title ax.set_title('Combined Execution Times') ax.set_xlabel('Runs') ax.set_ylabel('Time (seconds)') ax.grid(True) # Save the combined plot as an image plt.savefig(f'{file_path}.all.png') # Display the combined plot plt.show() if __name__ == "__main__": parser = argparse.ArgumentParser(description="Plot") parser.add_argument("file", help="JSON file") args = parser.parse_args() plot(args.file) --- plot_histogram.py.txt --- #!/usr/bin/env python """This program shows `hyperfine` benchmark results as a histogram.""" import argparse import json import numpy as np import matplotlib.pyplot as plt parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("file", help="JSON file with benchmark results") parser.add_argument("--title", help="Plot title") parser.add_argument( "--labels", help="Comma-separated list of entries for the plot legend" ) parser.add_argument("--bins", help="Number of bins (default: auto)") parser.add_argument( "--type", help="Type of histogram (*bar*, barstacked, step, stepfilled)" ) parser.add_argument("-o", "--output", help="Save image to the given filename.") parser.add_argument( "--t-min", metavar="T", help="Minimum time to be displayed (seconds)" ) parser.add_argument( "--t-max", metavar="T", help="Maximum time to be displayed (seconds)" ) parser.add_argument( "--log-count", help="Use a logarithmic y-axis for the event count", action="store_true", ) args = parser.parse_args() with open(args.file) as f: results = json.load(f)["results"] if args.labels: labels = args.labels.split(",") else: labels = [b["command"] for b in results] all_times = [b["times"] for b in results] t_min = float(args.t_min) if args.t_min else np.min(list(map(np.min, all_times))) t_max = float(args.t_max) if args.t_max else np.max(list(map(np.max, all_times))) bins = int(args.bins) if args.bins else "auto" histtype = args.type if args.type else "bar" plt.hist( all_times, label=labels, bins=bins, histtype=histtype, range=(t_min, t_max), ) plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]}) plt.xlabel("Time [s]") if args.title: plt.title(args.title) if args.log_count: plt.yscale("log") else: plt.ylim(0, None) if args.output: plt.savefig(args.output) else: plt.show() --- welch_ttest.py.txt --- #!/usr/bin/env python """This script performs Welch's t-test on a JSON export file with two benchmark results to test whether or not the two distributions are the same.""" import argparse import json import sys from scipy import stats parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("file", help="JSON file with two benchmark results") args = parser.parse_args() with open(args.file) as f: results = json.load(f)["results"] if len(results) != 2: print("The input file has to contain exactly two benchmarks") sys.exit(1) a, b = [x["command"] for x in results[:2]] X, Y = [x["times"] for x in results[:2]] print("Command 1: {}".format(a)) print("Command 2: {}\n".format(b)) t, p = stats.ttest_ind(X, Y, equal_var=False) th = 0.05 dispose = p < th print("t = {:.3}, p = {:.3}".format(t, p)) print() if dispose: print("There is a difference between the two benchmarks (p < {}).".format(th)) else: print("The two benchmarks are almost the same (p >= {}).".format(th)) --- benchmarks.json.md.txt --- 1 Command './benchmarks/multibrot_set/multibrot_mojo_parallelize' runs: 10 mean: 0.007 s stddev: 0.001 s median: 0.007 s min: 0.006 s max: 0.008 s percentiles: P_05 .. P_95: 0.006 s .. 0.008 s P_25 .. P_75: 0.007 s .. 0.007 s (IQR = 0.001 s) 2 Command './benchmarks/multibrot_set/multibrot_codon' runs: 10 mean: 0.044 s stddev: 0.001 s median: 0.044 s min: 0.043 s max: 0.046 s percentiles: P_05 .. P_95: 0.043 s .. 0.046 s P_25 .. P_75: 0.043 s .. 0.045 s (IQR = 0.001 s) 3 Command './benchmarks/multibrot_set/multibrot' runs: 10 mean: 0.136 s stddev: 0.001 s median: 0.136 s min: 0.135 s max: 0.138 s percentiles: P_05 .. P_95: 0.135 s .. 0.138 s P_25 .. P_75: 0.135 s .. 0.137 s (IQR = 0.002 s) 4 Command 'python3 benchmarks/multibrot_set/__pycache__/multibrot.cpython-311.pyc' runs: 10 mean: 5.444 s stddev: 0.023 s median: 5.445 s min: 5.408 s max: 5.491 s percentiles: P_05 .. P_95: 5.414 s .. 5.477 s P_25 .. P_75: 5.429 s .. 5.455 s (IQR = 0.026 s) --- multibrot.codon.txt --- WIDTH = 960 HEIGHT = 960 MAX_ITERS = 200 MIN_X = -2.0 MAX_X = 0.6 MIN_Y = -1.5 MAX_Y = 1.5 def mandelbrot_kernel(c): z = c for i in range(MAX_ITERS): z = z * z + c # Change this for different Multibrot sets (e.g., 2 for Mandelbrot) if z.real * z.real + z.imag * z.imag > 4: return i return MAX_ITERS def compute_mandelbrot(): t = [[0 for _ in range(WIDTH)] for _ in range(HEIGHT)] # Pixel matrix dx = (MAX_X - MIN_X) / WIDTH dy = (MAX_Y - MIN_Y) / HEIGHT @par(collapse=2) for row in range(HEIGHT): for col in range(WIDTH): t[row][col] = mandelbrot_kernel(complex(MIN_X + col * dx, MIN_Y + row * dy)) return t compute_mandelbrot() # @python # def show_plot(tensor): # import matplotlib.pyplot as plt # from matplotlib import colors # import numpy as np # WIDTH = 960 # HEIGHT = 960 # MAX_ITERS = 200 # SCALE = 10 # DPI = 64 # numpy_array = np.zeros((HEIGHT, WIDTH), np.float64) # for row in range(HEIGHT): # for col in range(WIDTH): # numpy_array.itemset((col, row), tensor[col][row]) # fig = plt.figure(1, [SCALE, SCALE * HEIGHT // WIDTH], DPI) # ax = fig.add_axes((0.0, 0.0, 1.0, 1.0)) # light = colors.LightSource(315, 10, 0, 1, 1, 0) # image = light.shade(numpy_array, plt.cm.hot, colors.PowerNorm(0.3), "hsv", 0, 0, 1.5) # plt.imshow(image) # plt.axis("off") # plt.savefig("multibrot.codon.png") # plt.show() # mandelbrot = compute_mandelbrot() # show_plot(mandelbrot) --- multibrot.mojo.txt --- from complex import ComplexFloat64 from python import Python from tensor import Tensor from utils.index import Index alias FloatType = DType.float64 alias WIDTH = 960 alias HEIGHT = 960 alias MAX_ITERS = 200 alias MIN_X = -2.0 alias MAX_X = 0.6 alias MIN_Y = -1.5 alias MAX_Y = 1.5 # Compute the number of steps to escape. def multibrot_kernel(c: ComplexFloat64) -> Int: z = c for i in range(MAX_ITERS): z = z * z + c # Change this for different Multibrot sets (e.g., 2 for Mandelbrot) if z.squared_norm() > 4: return i return MAX_ITERS def compute_multibrot() -> Tensor[FloatType]: # create a matrix. Each element of the matrix corresponds to a pixel t = Tensor[FloatType](HEIGHT, WIDTH) dx = (MAX_X - MIN_X) / WIDTH dy = (MAX_Y - MIN_Y) / HEIGHT y = MIN_Y for row in range(HEIGHT): x = MIN_X for col in range(WIDTH): t[Index(row, col)] = multibrot_kernel(ComplexFloat64(x, y)) x += dx y += dy return t # def show_plot(tensor: Tensor[FloatType]): # alias scale = 10 # alias dpi = 64 # np = Python.import_module("numpy") # plt = Python.import_module("matplotlib.pyplot") # colors = Python.import_module("matplotlib.colors") # numpy_array = np.zeros((HEIGHT, WIDTH), np.float64) # for row in range(HEIGHT): # for col in range(WIDTH): # numpy_array.itemset((col, row), tensor[col, row]) # fig = plt.figure(1, [scale, scale * HEIGHT // WIDTH], dpi) # ax = fig.add_axes((0.0, 0.0, 1.0, 1.0)) # light = colors.LightSource(315, 10, 0, 1, 1, 0) # image = light.shade(numpy_array, plt.cm.hot, colors.PowerNorm(0.3), "hsv", 0, 0, 1.5) # plt.imshow(image) # plt.axis("off") # plt.savefig("multibrot.mojo.png") # plt.show() def main(): _ = compute_multibrot() # multibrot = compute_multibrot() # show_plot(multibrot) --- multibrot.py.txt --- WIDTH = 960 HEIGHT = 960 MAX_ITERS = 200 MIN_X = -2.0 MAX_X = 0.6 MIN_Y = -1.5 MAX_Y = 1.5 def mandelbrot_kernel(c): z = c for i in range(MAX_ITERS): z = z * z + c # Change this for different Multibrot sets (e.g., 2 for Mandelbrot) if z.real * z.real + z.imag * z.imag > 4: return i return MAX_ITERS def compute_mandelbrot(): t = [[0 for _ in range(WIDTH)] for _ in range(HEIGHT)] # Pixel matrix dx = (MAX_X - MIN_X) / WIDTH dy = (MAX_Y - MIN_Y) / HEIGHT for row in range(HEIGHT): for col in range(WIDTH): t[row][col] = mandelbrot_kernel(complex(MIN_X + col * dx, MIN_Y + row * dy)) return t compute_mandelbrot() # def show_plot(tensor): # import matplotlib.pyplot as plt # from matplotlib import colors # import numpy as np # WIDTH = 960 # HEIGHT = 960 # MAX_ITERS = 200 # SCALE = 10 # DPI = 64 # numpy_array = np.zeros((HEIGHT, WIDTH), np.float64) # for row in range(HEIGHT): # for col in range(WIDTH): # numpy_array.itemset((col, row), tensor[col][row]) # fig = plt.figure(1, [SCALE, SCALE * HEIGHT // WIDTH], DPI) # ax = fig.add_axes((0.0, 0.0, 1.0, 1.0)) # light = colors.LightSource(315, 10, 0, 1, 1, 0) # image = light.shade(numpy_array, plt.cm.hot, colors.PowerNorm(0.3), "hsv", 0, 0, 1.5) # plt.imshow(image) # plt.axis("off") # plt.savefig("multibrot.py.png") # plt.show() # mandelbrot = compute_mandelbrot() # show_plot(mandelbrot) --- multibrot_exaloop.py.txt --- """ python3 multibrot_exaloop.py """ WIDTH = 960 HEIGHT = 960 MAX_ITERS = 200 MIN_X = -2.0 MAX_X = 0.6 MIN_Y = -1.5 MAX_Y = 1.5 def scale(j, a, b): return a + (j / HEIGHT) * (b - a) def compute_mandelbrot(): t = [0 for _ in range(HEIGHT * WIDTH)] for i in range(HEIGHT): for j in range(WIDTH): c = complex(scale(j, MIN_X, MAX_X), scale(i, MIN_Y, MAX_Y)) z = 0j iteration = 0 while abs(z) <= 2 and iteration < MAX_ITERS: z = z * z + c # Change this for different Multibrot sets (e.g., 2 for Mandelbrot) iteration += 1 t[i * HEIGHT + j] = int(255 * iteration / MAX_ITERS) return t def show_plot(vector): import matplotlib.pyplot as plt from matplotlib import colors import numpy as np WIDTH = 960 HEIGHT = 960 MAX_ITERS = 200 SCALE = 10 DPI = 64 tensor = np.reshape(vector, (HEIGHT, WIDTH)) numpy_array = np.zeros((HEIGHT, WIDTH), np.float64) for row in range(HEIGHT): for col in range(WIDTH): numpy_array.itemset((col, row), tensor[col][row]) fig = plt.figure(1, [SCALE, SCALE * HEIGHT // WIDTH], DPI) ax = fig.add_axes((0.0, 0.0, 1.0, 1.0)) light = colors.LightSource(315, 10, 0, 1, 1, 0) image = light.shade(numpy_array, plt.cm.hot, colors.PowerNorm(0.3), "hsv", 0, 0, 1.5) plt.imshow(image) plt.axis("off") plt.savefig("multibrot_exaloop.py.png") plt.show() mandelbrot = compute_mandelbrot() show_plot(mandelbrot) --- multibrot_mojo_parallelize.mojo.txt --- from complex import ComplexSIMD from math import iota from algorithm import parallelize, vectorize from tensor import Tensor from utils.index import Index alias float_type = DType.float64 alias simd_width = 2 * simdwidthof[float_type]() alias width = 960 alias height = 960 alias MAX_ITERS = 200 alias min_x = -2.0 alias max_x = 0.6 alias min_y = -1.5 alias max_y = 1.5 fn mandelbrot_kernel_SIMD[ simd_width: Int ](c: ComplexSIMD[float_type, simd_width]) -> SIMD[float_type, simd_width]: """A vectorized implementation of the inner mandelbrot computation.""" let cx = c.re let cy = c.im var x = SIMD[float_type, simd_width](0) var y = SIMD[float_type, simd_width](0) var y2 = SIMD[float_type, simd_width](0) var iters = SIMD[float_type, simd_width](0) var t: SIMD[DType.bool, simd_width] = True for i in range(MAX_ITERS): if not t.reduce_or(): break y2 = y * y y = x.fma(y + y, cy) t = x.fma(x, y2) <= 4 x = x.fma(x, cx - y2) iters = t.select(iters + 1, iters) return iters fn compute_multibrot_parallelized() -> Tensor[float_type]: let t = Tensor[float_type](height, width) @parameter fn worker(row: Int): let scale_x = (max_x - min_x) / width let scale_y = (max_y - min_y) / height @parameter fn compute_vector[simd_width: Int](col: Int): """Each time we operate on a `simd_width` vector of pixels.""" let cx = min_x + (col + iota[float_type, simd_width]()) * scale_x let cy = min_y + row * scale_y let c = ComplexSIMD[float_type, simd_width](cx, cy) t.data().simd_store[simd_width]( row * width + col, mandelbrot_kernel_SIMD[simd_width](c) ) # Vectorize the call to compute_vector where call gets a chunk of pixels. vectorize[simd_width, compute_vector](width) # Parallelized parallelize[worker](height, height) return t def main(): _ = compute_multibrot_parallelized() # let multibrot = compute_multibrot_parallelized() # try: # _ = show_plot(multibrot) # except e: # print("failed to show plot:", e) # def show_plot(tensor: Tensor[float_type]): # alias scale = 10 # alias dpi = 64 # from python import Python # np = Python.import_module("numpy") # plt = Python.import_module("matplotlib.pyplot") # colors = Python.import_module("matplotlib.colors") # numpy_array = np.zeros((height, width), np.float64) # for row in range(height): # for col in range(width): # numpy_array.itemset((col, row), tensor[col, row]) # fig = plt.figure(1, [scale, scale * height // width], dpi) # ax = fig.add_axes((0.0, 0.0, 1.0, 1.0)) # light = colors.LightSource(315, 10, 0, 1, 1, 0) # image = light.shade(numpy_array, plt.cm.hot, colors.PowerNorm(0.3), "hsv", 0, 0, 1.5) # plt.imshow(image) # plt.axis("off") # plt.savefig("multibrot_mojo_ parallelize.mojo.png") # plt.show() --- lang.csv.txt --- title appeared type rank Java 1995 pl 0 JavaScript 1995 pl 1 C 1972 pl 2 Python 1991 pl 3 SQL 1974 queryLanguage 4 C++ 1985 pl 5 Linux 1991 os 6 HTML 1991 textMarkup 7 XML 1996 dataNotation 8 PHP 1995 pl 9 Perl 1987 pl 10 MATLAB 1984 pl 11 Ruby 1995 pl 12 C# 2000 pl 13 Android 2008 os 14 MySQL 1995 queryLanguage 15 Fortran 1957 pl 16 CSS 1996 stylesheetLanguage 17 R 1993 pl 18 Go 2009 pl 19 JSON 2001 dataNotation 20 iOS 2007 os 21 Swift 2014 pl 22 Scala 2004 pl 23 Ada 1980 pl 24 COBOL 1959 pl 25 Rust 2010 pl 26 PostgreSQL 1986 queryLanguage 27 Kotlin 2011 pl 28 PowerShell 2006 pl 29 Arduino Programming Language 2005 pl 30 Pascal 1970 pl 31 Haskell 1990 pl 32 TypeScript 2012 pl 33 SAS 1976 pl 34 ARM 1985 assembly 35 Lisp 1958 pl 36 Lua 1993 pl 37 Node.js 2009 pl 38 Julia 2012 pl 39 Prolog 1972 pl 40 Clojure 2007 pl 41 HTTP 1989 protocol 42 Objective-C 1984 pl 43 Assembly language 1960 assembly 44 Scheme 1970 pl 45 Mathematica 1988 pl 46 Erlang 1986 pl 47 Bash 1989 pl 48 JQuery 2006 library 49 ISBN 1970 schema 50 Elixir 2011 pl 51 CUDA 2007 pl 52 Dart 2011 pl 53 Emacs 1976 editor 54 Modula-2 1978 pl 55 MongoDB 2009 application 56 Visual Basic 1991 pl 57 Tcl 1988 pl 58 ActionScript 1998 pl 59 VBA 1993 pl 60 WordPress 2003 application 61 Vim 1991 editor 62 Ruby on Rails 2005 framework 63 BASIC 1964 pl 64 Verilog 1984 hardwareDescriptionLanguage 65 Solidity 2014 contractLanguage 66 awk 1977 pl 67 Delphi 1995 pl 68 ASCII 1963 characterEncoding 69 F# 2005 pl 70 AWS 2006 cloud 71 Regular Expressions 1951 queryLanguage 72 Elm 2012 pl 73 Eiffel 1986 pl 74 ASP 1996 template 75 Crystal 2014 pl 76 OCaml 1996 pl 77 Smalltalk 1972 pl 78 Git 2005 application 79 Modula-3 1986 pl 80 Yacc 1975 grammarLanguage 81 Racket 1994 pl 82 D 2001 pl 83 Unix 1969 os 84 Sage 2005 pl 85 Reason 2016 pl 86 Groovy 2003 pl 87 UML 1996 xmlFormat 88 Maple 1982 pl 89 Common Lisp 1984 pl 90 Unicode 1987 characterEncoding 91 CoffeeScript 2009 pl 92 VHDL 1983 hardwareDescriptionLanguage 93 APL 1964 pl 94 OpenCL 2009 pl 95 YAML 2001 dataNotation 96 Microsoft Azure 2010 cloud 97 UTF-8 1993 characterEncoding 98 DOI 2000 schema 99 MediaWiki 2002 wikiMarkup 100 REST 1996 protocol 101 Microsoft Excel 1987 application 102 XQuery 2007 pl 103 PostScript 1982 textMarkup 104 Nginx 2004 configFormat 105 GraphQL 2012 queryLanguage 106 SPSS 1968 pl 107 PowerPC 1992 isa 108 Eclipse 2001 editor 109 TLS 1999 protocol 110 FTP 1971 protocol 111 Visual Studio 1997 editor 112 WebAssembly 2015 bytecode 113 SOAP 1998 xmlFormat 114 Literate CoffeeScript 2013 pl 115 Vue 2014 framework 116 Matplotlib 2003 library 117 Rexx 1979 pl 118 ANTLR 1992 grammarLanguage 119 Nim 2008 pl 120 Pug 2010 template 121 X86 1978 isa 122 Liquid 2008 template 123 TCP 1974 protocol 124 SciPy 2001 library 125 Smali 2010 assembly 126 Scratch 2002 visual 127 Markdown 2004 textMarkup 128 LFE 2008 pl 129 LaTeX 1985 textMarkup 130 Haxe 2005 pl 131 Forth 1970 pl 132 Visual Basic .NET 2001 pl 133 SMTP 1982 protocol 134 PureBasic 1998 pl 135 ML 1973 pl 136 Solaris 1992 os 137 Chapel 2004 pl 138 fish 2005 pl 139 VBScript 1996 pl 140 PDF 1993 binaryDataFormat 141 LabVIEW G 1986 pl 142 Oberon 1986 pl 143 CIL 2000 pl 144 Applescript 1993 pl 145 Lasso 1995 pl 146 LLVM IR 2003 ir 147 Oz 1991 pl 148 Red 2011 pl 149 ECMAScript 1997 pl 150 Idris 2014 pl 151 Simula 1965 pl 152 V 2019 pl 153 Protocol Buffers 2008 idl 154 SQLite 2000 queryLanguage 155 UDP 1980 protocol 156 Tex 1978 pl 157 Logo 1967 pl 158 AMPL 1985 pl 159 OpenGL 1992 library 160 sed 1974 pl 161 PicoLisp 1988 pl 162 FreeBSD 1993 os 163 Standard ML 1990 pl 164 Visual Studio Code 2015 editor 165 Drupal 2000 application 166 JVM 1994 vm 167 BCPL 1966 pl 168 Apache Maven 2004 application 169 Dylan 1992 pl 170 PL/SQL 1991 pl 171 Unity 2005 library 172 PureScript 2013 pl 173 REBOL 1997 pl 174 FLUX 2014 pl 175 Processing 2001 pl 176 MIPS architecture 1985 isa 177 Hack 2014 pl 178 URL 1994 schema 179 Org 2003 textMarkup 180 OWL 2004 xmlFormat 181 SVG 2001 textMarkup 182 Monaco Editor 2016 editor 183 Brainfuck 1993 esolang 184 Algol 1958 pl 185 FAT 1977 filesystem 186 DOT 2007 textMarkup 187 Squirrel 2003 pl 188 Coq 1989 pl 189 Fantom 2005 pl 190 FLEX 1987 grammarLanguage 191 Monkey 2011 pl 192 Jinja 2006 template 193 AUTOCAD 1982 application 194 BlitzBasic 2000 pl 195 ABAP 1983 pl 196 Limbo 1995 pl 197 EuLisp 1985 pl 198 Agda 2007 pl 199 HAML 2006 template 200 RDF 1997 dataNotation 201 GAME 1977 pl 202 MUMPS 1966 pl 203 x86 Assembly 1972 assembly 204 ColdFusion 1995 pl 205 Occam 1983 pl 206 J 1990 pl 207 Emacs Lisp 1985 pl 208 AutoIt 1999 pl 209 Qt 1995 framework 210 Zig 2015 pl 211 NewLisp 1991 pl 212 Nearley 2014 grammarLanguage 213 Jison 2009 pl 214 Makefile 1976 pl 215 Vala 2006 pl 216 MIME 1991 textDataFormat 217 MoonScript 2011 pl 218 Nemerle 2003 pl 219 XAML 2008 xmlFormat 220 TOML 2013 dataNotation 221 Ballerina 2015 pl 222 Flow 2014 pl 223 Terra 2012 pl 224 Icon 1977 pl 225 Scilab 1990 pl 226 X10 2004 pl 227 Scikit-learn 2007 library 228 Frege 2011 pl 229 Slim 2010 template 230 Turing 1982 pl 231 PostCSS 2013 textMarkup 232 idyll 2017 pl 233 MicroPython 2014 pl 234 Reverse Polish notation 1953 notation 235 Io 2002 pl 236 QML 2009 pl 237 Mercury 1995 pl 238 RPG 1959 pl 239 xBase 1986 pl 240 JSP 1999 template 241 Opa 2011 pl 242 IDL 1977 pl 243 Hy 2013 pl 244 Boo 2003 pl 245 TensorFlow 2015 library 246 GNU Octave 1988 pl 247 Ceylon 2011 pl 248 Zephir 2013 pl 249 highlight.js 2006 library 250 Redis 2009 application 251 SPARQL 2008 queryLanguage 252 Object Pascal 1986 pl 253 LOLCODE 2007 esolang 254 SPARC 1987 isa 255 Lean 2015 pl 256 SystemVerilog 2002 pl 257 Arc 2001 pl 258 Clean 1987 pl 259 RobotFramework 2013 pl 260 SuperCollider 1996 pl 261 RFC 1969 notation 262 ALGOL 60 1960 pl 263 Pony 2012 pl 264 QBasic 1991 pl 265 Factor 2003 pl 266 Cython 2007 pl 267 Bison 1985 grammarLanguage 268 XPath 1999 queryLanguage 269 WebGL 2011 library 270 CLIPS 1985 pl 271 Inform 1993 pl 272 KiCad Legacy Layout 1992 application 273 SNOBOL 1962 pl 274 vi 1976 editor 275 reStructuredText 2002 textMarkup 276 JSON5 2012 dataNotation 277 Nextflow 2013 pl 278 PL/pgSQL 1998 pl 279 CMake 2000 application 280 Sass 2006 stylesheetLanguage 281 Stata 1985 pl 282 Sublime Text 2008 editor 283 Multi-User Forth 1995 pl 284 SI 1960 notation 285 grep 1974 pl 286 EDN 2012 dataNotation 287 API Blueprint 2013 pl 288 NetLogo 1999 pl 289 Metal 2014 library 290 Self 1987 pl 291 NumPy 1995 library 292 Pike 1994 pl 293 RAML 2013 yamlFormat 294 Gzip 1992 binaryDataFormat 295 HCL 2014 dataNotation 296 Isabelle 1986 pl 297 Magit 2013 application 298 WSDL 2000 xmlFormat 299 Deno 2018 compiler 300 Click 1999 pl 301 Extensible Linking Format 1999 binaryExecutable 302 New Technology File System 1993 filesystem 303 MiniD 2006 pl 304 Ace Editor 2010 editor 305 D3.js 2011 library 306 PL/I 1964 pl 307 ClojureScript 2011 pl 308 S-algol 1979 pl 309 OpenRC runscript 2007 application 310 ATS 2013 pl 311 IA-32 1985 isa 312 F* 2014 pl 313 AutoLISP 1986 pl 314 YANG 2014 application 315 Perl 6 2015 pl 316 Turtle 2011 dataNotation 317 Subversion 2000 application 318 Csound 1985 pl 319 npm 2010 packageManager 320 Morse code 1837 notation 321 Ioke 2008 pl 322 Lex 1975 grammarLanguage 323 odin 2016 pl 324 Wren 2013 pl 325 AGC 1966 assembly 326 YARA 2008 pl 327 FlatBuffers 2014 idl 328 Ini 1987 dataNotation 329 FoxPRO 1992 pl 330 Embedded Crystal 2016 template 331 Gnuplot 1986 pl 332 Xojo 1996 pl 333 INTERCAL 1972 esolang 334 Java Bytecode 1995 bytecode 335 CodeMirror 2007 editor 336 S-expressions 1960 dataNotation 337 Alloy 1997 pl 338 AXIOM 1992 pl 339 POV-Ray SDL 1991 pl 340 E 1997 pl 341 RDoc 2004 textMarkup 342 LiveScript 2011 pl 343 Marko 2014 textMarkup 344 Modelica 1997 pl 345 Office Open XML 2006 xmlFormat 346 Wavefront Object 1988 application 347 Microsoft BASIC 1975 pl 348 CSP 1978 pl 349 Django 2005 library 350 ERB 2004 template 351 MariaDB 2009 queryLanguage 352 Gradle 2008 application 353 Dafny 2009 pl 354 Whitespace 2003 esolang 355 GAMS 1963 pl 356 Batchfile 1985 pl 357 DNS 1985 protocol 358 SYMBOL 1971 pl 359 Clipper 1985 pl 360 BPMN 2004 visual 361 Dhall 2017 dataNotation 362 AsciiDoc 2002 textMarkup 363 JSON-LD 2010 dataValidationLanguage 364 Objective-J 2008 pl 365 Datalog 1977 pl 366 Pod 1997 textMarkup 367 C-- 1997 pl 368 M4 1977 pl 369 PEG.js 2010 grammarLanguage 370 chevrotain 2015 library 371 Ninja 2012 template 372 Halide 2010 pl 373 Base64 1987 textEncodingFormat 374 B 1969 pl 375 SaltStack 2011 pl 376 Bicep 2020 jsonFormat 377 Google Cloud Platform 2011 cloud 378 Microsoft Notepad 1983 editor 379 Wolfram Language 1988 pl 380 Q 2003 pl 381 TLA 1999 pl 382 Puppet 2005 pl 383 GDB 1986 application 384 Gambas 1999 pl 385 Seed7 2005 pl 386 Speedie 2022 pl 387 Oxygene 2002 pl 388 C3 2019 pl 389 Bourne shell 1977 pl 390 Befunge 1993 esolang 391 x86-64 2000 isa 392 Coconut 2014 pl 393 Twig 2009 template 394 PowerBuilder 2010 pl 395 HyperTalk 1987 pl 396 Visual FoxPro 1995 pl 397 Less 2009 stylesheetLanguage 398 BibTeX 1985 application 399 SGML 1986 textMarkup 400 Miranda 1985 pl 401 JSON Schema 2010 dataValidationLanguage 402 eC 2004 pl 403 XS 2002 pl 404 G-code 1950 pl 405 Simulink 1984 pl 406 NATO phonetic alphabet 1956 notation 407 ECL 2000 pl 408 Oberon-2 1991 pl 409 Turbo Pascal 1983 compiler 410 AutoHotkey 2003 pl 411 Homebrew 2009 packageManager 412 Classroom Object Oriented Language 1996 pl 413 GW-BASIC 1983 pl 414 Thrift 2007 idl 415 PL/0 1976 pl 416 Genie 2008 pl 417 QuickBASIC 1985 pl 418 Scala.js 2013 pl 419 LINQ 2007 queryLanguage 420 SETL 1969 pl 421 Maxima 1982 pl 422 EJS 2010 template 423 XBase++ 1997 pl 424 Cap'n Proto 2013 idl 425 v8 2008 vm 426 Netwide Assembler 1996 assembly 427 YASnippet 2008 textMarkup 428 wisp 2012 pl 429 Pandas 2008 library 430 Falcon 2003 pl 431 Transact-SQL 1984 queryLanguage 432 HHVM 2011 vm 433 Markwhen 2022 textMarkup 434 COMTRAN 1957 pl 435 PRQL 2022 queryLanguage 436 ink 2015 esolang 437 Dc 1978 pl 438 ASN.1 1984 idl 439 Z notation 1974 notation 440 Ext4 2008 filesystem 441 ALGOL 68 1968 pl 442 CLU 1975 pl 443 Mercurial 2005 application 444 DIAGRAM 1980 pl 445 LiveCode 2001 pl 446 RMarkdown 2014 textMarkup 447 Squeak 1996 pl 448 RStudio 2011 editor 449 unison 2015 pl 450 Croc 2006 pl 451 HyperCard 1987 pl 452 Natural Language Toolkit 2001 library 453 Bluespec 2000 pl 454 tornado 2009 template 455 KaTeX 2013 textMarkup 456 jq 2012 queryLanguage 457 ABC 1980 pl 458 S 1976 pl 459 DBase 1979 application 460 GAP 1986 pl 461 UrWeb 2008 pl 462 K 1993 pl 463 starlark 2018 pl 464 WxBasic 2002 pl 465 Ion 2016 idl 466 Latte 2008 template 467 Stylus 2010 stylesheetLanguage 468 MMX instruction set 1997 isa 469 Vim script 1991 pl 470 mermaid 2014 textMarkup 471 Pygments 2006 library 472 JScript 1996 pl 473 chrysaLisp 2015 pl 474 Jython 2001 pl 475 True BASIC 1983 pl 476 Wolfram Mathematica 1988 editor 477 Sather 1990 pl 478 CouchDB 2005 application 479 React Native 2015 library 480 TXL 1985 pl 481 Numba 2012 compiler 482 FASTQ 2000 textDataFormat 483 EML 1974 textDataFormat 484 Pig Latin 2008 queryLanguage 485 Smarty 2006 template 486 Graph Modeling Language 1997 application 487 Punched tape 1943 notation 488 Parrot 2002 vm 489 mlir 2019 ir 490 Malbolge 1998 esolang 491 FreeBASIC 2004 pl 492 DTD 1996 grammarLanguage 493 Multics 1967 pl 494 Ragel 2007 pl 495 JFlex 2003 grammarLanguage 496 Eve 2016 pl 497 CIL 1994 pl 498 Xtend 2011 pl 499 IBM System z 2000 computingMachine 500 Cue 2018 dataNotation 501 Nu 2007 pl 502 DTrace 2005 pl 503 Tiny BASIC 1975 pl 504 AspectJ 2001 pl 505 TRS-80 Color Computer 1980 computingMachine 506 Max 1990 jsonFormat 507 Fennel 2016 pl 508 ALGOL W 1966 pl 509 RDFa 2004 xmlFormat 510 HLSL 2002 pl 511 janet 2018 pl 512 Ring 2016 pl 513 PARI/GP 1985 pl 514 Pure Data 1996 pl 515 Golo 2012 pl 516 Free Pascal 1997 pl 517 XSLT 1998 xmlFormat 518 NL 1993 application 519 Unicon 2008 pl 520 Imba 2014 pl 521 Caml 1985 pl 522 Fortress 2004 pl 523 Diff 1974 unixApplication 524 beef-lang 2019 pl 525 commonmark 2014 textMarkup 526 Slash 2012 pl 527 muPad 1997 pl 528 Atmel AVR 1996 pl 529 HOPE 1978 pl 530 Enso 2015 pl 531 High Level Assembly 2011 assembly 532 Luna 2015 pl 533 Koka 2012 pl 534 Dogescript 2013 pl 535 gravity 2017 pl 536 Gosu 2002 pl 537 OpenVera 2001 pl 538 Gerber Image 1980 application 539 MusicXML 2004 pl 540 TreeSheets 2019 visual 541 Textile 2002 textMarkup 542 SIL 2012 ir 543 Taichi 2019 pl 544 Ladder Logic 1994 pl 545 NSIS 2001 pl 546 WDL 2012 pl 547 RPL 1984 pl 548 AutoCAD DXF 1982 application 549 MDX 2017 textMarkup 550 Closure Templates 2009 template 551 Ron 2015 dataNotation 552 Hierarchical Data Format 1992 binaryDataFormat 553 MPS 2010 grammarLanguage 554 AssemblyScript 2017 pl 555 FASTA 2004 textDataFormat 556 datascript 2014 queryLanguage 557 Inno Setup 1997 pl 558 Objective C++ 1993 pl 559 GLSL 1992 pl 560 Curry 1990 pl 561 Expect 1990 pl 562 BETA 1983 pl 563 Action! 1983 pl 564 PEG 2002 grammarLanguage 565 carp 2016 pl 566 Korn shell 1983 pl 567 CWL 2014 pl 568 SWI Prolog 1987 pl 569 JCL 1964 pl 570 RATFOR 1976 pl 571 Altair BASIC 1975 pl 572 RISC-V 2010 isa 573 Hjson 2014 dataNotation 574 PL/M 1973 pl 575 Cg 2003 pl 576 LilyPond 1996 pl 577 Xtext 2006 grammarLanguage 578 SourcePawn 2014 pl 579 Augmented Backus-Naur Form 2008 grammarLanguage 580 Eagle 1988 application 581 PhyloXML 2009 xmlFormat 582 Reia 2008 pl 583 Zip file format 1989 binaryDataFormat 584 UNLAMBDA 1999 esolang 585 Emojicode 2016 pl 586 IGOR Pro 1993 pl 587 Java EE version history 1998 pl 588 QB64 2007 pl 589 Commodore BASIC 1977 pl 590 Euphoria 1993 pl 591 Blitz3D 2001 pl 592 .dwg 1982 binaryDataFormat 593 Java Properties 1995 dataNotation 594 Ren'Py 2004 pl 595 Dynamo 2011 visual 596 CodeQL 2018 queryLanguage 597 BBCode 1998 textMarkup 598 ExFAT 2006 filesystem 599 CWEB 1987 textMarkup 600 GAMS 1988 pl 601 EBNF 1977 grammarLanguage 602 Argdown 2014 textMarkup 603 Apache Spark 2012 application 604 PIR 2006 pl 605 GeoJSON 2008 jsonFormat 606 Qualcomm Hexagon 2006 assembly 607 IMAP 1986 protocol 608 CSON 2011 dataNotation 609 kaitai 2016 idl 610 mustache 2009 template 611 Djot 2022 textMarkup 612 OpenLisp 1988 pl 613 LPC 1995 pl 614 Jule 2021 pl 615 Mirah 2009 pl 616 Aith 2020 pl 617 RUNOFF 1965 textMarkup 618 mgmt 2015 pl 619 DDML 1999 xmlFormat 620 Dockerfile 2013 pl 621 Rust MIR 2016 ir 622 Velato 2009 esolang 623 Microsoft Small Basic 2008 pl 624 Kubernetes 2014 application 625 RoboMind 2005 pl 626 Information Presentation Facility 1997 pl 627 Velocity 2003 template 628 mavo 2015 template 629 Futhark 2013 pl 630 Plain English 2018 pl 631 PIC microcontroller 1975 pl 632 DRAKON 1996 pl 633 Microsoft Macro Assembler 1981 assembly 634 flowchart.fun 2021 textMarkup 635 Manim 2015 framework 636 SubRip Text 2005 application 637 Keras 2015 library 638 LyX 1995 editor 639 PyTorch 2016 library 640 Ghostscript 1988 pl 641 beads-lang 2016 pl 642 Asm.js 2013 ir 643 Jekyll 2008 application 644 SQLPL 2009 pl 645 Pizza 2001 pl 646 NewtonScript 1993 pl 647 Svelte 2019 pl 648 Glyph Bitmap Distribution Format 1988 application 649 BlitzPlus 2003 pl 650 PROMETHEUS 2012 pl 651 CFML 1995 pl 652 KiXtart 1991 pl 653 Triton 2021 pl 654 Bel 2019 pl 655 Sqlalchemy 2006 queryLanguage 656 Microdata HTML 2013 schema 657 FFmpeg 2000 application 658 Jakt 2022 pl 659 Clarion 1986 pl 660 VRML 1994 pl 661 PAWN 2006 pl 662 gogs-editor 2014 editor 663 KML 2007 xmlFormat 664 Readable 2018 textMarkup 665 JADE 1996 pl 666 Pharo 2008 pl 667 X PixMap 1989 application 668 tldr 2013 application 669 Spin 2006 pl 670 ACT-III 1956 pl 671 LotusScript 1996 pl 672 Felix 2001 pl 673 ALGOL 58 1958 pl 674 X BitMap 1989 application 675 Yes It Is 2006 framework 676 CSS Doodle 2017 pl 677 Uno 2002 pl 678 Godot 2014 library 679 emberjs-framework 2011 framework 680 progsbase 2018 pl 681 JSON-stat 2011 jsonFormat 682 QR code 1994 barCodeFormat 683 XeTeX 2004 textMarkup 684 mochajs 2011 library 685 Vcpkg 2016 packageManager 686 Concise Encoding 2018 dataNotation 687 blockml 2014 textMarkup 688 Bazel 2015 application 689 JavaCC 1996 grammarLanguage 690 Ext3 2001 filesystem 691 BNF 1956 grammarLanguage 692 S3 1986 pl 693 Yoix 2000 pl 694 MBASIC 1983 pl 695 Troff 1973 textMarkup 696 chaiscript 2009 pl 697 Guile 1993 pl 698 Shapefile 1995 binaryDataFormat 699 Simple Binary Encoding 2013 pl 700 Slope 2021 pl 701 Papyrus 2015 pl 702 Varnish Configuration Language 2006 application 703 Rockstar 2018 esolang 704 Project Jupyter 2014 editor 705 ThinBasic 2004 pl 706 Roslyn compiler 2009 compiler 707 NetLinx 2007 pl 708 chatterbot 2014 library 709 JAI 2014 pl 710 Fuzzy Markup Language 2004 xmlFormat 711 USB 1996 standard 712 Nushell 2019 pl 713 fay 2012 pl 714 FIGlet Font 1991 application 715 Mathcad 1986 pl 716 P4 2014 pl 717 Nial 1981 pl 718 Tiny C Compiler 2001 compiler 719 FLOW-MATIC 1955 pl 720 Grammar 2017 grammarLanguage 721 micro-editor 2016 editor 722 CSV 1972 dataNotation 723 Advanced Message Queuing Protocol 2003 protocol 724 dgraph 2015 application 725 Secure Scuttlebutt 2014 protocol 726 XProc 1990 pl 727 Aldor 1990 pl 728 jasmine 2008 library 729 onnx 2017 binaryDataFormat 730 HDMI 2002 standard 731 TI MSP430 2009 isa 732 Apache Hbase 2008 application 733 Pick operating system 1970 os 734 SymPy 2007 library 735 QMake 2002 pl 736 UTC 1960 timeFormat 737 Rholang 2016 contractLanguage 738 JSFuck 2012 esolang 739 Scoop 2013 packageManager 740 PgBouncer 2007 application 741 LookML 2012 pl 742 CPL 1963 pl 743 Alice 2000 pl 744 Modula 1975 pl 745 ProvideX 1992 pl 746 Mindsdb 2018 application 747 Cobra 2006 pl 748 cloc 2006 application 749 Volt 2011 pl 750 JMP 1989 application 751 Angelscript 2003 pl 752 Dojo 2005 pl 753 Iterm2 1996 application 754 Apex 2007 pl 755 ARexx 1987 pl 756 CLOS 1988 pl 757 Visual Prolog 1996 pl 758 Asymptote 2004 application 759 NCAR Command Language 1994 pl 760 GIF 1987 binaryDataFormat 761 MQL5 2005 pl 762 mal 2014 interpreter 763 CoNLL-U 2014 application 764 DisplayPort 2006 standard 765 wasmer 2018 vm 766 DM 1994 pl 767 Prism 2012 library 768 capybara 2009 library 769 Semantic Versioning 2011 schema 770 Ant Build System 2000 application 771 Linden Scripting Language 2003 pl 772 J# 2002 pl 773 Cyclone 2001 pl 774 Lisaac 2003 pl 775 Karel 1981 pl 776 JSONiq 2011 queryLanguage 777 gridstudio-editor 2018 editor 778 DIGITAL Command Language 1997 pl 779 Z shell 1990 pl 780 F Prime 2017 library 781 Tea 1997 pl 782 Filebench WML 2011 pl 783 GDScript 2008 pl 784 Roc 2020 pl 785 Cryptol 2014 pl 786 pyret 2011 pl 787 Curl 1998 pl 788 Tree Notation 2017 dataNotation 789 GML 1969 xmlFormat 790 Eclipse Command Language 2008 pl 791 Logica 2020 queryLanguage 792 Kakoune 2011 editor 793 XL 2000 pl 794 GOLD 2012 grammarLanguage 795 Up-arrow notation 1976 notation 796 BPEL 2001 xmlFormat 797 GNU Assembler 1986 compiler 798 ShaderLab 2000 pl 799 dat-protocol 2013 protocol 800 Carbon 2020 pl 801 TSV 1993 dataNotation 802 PIC 1988 textMarkup 803 docopt 2012 pl 804 Mu 2014 pl 805 xsv-app 2014 application 806 Vimwiki 2008 wikiMarkup 807 Cloud Firestore Security Rules 2017 application 808 sizzle 2008 queryLanguage 809 RetDec 2017 decompiler 810 Desmos 2011 pl 811 Nix 2003 packageManager 812 PCRE 1997 queryLanguage 813 MD5 1991 hashFunction 814 Ext2 1993 filesystem 815 Not Quite C 2017 pl 816 BeanShell 1999 pl 817 FutureBASIC 1992 pl 818 StarOffice Basic 2000 pl 819 4G 2013 standard 820 Joy 2001 pl 821 edgedb 2017 database 822 COLLADA 2004 application 823 bosque 2019 pl 824 Creole 2007 textMarkup 825 noms-db 2015 database 826 SHA-2 2001 hashFunction 827 gleam 2016 pl 828 Conan 2015 packageManager 829 DNS Zone 2001 application 830 htmx 2020 template 831 Meson 2013 pl 832 binaryen 2015 compiler 833 Omgrofl 2006 esolang 834 SHA-1 1993 hashFunction 835 Pop-11 1999 pl 836 Automatically Programmed Tool 1956 pl 837 Mask 2012 template 838 Harbour 1999 pl 839 carth 2018 pl 840 Digital Visual Interface 1999 standard 841 BBC BASIC 1981 pl 842 SQL-92 1992 pl 843 Network Time Protocol 1981 protocol 844 TextMate 2004 editor 845 Lightweight Directory Access Protocol 1997 protocol 846 COMPONENT PASCAL 1997 pl 847 zephyr-asdl 1997 grammarLanguage 848 Gettext Catalog 1990 textMarkup 849 METAFONT 1977 application 850 Bucklescript 2010 pl 851 Telnet 1969 protocol 852 chibicc 2019 compiler 853 YoptaScript 2016 pl 854 mckeeman-form 2020 grammarLanguage 855 Neko 2005 pl 856 IcedCoffeeScript 2009 pl 857 Elvish 2013 pl 858 BMP file format 2000 binaryDataFormat 859 Easybuild 2014 application 860 CartoCSS 2010 pl 861 JOVIAL 1960 pl 862 SysML 2000 pl 863 ooc 2009 pl 864 Rascal 2013 grammarLanguage 865 Spyder 2009 editor 866 Thymeleaf 2011 template 867 Tagged Image File Format 1986 binaryDataFormat 868 Lily 2011 pl 869 Refal 1968 pl 870 Yorick 1996 pl 871 Zuo 2022 pl 872 UCL 2013 dataNotation 873 BlitzMax 2014 pl 874 SAM file format 2009 textDataFormat 875 SCSS 2006 stylesheetLanguage 876 contracts.coffee 2011 pl 877 ICD-10-CM diagnosis 1983 schema 878 Ante 2015 pl 879 Jasmin 1997 pl 880 RenderScript 2011 pl 881 Literate Agda 2009 pl 882 walt 2017 pl 883 Turbo Basic 1987 pl 884 penrose 2016 pl 885 OPL 1984 pl 886 Ravenscar profile 1997 pl 887 TELCOMP 1966 pl 888 Praat Script 1997 pl 889 ToffeeScript 2013 pl 890 BlackCoffee 2014 pl 891 Nit 2008 pl 892 Dartmouth BASIC 1964 pl 893 heap.coffee 2012 pl 894 MarkovJunior 2022 pl 895 EmberScript 2012 pl 896 UPC 2003 pl 897 PowerBASIC 1989 pl 898 Game Maker Language 1999 pl 899 Caffeine 2012 pl 900 tbox-lib 2010 library 901 LuaJIT 2005 compiler 902 vyper 2016 pl 903 skip 2018 pl 904 Context Diff 1981 diffFormat 905 skulpt 2009 pl 906 OpenSCAD 2010 pl 907 hasklig 2012 font 908 clay 2010 pl 909 codecept 2015 library 910 Speakeasy 2006 pl 911 WML 2006 template 912 AsciiDots 2017 esolang 913 Message Queuing Telemetry Transport 1999 protocol 914 Google File System 2003 filesystem 915 Edje Data Collection 2010 jsonFormat 916 TiddlyWiki 2004 wikiMarkup 917 Power BI 2011 application 918 Tableau Software 2003 application 919 CLIST 1990 pl 920 Euclidean geometry -300 notation 921 UNITY 1988 pl 922 Slice 2011 pl 923 HFS Plus 1998 filesystem 924 Streem 2014 pl 925 Blender 1998 application 926 m3db 2016 database 927 Hyperscript 2012 template 928 Security Assertion Markup Language 2001 xmlFormat 929 SimCode 1997 pl 930 omega 2005 pl 931 Beatnik 2001 esolang 932 Sweet.js 2012 pl 933 Impala 2012 queryLanguage 934 HTTP/2 2015 protocol 935 ArkScript 2019 pl 936 BLISS 1969 pl 937 ROFF 1971 textMarkup 938 OX 1996 pl 939 Alpine Abuild 2006 pl 940 JRuby 2001 pl 941 Motif 1989 pl 942 SmallBASIC 2001 pl 943 ohm 2014 grammarLanguage 944 xCard 2011 xmlFormat 945 SMIL 1997 pl 946 SugarSS 2016 textMarkup 947 Binary notation 1689 notation 948 Stripe company 2011 webApi 949 TI-BASIC 1970 pl 950 ISLISP 2007 pl 951 FM broadcasting 1950 standard 952 Whiley 2009 pl 953 Atari BASIC 1983 pl 954 UCSD Pascal 1978 pl 955 Applesoft BASIC 1979 pl 956 zz 2019 pl 957 GCC Machine Description 2001 pl 958 Jupyter Notebook 2014 jsonFormat 959 ActiveVFP 2001 pl 960 ALEF 1992 pl 961 netbeans-editor 2013 editor 962 Shen 2011 pl 963 oil 2016 pl 964 Please Build 2016 pl 965 mun-lang 2019 pl 966 Melody 2022 pl 967 Mojo 2022 pl 968 chef 2002 esolang 969 GraphIt 2017 pl 970 SHA-3 2015 hashFunction 971 MATHLAB 1964 pl 972 groff 1990 textMarkup 973 ROOT 1994 library 974 Cesil 1974 pl 975 chisel 2015 hardwareDescriptionLanguage 976 Fancy 2010 pl 977 Geography Markup Language 2000 xmlFormat 978 Qalb 2012 pl 979 verona 2019 pl 980 Cell 2017 pl 981 Hackett 2017 pl 982 Stan 2012 pl 983 Stencil 2018 template 984 lmdb 2011 library 985 PogoScript 2011 pl 986 Brightscript 2010 pl 987 winxed 2009 pl 988 Megaparsec 2015 library 989 Tap code 1941 notation 990 ColaScript 2012 pl 991 Laravel 2011 framework 992 xlwings-editor 2013 library 993 Strips 1969 pl 994 MVEL 2003 pl 995 IP Pascal 1990 pl 996 Perl Data Language 1996 pl 997 kitten 2012 pl 998 Mech 2018 pl 999 DOML 2017 dataNotation 1000 Large-scale Atomic/Molecular Massively Parallel Simulator Format 1995 application 1001 LOGLAN 1982 pl 1002 DokuWiki 2004 wikiMarkup 1003 svgbob 2016 textMarkup 1004 SRL 2016 queryLanguage 1005 rant 2014 pl 1006 manhood 2014 pl 1007 Cycript 2008 pl 1008 Raku 2019 pl 1009 Vigil 2013 esolang 1010 Pure 2008 pl 1011 Formulating On-Line Calculations in Algebraic Language 1968 pl 1012 Real-time Transport Protocol 1996 protocol 1013 Ch 2003 pl 1014 Hindu-Arabic numeral system 825 numeralSystem 1015 checked-c 2015 pl 1016 Committee on Uniform Security Identification Procedures 1968 schema 1017 SMT 2003 pl 1018 Caché Basic 1997 queryLanguage 1019 A-0 system 1951 compiler 1020 storyscript 2017 pl 1021 Aardvark 2020 pl 1022 VML 1998 xmlFormat 1023 Cranelift 2016 ir 1024 Ezhil 2007 pl 1025 Snowman 2015 decompiler 1026 FreeMarker 2000 template 1027 Pan 2011 pl 1028 Pep8 2009 assembly 1029 Logtalk 1998 pl 1030 SRecode Template 2000 textMarkup 1031 TI Program 1970 assembly 1032 Fibonacci 1991 pl 1033 Observable 2017 pl 1034 packagist-pm 2011 packageManager 1035 WebIDL 2012 idl 1036 Sieve mail filtering language 2008 application 1037 Notepad++ 2003 editor 1038 Hyperscript 2020 pl 1039 gluon 2014 pl 1040 BQN 2020 pl 1041 Spatial 2018 pl 1042 Common Object File Format 1983 binaryExecutable 1043 Jargon 1987 pl 1044 json-graph-format 2014 jsonFormat 1045 Not eXactly C 2006 pl 1046 Mary 1970 pl 1047 DOODLE 1992 pl 1048 Apache Lucene 1999 queryLanguage 1049 Dak 2022 pl 1050 T 1980 pl 1051 Open Data Protcol 2007 protocol 1052 P 2013 pl 1053 JSON with Comments 2001 dataNotation 1054 Luna 2011 pl 1055 Property list 2012 textMarkup 1056 ActivityPub 2018 protocol 1057 Script.NET 2007 pl 1058 bog 2020 pl 1059 MAXScript 1996 pl 1060 invokator 2004 pl 1061 Umple 2008 pl 1062 Open Shading Language 2008 pl 1063 YAWL 2006 pl 1064 C2 2012 pl 1065 Creative Basic 2008 pl 1066 Pandoc 2006 application 1067 mathics 2012 pl 1068 LoomScript 2013 pl 1069 Shakespeare 2001 pl 1070 Basis Codec 2019 binaryDataFormat 1071 SQL/PSM 1996 pl 1072 Linotte 2005 pl 1073 Flutter 2017 framework 1074 Almquist shell 1989 pl 1075 JOSS 1966 pl 1076 Stutter 2018 esolang 1077 Compiler-Compiler 1963 pl 1078 Epigram 2004 pl 1079 Kodu Game Lab 2009 pl 1080 WebP 2010 binaryDataFormat 1081 TIScript 2007 pl 1082 ARC processor 1995 isa 1083 XHTML 2000 dataNotation 1084 pasukon 2020 grammarLanguage 1085 Gopher 1991 protocol 1086 roy 2011 pl 1087 Video Graphics Array 1987 standard 1088 Apache Cassandra 2008 database 1089 jsil-compiler 2010 compiler 1090 plot 2019 template 1091 desktop 2008 application 1092 Type Language 2013 pl 1093 Windows Registry Entries 1992 application 1094 Programming Language for Business 1972 pl 1095 UBASIC 1991 pl 1096 Unified Diff 1990 diffFormat 1097 Post Office Protocol 1957 protocol 1098 OpenEdge ABL 2006 pl 1099 Blockly 2011 library 1100 Nexus file 1997 textDataFormat 1101 NetRexx 1996 pl 1102 MOO 1993 pl 1103 Treelang 1988 pl 1104 Touch 2020 textMarkup 1105 InfiniBand 1999 standard 1106 Bun 2021 vm 1107 HeLang 2022 pl 1108 Esterel 1980 pl 1109 PL360 1967 pl 1110 nesC 2002 pl 1111 Jolie 2006 pl 1112 Opal 1994 pl 1113 RPM Spec 1997 application 1114 NATURAL 1971 pl 1115 Arden syntax 1992 dataNotation 1116 ColdFusion Components 1995 xmlFormat 1117 Glicol 2020 musicalNotation 1118 Autodesk Revit 1997 application 1119 spry 2015 pl 1120 Turbo Assembler 1989 pl 1121 Quaint 2014 textMarkup 1122 Sheep 2000 pl 1123 EXPRESS 2004 dataNotation 1124 souper 2014 optimizingCompiler 1125 AviSynth 2000 editor 1126 Jison Lex 2013 pl 1127 Blade 2011 template 1128 Extensible Embeddable Language 2005 pl 1129 dexvis 2012 application 1130 GRASS 1977 pl 1131 hurl 2020 application 1132 TECO 1963 pl 1133 VHDL-AMS 1993 pl 1134 Fable 2012 pl 1135 Flow9 2010 pl 1136 M4Sugar 2003 pl 1137 Operational Control Language 1986 pl 1138 Violent ES 2022 pl 1139 asterius-compiler 2017 compiler 1140 Parrot Assembly 2003 assembly 1141 HL7 1989 pl 1142 FP 1977 pl 1143 Smiles 1988 textDataFormat 1144 PEARL 1977 pl 1145 tidyverse 2016 library 1146 SSI 2004 template 1147 Open Database Connectivity 1990 protocol 1148 Google Apps Script 2009 pl 1149 llhd 2016 hardwareDescriptionLanguage 1150 opam-pm 2012 packageManager 1151 WHOIS 1970 protocol 1152 lamdu-editor 2011 editor 1153 Lamdu 2011 pl 1154 erg 2022 pl 1155 MATH-MATIC 1957 pl 1156 EGL 2008 pl 1157 FML 2012 pl 1158 Speedcoding 1953 pl 1159 Flix 2016 pl 1160 Kaggle 2010 application 1161 Rpm 1997 packageManager 1162 Wasp 2019 pl 1163 OpenNN 2003 library 1164 bpkg-pm 2017 packageManager 1165 Query by Example 1969 pl 1166 Cyber 2022 pl 1167 Carpet 1997 pl 1168 Molfile 1979 textDataFormat 1169 crush 2020 pl 1170 Reko 2007 decompiler 1171 comby 2019 grammarLanguage 1172 VCF 2011 textDataFormat 1173 Earl Grey 2014 pl 1174 Scroll 2020 textMarkup 1175 Handel-C 1996 pl 1176 Newick format 1986 textDataFormat 1177 IBM 1620 1959 assembly 1178 Maya Embedded Language 2013 pl 1179 Logos 2010 pl 1180 Spline Font Database 2004 application 1181 exkited 2018 template 1182 Markus 2020 queryLanguage 1183 Txt2tags 2001 textMarkup 1184 leo-editor 2013 editor 1185 ferret 2017 pl 1186 Xgboost 2014 binaryDataFormat 1187 PDP-11 1970 computingMachine 1188 TAP 1988 protocol 1189 tiledb 2017 database 1190 GFA BASIC 1986 pl 1191 haste 2014 pl 1192 Ternary numeral system 2001 notation 1193 XC 2005 pl 1194 HiveQL 2011 queryLanguage 1195 X Font Directory Index 1991 application 1196 XCompose 2006 application 1197 snakemake 2012 pl 1198 femtolisp 2008 pl 1199 Swallow 2021 pl 1200 Ark 2014 pl 1201 BlooP 1979 esolang 1202 tht 2017 pl 1203 monte 2014 pl 1204 ELLA 1979 pl 1205 astroml 2012 library 1206 Cypher Query Language 2011 queryLanguage 1207 Lingo 1988 pl 1208 MXML 2004 xmlFormat 1209 EEX 2012 template 1210 JSX 2013 template 1211 Guix Workflow Language 2017 pl 1212 GNU nano 2000 editor 1213 kona 2010 pl 1214 Lux 2014 pl 1215 Hedy 2020 pl 1216 Semantic Patch Language 2006 grammarLanguage 1217 XML Binding Language 2000 xmlFormat 1218 lobster 2011 pl 1219 3DS 1990 binaryDataFormat 1220 Vale 2017 assembly 1221 gentee 2018 pl 1222 MACRO-10 1978 pl 1223 Cali-Lang 2015 pl 1224 Em 2020 textMarkup 1225 Superjson 2014 dataNotation 1226 clash 2015 pl 1227 lispyscript 2012 pl 1228 Punycode 2003 characterEncoding 1229 XBLite 2001 pl 1230 NestedText 2020 dataNotation 1231 CFEngine 1993 application 1232 KRL 1976 pl 1233 Frost 2017 pl 1234 Q# 2017 pl 1235 fetlang 2017 esolang 1236 Mesa 1970 pl 1237 ALGO 1958 pl 1238 Genshi 2006 template 1239 Sinclair BASIC 1979 pl 1240 Farcaster 2021 protocol 1241 Berry 2018 pl 1242 Ć 2011 pl 1243 DNS over HTTPS 2018 protocol 1244 Adept 2018 pl 1245 Plus 1976 pl 1246 Module Management System 2005 pl 1247 turnstile 2017 grammarLanguage 1248 Stackless Python 1998 interpreter 1249 Asterisk 1999 application 1250 MurmurHash 2008 hashFunction 1251 ISWIM 1966 pl 1252 Differential Datalog 2018 pl 1253 kasaya 2018 application 1254 Noweb 1989 textMarkup 1255 1C Enterprise Script 2002 pl 1256 Rapira 1987 pl 1257 dslx 2020 pl 1258 PLZ 1979 pl 1259 dex 2018 pl 1260 MASM 1981 pl 1261 FOCUS 1997 pl 1262 miniML_error 2013 plzoo 1263 XUML 2002 pl 1264 Z-machine 1980 pl 1265 lem-editor 2015 editor 1266 harlan 2011 pl 1267 sile 2012 textMarkup 1268 Sweave 2002 template 1269 Newspeak 2006 pl 1270 AsciiMath 2014 textMarkup 1271 ACL2 1990 pl 1272 Object Rexx 1988 pl 1273 Locomotive BASIC 1984 pl 1274 spider 2014 pl 1275 Knitr 2012 template 1276 XPages 2008 application 1277 Xbasic 1988 pl 1278 Executable JSON 2013 pl 1279 relax 2000 grammarLanguage 1280 WML 1998 xmlFormat 1281 reflex-framework 2015 framework 1282 tea 2021 packageManager 1283 Ch computer programming 2001 pl 1284 Typed Lua 2019 pl 1285 hobbes 2017 pl 1286 Autocode 1954 pl 1287 circle-lang 2019 pl 1288 Mond 2014 pl 1289 Gentoo Ebuild 1999 pl 1290 MIRC scripting language 1995 pl 1291 HXML 2009 application 1292 JAL compiler 2000 compiler 1293 PROMAL 1986 pl 1294 Rescript 2020 pl 1295 Hierarchical File System 1985 filesystem 1296 cityhash-hash-function 2011 hashFunction 1297 Google Sheets 2006 application 1298 Smartsheet 2006 application 1299 Wyvern 2012 pl 1300 International System of Quantities 2009 schema 1301 score 2013 pl 1302 Nios II 2000 isa 1303 rason 2015 pl 1304 Revolution 1993 pl 1305 UnrealScript 1998 pl 1306 Subleq 2009 isa 1307 Simple Actor Language System and Architecture 2001 pl 1308 Avail 2010 pl 1309 BARE 2020 idl 1310 XSD 2001 dataValidationLanguage 1311 General Purpose Simulation System 1960 pl 1312 NS Basic 1994 pl 1313 AL 2016 pl 1314 Assembly CLI 2005 library 1315 .QL 2007 pl 1316 dub-pm 2012 packageManager 1317 atomspace 2008 application 1318 neut 2018 pl 1319 bee 2019 pl 1320 Object Linking and Embedding 1990 protocol 1321 NGS 2013 pl 1322 CSVw 2014 dataValidationLanguage 1323 Grammatical Framework 1998 grammarLanguage 1324 Qore 2006 pl 1325 Aheui 2012 esolang 1326 Parser 3 1997 pl 1327 neeilang 2019 pl 1328 hilvl 2015 pl 1329 Maude 1990 pl 1330 fo 2018 pl 1331 Swagger 2011 framework 1332 Pyret 2012 pl 1333 Schema.org 2011 dataValidationLanguage 1334 curv 2016 pl 1335 I-expressions 2003 dataNotation 1336 PLANNER 1969 pl 1337 HP BASIC for OpenVMS 1982 pl 1338 SuperBASIC 1984 pl 1339 Confluence 2004 textMarkup 1340 Sam Coupé 1989 pl 1341 XBRL 2003 xmlFormat 1342 BASIC Stamp 1990 pl 1343 Rc 1989 pl 1344 Livr 2012 dataValidationLanguage 1345 F 1996 pl 1346 muon 2019 pl 1347 SATySFi 2015 textMarkup 1348 Mako 2006 template 1349 Yet Another Scripting Language 2017 pl 1350 Frink 2001 pl 1351 Fast Healthcare Interoperability Resources 2011 standard 1352 visdown 2016 textMarkup 1353 NuGet 2010 packageManager 1354 CLISP 1973 pl 1355 FAUST 2002 pl 1356 Template Attribute Language 2007 template 1357 GLBasic 2003 pl 1358 EXEC 1966 pl 1359 Gerbil Scheme 2016 pl 1360 BitBake 2004 pl 1361 Gherkin 2008 pl 1362 flagship 1986 pl 1363 mpl 1988 pl 1364 BASIC Programming 1979 pl 1365 Handlebars 2010 template 1366 ObjDump 1991 application 1367 ApacheConf 1995 application 1368 Nymph 2017 pl 1369 Crema 2014 pl 1370 Caltech Intermediate Form 1980 pl 1371 Recfiles 1994 dataNotation 1372 Jsonnet 2014 dataNotation 1373 Pomsky 2022 pl 1374 Connection Machine 1990 pl 1375 Extended file system 1992 filesystem 1376 Dale 2013 pl 1377 F-Script 2009 pl 1378 CIR 2020 ir 1379 LUCID 1976 pl 1380 Cayenne 1998 pl 1381 Fully Automated Compiling Technique 1959 pl 1382 Parrot BASIC 2009 pl 1383 hamler 2019 pl 1384 Integer BASIC 1977 pl 1385 xodio 2015 visual 1386 kitlang 2018 pl 1387 Passerine 2021 pl 1388 Etoys 1996 pl 1389 Babylonian numerals -2000 numeralSystem 1390 GN 2015 application 1391 SQF 2002 pl 1392 tcsh 1983 pl 1393 Orc 2004 pl 1394 p4p 2010 pl 1395 Language Server Index Format 2019 jsonFormat 1396 Hare 2020 pl 1397 Ligo 2019 contractLanguage 1398 ddfql 2016 queryLanguage 1399 SFC 1993 pl 1400 basic calculator 1975 pl 1401 hashlink 2015 bytecode 1402 Caramel 2020 pl 1403 abs 2018 pl 1404 Snap! 2011 pl 1405 International Chemical Identifier 2005 textDataFormat 1406 ink-lang 2019 pl 1407 Memex 1945 computingMachine 1408 COMAL 1973 pl 1409 Spec Sharp 2004 pl 1410 vdscript 2000 pl 1411 MiniZinc 2012 pl 1412 Zonnon 2003 pl 1413 SdlBasic 2002 pl 1414 General feature format 2006 textDataFormat 1415 firrtl 2015 ir 1416 dlvm 2017 ir 1417 PowerQuery M 2015 queryLanguage 1418 Ren 2013 dataNotation 1419 Formatted Table 1990 dataNotation 1420 bloom 2010 pl 1421 APT Debian 1998 packageManager 1422 djangoql 2017 pl 1423 Atmel AVR instruction set 1996 isa 1424 S-PLUS 1988 pl 1425 mochi 2014 pl 1426 koara 2016 textMarkup 1427 Hocon 2011 dataNotation 1428 ToonTalk 1995 pl 1429 fe 2019 pl 1430 Oxyl 2019 pl 1431 Lisp Machine Lisp 1974 pl 1432 ballerina-central-pm 2015 packageManager 1433 Z 2012 pl 1434 Fun 2010 pl 1435 Genero Business Development Language 2010 pl 1436 holyc 2005 pl 1437 Interlisp 1966 pl 1438 Catala 2019 pl 1439 hacspec 2018 pl 1440 silk 2019 pl 1441 Uniform eXchange Format 2022 dataNotation 1442 txr 2009 pl 1443 Zimpl 2004 pl 1444 TELOS 1990 pl 1445 Flavors 1980 pl 1446 Egison 2013 pl 1447 Pact 2016 contractLanguage 1448 scribble 1997 pl 1449 OCL 1997 pl 1450 JavaFX Script 2005 pl 1451 NeXML format 2007 xmlFormat 1452 Bucardo 2009 application 1453 noulith 2022 pl 1454 JSON Query Language 2019 queryLanguage 1455 Cirru 2012 pl 1456 Grace 2010 pl 1457 Adobe Font Metrics 1987 application 1458 manool 2018 pl 1459 Ubercode 2005 pl 1460 Boron 2009 pl 1461 Edge Side Includes 2001 pl 1462 BIND 2000 application 1463 Potion 2007 pl 1464 spiral 2017 pl 1465 astro 2016 pl 1466 Z++ 1991 pl 1467 Linda 1986 pl 1468 noisecraft 2021 pl 1469 raptorjit 2009 pl 1470 Marp 2018 textMarkup 1471 eff 2012 pl 1472 Yum 1999 packageManager 1473 XML Metadata Interchange 2015 xmlFormat 1474 Scribe 1980 pl 1475 Redcode 1984 pl 1476 humanhash-hash-function 2011 hashFunction 1477 Flowgorithm 2014 visual 1478 Michigan Algorithm Decoder 1959 pl 1479 WDDX 1998 pl 1480 Bioconductor 2001 packageManager 1481 jayfor 2014 pl 1482 MIMIC 1964 pl 1483 Mouse 1970 pl 1484 NWScript 2004 pl 1485 JSON Graph Spec 2013 jsonFormat 1486 Claro 2021 pl 1487 Zot 2015 pl 1488 lav-format 2004 textDataFormat 1489 Acorn Atom 1980 pl 1490 Sibelius 1998 pl 1491 RDF Schema 1998 grammarLanguage 1492 Family BASIC 1984 pl 1493 Vale 2020 pl 1494 tsquery 2018 queryLanguage 1495 VisualWorks 1985 pl 1496 WATFIV 1968 pl 1497 NixOS 2003 os 1498 MACRO 1979 pl 1499 sixten 2014 pl 1500 oden 2016 pl 1501 Cadence SKILL 1990 pl 1502 Parallax Propeller 2006 isa 1503 MUSIC/SP 1972 pl 1504 Adventure Game Studio Script 2001 pl 1505 Kit 2012 template 1506 Alma 2014 pl 1507 C shell 1978 pl 1508 Charity 1992 pl 1509 Toi 2015 pl 1510 Pawn 1998 pl 1511 owen-lang 2019 pl 1512 epsilon 1967 pl 1513 GraphQL Schema Definition Language 2018 idl 1514 Watcom 1988 pl 1515 05AB1E 2015 esolang 1516 Plankalkul 1948 pl 1517 RELAX NG 2001 grammarLanguage 1518 hazel 2016 pl 1519 Oak 1991 pl 1520 Jank 2015 pl 1521 MXF 2004 binaryDataFormat 1522 GraphML 2001 xmlFormat 1523 Tuple space 1988 pl 1524 RSS 1999 protocol 1525 JSLT 2017 pl 1526 Berkeley DB 1994 library 1527 attoparsec 2010 library 1528 Morfik 2000 pl 1529 StarLogo 2008 pl 1530 Airtable 2012 application 1531 HAGGIS 2010 pl 1532 Deb file format 2003 binaryDataFormat 1533 AMOS 1990 pl 1534 Lustre 1993 pl 1535 GNU Data Language 2004 idl 1536 CFScript 1999 pl 1537 TextMate Language 2004 grammarLanguage 1538 Umka 2020 pl 1539 pie-lang 2018 pl 1540 Hodor 2015 esolang 1541 Rouge 2012 pl 1542 popr 2012 pl 1543 Groovy Server Pages 2008 template 1544 PeopleCode 2008 pl 1545 FaCT 2017 pl 1546 parenthetic 2012 esolang 1547 Battlestar 2014 pl 1548 kai 2016 pl 1549 UCG 2017 dataNotation 1550 Invisible XML 2020 grammarLanguage 1551 Xidoc 2021 textMarkup 1552 JS++ 2011 pl 1553 latino 2015 pl 1554 Conceptual 2019 pl 1555 HMMM 2006 assembly 1556 AmigaBASIC 1985 pl 1557 XPL 1967 pl 1558 Numbers 2007 application 1559 MSX BASIC 1984 pl 1560 multicodec 2015 standard 1561 Property Specification Language 2004 pl 1562 HAL/S 1972 assembly 1563 DAX 2009 queryLanguage 1564 CORAL 1964 pl 1565 SISAL 1983 pl 1566 CHIP-8 1970 pl 1567 Liberty BASIC 1992 pl 1568 COWSEL 1964 pl 1569 PILOT 1962 pl 1570 QuakeC 1996 pl 1571 SCRIPT markup 1999 pl 1572 Amiga E 1993 pl 1573 Yacas 1999 pl 1574 Q 1991 pl 1575 Kid templating language 1999 template 1576 REDUCE 2011 pl 1577 Vvvv 1998 application 1578 Structured text 2019 pl 1579 BLAKE 2012 hashFunction 1580 partiql 2019 queryLanguage 1581 cat 2016 pl 1582 ldpl 2019 pl 1583 pointless 2020 pl 1584 JSON Lines 2013 dataNotation 1585 zenscript 2014 pl 1586 Sophia 2018 contractLanguage 1587 cor 2016 pl 1588 Project Mentat 2016 queryLanguage 1589 Z-flat 2021 pl 1590 Incipit 2021 textMarkup 1591 Goal 2022 pl 1592 Lil 2022 pl 1593 Standard Portable Intermediate Representation 2014 ir 1594 Newsqueak 1990 pl 1595 Coco 2010 pl 1596 pikelet 2017 pl 1597 Li-Chen Wang 1976 pl 1598 forest-lang 2017 pl 1599 k-framework 2013 grammarLanguage 1600 BASIC-PLUS 1975 pl 1601 CMS-2 1968 pl 1602 Sketchpad 1962 pl 1603 Go! 2003 pl 1604 Information Processing Language 1954 pl 1605 [x]it! 2022 dataNotation 1606 Metalang99 2021 pl 1607 OPS5 1977 pl 1608 hakaru 2014 pl 1609 VSXu 2004 visual 1610 lemon 2017 pl 1611 tao3d 2003 pl 1612 Thue 2004 esolang 1613 GEL Genius 1997 pl 1614 dyvil 2014 pl 1615 Judoscript 2001 pl 1616 parasail 2009 pl 1617 Breccia 2019 textMarkup 1618 ArchieML 2015 dataNotation 1619 Vely 2022 pl 1620 Finite State Language 2016 pl 1621 Soy 2008 template 1622 StruQL 1999 queryLanguage 1623 Euler 1965 pl 1624 Lucidchart 2008 application 1625 Hush 2021 pl 1626 co-dfns 2012 pl 1627 SIMSCRIPT 1963 pl 1628 NESL 1993 pl 1629 Facelets 2005 template 1630 TOM object-oriented 1999 pl 1631 RTL/2 1972 pl 1632 Note 2012 dataNotation 1633 VisSim 1989 pl 1634 IBM POWER Instruction Set Architecture 1998 isa 1635 RubyGems 2018 packageManager 1636 MultiDimensional eXpressions 1997 queryLanguage 1637 httplang 2015 pl 1638 YARV 2007 vm 1639 Algebraic modeling language 1980 pl 1640 myia 2017 pl 1641 ASDF 2015 pl 1642 Geany 2005 editor 1643 QUEL 1976 queryLanguage 1644 MyBB 2002 pl 1645 RAPID 1994 pl 1646 FRACTRAN 1996 esolang 1647 Forsyth-Edwards Notation 1883 notation 1648 cuneiform 2015 pl 1649 OpenType Feature File 1996 application 1650 elena 2013 pl 1651 Augeas 2007 pl 1652 tangledown 2011 template 1653 Pod6 2019 textMarkup 1654 Fuzuli 2012 pl 1655 Alpaca 2017 pl 1656 Topaz 2021 pl 1657 Sublime Syntax Test Lang 2008 grammarLanguage 1658 POP-2 1967 pl 1659 HP Time-Shared BASIC 1969 pl 1660 Analytical engine 1837 computingMachine 1661 Mangle 2022 pl 1662 multiaddr 2014 schema 1663 STOS BASIC 1988 pl 1664 Business Basic 1970 pl 1665 BPML 2002 pl 1666 psyche-c 2016 compiler 1667 Zope 1999 application 1668 Sibilant 2010 pl 1669 Function block diagram 2001 pl 1670 OpenEXR 1999 binaryDataFormat 1671 Gwion 2016 pl 1672 micro-mitten 2020 pl 1673 dedukti 2009 pl 1674 Wavefront Material 1988 application 1675 IBM i Control Language 1993 pl 1676 Fjölnir 1986 pl 1677 orange 2014 pl 1678 reforth 2013 pl 1679 Nice 2006 pl 1680 Blacklight 2015 pl 1681 BANCStar 1996 pl 1682 z80 1976 assembly 1683 gura 2012 pl 1684 swizzle 2018 esolang 1685 verifpal 2019 pl 1686 Linux Kernel Module 1996 application 1687 LOLA 1991 pl 1688 Yedalog 2015 queryLanguage 1689 JSON lambda 2017 queryLanguage 1690 fleck 2019 pl 1691 Janus 1982 pl 1692 jeebox 2012 pl 1693 A# 2004 pl 1694 Bython 2016 pl 1695 orca-pl 2018 esolang 1696 Text Adventure Development System 1988 application 1697 AIMMS 1993 pl 1698 CBOR 2013 binaryDataFormat 1699 Bro 1994 pl 1700 topshell 2018 pl 1701 Strongtalk 1994 pl 1702 TRAC 1964 pl 1703 Textadept 2007 editor 1704 LinearML 2010 pl 1705 Cone 2017 pl 1706 OK 2021 pl 1707 MDL 1971 pl 1708 Gödel (Goedel) 1992 pl 1709 Heron 2016 pl 1710 taf 2012 pl 1711 CSpydr 2021 pl 1712 GLMS 2022 pl 1713 BuddyScript 2002 pl 1714 Velocity Template Language 2000 template 1715 Ripple 2014 pl 1716 maraca-lang 2018 pl 1717 Aime 2013 pl 1718 fizz 2017 pl 1719 BALGOL 1959 pl 1720 net-format 2006 textDataFormat 1721 WMLScript 1998 pl 1722 Boomerang Decompiler 2002 decompiler 1723 N-Triples 2014 dataNotation 1724 POPLOG 1992 pl 1725 april 2017 pl 1726 QtScript 2008 pl 1727 plam 2017 pl 1728 Quicken Interchange Format 2000 textDataFormat 1729 quicklisp-pm 2010 packageManager 1730 STON 2012 application 1731 Interchange File Format 1985 binaryDataFormat 1732 THEOS 1977 pl 1733 Visual Objects 1994 pl 1734 Casio BASIC 2006 pl 1735 jsparagus 2018 grammarLanguage 1736 HyPhy 2008 pl 1737 TriG syntax 2007 dataNotation 1738 mimium 2019 pl 1739 DataWeave 2014 pl 1740 ELFE 2003 pl 1741 OEM 1995 schema 1742 File Oriented Interpretive Language 1967 pl 1743 M2001 2001 pl 1744 Đ 2019 pl 1745 BeBasic 2009 pl 1746 TQL 2023 queryLanguage 1747 GAML 1991 pl 1748 Tao 2020 pl 1749 HuJSON 2019 dataNotation 1750 Kal 2012 pl 1751 titan 2017 pl 1752 Basic-256 2007 pl 1753 XOTcl 2000 pl 1754 JSL 1989 pl 1755 bamboo 2016 pl 1756 Turbo-Basic XL 1985 pl 1757 Wu 2018 pl 1758 LC-3 2003 pl 1759 mirth 2019 pl 1760 Austral 2018 pl 1761 Joule 1996 pl 1762 stoneknifeforth 2008 pl 1763 Coco/R 1990 grammarLanguage 1764 PBASIC 1988 pl 1765 KRC 1981 pl 1766 minikanren 2013 pl 1767 Pyrex 2002 pl 1768 baysick 2009 esolang 1769 hexagony 2015 esolang 1770 World of Warcraft Addon Data 2012 application 1771 Easytrieve 1969 pl 1772 Ohayo 2017 pl 1773 Lite-C 2007 pl 1774 Document Structure Description 2000 xmlFormat 1775 Draco 1987 pl 1776 Truth 2019 dataNotation 1777 Zimbu 2009 pl 1778 Promela 1997 pl 1779 P* 2013 pl 1780 Jevko 2021 dataNotation 1781 Mscgen 2016 textMarkup 1782 Picat 2012 pl 1783 Explorer 2020 visual 1784 AUTOCODER 1955 assembly 1785 Jeeves 2013 pl 1786 KUKA Robot Language 2010 pl 1787 infusion-framework 2007 framework 1788 buzz 2021 pl 1789 ulisp 2016 pl 1790 MessagePack 2009 binaryDataFormat 1791 Executive Systems Problem Oriented Language 1967 pl 1792 t2b 2018 pl 1793 Model 204 1972 pl 1794 pipelines 2018 pl 1795 Links 2006 pl 1796 multibase 2016 standard 1797 Matrix protocol 2014 protocol 1798 Notation3 1998 dataNotation 1799 Virgil 2006 pl 1800 Structured Query Reporter 1980 pl 1801 solid 2013 pl 1802 Vyxal 2020 esolang 1803 Homa 2018 protocol 1804 ObjectScript 2012 pl 1805 Caché ObjectScript 1997 pl 1806 Candy 2020 pl 1807 SMX 1998 pl 1808 jiyu 2019 pl 1809 kumir 2011 pl 1810 Atomese 2007 pl 1811 mint 2018 pl 1812 PML 1986 textMarkup 1813 Manchester syntax 2006 dataNotation 1814 HyTime 1991 pl 1815 Linden Scripting Language 2003 pl 1816 PLEX 1975 pl 1817 GorillaScript 2013 pl 1818 Balanced ternary 1544 notation 1819 C/AL 1987 pl 1820 COMIT 1957 pl 1821 Basic4ppc 2005 pl 1822 datafun 2015 pl 1823 NEWP 1985 pl 1824 son 2017 textMarkup 1825 Optimized Systems Software 1981 pl 1826 SYNAPSE 1990 pl 1827 LispWorks 1989 pl 1828 Processor Technology 1975 pl 1829 fructure-editor 2017 pl 1830 Smile data interchange format 2010 binaryDataFormat 1831 inko 2015 pl 1832 tampio 2017 pl 1833 xxl 2016 pl 1834 Uniface 1994 pl 1835 Kamby 2022 pl 1836 Sugar 2006 pl 1837 ten 2019 pl 1838 Nuua 2018 pl 1839 Mudlle 1998 pl 1840 Visual Tool Markup Language 1997 pl 1841 CEEMAC 1980 pl 1842 YESS 2022 protocol 1843 Céu 2011 pl 1844 Macchiato 2019 pl 1845 concurnas 2018 pl 1846 hoon 2011 pl 1847 Filterscript 2012 pl 1848 Reactive Plan Language 1993 pl 1849 tremor-query 2019 queryLanguage 1850 xTAO Modeling Language 2005 xmlFormat 1851 Fossil 2006 application 1852 GNU Guix 2013 distribution 1853 SipHash 2011 hashFunction 1854 Haxe Library Manager 2013 packageManager 1855 ko 2018 pl 1856 Small-C 1980 pl 1857 PTX 2009 assembly 1858 Visual Paradigm 2002 application 1859 X BitMap 1989 textDataFormat 1860 Gremlin 2009 queryLanguage 1861 Semantic Web Rule Language 2004 xmlFormat 1862 Functional PHP Preprocessor 2018 pl 1863 SDTM 2004 standard 1864 Conway chained arrow notation 1996 notation 1865 crmsh 2008 pl 1866 DML 2005 pl 1867 juvix 2017 pl 1868 Lucid 2014 template 1869 Short Code computer language 1949 pl 1870 Kuroko 2020 pl 1871 Parenscript 2009 pl 1872 ΜC++ 1992 pl 1873 Wing 2022 pl 1874 Scala Markup Language 2010 template 1875 Gren 2012 pl 1876 Rebeca Modeling Language 2004 pl 1877 Parlog 1983 pl 1878 Toy 2018 pl 1879 blz 2015 pl 1880 dllup 2015 textMarkup 1881 Dashrep 2011 pl 1882 Ook 2005 esolang 1883 jcard 2014 jsonFormat 1884 jplace 2012 jsonFormat 1885 Winbatch 1989 pl 1886 vega-editor-app 2015 application 1887 Simplicity 2017 pl 1888 Gist 1977 pl 1889 WinWrap Basic 1993 pl 1890 never 2018 pl 1891 expresso 2012 pl 1892 CBASIC 1982 pl 1893 Atlas Autocode 1965 pl 1894 OGNL 2007 pl 1895 NELIAC 1958 pl 1896 Continuity of Care Document 2008 xmlFormat 1897 Color BASIC 1980 pl 1898 MAGMA 1993 pl 1899 Sawzall 2003 pl 1900 ASIC 1992 pl 1901 Zeek 1994 pl 1902 DATABUS 1972 pl 1903 Energy Systems Language 1950 notation 1904 Flowcode 2002 pl 1905 Phel 2020 pl 1906 yeti 2007 pl 1907 FloScript 2013 pl 1908 Quake 2001 pl 1909 zolang 2018 pl 1910 video 2016 pl 1911 hamdown 2018 textMarkup 1912 MUDDL 1988 pl 1913 Scsh 1993 pl 1914 json->url 2017 jsonFormat 1915 DAP FORTRAN 1975 pl 1916 funl 2020 pl 1917 Speech Synthesis Markup Language 2010 xmlFormat 1918 texti 2017 textMarkup 1919 Blox 2018 pl 1920 rosette-lang 2013 pl 1921 Sitemap 2001 xmlFormat 1922 Data Communications ALGOL 1970 pl 1923 Rocky Mountain BASIC 1988 pl 1924 Python for S60 2006 pl 1925 sporth 2015 pl 1926 Pycket 2022 pl 1927 Kuin 2016 pl 1928 Edinburgh IMP 2002 pl 1929 Pharen 2009 pl 1930 A+ 1988 pl 1931 Clinical Document Architecture 1996 xmlFormat 1932 Axiom 1992 pl 1933 Euclid 1970 pl 1934 Synon 1986 pl 1935 XCAS 2001 pl 1936 PL/P 1978 pl 1937 Instruction list 2000 pl 1938 DDA 1979 pl 1939 Simons' BASIC 1983 pl 1940 categorical-query-language 2019 queryLanguage 1941 Margin 2019 textMarkup 1942 moya 2015 pl 1943 Wart 2010 pl 1944 ODRL 2000 pl 1945 Forte 4GL 1994 pl 1946 Action Code Script 2004 pl 1947 CobolScript 1999 pl 1948 Project MAC’s SYmbolic MAnipulator 1968 pl 1949 strat 2018 pl 1950 mimix-stream-language 2018 pl 1951 BrightScript 2008 pl 1952 Hspec 1990 pl 1953 Markdeep 2015 textMarkup 1954 xsharp 2015 pl 1955 Linker Script 1991 application 1956 jinx 2016 pl 1957 Tabloid 2020 esolang 1958 SAC 1994 pl 1959 FL 1989 pl 1960 TAL 2008 pl 1961 OBJ 1976 pl 1962 GEORGE 1957 pl 1963 Statsplorer 2014 visual 1964 Matrix Market Coordinate Format 1996 textDataFormat 1965 praxis-lang 2011 pl 1966 IDL specification language 1980 idl 1967 Armed Bear Common Lisp 2008 pl 1968 redprl 2016 pl 1969 Advanced Authoring Format 2002 binaryDataFormat 1970 CHICKEN 1994 pl 1971 MLAB 1975 pl 1972 g-fu 2019 pl 1973 Yabasic 1995 pl 1974 CRAM file format 2011 binaryDataFormat 1975 Tahoe-LAFS 2007 filesystem 1976 Chinese BASIC 1980 pl 1977 3D Manufacturing Format 2015 xmlFormat 1978 little 2016 pl 1979 BEAM Erlang virtual machine 2011 vm 1980 MHEG-5 1997 schema 1981 SequenceL 1989 pl 1982 lift 2014 pl 1983 clarity 2019 contractLanguage 1984 Literate Haskell 1991 pl 1985 RHTML 2004 template 1986 wah 2017 pl 1987 semicolon 2012 esolang 1988 lever 2015 pl 1989 Wonkey 2021 pl 1990 Gellish 2005 textMarkup 1991 Kalyn 2020 pl 1992 aretext 2020 editor 1993 obsidian 2018 pl 1994 Stockholm format 1997 textDataFormat 1995 Flatline 2013 pl 1996 NilScript 2013 pl 1997 ugBASIC 2021 pl 1998 XPL0 1976 pl 1999 ApeScript 1995 pl 2000 SQRL 2018 queryLanguage 2001 ISETL 1989 pl 2002 IPL 2013 pl 2003 Space 2013 dataNotation 2004 Astatine 2022 pl 2005 jasper 2014 pl 2006 Boogie 2008 pl 2007 D2 1995 textMarkup 2008 dbml 2019 textMarkup 2009 Low* 2008 pl 2010 opengraph 2010 xmlFormat 2011 2-pak 1975 pl 2012 rbs 2020 headerLang 2013 Basic4android 2011 pl 2014 Atari Microsoft BASIC 1981 pl 2015 Le-Lisp 1984 pl 2016 PL/C 1973 pl 2017 Google Data Protcol 2007 protocol 2018 Frank 2017 pl 2019 Pyth 2014 esolang 2020 TMTP 2017 protocol 2021 Binary Alignment Map 2009 binaryDataFormat 2022 De Bruijn index 1972 notation 2023 Pro*C 1996 pl 2024 hr-code 2019 barCodeFormat 2025 PEAR 1999 packageManager 2026 CYCL 1988 pl 2027 ESC/P 1992 pl 2028 OQL 1986 queryLanguage 2029 Coda web development software 2007 editor 2030 Hotdog 2001 pl 2031 Apple ProDOS 1983 os 2032 Meta Expressions 1960 dataNotation 2033 Netlib 1985 library 2034 MAI Basic Four 1974 pl 2035 Kaffeine 2010 pl 2036 General-purpose macro processor 1995 grammarLanguage 2037 ABC 80 1978 pl 2038 Glyph 2007 pl 2039 Savi 2018 pl 2040 Forml 2011 pl 2041 WebDNA 1995 pl 2042 Ciel 2010 pl 2043 Slideshow 2000 textMarkup 2044 Sing Sharp 2005 pl 2045 juniper 2016 pl 2046 Pnuts 1997 pl 2047 Nickle 2001 pl 2048 huginn 2015 pl 2049 Interactive C Interpreter 1980 pl 2050 Alumina 2021 pl 2051 tuplemarkup 2012 textMarkup 2052 Dern 2008 pl 2053 FOAF 2007 xmlFormat 2054 SHACL 2015 pl 2055 JCOF 2022 dataNotation 2056 Fardlang 2022 esolang 2057 lila-lang 2019 pl 2058 HUGO 1995 pl 2059 Bla 1994 pl 2060 False 1993 pl 2061 Lexon 2018 contractLanguage 2062 Scrapscript 2023 pl 2063 world 2011 pl 2064 Worst 2001 pl 2065 GUIDE 1994 pl 2066 IRC chat logs 1988 application 2067 Portable Bit Map Format 1986 textDataFormat 2068 v8torque 2018 pl 2069 Zork Implementation Language 1988 pl 2070 Dink Smallwood 1998 pl 2071 Nadesiko 2008 pl 2072 ARITH-MATIC 1954 pl 2073 IBM BASICA 1981 pl 2074 SenseTalk 2001 pl 2075 Irvine Dataflow 1975 pl 2076 Ruby Document format 1995 textMarkup 2077 ALGOL 68-R 1970 pl 2078 ARM Templates 2017 jsonFormat 2079 Crystallographic Information File 1991 textDataFormat 2080 candor 2012 pl 2081 Dasm 1988 assembly 2082 Lawvere 2021 pl 2083 ecsharp 2008 pl 2084 SpiderBasic 2015 pl 2085 Silicon Graphics Image 1996 binaryDataFormat 2086 Schematron 1999 xmlFormat 2087 Chipmunk Basic 1989 pl 2088 Daisy Systems 1983 pl 2089 Preferred Executable Format 1994 pl 2090 Common Data Format 1985 binaryDataFormat 2091 HAL Format 2012 binaryDataFormat 2092 elymas 2012 pl 2093 RapidQ 2000 pl 2094 SCM 1990 pl 2095 Split-C 1995 pl 2096 ILBM 1985 binaryDataFormat 2097 FXML 2011 xmlFormat 2098 A++ 1996 pl 2099 METAPOST 1994 pl 2100 tamgu 2019 pl 2101 arret 2017 pl 2102 GRAAL 1986 pl 2103 ultralisp-pm 2018 packageManager 2104 Charcoal 2016 esolang 2105 Beta BASIC 1983 pl 2106 Unity3D Asset 2005 application 2107 tablam 2020 queryLanguage 2108 Prograph 1983 pl 2109 ATLAS Transformation Language 2005 pl 2110 Tandem Advanced Command Language 1999 pl 2111 Miva 1996 pl 2112 Ante 2013 esolang 2113 JSONScript 2016 pl 2114 CLAIRE 2004 pl 2115 Small 1980 pl 2116 Z 2019 pl 2117 CLPR 1986 pl 2118 Urbiscript 2003 pl 2119 System Automatycznego Kodowania Operacji 1960 pl 2120 YAMP 2019 dataNotation 2121 h 2019 esolang 2122 iCalendar 1998 textDataFormat 2123 pinto 2016 pl 2124 TAO 2020 dataNotation 2125 nydp 2014 pl 2126 JLang 2016 pl 2127 Link 2021 pl 2128 Serious 2021 pl 2129 Slim Framework 2013 framework 2130 Acme 1994 pl 2131 AspectC++ 2001 pl 2132 The Dog Programming Language 2011 pl 2133 frame 2013 pl 2134 stella 1999 pl 2135 z2 2015 pl 2136 ca65 Assembly 1998 assembly 2137 ctalk-lang 1989 pl 2138 Run BASIC 2008 pl 2139 Augment 1974 pl 2140 IBM BASIC 1981 pl 2141 MetaComCo 1981 pl 2142 Laning and Zierler system 1953 pl 2143 LINC 4GL 1980 pl 2144 Spice Lisp 1980 pl 2145 DarkBASIC 2000 pl 2146 Portable Standard Lisp 1980 pl 2147 Polymorphic Programming Language 1969 pl 2148 Obliq 1993 pl 2149 Atari ST BASIC 1985 pl 2150 Graphics BASIC 1983 pl 2151 IMP 1968 pl 2152 Cullinet 1968 pl 2153 Stalin 2006 compiler 2154 Knowledge Interchange Format 1990 pl 2155 Nimskull 2021 pl 2156 cperl 2017 pl 2157 IBM Informix-4GL 1985 queryLanguage 2158 loci 2013 pl 2159 hrqr 2015 barCodeFormat 2160 Dolittle 1952 pl 2161 Rita 2019 pl 2162 Leda 1995 pl 2163 MACRO-11 1974 pl 2164 DragonBASIC 2003 pl 2165 MakeDoc 2000 textMarkup 2166 Namespace-based Validation Dispatching Language 2006 xmlFormat 2167 ru 2015 pl 2168 Chrome 2008 pl 2169 Nord Programming Language 1974 pl 2170 Plaid 2009 pl 2171 adamant 2018 pl 2172 nianiolang 2015 pl 2173 flua 2012 pl 2174 FCL 1989 pl 2175 ProbeVue 2008 pl 2176 plink-ped-format 2007 textDataFormat 2177 starpial 2012 pl 2178 KAML 2018 dataNotation 2179 Kami 2022 textMarkup 2180 Binary Lambda Calculus 2004 esolang 2181 myrddin 2016 pl 2182 OMG IDL 2018 idl 2183 Plot 2006 pl 2184 Slick 2020 pl 2185 4th Dimension 1987 pl 2186 chain-format 2013 textDataFormat 2187 Fortran 90 1990 pl 2188 Netpbm grayscale image format 1988 textDataFormat 2189 clike 2014 pl 2190 Tynker 2012 visual 2191 XBEL 2006 pl 2192 HP-GL 1986 pl 2193 Game Oriented Assembly Lisp 1993 pl 2194 SP/k 1974 pl 2195 Sublime Syntax 2008 grammarLanguage 2196 ColorForth 1992 pl 2197 Lazy ML 1980 pl 2198 Mortran 1973 pl 2199 EXEC 2 1970 pl 2200 P′′ 1964 pl 2201 ZBasic 1980 pl 2202 Ecstasy 2015 pl 2203 ISBL 1980 pl 2204 SIGNAL 1982 pl 2205 Steinhaus-Moser notation 1969 notation 2206 MML 1982 standard 2207 Content Assembly Mechanism 2002 xmlFormat 2208 Dataflex 1982 pl 2209 co2 2016 pl 2210 Ren-C 2012 pl 2211 rhine 2014 pl 2212 Croma 2005 pl 2213 Mobl 2010 pl 2214 UBJSON 2017 binaryDataFormat 2215 BASIC A+ 1983 pl 2216 Mallard BASIC 1985 pl 2217 Janus 1990 pl 2218 LISP 2 1963 pl 2219 Ratfiv 1980 pl 2220 Apple BASIC 1978 pl 2221 Tree and Tabular Combined Notation 1992 pl 2222 keli 2018 pl 2223 mlatu 2021 pl 2224 a Lisp Environment 2019 pl 2225 UIML 2005 xmlFormat 2226 Chomski 2007 pl 2227 Visual Test 1992 pl 2228 Argus 1982 pl 2229 GameMonkey Script 2002 pl 2230 Steel Bank Common Lisp 1999 pl 2231 JIS X 0201 1969 characterEncoding 2232 Just Another Scripting Syntax 2009 pl 2233 LiteScript 2013 pl 2234 Om 2012 pl 2235 Avionics Architecture Design Language 2003 pl 2236 Trellis 1985 pl 2237 Kawa 1996 pl 2238 Magik 1989 pl 2239 Data General Business Basic 1970 pl 2240 mythryl 2006 pl 2241 TUTOR 1969 pl 2242 Refer 1978 textMarkup 2243 lambda-zero 2018 pl 2244 Kaleidoscope 1994 pl 2245 fp 2022 pl 2246 zl 2012 pl 2247 3APL 1998 pl 2248 Enterprise Mashup Markup Language 2001 pl 2249 OpenComal 2006 pl 2250 nylo 2017 pl 2251 orca 1985 pl 2252 TI-89 series 1998 pl 2253 rpscript 2018 pl 2254 awl 2014 pl 2255 juicy 2017 pl 2256 RapidBatch 2017 pl 2257 kerf 2015 pl 2258 Devicetree 2009 dataNotation 2259 G-Portugol 2005 pl 2260 nimrod 2013 pl 2261 Objective-S 1980 pl 2262 protium 2007 pl 2263 bml 2014 dataNotation 2264 Make 1977 application 2265 WHIRL 1997 pl 2266 Y 1981 pl 2267 SnapTag 2011 barCodeFormat 2268 Transaction Language 1 1984 pl 2269 Gene transfer format 2006 textDataFormat 2270 MEDUSA 2002 pl 2271 Aztec C 1980 pl 2272 ΛProlog 1986 pl 2273 CECIL 1992 pl 2274 polyglot-compiler 2003 compiler 2275 ana 2018 pl 2276 CodeGear Delphi 1995 pl 2277 Vilnius BASIC 1986 pl 2278 Scratchpad 1971 pl 2279 l2 2017 pl 2280 Jisp 2014 pl 2281 mys 2020 pl 2282 Integrated Data Store 1964 queryLanguage 2283 DYNAMO 1959 pl 2284 Eurisko 1978 pl 2285 Alma-0 1997 pl 2286 RamdaScript 2016 pl 2287 hivemind 2015 pl 2288 B32 Business Basic 1986 pl 2289 WFL 1961 pl 2290 AgentSpeak 1994 pl 2291 BCX 1999 pl 2292 Cornell University Programming Language 1967 pl 2293 Meditech Interpretive Information System 1986 pl 2294 Gforth 1992 pl 2295 Sun Raster 1989 binaryDataFormat 2296 UPIC 2018 pl 2297 MAPPER 1960 pl 2298 mages 2016 pl 2299 jonprl 2015 pl 2300 txtzyme 2010 pl 2301 Piet 1990 esolang 2302 Slony 2004 application 2303 SIMPL 1990 pl 2304 Text Executive Programming Language 1979 pl 2305 Wirth syntax notation 1977 grammarLanguage 2306 egel 2016 interpreter 2307 Common Lisp with Arc Macros and Procedures 2014 pl 2308 I 2012 pl 2309 RLaB 1998 pl 2310 QOIR 2022 binaryDataFormat 2311 Formula language 1989 pl 2312 OptimJ 2006 pl 2313 rainbow 2009 pl 2314 fjs 2013 pl 2315 phorth 2016 pl 2316 CMS Pipelines 1986 pl 2317 DEVIL 2000 pl 2318 icarus 2015 pl 2319 Ham 2013 pl 2320 sill 2015 pl 2321 badlanguage 2017 pl 2322 rel-lang 2015 pl 2323 gintonic 2018 queryLanguage 2324 jedlang 2015 pl 2325 runiq 2015 pl 2326 blur-markup-language 2017 textMarkup 2327 formality 2019 pl 2328 ramen 2017 pl 2329 corescript 2018 pl 2330 X PixMap 1989 textDataFormat 2331 mdl 2019 isa 2332 lezer 2019 grammarLanguage 2333 emesh 2014 esolang 2334 flownote 2019 pl 2335 oopsilon 2017 esolang 2336 U 2013 pl 2337 elegance 2017 pl 2338 AmbientTalk 2006 pl 2339 emfatic 2004 pl 2340 git-config 2005 application 2341 LARP 2003 pl 2342 Lazy K 2002 esolang 2343 Liso 2014 dataNotation 2344 ><> 2009 esolang 2345 Ion Schema Language 2018 grammarLanguage 2346 Robots.txt 1994 configFormat 2347 specrtl 2011 pl 2348 vivaldi 2015 pl 2349 PascalABC.NET 2002 pl 2350 kei 2019 pl 2351 edgelisp 2008 pl 2352 D data language specification 1994 queryLanguage 2353 CONVERT 1966 pl 2354 GeneXus 1988 pl 2355 unseemly 2016 pl 2356 typecobol 2015 pl 2357 Alternate Instruction Set 2001 isa 2358 r4 2009 pl 2359 Fenix Project 2006 pl 2360 ScriptBasic 1999 pl 2361 BASICODE 1980 pl 2362 Knowledge Query and Manipulation Language 1993 queryLanguage 2363 MARK IV 1985 pl 2364 TTM 1968 pl 2365 Ease 1991 pl 2366 JOSS Extended and Adapted for Nineteen-hundred 1960 pl 2367 Lava 2001 pl 2368 BASIC09 1978 pl 2369 MacBASIC 1985 pl 2370 Encore 2014 pl 2371 Brain-Flak 2016 esolang 2372 R++ 1990 pl 2373 CHILL 1980 pl 2374 ELAN 1974 pl 2375 SAOL 1999 pl 2376 Southampton BASIC System 1960 pl 2377 IPTSCRAE 1994 pl 2378 moinmoin 2000 textMarkup 2379 CodeStudAssembler 2017 assembly 2380 ktexteditor-editor 2014 editor 2381 Cambridge Algebra System 1973 pl 2382 PACT I 1955 pl 2383 Continuity of Care Record 2007 xmlFormat 2384 AUI 2002 pl 2385 Amigas 1989 pl 2386 Hopscotch 2016 pl 2387 SPIP 1977 pl 2388 Nomad software 1976 pl 2389 Corman Common Lisp 1995 pl 2390 Ciao 1984 pl 2391 PICO 1997 pl 2392 Join Java 2000 pl 2393 fork-lang 2014 pl 2394 Scheme 2-D 2021 pl 2395 Snowball 2001 pl 2396 preforth 2018 pl 2397 quaint-lang 2015 pl 2398 RascalMPL 2010 pl 2399 TScript 2012 pl 2400 remix 2016 pl 2401 VlibTemplate 2003 template 2402 neutron 2019 pl 2403 emerald-lang 2019 pl 2404 Riff 2020 pl 2405 HCard 2009 xmlFormat 2406 Ad-hoc 2017 pl 2407 polymath 2020 textMarkup 2408 Edina 2022 pl 2409 rocket 2018 pl 2410 Jammy 2021 pl 2411 nlpl 2018 pl 2412 lsd 2016 textMarkup 2413 Calc4 2018 pl 2414 cosh 2022 pl 2415 eskew 2019 pl 2416 BML 2007 xmlFormat 2417 coherence 2009 pl 2418 s-lang 1992 pl 2419 CBOR data definition language 2017 idl 2420 hop 2006 pl 2421 Joyfully Universal Language for (Inline) Assembly 2016 pl 2422 LIFE 1987 pl 2423 Myghty 2006 pl 2424 ppm-format 1988 textDataFormat 2425 SHIFT 1997 pl 2426 Visual Smalltalk Enterprise 1992 pl 2427 PV-Wave 1988 pl 2428 APLX 1985 pl 2429 ABSET 1969 pl 2430 Agora 1993 pl 2431 MapBasic 1997 pl 2432 TMG 1968 grammarLanguage 2433 Elliott ALGOL 1962 pl 2434 Jet Propulsion Laboratory Display Information System 1973 pl 2435 Bounce 2016 pl 2436 Pascal Script 2000 pl 2437 ircis 2019 esolang 2438 Concurrent ML 1993 pl 2439 DML 1992 pl 2440 THINK C 1986 pl 2441 OpenROAD 1990 pl 2442 GUIDO music notation 1998 textDataFormat 2443 EasyLanguage 1995 pl 2444 Data Catalog Vocabulary 2014 schema 2445 Meta II 1962 grammarLanguage 2446 Omnis Studio 1982 pl 2447 Easy Programming Language 2004 pl 2448 Systems Biology Markup Language 2006 xmlFormat 2449 ITL 1981 pl 2450 Protel 1975 pl 2451 V 2016 esolang 2452 ALGOL N 1967 pl 2453 Galaksija BASIC 1983 pl 2454 FastTrack Scripting Host 2006 pl 2455 APSE 1980 pl 2456 Harwell-Boeing file format 1989 textDataFormat 2457 SPITBOL 1971 pl 2458 String diagram 1971 notation 2459 Intuit Interchange Format 2004 textDataFormat 2460 PALASM 1980 pl 2461 WOL 1997 pl 2462 Framework office suite 1983 pl 2463 QUIKSCRIPT 1965 pl 2464 SBASIC 1983 pl 2465 Star 2021 pl 2466 Jazz 2019 pl 2467 Abbreviated Test Language for All Systems 1984 pl 2468 mycroft 2013 pl 2469 ralph 2010 pl 2470 grid-notation 2013 textDataFormat 2471 MewMew 2020 esolang 2472 sugartex 2018 textMarkup 2473 y-lang 2019 pl 2474 Calypso 2020 pl 2475 Proteus 1998 pl 2476 whack 2018 pl 2477 BlazeX 2020 pl 2478 setlx 2011 pl 2479 flame-ir 2015 ir 2480 toki sona 2021 pl 2481 CGOL 1973 pl 2482 ZENO 1995 pl 2483 AIML 2001 dataNotation 2484 Little Implementation Language 1974 pl 2485 Insitux 2021 pl 2486 Cane 2022 musicalNotation 2487 Rye 2019 pl 2488 Daplex 1979 pl 2489 NXT-G 2006 pl 2490 r3 2021 pl 2491 shadama 2017 pl 2492 PCrap 2021 pl 2493 RigC 2021 pl 2494 Amazon Redshift 2012 queryLanguage 2495 RTF 1987 textMarkup 2496 vCard 1998 textDataFormat 2497 Chika 2019 pl 2498 latte-js 2012 pl 2499 duro 2003 queryLanguage 2500 Blue 1977 pl 2501 Lesma 2022 pl 2502 HuwCode 2018 pl 2503 penguor 2020 pl 2504 taxa 2014 pl 2505 acorn-lang 2015 pl 2506 newclay 2011 pl 2507 Idio 2015 pl 2508 Mewl 2022 esolang 2509 stacklang 2018 pl 2510 Storymatic 2022 pl 2511 Esoteric Reaction 2020 esolang 2512 Horse64 2020 pl 2513 passambler 2015 pl 2514 rockstar-rkt 2019 pl 2515 Workfl 2019 textMarkup 2516 GamerLanguage 2021 pl 2517 Marine Trading Markup Language 2000 xmlFormat 2518 Procfile 2012 pl 2519 quorum 2013 pl 2520 srv 2010 idl 2521 Trex 2001 grammarLanguage 2522 USD 2016 pl 2523 wescheme 2009 pl 2524 APL2 1984 pl 2525 blue 2009 pl 2526 EFL 1979 pl 2527 Structured Control Language 1998 pl 2528 Twelf 2006 pl 2529 TASM 1989 pl 2530 Tosh 2015 pl 2531 Visual DataFlex 1982 pl 2532 Rexon 1978 pl 2533 FpgaC 1996 pl 2534 Object-Z 1991 pl 2535 SYMPL 1970 pl 2536 Ikarus Scheme implementation 2007 pl 2537 LYaPAS 1964 pl 2538 ObjectLOGO 1993 pl 2539 Agilent VEE 1991 pl 2540 AlphaBasic 1976 pl 2541 BASIC-11 1976 pl 2542 PS-algol 1981 pl 2543 Structured Product Labeling 2004 xmlFormat 2544 GARP 1988 pl 2545 CS-Script 2004 pl 2546 PROIV 1976 pl 2547 RuleML 2002 pl 2548 aplette 2014 pl 2549 DEMOS 1978 pl 2550 Flex language 1967 pl 2551 SLIP 1960 pl 2552 glush 2019 grammarLanguage 2553 Taijilang 2014 pl 2554 CMU Common Lisp 1980 pl 2555 ALCOR 1959 pl 2556 Larceny Scheme implementation 2017 pl 2557 Acornsoft Logo 1985 pl 2558 Napier88 1989 pl 2559 Basic4GL 2002 pl 2560 GNU E 1991 pl 2561 Nested Context Language 2000 xmlFormat 2562 SuperTalk 1989 pl 2563 SAM76 1970 pl 2564 Standard for Exchange of Non-clinical Data 2002 standard 2565 VAL 1980 pl 2566 Robot Battle 1994 pl 2567 INFER 1992 pl 2568 S/SL 1980 pl 2569 Digital Interactive Business Oriented Language 1970 pl 2570 Tymshare SuperBasic 1968 pl 2571 Tag Line Commands 2015 pl 2572 KamilaLisp 2021 pl 2573 eco-editor 2012 editor 2574 sham 2016 grammarLanguage 2575 Extended ML 1985 pl 2576 BASIC-E 1976 pl 2577 UniVerse 1997 pl 2578 Post production 1941 grammarLanguage 2579 6gunz 2018 pl 2580 Dexterity 1991 pl 2581 DARPA Agent Markup Language 1999 xmlFormat 2582 PASCAL/MT+ 1988 pl 2583 LIMDEP 1980 pl 2584 Atom 2007 pl 2585 SASL 1972 pl 2586 NCAR Command Language 1990 pl 2587 CommonLoops 1986 pl 2588 Khepri 2012 pl 2589 Typographical Number Theory 1979 notation 2590 UNCOL 1958 ir 2591 SISC 2007 pl 2592 Alpha 1971 pl 2593 ALTRAN 1968 pl 2594 PowerHouse 1988 pl 2595 Secure Operations Language 1970 pl 2596 Election Markup Language 2001 xmlFormat 2597 RenderMan Shading Language 1989 pl 2598 ed 1973 editor 2599 Squire 2021 pl 2600 Knight 2021 pl 2601 Hook 2021 pl 2602 Langage Sans Espoir 1971 pl 2603 Flapjax 2006 pl 2604 Little b 2004 pl 2605 CheetahTemplate 2001 template 2606 AIL 2016 ir 2607 nulan 2012 pl 2608 Hot Cocoa Lisp 2013 pl 2609 Lithe 1982 pl 2610 Curly 2021 pl 2611 RustScript 2021 pl 2612 rio 2017 pl 2613 Bizubee 2015 pl 2614 KavaScript 2021 pl 2615 Octune 2021 pl 2616 mlpolyr 2016 pl 2617 Cotton 2021 pl 2618 ForthScript 2020 pl 2619 lamderp 2013 pl 2620 Iode 2015 pl 2621 PearScript 2016 pl 2622 woe 2009 pl 2623 H++ 2013 pl 2624 Jingo 2020 pl 2625 Hina 2020 pl 2626 microl 2021 pl 2627 Fern 2022 pl 2628 MeanscriptCLI 2020 pl 2629 mountain 2019 pl 2630 lambcalc 2019 pl 2631 Broccoli 2020 pl 2632 mai 2019 pl 2633 alan 2018 pl 2634 avro 2012 idl 2635 beautiful-report-language 2003 pl 2636 Copilot 2021 pl 2637 lain 2017 pl 2638 luau 2020 pl 2639 MathLingua 2019 pl 2640 michelson 2017 pl 2641 Nasal 2002 pl 2642 plantuml 2010 textMarkup 2643 rosie 2015 queryLanguage 2644 Timpani 2017 textMarkup 2645 bioscript 2019 pl 2646 CP 1987 pl 2647 Darcs Advanced Revision Control System 2003 application 2648 Emerald 1987 pl 2649 QCL 2005 pl 2650 rise 2020 pl 2651 sora 2019 pl 2652 SubX 2019 assembly 2653 webql 2001 queryLanguage 2654 MINC 1985 pl 2655 OWBasic 2000 pl 2656 Phoenix Object Basic 2001 pl 2657 CA-Realizer 1992 pl 2658 FLACC 1977 pl 2659 Object Oberon 1990 pl 2660 Ramis software 1960 pl 2661 Smalltalk MT 1994 pl 2662 Mama 2010 pl 2663 TOM 2001 pl 2664 ZigZag 1965 knowledgeBase 2665 Actor 1988 pl 2666 Gello Expression Language 2001 pl 2667 OMeta 2007 grammarLanguage 2668 NPL 1977 pl 2669 IFPS 1970 pl 2670 Matita 1999 pl 2671 Abstract State Machine Language 2001 pl 2672 CA-Telon 1981 pl 2673 SR 1988 pl 2674 Lynx 1984 pl 2675 PIKT 1998 pl 2676 Distributed Application Specification Language 1999 pl 2677 Langage Implementation Systeme 1980 pl 2678 Algebraic Logic Functional 1990 pl 2679 Subtext 2005 pl 2680 CAL Actor Language 2001 pl 2681 FuzzyCLIPS 1995 knowledgeBase 2682 Tektronix 4050 1980 pl 2683 IBM 1401 Symbolic Programming System 1959 compiler 2684 Information Algebra 1962 pl 2685 PVS 1992 pl 2686 Real-time Cmix 1992 pl 2687 Actor-Based Concurrent Language 1986 pl 2688 Occam π 2005 pl 2689 Strand 1989 pl 2690 Onyx 1989 pl 2691 Tiger-BASIC 1986 pl 2692 IBM Rational SQABasic 1996 pl 2693 Batari Basic 2007 pl 2694 Bywater BASIC 1992 pl 2695 NorthStar BASIC 1977 pl 2696 Allegro Common Lisp 1986 pl 2697 Todotxt 2006 dataNotation 2698 CokeScript 2015 pl 2699 D4 2001 pl 2700 Texy! 2004 textMarkup 2701 ShEx 2012 grammarLanguage 2702 Scriptol 2001 pl 2703 Alphard 1974 pl 2704 Typecast.js 2013 pl 2705 daonode 2011 pl 2706 CLiX markup 1998 xmlFormat 2707 LEAP 1969 pl 2708 t-lang 2019 pl 2709 Swym 2012 pl 2710 gfoo 2020 pl 2711 Ferite 2000 pl 2712 Moescript 2012 pl 2713 tridash 2018 pl 2714 wats 2017 pl 2715 weebasic 2021 pl 2716 FutureScript 2015 pl 2717 TextFrame 2008 textMarkup 2718 Broccoli 2008 pl 2719 leaf 2013 pl 2720 psyche 2018 pl 2721 Broccoli 2022 esolang 2722 LES 2012 grammarLanguage 2723 The New Hampshire X Format 1999 textDataFormat 2724 Patient-Oriented Prescription Programming Language 2015 pl 2725 Spice 2021 pl 2726 Sweet Expressions 2013 dataNotation 2727 verve 2017 pl 2728 Eden 1995 pl 2729 emoticon 2004 esolang 2730 mmix 1999 assembly 2731 Red 1972 pl 2732 ssl-lang 1976 pl 2733 Hummingbird QuickScript 1990 pl 2734 High Tech BASIC 1988 pl 2735 Gauche Scheme implementation 1998 pl 2736 Stratego/XT 1998 grammarLanguage 2737 DAML+OIL 2001 pl 2738 XCore Architecture 2007 isa 2739 Advanced Continuous Simulation Language 1967 pl 2740 Averest 2005 pl 2741 EUMEL 1979 pl 2742 SIMPLE 1980 pl 2743 Ecological Metadata Language 1997 xmlFormat 2744 muMath 1978 pl 2745 PALcode 1996 isa 2746 PICT 1992 pl 2747 YAP 1985 pl 2748 MathType 1987 application 2749 Ethernet 1973 protocol 2750 JPEG 1992 binaryDataFormat 2751 Open Financial Exchange 1997 xmlFormat 2752 patch 1985 unixApplication 2753 Mass Energy Equation 1905 equation 2754 QED 1967 editor 2755 Autoconf 1991 configFormat 2756 Common Log Format 1995 textDataFormat 2757 ex 1978 editor 2758 Interpress 1986 textMarkup 2759 XGMML 2006 pl 2760 FILETAB 1966 pl 2761 BEFLIX 1963 pl 2762 Data Access Language 1990 pl 2763 Service Modeling Language 2009 pl 2764 CorVision 1986 pl 2765 IAL 1958 pl 2766 Joe-E 2004 pl 2767 O-Matrix 1994 pl 2768 SA-C 1998 pl 2769 WLambda 2019 pl 2770 zlang 2017 pl 2771 PLEXIL 2005 pl 2772 System 2 2008 pl 2773 WCPS 2008 pl 2774 cytosol 2020 pl 2775 BRUIN 1968 pl 2776 Yakou Lang 2021 pl 2777 DIANA 1980 ir 2778 WSFN 1983 pl 2779 Dixy 2017 dataNotation 2780 RicScript 2019 pl 2781 truck 2019 pl 2782 ASP.NET 2002 pl 2783 MathML 1998 xmlFormat 2784 Namespace Routing Language 2003 xmlFormat 2785 tsar 2019 pl 2786 RoyalScript 2016 pl 2787 dreamlisp 2019 pl 2788 Tawa 2021 pl 2789 SQHTML 2022 pl 2790 Sugi 2021 pl 2791 albatross 2015 pl 2792 empirical 2019 pl 2793 GolfScript 2007 esolang 2794 hecl 2004 pl 2795 Indental 2017 dataNotation 2796 Jesth 2022 dataNotation 2797 links 2016 pl 2798 PromQL 2014 queryLanguage 2799 qed-lang 2015 pl 2800 runic 2017 template 2801 Seq 2019 pl 2802 Bossam Rule Language 2004 queryLanguage 2803 kivy-lang 2010 pl 2804 phylip 1991 textDataFormat 2805 Public Key File 1995 application 2806 REALBasic (now Xojo) 1996 pl 2807 Rust HIR 2015 ir 2808 euboea 2018 pl 2809 Nuprl 1984 pl 2810 ABSYS 1966 pl 2811 KL0 1982 pl 2812 cql 1998 pl 2813 QUTE 1986 pl 2814 CHIP 1985 pl 2815 DATATRIEVE 1970 queryLanguage 2816 IBM HAScript 1990 pl 2817 PL-11 1971 pl 2818 ROOP 1995 pl 2819 ZOPL 1979 pl 2820 SNOBOL4 1967 pl 2821 Mentat 1987 pl 2822 Kermeta 2012 pl 2823 XDR Schema 1998 xmlFormat 2824 LEXX 1985 editor 2825 Schema for Object-Oriented XML 1998 xmlFormat 2826 COFFEE Cinema 4D 1992 pl 2827 Visual DialogScript 2000 pl 2828 FX-87 1987 pl 2829 JAWS Scripting Language 2008 pl 2830 MacroML 2001 pl 2831 Business Object Notation 1989 notation 2832 CYBIL 1980 pl 2833 Datapoint's Advanced Systems Language 1982 pl 2834 FORMAC 1993 pl 2835 KonsolScript 2005 pl 2836 Spark 1988 pl 2837 tibet 1997 framework 2838 codeflow 2014 pl 2839 c-talk 1999 pl 2840 hilbert 2014 pl 2841 Lush 2002 pl 2842 Pickle 1995 binaryDataFormat 2843 pikachu 2017 esolang 2844 SARL 2013 pl 2845 ttsneo 2006 pl 2846 Typoscript 1998 dataNotation 2847 ASCII Armor 2007 textEncodingFormat 2848 CSL 1966 pl 2849 Homespring 2003 pl 2850 PLAIN 1976 pl 2851 Post-X 1980 grammarLanguage 2852 prompter 2011 pl 2853 strudel 2011 textDataFormat 2854 IpTables Rope 2005 pl 2855 Datomic 2012 queryLanguage 2856 CLX 1985 pl 2857 Adenine 1999 pl 2858 Lagoona 1997 pl 2859 Sort Merge Generator 1951 pl 2860 TACPOL 1976 pl 2861 MARIA XML 2009 xmlFormat 2862 AMBIT 1964 pl 2863 o:XML 2002 pl 2864 BBj 2001 pl 2865 BBx 1985 pl 2866 R2ML 2003 xmlFormat 2867 JSML 2001 xmlFormat 2868 SYMBOLIC ASSEMBLY 1956 assembly 2869 FleXML 2001 pl 2870 GRML 2003 pl 2871 Robic 1975 pl 2872 ThingLab 1979 pl 2873 51forth 1980 pl 2874 Concurrent METATEM 1993 pl 2875 LispMe 2008 pl 2876 Met-English 1950 pl 2877 ObjectPAL 1993 pl 2878 SheerPower4GL 2000 pl 2879 Business application language 1974 pl 2880 IITRAN 1969 pl 2881 Soulver 2005 editor 2882 Bayer Expressions 2018 dataNotation 2883 ed script 1973 diffFormat 2884 mawk 1991 pl 2885 Tefkat 2004 pl 2886 XMTC 1990 pl 2887 APE100 1995 pl 2888 BasicX 1998 pl 2889 RASP 1988 pl 2890 CaPSL 1989 pl 2891 CorbaScript 1998 pl 2892 RunRev 2003 pl 2893 Compact Application Solution Language 1997 pl 2894 FXScript 2002 pl 2895 ProSet 1990 pl 2896 Minilang 2016 interpreter 2897 20-GATE 1961 pl 2898 Citrine 2014 pl 2899 SMILES arbitrary target specification 1987 textDataFormat 2900 boa 2013 plzoo 2901 Entropy 2021 esolang 2902 Freefem 2000 pl 2903 Linked Markdown 2022 textMarkup 2904 Loom 1987 knowledgeBase 2905 o42a 2010 pl 2906 operon 2018 queryLanguage 2907 Planguage 2001 dataNotation 2908 ScriptEase 2001 pl 2909 Suneido 2000 pl 2910 whalecalf 2000 grammarLanguage 2911 Algae 1997 pl 2912 DAS 1962 pl 2913 g-expressions 2012 pl 2914 Metaweb Query Language 2006 queryLanguage 2915 Newton 1977 pl 2916 Pandora 1989 pl 2917 PSI 2013 pl 2918 Push 2001 pl 2919 rapidgen-rpl 1983 pl 2920 Spill 1997 pl 2921 xduce 2003 pl 2922 nirvana 2018 pl 2923 X-BASIC 1987 pl 2924 Xupdate 2000 pl 2925 Baby modula-3 1993 pl 2926 Hbasic 2007 pl 2927 Multi-user BASIC 1980 pl 2928 Firefox 2004 webBrowser 2929 WebKit 1998 browserEngine 2930 XGBoost 2014 library 2931 LSP 2016 protocol 2932 root-format 1994 binaryDataFormat 2933 DomainKeys Identified Mail 2004 standard 2934 GHC 1992 compiler 2935 JMAP 2019 protocol 2936 PSYCO 2007 grammarLanguage 2937 alfred 1972 pl 2938 Boost C++ libraries 1998 library 2939 Oracle Java 2010 pl 2940 ZIM Format 2009 binaryDataFormat 2941 Seph 2010 pl 2942 SpiderMonkey 1996 vm 2943 parquet 2014 binaryDataFormat 2944 Docker 2013 application 2945 Linoleum (L.in.oleum) 1996 pl 2946 GCC 1987 compiler 2947 GeoGebra 2001 application 2948 MathJax 2008 textMarkup 2949 GraphQL+- 2017 queryLanguage 2950 hackage-pm 2007 packageManager 2951 mockingbird-notation 1996 notation 2952 kernel 2009 pl 2953 Sourcetree 2010 application 2954 Abacus -2700 computingMachine 2955 ADS-B 2006 standard 2956 Attic numerals -600 numeralSystem 2957 Bit array 2004 dataStructure 2958 Fast Fourier Transform Equation 1965 equation 2959 Feynman diagram 1948 notation 2960 Greek numerals -300 numeralSystem 2961 Navier-Stokes Equation 1821 equation 2962 Pascal's calculator 1642 computingMachine 2963 Roman abacus -2700 computingMachine 2964 Roman numerals -900 numeralSystem 2965 ALOHAnet 1971 protocol 2966 CueCat 2000 barCodeFormat 2967 Etruscan numerals -700 numeralSystem 2968 Liber Abaci 1202 notation 2969 Visual J++ 1996 pl 2970 MonoDevelop 2003 editor 2971 Normal Distribution Equation 1823 equation 2972 Vienna Development Method Specification Language 1996 pl 2973 Address 1955 pl 2974 AFS 1982 filesystem 2975 Ampère's Circuital Equation 1961 equation 2976 Apple I 1976 computingMachine 2977 Atom 2014 editor 2978 Coulomb's Equation 1785 equation 2979 Steinberg Cubase 1989 application 2980 Faraday's Induction Equation 1831 equation 2981 Gauss Flux Formula 1773 equation 2982 Gauss Magnetism Formula 1773 equation 2983 Gecko 1997 browserEngine 2984 HCCB 2007 barCodeFormat 2985 HLASM 1992 assembly 2986 IMac 1998 computingMachine 2987 Ingres database 1974 database 2988 IPad 2010 computingMachine 2989 IPhone 2007 computingMachine 2990 IPv4 1984 protocol 2991 Language H 1962 pl 2992 MacBook Air 2008 computingMachine 2993 Macintosh 1984 computingMachine 2994 MP3 1993 binaryDataFormat 2995 OpenDoc 1993 protocol 2996 PL/I 1981 pl 2997 Price Equation 1967 equation 2998 Pythagorean Equation -570 equation 2999 Safari 2003 webBrowser 3000 Set-builder notation 1942 notation 3001 Sender Policy Framework 2000 standard 3002 Sprite Operating System 1984 os 3003 SYBYL line notation 1997 textDataFormat 3004 Wiswesser line notation 1949 textDataFormat 3005 Bayes' Equation 1763 equation 3006 Device independent file format 1982 binaryDataFormat 3007 Dot Product Equation 1773 equation 3008 Gravity Equation 1687 equation 3009 Information Theory Equation 1948 equation 3010 InterPlanetary File System 2015 protocol 3011 nroff 1972 textMarkup 3012 PHIGS 1988 library 3013 PNG 1996 binaryDataFormat 3014 QFX file format 1997 textDataFormat 3015 Razor 2010 template 3016 SK8 1988 pl 3017 SPARQCode 2010 barCodeFormat 3018 Superplan 1951 pl 3019 WATBOL 1969 compiler 3020 ALGOL X 1963 pl 3021 Energy Momentum Equation 1928 equation 3022 HEIC 2015 binaryDataFormat 3023 Lincos 1961 notation 3024 Molecular Query Language 2007 queryLanguage 3025 COM Structured Storage 2010 binaryDataFormat 3026 Advice Taker 1958 pl 3027 BBN-LISP 1960 pl 3028 Dendral 1965 application 3029 eqn 1974 textMarkup 3030 Euler's Equation 1748 equation 3031 GENSTAT 1968 application 3032 HyperFun 1999 pl 3033 Kyma 1986 pl 3034 Macintosh Common Lisp 1984 pl 3035 Object Definition Language 1991 pl 3036 ObjVlisp 1984 pl 3037 PM2 1989 pl 3038 Prolog++ 1994 pl 3039 RPG III 1968 pl 3040 Schoonschip 1963 pl 3041 SDF 1989 grammarLanguage 3042 Setun 1958 computingMachine 3043 SQUOZE 1958 binaryDataFormat 3044 STRINGCOMP 1967 pl 3045 FLANG 1988 pl 3046 General Activity Simulation Program 1961 pl 3047 Integral Equation 1888 equation 3048 Iota-and-jot 2001 esolang 3049 Little Smalltalk 1987 pl 3050 Optimization Programming Language 1999 pl 3051 Parasolid 2000 application 3052 RPG II 1965 pl 3053 Semi-Thue 1914 grammarLanguage 3054 SHRDLU 1968 application 3055 DAD 2015 pl 3056 Gofer 1994 pl 3057 Programming Language for the University of Maryland 1978 pl 3058 Interscript 1984 textMarkup 3059 ISO 8601 1988 standard 3060 Nyquist 1997 pl 3061 Rosetta-2 2006 pl 3062 Shared Dataspace Language 1988 pl 3063 Definite clause grammar 1980 grammarLanguage 3064 Language for Your Remote Instruction by Computer 1966 pl 3065 ZPL 1993 pl 3066 beagle 2019 pl 3067 draconian 2021 pl 3068 stringbean 2016 pl 3069 8th 2014 pl 3070 arvelie-format 2017 timeFormat 3071 Flare 2001 pl 3072 MINI OBJECT-ORIENTED LANGUAGE 2010 pl 3073 plasma 2015 pl 3074 RQL 2017 pl 3075 AArch64 2011 assembly 3076 CLASS 1970 pl 3077 Edison 1992 pl 3078 Electre 1983 pl 3079 EverParse3D 2022 idl 3080 GRIN 1977 pl 3081 guru 2009 pl 3082 iikuse 2010 esolang 3083 manticore 2009 pl 3084 Nelua 2019 pl 3085 PLEASE 1984 pl 3086 rbscript 1996 pl 3087 SBA 1977 pl 3088 SCAN 1987 pl 3089 sh 1971 pl 3090 Statement List 1993 assembly 3091 V 1997 pl 3092 WebAssembly Text Format 2015 pl 3093 XML Query Language 1998 queryLanguage 3094 xt3d 2000 grammarLanguage 3095 atx 2002 textMarkup 3096 w 2019 pl 3097 LOGIN 1986 pl 3098 Moby 1998 pl 3099 algobox 2011 pl 3100 COMSOL Script 1998 pl 3101 Nosica 2002 pl 3102 Bistro 1999 pl 3103 BitC 2004 pl 3104 Boxx 2002 pl 3105 Hyper Basic 1985 pl 3106 MetaL 2001 pl 3107 Monesa 2002 pl 3108 Tibbo BASIC 2000 pl 3109 TouchDevelop 2012 pl 3110 UJML 2000 pl 3111 WinDev 1993 pl 3112 Wlanguage 1992 pl 3113 XProfan 1990 pl 3114 Bigwig Programming Language 1998 pl 3115 Deesel 2005 pl 3116 Timber 1999 pl 3117 Micro-PROLOG 1980 pl 3118 Scieneer Common Lisp 2002 pl 3119 Superx++ 2001 pl 3120 CHAIN 1981 pl 3121 Escapade 1977 pl 3122 Izibasic 2004 pl 3123 M 2008 pl 3124 Mocklisp 1981 pl 3125 Moonrock Basic Compiler 1994 pl 3126 Omikron BASIC 1985 pl 3127 PROC procedure language 1986 pl 3128 Bon 1967 pl 3129 Marmot 2000 pl 3130 Portal langage 1978 pl 3131 PowerLanguage 1997 pl 3132 HTTP/3 2018 protocol 3133 MUSP 1960 pl 3134 NGL 2001 pl 3135 Klerer-May System 1964 pl 3136 Legal Knowledge Interchange Format 2007 xmlFormat 3137 OPL 1989 pl 3138 iScript 2008 pl 3139 SIMAN 1983 pl 3140 clox 2020 pl 3141 rlox 2004 pl 3142 Biological Expression Language 2003 textDataFormat 3143 converge 2004 pl 3144 datev 2017 pl 3145 dynamo-pm 2013 packageManager 3146 eta 2017 pl 3147 foundry 2013 pl 3148 grain 2017 pl 3149 habit 2016 pl 3150 liquidity 2017 pl 3151 mypy 2012 pl 3152 NumPad 2022 editor 3153 package-control-pm 2014 packageManager 3154 shakti 2019 pl 3155 tablatal 2017 pl 3156 arrow 2015 pl 3157 axt-format 2004 textDataFormat 3158 Browser Extensible Data Format 2004 textDataFormat 3159 DUEL 1993 pl 3160 EQS 1978 pl 3161 EZ 1984 pl 3162 Interleaved Notation 2022 pl 3163 OASIS 1994 pl 3164 PAMELA 1992 pl 3165 RAISE Specification Language 1992 pl 3166 School 1990 pl 3167 SNQL: A Social Network Query and Transformation Language 2011 queryLanguage 3168 System V ABI 1983 binaryExecutable 3169 Titanium 1998 pl 3170 SDMS 2001 pl 3171 shml 2015 textMarkup 3172 sentient 2016 pl 3173 squiggle 2015 pl 3174 shill 2014 pl 3175 IT 1955 pl 3176 calc 2013 plzoo 3177 clojars-pm 2009 packageManager 3178 cocoapods-pm 2011 packageManager 3179 cpan-pm 1995 packageManager 3180 crates-pm 2014 packageManager 3181 ctan-pm 1998 packageManager 3182 dio 2020 pl 3183 enso 2011 pl 3184 Extempore 2011 pl 3185 goose 2018 pl 3186 grunt 2011 library 3187 imp-lang 2019 pl 3188 JMESPath 2013 pl 3189 kilo-lisp 2019 pl 3190 lasp 2015 pl 3191 Leazy 1990 compiler 3192 melpha-pm 2014 packageManager 3193 Omega 2019 pl 3194 pgql 2016 pl 3195 PickCode 2021 visual 3196 plink-bed-format 2007 binaryDataFormat 3197 plumb 2014 pl 3198 powershell-gallery-pm 2014 packageManager 3199 PSeInt 2003 pl 3200 robotc 2005 pl 3201 sdf-format 2012 xmlFormat 3202 skew 2015 pl 3203 smalltalkhub-pm 2011 packageManager 3204 souffle 2019 pl 3205 spark-pm 2014 packageManager 3206 statebox 2008 visual 3207 versioned-text-markup-language 1999 textMarkup 3208 ABEL 1979 pl 3209 Afnix 2003 pl 3210 BOLT 1981 pl 3211 CCS 1999 pl 3212 Chimera 1994 pl 3213 Descartes 1983 pl 3214 DINO 1990 pl 3215 DLP 1992 pl 3216 HScript 1996 pl 3217 Lila 2017 pl 3218 Lorel 1996 queryLanguage 3219 MDL 1992 pl 3220 PAISley 1982 pl 3221 Relational Data File 1965 queryLanguage 3222 Ruri 2000 pl 3223 SCROLL 1970 pl 3224 SquidConf 1996 configFormat 3225 Timeless Instruction Set (TL ISA) 2022 isa 3226 UnQL 2000 queryLanguage 3227 WATFOR 1966 pl 3228 Wikitax 2002 wikiMarkup 3229 unlws 2010 notation 3230 WebStorm 2010 editor 3231 Floral 2020 pl 3232 REC Studio 2010 decompiler 3233 thune 2014 pl 3234 BIPLAN 2017 pl 3235 bytecode-modeling-language 2008 bytecode 3236 coi-protocol 2019 protocol 3237 Datalisp 2020 pl 3238 iqr 1994 barCodeFormat 3239 jedit-editor 1998 editor 3240 lunar 2017 pl 3241 marten 1980 visual 3242 Nova 2019 editor 3243 PhpStorm 2011 editor 3244 Plush 2017 pl 3245 resharper-editor 2004 editor 3246 rider-editor 2017 editor 3247 stx 1999 pl 3248 tetruss-app 1996 application 3249 unicon-adl 1996 pl 3250 Vortex 2020 pl 3251 aubit-4gl 2001 pl 3252 AUR 2015 packageManager 3253 bscript-interpreter 1999 interpreter 3254 BScript 1999 pl 3255 chicken-lang 2013 esolang 3256 cixl 2018 pl 3257 clickpath 2011 queryLanguage 3258 Coral 2017 pl 3259 domino 1989 pl 3260 frtime 2004 pl 3261 hac 2007 pl 3262 hsaml-format 2013 xmlFormat 3263 Imandra Protocol Language 2017 pl 3264 klisp 1958 pl 3265 kvsapi 2019 standard 3266 Lanai 2016 isa 3267 lazarus-editor 2012 editor 3268 listdown 2017 textMarkup 3269 Mascara 2009 pl 3270 Multihash 2017 hashFunction 3271 paperalgo 2014 notation 3272 powerloom-knowledgeBase 1999 knowledgeBase 3273 quicksight-app 2015 application 3274 rlmeta 2018 grammarLanguage 3275 tab 2015 pl 3276 tarot 2017 compiler 3277 teal 1987 pl 3278 underlay 2018 protocol 3279 Vim Scripts 2001 packageManager 3280 Visual Studio Marketplace 2015 packageManager 3281 yinyang 2013 pl 3282 Arturo 2019 pl 3283 BRL 1997 pl 3284 business-rule-language 2012 pl 3285 bx 1990 pl 3286 Cheri 2010 isa 3287 ctalk 2006 pl 3288 dec64 2009 numeralSystem 3289 gemini-protocol 2020 protocol 3290 Gnome Basic 1999 pl 3291 google-data-studio-app 2016 application 3292 General purpose 2015 pl 3293 helium 2003 pl 3294 holonforth 1989 pl 3295 JuliaHub Packages 2014 packageManager 3296 MathWorks File Exchange 1997 packageManager 3297 miso-framework 2016 framework 3298 objective-modula-2 2009 pl 3299 qbe 2015 pl 3300 Radish 2022 pl 3301 readable-lisp 2013 pl 3302 redpanda-app 2009 application 3303 rhoscript 2013 pl 3304 ruby-mine-editor 2008 editor 3305 sharpscript 2019 pl 3306 sierra 2018 pl 3307 tengo 2019 pl 3308 tinygo-compiler 2018 compiler 3309 Lambda Diagrams 2014 notation 3310 uml2-sp 2018 pl 3311 Wolfram Data Framework 2014 dataNotation 3312 atomo 2010 pl 3313 B3 IR 2016 ir 3314 blank 2018 esolang 3315 Blueprints 2014 visual 3316 C^3 2009 pl 3317 c-smile 2002 pl 3318 calc_var 2013 plzoo 3319 chaos-lang 2020 pl 3320 Cobol.NET 2002 pl 3321 coffeepp 2017 pl 3322 Conan Center 2016 packageManager 3323 dart-pm 2011 packageManager 3324 dfns 2014 pl 3325 dss 2018 pl 3326 Elm Packages 2012 packageManager 3327 emu 2019 pl 3328 fmj 2003 pl 3329 Genshi Text 2020 pl 3330 GNU Linear Programming Kit 2000 library 3331 High-Level Virtual Machine 2009 vm 3332 Kefir 2021 compiler 3333 klong 2015 pl 3334 kogut 2004 pl 3335 koi 2010 pl 3336 lllpg 2012 library 3337 Maven Central Repository 2018 packageManager 3338 minihaskell 2013 plzoo 3339 miniprolog 2013 plzoo 3340 mir 2015 ir 3341 mlite 2004 pl 3342 Optimized Row Columnar 2016 binaryDataFormat 3343 piccola 2002 pl 3344 Pursuit PureScript Package Repository 2014 packageManager 3345 pyke 2008 knowledgeBase 3346 Python Format Specification 2008 template 3347 ra 2015 pl 3348 raco-pm 2012 packageManager 3349 redscript 2013 pl 3350 retroforth 2000 pl 3351 rsharp 2003 pl 3352 scopes 2016 pl 3353 shade 2012 pl 3354 skookumscript 2004 pl 3355 SmartGameFormat 1987 pl 3356 SNBT 2011 pl 3357 solaris-pm 2004 packageManager 3358 SOQL 2006 queryLanguage 3359 sub 2013 plzoo 3360 tern 2019 pl 3361 terse 1986 assembly 3362 tetra 2017 pl 3363 texpr 2013 pl 3364 thorn 2014 pl 3365 tilton 2000 pl 3366 typedefs 2017 grammarLanguage 3367 Zoem 2005 pl 3368 AIR 2016 ir 3369 BUSH 2002 pl 3370 chirp 2008 visual 3371 cloe 2018 pl 3372 comm 2013 plzoo 3373 CorelScript 1994 pl 3374 crack 2011 pl 3375 cran-pm 1993 packageManager 3376 Descript 2018 pl 3377 D++ 1999 pl 3378 DRAGOON 1989 pl 3379 Emacs Lisp Package Archive 2016 packageManager 3380 envoy-app 2017 application 3381 flux-lang 2006 pl 3382 forthnet-pm 2010 packageManager 3383 fox 2017 pl 3384 GSQL 2015 pl 3385 Hex-Rays 2005 decompiler 3386 JSGF 1998 pl 3387 lambda 2013 plzoo 3388 levy 2013 plzoo 3389 loglo 2020 pl 3390 Maplesoft Application Center 2004 packageManager 3391 miniml 2013 plzoo 3392 New AWK 1993 pl 3393 nimble-pm 2016 packageManager 3394 oforth 2009 pl 3395 Ordered graph data language 2002 textDataFormat 3396 orca-lang 2014 pl 3397 polly 2016 template 3398 poly 2013 plzoo 3399 popcorn-linux 1994 os 3400 PyPI 2015 packageManager 3401 raptor 2015 visual 3402 Restricted Python 2007 pl 3403 sepi 2012 pl 3404 slim-pl 1999 pl 3405 SOSL 2006 queryLanguage 3406 Boston College Statistical Software Components 1996 packageManager 3407 subscript 2012 pl 3408 Table Query Language 1997 queryLanguage 3409 toadskin 2003 esolang 3410 TWiki 1998 wikiMarkup 3411 ugnis 2017 pl 3412 Visual Logic 2005 visual 3413 woofjs 2016 pl 3414 xmpp-protocol 2003 protocol 3415 Xoc 2008 compiler 3416 angr 2015 decompiler 3417 antha 2014 pl 3418 arend 2019 pl 3419 Apache Arrow 2016 binaryDataFormat 3420 Binary Ninja 2015 decompiler 3421 bjou 2019 pl 3422 charly 2017 pl 3423 circa 2012 pl 3424 cleanlang 2017 pl 3425 cx 2015 pl 3426 edgeql 2017 queryLanguage 3427 Elpi 2014 pl 3428 eno 2018 pl 3429 ForgeBox 2015 packageManager 3430 Ghidra 2019 decompiler 3431 glitch-editor 2017 editor 3432 GNS 2018 protocol 3433 Header Dictionary Triples 2012 binaryDataFormat 3434 helena 2017 pl 3435 hello 2015 pl 3436 Hilltop 2018 pl 3437 joker 2018 pl 3438 kate-editor 2000 editor 3439 kima 2018 pl 3440 l 2013 pl 3441 min 2017 pl 3442 neovim-editor 2015 editor 3443 neralie-format 2017 timeFormat 3444 none 2015 pl 3445 onex 2014 application 3446 OpenSpice 2005 pl 3447 par 2018 pl 3448 pisc 2017 pl 3449 plink-bim-format 2007 textDataFormat 3450 plink-fam-format 2007 textDataFormat 3451 potential 2010 pl 3452 prodel 2014 pl 3453 Sather-K 1995 pl 3454 The Synthetic Biology Open Language 2010 xmlFormat 3455 simit 2016 pl 3456 Smithy 2016 pl 3457 socialite 2015 pl 3458 syndicate 2016 pl 3459 Tea 2019 library 3460 Typst 2022 textMarkup 3461 urn 2017 pl 3462 bag-format 2010 binaryDataFormat 3463 C∀ 2018 pl 3464 chartio-app 2010 application 3465 chocolatey-pm 2011 packageManager 3466 Clausal Language 1997 pl 3467 ctr 2017 pl 3468 darklang 2019 pl 3469 Dimensional Script 2012 notation 3470 Fawlty 2006 pl 3471 goby 2017 pl 3472 Hex 2014 packageManager 3473 juttle 2014 pl 3474 kayia 1999 pl 3475 ki 2014 pl 3476 libsvm-format 2011 textDataFormat 3477 luarocks-pm 2007 packageManager 3478 mathematica-packagedata-pm 2015 packageManager 3479 Mathpix Markdown 2019 textMarkup 3480 merd 2002 pl 3481 morfa 2015 pl 3482 nectar 2016 pl 3483 np 2013 pl 3484 NU-Prolog 1988 pl 3485 PacmanConf 2019 configFormat 3486 panther-lang 2010 pl 3487 paxScript 2011 pl 3488 PkgConfig 2000 configFormat 3489 pliant 1999 pl 3490 plink-map-format 2007 textDataFormat 3491 Simkin 1995 pl 3492 singular 1987 pl 3493 soul 2000 queryLanguage 3494 T3X 1995 pl 3495 tiddler 2004 pl 3496 Alma 1997 pl 3497 AlpHard 1996 pl 3498 COPE 1977 pl 3499 cT 1989 pl 3500 EDUCE 1986 pl 3501 gnu-rtl 1987 ir 3502 INQUIRE 1969 queryLanguage 3503 McLeyvier Command Language 1982 pl 3504 Modified Integration Digital Analog Simulator 1963 pl 3505 O++ 1989 pl 3506 order 2003 pl 3507 Perfectscript 1995 pl 3508 PO 2000 pl 3509 PROSPER 1989 pl 3510 Sapphire 1995 pl 3511 SHADOW 1958 pl 3512 SHEEP 1978 pl 3513 SLANG 1960 pl 3514 UnQL 2011 queryLanguage 3515 WebGPU Shading Language 2020 pl 3516 XE 1988 pl 3517 XQL 1998 queryLanguage 3518 BEAM Bytecode 2017 bytecode 3519 Vienna Definition Language 1965 pl 3520 CDL 1995 pl 3521 FORTRAN 77 1977 pl 3522 Snit 2002 pl 3523 Cish 2022 pl 3524 SNOBOL3 1966 pl 3525 Zeta 2008 pl 3526 ACCENT 1990 pl 3527 Argos 1992 pl 3528 BABEL 1990 pl 3529 BridgeTalk 1987 pl 3530 Combined Log Format 2002 textDataFormat 3531 DDF 2016 dataNotation 3532 DEMETER 1995 pl 3533 Dribble 2003 pl 3534 ETC 1971 pl 3535 Fable 1983 pl 3536 Friendly Enough Expression Language 2015 queryLanguage 3537 Generic Expression Language 2008 textMarkup 3538 GLOSS 1971 pl 3539 Herbrand 1995 pl 3540 JACL 1997 pl 3541 KB 1990 pl 3542 LESK 1975 pl 3543 Lighttpd configuration file 2003 configFormat 3544 Lisp Object-Oriented Programming System 1983 pl 3545 MADCAP VI 1972 pl 3546 MENDEL 1985 pl 3547 nML 1991 pl 3548 Patchwork 1996 pl 3549 PLAN2D 1976 pl 3550 Pluk 1995 pl 3551 Prolog Pack 2012 packageManager 3552 RLISP 1970 pl 3553 ROS Message 2010 idl 3554 SMDL 1991 pl 3555 SoQL 2009 queryLanguage 3556 Statemate 1998 pl 3557 Tick C 1997 pl 3558 Tiki Wiki Markup 2002 wikiMarkup 3559 topaz 2011 pl 3560 torchscript 2018 pl 3561 Tutorial D 1994 queryLanguage 3562 AMTRAN 1966 pl 3563 ANNA 1987 pl 3564 APL-GPSS 1988 pl 3565 aQasm 2017 assembly 3566 Arc Assembly 1947 assembly 3567 bawk 1994 pl 3568 Binary Equation 1689 equation 3569 BIRD 2021 pl 3570 CDL++ 1999 pl 3571 CMIX 1980 pl 3572 COMMEN 1967 pl 3573 cooC 2000 pl 3574 TypeScript Type Declarations 2012 headerLang 3575 EXPLAN 1994 pl 3576 EXPLOR 1972 pl 3577 FORTRAN assembly program 1959 assembly 3578 FAR 2000 pl 3579 flowlog 2014 pl 3580 Giotto 2001 pl 3581 Hadoop Distributed File System 2011 filesystem 3582 Heron 2008 pl 3583 IBEX 2002 pl 3584 IFO 1987 pl 3585 Knowledge Acquisition and Representation Language 1993 pl 3586 L6 1963 pl 3587 LISP 1.5 1959 pl 3588 Lorel 1974 pl 3589 MAPS 1993 pl 3590 MOOSE 1994 pl 3591 MSL 1977 pl 3592 NAKL 1982 pl 3593 NODAL 1972 pl 3594 o2 1989 pl 3595 OOPS+ 1988 pl 3596 PACTOLUS 1964 pl 3597 Pascal-XSC 1991 pl 3598 Petr 1999 pl 3599 PopAsm 2003 pl 3600 PUFFT 1965 pl 3601 quexal 2007 esolang 3602 RATSNO 1977 pl 3603 Rapid Development and Maintenance Language 2005 pl 3604 rds-format 2011 binaryDataFormat 3605 Real-Time Concurrent C 1991 pl 3606 Real-Time Mentat 1989 pl 3607 Regina 2001 pl 3608 REGULUS 1977 pl 3609 RPL 1988 queryLanguage 3610 RPT 1961 pl 3611 Rosetta SMALLTALK 1979 pl 3612 S-Snobol 1978 pl 3613 SHOE 2000 pl 3614 SIL 1990 pl 3615 sina 1989 pl 3616 Smalltalk YX 2007 pl 3617 SMOKE 1992 pl 3618 Snostorm 1984 pl 3619 SQLMP 1991 pl 3620 SSL 1994 protocol 3621 STOICAL 2000 pl 3622 TAO 1983 pl 3623 Verse 2022 pl 3624 Water 2002 template 3625 xs 2019 pl 3626 appcode-editor 2016 editor 3627 brackets-editor 2012 editor 3628 clion-editor 2015 editor 3629 code-blocks-editor 2005 editor 3630 codelite-editor 2006 editor 3631 Schrödinger's Equation 1925 equation 3632 synergist 1986 pl 3633 uscript 2016 notation 3634 uscript2 2018 notation 3635 2lisp 1982 pl 3636 arbortext-command-language 2009 pl 3637 Argon 2022 pl 3638 chappe-code 1792 notation 3639 concordance 1994 pl 3640 CSV++ 2016 dataNotation 3641 gedit-editor 1999 editor 3642 Imaginary Number Equation 1572 equation 3643 intellijidea-editor 2001 editor 3644 komodo-editor 2007 editor 3645 pycharm-editor 2016 editor 3646 runescript 2001 pl 3647 sugarj 2012 grammarLanguage 3648 TeaSharp 2022 pl 3649 ACSI-Matic 1959 pl 3650 adam-standard 2009 standard 3651 ALEPH 1992 pl 3652 ALGOL 68-RT 1979 pl 3653 ALJABR 1991 pl 3654 Altibase 1999 database 3655 amalthea 2002 pl 3656 Amazon DynamoDB 2012 database 3657 Amazon RDS 2009 database 3658 AMTRAN 70 1969 pl 3659 Apache Derby 2004 database 3660 Apache Phoenix 2014 database 3661 APLO 1989 pl 3662 ArangoDB 2011 database 3663 ARTA 1970 pl 3664 AUTOCODER II 1958 assembly 3665 BeeBasic 2013 pl 3666 BER 1988 pl 3667 BullFrog 2005 esolang 3668 Celsius WebScript 2006 pl 3669 Cigale 1986 pl 3670 COGO 1962 pl 3671 concept-script 1879 notation 3672 ConCurr 1979 pl 3673 Couchbase Mobile 2010 database 3674 Couchbase 2011 database 3675 Cymbal 1999 pl 3676 Decision Model & Notation 2015 notation 3677 DinnerBell 1990 pl 3678 EqL 1989 pl 3679 EXAPT 1967 pl 3680 Firebase Realtime Database 2011 database 3681 Google Cloud SQL 2011 database 3682 Greenplum 2005 database 3683 IBM DB2 1983 database 3684 InfluxDB 2013 database 3685 InterBase 1985 database 3686 InterSystems Caché 1997 database 3687 ji 2019 pl 3688 kernel-e 1994 pl 3689 MariaDB ColumnStore 2016 database 3690 MarkLogic 2001 database 3691 Memcached 2003 database 3692 Microsoft Access 1992 database 3693 Microsoft Azure Cosmos DB 2017 database 3694 Microsoft SQL Server 1989 database 3695 MODEL-K 1993 pl 3696 Mushroom 1988 pl 3697 NEBULA 1960 pl 3698 Neo4j 2007 database 3699 oniguruma 2002 queryLanguage 3700 Oracle 1979 database 3701 OrientDB 2010 database 3702 PCLOS 1993 pl 3703 Pearson correlation coefficient equation 1880 equation 3704 PGen 2015 grammarLanguage 3705 IBM Programming Language/Advanced Systems 1976 pl 3706 SAP HANA 2010 database 3707 SCAT 1957 assembly 3708 SimpleScript 2013 pl 3709 Socrata Query Language 2012 queryLanguage 3710 sourcelair-editor 2011 editor 3711 status-quo-script 2001 pl 3712 SW2 1986 pl 3713 SYNGLISH 1980 pl 3714 SYNPROC 1970 pl 3715 SYNTOL 1960 pl 3716 TABLOG 1984 pl 3717 TABSOL 1960 pl 3718 TABTRAN 1967 pl 3719 TAC 1959 pl 3720 Tarmac 1990 pl 3721 Taxis 1980 pl 3722 tcc 1997 pl 3723 TCOZ 2002 pl 3724 TCSP 1995 pl 3725 TDFL 1990 pl 3726 TDMS 1970 pl 3727 telefile-assembly 1952 assembly 3728 TELSIM 1966 pl 3729 Templar 1993 pl 3730 Temporal Prolog 1983 pl 3731 Teradata Aster 2005 database 3732 Teradata 1979 database 3733 TFL 1996 pl 3734 The Message System 1967 pl 3735 THREADED LISTS 1959 pl 3736 TICS 1973 pl 3737 TiDB 2015 database 3738 Timed CSP 1986 pl 3739 Tinkertoy 1988 pl 3740 TOOLBUS 1998 pl 3741 TPDL* 1991 pl 3742 Trafola-H 1991 pl 3743 Traits 1982 pl 3744 TRAMP 1968 pl 3745 TRANQUIL 1966 pl 3746 Transforma 1985 pl 3747 TREET 1964 pl 3748 triroff 1983 pl 3749 TSL 1985 pl 3750 TSQL2 1996 pl 3751 Turing Plus 1987 pl 3752 turnstile-plus 2020 grammarLanguage 3753 Tyco 1998 pl 3754 TyRuBa 1998 pl 3755 U-Datalog 1997 pl 3756 UAN 1990 pl 3757 UberScript 2011 pl 3758 Ubik 2000 pl 3759 UFL 1986 pl 3760 UFO 1992 pl 3761 UMTA 1974 pl 3762 UNICORN 1986 pl 3763 UNISIM 1964 pl 3764 UNRAVEL 1973 pl 3765 USSA 1992 pl 3766 Utopia 84 1979 pl 3767 V-Promela 1999 pl 3768 VAL II 1983 pl 3769 VARLIST 1975 pl 3770 Vector PASCAL 1998 pl 3771 VENUS 1967 pl 3772 Vienna Fortran 1992 pl 3773 VIPTRAN 1973 pl 3774 Viron 1983 pl 3775 VisaVis 1994 pl 3776 Visual Eiffel 1993 pl 3777 Visual Occam 1997 pl 3778 VIVA 1990 pl 3779 viz 1990 pl 3780 VPL 1991 pl 3781 VSPL 2000 pl 3782 VULCAN 1987 pl 3783 WCL 1991 pl 3784 WebL 2000 pl 3785 Whirlwind 1951 pl 3786 WRITEACOURSE 1968 pl 3787 WYLBUR 1973 pl 3788 X-KLAIM 2000 pl 3789 X11-Basic 1991 pl 3790 xADL 2000 pl 3791 XCY 1980 pl 3792 XML-GL 1998 queryLanguage 3793 The Algebra 2001 grammarLanguage 3794 XPOP 1964 pl 3795 XSIM 1977 pl 3796 XTRAN 1958 pl 3797 YugabyteDB 2018 database 3798 ZCCS 1997 pl 3799 ZGRASS 1978 pl 3800 1.pak 1973 pl 3801 2OBJ 1995 pl 3802 3-LISP 1982 pl 3803 3DComposer 1999 pl 3804 3RIP 1977 pl 3805 ABAL 1974 pl 3806 ABCL/c+ 1988 pl 3807 ABCL/f 1994 pl 3808 ABC++ 1994 pl 3809 Abstracto 1979 pl 3810 AC Toolbox 1992 pl 3811 ACL 1972 pl 3812 Acore 1988 pl 3813 ACORN 1990 pl 3814 ACOS 1988 pl 3815 ACSL 1979 pl 3816 ACT ONE 1983 pl 3817 Actalk 1989 pl 3818 Active Language I 1963 pl 3819 Active-U-Datalog 1997 pl 3820 Actus 1979 pl 3821 Ada 95 1995 pl 3822 Ada 9X 1988 pl 3823 Ada/TL 1990 pl 3824 ADABTPL 1987 pl 3825 Adagio 2007 pl 3826 Adaplex 1983 pl 3827 Aditi 1992 pl 3828 AED 1963 pl 3829 AEPL 1971 pl 3830 AESOP 1967 pl 3831 Agent-K 1994 pl 3832 AGL 1975 pl 3833 AIDA 1986 pl 3834 AKL 1991 pl 3835 ALADIN 1971 pl 3836 Alambik 2011 pl 3837 ALBA 1993 pl 3838 Aldat 1989 pl 3839 Aldwych 2000 pl 3840 ALEC 1967 pl 3841 Algebraic Compiler 1958 pl 3842 ALGEM 1966 pl 3843 ALGERNON 1990 pl 3844 ALGOL-E 1972 pl 3845 ALGY 1961 pl 3846 Alma-O 1998 pl 3847 ALMIR 1968 pl 3848 Alonzo 1994 pl 3849 AlphaPop 1986 pl 3850 ALTAC 1959 pl 3851 Amanda 1988 pl 3852 AMBIT/G 1968 pl 3853 AMBIT/L 1970 pl 3854 AMPPL-II 1969 pl 3855 Andorra 1988 pl 3856 arezzo-notation 1033 musicalNotation 3857 AUTOCODER III 1958 assembly 3858 axcess 1983 pl 3859 Bison++ 1998 grammarLanguage 3860 Blade 2022 pl 3861 Bolin 2022 pl 3862 brooks-programming-language 2003 pl 3863 Candy Codes 2022 barCodeFormat 3864 Cedar 1983 pl 3865 checkout 2011 assembly 3866 Chicon 1998 pl 3867 CONA 1977 pl 3868 Cosmos 2022 pl 3869 CVL 1993 pl 3870 dalvik-bytecode 2008 bytecode 3871 Data Package 2007 jsonFormat 3872 Distributed Smalltalk 1980 pl 3873 DM-1 1967 pl 3874 dsym 2011 binaryDataFormat 3875 ebg 1999 pl 3876 Elasticsearch Query DSL 2010 queryLanguage 3877 english-programming-language 1973 pl 3878 ESP 1983 pl 3879 EXTRAN 1978 pl 3880 filetab-d 1978 pl 3881 floorplan 2019 pl 3882 forest-database 2011 application 3883 FORTRAN III 1958 pl 3884 FORTRAN IV 1962 pl 3885 GAEA 1998 pl 3886 Gaiman 2022 pl 3887 hackppl 2019 pl 3888 HAYSTAQ 1959 queryLanguage 3889 honu 2012 pl 3890 ibm-system-38-language 1978 pl 3891 iota 1985 pl 3892 Just 2021 pl 3893 kaukatcr 2018 pl 3894 Konna 2021 pl 3895 lambda-obliv 2020 pl 3896 LinkText 2022 pl 3897 Low Level Lisp 2014 pl 3898 local 2019 pl 3899 metalex 2002 xmlFormat 3900 microPLANNER 1970 pl 3901 modl 1987 pl 3902 N 1990 pl 3903 Noms GraphQL 2017 queryLanguage 3904 NJCL 1974 pl 3905 Navigational User's Language 1976 pl 3906 OMNITAB II 1970 pl 3907 OMNITAB 1963 pl 3908 Oxide 2021 pl 3909 Parse Tree Notation 1994 grammarLanguage 3910 Pegasus AUTOCODE 1959 pl 3911 Peridot 2022 pl 3912 PL/S-II 1974 pl 3913 PL/S 1968 pl 3914 PL-X 1994 pl 3915 Pλ⍵NK 2020 pl 3916 Protosynthex 1964 pl 3917 Pygmalion 1974 visual 3918 QUIKTRAN 1964 pl 3919 RAND-ABEL 1990 pl 3920 RAPIDWRITE 1962 pl 3921 SALE 1959 pl 3922 SAUSTALL 1982 pl 3923 shiv 2018 pl 3924 Simple Stackless Lisp 2022 pl 3925 Siri 1991 pl 3926 sqlite-storage-format 2000 binaryDataFormat 3927 Sue 1971 pl 3928 SUMMER 1980 pl 3929 SuperForth 2022 pl 3930 SUPERMAC 1979 pl 3931 SVL 1994 pl 3932 SYMBAL 1972 pl 3933 SymbMath 1999 pl 3934 SYNTEX 1972 pl 3935 TACTICS 1972 pl 3936 TALE 1986 pl 3937 TALL 1962 pl 3938 TeLa 2000 pl 3939 TEMPO 1995 pl 3940 TOMAL 1975 pl 3941 TRACE 1967 pl 3942 TRANSCODE 1953 pl 3943 TRANSLANG 1970 pl 3944 TRIO 1990 pl 3945 TRIPLE 2002 pl 3946 TS 1988 pl 3947 TWO-D 1971 pl 3948 twoducks 2006 esolang 3949 UC 1995 pl 3950 VEX 1995 notation 3951 Visual 2000 pl 3952 WIZOR 1962 pl 3953 Xmind Format 2007 xmlFormat 3954 ycp 2005 pl 3955 yoga 2020 pl 3956 Zed 1978 pl 3957 zish 2017 dataNotation 3958 A51 Assembly 1988 assembly 3959 Aardappel 1997 pl 3960 ABC ALGOL 1973 pl 3961 Actors 1971 pl 3962 ADES II 1955 pl 3963 ADES 1955 pl 3964 ADLIB 1980 pl 3965 AIDS 1970 pl 3966 ALDES 1976 pl 3967 ALLO 1995 pl 3968 ALPS 1988 pl 3969 Amber 1984 pl 3970 AMBUSH 1971 pl 3971 AMPPL-I 1968 pl 3972 Amulet 1996 pl 3973 And/Or 1980 pl 3974 Andante 1980 pl 3975 Andorra-I 1991 pl 3976 ANS MUMPS 1977 pl 3977 ANSI BASIC 1980 pl 3978 APAR 1958 pl 3979 APAREL 1969 pl 3980 APL/Z80 1979 pl 3981 APLGOL-2 1973 pl 3982 APLGOL 1972 pl 3983 APOSTLE 1996 pl 3984 APPL/A 1995 pl 3985 APPLOG 1986 pl 3986 APROL 1998 pl 3987 AQL 1977 pl 3988 Aquarius Prolog 1989 pl 3989 ARABLAN 1995 pl 3990 ARCHI 1986 pl 3991 Arjuna 1989 pl 3992 ARK 2002 pl 3993 Armani 1999 pl 3994 ASF+SDF 1993 pl 3995 ASPEN 1977 pl 3996 associons 1972 pl 3997 Asspegique 1985 pl 3998 ASTLOG 1997 pl 3999 ATOL 1979 pl 4000 AUTASIM 1974 pl 4001 AUTODRAFT 1965 pl 4002 AUTOGRP 1972 pl 4003 AUTOMAST 1966 pl 4004 Avalon/Common LISP 1990 pl 4005 B4Tran 1975 pl 4006 BALG 1975 pl 4007 BALM 1969 pl 4008 BALSA 1998 pl 4009 Baltík 1996 pl 4010 Bartok 2001 pl 4011 Basic PDP-1 Lisp 1963 pl 4012 BASIL 1979 pl 4013 BC NELIAC 1962 pl 4014 BDL 1987 pl 4015 BEDSOCS 1973 pl 4016 BESYS 1958 pl 4017 Beta-Prolog 1992 pl 4018 BGRAF2 1975 pl 4019 BHSL 1966 pl 4020 Bigloo 1995 pl 4021 BIOMOD 1970 pl 4022 BIOSSIM 1978 pl 4023 BLAZE 1985 pl 4024 BLOOMS 1997 pl 4025 BMD 1961 pl 4026 Bob 1991 pl 4027 BOIL 1998 pl 4028 Booster 1989 pl 4029 Borneo 1998 pl 4030 Bounce 1994 pl 4031 Boxer 1985 pl 4032 BPL 1978 pl 4033 Basic Petri Net Programming Notation 1992 pl 4034 Brisk 1995 pl 4035 BSML 1996 pl 4036 BSP 1989 pl 4037 BUGSYS 1964 pl 4038 Butterfly Common LISP 1993 pl 4039 ByteLisp 1965 pl 4040 C Header Files 1972 headerLang 4041 CABAL 1997 pl 4042 Cactus 1998 pl 4043 cado-systems-technical-information 1973 pl 4044 CAGES 1973 pl 4045 CAISYS 1973 pl 4046 CAMAC 1979 pl 4047 CAMIL 1978 pl 4048 Cantor 1987 pl 4049 Common Authentication Protocol Specification Language 1996 pl 4050 Capsule 1981 pl 4051 CASSANDRE 1967 pl 4052 Catalysis 1998 pl 4053 CAYLEY 1975 pl 4054 CCEL 1993 pl 4055 Cedar Fortran 1984 pl 4056 CELIP 1990 pl 4057 CELLSIM 1973 pl 4058 Ceprol 1985 pl 4059 CHAMP 1968 pl 4060 CHARM++ 1993 pl 4061 Charrette Ada 1980 pl 4062 CHARYBDIS 1967 pl 4063 ChemTrains 1992 pl 4064 Chronolog 1985 pl 4065 ChronologMC 1996 pl 4066 ChronologZ 1993 pl 4067 cimfast 1991 pl 4068 CIMS PL/I 1970 pl 4069 CL-I 1960 pl 4070 Clascal 1983 pl 4071 Classic-Ada 1992 pl 4072 Clear Language for Expressing Orders 1963 pl 4073 CLeogo 1998 pl 4074 CLEOPATRA 1973 pl 4075 CLOVER 1996 pl 4076 CLP* 1989 pl 4077 CMN 1990 pl 4078 COBLOC 1964 pl 4079 CODIL 1970 pl 4080 CogMap 1992 pl 4081 COLASL 1962 pl 4082 COLD-K 1989 pl 4083 Complex-Prolog 1989 pl 4084 Computer Compiler 1969 pl 4085 COMSL 1970 pl 4086 ConC 1991 pl 4087 Concert/C 1993 pl 4088 CONCUR 1981 pl 4089 Concurrent Pascal 1972 pl 4090 conGolog 1994 pl 4091 ConMan 1988 pl 4092 CONNIVER 1973 pl 4093 ConstraintLisp 1992 pl 4094 CONTRANS 1960 pl 4095 COPAS 1981 pl 4096 CORAL 64 1964 pl 4097 Coral++ 1993 pl 4098 CORC 1963 pl 4099 CosmicOS 2000 pl 4100 COSMO 2001 pl 4101 CQLF 1982 pl 4102 CQL++ 1992 pl 4103 CSMP 1965 pl 4104 CSP-OZ-DC 2002 pl 4105 CSP-OZ 1997 pl 4106 CSSA 1979 pl 4107 Culler-Fried System 1961 pl 4108 CuPit-2 1997 pl 4109 cuscus 2019 pl 4110 CypherText 1970 pl 4111 D4 2001 queryLanguage 4112 DAG 1989 pl 4113 DAP-Algol 1985 pl 4114 DartCVL 1995 pl 4115 DATA-TEXT 1967 pl 4116 DATAN 1966 pl 4117 DEACON 1962 pl 4118 DeBuMa 1988 pl 4119 DEM 1996 pl 4120 DESCRIPTRAN 1963 pl 4121 DETAB/65 1964 pl 4122 DETAB-X 1960 pl 4123 DETAP 1965 pl 4124 Deva 1993 pl 4125 DFL 1983 pl 4126 DIAMAG 1966 pl 4127 DIGRAF 1977 pl 4128 Diplans 1988 pl 4129 Distributed Processes 1978 pl 4130 DITRAN 1967 pl 4131 DITROFF/FFORTID 1985 pl 4132 DITROFF 1982 pl 4133 DMAP 1975 pl 4134 DOE Macsyma 1984 pl 4135 DOLPHIN 1970 pl 4136 DOWL 1993 pl 4137 DPRL 1990 pl 4138 DRL 1997 pl 4139 DROL 2000 pl 4140 DSL/90 1965 pl 4141 DYSTAL 1965 pl 4142 EAS-E 1983 pl 4143 EASL 1966 pl 4144 EASY ENGLISH 1968 pl 4145 Eclectic CSP 2000 pl 4146 ECT 1971 pl 4147 Edinburgh LCF 1979 pl 4148 EDSAC Initial Orders 1948 assembly 4149 EDSIM 1977 pl 4150 EDUCE* 1990 pl 4151 EGS4 1985 pl 4152 EL1 1970 pl 4153 Ellie 1990 pl 4154 ELMOL 1970 pl 4155 Emily 1970 os 4156 EPILOG 1981 pl 4157 EQLog 1986 pl 4158 EQUATE 1991 pl 4159 ERROL 1983 pl 4160 Ethereum Virtual Machine 2015 vm 4161 Etude 1979 pl 4162 FAC 1986 pl 4163 FAD 1987 pl 4164 FCPU 1970 pl 4165 Fickle 2000 pl 4166 FLENG++ 1989 pl 4167 flexbuffers 2014 idl 4168 Flora 1995 pl 4169 foogol 1985 pl 4170 FORAL LP 1978 pl 4171 FORAL 1975 pl 4172 FORALL 1980 pl 4173 Fork95 1995 pl 4174 FORMS/3 1990 pl 4175 Fortran 8x 1989 pl 4176 FORTRAN CEP 1963 pl 4177 Fortran D 1991 pl 4178 FORTRAN II 1958 pl 4179 Fortran M 1992 pl 4180 FP2 1986 pl 4181 FRAN 1997 pl 4182 g-2 1992 pl 4183 Gargoyle 1964 pl 4184 GASP II 1967 pl 4185 GAT 1959 pl 4186 GaussFit 1986 pl 4187 GCP 1985 pl 4188 GDPL 1984 pl 4189 Gedanken 1969 pl 4190 Generic Haskell 2000 pl 4191 GENTRAN 90 1990 pl 4192 GENTRAN 1984 pl 4193 GCC GIMPLE 2003 ir 4194 gitignore 2005 configFormat 4195 GKS 1983 pl 4196 GLIDE 1977 pl 4197 GLU 1995 pl 4198 Glue-Nail 1991 pl 4199 GPDS 1970 pl 4200 GPGS 1977 pl 4201 GPSS/360 1967 pl 4202 GPSS FORTRAN 1976 pl 4203 GQL 1980 pl 4204 GRAD Assistant 1965 pl 4205 GraphLog 1988 pl 4206 GRAPHOS 1972 pl 4207 Graqula 1993 pl 4208 GROUPLOG 2000 pl 4209 GSBL 1988 pl 4210 GVL 1990 pl 4211 GXL 2000 pl 4212 Gypsy 1976 pl 4213 Hank 1996 pl 4214 Haskell# 1991 pl 4215 HASL 1982 pl 4216 HERAKLIT 1987 pl 4217 Hermes 1990 pl 4218 HiQ 1998 pl 4219 HMSL 1980 pl 4220 HOL 1985 pl 4221 HOLCF 1994 pl 4222 HP-PASCAL 1984 pl 4223 HPRL 1982 pl 4224 HSL 1991 pl 4225 HSML 1998 pl 4226 HTEL 1999 pl 4227 HYPAC 1970 pl 4228 Hyperflow 1993 pl 4229 Hyperlisp 1971 pl 4230 Hyperlog 1996 pl 4231 HYTRAN 1963 pl 4232 IAM 1968 pl 4233 IB-Templog 1987 pl 4234 IBM Logo 1983 pl 4235 Integrated Civil Engineering System 1961 standard 4236 ICETRAN 1965 pl 4237 ICOT 1995 pl 4238 IMP72 1972 pl 4239 Industrial Modeling and Programming Language 2019 pl 4240 INMAGIC 1983 pl 4241 Inscan 1968 pl 4242 INTERCELLAS 1977 pl 4243 InterCONS 1995 pl 4244 Interlisp-VAX 1981 pl 4245 IPL-V 1957 pl 4246 IQF 1975 pl 4247 Isabelle-91 1991 pl 4248 Isabelle/HOL 1997 pl 4249 ISIS 1995 pl 4250 ISPL 1971 pl 4251 IVTRAN 1966 pl 4252 JACAL 2008 pl 4253 JavaScriptCore 2002 vm 4254 jBC 1989 pl 4255 JFugue 2002 pl 4256 JMSL 1986 pl 4257 JOSS II 1965 pl 4258 JSyn 2010 pl 4259 Juno 1985 pl 4260 KAIL 1976 pl 4261 Kaleidoquery 1998 pl 4262 Kaleidoscope'90 1990 pl 4263 Kaleidoscope'91 1991 pl 4264 KEE 1984 pl 4265 KEK-NODAL 1985 pl 4266 kew 2004 pl 4267 KeyKit 1995 pl 4268 Kiev 2002 pl 4269 King Kong 1991 pl 4270 KL-ONE 1977 pl 4271 KLIPA 1960 pl 4272 KRL-0 1977 pl 4273 KRS 1987 pl 4274 KRYPTON 1983 pl 4275 Kvikkalkul 2003 pl 4276 Kylix 2000 pl 4277 LABTRAN 1972 pl 4278 Larch 1985 pl 4279 LAURE 1989 pl 4280 LCF 1972 pl 4281 LCL 1991 pl 4282 LDL1 1987 pl 4283 LEGOL 1974 pl 4284 Leogo 1997 pl 4285 Leopard 2007 pl 4286 LGDF 1986 pl 4287 Libra 2020 pl 4288 Lincoln Reckoner 1965 pl 4289 Lingua Graphica 1992 pl 4290 LiSEB 1994 pl 4291 LISP A 1968 pl 4292 LOCS 1965 pl 4293 Logicon 1986 pl 4294 LOGIST 1980 pl 4295 Logres 1990 queryLanguage 4296 LogScheme 1990 pl 4297 Lola-2 1994 pl 4298 LOTIS 1969 pl 4299 LOTOS 1989 pl 4300 LPL 1973 pl 4301 LRLTRAN 1968 pl 4302 Lucinda 1991 pl 4303 M-LISP 1991 pl 4304 MacAims 1968 pl 4305 MACE 1989 pl 4306 Machiavelli 1989 pl 4307 Macro SPITBOL 1971 pl 4308 Magma2 1984 pl 4309 magritte 2019 pl 4310 MALUS 1970 pl 4311 ManuScript 2009 pl 4312 MAP 1960 assembly 4313 Marlais 1995 pl 4314 Mary/2 1984 pl 4315 MASIM 1985 pl 4316 Mathsy 1980 pl 4317 MATRIX PASCAL 1983 pl 4318 MCOBOL 1980 pl 4319 MDBS-QRS 1981 queryLanguage 4320 MEDIC 1980 pl 4321 Megalog 1991 pl 4322 Mercury Programming System 1960 pl 4323 Meroon 1991 pl 4324 Meta-Assembler 1977 assembly 4325 META/LISP 1970 pl 4326 MetaML 1997 pl 4327 METAPI 1967 pl 4328 METASIM 1973 pl 4329 METATEM 1989 pl 4330 Micro-flowcharts 1959 pl 4331 MICRODARE 1979 pl 4332 microTAL 1981 pl 4333 MiKe 2022 pl 4334 Mini-ML 1986 pl 4335 MINION 1989 pl 4336 MINIVITAL 1974 pl 4337 MINOPT 1998 pl 4338 MIRAGER 1971 pl 4339 Miranim 1985 pl 4340 MIRFAC 1962 pl 4341 Mizar 1973 pl 4342 MLISP2 1972 pl 4343 mmsearch 2001 pl 4344 MOBL 1960 pl 4345 MODCAP 1978 pl 4346 MODLISP 1980 pl 4347 MODSIM III 1996 pl 4348 Modula-P 1992 pl 4349 Modula/R 1983 pl 4350 Modular Prolog 1992 pl 4351 Molog 1987 pl 4352 MORPHISM 1965 pl 4353 MOUSE4 1978 pl 4354 Moxie 1984 pl 4355 MPGS 1972 pl 4356 MRDB 1976 pl 4357 MS2 1967 pl 4358 MSG.84 1985 pl 4359 muFP 1984 pl 4360 Mul-T 1989 pl 4361 Multigame 1994 pl 4362 MUMS 1976 pl 4363 MUNIN 1989 pl 4364 MuSimp 1978 pl 4365 MVL 1993 pl 4366 NAPSS 1965 pl 4367 NARPL 1989 pl 4368 Nassi-Shneiderman charts 1972 pl 4369 NSS 1999 binaryDataFormat 4370 NDL 2007 pl 4371 NEATER 2 1968 linter 4372 Ness 1989 pl 4373 Netform 1974 pl 4374 Network Control Language 1978 pl 4375 NeuronC 1992 pl 4376 NFQL 1989 pl 4377 NIKL 1986 pl 4378 NOAH 1982 pl 4379 Noodle 1993 pl 4380 NOP-2 2001 pl 4381 NPL 1963 pl 4382 Numerica 1997 pl 4383 Oaklisp 1986 pl 4384 oasis-operating-system 1977 os 4385 OBJ2 1984 pl 4386 Objectcharts 1992 pl 4387 ObjectWorld 1993 pl 4388 ObjVProlog 1989 pl 4389 OBSCURE 1985 pl 4390 Occam 2 1987 pl 4391 Octopus 1993 pl 4392 O'Haskell 2002 pl 4393 OLGA 1985 pl 4394 OLI 1997 pl 4395 OMNIMARK 1980 pl 4396 OMNITAB 80 1980 pl 4397 OOPAL 2002 pl 4398 OpenMusic 2019 pl 4399 OPS-3 1965 pl 4400 OPS 1970 pl 4401 OREGANO 1969 pl 4402 Orlog 1992 pl 4403 OSIRIS 1970 pl 4404 OSL/2 1970 pl 4405 Ottawa Euclid 1984 pl 4406 Otter 1988 pl 4407 OWL DL 2007 xmlFormat 4408 P-Prolog 1986 pl 4409 P-TAC 1989 pl 4410 P3L 1998 pl 4411 PACOL 1974 pl 4412 PADL-1 1978 pl 4413 PaiLisp 1986 pl 4414 Palingol 1996 pl 4415 PANCODE 1982 pl 4416 PANON-1 1963 pl 4417 PANON-1B 1965 pl 4418 Parallel ELLPACK 1983 pl 4419 Parallel Pascal 1984 pl 4420 ParaLog_e 1997 pl 4421 ParMod 1987 pl 4422 Pascal Plus 1979 pl 4423 Pascal-SC 1982 pl 4424 PASION 1986 pl 4425 PASRO 1985 pl 4426 Path Pascal 1978 pl 4427 PCN 1992 pl 4428 PCOL 1986 pl 4429 pC++ 1991 pl 4430 Partial Differential Equation Language 1968 pl 4431 PDL/Ada 1981 pl 4432 PDL 1973 pl 4433 Pebble 1984 pl 4434 PEI 1994 pl 4435 PEP 1984 pl 4436 PFORT 1975 pl 4437 Pfortran 1992 pl 4438 pGOLOG 2000 pl 4439 PHYSICTRAN 1971 pl 4440 Pi Calculus 1991 pl 4441 PICTOL 1975 pl 4442 PICTUREBALM 1980 pl 4443 PiLib 2002 pl 4444 PL/EXUS 1973 pl 4445 PLANIT 1967 pl 4446 PLANNER-73 1973 pl 4447 Playground 1989 pl 4448 Pocket Smalltalk 1999 pl 4449 POGOL 1973 pl 4450 POLAC 1975 pl 4451 Polylith 1983 pl 4452 PolyP 1997 pl 4453 PolyTOIL 1994 pl 4454 POPSY 1986 pl 4455 PORT-ALG 1973 pl 4456 PRAXIS 1980 pl 4457 PRESTO 1987 pl 4458 Principle of sufficient reason 1975 pl 4459 PRISM 1983 pl 4460 Prisma Schema Language 2019 idl 4461 PROCOL 1991 pl 4462 PROGRES 1991 pl 4463 Prolog-D-Linda 1990 pl 4464 Prolog-ELF 1985 pl 4465 Prolog III 1984 pl 4466 Prolog/KR 1984 pl 4467 Prolog-Linda 1989 pl 4468 PROPLAN 1977 pl 4469 PROTOS-L 1989 pl 4470 PROW 1969 pl 4471 pSather 1991 pl 4472 PSG 1969 pl 4473 PSL 1979 pl 4474 PT 1983 pl 4475 PUMPKIN 1974 pl 4476 Q-GERT 1979 pl 4477 QA4 1967 pl 4478 QLISP 1988 pl 4479 Qunity 2022 pl 4480 Quty 1984 pl 4481 rbasic 1985 pl 4482 REC/SM 1980 pl 4483 RECOL 1963 pl 4484 REF-ARF 1970 pl 4485 RefLisp 1988 pl 4486 REGENT 1971 pl 4487 Relationlog 2001 pl 4488 RELFUN 1986 pl 4489 RF-Maple 1984 pl 4490 RHET 1990 pl 4491 RIGAL 1987 pl 4492 ROL 1996 pl 4493 ROL2 1999 pl 4494 Rosette 2000 pl 4495 RT-ASLAN 1986 pl 4496 RT-CDL 1989 pl 4497 RT-Z 1999 pl 4498 SAAL 1966 assembly 4499 SAC-1 1967 pl 4500 SAC-2 1969 pl 4501 SARTEX 1985 pl 4502 Sassy 1999 pl 4503 SB-ONE 1990 pl 4504 SCALPEL 1971 pl 4505 SCHEMAL 1983 pl 4506 SCIL-VP 1992 pl 4507 Sclipting 2011 esolang 4508 Scratchpad II 1980 pl 4509 Scrimshaw 1993 pl 4510 ScriptX 1995 pl 4511 SectorC 2023 compiler 4512 SEGRAS 1985 pl 4513 SEMANOL 1969 pl 4514 Seque 1988 pl 4515 SEQUEL 2 1976 pl 4516 Sequential Pascal 1970 pl 4517 SESPOOL 1977 pl 4518 SetLog 1991 pl 4519 SEVAL 1981 pl 4520 ShapeUp 1984 pl 4521 Shared Prolog 1990 pl 4522 SI Library 1998 pl 4523 SIMAN IV 1990 pl 4524 SIMCAL 1986 pl 4525 SIMDIS 1985 pl 4526 SIMFACTORY 1990 pl 4527 SIML/I 1979 pl 4528 SIMNET 1988 pl 4529 SIMPAS 1980 pl 4530 SIMUL 1973 pl 4531 SIMULA 67 1967 pl 4532 Sketchpad III 1966 pl 4533 SL5 1975 pl 4534 SLAM II 1980 pl 4535 SLEUTH 1962 assembly 4536 SLPL 1976 pl 4537 SMALGOL 1961 pl 4538 Small Euclid 1988 pl 4539 SMALL-X 1985 pl 4540 Smalltalk-76 1976 pl 4541 Smalltalk-80 1980 pl 4542 SMoLCS 1986 pl 4543 SNOBAT 1976 pl 4544 SNOOP 1988 pl 4545 SOLMAR 1978 pl 4546 SORCA 1983 pl 4547 SPECL 1973 pl 4548 spir-v 2015 ir 4549 Symbolic Programming System 1959 pl 4550 sqlar-format 2014 binaryDataFormat 4551 SQURL 1981 pl 4552 STAGE2 1970 pl 4553 Standard Lisp 1979 pl 4554 STAPLE 1975 pl 4555 *Prolog 1989 pl 4556 Static Typescript 2019 pl 4557 StoneCutter 2020 grammarLanguage 4558 STRCMACS 1977 pl 4559 STREMA 1976 pl 4560 STRESS 1963 pl 4561 SubL 1989 pl 4562 SURGE 1958 pl 4563 taktentus 2015 esolang 4564 VoxML 1998 pl 4565 Very Tiny Language 1976 pl 4566 wizml 1997 pl 4567 Wolontis-Bell Interpreter 1955 pl 4568 xl 1977 pl 4569 XQL 1999 queryLanguage 4570 3D Logo 1986 pl 4571 ABLE 1981 pl 4572 ADAM 1964 pl 4573 ALPAK 1963 pl 4574 APACHE 1961 pl 4575 APL/HP 1986 pl 4576 Arctic 1984 pl 4577 ARTSPEAK 1974 pl 4578 ASHMEDAI 1967 pl 4579 ASPOL 1973 pl 4580 Atomos 2006 pl 4581 Aurora 1988 pl 4582 AUTOLOFT 1962 pl 4583 Automator 2005 pl 4584 AUTOmatic PROgramming of Machine Tools 1961 pl 4585 B-LINE 1968 pl 4586 BACK 1988 pl 4587 BaLinda Lisp 1996 pl 4588 baltazar 1993 pl 4589 Barrel 1980 pl 4590 BASEBALL 1961 pl 4591 BASEL 1968 pl 4592 BEEF 1961 pl 4593 Berkeley DB 1991 library 4594 BETA Project 1961 grammarLanguage 4595 Biferno 2003 pl 4596 BIGMAC 1981 pl 4597 bigWig format 2009 binaryDataFormat 4598 BIGWIG 1998 pl 4599 Birkbeck Assembly 1947 assembly 4600 BLAZE 2 1989 pl 4601 BrouHaHa 1987 pl 4602 C flat 1991 pl 4603 CafeObj 1997 pl 4604 CAJOLE 1978 pl 4605 CCal 1987 pl 4606 CIRCAL 1985 pl 4607 CLANGER 1995 pl 4608 ClassiC 1998 pl 4609 CLEAR 1976 pl 4610 Coherent Parallel C 1988 pl 4611 COL 1989 pl 4612 COMFY 1997 pl 4613 COMPUTEST 1964 pl 4614 COMSKEE 1973 pl 4615 Concurrent C++ 1988 pl 4616 Concurrent Prolog 1983 pl 4617 CONLAN 1980 pl 4618 Connection Machine LISP 1986 pl 4619 CONSIM 1977 pl 4620 CONSTRAINTS 1978 pl 4621 Consul 1981 pl 4622 CST 1988 pl 4623 CUBE 1992 pl 4624 CUPID 1975 pl 4625 DAMN 1970 pl 4626 DEBL 1988 pl 4627 DECLARE 1997 pl 4628 DEL 1971 pl 4629 Delirium 1991 pl 4630 Delta Prolog 1984 pl 4631 DIALOG 1966 pl 4632 DICE 1991 pl 4633 DIET 1975 pl 4634 Dipe-R 2002 pl 4635 DISC 1989 pl 4636 DISPEL 1981 pl 4637 DNA 1980 pl 4638 $ 1983 pl 4639 DOPL 1982 pl 4640 DUAL 1953 pl 4641 Durra 1986 pl 4642 Elegant 1987 pl 4643 ELLPACK 1983 pl 4644 EMMA 1999 pl 4645 Eva 1990 pl 4646 EXEL 1973 pl 4647 Extended Pascal 1987 pl 4648 FLIC 1987 pl 4649 FlowNet 1993 protocol 4650 FORK 1992 pl 4651 FORTRANSIT 1956 pl 4652 FRANK 1985 pl 4653 Frenetic 2011 pl 4654 Fresco 1993 pl 4655 Galileo 1983 pl 4656 GCLA II 1992 pl 4657 GEM 1985 pl 4658 GCC GENERIC 2003 ir 4659 Gerald 1989 pl 4660 GERMINAL 1974 pl 4661 Glish 1993 pl 4662 Golog 1993 pl 4663 GOQL 1997 pl 4664 GOSPEL 1977 pl 4665 GPS 1957 pl 4666 GPSS/85 1985 pl 4667 Grapheasy 1975 pl 4668 Green 1998 pl 4669 GROOVE 1970 pl 4670 Hancock 1999 pl 4671 HARVEY 1972 pl 4672 HELPER 1969 pl 4673 henk 1997 pl 4674 Hi-Visual 1992 pl 4675 Holo 2001 pl 4676 hoot-smalltalk 2018 pl 4677 Hybrid 1987 pl 4678 HyCom 1975 pl 4679 Ibuki CL 1992 pl 4680 ICML 2008 xmlFormat 4681 ILU 1994 pl 4682 ILX 2002 pl 4683 IMAGE 1975 pl 4684 imf 2008 textDataFormat 4685 Ina Jo 1985 pl 4686 INC 1987 pl 4687 INFOLOG 1986 pl 4688 INSIGHT 1983 pl 4689 INTERACTIVE 1983 pl 4690 ISAC 2003 pl 4691 JavaML 2000 pl 4692 JOSIE 1991 pl 4693 Joyce 1987 pl 4694 JOYCE+ 1990 pl 4695 JPL 1991 pl 4696 JR 2004 pl 4697 KATE 1979 pl 4698 Keep It Short and Simple 1959 pl 4699 KL1 1988 pl 4700 Klaim 1997 pl 4701 KRIS 1991 pl 4702 LAMINA 1988 pl 4703 Language for Class Description 1964 pl 4704 LAP 1987 pl 4705 LARIS 2000 pl 4706 LASS 1982 pl 4707 LDL 1984 pl 4708 Lemick 2004 pl 4709 LG 1969 pl 4710 Lisptalk 1988 pl 4711 LNF 1985 pl 4712 LO 1990 pl 4713 LOGAL 1977 pl 4714 LOGLISP 1980 pl 4715 LOGOL 1968 pl 4716 LogoWriter 1986 pl 4717 LOL 1994 queryLanguage 4718 LOOPN++ 2000 pl 4719 LORE 1985 pl 4720 Lucid representations 1991 pl 4721 Lygon 1995 pl 4722 MIT Algebraic Compiler 1957 pl 4723 MADCAP 1960 pl 4724 MADS 1964 pl 4725 Magic Paper 1963 pl 4726 MAPQUERY 1982 pl 4727 MARSYAS 1970 pl 4728 MAVIS 1992 pl 4729 MELD 1989 pl 4730 META/PLUS 1971 pl 4731 MetaH 1988 pl 4732 Microsoft Equation Editor 1993 application 4733 Modula-2+ 1984 pl 4734 Modula-3* 1993 pl 4735 Morphe 1992 pl 4736 MPSX 1978 pl 4737 MUSYS 1969 pl 4738 N-Prolog 1985 pl 4739 Nail 1986 pl 4740 NetBasic 1999 pl 4741 Netscript 2016 pl 4742 NIL 1983 pl 4743 npy 2008 binaryDataFormat 4744 NSL 1991 pl 4745 NUA-Prolog 1991 pl 4746 NUT 1986 pl 4747 O 1986 pl 4748 OFL 1995 pl 4749 OLDAS 1968 pl 4750 OLIVER 1976 pl 4751 olog 1997 pl 4752 OMAR 1999 pl 4753 One-man-language 1977 pl 4754 OOLP 1989 pl 4755 OOPS 1986 pl 4756 OpenAda 2000 pl 4757 Orient84/K 1986 pl 4758 Object-oriented Structured Query Language 1990 queryLanguage 4759 P/CL 1984 pl 4760 PACT IA 1957 pl 4761 Paragon 1991 pl 4762 Pascal-FC 1990 pl 4763 PASCAL-I 1980 pl 4764 Pascal-S 1975 pl 4765 PHOCUS 1987 pl 4766 PICASSO 1988 pl 4767 PIE 1988 pl 4768 PIN 1975 pl 4769 PIT 1958 pl 4770 PIXIN 1974 pl 4771 PL/I-FORMAC 1968 pl 4772 PL/LL 1983 pl 4773 PL4 1974 pl 4774 PLACA 1993 pl 4775 POSE 1967 pl 4776 PRIZ 1983 pl 4777 ProFIT 1994 pl 4778 Progol 1993 pl 4779 PROPHET 1974 pl 4780 proto-GNOSIS 1987 pl 4781 ProVerif 2014 pl 4782 Proxy 1992 pl 4783 Py 1991 pl 4784 python-cl-compiler 1991 compiler 4785 QAS 1978 pl 4786 QUADRIL 1976 pl 4787 Quanta 2003 pl 4788 Quick Macros 1997 pl 4789 QUILT 1970 pl 4790 RACK 1990 pl 4791 RC++ 2001 pl 4792 rdata-format 2000 binaryDataFormat 4793 Real-Time Euclid 1986 pl 4794 Rebus 1982 pl 4795 Refined C 1984 pl 4796 REL English 1975 pl 4797 REL 1968 pl 4798 Relix 1984 pl 4799 Reuse Description Language 2005 pl 4800 RoboTalk 1985 pl 4801 ROSCOE 1979 pl 4802 RUNCIBLE 1958 pl 4803 RUSSELL 1970 pl 4804 RUTH 1987 pl 4805 SA 1977 pl 4806 SALEM 1967 pl 4807 Sampletalk 1991 pl 4808 Scenic 2019 pl 4809 SCOOP 1988 pl 4810 SCREAMER 1993 pl 4811 SEARCH 1973 pl 4812 SESPATH 1985 pl 4813 Seymour 1989 pl 4814 SIDOPS+ 1997 pl 4815 SIGMA 76 1976 pl 4816 SIMODULA 1988 pl 4817 Sim++ 1991 pl 4818 Siprol 1980 pl 4819 SKIL 1996 pl 4820 SKY 2000 pl 4821 SL 1988 pl 4822 SLIPS 1984 pl 4823 SLOG 1985 pl 4824 Smalltalk/V 1986 pl 4825 SmallVDM 1993 pl 4826 SMART 1964 pl 4827 SMSL 1995 pl 4828 Symbolic Optimal Assembly Program 1955 assembly 4829 Soar Markup Language 2014 xmlFormat 4830 Spec 1990 pl 4831 SPECOL 1968 pl 4832 SPIL 1973 pl 4833 SPLAW 1998 pl 4834 SPRINT 1967 pl 4835 SQUARE 1975 pl 4836 SR 1988 pl 4837 StreamIt 1992 pl 4838 STRUDL 1965 pl 4839 Unicode 1955 pl 4840 Virt 1998 pl 4841 --- pldb.pub.md.txt --- # Let's do some research on lang topic! Recently I found out about *Programming Language DataBase* [PLDB](https://pldb.pub) All dataset here https://pldb.pub/pldb.json ```shell python3 -m venv .venv . .venv/bin/activate pip install ipython pandas ipython3 ``` ```python import pandas as pd with open("lang/lang.csv") as fd: data = [] for i, line in enumerate(fd.readlines()): if i == 0: continue cols = [x.strip() for x in line.split(" ") if x.strip()] if len(cols) > 4: cols = [" ".join(cols[:len(cols)-3])] + cols[-3:] title, appeared, type_, rank = cols data.append( { "title": title, "appeared": int(appeared), "type": type_, "rank": int(rank), } ) df = pd.DataFrame(data) print("New Tech") new_items = df.sort_values(["appeared", "rank"], ascending=[False, True]) print(new_items[:50].to_string(index=False)) ``` New Tech title appeared type rank TQL 2023 queryLanguage 1747 Scrapscript 2023 pl 2063 SectorC 2023 compiler 4512 Speedie 2022 pl 387 Markwhen 2022 textMarkup 434 PRQL 2022 queryLanguage 436 Djot 2022 textMarkup 612 Jakt 2022 pl 659 Zuo 2022 pl 872 MarkovJunior 2022 pl 895 Melody 2022 pl 967 Mojo 2022 pl 968 Dak 2022 pl 1050 HeLang 2022 pl 1108 Violent ES 2022 pl 1139 erg 2022 pl 1155 Cyber 2022 pl 1167 Pomsky 2022 pl 1374 Uniform eXchange Format 2022 dataNotation 1442 noulith 2022 pl 1454 Goal 2022 pl 1592 Lil 2022 pl 1593 [x]it! 2022 dataNotation 1606 Vely 2022 pl 1620 Mangle 2022 pl 1662 GLMS 2022 pl 1713 Kamby 2022 pl 1836 YESS 2022 protocol 1843 Wing 2022 pl 1874 Pycket 2022 pl 1927 Astatine 2022 pl 2005 JCOF 2022 dataNotation 2056 Fardlang 2022 esolang 2057 Kami 2022 textMarkup 2180 fp 2022 pl 2246 QOIR 2022 binaryDataFormat 2311 Edina 2022 pl 2409 cosh 2022 pl 2415 Cane 2022 musicalNotation 2487 Lesma 2022 pl 2502 Mewl 2022 esolang 2509 Storymatic 2022 pl 2511 Fern 2022 pl 2628 Broccoli 2022 esolang 2722 SQHTML 2022 pl 2790 Jesth 2022 dataNotation 2797 Linked Markdown 2022 textMarkup 2904 EverParse3D 2022 idl 3080 NumPad 2022 editor 3153 Interleaved Notation 2022 pl 3163 ```python print("New Compiler") compiler = df[df["type"] == "compiler"] compiler = compiler.sort_values(["appeared", "rank"], ascending=[False, True]) print(compiler[:20].to_string(index=False)) ``` New Compiler title appeared type rank SectorC 2023 compiler 4512 Kefir 2021 compiler 3333 chibicc 2019 compiler 853 Deno 2018 compiler 300 tinygo-compiler 2018 compiler 3309 asterius-compiler 2017 compiler 1140 tarot 2017 compiler 3277 psyche-c 2016 compiler 1667 binaryen 2015 compiler 833 Numba 2012 compiler 482 jsil-compiler 2010 compiler 1090 Roslyn compiler 2009 compiler 707 Xoc 2008 compiler 3416 Stalin 2006 compiler 2154 LuaJIT 2005 compiler 902 polyglot-compiler 2003 compiler 2275 Tiny C Compiler 2001 compiler 719 JAL compiler 2000 compiler 1293 GHC 1992 compiler 2935 python-cl-compiler 1991 compiler 4785 ```python print("New Lang") df_pl = df[df["type"] == "pl"] lang = df_pl.sort_values(["appeared", "rank"], ascending=[False, True]) print(lang[:50].to_string(index=False)) ``` New Lang title appeared type rank Scrapscript 2023 pl 2063 Speedie 2022 pl 387 Jakt 2022 pl 659 Zuo 2022 pl 872 MarkovJunior 2022 pl 895 Melody 2022 pl 967 Mojo 2022 pl 968 Dak 2022 pl 1050 HeLang 2022 pl 1108 Violent ES 2022 pl 1139 erg 2022 pl 1155 Cyber 2022 pl 1167 Pomsky 2022 pl 1374 noulith 2022 pl 1454 Goal 2022 pl 1592 Lil 2022 pl 1593 Vely 2022 pl 1620 Mangle 2022 pl 1662 GLMS 2022 pl 1713 Kamby 2022 pl 1836 Wing 2022 pl 1874 Pycket 2022 pl 1927 Astatine 2022 pl 2005 fp 2022 pl 2246 Edina 2022 pl 2409 cosh 2022 pl 2415 Lesma 2022 pl 2502 Storymatic 2022 pl 2511 Fern 2022 pl 2628 SQHTML 2022 pl 2790 Interleaved Notation 2022 pl 3163 Radish 2022 pl 3301 Cish 2022 pl 3524 Verse 2022 pl 3624 Argon 2022 pl 3638 TeaSharp 2022 pl 3649 Blade 2022 pl 3861 Bolin 2022 pl 3862 Cosmos 2022 pl 3869 Gaiman 2022 pl 3887 LinkText 2022 pl 3897 Peridot 2022 pl 3912 Simple Stackless Lisp 2022 pl 3925 SuperForth 2022 pl 3930 MiKe 2022 pl 4334 Qunity 2022 pl 4480 Jule 2021 pl 615 Triton 2021 pl 654 Slope 2021 pl 701 Swallow 2021 pl 1200 --- enums.py.txt --- import enum from functools import total_ordering @total_ordering @enum.unique class BaseUniqueSortedEnum(enum.Enum): """Base unique enum class with ordering.""" def __new__(cls, *args, **kwargs): obj = object.__new__(cls) obj.index = len(cls.__members__) + 1 return obj def __hash__(self) -> int: return hash( f"{self.__module__}_{self.__class__.__name__}_{self.name}_{self.value}" ) def __eq__(self, other) -> bool: self._check_type(other) return super().__eq__(other) def __lt__(self, other) -> bool: self._check_type(other) return self.index < other.index def _check_type(self, other) -> None: if type(self) != type(other): raise TypeError(f"Different types of Enum: {self} != {other}") class Dog(BaseUniqueSortedEnum): BLOODHOUND = "BLOODHOUND" WEIMARANER = "WEIMARANER" SAME = "SAME" class Cat(BaseUniqueSortedEnum): BRITISH = "BRITISH" SCOTTISH = "SCOTTISH" SAME = "SAME" assert Dog.BLOODHOUND < Dog.WEIMARANER assert Dog.BLOODHOUND <= Dog.WEIMARANER assert Dog.BLOODHOUND != Dog.WEIMARANER assert Dog.BLOODHOUND == Dog.BLOODHOUND assert Dog.WEIMARANER == Dog.WEIMARANER assert Dog.WEIMARANER > Dog.BLOODHOUND assert Dog.WEIMARANER >= Dog.BLOODHOUND assert Cat.BRITISH < Cat.SCOTTISH assert Cat.BRITISH <= Cat.SCOTTISH assert Cat.BRITISH != Cat.SCOTTISH assert Cat.BRITISH == Cat.BRITISH assert Cat.SCOTTISH == Cat.SCOTTISH assert Cat.SCOTTISH > Cat.BRITISH assert Cat.SCOTTISH >= Cat.BRITISH assert hash(Dog.BLOODHOUND) == hash(Dog.BLOODHOUND) assert hash(Dog.WEIMARANER) == hash(Dog.WEIMARANER) assert hash(Dog.BLOODHOUND) != hash(Dog.WEIMARANER) assert hash(Dog.SAME) != hash(Cat.SAME) # raise TypeError Dog.SAME <= Cat.SAME Dog.SAME < Cat.SAME Dog.SAME > Cat.SAME Dog.SAME >= Cat.SAME Dog.SAME != Cat.SAME --- .gitignore --- --- LICENSE --- MIT License Copyright (c) 2024 Maxim Zaks Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Mojo-prefix sum Implementation of prefix sum as a scalar operation and with SIMD --- article.py --- from time import time_ns import numpy as np def simple_python_prefix_sum(): list = [1] * 10_000 tik = time_ns() element = list[0] for i in range(1, len(list)): list[i] += element element = list[i] tok = time_ns() print(f"Time spent per element: {(tok - tik) / len(list)} ns") def naive_numpy_prefix_sum(): list = [1] * 10_000 tik = time_ns() list = np.cumsum(list) tok = time_ns() print(f"Time spent per element: {(tok - tik) / len(list)} ns") def proper_numpy_prefix_sum(): list = np.full(10_000, 1) tik = time_ns() list = np.cumsum(list) tok = time_ns() print(f"Time spent per element: {(tok - tik) / len(list)} ns") def stupid_numpy_prefix_sum(): list = np.full(10_000, 1) tik = time_ns() element = list[0] for i in range(1, len(list)): list[i] += element element = list[i] tok = time_ns() print(f"Time spent per element: {(tok - tik) / len(list)} ns") if __name__ == "__main__": l1 = simple_python_prefix_sum() l2 = naive_numpy_prefix_sum() l3 = proper_numpy_prefix_sum() l4 = stupid_numpy_prefix_sum() --- checkout_remote_modules.sh --- #!/bin/bash function check_out_remote_module() ( rurl="$1" shift declare -a paths declare -a module_names for var in "$@" do IFS="=" read -ra module_name_components <<< "$var" components_count=${#module_name_components[@]} path=${module_name_components[0]} module_name=${module_name_components[$components_count-1]} paths=("${paths[@]}" "$path") module_names=("${module_names[@]}" "$module_name") done IFS=" " for module_name in "${module_names[@]}" do rm -rf ../$module_name done current_date_time=$(date) echo "URL: $rurl" git clone -n --depth=1 --filter=tree:0 $rurl cd ${rurl##*/} git sparse-checkout set --no-cone "${paths[@]}" git checkout for i in "${!paths[@]}" do module_name=${module_names[$i]} path=${paths[$i]} cp -R ./$path ../../$module_name echo $current_date_time > ../../$module_name/.checkoutinfo echo "URL: $rurl" >> ../../$module_name/.checkoutinfo echo "Path: $path" >> ../../$module_name/.checkoutinfo done cd ../ ) function checkout()( # Add check out remote module calls here check_out_remote_module "https://github.com/mzaks/mojo-csv" "csv" ) mkdir -p "_deps" cd "_deps" checkout rm -rf "../_deps" --- csv/.checkoutinfo --- Fri Mar 29 17:23:18 CET 2024 URL: https://github.com/mzaks/mojo-csv Path: csv --- csv/__init__.mojo --- from .csv_builder import CsvBuilder from .csv_table import CsvTable --- csv/csv_builder.mojo --- from memory.memory import memcpy from buffer import Buffer, Dim from .string_utils import find_indices, contains_any_of, string_from_pointer alias BufferType = Buffer[DType.int8] alias CR_CHAR = "\r" alias CR = ord(CR_CHAR) alias LF_CHAR = "\n" alias LF = ord(LF_CHAR) alias COMMA_CHAR = "," alias COMMA = ord(COMMA_CHAR) alias QUOTE_CHAR = '"' alias QUOTE = Int8(ord(QUOTE_CHAR)) struct CsvBuilder: var _buffer: DTypePointer[DType.int8] var _capacity: Int var num_bytes: Int var _column_count: Int var _elements_count: Int var _finished: Bool fn __init__(inout self, column_count: Int): self._capacity = 1024 self._buffer = DTypePointer[DType.int8].alloc(self._capacity) self._column_count = column_count self._elements_count = 0 self._finished = False self.num_bytes = 0 fn __init__(inout self, *coulmn_names: StringLiteral): self._capacity = 1024 self._buffer = DTypePointer[DType.int8].alloc(self._capacity) self._elements_count = 0 self._finished = False self.num_bytes = 0 var column_name_list: VariadicList[StringLiteral] = coulmn_names self._column_count = len(column_name_list) for i in range(len(column_name_list)): self.push(coulmn_names[i]) fn __del__(owned self): if not self._finished: self._buffer.free() fn push[D: DType](inout self, value: SIMD[D, 1]): var s = String(value) var size = len(s) self.push(s, False) fn push_stringabel[T: Stringable](inout self, value: T, consider_escaping: Bool = False): self.push(str(value), consider_escaping) fn push_empty(inout self): self.push("", False) fn fill_up_row(inout self): var num_empty = self._column_count - (self._elements_count % self._column_count) if num_empty < self._column_count: for _ in range(num_empty): self.push_empty() fn push(inout self, s: String, consider_escaping: Bool = True): if consider_escaping and contains_any_of( s, CR_CHAR, LF_CHAR, COMMA_CHAR, QUOTE_CHAR ): return self.push(QUOTE_CHAR + escape_quotes_in(s) + QUOTE_CHAR, False) var size = len(s) self._extend_buffer_if_needed(size + 2) if self._elements_count > 0: if self._elements_count % self._column_count == 0: self._buffer.offset(self.num_bytes).store(CR) self._buffer.offset(self.num_bytes + 1).store(LF) self.num_bytes += 2 else: self._buffer.offset(self.num_bytes).store(COMMA) self.num_bytes += 1 memcpy(self._buffer.offset(self.num_bytes), s._as_ptr(), size) s._strref_keepalive() self.num_bytes += size self._elements_count += 1 @always_inline fn _extend_buffer_if_needed(inout self, size: Int): if self.num_bytes + size < self._capacity: return var new_size = self._capacity while new_size < self.num_bytes + size: new_size *= 2 var p = DTypePointer[DType.int8].alloc(new_size) memcpy(p, self._buffer, self.num_bytes) self._buffer.free() self._capacity = new_size self._buffer = p fn finish(owned self) -> String: self._finished = True self.fill_up_row() self._buffer.offset(self.num_bytes).store(CR) self._buffer.offset(self.num_bytes + 1).store(LF) self.num_bytes += 3 return string_from_pointer(self._buffer, self.num_bytes) fn escape_quotes_in(s: String) -> String: var indices = find_indices(s, QUOTE_CHAR) var i_size = len(indices) if i_size == 0: return s var size = len(s._buffer) var p_current = s._as_ptr() var p_result = DTypePointer[DType.int8].alloc(size + i_size) var first_index = indices[0].to_int() memcpy(p_result, p_current, first_index) p_result.offset(first_index).store(QUOTE) var offset = first_index + 1 for i in range(1, len(indices)): var c_offset = indices[i - 1].to_int() var length = indices[i].to_int() - c_offset memcpy(p_result.offset(offset), p_current.offset(c_offset), length) offset += length p_result.offset(offset).store(QUOTE) offset += 1 var last_index = indices[i_size - 1].to_int() memcpy(p_result.offset(offset), p_current.offset(last_index), size - last_index) return string_from_pointer(p_result, size + i_size) --- csv/csv_table.mojo --- from .string_utils import find_indices, string_from_pointer from algorithm.functional import vectorize from sys.info import simdwidthof from sys.intrinsics import compressed_store from math import iota, reduce_bit_count from memory import stack_allocation alias QUOTE = ord('"') alias COMMA = ord(",") alias LF = ord("\n") alias CR = ord("\r") alias simd_width_u8 = simdwidthof[DType.uint8]() struct CsvTable: var _inner_string: String var _starts: List[Int] var _ends: List[Int] var column_count: Int fn __init__(inout self, owned s: String, with_simd: Bool = True): self._inner_string = s self._starts = List[Int](capacity=10) self._ends = List[Int](capacity=10) self.column_count = -1 if with_simd: self._simd_parse() else: self._parse() @always_inline fn _parse(inout self): var length = len(self._inner_string) var offset = 0 var in_double_quotes = False self._starts.append(offset) while offset < length: var c = self._inner_string._buffer[offset] if c == QUOTE: in_double_quotes = not in_double_quotes offset += 1 elif not in_double_quotes and c == COMMA: self._ends.append(offset) offset += 1 self._starts.append(offset) elif not in_double_quotes and c == LF: self._ends.append(offset) if self.column_count == -1: self.column_count = len(self._ends) offset += 1 self._starts.append(offset) elif ( not in_double_quotes and c == CR and length > offset + 1 and self._inner_string._buffer[offset + 1] == LF ): self._ends.append(offset) if self.column_count == -1: self.column_count = len(self._ends) offset += 2 self._starts.append(offset) else: offset += 1 if self._inner_string[length - 1] == "\n": _ = self._starts.pop_back() else: self._ends.append(length) @always_inline fn _simd_parse(inout self): var p = self._inner_string._as_ptr().bitcast[DType.uint8]() var string_byte_length = len(self._inner_string) var in_quotes = False var last_chunk__ends_on_cr = False self._starts.append(0) @always_inline @parameter fn find_indicies[simd_width: Int](offset: Int): var chars = p.load[width=simd_width](offset) var quotes = chars == QUOTE var commas = chars == COMMA var lfs = chars == LF var all_bits = quotes | commas | lfs var crs = chars == CR var offsets = iota[DType.uint8, simd_width]() var sp: DTypePointer[DType.uint8] = stack_allocation[ simd_width, UInt8, simd_width ]() compressed_store(offsets, sp, all_bits) var all_len = reduce_bit_count(all_bits) for i in range(all_len): var index = sp.load(i).to_int() if quotes[index]: in_quotes = not in_quotes continue if in_quotes: continue var current_offset = index + offset var rs_compensation: Int if index > 0: rs_compensation = (lfs[index] & crs[index - 1]).to_int() else: rs_compensation = (lfs[index] & last_chunk__ends_on_cr).to_int() self._ends.append(current_offset - rs_compensation) self._starts.append(current_offset + 1) if self.column_count == -1 and lfs[index]: self.column_count = len(self._ends) last_chunk__ends_on_cr = crs[simd_width - 1] vectorize[find_indicies, simd_width_u8](string_byte_length) if self._inner_string[string_byte_length - 1] == "\n": _ = self._starts.pop_back() else: self._ends.append(string_byte_length) fn get(self, row: Int, column: Int) -> String: if column >= self.column_count: return "" var index = self.column_count * row + column if index >= len(self._ends): return "" if ( self._inner_string[self._starts[index]] == '"' and self._inner_string[self._ends[index] - 1] == '"' ): var start = self._starts[index] + 1 var length = (self._ends[index] - 1) - start var p1 = Pointer[Int8].alloc(length + 1) memcpy(p1, self._inner_string._as_ptr().offset(start), length) var _inner_string = string_from_pointer(p1, length + 1) var quote_indices = find_indices(_inner_string, '"') var quotes_count = len(quote_indices) if quotes_count == 0 or quotes_count & 1 == 1: return _inner_string var p = _inner_string._as_ptr() var length2 = length - (quotes_count >> 1) var p2 = Pointer[Int8].alloc(length2 + 1) var offset2 = 0 memcpy(p2, p, quote_indices[0].to_int()) offset2 += quote_indices[0].to_int() for i in range(2, quotes_count, 2): var start = quote_indices[i - 1].to_int() var size = quote_indices[i].to_int() - start memcpy(p2.offset(offset2), p.offset(start), size) offset2 += size var last = quote_indices[quotes_count - 1].to_int() memcpy(p2.offset(offset2), p.offset(last), length - last) _inner_string._strref_keepalive() return string_from_pointer(p2, length - (quotes_count >> 1) + 1) return self._inner_string[self._starts[index] : self._ends[index]] fn row_count(self) -> Int: return len(self._starts) // self.column_count --- csv/string_utils.mojo --- from algorithm.functional import vectorize from sys.info import simdwidthof from sys.intrinsics import compressed_store from math import iota, reduce_bit_count, any_true from memory import stack_allocation from time import now from collections.vector import InlinedFixedVector alias simd_width_i8 = simdwidthof[DType.int8]() fn vectorize_and_exit[simd_width: Int, workgroup_function: fn[i: Int](Int) capturing -> Bool](size: Int): var loops = size // simd_width for i in range(loops): if workgroup_function[simd_width](i * simd_width): return var rest = size & (simd_width - 1) @parameter if simd_width >= 64: if rest >= 32: if workgroup_function[32](size - rest): return rest -= 32 @parameter if simd_width >= 32: if rest >= 16: if workgroup_function[16](size - rest): return rest -= 16 @parameter if simd_width >= 16: if rest >= 8: if workgroup_function[8](size - rest): return rest -= 8 @parameter if simd_width >= 8: if rest >= 4: if workgroup_function[4](size - rest): return rest -= 4 @parameter if simd_width >= 4: if rest >= 2: if workgroup_function[2](size - rest): return rest -= 2 if rest == 1: _= workgroup_function[1](size - rest) fn find_indices(s: String, c: String) -> List[UInt64]: var size = len(s) var result = List[UInt64]() var char = Int8(ord(c)) var p = s._as_ptr() @parameter fn find[simd_width: Int](offset: Int): @parameter if simd_width == 1: if p.offset(offset).load() == char: return result.append(offset) else: var chunk = p.load[width=simd_width](offset) var occurrence = chunk == char var offsets = iota[DType.uint64, simd_width]() + offset var occurrence_count = reduce_bit_count(occurrence) var current_len = len(result) result.reserve(current_len + occurrence_count) result.resize(current_len + occurrence_count, 0) compressed_store(offsets, DTypePointer[DType.uint64](result.data.value).offset(current_len), occurrence) vectorize[find, simd_width_i8](size) return result fn occurrence_count(s: String, *c: String) -> Int: var size = len(s) var result = 0 var chars = InlinedFixedVector[Int8](len(c)) for i in range(len(c)): chars.append(Int8(ord(c[i]))) var p = s._as_ptr() @parameter fn find[simd_width: Int](offset: Int): @parameter if simd_width == 1: for i in range(len(chars)): var char = chars[i] if p.offset(offset).load() == char: result += 1 return else: var chunk = p.load[width=simd_width](offset) var occurrence = SIMD[DType.bool, simd_width](False) for i in range(len(chars)): occurrence |= chunk == chars[i] var occurrence_count = reduce_bit_count(occurrence) result += occurrence_count vectorize[find, simd_width_i8](size) return result fn contains_any_of(s: String, *c: String) -> Bool: var size = len(s) # var c_list: VariadicListMem[String] = c var chars = InlinedFixedVector[Int8](len(c)) for i in range(len(c)): chars.append(Int8(ord(c[i]))) var p = s._as_ptr() var flag = False @parameter fn find[simd_width: Int](i: Int) -> Bool: var chunk = p.load[width=simd_width]() p = p.offset(simd_width) for i in range(len(chars)): var occurrence = chunk == chars[i] if any_true(occurrence): flag = True return flag return False vectorize_and_exit[simd_width_i8, find](size) return flag @always_inline fn string_from_pointer(p: DTypePointer[DType.int8], length: Int) -> String: # Since Mojo 0.5.0 the pointer needs to provide a 0 terminated byte string p.store(length - 1, 0) return String(p, length) fn print_v(v: List[UInt64]): print("(" + str(len(v)) + ")[") for i in range(len(v)): var end = ", " if i < len(v) - 1 else "]\n" print(v[i], ",") --- cum_sum.py --- import math import numpy as np import time LIST_SIZE = 1 << 20 ROUNDS = 10 def cum_sum_python(): min_duration = 100000000000 for _ in range(ROUNDS): l = [1] * LIST_SIZE tik = time.time_ns() for i in range(1, len(l)): l[i] += l[i-1] tok = time.time_ns() min_duration = min(min_duration, tok - tik) print(f"Cumulative sum over a list with {LIST_SIZE} items in {min_duration} ns, {(min_duration) / LIST_SIZE} ns per item") return l def cum_sum_numpy_brutforce(): min_duration = 100000000000 for _ in range(ROUNDS): arr = np.full(LIST_SIZE, 1) tik = time.time_ns() for i in range(1, len(arr)): arr[i] += arr[i-1] tok = time.time_ns() min_duration = min(min_duration, tok - tik) print(f"Cumulative sum over numpy array with {LIST_SIZE} items in for loop in {min_duration} ns, {(min_duration) / LIST_SIZE} ns per item") return list(arr) def cum_sum_numpy_shift(): min_duration = 100000000000 for _ in range(ROUNDS): arr = np.full(LIST_SIZE, 1) tik = time.time_ns() for i in range(int(math.log2(LIST_SIZE))): chunk = 1 << i shifted = np.roll(arr, chunk) shifted[:chunk] = 0 arr += shifted tok = time.time_ns() min_duration = min(min_duration, tok - tik) print(f"Cumulative sum over numpy array with {LIST_SIZE} items with shifted addition in {min_duration} ns, {(min_duration) / LIST_SIZE} ns per item") return list(arr) def cum_sum_numpy(): min_duration = 100000000000 for _ in range(ROUNDS): l = [1] * LIST_SIZE tik = time.time_ns() arr = np.cumsum(l) tok = time.time_ns() min_duration = min(min_duration, tok - tik) print(f"Cumulative sum over a list with {LIST_SIZE} items through numpy in {min_duration} ns, {(min_duration) / LIST_SIZE} ns per item") return list(arr) def cum_sum_numpy_explicit_conversion(): min_duration = 100000000000 for _ in range(ROUNDS): arr = np.full(LIST_SIZE, 1) tik = time.time_ns() arr = arr.cumsum() tok = time.time_ns() min_duration = min(min_duration, tok - tik) print(f"Cumulative sum over a np array with {LIST_SIZE} items in {tok - tik} ns, {(tok - tik) / LIST_SIZE} ns per item") return list(arr) if __name__ == "__main__": l1 = cum_sum_python() l2 = cum_sum_numpy() l3 = cum_sum_numpy_explicit_conversion() l4 = cum_sum_numpy_brutforce() l5 = cum_sum_numpy_shift() assert l1 == l2 assert l2 == l3 assert l3 == l4 assert l4 == l5 --- cum_sum_mojo.mojo --- from prefix_sum import scalar_prefix_sum, simd_prefix_sum from time import now from testing import assert_equal import benchmark alias LIST_SIZE = 10_000 alias dtype = DType.int64 alias type = SIMD[dtype, 1] alias rounds = 10 fn scalar() -> List[type]: var list = List[type](LIST_SIZE) var min_duration = 10000000 var result = 0 for _ in range(rounds): list = List[type](LIST_SIZE) for _ in range(LIST_SIZE): list.append(1) var tik = now() scalar_prefix_sum[dtype](list) var tok = now() min_duration = tok - tik if (tok - tik) < min_duration else min_duration print("Scalar prefix over a vector with", LIST_SIZE, "items in", min_duration, "ns,", Float64(min_duration) / LIST_SIZE, "ns per item") return list fn simd() -> List[type]: var list = List[type](LIST_SIZE) var min_duration = 10000000 for _ in range(rounds): list = List[type](LIST_SIZE) for _ in range(LIST_SIZE): list.append(1) var tik = now() simd_prefix_sum[dtype](list) var tok = now() min_duration = tok - tik if (tok - tik) < min_duration else min_duration print("SIMD prefix over a vector with", LIST_SIZE, "items in", min_duration, "ns,", Float64(min_duration) / LIST_SIZE, "ns per item") return list fn main() raises: var l1 = scalar() var l2 = simd() for i in range(LIST_SIZE): assert_equal(l1[i], l2[i]) # var l3 = List[type](LIST_SIZE) # var l4 = List[type](LIST_SIZE) # for _ in range(LIST_SIZE): # l3.append(1) # l4.append(1) # @parameter # fn _scalar(): # var l = l3 # scalar_prefix_sum[dtype](l) # @parameter # fn _simd(): # var l = l4 # scalar_prefix_sum[dtype](l) # var report1 = benchmark.run[_scalar](min_runtime_secs=0.5) # var report2 = benchmark.run[_simd](min_runtime_secs=0.5) # report1.print_full("ns") # report2.print_full("ns") --- prefix_sum.csv --- Std int8 , 256 , 56 ,0.21875 Std int16 , 256 , 29 ,0.11328125 Std int32 , 256 , 39 ,0.15234375 Std int64 , 256 , 64 ,0.25 Std int8 , 2048 , 102 ,0.0498046875 Std int16 , 2048 , 156 ,0.076171875 Std int32 , 2048 , 247 ,0.12060546875 Std int64 , 2048 , 498 ,0.2431640625 Std int8 , 8192 , 414 ,0.050537109375 Std int16 , 8192 , 669 ,0.0816650390625 Std int32 , 8192 , 1353 ,0.1651611328125 Std int64 , 8192 , 2964 ,0.36181640625 Std int8 ,65536 , 14509 ,0.2213897705078125 Std int16 ,65536 , 28283 ,0.4315643310546875 Std int32 ,65536 , 59010 ,0.900421142578125 Std int64 ,65536 ,118922 ,1.814605712890625 Scalar int8 , 256 , 136 ,0.53125 Scalar int16 , 256 , 135 ,0.52734375 Scalar int32 , 256 , 137 ,0.53515625 Scalar int64 , 256 , 138 ,0.5390625 Scalar int8 , 2048 , 980 ,0.478515625 Scalar int16 , 2048 , 1101 ,0.53759765625 Scalar int32 , 2048 , 980 ,0.478515625 Scalar int64 , 2048 , 995 ,0.48583984375 Scalar int8 , 8192 , 3891 ,0.4749755859375 Scalar int16 , 8192 , 3914 ,0.477783203125 Scalar int32 , 8192 , 4361 ,0.5323486328125 Scalar int64 , 8192 , 4374 ,0.533935546875 Scalar int8 ,65536 , 35002 ,0.534088134765625 Scalar int16 ,65536 , 34778 ,0.530670166015625 Scalar int32 ,65536 , 30251 ,0.4615936279296875 Scalar int64 ,65536 , 32332 ,0.49334716796875 SIMD int8 , 256 , 52 ,0.203125 SIMD int16 , 256 , 27 ,0.10546875 SIMD int32 , 256 , 34 ,0.1328125 SIMD int64 , 256 , 47 ,0.18359375 SIMD int8 , 2048 , 85 ,0.04150390625 SIMD int16 , 2048 , 138 ,0.0673828125 SIMD int32 , 2048 , 178 ,0.0869140625 SIMD int64 , 2048 , 291 ,0.14208984375 SIMD int8 , 8192 , 301 ,0.0367431640625 SIMD int16 , 8192 , 561 ,0.0684814453125 SIMD int32 , 8192 , 1129 ,0.1378173828125 SIMD int64 , 8192 , 1137 ,0.1387939453125 SIMD int8 ,65536 , 2292 ,0.03497314453125 SIMD int16 ,65536 , 3503 ,0.0534515380859375 SIMD int32 ,65536 , 5191 ,0.0792083740234375 SIMD int64 ,65536 , 11560 ,0.1763916015625 --- prefix_sum/__init__.mojo --- from .prefix_sum import scalar_prefix_sum, simd_prefix_sum --- prefix_sum/prefix_sum.mojo --- from utils.loop import unroll @always_inline fn scalar_prefix_sum[D: DType](inout array: List[SIMD[D, 1]]): var element = array[0] for i in range(1, len(array)): array[i] += element element = array[i] @always_inline fn _sum[width: Int, alignment: Int, loops: Int, D: DType](pointer: DTypePointer[D], carry_over: SIMD[D, 1]) -> SIMD[D, width]: var result = pointer.load[width=width]() @parameter fn add[i: Int](): result += result.shift_right[1 << i]() unroll[add, loops]() result += carry_over return result @always_inline fn simd_prefix_sum[D: DType](inout array: List[SIMD[D, 1]]): @parameter fn inner_func[width: Int, alignment: Int, loops: Int](): var length = len(array) var numbers = DTypePointer[D](array.data.value) var c: SIMD[D, 1] = 0 var i = 0 while i + width <= length: var part = _sum[width, alignment, loops, D](numbers.offset(i), c) c = part[width - 1] numbers.store(i, part) i += width @parameter fn add_rest[round: Int](): alias index = round + 1 alias w = width >> index if i + w <= length: var part = _sum[w, alignment, loops - index, D](numbers.offset(i), c) c = part[w - 1] numbers.store(i, part) i += w unroll[add_rest, loops]() @parameter if D == DType.uint32 or D == DType.int32 or D == DType.float32: alias loops = 6 inner_func[1 << loops, 4, loops]() elif D == DType.uint16 or D == DType.int16 or D == DType.float16: alias loops = 7 inner_func[1 << loops, 2, loops]() elif D == DType.uint8 or D == DType.int8: alias loops = 8 inner_func[1 << loops, 1, loops]() else: alias loops = 5 inner_func[1 << loops, 8, loops]() --- prefix_sum_benchmark.mojo --- from time import now from random import random_float64, random_si64, random_ui64 from math import min from prefix_sum import scalar_prefix_sum, simd_prefix_sum from csv import CsvBuilder fn random_vec[D: DType](size: Int, max: Int = 3000) -> List[SIMD[D, 1]]: var result = List[SIMD[D, 1]](size) for _ in range(size): @parameter if D == DType.int8 or D == DType.int16 or D == DType.int32 or D == DType.int64: result.append(random_si64(0, max).cast[D]()) elif D == DType.float16 or D == DType.float32 or D == DType.float64: result.append(random_float64(0, max).cast[D]()) else: result.append(random_ui64(0, max).cast[D]()) return result fn benchmark[D: DType, func: fn(inout List[SIMD[D, 1]]) -> None]( name: StringLiteral, inout csv_builder: CsvBuilder, size: Int, max: Int = 3000 ): var v = random_vec[D](size, max) var v1 = v var min_duration = 1_000_000_000 for _ in range(10): v1 = v var tik = now() func(v1) var tok = now() min_duration = min(min_duration, tok - tik) var op_name = name + String(" ") + D.__str__() csv_builder.push(op_name) csv_builder.push(size) csv_builder.push(max) csv_builder.push(min_duration) csv_builder.push(Float64(min_duration) / Float64(size)) fn main(): alias D = DType.int32 var csv_builder = CsvBuilder(5) for i in range(8, (1 << 10) + 1, 1): benchmark[D, scalar_prefix_sum[D]]("Scalar", csv_builder, i, 10) benchmark[D, simd_prefix_sum[D]]("SIMD", csv_builder, i, 10) print(csv_builder^.finish()) --- prefix_sum_test.mojo --- from prefix_sum import scalar_prefix_sum, simd_prefix_sum fn main(): alias D = DType.uint64 var length = (1 << 8) + 157 var v1 = List[SIMD[D, 1]](length) var v2 = List[SIMD[D, 1]](length) for i in range(1, length + 1): v1.append(i) v2.append(i) scalar_prefix_sum[D](v1) simd_prefix_sum[D](v2) for i in range(length): if v1[i] != v2[i]: print("Index", i, "is not equal") print("Done!!!") --- std_cumsum_benchmark.mojo --- from algorithm import cumsum from time import now from math import min from prefix_sum import scalar_prefix_sum, simd_prefix_sum from prefix_sum_benchmark import benchmark from csv import CsvBuilder from buffer import Dim, Buffer fn benchmark_other[size: Int, D: DType, func: fn(inout List[SIMD[D, 1]]) -> None](name: StringLiteral, inout csv_builder: CsvBuilder): var min_duration = 1_000_000_000 var value = 0 for _ in range(10): var v1 = List[SIMD[D, 1]](size) v1.resize(size, 0) for i in range(size): v1[i] = i % 4 == 0 var tik = now() func(v1) var tok = now() min_duration = min(min_duration, tok - tik) value = v1[size - 1].to_int() csv_builder.push(name + String(" ") + D.__str__()) csv_builder.push(size) csv_builder.push(value) csv_builder.push(min_duration) csv_builder.push( Float64(min_duration) / Float64(size)) fn benchmark_std[size: Int, D: DType](inout csv_builder: CsvBuilder): var min_duration = 1_000_000_000 var value = 0 for _ in range(10): var p1 = DTypePointer[D].alloc(size) var b1 = Buffer[D, Dim(size)](p1) var p2 = DTypePointer[D].alloc(size) var b2 = Buffer[D, Dim(size)](p2) for i in range(size): b1[i] = i % 4 == 0 var tik = now() cumsum(b2, b1) var tok = now() min_duration = min(min_duration, tok - tik) value = b2[size - 1].to_int() csv_builder.push(String("Std ") + D.__str__()) csv_builder.push(size) csv_builder.push(value) csv_builder.push(min_duration) csv_builder.push(Float64(min_duration) / Float64(size)) fn main(): var csv_builder = CsvBuilder(5) benchmark_std[1 << 8, DType.int8](csv_builder) benchmark_std[1 << 8, DType.int16](csv_builder) benchmark_std[1 << 8, DType.int32](csv_builder) benchmark_std[1 << 8, DType.int64](csv_builder) benchmark_std[1 << 11, DType.int8](csv_builder) benchmark_std[1 << 11, DType.int16](csv_builder) benchmark_std[1 << 11, DType.int32](csv_builder) benchmark_std[1 << 11, DType.int64](csv_builder) benchmark_std[1 << 13, DType.int8](csv_builder) benchmark_std[1 << 13, DType.int16](csv_builder) benchmark_std[1 << 13, DType.int32](csv_builder) benchmark_std[1 << 13, DType.int64](csv_builder) benchmark_std[1 << 16, DType.int8](csv_builder) benchmark_std[1 << 16, DType.int16](csv_builder) benchmark_std[1 << 16, DType.int32](csv_builder) benchmark_std[1 << 16, DType.int64](csv_builder) benchmark_std[1 << 24, DType.int64](csv_builder) benchmark_other[1 << 8, DType.int8, scalar_prefix_sum[DType.int8]]("Scalar", csv_builder) benchmark_other[1 << 8, DType.int16, scalar_prefix_sum[DType.int16]]("Scalar", csv_builder) benchmark_other[1 << 8, DType.int32, scalar_prefix_sum[DType.int32]]("Scalar", csv_builder) benchmark_other[1 << 8, DType.int64, scalar_prefix_sum[DType.int64]]("Scalar", csv_builder) benchmark_other[1 << 11, DType.int8, scalar_prefix_sum[DType.int8]]("Scalar", csv_builder) benchmark_other[1 << 11, DType.int16, scalar_prefix_sum[DType.int16]]("Scalar", csv_builder) benchmark_other[1 << 11, DType.int32, scalar_prefix_sum[DType.int32]]("Scalar", csv_builder) benchmark_other[1 << 11, DType.int64, scalar_prefix_sum[DType.int64]]("Scalar", csv_builder) benchmark_other[1 << 13, DType.int8, scalar_prefix_sum[DType.int8]]("Scalar", csv_builder) benchmark_other[1 << 13, DType.int16, scalar_prefix_sum[DType.int16]]("Scalar", csv_builder) benchmark_other[1 << 13, DType.int32, scalar_prefix_sum[DType.int32]]("Scalar", csv_builder) benchmark_other[1 << 13, DType.int64, scalar_prefix_sum[DType.int64]]("Scalar", csv_builder) benchmark_other[1 << 16, DType.int8, scalar_prefix_sum[DType.int8]]("Scalar", csv_builder) benchmark_other[1 << 16, DType.int16, scalar_prefix_sum[DType.int16]]("Scalar", csv_builder) benchmark_other[1 << 16, DType.int32, scalar_prefix_sum[DType.int32]]("Scalar", csv_builder) benchmark_other[1 << 16, DType.int64, scalar_prefix_sum[DType.int64]]("Scalar", csv_builder) benchmark_other[1 << 24, DType.int64, scalar_prefix_sum[DType.int64]]("Scalar", csv_builder) benchmark_other[1 << 8, DType.int8, simd_prefix_sum[DType.int8]]("SIMD", csv_builder) benchmark_other[1 << 8, DType.int16, simd_prefix_sum[DType.int16]]("SIMD", csv_builder) benchmark_other[1 << 8, DType.int32, simd_prefix_sum[DType.int32]]("SIMD", csv_builder) benchmark_other[1 << 8, DType.int64, simd_prefix_sum[DType.int64]]("SIMD", csv_builder) benchmark_other[1 << 11, DType.int8, simd_prefix_sum[DType.int8]]("SIMD", csv_builder) benchmark_other[1 << 11, DType.int16, simd_prefix_sum[DType.int16]]("SIMD", csv_builder) benchmark_other[1 << 11, DType.int32, simd_prefix_sum[DType.int32]]("SIMD", csv_builder) benchmark_other[1 << 11, DType.int64, simd_prefix_sum[DType.int64]]("SIMD", csv_builder) benchmark_other[1 << 13, DType.int8, simd_prefix_sum[DType.int8]]("SIMD", csv_builder) benchmark_other[1 << 13, DType.int16, simd_prefix_sum[DType.int16]]("SIMD", csv_builder) benchmark_other[1 << 13, DType.int32, simd_prefix_sum[DType.int32]]("SIMD", csv_builder) benchmark_other[1 << 13, DType.int64, simd_prefix_sum[DType.int64]]("SIMD", csv_builder) benchmark_other[1 << 16, DType.int8, simd_prefix_sum[DType.int8]]("SIMD", csv_builder) benchmark_other[1 << 16, DType.int16, simd_prefix_sum[DType.int16]]("SIMD", csv_builder) benchmark_other[1 << 16, DType.int32, simd_prefix_sum[DType.int32]]("SIMD", csv_builder) benchmark_other[1 << 16, DType.int64, simd_prefix_sum[DType.int64]]("SIMD", csv_builder) benchmark_other[1 << 24, DType.int64, simd_prefix_sum[DType.int64]]("SIMD", csv_builder) print(csv_builder^.finish()) --- vector_utils/__init__.mojo --- from .vector_utils import vector, print_v, print_iv --- vector_utils/vector_utils.mojo --- fn print_v[D: DType, size: Int = 1](v: DynamicVector[SIMD[D, size]]): print_no_newline("(") print_no_newline(len(v)) print_no_newline(")") print_no_newline("[") for i in range(len(v)): print_no_newline(v[i]) print_no_newline(", ") print("]") --- .github/workflows/jekyll-gh-pages.yml --- # Sample workflow for building and deploying a Jekyll site to GitHub Pages name: Deploy Jekyll with GitHub Pages dependencies preinstalled on: # Runs on pushes targeting the default branch push: branches: ["main"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false jobs: # Build job build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Pages uses: actions/configure-pages@v4 - name: Build with Jekyll uses: actions/jekyll-build-pages@v1 with: source: ./ destination: ./_site - name: Upload artifact uses: actions/upload-pages-artifact@v3 # Deployment job deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 --- .gitignore --- # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # VSCode .vscode/settings.json # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ --- COMPLEX.md --- ### Complex Numbers A Complex Number is able to be created using the `ComplexNum` struct, and is constructed as follows: ```py # ComplexNum(re: Float64, im: Float64) var myComplex = ComplexNum() ``` **Reading Values** You can read the real and imaginary values from the Complex Number as follows: ```py myComplex[0] # This returns the real value myComplex[1] # This returns the imaginary value ``` **Setting Values** You can set the real and imaginary values as follows: ```py myComplex[0] = 0.1 # Sets real myComplex[1] = 0.2 # Sets imaginary ``` **Printing** You can print the number as follows: ```py myComplex.print() # Prints formatted number (0 + 2i, 5 - 3i) ``` **Operating** You can add, subtract, and multiply Complex Numbers with the `+, -, *` operators respectively. **Conjugation** You can retrieve the conjugate of the number with the `ComplexNum.conjugate()` or `ComplexNum.c()` methods as follows: ```py var newComplex = myComplex.c() ``` Or, alternatively, with the `__inverse__` dunder method, as follows: ```py var newComplex = ~myComplex() ``` These two work exactly the same. **Magnitude** You can retrieve the magnitude of the number with the `ComplexNum.magnitude` or `ComplexNum.m` methods as follows: ```py var magnitude = myComplex.m() ``` ### Complex Arrays Complex Arrays are Arrays that store Complex Numbers (`ComplexNum`s) **Constructing** It is constructed as follows: ```py # ComplexArray(length: Int, default_value: ComplexNum = ComplexNum(0,0)) var myArray = ComplexArray(3) # This creates a Complex Array of length 3 with 0 + 0i in every index. var myArray = ComplexArray(5, ComplexNum(0,-2)) # This creates a Complex Array of length 5 with 0 - 2i in every index. ``` **Getting and Setting** You can get and set the items with the `__getitem__` and `__setitem__` dunder methods, as follows: ```py myArray[0] = ComplexNum(0,1) myArray[0].print() # Prints 0 + 1i ``` **Printing** You can also print the array's contents with `ComplexArray.print` as follows: ```py myArray.print() ``` ### Complex Matrices We step away from Arrays and move into Matrices. These form the basis for Qubits and Quantum Gates. **Constructing** You can construct one as follows: ```py # ComplexMatrix(rows: Int, cols: Int, default_value: ComplexNum = ComplexNum(0,0)) var myMatrix = ComplexMatrix(3, 3) # Creates a 3x3 Matrix with values set to 0 + 0i var myMatrix = ComplexMatrix(3, 4, ComplexNum(1,2)) # Creates a 3x4 Matrix with values set to 1 + 2i ``` **Getting and Setting** You can set and get values from the matrix with the following syntax: ```py # ComplexMatrix[row: Int, col: Int] var value = myMatrix[0, 0] myMatrix[0,1] = ComplexNum(1,2) ``` **Operating** You can perform elementary operations with the `+, -` operators. The `*` operator is overloaded: - `ComplexMatrix * Float64`: Every element of the matrix is multiplied by the Float value - `ComplexMatrix * ComplexArray`: Every row of the matrix is multiplied element-wise with the `ComplexArray` - `ComplexMatrix * ComplexMatrix`: The two matrices are multiplied element-wise. The `@` operator achieves matrix multiplication. ```py var newMat = myMatrixOne @ myMatrixTwo ``` **Transposing** You can transpose any Complex Matrix with the `ComplexMatrix.transpose`, which swaps the axes. ```py var transposed = myMatrix.transpose() ``` You can get the conjugate transpose of any Complex Matrix with the `ComplexMatrix.conjugate_transpose` method: ```py var conj_trans = myMatrix.conjugate_transpose() ``` **Printing** And of course, you can print the contents with `ComplexMatrix.print()` --- LICENSE --- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- README.md --- # Quojo A Quantum Computing Simulation written in Mojo. This really only serves as one of my passion projects, but I would like it to expand into a larger platform for Quantum Development. Moved to a Python adaptation, [PyQ](https://github.com/Deftioon/PyQ) ## Goals This project aims to: - Provide an easy to use, comprehensible, and simple interface to simulate operations on a Quantum System - This will be done with a simple `QuantumWire("H X Y H")` Quantum Wiring Syntax, `Circuit.Connect(Wire, Wire)` Quantum Circuitry Syntax to give full freedom on the customizability of Quantum Circuits. - Fast, Parallelized Compute on Quantum Operations. - This will make use of Mojo's fast parallelization, tiling, and autotune to optimize Matrix operations. Eventually when enabled to run on GPU, we will utilize GPU to perform matrix operations for more speed. ## TODO: - Implement Uncomputing - Implement Quantum RAM - Implement Quantum Circuits - Add Sample Programs (Quantum Search, Quantum Teleportation) - Optimize code and make it more readable - Parallelize Quantum Gates ## Usage See [USAGE.md](USAGE.md) ## Complex Number Module See [COMPLEX.md](COMPLEX.md) ## Sample Programs ### Quantum Search With a classical computer, a linear search has time complexity $O(n)$. With a Quantum Computer, a Quantum Search has time complexity $O(\sqrt{n})$. --- USAGE.md --- ## Usage ### Creating a Qubit (Quantum Bit) Use the `Qubit` Struct to create a qubit using a string representing a basis state. ```py # Qubit(State: Int) var myQubit = Qubit("1") ``` The mapping of String to Basis State is as follows: `"0"` $\rightarrow|0\rangle$ `"1"` $\rightarrow|1\rangle$ It is not allowed to input any String other than `"0"` or `"1"`, doing so will create an `Exception` and terminate the code if unhandled. The `print` method in the `Qubit` struct can be used to print the contents of the Qubit (this is NOT recommended as it breaks the rules of physics, but only serves for observing purposes and does not affect the workings of the circuits) Constructing a Qubit with a predefined state is also possible. ```py import complexNum as complx var State = complx.ComplexMatrix(1,2) State[0,0] = complx.ComplexNum(0.8,0) State[0,1] = complx.ComplexNum(0.6,0) var myQubit = Qubit(State) ``` The magnitudes of the squares of the two components of the Qubit, here being `State[0, 0]` and `State[0, 1]`, **must** sum to 1 by the 2nd axiom of probability theory. This is not strongly restrained so far, but is assumed when **measuring**. ### Measuring Measuring a Qubit is an irreversible operation, and therefore after measuring a Qubit the object will be overwritten to whatever was measured: either $|0\rangle$ or $|1\rangle$. With Qubit $\alpha|0\rangle + \beta|1\rangle$, the probability amplitude of measuring $|0\rangle$ is of probability $|\alpha^2|$, and likewise the probability of measuring $|1\rangle$. is $|\beta^2|$. You can measure a Qubit with the `measure` method from the `Qubit` struct. ```py var myQubit = Qubit(1) # Qubit.measure() -> None myQubit.measure() ``` ### Creating a Qudit (Quantum Register) Qudits are basically wider Qubits. You can define a Qudit as follows: ```py var qudit = Qudit("1000") ``` Where the string in the `Qudit()` represents the basis state the Qudit will be set to. ### Quantum Gates Quantum Gates are unitary matrices that can be multiplied with Qubits to manipulate them. ```py let Gates = QuantumGates() var myQubit = Qubit(0) ``` #### Currently Supported Gates: - Pauli X, Y, and Z gates ```py var xBit = Gates.X(myQubit) var yBit = Gates.Y(myQubit) var zBit = Gates.Z(myQubit) ``` - Hadamard Gate ```py var hBit = Gates.H(myQubit) ``` - Phase Shift (P, S) Gate ```py var pBit = Gates.P(myQubit, phi) # Here, Phi is an angle measured in radians and rotates the Qubit by phi radians on the z axis on the Bloch Sphere var pBit = Gates.S(myQubit, phi) ``` S by default has a `phi` value of $\frac{\pi}{2}$. To use other `phi` values use the `P` gate. #### Gates operating on Qudits - CNOT - Only operable on Qudits of width 2 ```py var myQudit = Qudit(2) var p = Qubit("0") var q = Qubit("1") myQudit[0] = p myQudit[1] = q var r = Gates.CNOT(myQudit) r.print() # 1.0 0.0 # 0.0 0.0 # 1.0 0.0 # 0.0 0.0 ``` `CX()` is also a valid function, running the `CNOT` method. - SWAP - Only Operable on Qudits of width 2 ```py var r = Gates.SWAP(myQudit) r.print() # 1.0 0.0 # 0.0 0.0 # 0.0 0.0 # 1.0 0.0 ``` - CCNOT (Toffioli - Only Operable on Qudits of width 3) ```py var myQudit = Qudit(3) var p = Qubit("0") var q = Qubit("1") var k = Qubit("1") myQudit[0] = p myQudit[1] = q myQudit[2] = k var r = Gates.CCNOT(myQudit) r.print() ``` `CCX()` is also a valid function, running the `CCNOT` method. Current CCNOT implementation is cheesy and flimsy, expect errors to occur. ### Parallel Gates? Parallel Gates will certainly be implemented in the future, but it is not top priority as it is impractical, or rather, it uses too many resources to be applied practically. To put this into perspective, lets look at the Hadamard Gate. To apply a Hadamard Gate on two qubits together, we need a 4x4 Matrix. Three qubits corresponds to a 8x8, And at 16 Qubits we're looking at a gate size of 65,536 by 65,536, which takes quite a while to multiply. The lower-bound time complexity for multiplying two of such matrices is $\Omega(n^2\log{n})$ To quote Wikipedia (not good source I know), > The time complexity for multiplying two $n\times n$ matrices is at least $\Omega(n^2\log{n})$, if using a classical machine. Because the size of a gate that operates on $q$ qubits is $2^q\times 2^q$ it means that the time for simulating a step in a quantum circuit (by means of multiplying the gates) that operates on generic entangled states is $\Omega(2^{q^2}\log{2^q})$. For this reason it is believed to be intractable to simulate large entangled quantum systems using classical computers. ### Quantum Wires In Quojo, Quantum Wires serve as a medium to create a sort of "Compound Gate". Gates can be strung together to pass a Qubit through all of them at once. This reduces the need for repeated Gates in the circumstance that a certain sequence of gates needs to be repeated, for example if using a Hadamard and a Pauli X gate, a Quantum Gate can be constructed to call only once to pass a Qubit through both of these gates. If a wire was not used, then it would take two calls and a lot of repetition. Quantum Wires also aid in the construction of Quantum Circuits, which are essentially Quantum Wires but involve multiple qubits and multiple wires. You can construct a Quantum Wire as follows: ```py var Wire = QuantumWire("H X Y Z M") ``` A wire is constructed using a string of gates, each gate separated by a space. `Wire.help()` prints a directory of every gate able to be added. ```py Wire.help() # -------QUANTUM WIRE HELP-------- # Valid States: "I H X Y Z S M" # I: Identity Gate # H: Hadamard Gate # X: Pauli-X Gate # Y: Pauli-Y Gate # Z: Pauli-Z Gate # S: Phase Gate # M: Measure Qubit # -------------------------------- ``` Gates can be added to Wires with `add`. ```py Wire.add("H") ``` Wires can be printed with `print` with pretty formatting ```py Wire.print() # ▯ -H-X-Y-Z-M-H-> ``` Qubits can be passed through Wires with the `parse` method. ```py var q = Qubit("0") var wire = QuantumWire("H X Y Z H H I H") var r = wire.parse(q) ``` ### Quantum Circuits Work in Progress --- samples/quantumSearch.mojo --- --- src/quojo/complexNum.mojo --- from memory.unsafe import Pointer from complex import ComplexSIMD struct ComplexNum: var re: Float64 var im: Float64 fn __init__(inout self, re: Float64, im: Float64) -> None: self.re = re self.im = im fn __copyinit__(inout self, existing: Self) -> None: self.re = existing.re self.im = existing.im fn __add__(borrowed self, other: ComplexNum) -> ComplexNum: return ComplexNum(self.re + other.re, self.im + other.im) fn __sub__(borrowed self, other: ComplexNum) -> ComplexNum: return ComplexNum(self.re - other.re, self.im - other.im) fn __mul__(borrowed self, other: ComplexNum) -> ComplexNum: return ComplexNum(self.re * other.re - self.im * other.im, self.re * other.im + self.im * other.re) fn __mul__(borrowed self, other: Float64) -> ComplexNum: return ComplexNum(self.re * other, self.im * other) fn __invert__(borrowed self) -> ComplexNum: return ComplexNum(self.re, -self.im) fn __ne__(borrowed self, other: ComplexNum) -> Bool: return self.re != other.re or self.im != other.im fn __getitem__(borrowed self, i: Int) raises -> Float64 : if i == 0: return self.re elif i == 1: return self.im else: raise("ComplexNum: getitem -> Index out of range. Can only use indices 0 and 1 to get real and imaginary components respectively") fn __setitem__(inout self, i: Int, value: ComplexNum) raises -> None: if i == 0: self.re = value.re elif i == 1: self.im = value.im else: raise("ComplexNum: setitem -> Index out of range. Can only set indices 0 and 1 to set real and imaginary components respectively") fn print(borrowed self) -> None: if self.im >= 0: print(self.re, "+", self.im, "i") else: print(self.re, "-", -1 * self.im, "i") fn conjugate(borrowed self) -> ComplexNum: return ComplexNum(self.re, -self.im) fn magnitude(borrowed self) -> Float64: return (self.re * self.re + self.im * self.im) ** 0.5 fn c(borrowed self) -> ComplexNum: return ComplexNum(self.re, -self.im) fn m(borrowed self) -> Float64: return (self.re * self.re + self.im * self.im) ** 0.5 struct ComplexArray: var ArrPointer: Pointer[Float64] var len: Int fn __init__(inout self, length: Int, default_value: ComplexNum = ComplexNum(0,0)) raises -> None: self.len = length self.ArrPointer = Pointer[Float64].alloc(length * 2) for i in range(length): self[i] = default_value fn __copyinit__(inout self, existing: Self) -> None: self.len = existing.len self.ArrPointer = existing.ArrPointer fn __getitem__(borrowed self, i: Int) raises -> ComplexNum: if i > self.len - 1: raise("ComplexArray: getitem -> Index out of range") return ComplexNum(self.ArrPointer.load(i * 2), self.ArrPointer.load(i * 2 + 1)) fn __setitem__(inout self, loc: Int, item: ComplexNum) raises -> None : if loc > self.len - 1: raise("ComplexArray: setitem -> Index out of range") self.ArrPointer.store(loc * 2, item.re) self.ArrPointer.store(loc * 2 + 1, item.im) fn print(inout self) raises -> None: for i in range(self.len): print(self[i].re, "+", self[i].im, "i") struct ComplexMatrix: var rows: Int var cols: Int var data: ComplexArray fn __init__(inout self, rows: Int, cols: Int, default_value: ComplexNum = ComplexNum(0,0)) raises -> None: self.rows = rows self.cols = cols self.data = ComplexArray(rows * cols, default_value) fn __copyinit__(inout self, existing: Self) -> None: self.rows = existing.rows self.cols = existing.cols self.data = existing.data fn __getitem__(borrowed self, i: Int, j: Int) raises -> ComplexNum: if i > self.rows - 1 or j > self.cols - 1: raise("ComplexMatrix: getitem -> Index out of range") return self.data[i * self.cols + j] fn __setitem__(inout self, i: Int, j: Int, value: ComplexNum) raises -> None: if i > self.rows - 1 or j > self.cols - 1: raise("ComplexMatrix: setitem -> Index out of range") self.data[i * self.cols + j] = value fn __add__(borrowed self, other: ComplexMatrix) raises -> ComplexMatrix: if self.rows != other.rows or self.cols != other.cols: raise("ComplexMatrix: add -> Matrix dimensions do not match") var result = ComplexMatrix(self.rows, self.cols) for i in range(self.rows): for j in range(self.cols): result.data[i * self.cols + j] = self.data[i * self.cols + j] + other.data[i * other.cols + j] return result fn __mul__(borrowed self, other: Float64) raises -> ComplexMatrix: var result = ComplexMatrix(self.rows, self.cols) for i in range(self.rows): for j in range(self.cols): result.data[i * self.cols + j] = self.data[i * self.cols + j] * other return result fn __mul__(borrowed self, other: ComplexNum) raises -> ComplexMatrix: var result = ComplexMatrix(self.rows, self.cols) for i in range(self.rows): for j in range(self.cols): result.data[i * self.cols + j] = self.data[i * self.cols + j] * other return result fn __mul__(borrowed self, other: ComplexArray) raises -> ComplexMatrix: if self.cols != other.len: raise("ComplexMatrix: mul -> Matrix dimensions on 0th axis do not match") var result = ComplexMatrix(self.rows, self.cols) for i in range(self.rows): for j in range(self.cols): result[i, j] = self[i, j] * other[i] return result fn __mul__(borrowed self, other: ComplexMatrix) raises -> ComplexMatrix: var result = ComplexMatrix(self.rows * other.rows, self.cols * other.cols) for i in range(self.rows): for j in range(self.cols): for k in range(other.rows): for l in range(other.cols): result[i * other.rows + k, j * other.cols + l] = self[i, j] * other[k, l] return result fn __matmul__(borrowed self, other: ComplexMatrix) raises -> ComplexMatrix: if self.cols != other.rows: raise("ComplexMatrix: mul -> Matrix dimensions do not match") var result = ComplexMatrix(self.rows, other.cols) for i in range(self.rows): for j in range(other.cols): for k in range(self.cols): result.data[i * other.cols + j] = result.data[i * other.cols + j] + self.data[i * self.cols + k] * other.data[k * other.cols + j] return result fn transpose(borrowed self) raises -> ComplexMatrix: var result = ComplexMatrix(self.cols, self.rows) for i in range(self.rows): for j in range(self.cols): result.data[j * self.rows + i] = self.data[i * self.cols + j] return result fn conjugate_transpose(borrowed self) raises -> ComplexMatrix: var result = ComplexMatrix(self.cols, self.rows) for i in range(self.rows): for j in range(self.cols): result.data[j * self.rows + i] = ~self.data[i * self.cols + j] return result fn print(borrowed self) raises -> None: for i in range(self.rows): for j in range(self.cols): print(i, j, end = " ") self.data[i * self.cols + j].print() --- src/quojo/quantum.mojo --- import complexNum as comp import random from math import sin, cos from collections.list import List from collections.dict import Dict, KeyElement struct QuantumGates: var HadamardMatrix: comp.ComplexMatrix var mX: comp.ComplexMatrix var mY: comp.ComplexMatrix var mZ: comp.ComplexMatrix var mP: comp.ComplexMatrix var mT: comp.ComplexMatrix var mCNOT: comp.ComplexMatrix var mSWAP: comp.ComplexMatrix var mCCNOT: comp.ComplexMatrix var IdentityMatrix: comp.ComplexMatrix fn __init__(inout self) raises: # Initialise Identity Gate self.IdentityMatrix = comp.ComplexMatrix(2, 2) self.IdentityMatrix[0, 0] = comp.ComplexNum(1, 0) self.IdentityMatrix[1, 1] = comp.ComplexNum(1, 0) # Initialise Hadamard Gate self.HadamardMatrix = comp.ComplexMatrix(2, 2) self.HadamardMatrix[0, 0] = comp.ComplexNum(1, 0) self.HadamardMatrix[0, 1] = comp.ComplexNum(1, 0) self.HadamardMatrix[1, 0] = comp.ComplexNum(1, 0) self.HadamardMatrix[1, 1] = comp.ComplexNum(-1, 0) self.HadamardMatrix = self.HadamardMatrix * (1 / (2.0 ** 0.5)) # Initialise Phase Shift Gate self.mP = comp.ComplexMatrix(2, 2) self.mP[0, 0] = comp.ComplexNum(1, 0) self.mP[1, 1] = comp.ComplexNum(0, 1) self.mT = comp.ComplexMatrix(2, 2) self.mT[0, 0] = comp.ComplexNum(1, 0) self.mT[1, 1] = comp.ComplexNum(cos[DType.float64, 1](0.25 * 3.14159265358979323846), sin[DType.float64, 1](0.25 * 3.14159265358979323846)) # Initialise Pauli- X,Y,Z Gates self.mX = comp.ComplexMatrix(2, 2) self.mX[0, 1] = comp.ComplexNum(1, 0) self.mX[1, 0] = comp.ComplexNum(1, 0) self.mY = comp.ComplexMatrix(2, 2) self.mY[0, 1] = comp.ComplexNum(0, -1) self.mY[1, 0] = comp.ComplexNum(0, 1) self.mZ = comp.ComplexMatrix(2, 2) self.mZ[0, 0] = comp.ComplexNum(1, 0) self.mZ[1, 1] = comp.ComplexNum(-1, 0) # Initialise CNOT Gate self.mCNOT = comp.ComplexMatrix(4, 4) self.mCNOT[0, 0] = comp.ComplexNum(1, 0) self.mCNOT[1, 1] = comp.ComplexNum(1, 0) self.mCNOT[2, 3] = comp.ComplexNum(1, 0) self.mCNOT[3, 2] = comp.ComplexNum(1, 0) # Initialise SWAP Gate self.mSWAP = comp.ComplexMatrix(4, 4) self.mSWAP[0, 0] = comp.ComplexNum(1, 0) self.mSWAP[1, 2] = comp.ComplexNum(1, 0) self.mSWAP[2, 1] = comp.ComplexNum(1, 0) self.mSWAP[3, 3] = comp.ComplexNum(1, 0) # CCNOT Gate self.mCCNOT = comp.ComplexMatrix(8, 8) self.mCCNOT[0, 0] = comp.ComplexNum(1, 0) self.mCCNOT[1, 1] = comp.ComplexNum(1, 0) self.mCCNOT[2, 2] = comp.ComplexNum(1, 0) self.mCCNOT[3, 3] = comp.ComplexNum(1, 0) self.mCCNOT[4, 4] = comp.ComplexNum(1, 0) self.mCCNOT[5, 5] = comp.ComplexNum(1, 0) self.mCCNOT[6, 7] = comp.ComplexNum(1, 0) self.mCCNOT[7, 6] = comp.ComplexNum(1, 0) fn __copyinit__(inout self, existing: Self): self.HadamardMatrix = existing.HadamardMatrix self.mX = existing.mX self.mY = existing.mY self.mZ = existing.mZ self.mP = existing.mP self.mT = existing.mT self.mCNOT = existing.mCNOT self.mSWAP = existing.mSWAP self.mCCNOT = existing.mCCNOT self.IdentityMatrix = existing.IdentityMatrix # One Qubit Gates fn Hadamard(borrowed self, other: Qubit) raises -> Qubit: return Qubit(other.qubit @ self.HadamardMatrix) fn PauliX(borrowed self, other: Qubit) raises -> Qubit: return Qubit(other.qubit @ self.mX) fn PauliY(borrowed self, other: Qubit) raises -> Qubit: return Qubit(other.qubit @ self.mY) fn PauliZ(borrowed self, other: Qubit) raises -> Qubit: return Qubit(other.qubit @ self.mZ) fn PhaseShift(borrowed self, other: Qubit) raises -> Qubit: return Qubit(other.qubit @ self.mP) fn PhaseShift(borrowed self, other: Qubit, phi: Float64) raises -> Qubit: var mP = comp.ComplexMatrix(2, 2) mP[0, 0] = comp.ComplexNum(1, 0) mP[1, 1] = comp.ComplexNum(cos[DType.float64, 1](phi), sin[DType.float64, 1](phi)) return Qubit(other.qubit @ mP) fn Identity(borrowed self, other: Qubit) raises -> Qubit: return Qubit(other.qubit @ self.IdentityMatrix) fn H(borrowed self, other: Qubit) raises -> Qubit: return self.Hadamard(other) fn X(borrowed self, other: Qubit) raises -> Qubit: return self.PauliX(other) fn Y(borrowed self, other: Qubit) raises -> Qubit: return self.PauliY(other) fn Z(borrowed self, other: Qubit) raises -> Qubit: return self.PauliZ(other) fn P(borrowed self, other: Qubit) raises -> Qubit: return self.PhaseShift(other) fn S(borrowed self, other: Qubit) raises -> Qubit: return self.PhaseShift(other) fn T(borrowed self, other: Qubit) raises -> Qubit: return Qubit(other.qubit @ self.mT) fn I(borrowed self, other: Qubit) raises -> Qubit: return self.Identity(other) # Qudit Gates fn ParallelHadamard(borrowed self, states: Qudit) raises -> Qudit: var pH = self.HadamardMatrix for i in range(states.width - 1): pH = pH * self.HadamardMatrix return Qudit(states.qudit @ pH) fn ParallelPauliX(borrowed self, states: Qudit) raises -> Qudit: var pX = self.mX for i in range(states.width - 1): pX = pX * self.mX return Qudit(states.qudit @ pX) fn ParallelPauliY(borrowed self, states: Qudit) raises -> Qudit: var pY = self.mY for i in range(states.width - 1): pY = pY * self.mY return Qudit(states.qudit @ pY) fn ParallelPauliZ(borrowed self, states: Qudit) raises -> Qudit: var pZ = self.mZ for i in range(states.width - 1): pZ = pZ * self.mZ return Qudit(states.qudit @ pZ) fn ParallelPhaseShift(borrowed self, states: Qudit) raises -> Qudit: var mP = self.mP for i in range(states.width - 1): mP = mP * self.mP return Qudit(states.qudit @ mP) fn ParallelTGate(borrowed self, states: Qudit) raises -> Qudit: var mP = self.mT for i in range(states.width - 1): mP = mP * self.mT return Qudit(states.qudit @ mP) fn ParallelIdentity(borrowed self, states: Qudit) raises -> Qudit: var mI = self.IdentityMatrix for i in range(states.width - 1): mI = mI * self.IdentityMatrix return Qudit(states.qudit @ mI) fn ParallelCNOT(borrowed self, states: Qudit) raises -> Qudit: var pCNOT = self.mCNOT for i in range((states.width - 2)/2): pCNOT = pCNOT * self.mCNOT return Qudit(states.qudit @ pCNOT) fn ParallelSWAP(borrowed self, states: Qudit) raises -> Qudit: var pSWAP = self.mSWAP for i in range((states.width - 2)/2): pSWAP = pSWAP * pSWAP return Qudit(states.qudit @ pSWAP) fn ParallelCCNOT(borrowed self, states: Qudit) raises -> Qudit: var pCCNOT = self.mCCNOT for i in range((states.width - 3)/3): pCCNOT = pCCNOT * self.mCCNOT return Qudit(states.qudit @ pCCNOT) fn H(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelHadamard(states) fn X(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelPauliX(states) fn Y(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelPauliY(states) fn Z(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelPauliZ(states) fn P(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelPhaseShift(states) fn S(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelPhaseShift(states) fn T(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelTGate(states) fn I(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelIdentity(states) fn CNOT(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelCNOT(states) fn SWAP(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelSWAP(states) fn CCNOT(borrowed self, states: Qudit) raises -> Qudit: return self.ParallelCCNOT(states) struct Qubit: var qubit: comp.ComplexMatrix fn __init__(inout self, state: StringLiteral) raises: # Initialise Qubit if state != "0" and state != "1": raise "Invalid Qubit State" self.qubit = comp.ComplexMatrix(1, 2) self.qubit[0, atol(state)] = comp.ComplexNum(1, 0) fn __init__(inout self, state: comp.ComplexMatrix) raises: self.qubit = state fn __init__(inout self) raises: self.qubit = comp.ComplexMatrix(1, 2) fn __copyinit__(inout self, existing: Self): self.qubit = existing.qubit fn __getitem__(borrowed self, index: Int) raises -> comp.ComplexNum: return self.qubit[0, index] fn __setitem__(inout self, index: Int, value: comp.ComplexNum) raises: self.qubit[0, index] = value fn print(borrowed self) raises: for i in range(2): print(self.qubit[0, i].re, self.qubit[0, i].im) fn measure(inout self) raises -> Qubit: random.seed() var randNum = random.random_float64() var alpha = (self.qubit[0, 0] * self.qubit[0,0]).magnitude() if randNum < alpha: self.qubit = comp.ComplexMatrix(1, 2) self.qubit[0, 0] = comp.ComplexNum(1, 0) else: self.qubit = comp.ComplexMatrix(1, 2) self.qubit[0, 1] = comp.ComplexNum(1, 0) print("Measured Qubit: ") self.qubit.print() return self struct Qudit: var qudit: comp.ComplexMatrix var width: Int fn __init__(inout self, state: String) raises: self.width = len(state) self.qudit = comp.ComplexMatrix(1, 2 ** self.width) var binary_num = atol(state) var decimal_num = 0 var power = 0 while binary_num > 0: decimal_num += 2 ** power * (binary_num % 10) binary_num = binary_num // 10 power += 1 self.qudit[0, decimal_num] = comp.ComplexNum(1, 0) fn __init__(inout self, state: comp.ComplexMatrix) raises: self.width = state.cols self.qudit = state fn __init__(inout self, size: Int) raises: self.width = size self.qudit = comp.ComplexMatrix(1, 2 ** size) fn __copyinit__(inout self, existing: Self): self.width = existing.width self.qudit = existing.qudit fn __getitem__(borrowed self, index: Int) raises -> comp.ComplexNum: return self.qudit[0, index] fn __setitem__(inout self, index: Int, value: comp.ComplexNum) raises: self.qudit[0, index] = value fn print(borrowed self) raises: self.qudit.print() fn measure(inout self) raises -> None: random.seed() var randNum = random.random_float64() var sum: Float64 = 0.0 var index = 0 for i in range(self.width): sum += (self.qudit[0, i] * self.qudit[0, i]).magnitude() if randNum < sum: index = i break self.qudit = comp.ComplexMatrix(1, self.width) self.qudit[0, index] = comp.ComplexNum(1, 0) self.print() --- src/quojo/quantumComputer.mojo --- import quantum as Q from quantum import QuantumGates as Gates import complexNum as comp from collections.list import List #TODO: Apply Memory Paging of 4 Qubit struct QuantumPages: #Quantum Memory Cells var top: Int var addresses: List[Int] var data: comp.ComplexArray fn __init__(inout self, capacity: Int) raises: self.top = 1 self.addresses = List[Int]() self.addresses.append(1) self.data = comp.ComplexArray(capacity + 1) fn dump(inout self) raises: for i in range(1, self.data.len): self.data[i].print() fn delete(inout self, address: Int) raises: if address >= len(self.addresses) - 1: raise("Address does not exist") var size = self.addresses[address + 1] - self.addresses[address] var start = self.addresses[address] # clear data from start to start + size for i in range(start, start+size): self.data[i] = comp.ComplexNum(0,0) fn write(inout self, contents: Q.Qubit, mode: String, address: Int = 0) raises: if mode == "a": var size = 2 for i in range(size): self.data[self.top + i] = contents.qubit[0, i] self.top += size self.addresses.append(self.top) if mode == "o": var size = 2 var start = self.addresses[address] self.delete(address) for i in range(start, start + size): self.data[i] = contents.qubit[0, i - start] --- .github/workflows/build.yml --- name: Build and Release # define your mojo package name here # set the path to the directory containing the module files env: PACKAGE_NAME: mo_time.mojopkg MOJO_DIR: mo_time MOJO_HOME: /home/runner/.modular/pkg/packages.modular.com_mojo/bin on: workflow_dispatch jobs: build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - name: Install dependencies run: | curl https://get.modular.com | MODULAR_AUTH=${{ secrets.MODULAR_AUTH }} sh - modular install mojo - name: Build run: | ${{ env.MOJO_HOME }}/mojo package ${{ env.MOJO_DIR }} -o ${{ github.workspace }}/${{ env.PACKAGE_NAME }} - name: Upload package uses: actions/upload-artifact@v3 with: name: ${{ env.PACKAGE_NAME }} path: ${{ github.workspace }}/${{ env.PACKAGE_NAME }} --- .gitignore --- .env_setup.sh dist/ --- LICENSE --- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- README.md --- ![](https://img.shields.io/badge/status-alpha-orange) Please don't put negative numbers in `plus_*` functions yet 😬 ## Usage Grab a `.mojopkg` from the releases, or clone this repo and run `make build` ```python from mo_time import Instant, DateTimeLocal # Instantiate with the .now static methods DateTimeLocal.now_utc() DateTimeLocal.now() # or from an Instant let instant = Instant.now() DateTimeLocal.from_instant(instant) DateTimeLocal.from_instant_utc(instant) # or with the constructor DateTimeLocal(2023, 9, 14, 0, 0, 0) # convert back and forth between python and mojo let py_dt = DateTimeLocal.now().to_py() let mojo_dt = DateTimeLocal.from_py(py_dt) # Print let dt = DateTimeLocal.now_utc() print(dt.__str__()) # Supports basic arithmetic dt.plus_years(1) dt.plus_months(12) dt.plus_days(366) dt.plus_hours(8784) dt.plus_minutes(527040) dt.plus_seconds(31622400) ``` Coming up - Types - `DateTimeOffset` - `DateTimeZoned` - `Date` - `Time` - `Duration` - `TimeZone` ## Testing `make test` --- makefile --- .PHONY: mojo mojo: sh .env_setup.sh .PHONY: test test: mojo run test.mojo .PHONY: build build: mkdir -p dist mojo package mo_time -o dist/mo_time.mojopkg --- mo_time/__init__.mojo --- from mo_time.instant import Instant from mo_time.date_time import DateTimeLocal from mo_time.duration import Duration alias VERSION = "0.1.2" --- mo_time/ctypes.mojo --- from memory.unsafe import Pointer alias _CLOCK_REALTIME = 0 @value @register_passable("trivial") struct _CTimeSpec: var tv_sec: Int # Seconds var tv_nsec: Int # NanoSeconds fn __init__() -> Self: return Self {tv_sec: 0, tv_nsec: 0} fn as_nanoseconds(self) -> Int: return self.tv_sec * 1_000_000_000 + self.tv_nsec @always_inline fn clock_gettime() -> _CTimeSpec: """Low-level call to the clock_gettime libc function.""" var ts = _CTimeSpec() let ts_pointer = Pointer[_CTimeSpec].address_of(ts) let clockid_si32: Int32 = _CLOCK_REALTIME external_call["clock_gettime", NoneType, Int32, Pointer[_CTimeSpec]]( clockid_si32, ts_pointer ) return ts @value @register_passable("trivial") struct C_tm: var tm_sec: Int32 var tm_min: Int32 var tm_hour: Int32 var tm_mday: Int32 var tm_mon: Int32 var tm_year: Int32 var tm_wday: Int32 var tm_yday: Int32 var tm_isdst: Int32 fn __init__() -> Self: return Self { tm_sec: 0, tm_min: 0, tm_hour: 0, tm_mday: 0, tm_mon: 0, tm_year: 0, tm_wday: 0, tm_yday: 0, tm_isdst: 0, } @always_inline fn ts_to_utc_tm(owned ts: _CTimeSpec) -> C_tm: let ts_pointer = Pointer[Int].address_of(ts.tv_sec) # Call libc's clock_gettime. let tm = external_call["gmtime", Pointer[C_tm], Pointer[Int]](ts_pointer).load() return tm @always_inline fn ts_to_local_tm(owned ts: _CTimeSpec) -> C_tm: let ts_pointer = Pointer[Int].address_of(ts.tv_sec) # Call libc's clock_gettime. let tm = external_call["localtime", Pointer[C_tm], Pointer[Int]](ts_pointer).load() return tm --- mo_time/date_time.mojo --- from mo_time.ctypes import ts_to_local_tm, ts_to_utc_tm, _CTimeSpec, C_tm from mo_time.duration import Duration, days_in_month from python.object import PythonObject from python import Python @value struct Date: var year: Int32 var month: Int32 var day: Int32 fn to_datetimelocal(self, time: Time) -> DateTimeLocal: return DateTimeLocal( self.year, self.month, self.day, time.hour, time.minute, time.second, ) fn to_datetimelocal(self) -> DateTimeLocal: return DateTimeLocal(self.year, self.month, self.day, 0, 0, 0) @value struct Time: var hour: Int32 var minute: Int32 var second: Int32 fn to_datetimelocal(self, date: Date) -> DateTimeLocal: return DateTimeLocal( date.year, date.month, date.day, self.hour, self.minute, self.second, ) @value struct DateTimeLocal: var year: Int32 var month: Int32 var day: Int32 var hour: Int32 var minute: Int32 var second: Int32 @staticmethod fn from_instant_utc(instant: Instant) -> Self: let ts = _CTimeSpec(instant.seconds, instant.nanos) let tm = ts_to_utc_tm(ts) return DateTimeLocal._from_tm(tm) @staticmethod fn from_instant(instant: Instant) -> Self: let ts = _CTimeSpec(instant.seconds, instant.nanos) let tm = ts_to_local_tm(ts) return DateTimeLocal._from_tm(tm) @staticmethod fn _from_tm(tm: C_tm) -> Self: return DateTimeLocal( tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, ) @staticmethod fn now_utc() -> Self: return DateTimeLocal.from_instant_utc(Instant.now()) @staticmethod fn now() -> Self: return DateTimeLocal.from_instant(Instant.now()) @staticmethod fn from_py(py_datetime: PythonObject) raises -> Self: return DateTimeLocal( Int32(py_datetime.year.to_float64().to_int()), Int32(py_datetime.month.to_float64().to_int()), Int32(py_datetime.day.to_float64().to_int()), Int32(py_datetime.hour.to_float64().to_int()), Int32(py_datetime.minute.to_float64().to_int()), Int32(py_datetime.second.to_float64().to_int()), ) fn to_py(self) raises -> PythonObject: let dateimte = Python.import_module("datetime") return dateimte.datetime( self.year, self.month, self.day, self.hour, self.minute, self.second, ) # type conversions fn to_date(self) -> Date: return Date( self.year, self.month, self.day, ) fn to_time(self) -> Time: return Time( self.hour, self.minute, self.second, ) # arithmetic fn plus_years(self, years: Int32) -> Self: return DateTimeLocal( self.year + years, self.month, self.day, self.hour, self.minute, self.second, ) fn plus_months(self, months: Int32) -> Self: let new_year = self.year + (months / 12) let new_month = ((self.month - 1 + months) % 12) + 1 return DateTimeLocal( new_year, new_month, self.day, self.hour, self.minute, self.second, ) fn plus_days(self, days: Int32) -> Self: var new_day = days + self.day var new_month = self.month var new_year = self.year var days_in_current_month = days_in_month( new_year.__int__(), new_month.__int__() ) while new_day > days_in_current_month: new_day -= days_in_current_month new_year += new_month // 12 new_month = (new_month % 12) + 1 days_in_current_month = days_in_month( new_year.__int__(), new_month.__int__() ) return DateTimeLocal( new_year, new_month, new_day, self.hour, self.minute, self.second, ) fn plus_hours(self, hours: Int32) -> Self: let new_hour = (self.hour + hours) % 24 let overflow_days = hours / 24 return DateTimeLocal( self.year, self.month, self.day, new_hour, self.minute, self.second, ).plus_days(overflow_days) fn plus_minutes(self, minutes: Int32) -> Self: let new_minute = (self.minute + minutes) % 60 let overflow_hours = minutes / 60 return DateTimeLocal( self.year, self.month, self.day, self.hour, new_minute, self.second, ).plus_hours(overflow_hours) fn plus_seconds(self, seconds: Int32) -> Self: let new_second = (self.second + seconds) % 60 let overflow_minutes = seconds / 60 return DateTimeLocal( self.year, self.month, self.day, self.hour, self.minute, new_second, ).plus_minutes(overflow_minutes) fn __str__(self) -> String: # TODO use strftime return ( String(self.year.to_int()) + "-" + ("0" if self.month < 10 else "") + String(self.month.to_int()) + "-" + ("0" if self.day < 10 else "") + String(self.day.to_int()) + "T" + ("0" if self.hour < 10 else "") + String(self.hour.to_int()) + ":" + ("0" if self.minute < 10 else "") + String(self.minute.to_int()) + ":" + ("0" if self.second < 10 else "") + String(self.second.to_int()) ) fn __repr__(self) -> String: return self.__str__() --- mo_time/duration.mojo --- from utils.list import VariadicList alias _DAYS_IN_MONTH = VariadicList[Int](31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) @always_inline fn is_leap_year(year: Int) -> Bool: return (year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0)) fn days_in_month(year: Int, month: Int) -> Int: let should_add_leap_day = month == 2 and is_leap_year(year) let leap_day_addition = UInt8(should_add_leap_day).to_int() return _DAYS_IN_MONTH[month - 1] + leap_day_addition @value struct Duration: var seconds: Int32 var minutes: Int32 var hours: Int32 var days: Int32 var months: Int32 var years: Int32 --- mo_time/instant.mojo --- from mo_time.ctypes import clock_gettime @value struct Instant: """Seconds since epoch.""" var seconds: Int """Nanos since second.""" var nanos: Int fn __init__(inout self): self.seconds = 0 self.nanos = 0 @staticmethod fn now() -> Self: let ts = clock_gettime() return Instant(ts.tv_sec, ts.tv_nsec) --- test.mojo --- from mo_time import Instant, DateTimeLocal, Duration from testing import assert_equal fn main(): let instant = Instant.now() let dt_instant = DateTimeLocal.from_instant(instant) print("dt_instant: ", dt_instant.__str__()) let dt_utc_instant = DateTimeLocal.from_instant_utc(instant) print("dt_utc_instant: ", dt_utc_instant.__str__()) let dt_utc = DateTimeLocal.now_utc() print("dt_utc: ", dt_utc.__str__()) try: let pydt = dt_utc.to_py() print("Python datetime: ", pydt.to_string()) let mojodt = DateTimeLocal.from_py(pydt) print("Mojo datetime: ", mojodt.__str__()) except e: print("Exception: ", e) let dt_local = DateTimeLocal.now() print("dt_local: ", dt_local.__str__()) let duration = Duration(0, 0, 0, 365, 0, 0) let dt2 = DateTimeLocal(2023, 9, 14, 0, 0, 0) _ = assert_equal(dt2.__str__(), "2023-09-14T00:00:00") let target_dt_str = "2024-09-14T00:00:00" _ = assert_equal(dt2.plus_years(1).__str__(), target_dt_str) _ = assert_equal(dt2.plus_months(12).__str__(), target_dt_str) _ = assert_equal(dt2.plus_days(366).__str__(), target_dt_str) _ = assert_equal(dt2.plus_hours(8784).__str__(), target_dt_str) _ = assert_equal(dt2.plus_minutes(527040).__str__(), target_dt_str) _ = assert_equal(dt2.plus_seconds(31622400).__str__(), target_dt_str) --- .gitignore --- .idea .venv .coverage .vscode .ipynb_checkpoints __pycache__/ .pytest_cache examples tutorials animations cpp/include/eigen-3.4.0 --- Makefile --- setup: venv . .venv/bin/activate && python -m pip install --upgrade pip . .venv/bin/activate && pip install -r python-requirements.txt venv: test -d .venv || python3 -m venv .venv clean: rm -rf .venv py: . .venv/bin/activate && python main.py mo: . .venv/bin/activate && mojo run main.mojo cpp-build: @echo "Building C++ executable ..." g++ -std=c++20 \ -O3 \ -fopenmp \ -o ./cpp/build/bin/gradient_descent \ -I ./cpp/include \ -I ./cpp/include/eigen-3.4.0 \ ./cpp/src/*.cpp @echo "Building C++ shared object ..." g++ -std=c++20 \ -O3 \ -fpic \ -shared \ -fopenmp \ -o ./cpp/build/lib/gradient_descent.so \ -I ./cpp/include \ -I ./cpp/include/eigen-3.4.0 \ ./cpp/src/*.cpp @echo "Running C++ executable" ./cpp/build/bin/gradient_descent shape: . .venv/bin/activate && python -m shapes.parse_svg --- README.md --- <h1 align='center'><b>Gradient Descent in Mojo 🔥</b></h1> <p align='center'><sub> Implementation of a simple gradient descent problem in Python, Numpy, JAX, C++ (binding with Python) and Mojo. My goal here is to make a fair evaluation on the out-of-the-box, raw performance of a tech stack choice. Neither of the implementations is optimal. But what I hope to show is what execution speeds to expect out of the box, the complexity of each implementation and to pinpoint which ones have the possibility of squeezing out every bit of performance the hardware has to offer. </sub> </p> <table> <tr> <td><img src="https://github.com/StijnWoestenborghs/gradi-mojo/blob/main/shapes/gifs/circle.gif?raw=true" alt="Circle"></td> <td><img src="https://github.com/StijnWoestenborghs/gradi-mojo/blob/main/shapes/gifs/sphere.gif?raw=true" alt="Sphere"></td> <td><img src="https://github.com/StijnWoestenborghs/gradi-mojo/blob/main/shapes/gifs/flame.gif?raw=true" alt="Flame"></td> <td><img src="https://github.com/StijnWoestenborghs/gradi-mojo/blob/main/shapes/gifs/modular.gif?raw=true" alt="Modular"></td> </tr> </table> ## Project Setup ### Prerequisite System Requirements: > Mojo v0.4.0 > Linux: Ubuntu 22.04 > x86_64 architecture Project setup: by running `make setup` > Create virtual environment: `python3 -m venv .venv` > Upgrade pip: `. .venv/bin/activate && python -m pip install --upgrade pip` > Install project requirements: `. .venv/bin/activate && pip install -r python-requirements.txt` ### First run All implementation can be executed by running the **main.mojo** file: `make mo` > `. .venv/bin/activate && mojo run main.mojo` - Runs the Mojo implementation - Python interop to **main.py** > "benchmarks" function - Benchmarks Python/Numpy/JAX/C++(binding) - Python interop to all visualizations ### Configure the optimization problem From **main.mojo**: The shape, optimization target can be adapted by changing the **points** variable. You can choose either: - A circle of N points (fixed dim = 2) - A sphere of N points (fixed dim = 3) - A flame shape (fixed N points) - A modular shape (fixed N points) The optimization parameters can be changed: - dim: Dimensionality of the gradient descent algorithm (visualization support only dim = 2 & 3) - lr: Learning rate - niter: Number of iterations (no early stopping is implemented) - plot: (bool) Generat plots and animations - run_python: (bool) Run python interop to main.py > benchmarks ### Running the implementations seperately: Python based implementation can be executed from **main.py**: `make py` This includes: Python/Numpy/Jax and C++ (binding) > . .venv/bin/activate && python main.py Mojo only can executed by changing **run_python** to False in the **main.mojo** file and running: `make py` > . .venv/bin/activate && mojo run main.mojo To change the parellelization of the gradient calculations in Mojo: Identify the number of logical CPUs on a Linux system: `nproc` And configure the number of workers in `./mojo/gradient_descent.mojo` Switching between default and parallel mode can be done by changing how to compute the gradient in gradient_descent function of `./mojo/gradient_descent.mojo` > compute_gradient[dtype](grad, X, D) > compute_gradient_parallel[dtype, nelts](grad, X, D) ### Building the C++ (binding to Python) yourself: Both default and parallel (20 workers) C++ binaries are included in the `./cpp/bin` and `./cpp/lib` folder. So you don't have to run this again if you just want to run the code. But you can build the binary & shared object yourself: First unzip the 3rd party eigen-3.4.0.zip library in the `./cpp/include/` folder and compile the C++ code by running `make cpp-build` (g++ build tools installation required). To change the parellelization of the gradient calculations: Identify the number of logical CPUs on a Linux system: `nproc` And configure the number of workers in `./cpp/src/gradient_descent.cpp`. After building the sharded object (`make cpp-build`). Configure the exact gradient_descent.so. file you just compiled for the Python binding in `./cpp/binding.py` > libc = CDLL("cpp/build/lib/gradient_descent_p20.so") --- cpp/binding.py --- import os import json import ctypes from ctypes import * import numpy as np # libc = CDLL("cpp/build/lib/gradient_descent.so") libc = CDLL("cpp/build/lib/gradient_descent_p20.so") run_binding_external = libc.run_binding_external run_binding_external.argtypes = [c_char_p, c_int, POINTER(c_char_p), POINTER(c_int)] run_binding_external.restype = c_int delete_c_return = libc.delete_c_return delete_c_return.argtypes = [c_char_p] delete_c_return.restype = None def run_binding(input_string): s_return = c_char_p() length_return = c_int() code = run_binding_external(input_string, len(input_string), pointer(s_return), pointer(length_return)) if code == 0: result = string_at(s_return, length_return) delete_c_return(s_return) return result else: raise Exception('Error in binding') def gradient_descent_cpp(X, D, learning_rate, num_iterations): # Serialize input # Flatten input matrices to 1D arrays input_json = json.dumps( { "N": int(X.shape[0]), "dim": int(X.shape[1]), "X": X.ravel().tolist(), "D": D.ravel().tolist(), "learning_rate": float(learning_rate), "num_iterations": int(num_iterations) } ) # call python-cpp binding result = run_binding(input_json.encode('utf-8')) # Deserialize output output_json = json.loads(result.decode('utf-8')) X_out = output_json["X"] X_out = np.reshape(np.array(X_out), (X.shape[1], X.shape[0])).T return X_out --- cpp/include/binding_export.h --- extern "C" { extern int run_binding_external(char* c, int length, char** c_return, int* c_length); extern void delete_c_return(char* c_return); } --- cpp/include/gradient_descent.h --- // Input type definitions struct InputBindingInterface { int N; int dim; Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> X; Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> D; float learning_rate; int num_iterations; }; // Output type definitions struct OutputBindingInterface { Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> X; }; // Bounded function OutputBindingInterface gradient_descent(InputBindingInterface input); --- cpp/include/simpleson.h --- /* MIT License Copyright (c) 2018 Gregory Eslinger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef JSON_H #define JSON_H #include <string> #include <vector> #include <cstdio> #include <utility> #include <stdexcept> #include <cctype> #include <iostream> #define NUMBER_TO_STRING_BUFFER_LENGTH 100 namespace json { class invalid_key : public std::exception { public: const std::string key; inline invalid_key(const std::string &key) : key(key) { } inline virtual ~invalid_key() throw() { } virtual const char* what() const throw() { return key.c_str(); } }; class parsing_error : public std::invalid_argument { public: inline parsing_error(const char *message) : std::invalid_argument(message) { } inline virtual ~parsing_error() throw() { } }; namespace parsing { const char* tlws(const char *start); } /* Data types */ namespace jtype { enum jtype { jstring, jnumber, jobject, jarray, jbool, jnull, not_valid }; jtype detect(const char *input); } namespace parsing { std::string read_digits(const char *input); std::string escape_quotes(const char *input); std::string unescape_quotes(const char *input); struct parse_results { jtype::jtype type; std::string value; const char *remainder; }; parse_results parse(const char *input); template <typename T> T get_number(const char *input, const char* format) { T result; std::sscanf(input, format, &result); return result; } template <typename T> std::string get_number_string(const T &number, const char *format) { char cstr[NUMBER_TO_STRING_BUFFER_LENGTH]; std::sprintf(cstr, format, number); return std::string(cstr); } std::vector<std::string> parse_array(const char *input); } typedef std::pair<std::string, std::string> kvp; class jobject { private: std::vector<kvp> data; class const_proxy { private: const jobject &source; protected: const std::string key; template<typename T> inline T get_number(const char* format) const { return json::parsing::get_number<T>(this->source.get(key).c_str(), format); } template<typename T> inline std::vector<T> get_number_array(const char* format) const { std::string value = this->source.get(key); std::vector<std::string> numbers = json::parsing::parse_array(value.c_str()); std::vector<T> result; for (size_t i = 0; i < numbers.size(); i++) { result.push_back(json::parsing::get_number<T>(numbers[i].c_str(), format)); } return result; } public: const_proxy(const jobject &source, const std::string key) : source(source), key(key) { } inline std::string as_string() const { const std::string value = source.get(key); return json::parsing::unescape_quotes(json::parsing::parse(value.c_str()).value.c_str()); } inline operator std::string() const { return this->as_string(); } bool operator== (const std::string other) const { return ((std::string)(*this)) == other; } bool operator!= (const std::string other) const { return !(((std::string)(*this)) == other); } // Numbers operator int() const { return this->get_number<int>("%i"); } operator unsigned int() const { return this->get_number<unsigned int>("%u"); } operator long() const { return this->get_number<long>("%li"); } operator unsigned long() const { return this->get_number<unsigned long>("%lu"); } operator char() const { return this->get_number<char>("%c"); } operator float() const { return this->get_number<float>("%f"); } operator double() const { return this->get_number<double>("%lf"); } // Objects inline json::jobject as_object() const { const std::string value = this->source.get(key); return json::jobject::parse(value.c_str()); } inline operator json::jobject() const { return this->as_object(); } // Arrays operator std::vector<int>() const { return this->get_number_array<int>("%i"); } operator std::vector<unsigned int>() const { return this->get_number_array<unsigned int>("%u"); } operator std::vector<long>() const { return this->get_number_array<long>("%li"); } operator std::vector<unsigned long>() const { return this->get_number_array<unsigned long>("%lu"); } operator std::vector<char>() const { return this->get_number_array<char>("%c"); } operator std::vector<float>() const { return this->get_number_array<float>("%f"); } operator std::vector<double>() const { return this->get_number_array<double>("%f"); } operator std::vector<json::jobject>() const { const std::vector<std::string> objs = json::parsing::parse_array(this->source.get(key).c_str()); std::vector<json::jobject> results; for (size_t i = 0; i < objs.size(); i++) results.push_back(json::jobject::parse(objs[i].c_str())); return results; } operator std::vector<std::string>() const { return json::parsing::parse_array(this->source.get(key).c_str()); } template<typename T> inline std::vector<T> as_array() const { return (std::vector<T>)(*this); } // Boolean inline bool is_true() const { const std::string value = this->source.get(key); json::parsing::parse_results result = json::parsing::parse(value.c_str()); return (result.type == json::jtype::jbool && result.value == "true"); } // Null inline bool is_null() const { const std::string value = this->source.get(key); json::parsing::parse_results result = json::parsing::parse(value.c_str()); return result.type == json::jtype::jnull; } }; class proxy : public json::jobject::const_proxy { jobject &sink; protected: template<typename T> inline void set_number(const T value, const char* format) { this->sink.set(key, json::parsing::get_number_string(value, format)); } void set_array(const std::vector<std::string> &values, const bool wrap = false); template<typename T> inline void set_number_array(const std::vector<T> &values, const char* format) { std::vector<std::string> numbers; for (size_t i = 0; i < values.size(); i++) { numbers.push_back(json::parsing::get_number_string(values[i], format)); } this->set_array(numbers); } public: proxy(jobject &source, const std::string key) : json::jobject::const_proxy(source, key), sink(source) { } // Strings inline void operator= (const std::string value) { this->sink.set(this->key, "\"" + json::parsing::escape_quotes(value.c_str()) + "\""); } // Numbers void operator=(const int input) { this->set_number(input, "%i"); } void operator=(const unsigned int input) { this->set_number(input, "%u"); } void operator=(const long input) { this->set_number(input, "%li"); } void operator=(const unsigned long input) { this->set_number(input, "%lu"); } void operator=(const char input) { this->set_number(input, "%c"); } void operator=(const double input) { this->set_number(input, "%e"); } void operator=(const float input) { this->set_number(input, "%e"); } // Objects void operator=(json::jobject input) { this->sink.set(key, (std::string)input); } // Arrays void operator=(const std::vector<int> input) { this->set_number_array(input, "%i"); } void operator=(const std::vector<unsigned int> input) { this->set_number_array(input, "%u"); } void operator=(const std::vector<long> input) { this->set_number_array(input, "%li"); } void operator=(const std::vector<unsigned long> input) { this->set_number_array(input, "%lu"); } void operator=(const std::vector<char> input) { this->set_number_array(input, "%c"); } void operator=(const std::vector<float> input) { this->set_number_array(input, "%e"); } void operator=(const std::vector<double> input) { this->set_number_array(input, "%e"); } void operator=(const std::vector<std::string> input) { this->set_array(input, true); } void operator=(std::vector<json::jobject> input) { std::vector<std::string> objs; for (size_t i = 0; i < input.size(); i++) { objs.push_back((std::string)input[i]); } this->set_array(objs, false); } // Boolean inline void set_boolean(const bool value) { if (value) this->sink.set(key, "true"); else this->sink.set(key, "false"); } // Null inline void set_null() { this->sink.set(key, "null"); } inline void clear() { this->sink.remove(key); } }; public: inline jobject() { } inline virtual ~jobject() { } inline size_t size() const { return this->data.size(); } inline void clear() { this->data.resize(0); } jobject& operator+=(const kvp& other) { if (this->has_key(other.first)) throw json::parsing_error("Key conflict"); this->data.push_back(other); return *this; } jobject& operator+=(jobject& other) { for (size_t i = 0; i < other.size(); i++) this->data.push_back(other.data.at(i)); return *this; } jobject& operator+=(const jobject& other) { json::jobject copy(other); for (size_t i = 0; i < copy.size(); i++) this->data.push_back(other.data.at(i)); return *this; } jobject operator+(jobject& other) { jobject result = *this; result += other; return result; } static jobject parse(const char *input); static inline jobject parse(const std::string input) { return parse(input.c_str()); } // Returns true if a json parsing error occured inline bool static tryparse(const char *input, jobject &output) { try { output = parse(input); } catch(...) { return true; } return false; } inline bool has_key(const std::string &key) const { for (size_t i = 0; i < this->size(); i++) if (this->data.at(i).first == key) return true; return false; } void set(const std::string &key, const std::string &value); inline std::string get(const std::string &key) const { for (size_t i = 0; i < this->size(); i++) if (this->data.at(i).first == key) return this->data.at(i).second; throw json::invalid_key(key); } void remove(const std::string &key); inline virtual jobject::proxy operator[](const std::string key) { return jobject::proxy(*this, key); } inline virtual const jobject::const_proxy operator[](const std::string key) const { return jobject::const_proxy(*this, key); } operator std::string() const; inline std::string as_string() const { return this->operator std::string(); } }; } #endif // !JSON_H --- cpp/include/timer.h --- #pragma once #include <chrono> #include <iostream> /* Timing class: Create the Timer object inside a scope: Basically, when the timer gets created start the timer When the timer gets destroyed (desctructor) stop the timer --> end of scope */ class Timer { public: Timer() { m_StartTimepoint = std::chrono::high_resolution_clock::now(); } ~Timer() { Stop(); } void Stop() { auto endTimepoint = std::chrono::high_resolution_clock::now(); auto start = std::chrono::time_point_cast<std::chrono::microseconds>(m_StartTimepoint).time_since_epoch().count(); auto end = std::chrono::time_point_cast<std::chrono::microseconds>(endTimepoint).time_since_epoch().count(); auto duration = end - start; double ms = duration * 0.001; std::cout << duration << "µs (" << ms << "ms)\n"; } private: std::chrono::time_point< std::chrono::high_resolution_clock> m_StartTimepoint; }; --- cpp/src/binding_export.cpp --- #include <vector> #include <Eigen/Dense> #include "binding_export.h" #include "simpleson.h" #include "gradient_descent.h" int run_binding_external(char* c, int length, char** c_return, int* length_return) { // Deserialize input_string to json std::string input_string = std::string(c, length); json::jobject input_json = json::jobject::parse(input_string); // Copy input json into Binding struct InputBindingInterface input; input.N = (int)input_json["N"]; input.dim = (int)input_json["dim"]; input.learning_rate = (double)input_json["learning_rate"]; input.num_iterations = (int)input_json["num_iterations"]; // Copy (1D) input vector X into matrix of the right shape std::vector<float> X_json = (std::vector<float>)input_json["X"]; Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> X; X.resize(input.N, input.dim); for (int i = 0; i < input.N; i++) { for (int j = 0; j < input.dim; j++) { X(i, j) = X_json[i * input.dim + j]; } } input.X = X; // Copy (1D) input vector D into matrix of the right shape std::vector<float> D_json = (std::vector<float>)input_json["D"]; Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> D; D.resize(input.N, input.N); for (int i = 0; i < input.N; i++) { for (int j = 0; j < input.N; j++) { D(i, j) = D_json[i * input.N + j]; } } input.D = D; // Call the Gradient Descent C++ Function OutputBindingInterface output; try { output = gradient_descent(input); } catch(...) { printf("cppFunction crashed\n"); return -1; } // Create output json json::jobject output_json; // copy matrix into (1D) std::vector std::vector<double> vector_X(output.X.data(), output.X.data() + output.X.size()); output_json["X"] = vector_X; // Serialize output_json to string std::string output_string = (std::string)output_json; // Copy output to the output variables *c_return = new char[output_string.length()]; std::copy(output_string.c_str(), output_string.c_str() + output_string.length(), *c_return); *length_return = output_string.length(); return 0; } // Avoid memory leak void delete_c_return(char* c_return) { delete c_return; } --- cpp/src/gradient_descent.cpp --- #include <iostream> #include <vector> #include <Eigen/Dense> #include <omp.h> #include "gradient_descent.h" void compute_gradient( Eigen::MatrixXf & grad, const Eigen::MatrixXf & X, const Eigen::MatrixXf & D ) { float squared_distance; int num_threads = omp_get_max_threads(); // std::cout << num_threads << std::endl; // 20 for my machine omp_set_num_threads(num_threads); #pragma omp parallel for private(squared_distance) for (int i = 0; i < X.rows(); ++i) { for (int j = 0; j < X.rows(); ++j) { squared_distance = 0; for (int d = 0; d < X.cols(); ++d) { squared_distance += (X(i, d) - X(j, d)) * (X(i, d) - X(j, d)); } for (int d = 0; d < X.cols(); ++d) { grad(i, d) += 4 * (squared_distance - D(i, j) * D(i, j)) * (X(i, d) - X(j, d)); } } } } OutputBindingInterface gradient_descent(InputBindingInterface input){ Eigen::MatrixXf grad(input.N, input.dim); Eigen::MatrixXf X = input.X; for (int iter = 0; iter < input.num_iterations; ++iter) { grad.setZero(); compute_gradient(grad, X, input.D); for (int r = 0; r < X.rows(); ++r) { for (int c = 0; c < X.cols(); ++c) { X(r, c) -= input.learning_rate * grad(r, c); } } } // write to output OutputBindingInterface output; output.X.resize(input.N, input.dim); output.X = X; return output; } --- cpp/src/main.cpp --- #include <iostream> #include <Eigen/Dense> #include <cmath> #include "timer.h" #include "gradient_descent.h" const int N = 10; const int dim = 2; const float lr = 0.00001; const int niter = 1000; Eigen::Matrix<float, N, dim> generate_radial_points() { Eigen::Matrix<float, N, dim> points; const float r = 3.0; float angle; if (dim == 2) { for (int i = 0; i < N; i++) { angle = 2 * M_PI * i / N; points(i, 0) = r * std::cos(angle); points(i, 1) = r * std::sin(angle); } } else if (dim == 3) { for (int i = 0; i < N; i++) { float phi = std::acos(1 - 2 * static_cast<float>(i) / N); float theta = std::sqrt(N * M_PI) * phi; points(i, 0) = r * std::sin(phi) * std::cos(theta); points(i, 1) = r * std::sin(phi) * std::sin(theta); points(i, 2) = r * std::cos(phi); } } else { std::cerr << "Only supports 2D and 3D" << std::endl; exit(1); } return points; } Eigen::Matrix<float, N, N> generate_distance_matrix(const Eigen::Matrix<float, N, dim>& points) { Eigen::Matrix<float, N, N> distance_matrix = Eigen::Matrix<float, N, N>::Zero(); for (int i = 0; i < N; i++) { for (int j = i+1; j < N; j++) { float distance = (points.row(i) - points.row(j)).norm(); distance_matrix(i, j) = distance; distance_matrix(j, i) = distance; } } return distance_matrix; } int main(){ std::cout << "[EXECUTABLE] Gradient Descent as C++ executable " << std::endl; // generate optimization target Eigen::Matrix<float, N, dim> points = generate_radial_points(); Eigen::Matrix<float, N, N> D = generate_distance_matrix(points); // Initial starting point Eigen::Matrix<float, N, dim> X = Eigen::Matrix<float, N, dim>::Random(); // Between -1 and 1 InputBindingInterface input; input.N = N; input.dim = dim; input.learning_rate = lr; input.num_iterations = niter; input.X = X; input.D = D; OutputBindingInterface output; { Timer timer; output = gradient_descent(input); } std::cout << "\t Done: \n" << output.X << std::endl; } --- cpp/src/simpleson.cpp --- /* MIT License Copyright (c) 2018 Gregory Eslinger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "simpleson.h" #include <string.h> #define EMPTY_STRING(str) (*str == '\0') #define SKIP_WHITE_SPACE(str) { const char *next = json::parsing::tlws(str); str = next; } const char* json::parsing::tlws(const char *input) { const char *output = input; while(!EMPTY_STRING(output) && std::isspace(*output)) output++; return output; } json::jtype::jtype json::jtype::detect(const char *input) { const char *start = json::parsing::tlws(input); if (EMPTY_STRING(start)) return json::jtype::not_valid; switch (*start) { case '[': return json::jtype::jarray; break; case '"': return json::jtype::jstring; break; case '{': return json::jtype::jobject; break; case '-': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return json::jtype::jnumber; case 't': case 'f': return (strncmp(start, "true", 4) == 0 || strncmp(start, "false", 5) == 0) ? json::jtype::jbool : json::jtype::not_valid; break; case 'n': return (strncmp(start, "null", 4) == 0) ? json::jtype::jnull : json::jtype::not_valid; break; default: return json::jtype::not_valid; break; } } std::string json::parsing::read_digits(const char *input) { // Trim leading white space const char *index = json::parsing::tlws(input); // Initialize the result std::string result; // Loop until all digits are read while ( !EMPTY_STRING(index) && ( *index == '0' || *index == '1' || *index == '2' || *index == '3' || *index == '4' || *index == '5' || *index == '6' || *index == '7' || *index == '8' || *index == '9' ) ) { result += *index; index++; } // Return the result return result; } std::string json::parsing::escape_quotes(const char *input) { std::string parsed; const size_t len = strlen(input); for (size_t i = 0; i < len; i++) { if (input[i] == '\"' && parsed[parsed.size() - 1] != '\\') { parsed += '\\'; } parsed += input[i]; } return parsed; } std::string json::parsing::unescape_quotes(const char *input) { std::string result; const char *index = input; while (!EMPTY_STRING(index)) { if (strlen(index) > 1 && *index == '\\' && index[1] == '\"') { result += '\"'; index += 2; } else { result.push_back(*index); index++; } } return result; } json::parsing::parse_results json::parsing::parse(const char *input) { // Strip white space const char *index = json::parsing::tlws(input); // Validate input if (EMPTY_STRING(index)) throw json::parsing_error("Input was only whitespace"); // Initialize the output json::parsing::parse_results result; // Detect the type result.type = json::jtype::detect(index); // Parse the values switch (result.type) { case json::jtype::jstring: // Validate the input if (*index != '"') throw json::parsing_error("Expected '\"' as first character"); // Remove the opening quote index++; // Copy the string while (!EMPTY_STRING(index)) { if (*index != '"' || (result.value.size() > 0 && result.value[result.value.size() - 1] == '\\')) { result.value.push_back(*index); index++; } else { break; } } if (EMPTY_STRING(index) || *index != '"') result.type = json::jtype::not_valid; else index++; break; case json::jtype::jnumber: { const char error[] = "Input did not contain a valid number"; if (*index == '-') { result.value.push_back('-'); index++; } if (EMPTY_STRING(index)) throw json::parsing_error(error); // Read the whole digits std::string whole_digits = json::parsing::read_digits(index); // Validate the read if (whole_digits.length() == 0) throw json::parsing_error(error); // Tack on the value result.value += whole_digits; index += whole_digits.length(); // Check for decimal number if (*index == '.') { result.value.push_back('.'); index++; std::string decimal_digits = json::parsing::read_digits(index); if (decimal_digits.length() == 0) throw json::parsing_error(error); result.value += decimal_digits; index += decimal_digits.size(); } // Check for exponential number if (*index == 'e' || *index == 'E') { result.value.push_back(*index); index++; if (EMPTY_STRING(index)) throw json::parsing_error(error); if (*index == '+' || *index == '-') { result.value.push_back(*index); index++; } if (EMPTY_STRING(index)) throw json::parsing_error(error); std::string exponential_digits = json::parsing::read_digits(index); if (exponential_digits.size() == 0) throw json::parsing_error(error); result.value += exponential_digits; index += exponential_digits.size(); } break; } case json::jtype::jobject: { const char error[] = "Input did not contain a valid object"; // The first character should be an open bracket if (*index != '{') throw json::parsing_error(error); result.value += '{'; index++; SKIP_WHITE_SPACE(index); // Loop until the closing bracket is encountered while (!EMPTY_STRING(index) && *index != '}') { // Read the key json::parsing::parse_results key = json::parsing::parse(index); // Validate that the key is a string if (key.type != json::jtype::jstring) throw json::parsing_error(error); // Store the key result.value += "\"" + json::parsing::escape_quotes(key.value.c_str()) + "\""; index = json::parsing::tlws(key.remainder); // Look for the colon if (*index != ':') throw json::parsing_error(error); result.value.push_back(':'); index++; // Get the value json::parsing::parse_results subvalue = json::parsing::parse(index); // Validate the value type if (subvalue.type == json::jtype::not_valid) throw json::parsing_error(error); // Store the value if (subvalue.type == json::jtype::jstring) result.value += "\"" + json::parsing::escape_quotes(subvalue.value.c_str()) + "\""; else result.value += subvalue.value; index = json::parsing::tlws(subvalue.remainder); // Validate format if (*index != ',' && *index != '}') throw json::parsing_error(error); // Check for next line if (*index == ',') { result.value.push_back(','); index++; } } if (*index != '}') throw json::parsing_error(error); result.value += '}'; index++; break; } case json::jtype::jarray: { const char error[] = "Input did not contain a valid array"; if (*index != '[') throw json::parsing_error(error); result.value += '['; index++; SKIP_WHITE_SPACE(index); if (EMPTY_STRING(index)) throw json::parsing_error(error); while (!EMPTY_STRING(index) && *index != ']') { json::parsing::parse_results array_value = json::parsing::parse(index); if (array_value.type == json::jtype::not_valid) throw json::parsing_error(error); if (array_value.type == json::jtype::jstring) result.value += "\"" + json::parsing::escape_quotes(array_value.value.c_str()) + "\""; else result.value += array_value.value; index = json::parsing::tlws(array_value.remainder); if (*index != ',' && *index != ']') throw json::parsing_error(error); if (*index == ',') { result.value.push_back(','); index++; } } if (*index != ']') throw json::parsing_error(error); result.value.push_back(']'); index++; break; } case json::jtype::jbool: { if (strncmp(index, "true", 4) == 0) { result.value += "true"; index += 4; } else if (strncmp(index, "false", 4) == 0) { result.value += "false"; index += 5; } else { throw json::parsing_error("Input did not contain a valid boolean"); } break; } case json::jtype::jnull: { if (strncmp(index, "null", 4) == 0) { result.value += "null"; index+= 4; } else { throw json::parsing_error("Input did not contain a valid null"); } break; } default: throw json::parsing_error("Input did not contain valid json"); break; } result.remainder = index; return result; } std::vector<std::string> json::parsing::parse_array(const char *input) { // Initalize the result std::vector<std::string> result; const char *index = json::parsing::tlws(input); if (*index != '[') throw json::parsing_error("Input was not an array"); index++; SKIP_WHITE_SPACE(index); if (*index == ']') { return result; } const char error[] = "Input was not properly formated"; while (!EMPTY_STRING(index)) { SKIP_WHITE_SPACE(index); json::parsing::parse_results parse_results = json::parsing::parse(index); if (parse_results.type == json::jtype::not_valid) throw json::parsing_error(error); result.push_back(parse_results.value); index = json::parsing::tlws(parse_results.remainder); if (*index == ']') break; if (*index == ',') index++; } if (*index != ']') throw json::parsing_error(error); index++; return result; } void json::jobject::proxy::set_array(const std::vector<std::string> &values, const bool wrap) { std::string value = "["; for (size_t i = 0; i < values.size(); i++) { if (wrap) value += "\"" + json::parsing::escape_quotes(values[i].c_str()) + "\","; else value += values[i] + ","; } if(values.size() > 0) value.erase(value.size() - 1, 1); value += "]"; this->sink.set(key, value); } json::jobject json::jobject::parse(const char *input) { const char error[] = "Input is not a valid object"; const char *index = json::parsing::tlws(input); if (*index != '{') throw json::parsing_error(error); index++; SKIP_WHITE_SPACE(index); if (EMPTY_STRING(index)) throw json::parsing_error(error); json::jobject result; while (!EMPTY_STRING(index) && *index != '}') { // Get key kvp entry; json::parsing::parse_results key = json::parsing::parse(index); if (key.type != json::jtype::jstring || key.value == "") throw json::parsing_error(error); entry.first = key.value; index = key.remainder; // Get value SKIP_WHITE_SPACE(index); if (*index != ':') throw json::parsing_error(error); index++; SKIP_WHITE_SPACE(index); json::parsing::parse_results value = json::parsing::parse(index); if (value.type == json::jtype::not_valid) throw json::parsing_error(error); if (value.type == json::jtype::jstring) entry.second = "\"" + value.value + "\""; else entry.second = value.value; index = value.remainder; // Clean up SKIP_WHITE_SPACE(index); if (*index != ',' && *index != '}') throw json::parsing_error(error); if (*index == ',') index++; result += entry; } if (EMPTY_STRING(index) || *index != '}') throw json::parsing_error(error); index++; return result; } void json::jobject::set(const std::string &key, const std::string &value) { for (size_t i = 0; i < this->size(); i++) { if (this->data.at(i).first == key) { this->data.at(i).second = value; return; } } kvp entry; entry.first = key; entry.second = value; this->data.push_back(entry); } void json::jobject::remove(const std::string &key) { for (size_t i = 0; i < this->size(); i++) { if (this->data.at(i).first == key) { this->data.erase(this->data.begin() + i, this->data.begin() + i + 1); } } } json::jobject::operator std::string() const { if (this->size() == 0) return "{}"; std::string result = "{"; for (size_t i = 0; i < this->size(); i++) { result += "\"" + this->data.at(i).first + "\":" + this->data.at(i).second + ","; } result.erase(result.size() - 1, 1); result += "}"; return result; } --- main.mojo --- from benchmark import Benchmark from python.python import Python from math import sin, cos, sqrt, acos from mojo.gradi.matrix import Matrix from mojo.gradient_descent import gradient_descent from mojo.utils import plot_gradient_descent_cache, read_shape alias PI = 3.141592653589793 fn generate_radial_points[dtype: DType](N: Int, dim: Int) -> Matrix[dtype]: var points = Matrix[dtype](N, dim) let angle: SIMD[dtype, 1] let r: SIMD[dtype, 1] = 0.5 if dim == 2: for i in range(N): angle = 2 * PI * i / N points[i, 0] = r * cos(angle) points[i, 1] = r * sin(angle) elif dim == 3: let phi: SIMD[dtype, 1] let theta: SIMD[dtype, 1] for i in range(N): angle = (1 - 2 * (i / N)).cast[dtype]() phi = acos[dtype, 1](angle) theta = sqrt[dtype, 1](N * PI) * phi points[i, 0] = r * sin(phi) * cos(theta) points[i, 1] = r * sin(phi) * sin(theta) points[i, 2] = r * cos(phi) else: print("Only supports 2D and 3D !") return points fn generate_distance_matrix[dtype: DType](points: Matrix[dtype]) -> Matrix[dtype]: let N = points.rows let dim = points.cols var distance: SIMD[dtype, 1] var D = Matrix[dtype](N, N) D.zeros() for i in range(N): for j in range(i+1, N): distance = 0 for d in range(dim): distance += (points[j, d] - points[i, d])**2 distance = sqrt(distance) D[i, j] = distance D[j, i] = distance return D @always_inline fn benchmark[dtype: DType, nelts: Int](D: Matrix[dtype], dim: Int, lr: SIMD[dtype, 1], niter: Int): # Initial starting point var X = Matrix[dtype](D.rows, dim) X.rand() @parameter fn test_fn(): _ = gradient_descent[dtype, nelts](X, D, learning_rate = lr, num_iterations = niter) let secs = Benchmark().run[test_fn]() / 1e9 # Prevent the matrices from being freed before the benchmark run _ = (X, D) print("Average time Mojo: ", secs) fn main(): alias dtype = DType.float32 alias nelts = simdwidthof[dtype]() # Generate optimization target let points: Matrix[dtype] alias n_circle = 10 alias dim_circle = 2 points = generate_radial_points[dtype](n_circle, dim_circle) # try: # points = read_shape[dtype]("./shapes/flame.csv") # # points = read_shape[dtype]("./shapes/modular.csv") # except e: # print("Failed to parse shape: ", e) # Optimization input alias dim = 2 alias lr = 0.001 alias niter = 1000 alias plots = True alias run_python = True let D: Matrix[dtype] D = generate_distance_matrix[dtype](points) ### Benchmarks from python # [python native, numpy, jax, C++ (python binding)] try: if run_python: Python.add_to_path(".") let pymain = Python.import_module("main") _ = pymain.benchmarks( D.to_python(), dim, lr, niter, plots ) except e: print("Error: ", e) # Initial starting point var X = Matrix[dtype](D.rows, dim) X.rand() ### Without visuals gradient_descent[dtype, nelts](X, D, learning_rate=lr, num_iterations=niter) ### Benchmark Mojo benchmark[dtype, nelts](D, dim, lr=lr, niter=niter) ### PLOTTING try: if plots: X.rand() _ = plot_gradient_descent_cache[dtype, nelts](X, D, learning_rate=lr, num_iterations=niter) except e: print("Error: ", e) --- main.py --- import numpy as np from cpp.binding import gradient_descent_cpp from python.gradient_descent import gradient_descent, gradient_descent_cache from python.gradient_descent_native import gradient_descent_native, gradient_descent_native_cache, PyMatrix from python.gradient_descent_JAX import gradient_descent_JAX, gradient_descent_cache_JAX from python.visuals import plot_gradient_descent, plot_gradient_descent_2D, animate_gradient_descent from timeit import timeit def generate_radial_points(N, dim): r = 0.5 points = [] if dim == 2: for i in range(N): angle = 2 * np.pi * i / N points.append([r * np.cos(angle), r * np.sin(angle)]) elif dim == 3: for i in range(N): phi = np.arccos(1 - 2 * (i / N)) theta = np.sqrt(N * np.pi) * phi x = r * np.sin(phi) * np.cos(theta) y = r * np.sin(phi) * np.sin(theta) z = r * np.cos(phi) points.append([x, y, z]) else: raise ValueError("Only supports 2D and 3D") return points def generate_distance_matrix(points): n = len(points) distance_matrix = np.zeros((n, n)) for i in range(n): for j in range(i+1, n): distance = np.linalg.norm(np.array(points[i]) - np.array(points[j])) distance_matrix[i, j] = distance distance_matrix[j, i] = distance return distance_matrix NUM_ITERS = 10 def benchmark_gradient_descent_native(X_native, D_native, lr, niter): secs = timeit(lambda: gradient_descent_native(X_native, D_native, learning_rate=lr, num_iterations=niter), number=NUM_ITERS) / NUM_ITERS print(f"Average time python native: {secs}") def benchmark_gradient_descent(X, D, lr, niter): secs = timeit(lambda: gradient_descent(X, D, learning_rate=lr, num_iterations=niter), number=NUM_ITERS) / NUM_ITERS print(f"Average time python numpy: {secs}") def benchmark_gradient_descent_JAX(X, D, lr, niter): secs = timeit(lambda: gradient_descent_JAX(X, D, learning_rate=lr, num_iterations=niter), number=NUM_ITERS) / NUM_ITERS print(f"Average time JAX: {secs}") def benchmark_gradient_descent_cpp(X, D, lr, niter): secs = timeit(lambda: gradient_descent_cpp(X, D, learning_rate=lr, num_iterations=niter), number=NUM_ITERS) / NUM_ITERS print(f"Average time C++ binding: {secs}") def benchmarks(D, dim, lr, niter, plots=True): N = len(D) D = np.array(D, dtype=np.float64) D_native = PyMatrix(D.tolist(), N, N) # Initial starting point np.random.seed(42) X = np.random.rand(N, dim) X_native = PyMatrix(X.tolist(), N, dim) ### Without visuals p1 = gradient_descent_native(X_native.copy(), D_native, learning_rate=lr, num_iterations=niter) p2 = gradient_descent(X.copy(), D, learning_rate=lr, num_iterations=niter) p3 = gradient_descent_JAX(X.copy(), D, learning_rate=lr, num_iterations=niter) p_cpp = gradient_descent_cpp(X.copy(), D, learning_rate=lr, num_iterations=niter) ### Benchmarks benchmark_gradient_descent_native(X_native.copy(), D_native, lr=lr, niter=niter) benchmark_gradient_descent(X.copy(), D, lr=lr, niter=niter) benchmark_gradient_descent_JAX(X.copy(), D, lr=lr, niter=niter) benchmark_gradient_descent_cpp(X.copy(), D, lr=lr, niter=niter) ## Visualization if plots: P, L = gradient_descent_cache(X.copy(), D, learning_rate=lr, num_iterations=niter) plot_gradient_descent_2D(P, L, title="Gradient Descent in python numpy") plot_gradient_descent(P, L, title="Gradient Descent in python numpy") P_native, L_native = gradient_descent_native_cache(X_native.copy(), D_native, learning_rate=lr, num_iterations=niter) plot_gradient_descent(P_native, L_native, title="Gradient Descent in native python") P_JAX, L_JAX = gradient_descent_cache_JAX(X.copy(), D, learning_rate=lr, num_iterations=niter) plot_gradient_descent(P_JAX.tolist(), L_JAX.tolist(), title="Gradient Descent in JAX") # (cache function not implemented: Can only plot final value) plot_gradient_descent(p_cpp, -1, title="Gradient Descent in C++") animate_gradient_descent(P, L, trace=False) if __name__ == "__main__": # Create optimization target n_circle = 10 dim_circle = 2 points = generate_radial_points(n_circle, dim_circle) # circle/sphere # points = np.loadtxt("./shapes/modular.csv", delimiter=",") # modular (N = 1000) # points = np.loadtxt("./shapes/flame.csv", delimiter=",") # flame (N = 307) # Optimization input dim = 2 lr = 0.001 niter = 1000 plots = True benchmarks( D=generate_distance_matrix(points), dim=dim, lr=lr, niter=niter, plots=plots ) --- mojo/__init__.mojo --- --- mojo/gradi/__init__.mojo --- --- mojo/gradi/matrix.mojo --- from python.python import Python from algorithm import vectorize, parallelize, vectorize_unroll from memory import memset_zero, memset from random import rand struct Matrix[dtype: DType]: var data: DTypePointer[dtype] var rows: Int var cols: Int fn __init__(inout self, rows: Int, cols: Int): self.data = DTypePointer[dtype].alloc(rows * cols) self.rows = rows self.cols = cols fn __del__(owned self): self.data.free() fn zeros(inout self): memset_zero(self.data, self.rows * self.cols) fn ones(inout self): # memset(self.data, 1, self.rows * self.cols) # v0.4.0: memset only takes in SIMD[ui8, 1] for now for y in range(self.rows): for x in range(self.cols): self[y, x] = 1 fn rand(inout self): rand(self.data, self.rows*self.cols) @always_inline fn __getitem__(self, y: Int, x: Int) -> SIMD[dtype, 1]: return self.load[1](y, x) @always_inline fn __setitem__(inout self, y: Int, x: Int, val: SIMD[dtype, 1]): self.store[1](y, x, val) @always_inline fn __copyinit__(inout self, other: Matrix[dtype]): self.data = DTypePointer[dtype].alloc(other.rows * other.cols) for y in range(other.rows): for x in range(other.cols): self.data.simd_store[1](y * other.cols + x, other.data.simd_load[1](y * other.cols + x)) self.rows = other.rows self.cols = other.cols @always_inline fn load[nelts: Int](self, y: Int, x: Int) -> SIMD[dtype, nelts]: return self.data.simd_load[nelts](y * self.cols + x) @always_inline fn store[nelts: Int](inout self, y: Int, x: Int, val: SIMD[dtype, nelts]): return self.data.simd_store[nelts](y * self.cols + x, val) @always_inline fn __str__(self) -> String: """ v0.4.0 Until mojo has traits, there isn't a clean implementation of __str__ and __repr__ that are usable for a polymorphic implementation of print. https://github.com/modularml/mojo/discussions/325 --> use print(X.__str__()) instead """ var row_str: String var matrix_str: String = "[" for y in range(self.rows): row_str = "[ " + String(self[y, 0]) for x in range(1, self.cols): row_str += ", " + String(self[y, x]) row_str += "]\n " matrix_str += row_str matrix_str = matrix_str[:-2] + "]" return matrix_str fn T(self) -> Matrix[dtype]: var transposed = Matrix[dtype](self.cols, self.rows) for y in range(self.cols): for x in range(self.rows): transposed[y, x] = self[x, y] return transposed fn dot[nelts: Int](inout self, other: Matrix[dtype]) -> Matrix[dtype]: var C = Matrix[dtype](self.rows, other.cols) C.zeros() @parameter fn calc_row(m: Int): for k in range(self.cols): @parameter fn dot[nelts: Int](n: Int): C.store[nelts]( m, n, C.load[nelts](m, n) + self[m, k] * other.load[nelts](k, n) ) vectorize[nelts, dot](C.cols) parallelize[calc_row](C.rows, C.rows) return C @always_inline fn __mul__(self, scalar: SIMD[dtype, 1]) -> Matrix[dtype]: var res = Matrix[dtype](self.rows, self.cols) for y in range(self.rows): for x in range(self.cols): res[y, x] = scalar * self.data.simd_load[1](y * self.cols + x) return res @always_inline fn __rmul__(self, scalar: SIMD[dtype, 1]) -> Matrix[dtype]: return self.__mul__(scalar) @always_inline fn __add__(self, other: Matrix[dtype]) -> Matrix[dtype]: var res = Matrix[dtype](self.rows, self.cols) for y in range(self.rows): for x in range(self.cols): res[y, x] = self.data.simd_load[1](y * self.cols + x) + other.data.simd_load[1](y * self.cols + x) return res @always_inline fn __iadd__(inout self, owned other: Matrix[dtype]): for y in range(self.rows): for x in range(self.cols): self[y, x] += other[y, x] @always_inline fn __isub__(inout self, owned other: Matrix[dtype]): for y in range(self.rows): for x in range(self.cols): self[y, x] -= other[y, x] def to_python(self) -> PythonObject: try: np = Python.import_module("numpy") pymatrix = np.zeros((self.rows, self.cols), np.float64) for y in range(self.rows): for x in range(self.cols): pymatrix.itemset((y, x), self[y, x]) return pymatrix except: raise Error("Failed to convert Matrix to PythonObject") --- mojo/gradient_descent.mojo --- from algorithm import vectorize, parallelize, vectorize_unroll from python.python import Python from mojo.gradi.matrix import Matrix fn loss[dtype: DType](X: Matrix[dtype], D: Matrix[dtype]) -> SIMD[dtype, 1]: var total_loss: SIMD[dtype, 1] = 0 var squared_distance: SIMD[dtype, 1] = 0 for i in range(X.rows): for j in range(X.rows): squared_distance = 0 for d in range(X.cols): squared_distance += (X[i, d] - X[j, d])**2 total_loss += (squared_distance - D[i, j]**2)**2 return total_loss fn compute_gradient[dtype: DType](inout grad: Matrix[dtype], X: Matrix[dtype], D: Matrix[dtype]): var squared_distance: SIMD[dtype, 1] for i in range(X.rows): for j in range(X.rows): squared_distance = 0 for d in range(X.cols): squared_distance += (X[i, d] - X[j, d])**2 for d in range(X.cols): grad[i, d] += 4 * (squared_distance - D[i, j] ** 2) * (X[i, d] - X[j, d]) fn gradient_descent[dtype: DType, nelts: Int]( inout X: Matrix[dtype], D: Matrix[dtype], learning_rate: SIMD[dtype, 1], num_iterations: Int ): var grad = Matrix[dtype](X.rows, X.cols) for _ in range(num_iterations): grad.zeros() # compute_gradient[dtype](grad, X, D) compute_gradient_parallel[dtype, nelts](grad, X, D) for r in range(X.rows): for c in range(X.cols): X[r, c] -= learning_rate * grad[r, c] # ## Using extended matrix methods # for _ in range(num_iterations): # grad.zeros() # compute_gradient[dtype](grad, X, D) # X -= learning_rate * grad ### Vector & Parallel fn compute_gradient_parallel[dtype: DType, nelts: Int](inout grad: Matrix[dtype], X: Matrix[dtype], D: Matrix[dtype]): @parameter fn calc_row(i: Int): var squared_distance: SIMD[dtype, 1] = 0 for j in range(X.rows): squared_distance = 0 for d in range(X.cols): squared_distance += (X[i, d] - X[j, d])**2 for d in range(X.cols): grad[i, d] += 4 * (squared_distance - D[i, j] ** 2) * (X[i, d] - X[j, d]) # Available number of logical CPUs on my machine: 20 parallelize[calc_row](X.rows, 20) --- mojo/utils.mojo --- from python.python import Python from utils.vector import InlinedFixedVector from mojo.gradient_descent import gradient_descent, compute_gradient, compute_gradient_parallel, loss from mojo.gradi.matrix import Matrix def plot_gradient_descent_cache[dtype: DType, nelts: Int]( inout X: Matrix[dtype], D: Matrix[dtype], learning_rate: SIMD[dtype, 1], num_iterations: Int ): # Import python modules Python.add_to_path("./python") np = Python.import_module("numpy") visuals = Python.import_module("visuals") # Gradient descent cach var grad = Matrix[dtype](X.rows, X.cols) positions_over_time = np.zeros((num_iterations + 1, X.rows, X.cols), np.float64) loss_over_time = np.zeros((num_iterations + 1, ), np.float64) for i in range(num_iterations): # Cache to numpy arrays set_element[dtype](positions_over_time, loss_over_time, X, D, i) grad.zeros() compute_gradient[dtype](grad, X, D) # compute_gradient_parallel[dtype, nelts](grad, X, D) for r in range(X.rows): for c in range(X.cols): X[r, c] -= learning_rate * grad[r, c] # Add last element set_element[dtype](positions_over_time, loss_over_time, X, D, num_iterations) visuals.plot_gradient_descent(positions_over_time[-1], loss_over_time[-1]) visuals.animate_gradient_descent(positions_over_time, loss_over_time, "Gradient Descent Animation: Mojo", False) def set_element[dtype: DType](inout positions_over_time: PythonObject, inout loss_over_time: PythonObject, X: Matrix[dtype], D: Matrix[dtype], i: Int): loss_over_time.itemset((i,), loss[dtype](X, D).cast[DType.float64]()) for r in range(X.rows): for c in range(X.cols): positions_over_time.itemset((i, r, c), X[r, c]) # Read and parse shape files (.csv format with very specific structure) # Into the Matrix type fn count_lines(s: String) -> Int: var count: Int = 0 for i in range(len(s)): if s[i] == "\n": count += 1 return count fn find_first(s: String, delimiter: String) -> Int: for i in range(len(s)): if s[i] == delimiter: return i return -1 fn cast_string[dtype: DType](s: String) raises -> SIMD[dtype, 1]: let idx = find_first(s, delimiter=".") var x: SIMD[dtype, 1] = -1 if idx == -1: x = atol(s) return x else: let c_int: SIMD[dtype, 1] let c_frac: SIMD[dtype, 1] c_int = atol(s[:idx]) c_frac = atol(s[idx+1:]) x = c_int + c_frac / (10 ** len(s[idx+1:])) return x fn read_shape[dtype: DType](file_name: String) raises -> Matrix[dtype]: var s: String with open(file_name, "r") as f: s = f.read() let N: Int = count_lines(s) var points = Matrix[dtype](N, 2) # Both modular.csv and flame.csv are 2D let x_str: String let y_str: String let coord_idx: Int var line_idx: Int = find_first(s, "\n") var point_idx: Int = 0 while line_idx != -1: # Read coordinate strings of the line coord_idx = find_first(s[:line_idx], ",") x_str = s[:coord_idx] y_str = s[coord_idx+1:line_idx] # Update point matrix points[point_idx, 0] = cast_string[dtype](x_str) points[point_idx, 1] = cast_string[dtype](y_str) # Cut line and update line_idx s = s[line_idx+1:] line_idx = find_first(s, "\n") point_idx += 1 return points --- python-requirements.txt --- numpy==1.25.1 jax==0.4.17 jaxlib==0.4.17 matplotlib==3.8.0 plotly==5.17.0 --- python/gradient_descent.py --- import numpy as np def loss(X, D): N = X.shape[0] total_loss = 0 for i in range(N): for j in range(N): difference = X[i] - X[j] squared_distance = np.dot(difference.T, difference) total_loss += (squared_distance - D[i, j]**2)**2 return total_loss def compute_gradient(X, D): N = X.shape[0] grad = np.zeros_like(X) for i in range(N): for j in range(N): difference = X[i] - X[j] squared_distance = np.dot(difference.T, difference) grad[i] += 4 * (squared_distance - D[i, j]**2) * difference return grad def gradient_descent(X, D, learning_rate=0.0001, num_iterations=1000): for _ in range(num_iterations): grad = compute_gradient(X, D) X -= learning_rate * grad return X def gradient_descent_cache(X, D, learning_rate=0.001, num_iterations=1000): positions_over_time = [] loss_over_time = [] for _ in range(num_iterations): positions_over_time.append(X.copy()) loss_over_time.append(loss(X, D)) grad = compute_gradient(X, D) X -= learning_rate * grad positions_over_time.append(X.copy()) loss_over_time.append(loss(X, D)) return positions_over_time, loss_over_time --- python/gradient_descent_JAX.py --- import jax.numpy as jnp import jax from functools import partial def loss(X, D): N = X.shape[0] total_loss = 0 for i in range(N): for j in range(N): difference = X[i] - X[j] squared_distance = jnp.dot(difference.T, difference) total_loss += (squared_distance - D[i, j]**2)**2 return total_loss # ----- Jax Method 1 ----- @partial(jax.jit, static_argnums=(2,3)) def gradient_descent_JAX(X, D, learning_rate=0.0001, num_iterations=1000): D = jnp.array(D) X = jnp.array(X) iterations = jnp.arange(num_iterations) (X, learning_rate, D), _ = jax.lax.scan(grad_step, (X, learning_rate, D), iterations) return X def grad_step(carry, x): X, learning_rate, D = carry grad = compute_gradient(X, D) X -= learning_rate * grad return (X, learning_rate, D), None def compute_gradient(X, D): iterations = jnp.arange(X.shape[0]) (X, D), grad = jax.lax.scan(iter1, (X, D), iterations) return grad def iter1(carry, row1): X, D = carry diff = X[row1] - X diff_squared = diff ** 2 squared_distance = jnp.sum(diff_squared, axis=diff_squared.ndim - 1) squared_distance_diff = 4 * (squared_distance - (D[row1] ** 2).T) squared_distance_diff_reshaped = jnp.reshape(squared_distance_diff, (squared_distance_diff.shape[0], 1)) return (X, D), jnp.sum(squared_distance_diff_reshaped * diff, axis=0) # ----- Jax cache method for plotting ----- def gradient_descent_cache_JAX(X, D, learning_rate=0.001, num_iterations=1000): D = jnp.array(D) X = jnp.array(X) iterations = jnp.arange(num_iterations) _, (positions_over_time, loss_over_time) = jax.lax.scan(grad_step_with_time_evolution, (X, learning_rate, D), iterations) return positions_over_time, loss_over_time def grad_step_with_time_evolution(carry, _): X, learning_rate, D = carry loss_val = loss(X, D) grad = compute_gradient(X, D) X -= learning_rate * grad return (X, learning_rate, D), (X, loss_val) --- python/gradient_descent_native.py --- class PyMatrix: def __init__(self, value, rows, cols): self.value = value self.rows = rows self.cols = cols self.shape = (rows, cols) def __getitem__(self, idxs): if isinstance(idxs, tuple): return self.value[idxs[0]][idxs[1]] elif isinstance(idxs, int): return PyMatrix([self.value[idxs]], 1, self.cols) def __setitem__(self, idxs, value): self.value[idxs[0]][idxs[1]] = value def __add__(self, other): return PyMatrix( [[self[i, j] + other[i, j] for j in range(self.cols)] for i in range(self.rows)], self.rows, self.cols ) def __sub__(self, other): return PyMatrix( [[self[i, j] - other[i, j] for j in range(self.cols)] for i in range(self.rows)], self.rows, self.cols ) def __str__(self): rows_str = ['[' + ', '.join(map(str, row)) + ']' for row in self.value] matrix_str = '[' + ',\n '.join(rows_str) + ']' return matrix_str def T(self): return PyMatrix( [[self[i, j] for i in range(self.rows)] for j in range(self.cols)], self.cols, self.rows ) def copy(self): return PyMatrix( [[self[i, j] for j in range(self.cols)] for i in range(self.rows)], self.rows, self.cols ) def matmul_native(A, B): """ The problem here is that you need to initialize a result matrix of zeros which cost resources. Numpy (optimized C in the backend) handles this by allocating memory directly which is way more efficient. Note that the matmul example in mojo did exclude this from teh benchmark """ C = PyMatrix([[0.0] * B.cols for _ in range(A.rows)], A.rows, B.cols) for m in range(C.rows): for k in range(A.cols): for n in range(C.cols): C[m, n] += A[m, k] * B[k, n] return C def loss_native(X, D): N = X.rows total_loss = 0 for i in range(N): for j in range(N): difference = X[i] - X[j] squared_distance = matmul_native(difference, difference.T())[0, 0] total_loss += (squared_distance - D[i, j]**2)**2 return total_loss def compute_gradient_native(X, D): N = X.rows dim = X.cols grad = PyMatrix([[0.0] * dim for _ in range(N)], N, dim) for i in range(N): for j in range(N): difference = X[i] - X[j] squared_distance = matmul_native(difference, difference.T())[0, 0] for d in range(dim): grad[i, d] += 4 * (squared_distance - D[i, j] ** 2) * difference[0, d] return grad def gradient_descent_native(X, D, learning_rate=0.0001, num_iterations=1000): for _ in range(num_iterations): grad = compute_gradient_native(X, D) for r in range(X.rows): for c in range(X.cols): X[r, c] -= learning_rate * grad[r, c] return X def gradient_descent_native_cache(X, D, learning_rate=0.0001, num_iterations=1000): positions_over_time = [] loss_over_time = [] for _ in range(num_iterations): positions_over_time.append(X.copy().value) loss_over_time.append(loss_native(X, D)) grad = compute_gradient_native(X, D) for r in range(X.rows): for c in range(X.cols): X[r, c] -= learning_rate * grad[r, c] positions_over_time.append(X.copy().value) loss_over_time.append(loss_native(X, D)) return positions_over_time, loss_over_time --- python/visuals.py --- import numpy as np import matplotlib.pyplot as plt import plotly.graph_objects as go def plot_gradient_descent_2D(positions_over_time, loss_over_time, title = 'Gradient descent'): print(f"Plotting: {title}...") positions_over_time = np.array(positions_over_time) X_final = positions_over_time[-1] loss_final = loss_over_time[-1] fig, ax = plt.subplots() for positions in positions_over_time: ax.scatter(positions[:, 0], positions[:, 1], c='gray', alpha=0.5) ax.scatter(X_final[:, 0], X_final[:, 1], c='red') text = f"Iteration: {len(loss_over_time)-1}\nLoss: {loss_final:.4f}" ax.text(0.98, 0.90, text, transform=ax.transAxes, ha='right', fontsize=10) plt.axis('equal') plt.title(title) plt.show() def flatten(points): dim = points.shape[2] x = points.reshape(-1, dim)[:, 0] y = points.reshape(-1, dim)[:, 1] if dim == 2: # If the data is 2D, set z-coordinates to zero z = np.zeros_like(x) elif dim == 3: z = points.reshape(-1, dim)[:, 2] else: raise ValueError("Only 2D and 3D supported") return x, y, z def plot_gradient_descent(positions_over_time, loss_over_time, title = 'Gradient descent'): ''' Plots all positions, but also able to take in only the last element. If the plot shows empyt your browser probably runs out of memory. ''' print(f"Plotting: {title}...") points = np.array(positions_over_time) if points.ndim == 2: points = points[np.newaxis, :, :] if not isinstance(loss_over_time, (list, np.ndarray)): loss_over_time = [loss_over_time] N_points = len(points[0]) time_steps = len(points) x, y, z = flatten(points) # Create a figure fig = go.Figure( data=[go.Scatter3d( x=x, y=y, z=z, mode='markers', marker=dict(color=['gray'] * (N_points * (time_steps - 1)) + ['red'] * N_points, size=[5] * (N_points * (time_steps - 1)) + [15] * N_points, line=dict(width=0)) )], layout=go.Layout( title=title, scene=dict( xaxis=dict(range=[-2, 2], autorange=False), yaxis=dict(range=[-2, 2], autorange=False), zaxis=dict(range=[-2, 2], autorange=False), aspectmode='cube' ), annotations=[dict( showarrow=False, x=0.90, y=0.90, xref="paper", yref="paper", text=f"Iteration: {len(loss_over_time)-1}<br>Loss: {loss_over_time[-1]:.4f}", font=dict(size=25) )] ) ) fig.show() def animate_gradient_descent(positions_over_time, loss_over_time, title="Gradient Descent Animation", trace=False): print(f"Animating: {title}...") points = np.array(positions_over_time) if points.ndim == 2: points = points[np.newaxis, :, :] N_points = len(points[0]) time_steps = len(points) all_x, all_y, all_z = flatten(points) fig = go.Figure( data=[go.Scatter3d( x=all_x[:N_points], y=all_y[:N_points], z=all_z[:N_points], mode='markers', marker=dict(color=["red"] * N_points, size=10) )], layout=go.Layout( title=title, updatemenus=[dict( type='buttons', showactive=False, buttons=[ dict( label='Play', method='animate', args=[None, dict(frame=dict(duration=1, redraw=True), fromcurrent=True, mode="immediate")] ) ] )], scene=dict( xaxis=dict(range=[-2, 2], autorange=False), yaxis=dict(range=[-2, 2], autorange=False), zaxis=dict(range=[-2, 2], autorange=False), aspectmode='cube' ) ), frames=[go.Frame( data=[ go.Scatter3d( x=all_x[:(i+1)*N_points] if trace else all_x[i*N_points:(i+1)*N_points], y=all_y[:(i+1)*N_points] if trace else all_y[i*N_points:(i+1)*N_points], z=all_z[:(i+1)*N_points] if trace else all_z[i*N_points:(i+1)*N_points], mode='markers', marker=dict( color=['gray']*(N_points * i) + ['red']*N_points if trace else ['red']*N_points, size=[5]*(N_points * i) + [15]*N_points if trace else [15]*N_points, line=dict(width=0) ) ) ], layout=dict(annotations=[dict( showarrow=False, x=0.90, y=0.90, xref="paper", yref="paper", text=f"Iteration: {i+1}<br>Loss: {loss_over_time[i]:.4f}", font=dict(size=25) )]) ) for i in range(1, time_steps)] ) fig.show() --- shapes/flame.csv --- 0.866240,0.451120 0.624640,0.532480 0.406480,0.683760 0.878360,0.490640 0.668000,0.465760 0.992120,1.017880 0.387880,0.768240 0.866120,0.451000 0.609240,0.550000 1.004240,0.718120 0.582480,0.583240 0.512360,0.587880 0.668360,0.391760 0.401880,0.695880 0.974640,1.041360 1.042880,0.827360 0.823880,1.138000 1.038880,0.899760 0.439760,1.001880 0.992240,1.017880 0.383000,0.816120 0.660480,1.144360 1.032640,0.935640 0.975000,1.041000 0.860240,0.437760 0.535640,0.711120 0.602640,0.558360 0.676000,0.311240 0.382760,0.827640 0.668000,0.465640 0.866000,0.450880 0.880640,0.587880 1.004240,0.718000 1.043000,0.815760 0.416360,0.660240 0.549520,0.638760 0.504360,0.553360 0.882640,0.551880 0.644000,0.512360 0.468120,0.579240 0.923360,0.736480 0.882760,0.551880 0.398120,0.707520 1.025760,0.751880 0.602760,0.558360 0.656360,0.490120 1.042880,0.827240 0.860480,0.438240 0.964480,0.699240 0.515880,1.084880 0.875120,0.479360 0.511760,0.647640 1.015760,0.983240 0.876640,1.116480 0.461640,1.033760 0.875120,0.720000 0.431240,0.989360 0.882880,0.551880 0.528120,0.712880 0.991000,0.695640 0.672640,1.144880 0.881640,0.576120 0.839360,1.134000 0.860760,0.438760 0.870880,0.465360 0.411640,0.947000 1.026000,0.751880 0.901240,1.101640 0.636120,1.138880 0.564880,1.114880 0.641000,0.344000 0.389000,0.875880 0.425360,0.979120 0.881120,0.504240 1.040360,0.887880 0.852360,1.126760 0.451240,0.600240 1.009120,0.995240 0.655880,0.363640 0.869000,0.694880 0.633120,0.308880 0.672760,1.144880 0.956640,0.709240 0.461640,1.033640 0.672880,1.144880 0.511760,0.611760 0.876120,0.611760 1.030000,0.764000 0.936000,0.732120 0.431240,0.989240 0.899760,0.736120 0.446760,1.013360 0.420360,0.648120 0.641360,0.308640 0.648000,0.351360 0.511880,0.659760 0.672120,0.411760 0.555640,0.624760 0.545520,0.650640 0.478240,1.050760 1.043120,0.815640 0.431240,0.989520 0.761880,1.151240 0.600480,1.127760 0.382880,0.839640 0.747880,0.335120 0.519240,0.695880 0.848640,0.415240 0.469880,1.042480 1.025120,0.960000 0.602480,0.558360 0.719640,0.323240 0.708000,1.148120 0.588360,0.576240 0.672000,0.440120 1.025880,0.751880 1.009640,0.995240 0.507520,1.078360 0.511360,0.599520 0.479640,0.568240 0.442880,0.611880 0.479760,0.568240 0.433880,0.624000 0.383520,0.804000 0.792240,0.355880 0.869640,0.648000 0.745360,1.151360 0.611640,1.132000 0.882360,0.516480 0.803240,0.364360 0.588120,1.123880 0.498360,0.552000 0.662000,0.476360 0.383640,0.792000 0.528480,1.093760 0.384240,0.780120 0.733000,0.327880 0.391760,0.888000 0.874000,0.624000 0.469880,1.042360 0.576360,1.119000 0.709120,1.148120 0.552480,1.108360 0.719640,0.323120 0.872000,0.708480 1.042880,0.815880 1.011640,0.728480 0.841880,0.404880 0.512360,0.587760 0.576120,0.591240 0.912000,0.737120 0.469880,1.042640 0.659360,0.370480 0.552760,1.107880 0.805880,1.143120 0.455520,1.024760 0.410120,0.671640 0.834360,0.393240 1.029000,0.947360 1.034640,0.777520 0.536000,0.691360 0.721120,1.151640 0.617360,0.540120 0.386640,0.864240 0.420240,0.967360 0.539520,0.664240 0.780880,0.348880 0.662480,0.310880 0.652120,0.499640 1.042880,0.827520 1.000240,1.005760 0.668480,0.391640 0.483880,0.563760 0.912120,0.737120 0.706880,1.148120 0.672360,0.425880 0.652240,0.310640 0.536000,0.691640 0.536000,0.677760 0.882360,0.528000 0.594640,0.568760 0.692000,0.315760 0.401880,0.696120 0.516120,0.683880 0.806120,1.142880 0.384000,0.852240 0.393760,0.719640 0.882000,0.564000 0.878000,0.599760 0.962480,1.054000 0.511880,0.635880 0.627520,0.326760 0.489120,1.061520 1.044480,0.851880 0.765760,0.341120 0.382760,0.827880 0.515120,0.672000 0.594760,0.568760 0.662640,0.378760 0.528120,0.712760 1.035640,0.924120 0.946480,0.720000 0.823360,0.382760 0.633520,0.523240 1.009360,0.995240 0.704880,0.319520 0.705000,0.319520 0.391000,0.743760 0.683360,1.145760 0.594480,0.568760 0.984120,0.687360 0.394120,0.731880 0.997240,0.706360 0.992000,1.017880 0.479880,0.568240 0.382760,0.827760 0.662640,0.378640 0.868000,0.684120 0.869360,0.659120 0.528120,0.712640 0.705120,0.319520 0.814480,0.373640 1.040120,0.803760 0.523640,0.707880 0.985240,1.029000 0.775760,1.148640 0.974240,1.041760 0.662640,0.378480 0.719640,0.323360 0.790880,1.146360 0.913760,1.093240 0.867520,0.671640 0.648240,1.141120 0.624240,1.136640 0.511880,0.563640 0.535880,0.701880 0.882480,0.540480 0.461640,1.033880 0.491760,0.556120 0.567760,0.602640 0.937120,1.077640 0.923520,0.736480 0.540640,1.100360 0.937240,1.077640 0.415640,0.957120 0.388480,0.756000 0.467880,0.579240 0.468000,0.579240 1.036120,0.790360 0.865520,1.122120 1.036360,0.790760 1.042240,0.875640 0.732360,1.152000 0.625760,0.316640 0.429000,0.636000 0.912240,0.737120 0.410240,0.671640 0.923640,0.736480 0.968480,0.688240 0.975520,0.683640 0.856120,0.428480 0.937360,1.077640 0.823640,1.138000 0.588240,1.123760 0.886240,0.731640 0.670240,0.455120 0.856240,0.428480 0.888760,1.110880 0.823760,1.138000 0.926120,1.086480 1.043760,0.839760 1.029000,0.947240 0.806000,1.143000 0.635360,0.336480 1.037000,0.911880 0.473640,0.575760 0.668240,0.391880 0.670000,0.398480 0.402880,0.923880 0.872880,0.635880 0.410360,0.671640 0.456120,0.595640 0.408000,0.936120 1.036640,0.791120 0.780880,0.348760 0.512240,0.575760 0.780880,0.349000 0.511880,0.624120 0.668000,0.465880 0.856360,0.428480 0.461760,0.587640 0.561000,0.612000 0.400000,0.912240 0.536000,0.691520 1.004240,0.718240 1.043880,0.863240 0.951520,1.065880 0.396000,0.900000 1.020760,0.972000 0.512360,0.588000 1.017640,0.739640 0.401880,0.696000 0.695880,1.146640 0.497240,1.069520 1.029000,0.947120 0.588000,1.124000 0.553000,1.107360 --- shapes/flame.svg --- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg xmlns="http://www.w3.org/2000/svg" width="1.19333in" height="1.22in" viewBox="0 0 358 366"> <path id="Unnamed" fill="none" stroke="black" stroke-width="1" d="M 102.00,234.03 C 102.00,234.03 100.72,230.97 100.72,230.97 100.72,230.97 100.00,228.06 100.00,228.06 100.00,228.06 99.00,225.00 99.00,225.00 99.00,225.00 97.94,222.00 97.94,222.00 97.94,222.00 97.25,218.97 97.25,218.97 97.25,218.97 96.66,216.06 96.66,216.06 96.66,216.06 96.00,213.06 96.00,213.06 96.00,213.06 95.72,209.91 95.72,209.91 95.72,209.91 95.69,206.97 95.69,206.94 95.69,206.91 95.75,204.03 95.75,204.03 95.75,204.03 95.88,201.00 95.88,201.00 95.88,201.00 95.91,198.00 95.91,198.00 95.91,198.00 96.06,195.03 96.06,195.03 96.06,195.03 96.97,192.06 96.97,192.06 96.97,192.06 97.12,189.00 97.12,189.00 97.12,189.00 97.75,185.94 97.75,185.94 97.75,185.94 98.53,182.97 98.53,182.97 98.53,182.97 98.44,179.91 98.44,179.91 98.44,179.91 99.53,176.88 99.53,176.88 99.53,176.88 100.47,174.03 100.47,174.00 100.47,173.97 101.62,170.94 101.62,170.94 101.62,170.94 102.53,167.91 102.56,167.91 102.59,167.91 104.09,165.06 104.09,165.06 104.09,165.06 105.09,162.03 105.09,162.03 105.09,162.03 107.25,159.00 107.25,159.00 107.25,159.00 108.47,156.00 108.47,156.00 108.47,156.00 110.72,152.97 110.72,152.97 110.72,152.97 112.81,150.06 112.81,150.06 112.81,150.06 114.03,148.91 114.03,148.91 114.03,148.91 115.44,146.91 115.44,146.91 115.44,146.91 116.97,144.81 117.00,144.81 117.03,144.81 118.41,143.94 118.41,143.94 118.41,143.94 119.91,142.06 119.94,142.06 119.97,142.06 120.97,140.94 120.97,140.94 120.97,140.94 122.94,139.03 122.94,139.03 122.94,139.03 124.59,138.00 124.59,138.00 124.59,138.00 126.09,138.34 126.09,138.34 126.09,138.34 127.97,140.91 127.97,140.91 127.97,140.91 128.06,143.94 128.06,143.94 128.06,143.94 128.09,147.00 128.09,146.97 128.09,146.94 127.84,149.88 127.84,149.88 127.84,149.88 127.94,152.94 127.94,152.94 127.94,152.94 127.97,156.03 127.97,156.03 127.97,156.03 127.97,158.97 127.97,158.97 127.97,158.97 127.94,161.91 127.94,161.91 127.94,161.91 127.97,164.94 127.97,164.94 127.97,164.94 128.78,168.00 128.78,168.00 128.78,168.00 129.03,170.97 129.03,170.97 129.03,170.97 129.81,173.97 129.81,173.97 129.81,173.97 130.91,176.97 130.91,176.97 130.91,176.97 132.03,178.22 132.03,178.19 132.03,178.16 133.91,177.78 133.91,177.78 133.91,177.78 133.97,175.47 133.97,175.47 133.97,175.47 134.00,172.91 134.00,172.88 134.00,172.84 134.00,169.44 134.00,169.44 134.00,169.44 134.88,166.06 134.88,166.06 134.88,166.06 136.38,162.66 136.38,162.66 136.38,162.66 137.38,159.69 137.38,159.69 137.38,159.69 138.91,156.19 138.91,156.19 138.91,156.19 140.25,153.00 140.25,153.00 140.25,153.00 141.94,150.66 141.94,150.66 141.94,150.66 144.03,147.81 144.03,147.81 144.03,147.81 145.62,145.81 145.62,145.81 145.62,145.81 147.09,144.06 147.09,144.06 147.09,144.06 148.62,142.19 148.66,142.19 148.69,142.19 150.62,139.59 150.66,139.59 150.69,139.59 152.31,137.50 152.31,137.50 152.31,137.50 154.34,135.03 154.34,135.03 154.34,135.03 156.16,133.12 156.16,133.12 156.16,133.12 158.38,130.81 158.38,130.81 158.38,130.81 161.00,128.09 161.00,128.09 161.00,128.09 163.03,124.91 163.03,124.91 163.03,124.91 164.09,122.53 164.09,122.53 164.09,122.53 165.50,119.09 165.50,119.09 165.50,119.09 167.00,116.47 167.00,116.44 167.00,116.41 167.56,113.78 167.56,113.78 167.56,113.78 168.00,110.03 168.00,110.03 168.00,110.03 168.09,106.47 168.09,106.47 168.09,106.47 168.03,102.94 168.03,102.94 168.03,102.94 167.50,99.62 167.50,99.62 167.50,99.62 167.12,97.91 167.09,97.94 167.06,97.97 165.66,94.62 165.66,94.66 165.66,94.69 164.84,92.62 164.84,92.62 164.84,92.62 163.97,90.91 163.97,90.91 163.97,90.91 162.00,87.84 162.00,87.84 162.00,87.84 160.25,86.00 160.25,86.00 160.25,86.00 158.84,84.12 158.84,84.12 158.84,84.12 156.88,81.69 156.88,81.69 156.88,81.69 156.44,79.16 156.44,79.16 156.44,79.16 158.28,77.22 158.28,77.22 158.28,77.22 160.34,77.16 160.34,77.16 160.34,77.16 163.06,77.66 163.06,77.66 163.06,77.66 165.62,77.72 165.62,77.72 165.62,77.72 169.00,77.81 169.00,77.81 169.00,77.81 173.00,78.94 173.00,78.94 173.00,78.94 176.22,79.88 176.25,79.88 176.28,79.88 179.91,80.84 179.91,80.81 179.91,80.78 183.25,81.97 183.25,81.97 183.25,81.97 186.97,83.78 186.97,83.78 186.97,83.78 191.44,85.28 191.44,85.28 191.44,85.28 195.22,87.19 195.22,87.22 195.22,87.25 198.06,88.97 198.06,88.97 198.06,88.97 200.81,91.09 200.81,91.09 200.81,91.09 203.62,93.41 203.62,93.41 203.62,93.41 205.84,95.69 205.84,95.69 205.84,95.69 208.59,98.31 208.59,98.31 208.59,98.31 210.47,101.22 210.47,101.22 210.47,101.22 212.16,103.81 212.16,103.81 212.16,103.81 214.03,107.12 214.06,107.12 214.09,107.12 215.06,109.44 215.12,109.56 215.19,109.69 216.50,112.72 216.53,112.75 216.56,112.78 217.72,116.34 217.72,116.34 217.72,116.34 218.78,119.84 218.78,119.84 218.78,119.84 219.59,122.66 219.59,122.66 219.59,122.66 220.28,126.06 220.28,126.06 220.28,126.06 220.59,129.12 220.59,129.12 220.59,129.12 220.59,132.00 220.59,132.00 220.59,132.00 220.62,135.12 220.62,135.12 220.62,135.12 220.72,137.97 220.69,137.97 220.66,137.97 220.50,141.00 220.50,141.00 220.50,141.00 220.41,144.03 220.41,144.03 220.41,144.03 220.16,146.97 220.16,146.97 220.16,146.97 219.50,149.94 219.50,149.94 219.50,149.94 219.03,152.94 219.03,152.94 219.03,152.94 218.50,156.00 218.50,156.00 218.50,156.00 218.22,158.97 218.22,158.97 218.22,158.97 217.41,162.00 217.41,162.00 217.41,162.00 217.34,164.78 217.34,164.78 217.34,164.78 216.88,167.91 216.88,167.91 216.88,167.91 217.00,171.03 217.00,171.03 217.00,171.03 217.25,173.72 217.25,173.72 217.25,173.72 218.00,177.12 218.00,177.12 218.00,177.12 218.78,180.00 218.78,180.00 218.78,180.00 221.56,182.91 221.56,182.91 221.56,182.91 224.94,184.03 224.94,184.03 224.94,184.03 228.00,184.28 228.03,184.28 228.06,184.28 230.84,184.12 230.88,184.12 230.91,184.12 234.00,183.03 234.00,183.03 234.00,183.03 236.62,180.00 236.62,180.00 236.62,180.00 239.16,177.31 239.16,177.31 239.16,177.31 241.12,174.81 241.12,174.81 241.12,174.81 242.12,172.06 242.12,172.06 242.12,172.06 243.88,170.91 243.88,170.91 243.88,170.91 246.03,171.84 246.03,171.84 246.03,171.84 247.75,173.91 247.75,173.91 247.75,173.91 249.31,176.59 249.31,176.59 249.31,176.59 251.06,179.50 251.06,179.53 251.06,179.56 252.91,182.12 252.91,182.12 252.91,182.12 254.41,184.91 254.41,184.91 254.41,184.91 256.50,187.97 256.47,187.97 256.44,187.97 257.50,191.00 257.50,191.00 257.50,191.00 258.66,194.38 258.66,194.38 258.66,194.38 259.03,197.59 259.09,197.69 259.16,197.78 260.03,200.94 260.03,200.94 260.03,200.94 260.78,203.91 260.75,203.94 260.72,203.97 260.72,206.81 260.72,206.84 260.72,206.88 260.94,209.94 260.94,209.94 260.94,209.94 261.12,212.97 261.12,212.97 261.12,212.97 260.97,215.81 260.97,215.81 260.97,215.81 260.56,218.91 260.56,218.91 260.56,218.91 260.09,221.97 260.09,221.97 260.09,221.97 259.72,224.94 259.72,224.94 259.72,224.94 259.25,227.97 259.25,227.97 259.25,227.97 258.91,231.03 258.91,231.03 258.91,231.03 258.16,233.91 258.16,233.91 258.16,233.91 257.25,236.78 257.25,236.81 257.25,236.84 256.28,240.00 256.28,240.00 256.28,240.00 255.19,243.00 255.19,243.00 255.19,243.00 253.94,245.81 253.94,245.81 253.94,245.81 252.41,248.81 252.34,248.81 252.28,248.81 250.06,251.44 250.06,251.44 250.06,251.44 248.00,254.47 248.03,254.47 248.06,254.47 246.31,257.25 246.31,257.25 246.31,257.25 243.75,260.25 243.66,260.34 243.56,260.44 240.62,263.50 240.62,263.50 240.62,263.50 237.88,266.47 237.88,266.47 237.88,266.47 234.28,269.41 234.31,269.41 234.34,269.41 231.53,271.62 231.53,271.62 231.53,271.62 228.44,273.31 228.44,273.31 228.44,273.31 225.31,275.41 225.31,275.41 225.31,275.41 222.19,277.72 222.19,277.72 222.19,277.72 219.16,279.12 219.16,279.12 219.16,279.12 216.38,280.53 216.38,280.53 216.38,280.53 213.09,281.69 213.09,281.69 213.09,281.69 209.84,283.50 209.84,283.50 209.84,283.50 205.97,284.50 205.94,284.50 205.91,284.50 201.53,285.72 201.50,285.75 201.47,285.78 197.72,286.59 197.72,286.59 197.72,286.59 193.94,287.16 193.94,287.16 193.94,287.16 190.47,287.81 190.47,287.81 190.47,287.81 186.34,287.84 186.34,287.84 186.34,287.84 183.09,288.00 183.09,288.00 183.09,288.00 180.28,287.91 180.28,287.91 180.28,287.91 177.28,287.03 177.00,287.03 176.72,287.03 173.97,286.66 173.97,286.66 173.97,286.66 170.84,286.44 170.84,286.44 170.84,286.44 168.22,286.22 168.19,286.22 168.16,286.22 165.12,286.09 165.12,286.09 165.12,286.09 162.06,285.28 162.06,285.28 162.06,285.28 159.03,284.72 159.03,284.72 159.03,284.72 156.06,284.16 156.06,284.16 156.06,284.16 152.91,283.00 152.91,283.00 152.91,283.00 150.12,281.94 150.12,281.94 150.12,281.94 147.06,280.94 147.03,280.97 147.00,281.00 144.09,279.75 144.09,279.75 144.09,279.75 141.22,278.72 141.22,278.72 141.22,278.72 138.25,276.84 138.19,276.97 138.12,277.09 135.16,275.09 135.16,275.09 135.16,275.09 132.12,273.44 132.12,273.44 132.12,273.44 128.97,271.22 128.97,271.22 128.97,271.22 126.88,269.59 126.88,269.59 126.88,269.59 124.31,267.38 124.31,267.38 124.31,267.38 122.28,265.38 122.28,265.38 122.28,265.38 119.56,262.69 119.56,262.69 119.56,262.69 117.47,260.66 117.47,260.62 117.47,260.59 115.41,258.47 115.41,258.44 115.41,258.41 113.88,256.19 113.88,256.19 113.88,256.19 111.69,253.34 111.69,253.34 111.69,253.34 109.94,250.47 109.94,250.47 109.94,250.47 107.81,247.38 107.81,247.34 107.81,247.31 106.34,244.78 106.34,244.78 106.34,244.78 105.06,241.84 105.06,241.84 105.06,241.84 103.91,239.28 103.91,239.28 103.91,239.28 102.91,236.75 102.91,236.75" /> </svg> --- shapes/modular.csv --- 0.046100,0.390000 0.167300,0.512900 0.019900,0.413400 0.400000,0.759900 0.310000,0.643900 0.429900,0.585600 0.242700,0.390000 0.449900,0.684300 0.173400,0.610200 0.020000,0.463200 0.273100,0.510600 0.330000,0.664100 0.163400,0.389900 0.020000,0.476400 0.310000,0.560000 0.292700,0.531700 0.263300,0.790000 0.143100,0.519400 0.110000,0.596400 0.276800,0.790100 0.430000,0.720000 0.330000,0.602900 0.330000,0.650700 0.450000,0.707500 0.286700,0.790000 0.406400,0.759900 0.429900,0.613300 0.212300,0.649800 0.159000,0.489700 0.023300,0.390000 0.130000,0.586400 0.310000,0.637000 0.249200,0.390000 0.255000,0.644700 0.185200,0.565100 0.449900,0.557600 0.445000,0.650000 0.130000,0.656900 0.330000,0.609400 0.130000,0.599600 0.130000,0.690000 0.327100,0.790000 0.020000,0.482800 0.159500,0.568700 0.429900,0.619800 0.020000,0.663600 0.103500,0.790000 0.330000,0.615900 0.130000,0.606100 0.226100,0.390000 0.109800,0.790000 0.449900,0.544200 0.190000,0.580000 0.099800,0.389900 0.274900,0.390000 0.429900,0.626300 0.080100,0.780100 0.309900,0.667000 0.215200,0.657800 0.257100,0.638600 0.251000,0.577200 0.437000,0.719900 0.330000,0.657000 0.310000,0.572800 0.330000,0.579800 0.329900,0.673400 0.109900,0.520300 0.020000,0.525200 0.056600,0.389900 0.320100,0.690000 0.079500,0.389900 0.110000,0.546700 0.062900,0.389900 0.430000,0.579900 0.109800,0.506700 0.409800,0.739900 0.300000,0.790000 0.302400,0.510300 0.150500,0.790000 0.156800,0.790000 0.330000,0.593000 0.069500,0.389900 0.300200,0.390000 0.130000,0.612600 0.449900,0.503500 0.399900,0.420200 0.330000,0.553200 0.330000,0.573100 0.274700,0.585600 0.110000,0.540000 0.285700,0.552600 0.276700,0.500100 0.236900,0.619400 0.399900,0.433400 0.330000,0.566400 0.196300,0.599700 0.020000,0.636800 0.080100,0.760000 0.426900,0.450100 0.100000,0.790000 0.399900,0.440000 0.289000,0.542900 0.196000,0.597900 0.330000,0.559700 0.162200,0.497800 0.020000,0.650000 0.307500,0.510300 0.439900,0.719900 0.413000,0.450000 0.130000,0.634600 0.130000,0.674900 0.187100,0.571400 0.020000,0.518300 0.109900,0.533300 0.323200,0.390000 0.430100,0.450100 0.429900,0.590000 0.089600,0.389900 0.449900,0.703400 0.136800,0.790000 0.019800,0.419900 0.130000,0.523300 0.449900,0.460000 0.109900,0.526600 0.207200,0.632300 0.019800,0.426500 0.449900,0.466600 0.144000,0.790000 0.060000,0.749900 0.223700,0.690000 0.304900,0.510300 0.310000,0.626900 0.211300,0.647100 0.297300,0.390000 0.050000,0.749900 0.230000,0.690000 0.110000,0.643400 0.120100,0.790000 0.056300,0.749900 0.310000,0.490000 0.383200,0.389900 0.310000,0.600300 0.254000,0.647600 0.243600,0.679300 0.214300,0.655400 0.446000,0.450100 0.429900,0.569900 0.276000,0.501800 0.309900,0.673100 0.227700,0.647200 0.450000,0.719900 0.130000,0.668000 0.310000,0.613500 0.194000,0.592600 0.262500,0.542400 0.267100,0.608300 0.423300,0.450100 0.080000,0.766300 0.130000,0.556200 0.020000,0.587100 0.130000,0.573300 0.110000,0.560800 0.020000,0.501900 0.185700,0.647200 0.247200,0.588700 0.109900,0.687300 0.174500,0.613600 0.130000,0.549500 0.020000,0.740000 0.020000,0.600300 0.224900,0.655500 0.109900,0.677800 0.449900,0.472900 0.110000,0.636500 0.449900,0.550100 0.206500,0.789900 0.347300,0.390000 0.173000,0.790000 0.330000,0.510000 0.227100,0.690000 0.114000,0.490100 0.164300,0.505200 0.110000,0.554100 0.399900,0.446100 0.354500,0.390000 0.168200,0.515000 0.052600,0.390000 0.160100,0.389900 0.235900,0.622500 0.229900,0.790000 0.143500,0.389900 0.268500,0.524400 0.270300,0.519200 0.020000,0.613500 0.130000,0.641200 0.370000,0.760000 0.179600,0.548200 0.387700,0.390000 0.297100,0.519100 0.020000,0.717100 0.360000,0.769800 0.248500,0.664200 0.019900,0.397300 0.429900,0.624000 0.180000,0.630100 0.357800,0.390000 0.020000,0.620000 0.449900,0.680100 0.186600,0.389900 0.233700,0.629100 0.146800,0.389900 0.203200,0.790000 0.242800,0.681300 0.130200,0.389900 0.173300,0.389900 0.130000,0.647700 0.294800,0.490000 0.197300,0.602300 0.156700,0.389900 0.282700,0.561900 0.410100,0.450000 0.310000,0.660900 0.135000,0.490000 0.110000,0.629600 0.361000,0.390000 0.449900,0.493900 0.272700,0.591600 0.450000,0.655500 0.310000,0.654200 0.435000,0.650000 0.201800,0.615600 0.110000,0.622900 0.120100,0.490100 0.359900,0.779900 0.123400,0.389900 0.270200,0.599200 0.110000,0.616200 0.020000,0.557300 0.110000,0.573600 0.289900,0.540100 0.179000,0.626900 0.040000,0.749900 0.330000,0.634600 0.310000,0.535700 0.020000,0.570500 0.449900,0.673200 0.267700,0.527000 0.172300,0.606900 0.110000,0.580100 0.269200,0.602300 0.125100,0.690000 0.217000,0.661700 0.020000,0.696800 0.310000,0.576800 0.034700,0.390000 0.115100,0.690000 0.310000,0.647300 0.181200,0.554200 0.293600,0.529100 0.269400,0.522000 0.449900,0.540000 0.367100,0.390000 0.036700,0.750000 0.330000,0.647600 0.110000,0.586600 0.130000,0.570100 0.130000,0.535500 0.249100,0.582900 0.019900,0.410000 0.393400,0.760000 0.449900,0.546500 0.232700,0.632200 0.251900,0.574400 0.310000,0.556700 0.246400,0.590800 0.271400,0.390000 0.020000,0.466500 0.430000,0.575700 0.110000,0.593100 0.020000,0.453200 0.020000,0.473100 0.109900,0.657100 0.236000,0.790000 0.020000,0.479700 0.110000,0.606300 0.130000,0.589800 0.429900,0.616700 0.189300,0.657700 0.020000,0.723000 0.046400,0.749900 0.449900,0.533100 0.130000,0.583100 0.116800,0.790000 0.225700,0.653000 0.429900,0.629900 0.020000,0.673700 0.110000,0.690000 0.360000,0.774200 0.222800,0.390000 0.410000,0.749900 0.112800,0.790000 0.232700,0.390000 0.130000,0.596300 0.310000,0.521900 0.330000,0.653900 0.020000,0.536800 0.019800,0.415700 0.041100,0.390000 0.158400,0.565200 0.193200,0.389900 0.109900,0.670100 0.310000,0.680000 0.231700,0.635100 0.203100,0.389900 0.249600,0.661100 0.086100,0.389900 0.191500,0.664500 0.399900,0.402400 0.306700,0.390000 0.330000,0.680300 0.420000,0.720000 0.195200,0.675900 0.450000,0.659900 0.224100,0.657800 0.290000,0.790000 0.062800,0.749900 0.272200,0.513500 0.306800,0.790100 0.110000,0.550100 0.322800,0.790000 0.120100,0.690000 0.399900,0.423600 0.330000,0.619100 0.020000,0.439500 0.130000,0.609300 0.329900,0.670100 0.289900,0.490000 0.020000,0.446100 0.420100,0.450100 0.123200,0.790000 0.069900,0.750000 0.147200,0.531800 0.330000,0.569800 0.437200,0.450200 0.330000,0.589700 0.020000,0.660100 0.110000,0.556600 0.310000,0.542900 0.330000,0.549900 0.310000,0.590700 0.020000,0.508500 0.242300,0.603400 0.020000,0.653400 0.310000,0.533400 0.080000,0.790000 0.244700,0.676000 0.219500,0.389900 0.313200,0.390000 0.109800,0.509900 0.076000,0.389900 0.130000,0.615800 0.183200,0.789900 0.286900,0.549200 0.284600,0.556200 0.248100,0.585800 0.020000,0.646700 0.020000,0.521700 0.130000,0.671600 0.110000,0.543200 0.329900,0.533000 0.433300,0.720000 0.310000,0.500100 0.020000,0.640000 0.020000,0.515000 0.109900,0.530000 0.020000,0.390000 0.193500,0.670500 0.080000,0.750000 0.303500,0.390000 0.354400,0.789900 0.019900,0.394500 0.430000,0.582900 0.019800,0.429800 0.020000,0.492200 0.359900,0.783900 0.090100,0.790000 0.206300,0.690000 0.096400,0.790000 0.150000,0.540100 0.330000,0.686400 0.320000,0.510000 0.399900,0.409900 0.196100,0.678800 0.449900,0.469800 0.245000,0.595000 0.140000,0.510000 0.160600,0.493900 0.310000,0.610200 0.449900,0.476400 0.294100,0.527600 0.350000,0.789900 0.053900,0.749900 0.266200,0.611200 0.291200,0.390000 0.184600,0.643800 0.233700,0.690000 0.140200,0.389900 0.295700,0.523100 0.278700,0.573700 0.208900,0.638600 0.177000,0.541500 0.240000,0.690000 0.258200,0.555400 0.110000,0.493600 0.429900,0.593000 0.196700,0.790000 0.019800,0.422900 0.020000,0.597000 0.310000,0.664500 0.360000,0.760000 0.109900,0.389900 0.199900,0.790000 0.020000,0.630100 0.200700,0.612800 0.429900,0.599500 0.020000,0.623400 0.136800,0.389900 0.175600,0.616900 0.197300,0.682900 0.209700,0.640700 0.130000,0.526100 0.449800,0.693400 0.265200,0.614100 0.330000,0.546300 0.445100,0.569900 0.399900,0.416100 0.449900,0.537100 0.310000,0.687000 0.145700,0.490100 0.176700,0.789900 0.213900,0.690000 0.171200,0.603700 0.020000,0.547500 0.110000,0.626300 0.234800,0.625900 0.059900,0.389900 0.120000,0.389900 0.189800,0.790000 0.123000,0.490100 0.283500,0.790100 0.389900,0.760000 0.430000,0.650000 0.109900,0.516000 0.130000,0.545800 0.243200,0.600600 0.270200,0.790100 0.151000,0.542900 0.260600,0.548400 0.239100,0.612800 0.110000,0.499800 0.228700,0.644000 0.409800,0.743600 0.110000,0.612900 0.020000,0.706900 0.169800,0.790000 0.325000,0.510000 0.396400,0.390000 0.449900,0.462500 0.020000,0.567200 0.020000,0.720100 0.166700,0.389900 0.449900,0.669900 0.165700,0.587200 0.153000,0.549100 0.140100,0.490000 0.409800,0.735400 0.276700,0.579500 0.449900,0.676400 0.296400,0.520800 0.020000,0.450100 0.440100,0.650000 0.226400,0.790000 0.206300,0.389900 0.449900,0.516800 0.161700,0.496600 0.154700,0.490100 0.020000,0.469900 0.110000,0.583300 0.449900,0.510100 0.449900,0.530000 0.188100,0.654200 0.206200,0.629800 0.189000,0.577500 0.019900,0.400100 0.383000,0.760000 0.253400,0.790000 0.148600,0.535800 0.130000,0.532200 0.174100,0.534300 0.110000,0.653800 0.019900,0.406700 0.416500,0.720000 0.449900,0.523300 0.256000,0.641700 0.080100,0.754000 0.246700,0.790000 0.258100,0.635400 0.110000,0.589800 0.261700,0.545000 0.360000,0.764400 0.175300,0.537300 0.252200,0.653300 0.310000,0.546700 0.363900,0.760000 0.260300,0.628700 0.400000,0.390000 0.429900,0.633300 0.410000,0.760000 0.247200,0.668300 0.020000,0.443200 0.110000,0.603000 0.130000,0.566600 0.189900,0.389900 0.299100,0.513400 0.176700,0.620200 0.109900,0.667000 0.161700,0.496400 0.199800,0.389900 0.310000,0.540000 0.130000,0.579800 0.449900,0.454000 0.264200,0.617000 0.109900,0.660300 0.409900,0.729900 0.109900,0.680200 0.219900,0.789900 0.155100,0.555200 0.154000,0.552100 0.171400,0.524600 0.066200,0.389900 0.359900,0.776000 0.130000,0.593000 0.410000,0.746600 0.424800,0.720000 0.110000,0.609500 0.266800,0.529700 0.184000,0.562000 0.410000,0.720000 0.239400,0.390000 0.263200,0.390000 0.020000,0.676900 0.213500,0.652700 0.109800,0.513500 0.190400,0.661000 0.250100,0.790000 0.275700,0.582600 0.129800,0.790000 0.329900,0.543300 0.193700,0.591500 0.266900,0.790100 0.156100,0.558400 0.195000,0.595200 0.020000,0.670200 0.268100,0.605300 0.399900,0.407100 0.310000,0.553000 0.310000,0.580900 0.399900,0.413700 0.216200,0.389900 0.339700,0.789900 0.303500,0.790000 0.449800,0.685700 0.241200,0.606600 0.176600,0.540600 0.092900,0.790000 0.325000,0.690000 0.399900,0.426900 0.449900,0.697000 0.329900,0.529900 0.288100,0.390000 0.245900,0.390000 0.105500,0.790000 0.330000,0.586400 0.254700,0.565900 0.020000,0.656800 0.346500,0.789900 0.310000,0.587400 0.130000,0.627200 0.020000,0.505200 0.240200,0.609700 0.310000,0.510200 0.126800,0.389900 0.330000,0.599600 0.330000,0.690000 0.067500,0.750000 0.330100,0.520100 0.329900,0.536400 0.109900,0.673100 0.020000,0.643400 0.329900,0.666600 0.429900,0.610000 0.278300,0.390000 0.310000,0.593900 0.196900,0.681700 0.310100,0.790100 0.020000,0.489000 0.110000,0.650200 0.450000,0.662900 0.186500,0.790000 0.020000,0.511700 0.130000,0.619000 0.038100,0.390000 0.165200,0.507500 0.143900,0.521900 0.449900,0.479900 0.133700,0.790000 0.310000,0.677600 0.310000,0.510000 0.310000,0.529900 0.449900,0.486500 0.330000,0.627300 0.140900,0.790000 0.273700,0.588600 0.222000,0.664100 0.130000,0.510000 0.147200,0.790000 0.230800,0.637900 0.250000,0.580000 0.204000,0.622800 0.294200,0.390000 0.333000,0.790000 0.130000,0.563000 0.222600,0.662300 0.330100,0.513200 0.217900,0.664000 0.288000,0.545900 0.315000,0.510000 0.019800,0.433000 0.172900,0.530100 0.020000,0.495400 0.310000,0.606900 0.019900,0.404300 0.116600,0.389900 0.181200,0.633600 0.146100,0.528300 0.193000,0.790000 0.360000,0.790000 0.220300,0.690000 0.297500,0.517900 0.310000,0.620100 0.310000,0.495100 0.416600,0.450100 0.130100,0.490000 0.251300,0.656000 0.096300,0.389900 0.210000,0.690000 0.160000,0.790000 0.020000,0.593700 0.170400,0.522100 0.286000,0.490000 0.144900,0.524900 0.020000,0.606900 0.429900,0.596200 0.020000,0.626800 0.339200,0.390000 0.449900,0.569900 0.304000,0.490000 0.271000,0.596700 0.226700,0.650200 0.130000,0.659700 0.435100,0.569900 0.329500,0.390000 0.263300,0.619800 0.266000,0.532100 0.310000,0.565400 0.020000,0.580300 0.300000,0.490000 0.264200,0.537300 0.345400,0.789900 0.262400,0.622500 0.020000,0.550900 0.199700,0.689800 0.169000,0.597100 0.106400,0.389900 0.210800,0.643700 0.450000,0.710100 0.429900,0.602700 0.372700,0.760000 0.216700,0.661700 0.110000,0.567200 0.379900,0.760000 0.110000,0.490000 0.238000,0.616100 0.031700,0.390000 0.198600,0.605700 0.369900,0.390000 0.248100,0.665600 0.279100,0.492800 0.179900,0.550800 0.020000,0.544200 0.164600,0.583900 0.132400,0.510000 0.244100,0.597800 0.364100,0.390000 0.380100,0.389900 0.449800,0.689900 0.163800,0.503900 0.336000,0.390000 0.376700,0.760000 0.430000,0.640000 0.020000,0.683700 0.020000,0.703600 0.020000,0.563900 0.330000,0.641200 0.136400,0.490000 0.163600,0.580700 0.020000,0.577100 0.162500,0.498600 0.188100,0.573900 0.212900,0.389900 0.449900,0.526900 0.310000,0.690000 0.281700,0.564900 0.259200,0.632100 0.242200,0.683200 0.167900,0.593800 0.130000,0.529100 0.218900,0.666600 0.020000,0.710100 0.134800,0.510000 0.183300,0.389900 0.293500,0.790000 0.130000,0.542300 0.182300,0.636900 0.174000,0.533000 0.020000,0.690200 0.150100,0.490100 0.170000,0.389900 0.260000,0.790000 0.153400,0.389900 0.315000,0.690000 0.250400,0.658600 0.130000,0.637900 0.160000,0.490100 0.245500,0.673400 0.020000,0.460000 0.130000,0.520900 0.130000,0.631200 0.109900,0.663900 0.130000,0.653900 0.257400,0.557900 0.166800,0.590500 0.190900,0.582400 0.246100,0.671500 0.196500,0.389900 0.351100,0.390000 0.449900,0.500100 0.449900,0.520000 0.202900,0.620100 0.255800,0.390000 0.253100,0.650500 0.449900,0.513300 0.029900,0.750000 0.130000,0.680300 0.310000,0.563300 0.399900,0.437300 0.409900,0.733300 0.080100,0.783800 0.280700,0.567800 0.110000,0.599700 0.236100,0.390000 0.329900,0.527000 0.259000,0.390000 0.330000,0.606200 0.397000,0.759900 0.316200,0.790000 0.169500,0.519800 0.223400,0.789900 0.449900,0.506600 0.423800,0.720000 0.130000,0.514000 0.430000,0.646100 0.450000,0.716000 0.130000,0.576500 0.170100,0.600400 0.310000,0.549900 0.310000,0.640300 0.273500,0.790100 0.330000,0.612700 0.130000,0.602900 0.020000,0.528700 0.255700,0.563000 0.193000,0.669000 0.310000,0.633600 0.192000,0.666000 0.274900,0.505100 0.329900,0.540000 0.186800,0.650500 0.267300,0.390000 0.020000,0.666900 0.252500,0.390000 0.399900,0.450200 0.281700,0.390000 0.261500,0.625300 0.449900,0.665800 0.313500,0.790100 0.300000,0.510200 0.330000,0.583100 0.080100,0.776700 0.020000,0.485900 0.208100,0.634600 0.182200,0.556900 0.399900,0.430200 0.310000,0.584100 0.284900,0.390000 0.409900,0.726200 0.019900,0.736600 0.229400,0.390000 0.130000,0.686400 0.330000,0.576400 0.103100,0.389900 0.330000,0.596300 0.109900,0.502200 0.319400,0.790000 0.265100,0.534700 0.019900,0.729900 0.449900,0.490000 0.171800,0.527400 0.084000,0.789900 0.080100,0.763300 0.410000,0.756100 0.449900,0.700200 0.429900,0.606700 0.309900,0.670100 0.403600,0.450000 0.023900,0.750000 0.082800,0.389900 0.080000,0.770000 0.330000,0.563000 0.310000,0.513400 0.199400,0.609600 0.109900,0.523400 0.020000,0.633400 0.263400,0.539900 0.110000,0.646900 0.343300,0.390000 0.449900,0.450100 0.019900,0.401200 0.020000,0.743700 0.433300,0.450100 0.310000,0.526600 0.309800,0.390000 0.295100,0.490000 0.330200,0.790000 0.310000,0.597100 0.296700,0.790000 0.279700,0.570700 0.126800,0.490000 0.241400,0.685500 0.113200,0.389900 0.310000,0.630200 0.130000,0.559700 0.110000,0.536400 0.253800,0.568800 0.449900,0.483100 0.316600,0.390000 0.076500,0.750000 0.277400,0.497700 0.330000,0.659900 0.430000,0.637300 0.445900,0.719900 0.280000,0.490000 0.200000,0.689900 0.440200,0.569900 0.310000,0.603600 0.229900,0.640600 0.310000,0.623500 0.072700,0.389900 0.092900,0.389900 0.179900,0.789900 0.166300,0.510300 0.166600,0.790000 0.215300,0.690000 0.162200,0.576600 0.191700,0.586400 0.330000,0.556100 0.310000,0.616800 0.439900,0.450200 0.153600,0.790000 0.319900,0.390000 0.020000,0.498600 0.020000,0.436100 0.020000,0.750000 0.310000,0.505000 0.126400,0.790000 0.449900,0.560100 0.291800,0.534500 0.386800,0.760000 0.220000,0.670200 0.157200,0.561700 0.283600,0.559000 0.130000,0.552800 0.020000,0.590400 0.130000,0.677800 0.449900,0.553400 0.185900,0.568300 0.337200,0.789900 0.310000,0.568800 0.020000,0.583700 0.160900,0.572600 0.020000,0.603600 0.205100,0.625500 0.110000,0.639800 0.163200,0.790000 0.252800,0.571700 0.234000,0.790000 0.310000,0.519500 0.256500,0.560500 0.020000,0.616800 0.194300,0.673200 0.110000,0.633100 0.130000,0.644500 0.049700,0.390000 0.277700,0.576700 0.310000,0.657700 0.020000,0.610100 0.326400,0.390000 0.110000,0.563900 0.271300,0.516000 0.374300,0.390000 0.080000,0.774600 0.274100,0.507500 0.223300,0.660200 0.299800,0.511000 0.209800,0.789900 0.243500,0.790000 0.399900,0.393400 0.449900,0.495900 0.032700,0.750000 0.130000,0.623100 0.399900,0.400000 0.020000,0.540900 0.020000,0.693800 0.152000,0.546000 0.290800,0.537400 0.177900,0.623500 0.020000,0.736400 0.178300,0.544900 0.209600,0.389900 0.020000,0.554100 0.029300,0.390000 0.183000,0.559300 0.110000,0.570400 0.376600,0.389900 0.259400,0.551900 0.245700,0.592900 0.390100,0.390000 0.183400,0.640200 0.213100,0.789900 0.180000,0.389900 0.332800,0.390000 0.449900,0.650100 0.020000,0.532700 0.216700,0.789900 0.330100,0.522500 0.150100,0.389900 0.240100,0.790000 0.330000,0.677700 0.020000,0.560600 0.192700,0.588800 0.110000,0.576900 0.133500,0.389900 0.176600,0.389900 0.330000,0.637900 0.280100,0.790100 0.294900,0.525400 0.330000,0.623200 0.110000,0.619500 0.020000,0.713500 0.449900,0.566200 0.141100,0.513400 0.020000,0.573800 0.137400,0.510000 0.130000,0.650800 0.330000,0.631200 0.141900,0.490000 0.020000,0.686900 0.020000,0.456800 0.043400,0.749900 0.271800,0.594200 0.130000,0.539000 0.130000,0.664000 0.330000,0.644400 0.020000,0.700100 0.256800,0.790000 0.220700,0.668000 0.019900,0.727400 0.020000,0.680200 0.310000,0.650600 0.019900,0.406800 --- shapes/modular.svg --- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg xmlns="http://www.w3.org/2000/svg" width="0.393333in" height="0.393333in" viewBox="0 0 118 118"> <path id="Unnamed" fill="none" stroke="black" stroke-width="1" d="M 30.00,51.02 C 30.00,51.02 30.24,51.03 30.49,51.03 30.75,51.03 31.00,51.02 31.00,51.02 31.00,51.02 31.00,51.34 31.00,51.95 31.00,52.19 31.00,52.66 31.00,52.99 31.00,53.34 31.00,53.57 31.00,54.00 31.00,54.29 31.00,54.67 31.00,54.99 31.00,55.30 31.00,55.67 31.00,56.00 31.00,56.33 31.00,56.54 31.00,56.88 31.00,57.28 31.00,57.68 31.00,58.09 31.00,58.41 31.00,58.74 31.00,59.07 31.00,59.39 31.00,59.71 31.00,60.03 31.00,60.36 31.00,60.69 31.00,61.02 31.00,61.35 31.00,61.68 31.00,62.01 31.00,62.35 31.00,62.69 31.00,63.02 31.00,63.36 31.00,63.70 31.00,64.03 31.00,64.39 31.00,64.73 31.00,65.06 31.00,65.42 31.00,65.77 31.00,66.09 31.00,66.45 30.99,66.70 30.99,67.01 30.99,67.31 31.00,67.76 31.00,68.00 31.00,68.70 31.00,69.00 31.00,69.00 31.00,69.00 31.50,69.00 32.01,69.00 32.50,69.00 33.00,69.00 33.00,69.00 33.00,69.00 33.00,68.64 33.00,68.03 33.00,67.77 32.99,67.34 32.99,67.01 32.99,66.66 33.00,66.41 33.00,65.99 33.00,65.70 33.00,65.39 33.00,65.07 33.00,64.76 33.00,64.44 33.00,64.12 33.00,63.79 33.00,63.46 33.00,63.12 33.00,62.73 33.00,62.32 33.00,61.91 33.00,61.59 33.00,61.27 33.00,60.94 33.00,60.62 33.00,60.29 33.00,59.96 33.00,59.63 33.00,59.30 33.00,58.97 33.00,58.64 33.00,58.31 33.00,57.98 33.00,57.64 33.00,57.31 33.00,56.98 33.00,56.64 33.00,56.30 33.00,55.97 33.00,55.61 33.00,55.32 33.00,54.99 33.00,54.63 32.99,54.33 32.99,54.00 32.99,53.64 32.99,53.30 32.99,52.99 32.99,52.70 33.01,52.25 33.01,52.01 33.01,51.32 33.00,51.00 33.00,51.00 33.00,51.00 32.50,51.00 32.00,51.00 31.50,51.00 31.00,51.00 31.00,51.00 31.00,51.00 31.00,50.50 31.00,50.01 31.00,49.51 31.00,49.00 31.00,49.00 31.00,49.00 30.40,49.00 30.00,49.00 29.51,49.00 29.48,49.00 28.99,49.00 28.60,49.00 28.00,49.00 28.00,49.00 28.00,49.00 27.91,49.28 27.74,49.77 27.67,50.01 27.60,50.18 27.49,50.51 27.41,50.75 27.31,51.06 27.22,51.35 27.13,51.60 27.03,51.92 26.94,52.20 26.85,52.44 26.77,52.70 26.68,52.97 26.60,53.21 26.51,53.47 26.42,53.73 26.34,53.99 26.25,54.24 26.17,54.50 26.06,54.84 25.94,55.19 25.82,55.54 25.74,55.79 25.65,56.05 25.57,56.30 25.47,56.59 25.38,56.88 25.28,57.17 25.19,57.44 25.10,57.72 25.00,58.00 24.91,58.29 24.81,58.58 24.72,58.87 24.64,59.08 24.57,59.29 24.50,59.50 24.41,59.78 24.32,60.06 24.23,60.34 24.12,60.66 24.02,60.97 23.91,61.28 23.80,61.61 23.69,61.94 23.59,62.25 23.48,62.59 23.37,62.91 23.27,63.22 23.17,63.51 23.08,63.79 22.99,64.06 22.87,64.40 22.77,64.72 22.67,65.02 22.57,65.30 22.49,65.55 22.41,65.78 22.33,66.02 22.26,66.23 22.20,66.41 22.07,66.80 22.00,67.02 22.00,67.02 22.00,67.02 21.89,66.66 21.79,66.40 21.70,66.17 21.67,66.17 21.52,65.78 21.43,65.54 21.35,65.27 21.23,64.98 21.13,64.71 21.08,64.37 20.97,64.07 20.89,63.86 20.81,63.46 20.72,63.23 20.62,62.98 20.51,62.55 20.40,62.28 20.29,62.01 20.18,61.56 20.07,61.28 19.94,60.96 19.86,60.57 19.73,60.23 19.63,59.97 19.60,59.79 19.50,59.52 19.40,59.26 19.37,59.15 19.27,58.88 19.17,58.64 19.09,58.24 19.00,58.00 18.90,57.75 18.81,57.39 18.71,57.14 18.59,56.83 18.52,56.51 18.40,56.20 18.30,55.93 18.22,55.69 18.12,55.42 17.99,55.08 17.96,54.82 17.83,54.49 17.70,54.15 17.66,54.06 17.53,53.73 17.41,53.43 17.40,53.30 17.29,53.01 17.18,52.74 17.14,52.46 17.04,52.21 16.95,51.98 16.82,51.50 16.73,51.29 16.63,51.03 16.52,50.75 16.43,50.52 16.38,50.39 16.25,49.86 16.17,49.64 16.06,49.39 16.22,49.78 16.17,49.66 15.90,48.97 16.00,49.01 16.00,49.01 16.00,49.01 15.47,49.01 15.01,49.01 14.57,49.01 14.19,49.00 14.01,49.00 13.64,49.00 13.50,49.00 13.01,49.00 12.68,49.00 12.30,49.01 12.01,49.01 11.40,49.01 11.00,49.00 11.00,49.00 11.00,49.00 11.00,49.36 11.00,49.98 10.99,50.22 10.98,50.67 10.98,50.99 10.98,51.35 10.99,51.60 10.99,52.03 10.99,52.34 10.99,52.66 10.99,53.00 10.99,53.33 11.00,53.64 11.00,54.00 11.00,54.32 11.00,54.67 11.00,55.01 11.00,55.41 11.00,55.66 11.00,56.08 11.00,56.39 11.00,56.72 11.00,57.04 11.00,57.36 11.00,57.69 11.00,58.01 11.00,58.33 11.00,58.66 11.00,58.98 11.00,59.31 11.00,59.64 11.00,59.97 11.00,60.30 11.00,60.63 11.00,60.95 11.00,61.29 11.00,61.62 11.00,61.95 11.00,62.29 11.00,62.63 11.00,62.96 11.00,63.31 11.00,63.65 11.00,63.98 11.00,64.34 11.00,64.69 11.00,65.02 11.00,65.38 10.99,65.71 10.99,66.03 10.99,66.39 10.99,66.70 10.99,67.01 10.99,67.31 10.99,67.78 10.99,68.02 10.99,68.73 11.00,69.00 11.00,69.00 11.00,69.00 2.00,75.00 2.00,75.00 2.00,75.00 2.00,74.37 2.00,74.00 2.00,73.64 1.99,73.66 1.99,72.99 1.99,72.74 2.00,72.30 2.00,72.01 2.00,71.71 2.00,71.35 2.00,71.01 2.00,70.69 2.00,70.36 2.00,70.01 2.00,69.68 2.00,69.38 2.00,69.02 2.00,68.69 2.00,68.37 2.00,68.02 2.00,67.69 2.00,67.37 2.00,67.02 2.00,66.69 2.00,66.36 2.00,66.01 2.00,65.68 2.00,65.34 2.00,65.00 2.00,64.67 2.00,64.34 2.00,64.00 2.00,63.68 2.00,63.34 2.00,63.01 2.00,62.68 2.00,62.34 2.00,62.00 2.00,61.68 2.00,61.35 2.00,61.01 2.00,60.69 2.00,60.36 2.00,60.03 2.00,59.70 2.00,59.37 2.00,59.04 2.00,58.71 2.00,58.37 2.00,58.03 2.00,57.71 2.00,57.38 2.00,57.05 2.00,56.72 2.00,56.39 2.00,56.06 2.00,55.73 2.00,55.41 2.00,55.09 2.00,54.75 2.00,54.42 2.00,54.09 2.00,53.68 2.00,53.27 2.00,52.87 2.00,52.52 2.00,52.17 2.00,51.83 2.00,51.50 2.00,51.17 2.00,50.85 2.00,50.52 2.00,50.19 2.00,49.86 2.00,49.54 2.00,49.22 2.00,48.90 2.00,48.59 2.00,48.28 2.00,47.97 2.00,47.64 2.00,47.31 2.00,46.99 2.00,46.65 2.00,46.32 2.00,46.00 2.00,45.68 2.00,45.32 2.00,45.01 2.00,44.61 2.00,44.32 2.00,43.95 2.00,43.61 1.98,43.30 1.98,42.98 1.98,42.65 1.98,42.29 1.98,41.99 1.98,41.57 1.99,41.34 1.99,41.00 1.99,40.67 1.99,40.68 1.99,40.43 1.99,40.12 1.99,40.01 1.99,39.73 1.99,39.45 2.00,39.00 2.00,39.00 2.00,39.00 2.33,39.00 2.93,39.00 3.17,39.00 3.47,39.00 3.81,39.00 4.11,39.00 4.61,39.00 4.97,39.00 5.26,39.00 5.66,38.99 5.99,38.99 6.29,38.99 6.62,38.99 6.95,38.99 7.27,38.99 7.60,38.99 7.95,38.99 8.28,38.99 8.61,38.99 8.96,38.99 9.29,38.99 9.63,38.99 9.98,38.99 10.31,38.99 10.64,38.99 10.99,38.99 11.32,38.99 11.66,38.99 12.00,38.99 12.34,38.99 12.68,38.99 13.02,38.99 13.35,38.99 13.68,38.99 14.02,38.99 14.35,38.99 14.68,38.99 15.01,38.99 15.34,38.99 15.67,38.99 16.01,38.99 16.34,38.99 16.67,38.99 17.00,38.99 17.33,38.99 17.66,38.99 18.00,38.99 18.33,38.99 18.66,38.99 18.99,38.99 19.32,38.99 19.65,38.99 19.98,38.99 20.31,38.99 20.63,38.99 20.96,38.99 21.29,38.99 21.62,38.99 21.95,38.99 22.28,39.00 22.61,39.00 22.94,39.00 23.27,39.00 23.61,39.00 23.94,39.00 24.27,39.00 24.59,39.00 24.92,39.00 25.25,39.00 25.58,39.00 25.90,39.00 26.32,39.00 26.73,39.00 27.14,39.00 27.49,39.00 27.83,39.00 28.17,39.00 28.49,39.00 28.81,39.00 29.12,39.00 29.42,39.00 29.73,39.00 30.02,39.00 30.35,39.00 30.67,39.00 30.98,39.00 31.32,39.00 31.66,39.00 31.99,39.00 32.32,39.00 32.64,39.00 32.95,39.00 33.28,39.00 33.60,39.00 33.92,39.00 34.33,39.00 34.73,39.00 35.11,39.00 35.45,39.00 35.78,39.00 36.10,39.00 36.41,39.00 36.71,39.00 36.99,39.00 37.43,39.00 37.66,38.99 38.01,38.99 38.32,38.99 38.77,39.00 39.01,39.00 39.64,39.00 40.00,39.00 40.00,39.00 40.00,39.00 39.99,39.34 39.99,40.00 39.99,40.24 39.99,40.71 39.99,40.99 39.99,41.37 39.99,41.61 39.99,42.02 39.99,42.36 39.99,42.69 39.99,43.02 39.99,43.34 39.99,43.73 39.99,44.00 39.99,44.61 39.99,45.02 39.99,45.02 39.99,45.02 40.36,45.00 41.01,45.00 41.30,45.00 41.66,45.01 42.01,45.01 42.33,45.01 42.69,45.01 43.01,45.01 43.33,45.01 43.72,45.02 43.99,45.02 44.60,45.01 44.99,45.01 44.99,45.01 44.99,45.01 44.99,45.40 44.99,46.00 44.99,46.25 44.99,46.66 44.99,46.98 44.99,47.29 44.99,47.64 44.99,47.99 44.99,48.31 44.99,48.65 44.99,49.00 44.99,49.39 44.99,49.59 44.99,50.01 44.99,50.35 44.99,50.66 44.99,51.01 44.99,51.33 44.99,51.68 44.99,52.00 44.99,52.33 44.99,52.69 44.99,53.00 44.99,53.31 44.99,53.71 44.99,54.00 44.99,54.42 44.99,54.65 44.99,55.01 44.99,55.34 44.99,55.76 44.99,56.01 44.99,56.62 44.99,56.99 44.99,56.99 44.99,56.99 44.51,56.99 44.02,56.99 43.51,56.99 42.99,56.99 42.99,56.99 42.99,56.99 43.00,57.57 43.00,57.99 43.00,58.29 42.99,58.56 42.99,59.00 42.99,59.30 42.99,59.62 42.99,59.95 42.99,60.27 42.99,60.67 42.99,61.00 42.99,61.33 42.99,61.67 42.99,61.98 42.99,62.40 42.99,62.63 42.99,62.99 42.99,63.33 43.00,63.73 43.00,64.00 43.00,64.61 43.00,65.00 43.00,65.00 43.00,65.00 43.50,65.00 44.01,65.00 44.50,65.00 44.99,65.01 44.99,65.01 44.99,65.01 45.00,65.55 45.00,65.99 45.00,66.29 44.99,66.58 44.99,66.99 44.99,67.32 44.99,67.64 44.99,68.01 44.99,68.43 44.98,68.57 44.98,68.99 44.98,69.34 44.99,69.70 44.99,70.02 44.99,70.34 45.00,70.75 45.00,71.01 45.00,71.60 45.00,71.99 45.00,71.99 45.00,71.99 44.59,71.99 43.99,71.99 43.70,71.99 43.33,72.00 43.00,72.00 42.48,72.00 42.38,72.00 42.00,72.00 41.65,72.00 41.00,72.00 41.00,72.00 41.00,72.00 40.99,72.62 40.99,72.99 40.99,73.33 40.98,73.54 40.98,73.99 40.98,74.36 41.00,74.66 41.00,74.99 41.00,75.61 41.00,76.00 41.00,76.00 41.00,76.00 40.64,75.99 40.00,75.99 39.70,75.99 39.34,76.00 38.99,76.00 38.68,76.00 38.30,76.00 37.99,76.00 37.67,76.00 37.27,76.00 37.00,76.00 36.39,76.00 36.00,76.00 36.00,76.00 36.00,76.00 36.00,76.44 36.00,76.98 36.00,77.42 35.99,77.60 35.99,77.99 35.99,78.39 36.00,79.00 36.00,79.00 36.00,79.00 35.44,78.99 35.00,78.99 34.65,78.99 34.54,78.99 33.97,78.99 33.72,78.99 33.30,79.00 33.02,79.00 32.71,79.00 32.28,79.00 31.94,79.00 31.62,79.00 31.35,79.01 31.01,79.01 30.68,79.01 30.35,79.00 30.00,79.00 29.67,79.00 29.35,79.00 29.00,79.00 28.67,79.00 28.35,79.01 28.01,79.01 27.68,79.01 27.35,79.01 27.02,79.01 26.69,79.01 26.33,79.00 26.00,79.00 25.68,79.00 25.34,79.00 25.01,79.00 24.67,79.00 24.35,79.00 24.01,79.00 23.60,79.00 23.40,79.00 22.99,79.00 22.64,79.00 22.34,78.99 21.99,78.99 21.67,78.99 21.31,78.99 20.98,78.99 20.65,78.99 20.32,79.00 19.99,79.00 19.67,79.00 19.30,79.00 18.98,79.00 18.65,79.00 18.32,78.99 17.99,78.99 17.67,78.99 17.30,79.00 16.98,79.00 16.66,79.00 16.32,79.00 16.00,79.00 15.68,79.00 15.36,79.00 15.05,79.00 14.72,79.00 14.40,79.00 14.09,79.00 13.68,79.00 13.37,79.00 12.98,79.00 12.64,79.00 12.32,79.00 12.01,79.00 11.68,79.00 11.28,79.00 10.98,79.00 10.55,79.00 10.35,79.00 10.00,79.00 9.64,79.00 9.29,79.00 9.01,79.00 8.40,78.99 8.00,79.00 8.00,79.00 8.00,79.00 8.01,78.38 8.01,78.01 8.01,77.67 8.00,77.46 8.00,77.00 8.00,76.63 8.01,76.33 8.01,76.00 8.01,75.40 8.00,75.00 8.00,75.00 8.00,75.00 7.65,75.00 6.99,75.00 6.75,75.00 6.28,74.99 6.00,74.99 5.63,74.99 5.39,74.99 5.00,74.99 4.64,74.99 4.34,74.99 4.00,74.99 3.67,75.00 3.27,75.00 2.99,75.00 2.39,75.00 2.00,75.00 2.00,75.00M 29.91,51.34 C 29.91,51.34 29.98,51.10 29.75,51.79 29.71,51.91 29.64,52.08 29.57,52.31 29.49,52.54 29.41,52.76 29.36,52.91 29.27,53.17 29.18,53.45 29.08,53.74 28.99,54.01 28.90,54.29 28.80,54.59 28.69,54.92 28.57,55.26 28.46,55.62 28.36,55.90 28.27,56.19 28.17,56.49 28.07,56.78 27.97,57.07 27.87,57.37 27.77,57.67 27.67,57.95 27.57,58.26 27.47,58.56 27.37,58.86 27.27,59.16 27.18,59.42 27.10,59.67 27.02,59.92 26.92,60.23 26.81,60.53 26.71,60.83 26.62,61.12 26.52,61.41 26.42,61.70 26.33,61.98 26.24,62.25 26.15,62.53 26.03,62.87 25.92,63.21 25.81,63.54 25.71,63.86 25.60,64.17 25.50,64.47 25.40,64.76 25.31,65.05 25.22,65.33 25.13,65.60 25.04,65.86 24.96,66.11 24.85,66.42 24.81,66.56 24.72,66.83 24.61,67.15 24.55,67.34 24.47,67.60 24.36,67.93 24.28,68.13 24.22,68.32 24.14,68.55 24.00,69.00 24.00,69.00 24.00,69.00 23.37,69.00 23.00,69.00 22.71,69.00 22.37,69.00 22.03,69.00 21.53,69.00 21.39,69.00 21.00,69.00 20.63,69.00 20.00,68.99 20.00,68.99 20.00,68.99 19.97,68.98 19.73,68.29 19.69,68.17 19.61,67.88 19.52,67.59 19.43,67.32 19.35,67.05 19.30,66.90 19.20,66.60 19.15,66.45 19.04,66.10 18.93,65.77 18.81,65.42 18.68,65.05 18.57,64.72 18.46,64.38 18.34,64.02 18.23,63.69 18.12,63.36 18.00,63.01 17.90,62.69 17.79,62.35 17.67,62.02 17.56,61.69 17.45,61.36 17.34,61.02 17.23,60.69 17.12,60.37 17.01,60.04 16.90,59.71 16.79,59.38 16.68,59.05 16.57,58.72 16.46,58.39 16.36,58.07 16.22,57.66 16.09,57.26 15.95,56.87 15.84,56.52 15.72,56.17 15.61,55.84 15.51,55.52 15.40,55.21 15.30,54.91 15.20,54.60 15.10,54.29 15.00,54.01 14.86,53.58 14.72,53.18 14.61,52.83 14.49,52.49 14.39,52.19 14.31,51.94 14.11,51.34 14.00,51.00 14.00,51.00 14.00,51.00 13.74,51.00 13.48,51.00 13.24,51.00 13.00,51.00 13.00,51.00 13.00,51.00 13.00,51.40 13.00,52.09 13.00,52.33 13.00,52.61 13.00,52.91 13.00,53.22 13.00,53.55 13.00,53.90 13.00,54.23 13.00,54.58 13.00,54.95 13.00,55.28 13.00,55.62 13.00,55.97 13.00,56.30 13.00,56.66 13.00,57.01 13.00,57.33 13.00,57.65 13.00,57.98 13.00,58.31 13.00,58.64 13.00,58.98 13.00,59.30 13.00,59.63 13.00,59.96 13.00,60.29 13.00,60.61 13.00,60.93 13.00,61.26 13.00,61.58 13.00,61.90 13.00,62.31 13.00,62.72 13.00,63.12 13.00,63.46 13.00,63.79 13.00,64.12 13.00,64.45 13.00,64.77 13.00,65.08 13.00,65.39 13.00,65.69 13.00,65.97 13.00,66.40 13.00,66.80 13.00,67.16 13.00,67.49 13.00,67.78 13.00,68.03 13.00,68.64 13.00,69.00 13.00,69.00 13.00,69.00 12.51,69.00 12.01,69.00 11.51,69.00 11.00,69.00 11.00,69.00" /> </svg> --- shapes/parse_svg.py --- import numpy as np import xml.etree.ElementTree as ET import matplotlib.pyplot as plt def extract_coords_from_svg(svg_file_path, BASE): assert BASE in ["flame", "modular"] scaling = { "modular": 100, "flame": 250 } # Parse the SVG file tree = ET.parse(svg_file_path) root = tree.getroot() paths = root.findall(".//svg:path", {'svg': 'http://www.w3.org/2000/svg'}) # Store coordinates coordinates = [] for path in paths: d = path.get('d', "") commands = d.split() for cmd in commands: if ',' in cmd: x, y = cmd.split(',') try: # Scale coordinates scale_factor = scaling[BASE] x = round(float(x)/scale_factor, 6) y = round(float(y)/scale_factor, 6) coordinates.append((x, y)) except: pass return coordinates def plot_points(points): # Plotting using matplotlib plt.figure(figsize=(10, 10)) plt.scatter(points[:, 0], points[:, 1]) plt.gca().invert_yaxis() plt.title("Unique SVG Path Coordinates") plt.xlabel("X") plt.ylabel("Y") plt.grid(True) plt.show() if __name__ == "__main__": # BASE = "modular" BASE = "flame" svg_file_path = f'./shapes/{BASE}.svg' coords = extract_coords_from_svg(svg_file_path, BASE) points = np.array(list(set(coords))) plot_points(points) # Save to csv np.savetxt(f"./shapes/{BASE}.csv", points, delimiter=",", fmt='%f') # load csv print(np.loadtxt(f"./shapes/{BASE}.csv", delimiter=",")) --- .gitignore --- .vscode/ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ --- LICENSE --- MIT License Copyright (c) 2023 Vladyslav Moisieienkov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- README.md --- # Mojo Gym Small hands-on exercises to practice the basics of the Mojo programming language. Ideal for developers who are new to Mojo but know basics of Python. Inspired by [Rustlings](https://github.com/rust-lang/rustlings) project that has a similar approach to teach Rust. ## Getting started 1. [Install Mojo](https://docs.modular.com/mojo/manual/get-started/) 2. Clone this repository or better yet, fork it and clone your fork. 3. Install necessary Python packages to run the exercises: ```bash pip3 install -r requirements.txt ``` Feel free to use virtualenv or any other tool to manage your Python packages. 4. Run the exercises: ```bash python mojo_gym.py ``` 5. Follow the instructions and have fun! ## Learning approach This is an optional reading if you are interested in how mojo-gym structures the learning material. Because Mojo is very similar to Python, we omit some of the basic concepts that are shared between the two languages, for example, control flow statements. We focus on the concepts that are unique to Mojo. We start with variables, functions, and value ownership (+ mutability). This is a bit different from what Mojo documentation has. The reason is we try to avoid introducing new concepts and we also want to build new knowledlge on top of the previous exercises. When you are familiar with the previous topics, we move to structs, value lifecycle, metaprogramming and traits. We finish the learning with exercises on Python integration and modules/packages in Mojo. Hopefully, you will find this project useful and fun! --- exercises/functions/README.md --- # Functions in Mojo You can read introduction to functions in [Mojo Language Basics](https://docs.modular.com/mojo/programming-manual.html#let-and-var-declarations). More detailed and recommend guide on functions in Mojo can be found in [Mojo Programming Manual](https://docs.modular.com/mojo/programming-manual.html#fn-definitions). --- exercises/functions/functions1.mojo --- # I AM NOT DONE def func1(): print('func1 here') fn func2(): print('func2 here') def main(): func1() func2() --- exercises/functions/functions2.mojo --- # TASK # Fix an error and make file compile # I AM NOT DONE fn main(): x = 4 var y = 5 let z = 6 print('x + y + z =', x + y + z) --- exercises/functions/functions3.mojo --- # TASK # Fix error(s) and make file compile # I AM NOT DONE # Do not change "fn" to "def" fn add(a, b): return a + b # Do not change anything below this line fn main(): let a: Int = 1 let b: Int = 2 let c: Int = add(a, b) print('c =', c) --- exercises/functions/functions4.mojo --- # TASK # Make assert statement pass # I AM NOT DONE from testing import assert_true # only change definition of the function fn pow(base: Int, exp: Int) -> Int: return base ** exp # do not change below this line fn main() raises: let c = pow(3) if c != 9: raise Error('z should equal 9') --- exercises/functions/functions5.mojo --- # TASK # Make assert statement pass # I AM NOT DONE from testing import assert_true # only change definition of the function fn add(x: Int = 2, y: Int) -> Int: return x + y # do not change below this line fn main() raises: let c = add() if c != 5: raise Error('c should equal 5') --- exercises/intro/README.md --- # Introduction Mojo supports (or will support) a standard Python syntax. This means you can use a syntax that is familiar to you. --- exercises/intro/intro.mojo --- # About this `I AM NOT DONE` thing: # We sometimes encourage you to keep trying things on a given exercise, even # after you already figured it out. If you got everything working and feel # ready for the next exercise, remove the `I AM NOT DONE` comment below. # TASK: # Output the string "Hello, Mojo!" to the console. # I AM NOT DONE def main(): print('Hello {}') --- exercises/structs/README.md --- # Structs The [Mojo language basics guide](https://docs.modular.com/mojo/manual/basics/#structures) provides a good introduction to structs. More detailed information can be found in the [Mojo programming manual](https://docs.modular.com/mojo/programming-manual.html#struct-types). --- exercises/structs/structs1.mojo --- # TASK # Address all the TODOs to make the test pass # I AM NOT DONE struct ColorClassic: # TODO: something goes here def main(): # TODO: create a ColorClassic struct # let color = ... if color.red != 0 or color.green != 255 or color.blue != 0: raise Error('Color must be 0, 255, 0') print('Nicely done!') --- exercises/structs/structs2.mojo --- # TASK # Make tests pass # I AM NOT DONE struct Package: var sender_country: String var recipient_country: String var weight_in_grams: Int fn __init__(inout self, sender_country: String, recipient_country: String, weight_in_grams: Int) raises: self.sender_country = sender_country self.recipient_country = recipient_country self.weight_in_grams = weight_in_grams if weight_in_grams < 10: raise Error('Cannot transport packages less than 10 grams') fn is_international(inout self) -> ???: # someting goes here... pass fn get_fees(inout self, cents_per_gram: Int) -> ???: # something goes here... pass def main(): # test 1 var sender_country: String = 'Spain' var recipient_country: String = 'Austria' try: var package = Package(sender_country, recipient_country, 5) raise Error('Package is too small, cannot send') except Error: pass # test 2 sender_country = 'Spain' recipient_country = 'UK' var package = Package(sender_country, recipient_country, 1200) if not package.is_international(): raise Error('Package from Spain to UK is international') # test 3 sender_country = 'Canada' recipient_country = 'Canada' package = Package(sender_country, recipient_country, 1200) if package.is_international(): raise Error('Package within Canada is not international') # test 4 let cents_per_gram: Int = 3 package = Package(sender_country, recipient_country, 1500) if package.get_fees(cents_per_gram) != 4500 or package.get_fees(cents_per_gram * 2) != 9000: raise Error('Fees are not calculated properly') print('Great job') --- exercises/value_ownership/README.md --- # Mutability and Ownership You can check short introduction on mutability and ownership in Mojo from [Language Basics](https://docs.modular.com/mojo/manual/basics/#argument-mutability-and-ownership) page. Or more detailed explanation in [Programming Manual](https://docs.modular.com/mojo/programming-manual.html#argument-passing-control-and-memory-ownership). --- exercises/value_ownership/mutability1.mojo --- # TASK # Run this file and see what happens # I AM NOT DONE # Both of these functions are equivalent fn add(x: Int, y: Int) -> Int: return x + y fn add_borrowed(borrowed x: Int, borrowed y: Int) -> Int: return x + y fn main(): let x = 1 let y = 2 let a = add(x, y) let b = add_borrowed(x, y) print('a = ', a) print('b = ', a) --- exercises/value_ownership/mutability2.mojo --- # TASK # Compile program and make it pass tests # I AM NOT DONE fn add_mutate(x: Int, y: Int) -> Int: x += 1 y += 1 return x + y # do not change code below this line fn add(x: Int, y: Int) -> Int: return x + y fn main() raises: var x = 1 var y = 2 print('x = ', x) print('y = ', y) let a = add(x, y) print('a = ', a) if a != 3: raise Error('a should equal 3') if x != 1: raise Error('x should not be changed') if y != 2: raise Error('y should not be changed') let b = add_mutate(x, y) print('b = ', b) print('x = ', x) print('y = ', y) if b != 5: raise Error('b should equal 5') if x != 2: raise Error('x should be changed') if y != 3: raise Error('y should be changed') --- exercises/value_ownership/ownership1.mojo --- # TASK # Make file compile with no errors # I AM NOT DONE fn set_fire(text: String) -> String: text += "🔥" return text # Do not modify below this line fn main() raises: var a: String = "mojo" let b = set_fire(a) if a != "mojo": raise Error("a should not be modified") if b != "mojo🔥": raise Error("b should be on fire") --- exercises/value_ownership/ownership2.mojo --- # TASK # Make this file compile # I AM NOT DONE # Do not change this function fn take_value(owned x: Int): x += 2 use_value(x) # Do not change this function fn use_value(x: Int): print('value is', x) fn main(): var counter = 0 counter += 1 print('counter is', counter) # the line below should not be changed var new_counter = counter^ print('new_counter is ', new_counter) counter += 1 new_counter += 1 print('new_counter is', new_counter) --- exercises/value_ownership/ownership3.mojo --- # TASK # Make file compile with no errors # I AM NOT DONE fn take_ptr(owned array: Pointer[Int]): array.store(2, 23) fn main(): # this line just allocates pointer for 3 integers # think about it as array with capacity of 3 integers var array = Pointer[Int].alloc(3) array.store(0, 1) array.store(1, 2) # this function call does not need any changes take_ptr(array^) array.store(1, 2) --- exercises/variables/README.md --- # Variables in Mojo Mojo provides to kinds of variables: mutable marked by `var` and immutable marked by `let`. Read more about variables in [Mojo docs](https://docs.modular.com/mojo/manual/variables.html). --- exercises/variables/variables1.mojo --- # TASK # The program should print the values of x, y, and z. # I AM NOT DONE def main(): x = 5 var y = 6 let z = 7 print('x = ', x) print('y = ', y) print('z = ', z) --- exercises/variables/variables2.mojo --- # TASK # Fix error(s) so the program compiles # I AM NOT DONE def main(): let x: Int var y: Int let c: Int c = x + y if c == 5: print("x is 5") else: print("x is not 5") --- exercises/variables/variables3.mojo --- # TASK # Fix error(s) and make file compile and run. # I AM NOT DONE def main(): let x = 5 print('x =', x) x = 6 # don't change this line print('x =', x) --- exercises/variables/variables4.mojo --- # TASK # Make file compile # I AM NOT DONE def main(): let x: Int = 4 var y: Int = 5 z: Int = 6 z += 1 # don't change this line print('x + y + z = ', x + y + z) --- exercises/variables/variables5.mojo --- # TASK # Make file compile and test pass # I AM NOT DONE def main(): let x: Int = 4 let y: Int = 5 var z: Int = 6.5 # don't change below this line if x + y + z != 15.5: raise Error('x + y + z should be 15') --- mojo_gym.py --- import time import subprocess from pathlib import Path from rich.layout import Layout from rich.live import Live EXERCISES_FOLDER = Path('exercises') LESSONS = [ { 'folder': 'intro', 'files': [ 'intro.mojo', ] }, { 'folder': 'variables', 'files': [ 'variables1.mojo', 'variables2.mojo', 'variables3.mojo', 'variables4.mojo', 'variables5.mojo', ] }, { 'folder': 'functions', 'files': [ 'functions1.mojo', 'functions2.mojo', 'functions3.mojo', 'functions4.mojo', 'functions5.mojo', ] }, { 'folder': 'value_ownership', 'files': [ 'mutability1.mojo', 'mutability2.mojo', 'ownership1.mojo', 'ownership2.mojo', 'ownership3.mojo', ] }, { 'folder': 'structs', 'files': [ 'structs1.mojo', 'structs2.mojo', ] } ] def is_done(filename: str) -> bool: with open(filename, 'r') as f: return '# I AM NOT DONE' not in f.read() def compile_and_run(filename: Path) -> (bool, str): mojo_run_result = subprocess.run(['mojo', 'run', filename], check=False, capture_output=True) if mojo_run_result.returncode == 0: output = mojo_run_result.stdout.decode() else: output = mojo_run_result.stderr.decode() return mojo_run_result.returncode == 0, output def main(): layout = Layout() layout.split_column( Layout(name='upper'), Layout(name='lower') ) layout['lower'].size = None layout['lower'].ratio = 4 layout['lower'].update('Here you will see output of exercises.') layout['upper'].update('Welcome to [red]Mojo Gym[/]!') with Live(layout, refresh_per_second=2, screen=True): try: for lesson in LESSONS: files = lesson['files'] file_index = 0 while file_index < len(files): filepath = EXERCISES_FOLDER / lesson['folder'] / files[file_index] layout['upper'].update(f'Current exercise [red]{filepath}[/]. Proceed to file and follow instructions.') if filepath.exists(): is_ok, output = compile_and_run(filepath) if is_ok: layout['lower'].update(f'[green]Pass[/]. Remove "I AM NOT DONE" to continue to the next exercise. Output:\n\n{output}') if is_done(filepath): file_index += 1 else: layout['lower'].update(f'[red]Failed[/]. Output:\n\n{output}') time.sleep(1) layout['upper'].update('[red]Congratulations![/] You have finished all exercises. Press Ctrl+C to exit.') layout['lower'].update('') while True: pass except KeyboardInterrupt: pass if __name__ == '__main__': main() --- requirements.txt --- rich==13.6.0 --- .gitignore --- **/main **/*.a **/*.o **/*.so --- README.md --- # Mojo FFI Notes 1. [Calling C libraries from Mojo](mojo-call-c/) 2. [Statically linking a Mojo executable against a C library](mojo-exe-link-c-static/) (demo) 3. [Creating a shared library from Mojo, and calling it from C](c-link-mojo-shared/) (demo) In order to run 2 and 3, add `scripts/` to your `PATH` before using the demo `Makefile`s (or invoke `/this/path/scripts/mojoc` directly). The scripts require `python` to be available in `PATH`. (note: the scripts have not yet been updated to support macOS, but the approach should work with minor modifications) --- c-link-mojo-shared/Makefile --- all: libhellomojo.so main run main: main.c libhellomojo.so gcc -L. -lhellomojo main.c -o main -Wl,-rpath=./ libhellomojo.so: hello_shared.mojo mojoc -shared hello_shared.mojo -o libhellomojo.so run: FORCE ./main clean: rm -f main libhellomojo.so FORCE: --- c-link-mojo-shared/README.md --- This directory demonstrates the creation of a shared library from Mojo, and then calling a function in that shared library from a C executable. File overview: - `main.c`: C executable which declares and calls an `extern` function -- the function's symbol must be made available at link time. - `hello_shared.mojo`: Mojo file with an `@export`-ed function called `hello_mojo`. This function prints fiery greetings. The file is compiled via the `mojoc` helper script which causes the creation of the `libhellomojo.so` shared library. - `Makefile`: builds and executes all code. On linux, the following output should be displayed: ``` mojoc -shared hello_shared.mojo -o libhellomojo.so gcc -L. -lhellomojo main.c -o main -Wl,-rpath=./ ./main <Calling mojo from C...> 🔥🔥🔥🔥🔥🔥🔥🔥 hello from mojo shared library! 🔥🔥🔥🔥🔥🔥🔥🔥 <...Returned to C from mojo> ``` --- c-link-mojo-shared/hello_shared.mojo --- @export fn hello_mojo(): print("🔥🔥🔥🔥🔥🔥🔥🔥 hello from mojo shared library! 🔥🔥🔥🔥🔥🔥🔥🔥") def main(): # required by `mojo build` pass --- c-link-mojo-shared/main.c --- #include <stdio.h> extern void hello_mojo(); int main(int argc, char** argv) { (void)argc; (void)argv; printf("<Calling mojo from C...>\n"); hello_mojo(); printf("<...Returned to C from mojo>\n"); } --- mojo-call-c/Makefile --- all: cc -shared -fPIC demo.c -o libdemo.so cc -c demo.c -O -o libdemo.o clean: rm libdemo.so libdemo.o --- mojo-call-c/README.md --- # Calling C functions from Mojo Mojo supports at least two methods to call C functions: 1. (documented) [`external_call`](https://docs.modular.com/mojo/stdlib/sys/intrinsics.html#external_call). `external_call` takes the function name, return type, and up to six (?) argument types as parameters, and then the corresponding argument values as input. However, `external_call` _does not_ currently support specifying the function library name, so by default it can only call functions in libc. More on that later. A simple `external_call` looks like this: ``` let eightball = external_call["rand", Int32]() print(eightball) ``` Which will call the [`rand`](https://en.cppreference.com/w/c/numeric/random/rand) function in the C stdlib, with return type `Int32` (first parameter) and no function arguments. For a more complicated example, see [`call_div.mojo`](call_div.mojo) in this directory, which passes two arguments to the [`div`](https://en.cppreference.com/w/c/numeric/math/div) function, and retrieves the return values via a struct. 2. (undocumented?) Declare a function pointer type, and just ... call it! Mojo appears to use the platform C calling convention for at least simple `fn` alias declarations. Such function pointers may be loaded using `sys.ffi.DLHandle` (undocumented) and then called. See [`call_atof_fptr.mojo`](call_atof_fptr.mojo) for a full example, which demonstrates calling [`atof`](https://en.cppreference.com/w/c/string/byte/atof) to parse a C string and return a double value from the string. (TODO: it is likely possible to make external calls via embedded MLIR as well...) # Functions in non-libc libraries The examples linked above use functions from the C standard library, which is implicitly available in the REPL, or explicitly linked by `mojo build`. But there are many other useful C functions in the world which we might want to call. Here is an overview of the options. ## Call a shared library from the REPL *(note: be sure to run `make` in this directory, before trying the examples below; they depend on the existence of `libdemo.so`)* Using `external_call` in the REPL only requires that the function name is locatable in the process image. `sys.ffi.DLHandle("shared-lib.so")` will cause `shared-lib.so` to be loaded, and presumably uses `dlopen` under the hood. (using `ctypes.CDLL` via Python integration also works) *However*, there is a very large caveat: the call to `DLHandle` *must* happen in a separate REPL/notebook cell, before the cell which contains the `external_call` is executed (for the same reason that `mojo run` fails, detailed below). Run this first: ```mojo from sys import ffi ffi.DLHandle("./libdemo.so") ``` Then this: ```mojo var vec = DynamicVector[Float64]() vec.push_back(1) vec.push_back(2) vec.push_back(30) vec.push_back(51.112) vec.push_back(40) vec.push_back(51.0) print(external_call["array_max", Float64, Pointer[Float64], Int64](vec.data, len(vec))) ``` The program should print `51.112`. ## Call a shared library from `mojo run` (TBD?) A logical next step is to start from the code above and add a `main` block around it, then execute that function with `mojo run`, or compile with `mojo build`. Using `mojo run`, the result will look like this (see [call_shared-bad.mojo](call_shared-bad.mojo)): ``` JIT session error: Symbols not found: [ array_max ] mojo: error: Failed to materialize symbols: { (exec, { main }) } ``` This fails, because the JIT must resolve all symbols during the compilation phase, whereas, currently, `array_max` would only be available after the `DLHandle` function is executed. ## Call a library from a Mojo compiled executable With `mojo build`, on the other hand, the binary fails to link: ``` call_shared-bad.mojo:(.text+0x104): undefined reference to `array_max' collect2: error: ld returned 1 exit status mojo: error: failed to link executable ``` `mojo build` does not yet support linker arguments. However, for fun, this repository includes helper code in `scripts/` which can hook the compilation process and create a Mojo executable statically-linked against an external library. See the following directory for more information: - [Statically linking a Mojo executable against an external library](../mojo-exe-link-c-static/) # Exporting a C-callable function from Mojo Mojo accepts an `@export` annotation on `fn` definitions, which marks the following function for C export (in change log, otherwise undocumented). `scripts/mojoc` can also create a shared library from mojo code. See the following for a full demo: - [Creating a shared library from Mojo, and calling it from C](../c-link-mojo-shared/) --- mojo-call-c/call_atof_fptr.mojo --- from sys import ffi alias c_atof_type = fn(s: Pointer[Int8]) -> Float64 def main(): let handle = ffi.DLHandle("") let c_atof = handle.get_function[c_atof_type]("atof") let float_str = StringRef("1.234") let val = c_atof(float_str.data.as_scalar_pointer()) print("The parsed Float64 value is: ", val) --- mojo-call-c/call_div.mojo --- # Declare the return type struct, a pair of int32_t values @register_passable('trivial') struct div_t: var quot: Int32 var rem: Int32 fn clib_div(numer: Int32, denom: Int32) -> div_t: return external_call["div", div_t, Int32, Int32](numer, denom) def main(): let res = clib_div(17,4) # should print (4, 1) print("quotient, remainder: (", res.quot, ", ", res.rem, ")") --- mojo-call-c/call_shared-bad.mojo --- from sys import ffi def callme(): var vec = DynamicVector[Float64]() vec.push_back(1) vec.push_back(2) vec.push_back(30) vec.push_back(51.112) vec.push_back(40) vec.push_back(51.0) print(external_call["array_max", Float64, Pointer[Float64], Int64](vec.data, len(vec))) def main(): ffi.DLHandle("./libdemo.so") callme() --- mojo-call-c/demo.c --- #include <stdio.h> double array_max(double* input, size_t nelem) { double max = 0; for (size_t i = 0; i < nelem; i++) { if (input[i] > max) { max = input[i]; } } return max; } --- mojo-exe-link-c-static/.gitignore --- call_demo libdemo.a --- mojo-exe-link-c-static/Makefile --- all: call_demo libdemo.a run libdemo.a: demo.c gcc -static -c demo.c -o libdemo.a call_demo: call_demo.mojo libdemo.a mojoc call_demo.mojo -Slibdemo.a -o call_demo run: FORCE call_demo ./call_demo clean: rm -f libdemo.a call_demo FORCE: --- mojo-exe-link-c-static/README.md --- This directory demonstrates the creation of an executable from Mojo, which calls a C function in a statically-linked external library. File overview: - `demo.c`: exports the C function `call_this`, which prints a greeting. - `call_demo.mojo`: Mojo `main` function which calls `call_this` using `external_call`. In order to statically link `call_demo.mojo` against `libdemo`, we use the `mojoc` helper script. - `Makefile`: builds and runs all code. On linux, the following output should be displayed: ``` gcc -static -c demo.c -o libdemo.a mojoc call_demo.mojo -Slibdemo.a -o call_demo ./call_demo <calling statically-linked function from mojo> hello from static library <returned to mojo> ``` --- mojo-exe-link-c-static/call_demo.mojo --- def main(): print("<calling statically-linked function from mojo>") external_call["call_this", NoneType]() print("<returned to mojo>") --- mojo-exe-link-c-static/demo.c --- #include <stdio.h> void call_this() { printf("hello from static library\n"); } --- scripts/ld --- #!/usr/bin/env python """ Simple ld wrapper to do fun things """ import json import subprocess import sys, os, shutil def lprefix(the_list, prefix): for idx,item in enumerate(reversed(the_list)): if item.startswith(prefix): return -1 - idx def main(): fwd_json = os.environ["MOJOC_LD_FWD"] fwd_args = json.loads(fwd_json) #print("fwd_args", fwd_args) argv = sys.argv argv[0] = "/usr/bin/ld" # put back original ld shared = fwd_args["shared"] if shared: argv.insert(1, "-shared") def remove_arg(the_arg): if the_arg in argv: del argv[argv.index(the_arg)] remove_arg("-pie") remove_arg("--gc-sections") # can't use with shared linkage remove_arg("/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o") # force the linker to keep all symbols. this is ugly but simple for now. # TODO: extract @export annotations and make linker script for idx,arg in enumerate(argv): if "/tmp" in arg and arg.endswith(".a"): argv[idx:idx+1] = ["--whole-archive", argv[idx], "--no-whole-archive"] break # insert forwarded -L arguments lib_args = fwd_args["lib_args"] #print("lib_args: ", lib_args) if lib_args is not None: L_index = lprefix(argv, "-L") argv[L_index:L_index] = lib_args link_args = fwd_args["link_args"] #print("link_args: ", link_args) if link_args: l_index = lprefix(argv, "-l") argv[l_index:l_index] = link_args if fwd_args["output_file"] is not None: ofile_idx = argv.index("-o") del argv[ofile_idx:ofile_idx+2] argv[ofile_idx:ofile_idx] = ["-o", fwd_args["output_file"]] # copy the tmp archive if False: for arg in argv: if "/tmp" in arg and arg.endswith(".a"): shutil.copyfile(arg, arg+".1") elif "/tmp" in arg and arg.endswith(".res"): p = arg.split("=")[-1] shutil.copyfile(p, p+".1") #print("ld argv: ", argv) #with open("/tmp/last-ld-args.txt", "w") as f: # f.write(argv) subprocess.run(argv) if __name__ == "__main__": main() --- scripts/mojoc --- #!/usr/bin/env python # -*- mode: py -*- import argparse import base64 import os import json import sys import subprocess from typing import List def make_parser(): parser = argparse.ArgumentParser() parser.add_argument( "-shared", default=False, action='store_true' ) parser.add_argument( "-l", action="append", dest="link_libs" ) parser.add_argument( "-S", action="append", dest="link_static" ) parser.add_argument( "-L", action="append", dest="link_paths" ) parser.add_argument( "-o", dest="output_file", type=str ) parser.add_argument( "input_file", type=str ) return parser def test_parser(): parser = make_parser() a0, _ = parser.parse_known_args(["test.mojo"]) assert a0.shared is False assert a0.input_file == "test.mojo" assert a0.link_libs == None assert a0.link_paths == None a1, _ = parser.parse_known_args("-shared -lCallable -lfoo test.mojo -o test".split()) assert a1.link_libs == ["Callable", "foo"] assert a1.link_paths == None assert a1.input_file == "test.mojo" print(a1.output_file) assert a1.output_file == "test" #test_parser() def run_mojo(args, mojo_args): link_args = [f"-l{arg}" for arg in args.link_libs] if args.link_libs else [] lib_args = [f"-L{arg}" for arg in args.link_paths] if args.link_paths else [] # Use `-S` arguments to pass through individual objects to link if args.link_static: lib_args += args.link_static ld_fwd = { "shared": args.shared, "link_args": link_args, "lib_args": lib_args, "output_file": args.output_file } # Should be safe enough for now, use base64 later if needed ld_fwd_json = json.dumps(ld_fwd) env = os.environ.copy() env["MOJOC_LD_FWD"] = ld_fwd_json # We want mojo to use the `ld` sitting next to this file #env["PATH"] = os.path.join(os.path.dirname(__file__)) + ":" + env["PATH"] mojoc_real_dir = os.path.dirname(os.path.realpath(__file__)) env["PATH"] = mojoc_real_dir + ":" + env["PATH"] #print("MOJOC_LD_FWD", ld_fwd_json) exec_args = ( "mojo", "build", *mojo_args ) exec_kwargs = { "env": env, } #print(exec_args) #print(exec_kwargs) return subprocess.run(exec_args, **exec_kwargs, check=False) def cli(input_args): parser = make_parser() args, mojo_args = parser.parse_known_args(input_args) run_mojo(args, mojo_args) if __name__ == '__main__': cli(sys.argv) --- .gitignore --- *.png --- README.md --- # 🔥grad <br /> <img src="https://github.com/automata/mojograd/assets/49062/ca242b1e-e7d7-485d-8bb7-7e27ff0d69a8" width="512px" /> <br /> `mojograd` is a Mojo implementation of [micrograd](https://github.com/karpathy/micrograd), a reverse-mode autodiff library with a PyTorch-like API. The goal is to be as close as possible to micrograd, keeping a pretty clean syntax to define computational graphs. Like micrograd, it only supports scalar values for now, but we plan to extend it to support Tensors in the near future. Note that `mojograd` is in WIP and relies on static register passable structures, so backward pass copies values and can be really slow (Mojo traits support should improve that, so please stay tuned!). However, even now with zero optimizations, forward pass is already ~40x faster than the original Python implementation (see benchmarks bellow). # Using `mojograd` dynamically builds a computational graph by overloading operators on `Value` type, performing the forward pass. Just write your expression like a normal (non-diff) equation and call `backward()` to perform the backward pass: ```python from mojograd import Value var a = Value(2.0) var b = Value(3.0) var c: Float32 = 2.0 var d = b**c var e = a + c e.backward() a.print() # => <Value data: 2.0 grad: 1.0 op: > b.print() # => <Value data: 3.0 grad: 0.0 op: > d.print() # => <Value data: 9.0 grad: 0.0 op: ** > e.print() # => <Value data: 4.0 grad: 1.0 op: + > ``` For a more complete example (a simple Multi-Layer Perceptron), please check the `tests.mojo` file. You can run it with: ```bash mojo tests.mojo ``` # Benchmarks ## MLP binary classifier When compared to original Python implementation, `mojograd` is up to **~40 times faster in forward pass**. | # parameters | micrograd (Python) (sec) | mojograd (Mojo) (sec) | speed up | |--------------|--------------------------|-----------------------|----------| | 367 | 0.001 | 0.00006 | x20 | | 1185 | 0.004 | 0.0001 | x40 | | 4417 | 0.01 | 0.0005 | x20 | | 17025 | 0.06 | 0.002 | x30 | # Changelog - 2023.11.19 - Benchmarking inference and comparing with micrograd - 2023.11.18 - Optimization pass through the code - 2023.11.14 - Rebuild the whole thing using pointer handling (dangerous) to register-passables - Got the full micrograd implementation working! - MLP example training and inference working! - 2023.09.05 - Starting from scratch based on suggestions from Jack Clayton - Topological sort works but I'm messing something with memory handling, the gradients are not getting updated - 2023.07.04 - Ported Neuron, Layer and MLP - Back to use yakupc55's List (need `register_passable` data struct) - 2023.06.30 - Finally got it working! Only missing pow ops and review it --- legacy/data.mojo --- @register_passable struct Data[Type: AnyType]: # Changeable data (while we don't have let on struct?) # From: https://github.com/yakupc55/mojo-example/blob/main/changeable%20data%20for%20struct.md var __data : Pointer[Type] fn __init__() -> Self: return Self {__data : Pointer[Type].alloc(1)} fn __init__(value : Type) -> Self: let data = Pointer[Type].alloc(1) data.store(0, value) return Self {__data:data} fn __copyinit__(self) -> Self: return Self {__data:self.__data} fn set(self, value : Type): self.__data.store(0, value) fn get(self) -> Type: return self.__data.load(0) # fn __del__(owned self): # self.__data.free() --- legacy/engine.mojo --- from String import String from Vector import DynamicVector from Random import rand, random_float64 from data import Data # Utils fn reverse(vec : DynamicVector[Value]) -> DynamicVector[Value]: var reversed : DynamicVector[Value] = DynamicVector[Value](len(vec)) for i in range(len(vec)-1, -1, -1): reversed.push_back(vec[i]) return reversed @register_passable struct Value: var _id: Float64 var data: Data[Float64] var grad: Data[Float64] var _prev_a: Pointer[NoneType] var _prev_b: Pointer[NoneType] var _op: StringLiteral fn __init__(data: Float64) -> Self: let ptr_child_a = Pointer[NoneType].alloc(1) let ptr_child_b = Pointer[NoneType].alloc(1) let new_data = Data[Float64](data) let new_grad = Data[Float64](0.0) return Self { _id: random_float64(), data: new_data, grad: new_grad, _prev_a: ptr_child_a, _prev_b: ptr_child_b, _op: "" } fn __init__(data: Float64, op: StringLiteral) -> Self: let ptr_child_a = Pointer[NoneType].alloc(1) let ptr_child_b = Pointer[NoneType].alloc(1) return Self { _id: random_float64(), data: Data[Float64](data), grad: Data[Float64](0.0), _prev_a: ptr_child_a, _prev_b: ptr_child_b, _op: op } fn __init__(data: Float64, child_a: Value, child_b: Value, op: StringLiteral) -> Self: let ptr_child_a = Pointer[Value].alloc(1) let ptr_child_b = Pointer[Value].alloc(1) ptr_child_a.store(0, child_a) ptr_child_b.store(0, child_b) return Self { _id: random_float64(), data: Data[Float64](data), grad: Data[Float64](0.0), _prev_a: ptr_child_a.bitcast[NoneType](), _prev_b: ptr_child_b.bitcast[NoneType](), _op: op } fn __copyinit__(other: Self) -> Self: return Self { # TODO Should we copy id or create a new one _id: random_float64()? _id: other._id, data: other.data, grad: other.grad, _prev_a: other._prev_a, _prev_b: other._prev_b, _op: other._op } # add fn __add__(self, other: Self) -> Self: let res: Float64 = self.data.get() + other.data.get() let out: Value = Value(res, self, other, '+') return out fn __add__(self, other: Float64) -> Self: return self + Value(other) fn __radd__(self, other: Self) -> Self: # other + self return self + other fn __radd__(self, other: Float64) -> Self: return self + other fn _backward_add(self): let grad_a = self._prev_a.bitcast[Value]()[0].grad.get() let grad_b = self._prev_b.bitcast[Value]()[0].grad.get() let grad = self.grad.get() self._prev_a.bitcast[Value]()[0].grad.set(grad_a + grad) self._prev_b.bitcast[Value]()[0].grad.set(grad_b + grad) # mul fn __mul__(self, other: Self) -> Self: let res: Float64 = self.data.get() * other.data.get() let out: Value = Value(res, self, other, '*') return out fn __mul__(self, other: Float64) -> Self: return self * Value(other) fn __rmul__(self, other: Self) -> Self: # other * self return self * other fn _backward_mul(self): let grad_a = self._prev_a.bitcast[Value]()[0].grad.get() let grad_b = self._prev_b.bitcast[Value]()[0].grad.get() let data_a = self._prev_a.bitcast[Value]()[0].data.get() let data_b = self._prev_b.bitcast[Value]()[0].data.get() let grad = self.grad.get() self._prev_a.bitcast[Value]()[0].grad.set(grad_a + data_b * grad) self._prev_b.bitcast[Value]()[0].grad.set(grad_b + data_a * grad) # # pow # fn __pow__(self, other: Float64) -> Self: # # TODO Do it for Int as well # let res: Float64 = self.data.get() ** other # let out: Value = Value(res, self, other, '**') # return out # fn __pow__(self, other: Int) -> Self: # # TODO Do it for Int as well # let res: Float64 = self.data.get() ** other # let out: Value = Value(res, self, other, '**') # return out # fn _backward_pow(self): # let prev_a = self._prev_a.bitcast[Value]()[0] # let prev_b = self._prev_b.bitcast[Value]()[0] # let grad_a = self._prev_a.bitcast[Value]()[0].grad.get() # let grad_b = self._prev_b.bitcast[Value]()[0].grad.get() # let data_a = self._prev_a.bitcast[Value]()[0].data.get() # let data_b = self._prev_b.bitcast[Value]()[0].data.get() # let grad = self.grad.get() # self._prev_a.bitcast[Value]()[0].grad.set( # grad_a + ((prev_b * data_a**(prev_b-1)) * grad)) # ReLU fn relu(self) -> Self: if self.data.get() < 0.0: return Value(0.0) # TODO How to pass self and other as None? return Value(self.data.get(), self, self, 'ReLU') fn _backward_relu(self): let grad_a = self._prev_a.bitcast[Value]()[0].grad.get() let grad = self.grad.get() let data = self.data.get() if data > 0: self._prev_a.bitcast[Value]()[0].grad.set(grad_a + grad) fn __neg__(self) -> Self: # -self return self * -1.0 fn __sub__(self, other : Self) -> Self: # self - other return self + (-other) fn __sub__(self, other : Float64) -> Self: return self + (-other) fn __rsub__(self, other : Self) -> Self: # other - self return other + (-self) fn __rsub__(self, other : Float64) -> Self: return other + (-self) # fn __truediv__(self, other : Self) -> Self: # self / other # return self * other**-1 # fn __rtruediv__(self, other : Self) -> Self: # other / self # return other * self**-1 fn __eq__(self, other : Value) -> Bool: # TODO How to compare structs? For now using a random_float64 value :-) if self._id == other._id: return True return False fn build_topo(self, v : Int, inout visited : DynamicVector[Value], inout topo : DynamicVector[Value]): # Avoid powers return fn build_topo(self, v : Float64, inout visited : DynamicVector[Value], inout topo : DynamicVector[Value]): # Avoid powers return fn build_topo(self, v : Value, inout visited : DynamicVector[Value], inout topo : DynamicVector[Value]): var is_in_visited = False let size = len(visited) for i in range(size): if v == visited[i]: is_in_visited = True if not is_in_visited: # TODO: Only push if not already there (set) visited.push_back(v) self.build_topo(self._prev_a.bitcast[Value]()[0], visited, topo) self.build_topo(self._prev_b.bitcast[Value]()[0], visited, topo) topo.push_back(v) fn backward(self): # Topological sort var topo : DynamicVector[Value] = DynamicVector[Value]() var visited : DynamicVector[Value] = DynamicVector[Value]() self.build_topo(self, visited, topo) # Chain rule self.grad.set(1.0) let reversed_topo = reverse(topo) let size : Int = len(reversed_topo) for i in range(size): let v = reversed_topo[i] if v._op == '+': v._backward_add() if v._op == '*': v._backward_mul() # if v._op == '**': # v._backward_pow() # if v._op == 'ReLU': # v._backward_relu() fn show(self, label : StringLiteral): print("<Value", label, "::", "data:", self.data.get(), "grad:", self.grad.get(), "op:", self._op, "id:", self._id, ">") --- legacy/list.mojo --- @register_passable struct List[Type: AnyType]: # From: https://github.com/yakupc55/mojo-example/ var data:Pointer[Pointer[Type]] var data_back:Pointer[Pointer[Type]] var _size:Data[Int] var _cap:Data[Int] fn __init__()->Self: let size = Data[Int](0) let cap = Data[Int](2) let data = Pointer[Pointer[Type]].alloc(1) let data_back = Pointer[Pointer[Type]].alloc(1) data.store(0, Pointer[Type].alloc(2)) data_back.store(0,data.load(0)) return Self{_size:size,_cap:cap,data:data,data_back:data_back} fn copy(self)->Self: let size = Data[Int](self.size()) let cap = Data[Int](self.capacity()) let data = Pointer[Pointer[Type]].alloc(1) let data_back = Pointer[Pointer[Type]].alloc(1) data.store(0, Pointer[Type].alloc(cap.get())) data_back.store(0,data.load(0)) for i in range(size.get()): data.load(0).store(i,self.data.load(0).load(i)) return Self{_size:size,_cap:cap,data:data,data_back:data_back} fn size(self)->Int: return self._size.get() fn capacity(self)->Int: return self._cap.get() fn add(self,_index:Int,value:Type): var index =_index var size = self.size() if index<0: index = size+index var cap = self.capacity() size = size + 1 self._size.set(size) if(size == cap): cap = cap * 2 self.data.store(0, Pointer[Type].alloc(cap)) self._cap.set(cap) for i in range(size-1):#previous size self.data.load(0).store(i,self.data_back.load(0).load(i)) self.__add_Index(index,value) self.data_back.store(0,self.data.load(0)) else: self.__add_Index(index,value) fn __add_Index(self,index:Int,value:Type): for i in range(self.size()-1,index,-1): self.data.load(0).store(i,self.data.load(0).load(i-1)) self.data.load(0).store(index,value) fn __add_Index(self,index:Int,data:Pointer[Type],size:Int): for i in range(self.size()-1,index+size-1,-1): self.data.load(0).store(i,self.data.load(0).load(i-size)) for i in range(size): self.data.load(0).store(i+index,data.load(i)) fn add(self,_index:Int,other:Self): self.add(_index,other.data.load(0).bitcast[Type](),other.size()) fn add(self,_index:Int,data:Pointer[Type],_size:Int): var index =_index var size = self.size() if index<0: index = size+index var newCap = self.capacity() size = size + _size self._size.set(size) while(size>newCap): newCap = newCap * 2 if newCap>self.capacity(): self.data.store(0, Pointer[Type].alloc(newCap)) self._cap.set(newCap) for i in range(size-1):#previous size self.data.load(0).store(i,self.data_back.load(0).load(i)) self.__add_Index(index,data,_size) self.data_back.store(0,self.data.load(0)) else: self.__add_Index(index,data,_size) fn add(self,value:Type): var size = self.size() var cap = self.capacity() size = size + 1 self._size.set(size) if(size == cap): cap = cap * 2 self.data.store(0, Pointer[Type].alloc(cap)) self._cap.set(cap) for i in range(size-1):#previous size self.data.load(0).store(i,self.data_back.load(0).load(i)) self.data.load(0).store(size-1,value) self.data_back.store(0,self.data.load(0)) else: self.data.load(0).store(size-1,value) fn add(self,other:Self): self.add(other.data.load(0),other.size()) fn add(self,data:Pointer[Type],size:Int): for i in range(size): self.add(data[i]) fn addMany(self,size:Int,value:Type): let data= Pointer[Type].alloc(size) for i in range(size): data.store(i, value) self.add(data,size) fn addEmpty(self,addSize:Int): var size = self.size() var newCap = self.capacity() size = size + addSize self._size.set(size) while(size>newCap): newCap = newCap * 2 if newCap>self.capacity(): self.data.store(0, Pointer[Type].alloc(newCap)) self._cap.set(newCap) for i in range(size-1):#previous size self.data.load(0).store(i,self.data_back.load(0).load(i)) self.data_back.store(0,self.data.load(0)) fn addMany(self,index:Int,size:Int,value:Type): let data= Pointer[Type].alloc(size) for i in range(size): data.store(i, value) self.add(index,data,size) fn remove(self): var size = self.size() if(size>0): size = size - 1 self._size.set(size) fn remove(self,_index:Int): let size = self.size() if(size==0): return None var index =_index if index<0: index = self.size()+index for i in range(index,size-1): self.data.load(0).store(i,self.data.load(0).load(i+1)) self.remove() fn remove(self,_index:Int,length:Int): var size = self.size() if(size-length<0): return None size = size - length self._size.set(size) var index =_index if index<0: index = self.size()+index for i in range(index,size): self.data.load(0).store(i,self.data.load(0).load(i+length)) fn __setitem__(self,i:slice,data:Pointer[Type]): for j in range(0,i.end - i.start): self.data.load(0).store(j+i.start,data.load(j)) fn __setitem__(self, i: Int,value:Type): return self.data.load(0).store(i,value) fn __getitem__(self, x: Int) -> Type: var i = x if i<0: i = self.size()+i return self.data.load(0).load(i) fn __getitem__(self, s:slice) -> Pointer[Type]: let total:Int = (s.end - s.start) let newList = Pointer[Type].alloc(total) for j in range(total): newList.store(j,self.data.load(0).load(j+s.start)) return newList # fn printArray(self): # #1d lists # if Type==Int: # PrintService.printArray(self.data.load(0).bitcast[Int](),self.size()) # if Type==Float64: # PrintService.printArray(self.data.load(0).bitcast[Float64](),self.size()) --- legacy/micrograd.py --- import random import numpy as np from sklearn.datasets import make_moons import matplotlib.pyplot as plt import time np.random.seed(1337) random.seed(1337) class Value: """ stores a single scalar value and its gradient """ def __init__(self, data, _children=(), _op=''): self.data = data self.grad = 0 # internal variables used for autograd graph construction self._backward = lambda: None self._prev = set(_children) self._op = _op # the op that produced this node, for graphviz / debugging / etc def __add__(self, other): other = other if isinstance(other, Value) else Value(other) out = Value(self.data + other.data, (self, other), '+') def _backward(): self.grad += out.grad other.grad += out.grad out._backward = _backward return out def __mul__(self, other): other = other if isinstance(other, Value) else Value(other) out = Value(self.data * other.data, (self, other), '*') def _backward(): self.grad += other.data * out.grad other.grad += self.data * out.grad out._backward = _backward return out def __pow__(self, other): assert isinstance(other, (int, float)), "only supporting int/float powers for now" out = Value(self.data**other, (self,), f'**{other}') def _backward(): self.grad += (other * self.data**(other-1)) * out.grad out._backward = _backward return out def relu(self): out = Value(0 if self.data < 0 else self.data, (self,), 'ReLU') def _backward(): update = (out.data > 0) * out.grad self.grad += update out._backward = _backward return out def backward(self): # topological order all of the children in the graph topo = [] visited = set() def build_topo(v): # print("curr", v) if v not in visited: visited.add(v) for child in v._prev: build_topo(child) topo.append(v) build_topo(self) # print(topo) # go one variable at a time and apply the chain rule to get its gradient self.grad = 1 # r_topo = reversed(topo) # print("reversed") # print(list(r_topo)) for v in reversed(topo): v._backward() def __neg__(self): # -self return self * -1 def __radd__(self, other): # other + self return self + other def __sub__(self, other): # self - other return self + (-other) def __rsub__(self, other): # other - self return other + (-self) def __rmul__(self, other): # other * self return self * other def __truediv__(self, other): # self / other return self * other**-1 def __rtruediv__(self, other): # other / self return other * self**-1 def __repr__(self): return f"Value(data={self.data}, grad={self.grad})" class Module: def zero_grad(self): for p in self.parameters(): p.grad = 0 def parameters(self): return [] class Neuron(Module): def __init__(self, nin, nonlin=True): self.w = [Value(random.uniform(-1,1)) for _ in range(nin)] # self.w = [Value(1.0) for _ in range(nin)] self.b = Value(0) self.nonlin = nonlin def __call__(self, x): act = sum((wi*xi for wi,xi in zip(self.w, x)), self.b) return act.relu() if self.nonlin else act # return act def parameters(self): return self.w + [self.b] def __repr__(self): return f"{'ReLU' if self.nonlin else 'Linear'}Neuron({len(self.w)})" class Layer(Module): def __init__(self, nin, nout, **kwargs): self.neurons = [Neuron(nin, **kwargs) for _ in range(nout)] def __call__(self, x): out = [n(x) for n in self.neurons] return out[0] if len(out) == 1 else out def parameters(self): return [p for n in self.neurons for p in n.parameters()] def __repr__(self): return f"Layer of [{', '.join(str(n) for n in self.neurons)}]" class MLP(Module): def __init__(self, nin, nouts): sz = [nin] + nouts self.layers = [Layer(sz[i], sz[i+1], nonlin=i!=len(nouts)-1) for i in range(len(nouts))] def __call__(self, x): for layer in self.layers: x = layer(x) return x def parameters(self): return [p for layer in self.layers for p in layer.parameters()] def __repr__(self): return f"MLP of [{', '.join(str(layer) for layer in self.layers)}]" def plot(X, y, step): plt.title(f"micrograd.py - step {step}") plt.scatter(X[:,0], X[:,1], 10, y) plt.savefig(f"./mout_{step}.png") def plot_decision(X, y, model, step): # visualize decision boundary h = 0.15 x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5 y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5 xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h)) Xmesh = np.c_[xx.ravel(), yy.ravel()] inputs = [list(map(Value, xrow)) for xrow in Xmesh] scores = list(map(model, inputs)) Z = np.array([s.data > 0 for s in scores]) Z = Z.reshape(xx.shape) fig = plt.figure() plt.title(f"step {step}") plt.contourf(xx, yy, Z, cmap=plt.cm.coolwarm) plt.scatter(X[:, 0], X[:, 1], c=y, s=10, cmap=plt.cm.coolwarm) plt.xlim(xx.min(), xx.max()) plt.ylim(yy.min(), yy.max()) plt.savefig(f"./mout_decision_{step}.png") def plot_classifier_step(step, model, X, y, n_samples): outs = [] for i in range(n_samples): x = X[i] outs.append(model(x)) # print([yi>0 for yi in y ]) # plot(X, [oi.data>0 for oi in outs], step) # plot_decision(X, [o.data>0 for o in outs], model, step) def main(): # Test 1 # a = Value(2.0) # b = Value(1.0) # c = Value(4.0) # d = (a + -b + (c + c) / a * b**10 - b**2).relu() # # d = a / b # d.backward() # print(a.data, b.data, c.data, d.data) # print(a.grad, b.grad, c.grad, d.grad) # # Test 2 # n = Neuron(2) # x = [Value(2.0), Value(2.0)] # y = n(x) # y.backward() # print(y) # print(n.parameters()) # #dot = draw_dot(y) # Test 3 n_samples = 10 X, y = make_moons(n_samples=n_samples, noise=0.1) y = y*2 - 1 # make y be -1 or 1 model = MLP(2, [16,16, 1]) # 2-layer neural network # optimization n_epochs = 10 for k in range(n_epochs): # forward inputs = [list(map(Value, xrow)) for xrow in X] # forward the model to get scores scores = list(map(model, inputs)) # svm "max-margin" loss losses = [(1 + -yi*scorei).relu() for yi, scorei in zip(y, scores)] # print("losses", len(losses), losses) data_loss = sum(losses) * (1.0 / len(losses)) # L2 regularization alpha = 1e-4 # reg_loss = alpha * sum((p*p for p in model.parameters())) total_loss = data_loss #+ reg_loss # also get accuracy # accuracy = [(yi > 0) == (scorei.data > 0) for yi, scorei in zip(y, scores)] # acc = sum(accuracy) / len(accuracy) # backward model.zero_grad() total_loss.backward() # update (sgd) learning_rate = 1.0 - 0.9*k/100 for p in model.parameters(): p.data = p.data - learning_rate * p.grad if k % 1 == 0: # print(f"step {k} loss {total_loss.data}, accuracy {acc*100}%") print(f"step {k} loss {total_loss.data}") plot_classifier_step(k, model, X, y, n_samples) if __name__ == "__main__": main() --- legacy/mojograd.🔥 --- from random import random_float64 from math import tanh @value @register_passable("trivial") struct Value: var r: Pointer[Int] var l: Pointer[Int] var data: Pointer[Float64] var grad: Pointer[Float64] var op: StringLiteral var _id: Float64 fn __init__(data: Float64) -> Value: let data_holder = Pointer[Float64].alloc(0) data_holder.store(0, data) let grad_holder = Pointer[Float64].alloc(0) grad_holder.store(0, 0.0) return Value { r: Pointer[Int].get_null(), l: Pointer[Int].get_null(), data: data_holder, grad: grad_holder, op: "", _id: random_float64() } fn __eq__(self, other : Value) -> Bool: # For now using a random_float64 value :-) if self._id == other._id: return True return False # Add fn __add__(self, other: Value) -> Value: return self.new(self.data.load(0) + other.data.load(0), other, "+") fn __radd__(self, other: Value) -> Value: return self + other fn __add__(self, other: Float64) -> Value: return self + Value(other) fn __radd__(self, other: Float64) -> Value: return self + Value(other) @staticmethod fn backward_add(inout node: Value): var l = node.l.bitcast[Value]().load(0) var r = node.r.bitcast[Value]().load(0) l.grad.store(0, l.grad.load(0) + node.grad.load(0)) r.grad.store(0, r.grad.load(0) + node.grad.load(0)) node.l.bitcast[Value]().store(0, l) node.l.bitcast[Value]().store(0, r) Value._backward(l) Value._backward(r) # Mul fn __mul__(self, other: Value) -> Value: return self.new(self.data.load(0) * other.data.load(0), other, "*") fn __rmul__(self, other: Value) -> Value: return self * other fn __mul__(self, other: Float64) -> Value: return self * Value(other) fn __rmul__(self, other: Float64) -> Value: return self * Value(other) @staticmethod fn backward_mul(inout node: Value): var left = node.l.bitcast[Value]().load(0) var right = node.r.bitcast[Value]().load(0) left.grad.store(0, left.grad.load(0) + (right.data.load(0) * node.grad.load(0))) right.grad.store(0, right.grad.load(0) + (left.data.load(0) * node.grad.load(0))) node.l.bitcast[Value]().store(0, left) node.r.bitcast[Value]().store(0, right) Value._backward(left) Value._backward(right) # Neg fn __neg__(self) -> Value: return self * -1 # Sub fn __sub__(self, other: Value) -> Value: return self + (-other) fn __sub__(self, other: Float64) -> Value: return self + (-Value(other)) # Tanh fn tanh(self) -> Value: return self.new(tanh(self.data.load(0)), "tanh") fn backward_tanh(inout node: Value): var left = node.l.bitcast[Value]().load(0) left.grad.store(0, left.grad.load(0) + ((1 - tanh(left.data.load(0))**2) * node.grad.load(0))) node.l.bitcast[Value]().store(0, left) Value._backward(left) # Value alloc fn new(self: Value, data: Float64, op: StringLiteral) -> Value: let l = Pointer[Value].alloc(0) l.store(0, self) let data_holder = Pointer[Float64].alloc(0) data_holder.store(0, data) let grad_holder = Pointer[Float64].alloc(0) grad_holder.store(0, 0.0) return Value(l.bitcast[Int](), Pointer[Int].get_null(), data_holder, grad_holder, op, random_float64()) fn new(self: Value, data: Float64, right: Value, op: StringLiteral) -> Value: let l = Pointer[Value].aligned_alloc(0, 0) l.store(0, self) let r = Pointer[Value].aligned_alloc(0, 0) r.store(0, right) let data_holder = Pointer[Float64].alloc(0) data_holder.store(0, data) let grad_holder = Pointer[Float64].alloc(0) grad_holder.store(0, 0.0) return Value(l.bitcast[Int](), r.bitcast[Int](), data_holder, grad_holder, op, random_float64()) # Autograd fn build_topo(inout self: Value, v : Value, inout visited : DynamicVector[Value], inout topo : DynamicVector[Value]): var is_in_visited = False print("hey") let size = len(visited) for i in range(size): if v == visited[i]: is_in_visited = True if not is_in_visited: visited.push_back(v) let null = Pointer[Int].get_null() # It's pushing back, so visit in reverse, first right then left if v.r != null: self.build_topo(v.r.bitcast[Value]().load(0), visited, topo) if v.l != null: self.build_topo(v.l.bitcast[Value]().load(0), visited, topo) topo.push_back(v) @staticmethod fn _backward(inout node: Value): if node.op == "": return if node.op == "+": Value.backward_add(node) if node.op == "*": Value.backward_mul(node) if node.op == "tanh": Value.backward_tanh(node) fn backward(inout self): # Topological sort var topo : DynamicVector[Value] = DynamicVector[Value]() var visited : DynamicVector[Value] = DynamicVector[Value]() self.build_topo(self, visited, topo) # self.grad.store(0, 1.0) # var reversed = Value.reverse(topo) # for i in range(len(reversed)): # self._backward(reversed[i]) @staticmethod fn reverse(vec : DynamicVector[Value]) -> DynamicVector[Value]: var reversed : DynamicVector[Value] = DynamicVector[Value](len(vec)) for i in range(len(vec)-1, -1, -1): reversed.push_back(vec[i]) return reversed @staticmethod fn show(node: Value, label : StringLiteral): print("<Value", label, "::", "data:", node.data.load(0), "grad:", node.grad.load(0), "op:", node.op, ">") # @staticmethod fn print_backward(node): if node.l.load(0) and node.r.load(0): let left = node.l.bitcast[Value]().load(0) let right = node.r.bitcast[Value]().load(0) print(left.data.load(0), "(", left.grad.load(0), ")", node.op, right.data.load(0), "(", right.grad.load(0), ")", "=", node.data.load(0)) elif node.l: let left = node.l.bitcast[Value]().load(0) print(left.data.load(0), "(", left.grad.load(0), ")", node.op, "=", node.data.load(0)) if node.l != Pointer[Int].get_null(): print(node.l.bitcast[Value]().load(0).data.load(0)) # node.l.bitcast[Value]().load(0).print_backward() # left2.print_backward() # if node.r.load(0): # let right = node.r.bitcast[Value]().load(0) # Value.print_backward(right) fn main(): let a = Value(1.5) let b = Value(2) let c = Value(7) let s1 = a + b var s2 = s1 * c # s1.backward() s2.backward() Value.show(a, "a") Value.show(b, "b") Value.show(c, "c") # Value.show(s1, "s1") # a.show("b") # a.show("c") # a.show("s1") # print(s1.data.load(0)) # print("...", s2.l.bitcast[Value]().load(0).data.load(0)) # s2.print_backward() # print(s1) # a.show("s2") --- legacy/nn.mojo --- from engine import Value from list import List @register_passable struct Neuron: var w: List[Value] var b: Value var nonlin: Bool fn __init__(nin: Int, nonlin: Bool=True) -> Neuron: let w: List[Value] = List[Value]() for i in range(nin): w.add(Value(random_float64())) return Self {w: w.copy(), b: Value(0.0), nonlin: nonlin} fn __call__(self, x: List[Value]) -> Value: var act: Value = Value(0.0) for i in range(x.size()): act = act + self.w[i] * x[i] act = act + self.b if self.nonlin: return act.relu() return act fn zero_grad(self): for pi in range(self.parameters().size()): self.parameters()[pi].grad.set(0.0) fn parameters(self) -> List[Value]: let ret = List[Value]() for i in range(self.w.size()): ret.add(self.w[i]) ret.add(self.b) return ret.copy() @register_passable struct Layer: var neurons: List[Neuron] fn __init__(nin: Int, nout: Int) -> Layer: let neurons: List[Neuron] = List[Neuron]() for i in range(nout): neurons.add(Neuron(nin)) return Self { neurons: neurons.copy() } fn __call__(self, x: List[Value]) -> List[Value]: let out: List[Value] = List[Value]() for i in range(self.neurons.size()): out.add(self.neurons[i](x)) return out.copy() fn parameters(self) -> List[Value]: let ret = List[Value]() for i in range(self.neurons.size()): for j in range(self.neurons[i].parameters().size()): ret.add(self.neurons[i].parameters()[j]) return ret.copy() @register_passable struct MLP: var layers: List[Layer] fn __init__(nin: Int, nouts: List[Int]) -> MLP: let sz: List[Int] = List[Int]() sz.add(nin) for i in range(nouts.size()): sz.add(nouts[i]) # TODO Missing nonlin param let layers: List[Layer] = List[Layer]() for i in range(nouts.size()): layers.add(Layer(sz[i], sz[i+1])) return Self { layers: layers.copy() } fn __call__(self, x: List[Value]) -> List[Value]: var _x: List[Value] = List[Value]() _x = x.copy() for i in range(self.layers.size()): _x = self.layers[i](_x) return _x.copy() fn parameters(self) -> List[Value]: let ret = List[Value]() for i in range(self.layers.size()): for j in range(self.layers[i].parameters().size()): ret.add(self.layers[i].parameters()[j]) return ret.copy() --- legacy/test.mojo --- # Test Value var a: Value = Value(1.) var b: Value = Value(2.) var c: Value = a + b - 2. * 2 c.backward() a.show("a") b.show("b") c.show("c") # Test Neuron var n: Neuron = Neuron(2) var input: List[Value] = List[Value]() input.add(Value(2.0)) input.add(Value(3.0)) var act: Value = n(input) act.show("act") act.backward() act.show("act") # Test MLP var nouts: List[Int] = List[Int]() nouts.add(16) nouts.add(16) nouts.add(1) var model: Model = MLP(2, nouts) var inputs: List[Value] = List[Value]() inputs.add(Value(2.0)) inputs.add(Value(2.5)) var outputs: List[Value] = model(inputs) print(outputs[0].data.get()) --- mojograd/__init__.mojo --- from .engine import Value from .nn import Neuron, Layer, MLP from .utils import make_moons, plot, print_datasets, to_float32 --- mojograd/engine.mojo --- from memory import memset_zero from memory.unsafe import Pointer from random import random_float64 from .utils import to_float32, reverse @register_passable("trivial") struct Value: var data: Pointer[Float32] var grad: Pointer[Float32] var l: Pointer[Int] var r: Pointer[Int] var _op: StringRef fn __init__(data: Float32) -> Self: let ptr_data: Pointer[Float32] = Pointer[Float32].alloc(1) ptr_data.store(data) let ptr_grad: Pointer[Float32] = Pointer[Float32].alloc(1) ptr_grad.store(0.0) return Self { data: ptr_data, grad: ptr_grad, l: Pointer[Int].get_null(), r: Pointer[Int].get_null(), _op: "" } # Forward pass @always_inline fn __add__(self, inout other: Pointer[Value]) -> Value: var new_value: Value = Value(0) new_value.data.store(self.data.load() + other.load().data.load()) let ptr_l: Pointer[Value] = Pointer[Value].alloc(1) ptr_l.store(self) new_value.l = ptr_l.bitcast[Int]() new_value.r = other.bitcast[Int]() new_value._op = "+" return new_value @always_inline fn __add__(self, inout other: Float32) -> Value: let new_value: Value = Value(other) var ptr_v: Pointer[Value] = Pointer[Value].alloc(1) ptr_v.store(new_value) return self.__add__(ptr_v) @always_inline fn __add__(self, inout other: Value) -> Value: var ptr_v: Pointer[Value] = Pointer[Value].alloc(1) ptr_v.store(other) return self + ptr_v @always_inline fn __mul__(self, inout other: Pointer[Value]) -> Value: var new_value: Value = Value(0) new_value.data.store(self.data.load() * other.load().data.load()) let ptr_l: Pointer[Value] = Pointer[Value].alloc(1) ptr_l.store(self) new_value.l = ptr_l.bitcast[Int]() new_value.r = other.bitcast[Int]() new_value._op = "*" return new_value @always_inline fn __mul__(self, inout other: Float32) -> Value: let new_value: Value = Value(other) var ptr_v: Pointer[Value] = Pointer[Value].alloc(1) ptr_v.store(new_value) return self.__mul__(ptr_v) @always_inline fn __mul__(self, inout other: Value) -> Value: var ptr_v: Pointer[Value] = Pointer[Value].alloc(1) ptr_v.store(other) return self * ptr_v @always_inline fn __pow__(self, inout other: Pointer[Value]) -> Value: var new_value: Value = Value(0) # Using other only as a holder for data, it doens't backprop (we don't backward(r) bellow) # and we leave new_value.r as null pointer here new_value.data.store(self.data.load() ** other.load().data.load()) let ptr_l: Pointer[Value] = Pointer[Value].alloc(1) ptr_l.store(self) new_value.l = ptr_l.bitcast[Int]() new_value.r = other.bitcast[Int]() # Only has one child new_value._op = "**" return new_value @always_inline fn __pow__(self, inout other: Value) -> Value: var ptr_v: Pointer[Value] = Pointer[Value].alloc(1) ptr_v.store(other) return self ** ptr_v @always_inline fn __pow__(self, inout other: Float32) -> Value: let new_value: Value = Value(other) var ptr_v: Pointer[Value] = Pointer[Value].alloc(1) ptr_v.store(new_value) return self.__pow__(ptr_v) @always_inline fn relu(self) -> Value: var new_value: Value = Value(0) var data: Float32 = 0 if self.data.load() >= 0: data = self.data.load() new_value.data.store(data) let ptr_l: Pointer[Value] = Pointer[Value].alloc(1) ptr_l.store(self) new_value.l = ptr_l.bitcast[Int]() # Only has one child new_value._op = "ReLU" return new_value @always_inline fn __neg__(self) -> Value: var data: Float32 = -1 return self * data @always_inline fn __radd__(self, inout other: Value) -> Value: return self + other @always_inline fn __radd__(self, inout other: Float32) -> Value: return self + other @always_inline fn __sub__(self, inout other: Pointer[Value]) -> Value: let value: Value = other.load() var data: Float32 = -1 var mul: Value = value * data var ptr_mul: Pointer[Value] = Pointer[Value].alloc(1) ptr_mul.store(mul) return self + ptr_mul @always_inline fn __sub__(self, inout other: Value) -> Value: var ptr_v: Pointer[Value] = Pointer[Value].alloc(1) ptr_v.store(other) return self - ptr_v @always_inline fn __sub__(self, inout other: Float32) -> Value: let new_value: Value = Value(other) var ptr_v: Pointer[Value] = Pointer[Value].alloc(1) ptr_v.store(new_value) return self.__sub__(ptr_v) @always_inline fn __rsub__(self, inout other: Pointer[Value]) -> Value: return self - other fn __rsub__(self, inout other: Float32) -> Value: return self - other @always_inline fn __rmul__(self, inout other: Pointer[Value]) -> Value: return self * other @always_inline fn __rmul__(self, inout other: Float32) -> Value: return self * other @always_inline fn __truediv__(self, inout other: Value) -> Value: var powie: Float32 = -1.0 var pow: Value = other ** powie return self * pow @always_inline fn __rtruediv__(self, inout other: Value) -> Value: var powie: Float32 = -1.0 var pow: Value = self ** powie return other * pow @always_inline fn __truediv__(self, inout other: Float32) -> Value: return self / other @always_inline fn __rtruediv__(self, inout other: Float32) -> Value: return other / self # Backward pass @staticmethod @always_inline fn _backward(inout v: Pointer[Value]): let op: String = v.load()._op if op == "": return if op == "+": Value.backward_add(v) elif op == "*": Value.backward_mul(v) elif op == "**": Value.backward_pow(v) elif op == "ReLU": Value.backward_relu(v) else: print("OP not supported", op) @staticmethod @always_inline fn backward_add(inout v: Pointer[Value]): let vv: Value = v.load() if vv.l == Pointer[Int].get_null(): return let l: Value = vv.l.bitcast[Value]().load() l.grad.store( l.grad.load() + vv.grad.load() ) if vv.r == Pointer[Int].get_null(): return let r: Value = vv.r.bitcast[Value]().load() r.grad.store( r.grad.load() + vv.grad.load() ) @staticmethod @always_inline fn backward_mul(inout v: Pointer[Value]): let vv: Value = v.load() if vv.l == Pointer[Int].get_null(): return let l: Value = vv.l.bitcast[Value]().load() if vv.r == Pointer[Int].get_null(): return let r = vv.r.bitcast[Value]().load() l.grad.store( l.grad.load() + ( r.data.load() * vv.grad.load() ) ) r.grad.store( r.grad.load() + ( l.data.load() * vv.grad.load() ) ) @staticmethod @always_inline fn backward_pow(inout v: Pointer[Value]): let vv: Value = v.load() if vv.l == Pointer[Int].get_null(): return let l: Value = vv.l.bitcast[Value]().load() if v.load().r == Pointer[Int].get_null(): return let r: Value = vv.r.bitcast[Value]().load() let other = r.data.load() l.grad.store(l.grad.load() + (other * l.data.load()**(other-1) * vv.grad.load())) @staticmethod @always_inline fn backward_relu(inout v: Pointer[Value]): let vv: Value = v.load() if vv.l == Pointer[Int].get_null(): return let l: Value = vv.l.bitcast[Value]().load() # TODO Can be Int? var data: Float32 = 0 if vv.data.load() > 0: data = 1 let update: Float32 = data * v.load().grad.load() l.grad.store( l.grad.load() + update ) @staticmethod fn build_topo(inout ptr_v: Pointer[Value], inout visited: DynamicVector[Pointer[Value]], inout topo: DynamicVector[Pointer[Value]]): if ptr_v == Pointer[Value].get_null(): return var is_visited: Bool = False let size: Int = len(visited) for i in range(size): if ptr_v == visited[i]: is_visited = True if not is_visited: visited.push_back(ptr_v) # Make sure we don't try to access null pointers (e.g. on pow # where we don't have the right child) if ptr_v.load().l != Pointer[Int].get_null(): var ptr_l: Pointer[Value] = ptr_v.load().l.bitcast[Value]() if ptr_l != Pointer[Value].get_null(): Value.build_topo(ptr_l, visited, topo) if ptr_v.load().r != Pointer[Int].get_null(): var ptr_r: Pointer[Value] = ptr_v.load().r.bitcast[Value]() if ptr_r != Pointer[Value].get_null(): Value.build_topo(ptr_r, visited, topo) topo.push_back(ptr_v) @always_inline fn backward(inout self): var visited: DynamicVector[Pointer[Value]] = DynamicVector[Pointer[Value]]() var topo: DynamicVector[Pointer[Value]] = DynamicVector[Pointer[Value]]() var ptr_self: Pointer[Value] = Pointer[Value].alloc(1) ptr_self.store(self) Value.build_topo(ptr_self, visited, topo) self.grad.store(1.0) var reversed: DynamicVector[Pointer[Value]] = reverse(topo) for i in range(len(reversed)): Value._backward(reversed[i]) visited.clear() topo.clear() reversed.clear() ptr_self.free() @always_inline fn print(inout self): print("<Value", "data:", self.data.load(), "grad:", self.grad.load(), "op:", self._op, ">") @always_inline fn print(inout self, label: StringRef): print("<Value", "label:", label, "data:", self.data.load(), "grad:", self.grad.load(), "op:", self._op, ">") --- mojograd/nn.mojo --- from memory.unsafe import Pointer from random import random_float64 from .engine import Value from .utils import to_float32 @register_passable struct Neuron: var w: Pointer[Pointer[Value]] var b: Pointer[Value] var nin: Int var nonlin: Bool fn __init__(nin: Int, nonlin: Bool = True) -> Self: let ptr_w = Pointer[Pointer[Value]].alloc(nin) for i in range(nin): let r = to_float32(random_float64(-1, 1)) let v = Value(r) let ptr_v = Pointer[Value].alloc(1) ptr_v.store(v) ptr_w.store(i, ptr_v) let ptr_b = Pointer[Value].alloc(1) ptr_b.store(Value(0.0)) return Self { w: ptr_w, b: ptr_b, nin: nin, nonlin: nonlin } @always_inline fn forward(inout self, inout x: Pointer[Pointer[Value]]) -> Pointer[Value]: var tot = Value(0.0) for i in range(self.nin): let w: Value = self.w.load(i).load() var x: Pointer[Value] = x.load(i) let s: Value = w * x # var ptr_s = Pointer[Value].alloc(1) # ptr_s.store(s) tot = tot + s let act = tot + self.b let ptr_act = Pointer[Value].alloc(1) if self.nonlin: ptr_act.store(act.relu()) return ptr_act ptr_act.store(act) return ptr_act # fn parameters(self) -> Pointer[Pointer[Value]]: # var params = Pointer[Pointer[Value]].alloc(self.nin + 1) # for i in range(self.nin): # params.store(i, self.w.load(i)) # params.store(self.nin, self.b) # return params @always_inline fn parameters(self) -> DynamicVector[Pointer[Value]]: var params = DynamicVector[Pointer[Value]]() for i in range(self.nin): params.push_back(self.w.load(i)) params.push_back(self.b) return params @register_passable struct Layer: var neurons: Pointer[Pointer[Neuron]] var nin: Int var nout: Int fn __init__(nin: Int, nout: Int, nonlin: Bool = True) -> Self: let neurons = Pointer[Pointer[Neuron]]().alloc(nout) for i in range(nout): let neuron = Neuron(nin, nonlin=nonlin) let ptr_neuron = Pointer[Neuron].alloc(1) ptr_neuron.store(neuron) neurons.store(i, ptr_neuron) return Self { neurons: neurons, nin: nin, nout: nout } @always_inline fn forward(inout self, inout x: Pointer[Pointer[Value]]) -> Pointer[Pointer[Value]]: let out = Pointer[Pointer[Value]].alloc(self.nout) for i in range(self.nout): let ptr_neuron: Pointer[Neuron] = self.neurons.load(i) var neuron = ptr_neuron.load() let ptr_neuron_out = neuron.forward(x) out.store(i, ptr_neuron_out) return out # fn parameters(self) -> Pointer[Pointer[Value]]: # # For all neurons, get all their parameters # var params = Pointer[Pointer[Value]].alloc(self.nout * self.nin) # for i in range(self.nout): # var params_neuron = self.neurons.load(i).load().parameters() # for j in range(self.nin): # params.store(i*self.nin + j, params_neuron.load(j)) # return params @always_inline fn parameters(self) -> DynamicVector[Pointer[Value]]: var params = DynamicVector[Pointer[Value]]() for i in range(self.nout): let params_neuron = self.neurons.load(i).load().parameters() for j in range(len(params_neuron)): params.push_back(params_neuron[j]) return params @register_passable struct MLP: var layers: Pointer[Pointer[Layer]] var nlayers: Int fn __init__(nin: Int, nouts: DynamicVector[Int]) -> Self: let nnodes = len(nouts) + 1 let nlayers = nnodes - 1 let layers = Pointer[Pointer[Layer]]().alloc(nlayers) let layer = Layer(nin, nouts[0], nonlin=True) let ptr_layer = Pointer[Layer].alloc(1) ptr_layer.store(layer) layers.store(0, ptr_layer) for i in range(nlayers-1): # Last layer is linear, others are nonlinear let nonlin = i != nlayers-2 let layer = Layer(nouts[i], nouts[i+1], nonlin=nonlin) let ptr_layer = Pointer[Layer].alloc(1) ptr_layer.store(layer) layers.store(i+1, ptr_layer) return Self { layers: layers, nlayers: nlayers } @always_inline fn forward(inout self, inout x: Pointer[Pointer[Value]]) -> Pointer[Pointer[Value]]: # var out: Pointer[Pointer[Value]] = x for i in range(self.nlayers): var layer: Layer = self.layers.load(i).load() # Not sure if this works x = layer.forward(x) return x # fn parameters(self) -> Pointer[Pointer[Value]]: # # For all layers, get all their parameters # var params = DynamicVector[Pointer[Value]]() # for i in range(self.nlayers): # var layer = self.layers.load(i).load() # var layer_params = layer.parameters() # for j in range(layer.nin * layer.nout): # params.push_back(layer_params.load(j)) # # Hacky, return DynamicVector instead # var ptr_params = Pointer[Pointer[Value]].alloc(len(params)) # for i in range(len(params)): # ptr_params.store(i, params[i]) # return ptr_params @always_inline fn parameters(self) -> DynamicVector[Pointer[Value]]: # For all layers, get all their parameters var params = DynamicVector[Pointer[Value]]() for i in range(self.nlayers): let layer = self.layers.load(i).load() let layer_params = layer.parameters() for j in range(len(layer_params)): params.push_back(layer_params[j]) return params @always_inline fn zero_grad(inout self): let params = self.parameters() for i in range(len(params)): params[i].load().grad.store(0, 0.0) --- mojograd/utils.mojo --- from memory.unsafe import Pointer from random import random_float64 from python import Python from .engine import Value @always_inline fn reverse(inout vec : DynamicVector[Pointer[Value]]) -> DynamicVector[Pointer[Value]]: var reversed : DynamicVector[Pointer[Value]] = DynamicVector[Pointer[Value]](len(vec)) for i in range(len(vec)-1, -1, -1): reversed.push_back(vec[i]) return reversed @always_inline fn to_float32(v: Float64) -> Float32: return v.cast[DType.float32]() @always_inline fn make_moons(n_samples: Int, noise: Float64) raises -> (Pointer[Pointer[Pointer[Value]]], Pointer[Pointer[Value]]): let sklearn = Python.import_module("sklearn.datasets") let numpy = Python.import_module("numpy") let out = sklearn.make_moons(n_samples) let py_X = out[0] let py_y = out[1] let X = Pointer[Pointer[Pointer[Value]]].alloc(n_samples) for i in range(n_samples): let row = Pointer[Pointer[Value]].alloc(2) for j in range(2): let v_f64: Float64 = py_X[i][j].to_float64() let v_f32: Float32 = to_float32(v_f64) # Add some noise let noise_v: Float32 = to_float32(random_float64(-noise, noise)) let value = Value(v_f32 + noise_v) let ptr_value = Pointer[Value].alloc(1) ptr_value.store(value) row.store(j, ptr_value) X.store(i, row) let y = Pointer[Pointer[Value]].alloc(n_samples) for i in range(n_samples): let v_f64: Float64 = py_y[i].to_float64() let v_f32: Float32 = to_float32(v_f64) # Make y be -1 or 1 let value = Value(v_f32*2 - 1) let ptr_value = Pointer[Value].alloc(1) ptr_value.store(value) y.store(i, ptr_value) return X, y @always_inline fn print_datasets(X: Pointer[Pointer[Pointer[Value]]], y: Pointer[Pointer[Value]], n_samples: Int): print("X:") for i in range(n_samples): let row = X.load(i) print(i, row.load(0).load().data.load(), row.load(1).load().data.load()) print("y:") for i in range(n_samples): print(i, y.load(i).load().data.load()) @always_inline fn plot(X: Pointer[Pointer[Pointer[Value]]], y: Pointer[Pointer[Value]], n_samples: Int, filename: String, title: String) raises: let np = Python.import_module("numpy") let plt = Python.import_module("matplotlib.pyplot") let x0 = np.zeros(n_samples, np.float32) let x1 = np.zeros(n_samples, np.float32) let yy = np.zeros(n_samples, np.float32) for i in range(n_samples): _ = x0.itemset(i, X.load(i).load(0).load().data.load()) _ = x1.itemset(i, X.load(i).load(1).load().data.load()) _ = yy.itemset(i, y.load(i).load().data.load() + 100) _ = plt.title(title) _ = plt.scatter(x0, x1, 10, yy) _ = plt.savefig(filename) # TODO Port from Python to generate boundaries # h = 0.25 # x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1 # y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1 # xx, yy = np.meshgrid(np.arange(x_min, x_max, h), # np.arange(y_min, y_max, h)) # Xmesh = np.c_[xx.ravel(), yy.ravel()] # inputs = [list(map(Value, xrow)) for xrow in Xmesh] # scores = list(map(model, inputs)) # Z = np.array([s.data > 0 for s in scores]) # Z = Z.reshape(xx.shape) # fig = plt.figure() # plt.contourf(xx, yy, Z, cmap=plt.cm.Spectral, alpha=0.8) # plt.scatter(X[:, 0], X[:, 1], c=y, s=40, cmap=plt.cm.Spectral) # plt.xlim(xx.min(), xx.max()) # plt.ylim(yy.min(), yy.max()) --- tests.mojo --- from memory.unsafe import Pointer from python import Python from mojograd import Value, Neuron, Layer, MLP, make_moons, plot # Utils fn plot_classifier_step(step: Int, inout model: MLP, inout X: Pointer[Pointer[Pointer[Value]]], n_samples: Int) raises: let outs = Pointer[Pointer[Value]].alloc(n_samples) for i in range(n_samples): var x = X.load(i) let packed = model.forward(x) let zero_or_one = 0 if packed.load(0).load().data.load() > 0 else 1 let v = Value(zero_or_one) let ptr_v = Pointer[Value].alloc(1) ptr_v.store(v) # outs.store(i, packed.load(0)) outs.store(i, ptr_v) # Assets fn asset_input(n_x: Int = 2) -> Pointer[Pointer[Value]]: let x = Pointer[Pointer[Value]].alloc(n_x) for i in range(n_x): let xi = Value(2.0) let ptr_xi = Pointer[Value].alloc(1) ptr_xi.store(xi) x.store(i, ptr_xi) return x # Tests fn test_simple_eq(): var a = Value(2.0) var b = Value(3.0) var c: Float32 = 2.0 var d = b**c var e = a + c e.backward() a.print() b.print() d.print() e.print() fn test_autograd(): var a = Value(2.0) let b = Value(1.0) var c = Value(4.0) let x = a + -b var x2 = c + c let x3 = x + x2 var x4 = x3.relu() # var d = (a + -b + (c + c) / a * b**10 - b**2).relu() print(a.data.load(), b.data.load(), c.data.load(), x4.data.load()) print(a.grad.load(), b.grad.load(), c.grad.load(), x4.grad.load()) x4.backward() print(a.data.load(), b.data.load(), c.data.load(), x4.data.load()) print(a.grad.load(), b.grad.load(), c.grad.load(), x4.grad.load()) # fn test_original_eq(): # let a = Value(-4.0) # let b= Value(2.0) # var c = a + b # var d = a * b + b**3 # c = c + c + 1.0 # c = c + 1.0 + c + (-a) # d = d + d * 2.0 + (b + a).relu() # d = d + 3.0 * d + (b - a).relu() # var e = c - d # print(e.data.load()) # e.backward() # print(a.grad.load()) # print(b.grad.load()) fn test_neuron(): var x = asset_input(2) var neuron = Neuron(2) let ptr_s = neuron.forward(x) print("s", ptr_s.load().data.load(), ptr_s.load().grad.load()) var s = ptr_s.load() s.backward() print("s", ptr_s.load().data.load(), ptr_s.load().grad.load()) for i in range(neuron.nin): let v = neuron.w.load(i).load() print("w", i, v.data.load(), v.grad.load()) fn test_layer(): var x = asset_input(2) var l = Layer(2, 1) let res = l.forward(x) for i in range(l.nout): var v = res.load(i).load() print("v", i, v.data.load(), v.grad.load()) v.backward() print("v", i, v.data.load(), v.grad.load()) fn test_mlp() raises: var x = asset_input() var nouts = DynamicVector[Int]() nouts.push_back(16) nouts.push_back(16) nouts.push_back(1) var m = MLP(2, nouts) let res = m.forward(x) var res_v = res.load(0).load() print("v", res_v.data.load(), res_v.grad.load()) res_v.backward() print("v", res_v.data.load(), res_v.grad.load()) # m.layers.load(0).load().neurons.load(0).load().parameters.load() fn test_optmization() raises: ## Make datasets let time = Python.import_module("time") let n_samples = 30 let n_dim = 2 let out = make_moons(n_samples, 0.1) let X = out.get[0, Pointer[Pointer[Pointer[Value]]]]() let y = out.get[1, Pointer[Pointer[Value]]]() # print_datasets(X, y, n_samples) # plot(X, y, n_samples) ## Create MLP model var nouts = DynamicVector[Int]() nouts.push_back(16) nouts.push_back(16) nouts.push_back(1) var model = MLP(2, nouts) let num_epochs = 100 let scores = Pointer[Pointer[Value]].alloc(n_samples) let losses = Pointer[Pointer[Value]].alloc(n_samples) for i in range(n_samples): let ptr_loss = Pointer[Value].alloc(1) losses.store(i, ptr_loss) for k in range(num_epochs): let scores = Pointer[Pointer[Value]].alloc(n_samples) # Forward for i in range(n_samples): var x = X.load(i) # For this example, it results only a "list" of one element, # so let's unpack it to the value let packed = model.forward(x) scores.store(i, packed.load(0)) # SVM max-margin loss for i in range(n_samples): var scorei = scores.load(i) let yi = y.load(i).load() let prod = -yi * scorei # load? var one: Float32 = 1.0 let loss = (one + prod).relu() let ptr_loss = losses.load(i) ptr_loss.store(loss) var sum_losses = Value(0.0) for i in range(n_samples): sum_losses = sum_losses + losses.load(i).load() var div: Float32 = 1.0 / n_samples var data_loss = sum_losses * div # Backward model.zero_grad() data_loss.backward() # SGD Update let params = model.parameters() let learning_rate = 1.0 - 0.9*k/100 for i in range(len(params)): let param = params[i].load() let data = param.data data.store( data.load() - learning_rate * param.grad.load() ) print("step", k, "loss", data_loss.data.load()) # let outs = Pointer[Pointer[Value]].alloc(n_samples) # for i in range(n_samples): # var x = X.load(i) # let packed = model.forward(x) # let zero_or_one = 0 if packed.load(0).load().data.load() > 0 else 1 # let v = Value(zero_or_one) # let ptr_v = Pointer[Value].alloc(1) # ptr_v.store(v) # outs.store(i, ptr_v) # plot_classifier_step(k, model, X, n_samples) fn main() raises: # TODO Assert expected outputs, for now only useful for dev # test_simple_eq() # test_autograd() # test_original_eq() # test_neuron() # test_layer() # test_mlp() test_optmization() URL: https://docs.modular.com/mojo/manual/ - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Introduction # Mojo Manual Welcome to the Mojo Manual, a complete guide to the Mojo🔥 programming language! Mojo is designed to solve a variety of AI development challenges that no other language can, because Mojo is the first programming language built from the ground-up with MLIR (a compiler infrastructure that's ideal for heterogeneous hardware, from CPUs and GPUs, to various AI ASICs). We also designed Mojo as a superset of Python because we love Python and its community, but we couldn't realistically enhance Python to do all the things we wanted. For a longer discussion on this topic, read Why Mojo. Beware that Mojo is still a very young language, so there's a lot that hasn't been built yet. Likewise, there's a lot of documentation that hasn't been written yet. But we're excited to share Mojo with you and get your feedback. ## Contents​ - Get started Why Mojo Get started with Mojo - Why Mojo - Get started with Mojo - Language basics Introduction to Mojo Functions Variables Types Control flow Structs Modules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownership Intro to value ownership Value semantics Ownership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycle Intro to value lifecycle Life of a value Death of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parameters Traits Parameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - Pointers Unsafe pointers - Unsafe pointers - Python Python integration Python types - Python integration - Python types - Tools Debugging Testing - Debugging - Testing - Project information Roadmap and sharp edges Changelog FAQ Community - Roadmap and sharp edges - Changelog - FAQ - Community Get started - Why Mojo - Get started with Mojo Language basics - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages Value ownership - Intro to value ownership - Value semantics - Ownership and borrowing Value lifecycle - Intro to value lifecycle - Life of a value - Death of a value Traits and parameters - Traits - Parameterization: compile-time metaprogramming Pointers - Unsafe pointers Python - Python integration - Python types Tools - Debugging - Testing Project information - Roadmap and sharp edges - Changelog - FAQ - Community - Contents - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/#__docusaurus_skipToContent_fallback - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Introduction # Mojo Manual Welcome to the Mojo Manual, a complete guide to the Mojo🔥 programming language! Mojo is designed to solve a variety of AI development challenges that no other language can, because Mojo is the first programming language built from the ground-up with MLIR (a compiler infrastructure that's ideal for heterogeneous hardware, from CPUs and GPUs, to various AI ASICs). We also designed Mojo as a superset of Python because we love Python and its community, but we couldn't realistically enhance Python to do all the things we wanted. For a longer discussion on this topic, read Why Mojo. Beware that Mojo is still a very young language, so there's a lot that hasn't been built yet. Likewise, there's a lot of documentation that hasn't been written yet. But we're excited to share Mojo with you and get your feedback. ## Contents​ - Get started Why Mojo Get started with Mojo - Why Mojo - Get started with Mojo - Language basics Introduction to Mojo Functions Variables Types Control flow Structs Modules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownership Intro to value ownership Value semantics Ownership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycle Intro to value lifecycle Life of a value Death of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parameters Traits Parameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - Pointers Unsafe pointers - Unsafe pointers - Python Python integration Python types - Python integration - Python types - Tools Debugging Testing - Debugging - Testing - Project information Roadmap and sharp edges Changelog FAQ Community - Roadmap and sharp edges - Changelog - FAQ - Community Get started - Why Mojo - Get started with Mojo Language basics - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages Value ownership - Intro to value ownership - Value semantics - Ownership and borrowing Value lifecycle - Intro to value lifecycle - Life of a value - Death of a value Traits and parameters - Traits - Parameterization: compile-time metaprogramming Pointers - Unsafe pointers Python - Python integration - Python types Tools - Debugging - Testing Project information - Roadmap and sharp edges - Changelog - FAQ - Community - Contents - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/variables - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Variables # Variables A variable is a name that holds a value or object. All variables in Mojo are mutable—their value can be changed. (If you want to define a constant value that can't change at runtime, see the alias keyword.) alias Mojo has two kinds of variables: - Declared variables are created with the var keyword, and may include type annotations. var a = 5var b: Float64 = 3.14 - Undeclared variables are created with an assignment statement: a = 5b = 3.14 Declared variables are created with the var keyword, and may include type annotations. var ```mojo var a = 5var b: Float64 = 3.14 ``` Undeclared variables are created with an assignment statement: ```mojo a = 5b = 3.14 ``` Both types of variables are strongly-typed: the variable receives a type when it's created, and the type never changes. You can't assign a variable a value of a different type: ```mojo count = 8 # count is type Intcount = "Nine?" # Error: can't implicitly convert 'StringLiteral' to 'Int' ``` Some types support implicit conversions from other types. For example, an integer value can implicitly convert to a floating-point value: ```mojo var temperature: Float64 = 99print(temperature) ``` In this example, the temperature variable is explicitly typed as Float64, but assigned an integer value, so the value is implicitly converted to a Float64. temperature Float64 Float64 ## Undeclared variables​ Within a def function or a REPL environment, you can create a variable with just a name and a value. For example: def ```mojo name = str("Sam")user_id = 0 ``` Undeclared variables are strongly typed: they take the type from the first value assigned to them. For example, the user_id variable above is type Int, while the name variable is type String. You can't assign a string to user_id or an integer to name. user_id Int name String user_id name Undeclared variables are scoped at the function level. You create an undeclared variable the first time you assign a value to a given name inside a function. Any subsequent references to that name inside the function refer to the same variable. For more information, see Variable scopes, which describes how variable scoping differs between declared and undeclared variables. Undeclared variables are not allowed in an fn function or as a struct field. fn ## Declared variables​ You can declare a variable with the var keyword. For example: var ```mojo var name = str("Sam")var user_id: Int ``` The name variable is initialized to the string "Sam". The user_id variable is uninitialized, but it has a declared type, Int for an integer value. All declared values are typed—either explicitly with a type annotation or implicitly when they're initialized with a value. name user_id Int Since variables are strongly typed, you can't assign a variable a value of a different type, unless those types can be implicitly converted. For example, this code will not compile: ```mojo var user_id: Int = "Sam" ``` There are several main differences between declared variables and undeclared variables: - A declared variable can be declared without initializing it: var value: Float64 - Declared variables follow lexical scoping, unlike undeclared variables. - Declared variables can be used in both def and fn functions. A declared variable can be declared without initializing it: ```mojo var value: Float64 ``` Declared variables follow lexical scoping, unlike undeclared variables. Declared variables can be used in both def and fn functions. def fn Using var can help prevent runtime errors caused by typos. For example, if you misspell the name of an undeclared variable, Mojo simply creates a new variable using the misspelled name. But when all mutable variables must be first declared with var (which is the case inside an fn function), then misspellings such as the following are caught by the compiler: var var fn ```mojo var name = "Sam"# Somewhere later...nane = "Sammy" # This is not allowed in an `fn` function ``` Although you can use var in a def function, this benefit is realized only when used inside an fn function, where the Mojo compiler will flag undeclared variables (such as the above nane) as unknown declarations. var def fn nane When using Mojo in a REPL environment, top-level variables (variables outside a function or struct) do not require var declarations. var ## Type annotations​ Although Mojo can infer a variable type from from the first value assigned to a variable, it also supports static type annotations on variables. Type annotations provide a more explicit way of specifying the variable's type. To specify the type for a variable, add a colon followed by the type name: ```mojo var name: String = get_name() ``` This makes it clear that name is type String, without knowing what the get_name() function returns. The get_name() function may return a String, or a value that's implicitly convertible to a String. name String get_name() get_name() String String You must declare a variable with var to use type annotations. var If a type has a constructor with just one argument, you can initialize it in two ways: ```mojo var name1: String = "Sam"var name2 = String("Sam") ``` Both of these lines invoke the same constructor to create a String from a StringLiteral. String StringLiteral ### Late initialization​ Using type annotations allows for late initialization. For example, notice here that the z variable is first declared with just a type, and the value is assigned later: z ```mojo fn my_function(x: Int): var z: Float32 if x != 0: z = 1.0 else: z = foo() print(z)fn foo() -> Float32: return 3.14 ``` If you try to pass an uninitialized variable to a function or use it on the right-hand side of an assignment statement, compilation fails. ```mojo var z: Float32var y = z # Error: use of uninitialized value 'z' ``` Late initialization works only if the variable is declared with a type. ### Implicit type conversion​ Some types include built-in type conversion (type casting) from one type into its own type. For example, if you assign an integer to a variable that has a floating-point type, it converts the value instead of giving a compiler error: ```mojo var number: Float64 = 1 ``` As shown above, value assignment can be converted into a constructor call if the target type has a constructor that takes a single argument that matches the value being assigned. So, this code uses the Float64 constructor that takes an integer: __init__(inout self, value: Int). Float64 __init__(inout self, value: Int) In general, implicit conversions should only be supported where the conversion is lossless. Implicit conversion follows the logic of overloaded functions. If the destination type has a single-argument constructor that takes an argument of the source type, it can be invoked for implicit conversion. So assigning an integer to a Float64 variable is exactly the same as this: Float64 ```mojo var number = Float64(1) ``` Similarly, if you call a function that requires an argument of a certain type (such as Float64), you can pass in any value as long as that value type can implicitly convert to the required type (using one of the type's overloaded constructors). Float64 For example, you can pass an Int to a function that expects a Float64, because Float64 includes a constructor that takes an Int: Int Float64 Float64 Int ```mojo fn take_float(value: Float64): print(value)fn pass_integer(): var value: Int = 1 take_float(value) ``` For more details on implicit conversion, see Constructors and implicit conversion. ## Variable scopes​ Variables declared with var are bound by lexical scoping. This means that nested code blocks can read and modify variables defined in an outer scope. But an outer scope cannot read variables defined in an inner scope at all. var For example, the if code block shown here creates an inner scope where outer variables are accessible to read/write, but any new variables do not live beyond the scope of the if block: if if ```mojo def lexical_scopes(): var num = 1 var dig = 1 if num == 1: print("num:", num) # Reads the outer-scope "num" var num = 2 # Creates new inner-scope "num" print("num:", num) # Reads the inner-scope "num" dig = 2 # Updates the outer-scope "dig" print("num:", num) # Reads the outer-scope "num" print("dig:", dig) # Reads the outer-scope "dig"lexical_scopes() ``` Note that the var statement inside the if creates a new variable with the same name as the outer variable. This prevents the inner loop from accessing the outer num variable. (This is called "variable shadowing," where the inner scope variable hides or "shadows" a variable from an outer scope.) var if num The lifetime of the inner num ends exactly where the if code block ends, because that's the scope in which the variable was defined. num if This is in contrast to undeclared variables (those without the var keyword), which use function-level scoping (consistent with Python variable behavior). That means, when you change the value of an undeclared variable inside the if block, it actually changes the value for the entire function. var if For example, here's the same code but without the var declarations: var ```mojo def function_scopes(): num = 1 if num == 1: print(num) # Reads the function-scope "num" num = 2 # Updates the function-scope variable print(num) # Reads the function-scope "num" print(num) # Reads the function-scope "num"function_scopes() ``` Now, the last print() function sees the updated num value from the inner scope, because undeclared variables (Python-style variables) use function-level scope (instead of lexical scope). print() num - Undeclared variables - Declared variables - Type annotationsLate initializationImplicit type conversion - Late initialization - Implicit type conversion - Variable scopes - Late initialization - Implicit type conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/structs - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Structs # Structs A Mojo struct is a data structure that allows you to encapsulate fields and methods that operate on an abstraction, such as a data type or an object. Fields are variables that hold data relevant to the struct, and methods are functions inside a struct that generally act upon the field data. For example, if you're building a graphics program, you can use a struct to define an Image that has fields to store information about each image (such as the pixels) and methods that perform actions on it (such as rotate it). Image For the most part, Mojo's struct format is designed to provide a static, memory-safe data structure for high-level data types used in programs. For example, all the data types in Mojo's standard library (such as Int, Bool, String, and Tuple) are defined as structs. Int Bool String Tuple If you understand how functions and variables work in Mojo, you probably noticed that Mojo is designed to provide dynamic programming features in a def function while enforcing stronger code safety in fn functions. When it comes to structs, Mojo leans toward the safe side: You can still choose whether to use either def or fn declarations for methods, but all fields must be declared with var. def fn def fn var ## Struct definition​ You can define a simple struct called MyPair with two fields like this: MyPair ```mojo struct MyPair: var first: Int var second: Int ``` However, you can't instantiate this struct because it has no constructor method. So here it is with a constructor to initialize the two fields: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second ``` Notice that the first argument in the __init__() method is inout self. For now, ignore inout (it's an argument convention that declares self as a mutable reference); all you need to know right now is that self must be the first argument. It references the current struct instance (it allows code in the method to refer to "itself"). When you call the constructor, you never pass a value for self—Mojo passes it in automatically. __init__() inout self inout self self self The __init__() method is one of many special methods (also known as "dunder methods" because they have double underscores) with pre-determined names. __init__() You can't assign values when you declare fields. You must initialize all of the struct's fields in the constructor. (If you try to leave a field uninitialized, the code won't compile.) Once you have a constructor, you can create an instance of MyPair and set the fields: MyPair ```mojo var mine = MyPair(2,4)print(mine.first) ``` ## Methods​ In addition to special methods like __init__(), you can add any other method you want to your struct. For example: __init__() ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn get_sum(self) -> Int: return self.first + self.second ``` ```mojo var mine = MyPair(6, 8)print(mine.get_sum()) ``` Notice that get_sum() also uses the self argument, because this is the only way you can access the struct's fields in a method. The name self is just a convention, and you can use any name you want to refer to the struct instance that is always passed as the first argument. get_sum() self self Methods that take the implicit self argument are called instance methods because they act on an instance of the struct. self The self argument in a struct method is the only argument in an fn function that does not require a type. You can include it if you want, but you can elide it because Mojo already knows its type (MyPair in this case). self fn MyPair ### Static methods​ A struct can also have static methods. A static method can be called without creating an instance of the struct. Unlike instance methods, a static method doesn't receive the implicit self argument, so it can't access any fields on the struct. self To declare a static method, use the @staticmethod decorator and don't include a self argument: @staticmethod self ```mojo struct Logger: fn __init__(inout self): pass @staticmethod fn log_info(message: String): print("Info: ", message) ``` You can invoke a static method by calling it on the type (in this case, Logger). You can also call it on an instance of the type. Both forms are shown below: Logger ```mojo Logger.log_info("Static method called.")var l = Logger()l.log_info("Static method called from instance.") ``` ## Structs compared to classes​ If you're familiar with other object-oriented languages, then structs might sound a lot like classes, and there are some similarities, but also some important differences. Eventually, Mojo will also support classes to match the behavior of Python classes. So, let's compare Mojo structs to Python classes. They both support methods, fields, operator overloading, decorators for metaprogramming, and more, but their key differences are as follows: - Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. - Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. - Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. - Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. - Mojo structs don't support static data members. Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. Mojo structs don't support static data members. Syntactically, the biggest difference compared to a Python class is that all fields in a struct must be explicitly declared with var. var In Mojo, the structure and contents of a struct are set at compile time and can’t be changed while the program is running. Unlike in Python, where you can add, remove, or change attributes of an object on the fly, Mojo doesn’t allow that for structs. However, the static nature of structs helps Mojo run your code faster. The program knows exactly where to find the struct’s information and how to use it without any extra steps or delays at runtime. Mojo’s structs also work really well with features you might already know from Python, like operator overloading (which lets you change how math symbols like + and - work with your own data, using special methods). + - As mentioned above, all Mojo's standard types (Int, String, etc.) are made using structs, rather than being hardwired into the language itself. This gives you more flexibility and control when writing your code, and it means you can define your own types with all the same capabilities (there's no special treatment for the standard library types). Int String ## Special methods​ Special methods (or "dunder methods") such as __init__() are pre-determined method names that you can define in a struct to perform a special task. __init__() Although it's possible to call special methods with their method names, the point is that you never should, because Mojo automatically invokes them in circumstances where they're needed (which is why they're also called "magic methods"). For example, Mojo calls the __init__() method when you create an instance of the struct; and when Mojo destroys the instance, it calls the __del__() method (if it exists). __init__() __del__() Even operator behaviors that appear built-in (+, <, ==, |, and so on) are implemented as special methods that Mojo implicitly calls upon to perform operations or comparisons on the type that the operator is applied to. + < == | Mojo supports a long list of special methods; far too many to discuss here, but they generally match all of Python's special methods and they usually accomplish one of two types of tasks: - Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). - Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). < + | Int __lt__() num1 < num2 Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. __init__() __del__() You can learn all about the lifecycle special methods in the Value lifecycle section. However, most structs are simple aggregations of other types, so unless your type requires custom behaviors when an instance is created, copied, moved, or destroyed, you can synthesize the essential lifecycle methods you need (and save yourself some time) by adding the @value decorator. @value ### @value decorator​ @value When you add the @value decorator to a struct, Mojo will synthesize the essential lifecycle methods so your object provides full value semantics. Specifically, it generates the __init__(), __copyinit__(), and __moveinit__() methods, which allow you to construct, copy, and move your struct type in a manner that's value semantic and compatible with Mojo's ownership model. @value __init__() __copyinit__() __moveinit__() For example: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo will notice that you don't have a member-wise initializer, a move constructor, or a copy constructor, and it will synthesize these for you as if you had written: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Without the copy and move constructors, the following code would not work because Mojo would not know how to copy an instance of MyPet: MyPet ```mojo var dog = MyPet("Charlie", 5)var poodle = dogprint(poodle.name) ``` When you add the @value decorator, Mojo synthesizes each special method above only if it doesn't exist already. That is, you can still implement a custom version of each method. @value In addition to the inout argument convention you already saw with __init__(), this code also introduces owned, which is another argument convention that ensures the argument has unique ownership of the value. For more detail, see the section about value ownership. inout __init__() owned - Struct definition - MethodsStatic methods - Static methods - Structs compared to classes - Special methods@value decorator - @value decorator - Static methods - @value decorator @value - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/packages - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Modules and packages # Modules and packages Mojo provides a packaging system that allows you to organize and compile code libraries into importable files. This page introduces the necessary concepts about how to organize your code into modules and packages (which is a lot like Python), and shows you how to create a packaged binary with the mojo package command. mojo package ## Mojo modules​ To understand Mojo packages, you first need to understand Mojo modules. A Mojo module is a single Mojo source file that includes code suitable for use by other files that import it. For example, you can create a module to define a struct such as this one: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` Notice that this code has no main() function, so you can't execute mymodule.mojo. However, you can import this into another file with a main() function and use it there. main() mymodule.mojo main() For example, here's how you can import MyPair into a file named main.mojo that's in the same directory as mymodule.mojo: MyPair main.mojo mymodule.mojo ```mojo from mymodule import MyPairfn main(): var mine = MyPair(2, 4) mine.dump() ``` Alternatively, you can import the whole module and then access its members through the module name. For example: ```mojo import mymodulefn main(): var mine = mymodule.MyPair(2, 4) mine.dump() ``` You can also create an alias for an imported member with as, like this: as ```mojo import mymodule as myfn main(): var mine = my.MyPair(2, 4) mine.dump() ``` In this example, it only works when mymodule.mojo is in the same directory as main.mojo. Currently, you can't import .mojo files as modules if they reside in other directories. That is, unless you treat the directory as a Mojo package, as described in the next section. mymodule.mojo main.mojo .mojo A Mojo module may include a main() function and may also be executable, but that's generally not the practice and modules typically include APIs to be imported and used in other Mojo programs. main() ## Mojo packages​ A Mojo package is just a collection of Mojo modules in a directory that includes an __init__.mojo file. By organizing modules together in a directory, you can then import all the modules together or individually. Optionally, you can also compile the package into a .mojopkg or .📦 file that's easier to share and still compatible with other system architectures. __init__.mojo .mojopkg .📦 You can import a package and its modules either directly from source files or from a compiled .mojopkg/.📦 file. It makes no real difference to Mojo which way you import a package. When importing from source files, the directory name works as the package name, whereas when importing from a compiled package, the filename is the package name (which you specify with the mojo package command—it can differ from the directory name). .mojopkg .📦 mojo package For example, consider a project with these files: ```mojo main.mojomypackage/ __init__.mojo mymodule.mojo ``` mymodule.mojo is the same code from examples above (with the MyPair struct) and __init__.mojo is empty. mymodule.mojo MyPair __init__.mojo In this case, the main.mojo file can now import MyPair through the package name like this: main.mojo MyPair ```mojo from mypackage.mymodule import MyPairfn main(): var mine = MyPair(2, 4) mine.dump() ``` Notice that the __init__.mojo is crucial here. If you delete it, then Mojo doesn't recognize the directory as a package and it cannot import mymodule. __init__.mojo mymodule Then, let's say you don't want the mypackage source code in the same location as main.mojo. So, you can compile it into a package file like this: mypackage main.mojo ```mojo mojo package mypackage -o mypack.mojopkg ``` A .mojopkg file contains non-elaborated code, so you can share it across systems. The code becomes an architecture-specific executable only after it's imported into a Mojo program that's then compiled with mojo build. .mojopkg mojo build Now, you can move the mypackage source somewhere else, and the project files now look like this: mypackage ```mojo main.mojomypack.mojopkg ``` Because we named the package file different from the directory, we need to fix the import statement and it all works the same: ```mojo from mypack.mymodule import MyPair ``` If you want to rename your package, you cannot simply edit the .mojopkg or .📦 filename, because the package name is encoded in the file. You must instead run mojo package again to specify a new name. .mojopkg .📦 mojo package ### The __init__ file​ __init__ As mentioned above, the __init__.mojo file is required to indicate that a directory should be treated as a Mojo package, and it can be empty. __init__.mojo Currently, top-level code is not supported in .mojo files, so unlike Python, you can't write code in __init__.mojo that executes upon import. You can, however, add structs and functions, which you can then import from the package name. .mojo __init__.mojo However, instead of adding APIs in the __init__.mojo file, you can import module members, which has the same effect by making your APIs accessible from the package name, instead of requiring the <package_name>.<module_name> notation. __init__.mojo <package_name>.<module_name> For example, again let's say you have these files: ```mojo main.mojomypackage/ __init__.mojo mymodule.mojo ``` Let's now add the following line in __init__.mojo: __init__.mojo ```mojo from .mymodule import MyPair ``` That's all that's in there. Now, we can simplify the import statement in main.mojo like this: main.mojo ```mojo from mypackage import MyPair ``` This feature explains why some members in the Mojo standard library can be imported from their package name, while others required the <package_name>.<module_name> notation. For example, the functional module resides in the algorithm package, so you can import members of that module (such as the map() function) like this: <package_name>.<module_name> functional algorithm map() ```mojo from algorithm.functional import map ``` However, the algorithm/__init__.mojo file also includes these lines: algorithm/__init__.mojo ```mojo from .functional import *from .reduction import * ``` So you can actually import anything from functional or reduction simply by naming the package. That is, you can drop the functional name from the import statement, and it also works: functional reduction functional ```mojo from algorithm import map ``` Which modules in the standard library are imported to the package scope varies, and is subject to change. Refer to the documentation for each module to see how you can import its members. - Mojo modules - Mojo packagesThe __init__ file - The __init__ file - The __init__ file __init__ - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Intro to value ownership # Intro to value ownership A program is nothing without data, and all modern programming languages store data in one of two places: the call stack and the heap (also sometimes in CPU registers, but we won't get into that here). However, each language reads and writes data a bit differently—sometimes very differently. So in the following sections, we'll explain how Mojo manages memory in your programs and how this affects the way you write Mojo code. ## Stack and heap overview​ In general, all programming languages use a call stack the same way: When a function is called, the compiler allocates a block of memory on the stack that is exactly the size required to store the execution logic and fixed-size local values. When another function is called, its data is likewise added to the top of the stack. When a function is done, all its data in the stack is destroyed so that memory becomes available for other code. Notice that we said only "fixed-size local values" are stored in the stack. Dynamically-sized values that can change in size at runtime are instead stored in the heap, which is a much larger region of memory that allows for dynamic memory access at runtime. Technically, a local variable for such a value is still stored in the call stack, but its value is a fixed-size pointer to the real value on the heap. Additionally, values that need to outlive the lifetime of a function (such as an array that's passed between functions and should not be copied) are stored in the heap, because heap memory is accessible from anywhere in the call stack, even after the function that created it is removed from the stack. This sort of situation—in which a heap-allocated value is used by multiple functions—is where most memory errors occur, and it's where memory management strategies vary the most between programming languages. ## Memory management strategies​ Because memory is limited, it's important that programs remove unused data from the heap ("free" the memory) as quickly as possible. Figuring out when to free that memory is pretty complicated. Some programming languages try to hide the complexities of memory management from you by utilizing a "garbage collector" process that tracks all memory usage and deallocates unused heap memory periodically (also known as automatic memory management). A significant benefit of this method is that it relieves developers from the burden of manual memory management, generally avoiding more errors and making developers more productive. However, it incurs a performance cost because the garbage collector interrupts the program's execution, and it might not reclaim memory very quickly. Other languages require that you manually free data that's allocated on the heap. When done properly, this makes programs execute quickly, because there's no processing time consumed by a garbage collector. However, the challenge with this approach is that programmers make mistakes, especially when multiple parts of the program need access to the same memory—it becomes difficult to know which part of the program "owns" the data and must deallocate it. Programmers might accidentally deallocate data before the program is done with it (causing "use-after-free" errors), or they might deallocate it twice ("double free" errors), or they might never deallocate it ("leaked memory" errors). Mistakes like these and others can have catastrophic results for the program, and these bugs are often hard to track down, making it especially important that they don't occur in the first place. Mojo uses a third approach called "ownership" that relies on a collection of rules that programmers must follow when passing values. The rules ensure there is only one "owner" for each chunk of memory at a time, and that the memory is deallocated accordingly. In this way, Mojo automatically allocates and deallocates heap memory for you, but it does so in a way that's deterministic and safe from errors such as use-after-free, double-free and memory leaks. Plus, it does so with a very low performance overhead. Mojo's value ownership model provides an excellent balance of programming productivity and strong memory safety. It only requires that you learn some new syntax and a few rules about how to share access to memory within your program. But before we explain the rules and syntax for Mojo's value ownership model, you first need to understand value semantics. - Stack and heap overview - Memory management strategies - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/value-semantics - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Value semantics # Value semantics Mojo doesn't enforce value semantics or reference semantics. It supports them both and allows each type to define how it is created, copied, and moved (if at all). So, if you're building your own type, you can implement it to support value semantics, reference semantics, or a bit of both. That said, Mojo is designed with argument behaviors that default to value semantics, and it provides tight controls for reference semantics that avoid memory errors. The controls over reference semantics are provided by the value ownership model, but before we get into the syntax and rules for that, it's important that you understand the principles of value semantics. Generally, it means that each variable has unique access to a value, and any code outside the scope of that variable cannot modify its value. ## Intro to value semantics​ In the most basic situation, sharing a value-semantic type means that you create a copy of the value. This is also known as "pass by value." For example, consider this code: ```mojo x = 1y = xy += 1print(x)print(y) ``` We assigned the value of x to y, which creates the value for y by making a copy of x. When we increment y, the value of x doesn't change. Each variable has exclusive ownership of a value. x y y x y x Whereas, if a type instead uses reference semantics, then y would point to the same value as x, and incrementing either one would affect the value for both. Neither x nor y would "own" the value, and any variable would be allowed to reference it and mutate it. y x x y Here's another example with a function: ```mojo def add_one(y: Int): y += 1 print(y)x = 1add_one(x)print(x) ``` Again, the y value is a copy and the function cannot modify the original x value. y x If you're familiar with Python, this is probably familiar so far, because the code above behaves the same in Python. However, Python is not value semantic. It gets complicated, but let's consider a situation in which you call a Python function and pass an object with a pointer to a heap-allocated value. Python actually gives that function a reference to your object, which allows the function to mutate the heap-allocated value. This can cause nasty bugs if you're not careful, because the function might incorrectly assume it has unique ownership of that object. In Mojo, the default behavior for all function arguments is to use value semantics. If the function wants to modify the value of an incoming argument, then it must explicitly declare so, which avoids accidental mutations of the original value. All Mojo types passed to a def function can be treated as mutable, which maintains the expected mutability behavior from Python. But by default, it is mutating a uniquely-owned value, not the original value. def For example, when you pass an instance of a SIMD vector to a def function it creates a unique copy of all values. Thus, if we modify the argument in the function, the original value is unchanged: SIMD def ```mojo def update_simd(t: SIMD[DType.int32, 4]): t[0] = 9 print(t)v = SIMD[DType.int32, 4](1, 2, 3, 4)update_simd(v)print(v) ``` If this were Python code, the function would modify the original object, because Python shares a reference to the original object. ### Value semantics in def vs fn​ def fn The arguments above are mutable because a def function has special treatment for the default borrowed argument convention. def borrowed Whereas, fn functions always receive borrowed arguments as immutable references. This is a memory optimization to avoid making unnecessary copies. fn borrowed For example, let's create another function with the fn declaration. In this case, the y argument is immutable by default, so if the function wants to modify the value in the local scope, it needs to make a local copy: fn y ```mojo fn add_two(y: Int): # y += 2 # This will cause a compiler error because `y` is immutable # We can instead make an explicit copy: var z = y z += 2 print(z)x = 1add_two(x)print(x) ``` This is all consistent with value semantics because each variable maintains unique ownership of its value. The way the fn function receives the y value is a "look but don't touch" approach to value semantics. This is also a more memory-efficient approach when dealing with memory-intensive arguments, because Mojo doesn't make any copies unless we explicitly make the copies ourselves. fn y Thus, the default behavior for def and fn arguments is fully value semantic: arguments are either copies or immutable references, and any living variable from the callee is not affected by the function. def fn But we must also allow reference semantics (mutable references) because it's how we build performant and memory-efficient programs (making copies of everything gets really expensive). The challenge is to introduce reference semantics in a way that does not disturb the predictability and safety of value semantics. The way we do that in Mojo is, instead of enforcing that every variable have "exclusive access" to a value, we ensure that every value has an "exclusive owner," and destroy each value when the lifetime of its owner ends. On the next page about value ownership, you'll learn how to modify the default argument conventions, and safely use reference semantics so every value has only one owner at a time. ## Python-style reference semantics​ If you will always use strict type declarations, you can skip this section because it only applies to Mojo code using def functions without type declarations (or values declared as object). def object As we said at the top of this page, Mojo doesn't enforce value semantics or reference semantics. It's up to each type author to decide how an instance of their type should be created, copied, and moved (see Value lifecycle). Thus, in order to provide compatibility with Python, Mojo's object type is designed to support Python's style of argument passing for functions, which is different from the other types in Mojo. object Python's argument-passing convention is called "pass by object reference." This means when you pass a variable to a Python function, you actually pass a reference to the object, as a value (so it's not strictly reference semantics). Passing the object reference "as a value" means that the argument name is just a container that acts like an alias to the original object. If you reassign the argument inside the function, it does not affect the caller's original value. However, if you modify the object itself (such as call append() on a list), the change is visible to the original object outside the function. append() For example, here's a Python function that receives a list and modifies it: ```mojo %%pythondef modify_list(l): l.append(3) print("func:", l)ar = [1, 2]modify_list(ar)print("orig:", ar) ``` In this example, it looks like the list is "passed by reference" because l modifies the original value. l However, if the Python function instead assigns a value to l, it does not affect the original value: l ```mojo %%pythondef change_list(l): l = [3, 4] print("func:", l)ar = [1, 2]change_list(ar)print("orig:", ar) ``` This demonstrates how a Python argument holds the object reference as a value: the function can mutate the original value, but it can also assign a new object to the argument name. ### Pass by object reference in Mojo​ Although we haven't finished implementing the object type to represent any Mojo type, our intention is to do so, and enable "pass by object reference" as described above for all dynamic types in a def function. object def That means you can have dynamic typing and "pass by object reference" behavior by simply writing your Mojo code like Python: - Use def function declarations. - Don't declare argument types. def Mojo is not a complete superset of Python yet, and there is a lot to do in this department before Mojo supports all of Python's types and behaviors. As such, this is a topic that also still needs a lot of documentation. - Intro to value semanticsValue semantics in def vs fn - Value semantics in def vs fn - Python-style reference semanticsPass by object reference in Mojo - Pass by object reference in Mojo - Value semantics in def vs fn def fn - Pass by object reference in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/ - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Intro to value lifecycle # Intro to value lifecycle So far, we've explained how Mojo allows you to build high-performance code that is memory safe without manually managing memory, using Mojo's ownership model. However, Mojo is designed for systems programming, which often requires manual memory management for custom data types. So, Mojo lets you do that as you see fit. To be clear, Mojo has no reference counter and no garbage collector. Mojo also has no built-in data types with special privileges. All data types in the standard library (such as Bool, Int, and String) are implemented as structs. You can actually write your own replacements for these types by using low-level primitives provided by MLIR dialects. Bool Int String What's great about the Mojo language is that it provides you these low-level tools for systems programming, but within a framework that helps you build things that are safe and easy to use from higher-level programs. That is, you can get under the hood and write all the "unsafe" code you want, but as long as you do so in accordance with Mojo's value semantics, the programmer instantiating your type/object doesn't need to think about memory management at all, and the behavior will be safe and predictable, thanks to value ownership. In summary, it's the responsibility of the type author to manage the memory and resources for each value type, by implementing specific lifecycle methods, such as the constructor, copy constructor, move constructor, and destructor, as necessary. Mojo doesn't create any constructors by default, although it does add a trivial, no-op destructor for types that don't define their own. In the following pages, we'll explain exactly how to define these lifecycle methods in accordance with value semantics so your types play nicely with value ownership. ## Lifecycles and lifetimes​ First, let's clarify some terminology: - The "lifecycle" of a value is defined by various dunder methods in a struct. Each lifecycle event is handled by a different method, such as the constructor (__init__()), the destructor (__del__()), the copy constructor (__copyinit__()), and the move constructor (__moveinit__()). All values that are declared with the same type have the same lifecycle. - The "lifetime" of a value is defined by the span of time during program execution in which each value is considered valid. The life of a value begins when it is initialized and ends when it is destroyed, which generally (but not always) spans from __init__() to __del__(). No two values have the exact same lifetime, because every value is created and destroyed at a different point in time (even if the difference is imperceivable). The "lifecycle" of a value is defined by various dunder methods in a struct. Each lifecycle event is handled by a different method, such as the constructor (__init__()), the destructor (__del__()), the copy constructor (__copyinit__()), and the move constructor (__moveinit__()). All values that are declared with the same type have the same lifecycle. __init__() __del__() __copyinit__() __moveinit__() The "lifetime" of a value is defined by the span of time during program execution in which each value is considered valid. The life of a value begins when it is initialized and ends when it is destroyed, which generally (but not always) spans from __init__() to __del__(). No two values have the exact same lifetime, because every value is created and destroyed at a different point in time (even if the difference is imperceivable). __init__() __del__() The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. Mojo destroys every value/object as soon as it's no longer used, using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. As you might imagine, keeping track of a value's lifetime can be difficult if a value is shared across functions many times during the life of a program. However, Mojo makes this predictable partly through its value semantics and value ownership (both prerequisite readings for the following sections). The final piece of the puzzle for lifetime management is the value lifecycle: every value (defined in a struct) needs to implement key lifecycle methods that define how a value is created and destroyed. - Lifecycles and lifetimes - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/death - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Death of a value # Death of a value As soon as a value/object is no longer used, Mojo destroys it. Mojo does not wait until the end of a code block—or even until the end of an expression—to destroy an unused value. It destroys values using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. Even within an expression like a+b+c+d, Mojo destroys the intermediate values as soon as they're no longer needed. a+b+c+d Mojo uses static compiler analysis to find the point where a value is last used. Then, Mojo immediately ends the value's lifetime and calls the __del__() destructor to perform any necessary cleanup for the type. __del__() For example, notice when the __del__() destructor is called for each instance of MyPet: __del__() MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __del__(owned self): print("Destruct", self.name)fn pets(): var a = MyPet("Loki", 4) var b = MyPet("Sylvie", 2) print(a.name) # a.__del__() runs here for "Loki" a = MyPet("Charlie", 8) # a.__del__() runs immediately because "Charlie" is never used print(b.name) # b.__del__() runs herepets() ``` Notice that each initialization of a value is matched with a call to the destructor, and a is actually destroyed multiple times—once for each time it receives a new value. a Also notice that this __del__() implementation doesn't actually do anything. Most structs don't require a custom destructor, and Mojo automatically adds a no-op destructor if you don't define one. __del__() ### Default destruction behavior​ You may be wondering how Mojo can destroy a type without a custom destructor, or why a no-op destructor is useful. If a type is simply a collection of fields, like the MyPet example, Mojo only needs to destroy the fields: MyPet doesn't dynamically allocate memory or use any long-lived resources (like file handles). There's no special action to take when a MyPet value is destroyed. MyPet MyPet MyPet Looking at the individual fields, MyPet includes an Int and a String. The Int is what Mojo calls a trivial type. It's a statically-sized bundle of bits. Mojo knows exactly how big it is, so those bits can be reused to store something else. MyPet Int String Int The String value is a little more complicated. Mojo strings are mutable. The String object has an internal buffer—a List field, which holds the characters that make up the string. A List stores its contents in dynamically allocated memory on the heap, so the string can grow or shrink. The string itself doesn't have any special destructor logic, but when Mojo destroys a string, it calls the destructor for the List field, which de-allocates the memory. String String List List List Since String and Int don't require any custom destructor logic, they both have no-op destructors: literally, __del__() methods that don't do anything. This may seem pointless, but it means that Mojo can call the destructor on any value when its lifetime ends. This makes it easier to write generic containers and algorithms. String Int __del__() ### Benefits of ASAP destruction​ Similar to other languages, Mojo follows the principle that objects/values acquire resources in a constructor (__init__()) and release resources in a destructor (__del__()). However, Mojo's ASAP destruction has some advantages over scope-based destruction (such as the C++ RAII pattern, which waits until the end of the code scope to destroy values): __init__() __del__() - Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. - Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Additionally, Mojo's ASAP destruction works great within Python-style def functions. That's because Python doesn’t really provide scopes beyond a function scope, so the Python garbage collector cleans up resources more often than a scope-based destruction policy would. However, Mojo does not use a garbage collector, so the ASAP destruction policy provides destruction guarantees that are even more fine-grained than in Python. def The Mojo destruction policy is more similar to how Rust and Swift work, because they both have strong value ownership tracking and provide memory safety. One difference is that Rust and Swift require the use of a dynamic "drop flag"—they maintain hidden shadow variables to keep track of the state of your values to provide safety. These are often optimized away, but the Mojo approach eliminates this overhead entirely, making the generated code faster and avoiding ambiguity. ## Destructor​ Mojo calls a value's destructor (__del__() method) when the value's lifetime ends (typically the point at which the value is last used). As we mentioned earlier, Mojo provides a default, no-op destructor for all types, so in most cases you don't need to define the __del__() method. __del__() __del__() You should define the __del__() method to perform any kind of cleanup the type requires. Usually, that includes freeing memory for any fields where you dynamically allocated memory (for example, via Pointer or DTypePointer) and closing any long-lived resources such as file handles. __del__() Pointer DTypePointer However, any struct that is just a simple collection of other types does not need to implement the destructor. For example, consider this simple struct: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` There's no need to define the __del__() destructor for this, because it's a simple collection of other types (String and Int), and it doesn't dynamically allocate memory. __del__() String Int Whereas, the following struct must define the __del__() method to free the memory allocated by its UnsafePointer: __del__() UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct HeapArray: var data: UnsafePointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = UnsafePointer[Int].alloc(self.size) for i in range(self.size): initialize_pointee_copy(self.data + i, val) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data + i) self.data.free() ``` Note that a pointer doesn't own any values in the memory it points to, so when a pointer is destroyed, Mojo doesn't call the destructors on those values. So in the HeapArray example above, calling free() on the pointer releases the memory, but doesn't call the destructors on the stored values. To invoke the destructors, use the destroy_pointee() function from the unsafe_pointer module. HeapArray free() destroy_pointee() unsafe_pointer You can't just call the destructor explicitly. Because __del__() takes self as an owned value, and owned arguments are copied by default, foo.__del__() actually creates and destroys a copy of foo. When Mojo destroys a value, however, it passes in the original value as self, not a copy. __del__() self owned foo.__del__() foo self It's important to notice that the __del__() method is an "extra" cleanup event, and your implementation does not override any default destruction behaviors. For example, Mojo still destroys all the fields in MyPet even if you implement __del__() to do nothing: __del__() MyPet __del__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __del__(owned self): # Mojo destroys all the fields when they're last used pass ``` However, the self value inside the __del__() destructor is still whole (so all fields are still usable) until the destructor returns, as we'll discuss more in the following section. self __del__() ## Field lifetimes​ In addition to tracking the lifetime of all objects in a program, Mojo also tracks each field of a structure independently. That is, Mojo keeps track of whether a "whole object" is fully or partially initialized/destroyed, and it destroys each field independently with its ASAP destruction policy. For example, consider this code that changes the value of a field: ```mojo @valuestruct MyPet: var name: String var age: Intfn use_two_strings(): var pet = MyPet("Po", 8) print(pet.name) # pet.name.__del__() runs here, because this instance is # no longer used; it's replaced below pet.name = String("Lola") # Overwrite pet.name print(pet.name) # pet.__del__() runs here ``` The pet.name field is destroyed after the first print(), because Mojo knows that it will be overwritten below. You can also see this behavior when using the transfer operator: pet.name print() ```mojo fn consume(owned arg: String): passfn use(arg: MyPet): print(arg.name)fn consume_and_use(): var pet = MyPet("Selma", 5) consume(pet.name^) # pet.name.__moveinit__() runs here, which destroys pet.name # Now pet is only partially initialized # use(pet) # This fails because pet.name is uninitialized pet.name = String("Jasper") # All together now use(pet) # This is ok # pet.__del__() runs here (and only if the object is whole) ``` Notice that the code transfers ownership of the name field to consume(). For a period of time after that, the name field is uninitialized. Then name is reinitialized before it is passed to the use() function. If you try calling use() before name is re-initialized, Mojo rejects the code with an uninitialized field error. name consume() name name use() use() name Also, if you don't re-initialize the name by the end of the pet lifetime, the compiler complains because it's unable to destroy a partially initialized object. pet Mojo's policy here is powerful and intentionally straight-forward: fields can be temporarily transferred, but the "whole object" must be constructed with the aggregate type’s initializer and destroyed with the aggregate destructor. This means it's impossible to create an object by initializing only its fields, and it's likewise impossible to destroy an object by destroying only its fields. ### Field lifetimes during destruct and move​ The consuming-move constructor and destructor face an interesting situation with field lifetimes, because, unlike other lifecycle methods, they both take an instance of their own type as an owned argument, which is about to be destroyed. You don't really need to worry about this detail when implementing these methods, but it might help you better understand field lifetimes. owned Just to recap, the move constructor and destructor method signatures look like this: ```mojo struct TwoStrings: fn __moveinit__(inout self, owned existing: Self): # Initializes a new `self` by consuming the contents of `existing` fn __del__(owned self): # Destroys all resources in `self` ``` There are two kinds of "self" here: capitalized Self is an alias for the current type name (used as a type specifier for the existing argument), whereas lowercase self is the argument name for the implicitly-passed reference to the current instance (also called "this" in other languages, and also implicitly a Self type). Self existing self Self Both of these methods face an interesting but obscure problem: they both must dismantle the existing/self value that's owned. That is, __moveinit__() implicitly destroys sub-elements of existing in order to transfer ownership to a new instance (read more about the move constructor), while __del__() implements the deletion logic for its self. As such, they both need to own and transform elements of the owned value, and they definitely don’t want the original owned value's destructor to also run—that could result in a double-free error, and in the case of the __del__() method, it would become an infinite loop. existing self owned __moveinit__() existing __del__() self owned owned __del__() To solve this problem, Mojo handles these two methods specially by assuming that their whole values are destroyed upon reaching any return from the method. This means that the whole object may be used as usual, up until the field values are transferred or the method returns. For example, the following code works as you would expect (within the destructor, we can still pass ownership of a field value to another function, and there's no infinite loop to destroy self): self ```mojo fn consume(owned str: String): print('Consumed', str)struct TwoStrings: var str1: String var str2: String fn __init__(inout self, one: String): self.str1 = one self.str2 = String("bar") fn __moveinit__(inout self, owned existing: Self): self.str1 = existing.str1 self.str2 = existing.str2 fn __del__(owned self): self.dump() # Self is still whole here # Mojo calls self.str2.__del__() since str2 isn't used anymore consume(self.str1^) # self.str1 has been transferred so it is also destroyed now; # `self.__del__()` is not called (avoiding an infinite loop). fn dump(inout self): print('str1:', self.str1) print('str2:', self.str2)fn use_two_strings(): var two_strings = TwoStrings("foo") ``` ## Explicit lifetimes​ So far, we've described how Mojo destroys a value at the point it's last used, and this works great in almost all situations. However, there are very rare situations in which Mojo simply cannot predict this correctly and will destroy a value that is still referenced through some other means. For instance, perhaps you're building a type with a field that carries a pointer to another field. The Mojo compiler won't be able to reason about the pointer, so it might destroy a field (obj1) when that field is technically no longer used, even though another field (obj2) still holds a pointer to part of it. So, you might need to keep obj1 alive until you can execute some special logic in the destructor or move initializer. obj1 obj2 obj1 You can force Mojo to keep a value alive up to a certain point by assigning the value to the _ discard pattern at the point where it's okay to destroy it. For example: _ ```mojo fn __del__(owned self): self.dump() # Self is still whole here consume(self.obj2^) _ = self.obj1 # Mojo keeps `obj1` alive until here, after its "last use" ``` In this case, if consume() refers to some value in obj1 somehow, this ensures that Mojo does not destroy obj1 until after the call to consume(), because assignment to the discard variable _ is actually the last use. consume() obj1 obj1 consume() _ For other situations, you can also scope the lifetime of a value using the Python-style with statement. That is, for any value defined at the entrance to a with statement, Mojo will keep that value alive until the end of the with statement. For example: with with with ```mojo with open("my_file.txt", "r") as file: print(file.read()) # Other stuff happens here (whether using `file` or not)... foo() # `file` is alive up to the end of the `with` statement.# `file` is destroyed when the statement ends.bar() ``` - Default destruction behavior - Benefits of ASAP destruction - Destructor - Field lifetimesField lifetimes during destruct and move - Field lifetimes during destruct and move - Explicit lifetimes - Field lifetimes during destruct and move - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/ - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/ - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python integration # Python integration Our long-term goal is to make Mojo a superset of Python (that is, to make Mojo compatible with existing Python programs). Python programmers should be able to use Mojo immediately, and be able to access the huge ecosystem of Python packages that are available today. However, Mojo is still in early development and many Python features are not yet implemented. You can't currently write everything in Mojo that you can write in Python. And Mojo doesn't have its own ecosystem of packages yet. To help bridge this gap, Mojo lets you import Python modules, call Python functions and interact with Python objects from Mojo code. It runs Python code using a standard Python interpreter (CPython), so your existing Python code doesn't need to change. ## Import a Python module​ To import a Python module in Mojo, just call Python.import_module() with the module name: Python.import_module() ```mojo from python import Pythonfn use_array() raises: # This is equivalent to Python's `import numpy as np` var np = Python.import_module("numpy") # Now use numpy as if writing in Python var array = np.array([1, 2, 3]) print(array) ``` ```mojo use_array() ``` Yes, this imports Python NumPy, and you can import any other Python module that you have installed. A few things to note: - Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. - Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. - import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. import_module() import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) import_module() fn try/except raises Mojo loads the Python interpreter and Python modules at runtime, so wherever you run a Mojo program, it must be able to access a compatible Python interpreter, and to locate any imported Python modules. For more information, see Python environment. ### Import a local Python module​ If you have some local Python code you want to use in Mojo, just add the directory to the Python path and then import the module. For example, suppose you have a Python file named mypython.py: mypython.py ```mojo import numpy as npdef gen_random_values(size, base): # generate a size x size array of random numbers between base and base+1 random_array = np.random.rand(size, size) return random_array + base ``` Here's how you can import it and use it in a Mojo file: ```mojo from python import Pythonfn main() raises: Python.add_to_path("path/to/module") var mypython = Python.import_module("mypython") var values = mypython.gen_random_values(2, 3) print(values) ``` Both absolute and relative paths work with add_to_path(). For example, you can import from the local directory like this: add_to_path() ```mojo Python.add_to_path(".") ``` ## Call Mojo from Python​ As shown above, you can call out to Python modules from Mojo. However, there's currently no way to do the reverse—import Mojo modules from Python or call Mojo functions from Python. This may present a challenge for using certain modules. For example, many UI frameworks have a main event loop that makes callbacks to user-defined code in response to UI events. This is sometimes called an "inversion of control" pattern. Instead of your application code calling in to a library, the framework code calls out to your application code. This pattern doesn't work because you can't pass Mojo callbacks to a Python module. For example, consider the popular Tkinter package. The typical usage for Tkinter is something like this: - You create a main, or "root" window for the application. - You add one or more UI widgets to the window. The widgets can have associated callback functions (for example, when a button is pushed). - You call the root window's mainloop() method, which listens for events, updates the UI, and invokes callback functions. The main loop keeps running until the application exits. mainloop() Since Python can't call back into Mojo, one alternative is to have the Mojo application drive the event loop and poll for updates. The following example uses Tkinter, but the basic approach can be applied to other packages. First we create a Python module that defines a Tkinter interface, with a window and single button: ```mojo %%pythonimport tkinter as tkclass App: def __init__(self): self._root = tk.Tk() self.clicked = False def click(self): self.clicked = True def create_button(self, button_text: str): button = tk.Button( master=self._root, text=button_text, command=self.click ) button.place(relx=0.5, rely=0.5, anchor=tk.CENTER) def create(self, res: str): self._root.geometry(res) self.create_button("Hello Mojo!") def update(self): self._root.update() ``` We can call this module from Mojo like this: ```mojo from python import Pythonfn button_clicked(): print("Hi from a Mojo🔥 fn!")def main(): Python.add_to_path(".") var app = Python.import_module("myapp").App() app.create("800x600") while True: app.update() if app.clicked: button_clicked() app.clicked = False ``` Instead of the Python module calling the Tkinter mainloop() method, the Mojo code calls the update() method in a loop and checks the clicked attribute after each update. mainloop() update() clicked ## Python environment​ The Mojo SDK depends on an existing Python dynamic library. At runtime, Mojo uses the first Python in the search path (PATH), to find an associated dynamic Python library of the same version. This will also add any modules from the activated virtual environment. PATH ### Resolving issues​ Finding libpython may fail if the Python interpreter on top of PATH does not have an associated dynamic library. Some Python distributions don't include the shared library, and others only have a static library which isn't supported by Mojo yet. PATH You can find a compatible Python on your system by running this Python script: ```mojo import osimport subprocessFIND_LIBPYTHON = """import osimport sysfrom pathlib import Pathfrom sysconfig import get_config_varext = "dll" if os.name == "nt" else "dylib" if sys.platform == "darwin" else "so"binary = f"libpython{get_config_var('py_version_short')}.{ext}"for folder in [Path(get_config_var(p)) for p in ["LIBPL", "LIBDIR"]]: libpython_path = folder / binary if libpython_path.is_file(): print(libpython_path.resolve()) exit(0)exit(1)"""FIND_PYTHON_VER = "import sysconfig; print(sysconfig.get_python_version())"exe_names = ["python3", "python"] + [f"python3.{i}" for i in range(8, 13)]seen = []executables = []print("Mojo will attempt to use the first python executable from the top:\n")print("vers | compat | path")for path in os.environ["PATH"].split(":"): for exe in exe_names: full_path = os.path.join(path, exe) if os.path.exists(full_path): pyver = subprocess.check_output([full_path, "-c", FIND_PYTHON_VER], text=True).strip() res = subprocess.run([full_path, "-c", FIND_LIBPYTHON], text=True, capture_output=True) libpython = res.stdout.strip() if res.returncode != 0: print(f"{pyver:<7} no {full_path}") elif libpython not in seen: print(f"{pyver:<7} yes {full_path}") seen.append(libpython) executables.append(full_path)if not executables: print("no compatible Python environments found")else: print("\ncreate and activate a virtual environment to use a different Python version:") print(f" {executables[-1]} -m venv .venv") print(" source .venv/bin/activate") ``` Which will produce output like: ```mojo Mojo will attempt to use the first python executable from the top:vers | compat | path3.11 yes /opt/homebrew/opt/[email protected]/libexec/bin/python33.12 yes /opt/homebrew/bin/python33.9 yes /usr/bin/python3create and activate a virtual environment to use a different Python version: /usr/bin/python3 -m venv .venv source .venv/bin/activate ``` If you have no compatible environment, you can install a compatible version of Python that includes shared libraries. Try following the instructions in Set up a Python environment with Conda to install a virtual environment. ### Set up a Python environment with Conda​ Using a Python virtual environment such as Conda is one way to get a version of Python that will work reliably with Mojo. It comes with the required dynamic library, and ensures there are no conflicts with system dependencies. To set up a virtual environment with Conda: - Install Conda by following the Quick command-line install instructions. - Initialize Conda for all the shells on your path: ~/miniconda3/bin/conda init --all Or just one at a time: ~/miniconda3/bin/conda init zsh - Restart your shell. - Install your desired version of Python and activate the environment: conda create -n 3.10 python=3.10conda activate 3.10 Install Conda by following the Quick command-line install instructions. Initialize Conda for all the shells on your path: ```mojo ~/miniconda3/bin/conda init --all ``` Or just one at a time: ```mojo ~/miniconda3/bin/conda init zsh ``` Restart your shell. Install your desired version of Python and activate the environment: ```mojo conda create -n 3.10 python=3.10conda activate 3.10 ``` After setting up the Conda virtual environment, you can install any Python packages you want to use with Mojo, with conda install or pip install. For example: conda install pip install ```mojo conda install numpypip install pillow ``` Now whenever you conda activate 3.10, Mojo will be able to find any modules you installed into that environment. conda activate 3.10 For more information on using Conda with Mojo, see Using Mojo with Python on the Modular Blog. - Import a Python moduleImport a local Python module - Import a local Python module - Call Mojo from Python - Python environmentResolving issuesSet up a Python environment with Conda - Resolving issues - Set up a Python environment with Conda - Import a local Python module - Resolving issues - Set up a Python environment with Conda - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/types - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python types # Python types When calling Python methods, Mojo needs to convert back and forth between native Python objects and native Mojo objects. Most of these conversions happen automatically, but there are a number of cases that Mojo doesn't handle yet. In these cases you may need to do an explicit conversion, or call an extra method. ## Mojo types in Python​ Mojo primitive types implicitly convert into Python objects. Today we support lists, tuples, integers, floats, booleans, and strings. For example, given this Python function that prints Python types: ```mojo %%pythondef type_printer(value): print(type(value)) ``` (You can ignore the %%python at the start of the code sample; it's explained in the note below.) %%python You can pass this Python function Mojo types with no problem: ```mojo type_printer(4)type_printer(3.14)type_printer(("Mojo", True)) ``` This is a simplified code example written as a set of Jupyter notebook cells. The first cell includes the %%python directive so it's interpreted as Python. The second cell includes top-level Mojo code. You'd need to adjust this code to run it elsewhere. %%python ## Python types in Mojo​ You can also use Python objects from Mojo. For example, Mojo's Dict and List types don't natively support heterogeneous collections. One alternative is to use a Python dictionary or list. Dict List For example, to create a Python dictionary, use the dict() method: dict() ```mojo from python import Pythondef use_dict(): var dictionary = Python.dict() dictionary["item_name"] = "whizbang" dictionary["price"] = 11.75 dictionary["inventory"] = 100 print(dictionary) ``` ### Mojo wrapper objects​ When you use Python objects in your Mojo code, Mojo adds the PythonObject wrapper around the Python object. This object exposes a number of common double underscore methods (dunder methods) like __getitem__() and __getattr__(), passing them through to the underlying Python object. PythonObject __getitem__() __getattr__() You can explicitly create a wrapped Python object by initializing a PythonObject with a Mojo literal: PythonObject ```mojo from python import PythonObjectvar py_list: PythonObject = [1, 2, 3, 4] ``` Most of the time, you can treat the wrapped object just like you'd treat it in Python. You can use Python's [] operators to access an item in a list, and use dot-notation to access attributes and call methods. For example: [] ```mojo var n = py_list[2]py_list.append(5) ``` If you want to construct a Python type that doesn't have a literal Mojo equivalent, you can also use the Python.evaluate() method. For example, to create a Python set: Python.evaluate() set ```mojo def use_py_set(): var py_set = Python.evaluate('set([2, 3, 5, 7, 11])') var num_items = len(py_set) print(num_items, " items in set.") # prints "5 items in set" print(py_set.__contains__(6)) # prints "False" ``` TODO: You should be able to use the expression 6 in py_set. However, because of the way PythonObject currently works, you need to call the __contains__() method directly. 6 in py_set PythonObject __contains__() Some Mojo APIs handle PythonObject just fine, but sometimes you'll need to explicitly convert a Python value into a native Mojo value. PythonObject Currently PythonObject conforms to the Intable, Stringable, and Boolable traits, which means you can convert Python values to Mojo Int, String, and Bool types using the built-in int(), str(), and bool() functions, and print Python values using the built-in print() function. PythonObject Intable Stringable Boolable Int String Bool int() str() bool() print() PythonObject also provides the to_float64() for converting to a Mojo floating point value. PythonObject to_float64() ```mojo var i: Int = int(py_int)var s: String = str(py_string)var b: Bool = bool(py_bool)var f: Float64 = py_float.to_float64() ``` ### Comparing Python types in Mojo​ In conditionals, Python objects act like you'd expect them to: Python values like False and None evaluate as false in Mojo, too. False None If you need to know the type of the underlying Python object, you can use the Python.type() method, which is equivalent to the Python type() builtin. You can compare the identity of two Python objects using the Python.is_type() method (which is equivalent to the Python is operator): Python.type() type() Python.is_type() is ```mojo def python_types(): from python import Python from python import PythonObject var value1: PythonObject = 3.7 var value2 = Python.evaluate("10/3") var float_type = Python.evaluate("float") print(Python.type(value1)) # <class 'float'> print(Python.is_type(Python.type(value1), Python.type(value2))) # True print(Python.is_type(Python.type(value1), float_type)) # True print(Python.is_type(Python.type(value1), Python.none())) # False ``` One TODO item here: The Python.is_type() method is misleadingly named, since it doesn't compare types, but object identity. Python.is_type() ## Further reading​ For more information, see Using Mojo with Python on the Modular Blog. - Mojo types in Python - Python types in MojoMojo wrapper objectsComparing Python types in Mojo - Mojo wrapper objects - Comparing Python types in Mojo - Further reading - Mojo wrapper objects - Comparing Python types in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/#contents - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Introduction # Mojo Manual Welcome to the Mojo Manual, a complete guide to the Mojo🔥 programming language! Mojo is designed to solve a variety of AI development challenges that no other language can, because Mojo is the first programming language built from the ground-up with MLIR (a compiler infrastructure that's ideal for heterogeneous hardware, from CPUs and GPUs, to various AI ASICs). We also designed Mojo as a superset of Python because we love Python and its community, but we couldn't realistically enhance Python to do all the things we wanted. For a longer discussion on this topic, read Why Mojo. Beware that Mojo is still a very young language, so there's a lot that hasn't been built yet. Likewise, there's a lot of documentation that hasn't been written yet. But we're excited to share Mojo with you and get your feedback. ## Contents​ - Get started Why Mojo Get started with Mojo - Why Mojo - Get started with Mojo - Language basics Introduction to Mojo Functions Variables Types Control flow Structs Modules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownership Intro to value ownership Value semantics Ownership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycle Intro to value lifecycle Life of a value Death of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parameters Traits Parameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - Pointers Unsafe pointers - Unsafe pointers - Python Python integration Python types - Python integration - Python types - Tools Debugging Testing - Debugging - Testing - Project information Roadmap and sharp edges Changelog FAQ Community - Roadmap and sharp edges - Changelog - FAQ - Community Get started - Why Mojo - Get started with Mojo Language basics - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages Value ownership - Intro to value ownership - Value semantics - Ownership and borrowing Value lifecycle - Intro to value lifecycle - Life of a value - Death of a value Traits and parameters - Traits - Parameterization: compile-time metaprogramming Pointers - Unsafe pointers Python - Python integration - Python types Tools - Debugging - Testing Project information - Roadmap and sharp edges - Changelog - FAQ - Community - Contents - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started#1-install-mojo - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started#2-run-code-in-the-repl - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started#3-run-a-mojo-file - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started#4-build-an-executable-binary - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started#5-install-our-vs-code-extension-optional - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started#next-steps - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started#update-mojo - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#functions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/get-started#run-code-in-the-repl - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Get started # Get started with Mojo🔥 On this page, we'll show you how to create the classic "Hello world" starter program with Mojo, in three different ways. If you'd rather read how to write Mojo code beyond just printing text, see the introduction to Mojo. ## 1. Install Mojo​ Mojo is now bundled with MAX, which provides everything you need to compile, run, debug, and package Mojo code. (Read why we bundled Mojo with MAX.) Follow the guide to install MAX & Mojo, and then return here. ## 2. Run code in the REPL​ Now that you've installed Mojo, let's write some code! First, let's use the Mojo REPL, which allows you to write and run Mojo code in a command prompt: - To start a REPL session, type mojo in your terminal and press Enter. - Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). To start a REPL session, type mojo in your terminal and press Enter. mojo Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression). print("Hello, world!") That's it! For example: ```mojo $ mojoWelcome to Mojo! 🔥Expressions are delimited by a blank line.Type `:quit` to exit the REPL and `:mojo help repl` for further assistance.1> print("Hello, world!")2.Hello, world! ``` You can write as much code as you want in the REPL. You can press Enter to start a new line and continue writing code, and when you want Mojo to evaluate the code, press Enter twice. If there's something to print, Mojo prints it and then returns the prompt to you. The REPL is primarily useful for short experiments because the code isn't saved. So when you want to write a real program, you need to write the code in a .mojo source file. .mojo ## 3. Run a Mojo file​ Now let's write the code in a Mojo source file and run it with the mojo command: mojo - Create a file named hello.mojo (or hello.🔥) and add the following code: fn main(): print("Hello, world!") That's all you need. Save the file and return to your terminal. - Now run it with the mojo command: mojo hello.mojo It should immediately print the message: Hello, world! Create a file named hello.mojo (or hello.🔥) and add the following code: hello.mojo hello.🔥 ```mojo fn main(): print("Hello, world!") ``` That's all you need. Save the file and return to your terminal. Now run it with the mojo command: mojo ```mojo mojo hello.mojo ``` It should immediately print the message: ```mojo Hello, world! ``` If this didn't work for you, double-check that your code looks exactly like the code in step 1, and make sure you correctly installed either MAX (which includes Mojo) or Mojo. ## 4. Build an executable binary​ Finally, let's build and run that same code as an executable: - Create an executable file with the build command: mojo build hello.mojo The executable file uses the same name as the .mojo file, but you can change that with the -o option. - Then run the executable: ./hello Create an executable file with the build command: build ```mojo mojo build hello.mojo ``` The executable file uses the same name as the .mojo file, but you can change that with the -o option. .mojo -o Then run the executable: ```mojo ./hello ``` This creates a statically compiled binary file, so it contains all the code and libraries it needs to run. ## 5. Install our VS Code extension (optional)​ To provide a first-class developer experience with features like code completion, quick fixes, and hover help, we've created a Mojo extension for Visual Studio Code. ## Next steps​ - If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git If you installed the nightly build, also checkout the nightly branch: git checkout nightly In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you're new to Mojo, we suggest you learn the language basics in the introduction to Mojo. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` If you installed the nightly build, also checkout the nightly branch: ```mojo git checkout nightly ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. If you have issues during install, check our known issues. To help us improve Mojo, we collect some basic system information and crash reports. Learn more. ## Update Mojo​ Because Mojo is now a part of MAX, you soon won't be able to update the standalone mojo package, and you must instead install/update the max package. (Read why we bundled Mojo with MAX.) mojo max If you already installed Mojo on its own, you'll need to install MAX to get all future Mojo updates. Before you install max, you should uninstall Mojo to avoid conflicting toolchain versions between the mojo and max packages: max mojo max ```mojo modular uninstall mojo ``` Then follow the guide to install MAX & Mojo. - 1. Install Mojo - 2. Run code in the REPL - 3. Run a Mojo file - 4. Build an executable binary - 5. Install our VS Code extension (optional) - Next steps - Update Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#value-ownership-and-argument-mutability - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#variables - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#structs - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#traits - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#parameterization - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#blocks-and-statements - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#code-comments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#python-integration - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/basics#next-steps - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Introduction to Mojo # Introduction to Mojo At this point, you should have already set up the Mojo SDK and run "Hello world". Now let's talk about how to write Mojo code. You probably already know that Mojo is designed as a superset of Python. So if you know Python, then a lot of Mojo code will look familiar. However, Mojo is—first and foremost—designed for high-performance systems programming, with features like strong type checking, memory safety, next-generation compiler technologies, and more. As such, Mojo also has a lot in common with languages like C++ and Rust. Yet, we've designed Mojo to be flexible, so you can incrementally adopt systems-programming features like strong type checking as you see fit—Mojo does not require strong type checking. On this page, we'll introduce the essential Mojo syntax, so you can start coding quickly and understand other Mojo code you encounter. Subsequent sections in the Mojo Manual dive deeper into these topics, and links are provided below as appropriate. Let's get started! 🔥 Mojo is a young language and there are many features still missing. As such, Mojo is currently not meant for beginners. Even this basics section assumes some programming experience. However, throughout the Mojo Manual, we try not to assume experience with any particular language. ## Functions​ Mojo functions can be declared with either fn or def. fn def The fn declaration enforces type-checking and memory-safe behaviors (Rust style), while def allows no type declarations and dynamic behaviors (Python style). fn def For example, this def function doesn't require declaration of argument types or the return type: def ```mojo def greet(name): return "Hello, " + name + "!" ``` While the same thing as an fn function requires that you specify the argument type and the return type like this: fn ```mojo fn greet2(name: String) -> String: return "Hello, " + name + "!" ``` Both functions have the same result, but the fn function provides compile-time checks to ensure the function receives and returns the correct types. Whereas, the def function might fail at runtime if it receives the wrong type. fn def Currently, Mojo doesn't support top-level code in a .mojo (or .🔥) file, so every program must include a function named main() as the entry point. You can declare it with either def or fn: .mojo .🔥 main() def fn ```mojo def main(): print("Hello, world!") ``` You don't need a main() function when coding in the REPL or in a Jupyter notebook. main() For more details, see the page about functions. ### Value ownership and argument mutability​ If you're wondering whether function arguments are passed by value or passed by reference, the short answer is: def functions receive arguments "by value" and fn functions receive arguments "by immutable reference." def fn The longer short answer is that Mojo allows you to specify for each argument whether it should be passed by value (as owned), or whether it should be passed by reference (as borrowed for an immutable reference, or as inout for a mutable reference). owned borrowed inout This feature is entwined with Mojo's value ownership model, which protects you from memory errors by ensuring that only one variable "owns" a value at any given time (but allowing other variables to receive a reference to it). Ownership then ensures that the value is destroyed when the lifetime of the owner ends (and there are no outstanding references). But that's still a short answer, because going much further is a slippery slope into complexity that is out of scope for this section. For the complete answer, see the section about value ownership. ## Variables​ You can declare variables with the var keyword. Or, if your code is in a def function, you can omit the var (in an fn function, you must include the var keyword). var def var fn var For example: ```mojo def do_math(x): var y = x + x y = y * y print(y) ``` Optionally, you can also declare a variable type like this: ```mojo def add_one(x): var y: Int = 1 print(x + y) ``` Even in an fn function, declaring the variable type is optional (only the argument and return types must be declared in fn functions). fn fn For more details, see the page about variables. ## Structs​ You can build high-level abstractions for types (or "objects") as a struct. struct A struct in Mojo is similar to a class in Python: they both support methods, fields, operator overloading, decorators for metaprogramming, and so on. However, Mojo structs are completely static—they are bound at compile-time, so they do not allow dynamic dispatch or any runtime changes to the structure. (Mojo will also support Python-style classes in the future.) struct class For example, here's a basic struct: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` And here's how you can use it: ```mojo fn use_mypair(): var mine = MyPair(2, 4) mine.dump() ``` For more details, see the page about structs. ### Traits​ A trait is like a template of characteristics for a struct. If you want to create a struct with the characteristics defined in a trait, you must implement each characteristic (such as each method). Each characteristic in a trait is a "requirement" for the struct, and when your struct implements each requirement, it's said to "conform" to the trait. Currently, the only characteristics that traits can define are method signatures. Also, traits currently cannot implement default behaviors for methods. Using traits allows you to write generic functions that can accept any type that conforms to a trait, rather than accept only specific types. For example, here's how you can create a trait (notice the function is not implemented): ```mojo trait SomeTrait: fn required_method(self, x: Int): ... ``` And here's how to create a struct that conforms to the trait: ```mojo @valuestruct SomeStruct(SomeTrait): fn required_method(self, x: Int): print("hello traits", x) ``` Then, here's a function that uses the trait as an argument type (instead of the struct type): ```mojo fn fun_with_traits[T: SomeTrait](x: T): x.required_method(42)fn use_trait_function(): var thing = SomeStruct() fun_with_traits(thing) ``` You're probably wondering about the square brackets on fun_with_traits(). These aren't function arguments (which go in parentheses); these are function parameters, which we'll explain next. fun_with_traits() Without traits, the x argument in fun_with_traits() would have to declare a specific type that implements required_method(), such as SomeStruct (but then the function would accept only that type). With traits, the function can accept any type for x as long as it conforms to (it "implements") SomeTrait. Thus, fun_with_traits() is known as a "generic function" because it accepts a generalized type instead of a specific type. x fun_with_traits() required_method() SomeStruct x SomeTrait fun_with_traits() For more details, see the page about traits. ## Parameterization​ In Mojo, a parameter is a compile-time variable that becomes a runtime constant, and it's declared in square brackets on a function or struct. Parameters allow for compile-time metaprogramming, which means you can generate or modify code at compile time. Many other languages use "parameter" and "argument" interchangeably, so be aware that when we say things like "parameter" and "parametric function," we're talking about these compile-time parameters. Whereas, a function "argument" is a runtime value that's declared in parentheses. Parameterization is a complex topic that's covered in much more detail in the Metaprogramming section, but we want to break the ice just a little bit here. To get you started, let's look at a parametric function: ```mojo fn repeat[count: Int](msg: String): for i in range(count): print(msg) ``` This function has one parameter of type Int and one argument of type String. To call the function, you need to specify both the parameter and the argument: Int String ```mojo fn call_repeat(): repeat[3]("Hello") # Prints "Hello" 3 times ``` By specifying count as a parameter, the Mojo compiler is able to optimize the function because this value is guaranteed to not change at runtime. The compiler effectively generates a unique version of the repeat() function that repeats the message only 3 times. This makes the code more performant because there's less to compute at runtime. count repeat() Similarly, you can define a struct with parameters, which effectively allows you to define variants of that type at compile-time, depending on the parameter values. For more detail on parameters, see the section on Metaprogramming. ## Blocks and statements​ Code blocks such as functions, conditions, and loops are defined with a colon followed by indented lines. For example: ```mojo def loop(): for x in range(5): if x % 2 == 0: print(x) ``` You can use any number of spaces or tabs for your indentation (we prefer 4 spaces). All code statements in Mojo end with a newline. However, statements can span multiple lines if you indent the following lines. For example, this long string spans two lines: ```mojo def print_line(): long_text = "This is a long line of text that is a lot easier to read if" " it is broken up across two lines instead of one long line." print(long_text) ``` And you can chain function calls across lines: ```mojo def print_hello(): text = String(",") .join("Hello", " world!") print(text) ``` ## Code comments​ You can create a one-line comment using the hash # symbol: # ```mojo # This is a comment. The Mojo compiler ignores this line. ``` Comments may also follow some code: ```mojo var message = "Hello, World!" # This is also a valid comment ``` You can instead write longer comments across many lines using triple quotes: ```mojo """This is also a comment, but it's easier to write acrossmany lines, because each line doesn't need the # symbol.""" ``` Triple quotes is the preferred method of writing API documentation. For example: ```mojo fn print(x: String): """Prints a string. Args: x: The string to print. """ ... ``` Documenting your code with these kinds of comments (known as "docstrings") is a topic we've yet to fully specify, but you can generate an API reference from docstrings using the mojo doc command. mojo doc ## Python integration​ Mojo is not yet a full superset of Python, but we've built a mechanism to import Python modules as-is, so you can leverage existing Python code right away. For example, here's how you can import and use NumPy (you must have Python numpy installed): numpy ```mojo from python import Pythonfn use_numpy() raises: var np = Python.import_module("numpy") var ar = np.arange(15).reshape(3, 5) print(ar) print(ar.shape) ``` You must have the Python module (such as numpy) installed already. numpy For more details, see the page about Python integration. ## Next steps​ Hopefully this page has given you enough information to start experimenting with Mojo, but this is only touching the surface of what's available in Mojo. If you're in the mood to read more, continue through each page of this Mojo Manual using the buttons at the bottom of each page—the next page from here is Functions. Otherwise, here are some other resources to check out: - If you want to experiment with some code, clone the Mojo repo to try our code examples: git clone https://github.com/modularml/mojo.git In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. - To see all the available Mojo APIs, check out the Mojo standard library reference. If you want to experiment with some code, clone the Mojo repo to try our code examples: ```mojo git clone https://github.com/modularml/mojo.git ``` In addition to several .mojo examples, the repo includes Jupyter notebooks that teach advanced Mojo features. .mojo To see all the available Mojo APIs, check out the Mojo standard library reference. - FunctionsValue ownership and argument mutability - Value ownership and argument mutability - Variables - StructsTraits - Traits - Parameterization - Blocks and statements - Code comments - Python integration - Next steps - Value ownership and argument mutability - Traits - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#fn-functions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/structs#methods - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Structs # Structs A Mojo struct is a data structure that allows you to encapsulate fields and methods that operate on an abstraction, such as a data type or an object. Fields are variables that hold data relevant to the struct, and methods are functions inside a struct that generally act upon the field data. For example, if you're building a graphics program, you can use a struct to define an Image that has fields to store information about each image (such as the pixels) and methods that perform actions on it (such as rotate it). Image For the most part, Mojo's struct format is designed to provide a static, memory-safe data structure for high-level data types used in programs. For example, all the data types in Mojo's standard library (such as Int, Bool, String, and Tuple) are defined as structs. Int Bool String Tuple If you understand how functions and variables work in Mojo, you probably noticed that Mojo is designed to provide dynamic programming features in a def function while enforcing stronger code safety in fn functions. When it comes to structs, Mojo leans toward the safe side: You can still choose whether to use either def or fn declarations for methods, but all fields must be declared with var. def fn def fn var ## Struct definition​ You can define a simple struct called MyPair with two fields like this: MyPair ```mojo struct MyPair: var first: Int var second: Int ``` However, you can't instantiate this struct because it has no constructor method. So here it is with a constructor to initialize the two fields: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second ``` Notice that the first argument in the __init__() method is inout self. For now, ignore inout (it's an argument convention that declares self as a mutable reference); all you need to know right now is that self must be the first argument. It references the current struct instance (it allows code in the method to refer to "itself"). When you call the constructor, you never pass a value for self—Mojo passes it in automatically. __init__() inout self inout self self self The __init__() method is one of many special methods (also known as "dunder methods" because they have double underscores) with pre-determined names. __init__() You can't assign values when you declare fields. You must initialize all of the struct's fields in the constructor. (If you try to leave a field uninitialized, the code won't compile.) Once you have a constructor, you can create an instance of MyPair and set the fields: MyPair ```mojo var mine = MyPair(2,4)print(mine.first) ``` ## Methods​ In addition to special methods like __init__(), you can add any other method you want to your struct. For example: __init__() ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn get_sum(self) -> Int: return self.first + self.second ``` ```mojo var mine = MyPair(6, 8)print(mine.get_sum()) ``` Notice that get_sum() also uses the self argument, because this is the only way you can access the struct's fields in a method. The name self is just a convention, and you can use any name you want to refer to the struct instance that is always passed as the first argument. get_sum() self self Methods that take the implicit self argument are called instance methods because they act on an instance of the struct. self The self argument in a struct method is the only argument in an fn function that does not require a type. You can include it if you want, but you can elide it because Mojo already knows its type (MyPair in this case). self fn MyPair ### Static methods​ A struct can also have static methods. A static method can be called without creating an instance of the struct. Unlike instance methods, a static method doesn't receive the implicit self argument, so it can't access any fields on the struct. self To declare a static method, use the @staticmethod decorator and don't include a self argument: @staticmethod self ```mojo struct Logger: fn __init__(inout self): pass @staticmethod fn log_info(message: String): print("Info: ", message) ``` You can invoke a static method by calling it on the type (in this case, Logger). You can also call it on an instance of the type. Both forms are shown below: Logger ```mojo Logger.log_info("Static method called.")var l = Logger()l.log_info("Static method called from instance.") ``` ## Structs compared to classes​ If you're familiar with other object-oriented languages, then structs might sound a lot like classes, and there are some similarities, but also some important differences. Eventually, Mojo will also support classes to match the behavior of Python classes. So, let's compare Mojo structs to Python classes. They both support methods, fields, operator overloading, decorators for metaprogramming, and more, but their key differences are as follows: - Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. - Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. - Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. - Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. - Mojo structs don't support static data members. Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. Mojo structs don't support static data members. Syntactically, the biggest difference compared to a Python class is that all fields in a struct must be explicitly declared with var. var In Mojo, the structure and contents of a struct are set at compile time and can’t be changed while the program is running. Unlike in Python, where you can add, remove, or change attributes of an object on the fly, Mojo doesn’t allow that for structs. However, the static nature of structs helps Mojo run your code faster. The program knows exactly where to find the struct’s information and how to use it without any extra steps or delays at runtime. Mojo’s structs also work really well with features you might already know from Python, like operator overloading (which lets you change how math symbols like + and - work with your own data, using special methods). + - As mentioned above, all Mojo's standard types (Int, String, etc.) are made using structs, rather than being hardwired into the language itself. This gives you more flexibility and control when writing your code, and it means you can define your own types with all the same capabilities (there's no special treatment for the standard library types). Int String ## Special methods​ Special methods (or "dunder methods") such as __init__() are pre-determined method names that you can define in a struct to perform a special task. __init__() Although it's possible to call special methods with their method names, the point is that you never should, because Mojo automatically invokes them in circumstances where they're needed (which is why they're also called "magic methods"). For example, Mojo calls the __init__() method when you create an instance of the struct; and when Mojo destroys the instance, it calls the __del__() method (if it exists). __init__() __del__() Even operator behaviors that appear built-in (+, <, ==, |, and so on) are implemented as special methods that Mojo implicitly calls upon to perform operations or comparisons on the type that the operator is applied to. + < == | Mojo supports a long list of special methods; far too many to discuss here, but they generally match all of Python's special methods and they usually accomplish one of two types of tasks: - Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). - Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). < + | Int __lt__() num1 < num2 Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. __init__() __del__() You can learn all about the lifecycle special methods in the Value lifecycle section. However, most structs are simple aggregations of other types, so unless your type requires custom behaviors when an instance is created, copied, moved, or destroyed, you can synthesize the essential lifecycle methods you need (and save yourself some time) by adding the @value decorator. @value ### @value decorator​ @value When you add the @value decorator to a struct, Mojo will synthesize the essential lifecycle methods so your object provides full value semantics. Specifically, it generates the __init__(), __copyinit__(), and __moveinit__() methods, which allow you to construct, copy, and move your struct type in a manner that's value semantic and compatible with Mojo's ownership model. @value __init__() __copyinit__() __moveinit__() For example: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo will notice that you don't have a member-wise initializer, a move constructor, or a copy constructor, and it will synthesize these for you as if you had written: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Without the copy and move constructors, the following code would not work because Mojo would not know how to copy an instance of MyPet: MyPet ```mojo var dog = MyPet("Charlie", 5)var poodle = dogprint(poodle.name) ``` When you add the @value decorator, Mojo synthesizes each special method above only if it doesn't exist already. That is, you can still implement a custom version of each method. @value In addition to the inout argument convention you already saw with __init__(), this code also introduces owned, which is another argument convention that ensures the argument has unique ownership of the value. For more detail, see the section about value ownership. inout __init__() owned - Struct definition - MethodsStatic methods - Static methods - Structs compared to classes - Special methods@value decorator - @value decorator - Static methods - @value decorator @value - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#argument-conventions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#def-functions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/value-semantics#python-style-reference-semantics - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Value semantics # Value semantics Mojo doesn't enforce value semantics or reference semantics. It supports them both and allows each type to define how it is created, copied, and moved (if at all). So, if you're building your own type, you can implement it to support value semantics, reference semantics, or a bit of both. That said, Mojo is designed with argument behaviors that default to value semantics, and it provides tight controls for reference semantics that avoid memory errors. The controls over reference semantics are provided by the value ownership model, but before we get into the syntax and rules for that, it's important that you understand the principles of value semantics. Generally, it means that each variable has unique access to a value, and any code outside the scope of that variable cannot modify its value. ## Intro to value semantics​ In the most basic situation, sharing a value-semantic type means that you create a copy of the value. This is also known as "pass by value." For example, consider this code: ```mojo x = 1y = xy += 1print(x)print(y) ``` We assigned the value of x to y, which creates the value for y by making a copy of x. When we increment y, the value of x doesn't change. Each variable has exclusive ownership of a value. x y y x y x Whereas, if a type instead uses reference semantics, then y would point to the same value as x, and incrementing either one would affect the value for both. Neither x nor y would "own" the value, and any variable would be allowed to reference it and mutate it. y x x y Here's another example with a function: ```mojo def add_one(y: Int): y += 1 print(y)x = 1add_one(x)print(x) ``` Again, the y value is a copy and the function cannot modify the original x value. y x If you're familiar with Python, this is probably familiar so far, because the code above behaves the same in Python. However, Python is not value semantic. It gets complicated, but let's consider a situation in which you call a Python function and pass an object with a pointer to a heap-allocated value. Python actually gives that function a reference to your object, which allows the function to mutate the heap-allocated value. This can cause nasty bugs if you're not careful, because the function might incorrectly assume it has unique ownership of that object. In Mojo, the default behavior for all function arguments is to use value semantics. If the function wants to modify the value of an incoming argument, then it must explicitly declare so, which avoids accidental mutations of the original value. All Mojo types passed to a def function can be treated as mutable, which maintains the expected mutability behavior from Python. But by default, it is mutating a uniquely-owned value, not the original value. def For example, when you pass an instance of a SIMD vector to a def function it creates a unique copy of all values. Thus, if we modify the argument in the function, the original value is unchanged: SIMD def ```mojo def update_simd(t: SIMD[DType.int32, 4]): t[0] = 9 print(t)v = SIMD[DType.int32, 4](1, 2, 3, 4)update_simd(v)print(v) ``` If this were Python code, the function would modify the original object, because Python shares a reference to the original object. ### Value semantics in def vs fn​ def fn The arguments above are mutable because a def function has special treatment for the default borrowed argument convention. def borrowed Whereas, fn functions always receive borrowed arguments as immutable references. This is a memory optimization to avoid making unnecessary copies. fn borrowed For example, let's create another function with the fn declaration. In this case, the y argument is immutable by default, so if the function wants to modify the value in the local scope, it needs to make a local copy: fn y ```mojo fn add_two(y: Int): # y += 2 # This will cause a compiler error because `y` is immutable # We can instead make an explicit copy: var z = y z += 2 print(z)x = 1add_two(x)print(x) ``` This is all consistent with value semantics because each variable maintains unique ownership of its value. The way the fn function receives the y value is a "look but don't touch" approach to value semantics. This is also a more memory-efficient approach when dealing with memory-intensive arguments, because Mojo doesn't make any copies unless we explicitly make the copies ourselves. fn y Thus, the default behavior for def and fn arguments is fully value semantic: arguments are either copies or immutable references, and any living variable from the callee is not affected by the function. def fn But we must also allow reference semantics (mutable references) because it's how we build performant and memory-efficient programs (making copies of everything gets really expensive). The challenge is to introduce reference semantics in a way that does not disturb the predictability and safety of value semantics. The way we do that in Mojo is, instead of enforcing that every variable have "exclusive access" to a value, we ensure that every value has an "exclusive owner," and destroy each value when the lifetime of its owner ends. On the next page about value ownership, you'll learn how to modify the default argument conventions, and safely use reference semantics so every value has only one owner at a time. ## Python-style reference semantics​ If you will always use strict type declarations, you can skip this section because it only applies to Mojo code using def functions without type declarations (or values declared as object). def object As we said at the top of this page, Mojo doesn't enforce value semantics or reference semantics. It's up to each type author to decide how an instance of their type should be created, copied, and moved (see Value lifecycle). Thus, in order to provide compatibility with Python, Mojo's object type is designed to support Python's style of argument passing for functions, which is different from the other types in Mojo. object Python's argument-passing convention is called "pass by object reference." This means when you pass a variable to a Python function, you actually pass a reference to the object, as a value (so it's not strictly reference semantics). Passing the object reference "as a value" means that the argument name is just a container that acts like an alias to the original object. If you reassign the argument inside the function, it does not affect the caller's original value. However, if you modify the object itself (such as call append() on a list), the change is visible to the original object outside the function. append() For example, here's a Python function that receives a list and modifies it: ```mojo %%pythondef modify_list(l): l.append(3) print("func:", l)ar = [1, 2]modify_list(ar)print("orig:", ar) ``` In this example, it looks like the list is "passed by reference" because l modifies the original value. l However, if the Python function instead assigns a value to l, it does not affect the original value: l ```mojo %%pythondef change_list(l): l = [3, 4] print("func:", l)ar = [1, 2]change_list(ar)print("orig:", ar) ``` This demonstrates how a Python argument holds the object reference as a value: the function can mutate the original value, but it can also assign a new object to the argument name. ### Pass by object reference in Mojo​ Although we haven't finished implementing the object type to represent any Mojo type, our intention is to do so, and enable "pass by object reference" as described above for all dynamic types in a def function. object def That means you can have dynamic typing and "pass by object reference" behavior by simply writing your Mojo code like Python: - Use def function declarations. - Don't declare argument types. def Mojo is not a complete superset of Python yet, and there is a lot to do in this department before Mojo supports all of Python's types and behaviors. As such, this is a topic that also still needs a lot of documentation. - Intro to value semanticsValue semantics in def vs fn - Value semantics in def vs fn - Python-style reference semanticsPass by object reference in Mojo - Pass by object reference in Mojo - Value semantics in def vs fn def fn - Pass by object reference in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#the-object-type - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/value-semantics#full-value-semantics - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Value semantics # Value semantics Mojo doesn't enforce value semantics or reference semantics. It supports them both and allows each type to define how it is created, copied, and moved (if at all). So, if you're building your own type, you can implement it to support value semantics, reference semantics, or a bit of both. That said, Mojo is designed with argument behaviors that default to value semantics, and it provides tight controls for reference semantics that avoid memory errors. The controls over reference semantics are provided by the value ownership model, but before we get into the syntax and rules for that, it's important that you understand the principles of value semantics. Generally, it means that each variable has unique access to a value, and any code outside the scope of that variable cannot modify its value. ## Intro to value semantics​ In the most basic situation, sharing a value-semantic type means that you create a copy of the value. This is also known as "pass by value." For example, consider this code: ```mojo x = 1y = xy += 1print(x)print(y) ``` We assigned the value of x to y, which creates the value for y by making a copy of x. When we increment y, the value of x doesn't change. Each variable has exclusive ownership of a value. x y y x y x Whereas, if a type instead uses reference semantics, then y would point to the same value as x, and incrementing either one would affect the value for both. Neither x nor y would "own" the value, and any variable would be allowed to reference it and mutate it. y x x y Here's another example with a function: ```mojo def add_one(y: Int): y += 1 print(y)x = 1add_one(x)print(x) ``` Again, the y value is a copy and the function cannot modify the original x value. y x If you're familiar with Python, this is probably familiar so far, because the code above behaves the same in Python. However, Python is not value semantic. It gets complicated, but let's consider a situation in which you call a Python function and pass an object with a pointer to a heap-allocated value. Python actually gives that function a reference to your object, which allows the function to mutate the heap-allocated value. This can cause nasty bugs if you're not careful, because the function might incorrectly assume it has unique ownership of that object. In Mojo, the default behavior for all function arguments is to use value semantics. If the function wants to modify the value of an incoming argument, then it must explicitly declare so, which avoids accidental mutations of the original value. All Mojo types passed to a def function can be treated as mutable, which maintains the expected mutability behavior from Python. But by default, it is mutating a uniquely-owned value, not the original value. def For example, when you pass an instance of a SIMD vector to a def function it creates a unique copy of all values. Thus, if we modify the argument in the function, the original value is unchanged: SIMD def ```mojo def update_simd(t: SIMD[DType.int32, 4]): t[0] = 9 print(t)v = SIMD[DType.int32, 4](1, 2, 3, 4)update_simd(v)print(v) ``` If this were Python code, the function would modify the original object, because Python shares a reference to the original object. ### Value semantics in def vs fn​ def fn The arguments above are mutable because a def function has special treatment for the default borrowed argument convention. def borrowed Whereas, fn functions always receive borrowed arguments as immutable references. This is a memory optimization to avoid making unnecessary copies. fn borrowed For example, let's create another function with the fn declaration. In this case, the y argument is immutable by default, so if the function wants to modify the value in the local scope, it needs to make a local copy: fn y ```mojo fn add_two(y: Int): # y += 2 # This will cause a compiler error because `y` is immutable # We can instead make an explicit copy: var z = y z += 2 print(z)x = 1add_two(x)print(x) ``` This is all consistent with value semantics because each variable maintains unique ownership of its value. The way the fn function receives the y value is a "look but don't touch" approach to value semantics. This is also a more memory-efficient approach when dealing with memory-intensive arguments, because Mojo doesn't make any copies unless we explicitly make the copies ourselves. fn y Thus, the default behavior for def and fn arguments is fully value semantic: arguments are either copies or immutable references, and any living variable from the callee is not affected by the function. def fn But we must also allow reference semantics (mutable references) because it's how we build performant and memory-efficient programs (making copies of everything gets really expensive). The challenge is to introduce reference semantics in a way that does not disturb the predictability and safety of value semantics. The way we do that in Mojo is, instead of enforcing that every variable have "exclusive access" to a value, we ensure that every value has an "exclusive owner," and destroy each value when the lifetime of its owner ends. On the next page about value ownership, you'll learn how to modify the default argument conventions, and safely use reference semantics so every value has only one owner at a time. ## Python-style reference semantics​ If you will always use strict type declarations, you can skip this section because it only applies to Mojo code using def functions without type declarations (or values declared as object). def object As we said at the top of this page, Mojo doesn't enforce value semantics or reference semantics. It's up to each type author to decide how an instance of their type should be created, copied, and moved (see Value lifecycle). Thus, in order to provide compatibility with Python, Mojo's object type is designed to support Python's style of argument passing for functions, which is different from the other types in Mojo. object Python's argument-passing convention is called "pass by object reference." This means when you pass a variable to a Python function, you actually pass a reference to the object, as a value (so it's not strictly reference semantics). Passing the object reference "as a value" means that the argument name is just a container that acts like an alias to the original object. If you reassign the argument inside the function, it does not affect the caller's original value. However, if you modify the object itself (such as call append() on a list), the change is visible to the original object outside the function. append() For example, here's a Python function that receives a list and modifies it: ```mojo %%pythondef modify_list(l): l.append(3) print("func:", l)ar = [1, 2]modify_list(ar)print("orig:", ar) ``` In this example, it looks like the list is "passed by reference" because l modifies the original value. l However, if the Python function instead assigns a value to l, it does not affect the original value: l ```mojo %%pythondef change_list(l): l = [3, 4] print("func:", l)ar = [1, 2]change_list(ar)print("orig:", ar) ``` This demonstrates how a Python argument holds the object reference as a value: the function can mutate the original value, but it can also assign a new object to the argument name. ### Pass by object reference in Mojo​ Although we haven't finished implementing the object type to represent any Mojo type, our intention is to do so, and enable "pass by object reference" as described above for all dynamic types in a def function. object def That means you can have dynamic typing and "pass by object reference" behavior by simply writing your Mojo code like Python: - Use def function declarations. - Don't declare argument types. def Mojo is not a complete superset of Python yet, and there is a lot to do in this department before Mojo supports all of Python's types and behaviors. As such, this is a topic that also still needs a lot of documentation. - Intro to value semanticsValue semantics in def vs fn - Value semantics in def vs fn - Python-style reference semanticsPass by object reference in Mojo - Pass by object reference in Mojo - Value semantics in def vs fn def fn - Pass by object reference in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#function-arguments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#optional-arguments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#mutable-arguments-inout - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#positional-only-and-keyword-only-arguments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#keyword-arguments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#variadic-arguments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#variadic-parameters - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#homogeneous-variadic-arguments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#heterogeneous-variadic-arguments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#variadic-keyword-arguments - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/functions#overloaded-functions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Functions # Functions As mentioned in Language basics, Mojo supports two types of functions: def and fn functions. You can use either declaration with any function, including the main() function, but they have different default behaviors, as described on this page. def fn main() We believe both def and fn have good use cases and don't consider either to be better than the other. Deciding which to use is a matter of personal taste as to which style best fits a given task. def fn We believe Mojo's flexibility in this regard is a superpower that allows you to write code in the manner that's best for your project. Functions declared inside a struct are called "methods," but they have all the same qualities as "functions" described here. struct ## fn functions​ fn The fn function has somewhat stricter rules than the def function. fn def Here's an example of an fn function: fn ```mojo fn greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` As far as a function caller is concerned, def and fn functions are interchangeable. That is, there's nothing a def can do that an fn can't (and vice versa). The difference is that, compared to a def function, an fn function is more strict on the inside. def fn def fn def fn Here's everything to know about fn: fn - Arguments must specify a type (except for the self argument in struct methods). - Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). - By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). - Variables must be declared using the var keyword. - If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) Arguments must specify a type (except for the self argument in struct methods). self Return values must specify a type, unless the function doesn't return a value. If you don't specify a return type, it defaults to None (meaning no return value). None By default, arguments are received as an immutable reference (values are read-only, using the borrowed argument convention). borrowed This prevents accidental mutations, and permits the use of non-copyable types as arguments. If you want a local copy, you can simply assign the value to a local variable. Or, you can get a mutable reference to the value by declaring the inout argument convention). inout Variables must be declared using the var keyword. var If the function raises an exception, it must be explicitly declared with the raises keyword. (A def function does not need to declare exceptions.) raises def By enforcing these type checks, using the fn function helps avoid a variety of runtime errors. fn ## def functions​ def Compared to an fn function, a def function has fewer restrictions. The def function works more like a Python def function. For example, this function works the same in Python and Mojo: fn def def def ```mojo def greet(name): greeting = "Hello, " + name + "!" return greeting ``` In a Mojo def function, you have the option to specify the argument type and the return type. You can also declare variables with var, with or without explicit typing. So you can write a def function that looks almost exactly like the fn function shown earlier: def var def fn ```mojo def greet(name: String) -> String: var greeting = "Hello, " + name + "!" return greeting ``` This way, the compiler ensures that name is a string, and the return type is a string. name Here's everything to know about def: def - Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). - Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) - Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. If an argument is an object type, it's received as a reference, following object reference semantics. If an argument is any other declared type, it's received as a value. - Variables don't need to be declared using var. Arguments don't require a declared type. Undeclared arguments are actually passed as an object, which allows the function to receive any type (Mojo infers the type at runtime). object Return types don't need to be declared, and also default to object. (If a def function doesn't declare a return type of None, it's considered to return an object by default.) object def None object Arguments are mutable. Arguments default to using the using the borrowed argument convention) like an fn function, with a special addition: if the function mutates the argument, it makes a mutable copy. borrowed fn If an argument is an object type, it's received as a reference, following object reference semantics. object If an argument is any other declared type, it's received as a value. Variables don't need to be declared using var. var ### The object type​ object If you don't declare the type for an argument or return value in a def, it becomes an object, which is unlike any other type in the standard library. def object The object type allows for dynamic typing because it can actually represent any type in the Mojo standard library, and the actual type is inferred at runtime. (Actually, there's still more to do before it can represent all Mojo types.) This is great for compatibility with Python and all of the flexibility that it provides with dynamic types. However, this lack of type enforcement can lead to runtime errors when a function receives or returns an unexpected type. object For compatibility with Python, object values are passed using object reference semantics. As such, the object type is not compatible with the argument conventions that enforce value semantics. So, be careful if using object values alongside other strongly-typed values—their behavior might be inconsistent because object is the only type in the standard library that does not conform to full value semantics. object object object object The object type is still a work in progress. It doesn't support all of the possible underlying types, for example. object ## Function arguments​ As noted in the previous sections, there are a few differences between how def and fn functions treat arguments. But most of the time they are the same. def fn As noted, there are some differences in argument conventions. Argument conventions are discussed in much more detail in the page on Ownership. The other difference is that def functions don't need to specify an argument's type. If no type is specified, the argument is passed as an object. def object The remaining rules for arguments described in this section apply to both def and fn functions. def fn ### Optional arguments​ An optional argument is one that includes a default value, such as the exp argument here: exp ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_defaults(): # Uses the default value for `exp` var z = my_pow(3) print(z) ``` However, you cannot define a default value for an argument that's declared as inout. inout Any optional arguments must appear after any required arguments. Keyword-only arguments, discussed later, can also be either required or optional. ### Keyword arguments​ You can also use keyword arguments when calling a function. Keyword arguments are specified using the format argument_name = argument_value. You can pass keyword arguments in any order: ```mojo argument_name = argument_value ``` ```mojo fn my_pow(base: Int, exp: Int = 2) -> Int: return base ** expfn use_keywords(): # Uses keyword argument names (with order reversed) var z = my_pow(exp=3, base=2) print(z) ``` ### Variadic arguments​ Variadic arguments let a function accept a variable number of arguments. To define a function that takes a variadic argument, use the variadic argument syntax *argument_name: ```mojo *argument_name ``` ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum + value return sum ``` The variadic argument values here is a placeholder that accepts any number of passed positional arguments. values You can define zero or more arguments before the variadic argument. When calling the function, any remaining positional arguments are assigned to the variadic argument, so any arguments declared after the variadic argument can only be specified by keyword (see Positional-only and keyword-only arguments). Variadic arguments can be divided into two categories: - Homogeneous variadic arguments, where all of the passed arguments are the same type—all Int, or all String, for example. - Heterogeneous variadic arguments, which can accept a set of different argument types. Int String The following sections describe how to work with homogeneous and heterogenous variadic arguments. Mojo parameters are distinct from arguments (parameters are used for compile-time metaprogramming). Variadic parameters are supported, but with some limitations—for details see variadic parameters. #### Homogeneous variadic arguments​ When defining a homogeneous variadic argument, use *argument_name: argument_type: ```mojo *argument_name: argument_type ``` ```mojo def greet(*names: String): ... ``` Inside the function body, the variadic argument is available as an iterable list for ease of use. Currently there are some differences in handling the list depending on whether the arguments are register-passable types (such as Int) or memory-only types (such as String). TODO: We hope to remove these differences in the future. Int String Register-passable types, such as Int, are available as a VariadicList type. As shown in the previous example, you can iterate over the values using a for..in loop. Int VariadicList for..in ```mojo fn sum(*values: Int) -> Int: var sum: Int = 0 for value in values: sum = sum+value return sum ``` Memory-only types, such as String, are available as a VariadicListMem. Iterating over this list directly with a for..in loop currently produces a Reference for each value instead of the value itself. You must add an empty subscript operator [] to dereference the reference and retrieve the value: String VariadicListMem for..in Reference [] ```mojo def make_worldly(inout *strs: String): # Requires extra [] to dereference the reference for now. for i in strs: i[] += " world" ``` Alternately, subscripting into a VariadicListMem returns the argument value, and doesn't require any dereferencing: VariadicListMem ```mojo fn make_worldly(inout *strs: String): # This "just works" as you'd expect! for i in range(len(strs)): strs[i] += " world" ``` #### Heterogeneous variadic arguments​ Implementing heterogeneous variadic arguments is somewhat more complicated than homogeneous variadic arguments. Writing generic code to handle multiple argument types requires traits and parameters. So the syntax may look a little unfamiliar if you haven't worked with those features. The signature for a function with a heterogeneous variadic argument looks like this: ```mojo def count_many_things[*ArgTypes: Intable](*args: *ArgTypes): ... ``` The parameter list, [*ArgTypes: Intable] specifies that the function takes an ArgTypes parameter, which is a list of types, all of which conform to the Intable trait. The argument list, (*args: *ArgTypes) has the familiar *args for the variadic argument, but instead of a single type, its type is defined as list of types, *ArgTypes. [*ArgTypes: Intable] ArgTypes Intable (*args: *ArgTypes) *args *ArgTypes This means that each argument in args has a corresponding type in ArgTypes, so args[n] is of type ArgTypes[n]. args ArgTypes ```mojo args[n] ``` ```mojo ArgTypes[n] ``` Inside the function, args is available as a VariadicPack. The easiest way to work with the arguments is to use the each() method to iterate through the VariadicPack: args VariadicPack each() VariadicPack ```mojo fn count_many_things[*ArgTypes: Intable](*args: *ArgTypes) -> Int: var total = 0 @parameter fn add[Type: Intable](value: Type): total += int(value) args.each[add]() return totalprint(count_many_things(5, 11.7, 12)) ``` In the example above, the add() function is called for each argument in turn, with the appropriate value and Type values. For instance, add() is first called with value=5 and Type=Int, then with value=11.7 and Type=Float64. add() value Type add() value=5 Type=Int value=11.7 Type=Float64 Also, note that when calling count_many_things(), you don't actually pass in a list of argument types. You only need to pass in the arguments, and Mojo generates the ArgTypes list itself. count_many_things() ArgTypes As a small optimization, if your function is likely to be called with a single argument frequently, you can define your function with a single argument followed by a variadic argument. This lets the simple case bypass populating and iterating through the VariadicPack. VariadicPack For example, given a print_string() function that prints a single string, you could re-implement the variadic print() function with code like this: print_string() print() ```mojo fn print_string(s: String): print(s, end="")fn print_many[T: Stringable, *Ts: Stringable](first: T, *rest: *Ts): print_string(str(first)) @parameter fn print_elt[T: Stringable](a: T): print_string(" ") print_string(a) rest.each[print_elt]()print_many("Bob") ``` If you call print_many() with a single argument, it calls print_string() directly. The VariadicPack is empty, so each() returns immediately without calling the print_elt() function. print_many() print_string() VariadicPack each() print_elt() #### Variadic keyword arguments​ Mojo functions also support variadic keyword arguments (**kwargs). Variadic keyword arguments allow the user to pass an arbitrary number of keyword arguments. To define a function that takes a variadic keyword argument, use the variadic keyword argument syntax **kw_argument_name: **kwargs ```mojo **kw_argument_name ``` ```mojo fn print_nicely(**kwargs: Int) raises: for key in kwargs.keys(): print(key[], "=", kwargs[key[]]) # prints: # `a = 7` # `y = 8`print_nicely(a=7, y=8) ``` In this example, the argument name kwargs is a placeholder that accepts any number of keyword arguments. Inside the body of the function, you can access the arguments as a dictionary of keywords and argument values (specifically, an instance of OwnedKwargsDict). kwargs OwnedKwargsDict There are currently a few limitations: - Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... - All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. - The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. - Dictionary unpacking is not supported yet: fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. - Variadic keyword parameters are not supported yet: # Not supported yet.fn var_kwparams[**kwparams: Int](): ... Variadic keyword arguments are always implicitly treated as if they were declared with the owned argument convention, and can't be declared otherwise: owned ```mojo # Not supported yet.fn borrowed_var_kwargs(borrowed **kwargs: Int): ... ``` All the variadic keyword arguments must have the same type, and this determines the type of the argument dictionary. For example, if the argument is **kwargs: Float64 then the argument dictionary will be a OwnedKwargsDict[Float64]. **kwargs: Float64 OwnedKwargsDict[Float64] The argument type must conform to the CollectionElement trait. That is, the type must be both Movable and Copyable. CollectionElement Movable Copyable Dictionary unpacking is not supported yet: ```mojo fn takes_dict(d: Dict[String, Int]): print_nicely(**d) # Not supported yet. ``` Variadic keyword parameters are not supported yet: ```mojo # Not supported yet.fn var_kwparams[**kwparams: Int](): ... ``` ### Positional-only and keyword-only arguments​ When defining a function, you can restrict some arguments so that they can only be passed as positional arguments, or they can only be passed as keyword arguments. To define positional-only arguments, add a slash character (/) to the argument list. Any arguments before the / are positional-only: they can't be passed as keyword arguments. For example: / / ```mojo fn min(a: Int, b: Int, /) -> Int: return a if a < b else b ``` This min() function can be called with min(1, 2) but can't be called using keywords, like min(a=1, b=2). min() min(1, 2) min(a=1, b=2) There are several reasons you might want to write a function with positional-only arguments: - The argument names aren't meaningful for the the caller. - You want the freedom to change the argument names later on without breaking backward compatibility. For example, in the min() function, the argument names don't add any real information, and there's no reason to specify arguments by keyword. min() For more information on positional-only arguments, see PEP 570 – Python Positional-Only Parameters. Keyword-only arguments are the inverse of positional-only arguments: they can only be specified by keyword. If a function accepts variadic arguments, any arguments defined after the variadic arguments are treated as keyword-only. For example: ```mojo fn sort(*values: Float64, ascending: Bool = True): ... ``` In this example, the user can pass any number of Float64 values, optionally followed by the keyword ascending argument: Float64 ascending ```mojo var a = sort(1.1, 6.5, 4.3, ascending=False) ``` If the function doesn't accept variadic arguments, you can add a single star (*) to the argument list to separate the keyword-only arguments: * ```mojo fn kw_only_args(a1: Int, a2: Int, *, double: Bool) -> Int: var product = a1 * a2 if double: return product * 2 else: return product ``` Keyword-only arguments often have default values, but this is not required. If a keyword-only argument doesn't have a default value, it is a required keyword-only argument. It must be specified, and it must be specified by keyword. Any required keyword-only arguments must appear in the signature before any optional keyword-only arguments. That is, arguments appear in the following sequence a function signature: - Required positional arguments. - Optional positional arguments. - Variadic arguments. - Required keyword-only arguments. - Optional keyword-only arguments. - Variadic keyword arguments. For more information on keyword-only arguments, see PEP 3102 – Keyword-Only Arguments. ## Overloaded functions​ If a def function does not specify argument types, then it can accept any data type and decide how to handle each type internally. This is nice when you want expressive APIs that just work by accepting arbitrary inputs, so there's usually no need to write function overloads for a def function. def def On the other hand, all fn functions must specify argument types, so if you want a function to work with different data types, you need to implement separate versions of the function that each specify different argument types. This is called "overloading" a function. fn For example, here's an overloaded add() function that can accept either Int or String types: add() Int String ```mojo fn add(x: Int, y: Int) -> Int: return x + yfn add(x: String, y: String) -> String: return x + y ``` If you pass anything other than Int or String to the add() function, you'll get a compiler error. That is, unless Int or String can implicitly cast the type into their own type. For example, String includes an overloaded version of its constructor (__init__()) that accepts a StringLiteral value. Thus, you can also pass a StringLiteral to a function that expects a String. Int String add() Int String String __init__() StringLiteral StringLiteral String When resolving an overloaded function call, the Mojo compiler tries each candidate function and uses the one that works (if only one version works), or it picks the closest match (if it can determine a close match), or it reports that the call is ambiguous (if it can’t figure out which one to pick). If the compiler can't figure out which function to use, you can resolve the ambiguity by explicitly casting your value to a supported argument type. For example, in the following code, we want to call the overloaded foo() function, but both implementations accept an argument that supports implicit conversion from StringLiteral. So, the call to foo(string) is ambiguous and creates a compiler error. We can fix it by casting the value to the type we really want: foo() StringLiteral foo(string) ```mojo @valuestruct MyString: fn __init__(inout self, string: StringLiteral): passfn foo(name: String): print("String")fn foo(name: MyString): print("MyString")fn call_foo(): alias string: StringLiteral = "Hello" # foo(string) # This call is ambiguous because two `foo` functions match it foo(MyString(string)) ``` When resolving an overloaded function, Mojo does not consider the return type or other contextual information at the call site—only the argument types affect which function is selected. Overloading also works with combinations of both fn and def functions. For example, you could define multiple fn function overloads and then one or more def versions that don't specify all argument types, as a fallback. fn def fn def Although we haven't discussed parameters yet (they're different from function arguments, and used for compile-time metaprogramming), you can also overload functions based on parameter types. - fn functions - def functionsThe object type - The object type - Function argumentsOptional argumentsKeyword argumentsVariadic argumentsPositional-only and keyword-only arguments - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - Overloaded functions fn def - The object type object - Optional arguments - Keyword arguments - Variadic arguments - Positional-only and keyword-only arguments - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/variables#implicit-type-conversion - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Variables # Variables A variable is a name that holds a value or object. All variables in Mojo are mutable—their value can be changed. (If you want to define a constant value that can't change at runtime, see the alias keyword.) alias Mojo has two kinds of variables: - Declared variables are created with the var keyword, and may include type annotations. var a = 5var b: Float64 = 3.14 - Undeclared variables are created with an assignment statement: a = 5b = 3.14 Declared variables are created with the var keyword, and may include type annotations. var ```mojo var a = 5var b: Float64 = 3.14 ``` Undeclared variables are created with an assignment statement: ```mojo a = 5b = 3.14 ``` Both types of variables are strongly-typed: the variable receives a type when it's created, and the type never changes. You can't assign a variable a value of a different type: ```mojo count = 8 # count is type Intcount = "Nine?" # Error: can't implicitly convert 'StringLiteral' to 'Int' ``` Some types support implicit conversions from other types. For example, an integer value can implicitly convert to a floating-point value: ```mojo var temperature: Float64 = 99print(temperature) ``` In this example, the temperature variable is explicitly typed as Float64, but assigned an integer value, so the value is implicitly converted to a Float64. temperature Float64 Float64 ## Undeclared variables​ Within a def function or a REPL environment, you can create a variable with just a name and a value. For example: def ```mojo name = str("Sam")user_id = 0 ``` Undeclared variables are strongly typed: they take the type from the first value assigned to them. For example, the user_id variable above is type Int, while the name variable is type String. You can't assign a string to user_id or an integer to name. user_id Int name String user_id name Undeclared variables are scoped at the function level. You create an undeclared variable the first time you assign a value to a given name inside a function. Any subsequent references to that name inside the function refer to the same variable. For more information, see Variable scopes, which describes how variable scoping differs between declared and undeclared variables. Undeclared variables are not allowed in an fn function or as a struct field. fn ## Declared variables​ You can declare a variable with the var keyword. For example: var ```mojo var name = str("Sam")var user_id: Int ``` The name variable is initialized to the string "Sam". The user_id variable is uninitialized, but it has a declared type, Int for an integer value. All declared values are typed—either explicitly with a type annotation or implicitly when they're initialized with a value. name user_id Int Since variables are strongly typed, you can't assign a variable a value of a different type, unless those types can be implicitly converted. For example, this code will not compile: ```mojo var user_id: Int = "Sam" ``` There are several main differences between declared variables and undeclared variables: - A declared variable can be declared without initializing it: var value: Float64 - Declared variables follow lexical scoping, unlike undeclared variables. - Declared variables can be used in both def and fn functions. A declared variable can be declared without initializing it: ```mojo var value: Float64 ``` Declared variables follow lexical scoping, unlike undeclared variables. Declared variables can be used in both def and fn functions. def fn Using var can help prevent runtime errors caused by typos. For example, if you misspell the name of an undeclared variable, Mojo simply creates a new variable using the misspelled name. But when all mutable variables must be first declared with var (which is the case inside an fn function), then misspellings such as the following are caught by the compiler: var var fn ```mojo var name = "Sam"# Somewhere later...nane = "Sammy" # This is not allowed in an `fn` function ``` Although you can use var in a def function, this benefit is realized only when used inside an fn function, where the Mojo compiler will flag undeclared variables (such as the above nane) as unknown declarations. var def fn nane When using Mojo in a REPL environment, top-level variables (variables outside a function or struct) do not require var declarations. var ## Type annotations​ Although Mojo can infer a variable type from from the first value assigned to a variable, it also supports static type annotations on variables. Type annotations provide a more explicit way of specifying the variable's type. To specify the type for a variable, add a colon followed by the type name: ```mojo var name: String = get_name() ``` This makes it clear that name is type String, without knowing what the get_name() function returns. The get_name() function may return a String, or a value that's implicitly convertible to a String. name String get_name() get_name() String String You must declare a variable with var to use type annotations. var If a type has a constructor with just one argument, you can initialize it in two ways: ```mojo var name1: String = "Sam"var name2 = String("Sam") ``` Both of these lines invoke the same constructor to create a String from a StringLiteral. String StringLiteral ### Late initialization​ Using type annotations allows for late initialization. For example, notice here that the z variable is first declared with just a type, and the value is assigned later: z ```mojo fn my_function(x: Int): var z: Float32 if x != 0: z = 1.0 else: z = foo() print(z)fn foo() -> Float32: return 3.14 ``` If you try to pass an uninitialized variable to a function or use it on the right-hand side of an assignment statement, compilation fails. ```mojo var z: Float32var y = z # Error: use of uninitialized value 'z' ``` Late initialization works only if the variable is declared with a type. ### Implicit type conversion​ Some types include built-in type conversion (type casting) from one type into its own type. For example, if you assign an integer to a variable that has a floating-point type, it converts the value instead of giving a compiler error: ```mojo var number: Float64 = 1 ``` As shown above, value assignment can be converted into a constructor call if the target type has a constructor that takes a single argument that matches the value being assigned. So, this code uses the Float64 constructor that takes an integer: __init__(inout self, value: Int). Float64 __init__(inout self, value: Int) In general, implicit conversions should only be supported where the conversion is lossless. Implicit conversion follows the logic of overloaded functions. If the destination type has a single-argument constructor that takes an argument of the source type, it can be invoked for implicit conversion. So assigning an integer to a Float64 variable is exactly the same as this: Float64 ```mojo var number = Float64(1) ``` Similarly, if you call a function that requires an argument of a certain type (such as Float64), you can pass in any value as long as that value type can implicitly convert to the required type (using one of the type's overloaded constructors). Float64 For example, you can pass an Int to a function that expects a Float64, because Float64 includes a constructor that takes an Int: Int Float64 Float64 Int ```mojo fn take_float(value: Float64): print(value)fn pass_integer(): var value: Int = 1 take_float(value) ``` For more details on implicit conversion, see Constructors and implicit conversion. ## Variable scopes​ Variables declared with var are bound by lexical scoping. This means that nested code blocks can read and modify variables defined in an outer scope. But an outer scope cannot read variables defined in an inner scope at all. var For example, the if code block shown here creates an inner scope where outer variables are accessible to read/write, but any new variables do not live beyond the scope of the if block: if if ```mojo def lexical_scopes(): var num = 1 var dig = 1 if num == 1: print("num:", num) # Reads the outer-scope "num" var num = 2 # Creates new inner-scope "num" print("num:", num) # Reads the inner-scope "num" dig = 2 # Updates the outer-scope "dig" print("num:", num) # Reads the outer-scope "num" print("dig:", dig) # Reads the outer-scope "dig"lexical_scopes() ``` Note that the var statement inside the if creates a new variable with the same name as the outer variable. This prevents the inner loop from accessing the outer num variable. (This is called "variable shadowing," where the inner scope variable hides or "shadows" a variable from an outer scope.) var if num The lifetime of the inner num ends exactly where the if code block ends, because that's the scope in which the variable was defined. num if This is in contrast to undeclared variables (those without the var keyword), which use function-level scoping (consistent with Python variable behavior). That means, when you change the value of an undeclared variable inside the if block, it actually changes the value for the entire function. var if For example, here's the same code but without the var declarations: var ```mojo def function_scopes(): num = 1 if num == 1: print(num) # Reads the function-scope "num" num = 2 # Updates the function-scope variable print(num) # Reads the function-scope "num" print(num) # Reads the function-scope "num"function_scopes() ``` Now, the last print() function sees the updated num value from the inner scope, because undeclared variables (Python-style variables) use function-level scope (instead of lexical scope). print() num - Undeclared variables - Declared variables - Type annotationsLate initializationImplicit type conversion - Late initialization - Implicit type conversion - Variable scopes - Late initialization - Implicit type conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#alias-named-parameter-expressions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/variables#type-annotations - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Variables # Variables A variable is a name that holds a value or object. All variables in Mojo are mutable—their value can be changed. (If you want to define a constant value that can't change at runtime, see the alias keyword.) alias Mojo has two kinds of variables: - Declared variables are created with the var keyword, and may include type annotations. var a = 5var b: Float64 = 3.14 - Undeclared variables are created with an assignment statement: a = 5b = 3.14 Declared variables are created with the var keyword, and may include type annotations. var ```mojo var a = 5var b: Float64 = 3.14 ``` Undeclared variables are created with an assignment statement: ```mojo a = 5b = 3.14 ``` Both types of variables are strongly-typed: the variable receives a type when it's created, and the type never changes. You can't assign a variable a value of a different type: ```mojo count = 8 # count is type Intcount = "Nine?" # Error: can't implicitly convert 'StringLiteral' to 'Int' ``` Some types support implicit conversions from other types. For example, an integer value can implicitly convert to a floating-point value: ```mojo var temperature: Float64 = 99print(temperature) ``` In this example, the temperature variable is explicitly typed as Float64, but assigned an integer value, so the value is implicitly converted to a Float64. temperature Float64 Float64 ## Undeclared variables​ Within a def function or a REPL environment, you can create a variable with just a name and a value. For example: def ```mojo name = str("Sam")user_id = 0 ``` Undeclared variables are strongly typed: they take the type from the first value assigned to them. For example, the user_id variable above is type Int, while the name variable is type String. You can't assign a string to user_id or an integer to name. user_id Int name String user_id name Undeclared variables are scoped at the function level. You create an undeclared variable the first time you assign a value to a given name inside a function. Any subsequent references to that name inside the function refer to the same variable. For more information, see Variable scopes, which describes how variable scoping differs between declared and undeclared variables. Undeclared variables are not allowed in an fn function or as a struct field. fn ## Declared variables​ You can declare a variable with the var keyword. For example: var ```mojo var name = str("Sam")var user_id: Int ``` The name variable is initialized to the string "Sam". The user_id variable is uninitialized, but it has a declared type, Int for an integer value. All declared values are typed—either explicitly with a type annotation or implicitly when they're initialized with a value. name user_id Int Since variables are strongly typed, you can't assign a variable a value of a different type, unless those types can be implicitly converted. For example, this code will not compile: ```mojo var user_id: Int = "Sam" ``` There are several main differences between declared variables and undeclared variables: - A declared variable can be declared without initializing it: var value: Float64 - Declared variables follow lexical scoping, unlike undeclared variables. - Declared variables can be used in both def and fn functions. A declared variable can be declared without initializing it: ```mojo var value: Float64 ``` Declared variables follow lexical scoping, unlike undeclared variables. Declared variables can be used in both def and fn functions. def fn Using var can help prevent runtime errors caused by typos. For example, if you misspell the name of an undeclared variable, Mojo simply creates a new variable using the misspelled name. But when all mutable variables must be first declared with var (which is the case inside an fn function), then misspellings such as the following are caught by the compiler: var var fn ```mojo var name = "Sam"# Somewhere later...nane = "Sammy" # This is not allowed in an `fn` function ``` Although you can use var in a def function, this benefit is realized only when used inside an fn function, where the Mojo compiler will flag undeclared variables (such as the above nane) as unknown declarations. var def fn nane When using Mojo in a REPL environment, top-level variables (variables outside a function or struct) do not require var declarations. var ## Type annotations​ Although Mojo can infer a variable type from from the first value assigned to a variable, it also supports static type annotations on variables. Type annotations provide a more explicit way of specifying the variable's type. To specify the type for a variable, add a colon followed by the type name: ```mojo var name: String = get_name() ``` This makes it clear that name is type String, without knowing what the get_name() function returns. The get_name() function may return a String, or a value that's implicitly convertible to a String. name String get_name() get_name() String String You must declare a variable with var to use type annotations. var If a type has a constructor with just one argument, you can initialize it in two ways: ```mojo var name1: String = "Sam"var name2 = String("Sam") ``` Both of these lines invoke the same constructor to create a String from a StringLiteral. String StringLiteral ### Late initialization​ Using type annotations allows for late initialization. For example, notice here that the z variable is first declared with just a type, and the value is assigned later: z ```mojo fn my_function(x: Int): var z: Float32 if x != 0: z = 1.0 else: z = foo() print(z)fn foo() -> Float32: return 3.14 ``` If you try to pass an uninitialized variable to a function or use it on the right-hand side of an assignment statement, compilation fails. ```mojo var z: Float32var y = z # Error: use of uninitialized value 'z' ``` Late initialization works only if the variable is declared with a type. ### Implicit type conversion​ Some types include built-in type conversion (type casting) from one type into its own type. For example, if you assign an integer to a variable that has a floating-point type, it converts the value instead of giving a compiler error: ```mojo var number: Float64 = 1 ``` As shown above, value assignment can be converted into a constructor call if the target type has a constructor that takes a single argument that matches the value being assigned. So, this code uses the Float64 constructor that takes an integer: __init__(inout self, value: Int). Float64 __init__(inout self, value: Int) In general, implicit conversions should only be supported where the conversion is lossless. Implicit conversion follows the logic of overloaded functions. If the destination type has a single-argument constructor that takes an argument of the source type, it can be invoked for implicit conversion. So assigning an integer to a Float64 variable is exactly the same as this: Float64 ```mojo var number = Float64(1) ``` Similarly, if you call a function that requires an argument of a certain type (such as Float64), you can pass in any value as long as that value type can implicitly convert to the required type (using one of the type's overloaded constructors). Float64 For example, you can pass an Int to a function that expects a Float64, because Float64 includes a constructor that takes an Int: Int Float64 Float64 Int ```mojo fn take_float(value: Float64): print(value)fn pass_integer(): var value: Int = 1 take_float(value) ``` For more details on implicit conversion, see Constructors and implicit conversion. ## Variable scopes​ Variables declared with var are bound by lexical scoping. This means that nested code blocks can read and modify variables defined in an outer scope. But an outer scope cannot read variables defined in an inner scope at all. var For example, the if code block shown here creates an inner scope where outer variables are accessible to read/write, but any new variables do not live beyond the scope of the if block: if if ```mojo def lexical_scopes(): var num = 1 var dig = 1 if num == 1: print("num:", num) # Reads the outer-scope "num" var num = 2 # Creates new inner-scope "num" print("num:", num) # Reads the inner-scope "num" dig = 2 # Updates the outer-scope "dig" print("num:", num) # Reads the outer-scope "num" print("dig:", dig) # Reads the outer-scope "dig"lexical_scopes() ``` Note that the var statement inside the if creates a new variable with the same name as the outer variable. This prevents the inner loop from accessing the outer num variable. (This is called "variable shadowing," where the inner scope variable hides or "shadows" a variable from an outer scope.) var if num The lifetime of the inner num ends exactly where the if code block ends, because that's the scope in which the variable was defined. num if This is in contrast to undeclared variables (those without the var keyword), which use function-level scoping (consistent with Python variable behavior). That means, when you change the value of an undeclared variable inside the if block, it actually changes the value for the entire function. var if For example, here's the same code but without the var declarations: var ```mojo def function_scopes(): num = 1 if num == 1: print(num) # Reads the function-scope "num" num = 2 # Updates the function-scope variable print(num) # Reads the function-scope "num" print(num) # Reads the function-scope "num"function_scopes() ``` Now, the last print() function sees the updated num value from the inner scope, because undeclared variables (Python-style variables) use function-level scope (instead of lexical scope). print() num - Undeclared variables - Declared variables - Type annotationsLate initializationImplicit type conversion - Late initialization - Implicit type conversion - Variable scopes - Late initialization - Implicit type conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/variables#undeclared-variables - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Variables # Variables A variable is a name that holds a value or object. All variables in Mojo are mutable—their value can be changed. (If you want to define a constant value that can't change at runtime, see the alias keyword.) alias Mojo has two kinds of variables: - Declared variables are created with the var keyword, and may include type annotations. var a = 5var b: Float64 = 3.14 - Undeclared variables are created with an assignment statement: a = 5b = 3.14 Declared variables are created with the var keyword, and may include type annotations. var ```mojo var a = 5var b: Float64 = 3.14 ``` Undeclared variables are created with an assignment statement: ```mojo a = 5b = 3.14 ``` Both types of variables are strongly-typed: the variable receives a type when it's created, and the type never changes. You can't assign a variable a value of a different type: ```mojo count = 8 # count is type Intcount = "Nine?" # Error: can't implicitly convert 'StringLiteral' to 'Int' ``` Some types support implicit conversions from other types. For example, an integer value can implicitly convert to a floating-point value: ```mojo var temperature: Float64 = 99print(temperature) ``` In this example, the temperature variable is explicitly typed as Float64, but assigned an integer value, so the value is implicitly converted to a Float64. temperature Float64 Float64 ## Undeclared variables​ Within a def function or a REPL environment, you can create a variable with just a name and a value. For example: def ```mojo name = str("Sam")user_id = 0 ``` Undeclared variables are strongly typed: they take the type from the first value assigned to them. For example, the user_id variable above is type Int, while the name variable is type String. You can't assign a string to user_id or an integer to name. user_id Int name String user_id name Undeclared variables are scoped at the function level. You create an undeclared variable the first time you assign a value to a given name inside a function. Any subsequent references to that name inside the function refer to the same variable. For more information, see Variable scopes, which describes how variable scoping differs between declared and undeclared variables. Undeclared variables are not allowed in an fn function or as a struct field. fn ## Declared variables​ You can declare a variable with the var keyword. For example: var ```mojo var name = str("Sam")var user_id: Int ``` The name variable is initialized to the string "Sam". The user_id variable is uninitialized, but it has a declared type, Int for an integer value. All declared values are typed—either explicitly with a type annotation or implicitly when they're initialized with a value. name user_id Int Since variables are strongly typed, you can't assign a variable a value of a different type, unless those types can be implicitly converted. For example, this code will not compile: ```mojo var user_id: Int = "Sam" ``` There are several main differences between declared variables and undeclared variables: - A declared variable can be declared without initializing it: var value: Float64 - Declared variables follow lexical scoping, unlike undeclared variables. - Declared variables can be used in both def and fn functions. A declared variable can be declared without initializing it: ```mojo var value: Float64 ``` Declared variables follow lexical scoping, unlike undeclared variables. Declared variables can be used in both def and fn functions. def fn Using var can help prevent runtime errors caused by typos. For example, if you misspell the name of an undeclared variable, Mojo simply creates a new variable using the misspelled name. But when all mutable variables must be first declared with var (which is the case inside an fn function), then misspellings such as the following are caught by the compiler: var var fn ```mojo var name = "Sam"# Somewhere later...nane = "Sammy" # This is not allowed in an `fn` function ``` Although you can use var in a def function, this benefit is realized only when used inside an fn function, where the Mojo compiler will flag undeclared variables (such as the above nane) as unknown declarations. var def fn nane When using Mojo in a REPL environment, top-level variables (variables outside a function or struct) do not require var declarations. var ## Type annotations​ Although Mojo can infer a variable type from from the first value assigned to a variable, it also supports static type annotations on variables. Type annotations provide a more explicit way of specifying the variable's type. To specify the type for a variable, add a colon followed by the type name: ```mojo var name: String = get_name() ``` This makes it clear that name is type String, without knowing what the get_name() function returns. The get_name() function may return a String, or a value that's implicitly convertible to a String. name String get_name() get_name() String String You must declare a variable with var to use type annotations. var If a type has a constructor with just one argument, you can initialize it in two ways: ```mojo var name1: String = "Sam"var name2 = String("Sam") ``` Both of these lines invoke the same constructor to create a String from a StringLiteral. String StringLiteral ### Late initialization​ Using type annotations allows for late initialization. For example, notice here that the z variable is first declared with just a type, and the value is assigned later: z ```mojo fn my_function(x: Int): var z: Float32 if x != 0: z = 1.0 else: z = foo() print(z)fn foo() -> Float32: return 3.14 ``` If you try to pass an uninitialized variable to a function or use it on the right-hand side of an assignment statement, compilation fails. ```mojo var z: Float32var y = z # Error: use of uninitialized value 'z' ``` Late initialization works only if the variable is declared with a type. ### Implicit type conversion​ Some types include built-in type conversion (type casting) from one type into its own type. For example, if you assign an integer to a variable that has a floating-point type, it converts the value instead of giving a compiler error: ```mojo var number: Float64 = 1 ``` As shown above, value assignment can be converted into a constructor call if the target type has a constructor that takes a single argument that matches the value being assigned. So, this code uses the Float64 constructor that takes an integer: __init__(inout self, value: Int). Float64 __init__(inout self, value: Int) In general, implicit conversions should only be supported where the conversion is lossless. Implicit conversion follows the logic of overloaded functions. If the destination type has a single-argument constructor that takes an argument of the source type, it can be invoked for implicit conversion. So assigning an integer to a Float64 variable is exactly the same as this: Float64 ```mojo var number = Float64(1) ``` Similarly, if you call a function that requires an argument of a certain type (such as Float64), you can pass in any value as long as that value type can implicitly convert to the required type (using one of the type's overloaded constructors). Float64 For example, you can pass an Int to a function that expects a Float64, because Float64 includes a constructor that takes an Int: Int Float64 Float64 Int ```mojo fn take_float(value: Float64): print(value)fn pass_integer(): var value: Int = 1 take_float(value) ``` For more details on implicit conversion, see Constructors and implicit conversion. ## Variable scopes​ Variables declared with var are bound by lexical scoping. This means that nested code blocks can read and modify variables defined in an outer scope. But an outer scope cannot read variables defined in an inner scope at all. var For example, the if code block shown here creates an inner scope where outer variables are accessible to read/write, but any new variables do not live beyond the scope of the if block: if if ```mojo def lexical_scopes(): var num = 1 var dig = 1 if num == 1: print("num:", num) # Reads the outer-scope "num" var num = 2 # Creates new inner-scope "num" print("num:", num) # Reads the inner-scope "num" dig = 2 # Updates the outer-scope "dig" print("num:", num) # Reads the outer-scope "num" print("dig:", dig) # Reads the outer-scope "dig"lexical_scopes() ``` Note that the var statement inside the if creates a new variable with the same name as the outer variable. This prevents the inner loop from accessing the outer num variable. (This is called "variable shadowing," where the inner scope variable hides or "shadows" a variable from an outer scope.) var if num The lifetime of the inner num ends exactly where the if code block ends, because that's the scope in which the variable was defined. num if This is in contrast to undeclared variables (those without the var keyword), which use function-level scoping (consistent with Python variable behavior). That means, when you change the value of an undeclared variable inside the if block, it actually changes the value for the entire function. var if For example, here's the same code but without the var declarations: var ```mojo def function_scopes(): num = 1 if num == 1: print(num) # Reads the function-scope "num" num = 2 # Updates the function-scope variable print(num) # Reads the function-scope "num" print(num) # Reads the function-scope "num"function_scopes() ``` Now, the last print() function sees the updated num value from the inner scope, because undeclared variables (Python-style variables) use function-level scope (instead of lexical scope). print() num - Undeclared variables - Declared variables - Type annotationsLate initializationImplicit type conversion - Late initialization - Implicit type conversion - Variable scopes - Late initialization - Implicit type conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/variables#variable-scopes - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Variables # Variables A variable is a name that holds a value or object. All variables in Mojo are mutable—their value can be changed. (If you want to define a constant value that can't change at runtime, see the alias keyword.) alias Mojo has two kinds of variables: - Declared variables are created with the var keyword, and may include type annotations. var a = 5var b: Float64 = 3.14 - Undeclared variables are created with an assignment statement: a = 5b = 3.14 Declared variables are created with the var keyword, and may include type annotations. var ```mojo var a = 5var b: Float64 = 3.14 ``` Undeclared variables are created with an assignment statement: ```mojo a = 5b = 3.14 ``` Both types of variables are strongly-typed: the variable receives a type when it's created, and the type never changes. You can't assign a variable a value of a different type: ```mojo count = 8 # count is type Intcount = "Nine?" # Error: can't implicitly convert 'StringLiteral' to 'Int' ``` Some types support implicit conversions from other types. For example, an integer value can implicitly convert to a floating-point value: ```mojo var temperature: Float64 = 99print(temperature) ``` In this example, the temperature variable is explicitly typed as Float64, but assigned an integer value, so the value is implicitly converted to a Float64. temperature Float64 Float64 ## Undeclared variables​ Within a def function or a REPL environment, you can create a variable with just a name and a value. For example: def ```mojo name = str("Sam")user_id = 0 ``` Undeclared variables are strongly typed: they take the type from the first value assigned to them. For example, the user_id variable above is type Int, while the name variable is type String. You can't assign a string to user_id or an integer to name. user_id Int name String user_id name Undeclared variables are scoped at the function level. You create an undeclared variable the first time you assign a value to a given name inside a function. Any subsequent references to that name inside the function refer to the same variable. For more information, see Variable scopes, which describes how variable scoping differs between declared and undeclared variables. Undeclared variables are not allowed in an fn function or as a struct field. fn ## Declared variables​ You can declare a variable with the var keyword. For example: var ```mojo var name = str("Sam")var user_id: Int ``` The name variable is initialized to the string "Sam". The user_id variable is uninitialized, but it has a declared type, Int for an integer value. All declared values are typed—either explicitly with a type annotation or implicitly when they're initialized with a value. name user_id Int Since variables are strongly typed, you can't assign a variable a value of a different type, unless those types can be implicitly converted. For example, this code will not compile: ```mojo var user_id: Int = "Sam" ``` There are several main differences between declared variables and undeclared variables: - A declared variable can be declared without initializing it: var value: Float64 - Declared variables follow lexical scoping, unlike undeclared variables. - Declared variables can be used in both def and fn functions. A declared variable can be declared without initializing it: ```mojo var value: Float64 ``` Declared variables follow lexical scoping, unlike undeclared variables. Declared variables can be used in both def and fn functions. def fn Using var can help prevent runtime errors caused by typos. For example, if you misspell the name of an undeclared variable, Mojo simply creates a new variable using the misspelled name. But when all mutable variables must be first declared with var (which is the case inside an fn function), then misspellings such as the following are caught by the compiler: var var fn ```mojo var name = "Sam"# Somewhere later...nane = "Sammy" # This is not allowed in an `fn` function ``` Although you can use var in a def function, this benefit is realized only when used inside an fn function, where the Mojo compiler will flag undeclared variables (such as the above nane) as unknown declarations. var def fn nane When using Mojo in a REPL environment, top-level variables (variables outside a function or struct) do not require var declarations. var ## Type annotations​ Although Mojo can infer a variable type from from the first value assigned to a variable, it also supports static type annotations on variables. Type annotations provide a more explicit way of specifying the variable's type. To specify the type for a variable, add a colon followed by the type name: ```mojo var name: String = get_name() ``` This makes it clear that name is type String, without knowing what the get_name() function returns. The get_name() function may return a String, or a value that's implicitly convertible to a String. name String get_name() get_name() String String You must declare a variable with var to use type annotations. var If a type has a constructor with just one argument, you can initialize it in two ways: ```mojo var name1: String = "Sam"var name2 = String("Sam") ``` Both of these lines invoke the same constructor to create a String from a StringLiteral. String StringLiteral ### Late initialization​ Using type annotations allows for late initialization. For example, notice here that the z variable is first declared with just a type, and the value is assigned later: z ```mojo fn my_function(x: Int): var z: Float32 if x != 0: z = 1.0 else: z = foo() print(z)fn foo() -> Float32: return 3.14 ``` If you try to pass an uninitialized variable to a function or use it on the right-hand side of an assignment statement, compilation fails. ```mojo var z: Float32var y = z # Error: use of uninitialized value 'z' ``` Late initialization works only if the variable is declared with a type. ### Implicit type conversion​ Some types include built-in type conversion (type casting) from one type into its own type. For example, if you assign an integer to a variable that has a floating-point type, it converts the value instead of giving a compiler error: ```mojo var number: Float64 = 1 ``` As shown above, value assignment can be converted into a constructor call if the target type has a constructor that takes a single argument that matches the value being assigned. So, this code uses the Float64 constructor that takes an integer: __init__(inout self, value: Int). Float64 __init__(inout self, value: Int) In general, implicit conversions should only be supported where the conversion is lossless. Implicit conversion follows the logic of overloaded functions. If the destination type has a single-argument constructor that takes an argument of the source type, it can be invoked for implicit conversion. So assigning an integer to a Float64 variable is exactly the same as this: Float64 ```mojo var number = Float64(1) ``` Similarly, if you call a function that requires an argument of a certain type (such as Float64), you can pass in any value as long as that value type can implicitly convert to the required type (using one of the type's overloaded constructors). Float64 For example, you can pass an Int to a function that expects a Float64, because Float64 includes a constructor that takes an Int: Int Float64 Float64 Int ```mojo fn take_float(value: Float64): print(value)fn pass_integer(): var value: Int = 1 take_float(value) ``` For more details on implicit conversion, see Constructors and implicit conversion. ## Variable scopes​ Variables declared with var are bound by lexical scoping. This means that nested code blocks can read and modify variables defined in an outer scope. But an outer scope cannot read variables defined in an inner scope at all. var For example, the if code block shown here creates an inner scope where outer variables are accessible to read/write, but any new variables do not live beyond the scope of the if block: if if ```mojo def lexical_scopes(): var num = 1 var dig = 1 if num == 1: print("num:", num) # Reads the outer-scope "num" var num = 2 # Creates new inner-scope "num" print("num:", num) # Reads the inner-scope "num" dig = 2 # Updates the outer-scope "dig" print("num:", num) # Reads the outer-scope "num" print("dig:", dig) # Reads the outer-scope "dig"lexical_scopes() ``` Note that the var statement inside the if creates a new variable with the same name as the outer variable. This prevents the inner loop from accessing the outer num variable. (This is called "variable shadowing," where the inner scope variable hides or "shadows" a variable from an outer scope.) var if num The lifetime of the inner num ends exactly where the if code block ends, because that's the scope in which the variable was defined. num if This is in contrast to undeclared variables (those without the var keyword), which use function-level scoping (consistent with Python variable behavior). That means, when you change the value of an undeclared variable inside the if block, it actually changes the value for the entire function. var if For example, here's the same code but without the var declarations: var ```mojo def function_scopes(): num = 1 if num == 1: print(num) # Reads the function-scope "num" num = 2 # Updates the function-scope variable print(num) # Reads the function-scope "num" print(num) # Reads the function-scope "num"function_scopes() ``` Now, the last print() function sees the updated num value from the inner scope, because undeclared variables (Python-style variables) use function-level scope (instead of lexical scope). print() num - Undeclared variables - Declared variables - Type annotationsLate initializationImplicit type conversion - Late initialization - Implicit type conversion - Variable scopes - Late initialization - Implicit type conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/variables#declared-variables - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Variables # Variables A variable is a name that holds a value or object. All variables in Mojo are mutable—their value can be changed. (If you want to define a constant value that can't change at runtime, see the alias keyword.) alias Mojo has two kinds of variables: - Declared variables are created with the var keyword, and may include type annotations. var a = 5var b: Float64 = 3.14 - Undeclared variables are created with an assignment statement: a = 5b = 3.14 Declared variables are created with the var keyword, and may include type annotations. var ```mojo var a = 5var b: Float64 = 3.14 ``` Undeclared variables are created with an assignment statement: ```mojo a = 5b = 3.14 ``` Both types of variables are strongly-typed: the variable receives a type when it's created, and the type never changes. You can't assign a variable a value of a different type: ```mojo count = 8 # count is type Intcount = "Nine?" # Error: can't implicitly convert 'StringLiteral' to 'Int' ``` Some types support implicit conversions from other types. For example, an integer value can implicitly convert to a floating-point value: ```mojo var temperature: Float64 = 99print(temperature) ``` In this example, the temperature variable is explicitly typed as Float64, but assigned an integer value, so the value is implicitly converted to a Float64. temperature Float64 Float64 ## Undeclared variables​ Within a def function or a REPL environment, you can create a variable with just a name and a value. For example: def ```mojo name = str("Sam")user_id = 0 ``` Undeclared variables are strongly typed: they take the type from the first value assigned to them. For example, the user_id variable above is type Int, while the name variable is type String. You can't assign a string to user_id or an integer to name. user_id Int name String user_id name Undeclared variables are scoped at the function level. You create an undeclared variable the first time you assign a value to a given name inside a function. Any subsequent references to that name inside the function refer to the same variable. For more information, see Variable scopes, which describes how variable scoping differs between declared and undeclared variables. Undeclared variables are not allowed in an fn function or as a struct field. fn ## Declared variables​ You can declare a variable with the var keyword. For example: var ```mojo var name = str("Sam")var user_id: Int ``` The name variable is initialized to the string "Sam". The user_id variable is uninitialized, but it has a declared type, Int for an integer value. All declared values are typed—either explicitly with a type annotation or implicitly when they're initialized with a value. name user_id Int Since variables are strongly typed, you can't assign a variable a value of a different type, unless those types can be implicitly converted. For example, this code will not compile: ```mojo var user_id: Int = "Sam" ``` There are several main differences between declared variables and undeclared variables: - A declared variable can be declared without initializing it: var value: Float64 - Declared variables follow lexical scoping, unlike undeclared variables. - Declared variables can be used in both def and fn functions. A declared variable can be declared without initializing it: ```mojo var value: Float64 ``` Declared variables follow lexical scoping, unlike undeclared variables. Declared variables can be used in both def and fn functions. def fn Using var can help prevent runtime errors caused by typos. For example, if you misspell the name of an undeclared variable, Mojo simply creates a new variable using the misspelled name. But when all mutable variables must be first declared with var (which is the case inside an fn function), then misspellings such as the following are caught by the compiler: var var fn ```mojo var name = "Sam"# Somewhere later...nane = "Sammy" # This is not allowed in an `fn` function ``` Although you can use var in a def function, this benefit is realized only when used inside an fn function, where the Mojo compiler will flag undeclared variables (such as the above nane) as unknown declarations. var def fn nane When using Mojo in a REPL environment, top-level variables (variables outside a function or struct) do not require var declarations. var ## Type annotations​ Although Mojo can infer a variable type from from the first value assigned to a variable, it also supports static type annotations on variables. Type annotations provide a more explicit way of specifying the variable's type. To specify the type for a variable, add a colon followed by the type name: ```mojo var name: String = get_name() ``` This makes it clear that name is type String, without knowing what the get_name() function returns. The get_name() function may return a String, or a value that's implicitly convertible to a String. name String get_name() get_name() String String You must declare a variable with var to use type annotations. var If a type has a constructor with just one argument, you can initialize it in two ways: ```mojo var name1: String = "Sam"var name2 = String("Sam") ``` Both of these lines invoke the same constructor to create a String from a StringLiteral. String StringLiteral ### Late initialization​ Using type annotations allows for late initialization. For example, notice here that the z variable is first declared with just a type, and the value is assigned later: z ```mojo fn my_function(x: Int): var z: Float32 if x != 0: z = 1.0 else: z = foo() print(z)fn foo() -> Float32: return 3.14 ``` If you try to pass an uninitialized variable to a function or use it on the right-hand side of an assignment statement, compilation fails. ```mojo var z: Float32var y = z # Error: use of uninitialized value 'z' ``` Late initialization works only if the variable is declared with a type. ### Implicit type conversion​ Some types include built-in type conversion (type casting) from one type into its own type. For example, if you assign an integer to a variable that has a floating-point type, it converts the value instead of giving a compiler error: ```mojo var number: Float64 = 1 ``` As shown above, value assignment can be converted into a constructor call if the target type has a constructor that takes a single argument that matches the value being assigned. So, this code uses the Float64 constructor that takes an integer: __init__(inout self, value: Int). Float64 __init__(inout self, value: Int) In general, implicit conversions should only be supported where the conversion is lossless. Implicit conversion follows the logic of overloaded functions. If the destination type has a single-argument constructor that takes an argument of the source type, it can be invoked for implicit conversion. So assigning an integer to a Float64 variable is exactly the same as this: Float64 ```mojo var number = Float64(1) ``` Similarly, if you call a function that requires an argument of a certain type (such as Float64), you can pass in any value as long as that value type can implicitly convert to the required type (using one of the type's overloaded constructors). Float64 For example, you can pass an Int to a function that expects a Float64, because Float64 includes a constructor that takes an Int: Int Float64 Float64 Int ```mojo fn take_float(value: Float64): print(value)fn pass_integer(): var value: Int = 1 take_float(value) ``` For more details on implicit conversion, see Constructors and implicit conversion. ## Variable scopes​ Variables declared with var are bound by lexical scoping. This means that nested code blocks can read and modify variables defined in an outer scope. But an outer scope cannot read variables defined in an inner scope at all. var For example, the if code block shown here creates an inner scope where outer variables are accessible to read/write, but any new variables do not live beyond the scope of the if block: if if ```mojo def lexical_scopes(): var num = 1 var dig = 1 if num == 1: print("num:", num) # Reads the outer-scope "num" var num = 2 # Creates new inner-scope "num" print("num:", num) # Reads the inner-scope "num" dig = 2 # Updates the outer-scope "dig" print("num:", num) # Reads the outer-scope "num" print("dig:", dig) # Reads the outer-scope "dig"lexical_scopes() ``` Note that the var statement inside the if creates a new variable with the same name as the outer variable. This prevents the inner loop from accessing the outer num variable. (This is called "variable shadowing," where the inner scope variable hides or "shadows" a variable from an outer scope.) var if num The lifetime of the inner num ends exactly where the if code block ends, because that's the scope in which the variable was defined. num if This is in contrast to undeclared variables (those without the var keyword), which use function-level scoping (consistent with Python variable behavior). That means, when you change the value of an undeclared variable inside the if block, it actually changes the value for the entire function. var if For example, here's the same code but without the var declarations: var ```mojo def function_scopes(): num = 1 if num == 1: print(num) # Reads the function-scope "num" num = 2 # Updates the function-scope variable print(num) # Reads the function-scope "num" print(num) # Reads the function-scope "num"function_scopes() ``` Now, the last print() function sees the updated num value from the inner scope, because undeclared variables (Python-style variables) use function-level scope (instead of lexical scope). print() num - Undeclared variables - Declared variables - Type annotationsLate initializationImplicit type conversion - Late initialization - Implicit type conversion - Variable scopes - Late initialization - Implicit type conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/variables#late-initialization - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Variables # Variables A variable is a name that holds a value or object. All variables in Mojo are mutable—their value can be changed. (If you want to define a constant value that can't change at runtime, see the alias keyword.) alias Mojo has two kinds of variables: - Declared variables are created with the var keyword, and may include type annotations. var a = 5var b: Float64 = 3.14 - Undeclared variables are created with an assignment statement: a = 5b = 3.14 Declared variables are created with the var keyword, and may include type annotations. var ```mojo var a = 5var b: Float64 = 3.14 ``` Undeclared variables are created with an assignment statement: ```mojo a = 5b = 3.14 ``` Both types of variables are strongly-typed: the variable receives a type when it's created, and the type never changes. You can't assign a variable a value of a different type: ```mojo count = 8 # count is type Intcount = "Nine?" # Error: can't implicitly convert 'StringLiteral' to 'Int' ``` Some types support implicit conversions from other types. For example, an integer value can implicitly convert to a floating-point value: ```mojo var temperature: Float64 = 99print(temperature) ``` In this example, the temperature variable is explicitly typed as Float64, but assigned an integer value, so the value is implicitly converted to a Float64. temperature Float64 Float64 ## Undeclared variables​ Within a def function or a REPL environment, you can create a variable with just a name and a value. For example: def ```mojo name = str("Sam")user_id = 0 ``` Undeclared variables are strongly typed: they take the type from the first value assigned to them. For example, the user_id variable above is type Int, while the name variable is type String. You can't assign a string to user_id or an integer to name. user_id Int name String user_id name Undeclared variables are scoped at the function level. You create an undeclared variable the first time you assign a value to a given name inside a function. Any subsequent references to that name inside the function refer to the same variable. For more information, see Variable scopes, which describes how variable scoping differs between declared and undeclared variables. Undeclared variables are not allowed in an fn function or as a struct field. fn ## Declared variables​ You can declare a variable with the var keyword. For example: var ```mojo var name = str("Sam")var user_id: Int ``` The name variable is initialized to the string "Sam". The user_id variable is uninitialized, but it has a declared type, Int for an integer value. All declared values are typed—either explicitly with a type annotation or implicitly when they're initialized with a value. name user_id Int Since variables are strongly typed, you can't assign a variable a value of a different type, unless those types can be implicitly converted. For example, this code will not compile: ```mojo var user_id: Int = "Sam" ``` There are several main differences between declared variables and undeclared variables: - A declared variable can be declared without initializing it: var value: Float64 - Declared variables follow lexical scoping, unlike undeclared variables. - Declared variables can be used in both def and fn functions. A declared variable can be declared without initializing it: ```mojo var value: Float64 ``` Declared variables follow lexical scoping, unlike undeclared variables. Declared variables can be used in both def and fn functions. def fn Using var can help prevent runtime errors caused by typos. For example, if you misspell the name of an undeclared variable, Mojo simply creates a new variable using the misspelled name. But when all mutable variables must be first declared with var (which is the case inside an fn function), then misspellings such as the following are caught by the compiler: var var fn ```mojo var name = "Sam"# Somewhere later...nane = "Sammy" # This is not allowed in an `fn` function ``` Although you can use var in a def function, this benefit is realized only when used inside an fn function, where the Mojo compiler will flag undeclared variables (such as the above nane) as unknown declarations. var def fn nane When using Mojo in a REPL environment, top-level variables (variables outside a function or struct) do not require var declarations. var ## Type annotations​ Although Mojo can infer a variable type from from the first value assigned to a variable, it also supports static type annotations on variables. Type annotations provide a more explicit way of specifying the variable's type. To specify the type for a variable, add a colon followed by the type name: ```mojo var name: String = get_name() ``` This makes it clear that name is type String, without knowing what the get_name() function returns. The get_name() function may return a String, or a value that's implicitly convertible to a String. name String get_name() get_name() String String You must declare a variable with var to use type annotations. var If a type has a constructor with just one argument, you can initialize it in two ways: ```mojo var name1: String = "Sam"var name2 = String("Sam") ``` Both of these lines invoke the same constructor to create a String from a StringLiteral. String StringLiteral ### Late initialization​ Using type annotations allows for late initialization. For example, notice here that the z variable is first declared with just a type, and the value is assigned later: z ```mojo fn my_function(x: Int): var z: Float32 if x != 0: z = 1.0 else: z = foo() print(z)fn foo() -> Float32: return 3.14 ``` If you try to pass an uninitialized variable to a function or use it on the right-hand side of an assignment statement, compilation fails. ```mojo var z: Float32var y = z # Error: use of uninitialized value 'z' ``` Late initialization works only if the variable is declared with a type. ### Implicit type conversion​ Some types include built-in type conversion (type casting) from one type into its own type. For example, if you assign an integer to a variable that has a floating-point type, it converts the value instead of giving a compiler error: ```mojo var number: Float64 = 1 ``` As shown above, value assignment can be converted into a constructor call if the target type has a constructor that takes a single argument that matches the value being assigned. So, this code uses the Float64 constructor that takes an integer: __init__(inout self, value: Int). Float64 __init__(inout self, value: Int) In general, implicit conversions should only be supported where the conversion is lossless. Implicit conversion follows the logic of overloaded functions. If the destination type has a single-argument constructor that takes an argument of the source type, it can be invoked for implicit conversion. So assigning an integer to a Float64 variable is exactly the same as this: Float64 ```mojo var number = Float64(1) ``` Similarly, if you call a function that requires an argument of a certain type (such as Float64), you can pass in any value as long as that value type can implicitly convert to the required type (using one of the type's overloaded constructors). Float64 For example, you can pass an Int to a function that expects a Float64, because Float64 includes a constructor that takes an Int: Int Float64 Float64 Int ```mojo fn take_float(value: Float64): print(value)fn pass_integer(): var value: Int = 1 take_float(value) ``` For more details on implicit conversion, see Constructors and implicit conversion. ## Variable scopes​ Variables declared with var are bound by lexical scoping. This means that nested code blocks can read and modify variables defined in an outer scope. But an outer scope cannot read variables defined in an inner scope at all. var For example, the if code block shown here creates an inner scope where outer variables are accessible to read/write, but any new variables do not live beyond the scope of the if block: if if ```mojo def lexical_scopes(): var num = 1 var dig = 1 if num == 1: print("num:", num) # Reads the outer-scope "num" var num = 2 # Creates new inner-scope "num" print("num:", num) # Reads the inner-scope "num" dig = 2 # Updates the outer-scope "dig" print("num:", num) # Reads the outer-scope "num" print("dig:", dig) # Reads the outer-scope "dig"lexical_scopes() ``` Note that the var statement inside the if creates a new variable with the same name as the outer variable. This prevents the inner loop from accessing the outer num variable. (This is called "variable shadowing," where the inner scope variable hides or "shadows" a variable from an outer scope.) var if num The lifetime of the inner num ends exactly where the if code block ends, because that's the scope in which the variable was defined. num if This is in contrast to undeclared variables (those without the var keyword), which use function-level scoping (consistent with Python variable behavior). That means, when you change the value of an undeclared variable inside the if block, it actually changes the value for the entire function. var if For example, here's the same code but without the var declarations: var ```mojo def function_scopes(): num = 1 if num == 1: print(num) # Reads the function-scope "num" num = 2 # Updates the function-scope variable print(num) # Reads the function-scope "num" print(num) # Reads the function-scope "num"function_scopes() ``` Now, the last print() function sees the updated num value from the inner scope, because undeclared variables (Python-style variables) use function-level scope (instead of lexical scope). print() num - Undeclared variables - Declared variables - Type annotationsLate initializationImplicit type conversion - Late initialization - Implicit type conversion - Variable scopes - Late initialization - Implicit type conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life/#constructors-and-implicit-conversion - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#numeric-types - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#floating-point-numbers - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#numeric-literals - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#simd-and-dtype - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#scalar-values - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#table-1 - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#the-dtype-type - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#strings - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#string-literals - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#booleans - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#collection-types - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#list - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#dict - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#set - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#optional - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#register-passable-memory-only-and-trivial-types - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/register-passable - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@register_passable # @register_passable You can add the @register_passable decorator on a struct to tell Mojo that the type should be passed in machine registers (such as a CPU register; subject to the details of the underlying architecture). For tiny data types like an integer or floating-point number, this is much more efficient than storing values in stack memory. This means the type is always passed by value and cannot be passed by reference. @register_passable The basic @register_passable decorator does not change the fundamental behavior of a type: it still needs an __init__() and __copyinit__() method to be copyable (and it may have a __del__() method, if necessary). For example: @register_passable __init__() __copyinit__() __del__() ```mojo @register_passablestruct Pair: var a: Int var b: Int fn __init__(inout self, one: Int, two: Int): self.a = one self.b = two fn __copyinit__(inout self, existing: Self): self.a = existing.a self.b = existing.bfn test_pair(): var x = Pair(5, 10) var y = x print(y.a, y.b) y.a = 10 y.b = 20 print(y.a, y.b) ``` ```mojo test_pair() ``` This behavior is what we expect from Pair, with or without the decorator. Pair You should be aware of a few other observable effects: - @register_passable types cannot hold instances of types that are not also @register_passable. - @register_passable types do not have a predictable identity, and so the self pointer is not stable/predictable (e.g. in hash tables). - @register_passable arguments and result are exposed to C and C++ directly, instead of being passed by-pointer. - @register_passable types cannot have a __moveinit__() constructor, because values passed in a register cannot be passed by reference. @register_passable types cannot hold instances of types that are not also @register_passable. @register_passable @register_passable @register_passable types do not have a predictable identity, and so the self pointer is not stable/predictable (e.g. in hash tables). @register_passable self @register_passable arguments and result are exposed to C and C++ directly, instead of being passed by-pointer. @register_passable @register_passable types cannot have a __moveinit__() constructor, because values passed in a register cannot be passed by reference. @register_passable __moveinit__() ## @register_passable("trivial")​ @register_passable("trivial") Most types that use @register_passable are just "bags of bits," which we call "trivial" types. These trivial types are simple and should be copied, moved, and destroyed without any custom constructors or a destructor. For these types, you can add the "trivial" argument, and Mojo synthesizes all the lifecycle methods as appropriate for a trivial register-passable type: @register_passable "trivial" ```mojo @register_passable("trivial")struct Pair: var a: Int var b: Int ``` This is similar to the @value decorator, except when using @register_passable("trivial") the only lifecycle method you're allowed to define is the __init__() constructor (but you don't have to)—you cannot define any copy or move constructors or a destructor. @value @register_passable("trivial") __init__() Examples of trivial types include: - Arithmetic types such as Int, Bool, Float64 etc. - Pointers (the address value is trivial, not the data being pointed to). - Arrays of other trivial types, including SIMD. Int Bool Float64 For more information about lifecycle methods (constructors and destructors) see the section about Value lifecycle. This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general decorator, which is orthogonal to @register_passable. @register_passable - @register_passable("trivial") @register_passable("trivial") - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/register-passable#register_passabletrivial - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@register_passable # @register_passable You can add the @register_passable decorator on a struct to tell Mojo that the type should be passed in machine registers (such as a CPU register; subject to the details of the underlying architecture). For tiny data types like an integer or floating-point number, this is much more efficient than storing values in stack memory. This means the type is always passed by value and cannot be passed by reference. @register_passable The basic @register_passable decorator does not change the fundamental behavior of a type: it still needs an __init__() and __copyinit__() method to be copyable (and it may have a __del__() method, if necessary). For example: @register_passable __init__() __copyinit__() __del__() ```mojo @register_passablestruct Pair: var a: Int var b: Int fn __init__(inout self, one: Int, two: Int): self.a = one self.b = two fn __copyinit__(inout self, existing: Self): self.a = existing.a self.b = existing.bfn test_pair(): var x = Pair(5, 10) var y = x print(y.a, y.b) y.a = 10 y.b = 20 print(y.a, y.b) ``` ```mojo test_pair() ``` This behavior is what we expect from Pair, with or without the decorator. Pair You should be aware of a few other observable effects: - @register_passable types cannot hold instances of types that are not also @register_passable. - @register_passable types do not have a predictable identity, and so the self pointer is not stable/predictable (e.g. in hash tables). - @register_passable arguments and result are exposed to C and C++ directly, instead of being passed by-pointer. - @register_passable types cannot have a __moveinit__() constructor, because values passed in a register cannot be passed by reference. @register_passable types cannot hold instances of types that are not also @register_passable. @register_passable @register_passable @register_passable types do not have a predictable identity, and so the self pointer is not stable/predictable (e.g. in hash tables). @register_passable self @register_passable arguments and result are exposed to C and C++ directly, instead of being passed by-pointer. @register_passable @register_passable types cannot have a __moveinit__() constructor, because values passed in a register cannot be passed by reference. @register_passable __moveinit__() ## @register_passable("trivial")​ @register_passable("trivial") Most types that use @register_passable are just "bags of bits," which we call "trivial" types. These trivial types are simple and should be copied, moved, and destroyed without any custom constructors or a destructor. For these types, you can add the "trivial" argument, and Mojo synthesizes all the lifecycle methods as appropriate for a trivial register-passable type: @register_passable "trivial" ```mojo @register_passable("trivial")struct Pair: var a: Int var b: Int ``` This is similar to the @value decorator, except when using @register_passable("trivial") the only lifecycle method you're allowed to define is the __init__() constructor (but you don't have to)—you cannot define any copy or move constructors or a destructor. @value @register_passable("trivial") __init__() Examples of trivial types include: - Arithmetic types such as Int, Bool, Float64 etc. - Pointers (the address value is trivial, not the data being pointed to). - Arrays of other trivial types, including SIMD. Int Bool Float64 For more information about lifecycle methods (constructors and destructors) see the section about Value lifecycle. This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general decorator, which is orthogonal to @register_passable. @register_passable - @register_passable("trivial") @register_passable("trivial") - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/types#anytype-and-anytrivialregtype - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Types # Types All values in Mojo have an associated data type. Most of the types are nominal types, defined by a struct. These types are nominal (or "named") because type equality is determined by the type's name, not its structure. struct There are a some types that aren't defined as structs: - Functions are typed based on their signatures. - NoneType is a type with one instance, the None object, which is used to signal "no value." NoneType None Mojo comes with a standard library that provides a number of useful types and utility functions. These standard types aren’t privileged. Each of the standard library types is defined just like user-defined types—even basic types like Int and String. But these standard library types are the building blocks you'll use for most Mojo programs. Int String The most common types are built-in types, which are always available and don't need to be imported. These include types for numeric values, strings, boolean values, and others. The standard library also includes many more types that you can import as needed, including collection types, utilities for interacting with the filesystem and getting system information, and so on. ## Numeric types​ Mojo's most basic numeric type is Int, which represents a signed integer of the largest size supported by the system—typically 64 bits or 32 bits. Int Mojo also has built-in types for integer and floating-point values of various precisions: Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Float16 Float32 Float64 The types in Table 1 are actually all aliases to a single type, SIMD, which is discussed later. SIMD All of the numeric types support the usual numeric and bitwise operators. The math module provides a number of additional math functions. math You may wonder when to use Int and when to use the other integer types. In general, Int is good safe default when you need an integer type and you don't require a specific bit width. Using Int as the default integer type for APIs makes APIs more consistent and predictable. Int Int Int ### Floating-point numbers​ Floating-point types represent real numbers. Because not all real numbers can be expressed in a finite number of bits, floating-point numbers can't represent every value exactly. The floating-point types listed in Table 1—Float64, Float32, and Float16—follow the IEEE 754-2008 standard for representing floating-point values. Each type includes a sign bit, one set of bits representing an exponent, and another set representing the fraction or mantissa. Table 2 shows how each of these types are represented in memory. Float64 Float32 Float16 Float64 Float32 Float16 Numbers with exponent values of all ones or all zeros represent special values, allowing floating-point numbers to represent infinity, negative infinity, signed zeros, and not-a-number (NaN). For more details on how numbers are represented, see IEEE 754 on Wikipedia. A few things to note with floating-point values: - Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. - Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Rounding errors. Rounding may produce unexpected results. For example, 1/3 can't be represented exactly in these floating-point formats. The more operations you perform with floating-point numbers, the more the rounding errors accumulate. Space between consecutive numbers. The space between consecutive numbers is variable across the range of a floating-point number format. For numbers close to zero, the distance between consecutive numbers is very small. For large positive and negative numbers, the space between consecutive numbers is greater than 1, so it may not be possible to represent consecutive integers. Because the values are approximate, it is rarely useful to compare them with the equality operator (==). Consider the following example: == ```mojo var big_num = 1.0e16var bigger_num = big_num+1.0print(big_num == bigger_num) ``` Comparison operators (< >= and so on) work with floating point numbers. You can also use the math.isclose() function to compare whether two floating-point numbers are equal within a specified tolerance. < >= math.isclose() ### Numeric literals​ In addition to these numeric types, the standard libraries provides integer and floating-point literal types, IntLiteral and FloatLiteral. IntLiteral FloatLiteral These literal types are used at compile time to represent literal numbers that appear in the code. In general, you should never instantiate these types yourself. Table 3 summarizes the literal formats you can use to represent numbers. 1760 0xaa 0xFF 0o77 0b0111 3.14 1.2e9 At compile time, the literal types are arbitrary-precision (also called infinite-precision) values, so the compiler can perform compile-time calculations without overflow or rounding errors. At runtime the values are converted to finite-precision types—Int for integer values, and Float64 for floating-point values. (This process of converting a value that can only exist at compile time into a runtime value is called materialization.) Int Float64 The following code sample shows the difference between an arbitrary-precision calculation and the same calculation done using Float64 values at runtime, which suffers from rounding errors. Float64 ```mojo var arbitrary_precision = 3.0 * (4.0 / 3.0 - 1.0)# use a variable to force the following calculation to occur at runtimevar three = 3.0var finite_precision = three * (4.0 / three - 1.0)print(arbitrary_precision, finite_precision) ``` ### SIMD and DType​ SIMD DType To support high-performance numeric processing, Mojo uses the SIMD type as the basis for its numeric types. SIMD (single instruction, multiple data) is a processor technology that allows you to perform an operation on an entire set of operands at once. Mojo's SIMD type abstracts SIMD operations. A SIMD value represents a SIMD vector—that is, a fixed-size array of values that can fit into a processor's register. SIMD vectors are defined by two parameters: SIMD SIMD SIMD - A DType value, defining the data type in the vector (for example, 32-bit floating-point numbers). - The number of elements in the vector, which must be a power of two. DType For example, you can define a vector of four Float32 values like this: Float32 ```mojo var vec = SIMD[DType.float32, 4](3.0, 2.0, 2.0, 1.0) ``` Math operations on SIMD values are applied elementwise, on each individual element in the vector. For example: ```mojo var vec1 = SIMD[DType.int8, 4](2, 3, 5, 7)var vec2 = SIMD[DType.int8, 4](1, 2, 3, 4)var product = vec1 * vec2print(product) ``` ### Scalar values​ The SIMD module defines several type aliases that are shorthand for different types of SIMD vectors. In particular, the Scalar type is just a SIMD vector with a single element. The numeric types listed in Table 1, like Int8 and Float32 are actually type aliases for different types of scalar values: SIMD SIMD Scalar SIMD Int8 Float32 ```mojo alias Scalar = SIMD[size=1]alias Int8 = Scalar[DType.int8]alias Float32 = Scalar[DType.float32] ``` This may seem a little confusing at first, but it means that whether you're working with a single Float32 value or a vector of float32 values, the math operations go through exactly the same code path. Float32 #### The DType type​ DType The DType struct describes the different data types that a SIMD vector can hold, and defines a number of utility functions for operating on those data types. The DType struct defines a set of aliases that act as identifiers for the different data types, like DType.int8 and DType.float32. You use these aliases when declaring a SIMD vector: DType SIMD DType DType.int8 DType.float32 SIMD ```mojo var v: SIMD[DType.float64, 16] ``` Note that DType.float64 isn't a type, it's a value that describes a data type. You can't create a variable with the type DType.float64. You can create a variable with the type SIMD[DType.float64, 1] (or Float64, which is the same thing). DType.float64 DType.float64 SIMD[DType.float64, 1] Float64 ```mojo from utils.numerics import max_finite, min_finitedef describeDType[dtype: DType](): print(dtype, "is floating point:", dtype.is_floating_point()) print(dtype, "is integral:", dtype.is_integral()) print("Min/max finite values for", dtype) print(min_finite[dtype](), max_finite[dtype]())describeDType[DType.float32]() ``` There are several other data types in the standard library that also use the DType abstraction. DType ## Strings​ Mojo's String type represents a mutable string. (For Python programmers, note that this is different from Python's standard string, which is immutable.) Strings support a variety of operators and common methods. String ```mojo var s: String = "Testing"s += " Mojo strings"print(s) ``` Most standard library types conform to the Stringable trait, which represents a type that can be converted to a string. Use str(value) to explicitly convert a value to a string: Stringable str(value) ```mojo var s = str("Items in list: ") + str(5)print(s) ``` ### String literals​ As with numeric types, the standard library includes a string literal type used to represent literal strings in the program source. String literals are enclosed in either single or double quotes. Adjacent literals are concatenated together, so you can define a long string using a series of literals broken up over several lines: ```mojo var s = "A very long string which is " "broken into two literals for legibility." ``` To define a multi-line string, enclose the literal in three single or double quotes: ```mojo var s = """Multi-line string literals let you enter long blocks of text, including newlines.""" ``` Note that the triple double quote form is also used for API documentation strings. Unlike IntLiteral and FloatLiteral, StringLiteral doesn't automatically materialize to a runtime type. In some cases, you may need to manually convert StringLiteral values to String using the built-in str() method. IntLiteral FloatLiteral StringLiteral StringLiteral String str() For example, if you want to concatenate string literals to other types, you need to first convert StringLiteral to String values. This is because many types can be implicitly converted to String, but not to StringLiteral. StringLiteral String String StringLiteral ```mojo # print("Strings play nicely with others: " + True)# Error: ... right hand side cannot be converted from Bool to StringLiteralprint(str("Strings play nicely with others: ") + str(True)) ``` ## Booleans​ Mojo's Bool type represents a boolean value. It can take one of two values, True or False. You can negate a boolean value using the not operator. Bool True False not ```mojo var conditionA = Falsevar conditionB: BoolconditionB = not conditionAprint(conditionA, conditionB) ``` Many types have a boolean representation. Any type that implements the Boolable trait has a boolean representation. As a general principle, collections evaluate as True if they contain any elements, False if they are empty; strings evaluate as True if they have a non-zero length. Boolable ## Collection types​ The Mojo standard library also includes a set of basic collection types that can be used to build more complex data structures: - List, a dynamically-sized array of items. - Dict, an associative array of key-value pairs. - Set, an unordered collection of unique items. - Optional represents a value that may or may not be present. List Dict Set Optional The collection types are generic types: while a given collection can only hold a specific type of value (such as Int or Float64), you specify the type at compile time using a parameter. For example, you can create a List of Int values like this: Int Float64 List Int ```mojo var l = List[Int](1, 2, 3, 4)# l.append(3.14) # error: FloatLiteral cannot be converted to Int ``` You don't always need to specify the type explicitly. If Mojo can infer the type, you can omit it. For example, when you construct a list from a set of integer literals, Mojo creates a List[Int]. List[Int] ```mojo # Inferred type == Intvar l1 = List(1, 2, 3, 4) ``` Where you need a more flexible collection, the Variant type can hold different types of values. For example, a Variant[Int32, Float64] can hold either an Int32 or a Float64 value at any given time. (Using Variant is not covered in this section, see the API docs for more information.) Variant Variant[Int32, Float64] Int32 Float64 Variant The following sections give brief introduction to the main collection types. ### List​ List is a dynamically-sized array of elements. List elements need to conform to the CollectionElement trait, which just means that the items must be copyable and movable. Most of the common standard library primitives, like Int, String, and SIMD conform to this trait. You can create a List by passing the element type as a parameter, like this: List CollectionElement Int String SIMD List ```mojo var l = List[String]() ``` The List type supports a subset of the Python list API, including the ability to append to the list, pop items out of the list, and access list items using subscript notation. List list ```mojo from collections import Listvar list = List(2, 3, 5)list.append(7)list.append(11)print("Popping last item from list: ", list.pop())for idx in range(len(list)): print(list[idx], end=", ") ``` Note that the previous code sample leaves out the type parameter when creating the list. Because the list is being created with a set of Int values, Mojo can infer the type from the arguments. Int There are some notable limitations when using List: List - You can't currently initialize a list from a list literal, like this: # Doesn't work!var list: List[Int] = [2, 3, 5] But you can use variadic arguments to achieve the same thing: var list = List(2, 3, 5) - You can't print() a list, or convert it directly into a string. # Does not workprint(list) As shown above, you can print the individual elements in a list as long as they're a Stringable type. - Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: You can't currently initialize a list from a list literal, like this: ```mojo # Doesn't work!var list: List[Int] = [2, 3, 5] ``` But you can use variadic arguments to achieve the same thing: ```mojo var list = List(2, 3, 5) ``` You can't print() a list, or convert it directly into a string. print() ```mojo # Does not workprint(list) ``` As shown above, you can print the individual elements in a list as long as they're a Stringable type. Stringable Iterating a List currently returns a Reference to each item, not the item itself. You can access the item using the dereference operator, []: List Reference [] ```mojo #: from collections import Listvar list = List(2, 3, 4)for item in list: print(item[], end=", ") ``` Subscripting in to a list, however, returns the item directly—no need to dereference: ```mojo #: from collections import List#: var list = List[Int](2, 3, 4)for i in range(len(list)): print(list[i], end=", ") ``` ### Dict​ The Dict type is an associative array that holds key-value pairs. You can create a Dict by specifying the key type and value type as parameters, like this: Dict Dict ```mojo var values = Dict[String, Float64]() ``` The dictionary's key type must conform to the KeyElement trait, and value elements must conform to the CollectionElement trait. KeyElement CollectionElement You can insert and remove key-value pairs, update the value assigned to a key, and iterate through keys, values, or items in the dictionary. The Dict iterators all yield references, so you need to use the dereference operator [] as shown in the following example: Dict [] ```mojo from collections import Dictvar d = Dict[String, Float64]()d["plasticity"] = 3.1d["elasticity"] = 1.3d["electricity"] = 9.7for item in d.items(): print(item[].key, item[].value) ``` ### Set​ The Set type represents a set of unique values. You can add and remove elements from the set, test whether a value exists in the set, and perform set algebra operations, like unions and intersections between two sets. Set Sets are generic and the element type must conform to the KeyElement trait. KeyElement ```mojo from collections import Seti_like = Set("sushi", "ice cream", "tacos", "pho")you_like = Set("burgers", "tacos", "salad", "ice cream")we_like = i_like.intersection(you_like)print("We both like:")for item in we_like: print("-", item[]) ``` ### Optional​ An Optional represents a value that may or may not be present. Like the other collection types, it is generic, and can hold any type that conforms to the CollectionElement trait. Optional CollectionElement ```mojo # Two ways to initialize an Optional with a valuevar opt1 = Optional(5)var opt2: Optional[Int] = 5# Two ways to initalize an Optional with no valuevar opt3 = Optional[Int]()var opt4: Optional[Int] = None ``` An Optional evaluates as True when it holds a value, False otherwise. If the Optional holds a value, you can retrieve a reference to the value using the value() method. But calling value() on an Optional with no value results in undefined behavior, so you should always guard a call to value() inside a conditional that checks whether a value exists. Optional True False Optional value() value() Optional value() ```mojo var opt: Optional[String] = str("Testing")if opt: var value_ref = opt.value() print(value_ref) ``` Alternately, you can use the or_else() method, which returns the stored value if there is one, or a user-specified default value otherwise: or_else() ```mojo var custom_greeting: Optional[String] = Noneprint(custom_greeting.or_else("Hello"))custom_greeting = str("Hi")print(custom_greeting.or_else("Hello")) ``` ## Register-passable, memory-only, and trivial types​ In various places in the documentation you'll see references to register-passable, memory-only, and trivial types. Register-passable and memory-only types are distinguished based on how they hold data: - Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Register-passable types are always passed by value (that is, the values are copied). - Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. Register-passable types are composed exclusively of fixed-size data types, which can (theoretically) be stored in a machine register. A register-passable type can include other types, as long as they are also register-passable. Int, Bool, and SIMD, for example, are all register-passable types. So a register-passable struct could include Int and Bool fields, but not a String field. Register-passable types are declared with the @register_passable decorator. Int Bool SIMD struct Int Bool String @register_passable Register-passable types are always passed by value (that is, the values are copied). Memory-only types consist of any types that don't fit the description of register-passable types. In particular, these types usually have pointers or references to dynamically-allocated memory. String, List, and Dict are all examples of memory-only types. String List Dict Our long-term goal is to make this distinction transparent to the user, and ensure all APIs work with both register-passable and memory-only types. But right now you will see some standard library types that only work with register-passable types or only work with memory-only types. In addition to these two categories, Mojo also has "trivial" types. Conceptually a trivial type is simply a type that doesn't require any custom logic in its lifecycle methods. The bits that make up an instance of a trivial type can be copied or moved without any knowledge of what they do. Currently, trivial types are declared using the @register_passable(trivial) decorator. Trivial types shouldn't be limited to only register-passable types, so in the future we intend to separate trivial types from the @register_passable decorator. @register_passable(trivial) @register_passable ## AnyType and AnyTrivialRegType​ AnyType AnyTrivialRegType Two other things you'll see in Mojo APIs are references to AnyType and AnyTrivialRegType. These are effectively metatypes, that is, types of types. AnyType AnyTrivialRegType - AnyType represents any Mojo type. Mojo treats AnyType as a special kind of trait, and you'll find more discussion of it on the Traits page. - AnyTrivialRegType is a metatype representing any Mojo type that's marked register passable. AnyType AnyType AnyTrivialRegType You'll see them in signatures like this: ```mojo fn any_type_function[ValueType: AnyTrivialRegType](value: ValueType): ... ``` You can read this as any_type_function has an argument, value of type ValueType, where ValueType is a register-passable type, determined at compile time. any_type_function value ValueType ValueType There is still some code like this in the standard library, but it's gradually being migrated to more generic code that doesn't distinguish between register-passable and memory-only types. - Numeric typesFloating-point numbersNumeric literalsSIMD and DTypeScalar values - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values - StringsString literals - String literals - Booleans - Collection typesListDictSetOptional - List - Dict - Set - Optional - Register-passable, memory-only, and trivial types - AnyType and AnyTrivialRegType - Floating-point numbers - Numeric literals - SIMD and DType - Scalar values SIMD DType - String literals - List - Dict - Set - Optional AnyType AnyTrivialRegType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#the-anytype-trait - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow#the-if-statement - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow#short-circuit-evaluation - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow#conditional-expressions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow#the-while-statement - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow#the-for-statement - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow#iterating-over-mojo-collections - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow#for-loop-control-statements - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/control-flow#iterating-over-python-collections - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Control flow # Control flow Mojo includes several traditional control flow structures for conditional and repeated execution of code blocks. ## The if statement​ if Mojo supports the if statement for conditional code execution. With it you can conditionally execute an indented code block if a given boolean expression evaluates to True. if True ```mojo temp_celsius = 25if temp_celsius > 20: print("It is warm.") print("The temperature is", temp_celsius * 9 / 5 + 32, "Fahrenheit." ) ``` You can write the entire if statement as a single line if all you need to execute conditionally is a single, short statement. if ```mojo temp_celsius = 22if temp_celsius < 15: print("It is cool.") # Skipped because condition is Falseif temp_celsius > 20: print("It is warm.") ``` Optionally, an if statement can include any number of additional elif clauses, each specifying a boolean condition and associated code block to execute if True. The conditions are tested in the order given. When a condition evaluates to True, the associated code block is executed and no further conditions are tested. if elif True True Additionally, an if statement can include an optional else clause providing a code block to execute if all conditions evaluate to False. if else False ```mojo temp_celsius = 25if temp_celsius <= 0: print("It is freezing.")elif temp_celsius < 20: print("It is cool.")elif temp_celsius < 30: print("It is warm.")else: print("It is hot.") ``` Mojo currently does not support the equivalent of a Python match or C switch statement for pattern matching and conditional execution. match switch ### Short-circuit evaluation​ Mojo follows short-circuit evaluation semantics for boolean operators. If the first argument to an or operator evaluates to True, the second argument is not evaluated. or True ```mojo def true_func() -> Bool: print("Executing true_func") return Truedef false_func() -> Bool: print("Executing false_func") return Falseprint('Short-circuit "or" evaluation')if true_func() or false_func(): print("True result") ``` If the first argument to an and operator evaluates to False, the second argument is not evaluated. and False ```mojo print('Short-circuit "and" evaluation')if false_func() and true_func(): print("True result") ``` ### Conditional expressions​ Mojo also supports conditional expressions (or what is sometimes called a ternary conditional operator) using the syntaxtrue_result if boolean_expression else false_result, just as in Python. This is most often used as a concise way to assign one of two different values to a variable, based on a boolean condition. ```mojo true_result if boolean_expression else false_result ``` ```mojo temp_celsius = 15forecast = "warm" if temp_celsius > 20 else "cool"print("The forecast for today is", forecast) ``` The alternative, written as a multi-line if statement, is more verbose. if ```mojo if temp_celsius > 20: forecast = "warm"else: forecast = "cool"print("The forecast for today is", forecast) ``` ## The while statement​ while The while loop repeatedly executes a code block while a given boolean expression evaluates to True. For example, the following loop prints values from the Fibonacci series that are less than 50. while True ```mojo fib_prev = 0fib_curr = 1print(fib_prev, end="")while fib_curr < 50: print(",", fib_curr, end="") fib_prev, fib_curr = fib_curr, fib_prev + fib_curr ``` A continue statement skips execution of the rest of the code block and resumes with the loop test expression. continue ```mojo n = 0while n < 5: n += 1 if n == 3: continue print(n, end=", ") ``` A break statement terminates execution of the loop. break ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n, end=", ") ``` Optionally, a while loop can include an else clause. The body of the else clause executes when the loop's boolean condition evaluates to False, even if it occurs the first time tested. while else else False ```mojo n = 5while n < 4: print(n) n += 1else: print("Loop completed") ``` The else clause does not execute if a break or return statement exits the while loop. else break return while ```mojo n = 0while n < 5: n += 1 if n == 3: break print(n)else: print("Executing else clause") ``` ## The for statement​ for The for loop iterates over a sequence, executing a code block for each element in the sequence. The Mojo for loop can iterate over any type that implements an __iter__() method that returns a type that defines __next__() and __len__() methods. for for __iter__() __next__() __len__() ### Iterating over Mojo collections​ All of the collection types in the collections module support for loop iteration. See the Collection types documentation for more information on Mojo collection types. collections for Iterating over Mojo native collections currently assigns the loop index variable a Reference to each item, not the item itself. You can access the item using the dereference operator, [], as shown in the examples below. This may change in a future version of Mojo. Reference [] The following shows an example of iterating over a Mojo List. List ```mojo from collections import Liststates = List[String]("California", "Hawaii", "Oregon")for state in states: print(state[]) ``` The same technique works for iterating over a Mojo Set. Set ```mojo from collections import Setvalues = Set[Int](42, 0)for item in values: print(item[]) ``` There are two techniques for iterating over a Mojo Dict. The first is to iterate directly using the Dict, which produces a sequence of the dictionary's keys. Dict Dict ```mojo from collections import Dictcapitals = Dict[String, String]()capitals["California"] = "Sacramento"capitals["Hawaii"] = "Honolulu"capitals["Oregon"] = "Salem"for state in capitals: print(capitals[state[]] + ", " + state[]) ``` The second approach to iterating over a Mojo Dict is to invoke its items() method, which produces a sequence of DictEntry objects. Within the loop body, you can then access the key and value fields of the entry. Dict items() DictEntry key value ```mojo for item in capitals.items(): print(item[].value + ", " + item[].key) ``` Another type of iterable provided by the Mojo standard library is a range, which is a sequence of integers generated by the range() function. It differs from the collection types shown above in that it's implemented as a generator, producing each value as needed rather than materializing the entire sequence in memory. Additionally, each value assigned to the loop index variable is simply the Int value rather than a Reference to the value, so you should not use the dereference operator on it within the loop. For example: range() Int Reference ```mojo for i in range(5): print(i, end=", ") ``` ### for loop control statements​ for A continue statement skips execution of the rest of the code block and resumes the loop with the next element of the collection. continue ```mojo for i in range(5): if i == 3: continue print(i, end=", ") ``` A break statement terminates execution of the loop. break ```mojo for i in range(5): if i == 3: break print(i, end=", ") ``` Optionally, a for loop can include an else clause. The body of the else clause executes after iterating over all of the elements in a collection. for else else ```mojo for i in range(5): print(i, end=", ")else: print("\nFinished executing 'for' loop") ``` The else clause executes even if the collection is empty. else ```mojo from collections import Listempty = List[Int]()for i in empty: print(i[])else: print("Finished executing 'for' loop") ``` The else clause does not execute if a break or return statement terminates the for loop. else break return for ```mojo from collections import Listanimals = List[String]("cat", "aardvark", "hippopotamus", "dog")for animal in animals: if animal[] == "dog": print("Found a dog") breakelse: print("No dog found") ``` ### Iterating over Python collections​ The Mojo for loop supports iterating over Python collection types. Each item retrieved by the loop is a PythonObject wrapper around the Python object. Refer to the Python types documentation for more information on manipulating Python objects from Mojo. for PythonObject The following is a simple example of iterating over a mixed-type Python list. ```mojo from python import Python# Create a mixed-type Python listpy_list = Python.evaluate("[42, 'cat', 3.14159]")for py_obj in py_list: # Each element is of type "PythonObject" print(py_obj) ``` Iterating over a Mojo collection currently assigns the loop index variable a Reference to each element, which then requires you to use the dereference operator within the loop body. In contrast, iterating over a Python collection assigns a PythonObject wrapper for the element, which does not require you to use the dereference operator. Reference PythonObject There are two techniques for iterating over a Python dictionary. The first is to iterate directly using the dictionary, which produces a sequence of its keys. ```mojo from python import Python# Create a mixed-type Python dictionarypy_dict = Python.evaluate("{'a': 1, 'b': 2.71828, 'c': 'sushi'}")for py_key in py_dict: # Each element is of type "PythonObject" print(py_key, py_dict[py_key]) ``` The second approach to iterating over a Python dictionary is to invoke its items() method, which produces a sequence of 2-tuple objects. Within the loop body, you can then access the key and value by index. items() ```mojo for py_tuple in py_dict.items(): # Each element is of type "PythonObject" print(py_tuple[0], py_tuple[1]) ``` - The if statementShort-circuit evaluationConditional expressions - Short-circuit evaluation - Conditional expressions - The while statement - The for statementIterating over Mojo collectionsfor loop control statementsIterating over Python collections - Iterating over Mojo collections - for loop control statements - Iterating over Python collections if - Short-circuit evaluation - Conditional expressions while for - Iterating over Mojo collections - for loop control statements - Iterating over Python collections for - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/structs#struct-definition - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Structs # Structs A Mojo struct is a data structure that allows you to encapsulate fields and methods that operate on an abstraction, such as a data type or an object. Fields are variables that hold data relevant to the struct, and methods are functions inside a struct that generally act upon the field data. For example, if you're building a graphics program, you can use a struct to define an Image that has fields to store information about each image (such as the pixels) and methods that perform actions on it (such as rotate it). Image For the most part, Mojo's struct format is designed to provide a static, memory-safe data structure for high-level data types used in programs. For example, all the data types in Mojo's standard library (such as Int, Bool, String, and Tuple) are defined as structs. Int Bool String Tuple If you understand how functions and variables work in Mojo, you probably noticed that Mojo is designed to provide dynamic programming features in a def function while enforcing stronger code safety in fn functions. When it comes to structs, Mojo leans toward the safe side: You can still choose whether to use either def or fn declarations for methods, but all fields must be declared with var. def fn def fn var ## Struct definition​ You can define a simple struct called MyPair with two fields like this: MyPair ```mojo struct MyPair: var first: Int var second: Int ``` However, you can't instantiate this struct because it has no constructor method. So here it is with a constructor to initialize the two fields: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second ``` Notice that the first argument in the __init__() method is inout self. For now, ignore inout (it's an argument convention that declares self as a mutable reference); all you need to know right now is that self must be the first argument. It references the current struct instance (it allows code in the method to refer to "itself"). When you call the constructor, you never pass a value for self—Mojo passes it in automatically. __init__() inout self inout self self self The __init__() method is one of many special methods (also known as "dunder methods" because they have double underscores) with pre-determined names. __init__() You can't assign values when you declare fields. You must initialize all of the struct's fields in the constructor. (If you try to leave a field uninitialized, the code won't compile.) Once you have a constructor, you can create an instance of MyPair and set the fields: MyPair ```mojo var mine = MyPair(2,4)print(mine.first) ``` ## Methods​ In addition to special methods like __init__(), you can add any other method you want to your struct. For example: __init__() ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn get_sum(self) -> Int: return self.first + self.second ``` ```mojo var mine = MyPair(6, 8)print(mine.get_sum()) ``` Notice that get_sum() also uses the self argument, because this is the only way you can access the struct's fields in a method. The name self is just a convention, and you can use any name you want to refer to the struct instance that is always passed as the first argument. get_sum() self self Methods that take the implicit self argument are called instance methods because they act on an instance of the struct. self The self argument in a struct method is the only argument in an fn function that does not require a type. You can include it if you want, but you can elide it because Mojo already knows its type (MyPair in this case). self fn MyPair ### Static methods​ A struct can also have static methods. A static method can be called without creating an instance of the struct. Unlike instance methods, a static method doesn't receive the implicit self argument, so it can't access any fields on the struct. self To declare a static method, use the @staticmethod decorator and don't include a self argument: @staticmethod self ```mojo struct Logger: fn __init__(inout self): pass @staticmethod fn log_info(message: String): print("Info: ", message) ``` You can invoke a static method by calling it on the type (in this case, Logger). You can also call it on an instance of the type. Both forms are shown below: Logger ```mojo Logger.log_info("Static method called.")var l = Logger()l.log_info("Static method called from instance.") ``` ## Structs compared to classes​ If you're familiar with other object-oriented languages, then structs might sound a lot like classes, and there are some similarities, but also some important differences. Eventually, Mojo will also support classes to match the behavior of Python classes. So, let's compare Mojo structs to Python classes. They both support methods, fields, operator overloading, decorators for metaprogramming, and more, but their key differences are as follows: - Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. - Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. - Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. - Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. - Mojo structs don't support static data members. Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. Mojo structs don't support static data members. Syntactically, the biggest difference compared to a Python class is that all fields in a struct must be explicitly declared with var. var In Mojo, the structure and contents of a struct are set at compile time and can’t be changed while the program is running. Unlike in Python, where you can add, remove, or change attributes of an object on the fly, Mojo doesn’t allow that for structs. However, the static nature of structs helps Mojo run your code faster. The program knows exactly where to find the struct’s information and how to use it without any extra steps or delays at runtime. Mojo’s structs also work really well with features you might already know from Python, like operator overloading (which lets you change how math symbols like + and - work with your own data, using special methods). + - As mentioned above, all Mojo's standard types (Int, String, etc.) are made using structs, rather than being hardwired into the language itself. This gives you more flexibility and control when writing your code, and it means you can define your own types with all the same capabilities (there's no special treatment for the standard library types). Int String ## Special methods​ Special methods (or "dunder methods") such as __init__() are pre-determined method names that you can define in a struct to perform a special task. __init__() Although it's possible to call special methods with their method names, the point is that you never should, because Mojo automatically invokes them in circumstances where they're needed (which is why they're also called "magic methods"). For example, Mojo calls the __init__() method when you create an instance of the struct; and when Mojo destroys the instance, it calls the __del__() method (if it exists). __init__() __del__() Even operator behaviors that appear built-in (+, <, ==, |, and so on) are implemented as special methods that Mojo implicitly calls upon to perform operations or comparisons on the type that the operator is applied to. + < == | Mojo supports a long list of special methods; far too many to discuss here, but they generally match all of Python's special methods and they usually accomplish one of two types of tasks: - Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). - Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). < + | Int __lt__() num1 < num2 Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. __init__() __del__() You can learn all about the lifecycle special methods in the Value lifecycle section. However, most structs are simple aggregations of other types, so unless your type requires custom behaviors when an instance is created, copied, moved, or destroyed, you can synthesize the essential lifecycle methods you need (and save yourself some time) by adding the @value decorator. @value ### @value decorator​ @value When you add the @value decorator to a struct, Mojo will synthesize the essential lifecycle methods so your object provides full value semantics. Specifically, it generates the __init__(), __copyinit__(), and __moveinit__() methods, which allow you to construct, copy, and move your struct type in a manner that's value semantic and compatible with Mojo's ownership model. @value __init__() __copyinit__() __moveinit__() For example: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo will notice that you don't have a member-wise initializer, a move constructor, or a copy constructor, and it will synthesize these for you as if you had written: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Without the copy and move constructors, the following code would not work because Mojo would not know how to copy an instance of MyPet: MyPet ```mojo var dog = MyPet("Charlie", 5)var poodle = dogprint(poodle.name) ``` When you add the @value decorator, Mojo synthesizes each special method above only if it doesn't exist already. That is, you can still implement a custom version of each method. @value In addition to the inout argument convention you already saw with __init__(), this code also introduces owned, which is another argument convention that ensures the argument has unique ownership of the value. For more detail, see the section about value ownership. inout __init__() owned - Struct definition - MethodsStatic methods - Static methods - Structs compared to classes - Special methods@value decorator - @value decorator - Static methods - @value decorator @value - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/structs#special-methods - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Structs # Structs A Mojo struct is a data structure that allows you to encapsulate fields and methods that operate on an abstraction, such as a data type or an object. Fields are variables that hold data relevant to the struct, and methods are functions inside a struct that generally act upon the field data. For example, if you're building a graphics program, you can use a struct to define an Image that has fields to store information about each image (such as the pixels) and methods that perform actions on it (such as rotate it). Image For the most part, Mojo's struct format is designed to provide a static, memory-safe data structure for high-level data types used in programs. For example, all the data types in Mojo's standard library (such as Int, Bool, String, and Tuple) are defined as structs. Int Bool String Tuple If you understand how functions and variables work in Mojo, you probably noticed that Mojo is designed to provide dynamic programming features in a def function while enforcing stronger code safety in fn functions. When it comes to structs, Mojo leans toward the safe side: You can still choose whether to use either def or fn declarations for methods, but all fields must be declared with var. def fn def fn var ## Struct definition​ You can define a simple struct called MyPair with two fields like this: MyPair ```mojo struct MyPair: var first: Int var second: Int ``` However, you can't instantiate this struct because it has no constructor method. So here it is with a constructor to initialize the two fields: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second ``` Notice that the first argument in the __init__() method is inout self. For now, ignore inout (it's an argument convention that declares self as a mutable reference); all you need to know right now is that self must be the first argument. It references the current struct instance (it allows code in the method to refer to "itself"). When you call the constructor, you never pass a value for self—Mojo passes it in automatically. __init__() inout self inout self self self The __init__() method is one of many special methods (also known as "dunder methods" because they have double underscores) with pre-determined names. __init__() You can't assign values when you declare fields. You must initialize all of the struct's fields in the constructor. (If you try to leave a field uninitialized, the code won't compile.) Once you have a constructor, you can create an instance of MyPair and set the fields: MyPair ```mojo var mine = MyPair(2,4)print(mine.first) ``` ## Methods​ In addition to special methods like __init__(), you can add any other method you want to your struct. For example: __init__() ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn get_sum(self) -> Int: return self.first + self.second ``` ```mojo var mine = MyPair(6, 8)print(mine.get_sum()) ``` Notice that get_sum() also uses the self argument, because this is the only way you can access the struct's fields in a method. The name self is just a convention, and you can use any name you want to refer to the struct instance that is always passed as the first argument. get_sum() self self Methods that take the implicit self argument are called instance methods because they act on an instance of the struct. self The self argument in a struct method is the only argument in an fn function that does not require a type. You can include it if you want, but you can elide it because Mojo already knows its type (MyPair in this case). self fn MyPair ### Static methods​ A struct can also have static methods. A static method can be called without creating an instance of the struct. Unlike instance methods, a static method doesn't receive the implicit self argument, so it can't access any fields on the struct. self To declare a static method, use the @staticmethod decorator and don't include a self argument: @staticmethod self ```mojo struct Logger: fn __init__(inout self): pass @staticmethod fn log_info(message: String): print("Info: ", message) ``` You can invoke a static method by calling it on the type (in this case, Logger). You can also call it on an instance of the type. Both forms are shown below: Logger ```mojo Logger.log_info("Static method called.")var l = Logger()l.log_info("Static method called from instance.") ``` ## Structs compared to classes​ If you're familiar with other object-oriented languages, then structs might sound a lot like classes, and there are some similarities, but also some important differences. Eventually, Mojo will also support classes to match the behavior of Python classes. So, let's compare Mojo structs to Python classes. They both support methods, fields, operator overloading, decorators for metaprogramming, and more, but their key differences are as follows: - Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. - Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. - Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. - Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. - Mojo structs don't support static data members. Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. Mojo structs don't support static data members. Syntactically, the biggest difference compared to a Python class is that all fields in a struct must be explicitly declared with var. var In Mojo, the structure and contents of a struct are set at compile time and can’t be changed while the program is running. Unlike in Python, where you can add, remove, or change attributes of an object on the fly, Mojo doesn’t allow that for structs. However, the static nature of structs helps Mojo run your code faster. The program knows exactly where to find the struct’s information and how to use it without any extra steps or delays at runtime. Mojo’s structs also work really well with features you might already know from Python, like operator overloading (which lets you change how math symbols like + and - work with your own data, using special methods). + - As mentioned above, all Mojo's standard types (Int, String, etc.) are made using structs, rather than being hardwired into the language itself. This gives you more flexibility and control when writing your code, and it means you can define your own types with all the same capabilities (there's no special treatment for the standard library types). Int String ## Special methods​ Special methods (or "dunder methods") such as __init__() are pre-determined method names that you can define in a struct to perform a special task. __init__() Although it's possible to call special methods with their method names, the point is that you never should, because Mojo automatically invokes them in circumstances where they're needed (which is why they're also called "magic methods"). For example, Mojo calls the __init__() method when you create an instance of the struct; and when Mojo destroys the instance, it calls the __del__() method (if it exists). __init__() __del__() Even operator behaviors that appear built-in (+, <, ==, |, and so on) are implemented as special methods that Mojo implicitly calls upon to perform operations or comparisons on the type that the operator is applied to. + < == | Mojo supports a long list of special methods; far too many to discuss here, but they generally match all of Python's special methods and they usually accomplish one of two types of tasks: - Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). - Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). < + | Int __lt__() num1 < num2 Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. __init__() __del__() You can learn all about the lifecycle special methods in the Value lifecycle section. However, most structs are simple aggregations of other types, so unless your type requires custom behaviors when an instance is created, copied, moved, or destroyed, you can synthesize the essential lifecycle methods you need (and save yourself some time) by adding the @value decorator. @value ### @value decorator​ @value When you add the @value decorator to a struct, Mojo will synthesize the essential lifecycle methods so your object provides full value semantics. Specifically, it generates the __init__(), __copyinit__(), and __moveinit__() methods, which allow you to construct, copy, and move your struct type in a manner that's value semantic and compatible with Mojo's ownership model. @value __init__() __copyinit__() __moveinit__() For example: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo will notice that you don't have a member-wise initializer, a move constructor, or a copy constructor, and it will synthesize these for you as if you had written: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Without the copy and move constructors, the following code would not work because Mojo would not know how to copy an instance of MyPet: MyPet ```mojo var dog = MyPet("Charlie", 5)var poodle = dogprint(poodle.name) ``` When you add the @value decorator, Mojo synthesizes each special method above only if it doesn't exist already. That is, you can still implement a custom version of each method. @value In addition to the inout argument convention you already saw with __init__(), this code also introduces owned, which is another argument convention that ensures the argument has unique ownership of the value. For more detail, see the section about value ownership. inout __init__() owned - Struct definition - MethodsStatic methods - Static methods - Structs compared to classes - Special methods@value decorator - @value decorator - Static methods - @value decorator @value - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/structs#static-methods - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Structs # Structs A Mojo struct is a data structure that allows you to encapsulate fields and methods that operate on an abstraction, such as a data type or an object. Fields are variables that hold data relevant to the struct, and methods are functions inside a struct that generally act upon the field data. For example, if you're building a graphics program, you can use a struct to define an Image that has fields to store information about each image (such as the pixels) and methods that perform actions on it (such as rotate it). Image For the most part, Mojo's struct format is designed to provide a static, memory-safe data structure for high-level data types used in programs. For example, all the data types in Mojo's standard library (such as Int, Bool, String, and Tuple) are defined as structs. Int Bool String Tuple If you understand how functions and variables work in Mojo, you probably noticed that Mojo is designed to provide dynamic programming features in a def function while enforcing stronger code safety in fn functions. When it comes to structs, Mojo leans toward the safe side: You can still choose whether to use either def or fn declarations for methods, but all fields must be declared with var. def fn def fn var ## Struct definition​ You can define a simple struct called MyPair with two fields like this: MyPair ```mojo struct MyPair: var first: Int var second: Int ``` However, you can't instantiate this struct because it has no constructor method. So here it is with a constructor to initialize the two fields: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second ``` Notice that the first argument in the __init__() method is inout self. For now, ignore inout (it's an argument convention that declares self as a mutable reference); all you need to know right now is that self must be the first argument. It references the current struct instance (it allows code in the method to refer to "itself"). When you call the constructor, you never pass a value for self—Mojo passes it in automatically. __init__() inout self inout self self self The __init__() method is one of many special methods (also known as "dunder methods" because they have double underscores) with pre-determined names. __init__() You can't assign values when you declare fields. You must initialize all of the struct's fields in the constructor. (If you try to leave a field uninitialized, the code won't compile.) Once you have a constructor, you can create an instance of MyPair and set the fields: MyPair ```mojo var mine = MyPair(2,4)print(mine.first) ``` ## Methods​ In addition to special methods like __init__(), you can add any other method you want to your struct. For example: __init__() ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn get_sum(self) -> Int: return self.first + self.second ``` ```mojo var mine = MyPair(6, 8)print(mine.get_sum()) ``` Notice that get_sum() also uses the self argument, because this is the only way you can access the struct's fields in a method. The name self is just a convention, and you can use any name you want to refer to the struct instance that is always passed as the first argument. get_sum() self self Methods that take the implicit self argument are called instance methods because they act on an instance of the struct. self The self argument in a struct method is the only argument in an fn function that does not require a type. You can include it if you want, but you can elide it because Mojo already knows its type (MyPair in this case). self fn MyPair ### Static methods​ A struct can also have static methods. A static method can be called without creating an instance of the struct. Unlike instance methods, a static method doesn't receive the implicit self argument, so it can't access any fields on the struct. self To declare a static method, use the @staticmethod decorator and don't include a self argument: @staticmethod self ```mojo struct Logger: fn __init__(inout self): pass @staticmethod fn log_info(message: String): print("Info: ", message) ``` You can invoke a static method by calling it on the type (in this case, Logger). You can also call it on an instance of the type. Both forms are shown below: Logger ```mojo Logger.log_info("Static method called.")var l = Logger()l.log_info("Static method called from instance.") ``` ## Structs compared to classes​ If you're familiar with other object-oriented languages, then structs might sound a lot like classes, and there are some similarities, but also some important differences. Eventually, Mojo will also support classes to match the behavior of Python classes. So, let's compare Mojo structs to Python classes. They both support methods, fields, operator overloading, decorators for metaprogramming, and more, but their key differences are as follows: - Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. - Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. - Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. - Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. - Mojo structs don't support static data members. Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. Mojo structs don't support static data members. Syntactically, the biggest difference compared to a Python class is that all fields in a struct must be explicitly declared with var. var In Mojo, the structure and contents of a struct are set at compile time and can’t be changed while the program is running. Unlike in Python, where you can add, remove, or change attributes of an object on the fly, Mojo doesn’t allow that for structs. However, the static nature of structs helps Mojo run your code faster. The program knows exactly where to find the struct’s information and how to use it without any extra steps or delays at runtime. Mojo’s structs also work really well with features you might already know from Python, like operator overloading (which lets you change how math symbols like + and - work with your own data, using special methods). + - As mentioned above, all Mojo's standard types (Int, String, etc.) are made using structs, rather than being hardwired into the language itself. This gives you more flexibility and control when writing your code, and it means you can define your own types with all the same capabilities (there's no special treatment for the standard library types). Int String ## Special methods​ Special methods (or "dunder methods") such as __init__() are pre-determined method names that you can define in a struct to perform a special task. __init__() Although it's possible to call special methods with their method names, the point is that you never should, because Mojo automatically invokes them in circumstances where they're needed (which is why they're also called "magic methods"). For example, Mojo calls the __init__() method when you create an instance of the struct; and when Mojo destroys the instance, it calls the __del__() method (if it exists). __init__() __del__() Even operator behaviors that appear built-in (+, <, ==, |, and so on) are implemented as special methods that Mojo implicitly calls upon to perform operations or comparisons on the type that the operator is applied to. + < == | Mojo supports a long list of special methods; far too many to discuss here, but they generally match all of Python's special methods and they usually accomplish one of two types of tasks: - Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). - Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). < + | Int __lt__() num1 < num2 Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. __init__() __del__() You can learn all about the lifecycle special methods in the Value lifecycle section. However, most structs are simple aggregations of other types, so unless your type requires custom behaviors when an instance is created, copied, moved, or destroyed, you can synthesize the essential lifecycle methods you need (and save yourself some time) by adding the @value decorator. @value ### @value decorator​ @value When you add the @value decorator to a struct, Mojo will synthesize the essential lifecycle methods so your object provides full value semantics. Specifically, it generates the __init__(), __copyinit__(), and __moveinit__() methods, which allow you to construct, copy, and move your struct type in a manner that's value semantic and compatible with Mojo's ownership model. @value __init__() __copyinit__() __moveinit__() For example: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo will notice that you don't have a member-wise initializer, a move constructor, or a copy constructor, and it will synthesize these for you as if you had written: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Without the copy and move constructors, the following code would not work because Mojo would not know how to copy an instance of MyPet: MyPet ```mojo var dog = MyPet("Charlie", 5)var poodle = dogprint(poodle.name) ``` When you add the @value decorator, Mojo synthesizes each special method above only if it doesn't exist already. That is, you can still implement a custom version of each method. @value In addition to the inout argument convention you already saw with __init__(), this code also introduces owned, which is another argument convention that ensures the argument has unique ownership of the value. For more detail, see the section about value ownership. inout __init__() owned - Struct definition - MethodsStatic methods - Static methods - Structs compared to classes - Special methods@value decorator - @value decorator - Static methods - @value decorator @value - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/structs#structs-compared-to-classes - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Structs # Structs A Mojo struct is a data structure that allows you to encapsulate fields and methods that operate on an abstraction, such as a data type or an object. Fields are variables that hold data relevant to the struct, and methods are functions inside a struct that generally act upon the field data. For example, if you're building a graphics program, you can use a struct to define an Image that has fields to store information about each image (such as the pixels) and methods that perform actions on it (such as rotate it). Image For the most part, Mojo's struct format is designed to provide a static, memory-safe data structure for high-level data types used in programs. For example, all the data types in Mojo's standard library (such as Int, Bool, String, and Tuple) are defined as structs. Int Bool String Tuple If you understand how functions and variables work in Mojo, you probably noticed that Mojo is designed to provide dynamic programming features in a def function while enforcing stronger code safety in fn functions. When it comes to structs, Mojo leans toward the safe side: You can still choose whether to use either def or fn declarations for methods, but all fields must be declared with var. def fn def fn var ## Struct definition​ You can define a simple struct called MyPair with two fields like this: MyPair ```mojo struct MyPair: var first: Int var second: Int ``` However, you can't instantiate this struct because it has no constructor method. So here it is with a constructor to initialize the two fields: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second ``` Notice that the first argument in the __init__() method is inout self. For now, ignore inout (it's an argument convention that declares self as a mutable reference); all you need to know right now is that self must be the first argument. It references the current struct instance (it allows code in the method to refer to "itself"). When you call the constructor, you never pass a value for self—Mojo passes it in automatically. __init__() inout self inout self self self The __init__() method is one of many special methods (also known as "dunder methods" because they have double underscores) with pre-determined names. __init__() You can't assign values when you declare fields. You must initialize all of the struct's fields in the constructor. (If you try to leave a field uninitialized, the code won't compile.) Once you have a constructor, you can create an instance of MyPair and set the fields: MyPair ```mojo var mine = MyPair(2,4)print(mine.first) ``` ## Methods​ In addition to special methods like __init__(), you can add any other method you want to your struct. For example: __init__() ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn get_sum(self) -> Int: return self.first + self.second ``` ```mojo var mine = MyPair(6, 8)print(mine.get_sum()) ``` Notice that get_sum() also uses the self argument, because this is the only way you can access the struct's fields in a method. The name self is just a convention, and you can use any name you want to refer to the struct instance that is always passed as the first argument. get_sum() self self Methods that take the implicit self argument are called instance methods because they act on an instance of the struct. self The self argument in a struct method is the only argument in an fn function that does not require a type. You can include it if you want, but you can elide it because Mojo already knows its type (MyPair in this case). self fn MyPair ### Static methods​ A struct can also have static methods. A static method can be called without creating an instance of the struct. Unlike instance methods, a static method doesn't receive the implicit self argument, so it can't access any fields on the struct. self To declare a static method, use the @staticmethod decorator and don't include a self argument: @staticmethod self ```mojo struct Logger: fn __init__(inout self): pass @staticmethod fn log_info(message: String): print("Info: ", message) ``` You can invoke a static method by calling it on the type (in this case, Logger). You can also call it on an instance of the type. Both forms are shown below: Logger ```mojo Logger.log_info("Static method called.")var l = Logger()l.log_info("Static method called from instance.") ``` ## Structs compared to classes​ If you're familiar with other object-oriented languages, then structs might sound a lot like classes, and there are some similarities, but also some important differences. Eventually, Mojo will also support classes to match the behavior of Python classes. So, let's compare Mojo structs to Python classes. They both support methods, fields, operator overloading, decorators for metaprogramming, and more, but their key differences are as follows: - Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. - Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. - Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. - Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. - Mojo structs don't support static data members. Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. Mojo structs don't support static data members. Syntactically, the biggest difference compared to a Python class is that all fields in a struct must be explicitly declared with var. var In Mojo, the structure and contents of a struct are set at compile time and can’t be changed while the program is running. Unlike in Python, where you can add, remove, or change attributes of an object on the fly, Mojo doesn’t allow that for structs. However, the static nature of structs helps Mojo run your code faster. The program knows exactly where to find the struct’s information and how to use it without any extra steps or delays at runtime. Mojo’s structs also work really well with features you might already know from Python, like operator overloading (which lets you change how math symbols like + and - work with your own data, using special methods). + - As mentioned above, all Mojo's standard types (Int, String, etc.) are made using structs, rather than being hardwired into the language itself. This gives you more flexibility and control when writing your code, and it means you can define your own types with all the same capabilities (there's no special treatment for the standard library types). Int String ## Special methods​ Special methods (or "dunder methods") such as __init__() are pre-determined method names that you can define in a struct to perform a special task. __init__() Although it's possible to call special methods with their method names, the point is that you never should, because Mojo automatically invokes them in circumstances where they're needed (which is why they're also called "magic methods"). For example, Mojo calls the __init__() method when you create an instance of the struct; and when Mojo destroys the instance, it calls the __del__() method (if it exists). __init__() __del__() Even operator behaviors that appear built-in (+, <, ==, |, and so on) are implemented as special methods that Mojo implicitly calls upon to perform operations or comparisons on the type that the operator is applied to. + < == | Mojo supports a long list of special methods; far too many to discuss here, but they generally match all of Python's special methods and they usually accomplish one of two types of tasks: - Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). - Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). < + | Int __lt__() num1 < num2 Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. __init__() __del__() You can learn all about the lifecycle special methods in the Value lifecycle section. However, most structs are simple aggregations of other types, so unless your type requires custom behaviors when an instance is created, copied, moved, or destroyed, you can synthesize the essential lifecycle methods you need (and save yourself some time) by adding the @value decorator. @value ### @value decorator​ @value When you add the @value decorator to a struct, Mojo will synthesize the essential lifecycle methods so your object provides full value semantics. Specifically, it generates the __init__(), __copyinit__(), and __moveinit__() methods, which allow you to construct, copy, and move your struct type in a manner that's value semantic and compatible with Mojo's ownership model. @value __init__() __copyinit__() __moveinit__() For example: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo will notice that you don't have a member-wise initializer, a move constructor, or a copy constructor, and it will synthesize these for you as if you had written: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Without the copy and move constructors, the following code would not work because Mojo would not know how to copy an instance of MyPet: MyPet ```mojo var dog = MyPet("Charlie", 5)var poodle = dogprint(poodle.name) ``` When you add the @value decorator, Mojo synthesizes each special method above only if it doesn't exist already. That is, you can still implement a custom version of each method. @value In addition to the inout argument convention you already saw with __init__(), this code also introduces owned, which is another argument convention that ensures the argument has unique ownership of the value. For more detail, see the section about value ownership. inout __init__() owned - Struct definition - MethodsStatic methods - Static methods - Structs compared to classes - Special methods@value decorator - @value decorator - Static methods - @value decorator @value - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/structs#value-decorator - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Structs # Structs A Mojo struct is a data structure that allows you to encapsulate fields and methods that operate on an abstraction, such as a data type or an object. Fields are variables that hold data relevant to the struct, and methods are functions inside a struct that generally act upon the field data. For example, if you're building a graphics program, you can use a struct to define an Image that has fields to store information about each image (such as the pixels) and methods that perform actions on it (such as rotate it). Image For the most part, Mojo's struct format is designed to provide a static, memory-safe data structure for high-level data types used in programs. For example, all the data types in Mojo's standard library (such as Int, Bool, String, and Tuple) are defined as structs. Int Bool String Tuple If you understand how functions and variables work in Mojo, you probably noticed that Mojo is designed to provide dynamic programming features in a def function while enforcing stronger code safety in fn functions. When it comes to structs, Mojo leans toward the safe side: You can still choose whether to use either def or fn declarations for methods, but all fields must be declared with var. def fn def fn var ## Struct definition​ You can define a simple struct called MyPair with two fields like this: MyPair ```mojo struct MyPair: var first: Int var second: Int ``` However, you can't instantiate this struct because it has no constructor method. So here it is with a constructor to initialize the two fields: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second ``` Notice that the first argument in the __init__() method is inout self. For now, ignore inout (it's an argument convention that declares self as a mutable reference); all you need to know right now is that self must be the first argument. It references the current struct instance (it allows code in the method to refer to "itself"). When you call the constructor, you never pass a value for self—Mojo passes it in automatically. __init__() inout self inout self self self The __init__() method is one of many special methods (also known as "dunder methods" because they have double underscores) with pre-determined names. __init__() You can't assign values when you declare fields. You must initialize all of the struct's fields in the constructor. (If you try to leave a field uninitialized, the code won't compile.) Once you have a constructor, you can create an instance of MyPair and set the fields: MyPair ```mojo var mine = MyPair(2,4)print(mine.first) ``` ## Methods​ In addition to special methods like __init__(), you can add any other method you want to your struct. For example: __init__() ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn get_sum(self) -> Int: return self.first + self.second ``` ```mojo var mine = MyPair(6, 8)print(mine.get_sum()) ``` Notice that get_sum() also uses the self argument, because this is the only way you can access the struct's fields in a method. The name self is just a convention, and you can use any name you want to refer to the struct instance that is always passed as the first argument. get_sum() self self Methods that take the implicit self argument are called instance methods because they act on an instance of the struct. self The self argument in a struct method is the only argument in an fn function that does not require a type. You can include it if you want, but you can elide it because Mojo already knows its type (MyPair in this case). self fn MyPair ### Static methods​ A struct can also have static methods. A static method can be called without creating an instance of the struct. Unlike instance methods, a static method doesn't receive the implicit self argument, so it can't access any fields on the struct. self To declare a static method, use the @staticmethod decorator and don't include a self argument: @staticmethod self ```mojo struct Logger: fn __init__(inout self): pass @staticmethod fn log_info(message: String): print("Info: ", message) ``` You can invoke a static method by calling it on the type (in this case, Logger). You can also call it on an instance of the type. Both forms are shown below: Logger ```mojo Logger.log_info("Static method called.")var l = Logger()l.log_info("Static method called from instance.") ``` ## Structs compared to classes​ If you're familiar with other object-oriented languages, then structs might sound a lot like classes, and there are some similarities, but also some important differences. Eventually, Mojo will also support classes to match the behavior of Python classes. So, let's compare Mojo structs to Python classes. They both support methods, fields, operator overloading, decorators for metaprogramming, and more, but their key differences are as follows: - Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. - Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. - Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. - Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. - Mojo structs don't support static data members. Python classes are dynamic: they allow for dynamic dispatch, monkey-patching (or “swizzling”), and dynamically binding instance fields at runtime. Mojo structs are static: they are bound at compile-time (you cannot add methods at runtime). Structs allow you to trade flexibility for performance while being safe and easy to use. Mojo structs do not support inheritance ("sub-classing"), but a struct can implement traits. Python classes support class attributes—values that are shared by all instances of the class, equivalent to class variables or static data members in other languages. Mojo structs don't support static data members. Syntactically, the biggest difference compared to a Python class is that all fields in a struct must be explicitly declared with var. var In Mojo, the structure and contents of a struct are set at compile time and can’t be changed while the program is running. Unlike in Python, where you can add, remove, or change attributes of an object on the fly, Mojo doesn’t allow that for structs. However, the static nature of structs helps Mojo run your code faster. The program knows exactly where to find the struct’s information and how to use it without any extra steps or delays at runtime. Mojo’s structs also work really well with features you might already know from Python, like operator overloading (which lets you change how math symbols like + and - work with your own data, using special methods). + - As mentioned above, all Mojo's standard types (Int, String, etc.) are made using structs, rather than being hardwired into the language itself. This gives you more flexibility and control when writing your code, and it means you can define your own types with all the same capabilities (there's no special treatment for the standard library types). Int String ## Special methods​ Special methods (or "dunder methods") such as __init__() are pre-determined method names that you can define in a struct to perform a special task. __init__() Although it's possible to call special methods with their method names, the point is that you never should, because Mojo automatically invokes them in circumstances where they're needed (which is why they're also called "magic methods"). For example, Mojo calls the __init__() method when you create an instance of the struct; and when Mojo destroys the instance, it calls the __del__() method (if it exists). __init__() __del__() Even operator behaviors that appear built-in (+, <, ==, |, and so on) are implemented as special methods that Mojo implicitly calls upon to perform operations or comparisons on the type that the operator is applied to. + < == | Mojo supports a long list of special methods; far too many to discuss here, but they generally match all of Python's special methods and they usually accomplish one of two types of tasks: - Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). - Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. Operator overloading: A lot of special methods are designed to overload operators such as < (less-than), + (add), and | (or) so they work appropriately with each type. For example, look at the methods listed for Mojo's Int type. One such method is __lt__(), which Mojo calls to perform a less-than comparison between two integers (for example, num1 < num2). < + | Int __lt__() num1 < num2 Lifecycle event handling: These special methods deal with the lifecycle and value ownership of an instance. For example, __init__() and __del__() demarcate the beginning and end of an instance lifetime, and other special methods define the behavior for other lifecycle events such as how to copy or move a value. __init__() __del__() You can learn all about the lifecycle special methods in the Value lifecycle section. However, most structs are simple aggregations of other types, so unless your type requires custom behaviors when an instance is created, copied, moved, or destroyed, you can synthesize the essential lifecycle methods you need (and save yourself some time) by adding the @value decorator. @value ### @value decorator​ @value When you add the @value decorator to a struct, Mojo will synthesize the essential lifecycle methods so your object provides full value semantics. Specifically, it generates the __init__(), __copyinit__(), and __moveinit__() methods, which allow you to construct, copy, and move your struct type in a manner that's value semantic and compatible with Mojo's ownership model. @value __init__() __copyinit__() __moveinit__() For example: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo will notice that you don't have a member-wise initializer, a move constructor, or a copy constructor, and it will synthesize these for you as if you had written: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Without the copy and move constructors, the following code would not work because Mojo would not know how to copy an instance of MyPet: MyPet ```mojo var dog = MyPet("Charlie", 5)var poodle = dogprint(poodle.name) ``` When you add the @value decorator, Mojo synthesizes each special method above only if it doesn't exist already. That is, you can still implement a custom version of each method. @value In addition to the inout argument convention you already saw with __init__(), this code also introduces owned, which is another argument convention that ensures the argument has unique ownership of the value. For more detail, see the section about value ownership. inout __init__() owned - Struct definition - MethodsStatic methods - Static methods - Structs compared to classes - Special methods@value decorator - @value decorator - Static methods - @value decorator @value - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/value - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@value # @value You can add the @value decorator on a struct to generate boilerplate lifecycle methods, including the member-wise __init__() constructor, __copyinit__() copy constructor, and __moveinit__() move constructor. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have any constructors and it synthesizes them for you, the result being as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. @value For more information about these lifecycle methods, read Life of a value. - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/packages#mojo-modules - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Modules and packages # Modules and packages Mojo provides a packaging system that allows you to organize and compile code libraries into importable files. This page introduces the necessary concepts about how to organize your code into modules and packages (which is a lot like Python), and shows you how to create a packaged binary with the mojo package command. mojo package ## Mojo modules​ To understand Mojo packages, you first need to understand Mojo modules. A Mojo module is a single Mojo source file that includes code suitable for use by other files that import it. For example, you can create a module to define a struct such as this one: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` Notice that this code has no main() function, so you can't execute mymodule.mojo. However, you can import this into another file with a main() function and use it there. main() mymodule.mojo main() For example, here's how you can import MyPair into a file named main.mojo that's in the same directory as mymodule.mojo: MyPair main.mojo mymodule.mojo ```mojo from mymodule import MyPairfn main(): var mine = MyPair(2, 4) mine.dump() ``` Alternatively, you can import the whole module and then access its members through the module name. For example: ```mojo import mymodulefn main(): var mine = mymodule.MyPair(2, 4) mine.dump() ``` You can also create an alias for an imported member with as, like this: as ```mojo import mymodule as myfn main(): var mine = my.MyPair(2, 4) mine.dump() ``` In this example, it only works when mymodule.mojo is in the same directory as main.mojo. Currently, you can't import .mojo files as modules if they reside in other directories. That is, unless you treat the directory as a Mojo package, as described in the next section. mymodule.mojo main.mojo .mojo A Mojo module may include a main() function and may also be executable, but that's generally not the practice and modules typically include APIs to be imported and used in other Mojo programs. main() ## Mojo packages​ A Mojo package is just a collection of Mojo modules in a directory that includes an __init__.mojo file. By organizing modules together in a directory, you can then import all the modules together or individually. Optionally, you can also compile the package into a .mojopkg or .📦 file that's easier to share and still compatible with other system architectures. __init__.mojo .mojopkg .📦 You can import a package and its modules either directly from source files or from a compiled .mojopkg/.📦 file. It makes no real difference to Mojo which way you import a package. When importing from source files, the directory name works as the package name, whereas when importing from a compiled package, the filename is the package name (which you specify with the mojo package command—it can differ from the directory name). .mojopkg .📦 mojo package For example, consider a project with these files: ```mojo main.mojomypackage/ __init__.mojo mymodule.mojo ``` mymodule.mojo is the same code from examples above (with the MyPair struct) and __init__.mojo is empty. mymodule.mojo MyPair __init__.mojo In this case, the main.mojo file can now import MyPair through the package name like this: main.mojo MyPair ```mojo from mypackage.mymodule import MyPairfn main(): var mine = MyPair(2, 4) mine.dump() ``` Notice that the __init__.mojo is crucial here. If you delete it, then Mojo doesn't recognize the directory as a package and it cannot import mymodule. __init__.mojo mymodule Then, let's say you don't want the mypackage source code in the same location as main.mojo. So, you can compile it into a package file like this: mypackage main.mojo ```mojo mojo package mypackage -o mypack.mojopkg ``` A .mojopkg file contains non-elaborated code, so you can share it across systems. The code becomes an architecture-specific executable only after it's imported into a Mojo program that's then compiled with mojo build. .mojopkg mojo build Now, you can move the mypackage source somewhere else, and the project files now look like this: mypackage ```mojo main.mojomypack.mojopkg ``` Because we named the package file different from the directory, we need to fix the import statement and it all works the same: ```mojo from mypack.mymodule import MyPair ``` If you want to rename your package, you cannot simply edit the .mojopkg or .📦 filename, because the package name is encoded in the file. You must instead run mojo package again to specify a new name. .mojopkg .📦 mojo package ### The __init__ file​ __init__ As mentioned above, the __init__.mojo file is required to indicate that a directory should be treated as a Mojo package, and it can be empty. __init__.mojo Currently, top-level code is not supported in .mojo files, so unlike Python, you can't write code in __init__.mojo that executes upon import. You can, however, add structs and functions, which you can then import from the package name. .mojo __init__.mojo However, instead of adding APIs in the __init__.mojo file, you can import module members, which has the same effect by making your APIs accessible from the package name, instead of requiring the <package_name>.<module_name> notation. __init__.mojo <package_name>.<module_name> For example, again let's say you have these files: ```mojo main.mojomypackage/ __init__.mojo mymodule.mojo ``` Let's now add the following line in __init__.mojo: __init__.mojo ```mojo from .mymodule import MyPair ``` That's all that's in there. Now, we can simplify the import statement in main.mojo like this: main.mojo ```mojo from mypackage import MyPair ``` This feature explains why some members in the Mojo standard library can be imported from their package name, while others required the <package_name>.<module_name> notation. For example, the functional module resides in the algorithm package, so you can import members of that module (such as the map() function) like this: <package_name>.<module_name> functional algorithm map() ```mojo from algorithm.functional import map ``` However, the algorithm/__init__.mojo file also includes these lines: algorithm/__init__.mojo ```mojo from .functional import *from .reduction import * ``` So you can actually import anything from functional or reduction simply by naming the package. That is, you can drop the functional name from the import statement, and it also works: functional reduction functional ```mojo from algorithm import map ``` Which modules in the standard library are imported to the package scope varies, and is subject to change. Refer to the documentation for each module to see how you can import its members. - Mojo modules - Mojo packagesThe __init__ file - The __init__ file - The __init__ file __init__ - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/packages#mojo-packages - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Modules and packages # Modules and packages Mojo provides a packaging system that allows you to organize and compile code libraries into importable files. This page introduces the necessary concepts about how to organize your code into modules and packages (which is a lot like Python), and shows you how to create a packaged binary with the mojo package command. mojo package ## Mojo modules​ To understand Mojo packages, you first need to understand Mojo modules. A Mojo module is a single Mojo source file that includes code suitable for use by other files that import it. For example, you can create a module to define a struct such as this one: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` Notice that this code has no main() function, so you can't execute mymodule.mojo. However, you can import this into another file with a main() function and use it there. main() mymodule.mojo main() For example, here's how you can import MyPair into a file named main.mojo that's in the same directory as mymodule.mojo: MyPair main.mojo mymodule.mojo ```mojo from mymodule import MyPairfn main(): var mine = MyPair(2, 4) mine.dump() ``` Alternatively, you can import the whole module and then access its members through the module name. For example: ```mojo import mymodulefn main(): var mine = mymodule.MyPair(2, 4) mine.dump() ``` You can also create an alias for an imported member with as, like this: as ```mojo import mymodule as myfn main(): var mine = my.MyPair(2, 4) mine.dump() ``` In this example, it only works when mymodule.mojo is in the same directory as main.mojo. Currently, you can't import .mojo files as modules if they reside in other directories. That is, unless you treat the directory as a Mojo package, as described in the next section. mymodule.mojo main.mojo .mojo A Mojo module may include a main() function and may also be executable, but that's generally not the practice and modules typically include APIs to be imported and used in other Mojo programs. main() ## Mojo packages​ A Mojo package is just a collection of Mojo modules in a directory that includes an __init__.mojo file. By organizing modules together in a directory, you can then import all the modules together or individually. Optionally, you can also compile the package into a .mojopkg or .📦 file that's easier to share and still compatible with other system architectures. __init__.mojo .mojopkg .📦 You can import a package and its modules either directly from source files or from a compiled .mojopkg/.📦 file. It makes no real difference to Mojo which way you import a package. When importing from source files, the directory name works as the package name, whereas when importing from a compiled package, the filename is the package name (which you specify with the mojo package command—it can differ from the directory name). .mojopkg .📦 mojo package For example, consider a project with these files: ```mojo main.mojomypackage/ __init__.mojo mymodule.mojo ``` mymodule.mojo is the same code from examples above (with the MyPair struct) and __init__.mojo is empty. mymodule.mojo MyPair __init__.mojo In this case, the main.mojo file can now import MyPair through the package name like this: main.mojo MyPair ```mojo from mypackage.mymodule import MyPairfn main(): var mine = MyPair(2, 4) mine.dump() ``` Notice that the __init__.mojo is crucial here. If you delete it, then Mojo doesn't recognize the directory as a package and it cannot import mymodule. __init__.mojo mymodule Then, let's say you don't want the mypackage source code in the same location as main.mojo. So, you can compile it into a package file like this: mypackage main.mojo ```mojo mojo package mypackage -o mypack.mojopkg ``` A .mojopkg file contains non-elaborated code, so you can share it across systems. The code becomes an architecture-specific executable only after it's imported into a Mojo program that's then compiled with mojo build. .mojopkg mojo build Now, you can move the mypackage source somewhere else, and the project files now look like this: mypackage ```mojo main.mojomypack.mojopkg ``` Because we named the package file different from the directory, we need to fix the import statement and it all works the same: ```mojo from mypack.mymodule import MyPair ``` If you want to rename your package, you cannot simply edit the .mojopkg or .📦 filename, because the package name is encoded in the file. You must instead run mojo package again to specify a new name. .mojopkg .📦 mojo package ### The __init__ file​ __init__ As mentioned above, the __init__.mojo file is required to indicate that a directory should be treated as a Mojo package, and it can be empty. __init__.mojo Currently, top-level code is not supported in .mojo files, so unlike Python, you can't write code in __init__.mojo that executes upon import. You can, however, add structs and functions, which you can then import from the package name. .mojo __init__.mojo However, instead of adding APIs in the __init__.mojo file, you can import module members, which has the same effect by making your APIs accessible from the package name, instead of requiring the <package_name>.<module_name> notation. __init__.mojo <package_name>.<module_name> For example, again let's say you have these files: ```mojo main.mojomypackage/ __init__.mojo mymodule.mojo ``` Let's now add the following line in __init__.mojo: __init__.mojo ```mojo from .mymodule import MyPair ``` That's all that's in there. Now, we can simplify the import statement in main.mojo like this: main.mojo ```mojo from mypackage import MyPair ``` This feature explains why some members in the Mojo standard library can be imported from their package name, while others required the <package_name>.<module_name> notation. For example, the functional module resides in the algorithm package, so you can import members of that module (such as the map() function) like this: <package_name>.<module_name> functional algorithm map() ```mojo from algorithm.functional import map ``` However, the algorithm/__init__.mojo file also includes these lines: algorithm/__init__.mojo ```mojo from .functional import *from .reduction import * ``` So you can actually import anything from functional or reduction simply by naming the package. That is, you can drop the functional name from the import statement, and it also works: functional reduction functional ```mojo from algorithm import map ``` Which modules in the standard library are imported to the package scope varies, and is subject to change. Refer to the documentation for each module to see how you can import its members. - Mojo modules - Mojo packagesThe __init__ file - The __init__ file - The __init__ file __init__ - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/packages#the-__init__-file - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Language basics - /Modules and packages # Modules and packages Mojo provides a packaging system that allows you to organize and compile code libraries into importable files. This page introduces the necessary concepts about how to organize your code into modules and packages (which is a lot like Python), and shows you how to create a packaged binary with the mojo package command. mojo package ## Mojo modules​ To understand Mojo packages, you first need to understand Mojo modules. A Mojo module is a single Mojo source file that includes code suitable for use by other files that import it. For example, you can create a module to define a struct such as this one: ```mojo struct MyPair: var first: Int var second: Int fn __init__(inout self, first: Int, second: Int): self.first = first self.second = second fn dump(self): print(self.first, self.second) ``` Notice that this code has no main() function, so you can't execute mymodule.mojo. However, you can import this into another file with a main() function and use it there. main() mymodule.mojo main() For example, here's how you can import MyPair into a file named main.mojo that's in the same directory as mymodule.mojo: MyPair main.mojo mymodule.mojo ```mojo from mymodule import MyPairfn main(): var mine = MyPair(2, 4) mine.dump() ``` Alternatively, you can import the whole module and then access its members through the module name. For example: ```mojo import mymodulefn main(): var mine = mymodule.MyPair(2, 4) mine.dump() ``` You can also create an alias for an imported member with as, like this: as ```mojo import mymodule as myfn main(): var mine = my.MyPair(2, 4) mine.dump() ``` In this example, it only works when mymodule.mojo is in the same directory as main.mojo. Currently, you can't import .mojo files as modules if they reside in other directories. That is, unless you treat the directory as a Mojo package, as described in the next section. mymodule.mojo main.mojo .mojo A Mojo module may include a main() function and may also be executable, but that's generally not the practice and modules typically include APIs to be imported and used in other Mojo programs. main() ## Mojo packages​ A Mojo package is just a collection of Mojo modules in a directory that includes an __init__.mojo file. By organizing modules together in a directory, you can then import all the modules together or individually. Optionally, you can also compile the package into a .mojopkg or .📦 file that's easier to share and still compatible with other system architectures. __init__.mojo .mojopkg .📦 You can import a package and its modules either directly from source files or from a compiled .mojopkg/.📦 file. It makes no real difference to Mojo which way you import a package. When importing from source files, the directory name works as the package name, whereas when importing from a compiled package, the filename is the package name (which you specify with the mojo package command—it can differ from the directory name). .mojopkg .📦 mojo package For example, consider a project with these files: ```mojo main.mojomypackage/ __init__.mojo mymodule.mojo ``` mymodule.mojo is the same code from examples above (with the MyPair struct) and __init__.mojo is empty. mymodule.mojo MyPair __init__.mojo In this case, the main.mojo file can now import MyPair through the package name like this: main.mojo MyPair ```mojo from mypackage.mymodule import MyPairfn main(): var mine = MyPair(2, 4) mine.dump() ``` Notice that the __init__.mojo is crucial here. If you delete it, then Mojo doesn't recognize the directory as a package and it cannot import mymodule. __init__.mojo mymodule Then, let's say you don't want the mypackage source code in the same location as main.mojo. So, you can compile it into a package file like this: mypackage main.mojo ```mojo mojo package mypackage -o mypack.mojopkg ``` A .mojopkg file contains non-elaborated code, so you can share it across systems. The code becomes an architecture-specific executable only after it's imported into a Mojo program that's then compiled with mojo build. .mojopkg mojo build Now, you can move the mypackage source somewhere else, and the project files now look like this: mypackage ```mojo main.mojomypack.mojopkg ``` Because we named the package file different from the directory, we need to fix the import statement and it all works the same: ```mojo from mypack.mymodule import MyPair ``` If you want to rename your package, you cannot simply edit the .mojopkg or .📦 filename, because the package name is encoded in the file. You must instead run mojo package again to specify a new name. .mojopkg .📦 mojo package ### The __init__ file​ __init__ As mentioned above, the __init__.mojo file is required to indicate that a directory should be treated as a Mojo package, and it can be empty. __init__.mojo Currently, top-level code is not supported in .mojo files, so unlike Python, you can't write code in __init__.mojo that executes upon import. You can, however, add structs and functions, which you can then import from the package name. .mojo __init__.mojo However, instead of adding APIs in the __init__.mojo file, you can import module members, which has the same effect by making your APIs accessible from the package name, instead of requiring the <package_name>.<module_name> notation. __init__.mojo <package_name>.<module_name> For example, again let's say you have these files: ```mojo main.mojomypackage/ __init__.mojo mymodule.mojo ``` Let's now add the following line in __init__.mojo: __init__.mojo ```mojo from .mymodule import MyPair ``` That's all that's in there. Now, we can simplify the import statement in main.mojo like this: main.mojo ```mojo from mypackage import MyPair ``` This feature explains why some members in the Mojo standard library can be imported from their package name, while others required the <package_name>.<module_name> notation. For example, the functional module resides in the algorithm package, so you can import members of that module (such as the map() function) like this: <package_name>.<module_name> functional algorithm map() ```mojo from algorithm.functional import map ``` However, the algorithm/__init__.mojo file also includes these lines: algorithm/__init__.mojo ```mojo from .functional import *from .reduction import * ``` So you can actually import anything from functional or reduction simply by naming the package. That is, you can drop the functional name from the import statement, and it also works: functional reduction functional ```mojo from algorithm import map ``` Which modules in the standard library are imported to the package scope varies, and is subject to change. Refer to the documentation for each module to see how you can import its members. - Mojo modules - Mojo packagesThe __init__ file - The __init__ file - The __init__ file __init__ - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/#stack-and-heap-overview - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Intro to value ownership # Intro to value ownership A program is nothing without data, and all modern programming languages store data in one of two places: the call stack and the heap (also sometimes in CPU registers, but we won't get into that here). However, each language reads and writes data a bit differently—sometimes very differently. So in the following sections, we'll explain how Mojo manages memory in your programs and how this affects the way you write Mojo code. ## Stack and heap overview​ In general, all programming languages use a call stack the same way: When a function is called, the compiler allocates a block of memory on the stack that is exactly the size required to store the execution logic and fixed-size local values. When another function is called, its data is likewise added to the top of the stack. When a function is done, all its data in the stack is destroyed so that memory becomes available for other code. Notice that we said only "fixed-size local values" are stored in the stack. Dynamically-sized values that can change in size at runtime are instead stored in the heap, which is a much larger region of memory that allows for dynamic memory access at runtime. Technically, a local variable for such a value is still stored in the call stack, but its value is a fixed-size pointer to the real value on the heap. Additionally, values that need to outlive the lifetime of a function (such as an array that's passed between functions and should not be copied) are stored in the heap, because heap memory is accessible from anywhere in the call stack, even after the function that created it is removed from the stack. This sort of situation—in which a heap-allocated value is used by multiple functions—is where most memory errors occur, and it's where memory management strategies vary the most between programming languages. ## Memory management strategies​ Because memory is limited, it's important that programs remove unused data from the heap ("free" the memory) as quickly as possible. Figuring out when to free that memory is pretty complicated. Some programming languages try to hide the complexities of memory management from you by utilizing a "garbage collector" process that tracks all memory usage and deallocates unused heap memory periodically (also known as automatic memory management). A significant benefit of this method is that it relieves developers from the burden of manual memory management, generally avoiding more errors and making developers more productive. However, it incurs a performance cost because the garbage collector interrupts the program's execution, and it might not reclaim memory very quickly. Other languages require that you manually free data that's allocated on the heap. When done properly, this makes programs execute quickly, because there's no processing time consumed by a garbage collector. However, the challenge with this approach is that programmers make mistakes, especially when multiple parts of the program need access to the same memory—it becomes difficult to know which part of the program "owns" the data and must deallocate it. Programmers might accidentally deallocate data before the program is done with it (causing "use-after-free" errors), or they might deallocate it twice ("double free" errors), or they might never deallocate it ("leaked memory" errors). Mistakes like these and others can have catastrophic results for the program, and these bugs are often hard to track down, making it especially important that they don't occur in the first place. Mojo uses a third approach called "ownership" that relies on a collection of rules that programmers must follow when passing values. The rules ensure there is only one "owner" for each chunk of memory at a time, and that the memory is deallocated accordingly. In this way, Mojo automatically allocates and deallocates heap memory for you, but it does so in a way that's deterministic and safe from errors such as use-after-free, double-free and memory leaks. Plus, it does so with a very low performance overhead. Mojo's value ownership model provides an excellent balance of programming productivity and strong memory safety. It only requires that you learn some new syntax and a few rules about how to share access to memory within your program. But before we explain the rules and syntax for Mojo's value ownership model, you first need to understand value semantics. - Stack and heap overview - Memory management strategies - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/#memory-management-strategies - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Intro to value ownership # Intro to value ownership A program is nothing without data, and all modern programming languages store data in one of two places: the call stack and the heap (also sometimes in CPU registers, but we won't get into that here). However, each language reads and writes data a bit differently—sometimes very differently. So in the following sections, we'll explain how Mojo manages memory in your programs and how this affects the way you write Mojo code. ## Stack and heap overview​ In general, all programming languages use a call stack the same way: When a function is called, the compiler allocates a block of memory on the stack that is exactly the size required to store the execution logic and fixed-size local values. When another function is called, its data is likewise added to the top of the stack. When a function is done, all its data in the stack is destroyed so that memory becomes available for other code. Notice that we said only "fixed-size local values" are stored in the stack. Dynamically-sized values that can change in size at runtime are instead stored in the heap, which is a much larger region of memory that allows for dynamic memory access at runtime. Technically, a local variable for such a value is still stored in the call stack, but its value is a fixed-size pointer to the real value on the heap. Additionally, values that need to outlive the lifetime of a function (such as an array that's passed between functions and should not be copied) are stored in the heap, because heap memory is accessible from anywhere in the call stack, even after the function that created it is removed from the stack. This sort of situation—in which a heap-allocated value is used by multiple functions—is where most memory errors occur, and it's where memory management strategies vary the most between programming languages. ## Memory management strategies​ Because memory is limited, it's important that programs remove unused data from the heap ("free" the memory) as quickly as possible. Figuring out when to free that memory is pretty complicated. Some programming languages try to hide the complexities of memory management from you by utilizing a "garbage collector" process that tracks all memory usage and deallocates unused heap memory periodically (also known as automatic memory management). A significant benefit of this method is that it relieves developers from the burden of manual memory management, generally avoiding more errors and making developers more productive. However, it incurs a performance cost because the garbage collector interrupts the program's execution, and it might not reclaim memory very quickly. Other languages require that you manually free data that's allocated on the heap. When done properly, this makes programs execute quickly, because there's no processing time consumed by a garbage collector. However, the challenge with this approach is that programmers make mistakes, especially when multiple parts of the program need access to the same memory—it becomes difficult to know which part of the program "owns" the data and must deallocate it. Programmers might accidentally deallocate data before the program is done with it (causing "use-after-free" errors), or they might deallocate it twice ("double free" errors), or they might never deallocate it ("leaked memory" errors). Mistakes like these and others can have catastrophic results for the program, and these bugs are often hard to track down, making it especially important that they don't occur in the first place. Mojo uses a third approach called "ownership" that relies on a collection of rules that programmers must follow when passing values. The rules ensure there is only one "owner" for each chunk of memory at a time, and that the memory is deallocated accordingly. In this way, Mojo automatically allocates and deallocates heap memory for you, but it does so in a way that's deterministic and safe from errors such as use-after-free, double-free and memory leaks. Plus, it does so with a very low performance overhead. Mojo's value ownership model provides an excellent balance of programming productivity and strong memory safety. It only requires that you learn some new syntax and a few rules about how to share access to memory within your program. But before we explain the rules and syntax for Mojo's value ownership model, you first need to understand value semantics. - Stack and heap overview - Memory management strategies - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/value-semantics#intro-to-value-semantics - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Value semantics # Value semantics Mojo doesn't enforce value semantics or reference semantics. It supports them both and allows each type to define how it is created, copied, and moved (if at all). So, if you're building your own type, you can implement it to support value semantics, reference semantics, or a bit of both. That said, Mojo is designed with argument behaviors that default to value semantics, and it provides tight controls for reference semantics that avoid memory errors. The controls over reference semantics are provided by the value ownership model, but before we get into the syntax and rules for that, it's important that you understand the principles of value semantics. Generally, it means that each variable has unique access to a value, and any code outside the scope of that variable cannot modify its value. ## Intro to value semantics​ In the most basic situation, sharing a value-semantic type means that you create a copy of the value. This is also known as "pass by value." For example, consider this code: ```mojo x = 1y = xy += 1print(x)print(y) ``` We assigned the value of x to y, which creates the value for y by making a copy of x. When we increment y, the value of x doesn't change. Each variable has exclusive ownership of a value. x y y x y x Whereas, if a type instead uses reference semantics, then y would point to the same value as x, and incrementing either one would affect the value for both. Neither x nor y would "own" the value, and any variable would be allowed to reference it and mutate it. y x x y Here's another example with a function: ```mojo def add_one(y: Int): y += 1 print(y)x = 1add_one(x)print(x) ``` Again, the y value is a copy and the function cannot modify the original x value. y x If you're familiar with Python, this is probably familiar so far, because the code above behaves the same in Python. However, Python is not value semantic. It gets complicated, but let's consider a situation in which you call a Python function and pass an object with a pointer to a heap-allocated value. Python actually gives that function a reference to your object, which allows the function to mutate the heap-allocated value. This can cause nasty bugs if you're not careful, because the function might incorrectly assume it has unique ownership of that object. In Mojo, the default behavior for all function arguments is to use value semantics. If the function wants to modify the value of an incoming argument, then it must explicitly declare so, which avoids accidental mutations of the original value. All Mojo types passed to a def function can be treated as mutable, which maintains the expected mutability behavior from Python. But by default, it is mutating a uniquely-owned value, not the original value. def For example, when you pass an instance of a SIMD vector to a def function it creates a unique copy of all values. Thus, if we modify the argument in the function, the original value is unchanged: SIMD def ```mojo def update_simd(t: SIMD[DType.int32, 4]): t[0] = 9 print(t)v = SIMD[DType.int32, 4](1, 2, 3, 4)update_simd(v)print(v) ``` If this were Python code, the function would modify the original object, because Python shares a reference to the original object. ### Value semantics in def vs fn​ def fn The arguments above are mutable because a def function has special treatment for the default borrowed argument convention. def borrowed Whereas, fn functions always receive borrowed arguments as immutable references. This is a memory optimization to avoid making unnecessary copies. fn borrowed For example, let's create another function with the fn declaration. In this case, the y argument is immutable by default, so if the function wants to modify the value in the local scope, it needs to make a local copy: fn y ```mojo fn add_two(y: Int): # y += 2 # This will cause a compiler error because `y` is immutable # We can instead make an explicit copy: var z = y z += 2 print(z)x = 1add_two(x)print(x) ``` This is all consistent with value semantics because each variable maintains unique ownership of its value. The way the fn function receives the y value is a "look but don't touch" approach to value semantics. This is also a more memory-efficient approach when dealing with memory-intensive arguments, because Mojo doesn't make any copies unless we explicitly make the copies ourselves. fn y Thus, the default behavior for def and fn arguments is fully value semantic: arguments are either copies or immutable references, and any living variable from the callee is not affected by the function. def fn But we must also allow reference semantics (mutable references) because it's how we build performant and memory-efficient programs (making copies of everything gets really expensive). The challenge is to introduce reference semantics in a way that does not disturb the predictability and safety of value semantics. The way we do that in Mojo is, instead of enforcing that every variable have "exclusive access" to a value, we ensure that every value has an "exclusive owner," and destroy each value when the lifetime of its owner ends. On the next page about value ownership, you'll learn how to modify the default argument conventions, and safely use reference semantics so every value has only one owner at a time. ## Python-style reference semantics​ If you will always use strict type declarations, you can skip this section because it only applies to Mojo code using def functions without type declarations (or values declared as object). def object As we said at the top of this page, Mojo doesn't enforce value semantics or reference semantics. It's up to each type author to decide how an instance of their type should be created, copied, and moved (see Value lifecycle). Thus, in order to provide compatibility with Python, Mojo's object type is designed to support Python's style of argument passing for functions, which is different from the other types in Mojo. object Python's argument-passing convention is called "pass by object reference." This means when you pass a variable to a Python function, you actually pass a reference to the object, as a value (so it's not strictly reference semantics). Passing the object reference "as a value" means that the argument name is just a container that acts like an alias to the original object. If you reassign the argument inside the function, it does not affect the caller's original value. However, if you modify the object itself (such as call append() on a list), the change is visible to the original object outside the function. append() For example, here's a Python function that receives a list and modifies it: ```mojo %%pythondef modify_list(l): l.append(3) print("func:", l)ar = [1, 2]modify_list(ar)print("orig:", ar) ``` In this example, it looks like the list is "passed by reference" because l modifies the original value. l However, if the Python function instead assigns a value to l, it does not affect the original value: l ```mojo %%pythondef change_list(l): l = [3, 4] print("func:", l)ar = [1, 2]change_list(ar)print("orig:", ar) ``` This demonstrates how a Python argument holds the object reference as a value: the function can mutate the original value, but it can also assign a new object to the argument name. ### Pass by object reference in Mojo​ Although we haven't finished implementing the object type to represent any Mojo type, our intention is to do so, and enable "pass by object reference" as described above for all dynamic types in a def function. object def That means you can have dynamic typing and "pass by object reference" behavior by simply writing your Mojo code like Python: - Use def function declarations. - Don't declare argument types. def Mojo is not a complete superset of Python yet, and there is a lot to do in this department before Mojo supports all of Python's types and behaviors. As such, this is a topic that also still needs a lot of documentation. - Intro to value semanticsValue semantics in def vs fn - Value semantics in def vs fn - Python-style reference semanticsPass by object reference in Mojo - Pass by object reference in Mojo - Value semantics in def vs fn def fn - Pass by object reference in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/value-semantics#value-semantics-in-def-vs-fn - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Value semantics # Value semantics Mojo doesn't enforce value semantics or reference semantics. It supports them both and allows each type to define how it is created, copied, and moved (if at all). So, if you're building your own type, you can implement it to support value semantics, reference semantics, or a bit of both. That said, Mojo is designed with argument behaviors that default to value semantics, and it provides tight controls for reference semantics that avoid memory errors. The controls over reference semantics are provided by the value ownership model, but before we get into the syntax and rules for that, it's important that you understand the principles of value semantics. Generally, it means that each variable has unique access to a value, and any code outside the scope of that variable cannot modify its value. ## Intro to value semantics​ In the most basic situation, sharing a value-semantic type means that you create a copy of the value. This is also known as "pass by value." For example, consider this code: ```mojo x = 1y = xy += 1print(x)print(y) ``` We assigned the value of x to y, which creates the value for y by making a copy of x. When we increment y, the value of x doesn't change. Each variable has exclusive ownership of a value. x y y x y x Whereas, if a type instead uses reference semantics, then y would point to the same value as x, and incrementing either one would affect the value for both. Neither x nor y would "own" the value, and any variable would be allowed to reference it and mutate it. y x x y Here's another example with a function: ```mojo def add_one(y: Int): y += 1 print(y)x = 1add_one(x)print(x) ``` Again, the y value is a copy and the function cannot modify the original x value. y x If you're familiar with Python, this is probably familiar so far, because the code above behaves the same in Python. However, Python is not value semantic. It gets complicated, but let's consider a situation in which you call a Python function and pass an object with a pointer to a heap-allocated value. Python actually gives that function a reference to your object, which allows the function to mutate the heap-allocated value. This can cause nasty bugs if you're not careful, because the function might incorrectly assume it has unique ownership of that object. In Mojo, the default behavior for all function arguments is to use value semantics. If the function wants to modify the value of an incoming argument, then it must explicitly declare so, which avoids accidental mutations of the original value. All Mojo types passed to a def function can be treated as mutable, which maintains the expected mutability behavior from Python. But by default, it is mutating a uniquely-owned value, not the original value. def For example, when you pass an instance of a SIMD vector to a def function it creates a unique copy of all values. Thus, if we modify the argument in the function, the original value is unchanged: SIMD def ```mojo def update_simd(t: SIMD[DType.int32, 4]): t[0] = 9 print(t)v = SIMD[DType.int32, 4](1, 2, 3, 4)update_simd(v)print(v) ``` If this were Python code, the function would modify the original object, because Python shares a reference to the original object. ### Value semantics in def vs fn​ def fn The arguments above are mutable because a def function has special treatment for the default borrowed argument convention. def borrowed Whereas, fn functions always receive borrowed arguments as immutable references. This is a memory optimization to avoid making unnecessary copies. fn borrowed For example, let's create another function with the fn declaration. In this case, the y argument is immutable by default, so if the function wants to modify the value in the local scope, it needs to make a local copy: fn y ```mojo fn add_two(y: Int): # y += 2 # This will cause a compiler error because `y` is immutable # We can instead make an explicit copy: var z = y z += 2 print(z)x = 1add_two(x)print(x) ``` This is all consistent with value semantics because each variable maintains unique ownership of its value. The way the fn function receives the y value is a "look but don't touch" approach to value semantics. This is also a more memory-efficient approach when dealing with memory-intensive arguments, because Mojo doesn't make any copies unless we explicitly make the copies ourselves. fn y Thus, the default behavior for def and fn arguments is fully value semantic: arguments are either copies or immutable references, and any living variable from the callee is not affected by the function. def fn But we must also allow reference semantics (mutable references) because it's how we build performant and memory-efficient programs (making copies of everything gets really expensive). The challenge is to introduce reference semantics in a way that does not disturb the predictability and safety of value semantics. The way we do that in Mojo is, instead of enforcing that every variable have "exclusive access" to a value, we ensure that every value has an "exclusive owner," and destroy each value when the lifetime of its owner ends. On the next page about value ownership, you'll learn how to modify the default argument conventions, and safely use reference semantics so every value has only one owner at a time. ## Python-style reference semantics​ If you will always use strict type declarations, you can skip this section because it only applies to Mojo code using def functions without type declarations (or values declared as object). def object As we said at the top of this page, Mojo doesn't enforce value semantics or reference semantics. It's up to each type author to decide how an instance of their type should be created, copied, and moved (see Value lifecycle). Thus, in order to provide compatibility with Python, Mojo's object type is designed to support Python's style of argument passing for functions, which is different from the other types in Mojo. object Python's argument-passing convention is called "pass by object reference." This means when you pass a variable to a Python function, you actually pass a reference to the object, as a value (so it's not strictly reference semantics). Passing the object reference "as a value" means that the argument name is just a container that acts like an alias to the original object. If you reassign the argument inside the function, it does not affect the caller's original value. However, if you modify the object itself (such as call append() on a list), the change is visible to the original object outside the function. append() For example, here's a Python function that receives a list and modifies it: ```mojo %%pythondef modify_list(l): l.append(3) print("func:", l)ar = [1, 2]modify_list(ar)print("orig:", ar) ``` In this example, it looks like the list is "passed by reference" because l modifies the original value. l However, if the Python function instead assigns a value to l, it does not affect the original value: l ```mojo %%pythondef change_list(l): l = [3, 4] print("func:", l)ar = [1, 2]change_list(ar)print("orig:", ar) ``` This demonstrates how a Python argument holds the object reference as a value: the function can mutate the original value, but it can also assign a new object to the argument name. ### Pass by object reference in Mojo​ Although we haven't finished implementing the object type to represent any Mojo type, our intention is to do so, and enable "pass by object reference" as described above for all dynamic types in a def function. object def That means you can have dynamic typing and "pass by object reference" behavior by simply writing your Mojo code like Python: - Use def function declarations. - Don't declare argument types. def Mojo is not a complete superset of Python yet, and there is a lot to do in this department before Mojo supports all of Python's types and behaviors. As such, this is a topic that also still needs a lot of documentation. - Intro to value semanticsValue semantics in def vs fn - Value semantics in def vs fn - Python-style reference semanticsPass by object reference in Mojo - Pass by object reference in Mojo - Value semantics in def vs fn def fn - Pass by object reference in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/value-semantics#pass-by-object-reference-in-mojo - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Value semantics # Value semantics Mojo doesn't enforce value semantics or reference semantics. It supports them both and allows each type to define how it is created, copied, and moved (if at all). So, if you're building your own type, you can implement it to support value semantics, reference semantics, or a bit of both. That said, Mojo is designed with argument behaviors that default to value semantics, and it provides tight controls for reference semantics that avoid memory errors. The controls over reference semantics are provided by the value ownership model, but before we get into the syntax and rules for that, it's important that you understand the principles of value semantics. Generally, it means that each variable has unique access to a value, and any code outside the scope of that variable cannot modify its value. ## Intro to value semantics​ In the most basic situation, sharing a value-semantic type means that you create a copy of the value. This is also known as "pass by value." For example, consider this code: ```mojo x = 1y = xy += 1print(x)print(y) ``` We assigned the value of x to y, which creates the value for y by making a copy of x. When we increment y, the value of x doesn't change. Each variable has exclusive ownership of a value. x y y x y x Whereas, if a type instead uses reference semantics, then y would point to the same value as x, and incrementing either one would affect the value for both. Neither x nor y would "own" the value, and any variable would be allowed to reference it and mutate it. y x x y Here's another example with a function: ```mojo def add_one(y: Int): y += 1 print(y)x = 1add_one(x)print(x) ``` Again, the y value is a copy and the function cannot modify the original x value. y x If you're familiar with Python, this is probably familiar so far, because the code above behaves the same in Python. However, Python is not value semantic. It gets complicated, but let's consider a situation in which you call a Python function and pass an object with a pointer to a heap-allocated value. Python actually gives that function a reference to your object, which allows the function to mutate the heap-allocated value. This can cause nasty bugs if you're not careful, because the function might incorrectly assume it has unique ownership of that object. In Mojo, the default behavior for all function arguments is to use value semantics. If the function wants to modify the value of an incoming argument, then it must explicitly declare so, which avoids accidental mutations of the original value. All Mojo types passed to a def function can be treated as mutable, which maintains the expected mutability behavior from Python. But by default, it is mutating a uniquely-owned value, not the original value. def For example, when you pass an instance of a SIMD vector to a def function it creates a unique copy of all values. Thus, if we modify the argument in the function, the original value is unchanged: SIMD def ```mojo def update_simd(t: SIMD[DType.int32, 4]): t[0] = 9 print(t)v = SIMD[DType.int32, 4](1, 2, 3, 4)update_simd(v)print(v) ``` If this were Python code, the function would modify the original object, because Python shares a reference to the original object. ### Value semantics in def vs fn​ def fn The arguments above are mutable because a def function has special treatment for the default borrowed argument convention. def borrowed Whereas, fn functions always receive borrowed arguments as immutable references. This is a memory optimization to avoid making unnecessary copies. fn borrowed For example, let's create another function with the fn declaration. In this case, the y argument is immutable by default, so if the function wants to modify the value in the local scope, it needs to make a local copy: fn y ```mojo fn add_two(y: Int): # y += 2 # This will cause a compiler error because `y` is immutable # We can instead make an explicit copy: var z = y z += 2 print(z)x = 1add_two(x)print(x) ``` This is all consistent with value semantics because each variable maintains unique ownership of its value. The way the fn function receives the y value is a "look but don't touch" approach to value semantics. This is also a more memory-efficient approach when dealing with memory-intensive arguments, because Mojo doesn't make any copies unless we explicitly make the copies ourselves. fn y Thus, the default behavior for def and fn arguments is fully value semantic: arguments are either copies or immutable references, and any living variable from the callee is not affected by the function. def fn But we must also allow reference semantics (mutable references) because it's how we build performant and memory-efficient programs (making copies of everything gets really expensive). The challenge is to introduce reference semantics in a way that does not disturb the predictability and safety of value semantics. The way we do that in Mojo is, instead of enforcing that every variable have "exclusive access" to a value, we ensure that every value has an "exclusive owner," and destroy each value when the lifetime of its owner ends. On the next page about value ownership, you'll learn how to modify the default argument conventions, and safely use reference semantics so every value has only one owner at a time. ## Python-style reference semantics​ If you will always use strict type declarations, you can skip this section because it only applies to Mojo code using def functions without type declarations (or values declared as object). def object As we said at the top of this page, Mojo doesn't enforce value semantics or reference semantics. It's up to each type author to decide how an instance of their type should be created, copied, and moved (see Value lifecycle). Thus, in order to provide compatibility with Python, Mojo's object type is designed to support Python's style of argument passing for functions, which is different from the other types in Mojo. object Python's argument-passing convention is called "pass by object reference." This means when you pass a variable to a Python function, you actually pass a reference to the object, as a value (so it's not strictly reference semantics). Passing the object reference "as a value" means that the argument name is just a container that acts like an alias to the original object. If you reassign the argument inside the function, it does not affect the caller's original value. However, if you modify the object itself (such as call append() on a list), the change is visible to the original object outside the function. append() For example, here's a Python function that receives a list and modifies it: ```mojo %%pythondef modify_list(l): l.append(3) print("func:", l)ar = [1, 2]modify_list(ar)print("orig:", ar) ``` In this example, it looks like the list is "passed by reference" because l modifies the original value. l However, if the Python function instead assigns a value to l, it does not affect the original value: l ```mojo %%pythondef change_list(l): l = [3, 4] print("func:", l)ar = [1, 2]change_list(ar)print("orig:", ar) ``` This demonstrates how a Python argument holds the object reference as a value: the function can mutate the original value, but it can also assign a new object to the argument name. ### Pass by object reference in Mojo​ Although we haven't finished implementing the object type to represent any Mojo type, our intention is to do so, and enable "pass by object reference" as described above for all dynamic types in a def function. object def That means you can have dynamic typing and "pass by object reference" behavior by simply writing your Mojo code like Python: - Use def function declarations. - Don't declare argument types. def Mojo is not a complete superset of Python yet, and there is a lot to do in this department before Mojo supports all of Python's types and behaviors. As such, this is a topic that also still needs a lot of documentation. - Intro to value semanticsValue semantics in def vs fn - Value semantics in def vs fn - Python-style reference semanticsPass by object reference in Mojo - Pass by object reference in Mojo - Value semantics in def vs fn def fn - Pass by object reference in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#ownership-summary - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#borrowed-arguments-borrowed - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#compared-to-c-and-rust - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#transfer-arguments-owned-and- - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#transfer-implementation-details - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#consuming-move-constructor - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#comparing-def-and-fn-argument-conventions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/#lifecycles-and-lifetimes - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Intro to value lifecycle # Intro to value lifecycle So far, we've explained how Mojo allows you to build high-performance code that is memory safe without manually managing memory, using Mojo's ownership model. However, Mojo is designed for systems programming, which often requires manual memory management for custom data types. So, Mojo lets you do that as you see fit. To be clear, Mojo has no reference counter and no garbage collector. Mojo also has no built-in data types with special privileges. All data types in the standard library (such as Bool, Int, and String) are implemented as structs. You can actually write your own replacements for these types by using low-level primitives provided by MLIR dialects. Bool Int String What's great about the Mojo language is that it provides you these low-level tools for systems programming, but within a framework that helps you build things that are safe and easy to use from higher-level programs. That is, you can get under the hood and write all the "unsafe" code you want, but as long as you do so in accordance with Mojo's value semantics, the programmer instantiating your type/object doesn't need to think about memory management at all, and the behavior will be safe and predictable, thanks to value ownership. In summary, it's the responsibility of the type author to manage the memory and resources for each value type, by implementing specific lifecycle methods, such as the constructor, copy constructor, move constructor, and destructor, as necessary. Mojo doesn't create any constructors by default, although it does add a trivial, no-op destructor for types that don't define their own. In the following pages, we'll explain exactly how to define these lifecycle methods in accordance with value semantics so your types play nicely with value ownership. ## Lifecycles and lifetimes​ First, let's clarify some terminology: - The "lifecycle" of a value is defined by various dunder methods in a struct. Each lifecycle event is handled by a different method, such as the constructor (__init__()), the destructor (__del__()), the copy constructor (__copyinit__()), and the move constructor (__moveinit__()). All values that are declared with the same type have the same lifecycle. - The "lifetime" of a value is defined by the span of time during program execution in which each value is considered valid. The life of a value begins when it is initialized and ends when it is destroyed, which generally (but not always) spans from __init__() to __del__(). No two values have the exact same lifetime, because every value is created and destroyed at a different point in time (even if the difference is imperceivable). The "lifecycle" of a value is defined by various dunder methods in a struct. Each lifecycle event is handled by a different method, such as the constructor (__init__()), the destructor (__del__()), the copy constructor (__copyinit__()), and the move constructor (__moveinit__()). All values that are declared with the same type have the same lifecycle. __init__() __del__() __copyinit__() __moveinit__() The "lifetime" of a value is defined by the span of time during program execution in which each value is considered valid. The life of a value begins when it is initialized and ends when it is destroyed, which generally (but not always) spans from __init__() to __del__(). No two values have the exact same lifetime, because every value is created and destroyed at a different point in time (even if the difference is imperceivable). __init__() __del__() The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. Mojo destroys every value/object as soon as it's no longer used, using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. As you might imagine, keeping track of a value's lifetime can be difficult if a value is shared across functions many times during the life of a program. However, Mojo makes this predictable partly through its value semantics and value ownership (both prerequisite readings for the following sections). The final piece of the puzzle for lifetime management is the value lifecycle: every value (defined in a struct) needs to implement key lifecycle methods that define how a value is created and destroyed. - Lifecycles and lifetimes - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#constructor - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#immutable-arguments-borrowed - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#overloading-the-constructor - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#field-initialization - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#constructors-and-implicit-conversion - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#value-decorator - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#copy-constructor - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/values/ownership#transfer-arguments-owned-and - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value ownership - /Ownership and borrowing # Ownership and borrowing A challenge you might face when using some programming languages is that you must manually allocate and deallocate memory. When multiple parts of the program need access to the same memory, it becomes difficult to keep track of who "owns" a value and determine when is the right time to deallocate it. If you make a mistake, it can result in a "use-after-free" error, a "double free" error, or a "leaked memory" error, any one of which can be catastrophic. Mojo helps avoid these errors by ensuring there is only one variable that owns each value at a time, while still allowing you to share references with other functions. When the lifetime of the owner ends, Mojo destroys the value. On this page, we'll explain the rules that govern this ownership model and how to specify different argument conventions that define how values are shared into functions. ## Argument conventions​ In all programming languages, code quality and performance is heavily dependent upon how functions treat argument values. That is, whether a value received by a function is a unique value or a reference, and whether it's mutable or immutable, has a series of consequences that define the readability, performance, and safety of the language. In Mojo, we want to provide full value semantics by default, which provides consistent and predictable behavior. But as a systems programming language, we also need to offer full control over memory optimizations, which generally requires reference semantics. The trick is to introduce reference semantics in a way that ensures all code is memory safe by tracking the lifetime of every value and destroying each one at the right time (and only once). All of this is made possible in Mojo through the use of argument conventions that ensure every value has only one owner at a time. An argument convention specifies whether an argument is mutable or immutable, and whether the function owns the value. Each convention is defined by a keyword at the beginning of an argument declaration: - borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. - inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). - owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). borrowed: The function receives an immutable reference. This means the function can read the original value (it is not a copy), but it cannot mutate (modify) it. def functions treat this differently, as described below. borrowed def inout: The function receives a mutable reference. This means the function can read and mutate the original value (it is not a copy). inout owned: The function takes ownership. This means the function has exclusive mutable access to the argument—the function caller does not have access to this value (anymore). Often, this also implies that the caller should transfer ownership to this function, but that's not always what happens and this might instead be a copy (as you'll learn below). owned For example, this function has one argument that's a mutable reference and one that's immutable: ```mojo fn add(inout x: Int, borrowed y: Int): x += yfn main(): var a = 1 var b = 2 add(a, b) print(a) # Prints 3 ``` You've probably already seen some function arguments that don't declare a convention. by default, all arguments are borrowed. But def and fn functions treat borrowed arguments somewhat differently: borrowed def fn borrowed - In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: var my_copy = borrowed_arg - In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. In an fn function, the function always receives an immutable reference. If you want a mutable copy, you can assign it to a local variable: fn ```mojo var my_copy = borrowed_arg ``` In a def function, if the function mutates the value, the function receives a mutable copy of the argument. Otherwise, it receives an immutable reference. This allows you to treat arguments as mutable, but avoid the overhead of making extra copies when they're not needed. def The difference between borrowed and owned in a def function may be a little subtle: borrowed owned def - In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. - The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. - The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. In a def function, a borrowed argument is received as an immutable reference, unless it's mutated in the body of the function. This eliminates unneeded copies, but maintains the Python expectation that arguments are mutable. def borrowed The borrowed argument always gets an immutable reference or a local copy. You can't transfer a value into a borrowed argument. borrowed borrowed The owned argument always gets a uniquely owned value, which may have been copied or transferred from the callee. Using owned arguments without the transfer operator (^) usually results in values being copied. owned owned ^ In the following sections, we'll explain each of these argument conventions in more detail. ## Ownership summary​ The fundamental rules that make Mojo's ownership model work are the following: - Every value has only one owner at a time. - When the lifetime of the owner ends, Mojo destroys the value. In the future, the Mojo lifetime checker will enforce reference exclusivity, so that only one mutable reference to a value can exist at a time. This is not currently enforced. ## Borrowed arguments (borrowed)​ borrowed The borrowed convention is the default for all arguments. borrowed In fn functions, a borrowed argument is received as an immutable reference. fn borrowed In def functions, you can treat a borrowed argument as mutable or immutable. If you mutate the argument in the body of the function, you get a mutable copy of the original value. If you don't mutate the argument, you get an immutable reference, as in an fn function. def borrowed fn For example: ```mojo from tensor import Tensor, TensorShapedef print_shape(tensor: Tensor[DType.float32]): shape = tensor.shape() print(str(shape))var tensor = Tensor[DType.float32](256, 256)print_shape(tensor) ``` Here the tensor argument is borrowed and not mutated, so the print_shape() function gets an immutable reference to the original Tensor, and doesn't do any copying. In general, passing an immutable reference is much more efficient when handling large or expensive-to-copy values, because the copy constructor and destructor are not invoked for a borrow. tensor print_shape() Tensor ### Compared to C++ and Rust​ Mojo's borrowed argument convention is similar in some ways to passing an argument by const& in C++, which also avoids a copy of the value and disables mutability in the callee. However, the borrowed convention differs from const& in C++ in two important ways: const& const& - The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. - Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. The Mojo compiler implements a lifetime checker that ensures that values are not destroyed when there are outstanding references to those values. Small values like Int, Float, and SIMD are passed directly in machine registers instead of through an extra indirection (this is because they are declared with the @register_passable decorator). This is a significant performance enhancement when compared to languages like C++ and Rust, and moves this optimization from every call site to a declaration on the type definition. Int Float SIMD @register_passable In the future, Mojo's lifetime checker will enforces the exclusivity of mutable references, similar to Rust. The major difference between Rust and Mojo is that Mojo does not require a sigil on the caller side to pass by borrow. Also, Mojo is more efficient when passing small values, and Rust defaults to moving values instead of passing them around by borrow. These policy and syntax decisions allow Mojo to provide an easier-to-use programming model. ## Mutable arguments (inout)​ inout If you'd like your function to receive a mutable reference, add the inout keyword in front of the argument name. You can think of inout like this: it means any changes to the value inside the function are visible outside the function. inout inout For example, this mutate() function updates the original x value: mutate() x ```mojo def mutate(inout y: Int): y += 1var x = 1mutate(x)print(x) ``` That behaves like an optimized shorthand for this: ```mojo def mutate_copy(y: Int) -> Int: y += 1 return yvar x = 1x = mutate_copy(x)print(x) ``` Although the code using inout isn't that much shorter, it's more memory efficient because it does not make a copy of the value. inout However, remember that the values passed as inout must already be mutable. For example, if you try to take a borrowed value and pass it to another function as inout, you'll get a compiler error because Mojo can't form a mutable reference from an immutable reference. inout borrowed inout Notice that we don't call this argument passing "by reference." Although the inout convention is conceptually the same, we don't call it by-reference passing because the implementation may actually pass values using pointers. inout You cannot define default values for inout arguments. inout ## Transfer arguments (owned and ^)​ owned ^ And finally, if you'd like your function to receive value ownership, add the owned keyword in front of the argument name. owned This convention is usually combined with use of the postfixed ^ "transfer" operator on the variable that is passed into the function, which ends the lifetime of that variable. ^ Technically, the owned keyword does not guarantee that the received value is the original value—it guarantees only that the function gets unique ownership of a value (enforcing value semantics). This happens in one of three ways: owned - The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. - The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). - The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: def take(owned s: String): passtake(str("A brand-new String!")) The caller passes the argument with the ^ transfer operator, which ends the lifetime of that variable (the variable becomes uninitialized) and ownership is transferred into the function without making a copy of any heap-allocated data. ^ The caller does not use the ^ transfer operator, in which case, the value is copied into the function argument and the original variable remains valid. (If the original value is not used again, the compiler may optimize away the copy and transfer the value). ^ The caller passes in a newly-created "owned" value, such as a value returned from a function. In this case, no variable owns the value and it can be transferred directly to the callee. For example: ```mojo def take(owned s: String): passtake(str("A brand-new String!")) ``` Regardless, when the function declares an argument as owned, it can be certain that it has unique mutable access to that value. owned For example, the following code works by making a copy of the string, because—although take_text() uses the owned convention—the caller does not include the transfer operator: take_text() owned ```mojo fn take_text(owned text: String): text += "!" print(text)fn my_function(): var message: String = "Hello" take_text(message) print(message)my_function() ``` However, if you add the ^ transfer operator when calling take_text(), the compiler complains about print(message), because at that point, the message variable is no longer initialized. That is, this version does not compile: ^ take_text() print(message) message ```mojo fn my_function(): var message: String = "Hello" take_text(message^) print(message) # ERROR: The `message` variable is uninitialized ``` This is a critical feature of Mojo's lifetime checker, because it ensures that no two variables can have ownership of the same value. To fix the error, you must not use the message variable after you end its lifetime with the ^ transfer operator. So here is the corrected code: message ^ ```mojo fn my_function(): var message: String = "Hello" take_text(message^)my_function() ``` Value lifetimes are not fully implemented for top-level code in Mojo's REPL, so the transfer operator currently works as intended only when used inside a function. ### Transfer implementation details​ In Mojo, it's important that you not conflate "ownership transfer" with a "move operation"—these are not strictly the same thing. There are multiple ways that Mojo can transfer ownership of a value without making a copy: - If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). - If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. If a type implements the move constructor, __moveinit__(), Mojo may invoke this method if a value of that type is transferred into a function as an owned argument, and the original value's lifetime ends at the same point (with or without use of the ^ transfer operator). __moveinit__() owned ^ If a type hasn't implemented __moveinit__() Mojo may transfer ownership by simply passing the recipient a reference to the value in the caller's stack. __moveinit__() In order for the owned convention to work without the transfer operator, the value type must be copyable (via __copyinit__()). owned __copyinit__() ## Comparing def and fn argument conventions​ def fn As mentioned in the section about functions, def and fn functions are interchangeable, as far as a caller is concerned, and they can both accomplish the same things. It's only the inside that differs, and Mojo's def function is essentially just sugaring for the fn function: def fn def fn - A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). - A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. A def argument without a type annotation defaults to object type (whereas as fn requires all types be explicitly declared). def object fn A def function can treat a borrowed argument as mutable (in which case it receives a mutable copy). An fn function must make this copy explicitly. def borrowed fn For example, these two functions have the exact same behavior. ```mojo def def_example(a: Int, inout b: Int, owned c): passfn fn_example(a_in: Int, inout b: Int, owned c: object): var a = a_in pass ``` This shadow copy typically adds no overhead, because references for small types like object are cheap to copy. However, copying large types that allocate heap storage can be expensive. (For example, copying List or Dict types, or copying large numbers of strings.) object List Dict - Argument conventions - Ownership summary - Borrowed arguments (borrowed)Compared to C++ and Rust - Compared to C++ and Rust - Mutable arguments (inout) - Transfer arguments (owned and ^)Transfer implementation details - Transfer implementation details - Comparing def and fn argument conventions borrowed - Compared to C++ and Rust inout owned ^ - Transfer implementation details def fn - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#move-constructor - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#trivial-types - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/death#default-destruction-behavior - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Death of a value # Death of a value As soon as a value/object is no longer used, Mojo destroys it. Mojo does not wait until the end of a code block—or even until the end of an expression—to destroy an unused value. It destroys values using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. Even within an expression like a+b+c+d, Mojo destroys the intermediate values as soon as they're no longer needed. a+b+c+d Mojo uses static compiler analysis to find the point where a value is last used. Then, Mojo immediately ends the value's lifetime and calls the __del__() destructor to perform any necessary cleanup for the type. __del__() For example, notice when the __del__() destructor is called for each instance of MyPet: __del__() MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __del__(owned self): print("Destruct", self.name)fn pets(): var a = MyPet("Loki", 4) var b = MyPet("Sylvie", 2) print(a.name) # a.__del__() runs here for "Loki" a = MyPet("Charlie", 8) # a.__del__() runs immediately because "Charlie" is never used print(b.name) # b.__del__() runs herepets() ``` Notice that each initialization of a value is matched with a call to the destructor, and a is actually destroyed multiple times—once for each time it receives a new value. a Also notice that this __del__() implementation doesn't actually do anything. Most structs don't require a custom destructor, and Mojo automatically adds a no-op destructor if you don't define one. __del__() ### Default destruction behavior​ You may be wondering how Mojo can destroy a type without a custom destructor, or why a no-op destructor is useful. If a type is simply a collection of fields, like the MyPet example, Mojo only needs to destroy the fields: MyPet doesn't dynamically allocate memory or use any long-lived resources (like file handles). There's no special action to take when a MyPet value is destroyed. MyPet MyPet MyPet Looking at the individual fields, MyPet includes an Int and a String. The Int is what Mojo calls a trivial type. It's a statically-sized bundle of bits. Mojo knows exactly how big it is, so those bits can be reused to store something else. MyPet Int String Int The String value is a little more complicated. Mojo strings are mutable. The String object has an internal buffer—a List field, which holds the characters that make up the string. A List stores its contents in dynamically allocated memory on the heap, so the string can grow or shrink. The string itself doesn't have any special destructor logic, but when Mojo destroys a string, it calls the destructor for the List field, which de-allocates the memory. String String List List List Since String and Int don't require any custom destructor logic, they both have no-op destructors: literally, __del__() methods that don't do anything. This may seem pointless, but it means that Mojo can call the destructor on any value when its lifetime ends. This makes it easier to write generic containers and algorithms. String Int __del__() ### Benefits of ASAP destruction​ Similar to other languages, Mojo follows the principle that objects/values acquire resources in a constructor (__init__()) and release resources in a destructor (__del__()). However, Mojo's ASAP destruction has some advantages over scope-based destruction (such as the C++ RAII pattern, which waits until the end of the code scope to destroy values): __init__() __del__() - Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. - Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Additionally, Mojo's ASAP destruction works great within Python-style def functions. That's because Python doesn’t really provide scopes beyond a function scope, so the Python garbage collector cleans up resources more often than a scope-based destruction policy would. However, Mojo does not use a garbage collector, so the ASAP destruction policy provides destruction guarantees that are even more fine-grained than in Python. def The Mojo destruction policy is more similar to how Rust and Swift work, because they both have strong value ownership tracking and provide memory safety. One difference is that Rust and Swift require the use of a dynamic "drop flag"—they maintain hidden shadow variables to keep track of the state of your values to provide safety. These are often optimized away, but the Mojo approach eliminates this overhead entirely, making the generated code faster and avoiding ambiguity. ## Destructor​ Mojo calls a value's destructor (__del__() method) when the value's lifetime ends (typically the point at which the value is last used). As we mentioned earlier, Mojo provides a default, no-op destructor for all types, so in most cases you don't need to define the __del__() method. __del__() __del__() You should define the __del__() method to perform any kind of cleanup the type requires. Usually, that includes freeing memory for any fields where you dynamically allocated memory (for example, via Pointer or DTypePointer) and closing any long-lived resources such as file handles. __del__() Pointer DTypePointer However, any struct that is just a simple collection of other types does not need to implement the destructor. For example, consider this simple struct: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` There's no need to define the __del__() destructor for this, because it's a simple collection of other types (String and Int), and it doesn't dynamically allocate memory. __del__() String Int Whereas, the following struct must define the __del__() method to free the memory allocated by its UnsafePointer: __del__() UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct HeapArray: var data: UnsafePointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = UnsafePointer[Int].alloc(self.size) for i in range(self.size): initialize_pointee_copy(self.data + i, val) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data + i) self.data.free() ``` Note that a pointer doesn't own any values in the memory it points to, so when a pointer is destroyed, Mojo doesn't call the destructors on those values. So in the HeapArray example above, calling free() on the pointer releases the memory, but doesn't call the destructors on the stored values. To invoke the destructors, use the destroy_pointee() function from the unsafe_pointer module. HeapArray free() destroy_pointee() unsafe_pointer You can't just call the destructor explicitly. Because __del__() takes self as an owned value, and owned arguments are copied by default, foo.__del__() actually creates and destroys a copy of foo. When Mojo destroys a value, however, it passes in the original value as self, not a copy. __del__() self owned foo.__del__() foo self It's important to notice that the __del__() method is an "extra" cleanup event, and your implementation does not override any default destruction behaviors. For example, Mojo still destroys all the fields in MyPet even if you implement __del__() to do nothing: __del__() MyPet __del__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __del__(owned self): # Mojo destroys all the fields when they're last used pass ``` However, the self value inside the __del__() destructor is still whole (so all fields are still usable) until the destructor returns, as we'll discuss more in the following section. self __del__() ## Field lifetimes​ In addition to tracking the lifetime of all objects in a program, Mojo also tracks each field of a structure independently. That is, Mojo keeps track of whether a "whole object" is fully or partially initialized/destroyed, and it destroys each field independently with its ASAP destruction policy. For example, consider this code that changes the value of a field: ```mojo @valuestruct MyPet: var name: String var age: Intfn use_two_strings(): var pet = MyPet("Po", 8) print(pet.name) # pet.name.__del__() runs here, because this instance is # no longer used; it's replaced below pet.name = String("Lola") # Overwrite pet.name print(pet.name) # pet.__del__() runs here ``` The pet.name field is destroyed after the first print(), because Mojo knows that it will be overwritten below. You can also see this behavior when using the transfer operator: pet.name print() ```mojo fn consume(owned arg: String): passfn use(arg: MyPet): print(arg.name)fn consume_and_use(): var pet = MyPet("Selma", 5) consume(pet.name^) # pet.name.__moveinit__() runs here, which destroys pet.name # Now pet is only partially initialized # use(pet) # This fails because pet.name is uninitialized pet.name = String("Jasper") # All together now use(pet) # This is ok # pet.__del__() runs here (and only if the object is whole) ``` Notice that the code transfers ownership of the name field to consume(). For a period of time after that, the name field is uninitialized. Then name is reinitialized before it is passed to the use() function. If you try calling use() before name is re-initialized, Mojo rejects the code with an uninitialized field error. name consume() name name use() use() name Also, if you don't re-initialize the name by the end of the pet lifetime, the compiler complains because it's unable to destroy a partially initialized object. pet Mojo's policy here is powerful and intentionally straight-forward: fields can be temporarily transferred, but the "whole object" must be constructed with the aggregate type’s initializer and destroyed with the aggregate destructor. This means it's impossible to create an object by initializing only its fields, and it's likewise impossible to destroy an object by destroying only its fields. ### Field lifetimes during destruct and move​ The consuming-move constructor and destructor face an interesting situation with field lifetimes, because, unlike other lifecycle methods, they both take an instance of their own type as an owned argument, which is about to be destroyed. You don't really need to worry about this detail when implementing these methods, but it might help you better understand field lifetimes. owned Just to recap, the move constructor and destructor method signatures look like this: ```mojo struct TwoStrings: fn __moveinit__(inout self, owned existing: Self): # Initializes a new `self` by consuming the contents of `existing` fn __del__(owned self): # Destroys all resources in `self` ``` There are two kinds of "self" here: capitalized Self is an alias for the current type name (used as a type specifier for the existing argument), whereas lowercase self is the argument name for the implicitly-passed reference to the current instance (also called "this" in other languages, and also implicitly a Self type). Self existing self Self Both of these methods face an interesting but obscure problem: they both must dismantle the existing/self value that's owned. That is, __moveinit__() implicitly destroys sub-elements of existing in order to transfer ownership to a new instance (read more about the move constructor), while __del__() implements the deletion logic for its self. As such, they both need to own and transform elements of the owned value, and they definitely don’t want the original owned value's destructor to also run—that could result in a double-free error, and in the case of the __del__() method, it would become an infinite loop. existing self owned __moveinit__() existing __del__() self owned owned __del__() To solve this problem, Mojo handles these two methods specially by assuming that their whole values are destroyed upon reaching any return from the method. This means that the whole object may be used as usual, up until the field values are transferred or the method returns. For example, the following code works as you would expect (within the destructor, we can still pass ownership of a field value to another function, and there's no infinite loop to destroy self): self ```mojo fn consume(owned str: String): print('Consumed', str)struct TwoStrings: var str1: String var str2: String fn __init__(inout self, one: String): self.str1 = one self.str2 = String("bar") fn __moveinit__(inout self, owned existing: Self): self.str1 = existing.str1 self.str2 = existing.str2 fn __del__(owned self): self.dump() # Self is still whole here # Mojo calls self.str2.__del__() since str2 isn't used anymore consume(self.str1^) # self.str1 has been transferred so it is also destroyed now; # `self.__del__()` is not called (avoiding an infinite loop). fn dump(inout self): print('str1:', self.str1) print('str2:', self.str2)fn use_two_strings(): var two_strings = TwoStrings("foo") ``` ## Explicit lifetimes​ So far, we've described how Mojo destroys a value at the point it's last used, and this works great in almost all situations. However, there are very rare situations in which Mojo simply cannot predict this correctly and will destroy a value that is still referenced through some other means. For instance, perhaps you're building a type with a field that carries a pointer to another field. The Mojo compiler won't be able to reason about the pointer, so it might destroy a field (obj1) when that field is technically no longer used, even though another field (obj2) still holds a pointer to part of it. So, you might need to keep obj1 alive until you can execute some special logic in the destructor or move initializer. obj1 obj2 obj1 You can force Mojo to keep a value alive up to a certain point by assigning the value to the _ discard pattern at the point where it's okay to destroy it. For example: _ ```mojo fn __del__(owned self): self.dump() # Self is still whole here consume(self.obj2^) _ = self.obj1 # Mojo keeps `obj1` alive until here, after its "last use" ``` In this case, if consume() refers to some value in obj1 somehow, this ensures that Mojo does not destroy obj1 until after the call to consume(), because assignment to the discard variable _ is actually the last use. consume() obj1 obj1 consume() _ For other situations, you can also scope the lifetime of a value using the Python-style with statement. That is, for any value defined at the entrance to a with statement, Mojo will keep that value alive until the end of the with statement. For example: with with with ```mojo with open("my_file.txt", "r") as file: print(file.read()) # Other stuff happens here (whether using `file` or not)... foo() # `file` is alive up to the end of the `with` statement.# `file` is destroyed when the statement ends.bar() ``` - Default destruction behavior - Benefits of ASAP destruction - Destructor - Field lifetimesField lifetimes during destruct and move - Field lifetimes during destruct and move - Explicit lifetimes - Field lifetimes during destruct and move - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/death#benefits-of-asap-destruction - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Death of a value # Death of a value As soon as a value/object is no longer used, Mojo destroys it. Mojo does not wait until the end of a code block—or even until the end of an expression—to destroy an unused value. It destroys values using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. Even within an expression like a+b+c+d, Mojo destroys the intermediate values as soon as they're no longer needed. a+b+c+d Mojo uses static compiler analysis to find the point where a value is last used. Then, Mojo immediately ends the value's lifetime and calls the __del__() destructor to perform any necessary cleanup for the type. __del__() For example, notice when the __del__() destructor is called for each instance of MyPet: __del__() MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __del__(owned self): print("Destruct", self.name)fn pets(): var a = MyPet("Loki", 4) var b = MyPet("Sylvie", 2) print(a.name) # a.__del__() runs here for "Loki" a = MyPet("Charlie", 8) # a.__del__() runs immediately because "Charlie" is never used print(b.name) # b.__del__() runs herepets() ``` Notice that each initialization of a value is matched with a call to the destructor, and a is actually destroyed multiple times—once for each time it receives a new value. a Also notice that this __del__() implementation doesn't actually do anything. Most structs don't require a custom destructor, and Mojo automatically adds a no-op destructor if you don't define one. __del__() ### Default destruction behavior​ You may be wondering how Mojo can destroy a type without a custom destructor, or why a no-op destructor is useful. If a type is simply a collection of fields, like the MyPet example, Mojo only needs to destroy the fields: MyPet doesn't dynamically allocate memory or use any long-lived resources (like file handles). There's no special action to take when a MyPet value is destroyed. MyPet MyPet MyPet Looking at the individual fields, MyPet includes an Int and a String. The Int is what Mojo calls a trivial type. It's a statically-sized bundle of bits. Mojo knows exactly how big it is, so those bits can be reused to store something else. MyPet Int String Int The String value is a little more complicated. Mojo strings are mutable. The String object has an internal buffer—a List field, which holds the characters that make up the string. A List stores its contents in dynamically allocated memory on the heap, so the string can grow or shrink. The string itself doesn't have any special destructor logic, but when Mojo destroys a string, it calls the destructor for the List field, which de-allocates the memory. String String List List List Since String and Int don't require any custom destructor logic, they both have no-op destructors: literally, __del__() methods that don't do anything. This may seem pointless, but it means that Mojo can call the destructor on any value when its lifetime ends. This makes it easier to write generic containers and algorithms. String Int __del__() ### Benefits of ASAP destruction​ Similar to other languages, Mojo follows the principle that objects/values acquire resources in a constructor (__init__()) and release resources in a destructor (__del__()). However, Mojo's ASAP destruction has some advantages over scope-based destruction (such as the C++ RAII pattern, which waits until the end of the code scope to destroy values): __init__() __del__() - Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. - Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Additionally, Mojo's ASAP destruction works great within Python-style def functions. That's because Python doesn’t really provide scopes beyond a function scope, so the Python garbage collector cleans up resources more often than a scope-based destruction policy would. However, Mojo does not use a garbage collector, so the ASAP destruction policy provides destruction guarantees that are even more fine-grained than in Python. def The Mojo destruction policy is more similar to how Rust and Swift work, because they both have strong value ownership tracking and provide memory safety. One difference is that Rust and Swift require the use of a dynamic "drop flag"—they maintain hidden shadow variables to keep track of the state of your values to provide safety. These are often optimized away, but the Mojo approach eliminates this overhead entirely, making the generated code faster and avoiding ambiguity. ## Destructor​ Mojo calls a value's destructor (__del__() method) when the value's lifetime ends (typically the point at which the value is last used). As we mentioned earlier, Mojo provides a default, no-op destructor for all types, so in most cases you don't need to define the __del__() method. __del__() __del__() You should define the __del__() method to perform any kind of cleanup the type requires. Usually, that includes freeing memory for any fields where you dynamically allocated memory (for example, via Pointer or DTypePointer) and closing any long-lived resources such as file handles. __del__() Pointer DTypePointer However, any struct that is just a simple collection of other types does not need to implement the destructor. For example, consider this simple struct: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` There's no need to define the __del__() destructor for this, because it's a simple collection of other types (String and Int), and it doesn't dynamically allocate memory. __del__() String Int Whereas, the following struct must define the __del__() method to free the memory allocated by its UnsafePointer: __del__() UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct HeapArray: var data: UnsafePointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = UnsafePointer[Int].alloc(self.size) for i in range(self.size): initialize_pointee_copy(self.data + i, val) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data + i) self.data.free() ``` Note that a pointer doesn't own any values in the memory it points to, so when a pointer is destroyed, Mojo doesn't call the destructors on those values. So in the HeapArray example above, calling free() on the pointer releases the memory, but doesn't call the destructors on the stored values. To invoke the destructors, use the destroy_pointee() function from the unsafe_pointer module. HeapArray free() destroy_pointee() unsafe_pointer You can't just call the destructor explicitly. Because __del__() takes self as an owned value, and owned arguments are copied by default, foo.__del__() actually creates and destroys a copy of foo. When Mojo destroys a value, however, it passes in the original value as self, not a copy. __del__() self owned foo.__del__() foo self It's important to notice that the __del__() method is an "extra" cleanup event, and your implementation does not override any default destruction behaviors. For example, Mojo still destroys all the fields in MyPet even if you implement __del__() to do nothing: __del__() MyPet __del__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __del__(owned self): # Mojo destroys all the fields when they're last used pass ``` However, the self value inside the __del__() destructor is still whole (so all fields are still usable) until the destructor returns, as we'll discuss more in the following section. self __del__() ## Field lifetimes​ In addition to tracking the lifetime of all objects in a program, Mojo also tracks each field of a structure independently. That is, Mojo keeps track of whether a "whole object" is fully or partially initialized/destroyed, and it destroys each field independently with its ASAP destruction policy. For example, consider this code that changes the value of a field: ```mojo @valuestruct MyPet: var name: String var age: Intfn use_two_strings(): var pet = MyPet("Po", 8) print(pet.name) # pet.name.__del__() runs here, because this instance is # no longer used; it's replaced below pet.name = String("Lola") # Overwrite pet.name print(pet.name) # pet.__del__() runs here ``` The pet.name field is destroyed after the first print(), because Mojo knows that it will be overwritten below. You can also see this behavior when using the transfer operator: pet.name print() ```mojo fn consume(owned arg: String): passfn use(arg: MyPet): print(arg.name)fn consume_and_use(): var pet = MyPet("Selma", 5) consume(pet.name^) # pet.name.__moveinit__() runs here, which destroys pet.name # Now pet is only partially initialized # use(pet) # This fails because pet.name is uninitialized pet.name = String("Jasper") # All together now use(pet) # This is ok # pet.__del__() runs here (and only if the object is whole) ``` Notice that the code transfers ownership of the name field to consume(). For a period of time after that, the name field is uninitialized. Then name is reinitialized before it is passed to the use() function. If you try calling use() before name is re-initialized, Mojo rejects the code with an uninitialized field error. name consume() name name use() use() name Also, if you don't re-initialize the name by the end of the pet lifetime, the compiler complains because it's unable to destroy a partially initialized object. pet Mojo's policy here is powerful and intentionally straight-forward: fields can be temporarily transferred, but the "whole object" must be constructed with the aggregate type’s initializer and destroyed with the aggregate destructor. This means it's impossible to create an object by initializing only its fields, and it's likewise impossible to destroy an object by destroying only its fields. ### Field lifetimes during destruct and move​ The consuming-move constructor and destructor face an interesting situation with field lifetimes, because, unlike other lifecycle methods, they both take an instance of their own type as an owned argument, which is about to be destroyed. You don't really need to worry about this detail when implementing these methods, but it might help you better understand field lifetimes. owned Just to recap, the move constructor and destructor method signatures look like this: ```mojo struct TwoStrings: fn __moveinit__(inout self, owned existing: Self): # Initializes a new `self` by consuming the contents of `existing` fn __del__(owned self): # Destroys all resources in `self` ``` There are two kinds of "self" here: capitalized Self is an alias for the current type name (used as a type specifier for the existing argument), whereas lowercase self is the argument name for the implicitly-passed reference to the current instance (also called "this" in other languages, and also implicitly a Self type). Self existing self Self Both of these methods face an interesting but obscure problem: they both must dismantle the existing/self value that's owned. That is, __moveinit__() implicitly destroys sub-elements of existing in order to transfer ownership to a new instance (read more about the move constructor), while __del__() implements the deletion logic for its self. As such, they both need to own and transform elements of the owned value, and they definitely don’t want the original owned value's destructor to also run—that could result in a double-free error, and in the case of the __del__() method, it would become an infinite loop. existing self owned __moveinit__() existing __del__() self owned owned __del__() To solve this problem, Mojo handles these two methods specially by assuming that their whole values are destroyed upon reaching any return from the method. This means that the whole object may be used as usual, up until the field values are transferred or the method returns. For example, the following code works as you would expect (within the destructor, we can still pass ownership of a field value to another function, and there's no infinite loop to destroy self): self ```mojo fn consume(owned str: String): print('Consumed', str)struct TwoStrings: var str1: String var str2: String fn __init__(inout self, one: String): self.str1 = one self.str2 = String("bar") fn __moveinit__(inout self, owned existing: Self): self.str1 = existing.str1 self.str2 = existing.str2 fn __del__(owned self): self.dump() # Self is still whole here # Mojo calls self.str2.__del__() since str2 isn't used anymore consume(self.str1^) # self.str1 has been transferred so it is also destroyed now; # `self.__del__()` is not called (avoiding an infinite loop). fn dump(inout self): print('str1:', self.str1) print('str2:', self.str2)fn use_two_strings(): var two_strings = TwoStrings("foo") ``` ## Explicit lifetimes​ So far, we've described how Mojo destroys a value at the point it's last used, and this works great in almost all situations. However, there are very rare situations in which Mojo simply cannot predict this correctly and will destroy a value that is still referenced through some other means. For instance, perhaps you're building a type with a field that carries a pointer to another field. The Mojo compiler won't be able to reason about the pointer, so it might destroy a field (obj1) when that field is technically no longer used, even though another field (obj2) still holds a pointer to part of it. So, you might need to keep obj1 alive until you can execute some special logic in the destructor or move initializer. obj1 obj2 obj1 You can force Mojo to keep a value alive up to a certain point by assigning the value to the _ discard pattern at the point where it's okay to destroy it. For example: _ ```mojo fn __del__(owned self): self.dump() # Self is still whole here consume(self.obj2^) _ = self.obj1 # Mojo keeps `obj1` alive until here, after its "last use" ``` In this case, if consume() refers to some value in obj1 somehow, this ensures that Mojo does not destroy obj1 until after the call to consume(), because assignment to the discard variable _ is actually the last use. consume() obj1 obj1 consume() _ For other situations, you can also scope the lifetime of a value using the Python-style with statement. That is, for any value defined at the entrance to a with statement, Mojo will keep that value alive until the end of the with statement. For example: with with with ```mojo with open("my_file.txt", "r") as file: print(file.read()) # Other stuff happens here (whether using `file` or not)... foo() # `file` is alive up to the end of the `with` statement.# `file` is destroyed when the statement ends.bar() ``` - Default destruction behavior - Benefits of ASAP destruction - Destructor - Field lifetimesField lifetimes during destruct and move - Field lifetimes during destruct and move - Explicit lifetimes - Field lifetimes during destruct and move - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/death#destructor - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Death of a value # Death of a value As soon as a value/object is no longer used, Mojo destroys it. Mojo does not wait until the end of a code block—or even until the end of an expression—to destroy an unused value. It destroys values using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. Even within an expression like a+b+c+d, Mojo destroys the intermediate values as soon as they're no longer needed. a+b+c+d Mojo uses static compiler analysis to find the point where a value is last used. Then, Mojo immediately ends the value's lifetime and calls the __del__() destructor to perform any necessary cleanup for the type. __del__() For example, notice when the __del__() destructor is called for each instance of MyPet: __del__() MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __del__(owned self): print("Destruct", self.name)fn pets(): var a = MyPet("Loki", 4) var b = MyPet("Sylvie", 2) print(a.name) # a.__del__() runs here for "Loki" a = MyPet("Charlie", 8) # a.__del__() runs immediately because "Charlie" is never used print(b.name) # b.__del__() runs herepets() ``` Notice that each initialization of a value is matched with a call to the destructor, and a is actually destroyed multiple times—once for each time it receives a new value. a Also notice that this __del__() implementation doesn't actually do anything. Most structs don't require a custom destructor, and Mojo automatically adds a no-op destructor if you don't define one. __del__() ### Default destruction behavior​ You may be wondering how Mojo can destroy a type without a custom destructor, or why a no-op destructor is useful. If a type is simply a collection of fields, like the MyPet example, Mojo only needs to destroy the fields: MyPet doesn't dynamically allocate memory or use any long-lived resources (like file handles). There's no special action to take when a MyPet value is destroyed. MyPet MyPet MyPet Looking at the individual fields, MyPet includes an Int and a String. The Int is what Mojo calls a trivial type. It's a statically-sized bundle of bits. Mojo knows exactly how big it is, so those bits can be reused to store something else. MyPet Int String Int The String value is a little more complicated. Mojo strings are mutable. The String object has an internal buffer—a List field, which holds the characters that make up the string. A List stores its contents in dynamically allocated memory on the heap, so the string can grow or shrink. The string itself doesn't have any special destructor logic, but when Mojo destroys a string, it calls the destructor for the List field, which de-allocates the memory. String String List List List Since String and Int don't require any custom destructor logic, they both have no-op destructors: literally, __del__() methods that don't do anything. This may seem pointless, but it means that Mojo can call the destructor on any value when its lifetime ends. This makes it easier to write generic containers and algorithms. String Int __del__() ### Benefits of ASAP destruction​ Similar to other languages, Mojo follows the principle that objects/values acquire resources in a constructor (__init__()) and release resources in a destructor (__del__()). However, Mojo's ASAP destruction has some advantages over scope-based destruction (such as the C++ RAII pattern, which waits until the end of the code scope to destroy values): __init__() __del__() - Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. - Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Additionally, Mojo's ASAP destruction works great within Python-style def functions. That's because Python doesn’t really provide scopes beyond a function scope, so the Python garbage collector cleans up resources more often than a scope-based destruction policy would. However, Mojo does not use a garbage collector, so the ASAP destruction policy provides destruction guarantees that are even more fine-grained than in Python. def The Mojo destruction policy is more similar to how Rust and Swift work, because they both have strong value ownership tracking and provide memory safety. One difference is that Rust and Swift require the use of a dynamic "drop flag"—they maintain hidden shadow variables to keep track of the state of your values to provide safety. These are often optimized away, but the Mojo approach eliminates this overhead entirely, making the generated code faster and avoiding ambiguity. ## Destructor​ Mojo calls a value's destructor (__del__() method) when the value's lifetime ends (typically the point at which the value is last used). As we mentioned earlier, Mojo provides a default, no-op destructor for all types, so in most cases you don't need to define the __del__() method. __del__() __del__() You should define the __del__() method to perform any kind of cleanup the type requires. Usually, that includes freeing memory for any fields where you dynamically allocated memory (for example, via Pointer or DTypePointer) and closing any long-lived resources such as file handles. __del__() Pointer DTypePointer However, any struct that is just a simple collection of other types does not need to implement the destructor. For example, consider this simple struct: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` There's no need to define the __del__() destructor for this, because it's a simple collection of other types (String and Int), and it doesn't dynamically allocate memory. __del__() String Int Whereas, the following struct must define the __del__() method to free the memory allocated by its UnsafePointer: __del__() UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct HeapArray: var data: UnsafePointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = UnsafePointer[Int].alloc(self.size) for i in range(self.size): initialize_pointee_copy(self.data + i, val) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data + i) self.data.free() ``` Note that a pointer doesn't own any values in the memory it points to, so when a pointer is destroyed, Mojo doesn't call the destructors on those values. So in the HeapArray example above, calling free() on the pointer releases the memory, but doesn't call the destructors on the stored values. To invoke the destructors, use the destroy_pointee() function from the unsafe_pointer module. HeapArray free() destroy_pointee() unsafe_pointer You can't just call the destructor explicitly. Because __del__() takes self as an owned value, and owned arguments are copied by default, foo.__del__() actually creates and destroys a copy of foo. When Mojo destroys a value, however, it passes in the original value as self, not a copy. __del__() self owned foo.__del__() foo self It's important to notice that the __del__() method is an "extra" cleanup event, and your implementation does not override any default destruction behaviors. For example, Mojo still destroys all the fields in MyPet even if you implement __del__() to do nothing: __del__() MyPet __del__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __del__(owned self): # Mojo destroys all the fields when they're last used pass ``` However, the self value inside the __del__() destructor is still whole (so all fields are still usable) until the destructor returns, as we'll discuss more in the following section. self __del__() ## Field lifetimes​ In addition to tracking the lifetime of all objects in a program, Mojo also tracks each field of a structure independently. That is, Mojo keeps track of whether a "whole object" is fully or partially initialized/destroyed, and it destroys each field independently with its ASAP destruction policy. For example, consider this code that changes the value of a field: ```mojo @valuestruct MyPet: var name: String var age: Intfn use_two_strings(): var pet = MyPet("Po", 8) print(pet.name) # pet.name.__del__() runs here, because this instance is # no longer used; it's replaced below pet.name = String("Lola") # Overwrite pet.name print(pet.name) # pet.__del__() runs here ``` The pet.name field is destroyed after the first print(), because Mojo knows that it will be overwritten below. You can also see this behavior when using the transfer operator: pet.name print() ```mojo fn consume(owned arg: String): passfn use(arg: MyPet): print(arg.name)fn consume_and_use(): var pet = MyPet("Selma", 5) consume(pet.name^) # pet.name.__moveinit__() runs here, which destroys pet.name # Now pet is only partially initialized # use(pet) # This fails because pet.name is uninitialized pet.name = String("Jasper") # All together now use(pet) # This is ok # pet.__del__() runs here (and only if the object is whole) ``` Notice that the code transfers ownership of the name field to consume(). For a period of time after that, the name field is uninitialized. Then name is reinitialized before it is passed to the use() function. If you try calling use() before name is re-initialized, Mojo rejects the code with an uninitialized field error. name consume() name name use() use() name Also, if you don't re-initialize the name by the end of the pet lifetime, the compiler complains because it's unable to destroy a partially initialized object. pet Mojo's policy here is powerful and intentionally straight-forward: fields can be temporarily transferred, but the "whole object" must be constructed with the aggregate type’s initializer and destroyed with the aggregate destructor. This means it's impossible to create an object by initializing only its fields, and it's likewise impossible to destroy an object by destroying only its fields. ### Field lifetimes during destruct and move​ The consuming-move constructor and destructor face an interesting situation with field lifetimes, because, unlike other lifecycle methods, they both take an instance of their own type as an owned argument, which is about to be destroyed. You don't really need to worry about this detail when implementing these methods, but it might help you better understand field lifetimes. owned Just to recap, the move constructor and destructor method signatures look like this: ```mojo struct TwoStrings: fn __moveinit__(inout self, owned existing: Self): # Initializes a new `self` by consuming the contents of `existing` fn __del__(owned self): # Destroys all resources in `self` ``` There are two kinds of "self" here: capitalized Self is an alias for the current type name (used as a type specifier for the existing argument), whereas lowercase self is the argument name for the implicitly-passed reference to the current instance (also called "this" in other languages, and also implicitly a Self type). Self existing self Self Both of these methods face an interesting but obscure problem: they both must dismantle the existing/self value that's owned. That is, __moveinit__() implicitly destroys sub-elements of existing in order to transfer ownership to a new instance (read more about the move constructor), while __del__() implements the deletion logic for its self. As such, they both need to own and transform elements of the owned value, and they definitely don’t want the original owned value's destructor to also run—that could result in a double-free error, and in the case of the __del__() method, it would become an infinite loop. existing self owned __moveinit__() existing __del__() self owned owned __del__() To solve this problem, Mojo handles these two methods specially by assuming that their whole values are destroyed upon reaching any return from the method. This means that the whole object may be used as usual, up until the field values are transferred or the method returns. For example, the following code works as you would expect (within the destructor, we can still pass ownership of a field value to another function, and there's no infinite loop to destroy self): self ```mojo fn consume(owned str: String): print('Consumed', str)struct TwoStrings: var str1: String var str2: String fn __init__(inout self, one: String): self.str1 = one self.str2 = String("bar") fn __moveinit__(inout self, owned existing: Self): self.str1 = existing.str1 self.str2 = existing.str2 fn __del__(owned self): self.dump() # Self is still whole here # Mojo calls self.str2.__del__() since str2 isn't used anymore consume(self.str1^) # self.str1 has been transferred so it is also destroyed now; # `self.__del__()` is not called (avoiding an infinite loop). fn dump(inout self): print('str1:', self.str1) print('str2:', self.str2)fn use_two_strings(): var two_strings = TwoStrings("foo") ``` ## Explicit lifetimes​ So far, we've described how Mojo destroys a value at the point it's last used, and this works great in almost all situations. However, there are very rare situations in which Mojo simply cannot predict this correctly and will destroy a value that is still referenced through some other means. For instance, perhaps you're building a type with a field that carries a pointer to another field. The Mojo compiler won't be able to reason about the pointer, so it might destroy a field (obj1) when that field is technically no longer used, even though another field (obj2) still holds a pointer to part of it. So, you might need to keep obj1 alive until you can execute some special logic in the destructor or move initializer. obj1 obj2 obj1 You can force Mojo to keep a value alive up to a certain point by assigning the value to the _ discard pattern at the point where it's okay to destroy it. For example: _ ```mojo fn __del__(owned self): self.dump() # Self is still whole here consume(self.obj2^) _ = self.obj1 # Mojo keeps `obj1` alive until here, after its "last use" ``` In this case, if consume() refers to some value in obj1 somehow, this ensures that Mojo does not destroy obj1 until after the call to consume(), because assignment to the discard variable _ is actually the last use. consume() obj1 obj1 consume() _ For other situations, you can also scope the lifetime of a value using the Python-style with statement. That is, for any value defined at the entrance to a with statement, Mojo will keep that value alive until the end of the with statement. For example: with with with ```mojo with open("my_file.txt", "r") as file: print(file.read()) # Other stuff happens here (whether using `file` or not)... foo() # `file` is alive up to the end of the `with` statement.# `file` is destroyed when the statement ends.bar() ``` - Default destruction behavior - Benefits of ASAP destruction - Destructor - Field lifetimesField lifetimes during destruct and move - Field lifetimes during destruct and move - Explicit lifetimes - Field lifetimes during destruct and move - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/death#field-lifetimes - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Death of a value # Death of a value As soon as a value/object is no longer used, Mojo destroys it. Mojo does not wait until the end of a code block—or even until the end of an expression—to destroy an unused value. It destroys values using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. Even within an expression like a+b+c+d, Mojo destroys the intermediate values as soon as they're no longer needed. a+b+c+d Mojo uses static compiler analysis to find the point where a value is last used. Then, Mojo immediately ends the value's lifetime and calls the __del__() destructor to perform any necessary cleanup for the type. __del__() For example, notice when the __del__() destructor is called for each instance of MyPet: __del__() MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __del__(owned self): print("Destruct", self.name)fn pets(): var a = MyPet("Loki", 4) var b = MyPet("Sylvie", 2) print(a.name) # a.__del__() runs here for "Loki" a = MyPet("Charlie", 8) # a.__del__() runs immediately because "Charlie" is never used print(b.name) # b.__del__() runs herepets() ``` Notice that each initialization of a value is matched with a call to the destructor, and a is actually destroyed multiple times—once for each time it receives a new value. a Also notice that this __del__() implementation doesn't actually do anything. Most structs don't require a custom destructor, and Mojo automatically adds a no-op destructor if you don't define one. __del__() ### Default destruction behavior​ You may be wondering how Mojo can destroy a type without a custom destructor, or why a no-op destructor is useful. If a type is simply a collection of fields, like the MyPet example, Mojo only needs to destroy the fields: MyPet doesn't dynamically allocate memory or use any long-lived resources (like file handles). There's no special action to take when a MyPet value is destroyed. MyPet MyPet MyPet Looking at the individual fields, MyPet includes an Int and a String. The Int is what Mojo calls a trivial type. It's a statically-sized bundle of bits. Mojo knows exactly how big it is, so those bits can be reused to store something else. MyPet Int String Int The String value is a little more complicated. Mojo strings are mutable. The String object has an internal buffer—a List field, which holds the characters that make up the string. A List stores its contents in dynamically allocated memory on the heap, so the string can grow or shrink. The string itself doesn't have any special destructor logic, but when Mojo destroys a string, it calls the destructor for the List field, which de-allocates the memory. String String List List List Since String and Int don't require any custom destructor logic, they both have no-op destructors: literally, __del__() methods that don't do anything. This may seem pointless, but it means that Mojo can call the destructor on any value when its lifetime ends. This makes it easier to write generic containers and algorithms. String Int __del__() ### Benefits of ASAP destruction​ Similar to other languages, Mojo follows the principle that objects/values acquire resources in a constructor (__init__()) and release resources in a destructor (__del__()). However, Mojo's ASAP destruction has some advantages over scope-based destruction (such as the C++ RAII pattern, which waits until the end of the code scope to destroy values): __init__() __del__() - Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. - Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Additionally, Mojo's ASAP destruction works great within Python-style def functions. That's because Python doesn’t really provide scopes beyond a function scope, so the Python garbage collector cleans up resources more often than a scope-based destruction policy would. However, Mojo does not use a garbage collector, so the ASAP destruction policy provides destruction guarantees that are even more fine-grained than in Python. def The Mojo destruction policy is more similar to how Rust and Swift work, because they both have strong value ownership tracking and provide memory safety. One difference is that Rust and Swift require the use of a dynamic "drop flag"—they maintain hidden shadow variables to keep track of the state of your values to provide safety. These are often optimized away, but the Mojo approach eliminates this overhead entirely, making the generated code faster and avoiding ambiguity. ## Destructor​ Mojo calls a value's destructor (__del__() method) when the value's lifetime ends (typically the point at which the value is last used). As we mentioned earlier, Mojo provides a default, no-op destructor for all types, so in most cases you don't need to define the __del__() method. __del__() __del__() You should define the __del__() method to perform any kind of cleanup the type requires. Usually, that includes freeing memory for any fields where you dynamically allocated memory (for example, via Pointer or DTypePointer) and closing any long-lived resources such as file handles. __del__() Pointer DTypePointer However, any struct that is just a simple collection of other types does not need to implement the destructor. For example, consider this simple struct: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` There's no need to define the __del__() destructor for this, because it's a simple collection of other types (String and Int), and it doesn't dynamically allocate memory. __del__() String Int Whereas, the following struct must define the __del__() method to free the memory allocated by its UnsafePointer: __del__() UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct HeapArray: var data: UnsafePointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = UnsafePointer[Int].alloc(self.size) for i in range(self.size): initialize_pointee_copy(self.data + i, val) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data + i) self.data.free() ``` Note that a pointer doesn't own any values in the memory it points to, so when a pointer is destroyed, Mojo doesn't call the destructors on those values. So in the HeapArray example above, calling free() on the pointer releases the memory, but doesn't call the destructors on the stored values. To invoke the destructors, use the destroy_pointee() function from the unsafe_pointer module. HeapArray free() destroy_pointee() unsafe_pointer You can't just call the destructor explicitly. Because __del__() takes self as an owned value, and owned arguments are copied by default, foo.__del__() actually creates and destroys a copy of foo. When Mojo destroys a value, however, it passes in the original value as self, not a copy. __del__() self owned foo.__del__() foo self It's important to notice that the __del__() method is an "extra" cleanup event, and your implementation does not override any default destruction behaviors. For example, Mojo still destroys all the fields in MyPet even if you implement __del__() to do nothing: __del__() MyPet __del__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __del__(owned self): # Mojo destroys all the fields when they're last used pass ``` However, the self value inside the __del__() destructor is still whole (so all fields are still usable) until the destructor returns, as we'll discuss more in the following section. self __del__() ## Field lifetimes​ In addition to tracking the lifetime of all objects in a program, Mojo also tracks each field of a structure independently. That is, Mojo keeps track of whether a "whole object" is fully or partially initialized/destroyed, and it destroys each field independently with its ASAP destruction policy. For example, consider this code that changes the value of a field: ```mojo @valuestruct MyPet: var name: String var age: Intfn use_two_strings(): var pet = MyPet("Po", 8) print(pet.name) # pet.name.__del__() runs here, because this instance is # no longer used; it's replaced below pet.name = String("Lola") # Overwrite pet.name print(pet.name) # pet.__del__() runs here ``` The pet.name field is destroyed after the first print(), because Mojo knows that it will be overwritten below. You can also see this behavior when using the transfer operator: pet.name print() ```mojo fn consume(owned arg: String): passfn use(arg: MyPet): print(arg.name)fn consume_and_use(): var pet = MyPet("Selma", 5) consume(pet.name^) # pet.name.__moveinit__() runs here, which destroys pet.name # Now pet is only partially initialized # use(pet) # This fails because pet.name is uninitialized pet.name = String("Jasper") # All together now use(pet) # This is ok # pet.__del__() runs here (and only if the object is whole) ``` Notice that the code transfers ownership of the name field to consume(). For a period of time after that, the name field is uninitialized. Then name is reinitialized before it is passed to the use() function. If you try calling use() before name is re-initialized, Mojo rejects the code with an uninitialized field error. name consume() name name use() use() name Also, if you don't re-initialize the name by the end of the pet lifetime, the compiler complains because it's unable to destroy a partially initialized object. pet Mojo's policy here is powerful and intentionally straight-forward: fields can be temporarily transferred, but the "whole object" must be constructed with the aggregate type’s initializer and destroyed with the aggregate destructor. This means it's impossible to create an object by initializing only its fields, and it's likewise impossible to destroy an object by destroying only its fields. ### Field lifetimes during destruct and move​ The consuming-move constructor and destructor face an interesting situation with field lifetimes, because, unlike other lifecycle methods, they both take an instance of their own type as an owned argument, which is about to be destroyed. You don't really need to worry about this detail when implementing these methods, but it might help you better understand field lifetimes. owned Just to recap, the move constructor and destructor method signatures look like this: ```mojo struct TwoStrings: fn __moveinit__(inout self, owned existing: Self): # Initializes a new `self` by consuming the contents of `existing` fn __del__(owned self): # Destroys all resources in `self` ``` There are two kinds of "self" here: capitalized Self is an alias for the current type name (used as a type specifier for the existing argument), whereas lowercase self is the argument name for the implicitly-passed reference to the current instance (also called "this" in other languages, and also implicitly a Self type). Self existing self Self Both of these methods face an interesting but obscure problem: they both must dismantle the existing/self value that's owned. That is, __moveinit__() implicitly destroys sub-elements of existing in order to transfer ownership to a new instance (read more about the move constructor), while __del__() implements the deletion logic for its self. As such, they both need to own and transform elements of the owned value, and they definitely don’t want the original owned value's destructor to also run—that could result in a double-free error, and in the case of the __del__() method, it would become an infinite loop. existing self owned __moveinit__() existing __del__() self owned owned __del__() To solve this problem, Mojo handles these two methods specially by assuming that their whole values are destroyed upon reaching any return from the method. This means that the whole object may be used as usual, up until the field values are transferred or the method returns. For example, the following code works as you would expect (within the destructor, we can still pass ownership of a field value to another function, and there's no infinite loop to destroy self): self ```mojo fn consume(owned str: String): print('Consumed', str)struct TwoStrings: var str1: String var str2: String fn __init__(inout self, one: String): self.str1 = one self.str2 = String("bar") fn __moveinit__(inout self, owned existing: Self): self.str1 = existing.str1 self.str2 = existing.str2 fn __del__(owned self): self.dump() # Self is still whole here # Mojo calls self.str2.__del__() since str2 isn't used anymore consume(self.str1^) # self.str1 has been transferred so it is also destroyed now; # `self.__del__()` is not called (avoiding an infinite loop). fn dump(inout self): print('str1:', self.str1) print('str2:', self.str2)fn use_two_strings(): var two_strings = TwoStrings("foo") ``` ## Explicit lifetimes​ So far, we've described how Mojo destroys a value at the point it's last used, and this works great in almost all situations. However, there are very rare situations in which Mojo simply cannot predict this correctly and will destroy a value that is still referenced through some other means. For instance, perhaps you're building a type with a field that carries a pointer to another field. The Mojo compiler won't be able to reason about the pointer, so it might destroy a field (obj1) when that field is technically no longer used, even though another field (obj2) still holds a pointer to part of it. So, you might need to keep obj1 alive until you can execute some special logic in the destructor or move initializer. obj1 obj2 obj1 You can force Mojo to keep a value alive up to a certain point by assigning the value to the _ discard pattern at the point where it's okay to destroy it. For example: _ ```mojo fn __del__(owned self): self.dump() # Self is still whole here consume(self.obj2^) _ = self.obj1 # Mojo keeps `obj1` alive until here, after its "last use" ``` In this case, if consume() refers to some value in obj1 somehow, this ensures that Mojo does not destroy obj1 until after the call to consume(), because assignment to the discard variable _ is actually the last use. consume() obj1 obj1 consume() _ For other situations, you can also scope the lifetime of a value using the Python-style with statement. That is, for any value defined at the entrance to a with statement, Mojo will keep that value alive until the end of the with statement. For example: with with with ```mojo with open("my_file.txt", "r") as file: print(file.read()) # Other stuff happens here (whether using `file` or not)... foo() # `file` is alive up to the end of the `with` statement.# `file` is destroyed when the statement ends.bar() ``` - Default destruction behavior - Benefits of ASAP destruction - Destructor - Field lifetimesField lifetimes during destruct and move - Field lifetimes during destruct and move - Explicit lifetimes - Field lifetimes during destruct and move - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/death#field-lifetimes-during-destruct-and-move - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Death of a value # Death of a value As soon as a value/object is no longer used, Mojo destroys it. Mojo does not wait until the end of a code block—or even until the end of an expression—to destroy an unused value. It destroys values using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. Even within an expression like a+b+c+d, Mojo destroys the intermediate values as soon as they're no longer needed. a+b+c+d Mojo uses static compiler analysis to find the point where a value is last used. Then, Mojo immediately ends the value's lifetime and calls the __del__() destructor to perform any necessary cleanup for the type. __del__() For example, notice when the __del__() destructor is called for each instance of MyPet: __del__() MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __del__(owned self): print("Destruct", self.name)fn pets(): var a = MyPet("Loki", 4) var b = MyPet("Sylvie", 2) print(a.name) # a.__del__() runs here for "Loki" a = MyPet("Charlie", 8) # a.__del__() runs immediately because "Charlie" is never used print(b.name) # b.__del__() runs herepets() ``` Notice that each initialization of a value is matched with a call to the destructor, and a is actually destroyed multiple times—once for each time it receives a new value. a Also notice that this __del__() implementation doesn't actually do anything. Most structs don't require a custom destructor, and Mojo automatically adds a no-op destructor if you don't define one. __del__() ### Default destruction behavior​ You may be wondering how Mojo can destroy a type without a custom destructor, or why a no-op destructor is useful. If a type is simply a collection of fields, like the MyPet example, Mojo only needs to destroy the fields: MyPet doesn't dynamically allocate memory or use any long-lived resources (like file handles). There's no special action to take when a MyPet value is destroyed. MyPet MyPet MyPet Looking at the individual fields, MyPet includes an Int and a String. The Int is what Mojo calls a trivial type. It's a statically-sized bundle of bits. Mojo knows exactly how big it is, so those bits can be reused to store something else. MyPet Int String Int The String value is a little more complicated. Mojo strings are mutable. The String object has an internal buffer—a List field, which holds the characters that make up the string. A List stores its contents in dynamically allocated memory on the heap, so the string can grow or shrink. The string itself doesn't have any special destructor logic, but when Mojo destroys a string, it calls the destructor for the List field, which de-allocates the memory. String String List List List Since String and Int don't require any custom destructor logic, they both have no-op destructors: literally, __del__() methods that don't do anything. This may seem pointless, but it means that Mojo can call the destructor on any value when its lifetime ends. This makes it easier to write generic containers and algorithms. String Int __del__() ### Benefits of ASAP destruction​ Similar to other languages, Mojo follows the principle that objects/values acquire resources in a constructor (__init__()) and release resources in a destructor (__del__()). However, Mojo's ASAP destruction has some advantages over scope-based destruction (such as the C++ RAII pattern, which waits until the end of the code scope to destroy values): __init__() __del__() - Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. - Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Additionally, Mojo's ASAP destruction works great within Python-style def functions. That's because Python doesn’t really provide scopes beyond a function scope, so the Python garbage collector cleans up resources more often than a scope-based destruction policy would. However, Mojo does not use a garbage collector, so the ASAP destruction policy provides destruction guarantees that are even more fine-grained than in Python. def The Mojo destruction policy is more similar to how Rust and Swift work, because they both have strong value ownership tracking and provide memory safety. One difference is that Rust and Swift require the use of a dynamic "drop flag"—they maintain hidden shadow variables to keep track of the state of your values to provide safety. These are often optimized away, but the Mojo approach eliminates this overhead entirely, making the generated code faster and avoiding ambiguity. ## Destructor​ Mojo calls a value's destructor (__del__() method) when the value's lifetime ends (typically the point at which the value is last used). As we mentioned earlier, Mojo provides a default, no-op destructor for all types, so in most cases you don't need to define the __del__() method. __del__() __del__() You should define the __del__() method to perform any kind of cleanup the type requires. Usually, that includes freeing memory for any fields where you dynamically allocated memory (for example, via Pointer or DTypePointer) and closing any long-lived resources such as file handles. __del__() Pointer DTypePointer However, any struct that is just a simple collection of other types does not need to implement the destructor. For example, consider this simple struct: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` There's no need to define the __del__() destructor for this, because it's a simple collection of other types (String and Int), and it doesn't dynamically allocate memory. __del__() String Int Whereas, the following struct must define the __del__() method to free the memory allocated by its UnsafePointer: __del__() UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct HeapArray: var data: UnsafePointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = UnsafePointer[Int].alloc(self.size) for i in range(self.size): initialize_pointee_copy(self.data + i, val) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data + i) self.data.free() ``` Note that a pointer doesn't own any values in the memory it points to, so when a pointer is destroyed, Mojo doesn't call the destructors on those values. So in the HeapArray example above, calling free() on the pointer releases the memory, but doesn't call the destructors on the stored values. To invoke the destructors, use the destroy_pointee() function from the unsafe_pointer module. HeapArray free() destroy_pointee() unsafe_pointer You can't just call the destructor explicitly. Because __del__() takes self as an owned value, and owned arguments are copied by default, foo.__del__() actually creates and destroys a copy of foo. When Mojo destroys a value, however, it passes in the original value as self, not a copy. __del__() self owned foo.__del__() foo self It's important to notice that the __del__() method is an "extra" cleanup event, and your implementation does not override any default destruction behaviors. For example, Mojo still destroys all the fields in MyPet even if you implement __del__() to do nothing: __del__() MyPet __del__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __del__(owned self): # Mojo destroys all the fields when they're last used pass ``` However, the self value inside the __del__() destructor is still whole (so all fields are still usable) until the destructor returns, as we'll discuss more in the following section. self __del__() ## Field lifetimes​ In addition to tracking the lifetime of all objects in a program, Mojo also tracks each field of a structure independently. That is, Mojo keeps track of whether a "whole object" is fully or partially initialized/destroyed, and it destroys each field independently with its ASAP destruction policy. For example, consider this code that changes the value of a field: ```mojo @valuestruct MyPet: var name: String var age: Intfn use_two_strings(): var pet = MyPet("Po", 8) print(pet.name) # pet.name.__del__() runs here, because this instance is # no longer used; it's replaced below pet.name = String("Lola") # Overwrite pet.name print(pet.name) # pet.__del__() runs here ``` The pet.name field is destroyed after the first print(), because Mojo knows that it will be overwritten below. You can also see this behavior when using the transfer operator: pet.name print() ```mojo fn consume(owned arg: String): passfn use(arg: MyPet): print(arg.name)fn consume_and_use(): var pet = MyPet("Selma", 5) consume(pet.name^) # pet.name.__moveinit__() runs here, which destroys pet.name # Now pet is only partially initialized # use(pet) # This fails because pet.name is uninitialized pet.name = String("Jasper") # All together now use(pet) # This is ok # pet.__del__() runs here (and only if the object is whole) ``` Notice that the code transfers ownership of the name field to consume(). For a period of time after that, the name field is uninitialized. Then name is reinitialized before it is passed to the use() function. If you try calling use() before name is re-initialized, Mojo rejects the code with an uninitialized field error. name consume() name name use() use() name Also, if you don't re-initialize the name by the end of the pet lifetime, the compiler complains because it's unable to destroy a partially initialized object. pet Mojo's policy here is powerful and intentionally straight-forward: fields can be temporarily transferred, but the "whole object" must be constructed with the aggregate type’s initializer and destroyed with the aggregate destructor. This means it's impossible to create an object by initializing only its fields, and it's likewise impossible to destroy an object by destroying only its fields. ### Field lifetimes during destruct and move​ The consuming-move constructor and destructor face an interesting situation with field lifetimes, because, unlike other lifecycle methods, they both take an instance of their own type as an owned argument, which is about to be destroyed. You don't really need to worry about this detail when implementing these methods, but it might help you better understand field lifetimes. owned Just to recap, the move constructor and destructor method signatures look like this: ```mojo struct TwoStrings: fn __moveinit__(inout self, owned existing: Self): # Initializes a new `self` by consuming the contents of `existing` fn __del__(owned self): # Destroys all resources in `self` ``` There are two kinds of "self" here: capitalized Self is an alias for the current type name (used as a type specifier for the existing argument), whereas lowercase self is the argument name for the implicitly-passed reference to the current instance (also called "this" in other languages, and also implicitly a Self type). Self existing self Self Both of these methods face an interesting but obscure problem: they both must dismantle the existing/self value that's owned. That is, __moveinit__() implicitly destroys sub-elements of existing in order to transfer ownership to a new instance (read more about the move constructor), while __del__() implements the deletion logic for its self. As such, they both need to own and transform elements of the owned value, and they definitely don’t want the original owned value's destructor to also run—that could result in a double-free error, and in the case of the __del__() method, it would become an infinite loop. existing self owned __moveinit__() existing __del__() self owned owned __del__() To solve this problem, Mojo handles these two methods specially by assuming that their whole values are destroyed upon reaching any return from the method. This means that the whole object may be used as usual, up until the field values are transferred or the method returns. For example, the following code works as you would expect (within the destructor, we can still pass ownership of a field value to another function, and there's no infinite loop to destroy self): self ```mojo fn consume(owned str: String): print('Consumed', str)struct TwoStrings: var str1: String var str2: String fn __init__(inout self, one: String): self.str1 = one self.str2 = String("bar") fn __moveinit__(inout self, owned existing: Self): self.str1 = existing.str1 self.str2 = existing.str2 fn __del__(owned self): self.dump() # Self is still whole here # Mojo calls self.str2.__del__() since str2 isn't used anymore consume(self.str1^) # self.str1 has been transferred so it is also destroyed now; # `self.__del__()` is not called (avoiding an infinite loop). fn dump(inout self): print('str1:', self.str1) print('str2:', self.str2)fn use_two_strings(): var two_strings = TwoStrings("foo") ``` ## Explicit lifetimes​ So far, we've described how Mojo destroys a value at the point it's last used, and this works great in almost all situations. However, there are very rare situations in which Mojo simply cannot predict this correctly and will destroy a value that is still referenced through some other means. For instance, perhaps you're building a type with a field that carries a pointer to another field. The Mojo compiler won't be able to reason about the pointer, so it might destroy a field (obj1) when that field is technically no longer used, even though another field (obj2) still holds a pointer to part of it. So, you might need to keep obj1 alive until you can execute some special logic in the destructor or move initializer. obj1 obj2 obj1 You can force Mojo to keep a value alive up to a certain point by assigning the value to the _ discard pattern at the point where it's okay to destroy it. For example: _ ```mojo fn __del__(owned self): self.dump() # Self is still whole here consume(self.obj2^) _ = self.obj1 # Mojo keeps `obj1` alive until here, after its "last use" ``` In this case, if consume() refers to some value in obj1 somehow, this ensures that Mojo does not destroy obj1 until after the call to consume(), because assignment to the discard variable _ is actually the last use. consume() obj1 obj1 consume() _ For other situations, you can also scope the lifetime of a value using the Python-style with statement. That is, for any value defined at the entrance to a with statement, Mojo will keep that value alive until the end of the with statement. For example: with with with ```mojo with open("my_file.txt", "r") as file: print(file.read()) # Other stuff happens here (whether using `file` or not)... foo() # `file` is alive up to the end of the `with` statement.# `file` is destroyed when the statement ends.bar() ``` - Default destruction behavior - Benefits of ASAP destruction - Destructor - Field lifetimesField lifetimes during destruct and move - Field lifetimes during destruct and move - Explicit lifetimes - Field lifetimes during destruct and move - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/death#explicit-lifetimes - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Death of a value # Death of a value As soon as a value/object is no longer used, Mojo destroys it. Mojo does not wait until the end of a code block—or even until the end of an expression—to destroy an unused value. It destroys values using an “as soon as possible” (ASAP) destruction policy that runs after every sub-expression. Even within an expression like a+b+c+d, Mojo destroys the intermediate values as soon as they're no longer needed. a+b+c+d Mojo uses static compiler analysis to find the point where a value is last used. Then, Mojo immediately ends the value's lifetime and calls the __del__() destructor to perform any necessary cleanup for the type. __del__() For example, notice when the __del__() destructor is called for each instance of MyPet: __del__() MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __del__(owned self): print("Destruct", self.name)fn pets(): var a = MyPet("Loki", 4) var b = MyPet("Sylvie", 2) print(a.name) # a.__del__() runs here for "Loki" a = MyPet("Charlie", 8) # a.__del__() runs immediately because "Charlie" is never used print(b.name) # b.__del__() runs herepets() ``` Notice that each initialization of a value is matched with a call to the destructor, and a is actually destroyed multiple times—once for each time it receives a new value. a Also notice that this __del__() implementation doesn't actually do anything. Most structs don't require a custom destructor, and Mojo automatically adds a no-op destructor if you don't define one. __del__() ### Default destruction behavior​ You may be wondering how Mojo can destroy a type without a custom destructor, or why a no-op destructor is useful. If a type is simply a collection of fields, like the MyPet example, Mojo only needs to destroy the fields: MyPet doesn't dynamically allocate memory or use any long-lived resources (like file handles). There's no special action to take when a MyPet value is destroyed. MyPet MyPet MyPet Looking at the individual fields, MyPet includes an Int and a String. The Int is what Mojo calls a trivial type. It's a statically-sized bundle of bits. Mojo knows exactly how big it is, so those bits can be reused to store something else. MyPet Int String Int The String value is a little more complicated. Mojo strings are mutable. The String object has an internal buffer—a List field, which holds the characters that make up the string. A List stores its contents in dynamically allocated memory on the heap, so the string can grow or shrink. The string itself doesn't have any special destructor logic, but when Mojo destroys a string, it calls the destructor for the List field, which de-allocates the memory. String String List List List Since String and Int don't require any custom destructor logic, they both have no-op destructors: literally, __del__() methods that don't do anything. This may seem pointless, but it means that Mojo can call the destructor on any value when its lifetime ends. This makes it easier to write generic containers and algorithms. String Int __del__() ### Benefits of ASAP destruction​ Similar to other languages, Mojo follows the principle that objects/values acquire resources in a constructor (__init__()) and release resources in a destructor (__del__()). However, Mojo's ASAP destruction has some advantages over scope-based destruction (such as the C++ RAII pattern, which waits until the end of the code scope to destroy values): __init__() __del__() - Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. - Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Destroying values immediately at last-use composes nicely with the "move" optimization, which transforms a "copy+del" pair into a "move" operation. Destroying values at end-of-scope in C++ is problematic for some common patterns like tail recursion, because the destructor call happens after the tail call. This can be a significant performance and memory problem for certain functional programming patterns, which is not a problem in Mojo, because the destructor call always happens before the tail call. Additionally, Mojo's ASAP destruction works great within Python-style def functions. That's because Python doesn’t really provide scopes beyond a function scope, so the Python garbage collector cleans up resources more often than a scope-based destruction policy would. However, Mojo does not use a garbage collector, so the ASAP destruction policy provides destruction guarantees that are even more fine-grained than in Python. def The Mojo destruction policy is more similar to how Rust and Swift work, because they both have strong value ownership tracking and provide memory safety. One difference is that Rust and Swift require the use of a dynamic "drop flag"—they maintain hidden shadow variables to keep track of the state of your values to provide safety. These are often optimized away, but the Mojo approach eliminates this overhead entirely, making the generated code faster and avoiding ambiguity. ## Destructor​ Mojo calls a value's destructor (__del__() method) when the value's lifetime ends (typically the point at which the value is last used). As we mentioned earlier, Mojo provides a default, no-op destructor for all types, so in most cases you don't need to define the __del__() method. __del__() __del__() You should define the __del__() method to perform any kind of cleanup the type requires. Usually, that includes freeing memory for any fields where you dynamically allocated memory (for example, via Pointer or DTypePointer) and closing any long-lived resources such as file handles. __del__() Pointer DTypePointer However, any struct that is just a simple collection of other types does not need to implement the destructor. For example, consider this simple struct: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` There's no need to define the __del__() destructor for this, because it's a simple collection of other types (String and Int), and it doesn't dynamically allocate memory. __del__() String Int Whereas, the following struct must define the __del__() method to free the memory allocated by its UnsafePointer: __del__() UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct HeapArray: var data: UnsafePointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = UnsafePointer[Int].alloc(self.size) for i in range(self.size): initialize_pointee_copy(self.data + i, val) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data + i) self.data.free() ``` Note that a pointer doesn't own any values in the memory it points to, so when a pointer is destroyed, Mojo doesn't call the destructors on those values. So in the HeapArray example above, calling free() on the pointer releases the memory, but doesn't call the destructors on the stored values. To invoke the destructors, use the destroy_pointee() function from the unsafe_pointer module. HeapArray free() destroy_pointee() unsafe_pointer You can't just call the destructor explicitly. Because __del__() takes self as an owned value, and owned arguments are copied by default, foo.__del__() actually creates and destroys a copy of foo. When Mojo destroys a value, however, it passes in the original value as self, not a copy. __del__() self owned foo.__del__() foo self It's important to notice that the __del__() method is an "extra" cleanup event, and your implementation does not override any default destruction behaviors. For example, Mojo still destroys all the fields in MyPet even if you implement __del__() to do nothing: __del__() MyPet __del__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __del__(owned self): # Mojo destroys all the fields when they're last used pass ``` However, the self value inside the __del__() destructor is still whole (so all fields are still usable) until the destructor returns, as we'll discuss more in the following section. self __del__() ## Field lifetimes​ In addition to tracking the lifetime of all objects in a program, Mojo also tracks each field of a structure independently. That is, Mojo keeps track of whether a "whole object" is fully or partially initialized/destroyed, and it destroys each field independently with its ASAP destruction policy. For example, consider this code that changes the value of a field: ```mojo @valuestruct MyPet: var name: String var age: Intfn use_two_strings(): var pet = MyPet("Po", 8) print(pet.name) # pet.name.__del__() runs here, because this instance is # no longer used; it's replaced below pet.name = String("Lola") # Overwrite pet.name print(pet.name) # pet.__del__() runs here ``` The pet.name field is destroyed after the first print(), because Mojo knows that it will be overwritten below. You can also see this behavior when using the transfer operator: pet.name print() ```mojo fn consume(owned arg: String): passfn use(arg: MyPet): print(arg.name)fn consume_and_use(): var pet = MyPet("Selma", 5) consume(pet.name^) # pet.name.__moveinit__() runs here, which destroys pet.name # Now pet is only partially initialized # use(pet) # This fails because pet.name is uninitialized pet.name = String("Jasper") # All together now use(pet) # This is ok # pet.__del__() runs here (and only if the object is whole) ``` Notice that the code transfers ownership of the name field to consume(). For a period of time after that, the name field is uninitialized. Then name is reinitialized before it is passed to the use() function. If you try calling use() before name is re-initialized, Mojo rejects the code with an uninitialized field error. name consume() name name use() use() name Also, if you don't re-initialize the name by the end of the pet lifetime, the compiler complains because it's unable to destroy a partially initialized object. pet Mojo's policy here is powerful and intentionally straight-forward: fields can be temporarily transferred, but the "whole object" must be constructed with the aggregate type’s initializer and destroyed with the aggregate destructor. This means it's impossible to create an object by initializing only its fields, and it's likewise impossible to destroy an object by destroying only its fields. ### Field lifetimes during destruct and move​ The consuming-move constructor and destructor face an interesting situation with field lifetimes, because, unlike other lifecycle methods, they both take an instance of their own type as an owned argument, which is about to be destroyed. You don't really need to worry about this detail when implementing these methods, but it might help you better understand field lifetimes. owned Just to recap, the move constructor and destructor method signatures look like this: ```mojo struct TwoStrings: fn __moveinit__(inout self, owned existing: Self): # Initializes a new `self` by consuming the contents of `existing` fn __del__(owned self): # Destroys all resources in `self` ``` There are two kinds of "self" here: capitalized Self is an alias for the current type name (used as a type specifier for the existing argument), whereas lowercase self is the argument name for the implicitly-passed reference to the current instance (also called "this" in other languages, and also implicitly a Self type). Self existing self Self Both of these methods face an interesting but obscure problem: they both must dismantle the existing/self value that's owned. That is, __moveinit__() implicitly destroys sub-elements of existing in order to transfer ownership to a new instance (read more about the move constructor), while __del__() implements the deletion logic for its self. As such, they both need to own and transform elements of the owned value, and they definitely don’t want the original owned value's destructor to also run—that could result in a double-free error, and in the case of the __del__() method, it would become an infinite loop. existing self owned __moveinit__() existing __del__() self owned owned __del__() To solve this problem, Mojo handles these two methods specially by assuming that their whole values are destroyed upon reaching any return from the method. This means that the whole object may be used as usual, up until the field values are transferred or the method returns. For example, the following code works as you would expect (within the destructor, we can still pass ownership of a field value to another function, and there's no infinite loop to destroy self): self ```mojo fn consume(owned str: String): print('Consumed', str)struct TwoStrings: var str1: String var str2: String fn __init__(inout self, one: String): self.str1 = one self.str2 = String("bar") fn __moveinit__(inout self, owned existing: Self): self.str1 = existing.str1 self.str2 = existing.str2 fn __del__(owned self): self.dump() # Self is still whole here # Mojo calls self.str2.__del__() since str2 isn't used anymore consume(self.str1^) # self.str1 has been transferred so it is also destroyed now; # `self.__del__()` is not called (avoiding an infinite loop). fn dump(inout self): print('str1:', self.str1) print('str2:', self.str2)fn use_two_strings(): var two_strings = TwoStrings("foo") ``` ## Explicit lifetimes​ So far, we've described how Mojo destroys a value at the point it's last used, and this works great in almost all situations. However, there are very rare situations in which Mojo simply cannot predict this correctly and will destroy a value that is still referenced through some other means. For instance, perhaps you're building a type with a field that carries a pointer to another field. The Mojo compiler won't be able to reason about the pointer, so it might destroy a field (obj1) when that field is technically no longer used, even though another field (obj2) still holds a pointer to part of it. So, you might need to keep obj1 alive until you can execute some special logic in the destructor or move initializer. obj1 obj2 obj1 You can force Mojo to keep a value alive up to a certain point by assigning the value to the _ discard pattern at the point where it's okay to destroy it. For example: _ ```mojo fn __del__(owned self): self.dump() # Self is still whole here consume(self.obj2^) _ = self.obj1 # Mojo keeps `obj1` alive until here, after its "last use" ``` In this case, if consume() refers to some value in obj1 somehow, this ensures that Mojo does not destroy obj1 until after the call to consume(), because assignment to the discard variable _ is actually the last use. consume() obj1 obj1 consume() _ For other situations, you can also scope the lifetime of a value using the Python-style with statement. That is, for any value defined at the entrance to a with statement, Mojo will keep that value alive until the end of the with statement. For example: with with with ```mojo with open("my_file.txt", "r") as file: print(file.read()) # Other stuff happens here (whether using `file` or not)... foo() # `file` is alive up to the end of the `with` statement.# `file` is destroyed when the statement ends.bar() ``` - Default destruction behavior - Benefits of ASAP destruction - Destructor - Field lifetimesField lifetimes during destruct and move - Field lifetimes during destruct and move - Explicit lifetimes - Field lifetimes during destruct and move - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#background - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#using-traits - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#traits-can-require-static-methods - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#implicit-trait-conformance - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#trait-inheritance - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#traits-and-lifecycle-methods - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#built-in-traits - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#the-sized-trait - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#the-intable-and-stringable-traits - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/traits#generic-structs-with-traits - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Traits # Traits A trait is a set of requirements that a type must implement. You can think of it as a contract: a type that conforms to a trait guarantees that it implements all of the features of the trait. Traits are similar to Java interfaces, C++ concepts, Swift protocols, and Rust traits. If you're familiar with any of those features, Mojo traits solve the same basic problem. ## Background​ In dynamically-typed languages like Python, you don't need to explicitly declare that two classes are similar. This is easiest to show by example: ```mojo %%pythonclass Duck: def quack(self): print("Quack.")class StealthCow: def quack(self): print("Moo!")def make_it_quack_python(maybe_a_duck): try: maybe_a_duck.quack() except: print("Not a duck.")make_it_quack_python(Duck())make_it_quack_python(StealthCow()) ``` The Duck and StealthCow classes aren't related in any way, but they both define a quack() method, so they work the same in the make_it_quack() function. This works because Python uses dynamic dispatch—it identifies the methods to call at runtime. So make_it_quack_python() doesn't care what types you're passing it, only the fact that they implement the quack() method. Duck StealthCow quack() make_it_quack() make_it_quack_python() quack() In a statically-typed environment, this approach doesn't work: fn functions require you to specify the type of each argument. If you wanted to write this example in Mojo without traits, you'd need to write a function overload for each input type. All of the examples from here on are in Mojo, so we'll just call the function make_it_quack() going forward. fn make_it_quack() ```mojo @valuestruct Duck: fn quack(self): print("Quack")@valuestruct StealthCow: fn quack(self): print("Moo!")fn make_it_quack(definitely_a_duck: Duck): definitely_a_duck.quack()fn make_it_quack(not_a_duck: StealthCow): not_a_duck.quack()make_it_quack(Duck())make_it_quack(StealthCow()) ``` This isn't too bad with only two classes. But the more classes you want to support, the less practical this approach is. You might notice that the Mojo versions of make_it_quack() don't include the try/except statement. We don't need it because Mojo's static type checking ensures that you can only pass instances of Duck or StealthCow into the make_it_quack()function. make_it_quack() try/except Duck StealthCow make_it_quack() ## Using traits​ Traits solve this problem by letting you define a shared set of behaviors that types can implement. Then you can write a function that depends on the trait, rather than individual types. As an example, let's update the make_it_quack() example using traits. The first step is defining a trait: make_it_quack() ```mojo trait Quackable: fn quack(self): ... ``` A trait looks a lot like a struct, except it's introduced by the trait keyword. Right now, a trait can only contain method signatures, and cannot include method implementations. Each method signature must be followed by three dots (...) to indicate that the method is unimplemented. trait ... In the future, we plan to support defining fields and default method implementations inside a trait. Right now, though, a trait can only declare method signatures. Next we create some structs that conform to the Quackable trait. To indicate that a struct conforms to a trait, include the trait name in parenthesis after the struct name. You can also include multiple traits, separated by commas. (If you're familiar with Python, this looks just like Python's inheritance syntax.) Quackable ```mojo @valuestruct Duck(Quackable): fn quack(self): print("Quack")@valuestruct StealthCow(Quackable): fn quack(self): print("Moo!") ``` The struct needs to implement any methods that are declared in the trait. The compiler enforces conformance: if a struct says it conforms to a trait, it must implement everything required by the trait or the code won't compile. Finally, you can define a function that takes a Quackable like this: Quackable ```mojo fn make_it_quack[T: Quackable](maybe_a_duck: T): maybe_a_duck.quack() ``` This syntax may look a little unfamiliar if you haven't dealt with Mojo parameters before. What this signature means is that maybe_a_duck is an argument of type T, where T is a type that must conform to the Quackable trait. TODO: This syntax is a little verbose, and we hope to make it more ergonomic in a future release. maybe_a_duck T T Quackable Using the method is simple enough: ```mojo make_it_quack(Duck())make_it_quack(StealthCow()) ``` Note that you don't need the square brackets when you call make_it_quack(): the compiler infers the type of the argument, and ensures the type has the required trait. make_it_quack() One limitation of traits is that you can't add traits to existing types. For example, if you define a new Numeric trait, you can't add it to the standard library Float64 and Int types. However, the standard library already includes a few traits, and we'll be adding more over time. Numeric Float64 Int ### Traits can require static methods​ In addition to regular instance methods, traits can specify required static methods. ```mojo trait HasStaticMethod: @staticmethod fn do_stuff(): ...fn fun_with_traits[T: HasStaticMethod](): T.do_stuff() ``` ## Implicit trait conformance​ Mojo also supports implicit trait conformance. That is, if a type implements all of the methods required for a trait, it's treated as conforming to the trait, even if it doesn't explicitly include the trait in its declaration: ```mojo struct RubberDucky: fn quack(self): print("Squeak!")make_it_quack(RubberDucky()) ``` Implicit conformance can be handy if you're defining a trait and you want it to work with types that you don't control—such as types from the standard library, or a third-party library. However, we still strongly recommend explicit trait conformance wherever possible. This has two advantages: - Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. - Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. Documentation. It makes it clear that the type conforms to the trait, without having to scan all of its methods. Future feature support. When default method implementations are added to traits, they'll only work for types that explicitly conform to traits. ## Trait inheritance​ Traits can inherit from other traits. A trait that inherits from another trait includes all of the requirements declared by the parent trait. For example: ```mojo trait Animal: fn make_sound(self): ...# Bird inherits from Animaltrait Bird(Animal): fn fly(self): ... ``` Since Bird inherits from Animal, a struct that conforms to the Bird trait needs to implement both make_sound() and fly(). And since every Bird conforms to Animal, a struct that conforms to Bird can be passed to any function that requires an Animal. Bird Animal Bird make_sound() fly() Bird Animal Bird Animal To inherit from multiple traits, add a comma-separated list of traits inside the parenthesis. For example, you could define a NamedAnimal trait that combines the requirements of the Animal trait and a new Named trait: NamedAnimal Animal Named ```mojo trait Named: fn get_name(self) -> String: ...trait NamedAnimal(Animal, Named): pass ``` ## Traits and lifecycle methods​ Traits can specify required lifecycle methods, including constructors, copy constructors and move constructors. For example, the following code creates a MassProducible trait. A MassProducible type has a default (no-argument) constructor and can be moved. It uses the built-in Movable trait, which requires the type to have a move constructor. MassProducible MassProducible Movable The factory[]() function returns a newly-constructed instance of a MassProducible type. factory[]() MassProducible ```mojo trait DefaultConstructible: fn __init__(inout self): ...trait MassProducible(DefaultConstructible, Movable): passfn factory[T: MassProducible]() -> T: return T()struct Thing(MassProducible): var id: Int fn __init__(inout self): self.id = 0 fn __moveinit__(inout self, owned existing: Self): self.id = existing.idvar thing = factory[Thing]() ``` Note that @register_passable("trivial") types have restrictions on their lifecycle methods: they can't define copy or move constructors, because they don't require any custom logic. @register_passable("trivial") For the purpose of trait conformance, the compiler treats trivial types as copyable and movable. ## Built-in traits​ The Mojo standard library currently includes a few traits. They're implemented by a number of standard library types, and you can also implement these on your own types: - Absable - AnyType - Boolable - BoolableCollectionElement - BoolableKeyElement - CollectionElement - Copyable - Intable - KeyElement - Movable - PathLike - Powable - Representable - RepresentableCollectionElement - RepresentableKeyElement - Sized - Stringable Absable AnyType Boolable BoolableCollectionElement BoolableKeyElement CollectionElement Copyable Intable KeyElement Movable PathLike Powable Representable RepresentableCollectionElement RepresentableKeyElement Sized Stringable The API reference docs linked above include usage examples for each trait. The following sections discuss a few of these traits. ### The Sized trait​ Sized The Sized trait identifies types that have a measurable length, like strings and arrays. Sized Specifically, Sized requires a type to implement the __len__() method. This trait is used by the built-in len() function. For example, if you're writing a custom list type, you could implement this trait so your type works with len(): Sized __len__() len() len() ```mojo struct MyList(Sized): var size: Int # ... fn __init__(inout self): self.size = 0 fn __len__(self) -> Int: return self.sizeprint(len(MyList())) ``` ### The Intable and Stringable traits​ Intable Stringable The Intable and Stringable traits identify types that can be implicitly converted to Int and String, respectively. Intable Stringable Int String Any type that conforms to Stringable works with the built-in print() and str() functions: Stringable print() str() ```mojo @valuestruct Pet(Stringable): var name: String var type: String fn __str__(self) -> String: return "This is a " + self.type + " named " + self.namevar spot = Pet("Spot", "dog")print(spot) ``` Similarly, an Intable type works with the built-in int function. You can find an example in the Intable API reference. Intable int Intable ### The AnyType trait​ AnyType When building a generic container type, one challenge is knowing how to dispose of the contained items when the container is destroyed. Any type that dynamically allocates memory needs to supply a destructor (__del__() method) that must be called to free the allocated memory. But not all types have a destructor, and your Mojo code has no way to determine which is which. __del__() The AnyType trait solves this issue: every trait implicitly inherits from AnyType, and all structs conform to AnyType, which guarantees that the type has a destructor. For types that don't have one, Mojo adds a no-op destructor. This means you can call the destructor on any type. AnyType AnyType AnyType This makes it possible to build generic collections without leaking memory. When the collection's destructor is called, it can safely call the destructors on every item it contains. ## Generic structs with traits​ You can also use traits when defining a generic container. A generic container is a container (for example, an array or hashmap) that can hold different data types. In a dynamic language like Python it's easy to add different types of items to a container. But in a statically-typed environment the compiler needs to be able to identify the types at compile time. For example, if the container needs to copy a value, the compiler needs to verify that the type can be copied. The List type is an example of a generic container. A single List can only hold a single type of data. For example, you can create a list of integer values like this: List List ```mojo from collections import Listvar list = List[Int](1, 2, 3)for i in range(len(list)): print(list[i], sep=" ", end="") ``` You can use traits to define requirements for elements that are stored in a container. For example, List requires elements that can be moved and copied. To store a struct in a List, the struct needs to conform to the CollectionElement trait, which requires a copy constructor and a move constructor. List List CollectionElement Building generic containers is an advanced topic. For an introduction, see the section on parameterized structs. - Background - Using traitsTraits can require static methods - Traits can require static methods - Implicit trait conformance - Trait inheritance - Traits and lifecycle methods - Built-in traitsThe Sized traitThe Intable and Stringable traitsThe AnyType trait - The Sized trait - The Intable and Stringable traits - The AnyType trait - Generic structs with traits - Traits can require static methods - The Sized trait - The Intable and Stringable traits - The AnyType trait Sized Intable Stringable AnyType - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#parameterized-structs - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#parameterized-functions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/parameter - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@parameter # @parameter You can add the @parameter decorator on an if statement or on a nested function to run that code at compile time. @parameter if ## Parametric if statement​ You can add @parameter to any if condition that's based on a valid parameter expression (it's an expression that evaluates at compile time). This ensures that only the live branch of the if statement is compiled into the program, which can reduce your final binary size. For example: @parameter if if ```mojo @parameterif True: print("this will be included in the binary")else: print("this will be eliminated at compile time") ``` ## Parametric for statement​ You can add the @parameter decorator to an for loop to create a loop that's evaluated at compile time. The loop sequence and induction values must be a valid parameter expressions (that is, an expressions that evaluate at compile time). @parameter for This has the effect of "unrolling" the loop. ```mojo fn parameter_for[max: Int](): @parameter for i in range(max) @parameter if i == 10: print("found 10!") ``` Currently, @parameter for requires the sequence's __iter__ method to return a _StridedRangeIterator, meaning the induction variables must be Int. The intention is to lift these restrictions in the future. @parameter for __iter__ _StridedRangeIterator Int ### Compared to unroll()​ unroll() The Mojo standard library also includes a function called unroll() that unrolls a given function that you want to call repeatedly, but has some important differences when compared to the parametric for statement: unroll() for - The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. - The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. @parameter for unroll() The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. for for continue By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. unroll() Both unroll() and @parameter for unroll at the beginning of compilation, which might explode the size of the program that still needs to be compiled, depending on the amount of code that's unrolled. unroll() @parameter for ## Parametric closure​ You can add @parameter on a nested function to create a “parametric” capturing closure. This means you can create a closure function that captures values from the outer scope (regardless of whether they are variables or parameters), and then use that closure as a parameter. For example: @parameter ```mojo fn use_closure[func: fn(Int) capturing -> Int](num: Int) -> Int: return func(num)fn create_closure(): var x = 1 @parameter fn add(i: Int) -> Int: return x + i var y = use_closure[add](2) print(y)create_closure() ``` Without the @parameter decorator, you'll get a compiler error that says you "cannot use a dynamic value in call parameter"—referring to the use_closure[add](2) call—because the add() closure would still be dynamic. @parameter use_closure[add](2) add() This is an unsafe feature because we currently do not model the lifetimes of capture-by-reference. - Parametric if statement - Parametric for statementCompared to unroll() - Compared to unroll() - Parametric closure - Compared to unroll() unroll() - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#parameters-and-generics - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#case-study-the-simd-type - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#overloading-on-parameters - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#using-parameterized-types-and-functions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#parameter-inference - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#optional-parameters-and-keyword-parameters - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#infer-only-parameters - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#parameter-expressions-are-just-mojo-code - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#powerful-compile-time-programming - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#mojo-types-are-just-parameter-expressions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#fully-bound-partially-bound-and-unbound-types - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#automatic-parameterization-of-functions - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#omitted-parameters - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#automatic-parameterization-with-partially-bound-types - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/parameters/#legacy-syntax-omitted-parameters - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Traits and parameters - /Parameterization: compile-time metaprogramming # Parameterization: compile-time metaprogramming Many languages have facilities for metaprogramming: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use. To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features. The main new feature is parameters. You can think of a parameter as a compile-time variable that becomes a runtime constant. This usage of "parameter" is probably different from what you're used to from other languages, where "parameter" and "argument" are often used interchangeably. In Mojo, "parameter" and "parameter expression" refer to compile-time values, and "argument" and "expression" refer to runtime values. In Mojo, you can add parameters to a struct or function. You can also define named parameter expressions—aliases—that you can use as runtime constants. ## Parameterized functions​ To define a parameterized function, add parameters in square brackets ahead of the argument list. Each parameter is formatted just like an argument: a parameter name, followed by a colon and a type (which is required). In the following example, the function has a single parameter, count of type Int. count Int ```mojo fn repeat[count: Int](msg: String): @parameter for i in range(count): print(msg) ``` The @parameter directive shown here causes the for loop to be evaluated at compile time. The directive only works if the loop limits are compile-time constants. Since count is a parameter, range(count) can be calculated at compile time. @parameter for count range(count) Calling a parameterized function, you provide values for the parameters, just like function arguments: ```mojo repeat[3]("Hello") ``` The compiler resolves the parameter values during compilation, and creates a concrete version of the repeat[]() function for each unique parameter value. After resolving the parameter values and unrolling the loop, the repeat[3]() function would be roughly equivalent to this: repeat[]() repeat[3]() ```mojo fn repeat_3(msg: String): print(msg) print(msg) print(msg) ``` This doesn't represent actual code generated by the compiler. By the time parameters are resolved, Mojo code has already been transformed to an intermediate representation in MLIR. If the compiler can't resolve all parameter values to constant values, compilation fails. ## Parameters and generics​ "Generics" refers to functions that can act on multiple types of values, or containers that can hold multiple types of values. For example, List, can hold different types of values, so you can have a list of Int values, or a list of String values). List Int String In Mojo, generics use parameters to specify types. For example, List takes a type parameter, so a vector of integers is written List[Int]. So all generics use parameters, but not everything that uses parameters is a generic. List List[Int] For example, the repeat[]() function in the previous section includes parameter of type Int, and an argument of type String. It's parameterized, but not generic. A generic function or struct is parameterized on type. For example, we could rewrite repeat[]() to take any type of argument that conforms to the Stringable trait: repeat[]() Int String repeat[]() Stringable ```mojo fn repeat[MsgType: Stringable, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# Must use keyword parameter for `count`repeat[count=2](42) ``` This updated function takes any Stringable type, so you can pass it an Int, String, or Bool value. Stringable Int String Bool You can't pass the count as a positional keyword without also specifying MsgType. You can put // after MsgType to specify that it's always inferred by the argument. Now you can pass the following parameter count positionally: count MsgType // MsgType count ```mojo fn repeat[MsgType: Stringable, //, count: Int](msg: MsgType): @parameter for i in range(count): print(msg)# MsgType is always inferred, so first positional keyword `2` is passed to `count`repeat[2](42) ``` Mojo's support for generics is still early. You can write generic functions like this using traits and parameters. You can also write generic collections like List and Dict. If you're interested in learning how these types work, you can find the source code for the standard library collection types on GitHub. List Dict ## Parameterized structs​ You can also add parameters to structs. You can use parameterized structs to build generic containers. For example, a generic array type might include code like this: ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, destroy_pointeestruct GenericArray[ElementType: CollectionElement]: var data: UnsafePointer[ElementType] var size: Int fn __init__(inout self, *elements: ElementType): self.size = len(elements) self.data = UnsafePointer[ElementType].alloc(self.size) for i in range(self.size): initialize_pointee_move(self.data.offset(i), elements[i]) fn __del__(owned self): for i in range(self.size): destroy_pointee(self.data.offset(i)) self.data.free() fn __getitem__(self, i: Int) raises -> ref [__lifetime_of(self)] ElementType: if (i < self.size): return self.data[i] else: raise Error("Out of bounds") ``` This struct has a single parameter, ElementType, which is a placeholder for the data type you want to store in the array, sometimes called a type parameter. ElementType is typed as CollectionElement, which is a trait representing any type that can be copied and moved. ElementType ElementType CollectionElement As with parameterized functions, you need to pass in parameter values when you use a parameterized struct. In this case, when you create an instance of GenericArray, you need to specify the type you want to store, like Int, or Float64. (This is a little confusing, because the parameter value you're passing in this case is a type. That's OK: a Mojo type is a valid compile-time value.) GenericArray Int Float64 You'll see that ElementType is used throughout the struct where you'd usually see a type name. For example, as the formal type for the elements in the constructor, and the return type of the __getitem__() method. ElementType elements __getitem__() Here's an example of using GenericArray: GenericArray ```mojo var array = GenericArray[Int](1, 2, 3, 4)for i in range(array.size): print(array[i], end=" ") ``` A parameterized struct can use the Self type to represent a concrete instance of the struct (that is, with all its parameters specified). For example, you could add a static factory method to GenericArray with the following signature: Self GenericArray ```mojo struct GenericArray[ElementType: CollectionElement]: ... @staticmethod fn splat(count: Int, value: ElementType) -> Self: # Create a new array with count instances of the given value ``` Here, Self is equivalent to writing GenericArray[ElementType]. That is, you can call the splat() method like this: Self GenericArray[ElementType] splat() ```mojo GenericArray[Float64].splat(8, 0) ``` The method returns an instance of GenericArray[Float64]. GenericArray[Float64] ### Case study: the SIMD type​ For a real-world example of a parameterized type, let's look at the SIMD type from Mojo's standard library. SIMD Single instruction, multiple data (SIMD) is a parallel processing technology built into many modern CPUs, GPUs, and custom accelerators. SIMD allows you to perform a single operation on multiple pieces of data at once. For example, if you want to take the square root of each element in an array, you can use SIMD to parallelize the work. Processors implement SIMD using low-level vector registers in hardware that hold multiple instances of a scalar data type. In order to use the SIMD instructions on these processors, the data must be shaped into the proper SIMD width (data type) and length (vector size). Processors may support 512-bit or longer SIMD vectors, and support many data types from 8-bit integers to 64-bit floating point numbers, so it's not practical to define all of the possible SIMD variations. Mojo's SIMD type (defined as a struct) exposes the common SIMD operations through its methods, and makes the SIMD data type and size values parametric. This allows you to directly map your data to the SIMD vectors on any hardware. SIMD Here's a cut-down (non-functional) version of Mojo's SIMD type definition: SIMD ```mojo struct SIMD[type: DType, size: Int]: var value: … # Some low-level MLIR stuff here # Create a new SIMD from a number of scalars fn __init__(inout self, *elems: SIMD[type, 1]): ... # Fill a SIMD with a duplicated scalar value. @staticmethod fn splat(x: SIMD[type, 1]) -> SIMD[type, size]: ... # Cast the elements of the SIMD to a different elt type. fn cast[target: DType](self) -> SIMD[target, size]: ... # Many standard operators are supported. fn __add__(self, rhs: Self) -> Self: ... ``` So you can create and use a SIMD vector like this: ```mojo var vector = SIMD[DType.int16, 4](1, 2, 3, 4)vector = vector * vectorfor i in range(4): print(vector[i], end=" ") ``` As you can see, a simple arithmetic operator like * applied to a pair of SIMD vector operates on the corresponding elements in each vector. * SIMD Defining each SIMD variant with parameters is great for code reuse because the SIMD type can express all the different vector variants statically, instead of requiring the language to pre-define every variant. SIMD Because SIMD is a parameterized type, the self argument in its functions carries those parameters—the full type name is SIMD[type, size]. Although it's valid to write this out (as shown in the return type of splat()), this can be verbose, so we recommend using the Self type (from PEP673) like the __add__ example does. SIMD self SIMD[type, size] splat() Self __add__ ## Overloading on parameters​ Functions and methods can be overloaded on their parameter signatures. The overload resolution logic filters for candidates according to the following rules, in order of precedence: - Candidates with the minimal number of implicit conversions (in both arguments and parameters). - Candidates without variadic arguments. - Candidates without variadic parameters. - Candidates with the shortest parameter signature. - Non-@staticmethod candidates (over @staticmethod ones, if available). @staticmethod @staticmethod If there is more than one candidate after applying these rules, the overload resolution fails. For example: ```mojo @register_passable("trivial")struct MyInt: """A type that is implicitly convertible to `Int`.""" var value: Int @always_inline("nodebug") fn __init__(inout self, _a: Int): self.value = _afn foo[x: MyInt, a: Int](): print("foo[x: MyInt, a: Int]()")fn foo[x: MyInt, y: MyInt](): print("foo[x: MyInt, y: MyInt]()")fn bar[a: Int](b: Int): print("bar[a: Int](b: Int)")fn bar[a: Int](*b: Int): print("bar[a: Int](*b: Int)")fn bar[*a: Int](b: Int): print("bar[*a: Int](b: Int)")fn parameter_overloads[a: Int, b: Int, x: MyInt](): # `foo[x: MyInt, a: Int]()` is called because it requires no implicit # conversions, whereas `foo[x: MyInt, y: MyInt]()` requires one. foo[x, a]() # `bar[a: Int](b: Int)` is called because it does not have variadic # arguments or parameters. bar[a](b) # `bar[*a: Int](b: Int)` is called because it has variadic parameters. bar[a, a, a](b)parameter_overloads[1, 2, MyInt(3)]()struct MyStruct: fn __init__(inout self): pass fn foo(inout self): print("calling instance method") @staticmethod fn foo(): print("calling static method")fn test_static_overload(): var a = MyStruct() # `foo(inout self)` takes precedence over a static method. a.foo() ``` ## Using parameterized types and functions​ You can use parametric types and functions by passing values to the parameters in square brackets. For example, for the SIMD type above, type specifies the data type and size specifies the length of the SIMD vector (it must be a power of 2): SIMD type size ```mojo # Make a vector of 4 floats.var small_vec = SIMD[DType.float32, 4](1.0, 2.0, 3.0, 4.0)# Make a big vector containing 1.0 in float16 format.var big_vec = SIMD[DType.float16, 32].splat(1.0)# Do some math and convert the elements to float32.var bigger_vec = (big_vec+big_vec).cast[DType.float32]()# You can write types out explicitly if you want of course.var bigger_vec2 : SIMD[DType.float32, 32] = bigger_vecprint('small_vec type:', small_vec.element_type, 'length:', len(small_vec))print('bigger_vec2 type:', bigger_vec2.element_type, 'length:', len(bigger_vec2)) ``` Note that the cast() method also needs a parameter to specify the type you want from the cast (the method definition above expects a target parametric value). Thus, just as the SIMD struct is a generic type definition, the cast() method is a generic method definition. At compile time, the compiler creates a concrete version of the cast() method with the target parameter bound to DType.float32. cast() target SIMD cast() cast() DType.float32 The code above shows the use of concrete types (that is, the parameters are all bound to known values). But the major power of parameters comes from the ability to define parametric algorithms and types (code that uses the parameter values). For example, here's how to define a parametric algorithm with SIMD that is type- and width-agnostic: SIMD ```mojo from math import sqrtfn rsqrt[dt: DType, width: Int](x: SIMD[dt, width]) -> SIMD[dt, width]: return 1 / sqrt(x)var v = SIMD[DType.float16, 4](42)print(rsqrt(v)) ``` Notice that the x argument is actually a SIMD type based on the function parameters. The runtime program can use the value of the parameters, because the parameters are resolved at compile-time before they are needed by the runtime program (but compile-time parameter expressions cannot use runtime values). x SIMD ### Parameter inference​ The Mojo compiler can often infer parameter values, so you don't always have to specify them. For example, you can call the rsqrt() function defined above without any parameters: rsqrt() ```mojo var v = SIMD[DType.float16, 4](33)print(rsqrt(v)) ``` The compiler infers its parameters based on the parametric v value passed into it, as if you wrote rsqrt[DType.float16, 4](v) explicitly. v rsqrt[DType.float16, 4](v) Mojo can also infer the values of struct parameters from the arguments passed to a constructor or static method. For example, consider the following struct: ```mojo @valuestruct One[Type: StringableCollectionElement]: var value: Type fn __init__(inout self, value: Type): self.value = valuedef use_one(): s1 = One(123) s2 = One("Hello") ``` Note that you can create an instance of One without specifying the Type parameter—Mojo can infer it from the value argument. One Type value You can also infer parameters from a parameterized type passed to a constructor or static method: ```mojo struct Two[Type: StringableCollectionElement]: var val1: Type var val2: Type fn __init__(inout self, one: One[Type], another: One[Type]): self.val1 = one.value self.val2 = another.value print(self.val1, self.val2) @staticmethod fn fire(thing1: One[Type], thing2: One[Type]): print("🔥", thing1.value, thing2.value)def use_two(): s3 = Two(One("infer"), One("me")) Two.fire(One(1), One(2))use_two() ``` Two takes a Type parameter, and its constructor takes values of type One[Type]. When constructing an instance of Two, you don't need to specify the Type parameter, since it can be inferred from the arguments. Two Type One[Type] Two Type Similarly, the static fire() method takes values of type One[Type], so Mojo can infer the Type value at compile time. fire() One[Type] Type If you're familiar with C++, you may recognize this as similar to Class Template Argument Deduction (CTAD). ## Optional parameters and keyword parameters​ Just as you can specify optional arguments in function signatures, you can also define an optional parameter by giving it a default value. You can also pass parameters by keyword, just like you can use keyword arguments. For a function or struct with multiple optional parameters, using keywords allows you to pass only the parameters you want to specify, regardless of their position in the function signature. For example, here's a function with two parameters, each with a default value: ```mojo fn speak[a: Int = 3, msg: StringLiteral = "woof"](): print(msg, a)fn use_defaults() raises: speak() # prints 'woof 3' speak[5]() # prints 'woof 5' speak[7, "meow"]() # prints 'meow 7' speak[msg="baaa"]() # prints 'baaa 3' ``` Recall that when a parametric function is called, Mojo can infer the parameter values. That is, it can use the parameter values attached to an argument value (see the sqrt[]() example above). If the parametric function also has a default value defined, then the inferred parameter type takes precedence. sqrt[]() For example, in the following code, we update the parametric speak[]() function to take an argument with a parametric type. Although the function has a default parameter value for a, Mojo instead uses the inferred a parameter value from the bar argument (as written, the default a value can never be used, but this is just for demonstration purposes): speak[]() a a bar a ```mojo @valuestruct Bar[v: Int]: passfn speak[a: Int = 3, msg: StringLiteral = "woof"](bar: Bar[a]): print(msg, a)fn use_inferred(): speak(Bar[9]()) # prints 'woof 9' ``` As mentioned above, you can also use optional parameters and keyword parameters in a struct: ```mojo struct KwParamStruct[greeting: String = "Hello", name: String = "🔥mojo🔥"]: fn __init__(inout self): print(greeting, name)fn use_kw_params(): var a = KwParamStruct[]() # prints 'Hello 🔥mojo🔥' var b = KwParamStruct[name="World"]() # prints 'Hello World' var c = KwParamStruct[greeting="Hola"]() # prints 'Hola 🔥mojo🔥' ``` Mojo supports positional-only and keyword-only parameters, following the same rules as positional-only and keyword-only arguments. ## Infer-only parameters​ Sometimes you need to declare functions where parameters depend on other parameters. Because the signature is processed left to right, a parameter can only depend on a parameter earlier in the parameter list. For example: ```mojo fn dependent_type[dtype: DType, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[DType.float64, Float64(2.2)]() ``` You can't reverse the position of the dtype and value parameters, because value depends on dtype. However, because dtype is a required parameter, you can't leave it out of the parameter list and let Mojo infer it from value: dtype value value dtype dtype value ```mojo dependent_type[Float64(2.2)]() # Error! ``` Infer-only parameters are a special class of parameters that are always inferred from context. Infer-only parameters are placed at the beginning of the parameter list, set off from other parameters by the // sigil`: // ```mojo fn example[type: CollectionElement, //, list: List[type]]() ``` Transforming dtype into an infer-only parameter solves this problem: dtype ```mojo fn dependent_type[dtype: DType, //, value: Scalar[dtype]](): print("Value: ", value) print("Value is floating-point: ", dtype.is_floating_point())dependent_type[Float64(2.2)]() ``` Because infer-only parameters are declared at the beginning of the parameter list, other parameters can depend on them, and the compiler will always attempt to infer the infer-only values from bound parameters or arguments. If the compiler can't infer the value of an infer-only parameter, compilation fails. ## Variadic parameters​ Mojo also supports variadic parameters, similar to Variadic arguments: ```mojo struct MyTensor[*dimensions: Int]: pass ``` Variadic parameters currently have some limitations that variadic arguments don't have: - Variadic parameters must be homogeneous—that is, all the values must be the same type. - The parameter type must be register-passable. - The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: Variadic parameters must be homogeneous—that is, all the values must be the same type. The parameter type must be register-passable. The parameter values aren't automatically projected into a VariadicList, so you need to construct the list explicitly: VariadicList ```mojo fn sum_params[*values: Int]() -> Int: alias list = VariadicList(values) var sum = 0 for v in list: sum += v return sum ``` Variadic keyword parameters (for example, **kwparams) are not supported yet. **kwparams ## Parameter expressions are just Mojo code​ A parameter expression is any code expression (such as a+b) that occurs where a parameter is expected. Parameter expressions support operators and function calls, just like runtime code, and all parameter types use the same type system as the runtime program (such as Int and DType). a+b Int DType Because parameter expressions use the same grammar and types as runtime Mojo code, you can use many "dependent type" features. For example, you might want to define a helper function to concatenate two SIMD vectors: ```mojo fn concat[ty: DType, len1: Int, len2: Int]( lhs: SIMD[ty, len1], rhs: SIMD[ty, len2]) -> SIMD[ty, len1+len2]: var result = SIMD[ty, len1 + len2]() for i in range(len1): result[i] = SIMD[ty, 1](lhs[i]) for j in range(len2): result[len1 + j] = SIMD[ty, 1](rhs[j]) return resultvar a = SIMD[DType.float32, 2](1, 2)var x = concat(a, a)print('result type:', x.element_type, 'length:', len(x)) ``` Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple + operation. + ### Powerful compile-time programming​ While simple expressions are useful, sometimes you want to write imperative compile-time logic with control flow. You can even do compile-time recursion. For instance, here is an example "tree reduction" algorithm that sums all elements of a vector recursively into a scalar: ```mojo fn slice[ty: DType, new_size: Int, size: Int]( x: SIMD[ty, size], offset: Int) -> SIMD[ty, new_size]: var result = SIMD[ty, new_size]() for i in range(new_size): result[i] = SIMD[ty, 1](x[i + offset]) return resultfn reduce_add[ty: DType, size: Int](x: SIMD[ty, size]) -> Int: @parameter if size == 1: return int(x[0]) elif size == 2: return int(x[0]) + int(x[1]) # Extract the top/bottom halves, add them, sum the elements. alias half_size = size // 2 var lhs = slice[ty, half_size, size](x, 0) var rhs = slice[ty, half_size, size](x, half_size) return reduce_add[ty, half_size](lhs + rhs)var x = SIMD[DType.index, 4](1, 2, 3, 4)print(x)print("Elements sum:", reduce_add(x)) ``` This makes use of the @parameter decorator to create a parametric if condition, which is an if statement that runs at compile-time. It requires that its condition be a valid parameter expression, and ensures that only the live branch of the if statement is compiled into the program. (This is similar to use of the @parameter decorator with a for loop shown earlier.) @parameter if if @parameter for ## Mojo types are just parameter expressions​ While we've shown how you can use parameter expressions within types, type annotations can themselves be arbitrary expressions (just like in Python). Types in Mojo have a special metatype type, allowing type-parametric algorithms and functions to be defined. For example, we can create a simplified Array that supports arbitrary types of elements (via the AnyTrivialRegType parameter): Array AnyTrivialRegType ```mojo struct Array[T: AnyTrivialRegType]: var data: Pointer[T] var size: Int fn __init__(inout self, size: Int, value: T): self.size = size self.data = Pointer[T].alloc(self.size) for i in range(self.size): self.data[i] = value fn __getitem__(self, i: Int) -> T: return self.data[i] fn __del__(owned self): self.data.free()var v = Array[Float32](4, 3.14)print(v[0], v[1], v[2], v[3]) ``` Notice that the T parameter is being used as the formal type for the value arguments and the return type of the __getitem__() function. Parameters allow the Array type to provide different APIs based on the different use-cases. T value __getitem__() Array There are many other cases that benefit from more advanced use of parameters. For example, you can execute a closure N times in parallel, feeding in a value from the context, like this: ```mojo fn parallelize[func: fn (Int) -> None](num_work_items: Int): # Not actually parallel: see the 'algorithm' module for real implementation. for i in range(num_work_items): func(i) ``` Another example where this is important is with variadic generics, where an algorithm or data structure may need to be defined over a list of heterogeneous types such as for a tuple. Right now, this is not fully supported in Mojo and requires writing some MLIR by hand. In the future, this will be possible in pure Mojo. ## alias: named parameter expressions​ alias It is very common to want to name compile-time values. Whereas var defines a runtime value, we need a way to define a compile-time temporary value. For this, Mojo uses an alias declaration. var alias For example, the DType struct implements a simple enum using aliases for the enumerators like this (the actual DType implementation details vary a bit): DType DType ```mojo struct DType: var value : UI8 alias invalid = DType(0) alias bool = DType(1) alias int8 = DType(2) alias uint8 = DType(3) alias int16 = DType(4) alias int16 = DType(5) ... alias float32 = DType(15) ``` This allows clients to use DType.float32 as a parameter expression (which also works as a runtime value) naturally. Note that this is invoking the runtime constructor for DType at compile-time. DType.float32 DType Types are another common use for aliases. Because types are compile-time expressions, it is handy to be able to do things like this: ```mojo alias Float16 = SIMD[DType.float16, 1]alias UInt8 = SIMD[DType.uint8, 1]var x: Float16 = 0 # Float16 works like a "typedef" ``` Like var variables, aliases obey scope, and you can use local aliases within functions as you'd expect. var ## Fully-bound, partially-bound, and unbound types​ A parametric type with its parameters specified is said to be fully-bound. That is, all of its parameters are bound to values. As mentioned before, you can only instantiate a fully-bound type (sometimes called a concrete type). However, parametric types can be unbound or partially bound in some contexts. For example, you can alias a partially-bound type to create a new type that requires fewer parameters: ```mojo alias StringKeyDict = Dict[String, _]var b = StringKeyDict[UInt8]()b["answer"] = 42 ``` Here, StringKeyDict is a type alias for a Dict that takes String keys. The underscore _ in the parameter list indicates that the second parameter, V (the value type), is unbound. You specify the V parameter later, when you use StringKeyDict. StringKeyDict Dict String _ V V StringKeyDict For example, given the following type: ```mojo struct MyType[s: String, i: Int, i2: Int, b: Bool = True]: pass ``` It can appear in code in the following forms: - Fully bound, with all of its parameters specified: MyType["Hello", 3, 4, True] - Partially bound, with some but not all of its parameters specified: MyType["Hola", _, _, True] - Unbound, with no parameters specified: MyType[_, _, _, _] Fully bound, with all of its parameters specified: ```mojo MyType["Hello", 3, 4, True] ``` Partially bound, with some but not all of its parameters specified: ```mojo MyType["Hola", _, _, True] ``` Unbound, with no parameters specified: ```mojo MyType[_, _, _, _] ``` You can also use the star-underscore expression *_ to unbind an arbitrary number of positional parameters at the end of a parameter list. *_ ```mojo # These two types are equivalentMyType["Hello", *_]MyType["Hello", _, _, _] ``` When a parameter is explicitly unbound with the _ or *_ expression, you must specify a value for that parameter to use the type. Any default value from the original type declaration is ignored. _ *_ Partially-bound and unbound parametric types can be used in some contexts where the missing (unbound) parameters will be supplied later—such as in aliases and automatically parameterized functions. ### Omitted parameters​ Mojo also supports an alternate format for unbound parameter where the parameter is simply omitted from the expression: ```mojo # Partially boundMyType["Hi there"]# UnboundMyType ``` This format differs from the explicit unbinding syntax described above in that the default values for omitted parameters are bound immediately. For example, the following expressions are equivalent: ```mojo MyType["Hi there"]# equivalent toMyType["Hi there", _, _, True] # Uses the default value for `b` ``` This format is currently supported for backwards compatibility. We intend to deprecate this format in the future in favor of the explicit unbinding syntax. ## Automatic parameterization of functions​ Mojo supports "automatic" parameterization of functions. If a function argument type is a partially-bound or unbound type, the unbound parameters are automatically added as input parameters on the function. This is easier to understand with an example: ```mojo fn print_params(vec: SIMD[*_]): print(vec.type) print(vec.size)var v = SIMD[DType.float64, 4](1.0, 2.0, 3.0, 4.0)print_params(v) ``` In the above example, the print_params function is automatically parameterized. The vec argument takes an argument of type SIMD[*_]. This is an unbound parameterized type—that is, it doesn't specify any parameter values for the type. Mojo treats the unbound parameters on vec as implicit parameters on the function. This is roughly equivalent to the following code, which includes explicit input parameters: print_params vec SIMD[*_] vec ```mojo fn print_params[t: DType, s: Int](vec: SIMD[t, s]): print(vec.type) print(vec.size) ``` When you call print_params() you must pass it a concrete instance of the SIMD type—that is, one with all of its parameters specified, like SIMD[DType.float64, 4]. The Mojo compiler infers the parameter values from the input argument. print_params() SIMD SIMD[DType.float64, 4] With a manually parameterized function, you can access the input parameters by name (for example, t and s in the previous example). For an automatically parameterized function, you can access the parameters as attributes on the argument (for example, vec.type). t s vec.type This ability to access a type's input parameters is not specific to automatically parameterized functions, you can use it anywhere. You can access the input parameters of a parameterized type as attributes on the type itself: ```mojo fn on_type(): print(SIMD[DType.float32, 2].size) # prints 2 ``` Or as attributes on an instance of the type: ```mojo fn on_instance(): var x = SIMD[DType.int32, 2](4, 8) print(x.type) # prints int32 ``` You can even use this syntax in the function's signature to define a function's arguments and return type based on an argument's parameters. For example, if you want your function to take two SIMD vectors with the same type and size, you can write code like this: ```mojo fn interleave(v1: SIMD, v2: __type_of(v1)) -> SIMD[v1.type, v1.size*2]: var result = SIMD[v1.type, v1.size*2]() for i in range(v1.size): result[i*2] = SIMD[v1.type, 1](v1[i]) result[i*2+1] = SIMD[v1.type, 1](v2[i]) return resultvar a = SIMD[DType.int16, 4](1, 2, 3, 4)var b = SIMD[DType.int16, 4](0, 0, 0, 0)var c = interleave(a, b)print(c) ``` As shown in the example, you can use the magic __type_of(x) call if you just want to match the type of an argument. In this case, it's more convenient and compact that writing the equivalent SIMD[v1.type, v1.size]. __type_of(x) SIMD[v1.type, v1.size] ### Automatic parameterization with partially-bound types​ Mojo also supports automatic parameterization: with partially-bound parameterized types (that is, types with some but not all of the parameters specified). For example, suppose we have a Fudge struct with three parameters: Fudge ```mojo @valuestruct Fudge[sugar: Int, cream: Int, chocolate: Int = 7](Stringable): fn __str__(self) -> String: var values = StaticIntTuple[3](sugar, cream, chocolate) return str("Fudge") + str(values) ``` We can write a function that takes a Fudge argument with just one bound parameter (it's partially bound): Fudge ```mojo fn eat(f: Fudge[5, *_]): print("Ate " + str(f)) ``` The eat() function takes a Fudge struct with the first parameter (sugar) bound to the value 5. The second and third parameters, cream and chocolate are unbound. eat() Fudge sugar cream chocolate The unbound cream and chocolate parameters become implicit input parameters on the eat function. In practice, this is roughly equivalent to writing: cream chocolate eat ```mojo fn eat[cr: Int, ch: Int](f: Fudge[5, cr, ch]): print("Ate " + str(f)) ``` In both cases, we can call the function by passing in an instance with the cream and chocolate parameters bound: cream chocolate ```mojo eat(Fudge[5, 5, 7]())eat(Fudge[5, 8, 9]()) ``` If you try to pass in an argument with a sugar value other than 5, compilation fails, because it doesn't match the argument type: sugar ```mojo eat(Fudge[12, 5, 7]()) # ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[12, 5, 7]' to 'Fudge[5, 5, 7]' ``` You can also explicitly unbind individual parameters. This gives you more freedom in specifying unbound parameters. For example, you might want to let the user specify values for sugar and chocolate, and leave cream constant. To do this, replace each unbound parameter value with a single underscore (_): sugar chocolate cream _ ```mojo fn devour(f: Fudge[_, 6, _]): print(str("Devoured ") + str(f)) ``` Again, the unbound parameters (sugar and chocolate) are added as implicit input parameters on the function. This version is roughly equivalent to the following code, where these two values are explicitly bound to the input parameters, su and ch: sugar chocolate su ch ```mojo fn devour[su: Int, ch: Int](f: Fudge[su, 6, ch]): print(str("Devoured ") + str(f)) ``` You can also specify parameters by keyword, or mix positional and keyword parameters, so the following function is roughly equivalent to the previous one: the first parameter, sugar is explicitly unbound with the underscore character. The chocolate parameter is unbound using the keyword syntax, chocolate=_. And cream is explicitly bound to the value 6: sugar chocolate chocolate=_ cream ```mojo fn devour(f: Fudge[_, chocolate=_, cream=6]): print(str("Devoured ") + str(f)) ``` All three versions of the devour() function work with the following calls: devour() ```mojo devour(Fudge[3, 6, 9]())devour(Fudge[4, 6, 8]()) ``` ### Legacy syntax (omitted parameters)​ You can also specify an unbound or partially-bound type by omitting parameters: for example: ```mojo fn nibble(f: Fudge[5]): print("Ate " + str(f)) ``` Here, Fudge[5] works like Fudge[5, *_] except in the handling of parameters with default values. Instead of discarding the default value of chocolate, Fudge[5] binds the default value immediately, making it equivalent to: Fudge[5, _, 7]. Fudge[5] Fudge[5, *_] chocolate Fudge[5] Fudge[5, _, 7] This means that the following code won't compile with the previous definition for nibble() function, since it doesn't use the default value for chocolate: nibble() chocolate ```mojo nibble(Fudge[5, 5, 9]())# ERROR: invalid call to 'eat': argument #0 cannot be converted from 'Fudge[5, 5, 9]' to 'Fudge[5, 5, 7]' ``` Support for omitting unbound parameters will eventually be deprecated in favor of explicitly unbound parameters using _ and *_. _ *_ - Parameterized functions - Parameters and generics - Parameterized structsCase study: the SIMD type - Case study: the SIMD type - Overloading on parameters - Using parameterized types and functionsParameter inference - Parameter inference - Optional parameters and keyword parameters - Infer-only parameters - Variadic parameters - Parameter expressions are just Mojo codePowerful compile-time programming - Powerful compile-time programming - Mojo types are just parameter expressions - alias: named parameter expressions - Fully-bound, partially-bound, and unbound typesOmitted parameters - Omitted parameters - Automatic parameterization of functionsAutomatic parameterization with partially-bound typesLegacy syntax (omitted parameters) - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - Case study: the SIMD type - Parameter inference - Powerful compile-time programming alias - Omitted parameters - Automatic parameterization with partially-bound types - Legacy syntax (omitted parameters) - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#unsafepointer-and-reference - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#what-is-a-pointer - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#storing-multiple-values - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#lifecycle-of-a-pointer - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#allocating-memory - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#initializing-the-pointee - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#initializing-from-an-address - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#converting-data-bitcasting-and-byte-order - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#dereferencing-pointers - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#destroying-or-removing-values - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#freeing-memory - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#dtypepointer-handling-numeric-data - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/pointers#safety - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Pointers - /Unsafe pointers # Unsafe pointers The UnsafePointer type creates an indirect reference to a location in memory. You can use an UnsafePointer to dynamically allocate and free memory, or to point to memory allocated by some other piece of code. You can use these pointers to write code that interacts with low-level interfaces, to interface with other programming languages, or to build certain kinds of data structures. But as the name suggests, they're inherently unsafe. For example, when using unsafe pointers, you're responsible for ensuring that memory gets allocated and freed correctly. UnsafePointer UnsafePointer In addition to unsafe pointers, Mojo supports a safe Reference type. See UnsafePointer and Reference for a brief comparison of the types. Reference UnsafePointer Reference ## What is a pointer?​ An UnsafePointer is a type that holds an address to memory. You can store and retrieve values in that memory. The UnsafePointer type is generic—it can point to any type of value, and the value type is specified as a parameter. The value pointed to by a pointer is sometimes called a pointee. UnsafePointer UnsafePointer ```mojo from memory.unsafe_pointer import UnsafePointer, initialize_pointee_copy, initialize_pointee_move# Allocate memory to hold a valuevar ptr = UnsafePointer[Int].alloc(1)# Initialize the allocated memoryinitialize_pointee_copy(ptr, 100) ``` Accessing the memory—to retrieve or update a value—is called dereferencing the pointer. You can dereference a pointer by following the variable name with an empty pair of square brackets: ```mojo # Update an initialized valueptr[] += 10# Access an initialized valueprint(ptr[]) ``` You can also allocate memory to hold multiple values to build array-like structures. For details, see Storing multiple values. ## Lifecycle of a pointer​ At any given time, a pointer can be in one of several states: - Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. var ptr: UnsafePointer[Int] - Null. A null pointer has an address of 0, indicating an invalid pointer. ptr = UnsafePointer[Int]() - Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. ptr = UnsafePointer[Int].alloc(1) Trying to dereference a pointer to uninitialized memory results in undefined behavior. - Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) Once the value is initialized, you can read or mutate it using the dereference syntax: oldValue = ptr[]ptr[] = newValue - Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ptr.free() Uninitialized. Just like any variable, a variable of type UnsafePointer can be declared but uninitialized. UnsafePointer ```mojo var ptr: UnsafePointer[Int] ``` Null. A null pointer has an address of 0, indicating an invalid pointer. ```mojo ptr = UnsafePointer[Int]() ``` Pointing to allocated, uninitialized memory. The alloc() static method returns a pointer to a newly-allocated block of memory with space for the specified number of elements of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(1) ``` Trying to dereference a pointer to uninitialized memory results in undefined behavior. Pointing to initialized memory. You can initialize an allocated, uninitialized pointer by moving or copying an existing value into the memory. Or you can use the address_of() static method to get a pointer to an existing value. address_of() ```mojo initialize_pointee_copy(ptr, value)# orinitalize_pointee_move(ptr, value^)# or ptr = UnsafePointer[Int].address_of(value) ``` Once the value is initialized, you can read or mutate it using the dereference syntax: ```mojo oldValue = ptr[]ptr[] = newValue ``` Dangling. When you free the pointer's allocated memory, you're left with a dangling pointer. The address still points to its previous location, but the memory is no longer allocated to this pointer. Trying to dereference the pointer, or calling any method that would access the memory location results in undefined behavior. ```mojo ptr.free() ``` The following diagram shows the lifecycle of an UnsafePointer: UnsafePointer UnsafePointer ### Allocating memory​ Use the static alloc() method to allocate memory. The method returns a new pointer pointing to the requested memory. You can allocate space for one or more values of the pointee's type. alloc() ```mojo ptr = UnsafePointer[Int].alloc(10) # Allocate space for 10 Int values ``` The allocated space is uninitialized—like a variable that's been declared but not initialized. ### Initializing the pointee​ The unsafe_pointer module includes a number of free functions for working with the UnsafePointer type. To initialize allocated memory, you can use the initialize_pointee_copy() or initialize_pointee_move() functions: unsafe_pointer UnsafePointer initialize_pointee_copy() initialize_pointee_move() ```mojo initialize_pointee_copy(ptr, 5) ``` To move a value into the pointer's memory location, use initialize_pointee_move(): initialize_pointee_move() ```mojo initialize_pointee_move(str_ptr, my_string^) ``` Note that to move the value, you usually need to add the transfer operator (^), unless the value is a trivial type (like Int) or a newly-constructed, "owned" value: ^ Int ```mojo initialize_pointee_move(str_ptr, str("Owned string")) ``` Alternately, you can get a pointer to an existing value using the static address_of() method. This is useful for getting a pointer to a value on the stack, for example. address_of() ```mojo var counter: Int = 5ptr = UnsafePointer[Int].address_of(counter) ``` Note that when calling address_of(), you don't need to allocate memory ahead of time, since you're pointing to an existing value. address_of() #### Initializing from an address​ When exchanging data with other programming languages, you may need to construct an UnsafePointer from an address. For example, if you're working with a pointer allocated by a C or C++ library, or a Python object that implements the array interface protocol, you can construct an UnsafePointer to access the data from the Mojo side. UnsafePointer UnsafePointer You can construct an UnsafePointer from an integer address using the address keyword argument. For example, the following code creates a NumPy array and then accesses the data using a Mojo pointer: UnsafePointer address ```mojo from python import Pythonfrom memory.unsafe_pointer import UnsafePointerdef share_array(): np = Python.import_module("numpy") arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) addr = int(arr.__array_interface__["data"][0]) ptr = UnsafePointer[Int64](address=addr) for i in range(9): print(ptr[i], end=", ")share_array() ``` When dealing with memory allocated elsewhere, you need to be aware of who's responsible for freeing the memory. Freeing memory allocated elsewhere can result in undefined behavior. You also need to be aware of the format of the data stored in memory, including data types and byte order. For more information, see Converting data: bitcasting and byte order. ### Dereferencing pointers​ Use the [] dereference operator to access the value stored at a pointer (the "pointee"). [] ```mojo # Read from pointeeprint(ptr[])# mutate pointeeptr[] = 0 ``` If you've allocated space for multiple values, you can use subscript syntax to access the values, as if they were an array, like ptr[3]. The empty subscript [] has the same meaning as [0]. ptr[3] [] [0] The dereference operator assumes that the memory being dereferenced is initialized. Dereferencing uninitialized memory results in undefined behavior. You cannot safely use the dereference operator on uninitialized memory, even to initialize a pointee. This is because assigning to a dereferenced pointer calls lifecycle methods on the existing pointee (such as the destructor, move constructor or copy constructor). ```mojo str_ptr = UnsafePointer[String].alloc(1)# str_ptr[] = "Testing" # Undefined behavior!initialize_pointee_move(str_ptr, "Testing")str_ptr[] += " pointers" # Works now ``` ### Destroying or removing values​ The move_from_pointee(ptr) function moves the pointee from the memory location pointed to by ptr. This is a consuming move—it invokes __moveinit__() on the destination value. It leaves the memory location uninitialized. move_from_pointee(ptr) ptr __moveinit__() The destroy_pointee(ptr) function calls the destructor on the pointee, and leaves the memory location pointed to by ptr uninitialized. destroy_pointee(ptr) ptr Both move_from_pointee() and destroy_pointee() require that the pointer is non-null, and the memory location contains a valid, initialized value of the pointee's type; otherwise the function results in undefined behavior. move_from_pointee() destroy_pointee() The move_pointee(src, dst) function moves the pointee from one pointer location to another. Both pointers must be non-null. The source location must contain a valid, initialized value of the pointee's type, and is left uninitialized after the call. The destination location is assumed to be uninitialized—if it contains a valid value, that value's destructor is not run. The value from the source location is moved to the destination location as a consuming move. This function also has undefined behavior if any of its prerequisites is not met. move_pointee(src, dst) ### Freeing memory​ Calling free() on a pointer frees the memory allocated by the pointer. It doesn't call the destructors on any values stored in the memory—you need to do that explicitly (for example, using destroy_pointee() or one of the other functions described in Destroying or removing values). free() destroy_pointee() Disposing of a pointer without freeing the associated memory can result in a memory leak—where your program keeps taking more and more memory, because not all allocated memory is being freed. On the other hand, if you have multiple copies of a pointer accessing the same memory, you need to make sure you only call free() on one of them. Freeing the same memory twice is also an error. free() After freeing a pointer's memory, you're left with a dangling pointer—its address still points to the freed memory. Any attempt to access the memory, like dereferencing the pointer results in undefined behavior. ## Storing multiple values​ As mentioned in Allocating memory, you can use an UnsafePointer to allocate memory for multiple values. The memory is allocated as a single, contiguous block. Pointers support arithmetic: adding an integer to a pointer returns a new pointer offset by the specified number of values from the original pointer: UnsafePointer ```mojo third_ptr = first_ptr + 2 ``` Pointers also support subtraction, as well as in-place addition and subtraction: ```mojo # Advance the pointer one element:ptr += 1 ``` For example, the following example allocates memory to store 6 Float64 values, and initializes them all to zero. Float64 ```mojo float_ptr = UnsafePointer[Float64].alloc(6)for offset in range(6): initialize_pointee_copy(float_ptr+offset, 0.0) ``` Once the values are initialized, you can access them using subscript syntax: ```mojo float_ptr[2] = 3.0for offset in range(6): print(float_ptr[offset], end=", ") ``` ## Converting data: bitcasting and byte order​ Bitcasting a pointer returns a new pointer that has the same memory location, but a new data type. This can be useful if you need to access different types of data from a single area of memory. This can happen when you're reading binary files, like image files, or receiving data over the network. The following sample processes a format that consists of chunks of data, where each chunk contains a variable number of 32-bit integers. Each chunk begins with an 8-bit integer that identifies the number of values in the chunk. ```mojo def read_chunks(owned ptr: UnsafePointer[UInt8]) -> List[List[UInt32]]: chunks = List[List[UInt32]]() # A chunk size of 0 indicates the end of the data chunk_size = int(ptr[]) while (chunk_size > 0): # Skip the 1 byte chunk_size and get a pointer to the first # UInt32 in the chunk ui32_ptr = (ptr + 1).bitcast[UInt32]() chunk = List[UInt32](capacity=chunk_size) for i in range(chunk_size): chunk.append(ui32_ptr[i]) chunks.append(chunk) # Move our pointer to the next byte after the current chunk ptr += (1 + 4 * chunk_size) # Read the size of the next chunk chunk_size = int(ptr[]) return chunks ``` When dealing with data read in from a file or from the network, you may also need to deal with byte order. Most systems use little-endian byte order (also called least-signficicant byte, or LSB) where the least-significant byte in a multibyte value comes first. For example, the number 1001 can be represented in hexadecimal as 0x03E9, where E9 is the least-significant byte. Represented as a 16-bit little-endian integer, the two bytes are ordered E9 03. As a 32-bit integer, it would be represented as E9 03 00 00. Big-endian or most-significant byte (MSB) ordering is the opposite: in the 32-bit case, 00 00 03 E9. MSB ordering is frequently used in file formats and when transmitting data over the network. You can use the byte_swap() function to swap the byte order of a SIMD value from big-endian to little-endian or the reverse. For example, if the method above was reading big-endian data, you'd just need to change a single line: byte_swap() ```mojo chunk.append(byte_swap(ui32_ptr[i])) ``` ## DTypePointer: handling numeric data​ DTypePointer A DTypePointer is an unsafe pointer that supports some additional methods for loading and storing numeric data. Like the SIMD type, it's parameterized on DType as described in SIMD and DType. DTypePointer SIMD DType DTypePointer has a similar API to UnsafePointer: DTypePointer UnsafePointer - You can alloc() and free() memory, or use address_of() to point to an existing value. - The pointer supports pointer arithmetic to access adjacent memory locations. - You can dereference a DTypePointer using subscript notation. - You can construct a DTypePointer from an Int address. alloc() free() address_of() DTypePointer DTypePointer Int You can also construct a DTypePointer from an UnsafePointer of a scalar type like Int64 or Float32: DTypePointer UnsafePointer Int64 Float32 ```mojo from memory import DTypePointer, UnsafePointeruptr = UnsafePointer[Float64].alloc(10)dptr = DTypePointer(uptr)# Or:dptr = DTypePointer[DType.float64].alloc(10) ``` Unlike UnsafePointer, DTypePointer doesn't have special methods to initialize values, destroy them, or move them out. Because all of the values that DTypePointer works with are trivial types, DTypePointer doesn't need to destroy values before overwriting them or freeing memory. Instead, you can use subscript notation (like UnsafePointer) or use the load() and store() methods to access values. UnsafePointer DTypePointer DTypePointer DTypePointer UnsafePointer load() store() What DTypePointer adds is various methods of loading and storing SIMD values to memory. In particular: strided load/store and gather/scatter. DTypePointer Strided load loads values from memory into a SIMD vector using an offset (the "stride") between successive memory addresses. This can be useful for extracting rows or columns from tabular data, or for extracting individual values from structured data. For example, consider the data for an RGB image, where each pixel is made up of three 8-bit values, for red, green, and blue. If you want to access just the red values, you can use a strided load or store. The following function uses the simd_strided_load() and simd_strided_store() methods to invert the red pixel values in an image, 8 values at a time. (Note that this function only handles images where the number of pixels is evenly divisible by eight.) simd_strided_load() simd_strided_store() ```mojo def invert_red_channel(ptr: DTypePointer[DType.uint8], pixel_count: Int): # number of values loaded or stored at a time alias simd_width = 8 # bytes per pixel, which is also the stride size bpp = 3 for i in range(0, pixel_count * bpp, simd_width * bpp): red_values = ptr.offset(i).simd_strided_load[width=simd_width](bpp) # Invert values and store them in their original locations ptr.offset(i).simd_strided_store[width=simd_width](~red_values, bpp) ``` DTypePointer The DTypePointer type exists for historical reasons, but it no longer really needs to be a separate type. UnsafePointer can handle most things that DTypePointer does except for a few features related to reading and writing SIMD values. At some point in the future, these features will probably be integrated into the SIMD type, so you can use them with UnsafePointer. DTypePointer UnsafePointer DTypePointer SIMD SIMD UnsafePointer ## Safety​ Unsafe pointers are unsafe for several reasons: - Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. - UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. - Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) Memory management is up to the user. You need to manually allocate and free memory, and be aware of when other APIs are allocating or freeing memory for you. UnsafePointer and DTypePointer values are nullable—that is, the pointer is not guaranteed to point to anything. And even when a pointer points to allocated memory, that memory may not be initialized. UnsafePointer DTypePointer Mojo doesn't track lifetimes for the data pointed to by an UnsafePointer. When you use an UnsafePointer, managing memory and knowing when to destroy objects is your responsibility. (Since DTypePointer only works with trivial types, this is not typically an issue for DTypePointer.) UnsafePointer UnsafePointer DTypePointer DTypePointer ## UnsafePointer and Reference​ UnsafePointer Reference The Reference type is essentially a safe pointer type. Like a pointer, you can derferences a Reference using the dereference operator, []. However, the Reference type has several differences from UnsafePointer which make it safer: Reference Reference [] Reference UnsafePointer - A Reference is non-nullable. A reference always points to something. - You can't allocate or free memory using a Reference—only point to an existing value. - A Reference only refers to a single value. You can't do pointer arithmetic with a Reference. - A Reference has an associated lifetime, which connects it back to an original, owned value. The lifetime ensures that the value won't be destroyed while the reference exists. Reference Reference Reference Reference Reference The Reference type shouldn't be confused with the immutable and mutable references used with the borrowed and inout argument conventions. Those references do not require explicit dereferencing, unlike a Reference or UnsafePointer. Reference borrowed inout Reference UnsafePointer - What is a pointer? - Lifecycle of a pointerAllocating memoryInitializing the pointeeDereferencing pointersDestroying or removing valuesFreeing memory - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory - Storing multiple values - Converting data: bitcasting and byte order - DTypePointer: handling numeric data - Safety - UnsafePointer and Reference - Allocating memory - Initializing the pointee - Dereferencing pointers - Destroying or removing values - Freeing memory DTypePointer UnsafePointer Reference - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/#import-a-python-module - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python integration # Python integration Our long-term goal is to make Mojo a superset of Python (that is, to make Mojo compatible with existing Python programs). Python programmers should be able to use Mojo immediately, and be able to access the huge ecosystem of Python packages that are available today. However, Mojo is still in early development and many Python features are not yet implemented. You can't currently write everything in Mojo that you can write in Python. And Mojo doesn't have its own ecosystem of packages yet. To help bridge this gap, Mojo lets you import Python modules, call Python functions and interact with Python objects from Mojo code. It runs Python code using a standard Python interpreter (CPython), so your existing Python code doesn't need to change. ## Import a Python module​ To import a Python module in Mojo, just call Python.import_module() with the module name: Python.import_module() ```mojo from python import Pythonfn use_array() raises: # This is equivalent to Python's `import numpy as np` var np = Python.import_module("numpy") # Now use numpy as if writing in Python var array = np.array([1, 2, 3]) print(array) ``` ```mojo use_array() ``` Yes, this imports Python NumPy, and you can import any other Python module that you have installed. A few things to note: - Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. - Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. - import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. import_module() import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) import_module() fn try/except raises Mojo loads the Python interpreter and Python modules at runtime, so wherever you run a Mojo program, it must be able to access a compatible Python interpreter, and to locate any imported Python modules. For more information, see Python environment. ### Import a local Python module​ If you have some local Python code you want to use in Mojo, just add the directory to the Python path and then import the module. For example, suppose you have a Python file named mypython.py: mypython.py ```mojo import numpy as npdef gen_random_values(size, base): # generate a size x size array of random numbers between base and base+1 random_array = np.random.rand(size, size) return random_array + base ``` Here's how you can import it and use it in a Mojo file: ```mojo from python import Pythonfn main() raises: Python.add_to_path("path/to/module") var mypython = Python.import_module("mypython") var values = mypython.gen_random_values(2, 3) print(values) ``` Both absolute and relative paths work with add_to_path(). For example, you can import from the local directory like this: add_to_path() ```mojo Python.add_to_path(".") ``` ## Call Mojo from Python​ As shown above, you can call out to Python modules from Mojo. However, there's currently no way to do the reverse—import Mojo modules from Python or call Mojo functions from Python. This may present a challenge for using certain modules. For example, many UI frameworks have a main event loop that makes callbacks to user-defined code in response to UI events. This is sometimes called an "inversion of control" pattern. Instead of your application code calling in to a library, the framework code calls out to your application code. This pattern doesn't work because you can't pass Mojo callbacks to a Python module. For example, consider the popular Tkinter package. The typical usage for Tkinter is something like this: - You create a main, or "root" window for the application. - You add one or more UI widgets to the window. The widgets can have associated callback functions (for example, when a button is pushed). - You call the root window's mainloop() method, which listens for events, updates the UI, and invokes callback functions. The main loop keeps running until the application exits. mainloop() Since Python can't call back into Mojo, one alternative is to have the Mojo application drive the event loop and poll for updates. The following example uses Tkinter, but the basic approach can be applied to other packages. First we create a Python module that defines a Tkinter interface, with a window and single button: ```mojo %%pythonimport tkinter as tkclass App: def __init__(self): self._root = tk.Tk() self.clicked = False def click(self): self.clicked = True def create_button(self, button_text: str): button = tk.Button( master=self._root, text=button_text, command=self.click ) button.place(relx=0.5, rely=0.5, anchor=tk.CENTER) def create(self, res: str): self._root.geometry(res) self.create_button("Hello Mojo!") def update(self): self._root.update() ``` We can call this module from Mojo like this: ```mojo from python import Pythonfn button_clicked(): print("Hi from a Mojo🔥 fn!")def main(): Python.add_to_path(".") var app = Python.import_module("myapp").App() app.create("800x600") while True: app.update() if app.clicked: button_clicked() app.clicked = False ``` Instead of the Python module calling the Tkinter mainloop() method, the Mojo code calls the update() method in a loop and checks the clicked attribute after each update. mainloop() update() clicked ## Python environment​ The Mojo SDK depends on an existing Python dynamic library. At runtime, Mojo uses the first Python in the search path (PATH), to find an associated dynamic Python library of the same version. This will also add any modules from the activated virtual environment. PATH ### Resolving issues​ Finding libpython may fail if the Python interpreter on top of PATH does not have an associated dynamic library. Some Python distributions don't include the shared library, and others only have a static library which isn't supported by Mojo yet. PATH You can find a compatible Python on your system by running this Python script: ```mojo import osimport subprocessFIND_LIBPYTHON = """import osimport sysfrom pathlib import Pathfrom sysconfig import get_config_varext = "dll" if os.name == "nt" else "dylib" if sys.platform == "darwin" else "so"binary = f"libpython{get_config_var('py_version_short')}.{ext}"for folder in [Path(get_config_var(p)) for p in ["LIBPL", "LIBDIR"]]: libpython_path = folder / binary if libpython_path.is_file(): print(libpython_path.resolve()) exit(0)exit(1)"""FIND_PYTHON_VER = "import sysconfig; print(sysconfig.get_python_version())"exe_names = ["python3", "python"] + [f"python3.{i}" for i in range(8, 13)]seen = []executables = []print("Mojo will attempt to use the first python executable from the top:\n")print("vers | compat | path")for path in os.environ["PATH"].split(":"): for exe in exe_names: full_path = os.path.join(path, exe) if os.path.exists(full_path): pyver = subprocess.check_output([full_path, "-c", FIND_PYTHON_VER], text=True).strip() res = subprocess.run([full_path, "-c", FIND_LIBPYTHON], text=True, capture_output=True) libpython = res.stdout.strip() if res.returncode != 0: print(f"{pyver:<7} no {full_path}") elif libpython not in seen: print(f"{pyver:<7} yes {full_path}") seen.append(libpython) executables.append(full_path)if not executables: print("no compatible Python environments found")else: print("\ncreate and activate a virtual environment to use a different Python version:") print(f" {executables[-1]} -m venv .venv") print(" source .venv/bin/activate") ``` Which will produce output like: ```mojo Mojo will attempt to use the first python executable from the top:vers | compat | path3.11 yes /opt/homebrew/opt/[email protected]/libexec/bin/python33.12 yes /opt/homebrew/bin/python33.9 yes /usr/bin/python3create and activate a virtual environment to use a different Python version: /usr/bin/python3 -m venv .venv source .venv/bin/activate ``` If you have no compatible environment, you can install a compatible version of Python that includes shared libraries. Try following the instructions in Set up a Python environment with Conda to install a virtual environment. ### Set up a Python environment with Conda​ Using a Python virtual environment such as Conda is one way to get a version of Python that will work reliably with Mojo. It comes with the required dynamic library, and ensures there are no conflicts with system dependencies. To set up a virtual environment with Conda: - Install Conda by following the Quick command-line install instructions. - Initialize Conda for all the shells on your path: ~/miniconda3/bin/conda init --all Or just one at a time: ~/miniconda3/bin/conda init zsh - Restart your shell. - Install your desired version of Python and activate the environment: conda create -n 3.10 python=3.10conda activate 3.10 Install Conda by following the Quick command-line install instructions. Initialize Conda for all the shells on your path: ```mojo ~/miniconda3/bin/conda init --all ``` Or just one at a time: ```mojo ~/miniconda3/bin/conda init zsh ``` Restart your shell. Install your desired version of Python and activate the environment: ```mojo conda create -n 3.10 python=3.10conda activate 3.10 ``` After setting up the Conda virtual environment, you can install any Python packages you want to use with Mojo, with conda install or pip install. For example: conda install pip install ```mojo conda install numpypip install pillow ``` Now whenever you conda activate 3.10, Mojo will be able to find any modules you installed into that environment. conda activate 3.10 For more information on using Conda with Mojo, see Using Mojo with Python on the Modular Blog. - Import a Python moduleImport a local Python module - Import a local Python module - Call Mojo from Python - Python environmentResolving issuesSet up a Python environment with Conda - Resolving issues - Set up a Python environment with Conda - Import a local Python module - Resolving issues - Set up a Python environment with Conda - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/#python-environment - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python integration # Python integration Our long-term goal is to make Mojo a superset of Python (that is, to make Mojo compatible with existing Python programs). Python programmers should be able to use Mojo immediately, and be able to access the huge ecosystem of Python packages that are available today. However, Mojo is still in early development and many Python features are not yet implemented. You can't currently write everything in Mojo that you can write in Python. And Mojo doesn't have its own ecosystem of packages yet. To help bridge this gap, Mojo lets you import Python modules, call Python functions and interact with Python objects from Mojo code. It runs Python code using a standard Python interpreter (CPython), so your existing Python code doesn't need to change. ## Import a Python module​ To import a Python module in Mojo, just call Python.import_module() with the module name: Python.import_module() ```mojo from python import Pythonfn use_array() raises: # This is equivalent to Python's `import numpy as np` var np = Python.import_module("numpy") # Now use numpy as if writing in Python var array = np.array([1, 2, 3]) print(array) ``` ```mojo use_array() ``` Yes, this imports Python NumPy, and you can import any other Python module that you have installed. A few things to note: - Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. - Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. - import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. import_module() import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) import_module() fn try/except raises Mojo loads the Python interpreter and Python modules at runtime, so wherever you run a Mojo program, it must be able to access a compatible Python interpreter, and to locate any imported Python modules. For more information, see Python environment. ### Import a local Python module​ If you have some local Python code you want to use in Mojo, just add the directory to the Python path and then import the module. For example, suppose you have a Python file named mypython.py: mypython.py ```mojo import numpy as npdef gen_random_values(size, base): # generate a size x size array of random numbers between base and base+1 random_array = np.random.rand(size, size) return random_array + base ``` Here's how you can import it and use it in a Mojo file: ```mojo from python import Pythonfn main() raises: Python.add_to_path("path/to/module") var mypython = Python.import_module("mypython") var values = mypython.gen_random_values(2, 3) print(values) ``` Both absolute and relative paths work with add_to_path(). For example, you can import from the local directory like this: add_to_path() ```mojo Python.add_to_path(".") ``` ## Call Mojo from Python​ As shown above, you can call out to Python modules from Mojo. However, there's currently no way to do the reverse—import Mojo modules from Python or call Mojo functions from Python. This may present a challenge for using certain modules. For example, many UI frameworks have a main event loop that makes callbacks to user-defined code in response to UI events. This is sometimes called an "inversion of control" pattern. Instead of your application code calling in to a library, the framework code calls out to your application code. This pattern doesn't work because you can't pass Mojo callbacks to a Python module. For example, consider the popular Tkinter package. The typical usage for Tkinter is something like this: - You create a main, or "root" window for the application. - You add one or more UI widgets to the window. The widgets can have associated callback functions (for example, when a button is pushed). - You call the root window's mainloop() method, which listens for events, updates the UI, and invokes callback functions. The main loop keeps running until the application exits. mainloop() Since Python can't call back into Mojo, one alternative is to have the Mojo application drive the event loop and poll for updates. The following example uses Tkinter, but the basic approach can be applied to other packages. First we create a Python module that defines a Tkinter interface, with a window and single button: ```mojo %%pythonimport tkinter as tkclass App: def __init__(self): self._root = tk.Tk() self.clicked = False def click(self): self.clicked = True def create_button(self, button_text: str): button = tk.Button( master=self._root, text=button_text, command=self.click ) button.place(relx=0.5, rely=0.5, anchor=tk.CENTER) def create(self, res: str): self._root.geometry(res) self.create_button("Hello Mojo!") def update(self): self._root.update() ``` We can call this module from Mojo like this: ```mojo from python import Pythonfn button_clicked(): print("Hi from a Mojo🔥 fn!")def main(): Python.add_to_path(".") var app = Python.import_module("myapp").App() app.create("800x600") while True: app.update() if app.clicked: button_clicked() app.clicked = False ``` Instead of the Python module calling the Tkinter mainloop() method, the Mojo code calls the update() method in a loop and checks the clicked attribute after each update. mainloop() update() clicked ## Python environment​ The Mojo SDK depends on an existing Python dynamic library. At runtime, Mojo uses the first Python in the search path (PATH), to find an associated dynamic Python library of the same version. This will also add any modules from the activated virtual environment. PATH ### Resolving issues​ Finding libpython may fail if the Python interpreter on top of PATH does not have an associated dynamic library. Some Python distributions don't include the shared library, and others only have a static library which isn't supported by Mojo yet. PATH You can find a compatible Python on your system by running this Python script: ```mojo import osimport subprocessFIND_LIBPYTHON = """import osimport sysfrom pathlib import Pathfrom sysconfig import get_config_varext = "dll" if os.name == "nt" else "dylib" if sys.platform == "darwin" else "so"binary = f"libpython{get_config_var('py_version_short')}.{ext}"for folder in [Path(get_config_var(p)) for p in ["LIBPL", "LIBDIR"]]: libpython_path = folder / binary if libpython_path.is_file(): print(libpython_path.resolve()) exit(0)exit(1)"""FIND_PYTHON_VER = "import sysconfig; print(sysconfig.get_python_version())"exe_names = ["python3", "python"] + [f"python3.{i}" for i in range(8, 13)]seen = []executables = []print("Mojo will attempt to use the first python executable from the top:\n")print("vers | compat | path")for path in os.environ["PATH"].split(":"): for exe in exe_names: full_path = os.path.join(path, exe) if os.path.exists(full_path): pyver = subprocess.check_output([full_path, "-c", FIND_PYTHON_VER], text=True).strip() res = subprocess.run([full_path, "-c", FIND_LIBPYTHON], text=True, capture_output=True) libpython = res.stdout.strip() if res.returncode != 0: print(f"{pyver:<7} no {full_path}") elif libpython not in seen: print(f"{pyver:<7} yes {full_path}") seen.append(libpython) executables.append(full_path)if not executables: print("no compatible Python environments found")else: print("\ncreate and activate a virtual environment to use a different Python version:") print(f" {executables[-1]} -m venv .venv") print(" source .venv/bin/activate") ``` Which will produce output like: ```mojo Mojo will attempt to use the first python executable from the top:vers | compat | path3.11 yes /opt/homebrew/opt/[email protected]/libexec/bin/python33.12 yes /opt/homebrew/bin/python33.9 yes /usr/bin/python3create and activate a virtual environment to use a different Python version: /usr/bin/python3 -m venv .venv source .venv/bin/activate ``` If you have no compatible environment, you can install a compatible version of Python that includes shared libraries. Try following the instructions in Set up a Python environment with Conda to install a virtual environment. ### Set up a Python environment with Conda​ Using a Python virtual environment such as Conda is one way to get a version of Python that will work reliably with Mojo. It comes with the required dynamic library, and ensures there are no conflicts with system dependencies. To set up a virtual environment with Conda: - Install Conda by following the Quick command-line install instructions. - Initialize Conda for all the shells on your path: ~/miniconda3/bin/conda init --all Or just one at a time: ~/miniconda3/bin/conda init zsh - Restart your shell. - Install your desired version of Python and activate the environment: conda create -n 3.10 python=3.10conda activate 3.10 Install Conda by following the Quick command-line install instructions. Initialize Conda for all the shells on your path: ```mojo ~/miniconda3/bin/conda init --all ``` Or just one at a time: ```mojo ~/miniconda3/bin/conda init zsh ``` Restart your shell. Install your desired version of Python and activate the environment: ```mojo conda create -n 3.10 python=3.10conda activate 3.10 ``` After setting up the Conda virtual environment, you can install any Python packages you want to use with Mojo, with conda install or pip install. For example: conda install pip install ```mojo conda install numpypip install pillow ``` Now whenever you conda activate 3.10, Mojo will be able to find any modules you installed into that environment. conda activate 3.10 For more information on using Conda with Mojo, see Using Mojo with Python on the Modular Blog. - Import a Python moduleImport a local Python module - Import a local Python module - Call Mojo from Python - Python environmentResolving issuesSet up a Python environment with Conda - Resolving issues - Set up a Python environment with Conda - Import a local Python module - Resolving issues - Set up a Python environment with Conda - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/#import-a-local-python-module - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python integration # Python integration Our long-term goal is to make Mojo a superset of Python (that is, to make Mojo compatible with existing Python programs). Python programmers should be able to use Mojo immediately, and be able to access the huge ecosystem of Python packages that are available today. However, Mojo is still in early development and many Python features are not yet implemented. You can't currently write everything in Mojo that you can write in Python. And Mojo doesn't have its own ecosystem of packages yet. To help bridge this gap, Mojo lets you import Python modules, call Python functions and interact with Python objects from Mojo code. It runs Python code using a standard Python interpreter (CPython), so your existing Python code doesn't need to change. ## Import a Python module​ To import a Python module in Mojo, just call Python.import_module() with the module name: Python.import_module() ```mojo from python import Pythonfn use_array() raises: # This is equivalent to Python's `import numpy as np` var np = Python.import_module("numpy") # Now use numpy as if writing in Python var array = np.array([1, 2, 3]) print(array) ``` ```mojo use_array() ``` Yes, this imports Python NumPy, and you can import any other Python module that you have installed. A few things to note: - Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. - Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. - import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. import_module() import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) import_module() fn try/except raises Mojo loads the Python interpreter and Python modules at runtime, so wherever you run a Mojo program, it must be able to access a compatible Python interpreter, and to locate any imported Python modules. For more information, see Python environment. ### Import a local Python module​ If you have some local Python code you want to use in Mojo, just add the directory to the Python path and then import the module. For example, suppose you have a Python file named mypython.py: mypython.py ```mojo import numpy as npdef gen_random_values(size, base): # generate a size x size array of random numbers between base and base+1 random_array = np.random.rand(size, size) return random_array + base ``` Here's how you can import it and use it in a Mojo file: ```mojo from python import Pythonfn main() raises: Python.add_to_path("path/to/module") var mypython = Python.import_module("mypython") var values = mypython.gen_random_values(2, 3) print(values) ``` Both absolute and relative paths work with add_to_path(). For example, you can import from the local directory like this: add_to_path() ```mojo Python.add_to_path(".") ``` ## Call Mojo from Python​ As shown above, you can call out to Python modules from Mojo. However, there's currently no way to do the reverse—import Mojo modules from Python or call Mojo functions from Python. This may present a challenge for using certain modules. For example, many UI frameworks have a main event loop that makes callbacks to user-defined code in response to UI events. This is sometimes called an "inversion of control" pattern. Instead of your application code calling in to a library, the framework code calls out to your application code. This pattern doesn't work because you can't pass Mojo callbacks to a Python module. For example, consider the popular Tkinter package. The typical usage for Tkinter is something like this: - You create a main, or "root" window for the application. - You add one or more UI widgets to the window. The widgets can have associated callback functions (for example, when a button is pushed). - You call the root window's mainloop() method, which listens for events, updates the UI, and invokes callback functions. The main loop keeps running until the application exits. mainloop() Since Python can't call back into Mojo, one alternative is to have the Mojo application drive the event loop and poll for updates. The following example uses Tkinter, but the basic approach can be applied to other packages. First we create a Python module that defines a Tkinter interface, with a window and single button: ```mojo %%pythonimport tkinter as tkclass App: def __init__(self): self._root = tk.Tk() self.clicked = False def click(self): self.clicked = True def create_button(self, button_text: str): button = tk.Button( master=self._root, text=button_text, command=self.click ) button.place(relx=0.5, rely=0.5, anchor=tk.CENTER) def create(self, res: str): self._root.geometry(res) self.create_button("Hello Mojo!") def update(self): self._root.update() ``` We can call this module from Mojo like this: ```mojo from python import Pythonfn button_clicked(): print("Hi from a Mojo🔥 fn!")def main(): Python.add_to_path(".") var app = Python.import_module("myapp").App() app.create("800x600") while True: app.update() if app.clicked: button_clicked() app.clicked = False ``` Instead of the Python module calling the Tkinter mainloop() method, the Mojo code calls the update() method in a loop and checks the clicked attribute after each update. mainloop() update() clicked ## Python environment​ The Mojo SDK depends on an existing Python dynamic library. At runtime, Mojo uses the first Python in the search path (PATH), to find an associated dynamic Python library of the same version. This will also add any modules from the activated virtual environment. PATH ### Resolving issues​ Finding libpython may fail if the Python interpreter on top of PATH does not have an associated dynamic library. Some Python distributions don't include the shared library, and others only have a static library which isn't supported by Mojo yet. PATH You can find a compatible Python on your system by running this Python script: ```mojo import osimport subprocessFIND_LIBPYTHON = """import osimport sysfrom pathlib import Pathfrom sysconfig import get_config_varext = "dll" if os.name == "nt" else "dylib" if sys.platform == "darwin" else "so"binary = f"libpython{get_config_var('py_version_short')}.{ext}"for folder in [Path(get_config_var(p)) for p in ["LIBPL", "LIBDIR"]]: libpython_path = folder / binary if libpython_path.is_file(): print(libpython_path.resolve()) exit(0)exit(1)"""FIND_PYTHON_VER = "import sysconfig; print(sysconfig.get_python_version())"exe_names = ["python3", "python"] + [f"python3.{i}" for i in range(8, 13)]seen = []executables = []print("Mojo will attempt to use the first python executable from the top:\n")print("vers | compat | path")for path in os.environ["PATH"].split(":"): for exe in exe_names: full_path = os.path.join(path, exe) if os.path.exists(full_path): pyver = subprocess.check_output([full_path, "-c", FIND_PYTHON_VER], text=True).strip() res = subprocess.run([full_path, "-c", FIND_LIBPYTHON], text=True, capture_output=True) libpython = res.stdout.strip() if res.returncode != 0: print(f"{pyver:<7} no {full_path}") elif libpython not in seen: print(f"{pyver:<7} yes {full_path}") seen.append(libpython) executables.append(full_path)if not executables: print("no compatible Python environments found")else: print("\ncreate and activate a virtual environment to use a different Python version:") print(f" {executables[-1]} -m venv .venv") print(" source .venv/bin/activate") ``` Which will produce output like: ```mojo Mojo will attempt to use the first python executable from the top:vers | compat | path3.11 yes /opt/homebrew/opt/[email protected]/libexec/bin/python33.12 yes /opt/homebrew/bin/python33.9 yes /usr/bin/python3create and activate a virtual environment to use a different Python version: /usr/bin/python3 -m venv .venv source .venv/bin/activate ``` If you have no compatible environment, you can install a compatible version of Python that includes shared libraries. Try following the instructions in Set up a Python environment with Conda to install a virtual environment. ### Set up a Python environment with Conda​ Using a Python virtual environment such as Conda is one way to get a version of Python that will work reliably with Mojo. It comes with the required dynamic library, and ensures there are no conflicts with system dependencies. To set up a virtual environment with Conda: - Install Conda by following the Quick command-line install instructions. - Initialize Conda for all the shells on your path: ~/miniconda3/bin/conda init --all Or just one at a time: ~/miniconda3/bin/conda init zsh - Restart your shell. - Install your desired version of Python and activate the environment: conda create -n 3.10 python=3.10conda activate 3.10 Install Conda by following the Quick command-line install instructions. Initialize Conda for all the shells on your path: ```mojo ~/miniconda3/bin/conda init --all ``` Or just one at a time: ```mojo ~/miniconda3/bin/conda init zsh ``` Restart your shell. Install your desired version of Python and activate the environment: ```mojo conda create -n 3.10 python=3.10conda activate 3.10 ``` After setting up the Conda virtual environment, you can install any Python packages you want to use with Mojo, with conda install or pip install. For example: conda install pip install ```mojo conda install numpypip install pillow ``` Now whenever you conda activate 3.10, Mojo will be able to find any modules you installed into that environment. conda activate 3.10 For more information on using Conda with Mojo, see Using Mojo with Python on the Modular Blog. - Import a Python moduleImport a local Python module - Import a local Python module - Call Mojo from Python - Python environmentResolving issuesSet up a Python environment with Conda - Resolving issues - Set up a Python environment with Conda - Import a local Python module - Resolving issues - Set up a Python environment with Conda - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/#call-mojo-from-python - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python integration # Python integration Our long-term goal is to make Mojo a superset of Python (that is, to make Mojo compatible with existing Python programs). Python programmers should be able to use Mojo immediately, and be able to access the huge ecosystem of Python packages that are available today. However, Mojo is still in early development and many Python features are not yet implemented. You can't currently write everything in Mojo that you can write in Python. And Mojo doesn't have its own ecosystem of packages yet. To help bridge this gap, Mojo lets you import Python modules, call Python functions and interact with Python objects from Mojo code. It runs Python code using a standard Python interpreter (CPython), so your existing Python code doesn't need to change. ## Import a Python module​ To import a Python module in Mojo, just call Python.import_module() with the module name: Python.import_module() ```mojo from python import Pythonfn use_array() raises: # This is equivalent to Python's `import numpy as np` var np = Python.import_module("numpy") # Now use numpy as if writing in Python var array = np.array([1, 2, 3]) print(array) ``` ```mojo use_array() ``` Yes, this imports Python NumPy, and you can import any other Python module that you have installed. A few things to note: - Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. - Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. - import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. import_module() import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) import_module() fn try/except raises Mojo loads the Python interpreter and Python modules at runtime, so wherever you run a Mojo program, it must be able to access a compatible Python interpreter, and to locate any imported Python modules. For more information, see Python environment. ### Import a local Python module​ If you have some local Python code you want to use in Mojo, just add the directory to the Python path and then import the module. For example, suppose you have a Python file named mypython.py: mypython.py ```mojo import numpy as npdef gen_random_values(size, base): # generate a size x size array of random numbers between base and base+1 random_array = np.random.rand(size, size) return random_array + base ``` Here's how you can import it and use it in a Mojo file: ```mojo from python import Pythonfn main() raises: Python.add_to_path("path/to/module") var mypython = Python.import_module("mypython") var values = mypython.gen_random_values(2, 3) print(values) ``` Both absolute and relative paths work with add_to_path(). For example, you can import from the local directory like this: add_to_path() ```mojo Python.add_to_path(".") ``` ## Call Mojo from Python​ As shown above, you can call out to Python modules from Mojo. However, there's currently no way to do the reverse—import Mojo modules from Python or call Mojo functions from Python. This may present a challenge for using certain modules. For example, many UI frameworks have a main event loop that makes callbacks to user-defined code in response to UI events. This is sometimes called an "inversion of control" pattern. Instead of your application code calling in to a library, the framework code calls out to your application code. This pattern doesn't work because you can't pass Mojo callbacks to a Python module. For example, consider the popular Tkinter package. The typical usage for Tkinter is something like this: - You create a main, or "root" window for the application. - You add one or more UI widgets to the window. The widgets can have associated callback functions (for example, when a button is pushed). - You call the root window's mainloop() method, which listens for events, updates the UI, and invokes callback functions. The main loop keeps running until the application exits. mainloop() Since Python can't call back into Mojo, one alternative is to have the Mojo application drive the event loop and poll for updates. The following example uses Tkinter, but the basic approach can be applied to other packages. First we create a Python module that defines a Tkinter interface, with a window and single button: ```mojo %%pythonimport tkinter as tkclass App: def __init__(self): self._root = tk.Tk() self.clicked = False def click(self): self.clicked = True def create_button(self, button_text: str): button = tk.Button( master=self._root, text=button_text, command=self.click ) button.place(relx=0.5, rely=0.5, anchor=tk.CENTER) def create(self, res: str): self._root.geometry(res) self.create_button("Hello Mojo!") def update(self): self._root.update() ``` We can call this module from Mojo like this: ```mojo from python import Pythonfn button_clicked(): print("Hi from a Mojo🔥 fn!")def main(): Python.add_to_path(".") var app = Python.import_module("myapp").App() app.create("800x600") while True: app.update() if app.clicked: button_clicked() app.clicked = False ``` Instead of the Python module calling the Tkinter mainloop() method, the Mojo code calls the update() method in a loop and checks the clicked attribute after each update. mainloop() update() clicked ## Python environment​ The Mojo SDK depends on an existing Python dynamic library. At runtime, Mojo uses the first Python in the search path (PATH), to find an associated dynamic Python library of the same version. This will also add any modules from the activated virtual environment. PATH ### Resolving issues​ Finding libpython may fail if the Python interpreter on top of PATH does not have an associated dynamic library. Some Python distributions don't include the shared library, and others only have a static library which isn't supported by Mojo yet. PATH You can find a compatible Python on your system by running this Python script: ```mojo import osimport subprocessFIND_LIBPYTHON = """import osimport sysfrom pathlib import Pathfrom sysconfig import get_config_varext = "dll" if os.name == "nt" else "dylib" if sys.platform == "darwin" else "so"binary = f"libpython{get_config_var('py_version_short')}.{ext}"for folder in [Path(get_config_var(p)) for p in ["LIBPL", "LIBDIR"]]: libpython_path = folder / binary if libpython_path.is_file(): print(libpython_path.resolve()) exit(0)exit(1)"""FIND_PYTHON_VER = "import sysconfig; print(sysconfig.get_python_version())"exe_names = ["python3", "python"] + [f"python3.{i}" for i in range(8, 13)]seen = []executables = []print("Mojo will attempt to use the first python executable from the top:\n")print("vers | compat | path")for path in os.environ["PATH"].split(":"): for exe in exe_names: full_path = os.path.join(path, exe) if os.path.exists(full_path): pyver = subprocess.check_output([full_path, "-c", FIND_PYTHON_VER], text=True).strip() res = subprocess.run([full_path, "-c", FIND_LIBPYTHON], text=True, capture_output=True) libpython = res.stdout.strip() if res.returncode != 0: print(f"{pyver:<7} no {full_path}") elif libpython not in seen: print(f"{pyver:<7} yes {full_path}") seen.append(libpython) executables.append(full_path)if not executables: print("no compatible Python environments found")else: print("\ncreate and activate a virtual environment to use a different Python version:") print(f" {executables[-1]} -m venv .venv") print(" source .venv/bin/activate") ``` Which will produce output like: ```mojo Mojo will attempt to use the first python executable from the top:vers | compat | path3.11 yes /opt/homebrew/opt/[email protected]/libexec/bin/python33.12 yes /opt/homebrew/bin/python33.9 yes /usr/bin/python3create and activate a virtual environment to use a different Python version: /usr/bin/python3 -m venv .venv source .venv/bin/activate ``` If you have no compatible environment, you can install a compatible version of Python that includes shared libraries. Try following the instructions in Set up a Python environment with Conda to install a virtual environment. ### Set up a Python environment with Conda​ Using a Python virtual environment such as Conda is one way to get a version of Python that will work reliably with Mojo. It comes with the required dynamic library, and ensures there are no conflicts with system dependencies. To set up a virtual environment with Conda: - Install Conda by following the Quick command-line install instructions. - Initialize Conda for all the shells on your path: ~/miniconda3/bin/conda init --all Or just one at a time: ~/miniconda3/bin/conda init zsh - Restart your shell. - Install your desired version of Python and activate the environment: conda create -n 3.10 python=3.10conda activate 3.10 Install Conda by following the Quick command-line install instructions. Initialize Conda for all the shells on your path: ```mojo ~/miniconda3/bin/conda init --all ``` Or just one at a time: ```mojo ~/miniconda3/bin/conda init zsh ``` Restart your shell. Install your desired version of Python and activate the environment: ```mojo conda create -n 3.10 python=3.10conda activate 3.10 ``` After setting up the Conda virtual environment, you can install any Python packages you want to use with Mojo, with conda install or pip install. For example: conda install pip install ```mojo conda install numpypip install pillow ``` Now whenever you conda activate 3.10, Mojo will be able to find any modules you installed into that environment. conda activate 3.10 For more information on using Conda with Mojo, see Using Mojo with Python on the Modular Blog. - Import a Python moduleImport a local Python module - Import a local Python module - Call Mojo from Python - Python environmentResolving issuesSet up a Python environment with Conda - Resolving issues - Set up a Python environment with Conda - Import a local Python module - Resolving issues - Set up a Python environment with Conda - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/#resolving-issues - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python integration # Python integration Our long-term goal is to make Mojo a superset of Python (that is, to make Mojo compatible with existing Python programs). Python programmers should be able to use Mojo immediately, and be able to access the huge ecosystem of Python packages that are available today. However, Mojo is still in early development and many Python features are not yet implemented. You can't currently write everything in Mojo that you can write in Python. And Mojo doesn't have its own ecosystem of packages yet. To help bridge this gap, Mojo lets you import Python modules, call Python functions and interact with Python objects from Mojo code. It runs Python code using a standard Python interpreter (CPython), so your existing Python code doesn't need to change. ## Import a Python module​ To import a Python module in Mojo, just call Python.import_module() with the module name: Python.import_module() ```mojo from python import Pythonfn use_array() raises: # This is equivalent to Python's `import numpy as np` var np = Python.import_module("numpy") # Now use numpy as if writing in Python var array = np.array([1, 2, 3]) print(array) ``` ```mojo use_array() ``` Yes, this imports Python NumPy, and you can import any other Python module that you have installed. A few things to note: - Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. - Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. - import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. import_module() import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) import_module() fn try/except raises Mojo loads the Python interpreter and Python modules at runtime, so wherever you run a Mojo program, it must be able to access a compatible Python interpreter, and to locate any imported Python modules. For more information, see Python environment. ### Import a local Python module​ If you have some local Python code you want to use in Mojo, just add the directory to the Python path and then import the module. For example, suppose you have a Python file named mypython.py: mypython.py ```mojo import numpy as npdef gen_random_values(size, base): # generate a size x size array of random numbers between base and base+1 random_array = np.random.rand(size, size) return random_array + base ``` Here's how you can import it and use it in a Mojo file: ```mojo from python import Pythonfn main() raises: Python.add_to_path("path/to/module") var mypython = Python.import_module("mypython") var values = mypython.gen_random_values(2, 3) print(values) ``` Both absolute and relative paths work with add_to_path(). For example, you can import from the local directory like this: add_to_path() ```mojo Python.add_to_path(".") ``` ## Call Mojo from Python​ As shown above, you can call out to Python modules from Mojo. However, there's currently no way to do the reverse—import Mojo modules from Python or call Mojo functions from Python. This may present a challenge for using certain modules. For example, many UI frameworks have a main event loop that makes callbacks to user-defined code in response to UI events. This is sometimes called an "inversion of control" pattern. Instead of your application code calling in to a library, the framework code calls out to your application code. This pattern doesn't work because you can't pass Mojo callbacks to a Python module. For example, consider the popular Tkinter package. The typical usage for Tkinter is something like this: - You create a main, or "root" window for the application. - You add one or more UI widgets to the window. The widgets can have associated callback functions (for example, when a button is pushed). - You call the root window's mainloop() method, which listens for events, updates the UI, and invokes callback functions. The main loop keeps running until the application exits. mainloop() Since Python can't call back into Mojo, one alternative is to have the Mojo application drive the event loop and poll for updates. The following example uses Tkinter, but the basic approach can be applied to other packages. First we create a Python module that defines a Tkinter interface, with a window and single button: ```mojo %%pythonimport tkinter as tkclass App: def __init__(self): self._root = tk.Tk() self.clicked = False def click(self): self.clicked = True def create_button(self, button_text: str): button = tk.Button( master=self._root, text=button_text, command=self.click ) button.place(relx=0.5, rely=0.5, anchor=tk.CENTER) def create(self, res: str): self._root.geometry(res) self.create_button("Hello Mojo!") def update(self): self._root.update() ``` We can call this module from Mojo like this: ```mojo from python import Pythonfn button_clicked(): print("Hi from a Mojo🔥 fn!")def main(): Python.add_to_path(".") var app = Python.import_module("myapp").App() app.create("800x600") while True: app.update() if app.clicked: button_clicked() app.clicked = False ``` Instead of the Python module calling the Tkinter mainloop() method, the Mojo code calls the update() method in a loop and checks the clicked attribute after each update. mainloop() update() clicked ## Python environment​ The Mojo SDK depends on an existing Python dynamic library. At runtime, Mojo uses the first Python in the search path (PATH), to find an associated dynamic Python library of the same version. This will also add any modules from the activated virtual environment. PATH ### Resolving issues​ Finding libpython may fail if the Python interpreter on top of PATH does not have an associated dynamic library. Some Python distributions don't include the shared library, and others only have a static library which isn't supported by Mojo yet. PATH You can find a compatible Python on your system by running this Python script: ```mojo import osimport subprocessFIND_LIBPYTHON = """import osimport sysfrom pathlib import Pathfrom sysconfig import get_config_varext = "dll" if os.name == "nt" else "dylib" if sys.platform == "darwin" else "so"binary = f"libpython{get_config_var('py_version_short')}.{ext}"for folder in [Path(get_config_var(p)) for p in ["LIBPL", "LIBDIR"]]: libpython_path = folder / binary if libpython_path.is_file(): print(libpython_path.resolve()) exit(0)exit(1)"""FIND_PYTHON_VER = "import sysconfig; print(sysconfig.get_python_version())"exe_names = ["python3", "python"] + [f"python3.{i}" for i in range(8, 13)]seen = []executables = []print("Mojo will attempt to use the first python executable from the top:\n")print("vers | compat | path")for path in os.environ["PATH"].split(":"): for exe in exe_names: full_path = os.path.join(path, exe) if os.path.exists(full_path): pyver = subprocess.check_output([full_path, "-c", FIND_PYTHON_VER], text=True).strip() res = subprocess.run([full_path, "-c", FIND_LIBPYTHON], text=True, capture_output=True) libpython = res.stdout.strip() if res.returncode != 0: print(f"{pyver:<7} no {full_path}") elif libpython not in seen: print(f"{pyver:<7} yes {full_path}") seen.append(libpython) executables.append(full_path)if not executables: print("no compatible Python environments found")else: print("\ncreate and activate a virtual environment to use a different Python version:") print(f" {executables[-1]} -m venv .venv") print(" source .venv/bin/activate") ``` Which will produce output like: ```mojo Mojo will attempt to use the first python executable from the top:vers | compat | path3.11 yes /opt/homebrew/opt/[email protected]/libexec/bin/python33.12 yes /opt/homebrew/bin/python33.9 yes /usr/bin/python3create and activate a virtual environment to use a different Python version: /usr/bin/python3 -m venv .venv source .venv/bin/activate ``` If you have no compatible environment, you can install a compatible version of Python that includes shared libraries. Try following the instructions in Set up a Python environment with Conda to install a virtual environment. ### Set up a Python environment with Conda​ Using a Python virtual environment such as Conda is one way to get a version of Python that will work reliably with Mojo. It comes with the required dynamic library, and ensures there are no conflicts with system dependencies. To set up a virtual environment with Conda: - Install Conda by following the Quick command-line install instructions. - Initialize Conda for all the shells on your path: ~/miniconda3/bin/conda init --all Or just one at a time: ~/miniconda3/bin/conda init zsh - Restart your shell. - Install your desired version of Python and activate the environment: conda create -n 3.10 python=3.10conda activate 3.10 Install Conda by following the Quick command-line install instructions. Initialize Conda for all the shells on your path: ```mojo ~/miniconda3/bin/conda init --all ``` Or just one at a time: ```mojo ~/miniconda3/bin/conda init zsh ``` Restart your shell. Install your desired version of Python and activate the environment: ```mojo conda create -n 3.10 python=3.10conda activate 3.10 ``` After setting up the Conda virtual environment, you can install any Python packages you want to use with Mojo, with conda install or pip install. For example: conda install pip install ```mojo conda install numpypip install pillow ``` Now whenever you conda activate 3.10, Mojo will be able to find any modules you installed into that environment. conda activate 3.10 For more information on using Conda with Mojo, see Using Mojo with Python on the Modular Blog. - Import a Python moduleImport a local Python module - Import a local Python module - Call Mojo from Python - Python environmentResolving issuesSet up a Python environment with Conda - Resolving issues - Set up a Python environment with Conda - Import a local Python module - Resolving issues - Set up a Python environment with Conda - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/#set-up-a-python-environment-with-conda - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python integration # Python integration Our long-term goal is to make Mojo a superset of Python (that is, to make Mojo compatible with existing Python programs). Python programmers should be able to use Mojo immediately, and be able to access the huge ecosystem of Python packages that are available today. However, Mojo is still in early development and many Python features are not yet implemented. You can't currently write everything in Mojo that you can write in Python. And Mojo doesn't have its own ecosystem of packages yet. To help bridge this gap, Mojo lets you import Python modules, call Python functions and interact with Python objects from Mojo code. It runs Python code using a standard Python interpreter (CPython), so your existing Python code doesn't need to change. ## Import a Python module​ To import a Python module in Mojo, just call Python.import_module() with the module name: Python.import_module() ```mojo from python import Pythonfn use_array() raises: # This is equivalent to Python's `import numpy as np` var np = Python.import_module("numpy") # Now use numpy as if writing in Python var array = np.array([1, 2, 3]) print(array) ``` ```mojo use_array() ``` Yes, this imports Python NumPy, and you can import any other Python module that you have installed. A few things to note: - Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. - Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. - import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) Currently, you cannot import individual members (such as a single Python class or function)—you must import the whole Python module and then access members through the module name. Mojo doesn't yet support top-level code, so the import_module() call must be inside another method. This means you may need to import a module multiple times or pass around a reference to the module. This works the same way as Python: importing the module multiple times won't run the initialization logic more than once, so you don't pay any performance penalty. import_module() import_module() may raise an exception (for example, if the module isn't installed). If you're using it inside an fn function, you need to either handle errors (using a try/except clause), or add the raises keyword to the function signature. You'll also see this when calling Python functions that may raise exceptions. (Raising exceptions is much more common in Python code than in the Mojo standard library, which limits their use for performance reasons.) import_module() fn try/except raises Mojo loads the Python interpreter and Python modules at runtime, so wherever you run a Mojo program, it must be able to access a compatible Python interpreter, and to locate any imported Python modules. For more information, see Python environment. ### Import a local Python module​ If you have some local Python code you want to use in Mojo, just add the directory to the Python path and then import the module. For example, suppose you have a Python file named mypython.py: mypython.py ```mojo import numpy as npdef gen_random_values(size, base): # generate a size x size array of random numbers between base and base+1 random_array = np.random.rand(size, size) return random_array + base ``` Here's how you can import it and use it in a Mojo file: ```mojo from python import Pythonfn main() raises: Python.add_to_path("path/to/module") var mypython = Python.import_module("mypython") var values = mypython.gen_random_values(2, 3) print(values) ``` Both absolute and relative paths work with add_to_path(). For example, you can import from the local directory like this: add_to_path() ```mojo Python.add_to_path(".") ``` ## Call Mojo from Python​ As shown above, you can call out to Python modules from Mojo. However, there's currently no way to do the reverse—import Mojo modules from Python or call Mojo functions from Python. This may present a challenge for using certain modules. For example, many UI frameworks have a main event loop that makes callbacks to user-defined code in response to UI events. This is sometimes called an "inversion of control" pattern. Instead of your application code calling in to a library, the framework code calls out to your application code. This pattern doesn't work because you can't pass Mojo callbacks to a Python module. For example, consider the popular Tkinter package. The typical usage for Tkinter is something like this: - You create a main, or "root" window for the application. - You add one or more UI widgets to the window. The widgets can have associated callback functions (for example, when a button is pushed). - You call the root window's mainloop() method, which listens for events, updates the UI, and invokes callback functions. The main loop keeps running until the application exits. mainloop() Since Python can't call back into Mojo, one alternative is to have the Mojo application drive the event loop and poll for updates. The following example uses Tkinter, but the basic approach can be applied to other packages. First we create a Python module that defines a Tkinter interface, with a window and single button: ```mojo %%pythonimport tkinter as tkclass App: def __init__(self): self._root = tk.Tk() self.clicked = False def click(self): self.clicked = True def create_button(self, button_text: str): button = tk.Button( master=self._root, text=button_text, command=self.click ) button.place(relx=0.5, rely=0.5, anchor=tk.CENTER) def create(self, res: str): self._root.geometry(res) self.create_button("Hello Mojo!") def update(self): self._root.update() ``` We can call this module from Mojo like this: ```mojo from python import Pythonfn button_clicked(): print("Hi from a Mojo🔥 fn!")def main(): Python.add_to_path(".") var app = Python.import_module("myapp").App() app.create("800x600") while True: app.update() if app.clicked: button_clicked() app.clicked = False ``` Instead of the Python module calling the Tkinter mainloop() method, the Mojo code calls the update() method in a loop and checks the clicked attribute after each update. mainloop() update() clicked ## Python environment​ The Mojo SDK depends on an existing Python dynamic library. At runtime, Mojo uses the first Python in the search path (PATH), to find an associated dynamic Python library of the same version. This will also add any modules from the activated virtual environment. PATH ### Resolving issues​ Finding libpython may fail if the Python interpreter on top of PATH does not have an associated dynamic library. Some Python distributions don't include the shared library, and others only have a static library which isn't supported by Mojo yet. PATH You can find a compatible Python on your system by running this Python script: ```mojo import osimport subprocessFIND_LIBPYTHON = """import osimport sysfrom pathlib import Pathfrom sysconfig import get_config_varext = "dll" if os.name == "nt" else "dylib" if sys.platform == "darwin" else "so"binary = f"libpython{get_config_var('py_version_short')}.{ext}"for folder in [Path(get_config_var(p)) for p in ["LIBPL", "LIBDIR"]]: libpython_path = folder / binary if libpython_path.is_file(): print(libpython_path.resolve()) exit(0)exit(1)"""FIND_PYTHON_VER = "import sysconfig; print(sysconfig.get_python_version())"exe_names = ["python3", "python"] + [f"python3.{i}" for i in range(8, 13)]seen = []executables = []print("Mojo will attempt to use the first python executable from the top:\n")print("vers | compat | path")for path in os.environ["PATH"].split(":"): for exe in exe_names: full_path = os.path.join(path, exe) if os.path.exists(full_path): pyver = subprocess.check_output([full_path, "-c", FIND_PYTHON_VER], text=True).strip() res = subprocess.run([full_path, "-c", FIND_LIBPYTHON], text=True, capture_output=True) libpython = res.stdout.strip() if res.returncode != 0: print(f"{pyver:<7} no {full_path}") elif libpython not in seen: print(f"{pyver:<7} yes {full_path}") seen.append(libpython) executables.append(full_path)if not executables: print("no compatible Python environments found")else: print("\ncreate and activate a virtual environment to use a different Python version:") print(f" {executables[-1]} -m venv .venv") print(" source .venv/bin/activate") ``` Which will produce output like: ```mojo Mojo will attempt to use the first python executable from the top:vers | compat | path3.11 yes /opt/homebrew/opt/[email protected]/libexec/bin/python33.12 yes /opt/homebrew/bin/python33.9 yes /usr/bin/python3create and activate a virtual environment to use a different Python version: /usr/bin/python3 -m venv .venv source .venv/bin/activate ``` If you have no compatible environment, you can install a compatible version of Python that includes shared libraries. Try following the instructions in Set up a Python environment with Conda to install a virtual environment. ### Set up a Python environment with Conda​ Using a Python virtual environment such as Conda is one way to get a version of Python that will work reliably with Mojo. It comes with the required dynamic library, and ensures there are no conflicts with system dependencies. To set up a virtual environment with Conda: - Install Conda by following the Quick command-line install instructions. - Initialize Conda for all the shells on your path: ~/miniconda3/bin/conda init --all Or just one at a time: ~/miniconda3/bin/conda init zsh - Restart your shell. - Install your desired version of Python and activate the environment: conda create -n 3.10 python=3.10conda activate 3.10 Install Conda by following the Quick command-line install instructions. Initialize Conda for all the shells on your path: ```mojo ~/miniconda3/bin/conda init --all ``` Or just one at a time: ```mojo ~/miniconda3/bin/conda init zsh ``` Restart your shell. Install your desired version of Python and activate the environment: ```mojo conda create -n 3.10 python=3.10conda activate 3.10 ``` After setting up the Conda virtual environment, you can install any Python packages you want to use with Mojo, with conda install or pip install. For example: conda install pip install ```mojo conda install numpypip install pillow ``` Now whenever you conda activate 3.10, Mojo will be able to find any modules you installed into that environment. conda activate 3.10 For more information on using Conda with Mojo, see Using Mojo with Python on the Modular Blog. - Import a Python moduleImport a local Python module - Import a local Python module - Call Mojo from Python - Python environmentResolving issuesSet up a Python environment with Conda - Resolving issues - Set up a Python environment with Conda - Import a local Python module - Resolving issues - Set up a Python environment with Conda - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/types#mojo-types-in-python - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python types # Python types When calling Python methods, Mojo needs to convert back and forth between native Python objects and native Mojo objects. Most of these conversions happen automatically, but there are a number of cases that Mojo doesn't handle yet. In these cases you may need to do an explicit conversion, or call an extra method. ## Mojo types in Python​ Mojo primitive types implicitly convert into Python objects. Today we support lists, tuples, integers, floats, booleans, and strings. For example, given this Python function that prints Python types: ```mojo %%pythondef type_printer(value): print(type(value)) ``` (You can ignore the %%python at the start of the code sample; it's explained in the note below.) %%python You can pass this Python function Mojo types with no problem: ```mojo type_printer(4)type_printer(3.14)type_printer(("Mojo", True)) ``` This is a simplified code example written as a set of Jupyter notebook cells. The first cell includes the %%python directive so it's interpreted as Python. The second cell includes top-level Mojo code. You'd need to adjust this code to run it elsewhere. %%python ## Python types in Mojo​ You can also use Python objects from Mojo. For example, Mojo's Dict and List types don't natively support heterogeneous collections. One alternative is to use a Python dictionary or list. Dict List For example, to create a Python dictionary, use the dict() method: dict() ```mojo from python import Pythondef use_dict(): var dictionary = Python.dict() dictionary["item_name"] = "whizbang" dictionary["price"] = 11.75 dictionary["inventory"] = 100 print(dictionary) ``` ### Mojo wrapper objects​ When you use Python objects in your Mojo code, Mojo adds the PythonObject wrapper around the Python object. This object exposes a number of common double underscore methods (dunder methods) like __getitem__() and __getattr__(), passing them through to the underlying Python object. PythonObject __getitem__() __getattr__() You can explicitly create a wrapped Python object by initializing a PythonObject with a Mojo literal: PythonObject ```mojo from python import PythonObjectvar py_list: PythonObject = [1, 2, 3, 4] ``` Most of the time, you can treat the wrapped object just like you'd treat it in Python. You can use Python's [] operators to access an item in a list, and use dot-notation to access attributes and call methods. For example: [] ```mojo var n = py_list[2]py_list.append(5) ``` If you want to construct a Python type that doesn't have a literal Mojo equivalent, you can also use the Python.evaluate() method. For example, to create a Python set: Python.evaluate() set ```mojo def use_py_set(): var py_set = Python.evaluate('set([2, 3, 5, 7, 11])') var num_items = len(py_set) print(num_items, " items in set.") # prints "5 items in set" print(py_set.__contains__(6)) # prints "False" ``` TODO: You should be able to use the expression 6 in py_set. However, because of the way PythonObject currently works, you need to call the __contains__() method directly. 6 in py_set PythonObject __contains__() Some Mojo APIs handle PythonObject just fine, but sometimes you'll need to explicitly convert a Python value into a native Mojo value. PythonObject Currently PythonObject conforms to the Intable, Stringable, and Boolable traits, which means you can convert Python values to Mojo Int, String, and Bool types using the built-in int(), str(), and bool() functions, and print Python values using the built-in print() function. PythonObject Intable Stringable Boolable Int String Bool int() str() bool() print() PythonObject also provides the to_float64() for converting to a Mojo floating point value. PythonObject to_float64() ```mojo var i: Int = int(py_int)var s: String = str(py_string)var b: Bool = bool(py_bool)var f: Float64 = py_float.to_float64() ``` ### Comparing Python types in Mojo​ In conditionals, Python objects act like you'd expect them to: Python values like False and None evaluate as false in Mojo, too. False None If you need to know the type of the underlying Python object, you can use the Python.type() method, which is equivalent to the Python type() builtin. You can compare the identity of two Python objects using the Python.is_type() method (which is equivalent to the Python is operator): Python.type() type() Python.is_type() is ```mojo def python_types(): from python import Python from python import PythonObject var value1: PythonObject = 3.7 var value2 = Python.evaluate("10/3") var float_type = Python.evaluate("float") print(Python.type(value1)) # <class 'float'> print(Python.is_type(Python.type(value1), Python.type(value2))) # True print(Python.is_type(Python.type(value1), float_type)) # True print(Python.is_type(Python.type(value1), Python.none())) # False ``` One TODO item here: The Python.is_type() method is misleadingly named, since it doesn't compare types, but object identity. Python.is_type() ## Further reading​ For more information, see Using Mojo with Python on the Modular Blog. - Mojo types in Python - Python types in MojoMojo wrapper objectsComparing Python types in Mojo - Mojo wrapper objects - Comparing Python types in Mojo - Further reading - Mojo wrapper objects - Comparing Python types in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/types#python-types-in-mojo - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python types # Python types When calling Python methods, Mojo needs to convert back and forth between native Python objects and native Mojo objects. Most of these conversions happen automatically, but there are a number of cases that Mojo doesn't handle yet. In these cases you may need to do an explicit conversion, or call an extra method. ## Mojo types in Python​ Mojo primitive types implicitly convert into Python objects. Today we support lists, tuples, integers, floats, booleans, and strings. For example, given this Python function that prints Python types: ```mojo %%pythondef type_printer(value): print(type(value)) ``` (You can ignore the %%python at the start of the code sample; it's explained in the note below.) %%python You can pass this Python function Mojo types with no problem: ```mojo type_printer(4)type_printer(3.14)type_printer(("Mojo", True)) ``` This is a simplified code example written as a set of Jupyter notebook cells. The first cell includes the %%python directive so it's interpreted as Python. The second cell includes top-level Mojo code. You'd need to adjust this code to run it elsewhere. %%python ## Python types in Mojo​ You can also use Python objects from Mojo. For example, Mojo's Dict and List types don't natively support heterogeneous collections. One alternative is to use a Python dictionary or list. Dict List For example, to create a Python dictionary, use the dict() method: dict() ```mojo from python import Pythondef use_dict(): var dictionary = Python.dict() dictionary["item_name"] = "whizbang" dictionary["price"] = 11.75 dictionary["inventory"] = 100 print(dictionary) ``` ### Mojo wrapper objects​ When you use Python objects in your Mojo code, Mojo adds the PythonObject wrapper around the Python object. This object exposes a number of common double underscore methods (dunder methods) like __getitem__() and __getattr__(), passing them through to the underlying Python object. PythonObject __getitem__() __getattr__() You can explicitly create a wrapped Python object by initializing a PythonObject with a Mojo literal: PythonObject ```mojo from python import PythonObjectvar py_list: PythonObject = [1, 2, 3, 4] ``` Most of the time, you can treat the wrapped object just like you'd treat it in Python. You can use Python's [] operators to access an item in a list, and use dot-notation to access attributes and call methods. For example: [] ```mojo var n = py_list[2]py_list.append(5) ``` If you want to construct a Python type that doesn't have a literal Mojo equivalent, you can also use the Python.evaluate() method. For example, to create a Python set: Python.evaluate() set ```mojo def use_py_set(): var py_set = Python.evaluate('set([2, 3, 5, 7, 11])') var num_items = len(py_set) print(num_items, " items in set.") # prints "5 items in set" print(py_set.__contains__(6)) # prints "False" ``` TODO: You should be able to use the expression 6 in py_set. However, because of the way PythonObject currently works, you need to call the __contains__() method directly. 6 in py_set PythonObject __contains__() Some Mojo APIs handle PythonObject just fine, but sometimes you'll need to explicitly convert a Python value into a native Mojo value. PythonObject Currently PythonObject conforms to the Intable, Stringable, and Boolable traits, which means you can convert Python values to Mojo Int, String, and Bool types using the built-in int(), str(), and bool() functions, and print Python values using the built-in print() function. PythonObject Intable Stringable Boolable Int String Bool int() str() bool() print() PythonObject also provides the to_float64() for converting to a Mojo floating point value. PythonObject to_float64() ```mojo var i: Int = int(py_int)var s: String = str(py_string)var b: Bool = bool(py_bool)var f: Float64 = py_float.to_float64() ``` ### Comparing Python types in Mojo​ In conditionals, Python objects act like you'd expect them to: Python values like False and None evaluate as false in Mojo, too. False None If you need to know the type of the underlying Python object, you can use the Python.type() method, which is equivalent to the Python type() builtin. You can compare the identity of two Python objects using the Python.is_type() method (which is equivalent to the Python is operator): Python.type() type() Python.is_type() is ```mojo def python_types(): from python import Python from python import PythonObject var value1: PythonObject = 3.7 var value2 = Python.evaluate("10/3") var float_type = Python.evaluate("float") print(Python.type(value1)) # <class 'float'> print(Python.is_type(Python.type(value1), Python.type(value2))) # True print(Python.is_type(Python.type(value1), float_type)) # True print(Python.is_type(Python.type(value1), Python.none())) # False ``` One TODO item here: The Python.is_type() method is misleadingly named, since it doesn't compare types, but object identity. Python.is_type() ## Further reading​ For more information, see Using Mojo with Python on the Modular Blog. - Mojo types in Python - Python types in MojoMojo wrapper objectsComparing Python types in Mojo - Mojo wrapper objects - Comparing Python types in Mojo - Further reading - Mojo wrapper objects - Comparing Python types in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/types#mojo-wrapper-objects - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python types # Python types When calling Python methods, Mojo needs to convert back and forth between native Python objects and native Mojo objects. Most of these conversions happen automatically, but there are a number of cases that Mojo doesn't handle yet. In these cases you may need to do an explicit conversion, or call an extra method. ## Mojo types in Python​ Mojo primitive types implicitly convert into Python objects. Today we support lists, tuples, integers, floats, booleans, and strings. For example, given this Python function that prints Python types: ```mojo %%pythondef type_printer(value): print(type(value)) ``` (You can ignore the %%python at the start of the code sample; it's explained in the note below.) %%python You can pass this Python function Mojo types with no problem: ```mojo type_printer(4)type_printer(3.14)type_printer(("Mojo", True)) ``` This is a simplified code example written as a set of Jupyter notebook cells. The first cell includes the %%python directive so it's interpreted as Python. The second cell includes top-level Mojo code. You'd need to adjust this code to run it elsewhere. %%python ## Python types in Mojo​ You can also use Python objects from Mojo. For example, Mojo's Dict and List types don't natively support heterogeneous collections. One alternative is to use a Python dictionary or list. Dict List For example, to create a Python dictionary, use the dict() method: dict() ```mojo from python import Pythondef use_dict(): var dictionary = Python.dict() dictionary["item_name"] = "whizbang" dictionary["price"] = 11.75 dictionary["inventory"] = 100 print(dictionary) ``` ### Mojo wrapper objects​ When you use Python objects in your Mojo code, Mojo adds the PythonObject wrapper around the Python object. This object exposes a number of common double underscore methods (dunder methods) like __getitem__() and __getattr__(), passing them through to the underlying Python object. PythonObject __getitem__() __getattr__() You can explicitly create a wrapped Python object by initializing a PythonObject with a Mojo literal: PythonObject ```mojo from python import PythonObjectvar py_list: PythonObject = [1, 2, 3, 4] ``` Most of the time, you can treat the wrapped object just like you'd treat it in Python. You can use Python's [] operators to access an item in a list, and use dot-notation to access attributes and call methods. For example: [] ```mojo var n = py_list[2]py_list.append(5) ``` If you want to construct a Python type that doesn't have a literal Mojo equivalent, you can also use the Python.evaluate() method. For example, to create a Python set: Python.evaluate() set ```mojo def use_py_set(): var py_set = Python.evaluate('set([2, 3, 5, 7, 11])') var num_items = len(py_set) print(num_items, " items in set.") # prints "5 items in set" print(py_set.__contains__(6)) # prints "False" ``` TODO: You should be able to use the expression 6 in py_set. However, because of the way PythonObject currently works, you need to call the __contains__() method directly. 6 in py_set PythonObject __contains__() Some Mojo APIs handle PythonObject just fine, but sometimes you'll need to explicitly convert a Python value into a native Mojo value. PythonObject Currently PythonObject conforms to the Intable, Stringable, and Boolable traits, which means you can convert Python values to Mojo Int, String, and Bool types using the built-in int(), str(), and bool() functions, and print Python values using the built-in print() function. PythonObject Intable Stringable Boolable Int String Bool int() str() bool() print() PythonObject also provides the to_float64() for converting to a Mojo floating point value. PythonObject to_float64() ```mojo var i: Int = int(py_int)var s: String = str(py_string)var b: Bool = bool(py_bool)var f: Float64 = py_float.to_float64() ``` ### Comparing Python types in Mojo​ In conditionals, Python objects act like you'd expect them to: Python values like False and None evaluate as false in Mojo, too. False None If you need to know the type of the underlying Python object, you can use the Python.type() method, which is equivalent to the Python type() builtin. You can compare the identity of two Python objects using the Python.is_type() method (which is equivalent to the Python is operator): Python.type() type() Python.is_type() is ```mojo def python_types(): from python import Python from python import PythonObject var value1: PythonObject = 3.7 var value2 = Python.evaluate("10/3") var float_type = Python.evaluate("float") print(Python.type(value1)) # <class 'float'> print(Python.is_type(Python.type(value1), Python.type(value2))) # True print(Python.is_type(Python.type(value1), float_type)) # True print(Python.is_type(Python.type(value1), Python.none())) # False ``` One TODO item here: The Python.is_type() method is misleadingly named, since it doesn't compare types, but object identity. Python.is_type() ## Further reading​ For more information, see Using Mojo with Python on the Modular Blog. - Mojo types in Python - Python types in MojoMojo wrapper objectsComparing Python types in Mojo - Mojo wrapper objects - Comparing Python types in Mojo - Further reading - Mojo wrapper objects - Comparing Python types in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/types#comparing-python-types-in-mojo - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python types # Python types When calling Python methods, Mojo needs to convert back and forth between native Python objects and native Mojo objects. Most of these conversions happen automatically, but there are a number of cases that Mojo doesn't handle yet. In these cases you may need to do an explicit conversion, or call an extra method. ## Mojo types in Python​ Mojo primitive types implicitly convert into Python objects. Today we support lists, tuples, integers, floats, booleans, and strings. For example, given this Python function that prints Python types: ```mojo %%pythondef type_printer(value): print(type(value)) ``` (You can ignore the %%python at the start of the code sample; it's explained in the note below.) %%python You can pass this Python function Mojo types with no problem: ```mojo type_printer(4)type_printer(3.14)type_printer(("Mojo", True)) ``` This is a simplified code example written as a set of Jupyter notebook cells. The first cell includes the %%python directive so it's interpreted as Python. The second cell includes top-level Mojo code. You'd need to adjust this code to run it elsewhere. %%python ## Python types in Mojo​ You can also use Python objects from Mojo. For example, Mojo's Dict and List types don't natively support heterogeneous collections. One alternative is to use a Python dictionary or list. Dict List For example, to create a Python dictionary, use the dict() method: dict() ```mojo from python import Pythondef use_dict(): var dictionary = Python.dict() dictionary["item_name"] = "whizbang" dictionary["price"] = 11.75 dictionary["inventory"] = 100 print(dictionary) ``` ### Mojo wrapper objects​ When you use Python objects in your Mojo code, Mojo adds the PythonObject wrapper around the Python object. This object exposes a number of common double underscore methods (dunder methods) like __getitem__() and __getattr__(), passing them through to the underlying Python object. PythonObject __getitem__() __getattr__() You can explicitly create a wrapped Python object by initializing a PythonObject with a Mojo literal: PythonObject ```mojo from python import PythonObjectvar py_list: PythonObject = [1, 2, 3, 4] ``` Most of the time, you can treat the wrapped object just like you'd treat it in Python. You can use Python's [] operators to access an item in a list, and use dot-notation to access attributes and call methods. For example: [] ```mojo var n = py_list[2]py_list.append(5) ``` If you want to construct a Python type that doesn't have a literal Mojo equivalent, you can also use the Python.evaluate() method. For example, to create a Python set: Python.evaluate() set ```mojo def use_py_set(): var py_set = Python.evaluate('set([2, 3, 5, 7, 11])') var num_items = len(py_set) print(num_items, " items in set.") # prints "5 items in set" print(py_set.__contains__(6)) # prints "False" ``` TODO: You should be able to use the expression 6 in py_set. However, because of the way PythonObject currently works, you need to call the __contains__() method directly. 6 in py_set PythonObject __contains__() Some Mojo APIs handle PythonObject just fine, but sometimes you'll need to explicitly convert a Python value into a native Mojo value. PythonObject Currently PythonObject conforms to the Intable, Stringable, and Boolable traits, which means you can convert Python values to Mojo Int, String, and Bool types using the built-in int(), str(), and bool() functions, and print Python values using the built-in print() function. PythonObject Intable Stringable Boolable Int String Bool int() str() bool() print() PythonObject also provides the to_float64() for converting to a Mojo floating point value. PythonObject to_float64() ```mojo var i: Int = int(py_int)var s: String = str(py_string)var b: Bool = bool(py_bool)var f: Float64 = py_float.to_float64() ``` ### Comparing Python types in Mojo​ In conditionals, Python objects act like you'd expect them to: Python values like False and None evaluate as false in Mojo, too. False None If you need to know the type of the underlying Python object, you can use the Python.type() method, which is equivalent to the Python type() builtin. You can compare the identity of two Python objects using the Python.is_type() method (which is equivalent to the Python is operator): Python.type() type() Python.is_type() is ```mojo def python_types(): from python import Python from python import PythonObject var value1: PythonObject = 3.7 var value2 = Python.evaluate("10/3") var float_type = Python.evaluate("float") print(Python.type(value1)) # <class 'float'> print(Python.is_type(Python.type(value1), Python.type(value2))) # True print(Python.is_type(Python.type(value1), float_type)) # True print(Python.is_type(Python.type(value1), Python.none())) # False ``` One TODO item here: The Python.is_type() method is misleadingly named, since it doesn't compare types, but object identity. Python.is_type() ## Further reading​ For more information, see Using Mojo with Python on the Modular Blog. - Mojo types in Python - Python types in MojoMojo wrapper objectsComparing Python types in Mojo - Mojo wrapper objects - Comparing Python types in Mojo - Further reading - Mojo wrapper objects - Comparing Python types in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/python/types#further-reading - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Python - /Python types # Python types When calling Python methods, Mojo needs to convert back and forth between native Python objects and native Mojo objects. Most of these conversions happen automatically, but there are a number of cases that Mojo doesn't handle yet. In these cases you may need to do an explicit conversion, or call an extra method. ## Mojo types in Python​ Mojo primitive types implicitly convert into Python objects. Today we support lists, tuples, integers, floats, booleans, and strings. For example, given this Python function that prints Python types: ```mojo %%pythondef type_printer(value): print(type(value)) ``` (You can ignore the %%python at the start of the code sample; it's explained in the note below.) %%python You can pass this Python function Mojo types with no problem: ```mojo type_printer(4)type_printer(3.14)type_printer(("Mojo", True)) ``` This is a simplified code example written as a set of Jupyter notebook cells. The first cell includes the %%python directive so it's interpreted as Python. The second cell includes top-level Mojo code. You'd need to adjust this code to run it elsewhere. %%python ## Python types in Mojo​ You can also use Python objects from Mojo. For example, Mojo's Dict and List types don't natively support heterogeneous collections. One alternative is to use a Python dictionary or list. Dict List For example, to create a Python dictionary, use the dict() method: dict() ```mojo from python import Pythondef use_dict(): var dictionary = Python.dict() dictionary["item_name"] = "whizbang" dictionary["price"] = 11.75 dictionary["inventory"] = 100 print(dictionary) ``` ### Mojo wrapper objects​ When you use Python objects in your Mojo code, Mojo adds the PythonObject wrapper around the Python object. This object exposes a number of common double underscore methods (dunder methods) like __getitem__() and __getattr__(), passing them through to the underlying Python object. PythonObject __getitem__() __getattr__() You can explicitly create a wrapped Python object by initializing a PythonObject with a Mojo literal: PythonObject ```mojo from python import PythonObjectvar py_list: PythonObject = [1, 2, 3, 4] ``` Most of the time, you can treat the wrapped object just like you'd treat it in Python. You can use Python's [] operators to access an item in a list, and use dot-notation to access attributes and call methods. For example: [] ```mojo var n = py_list[2]py_list.append(5) ``` If you want to construct a Python type that doesn't have a literal Mojo equivalent, you can also use the Python.evaluate() method. For example, to create a Python set: Python.evaluate() set ```mojo def use_py_set(): var py_set = Python.evaluate('set([2, 3, 5, 7, 11])') var num_items = len(py_set) print(num_items, " items in set.") # prints "5 items in set" print(py_set.__contains__(6)) # prints "False" ``` TODO: You should be able to use the expression 6 in py_set. However, because of the way PythonObject currently works, you need to call the __contains__() method directly. 6 in py_set PythonObject __contains__() Some Mojo APIs handle PythonObject just fine, but sometimes you'll need to explicitly convert a Python value into a native Mojo value. PythonObject Currently PythonObject conforms to the Intable, Stringable, and Boolable traits, which means you can convert Python values to Mojo Int, String, and Bool types using the built-in int(), str(), and bool() functions, and print Python values using the built-in print() function. PythonObject Intable Stringable Boolable Int String Bool int() str() bool() print() PythonObject also provides the to_float64() for converting to a Mojo floating point value. PythonObject to_float64() ```mojo var i: Int = int(py_int)var s: String = str(py_string)var b: Bool = bool(py_bool)var f: Float64 = py_float.to_float64() ``` ### Comparing Python types in Mojo​ In conditionals, Python objects act like you'd expect them to: Python values like False and None evaluate as false in Mojo, too. False None If you need to know the type of the underlying Python object, you can use the Python.type() method, which is equivalent to the Python type() builtin. You can compare the identity of two Python objects using the Python.is_type() method (which is equivalent to the Python is operator): Python.type() type() Python.is_type() is ```mojo def python_types(): from python import Python from python import PythonObject var value1: PythonObject = 3.7 var value2 = Python.evaluate("10/3") var float_type = Python.evaluate("float") print(Python.type(value1)) # <class 'float'> print(Python.is_type(Python.type(value1), Python.type(value2))) # True print(Python.is_type(Python.type(value1), float_type)) # True print(Python.is_type(Python.type(value1), Python.none())) # False ``` One TODO item here: The Python.is_type() method is misleadingly named, since it doesn't compare types, but object identity. Python.is_type() ## Further reading​ For more information, see Using Mojo with Python on the Modular Blog. - Mojo types in Python - Python types in MojoMojo wrapper objectsComparing Python types in Mojo - Mojo wrapper objects - Comparing Python types in Mojo - Further reading - Mojo wrapper objects - Comparing Python types in Mojo - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/ - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /Decorators # Mojo decorators A Mojo decorator is a higher-order function that modifies or extends the behavior of a struct, a function, or some other code. Instead of actually calling the higher-order function, you simply add the decorator (such as the @value decorator) above your code (such as a struct). The Mojo compiler then uses the decorator function to modify your code at compile time. @value The creation of custom decorators is not yet supported. The available ones are built directly into the compiler. The following pages describe each built-in decorator with examples. ## @always_inline @always_inline Copies the body of a function directly into the body of the calling function. ## @__copy_capture @__copy_capture Captures register-passable typed values by copy. ## @nonmaterializable @nonmaterializable Declares that a type should exist only in the parameter domain. ## @parameter @parameter Executes a function or if statement at compile time. ## @register_passable @register_passable Declares that a type should be passed in machine registers. ## @staticmethod @staticmethod Declares a struct method as static. ## @value @value Generates boilerplate lifecycle methods for a struct. - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/always-inline - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@always_inline # @always_inline You can add the @always_inline decorator on any function to make the Mojo compiler "inline" the body of the function (copy it) directly into the body of the calling function. @always_inline This eliminates potential performance costs associated with function calls jumping to a new point in code. Normally, the compiler will do this automatically where it can improve performance, but this decorator forces it to do so. The downside is that it can increase the binary size by duplicating the function at every call site. For example: ```mojo @always_inlinefn add(a: Int, b: Int) -> Int: return a + bprint(add(1, 2)) ``` Because add() is decorated with @always_inline, Mojo compiles this program without adding the add() function to the call stack, and it instead performs the addition directly at the print() call site, as if it were written like this: add() @always_inline add() print() ```mojo print(1 + 2) ``` ## @always_inline("nodebug")​ @always_inline("nodebug") You can also use the decorator with the "nodebug" argument, which has the same effect to inline the function, but without debug information. This means that you can't step into the function when debugging. "nodebug" This decorator is intended to be used on the lowest-level functions in a library, which may wrap primitive functions, MLIR operations, or inline assembly. Marking these functions as "nodebug" prevents users from accidentally stepping into low-level non-Mojo code when debugging. - @always_inline("nodebug") @always_inline("nodebug") - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/copy-capture - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@__copy_capture # @__copy_capture You can add the __copy_capture decorator on a parametric closure to capture register-passable values by copy. This decorator causes a nested function to copy the value of the indicated variable into the closure object at the point of formation instead of capturing that variable by reference. This allows the closure to be passed as an escaping function, without lifetime concerns. __copy_capture ```mojo fn foo(x: Int): var z = x @__copy_capture(z) @parameter fn formatter() -> Int: return z z = 2 print(formatter()) fn main(): foo(5) ``` - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/nonmaterializable - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@nonmaterializable # @nonmaterializable You can add the @nonmaterializable decorator on a struct to declare that the type can exist only in the parameter domain (it can be used for metaprogramming only, and not as a runtime type). And, if an instance of this type does transition into the runtime domain, this decorator declares what type it becomes there. @nonmaterializable To use it, declare your type with @nonmaterializable(TargetType), where TargetType is the type that the object should convert to if it becomes a runtime value (you must declare the TargetType). For example, if a struct is marked as @nonmaterializable(Foo), then anywhere that it goes from a parameter value to a runtime value, it automatically converts into the Foo type. @nonmaterializable(TargetType) TargetType TargetType @nonmaterializable(Foo) Foo For example, the following NmStruct type can be used in the parameter domain, but the converted_to_has_bool instance of it is converted to HasBool when it's materialized as a runtime value: NmStruct converted_to_has_bool HasBool ```mojo @value@register_passable("trivial")struct HasBool: var x: Bool fn __init__(inout self, x: Bool): self.x = x @always_inline("nodebug") fn __init__(inout self, nms: NmStruct): self.x = True if (nms.x == 77) else False@value@nonmaterializable(HasBool)@register_passable("trivial")struct NmStruct: var x: Int @always_inline("nodebug") fn __add__(self: Self, rhs: Self) -> Self: return NmStruct(self.x + rhs.x)alias still_nm_struct = NmStruct(1) + NmStruct(2)# When materializing to a run-time variable, it is automatically converted,# even without a type annotation.var converted_to_has_bool = still_nm_struct ``` A non-materializable struct must have all of its methods annotated as @always_inline, and it must be computable in the parameter domain. @always_inline - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/staticmethod - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@staticmethod # @staticmethod You can add the @staticmethod decorator on a struct method to declare a static method. @staticmethod For example: ```mojo from tensor import Tensorfrom pathlib import Pathstruct MyStruct: var data: Tensor[DType.int8] fn __init__(inout self): self.data = Tensor[DType.int8]() fn __moveinit__(inout self, owned existing: Self): self.data = existing.data ^ @staticmethod fn load_from_file(file_path: Path) raises -> Self: var new_struct = MyStruct() new_struct.data = file_path.read_bytes() return new_struct ^ ``` Unlike an instance method, a static method doesn't take an implicit self argument. It's not attached to a specific instance of a struct, so it can't access instance data. self For more information see the documentation on static methods. - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/lifecycle/life#move-constructors - Home - MAX - Mojo - Modular CLI - Introduction - Why Mojo - Get started - Language basicsIntroduction to MojoFunctionsVariablesTypesControl flowStructsModules and packages - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Value ownershipIntro to value ownershipValue semanticsOwnership and borrowing - Intro to value ownership - Value semantics - Ownership and borrowing - Value lifecycleIntro to value lifecycleLife of a valueDeath of a value - Intro to value lifecycle - Life of a value - Death of a value - Traits and parametersTraitsParameterization: compile-time metaprogramming - Traits - Parameterization: compile-time metaprogramming - PointersUnsafe pointers - Unsafe pointers - PythonPython integrationPython types - Python integration - Python types - ToolsDebuggingTesting - Debugging - Testing - ProjectRoadmap & sharp edgesChangelogFAQCommunity - Roadmap & sharp edges - Changelog - FAQ - Community - Introduction to Mojo - Functions - Variables - Types - Control flow - Structs - Modules and packages - Intro to value ownership - Value semantics - Ownership and borrowing - Intro to value lifecycle - Life of a value - Death of a value - Traits - Parameterization: compile-time metaprogramming - Unsafe pointers - Python integration - Python types - Debugging - Testing - Roadmap & sharp edges - Changelog - FAQ - Community - Mojo - /Manual - /Value lifecycle - /Life of a value # Life of a value The life of a value in Mojo begins when a variable is initialized and continues up until the value is last used, at which point Mojo destroys it. This page describes how every value in Mojo is created, copied, and moved. (The next page describes how values are destroyed.) All data types in Mojo—including basic types in the standard library such as Bool, Int, and String, up to complex types such as SIMD and object—are defined as a struct. This means the creation and destruction of any piece of data follows the same lifecycle rules, and you can define your own data types that work exactly the same way. Bool Int String SIMD object Mojo structs don't get any default lifecycle methods, such as a constructor, copy constructor, or move constructor. That means you can create a struct without a constructor, but then you can't instantiate it, and it would be useful only as a sort of namespace for static methods. For example: ```mojo struct NoInstances: var state: Int @staticmethod fn print_hello(): print("Hello world!") ``` Without a constructor, this cannot be instantiated, so it has no lifecycle. The state field is also useless because it cannot be initialized (Mojo structs do not support default field values—you must initialize them in a constructor). state So the only thing you can do is call the static method: ```mojo NoInstances.print_hello() ``` ## Constructor​ To create an instance of a Mojo type, it needs the __init__() constructor method. The main responsibility of the constructor is to initialize all fields. For example: __init__() ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age ``` Now we can create an instance: ```mojo var mine = MyPet("Loki", 4) ``` An instance of MyPet can also be borrowed and destroyed, but it currently can't be copied or moved. MyPet We believe this is a good default starting point, because there are no built-in lifecycle events and no surprise behaviors. You—the type author—must explicitly decide whether and how the type can be copied or moved, by implementing the copy and move constructors. Mojo does not require a destructor to destroy an object. As long as all fields in the struct are destructible (every type in the standard library is destructible, except for pointers), then Mojo knows how to destroy the type when its lifetime ends. We'll discuss that more in Death of a value. ### Overloading the constructor​ Like any other function/method, you can overload the __init__() constructor to initialize the object with different arguments. For example, you might want a default constructor that sets some default values and takes no arguments, and then additional constructors that accept more arguments. __init__() Just be aware that, in order to modify any fields, each constructor must declare the self argument with the inout convention. If you want to call one constructor from another, you simply call upon that constructor as you would externally (you don't need to pass self). self inout self For example, here's how you can delegate work from an overloaded constructor: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self): self.name = "" self.age = 0 fn __init__(inout self, name: String): self = MyPet() self.name = name ``` ### Field initialization​ Notice in the previous example that, by the end of each constructor, all fields must be initialized. That's the only requirement in the constructor. In fact, the __init__() constructor is smart enough to treat the self object as fully initialized even before the constructor is finished, as long as all fields are initialized. For example, this constructor can pass around self as soon as all fields are initialized: __init__() self self ```mojo fn use(arg: MyPet): passstruct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int, cond: Bool): self.name = name if cond: self.age = age use(self) # Safe to use immediately! self.age = age use(self) # Safe to use immediately! ``` ### Constructors and implicit conversion​ Mojo supports implicit conversion from one type to another. Implicit conversion can happen when one of the following occurs: - You assign a value of one type to a variable with a different type. - You pass a value of one type to a function that requires a different type. In both cases, implicit conversion is supported when the target type defines a constructor that takes a single required, non-keyword argument of the source type. For example: ```mojo var a = Source()var b: Target = a ``` Mojo implicitly converts the Source value in a to a Target value if Target defines a matching constructor like this: Source a Target Target ```mojo struct Target: fn __init__(inout self, s: Source): ... ``` With implicit conversion, the assignment above is essentially identical to: ```mojo var b = Target(a) ``` The constructor used for implicit conversion can take optional arguments, so the following constructor would also support implicit conversion from Source to Target: Source Target ```mojo struct Target: fn __init__(inout self, s: Source, reverse: Bool = False): ... ``` Implicit conversion also occurs if the type doesn't declare its own constructor, but instead uses the @value decorator, and the type has only one field. That's because Mojo automatically creates a member-wise constructor for each field, and when there is only one field, that synthesized constructor works exactly like a conversion constructor. For example, this type also can convert a Source value to a Target value: @value Source Target ```mojo @valuestruct Target: var s: Source ``` Implicit conversion can fail if Mojo can't unambiguously match the conversion to a constructor. For example, if the target type has two overloaded constructors that take different types, and each of those types supports an implicit conversion from the source type, the compiler has two equally-valid paths to convert the values: ```mojo struct A: fn __init__(inout self, s: Source): ...struct B: fn __init__(inout self, s: Source): ...struct Target: fn __init__(inout self, a: A): ... fn __init__(inout self, b: B): ...# Failsvar t = Target(Source()) ``` In this case, removing either one of the target type's constructors will fix the problem. If you want to define a single-argument constructor, but you don't want the types to implicitly convert, you can define the constructor with a keyword-only argument: ```mojo struct Target: # does not support implicit conversion fn __init__(inout self, *, source: Source): ...# the constructor must be called with a keywordvar t = Target(source=a) ``` In the future we intend to provide a more explicit method of declaring whether a constructor should support implicit conversion. ## Copy constructor​ When Mojo encounters an assignment operator (=), it tries to make a copy of the right-side value by calling upon that type's copy constructor: the __copyinit__() method. Thus, it's the responsibility of the type author to implement __copyinit__() so it returns a copy of the value. = __copyinit__() __copyinit__() For example, the MyPet type above does not have a copy constructor, so this code fails to compile: MyPet ```mojo var mine = MyPet("Loki", 4)var yours = mine # This requires a copy, but MyPet has no copy constructor ``` To make it work, we need to add the copy constructor, like this: ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, name: String, age: Int): self.name = name self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age ``` Self (capital "S") is an alias for the current type name (MyPet, in this example). Using this alias is a best practice to avoid any mistakes when referring to the current struct name. Self MyPet Also, notice that the existing argument in __copyinit__() is immutable because the default argument convention in an fn function is borrowed—this is a good thing because this function should not modify the contents of the value being copied. existing __copyinit__() fn borrowed Now this code works to make a copy: ```mojo var mine = MyPet("Loki", 4)var yours = mine ``` What makes Mojo's copy behavior different, compared to other languages, is that __copyinit__() is designed to perform a deep copy of all fields in the type (as per value semantics). That is, it copies heap-allocated values, rather than just copying the pointer. __copyinit__() However, the Mojo compiler doesn't enforce this, so it's the type author's responsibility to implement __copyinit__() with value semantics. For example, here's a new HeapArray type that performs a deep copy in the copy constructor: __copyinit__() HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int var cap: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.cap = size * 2 self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.cap = existing.cap self.data = Pointer[Int].alloc(self.cap) for i in range(self.size): self.data.store(i, existing.data.load(i)) # The lifetime of `existing` continues unchanged fn __del__(owned self): # We must free the heap-allocated data, but # Mojo knows how to destroy the other fields self.data.free() fn append(inout self, val: Int): # Update the array for demo purposes if self.size < self.cap: self.data.store(self.size, val) self.size += 1 else: print("Out of bounds") fn dump(self): # Print the array contents for demo purposes print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` Notice that __copyinit__() does not copy the Pointer value (doing so would make the copied value refer to the same data memory address as the original value, which is a shallow copy). Instead, we initialize a new Pointer to allocate a new block of memory, and then copy over all the heap-allocated values (this is a deep copy). __copyinit__() Pointer data Pointer Thus, when we copy an instance of HeapArray, each copy has its own value on the heap, so changes to one value do not affect the other, as shown here: HeapArray ```mojo fn copies(): var a = HeapArray(2, 1) var b = a # Calls the copy constructor a.dump() # Prints [1, 1] b.dump() # Prints [1, 1] b.append(2) # Changes the copied data b.dump() # Prints [1, 1, 2] a.dump() # Prints [1, 1] (the original did not change) ``` In HeapArray, we must use the __del__() destructor to free the heap-allocated data when the HeapArray lifetime ends, but Mojo automatically destroys all other fields when their respective lifetimes end. We'll discuss this destructor more in Death of a value. HeapArray __del__() HeapArray If your type doesn't use any pointers for heap-allocated data, then writing the constructor and copy constructor is all boilerplate code that you shouldn't have to write. For most structs that don't manage memory explicitly, you can just add the @value decorator to your struct definition and Mojo will synthesize the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() Mojo also calls upon the copy constructor when a value is passed to a function that takes the argument as owned and when the lifetime of the given value does not end at that point. If the lifetime of the value does end there (usually indicated with the transfer operator ^), then Mojo instead invokes the move constructor. owned ^ ## Move constructor​ Although copying values provides predictable behavior that matches Mojo's value semantics, copying some data types can be a significant hit on performance. If you're familiar with reference semantics, then the solution here might seem clear: instead of making a copy when passing a value, share the value as a reference. And if the original variable is no longer needed, nullify the original to avoid any double-free or use-after-free errors. That's generally known as a move operation: the memory block holding the data remains the same (the memory does not actually move), but the pointer to that memory moves to a new variable. To support moving a value, implement the __moveinit__() method. The __moveinit__() method performs a consuming move: it transfers ownership of a value from one variable to another when the original variable's lifetime ends (also called a "destructive move"). __moveinit__() __moveinit__() A move constructor is not required to transfer ownership of a value. Unlike in Rust, transferring ownership is not always a move operation; the move constructors are only part of the implementation for how Mojo transfers ownership of a value. You can learn more in the section about ownership transfer. When a move occurs, Mojo immediately invalidates the original variable, preventing any access to it and disabling its destructor. Invalidating the original variable is important to avoid memory errors on heap-allocated data, such as use-after-free and double-free errors. Here's how to add the move constructor to the HeapArray example: HeapArray ```mojo struct HeapArray: var data: Pointer[Int] var size: Int fn __init__(inout self, size: Int, val: Int): self.size = size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, val) fn __copyinit__(inout self, existing: Self): # Deep-copy the existing value self.size = existing.size self.data = Pointer[Int].alloc(self.size) for i in range(self.size): self.data.store(i, existing.data.load(i)) fn __moveinit__(inout self, owned existing: Self): print("move") # Shallow copy the existing value self.size = existing.size self.data = existing.data # Then the lifetime of `existing` ends here, but # Mojo does NOT call its destructor fn __del__(owned self): self.data.free() fn dump(self): print("[", end="") for i in range(self.size): if i > 0: print(", ", end="") print(self.data.load(i), end="") print("]") ``` The critical feature of __moveinit__() is that it takes the incoming value as owned, meaning this method gets unique ownership of the value. Moreover, because this is a dunder method that Mojo calls only when performing a move (during ownership transfer), the existing argument is guaranteed to be a mutable reference to the original value, not a copy (unlike other methods that may declare an argument as owned, but might receive the value as a copy if the method is called without the ^ transfer operator). That is, Mojo calls this move constructor only when the original variable's lifetime actually ends at the point of transfer. __moveinit__() owned existing owned ^ Here's an example showing how to invoke the move constructor for HeapArray: HeapArray ```mojo fn moves(): var a = HeapArray(3, 1) a.dump() # Prints [1, 1, 1] var b = a^ # Prints "move"; the lifetime of `a` ends here b.dump() # Prints [1, 1, 1] #a.dump() # ERROR: use of uninitialized value 'a' ``` Notice that __moveinit__() performs a shallow copy of the existing field values (it copies the pointer, instead of allocating new memory on the heap), which is what makes it useful for types with heap-allocated values that are expensive to copy. __moveinit__() To go further and ensure your type can never be copied, you can make it "move-only" by implementing __moveinit__() and excluding __copyinit__(). A move-only type can be passed to other variables and passed into functions with any argument convention (borrowed, inout, and owned)—the only catch is that you must use the ^ transfer operator to end the lifetime of a move-only type when assigning it to a new variable or when passing it as an owned argument. __moveinit__() __copyinit__() borrowed inout owned ^ owned For types without heap-allocated fields, you get no real benefit from the move constructor. Making copies of simple data types on the stack, like integers, floats, and booleans, is very cheap. Yet, if you allow your type to be copied, then there's generally no reason to disallow moves, so you can synthesize both constructors by adding the @value decorator. @value ## Simple value types​ Because copy and move constructors are opt-in, Mojo provides great control for exotic use cases (such as for atomic values that should never be copied or moved), but most structs are simple aggregations of other types that should be easily copied and moved, and we don't want to write a lot of boilerplate constructors for those simple value types. To solve this, Mojo provides the @value decorator, which synthesizes the boilerplate code for the __init__(), __copyinit__(), and __moveinit__() methods. @value __init__() __copyinit__() __moveinit__() For example, consider a simple struct like this: ```mojo @valuestruct MyPet: var name: String var age: Int ``` Mojo sees the @value decorator and notices that you don't have a member-wise initializer (a constructor with arguments for each field), a copy constructor, or a move constructor, so it synthesizes them for you. The result is as if you had actually written this: @value ```mojo struct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String, age: Int): self.name = name^ self.age = age fn __copyinit__(inout self, existing: Self): self.name = existing.name self.age = existing.age fn __moveinit__(inout self, owned existing: Self): self.name = existing.name^ self.age = existing.age ``` Mojo synthesizes each lifecycle method only when it doesn't exist, so you can use @value and still define your own versions to override the default behavior. For example, it is fairly common to use the default member-wise and move constructor, but create a custom copy constructor. Another common pattern is to use @value to create a member-wise constructor, and add overloads that take different sets of arguments. For example, if you want to create a MyPet struct without specifying an age, you could add an overloaded constructor: @value @value MyPet ```mojo @valuestruct MyPet: var name: String var age: Int fn __init__(inout self, owned name: String): self.name = name^ self.age = 0 ``` Note that this overloaded constructor doesn't prevent the @value decorator from synthesizing the member-wise constructor. To override this default constructor, you'd need to add a constructor with the same signature as the default member-wise constructor. @value Something you can see in this code that we didn't mention yet is that the __init__() method takes all arguments as owned, because the constructor must take ownership to store each value. This is a useful micro-optimization and enables the use of move-only types. Trivial types like Int are also passed as owned, but because ownership doesn't mean anything for integers, we can elide that declaration and the transfer operator (^) for simplicity. The transfer operator is also just a formality in this case, because, even if it's not used with self.name = name^, the Mojo compiler will notice that name is last used here and convert this assignment into a move, instead of a copy+delete. __init__() owned Int owned ^ self.name = name^ name If your type contains any move-only fields, Mojo will not generate the copy constructor because it cannot copy those fields. Further, the @value decorator won't work at all if any of your members are neither copyable nor movable. For example, if you have something like Atomic in your struct, then it probably isn't a true value type, and you don't want the copy/move constructors anyway. @value Atomic Also notice that the MyPet struct above doesn't include the __del__() destructor (the @value decorator does not synthesize this), because Mojo doesn't need it to destroy fields, as discussed in Death of a value MyPet __del__() @value ## Trivial types​ So far, we've talked about values that live in memory, which means they have an identity (an address) that can be passed around among functions (passed "by reference"). This is great for most types, and it's a safe default for large objects with expensive copy operations. However, it's inefficient for tiny things like a single integer or floating point number. We call these types "trivial" because they are just "bags of bits" that should be copied, moved, and destroyed without invoking any custom lifecycle methods. Trivial types are the most common types that surround us, and from a language perspective, Mojo doesn’t need special support for these written in a struct. Usually, these values are so tiny that they should be passed around in CPU registers, not indirectly through memory. As such, Mojo provides a struct decorator to declare these types of values: @register_passable("trivial"). This decorator tells Mojo that the type should be copyable and movable but that it has no user-defined logic (no lifecycle methods) for doing this. It also tells Mojo to pass the value in CPU registers whenever possible, which has clear performance benefits. @register_passable("trivial") You'll see this decorator on types like Int in the standard library: Int ```mojo @register_passable("trivial")struct Int: var value: __mlir_type.index fn __init__(value: __mlir_type.index) -> Int: return Self {value: value} ... ``` We expect to use this decorator pervasively on Mojo standard library types, but it is safe to ignore for general application-level code. For more information, see the @register_passable documentation. @register_passable This decorator is due for reconsideration. Lack of custom copy/move/destroy logic and "passability in a register" are orthogonal concerns and should be split. This former logic should be subsumed into a more general @value("trivial") decorator, which is orthogonal from @register_passable. @value("trivial") @register_passable - ConstructorOverloading the constructorField initializationConstructors and implicit conversion - Overloading the constructor - Field initialization - Constructors and implicit conversion - Copy constructor - Move constructor - Simple value types - Trivial types - Overloading the constructor - Field initialization - Constructors and implicit conversion - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/parameter#parametric-if-statement - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@parameter # @parameter You can add the @parameter decorator on an if statement or on a nested function to run that code at compile time. @parameter if ## Parametric if statement​ You can add @parameter to any if condition that's based on a valid parameter expression (it's an expression that evaluates at compile time). This ensures that only the live branch of the if statement is compiled into the program, which can reduce your final binary size. For example: @parameter if if ```mojo @parameterif True: print("this will be included in the binary")else: print("this will be eliminated at compile time") ``` ## Parametric for statement​ You can add the @parameter decorator to an for loop to create a loop that's evaluated at compile time. The loop sequence and induction values must be a valid parameter expressions (that is, an expressions that evaluate at compile time). @parameter for This has the effect of "unrolling" the loop. ```mojo fn parameter_for[max: Int](): @parameter for i in range(max) @parameter if i == 10: print("found 10!") ``` Currently, @parameter for requires the sequence's __iter__ method to return a _StridedRangeIterator, meaning the induction variables must be Int. The intention is to lift these restrictions in the future. @parameter for __iter__ _StridedRangeIterator Int ### Compared to unroll()​ unroll() The Mojo standard library also includes a function called unroll() that unrolls a given function that you want to call repeatedly, but has some important differences when compared to the parametric for statement: unroll() for - The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. - The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. @parameter for unroll() The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. for for continue By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. unroll() Both unroll() and @parameter for unroll at the beginning of compilation, which might explode the size of the program that still needs to be compiled, depending on the amount of code that's unrolled. unroll() @parameter for ## Parametric closure​ You can add @parameter on a nested function to create a “parametric” capturing closure. This means you can create a closure function that captures values from the outer scope (regardless of whether they are variables or parameters), and then use that closure as a parameter. For example: @parameter ```mojo fn use_closure[func: fn(Int) capturing -> Int](num: Int) -> Int: return func(num)fn create_closure(): var x = 1 @parameter fn add(i: Int) -> Int: return x + i var y = use_closure[add](2) print(y)create_closure() ``` Without the @parameter decorator, you'll get a compiler error that says you "cannot use a dynamic value in call parameter"—referring to the use_closure[add](2) call—because the add() closure would still be dynamic. @parameter use_closure[add](2) add() This is an unsafe feature because we currently do not model the lifetimes of capture-by-reference. - Parametric if statement - Parametric for statementCompared to unroll() - Compared to unroll() - Parametric closure - Compared to unroll() unroll() - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/parameter#parametric-for-statement - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@parameter # @parameter You can add the @parameter decorator on an if statement or on a nested function to run that code at compile time. @parameter if ## Parametric if statement​ You can add @parameter to any if condition that's based on a valid parameter expression (it's an expression that evaluates at compile time). This ensures that only the live branch of the if statement is compiled into the program, which can reduce your final binary size. For example: @parameter if if ```mojo @parameterif True: print("this will be included in the binary")else: print("this will be eliminated at compile time") ``` ## Parametric for statement​ You can add the @parameter decorator to an for loop to create a loop that's evaluated at compile time. The loop sequence and induction values must be a valid parameter expressions (that is, an expressions that evaluate at compile time). @parameter for This has the effect of "unrolling" the loop. ```mojo fn parameter_for[max: Int](): @parameter for i in range(max) @parameter if i == 10: print("found 10!") ``` Currently, @parameter for requires the sequence's __iter__ method to return a _StridedRangeIterator, meaning the induction variables must be Int. The intention is to lift these restrictions in the future. @parameter for __iter__ _StridedRangeIterator Int ### Compared to unroll()​ unroll() The Mojo standard library also includes a function called unroll() that unrolls a given function that you want to call repeatedly, but has some important differences when compared to the parametric for statement: unroll() for - The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. - The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. @parameter for unroll() The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. for for continue By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. unroll() Both unroll() and @parameter for unroll at the beginning of compilation, which might explode the size of the program that still needs to be compiled, depending on the amount of code that's unrolled. unroll() @parameter for ## Parametric closure​ You can add @parameter on a nested function to create a “parametric” capturing closure. This means you can create a closure function that captures values from the outer scope (regardless of whether they are variables or parameters), and then use that closure as a parameter. For example: @parameter ```mojo fn use_closure[func: fn(Int) capturing -> Int](num: Int) -> Int: return func(num)fn create_closure(): var x = 1 @parameter fn add(i: Int) -> Int: return x + i var y = use_closure[add](2) print(y)create_closure() ``` Without the @parameter decorator, you'll get a compiler error that says you "cannot use a dynamic value in call parameter"—referring to the use_closure[add](2) call—because the add() closure would still be dynamic. @parameter use_closure[add](2) add() This is an unsafe feature because we currently do not model the lifetimes of capture-by-reference. - Parametric if statement - Parametric for statementCompared to unroll() - Compared to unroll() - Parametric closure - Compared to unroll() unroll() - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/parameter#compared-to-unroll - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@parameter # @parameter You can add the @parameter decorator on an if statement or on a nested function to run that code at compile time. @parameter if ## Parametric if statement​ You can add @parameter to any if condition that's based on a valid parameter expression (it's an expression that evaluates at compile time). This ensures that only the live branch of the if statement is compiled into the program, which can reduce your final binary size. For example: @parameter if if ```mojo @parameterif True: print("this will be included in the binary")else: print("this will be eliminated at compile time") ``` ## Parametric for statement​ You can add the @parameter decorator to an for loop to create a loop that's evaluated at compile time. The loop sequence and induction values must be a valid parameter expressions (that is, an expressions that evaluate at compile time). @parameter for This has the effect of "unrolling" the loop. ```mojo fn parameter_for[max: Int](): @parameter for i in range(max) @parameter if i == 10: print("found 10!") ``` Currently, @parameter for requires the sequence's __iter__ method to return a _StridedRangeIterator, meaning the induction variables must be Int. The intention is to lift these restrictions in the future. @parameter for __iter__ _StridedRangeIterator Int ### Compared to unroll()​ unroll() The Mojo standard library also includes a function called unroll() that unrolls a given function that you want to call repeatedly, but has some important differences when compared to the parametric for statement: unroll() for - The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. - The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. @parameter for unroll() The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. for for continue By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. unroll() Both unroll() and @parameter for unroll at the beginning of compilation, which might explode the size of the program that still needs to be compiled, depending on the amount of code that's unrolled. unroll() @parameter for ## Parametric closure​ You can add @parameter on a nested function to create a “parametric” capturing closure. This means you can create a closure function that captures values from the outer scope (regardless of whether they are variables or parameters), and then use that closure as a parameter. For example: @parameter ```mojo fn use_closure[func: fn(Int) capturing -> Int](num: Int) -> Int: return func(num)fn create_closure(): var x = 1 @parameter fn add(i: Int) -> Int: return x + i var y = use_closure[add](2) print(y)create_closure() ``` Without the @parameter decorator, you'll get a compiler error that says you "cannot use a dynamic value in call parameter"—referring to the use_closure[add](2) call—because the add() closure would still be dynamic. @parameter use_closure[add](2) add() This is an unsafe feature because we currently do not model the lifetimes of capture-by-reference. - Parametric if statement - Parametric for statementCompared to unroll() - Compared to unroll() - Parametric closure - Compared to unroll() unroll() - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/parameter#parametric-closure - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@parameter # @parameter You can add the @parameter decorator on an if statement or on a nested function to run that code at compile time. @parameter if ## Parametric if statement​ You can add @parameter to any if condition that's based on a valid parameter expression (it's an expression that evaluates at compile time). This ensures that only the live branch of the if statement is compiled into the program, which can reduce your final binary size. For example: @parameter if if ```mojo @parameterif True: print("this will be included in the binary")else: print("this will be eliminated at compile time") ``` ## Parametric for statement​ You can add the @parameter decorator to an for loop to create a loop that's evaluated at compile time. The loop sequence and induction values must be a valid parameter expressions (that is, an expressions that evaluate at compile time). @parameter for This has the effect of "unrolling" the loop. ```mojo fn parameter_for[max: Int](): @parameter for i in range(max) @parameter if i == 10: print("found 10!") ``` Currently, @parameter for requires the sequence's __iter__ method to return a _StridedRangeIterator, meaning the induction variables must be Int. The intention is to lift these restrictions in the future. @parameter for __iter__ _StridedRangeIterator Int ### Compared to unroll()​ unroll() The Mojo standard library also includes a function called unroll() that unrolls a given function that you want to call repeatedly, but has some important differences when compared to the parametric for statement: unroll() for - The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. - The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. The @parameter decorator operates on for loop expressions. The unroll() function is a higher-order function that takes a parametric closure (see below) and executes it a specified number of times. @parameter for unroll() The parametric for statement is more versatile, since you can do anything you can do in a for statement: including using arbitrary sequences, early-exiting from the loop, skipping iterations with continue and so on. for for continue By contrast, unroll() simply takes a function and a count, and executes the function the specified number of times. unroll() Both unroll() and @parameter for unroll at the beginning of compilation, which might explode the size of the program that still needs to be compiled, depending on the amount of code that's unrolled. unroll() @parameter for ## Parametric closure​ You can add @parameter on a nested function to create a “parametric” capturing closure. This means you can create a closure function that captures values from the outer scope (regardless of whether they are variables or parameters), and then use that closure as a parameter. For example: @parameter ```mojo fn use_closure[func: fn(Int) capturing -> Int](num: Int) -> Int: return func(num)fn create_closure(): var x = 1 @parameter fn add(i: Int) -> Int: return x + i var y = use_closure[add](2) print(y)create_closure() ``` Without the @parameter decorator, you'll get a compiler error that says you "cannot use a dynamic value in call parameter"—referring to the use_closure[add](2) call—because the add() closure would still be dynamic. @parameter use_closure[add](2) add() This is an unsafe feature because we currently do not model the lifetimes of capture-by-reference. - Parametric if statement - Parametric for statementCompared to unroll() - Compared to unroll() - Parametric closure - Compared to unroll() unroll() - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================ URL: https://docs.modular.com/mojo/manual/decorators/always-inline#always_inlinenodebug - Home - MAX - Mojo - Modular CLI - Standard libraryModule indexalgorithmbase64benchmarkbitbufferbuiltincollectionscomplexmathmemoryospathlibpythonrandomstatsystempfiletensortestingtimeutils - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - DecoratorsDecorators@always_inline@__copy_capture@nonmaterializable@parameter@register_passable@staticmethod@value - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - Mojo CLImojomojo buildmojo debugmojo demanglemojo docmojo formatmojo packagemojo replmojo runmojo test - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Module index - algorithm - base64 - benchmark - bit - buffer - builtin - collections - complex - math - memory - os - pathlib - python - random - stat - sys - tempfile - tensor - testing - time - utils - Decorators - @always_inline - @__copy_capture - @nonmaterializable - @parameter - @register_passable - @staticmethod - @value - mojo - mojo build - mojo debug - mojo demangle - mojo doc - mojo format - mojo package - mojo repl - mojo run - mojo test - Mojo - /APIs - /Decorators - /@always_inline # @always_inline You can add the @always_inline decorator on any function to make the Mojo compiler "inline" the body of the function (copy it) directly into the body of the calling function. @always_inline This eliminates potential performance costs associated with function calls jumping to a new point in code. Normally, the compiler will do this automatically where it can improve performance, but this decorator forces it to do so. The downside is that it can increase the binary size by duplicating the function at every call site. For example: ```mojo @always_inlinefn add(a: Int, b: Int) -> Int: return a + bprint(add(1, 2)) ``` Because add() is decorated with @always_inline, Mojo compiles this program without adding the add() function to the call stack, and it instead performs the addition directly at the print() call site, as if it were written like this: add() @always_inline add() print() ```mojo print(1 + 2) ``` ## @always_inline("nodebug")​ @always_inline("nodebug") You can also use the decorator with the "nodebug" argument, which has the same effect to inline the function, but without debug information. This means that you can't step into the function when debugging. "nodebug" This decorator is intended to be used on the lowest-level functions in a library, which may wrap primitive functions, MLIR operations, or inline assembly. Marking these functions as "nodebug" prevents users from accidentally stepping into low-level non-Mojo code when debugging. - @always_inline("nodebug") @always_inline("nodebug") - What is MAX - Install MAX - Mojo Manual - Changelog - Sign up - Company - Blog - Careers ================================================================================